From: Cris Di Sclafani Date: Thu, 29 Oct 2020 09:36:31 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=5c16d2dec98b26edd2737b92a649a09026b14ea2;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index beeca61..2b46bbd 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-29T09:28:42.748Z", "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 7b269a6..b010107 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 _0x8acb=['sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x87e03a,_0x164a98){var _0x31ecc7=function(_0x496357){while(--_0x496357){_0x87e03a['push'](_0x87e03a['shift']());}};_0x31ecc7(++_0x164a98);}(_0x8acb,0x17a));var _0xb8ac=function(_0x30ca29,_0x31ca7c){_0x30ca29=_0x30ca29-0x0;var _0x257e00=_0x8acb[_0x30ca29];return _0x257e00;};'use strict';var Sequelize=require(_0xb8ac('0x0'));module[_0xb8ac('0x1')]={'name':{'type':Sequelize[_0xb8ac('0x2')],'get':function(_0xbe9e26){return this[_0xb8ac('0x3')](_0xb8ac('0x4'));}},'action':{'type':Sequelize[_0xb8ac('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb8ac('0x6'),'integration',_0xb8ac('0x7'),'jscripty',_0xb8ac('0x8'),'browser',_0xb8ac('0x9'),_0xb8ac('0xa')]],'msg':_0xb8ac('0xb')}},'comment':_0xb8ac('0xb')},'data1':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':_0xb8ac('0xc')},'data3':{'type':Sequelize[_0xb8ac('0x5')](0x1000),'comment':_0xb8ac('0xd')},'data4':{'type':Sequelize[_0xb8ac('0x5')](0x1000)},'data5':{'type':Sequelize[_0xb8ac('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5d5d=['motionbar[NULL,NULL,WinAppArguments]','sequelize','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x352aae,_0xa0e017){var _0x898326=function(_0x326988){while(--_0x326988){_0x352aae['push'](_0x352aae['shift']());}};_0x898326(++_0xa0e017);}(_0x5d5d,0xd3));var _0xd5d5=function(_0x21a242,_0x33dc60){_0x21a242=_0x21a242-0x0;var _0x5cb103=_0x5d5d[_0x21a242];return _0x5cb103;};'use strict';var Sequelize=require(_0xd5d5('0x0'));module['exports']={'name':{'type':Sequelize[_0xd5d5('0x1')],'get':function(_0x39680e){return this['getDataValue'](_0xd5d5('0x2'));}},'action':{'type':Sequelize[_0xd5d5('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd5d5('0x4'),_0xd5d5('0x5'),_0xd5d5('0x6'),_0xd5d5('0x7'),_0xd5d5('0x8'),'browser',_0xd5d5('0x9'),_0xd5d5('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xd5d5('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xd5d5('0xc')},'data2':{'type':Sequelize[_0xd5d5('0x3')](0x1000),'comment':_0xd5d5('0xd')},'data3':{'type':Sequelize[_0xd5d5('0x3')](0x1000),'comment':_0xd5d5('0xe')},'data4':{'type':Sequelize[_0xd5d5('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xd5d5('0x3')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index edb8eef..a15a807 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 _0x9813=['sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','Action','find','catch','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x9813,0xff));var _0x3981=function(_0x1abc5f,_0x1d28da){_0x1abc5f=_0x1abc5f-0x0;var _0x57a641=_0x9813[_0x1abc5f];return _0x57a641;};'use strict';var pdf=require(_0x3981('0x0'));var emlformat=require(_0x3981('0x1'));var rimraf=require(_0x3981('0x2'));var zipdir=require(_0x3981('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3981('0x4'));var moment=require(_0x3981('0x5'));var BPromise=require(_0x3981('0x6'));var Mustache=require(_0x3981('0x7'));var util=require(_0x3981('0x8'));var path=require(_0x3981('0x9'));var sox=require(_0x3981('0xa'));var csv=require(_0x3981('0xb'));var ejs=require(_0x3981('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3981('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3981('0xe'));var toCsv=require(_0x3981('0xb'));var querystring=require(_0x3981('0xf'));var Papa=require(_0x3981('0x10'));var Redis=require(_0x3981('0x11'));var authService=require(_0x3981('0x12'));var qs=require(_0x3981('0x13'));var as=require(_0x3981('0x14'));var hardwareService=require(_0x3981('0x15'));var logger=require(_0x3981('0x16'))(_0x3981('0x17'));var utils=require(_0x3981('0x18'));var config=require(_0x3981('0x19'));var db=require(_0x3981('0x1a'))['db'];function respondWithStatusCode(_0x1f9699,_0x1e802c){_0x1e802c=_0x1e802c||0xcc;return function(_0x50c978){if(_0x50c978){return _0x1f9699[_0x3981('0x1b')](_0x1e802c);}return _0x1f9699[_0x3981('0x1c')](_0x1e802c)['end']();};}function respondWithResult(_0x538063,_0xc850b2){_0xc850b2=_0xc850b2||0xc8;return function(_0x4b9ec5){if(_0x4b9ec5){return _0x538063[_0x3981('0x1c')](_0xc850b2)[_0x3981('0x1d')](_0x4b9ec5);}};}function respondWithFilteredResult(_0x5259f9,_0x303e22){return function(_0x3c0c93){if(_0x3c0c93){var _0x52fcc7=_0x3c0c93[_0x3981('0x1e')],_0x1a5567=_0x303e22[_0x3981('0x1f')],_0x137591=_0x303e22[_0x3981('0x1f')]+_0x303e22[_0x3981('0x20')],_0x5c95fa;if(_0x137591>=_0x52fcc7){_0x137591=_0x52fcc7;_0x5c95fa=0xc8;}else{_0x5c95fa=0xce;}_0x5259f9[_0x3981('0x1c')](_0x5c95fa);return _0x5259f9[_0x3981('0x21')](_0x3981('0x22'),_0x1a5567+'-'+_0x137591+'/'+_0x52fcc7)[_0x3981('0x1d')](_0x3c0c93);}return null;};}function patchUpdates(_0x10519b){return function(_0x2972b6){try{jsonpatch['apply'](_0x2972b6,_0x10519b,!![]);}catch(_0x432aec){return BPromise[_0x3981('0x23')](_0x432aec);}return _0x2972b6['save']();};}function saveUpdates(_0xf92de3,_0x11f892){return function(_0x57d9dd){if(_0x57d9dd){return _0x57d9dd[_0x3981('0x24')](_0xf92de3)[_0x3981('0x25')](function(_0x1611b3){return _0x1611b3;});}return null;};}function removeEntity(_0x3abb4c,_0x18092d){return function(_0xad0722){if(_0xad0722){return _0xad0722[_0x3981('0x26')]()['then'](function(){_0x3abb4c[_0x3981('0x1c')](0xcc)[_0x3981('0x27')]();});}};}function handleEntityNotFound(_0x2b202a,_0x22231d){return function(_0x556618){if(!_0x556618){_0x2b202a[_0x3981('0x1b')](0x194);}return _0x556618;};}function handleError(_0x36b9be,_0x35febf){_0x35febf=_0x35febf||0x1f4;return function(_0x2ff15b){logger['error'](_0x2ff15b[_0x3981('0x28')]);if(_0x2ff15b[_0x3981('0x29')]){delete _0x2ff15b['name'];}_0x36b9be[_0x3981('0x1c')](_0x35febf)[_0x3981('0x2a')](_0x2ff15b);};}exports[_0x3981('0x24')]=function(_0x331403,_0x5ce549){if(_0x331403['body']['id']){delete _0x331403['body']['id'];}return db[_0x3981('0x2b')][_0x3981('0x2c')]({'where':{'id':_0x331403['params']['id']}})[_0x3981('0x25')](handleEntityNotFound(_0x5ce549,null))['then'](saveUpdates(_0x331403['body'],null))[_0x3981('0x25')](respondWithResult(_0x5ce549,null))[_0x3981('0x2d')](handleError(_0x5ce549,null));};exports[_0x3981('0x26')]=function(_0x139e90,_0xf97f94){return db[_0x3981('0x2b')][_0x3981('0x2c')]({'where':{'id':_0x139e90[_0x3981('0x2e')]['id']}})['then'](handleEntityNotFound(_0xf97f94,null))[_0x3981('0x25')](removeEntity(_0xf97f94,null))[_0x3981('0x2d')](handleError(_0xf97f94,null));}; \ No newline at end of file +var _0x775d=['update','then','error','name','send','body','Action','catch','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x181613,_0x43258d){var _0x314e4e=function(_0x35d78e){while(--_0x35d78e){_0x181613['push'](_0x181613['shift']());}};_0x314e4e(++_0x43258d);}(_0x775d,0xe1));var _0xd775=function(_0x28404a,_0x53d15){_0x28404a=_0x28404a-0x0;var _0x154835=_0x775d[_0x28404a];return _0x154835;};'use strict';var pdf=require(_0xd775('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd775('0x1'));var zipdir=require(_0xd775('0x2'));var jsonpatch=require(_0xd775('0x3'));var rp=require(_0xd775('0x4'));var moment=require(_0xd775('0x5'));var BPromise=require(_0xd775('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd775('0x7'));var sox=require(_0xd775('0x8'));var csv=require(_0xd775('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd775('0xa'));var squel=require(_0xd775('0xb'));var crypto=require('crypto');var jsforce=require(_0xd775('0xc'));var deskjs=require(_0xd775('0xd'));var toCsv=require(_0xd775('0x9'));var querystring=require(_0xd775('0xe'));var Papa=require(_0xd775('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd775('0x10'));var as=require(_0xd775('0x11'));var hardwareService=require(_0xd775('0x12'));var logger=require(_0xd775('0x13'))(_0xd775('0x14'));var utils=require(_0xd775('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f940f,_0x264630){_0x264630=_0x264630||0xcc;return function(_0x33dfde){if(_0x33dfde){return _0x4f940f[_0xd775('0x16')](_0x264630);}return _0x4f940f[_0xd775('0x17')](_0x264630)[_0xd775('0x18')]();};}function respondWithResult(_0x31d4a4,_0x3236d0){_0x3236d0=_0x3236d0||0xc8;return function(_0x3c3894){if(_0x3c3894){return _0x31d4a4['status'](_0x3236d0)['json'](_0x3c3894);}};}function respondWithFilteredResult(_0x16aa8a,_0x403acc){return function(_0x3cd782){if(_0x3cd782){var _0x29f29f=_0x3cd782[_0xd775('0x19')],_0x258bc2=_0x403acc[_0xd775('0x1a')],_0x1cf298=_0x403acc['offset']+_0x403acc[_0xd775('0x1b')],_0x56df0a;if(_0x1cf298>=_0x29f29f){_0x1cf298=_0x29f29f;_0x56df0a=0xc8;}else{_0x56df0a=0xce;}_0x16aa8a['status'](_0x56df0a);return _0x16aa8a[_0xd775('0x1c')](_0xd775('0x1d'),_0x258bc2+'-'+_0x1cf298+'/'+_0x29f29f)[_0xd775('0x1e')](_0x3cd782);}return null;};}function patchUpdates(_0x703569){return function(_0xe3b093){try{jsonpatch[_0xd775('0x1f')](_0xe3b093,_0x703569,!![]);}catch(_0x37fd63){return BPromise[_0xd775('0x20')](_0x37fd63);}return _0xe3b093['save']();};}function saveUpdates(_0x278986,_0x5391de){return function(_0x5db1d7){if(_0x5db1d7){return _0x5db1d7[_0xd775('0x21')](_0x278986)['then'](function(_0x17257b){return _0x17257b;});}return null;};}function removeEntity(_0x43e63a,_0x49aa59){return function(_0x523433){if(_0x523433){return _0x523433['destroy']()[_0xd775('0x22')](function(){_0x43e63a[_0xd775('0x17')](0xcc)[_0xd775('0x18')]();});}};}function handleEntityNotFound(_0x20e99d,_0x5cfdcf){return function(_0x689e6b){if(!_0x689e6b){_0x20e99d['sendStatus'](0x194);}return _0x689e6b;};}function handleError(_0x38af48,_0x2eed68){_0x2eed68=_0x2eed68||0x1f4;return function(_0x4a9816){logger[_0xd775('0x23')](_0x4a9816['stack']);if(_0x4a9816[_0xd775('0x24')]){delete _0x4a9816[_0xd775('0x24')];}_0x38af48[_0xd775('0x17')](_0x2eed68)[_0xd775('0x25')](_0x4a9816);};}exports[_0xd775('0x21')]=function(_0x104049,_0x31bcb7){if(_0x104049[_0xd775('0x26')]['id']){delete _0x104049[_0xd775('0x26')]['id'];}return db[_0xd775('0x27')]['find']({'where':{'id':_0x104049['params']['id']}})['then'](handleEntityNotFound(_0x31bcb7,null))[_0xd775('0x22')](saveUpdates(_0x104049[_0xd775('0x26')],null))[_0xd775('0x22')](respondWithResult(_0x31bcb7,null))[_0xd775('0x28')](handleError(_0x31bcb7,null));};exports['destroy']=function(_0x13e79e,_0x54fb55){return db[_0xd775('0x27')][_0xd775('0x29')]({'where':{'id':_0x13e79e[_0xd775('0x2a')]['id']}})[_0xd775('0x22')](handleEntityNotFound(_0x54fb55,null))[_0xd775('0x22')](removeEntity(_0x54fb55,null))['catch'](handleError(_0x54fb55,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index e115337..fab661d 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 _0xa278=['../../config/logger','api','bluebird','request-promise','path','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','util'];(function(_0x215454,_0x24d91f){var _0x14eb7c=function(_0x399011){while(--_0x399011){_0x215454['push'](_0x215454['shift']());}};_0x14eb7c(++_0x24d91f);}(_0xa278,0x184));var _0x8a27=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0xa278[_0x315b61];return _0x3521e8;};'use strict';var _=require(_0x8a27('0x0'));var util=require(_0x8a27('0x1'));var logger=require(_0x8a27('0x2'))(_0x8a27('0x3'));var moment=require('moment');var BPromise=require(_0x8a27('0x4'));var rp=require(_0x8a27('0x5'));var fs=require('fs');var path=require(_0x8a27('0x6'));var rimraf=require(_0x8a27('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a27('0x8'));module[_0x8a27('0x9')]=function(_0x3ba466,_0x228682){return _0x3ba466[_0x8a27('0xa')](_0x8a27('0xb'),attributes,{'tableName':_0x8a27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde9c=['bluebird','rimraf','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x56ab53,_0x1965a4){var _0x5b9734=function(_0x501c80){while(--_0x501c80){_0x56ab53['push'](_0x56ab53['shift']());}};_0x5b9734(++_0x1965a4);}(_0xde9c,0x92));var _0xcde9=function(_0x150d13,_0x1aaec3){_0x150d13=_0x150d13-0x0;var _0x436b72=_0xde9c[_0x150d13];return _0x436b72;};'use strict';var _=require(_0xcde9('0x0'));var util=require(_0xcde9('0x1'));var logger=require(_0xcde9('0x2'))(_0xcde9('0x3'));var moment=require('moment');var BPromise=require(_0xcde9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcde9('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xcde9('0x6')]=function(_0x401828,_0x5f1aa9){return _0x401828[_0xcde9('0x7')](_0xcde9('0x8'),attributes,{'tableName':_0xcde9('0x9'),'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 76f2c61..6351db3 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(_0x130422,_0x43a473){var _0x598367=function(_0x5e8180){while(--_0x5e8180){_0x130422['push'](_0x130422['shift']());}};_0x598367(++_0x43a473);}(_0xe706,0xa3));var _0x6e70=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0xe706[_0x3253f3];return _0x598c26;};'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(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 946d652..5306534 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 _0x3c44=['../../config/environment','put','update','/:id','isAuthenticated','exports','multer','connect-timeout','Router','../../components/interaction/service'];(function(_0xcaad19,_0x2fa6dc){var _0x397b45=function(_0x331437){while(--_0x331437){_0xcaad19['push'](_0xcaad19['shift']());}};_0x397b45(++_0x2fa6dc);}(_0x3c44,0x18c));var _0x43c4=function(_0x39d7c1,_0x3f1d0a){_0x39d7c1=_0x39d7c1-0x0;var _0x5ac8c2=_0x3c44[_0x39d7c1];return _0x5ac8c2;};'use strict';var multer=require(_0x43c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x43c4('0x1'));var express=require('express');var router=express[_0x43c4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x43c4('0x3'));var config=require(_0x43c4('0x4'));var controller=require('./action.controller');router[_0x43c4('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x43c4('0x6')]);router['delete'](_0x43c4('0x7'),auth[_0x43c4('0x8')](),controller['destroy']);module[_0x43c4('0x9')]=router; \ No newline at end of file +var _0x88ec=['Router','put','/:id','isAuthenticated','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x88ec,0x110));var _0xc88e=function(_0x54c3ff,_0x5d1b83){_0x54c3ff=_0x54c3ff-0x0;var _0x1952d8=_0x88ec[_0x54c3ff];return _0x1952d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc88e('0x0'));var timeout=require(_0xc88e('0x1'));var express=require(_0xc88e('0x2'));var router=express[_0xc88e('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0xc88e('0x4')](_0xc88e('0x5'),auth[_0xc88e('0x6')](),controller[_0xc88e('0x7')]);router[_0xc88e('0x8')](_0xc88e('0x5'),auth['isAuthenticated'](),controller[_0xc88e('0x9')]);module[_0xc88e('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index bd03d0b..58d1508 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 _0x5658=['STRING','TEXT','sequelize'];(function(_0x753dd1,_0x3c1670){var _0x262c9c=function(_0x27d319){while(--_0x27d319){_0x753dd1['push'](_0x753dd1['shift']());}};_0x262c9c(++_0x3c1670);}(_0x5658,0x164));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x8565('0x0'));module['exports']={'name':{'type':Sequelize[_0x8565('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8565('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8565('0x2')]}}; \ No newline at end of file +var _0xb1ba=['STRING','TEXT','exports'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xb1ba,0x1bb));var _0xab1b=function(_0x12c092,_0x3f28de){_0x12c092=_0x12c092-0x0;var _0x387252=_0xb1ba[_0x12c092];return _0x387252;};'use strict';var Sequelize=require('sequelize');module[_0xab1b('0x0')]={'name':{'type':Sequelize[_0xab1b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xab1b('0x1')]},'table':{'type':Sequelize[_0xab1b('0x1')]},'conditions':{'type':Sequelize[_0xab1b('0x2')]},'joins':{'type':Sequelize[_0xab1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ee855f7..8bc8d1d 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 _0x9f94=['Run\x20Query:','toString','fork','../../components/export/','../../files/reports','savename','select','countTable','run','runReport','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','get','CustomReports','UserProfileResource','then','end','error','name','send','index','AnalyticCustomReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MIN(%s)','HOUR(%s)','parse','parentKey','clone','No\x20available\x20data','output','web','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x4062dc,_0x50af25){var _0x4248dd=function(_0x541fe8){while(--_0x541fe8){_0x4062dc['push'](_0x4062dc['shift']());}};_0x4248dd(++_0x50af25);}(_0x9f94,0x1e7));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var pdf=require(_0x49f9('0x0'));var emlformat=require(_0x49f9('0x1'));var rimraf=require(_0x49f9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49f9('0x3'));var moment=require(_0x49f9('0x4'));var BPromise=require(_0x49f9('0x5'));var Mustache=require(_0x49f9('0x6'));var util=require(_0x49f9('0x7'));var path=require('path');var sox=require(_0x49f9('0x8'));var csv=require(_0x49f9('0x9'));var ejs=require(_0x49f9('0xa'));var fs=require('fs');var _=require(_0x49f9('0xb'));var squel=require(_0x49f9('0xc'));var crypto=require(_0x49f9('0xd'));var jsforce=require(_0x49f9('0xe'));var deskjs=require(_0x49f9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49f9('0x10'));var Redis=require('ioredis');var authService=require(_0x49f9('0x11'));var qs=require(_0x49f9('0x12'));var as=require(_0x49f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49f9('0x14'))('api');var utils=require(_0x49f9('0x15'));var config=require(_0x49f9('0x16'));var db=require(_0x49f9('0x17'))['db'];var dbH=require(_0x49f9('0x17'))['dbH'];function respondWithStatusCode(_0x52c3fe,_0x446fb1){_0x446fb1=_0x446fb1||0xcc;return function(_0x9ed1f5){if(_0x9ed1f5){return _0x52c3fe[_0x49f9('0x18')](_0x446fb1);}return _0x52c3fe[_0x49f9('0x19')](_0x446fb1)['end']();};}function respondWithResult(_0x4e7790,_0x5f1577){_0x5f1577=_0x5f1577||0xc8;return function(_0x2a23dc){if(_0x2a23dc){return _0x4e7790['status'](_0x5f1577)[_0x49f9('0x1a')](_0x2a23dc);}};}function respondWithFilteredResult(_0x4b8228,_0x398a05){return function(_0x760ac){if(_0x760ac){var _0x482aa5=_0x760ac[_0x49f9('0x1b')],_0x45a376=_0x398a05[_0x49f9('0x1c')],_0x1a2026=_0x398a05[_0x49f9('0x1c')]+_0x398a05[_0x49f9('0x1d')],_0x24250f;if(_0x1a2026>=_0x482aa5){_0x1a2026=_0x482aa5;_0x24250f=0xc8;}else{_0x24250f=0xce;}_0x4b8228[_0x49f9('0x19')](_0x24250f);return _0x4b8228[_0x49f9('0x1e')](_0x49f9('0x1f'),_0x45a376+'-'+_0x1a2026+'/'+_0x482aa5)[_0x49f9('0x1a')](_0x760ac);}return null;};}function patchUpdates(_0x1971e3){return function(_0xa9b24c){try{jsonpatch[_0x49f9('0x20')](_0xa9b24c,_0x1971e3,!![]);}catch(_0x136836){return BPromise['reject'](_0x136836);}return _0xa9b24c['save']();};}function saveUpdates(_0x916ef5,_0x4884ef){return function(_0x3e8a62){if(_0x3e8a62){return _0x3e8a62['update'](_0x916ef5)['then'](function(_0x42c0aa){return _0x42c0aa;});}return null;};}function removeEntity(_0xde1383,_0x4e92e5){return function(_0x372347){if(_0x372347){return _0x372347['destroy']()['then'](function(){var _0xf2afb7=_0x372347[_0x49f9('0x21')]({'plain':!![]});var _0x5757d3=_0x49f9('0x22');return db[_0x49f9('0x23')]['destroy']({'where':{'type':_0x5757d3,'resourceId':_0xf2afb7['id']}})[_0x49f9('0x24')](function(){return _0x372347;});})[_0x49f9('0x24')](function(){_0xde1383[_0x49f9('0x19')](0xcc)[_0x49f9('0x25')]();});}};}function handleEntityNotFound(_0x4e6a90,_0xa559a2){return function(_0x3aff06){if(!_0x3aff06){_0x4e6a90[_0x49f9('0x18')](0x194);}return _0x3aff06;};}function handleError(_0x10da65,_0x28e56f){_0x28e56f=_0x28e56f||0x1f4;return function(_0x45e077){logger[_0x49f9('0x26')](_0x45e077['stack']);if(_0x45e077['name']){delete _0x45e077[_0x49f9('0x27')];}_0x10da65[_0x49f9('0x19')](_0x28e56f)[_0x49f9('0x28')](_0x45e077);};}exports[_0x49f9('0x29')]=function(_0x51adc3,_0x2d1e7d){var _0x76e1c6={},_0x1deb22={},_0x5c8fc5={'count':0x0,'rows':[]};var _0xc0a9aa=_['map'](db[_0x49f9('0x2a')][_0x49f9('0x2b')],function(_0x39f66a){return{'name':_0x39f66a['fieldName'],'type':_0x39f66a[_0x49f9('0x2c')][_0x49f9('0x2d')]};});_0x1deb22[_0x49f9('0x2e')]=_[_0x49f9('0x2f')](_0xc0a9aa,_0x49f9('0x27'));_0x1deb22[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x51adc3[_0x49f9('0x30')]);_0x1deb22[_0x49f9('0x32')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],_0x1deb22[_0x49f9('0x30')]);_0x76e1c6[_0x49f9('0x34')]=_[_0x49f9('0x33')](_0x1deb22[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x51adc3[_0x49f9('0x30')]['fields']));_0x76e1c6[_0x49f9('0x34')]=_0x76e1c6[_0x49f9('0x34')][_0x49f9('0x36')]?_0x76e1c6[_0x49f9('0x34')]:_0x1deb22['model'];if(!_0x51adc3['query'][_0x49f9('0x37')]('nolimit')){_0x76e1c6[_0x49f9('0x1d')]=qs[_0x49f9('0x1d')](_0x51adc3[_0x49f9('0x30')][_0x49f9('0x1d')]);_0x76e1c6[_0x49f9('0x1c')]=qs[_0x49f9('0x1c')](_0x51adc3[_0x49f9('0x30')]['offset']);}_0x76e1c6[_0x49f9('0x38')]=qs[_0x49f9('0x39')](_0x51adc3['query']['sort']);_0x76e1c6['where']=qs[_0x49f9('0x32')](_['pick'](_0x51adc3['query'],_0x1deb22[_0x49f9('0x32')]),_0xc0a9aa);if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3a')]){_0x76e1c6[_0x49f9('0x3b')]=_['merge'](_0x76e1c6[_0x49f9('0x3b')],{'$or':_['map'](_0xc0a9aa,function(_0x2e1277){if(_0x2e1277[_0x49f9('0x2c')]!==_0x49f9('0x3c')){var _0x33bac9={};_0x33bac9[_0x2e1277[_0x49f9('0x27')]]={'$like':'%'+_0x51adc3[_0x49f9('0x30')]['filter']+'%'};return _0x33bac9;}})});}_0x76e1c6=_['merge']({},_0x76e1c6,_0x51adc3[_0x49f9('0x3d')]);var _0x2fecb6={'where':_0x76e1c6[_0x49f9('0x3b')]};return db['AnalyticCustomReport'][_0x49f9('0x1b')](_0x2fecb6)[_0x49f9('0x24')](function(_0x4c656c){_0x5c8fc5['count']=_0x4c656c;if(_0x51adc3[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x76e1c6[_0x49f9('0x3f')]=[{'all':!![]}];}return db[_0x49f9('0x2a')]['findAll'](_0x76e1c6);})[_0x49f9('0x24')](function(_0x4b760e){_0x5c8fc5[_0x49f9('0x40')]=_0x4b760e;return _0x5c8fc5;})[_0x49f9('0x24')](respondWithFilteredResult(_0x2d1e7d,_0x76e1c6))[_0x49f9('0x41')](handleError(_0x2d1e7d,null));};exports[_0x49f9('0x42')]=function(_0x2693be,_0x1bc0c9){var _0x11398a={'raw':![],'where':{'id':_0x2693be['params']['id']}},_0x338974={};_0x338974[_0x49f9('0x2e')]=_[_0x49f9('0x31')](db[_0x49f9('0x2a')][_0x49f9('0x2b')]);_0x338974[_0x49f9('0x30')]=_[_0x49f9('0x31')](_0x2693be[_0x49f9('0x30')]);_0x338974['filters']=_[_0x49f9('0x33')](_0x338974['model'],_0x338974[_0x49f9('0x30')]);_0x11398a[_0x49f9('0x34')]=_['intersection'](_0x338974[_0x49f9('0x2e')],qs[_0x49f9('0x35')](_0x2693be['query'][_0x49f9('0x35')]));_0x11398a[_0x49f9('0x34')]=_0x11398a['attributes'][_0x49f9('0x36')]?_0x11398a[_0x49f9('0x34')]:_0x338974[_0x49f9('0x2e')];if(_0x2693be[_0x49f9('0x30')][_0x49f9('0x3e')]){_0x11398a[_0x49f9('0x3f')]=[{'all':!![]}];}_0x11398a=_['merge']({},_0x11398a,_0x2693be[_0x49f9('0x3d')]);return db['AnalyticCustomReport'][_0x49f9('0x43')](_0x11398a)[_0x49f9('0x24')](handleEntityNotFound(_0x1bc0c9,null))['then'](respondWithResult(_0x1bc0c9,null))[_0x49f9('0x41')](handleError(_0x1bc0c9,null));};exports[_0x49f9('0x44')]=function(_0x9649c5,_0x10b535){return db[_0x49f9('0x2a')][_0x49f9('0x44')](_0x9649c5[_0x49f9('0x45')],{})[_0x49f9('0x24')](function(_0x6936a3){var _0x2e62dd=_0x9649c5[_0x49f9('0x46')]['get']({'plain':!![]});if(!_0x2e62dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e62dd[_0x49f9('0x47')]===_0x49f9('0x46')){var _0x1a0bfe=_0x6936a3[_0x49f9('0x21')]({'plain':!![]});var _0xacd19a=_0x49f9('0x48');return db[_0x49f9('0x49')]['find']({'where':{'name':_0xacd19a,'userProfileId':_0x2e62dd[_0x49f9('0x4a')]},'raw':!![]})[_0x49f9('0x24')](function(_0x58060){if(_0x58060&&_0x58060[_0x49f9('0x4b')]===0x0){return db[_0x49f9('0x23')]['create']({'name':_0x1a0bfe['name'],'resourceId':_0x1a0bfe['id'],'type':'CustomReports','sectionId':_0x58060['id']},{})[_0x49f9('0x24')](function(){return _0x6936a3;});}else{return _0x6936a3;}})[_0x49f9('0x41')](function(_0x186db7){logger[_0x49f9('0x26')](_0x49f9('0x4c'),_0x186db7);throw _0x186db7;});}return _0x6936a3;})[_0x49f9('0x24')](respondWithResult(_0x10b535,0xc9))['catch'](handleError(_0x10b535,null));};exports[_0x49f9('0x4d')]=function(_0x57acbb,_0x2fa14c){if(_0x57acbb['body']['id']){delete _0x57acbb['body']['id'];}return db[_0x49f9('0x2a')]['find']({'where':{'id':_0x57acbb[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2fa14c,null))[_0x49f9('0x24')](saveUpdates(_0x57acbb[_0x49f9('0x45')],null))[_0x49f9('0x24')](respondWithResult(_0x2fa14c,null))[_0x49f9('0x41')](handleError(_0x2fa14c,null));};exports['destroy']=function(_0x5f649b,_0x2463ea){return db[_0x49f9('0x2a')][_0x49f9('0x43')]({'where':{'id':_0x5f649b[_0x49f9('0x4e')]['id']}})[_0x49f9('0x24')](handleEntityNotFound(_0x2463ea,null))[_0x49f9('0x24')](removeEntity(_0x2463ea,null))[_0x49f9('0x41')](handleError(_0x2463ea,null));};exports['preview']=function(_0x33d7d9,_0x594664){var _0x2ed3d2=0xa;var _0x249cfa=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0xbd2b8f={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x49f9('0x54'),'MIN':'MIN(%s)','AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x556287={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x55b708=function(_0x104174){return!_[_0x49f9('0x5c')]([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x104174);};var _0x568a90=function(_0x55579b){if(!_0x55579b||!_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x579800='(',_0x457c2f=0x0;_0x457c2f<_0x55579b[_0x49f9('0x61')][_0x49f9('0x36')];_0x457c2f+=0x1){_0x457c2f>0x0&&(_0x579800+='\x20'+_0x55579b[_0x49f9('0x62')]+'\x20');_0x579800+=_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x63')]?_0x568a90(_0x55579b['rules'][_0x457c2f][_0x49f9('0x63')]):_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x64')]+'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')]+(_0x55b708(_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x65')])?'\x20'+_0x55579b[_0x49f9('0x61')][_0x457c2f][_0x49f9('0x66')]:'');}return _0x579800+')';};var _0x34098e={'where':{'id':_0x33d7d9[_0x49f9('0x4e')]['id']}},_0x253edf,_0x2bd3ec,_0x3f3f26,_0x149159,_0x18e165;_0x34098e=_[_0x49f9('0x67')]({},_0x34098e,_0x33d7d9['options']);return db[_0x49f9('0x2a')]['find'](_0x34098e)['then'](function(_0x187494){if(_0x187494){_0x253edf=_0x187494;return _0x187494[_0x49f9('0x68')]();}return null;})[_0x49f9('0x24')](function(_0x564eca){if(_0x564eca){if(!_0x564eca['length']){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x2bd3ec=_0x564eca;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x2316e2){if(_0x2316e2){_0x3f3f26=_[_0x49f9('0x6d')](_0x2316e2,'id');var _0x5bdcef;var _0x3ae840=squel['select']();_0x3ae840[_0x49f9('0x6e')](_0x253edf[_0x49f9('0x6f')]);for(var _0x412060=0x0;_0x412060<_0x2bd3ec[_0x49f9('0x36')];_0x412060+=0x1){_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x70')]?_0x3f3f26[_0x2bd3ec[_0x412060]['MetricId']][_0x49f9('0x71')]:_0x2bd3ec[_0x412060][_0x49f9('0x64')];_0x5bdcef=_0x2bd3ec[_0x412060]['function']?_[_0x49f9('0x72')](_0xbd2b8f[_0x2bd3ec[_0x412060][_0x49f9('0x73')]],'%s',_0x5bdcef):_0x5bdcef;_0x5bdcef=_0x2bd3ec[_0x412060][_0x49f9('0x74')]?_[_0x49f9('0x72')](_0x556287[_0x2bd3ec[_0x412060]['format']],'%s',_0x5bdcef):_0x5bdcef;if(_0x2bd3ec[_0x412060][_0x49f9('0x75')]){_0x3ae840['group'](_0x5bdcef);}_0x2bd3ec[_0x412060][_0x49f9('0x76')]&&_0x3ae840[_0x49f9('0x38')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x3ae840[_0x49f9('0x64')](_0x5bdcef,_0x2bd3ec[_0x412060][_0x49f9('0x78')]||_0x5bdcef);}if(_0x253edf[_0x49f9('0x79')]){_0x253edf[_0x49f9('0x79')]=JSON['parse'](_0x253edf[_0x49f9('0x79')]);for(var _0x33642f=0x0;_0x33642f<_0x253edf['joins'][_0x49f9('0x36')];_0x33642f+=0x1){if(_0x253edf['joins'][_0x33642f][_0x49f9('0x2c')]&&_[_0x49f9('0x5c')](_0x249cfa,_0x253edf['joins'][_0x33642f]['type'])&&_0x253edf['joins'][_0x33642f]['parentKey']&&_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7a')]&&_0x253edf['joins'][_0x33642f][_0x49f9('0x7b')]){_0x3ae840[_0x253edf['joins'][_0x33642f]['type']](_0x253edf[_0x49f9('0x79')][_0x33642f]['foreignTable'],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x253edf['table'],_0x253edf['joins'][_0x33642f]['parentKey'],_0x253edf['joins'][_0x33642f]['foreignTable'],_0x253edf[_0x49f9('0x79')][_0x33642f][_0x49f9('0x7b')]));}}}if(_0x253edf['conditions']){_0x253edf[_0x49f9('0x7d')]=JSON['parse'](_0x253edf[_0x49f9('0x7d')]);_0x3ae840[_0x49f9('0x3b')](_0x568a90(_0x253edf[_0x49f9('0x7d')]['group']));}_0x18e165=_0x3ae840['clone']();_0x3ae840[_0x49f9('0x1d')](_0x2ed3d2);_0x3ae840['offset'](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x3ae840['toString']());return db['sequelize'][_0x49f9('0x30')](_0x3ae840['toString'](),{'type':db[_0x49f9('0x80')][_0x49f9('0x81')][_0x49f9('0x82')]});}})[_0x49f9('0x24')](respondWithResult(_0x594664,null))['catch'](handleError(_0x594664,null));};function runReport(_0x182bdc,_0x31c4a6,_0x6fc9c){var _0x2b7938=_0x31c4a6['name'];var _0x3f86cb=0xa;var _0x7410f1=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x5143e1={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':_0x49f9('0x54'),'MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':_0x49f9('0x58')};var _0x590cf3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':_0x49f9('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x205f43=function(_0x4e7a7e){return!_['includes']([_0x49f9('0x5d'),_0x49f9('0x5e'),_0x49f9('0x5f'),_0x49f9('0x60')],_0x4e7a7e);};var _0x3ae2b3=function(_0x323f41){if(!_0x323f41||!_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')]){return'';}for(var _0x27a4c9='(',_0x17aa19=0x0;_0x17aa19<_0x323f41[_0x49f9('0x61')][_0x49f9('0x36')];_0x17aa19+=0x1){_0x17aa19>0x0&&(_0x27a4c9+='\x20'+_0x323f41[_0x49f9('0x62')]+'\x20');_0x27a4c9+=_0x323f41['rules'][_0x17aa19][_0x49f9('0x63')]?_0x3ae2b3(_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x63')]):_0x323f41[_0x49f9('0x61')][_0x17aa19][_0x49f9('0x64')]+'\x20'+_0x323f41['rules'][_0x17aa19][_0x49f9('0x65')]+(_0x205f43(_0x323f41[_0x49f9('0x61')][_0x17aa19]['condition'])?'\x20'+_0x323f41['rules'][_0x17aa19]['value']:'');}return _0x27a4c9+')';};var _0xf037f0={'where':{'id':_0x182bdc['id']}},_0x7988b7,_0x471bd5,_0x396ee1,_0x486fac,_0xfc4a3e;_0xf037f0=_[_0x49f9('0x67')]({},_0xf037f0,_0x6fc9c);return db[_0x49f9('0x2a')]['find'](_0xf037f0)[_0x49f9('0x24')](function(_0x57b879){if(_0x57b879){_0x7988b7=_0x57b879;return _0x57b879[_0x49f9('0x68')]();}return null;})['then'](function(_0x4e5d45){if(_0x4e5d45){if(!_0x4e5d45[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x471bd5=_0x4e5d45;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x4db188){if(_0x4db188){_0x396ee1=_['keyBy'](_0x4db188,'id');var _0x4a66f8;var _0x4e732c=squel['select']();_0x4e732c[_0x49f9('0x6e')](_0x7988b7[_0x49f9('0x6f')]);for(var _0x3d045b=0x0;_0x3d045b<_0x471bd5[_0x49f9('0x36')];_0x3d045b+=0x1){_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x70')]?_0x396ee1[_0x471bd5[_0x3d045b]['MetricId']][_0x49f9('0x71')]:_0x471bd5[_0x3d045b][_0x49f9('0x64')];_0x4a66f8=_0x471bd5[_0x3d045b][_0x49f9('0x73')]?_[_0x49f9('0x72')](_0x5143e1[_0x471bd5[_0x3d045b][_0x49f9('0x73')]],'%s',_0x4a66f8):_0x4a66f8;_0x4a66f8=_0x471bd5[_0x3d045b]['format']?_['replace'](_0x590cf3[_0x471bd5[_0x3d045b][_0x49f9('0x74')]],'%s',_0x4a66f8):_0x4a66f8;if(_0x471bd5[_0x3d045b]['groupBy']){_0x4e732c['group'](_0x4a66f8);}_0x471bd5[_0x3d045b][_0x49f9('0x76')]&&_0x4e732c[_0x49f9('0x38')](_0x4a66f8,_0x471bd5[_0x3d045b]['orderBy']==='DESC'?![]:!![]);_0x4e732c[_0x49f9('0x64')](_0x4a66f8,_0x471bd5[_0x3d045b][_0x49f9('0x78')]||_0x4a66f8);}if(_0x7988b7[_0x49f9('0x79')]){_0x7988b7[_0x49f9('0x79')]=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x79')]);for(var _0x499280=0x0;_0x499280<_0x7988b7[_0x49f9('0x79')][_0x49f9('0x36')];_0x499280+=0x1){if(_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')]&&_['includes'](_0x7410f1,_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x2c')])&&_0x7988b7['joins'][_0x499280][_0x49f9('0x87')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7a')]&&_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x7b')]){_0x4e732c[_0x7988b7['joins'][_0x499280][_0x49f9('0x2c')]](_0x7988b7[_0x49f9('0x79')][_0x499280]['foreignTable'],null,util[_0x49f9('0x74')]('%s.%s\x20=\x20%s.%s',_0x7988b7['table'],_0x7988b7[_0x49f9('0x79')][_0x499280][_0x49f9('0x87')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7a')],_0x7988b7['joins'][_0x499280][_0x49f9('0x7b')]));}}}if(_0x7988b7[_0x49f9('0x7d')]){_0x7988b7['conditions']=JSON[_0x49f9('0x86')](_0x7988b7[_0x49f9('0x7d')]);_0x4e732c[_0x49f9('0x3b')](_0x3ae2b3(_0x7988b7['conditions'][_0x49f9('0x63')]));}_0xfc4a3e=_0x4e732c[_0x49f9('0x88')]();_0x4e732c['limit'](_0x3f86cb);_0x4e732c['offset'](0x0);logger['debug'](_0x49f9('0x7f'),_0x4e732c['toString']());return db['sequelize'][_0x49f9('0x30')](_0x4e732c['toString'](),{'type':db[_0x49f9('0x80')]['QueryTypes']['SELECT']});}})[_0x49f9('0x24')](function(_0x2111d4){if(!_0x2111d4[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))]['ValidationErrorItem'](_0x49f9('0x89'),0xcc);}if(_0x31c4a6[_0x49f9('0x8a')]===_0x49f9('0x8b')){return null;}var _0xf7b0aa=_[_0x49f9('0x67')](_0x31c4a6,{'name':_0x31c4a6['fullPath']||_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],'basename':_0x2b7938,'savename':util[_0x49f9('0x74')]('%s-%s.%s',_0x31c4a6[_0x49f9('0x27')]||_0x7988b7['name'],require(_0x49f9('0x8c'))[_0x49f9('0x8d')](0x4),_0x31c4a6[_0x49f9('0x8a')]||'csv'),'reportId':_0x7988b7['id'],'reportType':_0x49f9('0x8e')});return db[_0x49f9('0x8f')][_0x49f9('0x44')](_0xf7b0aa,{'raw':!![]});})[_0x49f9('0x24')](function(_0x4a4ae4){if(_0x7988b7[_0x49f9('0x6f')]==='cdr'){_0xfc4a3e[_0x49f9('0x3b')](_0x7988b7['table']+_0x49f9('0x90'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}else{_0xfc4a3e['where'](_0x7988b7[_0x49f9('0x6f')]+_0x49f9('0x93'),_0x31c4a6[_0x49f9('0x91')],_0x31c4a6[_0x49f9('0x92')]);}if(_0x4a4ae4){logger[_0x49f9('0x94')](_0x49f9('0x95'),_0xfc4a3e[_0x49f9('0x96')]());require('child_process')[_0x49f9('0x97')](path[_0x49f9('0x4f')](__dirname,_0x49f9('0x98'),_0x4a4ae4[_0x49f9('0x8a')]),[_0x4a4ae4['id'],_0xfc4a3e[_0x49f9('0x96')](),path['join'](__dirname,_0x49f9('0x99'),_0x4a4ae4[_0x49f9('0x9a')]),_0x2b7938]);return _0x4a4ae4;}else{var _0x1fe414=squel[_0x49f9('0x9b')]();_0x1fe414[_0x49f9('0x6e')]('('+_0xfc4a3e[_0x49f9('0x96')]()+')',_0x49f9('0x9c'));_0x1fe414[_0x49f9('0x64')]('COUNT(*)',_0x49f9('0x1b'));_0xfc4a3e['limit'](_0x31c4a6[_0x49f9('0x1d')]||_0x3f86cb);_0xfc4a3e[_0x49f9('0x1c')](_0x31c4a6[_0x49f9('0x1c')]||0x0);return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0x1fe414['toString'](),{'type':dbH[_0x49f9('0x80')]['QueryTypes']['SELECT']})[_0x49f9('0x24')](function(_0x17e21c){if(!_0x17e21c['length']){_0x486fac=0x0;}else{_0x486fac=_0x17e21c[0x0]['count']||0x0;}return dbH[_0x49f9('0x80')][_0x49f9('0x30')](_0xfc4a3e[_0x49f9('0x96')](),{'type':dbH['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});})[_0x49f9('0x24')](function(_0x210969){return{'rows':_0x210969||[],'count':_0x486fac};});}});}exports[_0x49f9('0x9d')]=function(_0x4d23da,_0x5a712d){return runReport(_0x4d23da[_0x49f9('0x4e')],_0x4d23da[_0x49f9('0x30')],_0x4d23da['options'])[_0x49f9('0x24')](respondWithResult(_0x5a712d,null))[_0x49f9('0x41')](handleError(_0x5a712d,null));};exports[_0x49f9('0x9e')]=runReport;exports[_0x49f9('0x30')]=function(_0x497805,_0xc1b686){var _0x2923df=0xa;var _0x259a20=[_0x49f9('0x4f'),_0x49f9('0x50'),_0x49f9('0x51'),'cross_join'];var _0x286b90={'SUM':_0x49f9('0x52'),'COUNT':_0x49f9('0x53'),'COUNT DISTINCT':_0x49f9('0x83'),'MAX':'MAX(%s)','MIN':_0x49f9('0x84'),'AVG':_0x49f9('0x55'),'GROUP_CONCAT':_0x49f9('0x56'),'GROUP_CONCAT ASC':_0x49f9('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58bf69={'SEC_TO_TIME':_0x49f9('0x59'),'DATE':'DATE(%s)','HOUR':_0x49f9('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x49f9('0x5b')};var _0x4031f4=function(_0xf198e5){return!_[_0x49f9('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x49f9('0x5f'),'IS\x20NOT\x20EMPTY'],_0xf198e5);};var _0x56a244=function(_0x32264f){if(!_0x32264f||!_0x32264f['rules'][_0x49f9('0x36')]){return'';}for(var _0x21ca71='(',_0x14de03=0x0;_0x14de03<_0x32264f[_0x49f9('0x61')][_0x49f9('0x36')];_0x14de03+=0x1){_0x14de03>0x0&&(_0x21ca71+='\x20'+_0x32264f[_0x49f9('0x62')]+'\x20');_0x21ca71+=_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]?_0x56a244(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x63')]):_0x32264f[_0x49f9('0x61')][_0x14de03]['field']+'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')]+(_0x4031f4(_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x65')])?'\x20'+_0x32264f[_0x49f9('0x61')][_0x14de03][_0x49f9('0x66')]:'');}return _0x21ca71+')';};var _0x5b7030={'where':{'id':_0x497805[_0x49f9('0x4e')]['id']}},_0x1da9a7,_0x1a0c41,_0x3f3419,_0x2cefe1,_0x3b051c;_0x5b7030=_['merge']({},_0x5b7030,_0x497805[_0x49f9('0x3d')]);return db[_0x49f9('0x2a')][_0x49f9('0x43')](_0x5b7030)[_0x49f9('0x24')](function(_0x575947){if(_0x575947){_0x1da9a7=_0x575947;return _0x575947[_0x49f9('0x68')]();}return null;})['then'](function(_0x37efa9){if(_0x37efa9){if(!_0x37efa9[_0x49f9('0x36')]){throw new db[(_0x49f9('0x69'))][(_0x49f9('0x6a'))](_0x49f9('0x6b'),0x193);}_0x1a0c41=_0x37efa9;return db['AnalyticMetric'][_0x49f9('0x6c')]({'raw':!![]});}return null;})[_0x49f9('0x24')](function(_0x32e9c6){if(_0x32e9c6){_0x3f3419=_[_0x49f9('0x6d')](_0x32e9c6,'id');var _0x1a92bc;var _0x51494a=squel[_0x49f9('0x9b')]();_0x51494a[_0x49f9('0x6e')](_0x1da9a7[_0x49f9('0x6f')]);for(var _0x18b947=0x0;_0x18b947<_0x1a0c41['length'];_0x18b947+=0x1){_0x1a92bc=_0x1a0c41[_0x18b947]['MetricId']?_0x3f3419[_0x1a0c41[_0x18b947][_0x49f9('0x70')]][_0x49f9('0x71')]:_0x1a0c41[_0x18b947][_0x49f9('0x64')];_0x1a92bc=_0x1a0c41[_0x18b947][_0x49f9('0x73')]?_['replace'](_0x286b90[_0x1a0c41[_0x18b947][_0x49f9('0x73')]],'%s',_0x1a92bc):_0x1a92bc;_0x1a92bc=_0x1a0c41[_0x18b947]['format']?_[_0x49f9('0x72')](_0x58bf69[_0x1a0c41[_0x18b947][_0x49f9('0x74')]],'%s',_0x1a92bc):_0x1a92bc;if(_0x1a0c41[_0x18b947][_0x49f9('0x75')]){_0x51494a[_0x49f9('0x63')](_0x1a92bc);}_0x1a0c41[_0x18b947][_0x49f9('0x76')]&&_0x51494a['order'](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x76')]===_0x49f9('0x77')?![]:!![]);_0x51494a[_0x49f9('0x64')](_0x1a92bc,_0x1a0c41[_0x18b947][_0x49f9('0x78')]||_0x1a92bc);}if(_0x1da9a7['joins']){_0x1da9a7[_0x49f9('0x79')]=JSON['parse'](_0x1da9a7['joins']);for(var _0x2af1f5=0x0;_0x2af1f5<_0x1da9a7[_0x49f9('0x79')][_0x49f9('0x36')];_0x2af1f5+=0x1){if(_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x2c')]&&_['includes'](_0x259a20,_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')])&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')]&&_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7b')]){_0x51494a[_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x2c')]](_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],null,util[_0x49f9('0x74')](_0x49f9('0x7c'),_0x1da9a7['table'],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x87')],_0x1da9a7[_0x49f9('0x79')][_0x2af1f5][_0x49f9('0x7a')],_0x1da9a7['joins'][_0x2af1f5][_0x49f9('0x7b')]));}}}if(_0x1da9a7[_0x49f9('0x7d')]){_0x1da9a7[_0x49f9('0x7d')]=JSON['parse'](_0x1da9a7[_0x49f9('0x7d')]);_0x51494a['where'](_0x56a244(_0x1da9a7[_0x49f9('0x7d')]['group']));}_0x3b051c=_0x51494a[_0x49f9('0x88')]();_0x51494a[_0x49f9('0x1d')](_0x2923df);_0x51494a[_0x49f9('0x1c')](0x0);logger[_0x49f9('0x7e')](_0x49f9('0x7f'),_0x51494a[_0x49f9('0x96')]());return db[_0x49f9('0x80')]['query'](_0x51494a[_0x49f9('0x96')](),{'type':db['sequelize'][_0x49f9('0x81')][_0x49f9('0x82')]});}})['then'](function(){return{'sql':_0x3b051c[_0x49f9('0x96')]()};})['then'](respondWithResult(_0xc1b686,null))['catch'](handleError(_0xc1b686,null));}; \ No newline at end of file +var _0x1d5b=['desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','show','find','create','body','user','role','Reports','UserProfileSection','CustomReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','value','Please\x20insert\x20at\x20least\x20one\x20field','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','IS\x20EMPTY','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0xe3d73d,_0x1419ce){var _0x44cafc=function(_0xa8d60b){while(--_0xa8d60b){_0xe3d73d['push'](_0xe3d73d['shift']());}};_0x44cafc(++_0x1419ce);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x17fd24,_0x94f18e){_0x17fd24=_0x17fd24-0x0;var _0x393c9a=_0x1d5b[_0x17fd24];return _0x393c9a;};'use strict';var pdf=require(_0xb1d5('0x0'));var emlformat=require(_0xb1d5('0x1'));var rimraf=require(_0xb1d5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1d5('0x3'));var rp=require('request-promise');var moment=require(_0xb1d5('0x4'));var BPromise=require(_0xb1d5('0x5'));var Mustache=require(_0xb1d5('0x6'));var util=require(_0xb1d5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb1d5('0x8'));var ejs=require(_0xb1d5('0x9'));var fs=require('fs');var _=require(_0xb1d5('0xa'));var squel=require(_0xb1d5('0xb'));var crypto=require(_0xb1d5('0xc'));var jsforce=require(_0xb1d5('0xd'));var deskjs=require(_0xb1d5('0xe'));var toCsv=require(_0xb1d5('0x8'));var querystring=require('querystring');var Papa=require(_0xb1d5('0xf'));var Redis=require(_0xb1d5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1d5('0x11'));var hardwareService=require(_0xb1d5('0x12'));var logger=require(_0xb1d5('0x13'))('api');var utils=require(_0xb1d5('0x14'));var config=require(_0xb1d5('0x15'));var db=require(_0xb1d5('0x16'))['db'];var dbH=require('../../mysqldb')[_0xb1d5('0x17')];function respondWithStatusCode(_0x9d4e4,_0x2fd99c){_0x2fd99c=_0x2fd99c||0xcc;return function(_0xc0fa0a){if(_0xc0fa0a){return _0x9d4e4['sendStatus'](_0x2fd99c);}return _0x9d4e4[_0xb1d5('0x18')](_0x2fd99c)[_0xb1d5('0x19')]();};}function respondWithResult(_0x2c16e2,_0x53e1b3){_0x53e1b3=_0x53e1b3||0xc8;return function(_0x2925fd){if(_0x2925fd){return _0x2c16e2[_0xb1d5('0x18')](_0x53e1b3)[_0xb1d5('0x1a')](_0x2925fd);}};}function respondWithFilteredResult(_0x3fc6a0,_0x5f6066){return function(_0x16a6d0){if(_0x16a6d0){var _0x4fd2f0=_0x16a6d0[_0xb1d5('0x1b')],_0x199deb=_0x5f6066['offset'],_0x51cb99=_0x5f6066[_0xb1d5('0x1c')]+_0x5f6066[_0xb1d5('0x1d')],_0x9e4f8a;if(_0x51cb99>=_0x4fd2f0){_0x51cb99=_0x4fd2f0;_0x9e4f8a=0xc8;}else{_0x9e4f8a=0xce;}_0x3fc6a0[_0xb1d5('0x18')](_0x9e4f8a);return _0x3fc6a0['set'](_0xb1d5('0x1e'),_0x199deb+'-'+_0x51cb99+'/'+_0x4fd2f0)[_0xb1d5('0x1a')](_0x16a6d0);}return null;};}function patchUpdates(_0x5a9c6f){return function(_0x3ce6a9){try{jsonpatch[_0xb1d5('0x1f')](_0x3ce6a9,_0x5a9c6f,!![]);}catch(_0x3ca7b3){return BPromise[_0xb1d5('0x20')](_0x3ca7b3);}return _0x3ce6a9[_0xb1d5('0x21')]();};}function saveUpdates(_0x4dde74,_0x4189f0){return function(_0x46fd1e){if(_0x46fd1e){return _0x46fd1e[_0xb1d5('0x22')](_0x4dde74)[_0xb1d5('0x23')](function(_0x34df7d){return _0x34df7d;});}return null;};}function removeEntity(_0x50e15f,_0xd979d){return function(_0x5ad088){if(_0x5ad088){return _0x5ad088[_0xb1d5('0x24')]()['then'](function(){var _0x18e259=_0x5ad088[_0xb1d5('0x25')]({'plain':!![]});var _0x4178f0='CustomReports';return db['UserProfileResource'][_0xb1d5('0x24')]({'where':{'type':_0x4178f0,'resourceId':_0x18e259['id']}})[_0xb1d5('0x23')](function(){return _0x5ad088;});})[_0xb1d5('0x23')](function(){_0x50e15f[_0xb1d5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6428,_0x232b67){return function(_0x238798){if(!_0x238798){_0x2f6428[_0xb1d5('0x26')](0x194);}return _0x238798;};}function handleError(_0x7ba5f9,_0x27d8a7){_0x27d8a7=_0x27d8a7||0x1f4;return function(_0x192660){logger[_0xb1d5('0x27')](_0x192660['stack']);if(_0x192660[_0xb1d5('0x28')]){delete _0x192660[_0xb1d5('0x28')];}_0x7ba5f9[_0xb1d5('0x18')](_0x27d8a7)[_0xb1d5('0x29')](_0x192660);};}exports['index']=function(_0x38d16b,_0x18f6fd){var _0x2dd330={},_0x8ecfac={},_0x1d3971={'count':0x0,'rows':[]};var _0x1e4b71=_['map'](db[_0xb1d5('0x2a')][_0xb1d5('0x2b')],function(_0x831e42){return{'name':_0x831e42[_0xb1d5('0x2c')],'type':_0x831e42[_0xb1d5('0x2d')]['key']};});_0x8ecfac['model']=_[_0xb1d5('0x2e')](_0x1e4b71,_0xb1d5('0x28'));_0x8ecfac[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x38d16b[_0xb1d5('0x2f')]);_0x8ecfac[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x8ecfac[_0xb1d5('0x33')],_0x8ecfac['query']);_0x2dd330[_0xb1d5('0x34')]=_[_0xb1d5('0x32')](_0x8ecfac[_0xb1d5('0x33')],qs['fields'](_0x38d16b['query'][_0xb1d5('0x35')]));_0x2dd330[_0xb1d5('0x34')]=_0x2dd330[_0xb1d5('0x34')][_0xb1d5('0x36')]?_0x2dd330[_0xb1d5('0x34')]:_0x8ecfac[_0xb1d5('0x33')];if(!_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x2dd330[_0xb1d5('0x1d')]=qs[_0xb1d5('0x1d')](_0x38d16b[_0xb1d5('0x2f')]['limit']);_0x2dd330['offset']=qs[_0xb1d5('0x1c')](_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x1c')]);}_0x2dd330[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x2dd330['where']=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3b')](_0x38d16b['query'],_0x8ecfac[_0xb1d5('0x31')]),_0x1e4b71);if(_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x3c')]){_0x2dd330['where']=_[_0xb1d5('0x3d')](_0x2dd330['where'],{'$or':_[_0xb1d5('0x2e')](_0x1e4b71,function(_0x168b35){if(_0x168b35[_0xb1d5('0x2d')]!==_0xb1d5('0x3e')){var _0x6bd37e={};_0x6bd37e[_0x168b35['name']]={'$like':'%'+_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x3c')]+'%'};return _0x6bd37e;}})});}_0x2dd330=_['merge']({},_0x2dd330,_0x38d16b[_0xb1d5('0x3f')]);var _0xf9ed38={'where':_0x2dd330[_0xb1d5('0x40')]};return db[_0xb1d5('0x2a')]['count'](_0xf9ed38)[_0xb1d5('0x23')](function(_0x164e36){_0x1d3971[_0xb1d5('0x1b')]=_0x164e36;if(_0x38d16b[_0xb1d5('0x2f')][_0xb1d5('0x41')]){_0x2dd330[_0xb1d5('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x2dd330);})[_0xb1d5('0x23')](function(_0x4c3a38){_0x1d3971[_0xb1d5('0x43')]=_0x4c3a38;return _0x1d3971;})[_0xb1d5('0x23')](respondWithFilteredResult(_0x18f6fd,_0x2dd330))['catch'](handleError(_0x18f6fd,null));};exports[_0xb1d5('0x44')]=function(_0x97f4c7,_0x34523c){var _0x171cce={'raw':![],'where':{'id':_0x97f4c7['params']['id']}},_0x4efaa4={};_0x4efaa4[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x2a')][_0xb1d5('0x2b')]);_0x4efaa4[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x97f4c7[_0xb1d5('0x2f')]);_0x4efaa4[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x4efaa4[_0xb1d5('0x33')],_0x4efaa4['query']);_0x171cce[_0xb1d5('0x34')]=_[_0xb1d5('0x32')](_0x4efaa4[_0xb1d5('0x33')],qs[_0xb1d5('0x35')](_0x97f4c7[_0xb1d5('0x2f')][_0xb1d5('0x35')]));_0x171cce[_0xb1d5('0x34')]=_0x171cce[_0xb1d5('0x34')][_0xb1d5('0x36')]?_0x171cce['attributes']:_0x4efaa4[_0xb1d5('0x33')];if(_0x97f4c7['query'][_0xb1d5('0x41')]){_0x171cce[_0xb1d5('0x42')]=[{'all':!![]}];}_0x171cce=_[_0xb1d5('0x3d')]({},_0x171cce,_0x97f4c7[_0xb1d5('0x3f')]);return db[_0xb1d5('0x2a')][_0xb1d5('0x45')](_0x171cce)[_0xb1d5('0x23')](handleEntityNotFound(_0x34523c,null))[_0xb1d5('0x23')](respondWithResult(_0x34523c,null))['catch'](handleError(_0x34523c,null));};exports[_0xb1d5('0x46')]=function(_0x5af2f5,_0x5354ea){return db['AnalyticCustomReport']['create'](_0x5af2f5[_0xb1d5('0x47')],{})[_0xb1d5('0x23')](function(_0x1f0852){var _0xf84cf0=_0x5af2f5[_0xb1d5('0x48')][_0xb1d5('0x25')]({'plain':!![]});if(!_0xf84cf0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf84cf0[_0xb1d5('0x49')]===_0xb1d5('0x48')){var _0x767f58=_0x1f0852[_0xb1d5('0x25')]({'plain':!![]});var _0xaef3b9=_0xb1d5('0x4a');return db[_0xb1d5('0x4b')][_0xb1d5('0x45')]({'where':{'name':_0xaef3b9,'userProfileId':_0xf84cf0['userProfileId']},'raw':!![]})[_0xb1d5('0x23')](function(_0x41ef7){if(_0x41ef7&&_0x41ef7['autoAssociation']===0x0){return db['UserProfileResource'][_0xb1d5('0x46')]({'name':_0x767f58[_0xb1d5('0x28')],'resourceId':_0x767f58['id'],'type':_0xb1d5('0x4c'),'sectionId':_0x41ef7['id']},{})[_0xb1d5('0x23')](function(){return _0x1f0852;});}else{return _0x1f0852;}})[_0xb1d5('0x4d')](function(_0xcc68f6){logger[_0xb1d5('0x27')](_0xb1d5('0x4e'),_0xcc68f6);throw _0xcc68f6;});}return _0x1f0852;})['then'](respondWithResult(_0x5354ea,0xc9))[_0xb1d5('0x4d')](handleError(_0x5354ea,null));};exports[_0xb1d5('0x22')]=function(_0x1c00ac,_0x2587f4){if(_0x1c00ac[_0xb1d5('0x47')]['id']){delete _0x1c00ac[_0xb1d5('0x47')]['id'];}return db[_0xb1d5('0x2a')][_0xb1d5('0x45')]({'where':{'id':_0x1c00ac[_0xb1d5('0x4f')]['id']}})[_0xb1d5('0x23')](handleEntityNotFound(_0x2587f4,null))[_0xb1d5('0x23')](saveUpdates(_0x1c00ac[_0xb1d5('0x47')],null))[_0xb1d5('0x23')](respondWithResult(_0x2587f4,null))[_0xb1d5('0x4d')](handleError(_0x2587f4,null));};exports['destroy']=function(_0x2ba8df,_0x23ccb9){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2ba8df[_0xb1d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x23ccb9,null))[_0xb1d5('0x23')](removeEntity(_0x23ccb9,null))[_0xb1d5('0x4d')](handleError(_0x23ccb9,null));};exports[_0xb1d5('0x50')]=function(_0x28fc0e,_0x591dde){var _0x11a207=0xa;var _0x266ad5=[_0xb1d5('0x51'),_0xb1d5('0x52'),_0xb1d5('0x53'),'cross_join'];var _0x5bb7f3={'SUM':_0xb1d5('0x54'),'COUNT':_0xb1d5('0x55'),'COUNT DISTINCT':_0xb1d5('0x56'),'MAX':_0xb1d5('0x57'),'MIN':_0xb1d5('0x58'),'AVG':_0xb1d5('0x59'),'GROUP_CONCAT':_0xb1d5('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb1d5('0x5b')};var _0x22b6f7={'SEC_TO_TIME':_0xb1d5('0x5c'),'DATE':_0xb1d5('0x5d'),'HOUR':_0xb1d5('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb1d5('0x5f')};var _0x5951f6=function(_0x37d8cb){return!_[_0xb1d5('0x60')]([_0xb1d5('0x61'),_0xb1d5('0x62'),'IS\x20EMPTY',_0xb1d5('0x63')],_0x37d8cb);};var _0x3cb928=function(_0x3ed740){if(!_0x3ed740||!_0x3ed740[_0xb1d5('0x64')][_0xb1d5('0x36')]){return'';}for(var _0x65569e='(',_0x529022=0x0;_0x529022<_0x3ed740[_0xb1d5('0x64')][_0xb1d5('0x36')];_0x529022+=0x1){_0x529022>0x0&&(_0x65569e+='\x20'+_0x3ed740[_0xb1d5('0x65')]+'\x20');_0x65569e+=_0x3ed740['rules'][_0x529022][_0xb1d5('0x66')]?_0x3cb928(_0x3ed740['rules'][_0x529022][_0xb1d5('0x66')]):_0x3ed740['rules'][_0x529022][_0xb1d5('0x67')]+'\x20'+_0x3ed740[_0xb1d5('0x64')][_0x529022][_0xb1d5('0x68')]+(_0x5951f6(_0x3ed740[_0xb1d5('0x64')][_0x529022][_0xb1d5('0x68')])?'\x20'+_0x3ed740[_0xb1d5('0x64')][_0x529022]['value']:'');}return _0x65569e+')';};var _0x146cac={'where':{'id':_0x28fc0e[_0xb1d5('0x4f')]['id']}},_0xa790ed,_0x3cafbc,_0x47a287,_0x271a82,_0x492cea;_0x146cac=_[_0xb1d5('0x3d')]({},_0x146cac,_0x28fc0e['options']);return db[_0xb1d5('0x2a')][_0xb1d5('0x45')](_0x146cac)['then'](function(_0x454a05){if(_0x454a05){_0xa790ed=_0x454a05;return _0x454a05[_0xb1d5('0x69')]();}return null;})['then'](function(_0x57d2cd){if(_0x57d2cd){if(!_0x57d2cd['length']){throw new db[(_0xb1d5('0x6a'))][(_0xb1d5('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cafbc=_0x57d2cd;return db[_0xb1d5('0x6c')][_0xb1d5('0x6d')]({'raw':!![]});}return null;})[_0xb1d5('0x23')](function(_0x2a6a3e){if(_0x2a6a3e){_0x47a287=_[_0xb1d5('0x6e')](_0x2a6a3e,'id');var _0x20e236;var _0x1e3e09=squel[_0xb1d5('0x6f')]();_0x1e3e09[_0xb1d5('0x70')](_0xa790ed[_0xb1d5('0x71')]);for(var _0x3b179e=0x0;_0x3b179e<_0x3cafbc[_0xb1d5('0x36')];_0x3b179e+=0x1){_0x20e236=_0x3cafbc[_0x3b179e][_0xb1d5('0x72')]?_0x47a287[_0x3cafbc[_0x3b179e][_0xb1d5('0x72')]][_0xb1d5('0x73')]:_0x3cafbc[_0x3b179e][_0xb1d5('0x67')];_0x20e236=_0x3cafbc[_0x3b179e][_0xb1d5('0x74')]?_[_0xb1d5('0x75')](_0x5bb7f3[_0x3cafbc[_0x3b179e][_0xb1d5('0x74')]],'%s',_0x20e236):_0x20e236;_0x20e236=_0x3cafbc[_0x3b179e][_0xb1d5('0x76')]?_[_0xb1d5('0x75')](_0x22b6f7[_0x3cafbc[_0x3b179e][_0xb1d5('0x76')]],'%s',_0x20e236):_0x20e236;if(_0x3cafbc[_0x3b179e][_0xb1d5('0x77')]){_0x1e3e09['group'](_0x20e236);}_0x3cafbc[_0x3b179e][_0xb1d5('0x78')]&&_0x1e3e09['order'](_0x20e236,_0x3cafbc[_0x3b179e][_0xb1d5('0x78')]===_0xb1d5('0x79')?![]:!![]);_0x1e3e09['field'](_0x20e236,_0x3cafbc[_0x3b179e][_0xb1d5('0x7a')]||_0x20e236);}if(_0xa790ed[_0xb1d5('0x7b')]){_0xa790ed[_0xb1d5('0x7b')]=JSON[_0xb1d5('0x7c')](_0xa790ed[_0xb1d5('0x7b')]);for(var _0x234e4c=0x0;_0x234e4c<_0xa790ed[_0xb1d5('0x7b')][_0xb1d5('0x36')];_0x234e4c+=0x1){if(_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x2d')]&&_[_0xb1d5('0x60')](_0x266ad5,_0xa790ed[_0xb1d5('0x7b')][_0x234e4c]['type'])&&_0xa790ed[_0xb1d5('0x7b')][_0x234e4c]['parentKey']&&_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x7d')]&&_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x7e')]){_0x1e3e09[_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x2d')]](_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x7d')],null,util[_0xb1d5('0x76')](_0xb1d5('0x7f'),_0xa790ed[_0xb1d5('0x71')],_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x80')],_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x7d')],_0xa790ed[_0xb1d5('0x7b')][_0x234e4c][_0xb1d5('0x7e')]));}}}if(_0xa790ed['conditions']){_0xa790ed['conditions']=JSON[_0xb1d5('0x7c')](_0xa790ed[_0xb1d5('0x81')]);_0x1e3e09[_0xb1d5('0x40')](_0x3cb928(_0xa790ed['conditions'][_0xb1d5('0x66')]));}_0x492cea=_0x1e3e09[_0xb1d5('0x82')]();_0x1e3e09[_0xb1d5('0x1d')](_0x11a207);_0x1e3e09['offset'](0x0);logger[_0xb1d5('0x83')](_0xb1d5('0x84'),_0x1e3e09[_0xb1d5('0x85')]());return db[_0xb1d5('0x86')][_0xb1d5('0x2f')](_0x1e3e09['toString'](),{'type':db[_0xb1d5('0x86')][_0xb1d5('0x87')][_0xb1d5('0x88')]});}})[_0xb1d5('0x23')](respondWithResult(_0x591dde,null))[_0xb1d5('0x4d')](handleError(_0x591dde,null));};function runReport(_0x45d9e0,_0x56bc5e,_0x8bd8a8){var _0x3797c9=_0x56bc5e[_0xb1d5('0x28')];var _0x1df819=0xa;var _0x1eb62d=['join',_0xb1d5('0x52'),'right_join',_0xb1d5('0x89')];var _0x796e1f={'SUM':_0xb1d5('0x54'),'COUNT':_0xb1d5('0x55'),'COUNT DISTINCT':_0xb1d5('0x56'),'MAX':_0xb1d5('0x57'),'MIN':_0xb1d5('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb1d5('0x5a'),'GROUP_CONCAT ASC':_0xb1d5('0x8a'),'GROUP_CONCAT DESC':_0xb1d5('0x5b')};var _0x95f3d5={'SEC_TO_TIME':_0xb1d5('0x5c'),'DATE':_0xb1d5('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xb1d5('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e1964=function(_0x617476){return!_['includes']([_0xb1d5('0x61'),_0xb1d5('0x62'),'IS\x20EMPTY',_0xb1d5('0x63')],_0x617476);};var _0x1bf833=function(_0x1feb23){if(!_0x1feb23||!_0x1feb23[_0xb1d5('0x64')][_0xb1d5('0x36')]){return'';}for(var _0x16a3d1='(',_0xe4639c=0x0;_0xe4639c<_0x1feb23[_0xb1d5('0x64')]['length'];_0xe4639c+=0x1){_0xe4639c>0x0&&(_0x16a3d1+='\x20'+_0x1feb23[_0xb1d5('0x65')]+'\x20');_0x16a3d1+=_0x1feb23[_0xb1d5('0x64')][_0xe4639c]['group']?_0x1bf833(_0x1feb23[_0xb1d5('0x64')][_0xe4639c][_0xb1d5('0x66')]):_0x1feb23['rules'][_0xe4639c][_0xb1d5('0x67')]+'\x20'+_0x1feb23['rules'][_0xe4639c][_0xb1d5('0x68')]+(_0x4e1964(_0x1feb23['rules'][_0xe4639c][_0xb1d5('0x68')])?'\x20'+_0x1feb23['rules'][_0xe4639c][_0xb1d5('0x8c')]:'');}return _0x16a3d1+')';};var _0x2b6e4f={'where':{'id':_0x45d9e0['id']}},_0xf592c2,_0x48ea48,_0x115af6,_0x3a78db,_0x21864b;_0x2b6e4f=_[_0xb1d5('0x3d')]({},_0x2b6e4f,_0x8bd8a8);return db[_0xb1d5('0x2a')][_0xb1d5('0x45')](_0x2b6e4f)[_0xb1d5('0x23')](function(_0x4791b3){if(_0x4791b3){_0xf592c2=_0x4791b3;return _0x4791b3[_0xb1d5('0x69')]();}return null;})[_0xb1d5('0x23')](function(_0x4a3a43){if(_0x4a3a43){if(!_0x4a3a43[_0xb1d5('0x36')]){throw new db[(_0xb1d5('0x6a'))][(_0xb1d5('0x6b'))](_0xb1d5('0x8d'),0x193);}_0x48ea48=_0x4a3a43;return db[_0xb1d5('0x6c')][_0xb1d5('0x6d')]({'raw':!![]});}return null;})[_0xb1d5('0x23')](function(_0x2628b9){if(_0x2628b9){_0x115af6=_[_0xb1d5('0x6e')](_0x2628b9,'id');var _0x1f836e;var _0x2f6a4d=squel[_0xb1d5('0x6f')]();_0x2f6a4d[_0xb1d5('0x70')](_0xf592c2[_0xb1d5('0x71')]);for(var _0x3f67da=0x0;_0x3f67da<_0x48ea48[_0xb1d5('0x36')];_0x3f67da+=0x1){_0x1f836e=_0x48ea48[_0x3f67da][_0xb1d5('0x72')]?_0x115af6[_0x48ea48[_0x3f67da]['MetricId']]['metric']:_0x48ea48[_0x3f67da][_0xb1d5('0x67')];_0x1f836e=_0x48ea48[_0x3f67da]['function']?_['replace'](_0x796e1f[_0x48ea48[_0x3f67da][_0xb1d5('0x74')]],'%s',_0x1f836e):_0x1f836e;_0x1f836e=_0x48ea48[_0x3f67da]['format']?_[_0xb1d5('0x75')](_0x95f3d5[_0x48ea48[_0x3f67da]['format']],'%s',_0x1f836e):_0x1f836e;if(_0x48ea48[_0x3f67da][_0xb1d5('0x77')]){_0x2f6a4d[_0xb1d5('0x66')](_0x1f836e);}_0x48ea48[_0x3f67da][_0xb1d5('0x78')]&&_0x2f6a4d['order'](_0x1f836e,_0x48ea48[_0x3f67da][_0xb1d5('0x78')]===_0xb1d5('0x79')?![]:!![]);_0x2f6a4d[_0xb1d5('0x67')](_0x1f836e,_0x48ea48[_0x3f67da][_0xb1d5('0x7a')]||_0x1f836e);}if(_0xf592c2[_0xb1d5('0x7b')]){_0xf592c2[_0xb1d5('0x7b')]=JSON[_0xb1d5('0x7c')](_0xf592c2[_0xb1d5('0x7b')]);for(var _0x388907=0x0;_0x388907<_0xf592c2['joins'][_0xb1d5('0x36')];_0x388907+=0x1){if(_0xf592c2[_0xb1d5('0x7b')][_0x388907][_0xb1d5('0x2d')]&&_[_0xb1d5('0x60')](_0x1eb62d,_0xf592c2[_0xb1d5('0x7b')][_0x388907][_0xb1d5('0x2d')])&&_0xf592c2['joins'][_0x388907][_0xb1d5('0x80')]&&_0xf592c2[_0xb1d5('0x7b')][_0x388907][_0xb1d5('0x7d')]&&_0xf592c2[_0xb1d5('0x7b')][_0x388907][_0xb1d5('0x7e')]){_0x2f6a4d[_0xf592c2['joins'][_0x388907]['type']](_0xf592c2['joins'][_0x388907][_0xb1d5('0x7d')],null,util[_0xb1d5('0x76')](_0xb1d5('0x7f'),_0xf592c2[_0xb1d5('0x71')],_0xf592c2['joins'][_0x388907][_0xb1d5('0x80')],_0xf592c2['joins'][_0x388907][_0xb1d5('0x7d')],_0xf592c2[_0xb1d5('0x7b')][_0x388907]['foreignKey']));}}}if(_0xf592c2[_0xb1d5('0x81')]){_0xf592c2[_0xb1d5('0x81')]=JSON['parse'](_0xf592c2[_0xb1d5('0x81')]);_0x2f6a4d[_0xb1d5('0x40')](_0x1bf833(_0xf592c2['conditions'][_0xb1d5('0x66')]));}_0x21864b=_0x2f6a4d[_0xb1d5('0x82')]();_0x2f6a4d[_0xb1d5('0x1d')](_0x1df819);_0x2f6a4d[_0xb1d5('0x1c')](0x0);logger['debug'](_0xb1d5('0x84'),_0x2f6a4d[_0xb1d5('0x85')]());return db[_0xb1d5('0x86')]['query'](_0x2f6a4d[_0xb1d5('0x85')](),{'type':db['sequelize'][_0xb1d5('0x87')]['SELECT']});}})[_0xb1d5('0x23')](function(_0x243733){if(!_0x243733['length']){throw new db[(_0xb1d5('0x6a'))][(_0xb1d5('0x6b'))](_0xb1d5('0x8e'),0xcc);}if(_0x56bc5e[_0xb1d5('0x8f')]===_0xb1d5('0x90')){return null;}var _0x1d4fa3=_['merge'](_0x56bc5e,{'name':_0x56bc5e[_0xb1d5('0x91')]||_0x56bc5e[_0xb1d5('0x28')]||_0xf592c2['name'],'basename':_0x3797c9,'savename':util[_0xb1d5('0x76')](_0xb1d5('0x92'),_0x56bc5e['name']||_0xf592c2['name'],require(_0xb1d5('0x93'))[_0xb1d5('0x94')](0x4),_0x56bc5e['output']||_0xb1d5('0x95')),'reportId':_0xf592c2['id'],'reportType':_0xb1d5('0x96')});return db[_0xb1d5('0x97')][_0xb1d5('0x46')](_0x1d4fa3,{'raw':!![]});})[_0xb1d5('0x23')](function(_0xb634a0){if(_0xf592c2[_0xb1d5('0x71')]==='cdr'){_0x21864b[_0xb1d5('0x40')](_0xf592c2['table']+_0xb1d5('0x98'),_0x56bc5e[_0xb1d5('0x99')],_0x56bc5e[_0xb1d5('0x9a')]);}else{_0x21864b[_0xb1d5('0x40')](_0xf592c2['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x56bc5e[_0xb1d5('0x99')],_0x56bc5e[_0xb1d5('0x9a')]);}if(_0xb634a0){logger['info'](_0xb1d5('0x9b'),_0x21864b[_0xb1d5('0x85')]());require(_0xb1d5('0x9c'))[_0xb1d5('0x9d')](path['join'](__dirname,_0xb1d5('0x9e'),_0xb634a0[_0xb1d5('0x8f')]),[_0xb634a0['id'],_0x21864b[_0xb1d5('0x85')](),path[_0xb1d5('0x51')](__dirname,_0xb1d5('0x9f'),_0xb634a0[_0xb1d5('0xa0')]),_0x3797c9]);return _0xb634a0;}else{var _0x3a491f=squel[_0xb1d5('0x6f')]();_0x3a491f[_0xb1d5('0x70')]('('+_0x21864b[_0xb1d5('0x85')]()+')',_0xb1d5('0xa1'));_0x3a491f[_0xb1d5('0x67')](_0xb1d5('0xa2'),_0xb1d5('0x1b'));_0x21864b[_0xb1d5('0x1d')](_0x56bc5e[_0xb1d5('0x1d')]||_0x1df819);_0x21864b[_0xb1d5('0x1c')](_0x56bc5e[_0xb1d5('0x1c')]||0x0);return dbH[_0xb1d5('0x86')][_0xb1d5('0x2f')](_0x3a491f[_0xb1d5('0x85')](),{'type':dbH['sequelize'][_0xb1d5('0x87')][_0xb1d5('0x88')]})[_0xb1d5('0x23')](function(_0x41c94c){if(!_0x41c94c['length']){_0x3a78db=0x0;}else{_0x3a78db=_0x41c94c[0x0][_0xb1d5('0x1b')]||0x0;}return dbH['sequelize'][_0xb1d5('0x2f')](_0x21864b[_0xb1d5('0x85')](),{'type':dbH[_0xb1d5('0x86')][_0xb1d5('0x87')][_0xb1d5('0x88')]});})[_0xb1d5('0x23')](function(_0xd0a09b){return{'rows':_0xd0a09b||[],'count':_0x3a78db};});}});}exports[_0xb1d5('0xa3')]=function(_0x1b13f0,_0x23f7a9){return runReport(_0x1b13f0[_0xb1d5('0x4f')],_0x1b13f0['query'],_0x1b13f0[_0xb1d5('0x3f')])[_0xb1d5('0x23')](respondWithResult(_0x23f7a9,null))['catch'](handleError(_0x23f7a9,null));};exports['runReport']=runReport;exports[_0xb1d5('0x2f')]=function(_0xff39ea,_0xb63fa6){var _0x45c6c9=0xa;var _0x2988f4=[_0xb1d5('0x51'),'left_join',_0xb1d5('0x53'),_0xb1d5('0x89')];var _0x4ffa90={'SUM':_0xb1d5('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb1d5('0x56'),'MAX':_0xb1d5('0x57'),'MIN':_0xb1d5('0x58'),'AVG':_0xb1d5('0x59'),'GROUP_CONCAT':_0xb1d5('0x5a'),'GROUP_CONCAT ASC':_0xb1d5('0x8a'),'GROUP_CONCAT DESC':_0xb1d5('0x5b')};var _0x503862={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb1d5('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xb1d5('0x8b'),'UNIX_TIMESTAMP':_0xb1d5('0x5f')};var _0x1f1d37=function(_0x5d3c4c){return!_['includes']([_0xb1d5('0x61'),_0xb1d5('0x62'),_0xb1d5('0xa4'),_0xb1d5('0x63')],_0x5d3c4c);};var _0x2a5d25=function(_0x1a8093){if(!_0x1a8093||!_0x1a8093['rules'][_0xb1d5('0x36')]){return'';}for(var _0x3688bc='(',_0x4b9a35=0x0;_0x4b9a35<_0x1a8093[_0xb1d5('0x64')]['length'];_0x4b9a35+=0x1){_0x4b9a35>0x0&&(_0x3688bc+='\x20'+_0x1a8093['operator']+'\x20');_0x3688bc+=_0x1a8093[_0xb1d5('0x64')][_0x4b9a35]['group']?_0x2a5d25(_0x1a8093[_0xb1d5('0x64')][_0x4b9a35][_0xb1d5('0x66')]):_0x1a8093[_0xb1d5('0x64')][_0x4b9a35][_0xb1d5('0x67')]+'\x20'+_0x1a8093[_0xb1d5('0x64')][_0x4b9a35][_0xb1d5('0x68')]+(_0x1f1d37(_0x1a8093[_0xb1d5('0x64')][_0x4b9a35][_0xb1d5('0x68')])?'\x20'+_0x1a8093[_0xb1d5('0x64')][_0x4b9a35][_0xb1d5('0x8c')]:'');}return _0x3688bc+')';};var _0xae47a4={'where':{'id':_0xff39ea[_0xb1d5('0x4f')]['id']}},_0x5e6669,_0x195001,_0x36e9f8,_0x23d57f,_0xb4beb0;_0xae47a4=_[_0xb1d5('0x3d')]({},_0xae47a4,_0xff39ea[_0xb1d5('0x3f')]);return db[_0xb1d5('0x2a')][_0xb1d5('0x45')](_0xae47a4)[_0xb1d5('0x23')](function(_0x25d9dc){if(_0x25d9dc){_0x5e6669=_0x25d9dc;return _0x25d9dc[_0xb1d5('0x69')]();}return null;})[_0xb1d5('0x23')](function(_0x334870){if(_0x334870){if(!_0x334870[_0xb1d5('0x36')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x195001=_0x334870;return db[_0xb1d5('0x6c')][_0xb1d5('0x6d')]({'raw':!![]});}return null;})[_0xb1d5('0x23')](function(_0x3b93da){if(_0x3b93da){_0x36e9f8=_[_0xb1d5('0x6e')](_0x3b93da,'id');var _0x1bfe9a;var _0x1f77ae=squel[_0xb1d5('0x6f')]();_0x1f77ae[_0xb1d5('0x70')](_0x5e6669[_0xb1d5('0x71')]);for(var _0xc20b94=0x0;_0xc20b94<_0x195001[_0xb1d5('0x36')];_0xc20b94+=0x1){_0x1bfe9a=_0x195001[_0xc20b94][_0xb1d5('0x72')]?_0x36e9f8[_0x195001[_0xc20b94]['MetricId']][_0xb1d5('0x73')]:_0x195001[_0xc20b94][_0xb1d5('0x67')];_0x1bfe9a=_0x195001[_0xc20b94][_0xb1d5('0x74')]?_[_0xb1d5('0x75')](_0x4ffa90[_0x195001[_0xc20b94][_0xb1d5('0x74')]],'%s',_0x1bfe9a):_0x1bfe9a;_0x1bfe9a=_0x195001[_0xc20b94][_0xb1d5('0x76')]?_[_0xb1d5('0x75')](_0x503862[_0x195001[_0xc20b94][_0xb1d5('0x76')]],'%s',_0x1bfe9a):_0x1bfe9a;if(_0x195001[_0xc20b94][_0xb1d5('0x77')]){_0x1f77ae[_0xb1d5('0x66')](_0x1bfe9a);}_0x195001[_0xc20b94][_0xb1d5('0x78')]&&_0x1f77ae['order'](_0x1bfe9a,_0x195001[_0xc20b94][_0xb1d5('0x78')]===_0xb1d5('0x79')?![]:!![]);_0x1f77ae[_0xb1d5('0x67')](_0x1bfe9a,_0x195001[_0xc20b94]['alias']||_0x1bfe9a);}if(_0x5e6669[_0xb1d5('0x7b')]){_0x5e6669[_0xb1d5('0x7b')]=JSON[_0xb1d5('0x7c')](_0x5e6669[_0xb1d5('0x7b')]);for(var _0x5c3cd0=0x0;_0x5c3cd0<_0x5e6669[_0xb1d5('0x7b')]['length'];_0x5c3cd0+=0x1){if(_0x5e6669['joins'][_0x5c3cd0]['type']&&_[_0xb1d5('0x60')](_0x2988f4,_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0]['type'])&&_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0]['parentKey']&&_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0][_0xb1d5('0x7d')]&&_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0][_0xb1d5('0x7e')]){_0x1f77ae[_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0][_0xb1d5('0x2d')]](_0x5e6669['joins'][_0x5c3cd0][_0xb1d5('0x7d')],null,util['format'](_0xb1d5('0x7f'),_0x5e6669['table'],_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0][_0xb1d5('0x80')],_0x5e6669[_0xb1d5('0x7b')][_0x5c3cd0]['foreignTable'],_0x5e6669['joins'][_0x5c3cd0]['foreignKey']));}}}if(_0x5e6669[_0xb1d5('0x81')]){_0x5e6669['conditions']=JSON[_0xb1d5('0x7c')](_0x5e6669['conditions']);_0x1f77ae['where'](_0x2a5d25(_0x5e6669[_0xb1d5('0x81')][_0xb1d5('0x66')]));}_0xb4beb0=_0x1f77ae['clone']();_0x1f77ae['limit'](_0x45c6c9);_0x1f77ae[_0xb1d5('0x1c')](0x0);logger[_0xb1d5('0x83')](_0xb1d5('0x84'),_0x1f77ae['toString']());return db[_0xb1d5('0x86')][_0xb1d5('0x2f')](_0x1f77ae[_0xb1d5('0x85')](),{'type':db[_0xb1d5('0x86')]['QueryTypes'][_0xb1d5('0x88')]});}})['then'](function(){return{'sql':_0xb4beb0[_0xb1d5('0x85')]()};})[_0xb1d5('0x23')](respondWithResult(_0xb63fa6,null))[_0xb1d5('0x4d')](handleError(_0xb63fa6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 316a763..4ac916f 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 _0x248d=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x248d,0x14f));var _0xd248=function(_0x14b2db,_0x1ec1b4){_0x14b2db=_0x14b2db-0x0;var _0x1ecb84=_0x248d[_0x14b2db];return _0x1ecb84;};'use strict';var _=require(_0xd248('0x0'));var util=require(_0xd248('0x1'));var logger=require(_0xd248('0x2'))('api');var moment=require(_0xd248('0x3'));var BPromise=require(_0xd248('0x4'));var rp=require(_0xd248('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd248('0x6'));var config=require(_0xd248('0x7'));var attributes=require(_0xd248('0x8'));module['exports']=function(_0x44ada4,_0x11d0d1){return _0x44ada4[_0xd248('0x9')](_0xd248('0xa'),attributes,{'tableName':_0xd248('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5ce=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5ac096,_0xef96fc){var _0x588955=function(_0xc482b2){while(--_0xc482b2){_0x5ac096['push'](_0x5ac096['shift']());}};_0x588955(++_0xef96fc);}(_0xc5ce,0x7d));var _0xec5c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc5ce[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require(_0xec5c('0x0'));var logger=require('../../config/logger')(_0xec5c('0x1'));var moment=require(_0xec5c('0x2'));var BPromise=require(_0xec5c('0x3'));var rp=require(_0xec5c('0x4'));var fs=require('fs');var path=require(_0xec5c('0x5'));var rimraf=require('rimraf');var config=require(_0xec5c('0x6'));var attributes=require(_0xec5c('0x7'));module[_0xec5c('0x8')]=function(_0x3c335b,_0xf61ad){return _0x3c335b[_0xec5c('0x9')](_0xec5c('0xa'),attributes,{'tableName':_0xec5c('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 748a30b..e908f5d 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 _0x545c=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0x545c,0x1e3));var _0xc545=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x545c[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0xc545('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc545('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc545('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc545('0x3'));var logger=require(_0xc545('0x4'))(_0xc545('0x5'));var config=require(_0xc545('0x6'));var jayson=require(_0xc545('0x7'));var client=jayson[_0xc545('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x139dd8,_0x3d3564,_0x80b9f2){return new BPromise(function(_0x148f19,_0x4d5be4){return client[_0xc545('0x9')](_0x139dd8,_0x80b9f2)['then'](function(_0x147fad){logger[_0xc545('0xa')](_0xc545('0xb'),_0x3d3564,_0xc545('0xc'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3d3564,_0xc545('0xc'),JSON[_0xc545('0xd')](_0x147fad));if(_0x147fad[_0xc545('0xe')]){if(_0x147fad[_0xc545('0xe')][_0xc545('0xf')]===0x1f4){logger[_0xc545('0xe')](_0xc545('0xb'),_0x3d3564,_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);return _0x4d5be4(_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);}logger[_0xc545('0xe')](_0xc545('0xb'),_0x3d3564,_0x147fad[_0xc545('0xe')][_0xc545('0x10')]);return _0x148f19(_0x147fad[_0xc545('0xe')]['message']);}else{logger[_0xc545('0xa')](_0xc545('0xb'),_0x3d3564,_0xc545('0xc'));_0x148f19(_0x147fad[_0xc545('0x11')]['message']);}})[_0xc545('0x12')](function(_0x1a2d04){logger[_0xc545('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3d3564,_0x1a2d04);_0x4d5be4(_0x1a2d04);});});} \ No newline at end of file +var _0x3512=['jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x460a55,_0x4fa7d1){var _0x5ba7d2=function(_0x3f822a){while(--_0x3f822a){_0x460a55['push'](_0x460a55['shift']());}};_0x5ba7d2(++_0x4fa7d1);}(_0x3512,0x1a8));var _0x2351=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3512[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2351('0x0'));var util=require(_0x2351('0x1'));var moment=require(_0x2351('0x2'));var BPromise=require('bluebird');var rs=require(_0x2351('0x3'));var fs=require('fs');var Redis=require(_0x2351('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2351('0x5'));var logger=require('../../config/logger')(_0x2351('0x6'));var config=require(_0x2351('0x7'));var jayson=require(_0x2351('0x8'));var client=jayson[_0x2351('0x9')][_0x2351('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c64e9,_0x97712a,_0x114983){return new BPromise(function(_0x23b4cb,_0xaaaaf0){return client[_0x2351('0xb')](_0x1c64e9,_0x114983)[_0x2351('0xc')](function(_0x399cf3){logger[_0x2351('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x97712a,_0x2351('0xe'));logger[_0x2351('0xf')](_0x2351('0x10'),_0x97712a,_0x2351('0xe'),JSON[_0x2351('0x11')](_0x399cf3));if(_0x399cf3['error']){if(_0x399cf3[_0x2351('0x12')][_0x2351('0x13')]===0x1f4){logger[_0x2351('0x12')](_0x2351('0x14'),_0x97712a,_0x399cf3[_0x2351('0x12')]['message']);return _0xaaaaf0(_0x399cf3['error'][_0x2351('0x15')]);}logger[_0x2351('0x12')](_0x2351('0x14'),_0x97712a,_0x399cf3[_0x2351('0x12')][_0x2351('0x15')]);return _0x23b4cb(_0x399cf3['error'][_0x2351('0x15')]);}else{logger[_0x2351('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x97712a,'request\x20sent');_0x23b4cb(_0x399cf3[_0x2351('0x16')][_0x2351('0x15')]);}})[_0x2351('0x17')](function(_0x56c3d0){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x97712a,_0x56c3d0);_0xaaaaf0(_0x56c3d0);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 80e43f2..7d2a10d 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 _0x97fc=['query','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run'];(function(_0x51e964,_0xf55d22){var _0x20bb85=function(_0x4f3b30){while(--_0x4f3b30){_0x51e964['push'](_0x51e964['shift']());}};_0x20bb85(++_0xf55d22);}(_0x97fc,0x192));var _0xc97f=function(_0x58f49b,_0x40d7c8){_0x58f49b=_0x58f49b-0x0;var _0x5c22b8=_0x97fc[_0x58f49b];return _0x5c22b8;};'use strict';var multer=require(_0xc97f('0x0'));var util=require('util');var path=require(_0xc97f('0x1'));var timeout=require(_0xc97f('0x2'));var express=require(_0xc97f('0x3'));var router=express[_0xc97f('0x4')]();var auth=require(_0xc97f('0x5'));var interaction=require(_0xc97f('0x6'));var config=require(_0xc97f('0x7'));var controller=require(_0xc97f('0x8'));router[_0xc97f('0x9')]('/',auth[_0xc97f('0xa')](),controller[_0xc97f('0xb')]);router[_0xc97f('0x9')](_0xc97f('0xc'),auth['isAuthenticated'](),controller[_0xc97f('0xd')]);router[_0xc97f('0x9')](_0xc97f('0xe'),auth[_0xc97f('0xa')](),controller['preview']);router[_0xc97f('0x9')](_0xc97f('0xf'),auth['isAuthenticated'](),controller['run']);router[_0xc97f('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0xc97f('0x10')]);router[_0xc97f('0x11')]('/',auth[_0xc97f('0xa')](),controller['create']);router[_0xc97f('0x12')](_0xc97f('0xc'),auth[_0xc97f('0xa')](),controller[_0xc97f('0x13')]);router['delete'](_0xc97f('0xc'),auth['isAuthenticated'](),controller[_0xc97f('0x14')]);module[_0xc97f('0x15')]=router; \ No newline at end of file +var _0xa7e8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/query','query','create','update','destroy','exports','util','connect-timeout'];(function(_0x3c8c8f,_0x37cf5c){var _0x372c3e=function(_0x12f4f0){while(--_0x12f4f0){_0x3c8c8f['push'](_0x3c8c8f['shift']());}};_0x372c3e(++_0x37cf5c);}(_0xa7e8,0x124));var _0x8a7e=function(_0xf1457e,_0x5a0cef){_0xf1457e=_0xf1457e-0x0;var _0x58cc17=_0xa7e8[_0xf1457e];return _0x58cc17;};'use strict';var multer=require('multer');var util=require(_0x8a7e('0x0'));var path=require('path');var timeout=require(_0x8a7e('0x1'));var express=require(_0x8a7e('0x2'));var router=express[_0x8a7e('0x3')]();var auth=require(_0x8a7e('0x4'));var interaction=require(_0x8a7e('0x5'));var config=require(_0x8a7e('0x6'));var controller=require(_0x8a7e('0x7'));router[_0x8a7e('0x8')]('/',auth[_0x8a7e('0x9')](),controller[_0x8a7e('0xa')]);router['get'](_0x8a7e('0xb'),auth[_0x8a7e('0x9')](),controller[_0x8a7e('0xc')]);router[_0x8a7e('0x8')](_0x8a7e('0xd'),auth[_0x8a7e('0x9')](),controller[_0x8a7e('0xe')]);router[_0x8a7e('0x8')]('/:id/run',auth[_0x8a7e('0x9')](),controller['run']);router[_0x8a7e('0x8')](_0x8a7e('0xf'),auth[_0x8a7e('0x9')](),controller[_0x8a7e('0x10')]);router['post']('/',auth[_0x8a7e('0x9')](),controller[_0x8a7e('0x11')]);router['put']('/:id',auth[_0x8a7e('0x9')](),controller[_0x8a7e('0x12')]);router['delete'](_0x8a7e('0xb'),auth[_0x8a7e('0x9')](),controller[_0x8a7e('0x13')]);module[_0x8a7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index be39436..6cc3a1d 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 _0xd989=['TEXT','exports','STRING'];(function(_0x16fa00,_0x376b64){var _0x1eb025=function(_0x4b14a4){while(--_0x4b14a4){_0x16fa00['push'](_0x16fa00['shift']());}};_0x1eb025(++_0x376b64);}(_0xd989,0x9d));var _0x9d98=function(_0x11d08e,_0x1cd670){_0x11d08e=_0x11d08e-0x0;var _0x19c8cb=_0xd989[_0x11d08e];return _0x19c8cb;};'use strict';var Sequelize=require('sequelize');module[_0x9d98('0x0')]={'name':{'type':Sequelize[_0x9d98('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9d98('0x1')]},'parent':{'type':Sequelize[_0x9d98('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9d98('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x392d=['sequelize','exports','STRING','TEXT'];(function(_0x36a1a0,_0x5a4a78){var _0x28d836=function(_0x516eb0){while(--_0x516eb0){_0x36a1a0['push'](_0x36a1a0['shift']());}};_0x28d836(++_0x5a4a78);}(_0x392d,0xbc));var _0xd392=function(_0x5f8e98,_0x3b3f39){_0x5f8e98=_0x5f8e98-0x0;var _0x2914f8=_0x392d[_0x5f8e98];return _0x2914f8;};'use strict';var Sequelize=require(_0xd392('0x0'));module[_0xd392('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd392('0x2')]},'parent':{'type':Sequelize[_0xd392('0x2')]},'table':{'type':Sequelize[_0xd392('0x2')]},'conditions':{'type':Sequelize[_0xd392('0x3')]},'joins':{'type':Sequelize[_0xd392('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 51433a9..38bbd57 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 _0xe82c=['info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','sequelize','toString','QueryTypes','SELECT','MIN(%s)','IS\x20NULL','IS\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','DESC','Limited\x20Query:','No\x20available\x20data','output','web','fullPath','generate','csv','default','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate'];(function(_0x3a6c33,_0x356492){var _0x4b4b72=function(_0x2fcc45){while(--_0x2fcc45){_0x3a6c33['push'](_0x3a6c33['shift']());}};_0x4b4b72(++_0x356492);}(_0xe82c,0xae));var _0xce82=function(_0x85f6e8,_0x2e43c7){_0x85f6e8=_0x85f6e8-0x0;var _0x50dde3=_0xe82c[_0x85f6e8];return _0x50dde3;};'use strict';var pdf=require(_0xce82('0x0'));var emlformat=require(_0xce82('0x1'));var rimraf=require(_0xce82('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce82('0x3'));var rp=require(_0xce82('0x4'));var moment=require(_0xce82('0x5'));var BPromise=require(_0xce82('0x6'));var Mustache=require(_0xce82('0x7'));var util=require('util');var path=require(_0xce82('0x8'));var sox=require(_0xce82('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce82('0xa'));var squel=require(_0xce82('0xb'));var crypto=require(_0xce82('0xc'));var jsforce=require(_0xce82('0xd'));var deskjs=require(_0xce82('0xe'));var toCsv=require(_0xce82('0xf'));var querystring=require(_0xce82('0x10'));var Papa=require(_0xce82('0x11'));var Redis=require('ioredis');var authService=require(_0xce82('0x12'));var qs=require(_0xce82('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce82('0x14'));var logger=require(_0xce82('0x15'))(_0xce82('0x16'));var utils=require(_0xce82('0x17'));var config=require(_0xce82('0x18'));var db=require(_0xce82('0x19'))['db'];var dbH=require(_0xce82('0x19'))[_0xce82('0x1a')];function respondWithStatusCode(_0x1d5f10,_0xaa42f1){_0xaa42f1=_0xaa42f1||0xcc;return function(_0x23e38d){if(_0x23e38d){return _0x1d5f10[_0xce82('0x1b')](_0xaa42f1);}return _0x1d5f10[_0xce82('0x1c')](_0xaa42f1)[_0xce82('0x1d')]();};}function respondWithResult(_0x360493,_0x94791a){_0x94791a=_0x94791a||0xc8;return function(_0x87994){if(_0x87994){return _0x360493['status'](_0x94791a)[_0xce82('0x1e')](_0x87994);}};}function respondWithFilteredResult(_0x4f36a2,_0x507b26){return function(_0x1d2223){if(_0x1d2223){var _0x2b5926=_0x1d2223[_0xce82('0x1f')],_0x1c852f=_0x507b26[_0xce82('0x20')],_0x1b2004=_0x507b26[_0xce82('0x20')]+_0x507b26[_0xce82('0x21')],_0x3e2bcd;if(_0x1b2004>=_0x2b5926){_0x1b2004=_0x2b5926;_0x3e2bcd=0xc8;}else{_0x3e2bcd=0xce;}_0x4f36a2[_0xce82('0x1c')](_0x3e2bcd);return _0x4f36a2['set'](_0xce82('0x22'),_0x1c852f+'-'+_0x1b2004+'/'+_0x2b5926)[_0xce82('0x1e')](_0x1d2223);}return null;};}function patchUpdates(_0xc08a0f){return function(_0x38805e){try{jsonpatch[_0xce82('0x23')](_0x38805e,_0xc08a0f,!![]);}catch(_0x33362){return BPromise[_0xce82('0x24')](_0x33362);}return _0x38805e[_0xce82('0x25')]();};}function saveUpdates(_0x266f56,_0x225218){return function(_0xa1c707){if(_0xa1c707){return _0xa1c707['update'](_0x266f56)[_0xce82('0x26')](function(_0x372586){return _0x372586;});}return null;};}function removeEntity(_0x5b1c27,_0x5ad2f2){return function(_0x4fb284){if(_0x4fb284){return _0x4fb284[_0xce82('0x27')]()[_0xce82('0x26')](function(){var _0x3ea021=_0x4fb284[_0xce82('0x28')]({'plain':!![]});var _0x9c8b0a=_0xce82('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x9c8b0a,'resourceId':_0x3ea021['id']}})[_0xce82('0x26')](function(){return _0x4fb284;});})[_0xce82('0x26')](function(){_0x5b1c27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b288,_0x489265){return function(_0x1bdaac){if(!_0x1bdaac){_0x46b288[_0xce82('0x1b')](0x194);}return _0x1bdaac;};}function handleError(_0x57aadc,_0xd0076b){_0xd0076b=_0xd0076b||0x1f4;return function(_0x2c1c4c){logger[_0xce82('0x2a')](_0x2c1c4c[_0xce82('0x2b')]);if(_0x2c1c4c['name']){delete _0x2c1c4c[_0xce82('0x2c')];}_0x57aadc['status'](_0xd0076b)[_0xce82('0x2d')](_0x2c1c4c);};}exports[_0xce82('0x2e')]=function(_0x256e7e,_0x19726e){var _0x22a462={},_0x314bf1={},_0x47255e={'count':0x0,'rows':[]};var _0x316ed0=_['map'](db[_0xce82('0x2f')][_0xce82('0x30')],function(_0x529343){return{'name':_0x529343['fieldName'],'type':_0x529343[_0xce82('0x31')][_0xce82('0x32')]};});_0x314bf1[_0xce82('0x33')]=_['map'](_0x316ed0,_0xce82('0x2c'));_0x314bf1[_0xce82('0x34')]=_[_0xce82('0x35')](_0x256e7e[_0xce82('0x34')]);_0x314bf1['filters']=_[_0xce82('0x36')](_0x314bf1['model'],_0x314bf1['query']);_0x22a462[_0xce82('0x37')]=_['intersection'](_0x314bf1[_0xce82('0x33')],qs[_0xce82('0x38')](_0x256e7e[_0xce82('0x34')][_0xce82('0x38')]));_0x22a462[_0xce82('0x37')]=_0x22a462[_0xce82('0x37')]['length']?_0x22a462[_0xce82('0x37')]:_0x314bf1['model'];if(!_0x256e7e[_0xce82('0x34')][_0xce82('0x39')]('nolimit')){_0x22a462[_0xce82('0x21')]=qs[_0xce82('0x21')](_0x256e7e[_0xce82('0x34')][_0xce82('0x21')]);_0x22a462[_0xce82('0x20')]=qs[_0xce82('0x20')](_0x256e7e[_0xce82('0x34')][_0xce82('0x20')]);}_0x22a462[_0xce82('0x3a')]=qs[_0xce82('0x3b')](_0x256e7e[_0xce82('0x34')][_0xce82('0x3b')]);_0x22a462[_0xce82('0x3c')]=qs[_0xce82('0x3d')](_['pick'](_0x256e7e[_0xce82('0x34')],_0x314bf1[_0xce82('0x3d')]),_0x316ed0);if(_0x256e7e['query'][_0xce82('0x3e')]){_0x22a462[_0xce82('0x3c')]=_[_0xce82('0x3f')](_0x22a462[_0xce82('0x3c')],{'$or':_[_0xce82('0x40')](_0x316ed0,function(_0x559b04){if(_0x559b04[_0xce82('0x31')]!==_0xce82('0x41')){var _0x9e6d40={};_0x9e6d40[_0x559b04[_0xce82('0x2c')]]={'$like':'%'+_0x256e7e[_0xce82('0x34')]['filter']+'%'};return _0x9e6d40;}})});}_0x22a462=_[_0xce82('0x3f')]({},_0x22a462,_0x256e7e[_0xce82('0x42')]);var _0x144376={'where':_0x22a462[_0xce82('0x3c')]};return db[_0xce82('0x2f')]['count'](_0x144376)[_0xce82('0x26')](function(_0x59fd91){_0x47255e[_0xce82('0x1f')]=_0x59fd91;if(_0x256e7e['query'][_0xce82('0x43')]){_0x22a462['include']=[{'all':!![]}];}return db[_0xce82('0x2f')][_0xce82('0x44')](_0x22a462);})[_0xce82('0x26')](function(_0x17bee6){_0x47255e[_0xce82('0x45')]=_0x17bee6;return _0x47255e;})['then'](respondWithFilteredResult(_0x19726e,_0x22a462))[_0xce82('0x46')](handleError(_0x19726e,null));};exports['show']=function(_0x138660,_0x219072){var _0xc4da7f={'raw':!![],'where':{'id':_0x138660[_0xce82('0x47')]['id']}},_0x648124={};_0x648124[_0xce82('0x33')]=_[_0xce82('0x35')](db[_0xce82('0x2f')][_0xce82('0x30')]);_0x648124[_0xce82('0x34')]=_[_0xce82('0x35')](_0x138660[_0xce82('0x34')]);_0x648124[_0xce82('0x3d')]=_[_0xce82('0x36')](_0x648124[_0xce82('0x33')],_0x648124['query']);_0xc4da7f['attributes']=_['intersection'](_0x648124[_0xce82('0x33')],qs[_0xce82('0x38')](_0x138660[_0xce82('0x34')][_0xce82('0x38')]));_0xc4da7f['attributes']=_0xc4da7f['attributes'][_0xce82('0x48')]?_0xc4da7f[_0xce82('0x37')]:_0x648124[_0xce82('0x33')];if(_0x138660[_0xce82('0x34')][_0xce82('0x43')]){_0xc4da7f[_0xce82('0x49')]=[{'all':!![]}];}_0xc4da7f=_['merge']({},_0xc4da7f,_0x138660['options']);return db[_0xce82('0x2f')][_0xce82('0x4a')](_0xc4da7f)['then'](handleEntityNotFound(_0x219072,null))[_0xce82('0x26')](respondWithResult(_0x219072,null))[_0xce82('0x46')](handleError(_0x219072,null));};exports[_0xce82('0x4b')]=function(_0x251304,_0x44f365){return db[_0xce82('0x2f')][_0xce82('0x4b')](_0x251304[_0xce82('0x4c')],{})[_0xce82('0x26')](function(_0x1a900e){var _0x5ec350=_0x251304[_0xce82('0x4d')][_0xce82('0x28')]({'plain':!![]});if(!_0x5ec350)throw new Error(_0xce82('0x4e'));if(_0x5ec350[_0xce82('0x4f')]===_0xce82('0x4d')){var _0x2a7b1a=_0x1a900e[_0xce82('0x28')]({'plain':!![]});var _0x3d976e='Reports';return db[_0xce82('0x50')][_0xce82('0x4a')]({'where':{'name':_0x3d976e,'userProfileId':_0x5ec350[_0xce82('0x51')]},'raw':!![]})[_0xce82('0x26')](function(_0x3c6931){if(_0x3c6931&&_0x3c6931[_0xce82('0x52')]===0x0){return db[_0xce82('0x53')][_0xce82('0x4b')]({'name':_0x2a7b1a[_0xce82('0x2c')],'resourceId':_0x2a7b1a['id'],'type':_0xce82('0x29'),'sectionId':_0x3c6931['id']},{})[_0xce82('0x26')](function(){return _0x1a900e;});}else{return _0x1a900e;}})[_0xce82('0x46')](function(_0x58e083){logger['error'](_0xce82('0x54'),_0x58e083);throw _0x58e083;});}return _0x1a900e;})[_0xce82('0x26')](respondWithResult(_0x44f365,0xc9))[_0xce82('0x46')](handleError(_0x44f365,null));};exports[_0xce82('0x55')]=function(_0x3cb8b2,_0x3eca04){if(_0x3cb8b2[_0xce82('0x4c')]['id']){delete _0x3cb8b2[_0xce82('0x4c')]['id'];}return db['AnalyticDefaultReport'][_0xce82('0x4a')]({'where':{'id':_0x3cb8b2[_0xce82('0x47')]['id']}})[_0xce82('0x26')](handleEntityNotFound(_0x3eca04,null))[_0xce82('0x26')](saveUpdates(_0x3cb8b2['body'],null))[_0xce82('0x26')](respondWithResult(_0x3eca04,null))['catch'](handleError(_0x3eca04,null));};exports[_0xce82('0x27')]=function(_0xa45d1f,_0x26dfc8){return db[_0xce82('0x2f')][_0xce82('0x4a')]({'where':{'id':_0xa45d1f[_0xce82('0x47')]['id']}})[_0xce82('0x26')](handleEntityNotFound(_0x26dfc8,null))[_0xce82('0x26')](removeEntity(_0x26dfc8,null))[_0xce82('0x46')](handleError(_0x26dfc8,null));};exports[_0xce82('0x56')]=function(_0x4129f4,_0x4e8722){var _0x474848=0xa;var _0x5ddaa6=[_0xce82('0x57'),_0xce82('0x58'),_0xce82('0x59'),_0xce82('0x5a')];var _0x1d251b={'SUM':_0xce82('0x5b'),'COUNT':_0xce82('0x5c'),'COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':'MIN(%s)','AVG':_0xce82('0x5f'),'GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':_0xce82('0x61'),'GROUP_CONCAT DESC':_0xce82('0x62')};var _0x45d22e={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':_0xce82('0x65'),'ROUND':_0xce82('0x66'),'UNIX_TIMESTAMP':_0xce82('0x67')};var _0x501d8b=function(_0x2fcad3){return!_[_0xce82('0x68')](['IS\x20NULL',_0xce82('0x69'),'IS\x20EMPTY',_0xce82('0x6a')],_0x2fcad3);};var _0x295255=function(_0x25c467){if(!_0x25c467||!_0x25c467[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x25eabc='(',_0xc9af2e=0x0;_0xc9af2e<_0x25c467[_0xce82('0x6b')][_0xce82('0x48')];_0xc9af2e+=0x1){_0xc9af2e>0x0&&(_0x25eabc+='\x20'+_0x25c467[_0xce82('0x6c')]+'\x20');_0x25eabc+=_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x6d')]?_0x295255(_0x25c467[_0xce82('0x6b')][_0xc9af2e]['group']):_0x25c467['rules'][_0xc9af2e][_0xce82('0x6e')]+'\x20'+_0x25c467['rules'][_0xc9af2e][_0xce82('0x6f')]+(_0x501d8b(_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x6f')])?'\x20'+_0x25c467[_0xce82('0x6b')][_0xc9af2e][_0xce82('0x70')]:'');}return _0x25eabc+')';};var _0x460f90={'where':{'id':_0x4129f4[_0xce82('0x47')]['id']}},_0xd0c0eb,_0x603331,_0x1e715d,_0x580a90,_0x5bb986;_0x460f90=_[_0xce82('0x3f')]({},_0x460f90,_0x4129f4[_0xce82('0x42')]);return db[_0xce82('0x2f')]['find'](_0x460f90)[_0xce82('0x26')](function(_0x11323a){if(_0x11323a){_0xd0c0eb=_0x11323a;return _0x11323a[_0xce82('0x71')]();}return null;})[_0xce82('0x26')](function(_0x55c89b){if(_0x55c89b){if(!_0x55c89b[_0xce82('0x48')]){throw new db[(_0xce82('0x72'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x603331=_0x55c89b;return db[_0xce82('0x73')][_0xce82('0x44')]({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x28cd7a){if(_0x28cd7a){_0x1e715d=_['keyBy'](_0x28cd7a,'id');var _0x301f72;var _0x4dca5c=squel[_0xce82('0x74')]();_0x4dca5c[_0xce82('0x75')](_0xd0c0eb[_0xce82('0x76')]);for(var _0x34f2fd=0x0;_0x34f2fd<_0x603331[_0xce82('0x48')];_0x34f2fd+=0x1){_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x77')]?_0x1e715d[_0x603331[_0x34f2fd]['MetricId']][_0xce82('0x78')]:_0x603331[_0x34f2fd]['field'];_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x79')]?_[_0xce82('0x7a')](_0x1d251b[_0x603331[_0x34f2fd][_0xce82('0x79')]],'%s',_0x301f72):_0x301f72;_0x301f72=_0x603331[_0x34f2fd][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x45d22e[_0x603331[_0x34f2fd][_0xce82('0x7b')]],'%s',_0x301f72):_0x301f72;if(_0x603331[_0x34f2fd]['groupBy']){_0x4dca5c[_0xce82('0x6d')](_0x301f72);}_0x603331[_0x34f2fd][_0xce82('0x7c')]&&_0x4dca5c[_0xce82('0x3a')](_0x301f72,_0x603331[_0x34f2fd][_0xce82('0x7c')]==='DESC'?![]:!![]);_0x4dca5c[_0xce82('0x6e')](_0x301f72,_0x603331[_0x34f2fd][_0xce82('0x7d')]||_0x301f72);}if(_0xd0c0eb[_0xce82('0x7e')]){_0xd0c0eb[_0xce82('0x7e')]=JSON[_0xce82('0x7f')](_0xd0c0eb[_0xce82('0x7e')]);for(var _0x1fa552=0x0;_0x1fa552<_0xd0c0eb[_0xce82('0x7e')]['length'];_0x1fa552+=0x1){if(_0xd0c0eb['joins'][_0x1fa552][_0xce82('0x31')]&&_[_0xce82('0x68')](_0x5ddaa6,_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x31')])&&_0xd0c0eb[_0xce82('0x7e')][_0x1fa552]['parentKey']&&_0xd0c0eb['joins'][_0x1fa552][_0xce82('0x80')]&&_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x81')]){_0x4dca5c[_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x31')]](_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0xd0c0eb[_0xce82('0x76')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x83')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x80')],_0xd0c0eb[_0xce82('0x7e')][_0x1fa552][_0xce82('0x81')]));}}}if(_0xd0c0eb[_0xce82('0x84')]){_0xd0c0eb['conditions']=JSON['parse'](_0xd0c0eb[_0xce82('0x84')]);_0x4dca5c[_0xce82('0x3c')](_0x295255(_0xd0c0eb['conditions'][_0xce82('0x6d')]));}_0x5bb986=_0x4dca5c[_0xce82('0x85')]();_0x4dca5c[_0xce82('0x21')](_0x474848);_0x4dca5c['offset'](0x0);logger[_0xce82('0x86')]('Limited\x20Query:',_0x4dca5c['toString']());return db[_0xce82('0x87')][_0xce82('0x34')](_0x4dca5c[_0xce82('0x88')](),{'type':db['sequelize'][_0xce82('0x89')][_0xce82('0x8a')]});}})[_0xce82('0x26')](respondWithResult(_0x4e8722,null))['catch'](handleError(_0x4e8722,null));};function runReport(_0x2c7f80,_0x1ae763,_0x3f6f2c){var _0x1fae86=_0x1ae763['name'];var _0x130fc0=0xa;var _0x3594a2=[_0xce82('0x57'),'left_join',_0xce82('0x59'),'cross_join'];var _0x47ed93={'SUM':_0xce82('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':_0xce82('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':_0xce82('0x61'),'GROUP_CONCAT DESC':_0xce82('0x62')};var _0x37420f={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xce82('0x67')};var _0x46cf4c=function(_0x1f399b){return!_[_0xce82('0x68')]([_0xce82('0x8c'),_0xce82('0x69'),_0xce82('0x8d'),_0xce82('0x6a')],_0x1f399b);};var _0x47a14b=function(_0x49852c){if(!_0x49852c||!_0x49852c[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x197bab='(',_0x28ff52=0x0;_0x28ff52<_0x49852c['rules'][_0xce82('0x48')];_0x28ff52+=0x1){_0x28ff52>0x0&&(_0x197bab+='\x20'+_0x49852c[_0xce82('0x6c')]+'\x20');_0x197bab+=_0x49852c[_0xce82('0x6b')][_0x28ff52]['group']?_0x47a14b(_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6d')]):_0x49852c['rules'][_0x28ff52][_0xce82('0x6e')]+'\x20'+_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6f')]+(_0x46cf4c(_0x49852c[_0xce82('0x6b')][_0x28ff52][_0xce82('0x6f')])?'\x20'+_0x49852c['rules'][_0x28ff52][_0xce82('0x70')]:'');}return _0x197bab+')';};var _0x196426={'where':{'id':_0x2c7f80['id']}},_0x23492a,_0xcb2f77,_0x534100,_0x3a2545,_0x4e4f4b;_0x196426=_[_0xce82('0x3f')]({},_0x196426,_0x3f6f2c);return db[_0xce82('0x2f')][_0xce82('0x4a')](_0x196426)[_0xce82('0x26')](function(_0x16af07){if(_0x16af07){_0x23492a=_0x16af07;return _0x16af07[_0xce82('0x71')]();}return null;})['then'](function(_0xd69238){if(_0xd69238){if(!_0xd69238['length']){throw new db[(_0xce82('0x72'))][(_0xce82('0x8e'))](_0xce82('0x8f'),0x193);}_0xcb2f77=_0xd69238;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x331f7d){if(_0x331f7d){_0x534100=_[_0xce82('0x90')](_0x331f7d,'id');var _0x40fc4d;var _0x943900=squel[_0xce82('0x74')]();_0x943900[_0xce82('0x75')](_0x23492a[_0xce82('0x76')]);for(var _0x2bb43c=0x0;_0x2bb43c<_0xcb2f77[_0xce82('0x48')];_0x2bb43c+=0x1){_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x77')]?_0x534100[_0xcb2f77[_0x2bb43c][_0xce82('0x77')]]['metric']:_0xcb2f77[_0x2bb43c][_0xce82('0x6e')];_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x79')]?_['replace'](_0x47ed93[_0xcb2f77[_0x2bb43c][_0xce82('0x79')]],'%s',_0x40fc4d):_0x40fc4d;_0x40fc4d=_0xcb2f77[_0x2bb43c][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x37420f[_0xcb2f77[_0x2bb43c][_0xce82('0x7b')]],'%s',_0x40fc4d):_0x40fc4d;if(_0xcb2f77[_0x2bb43c]['groupBy']){_0x943900[_0xce82('0x6d')](_0x40fc4d);}_0xcb2f77[_0x2bb43c][_0xce82('0x7c')]&&_0x943900[_0xce82('0x3a')](_0x40fc4d,_0xcb2f77[_0x2bb43c][_0xce82('0x7c')]===_0xce82('0x91')?![]:!![]);_0x943900['field'](_0x40fc4d,_0xcb2f77[_0x2bb43c][_0xce82('0x7d')]||_0x40fc4d);}if(_0x23492a['joins']){_0x23492a[_0xce82('0x7e')]=JSON[_0xce82('0x7f')](_0x23492a[_0xce82('0x7e')]);for(var _0x4c4360=0x0;_0x4c4360<_0x23492a[_0xce82('0x7e')][_0xce82('0x48')];_0x4c4360+=0x1){if(_0x23492a['joins'][_0x4c4360][_0xce82('0x31')]&&_['includes'](_0x3594a2,_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x31')])&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x83')]&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x80')]&&_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x81')]){_0x943900[_0x23492a['joins'][_0x4c4360]['type']](_0x23492a['joins'][_0x4c4360][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0x23492a['table'],_0x23492a['joins'][_0x4c4360]['parentKey'],_0x23492a[_0xce82('0x7e')][_0x4c4360][_0xce82('0x80')],_0x23492a['joins'][_0x4c4360][_0xce82('0x81')]));}}}if(_0x23492a['conditions']){_0x23492a[_0xce82('0x84')]=JSON[_0xce82('0x7f')](_0x23492a[_0xce82('0x84')]);_0x943900[_0xce82('0x3c')](_0x47a14b(_0x23492a['conditions'][_0xce82('0x6d')]));}_0x4e4f4b=_0x943900[_0xce82('0x85')]();_0x943900[_0xce82('0x21')](_0x130fc0);_0x943900['offset'](0x0);logger[_0xce82('0x86')](_0xce82('0x92'),_0x943900[_0xce82('0x88')]());return db[_0xce82('0x87')][_0xce82('0x34')](_0x943900['toString'](),{'type':db[_0xce82('0x87')][_0xce82('0x89')][_0xce82('0x8a')]});}})[_0xce82('0x26')](function(_0xaf56b6){if(!_0xaf56b6[_0xce82('0x48')]){throw new db['Sequelize'][(_0xce82('0x8e'))](_0xce82('0x93'),0xcc);}if(_0x1ae763[_0xce82('0x94')]===_0xce82('0x95')){return null;}var _0x1ec191=_[_0xce82('0x3f')](_0x1ae763,{'name':_0x1ae763[_0xce82('0x96')]||_0x1ae763[_0xce82('0x2c')]||_0x23492a['name'],'basename':_0x1fae86,'savename':util['format']('%s-%s.%s',_0x1ae763[_0xce82('0x2c')]||_0x23492a['name'],require('randomstring')[_0xce82('0x97')](0x4),_0x1ae763['output']||_0xce82('0x98')),'reportId':_0x23492a['id'],'reportType':_0xce82('0x99')});return db['AnalyticExtractedReport'][_0xce82('0x4b')](_0x1ec191,{'raw':!![]});})[_0xce82('0x26')](function(_0x5d758c){if(_0x23492a[_0xce82('0x76')]===_0xce82('0x9a')){_0x4e4f4b[_0xce82('0x3c')](_0x23492a[_0xce82('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1ae763['startDate'],_0x1ae763[_0xce82('0x9b')]);}else{_0x4e4f4b['where'](_0x23492a[_0xce82('0x76')]+_0xce82('0x9c'),_0x1ae763[_0xce82('0x9d')],_0x1ae763[_0xce82('0x9b')]);}if(_0x5d758c){logger[_0xce82('0x9e')](_0xce82('0x9f'),_0x4e4f4b[_0xce82('0x88')]());require(_0xce82('0xa0'))[_0xce82('0xa1')](path[_0xce82('0x57')](__dirname,_0xce82('0xa2'),_0x5d758c[_0xce82('0x94')]),[_0x5d758c['id'],_0x4e4f4b[_0xce82('0x88')](),path[_0xce82('0x57')](__dirname,'../../files/reports',_0x5d758c['savename']),_0x1fae86]);return _0x5d758c;}else{var _0x966b57=squel[_0xce82('0x74')]();_0x966b57[_0xce82('0x75')]('('+_0x4e4f4b[_0xce82('0x88')]()+')',_0xce82('0xa3'));_0x966b57[_0xce82('0x6e')](_0xce82('0xa4'),'count');_0x4e4f4b[_0xce82('0x21')](_0x1ae763[_0xce82('0x21')]||_0x130fc0);_0x4e4f4b[_0xce82('0x20')](_0x1ae763[_0xce82('0x20')]||0x0);return dbH[_0xce82('0x87')][_0xce82('0x34')](_0x966b57[_0xce82('0x88')](),{'type':dbH[_0xce82('0x87')][_0xce82('0x89')][_0xce82('0x8a')]})['then'](function(_0x556017){if(!_0x556017[_0xce82('0x48')]){_0x3a2545=0x0;}else{_0x3a2545=_0x556017[0x0][_0xce82('0x1f')]||0x0;}return dbH['sequelize'][_0xce82('0x34')](_0x4e4f4b[_0xce82('0x88')](),{'type':dbH[_0xce82('0x87')]['QueryTypes'][_0xce82('0x8a')]});})['then'](function(_0xce99c4){return{'rows':_0xce99c4||[],'count':_0x3a2545};});}});}exports[_0xce82('0xa5')]=function(_0x13c384,_0x14a44d){return runReport(_0x13c384[_0xce82('0x47')],_0x13c384[_0xce82('0x34')],_0x13c384[_0xce82('0x42')])[_0xce82('0x26')](respondWithResult(_0x14a44d,null))['catch'](handleError(_0x14a44d,null));};exports['runReport']=runReport;exports[_0xce82('0x34')]=function(_0x1700b2,_0x441274){var _0x4c85ae=0xa;var _0x4254e2=[_0xce82('0x57'),'left_join',_0xce82('0x59'),_0xce82('0x5a')];var _0x5a4a16={'SUM':'SUM(%s)','COUNT':_0xce82('0x5c'),'COUNT DISTINCT':_0xce82('0x5d'),'MAX':_0xce82('0x5e'),'MIN':_0xce82('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xce82('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce82('0x62')};var _0x1874ac={'SEC_TO_TIME':_0xce82('0x63'),'DATE':_0xce82('0x64'),'HOUR':_0xce82('0x65'),'ROUND':_0xce82('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3169d7=function(_0x12d5a9){return!_['includes']([_0xce82('0x8c'),_0xce82('0x69'),_0xce82('0x8d'),'IS\x20NOT\x20EMPTY'],_0x12d5a9);};var _0x40c015=function(_0x3a93ff){if(!_0x3a93ff||!_0x3a93ff[_0xce82('0x6b')][_0xce82('0x48')]){return'';}for(var _0x26d6ec='(',_0xbd6b4b=0x0;_0xbd6b4b<_0x3a93ff[_0xce82('0x6b')][_0xce82('0x48')];_0xbd6b4b+=0x1){_0xbd6b4b>0x0&&(_0x26d6ec+='\x20'+_0x3a93ff[_0xce82('0x6c')]+'\x20');_0x26d6ec+=_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6d')]?_0x40c015(_0x3a93ff['rules'][_0xbd6b4b][_0xce82('0x6d')]):_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6e')]+'\x20'+_0x3a93ff['rules'][_0xbd6b4b][_0xce82('0x6f')]+(_0x3169d7(_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x6f')])?'\x20'+_0x3a93ff[_0xce82('0x6b')][_0xbd6b4b][_0xce82('0x70')]:'');}return _0x26d6ec+')';};var _0x5d9271={'where':{'id':_0x1700b2[_0xce82('0x47')]['id']}},_0x2346b4,_0x1b2b70,_0x5c0d09,_0x28ea29,_0x5f0d71;_0x5d9271=_[_0xce82('0x3f')]({},_0x5d9271,_0x1700b2[_0xce82('0x42')]);return db[_0xce82('0x2f')]['find'](_0x5d9271)[_0xce82('0x26')](function(_0x2aa01b){if(_0x2aa01b){_0x2346b4=_0x2aa01b;return _0x2aa01b[_0xce82('0x71')]();}return null;})['then'](function(_0x39796e){if(_0x39796e){if(!_0x39796e[_0xce82('0x48')]){throw new db[(_0xce82('0x72'))][(_0xce82('0x8e'))](_0xce82('0x8f'),0x193);}_0x1b2b70=_0x39796e;return db[_0xce82('0x73')][_0xce82('0x44')]({'raw':!![]});}return null;})[_0xce82('0x26')](function(_0x18cfec){if(_0x18cfec){_0x5c0d09=_['keyBy'](_0x18cfec,'id');var _0x927097;var _0x2a9c9c=squel[_0xce82('0x74')]();_0x2a9c9c[_0xce82('0x75')](_0x2346b4[_0xce82('0x76')]);for(var _0x17829a=0x0;_0x17829a<_0x1b2b70['length'];_0x17829a+=0x1){_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x77')]?_0x5c0d09[_0x1b2b70[_0x17829a][_0xce82('0x77')]][_0xce82('0x78')]:_0x1b2b70[_0x17829a]['field'];_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x79')]?_[_0xce82('0x7a')](_0x5a4a16[_0x1b2b70[_0x17829a][_0xce82('0x79')]],'%s',_0x927097):_0x927097;_0x927097=_0x1b2b70[_0x17829a][_0xce82('0x7b')]?_[_0xce82('0x7a')](_0x1874ac[_0x1b2b70[_0x17829a][_0xce82('0x7b')]],'%s',_0x927097):_0x927097;if(_0x1b2b70[_0x17829a]['groupBy']){_0x2a9c9c[_0xce82('0x6d')](_0x927097);}_0x1b2b70[_0x17829a]['orderBy']&&_0x2a9c9c[_0xce82('0x3a')](_0x927097,_0x1b2b70[_0x17829a][_0xce82('0x7c')]===_0xce82('0x91')?![]:!![]);_0x2a9c9c[_0xce82('0x6e')](_0x927097,_0x1b2b70[_0x17829a][_0xce82('0x7d')]||_0x927097);}if(_0x2346b4['joins']){_0x2346b4[_0xce82('0x7e')]=JSON['parse'](_0x2346b4[_0xce82('0x7e')]);for(var _0x485d4d=0x0;_0x485d4d<_0x2346b4['joins'][_0xce82('0x48')];_0x485d4d+=0x1){if(_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x31')]&&_[_0xce82('0x68')](_0x4254e2,_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x31')])&&_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x83')]&&_0x2346b4['joins'][_0x485d4d]['foreignTable']&&_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x81')]){_0x2a9c9c[_0x2346b4[_0xce82('0x7e')][_0x485d4d]['type']](_0x2346b4['joins'][_0x485d4d][_0xce82('0x80')],null,util[_0xce82('0x7b')](_0xce82('0x82'),_0x2346b4[_0xce82('0x76')],_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x83')],_0x2346b4[_0xce82('0x7e')][_0x485d4d][_0xce82('0x80')],_0x2346b4['joins'][_0x485d4d]['foreignKey']));}}}if(_0x2346b4[_0xce82('0x84')]){_0x2346b4[_0xce82('0x84')]=JSON['parse'](_0x2346b4[_0xce82('0x84')]);_0x2a9c9c[_0xce82('0x3c')](_0x40c015(_0x2346b4[_0xce82('0x84')][_0xce82('0x6d')]));}_0x5f0d71=_0x2a9c9c[_0xce82('0x85')]();_0x2a9c9c[_0xce82('0x21')](_0x4c85ae);_0x2a9c9c['offset'](0x0);logger[_0xce82('0x86')]('Limited\x20Query:',_0x2a9c9c['toString']());return db[_0xce82('0x87')][_0xce82('0x34')](_0x2a9c9c[_0xce82('0x88')](),{'type':db[_0xce82('0x87')]['QueryTypes']['SELECT']});}})[_0xce82('0x26')](function(){return{'sql':_0x5f0d71[_0xce82('0x88')]()};})[_0xce82('0x26')](respondWithResult(_0x441274,null))['catch'](handleError(_0x441274,null));}; \ No newline at end of file +var _0x35b2=['keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','create','user','role','Reports','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\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','group','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','orderBy','DESC','field','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','ROUND(%s)','operator','ValidationErrorItem','AnalyticMetric','groupBy','clone','No\x20available\x20data','output','web','fullPath','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','runReport','condition','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','name','index','map','AnalyticDefaultReport','type','key','model','query'];(function(_0x154ee4,_0x144cfc){var _0xf61b9e=function(_0xec9218){while(--_0xec9218){_0x154ee4['push'](_0x154ee4['shift']());}};_0xf61b9e(++_0x144cfc);}(_0x35b2,0x116));var _0x235b=function(_0xea2343,_0x18cd0e){_0xea2343=_0xea2343-0x0;var _0x3efc89=_0x35b2[_0xea2343];return _0x3efc89;};'use strict';var pdf=require(_0x235b('0x0'));var emlformat=require(_0x235b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x235b('0x2'));var jsonpatch=require(_0x235b('0x3'));var rp=require(_0x235b('0x4'));var moment=require(_0x235b('0x5'));var BPromise=require(_0x235b('0x6'));var Mustache=require('mustache');var util=require(_0x235b('0x7'));var path=require(_0x235b('0x8'));var sox=require(_0x235b('0x9'));var csv=require(_0x235b('0xa'));var ejs=require(_0x235b('0xb'));var fs=require('fs');var _=require(_0x235b('0xc'));var squel=require(_0x235b('0xd'));var crypto=require(_0x235b('0xe'));var jsforce=require(_0x235b('0xf'));var deskjs=require(_0x235b('0x10'));var toCsv=require(_0x235b('0xa'));var querystring=require(_0x235b('0x11'));var Papa=require(_0x235b('0x12'));var Redis=require('ioredis');var authService=require(_0x235b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x235b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x235b('0x15'))(_0x235b('0x16'));var utils=require('../../config/utils');var config=require(_0x235b('0x17'));var db=require(_0x235b('0x18'))['db'];var dbH=require(_0x235b('0x18'))[_0x235b('0x19')];function respondWithStatusCode(_0x2f1ae1,_0x114154){_0x114154=_0x114154||0xcc;return function(_0x596dd7){if(_0x596dd7){return _0x2f1ae1[_0x235b('0x1a')](_0x114154);}return _0x2f1ae1[_0x235b('0x1b')](_0x114154)[_0x235b('0x1c')]();};}function respondWithResult(_0x47d9e8,_0x5287ce){_0x5287ce=_0x5287ce||0xc8;return function(_0xce03ac){if(_0xce03ac){return _0x47d9e8[_0x235b('0x1b')](_0x5287ce)[_0x235b('0x1d')](_0xce03ac);}};}function respondWithFilteredResult(_0xe11cf5,_0x53d28c){return function(_0x16c1e9){if(_0x16c1e9){var _0x314d65=_0x16c1e9[_0x235b('0x1e')],_0x25ec7f=_0x53d28c[_0x235b('0x1f')],_0xe5fc61=_0x53d28c['offset']+_0x53d28c[_0x235b('0x20')],_0x225fe5;if(_0xe5fc61>=_0x314d65){_0xe5fc61=_0x314d65;_0x225fe5=0xc8;}else{_0x225fe5=0xce;}_0xe11cf5['status'](_0x225fe5);return _0xe11cf5['set'](_0x235b('0x21'),_0x25ec7f+'-'+_0xe5fc61+'/'+_0x314d65)[_0x235b('0x1d')](_0x16c1e9);}return null;};}function patchUpdates(_0x66720d){return function(_0x5bb226){try{jsonpatch['apply'](_0x5bb226,_0x66720d,!![]);}catch(_0x1b0a01){return BPromise[_0x235b('0x22')](_0x1b0a01);}return _0x5bb226[_0x235b('0x23')]();};}function saveUpdates(_0x3d6a19,_0x37df35){return function(_0x583cfb){if(_0x583cfb){return _0x583cfb[_0x235b('0x24')](_0x3d6a19)['then'](function(_0x2a78f5){return _0x2a78f5;});}return null;};}function removeEntity(_0x596218,_0xbbd6f7){return function(_0x4237a6){if(_0x4237a6){return _0x4237a6['destroy']()[_0x235b('0x25')](function(){var _0x480ecc=_0x4237a6[_0x235b('0x26')]({'plain':!![]});var _0x2d3500=_0x235b('0x27');return db[_0x235b('0x28')][_0x235b('0x29')]({'where':{'type':_0x2d3500,'resourceId':_0x480ecc['id']}})['then'](function(){return _0x4237a6;});})['then'](function(){_0x596218['status'](0xcc)[_0x235b('0x1c')]();});}};}function handleEntityNotFound(_0x268e8d,_0x33090c){return function(_0x3c42c6){if(!_0x3c42c6){_0x268e8d[_0x235b('0x1a')](0x194);}return _0x3c42c6;};}function handleError(_0x14fc40,_0x1e1d63){_0x1e1d63=_0x1e1d63||0x1f4;return function(_0x4ce417){logger['error'](_0x4ce417['stack']);if(_0x4ce417[_0x235b('0x2a')]){delete _0x4ce417[_0x235b('0x2a')];}_0x14fc40['status'](_0x1e1d63)['send'](_0x4ce417);};}exports[_0x235b('0x2b')]=function(_0x129d3f,_0x46dbd3){var _0x41145c={},_0x2c19c9={},_0x3b196b={'count':0x0,'rows':[]};var _0x12d1a0=_[_0x235b('0x2c')](db[_0x235b('0x2d')]['rawAttributes'],function(_0x357db1){return{'name':_0x357db1['fieldName'],'type':_0x357db1[_0x235b('0x2e')][_0x235b('0x2f')]};});_0x2c19c9[_0x235b('0x30')]=_['map'](_0x12d1a0,'name');_0x2c19c9[_0x235b('0x31')]=_[_0x235b('0x32')](_0x129d3f['query']);_0x2c19c9[_0x235b('0x33')]=_['intersection'](_0x2c19c9[_0x235b('0x30')],_0x2c19c9[_0x235b('0x31')]);_0x41145c[_0x235b('0x34')]=_['intersection'](_0x2c19c9[_0x235b('0x30')],qs[_0x235b('0x35')](_0x129d3f[_0x235b('0x31')]['fields']));_0x41145c[_0x235b('0x34')]=_0x41145c['attributes'][_0x235b('0x36')]?_0x41145c[_0x235b('0x34')]:_0x2c19c9[_0x235b('0x30')];if(!_0x129d3f[_0x235b('0x31')][_0x235b('0x37')](_0x235b('0x38'))){_0x41145c[_0x235b('0x20')]=qs[_0x235b('0x20')](_0x129d3f['query']['limit']);_0x41145c['offset']=qs[_0x235b('0x1f')](_0x129d3f[_0x235b('0x31')]['offset']);}_0x41145c[_0x235b('0x39')]=qs['sort'](_0x129d3f['query'][_0x235b('0x3a')]);_0x41145c[_0x235b('0x3b')]=qs[_0x235b('0x33')](_[_0x235b('0x3c')](_0x129d3f[_0x235b('0x31')],_0x2c19c9[_0x235b('0x33')]),_0x12d1a0);if(_0x129d3f[_0x235b('0x31')][_0x235b('0x3d')]){_0x41145c[_0x235b('0x3b')]=_[_0x235b('0x3e')](_0x41145c['where'],{'$or':_[_0x235b('0x2c')](_0x12d1a0,function(_0x3c6436){if(_0x3c6436[_0x235b('0x2e')]!=='VIRTUAL'){var _0x353fb6={};_0x353fb6[_0x3c6436[_0x235b('0x2a')]]={'$like':'%'+_0x129d3f[_0x235b('0x31')][_0x235b('0x3d')]+'%'};return _0x353fb6;}})});}_0x41145c=_[_0x235b('0x3e')]({},_0x41145c,_0x129d3f[_0x235b('0x3f')]);var _0x443fe6={'where':_0x41145c['where']};return db['AnalyticDefaultReport']['count'](_0x443fe6)[_0x235b('0x25')](function(_0x232038){_0x3b196b[_0x235b('0x1e')]=_0x232038;if(_0x129d3f[_0x235b('0x31')][_0x235b('0x40')]){_0x41145c[_0x235b('0x41')]=[{'all':!![]}];}return db[_0x235b('0x2d')][_0x235b('0x42')](_0x41145c);})['then'](function(_0x2dd74e){_0x3b196b[_0x235b('0x43')]=_0x2dd74e;return _0x3b196b;})[_0x235b('0x25')](respondWithFilteredResult(_0x46dbd3,_0x41145c))[_0x235b('0x44')](handleError(_0x46dbd3,null));};exports[_0x235b('0x45')]=function(_0x3ed958,_0x852c82){var _0x3fa2fd={'raw':!![],'where':{'id':_0x3ed958[_0x235b('0x46')]['id']}},_0x3cc1ee={};_0x3cc1ee[_0x235b('0x30')]=_[_0x235b('0x32')](db[_0x235b('0x2d')][_0x235b('0x47')]);_0x3cc1ee[_0x235b('0x31')]=_[_0x235b('0x32')](_0x3ed958[_0x235b('0x31')]);_0x3cc1ee[_0x235b('0x33')]=_[_0x235b('0x48')](_0x3cc1ee[_0x235b('0x30')],_0x3cc1ee[_0x235b('0x31')]);_0x3fa2fd[_0x235b('0x34')]=_[_0x235b('0x48')](_0x3cc1ee[_0x235b('0x30')],qs['fields'](_0x3ed958[_0x235b('0x31')][_0x235b('0x35')]));_0x3fa2fd[_0x235b('0x34')]=_0x3fa2fd[_0x235b('0x34')][_0x235b('0x36')]?_0x3fa2fd[_0x235b('0x34')]:_0x3cc1ee[_0x235b('0x30')];if(_0x3ed958[_0x235b('0x31')][_0x235b('0x40')]){_0x3fa2fd[_0x235b('0x41')]=[{'all':!![]}];}_0x3fa2fd=_[_0x235b('0x3e')]({},_0x3fa2fd,_0x3ed958[_0x235b('0x3f')]);return db[_0x235b('0x2d')]['find'](_0x3fa2fd)[_0x235b('0x25')](handleEntityNotFound(_0x852c82,null))[_0x235b('0x25')](respondWithResult(_0x852c82,null))[_0x235b('0x44')](handleError(_0x852c82,null));};exports[_0x235b('0x49')]=function(_0x45ba24,_0x3eb0cd){return db[_0x235b('0x2d')]['create'](_0x45ba24['body'],{})[_0x235b('0x25')](function(_0x3a27fd){var _0x29ae8f=_0x45ba24[_0x235b('0x4a')][_0x235b('0x26')]({'plain':!![]});if(!_0x29ae8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ae8f[_0x235b('0x4b')]===_0x235b('0x4a')){var _0x58cef8=_0x3a27fd[_0x235b('0x26')]({'plain':!![]});var _0x348e75=_0x235b('0x4c');return db[_0x235b('0x4d')][_0x235b('0x4e')]({'where':{'name':_0x348e75,'userProfileId':_0x29ae8f[_0x235b('0x4f')]},'raw':!![]})[_0x235b('0x25')](function(_0x57d5a2){if(_0x57d5a2&&_0x57d5a2['autoAssociation']===0x0){return db[_0x235b('0x28')]['create']({'name':_0x58cef8[_0x235b('0x2a')],'resourceId':_0x58cef8['id'],'type':_0x235b('0x27'),'sectionId':_0x57d5a2['id']},{})[_0x235b('0x25')](function(){return _0x3a27fd;});}else{return _0x3a27fd;}})[_0x235b('0x44')](function(_0x23275a){logger['error'](_0x235b('0x50'),_0x23275a);throw _0x23275a;});}return _0x3a27fd;})[_0x235b('0x25')](respondWithResult(_0x3eb0cd,0xc9))[_0x235b('0x44')](handleError(_0x3eb0cd,null));};exports[_0x235b('0x24')]=function(_0x560c23,_0x10e0e5){if(_0x560c23[_0x235b('0x51')]['id']){delete _0x560c23[_0x235b('0x51')]['id'];}return db[_0x235b('0x2d')][_0x235b('0x4e')]({'where':{'id':_0x560c23[_0x235b('0x46')]['id']}})[_0x235b('0x25')](handleEntityNotFound(_0x10e0e5,null))['then'](saveUpdates(_0x560c23['body'],null))[_0x235b('0x25')](respondWithResult(_0x10e0e5,null))[_0x235b('0x44')](handleError(_0x10e0e5,null));};exports[_0x235b('0x29')]=function(_0x434e52,_0x49e3e7){return db['AnalyticDefaultReport'][_0x235b('0x4e')]({'where':{'id':_0x434e52[_0x235b('0x46')]['id']}})[_0x235b('0x25')](handleEntityNotFound(_0x49e3e7,null))[_0x235b('0x25')](removeEntity(_0x49e3e7,null))[_0x235b('0x44')](handleError(_0x49e3e7,null));};exports[_0x235b('0x52')]=function(_0x4165de,_0x3e26ad){var _0x8f162e=0xa;var _0x4d530b=[_0x235b('0x53'),_0x235b('0x54'),_0x235b('0x55'),_0x235b('0x56')];var _0x287324={'SUM':_0x235b('0x57'),'COUNT':_0x235b('0x58'),'COUNT DISTINCT':_0x235b('0x59'),'MAX':_0x235b('0x5a'),'MIN':_0x235b('0x5b'),'AVG':_0x235b('0x5c'),'GROUP_CONCAT':_0x235b('0x5d'),'GROUP_CONCAT ASC':_0x235b('0x5e'),'GROUP_CONCAT DESC':_0x235b('0x5f')};var _0x775868={'SEC_TO_TIME':_0x235b('0x60'),'DATE':_0x235b('0x61'),'HOUR':_0x235b('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x235b('0x63')};var _0x36b9a8=function(_0x2fbf06){return!_[_0x235b('0x64')]([_0x235b('0x65'),_0x235b('0x66'),_0x235b('0x67'),_0x235b('0x68')],_0x2fbf06);};var _0x8d528f=function(_0xc83fc6){if(!_0xc83fc6||!_0xc83fc6[_0x235b('0x69')]['length']){return'';}for(var _0x5097ff='(',_0x1a155c=0x0;_0x1a155c<_0xc83fc6[_0x235b('0x69')]['length'];_0x1a155c+=0x1){_0x1a155c>0x0&&(_0x5097ff+='\x20'+_0xc83fc6['operator']+'\x20');_0x5097ff+=_0xc83fc6['rules'][_0x1a155c][_0x235b('0x6a')]?_0x8d528f(_0xc83fc6[_0x235b('0x69')][_0x1a155c][_0x235b('0x6a')]):_0xc83fc6[_0x235b('0x69')][_0x1a155c]['field']+'\x20'+_0xc83fc6['rules'][_0x1a155c]['condition']+(_0x36b9a8(_0xc83fc6[_0x235b('0x69')][_0x1a155c]['condition'])?'\x20'+_0xc83fc6[_0x235b('0x69')][_0x1a155c][_0x235b('0x6b')]:'');}return _0x5097ff+')';};var _0x3fb3e4={'where':{'id':_0x4165de[_0x235b('0x46')]['id']}},_0x2e4ff3,_0x1565c2,_0x2cf0f4,_0x27848a,_0x3755e0;_0x3fb3e4=_[_0x235b('0x3e')]({},_0x3fb3e4,_0x4165de['options']);return db['AnalyticDefaultReport'][_0x235b('0x4e')](_0x3fb3e4)[_0x235b('0x25')](function(_0x517cab){if(_0x517cab){_0x2e4ff3=_0x517cab;return _0x517cab[_0x235b('0x6c')]();}return null;})['then'](function(_0x59b007){if(_0x59b007){if(!_0x59b007[_0x235b('0x36')]){throw new db[(_0x235b('0x6d'))]['ValidationErrorItem'](_0x235b('0x6e'),0x193);}_0x1565c2=_0x59b007;return db['AnalyticMetric'][_0x235b('0x42')]({'raw':!![]});}return null;})[_0x235b('0x25')](function(_0x454bbd){if(_0x454bbd){_0x2cf0f4=_[_0x235b('0x6f')](_0x454bbd,'id');var _0x79ccf6;var _0x14f03e=squel[_0x235b('0x70')]();_0x14f03e[_0x235b('0x71')](_0x2e4ff3[_0x235b('0x72')]);for(var _0x3886df=0x0;_0x3886df<_0x1565c2[_0x235b('0x36')];_0x3886df+=0x1){_0x79ccf6=_0x1565c2[_0x3886df][_0x235b('0x73')]?_0x2cf0f4[_0x1565c2[_0x3886df][_0x235b('0x73')]][_0x235b('0x74')]:_0x1565c2[_0x3886df]['field'];_0x79ccf6=_0x1565c2[_0x3886df]['function']?_[_0x235b('0x75')](_0x287324[_0x1565c2[_0x3886df][_0x235b('0x76')]],'%s',_0x79ccf6):_0x79ccf6;_0x79ccf6=_0x1565c2[_0x3886df][_0x235b('0x77')]?_[_0x235b('0x75')](_0x775868[_0x1565c2[_0x3886df][_0x235b('0x77')]],'%s',_0x79ccf6):_0x79ccf6;if(_0x1565c2[_0x3886df]['groupBy']){_0x14f03e['group'](_0x79ccf6);}_0x1565c2[_0x3886df][_0x235b('0x78')]&&_0x14f03e[_0x235b('0x39')](_0x79ccf6,_0x1565c2[_0x3886df][_0x235b('0x78')]===_0x235b('0x79')?![]:!![]);_0x14f03e[_0x235b('0x7a')](_0x79ccf6,_0x1565c2[_0x3886df][_0x235b('0x7b')]||_0x79ccf6);}if(_0x2e4ff3[_0x235b('0x7c')]){_0x2e4ff3[_0x235b('0x7c')]=JSON[_0x235b('0x7d')](_0x2e4ff3['joins']);for(var _0x3ba0ff=0x0;_0x3ba0ff<_0x2e4ff3[_0x235b('0x7c')]['length'];_0x3ba0ff+=0x1){if(_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x2e')]&&_[_0x235b('0x64')](_0x4d530b,_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff]['type'])&&_0x2e4ff3['joins'][_0x3ba0ff]['parentKey']&&_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x7e')]&&_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x7f')]){_0x14f03e[_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x2e')]](_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x7e')],null,util[_0x235b('0x77')](_0x235b('0x80'),_0x2e4ff3[_0x235b('0x72')],_0x2e4ff3['joins'][_0x3ba0ff][_0x235b('0x81')],_0x2e4ff3['joins'][_0x3ba0ff][_0x235b('0x7e')],_0x2e4ff3[_0x235b('0x7c')][_0x3ba0ff][_0x235b('0x7f')]));}}}if(_0x2e4ff3[_0x235b('0x82')]){_0x2e4ff3[_0x235b('0x82')]=JSON[_0x235b('0x7d')](_0x2e4ff3[_0x235b('0x82')]);_0x14f03e[_0x235b('0x3b')](_0x8d528f(_0x2e4ff3[_0x235b('0x82')][_0x235b('0x6a')]));}_0x3755e0=_0x14f03e['clone']();_0x14f03e[_0x235b('0x20')](_0x8f162e);_0x14f03e['offset'](0x0);logger[_0x235b('0x83')](_0x235b('0x84'),_0x14f03e[_0x235b('0x85')]());return db['sequelize'][_0x235b('0x31')](_0x14f03e['toString'](),{'type':db[_0x235b('0x86')][_0x235b('0x87')][_0x235b('0x88')]});}})[_0x235b('0x25')](respondWithResult(_0x3e26ad,null))[_0x235b('0x44')](handleError(_0x3e26ad,null));};function runReport(_0x10a8e8,_0x4b1b34,_0x7e6bac){var _0x546388=_0x4b1b34[_0x235b('0x2a')];var _0x29b9ad=0xa;var _0x57510e=['join','left_join',_0x235b('0x55'),_0x235b('0x56')];var _0x18cd70={'SUM':_0x235b('0x57'),'COUNT':_0x235b('0x58'),'COUNT DISTINCT':_0x235b('0x59'),'MAX':_0x235b('0x5a'),'MIN':'MIN(%s)','AVG':_0x235b('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x235b('0x5e'),'GROUP_CONCAT DESC':_0x235b('0x5f')};var _0x4dab0f={'SEC_TO_TIME':_0x235b('0x60'),'DATE':_0x235b('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x235b('0x89'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x26da94=function(_0x5e7fc8){return!_[_0x235b('0x64')]([_0x235b('0x65'),_0x235b('0x66'),_0x235b('0x67'),_0x235b('0x68')],_0x5e7fc8);};var _0x252ca1=function(_0x17da52){if(!_0x17da52||!_0x17da52[_0x235b('0x69')]['length']){return'';}for(var _0x1464ac='(',_0x331ebf=0x0;_0x331ebf<_0x17da52['rules'][_0x235b('0x36')];_0x331ebf+=0x1){_0x331ebf>0x0&&(_0x1464ac+='\x20'+_0x17da52[_0x235b('0x8a')]+'\x20');_0x1464ac+=_0x17da52[_0x235b('0x69')][_0x331ebf][_0x235b('0x6a')]?_0x252ca1(_0x17da52[_0x235b('0x69')][_0x331ebf][_0x235b('0x6a')]):_0x17da52['rules'][_0x331ebf][_0x235b('0x7a')]+'\x20'+_0x17da52[_0x235b('0x69')][_0x331ebf]['condition']+(_0x26da94(_0x17da52['rules'][_0x331ebf]['condition'])?'\x20'+_0x17da52[_0x235b('0x69')][_0x331ebf][_0x235b('0x6b')]:'');}return _0x1464ac+')';};var _0x47d560={'where':{'id':_0x10a8e8['id']}},_0x4568aa,_0x2944fa,_0x1269d8,_0x316018,_0xb48ad9;_0x47d560=_[_0x235b('0x3e')]({},_0x47d560,_0x7e6bac);return db[_0x235b('0x2d')][_0x235b('0x4e')](_0x47d560)[_0x235b('0x25')](function(_0x45b2b4){if(_0x45b2b4){_0x4568aa=_0x45b2b4;return _0x45b2b4[_0x235b('0x6c')]();}return null;})[_0x235b('0x25')](function(_0x5e0579){if(_0x5e0579){if(!_0x5e0579[_0x235b('0x36')]){throw new db['Sequelize'][(_0x235b('0x8b'))](_0x235b('0x6e'),0x193);}_0x2944fa=_0x5e0579;return db[_0x235b('0x8c')][_0x235b('0x42')]({'raw':!![]});}return null;})['then'](function(_0x1ace7c){if(_0x1ace7c){_0x1269d8=_[_0x235b('0x6f')](_0x1ace7c,'id');var _0x9cad35;var _0x4323fd=squel[_0x235b('0x70')]();_0x4323fd[_0x235b('0x71')](_0x4568aa[_0x235b('0x72')]);for(var _0x5d55fc=0x0;_0x5d55fc<_0x2944fa['length'];_0x5d55fc+=0x1){_0x9cad35=_0x2944fa[_0x5d55fc]['MetricId']?_0x1269d8[_0x2944fa[_0x5d55fc][_0x235b('0x73')]][_0x235b('0x74')]:_0x2944fa[_0x5d55fc][_0x235b('0x7a')];_0x9cad35=_0x2944fa[_0x5d55fc]['function']?_[_0x235b('0x75')](_0x18cd70[_0x2944fa[_0x5d55fc]['function']],'%s',_0x9cad35):_0x9cad35;_0x9cad35=_0x2944fa[_0x5d55fc][_0x235b('0x77')]?_[_0x235b('0x75')](_0x4dab0f[_0x2944fa[_0x5d55fc]['format']],'%s',_0x9cad35):_0x9cad35;if(_0x2944fa[_0x5d55fc][_0x235b('0x8d')]){_0x4323fd[_0x235b('0x6a')](_0x9cad35);}_0x2944fa[_0x5d55fc]['orderBy']&&_0x4323fd[_0x235b('0x39')](_0x9cad35,_0x2944fa[_0x5d55fc][_0x235b('0x78')]===_0x235b('0x79')?![]:!![]);_0x4323fd[_0x235b('0x7a')](_0x9cad35,_0x2944fa[_0x5d55fc][_0x235b('0x7b')]||_0x9cad35);}if(_0x4568aa[_0x235b('0x7c')]){_0x4568aa['joins']=JSON[_0x235b('0x7d')](_0x4568aa[_0x235b('0x7c')]);for(var _0x43a781=0x0;_0x43a781<_0x4568aa[_0x235b('0x7c')][_0x235b('0x36')];_0x43a781+=0x1){if(_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x2e')]&&_[_0x235b('0x64')](_0x57510e,_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x2e')])&&_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x81')]&&_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x7e')]&&_0x4568aa['joins'][_0x43a781][_0x235b('0x7f')]){_0x4323fd[_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x2e')]](_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x7e')],null,util[_0x235b('0x77')](_0x235b('0x80'),_0x4568aa[_0x235b('0x72')],_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x81')],_0x4568aa[_0x235b('0x7c')][_0x43a781][_0x235b('0x7e')],_0x4568aa[_0x235b('0x7c')][_0x43a781]['foreignKey']));}}}if(_0x4568aa[_0x235b('0x82')]){_0x4568aa[_0x235b('0x82')]=JSON[_0x235b('0x7d')](_0x4568aa[_0x235b('0x82')]);_0x4323fd[_0x235b('0x3b')](_0x252ca1(_0x4568aa[_0x235b('0x82')][_0x235b('0x6a')]));}_0xb48ad9=_0x4323fd[_0x235b('0x8e')]();_0x4323fd[_0x235b('0x20')](_0x29b9ad);_0x4323fd[_0x235b('0x1f')](0x0);logger[_0x235b('0x83')](_0x235b('0x84'),_0x4323fd[_0x235b('0x85')]());return db[_0x235b('0x86')][_0x235b('0x31')](_0x4323fd[_0x235b('0x85')](),{'type':db[_0x235b('0x86')][_0x235b('0x87')][_0x235b('0x88')]});}})[_0x235b('0x25')](function(_0x27aa2b){if(!_0x27aa2b[_0x235b('0x36')]){throw new db['Sequelize'][(_0x235b('0x8b'))](_0x235b('0x8f'),0xcc);}if(_0x4b1b34[_0x235b('0x90')]===_0x235b('0x91')){return null;}var _0x3ee73a=_[_0x235b('0x3e')](_0x4b1b34,{'name':_0x4b1b34[_0x235b('0x92')]||_0x4b1b34[_0x235b('0x2a')]||_0x4568aa[_0x235b('0x2a')],'basename':_0x546388,'savename':util['format']('%s-%s.%s',_0x4b1b34['name']||_0x4568aa[_0x235b('0x2a')],require('randomstring')[_0x235b('0x93')](0x4),_0x4b1b34[_0x235b('0x90')]||_0x235b('0x94')),'reportId':_0x4568aa['id'],'reportType':_0x235b('0x95')});return db[_0x235b('0x96')]['create'](_0x3ee73a,{'raw':!![]});})[_0x235b('0x25')](function(_0x426ba1){if(_0x4568aa['table']===_0x235b('0x97')){_0xb48ad9[_0x235b('0x3b')](_0x4568aa[_0x235b('0x72')]+_0x235b('0x98'),_0x4b1b34[_0x235b('0x99')],_0x4b1b34[_0x235b('0x9a')]);}else{_0xb48ad9[_0x235b('0x3b')](_0x4568aa[_0x235b('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4b1b34[_0x235b('0x99')],_0x4b1b34[_0x235b('0x9a')]);}if(_0x426ba1){logger[_0x235b('0x9b')](_0x235b('0x9c'),_0xb48ad9[_0x235b('0x85')]());require(_0x235b('0x9d'))['fork'](path['join'](__dirname,_0x235b('0x9e'),_0x426ba1['output']),[_0x426ba1['id'],_0xb48ad9['toString'](),path[_0x235b('0x53')](__dirname,_0x235b('0x9f'),_0x426ba1['savename']),_0x546388]);return _0x426ba1;}else{var _0x4f3569=squel[_0x235b('0x70')]();_0x4f3569[_0x235b('0x71')]('('+_0xb48ad9[_0x235b('0x85')]()+')',_0x235b('0xa0'));_0x4f3569[_0x235b('0x7a')](_0x235b('0xa1'),_0x235b('0x1e'));_0xb48ad9[_0x235b('0x20')](_0x4b1b34['limit']||_0x29b9ad);_0xb48ad9[_0x235b('0x1f')](_0x4b1b34[_0x235b('0x1f')]||0x0);return dbH['sequelize'][_0x235b('0x31')](_0x4f3569[_0x235b('0x85')](),{'type':dbH[_0x235b('0x86')][_0x235b('0x87')][_0x235b('0x88')]})[_0x235b('0x25')](function(_0x4e9b33){if(!_0x4e9b33[_0x235b('0x36')]){_0x316018=0x0;}else{_0x316018=_0x4e9b33[0x0]['count']||0x0;}return dbH[_0x235b('0x86')][_0x235b('0x31')](_0xb48ad9[_0x235b('0x85')](),{'type':dbH[_0x235b('0x86')][_0x235b('0x87')]['SELECT']});})[_0x235b('0x25')](function(_0x50bdc1){return{'rows':_0x50bdc1||[],'count':_0x316018};});}});}exports['run']=function(_0x5e4cef,_0x5ac903){return runReport(_0x5e4cef[_0x235b('0x46')],_0x5e4cef[_0x235b('0x31')],_0x5e4cef[_0x235b('0x3f')])[_0x235b('0x25')](respondWithResult(_0x5ac903,null))[_0x235b('0x44')](handleError(_0x5ac903,null));};exports[_0x235b('0xa2')]=runReport;exports['query']=function(_0x149a15,_0x37b676){var _0x520d8e=0xa;var _0x4f1897=[_0x235b('0x53'),_0x235b('0x54'),_0x235b('0x55'),_0x235b('0x56')];var _0x4fe5ad={'SUM':_0x235b('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x235b('0x59'),'MAX':_0x235b('0x5a'),'MIN':'MIN(%s)','AVG':_0x235b('0x5c'),'GROUP_CONCAT':_0x235b('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x235b('0x5f')};var _0x180e39={'SEC_TO_TIME':_0x235b('0x60'),'DATE':_0x235b('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x235b('0x89'),'UNIX_TIMESTAMP':_0x235b('0x63')};var _0x4bb045=function(_0xe34d70){return!_[_0x235b('0x64')]([_0x235b('0x65'),'IS\x20NOT\x20NULL',_0x235b('0x67'),_0x235b('0x68')],_0xe34d70);};var _0x2fb963=function(_0xa8ddc){if(!_0xa8ddc||!_0xa8ddc[_0x235b('0x69')][_0x235b('0x36')]){return'';}for(var _0x45bcef='(',_0x10d2f8=0x0;_0x10d2f8<_0xa8ddc[_0x235b('0x69')][_0x235b('0x36')];_0x10d2f8+=0x1){_0x10d2f8>0x0&&(_0x45bcef+='\x20'+_0xa8ddc['operator']+'\x20');_0x45bcef+=_0xa8ddc['rules'][_0x10d2f8]['group']?_0x2fb963(_0xa8ddc['rules'][_0x10d2f8][_0x235b('0x6a')]):_0xa8ddc[_0x235b('0x69')][_0x10d2f8][_0x235b('0x7a')]+'\x20'+_0xa8ddc[_0x235b('0x69')][_0x10d2f8][_0x235b('0xa3')]+(_0x4bb045(_0xa8ddc[_0x235b('0x69')][_0x10d2f8]['condition'])?'\x20'+_0xa8ddc[_0x235b('0x69')][_0x10d2f8]['value']:'');}return _0x45bcef+')';};var _0x3e6cef={'where':{'id':_0x149a15['params']['id']}},_0x31337f,_0x5dc473,_0x225713,_0x3d02d1,_0x312508;_0x3e6cef=_[_0x235b('0x3e')]({},_0x3e6cef,_0x149a15[_0x235b('0x3f')]);return db[_0x235b('0x2d')]['find'](_0x3e6cef)[_0x235b('0x25')](function(_0x4d7987){if(_0x4d7987){_0x31337f=_0x4d7987;return _0x4d7987['getFields']();}return null;})[_0x235b('0x25')](function(_0x4106eb){if(_0x4106eb){if(!_0x4106eb['length']){throw new db[(_0x235b('0x6d'))][(_0x235b('0x8b'))](_0x235b('0x6e'),0x193);}_0x5dc473=_0x4106eb;return db[_0x235b('0x8c')][_0x235b('0x42')]({'raw':!![]});}return null;})['then'](function(_0x244edb){if(_0x244edb){_0x225713=_['keyBy'](_0x244edb,'id');var _0x369416;var _0x5a90aa=squel[_0x235b('0x70')]();_0x5a90aa[_0x235b('0x71')](_0x31337f[_0x235b('0x72')]);for(var _0x15d260=0x0;_0x15d260<_0x5dc473[_0x235b('0x36')];_0x15d260+=0x1){_0x369416=_0x5dc473[_0x15d260][_0x235b('0x73')]?_0x225713[_0x5dc473[_0x15d260][_0x235b('0x73')]][_0x235b('0x74')]:_0x5dc473[_0x15d260][_0x235b('0x7a')];_0x369416=_0x5dc473[_0x15d260]['function']?_['replace'](_0x4fe5ad[_0x5dc473[_0x15d260][_0x235b('0x76')]],'%s',_0x369416):_0x369416;_0x369416=_0x5dc473[_0x15d260]['format']?_['replace'](_0x180e39[_0x5dc473[_0x15d260][_0x235b('0x77')]],'%s',_0x369416):_0x369416;if(_0x5dc473[_0x15d260][_0x235b('0x8d')]){_0x5a90aa['group'](_0x369416);}_0x5dc473[_0x15d260][_0x235b('0x78')]&&_0x5a90aa['order'](_0x369416,_0x5dc473[_0x15d260]['orderBy']===_0x235b('0x79')?![]:!![]);_0x5a90aa[_0x235b('0x7a')](_0x369416,_0x5dc473[_0x15d260][_0x235b('0x7b')]||_0x369416);}if(_0x31337f['joins']){_0x31337f[_0x235b('0x7c')]=JSON['parse'](_0x31337f['joins']);for(var _0xa6194=0x0;_0xa6194<_0x31337f[_0x235b('0x7c')][_0x235b('0x36')];_0xa6194+=0x1){if(_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x2e')]&&_[_0x235b('0x64')](_0x4f1897,_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x2e')])&&_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x81')]&&_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x7e')]&&_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x7f')]){_0x5a90aa[_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x2e')]](_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x31337f['table'],_0x31337f['joins'][_0xa6194][_0x235b('0x81')],_0x31337f[_0x235b('0x7c')][_0xa6194]['foreignTable'],_0x31337f[_0x235b('0x7c')][_0xa6194][_0x235b('0x7f')]));}}}if(_0x31337f[_0x235b('0x82')]){_0x31337f['conditions']=JSON[_0x235b('0x7d')](_0x31337f[_0x235b('0x82')]);_0x5a90aa[_0x235b('0x3b')](_0x2fb963(_0x31337f['conditions']['group']));}_0x312508=_0x5a90aa[_0x235b('0x8e')]();_0x5a90aa[_0x235b('0x20')](_0x520d8e);_0x5a90aa[_0x235b('0x1f')](0x0);logger[_0x235b('0x83')](_0x235b('0x84'),_0x5a90aa['toString']());return db[_0x235b('0x86')][_0x235b('0x31')](_0x5a90aa['toString'](),{'type':db[_0x235b('0x86')]['QueryTypes'][_0x235b('0x88')]});}})['then'](function(){return{'sql':_0x312508[_0x235b('0x85')]()};})[_0x235b('0x25')](respondWithResult(_0x37b676,null))['catch'](handleError(_0x37b676,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0f2e642..f451cb8 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x816485,_0x2f4ff0){var _0x3f7d25=function(_0x2339ed){while(--_0x2339ed){_0x816485['push'](_0x816485['shift']());}};_0x3f7d25(++_0x2f4ff0);}(_0x53ec,0x192));var _0xc53e=function(_0x4e566c,_0x16e04c){_0x4e566c=_0x4e566c-0x0;var _0x31947e=_0x53ec[_0x4e566c];return _0x31947e;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','lodash','api','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x14710d,_0x35dfe4){var _0x294dd9=function(_0x1f6ef7){while(--_0x1f6ef7){_0x14710d['push'](_0x14710d['shift']());}};_0x294dd9(++_0x35dfe4);}(_0x0295,0x1f0));var _0x5029=function(_0x17e4f9,_0x4318be){_0x17e4f9=_0x17e4f9-0x0;var _0xf6cb46=_0x0295[_0x17e4f9];return _0xf6cb46;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 409f8e0..f4af0de 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 _0x590a=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x211897,_0x12b0ac){var _0x35952f=function(_0x18f318){while(--_0x18f318){_0x211897['push'](_0x211897['shift']());}};_0x35952f(++_0x12b0ac);}(_0x590a,0x159));var _0xa590=function(_0x6adbf1,_0x5779c7){_0x6adbf1=_0x6adbf1-0x0;var _0x3b8a42=_0x590a[_0x6adbf1];return _0x3b8a42;};'use strict';var _=require('lodash');var util=require(_0xa590('0x0'));var moment=require(_0xa590('0x1'));var BPromise=require(_0xa590('0x2'));var rs=require(_0xa590('0x3'));var fs=require('fs');var Redis=require(_0xa590('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa590('0x5'))(_0xa590('0x6'));var config=require(_0xa590('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa590('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dcf20,_0x163d19,_0x2ad01a){return new BPromise(function(_0x27a5fa,_0x5d9565){return client['request'](_0x2dcf20,_0x2ad01a)[_0xa590('0x9')](function(_0x486f78){logger[_0xa590('0xa')](_0xa590('0xb'),_0x163d19,_0xa590('0xc'));logger['debug'](_0xa590('0xd'),_0x163d19,_0xa590('0xc'),JSON[_0xa590('0xe')](_0x486f78));if(_0x486f78[_0xa590('0xf')]){if(_0x486f78[_0xa590('0xf')][_0xa590('0x10')]===0x1f4){logger[_0xa590('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0x486f78['error'][_0xa590('0x11')]);return _0x5d9565(_0x486f78[_0xa590('0xf')][_0xa590('0x11')]);}logger[_0xa590('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0x486f78[_0xa590('0xf')][_0xa590('0x11')]);return _0x27a5fa(_0x486f78['error']['message']);}else{logger[_0xa590('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x163d19,_0xa590('0xc'));_0x27a5fa(_0x486f78[_0xa590('0x12')][_0xa590('0x11')]);}})[_0xa590('0x13')](function(_0xfb7055){logger[_0xa590('0xf')](_0xa590('0xb'),_0x163d19,_0xfb7055);_0x5d9565(_0xfb7055);});});} \ No newline at end of file +var _0x1beb=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x1beb,0x165));var _0xb1be=function(_0x2b05e4,_0x4bde9f){_0x2b05e4=_0x2b05e4-0x0;var _0x5e8202=_0x1beb[_0x2b05e4];return _0x5e8202;};'use strict';var _=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var moment=require('moment');var BPromise=require(_0xb1be('0x2'));var rs=require(_0xb1be('0x3'));var fs=require('fs');var Redis=require(_0xb1be('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1be('0x5'));var logger=require(_0xb1be('0x6'))('rpc');var config=require(_0xb1be('0x7'));var jayson=require(_0xb1be('0x8'));var client=jayson[_0xb1be('0x9')][_0xb1be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b548a,_0xc54560,_0x42014d){return new BPromise(function(_0x1c8f2e,_0x533389){return client[_0xb1be('0xb')](_0x1b548a,_0x42014d)['then'](function(_0x54984a){logger[_0xb1be('0xc')](_0xb1be('0xd'),_0xc54560,'request\x20sent');logger['debug'](_0xb1be('0xe'),_0xc54560,_0xb1be('0xf'),JSON['stringify'](_0x54984a));if(_0x54984a[_0xb1be('0x10')]){if(_0x54984a['error'][_0xb1be('0x11')]===0x1f4){logger[_0xb1be('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc54560,_0x54984a[_0xb1be('0x10')][_0xb1be('0x12')]);return _0x533389(_0x54984a[_0xb1be('0x10')][_0xb1be('0x12')]);}logger[_0xb1be('0x10')](_0xb1be('0xd'),_0xc54560,_0x54984a[_0xb1be('0x10')][_0xb1be('0x12')]);return _0x1c8f2e(_0x54984a['error'][_0xb1be('0x12')]);}else{logger['info'](_0xb1be('0xd'),_0xc54560,_0xb1be('0xf'));_0x1c8f2e(_0x54984a[_0xb1be('0x13')][_0xb1be('0x12')]);}})[_0xb1be('0x14')](function(_0x4a0176){logger['error'](_0xb1be('0xd'),_0xc54560,_0x4a0176);_0x533389(_0x4a0176);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 41d275e..1d95e08 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 _0xe37e=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','query','create','put'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe37e,0xbc));var _0xee37=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xe37e[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xee37('0x0'));var util=require(_0xee37('0x1'));var path=require(_0xee37('0x2'));var timeout=require(_0xee37('0x3'));var express=require(_0xee37('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xee37('0x5'));var config=require(_0xee37('0x6'));var controller=require(_0xee37('0x7'));router['get']('/',auth[_0xee37('0x8')](),controller[_0xee37('0x9')]);router[_0xee37('0xa')](_0xee37('0xb'),auth[_0xee37('0x8')](),controller[_0xee37('0xc')]);router['get'](_0xee37('0xd'),auth[_0xee37('0x8')](),controller[_0xee37('0xe')]);router['get'](_0xee37('0xf'),auth[_0xee37('0x8')](),controller['run']);router[_0xee37('0xa')]('/:id/query',auth[_0xee37('0x8')](),controller[_0xee37('0x10')]);router['post']('/',auth[_0xee37('0x8')](),controller[_0xee37('0x11')]);router[_0xee37('0x12')](_0xee37('0xb'),auth[_0xee37('0x8')](),controller[_0xee37('0x13')]);router[_0xee37('0x14')](_0xee37('0xb'),auth['isAuthenticated'](),controller[_0xee37('0x15')]);module[_0xee37('0x16')]=router; \ No newline at end of file +var _0x173d=['get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x173d,0x1c7));var _0xd173=function(_0x22f4e4,_0x16841b){_0x22f4e4=_0x22f4e4-0x0;var _0x325131=_0x173d[_0x22f4e4];return _0x325131;};'use strict';var multer=require(_0xd173('0x0'));var util=require('util');var path=require(_0xd173('0x1'));var timeout=require(_0xd173('0x2'));var express=require('express');var router=express[_0xd173('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd173('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xd173('0x5')]('/',auth[_0xd173('0x6')](),controller[_0xd173('0x7')]);router[_0xd173('0x5')](_0xd173('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xd173('0x5')](_0xd173('0x9'),auth['isAuthenticated'](),controller[_0xd173('0xa')]);router['get'](_0xd173('0xb'),auth['isAuthenticated'](),controller[_0xd173('0xc')]);router['get'](_0xd173('0xd'),auth[_0xd173('0x6')](),controller[_0xd173('0xe')]);router['post']('/',auth[_0xd173('0x6')](),controller[_0xd173('0xf')]);router[_0xd173('0x10')](_0xd173('0x8'),auth[_0xd173('0x6')](),controller[_0xd173('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd173('0x12')]);module[_0xd173('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 ac39966..d0fbcb6 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 _0x4974=['DATE','Loading','manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','xlsx'];(function(_0x4aa76f,_0x5c8dfd){var _0x55dcd8=function(_0x42cee9){while(--_0x42cee9){_0x4aa76f['push'](_0x4aa76f['shift']());}};_0x55dcd8(++_0x5c8dfd);}(_0x4974,0x125));var _0x4497=function(_0x41790f,_0x3b4c01){_0x41790f=_0x41790f-0x0;var _0x3df424=_0x4974[_0x41790f];return _0x3df424;};'use strict';var Sequelize=require(_0x4497('0x0'));var moment=require(_0x4497('0x1'));module[_0x4497('0x2')]={'name':{'type':Sequelize[_0x4497('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4497('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4497('0x4')](_0x4497('0x5'),'pdf',_0x4497('0x6')),'allowNull':![],'defaultValue':_0x4497('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4497('0x7')]},'endDate':{'type':Sequelize[_0x4497('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4497('0x8')},'type':{'type':Sequelize[_0x4497('0x4')](_0x4497('0x9'),_0x4497('0xa')),'allowNull':![],'defaultValue':_0x4497('0x9')},'reportId':{'type':Sequelize[_0x4497('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4b0b=['xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0xf32dbe,_0x4631bf){var _0x415e8c=function(_0x11ebf2){while(--_0x11ebf2){_0xf32dbe['push'](_0xf32dbe['shift']());}};_0x415e8c(++_0x4631bf);}(_0x4b0b,0x1e7));var _0xb4b0=function(_0x360f3a,_0x355afb){_0x360f3a=_0x360f3a-0x0;var _0x49ead5=_0x4b0b[_0x360f3a];return _0x49ead5;};'use strict';var Sequelize=require(_0xb4b0('0x0'));var moment=require(_0xb4b0('0x1'));module[_0xb4b0('0x2')]={'name':{'type':Sequelize[_0xb4b0('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xb4b0('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xb4b0('0x4')](_0xb4b0('0x5'),_0xb4b0('0x6'),_0xb4b0('0x7')),'allowNull':![],'defaultValue':_0xb4b0('0x5')},'savename':{'type':Sequelize[_0xb4b0('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb4b0('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb4b0('0x3')],'defaultValue':_0xb4b0('0x9')},'type':{'type':Sequelize[_0xb4b0('0x4')](_0xb4b0('0xa'),_0xb4b0('0xb')),'allowNull':![],'defaultValue':_0xb4b0('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb4b0('0xc')]},'reportType':{'type':Sequelize[_0xb4b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 332a6aa..a8bdb99 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 _0xf234=['body','params','download','basename','output','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','savename','format','%s.%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','then','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf234,0xd2));var _0x4f23=function(_0x1e7aa7,_0x4e83fd){_0x1e7aa7=_0x1e7aa7-0x0;var _0x4d3c52=_0xf234[_0x1e7aa7];return _0x4d3c52;};'use strict';var pdf=require(_0x4f23('0x0'));var emlformat=require(_0x4f23('0x1'));var rimraf=require(_0x4f23('0x2'));var zipdir=require(_0x4f23('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f23('0x4'));var moment=require(_0x4f23('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f23('0x6'));var util=require(_0x4f23('0x7'));var path=require(_0x4f23('0x8'));var sox=require('sox');var csv=require(_0x4f23('0x9'));var ejs=require(_0x4f23('0xa'));var fs=require('fs');var _=require(_0x4f23('0xb'));var squel=require(_0x4f23('0xc'));var crypto=require(_0x4f23('0xd'));var jsforce=require(_0x4f23('0xe'));var deskjs=require(_0x4f23('0xf'));var toCsv=require(_0x4f23('0x9'));var querystring=require(_0x4f23('0x10'));var Papa=require(_0x4f23('0x11'));var Redis=require(_0x4f23('0x12'));var authService=require(_0x4f23('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4f23('0x14'));var hardwareService=require(_0x4f23('0x15'));var logger=require(_0x4f23('0x16'))(_0x4f23('0x17'));var utils=require('../../config/utils');var config=require(_0x4f23('0x18'));var db=require(_0x4f23('0x19'))['db'];function respondWithStatusCode(_0x5badd0,_0x4a4c84){_0x4a4c84=_0x4a4c84||0xcc;return function(_0x505a50){if(_0x505a50){return _0x5badd0[_0x4f23('0x1a')](_0x4a4c84);}return _0x5badd0[_0x4f23('0x1b')](_0x4a4c84)[_0x4f23('0x1c')]();};}function respondWithResult(_0x1cea9a,_0x128cd9){_0x128cd9=_0x128cd9||0xc8;return function(_0x128bbf){if(_0x128bbf){return _0x1cea9a[_0x4f23('0x1b')](_0x128cd9)[_0x4f23('0x1d')](_0x128bbf);}};}function respondWithFilteredResult(_0x174f0f,_0x321ceb){return function(_0x5c415b){if(_0x5c415b){var _0x537115=_0x5c415b[_0x4f23('0x1e')],_0x53cb9e=_0x321ceb[_0x4f23('0x1f')],_0x180338=_0x321ceb[_0x4f23('0x1f')]+_0x321ceb['limit'],_0x1937b6;if(_0x180338>=_0x537115){_0x180338=_0x537115;_0x1937b6=0xc8;}else{_0x1937b6=0xce;}_0x174f0f[_0x4f23('0x1b')](_0x1937b6);return _0x174f0f[_0x4f23('0x20')](_0x4f23('0x21'),_0x53cb9e+'-'+_0x180338+'/'+_0x537115)[_0x4f23('0x1d')](_0x5c415b);}return null;};}function patchUpdates(_0x346a73){return function(_0x4d67fd){try{jsonpatch[_0x4f23('0x22')](_0x4d67fd,_0x346a73,!![]);}catch(_0x539fd9){return BPromise[_0x4f23('0x23')](_0x539fd9);}return _0x4d67fd[_0x4f23('0x24')]();};}function saveUpdates(_0xa280d3,_0x306bbe){return function(_0x4ba403){if(_0x4ba403){return _0x4ba403[_0x4f23('0x25')](_0xa280d3)['then'](function(_0x5ece14){return _0x5ece14;});}return null;};}function removeEntity(_0x334c2c,_0x35b21a){return function(_0x2487b1){if(_0x2487b1){return _0x2487b1[_0x4f23('0x26')]()['then'](function(){var _0x4af4da=_0x2487b1[_0x4f23('0x27')]({'plain':!![]});var _0x1db2d4=_0x4f23('0x28');return db['UserProfileResource'][_0x4f23('0x26')]({'where':{'type':_0x1db2d4,'resourceId':_0x4af4da['id']}})['then'](function(){return _0x2487b1;});})[_0x4f23('0x29')](function(){_0x334c2c[_0x4f23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a78c,_0x4e8d57){return function(_0x5965e7){if(!_0x5965e7){_0x26a78c[_0x4f23('0x1a')](0x194);}return _0x5965e7;};}function handleError(_0x1356ba,_0x50c83a){_0x50c83a=_0x50c83a||0x1f4;return function(_0x4314ab){logger['error'](_0x4314ab[_0x4f23('0x2a')]);if(_0x4314ab[_0x4f23('0x2b')]){delete _0x4314ab[_0x4f23('0x2b')];}_0x1356ba['status'](_0x50c83a)[_0x4f23('0x2c')](_0x4314ab);};}exports[_0x4f23('0x2d')]=function(_0x10aae8,_0x5dc5cd){var _0x5a561f={},_0x255d4e={},_0x511e03={'count':0x0,'rows':[]};var _0x1809f7=_[_0x4f23('0x2e')](db[_0x4f23('0x2f')][_0x4f23('0x30')],function(_0x47757b){return{'name':_0x47757b['fieldName'],'type':_0x47757b[_0x4f23('0x31')][_0x4f23('0x32')]};});_0x255d4e[_0x4f23('0x33')]=_[_0x4f23('0x2e')](_0x1809f7,_0x4f23('0x2b'));_0x255d4e[_0x4f23('0x34')]=_[_0x4f23('0x35')](_0x10aae8[_0x4f23('0x34')]);_0x255d4e[_0x4f23('0x36')]=_[_0x4f23('0x37')](_0x255d4e[_0x4f23('0x33')],_0x255d4e[_0x4f23('0x34')]);_0x5a561f[_0x4f23('0x38')]=_[_0x4f23('0x37')](_0x255d4e[_0x4f23('0x33')],qs[_0x4f23('0x39')](_0x10aae8[_0x4f23('0x34')][_0x4f23('0x39')]));_0x5a561f['attributes']=_0x5a561f[_0x4f23('0x38')][_0x4f23('0x3a')]?_0x5a561f[_0x4f23('0x38')]:_0x255d4e[_0x4f23('0x33')];if(!_0x10aae8[_0x4f23('0x34')]['hasOwnProperty'](_0x4f23('0x3b'))){_0x5a561f[_0x4f23('0x3c')]=qs[_0x4f23('0x3c')](_0x10aae8[_0x4f23('0x34')]['limit']);_0x5a561f[_0x4f23('0x1f')]=qs[_0x4f23('0x1f')](_0x10aae8['query'][_0x4f23('0x1f')]);}_0x5a561f[_0x4f23('0x3d')]=qs[_0x4f23('0x3e')](_0x10aae8[_0x4f23('0x34')][_0x4f23('0x3e')]);_0x5a561f[_0x4f23('0x3f')]=qs['filters'](_[_0x4f23('0x40')](_0x10aae8[_0x4f23('0x34')],_0x255d4e[_0x4f23('0x36')]),_0x1809f7);if(_0x10aae8[_0x4f23('0x34')]['filter']){_0x5a561f[_0x4f23('0x3f')]=_[_0x4f23('0x41')](_0x5a561f[_0x4f23('0x3f')],{'$or':_['map'](_0x1809f7,function(_0x172f8d){if(_0x172f8d[_0x4f23('0x31')]!=='VIRTUAL'){var _0x59f62e={};_0x59f62e[_0x172f8d[_0x4f23('0x2b')]]={'$like':'%'+_0x10aae8[_0x4f23('0x34')][_0x4f23('0x42')]+'%'};return _0x59f62e;}})});}_0x5a561f=_[_0x4f23('0x41')]({},_0x5a561f,_0x10aae8['options']);var _0x3c6213={'where':_0x5a561f[_0x4f23('0x3f')]};return db[_0x4f23('0x2f')][_0x4f23('0x1e')](_0x3c6213)[_0x4f23('0x29')](function(_0x657e44){_0x511e03[_0x4f23('0x1e')]=_0x657e44;if(_0x10aae8['query'][_0x4f23('0x43')]){_0x5a561f[_0x4f23('0x44')]=[{'all':!![]}];}return db[_0x4f23('0x2f')]['findAll'](_0x5a561f);})[_0x4f23('0x29')](function(_0x152cbe){_0x511e03['rows']=_0x152cbe;return _0x511e03;})['then'](respondWithFilteredResult(_0x5dc5cd,_0x5a561f))[_0x4f23('0x45')](handleError(_0x5dc5cd,null));};exports[_0x4f23('0x46')]=function(_0x3c02fe,_0xc79409){var _0x2fa9bc={'raw':!![],'where':{'id':_0x3c02fe['params']['id']}},_0x10fdba={};_0x10fdba[_0x4f23('0x33')]=_['keys'](db[_0x4f23('0x2f')][_0x4f23('0x30')]);_0x10fdba['query']=_['keys'](_0x3c02fe['query']);_0x10fdba['filters']=_['intersection'](_0x10fdba['model'],_0x10fdba['query']);_0x2fa9bc['attributes']=_['intersection'](_0x10fdba[_0x4f23('0x33')],qs[_0x4f23('0x39')](_0x3c02fe[_0x4f23('0x34')][_0x4f23('0x39')]));_0x2fa9bc[_0x4f23('0x38')]=_0x2fa9bc[_0x4f23('0x38')][_0x4f23('0x3a')]?_0x2fa9bc[_0x4f23('0x38')]:_0x10fdba[_0x4f23('0x33')];if(_0x3c02fe[_0x4f23('0x34')]['includeAll']){_0x2fa9bc[_0x4f23('0x44')]=[{'all':!![]}];}_0x2fa9bc=_['merge']({},_0x2fa9bc,_0x3c02fe['options']);return db[_0x4f23('0x2f')][_0x4f23('0x47')](_0x2fa9bc)[_0x4f23('0x29')](handleEntityNotFound(_0xc79409,null))[_0x4f23('0x29')](respondWithResult(_0xc79409,null))[_0x4f23('0x45')](handleError(_0xc79409,null));};exports[_0x4f23('0x48')]=function(_0xed075e,_0x526d32){return db['AnalyticExtractedReport'][_0x4f23('0x48')](_0xed075e['body'],{})['then'](function(_0x3c2e09){var _0x4e9afe=_0xed075e[_0x4f23('0x49')][_0x4f23('0x27')]({'plain':!![]});if(!_0x4e9afe)throw new Error(_0x4f23('0x4a'));if(_0x4e9afe[_0x4f23('0x4b')]==='user'){var _0x54c362=_0x3c2e09[_0x4f23('0x27')]({'plain':!![]});var _0x1c5f5a='ExtractedReports';return db[_0x4f23('0x4c')][_0x4f23('0x47')]({'where':{'name':_0x1c5f5a,'userProfileId':_0x4e9afe[_0x4f23('0x4d')]},'raw':!![]})[_0x4f23('0x29')](function(_0x55d7bf){if(_0x55d7bf&&_0x55d7bf[_0x4f23('0x4e')]===0x0){return db[_0x4f23('0x4f')][_0x4f23('0x48')]({'name':_0x54c362[_0x4f23('0x2b')],'resourceId':_0x54c362['id'],'type':_0x55d7bf[_0x4f23('0x2b')],'sectionId':_0x55d7bf['id']},{})[_0x4f23('0x29')](function(){return _0x3c2e09;});}else{return _0x3c2e09;}})[_0x4f23('0x45')](function(_0x14f0d1){logger['error'](_0x4f23('0x50'),_0x14f0d1);throw _0x14f0d1;});}return _0x3c2e09;})['then'](respondWithResult(_0x526d32,0xc9))['catch'](handleError(_0x526d32,null));};exports[_0x4f23('0x25')]=function(_0x4361aa,_0x4ff05c){if(_0x4361aa[_0x4f23('0x51')]['id']){delete _0x4361aa['body']['id'];}return db['AnalyticExtractedReport'][_0x4f23('0x47')]({'where':{'id':_0x4361aa[_0x4f23('0x52')]['id']}})[_0x4f23('0x29')](handleEntityNotFound(_0x4ff05c,null))[_0x4f23('0x29')](saveUpdates(_0x4361aa[_0x4f23('0x51')],null))['then'](respondWithResult(_0x4ff05c,null))[_0x4f23('0x45')](handleError(_0x4ff05c,null));};exports['destroy']=function(_0x370ae7,_0x13aeca){return db[_0x4f23('0x2f')][_0x4f23('0x47')]({'where':{'id':_0x370ae7[_0x4f23('0x52')]['id']}})[_0x4f23('0x29')](handleEntityNotFound(_0x13aeca,null))[_0x4f23('0x29')](removeEntity(_0x13aeca,null))[_0x4f23('0x45')](handleError(_0x13aeca,null));};exports[_0x4f23('0x53')]=function(_0x1c432f,_0x481e9b,_0x20f819){return db[_0x4f23('0x2f')][_0x4f23('0x47')]({'where':{'id':_0x1c432f[_0x4f23('0x52')]['id']},'attributes':[_0x4f23('0x2b'),_0x4f23('0x54'),'savename',_0x4f23('0x55')],'raw':!![]})[_0x4f23('0x29')](handleEntityNotFound(_0x481e9b,null))['then'](function(_0xbd32e4){if(_0xbd32e4){if(!fs[_0x4f23('0x56')](path[_0x4f23('0x57')](config[_0x4f23('0x58')],'server/files/reports',_0xbd32e4['savename']))){throw new db[(_0x4f23('0x59'))][(_0x4f23('0x5a'))](_0x4f23('0x5b'));}if(_0x1c432f[_0x4f23('0x34')][_0x4f23('0x5c')]){return _0x481e9b[_0x4f23('0x1a')](0xc8);}return _0x481e9b[_0x4f23('0x53')](path[_0x4f23('0x57')](config[_0x4f23('0x58')],_0x4f23('0x5d'),_0xbd32e4[_0x4f23('0x5e')]),util[_0x4f23('0x5f')](_0x4f23('0x60'),_0xbd32e4[_0x4f23('0x54')]||_0xbd32e4[_0x4f23('0x2b')],_0xbd32e4[_0x4f23('0x55')]['toLowerCase']()));}})[_0x4f23('0x45')](handleError(_0x481e9b,null));}; \ No newline at end of file +var _0x9bb9=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','ExtractedReports','UserProfileResource','then','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','rows','catch','show','params','keys','include','find','create','body','user','get','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','join','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','format','toLowerCase','html-pdf','eml-format'];(function(_0x2e833a,_0xf24472){var _0x5d4a20=function(_0x31e0b6){while(--_0x31e0b6){_0x2e833a['push'](_0x2e833a['shift']());}};_0x5d4a20(++_0xf24472);}(_0x9bb9,0xb2));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x99bb('0x0'));var emlformat=require(_0x99bb('0x1'));var rimraf=require(_0x99bb('0x2'));var zipdir=require(_0x99bb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99bb('0x4'));var moment=require(_0x99bb('0x5'));var BPromise=require(_0x99bb('0x6'));var Mustache=require(_0x99bb('0x7'));var util=require(_0x99bb('0x8'));var path=require(_0x99bb('0x9'));var sox=require(_0x99bb('0xa'));var csv=require('to-csv');var ejs=require(_0x99bb('0xb'));var fs=require('fs');var _=require(_0x99bb('0xc'));var squel=require('squel');var crypto=require(_0x99bb('0xd'));var jsforce=require(_0x99bb('0xe'));var deskjs=require(_0x99bb('0xf'));var toCsv=require(_0x99bb('0x10'));var querystring=require('querystring');var Papa=require(_0x99bb('0x11'));var Redis=require(_0x99bb('0x12'));var authService=require(_0x99bb('0x13'));var qs=require(_0x99bb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99bb('0x15'));var logger=require(_0x99bb('0x16'))(_0x99bb('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cc78f,_0x355e1f){_0x355e1f=_0x355e1f||0xcc;return function(_0x438435){if(_0x438435){return _0x1cc78f[_0x99bb('0x18')](_0x355e1f);}return _0x1cc78f[_0x99bb('0x19')](_0x355e1f)[_0x99bb('0x1a')]();};}function respondWithResult(_0x4b1441,_0x3ab52d){_0x3ab52d=_0x3ab52d||0xc8;return function(_0x5c1d00){if(_0x5c1d00){return _0x4b1441[_0x99bb('0x19')](_0x3ab52d)[_0x99bb('0x1b')](_0x5c1d00);}};}function respondWithFilteredResult(_0x1c5e82,_0x10d4dd){return function(_0x3e04e6){if(_0x3e04e6){var _0x4aac71=_0x3e04e6[_0x99bb('0x1c')],_0x5a2f5a=_0x10d4dd[_0x99bb('0x1d')],_0x53d276=_0x10d4dd[_0x99bb('0x1d')]+_0x10d4dd[_0x99bb('0x1e')],_0x6b6033;if(_0x53d276>=_0x4aac71){_0x53d276=_0x4aac71;_0x6b6033=0xc8;}else{_0x6b6033=0xce;}_0x1c5e82[_0x99bb('0x19')](_0x6b6033);return _0x1c5e82['set'](_0x99bb('0x1f'),_0x5a2f5a+'-'+_0x53d276+'/'+_0x4aac71)[_0x99bb('0x1b')](_0x3e04e6);}return null;};}function patchUpdates(_0x28dddd){return function(_0x279183){try{jsonpatch['apply'](_0x279183,_0x28dddd,!![]);}catch(_0x3c1684){return BPromise[_0x99bb('0x20')](_0x3c1684);}return _0x279183[_0x99bb('0x21')]();};}function saveUpdates(_0x523673,_0x4e14ea){return function(_0x4d5dcb){if(_0x4d5dcb){return _0x4d5dcb[_0x99bb('0x22')](_0x523673)['then'](function(_0x4dd71f){return _0x4dd71f;});}return null;};}function removeEntity(_0x17c4be,_0x916c3){return function(_0x1e0e13){if(_0x1e0e13){return _0x1e0e13[_0x99bb('0x23')]()['then'](function(){var _0x1548dd=_0x1e0e13['get']({'plain':!![]});var _0x5f22c8=_0x99bb('0x24');return db[_0x99bb('0x25')][_0x99bb('0x23')]({'where':{'type':_0x5f22c8,'resourceId':_0x1548dd['id']}})[_0x99bb('0x26')](function(){return _0x1e0e13;});})[_0x99bb('0x26')](function(){_0x17c4be['status'](0xcc)[_0x99bb('0x1a')]();});}};}function handleEntityNotFound(_0x3abfb9,_0x360d96){return function(_0x20fb78){if(!_0x20fb78){_0x3abfb9['sendStatus'](0x194);}return _0x20fb78;};}function handleError(_0x6df335,_0x2307c4){_0x2307c4=_0x2307c4||0x1f4;return function(_0xe388a7){logger[_0x99bb('0x27')](_0xe388a7[_0x99bb('0x28')]);if(_0xe388a7[_0x99bb('0x29')]){delete _0xe388a7[_0x99bb('0x29')];}_0x6df335[_0x99bb('0x19')](_0x2307c4)[_0x99bb('0x2a')](_0xe388a7);};}exports[_0x99bb('0x2b')]=function(_0x3fbc27,_0x8761d3){var _0x1547b3={},_0x552f7b={},_0x4dd435={'count':0x0,'rows':[]};var _0x205ec6=_[_0x99bb('0x2c')](db[_0x99bb('0x2d')][_0x99bb('0x2e')],function(_0x13d3d2){return{'name':_0x13d3d2['fieldName'],'type':_0x13d3d2[_0x99bb('0x2f')][_0x99bb('0x30')]};});_0x552f7b[_0x99bb('0x31')]=_['map'](_0x205ec6,_0x99bb('0x29'));_0x552f7b[_0x99bb('0x32')]=_['keys'](_0x3fbc27['query']);_0x552f7b[_0x99bb('0x33')]=_['intersection'](_0x552f7b[_0x99bb('0x31')],_0x552f7b['query']);_0x1547b3[_0x99bb('0x34')]=_[_0x99bb('0x35')](_0x552f7b[_0x99bb('0x31')],qs['fields'](_0x3fbc27['query'][_0x99bb('0x36')]));_0x1547b3[_0x99bb('0x34')]=_0x1547b3[_0x99bb('0x34')][_0x99bb('0x37')]?_0x1547b3[_0x99bb('0x34')]:_0x552f7b[_0x99bb('0x31')];if(!_0x3fbc27[_0x99bb('0x32')][_0x99bb('0x38')](_0x99bb('0x39'))){_0x1547b3[_0x99bb('0x1e')]=qs[_0x99bb('0x1e')](_0x3fbc27[_0x99bb('0x32')][_0x99bb('0x1e')]);_0x1547b3['offset']=qs[_0x99bb('0x1d')](_0x3fbc27[_0x99bb('0x32')][_0x99bb('0x1d')]);}_0x1547b3[_0x99bb('0x3a')]=qs[_0x99bb('0x3b')](_0x3fbc27[_0x99bb('0x32')][_0x99bb('0x3b')]);_0x1547b3[_0x99bb('0x3c')]=qs[_0x99bb('0x33')](_['pick'](_0x3fbc27[_0x99bb('0x32')],_0x552f7b['filters']),_0x205ec6);if(_0x3fbc27['query'][_0x99bb('0x3d')]){_0x1547b3[_0x99bb('0x3c')]=_[_0x99bb('0x3e')](_0x1547b3['where'],{'$or':_[_0x99bb('0x2c')](_0x205ec6,function(_0x283007){if(_0x283007[_0x99bb('0x2f')]!=='VIRTUAL'){var _0x48245a={};_0x48245a[_0x283007['name']]={'$like':'%'+_0x3fbc27[_0x99bb('0x32')][_0x99bb('0x3d')]+'%'};return _0x48245a;}})});}_0x1547b3=_[_0x99bb('0x3e')]({},_0x1547b3,_0x3fbc27[_0x99bb('0x3f')]);var _0x2e6ab4={'where':_0x1547b3[_0x99bb('0x3c')]};return db[_0x99bb('0x2d')]['count'](_0x2e6ab4)[_0x99bb('0x26')](function(_0x1a9db7){_0x4dd435[_0x99bb('0x1c')]=_0x1a9db7;if(_0x3fbc27['query']['includeAll']){_0x1547b3['include']=[{'all':!![]}];}return db[_0x99bb('0x2d')]['findAll'](_0x1547b3);})[_0x99bb('0x26')](function(_0x4071d1){_0x4dd435[_0x99bb('0x40')]=_0x4071d1;return _0x4dd435;})[_0x99bb('0x26')](respondWithFilteredResult(_0x8761d3,_0x1547b3))[_0x99bb('0x41')](handleError(_0x8761d3,null));};exports[_0x99bb('0x42')]=function(_0x1ac7b7,_0x3ae288){var _0x4dc6cf={'raw':!![],'where':{'id':_0x1ac7b7[_0x99bb('0x43')]['id']}},_0x5ab881={};_0x5ab881[_0x99bb('0x31')]=_['keys'](db['AnalyticExtractedReport'][_0x99bb('0x2e')]);_0x5ab881[_0x99bb('0x32')]=_[_0x99bb('0x44')](_0x1ac7b7[_0x99bb('0x32')]);_0x5ab881[_0x99bb('0x33')]=_[_0x99bb('0x35')](_0x5ab881[_0x99bb('0x31')],_0x5ab881[_0x99bb('0x32')]);_0x4dc6cf['attributes']=_[_0x99bb('0x35')](_0x5ab881['model'],qs[_0x99bb('0x36')](_0x1ac7b7[_0x99bb('0x32')][_0x99bb('0x36')]));_0x4dc6cf[_0x99bb('0x34')]=_0x4dc6cf[_0x99bb('0x34')]['length']?_0x4dc6cf[_0x99bb('0x34')]:_0x5ab881[_0x99bb('0x31')];if(_0x1ac7b7[_0x99bb('0x32')]['includeAll']){_0x4dc6cf[_0x99bb('0x45')]=[{'all':!![]}];}_0x4dc6cf=_[_0x99bb('0x3e')]({},_0x4dc6cf,_0x1ac7b7[_0x99bb('0x3f')]);return db[_0x99bb('0x2d')][_0x99bb('0x46')](_0x4dc6cf)[_0x99bb('0x26')](handleEntityNotFound(_0x3ae288,null))[_0x99bb('0x26')](respondWithResult(_0x3ae288,null))[_0x99bb('0x41')](handleError(_0x3ae288,null));};exports[_0x99bb('0x47')]=function(_0x8293d1,_0x3beca4){return db[_0x99bb('0x2d')][_0x99bb('0x47')](_0x8293d1[_0x99bb('0x48')],{})[_0x99bb('0x26')](function(_0x1084eb){var _0x20e140=_0x8293d1[_0x99bb('0x49')][_0x99bb('0x4a')]({'plain':!![]});if(!_0x20e140)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e140[_0x99bb('0x4b')]===_0x99bb('0x49')){var _0xdbb648=_0x1084eb[_0x99bb('0x4a')]({'plain':!![]});var _0x1d045e='ExtractedReports';return db['UserProfileSection'][_0x99bb('0x46')]({'where':{'name':_0x1d045e,'userProfileId':_0x20e140[_0x99bb('0x4c')]},'raw':!![]})[_0x99bb('0x26')](function(_0x4793da){if(_0x4793da&&_0x4793da['autoAssociation']===0x0){return db['UserProfileResource'][_0x99bb('0x47')]({'name':_0xdbb648[_0x99bb('0x29')],'resourceId':_0xdbb648['id'],'type':_0x4793da[_0x99bb('0x29')],'sectionId':_0x4793da['id']},{})[_0x99bb('0x26')](function(){return _0x1084eb;});}else{return _0x1084eb;}})[_0x99bb('0x41')](function(_0x5bb8b7){logger[_0x99bb('0x27')](_0x99bb('0x4d'),_0x5bb8b7);throw _0x5bb8b7;});}return _0x1084eb;})[_0x99bb('0x26')](respondWithResult(_0x3beca4,0xc9))['catch'](handleError(_0x3beca4,null));};exports[_0x99bb('0x22')]=function(_0x1f232f,_0x40256d){if(_0x1f232f['body']['id']){delete _0x1f232f[_0x99bb('0x48')]['id'];}return db[_0x99bb('0x2d')][_0x99bb('0x46')]({'where':{'id':_0x1f232f[_0x99bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x40256d,null))[_0x99bb('0x26')](saveUpdates(_0x1f232f[_0x99bb('0x48')],null))[_0x99bb('0x26')](respondWithResult(_0x40256d,null))[_0x99bb('0x41')](handleError(_0x40256d,null));};exports[_0x99bb('0x23')]=function(_0x546a9f,_0x534840){return db[_0x99bb('0x2d')]['find']({'where':{'id':_0x546a9f[_0x99bb('0x43')]['id']}})[_0x99bb('0x26')](handleEntityNotFound(_0x534840,null))[_0x99bb('0x26')](removeEntity(_0x534840,null))[_0x99bb('0x41')](handleError(_0x534840,null));};exports['download']=function(_0x475267,_0x268cb0,_0x36af0d){return db[_0x99bb('0x2d')]['find']({'where':{'id':_0x475267[_0x99bb('0x43')]['id']},'attributes':['name',_0x99bb('0x4e'),'savename',_0x99bb('0x4f')],'raw':!![]})[_0x99bb('0x26')](handleEntityNotFound(_0x268cb0,null))[_0x99bb('0x26')](function(_0x587bed){if(_0x587bed){if(!fs['existsSync'](path[_0x99bb('0x50')](config['root'],_0x99bb('0x51'),_0x587bed[_0x99bb('0x52')]))){throw new db['Sequelize'][(_0x99bb('0x53'))](_0x99bb('0x54'));}if(_0x475267[_0x99bb('0x32')][_0x99bb('0x55')]){return _0x268cb0[_0x99bb('0x18')](0xc8);}return _0x268cb0[_0x99bb('0x56')](path['join'](config[_0x99bb('0x57')],_0x99bb('0x51'),_0x587bed['savename']),util[_0x99bb('0x58')]('%s.%s',_0x587bed[_0x99bb('0x4e')]||_0x587bed[_0x99bb('0x29')],_0x587bed[_0x99bb('0x4f')][_0x99bb('0x59')]()));}})[_0x99bb('0x41')](handleError(_0x268cb0,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d352d51..cc071f1 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 _0x93af=['AnalyticExtractedReport','analytics_extracted_reports','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define'];(function(_0x52e5bf,_0x33a43){var _0x779e6=function(_0x3dec4a){while(--_0x3dec4a){_0x52e5bf['push'](_0x52e5bf['shift']());}};_0x779e6(++_0x33a43);}(_0x93af,0x1af));var _0xf93a=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0x93af[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf93a('0x0'));var moment=require(_0xf93a('0x1'));var BPromise=require(_0xf93a('0x2'));var rp=require(_0xf93a('0x3'));var fs=require('fs');var path=require(_0xf93a('0x4'));var rimraf=require(_0xf93a('0x5'));var config=require('../../config/environment');var attributes=require(_0xf93a('0x6'));module[_0xf93a('0x7')]=function(_0x4dbe60,_0x252457){return _0x4dbe60[_0xf93a('0x8')](_0xf93a('0x9'),attributes,{'tableName':_0xf93a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22e7=['bluebird','path','exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22e7,0x14a));var _0x722e=function(_0x12577b,_0x244594){_0x12577b=_0x12577b-0x0;var _0x5816b4=_0x22e7[_0x12577b];return _0x5816b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x722e('0x0'))(_0x722e('0x1'));var moment=require(_0x722e('0x2'));var BPromise=require(_0x722e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x722e('0x5')]=function(_0x36407b,_0x38ed06){return _0x36407b[_0x722e('0x6')](_0x722e('0x7'),attributes,{'tableName':_0x722e('0x8'),'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 b5febb6..fd4d06f 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 _0xce2c=['request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x56f873,_0x3f5e6e){var _0x2a7cda=function(_0xf7fc12){while(--_0xf7fc12){_0x56f873['push'](_0x56f873['shift']());}};_0x2a7cda(++_0x3f5e6e);}(_0xce2c,0x171));var _0xcce2=function(_0x385559,_0x7d5353){_0x385559=_0x385559-0x0;var _0x6e5312=_0xce2c[_0x385559];return _0x6e5312;};'use strict';var _=require(_0xcce2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcce2('0x1'))(_0xcce2('0x2'));var config=require('../../config/environment');var jayson=require(_0xcce2('0x3'));var client=jayson[_0xcce2('0x4')][_0xcce2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x10e83c,_0x14894c,_0x467693){return new BPromise(function(_0x5c0ec9,_0x227651){return client[_0xcce2('0x6')](_0x10e83c,_0x467693)[_0xcce2('0x7')](function(_0x153328){logger['info'](_0xcce2('0x8'),_0x14894c,_0xcce2('0x9'));logger[_0xcce2('0xa')](_0xcce2('0xb'),_0x14894c,_0xcce2('0x9'),JSON['stringify'](_0x153328));if(_0x153328[_0xcce2('0xc')]){if(_0x153328[_0xcce2('0xc')][_0xcce2('0xd')]===0x1f4){logger[_0xcce2('0xc')](_0xcce2('0x8'),_0x14894c,_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);return _0x227651(_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);}logger[_0xcce2('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14894c,_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);return _0x5c0ec9(_0x153328[_0xcce2('0xc')][_0xcce2('0xe')]);}else{logger[_0xcce2('0xf')](_0xcce2('0x8'),_0x14894c,_0xcce2('0x9'));_0x5c0ec9(_0x153328[_0xcce2('0x10')]['message']);}})[_0xcce2('0x11')](function(_0x9291cb){logger[_0xcce2('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x14894c,_0x9291cb);_0x227651(_0x9291cb);});});} \ No newline at end of file +var _0x734b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x27b215,_0x1a8b33){var _0x10f952=function(_0xe74b66){while(--_0xe74b66){_0x27b215['push'](_0x27b215['shift']());}};_0x10f952(++_0x1a8b33);}(_0x734b,0xe0));var _0xb734=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x734b[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xb734('0x0'));var util=require(_0xb734('0x1'));var moment=require(_0xb734('0x2'));var BPromise=require(_0xb734('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb734('0x4'));var db=require(_0xb734('0x5'))['db'];var utils=require(_0xb734('0x6'));var logger=require(_0xb734('0x7'))(_0xb734('0x8'));var config=require(_0xb734('0x9'));var jayson=require(_0xb734('0xa'));var client=jayson[_0xb734('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb14a9c,_0x43fa30,_0x195459){return new BPromise(function(_0x2426b8,_0x4d9c36){return client['request'](_0xb14a9c,_0x195459)[_0xb734('0xc')](function(_0x57cfd3){logger['info'](_0xb734('0xd'),_0x43fa30,'request\x20sent');logger[_0xb734('0xe')](_0xb734('0xf'),_0x43fa30,'request\x20sent',JSON[_0xb734('0x10')](_0x57cfd3));if(_0x57cfd3['error']){if(_0x57cfd3[_0xb734('0x11')]['code']===0x1f4){logger[_0xb734('0x11')](_0xb734('0xd'),_0x43fa30,_0x57cfd3[_0xb734('0x11')][_0xb734('0x12')]);return _0x4d9c36(_0x57cfd3[_0xb734('0x11')][_0xb734('0x12')]);}logger[_0xb734('0x11')](_0xb734('0xd'),_0x43fa30,_0x57cfd3['error']['message']);return _0x2426b8(_0x57cfd3[_0xb734('0x11')][_0xb734('0x12')]);}else{logger[_0xb734('0x13')](_0xb734('0xd'),_0x43fa30,_0xb734('0x14'));_0x2426b8(_0x57cfd3[_0xb734('0x15')][_0xb734('0x12')]);}})[_0xb734('0x16')](function(_0x51951f){logger['error'](_0xb734('0xd'),_0x43fa30,_0x51951f);_0x4d9c36(_0x51951f);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4039e9a..db844f2 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 _0x11a9=['download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x190c49,_0x17a01a){var _0x1831c3=function(_0x28af0e){while(--_0x28af0e){_0x190c49['push'](_0x190c49['shift']());}};_0x1831c3(++_0x17a01a);}(_0x11a9,0x11b));var _0x911a=function(_0xceec30,_0x43c4e5){_0xceec30=_0xceec30-0x0;var _0x259b0c=_0x11a9[_0xceec30];return _0x259b0c;};'use strict';var multer=require(_0x911a('0x0'));var util=require(_0x911a('0x1'));var path=require(_0x911a('0x2'));var timeout=require(_0x911a('0x3'));var express=require(_0x911a('0x4'));var router=express[_0x911a('0x5')]();var auth=require(_0x911a('0x6'));var interaction=require(_0x911a('0x7'));var config=require(_0x911a('0x8'));var controller=require(_0x911a('0x9'));router[_0x911a('0xa')]('/',auth[_0x911a('0xb')](),controller[_0x911a('0xc')]);router['get'](_0x911a('0xd'),auth['isAuthenticated'](),controller[_0x911a('0xe')]);router[_0x911a('0xa')](_0x911a('0xf'),auth[_0x911a('0xb')](),controller[_0x911a('0x10')]);router[_0x911a('0x11')]('/',auth[_0x911a('0xb')](),controller[_0x911a('0x12')]);router[_0x911a('0x13')](_0x911a('0xd'),auth['isAuthenticated'](),controller[_0x911a('0x14')]);router[_0x911a('0x15')](_0x911a('0xd'),auth[_0x911a('0xb')](),controller['destroy']);module[_0x911a('0x16')]=router; \ No newline at end of file +var _0x4d00=['get','isAuthenticated','/:id','show','/:id/download','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x26230c,_0x65ee0c){var _0x5431c8=function(_0x5b341d){while(--_0x5b341d){_0x26230c['push'](_0x26230c['shift']());}};_0x5431c8(++_0x65ee0c);}(_0x4d00,0x7c));var _0x04d0=function(_0x479d71,_0x5d3197){_0x479d71=_0x479d71-0x0;var _0x476f67=_0x4d00[_0x479d71];return _0x476f67;};'use strict';var multer=require(_0x04d0('0x0'));var util=require(_0x04d0('0x1'));var path=require('path');var timeout=require(_0x04d0('0x2'));var express=require(_0x04d0('0x3'));var router=express[_0x04d0('0x4')]();var auth=require(_0x04d0('0x5'));var interaction=require(_0x04d0('0x6'));var config=require(_0x04d0('0x7'));var controller=require(_0x04d0('0x8'));router[_0x04d0('0x9')]('/',auth[_0x04d0('0xa')](),controller['index']);router[_0x04d0('0x9')](_0x04d0('0xb'),auth[_0x04d0('0xa')](),controller[_0x04d0('0xc')]);router['get'](_0x04d0('0xd'),auth[_0x04d0('0xa')](),controller['download']);router['post']('/',auth[_0x04d0('0xa')](),controller[_0x04d0('0xe')]);router['put'](_0x04d0('0xb'),auth[_0x04d0('0xa')](),controller[_0x04d0('0xf')]);router[_0x04d0('0x10')]('/:id',auth[_0x04d0('0xa')](),controller[_0x04d0('0x11')]);module[_0x04d0('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 67b5e17..2533c3d 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x2113cd,_0xb2845b){var _0x554747=function(_0x2b3c6a){while(--_0x2b3c6a){_0x2113cd['push'](_0x2113cd['shift']());}};_0x554747(++_0xb2845b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4ca72c,_0x36fb0a){var _0xf99ffe=function(_0x393068){while(--_0x393068){_0x4ca72c['push'](_0x4ca72c['shift']());}};_0xf99ffe(++_0x36fb0a);}(_0x1261,0x144));var _0x1126=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x1261[_0xb98d8d];return _0x489b15;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 86fd457..7d10de0 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 _0x325e=['attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','bulkCreate','body','update','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','then','destroy','error','stack','name','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection'];(function(_0x48f703,_0x14e365){var _0x6d6e46=function(_0x10e372){while(--_0x10e372){_0x48f703['push'](_0x48f703['shift']());}};_0x6d6e46(++_0x14e365);}(_0x325e,0xc1));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe325('0x0'));var emlformat=require(_0xe325('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe325('0x2'));var jsonpatch=require(_0xe325('0x3'));var rp=require('request-promise');var moment=require(_0xe325('0x4'));var BPromise=require(_0xe325('0x5'));var Mustache=require(_0xe325('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe325('0x7'));var ejs=require(_0xe325('0x8'));var fs=require('fs');var _=require(_0xe325('0x9'));var squel=require(_0xe325('0xa'));var crypto=require(_0xe325('0xb'));var jsforce=require(_0xe325('0xc'));var deskjs=require(_0xe325('0xd'));var toCsv=require(_0xe325('0x7'));var querystring=require('querystring');var Papa=require(_0xe325('0xe'));var Redis=require(_0xe325('0xf'));var authService=require(_0xe325('0x10'));var qs=require(_0xe325('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe325('0x12'));var logger=require(_0xe325('0x13'))(_0xe325('0x14'));var utils=require(_0xe325('0x15'));var config=require(_0xe325('0x16'));var db=require(_0xe325('0x17'))['db'];function respondWithStatusCode(_0x1ec4bf,_0x433d11){_0x433d11=_0x433d11||0xcc;return function(_0x3d151a){if(_0x3d151a){return _0x1ec4bf[_0xe325('0x18')](_0x433d11);}return _0x1ec4bf[_0xe325('0x19')](_0x433d11)[_0xe325('0x1a')]();};}function respondWithResult(_0x210a5c,_0x26df6d){_0x26df6d=_0x26df6d||0xc8;return function(_0x2beec7){if(_0x2beec7){return _0x210a5c[_0xe325('0x19')](_0x26df6d)['json'](_0x2beec7);}};}function respondWithFilteredResult(_0x14eae7,_0x544c57){return function(_0x435861){if(_0x435861){var _0xb99c4a=_0x435861['count'],_0x565005=_0x544c57['offset'],_0x41dd20=_0x544c57[_0xe325('0x1b')]+_0x544c57['limit'],_0x157cbb;if(_0x41dd20>=_0xb99c4a){_0x41dd20=_0xb99c4a;_0x157cbb=0xc8;}else{_0x157cbb=0xce;}_0x14eae7[_0xe325('0x19')](_0x157cbb);return _0x14eae7[_0xe325('0x1c')]('Content-Range',_0x565005+'-'+_0x41dd20+'/'+_0xb99c4a)[_0xe325('0x1d')](_0x435861);}return null;};}function patchUpdates(_0x59ca9b){return function(_0x12b89f){try{jsonpatch[_0xe325('0x1e')](_0x12b89f,_0x59ca9b,!![]);}catch(_0x99becb){return BPromise[_0xe325('0x1f')](_0x99becb);}return _0x12b89f[_0xe325('0x20')]();};}function saveUpdates(_0x1da2d6,_0x5d43ed){return function(_0x5ed827){if(_0x5ed827){return _0x5ed827['update'](_0x1da2d6)[_0xe325('0x21')](function(_0x18dffc){return _0x18dffc;});}return null;};}function removeEntity(_0x2cf396,_0x301204){return function(_0x38e3b4){if(_0x38e3b4){return _0x38e3b4[_0xe325('0x22')]()[_0xe325('0x21')](function(){_0x2cf396[_0xe325('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491aed,_0x298405){return function(_0x2641c8){if(!_0x2641c8){_0x491aed[_0xe325('0x18')](0x194);}return _0x2641c8;};}function handleError(_0x391450,_0x3c68f9){_0x3c68f9=_0x3c68f9||0x1f4;return function(_0x4d4264){logger[_0xe325('0x23')](_0x4d4264[_0xe325('0x24')]);if(_0x4d4264[_0xe325('0x25')]){delete _0x4d4264[_0xe325('0x25')];}_0x391450[_0xe325('0x19')](_0x3c68f9)['send'](_0x4d4264);};}exports['index']=function(_0x3d0696,_0x249ce6){var _0x1b7b26={},_0x5aec1d={},_0x2cd305={'count':0x0,'rows':[]};var _0x49ae13=_[_0xe325('0x26')](db[_0xe325('0x27')]['rawAttributes'],function(_0x5db379){return{'name':_0x5db379[_0xe325('0x28')],'type':_0x5db379[_0xe325('0x29')][_0xe325('0x2a')]};});_0x5aec1d[_0xe325('0x2b')]=_[_0xe325('0x26')](_0x49ae13,_0xe325('0x25'));_0x5aec1d[_0xe325('0x2c')]=_[_0xe325('0x2d')](_0x3d0696[_0xe325('0x2c')]);_0x5aec1d['filters']=_[_0xe325('0x2e')](_0x5aec1d[_0xe325('0x2b')],_0x5aec1d[_0xe325('0x2c')]);_0x1b7b26[_0xe325('0x2f')]=_['intersection'](_0x5aec1d[_0xe325('0x2b')],qs['fields'](_0x3d0696[_0xe325('0x2c')]['fields']));_0x1b7b26['attributes']=_0x1b7b26[_0xe325('0x2f')][_0xe325('0x30')]?_0x1b7b26[_0xe325('0x2f')]:_0x5aec1d[_0xe325('0x2b')];if(!_0x3d0696[_0xe325('0x2c')][_0xe325('0x31')]('nolimit')){_0x1b7b26[_0xe325('0x32')]=qs['limit'](_0x3d0696[_0xe325('0x2c')][_0xe325('0x32')]);_0x1b7b26[_0xe325('0x1b')]=qs[_0xe325('0x1b')](_0x3d0696['query'][_0xe325('0x1b')]);}_0x1b7b26[_0xe325('0x33')]=qs[_0xe325('0x34')](_0x3d0696[_0xe325('0x2c')][_0xe325('0x34')]);_0x1b7b26[_0xe325('0x35')]=qs['filters'](_[_0xe325('0x36')](_0x3d0696[_0xe325('0x2c')],_0x5aec1d[_0xe325('0x37')]),_0x49ae13);if(_0x3d0696[_0xe325('0x2c')]['filter']){_0x1b7b26[_0xe325('0x35')]=_[_0xe325('0x38')](_0x1b7b26['where'],{'$or':_[_0xe325('0x26')](_0x49ae13,function(_0x1532af){if(_0x1532af[_0xe325('0x29')]!==_0xe325('0x39')){var _0x47a376={};_0x47a376[_0x1532af['name']]={'$like':'%'+_0x3d0696[_0xe325('0x2c')]['filter']+'%'};return _0x47a376;}})});}_0x1b7b26=_[_0xe325('0x38')]({},_0x1b7b26,_0x3d0696[_0xe325('0x3a')]);var _0x133cc9={'where':_0x1b7b26[_0xe325('0x35')]};return db[_0xe325('0x27')][_0xe325('0x3b')](_0x133cc9)[_0xe325('0x21')](function(_0x378ee5){_0x2cd305[_0xe325('0x3b')]=_0x378ee5;if(_0x3d0696['query']['includeAll']){_0x1b7b26[_0xe325('0x3c')]=[{'all':!![]}];}return db[_0xe325('0x27')][_0xe325('0x3d')](_0x1b7b26);})['then'](function(_0x566f67){_0x2cd305[_0xe325('0x3e')]=_0x566f67;return _0x2cd305;})[_0xe325('0x21')](respondWithFilteredResult(_0x249ce6,_0x1b7b26))[_0xe325('0x3f')](handleError(_0x249ce6,null));};exports[_0xe325('0x40')]=function(_0xc62ec0,_0x59f947){var _0xae14d8={'raw':![],'where':{'id':_0xc62ec0[_0xe325('0x41')]['id']}},_0x48b078={};_0x48b078['model']=_[_0xe325('0x2d')](db[_0xe325('0x27')][_0xe325('0x42')]);_0x48b078[_0xe325('0x2c')]=_[_0xe325('0x2d')](_0xc62ec0[_0xe325('0x2c')]);_0x48b078[_0xe325('0x37')]=_[_0xe325('0x2e')](_0x48b078[_0xe325('0x2b')],_0x48b078[_0xe325('0x2c')]);_0xae14d8[_0xe325('0x2f')]=_[_0xe325('0x2e')](_0x48b078[_0xe325('0x2b')],qs[_0xe325('0x43')](_0xc62ec0['query'][_0xe325('0x43')]));_0xae14d8['attributes']=_0xae14d8[_0xe325('0x2f')][_0xe325('0x30')]?_0xae14d8[_0xe325('0x2f')]:_0x48b078['model'];if(_0xc62ec0[_0xe325('0x2c')][_0xe325('0x44')]){_0xae14d8[_0xe325('0x3c')]=[{'all':!![]}];}_0xae14d8=_[_0xe325('0x38')]({},_0xae14d8,_0xc62ec0[_0xe325('0x3a')]);return db[_0xe325('0x27')][_0xe325('0x45')](_0xae14d8)[_0xe325('0x21')](handleEntityNotFound(_0x59f947,null))[_0xe325('0x21')](respondWithResult(_0x59f947,null))[_0xe325('0x3f')](handleError(_0x59f947,null));};exports[_0xe325('0x46')]=function(_0x365e59,_0x265a6c){return db[_0xe325('0x27')]['create'](_0x365e59['body'],{})[_0xe325('0x21')](respondWithResult(_0x265a6c,0xc9))[_0xe325('0x3f')](handleError(_0x265a6c,null));};exports[_0xe325('0x47')]=function(_0xeb2235,_0x3c6ead){return db[_0xe325('0x27')][_0xe325('0x47')](_0xeb2235[_0xe325('0x48')],{'raw':![],'individualHooks':!![]})[_0xe325('0x21')](respondWithResult(_0x3c6ead,0xc9))[_0xe325('0x3f')](handleError(_0x3c6ead,null));};exports[_0xe325('0x49')]=function(_0x464ca5,_0x37299b){if(_0x464ca5[_0xe325('0x48')]['id']){delete _0x464ca5[_0xe325('0x48')]['id'];}return db[_0xe325('0x27')][_0xe325('0x45')]({'where':{'id':_0x464ca5['params']['id']}})['then'](handleEntityNotFound(_0x37299b,null))[_0xe325('0x21')](saveUpdates(_0x464ca5[_0xe325('0x48')],null))[_0xe325('0x21')](respondWithResult(_0x37299b,null))[_0xe325('0x3f')](handleError(_0x37299b,null));};exports[_0xe325('0x22')]=function(_0x5eeb9c,_0x27d10e){return db[_0xe325('0x27')]['find']({'where':{'id':_0x5eeb9c[_0xe325('0x41')]['id']}})[_0xe325('0x21')](handleEntityNotFound(_0x27d10e,null))[_0xe325('0x21')](removeEntity(_0x27d10e,null))[_0xe325('0x3f')](handleError(_0x27d10e,null));};exports['bulkDestroy']=function(_0x31c9af,_0x41f249){return db[_0xe325('0x27')]['destroy']({'where':{'id':_0x31c9af[_0xe325('0x2c')][_0xe325('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xe325('0x21')](respondWithResult(_0x41f249,0xcc))['catch'](handleError(_0x41f249,null));};exports[_0xe325('0x4b')]=function(_0x2d1403,_0x12ac80,_0x2a611b){return db[_0xe325('0x4c')]['findOne']({'where':{'id':_0x2d1403[_0xe325('0x41')]['id']}})[_0xe325('0x21')](handleEntityNotFound(_0x12ac80,null))[_0xe325('0x21')](function(_0x4ffebb){if(_0x4ffebb){return db[_0xe325('0x4d')][_0xe325('0x4e')](function(_0x508c74){return db[_0xe325('0x27')]['destroy']({'where':{'CustomReportId':_0x2d1403[_0xe325('0x41')]['id']},'transaction':_0x508c74})[_0xe325('0x21')](function(_0x352a39){var _0x1db9db=_[_0xe325('0x26')](_0x2d1403['body'],function(_0x284228){delete _0x284228['id'];_0x284228[_0xe325('0x4f')]=_0x2d1403[_0xe325('0x41')]['id'];return _0x284228;});return db[_0xe325('0x27')]['bulkCreate'](_0x1db9db,{'transaction':_0x508c74});});})[_0xe325('0x21')](function(){return db[_0xe325('0x27')][_0xe325('0x3d')]({'where':{'CustomReportId':_0x2d1403[_0xe325('0x41')]['id']}});});}})['then'](respondWithResult(_0x12ac80,null))['catch'](handleError(_0x12ac80,null));}; \ No newline at end of file +var _0xa459=['intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','merge','create','body','destroy','find','bulkDestroy','ids','AnalyticCustomReport','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','update','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa459,0x1d8));var _0x9a45=function(_0x58ba47,_0x5e4443){_0x58ba47=_0x58ba47-0x0;var _0x401a97=_0xa459[_0x58ba47];return _0x401a97;};'use strict';var pdf=require(_0x9a45('0x0'));var emlformat=require(_0x9a45('0x1'));var rimraf=require(_0x9a45('0x2'));var zipdir=require(_0x9a45('0x3'));var jsonpatch=require(_0x9a45('0x4'));var rp=require(_0x9a45('0x5'));var moment=require(_0x9a45('0x6'));var BPromise=require(_0x9a45('0x7'));var Mustache=require(_0x9a45('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a45('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a45('0xa'));var squel=require(_0x9a45('0xb'));var crypto=require(_0x9a45('0xc'));var jsforce=require(_0x9a45('0xd'));var deskjs=require(_0x9a45('0xe'));var toCsv=require(_0x9a45('0x9'));var querystring=require('querystring');var Papa=require(_0x9a45('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a45('0x10'));var hardwareService=require(_0x9a45('0x11'));var logger=require(_0x9a45('0x12'))('api');var utils=require(_0x9a45('0x13'));var config=require(_0x9a45('0x14'));var db=require(_0x9a45('0x15'))['db'];function respondWithStatusCode(_0x30bdf2,_0x3d0a8f){_0x3d0a8f=_0x3d0a8f||0xcc;return function(_0x463d99){if(_0x463d99){return _0x30bdf2[_0x9a45('0x16')](_0x3d0a8f);}return _0x30bdf2[_0x9a45('0x17')](_0x3d0a8f)[_0x9a45('0x18')]();};}function respondWithResult(_0x557e7b,_0x99c111){_0x99c111=_0x99c111||0xc8;return function(_0x435f90){if(_0x435f90){return _0x557e7b[_0x9a45('0x17')](_0x99c111)['json'](_0x435f90);}};}function respondWithFilteredResult(_0x403e2d,_0x59f693){return function(_0x38e771){if(_0x38e771){var _0x546495=_0x38e771[_0x9a45('0x19')],_0x18b793=_0x59f693[_0x9a45('0x1a')],_0x43fdfb=_0x59f693[_0x9a45('0x1a')]+_0x59f693['limit'],_0x1adce2;if(_0x43fdfb>=_0x546495){_0x43fdfb=_0x546495;_0x1adce2=0xc8;}else{_0x1adce2=0xce;}_0x403e2d[_0x9a45('0x17')](_0x1adce2);return _0x403e2d[_0x9a45('0x1b')](_0x9a45('0x1c'),_0x18b793+'-'+_0x43fdfb+'/'+_0x546495)[_0x9a45('0x1d')](_0x38e771);}return null;};}function patchUpdates(_0x31ca24){return function(_0x4d58af){try{jsonpatch[_0x9a45('0x1e')](_0x4d58af,_0x31ca24,!![]);}catch(_0x139842){return BPromise['reject'](_0x139842);}return _0x4d58af['save']();};}function saveUpdates(_0x5913b9,_0x1c662f){return function(_0x56428a){if(_0x56428a){return _0x56428a[_0x9a45('0x1f')](_0x5913b9)[_0x9a45('0x20')](function(_0x4c6f4c){return _0x4c6f4c;});}return null;};}function removeEntity(_0x44fe60,_0x48b3c3){return function(_0x4ccb7e){if(_0x4ccb7e){return _0x4ccb7e['destroy']()['then'](function(){_0x44fe60[_0x9a45('0x17')](0xcc)[_0x9a45('0x18')]();});}};}function handleEntityNotFound(_0x1b7a69,_0x285563){return function(_0x20dd61){if(!_0x20dd61){_0x1b7a69[_0x9a45('0x16')](0x194);}return _0x20dd61;};}function handleError(_0x14193b,_0x1f664f){_0x1f664f=_0x1f664f||0x1f4;return function(_0x1d1d26){logger[_0x9a45('0x21')](_0x1d1d26[_0x9a45('0x22')]);if(_0x1d1d26[_0x9a45('0x23')]){delete _0x1d1d26['name'];}_0x14193b[_0x9a45('0x17')](_0x1f664f)[_0x9a45('0x24')](_0x1d1d26);};}exports['index']=function(_0x106bfb,_0x454998){var _0x583d4c={},_0x7e9378={},_0x587b09={'count':0x0,'rows':[]};var _0x2a9aaa=_[_0x9a45('0x25')](db[_0x9a45('0x26')][_0x9a45('0x27')],function(_0x8cbaf){return{'name':_0x8cbaf[_0x9a45('0x28')],'type':_0x8cbaf[_0x9a45('0x29')]['key']};});_0x7e9378[_0x9a45('0x2a')]=_['map'](_0x2a9aaa,_0x9a45('0x23'));_0x7e9378[_0x9a45('0x2b')]=_[_0x9a45('0x2c')](_0x106bfb[_0x9a45('0x2b')]);_0x7e9378[_0x9a45('0x2d')]=_[_0x9a45('0x2e')](_0x7e9378['model'],_0x7e9378[_0x9a45('0x2b')]);_0x583d4c['attributes']=_[_0x9a45('0x2e')](_0x7e9378['model'],qs[_0x9a45('0x2f')](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x2f')]));_0x583d4c['attributes']=_0x583d4c[_0x9a45('0x30')]['length']?_0x583d4c[_0x9a45('0x30')]:_0x7e9378[_0x9a45('0x2a')];if(!_0x106bfb['query']['hasOwnProperty'](_0x9a45('0x31'))){_0x583d4c[_0x9a45('0x32')]=qs[_0x9a45('0x32')](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x32')]);_0x583d4c[_0x9a45('0x1a')]=qs['offset'](_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x1a')]);}_0x583d4c[_0x9a45('0x33')]=qs[_0x9a45('0x34')](_0x106bfb['query'][_0x9a45('0x34')]);_0x583d4c[_0x9a45('0x35')]=qs[_0x9a45('0x2d')](_[_0x9a45('0x36')](_0x106bfb[_0x9a45('0x2b')],_0x7e9378[_0x9a45('0x2d')]),_0x2a9aaa);if(_0x106bfb['query'][_0x9a45('0x37')]){_0x583d4c['where']=_['merge'](_0x583d4c[_0x9a45('0x35')],{'$or':_[_0x9a45('0x25')](_0x2a9aaa,function(_0x4a31a4){if(_0x4a31a4[_0x9a45('0x29')]!==_0x9a45('0x38')){var _0x5914fd={};_0x5914fd[_0x4a31a4[_0x9a45('0x23')]]={'$like':'%'+_0x106bfb[_0x9a45('0x2b')][_0x9a45('0x37')]+'%'};return _0x5914fd;}})});}_0x583d4c=_['merge']({},_0x583d4c,_0x106bfb[_0x9a45('0x39')]);var _0x3e994b={'where':_0x583d4c[_0x9a45('0x35')]};return db['AnalyticFieldReport'][_0x9a45('0x19')](_0x3e994b)[_0x9a45('0x20')](function(_0x203dd7){_0x587b09[_0x9a45('0x19')]=_0x203dd7;if(_0x106bfb['query'][_0x9a45('0x3a')]){_0x583d4c['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9a45('0x3b')](_0x583d4c);})[_0x9a45('0x20')](function(_0x5e4a4e){_0x587b09[_0x9a45('0x3c')]=_0x5e4a4e;return _0x587b09;})[_0x9a45('0x20')](respondWithFilteredResult(_0x454998,_0x583d4c))[_0x9a45('0x3d')](handleError(_0x454998,null));};exports[_0x9a45('0x3e')]=function(_0x42ae3f,_0x57e9f4){var _0x3b13a9={'raw':![],'where':{'id':_0x42ae3f[_0x9a45('0x3f')]['id']}},_0x18e873={};_0x18e873[_0x9a45('0x2a')]=_[_0x9a45('0x2c')](db['AnalyticFieldReport'][_0x9a45('0x27')]);_0x18e873[_0x9a45('0x2b')]=_[_0x9a45('0x2c')](_0x42ae3f['query']);_0x18e873[_0x9a45('0x2d')]=_[_0x9a45('0x2e')](_0x18e873[_0x9a45('0x2a')],_0x18e873['query']);_0x3b13a9[_0x9a45('0x30')]=_[_0x9a45('0x2e')](_0x18e873[_0x9a45('0x2a')],qs[_0x9a45('0x2f')](_0x42ae3f[_0x9a45('0x2b')][_0x9a45('0x2f')]));_0x3b13a9[_0x9a45('0x30')]=_0x3b13a9['attributes']['length']?_0x3b13a9['attributes']:_0x18e873['model'];if(_0x42ae3f[_0x9a45('0x2b')][_0x9a45('0x3a')]){_0x3b13a9['include']=[{'all':!![]}];}_0x3b13a9=_[_0x9a45('0x40')]({},_0x3b13a9,_0x42ae3f[_0x9a45('0x39')]);return db[_0x9a45('0x26')]['find'](_0x3b13a9)['then'](handleEntityNotFound(_0x57e9f4,null))[_0x9a45('0x20')](respondWithResult(_0x57e9f4,null))[_0x9a45('0x3d')](handleError(_0x57e9f4,null));};exports[_0x9a45('0x41')]=function(_0x15b3d3,_0x5d812a){return db[_0x9a45('0x26')][_0x9a45('0x41')](_0x15b3d3[_0x9a45('0x42')],{})[_0x9a45('0x20')](respondWithResult(_0x5d812a,0xc9))['catch'](handleError(_0x5d812a,null));};exports['bulkCreate']=function(_0x22d850,_0x263eee){return db[_0x9a45('0x26')]['bulkCreate'](_0x22d850['body'],{'raw':![],'individualHooks':!![]})[_0x9a45('0x20')](respondWithResult(_0x263eee,0xc9))[_0x9a45('0x3d')](handleError(_0x263eee,null));};exports[_0x9a45('0x1f')]=function(_0x2a7af6,_0x2e3665){if(_0x2a7af6['body']['id']){delete _0x2a7af6['body']['id'];}return db[_0x9a45('0x26')]['find']({'where':{'id':_0x2a7af6[_0x9a45('0x3f')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x2e3665,null))[_0x9a45('0x20')](saveUpdates(_0x2a7af6[_0x9a45('0x42')],null))[_0x9a45('0x20')](respondWithResult(_0x2e3665,null))[_0x9a45('0x3d')](handleError(_0x2e3665,null));};exports[_0x9a45('0x43')]=function(_0x4f76f8,_0x4fee1d){return db['AnalyticFieldReport'][_0x9a45('0x44')]({'where':{'id':_0x4f76f8[_0x9a45('0x3f')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x4fee1d,null))[_0x9a45('0x20')](removeEntity(_0x4fee1d,null))['catch'](handleError(_0x4fee1d,null));};exports[_0x9a45('0x45')]=function(_0x758278,_0x557244){return db[_0x9a45('0x26')]['destroy']({'where':{'id':_0x758278[_0x9a45('0x2b')][_0x9a45('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x9a45('0x20')](respondWithResult(_0x557244,0xcc))[_0x9a45('0x3d')](handleError(_0x557244,null));};exports['addFields']=function(_0x53370f,_0x118ade,_0x317c10){return db[_0x9a45('0x47')]['findOne']({'where':{'id':_0x53370f[_0x9a45('0x3f')]['id']}})[_0x9a45('0x20')](handleEntityNotFound(_0x118ade,null))[_0x9a45('0x20')](function(_0x2f96c8){if(_0x2f96c8){return db[_0x9a45('0x48')][_0x9a45('0x49')](function(_0x30e985){return db[_0x9a45('0x26')][_0x9a45('0x43')]({'where':{'CustomReportId':_0x53370f['params']['id']},'transaction':_0x30e985})['then'](function(_0x3128c9){var _0x5bbb7b=_[_0x9a45('0x25')](_0x53370f[_0x9a45('0x42')],function(_0x195ace){delete _0x195ace['id'];_0x195ace['CustomReportId']=_0x53370f[_0x9a45('0x3f')]['id'];return _0x195ace;});return db[_0x9a45('0x26')]['bulkCreate'](_0x5bbb7b,{'transaction':_0x30e985});});})['then'](function(){return db[_0x9a45('0x26')][_0x9a45('0x3b')]({'where':{'CustomReportId':_0x53370f[_0x9a45('0x3f')]['id']}});});}})[_0x9a45('0x20')](respondWithResult(_0x118ade,null))[_0x9a45('0x3d')](handleError(_0x118ade,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 5e409e5..91d9a76 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 _0xcde7=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30208b,_0x3ba154){var _0x3e42e5=function(_0x520c9b){while(--_0x520c9b){_0x30208b['push'](_0x30208b['shift']());}};_0x3e42e5(++_0x3ba154);}(_0xcde7,0x1a9));var _0x7cde=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcde7[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7cde('0x0'));var util=require(_0x7cde('0x1'));var logger=require(_0x7cde('0x2'))(_0x7cde('0x3'));var moment=require(_0x7cde('0x4'));var BPromise=require(_0x7cde('0x5'));var rp=require(_0x7cde('0x6'));var fs=require('fs');var path=require(_0x7cde('0x7'));var rimraf=require(_0x7cde('0x8'));var config=require(_0x7cde('0x9'));var attributes=require(_0x7cde('0xa'));module[_0x7cde('0xb')]=function(_0x1075c2,_0x1cfd7e){return _0x1075c2[_0x7cde('0xc')](_0x7cde('0xd'),attributes,{'tableName':_0x7cde('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb52f=['./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x58c3ff,_0x124777){var _0x4e5a30=function(_0x4052ef){while(--_0x4052ef){_0x58c3ff['push'](_0x58c3ff['shift']());}};_0x4e5a30(++_0x124777);}(_0xb52f,0x101));var _0xfb52=function(_0x4fc9cc,_0x1d635d){_0x4fc9cc=_0x4fc9cc-0x0;var _0x1e6471=_0xb52f[_0x4fc9cc];return _0x1e6471;};'use strict';var _=require(_0xfb52('0x0'));var util=require(_0xfb52('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfb52('0x2'));var BPromise=require(_0xfb52('0x3'));var rp=require(_0xfb52('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb52('0x5'));var config=require(_0xfb52('0x6'));var attributes=require(_0xfb52('0x7'));module[_0xfb52('0x8')]=function(_0x1af394,_0xdc8f89){return _0x1af394[_0xfb52('0x9')](_0xfb52('0xa'),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 ed1e114..b4fcd9d 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 _0x014e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x500f38,_0x420d7d){var _0x29a07b=function(_0x5e3c11){while(--_0x5e3c11){_0x500f38['push'](_0x500f38['shift']());}};_0x29a07b(++_0x420d7d);}(_0x014e,0x1f2));var _0xe014=function(_0x28898,_0x438a8c){_0x28898=_0x28898-0x0;var _0x39e12b=_0x014e[_0x28898];return _0x39e12b;};'use strict';var _=require(_0xe014('0x0'));var util=require(_0xe014('0x1'));var moment=require(_0xe014('0x2'));var BPromise=require(_0xe014('0x3'));var rs=require(_0xe014('0x4'));var fs=require('fs');var Redis=require(_0xe014('0x5'));var db=require(_0xe014('0x6'))['db'];var utils=require(_0xe014('0x7'));var logger=require(_0xe014('0x8'))(_0xe014('0x9'));var config=require(_0xe014('0xa'));var jayson=require(_0xe014('0xb'));var client=jayson[_0xe014('0xc')][_0xe014('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x177515,_0x10a416,_0x58ea3d){return new BPromise(function(_0x223daa,_0x34798a){return client[_0xe014('0xe')](_0x177515,_0x58ea3d)['then'](function(_0x7d72f3){logger[_0xe014('0xf')](_0xe014('0x10'),_0x10a416,_0xe014('0x11'));logger[_0xe014('0x12')](_0xe014('0x13'),_0x10a416,_0xe014('0x11'),JSON[_0xe014('0x14')](_0x7d72f3));if(_0x7d72f3[_0xe014('0x15')]){if(_0x7d72f3['error'][_0xe014('0x16')]===0x1f4){logger[_0xe014('0x15')](_0xe014('0x10'),_0x10a416,_0x7d72f3[_0xe014('0x15')][_0xe014('0x17')]);return _0x34798a(_0x7d72f3['error'][_0xe014('0x17')]);}logger['error'](_0xe014('0x10'),_0x10a416,_0x7d72f3[_0xe014('0x15')][_0xe014('0x17')]);return _0x223daa(_0x7d72f3['error'][_0xe014('0x17')]);}else{logger[_0xe014('0xf')](_0xe014('0x10'),_0x10a416,_0xe014('0x11'));_0x223daa(_0x7d72f3[_0xe014('0x18')][_0xe014('0x17')]);}})['catch'](function(_0x4768c7){logger[_0xe014('0x15')](_0xe014('0x10'),_0x10a416,_0x4768c7);_0x34798a(_0x4768c7);});});} \ No newline at end of file +var _0x6c45=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x12c684,_0x7ab045){var _0x1f5c1c=function(_0x44df12){while(--_0x44df12){_0x12c684['push'](_0x12c684['shift']());}};_0x1f5c1c(++_0x7ab045);}(_0x6c45,0x15e));var _0x56c4=function(_0x345736,_0x5e8e48){_0x345736=_0x345736-0x0;var _0x56d995=_0x6c45[_0x345736];return _0x56d995;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var moment=require(_0x56c4('0x2'));var BPromise=require(_0x56c4('0x3'));var rs=require(_0x56c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56c4('0x5'))['db'];var utils=require(_0x56c4('0x6'));var logger=require(_0x56c4('0x7'))(_0x56c4('0x8'));var config=require(_0x56c4('0x9'));var jayson=require(_0x56c4('0xa'));var client=jayson[_0x56c4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a28d8,_0x5961fd,_0x1d6f5){return new BPromise(function(_0x593fdf,_0x1eace2){return client[_0x56c4('0xc')](_0x2a28d8,_0x1d6f5)['then'](function(_0x4cfe9a){logger[_0x56c4('0xd')](_0x56c4('0xe'),_0x5961fd,_0x56c4('0xf'));logger[_0x56c4('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5961fd,_0x56c4('0xf'),JSON[_0x56c4('0x11')](_0x4cfe9a));if(_0x4cfe9a[_0x56c4('0x12')]){if(_0x4cfe9a['error'][_0x56c4('0x13')]===0x1f4){logger[_0x56c4('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5961fd,_0x4cfe9a[_0x56c4('0x12')][_0x56c4('0x14')]);return _0x1eace2(_0x4cfe9a[_0x56c4('0x12')][_0x56c4('0x14')]);}logger[_0x56c4('0x12')](_0x56c4('0xe'),_0x5961fd,_0x4cfe9a[_0x56c4('0x12')][_0x56c4('0x14')]);return _0x593fdf(_0x4cfe9a['error'][_0x56c4('0x14')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x5961fd,_0x56c4('0xf'));_0x593fdf(_0x4cfe9a[_0x56c4('0x15')][_0x56c4('0x14')]);}})[_0x56c4('0x16')](function(_0x1b08c8){logger[_0x56c4('0x12')](_0x56c4('0xe'),_0x5961fd,_0x1b08c8);_0x1eace2(_0x1b08c8);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0e995cd..b187085 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(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0x7217,0x19e));var _0x7721=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x7217[_0x376b45];return _0x2341b3;};'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 _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5c996a,_0xccd6bc){var _0x97a899=function(_0x3880d4){while(--_0x3880d4){_0x5c996a['push'](_0x5c996a['shift']());}};_0x97a899(++_0xccd6bc);}(_0x814b,0x1a2));var _0xb814=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x814b[_0x13b330];return _0x1f666c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9747400..c800e9a 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 _0xf865=['name','TEXT','sequelize','exports','STRING'];(function(_0x564022,_0x15206f){var _0x1adb7e=function(_0x3315ba){while(--_0x3315ba){_0x564022['push'](_0x564022['shift']());}};_0x1adb7e(++_0x15206f);}(_0xf865,0x11a));var _0x5f86=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xf865[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require(_0x5f86('0x0'));module[_0x5f86('0x1')]={'name':{'type':Sequelize[_0x5f86('0x2')],'allowNull':![],'unique':_0x5f86('0x3')},'table':{'type':Sequelize[_0x5f86('0x2')]},'metric':{'type':Sequelize[_0x5f86('0x4')]},'description':{'type':Sequelize[_0x5f86('0x2')]}}; \ No newline at end of file +var _0xe348=['TEXT','sequelize','exports','name','STRING'];(function(_0x39aee3,_0x53b3ee){var _0x12bcc3=function(_0x911af1){while(--_0x911af1){_0x39aee3['push'](_0x39aee3['shift']());}};_0x12bcc3(++_0x53b3ee);}(_0xe348,0x137));var _0x8e34=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xe348[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require(_0x8e34('0x0'));module[_0x8e34('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e34('0x2')},'table':{'type':Sequelize[_0x8e34('0x3')]},'metric':{'type':Sequelize[_0x8e34('0x4')]},'description':{'type':Sequelize[_0x8e34('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 56687ca..6e6166d 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 _0x80ed=['end','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','options','AnalyticMetric','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','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','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','get','Metrics','UserProfileResource'];(function(_0x23fce2,_0x29b0aa){var _0x7af835=function(_0x3c0b04){while(--_0x3c0b04){_0x23fce2['push'](_0x23fce2['shift']());}};_0x7af835(++_0x29b0aa);}(_0x80ed,0x11c));var _0xd80e=function(_0x36a7d8,_0x3cba6b){_0x36a7d8=_0x36a7d8-0x0;var _0x58aeb8=_0x80ed[_0x36a7d8];return _0x58aeb8;};'use strict';var pdf=require(_0xd80e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd80e('0x1'));var zipdir=require(_0xd80e('0x2'));var jsonpatch=require(_0xd80e('0x3'));var rp=require('request-promise');var moment=require(_0xd80e('0x4'));var BPromise=require(_0xd80e('0x5'));var Mustache=require(_0xd80e('0x6'));var util=require(_0xd80e('0x7'));var path=require('path');var sox=require(_0xd80e('0x8'));var csv=require(_0xd80e('0x9'));var ejs=require(_0xd80e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x9'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var db=require(_0xd80e('0x19'))['db'];function respondWithStatusCode(_0x1a9024,_0x118f53){_0x118f53=_0x118f53||0xcc;return function(_0x1d3fcf){if(_0x1d3fcf){return _0x1a9024['sendStatus'](_0x118f53);}return _0x1a9024['status'](_0x118f53)['end']();};}function respondWithResult(_0x57fefb,_0x145766){_0x145766=_0x145766||0xc8;return function(_0x3d233b){if(_0x3d233b){return _0x57fefb[_0xd80e('0x1a')](_0x145766)[_0xd80e('0x1b')](_0x3d233b);}};}function respondWithFilteredResult(_0x449c60,_0x58a17e){return function(_0x595683){if(_0x595683){var _0x2c8c61=_0x595683[_0xd80e('0x1c')],_0x3124e8=_0x58a17e[_0xd80e('0x1d')],_0x3b48ae=_0x58a17e[_0xd80e('0x1d')]+_0x58a17e['limit'],_0x40a4d5;if(_0x3b48ae>=_0x2c8c61){_0x3b48ae=_0x2c8c61;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x449c60[_0xd80e('0x1a')](_0x40a4d5);return _0x449c60[_0xd80e('0x1e')](_0xd80e('0x1f'),_0x3124e8+'-'+_0x3b48ae+'/'+_0x2c8c61)[_0xd80e('0x1b')](_0x595683);}return null;};}function patchUpdates(_0x593af6){return function(_0x39397a){try{jsonpatch[_0xd80e('0x20')](_0x39397a,_0x593af6,!![]);}catch(_0xecfe74){return BPromise['reject'](_0xecfe74);}return _0x39397a[_0xd80e('0x21')]();};}function saveUpdates(_0x2ef8a1,_0x2765ea){return function(_0x147134){if(_0x147134){return _0x147134[_0xd80e('0x22')](_0x2ef8a1)['then'](function(_0x4b6b8a){return _0x4b6b8a;});}return null;};}function removeEntity(_0x35a1bc,_0x3fa159){return function(_0x3b39bf){if(_0x3b39bf){return _0x3b39bf[_0xd80e('0x23')]()[_0xd80e('0x24')](function(){var _0x326d66=_0x3b39bf[_0xd80e('0x25')]({'plain':!![]});var _0x5430b6=_0xd80e('0x26');return db[_0xd80e('0x27')][_0xd80e('0x23')]({'where':{'type':_0x5430b6,'resourceId':_0x326d66['id']}})['then'](function(){return _0x3b39bf;});})[_0xd80e('0x24')](function(){_0x35a1bc[_0xd80e('0x1a')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1a')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x3b')](_0x1ad3bc['query'][_0xd80e('0x3b')]);_0x39088b[_0xd80e('0x1d')]=qs[_0xd80e('0x1d')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3c')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3d')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3d')]=_[_0xd80e('0x3e')](_0x39088b[_0xd80e('0x3d')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3f')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x40')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x41')]['count'](_0x3ff4b4)[_0xd80e('0x24')](function(_0x5ade19){_0x361946[_0xd80e('0x1c')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x41')][_0xd80e('0x42')](_0x39088b);})[_0xd80e('0x24')](function(_0x3e65a7){_0x361946[_0xd80e('0x43')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x24')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x44')](handleError(_0x845451,null));};exports[_0xd80e('0x45')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':!![],'where':{'id':_0x91c6ed[_0xd80e('0x46')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x41')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x47')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3e')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x40')]);return db[_0xd80e('0x41')]['find'](_0x1bbb36)[_0xd80e('0x24')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x24')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x44')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x41')][_0xd80e('0x48')](_0x8d5cb8[_0xd80e('0x49')],{})[_0xd80e('0x24')](function(_0x56ba81){var _0x5aad1b=_0x8d5cb8[_0xd80e('0x4a')][_0xd80e('0x25')]({'plain':!![]});if(!_0x5aad1b)throw new Error(_0xd80e('0x4b'));if(_0x5aad1b['role']==='user'){var _0x1762a8=_0x56ba81[_0xd80e('0x25')]({'plain':!![]});var _0x183f78=_0xd80e('0x26');return db[_0xd80e('0x4c')]['find']({'where':{'name':_0x183f78,'userProfileId':_0x5aad1b[_0xd80e('0x4d')]},'raw':!![]})['then'](function(_0x46c781){if(_0x46c781&&_0x46c781[_0xd80e('0x4e')]===0x0){return db['UserProfileResource'][_0xd80e('0x48')]({'name':_0x1762a8[_0xd80e('0x2b')],'resourceId':_0x1762a8['id'],'type':_0x46c781[_0xd80e('0x2b')],'sectionId':_0x46c781['id']},{})[_0xd80e('0x24')](function(){return _0x56ba81;});}else{return _0x56ba81;}})[_0xd80e('0x44')](function(_0x470319){logger[_0xd80e('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x470319);throw _0x470319;});}return _0x56ba81;})[_0xd80e('0x24')](respondWithResult(_0x29aaa0,0xc9))[_0xd80e('0x44')](handleError(_0x29aaa0,null));};exports[_0xd80e('0x22')]=function(_0x4a66ca,_0x52ab04){if(_0x4a66ca[_0xd80e('0x49')]['id']){delete _0x4a66ca[_0xd80e('0x49')]['id'];}return db[_0xd80e('0x41')][_0xd80e('0x50')]({'where':{'id':_0x4a66ca[_0xd80e('0x46')]['id']}})[_0xd80e('0x24')](handleEntityNotFound(_0x52ab04,null))[_0xd80e('0x24')](saveUpdates(_0x4a66ca[_0xd80e('0x49')],null))['then'](respondWithResult(_0x52ab04,null))[_0xd80e('0x44')](handleError(_0x52ab04,null));};exports['destroy']=function(_0x3b5f47,_0x3c184c){return db[_0xd80e('0x41')][_0xd80e('0x50')]({'where':{'id':_0x3b5f47[_0xd80e('0x46')]['id']}})[_0xd80e('0x24')](handleEntityNotFound(_0x3c184c,null))['then'](removeEntity(_0x3c184c,null))[_0xd80e('0x44')](handleError(_0x3c184c,null));}; \ No newline at end of file +var _0x68a5=['pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x216446,_0x28d139){var _0x4b200b=function(_0x4a2185){while(--_0x4a2185){_0x216446['push'](_0x216446['shift']());}};_0x4b200b(++_0x28d139);}(_0x68a5,0xfc));var _0x568a=function(_0x1d9fd8,_0x2ed208){_0x1d9fd8=_0x1d9fd8-0x0;var _0xfb3e60=_0x68a5[_0x1d9fd8];return _0xfb3e60;};'use strict';var pdf=require(_0x568a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x568a('0x1'));var zipdir=require(_0x568a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x568a('0x3'));var moment=require(_0x568a('0x4'));var BPromise=require(_0x568a('0x5'));var Mustache=require(_0x568a('0x6'));var util=require('util');var path=require(_0x568a('0x7'));var sox=require('sox');var csv=require(_0x568a('0x8'));var ejs=require(_0x568a('0x9'));var fs=require('fs');var _=require(_0x568a('0xa'));var squel=require(_0x568a('0xb'));var crypto=require('crypto');var jsforce=require(_0x568a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x568a('0x8'));var querystring=require(_0x568a('0xd'));var Papa=require(_0x568a('0xe'));var Redis=require(_0x568a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x568a('0x10'));var hardwareService=require(_0x568a('0x11'));var logger=require('../../config/logger')(_0x568a('0x12'));var utils=require('../../config/utils');var config=require(_0x568a('0x13'));var db=require(_0x568a('0x14'))['db'];function respondWithStatusCode(_0xea9341,_0x22bc5b){_0x22bc5b=_0x22bc5b||0xcc;return function(_0x365871){if(_0x365871){return _0xea9341[_0x568a('0x15')](_0x22bc5b);}return _0xea9341[_0x568a('0x16')](_0x22bc5b)[_0x568a('0x17')]();};}function respondWithResult(_0x441119,_0x37903b){_0x37903b=_0x37903b||0xc8;return function(_0x3dd9af){if(_0x3dd9af){return _0x441119[_0x568a('0x16')](_0x37903b)[_0x568a('0x18')](_0x3dd9af);}};}function respondWithFilteredResult(_0x2c7b3c,_0x110ac2){return function(_0x1f9cc4){if(_0x1f9cc4){var _0x375bac=_0x1f9cc4[_0x568a('0x19')],_0x4e6f9a=_0x110ac2[_0x568a('0x1a')],_0x323bf3=_0x110ac2['offset']+_0x110ac2[_0x568a('0x1b')],_0x573b17;if(_0x323bf3>=_0x375bac){_0x323bf3=_0x375bac;_0x573b17=0xc8;}else{_0x573b17=0xce;}_0x2c7b3c['status'](_0x573b17);return _0x2c7b3c[_0x568a('0x1c')](_0x568a('0x1d'),_0x4e6f9a+'-'+_0x323bf3+'/'+_0x375bac)[_0x568a('0x18')](_0x1f9cc4);}return null;};}function patchUpdates(_0x16a7c5){return function(_0x5f0b12){try{jsonpatch[_0x568a('0x1e')](_0x5f0b12,_0x16a7c5,!![]);}catch(_0x4fd8e8){return BPromise[_0x568a('0x1f')](_0x4fd8e8);}return _0x5f0b12[_0x568a('0x20')]();};}function saveUpdates(_0x15fb1b,_0x3b9968){return function(_0x252bb8){if(_0x252bb8){return _0x252bb8[_0x568a('0x21')](_0x15fb1b)[_0x568a('0x22')](function(_0x29c358){return _0x29c358;});}return null;};}function removeEntity(_0x4d1172,_0x3171d8){return function(_0x1f12b5){if(_0x1f12b5){return _0x1f12b5['destroy']()[_0x568a('0x22')](function(){var _0x35d891=_0x1f12b5[_0x568a('0x23')]({'plain':!![]});var _0x4f5c30=_0x568a('0x24');return db[_0x568a('0x25')][_0x568a('0x26')]({'where':{'type':_0x4f5c30,'resourceId':_0x35d891['id']}})[_0x568a('0x22')](function(){return _0x1f12b5;});})[_0x568a('0x22')](function(){_0x4d1172[_0x568a('0x16')](0xcc)[_0x568a('0x17')]();});}};}function handleEntityNotFound(_0x38e03a,_0x2df7d6){return function(_0x5721a5){if(!_0x5721a5){_0x38e03a[_0x568a('0x15')](0x194);}return _0x5721a5;};}function handleError(_0x63decd,_0x3e7b42){_0x3e7b42=_0x3e7b42||0x1f4;return function(_0x22b097){logger[_0x568a('0x27')](_0x22b097[_0x568a('0x28')]);if(_0x22b097['name']){delete _0x22b097[_0x568a('0x29')];}_0x63decd[_0x568a('0x16')](_0x3e7b42)[_0x568a('0x2a')](_0x22b097);};}exports[_0x568a('0x2b')]=function(_0x20498b,_0x5911f4){var _0x460b31={},_0x17a99d={},_0x3d0b1f={'count':0x0,'rows':[]};var _0x1b477f=_[_0x568a('0x2c')](db[_0x568a('0x2d')][_0x568a('0x2e')],function(_0x396ee9){return{'name':_0x396ee9[_0x568a('0x2f')],'type':_0x396ee9[_0x568a('0x30')]['key']};});_0x17a99d[_0x568a('0x31')]=_[_0x568a('0x2c')](_0x1b477f,_0x568a('0x29'));_0x17a99d[_0x568a('0x32')]=_[_0x568a('0x33')](_0x20498b[_0x568a('0x32')]);_0x17a99d['filters']=_['intersection'](_0x17a99d['model'],_0x17a99d[_0x568a('0x32')]);_0x460b31[_0x568a('0x34')]=_[_0x568a('0x35')](_0x17a99d[_0x568a('0x31')],qs[_0x568a('0x36')](_0x20498b['query']['fields']));_0x460b31[_0x568a('0x34')]=_0x460b31[_0x568a('0x34')][_0x568a('0x37')]?_0x460b31[_0x568a('0x34')]:_0x17a99d[_0x568a('0x31')];if(!_0x20498b['query'][_0x568a('0x38')]('nolimit')){_0x460b31[_0x568a('0x1b')]=qs[_0x568a('0x1b')](_0x20498b['query'][_0x568a('0x1b')]);_0x460b31['offset']=qs[_0x568a('0x1a')](_0x20498b[_0x568a('0x32')][_0x568a('0x1a')]);}_0x460b31['order']=qs['sort'](_0x20498b[_0x568a('0x32')][_0x568a('0x39')]);_0x460b31[_0x568a('0x3a')]=qs[_0x568a('0x3b')](_[_0x568a('0x3c')](_0x20498b[_0x568a('0x32')],_0x17a99d[_0x568a('0x3b')]),_0x1b477f);if(_0x20498b['query']['filter']){_0x460b31[_0x568a('0x3a')]=_[_0x568a('0x3d')](_0x460b31[_0x568a('0x3a')],{'$or':_['map'](_0x1b477f,function(_0x52146a){if(_0x52146a[_0x568a('0x30')]!==_0x568a('0x3e')){var _0x5cf6e9={};_0x5cf6e9[_0x52146a[_0x568a('0x29')]]={'$like':'%'+_0x20498b[_0x568a('0x32')]['filter']+'%'};return _0x5cf6e9;}})});}_0x460b31=_[_0x568a('0x3d')]({},_0x460b31,_0x20498b[_0x568a('0x3f')]);var _0x22140c={'where':_0x460b31[_0x568a('0x3a')]};return db[_0x568a('0x2d')][_0x568a('0x19')](_0x22140c)['then'](function(_0x4da8da){_0x3d0b1f[_0x568a('0x19')]=_0x4da8da;if(_0x20498b[_0x568a('0x32')][_0x568a('0x40')]){_0x460b31[_0x568a('0x41')]=[{'all':!![]}];}return db[_0x568a('0x2d')][_0x568a('0x42')](_0x460b31);})[_0x568a('0x22')](function(_0x64143a){_0x3d0b1f['rows']=_0x64143a;return _0x3d0b1f;})[_0x568a('0x22')](respondWithFilteredResult(_0x5911f4,_0x460b31))[_0x568a('0x43')](handleError(_0x5911f4,null));};exports[_0x568a('0x44')]=function(_0x8e4926,_0x47767f){var _0x5adee0={'raw':!![],'where':{'id':_0x8e4926['params']['id']}},_0x31cdc0={};_0x31cdc0[_0x568a('0x31')]=_[_0x568a('0x33')](db[_0x568a('0x2d')][_0x568a('0x2e')]);_0x31cdc0[_0x568a('0x32')]=_[_0x568a('0x33')](_0x8e4926[_0x568a('0x32')]);_0x31cdc0['filters']=_[_0x568a('0x35')](_0x31cdc0[_0x568a('0x31')],_0x31cdc0[_0x568a('0x32')]);_0x5adee0['attributes']=_[_0x568a('0x35')](_0x31cdc0['model'],qs['fields'](_0x8e4926[_0x568a('0x32')]['fields']));_0x5adee0[_0x568a('0x34')]=_0x5adee0[_0x568a('0x34')]['length']?_0x5adee0[_0x568a('0x34')]:_0x31cdc0[_0x568a('0x31')];if(_0x8e4926[_0x568a('0x32')][_0x568a('0x40')]){_0x5adee0[_0x568a('0x41')]=[{'all':!![]}];}_0x5adee0=_['merge']({},_0x5adee0,_0x8e4926[_0x568a('0x3f')]);return db[_0x568a('0x2d')]['find'](_0x5adee0)[_0x568a('0x22')](handleEntityNotFound(_0x47767f,null))[_0x568a('0x22')](respondWithResult(_0x47767f,null))[_0x568a('0x43')](handleError(_0x47767f,null));};exports[_0x568a('0x45')]=function(_0x8d9aa5,_0x3e224b){return db[_0x568a('0x2d')]['create'](_0x8d9aa5[_0x568a('0x46')],{})[_0x568a('0x22')](function(_0x4ef7fe){var _0x387c29=_0x8d9aa5[_0x568a('0x47')]['get']({'plain':!![]});if(!_0x387c29)throw new Error(_0x568a('0x48'));if(_0x387c29['role']===_0x568a('0x47')){var _0x3b21ac=_0x4ef7fe[_0x568a('0x23')]({'plain':!![]});var _0x2fc1ac=_0x568a('0x24');return db['UserProfileSection'][_0x568a('0x49')]({'where':{'name':_0x2fc1ac,'userProfileId':_0x387c29[_0x568a('0x4a')]},'raw':!![]})['then'](function(_0x28c494){if(_0x28c494&&_0x28c494[_0x568a('0x4b')]===0x0){return db[_0x568a('0x25')][_0x568a('0x45')]({'name':_0x3b21ac['name'],'resourceId':_0x3b21ac['id'],'type':_0x28c494[_0x568a('0x29')],'sectionId':_0x28c494['id']},{})[_0x568a('0x22')](function(){return _0x4ef7fe;});}else{return _0x4ef7fe;}})[_0x568a('0x43')](function(_0x263d9d){logger[_0x568a('0x27')](_0x568a('0x4c'),_0x263d9d);throw _0x263d9d;});}return _0x4ef7fe;})[_0x568a('0x22')](respondWithResult(_0x3e224b,0xc9))[_0x568a('0x43')](handleError(_0x3e224b,null));};exports['update']=function(_0x33a8c1,_0x1a153b){if(_0x33a8c1[_0x568a('0x46')]['id']){delete _0x33a8c1[_0x568a('0x46')]['id'];}return db[_0x568a('0x2d')]['find']({'where':{'id':_0x33a8c1[_0x568a('0x4d')]['id']}})[_0x568a('0x22')](handleEntityNotFound(_0x1a153b,null))[_0x568a('0x22')](saveUpdates(_0x33a8c1[_0x568a('0x46')],null))[_0x568a('0x22')](respondWithResult(_0x1a153b,null))[_0x568a('0x43')](handleError(_0x1a153b,null));};exports['destroy']=function(_0x7bf1b0,_0xaf95c){return db[_0x568a('0x2d')][_0x568a('0x49')]({'where':{'id':_0x7bf1b0[_0x568a('0x4d')]['id']}})[_0x568a('0x22')](handleEntityNotFound(_0xaf95c,null))[_0x568a('0x22')](removeEntity(_0xaf95c,null))[_0x568a('0x43')](handleError(_0xaf95c,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8f47e7d..89b6125 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 _0x1ba4=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports'];(function(_0xf6086c,_0x23b3cb){var _0x3118a3=function(_0x3fad4a){while(--_0x3fad4a){_0xf6086c['push'](_0xf6086c['shift']());}};_0x3118a3(++_0x23b3cb);}(_0x1ba4,0x7b));var _0x41ba=function(_0x2f73a7,_0x1be12b){_0x2f73a7=_0x2f73a7-0x0;var _0x4e8690=_0x1ba4[_0x2f73a7];return _0x4e8690;};'use strict';var _=require(_0x41ba('0x0'));var util=require(_0x41ba('0x1'));var logger=require(_0x41ba('0x2'))(_0x41ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x41ba('0x4'));var config=require(_0x41ba('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x41ba('0x6')]=function(_0x3f8b5b,_0x2701a3){return _0x3f8b5b[_0x41ba('0x7')](_0x41ba('0x8'),attributes,{'tableName':_0x41ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750d=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','moment','bluebird'];(function(_0xf3b76c,_0x17f16e){var _0x1f3e57=function(_0x5584e1){while(--_0x5584e1){_0xf3b76c['push'](_0xf3b76c['shift']());}};_0x1f3e57(++_0x17f16e);}(_0x750d,0x1c3));var _0xd750=function(_0x17dc0d,_0x45a499){_0x17dc0d=_0x17dc0d-0x0;var _0x32e5b7=_0x750d[_0x17dc0d];return _0x32e5b7;};'use strict';var _=require(_0xd750('0x0'));var util=require(_0xd750('0x1'));var logger=require(_0xd750('0x2'))('api');var moment=require(_0xd750('0x3'));var BPromise=require(_0xd750('0x4'));var rp=require(_0xd750('0x5'));var fs=require('fs');var path=require(_0xd750('0x6'));var rimraf=require('rimraf');var config=require(_0xd750('0x7'));var attributes=require(_0xd750('0x8'));module[_0xd750('0x9')]=function(_0x3fdc3b,_0x18d24a){return _0x3fdc3b[_0xd750('0xa')](_0xd750('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 1b41de4..8982ddf 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 _0x533b=['../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4580d4,_0xb4514f){var _0x48ce72=function(_0x35194e){while(--_0x35194e){_0x4580d4['push'](_0x4580d4['shift']());}};_0x48ce72(++_0xb4514f);}(_0x533b,0x183));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb533('0x0'));var util=require(_0xb533('0x1'));var moment=require(_0xb533('0x2'));var BPromise=require('bluebird');var rs=require(_0xb533('0x3'));var fs=require('fs');var Redis=require(_0xb533('0x4'));var db=require(_0xb533('0x5'))['db'];var utils=require(_0xb533('0x6'));var logger=require(_0xb533('0x7'))(_0xb533('0x8'));var config=require(_0xb533('0x9'));var jayson=require(_0xb533('0xa'));var client=jayson[_0xb533('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8cc6,_0x55f4f3,_0x158db0){return new BPromise(function(_0x59dc61,_0x153dff){return client['request'](_0x2d8cc6,_0x158db0)[_0xb533('0xc')](function(_0x446481){logger[_0xb533('0xd')](_0xb533('0xe'),_0x55f4f3,_0xb533('0xf'));logger[_0xb533('0x10')](_0xb533('0x11'),_0x55f4f3,_0xb533('0xf'),JSON[_0xb533('0x12')](_0x446481));if(_0x446481[_0xb533('0x13')]){if(_0x446481[_0xb533('0x13')][_0xb533('0x14')]===0x1f4){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x446481[_0xb533('0x13')]['message']);return _0x153dff(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}logger[_0xb533('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0x446481[_0xb533('0x13')][_0xb533('0x15')]);return _0x59dc61(_0x446481[_0xb533('0x13')][_0xb533('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x55f4f3,_0xb533('0xf'));_0x59dc61(_0x446481['result'][_0xb533('0x15')]);}})['catch'](function(_0x22f46f){logger[_0xb533('0x13')](_0xb533('0xe'),_0x55f4f3,_0x22f46f);_0x153dff(_0x22f46f);});});} \ No newline at end of file +var _0x3287=['http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x3287,0xdb));var _0x7328=function(_0x9f2d3,_0x226f0f){_0x9f2d3=_0x9f2d3-0x0;var _0x176342=_0x3287[_0x9f2d3];return _0x176342;};'use strict';var _=require(_0x7328('0x0'));var util=require(_0x7328('0x1'));var moment=require('moment');var BPromise=require(_0x7328('0x2'));var rs=require(_0x7328('0x3'));var fs=require('fs');var Redis=require(_0x7328('0x4'));var db=require(_0x7328('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7328('0x6'))(_0x7328('0x7'));var config=require(_0x7328('0x8'));var jayson=require(_0x7328('0x9'));var client=jayson[_0x7328('0xa')][_0x7328('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40957d,_0x2fc3ae,_0x280641){return new BPromise(function(_0x2a03fe,_0x359629){return client['request'](_0x40957d,_0x280641)[_0x7328('0xc')](function(_0x36ba86){logger[_0x7328('0xd')](_0x7328('0xe'),_0x2fc3ae,_0x7328('0xf'));logger[_0x7328('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2fc3ae,_0x7328('0xf'),JSON[_0x7328('0x11')](_0x36ba86));if(_0x36ba86[_0x7328('0x12')]){if(_0x36ba86['error'][_0x7328('0x13')]===0x1f4){logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x36ba86['error'][_0x7328('0x14')]);return _0x359629(_0x36ba86[_0x7328('0x12')][_0x7328('0x14')]);}logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x36ba86['error']['message']);return _0x2a03fe(_0x36ba86[_0x7328('0x12')][_0x7328('0x14')]);}else{logger[_0x7328('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x2fc3ae,'request\x20sent');_0x2a03fe(_0x36ba86[_0x7328('0x15')][_0x7328('0x14')]);}})[_0x7328('0x16')](function(_0x57f2ac){logger[_0x7328('0x12')](_0x7328('0xe'),_0x2fc3ae,_0x57f2ac);_0x359629(_0x57f2ac);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d88d14a..4a4eee6 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','post','create','put','update','exports','multer'];(function(_0x3565c1,_0x30cc7a){var _0x3f2183=function(_0x57b3b){while(--_0x57b3b){_0x3565c1['push'](_0x3565c1['shift']());}};_0x3f2183(++_0x30cc7a);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/',auth['isAuthenticated'](),controller[_0xee2f('0xb')]);router[_0xee2f('0xc')]('/:id',auth[_0xee2f('0x7')](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0xda19=['post','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4f7742,_0x15ce9a){var _0x270a53=function(_0x55f52f){while(--_0x55f52f){_0x4f7742['push'](_0x4f7742['shift']());}};_0x270a53(++_0x15ce9a);}(_0xda19,0xd5));var _0x9da1=function(_0x31e185,_0x40dc4e){_0x31e185=_0x31e185-0x0;var _0x2718c9=_0xda19[_0x31e185];return _0x2718c9;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9da1('0x9'),auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);module[_0x9da1('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f6f62ca..cec1108 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 _0xe2ef=['sequelize','exports','TEXT'];(function(_0x26a655,_0x4b48c2){var _0x6db920=function(_0x23b3d9){while(--_0x23b3d9){_0x26a655['push'](_0x26a655['shift']());}};_0x6db920(++_0x4b48c2);}(_0xe2ef,0xf6));var _0xfe2e=function(_0x4ba677,_0x2dff1e){_0x4ba677=_0x4ba677-0x0;var _0x4ed8d2=_0xe2ef[_0x4ba677];return _0x4ed8d2;};'use strict';var Sequelize=require(_0xfe2e('0x0'));module[_0xfe2e('0x1')]={'tree':{'type':Sequelize[_0xfe2e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9023=['exports','sequelize'];(function(_0x102b48,_0x1ffa36){var _0x1819c4=function(_0xc1c6dc){while(--_0xc1c6dc){_0x102b48['push'](_0x102b48['shift']());}};_0x1819c4(++_0x1ffa36);}(_0x9023,0xf9));var _0x3902=function(_0xc996ac,_0x1137bd){_0xc996ac=_0xc996ac-0x0;var _0x150b63=_0x9023[_0xc996ac];return _0x150b63;};'use strict';var Sequelize=require(_0x3902('0x0'));module[_0x3902('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 45d134d..5c08864 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 _0xaf01=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x45d110,_0x352195){var _0x27a1f5=function(_0x5ee28f){while(--_0x5ee28f){_0x45d110['push'](_0x45d110['shift']());}};_0x27a1f5(++_0x352195);}(_0xaf01,0x1af));var _0x1af0=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xaf01[_0x29d94e];return _0x106237;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1af0('0x0'));var rimraf=require(_0x1af0('0x1'));var zipdir=require(_0x1af0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1af0('0x3'));var moment=require(_0x1af0('0x4'));var BPromise=require(_0x1af0('0x5'));var Mustache=require(_0x1af0('0x6'));var util=require(_0x1af0('0x7'));var path=require(_0x1af0('0x8'));var sox=require('sox');var csv=require(_0x1af0('0x9'));var ejs=require(_0x1af0('0xa'));var fs=require('fs');var _=require(_0x1af0('0xb'));var squel=require(_0x1af0('0xc'));var crypto=require('crypto');var jsforce=require(_0x1af0('0xd'));var deskjs=require(_0x1af0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1af0('0xf'));var Papa=require(_0x1af0('0x10'));var Redis=require(_0x1af0('0x11'));var authService=require(_0x1af0('0x12'));var qs=require(_0x1af0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1af0('0x14'))(_0x1af0('0x15'));var utils=require(_0x1af0('0x16'));var config=require('../../config/environment');var db=require(_0x1af0('0x17'))['db'];function respondWithStatusCode(_0x3ecc95,_0x5eca6f){_0x5eca6f=_0x5eca6f||0xcc;return function(_0x1e9b98){if(_0x1e9b98){return _0x3ecc95[_0x1af0('0x18')](_0x5eca6f);}return _0x3ecc95[_0x1af0('0x19')](_0x5eca6f)[_0x1af0('0x1a')]();};}function respondWithResult(_0x1c3e2e,_0x1f13b6){_0x1f13b6=_0x1f13b6||0xc8;return function(_0x593cd8){if(_0x593cd8){return _0x1c3e2e['status'](_0x1f13b6)[_0x1af0('0x1b')](_0x593cd8);}};}function respondWithFilteredResult(_0x321e8e,_0x320d19){return function(_0xe03ea7){if(_0xe03ea7){var _0x43161c=_0xe03ea7['count'],_0x39a604=_0x320d19[_0x1af0('0x1c')],_0x423b6c=_0x320d19['offset']+_0x320d19['limit'],_0x53be78;if(_0x423b6c>=_0x43161c){_0x423b6c=_0x43161c;_0x53be78=0xc8;}else{_0x53be78=0xce;}_0x321e8e['status'](_0x53be78);return _0x321e8e['set'](_0x1af0('0x1d'),_0x39a604+'-'+_0x423b6c+'/'+_0x43161c)[_0x1af0('0x1b')](_0xe03ea7);}return null;};}function patchUpdates(_0x14b8a1){return function(_0xdbda47){try{jsonpatch[_0x1af0('0x1e')](_0xdbda47,_0x14b8a1,!![]);}catch(_0x24eceb){return BPromise[_0x1af0('0x1f')](_0x24eceb);}return _0xdbda47[_0x1af0('0x20')]();};}function saveUpdates(_0x159e3c,_0x16c0c2){return function(_0x1c693f){if(_0x1c693f){return _0x1c693f[_0x1af0('0x21')](_0x159e3c)['then'](function(_0x213311){return _0x213311;});}return null;};}function removeEntity(_0x1a5829,_0x22c02b){return function(_0x4e76f4){if(_0x4e76f4){return _0x4e76f4[_0x1af0('0x22')]()[_0x1af0('0x23')](function(){_0x1a5829['status'](0xcc)[_0x1af0('0x1a')]();});}};}function handleEntityNotFound(_0x259db8,_0x4f19ef){return function(_0x186467){if(!_0x186467){_0x259db8['sendStatus'](0x194);}return _0x186467;};}function handleError(_0x5e1bb0,_0x614939){_0x614939=_0x614939||0x1f4;return function(_0x41769e){logger[_0x1af0('0x24')](_0x41769e[_0x1af0('0x25')]);if(_0x41769e[_0x1af0('0x26')]){delete _0x41769e[_0x1af0('0x26')];}_0x5e1bb0[_0x1af0('0x19')](_0x614939)[_0x1af0('0x27')](_0x41769e);};}exports['index']=function(_0x34db5d,_0x591d28){var _0x54937a={},_0x5cf5ae={},_0x507c49={'count':0x0,'rows':[]};var _0x5444f0=_[_0x1af0('0x28')](db[_0x1af0('0x29')][_0x1af0('0x2a')],function(_0x245247){return{'name':_0x245247[_0x1af0('0x2b')],'type':_0x245247['type'][_0x1af0('0x2c')]};});_0x5cf5ae['model']=_[_0x1af0('0x28')](_0x5444f0,'name');_0x5cf5ae[_0x1af0('0x2d')]=_['keys'](_0x34db5d[_0x1af0('0x2d')]);_0x5cf5ae[_0x1af0('0x2e')]=_[_0x1af0('0x2f')](_0x5cf5ae[_0x1af0('0x30')],_0x5cf5ae[_0x1af0('0x2d')]);_0x54937a[_0x1af0('0x31')]=_['intersection'](_0x5cf5ae[_0x1af0('0x30')],qs[_0x1af0('0x32')](_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x32')]));_0x54937a['attributes']=_0x54937a['attributes'][_0x1af0('0x33')]?_0x54937a['attributes']:_0x5cf5ae[_0x1af0('0x30')];if(!_0x34db5d['query'][_0x1af0('0x34')](_0x1af0('0x35'))){_0x54937a[_0x1af0('0x36')]=qs[_0x1af0('0x36')](_0x34db5d[_0x1af0('0x2d')]['limit']);_0x54937a[_0x1af0('0x1c')]=qs[_0x1af0('0x1c')](_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x1c')]);}_0x54937a[_0x1af0('0x37')]=qs[_0x1af0('0x38')](_0x34db5d[_0x1af0('0x2d')]['sort']);_0x54937a['where']=qs[_0x1af0('0x2e')](_[_0x1af0('0x39')](_0x34db5d[_0x1af0('0x2d')],_0x5cf5ae[_0x1af0('0x2e')]),_0x5444f0);if(_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x3a')]){_0x54937a[_0x1af0('0x3b')]=_[_0x1af0('0x3c')](_0x54937a['where'],{'$or':_['map'](_0x5444f0,function(_0x167d01){if(_0x167d01[_0x1af0('0x3d')]!==_0x1af0('0x3e')){var _0x35651c={};_0x35651c[_0x167d01['name']]={'$like':'%'+_0x34db5d[_0x1af0('0x2d')][_0x1af0('0x3a')]+'%'};return _0x35651c;}})});}_0x54937a=_[_0x1af0('0x3c')]({},_0x54937a,_0x34db5d[_0x1af0('0x3f')]);var _0x722b9d={'where':_0x54937a[_0x1af0('0x3b')]};return db['AnalyticTreeReport']['count'](_0x722b9d)['then'](function(_0x273ce5){_0x507c49['count']=_0x273ce5;if(_0x34db5d[_0x1af0('0x2d')]['includeAll']){_0x54937a[_0x1af0('0x40')]=[{'all':!![]}];}return db[_0x1af0('0x29')][_0x1af0('0x41')](_0x54937a);})[_0x1af0('0x23')](function(_0x18ab9d){_0x507c49[_0x1af0('0x42')]=_0x18ab9d;return _0x507c49;})[_0x1af0('0x23')](respondWithFilteredResult(_0x591d28,_0x54937a))['catch'](handleError(_0x591d28,null));};exports[_0x1af0('0x43')]=function(_0x528b6e,_0x2f326f){var _0x280e2c={'raw':!![],'where':{'id':_0x528b6e[_0x1af0('0x44')]['id']}},_0x242cf1={};_0x242cf1[_0x1af0('0x30')]=_[_0x1af0('0x45')](db[_0x1af0('0x29')][_0x1af0('0x2a')]);_0x242cf1[_0x1af0('0x2d')]=_[_0x1af0('0x45')](_0x528b6e[_0x1af0('0x2d')]);_0x242cf1[_0x1af0('0x2e')]=_[_0x1af0('0x2f')](_0x242cf1['model'],_0x242cf1[_0x1af0('0x2d')]);_0x280e2c[_0x1af0('0x31')]=_[_0x1af0('0x2f')](_0x242cf1[_0x1af0('0x30')],qs[_0x1af0('0x32')](_0x528b6e[_0x1af0('0x2d')][_0x1af0('0x32')]));_0x280e2c['attributes']=_0x280e2c['attributes'][_0x1af0('0x33')]?_0x280e2c[_0x1af0('0x31')]:_0x242cf1[_0x1af0('0x30')];if(_0x528b6e[_0x1af0('0x2d')][_0x1af0('0x46')]){_0x280e2c[_0x1af0('0x40')]=[{'all':!![]}];}_0x280e2c=_[_0x1af0('0x3c')]({},_0x280e2c,_0x528b6e[_0x1af0('0x3f')]);return db['AnalyticTreeReport'][_0x1af0('0x47')](_0x280e2c)[_0x1af0('0x23')](handleEntityNotFound(_0x2f326f,null))['then'](respondWithResult(_0x2f326f,null))[_0x1af0('0x48')](handleError(_0x2f326f,null));};exports[_0x1af0('0x49')]=function(_0x383d3,_0x537229){return db[_0x1af0('0x29')][_0x1af0('0x49')](_0x383d3['body'],{})[_0x1af0('0x23')](respondWithResult(_0x537229,0xc9))['catch'](handleError(_0x537229,null));};exports[_0x1af0('0x21')]=function(_0xf08f45,_0x2c5d77){if(_0xf08f45[_0x1af0('0x4a')]['id']){delete _0xf08f45[_0x1af0('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x1af0('0x47')]({'where':{'id':_0xf08f45['params']['id']}})[_0x1af0('0x23')](handleEntityNotFound(_0x2c5d77,null))[_0x1af0('0x23')](saveUpdates(_0xf08f45['body'],null))['then'](respondWithResult(_0x2c5d77,null))[_0x1af0('0x48')](handleError(_0x2c5d77,null));};exports['destroy']=function(_0x34daf3,_0x157bed){return db[_0x1af0('0x29')][_0x1af0('0x47')]({'where':{'id':_0x34daf3['params']['id']}})[_0x1af0('0x23')](handleEntityNotFound(_0x157bed,null))[_0x1af0('0x23')](removeEntity(_0x157bed,null))['catch'](handleError(_0x157bed,null));}; \ No newline at end of file +var _0x5348=['findAll','rows','catch','show','params','keys','find','create','body','update','html-pdf','eml-format','zip-dir','moment','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','type','filter','options','includeAll','include'];(function(_0x128443,_0x2fe025){var _0x1a4ce1=function(_0x12d72c){while(--_0x12d72c){_0x128443['push'](_0x128443['shift']());}};_0x1a4ce1(++_0x2fe025);}(_0x5348,0x94));var _0x8534=function(_0x327ec3,_0x1730a0){_0x327ec3=_0x327ec3-0x0;var _0x335fe3=_0x5348[_0x327ec3];return _0x335fe3;};'use strict';var pdf=require(_0x8534('0x0'));var emlformat=require(_0x8534('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8534('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8534('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8534('0x4'));var path=require(_0x8534('0x5'));var sox=require(_0x8534('0x6'));var csv=require(_0x8534('0x7'));var ejs=require(_0x8534('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8534('0x9'));var crypto=require('crypto');var jsforce=require(_0x8534('0xa'));var deskjs=require(_0x8534('0xb'));var toCsv=require(_0x8534('0x7'));var querystring=require(_0x8534('0xc'));var Papa=require(_0x8534('0xd'));var Redis=require('ioredis');var authService=require(_0x8534('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8534('0xf'));var hardwareService=require(_0x8534('0x10'));var logger=require(_0x8534('0x11'))(_0x8534('0x12'));var utils=require('../../config/utils');var config=require(_0x8534('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c95a2,_0x363d5d){_0x363d5d=_0x363d5d||0xcc;return function(_0x3aea51){if(_0x3aea51){return _0x2c95a2[_0x8534('0x14')](_0x363d5d);}return _0x2c95a2[_0x8534('0x15')](_0x363d5d)[_0x8534('0x16')]();};}function respondWithResult(_0x20cead,_0x4b3e31){_0x4b3e31=_0x4b3e31||0xc8;return function(_0x3a4646){if(_0x3a4646){return _0x20cead['status'](_0x4b3e31)['json'](_0x3a4646);}};}function respondWithFilteredResult(_0x39dd3d,_0x6728fd){return function(_0xf3cf1d){if(_0xf3cf1d){var _0x5d9743=_0xf3cf1d[_0x8534('0x17')],_0x5e7dfc=_0x6728fd[_0x8534('0x18')],_0x2cbc5b=_0x6728fd['offset']+_0x6728fd['limit'],_0x140ceb;if(_0x2cbc5b>=_0x5d9743){_0x2cbc5b=_0x5d9743;_0x140ceb=0xc8;}else{_0x140ceb=0xce;}_0x39dd3d['status'](_0x140ceb);return _0x39dd3d[_0x8534('0x19')](_0x8534('0x1a'),_0x5e7dfc+'-'+_0x2cbc5b+'/'+_0x5d9743)[_0x8534('0x1b')](_0xf3cf1d);}return null;};}function patchUpdates(_0x3b38a4){return function(_0x4fafa2){try{jsonpatch[_0x8534('0x1c')](_0x4fafa2,_0x3b38a4,!![]);}catch(_0x203556){return BPromise['reject'](_0x203556);}return _0x4fafa2[_0x8534('0x1d')]();};}function saveUpdates(_0x4d3bc1,_0x40e3b9){return function(_0x4d6b08){if(_0x4d6b08){return _0x4d6b08['update'](_0x4d3bc1)[_0x8534('0x1e')](function(_0x418206){return _0x418206;});}return null;};}function removeEntity(_0x1dde0f,_0xff2158){return function(_0xe077e0){if(_0xe077e0){return _0xe077e0[_0x8534('0x1f')]()[_0x8534('0x1e')](function(){_0x1dde0f[_0x8534('0x15')](0xcc)[_0x8534('0x16')]();});}};}function handleEntityNotFound(_0x57dc14,_0x492f68){return function(_0x2033fe){if(!_0x2033fe){_0x57dc14['sendStatus'](0x194);}return _0x2033fe;};}function handleError(_0x33f9fd,_0x56ac1b){_0x56ac1b=_0x56ac1b||0x1f4;return function(_0x26c446){logger[_0x8534('0x20')](_0x26c446[_0x8534('0x21')]);if(_0x26c446['name']){delete _0x26c446[_0x8534('0x22')];}_0x33f9fd[_0x8534('0x15')](_0x56ac1b)['send'](_0x26c446);};}exports['index']=function(_0x1eacf9,_0x120bf9){var _0x1e759d={},_0x2b4cab={},_0x5986b8={'count':0x0,'rows':[]};var _0x509420=_[_0x8534('0x23')](db[_0x8534('0x24')][_0x8534('0x25')],function(_0x5197ac){return{'name':_0x5197ac[_0x8534('0x26')],'type':_0x5197ac['type'][_0x8534('0x27')]};});_0x2b4cab['model']=_[_0x8534('0x23')](_0x509420,_0x8534('0x22'));_0x2b4cab[_0x8534('0x28')]=_['keys'](_0x1eacf9[_0x8534('0x28')]);_0x2b4cab[_0x8534('0x29')]=_[_0x8534('0x2a')](_0x2b4cab[_0x8534('0x2b')],_0x2b4cab[_0x8534('0x28')]);_0x1e759d['attributes']=_[_0x8534('0x2a')](_0x2b4cab[_0x8534('0x2b')],qs[_0x8534('0x2c')](_0x1eacf9[_0x8534('0x28')][_0x8534('0x2c')]));_0x1e759d[_0x8534('0x2d')]=_0x1e759d[_0x8534('0x2d')][_0x8534('0x2e')]?_0x1e759d['attributes']:_0x2b4cab[_0x8534('0x2b')];if(!_0x1eacf9['query'][_0x8534('0x2f')](_0x8534('0x30'))){_0x1e759d[_0x8534('0x31')]=qs[_0x8534('0x31')](_0x1eacf9[_0x8534('0x28')][_0x8534('0x31')]);_0x1e759d['offset']=qs['offset'](_0x1eacf9[_0x8534('0x28')][_0x8534('0x18')]);}_0x1e759d['order']=qs[_0x8534('0x32')](_0x1eacf9[_0x8534('0x28')]['sort']);_0x1e759d[_0x8534('0x33')]=qs[_0x8534('0x29')](_[_0x8534('0x34')](_0x1eacf9[_0x8534('0x28')],_0x2b4cab[_0x8534('0x29')]),_0x509420);if(_0x1eacf9[_0x8534('0x28')]['filter']){_0x1e759d['where']=_[_0x8534('0x35')](_0x1e759d[_0x8534('0x33')],{'$or':_[_0x8534('0x23')](_0x509420,function(_0x4cf3ff){if(_0x4cf3ff[_0x8534('0x36')]!=='VIRTUAL'){var _0x5b6eea={};_0x5b6eea[_0x4cf3ff[_0x8534('0x22')]]={'$like':'%'+_0x1eacf9[_0x8534('0x28')][_0x8534('0x37')]+'%'};return _0x5b6eea;}})});}_0x1e759d=_['merge']({},_0x1e759d,_0x1eacf9[_0x8534('0x38')]);var _0x213920={'where':_0x1e759d[_0x8534('0x33')]};return db['AnalyticTreeReport'][_0x8534('0x17')](_0x213920)[_0x8534('0x1e')](function(_0x438d12){_0x5986b8['count']=_0x438d12;if(_0x1eacf9['query'][_0x8534('0x39')]){_0x1e759d[_0x8534('0x3a')]=[{'all':!![]}];}return db[_0x8534('0x24')][_0x8534('0x3b')](_0x1e759d);})[_0x8534('0x1e')](function(_0x3bb42){_0x5986b8[_0x8534('0x3c')]=_0x3bb42;return _0x5986b8;})[_0x8534('0x1e')](respondWithFilteredResult(_0x120bf9,_0x1e759d))[_0x8534('0x3d')](handleError(_0x120bf9,null));};exports[_0x8534('0x3e')]=function(_0x23cfa9,_0x5d913c){var _0x22df78={'raw':!![],'where':{'id':_0x23cfa9[_0x8534('0x3f')]['id']}},_0x7f0b00={};_0x7f0b00['model']=_[_0x8534('0x40')](db[_0x8534('0x24')]['rawAttributes']);_0x7f0b00[_0x8534('0x28')]=_[_0x8534('0x40')](_0x23cfa9[_0x8534('0x28')]);_0x7f0b00[_0x8534('0x29')]=_[_0x8534('0x2a')](_0x7f0b00[_0x8534('0x2b')],_0x7f0b00[_0x8534('0x28')]);_0x22df78[_0x8534('0x2d')]=_[_0x8534('0x2a')](_0x7f0b00[_0x8534('0x2b')],qs[_0x8534('0x2c')](_0x23cfa9[_0x8534('0x28')][_0x8534('0x2c')]));_0x22df78[_0x8534('0x2d')]=_0x22df78[_0x8534('0x2d')][_0x8534('0x2e')]?_0x22df78[_0x8534('0x2d')]:_0x7f0b00['model'];if(_0x23cfa9[_0x8534('0x28')][_0x8534('0x39')]){_0x22df78['include']=[{'all':!![]}];}_0x22df78=_[_0x8534('0x35')]({},_0x22df78,_0x23cfa9[_0x8534('0x38')]);return db[_0x8534('0x24')][_0x8534('0x41')](_0x22df78)[_0x8534('0x1e')](handleEntityNotFound(_0x5d913c,null))[_0x8534('0x1e')](respondWithResult(_0x5d913c,null))[_0x8534('0x3d')](handleError(_0x5d913c,null));};exports['create']=function(_0x2eea86,_0x33d268){return db[_0x8534('0x24')][_0x8534('0x42')](_0x2eea86[_0x8534('0x43')],{})[_0x8534('0x1e')](respondWithResult(_0x33d268,0xc9))[_0x8534('0x3d')](handleError(_0x33d268,null));};exports[_0x8534('0x44')]=function(_0x397fd8,_0x2c0f2a){if(_0x397fd8[_0x8534('0x43')]['id']){delete _0x397fd8['body']['id'];}return db[_0x8534('0x24')][_0x8534('0x41')]({'where':{'id':_0x397fd8[_0x8534('0x3f')]['id']}})[_0x8534('0x1e')](handleEntityNotFound(_0x2c0f2a,null))[_0x8534('0x1e')](saveUpdates(_0x397fd8[_0x8534('0x43')],null))[_0x8534('0x1e')](respondWithResult(_0x2c0f2a,null))[_0x8534('0x3d')](handleError(_0x2c0f2a,null));};exports['destroy']=function(_0x15db59,_0x3816cf){return db[_0x8534('0x24')]['find']({'where':{'id':_0x15db59['params']['id']}})['then'](handleEntityNotFound(_0x3816cf,null))['then'](removeEntity(_0x3816cf,null))[_0x8534('0x3d')](handleError(_0x3816cf,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9ddfc6a..6c01540 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 _0xc77d=['moment','bluebird','path','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger'];(function(_0x433bff,_0x55d2da){var _0x23105e=function(_0x2efdde){while(--_0x2efdde){_0x433bff['push'](_0x433bff['shift']());}};_0x23105e(++_0x55d2da);}(_0xc77d,0x6a));var _0xdc77=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xc77d[_0x35b7ba];return _0x25ea5e;};'use strict';var _=require('lodash');var util=require(_0xdc77('0x0'));var logger=require(_0xdc77('0x1'))('api');var moment=require(_0xdc77('0x2'));var BPromise=require(_0xdc77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc77('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc77('0x5'));module[_0xdc77('0x6')]=function(_0x3646f8,_0x2da1aa){return _0x3646f8['define'](_0xdc77('0x7'),attributes,{'tableName':_0xdc77('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f3b=['define','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x59bea8,_0x5deeb7){var _0xfa3451=function(_0x2c2512){while(--_0x2c2512){_0x59bea8['push'](_0x59bea8['shift']());}};_0xfa3451(++_0x5deeb7);}(_0x0f3b,0xfe));var _0xb0f3=function(_0x2ef1b3,_0x45916e){_0x2ef1b3=_0x2ef1b3-0x0;var _0x9f46e2=_0x0f3b[_0x2ef1b3];return _0x9f46e2;};'use strict';var _=require('lodash');var util=require(_0xb0f3('0x0'));var logger=require(_0xb0f3('0x1'))(_0xb0f3('0x2'));var moment=require(_0xb0f3('0x3'));var BPromise=require(_0xb0f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0f3('0x5'));var rimraf=require(_0xb0f3('0x6'));var config=require(_0xb0f3('0x7'));var attributes=require(_0xb0f3('0x8'));module[_0xb0f3('0x9')]=function(_0x3edeef,_0x404459){return _0x3edeef[_0xb0f3('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 7413acc..ab66202 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 _0x470e=['debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c209d,_0x130f59){var _0x37b254=function(_0x167008){while(--_0x167008){_0x2c209d['push'](_0x2c209d['shift']());}};_0x37b254(++_0x130f59);}(_0x470e,0xc3));var _0xe470=function(_0x12c3d1,_0x3c6ae7){_0x12c3d1=_0x12c3d1-0x0;var _0x282840=_0x470e[_0x12c3d1];return _0x282840;};'use strict';var _=require(_0xe470('0x0'));var util=require(_0xe470('0x1'));var moment=require(_0xe470('0x2'));var BPromise=require(_0xe470('0x3'));var rs=require(_0xe470('0x4'));var fs=require('fs');var Redis=require(_0xe470('0x5'));var db=require(_0xe470('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe470('0x7'))(_0xe470('0x8'));var config=require(_0xe470('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe470('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19dfbd,_0x41b312,_0x2e72e2){return new BPromise(function(_0x3ff259,_0x158dfe){return client[_0xe470('0xb')](_0x19dfbd,_0x2e72e2)['then'](function(_0x3661f5){logger[_0xe470('0xc')](_0xe470('0xd'),_0x41b312,_0xe470('0xe'));logger[_0xe470('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x41b312,_0xe470('0xe'),JSON['stringify'](_0x3661f5));if(_0x3661f5['error']){if(_0x3661f5[_0xe470('0x10')][_0xe470('0x11')]===0x1f4){logger[_0xe470('0x10')](_0xe470('0xd'),_0x41b312,_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);return _0x158dfe(_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);}logger[_0xe470('0x10')]('AnalyticTreeReport,\x20%s,\x20%s',_0x41b312,_0x3661f5['error'][_0xe470('0x12')]);return _0x3ff259(_0x3661f5[_0xe470('0x10')][_0xe470('0x12')]);}else{logger[_0xe470('0xc')](_0xe470('0xd'),_0x41b312,'request\x20sent');_0x3ff259(_0x3661f5[_0xe470('0x13')][_0xe470('0x12')]);}})[_0xe470('0x14')](function(_0x4fa0bc){logger[_0xe470('0x10')](_0xe470('0xd'),_0x41b312,_0x4fa0bc);_0x158dfe(_0x4fa0bc);});});} \ No newline at end of file +var _0xc190=['AnalyticTreeReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xc190,0x113));var _0x0c19=function(_0x3917b2,_0x24f869){_0x3917b2=_0x3917b2-0x0;var _0xd61cc9=_0xc190[_0x3917b2];return _0xd61cc9;};'use strict';var _=require(_0x0c19('0x0'));var util=require(_0x0c19('0x1'));var moment=require(_0x0c19('0x2'));var BPromise=require(_0x0c19('0x3'));var rs=require(_0x0c19('0x4'));var fs=require('fs');var Redis=require(_0x0c19('0x5'));var db=require(_0x0c19('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0c19('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c19('0x8'));var client=jayson[_0x0c19('0x9')][_0x0c19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23c368,_0x449aa0,_0x10ce62){return new BPromise(function(_0x3f009c,_0x54b1a4){return client[_0x0c19('0xb')](_0x23c368,_0x10ce62)[_0x0c19('0xc')](function(_0x940e58){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x449aa0,_0x0c19('0xd'));logger[_0x0c19('0xe')](_0x0c19('0xf'),_0x449aa0,'request\x20sent',JSON[_0x0c19('0x10')](_0x940e58));if(_0x940e58[_0x0c19('0x11')]){if(_0x940e58[_0x0c19('0x11')]['code']===0x1f4){logger[_0x0c19('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x449aa0,_0x940e58[_0x0c19('0x11')]['message']);return _0x54b1a4(_0x940e58['error'][_0x0c19('0x12')]);}logger['error'](_0x0c19('0x13'),_0x449aa0,_0x940e58[_0x0c19('0x11')][_0x0c19('0x12')]);return _0x3f009c(_0x940e58['error'][_0x0c19('0x12')]);}else{logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x449aa0,'request\x20sent');_0x3f009c(_0x940e58['result'][_0x0c19('0x12')]);}})[_0x0c19('0x14')](function(_0x3d0055){logger[_0x0c19('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0x449aa0,_0x3d0055);_0x54b1a4(_0x3d0055);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 792268f..a8e2538 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 _0x27bc=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','exports','path'];(function(_0x2d81de,_0x2ed903){var _0xe91fc1=function(_0x4ae7d0){while(--_0x4ae7d0){_0x2d81de['push'](_0x2d81de['shift']());}};_0xe91fc1(++_0x2ed903);}(_0x27bc,0x120));var _0xc27b=function(_0x5538c4,_0x38cd72){_0x5538c4=_0x5538c4-0x0;var _0x3223c6=_0x27bc[_0x5538c4];return _0x3223c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc27b('0x0'));var timeout=require(_0xc27b('0x1'));var express=require(_0xc27b('0x2'));var router=express[_0xc27b('0x3')]();var auth=require(_0xc27b('0x4'));var interaction=require(_0xc27b('0x5'));var config=require(_0xc27b('0x6'));var controller=require(_0xc27b('0x7'));router[_0xc27b('0x8')]('/',auth['isAuthenticated'](),controller[_0xc27b('0x9')]);router[_0xc27b('0x8')](_0xc27b('0xa'),auth[_0xc27b('0xb')](),controller[_0xc27b('0xc')]);router[_0xc27b('0xd')]('/',auth['isAuthenticated'](),controller[_0xc27b('0xe')]);router['put'](_0xc27b('0xa'),auth[_0xc27b('0xb')](),controller[_0xc27b('0xf')]);router['delete'](_0xc27b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc27b('0x10')]=router; \ No newline at end of file +var _0x9d73=['index','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x483540,_0x90efa6){var _0x356d6b=function(_0x348edd){while(--_0x348edd){_0x483540['push'](_0x483540['shift']());}};_0x356d6b(++_0x90efa6);}(_0x9d73,0x1ba));var _0x39d7=function(_0x984509,_0x4b57b8){_0x984509=_0x984509-0x0;var _0x193f20=_0x9d73[_0x984509];return _0x193f20;};'use strict';var multer=require(_0x39d7('0x0'));var util=require(_0x39d7('0x1'));var path=require('path');var timeout=require(_0x39d7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x39d7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x39d7('0x4'));var controller=require(_0x39d7('0x5'));router[_0x39d7('0x6')]('/',auth[_0x39d7('0x7')](),controller[_0x39d7('0x8')]);router[_0x39d7('0x6')](_0x39d7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x39d7('0xa')]('/',auth['isAuthenticated'](),controller[_0x39d7('0xb')]);router['put'](_0x39d7('0x9'),auth['isAuthenticated'](),controller[_0x39d7('0xc')]);router[_0x39d7('0xd')]('/:id',auth[_0x39d7('0x7')](),controller[_0x39d7('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d0a33bc..52c6431 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 _0x8834=['exports','STRING'];(function(_0x34b35d,_0x53c19f){var _0x5ad57f=function(_0x55aa02){while(--_0x55aa02){_0x34b35d['push'](_0x34b35d['shift']());}};_0x5ad57f(++_0x53c19f);}(_0x8834,0x1ba));var _0x4883=function(_0x4adfb5,_0x50140c){_0x4adfb5=_0x4adfb5-0x0;var _0x1539f2=_0x8834[_0x4adfb5];return _0x1539f2;};'use strict';var Sequelize=require('sequelize');module[_0x4883('0x0')]={'name':{'type':Sequelize[_0x4883('0x1')]},'basename':{'type':Sequelize[_0x4883('0x1')]},'type':{'type':Sequelize[_0x4883('0x1')]}}; \ No newline at end of file +var _0xa449=['sequelize','exports','STRING'];(function(_0x62af84,_0x3c8214){var _0x583814=function(_0x3ecbb0){while(--_0x3ecbb0){_0x62af84['push'](_0x62af84['shift']());}};_0x583814(++_0x3c8214);}(_0xa449,0x123));var _0x9a44=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa449[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x9a44('0x0'));module[_0x9a44('0x1')]={'name':{'type':Sequelize[_0x9a44('0x2')]},'basename':{'type':Sequelize[_0x9a44('0x2')]},'type':{'type':Sequelize[_0x9a44('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1e8e254..55cc408 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 _0x51b5=['Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x3c15c2,_0x15110b){var _0x421658=function(_0x2e6723){while(--_0x2e6723){_0x3c15c2['push'](_0x3c15c2['shift']());}};_0x421658(++_0x15110b);}(_0x51b5,0x7f));var _0x551b=function(_0x3f1f5b,_0x4cccea){_0x3f1f5b=_0x3f1f5b-0x0;var _0x527a0c=_0x51b5[_0x3f1f5b];return _0x527a0c;};'use strict';var pdf=require(_0x551b('0x0'));var emlformat=require(_0x551b('0x1'));var rimraf=require(_0x551b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x551b('0x3'));var rp=require('request-promise');var moment=require(_0x551b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x551b('0x5'));var util=require(_0x551b('0x6'));var path=require(_0x551b('0x7'));var sox=require('sox');var csv=require(_0x551b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x551b('0x9'));var squel=require(_0x551b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x551b('0xb'));var toCsv=require(_0x551b('0x8'));var querystring=require(_0x551b('0xc'));var Papa=require(_0x551b('0xd'));var Redis=require(_0x551b('0xe'));var authService=require(_0x551b('0xf'));var qs=require(_0x551b('0x10'));var as=require(_0x551b('0x11'));var hardwareService=require(_0x551b('0x12'));var logger=require(_0x551b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b820f,_0x15cdea){_0x15cdea=_0x15cdea||0xcc;return function(_0x2138c2){if(_0x2138c2){return _0x3b820f[_0x551b('0x14')](_0x15cdea);}return _0x3b820f[_0x551b('0x15')](_0x15cdea)[_0x551b('0x16')]();};}function respondWithResult(_0x180f59,_0x1d331e){_0x1d331e=_0x1d331e||0xc8;return function(_0x4f85e7){if(_0x4f85e7){return _0x180f59[_0x551b('0x15')](_0x1d331e)[_0x551b('0x17')](_0x4f85e7);}};}function respondWithFilteredResult(_0xd800d4,_0x480a99){return function(_0x582d66){if(_0x582d66){var _0x5614e4=_0x582d66[_0x551b('0x18')],_0x3f7e39=_0x480a99['offset'],_0x3a9e0c=_0x480a99[_0x551b('0x19')]+_0x480a99[_0x551b('0x1a')],_0x1fa59f;if(_0x3a9e0c>=_0x5614e4){_0x3a9e0c=_0x5614e4;_0x1fa59f=0xc8;}else{_0x1fa59f=0xce;}_0xd800d4['status'](_0x1fa59f);return _0xd800d4[_0x551b('0x1b')]('Content-Range',_0x3f7e39+'-'+_0x3a9e0c+'/'+_0x5614e4)[_0x551b('0x17')](_0x582d66);}return null;};}function patchUpdates(_0x3437b8){return function(_0x400a84){try{jsonpatch[_0x551b('0x1c')](_0x400a84,_0x3437b8,!![]);}catch(_0x42ca1b){return BPromise[_0x551b('0x1d')](_0x42ca1b);}return _0x400a84['save']();};}function saveUpdates(_0x3a84b7,_0x20053a){return function(_0x3d4021){if(_0x3d4021){return _0x3d4021[_0x551b('0x1e')](_0x3a84b7)[_0x551b('0x1f')](function(_0x461f1e){return _0x461f1e;});}return null;};}function removeEntity(_0x5f0123,_0x2ab789){return function(_0x1bfe73){if(_0x1bfe73){return _0x1bfe73[_0x551b('0x20')]()[_0x551b('0x1f')](function(){_0x5f0123[_0x551b('0x15')](0xcc)[_0x551b('0x16')]();});}};}function handleEntityNotFound(_0x3c9c8e,_0xe4622a){return function(_0x540a51){if(!_0x540a51){_0x3c9c8e[_0x551b('0x14')](0x194);}return _0x540a51;};}function handleError(_0x39c5a3,_0x1129db){_0x1129db=_0x1129db||0x1f4;return function(_0x34f451){logger[_0x551b('0x21')](_0x34f451[_0x551b('0x22')]);if(_0x34f451[_0x551b('0x23')]){delete _0x34f451[_0x551b('0x23')];}_0x39c5a3['status'](_0x1129db)[_0x551b('0x24')](_0x34f451);};}exports[_0x551b('0x25')]=function(_0x2219cb,_0x2602b0){var _0x451382={},_0x3fe140={},_0x5dd2d6={'count':0x0,'rows':[]};var _0xd7db16=_[_0x551b('0x26')](db[_0x551b('0x27')][_0x551b('0x28')],function(_0x1e6797){return{'name':_0x1e6797[_0x551b('0x29')],'type':_0x1e6797[_0x551b('0x2a')][_0x551b('0x2b')]};});_0x3fe140['model']=_['map'](_0xd7db16,_0x551b('0x23'));_0x3fe140[_0x551b('0x2c')]=_[_0x551b('0x2d')](_0x2219cb[_0x551b('0x2c')]);_0x3fe140[_0x551b('0x2e')]=_[_0x551b('0x2f')](_0x3fe140[_0x551b('0x30')],_0x3fe140[_0x551b('0x2c')]);_0x451382[_0x551b('0x31')]=_['intersection'](_0x3fe140[_0x551b('0x30')],qs[_0x551b('0x32')](_0x2219cb[_0x551b('0x2c')][_0x551b('0x32')]));_0x451382[_0x551b('0x31')]=_0x451382['attributes']['length']?_0x451382[_0x551b('0x31')]:_0x3fe140[_0x551b('0x30')];if(!_0x2219cb[_0x551b('0x2c')][_0x551b('0x33')](_0x551b('0x34'))){_0x451382['limit']=qs['limit'](_0x2219cb[_0x551b('0x2c')][_0x551b('0x1a')]);_0x451382[_0x551b('0x19')]=qs[_0x551b('0x19')](_0x2219cb[_0x551b('0x2c')]['offset']);}_0x451382[_0x551b('0x35')]=qs[_0x551b('0x36')](_0x2219cb[_0x551b('0x2c')][_0x551b('0x36')]);_0x451382[_0x551b('0x37')]=qs[_0x551b('0x2e')](_[_0x551b('0x38')](_0x2219cb['query'],_0x3fe140[_0x551b('0x2e')]),_0xd7db16);if(_0x2219cb['query']['filter']){_0x451382[_0x551b('0x37')]=_[_0x551b('0x39')](_0x451382[_0x551b('0x37')],{'$or':_['map'](_0xd7db16,function(_0x391d0c){if(_0x391d0c[_0x551b('0x2a')]!=='VIRTUAL'){var _0x46cebd={};_0x46cebd[_0x391d0c[_0x551b('0x23')]]={'$like':'%'+_0x2219cb[_0x551b('0x2c')][_0x551b('0x3a')]+'%'};return _0x46cebd;}})});}_0x451382=_['merge']({},_0x451382,_0x2219cb[_0x551b('0x3b')]);var _0x3474fd={'where':_0x451382['where']};return db[_0x551b('0x27')]['count'](_0x3474fd)[_0x551b('0x1f')](function(_0x1a73ee){_0x5dd2d6[_0x551b('0x18')]=_0x1a73ee;if(_0x2219cb['query'][_0x551b('0x3c')]){_0x451382[_0x551b('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0x551b('0x3e')](_0x451382);})[_0x551b('0x1f')](function(_0x490d2d){_0x5dd2d6[_0x551b('0x3f')]=_0x490d2d;return _0x5dd2d6;})[_0x551b('0x1f')](respondWithFilteredResult(_0x2602b0,_0x451382))[_0x551b('0x40')](handleError(_0x2602b0,null));};exports[_0x551b('0x41')]=function(_0x2f395e,_0x5188de){var _0x5c2427={'raw':!![],'where':{'id':_0x2f395e[_0x551b('0x42')]['id']}},_0x286e62={};_0x286e62['model']=_['keys'](db['Attachment']['rawAttributes']);_0x286e62[_0x551b('0x2c')]=_[_0x551b('0x2d')](_0x2f395e[_0x551b('0x2c')]);_0x286e62[_0x551b('0x2e')]=_['intersection'](_0x286e62[_0x551b('0x30')],_0x286e62[_0x551b('0x2c')]);_0x5c2427[_0x551b('0x31')]=_[_0x551b('0x2f')](_0x286e62[_0x551b('0x30')],qs[_0x551b('0x32')](_0x2f395e['query']['fields']));_0x5c2427['attributes']=_0x5c2427[_0x551b('0x31')][_0x551b('0x43')]?_0x5c2427['attributes']:_0x286e62['model'];if(_0x2f395e[_0x551b('0x2c')][_0x551b('0x3c')]){_0x5c2427[_0x551b('0x3d')]=[{'all':!![]}];}_0x5c2427=_[_0x551b('0x39')]({},_0x5c2427,_0x2f395e[_0x551b('0x3b')]);return db[_0x551b('0x27')][_0x551b('0x44')](_0x5c2427)[_0x551b('0x1f')](handleEntityNotFound(_0x5188de,null))[_0x551b('0x1f')](respondWithResult(_0x5188de,null))[_0x551b('0x40')](handleError(_0x5188de,null));};exports['clone']=function(_0x21c092,_0x384ee6){var _0x2471c1={'where':{'id':_0x21c092[_0x551b('0x42')]['id']}},_0x35cbfc={};_0x35cbfc[_0x551b('0x30')]=_['keys'](db['Attachment'][_0x551b('0x28')]);_0x2471c1['attributes']=_[_0x551b('0x2f')](_0x35cbfc['model'],qs['fields'](_0x21c092[_0x551b('0x2c')][_0x551b('0x32')]));_0x2471c1[_0x551b('0x31')]=_0x2471c1[_0x551b('0x31')][_0x551b('0x43')]?_0x2471c1[_0x551b('0x31')]:_0x35cbfc[_0x551b('0x30')];if(_0x21c092[_0x551b('0x2c')]['includeAll']){_0x2471c1[_0x551b('0x3d')]=[{'all':!![]}];}_0x2471c1=_[_0x551b('0x39')]({},_0x2471c1,_0x21c092[_0x551b('0x3b')]);return db['Attachment']['find'](_0x2471c1)[_0x551b('0x1f')](handleEntityNotFound(_0x384ee6,null))[_0x551b('0x1f')](function(_0x45c8ce){if(_0x45c8ce){var _0x3c5438=_0x45c8ce[_0x551b('0x45')]({'plain':!![]});_0x3c5438=qs[_0x551b('0x46')](_0x3c5438,['id',_0x551b('0x47'),_0x551b('0x48')]);_0x21c092['body']=_[_0x551b('0x46')](_0x21c092[_0x551b('0x49')],['id','createdAt',_0x551b('0x48')]);return db['Attachment']['create'](_[_0x551b('0x39')](_0x3c5438,_0x21c092[_0x551b('0x49')]),{'include':_0x21c092[_0x551b('0x2c')][_0x551b('0x3c')]?[{'all':!![]}]:undefined});}})[_0x551b('0x1f')](respondWithResult(_0x384ee6,0xc9))[_0x551b('0x40')](handleError(_0x384ee6,null));};exports['update']=function(_0x5c81ce,_0x49d549){if(_0x5c81ce[_0x551b('0x49')]['id']){delete _0x5c81ce['body']['id'];}return db[_0x551b('0x27')][_0x551b('0x44')]({'where':{'id':_0x5c81ce[_0x551b('0x42')]['id']}})[_0x551b('0x1f')](handleEntityNotFound(_0x49d549,null))['then'](saveUpdates(_0x5c81ce[_0x551b('0x49')],null))[_0x551b('0x1f')](respondWithResult(_0x49d549,null))[_0x551b('0x40')](handleError(_0x49d549,null));};exports[_0x551b('0x20')]=function(_0x9b18af,_0x2aacbd){return db[_0x551b('0x27')]['find']({'where':{'id':_0x9b18af[_0x551b('0x42')]['id']}})[_0x551b('0x1f')](handleEntityNotFound(_0x2aacbd,null))[_0x551b('0x1f')](removeEntity(_0x2aacbd,null))[_0x551b('0x40')](handleError(_0x2aacbd,null));};exports[_0x551b('0x4a')]=function(_0x3a7ab0,_0x1a9f6c,_0x3f9dc8){_0x3a7ab0[_0x551b('0x49')][_0x551b('0x23')]=_0x3a7ab0[_0x551b('0x4b')][_0x551b('0x4c')];_0x3a7ab0[_0x551b('0x49')][_0x551b('0x4d')]=_0x3a7ab0[_0x551b('0x4b')]['filename'];_0x3a7ab0[_0x551b('0x49')][_0x551b('0x2a')]=_0x3a7ab0[_0x551b('0x4b')][_0x551b('0x4e')];return db[_0x551b('0x27')][_0x551b('0x4a')](_0x3a7ab0['body'])[_0x551b('0x1f')](respondWithResult(_0x1a9f6c,0xc9))[_0x551b('0x40')](handleError(_0x1a9f6c,null));};exports[_0x551b('0x4f')]=function(_0x4a688a,_0x3021e6,_0x1e3c18){return db[_0x551b('0x27')]['findOne']({'where':{'id':_0x4a688a[_0x551b('0x42')]['id']},'raw':!![]})[_0x551b('0x1f')](handleEntityNotFound(_0x3021e6,null))[_0x551b('0x1f')](function(_0x53842e){if(_0x53842e){return _0x3021e6[_0x551b('0x4f')](path[_0x551b('0x50')](config[_0x551b('0x51')],_0x551b('0x52'),_0x53842e[_0x551b('0x4d')]));}})[_0x551b('0x40')](handleError(_0x3021e6,null));}; \ No newline at end of file +var _0x3d0b=['index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','intersection','fields','clone','find','get','omit','createdAt','updatedAt','body','create','file','basename','mimetype','download','findOne','root','server/files/attachments/','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','save','update','then','destroy','stack','name'];(function(_0x16a459,_0x1e86a1){var _0x3dd263=function(_0x44a9eb){while(--_0x44a9eb){_0x16a459['push'](_0x16a459['shift']());}};_0x3dd263(++_0x1e86a1);}(_0x3d0b,0x119));var _0xb3d0=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x3d0b[_0x36a469];return _0x3347fc;};'use strict';var pdf=require(_0xb3d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb3d0('0x1'));var zipdir=require(_0xb3d0('0x2'));var jsonpatch=require(_0xb3d0('0x3'));var rp=require(_0xb3d0('0x4'));var moment=require(_0xb3d0('0x5'));var BPromise=require(_0xb3d0('0x6'));var Mustache=require(_0xb3d0('0x7'));var util=require('util');var path=require(_0xb3d0('0x8'));var sox=require(_0xb3d0('0x9'));var csv=require(_0xb3d0('0xa'));var ejs=require(_0xb3d0('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb3d0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb3d0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb3d0('0xe'));var Papa=require(_0xb3d0('0xf'));var Redis=require(_0xb3d0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb3d0('0x11'));var as=require(_0xb3d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3d0('0x13'));var utils=require('../../config/utils');var config=require(_0xb3d0('0x14'));var db=require(_0xb3d0('0x15'))['db'];function respondWithStatusCode(_0x35812a,_0x350406){_0x350406=_0x350406||0xcc;return function(_0x2b5d6c){if(_0x2b5d6c){return _0x35812a[_0xb3d0('0x16')](_0x350406);}return _0x35812a[_0xb3d0('0x17')](_0x350406)[_0xb3d0('0x18')]();};}function respondWithResult(_0x22bbc6,_0xcf229c){_0xcf229c=_0xcf229c||0xc8;return function(_0x37d29f){if(_0x37d29f){return _0x22bbc6['status'](_0xcf229c)['json'](_0x37d29f);}};}function respondWithFilteredResult(_0x2662e4,_0xe253bf){return function(_0x2198a7){if(_0x2198a7){var _0x168f10=_0x2198a7[_0xb3d0('0x19')],_0x243d6c=_0xe253bf[_0xb3d0('0x1a')],_0x1abd06=_0xe253bf[_0xb3d0('0x1a')]+_0xe253bf[_0xb3d0('0x1b')],_0x300c06;if(_0x1abd06>=_0x168f10){_0x1abd06=_0x168f10;_0x300c06=0xc8;}else{_0x300c06=0xce;}_0x2662e4['status'](_0x300c06);return _0x2662e4['set']('Content-Range',_0x243d6c+'-'+_0x1abd06+'/'+_0x168f10)[_0xb3d0('0x1c')](_0x2198a7);}return null;};}function patchUpdates(_0x626725){return function(_0x10113f){try{jsonpatch['apply'](_0x10113f,_0x626725,!![]);}catch(_0x198578){return BPromise['reject'](_0x198578);}return _0x10113f[_0xb3d0('0x1d')]();};}function saveUpdates(_0x2e86c2,_0x19dc00){return function(_0x1f5866){if(_0x1f5866){return _0x1f5866[_0xb3d0('0x1e')](_0x2e86c2)[_0xb3d0('0x1f')](function(_0xbbe1a2){return _0xbbe1a2;});}return null;};}function removeEntity(_0x426d77,_0x404157){return function(_0x1319d2){if(_0x1319d2){return _0x1319d2[_0xb3d0('0x20')]()[_0xb3d0('0x1f')](function(){_0x426d77[_0xb3d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2deb6d,_0x680627){return function(_0x54fca8){if(!_0x54fca8){_0x2deb6d[_0xb3d0('0x16')](0x194);}return _0x54fca8;};}function handleError(_0x1725a8,_0x32f904){_0x32f904=_0x32f904||0x1f4;return function(_0x2e3a60){logger['error'](_0x2e3a60[_0xb3d0('0x21')]);if(_0x2e3a60[_0xb3d0('0x22')]){delete _0x2e3a60[_0xb3d0('0x22')];}_0x1725a8['status'](_0x32f904)['send'](_0x2e3a60);};}exports[_0xb3d0('0x23')]=function(_0x203254,_0x2b0976){var _0x5875cd={},_0x6a8b6c={},_0x132692={'count':0x0,'rows':[]};var _0x15bf4c=_[_0xb3d0('0x24')](db[_0xb3d0('0x25')][_0xb3d0('0x26')],function(_0xf20b70){return{'name':_0xf20b70['fieldName'],'type':_0xf20b70[_0xb3d0('0x27')][_0xb3d0('0x28')]};});_0x6a8b6c[_0xb3d0('0x29')]=_[_0xb3d0('0x24')](_0x15bf4c,'name');_0x6a8b6c[_0xb3d0('0x2a')]=_[_0xb3d0('0x2b')](_0x203254[_0xb3d0('0x2a')]);_0x6a8b6c[_0xb3d0('0x2c')]=_['intersection'](_0x6a8b6c[_0xb3d0('0x29')],_0x6a8b6c[_0xb3d0('0x2a')]);_0x5875cd[_0xb3d0('0x2d')]=_['intersection'](_0x6a8b6c[_0xb3d0('0x29')],qs['fields'](_0x203254[_0xb3d0('0x2a')]['fields']));_0x5875cd[_0xb3d0('0x2d')]=_0x5875cd['attributes'][_0xb3d0('0x2e')]?_0x5875cd[_0xb3d0('0x2d')]:_0x6a8b6c[_0xb3d0('0x29')];if(!_0x203254[_0xb3d0('0x2a')][_0xb3d0('0x2f')](_0xb3d0('0x30'))){_0x5875cd[_0xb3d0('0x1b')]=qs[_0xb3d0('0x1b')](_0x203254['query'][_0xb3d0('0x1b')]);_0x5875cd['offset']=qs['offset'](_0x203254[_0xb3d0('0x2a')]['offset']);}_0x5875cd[_0xb3d0('0x31')]=qs[_0xb3d0('0x32')](_0x203254[_0xb3d0('0x2a')][_0xb3d0('0x32')]);_0x5875cd['where']=qs[_0xb3d0('0x2c')](_['pick'](_0x203254[_0xb3d0('0x2a')],_0x6a8b6c['filters']),_0x15bf4c);if(_0x203254[_0xb3d0('0x2a')][_0xb3d0('0x33')]){_0x5875cd[_0xb3d0('0x34')]=_['merge'](_0x5875cd[_0xb3d0('0x34')],{'$or':_[_0xb3d0('0x24')](_0x15bf4c,function(_0x4beaf5){if(_0x4beaf5[_0xb3d0('0x27')]!==_0xb3d0('0x35')){var _0x340508={};_0x340508[_0x4beaf5[_0xb3d0('0x22')]]={'$like':'%'+_0x203254['query'][_0xb3d0('0x33')]+'%'};return _0x340508;}})});}_0x5875cd=_[_0xb3d0('0x36')]({},_0x5875cd,_0x203254[_0xb3d0('0x37')]);var _0x24c04f={'where':_0x5875cd[_0xb3d0('0x34')]};return db['Attachment'][_0xb3d0('0x19')](_0x24c04f)[_0xb3d0('0x1f')](function(_0x15ec7d){_0x132692['count']=_0x15ec7d;if(_0x203254[_0xb3d0('0x2a')][_0xb3d0('0x38')]){_0x5875cd['include']=[{'all':!![]}];}return db[_0xb3d0('0x25')][_0xb3d0('0x39')](_0x5875cd);})[_0xb3d0('0x1f')](function(_0x356193){_0x132692[_0xb3d0('0x3a')]=_0x356193;return _0x132692;})[_0xb3d0('0x1f')](respondWithFilteredResult(_0x2b0976,_0x5875cd))[_0xb3d0('0x3b')](handleError(_0x2b0976,null));};exports[_0xb3d0('0x3c')]=function(_0x3dd1d0,_0x1f3369){var _0x2d703c={'raw':!![],'where':{'id':_0x3dd1d0[_0xb3d0('0x3d')]['id']}},_0x977f28={};_0x977f28[_0xb3d0('0x29')]=_['keys'](db[_0xb3d0('0x25')][_0xb3d0('0x26')]);_0x977f28[_0xb3d0('0x2a')]=_[_0xb3d0('0x2b')](_0x3dd1d0[_0xb3d0('0x2a')]);_0x977f28['filters']=_[_0xb3d0('0x3e')](_0x977f28['model'],_0x977f28[_0xb3d0('0x2a')]);_0x2d703c['attributes']=_[_0xb3d0('0x3e')](_0x977f28[_0xb3d0('0x29')],qs[_0xb3d0('0x3f')](_0x3dd1d0[_0xb3d0('0x2a')][_0xb3d0('0x3f')]));_0x2d703c[_0xb3d0('0x2d')]=_0x2d703c[_0xb3d0('0x2d')][_0xb3d0('0x2e')]?_0x2d703c[_0xb3d0('0x2d')]:_0x977f28[_0xb3d0('0x29')];if(_0x3dd1d0[_0xb3d0('0x2a')]['includeAll']){_0x2d703c['include']=[{'all':!![]}];}_0x2d703c=_[_0xb3d0('0x36')]({},_0x2d703c,_0x3dd1d0[_0xb3d0('0x37')]);return db[_0xb3d0('0x25')]['find'](_0x2d703c)[_0xb3d0('0x1f')](handleEntityNotFound(_0x1f3369,null))[_0xb3d0('0x1f')](respondWithResult(_0x1f3369,null))[_0xb3d0('0x3b')](handleError(_0x1f3369,null));};exports[_0xb3d0('0x40')]=function(_0xb39cc1,_0x425ea3){var _0x32facb={'where':{'id':_0xb39cc1[_0xb3d0('0x3d')]['id']}},_0x3d8739={};_0x3d8739[_0xb3d0('0x29')]=_[_0xb3d0('0x2b')](db[_0xb3d0('0x25')][_0xb3d0('0x26')]);_0x32facb[_0xb3d0('0x2d')]=_[_0xb3d0('0x3e')](_0x3d8739[_0xb3d0('0x29')],qs[_0xb3d0('0x3f')](_0xb39cc1[_0xb3d0('0x2a')][_0xb3d0('0x3f')]));_0x32facb['attributes']=_0x32facb[_0xb3d0('0x2d')][_0xb3d0('0x2e')]?_0x32facb[_0xb3d0('0x2d')]:_0x3d8739[_0xb3d0('0x29')];if(_0xb39cc1[_0xb3d0('0x2a')][_0xb3d0('0x38')]){_0x32facb['include']=[{'all':!![]}];}_0x32facb=_[_0xb3d0('0x36')]({},_0x32facb,_0xb39cc1[_0xb3d0('0x37')]);return db[_0xb3d0('0x25')][_0xb3d0('0x41')](_0x32facb)[_0xb3d0('0x1f')](handleEntityNotFound(_0x425ea3,null))[_0xb3d0('0x1f')](function(_0x4e5893){if(_0x4e5893){var _0x32813f=_0x4e5893[_0xb3d0('0x42')]({'plain':!![]});_0x32813f=qs[_0xb3d0('0x43')](_0x32813f,['id',_0xb3d0('0x44'),_0xb3d0('0x45')]);_0xb39cc1[_0xb3d0('0x46')]=_[_0xb3d0('0x43')](_0xb39cc1[_0xb3d0('0x46')],['id',_0xb3d0('0x44'),_0xb3d0('0x45')]);return db['Attachment'][_0xb3d0('0x47')](_['merge'](_0x32813f,_0xb39cc1[_0xb3d0('0x46')]),{'include':_0xb39cc1[_0xb3d0('0x2a')][_0xb3d0('0x38')]?[{'all':!![]}]:undefined});}})[_0xb3d0('0x1f')](respondWithResult(_0x425ea3,0xc9))['catch'](handleError(_0x425ea3,null));};exports[_0xb3d0('0x1e')]=function(_0x98aa88,_0x252341){if(_0x98aa88[_0xb3d0('0x46')]['id']){delete _0x98aa88[_0xb3d0('0x46')]['id'];}return db[_0xb3d0('0x25')][_0xb3d0('0x41')]({'where':{'id':_0x98aa88['params']['id']}})['then'](handleEntityNotFound(_0x252341,null))[_0xb3d0('0x1f')](saveUpdates(_0x98aa88[_0xb3d0('0x46')],null))['then'](respondWithResult(_0x252341,null))[_0xb3d0('0x3b')](handleError(_0x252341,null));};exports[_0xb3d0('0x20')]=function(_0x2bf0ee,_0x2aec68){return db['Attachment']['find']({'where':{'id':_0x2bf0ee['params']['id']}})[_0xb3d0('0x1f')](handleEntityNotFound(_0x2aec68,null))['then'](removeEntity(_0x2aec68,null))['catch'](handleError(_0x2aec68,null));};exports[_0xb3d0('0x47')]=function(_0x363353,_0x59d1f0,_0x264451){_0x363353[_0xb3d0('0x46')][_0xb3d0('0x22')]=_0x363353[_0xb3d0('0x48')]['originalname'];_0x363353['body'][_0xb3d0('0x49')]=_0x363353[_0xb3d0('0x48')]['filename'];_0x363353[_0xb3d0('0x46')][_0xb3d0('0x27')]=_0x363353[_0xb3d0('0x48')][_0xb3d0('0x4a')];return db[_0xb3d0('0x25')]['create'](_0x363353[_0xb3d0('0x46')])[_0xb3d0('0x1f')](respondWithResult(_0x59d1f0,0xc9))[_0xb3d0('0x3b')](handleError(_0x59d1f0,null));};exports[_0xb3d0('0x4b')]=function(_0x3cddde,_0x1c942c,_0x23030c){return db[_0xb3d0('0x25')][_0xb3d0('0x4c')]({'where':{'id':_0x3cddde['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1c942c,null))[_0xb3d0('0x1f')](function(_0x143b9a){if(_0x143b9a){return _0x1c942c[_0xb3d0('0x4b')](path['join'](config[_0xb3d0('0x4d')],_0xb3d0('0x4e'),_0x143b9a[_0xb3d0('0x49')]));}})[_0xb3d0('0x3b')](handleError(_0x1c942c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6da4ef4..687bfd9 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 _0xa37e=['moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define','../../config/logger','api'];(function(_0x4065ee,_0xdb79dd){var _0xc78991=function(_0x1192dc){while(--_0x1192dc){_0x4065ee['push'](_0x4065ee['shift']());}};_0xc78991(++_0xdb79dd);}(_0xa37e,0x97));var _0xea37=function(_0x125e95,_0x134374){_0x125e95=_0x125e95-0x0;var _0x3799bc=_0xa37e[_0x125e95];return _0x3799bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea2=['../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4c588e,_0x283b98){var _0x5e7293=function(_0x3ca52a){while(--_0x3ca52a){_0x4c588e['push'](_0x4c588e['shift']());}};_0x5e7293(++_0x283b98);}(_0xcea2,0x15a));var _0x2cea=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xcea2[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'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 36cf7b5..5b4233d 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 _0xc1bc=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','create','body','options','raw','info','CreateAttachment','lodash','util','moment'];(function(_0x3f1e0e,_0x3bcb1e){var _0x56293b=function(_0x1d8259){while(--_0x1d8259){_0x3f1e0e['push'](_0x3f1e0e['shift']());}};_0x56293b(++_0x3bcb1e);}(_0xc1bc,0x1ad));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcc1b('0x0'));var util=require(_0xcc1b('0x1'));var moment=require(_0xcc1b('0x2'));var BPromise=require(_0xcc1b('0x3'));var rs=require(_0xcc1b('0x4'));var fs=require('fs');var Redis=require(_0xcc1b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc1b('0x6'));var logger=require(_0xcc1b('0x7'))(_0xcc1b('0x8'));var config=require(_0xcc1b('0x9'));var jayson=require(_0xcc1b('0xa'));var client=jayson['client'][_0xcc1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c747d,_0x5dbbf9,_0x307809){return new BPromise(function(_0x39cddd,_0x16d299){return client['request'](_0x3c747d,_0x307809)[_0xcc1b('0xc')](function(_0x6ba507){logger['info'](_0xcc1b('0xd'),_0x5dbbf9,_0xcc1b('0xe'));logger[_0xcc1b('0xf')](_0xcc1b('0x10'),_0x5dbbf9,_0xcc1b('0xe'),JSON['stringify'](_0x6ba507));if(_0x6ba507['error']){if(_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x12')]===0x1f4){logger[_0xcc1b('0x11')](_0xcc1b('0xd'),_0x5dbbf9,_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);return _0x16d299(_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);}logger[_0xcc1b('0x11')](_0xcc1b('0xd'),_0x5dbbf9,_0x6ba507[_0xcc1b('0x11')][_0xcc1b('0x13')]);return _0x39cddd(_0x6ba507['error'][_0xcc1b('0x13')]);}else{logger['info'](_0xcc1b('0xd'),_0x5dbbf9,_0xcc1b('0xe'));_0x39cddd(_0x6ba507['result'][_0xcc1b('0x13')]);}})[_0xcc1b('0x14')](function(_0x4d667e){logger[_0xcc1b('0x11')]('Attachment,\x20%s,\x20%s',_0x5dbbf9,_0x4d667e);_0x16d299(_0x4d667e);});});}exports['CreateAttachment']=function(_0x3f1a69){var _0x8adbbf=this;return new Promise(function(_0x369cdb,_0x2f09b5){return db['Attachment'][_0xcc1b('0x15')](_0x3f1a69[_0xcc1b('0x16')],{'raw':_0x3f1a69[_0xcc1b('0x17')]?_0x3f1a69[_0xcc1b('0x17')][_0xcc1b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x7d6906){logger[_0xcc1b('0x19')](_0xcc1b('0x1a'),_0x3f1a69);logger[_0xcc1b('0xf')](_0xcc1b('0x1a'),_0x3f1a69,JSON['stringify'](_0x7d6906));_0x369cdb(_0x7d6906);})[_0xcc1b('0x14')](function(_0x3cbca4){logger['error']('CreateAttachment',_0x3cbca4['message'],_0x3f1a69);_0x2f09b5(_0x8adbbf[_0xcc1b('0x11')](0x1f4,_0x3cbca4[_0xcc1b('0x13')]));});});}; \ No newline at end of file +var _0x07dd=['create','body','options','raw','then','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','Attachment'];(function(_0x3f969a,_0x3cd782){var _0x3b39b7=function(_0x484413){while(--_0x484413){_0x3f969a['push'](_0x3f969a['shift']());}};_0x3b39b7(++_0x3cd782);}(_0x07dd,0x82));var _0xd07d=function(_0x384cc1,_0x2c01d4){_0x384cc1=_0x384cc1-0x0;var _0x94c39b=_0x07dd[_0x384cc1];return _0x94c39b;};'use strict';var _=require(_0xd07d('0x0'));var util=require(_0xd07d('0x1'));var moment=require(_0xd07d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd07d('0x3'));var fs=require('fs');var Redis=require(_0xd07d('0x4'));var db=require(_0xd07d('0x5'))['db'];var utils=require(_0xd07d('0x6'));var logger=require(_0xd07d('0x7'))(_0xd07d('0x8'));var config=require(_0xd07d('0x9'));var jayson=require(_0xd07d('0xa'));var client=jayson[_0xd07d('0xb')][_0xd07d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5baeca,_0x4ed8f0,_0x4540f3){return new BPromise(function(_0x2f6a61,_0x220374){return client[_0xd07d('0xd')](_0x5baeca,_0x4540f3)['then'](function(_0x550ad7){logger['info'](_0xd07d('0xe'),_0x4ed8f0,_0xd07d('0xf'));logger[_0xd07d('0x10')](_0xd07d('0x11'),_0x4ed8f0,_0xd07d('0xf'),JSON[_0xd07d('0x12')](_0x550ad7));if(_0x550ad7[_0xd07d('0x13')]){if(_0x550ad7[_0xd07d('0x13')][_0xd07d('0x14')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x4ed8f0,_0x550ad7['error'][_0xd07d('0x15')]);return _0x220374(_0x550ad7['error'][_0xd07d('0x15')]);}logger[_0xd07d('0x13')](_0xd07d('0xe'),_0x4ed8f0,_0x550ad7[_0xd07d('0x13')]['message']);return _0x2f6a61(_0x550ad7['error'][_0xd07d('0x15')]);}else{logger['info'](_0xd07d('0xe'),_0x4ed8f0,_0xd07d('0xf'));_0x2f6a61(_0x550ad7['result'][_0xd07d('0x15')]);}})[_0xd07d('0x16')](function(_0x34f0d4){logger[_0xd07d('0x13')](_0xd07d('0xe'),_0x4ed8f0,_0x34f0d4);_0x220374(_0x34f0d4);});});}exports[_0xd07d('0x17')]=function(_0x394325){var _0x476aed=this;return new Promise(function(_0x4ecf1d,_0x391646){return db[_0xd07d('0x18')][_0xd07d('0x19')](_0x394325[_0xd07d('0x1a')],{'raw':_0x394325[_0xd07d('0x1b')]?_0x394325[_0xd07d('0x1b')][_0xd07d('0x1c')]===undefined?!![]:![]:!![]})[_0xd07d('0x1d')](function(_0x3f6b23){logger[_0xd07d('0x1e')](_0xd07d('0x17'),_0x394325);logger[_0xd07d('0x10')](_0xd07d('0x17'),_0x394325,JSON[_0xd07d('0x12')](_0x3f6b23));_0x4ecf1d(_0x3f6b23);})[_0xd07d('0x16')](function(_0x1ddd0e){logger[_0xd07d('0x13')](_0xd07d('0x17'),_0x1ddd0e[_0xd07d('0x15')],_0x394325);_0x391646(_0x476aed[_0xd07d('0x13')](0x1f4,_0x1ddd0e['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a4895c7..ee30be6 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 _0x7d25=['%s-%s','now','originalname','replace','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','post','/:id/clone','diskStorage','join','root','server/files/attachments/','format'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0x7d25,0x8a));var _0x57d2=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x7d25[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require('multer');var util=require(_0x57d2('0x0'));var path=require(_0x57d2('0x1'));var timeout=require(_0x57d2('0x2'));var express=require(_0x57d2('0x3'));var router=express[_0x57d2('0x4')]();var auth=require(_0x57d2('0x5'));var interaction=require(_0x57d2('0x6'));var config=require('../../config/environment');var controller=require('./attachment.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x57d2('0x7')]);router['get'](_0x57d2('0x8'),auth[_0x57d2('0x9')](),controller[_0x57d2('0xa')]);router['get']('/:id/download',auth[_0x57d2('0x9')](),controller['download']);router[_0x57d2('0xb')](_0x57d2('0xc'),auth[_0x57d2('0x9')](),controller['clone']);var upload=multer({'storage':multer[_0x57d2('0xd')]({'destination':function(_0x1a86db,_0x1fa168,_0x3a53a1){_0x3a53a1(null,path[_0x57d2('0xe')](config[_0x57d2('0xf')],_0x57d2('0x10')));},'filename':function(_0x197426,_0x43d7fb,_0x32c33a){_0x32c33a(null,util[_0x57d2('0x11')](_0x57d2('0x12'),Date[_0x57d2('0x13')](),_0x43d7fb[_0x57d2('0x14')][_0x57d2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x57d2('0xb')]('/',upload['single']('file'),controller[_0x57d2('0x16')]);router[_0x57d2('0x17')]('/:id',auth[_0x57d2('0x9')](),controller[_0x57d2('0x18')]);router['delete'](_0x57d2('0x8'),auth['isAuthenticated'](),controller[_0x57d2('0x19')]);module['exports']=router; \ No newline at end of file +var _0xfaf2=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','/:id','isAuthenticated','show','/:id/download','post','/:id/clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file','create','update','delete','destroy'];(function(_0x550e39,_0x3e320e){var _0x11069b=function(_0x55119b){while(--_0x55119b){_0x550e39['push'](_0x550e39['shift']());}};_0x11069b(++_0x3e320e);}(_0xfaf2,0x169));var _0x2faf=function(_0x478c6d,_0x51578c){_0x478c6d=_0x478c6d-0x0;var _0x37abe9=_0xfaf2[_0x478c6d];return _0x37abe9;};'use strict';var multer=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var path=require(_0x2faf('0x2'));var timeout=require(_0x2faf('0x3'));var express=require(_0x2faf('0x4'));var router=express['Router']();var auth=require(_0x2faf('0x5'));var interaction=require(_0x2faf('0x6'));var config=require(_0x2faf('0x7'));var controller=require(_0x2faf('0x8'));router[_0x2faf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2faf('0xa'),auth[_0x2faf('0xb')](),controller[_0x2faf('0xc')]);router[_0x2faf('0x9')](_0x2faf('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x2faf('0xe')](_0x2faf('0xf'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0x2faf('0x10')]({'destination':function(_0x3fa4b0,_0x27ae4c,_0x5c705a){_0x5c705a(null,path['join'](config[_0x2faf('0x11')],_0x2faf('0x12')));},'filename':function(_0x52c162,_0x335730,_0x509157){_0x509157(null,util[_0x2faf('0x13')](_0x2faf('0x14'),Date[_0x2faf('0x15')](),_0x335730[_0x2faf('0x16')][_0x2faf('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2faf('0xe')]('/',upload['single'](_0x2faf('0x18')),controller[_0x2faf('0x19')]);router['put'](_0x2faf('0xa'),auth[_0x2faf('0xb')](),controller[_0x2faf('0x1a')]);router[_0x2faf('0x1b')]('/:id',auth[_0x2faf('0xb')](),controller[_0x2faf('0x1c')]);module[_0x2faf('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 558d6ce..782158e 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 _0x62da=['disabled','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','lodash','passport','passport-google-oauth20','moment','../../config/utils','google','/login','profile','email','callback','authenticate','use','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user'];(function(_0x2eb898,_0x43c47b){var _0x58974f=function(_0x5cdc1){while(--_0x5cdc1){_0x2eb898['push'](_0x2eb898['shift']());}};_0x58974f(++_0x43c47b);}(_0x62da,0x131));var _0xa62d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62da[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa62d('0x0'));var passport=require(_0xa62d('0x1'));var GoogleStrategy=require(_0xa62d('0x2'))['Strategy'];var moment=require(_0xa62d('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0xa62d('0x4'));exports['login']=passport['authenticate'](_0xa62d('0x5'),{'failureRedirect':_0xa62d('0x6'),'scope':[_0xa62d('0x7'),_0xa62d('0x8')],'session':![]});exports[_0xa62d('0x9')]=passport[_0xa62d('0xa')](_0xa62d('0x5'),{'failureRedirect':_0xa62d('0x6'),'session':![]});passport[_0xa62d('0xb')](new GoogleStrategy({'clientID':config[_0xa62d('0x5')]?config['google']['clientID']:'id','clientSecret':config['google']?config['google'][_0xa62d('0xc')]:_0xa62d('0xd'),'callbackURL':config[_0xa62d('0x5')]?config[_0xa62d('0x5')]['callbackURL']:''},function(_0x2a8927,_0x2945fc,_0xbb6b1c,_0x72d2ff){var _0x958704,_0x5b0b8d;return db[_0xa62d('0xe')]['findOne']({'where':{'id':0x1},'attributes':[_0xa62d('0xf'),_0xa62d('0x10')],'raw':!![]})[_0xa62d('0x11')](function(_0x38aad8){_0x958704=_0x38aad8;return db[_0xa62d('0x12')][_0xa62d('0x13')]({'where':{'email':_[_0xa62d('0x14')](_0xbb6b1c[_0xa62d('0x15')],_0xa62d('0x16')),'role':{'$or':[_0xa62d('0x17'),_0xa62d('0x18'),'agent']}}});})['then'](function(_0x90a801){_0x5b0b8d=_0x90a801;if(_0x5b0b8d){if(_0x5b0b8d[_0xa62d('0x19')]){return _0x72d2ff('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x958704[_0xa62d('0x10')]>0x0){if(_0x5b0b8d[_0xa62d('0x1a')]){if(moment(_0x5b0b8d[_0xa62d('0x1b')])[_0xa62d('0x1c')](_0x958704[_0xa62d('0x10')],_0xa62d('0x1d'))>moment()){return _0x72d2ff('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xa62d('0x1e')](_0x5b0b8d,0x0,![],null)[_0xa62d('0x11')](function(){return utils[_0xa62d('0x1f')](_0x5b0b8d);})['then'](function(){return _0x72d2ff(null,_0x5b0b8d);});}}else{return utils[_0xa62d('0x1f')](_0x5b0b8d)[_0xa62d('0x11')](function(){return _0x72d2ff(null,_0x5b0b8d);});}}else{return utils['getLicense'](_0x5b0b8d)[_0xa62d('0x11')](function(){return _0x72d2ff(null,_0x5b0b8d);});}}return _0x72d2ff(_0xa62d('0x20'));})['catch'](function(_0x15666b){_0x72d2ff(_0x15666b);});})); \ No newline at end of file +var _0x1472=['login','authenticate','callback','google','/login','use','clientID','clientSecret','Setting','findOne','blockDuration','then','User','emails','value','agent','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','moment','../../mysqldb','../../components/auth/service','signToken','../../config/utils'];(function(_0x479a83,_0x2c8226){var _0x36d90b=function(_0x4e6dee){while(--_0x4e6dee){_0x479a83['push'](_0x479a83['shift']());}};_0x36d90b(++_0x2c8226);}(_0x1472,0x1d9));var _0x2147=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x1472[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0x2147('0x0'));var passport=require(_0x2147('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x2147('0x2'));var db=require(_0x2147('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x2147('0x4'))[_0x2147('0x5')];var utils=require(_0x2147('0x6'));exports[_0x2147('0x7')]=passport[_0x2147('0x8')]('google',{'failureRedirect':'/login','scope':['profile','email'],'session':![]});exports[_0x2147('0x9')]=passport[_0x2147('0x8')](_0x2147('0xa'),{'failureRedirect':_0x2147('0xb'),'session':![]});passport[_0x2147('0xc')](new GoogleStrategy({'clientID':config[_0x2147('0xa')]?config[_0x2147('0xa')][_0x2147('0xd')]:'id','clientSecret':config['google']?config[_0x2147('0xa')][_0x2147('0xe')]:'secret','callbackURL':config[_0x2147('0xa')]?config[_0x2147('0xa')]['callbackURL']:''},function(_0x29bf0c,_0x2b0879,_0x52497a,_0x2a7a5a){var _0x38b6ff,_0x48ff19;return db[_0x2147('0xf')][_0x2147('0x10')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2147('0x11')],'raw':!![]})[_0x2147('0x12')](function(_0x36d9bf){_0x38b6ff=_0x36d9bf;return db[_0x2147('0x13')]['find']({'where':{'email':_['map'](_0x52497a[_0x2147('0x14')],_0x2147('0x15')),'role':{'$or':['admin','user',_0x2147('0x16')]}}});})[_0x2147('0x12')](function(_0x33f43f){_0x48ff19=_0x33f43f;if(_0x48ff19){if(_0x48ff19[_0x2147('0x17')]){return _0x2a7a5a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x38b6ff[_0x2147('0x11')]>0x0){if(_0x48ff19[_0x2147('0x18')]){if(moment(_0x48ff19[_0x2147('0x19')])[_0x2147('0x1a')](_0x38b6ff[_0x2147('0x11')],_0x2147('0x1b'))>moment()){return _0x2a7a5a(_0x2147('0x1c'));}else{return utils[_0x2147('0x1d')](_0x48ff19,0x0,![],null)[_0x2147('0x12')](function(){return utils[_0x2147('0x1e')](_0x48ff19);})['then'](function(){return _0x2a7a5a(null,_0x48ff19);});}}else{return utils[_0x2147('0x1e')](_0x48ff19)[_0x2147('0x12')](function(){return _0x2a7a5a(null,_0x48ff19);});}}else{return utils['getLicense'](_0x48ff19)[_0x2147('0x12')](function(){return _0x2a7a5a(null,_0x48ff19);});}}return _0x2a7a5a(_0x2147('0x1c'));})[_0x2147('0x1f')](function(_0x2441d6){_0x2a7a5a(_0x2441d6);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 379c589..7e3ddd5 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 _0x777f=['get','login','/callback','callback','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x1b931b,_0x4b260a){var _0x448a2b=function(_0x38573a){while(--_0x38573a){_0x1b931b['push'](_0x1b931b['shift']());}};_0x448a2b(++_0x4b260a);}(_0x777f,0x9f));var _0xf777=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x777f[_0x31b5b2];return _0x364f13;};'use strict';var express=require(_0xf777('0x0'));var passport=require(_0xf777('0x1'));var router=express[_0xf777('0x2')]();var controller=require(_0xf777('0x3'));var userController=require(_0xf777('0x4'));var authService=require(_0xf777('0x5'));router[_0xf777('0x6')]('/',controller[_0xf777('0x7')]);router['get'](_0xf777('0x8'),controller[_0xf777('0x9')],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0xf777('0xa')]=router; \ No newline at end of file +var _0x207d=['get','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','login'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0x207d,0x10d));var _0xd207=function(_0x5dd297,_0x414d94){_0x5dd297=_0x5dd297-0x0;var _0x5a3b7c=_0x207d[_0x5dd297];return _0x5a3b7c;};'use strict';var express=require(_0xd207('0x0'));var passport=require(_0xd207('0x1'));var router=express[_0xd207('0x2')]();var controller=require(_0xd207('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xd207('0x4'));router['get']('/',controller[_0xd207('0x5')]);router[_0xd207('0x6')]('/callback',controller[_0xd207('0x7')],authService[_0xd207('0x8')],userController[_0xd207('0x5')],authService[_0xd207('0x9')]);module[_0xd207('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c315892..a20d7ed 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 _0x76a6=['loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','disabled','minutes','getLicense','MailAccount','find','email','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','save','Password\x20reset!','util','passport','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','blocked','blockedAt'];(function(_0xb07ade,_0x1b317b){var _0x158eed=function(_0x4a8d4c){while(--_0x4a8d4c){_0xb07ade['push'](_0xb07ade['shift']());}};_0x158eed(++_0x1b317b);}(_0x76a6,0x18b));var _0x676a=function(_0x1c289a,_0x277fe7){_0x1c289a=_0x1c289a-0x0;var _0x28d68e=_0x76a6[_0x1c289a];return _0x28d68e;};'use strict';var util=require(_0x676a('0x0'));var passport=require(_0x676a('0x1'));var LocalStrategy=require('passport-local')[_0x676a('0x2')];var jayson=require(_0x676a('0x3'));var _=require(_0x676a('0x4'));var rs=require(_0x676a('0x5'));var moment=require('moment');var db=require(_0x676a('0x6'))['db'];var authService=require(_0x676a('0x7'));var utils=require(_0x676a('0x8'));var client=jayson['client'][_0x676a('0x9')]({'port':0x232b});function localAuthenticate(_0x172fac,_0x45578e,_0x218a34,_0x4c5897){var _0x81427c,_0x32f29f;return db[_0x676a('0xa')][_0x676a('0xb')]({'where':{'id':0x1},'attributes':[_0x676a('0xc'),_0x676a('0xd')],'raw':!![]})[_0x676a('0xe')](function(_0x1779f8){_0x81427c=_0x1779f8;return _0x172fac[_0x676a('0xb')]({'attributes':['id',_0x676a('0xf'),_0x676a('0x10'),_0x676a('0x11'),'role','disabled',_0x676a('0x12'),_0x676a('0x13'),_0x676a('0x14')],'where':{'name':_0x45578e,'role':{'$or':[_0x676a('0x15'),_0x676a('0x16'),_0x676a('0x17')]}}});})[_0x676a('0xe')](function(_0x26e0bd){if(!_0x26e0bd||_0x26e0bd&&_0x26e0bd[_0x676a('0xf')]!==_0x45578e){throw new Error(_0x676a('0x18'));}else{_0x32f29f=_0x26e0bd;return _0x32f29f;}})[_0x676a('0xe')](function(){_0x32f29f[_0x676a('0x19')](_0x218a34,function(_0x5880fd,_0x6587f6){var _0x26923e=_0x32f29f[_0x676a('0x14')]+0x1;if(_0x5880fd){return _0x4c5897(_0x5880fd);}else if(!_0x6587f6){if(_0x32f29f['disabled']){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else if(_0x81427c['allowedLoginAttempts']>0x0){if(_0x32f29f[_0x676a('0x12')]){if(_0x81427c[_0x676a('0xd')]>0x0){if(moment(_0x32f29f[_0x676a('0x13')])[_0x676a('0x1a')](_0x81427c[_0x676a('0xd')],'minutes')>moment()){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x676a('0x1b')](_0x32f29f,_0x26923e,![],null)[_0x676a('0xe')](function(){return _0x4c5897(null,![],{'message':_0x676a('0x18')});});}}else{return _0x4c5897(null,![],{'message':_0x676a('0x18')});}}else{if(_0x26923e>=_0x81427c[_0x676a('0xc')]){return utils[_0x676a('0x1b')](_0x32f29f,0x0,!![],moment())['then'](function(){return _0x4c5897(null,![],{'message':_0x676a('0x18')});});}else{return utils[_0x676a('0x1b')](_0x32f29f,_0x26923e,![],null)['then'](function(){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x4c5897(null,![],{'message':_0x676a('0x18')});}}else{if(_0x32f29f[_0x676a('0x1c')]){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else if(_0x81427c[_0x676a('0xc')]>0x0){if(_0x32f29f[_0x676a('0x12')]){if(_0x81427c[_0x676a('0xd')]>0x0){if(moment(_0x32f29f[_0x676a('0x13')])[_0x676a('0x1a')](_0x81427c[_0x676a('0xd')],_0x676a('0x1d'))>moment()){return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x676a('0x1b')](_0x32f29f,0x0,![],null)[_0x676a('0xe')](function(){return utils[_0x676a('0x1e')](_0x32f29f);})[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);});}}else{return _0x4c5897(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x676a('0x1b')](_0x32f29f,0x0,![],null)['then'](function(){return utils['getLicense'](_0x32f29f);})[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);})['catch'](function(_0x5d9978){return _0x4c5897(null,![],_0x5d9978);});}}else{if(_0x32f29f[_0x676a('0x12')]){return _0x4c5897(null,![],{'message':_0x676a('0x18')});}else{return utils['getLicense'](_0x32f29f)[_0x676a('0xe')](function(){return _0x4c5897(null,_0x32f29f);});}}}});})['catch'](function(_0x52a2bf){return _0x4c5897(null,![],_0x52a2bf);});}function sendServiceMail(_0xfce087){return db[_0x676a('0x1f')][_0x676a('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x676a('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x676a('0x22')}]})[_0x676a('0xe')](function(_0x4cd5d1){if(!_0x4cd5d1){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x6f7b2a={'tls':{'rejectUnauthorized':![]}};if(_0x4cd5d1['Smtp'][_0x676a('0x23')]){_0x6f7b2a[_0x676a('0x23')]=_0x4cd5d1[_0x676a('0x22')]['service'];}else{_0x6f7b2a['host']=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x24')];_0x6f7b2a[_0x676a('0x25')]=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x25')];_0x6f7b2a[_0x676a('0x26')]=_0x4cd5d1[_0x676a('0x22')][_0x676a('0x26')];}if(_0x4cd5d1[_0x676a('0x22')][_0x676a('0x27')]){_0x6f7b2a[_0x676a('0x28')]={'user':_0x4cd5d1[_0x676a('0x22')]['user'],'pass':_0x4cd5d1['Smtp'][_0x676a('0x29')]};}var _0x19d4df={'account':_0x6f7b2a,'message':_[_0x676a('0x2a')]({'from':util[_0x676a('0x2b')](_0x676a('0x2c'),_0x4cd5d1[_0x676a('0xf')],_0x4cd5d1[_0x676a('0x21')]||_0x4cd5d1[_0x676a('0x22')][_0x676a('0x16')])},_0xfce087)};return client[_0x676a('0x2d')](_0x676a('0x2e'),_0x19d4df);})[_0x676a('0xe')](function(_0x2d13ce){if(_0x2d13ce['error']){throw new Error(util[_0x676a('0x2b')](_0x676a('0x2f'),_0x2d13ce[_0x676a('0x30')][_0x676a('0x31')]||JSON[_0x676a('0x32')](_0x2d13ce['error'])));}return!![];});}function handleError(_0xedd703,_0x3ee60d,_0x37f923){return _0xedd703[_0x676a('0x33')](_0x3ee60d||0x1f4)[_0x676a('0x34')]({'message':_0x37f923?_0x37f923[_0x676a('0x31')]||_0x37f923:''});}function checkPasswordPattern(_0x1b92ed,_0x4c47ee,_0xf77ecd){if(_0xf77ecd){var _0x4b3cef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b3cef[_0x676a('0x35')](_0x4c47ee)){return _0x1b92ed;}else{throw new Error(_0x676a('0x36'));}}else{return _0x1b92ed;}}exports[_0x676a('0x37')]=function(_0x1ada2c,_0x33e96a,_0x5e12f2){passport[_0x676a('0x19')]('local',function(_0x16c077,_0x36c148,_0x4eb63a){var _0x3c6993=_0x16c077||_0x4eb63a;if(_0x3c6993){return handleError(_0x33e96a,0x191,_0x3c6993);}if(!_0x36c148){return handleError(_0x33e96a,0x194,{'message':_0x676a('0x38')});}else{var _0x21a2df={'payload':{'id':_0x36c148['id'],'role':_0x36c148[_0x676a('0x39')]},'options':{'expiresIn':0x15180}};return authService[_0x676a('0x3a')](_0x21a2df)['then'](function(_0x580926){_0x33e96a[_0x676a('0x3b')]({'id':_0x36c148['id'],'token':_0x580926,'statusCall':'','isAlreadyLogged':_0x36c148['online']});});}})(_0x1ada2c,_0x33e96a,_0x5e12f2);};exports['forgot']=function(_0x57a5bc,_0x22696b,_0x10c760){if(!_0x57a5bc[_0x676a('0x3c')]['email']){return handleError(_0x22696b,0x1f4,{'message':_0x676a('0x3d')});}var _0x401073=rs[_0x676a('0x3e')]();_0x57a5bc['body'][_0x676a('0x21')]=_0x57a5bc[_0x676a('0x3c')]['email'][_0x676a('0x3f')]()[_0x676a('0x40')]();var _0x418764;return db[_0x676a('0xa')][_0x676a('0xb')]({'where':{'id':0x1},'attributes':[_0x676a('0xc'),'blockDuration'],'raw':!![]})[_0x676a('0xe')](function(_0x91b620){_0x418764=_0x91b620;return db[_0x676a('0x41')]['find']({'where':{'email':_0x57a5bc['body'][_0x676a('0x21')]}});})[_0x676a('0xe')](function(_0xa1d2f1){if(!_0xa1d2f1){throw new Error(_0x676a('0x42'));}if(_0xa1d2f1[_0x676a('0x1c')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0xa1d2f1[_0x676a('0x12')]){if(moment(_0xa1d2f1[_0x676a('0x13')])[_0x676a('0x1a')](_0x418764['blockDuration'],'minutes')>moment()){throw new Error(_0x676a('0x43'));}else{_0xa1d2f1[_0x676a('0x12')]=![];_0xa1d2f1[_0x676a('0x13')]=null;}}_0xa1d2f1[_0x676a('0x44')]=_0x401073;_0xa1d2f1[_0x676a('0x45')]=Date[_0x676a('0x46')]()+0x36ee80;return _0xa1d2f1['save']();})[_0x676a('0xe')](function(){return sendServiceMail({'to':_0x57a5bc[_0x676a('0x3c')]['email'],'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'+_0x676a('0x47')+_0x57a5bc[_0x676a('0x48')][_0x676a('0x24')]+_0x676a('0x49')+_0x401073+'\x0a\x0a'+_0x676a('0x4a')});})[_0x676a('0xe')](function(){_0x22696b[_0x676a('0x33')](0xc8)['send']({'message':_0x676a('0x4b')});})[_0x676a('0x4c')](function(_0x4c9527){return handleError(_0x22696b,0x1f4,_0x4c9527);});};exports[_0x676a('0x4d')]=function(_0x5a8283,_0x4c3356,_0x4a52b0){var _0x37aabd;return db[_0x676a('0x41')][_0x676a('0x20')]({'where':{'resetPasswordToken':_0x5a8283['params'][_0x676a('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x676a('0x46')]()}}})[_0x676a('0xe')](function(_0x15baa8){_0x37aabd=_0x15baa8;if(!_0x37aabd){throw new Error(_0x676a('0x4f'));}return db['Setting'][_0x676a('0xb')]({'attributes':['id',_0x676a('0x50')]});})[_0x676a('0xe')](function(_0x544f48){return checkPasswordPattern(_0x544f48,_0x5a8283[_0x676a('0x3c')]['password'],_0x544f48[_0x676a('0x50')]);})['then'](function(){_0x37aabd[_0x676a('0x10')]=_0x5a8283[_0x676a('0x3c')][_0x676a('0x10')];_0x37aabd[_0x676a('0x44')]=null;_0x37aabd[_0x676a('0x45')]=null;return _0x37aabd[_0x676a('0x51')]();})[_0x676a('0xe')](function(){_0x4c3356[_0x676a('0x33')](0xc8)[_0x676a('0x34')]({'message':_0x676a('0x52')});})['catch'](function(_0x167a71){return handleError(_0x4c3356,0x1f4,_0x167a71);});};passport['use'](new LocalStrategy({'usernameField':_0x676a('0xf'),'passwordField':_0x676a('0x10')},function(_0x1fc4f1,_0x391b59,_0x2f7fb3){return localAuthenticate(db[_0x676a('0x41')],_0x1fc4f1,_0x391b59,_0x2f7fb3);})); \ No newline at end of file +var _0x6d24=['body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','Reset\x20Email\x20sent!','params','token','now','securePassword','password','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','disabled','blockedAt','minutes','getLicense','catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','login','local','signToken','online','forgot'];(function(_0xcff500,_0x5a4796){var _0x5df3d0=function(_0x372fb3){while(--_0x372fb3){_0xcff500['push'](_0xcff500['shift']());}};_0x5df3d0(++_0x5a4796);}(_0x6d24,0x119));var _0x46d2=function(_0x9e191a,_0xf223c){_0x9e191a=_0x9e191a-0x0;var _0x54bb11=_0x6d24[_0x9e191a];return _0x54bb11;};'use strict';var util=require(_0x46d2('0x0'));var passport=require(_0x46d2('0x1'));var LocalStrategy=require(_0x46d2('0x2'))[_0x46d2('0x3')];var jayson=require(_0x46d2('0x4'));var _=require(_0x46d2('0x5'));var rs=require(_0x46d2('0x6'));var moment=require(_0x46d2('0x7'));var db=require('../../mysqldb')['db'];var authService=require(_0x46d2('0x8'));var utils=require(_0x46d2('0x9'));var client=jayson[_0x46d2('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x1b40c3,_0x476218,_0x543ddb,_0x2363f9){var _0x43cf33,_0x46d0de;return db[_0x46d2('0xb')][_0x46d2('0xc')]({'where':{'id':0x1},'attributes':[_0x46d2('0xd'),_0x46d2('0xe')],'raw':!![]})[_0x46d2('0xf')](function(_0xfeed39){_0x43cf33=_0xfeed39;return _0x1b40c3[_0x46d2('0xc')]({'attributes':['id',_0x46d2('0x10'),'password',_0x46d2('0x11'),_0x46d2('0x12'),'disabled',_0x46d2('0x13'),'blockedAt',_0x46d2('0x14')],'where':{'name':_0x476218,'role':{'$or':[_0x46d2('0x15'),_0x46d2('0x16'),_0x46d2('0x17')]}}});})['then'](function(_0xe9ec8a){if(!_0xe9ec8a||_0xe9ec8a&&_0xe9ec8a[_0x46d2('0x10')]!==_0x476218){throw new Error(_0x46d2('0x18'));}else{_0x46d0de=_0xe9ec8a;return _0x46d0de;}})['then'](function(){_0x46d0de[_0x46d2('0x19')](_0x543ddb,function(_0x2d5da5,_0x5cf13d){var _0x3c4bd5=_0x46d0de[_0x46d2('0x14')]+0x1;if(_0x2d5da5){return _0x2363f9(_0x2d5da5);}else if(!_0x5cf13d){if(_0x46d0de['disabled']){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});}else if(_0x43cf33['allowedLoginAttempts']>0x0){if(_0x46d0de['blocked']){if(_0x43cf33[_0x46d2('0xe')]>0x0){if(moment(_0x46d0de['blockedAt'])[_0x46d2('0x1a')](_0x43cf33[_0x46d2('0xe')],'minutes')>moment()){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});}else{return utils['clearBlockUser'](_0x46d0de,_0x3c4bd5,![],null)['then'](function(){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});});}}else{return _0x2363f9(null,![],{'message':_0x46d2('0x18')});}}else{if(_0x3c4bd5>=_0x43cf33[_0x46d2('0xd')]){return utils[_0x46d2('0x1b')](_0x46d0de,0x0,!![],moment())[_0x46d2('0xf')](function(){return _0x2363f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x46d0de,_0x3c4bd5,![],null)[_0x46d2('0xf')](function(){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});});}}}else{return _0x2363f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x46d0de[_0x46d2('0x1c')]){return _0x2363f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x43cf33[_0x46d2('0xd')]>0x0){if(_0x46d0de[_0x46d2('0x13')]){if(_0x43cf33[_0x46d2('0xe')]>0x0){if(moment(_0x46d0de[_0x46d2('0x1d')])[_0x46d2('0x1a')](_0x43cf33[_0x46d2('0xe')],_0x46d2('0x1e'))>moment()){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});}else{return utils[_0x46d2('0x1b')](_0x46d0de,0x0,![],null)[_0x46d2('0xf')](function(){return utils[_0x46d2('0x1f')](_0x46d0de);})[_0x46d2('0xf')](function(){return _0x2363f9(null,_0x46d0de);});}}else{return _0x2363f9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x46d2('0x1b')](_0x46d0de,0x0,![],null)[_0x46d2('0xf')](function(){return utils['getLicense'](_0x46d0de);})[_0x46d2('0xf')](function(){return _0x2363f9(null,_0x46d0de);})[_0x46d2('0x20')](function(_0x2e06db){return _0x2363f9(null,![],_0x2e06db);});}}else{if(_0x46d0de[_0x46d2('0x13')]){return _0x2363f9(null,![],{'message':_0x46d2('0x18')});}else{return utils['getLicense'](_0x46d0de)[_0x46d2('0xf')](function(){return _0x2363f9(null,_0x46d0de);});}}}});})['catch'](function(_0x3b021c){return _0x2363f9(null,![],_0x3b021c);});}function sendServiceMail(_0x589915){return db[_0x46d2('0x21')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x46d2('0x22')],'include':[{'model':db[_0x46d2('0x23')],'as':_0x46d2('0x24')}]})['then'](function(_0x5612c4){if(!_0x5612c4){throw new Error(_0x46d2('0x25'));}var _0x1db751={'tls':{'rejectUnauthorized':![]}};if(_0x5612c4[_0x46d2('0x24')][_0x46d2('0x26')]){_0x1db751[_0x46d2('0x26')]=_0x5612c4[_0x46d2('0x24')]['service'];}else{_0x1db751[_0x46d2('0x27')]=_0x5612c4[_0x46d2('0x24')][_0x46d2('0x27')];_0x1db751['port']=_0x5612c4['Smtp'][_0x46d2('0x28')];_0x1db751['secure']=_0x5612c4['Smtp'][_0x46d2('0x29')];}if(_0x5612c4[_0x46d2('0x24')]['authentication']){_0x1db751[_0x46d2('0x2a')]={'user':_0x5612c4[_0x46d2('0x24')][_0x46d2('0x16')],'pass':_0x5612c4['Smtp']['pass']};}var _0xea9d92={'account':_0x1db751,'message':_[_0x46d2('0x2b')]({'from':util[_0x46d2('0x2c')]('\x22%s\x22\x20<%s>',_0x5612c4[_0x46d2('0x10')],_0x5612c4[_0x46d2('0x22')]||_0x5612c4[_0x46d2('0x24')][_0x46d2('0x16')])},_0x589915)};return client[_0x46d2('0x2d')](_0x46d2('0x2e'),_0xea9d92);})['then'](function(_0x5584b7){if(_0x5584b7[_0x46d2('0x2f')]){throw new Error(util[_0x46d2('0x2c')](_0x46d2('0x30'),_0x5584b7[_0x46d2('0x2f')][_0x46d2('0x31')]||JSON[_0x46d2('0x32')](_0x5584b7[_0x46d2('0x2f')])));}return!![];});}function handleError(_0xd13335,_0x305be4,_0x4f4731){return _0xd13335[_0x46d2('0x33')](_0x305be4||0x1f4)[_0x46d2('0x34')]({'message':_0x4f4731?_0x4f4731[_0x46d2('0x31')]||_0x4f4731:''});}function checkPasswordPattern(_0x1461f2,_0x23d0b6,_0x267120){if(_0x267120){var _0x159df8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x159df8[_0x46d2('0x35')](_0x23d0b6)){return _0x1461f2;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1461f2;}}exports[_0x46d2('0x36')]=function(_0x35684c,_0x1f9b6d,_0x4b1284){passport[_0x46d2('0x19')](_0x46d2('0x37'),function(_0x37f260,_0xb32a5f,_0x1fcf10){var _0xae5452=_0x37f260||_0x1fcf10;if(_0xae5452){return handleError(_0x1f9b6d,0x191,_0xae5452);}if(!_0xb32a5f){return handleError(_0x1f9b6d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2b8076={'payload':{'id':_0xb32a5f['id'],'role':_0xb32a5f['role']},'options':{'expiresIn':0x15180}};return authService[_0x46d2('0x38')](_0x2b8076)[_0x46d2('0xf')](function(_0x4e359e){_0x1f9b6d['json']({'id':_0xb32a5f['id'],'token':_0x4e359e,'statusCall':'','isAlreadyLogged':_0xb32a5f[_0x46d2('0x39')]});});}})(_0x35684c,_0x1f9b6d,_0x4b1284);};exports[_0x46d2('0x3a')]=function(_0xff3e2,_0x3ff86c,_0x59aa4f){if(!_0xff3e2[_0x46d2('0x3b')][_0x46d2('0x22')]){return handleError(_0x3ff86c,0x1f4,{'message':_0x46d2('0x3c')});}var _0x1e0354=rs[_0x46d2('0x3d')]();_0xff3e2[_0x46d2('0x3b')]['email']=_0xff3e2['body'][_0x46d2('0x22')][_0x46d2('0x3e')]()[_0x46d2('0x3f')]();var _0x4e68e7;return db[_0x46d2('0xb')][_0x46d2('0xc')]({'where':{'id':0x1},'attributes':[_0x46d2('0xd'),_0x46d2('0xe')],'raw':!![]})[_0x46d2('0xf')](function(_0xba069d){_0x4e68e7=_0xba069d;return db[_0x46d2('0x40')][_0x46d2('0x41')]({'where':{'email':_0xff3e2['body'][_0x46d2('0x22')]}});})['then'](function(_0x525a25){if(!_0x525a25){throw new Error(_0x46d2('0x42'));}if(_0x525a25['disabled']){throw new Error(_0x46d2('0x43'));}if(_0x525a25[_0x46d2('0x13')]){if(moment(_0x525a25[_0x46d2('0x1d')])[_0x46d2('0x1a')](_0x4e68e7['blockDuration'],_0x46d2('0x1e'))>moment()){throw new Error(_0x46d2('0x44'));}else{_0x525a25[_0x46d2('0x13')]=![];_0x525a25[_0x46d2('0x1d')]=null;}}_0x525a25[_0x46d2('0x45')]=_0x1e0354;_0x525a25[_0x46d2('0x46')]=Date['now']()+0x36ee80;return _0x525a25['save']();})[_0x46d2('0xf')](function(){return sendServiceMail({'to':_0xff3e2[_0x46d2('0x3b')]['email'],'subject':_0x46d2('0x47'),'text':_0x46d2('0x48')+_0x46d2('0x49')+_0x46d2('0x4a')+_0xff3e2[_0x46d2('0x4b')][_0x46d2('0x27')]+_0x46d2('0x4c')+_0x1e0354+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x46d2('0xf')](function(){_0x3ff86c[_0x46d2('0x33')](0xc8)[_0x46d2('0x34')]({'message':_0x46d2('0x4d')});})[_0x46d2('0x20')](function(_0x571a42){return handleError(_0x3ff86c,0x1f4,_0x571a42);});};exports['reset']=function(_0x54b1b9,_0x456afc,_0x18d3b7){var _0x33fd31;return db[_0x46d2('0x40')][_0x46d2('0x41')]({'where':{'resetPasswordToken':_0x54b1b9[_0x46d2('0x4e')][_0x46d2('0x4f')],'resetPasswordExpires':{'$gt':Date[_0x46d2('0x50')]()}}})['then'](function(_0x572525){_0x33fd31=_0x572525;if(!_0x33fd31){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x46d2('0xb')][_0x46d2('0xc')]({'attributes':['id',_0x46d2('0x51')]});})[_0x46d2('0xf')](function(_0x518fb9){return checkPasswordPattern(_0x518fb9,_0x54b1b9['body']['password'],_0x518fb9[_0x46d2('0x51')]);})[_0x46d2('0xf')](function(){_0x33fd31[_0x46d2('0x52')]=_0x54b1b9[_0x46d2('0x3b')][_0x46d2('0x52')];_0x33fd31[_0x46d2('0x45')]=null;_0x33fd31[_0x46d2('0x46')]=null;return _0x33fd31['save']();})[_0x46d2('0xf')](function(){_0x456afc[_0x46d2('0x33')](0xc8)[_0x46d2('0x34')]({'message':_0x46d2('0x53')});})[_0x46d2('0x20')](function(_0x36aa0f){return handleError(_0x456afc,0x1f4,_0x36aa0f);});};passport[_0x46d2('0x54')](new LocalStrategy({'usernameField':_0x46d2('0x10'),'passwordField':_0x46d2('0x52')},function(_0x557beb,_0x1f2219,_0x5a6cd7){return localAuthenticate(db[_0x46d2('0x40')],_0x557beb,_0x1f2219,_0x5a6cd7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b2f9c90..b99c908 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 _0x9df1=['forgot','/reset/:token','reset','exports','express','Router','post','/forgot'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9df1,0x1b4));var _0x19df=function(_0x1638b5,_0x4f4e68){_0x1638b5=_0x1638b5-0x0;var _0x7cfb20=_0x9df1[_0x1638b5];return _0x7cfb20;};'use strict';var express=require(_0x19df('0x0'));var router=express[_0x19df('0x1')]();var controller=require('./authLocal.controller');router[_0x19df('0x2')]('/',controller['login']);router['post'](_0x19df('0x3'),controller[_0x19df('0x4')]);router[_0x19df('0x2')](_0x19df('0x5'),controller[_0x19df('0x6')]);module[_0x19df('0x7')]=router; \ No newline at end of file +var _0xa339=['./authLocal.controller','post','login','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa339,0x85));var _0x9a33=function(_0x1b21ff,_0x217fcb){_0x1b21ff=_0x1b21ff-0x0;var _0xd3cb46=_0xa339[_0x1b21ff];return _0xd3cb46;};'use strict';var express=require(_0x9a33('0x0'));var router=express[_0x9a33('0x1')]();var controller=require(_0x9a33('0x2'));router[_0x9a33('0x3')]('/',controller[_0x9a33('0x4')]);router[_0x9a33('0x3')]('/forgot',controller[_0x9a33('0x5')]);router[_0x9a33('0x3')](_0x9a33('0x6'),controller[_0x9a33('0x7')]);module[_0x9a33('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4b9372c..cd27861 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 _0x84e6=['exports','STRING','BOOLEAN'];(function(_0x2054be,_0x1032d6){var _0xf49252=function(_0x5743e9){while(--_0x5743e9){_0x2054be['push'](_0x2054be['shift']());}};_0xf49252(++_0x1032d6);}(_0x84e6,0x1a4));var _0x684e=function(_0x229432,_0x59da9a){_0x229432=_0x229432-0x0;var _0x4d3584=_0x84e6[_0x229432];return _0x4d3584;};'use strict';var Sequelize=require('sequelize');module[_0x684e('0x0')]={'name':{'type':Sequelize[_0x684e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x684e('0x1')]},'description':{'type':Sequelize[_0x684e('0x1')]},'status':{'type':Sequelize[_0x684e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x4716=['exports','STRING','sequelize'];(function(_0x427d33,_0x2653df){var _0x1582de=function(_0x2fc792){while(--_0x2fc792){_0x427d33['push'](_0x427d33['shift']());}};_0x1582de(++_0x2653df);}(_0x4716,0xa7));var _0x6471=function(_0x3d2761,_0x2696bf){_0x3d2761=_0x3d2761-0x0;var _0x531ae9=_0x4716[_0x3d2761];return _0x531ae9;};'use strict';var Sequelize=require(_0x6471('0x0'));module[_0x6471('0x1')]={'name':{'type':Sequelize[_0x6471('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6471('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index b5f75ad..1c8ff98 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 _0xca56=['hasOwnProperty','nolimit','limit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','addConditions','Condition','ids','omit','findOne','sort','options','getConditions','addActions','Action','getActions','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','index','map','Automation','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length'];(function(_0x32b808,_0x42f040){var _0x14a0ea=function(_0x13e4fa){while(--_0x13e4fa){_0x32b808['push'](_0x32b808['shift']());}};_0x14a0ea(++_0x42f040);}(_0xca56,0x109));var _0x6ca5=function(_0x151681,_0x557bc3){_0x151681=_0x151681-0x0;var _0x4315bb=_0xca56[_0x151681];return _0x4315bb;};'use strict';var pdf=require(_0x6ca5('0x0'));var emlformat=require(_0x6ca5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ca5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ca5('0x3'));var Mustache=require(_0x6ca5('0x4'));var util=require(_0x6ca5('0x5'));var path=require(_0x6ca5('0x6'));var sox=require('sox');var csv=require(_0x6ca5('0x7'));var ejs=require(_0x6ca5('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ca5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ca5('0xa'));var toCsv=require(_0x6ca5('0x7'));var querystring=require(_0x6ca5('0xb'));var Papa=require(_0x6ca5('0xc'));var Redis=require(_0x6ca5('0xd'));var authService=require(_0x6ca5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6ca5('0xf'));var hardwareService=require(_0x6ca5('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x6ca5('0x11'));var config=require('../../config/environment');var db=require(_0x6ca5('0x12'))['db'];function respondWithStatusCode(_0x21c50b,_0x16ea63){_0x16ea63=_0x16ea63||0xcc;return function(_0x1327de){if(_0x1327de){return _0x21c50b['sendStatus'](_0x16ea63);}return _0x21c50b[_0x6ca5('0x13')](_0x16ea63)[_0x6ca5('0x14')]();};}function respondWithResult(_0x575240,_0x29af15){_0x29af15=_0x29af15||0xc8;return function(_0x55cde0){if(_0x55cde0){return _0x575240['status'](_0x29af15)['json'](_0x55cde0);}};}function respondWithFilteredResult(_0x5ca020,_0x57ea7c){return function(_0x4ddbc1){if(_0x4ddbc1){var _0x565b32=_0x4ddbc1[_0x6ca5('0x15')],_0x2b7ac2=_0x57ea7c[_0x6ca5('0x16')],_0x6ef4b6=_0x57ea7c[_0x6ca5('0x16')]+_0x57ea7c['limit'],_0x17c74c;if(_0x6ef4b6>=_0x565b32){_0x6ef4b6=_0x565b32;_0x17c74c=0xc8;}else{_0x17c74c=0xce;}_0x5ca020[_0x6ca5('0x13')](_0x17c74c);return _0x5ca020['set'](_0x6ca5('0x17'),_0x2b7ac2+'-'+_0x6ef4b6+'/'+_0x565b32)['json'](_0x4ddbc1);}return null;};}function patchUpdates(_0x198772){return function(_0x1a1caf){try{jsonpatch[_0x6ca5('0x18')](_0x1a1caf,_0x198772,!![]);}catch(_0x17984b){return BPromise[_0x6ca5('0x19')](_0x17984b);}return _0x1a1caf[_0x6ca5('0x1a')]();};}function saveUpdates(_0xb382b7,_0x582d9d){return function(_0x4ad925){if(_0x4ad925){return _0x4ad925[_0x6ca5('0x1b')](_0xb382b7)[_0x6ca5('0x1c')](function(_0x208129){return _0x208129;});}return null;};}function removeEntity(_0x347572,_0x432a48){return function(_0x1806b3){if(_0x1806b3){return _0x1806b3['destroy']()[_0x6ca5('0x1c')](function(){_0x347572['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bd130,_0x2e1da5){return function(_0x216d5a){if(!_0x216d5a){_0x2bd130[_0x6ca5('0x1d')](0x194);}return _0x216d5a;};}function handleError(_0x2fc9db,_0x8203d0){_0x8203d0=_0x8203d0||0x1f4;return function(_0x219b20){logger[_0x6ca5('0x1e')](_0x219b20[_0x6ca5('0x1f')]);if(_0x219b20['name']){delete _0x219b20['name'];}_0x2fc9db[_0x6ca5('0x13')](_0x8203d0)['send'](_0x219b20);};}exports[_0x6ca5('0x20')]=function(_0x298224,_0xbb0b6){var _0xf2ea6f={},_0x4bc196={},_0x30658b={'count':0x0,'rows':[]};var _0xe7e45b=_[_0x6ca5('0x21')](db[_0x6ca5('0x22')][_0x6ca5('0x23')],function(_0x38b135){return{'name':_0x38b135[_0x6ca5('0x24')],'type':_0x38b135[_0x6ca5('0x25')][_0x6ca5('0x26')]};});_0x4bc196[_0x6ca5('0x27')]=_['map'](_0xe7e45b,_0x6ca5('0x28'));_0x4bc196[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0x298224[_0x6ca5('0x29')]);_0x4bc196['filters']=_[_0x6ca5('0x2b')](_0x4bc196['model'],_0x4bc196[_0x6ca5('0x29')]);_0xf2ea6f[_0x6ca5('0x2c')]=_['intersection'](_0x4bc196[_0x6ca5('0x27')],qs['fields'](_0x298224['query'][_0x6ca5('0x2d')]));_0xf2ea6f[_0x6ca5('0x2c')]=_0xf2ea6f[_0x6ca5('0x2c')][_0x6ca5('0x2e')]?_0xf2ea6f['attributes']:_0x4bc196['model'];if(!_0x298224[_0x6ca5('0x29')][_0x6ca5('0x2f')](_0x6ca5('0x30'))){_0xf2ea6f[_0x6ca5('0x31')]=qs[_0x6ca5('0x31')](_0x298224[_0x6ca5('0x29')][_0x6ca5('0x31')]);_0xf2ea6f['offset']=qs[_0x6ca5('0x16')](_0x298224[_0x6ca5('0x29')][_0x6ca5('0x16')]);}_0xf2ea6f[_0x6ca5('0x32')]=qs['sort'](_0x298224[_0x6ca5('0x29')]['sort']);_0xf2ea6f['where']=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0x298224[_0x6ca5('0x29')],_0x4bc196[_0x6ca5('0x33')]),_0xe7e45b);if(_0x298224[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0xf2ea6f[_0x6ca5('0x36')]=_[_0x6ca5('0x37')](_0xf2ea6f[_0x6ca5('0x36')],{'$or':_['map'](_0xe7e45b,function(_0x6d990e){if(_0x6d990e[_0x6ca5('0x25')]!==_0x6ca5('0x38')){var _0x26c901={};_0x26c901[_0x6d990e[_0x6ca5('0x28')]]={'$like':'%'+_0x298224['query'][_0x6ca5('0x35')]+'%'};return _0x26c901;}})});}_0xf2ea6f=_[_0x6ca5('0x37')]({},_0xf2ea6f,_0x298224['options']);var _0x37c99c={'where':_0xf2ea6f[_0x6ca5('0x36')]};return db['Automation'][_0x6ca5('0x15')](_0x37c99c)[_0x6ca5('0x1c')](function(_0x5d2a07){_0x30658b[_0x6ca5('0x15')]=_0x5d2a07;if(_0x298224[_0x6ca5('0x29')][_0x6ca5('0x39')]){_0xf2ea6f['include']=[{'all':!![]}];}return db[_0x6ca5('0x22')][_0x6ca5('0x3a')](_0xf2ea6f);})['then'](function(_0x80e40){_0x30658b[_0x6ca5('0x3b')]=_0x80e40;return _0x30658b;})['then'](respondWithFilteredResult(_0xbb0b6,_0xf2ea6f))[_0x6ca5('0x3c')](handleError(_0xbb0b6,null));};exports['show']=function(_0x52e8de,_0x29d085){var _0x26a199={'raw':![],'where':{'id':_0x52e8de[_0x6ca5('0x3d')]['id']}},_0x31f3cf={};_0x31f3cf[_0x6ca5('0x27')]=_[_0x6ca5('0x2a')](db[_0x6ca5('0x22')][_0x6ca5('0x23')]);_0x31f3cf[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0x52e8de['query']);_0x31f3cf['filters']=_[_0x6ca5('0x2b')](_0x31f3cf['model'],_0x31f3cf['query']);_0x26a199[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x31f3cf[_0x6ca5('0x27')],qs[_0x6ca5('0x2d')](_0x52e8de[_0x6ca5('0x29')][_0x6ca5('0x2d')]));_0x26a199[_0x6ca5('0x2c')]=_0x26a199['attributes'][_0x6ca5('0x2e')]?_0x26a199[_0x6ca5('0x2c')]:_0x31f3cf[_0x6ca5('0x27')];if(_0x52e8de['query'][_0x6ca5('0x39')]){_0x26a199[_0x6ca5('0x3e')]=[{'all':!![]}];}_0x26a199=_['merge']({},_0x26a199,_0x52e8de['options']);return db[_0x6ca5('0x22')][_0x6ca5('0x3f')](_0x26a199)[_0x6ca5('0x1c')](handleEntityNotFound(_0x29d085,null))[_0x6ca5('0x1c')](respondWithResult(_0x29d085,null))[_0x6ca5('0x3c')](handleError(_0x29d085,null));};exports[_0x6ca5('0x40')]=function(_0x3be20a,_0x5ee2f8){return db['Automation'][_0x6ca5('0x40')](_0x3be20a[_0x6ca5('0x41')],{})[_0x6ca5('0x1c')](respondWithResult(_0x5ee2f8,0xc9))['catch'](handleError(_0x5ee2f8,null));};exports[_0x6ca5('0x1b')]=function(_0x598c3b,_0x29052f){if(_0x598c3b[_0x6ca5('0x41')]['id']){delete _0x598c3b['body']['id'];}return db[_0x6ca5('0x22')][_0x6ca5('0x3f')]({'where':{'id':_0x598c3b[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x29052f,null))[_0x6ca5('0x1c')](saveUpdates(_0x598c3b[_0x6ca5('0x41')],null))['then'](respondWithResult(_0x29052f,null))['catch'](handleError(_0x29052f,null));};exports[_0x6ca5('0x42')]=function(_0x50bec5,_0x1ac8a9){return db[_0x6ca5('0x22')]['find']({'where':{'id':_0x50bec5[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x1ac8a9,null))[_0x6ca5('0x1c')](removeEntity(_0x1ac8a9,null))[_0x6ca5('0x3c')](handleError(_0x1ac8a9,null));};exports[_0x6ca5('0x43')]=function(_0x349fea,_0x5069cc,_0x1f9e2a){return db[_0x6ca5('0x44')][_0x6ca5('0x3f')]({'where':{'id':_0x349fea['params']['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x5069cc,null))[_0x6ca5('0x1c')](function(_0x3c8f92){if(_0x3c8f92){return _0x3c8f92[_0x6ca5('0x43')](_0x349fea['body'][_0x6ca5('0x45')],_[_0x6ca5('0x46')](_0x349fea[_0x6ca5('0x41')],[_0x6ca5('0x45'),'id'])||{});}})[_0x6ca5('0x1c')](respondWithResult(_0x5069cc,null))[_0x6ca5('0x3c')](handleError(_0x5069cc,null));};exports['getConditions']=function(_0x28f1b4,_0x3152ed,_0x735814){var _0x2cae43={};var _0x321f28={};var _0x30b1da;var _0x5a2cb4;return db[_0x6ca5('0x22')][_0x6ca5('0x47')]({'where':{'id':_0x28f1b4['params']['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x3152ed,null))[_0x6ca5('0x1c')](function(_0x4844c5){if(_0x4844c5){_0x30b1da=_0x4844c5;_0x321f28[_0x6ca5('0x27')]=_['keys'](db[_0x6ca5('0x44')][_0x6ca5('0x23')]);_0x321f28['query']=_['keys'](_0x28f1b4[_0x6ca5('0x29')]);_0x321f28[_0x6ca5('0x33')]=_[_0x6ca5('0x2b')](_0x321f28[_0x6ca5('0x27')],_0x321f28[_0x6ca5('0x29')]);_0x2cae43[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x321f28[_0x6ca5('0x27')],qs['fields'](_0x28f1b4['query'][_0x6ca5('0x2d')]));_0x2cae43[_0x6ca5('0x2c')]=_0x2cae43['attributes'][_0x6ca5('0x2e')]?_0x2cae43[_0x6ca5('0x2c')]:_0x321f28[_0x6ca5('0x27')];_0x2cae43[_0x6ca5('0x32')]=qs[_0x6ca5('0x48')](_0x28f1b4[_0x6ca5('0x29')]['sort']);_0x2cae43[_0x6ca5('0x36')]=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0x28f1b4[_0x6ca5('0x29')],_0x321f28[_0x6ca5('0x33')]));if(_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0x2cae43[_0x6ca5('0x36')]=_[_0x6ca5('0x37')](_0x2cae43['where'],{'$or':_[_0x6ca5('0x21')](_0x2cae43[_0x6ca5('0x2c')],function(_0x456800){var _0xa5011={};_0xa5011[_0x456800]={'$like':'%'+_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x35')]+'%'};return _0xa5011;})});}_0x2cae43=_[_0x6ca5('0x37')]({},_0x2cae43,_0x28f1b4[_0x6ca5('0x49')]);return _0x30b1da['getConditions'](_0x2cae43);}})['then'](function(_0x5b1d03){if(_0x5b1d03){_0x5a2cb4=_0x5b1d03[_0x6ca5('0x2e')];if(!_0x28f1b4[_0x6ca5('0x29')][_0x6ca5('0x2f')](_0x6ca5('0x30'))){_0x2cae43[_0x6ca5('0x31')]=qs[_0x6ca5('0x31')](_0x28f1b4['query']['limit']);_0x2cae43[_0x6ca5('0x16')]=qs[_0x6ca5('0x16')](_0x28f1b4['query']['offset']);}return _0x30b1da[_0x6ca5('0x4a')](_0x2cae43);}})[_0x6ca5('0x1c')](function(_0x12b44f){if(_0x12b44f){return _0x12b44f?{'count':_0x5a2cb4,'rows':_0x12b44f}:null;}})[_0x6ca5('0x1c')](respondWithResult(_0x3152ed,null))[_0x6ca5('0x3c')](handleError(_0x3152ed,null));};exports[_0x6ca5('0x4b')]=function(_0x5e83d5,_0x15abb4,_0x25e787){return db[_0x6ca5('0x4c')][_0x6ca5('0x3f')]({'where':{'id':_0x5e83d5['params']['id']}})['then'](handleEntityNotFound(_0x15abb4,null))['then'](function(_0x6f666d){if(_0x6f666d){return _0x6f666d[_0x6ca5('0x4b')](_0x5e83d5[_0x6ca5('0x41')][_0x6ca5('0x45')],_[_0x6ca5('0x46')](_0x5e83d5[_0x6ca5('0x41')],[_0x6ca5('0x45'),'id'])||{});}})['then'](respondWithResult(_0x15abb4,null))[_0x6ca5('0x3c')](handleError(_0x15abb4,null));};exports[_0x6ca5('0x4d')]=function(_0xab2454,_0x171c70,_0x1e8273){var _0x18b72a={};var _0x214309={};var _0x37ba80;var _0x332089;return db[_0x6ca5('0x22')][_0x6ca5('0x47')]({'where':{'id':_0xab2454[_0x6ca5('0x3d')]['id']}})[_0x6ca5('0x1c')](handleEntityNotFound(_0x171c70,null))[_0x6ca5('0x1c')](function(_0x4dfa70){if(_0x4dfa70){_0x37ba80=_0x4dfa70;_0x214309[_0x6ca5('0x27')]=_[_0x6ca5('0x2a')](db[_0x6ca5('0x4c')][_0x6ca5('0x23')]);_0x214309[_0x6ca5('0x29')]=_[_0x6ca5('0x2a')](_0xab2454[_0x6ca5('0x29')]);_0x214309[_0x6ca5('0x33')]=_[_0x6ca5('0x2b')](_0x214309[_0x6ca5('0x27')],_0x214309[_0x6ca5('0x29')]);_0x18b72a[_0x6ca5('0x2c')]=_[_0x6ca5('0x2b')](_0x214309['model'],qs['fields'](_0xab2454['query']['fields']));_0x18b72a[_0x6ca5('0x2c')]=_0x18b72a[_0x6ca5('0x2c')]['length']?_0x18b72a['attributes']:_0x214309[_0x6ca5('0x27')];_0x18b72a[_0x6ca5('0x32')]=qs[_0x6ca5('0x48')](_0xab2454[_0x6ca5('0x29')]['sort']);_0x18b72a[_0x6ca5('0x36')]=qs[_0x6ca5('0x33')](_[_0x6ca5('0x34')](_0xab2454[_0x6ca5('0x29')],_0x214309['filters']));if(_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x35')]){_0x18b72a[_0x6ca5('0x36')]=_['merge'](_0x18b72a[_0x6ca5('0x36')],{'$or':_[_0x6ca5('0x21')](_0x18b72a[_0x6ca5('0x2c')],function(_0xbcd676){var _0x1b8cfe={};_0x1b8cfe[_0xbcd676]={'$like':'%'+_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x35')]+'%'};return _0x1b8cfe;})});}_0x18b72a=_[_0x6ca5('0x37')]({},_0x18b72a,_0xab2454['options']);return _0x37ba80['getActions'](_0x18b72a);}})[_0x6ca5('0x1c')](function(_0xab5eea){if(_0xab5eea){_0x332089=_0xab5eea[_0x6ca5('0x2e')];if(!_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x2f')]('nolimit')){_0x18b72a['limit']=qs['limit'](_0xab2454['query'][_0x6ca5('0x31')]);_0x18b72a[_0x6ca5('0x16')]=qs[_0x6ca5('0x16')](_0xab2454[_0x6ca5('0x29')][_0x6ca5('0x16')]);}return _0x37ba80['getActions'](_0x18b72a);}})[_0x6ca5('0x1c')](function(_0x503ddf){if(_0x503ddf){return _0x503ddf?{'count':_0x332089,'rows':_0x503ddf}:null;}})[_0x6ca5('0x1c')](respondWithResult(_0x171c70,null))['catch'](handleError(_0x171c70,null));}; \ No newline at end of file +var _0xceb6=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','error','name','send','index','map','Automation','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','Condition','addConditions','ids','omit','getConditions','findOne','rawAttributes','order','sort','addActions','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x193461,_0x49ef3e){var _0xb657af=function(_0x97be87){while(--_0x97be87){_0x193461['push'](_0x193461['shift']());}};_0xb657af(++_0x49ef3e);}(_0xceb6,0xe8));var _0x6ceb=function(_0x56367b,_0x254a10){_0x56367b=_0x56367b-0x0;var _0x144f8c=_0xceb6[_0x56367b];return _0x144f8c;};'use strict';var pdf=require(_0x6ceb('0x0'));var emlformat=require(_0x6ceb('0x1'));var rimraf=require(_0x6ceb('0x2'));var zipdir=require(_0x6ceb('0x3'));var jsonpatch=require(_0x6ceb('0x4'));var rp=require(_0x6ceb('0x5'));var moment=require(_0x6ceb('0x6'));var BPromise=require(_0x6ceb('0x7'));var Mustache=require(_0x6ceb('0x8'));var util=require(_0x6ceb('0x9'));var path=require(_0x6ceb('0xa'));var sox=require('sox');var csv=require(_0x6ceb('0xb'));var ejs=require(_0x6ceb('0xc'));var fs=require('fs');var _=require(_0x6ceb('0xd'));var squel=require('squel');var crypto=require(_0x6ceb('0xe'));var jsforce=require(_0x6ceb('0xf'));var deskjs=require(_0x6ceb('0x10'));var toCsv=require(_0x6ceb('0xb'));var querystring=require(_0x6ceb('0x11'));var Papa=require(_0x6ceb('0x12'));var Redis=require(_0x6ceb('0x13'));var authService=require(_0x6ceb('0x14'));var qs=require(_0x6ceb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ceb('0x16'))(_0x6ceb('0x17'));var utils=require(_0x6ceb('0x18'));var config=require(_0x6ceb('0x19'));var db=require(_0x6ceb('0x1a'))['db'];function respondWithStatusCode(_0x46c253,_0x1f58d1){_0x1f58d1=_0x1f58d1||0xcc;return function(_0xc4354){if(_0xc4354){return _0x46c253[_0x6ceb('0x1b')](_0x1f58d1);}return _0x46c253[_0x6ceb('0x1c')](_0x1f58d1)[_0x6ceb('0x1d')]();};}function respondWithResult(_0x3320e1,_0x42e76e){_0x42e76e=_0x42e76e||0xc8;return function(_0x74b40f){if(_0x74b40f){return _0x3320e1['status'](_0x42e76e)[_0x6ceb('0x1e')](_0x74b40f);}};}function respondWithFilteredResult(_0x17f33e,_0x295e15){return function(_0x3ce2d5){if(_0x3ce2d5){var _0x2b5770=_0x3ce2d5[_0x6ceb('0x1f')],_0x47371f=_0x295e15[_0x6ceb('0x20')],_0x52bf46=_0x295e15[_0x6ceb('0x20')]+_0x295e15[_0x6ceb('0x21')],_0x4a3d34;if(_0x52bf46>=_0x2b5770){_0x52bf46=_0x2b5770;_0x4a3d34=0xc8;}else{_0x4a3d34=0xce;}_0x17f33e[_0x6ceb('0x1c')](_0x4a3d34);return _0x17f33e[_0x6ceb('0x22')]('Content-Range',_0x47371f+'-'+_0x52bf46+'/'+_0x2b5770)[_0x6ceb('0x1e')](_0x3ce2d5);}return null;};}function patchUpdates(_0x1c8764){return function(_0x50902a){try{jsonpatch['apply'](_0x50902a,_0x1c8764,!![]);}catch(_0xf129dc){return BPromise[_0x6ceb('0x23')](_0xf129dc);}return _0x50902a[_0x6ceb('0x24')]();};}function saveUpdates(_0xbfbae6,_0x5c031b){return function(_0x290394){if(_0x290394){return _0x290394['update'](_0xbfbae6)[_0x6ceb('0x25')](function(_0x57c2fb){return _0x57c2fb;});}return null;};}function removeEntity(_0x201665,_0x4b4704){return function(_0x2e3c3d){if(_0x2e3c3d){return _0x2e3c3d['destroy']()['then'](function(){_0x201665[_0x6ceb('0x1c')](0xcc)[_0x6ceb('0x1d')]();});}};}function handleEntityNotFound(_0x3262f9,_0x411a39){return function(_0x3c4b44){if(!_0x3c4b44){_0x3262f9[_0x6ceb('0x1b')](0x194);}return _0x3c4b44;};}function handleError(_0x492294,_0x1d07e1){_0x1d07e1=_0x1d07e1||0x1f4;return function(_0x1968e){logger[_0x6ceb('0x26')](_0x1968e['stack']);if(_0x1968e[_0x6ceb('0x27')]){delete _0x1968e[_0x6ceb('0x27')];}_0x492294['status'](_0x1d07e1)[_0x6ceb('0x28')](_0x1968e);};}exports[_0x6ceb('0x29')]=function(_0x1ae7cc,_0x31af5f){var _0x55e8d4={},_0xe62a59={},_0x21a554={'count':0x0,'rows':[]};var _0x32cbdc=_[_0x6ceb('0x2a')](db[_0x6ceb('0x2b')]['rawAttributes'],function(_0x487ba1){return{'name':_0x487ba1[_0x6ceb('0x2c')],'type':_0x487ba1[_0x6ceb('0x2d')]['key']};});_0xe62a59['model']=_[_0x6ceb('0x2a')](_0x32cbdc,_0x6ceb('0x27'));_0xe62a59[_0x6ceb('0x2e')]=_[_0x6ceb('0x2f')](_0x1ae7cc[_0x6ceb('0x2e')]);_0xe62a59[_0x6ceb('0x30')]=_[_0x6ceb('0x31')](_0xe62a59[_0x6ceb('0x32')],_0xe62a59[_0x6ceb('0x2e')]);_0x55e8d4[_0x6ceb('0x33')]=_[_0x6ceb('0x31')](_0xe62a59[_0x6ceb('0x32')],qs[_0x6ceb('0x34')](_0x1ae7cc[_0x6ceb('0x2e')][_0x6ceb('0x34')]));_0x55e8d4[_0x6ceb('0x33')]=_0x55e8d4[_0x6ceb('0x33')]['length']?_0x55e8d4[_0x6ceb('0x33')]:_0xe62a59[_0x6ceb('0x32')];if(!_0x1ae7cc['query'][_0x6ceb('0x35')](_0x6ceb('0x36'))){_0x55e8d4[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0x1ae7cc[_0x6ceb('0x2e')][_0x6ceb('0x21')]);_0x55e8d4['offset']=qs[_0x6ceb('0x20')](_0x1ae7cc['query'][_0x6ceb('0x20')]);}_0x55e8d4['order']=qs['sort'](_0x1ae7cc['query']['sort']);_0x55e8d4[_0x6ceb('0x37')]=qs[_0x6ceb('0x30')](_[_0x6ceb('0x38')](_0x1ae7cc[_0x6ceb('0x2e')],_0xe62a59['filters']),_0x32cbdc);if(_0x1ae7cc[_0x6ceb('0x2e')][_0x6ceb('0x39')]){_0x55e8d4[_0x6ceb('0x37')]=_[_0x6ceb('0x3a')](_0x55e8d4[_0x6ceb('0x37')],{'$or':_[_0x6ceb('0x2a')](_0x32cbdc,function(_0x10e6a0){if(_0x10e6a0[_0x6ceb('0x2d')]!=='VIRTUAL'){var _0x528bd3={};_0x528bd3[_0x10e6a0[_0x6ceb('0x27')]]={'$like':'%'+_0x1ae7cc[_0x6ceb('0x2e')][_0x6ceb('0x39')]+'%'};return _0x528bd3;}})});}_0x55e8d4=_['merge']({},_0x55e8d4,_0x1ae7cc[_0x6ceb('0x3b')]);var _0x4ebb9c={'where':_0x55e8d4['where']};return db[_0x6ceb('0x2b')]['count'](_0x4ebb9c)['then'](function(_0x5b48c5){_0x21a554['count']=_0x5b48c5;if(_0x1ae7cc[_0x6ceb('0x2e')][_0x6ceb('0x3c')]){_0x55e8d4[_0x6ceb('0x3d')]=[{'all':!![]}];}return db[_0x6ceb('0x2b')][_0x6ceb('0x3e')](_0x55e8d4);})['then'](function(_0x2a8117){_0x21a554[_0x6ceb('0x3f')]=_0x2a8117;return _0x21a554;})[_0x6ceb('0x25')](respondWithFilteredResult(_0x31af5f,_0x55e8d4))[_0x6ceb('0x40')](handleError(_0x31af5f,null));};exports[_0x6ceb('0x41')]=function(_0x2986d4,_0x540e8b){var _0x30698d={'raw':![],'where':{'id':_0x2986d4['params']['id']}},_0x9f5d32={};_0x9f5d32[_0x6ceb('0x32')]=_[_0x6ceb('0x2f')](db[_0x6ceb('0x2b')]['rawAttributes']);_0x9f5d32[_0x6ceb('0x2e')]=_[_0x6ceb('0x2f')](_0x2986d4[_0x6ceb('0x2e')]);_0x9f5d32[_0x6ceb('0x30')]=_[_0x6ceb('0x31')](_0x9f5d32[_0x6ceb('0x32')],_0x9f5d32['query']);_0x30698d['attributes']=_[_0x6ceb('0x31')](_0x9f5d32[_0x6ceb('0x32')],qs[_0x6ceb('0x34')](_0x2986d4[_0x6ceb('0x2e')][_0x6ceb('0x34')]));_0x30698d[_0x6ceb('0x33')]=_0x30698d[_0x6ceb('0x33')][_0x6ceb('0x42')]?_0x30698d[_0x6ceb('0x33')]:_0x9f5d32[_0x6ceb('0x32')];if(_0x2986d4[_0x6ceb('0x2e')][_0x6ceb('0x3c')]){_0x30698d[_0x6ceb('0x3d')]=[{'all':!![]}];}_0x30698d=_['merge']({},_0x30698d,_0x2986d4[_0x6ceb('0x3b')]);return db[_0x6ceb('0x2b')][_0x6ceb('0x43')](_0x30698d)[_0x6ceb('0x25')](handleEntityNotFound(_0x540e8b,null))['then'](respondWithResult(_0x540e8b,null))[_0x6ceb('0x40')](handleError(_0x540e8b,null));};exports[_0x6ceb('0x44')]=function(_0x341b2d,_0x311508){return db[_0x6ceb('0x2b')][_0x6ceb('0x44')](_0x341b2d[_0x6ceb('0x45')],{})[_0x6ceb('0x25')](respondWithResult(_0x311508,0xc9))[_0x6ceb('0x40')](handleError(_0x311508,null));};exports[_0x6ceb('0x46')]=function(_0xac0b46,_0x342894){if(_0xac0b46[_0x6ceb('0x45')]['id']){delete _0xac0b46[_0x6ceb('0x45')]['id'];}return db[_0x6ceb('0x2b')]['find']({'where':{'id':_0xac0b46['params']['id']}})[_0x6ceb('0x25')](handleEntityNotFound(_0x342894,null))['then'](saveUpdates(_0xac0b46[_0x6ceb('0x45')],null))['then'](respondWithResult(_0x342894,null))['catch'](handleError(_0x342894,null));};exports['destroy']=function(_0x2ef57b,_0x57b4f1){return db[_0x6ceb('0x2b')]['find']({'where':{'id':_0x2ef57b[_0x6ceb('0x47')]['id']}})['then'](handleEntityNotFound(_0x57b4f1,null))[_0x6ceb('0x25')](removeEntity(_0x57b4f1,null))[_0x6ceb('0x40')](handleError(_0x57b4f1,null));};exports['addConditions']=function(_0x2af605,_0x22ee9a,_0x309283){return db[_0x6ceb('0x48')][_0x6ceb('0x43')]({'where':{'id':_0x2af605[_0x6ceb('0x47')]['id']}})[_0x6ceb('0x25')](handleEntityNotFound(_0x22ee9a,null))[_0x6ceb('0x25')](function(_0x1d6070){if(_0x1d6070){return _0x1d6070[_0x6ceb('0x49')](_0x2af605['body'][_0x6ceb('0x4a')],_[_0x6ceb('0x4b')](_0x2af605[_0x6ceb('0x45')],[_0x6ceb('0x4a'),'id'])||{});}})[_0x6ceb('0x25')](respondWithResult(_0x22ee9a,null))[_0x6ceb('0x40')](handleError(_0x22ee9a,null));};exports[_0x6ceb('0x4c')]=function(_0x3b9713,_0x2c88e8,_0x3fbcab){var _0xf96953={};var _0x460b29={};var _0x2c5ac7;var _0x57db7b;return db[_0x6ceb('0x2b')][_0x6ceb('0x4d')]({'where':{'id':_0x3b9713[_0x6ceb('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c88e8,null))[_0x6ceb('0x25')](function(_0x3360f4){if(_0x3360f4){_0x2c5ac7=_0x3360f4;_0x460b29[_0x6ceb('0x32')]=_[_0x6ceb('0x2f')](db[_0x6ceb('0x48')][_0x6ceb('0x4e')]);_0x460b29[_0x6ceb('0x2e')]=_[_0x6ceb('0x2f')](_0x3b9713[_0x6ceb('0x2e')]);_0x460b29[_0x6ceb('0x30')]=_[_0x6ceb('0x31')](_0x460b29['model'],_0x460b29[_0x6ceb('0x2e')]);_0xf96953['attributes']=_[_0x6ceb('0x31')](_0x460b29[_0x6ceb('0x32')],qs[_0x6ceb('0x34')](_0x3b9713[_0x6ceb('0x2e')][_0x6ceb('0x34')]));_0xf96953[_0x6ceb('0x33')]=_0xf96953[_0x6ceb('0x33')][_0x6ceb('0x42')]?_0xf96953[_0x6ceb('0x33')]:_0x460b29[_0x6ceb('0x32')];_0xf96953[_0x6ceb('0x4f')]=qs['sort'](_0x3b9713['query'][_0x6ceb('0x50')]);_0xf96953[_0x6ceb('0x37')]=qs['filters'](_[_0x6ceb('0x38')](_0x3b9713[_0x6ceb('0x2e')],_0x460b29[_0x6ceb('0x30')]));if(_0x3b9713[_0x6ceb('0x2e')][_0x6ceb('0x39')]){_0xf96953[_0x6ceb('0x37')]=_[_0x6ceb('0x3a')](_0xf96953['where'],{'$or':_['map'](_0xf96953['attributes'],function(_0x97d9a5){var _0x318f55={};_0x318f55[_0x97d9a5]={'$like':'%'+_0x3b9713['query'][_0x6ceb('0x39')]+'%'};return _0x318f55;})});}_0xf96953=_[_0x6ceb('0x3a')]({},_0xf96953,_0x3b9713['options']);return _0x2c5ac7[_0x6ceb('0x4c')](_0xf96953);}})[_0x6ceb('0x25')](function(_0x1ba8a9){if(_0x1ba8a9){_0x57db7b=_0x1ba8a9['length'];if(!_0x3b9713[_0x6ceb('0x2e')][_0x6ceb('0x35')](_0x6ceb('0x36'))){_0xf96953[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0x3b9713[_0x6ceb('0x2e')]['limit']);_0xf96953[_0x6ceb('0x20')]=qs[_0x6ceb('0x20')](_0x3b9713[_0x6ceb('0x2e')][_0x6ceb('0x20')]);}return _0x2c5ac7[_0x6ceb('0x4c')](_0xf96953);}})[_0x6ceb('0x25')](function(_0x525806){if(_0x525806){return _0x525806?{'count':_0x57db7b,'rows':_0x525806}:null;}})['then'](respondWithResult(_0x2c88e8,null))[_0x6ceb('0x40')](handleError(_0x2c88e8,null));};exports[_0x6ceb('0x51')]=function(_0x391d8a,_0x43b4e5,_0x51cd27){return db['Action'][_0x6ceb('0x43')]({'where':{'id':_0x391d8a['params']['id']}})[_0x6ceb('0x25')](handleEntityNotFound(_0x43b4e5,null))[_0x6ceb('0x25')](function(_0x41de3b){if(_0x41de3b){return _0x41de3b[_0x6ceb('0x51')](_0x391d8a[_0x6ceb('0x45')][_0x6ceb('0x4a')],_[_0x6ceb('0x4b')](_0x391d8a['body'],['ids','id'])||{});}})[_0x6ceb('0x25')](respondWithResult(_0x43b4e5,null))['catch'](handleError(_0x43b4e5,null));};exports[_0x6ceb('0x52')]=function(_0x4bcd11,_0x1ef41f,_0x18b659){var _0xa7647b={};var _0x4d48a8={};var _0x989cb4;var _0x2dca01;return db[_0x6ceb('0x2b')][_0x6ceb('0x4d')]({'where':{'id':_0x4bcd11[_0x6ceb('0x47')]['id']}})[_0x6ceb('0x25')](handleEntityNotFound(_0x1ef41f,null))['then'](function(_0x326401){if(_0x326401){_0x989cb4=_0x326401;_0x4d48a8[_0x6ceb('0x32')]=_[_0x6ceb('0x2f')](db[_0x6ceb('0x53')][_0x6ceb('0x4e')]);_0x4d48a8['query']=_[_0x6ceb('0x2f')](_0x4bcd11[_0x6ceb('0x2e')]);_0x4d48a8[_0x6ceb('0x30')]=_[_0x6ceb('0x31')](_0x4d48a8[_0x6ceb('0x32')],_0x4d48a8[_0x6ceb('0x2e')]);_0xa7647b['attributes']=_['intersection'](_0x4d48a8[_0x6ceb('0x32')],qs[_0x6ceb('0x34')](_0x4bcd11[_0x6ceb('0x2e')]['fields']));_0xa7647b[_0x6ceb('0x33')]=_0xa7647b[_0x6ceb('0x33')][_0x6ceb('0x42')]?_0xa7647b[_0x6ceb('0x33')]:_0x4d48a8[_0x6ceb('0x32')];_0xa7647b[_0x6ceb('0x4f')]=qs[_0x6ceb('0x50')](_0x4bcd11[_0x6ceb('0x2e')][_0x6ceb('0x50')]);_0xa7647b[_0x6ceb('0x37')]=qs[_0x6ceb('0x30')](_[_0x6ceb('0x38')](_0x4bcd11[_0x6ceb('0x2e')],_0x4d48a8[_0x6ceb('0x30')]));if(_0x4bcd11[_0x6ceb('0x2e')][_0x6ceb('0x39')]){_0xa7647b[_0x6ceb('0x37')]=_['merge'](_0xa7647b[_0x6ceb('0x37')],{'$or':_[_0x6ceb('0x2a')](_0xa7647b['attributes'],function(_0x52f7c4){var _0x135726={};_0x135726[_0x52f7c4]={'$like':'%'+_0x4bcd11['query'][_0x6ceb('0x39')]+'%'};return _0x135726;})});}_0xa7647b=_['merge']({},_0xa7647b,_0x4bcd11[_0x6ceb('0x3b')]);return _0x989cb4['getActions'](_0xa7647b);}})[_0x6ceb('0x25')](function(_0x43a8a9){if(_0x43a8a9){_0x2dca01=_0x43a8a9['length'];if(!_0x4bcd11[_0x6ceb('0x2e')]['hasOwnProperty'](_0x6ceb('0x36'))){_0xa7647b[_0x6ceb('0x21')]=qs[_0x6ceb('0x21')](_0x4bcd11[_0x6ceb('0x2e')][_0x6ceb('0x21')]);_0xa7647b[_0x6ceb('0x20')]=qs['offset'](_0x4bcd11['query'][_0x6ceb('0x20')]);}return _0x989cb4[_0x6ceb('0x52')](_0xa7647b);}})[_0x6ceb('0x25')](function(_0x34b19b){if(_0x34b19b){return _0x34b19b?{'count':_0x2dca01,'rows':_0x34b19b}:null;}})[_0x6ceb('0x25')](respondWithResult(_0x1ef41f,null))['catch'](handleError(_0x1ef41f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a858bce..863b61d 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 _0x5075=['bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5075,0x73));var _0x5507=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x5075[_0x3ba566];return _0x480317;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var moment=require(_0x5507('0x4'));var BPromise=require(_0x5507('0x5'));var rp=require(_0x5507('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var attributes=require(_0x5507('0x9'));module['exports']=function(_0x5b6d7f,_0x2cd9ee){return _0x5b6d7f[_0x5507('0xa')]('Automation',attributes,{'tableName':_0x5507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c12=['./automation.attributes','define','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14f282,_0x5994c5){var _0x4a1d13=function(_0x1d4d52){while(--_0x1d4d52){_0x14f282['push'](_0x14f282['shift']());}};_0x4a1d13(++_0x5994c5);}(_0x5c12,0x188));var _0x25c1=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x5c12[_0x257495];return _0x3849aa;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rp=require(_0x25c1('0x4'));var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require(_0x25c1('0x8'));module['exports']=function(_0x204287,_0x42ac16){return _0x204287[_0x25c1('0x9')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c2add1d..09731d9 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 _0xf0ab=['Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf0ab,0x17c));var _0xbf0a=function(_0x2b86f9,_0x35fcda){_0x2b86f9=_0x2b86f9-0x0;var _0x421038=_0xf0ab[_0x2b86f9];return _0x421038;};'use strict';var _=require(_0xbf0a('0x0'));var util=require(_0xbf0a('0x1'));var moment=require(_0xbf0a('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf0a('0x3'));var fs=require('fs');var Redis=require(_0xbf0a('0x4'));var db=require(_0xbf0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf0a('0x6'));var config=require(_0xbf0a('0x7'));var jayson=require(_0xbf0a('0x8'));var client=jayson[_0xbf0a('0x9')][_0xbf0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f4e27,_0x24677a,_0x1b8661){return new BPromise(function(_0x15fd59,_0xb2072f){return client['request'](_0x4f4e27,_0x1b8661)[_0xbf0a('0xb')](function(_0xb01e0b){logger[_0xbf0a('0xc')](_0xbf0a('0xd'),_0x24677a,_0xbf0a('0xe'));logger[_0xbf0a('0xf')](_0xbf0a('0x10'),_0x24677a,_0xbf0a('0xe'),JSON[_0xbf0a('0x11')](_0xb01e0b));if(_0xb01e0b['error']){if(_0xb01e0b['error'][_0xbf0a('0x12')]===0x1f4){logger[_0xbf0a('0x13')]('Automation,\x20%s,\x20%s',_0x24677a,_0xb01e0b[_0xbf0a('0x13')][_0xbf0a('0x14')]);return _0xb2072f(_0xb01e0b[_0xbf0a('0x13')][_0xbf0a('0x14')]);}logger[_0xbf0a('0x13')]('Automation,\x20%s,\x20%s',_0x24677a,_0xb01e0b[_0xbf0a('0x13')]['message']);return _0x15fd59(_0xb01e0b[_0xbf0a('0x13')]['message']);}else{logger['info'](_0xbf0a('0xd'),_0x24677a,'request\x20sent');_0x15fd59(_0xb01e0b['result'][_0xbf0a('0x14')]);}})[_0xbf0a('0x15')](function(_0xcc575){logger[_0xbf0a('0x13')](_0xbf0a('0xd'),_0x24677a,_0xcc575);_0xb2072f(_0xcc575);});});} \ No newline at end of file +var _0x3150=['then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x3150,0xab));var _0x0315=function(_0x4ba1e0,_0x460925){_0x4ba1e0=_0x4ba1e0-0x0;var _0x5d333b=_0x3150[_0x4ba1e0];return _0x5d333b;};'use strict';var _=require('lodash');var util=require(_0x0315('0x0'));var moment=require(_0x0315('0x1'));var BPromise=require('bluebird');var rs=require(_0x0315('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0315('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0315('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0315('0x5'));var client=jayson[_0x0315('0x6')][_0x0315('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192738,_0x21fd1e,_0x240ec6){return new BPromise(function(_0xe7b623,_0x248f86){return client[_0x0315('0x8')](_0x192738,_0x240ec6)[_0x0315('0x9')](function(_0x573cad){logger[_0x0315('0xa')](_0x0315('0xb'),_0x21fd1e,_0x0315('0xc'));logger[_0x0315('0xd')](_0x0315('0xe'),_0x21fd1e,_0x0315('0xc'),JSON['stringify'](_0x573cad));if(_0x573cad[_0x0315('0xf')]){if(_0x573cad[_0x0315('0xf')][_0x0315('0x10')]===0x1f4){logger[_0x0315('0xf')]('Automation,\x20%s,\x20%s',_0x21fd1e,_0x573cad[_0x0315('0xf')][_0x0315('0x11')]);return _0x248f86(_0x573cad[_0x0315('0xf')][_0x0315('0x11')]);}logger[_0x0315('0xf')](_0x0315('0xb'),_0x21fd1e,_0x573cad['error'][_0x0315('0x11')]);return _0xe7b623(_0x573cad[_0x0315('0xf')][_0x0315('0x11')]);}else{logger['info'](_0x0315('0xb'),_0x21fd1e,_0x0315('0xc'));_0xe7b623(_0x573cad[_0x0315('0x12')][_0x0315('0x11')]);}})[_0x0315('0x13')](function(_0x5dee6b){logger[_0x0315('0xf')](_0x0315('0xb'),_0x21fd1e,_0x5dee6b);_0x248f86(_0x5dee6b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 3aa4481..b2673d6 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 _0x8cdb=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update'];(function(_0x28ac9d,_0x10c052){var _0x201d5f=function(_0x20d7f1){while(--_0x20d7f1){_0x28ac9d['push'](_0x28ac9d['shift']());}};_0x201d5f(++_0x10c052);}(_0x8cdb,0x193));var _0xb8cd=function(_0x3f3c01,_0x159e9d){_0x3f3c01=_0x3f3c01-0x0;var _0x5a6be2=_0x8cdb[_0x3f3c01];return _0x5a6be2;};'use strict';var multer=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var path=require(_0xb8cd('0x2'));var timeout=require(_0xb8cd('0x3'));var express=require('express');var router=express[_0xb8cd('0x4')]();var auth=require(_0xb8cd('0x5'));var interaction=require(_0xb8cd('0x6'));var config=require(_0xb8cd('0x7'));var controller=require(_0xb8cd('0x8'));router[_0xb8cd('0x9')]('/',auth[_0xb8cd('0xa')](),controller['index']);router[_0xb8cd('0x9')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0xc')]);router[_0xb8cd('0x9')](_0xb8cd('0xd'),auth['isAuthenticated'](),controller[_0xb8cd('0xe')]);router[_0xb8cd('0x9')](_0xb8cd('0xf'),auth['isAuthenticated'](),controller[_0xb8cd('0x10')]);router[_0xb8cd('0x11')]('/',auth['isAuthenticated'](),controller[_0xb8cd('0x12')]);router[_0xb8cd('0x11')](_0xb8cd('0xd'),auth[_0xb8cd('0xa')](),controller['addConditions']);router[_0xb8cd('0x11')]('/:id/actions',auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x13')]);router[_0xb8cd('0x14')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x15')]);router[_0xb8cd('0x16')](_0xb8cd('0xb'),auth[_0xb8cd('0xa')](),controller[_0xb8cd('0x17')]);module[_0xb8cd('0x18')]=router; \ No newline at end of file +var _0x4f8f=['index','/:id','isAuthenticated','show','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x9a24b9,_0x421c9d){var _0x3e46b1=function(_0x356d68){while(--_0x356d68){_0x9a24b9['push'](_0x9a24b9['shift']());}};_0x3e46b1(++_0x421c9d);}(_0x4f8f,0x175));var _0xf4f8=function(_0x3314a9,_0x15ae56){_0x3314a9=_0x3314a9-0x0;var _0x3fbd2a=_0x4f8f[_0x3314a9];return _0x3fbd2a;};'use strict';var multer=require('multer');var util=require(_0xf4f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4f8('0x1'));var router=express['Router']();var auth=require(_0xf4f8('0x2'));var interaction=require(_0xf4f8('0x3'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0xf4f8('0x4')]('/',auth['isAuthenticated'](),controller[_0xf4f8('0x5')]);router[_0xf4f8('0x4')](_0xf4f8('0x6'),auth[_0xf4f8('0x7')](),controller[_0xf4f8('0x8')]);router[_0xf4f8('0x4')]('/:id/conditions',auth[_0xf4f8('0x7')](),controller[_0xf4f8('0x9')]);router[_0xf4f8('0x4')](_0xf4f8('0xa'),auth[_0xf4f8('0x7')](),controller[_0xf4f8('0xb')]);router[_0xf4f8('0xc')]('/',auth[_0xf4f8('0x7')](),controller[_0xf4f8('0xd')]);router[_0xf4f8('0xc')]('/:id/conditions',auth[_0xf4f8('0x7')](),controller[_0xf4f8('0xe')]);router[_0xf4f8('0xc')](_0xf4f8('0xa'),auth[_0xf4f8('0x7')](),controller[_0xf4f8('0xf')]);router[_0xf4f8('0x10')](_0xf4f8('0x6'),auth[_0xf4f8('0x7')](),controller[_0xf4f8('0x11')]);router[_0xf4f8('0x12')]('/:id',auth[_0xf4f8('0x7')](),controller[_0xf4f8('0x13')]);module[_0xf4f8('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 335073b..b3bb89f 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 _0x7d27=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x7d27,0x84));var _0x77d2=function(_0x3874ab,_0x1e2dec){_0x3874ab=_0x3874ab-0x0;var _0x3b90e8=_0x7d27[_0x3874ab];return _0x3b90e8;};'use strict';var Sequelize=require(_0x77d2('0x0'));module[_0x77d2('0x1')]={'name':{'type':Sequelize[_0x77d2('0x2')],'unique':_0x77d2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x77d2('0x4')),'allowNull':![],'defaultValue':_0x77d2('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x77d2('0x5')],'defaultValue':0x0,'comment':_0x77d2('0x6')},'limitCalls':{'type':Sequelize[_0x77d2('0x7')](0x4)[_0x77d2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x77d2('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x77d2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x77d2('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'comment':_0x77d2('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x77d2('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x77d2('0xf'),_0x77d2('0x10'),_0x77d2('0x11')),'defaultValue':_0x77d2('0xf')},'dialAMDActive':{'type':Sequelize[_0x77d2('0x5')],'defaultValue':0x0,'comment':_0x77d2('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x77d2('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x77d2('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x77d2('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x77d2('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x77d2('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x77d2('0x7')](0x9)[_0x77d2('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x77d2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x77d2('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x77d2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x77d2('0x18'),_0x77d2('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x77d2('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x77d2('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x77d2('0x1a')},'dialCutDigit':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x77d2('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x77d2('0x7')](0x3)[_0x77d2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x77d2('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x77d2('0x7')](0x5)[_0x77d2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x77d2('0x24')}}; \ No newline at end of file +var _0xf191=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)'];(function(_0x532e0c,_0x4eb6eb){var _0x2d27f7=function(_0x5726dc){while(--_0x5726dc){_0x532e0c['push'](_0x532e0c['shift']());}};_0x2d27f7(++_0x4eb6eb);}(_0xf191,0x19a));var _0x1f19=function(_0x34de7a,_0x57d22c){_0x34de7a=_0x34de7a-0x0;var _0xd1c14=_0xf191[_0x34de7a];return _0xd1c14;};'use strict';var Sequelize=require('sequelize');module[_0x1f19('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1f19('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1f19('0x2')](_0x1f19('0x3')),'allowNull':![],'defaultValue':_0x1f19('0x3')},'description':{'type':Sequelize[_0x1f19('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1f19('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1f19('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1f19('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f19('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f19('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1f19('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f19('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1f19('0xc')},'dialTimezone':{'type':Sequelize[_0x1f19('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1f19('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1f19('0x2')](_0x1f19('0xd'),_0x1f19('0xe'),_0x1f19('0xf')),'defaultValue':_0x1f19('0xd')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1f19('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x1f19('0x8')](0x9)[_0x1f19('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1f19('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x1f19('0x8')](0x9)[_0x1f19('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1f19('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f19('0x8')](0x9)[_0x1f19('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f19('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1f19('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1f19('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f19('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1f19('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f19('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1f19('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f19('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f19('0x17')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x1f19('0x18')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1f19('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1f19('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f19('0x19')},'dialCutDigit':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f19('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f19('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f19('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f19('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1f19('0x8')](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f19('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1f19('0x8')](0x5)[_0x1f19('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f19('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fdcdd59..9084f4a 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 _0x4af7=['sequelize','all','removeLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','IvrCampaigns','error','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','options','includeAll','findAll','catch','show','params','length','include','merge','find','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','update','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','rows','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','CmListId','toString','NOW()','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','into','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','push'];(function(_0x178225,_0x21e015){var _0xc732dc=function(_0x22588c){while(--_0x22588c){_0x178225['push'](_0x178225['shift']());}};_0xc732dc(++_0x21e015);}(_0x4af7,0x191));var _0x74af=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x4af7[_0x2b4448];return _0xb4b465;};'use strict';var pdf=require(_0x74af('0x0'));var emlformat=require(_0x74af('0x1'));var rimraf=require(_0x74af('0x2'));var zipdir=require(_0x74af('0x3'));var jsonpatch=require(_0x74af('0x4'));var rp=require(_0x74af('0x5'));var moment=require('moment');var BPromise=require(_0x74af('0x6'));var Mustache=require('mustache');var util=require(_0x74af('0x7'));var path=require('path');var sox=require(_0x74af('0x8'));var csv=require(_0x74af('0x9'));var ejs=require(_0x74af('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74af('0xb'));var crypto=require('crypto');var jsforce=require(_0x74af('0xc'));var deskjs=require(_0x74af('0xd'));var toCsv=require(_0x74af('0x9'));var querystring=require(_0x74af('0xe'));var Papa=require(_0x74af('0xf'));var Redis=require(_0x74af('0x10'));var authService=require(_0x74af('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74af('0x12'));var logger=require('../../config/logger')(_0x74af('0x13'));var utils=require(_0x74af('0x14'));var config=require('../../config/environment');var db=require(_0x74af('0x15'))['db'];function respondWithStatusCode(_0x193024,_0x46d4ad){_0x46d4ad=_0x46d4ad||0xcc;return function(_0x3911a0){if(_0x3911a0){return _0x193024[_0x74af('0x16')](_0x46d4ad);}return _0x193024['status'](_0x46d4ad)[_0x74af('0x17')]();};}function respondWithResult(_0x4a2a3c,_0x1faa5d){_0x1faa5d=_0x1faa5d||0xc8;return function(_0xf78713){if(_0xf78713){return _0x4a2a3c[_0x74af('0x18')](_0x1faa5d)[_0x74af('0x19')](_0xf78713);}};}function respondWithFilteredResult(_0x14b7d6,_0x295edd){return function(_0x4cfbaa){if(_0x4cfbaa){var _0x4e4a24=_0x4cfbaa[_0x74af('0x1a')],_0x23f62c=_0x295edd['offset'],_0x5750fd=_0x295edd[_0x74af('0x1b')]+_0x295edd[_0x74af('0x1c')],_0x483908;if(_0x5750fd>=_0x4e4a24){_0x5750fd=_0x4e4a24;_0x483908=0xc8;}else{_0x483908=0xce;}_0x14b7d6[_0x74af('0x18')](_0x483908);return _0x14b7d6[_0x74af('0x1d')](_0x74af('0x1e'),_0x23f62c+'-'+_0x5750fd+'/'+_0x4e4a24)['json'](_0x4cfbaa);}return null;};}function patchUpdates(_0x57fe02){return function(_0x197eea){try{jsonpatch[_0x74af('0x1f')](_0x197eea,_0x57fe02,!![]);}catch(_0x4d3486){return BPromise[_0x74af('0x20')](_0x4d3486);}return _0x197eea[_0x74af('0x21')]();};}function saveUpdates(_0x189a0d,_0x512896){return function(_0xde59a9){if(_0xde59a9){return _0xde59a9['update'](_0x189a0d)[_0x74af('0x22')](function(_0x223bca){return _0x223bca;});}return null;};}function removeEntity(_0x2c3c1c,_0x471a7a){return function(_0x1374dc){if(_0x1374dc){return _0x1374dc[_0x74af('0x23')]()[_0x74af('0x22')](function(){var _0x365efd=_0x1374dc['get']({'plain':!![]});var _0x14f60b=_0x74af('0x24');return db['UserProfileResource'][_0x74af('0x23')]({'where':{'type':_0x14f60b,'resourceId':_0x365efd['id']}})[_0x74af('0x22')](function(){return _0x1374dc;});})['then'](function(){_0x2c3c1c['status'](0xcc)[_0x74af('0x17')]();});}};}function handleEntityNotFound(_0x3376d6,_0x498ec3){return function(_0x9f208d){if(!_0x9f208d){_0x3376d6['sendStatus'](0x194);}return _0x9f208d;};}function handleError(_0x2eabe7,_0x26f1e9){_0x26f1e9=_0x26f1e9||0x1f4;return function(_0x5505d3){logger[_0x74af('0x25')](_0x5505d3['stack']);if(_0x5505d3[_0x74af('0x26')]){delete _0x5505d3[_0x74af('0x26')];}_0x2eabe7[_0x74af('0x18')](_0x26f1e9)[_0x74af('0x27')](_0x5505d3);};}exports[_0x74af('0x28')]=function(_0x43095f,_0x1065b9){var _0xfbe332={},_0x271940={},_0x100218={'count':0x0,'rows':[]};var _0x1f9068=_[_0x74af('0x29')](db[_0x74af('0x2a')][_0x74af('0x2b')],function(_0x598f1b){return{'name':_0x598f1b[_0x74af('0x2c')],'type':_0x598f1b[_0x74af('0x2d')][_0x74af('0x2e')]};});_0x271940[_0x74af('0x2f')]=_['map'](_0x1f9068,'name');_0x271940[_0x74af('0x30')]=_[_0x74af('0x31')](_0x43095f[_0x74af('0x30')]);_0x271940[_0x74af('0x32')]=_[_0x74af('0x33')](_0x271940['model'],_0x271940['query']);_0xfbe332['attributes']=_[_0x74af('0x33')](_0x271940[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x43095f['query'][_0x74af('0x34')]));_0xfbe332[_0x74af('0x35')]=_0xfbe332[_0x74af('0x35')]['length']?_0xfbe332[_0x74af('0x35')]:_0x271940['model'];if(!_0x43095f[_0x74af('0x30')]['hasOwnProperty'](_0x74af('0x36'))){_0xfbe332['limit']=qs[_0x74af('0x1c')](_0x43095f[_0x74af('0x30')][_0x74af('0x1c')]);_0xfbe332['offset']=qs[_0x74af('0x1b')](_0x43095f[_0x74af('0x30')][_0x74af('0x1b')]);}_0xfbe332[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x43095f[_0x74af('0x30')][_0x74af('0x38')]);_0xfbe332[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x43095f[_0x74af('0x30')],_0x271940[_0x74af('0x32')]),_0x1f9068);if(_0x43095f[_0x74af('0x30')]['filter']){_0xfbe332[_0x74af('0x39')]=_['merge'](_0xfbe332[_0x74af('0x39')],{'$or':_['map'](_0x1f9068,function(_0x310ee4){if(_0x310ee4[_0x74af('0x2d')]!=='VIRTUAL'){var _0x38552c={};_0x38552c[_0x310ee4[_0x74af('0x26')]]={'$like':'%'+_0x43095f['query'][_0x74af('0x3a')]+'%'};return _0x38552c;}})});}_0xfbe332=_['merge']({},_0xfbe332,_0x43095f[_0x74af('0x3b')]);var _0x123e3a={'where':_0xfbe332['where']};return db['Campaign'][_0x74af('0x1a')](_0x123e3a)[_0x74af('0x22')](function(_0x33632b){_0x100218[_0x74af('0x1a')]=_0x33632b;if(_0x43095f[_0x74af('0x30')][_0x74af('0x3c')]){_0xfbe332['include']=[{'all':!![]}];}return db['Campaign'][_0x74af('0x3d')](_0xfbe332);})[_0x74af('0x22')](function(_0xd86545){_0x100218['rows']=_0xd86545;return _0x100218;})['then'](respondWithFilteredResult(_0x1065b9,_0xfbe332))[_0x74af('0x3e')](handleError(_0x1065b9,null));};exports[_0x74af('0x3f')]=function(_0x19a538,_0x1b5269){var _0x4a6714={'raw':![],'where':{'id':_0x19a538[_0x74af('0x40')]['id']}},_0x56f793={};_0x56f793[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x2a')][_0x74af('0x2b')]);_0x56f793[_0x74af('0x30')]=_[_0x74af('0x31')](_0x19a538[_0x74af('0x30')]);_0x56f793[_0x74af('0x32')]=_[_0x74af('0x33')](_0x56f793[_0x74af('0x2f')],_0x56f793['query']);_0x4a6714[_0x74af('0x35')]=_['intersection'](_0x56f793[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x19a538[_0x74af('0x30')][_0x74af('0x34')]));_0x4a6714[_0x74af('0x35')]=_0x4a6714[_0x74af('0x35')][_0x74af('0x41')]?_0x4a6714[_0x74af('0x35')]:_0x56f793[_0x74af('0x2f')];if(_0x19a538[_0x74af('0x30')]['includeAll']){_0x4a6714[_0x74af('0x42')]=[{'all':!![]}];}_0x4a6714=_[_0x74af('0x43')]({},_0x4a6714,_0x19a538['options']);return db[_0x74af('0x2a')][_0x74af('0x44')](_0x4a6714)[_0x74af('0x22')](handleEntityNotFound(_0x1b5269,null))['then'](respondWithResult(_0x1b5269,null))[_0x74af('0x3e')](handleError(_0x1b5269,null));};exports[_0x74af('0x45')]=function(_0x2ef489,_0x3c41b8){return db[_0x74af('0x2a')]['create'](_0x2ef489[_0x74af('0x46')],{})[_0x74af('0x22')](function(_0x1fc273){var _0x133936=_0x2ef489[_0x74af('0x47')][_0x74af('0x48')]({'plain':!![]});if(!_0x133936)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133936[_0x74af('0x49')]===_0x74af('0x47')){var _0xa072bd=_0x1fc273[_0x74af('0x48')]({'plain':!![]});var _0x589ddb=_0x74af('0x24');return db[_0x74af('0x4a')][_0x74af('0x44')]({'where':{'name':_0x589ddb,'userProfileId':_0x133936['userProfileId']},'raw':!![]})[_0x74af('0x22')](function(_0x315312){if(_0x315312&&_0x315312['autoAssociation']===0x0){return db['UserProfileResource'][_0x74af('0x45')]({'name':_0xa072bd[_0x74af('0x26')],'resourceId':_0xa072bd['id'],'type':_0x315312[_0x74af('0x26')],'sectionId':_0x315312['id']},{})['then'](function(){return _0x1fc273;});}else{return _0x1fc273;}})[_0x74af('0x3e')](function(_0x3c7ce6){logger[_0x74af('0x25')](_0x74af('0x4b'),_0x3c7ce6);throw _0x3c7ce6;});}return _0x1fc273;})[_0x74af('0x22')](respondWithResult(_0x3c41b8,0xc9))[_0x74af('0x3e')](handleError(_0x3c41b8,null));};exports['clone']=function(_0x12c6d8,_0x28c01e){var _0x55501c={'where':{'id':_0x12c6d8[_0x74af('0x40')]['id']}},_0xef425e={};_0xef425e['model']=_['keys'](db['Campaign']['rawAttributes']);_0x55501c[_0x74af('0x35')]=_[_0x74af('0x33')](_0xef425e['model'],qs[_0x74af('0x34')](_0x12c6d8['query']['fields']));_0x55501c['attributes']=_0x55501c[_0x74af('0x35')][_0x74af('0x41')]?_0x55501c[_0x74af('0x35')]:_0xef425e[_0x74af('0x2f')];if(_0x12c6d8[_0x74af('0x30')][_0x74af('0x3c')]){_0x55501c[_0x74af('0x42')]=[{'all':!![]}];}_0x55501c=_[_0x74af('0x43')]({},_0x55501c,_0x12c6d8[_0x74af('0x3b')]);return db[_0x74af('0x2a')][_0x74af('0x44')](_0x55501c)[_0x74af('0x22')](handleEntityNotFound(_0x28c01e,null))[_0x74af('0x22')](function(_0x5e897d){if(_0x5e897d){var _0x12300c=_0x5e897d['get']({'plain':!![]});_0x12300c=qs[_0x74af('0x4c')](_0x12300c,['id','createdAt','updatedAt']);_0x12c6d8['body']=_[_0x74af('0x4c')](_0x12c6d8[_0x74af('0x46')],['id',_0x74af('0x4d'),_0x74af('0x4e')]);return db['Campaign'][_0x74af('0x45')](_[_0x74af('0x43')](_0x12300c,_0x12c6d8[_0x74af('0x46')]),{'include':_0x12c6d8[_0x74af('0x30')][_0x74af('0x3c')]?[{'all':!![]}]:undefined})['then'](function(_0x5a88b2){var _0x4ee25d=_0x12c6d8[_0x74af('0x47')][_0x74af('0x48')]({'plain':!![]});if(!_0x4ee25d)throw new Error(_0x74af('0x4f'));if(_0x4ee25d['role']===_0x74af('0x47')){var _0x4274e6=_0x5a88b2['get']({'plain':!![]});var _0x58a607='IvrCampaigns';return db[_0x74af('0x4a')]['find']({'where':{'name':_0x58a607,'userProfileId':_0x4ee25d[_0x74af('0x50')]},'raw':!![]})[_0x74af('0x22')](function(_0x19fe65){if(_0x19fe65&&_0x19fe65[_0x74af('0x51')]===0x0){return db[_0x74af('0x52')][_0x74af('0x45')]({'name':_0x4274e6['name'],'resourceId':_0x4274e6['id'],'type':_0x19fe65[_0x74af('0x26')],'sectionId':_0x19fe65['id']},{})[_0x74af('0x22')](function(){return _0x5a88b2;});}else{return _0x5a88b2;}})[_0x74af('0x3e')](function(_0x4a841b){logger['error'](_0x74af('0x4b'),_0x4a841b);throw _0x4a841b;});}return _0x5a88b2;});}})[_0x74af('0x22')](respondWithResult(_0x28c01e,0xc9))[_0x74af('0x3e')](handleError(_0x28c01e,null));};exports[_0x74af('0x53')]=function(_0x11c4fd,_0x2018e0){if(_0x11c4fd[_0x74af('0x46')]['id']){delete _0x11c4fd[_0x74af('0x46')]['id'];}return db['Campaign'][_0x74af('0x44')]({'where':{'id':_0x11c4fd[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x2018e0,null))[_0x74af('0x22')](saveUpdates(_0x11c4fd[_0x74af('0x46')],null))[_0x74af('0x22')](respondWithResult(_0x2018e0,null))[_0x74af('0x3e')](handleError(_0x2018e0,null));};exports[_0x74af('0x23')]=function(_0x5824cc,_0x3dfda8){return db[_0x74af('0x2a')][_0x74af('0x44')]({'where':{'id':_0x5824cc['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x3dfda8,null))[_0x74af('0x22')](removeEntity(_0x3dfda8,null))[_0x74af('0x3e')](handleError(_0x3dfda8,null));};exports[_0x74af('0x54')]=function(_0x4e9a7e,_0x2ae16a,_0x32de2a){var _0x663a70={'raw':!![],'where':{}};var _0x490418={};var _0x498d5f={'count':0x0,'rows':[]};return db[_0x74af('0x2a')][_0x74af('0x55')]({'where':{'id':_0x4e9a7e[_0x74af('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ae16a,null))['then'](function(_0xfae46a){if(_0xfae46a){_0x490418[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x56')][_0x74af('0x2b')]);_0x490418[_0x74af('0x30')]=_[_0x74af('0x31')](_0x4e9a7e[_0x74af('0x30')]);_0x490418[_0x74af('0x32')]=_['intersection'](_0x490418['model'],_0x490418[_0x74af('0x30')]);_0x663a70[_0x74af('0x35')]=_['intersection'](_0x490418['model'],qs[_0x74af('0x34')](_0x4e9a7e[_0x74af('0x30')][_0x74af('0x34')]));_0x663a70['attributes']=_0x663a70['attributes'][_0x74af('0x41')]?_0x663a70['attributes']:_0x490418['model'];if(!_0x4e9a7e['query'][_0x74af('0x57')](_0x74af('0x36'))){_0x663a70[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x4e9a7e[_0x74af('0x30')]['limit']);_0x663a70[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x4e9a7e['query'][_0x74af('0x1b')]);}_0x663a70[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x4e9a7e['query'][_0x74af('0x38')]);_0x663a70[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x4e9a7e['query'],_0x490418[_0x74af('0x32')]));_0x663a70[_0x74af('0x39')][_0x74af('0x58')]=_0xfae46a['id'];if(_0x4e9a7e['query'][_0x74af('0x3a')]){_0x663a70['where']=_[_0x74af('0x43')](_0x663a70[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x663a70[_0x74af('0x35')],function(_0x327ff6){var _0x2edc43={};_0x2edc43[_0x327ff6]={'$like':'%'+_0x4e9a7e[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x2edc43;})});}_0x663a70=_[_0x74af('0x43')]({},_0x663a70,_0x4e9a7e[_0x74af('0x3b')]);return db[_0x74af('0x56')][_0x74af('0x1a')]({'where':_0x663a70[_0x74af('0x39')]})[_0x74af('0x22')](function(_0x509fe4){_0x498d5f[_0x74af('0x1a')]=_0x509fe4;if(_0x4e9a7e[_0x74af('0x30')][_0x74af('0x3c')]){_0x663a70['include']=[{'all':!![]}];}return db[_0x74af('0x56')]['findAll'](_0x663a70);})['then'](function(_0x311bdb){_0x498d5f[_0x74af('0x59')]=_0x311bdb;return _0x498d5f;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x2ae16a,_0x663a70))[_0x74af('0x3e')](handleError(_0x2ae16a,null));};exports['getHopperHistories']=function(_0x14eeab,_0x2263a0,_0x5713c1){var _0x326142={'raw':!![],'where':{}};var _0x390549={};var _0x5a80db={'count':0x0,'rows':[]};return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x14eeab[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x2263a0,null))[_0x74af('0x22')](function(_0x56ea79){if(_0x56ea79){_0x390549[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x5a')][_0x74af('0x2b')]);_0x390549['query']=_['keys'](_0x14eeab['query']);_0x390549['filters']=_[_0x74af('0x33')](_0x390549[_0x74af('0x2f')],_0x390549[_0x74af('0x30')]);_0x326142[_0x74af('0x35')]=_[_0x74af('0x33')](_0x390549[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x14eeab[_0x74af('0x30')]['fields']));_0x326142[_0x74af('0x35')]=_0x326142[_0x74af('0x35')]['length']?_0x326142[_0x74af('0x35')]:_0x390549[_0x74af('0x2f')];if(!_0x14eeab['query'][_0x74af('0x57')](_0x74af('0x36'))){_0x326142[_0x74af('0x1c')]=qs['limit'](_0x14eeab[_0x74af('0x30')][_0x74af('0x1c')]);_0x326142[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x14eeab['query']['offset']);}_0x326142[_0x74af('0x37')]=qs['sort'](_0x14eeab[_0x74af('0x30')]['sort']);_0x326142[_0x74af('0x39')]=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x14eeab[_0x74af('0x30')],_0x390549[_0x74af('0x32')]));_0x326142[_0x74af('0x39')]['CampaignId']=_0x56ea79['id'];if(_0x14eeab[_0x74af('0x30')][_0x74af('0x3a')]){_0x326142[_0x74af('0x39')]=_[_0x74af('0x43')](_0x326142[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x326142[_0x74af('0x35')],function(_0x5a2e23){var _0x243d0f={};_0x243d0f[_0x5a2e23]={'$like':'%'+_0x14eeab[_0x74af('0x30')]['filter']+'%'};return _0x243d0f;})});}_0x326142=_[_0x74af('0x43')]({},_0x326142,_0x14eeab[_0x74af('0x3b')]);return db[_0x74af('0x5a')][_0x74af('0x1a')]({'where':_0x326142[_0x74af('0x39')]})[_0x74af('0x22')](function(_0x2e6e67){_0x5a80db['count']=_0x2e6e67;if(_0x14eeab['query'][_0x74af('0x3c')]){_0x326142[_0x74af('0x42')]=[{'all':!![]}];}return db[_0x74af('0x5a')][_0x74af('0x3d')](_0x326142);})[_0x74af('0x22')](function(_0x229a19){_0x5a80db[_0x74af('0x59')]=_0x229a19;return _0x5a80db;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x2263a0,_0x326142))[_0x74af('0x3e')](handleError(_0x2263a0,null));};exports[_0x74af('0x5c')]=function(_0x28c7bc,_0x436cb8,_0xea360){var _0x1e3d4b={'raw':!![],'where':{}};var _0x5b51d3={};var _0x463f0e={'count':0x0,'rows':[]};return db[_0x74af('0x2a')]['findOne']({'where':{'id':_0x28c7bc['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x436cb8,null))[_0x74af('0x22')](function(_0x3f6dc6){if(_0x3f6dc6){_0x5b51d3[_0x74af('0x2f')]=_['keys'](db[_0x74af('0x5d')][_0x74af('0x2b')]);_0x5b51d3[_0x74af('0x30')]=_[_0x74af('0x31')](_0x28c7bc[_0x74af('0x30')]);_0x5b51d3['filters']=_[_0x74af('0x33')](_0x5b51d3['model'],_0x5b51d3[_0x74af('0x30')]);_0x1e3d4b[_0x74af('0x35')]=_[_0x74af('0x33')](_0x5b51d3['model'],qs[_0x74af('0x34')](_0x28c7bc['query'][_0x74af('0x34')]));_0x1e3d4b[_0x74af('0x35')]=_0x1e3d4b[_0x74af('0x35')][_0x74af('0x41')]?_0x1e3d4b['attributes']:_0x5b51d3[_0x74af('0x2f')];if(!_0x28c7bc[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x1e3d4b[_0x74af('0x1c')]=qs['limit'](_0x28c7bc[_0x74af('0x30')][_0x74af('0x1c')]);_0x1e3d4b[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x28c7bc['query']['offset']);}_0x1e3d4b[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x28c7bc[_0x74af('0x30')]['sort']);_0x1e3d4b['where']=qs['filters'](_[_0x74af('0x5b')](_0x28c7bc['query'],_0x5b51d3[_0x74af('0x32')]));_0x1e3d4b[_0x74af('0x39')][_0x74af('0x58')]=_0x3f6dc6['id'];if(_0x28c7bc[_0x74af('0x30')][_0x74af('0x3a')]){_0x1e3d4b[_0x74af('0x39')]=_['merge'](_0x1e3d4b[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x1e3d4b[_0x74af('0x35')],function(_0x5835ac){var _0x302ce0={};_0x302ce0[_0x5835ac]={'$like':'%'+_0x28c7bc[_0x74af('0x30')]['filter']+'%'};return _0x302ce0;})});}_0x1e3d4b=_[_0x74af('0x43')]({},_0x1e3d4b,_0x28c7bc['options']);return db[_0x74af('0x5d')]['count']({'where':_0x1e3d4b['where']})[_0x74af('0x22')](function(_0x7e4c4b){_0x463f0e[_0x74af('0x1a')]=_0x7e4c4b;if(_0x28c7bc[_0x74af('0x30')][_0x74af('0x3c')]){_0x1e3d4b['include']=[{'all':!![]}];}return db[_0x74af('0x5d')]['findAll'](_0x1e3d4b);})['then'](function(_0x1be660){_0x463f0e[_0x74af('0x59')]=_0x1be660;return _0x463f0e;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x436cb8,_0x1e3d4b))[_0x74af('0x3e')](handleError(_0x436cb8,null));};exports[_0x74af('0x5e')]=function(_0x470fc9,_0x55c448,_0x33c334){var _0x2767ef={'raw':!![],'where':{}};var _0x2c12ca={};var _0x291aa={'count':0x0,'rows':[]};return db[_0x74af('0x2a')][_0x74af('0x55')]({'where':{'id':_0x470fc9[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x55c448,null))[_0x74af('0x22')](function(_0x5a7edd){if(_0x5a7edd){_0x2c12ca['model']=_['keys'](db[_0x74af('0x5f')][_0x74af('0x2b')]);_0x2c12ca[_0x74af('0x30')]=_['keys'](_0x470fc9[_0x74af('0x30')]);_0x2c12ca[_0x74af('0x32')]=_['intersection'](_0x2c12ca[_0x74af('0x2f')],_0x2c12ca[_0x74af('0x30')]);_0x2767ef[_0x74af('0x35')]=_['intersection'](_0x2c12ca[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x470fc9[_0x74af('0x30')]['fields']));_0x2767ef['attributes']=_0x2767ef[_0x74af('0x35')][_0x74af('0x41')]?_0x2767ef[_0x74af('0x35')]:_0x2c12ca[_0x74af('0x2f')];if(!_0x470fc9['query']['hasOwnProperty'](_0x74af('0x36'))){_0x2767ef[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x470fc9['query'][_0x74af('0x1c')]);_0x2767ef[_0x74af('0x1b')]=qs['offset'](_0x470fc9[_0x74af('0x30')][_0x74af('0x1b')]);}_0x2767ef['order']=qs[_0x74af('0x38')](_0x470fc9[_0x74af('0x30')][_0x74af('0x38')]);_0x2767ef[_0x74af('0x39')]=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x470fc9[_0x74af('0x30')],_0x2c12ca[_0x74af('0x32')]));_0x2767ef[_0x74af('0x39')][_0x74af('0x58')]=_0x5a7edd['id'];if(_0x470fc9[_0x74af('0x30')][_0x74af('0x3a')]){_0x2767ef[_0x74af('0x39')]=_[_0x74af('0x43')](_0x2767ef[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x2767ef[_0x74af('0x35')],function(_0xa0e1a){var _0x5e60be={};_0x5e60be[_0xa0e1a]={'$like':'%'+_0x470fc9[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x5e60be;})});}_0x2767ef=_[_0x74af('0x43')]({},_0x2767ef,_0x470fc9['options']);return db[_0x74af('0x5f')]['count']({'where':_0x2767ef['where']})['then'](function(_0x12a513){_0x291aa[_0x74af('0x1a')]=_0x12a513;if(_0x470fc9[_0x74af('0x30')][_0x74af('0x3c')]){_0x2767ef['include']=[{'all':!![]}];}return db[_0x74af('0x5f')]['findAll'](_0x2767ef);})[_0x74af('0x22')](function(_0x581676){_0x291aa[_0x74af('0x59')]=_0x581676;return _0x291aa;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x55c448,_0x2767ef))[_0x74af('0x3e')](handleError(_0x55c448,null));};exports['getLists']=function(_0x562b75,_0xd84b6c,_0x34ee57){var _0x367f09={};var _0x411229={};var _0x43cd8d;var _0x28a762;return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x562b75[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0xd84b6c,null))[_0x74af('0x22')](function(_0x5036ce){if(_0x5036ce){_0x43cd8d=_0x5036ce;_0x411229[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x60')][_0x74af('0x2b')]);_0x411229[_0x74af('0x30')]=_['keys'](_0x562b75[_0x74af('0x30')]);_0x411229[_0x74af('0x32')]=_[_0x74af('0x33')](_0x411229[_0x74af('0x2f')],_0x411229[_0x74af('0x30')]);_0x367f09['attributes']=_['intersection'](_0x411229[_0x74af('0x2f')],qs[_0x74af('0x34')](_0x562b75[_0x74af('0x30')][_0x74af('0x34')]));_0x367f09[_0x74af('0x35')]=_0x367f09[_0x74af('0x35')][_0x74af('0x41')]?_0x367f09[_0x74af('0x35')]:_0x411229[_0x74af('0x2f')];_0x367f09['order']=qs[_0x74af('0x38')](_0x562b75['query'][_0x74af('0x38')]);_0x367f09['where']=qs[_0x74af('0x32')](_[_0x74af('0x5b')](_0x562b75['query'],_0x411229['filters']));if(_0x562b75[_0x74af('0x30')][_0x74af('0x3a')]){_0x367f09[_0x74af('0x39')]=_[_0x74af('0x43')](_0x367f09[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x367f09[_0x74af('0x35')],function(_0x2cbd0b){var _0x367497={};_0x367497[_0x2cbd0b]={'$like':'%'+_0x562b75[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x367497;})});}_0x367f09=_[_0x74af('0x43')]({},_0x367f09,_0x562b75['options']);return _0x43cd8d[_0x74af('0x61')](_0x367f09);}})[_0x74af('0x22')](function(_0x159371){if(_0x159371){_0x28a762=_0x159371[_0x74af('0x41')];if(!_0x562b75[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x367f09[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x562b75[_0x74af('0x30')][_0x74af('0x1c')]);_0x367f09['offset']=qs[_0x74af('0x1b')](_0x562b75[_0x74af('0x30')]['offset']);}return _0x43cd8d[_0x74af('0x61')](_0x367f09);}})[_0x74af('0x22')](function(_0x5f0b6d){if(_0x5f0b6d){return _0x5f0b6d?{'count':_0x28a762,'rows':_0x5f0b6d}:null;}})[_0x74af('0x22')](respondWithResult(_0xd84b6c,null))['catch'](handleError(_0xd84b6c,null));};exports[_0x74af('0x62')]=function(_0x12464f,_0x49847c,_0xd615f2){var _0x14031d,_0x235904;return db['Campaign'][_0x74af('0x44')]({'where':{'id':_0x12464f[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x49847c,null))[_0x74af('0x22')](function(_0x11e65f){if(_0x11e65f){_0x235904=_0x11e65f;return _0x11e65f['addLists'](_0x12464f['body'][_0x74af('0x63')],_[_0x74af('0x4c')](_0x12464f[_0x74af('0x46')],[_0x74af('0x63'),'id'])||{});}return null;})[_0x74af('0x64')](function(_0x4ff044){var _0x2985cf;_0x14031d=_0x4ff044||[];var _0x4a755a=[];if(_0x4ff044){for(var _0x322191=0x0;_0x322191<_0x4ff044['length'];_0x322191+=0x1){var _0x1aec37=_0x4ff044[_0x322191][_0x74af('0x48')]({'plain':!![]});_0x235904[_0x74af('0x65')]=_0x12464f[_0x74af('0x46')]['dialCheckDuplicateType']?_0x12464f[_0x74af('0x46')][_0x74af('0x65')]:_0x235904[_0x74af('0x65')];switch(_0x235904['dialCheckDuplicateType']){case _0x74af('0x66'):_0x2985cf=squel['insert']()['into'](_0x74af('0x67'))[_0x74af('0x68')](['phone',_0x74af('0x69'),_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),'updatedAt'],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')]('NOW()',_0x74af('0x69'))[_0x74af('0x6d')]('id','ContactId')[_0x74af('0x6d')](_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')](),_0x74af('0x6b'))['field'](_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')](),_0x74af('0x58'))[_0x74af('0x6d')]('NOW()',_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))['from'](_0x74af('0x72'))[_0x74af('0x39')]('deletedAt\x20IS\x20NULL')[_0x74af('0x39')]('ListId\x20=\x20?',_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')]())['where'](_0x74af('0x73'))[_0x74af('0x39')](_0x74af('0x74'),squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x75'))['from']('cm_hopper_final')['where'](_0x74af('0x76'),_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')]()))[_0x74af('0x39')](_0x74af('0x74'),squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x77'))[_0x74af('0x78')](_0x74af('0x67'))[_0x74af('0x39')](_0x74af('0x76'),_0x12464f['params']['id'][_0x74af('0x70')]())))[_0x74af('0x70')]();break;case _0x74af('0x79'):_0x2985cf=squel[_0x74af('0x7a')]()[_0x74af('0x7b')]('cm_hopper')[_0x74af('0x68')]([_0x74af('0x6e'),_0x74af('0x69'),_0x74af('0x6a'),'ListId','CampaignId',_0x74af('0x4d'),_0x74af('0x4e')],squel[_0x74af('0x6c')]()[_0x74af('0x6d')]('phone',_0x74af('0x6e'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x69'))[_0x74af('0x6d')]('id',_0x74af('0x6a'))[_0x74af('0x6d')](_0x1aec37[_0x74af('0x6f')]['toString'](),_0x74af('0x6b'))['field'](_0x12464f['params']['id'][_0x74af('0x70')](),_0x74af('0x58'))['field'](_0x74af('0x71'),_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))[_0x74af('0x78')](_0x74af('0x72'))[_0x74af('0x39')]('deletedAt\x20IS\x20NULL')[_0x74af('0x39')](_0x74af('0x7c'),_0x1aec37['CmListId'][_0x74af('0x70')]())[_0x74af('0x39')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x74af('0x6c')]()[_0x74af('0x6d')]('COALESCE(phone,\x27\x27)')[_0x74af('0x78')]('cm_hopper')[_0x74af('0x39')](_0x74af('0x76'),_0x12464f[_0x74af('0x40')]['id'][_0x74af('0x70')]())))['toString']();break;default:_0x2985cf=squel[_0x74af('0x7a')]()[_0x74af('0x7b')](_0x74af('0x67'))[_0x74af('0x68')]([_0x74af('0x6e'),'scheduledAt',_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),_0x74af('0x4e')],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x69'))[_0x74af('0x6d')]('id',_0x74af('0x6a'))['field'](_0x1aec37['CmListId']['toString'](),'ListId')[_0x74af('0x6d')](_0x12464f[_0x74af('0x40')]['id']['toString'](),_0x74af('0x58'))[_0x74af('0x6d')]('NOW()',_0x74af('0x4d'))[_0x74af('0x6d')]('NOW()','updatedAt')[_0x74af('0x78')]('cm_contacts')[_0x74af('0x39')](_0x74af('0x7d'))[_0x74af('0x39')](_0x74af('0x7c'),_0x1aec37[_0x74af('0x6f')][_0x74af('0x70')]())[_0x74af('0x39')](_0x74af('0x73')))[_0x74af('0x70')]();}_0x4a755a[_0x74af('0x7e')](db[_0x74af('0x7f')][_0x74af('0x30')](_0x2985cf));}return BPromise[_0x74af('0x80')](_0x4a755a);}})[_0x74af('0x22')](function(){return _0x14031d;})[_0x74af('0x22')](respondWithResult(_0x49847c,null))['catch'](handleError(_0x49847c,null));};exports[_0x74af('0x81')]=function(_0x3daae2,_0x1a5cfc,_0x578ffb){return db[_0x74af('0x2a')][_0x74af('0x44')]({'where':{'id':_0x3daae2[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x1a5cfc,null))['then'](function(_0x57eb47){if(_0x57eb47){return _0x57eb47[_0x74af('0x81')](_0x3daae2['query'][_0x74af('0x63')]);}})[_0x74af('0x22')](function(_0x4b6aa7){if(_0x4b6aa7){return db[_0x74af('0x56')][_0x74af('0x23')]({'where':{'ListId':_0x3daae2['query']['ids'],'CampaignId':_0x3daae2[_0x74af('0x40')]['id']}})[_0x74af('0x22')](function(){return _0x4b6aa7;});}})[_0x74af('0x22')](respondWithStatusCode(_0x1a5cfc,null))[_0x74af('0x3e')](handleError(_0x1a5cfc,null));};exports['getBlackLists']=function(_0x537f30,_0x120e37,_0xb9089f){var _0x3f42d2={'raw':!![],'where':{}};var _0x1a529b={};var _0x156aa1={'count':0x0,'rows':[]};return db['Campaign'][_0x74af('0x55')]({'where':{'id':_0x537f30['params']['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x120e37,null))[_0x74af('0x22')](function(_0xef83d6){if(_0xef83d6){_0x1a529b[_0x74af('0x2f')]=_[_0x74af('0x31')](db[_0x74af('0x60')]['rawAttributes']);_0x1a529b['query']=_['keys'](_0x537f30[_0x74af('0x30')]);_0x1a529b[_0x74af('0x32')]=_[_0x74af('0x33')](_0x1a529b['model'],_0x1a529b['query']);_0x3f42d2[_0x74af('0x35')]=_[_0x74af('0x33')](_0x1a529b[_0x74af('0x2f')],qs['fields'](_0x537f30[_0x74af('0x30')][_0x74af('0x34')]));_0x3f42d2[_0x74af('0x35')]=_0x3f42d2[_0x74af('0x35')][_0x74af('0x41')]?_0x3f42d2['attributes']:_0x1a529b[_0x74af('0x2f')];if(!_0x537f30[_0x74af('0x30')][_0x74af('0x57')](_0x74af('0x36'))){_0x3f42d2[_0x74af('0x1c')]=qs[_0x74af('0x1c')](_0x537f30['query'][_0x74af('0x1c')]);_0x3f42d2[_0x74af('0x1b')]=qs[_0x74af('0x1b')](_0x537f30['query'][_0x74af('0x1b')]);}_0x3f42d2[_0x74af('0x37')]=qs[_0x74af('0x38')](_0x537f30[_0x74af('0x30')][_0x74af('0x38')]);_0x3f42d2[_0x74af('0x39')]=qs[_0x74af('0x32')](_['pick'](_0x537f30['query'],_0x1a529b[_0x74af('0x32')]));_0x3f42d2[_0x74af('0x39')][_0x74af('0x58')]=_0xef83d6['id'];if(_0x537f30[_0x74af('0x30')][_0x74af('0x3a')]){_0x3f42d2[_0x74af('0x39')]=_[_0x74af('0x43')](_0x3f42d2[_0x74af('0x39')],{'$or':_[_0x74af('0x29')](_0x3f42d2[_0x74af('0x35')],function(_0x229d12){var _0x230081={};_0x230081[_0x229d12]={'$like':'%'+_0x537f30[_0x74af('0x30')][_0x74af('0x3a')]+'%'};return _0x230081;})});}_0x3f42d2=_[_0x74af('0x43')]({},_0x3f42d2,_0x537f30[_0x74af('0x3b')]);return db[_0x74af('0x60')]['count']({'where':_0x3f42d2['where']})[_0x74af('0x22')](function(_0x504add){_0x156aa1['count']=_0x504add;if(_0x537f30[_0x74af('0x30')][_0x74af('0x3c')]){_0x3f42d2['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x3f42d2);})['then'](function(_0x3193a2){_0x156aa1[_0x74af('0x59')]=_0x3193a2;return _0x156aa1;});}})[_0x74af('0x22')](respondWithFilteredResult(_0x120e37,_0x3f42d2))[_0x74af('0x3e')](handleError(_0x120e37,null));};exports['addBlackLists']=function(_0x1a018a,_0x18a808,_0x556709){var _0xe4419c,_0x44322b;return db[_0x74af('0x2a')]['find']({'where':{'id':_0x1a018a[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x18a808,null))[_0x74af('0x22')](function(_0x2f2f32){if(_0x2f2f32){_0x44322b=_0x2f2f32;return _0x2f2f32[_0x74af('0x82')](_0x1a018a[_0x74af('0x46')]['ids'],_[_0x74af('0x4c')](_0x1a018a['body'],[_0x74af('0x63'),'id'])||{});}return null;})[_0x74af('0x64')](function(_0x2637ae){var _0x492815;_0xe4419c=_0x2637ae||[];var _0xfcfb10=[];if(_0x2637ae){for(var _0x439555=0x0;_0x439555<_0x2637ae['length'];_0x439555+=0x1){var _0x199f02=_0x2637ae[_0x439555]['get']({'plain':!![]});_0x492815=squel[_0x74af('0x7a')]()[_0x74af('0x7b')]('cm_hopper_black')['fromQuery']([_0x74af('0x6e'),_0x74af('0x6a'),_0x74af('0x6b'),_0x74af('0x58'),_0x74af('0x4d'),'updatedAt'],squel[_0x74af('0x6c')]()[_0x74af('0x6d')](_0x74af('0x6e'),_0x74af('0x6e'))[_0x74af('0x6d')]('id','ContactId')[_0x74af('0x6d')](_0x199f02['CmListId']['toString'](),'ListId')['field'](_0x1a018a['params']['id'][_0x74af('0x70')](),_0x74af('0x58'))['field'](_0x74af('0x71'),_0x74af('0x4d'))[_0x74af('0x6d')](_0x74af('0x71'),_0x74af('0x4e'))[_0x74af('0x78')](_0x74af('0x72'))[_0x74af('0x39')](_0x74af('0x7d'))[_0x74af('0x39')]('ListId\x20=\x20?',_0x199f02[_0x74af('0x6f')]['toString']())[_0x74af('0x39')](_0x74af('0x73')))[_0x74af('0x70')]();_0xfcfb10[_0x74af('0x7e')](db[_0x74af('0x7f')][_0x74af('0x30')](_0x492815));}return BPromise[_0x74af('0x80')](_0xfcfb10);}})['then'](function(){return _0xe4419c;})['then'](respondWithResult(_0x18a808,null))[_0x74af('0x3e')](handleError(_0x18a808,null));};exports[_0x74af('0x83')]=function(_0x5a3d51,_0x38b1fd,_0x21173c){return db[_0x74af('0x2a')]['find']({'where':{'id':_0x5a3d51[_0x74af('0x40')]['id']}})[_0x74af('0x22')](handleEntityNotFound(_0x38b1fd,null))[_0x74af('0x22')](function(_0x2a9091){if(_0x2a9091){return _0x2a9091['removeBlackLists'](_0x5a3d51[_0x74af('0x30')][_0x74af('0x63')]);}})[_0x74af('0x22')](function(_0xaf4fd0){if(_0xaf4fd0){return db[_0x74af('0x5f')][_0x74af('0x23')]({'where':{'ListId':_0x5a3d51['query'][_0x74af('0x63')],'CampaignId':_0x5a3d51[_0x74af('0x40')]['id']}})[_0x74af('0x22')](function(){return _0xaf4fd0;});}})['then'](respondWithStatusCode(_0x38b1fd,null))[_0x74af('0x3e')](handleError(_0x38b1fd,null));}; \ No newline at end of file +var _0xe06b=['type','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','error','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','CmHopper','order','pick','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','hasOwnProperty','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','sequelize','all','removeLists','getBlackLists','CmList','cm_hopper_black','push','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','name','send','index','map','Campaign','rawAttributes'];(function(_0x17ccdb,_0x3aead1){var _0x4bbe6c=function(_0x2804cc){while(--_0x2804cc){_0x17ccdb['push'](_0x17ccdb['shift']());}};_0x4bbe6c(++_0x3aead1);}(_0xe06b,0xe2));var _0xbe06=function(_0xcf56fa,_0x49b307){_0xcf56fa=_0xcf56fa-0x0;var _0x5946a3=_0xe06b[_0xcf56fa];return _0x5946a3;};'use strict';var pdf=require(_0xbe06('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe06('0x1'));var zipdir=require(_0xbe06('0x2'));var jsonpatch=require(_0xbe06('0x3'));var rp=require(_0xbe06('0x4'));var moment=require(_0xbe06('0x5'));var BPromise=require(_0xbe06('0x6'));var Mustache=require(_0xbe06('0x7'));var util=require(_0xbe06('0x8'));var path=require(_0xbe06('0x9'));var sox=require(_0xbe06('0xa'));var csv=require('to-csv');var ejs=require(_0xbe06('0xb'));var fs=require('fs');var _=require(_0xbe06('0xc'));var squel=require(_0xbe06('0xd'));var crypto=require(_0xbe06('0xe'));var jsforce=require(_0xbe06('0xf'));var deskjs=require(_0xbe06('0x10'));var toCsv=require(_0xbe06('0x11'));var querystring=require(_0xbe06('0x12'));var Papa=require(_0xbe06('0x13'));var Redis=require('ioredis');var authService=require(_0xbe06('0x14'));var qs=require(_0xbe06('0x15'));var as=require(_0xbe06('0x16'));var hardwareService=require(_0xbe06('0x17'));var logger=require('../../config/logger')(_0xbe06('0x18'));var utils=require('../../config/utils');var config=require(_0xbe06('0x19'));var db=require(_0xbe06('0x1a'))['db'];function respondWithStatusCode(_0x16f745,_0xe5a006){_0xe5a006=_0xe5a006||0xcc;return function(_0x59ae6b){if(_0x59ae6b){return _0x16f745[_0xbe06('0x1b')](_0xe5a006);}return _0x16f745[_0xbe06('0x1c')](_0xe5a006)['end']();};}function respondWithResult(_0x5f5a0e,_0x375ee6){_0x375ee6=_0x375ee6||0xc8;return function(_0x5d522c){if(_0x5d522c){return _0x5f5a0e[_0xbe06('0x1c')](_0x375ee6)[_0xbe06('0x1d')](_0x5d522c);}};}function respondWithFilteredResult(_0xc4294,_0x51df67){return function(_0x20ba38){if(_0x20ba38){var _0x1dfb17=_0x20ba38[_0xbe06('0x1e')],_0x5f478a=_0x51df67[_0xbe06('0x1f')],_0x41bd39=_0x51df67[_0xbe06('0x1f')]+_0x51df67[_0xbe06('0x20')],_0x5a51fe;if(_0x41bd39>=_0x1dfb17){_0x41bd39=_0x1dfb17;_0x5a51fe=0xc8;}else{_0x5a51fe=0xce;}_0xc4294[_0xbe06('0x1c')](_0x5a51fe);return _0xc4294['set'](_0xbe06('0x21'),_0x5f478a+'-'+_0x41bd39+'/'+_0x1dfb17)[_0xbe06('0x1d')](_0x20ba38);}return null;};}function patchUpdates(_0x2e271e){return function(_0x3412e1){try{jsonpatch[_0xbe06('0x22')](_0x3412e1,_0x2e271e,!![]);}catch(_0x4241be){return BPromise[_0xbe06('0x23')](_0x4241be);}return _0x3412e1[_0xbe06('0x24')]();};}function saveUpdates(_0x340eeb,_0x2187a8){return function(_0x36a74b){if(_0x36a74b){return _0x36a74b['update'](_0x340eeb)[_0xbe06('0x25')](function(_0x44b910){return _0x44b910;});}return null;};}function removeEntity(_0x2fc50d,_0x47c13f){return function(_0x6ada9a){if(_0x6ada9a){return _0x6ada9a[_0xbe06('0x26')]()[_0xbe06('0x25')](function(){var _0x3850ee=_0x6ada9a[_0xbe06('0x27')]({'plain':!![]});var _0x48f7f7='IvrCampaigns';return db[_0xbe06('0x28')][_0xbe06('0x26')]({'where':{'type':_0x48f7f7,'resourceId':_0x3850ee['id']}})[_0xbe06('0x25')](function(){return _0x6ada9a;});})[_0xbe06('0x25')](function(){_0x2fc50d[_0xbe06('0x1c')](0xcc)[_0xbe06('0x29')]();});}};}function handleEntityNotFound(_0x358850,_0x397239){return function(_0x3e8c15){if(!_0x3e8c15){_0x358850['sendStatus'](0x194);}return _0x3e8c15;};}function handleError(_0x2418d7,_0x2f7569){_0x2f7569=_0x2f7569||0x1f4;return function(_0x5d4d2a){logger['error'](_0x5d4d2a['stack']);if(_0x5d4d2a[_0xbe06('0x2a')]){delete _0x5d4d2a['name'];}_0x2418d7['status'](_0x2f7569)[_0xbe06('0x2b')](_0x5d4d2a);};}exports[_0xbe06('0x2c')]=function(_0x96909f,_0x1c4547){var _0x53b20e={},_0x4c9d37={},_0x5cc990={'count':0x0,'rows':[]};var _0x38ef68=_[_0xbe06('0x2d')](db[_0xbe06('0x2e')][_0xbe06('0x2f')],function(_0x58c8fd){return{'name':_0x58c8fd['fieldName'],'type':_0x58c8fd[_0xbe06('0x30')]['key']};});_0x4c9d37[_0xbe06('0x31')]=_['map'](_0x38ef68,_0xbe06('0x2a'));_0x4c9d37[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0x96909f[_0xbe06('0x32')]);_0x4c9d37['filters']=_['intersection'](_0x4c9d37[_0xbe06('0x31')],_0x4c9d37[_0xbe06('0x32')]);_0x53b20e[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0x4c9d37[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x96909f[_0xbe06('0x32')]['fields']));_0x53b20e['attributes']=_0x53b20e['attributes'][_0xbe06('0x37')]?_0x53b20e[_0xbe06('0x34')]:_0x4c9d37[_0xbe06('0x31')];if(!_0x96909f['query']['hasOwnProperty'](_0xbe06('0x38'))){_0x53b20e[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x96909f[_0xbe06('0x32')][_0xbe06('0x20')]);_0x53b20e[_0xbe06('0x1f')]=qs['offset'](_0x96909f['query'][_0xbe06('0x1f')]);}_0x53b20e['order']=qs[_0xbe06('0x39')](_0x96909f['query'][_0xbe06('0x39')]);_0x53b20e[_0xbe06('0x3a')]=qs[_0xbe06('0x3b')](_['pick'](_0x96909f['query'],_0x4c9d37['filters']),_0x38ef68);if(_0x96909f[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x53b20e[_0xbe06('0x3a')]=_[_0xbe06('0x3d')](_0x53b20e[_0xbe06('0x3a')],{'$or':_[_0xbe06('0x2d')](_0x38ef68,function(_0x3b5cfd){if(_0x3b5cfd[_0xbe06('0x30')]!==_0xbe06('0x3e')){var _0x1f37cd={};_0x1f37cd[_0x3b5cfd[_0xbe06('0x2a')]]={'$like':'%'+_0x96909f[_0xbe06('0x32')][_0xbe06('0x3c')]+'%'};return _0x1f37cd;}})});}_0x53b20e=_[_0xbe06('0x3d')]({},_0x53b20e,_0x96909f[_0xbe06('0x3f')]);var _0x5a8447={'where':_0x53b20e[_0xbe06('0x3a')]};return db[_0xbe06('0x2e')][_0xbe06('0x1e')](_0x5a8447)[_0xbe06('0x25')](function(_0x2db11a){_0x5cc990['count']=_0x2db11a;if(_0x96909f['query']['includeAll']){_0x53b20e['include']=[{'all':!![]}];}return db[_0xbe06('0x2e')][_0xbe06('0x40')](_0x53b20e);})['then'](function(_0x32e359){_0x5cc990[_0xbe06('0x41')]=_0x32e359;return _0x5cc990;})['then'](respondWithFilteredResult(_0x1c4547,_0x53b20e))[_0xbe06('0x42')](handleError(_0x1c4547,null));};exports['show']=function(_0x83b70f,_0xeed7a3){var _0x58fde1={'raw':![],'where':{'id':_0x83b70f['params']['id']}},_0x4b89ca={};_0x4b89ca[_0xbe06('0x31')]=_[_0xbe06('0x33')](db['Campaign'][_0xbe06('0x2f')]);_0x4b89ca['query']=_[_0xbe06('0x33')](_0x83b70f[_0xbe06('0x32')]);_0x4b89ca[_0xbe06('0x3b')]=_['intersection'](_0x4b89ca[_0xbe06('0x31')],_0x4b89ca[_0xbe06('0x32')]);_0x58fde1['attributes']=_[_0xbe06('0x35')](_0x4b89ca[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x83b70f[_0xbe06('0x32')][_0xbe06('0x36')]));_0x58fde1[_0xbe06('0x34')]=_0x58fde1[_0xbe06('0x34')]['length']?_0x58fde1[_0xbe06('0x34')]:_0x4b89ca['model'];if(_0x83b70f[_0xbe06('0x32')][_0xbe06('0x43')]){_0x58fde1[_0xbe06('0x44')]=[{'all':!![]}];}_0x58fde1=_[_0xbe06('0x3d')]({},_0x58fde1,_0x83b70f['options']);return db[_0xbe06('0x2e')]['find'](_0x58fde1)['then'](handleEntityNotFound(_0xeed7a3,null))[_0xbe06('0x25')](respondWithResult(_0xeed7a3,null))[_0xbe06('0x42')](handleError(_0xeed7a3,null));};exports[_0xbe06('0x45')]=function(_0x23c0fb,_0x9e87da){return db[_0xbe06('0x2e')][_0xbe06('0x45')](_0x23c0fb[_0xbe06('0x46')],{})[_0xbe06('0x25')](function(_0x5e1667){var _0x3796fd=_0x23c0fb[_0xbe06('0x47')][_0xbe06('0x27')]({'plain':!![]});if(!_0x3796fd)throw new Error(_0xbe06('0x48'));if(_0x3796fd[_0xbe06('0x49')]==='user'){var _0xfe6020=_0x5e1667[_0xbe06('0x27')]({'plain':!![]});var _0x31ba7e=_0xbe06('0x4a');return db[_0xbe06('0x4b')][_0xbe06('0x4c')]({'where':{'name':_0x31ba7e,'userProfileId':_0x3796fd[_0xbe06('0x4d')]},'raw':!![]})['then'](function(_0x1a2e95){if(_0x1a2e95&&_0x1a2e95[_0xbe06('0x4e')]===0x0){return db[_0xbe06('0x28')][_0xbe06('0x45')]({'name':_0xfe6020['name'],'resourceId':_0xfe6020['id'],'type':_0x1a2e95[_0xbe06('0x2a')],'sectionId':_0x1a2e95['id']},{})['then'](function(){return _0x5e1667;});}else{return _0x5e1667;}})[_0xbe06('0x42')](function(_0x11fde4){logger[_0xbe06('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11fde4);throw _0x11fde4;});}return _0x5e1667;})[_0xbe06('0x25')](respondWithResult(_0x9e87da,0xc9))[_0xbe06('0x42')](handleError(_0x9e87da,null));};exports[_0xbe06('0x50')]=function(_0x28bd00,_0x256f24){var _0x2d2bb0={'where':{'id':_0x28bd00['params']['id']}},_0x22ea45={};_0x22ea45['model']=_['keys'](db[_0xbe06('0x2e')][_0xbe06('0x2f')]);_0x2d2bb0[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0x22ea45[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x28bd00[_0xbe06('0x32')][_0xbe06('0x36')]));_0x2d2bb0[_0xbe06('0x34')]=_0x2d2bb0['attributes'][_0xbe06('0x37')]?_0x2d2bb0[_0xbe06('0x34')]:_0x22ea45[_0xbe06('0x31')];if(_0x28bd00[_0xbe06('0x32')][_0xbe06('0x43')]){_0x2d2bb0[_0xbe06('0x44')]=[{'all':!![]}];}_0x2d2bb0=_[_0xbe06('0x3d')]({},_0x2d2bb0,_0x28bd00[_0xbe06('0x3f')]);return db[_0xbe06('0x2e')][_0xbe06('0x4c')](_0x2d2bb0)['then'](handleEntityNotFound(_0x256f24,null))['then'](function(_0x1e2ce9){if(_0x1e2ce9){var _0x35e682=_0x1e2ce9['get']({'plain':!![]});_0x35e682=qs[_0xbe06('0x51')](_0x35e682,['id','createdAt',_0xbe06('0x52')]);_0x28bd00[_0xbe06('0x46')]=_[_0xbe06('0x51')](_0x28bd00[_0xbe06('0x46')],['id',_0xbe06('0x53'),'updatedAt']);return db[_0xbe06('0x2e')]['create'](_[_0xbe06('0x3d')](_0x35e682,_0x28bd00[_0xbe06('0x46')]),{'include':_0x28bd00['query']['includeAll']?[{'all':!![]}]:undefined})[_0xbe06('0x25')](function(_0x1c4fe2){var _0x2e2562=_0x28bd00[_0xbe06('0x47')]['get']({'plain':!![]});if(!_0x2e2562)throw new Error(_0xbe06('0x48'));if(_0x2e2562[_0xbe06('0x49')]===_0xbe06('0x47')){var _0x26ed56=_0x1c4fe2['get']({'plain':!![]});var _0x3a7234=_0xbe06('0x4a');return db[_0xbe06('0x4b')][_0xbe06('0x4c')]({'where':{'name':_0x3a7234,'userProfileId':_0x2e2562[_0xbe06('0x4d')]},'raw':!![]})[_0xbe06('0x25')](function(_0x288bcd){if(_0x288bcd&&_0x288bcd[_0xbe06('0x4e')]===0x0){return db['UserProfileResource'][_0xbe06('0x45')]({'name':_0x26ed56[_0xbe06('0x2a')],'resourceId':_0x26ed56['id'],'type':_0x288bcd['name'],'sectionId':_0x288bcd['id']},{})[_0xbe06('0x25')](function(){return _0x1c4fe2;});}else{return _0x1c4fe2;}})[_0xbe06('0x42')](function(_0x2900ee){logger['error'](_0xbe06('0x54'),_0x2900ee);throw _0x2900ee;});}return _0x1c4fe2;});}})['then'](respondWithResult(_0x256f24,0xc9))[_0xbe06('0x42')](handleError(_0x256f24,null));};exports[_0xbe06('0x55')]=function(_0xf8199c,_0x380843){if(_0xf8199c[_0xbe06('0x46')]['id']){delete _0xf8199c['body']['id'];}return db['Campaign'][_0xbe06('0x4c')]({'where':{'id':_0xf8199c['params']['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x380843,null))['then'](saveUpdates(_0xf8199c[_0xbe06('0x46')],null))[_0xbe06('0x25')](respondWithResult(_0x380843,null))[_0xbe06('0x42')](handleError(_0x380843,null));};exports[_0xbe06('0x26')]=function(_0x216f50,_0x2245df){return db[_0xbe06('0x2e')][_0xbe06('0x4c')]({'where':{'id':_0x216f50[_0xbe06('0x56')]['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x2245df,null))[_0xbe06('0x25')](removeEntity(_0x2245df,null))['catch'](handleError(_0x2245df,null));};exports[_0xbe06('0x57')]=function(_0x4d08d5,_0x436cc3,_0x27f3d9){var _0x47e86c={'raw':!![],'where':{}};var _0x39b8d2={};var _0x4f0202={'count':0x0,'rows':[]};return db[_0xbe06('0x2e')]['findOne']({'where':{'id':_0x4d08d5[_0xbe06('0x56')]['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x436cc3,null))[_0xbe06('0x25')](function(_0x5bb086){if(_0x5bb086){_0x39b8d2[_0xbe06('0x31')]=_[_0xbe06('0x33')](db[_0xbe06('0x58')][_0xbe06('0x2f')]);_0x39b8d2[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0x4d08d5[_0xbe06('0x32')]);_0x39b8d2[_0xbe06('0x3b')]=_['intersection'](_0x39b8d2[_0xbe06('0x31')],_0x39b8d2[_0xbe06('0x32')]);_0x47e86c[_0xbe06('0x34')]=_['intersection'](_0x39b8d2[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x4d08d5[_0xbe06('0x32')][_0xbe06('0x36')]));_0x47e86c[_0xbe06('0x34')]=_0x47e86c[_0xbe06('0x34')][_0xbe06('0x37')]?_0x47e86c[_0xbe06('0x34')]:_0x39b8d2[_0xbe06('0x31')];if(!_0x4d08d5[_0xbe06('0x32')]['hasOwnProperty'](_0xbe06('0x38'))){_0x47e86c[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x4d08d5[_0xbe06('0x32')][_0xbe06('0x20')]);_0x47e86c[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0x4d08d5[_0xbe06('0x32')][_0xbe06('0x1f')]);}_0x47e86c[_0xbe06('0x59')]=qs[_0xbe06('0x39')](_0x4d08d5[_0xbe06('0x32')]['sort']);_0x47e86c[_0xbe06('0x3a')]=qs[_0xbe06('0x3b')](_[_0xbe06('0x5a')](_0x4d08d5[_0xbe06('0x32')],_0x39b8d2['filters']));_0x47e86c[_0xbe06('0x3a')][_0xbe06('0x5b')]=_0x5bb086['id'];if(_0x4d08d5[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x47e86c[_0xbe06('0x3a')]=_[_0xbe06('0x3d')](_0x47e86c[_0xbe06('0x3a')],{'$or':_['map'](_0x47e86c[_0xbe06('0x34')],function(_0x313ad0){var _0x1eb40d={};_0x1eb40d[_0x313ad0]={'$like':'%'+_0x4d08d5[_0xbe06('0x32')][_0xbe06('0x3c')]+'%'};return _0x1eb40d;})});}_0x47e86c=_[_0xbe06('0x3d')]({},_0x47e86c,_0x4d08d5[_0xbe06('0x3f')]);return db[_0xbe06('0x58')][_0xbe06('0x1e')]({'where':_0x47e86c[_0xbe06('0x3a')]})[_0xbe06('0x25')](function(_0x3fd509){_0x4f0202['count']=_0x3fd509;if(_0x4d08d5[_0xbe06('0x32')]['includeAll']){_0x47e86c['include']=[{'all':!![]}];}return db[_0xbe06('0x58')]['findAll'](_0x47e86c);})[_0xbe06('0x25')](function(_0x3aac9b){_0x4f0202[_0xbe06('0x41')]=_0x3aac9b;return _0x4f0202;});}})[_0xbe06('0x25')](respondWithFilteredResult(_0x436cc3,_0x47e86c))[_0xbe06('0x42')](handleError(_0x436cc3,null));};exports[_0xbe06('0x5c')]=function(_0x1c4ea2,_0x436ecf,_0x432fa3){var _0x5565b2={'raw':!![],'where':{}};var _0x3409b={};var _0x8349cf={'count':0x0,'rows':[]};return db[_0xbe06('0x2e')][_0xbe06('0x5d')]({'where':{'id':_0x1c4ea2['params']['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x436ecf,null))['then'](function(_0x190288){if(_0x190288){_0x3409b[_0xbe06('0x31')]=_['keys'](db['CmHopperHistory'][_0xbe06('0x2f')]);_0x3409b[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0x1c4ea2[_0xbe06('0x32')]);_0x3409b[_0xbe06('0x3b')]=_[_0xbe06('0x35')](_0x3409b[_0xbe06('0x31')],_0x3409b[_0xbe06('0x32')]);_0x5565b2[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0x3409b['model'],qs['fields'](_0x1c4ea2[_0xbe06('0x32')]['fields']));_0x5565b2[_0xbe06('0x34')]=_0x5565b2['attributes'][_0xbe06('0x37')]?_0x5565b2['attributes']:_0x3409b[_0xbe06('0x31')];if(!_0x1c4ea2[_0xbe06('0x32')]['hasOwnProperty'](_0xbe06('0x38'))){_0x5565b2[_0xbe06('0x20')]=qs['limit'](_0x1c4ea2[_0xbe06('0x32')][_0xbe06('0x20')]);_0x5565b2['offset']=qs['offset'](_0x1c4ea2[_0xbe06('0x32')][_0xbe06('0x1f')]);}_0x5565b2[_0xbe06('0x59')]=qs[_0xbe06('0x39')](_0x1c4ea2[_0xbe06('0x32')][_0xbe06('0x39')]);_0x5565b2['where']=qs[_0xbe06('0x3b')](_['pick'](_0x1c4ea2[_0xbe06('0x32')],_0x3409b[_0xbe06('0x3b')]));_0x5565b2[_0xbe06('0x3a')][_0xbe06('0x5b')]=_0x190288['id'];if(_0x1c4ea2[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x5565b2[_0xbe06('0x3a')]=_[_0xbe06('0x3d')](_0x5565b2[_0xbe06('0x3a')],{'$or':_[_0xbe06('0x2d')](_0x5565b2[_0xbe06('0x34')],function(_0x34af05){var _0x45bfe9={};_0x45bfe9[_0x34af05]={'$like':'%'+_0x1c4ea2[_0xbe06('0x32')][_0xbe06('0x3c')]+'%'};return _0x45bfe9;})});}_0x5565b2=_[_0xbe06('0x3d')]({},_0x5565b2,_0x1c4ea2[_0xbe06('0x3f')]);return db[_0xbe06('0x5e')]['count']({'where':_0x5565b2[_0xbe06('0x3a')]})[_0xbe06('0x25')](function(_0x1ed4cd){_0x8349cf['count']=_0x1ed4cd;if(_0x1c4ea2['query'][_0xbe06('0x43')]){_0x5565b2[_0xbe06('0x44')]=[{'all':!![]}];}return db[_0xbe06('0x5e')][_0xbe06('0x40')](_0x5565b2);})[_0xbe06('0x25')](function(_0x33656d){_0x8349cf['rows']=_0x33656d;return _0x8349cf;});}})[_0xbe06('0x25')](respondWithFilteredResult(_0x436ecf,_0x5565b2))[_0xbe06('0x42')](handleError(_0x436ecf,null));};exports[_0xbe06('0x5f')]=function(_0x278fc1,_0x32bbd2,_0x136b48){var _0x150754={'raw':!![],'where':{}};var _0x4bf033={};var _0x50ed85={'count':0x0,'rows':[]};return db[_0xbe06('0x2e')][_0xbe06('0x5d')]({'where':{'id':_0x278fc1[_0xbe06('0x56')]['id']}})['then'](handleEntityNotFound(_0x32bbd2,null))[_0xbe06('0x25')](function(_0x55c800){if(_0x55c800){_0x4bf033['model']=_[_0xbe06('0x33')](db[_0xbe06('0x60')]['rawAttributes']);_0x4bf033[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0x278fc1[_0xbe06('0x32')]);_0x4bf033['filters']=_['intersection'](_0x4bf033[_0xbe06('0x31')],_0x4bf033[_0xbe06('0x32')]);_0x150754[_0xbe06('0x34')]=_['intersection'](_0x4bf033[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x278fc1[_0xbe06('0x32')][_0xbe06('0x36')]));_0x150754[_0xbe06('0x34')]=_0x150754[_0xbe06('0x34')]['length']?_0x150754['attributes']:_0x4bf033[_0xbe06('0x31')];if(!_0x278fc1[_0xbe06('0x32')]['hasOwnProperty'](_0xbe06('0x38'))){_0x150754[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x278fc1[_0xbe06('0x32')]['limit']);_0x150754[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0x278fc1[_0xbe06('0x32')][_0xbe06('0x1f')]);}_0x150754['order']=qs['sort'](_0x278fc1[_0xbe06('0x32')]['sort']);_0x150754[_0xbe06('0x3a')]=qs['filters'](_[_0xbe06('0x5a')](_0x278fc1[_0xbe06('0x32')],_0x4bf033[_0xbe06('0x3b')]));_0x150754[_0xbe06('0x3a')][_0xbe06('0x5b')]=_0x55c800['id'];if(_0x278fc1[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x150754[_0xbe06('0x3a')]=_['merge'](_0x150754[_0xbe06('0x3a')],{'$or':_[_0xbe06('0x2d')](_0x150754[_0xbe06('0x34')],function(_0x547e09){var _0x2e926e={};_0x2e926e[_0x547e09]={'$like':'%'+_0x278fc1['query'][_0xbe06('0x3c')]+'%'};return _0x2e926e;})});}_0x150754=_[_0xbe06('0x3d')]({},_0x150754,_0x278fc1[_0xbe06('0x3f')]);return db[_0xbe06('0x60')][_0xbe06('0x1e')]({'where':_0x150754[_0xbe06('0x3a')]})['then'](function(_0x5cf285){_0x50ed85[_0xbe06('0x1e')]=_0x5cf285;if(_0x278fc1[_0xbe06('0x32')][_0xbe06('0x43')]){_0x150754[_0xbe06('0x44')]=[{'all':!![]}];}return db[_0xbe06('0x60')][_0xbe06('0x40')](_0x150754);})[_0xbe06('0x25')](function(_0x2444f2){_0x50ed85[_0xbe06('0x41')]=_0x2444f2;return _0x50ed85;});}})['then'](respondWithFilteredResult(_0x32bbd2,_0x150754))[_0xbe06('0x42')](handleError(_0x32bbd2,null));};exports[_0xbe06('0x61')]=function(_0xa239d5,_0x470304,_0x1b3e6a){var _0x408f80={'raw':!![],'where':{}};var _0xc72869={};var _0x2f3287={'count':0x0,'rows':[]};return db[_0xbe06('0x2e')][_0xbe06('0x5d')]({'where':{'id':_0xa239d5[_0xbe06('0x56')]['id']}})['then'](handleEntityNotFound(_0x470304,null))[_0xbe06('0x25')](function(_0x743edd){if(_0x743edd){_0xc72869[_0xbe06('0x31')]=_['keys'](db[_0xbe06('0x62')]['rawAttributes']);_0xc72869[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0xa239d5[_0xbe06('0x32')]);_0xc72869[_0xbe06('0x3b')]=_[_0xbe06('0x35')](_0xc72869[_0xbe06('0x31')],_0xc72869[_0xbe06('0x32')]);_0x408f80[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0xc72869[_0xbe06('0x31')],qs['fields'](_0xa239d5['query'][_0xbe06('0x36')]));_0x408f80[_0xbe06('0x34')]=_0x408f80['attributes'][_0xbe06('0x37')]?_0x408f80['attributes']:_0xc72869['model'];if(!_0xa239d5[_0xbe06('0x32')][_0xbe06('0x63')](_0xbe06('0x38'))){_0x408f80['limit']=qs[_0xbe06('0x20')](_0xa239d5['query']['limit']);_0x408f80[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0xa239d5[_0xbe06('0x32')][_0xbe06('0x1f')]);}_0x408f80[_0xbe06('0x59')]=qs['sort'](_0xa239d5[_0xbe06('0x32')][_0xbe06('0x39')]);_0x408f80['where']=qs['filters'](_['pick'](_0xa239d5[_0xbe06('0x32')],_0xc72869['filters']));_0x408f80[_0xbe06('0x3a')][_0xbe06('0x5b')]=_0x743edd['id'];if(_0xa239d5[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x408f80[_0xbe06('0x3a')]=_[_0xbe06('0x3d')](_0x408f80[_0xbe06('0x3a')],{'$or':_[_0xbe06('0x2d')](_0x408f80[_0xbe06('0x34')],function(_0xbe11ef){var _0x37f3ee={};_0x37f3ee[_0xbe11ef]={'$like':'%'+_0xa239d5[_0xbe06('0x32')][_0xbe06('0x3c')]+'%'};return _0x37f3ee;})});}_0x408f80=_[_0xbe06('0x3d')]({},_0x408f80,_0xa239d5['options']);return db[_0xbe06('0x62')][_0xbe06('0x1e')]({'where':_0x408f80[_0xbe06('0x3a')]})[_0xbe06('0x25')](function(_0x480e3d){_0x2f3287[_0xbe06('0x1e')]=_0x480e3d;if(_0xa239d5[_0xbe06('0x32')][_0xbe06('0x43')]){_0x408f80[_0xbe06('0x44')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xbe06('0x40')](_0x408f80);})['then'](function(_0x2c6aa2){_0x2f3287[_0xbe06('0x41')]=_0x2c6aa2;return _0x2f3287;});}})[_0xbe06('0x25')](respondWithFilteredResult(_0x470304,_0x408f80))[_0xbe06('0x42')](handleError(_0x470304,null));};exports[_0xbe06('0x64')]=function(_0xf356d2,_0x1a53c7,_0x1cc7cd){var _0x27f1d9={};var _0x54ba3f={};var _0x4dc481;var _0xe55d7a;return db['Campaign']['findOne']({'where':{'id':_0xf356d2[_0xbe06('0x56')]['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x1a53c7,null))[_0xbe06('0x25')](function(_0x3c587a){if(_0x3c587a){_0x4dc481=_0x3c587a;_0x54ba3f[_0xbe06('0x31')]=_['keys'](db['CmList']['rawAttributes']);_0x54ba3f[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0xf356d2[_0xbe06('0x32')]);_0x54ba3f[_0xbe06('0x3b')]=_[_0xbe06('0x35')](_0x54ba3f[_0xbe06('0x31')],_0x54ba3f[_0xbe06('0x32')]);_0x27f1d9[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0x54ba3f[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0xf356d2[_0xbe06('0x32')][_0xbe06('0x36')]));_0x27f1d9['attributes']=_0x27f1d9[_0xbe06('0x34')][_0xbe06('0x37')]?_0x27f1d9[_0xbe06('0x34')]:_0x54ba3f[_0xbe06('0x31')];_0x27f1d9[_0xbe06('0x59')]=qs['sort'](_0xf356d2[_0xbe06('0x32')][_0xbe06('0x39')]);_0x27f1d9[_0xbe06('0x3a')]=qs[_0xbe06('0x3b')](_['pick'](_0xf356d2[_0xbe06('0x32')],_0x54ba3f[_0xbe06('0x3b')]));if(_0xf356d2[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x27f1d9['where']=_[_0xbe06('0x3d')](_0x27f1d9[_0xbe06('0x3a')],{'$or':_[_0xbe06('0x2d')](_0x27f1d9['attributes'],function(_0xbd46fa){var _0x5310a9={};_0x5310a9[_0xbd46fa]={'$like':'%'+_0xf356d2['query'][_0xbe06('0x3c')]+'%'};return _0x5310a9;})});}_0x27f1d9=_[_0xbe06('0x3d')]({},_0x27f1d9,_0xf356d2[_0xbe06('0x3f')]);return _0x4dc481[_0xbe06('0x64')](_0x27f1d9);}})[_0xbe06('0x25')](function(_0xbe912e){if(_0xbe912e){_0xe55d7a=_0xbe912e[_0xbe06('0x37')];if(!_0xf356d2[_0xbe06('0x32')]['hasOwnProperty'](_0xbe06('0x38'))){_0x27f1d9[_0xbe06('0x20')]=qs['limit'](_0xf356d2[_0xbe06('0x32')][_0xbe06('0x20')]);_0x27f1d9[_0xbe06('0x1f')]=qs[_0xbe06('0x1f')](_0xf356d2[_0xbe06('0x32')]['offset']);}return _0x4dc481['getLists'](_0x27f1d9);}})[_0xbe06('0x25')](function(_0x36f53d){if(_0x36f53d){return _0x36f53d?{'count':_0xe55d7a,'rows':_0x36f53d}:null;}})[_0xbe06('0x25')](respondWithResult(_0x1a53c7,null))['catch'](handleError(_0x1a53c7,null));};exports['addLists']=function(_0x254b82,_0x4ef3eb,_0x435b2a){var _0x14f8bf,_0x45bce9;return db['Campaign'][_0xbe06('0x4c')]({'where':{'id':_0x254b82['params']['id']}})['then'](handleEntityNotFound(_0x4ef3eb,null))['then'](function(_0x421855){if(_0x421855){_0x45bce9=_0x421855;return _0x421855[_0xbe06('0x65')](_0x254b82[_0xbe06('0x46')]['ids'],_[_0xbe06('0x51')](_0x254b82[_0xbe06('0x46')],[_0xbe06('0x66'),'id'])||{});}return null;})['spread'](function(_0x41429f){var _0xe66ed9;_0x14f8bf=_0x41429f||[];var _0x4e3c64=[];if(_0x41429f){for(var _0x1130c8=0x0;_0x1130c8<_0x41429f[_0xbe06('0x37')];_0x1130c8+=0x1){var _0x1c3c2e=_0x41429f[_0x1130c8][_0xbe06('0x27')]({'plain':!![]});_0x45bce9[_0xbe06('0x67')]=_0x254b82['body'][_0xbe06('0x67')]?_0x254b82[_0xbe06('0x46')]['dialCheckDuplicateType']:_0x45bce9[_0xbe06('0x67')];switch(_0x45bce9[_0xbe06('0x67')]){case _0xbe06('0x68'):_0xe66ed9=squel[_0xbe06('0x69')]()[_0xbe06('0x6a')](_0xbe06('0x6b'))[_0xbe06('0x6c')]([_0xbe06('0x6d'),_0xbe06('0x6e'),'ContactId',_0xbe06('0x6f'),'CampaignId','createdAt','updatedAt'],squel[_0xbe06('0x70')]()[_0xbe06('0x71')](_0xbe06('0x6d'),_0xbe06('0x6d'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x6e'))[_0xbe06('0x71')]('id',_0xbe06('0x73'))[_0xbe06('0x71')](_0x1c3c2e[_0xbe06('0x74')][_0xbe06('0x75')](),'ListId')[_0xbe06('0x71')](_0x254b82['params']['id'][_0xbe06('0x75')](),_0xbe06('0x5b'))[_0xbe06('0x71')]('NOW()',_0xbe06('0x53'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x52'))[_0xbe06('0x76')](_0xbe06('0x77'))[_0xbe06('0x3a')](_0xbe06('0x78'))['where']('ListId\x20=\x20?',_0x1c3c2e[_0xbe06('0x74')][_0xbe06('0x75')]())[_0xbe06('0x3a')](_0xbe06('0x79'))[_0xbe06('0x3a')](_0xbe06('0x7a'),squel[_0xbe06('0x70')]()[_0xbe06('0x71')](_0xbe06('0x7b'))['from'](_0xbe06('0x7c'))[_0xbe06('0x3a')]('CampaignId\x20=\x20?',_0x254b82[_0xbe06('0x56')]['id'][_0xbe06('0x75')]()))[_0xbe06('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbe06('0x70')]()[_0xbe06('0x71')](_0xbe06('0x7d'))[_0xbe06('0x76')](_0xbe06('0x6b'))[_0xbe06('0x3a')](_0xbe06('0x7e'),_0x254b82[_0xbe06('0x56')]['id']['toString']())))['toString']();break;case _0xbe06('0x7f'):_0xe66ed9=squel[_0xbe06('0x69')]()[_0xbe06('0x6a')](_0xbe06('0x6b'))[_0xbe06('0x6c')]([_0xbe06('0x6d'),_0xbe06('0x6e'),_0xbe06('0x73'),'ListId',_0xbe06('0x5b'),_0xbe06('0x53'),'updatedAt'],squel[_0xbe06('0x70')]()[_0xbe06('0x71')]('phone',_0xbe06('0x6d'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x6e'))[_0xbe06('0x71')]('id','ContactId')['field'](_0x1c3c2e[_0xbe06('0x74')]['toString'](),_0xbe06('0x6f'))['field'](_0x254b82[_0xbe06('0x56')]['id'][_0xbe06('0x75')](),_0xbe06('0x5b'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x53'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x52'))[_0xbe06('0x76')](_0xbe06('0x77'))[_0xbe06('0x3a')](_0xbe06('0x78'))[_0xbe06('0x3a')](_0xbe06('0x80'),_0x1c3c2e[_0xbe06('0x74')][_0xbe06('0x75')]())[_0xbe06('0x3a')](_0xbe06('0x79'))[_0xbe06('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbe06('0x70')]()['field'](_0xbe06('0x7d'))['from'](_0xbe06('0x6b'))[_0xbe06('0x3a')]('CampaignId\x20=\x20?',_0x254b82[_0xbe06('0x56')]['id'][_0xbe06('0x75')]())))[_0xbe06('0x75')]();break;default:_0xe66ed9=squel[_0xbe06('0x69')]()['into']('cm_hopper')[_0xbe06('0x6c')]([_0xbe06('0x6d'),_0xbe06('0x6e'),_0xbe06('0x73'),'ListId','CampaignId',_0xbe06('0x53'),_0xbe06('0x52')],squel['select']()['field'](_0xbe06('0x6d'),_0xbe06('0x6d'))['field'](_0xbe06('0x72'),_0xbe06('0x6e'))[_0xbe06('0x71')]('id',_0xbe06('0x73'))[_0xbe06('0x71')](_0x1c3c2e[_0xbe06('0x74')][_0xbe06('0x75')](),'ListId')[_0xbe06('0x71')](_0x254b82['params']['id'][_0xbe06('0x75')](),_0xbe06('0x5b'))[_0xbe06('0x71')](_0xbe06('0x72'),_0xbe06('0x53'))[_0xbe06('0x71')]('NOW()',_0xbe06('0x52'))['from'](_0xbe06('0x77'))[_0xbe06('0x3a')](_0xbe06('0x78'))[_0xbe06('0x3a')](_0xbe06('0x80'),_0x1c3c2e['CmListId'][_0xbe06('0x75')]())[_0xbe06('0x3a')](_0xbe06('0x79')))['toString']();}_0x4e3c64['push'](db[_0xbe06('0x81')][_0xbe06('0x32')](_0xe66ed9));}return BPromise[_0xbe06('0x82')](_0x4e3c64);}})['then'](function(){return _0x14f8bf;})[_0xbe06('0x25')](respondWithResult(_0x4ef3eb,null))['catch'](handleError(_0x4ef3eb,null));};exports[_0xbe06('0x83')]=function(_0x322ebb,_0x180dc1,_0x29ef30){return db[_0xbe06('0x2e')]['find']({'where':{'id':_0x322ebb[_0xbe06('0x56')]['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x180dc1,null))[_0xbe06('0x25')](function(_0x205476){if(_0x205476){return _0x205476[_0xbe06('0x83')](_0x322ebb[_0xbe06('0x32')][_0xbe06('0x66')]);}})[_0xbe06('0x25')](function(_0x938007){if(_0x938007){return db['CmHopper'][_0xbe06('0x26')]({'where':{'ListId':_0x322ebb[_0xbe06('0x32')][_0xbe06('0x66')],'CampaignId':_0x322ebb[_0xbe06('0x56')]['id']}})['then'](function(){return _0x938007;});}})[_0xbe06('0x25')](respondWithStatusCode(_0x180dc1,null))['catch'](handleError(_0x180dc1,null));};exports[_0xbe06('0x84')]=function(_0x106a38,_0x371ced,_0x374b44){var _0x473d1c={'raw':!![],'where':{}};var _0x567150={};var _0xc037dd={'count':0x0,'rows':[]};return db[_0xbe06('0x2e')][_0xbe06('0x5d')]({'where':{'id':_0x106a38[_0xbe06('0x56')]['id']}})['then'](handleEntityNotFound(_0x371ced,null))[_0xbe06('0x25')](function(_0x48dfcd){if(_0x48dfcd){_0x567150[_0xbe06('0x31')]=_[_0xbe06('0x33')](db[_0xbe06('0x85')][_0xbe06('0x2f')]);_0x567150[_0xbe06('0x32')]=_[_0xbe06('0x33')](_0x106a38['query']);_0x567150[_0xbe06('0x3b')]=_[_0xbe06('0x35')](_0x567150[_0xbe06('0x31')],_0x567150[_0xbe06('0x32')]);_0x473d1c[_0xbe06('0x34')]=_[_0xbe06('0x35')](_0x567150[_0xbe06('0x31')],qs[_0xbe06('0x36')](_0x106a38[_0xbe06('0x32')][_0xbe06('0x36')]));_0x473d1c[_0xbe06('0x34')]=_0x473d1c[_0xbe06('0x34')][_0xbe06('0x37')]?_0x473d1c['attributes']:_0x567150['model'];if(!_0x106a38[_0xbe06('0x32')][_0xbe06('0x63')]('nolimit')){_0x473d1c[_0xbe06('0x20')]=qs[_0xbe06('0x20')](_0x106a38[_0xbe06('0x32')][_0xbe06('0x20')]);_0x473d1c['offset']=qs[_0xbe06('0x1f')](_0x106a38[_0xbe06('0x32')][_0xbe06('0x1f')]);}_0x473d1c[_0xbe06('0x59')]=qs[_0xbe06('0x39')](_0x106a38[_0xbe06('0x32')][_0xbe06('0x39')]);_0x473d1c[_0xbe06('0x3a')]=qs[_0xbe06('0x3b')](_[_0xbe06('0x5a')](_0x106a38[_0xbe06('0x32')],_0x567150[_0xbe06('0x3b')]));_0x473d1c[_0xbe06('0x3a')]['CampaignId']=_0x48dfcd['id'];if(_0x106a38[_0xbe06('0x32')][_0xbe06('0x3c')]){_0x473d1c[_0xbe06('0x3a')]=_[_0xbe06('0x3d')](_0x473d1c['where'],{'$or':_[_0xbe06('0x2d')](_0x473d1c[_0xbe06('0x34')],function(_0x247d6f){var _0x2a167c={};_0x2a167c[_0x247d6f]={'$like':'%'+_0x106a38['query'][_0xbe06('0x3c')]+'%'};return _0x2a167c;})});}_0x473d1c=_[_0xbe06('0x3d')]({},_0x473d1c,_0x106a38[_0xbe06('0x3f')]);return db[_0xbe06('0x85')][_0xbe06('0x1e')]({'where':_0x473d1c['where']})['then'](function(_0x1f7021){_0xc037dd[_0xbe06('0x1e')]=_0x1f7021;if(_0x106a38[_0xbe06('0x32')][_0xbe06('0x43')]){_0x473d1c[_0xbe06('0x44')]=[{'all':!![]}];}return db[_0xbe06('0x85')][_0xbe06('0x40')](_0x473d1c);})[_0xbe06('0x25')](function(_0x4d7a10){_0xc037dd[_0xbe06('0x41')]=_0x4d7a10;return _0xc037dd;});}})[_0xbe06('0x25')](respondWithFilteredResult(_0x371ced,_0x473d1c))[_0xbe06('0x42')](handleError(_0x371ced,null));};exports['addBlackLists']=function(_0x2114ec,_0x49d0db,_0x3dee1e){var _0x5a8c16,_0x13dce4;return db[_0xbe06('0x2e')][_0xbe06('0x4c')]({'where':{'id':_0x2114ec[_0xbe06('0x56')]['id']}})[_0xbe06('0x25')](handleEntityNotFound(_0x49d0db,null))[_0xbe06('0x25')](function(_0x963473){if(_0x963473){_0x13dce4=_0x963473;return _0x963473['addBlackLists'](_0x2114ec['body'][_0xbe06('0x66')],_[_0xbe06('0x51')](_0x2114ec['body'],['ids','id'])||{});}return null;})['spread'](function(_0x3fb32d){var _0x1c6423;_0x5a8c16=_0x3fb32d||[];var _0x5568e0=[];if(_0x3fb32d){for(var _0x1131bf=0x0;_0x1131bf<_0x3fb32d[_0xbe06('0x37')];_0x1131bf+=0x1){var _0x39ea78=_0x3fb32d[_0x1131bf][_0xbe06('0x27')]({'plain':!![]});_0x1c6423=squel[_0xbe06('0x69')]()['into'](_0xbe06('0x86'))['fromQuery']([_0xbe06('0x6d'),_0xbe06('0x73'),_0xbe06('0x6f'),_0xbe06('0x5b'),_0xbe06('0x53'),'updatedAt'],squel['select']()[_0xbe06('0x71')](_0xbe06('0x6d'),_0xbe06('0x6d'))[_0xbe06('0x71')]('id',_0xbe06('0x73'))[_0xbe06('0x71')](_0x39ea78[_0xbe06('0x74')][_0xbe06('0x75')](),_0xbe06('0x6f'))[_0xbe06('0x71')](_0x2114ec['params']['id'][_0xbe06('0x75')](),_0xbe06('0x5b'))['field'](_0xbe06('0x72'),'createdAt')[_0xbe06('0x71')](_0xbe06('0x72'),'updatedAt')['from'](_0xbe06('0x77'))[_0xbe06('0x3a')](_0xbe06('0x78'))[_0xbe06('0x3a')](_0xbe06('0x80'),_0x39ea78['CmListId'][_0xbe06('0x75')]())[_0xbe06('0x3a')](_0xbe06('0x79')))[_0xbe06('0x75')]();_0x5568e0[_0xbe06('0x87')](db[_0xbe06('0x81')][_0xbe06('0x32')](_0x1c6423));}return BPromise[_0xbe06('0x82')](_0x5568e0);}})['then'](function(){return _0x5a8c16;})[_0xbe06('0x25')](respondWithResult(_0x49d0db,null))[_0xbe06('0x42')](handleError(_0x49d0db,null));};exports[_0xbe06('0x88')]=function(_0x49ff48,_0x5913dd,_0x2de2d1){return db[_0xbe06('0x2e')]['find']({'where':{'id':_0x49ff48[_0xbe06('0x56')]['id']}})['then'](handleEntityNotFound(_0x5913dd,null))[_0xbe06('0x25')](function(_0x4511fd){if(_0x4511fd){return _0x4511fd[_0xbe06('0x88')](_0x49ff48[_0xbe06('0x32')][_0xbe06('0x66')]);}})[_0xbe06('0x25')](function(_0x348e6d){if(_0x348e6d){return db[_0xbe06('0x62')][_0xbe06('0x26')]({'where':{'ListId':_0x49ff48[_0xbe06('0x32')][_0xbe06('0x66')],'CampaignId':_0x49ff48['params']['id']}})[_0xbe06('0x25')](function(){return _0x348e6d;});}})['then'](respondWithStatusCode(_0x5913dd,null))['catch'](handleError(_0x5913dd,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 1dc9321..211cd00 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x55d61d,_0x12e03a){var _0x16f451=function(_0x24e769){while(--_0x24e769){_0x55d61d['push'](_0x55d61d['shift']());}};_0x16f451(++_0x12e03a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5de97d,_0x1141ee){_0x5de97d=_0x5de97d-0x0;var _0x2da950=_0xb10b[_0x5de97d];return _0x2da950;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('Campaign',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 29bd1a6..c017186 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x40de5d,_0x3943a8){var _0x3bd741=function(_0x404358){while(--_0x404358){_0x40de5d['push'](_0x40de5d['shift']());}};_0x3bd741(++_0x3943a8);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _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(_0x4a2755,_0x466414){var _0x108a5d=function(_0x4e0425){while(--_0x4e0425){_0x4a2755['push'](_0x4a2755['shift']());}};_0x108a5d(++_0x466414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 45d6bd4..be7b466 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 _0xb0e3=['create','/:id/clone','/:id/lists','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0e3,0x113));var _0x3b0e=function(_0x2b0111,_0x43367b){_0x2b0111=_0x2b0111-0x0;var _0x22397b=_0xb0e3[_0x2b0111];return _0x22397b;};'use strict';var multer=require(_0x3b0e('0x0'));var util=require(_0x3b0e('0x1'));var path=require(_0x3b0e('0x2'));var timeout=require(_0x3b0e('0x3'));var express=require(_0x3b0e('0x4'));var router=express[_0x3b0e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b0e('0x6'));var config=require(_0x3b0e('0x7'));var controller=require(_0x3b0e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3b0e('0x9')](_0x3b0e('0xa'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0xc')]);router[_0x3b0e('0x9')](_0x3b0e('0xd'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0xe')]);router[_0x3b0e('0x9')](_0x3b0e('0xf'),auth['isAuthenticated'](),controller[_0x3b0e('0x10')]);router[_0x3b0e('0x9')](_0x3b0e('0x11'),auth[_0x3b0e('0xb')](),controller['getHopperFinals']);router[_0x3b0e('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x3b0e('0x9')]('/:id/lists',auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x12')]);router[_0x3b0e('0x9')](_0x3b0e('0x13'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x14')]);router[_0x3b0e('0x15')]('/',auth['isAuthenticated'](),controller[_0x3b0e('0x16')]);router[_0x3b0e('0x15')](_0x3b0e('0x17'),auth[_0x3b0e('0xb')](),controller['clone']);router[_0x3b0e('0x15')](_0x3b0e('0x18'),auth['isAuthenticated'](),controller[_0x3b0e('0x19')]);router[_0x3b0e('0x15')]('/:id/blacklists',auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1a')]);router[_0x3b0e('0x1b')](_0x3b0e('0xa'),auth['isAuthenticated'](),controller[_0x3b0e('0x1c')]);router[_0x3b0e('0x1d')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3b0e('0x1d')](_0x3b0e('0x18'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1e')]);router[_0x3b0e('0x1d')](_0x3b0e('0x13'),auth[_0x3b0e('0xb')](),controller[_0x3b0e('0x1f')]);module[_0x3b0e('0x20')]=router; \ No newline at end of file +var _0xf037=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x190fc8,_0x266a85){var _0x48078a=function(_0x5db3c5){while(--_0x5db3c5){_0x190fc8['push'](_0x190fc8['shift']());}};_0x48078a(++_0x266a85);}(_0xf037,0xba));var _0x7f03=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0xf037[_0x4de9e8];return _0x4db0de;};'use strict';var multer=require(_0x7f03('0x0'));var util=require(_0x7f03('0x1'));var path=require(_0x7f03('0x2'));var timeout=require(_0x7f03('0x3'));var express=require(_0x7f03('0x4'));var router=express[_0x7f03('0x5')]();var auth=require(_0x7f03('0x6'));var interaction=require(_0x7f03('0x7'));var config=require(_0x7f03('0x8'));var controller=require('./campaign.controller');router[_0x7f03('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f03('0x9')](_0x7f03('0xa'),auth[_0x7f03('0xb')](),controller['show']);router[_0x7f03('0x9')](_0x7f03('0xc'),auth[_0x7f03('0xb')](),controller[_0x7f03('0xd')]);router[_0x7f03('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x7f03('0xe')]);router['get'](_0x7f03('0xf'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x10')]);router[_0x7f03('0x9')](_0x7f03('0x11'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x12')]);router[_0x7f03('0x9')](_0x7f03('0x13'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x14')]);router[_0x7f03('0x9')](_0x7f03('0x15'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x16')]);router[_0x7f03('0x17')]('/',auth[_0x7f03('0xb')](),controller[_0x7f03('0x18')]);router['post'](_0x7f03('0x19'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x1a')]);router['post'](_0x7f03('0x13'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x1b')]);router[_0x7f03('0x17')](_0x7f03('0x15'),auth[_0x7f03('0xb')](),controller['addBlackLists']);router['put'](_0x7f03('0xa'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x1c')]);router[_0x7f03('0x1d')](_0x7f03('0xa'),auth[_0x7f03('0xb')](),controller[_0x7f03('0x1e')]);router[_0x7f03('0x1d')]('/:id/lists',auth[_0x7f03('0xb')](),controller['removeLists']);router[_0x7f03('0x1d')](_0x7f03('0x15'),auth[_0x7f03('0xb')](),controller['removeBlackLists']);module[_0x7f03('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1b1e4b6..f32557b 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 _0xa2f3=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xa2f3,0x1b0));var _0x3a2f=function(_0x28b4f2,_0x344860){_0x28b4f2=_0x28b4f2-0x0;var _0x1662df=_0xa2f3[_0x28b4f2];return _0x1662df;};'use strict';var Sequelize=require(_0x3a2f('0x0'));module[_0x3a2f('0x1')]={'key':{'type':Sequelize[_0x3a2f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x3a2f('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3a2f('0x4')],'get':function(){return this[_0x3a2f('0x5')](_0x3a2f('0x6'));}}}; \ No newline at end of file +var _0x399f=['key','sequelize','STRING','VIRTUAL','getDataValue'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x399f,0x1e6));var _0xf399=function(_0x13c04f,_0x140562){_0x13c04f=_0x13c04f-0x0;var _0x126225=_0x399f[_0x13c04f];return _0x126225;};'use strict';var Sequelize=require(_0xf399('0x0'));module['exports']={'key':{'type':Sequelize[_0xf399('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xf399('0x1')]},'name':{'type':Sequelize[_0xf399('0x2')],'get':function(){return this[_0xf399('0x3')](_0xf399('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 505de1f..2f99744 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 _0x9064=['query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','CannedAnswer','includeAll','include','findAll','rows','catch','params','rawAttributes','length','merge','options','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','CannedAnswers','UserProfileResource','destroy','error','name','send','index','map','fieldName','type','key','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9064,0x125));var _0x4906=function(_0x57c39e,_0x401207){_0x57c39e=_0x57c39e-0x0;var _0x5314b6=_0x9064[_0x57c39e];return _0x5314b6;};'use strict';var pdf=require(_0x4906('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4906('0x1'));var zipdir=require(_0x4906('0x2'));var jsonpatch=require(_0x4906('0x3'));var rp=require('request-promise');var moment=require(_0x4906('0x4'));var BPromise=require(_0x4906('0x5'));var Mustache=require(_0x4906('0x6'));var util=require('util');var path=require(_0x4906('0x7'));var sox=require(_0x4906('0x8'));var csv=require(_0x4906('0x9'));var ejs=require(_0x4906('0xa'));var fs=require('fs');var _=require(_0x4906('0xb'));var squel=require(_0x4906('0xc'));var crypto=require(_0x4906('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4906('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4906('0xf'));var Papa=require('papaparse');var Redis=require(_0x4906('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4906('0x11'));var hardwareService=require(_0x4906('0x12'));var logger=require(_0x4906('0x13'))(_0x4906('0x14'));var utils=require('../../config/utils');var config=require(_0x4906('0x15'));var db=require(_0x4906('0x16'))['db'];function respondWithStatusCode(_0x49b90c,_0x539ece){_0x539ece=_0x539ece||0xcc;return function(_0x20d87b){if(_0x20d87b){return _0x49b90c[_0x4906('0x17')](_0x539ece);}return _0x49b90c[_0x4906('0x18')](_0x539ece)[_0x4906('0x19')]();};}function respondWithResult(_0x4fc391,_0x3a4432){_0x3a4432=_0x3a4432||0xc8;return function(_0x1215ba){if(_0x1215ba){return _0x4fc391[_0x4906('0x18')](_0x3a4432)[_0x4906('0x1a')](_0x1215ba);}};}function respondWithFilteredResult(_0x545aa2,_0x2aa38d){return function(_0x425f95){if(_0x425f95){var _0x107d76=_0x425f95[_0x4906('0x1b')],_0xd9b0af=_0x2aa38d[_0x4906('0x1c')],_0x3b1cbf=_0x2aa38d[_0x4906('0x1c')]+_0x2aa38d[_0x4906('0x1d')],_0x18bc9d;if(_0x3b1cbf>=_0x107d76){_0x3b1cbf=_0x107d76;_0x18bc9d=0xc8;}else{_0x18bc9d=0xce;}_0x545aa2['status'](_0x18bc9d);return _0x545aa2[_0x4906('0x1e')](_0x4906('0x1f'),_0xd9b0af+'-'+_0x3b1cbf+'/'+_0x107d76)[_0x4906('0x1a')](_0x425f95);}return null;};}function patchUpdates(_0x9c5e41){return function(_0x3d0be7){try{jsonpatch['apply'](_0x3d0be7,_0x9c5e41,!![]);}catch(_0x429e1b){return BPromise[_0x4906('0x20')](_0x429e1b);}return _0x3d0be7[_0x4906('0x21')]();};}function saveUpdates(_0x28cc57,_0x25fb22){return function(_0x35187f){if(_0x35187f){return _0x35187f['update'](_0x28cc57)[_0x4906('0x22')](function(_0x3ea0b0){return _0x3ea0b0;});}return null;};}function removeEntity(_0x155248,_0x5454b2){return function(_0x2e6b7b){if(_0x2e6b7b){return _0x2e6b7b['destroy']()[_0x4906('0x22')](function(){var _0x403096=_0x2e6b7b['get']({'plain':!![]});var _0x4559ce=_0x4906('0x23');return db[_0x4906('0x24')][_0x4906('0x25')]({'where':{'type':_0x4559ce,'resourceId':_0x403096['id']}})[_0x4906('0x22')](function(){return _0x2e6b7b;});})[_0x4906('0x22')](function(){_0x155248[_0x4906('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f4c1,_0x331fb1){return function(_0x422ac4){if(!_0x422ac4){_0x55f4c1[_0x4906('0x17')](0x194);}return _0x422ac4;};}function handleError(_0x436f8b,_0x5bcbb2){_0x5bcbb2=_0x5bcbb2||0x1f4;return function(_0x355aa5){logger[_0x4906('0x26')](_0x355aa5['stack']);if(_0x355aa5[_0x4906('0x27')]){delete _0x355aa5[_0x4906('0x27')];}_0x436f8b['status'](_0x5bcbb2)[_0x4906('0x28')](_0x355aa5);};}exports[_0x4906('0x29')]=function(_0x4c305d,_0x466d67){var _0x5c3fb1={},_0x2b0c73={},_0x4a6454={'count':0x0,'rows':[]};var _0x228fc6=_[_0x4906('0x2a')](db['CannedAnswer']['rawAttributes'],function(_0x5bd240){return{'name':_0x5bd240[_0x4906('0x2b')],'type':_0x5bd240[_0x4906('0x2c')][_0x4906('0x2d')]};});_0x2b0c73['model']=_[_0x4906('0x2a')](_0x228fc6,_0x4906('0x27'));_0x2b0c73['query']=_[_0x4906('0x2e')](_0x4c305d[_0x4906('0x2f')]);_0x2b0c73[_0x4906('0x30')]=_[_0x4906('0x31')](_0x2b0c73['model'],_0x2b0c73[_0x4906('0x2f')]);_0x5c3fb1[_0x4906('0x32')]=_[_0x4906('0x31')](_0x2b0c73[_0x4906('0x33')],qs[_0x4906('0x34')](_0x4c305d['query'][_0x4906('0x34')]));_0x5c3fb1[_0x4906('0x32')]=_0x5c3fb1['attributes']['length']?_0x5c3fb1['attributes']:_0x2b0c73['model'];if(!_0x4c305d['query']['hasOwnProperty'](_0x4906('0x35'))){_0x5c3fb1[_0x4906('0x1d')]=qs[_0x4906('0x1d')](_0x4c305d[_0x4906('0x2f')][_0x4906('0x1d')]);_0x5c3fb1[_0x4906('0x1c')]=qs[_0x4906('0x1c')](_0x4c305d[_0x4906('0x2f')][_0x4906('0x1c')]);}_0x5c3fb1[_0x4906('0x36')]=qs['sort'](_0x4c305d[_0x4906('0x2f')][_0x4906('0x37')]);_0x5c3fb1[_0x4906('0x38')]=qs[_0x4906('0x30')](_[_0x4906('0x39')](_0x4c305d[_0x4906('0x2f')],_0x2b0c73[_0x4906('0x30')]),_0x228fc6);if(_0x4c305d[_0x4906('0x2f')][_0x4906('0x3a')]){_0x5c3fb1[_0x4906('0x38')]=_['merge'](_0x5c3fb1['where'],{'$or':_[_0x4906('0x2a')](_0x228fc6,function(_0x57b7b4){if(_0x57b7b4['type']!==_0x4906('0x3b')){var _0xfd8b1e={};_0xfd8b1e[_0x57b7b4[_0x4906('0x27')]]={'$like':'%'+_0x4c305d[_0x4906('0x2f')][_0x4906('0x3a')]+'%'};return _0xfd8b1e;}})});}_0x5c3fb1=_['merge']({},_0x5c3fb1,_0x4c305d['options']);var _0x2f5160={'where':_0x5c3fb1[_0x4906('0x38')]};return db[_0x4906('0x3c')][_0x4906('0x1b')](_0x2f5160)[_0x4906('0x22')](function(_0x3cc683){_0x4a6454[_0x4906('0x1b')]=_0x3cc683;if(_0x4c305d['query'][_0x4906('0x3d')]){_0x5c3fb1[_0x4906('0x3e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4906('0x3f')](_0x5c3fb1);})[_0x4906('0x22')](function(_0x462d3e){_0x4a6454[_0x4906('0x40')]=_0x462d3e;return _0x4a6454;})[_0x4906('0x22')](respondWithFilteredResult(_0x466d67,_0x5c3fb1))[_0x4906('0x41')](handleError(_0x466d67,null));};exports['show']=function(_0x9a4431,_0x7fea5c){var _0xae4448={'raw':!![],'where':{'id':_0x9a4431[_0x4906('0x42')]['id']}},_0x5904cc={};_0x5904cc[_0x4906('0x33')]=_[_0x4906('0x2e')](db[_0x4906('0x3c')][_0x4906('0x43')]);_0x5904cc['query']=_[_0x4906('0x2e')](_0x9a4431[_0x4906('0x2f')]);_0x5904cc[_0x4906('0x30')]=_['intersection'](_0x5904cc['model'],_0x5904cc['query']);_0xae4448['attributes']=_['intersection'](_0x5904cc[_0x4906('0x33')],qs[_0x4906('0x34')](_0x9a4431['query'][_0x4906('0x34')]));_0xae4448['attributes']=_0xae4448[_0x4906('0x32')][_0x4906('0x44')]?_0xae4448[_0x4906('0x32')]:_0x5904cc[_0x4906('0x33')];if(_0x9a4431[_0x4906('0x2f')][_0x4906('0x3d')]){_0xae4448['include']=[{'all':!![]}];}_0xae4448=_[_0x4906('0x45')]({},_0xae4448,_0x9a4431[_0x4906('0x46')]);return db[_0x4906('0x3c')][_0x4906('0x47')](_0xae4448)[_0x4906('0x22')](handleEntityNotFound(_0x7fea5c,null))['then'](respondWithResult(_0x7fea5c,null))['catch'](handleError(_0x7fea5c,null));};exports[_0x4906('0x48')]=function(_0x51f686,_0x57630b){if(_0x51f686[_0x4906('0x49')]['id']){delete _0x51f686[_0x4906('0x49')]['id'];}return db[_0x4906('0x3c')][_0x4906('0x47')]({'where':{'id':_0x51f686[_0x4906('0x42')]['id']}})[_0x4906('0x22')](handleEntityNotFound(_0x57630b,null))[_0x4906('0x22')](saveUpdates(_0x51f686['body'],null))[_0x4906('0x22')](respondWithResult(_0x57630b,null))[_0x4906('0x41')](handleError(_0x57630b,null));};exports[_0x4906('0x25')]=function(_0x47ad77,_0x28cfd0){return db['CannedAnswer'][_0x4906('0x47')]({'where':{'id':_0x47ad77[_0x4906('0x42')]['id']}})[_0x4906('0x22')](handleEntityNotFound(_0x28cfd0,null))['then'](removeEntity(_0x28cfd0,null))[_0x4906('0x41')](handleError(_0x28cfd0,null));};exports[_0x4906('0x4a')]=function(_0x5012ab,_0x380df6){var _0x99e6c6={'key':_0x5012ab[_0x4906('0x49')]['key']};if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4b')]){_0x99e6c6[_0x4906('0x4b')]=_0x5012ab['body'][_0x4906('0x4b')];}else if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4c')]){_0x99e6c6['SmsAccountId']=_0x5012ab['body'][_0x4906('0x4c')];}else if(_0x5012ab['body'][_0x4906('0x4d')]){_0x99e6c6[_0x4906('0x4d')]=_0x5012ab[_0x4906('0x49')]['OpenchannelAccountId'];}else if(_0x5012ab[_0x4906('0x49')][_0x4906('0x4e')]){_0x99e6c6[_0x4906('0x4e')]=_0x5012ab['body']['ChatWebsiteId'];}return db[_0x4906('0x3c')][_0x4906('0x47')]({'where':_0x99e6c6})[_0x4906('0x22')](function(_0x2db78b){if(_0x2db78b){throw new db['Sequelize']['ValidationError'](_0x4906('0x4f'));}return db[_0x4906('0x3c')]['create'](_0x5012ab[_0x4906('0x49')]);})['then'](function(_0x5469e5){var _0x4b1685=_0x5012ab[_0x4906('0x50')]['get']({'plain':!![]});if(!_0x4b1685)throw new Error(_0x4906('0x51'));if(_0x4b1685['role']===_0x4906('0x50')){var _0x1cca2c=_0x5469e5['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'CannedAnswers','userProfileId':_0x4b1685[_0x4906('0x52')]},'raw':!![]})[_0x4906('0x22')](function(_0x20980a){if(_0x20980a&&_0x20980a[_0x4906('0x53')]===0x0){return db['UserProfileResource'][_0x4906('0x4a')]({'name':_0x1cca2c[_0x4906('0x27')],'resourceId':_0x1cca2c['id'],'type':_0x20980a[_0x4906('0x27')],'sectionId':_0x20980a['id']},{})['then'](function(){return _0x5469e5;});}else{return _0x5469e5;}})[_0x4906('0x41')](function(_0x1a9c64){logger['error'](_0x4906('0x54'),_0x1a9c64);throw _0x1a9c64;});}return _0x5469e5;})[_0x4906('0x22')](respondWithResult(_0x380df6,0xc9))[_0x4906('0x41')](handleError(_0x380df6,null));}; \ No newline at end of file +var _0xadc1=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','CannedAnswers','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','CannedAnswer','includeAll','include','rows','catch','params','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf'];(function(_0x44d385,_0x1a313a){var _0x5c2cc5=function(_0x5d1d76){while(--_0x5d1d76){_0x44d385['push'](_0x44d385['shift']());}};_0x5c2cc5(++_0x1a313a);}(_0xadc1,0x10d));var _0x1adc=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0xadc1[_0x1cc961];return _0x471d86;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1adc('0x0'));var zipdir=require(_0x1adc('0x1'));var jsonpatch=require(_0x1adc('0x2'));var rp=require(_0x1adc('0x3'));var moment=require(_0x1adc('0x4'));var BPromise=require(_0x1adc('0x5'));var Mustache=require(_0x1adc('0x6'));var util=require(_0x1adc('0x7'));var path=require(_0x1adc('0x8'));var sox=require(_0x1adc('0x9'));var csv=require(_0x1adc('0xa'));var ejs=require(_0x1adc('0xb'));var fs=require('fs');var _=require(_0x1adc('0xc'));var squel=require(_0x1adc('0xd'));var crypto=require(_0x1adc('0xe'));var jsforce=require(_0x1adc('0xf'));var deskjs=require(_0x1adc('0x10'));var toCsv=require(_0x1adc('0xa'));var querystring=require(_0x1adc('0x11'));var Papa=require('papaparse');var Redis=require(_0x1adc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1adc('0x13'));var as=require(_0x1adc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1adc('0x15'))(_0x1adc('0x16'));var utils=require(_0x1adc('0x17'));var config=require(_0x1adc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34988c,_0x56b7f9){_0x56b7f9=_0x56b7f9||0xcc;return function(_0x5ac624){if(_0x5ac624){return _0x34988c[_0x1adc('0x19')](_0x56b7f9);}return _0x34988c[_0x1adc('0x1a')](_0x56b7f9)[_0x1adc('0x1b')]();};}function respondWithResult(_0x25996e,_0x56dd0d){_0x56dd0d=_0x56dd0d||0xc8;return function(_0x533c10){if(_0x533c10){return _0x25996e[_0x1adc('0x1a')](_0x56dd0d)['json'](_0x533c10);}};}function respondWithFilteredResult(_0x11c8b7,_0x1198b6){return function(_0x195d63){if(_0x195d63){var _0x5bf552=_0x195d63[_0x1adc('0x1c')],_0xbd159=_0x1198b6[_0x1adc('0x1d')],_0x240f62=_0x1198b6[_0x1adc('0x1d')]+_0x1198b6[_0x1adc('0x1e')],_0x337c1f;if(_0x240f62>=_0x5bf552){_0x240f62=_0x5bf552;_0x337c1f=0xc8;}else{_0x337c1f=0xce;}_0x11c8b7[_0x1adc('0x1a')](_0x337c1f);return _0x11c8b7[_0x1adc('0x1f')](_0x1adc('0x20'),_0xbd159+'-'+_0x240f62+'/'+_0x5bf552)[_0x1adc('0x21')](_0x195d63);}return null;};}function patchUpdates(_0x4753a9){return function(_0x54a9e2){try{jsonpatch['apply'](_0x54a9e2,_0x4753a9,!![]);}catch(_0x4994ff){return BPromise[_0x1adc('0x22')](_0x4994ff);}return _0x54a9e2[_0x1adc('0x23')]();};}function saveUpdates(_0x1e5aa7,_0x50e76f){return function(_0x8f42b7){if(_0x8f42b7){return _0x8f42b7['update'](_0x1e5aa7)[_0x1adc('0x24')](function(_0x24553e){return _0x24553e;});}return null;};}function removeEntity(_0x22ff2b,_0x49bbaf){return function(_0x378a54){if(_0x378a54){return _0x378a54['destroy']()[_0x1adc('0x24')](function(){var _0xd3fc2e=_0x378a54['get']({'plain':!![]});var _0xc188e1=_0x1adc('0x25');return db[_0x1adc('0x26')][_0x1adc('0x27')]({'where':{'type':_0xc188e1,'resourceId':_0xd3fc2e['id']}})[_0x1adc('0x24')](function(){return _0x378a54;});})[_0x1adc('0x24')](function(){_0x22ff2b[_0x1adc('0x1a')](0xcc)[_0x1adc('0x1b')]();});}};}function handleEntityNotFound(_0x3a057e,_0x18e029){return function(_0x8eca05){if(!_0x8eca05){_0x3a057e[_0x1adc('0x19')](0x194);}return _0x8eca05;};}function handleError(_0x1d24f1,_0x3d52bb){_0x3d52bb=_0x3d52bb||0x1f4;return function(_0x4fa825){logger[_0x1adc('0x28')](_0x4fa825['stack']);if(_0x4fa825[_0x1adc('0x29')]){delete _0x4fa825[_0x1adc('0x29')];}_0x1d24f1[_0x1adc('0x1a')](_0x3d52bb)[_0x1adc('0x2a')](_0x4fa825);};}exports[_0x1adc('0x2b')]=function(_0x27e46d,_0x48224e){var _0x16a443={},_0x1e7aab={},_0x5ec586={'count':0x0,'rows':[]};var _0x198ab2=_[_0x1adc('0x2c')](db['CannedAnswer'][_0x1adc('0x2d')],function(_0x4fbdd){return{'name':_0x4fbdd[_0x1adc('0x2e')],'type':_0x4fbdd[_0x1adc('0x2f')][_0x1adc('0x30')]};});_0x1e7aab[_0x1adc('0x31')]=_['map'](_0x198ab2,'name');_0x1e7aab[_0x1adc('0x32')]=_[_0x1adc('0x33')](_0x27e46d['query']);_0x1e7aab['filters']=_[_0x1adc('0x34')](_0x1e7aab['model'],_0x1e7aab[_0x1adc('0x32')]);_0x16a443[_0x1adc('0x35')]=_['intersection'](_0x1e7aab['model'],qs[_0x1adc('0x36')](_0x27e46d[_0x1adc('0x32')]['fields']));_0x16a443[_0x1adc('0x35')]=_0x16a443['attributes'][_0x1adc('0x37')]?_0x16a443[_0x1adc('0x35')]:_0x1e7aab[_0x1adc('0x31')];if(!_0x27e46d[_0x1adc('0x32')][_0x1adc('0x38')]('nolimit')){_0x16a443[_0x1adc('0x1e')]=qs[_0x1adc('0x1e')](_0x27e46d[_0x1adc('0x32')][_0x1adc('0x1e')]);_0x16a443['offset']=qs[_0x1adc('0x1d')](_0x27e46d[_0x1adc('0x32')][_0x1adc('0x1d')]);}_0x16a443[_0x1adc('0x39')]=qs[_0x1adc('0x3a')](_0x27e46d[_0x1adc('0x32')][_0x1adc('0x3a')]);_0x16a443['where']=qs[_0x1adc('0x3b')](_[_0x1adc('0x3c')](_0x27e46d[_0x1adc('0x32')],_0x1e7aab[_0x1adc('0x3b')]),_0x198ab2);if(_0x27e46d[_0x1adc('0x32')]['filter']){_0x16a443[_0x1adc('0x3d')]=_[_0x1adc('0x3e')](_0x16a443[_0x1adc('0x3d')],{'$or':_[_0x1adc('0x2c')](_0x198ab2,function(_0x3ee7af){if(_0x3ee7af[_0x1adc('0x2f')]!==_0x1adc('0x3f')){var _0x5928ae={};_0x5928ae[_0x3ee7af[_0x1adc('0x29')]]={'$like':'%'+_0x27e46d[_0x1adc('0x32')][_0x1adc('0x40')]+'%'};return _0x5928ae;}})});}_0x16a443=_[_0x1adc('0x3e')]({},_0x16a443,_0x27e46d[_0x1adc('0x41')]);var _0x2f7c7e={'where':_0x16a443[_0x1adc('0x3d')]};return db[_0x1adc('0x42')]['count'](_0x2f7c7e)[_0x1adc('0x24')](function(_0xea55ac){_0x5ec586[_0x1adc('0x1c')]=_0xea55ac;if(_0x27e46d['query'][_0x1adc('0x43')]){_0x16a443[_0x1adc('0x44')]=[{'all':!![]}];}return db[_0x1adc('0x42')]['findAll'](_0x16a443);})[_0x1adc('0x24')](function(_0x22814f){_0x5ec586[_0x1adc('0x45')]=_0x22814f;return _0x5ec586;})[_0x1adc('0x24')](respondWithFilteredResult(_0x48224e,_0x16a443))[_0x1adc('0x46')](handleError(_0x48224e,null));};exports['show']=function(_0x462743,_0x3c9fae){var _0x3d47cc={'raw':!![],'where':{'id':_0x462743[_0x1adc('0x47')]['id']}},_0x3a5530={};_0x3a5530[_0x1adc('0x31')]=_[_0x1adc('0x33')](db[_0x1adc('0x42')][_0x1adc('0x2d')]);_0x3a5530[_0x1adc('0x32')]=_[_0x1adc('0x33')](_0x462743[_0x1adc('0x32')]);_0x3a5530[_0x1adc('0x3b')]=_[_0x1adc('0x34')](_0x3a5530[_0x1adc('0x31')],_0x3a5530['query']);_0x3d47cc['attributes']=_[_0x1adc('0x34')](_0x3a5530['model'],qs[_0x1adc('0x36')](_0x462743[_0x1adc('0x32')][_0x1adc('0x36')]));_0x3d47cc[_0x1adc('0x35')]=_0x3d47cc[_0x1adc('0x35')]['length']?_0x3d47cc['attributes']:_0x3a5530['model'];if(_0x462743['query'][_0x1adc('0x43')]){_0x3d47cc[_0x1adc('0x44')]=[{'all':!![]}];}_0x3d47cc=_[_0x1adc('0x3e')]({},_0x3d47cc,_0x462743[_0x1adc('0x41')]);return db[_0x1adc('0x42')][_0x1adc('0x48')](_0x3d47cc)[_0x1adc('0x24')](handleEntityNotFound(_0x3c9fae,null))['then'](respondWithResult(_0x3c9fae,null))[_0x1adc('0x46')](handleError(_0x3c9fae,null));};exports[_0x1adc('0x49')]=function(_0x29a6a3,_0x54861d){if(_0x29a6a3[_0x1adc('0x4a')]['id']){delete _0x29a6a3[_0x1adc('0x4a')]['id'];}return db[_0x1adc('0x42')][_0x1adc('0x48')]({'where':{'id':_0x29a6a3[_0x1adc('0x47')]['id']}})[_0x1adc('0x24')](handleEntityNotFound(_0x54861d,null))[_0x1adc('0x24')](saveUpdates(_0x29a6a3[_0x1adc('0x4a')],null))['then'](respondWithResult(_0x54861d,null))[_0x1adc('0x46')](handleError(_0x54861d,null));};exports['destroy']=function(_0x392344,_0x2007b4){return db[_0x1adc('0x42')][_0x1adc('0x48')]({'where':{'id':_0x392344[_0x1adc('0x47')]['id']}})['then'](handleEntityNotFound(_0x2007b4,null))[_0x1adc('0x24')](removeEntity(_0x2007b4,null))[_0x1adc('0x46')](handleError(_0x2007b4,null));};exports[_0x1adc('0x4b')]=function(_0x5349c1,_0x3fdc25){var _0x16bf3a={'key':_0x5349c1['body'][_0x1adc('0x30')]};if(_0x5349c1[_0x1adc('0x4a')][_0x1adc('0x4c')]){_0x16bf3a[_0x1adc('0x4c')]=_0x5349c1['body'][_0x1adc('0x4c')];}else if(_0x5349c1[_0x1adc('0x4a')][_0x1adc('0x4d')]){_0x16bf3a[_0x1adc('0x4d')]=_0x5349c1[_0x1adc('0x4a')]['SmsAccountId'];}else if(_0x5349c1[_0x1adc('0x4a')][_0x1adc('0x4e')]){_0x16bf3a[_0x1adc('0x4e')]=_0x5349c1[_0x1adc('0x4a')][_0x1adc('0x4e')];}else if(_0x5349c1[_0x1adc('0x4a')][_0x1adc('0x4f')]){_0x16bf3a['ChatWebsiteId']=_0x5349c1[_0x1adc('0x4a')]['ChatWebsiteId'];}return db[_0x1adc('0x42')][_0x1adc('0x48')]({'where':_0x16bf3a})['then'](function(_0x535c76){if(_0x535c76){throw new db[(_0x1adc('0x50'))][(_0x1adc('0x51'))](_0x1adc('0x52'));}return db['CannedAnswer'][_0x1adc('0x4b')](_0x5349c1['body']);})[_0x1adc('0x24')](function(_0x32d2dd){var _0x1ddb37=_0x5349c1['user']['get']({'plain':!![]});if(!_0x1ddb37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ddb37[_0x1adc('0x53')]===_0x1adc('0x54')){var _0x4f9345=_0x32d2dd[_0x1adc('0x55')]({'plain':!![]});return db[_0x1adc('0x56')][_0x1adc('0x48')]({'where':{'name':_0x1adc('0x25'),'userProfileId':_0x1ddb37[_0x1adc('0x57')]},'raw':!![]})[_0x1adc('0x24')](function(_0x9f7150){if(_0x9f7150&&_0x9f7150[_0x1adc('0x58')]===0x0){return db[_0x1adc('0x26')][_0x1adc('0x4b')]({'name':_0x4f9345[_0x1adc('0x29')],'resourceId':_0x4f9345['id'],'type':_0x9f7150['name'],'sectionId':_0x9f7150['id']},{})[_0x1adc('0x24')](function(){return _0x32d2dd;});}else{return _0x32d2dd;}})[_0x1adc('0x46')](function(_0xc3d0b2){logger[_0x1adc('0x28')](_0x1adc('0x59'),_0xc3d0b2);throw _0xc3d0b2;});}return _0x32d2dd;})[_0x1adc('0x24')](respondWithResult(_0x3fdc25,0xc9))[_0x1adc('0x46')](handleError(_0x3fdc25,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index e7336be..a851b21 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 _0xecb2=['./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x3b669d,_0x5f03d8){var _0x139da0=function(_0x231280){while(--_0x231280){_0x3b669d['push'](_0x3b669d['shift']());}};_0x139da0(++_0x5f03d8);}(_0xecb2,0xf6));var _0x2ecb=function(_0x525597,_0x34396f){_0x525597=_0x525597-0x0;var _0x4ea32f=_0xecb2[_0x525597];return _0x4ea32f;};'use strict';var _=require(_0x2ecb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2ecb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ecb('0x2'));var fs=require('fs');var path=require(_0x2ecb('0x3'));var rimraf=require(_0x2ecb('0x4'));var config=require(_0x2ecb('0x5'));var attributes=require(_0x2ecb('0x6'));module[_0x2ecb('0x7')]=function(_0x4c169f,_0x51b28c){return _0x4c169f['define'](_0x2ecb('0x8'),attributes,{'tableName':_0x2ecb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2ecb('0xa'),'collate':_0x2ecb('0xb')});}; \ No newline at end of file +var _0xf873=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf873,0xb2));var _0x3f87=function(_0x102178,_0xed40fd){_0x102178=_0x102178-0x0;var _0x48f9c1=_0xf873[_0x102178];return _0x48f9c1;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f87('0xc'),'collate':_0x3f87('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4137739..a7e2738 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 _0x62ab=['request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','CannedAnswer,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62ab,0x12f));var _0xb62a=function(_0x42b260,_0x312da9){_0x42b260=_0x42b260-0x0;var _0x14ddb5=_0x62ab[_0x42b260];return _0x14ddb5;};'use strict';var _=require(_0xb62a('0x0'));var util=require(_0xb62a('0x1'));var moment=require('moment');var BPromise=require(_0xb62a('0x2'));var rs=require(_0xb62a('0x3'));var fs=require('fs');var Redis=require(_0xb62a('0x4'));var db=require(_0xb62a('0x5'))['db'];var utils=require(_0xb62a('0x6'));var logger=require('../../config/logger')(_0xb62a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb62a('0x8'));var client=jayson[_0xb62a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed15e9,_0x25706c,_0x5363e2){return new BPromise(function(_0x57afa9,_0x56909c){return client['request'](_0xed15e9,_0x5363e2)[_0xb62a('0xa')](function(_0x209f11){logger['info'](_0xb62a('0xb'),_0x25706c,_0xb62a('0xc'));logger['debug'](_0xb62a('0xd'),_0x25706c,'request\x20sent',JSON[_0xb62a('0xe')](_0x209f11));if(_0x209f11[_0xb62a('0xf')]){if(_0x209f11['error'][_0xb62a('0x10')]===0x1f4){logger[_0xb62a('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x25706c,_0x209f11['error'][_0xb62a('0x11')]);return _0x56909c(_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);}logger[_0xb62a('0xf')](_0xb62a('0xb'),_0x25706c,_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);return _0x57afa9(_0x209f11[_0xb62a('0xf')][_0xb62a('0x11')]);}else{logger[_0xb62a('0x12')](_0xb62a('0xb'),_0x25706c,_0xb62a('0xc'));_0x57afa9(_0x209f11[_0xb62a('0x13')][_0xb62a('0x11')]);}})[_0xb62a('0x14')](function(_0x377779){logger[_0xb62a('0xf')](_0xb62a('0xb'),_0x25706c,_0x377779);_0x56909c(_0x377779);});});} \ No newline at end of file +var _0x138d=['debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x46f742,_0x43d06c){var _0x7085e2=function(_0x423d56){while(--_0x423d56){_0x46f742['push'](_0x46f742['shift']());}};_0x7085e2(++_0x43d06c);}(_0x138d,0xf0));var _0xd138=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0x138d[_0x5ba74f];return _0x534d79;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var moment=require('moment');var BPromise=require(_0xd138('0x2'));var rs=require(_0xd138('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd138('0x4'));var jayson=require(_0xd138('0x5'));var client=jayson[_0xd138('0x6')][_0xd138('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc510c8,_0x1fef58,_0x49f634){return new BPromise(function(_0x589183,_0x440e7f){return client[_0xd138('0x8')](_0xc510c8,_0x49f634)[_0xd138('0x9')](function(_0x4c5c5a){logger[_0xd138('0xa')](_0xd138('0xb'),_0x1fef58,'request\x20sent');logger[_0xd138('0xc')](_0xd138('0xd'),_0x1fef58,_0xd138('0xe'),JSON[_0xd138('0xf')](_0x4c5c5a));if(_0x4c5c5a['error']){if(_0x4c5c5a[_0xd138('0x10')][_0xd138('0x11')]===0x1f4){logger[_0xd138('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x1fef58,_0x4c5c5a[_0xd138('0x10')][_0xd138('0x12')]);return _0x440e7f(_0x4c5c5a[_0xd138('0x10')][_0xd138('0x12')]);}logger[_0xd138('0x10')](_0xd138('0xb'),_0x1fef58,_0x4c5c5a['error'][_0xd138('0x12')]);return _0x589183(_0x4c5c5a[_0xd138('0x10')][_0xd138('0x12')]);}else{logger[_0xd138('0xa')](_0xd138('0xb'),_0x1fef58,_0xd138('0xe'));_0x589183(_0x4c5c5a[_0xd138('0x13')]['message']);}})[_0xd138('0x14')](function(_0x31e234){logger[_0xd138('0x10')](_0xd138('0xb'),_0x1fef58,_0x31e234);_0x440e7f(_0x31e234);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index f82abd4..699296f 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 _0x20d6=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post'];(function(_0x55732c,_0x4da144){var _0x24887a=function(_0x2f9afd){while(--_0x2f9afd){_0x55732c['push'](_0x55732c['shift']());}};_0x24887a(++_0x4da144);}(_0x20d6,0x9d));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var path=require(_0x620d('0x2'));var timeout=require(_0x620d('0x3'));var express=require(_0x620d('0x4'));var router=express['Router']();var auth=require(_0x620d('0x5'));var interaction=require(_0x620d('0x6'));var config=require(_0x620d('0x7'));var controller=require(_0x620d('0x8'));router['get']('/',auth[_0x620d('0x9')](),controller[_0x620d('0xa')]);router['get'](_0x620d('0xb'),auth[_0x620d('0x9')](),controller[_0x620d('0xc')]);router[_0x620d('0xd')]('/',auth[_0x620d('0x9')](),controller[_0x620d('0xe')]);router[_0x620d('0xf')](_0x620d('0xb'),auth[_0x620d('0x9')](),controller[_0x620d('0x10')]);router[_0x620d('0x11')](_0x620d('0xb'),auth['isAuthenticated'](),controller[_0x620d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x38ca=['Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','show','post','isAuthenticated','put','update','delete','/:id','exports','multer','path','connect-timeout','express'];(function(_0x5060e6,_0x51d0a9){var _0x442627=function(_0x56cae1){while(--_0x56cae1){_0x5060e6['push'](_0x5060e6['shift']());}};_0x442627(++_0x51d0a9);}(_0x38ca,0xb0));var _0xa38c=function(_0x4a0a1b,_0x2715d1){_0x4a0a1b=_0x4a0a1b-0x0;var _0xe101df=_0x38ca[_0x4a0a1b];return _0xe101df;};'use strict';var multer=require(_0xa38c('0x0'));var util=require('util');var path=require(_0xa38c('0x1'));var timeout=require(_0xa38c('0x2'));var express=require(_0xa38c('0x3'));var router=express[_0xa38c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa38c('0x5'));var config=require(_0xa38c('0x6'));var controller=require(_0xa38c('0x7'));router[_0xa38c('0x8')]('/',auth['isAuthenticated'](),controller[_0xa38c('0x9')]);router[_0xa38c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa38c('0xa')]);router[_0xa38c('0xb')]('/',auth[_0xa38c('0xc')](),controller['create']);router[_0xa38c('0xd')]('/:id',auth[_0xa38c('0xc')](),controller[_0xa38c('0xe')]);router[_0xa38c('0xf')](_0xa38c('0x10'),auth[_0xa38c('0xc')](),controller['destroy']);module[_0xa38c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 1c8af34..4a63cb6 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 _0xe062=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x20b1f7,_0x1a8f10){var _0x595b92=function(_0xe57ad7){while(--_0xe57ad7){_0x20b1f7['push'](_0x20b1f7['shift']());}};_0x595b92(++_0x1a8f10);}(_0xe062,0x139));var _0x2e06=function(_0x38875b,_0x158938){_0x38875b=_0x38875b-0x0;var _0x157806=_0xe062[_0x38875b];return _0x157806;};'use strict';var Sequelize=require(_0x2e06('0x0'));module[_0x2e06('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2e06('0x2')},'clid':{'type':Sequelize[_0x2e06('0x3')]},'src':{'type':Sequelize[_0x2e06('0x3')]},'dst':{'type':Sequelize[_0x2e06('0x3')]},'dcontext':{'type':Sequelize[_0x2e06('0x3')]},'channel':{'type':Sequelize[_0x2e06('0x3')]},'dstchannel':{'type':Sequelize[_0x2e06('0x3')]},'lastapp':{'type':Sequelize[_0x2e06('0x3')]},'lastdata':{'type':Sequelize[_0x2e06('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2e06('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2e06('0x3')]},'amaflags':{'type':Sequelize[_0x2e06('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2e06('0x3')]},'userfield':{'type':Sequelize[_0x2e06('0x3')]},'uniqueid':{'type':Sequelize[_0x2e06('0x3')]},'linkedid':{'type':Sequelize[_0x2e06('0x3')]},'sequence':{'type':Sequelize[_0x2e06('0x3')]},'peeraccount':{'type':Sequelize[_0x2e06('0x3')]},'type':{'type':Sequelize[_0x2e06('0x3')]},'tag':{'type':Sequelize[_0x2e06('0x3')]}}; \ No newline at end of file +var _0x5c77=['DATE','STRING','INTEGER','sequelize'];(function(_0x271aff,_0x535bbf){var _0x4c2676=function(_0x438077){while(--_0x438077){_0x271aff['push'](_0x271aff['shift']());}};_0x4c2676(++_0x535bbf);}(_0x5c77,0x193));var _0x75c7=function(_0x314350,_0x4433a0){_0x314350=_0x314350-0x0;var _0x2d9c1d=_0x5c77[_0x314350];return _0x2d9c1d;};'use strict';var Sequelize=require(_0x75c7('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x75c7('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x75c7('0x2')]},'src':{'type':Sequelize[_0x75c7('0x2')]},'dst':{'type':Sequelize[_0x75c7('0x2')]},'dcontext':{'type':Sequelize[_0x75c7('0x2')]},'channel':{'type':Sequelize[_0x75c7('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x75c7('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x75c7('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x75c7('0x2')]},'amaflags':{'type':Sequelize[_0x75c7('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x75c7('0x2')]},'userfield':{'type':Sequelize[_0x75c7('0x2')]},'uniqueid':{'type':Sequelize[_0x75c7('0x2')]},'linkedid':{'type':Sequelize[_0x75c7('0x2')]},'sequence':{'type':Sequelize[_0x75c7('0x2')]},'peeraccount':{'type':Sequelize[_0x75c7('0x2')]},'type':{'type':Sequelize[_0x75c7('0x2')]},'tag':{'type':Sequelize[_0x75c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e401798..fa281e5 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 _0x3a60=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','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','desk.js','querystring','papaparse'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0x3a60,0x87));var _0x03a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a60[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x03a6('0x0'));var emlformat=require(_0x03a6('0x1'));var rimraf=require(_0x03a6('0x2'));var zipdir=require(_0x03a6('0x3'));var jsonpatch=require(_0x03a6('0x4'));var rp=require(_0x03a6('0x5'));var moment=require(_0x03a6('0x6'));var BPromise=require(_0x03a6('0x7'));var Mustache=require(_0x03a6('0x8'));var util=require(_0x03a6('0x9'));var path=require(_0x03a6('0xa'));var sox=require(_0x03a6('0xb'));var csv=require(_0x03a6('0xc'));var ejs=require(_0x03a6('0xd'));var fs=require('fs');var _=require(_0x03a6('0xe'));var squel=require(_0x03a6('0xf'));var crypto=require(_0x03a6('0x10'));var jsforce=require(_0x03a6('0x11'));var deskjs=require(_0x03a6('0x12'));var toCsv=require(_0x03a6('0xc'));var querystring=require(_0x03a6('0x13'));var Papa=require(_0x03a6('0x14'));var Redis=require(_0x03a6('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x03a6('0x16'));var hardwareService=require(_0x03a6('0x17'));var logger=require(_0x03a6('0x18'))(_0x03a6('0x19'));var utils=require(_0x03a6('0x1a'));var config=require(_0x03a6('0x1b'));var db=require(_0x03a6('0x1c'))['db'];function respondWithStatusCode(_0x21199b,_0x160c7c){_0x160c7c=_0x160c7c||0xcc;return function(_0x53f011){if(_0x53f011){return _0x21199b[_0x03a6('0x1d')](_0x160c7c);}return _0x21199b[_0x03a6('0x1e')](_0x160c7c)[_0x03a6('0x1f')]();};}function respondWithResult(_0x1cf5af,_0x5a0856){_0x5a0856=_0x5a0856||0xc8;return function(_0x2e5a9f){if(_0x2e5a9f){return _0x1cf5af['status'](_0x5a0856)[_0x03a6('0x20')](_0x2e5a9f);}};}function respondWithFilteredResult(_0x2aaa4f,_0x1718f8){return function(_0x2da35a){if(_0x2da35a){var _0x50c8e5=_0x2da35a[_0x03a6('0x21')],_0x1f4c79=_0x1718f8[_0x03a6('0x22')],_0x4e91e4=_0x1718f8[_0x03a6('0x22')]+_0x1718f8[_0x03a6('0x23')],_0x189b7e;if(_0x4e91e4>=_0x50c8e5){_0x4e91e4=_0x50c8e5;_0x189b7e=0xc8;}else{_0x189b7e=0xce;}_0x2aaa4f[_0x03a6('0x1e')](_0x189b7e);return _0x2aaa4f[_0x03a6('0x24')]('Content-Range',_0x1f4c79+'-'+_0x4e91e4+'/'+_0x50c8e5)[_0x03a6('0x20')](_0x2da35a);}return null;};}function patchUpdates(_0x43ad46){return function(_0x3da49f){try{jsonpatch[_0x03a6('0x25')](_0x3da49f,_0x43ad46,!![]);}catch(_0x130d84){return BPromise[_0x03a6('0x26')](_0x130d84);}return _0x3da49f[_0x03a6('0x27')]();};}function saveUpdates(_0x5ad58c,_0x35165a){return function(_0x2ac582){if(_0x2ac582){return _0x2ac582[_0x03a6('0x28')](_0x5ad58c)[_0x03a6('0x29')](function(_0x17afc0){return _0x17afc0;});}return null;};}function removeEntity(_0x1ea412,_0x20cec7){return function(_0xff236d){if(_0xff236d){return _0xff236d[_0x03a6('0x2a')]()['then'](function(){_0x1ea412[_0x03a6('0x1e')](0xcc)[_0x03a6('0x1f')]();});}};}function handleEntityNotFound(_0x4a09ba,_0xf8c0c8){return function(_0x39a342){if(!_0x39a342){_0x4a09ba[_0x03a6('0x1d')](0x194);}return _0x39a342;};}function handleError(_0x292c5a,_0x3c0348){_0x3c0348=_0x3c0348||0x1f4;return function(_0x525b1c){logger[_0x03a6('0x2b')](_0x525b1c[_0x03a6('0x2c')]);if(_0x525b1c[_0x03a6('0x2d')]){delete _0x525b1c[_0x03a6('0x2d')];}_0x292c5a[_0x03a6('0x1e')](_0x3c0348)[_0x03a6('0x2e')](_0x525b1c);};}exports['index']=function(_0x20795b,_0x536ed0){var _0x5ee442={},_0x2d7459={},_0x2beb04={'count':0x0,'rows':[]};var _0x36870e=_['map'](db[_0x03a6('0x2f')][_0x03a6('0x30')],function(_0x4f5e50){return{'name':_0x4f5e50[_0x03a6('0x31')],'type':_0x4f5e50[_0x03a6('0x32')]['key']};});_0x2d7459[_0x03a6('0x33')]=_[_0x03a6('0x34')](_0x36870e,_0x03a6('0x2d'));_0x2d7459[_0x03a6('0x35')]=_[_0x03a6('0x36')](_0x20795b[_0x03a6('0x35')]);_0x2d7459[_0x03a6('0x37')]=_[_0x03a6('0x38')](_0x2d7459[_0x03a6('0x33')],_0x2d7459['query']);_0x5ee442[_0x03a6('0x39')]=_['intersection'](_0x2d7459[_0x03a6('0x33')],qs[_0x03a6('0x3a')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x3a')]));_0x5ee442[_0x03a6('0x39')]=_0x5ee442[_0x03a6('0x39')][_0x03a6('0x3b')]?_0x5ee442[_0x03a6('0x39')]:_0x2d7459[_0x03a6('0x33')];if(!_0x20795b['query'][_0x03a6('0x3c')](_0x03a6('0x3d'))){_0x5ee442['limit']=qs['limit'](_0x20795b[_0x03a6('0x35')][_0x03a6('0x23')]);_0x5ee442[_0x03a6('0x22')]=qs[_0x03a6('0x22')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x22')]);}_0x5ee442[_0x03a6('0x3e')]=qs[_0x03a6('0x3f')](_0x20795b[_0x03a6('0x35')][_0x03a6('0x3f')]);_0x5ee442[_0x03a6('0x40')]=qs[_0x03a6('0x37')](_[_0x03a6('0x41')](_0x20795b['query'],_0x2d7459[_0x03a6('0x37')]),_0x36870e);if(_0x20795b[_0x03a6('0x35')][_0x03a6('0x42')]){_0x5ee442[_0x03a6('0x40')]=_['merge'](_0x5ee442[_0x03a6('0x40')],{'$or':_[_0x03a6('0x34')](_0x36870e,function(_0x4736db){if(_0x4736db[_0x03a6('0x32')]!=='VIRTUAL'){var _0x577c42={};_0x577c42[_0x4736db[_0x03a6('0x2d')]]={'$like':'%'+_0x20795b[_0x03a6('0x35')][_0x03a6('0x42')]+'%'};return _0x577c42;}})});}_0x5ee442=_['merge']({},_0x5ee442,_0x20795b['options']);var _0x42b1bc={'where':_0x5ee442[_0x03a6('0x40')]};return db['Cdr'][_0x03a6('0x21')](_0x42b1bc)['then'](function(_0x2855fb){_0x2beb04[_0x03a6('0x21')]=_0x2855fb;if(_0x20795b['query'][_0x03a6('0x43')]){_0x5ee442[_0x03a6('0x44')]=[{'all':!![]}];}return db[_0x03a6('0x2f')][_0x03a6('0x45')](_0x5ee442);})['then'](function(_0x1b195b){_0x2beb04[_0x03a6('0x46')]=_0x1b195b;return _0x2beb04;})[_0x03a6('0x29')](respondWithFilteredResult(_0x536ed0,_0x5ee442))[_0x03a6('0x47')](handleError(_0x536ed0,null));};exports[_0x03a6('0x48')]=function(_0x174310,_0x4c4680){var _0x224326={'raw':!![],'where':{'id':_0x174310['params']['id']}},_0x43e2d5={};_0x43e2d5[_0x03a6('0x33')]=_[_0x03a6('0x36')](db['Cdr'][_0x03a6('0x30')]);_0x43e2d5[_0x03a6('0x35')]=_[_0x03a6('0x36')](_0x174310['query']);_0x43e2d5[_0x03a6('0x37')]=_['intersection'](_0x43e2d5[_0x03a6('0x33')],_0x43e2d5['query']);_0x224326[_0x03a6('0x39')]=_[_0x03a6('0x38')](_0x43e2d5[_0x03a6('0x33')],qs[_0x03a6('0x3a')](_0x174310[_0x03a6('0x35')][_0x03a6('0x3a')]));_0x224326[_0x03a6('0x39')]=_0x224326[_0x03a6('0x39')][_0x03a6('0x3b')]?_0x224326['attributes']:_0x43e2d5['model'];if(_0x174310[_0x03a6('0x35')][_0x03a6('0x43')]){_0x224326[_0x03a6('0x44')]=[{'all':!![]}];}_0x224326=_['merge']({},_0x224326,_0x174310[_0x03a6('0x49')]);return db[_0x03a6('0x2f')][_0x03a6('0x4a')](_0x224326)[_0x03a6('0x29')](handleEntityNotFound(_0x4c4680,null))['then'](respondWithResult(_0x4c4680,null))[_0x03a6('0x47')](handleError(_0x4c4680,null));};exports[_0x03a6('0x4b')]=function(_0x4f961a,_0x21b754){return db[_0x03a6('0x2f')]['create'](_0x4f961a[_0x03a6('0x4c')],{})[_0x03a6('0x29')](respondWithResult(_0x21b754,0xc9))[_0x03a6('0x47')](handleError(_0x21b754,null));};exports[_0x03a6('0x28')]=function(_0x311d0d,_0x8e0a16){if(_0x311d0d[_0x03a6('0x4c')]['id']){delete _0x311d0d[_0x03a6('0x4c')]['id'];}return db[_0x03a6('0x2f')][_0x03a6('0x4a')]({'where':{'id':_0x311d0d['params']['id']}})[_0x03a6('0x29')](handleEntityNotFound(_0x8e0a16,null))[_0x03a6('0x29')](saveUpdates(_0x311d0d[_0x03a6('0x4c')],null))['then'](respondWithResult(_0x8e0a16,null))['catch'](handleError(_0x8e0a16,null));};exports['destroy']=function(_0x5a082d,_0x4fa115){return db[_0x03a6('0x2f')][_0x03a6('0x4a')]({'where':{'id':_0x5a082d[_0x03a6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fa115,null))[_0x03a6('0x29')](removeEntity(_0x4fa115,null))['catch'](handleError(_0x4fa115,null));};exports['describe']=function(_0x157642,_0x22bf32){return db['Cdr']['describe']()['then'](respondWithResult(_0x22bf32,null))[_0x03a6('0x47')](handleError(_0x22bf32,null));}; \ No newline at end of file +var _0xfe52=['stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error'];(function(_0x4564d0,_0x5da430){var _0x45e98c=function(_0x5c0568){while(--_0x5c0568){_0x4564d0['push'](_0x4564d0['shift']());}};_0x45e98c(++_0x5da430);}(_0xfe52,0x70));var _0x2fe5=function(_0x21c976,_0x250c28){_0x21c976=_0x21c976-0x0;var _0x3f0950=_0xfe52[_0x21c976];return _0x3f0950;};'use strict';var pdf=require(_0x2fe5('0x0'));var emlformat=require(_0x2fe5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2fe5('0x2'));var jsonpatch=require(_0x2fe5('0x3'));var rp=require(_0x2fe5('0x4'));var moment=require(_0x2fe5('0x5'));var BPromise=require(_0x2fe5('0x6'));var Mustache=require(_0x2fe5('0x7'));var util=require(_0x2fe5('0x8'));var path=require(_0x2fe5('0x9'));var sox=require(_0x2fe5('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2fe5('0xb'));var crypto=require('crypto');var jsforce=require(_0x2fe5('0xc'));var deskjs=require(_0x2fe5('0xd'));var toCsv=require(_0x2fe5('0xe'));var querystring=require(_0x2fe5('0xf'));var Papa=require(_0x2fe5('0x10'));var Redis=require(_0x2fe5('0x11'));var authService=require(_0x2fe5('0x12'));var qs=require(_0x2fe5('0x13'));var as=require(_0x2fe5('0x14'));var hardwareService=require(_0x2fe5('0x15'));var logger=require(_0x2fe5('0x16'))(_0x2fe5('0x17'));var utils=require(_0x2fe5('0x18'));var config=require(_0x2fe5('0x19'));var db=require(_0x2fe5('0x1a'))['db'];function respondWithStatusCode(_0x397851,_0x13ebe7){_0x13ebe7=_0x13ebe7||0xcc;return function(_0x1bdfce){if(_0x1bdfce){return _0x397851['sendStatus'](_0x13ebe7);}return _0x397851[_0x2fe5('0x1b')](_0x13ebe7)[_0x2fe5('0x1c')]();};}function respondWithResult(_0x4fdace,_0x29801e){_0x29801e=_0x29801e||0xc8;return function(_0x2a341a){if(_0x2a341a){return _0x4fdace['status'](_0x29801e)[_0x2fe5('0x1d')](_0x2a341a);}};}function respondWithFilteredResult(_0x922345,_0x5a6a83){return function(_0x54f868){if(_0x54f868){var _0x5f0de2=_0x54f868[_0x2fe5('0x1e')],_0x19e743=_0x5a6a83['offset'],_0x3660ab=_0x5a6a83[_0x2fe5('0x1f')]+_0x5a6a83['limit'],_0x407776;if(_0x3660ab>=_0x5f0de2){_0x3660ab=_0x5f0de2;_0x407776=0xc8;}else{_0x407776=0xce;}_0x922345[_0x2fe5('0x1b')](_0x407776);return _0x922345[_0x2fe5('0x20')](_0x2fe5('0x21'),_0x19e743+'-'+_0x3660ab+'/'+_0x5f0de2)[_0x2fe5('0x1d')](_0x54f868);}return null;};}function patchUpdates(_0x3a7f9e){return function(_0x474999){try{jsonpatch[_0x2fe5('0x22')](_0x474999,_0x3a7f9e,!![]);}catch(_0x141d6d){return BPromise[_0x2fe5('0x23')](_0x141d6d);}return _0x474999['save']();};}function saveUpdates(_0x473046,_0x3f8f28){return function(_0x590ffd){if(_0x590ffd){return _0x590ffd[_0x2fe5('0x24')](_0x473046)['then'](function(_0x32cb2a){return _0x32cb2a;});}return null;};}function removeEntity(_0x46ad35,_0x13de50){return function(_0x4bcc15){if(_0x4bcc15){return _0x4bcc15[_0x2fe5('0x25')]()[_0x2fe5('0x26')](function(){_0x46ad35[_0x2fe5('0x1b')](0xcc)[_0x2fe5('0x1c')]();});}};}function handleEntityNotFound(_0x47f44a,_0x2d6a2c){return function(_0x8780e1){if(!_0x8780e1){_0x47f44a['sendStatus'](0x194);}return _0x8780e1;};}function handleError(_0x744be,_0x5303a0){_0x5303a0=_0x5303a0||0x1f4;return function(_0x5ec7af){logger[_0x2fe5('0x27')](_0x5ec7af[_0x2fe5('0x28')]);if(_0x5ec7af[_0x2fe5('0x29')]){delete _0x5ec7af['name'];}_0x744be['status'](_0x5303a0)[_0x2fe5('0x2a')](_0x5ec7af);};}exports[_0x2fe5('0x2b')]=function(_0x3681de,_0x496a79){var _0xed62a9={},_0x35c56f={},_0x234d77={'count':0x0,'rows':[]};var _0x21a1cf=_[_0x2fe5('0x2c')](db[_0x2fe5('0x2d')][_0x2fe5('0x2e')],function(_0x1afad0){return{'name':_0x1afad0[_0x2fe5('0x2f')],'type':_0x1afad0['type'][_0x2fe5('0x30')]};});_0x35c56f[_0x2fe5('0x31')]=_[_0x2fe5('0x2c')](_0x21a1cf,_0x2fe5('0x29'));_0x35c56f[_0x2fe5('0x32')]=_[_0x2fe5('0x33')](_0x3681de[_0x2fe5('0x32')]);_0x35c56f[_0x2fe5('0x34')]=_[_0x2fe5('0x35')](_0x35c56f[_0x2fe5('0x31')],_0x35c56f['query']);_0xed62a9[_0x2fe5('0x36')]=_[_0x2fe5('0x35')](_0x35c56f[_0x2fe5('0x31')],qs[_0x2fe5('0x37')](_0x3681de[_0x2fe5('0x32')][_0x2fe5('0x37')]));_0xed62a9[_0x2fe5('0x36')]=_0xed62a9[_0x2fe5('0x36')][_0x2fe5('0x38')]?_0xed62a9[_0x2fe5('0x36')]:_0x35c56f['model'];if(!_0x3681de[_0x2fe5('0x32')]['hasOwnProperty'](_0x2fe5('0x39'))){_0xed62a9[_0x2fe5('0x3a')]=qs[_0x2fe5('0x3a')](_0x3681de[_0x2fe5('0x32')][_0x2fe5('0x3a')]);_0xed62a9[_0x2fe5('0x1f')]=qs['offset'](_0x3681de['query'][_0x2fe5('0x1f')]);}_0xed62a9[_0x2fe5('0x3b')]=qs[_0x2fe5('0x3c')](_0x3681de[_0x2fe5('0x32')][_0x2fe5('0x3c')]);_0xed62a9[_0x2fe5('0x3d')]=qs[_0x2fe5('0x34')](_[_0x2fe5('0x3e')](_0x3681de[_0x2fe5('0x32')],_0x35c56f['filters']),_0x21a1cf);if(_0x3681de[_0x2fe5('0x32')][_0x2fe5('0x3f')]){_0xed62a9['where']=_[_0x2fe5('0x40')](_0xed62a9['where'],{'$or':_[_0x2fe5('0x2c')](_0x21a1cf,function(_0x4d4d3f){if(_0x4d4d3f[_0x2fe5('0x41')]!==_0x2fe5('0x42')){var _0x42d63a={};_0x42d63a[_0x4d4d3f[_0x2fe5('0x29')]]={'$like':'%'+_0x3681de[_0x2fe5('0x32')][_0x2fe5('0x3f')]+'%'};return _0x42d63a;}})});}_0xed62a9=_[_0x2fe5('0x40')]({},_0xed62a9,_0x3681de['options']);var _0x1b4a35={'where':_0xed62a9[_0x2fe5('0x3d')]};return db[_0x2fe5('0x2d')][_0x2fe5('0x1e')](_0x1b4a35)[_0x2fe5('0x26')](function(_0x2f576c){_0x234d77[_0x2fe5('0x1e')]=_0x2f576c;if(_0x3681de['query'][_0x2fe5('0x43')]){_0xed62a9[_0x2fe5('0x44')]=[{'all':!![]}];}return db['Cdr']['findAll'](_0xed62a9);})['then'](function(_0x369ebe){_0x234d77['rows']=_0x369ebe;return _0x234d77;})[_0x2fe5('0x26')](respondWithFilteredResult(_0x496a79,_0xed62a9))[_0x2fe5('0x45')](handleError(_0x496a79,null));};exports[_0x2fe5('0x46')]=function(_0x466c49,_0x34a627){var _0x5d0e53={'raw':!![],'where':{'id':_0x466c49[_0x2fe5('0x47')]['id']}},_0x592aee={};_0x592aee['model']=_['keys'](db['Cdr']['rawAttributes']);_0x592aee[_0x2fe5('0x32')]=_['keys'](_0x466c49[_0x2fe5('0x32')]);_0x592aee[_0x2fe5('0x34')]=_[_0x2fe5('0x35')](_0x592aee[_0x2fe5('0x31')],_0x592aee['query']);_0x5d0e53[_0x2fe5('0x36')]=_['intersection'](_0x592aee[_0x2fe5('0x31')],qs[_0x2fe5('0x37')](_0x466c49[_0x2fe5('0x32')][_0x2fe5('0x37')]));_0x5d0e53['attributes']=_0x5d0e53[_0x2fe5('0x36')]['length']?_0x5d0e53[_0x2fe5('0x36')]:_0x592aee[_0x2fe5('0x31')];if(_0x466c49[_0x2fe5('0x32')][_0x2fe5('0x43')]){_0x5d0e53['include']=[{'all':!![]}];}_0x5d0e53=_[_0x2fe5('0x40')]({},_0x5d0e53,_0x466c49['options']);return db[_0x2fe5('0x2d')]['find'](_0x5d0e53)[_0x2fe5('0x26')](handleEntityNotFound(_0x34a627,null))[_0x2fe5('0x26')](respondWithResult(_0x34a627,null))[_0x2fe5('0x45')](handleError(_0x34a627,null));};exports[_0x2fe5('0x48')]=function(_0x3aff7e,_0xc85edf){return db[_0x2fe5('0x2d')][_0x2fe5('0x48')](_0x3aff7e[_0x2fe5('0x49')],{})[_0x2fe5('0x26')](respondWithResult(_0xc85edf,0xc9))[_0x2fe5('0x45')](handleError(_0xc85edf,null));};exports[_0x2fe5('0x24')]=function(_0x50d2db,_0x4f289b){if(_0x50d2db[_0x2fe5('0x49')]['id']){delete _0x50d2db[_0x2fe5('0x49')]['id'];}return db['Cdr'][_0x2fe5('0x4a')]({'where':{'id':_0x50d2db[_0x2fe5('0x47')]['id']}})[_0x2fe5('0x26')](handleEntityNotFound(_0x4f289b,null))['then'](saveUpdates(_0x50d2db[_0x2fe5('0x49')],null))[_0x2fe5('0x26')](respondWithResult(_0x4f289b,null))[_0x2fe5('0x45')](handleError(_0x4f289b,null));};exports['destroy']=function(_0x11dc3f,_0x404523){return db[_0x2fe5('0x2d')][_0x2fe5('0x4a')]({'where':{'id':_0x11dc3f[_0x2fe5('0x47')]['id']}})[_0x2fe5('0x26')](handleEntityNotFound(_0x404523,null))[_0x2fe5('0x26')](removeEntity(_0x404523,null))['catch'](handleError(_0x404523,null));};exports[_0x2fe5('0x4b')]=function(_0x5cd4ab,_0x4678dd){return db[_0x2fe5('0x2d')][_0x2fe5('0x4b')]()[_0x2fe5('0x26')](respondWithResult(_0x4678dd,null))[_0x2fe5('0x45')](handleError(_0x4678dd,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 62c15df..644fab1 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 _0xed9d=['request-promise','path','rimraf','../../config/environment','exports','Cdr','cdr','calldate','disposition','src','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x43a251,_0x2ca1b8){var _0x15f782=function(_0x8b1d41){while(--_0x8b1d41){_0x43a251['push'](_0x43a251['shift']());}};_0x15f782(++_0x2ca1b8);}(_0xed9d,0xab));var _0xded9=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xed9d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var logger=require(_0xded9('0x2'))(_0xded9('0x3'));var moment=require('moment');var BPromise=require(_0xded9('0x4'));var rp=require(_0xded9('0x5'));var fs=require('fs');var path=require(_0xded9('0x6'));var rimraf=require(_0xded9('0x7'));var config=require(_0xded9('0x8'));var attributes=require('./cdr.attributes');module[_0xded9('0x9')]=function(_0x20417c,_0x2ea589){return _0x20417c['define'](_0xded9('0xa'),attributes,{'tableName':_0xded9('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':['accountcode']},{'name':_0xded9('0xc'),'fields':[_0xded9('0xc')]},{'name':_0xded9('0xd'),'fields':[_0xded9('0xd')]},{'name':'dst','fields':['dst']},{'name':'src','fields':[_0xded9('0xe')]},{'name':'uniqueid','fields':[_0xded9('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x69c9=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src'];(function(_0x2b8077,_0x384e00){var _0x5b4396=function(_0x105f58){while(--_0x105f58){_0x2b8077['push'](_0x2b8077['shift']());}};_0x5b4396(++_0x384e00);}(_0x69c9,0x1cc));var _0x969c=function(_0x37bd10,_0x47738e){_0x37bd10=_0x37bd10-0x0;var _0x49fd61=_0x69c9[_0x37bd10];return _0x49fd61;};'use strict';var _=require(_0x969c('0x0'));var util=require(_0x969c('0x1'));var logger=require(_0x969c('0x2'))('api');var moment=require(_0x969c('0x3'));var BPromise=require(_0x969c('0x4'));var rp=require(_0x969c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x969c('0x6'));var attributes=require('./cdr.attributes');module[_0x969c('0x7')]=function(_0x38e74c,_0x179f8f){return _0x38e74c[_0x969c('0x8')](_0x969c('0x9'),attributes,{'tableName':_0x969c('0xa'),'paranoid':![],'indexes':[{'name':_0x969c('0xb'),'fields':[_0x969c('0xb')]},{'name':'calldate','fields':[_0x969c('0xc')]},{'name':_0x969c('0xd'),'fields':[_0x969c('0xd')]},{'name':_0x969c('0xe'),'fields':[_0x969c('0xe')]},{'name':_0x969c('0xf'),'fields':[_0x969c('0xf')]},{'name':_0x969c('0x10'),'fields':[_0x969c('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 3874cc6..0bccb57 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 _0x8cc9=['Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2ee7e1,_0xcf2156){var _0x3e6dc7=function(_0x795f53){while(--_0x795f53){_0x2ee7e1['push'](_0x2ee7e1['shift']());}};_0x3e6dc7(++_0xcf2156);}(_0x8cc9,0x188));var _0x98cc=function(_0x42cc5f,_0x4806cd){_0x42cc5f=_0x42cc5f-0x0;var _0x152bb6=_0x8cc9[_0x42cc5f];return _0x152bb6;};'use strict';var _=require(_0x98cc('0x0'));var util=require(_0x98cc('0x1'));var moment=require(_0x98cc('0x2'));var BPromise=require(_0x98cc('0x3'));var rs=require(_0x98cc('0x4'));var fs=require('fs');var Redis=require(_0x98cc('0x5'));var db=require(_0x98cc('0x6'))['db'];var utils=require(_0x98cc('0x7'));var logger=require(_0x98cc('0x8'))(_0x98cc('0x9'));var config=require(_0x98cc('0xa'));var jayson=require(_0x98cc('0xb'));var client=jayson[_0x98cc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22c53d,_0xfc463d,_0x5e4f0f){return new BPromise(function(_0x359d9f,_0x191715){return client[_0x98cc('0xd')](_0x22c53d,_0x5e4f0f)[_0x98cc('0xe')](function(_0x24a5bc){logger[_0x98cc('0xf')](_0x98cc('0x10'),_0xfc463d,'request\x20sent');logger[_0x98cc('0x11')](_0x98cc('0x12'),_0xfc463d,_0x98cc('0x13'),JSON['stringify'](_0x24a5bc));if(_0x24a5bc['error']){if(_0x24a5bc[_0x98cc('0x14')]['code']===0x1f4){logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x24a5bc[_0x98cc('0x14')][_0x98cc('0x15')]);return _0x191715(_0x24a5bc[_0x98cc('0x14')]['message']);}logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x24a5bc['error']['message']);return _0x359d9f(_0x24a5bc[_0x98cc('0x14')][_0x98cc('0x15')]);}else{logger['info'](_0x98cc('0x10'),_0xfc463d,_0x98cc('0x13'));_0x359d9f(_0x24a5bc[_0x98cc('0x16')][_0x98cc('0x15')]);}})[_0x98cc('0x17')](function(_0x4a216e){logger[_0x98cc('0x14')](_0x98cc('0x10'),_0xfc463d,_0x4a216e);_0x191715(_0x4a216e);});});} \ No newline at end of file +var _0x5ef5=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','message','info','Cdr,\x20%s,\x20%s','result','catch'];(function(_0x32a1c4,_0x76aec8){var _0xa98786=function(_0x2aa09e){while(--_0x2aa09e){_0x32a1c4['push'](_0x32a1c4['shift']());}};_0xa98786(++_0x76aec8);}(_0x5ef5,0x118));var _0x55ef=function(_0x4c97b5,_0x3d3f37){_0x4c97b5=_0x4c97b5-0x0;var _0x1ab2f4=_0x5ef5[_0x4c97b5];return _0x1ab2f4;};'use strict';var _=require('lodash');var util=require(_0x55ef('0x0'));var moment=require('moment');var BPromise=require(_0x55ef('0x1'));var rs=require(_0x55ef('0x2'));var fs=require('fs');var Redis=require(_0x55ef('0x3'));var db=require(_0x55ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x55ef('0x5'))(_0x55ef('0x6'));var config=require(_0x55ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x55ef('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x470f97,_0x4439a7,_0x1be56d){return new BPromise(function(_0x194b7a,_0xf5106f){return client[_0x55ef('0x9')](_0x470f97,_0x1be56d)[_0x55ef('0xa')](function(_0xb94bc2){logger['info']('Cdr,\x20%s,\x20%s',_0x4439a7,_0x55ef('0xb'));logger[_0x55ef('0xc')]('Cdr,\x20%s,\x20%s,\x20%s',_0x4439a7,_0x55ef('0xb'),JSON[_0x55ef('0xd')](_0xb94bc2));if(_0xb94bc2[_0x55ef('0xe')]){if(_0xb94bc2[_0x55ef('0xe')]['code']===0x1f4){logger[_0x55ef('0xe')]('Cdr,\x20%s,\x20%s',_0x4439a7,_0xb94bc2[_0x55ef('0xe')][_0x55ef('0xf')]);return _0xf5106f(_0xb94bc2[_0x55ef('0xe')][_0x55ef('0xf')]);}logger[_0x55ef('0xe')]('Cdr,\x20%s,\x20%s',_0x4439a7,_0xb94bc2[_0x55ef('0xe')][_0x55ef('0xf')]);return _0x194b7a(_0xb94bc2['error'][_0x55ef('0xf')]);}else{logger[_0x55ef('0x10')](_0x55ef('0x11'),_0x4439a7,_0x55ef('0xb'));_0x194b7a(_0xb94bc2[_0x55ef('0x12')][_0x55ef('0xf')]);}})[_0x55ef('0x13')](function(_0x2db011){logger['error']('Cdr,\x20%s,\x20%s',_0x4439a7,_0x2db011);_0xf5106f(_0x2db011);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f74f2dc..6da183d 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 _0x8994=['show','create','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','get','/describe','/:id','isAuthenticated'];(function(_0x48b8ad,_0xe28403){var _0x4d1bae=function(_0x5d13b2){while(--_0x5d13b2){_0x48b8ad['push'](_0x48b8ad['shift']());}};_0x4d1bae(++_0xe28403);}(_0x8994,0xd1));var _0x4899=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8994[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x4899('0x0'));var util=require(_0x4899('0x1'));var path=require('path');var timeout=require(_0x4899('0x2'));var express=require(_0x4899('0x3'));var router=express[_0x4899('0x4')]();var auth=require(_0x4899('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4899('0x6'));var controller=require(_0x4899('0x7'));router[_0x4899('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4899('0x8')](_0x4899('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4899('0xa'),auth[_0x4899('0xb')](),controller[_0x4899('0xc')]);router['post']('/',auth[_0x4899('0xb')](),controller[_0x4899('0xd')]);router[_0x4899('0xe')](_0x4899('0xa'),auth[_0x4899('0xb')](),controller['update']);router[_0x4899('0xf')](_0x4899('0xa'),auth[_0x4899('0xb')](),controller[_0x4899('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf05c=['index','/describe','describe','/:id','show','post','create','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf05c,0xbe));var _0xcf05=function(_0x459c56,_0x39361c){_0x459c56=_0x459c56-0x0;var _0x56cb1b=_0xf05c[_0x459c56];return _0x56cb1b;};'use strict';var multer=require('multer');var util=require(_0xcf05('0x0'));var path=require(_0xcf05('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf05('0x2'));var router=express[_0xcf05('0x3')]();var auth=require(_0xcf05('0x4'));var interaction=require(_0xcf05('0x5'));var config=require(_0xcf05('0x6'));var controller=require(_0xcf05('0x7'));router[_0xcf05('0x8')]('/',auth[_0xcf05('0x9')](),controller[_0xcf05('0xa')]);router[_0xcf05('0x8')](_0xcf05('0xb'),auth[_0xcf05('0x9')](),controller[_0xcf05('0xc')]);router[_0xcf05('0x8')](_0xcf05('0xd'),auth[_0xcf05('0x9')](),controller[_0xcf05('0xe')]);router[_0xcf05('0xf')]('/',auth[_0xcf05('0x9')](),controller[_0xcf05('0x10')]);router['put'](_0xcf05('0xd'),auth[_0xcf05('0x9')](),controller[_0xcf05('0x11')]);router[_0xcf05('0x12')](_0xcf05('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcf05('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8c3f495..947b89d 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 _0x0b77=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x388eb7,_0x2f1bcb){var _0x17f762=function(_0x7a187c){while(--_0x7a187c){_0x388eb7['push'](_0x388eb7['shift']());}};_0x17f762(++_0x2f1bcb);}(_0x0b77,0x1c3));var _0x70b7=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x0b77[_0x2f8530];return _0x5e814e;};'use strict';var Sequelize=require(_0x70b7('0x0'));module[_0x70b7('0x1')]={'priority':{'type':Sequelize[_0x70b7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x70b7('0x3')],'allowNull':![],'defaultValue':_0x70b7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x70b7('0x3')]},'interval':{'type':Sequelize[_0x70b7('0x3')],'defaultValue':_0x70b7('0x5')}}; \ No newline at end of file +var _0x130e=['INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x33dbdb,_0x1b7d12){var _0x1fb172=function(_0x1eba99){while(--_0x1eba99){_0x33dbdb['push'](_0x33dbdb['shift']());}};_0x1fb172(++_0x1b7d12);}(_0x130e,0x126));var _0xe130=function(_0x1c5164,_0x3556a4){_0x1c5164=_0x1c5164-0x0;var _0x12e023=_0x130e[_0x1c5164];return _0x12e023;};'use strict';var Sequelize=require(_0xe130('0x0'));module['exports']={'priority':{'type':Sequelize[_0xe130('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe130('0x2')},'appdata':{'type':Sequelize[_0xe130('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe130('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7b79b9a..c3128da 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 _0x64be=['name','send','show','params','model','keys','ChatApplication','rawAttributes','query','fields','attributes','includeAll','include','options','catch','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','stack'];(function(_0x436a03,_0x423aaf){var _0xec83db=function(_0x4f6d10){while(--_0x4f6d10){_0x436a03['push'](_0x436a03['shift']());}};_0xec83db(++_0x423aaf);}(_0x64be,0x7d));var _0xe64b=function(_0x48a67f,_0x12fd90){_0x48a67f=_0x48a67f-0x0;var _0x4f1faf=_0x64be[_0x48a67f];return _0x4f1faf;};'use strict';var pdf=require(_0xe64b('0x0'));var emlformat=require(_0xe64b('0x1'));var rimraf=require(_0xe64b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe64b('0x3'));var moment=require('moment');var BPromise=require(_0xe64b('0x4'));var Mustache=require(_0xe64b('0x5'));var util=require(_0xe64b('0x6'));var path=require(_0xe64b('0x7'));var sox=require(_0xe64b('0x8'));var csv=require(_0xe64b('0x9'));var ejs=require(_0xe64b('0xa'));var fs=require('fs');var _=require(_0xe64b('0xb'));var squel=require(_0xe64b('0xc'));var crypto=require(_0xe64b('0xd'));var jsforce=require(_0xe64b('0xe'));var deskjs=require(_0xe64b('0xf'));var toCsv=require(_0xe64b('0x9'));var querystring=require(_0xe64b('0x10'));var Papa=require(_0xe64b('0x11'));var Redis=require(_0xe64b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe64b('0x13'));var as=require(_0xe64b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe64b('0x15'));var config=require('../../config/environment');var db=require(_0xe64b('0x16'))['db'];function respondWithStatusCode(_0x2dd7ac,_0xf57d72){_0xf57d72=_0xf57d72||0xcc;return function(_0x4caf5d){if(_0x4caf5d){return _0x2dd7ac[_0xe64b('0x17')](_0xf57d72);}return _0x2dd7ac[_0xe64b('0x18')](_0xf57d72)[_0xe64b('0x19')]();};}function respondWithResult(_0x1db43f,_0x4c6e70){_0x4c6e70=_0x4c6e70||0xc8;return function(_0x27b00c){if(_0x27b00c){return _0x1db43f[_0xe64b('0x18')](_0x4c6e70)[_0xe64b('0x1a')](_0x27b00c);}};}function respondWithFilteredResult(_0x5aee1c,_0x1b8ba1){return function(_0x5d6c90){if(_0x5d6c90){var _0x1f7e7a=_0x5d6c90['count'],_0x4fee95=_0x1b8ba1[_0xe64b('0x1b')],_0x13304f=_0x1b8ba1[_0xe64b('0x1b')]+_0x1b8ba1[_0xe64b('0x1c')],_0x164b1c;if(_0x13304f>=_0x1f7e7a){_0x13304f=_0x1f7e7a;_0x164b1c=0xc8;}else{_0x164b1c=0xce;}_0x5aee1c[_0xe64b('0x18')](_0x164b1c);return _0x5aee1c[_0xe64b('0x1d')]('Content-Range',_0x4fee95+'-'+_0x13304f+'/'+_0x1f7e7a)[_0xe64b('0x1a')](_0x5d6c90);}return null;};}function patchUpdates(_0x4041b4){return function(_0x405818){try{jsonpatch[_0xe64b('0x1e')](_0x405818,_0x4041b4,!![]);}catch(_0x20e0ec){return BPromise[_0xe64b('0x1f')](_0x20e0ec);}return _0x405818[_0xe64b('0x20')]();};}function saveUpdates(_0x67025b,_0xf6cd85){return function(_0x3561d3){if(_0x3561d3){return _0x3561d3[_0xe64b('0x21')](_0x67025b)['then'](function(_0x3e3e83){return _0x3e3e83;});}return null;};}function removeEntity(_0x48118d,_0x2387da){return function(_0x4b506f){if(_0x4b506f){return _0x4b506f[_0xe64b('0x22')]()[_0xe64b('0x23')](function(){_0x48118d[_0xe64b('0x18')](0xcc)[_0xe64b('0x19')]();});}};}function handleEntityNotFound(_0x535b14,_0x2bf03b){return function(_0x54168e){if(!_0x54168e){_0x535b14[_0xe64b('0x17')](0x194);}return _0x54168e;};}function handleError(_0x5199be,_0x2d1521){_0x2d1521=_0x2d1521||0x1f4;return function(_0x2bb55e){logger['error'](_0x2bb55e[_0xe64b('0x24')]);if(_0x2bb55e['name']){delete _0x2bb55e[_0xe64b('0x25')];}_0x5199be[_0xe64b('0x18')](_0x2d1521)[_0xe64b('0x26')](_0x2bb55e);};}exports[_0xe64b('0x27')]=function(_0x531c85,_0xda1708){var _0x44e5df={'raw':!![],'where':{'id':_0x531c85[_0xe64b('0x28')]['id']}},_0x14e503={};_0x14e503[_0xe64b('0x29')]=_[_0xe64b('0x2a')](db[_0xe64b('0x2b')][_0xe64b('0x2c')]);_0x14e503[_0xe64b('0x2d')]=_['keys'](_0x531c85[_0xe64b('0x2d')]);_0x14e503['filters']=_['intersection'](_0x14e503['model'],_0x14e503['query']);_0x44e5df['attributes']=_['intersection'](_0x14e503[_0xe64b('0x29')],qs['fields'](_0x531c85[_0xe64b('0x2d')][_0xe64b('0x2e')]));_0x44e5df[_0xe64b('0x2f')]=_0x44e5df[_0xe64b('0x2f')]['length']?_0x44e5df[_0xe64b('0x2f')]:_0x14e503[_0xe64b('0x29')];if(_0x531c85[_0xe64b('0x2d')][_0xe64b('0x30')]){_0x44e5df[_0xe64b('0x31')]=[{'all':!![]}];}_0x44e5df=_['merge']({},_0x44e5df,_0x531c85[_0xe64b('0x32')]);return db[_0xe64b('0x2b')]['find'](_0x44e5df)['then'](handleEntityNotFound(_0xda1708,null))[_0xe64b('0x23')](respondWithResult(_0xda1708,null))[_0xe64b('0x33')](handleError(_0xda1708,null));};exports[_0xe64b('0x21')]=function(_0x66ee1e,_0x1d0d8d){if(_0x66ee1e[_0xe64b('0x34')]['id']){delete _0x66ee1e[_0xe64b('0x34')]['id'];}return db[_0xe64b('0x2b')][_0xe64b('0x35')]({'where':{'id':_0x66ee1e[_0xe64b('0x28')]['id']}})[_0xe64b('0x23')](handleEntityNotFound(_0x1d0d8d,null))['then'](saveUpdates(_0x66ee1e[_0xe64b('0x34')],null))[_0xe64b('0x23')](respondWithResult(_0x1d0d8d,null))[_0xe64b('0x33')](handleError(_0x1d0d8d,null));};exports[_0xe64b('0x22')]=function(_0x5eac47,_0x440c70){return db[_0xe64b('0x2b')][_0xe64b('0x35')]({'where':{'id':_0x5eac47[_0xe64b('0x28')]['id']}})[_0xe64b('0x23')](handleEntityNotFound(_0x440c70,null))[_0xe64b('0x23')](removeEntity(_0x440c70,null))[_0xe64b('0x33')](handleError(_0x440c70,null));}; \ No newline at end of file +var _0x0022=['query','intersection','fields','attributes','length','includeAll','include','options','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','offset','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes'];(function(_0x4c8fa1,_0x4e4bde){var _0x9768c9=function(_0x4b4ef4){while(--_0x4b4ef4){_0x4c8fa1['push'](_0x4c8fa1['shift']());}};_0x9768c9(++_0x4e4bde);}(_0x0022,0x168));var _0x2002=function(_0x29976,_0x35de12){_0x29976=_0x29976-0x0;var _0x5cd575=_0x0022[_0x29976];return _0x5cd575;};'use strict';var pdf=require(_0x2002('0x0'));var emlformat=require(_0x2002('0x1'));var rimraf=require(_0x2002('0x2'));var zipdir=require(_0x2002('0x3'));var jsonpatch=require(_0x2002('0x4'));var rp=require('request-promise');var moment=require(_0x2002('0x5'));var BPromise=require(_0x2002('0x6'));var Mustache=require(_0x2002('0x7'));var util=require(_0x2002('0x8'));var path=require(_0x2002('0x9'));var sox=require(_0x2002('0xa'));var csv=require(_0x2002('0xb'));var ejs=require(_0x2002('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2002('0xd'));var jsforce=require(_0x2002('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2002('0xb'));var querystring=require(_0x2002('0xf'));var Papa=require(_0x2002('0x10'));var Redis=require('ioredis');var authService=require(_0x2002('0x11'));var qs=require(_0x2002('0x12'));var as=require(_0x2002('0x13'));var hardwareService=require(_0x2002('0x14'));var logger=require('../../config/logger')(_0x2002('0x15'));var utils=require('../../config/utils');var config=require(_0x2002('0x16'));var db=require(_0x2002('0x17'))['db'];function respondWithStatusCode(_0x30838a,_0x45afe7){_0x45afe7=_0x45afe7||0xcc;return function(_0x5d5a85){if(_0x5d5a85){return _0x30838a['sendStatus'](_0x45afe7);}return _0x30838a['status'](_0x45afe7)[_0x2002('0x18')]();};}function respondWithResult(_0x19490a,_0x505c59){_0x505c59=_0x505c59||0xc8;return function(_0x1b4147){if(_0x1b4147){return _0x19490a['status'](_0x505c59)['json'](_0x1b4147);}};}function respondWithFilteredResult(_0x38f6f2,_0x23c04d){return function(_0xd030dd){if(_0xd030dd){var _0x2a49b2=_0xd030dd['count'],_0x528168=_0x23c04d[_0x2002('0x19')],_0x4930f2=_0x23c04d['offset']+_0x23c04d[_0x2002('0x1a')],_0x16e750;if(_0x4930f2>=_0x2a49b2){_0x4930f2=_0x2a49b2;_0x16e750=0xc8;}else{_0x16e750=0xce;}_0x38f6f2[_0x2002('0x1b')](_0x16e750);return _0x38f6f2[_0x2002('0x1c')](_0x2002('0x1d'),_0x528168+'-'+_0x4930f2+'/'+_0x2a49b2)[_0x2002('0x1e')](_0xd030dd);}return null;};}function patchUpdates(_0x4b6a05){return function(_0x5ca0e1){try{jsonpatch[_0x2002('0x1f')](_0x5ca0e1,_0x4b6a05,!![]);}catch(_0x2a718a){return BPromise[_0x2002('0x20')](_0x2a718a);}return _0x5ca0e1[_0x2002('0x21')]();};}function saveUpdates(_0x51ade,_0x5a218a){return function(_0x694f46){if(_0x694f46){return _0x694f46['update'](_0x51ade)[_0x2002('0x22')](function(_0x158b87){return _0x158b87;});}return null;};}function removeEntity(_0x522935,_0x4ab4ed){return function(_0x25937f){if(_0x25937f){return _0x25937f[_0x2002('0x23')]()[_0x2002('0x22')](function(){_0x522935['status'](0xcc)[_0x2002('0x18')]();});}};}function handleEntityNotFound(_0x1841c8,_0x542b4d){return function(_0x27379d){if(!_0x27379d){_0x1841c8[_0x2002('0x24')](0x194);}return _0x27379d;};}function handleError(_0x44120e,_0x345016){_0x345016=_0x345016||0x1f4;return function(_0x466023){logger['error'](_0x466023[_0x2002('0x25')]);if(_0x466023[_0x2002('0x26')]){delete _0x466023[_0x2002('0x26')];}_0x44120e[_0x2002('0x1b')](_0x345016)[_0x2002('0x27')](_0x466023);};}exports[_0x2002('0x28')]=function(_0x3c1a66,_0x1b0397){var _0x285795={'raw':!![],'where':{'id':_0x3c1a66[_0x2002('0x29')]['id']}},_0x20b49c={};_0x20b49c[_0x2002('0x2a')]=_[_0x2002('0x2b')](db[_0x2002('0x2c')][_0x2002('0x2d')]);_0x20b49c['query']=_['keys'](_0x3c1a66[_0x2002('0x2e')]);_0x20b49c['filters']=_[_0x2002('0x2f')](_0x20b49c['model'],_0x20b49c[_0x2002('0x2e')]);_0x285795['attributes']=_[_0x2002('0x2f')](_0x20b49c['model'],qs[_0x2002('0x30')](_0x3c1a66[_0x2002('0x2e')][_0x2002('0x30')]));_0x285795['attributes']=_0x285795[_0x2002('0x31')][_0x2002('0x32')]?_0x285795[_0x2002('0x31')]:_0x20b49c[_0x2002('0x2a')];if(_0x3c1a66[_0x2002('0x2e')][_0x2002('0x33')]){_0x285795[_0x2002('0x34')]=[{'all':!![]}];}_0x285795=_['merge']({},_0x285795,_0x3c1a66[_0x2002('0x35')]);return db[_0x2002('0x2c')][_0x2002('0x36')](_0x285795)[_0x2002('0x22')](handleEntityNotFound(_0x1b0397,null))[_0x2002('0x22')](respondWithResult(_0x1b0397,null))[_0x2002('0x37')](handleError(_0x1b0397,null));};exports[_0x2002('0x38')]=function(_0x4fa6d0,_0x43882e){if(_0x4fa6d0[_0x2002('0x39')]['id']){delete _0x4fa6d0[_0x2002('0x39')]['id'];}return db[_0x2002('0x2c')][_0x2002('0x36')]({'where':{'id':_0x4fa6d0[_0x2002('0x29')]['id']}})[_0x2002('0x22')](handleEntityNotFound(_0x43882e,null))[_0x2002('0x22')](saveUpdates(_0x4fa6d0[_0x2002('0x39')],null))['then'](respondWithResult(_0x43882e,null))['catch'](handleError(_0x43882e,null));};exports[_0x2002('0x23')]=function(_0x574502,_0x5f1b21){return db[_0x2002('0x2c')]['find']({'where':{'id':_0x574502[_0x2002('0x29')]['id']}})[_0x2002('0x22')](handleEntityNotFound(_0x5f1b21,null))[_0x2002('0x22')](removeEntity(_0x5f1b21,null))[_0x2002('0x37')](handleError(_0x5f1b21,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 984c76c..4e48a2c 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 _0x0b77=['../../config/environment','exports','define','ChatApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x13725b,_0x36f52f){var _0x2530c5=function(_0x42ced2){while(--_0x42ced2){_0x13725b['push'](_0x13725b['shift']());}};_0x2530c5(++_0x36f52f);}(_0x0b77,0x16d));var _0x70b7=function(_0x17249c,_0x168d62){_0x17249c=_0x17249c-0x0;var _0x324e7b=_0x0b77[_0x17249c];return _0x324e7b;};'use strict';var _=require('lodash');var util=require(_0x70b7('0x0'));var logger=require(_0x70b7('0x1'))(_0x70b7('0x2'));var moment=require(_0x70b7('0x3'));var BPromise=require(_0x70b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70b7('0x5'));var rimraf=require(_0x70b7('0x6'));var config=require(_0x70b7('0x7'));var attributes=require('./chatApplication.attributes');module[_0x70b7('0x8')]=function(_0x4bdd0a,_0x10bd7b){return _0x4bdd0a[_0x70b7('0x9')](_0x70b7('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x70b7('0xb')});}; \ No newline at end of file +var _0x79b5=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2bf983,_0x5b4e28){var _0x33b74c=function(_0x33e02e){while(--_0x33e02e){_0x2bf983['push'](_0x2bf983['shift']());}};_0x33b74c(++_0x5b4e28);}(_0x79b5,0x9f));var _0x579b=function(_0x2fc917,_0x338d4c){_0x2fc917=_0x2fc917-0x0;var _0x17fa32=_0x79b5[_0x2fc917];return _0x17fa32;};'use strict';var _=require(_0x579b('0x0'));var util=require(_0x579b('0x1'));var logger=require(_0x579b('0x2'))(_0x579b('0x3'));var moment=require(_0x579b('0x4'));var BPromise=require(_0x579b('0x5'));var rp=require(_0x579b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x579b('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x579b('0x8')]=function(_0x29b8f3,_0x5d2943){return _0x29b8f3[_0x579b('0x9')](_0x579b('0xa'),attributes,{'tableName':_0x579b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x579b('0xc'),'collate':_0x579b('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a630bbd..645bc19 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 _0x9bbc=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x34b30d,_0xaa6257){var _0x5c33ba=function(_0x52c1be){while(--_0x52c1be){_0x34b30d['push'](_0x34b30d['shift']());}};_0x5c33ba(++_0xaa6257);}(_0x9bbc,0x173));var _0xc9bb=function(_0x9152f7,_0x1c56a2){_0x9152f7=_0x9152f7-0x0;var _0xbe781a=_0x9bbc[_0x9152f7];return _0xbe781a;};'use strict';var _=require(_0xc9bb('0x0'));var util=require(_0xc9bb('0x1'));var moment=require(_0xc9bb('0x2'));var BPromise=require(_0xc9bb('0x3'));var rs=require(_0xc9bb('0x4'));var fs=require('fs');var Redis=require(_0xc9bb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9bb('0x6'));var logger=require(_0xc9bb('0x7'))('rpc');var config=require(_0xc9bb('0x8'));var jayson=require(_0xc9bb('0x9'));var client=jayson[_0xc9bb('0xa')][_0xc9bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46544f,_0x38d055,_0x3f6e36){return new BPromise(function(_0x22b560,_0x535150){return client[_0xc9bb('0xc')](_0x46544f,_0x3f6e36)['then'](function(_0x5b2aa8){logger[_0xc9bb('0xd')](_0xc9bb('0xe'),_0x38d055,_0xc9bb('0xf'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x38d055,_0xc9bb('0xf'),JSON['stringify'](_0x5b2aa8));if(_0x5b2aa8['error']){if(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x11')]===0x1f4){logger['error'](_0xc9bb('0xe'),_0x38d055,_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);return _0x535150(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);}logger[_0xc9bb('0x10')](_0xc9bb('0xe'),_0x38d055,_0x5b2aa8[_0xc9bb('0x10')]['message']);return _0x22b560(_0x5b2aa8[_0xc9bb('0x10')][_0xc9bb('0x12')]);}else{logger['info'](_0xc9bb('0xe'),_0x38d055,'request\x20sent');_0x22b560(_0x5b2aa8[_0xc9bb('0x13')][_0xc9bb('0x12')]);}})[_0xc9bb('0x14')](function(_0x5079fd){logger[_0xc9bb('0x10')]('ChatApplication,\x20%s,\x20%s',_0x38d055,_0x5079fd);_0x535150(_0x5079fd);});});} \ No newline at end of file +var _0xcada=['client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xcada,0x1b0));var _0xacad=function(_0x336e45,_0x131afa){_0x336e45=_0x336e45-0x0;var _0x5ca83b=_0xcada[_0x336e45];return _0x5ca83b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xacad('0x0'));var BPromise=require(_0xacad('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacad('0x2'))['db'];var utils=require(_0xacad('0x3'));var logger=require(_0xacad('0x4'))(_0xacad('0x5'));var config=require(_0xacad('0x6'));var jayson=require(_0xacad('0x7'));var client=jayson[_0xacad('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9ee1,_0x4d5724,_0x42afaa){return new BPromise(function(_0x800f0c,_0x14f4f7){return client[_0xacad('0x9')](_0x5e9ee1,_0x42afaa)[_0xacad('0xa')](function(_0x53b30b){logger[_0xacad('0xb')](_0xacad('0xc'),_0x4d5724,_0xacad('0xd'));logger[_0xacad('0xe')](_0xacad('0xf'),_0x4d5724,_0xacad('0xd'),JSON[_0xacad('0x10')](_0x53b30b));if(_0x53b30b[_0xacad('0x11')]){if(_0x53b30b['error'][_0xacad('0x12')]===0x1f4){logger[_0xacad('0x11')](_0xacad('0xc'),_0x4d5724,_0x53b30b[_0xacad('0x11')]['message']);return _0x14f4f7(_0x53b30b[_0xacad('0x11')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x4d5724,_0x53b30b[_0xacad('0x11')][_0xacad('0x13')]);return _0x800f0c(_0x53b30b['error']['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4d5724,_0xacad('0xd'));_0x800f0c(_0x53b30b[_0xacad('0x14')][_0xacad('0x13')]);}})[_0xacad('0x15')](function(_0x8ab774){logger[_0xacad('0x11')](_0xacad('0xc'),_0x4d5724,_0x8ab774);_0x14f4f7(_0x8ab774);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 07618ea..4244c57 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 _0x0711=['/:id','show','isAuthenticated','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','get'];(function(_0xd07a06,_0x8566fe){var _0x76e5be=function(_0x12ec6c){while(--_0x12ec6c){_0xd07a06['push'](_0xd07a06['shift']());}};_0x76e5be(++_0x8566fe);}(_0x0711,0x14a));var _0x1071=function(_0x5e73e3,_0x496454){_0x5e73e3=_0x5e73e3-0x0;var _0x37a1e1=_0x0711[_0x5e73e3];return _0x37a1e1;};'use strict';var multer=require(_0x1071('0x0'));var util=require('util');var path=require(_0x1071('0x1'));var timeout=require(_0x1071('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1071('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1071('0x4'));var controller=require('./chatApplication.controller');router[_0x1071('0x5')](_0x1071('0x6'),auth['isAuthenticated'](),controller[_0x1071('0x7')]);router['put'](_0x1071('0x6'),auth[_0x1071('0x8')](),controller[_0x1071('0x9')]);router[_0x1071('0xa')](_0x1071('0x6'),auth[_0x1071('0x8')](),controller['destroy']);module[_0x1071('0xb')]=router; \ No newline at end of file +var _0x1c5b=['util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1c5b,0x77));var _0xb1c5=function(_0x48d4dc,_0x489e54){_0x48d4dc=_0x48d4dc-0x0;var _0x934a34=_0x1c5b[_0x48d4dc];return _0x934a34;};'use strict';var multer=require(_0xb1c5('0x0'));var util=require(_0xb1c5('0x1'));var path=require(_0xb1c5('0x2'));var timeout=require(_0xb1c5('0x3'));var express=require(_0xb1c5('0x4'));var router=express[_0xb1c5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb1c5('0x6'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xb1c5('0x7')]('/:id',auth[_0xb1c5('0x8')](),controller[_0xb1c5('0x9')]);router[_0xb1c5('0xa')](_0xb1c5('0xb'),auth[_0xb1c5('0x8')](),controller[_0xb1c5('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb1c5('0xd')]);module[_0xb1c5('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 37a40ce..86bb76f 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 _0x2da9=['STRING','sequelize'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x2da9,0x1d1));var _0x92da=function(_0x1779e3,_0x22133b){_0x1779e3=_0x1779e3-0x0;var _0x49f989=_0x2da9[_0x1779e3];return _0x49f989;};'use strict';var Sequelize=require(_0x92da('0x0'));module['exports']={'name':{'type':Sequelize[_0x92da('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x92da('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x66da=['STRING','sequelize','exports'];(function(_0xccdd91,_0x19b6fc){var _0x41a779=function(_0x36b6cc){while(--_0x36b6cc){_0xccdd91['push'](_0xccdd91['shift']());}};_0x41a779(++_0x19b6fc);}(_0x66da,0x12d));var _0xa66d=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x66da[_0x3f6565];return _0x4abd23;};'use strict';var Sequelize=require(_0xa66d('0x0'));module[_0xa66d('0x1')]={'name':{'type':Sequelize[_0xa66d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa66d('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 33e3973..86aadee 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 _0x2158=['api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','count','offset','Content-Range','json','apply','reject','save','destroy','sendStatus','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','fields','find','create','update','body','params','describe','getUnread','ChatInternalMessage','user','omit','ids','findOne','User','pick','getMembers','hasOwnProperty','removeMembers','addMessage','$gte','format','getMessages','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x4139b8,_0x554564){var _0x40c6d6=function(_0x4a743b){while(--_0x4a743b){_0x4139b8['push'](_0x4139b8['shift']());}};_0x40c6d6(++_0x554564);}(_0x2158,0xc3));var _0x8215=function(_0x33fbc4,_0x344f17){_0x33fbc4=_0x33fbc4-0x0;var _0x2789e5=_0x2158[_0x33fbc4];return _0x2789e5;};'use strict';var pdf=require(_0x8215('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8215('0x1'));var zipdir=require(_0x8215('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8215('0x3'));var BPromise=require(_0x8215('0x4'));var Mustache=require(_0x8215('0x5'));var util=require(_0x8215('0x6'));var path=require(_0x8215('0x7'));var sox=require(_0x8215('0x8'));var csv=require(_0x8215('0x9'));var ejs=require(_0x8215('0xa'));var fs=require('fs');var _=require(_0x8215('0xb'));var squel=require(_0x8215('0xc'));var crypto=require(_0x8215('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8215('0xe'));var toCsv=require(_0x8215('0x9'));var querystring=require(_0x8215('0xf'));var Papa=require('papaparse');var Redis=require(_0x8215('0x10'));var authService=require(_0x8215('0x11'));var qs=require(_0x8215('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8215('0x13'));var logger=require(_0x8215('0x14'))(_0x8215('0x15'));var utils=require(_0x8215('0x16'));var config=require(_0x8215('0x17'));var db=require('../../mysqldb')['db'];config[_0x8215('0x18')]=_[_0x8215('0x19')](config[_0x8215('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x8215('0x1a'))(new Redis(config[_0x8215('0x18')]));require(_0x8215('0x1b'))[_0x8215('0x1c')](socket);var jayson=require(_0x8215('0x1d'));var client=jayson[_0x8215('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x344035,_0x8a8f2e,_0x1f1a2c){if(_0x1f1a2c){var _0x55cb04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55cb04[_0x8215('0x1f')](_0x8a8f2e)){return _0x344035;}else{throw new db[(_0x8215('0x20'))][(_0x8215('0x21'))](_0x8215('0x22'));}}else{return _0x344035;}}function respondWithRpcPromise(_0x3787ac,_0xcfa078,_0x331b14,_0x5943b0){return new BPromise(function(_0x4e35f7,_0x32431c){var _0x4e8752=_0x5943b0||client;return _0x4e8752[_0x8215('0x23')](_0x3787ac,_0x331b14)[_0x8215('0x24')](function(_0x24a297){logger[_0x8215('0x25')](_0x8215('0x26'),_0xcfa078,'request\x20sent');logger['debug'](_0x8215('0x27'),_0xcfa078,_0x8215('0x28'),JSON[_0x8215('0x29')](_0x24a297));if(_0x24a297[_0x8215('0x2a')]){if(_0x24a297['error'][_0x8215('0x2b')]===0x1f4){logger['error'](_0x8215('0x26'),_0xcfa078,_0x24a297[_0x8215('0x2a')]['message']);return _0x32431c(_0x24a297[_0x8215('0x2a')][_0x8215('0x2c')]);}logger[_0x8215('0x2a')](_0x8215('0x26'),_0xcfa078,_0x24a297[_0x8215('0x2a')][_0x8215('0x2c')]);return _0x4e35f7(_0x24a297[_0x8215('0x2a')]['message']);}else{logger[_0x8215('0x25')](_0x8215('0x26'),_0xcfa078,_0x8215('0x28'));_0x4e35f7(_0x24a297[_0x8215('0x2d')][_0x8215('0x2c')]);}})[_0x8215('0x2e')](function(_0xf4c6fc){logger[_0x8215('0x2a')](_0x8215('0x26'),_0xcfa078,_0xf4c6fc);_0x32431c(_0xf4c6fc);});});}function respondWithStatusCode(_0x1eb718,_0x3abb2b){_0x3abb2b=_0x3abb2b||0xcc;return function(_0x1a2328){if(_0x1a2328){return _0x1eb718['sendStatus'](_0x3abb2b);}return _0x1eb718['status'](_0x3abb2b)[_0x8215('0x2f')]();};}function respondWithResult(_0x17ec5b,_0x4dc562){_0x4dc562=_0x4dc562||0xc8;return function(_0x211886){if(_0x211886){return _0x17ec5b[_0x8215('0x30')](_0x4dc562)['json'](_0x211886);}};}function respondWithFilteredResult(_0x1ada45,_0x4a0072){return function(_0x767767){if(_0x767767){var _0x524e51=_0x767767[_0x8215('0x31')],_0x5dbccb=_0x4a0072[_0x8215('0x32')],_0x22b90f=_0x4a0072['offset']+_0x4a0072['limit'],_0x412d02;if(_0x22b90f>=_0x524e51){_0x22b90f=_0x524e51;_0x412d02=0xc8;}else{_0x412d02=0xce;}_0x1ada45[_0x8215('0x30')](_0x412d02);return _0x1ada45['set'](_0x8215('0x33'),_0x5dbccb+'-'+_0x22b90f+'/'+_0x524e51)[_0x8215('0x34')](_0x767767);}return null;};}function patchUpdates(_0x53a1db){return function(_0x4fae8d){try{jsonpatch[_0x8215('0x35')](_0x4fae8d,_0x53a1db,!![]);}catch(_0xe8307c){return BPromise[_0x8215('0x36')](_0xe8307c);}return _0x4fae8d[_0x8215('0x37')]();};}function saveUpdates(_0x33fa6a,_0x4fbda2){return function(_0x162b41){if(_0x162b41){return _0x162b41['update'](_0x33fa6a)['then'](function(_0x450aef){return _0x450aef;});}return null;};}function removeEntity(_0x21d076,_0x721c6){return function(_0x3803a9){if(_0x3803a9){return _0x3803a9[_0x8215('0x38')]()[_0x8215('0x24')](function(){_0x21d076[_0x8215('0x30')](0xcc)[_0x8215('0x2f')]();});}};}function handleEntityNotFound(_0x2d327c,_0x519d6d){return function(_0x645af8){if(!_0x645af8){_0x2d327c[_0x8215('0x39')](0x194);}return _0x645af8;};}function handleError(_0xe50e9a,_0x3719b2){_0x3719b2=_0x3719b2||0x1f4;return function(_0x2e49a6){logger[_0x8215('0x2a')](_0x2e49a6['stack']);if(_0x2e49a6[_0x8215('0x3a')]){delete _0x2e49a6[_0x8215('0x3a')];}_0xe50e9a[_0x8215('0x30')](_0x3719b2)[_0x8215('0x3b')](_0x2e49a6);};}exports[_0x8215('0x3c')]=function(_0x5c8e1c,_0x2e030e){var _0x4e3c33={},_0x60fcbc={},_0x4f4d89={'count':0x0,'rows':[]};var _0x2caa68=_[_0x8215('0x3d')](db[_0x8215('0x3e')][_0x8215('0x3f')],function(_0x586ccb){return{'name':_0x586ccb[_0x8215('0x40')],'type':_0x586ccb[_0x8215('0x41')][_0x8215('0x42')]};});_0x60fcbc['model']=_[_0x8215('0x3d')](_0x2caa68,_0x8215('0x3a'));_0x60fcbc[_0x8215('0x43')]=_[_0x8215('0x44')](_0x5c8e1c[_0x8215('0x43')]);_0x60fcbc[_0x8215('0x45')]=_['intersection'](_0x60fcbc[_0x8215('0x46')],_0x60fcbc['query']);_0x4e3c33[_0x8215('0x47')]=_[_0x8215('0x48')](_0x60fcbc[_0x8215('0x46')],qs['fields'](_0x5c8e1c[_0x8215('0x43')]['fields']));_0x4e3c33[_0x8215('0x47')]=_0x4e3c33[_0x8215('0x47')][_0x8215('0x49')]?_0x4e3c33[_0x8215('0x47')]:_0x60fcbc[_0x8215('0x46')];if(!_0x5c8e1c[_0x8215('0x43')]['hasOwnProperty'](_0x8215('0x4a'))){_0x4e3c33[_0x8215('0x4b')]=qs[_0x8215('0x4b')](_0x5c8e1c['query'][_0x8215('0x4b')]);_0x4e3c33[_0x8215('0x32')]=qs['offset'](_0x5c8e1c['query'][_0x8215('0x32')]);}_0x4e3c33[_0x8215('0x4c')]=qs[_0x8215('0x4d')](_0x5c8e1c['query'][_0x8215('0x4d')]);_0x4e3c33[_0x8215('0x4e')]=qs['filters'](_['pick'](_0x5c8e1c[_0x8215('0x43')],_0x60fcbc['filters']),_0x2caa68);if(_0x5c8e1c[_0x8215('0x43')][_0x8215('0x4f')]){_0x4e3c33[_0x8215('0x4e')]=_[_0x8215('0x50')](_0x4e3c33['where'],{'$or':_[_0x8215('0x3d')](_0x2caa68,function(_0x1b513a){if(_0x1b513a['type']!==_0x8215('0x51')){var _0x403cde={};_0x403cde[_0x1b513a[_0x8215('0x3a')]]={'$like':'%'+_0x5c8e1c[_0x8215('0x43')][_0x8215('0x4f')]+'%'};return _0x403cde;}})});}_0x4e3c33=_[_0x8215('0x50')]({},_0x4e3c33,_0x5c8e1c[_0x8215('0x52')]);var _0x5cc676={'where':_0x4e3c33['where']};return db[_0x8215('0x3e')]['count'](_0x5cc676)[_0x8215('0x24')](function(_0x1bd147){_0x4f4d89[_0x8215('0x31')]=_0x1bd147;if(_0x5c8e1c[_0x8215('0x43')]['includeAll']){_0x4e3c33[_0x8215('0x53')]=[{'all':!![]}];}return db['ChatGroup'][_0x8215('0x54')](_0x4e3c33);})[_0x8215('0x24')](function(_0x153e7b){_0x4f4d89[_0x8215('0x55')]=_0x153e7b;return _0x4f4d89;})[_0x8215('0x24')](respondWithFilteredResult(_0x2e030e,_0x4e3c33))[_0x8215('0x2e')](handleError(_0x2e030e,null));};exports['show']=function(_0x892e7d,_0x11e6b4){var _0x586d09={'raw':!![],'where':{'id':_0x892e7d['params']['id']}},_0x2d813c={};_0x2d813c[_0x8215('0x46')]=_['keys'](db[_0x8215('0x3e')]['rawAttributes']);_0x2d813c[_0x8215('0x43')]=_[_0x8215('0x44')](_0x892e7d['query']);_0x2d813c[_0x8215('0x45')]=_[_0x8215('0x48')](_0x2d813c[_0x8215('0x46')],_0x2d813c[_0x8215('0x43')]);_0x586d09['attributes']=_[_0x8215('0x48')](_0x2d813c['model'],qs[_0x8215('0x56')](_0x892e7d['query'][_0x8215('0x56')]));_0x586d09[_0x8215('0x47')]=_0x586d09[_0x8215('0x47')][_0x8215('0x49')]?_0x586d09[_0x8215('0x47')]:_0x2d813c[_0x8215('0x46')];if(_0x892e7d[_0x8215('0x43')]['includeAll']){_0x586d09[_0x8215('0x53')]=[{'all':!![]}];}_0x586d09=_[_0x8215('0x50')]({},_0x586d09,_0x892e7d['options']);return db['ChatGroup'][_0x8215('0x57')](_0x586d09)[_0x8215('0x24')](handleEntityNotFound(_0x11e6b4,null))[_0x8215('0x24')](respondWithResult(_0x11e6b4,null))[_0x8215('0x2e')](handleError(_0x11e6b4,null));};exports['create']=function(_0xa62ac9,_0x40e45b){return db['ChatGroup'][_0x8215('0x58')](_0xa62ac9['body'],{})['then'](respondWithResult(_0x40e45b,0xc9))[_0x8215('0x2e')](handleError(_0x40e45b,null));};exports[_0x8215('0x59')]=function(_0x4d5149,_0xd08e23){if(_0x4d5149['body']['id']){delete _0x4d5149['body']['id'];}return db[_0x8215('0x3e')]['find']({'where':{'id':_0x4d5149['params']['id']}})[_0x8215('0x24')](handleEntityNotFound(_0xd08e23,null))['then'](saveUpdates(_0x4d5149[_0x8215('0x5a')],null))['then'](respondWithResult(_0xd08e23,null))[_0x8215('0x2e')](handleError(_0xd08e23,null));};exports['destroy']=function(_0x3a8064,_0x178fda){return db[_0x8215('0x3e')][_0x8215('0x57')]({'where':{'id':_0x3a8064[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x178fda,null))[_0x8215('0x24')](removeEntity(_0x178fda,null))[_0x8215('0x2e')](handleError(_0x178fda,null));};exports['describe']=function(_0x5359da,_0x89f9ec){return db['ChatGroup'][_0x8215('0x5c')]()[_0x8215('0x24')](respondWithResult(_0x89f9ec,null))['catch'](handleError(_0x89f9ec,null));};exports[_0x8215('0x5d')]=function(_0x38060e,_0x5bc384,_0x352c69){return db[_0x8215('0x5e')][_0x8215('0x31')]({'where':{'ChatGroupId':_0x38060e['params']['id'],'ToId':_0x38060e[_0x8215('0x5f')]['id'],'read':![]}})[_0x8215('0x24')](function(_0x3f27f8){return{'id':_['toInteger'](_0x38060e[_0x8215('0x5b')]['id']),'count':_0x3f27f8};})['then'](respondWithResult(_0x5bc384,null))[_0x8215('0x2e')](handleError(_0x5bc384,null));};exports['addMembers']=function(_0x2e520d,_0x3d29f2,_0x8bd62b){return db[_0x8215('0x3e')]['find']({'where':{'id':_0x2e520d[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x3d29f2,null))['then'](function(_0x30eec5){if(_0x30eec5){return _0x30eec5['addMembers'](_0x2e520d[_0x8215('0x5a')]['ids'],_[_0x8215('0x60')](_0x2e520d[_0x8215('0x5a')],[_0x8215('0x61'),'id'])||{});}})[_0x8215('0x24')](respondWithResult(_0x3d29f2,null))[_0x8215('0x2e')](handleError(_0x3d29f2,null));};exports['getMembers']=function(_0x4ed718,_0x4a82a5,_0x4508f7){var _0x970795={};var _0x3291ec={};var _0x6027d4;var _0x35362e;return db[_0x8215('0x3e')][_0x8215('0x62')]({'where':{'id':_0x4ed718[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x4a82a5,null))['then'](function(_0x1fb183){if(_0x1fb183){_0x6027d4=_0x1fb183;_0x3291ec['model']=_[_0x8215('0x44')](db[_0x8215('0x63')][_0x8215('0x3f')]);_0x3291ec[_0x8215('0x43')]=_[_0x8215('0x44')](_0x4ed718[_0x8215('0x43')]);_0x3291ec['filters']=_[_0x8215('0x48')](_0x3291ec[_0x8215('0x46')],_0x3291ec['query']);_0x970795[_0x8215('0x47')]=_['intersection'](_0x3291ec[_0x8215('0x46')],qs[_0x8215('0x56')](_0x4ed718[_0x8215('0x43')]['fields']));_0x970795[_0x8215('0x47')]=_0x970795[_0x8215('0x47')][_0x8215('0x49')]?_0x970795[_0x8215('0x47')]:_0x3291ec[_0x8215('0x46')];_0x970795[_0x8215('0x4c')]=qs['sort'](_0x4ed718['query']['sort']);_0x970795[_0x8215('0x4e')]=qs[_0x8215('0x45')](_[_0x8215('0x64')](_0x4ed718[_0x8215('0x43')],_0x3291ec['filters']));if(_0x4ed718['query']['filter']){_0x970795[_0x8215('0x4e')]=_['merge'](_0x970795['where'],{'$or':_[_0x8215('0x3d')](_0x970795[_0x8215('0x47')],function(_0x3028f4){var _0x27db92={};_0x27db92[_0x3028f4]={'$like':'%'+_0x4ed718['query'][_0x8215('0x4f')]+'%'};return _0x27db92;})});}_0x970795=_[_0x8215('0x50')]({},_0x970795,_0x4ed718[_0x8215('0x52')]);return _0x6027d4[_0x8215('0x65')](_0x970795);}})[_0x8215('0x24')](function(_0x2621d3){if(_0x2621d3){_0x35362e=_0x2621d3[_0x8215('0x49')];if(!_0x4ed718[_0x8215('0x43')][_0x8215('0x66')](_0x8215('0x4a'))){_0x970795[_0x8215('0x4b')]=qs[_0x8215('0x4b')](_0x4ed718[_0x8215('0x43')]['limit']);_0x970795[_0x8215('0x32')]=qs['offset'](_0x4ed718['query'][_0x8215('0x32')]);}return _0x6027d4[_0x8215('0x65')](_0x970795);}})[_0x8215('0x24')](function(_0x5d78e0){if(_0x5d78e0){return _0x5d78e0?{'count':_0x35362e,'rows':_0x5d78e0}:null;}})[_0x8215('0x24')](respondWithResult(_0x4a82a5,null))[_0x8215('0x2e')](handleError(_0x4a82a5,null));};exports[_0x8215('0x67')]=function(_0x1bf8b9,_0x2fe344,_0xe75e26){return db[_0x8215('0x3e')][_0x8215('0x57')]({'where':{'id':_0x1bf8b9[_0x8215('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2fe344,null))[_0x8215('0x24')](function(_0x1ff152){if(_0x1ff152){return _0x1ff152[_0x8215('0x67')](_0x1bf8b9[_0x8215('0x43')]['ids']);}})[_0x8215('0x24')](respondWithStatusCode(_0x2fe344,null))[_0x8215('0x2e')](handleError(_0x2fe344,null));};exports[_0x8215('0x68')]=function(_0x8755fa,_0x379328,_0x55121a){if(_0x8755fa[_0x8215('0x5a')]['id']){delete _0x8755fa[_0x8215('0x5a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x8755fa[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x379328,null))[_0x8215('0x24')](function(_0x5340b7){if(_0x5340b7){_0x8755fa[_0x8215('0x5a')]['ChatGroupId']=_0x5340b7['id'];return db[_0x8215('0x5e')][_0x8215('0x58')](_0x8755fa['body']);}})[_0x8215('0x24')](respondWithResult(_0x379328,null))[_0x8215('0x2e')](handleError(_0x379328,null));};exports['getMessages']=function(_0x15e305,_0x4a05c4,_0x2bf2b4){var _0x12916c={};var _0x5392ee={};var _0x26296a;var _0x1406a6;return db['ChatGroup'][_0x8215('0x62')]({'where':{'id':_0x15e305[_0x8215('0x5b')]['id']}})[_0x8215('0x24')](handleEntityNotFound(_0x4a05c4,null))['then'](function(_0x54de52){if(_0x54de52){_0x26296a=_0x54de52;_0x5392ee[_0x8215('0x46')]=_[_0x8215('0x44')](db['ChatInternalMessage']['rawAttributes']);_0x5392ee['query']=_[_0x8215('0x44')](_0x15e305[_0x8215('0x43')]);_0x5392ee['filters']=_[_0x8215('0x48')](_0x5392ee[_0x8215('0x46')],_0x5392ee[_0x8215('0x43')]);_0x12916c['attributes']=_['intersection'](_0x5392ee['model'],qs[_0x8215('0x56')](_0x15e305[_0x8215('0x43')][_0x8215('0x56')]));_0x12916c[_0x8215('0x47')]=_0x12916c['attributes'][_0x8215('0x49')]?_0x12916c[_0x8215('0x47')]:_0x5392ee['model'];_0x12916c[_0x8215('0x4c')]=qs['sort'](_0x15e305[_0x8215('0x43')]['sort']);_0x12916c[_0x8215('0x4e')]=qs['filters'](_[_0x8215('0x64')](_0x15e305[_0x8215('0x43')],_0x5392ee[_0x8215('0x45')]));if(_0x15e305[_0x8215('0x43')][_0x8215('0x4f')]){_0x12916c[_0x8215('0x4e')]=_['merge'](_0x12916c[_0x8215('0x4e')],{'$or':_[_0x8215('0x3d')](_0x12916c[_0x8215('0x47')],function(_0x514503){var _0x21bd94={};_0x21bd94[_0x514503]={'$like':'%'+_0x15e305[_0x8215('0x43')][_0x8215('0x4f')]+'%'};return _0x21bd94;})});}if(_0x15e305['query'][_0x8215('0x69')]){var _0x5b058d=_0x15e305[_0x8215('0x43')]['$gte']['split'](',');var _0xd5bd9f={};_0xd5bd9f[_0x5b058d[0x0]]={'$gte':moment(_0x5b058d[0x1])[_0x8215('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12916c[_0x8215('0x4e')]=_[_0x8215('0x50')](_0x12916c['where'],_0xd5bd9f);}_0x12916c=_[_0x8215('0x50')]({},_0x12916c,_0x15e305[_0x8215('0x52')]);return _0x26296a['getMessages'](_0x12916c);}})['then'](function(_0x46cba6){if(_0x46cba6){_0x1406a6=_0x46cba6[_0x8215('0x49')];if(!_0x15e305['query']['hasOwnProperty'](_0x8215('0x4a'))){_0x12916c['limit']=qs[_0x8215('0x4b')](_0x15e305[_0x8215('0x43')][_0x8215('0x4b')]);_0x12916c[_0x8215('0x32')]=qs[_0x8215('0x32')](_0x15e305[_0x8215('0x43')][_0x8215('0x32')]);}return _0x26296a[_0x8215('0x6b')](_0x12916c);}})[_0x8215('0x24')](function(_0x251f1f){if(_0x251f1f){return _0x251f1f?{'count':_0x1406a6,'rows':_0x251f1f}:null;}})['then'](respondWithResult(_0x4a05c4,null))['catch'](handleError(_0x4a05c4,null));}; \ No newline at end of file +var _0x8017=['offset','limit','apply','reject','save','update','destroy','stack','name','send','index','ChatGroup','rawAttributes','fieldName','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','where','type','filter','merge','includeAll','include','show','keys','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','getMembers','findOne','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count'];(function(_0x11cc81,_0x8b262d){var _0xf4b8eb=function(_0x22a9be){while(--_0x22a9be){_0x11cc81['push'](_0x11cc81['shift']());}};_0xf4b8eb(++_0x8b262d);}(_0x8017,0xa2));var _0x7801=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x8017[_0x1c8c28];return _0x1f59b4;};'use strict';var pdf=require(_0x7801('0x0'));var emlformat=require(_0x7801('0x1'));var rimraf=require(_0x7801('0x2'));var zipdir=require(_0x7801('0x3'));var jsonpatch=require(_0x7801('0x4'));var rp=require('request-promise');var moment=require(_0x7801('0x5'));var BPromise=require(_0x7801('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7801('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7801('0x8'));var jsforce=require(_0x7801('0x9'));var deskjs=require(_0x7801('0xa'));var toCsv=require(_0x7801('0x7'));var querystring=require(_0x7801('0xb'));var Papa=require(_0x7801('0xc'));var Redis=require('ioredis');var authService=require(_0x7801('0xd'));var qs=require(_0x7801('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7801('0xf'));var logger=require(_0x7801('0x10'))(_0x7801('0x11'));var utils=require(_0x7801('0x12'));var config=require(_0x7801('0x13'));var db=require(_0x7801('0x14'))['db'];config[_0x7801('0x15')]=_[_0x7801('0x16')](config['redis'],{'host':_0x7801('0x17'),'port':0x18eb});var socket=require(_0x7801('0x18'))(new Redis(config[_0x7801('0x15')]));require(_0x7801('0x19'))[_0x7801('0x1a')](socket);var jayson=require(_0x7801('0x1b'));var client=jayson[_0x7801('0x1c')][_0x7801('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5622d2,_0x4f83c0,_0x372ee5){if(_0x372ee5){var _0x54ce43=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54ce43[_0x7801('0x1e')](_0x4f83c0)){return _0x5622d2;}else{throw new db[(_0x7801('0x1f'))][(_0x7801('0x20'))](_0x7801('0x21'));}}else{return _0x5622d2;}}function respondWithRpcPromise(_0x4478b6,_0x4e0097,_0x1f0948,_0x12cb40){return new BPromise(function(_0x12e65d,_0xb41c38){var _0x584437=_0x12cb40||client;return _0x584437['request'](_0x4478b6,_0x1f0948)[_0x7801('0x22')](function(_0x276ea5){logger[_0x7801('0x23')](_0x7801('0x24'),_0x4e0097,_0x7801('0x25'));logger['debug'](_0x7801('0x26'),_0x4e0097,_0x7801('0x25'),JSON[_0x7801('0x27')](_0x276ea5));if(_0x276ea5[_0x7801('0x28')]){if(_0x276ea5[_0x7801('0x28')][_0x7801('0x29')]===0x1f4){logger[_0x7801('0x28')](_0x7801('0x24'),_0x4e0097,_0x276ea5['error'][_0x7801('0x2a')]);return _0xb41c38(_0x276ea5[_0x7801('0x28')][_0x7801('0x2a')]);}logger[_0x7801('0x28')](_0x7801('0x24'),_0x4e0097,_0x276ea5[_0x7801('0x28')][_0x7801('0x2a')]);return _0x12e65d(_0x276ea5[_0x7801('0x28')]['message']);}else{logger[_0x7801('0x23')](_0x7801('0x24'),_0x4e0097,_0x7801('0x25'));_0x12e65d(_0x276ea5['result'][_0x7801('0x2a')]);}})[_0x7801('0x2b')](function(_0x2580af){logger['error'](_0x7801('0x24'),_0x4e0097,_0x2580af);_0xb41c38(_0x2580af);});});}function respondWithStatusCode(_0x2228c6,_0xcfdab7){_0xcfdab7=_0xcfdab7||0xcc;return function(_0x5c4d0c){if(_0x5c4d0c){return _0x2228c6[_0x7801('0x2c')](_0xcfdab7);}return _0x2228c6[_0x7801('0x2d')](_0xcfdab7)[_0x7801('0x2e')]();};}function respondWithResult(_0x28151f,_0x5587ab){_0x5587ab=_0x5587ab||0xc8;return function(_0xe23ca3){if(_0xe23ca3){return _0x28151f[_0x7801('0x2d')](_0x5587ab)['json'](_0xe23ca3);}};}function respondWithFilteredResult(_0xd4bf29,_0x35090b){return function(_0x32bcba){if(_0x32bcba){var _0x590b3d=_0x32bcba[_0x7801('0x2f')],_0x42f12c=_0x35090b[_0x7801('0x30')],_0x2b4019=_0x35090b[_0x7801('0x30')]+_0x35090b[_0x7801('0x31')],_0x3758de;if(_0x2b4019>=_0x590b3d){_0x2b4019=_0x590b3d;_0x3758de=0xc8;}else{_0x3758de=0xce;}_0xd4bf29[_0x7801('0x2d')](_0x3758de);return _0xd4bf29['set']('Content-Range',_0x42f12c+'-'+_0x2b4019+'/'+_0x590b3d)['json'](_0x32bcba);}return null;};}function patchUpdates(_0x52bc58){return function(_0x59a225){try{jsonpatch[_0x7801('0x32')](_0x59a225,_0x52bc58,!![]);}catch(_0x3e0a3f){return BPromise[_0x7801('0x33')](_0x3e0a3f);}return _0x59a225[_0x7801('0x34')]();};}function saveUpdates(_0x4e613c,_0x175345){return function(_0xcf0099){if(_0xcf0099){return _0xcf0099[_0x7801('0x35')](_0x4e613c)[_0x7801('0x22')](function(_0x46c969){return _0x46c969;});}return null;};}function removeEntity(_0x5872fe,_0x882bdd){return function(_0x38c51e){if(_0x38c51e){return _0x38c51e[_0x7801('0x36')]()['then'](function(){_0x5872fe[_0x7801('0x2d')](0xcc)[_0x7801('0x2e')]();});}};}function handleEntityNotFound(_0x5463df,_0x170bf1){return function(_0x47e761){if(!_0x47e761){_0x5463df[_0x7801('0x2c')](0x194);}return _0x47e761;};}function handleError(_0x16e324,_0x3a1113){_0x3a1113=_0x3a1113||0x1f4;return function(_0xd1e23f){logger['error'](_0xd1e23f[_0x7801('0x37')]);if(_0xd1e23f[_0x7801('0x38')]){delete _0xd1e23f[_0x7801('0x38')];}_0x16e324[_0x7801('0x2d')](_0x3a1113)[_0x7801('0x39')](_0xd1e23f);};}exports[_0x7801('0x3a')]=function(_0x4366f5,_0x4038c9){var _0x5c27f0={},_0x3a6e33={},_0x2687a9={'count':0x0,'rows':[]};var _0x40795a=_['map'](db[_0x7801('0x3b')][_0x7801('0x3c')],function(_0x348aad){return{'name':_0x348aad[_0x7801('0x3d')],'type':_0x348aad['type']['key']};});_0x3a6e33['model']=_['map'](_0x40795a,_0x7801('0x38'));_0x3a6e33[_0x7801('0x3e')]=_['keys'](_0x4366f5[_0x7801('0x3e')]);_0x3a6e33[_0x7801('0x3f')]=_['intersection'](_0x3a6e33[_0x7801('0x40')],_0x3a6e33[_0x7801('0x3e')]);_0x5c27f0['attributes']=_[_0x7801('0x41')](_0x3a6e33['model'],qs[_0x7801('0x42')](_0x4366f5[_0x7801('0x3e')][_0x7801('0x42')]));_0x5c27f0[_0x7801('0x43')]=_0x5c27f0[_0x7801('0x43')][_0x7801('0x44')]?_0x5c27f0[_0x7801('0x43')]:_0x3a6e33[_0x7801('0x40')];if(!_0x4366f5[_0x7801('0x3e')]['hasOwnProperty'](_0x7801('0x45'))){_0x5c27f0['limit']=qs['limit'](_0x4366f5[_0x7801('0x3e')][_0x7801('0x31')]);_0x5c27f0[_0x7801('0x30')]=qs[_0x7801('0x30')](_0x4366f5['query'][_0x7801('0x30')]);}_0x5c27f0['order']=qs['sort'](_0x4366f5['query'][_0x7801('0x46')]);_0x5c27f0['where']=qs[_0x7801('0x3f')](_[_0x7801('0x47')](_0x4366f5[_0x7801('0x3e')],_0x3a6e33[_0x7801('0x3f')]),_0x40795a);if(_0x4366f5['query']['filter']){_0x5c27f0[_0x7801('0x48')]=_['merge'](_0x5c27f0[_0x7801('0x48')],{'$or':_['map'](_0x40795a,function(_0x4c069c){if(_0x4c069c[_0x7801('0x49')]!=='VIRTUAL'){var _0x2fc5fe={};_0x2fc5fe[_0x4c069c[_0x7801('0x38')]]={'$like':'%'+_0x4366f5[_0x7801('0x3e')][_0x7801('0x4a')]+'%'};return _0x2fc5fe;}})});}_0x5c27f0=_[_0x7801('0x4b')]({},_0x5c27f0,_0x4366f5['options']);var _0x58c3a0={'where':_0x5c27f0[_0x7801('0x48')]};return db[_0x7801('0x3b')][_0x7801('0x2f')](_0x58c3a0)[_0x7801('0x22')](function(_0x2d7d0d){_0x2687a9[_0x7801('0x2f')]=_0x2d7d0d;if(_0x4366f5[_0x7801('0x3e')][_0x7801('0x4c')]){_0x5c27f0[_0x7801('0x4d')]=[{'all':!![]}];}return db[_0x7801('0x3b')]['findAll'](_0x5c27f0);})[_0x7801('0x22')](function(_0x42c39b){_0x2687a9['rows']=_0x42c39b;return _0x2687a9;})['then'](respondWithFilteredResult(_0x4038c9,_0x5c27f0))['catch'](handleError(_0x4038c9,null));};exports[_0x7801('0x4e')]=function(_0x1677aa,_0x1b5514){var _0x3d8f41={'raw':!![],'where':{'id':_0x1677aa['params']['id']}},_0x1e840b={};_0x1e840b[_0x7801('0x40')]=_['keys'](db['ChatGroup'][_0x7801('0x3c')]);_0x1e840b[_0x7801('0x3e')]=_[_0x7801('0x4f')](_0x1677aa[_0x7801('0x3e')]);_0x1e840b[_0x7801('0x3f')]=_[_0x7801('0x41')](_0x1e840b['model'],_0x1e840b['query']);_0x3d8f41[_0x7801('0x43')]=_[_0x7801('0x41')](_0x1e840b[_0x7801('0x40')],qs['fields'](_0x1677aa[_0x7801('0x3e')]['fields']));_0x3d8f41[_0x7801('0x43')]=_0x3d8f41['attributes'][_0x7801('0x44')]?_0x3d8f41[_0x7801('0x43')]:_0x1e840b[_0x7801('0x40')];if(_0x1677aa[_0x7801('0x3e')][_0x7801('0x4c')]){_0x3d8f41[_0x7801('0x4d')]=[{'all':!![]}];}_0x3d8f41=_['merge']({},_0x3d8f41,_0x1677aa[_0x7801('0x50')]);return db[_0x7801('0x3b')][_0x7801('0x51')](_0x3d8f41)[_0x7801('0x22')](handleEntityNotFound(_0x1b5514,null))['then'](respondWithResult(_0x1b5514,null))[_0x7801('0x2b')](handleError(_0x1b5514,null));};exports[_0x7801('0x52')]=function(_0x43d5f9,_0x5c4920){return db[_0x7801('0x3b')]['create'](_0x43d5f9[_0x7801('0x53')],{})[_0x7801('0x22')](respondWithResult(_0x5c4920,0xc9))[_0x7801('0x2b')](handleError(_0x5c4920,null));};exports[_0x7801('0x35')]=function(_0x201cda,_0x1416de){if(_0x201cda[_0x7801('0x53')]['id']){delete _0x201cda['body']['id'];}return db[_0x7801('0x3b')][_0x7801('0x51')]({'where':{'id':_0x201cda[_0x7801('0x54')]['id']}})[_0x7801('0x22')](handleEntityNotFound(_0x1416de,null))[_0x7801('0x22')](saveUpdates(_0x201cda[_0x7801('0x53')],null))[_0x7801('0x22')](respondWithResult(_0x1416de,null))[_0x7801('0x2b')](handleError(_0x1416de,null));};exports[_0x7801('0x36')]=function(_0x113440,_0x2b4600){return db[_0x7801('0x3b')][_0x7801('0x51')]({'where':{'id':_0x113440[_0x7801('0x54')]['id']}})['then'](handleEntityNotFound(_0x2b4600,null))[_0x7801('0x22')](removeEntity(_0x2b4600,null))[_0x7801('0x2b')](handleError(_0x2b4600,null));};exports[_0x7801('0x55')]=function(_0x12ee5b,_0x12554c){return db[_0x7801('0x3b')][_0x7801('0x55')]()[_0x7801('0x22')](respondWithResult(_0x12554c,null))[_0x7801('0x2b')](handleError(_0x12554c,null));};exports[_0x7801('0x56')]=function(_0xd3bb99,_0xa7fd30,_0x1cbabc){return db[_0x7801('0x57')][_0x7801('0x2f')]({'where':{'ChatGroupId':_0xd3bb99[_0x7801('0x54')]['id'],'ToId':_0xd3bb99[_0x7801('0x58')]['id'],'read':![]}})['then'](function(_0x2af176){return{'id':_[_0x7801('0x59')](_0xd3bb99[_0x7801('0x54')]['id']),'count':_0x2af176};})['then'](respondWithResult(_0xa7fd30,null))[_0x7801('0x2b')](handleError(_0xa7fd30,null));};exports[_0x7801('0x5a')]=function(_0x413898,_0x59d5f7,_0x2ff210){return db[_0x7801('0x3b')]['find']({'where':{'id':_0x413898[_0x7801('0x54')]['id']}})[_0x7801('0x22')](handleEntityNotFound(_0x59d5f7,null))[_0x7801('0x22')](function(_0x3b5205){if(_0x3b5205){return _0x3b5205[_0x7801('0x5a')](_0x413898[_0x7801('0x53')]['ids'],_[_0x7801('0x5b')](_0x413898[_0x7801('0x53')],[_0x7801('0x5c'),'id'])||{});}})[_0x7801('0x22')](respondWithResult(_0x59d5f7,null))[_0x7801('0x2b')](handleError(_0x59d5f7,null));};exports[_0x7801('0x5d')]=function(_0x13b440,_0xb3ec9c,_0xe3f880){var _0x287e1d={};var _0x4b6d28={};var _0x5f60dd;var _0x506d99;return db[_0x7801('0x3b')][_0x7801('0x5e')]({'where':{'id':_0x13b440[_0x7801('0x54')]['id']}})['then'](handleEntityNotFound(_0xb3ec9c,null))[_0x7801('0x22')](function(_0x3e3d55){if(_0x3e3d55){_0x5f60dd=_0x3e3d55;_0x4b6d28[_0x7801('0x40')]=_[_0x7801('0x4f')](db['User'][_0x7801('0x3c')]);_0x4b6d28[_0x7801('0x3e')]=_[_0x7801('0x4f')](_0x13b440[_0x7801('0x3e')]);_0x4b6d28[_0x7801('0x3f')]=_[_0x7801('0x41')](_0x4b6d28['model'],_0x4b6d28[_0x7801('0x3e')]);_0x287e1d[_0x7801('0x43')]=_[_0x7801('0x41')](_0x4b6d28[_0x7801('0x40')],qs[_0x7801('0x42')](_0x13b440['query']['fields']));_0x287e1d[_0x7801('0x43')]=_0x287e1d[_0x7801('0x43')][_0x7801('0x44')]?_0x287e1d['attributes']:_0x4b6d28['model'];_0x287e1d['order']=qs[_0x7801('0x46')](_0x13b440['query'][_0x7801('0x46')]);_0x287e1d['where']=qs[_0x7801('0x3f')](_[_0x7801('0x47')](_0x13b440[_0x7801('0x3e')],_0x4b6d28['filters']));if(_0x13b440['query'][_0x7801('0x4a')]){_0x287e1d['where']=_[_0x7801('0x4b')](_0x287e1d[_0x7801('0x48')],{'$or':_['map'](_0x287e1d[_0x7801('0x43')],function(_0x59b724){var _0x1c9267={};_0x1c9267[_0x59b724]={'$like':'%'+_0x13b440[_0x7801('0x3e')][_0x7801('0x4a')]+'%'};return _0x1c9267;})});}_0x287e1d=_[_0x7801('0x4b')]({},_0x287e1d,_0x13b440[_0x7801('0x50')]);return _0x5f60dd[_0x7801('0x5d')](_0x287e1d);}})['then'](function(_0xe91d61){if(_0xe91d61){_0x506d99=_0xe91d61[_0x7801('0x44')];if(!_0x13b440[_0x7801('0x3e')][_0x7801('0x5f')](_0x7801('0x45'))){_0x287e1d[_0x7801('0x31')]=qs['limit'](_0x13b440[_0x7801('0x3e')][_0x7801('0x31')]);_0x287e1d[_0x7801('0x30')]=qs[_0x7801('0x30')](_0x13b440[_0x7801('0x3e')][_0x7801('0x30')]);}return _0x5f60dd[_0x7801('0x5d')](_0x287e1d);}})['then'](function(_0x387dee){if(_0x387dee){return _0x387dee?{'count':_0x506d99,'rows':_0x387dee}:null;}})['then'](respondWithResult(_0xb3ec9c,null))['catch'](handleError(_0xb3ec9c,null));};exports[_0x7801('0x60')]=function(_0x1d0201,_0x86e7e3,_0x17651e){return db[_0x7801('0x3b')][_0x7801('0x51')]({'where':{'id':_0x1d0201[_0x7801('0x54')]['id']}})['then'](handleEntityNotFound(_0x86e7e3,null))[_0x7801('0x22')](function(_0x24b11f){if(_0x24b11f){return _0x24b11f[_0x7801('0x60')](_0x1d0201[_0x7801('0x3e')][_0x7801('0x5c')]);}})['then'](respondWithStatusCode(_0x86e7e3,null))[_0x7801('0x2b')](handleError(_0x86e7e3,null));};exports[_0x7801('0x61')]=function(_0x2333d4,_0x1df4d7,_0x4a6052){if(_0x2333d4[_0x7801('0x53')]['id']){delete _0x2333d4[_0x7801('0x53')]['id'];}return db[_0x7801('0x3b')][_0x7801('0x51')]({'where':{'id':_0x2333d4[_0x7801('0x54')]['id']}})[_0x7801('0x22')](handleEntityNotFound(_0x1df4d7,null))[_0x7801('0x22')](function(_0x5571c4){if(_0x5571c4){_0x2333d4[_0x7801('0x53')][_0x7801('0x62')]=_0x5571c4['id'];return db['ChatInternalMessage'][_0x7801('0x52')](_0x2333d4[_0x7801('0x53')]);}})[_0x7801('0x22')](respondWithResult(_0x1df4d7,null))[_0x7801('0x2b')](handleError(_0x1df4d7,null));};exports[_0x7801('0x63')]=function(_0x4c6575,_0x4d8643,_0xeaaec7){var _0x2fd007={};var _0x3683a5={};var _0x3c923e;var _0x22b9e7;return db[_0x7801('0x3b')][_0x7801('0x5e')]({'where':{'id':_0x4c6575[_0x7801('0x54')]['id']}})['then'](handleEntityNotFound(_0x4d8643,null))[_0x7801('0x22')](function(_0xa25a75){if(_0xa25a75){_0x3c923e=_0xa25a75;_0x3683a5[_0x7801('0x40')]=_[_0x7801('0x4f')](db[_0x7801('0x57')][_0x7801('0x3c')]);_0x3683a5[_0x7801('0x3e')]=_['keys'](_0x4c6575[_0x7801('0x3e')]);_0x3683a5['filters']=_[_0x7801('0x41')](_0x3683a5[_0x7801('0x40')],_0x3683a5[_0x7801('0x3e')]);_0x2fd007[_0x7801('0x43')]=_[_0x7801('0x41')](_0x3683a5[_0x7801('0x40')],qs['fields'](_0x4c6575[_0x7801('0x3e')][_0x7801('0x42')]));_0x2fd007[_0x7801('0x43')]=_0x2fd007[_0x7801('0x43')][_0x7801('0x44')]?_0x2fd007[_0x7801('0x43')]:_0x3683a5[_0x7801('0x40')];_0x2fd007[_0x7801('0x64')]=qs[_0x7801('0x46')](_0x4c6575[_0x7801('0x3e')][_0x7801('0x46')]);_0x2fd007[_0x7801('0x48')]=qs[_0x7801('0x3f')](_[_0x7801('0x47')](_0x4c6575[_0x7801('0x3e')],_0x3683a5[_0x7801('0x3f')]));if(_0x4c6575[_0x7801('0x3e')][_0x7801('0x4a')]){_0x2fd007[_0x7801('0x48')]=_[_0x7801('0x4b')](_0x2fd007[_0x7801('0x48')],{'$or':_['map'](_0x2fd007[_0x7801('0x43')],function(_0x965b93){var _0x2ec163={};_0x2ec163[_0x965b93]={'$like':'%'+_0x4c6575[_0x7801('0x3e')][_0x7801('0x4a')]+'%'};return _0x2ec163;})});}if(_0x4c6575[_0x7801('0x3e')][_0x7801('0x65')]){var _0x42334f=_0x4c6575['query']['$gte'][_0x7801('0x66')](',');var _0x540d9f={};_0x540d9f[_0x42334f[0x0]]={'$gte':moment(_0x42334f[0x1])[_0x7801('0x67')](_0x7801('0x68'))};_0x2fd007[_0x7801('0x48')]=_[_0x7801('0x4b')](_0x2fd007[_0x7801('0x48')],_0x540d9f);}_0x2fd007=_[_0x7801('0x4b')]({},_0x2fd007,_0x4c6575['options']);return _0x3c923e['getMessages'](_0x2fd007);}})['then'](function(_0xc8aa29){if(_0xc8aa29){_0x22b9e7=_0xc8aa29[_0x7801('0x44')];if(!_0x4c6575[_0x7801('0x3e')]['hasOwnProperty']('nolimit')){_0x2fd007[_0x7801('0x31')]=qs[_0x7801('0x31')](_0x4c6575[_0x7801('0x3e')][_0x7801('0x31')]);_0x2fd007[_0x7801('0x30')]=qs[_0x7801('0x30')](_0x4c6575[_0x7801('0x3e')][_0x7801('0x30')]);}return _0x3c923e['getMessages'](_0x2fd007);}})['then'](function(_0x522d78){if(_0x522d78){return _0x522d78?{'count':_0x22b9e7,'rows':_0x522d78}:null;}})[_0x7801('0x22')](respondWithResult(_0x4d8643,null))[_0x7801('0x2b')](handleError(_0x4d8643,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index eb7fe7d..18609a6 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x4866bc,_0x445681){var _0x49a352=function(_0x1b43a1){while(--_0x1b43a1){_0x4866bc['push'](_0x4866bc['shift']());}};_0x49a352(++_0x445681);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e5f8a,_0x6f3cf6){_0x2e5f8a=_0x2e5f8a-0x0;var _0xdbe311=_0x5f2f[_0x2e5f8a];return _0xdbe311;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0xadb5,0xad));var _0x5adb=function(_0x120b9c,_0x1dd08a){_0x120b9c=_0x120b9c-0x0;var _0x584bc7=_0xadb5[_0x120b9c];return _0x584bc7;};'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 60d59db..120f02e 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 _0x06ae=['path','rimraf','../../config/environment','define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xcbf03b,_0x2ddbfd){var _0x2384a6=function(_0x58a614){while(--_0x58a614){_0xcbf03b['push'](_0xcbf03b['shift']());}};_0x2384a6(++_0x2ddbfd);}(_0x06ae,0x16e));var _0xe06a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x06ae[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var logger=require(_0xe06a('0x1'))(_0xe06a('0x2'));var moment=require(_0xe06a('0x3'));var BPromise=require(_0xe06a('0x4'));var rp=require(_0xe06a('0x5'));var fs=require('fs');var path=require(_0xe06a('0x6'));var rimraf=require(_0xe06a('0x7'));var config=require(_0xe06a('0x8'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x50e6cf,_0x1df79f){return _0x50e6cf[_0xe06a('0x9')](_0xe06a('0xa'),attributes,{'tableName':_0xe06a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb934=['exports','define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0xb934,0x92));var _0x4b93=function(_0x4f7964,_0x554439){_0x4f7964=_0x4f7964-0x0;var _0x2b2d33=_0xb934[_0x4f7964];return _0x2b2d33;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require(_0x4b93('0x3'));var BPromise=require(_0x4b93('0x4'));var rp=require(_0x4b93('0x5'));var fs=require('fs');var path=require(_0x4b93('0x6'));var rimraf=require(_0x4b93('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x4b93('0x8')]=function(_0x1fa8af,_0x2ea5ad){return _0x1fa8af[_0x4b93('0x9')]('ChatGroup',attributes,{'tableName':_0x4b93('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 d329505..91d0ece 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 _0x9731=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util'];(function(_0x3f01d0,_0x11b322){var _0x1ca2d7=function(_0x24e88b){while(--_0x24e88b){_0x3f01d0['push'](_0x3f01d0['shift']());}};_0x1ca2d7(++_0x11b322);}(_0x9731,0x8f));var _0x1973=function(_0x1723bf,_0x7b607b){_0x1723bf=_0x1723bf-0x0;var _0x4946b4=_0x9731[_0x1723bf];return _0x4946b4;};'use strict';var _=require(_0x1973('0x0'));var util=require(_0x1973('0x1'));var moment=require(_0x1973('0x2'));var BPromise=require(_0x1973('0x3'));var rs=require(_0x1973('0x4'));var fs=require('fs');var Redis=require(_0x1973('0x5'));var db=require(_0x1973('0x6'))['db'];var utils=require(_0x1973('0x7'));var logger=require(_0x1973('0x8'))(_0x1973('0x9'));var config=require(_0x1973('0xa'));var jayson=require(_0x1973('0xb'));var client=jayson[_0x1973('0xc')][_0x1973('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1973('0xe')],{'host':_0x1973('0xf'),'port':0x18eb});var socket=require(_0x1973('0x10'))(new Redis(config[_0x1973('0xe')]));require('./chatGroup.socket')[_0x1973('0x11')](socket);function respondWithRpcPromise(_0xe1db05,_0x53bb3f,_0x3d4359){return new BPromise(function(_0x2cc1ed,_0x3dfbca){return client[_0x1973('0x12')](_0xe1db05,_0x3d4359)['then'](function(_0x4e9f7f){logger['info'](_0x1973('0x13'),_0x53bb3f,_0x1973('0x14'));logger[_0x1973('0x15')](_0x1973('0x16'),_0x53bb3f,'request\x20sent',JSON[_0x1973('0x17')](_0x4e9f7f));if(_0x4e9f7f[_0x1973('0x18')]){if(_0x4e9f7f[_0x1973('0x18')]['code']===0x1f4){logger[_0x1973('0x18')]('ChatGroup,\x20%s,\x20%s',_0x53bb3f,_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);return _0x3dfbca(_0x4e9f7f[_0x1973('0x18')]['message']);}logger[_0x1973('0x18')](_0x1973('0x13'),_0x53bb3f,_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);return _0x2cc1ed(_0x4e9f7f[_0x1973('0x18')][_0x1973('0x19')]);}else{logger[_0x1973('0x1a')](_0x1973('0x13'),_0x53bb3f,_0x1973('0x14'));_0x2cc1ed(_0x4e9f7f[_0x1973('0x1b')][_0x1973('0x19')]);}})[_0x1973('0x1c')](function(_0x59e0dd){logger[_0x1973('0x18')]('ChatGroup,\x20%s,\x20%s',_0x53bb3f,_0x59e0dd);_0x3dfbca(_0x59e0dd);});});} \ No newline at end of file +var _0xf88f=['client','http','redis','localhost','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf88f,0x185));var _0xff88=function(_0x5ea507,_0x131281){_0x5ea507=_0x5ea507-0x0;var _0x2ecbec=_0xf88f[_0x5ea507];return _0x2ecbec;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var moment=require(_0xff88('0x2'));var BPromise=require(_0xff88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff88('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xff88('0x5'));var config=require('../../config/environment');var jayson=require(_0xff88('0x6'));var client=jayson[_0xff88('0x7')][_0xff88('0x8')]({'port':0x232a});config[_0xff88('0x9')]=_['defaults'](config[_0xff88('0x9')],{'host':_0xff88('0xa'),'port':0x18eb});var socket=require(_0xff88('0xb'))(new Redis(config[_0xff88('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x48c27d,_0x26efb6,_0x1a981e){return new BPromise(function(_0x4d5ddc,_0x1a0ab5){return client[_0xff88('0xc')](_0x48c27d,_0x1a981e)[_0xff88('0xd')](function(_0x4f4c72){logger['info'](_0xff88('0xe'),_0x26efb6,_0xff88('0xf'));logger[_0xff88('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x26efb6,_0xff88('0xf'),JSON['stringify'](_0x4f4c72));if(_0x4f4c72[_0xff88('0x11')]){if(_0x4f4c72[_0xff88('0x11')][_0xff88('0x12')]===0x1f4){logger[_0xff88('0x11')](_0xff88('0xe'),_0x26efb6,_0x4f4c72[_0xff88('0x11')]['message']);return _0x1a0ab5(_0x4f4c72[_0xff88('0x11')]['message']);}logger[_0xff88('0x11')](_0xff88('0xe'),_0x26efb6,_0x4f4c72[_0xff88('0x11')][_0xff88('0x13')]);return _0x4d5ddc(_0x4f4c72[_0xff88('0x11')]['message']);}else{logger[_0xff88('0x14')]('ChatGroup,\x20%s,\x20%s',_0x26efb6,_0xff88('0xf'));_0x4d5ddc(_0x4f4c72[_0xff88('0x15')]['message']);}})['catch'](function(_0x1b55b1){logger['error'](_0xff88('0xe'),_0x26efb6,_0x1b55b1);_0x1a0ab5(_0x1b55b1);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index da65d49..55b8dac 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 _0x5c0e=['emit','length','./chatGroup.events','save','remove','update'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0x5c0e,0x140));var _0xe5c0=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x5c0e[_0x467488];return _0x56107f;};'use strict';var ChatGroupEvents=require(_0xe5c0('0x0'));var events=[_0xe5c0('0x1'),_0xe5c0('0x2'),_0xe5c0('0x3')];function createListener(_0x45045a,_0x5ea398){return function(_0x574238){_0x5ea398[_0xe5c0('0x4')](_0x45045a,_0x574238);};}function removeListener(_0x46e1a7,_0x7fb7be){return function(){ChatGroupEvents['removeListener'](_0x46e1a7,_0x7fb7be);};}exports['register']=function(_0x61608a){for(var _0xb0b476=0x0,_0x37f7a7=events[_0xe5c0('0x5')];_0xb0b476<_0x37f7a7;_0xb0b476++){var _0x1d00dc=events[_0xb0b476];var _0x5b4908=createListener('chatGroup:'+_0x1d00dc,_0x61608a);ChatGroupEvents['on'](_0x1d00dc,_0x5b4908);}}; \ No newline at end of file +var _0xe4b7=['update','removeListener','length','chatGroup:','save'];(function(_0x4f1e52,_0x344262){var _0x6a9ac4=function(_0x37719b){while(--_0x37719b){_0x4f1e52['push'](_0x4f1e52['shift']());}};_0x6a9ac4(++_0x344262);}(_0xe4b7,0x1a3));var _0x7e4b=function(_0x3d1f8e,_0x279486){_0x3d1f8e=_0x3d1f8e-0x0;var _0x3ebcb3=_0xe4b7[_0x3d1f8e];return _0x3ebcb3;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x7e4b('0x0'),'remove',_0x7e4b('0x1')];function createListener(_0x4ee290,_0x31b1bd){return function(_0x28f32d){_0x31b1bd['emit'](_0x4ee290,_0x28f32d);};}function removeListener(_0x479708,_0x533bb9){return function(){ChatGroupEvents[_0x7e4b('0x2')](_0x479708,_0x533bb9);};}exports['register']=function(_0x228fc6){for(var _0x44f1f7=0x0,_0x199e0c=events[_0x7e4b('0x3')];_0x44f1f7<_0x199e0c;_0x44f1f7++){var _0x568836=events[_0x44f1f7];var _0x3c15a1=createListener(_0x7e4b('0x4')+_0x568836,_0x228fc6);ChatGroupEvents['on'](_0x568836,_0x3c15a1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ca3d4b9..5628951 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 _0x1e3d=['/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread'];(function(_0x47ea80,_0x48bba8){var _0x4a2d71=function(_0x55a8b0){while(--_0x55a8b0){_0x47ea80['push'](_0x47ea80['shift']());}};_0x4a2d71(++_0x48bba8);}(_0x1e3d,0x1cb));var _0xd1e3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1e3d[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xd1e3('0x0'));var util=require(_0xd1e3('0x1'));var path=require(_0xd1e3('0x2'));var timeout=require(_0xd1e3('0x3'));var express=require(_0xd1e3('0x4'));var router=express[_0xd1e3('0x5')]();var auth=require(_0xd1e3('0x6'));var interaction=require(_0xd1e3('0x7'));var config=require(_0xd1e3('0x8'));var controller=require(_0xd1e3('0x9'));router[_0xd1e3('0xa')]('/',auth[_0xd1e3('0xb')](),controller['index']);router[_0xd1e3('0xa')](_0xd1e3('0xc'),auth[_0xd1e3('0xb')](),controller['describe']);router[_0xd1e3('0xa')](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0xe')]);router['get'](_0xd1e3('0xf'),auth['isAuthenticated'](),controller[_0xd1e3('0x10')]);router[_0xd1e3('0xa')](_0xd1e3('0x11'),auth['isAuthenticated'](),controller[_0xd1e3('0x12')]);router[_0xd1e3('0xa')](_0xd1e3('0x13'),auth['isAuthenticated'](),controller[_0xd1e3('0x14')]);router['post']('/',auth[_0xd1e3('0xb')](),controller['create']);router[_0xd1e3('0x15')](_0xd1e3('0x11'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x16')]);router[_0xd1e3('0x15')](_0xd1e3('0x13'),auth['isAuthenticated'](),controller[_0xd1e3('0x17')]);router['put'](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x18')]);router[_0xd1e3('0x19')](_0xd1e3('0xd'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x1a')]);router[_0xd1e3('0x19')](_0xd1e3('0x11'),auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa6f1=['multer','util','connect-timeout','Router','../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports'];(function(_0x4e15fe,_0xb9d141){var _0x94fe5d=function(_0x26991a){while(--_0x26991a){_0x4e15fe['push'](_0x4e15fe['shift']());}};_0x94fe5d(++_0xb9d141);}(_0xa6f1,0xf3));var _0x1a6f=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0xa6f1[_0x407bd8];return _0x20b6c9;};'use strict';var multer=require(_0x1a6f('0x0'));var util=require(_0x1a6f('0x1'));var path=require('path');var timeout=require(_0x1a6f('0x2'));var express=require('express');var router=express[_0x1a6f('0x3')]();var auth=require(_0x1a6f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a6f('0x5'));router[_0x1a6f('0x6')]('/',auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x8')]);router[_0x1a6f('0x6')](_0x1a6f('0x9'),auth[_0x1a6f('0x7')](),controller['describe']);router[_0x1a6f('0x6')](_0x1a6f('0xa'),auth['isAuthenticated'](),controller[_0x1a6f('0xb')]);router[_0x1a6f('0x6')]('/:id/unread',auth[_0x1a6f('0x7')](),controller[_0x1a6f('0xc')]);router['get']('/:id/members',auth[_0x1a6f('0x7')](),controller[_0x1a6f('0xd')]);router[_0x1a6f('0x6')](_0x1a6f('0xe'),auth[_0x1a6f('0x7')](),controller[_0x1a6f('0xf')]);router[_0x1a6f('0x10')]('/',auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x11')]);router[_0x1a6f('0x10')](_0x1a6f('0x12'),auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x13')]);router[_0x1a6f('0x10')](_0x1a6f('0xe'),auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x14')]);router[_0x1a6f('0x15')](_0x1a6f('0xa'),auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x16')]);router[_0x1a6f('0x17')](_0x1a6f('0xa'),auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x18')]);router[_0x1a6f('0x17')]('/:id/members',auth[_0x1a6f('0x7')](),controller[_0x1a6f('0x19')]);module[_0x1a6f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 294ee6a..3df46d8 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 _0xd876=['exports','INTEGER','ENUM','star','thumb','DATE','STRING','TEXT','long','out'];(function(_0x483539,_0x4771b7){var _0x546f3f=function(_0x507c07){while(--_0x507c07){_0x483539['push'](_0x483539['shift']());}};_0x546f3f(++_0x4771b7);}(_0xd876,0x1cc));var _0x6d87=function(_0x1f8a39,_0xac239b){_0x1f8a39=_0x1f8a39-0x0;var _0x301bdf=_0xd876[_0x1f8a39];return _0x301bdf;};'use strict';var Sequelize=require('sequelize');module[_0x6d87('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6d87('0x1')]},'ratingType':{'type':Sequelize[_0x6d87('0x2')](_0x6d87('0x3'),_0x6d87('0x4')),'defaultValue':_0x6d87('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6d87('0x5')]},'disposition':{'type':Sequelize[_0x6d87('0x6')]},'note':{'type':Sequelize[_0x6d87('0x6')]},'browserName':{'type':Sequelize[_0x6d87('0x6')]},'browserVersion':{'type':Sequelize[_0x6d87('0x6')]},'osName':{'type':Sequelize[_0x6d87('0x6')]},'osVersion':{'type':Sequelize[_0x6d87('0x6')]},'deviceModel':{'type':Sequelize[_0x6d87('0x6')]},'deviceVendor':{'type':Sequelize[_0x6d87('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6d87('0x7')]},'customerIp':{'type':Sequelize[_0x6d87('0x6')]},'formData':{'type':Sequelize[_0x6d87('0x7')](_0x6d87('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6d87('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6d87('0x2')]('in',_0x6d87('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6d87('0x6')]},'customerPort':{'type':Sequelize[_0x6d87('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6d87('0x7')]}}; \ No newline at end of file +var _0x85ea=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0x3d9577,_0xbabc65){var _0x4388e6=function(_0x4d28a7){while(--_0x4d28a7){_0x3d9577['push'](_0x3d9577['shift']());}};_0x4388e6(++_0xbabc65);}(_0x85ea,0x15c));var _0xa85e=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0x85ea[_0x57fa33];return _0x12e724;};'use strict';var Sequelize=require(_0xa85e('0x0'));module[_0xa85e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa85e('0x2')]},'ratingType':{'type':Sequelize[_0xa85e('0x3')](_0xa85e('0x4'),_0xa85e('0x5')),'defaultValue':_0xa85e('0x4')},'ratingMessage':{'type':Sequelize[_0xa85e('0x6')]},'pathTranscript':{'type':Sequelize[_0xa85e('0x6')]},'mailTranscript':{'type':Sequelize[_0xa85e('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa85e('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xa85e('0x7')]},'osVersion':{'type':Sequelize[_0xa85e('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa85e('0x7')]},'deviceType':{'type':Sequelize[_0xa85e('0x7')]},'referer':{'type':Sequelize[_0xa85e('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xa85e('0x9'))},'read1stAt':{'type':Sequelize[_0xa85e('0x8')]},'lastMsgAt':{'type':Sequelize[_0xa85e('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xa85e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa85e('0x7')]},'customerPort':{'type':Sequelize[_0xa85e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xa85e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index db76d1e..ed3a58b 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 _0x4137=['set','Content-Range','save','update','destroy','stack','name','send','Users','map','fullname','TagIds','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','select','field','tools_tags','u.fullname','ui.ChatInteractionId','from','chat_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','end','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','rows','show','params','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooApiKey','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','nolimit','includeAgent','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','unix','join','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','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','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','YYYY-MM-DD','Chat','Account','N.A.','referer','customerIp','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','register','jayson/promise','http','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x7413('0x0'));var emlformat=require(_0x7413('0x1'));var rimraf=require(_0x7413('0x2'));var zipdir=require(_0x7413('0x3'));var jsonpatch=require(_0x7413('0x4'));var rp=require(_0x7413('0x5'));var moment=require(_0x7413('0x6'));var BPromise=require(_0x7413('0x7'));var Mustache=require(_0x7413('0x8'));var util=require(_0x7413('0x9'));var path=require(_0x7413('0xa'));var sox=require(_0x7413('0xb'));var csv=require('to-csv');var ejs=require(_0x7413('0xc'));var fs=require('fs');var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0x11'));var querystring=require('querystring');var Papa=require(_0x7413('0x12'));var Redis=require(_0x7413('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x14'));var as=require(_0x7413('0x15'));var hardwareService=require(_0x7413('0x16'));var logger=require(_0x7413('0x17'))(_0x7413('0x18'));var utils=require('../../config/utils');var config=require(_0x7413('0x19'));var db=require(_0x7413('0x1a'))['db'];config['redis']=_[_0x7413('0x1b')](config[_0x7413('0x1c')],{'host':_0x7413('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0x7413('0x1e')](socket);var jayson=require(_0x7413('0x1f'));var client=jayson['client'][_0x7413('0x20')]({'port':0x232b});var client9004=jayson[_0x7413('0x21')]['http']({'port':0x232c});function checkPasswordPattern(_0x38b3d1,_0x50f301,_0x4b9a5b){if(_0x4b9a5b){var _0x26501b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26501b['test'](_0x50f301)){return _0x38b3d1;}else{throw new db[(_0x7413('0x22'))]['ValidationError'](_0x7413('0x23'));}}else{return _0x38b3d1;}}function respondWithRpcPromise(_0x3230d8,_0x19157f,_0x12a01e,_0x2a3417){return new BPromise(function(_0x26dafe,_0x51194e){var _0xecc3e=_0x2a3417||client;return _0xecc3e[_0x7413('0x24')](_0x3230d8,_0x12a01e)[_0x7413('0x25')](function(_0xfe5b8c){logger['info'](_0x7413('0x26'),_0x19157f,_0x7413('0x27'));logger[_0x7413('0x28')](_0x7413('0x29'),_0x19157f,_0x7413('0x27'),JSON[_0x7413('0x2a')](_0xfe5b8c));if(_0xfe5b8c[_0x7413('0x2b')]){if(_0xfe5b8c[_0x7413('0x2b')]['code']===0x1f4){logger['error'](_0x7413('0x26'),_0x19157f,_0xfe5b8c['error'][_0x7413('0x2c')]);return _0x51194e(_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);}logger[_0x7413('0x2b')](_0x7413('0x26'),_0x19157f,_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);return _0x26dafe(_0xfe5b8c[_0x7413('0x2b')][_0x7413('0x2c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x19157f,_0x7413('0x27'));_0x26dafe(_0xfe5b8c['result'][_0x7413('0x2c')]);}})[_0x7413('0x2d')](function(_0x463b21){logger['error'](_0x7413('0x26'),_0x19157f,_0x463b21);_0x51194e(_0x463b21);});});}function respondWithStatusCode(_0x896552,_0x79cab6){_0x79cab6=_0x79cab6||0xcc;return function(_0x4843fd){if(_0x4843fd){return _0x896552[_0x7413('0x2e')](_0x79cab6);}return _0x896552[_0x7413('0x2f')](_0x79cab6)['end']();};}function respondWithResult(_0x24dce7,_0x4ed662){_0x4ed662=_0x4ed662||0xc8;return function(_0x1d0bde){if(_0x1d0bde){return _0x24dce7[_0x7413('0x2f')](_0x4ed662)[_0x7413('0x30')](_0x1d0bde);}};}function respondWithFilteredResult(_0x13a836,_0x25fa52){return function(_0x2004ea){if(_0x2004ea){var _0x5bb3ea=_0x2004ea[_0x7413('0x31')],_0x1ffb6f=_0x25fa52[_0x7413('0x32')],_0x17c342=_0x25fa52[_0x7413('0x32')]+_0x25fa52[_0x7413('0x33')],_0x39db32;if(_0x17c342>=_0x5bb3ea){_0x17c342=_0x5bb3ea;_0x39db32=0xc8;}else{_0x39db32=0xce;}_0x13a836['status'](_0x39db32);return _0x13a836[_0x7413('0x34')](_0x7413('0x35'),_0x1ffb6f+'-'+_0x17c342+'/'+_0x5bb3ea)[_0x7413('0x30')](_0x2004ea);}return null;};}function patchUpdates(_0xd373d5){return function(_0x14bf3b){try{jsonpatch['apply'](_0x14bf3b,_0xd373d5,!![]);}catch(_0x1c36f8){return BPromise['reject'](_0x1c36f8);}return _0x14bf3b[_0x7413('0x36')]();};}function saveUpdates(_0x126d66,_0x1cc4d8){return function(_0x539d93){if(_0x539d93){return _0x539d93[_0x7413('0x37')](_0x126d66)['then'](function(_0x29e30a){return _0x29e30a;});}return null;};}function removeEntity(_0x31c174,_0x591666){return function(_0x499cfa){if(_0x499cfa){return _0x499cfa[_0x7413('0x38')]()[_0x7413('0x25')](function(){_0x31c174[_0x7413('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd1ce,_0x409f06){return function(_0x5a92ab){if(!_0x5a92ab){_0x4dd1ce['sendStatus'](0x194);}return _0x5a92ab;};}function handleError(_0xda3035,_0x575a79){_0x575a79=_0x575a79||0x1f4;return function(_0x3ad12d){logger[_0x7413('0x2b')](_0x3ad12d[_0x7413('0x39')]);if(_0x3ad12d[_0x7413('0x3a')]){delete _0x3ad12d[_0x7413('0x3a')];}_0xda3035['status'](_0x575a79)[_0x7413('0x3b')](_0x3ad12d);};}function getInteractionUsers(_0x8dc047,_0x44e8b5){return new BPromise(function(_0xfa34ef,_0x245777){try{if(_0x44e8b5[_0x8dc047['id']]){_0x8dc047[_0x7413('0x3c')]=_[_0x7413('0x3d')](_0x44e8b5[_0x8dc047['id']],function(_0x385156){return{'id':_0x385156['id'],'fullname':_0x385156[_0x7413('0x3e')]};});}}catch(_0x26a241){_0x245777(_0x26a241);}_0xfa34ef(_0x8dc047);});}function getInteractionTags(_0x5c03eb,_0x320c61){return new BPromise(function(_0x5a9791,_0x31f8){try{if(_0x5c03eb['TagIds']){_0x5c03eb['Tags']=[];_0x5c03eb['TagIds']['split'](',')['forEach'](function(_0x44af7d){_0x5c03eb['Tags']['push'](_0x320c61[_0x44af7d]);});}delete _0x5c03eb[_0x7413('0x3f')];}catch(_0x4d0008){_0x31f8(_0x4d0008);}_0x5a9791(_0x5c03eb);});}function updateChatInteraction(_0x4c6746,_0x3d92ec,_0x32f1e8){return new BPromise(function(_0x18674c,_0x41ba22){return getInteractionUsers(_0x4c6746,_0x32f1e8)[_0x7413('0x25')](function(_0x57cb9e){return getInteractionTags(_0x57cb9e,_0x3d92ec);})[_0x7413('0x25')](function(_0x51c48a){_0x18674c(_0x51c48a);})[_0x7413('0x2d')](function(_0x1d8219){_0x41ba22(_0x1d8219);});});}exports[_0x7413('0x40')]=function(_0xfe0daa,_0x3f7da2){var _0x125466={},_0x12c1b3={},_0x1f88e7={'count':0x0,'rows':[]};var _0x35d198=_[_0x7413('0x3d')](db[_0x7413('0x41')][_0x7413('0x42')],function(_0x3fbec4){return{'name':_0x3fbec4['fieldName'],'type':_0x3fbec4[_0x7413('0x43')][_0x7413('0x44')]};});_0x12c1b3[_0x7413('0x45')]=_[_0x7413('0x3d')](_0x35d198,_0x7413('0x3a'));_0x12c1b3[_0x7413('0x46')]=_[_0x7413('0x47')](_0xfe0daa[_0x7413('0x46')]);_0x12c1b3[_0x7413('0x48')]=_[_0x7413('0x49')](_0x12c1b3[_0x7413('0x45')],_0x12c1b3['query']);_0x125466[_0x7413('0x4a')]=_['intersection'](_0x12c1b3[_0x7413('0x45')],qs[_0x7413('0x4b')](_0xfe0daa[_0x7413('0x46')][_0x7413('0x4b')]));_0x125466[_0x7413('0x4a')]=_0x125466[_0x7413('0x4a')][_0x7413('0x4c')]?_0x125466[_0x7413('0x4a')]:_0x12c1b3[_0x7413('0x45')];if(!_0xfe0daa[_0x7413('0x46')]['hasOwnProperty']('nolimit')){_0x125466[_0x7413('0x33')]=qs['limit'](_0xfe0daa['query'][_0x7413('0x33')]);_0x125466[_0x7413('0x32')]=qs['offset'](_0xfe0daa[_0x7413('0x46')]['offset']);}_0x125466['order']=qs[_0x7413('0x4d')](_0xfe0daa['query'][_0x7413('0x4d')]);_0x125466[_0x7413('0x4e')]=qs[_0x7413('0x48')](_[_0x7413('0x4f')](_0xfe0daa[_0x7413('0x46')],_0x12c1b3[_0x7413('0x48')]),_0x35d198);var _0x153a9c=[];var _0xde6773=squel[_0x7413('0x50')]()[_0x7413('0x51')]('id')['field'](_0x7413('0x3a'))['field']('color')['from'](_0x7413('0x52'));var _0x4299a3=squel[_0x7413('0x50')]()[_0x7413('0x51')]('u.id')['field'](_0x7413('0x53'))['field'](_0x7413('0x54'))['from']('user_has_chat_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x6734e4=squel[_0x7413('0x50')]()[_0x7413('0x55')](_0x7413('0x56'),'i')[_0x7413('0x57')]('cm_contacts','c',_0x7413('0x58'))[_0x7413('0x57')](_0x7413('0x59'),'o','o.id\x20=\x20i.UserId')[_0x7413('0x57')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x7413('0x57')](_0x7413('0x5a'),'me',_0x7413('0x5b'))[_0x7413('0x57')](_0x7413('0x5c'),'it',_0x7413('0x5d'))['left_join'](_0x7413('0x52'),'t','t.id\x20=\x20it.TagId');var _0x1d5ff2=squel['expr']();var _0x1ea50f=[];var _0x4d4faa=squel[_0x7413('0x5e')]();var _0x262f77;if(_0xfe0daa['query'][_0x7413('0x5f')]){_0x262f77=as['parseSearch'](_0xfe0daa[_0x7413('0x46')][_0x7413('0x5f')]);var _0x5163ca=_0x262f77[_0x7413('0x60')];for(var _0x12048c=0x0;_0x12048c<_0x262f77['conditions'][_0x7413('0x4c')];_0x12048c++){var _0x2bebea=_0x262f77['conditions'][_0x12048c];var _0xf4641='i';var _0x28eaf4=_[_0x7413('0x61')](_0x35d198,[_0x7413('0x3a'),_0x2bebea[_0x7413('0x51')]]);if(!_0x28eaf4){switch(_0x2bebea[_0x7413('0x51')]){case _0x7413('0x62'):if(_0x2bebea[_0x7413('0x63')]==0x1){_0x6734e4['having']('`'+_0x2bebea[_0x7413('0x51')]+'`\x20=\x200');}else{_0x6734e4[_0x7413('0x64')]('`'+_0x2bebea[_0x7413('0x51')]+_0x7413('0x65'));}break;case _0x7413('0x66'):if(_0x2bebea['operator']==='$substring'){if(_0x2bebea['value']['split']('\x20')['length']>0x1){_0x1d5ff2[_0x5163ca](_0x7413('0x67'),qs[_0x7413('0x68')](_0x2bebea[_0x7413('0x63')]),null);}else{var _0x5de03e='%'+_0x2bebea[_0x7413('0x63')]+'%';_0x1d5ff2[_0x5163ca](_0x7413('0x69'),_0x5de03e,_0x5de03e,_0x5de03e);}}else{_0x28eaf4=_[_0x7413('0x61')](_0x35d198,[_0x7413('0x3a'),_0x7413('0x6a')]);_0x2bebea[_0x7413('0x51')]=_0x7413('0x6a');_0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4[_0x7413('0x43')],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')][_0x7413('0x6d')],_0x46983f[_0x7413('0x63')]['end']);}break;case _0x7413('0x6e'):var _0x405ae4=_0x2bebea['value'][_0x7413('0x6f')](',')[_0x7413('0x3d')](function(_0x521682){return Number(_0x521682);});_0x405ae4[_0x7413('0x70')](function(_0x102fd2){_0x4d4faa['or'](_0x7413('0x71'),'%,'+_0x102fd2+',%');});_0x1ea50f=_['union'](_0x1ea50f,_0x405ae4);break;case _0x7413('0x72'):if(_0x2bebea[_0x7413('0x73')]==='$substring'){_0x1d5ff2[_0x5163ca](_0x7413('0x74'),'%'+_0x2bebea['value']+'%',null);}else{_0x28eaf4=_['find'](_0x35d198,[_0x7413('0x3a'),_0x7413('0x75')]);_0x2bebea[_0x7413('0x51')]=_0x7413('0x75');_0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4[_0x7413('0x43')],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')]['start'],_0x46983f[_0x7413('0x63')]['end']);}break;case _0x7413('0x76'):_0x46983f=as[_0x7413('0x6b')]('me',null,_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')][_0x7413('0x6d')],_0x46983f[_0x7413('0x63')][_0x7413('0x77')]);break;}}else{var _0x46983f=as[_0x7413('0x6b')](_0xf4641,_0x28eaf4['type'],_0x2bebea);_0x1d5ff2[_0x5163ca](_0x46983f[_0x7413('0x6c')],_0x46983f[_0x7413('0x63')]['start'],_0x46983f[_0x7413('0x63')][_0x7413('0x77')]);}}}else{var _0x599a91=_(_0xfe0daa[_0x7413('0x46')])['keys']()[_0x7413('0x3d')](function(_0x3d4ce3){return _['some'](_0x35d198,['name',_0x3d4ce3])?_0x3d4ce3:undefined;})[_0x7413('0x78')]()[_0x7413('0x63')]();if(!_[_0x7413('0x79')](_0x599a91)){_0x599a91['forEach'](function(_0x3fff33){if(_0x3fff33===_0x7413('0x7a')){_0x6734e4[_0x7413('0x4e')](_0x7413('0x7b'),[][_0x7413('0x7c')](_0xfe0daa[_0x7413('0x46')][_0x3fff33]));}else if(_0x3fff33==='createdAt'){var _0x3b6975=JSON[_0x7413('0x7d')](_0xfe0daa[_0x7413('0x46')][_0x3fff33])['$gte'];var _0x350b01=JSON[_0x7413('0x7d')](_0xfe0daa[_0x7413('0x46')][_0x3fff33])[_0x7413('0x7e')];_0x6734e4[_0x7413('0x4e')](_0x7413('0x7f'),_0x3b6975,_0x350b01);}else{if(_0xfe0daa[_0x7413('0x46')][_0x3fff33]===_0x7413('0x80')){_0x6734e4[_0x7413('0x4e')]('i.'+_0x3fff33+'\x20IS\x20NULL');}else{_0x6734e4[_0x7413('0x4e')]('i.'+_0x3fff33+_0x7413('0x81'),_0xfe0daa[_0x7413('0x46')][_0x3fff33]);}}});}if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x82')]){if(_0xfe0daa[_0x7413('0x46')]['read']==0x1){_0x6734e4[_0x7413('0x64')]('`unreadMessages`\x20=\x200');}else{_0x6734e4['having'](_0x7413('0x83'));}}if(_0xfe0daa[_0x7413('0x46')]['tag']){_0x1ea50f=_[_0x7413('0x84')](_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')])?_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')]:new Array(_0xfe0daa[_0x7413('0x46')][_0x7413('0x85')]);_0x1ea50f[_0x7413('0x70')](function(_0x5f4765){_0x4d4faa['or'](_0x7413('0x71'),'%,'+_0x5f4765+',%');});}if(_0xfe0daa['query'][_0x7413('0x86')]){var _0x3ad956=_0xfe0daa['query'][_0x7413('0x86')][_0x7413('0x87')]('\x5c','\x5c\x5c')[_0x7413('0x87')]('\x27\x27',_0x7413('0x88'));if(qs[_0x7413('0x89')](_0x3ad956)){_0x1d5ff2['or'](_0x7413('0x8a'),_0x3ad956+'%');}else{_0x1d5ff2['or'](_0x7413('0x8b'),qs[_0x7413('0x68')](_0x3ad956))['or'](_0x7413('0x8c'),_0x3ad956+'%');}}}_0x6734e4[_0x7413('0x4e')](_0x1d5ff2);_0x6734e4['group'](_0x7413('0x8d'));var _0x290acf={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x29ac62=_0x6734e4['clone']();_0x29ac62[_0x7413('0x51')](_0x7413('0x8d'));_0x29ac62[_0x7413('0x51')](_0x7413('0x8e'),_0x7413('0x62'));if(_0x125466[_0x7413('0x8f')]){_0x125466[_0x7413('0x8f')][_0x7413('0x70')](function(_0x3efa75){_0x6734e4['order']('i.'+_0x3efa75[0x0],_0x3efa75[0x1]===_0x7413('0x90')?![]:!![]);});}if(!_[_0x7413('0x79')](_0x1ea50f)){_0x6734e4[_0x7413('0x64')](_0x4d4faa);_0x29ac62['where'](_0x7413('0x91'),_0x1ea50f);}BPromise[_0x7413('0x92')]()[_0x7413('0x25')](function(){if(!_0x262f77){if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x7a')]||_0xfe0daa[_0x7413('0x46')][_0x7413('0x93')])return;_0x29ac62[_0x7413('0x4e')](_0x7413('0x94'));_0x6734e4[_0x7413('0x4e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0xfe0daa[_0x7413('0x95')][_0x7413('0x96')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43f813){if(_[_0x7413('0x79')](_0x43f813)){_0x29ac62['where'](_0x7413('0x97'));_0x6734e4[_0x7413('0x4e')](_0x7413('0x97'));}else{_0x29ac62['where'](_0x7413('0x7b'),_['map'](_0x43f813,'id'));_0x6734e4[_0x7413('0x4e')](_0x7413('0x7b'),_[_0x7413('0x3d')](_0x43f813,'id'));}});})[_0x7413('0x25')](function(){db[_0x7413('0x98')][_0x7413('0x46')](_0x29ac62['toString'](),_0x290acf)[_0x7413('0x25')](function(_0x40e10d){_0x1f88e7[_0x7413('0x31')]=_0x40e10d[_0x7413('0x4c')];if(_0x1f88e7[_0x7413('0x31')]===0x0)return[];return db['sequelize'][_0x7413('0x46')](_0xde6773[_0x7413('0x99')](),_0x290acf)[_0x7413('0x25')](function(_0x3c4661){_0x153a9c=_[_0x7413('0x9a')](_0x3c4661,'id');_0x290acf=_['merge'](_0x290acf,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfe0daa[_0x7413('0x46')][_0x7413('0x4b')]){_0x125466[_0x7413('0x4a')][_0x7413('0x70')](function(_0x4ec202){_0x6734e4['field']('i.'+_0x4ec202);});}else{_0x6734e4[_0x7413('0x51')](_0x7413('0x8e'),_0x7413('0x62'));_0x6734e4['field']('a.key',_0x7413('0x9b'));_0x6734e4[_0x7413('0x51')](_0x7413('0x9c'),_0x7413('0x9d'));_0x6734e4[_0x7413('0x51')](_0x7413('0x9e'));_0x6734e4[_0x7413('0x51')]('c.firstName','Contact.firstName');_0x6734e4[_0x7413('0x51')](_0x7413('0x9f'),'Contact.lastName');_0x6734e4[_0x7413('0x51')](_0x7413('0xa0'),_0x7413('0xa1'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa2'),_0x7413('0xa3'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa4'),_0x7413('0xa5'));_0x6734e4['field'](_0x7413('0xa6'),_0x7413('0xa7'));_0x6734e4[_0x7413('0x51')](_0x7413('0xa8'),_0x7413('0xa9'));_0x6734e4[_0x7413('0x51')]('o.internal','Owner.internal');_0x6734e4['field'](_0x7413('0xaa'),_0x7413('0x3f'));}if(_0x125466[_0x7413('0x33')])_0x6734e4[_0x7413('0x33')](_0x125466[_0x7413('0x33')]);if(_0x125466[_0x7413('0x32')])_0x6734e4[_0x7413('0x32')](_0x125466[_0x7413('0x32')]);return db['sequelize'][_0x7413('0x46')](_0x6734e4['toString'](),_0x290acf);})[_0x7413('0x25')](function(_0x30985e){_0x4299a3[_0x7413('0x4e')](_0x7413('0xab'),_[_0x7413('0x3d')](_0x30985e,'id'));return db['sequelize'][_0x7413('0x46')](_0x4299a3[_0x7413('0x99')](),_0x290acf)[_0x7413('0x25')](function(_0x145fcb){var _0xf11f9b=_[_0x7413('0xac')](_0x145fcb,_0x7413('0xad'));var _0xa43b1b=[];_0x30985e[_0x7413('0x70')](function(_0x31f54f){_0xa43b1b[_0x7413('0xae')](updateChatInteraction(_0x31f54f,_0x153a9c,_0xf11f9b));});return BPromise[_0x7413('0xaf')](_0xa43b1b);});});})[_0x7413('0x25')](function(_0x398823){_0x1f88e7[_0x7413('0xb0')]=_0x398823;return _0x1f88e7;})['then'](respondWithFilteredResult(_0x3f7da2,_0x125466));})['catch'](handleError(_0x3f7da2,null));};exports[_0x7413('0xb1')]=function(_0xae889e,_0x591ee4){var _0x2144b3={'raw':![],'where':{'id':_0xae889e[_0x7413('0xb2')]['id']}},_0x571a6c={};_0x571a6c[_0x7413('0x45')]=_[_0x7413('0x47')](db[_0x7413('0x41')][_0x7413('0x42')]);_0x571a6c[_0x7413('0x46')]=_[_0x7413('0x47')](_0xae889e[_0x7413('0x46')]);_0x571a6c['filters']=_[_0x7413('0x49')](_0x571a6c['model'],_0x571a6c[_0x7413('0x46')]);_0x2144b3['attributes']=_[_0x7413('0x49')](_0x571a6c[_0x7413('0x45')],qs[_0x7413('0x4b')](_0xae889e['query'][_0x7413('0x4b')]));_0x2144b3[_0x7413('0x4a')]=_0x2144b3[_0x7413('0x4a')][_0x7413('0x4c')]?_0x2144b3[_0x7413('0x4a')]:_0x571a6c[_0x7413('0x45')];if(_0xae889e['query'][_0x7413('0xb3')]){_0x2144b3['include']=[{'all':!![]}];}_0x2144b3=_['merge']({},_0x2144b3,_0xae889e[_0x7413('0xb4')]);return db[_0x7413('0x41')][_0x7413('0x61')](_0x2144b3)['then'](handleEntityNotFound(_0x591ee4,null))[_0x7413('0x25')](respondWithResult(_0x591ee4,null))[_0x7413('0x2d')](handleError(_0x591ee4,null));};exports[_0x7413('0xb5')]=function(_0x422c6d,_0x3772c2){return db[_0x7413('0x41')]['create'](_0x422c6d['body'],{})['then'](respondWithResult(_0x3772c2,0xc9))[_0x7413('0x2d')](handleError(_0x3772c2,null));};exports[_0x7413('0x37')]=function(_0x4f54f7,_0x2b202a){if(_0x4f54f7[_0x7413('0x76')]['id']){delete _0x4f54f7[_0x7413('0x76')]['id'];}return db[_0x7413('0x41')]['find']({'where':{'id':_0x4f54f7[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x2b202a,null))['then'](saveUpdates(_0x4f54f7[_0x7413('0x76')],null))[_0x7413('0x25')](respondWithResult(_0x2b202a,null))[_0x7413('0x2d')](handleError(_0x2b202a,null));};exports[_0x7413('0x38')]=function(_0x5a9c7e,_0x1b8863){return db[_0x7413('0x41')]['find']({'where':{'id':_0x5a9c7e[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x1b8863,null))['then'](removeEntity(_0x1b8863,null))[_0x7413('0x2d')](handleError(_0x1b8863,null));};exports['describe']=function(_0x4caf14,_0x150669){return db[_0x7413('0x41')][_0x7413('0xb6')]()[_0x7413('0x25')](respondWithResult(_0x150669,null))[_0x7413('0x2d')](handleError(_0x150669,null));};exports[_0x7413('0xb7')]=function(_0x2bac58,_0x5863c8){var _0x24092e=_0x2bac58['params']['id'];var _0x4ca0d5;var _0x143c25;var _0x3642db;return db['ChatInteraction'][_0x7413('0xb8')]({'where':{'id':_0x24092e}})[_0x7413('0x25')](function(_0x3d968e){_0x4ca0d5=_0x3d968e;return db[_0x7413('0xb9')][_0x7413('0xb8')]({'where':{'id':_0x3d968e[_0x7413('0x7a')]},'attributes':['id','vidaooApiKey',_0x7413('0xba')],'raw':!![]});})[_0x7413('0x25')](function(_0x14f143){if(_0x14f143&&_0x14f143[_0x7413('0xbb')]&&_0x14f143['vidaooEscalation']){_0x143c25=_0x14f143;var _0x2de249={'rejectUnauthorized':![],'method':_0x7413('0xbc'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x14f143[_0x7413('0xbb')]},'body':{'name':_0x7413('0xbd')+_0x24092e},'redirect':_0x7413('0xbe'),'json':!![]};return rp(_0x2de249);}else{throw new db['Sequelize'][(_0x7413('0xbf'))](_0x7413('0xc0'));}})[_0x7413('0x25')](function(_0x1aa397){_0x3642db=_0x1aa397;if(_0x3642db['id']){var _0xb789fc={'body':_0x3642db[_0x7413('0xc1')],'ChatWebsiteId':_0x143c25['id'],'ChatInteractionId':_0x4ca0d5['id'],'direction':'out','UserId':_0x2bac58['user']['id']};return db[_0x7413('0xc2')][_0x7413('0xb5')](_0xb789fc,{});}else{throw new db[(_0x7413('0x22'))][(_0x7413('0xbf'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x7413('0x25')](function(){return _0x4ca0d5[_0x7413('0xc3')]({'vidaooSessionId':_0x3642db['id']});})[_0x7413('0x25')](respondWithResult(_0x5863c8,null))[_0x7413('0x2d')](handleError(_0x5863c8,null));};exports['customUpdate']=function(_0x56422f,_0x13b42b){if(_0x56422f[_0x7413('0x76')]['id']){delete _0x56422f['body']['id'];}return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x56422f['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x13b42b,null))[_0x7413('0x25')](saveUpdates(_0x56422f[_0x7413('0x76')],null))[_0x7413('0x25')](respondWithResult(_0x13b42b,null))['catch'](handleError(_0x13b42b,null));};exports['abandon']=function(_0x533a4c,_0x4ee56c,_0x2f9603){if(_0x533a4c[_0x7413('0x76')]['id']){delete _0x533a4c[_0x7413('0x76')]['id'];}return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x533a4c[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](function(_0x3d4d43){if(!_0x3d4d43){logger[_0x7413('0x2b')](_0x7413('0xc4'),_0x7413('0xc5'),0x194,'entity\x20not\x20found');_0x4ee56c['sendStatus'](0x194);}else{if(_0x3d4d43['UserId']){throw new db[(_0x7413('0x22'))][(_0x7413('0xbf'))](_0x7413('0xc6'));}}return _0x3d4d43;})['then'](function(_0x4af3d2){if(_0x4af3d2){return _0x4af3d2[_0x7413('0x37')]({'closed':_0x533a4c[_0x7413('0x76')][_0x7413('0xc7')],'disposition':_0x533a4c['body'][_0x7413('0xc8')]})['then'](function(_0x1cc173){return _0x1cc173;});}})[_0x7413('0x25')](function(_0x205730){return respondWithRpcPromise(_0x7413('0xc9'),'abandon',_0x533a4c['body'],client9004);})['then'](respondWithResult(_0x4ee56c,null))['catch'](handleError(_0x4ee56c,null));};exports['attachmentUpload']=function(_0x4f3411,_0xa7c2fb,_0x2b4135){_0x4f3411['body'][_0x7413('0x3a')]=_0x4f3411[_0x7413('0xca')]['originalname'];_0x4f3411[_0x7413('0x76')][_0x7413('0xcb')]=_0x4f3411[_0x7413('0xca')]['filename'];_0x4f3411['body']['type']=_0x4f3411[_0x7413('0xca')][_0x7413('0xcc')];return db[_0x7413('0xcd')][_0x7413('0xb5')](_0x4f3411[_0x7413('0x76')])['then'](respondWithResult(_0xa7c2fb,0xc9))['catch'](handleError(_0xa7c2fb,null));};exports[_0x7413('0xce')]=function(_0x3e2d80,_0x2ac897,_0x37fe92){return db['ChatInteraction'][_0x7413('0xb8')]({'where':{'id':_0x3e2d80[_0x7413('0xb2')]['id']},'raw':!![]})[_0x7413('0x25')](handleEntityNotFound(_0x2ac897,null))[_0x7413('0x25')](function(_0x2c0a9b){if(_0x2c0a9b){if(_0x2c0a9b[_0x7413('0xc7')]){return _0x2ac897[_0x7413('0x2f')](0x193)[_0x7413('0x30')]({'status':0x193,'message':_0x7413('0xcf')});}return db[_0x7413('0xcd')]['findOne']({'where':{'id':_0x3e2d80[_0x7413('0x46')][_0x7413('0xd0')]},'raw':!![]})[_0x7413('0x25')](handleEntityNotFound(_0x2ac897,null));}})[_0x7413('0x25')](function(_0x202174){if(_0x202174){return _0x2ac897[_0x7413('0xd1')](path['join'](config[_0x7413('0xd2')],_0x7413('0xd3'),_0x202174[_0x7413('0xcb')]));}})[_0x7413('0x2d')](handleError(_0x2ac897,null));};exports[_0x7413('0xd4')]=function(_0x372ebc,_0x5efa42){var _0x561c08=null;var _0x39aac5=null;var _0x3954b6=null;var _0x13f578=null;if(_0x372ebc[_0x7413('0x76')]['id']){delete _0x372ebc[_0x7413('0x76')]['id'];}if(_0x372ebc[_0x7413('0x76')]['mailTranscript']){_0x13f578=path['join'](config[_0x7413('0xd2')],_0x7413('0xd5'),util[_0x7413('0xd6')](_0x7413('0xd7'),Date['now']()));_0x372ebc[_0x7413('0x76')][_0x7413('0xd8')]=_0x13f578;}return db['ChatInteraction'][_0x7413('0x61')]({'where':{'id':_0x372ebc[_0x7413('0xb2')]['id']},'include':[{'model':db[_0x7413('0xc2')],'as':_0x7413('0xd9'),'include':[{'model':db['User'],'as':_0x7413('0x72')}]}]})[_0x7413('0x25')](handleEntityNotFound(_0x5efa42,null))[_0x7413('0x25')](saveUpdates(_0x372ebc[_0x7413('0x76')],null))['then'](function(_0x54a70a){if(_0x54a70a){_0x561c08=_0x54a70a;return db[_0x7413('0xb9')][_0x7413('0x61')]({'where':{'id':_0x561c08[_0x7413('0x7a')]}});}})[_0x7413('0x25')](function(_0x1c5d99){if(_0x1c5d99){_0x3954b6=_0x1c5d99;return db[_0x7413('0xda')][_0x7413('0x61')]({'where':{'id':_0x561c08['ContactId']}});}})[_0x7413('0x25')](function(_0x24c091){if(_0x24c091){_0x39aac5=_0x24c091;if(_0x13f578){var _0x558e82=null;for(var _0x538654=0x1;_0x538654<_0x561c08[_0x7413('0xd9')]['length'];++_0x538654){_0x558e82=_0x561c08['Messages'][_0x538654];var _0x26cd01=_0x558e82[_0x7413('0x75')]?util[_0x7413('0xd6')](_0x7413('0xdb'),_0x3954b6[_0x7413('0xdc')],_0x558e82[_0x7413('0x75')]):_0x7413('0xdd');var _0x12fcf7=_0x372ebc['body'][_0x7413('0xde')]||util[_0x7413('0xd6')]('%s%d',_0x7413('0xdf'),_0x558e82[_0x7413('0x6a')]);switch(_0x3954b6[_0x7413('0xe0')]){case _0x7413('0xe1'):_0x26cd01=_0x558e82['UserId']?util[_0x7413('0xd6')](_0x7413('0xdb'),_0x3954b6[_0x7413('0xdc')],_0x558e82['UserId']):_0x7413('0xdd');break;case _0x7413('0xe2'):_0x26cd01=_0x558e82[_0x7413('0x75')]?_0x558e82['User'][_0x7413('0xe3')]||_0x558e82['User'][_0x7413('0x3e')]:'System';break;case'agent_fullname':_0x26cd01=_0x558e82[_0x7413('0x75')]?_0x558e82[_0x7413('0x72')][_0x7413('0x3e')]:_0x7413('0xdd');break;default:_0x26cd01=_0x558e82['UserId']?util[_0x7413('0xd6')]('%s%d',_0x3954b6[_0x7413('0xdc')],_0x558e82[_0x7413('0x75')]):'System';}var _0x65bed2=util[_0x7413('0xd6')](_0x7413('0xe4'),moment(_0x558e82[_0x7413('0xe5')])[_0x7413('0xd6')](_0x7413('0xe6')),_0x558e82[_0x7413('0xe7')]==='in'?_0x12fcf7:_0x26cd01,_0x558e82[_0x7413('0x76')]);if(!_0x558e82[_0x7413('0xe8')]){fs[_0x7413('0xe9')](_0x13f578,_0x65bed2);}}return db[_0x7413('0xea')][_0x7413('0xb8')]({'where':{'service':!![]},'include':[{'model':db[_0x7413('0xeb')],'as':_0x7413('0xec'),'raw':!![]}]});}}})[_0x7413('0x25')](function(_0x2abdb9){if(_0x2abdb9&&_0x2abdb9['Smtp']&&_0x372ebc['body']){var _0x32e473={'tls':{'rejectUnauthorized':![]}};if(_0x2abdb9[_0x7413('0xec')]['service']){_0x32e473[_0x7413('0xed')]=_0x2abdb9['Smtp']['service'];}else{_0x32e473[_0x7413('0xee')]=_0x2abdb9['Smtp'][_0x7413('0xee')];_0x32e473[_0x7413('0xef')]=_0x2abdb9[_0x7413('0xec')][_0x7413('0xef')];_0x32e473['secure']=_0x2abdb9[_0x7413('0xec')][_0x7413('0xf0')];}if(_0x2abdb9[_0x7413('0xec')][_0x7413('0xf1')]){_0x32e473['auth']={'user':_0x2abdb9['Smtp'][_0x7413('0x95')],'pass':_0x2abdb9[_0x7413('0xec')]['pass']};}return respondWithRpcPromise('SendMail',_0x7413('0xf2'),{'account':_0x32e473,'message':{'from':util['format'](_0x7413('0xf3'),_0x2abdb9[_0x7413('0x3a')],_0x2abdb9['email']||_0x2abdb9[_0x7413('0xec')][_0x7413('0x95')]),'to':_0x372ebc['body'][_0x7413('0xf4')],'subject':_0x7413('0xf5'),'text':util[_0x7413('0xd6')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x372ebc[_0x7413('0x76')]['mailTranscript']),'attachments':[{'path':_0x13f578}]}})[_0x7413('0x25')](function(){return _0x561c08;})['catch'](function(_0x1fc604){console[_0x7413('0x2b')](_0x1fc604);});}else{return _0x561c08;}})[_0x7413('0x25')](respondWithStatusCode(_0x5efa42,0xc8))['catch'](handleError(_0x5efa42,null));};exports[_0x7413('0xf6')]=function(_0x39b512,_0xd20e1b,_0x2428d0){return db[_0x7413('0xc2')][_0x7413('0x61')]({'where':{'id':_0x39b512['params']['id']}})['then'](handleEntityNotFound(_0xd20e1b,null))[_0x7413('0x25')](function(_0x529f85){if(_0x529f85){return _0x529f85['addMessage'](_0x39b512['body'][_0x7413('0xf7')],_[_0x7413('0xf8')](_0x39b512[_0x7413('0x76')],[_0x7413('0xf7'),'id'])||{});}})['then'](respondWithResult(_0xd20e1b,null))[_0x7413('0x2d')](handleError(_0xd20e1b,null));};exports[_0x7413('0xf9')]=function(_0x437390,_0x29044a,_0x53808c){var _0x22614a={'raw':![],'where':{}};var _0x1687c4={};var _0x305310={'count':0x0,'rows':[]};return db[_0x7413('0x41')]['findOne']({'where':{'id':_0x437390['params']['id']}})['then'](handleEntityNotFound(_0x29044a,null))[_0x7413('0x25')](function(_0x50e131){if(_0x50e131){_0x1687c4['model']=_[_0x7413('0x47')](db[_0x7413('0xc2')][_0x7413('0x42')]);_0x1687c4['query']=_[_0x7413('0x47')](_0x437390[_0x7413('0x46')]);_0x1687c4[_0x7413('0x48')]=_[_0x7413('0x49')](_0x1687c4[_0x7413('0x45')],_0x1687c4['query']);_0x22614a[_0x7413('0x4a')]=_['intersection'](_0x1687c4['model'],qs[_0x7413('0x4b')](_0x437390['query'][_0x7413('0x4b')]));_0x22614a[_0x7413('0x4a')]=_0x22614a['attributes']['length']?_0x22614a[_0x7413('0x4a')]:_0x1687c4[_0x7413('0x45')];if(!_0x437390[_0x7413('0x46')][_0x7413('0xfa')]('nolimit')){_0x22614a['limit']=qs['limit'](_0x437390[_0x7413('0x46')]['limit']);_0x22614a[_0x7413('0x32')]=qs['offset'](_0x437390[_0x7413('0x46')]['offset']);}_0x22614a['order']=qs[_0x7413('0x4d')](_0x437390['query'][_0x7413('0x4d')]);_0x22614a[_0x7413('0x4e')]=qs['filters'](_['pick'](_0x437390['query'],_0x1687c4[_0x7413('0x48')]));_0x22614a['where'][_0x7413('0xad')]=_0x50e131['id'];if(_0x437390[_0x7413('0x46')][_0x7413('0x86')]){_0x22614a[_0x7413('0x4e')]=_[_0x7413('0xfb')](_0x22614a[_0x7413('0x4e')],{'$or':_['map'](_0x22614a['attributes'],function(_0x5bbc6c){var _0x3f29db={};_0x3f29db[_0x5bbc6c]={'$like':'%'+_0x437390[_0x7413('0x46')][_0x7413('0x86')]+'%'};return _0x3f29db;})});}if(_0x437390[_0x7413('0x46')][_0x7413('0xfc')]){var _0x1f5fce=_0x437390[_0x7413('0x46')][_0x7413('0xfc')][_0x7413('0x6f')](',');var _0x1de3bf={};_0x1de3bf[_0x1f5fce[0x0]]={'$gte':moment(_0x1f5fce[0x1])[_0x7413('0xd6')](_0x7413('0xfd'))};_0x22614a[_0x7413('0x4e')]=_[_0x7413('0xfb')](_0x22614a[_0x7413('0x4e')],_0x1de3bf);}_0x22614a=_[_0x7413('0xfb')]({},_0x22614a,_0x437390[_0x7413('0xb4')]);return db[_0x7413('0xc2')][_0x7413('0x31')]({'where':_0x22614a[_0x7413('0x4e')]})[_0x7413('0x25')](function(_0x26d10d){_0x305310['count']=_0x26d10d;if(_0x437390[_0x7413('0x46')][_0x7413('0xb3')]){_0x22614a[_0x7413('0xfe')]=[{'all':!![]}];}return db[_0x7413('0xc2')][_0x7413('0xff')](_0x22614a);})['then'](function(_0x293ba7){_0x305310[_0x7413('0xb0')]=_0x293ba7;return _0x305310;});}})[_0x7413('0x25')](respondWithFilteredResult(_0x29044a,_0x22614a))[_0x7413('0x2d')](handleError(_0x29044a,null));};exports['getMyMessages']=function(_0x5ecd20,_0x27014c,_0x26b96c){var _0x646615={'where':{}},_0x441c99={},_0x39abc4={'count':0x0,'rows':[]};return db[_0x7413('0x41')][_0x7413('0xb8')]({'where':{'id':_0x5ecd20[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x27014c,null))[_0x7413('0x25')](function(_0x3e8312){if(_0x3e8312){_0x441c99['model']=_[_0x7413('0x47')](db[_0x7413('0xc2')][_0x7413('0x42')]);_0x441c99[_0x7413('0x46')]=_['keys'](_0x5ecd20[_0x7413('0x46')]);_0x441c99[_0x7413('0x48')]=_[_0x7413('0x49')](_0x441c99[_0x7413('0x45')],_0x441c99['query']);_0x646615[_0x7413('0x4a')]=_[_0x7413('0x49')](_0x441c99[_0x7413('0x45')],qs[_0x7413('0x4b')](_0x5ecd20[_0x7413('0x46')][_0x7413('0x4b')]));_0x646615['attributes']=_0x646615[_0x7413('0x4a')][_0x7413('0x4c')]?_0x646615['attributes']:_0x441c99[_0x7413('0x45')];if(!_0x5ecd20[_0x7413('0x46')]['hasOwnProperty'](_0x7413('0x100'))){_0x646615['limit']=qs[_0x7413('0x33')](_0x5ecd20[_0x7413('0x46')][_0x7413('0x33')]);_0x646615[_0x7413('0x32')]=qs[_0x7413('0x32')](_0x5ecd20[_0x7413('0x46')]['offset']);}_0x646615['order']=qs['sort'](_0x5ecd20[_0x7413('0x46')]['sort']);_0x646615[_0x7413('0x4e')]=qs['filters'](_['pick'](_0x5ecd20[_0x7413('0x46')],_0x441c99[_0x7413('0x48')]));_0x646615[_0x7413('0x4e')]['ChatInteractionId']=_0x3e8312['id'];if(_0x5ecd20[_0x7413('0x46')][_0x7413('0x86')]){_0x646615['where']=_[_0x7413('0xfb')](_0x646615['where'],{'$or':_[_0x7413('0x3d')](_0x646615[_0x7413('0x4a')],function(_0x107c4d){var _0x6842db={};_0x6842db[_0x107c4d]={'$like':'%'+_0x5ecd20['query'][_0x7413('0x86')]+'%'};return _0x6842db;})});}_0x646615[_0x7413('0x4e')][_0x7413('0xe8')]=![];if(_0x5ecd20['query']['id']){_0x646615[_0x7413('0x4e')]['id']={'$gt':_0x5ecd20[_0x7413('0x46')]['id']};}_0x646615=_[_0x7413('0xfb')]({},_0x646615,_0x5ecd20[_0x7413('0xb4')]);return db[_0x7413('0xc2')]['count']({'where':_0x646615[_0x7413('0x4e')]})[_0x7413('0x25')](function(_0x3bbcf7){_0x39abc4[_0x7413('0x31')]=_0x3bbcf7;_0x646615[_0x7413('0xfe')]=[];if(_0x5ecd20['query'][_0x7413('0x101')]){_0x646615[_0x7413('0xfe')][_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':_0x7413('0x72'),'attributes':['id',_0x7413('0x3e'),_0x7413('0xe3')]});}if(_0x5ecd20[_0x7413('0x46')][_0x7413('0xb3')]){_0x646615[_0x7413('0xfe')]=[{'all':!![]}];}return db[_0x7413('0xc2')][_0x7413('0xff')](_0x646615);})['then'](function(_0x485eb){_0x39abc4['rows']=_0x485eb;return _0x39abc4;});}})['then'](respondWithFilteredResult(_0x27014c,_0x646615))[_0x7413('0x2d')](handleError(_0x27014c,null));};exports[_0x7413('0x102')]=function(_0x3a9de3,_0x2b3bcb,_0xb4ab49){return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x3a9de3[_0x7413('0xb2')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x2b3bcb,null))[_0x7413('0x25')](function(_0x4e1b22){if(_0x4e1b22){return _0x4e1b22[_0x7413('0x103')](_0x3a9de3[_0x7413('0x76')]['ids'],_[_0x7413('0xf8')](_0x3a9de3[_0x7413('0x76')],[_0x7413('0xf7'),'id'])||{})[_0x7413('0x104')](function(){return db['Tag'][_0x7413('0xff')]({'attributes':['id',_0x7413('0x3a'),_0x7413('0x105')],'where':{'id':_0x3a9de3[_0x7413('0x76')][_0x7413('0xf7')]}});})[_0x7413('0x25')](function(_0x212f65){socket['emit'](_0x7413('0x106'),{'id':Number(_0x3a9de3[_0x7413('0xb2')]['id']),'tags':_0x212f65||[]});return{'id':Number(_0x3a9de3['params']['id']),'tags':_0x212f65||[]};});}})['then'](respondWithResult(_0x2b3bcb,null))['catch'](handleError(_0x2b3bcb,null));};exports[_0x7413('0x107')]=function(_0x2c8a05,_0x28d2aa,_0x2c4d3e){return db[_0x7413('0x41')]['find']({'where':{'id':_0x2c8a05['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x28d2aa,null))[_0x7413('0x25')](function(_0x528175){if(_0x528175){return _0x528175[_0x7413('0x107')](_0x2c8a05[_0x7413('0x46')][_0x7413('0xf7')]);}})[_0x7413('0x25')](respondWithStatusCode(_0x28d2aa,null))['catch'](handleError(_0x28d2aa,null));};exports[_0x7413('0xd1')]=function(_0x253505,_0x1c1031){var _0x3741dd=moment()[_0x7413('0x108')]()['toString']();var _0x3bee58=path[_0x7413('0x109')](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x10b'),_0x7413('0x10c'));var _0x18972f=path['join'](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x10b'),_0x7413('0x10d'));var _0x1470df=path[_0x7413('0x109')](_0x3bee58,_0x3741dd);var _0x443536=util[_0x7413('0xd6')](_0x7413('0x10e'),_0x253505[_0x7413('0xb2')]['id'],_0x3741dd);var _0x3182f9=path[_0x7413('0x109')](_0x3bee58,_0x443536);var _0x35f619=[];_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0xda')],'as':_0x7413('0x66'),'attributes':['id',_0x7413('0x10f'),_0x7413('0x110')],'raw':!![]});if(_0x253505[_0x7413('0x46')][_0x7413('0x10d')]){_0x35f619[_0x7413('0xae')]({'model':db[_0x7413('0xcd')],'as':_0x7413('0xcd'),'raw':!![]});}var _0x23da62=[{'model':db[_0x7413('0xc2')],'as':_0x7413('0xd9'),'attributes':['id',_0x7413('0x76'),_0x7413('0xe5'),_0x7413('0xe7'),_0x7413('0xe8'),_0x7413('0x82')],'include':_0x35f619}];_0x23da62[_0x7413('0xae')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x7413('0x3a')]});_0x23da62[_0x7413('0xae')]({'model':db[_0x7413('0x72')],'as':_0x7413('0x111'),'attributes':['id',_0x7413('0x3e')]});return db[_0x7413('0x41')][_0x7413('0x61')]({'where':{'id':_0x253505[_0x7413('0xb2')]['id']},'include':_0x23da62})[_0x7413('0x25')](handleEntityNotFound(_0x1c1031,null))[_0x7413('0x25')](function(_0x28e623){if(_0x28e623){var _0x3551e8=_0x28e623[_0x7413('0x112')]({'plain':!![]});fs[_0x7413('0x113')](_0x1470df);var _0x37b7dc={'format':'A4','border':_0x7413('0x114'),'header':{'height':_0x7413('0x115'),'contents':{'first':_0x7413('0x116')}},'footer':{'height':_0x7413('0x117'),'contents':{'default':util[_0x7413('0xd6')](_0x7413('0x118'),util[_0x7413('0xd6')](_0x7413('0x119'),'Chat',_0x3551e8['id']),moment()[_0x7413('0xd6')](_0x7413('0x11a'))['toString']())}}};var _0x258061={'channel':_0x7413('0x11b'),'account':_0x3551e8[_0x7413('0x11c')][_0x7413('0x3a')],'agent':_0x3551e8[_0x7413('0x111')]?_0x3551e8['Owner']['fullname']:_0x7413('0x11d'),'createdAt':moment(_0x3551e8['createdAt'])[_0x7413('0xd6')](_0x7413('0xfd'))[_0x7413('0x99')](),'closedAt':_0x3551e8['closed']?moment(_0x3551e8['closedAt'])[_0x7413('0xd6')](_0x7413('0xfd'))[_0x7413('0x99')]():'','disposition':_0x3551e8[_0x7413('0xc8')],'chatInfo':{'browser':_0x3551e8['browserName'],'os':_0x3551e8['osName'],'referer':_0x3551e8[_0x7413('0x11e')],'customerIp':_0x3551e8[_0x7413('0x11f')],'customerPort':_0x3551e8['customerPort']?_0x3551e8['customerPort']:_0x7413('0x11d')},'messages':_(_0x3551e8[_0x7413('0xd9')])['tail']()['filter']({'secret':![]})[_0x7413('0x3d')](function(_0x2315cb){if(_0x2315cb[_0x7413('0xcd')]){var _0x3170ab=path[_0x7413('0x109')](_0x18972f,_0x2315cb['Attachment'][_0x7413('0xcb')]);if(fs[_0x7413('0x120')](_0x3170ab)){fs[_0x7413('0x121')](_0x3170ab)[_0x7413('0x122')](fs[_0x7413('0x123')](path['join'](_0x1470df,_0x2315cb[_0x7413('0xcd')][_0x7413('0xcb')])));}}return{'date':moment(_0x2315cb[_0x7413('0xe5')])[_0x7413('0xd6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2315cb[_0x7413('0xe7')]===_0x7413('0x124')?_0x2315cb[_0x7413('0x72')]?_0x2315cb[_0x7413('0x72')][_0x7413('0x3e')]:'System':_0x2315cb[_0x7413('0x66')]['firstName']+(_0x2315cb['Contact'][_0x7413('0x110')]?'\x20'+_0x2315cb['Contact'][_0x7413('0x110')]:''),'body':_0x2315cb[_0x7413('0xcd')]?_0x2315cb[_0x7413('0xcd')][_0x7413('0xcb')]:_0x2315cb[_0x7413('0x76')],'direction':_0x2315cb['direction']===_0x7413('0x124')?'A':'C','secret':_0x2315cb[_0x7413('0xe8')],'read':_0x2315cb[_0x7413('0x82')],'attachment':_0x2315cb[_0x7413('0xcd')]};})['value']()};return ejs[_0x7413('0x125')](path[_0x7413('0x109')](config[_0x7413('0xd2')],_0x7413('0x10a'),_0x7413('0x126'),_0x7413('0x127')),{'interaction':_0x258061})['then'](function(_0x45aa4f){return new BPromise(function(_0xab1a5d,_0x37a312){pdf[_0x7413('0xb5')](_0x45aa4f,_0x37b7dc)['toFile'](path[_0x7413('0x109')](_0x1470df,_0x7413('0x128')+_0x3551e8['id']+'-'+_0x3741dd+_0x7413('0x129')),function(_0x263c73,_0x1e6b24){if(_0x263c73)return _0x37a312(_0x263c73);_0xab1a5d(_0x1e6b24);});});})[_0x7413('0x25')](function(){return new BPromise(function(_0x4c59c5,_0x48fb07){zipdir(_0x1470df,{'saveTo':_0x3182f9},function(_0x303185,_0x510904){if(_0x303185)return _0x48fb07(_0x303185);return _0x4c59c5(_0x510904);});})[_0x7413('0x25')](function(){return new BPromise(function(_0x1efc10,_0x5a6d40){rimraf(_0x1470df,function(_0x180196){if(_0x180196)_0x5a6d40(_0x180196);return _0x1efc10();});});})[_0x7413('0x25')](function(){return _0x1c1031['download'](_0x3182f9,_0x443536,function(_0x5950d2){if(_0x5950d2){console[_0x7413('0x12a')](_0x7413('0x12b'),_0x5950d2);}else{fs['unlinkSync'](_0x3182f9);}});});});}else{return _0x1c1031[_0x7413('0x2e')](0xc8);}})[_0x7413('0x2d')](handleError(_0x1c1031,null));}; \ No newline at end of file +var _0x323f=['some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','rawAttributes','includeAll','include','merge','options','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','out','user','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','download','join','root','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','CmContact','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','service','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','alias','addTags','setTags','omit','spread','emit','removeTags','unix','tmp','server','transcript-%d-%s.zip','firstName','attachments','Account','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','lastName','renderFile','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','Contact','$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','ContactId','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','type'];(function(_0xb6bd60,_0x48e4a3){var _0x36d0dd=function(_0xc1356a){while(--_0xc1356a){_0xb6bd60['push'](_0xb6bd60['shift']());}};_0x36d0dd(++_0x48e4a3);}(_0x323f,0x1ee));var _0xf323=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x323f[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf323('0x1'));var jsonpatch=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var Mustache=require(_0xf323('0x6'));var util=require(_0xf323('0x7'));var path=require(_0xf323('0x8'));var sox=require(_0xf323('0x9'));var csv=require(_0xf323('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0xa'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf323('0x1b')]=_[_0xf323('0x1c')](config[_0xf323('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf323('0x1d'))(new Redis(config[_0xf323('0x1b')]));require(_0xf323('0x1e'))[_0xf323('0x1f')](socket);var jayson=require(_0xf323('0x20'));var client=jayson[_0xf323('0x21')]['http']({'port':0x232b});var client9004=jayson['client'][_0xf323('0x22')]({'port':0x232c});function checkPasswordPattern(_0x447517,_0x38fd4c,_0x3858ee){if(_0x3858ee){var _0x3db58a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3db58a['test'](_0x38fd4c)){return _0x447517;}else{throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0x25'));}}else{return _0x447517;}}function respondWithRpcPromise(_0x44671c,_0x49b115,_0x2db977,_0x272aec){return new BPromise(function(_0x1a459d,_0x41b2cb){var _0x5955ea=_0x272aec||client;return _0x5955ea[_0xf323('0x26')](_0x44671c,_0x2db977)[_0xf323('0x27')](function(_0x5baab2){logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));logger[_0xf323('0x2b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x49b115,_0xf323('0x2a'),JSON[_0xf323('0x2c')](_0x5baab2));if(_0x5baab2[_0xf323('0x2d')]){if(_0x5baab2['error'][_0xf323('0x2e')]===0x1f4){logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);return _0x41b2cb(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2['error'][_0xf323('0x2f')]);return _0x1a459d(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}else{logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));_0x1a459d(_0x5baab2['result'][_0xf323('0x2f')]);}})['catch'](function(_0x1570d4){logger[_0xf323('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x49b115,_0x1570d4);_0x41b2cb(_0x1570d4);});});}function respondWithStatusCode(_0x46663b,_0x3c95ce){_0x3c95ce=_0x3c95ce||0xcc;return function(_0x2b6254){if(_0x2b6254){return _0x46663b[_0xf323('0x30')](_0x3c95ce);}return _0x46663b[_0xf323('0x31')](_0x3c95ce)['end']();};}function respondWithResult(_0x44c944,_0x34b536){_0x34b536=_0x34b536||0xc8;return function(_0x12c7d5){if(_0x12c7d5){return _0x44c944[_0xf323('0x31')](_0x34b536)[_0xf323('0x32')](_0x12c7d5);}};}function respondWithFilteredResult(_0x36bd3f,_0x17cb4d){return function(_0x1723b7){if(_0x1723b7){var _0x139adc=_0x1723b7[_0xf323('0x33')],_0x52300b=_0x17cb4d[_0xf323('0x34')],_0x3f23cf=_0x17cb4d[_0xf323('0x34')]+_0x17cb4d['limit'],_0x15187c;if(_0x3f23cf>=_0x139adc){_0x3f23cf=_0x139adc;_0x15187c=0xc8;}else{_0x15187c=0xce;}_0x36bd3f[_0xf323('0x31')](_0x15187c);return _0x36bd3f[_0xf323('0x35')](_0xf323('0x36'),_0x52300b+'-'+_0x3f23cf+'/'+_0x139adc)[_0xf323('0x32')](_0x1723b7);}return null;};}function patchUpdates(_0x3c849a){return function(_0x485cbf){try{jsonpatch[_0xf323('0x37')](_0x485cbf,_0x3c849a,!![]);}catch(_0x1a0d27){return BPromise[_0xf323('0x38')](_0x1a0d27);}return _0x485cbf[_0xf323('0x39')]();};}function saveUpdates(_0x4fc6bd,_0x17b4e6){return function(_0x5658db){if(_0x5658db){return _0x5658db[_0xf323('0x3a')](_0x4fc6bd)[_0xf323('0x27')](function(_0x4ff3c1){return _0x4ff3c1;});}return null;};}function removeEntity(_0x3dcac7,_0x47ba23){return function(_0x3c6a07){if(_0x3c6a07){return _0x3c6a07['destroy']()[_0xf323('0x27')](function(){_0x3dcac7['status'](0xcc)[_0xf323('0x3b')]();});}};}function handleEntityNotFound(_0x82a6ca,_0x4e0e51){return function(_0x4964a5){if(!_0x4964a5){_0x82a6ca['sendStatus'](0x194);}return _0x4964a5;};}function handleError(_0x8b24f2,_0x277a6c){_0x277a6c=_0x277a6c||0x1f4;return function(_0x79e636){logger[_0xf323('0x2d')](_0x79e636[_0xf323('0x3c')]);if(_0x79e636['name']){delete _0x79e636['name'];}_0x8b24f2['status'](_0x277a6c)[_0xf323('0x3d')](_0x79e636);};}function getInteractionUsers(_0x59fee2,_0x11d564){return new BPromise(function(_0x47e7a2,_0x431bc){try{if(_0x11d564[_0x59fee2['id']]){_0x59fee2[_0xf323('0x3e')]=_[_0xf323('0x3f')](_0x11d564[_0x59fee2['id']],function(_0x325fa9){return{'id':_0x325fa9['id'],'fullname':_0x325fa9[_0xf323('0x40')]};});}}catch(_0x48a6c4){_0x431bc(_0x48a6c4);}_0x47e7a2(_0x59fee2);});}function getInteractionTags(_0x3d8ddb,_0x3bbe02){return new BPromise(function(_0x408b66,_0x27ddcc){try{if(_0x3d8ddb[_0xf323('0x41')]){_0x3d8ddb[_0xf323('0x42')]=[];_0x3d8ddb[_0xf323('0x41')][_0xf323('0x43')](',')[_0xf323('0x44')](function(_0x13b8cb){_0x3d8ddb[_0xf323('0x42')][_0xf323('0x45')](_0x3bbe02[_0x13b8cb]);});}delete _0x3d8ddb[_0xf323('0x41')];}catch(_0x388d80){_0x27ddcc(_0x388d80);}_0x408b66(_0x3d8ddb);});}function updateChatInteraction(_0x2c89dd,_0x33b1b2,_0x5bb658){return new BPromise(function(_0x502114,_0x1818c4){return getInteractionUsers(_0x2c89dd,_0x5bb658)[_0xf323('0x27')](function(_0x2864f7){return getInteractionTags(_0x2864f7,_0x33b1b2);})[_0xf323('0x27')](function(_0xd9c79d){_0x502114(_0xd9c79d);})[_0xf323('0x46')](function(_0x2746e3){_0x1818c4(_0x2746e3);});});}exports[_0xf323('0x47')]=function(_0x1c0136,_0x320592){var _0x2c0854={},_0x247149={},_0x121599={'count':0x0,'rows':[]};var _0x48d4df=_[_0xf323('0x3f')](db['ChatInteraction']['rawAttributes'],function(_0x410792){return{'name':_0x410792['fieldName'],'type':_0x410792['type'][_0xf323('0x48')]};});_0x247149[_0xf323('0x49')]=_[_0xf323('0x3f')](_0x48d4df,_0xf323('0x4a'));_0x247149[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x1c0136[_0xf323('0x4b')]);_0x247149[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x247149[_0xf323('0x49')],_0x247149[_0xf323('0x4b')]);_0x2c0854['attributes']=_[_0xf323('0x4e')](_0x247149['model'],qs[_0xf323('0x4f')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2c0854[_0xf323('0x50')]=_0x2c0854['attributes']['length']?_0x2c0854[_0xf323('0x50')]:_0x247149['model'];if(!_0x1c0136[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2c0854[_0xf323('0x52')]=qs['limit'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x52')]);_0x2c0854[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2c0854[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x54')]);_0x2c0854[_0xf323('0x55')]=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x1c0136['query'],_0x247149[_0xf323('0x4d')]),_0x48d4df);var _0x18ad3e=[];var _0x27b191=squel[_0xf323('0x57')]()[_0xf323('0x58')]('id')[_0xf323('0x58')]('name')[_0xf323('0x58')](_0xf323('0x59'))['from'](_0xf323('0x5a'));var _0x2909cf=squel['select']()['field'](_0xf323('0x5b'))[_0xf323('0x58')](_0xf323('0x5c'))[_0xf323('0x58')](_0xf323('0x5d'))[_0xf323('0x5e')](_0xf323('0x5f'),'ui')[_0xf323('0x60')]('users','u',_0xf323('0x61'));var _0x198a2b=squel[_0xf323('0x57')]()[_0xf323('0x5e')](_0xf323('0x62'),'i')[_0xf323('0x60')](_0xf323('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf323('0x60')](_0xf323('0x64'),'o',_0xf323('0x65'))[_0xf323('0x60')](_0xf323('0x66'),'a',_0xf323('0x67'))[_0xf323('0x60')](_0xf323('0x68'),'me',_0xf323('0x69'))['left_join'](_0xf323('0x6a'),'it',_0xf323('0x6b'))[_0xf323('0x60')]('tools_tags','t',_0xf323('0x6c'));var _0x2ad9d4=squel['expr']();var _0x2506fd=[];var _0x475f95=squel['expr']();var _0xee9a9;if(_0x1c0136[_0xf323('0x4b')]['search']){_0xee9a9=as[_0xf323('0x6d')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x6e')]);var _0x2db2b1=_0xee9a9[_0xf323('0x6f')];for(var _0x291e36=0x0;_0x291e36<_0xee9a9[_0xf323('0x70')][_0xf323('0x71')];_0x291e36++){var _0x2b164b=_0xee9a9['conditions'][_0x291e36];var _0xd1902b='i';var _0x31942f=_['find'](_0x48d4df,[_0xf323('0x4a'),_0x2b164b[_0xf323('0x58')]]);if(!_0x31942f){switch(_0x2b164b['field']){case _0xf323('0x72'):if(_0x2b164b[_0xf323('0x73')]==0x1){_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+'`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+_0xf323('0x75'));}break;case _0xf323('0x76'):if(_0x2b164b['operator']===_0xf323('0x77')){if(_0x2b164b[_0xf323('0x73')][_0xf323('0x43')]('\x20')[_0xf323('0x71')]>0x1){_0x2ad9d4[_0x2db2b1](_0xf323('0x78'),qs[_0xf323('0x79')](_0x2b164b[_0xf323('0x73')]),null);}else{var _0x1a91c8='%'+_0x2b164b[_0xf323('0x73')]+'%';_0x2ad9d4[_0x2db2b1](_0xf323('0x7a'),_0x1a91c8,_0x1a91c8,_0x1a91c8);}}else{_0x31942f=_[_0xf323('0x7b')](_0x48d4df,[_0xf323('0x4a'),_0xf323('0x7c')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x7c');_0x53b408=as['buildExpression'](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}break;case _0xf323('0x7f'):var _0x550a6a=_0x2b164b[_0xf323('0x73')][_0xf323('0x43')](',')[_0xf323('0x3f')](function(_0x3add7c){return Number(_0x3add7c);});_0x550a6a['forEach'](function(_0x5e0382){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x5e0382+',%');});_0x2506fd=_[_0xf323('0x81')](_0x2506fd,_0x550a6a);break;case _0xf323('0x82'):if(_0x2b164b[_0xf323('0x83')]===_0xf323('0x77')){_0x2ad9d4[_0x2db2b1](_0xf323('0x84'),'%'+_0x2b164b[_0xf323('0x73')]+'%',null);}else{_0x31942f=_['find'](_0x48d4df,['name',_0xf323('0x85')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x85');_0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f[_0xf323('0x87')],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')]['end']);}break;case'body':_0x53b408=as[_0xf323('0x86')]('me',null,_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);break;}}else{var _0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408['text'],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}}}else{var _0x258e1a=_(_0x1c0136['query'])[_0xf323('0x4c')]()[_0xf323('0x3f')](function(_0x27a406){return _[_0xf323('0x88')](_0x48d4df,['name',_0x27a406])?_0x27a406:undefined;})[_0xf323('0x89')]()[_0xf323('0x73')]();if(!_[_0xf323('0x8a')](_0x258e1a)){_0x258e1a[_0xf323('0x44')](function(_0x4b8408){if(_0x4b8408===_0xf323('0x8b')){_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),[][_0xf323('0x8d')](_0x1c0136['query'][_0x4b8408]));}else if(_0x4b8408===_0xf323('0x8e')){var _0x36e7b9=JSON[_0xf323('0x8f')](_0x1c0136['query'][_0x4b8408])['$gte'];var _0x391ebe=JSON['parse'](_0x1c0136[_0xf323('0x4b')][_0x4b8408])[_0xf323('0x90')];_0x198a2b[_0xf323('0x55')](_0xf323('0x91'),_0x36e7b9,_0x391ebe);}else{if(_0x1c0136['query'][_0x4b8408]===_0xf323('0x92')){_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x93'));}else{_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x94'),_0x1c0136['query'][_0x4b8408]);}}});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]){if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]==0x1){_0x198a2b['having']('`unreadMessages`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')](_0xf323('0x96'));}}if(_0x1c0136['query'][_0xf323('0x97')]){_0x2506fd=_['isArray'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')])?_0x1c0136[_0xf323('0x4b')]['tag']:new Array(_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')]);_0x2506fd['forEach'](function(_0x1400fe){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x1400fe+',%');});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x98')]){var _0x249639=_0x1c0136['query'][_0xf323('0x98')][_0xf323('0x99')]('\x5c','\x5c\x5c')[_0xf323('0x99')]('\x27\x27',_0xf323('0x9a'));if(qs[_0xf323('0x9b')](_0x249639)){_0x2ad9d4['or']('i.id\x20LIKE\x20?',_0x249639+'%');}else{_0x2ad9d4['or'](_0xf323('0x9c'),qs['getFullTextValue'](_0x249639))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x249639+'%');}}}_0x198a2b['where'](_0x2ad9d4);_0x198a2b[_0xf323('0x9d')](_0xf323('0x9e'));var _0x2604a3={'type':db['Sequelize'][_0xf323('0x9f')][_0xf323('0xa0')],'raw':!![]};var _0x4d3478=_0x198a2b[_0xf323('0xa1')]();_0x4d3478[_0xf323('0x58')](_0xf323('0x9e'));_0x4d3478[_0xf323('0x58')](_0xf323('0xa2'),_0xf323('0x72'));if(_0x2c0854[_0xf323('0x53')]){_0x2c0854[_0xf323('0x53')]['forEach'](function(_0x31da2b){_0x198a2b[_0xf323('0x53')]('i.'+_0x31da2b[0x0],_0x31da2b[0x1]===_0xf323('0xa3')?![]:!![]);});}if(!_['isEmpty'](_0x2506fd)){_0x198a2b['having'](_0x475f95);_0x4d3478[_0xf323('0x55')](_0xf323('0xa4'),_0x2506fd);}BPromise[_0xf323('0xa5')]()[_0xf323('0x27')](function(){if(!_0xee9a9){if(_0x1c0136[_0xf323('0x4b')]['ChatWebsiteId']||_0x1c0136['query'][_0xf323('0xa6')])return;_0x4d3478[_0xf323('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x198a2b[_0xf323('0x55')](_0xf323('0xa7'));return;}return _0x1c0136['user'][_0xf323('0xa8')]({'attributes':['id'],'raw':!![]})[_0xf323('0x27')](function(_0x13d2ef){if(_[_0xf323('0x8a')](_0x13d2ef)){_0x4d3478['where'](_0xf323('0xa9'));_0x198a2b[_0xf323('0x55')](_0xf323('0xa9'));}else{_0x4d3478[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));}});})['then'](function(){db[_0xf323('0xaa')][_0xf323('0x4b')](_0x4d3478[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x478491){_0x121599[_0xf323('0x33')]=_0x478491['length'];if(_0x121599['count']===0x0)return[];return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x27b191[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x587a21){_0x18ad3e=_[_0xf323('0xac')](_0x587a21,'id');_0x2604a3=_['merge'](_0x2604a3,{'model':db[_0xf323('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]){_0x2c0854[_0xf323('0x50')]['forEach'](function(_0x18528a){_0x198a2b['field']('i.'+_0x18528a);});}else{_0x198a2b[_0xf323('0x58')](_0xf323('0xa2'),'unreadMessages');_0x198a2b[_0xf323('0x58')](_0xf323('0xae'),'Account.key');_0x198a2b[_0xf323('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x198a2b['field'](_0xf323('0xaf'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb0'),_0xf323('0xb1'));_0x198a2b[_0xf323('0x58')]('c.lastName',_0xf323('0xb2'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb3'),_0xf323('0xb4'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb5'),_0xf323('0xb6'));_0x198a2b[_0xf323('0x58')]('c.mobile',_0xf323('0xb7'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb8'),'Contact.fax');_0x198a2b['field']('o.fullname',_0xf323('0xb9'));_0x198a2b[_0xf323('0x58')](_0xf323('0xba'),_0xf323('0xbb'));_0x198a2b[_0xf323('0x58')](_0xf323('0xbc'),_0xf323('0x41'));}if(_0x2c0854[_0xf323('0x52')])_0x198a2b['limit'](_0x2c0854[_0xf323('0x52')]);if(_0x2c0854[_0xf323('0x34')])_0x198a2b[_0xf323('0x34')](_0x2c0854[_0xf323('0x34')]);return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x198a2b[_0xf323('0xab')](),_0x2604a3);})[_0xf323('0x27')](function(_0x44dffe){_0x2909cf['where'](_0xf323('0xbd'),_[_0xf323('0x3f')](_0x44dffe,'id'));return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x2909cf[_0xf323('0xab')](),_0x2604a3)[_0xf323('0x27')](function(_0x46c286){var _0x55bfa8=_[_0xf323('0xbe')](_0x46c286,_0xf323('0xbf'));var _0x1e79af=[];_0x44dffe[_0xf323('0x44')](function(_0x1ef7ba){_0x1e79af[_0xf323('0x45')](updateChatInteraction(_0x1ef7ba,_0x18ad3e,_0x55bfa8));});return BPromise[_0xf323('0xc0')](_0x1e79af);});});})[_0xf323('0x27')](function(_0x59283f){_0x121599['rows']=_0x59283f;return _0x121599;})[_0xf323('0x27')](respondWithFilteredResult(_0x320592,_0x2c0854));})[_0xf323('0x46')](handleError(_0x320592,null));};exports[_0xf323('0xc1')]=function(_0x1d534f,_0x4914da){var _0x53c9c5={'raw':![],'where':{'id':_0x1d534f[_0xf323('0xc2')]['id']}},_0x34003e={};_0x34003e[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xad')][_0xf323('0xc3')]);_0x34003e[_0xf323('0x4b')]=_['keys'](_0x1d534f['query']);_0x34003e['filters']=_['intersection'](_0x34003e[_0xf323('0x49')],_0x34003e['query']);_0x53c9c5[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x34003e[_0xf323('0x49')],qs[_0xf323('0x4f')](_0x1d534f[_0xf323('0x4b')]['fields']));_0x53c9c5[_0xf323('0x50')]=_0x53c9c5[_0xf323('0x50')]['length']?_0x53c9c5['attributes']:_0x34003e[_0xf323('0x49')];if(_0x1d534f[_0xf323('0x4b')][_0xf323('0xc4')]){_0x53c9c5[_0xf323('0xc5')]=[{'all':!![]}];}_0x53c9c5=_[_0xf323('0xc6')]({},_0x53c9c5,_0x1d534f[_0xf323('0xc7')]);return db[_0xf323('0xad')][_0xf323('0x7b')](_0x53c9c5)['then'](handleEntityNotFound(_0x4914da,null))['then'](respondWithResult(_0x4914da,null))[_0xf323('0x46')](handleError(_0x4914da,null));};exports[_0xf323('0xc8')]=function(_0x2dffc1,_0x4ab7cb){return db[_0xf323('0xad')]['create'](_0x2dffc1['body'],{})[_0xf323('0x27')](respondWithResult(_0x4ab7cb,0xc9))[_0xf323('0x46')](handleError(_0x4ab7cb,null));};exports[_0xf323('0x3a')]=function(_0x225fc9,_0x47b370){if(_0x225fc9[_0xf323('0xc9')]['id']){delete _0x225fc9[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x225fc9[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x47b370,null))['then'](saveUpdates(_0x225fc9[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x47b370,null))[_0xf323('0x46')](handleError(_0x47b370,null));};exports[_0xf323('0xca')]=function(_0x3bd242,_0x208860){return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x3bd242[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x208860,null))[_0xf323('0x27')](removeEntity(_0x208860,null))[_0xf323('0x46')](handleError(_0x208860,null));};exports[_0xf323('0xcb')]=function(_0xcf3ca1,_0x2f99d9){return db['ChatInteraction'][_0xf323('0xcb')]()[_0xf323('0x27')](respondWithResult(_0x2f99d9,null))[_0xf323('0x46')](handleError(_0x2f99d9,null));};exports[_0xf323('0xcc')]=function(_0xd5d557,_0x2409c9){var _0x297107=_0xd5d557[_0xf323('0xc2')]['id'];var _0x57162c;var _0x2b75c4;var _0x23ec08;return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x297107}})[_0xf323('0x27')](function(_0x1f1e6d){_0x57162c=_0x1f1e6d;return db[_0xf323('0xce')][_0xf323('0xcd')]({'where':{'id':_0x1f1e6d[_0xf323('0x8b')]},'attributes':['id',_0xf323('0xcf'),'vidaooEscalation'],'raw':!![]});})[_0xf323('0x27')](function(_0x34d500){if(_0x34d500&&_0x34d500['vidaooApiKey']&&_0x34d500[_0xf323('0xd0')]){_0x2b75c4=_0x34d500;var _0x2a75dc={'rejectUnauthorized':![],'method':_0xf323('0xd1'),'uri':_0xf323('0xd2'),'headers':{'X-APIKEY':_0x34d500[_0xf323('0xcf')]},'body':{'name':_0xf323('0xd3')+_0x297107},'redirect':'follow','json':!![]};return rp(_0x2a75dc);}else{throw new db['Sequelize']['ValidationError'](_0xf323('0xd4'));}})[_0xf323('0x27')](function(_0x5f72f4){_0x23ec08=_0x5f72f4;if(_0x23ec08['id']){var _0x29206f={'body':_0x23ec08['join_url'],'ChatWebsiteId':_0x2b75c4['id'],'ChatInteractionId':_0x57162c['id'],'direction':_0xf323('0xd5'),'UserId':_0xd5d557[_0xf323('0xd6')]['id']};return db['ChatMessage'][_0xf323('0xc8')](_0x29206f,{});}else{throw new db[(_0xf323('0x23'))]['ValidationError'](_0xf323('0xd7'));}})[_0xf323('0x27')](function(){return _0x57162c[_0xf323('0xd8')]({'vidaooSessionId':_0x23ec08['id']});})[_0xf323('0x27')](respondWithResult(_0x2409c9,null))['catch'](handleError(_0x2409c9,null));};exports[_0xf323('0xd9')]=function(_0x33eaec,_0x44c50){if(_0x33eaec[_0xf323('0xc9')]['id']){delete _0x33eaec[_0xf323('0xc9')]['id'];}return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x33eaec[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x44c50,null))[_0xf323('0x27')](saveUpdates(_0x33eaec[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x44c50,null))[_0xf323('0x46')](handleError(_0x44c50,null));};exports['abandon']=function(_0x45368e,_0x32824f,_0x38c95a){if(_0x45368e[_0xf323('0xc9')]['id']){delete _0x45368e[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')]['find']({'where':{'id':_0x45368e[_0xf323('0xc2')]['id']}})['then'](function(_0x3c82b5){if(!_0x3c82b5){logger[_0xf323('0x2d')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf323('0xda'),0x194,_0xf323('0xdb'));_0x32824f['sendStatus'](0x194);}else{if(_0x3c82b5['UserId']){throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0xdc'));}}return _0x3c82b5;})[_0xf323('0x27')](function(_0x43db55){if(_0x43db55){return _0x43db55[_0xf323('0x3a')]({'closed':_0x45368e[_0xf323('0xc9')][_0xf323('0xdd')],'disposition':_0x45368e[_0xf323('0xc9')][_0xf323('0xde')]})['then'](function(_0x192e61){return _0x192e61;});}})[_0xf323('0x27')](function(_0x5487b0){return respondWithRpcPromise(_0xf323('0xdf'),'abandon',_0x45368e[_0xf323('0xc9')],client9004);})[_0xf323('0x27')](respondWithResult(_0x32824f,null))[_0xf323('0x46')](handleError(_0x32824f,null));};exports[_0xf323('0xe0')]=function(_0xaf34a7,_0x4316ba,_0x43d6e6){_0xaf34a7[_0xf323('0xc9')][_0xf323('0x4a')]=_0xaf34a7['file'][_0xf323('0xe1')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0xe2')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe4')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0x87')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe5')];return db[_0xf323('0xe6')][_0xf323('0xc8')](_0xaf34a7['body'])['then'](respondWithResult(_0x4316ba,0xc9))[_0xf323('0x46')](handleError(_0x4316ba,null));};exports[_0xf323('0xe7')]=function(_0x66b6c5,_0x21d723,_0x56e3e0){return db['ChatInteraction']['findOne']({'where':{'id':_0x66b6c5['params']['id']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null))[_0xf323('0x27')](function(_0x310050){if(_0x310050){if(_0x310050[_0xf323('0xdd')]){return _0x21d723[_0xf323('0x31')](0x193)[_0xf323('0x32')]({'status':0x193,'message':'Unauthorized'});}return db[_0xf323('0xe6')][_0xf323('0xcd')]({'where':{'id':_0x66b6c5['query']['attachId']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null));}})[_0xf323('0x27')](function(_0x3ef481){if(_0x3ef481){return _0x21d723[_0xf323('0xe8')](path[_0xf323('0xe9')](config[_0xf323('0xea')],'server/files/attachments/',_0x3ef481[_0xf323('0xe2')]));}})['catch'](handleError(_0x21d723,null));};exports['close']=function(_0x1123cc,_0x133040){var _0x34fac4=null;var _0x159080=null;var _0x34c2a2=null;var _0x48bc44=null;if(_0x1123cc[_0xf323('0xc9')]['id']){delete _0x1123cc[_0xf323('0xc9')]['id'];}if(_0x1123cc['body'][_0xf323('0xeb')]){_0x48bc44=path['join'](config['root'],_0xf323('0xec'),util['format'](_0xf323('0xed'),Date[_0xf323('0xee')]()));_0x1123cc[_0xf323('0xc9')]['pathTranscript']=_0x48bc44;}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x1123cc['params']['id']},'include':[{'model':db[_0xf323('0xef')],'as':'Messages','include':[{'model':db[_0xf323('0x82')],'as':_0xf323('0x82')}]}]})[_0xf323('0x27')](handleEntityNotFound(_0x133040,null))[_0xf323('0x27')](saveUpdates(_0x1123cc[_0xf323('0xc9')],null))[_0xf323('0x27')](function(_0x222b46){if(_0x222b46){_0x34fac4=_0x222b46;return db[_0xf323('0xce')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ChatWebsiteId']}});}})[_0xf323('0x27')](function(_0x2a005b){if(_0x2a005b){_0x34c2a2=_0x2a005b;return db[_0xf323('0xf0')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ContactId']}});}})[_0xf323('0x27')](function(_0x3665f3){if(_0x3665f3){_0x159080=_0x3665f3;if(_0x48bc44){var _0x2b5870=null;for(var _0x304899=0x1;_0x304899<_0x34fac4['Messages'][_0xf323('0x71')];++_0x304899){_0x2b5870=_0x34fac4[_0xf323('0xf1')][_0x304899];var _0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');var _0x3a6587=_0x1123cc[_0xf323('0xc9')][_0xf323('0xf6')]||util['format'](_0xf323('0xf3'),_0xf323('0xf7'),_0x2b5870[_0xf323('0x7c')]);switch(_0x34c2a2[_0xf323('0xf8')]){case'website_alias':_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2['agentAlias'],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');break;case _0xf323('0xf9'):_0x2309d1=_0x2b5870['UserId']?_0x2b5870[_0xf323('0x82')]['alias']||_0x2b5870[_0xf323('0x82')][_0xf323('0x40')]:_0xf323('0xf5');break;case _0xf323('0xfa'):_0x2309d1=_0x2b5870[_0xf323('0x85')]?_0x2b5870[_0xf323('0x82')]['fullname']:_0xf323('0xf5');break;default:_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');}var _0x5af161=util[_0xf323('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2b5870[_0xf323('0x8e')])[_0xf323('0xf2')](_0xf323('0xfb')),_0x2b5870[_0xf323('0xfc')]==='in'?_0x3a6587:_0x2309d1,_0x2b5870[_0xf323('0xc9')]);if(!_0x2b5870[_0xf323('0xfd')]){fs[_0xf323('0xfe')](_0x48bc44,_0x5af161);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf323('0xff'),'raw':!![]}]});}}})[_0xf323('0x27')](function(_0x25bd4d){if(_0x25bd4d&&_0x25bd4d['Smtp']&&_0x1123cc['body']){var _0x1836a5={'tls':{'rejectUnauthorized':![]}};if(_0x25bd4d['Smtp'][_0xf323('0x100')]){_0x1836a5[_0xf323('0x100')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x100')];}else{_0x1836a5[_0xf323('0x101')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x101')];_0x1836a5[_0xf323('0x102')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x102')];_0x1836a5[_0xf323('0x103')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x103')];}if(_0x25bd4d[_0xf323('0xff')][_0xf323('0x104')]){_0x1836a5[_0xf323('0x105')]={'user':_0x25bd4d['Smtp'][_0xf323('0xd6')],'pass':_0x25bd4d[_0xf323('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf323('0x106'),{'account':_0x1836a5,'message':{'from':util['format'](_0xf323('0x107'),_0x25bd4d[_0xf323('0x4a')],_0x25bd4d['email']||_0x25bd4d[_0xf323('0xff')][_0xf323('0xd6')]),'to':_0x1123cc[_0xf323('0xc9')]['mailTranscript'],'subject':_0xf323('0x108'),'text':util['format'](_0xf323('0x109'),_0x1123cc[_0xf323('0xc9')][_0xf323('0xeb')]),'attachments':[{'path':_0x48bc44}]}})[_0xf323('0x27')](function(){return _0x34fac4;})[_0xf323('0x46')](function(_0x4068d7){console[_0xf323('0x2d')](_0x4068d7);});}else{return _0x34fac4;}})['then'](respondWithStatusCode(_0x133040,0xc8))[_0xf323('0x46')](handleError(_0x133040,null));};exports[_0xf323('0x10a')]=function(_0x1c5bcf,_0x406bd6,_0x28d50f){return db[_0xf323('0xef')]['find']({'where':{'id':_0x1c5bcf[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x406bd6,null))[_0xf323('0x27')](function(_0x305680){if(_0x305680){return _0x305680['addMessage'](_0x1c5bcf[_0xf323('0xc9')][_0xf323('0x10b')],_['omit'](_0x1c5bcf['body'],['ids','id'])||{});}})[_0xf323('0x27')](respondWithResult(_0x406bd6,null))[_0xf323('0x46')](handleError(_0x406bd6,null));};exports[_0xf323('0x10c')]=function(_0x2adc91,_0x51fc4f,_0x1e8abd){var _0x1f80af={'raw':![],'where':{}};var _0x92a2ff={};var _0x51b00e={'count':0x0,'rows':[]};return db[_0xf323('0xad')]['findOne']({'where':{'id':_0x2adc91[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x51fc4f,null))['then'](function(_0x3e9e09){if(_0x3e9e09){_0x92a2ff[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')][_0xf323('0xc3')]);_0x92a2ff[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x2adc91[_0xf323('0x4b')]);_0x92a2ff[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],_0x92a2ff[_0xf323('0x4b')]);_0x1f80af[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],qs['fields'](_0x2adc91['query'][_0xf323('0x4f')]));_0x1f80af[_0xf323('0x50')]=_0x1f80af['attributes'][_0xf323('0x71')]?_0x1f80af['attributes']:_0x92a2ff[_0xf323('0x49')];if(!_0x2adc91['query'][_0xf323('0x10d')](_0xf323('0x51'))){_0x1f80af['limit']=qs[_0xf323('0x52')](_0x2adc91[_0xf323('0x4b')]['limit']);_0x1f80af['offset']=qs[_0xf323('0x34')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x34')]);}_0x1f80af[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x54')]);_0x1f80af['where']=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x2adc91[_0xf323('0x4b')],_0x92a2ff[_0xf323('0x4d')]));_0x1f80af[_0xf323('0x55')][_0xf323('0xbf')]=_0x3e9e09['id'];if(_0x2adc91['query'][_0xf323('0x98')]){_0x1f80af[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x1f80af[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x1f80af[_0xf323('0x50')],function(_0x60a04b){var _0x1cfee7={};_0x1cfee7[_0x60a04b]={'$like':'%'+_0x2adc91[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x1cfee7;})});}if(_0x2adc91[_0xf323('0x4b')][_0xf323('0x10e')]){var _0x475de5=_0x2adc91['query'][_0xf323('0x10e')][_0xf323('0x43')](',');var _0x4c8e1c={};_0x4c8e1c[_0x475de5[0x0]]={'$gte':moment(_0x475de5[0x1])[_0xf323('0xf2')](_0xf323('0x10f'))};_0x1f80af[_0xf323('0x55')]=_['merge'](_0x1f80af[_0xf323('0x55')],_0x4c8e1c);}_0x1f80af=_[_0xf323('0xc6')]({},_0x1f80af,_0x2adc91[_0xf323('0xc7')]);return db[_0xf323('0xef')][_0xf323('0x33')]({'where':_0x1f80af['where']})[_0xf323('0x27')](function(_0x52bcaf){_0x51b00e[_0xf323('0x33')]=_0x52bcaf;if(_0x2adc91[_0xf323('0x4b')][_0xf323('0xc4')]){_0x1f80af['include']=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x1f80af);})[_0xf323('0x27')](function(_0x52ffbe){_0x51b00e[_0xf323('0x111')]=_0x52ffbe;return _0x51b00e;});}})['then'](respondWithFilteredResult(_0x51fc4f,_0x1f80af))['catch'](handleError(_0x51fc4f,null));};exports[_0xf323('0x112')]=function(_0x278588,_0x5a36ae,_0x36992a){var _0x2ca568={'where':{}},_0x3a0fa5={},_0x5e6d69={'count':0x0,'rows':[]};return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x278588['params']['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x5a36ae,null))['then'](function(_0x5aec46){if(_0x5aec46){_0x3a0fa5[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')]['rawAttributes']);_0x3a0fa5[_0xf323('0x4b')]=_['keys'](_0x278588[_0xf323('0x4b')]);_0x3a0fa5[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x3a0fa5['model'],_0x3a0fa5[_0xf323('0x4b')]);_0x2ca568['attributes']=_['intersection'](_0x3a0fa5['model'],qs[_0xf323('0x4f')](_0x278588[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2ca568['attributes']=_0x2ca568['attributes'][_0xf323('0x71')]?_0x2ca568['attributes']:_0x3a0fa5['model'];if(!_0x278588[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2ca568[_0xf323('0x52')]=qs[_0xf323('0x52')](_0x278588[_0xf323('0x4b')][_0xf323('0x52')]);_0x2ca568[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x278588[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2ca568['order']=qs[_0xf323('0x54')](_0x278588[_0xf323('0x4b')]['sort']);_0x2ca568[_0xf323('0x55')]=qs[_0xf323('0x4d')](_['pick'](_0x278588[_0xf323('0x4b')],_0x3a0fa5[_0xf323('0x4d')]));_0x2ca568[_0xf323('0x55')][_0xf323('0xbf')]=_0x5aec46['id'];if(_0x278588[_0xf323('0x4b')][_0xf323('0x98')]){_0x2ca568[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x2ca568[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x2ca568[_0xf323('0x50')],function(_0x28ac5d){var _0x4273c3={};_0x4273c3[_0x28ac5d]={'$like':'%'+_0x278588[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x4273c3;})});}_0x2ca568[_0xf323('0x55')][_0xf323('0xfd')]=![];if(_0x278588[_0xf323('0x4b')]['id']){_0x2ca568[_0xf323('0x55')]['id']={'$gt':_0x278588[_0xf323('0x4b')]['id']};}_0x2ca568=_['merge']({},_0x2ca568,_0x278588['options']);return db['ChatMessage'][_0xf323('0x33')]({'where':_0x2ca568['where']})[_0xf323('0x27')](function(_0x2d9822){_0x5e6d69[_0xf323('0x33')]=_0x2d9822;_0x2ca568[_0xf323('0xc5')]=[];if(_0x278588[_0xf323('0x4b')][_0xf323('0x113')]){_0x2ca568[_0xf323('0xc5')]['push']({'model':db[_0xf323('0x82')],'as':'User','attributes':['id',_0xf323('0x40'),_0xf323('0x114')]});}if(_0x278588['query'][_0xf323('0xc4')]){_0x2ca568[_0xf323('0xc5')]=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x2ca568);})[_0xf323('0x27')](function(_0xeb3641){_0x5e6d69[_0xf323('0x111')]=_0xeb3641;return _0x5e6d69;});}})[_0xf323('0x27')](respondWithFilteredResult(_0x5a36ae,_0x2ca568))[_0xf323('0x46')](handleError(_0x5a36ae,null));};exports[_0xf323('0x115')]=function(_0x1ea2bc,_0x2bc841,_0xede2f5){return db[_0xf323('0xad')]['find']({'where':{'id':_0x1ea2bc[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x2bc841,null))[_0xf323('0x27')](function(_0x4685aa){if(_0x4685aa){return _0x4685aa[_0xf323('0x116')](_0x1ea2bc['body'][_0xf323('0x10b')],_[_0xf323('0x117')](_0x1ea2bc[_0xf323('0xc9')],[_0xf323('0x10b'),'id'])||{})[_0xf323('0x118')](function(){return db[_0xf323('0x7f')]['findAll']({'attributes':['id',_0xf323('0x4a'),_0xf323('0x59')],'where':{'id':_0x1ea2bc[_0xf323('0xc9')][_0xf323('0x10b')]}});})[_0xf323('0x27')](function(_0x22c859){socket[_0xf323('0x119')]('chatInteractionTags:save',{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]});return{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]};});}})[_0xf323('0x27')](respondWithResult(_0x2bc841,null))['catch'](handleError(_0x2bc841,null));};exports[_0xf323('0x11a')]=function(_0x5d1897,_0x46a215,_0x2c0eb0){return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x5d1897[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x46a215,null))[_0xf323('0x27')](function(_0x158624){if(_0x158624){return _0x158624[_0xf323('0x11a')](_0x5d1897[_0xf323('0x4b')][_0xf323('0x10b')]);}})['then'](respondWithStatusCode(_0x46a215,null))[_0xf323('0x46')](handleError(_0x46a215,null));};exports[_0xf323('0xe8')]=function(_0x32d6e6,_0x4902ad){var _0x110c46=moment()[_0xf323('0x11b')]()[_0xf323('0xab')]();var _0x45f6ea=path['join'](config['root'],'server','files',_0xf323('0x11c'));var _0xd80f1a=path[_0xf323('0xe9')](config['root'],_0xf323('0x11d'),'files','attachments');var _0x4125c2=path[_0xf323('0xe9')](_0x45f6ea,_0x110c46);var _0x2940da=util[_0xf323('0xf2')](_0xf323('0x11e'),_0x32d6e6['params']['id'],_0x110c46);var _0x5dc95e=path['join'](_0x45f6ea,_0x2940da);var _0x4ce60a=[];_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0x82')],'as':_0xf323('0x82'),'attributes':['id','fullname'],'raw':!![]});_0x4ce60a['push']({'model':db[_0xf323('0xf0')],'as':_0xf323('0x76'),'attributes':['id',_0xf323('0x11f'),'lastName'],'raw':!![]});if(_0x32d6e6[_0xf323('0x4b')][_0xf323('0x120')]){_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0xe6')],'as':_0xf323('0xe6'),'raw':!![]});}var _0x4437c4=[{'model':db[_0xf323('0xef')],'as':_0xf323('0xf1'),'attributes':['id','body',_0xf323('0x8e'),'direction','secret',_0xf323('0x95')],'include':_0x4ce60a}];_0x4437c4[_0xf323('0x45')]({'model':db[_0xf323('0xce')],'as':_0xf323('0x121'),'attributes':['id',_0xf323('0x4a')]});_0x4437c4['push']({'model':db[_0xf323('0x82')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x32d6e6['params']['id']},'include':_0x4437c4})[_0xf323('0x27')](handleEntityNotFound(_0x4902ad,null))[_0xf323('0x27')](function(_0x24c285){if(_0x24c285){var _0x6ba94a=_0x24c285['get']({'plain':!![]});fs[_0xf323('0x122')](_0x4125c2);var _0x45a36e={'format':'A4','border':_0xf323('0x123'),'header':{'height':_0xf323('0x124'),'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':_0xf323('0x125'),'contents':{'default':util[_0xf323('0xf2')](_0xf323('0x126'),util[_0xf323('0xf2')](_0xf323('0x127'),_0xf323('0x128'),_0x6ba94a['id']),moment()[_0xf323('0xf2')]('YYYY-MM-DD')['toString']())}}};var _0x159fa8={'channel':_0xf323('0x128'),'account':_0x6ba94a['Account'][_0xf323('0x4a')],'agent':_0x6ba94a[_0xf323('0x129')]?_0x6ba94a[_0xf323('0x129')]['fullname']:_0xf323('0x12a'),'createdAt':moment(_0x6ba94a['createdAt'])[_0xf323('0xf2')](_0xf323('0x10f'))['toString'](),'closedAt':_0x6ba94a[_0xf323('0xdd')]?moment(_0x6ba94a[_0xf323('0x12b')])[_0xf323('0xf2')](_0xf323('0x10f'))['toString']():'','disposition':_0x6ba94a['disposition'],'chatInfo':{'browser':_0x6ba94a[_0xf323('0x12c')],'os':_0x6ba94a['osName'],'referer':_0x6ba94a[_0xf323('0x12d')],'customerIp':_0x6ba94a[_0xf323('0x12e')],'customerPort':_0x6ba94a[_0xf323('0x12f')]?_0x6ba94a[_0xf323('0x12f')]:_0xf323('0x12a')},'messages':_(_0x6ba94a[_0xf323('0xf1')])[_0xf323('0x130')]()[_0xf323('0x98')]({'secret':![]})[_0xf323('0x3f')](function(_0x435051){if(_0x435051['Attachment']){var _0xdec264=path[_0xf323('0xe9')](_0xd80f1a,_0x435051[_0xf323('0xe6')]['basename']);if(fs[_0xf323('0x131')](_0xdec264)){fs['createReadStream'](_0xdec264)[_0xf323('0x132')](fs[_0xf323('0x133')](path[_0xf323('0xe9')](_0x4125c2,_0x435051[_0xf323('0xe6')]['basename'])));}}return{'date':moment(_0x435051[_0xf323('0x8e')])['format'](_0xf323('0x10f'))[_0xf323('0xab')](),'sender':_0x435051[_0xf323('0xfc')]===_0xf323('0xd5')?_0x435051['User']?_0x435051[_0xf323('0x82')][_0xf323('0x40')]:'System':_0x435051[_0xf323('0x76')][_0xf323('0x11f')]+(_0x435051[_0xf323('0x76')][_0xf323('0x134')]?'\x20'+_0x435051[_0xf323('0x76')][_0xf323('0x134')]:''),'body':_0x435051['Attachment']?_0x435051[_0xf323('0xe6')][_0xf323('0xe2')]:_0x435051['body'],'direction':_0x435051['direction']===_0xf323('0xd5')?'A':'C','secret':_0x435051[_0xf323('0xfd')],'read':_0x435051['read'],'attachment':_0x435051['Attachment']};})[_0xf323('0x73')]()};return ejs[_0xf323('0x135')](path['join'](config[_0xf323('0xea')],_0xf323('0x11d'),'views',_0xf323('0x136')),{'interaction':_0x159fa8})[_0xf323('0x27')](function(_0x4665a3){return new BPromise(function(_0x6432fc,_0x112d75){pdf[_0xf323('0xc8')](_0x4665a3,_0x45a36e)[_0xf323('0x137')](path['join'](_0x4125c2,'transcript-'+_0x6ba94a['id']+'-'+_0x110c46+'.pdf'),function(_0x29320e,_0xa2c54d){if(_0x29320e)return _0x112d75(_0x29320e);_0x6432fc(_0xa2c54d);});});})[_0xf323('0x27')](function(){return new BPromise(function(_0x3072e8,_0x4568eb){zipdir(_0x4125c2,{'saveTo':_0x5dc95e},function(_0x3bb14b,_0x5a60c4){if(_0x3bb14b)return _0x4568eb(_0x3bb14b);return _0x3072e8(_0x5a60c4);});})[_0xf323('0x27')](function(){return new BPromise(function(_0x31bb0e,_0x70872f){rimraf(_0x4125c2,function(_0x4b4435){if(_0x4b4435)_0x70872f(_0x4b4435);return _0x31bb0e();});});})[_0xf323('0x27')](function(){return _0x4902ad[_0xf323('0xe8')](_0x5dc95e,_0x2940da,function(_0x3625a2){if(_0x3625a2){console[_0xf323('0x138')](_0xf323('0x139'),_0x3625a2);}else{fs[_0xf323('0x13a')](_0x5dc95e);}});});});}else{return _0x4902ad['sendStatus'](0xc8);}})[_0xf323('0x46')](handleError(_0x4902ad,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a48dc42..71f9af7 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 _0x369e=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x369e,0x17a));var _0xe369=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0x369e[_0x1c73ee];return _0x154f05;};'use strict';var EventEmitter=require(_0xe369('0x0'));var ChatInteraction=require(_0xe369('0x1'))['db'][_0xe369('0x2')];var ChatMessage=require(_0xe369('0x1'))['db'][_0xe369('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe369('0x4')](0x0);var events={'afterCreate':_0xe369('0x5'),'afterUpdate':'update','afterDestroy':_0xe369('0x6')};function emitEvent(_0x561c4c){return function(_0x17a7b6,_0x3302f0,_0x4038c8){_0x17a7b6[_0xe369('0x7')]({'attributes':['id'],'raw':!![]})[_0xe369('0x8')](function(_0x17acb8){_0x17a7b6[_0xe369('0x9')](_0xe369('0xa'),_0x17acb8[_0xe369('0xb')](function(_0x3b2eda){return{'id':_0x3b2eda['id']};}));return ChatMessage[_0xe369('0xc')]({'where':{'ChatInteractionId':_0x17a7b6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2f0775){_0x17a7b6[_0xe369('0x9')](_0xe369('0xd'),_0x2f0775[_0xe369('0xe')]);ChatInteractionEvents['emit'](_0x561c4c+':'+_0x17a7b6['id'],_0x17a7b6);ChatInteractionEvents[_0xe369('0xf')](_0x561c4c,_0x17a7b6);_0x4038c8(null);})['catch'](_0x4038c8(null));};}for(var e in events){if(events[_0xe369('0x10')](e)){var event=events[e];ChatInteraction[_0xe369('0x11')](e,emitEvent(event));}}module[_0xe369('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x6737=['ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0x6737,0x11b));var _0x7673=function(_0x21b413,_0x4f94ac){_0x21b413=_0x21b413-0x0;var _0x2adbbc=_0x6737[_0x21b413];return _0x2adbbc;};'use strict';var EventEmitter=require(_0x7673('0x0'));var ChatInteraction=require(_0x7673('0x1'))['db'][_0x7673('0x2')];var ChatMessage=require(_0x7673('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7673('0x3')](0x0);var events={'afterCreate':_0x7673('0x4'),'afterUpdate':_0x7673('0x5'),'afterDestroy':_0x7673('0x6')};function emitEvent(_0x4f9f2f){return function(_0x5fbf9e,_0xffa1fd,_0x8b904f){_0x5fbf9e[_0x7673('0x7')]({'attributes':['id'],'raw':!![]})[_0x7673('0x8')](function(_0x27ac1c){_0x5fbf9e[_0x7673('0x9')](_0x7673('0xa'),_0x27ac1c[_0x7673('0xb')](function(_0x46af3e){return{'id':_0x46af3e['id']};}));return ChatMessage[_0x7673('0xc')]({'where':{'ChatInteractionId':_0x5fbf9e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7673('0x8')](function(_0x4b6f4f){_0x5fbf9e[_0x7673('0x9')](_0x7673('0xd'),_0x4b6f4f[_0x7673('0xe')]);ChatInteractionEvents[_0x7673('0xf')](_0x4f9f2f+':'+_0x5fbf9e['id'],_0x5fbf9e);ChatInteractionEvents[_0x7673('0xf')](_0x4f9f2f,_0x5fbf9e);_0x8b904f(null);})[_0x7673('0x10')](_0x8b904f(null));};}for(var e in events){if(events[_0x7673('0x11')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7673('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5b0db90..fcc4507 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 _0x80c7=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closedAt'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x80c7,0x1ea));var _0x780c=function(_0x16e2b0,_0x44723e){_0x16e2b0=_0x16e2b0-0x0;var _0x1483f3=_0x80c7[_0x16e2b0];return _0x1483f3;};'use strict';var _=require('lodash');var util=require(_0x780c('0x0'));var logger=require(_0x780c('0x1'))(_0x780c('0x2'));var moment=require(_0x780c('0x3'));var BPromise=require(_0x780c('0x4'));var rp=require(_0x780c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x780c('0x6'));var config=require(_0x780c('0x7'));var attributes=require(_0x780c('0x8'));module[_0x780c('0x9')]=function(_0x299ee1,_0x1e9ee9){return _0x299ee1[_0x780c('0xa')](_0x780c('0xb'),attributes,{'tableName':_0x780c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2efc45,_0x1b8b2e,_0x1b591e){if(_0x2efc45['changed']('closed')){_0x2efc45[_0x780c('0xd')]=moment()[_0x780c('0xe')](_0x780c('0xf'));}_0x1b591e(null,_0x2efc45);}},'charset':_0x780c('0x10'),'collate':_0x780c('0x11')});}; \ No newline at end of file +var _0xc1aa=['changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x306866,_0x458846){var _0xa84353=function(_0x3e575c){while(--_0x3e575c){_0x306866['push'](_0x306866['shift']());}};_0xa84353(++_0x458846);}(_0xc1aa,0x194));var _0xac1a=function(_0x18f389,_0x2e11bd){_0x18f389=_0x18f389-0x0;var _0x2a9cce=_0xc1aa[_0x18f389];return _0x2a9cce;};'use strict';var _=require(_0xac1a('0x0'));var util=require('util');var logger=require(_0xac1a('0x1'))(_0xac1a('0x2'));var moment=require(_0xac1a('0x3'));var BPromise=require(_0xac1a('0x4'));var rp=require(_0xac1a('0x5'));var fs=require('fs');var path=require(_0xac1a('0x6'));var rimraf=require(_0xac1a('0x7'));var config=require(_0xac1a('0x8'));var attributes=require(_0xac1a('0x9'));module[_0xac1a('0xa')]=function(_0x1fa613,_0x7c2453){return _0x1fa613[_0xac1a('0xb')](_0xac1a('0xc'),attributes,{'tableName':_0xac1a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1cd4f9,_0x52cae7,_0x5491ba){if(_0x1cd4f9[_0xac1a('0xe')](_0xac1a('0xf'))){_0x1cd4f9['closedAt']=moment()['format'](_0xac1a('0x10'));}_0x5491ba(null,_0x1cd4f9);}},'charset':_0xac1a('0x11'),'collate':_0xac1a('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2e38b97..8219227 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 _0xab32=['../../config/environment','jayson/promise','http','redis','defaults','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','update','options','raw','limit','stringify','AddTagsToChatInteraction','ChatInteraction','find','where','addTags','body','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0xab32,0x98));var _0x2ab3=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0xab32[_0x1e500e];return _0x10dc5e;};'use strict';var _=require(_0x2ab3('0x0'));var util=require(_0x2ab3('0x1'));var moment=require('moment');var BPromise=require(_0x2ab3('0x2'));var rs=require(_0x2ab3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ab3('0x4'))['db'];var utils=require(_0x2ab3('0x5'));var logger=require(_0x2ab3('0x6'))(_0x2ab3('0x7'));var config=require(_0x2ab3('0x8'));var jayson=require(_0x2ab3('0x9'));var client=jayson['client'][_0x2ab3('0xa')]({'port':0x232a});config[_0x2ab3('0xb')]=_[_0x2ab3('0xc')](config[_0x2ab3('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x465997,_0xbe1a40,_0x2bc3ec){return new BPromise(function(_0x56020b,_0x3cb5ba){return client['request'](_0x465997,_0x2bc3ec)[_0x2ab3('0xd')](function(_0x2e4e27){logger[_0x2ab3('0xe')](_0x2ab3('0xf'),_0xbe1a40,_0x2ab3('0x10'));logger[_0x2ab3('0x11')](_0x2ab3('0x12'),_0xbe1a40,_0x2ab3('0x10'),JSON['stringify'](_0x2e4e27));if(_0x2e4e27[_0x2ab3('0x13')]){if(_0x2e4e27['error'][_0x2ab3('0x14')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0xbe1a40,_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);return _0x3cb5ba(_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);}logger[_0x2ab3('0x13')](_0x2ab3('0xf'),_0xbe1a40,_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);return _0x56020b(_0x2e4e27[_0x2ab3('0x13')][_0x2ab3('0x15')]);}else{logger['info'](_0x2ab3('0xf'),_0xbe1a40,_0x2ab3('0x10'));_0x56020b(_0x2e4e27[_0x2ab3('0x16')][_0x2ab3('0x15')]);}})[_0x2ab3('0x17')](function(_0x202191){logger[_0x2ab3('0x13')]('ChatInteraction,\x20%s,\x20%s',_0xbe1a40,_0x202191);_0x3cb5ba(_0x202191);});});}exports[_0x2ab3('0x18')]=function(_0x1b0b9f){var _0x11d45f=this;return new Promise(function(_0x2ee4cb,_0x285290){return db['ChatInteraction'][_0x2ab3('0x19')](_0x1b0b9f['body'],{'raw':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f[_0x2ab3('0x1a')][_0x2ab3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f['options']['where']||null:null,'attributes':_0x1b0b9f[_0x2ab3('0x1a')]?_0x1b0b9f[_0x2ab3('0x1a')]['attributes']||null:null,'limit':_0x1b0b9f['options']?_0x1b0b9f[_0x2ab3('0x1a')][_0x2ab3('0x1c')]||null:null})[_0x2ab3('0xd')](function(_0x28b6e6){logger[_0x2ab3('0xe')](_0x2ab3('0x18'),_0x1b0b9f);logger[_0x2ab3('0x11')](_0x2ab3('0x18'),_0x1b0b9f,JSON[_0x2ab3('0x1d')](_0x28b6e6));_0x2ee4cb(_0x28b6e6);})['catch'](function(_0x2e0df9){logger[_0x2ab3('0x13')](_0x2ab3('0x18'),_0x2e0df9['message'],_0x1b0b9f);_0x285290(_0x11d45f[_0x2ab3('0x13')](0x1f4,_0x2e0df9[_0x2ab3('0x15')]));});});};exports[_0x2ab3('0x1e')]=function(_0x43e940){return new Promise(function(_0x4b2dc4,_0x373705){return db[_0x2ab3('0x1f')][_0x2ab3('0x20')]({'where':_0x43e940[_0x2ab3('0x1a')]?_0x43e940['options'][_0x2ab3('0x21')]||null:null})[_0x2ab3('0xd')](function(_0x4b30ba){if(_0x4b30ba){return _0x4b30ba[_0x2ab3('0x22')](_0x43e940[_0x2ab3('0x23')]['ids'],_[_0x2ab3('0x24')](_0x43e940['body'],[_0x2ab3('0x25'),'id'])||{});}})[_0x2ab3('0x26')](function(_0x577667){logger[_0x2ab3('0xe')](_0x2ab3('0x27'),_0x43e940);logger[_0x2ab3('0x11')](_0x2ab3('0x27'),_0x43e940,JSON['stringify'](_0x577667));_0x4b2dc4(_0x577667);})[_0x2ab3('0x17')](function(_0x21b920){logger[_0x2ab3('0x13')](_0x2ab3('0x27'),_0x21b920[_0x2ab3('0x15')],_0x43e940);_0x373705(_this[_0x2ab3('0x13')](0x1f4,_0x21b920['message']));});});}; \ No newline at end of file +var _0xcde8=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','info','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s'];(function(_0x15185f,_0x2003a5){var _0x3c9c47=function(_0x2862f7){while(--_0x2862f7){_0x15185f['push'](_0x15185f['shift']());}};_0x3c9c47(++_0x2003a5);}(_0xcde8,0x167));var _0x8cde=function(_0x23b080,_0x1d4a52){_0x23b080=_0x23b080-0x0;var _0x456784=_0xcde8[_0x23b080];return _0x456784;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8cde('0x0'));var BPromise=require(_0x8cde('0x1'));var rs=require(_0x8cde('0x2'));var fs=require('fs');var Redis=require(_0x8cde('0x3'));var db=require(_0x8cde('0x4'))['db'];var utils=require(_0x8cde('0x5'));var logger=require(_0x8cde('0x6'))(_0x8cde('0x7'));var config=require(_0x8cde('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8cde('0x9')][_0x8cde('0xa')]({'port':0x232a});config[_0x8cde('0xb')]=_[_0x8cde('0xc')](config[_0x8cde('0xb')],{'host':_0x8cde('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8cde('0xb')]));require(_0x8cde('0xe'))[_0x8cde('0xf')](socket);function respondWithRpcPromise(_0x1599b2,_0x336d5e,_0x58117d){return new BPromise(function(_0x5ce1e6,_0x388404){return client[_0x8cde('0x10')](_0x1599b2,_0x58117d)[_0x8cde('0x11')](function(_0x20f31a){logger['info'](_0x8cde('0x12'),_0x336d5e,_0x8cde('0x13'));logger[_0x8cde('0x14')](_0x8cde('0x15'),_0x336d5e,_0x8cde('0x13'),JSON[_0x8cde('0x16')](_0x20f31a));if(_0x20f31a['error']){if(_0x20f31a[_0x8cde('0x17')]['code']===0x1f4){logger[_0x8cde('0x17')](_0x8cde('0x12'),_0x336d5e,_0x20f31a[_0x8cde('0x17')]['message']);return _0x388404(_0x20f31a[_0x8cde('0x17')][_0x8cde('0x18')]);}logger[_0x8cde('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x336d5e,_0x20f31a['error'][_0x8cde('0x18')]);return _0x5ce1e6(_0x20f31a[_0x8cde('0x17')][_0x8cde('0x18')]);}else{logger['info'](_0x8cde('0x12'),_0x336d5e,'request\x20sent');_0x5ce1e6(_0x20f31a[_0x8cde('0x19')][_0x8cde('0x18')]);}})[_0x8cde('0x1a')](function(_0x26aa39){logger[_0x8cde('0x17')](_0x8cde('0x12'),_0x336d5e,_0x26aa39);_0x388404(_0x26aa39);});});}exports[_0x8cde('0x1b')]=function(_0x3a386e){var _0x3efc11=this;return new Promise(function(_0x565842,_0x5d7ca1){return db['ChatInteraction'][_0x8cde('0x1c')](_0x3a386e[_0x8cde('0x1d')],{'raw':_0x3a386e[_0x8cde('0x1e')]?_0x3a386e['options'][_0x8cde('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a386e[_0x8cde('0x1e')]?_0x3a386e[_0x8cde('0x1e')][_0x8cde('0x20')]||null:null,'attributes':_0x3a386e['options']?_0x3a386e[_0x8cde('0x1e')][_0x8cde('0x21')]||null:null,'limit':_0x3a386e[_0x8cde('0x1e')]?_0x3a386e[_0x8cde('0x1e')][_0x8cde('0x22')]||null:null})[_0x8cde('0x11')](function(_0x317bfd){logger['info'](_0x8cde('0x1b'),_0x3a386e);logger[_0x8cde('0x14')]('UpdateChatInteraction',_0x3a386e,JSON[_0x8cde('0x16')](_0x317bfd));_0x565842(_0x317bfd);})[_0x8cde('0x1a')](function(_0x3ab7d1){logger[_0x8cde('0x17')](_0x8cde('0x1b'),_0x3ab7d1[_0x8cde('0x18')],_0x3a386e);_0x5d7ca1(_0x3efc11[_0x8cde('0x17')](0x1f4,_0x3ab7d1[_0x8cde('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x463be2){return new Promise(function(_0x40a522,_0xe43d01){return db['ChatInteraction'][_0x8cde('0x23')]({'where':_0x463be2[_0x8cde('0x1e')]?_0x463be2['options'][_0x8cde('0x20')]||null:null})[_0x8cde('0x11')](function(_0x24e7dc){if(_0x24e7dc){return _0x24e7dc[_0x8cde('0x24')](_0x463be2[_0x8cde('0x1d')][_0x8cde('0x25')],_[_0x8cde('0x26')](_0x463be2['body'],[_0x8cde('0x25'),'id'])||{});}})[_0x8cde('0x27')](function(_0x27fe6e){logger[_0x8cde('0x28')](_0x8cde('0x29'),_0x463be2);logger[_0x8cde('0x14')]('AddTags',_0x463be2,JSON[_0x8cde('0x16')](_0x27fe6e));_0x40a522(_0x27fe6e);})['catch'](function(_0x21077d){logger[_0x8cde('0x17')](_0x8cde('0x29'),_0x21077d['message'],_0x463be2);_0xe43d01(_this[_0x8cde('0x17')](0x1f4,_0x21077d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d0814ec..3082f4a 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 _0x489c=['save','update','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x489c,0x1d3));var _0xc489=function(_0x34a8b0,_0x17a597){_0x34a8b0=_0x34a8b0-0x0;var _0x1e318a=_0x489c[_0x34a8b0];return _0x1e318a;};'use strict';var ChatInteractionEvents=require(_0xc489('0x0'));var events=[_0xc489('0x1'),'remove',_0xc489('0x2')];function createListener(_0x35c17b,_0x404818){return function(_0x1451a3){_0x404818['emit'](_0x35c17b,_0x1451a3);};}function removeListener(_0x1bec1a,_0x5c27f2){return function(){ChatInteractionEvents['removeListener'](_0x1bec1a,_0x5c27f2);};}exports[_0xc489('0x3')]=function(_0x51a665){for(var _0xab5f73=0x0,_0x440a44=events[_0xc489('0x4')];_0xab5f73<_0x440a44;_0xab5f73++){var _0x3cda49=events[_0xab5f73];var _0x3e169f=createListener(_0xc489('0x5')+_0x3cda49,_0x51a665);ChatInteractionEvents['on'](_0x3cda49,_0x3e169f);}}; \ No newline at end of file +var _0xfa64=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x2d265c,_0x9363b9){var _0x526ccc=function(_0x204dae){while(--_0x204dae){_0x2d265c['push'](_0x2d265c['shift']());}};_0x526ccc(++_0x9363b9);}(_0xfa64,0x12d));var _0x4fa6=function(_0x236995,_0xa7b63c){_0x236995=_0x236995-0x0;var _0xb30244=_0xfa64[_0x236995];return _0xb30244;};'use strict';var ChatInteractionEvents=require(_0x4fa6('0x0'));var events=[_0x4fa6('0x1'),_0x4fa6('0x2'),_0x4fa6('0x3')];function createListener(_0x1f9b80,_0x5ea585){return function(_0x3cb2ba){_0x5ea585[_0x4fa6('0x4')](_0x1f9b80,_0x3cb2ba);};}function removeListener(_0x4079e4,_0x52f572){return function(){ChatInteractionEvents[_0x4fa6('0x5')](_0x4079e4,_0x52f572);};}exports['register']=function(_0x112e30){for(var _0x2bce3b=0x0,_0x558a51=events[_0x4fa6('0x6')];_0x2bce3b<_0x558a51;_0x2bce3b++){var _0x13966f=events[_0x2bce3b];var _0x5e3407=createListener(_0x4fa6('0x7')+_0x13966f,_0x112e30);ChatInteractionEvents['on'](_0x13966f,_0x5e3407);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0126fa9..8990228 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 _0xd142=['createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','attachmentUpload','addMessage','tracked','chatinteraction:addtags','addTags','put','/:id','chat','update','customUpdate','/:id/abandon','/:id/close','delete','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','create'];(function(_0x3ec845,_0x4e6c51){var _0x3c8434=function(_0x53b5a8){while(--_0x53b5a8){_0x3ec845['push'](_0x3ec845['shift']());}};_0x3c8434(++_0x4e6c51);}(_0xd142,0x11a));var _0x2d14=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0xd142[_0x23da4d];return _0x4ae55;};'use strict';var multer=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var path=require(_0x2d14('0x2'));var timeout=require(_0x2d14('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x2d14('0x4'));var interaction=require(_0x2d14('0x5'));var config=require(_0x2d14('0x6'));var controller=require(_0x2d14('0x7'));router[_0x2d14('0x8')]('/',auth[_0x2d14('0x9')](),controller[_0x2d14('0xa')]);router[_0x2d14('0x8')](_0x2d14('0xb'),auth[_0x2d14('0x9')](),controller[_0x2d14('0xc')]);router[_0x2d14('0x8')]('/:id',auth[_0x2d14('0xd')](),controller[_0x2d14('0xe')]);router['get'](_0x2d14('0xf'),auth[_0x2d14('0xd')](),controller[_0x2d14('0x10')]);router['get'](_0x2d14('0x11'),auth[_0x2d14('0x9')](),controller['getMessages']);router['get'](_0x2d14('0x12'),auth[_0x2d14('0xd')](),controller[_0x2d14('0x13')]);router['get'](_0x2d14('0x14'),auth[_0x2d14('0x9')](),controller[_0x2d14('0x15')]);router[_0x2d14('0x16')]('/',auth['isAuthenticated'](),controller[_0x2d14('0x17')]);router[_0x2d14('0x16')]('/:id/vidaoo',auth[_0x2d14('0x9')](),controller[_0x2d14('0x18')]);var upload=multer({'storage':multer[_0x2d14('0x19')]({'destination':function(_0xe9aadc,_0x2dfcd4,_0x5e6095){_0x5e6095(null,path[_0x2d14('0x1a')](config[_0x2d14('0x1b')],_0x2d14('0x1c')));},'filename':function(_0x30a789,_0x27b6a3,_0x5ac4a5){_0x5ac4a5(null,util[_0x2d14('0x1d')](_0x2d14('0x1e'),Date[_0x2d14('0x1f')](),_0x27b6a3[_0x2d14('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x2d14('0x21'),upload['single']('file'),controller[_0x2d14('0x22')]);router[_0x2d14('0x16')](_0x2d14('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x2d14('0x23')]);router[_0x2d14('0x16')]('/:id/tags',auth[_0x2d14('0x9')](),interaction[_0x2d14('0x24')]('chat',_0x2d14('0x25')),controller[_0x2d14('0x26')]);router[_0x2d14('0x27')](_0x2d14('0x28'),auth[_0x2d14('0x9')](),interaction['tracked'](_0x2d14('0x29'),'chatinteraction:update'),controller[_0x2d14('0x2a')]);router['put']('/:id/custom_update',controller[_0x2d14('0x2b')]);router[_0x2d14('0x27')](_0x2d14('0x2c'),auth[_0x2d14('0xd')](),controller['abandon']);router[_0x2d14('0x27')](_0x2d14('0x2d'),controller['close']);router[_0x2d14('0x2e')](_0x2d14('0x28'),auth[_0x2d14('0x9')](),interaction[_0x2d14('0x24')](_0x2d14('0x29'),'chatinteraction:destroy'),controller[_0x2d14('0x2f')]);router[_0x2d14('0x2e')](_0x2d14('0x30'),auth[_0x2d14('0x9')](),controller[_0x2d14('0x31')]);module[_0x2d14('0x32')]=router; \ No newline at end of file +var _0x60e1=['join','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','/:id','chatinteraction:update','/:id/abandon','abandon','/:id/close','close','delete','chat','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo'];(function(_0x4fd7ab,_0x1ae1f5){var _0x2ab5be=function(_0x145b14){while(--_0x145b14){_0x4fd7ab['push'](_0x4fd7ab['shift']());}};_0x2ab5be(++_0x1ae1f5);}(_0x60e1,0x14c));var _0x160e=function(_0x2bdf5,_0x36ed20){_0x2bdf5=_0x2bdf5-0x0;var _0x4e54b1=_0x60e1[_0x2bdf5];return _0x4e54b1;};'use strict';var multer=require(_0x160e('0x0'));var util=require('util');var path=require(_0x160e('0x1'));var timeout=require(_0x160e('0x2'));var express=require(_0x160e('0x3'));var router=express[_0x160e('0x4')]();var auth=require(_0x160e('0x5'));var interaction=require(_0x160e('0x6'));var config=require(_0x160e('0x7'));var controller=require(_0x160e('0x8'));router[_0x160e('0x9')]('/',auth[_0x160e('0xa')](),controller['index']);router[_0x160e('0x9')]('/describe',auth[_0x160e('0xa')](),controller[_0x160e('0xb')]);router[_0x160e('0x9')]('/:id',auth[_0x160e('0xc')](),controller[_0x160e('0xd')]);router[_0x160e('0x9')](_0x160e('0xe'),auth[_0x160e('0xc')](),controller[_0x160e('0xf')]);router['get'](_0x160e('0x10'),auth[_0x160e('0xa')](),controller[_0x160e('0x11')]);router[_0x160e('0x9')](_0x160e('0x12'),auth[_0x160e('0xc')](),controller[_0x160e('0x13')]);router['get'](_0x160e('0x14'),auth[_0x160e('0xa')](),controller[_0x160e('0x15')]);router[_0x160e('0x16')]('/',auth['isAuthenticated'](),controller[_0x160e('0x17')]);router[_0x160e('0x16')](_0x160e('0x18'),auth[_0x160e('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d618d,_0x56a685,_0x302052){_0x302052(null,path[_0x160e('0x19')](config[_0x160e('0x1a')],_0x160e('0x1b')));},'filename':function(_0x1e5e85,_0x1ed6aa,_0x55e08b){_0x55e08b(null,util[_0x160e('0x1c')](_0x160e('0x1d'),Date['now'](),_0x1ed6aa[_0x160e('0x1e')][_0x160e('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x160e('0x16')](_0x160e('0x20'),upload[_0x160e('0x21')](_0x160e('0x22')),controller['attachmentUpload']);router[_0x160e('0x16')]('/:id/messages',auth[_0x160e('0xc')](),controller[_0x160e('0x23')]);router['post'](_0x160e('0x24'),auth['isAuthenticated'](),interaction[_0x160e('0x25')]('chat',_0x160e('0x26')),controller['addTags']);router[_0x160e('0x27')](_0x160e('0x28'),auth['isAuthenticated'](),interaction[_0x160e('0x25')]('chat',_0x160e('0x29')),controller['update']);router[_0x160e('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0x160e('0x27')](_0x160e('0x2a'),auth[_0x160e('0xc')](),controller[_0x160e('0x2b')]);router[_0x160e('0x27')](_0x160e('0x2c'),controller[_0x160e('0x2d')]);router[_0x160e('0x2e')](_0x160e('0x28'),auth[_0x160e('0xa')](),interaction[_0x160e('0x25')](_0x160e('0x2f'),'chatinteraction:destroy'),controller[_0x160e('0x30')]);router['delete'](_0x160e('0x24'),auth[_0x160e('0xa')](),controller[_0x160e('0x31')]);module[_0x160e('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 48090a9..a36e0ef 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 _0x0295=['sequelize','medium'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0295,0x1f0));var _0x5029=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x0295[_0x23884b];return _0x28113b;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5029('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1967=['INTEGER','exports','TEXT','medium','BOOLEAN'];(function(_0x52e559,_0x106938){var _0x2d94d3=function(_0x4c469a){while(--_0x4c469a){_0x52e559['push'](_0x52e559['shift']());}};_0x2d94d3(++_0x106938);}(_0x1967,0x173));var _0x7196=function(_0x1e9814,_0x13f5f0){_0x1e9814=_0x1e9814-0x0;var _0x5005c8=_0x1967[_0x1e9814];return _0x5005c8;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'body':{'type':Sequelize[_0x7196('0x1')](_0x7196('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7196('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7196('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 551a828..bfeb253 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 _0x36d5=['index','map','ChatInternalMessage','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','params','keys','find','create','body','destroy','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','sendStatus','error','name','send'];(function(_0x4dd327,_0x1b29b7){var _0x445a6e=function(_0x4cb4b5){while(--_0x4cb4b5){_0x4dd327['push'](_0x4dd327['shift']());}};_0x445a6e(++_0x1b29b7);}(_0x36d5,0x1e3));var _0x536d=function(_0xe3bbea,_0x3ae4d3){_0xe3bbea=_0xe3bbea-0x0;var _0x18713d=_0x36d5[_0xe3bbea];return _0x18713d;};'use strict';var pdf=require(_0x536d('0x0'));var emlformat=require(_0x536d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x536d('0x2'));var rp=require(_0x536d('0x3'));var moment=require('moment');var BPromise=require(_0x536d('0x4'));var Mustache=require(_0x536d('0x5'));var util=require('util');var path=require(_0x536d('0x6'));var sox=require(_0x536d('0x7'));var csv=require(_0x536d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x536d('0x9'));var squel=require(_0x536d('0xa'));var crypto=require(_0x536d('0xb'));var jsforce=require(_0x536d('0xc'));var deskjs=require(_0x536d('0xd'));var toCsv=require(_0x536d('0x8'));var querystring=require(_0x536d('0xe'));var Papa=require(_0x536d('0xf'));var Redis=require(_0x536d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x536d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x536d('0x12'))(_0x536d('0x13'));var utils=require(_0x536d('0x14'));var config=require('../../config/environment');var db=require(_0x536d('0x15'))['db'];config[_0x536d('0x16')]=_[_0x536d('0x17')](config[_0x536d('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x536d('0x18'))(new Redis(config[_0x536d('0x16')]));require(_0x536d('0x19'))[_0x536d('0x1a')](socket);function respondWithStatusCode(_0x45b746,_0x34cbce){_0x34cbce=_0x34cbce||0xcc;return function(_0x5bead7){if(_0x5bead7){return _0x45b746['sendStatus'](_0x34cbce);}return _0x45b746[_0x536d('0x1b')](_0x34cbce)[_0x536d('0x1c')]();};}function respondWithResult(_0x1fd960,_0x4de5b0){_0x4de5b0=_0x4de5b0||0xc8;return function(_0x27f92c){if(_0x27f92c){return _0x1fd960['status'](_0x4de5b0)['json'](_0x27f92c);}};}function respondWithFilteredResult(_0xd2e9f8,_0x3b0f24){return function(_0x567133){if(_0x567133){var _0x2b00bb=_0x567133[_0x536d('0x1d')],_0x344fbb=_0x3b0f24[_0x536d('0x1e')],_0x3440e6=_0x3b0f24[_0x536d('0x1e')]+_0x3b0f24[_0x536d('0x1f')],_0x10bce0;if(_0x3440e6>=_0x2b00bb){_0x3440e6=_0x2b00bb;_0x10bce0=0xc8;}else{_0x10bce0=0xce;}_0xd2e9f8[_0x536d('0x1b')](_0x10bce0);return _0xd2e9f8['set'](_0x536d('0x20'),_0x344fbb+'-'+_0x3440e6+'/'+_0x2b00bb)[_0x536d('0x21')](_0x567133);}return null;};}function patchUpdates(_0x1399bf){return function(_0x5489be){try{jsonpatch[_0x536d('0x22')](_0x5489be,_0x1399bf,!![]);}catch(_0x248786){return BPromise['reject'](_0x248786);}return _0x5489be[_0x536d('0x23')]();};}function saveUpdates(_0x44178b,_0x50ba9a){return function(_0x5348b6){if(_0x5348b6){return _0x5348b6[_0x536d('0x24')](_0x44178b)['then'](function(_0x1f7294){return _0x1f7294;});}return null;};}function removeEntity(_0x4b567a,_0x4abc05){return function(_0x23ac1d){if(_0x23ac1d){return _0x23ac1d['destroy']()[_0x536d('0x25')](function(){_0x4b567a[_0x536d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31eb43,_0x4858e6){return function(_0x47ef7a){if(!_0x47ef7a){_0x31eb43[_0x536d('0x26')](0x194);}return _0x47ef7a;};}function handleError(_0x2f7ac9,_0x390834){_0x390834=_0x390834||0x1f4;return function(_0xd057fa){logger[_0x536d('0x27')](_0xd057fa['stack']);if(_0xd057fa[_0x536d('0x28')]){delete _0xd057fa[_0x536d('0x28')];}_0x2f7ac9['status'](_0x390834)[_0x536d('0x29')](_0xd057fa);};}exports[_0x536d('0x2a')]=function(_0x5c228c,_0x321e2d){var _0x39d484={},_0x679db0={},_0x2f2403={'count':0x0,'rows':[]};var _0x24c75c=_[_0x536d('0x2b')](db[_0x536d('0x2c')][_0x536d('0x2d')],function(_0x4f5582){return{'name':_0x4f5582['fieldName'],'type':_0x4f5582[_0x536d('0x2e')][_0x536d('0x2f')]};});_0x679db0[_0x536d('0x30')]=_[_0x536d('0x2b')](_0x24c75c,_0x536d('0x28'));_0x679db0[_0x536d('0x31')]=_['keys'](_0x5c228c['query']);_0x679db0['filters']=_[_0x536d('0x32')](_0x679db0[_0x536d('0x30')],_0x679db0['query']);_0x39d484['attributes']=_[_0x536d('0x32')](_0x679db0[_0x536d('0x30')],qs[_0x536d('0x33')](_0x5c228c[_0x536d('0x31')]['fields']));_0x39d484[_0x536d('0x34')]=_0x39d484[_0x536d('0x34')][_0x536d('0x35')]?_0x39d484[_0x536d('0x34')]:_0x679db0['model'];if(!_0x5c228c[_0x536d('0x31')][_0x536d('0x36')](_0x536d('0x37'))){_0x39d484[_0x536d('0x1f')]=qs[_0x536d('0x1f')](_0x5c228c[_0x536d('0x31')][_0x536d('0x1f')]);_0x39d484['offset']=qs[_0x536d('0x1e')](_0x5c228c[_0x536d('0x31')][_0x536d('0x1e')]);}_0x39d484[_0x536d('0x38')]=qs[_0x536d('0x39')](_0x5c228c[_0x536d('0x31')][_0x536d('0x39')]);_0x39d484[_0x536d('0x3a')]=qs[_0x536d('0x3b')](_[_0x536d('0x3c')](_0x5c228c[_0x536d('0x31')],_0x679db0[_0x536d('0x3b')]),_0x24c75c);if(_0x5c228c[_0x536d('0x31')][_0x536d('0x3d')]){_0x39d484[_0x536d('0x3a')]=_['merge'](_0x39d484['where'],{'$or':_['map'](_0x24c75c,function(_0x4f9fb7){if(_0x4f9fb7['type']!=='VIRTUAL'){var _0x1bdf57={};_0x1bdf57[_0x4f9fb7[_0x536d('0x28')]]={'$like':'%'+_0x5c228c[_0x536d('0x31')][_0x536d('0x3d')]+'%'};return _0x1bdf57;}})});}_0x39d484=_[_0x536d('0x3e')]({},_0x39d484,_0x5c228c[_0x536d('0x3f')]);var _0x37ab34={'where':_0x39d484['where']};return db[_0x536d('0x2c')]['count'](_0x37ab34)['then'](function(_0x44f980){_0x2f2403[_0x536d('0x1d')]=_0x44f980;if(_0x5c228c[_0x536d('0x31')][_0x536d('0x40')]){_0x39d484[_0x536d('0x41')]=[{'all':!![]}];}return db[_0x536d('0x2c')]['findAll'](_0x39d484);})['then'](function(_0x2ae7ae){_0x2f2403[_0x536d('0x42')]=_0x2ae7ae;return _0x2f2403;})[_0x536d('0x25')](respondWithFilteredResult(_0x321e2d,_0x39d484))[_0x536d('0x43')](handleError(_0x321e2d,null));};exports['show']=function(_0x36c348,_0x57f9b8){var _0x2add19={'raw':!![],'where':{'id':_0x36c348[_0x536d('0x44')]['id']}},_0x53223a={};_0x53223a[_0x536d('0x30')]=_[_0x536d('0x45')](db[_0x536d('0x2c')][_0x536d('0x2d')]);_0x53223a[_0x536d('0x31')]=_[_0x536d('0x45')](_0x36c348[_0x536d('0x31')]);_0x53223a[_0x536d('0x3b')]=_[_0x536d('0x32')](_0x53223a[_0x536d('0x30')],_0x53223a[_0x536d('0x31')]);_0x2add19[_0x536d('0x34')]=_[_0x536d('0x32')](_0x53223a[_0x536d('0x30')],qs[_0x536d('0x33')](_0x36c348[_0x536d('0x31')][_0x536d('0x33')]));_0x2add19[_0x536d('0x34')]=_0x2add19[_0x536d('0x34')][_0x536d('0x35')]?_0x2add19[_0x536d('0x34')]:_0x53223a[_0x536d('0x30')];if(_0x36c348['query'][_0x536d('0x40')]){_0x2add19[_0x536d('0x41')]=[{'all':!![]}];}_0x2add19=_['merge']({},_0x2add19,_0x36c348[_0x536d('0x3f')]);return db[_0x536d('0x2c')][_0x536d('0x46')](_0x2add19)[_0x536d('0x25')](handleEntityNotFound(_0x57f9b8,null))[_0x536d('0x25')](respondWithResult(_0x57f9b8,null))[_0x536d('0x43')](handleError(_0x57f9b8,null));};exports[_0x536d('0x47')]=function(_0x244c66,_0x1d7769){return db[_0x536d('0x2c')]['create'](_0x244c66[_0x536d('0x48')],{})[_0x536d('0x25')](respondWithResult(_0x1d7769,0xc9))[_0x536d('0x43')](handleError(_0x1d7769,null));};exports[_0x536d('0x24')]=function(_0x952948,_0x3f1f51){if(_0x952948[_0x536d('0x48')]['id']){delete _0x952948['body']['id'];}return db[_0x536d('0x2c')][_0x536d('0x46')]({'where':{'id':_0x952948[_0x536d('0x44')]['id']}})[_0x536d('0x25')](handleEntityNotFound(_0x3f1f51,null))[_0x536d('0x25')](saveUpdates(_0x952948['body'],null))[_0x536d('0x25')](respondWithResult(_0x3f1f51,null))['catch'](handleError(_0x3f1f51,null));};exports[_0x536d('0x49')]=function(_0x2f7563,_0x4d9d6f){return db[_0x536d('0x2c')][_0x536d('0x46')]({'where':{'id':_0x2f7563['params']['id']}})[_0x536d('0x25')](handleEntityNotFound(_0x4d9d6f,null))[_0x536d('0x25')](removeEntity(_0x4d9d6f,null))['catch'](handleError(_0x4d9d6f,null));};exports['describe']=function(_0x15612b,_0x4a91f5){return db[_0x536d('0x2c')]['describe']()[_0x536d('0x25')](respondWithResult(_0x4a91f5,null))['catch'](handleError(_0x4a91f5,null));};function wrapUser(_0x458cf8){return function(_0x29b5ed){var _0x41abb2=_0x458cf8[_0x536d('0x4a')]({'plain':!![]});_0x41abb2['messages']=[];if(_0x29b5ed){_0x41abb2[_0x536d('0x4b')]=_0x29b5ed[_0x536d('0x4c')];_0x41abb2[_0x536d('0x4d')]=_0x29b5ed;}else{_0x41abb2[_0x536d('0x4b')]=moment(0x0)[_0x536d('0x4e')](_0x536d('0x4f'));_0x41abb2[_0x536d('0x4d')]={};}return _0x41abb2;};}exports['getUsers']=function(_0x476266,_0x3dcf0f,_0xe2ff05){var _0x381535=[];return db['User'][_0x536d('0x50')]({'where':{'role':[_0x536d('0x51'),_0x536d('0x52'),_0x536d('0x53')]},'attributes':['id',_0x536d('0x54'),_0x536d('0x28'),_0x536d('0x55'),'userpic','internal',_0x536d('0x56'),_0x536d('0x57'),_0x536d('0x58'),_0x536d('0x59')],'order':qs[_0x536d('0x39')](_0x536d('0x5a')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x536d('0x28'),_0x536d('0x2e')],'through':{'attributes':[]}}]})[_0x536d('0x25')](function(_0x35690a){if(_0x35690a){var _0x19c653=_0x476266[_0x536d('0x53')]['get']({'plain':!![]});if(!_0x19c653)throw new Error(_0x536d('0x5b'));if(_0x19c653['role']===_0x536d('0x53')){return db[_0x536d('0x5c')]['find']({'where':{'name':_0x536d('0x5d'),'userProfileId':_0x19c653[_0x536d('0x5e')]},'raw':!![]})[_0x536d('0x25')](function(_0xb31c56){if(_0xb31c56){if(_0xb31c56[_0x536d('0x5f')]===0x0){return db[_0x536d('0x60')][_0x536d('0x50')]({'where':{'sectionId':_0xb31c56['id']},'raw':!![]})[_0x536d('0x25')](function(_0x3174ea){var _0xe8dd8c=[];if(_[_0x536d('0x61')](_0x3174ea)){_0xe8dd8c=_[_0x536d('0x3d')](_0x35690a,function(_0x42f098){if(_0x42f098['role']!=='agent'){return _0x42f098;}});return _0xe8dd8c;}else{for(var _0x57445d=0x0;_0x57445d<_0x35690a[_0x536d('0x35')];_0x57445d++){var _0x54bd95=_0x35690a[_0x57445d];if(_0x54bd95['role']===_0x536d('0x51')){var _0x2df051=_['find'](_0x3174ea,function(_0x12f310){return _0x12f310['resourceId']===_0x54bd95['id'];});if(_0x2df051)_0xe8dd8c['push'](_0x54bd95);}else{_0xe8dd8c[_0x536d('0x62')](_0x54bd95);}}return _0xe8dd8c;}});}else{return _0x35690a;}}else{var _0x7624f6=_[_0x536d('0x3d')](_0x35690a,function(_0x22e229){if(_0x22e229[_0x536d('0x55')]!==_0x536d('0x51')){return _0x22e229;}});return _0x7624f6;}});}else{return _0x35690a;}}})['then'](function(_0x3339d1){var _0x14e3c1=[];if(_0x3339d1){_0x381535=_0x3339d1;for(var _0x31b072=0x0;_0x31b072<_0x3339d1[_0x536d('0x35')];_0x31b072+=0x1){_0x381535[_0x31b072][_0x536d('0x63')]=[];_0x14e3c1[_0x536d('0x62')](db['ChatInternalMessage'][_0x536d('0x46')]({'where':{'FromId':[_0x476266[_0x536d('0x53')]['id'],_0x3339d1[_0x31b072]['id']],'ToId':[_0x476266[_0x536d('0x53')]['id'],_0x3339d1[_0x31b072]['id']],'ChatGroupId':null},'attributes':['id',_0x536d('0x4c'),_0x536d('0x64'),_0x536d('0x65'),_0x536d('0x66'),_0x536d('0x48')],'order':qs[_0x536d('0x39')](_0x536d('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3339d1[_0x31b072])));}return BPromise[_0x536d('0x68')](_0x14e3c1);}return[];})[_0x536d('0x25')](function(_0x3c9f21){return{'rows':_0x3c9f21,'count':_0x3c9f21['length']};})[_0x536d('0x25')](respondWithResult(_0x3dcf0f,null))['catch'](handleError(_0x3dcf0f,null));}; \ No newline at end of file +var _0x7ad7=['createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','FromId','ToId','read','-createdAt','all','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','messages','lastMessageAt'];(function(_0x1445c3,_0xe73466){var _0x35d37a=function(_0x4d3776){while(--_0x4d3776){_0x1445c3['push'](_0x1445c3['shift']());}};_0x35d37a(++_0xe73466);}(_0x7ad7,0x8b));var _0x77ad=function(_0x3464ce,_0x4dc32a){_0x3464ce=_0x3464ce-0x0;var _0x1a6cae=_0x7ad7[_0x3464ce];return _0x1a6cae;};'use strict';var pdf=require(_0x77ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x77ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77ad('0x2'));var rp=require(_0x77ad('0x3'));var moment=require(_0x77ad('0x4'));var BPromise=require(_0x77ad('0x5'));var Mustache=require(_0x77ad('0x6'));var util=require('util');var path=require(_0x77ad('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x77ad('0x8'));var fs=require('fs');var _=require(_0x77ad('0x9'));var squel=require('squel');var crypto=require(_0x77ad('0xa'));var jsforce=require(_0x77ad('0xb'));var deskjs=require(_0x77ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0x77ad('0xd'));var Papa=require(_0x77ad('0xe'));var Redis=require(_0x77ad('0xf'));var authService=require(_0x77ad('0x10'));var qs=require(_0x77ad('0x11'));var as=require(_0x77ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77ad('0x13'))(_0x77ad('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x77ad('0x15'))['db'];config[_0x77ad('0x16')]=_[_0x77ad('0x17')](config[_0x77ad('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x77ad('0x18'))(new Redis(config[_0x77ad('0x16')]));require(_0x77ad('0x19'))[_0x77ad('0x1a')](socket);function respondWithStatusCode(_0x326e0f,_0x26af48){_0x26af48=_0x26af48||0xcc;return function(_0xf3e6cb){if(_0xf3e6cb){return _0x326e0f[_0x77ad('0x1b')](_0x26af48);}return _0x326e0f[_0x77ad('0x1c')](_0x26af48)[_0x77ad('0x1d')]();};}function respondWithResult(_0x549003,_0x456868){_0x456868=_0x456868||0xc8;return function(_0x4e79c1){if(_0x4e79c1){return _0x549003[_0x77ad('0x1c')](_0x456868)[_0x77ad('0x1e')](_0x4e79c1);}};}function respondWithFilteredResult(_0x40461e,_0x11d19e){return function(_0x4f4c04){if(_0x4f4c04){var _0x3d0bca=_0x4f4c04[_0x77ad('0x1f')],_0x4f6b32=_0x11d19e['offset'],_0x5c591f=_0x11d19e[_0x77ad('0x20')]+_0x11d19e['limit'],_0x5c9653;if(_0x5c591f>=_0x3d0bca){_0x5c591f=_0x3d0bca;_0x5c9653=0xc8;}else{_0x5c9653=0xce;}_0x40461e[_0x77ad('0x1c')](_0x5c9653);return _0x40461e[_0x77ad('0x21')](_0x77ad('0x22'),_0x4f6b32+'-'+_0x5c591f+'/'+_0x3d0bca)[_0x77ad('0x1e')](_0x4f4c04);}return null;};}function patchUpdates(_0x40c4e6){return function(_0xe31987){try{jsonpatch[_0x77ad('0x23')](_0xe31987,_0x40c4e6,!![]);}catch(_0x3681e7){return BPromise[_0x77ad('0x24')](_0x3681e7);}return _0xe31987[_0x77ad('0x25')]();};}function saveUpdates(_0x356999,_0xfbbee4){return function(_0x510556){if(_0x510556){return _0x510556[_0x77ad('0x26')](_0x356999)[_0x77ad('0x27')](function(_0x253c39){return _0x253c39;});}return null;};}function removeEntity(_0x2a329f,_0x814f13){return function(_0x7cec58){if(_0x7cec58){return _0x7cec58[_0x77ad('0x28')]()['then'](function(){_0x2a329f[_0x77ad('0x1c')](0xcc)[_0x77ad('0x1d')]();});}};}function handleEntityNotFound(_0x2d432b,_0x4aed1f){return function(_0x3b2ac6){if(!_0x3b2ac6){_0x2d432b[_0x77ad('0x1b')](0x194);}return _0x3b2ac6;};}function handleError(_0x4fa598,_0x29c069){_0x29c069=_0x29c069||0x1f4;return function(_0xe21b66){logger[_0x77ad('0x29')](_0xe21b66[_0x77ad('0x2a')]);if(_0xe21b66[_0x77ad('0x2b')]){delete _0xe21b66[_0x77ad('0x2b')];}_0x4fa598[_0x77ad('0x1c')](_0x29c069)[_0x77ad('0x2c')](_0xe21b66);};}exports[_0x77ad('0x2d')]=function(_0x3c4dac,_0x318532){var _0x509116={},_0x594ca={},_0x291c75={'count':0x0,'rows':[]};var _0x57f9a8=_[_0x77ad('0x2e')](db[_0x77ad('0x2f')][_0x77ad('0x30')],function(_0x22ad80){return{'name':_0x22ad80['fieldName'],'type':_0x22ad80[_0x77ad('0x31')][_0x77ad('0x32')]};});_0x594ca[_0x77ad('0x33')]=_[_0x77ad('0x2e')](_0x57f9a8,_0x77ad('0x2b'));_0x594ca[_0x77ad('0x34')]=_[_0x77ad('0x35')](_0x3c4dac[_0x77ad('0x34')]);_0x594ca[_0x77ad('0x36')]=_[_0x77ad('0x37')](_0x594ca['model'],_0x594ca['query']);_0x509116[_0x77ad('0x38')]=_[_0x77ad('0x37')](_0x594ca[_0x77ad('0x33')],qs[_0x77ad('0x39')](_0x3c4dac[_0x77ad('0x34')][_0x77ad('0x39')]));_0x509116[_0x77ad('0x38')]=_0x509116[_0x77ad('0x38')][_0x77ad('0x3a')]?_0x509116['attributes']:_0x594ca[_0x77ad('0x33')];if(!_0x3c4dac[_0x77ad('0x34')][_0x77ad('0x3b')]('nolimit')){_0x509116[_0x77ad('0x3c')]=qs[_0x77ad('0x3c')](_0x3c4dac[_0x77ad('0x34')][_0x77ad('0x3c')]);_0x509116['offset']=qs[_0x77ad('0x20')](_0x3c4dac['query'][_0x77ad('0x20')]);}_0x509116['order']=qs[_0x77ad('0x3d')](_0x3c4dac[_0x77ad('0x34')]['sort']);_0x509116[_0x77ad('0x3e')]=qs['filters'](_['pick'](_0x3c4dac['query'],_0x594ca['filters']),_0x57f9a8);if(_0x3c4dac['query'][_0x77ad('0x3f')]){_0x509116[_0x77ad('0x3e')]=_[_0x77ad('0x40')](_0x509116['where'],{'$or':_[_0x77ad('0x2e')](_0x57f9a8,function(_0x3ebf0b){if(_0x3ebf0b[_0x77ad('0x31')]!==_0x77ad('0x41')){var _0x1bb1ea={};_0x1bb1ea[_0x3ebf0b['name']]={'$like':'%'+_0x3c4dac[_0x77ad('0x34')][_0x77ad('0x3f')]+'%'};return _0x1bb1ea;}})});}_0x509116=_[_0x77ad('0x40')]({},_0x509116,_0x3c4dac['options']);var _0x4bbc95={'where':_0x509116[_0x77ad('0x3e')]};return db['ChatInternalMessage'][_0x77ad('0x1f')](_0x4bbc95)[_0x77ad('0x27')](function(_0x124c88){_0x291c75[_0x77ad('0x1f')]=_0x124c88;if(_0x3c4dac[_0x77ad('0x34')][_0x77ad('0x42')]){_0x509116[_0x77ad('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x77ad('0x44')](_0x509116);})[_0x77ad('0x27')](function(_0x47ee7f){_0x291c75['rows']=_0x47ee7f;return _0x291c75;})['then'](respondWithFilteredResult(_0x318532,_0x509116))[_0x77ad('0x45')](handleError(_0x318532,null));};exports[_0x77ad('0x46')]=function(_0x2ca8bd,_0x58f0cc){var _0xc1e34={'raw':!![],'where':{'id':_0x2ca8bd['params']['id']}},_0x17660f={};_0x17660f['model']=_[_0x77ad('0x35')](db['ChatInternalMessage'][_0x77ad('0x30')]);_0x17660f[_0x77ad('0x34')]=_[_0x77ad('0x35')](_0x2ca8bd[_0x77ad('0x34')]);_0x17660f[_0x77ad('0x36')]=_[_0x77ad('0x37')](_0x17660f[_0x77ad('0x33')],_0x17660f[_0x77ad('0x34')]);_0xc1e34['attributes']=_[_0x77ad('0x37')](_0x17660f[_0x77ad('0x33')],qs[_0x77ad('0x39')](_0x2ca8bd[_0x77ad('0x34')][_0x77ad('0x39')]));_0xc1e34['attributes']=_0xc1e34[_0x77ad('0x38')][_0x77ad('0x3a')]?_0xc1e34[_0x77ad('0x38')]:_0x17660f[_0x77ad('0x33')];if(_0x2ca8bd['query'][_0x77ad('0x42')]){_0xc1e34['include']=[{'all':!![]}];}_0xc1e34=_['merge']({},_0xc1e34,_0x2ca8bd[_0x77ad('0x47')]);return db[_0x77ad('0x2f')][_0x77ad('0x48')](_0xc1e34)['then'](handleEntityNotFound(_0x58f0cc,null))[_0x77ad('0x27')](respondWithResult(_0x58f0cc,null))[_0x77ad('0x45')](handleError(_0x58f0cc,null));};exports[_0x77ad('0x49')]=function(_0x33eddf,_0x2eb5f1){return db[_0x77ad('0x2f')][_0x77ad('0x49')](_0x33eddf[_0x77ad('0x4a')],{})['then'](respondWithResult(_0x2eb5f1,0xc9))[_0x77ad('0x45')](handleError(_0x2eb5f1,null));};exports[_0x77ad('0x26')]=function(_0x1474a9,_0x1ae57f){if(_0x1474a9['body']['id']){delete _0x1474a9[_0x77ad('0x4a')]['id'];}return db[_0x77ad('0x2f')][_0x77ad('0x48')]({'where':{'id':_0x1474a9[_0x77ad('0x4b')]['id']}})[_0x77ad('0x27')](handleEntityNotFound(_0x1ae57f,null))['then'](saveUpdates(_0x1474a9[_0x77ad('0x4a')],null))['then'](respondWithResult(_0x1ae57f,null))[_0x77ad('0x45')](handleError(_0x1ae57f,null));};exports[_0x77ad('0x28')]=function(_0xa4d8a0,_0x47c9e0){return db[_0x77ad('0x2f')]['find']({'where':{'id':_0xa4d8a0[_0x77ad('0x4b')]['id']}})[_0x77ad('0x27')](handleEntityNotFound(_0x47c9e0,null))[_0x77ad('0x27')](removeEntity(_0x47c9e0,null))['catch'](handleError(_0x47c9e0,null));};exports[_0x77ad('0x4c')]=function(_0x191ada,_0x5b6626){return db['ChatInternalMessage'][_0x77ad('0x4c')]()[_0x77ad('0x27')](respondWithResult(_0x5b6626,null))[_0x77ad('0x45')](handleError(_0x5b6626,null));};function wrapUser(_0x445240){return function(_0x4c7bcb){var _0xdd005b=_0x445240['get']({'plain':!![]});_0xdd005b[_0x77ad('0x4d')]=[];if(_0x4c7bcb){_0xdd005b[_0x77ad('0x4e')]=_0x4c7bcb[_0x77ad('0x4f')];_0xdd005b[_0x77ad('0x50')]=_0x4c7bcb;}else{_0xdd005b[_0x77ad('0x4e')]=moment(0x0)[_0x77ad('0x51')](_0x77ad('0x52'));_0xdd005b[_0x77ad('0x50')]={};}return _0xdd005b;};}exports[_0x77ad('0x53')]=function(_0x1270f0,_0x1415cb,_0x1118f8){var _0x3ece47=[];return db[_0x77ad('0x54')][_0x77ad('0x44')]({'where':{'role':[_0x77ad('0x55'),_0x77ad('0x56'),_0x77ad('0x57')]},'attributes':['id','fullname',_0x77ad('0x2b'),_0x77ad('0x58'),_0x77ad('0x59'),_0x77ad('0x5a'),_0x77ad('0x5b'),_0x77ad('0x5c'),_0x77ad('0x5d'),_0x77ad('0x5e')],'order':qs[_0x77ad('0x3d')](_0x77ad('0x5f')),'include':[{'model':db['VoiceQueue'],'as':_0x77ad('0x60'),'attributes':['id',_0x77ad('0x2b'),_0x77ad('0x31')],'through':{'attributes':[]}}]})[_0x77ad('0x27')](function(_0x53dad0){if(_0x53dad0){var _0xd9c987=_0x1270f0[_0x77ad('0x57')]['get']({'plain':!![]});if(!_0xd9c987)throw new Error(_0x77ad('0x61'));if(_0xd9c987[_0x77ad('0x58')]===_0x77ad('0x57')){return db[_0x77ad('0x62')]['find']({'where':{'name':_0x77ad('0x63'),'userProfileId':_0xd9c987[_0x77ad('0x64')]},'raw':!![]})[_0x77ad('0x27')](function(_0x385b87){if(_0x385b87){if(_0x385b87[_0x77ad('0x65')]===0x0){return db['UserProfileResource'][_0x77ad('0x44')]({'where':{'sectionId':_0x385b87['id']},'raw':!![]})[_0x77ad('0x27')](function(_0x5831fa){var _0x5a71b9=[];if(_[_0x77ad('0x66')](_0x5831fa)){_0x5a71b9=_['filter'](_0x53dad0,function(_0x37d0af){if(_0x37d0af[_0x77ad('0x58')]!=='agent'){return _0x37d0af;}});return _0x5a71b9;}else{for(var _0x20579a=0x0;_0x20579a<_0x53dad0['length'];_0x20579a++){var _0x56f92f=_0x53dad0[_0x20579a];if(_0x56f92f[_0x77ad('0x58')]===_0x77ad('0x55')){var _0xa20c11=_[_0x77ad('0x48')](_0x5831fa,function(_0x3dfb9f){return _0x3dfb9f['resourceId']===_0x56f92f['id'];});if(_0xa20c11)_0x5a71b9['push'](_0x56f92f);}else{_0x5a71b9[_0x77ad('0x67')](_0x56f92f);}}return _0x5a71b9;}});}else{return _0x53dad0;}}else{var _0x4cfa61=_['filter'](_0x53dad0,function(_0x3fbd8a){if(_0x3fbd8a[_0x77ad('0x58')]!=='agent'){return _0x3fbd8a;}});return _0x4cfa61;}});}else{return _0x53dad0;}}})[_0x77ad('0x27')](function(_0x1af065){var _0x43a1e7=[];if(_0x1af065){_0x3ece47=_0x1af065;for(var _0x30991b=0x0;_0x30991b<_0x1af065[_0x77ad('0x3a')];_0x30991b+=0x1){_0x3ece47[_0x30991b][_0x77ad('0x4d')]=[];_0x43a1e7[_0x77ad('0x67')](db[_0x77ad('0x2f')][_0x77ad('0x48')]({'where':{'FromId':[_0x1270f0[_0x77ad('0x57')]['id'],_0x1af065[_0x30991b]['id']],'ToId':[_0x1270f0[_0x77ad('0x57')]['id'],_0x1af065[_0x30991b]['id']],'ChatGroupId':null},'attributes':['id',_0x77ad('0x4f'),_0x77ad('0x68'),_0x77ad('0x69'),_0x77ad('0x6a'),_0x77ad('0x4a')],'order':qs[_0x77ad('0x3d')](_0x77ad('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x1af065[_0x30991b])));}return BPromise[_0x77ad('0x6c')](_0x43a1e7);}return[];})[_0x77ad('0x27')](function(_0x23154e){return{'rows':_0x23154e,'count':_0x23154e[_0x77ad('0x3a')]};})[_0x77ad('0x27')](respondWithResult(_0x1415cb,null))['catch'](handleError(_0x1415cb,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 132c095..a846168 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 _0x4fd7=['ChatInternalMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3eacab,_0x315019){var _0x3a42be=function(_0x4dab30){while(--_0x4dab30){_0x3eacab['push'](_0x3eacab['shift']());}};_0x3a42be(++_0x315019);}(_0x4fd7,0xe6));var _0x74fd=function(_0x6d6d83,_0x46380b){_0x6d6d83=_0x6d6d83-0x0;var _0x52af18=_0x4fd7[_0x6d6d83];return _0x52af18;};'use strict';var EventEmitter=require(_0x74fd('0x0'));var ChatInternalMessage=require(_0x74fd('0x1'))['db'][_0x74fd('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x74fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x74fd('0x4')};function emitEvent(_0x29109a){return function(_0x59e3f1,_0x34f92f,_0x4a343e){ChatInternalMessageEvents[_0x74fd('0x5')](_0x29109a+':'+_0x59e3f1['id'],_0x59e3f1);ChatInternalMessageEvents['emit'](_0x29109a,_0x59e3f1);_0x4a343e(null);};}for(var e in events){if(events[_0x74fd('0x6')](e)){var event=events[e];ChatInternalMessage[_0x74fd('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xc3b5=['setMaxListeners','save','update','remove','emit','hook','exports','ChatInternalMessage'];(function(_0x3d8ee7,_0x1bd44a){var _0x7fd3dc=function(_0x54a2c5){while(--_0x54a2c5){_0x3d8ee7['push'](_0x3d8ee7['shift']());}};_0x7fd3dc(++_0x1bd44a);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x5b8155,_0x25b680){_0x5b8155=_0x5b8155-0x0;var _0x34b4df=_0xc3b5[_0x5b8155];return _0x34b4df;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x5c3b('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5c3b('0x1')](0x0);var events={'afterCreate':_0x5c3b('0x2'),'afterUpdate':_0x5c3b('0x3'),'afterDestroy':_0x5c3b('0x4')};function emitEvent(_0x34be81){return function(_0x237a61,_0x48f8a1,_0x587055){ChatInternalMessageEvents[_0x5c3b('0x5')](_0x34be81+':'+_0x237a61['id'],_0x237a61);ChatInternalMessageEvents[_0x5c3b('0x5')](_0x34be81,_0x237a61);_0x587055(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x5c3b('0x6')](e,emitEvent(event));}}module[_0x5c3b('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2d555c5..bfac777 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 _0x8835=['chat_internal_messages','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x721e9f,_0x40e826){var _0x5d2286=function(_0x4f4edd){while(--_0x4f4edd){_0x721e9f['push'](_0x721e9f['shift']());}};_0x5d2286(++_0x40e826);}(_0x8835,0x9d));var _0x5883=function(_0x59c031,_0x35ae0c){_0x59c031=_0x59c031-0x0;var _0x3c31e0=_0x8835[_0x59c031];return _0x3c31e0;};'use strict';var _=require(_0x5883('0x0'));var util=require(_0x5883('0x1'));var logger=require('../../config/logger')(_0x5883('0x2'));var moment=require(_0x5883('0x3'));var BPromise=require(_0x5883('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5883('0x5'));var rimraf=require(_0x5883('0x6'));var config=require(_0x5883('0x7'));var attributes=require(_0x5883('0x8'));module[_0x5883('0x9')]=function(_0x101172,_0x137cbe){return _0x101172[_0x5883('0xa')](_0x5883('0xb'),attributes,{'tableName':_0x5883('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2459=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatInternalMessage','utf8mb4','lodash'];(function(_0x43e5d7,_0x2b764c){var _0x330992=function(_0x11c191){while(--_0x11c191){_0x43e5d7['push'](_0x43e5d7['shift']());}};_0x330992(++_0x2b764c);}(_0x2459,0x103));var _0x9245=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x2459[_0x53056c];return _0x5cec88;};'use strict';var _=require(_0x9245('0x0'));var util=require(_0x9245('0x1'));var logger=require(_0x9245('0x2'))(_0x9245('0x3'));var moment=require(_0x9245('0x4'));var BPromise=require(_0x9245('0x5'));var rp=require(_0x9245('0x6'));var fs=require('fs');var path=require(_0x9245('0x7'));var rimraf=require(_0x9245('0x8'));var config=require(_0x9245('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x9245('0xa')]=function(_0x4ea821,_0x59f44a){return _0x4ea821['define'](_0x9245('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9245('0xc'),'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 f1cc171..d46ce67 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 _0xe596=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe596,0x152));var _0x6e59=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xe596[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0x6e59('0x0'));var moment=require(_0x6e59('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e59('0x3'))['db'];var utils=require(_0x6e59('0x4'));var logger=require(_0x6e59('0x5'))(_0x6e59('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e59('0x7'));var client=jayson[_0x6e59('0x8')][_0x6e59('0x9')]({'port':0x232a});config['redis']=_[_0x6e59('0xa')](config[_0x6e59('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e59('0xc'))(new Redis(config[_0x6e59('0xb')]));require(_0x6e59('0xd'))[_0x6e59('0xe')](socket);function respondWithRpcPromise(_0x3a6e6c,_0x5989e5,_0x4e0570){return new BPromise(function(_0x41125c,_0x4a1720){return client[_0x6e59('0xf')](_0x3a6e6c,_0x4e0570)[_0x6e59('0x10')](function(_0x1cd72d){logger[_0x6e59('0x11')](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));logger[_0x6e59('0x14')](_0x6e59('0x15'),_0x5989e5,'request\x20sent',JSON[_0x6e59('0x16')](_0x1cd72d));if(_0x1cd72d[_0x6e59('0x17')]){if(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x18')]===0x1f4){logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error'][_0x6e59('0x19')]);return _0x4a1720(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}logger[_0x6e59('0x17')](_0x6e59('0x12'),_0x5989e5,_0x1cd72d['error']['message']);return _0x41125c(_0x1cd72d[_0x6e59('0x17')][_0x6e59('0x19')]);}else{logger['info'](_0x6e59('0x12'),_0x5989e5,_0x6e59('0x13'));_0x41125c(_0x1cd72d['result']['message']);}})['catch'](function(_0x37dcd8){logger['error'](_0x6e59('0x12'),_0x5989e5,_0x37dcd8);_0x4a1720(_0x37dcd8);});});} \ No newline at end of file +var _0xe6d1=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x3340d4,_0x418571){var _0x30d830=function(_0x26df08){while(--_0x26df08){_0x3340d4['push'](_0x3340d4['shift']());}};_0x30d830(++_0x418571);}(_0xe6d1,0xbf));var _0x1e6d=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe6d1[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x1e6d('0x0'));var util=require(_0x1e6d('0x1'));var moment=require(_0x1e6d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e6d('0x3'));var db=require(_0x1e6d('0x4'))['db'];var utils=require(_0x1e6d('0x5'));var logger=require(_0x1e6d('0x6'))(_0x1e6d('0x7'));var config=require(_0x1e6d('0x8'));var jayson=require(_0x1e6d('0x9'));var client=jayson['client'][_0x1e6d('0xa')]({'port':0x232a});config[_0x1e6d('0xb')]=_[_0x1e6d('0xc')](config['redis'],{'host':_0x1e6d('0xd'),'port':0x18eb});var socket=require(_0x1e6d('0xe'))(new Redis(config['redis']));require(_0x1e6d('0xf'))[_0x1e6d('0x10')](socket);function respondWithRpcPromise(_0x35a1c0,_0x1dfecb,_0x35d20b){return new BPromise(function(_0xa2c1a1,_0x40c4ed){return client[_0x1e6d('0x11')](_0x35a1c0,_0x35d20b)[_0x1e6d('0x12')](function(_0xc04a55){logger[_0x1e6d('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1dfecb,_0x1e6d('0x14'));logger[_0x1e6d('0x15')](_0x1e6d('0x16'),_0x1dfecb,_0x1e6d('0x14'),JSON[_0x1e6d('0x17')](_0xc04a55));if(_0xc04a55[_0x1e6d('0x18')]){if(_0xc04a55[_0x1e6d('0x18')][_0x1e6d('0x19')]===0x1f4){logger[_0x1e6d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1dfecb,_0xc04a55['error']['message']);return _0x40c4ed(_0xc04a55['error']['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1dfecb,_0xc04a55[_0x1e6d('0x18')]['message']);return _0xa2c1a1(_0xc04a55[_0x1e6d('0x18')][_0x1e6d('0x1a')]);}else{logger[_0x1e6d('0x13')](_0x1e6d('0x1b'),_0x1dfecb,_0x1e6d('0x14'));_0xa2c1a1(_0xc04a55['result'][_0x1e6d('0x1a')]);}})[_0x1e6d('0x1c')](function(_0x1699f0){logger[_0x1e6d('0x18')](_0x1e6d('0x1b'),_0x1dfecb,_0x1699f0);_0x40c4ed(_0x1699f0);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f3e2007..5247023 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 _0xbe02=['remove','update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2590ac,_0x323b6b){var _0x3c6a06=function(_0x10bbf9){while(--_0x10bbf9){_0x2590ac['push'](_0x2590ac['shift']());}};_0x3c6a06(++_0x323b6b);}(_0xbe02,0x146));var _0x2be0=function(_0x2e1101,_0x515934){_0x2e1101=_0x2e1101-0x0;var _0x59d9fd=_0xbe02[_0x2e1101];return _0x59d9fd;};'use strict';var ChatInternalMessageEvents=require(_0x2be0('0x0'));var events=[_0x2be0('0x1'),_0x2be0('0x2'),_0x2be0('0x3')];function createListener(_0x56973c,_0x26aef6){return function(_0x2b34c2){_0x26aef6[_0x2be0('0x4')](_0x56973c,_0x2b34c2);};}function removeListener(_0x364c99,_0x22ed11){return function(){ChatInternalMessageEvents[_0x2be0('0x5')](_0x364c99,_0x22ed11);};}exports[_0x2be0('0x6')]=function(_0x474a35){for(var _0x39a2ca=0x0,_0x4e872c=events['length'];_0x39a2ca<_0x4e872c;_0x39a2ca++){var _0x176f12=events[_0x39a2ca];var _0xdfef68=createListener(_0x2be0('0x7')+_0x176f12,_0x474a35);ChatInternalMessageEvents['on'](_0x176f12,_0xdfef68);}}; \ No newline at end of file +var _0x495e=['chatInternalMessage:','./chatInternalMessage.events','update','removeListener','register'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x495e,0xfb));var _0xe495=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x495e[_0xbb091];return _0x467a04;};'use strict';var ChatInternalMessageEvents=require(_0xe495('0x0'));var events=['save','remove',_0xe495('0x1')];function createListener(_0x37c8ad,_0x3fe3a3){return function(_0x2c85b8){_0x3fe3a3['emit'](_0x37c8ad,_0x2c85b8);};}function removeListener(_0x3f119c,_0x442101){return function(){ChatInternalMessageEvents[_0xe495('0x2')](_0x3f119c,_0x442101);};}exports[_0xe495('0x3')]=function(_0x130db3){for(var _0x467a69=0x0,_0x101a7e=events['length'];_0x467a69<_0x101a7e;_0x467a69++){var _0x599ab4=events[_0x467a69];var _0x5c17d0=createListener(_0xe495('0x4')+_0x599ab4,_0x130db3);ChatInternalMessageEvents['on'](_0x599ab4,_0x5c17d0);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e3a6f5a..39e86cd 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x17d48d,_0x4074fb){var _0x26aee9=function(_0x13cb1e){while(--_0x13cb1e){_0x17d48d['push'](_0x17d48d['shift']());}};_0x26aee9(++_0x4074fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x8169fa,_0x5b9d1b){var _0xd86d89=function(_0x1302c5){while(--_0x1302c5){_0x8169fa['push'](_0x8169fa['shift']());}};_0xd86d89(++_0x5b9d1b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 86795c3..4557144 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 _0xd48e=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x3870fe,_0x510bd2){var _0x3fff97=function(_0x3d2514){while(--_0x3d2514){_0x3870fe['push'](_0x3870fe['shift']());}};_0x3fff97(++_0x510bd2);}(_0xd48e,0x155));var _0xed48=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xd48e[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xed48('0x0'));module[_0xed48('0x1')]={'body':{'type':Sequelize[_0xed48('0x2')](_0xed48('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xed48('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xed48('0x5')]('in',_0xed48('0x6')),'defaultValue':_0xed48('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xed48('0x7')]}}; \ No newline at end of file +var _0x5dab=['TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x2df0a4,_0x2613ba){var _0x4b3409=function(_0x1c067d){while(--_0x1c067d){_0x2df0a4['push'](_0x2df0a4['shift']());}};_0x4b3409(++_0x2613ba);}(_0x5dab,0x197));var _0xb5da=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5dab[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xb5da('0x0'));module['exports']={'body':{'type':Sequelize[_0xb5da('0x1')](_0xb5da('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb5da('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb5da('0x4')),'defaultValue':_0xb5da('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb5da('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 42e00dd..7d8b6a0 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 _0x1362=['request','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','ChatInteraction','ChatInteractionId','update','read1stAt','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','interface','SIP/%s','channel','event','accept','EventManager','parse','interaction','agent','RejectMessage','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x3287c4,_0x5a6b3e){var _0x2015ef=function(_0x269d69){while(--_0x269d69){_0x3287c4['push'](_0x3287c4['shift']());}};_0x2015ef(++_0x5a6b3e);}(_0x1362,0x1b8));var _0x2136=function(_0x19dbc6,_0x41b28a){_0x19dbc6=_0x19dbc6-0x0;var _0xf4481e=_0x1362[_0x19dbc6];return _0xf4481e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2136('0x0'));var rimraf=require(_0x2136('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2136('0x2'));var rp=require('request-promise');var moment=require(_0x2136('0x3'));var BPromise=require(_0x2136('0x4'));var Mustache=require(_0x2136('0x5'));var util=require(_0x2136('0x6'));var path=require(_0x2136('0x7'));var sox=require(_0x2136('0x8'));var csv=require(_0x2136('0x9'));var ejs=require(_0x2136('0xa'));var fs=require('fs');var _=require(_0x2136('0xb'));var squel=require(_0x2136('0xc'));var crypto=require(_0x2136('0xd'));var jsforce=require(_0x2136('0xe'));var deskjs=require(_0x2136('0xf'));var toCsv=require(_0x2136('0x9'));var querystring=require('querystring');var Papa=require(_0x2136('0x10'));var Redis=require(_0x2136('0x11'));var authService=require(_0x2136('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2136('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2136('0x14'));var utils=require('../../config/utils');var config=require(_0x2136('0x15'));var db=require('../../mysqldb')['db'];config[_0x2136('0x16')]=_[_0x2136('0x17')](config[_0x2136('0x16')],{'host':_0x2136('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2136('0x16')]));require(_0x2136('0x19'))[_0x2136('0x1a')](socket);var jayson=require(_0x2136('0x1b'));var client=jayson[_0x2136('0x1c')][_0x2136('0x1d')]({'port':0x232c});var client9002=jayson[_0x2136('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x301e22,_0x5da705,_0x2e1215){if(_0x2e1215){var _0x1a8cba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a8cba[_0x2136('0x1e')](_0x5da705)){return _0x301e22;}else{throw new db['Sequelize']['ValidationError'](_0x2136('0x1f'));}}else{return _0x301e22;}}function respondWithRpcPromise(_0x5637f8,_0x41992e,_0x3eb8b0,_0x36fe5e){return new BPromise(function(_0x575799,_0x110f75){var _0x14cdc9=_0x36fe5e||client;return _0x14cdc9[_0x2136('0x20')](_0x5637f8,_0x3eb8b0)['then'](function(_0x8ac39e){logger['info'](_0x2136('0x21'),_0x41992e,'request\x20sent');logger[_0x2136('0x22')](_0x2136('0x23'),_0x41992e,_0x2136('0x24'),JSON[_0x2136('0x25')](_0x8ac39e));if(_0x8ac39e['error']){if(_0x8ac39e[_0x2136('0x26')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x41992e,_0x8ac39e['error'][_0x2136('0x27')]);return _0x110f75(_0x8ac39e[_0x2136('0x26')][_0x2136('0x27')]);}logger[_0x2136('0x26')]('ChatMessage,\x20%s,\x20%s',_0x41992e,_0x8ac39e[_0x2136('0x26')]['message']);return _0x575799(_0x8ac39e[_0x2136('0x26')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x41992e,'request\x20sent');_0x575799(_0x8ac39e[_0x2136('0x28')][_0x2136('0x27')]);}})['catch'](function(_0x3fce52){logger[_0x2136('0x26')](_0x2136('0x21'),_0x41992e,_0x3fce52);_0x110f75(_0x3fce52);});});}function respondWithStatusCode(_0x5c25ef,_0x146d43){_0x146d43=_0x146d43||0xcc;return function(_0x21cbba){if(_0x21cbba){return _0x5c25ef['sendStatus'](_0x146d43);}return _0x5c25ef[_0x2136('0x29')](_0x146d43)[_0x2136('0x2a')]();};}function respondWithResult(_0x152b93,_0x2e34fd){_0x2e34fd=_0x2e34fd||0xc8;return function(_0x54f25f){if(_0x54f25f){return _0x152b93['status'](_0x2e34fd)['json'](_0x54f25f);}};}function respondWithFilteredResult(_0x1bec70,_0x542d4c){return function(_0xd7ec41){if(_0xd7ec41){var _0x2ed710=_0xd7ec41['count'],_0x5e41cc=_0x542d4c[_0x2136('0x2b')],_0x2464e3=_0x542d4c[_0x2136('0x2b')]+_0x542d4c[_0x2136('0x2c')],_0x2a6f4b;if(_0x2464e3>=_0x2ed710){_0x2464e3=_0x2ed710;_0x2a6f4b=0xc8;}else{_0x2a6f4b=0xce;}_0x1bec70[_0x2136('0x29')](_0x2a6f4b);return _0x1bec70[_0x2136('0x2d')](_0x2136('0x2e'),_0x5e41cc+'-'+_0x2464e3+'/'+_0x2ed710)[_0x2136('0x2f')](_0xd7ec41);}return null;};}function patchUpdates(_0x3a75ec){return function(_0x1b558a){try{jsonpatch[_0x2136('0x30')](_0x1b558a,_0x3a75ec,!![]);}catch(_0x2b9ce5){return BPromise[_0x2136('0x31')](_0x2b9ce5);}return _0x1b558a[_0x2136('0x32')]();};}function saveUpdates(_0x3f8c5d,_0x15b740){return function(_0x326507){if(_0x326507){return _0x326507['update'](_0x3f8c5d)[_0x2136('0x33')](function(_0x35c878){return _0x35c878;});}return null;};}function removeEntity(_0x53933a,_0x1d60f6){return function(_0x4da294){if(_0x4da294){return _0x4da294['destroy']()[_0x2136('0x33')](function(){_0x53933a[_0x2136('0x29')](0xcc)[_0x2136('0x2a')]();});}};}function handleEntityNotFound(_0x293d6f,_0x36882a){return function(_0x3ea323){if(!_0x3ea323){_0x293d6f['sendStatus'](0x194);}return _0x3ea323;};}function handleError(_0x4d713c,_0x15a5f3){_0x15a5f3=_0x15a5f3||0x1f4;return function(_0xa2a96e){logger['error'](_0xa2a96e['stack']);if(_0xa2a96e['name']){delete _0xa2a96e[_0x2136('0x34')];}_0x4d713c[_0x2136('0x29')](_0x15a5f3)[_0x2136('0x35')](_0xa2a96e);};}exports[_0x2136('0x36')]=function(_0x5d6bcc,_0x3e69ec){var _0x332434={},_0x170b94={},_0x2e85b1={'count':0x0,'rows':[]};var _0x27658b=_[_0x2136('0x37')](db[_0x2136('0x38')][_0x2136('0x39')],function(_0x18a739){return{'name':_0x18a739[_0x2136('0x3a')],'type':_0x18a739['type'][_0x2136('0x3b')]};});_0x170b94['model']=_[_0x2136('0x37')](_0x27658b,_0x2136('0x34'));_0x170b94[_0x2136('0x3c')]=_[_0x2136('0x3d')](_0x5d6bcc[_0x2136('0x3c')]);_0x170b94[_0x2136('0x3e')]=_[_0x2136('0x3f')](_0x170b94[_0x2136('0x40')],_0x170b94['query']);_0x332434[_0x2136('0x41')]=_[_0x2136('0x3f')](_0x170b94[_0x2136('0x40')],qs[_0x2136('0x42')](_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x42')]));_0x332434[_0x2136('0x41')]=_0x332434[_0x2136('0x41')]['length']?_0x332434['attributes']:_0x170b94['model'];if(!_0x5d6bcc['query'][_0x2136('0x43')]('nolimit')){_0x332434[_0x2136('0x2c')]=qs[_0x2136('0x2c')](_0x5d6bcc[_0x2136('0x3c')]['limit']);_0x332434[_0x2136('0x2b')]=qs['offset'](_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x2b')]);}_0x332434[_0x2136('0x44')]=qs[_0x2136('0x45')](_0x5d6bcc['query'][_0x2136('0x45')]);_0x332434[_0x2136('0x46')]=qs[_0x2136('0x3e')](_[_0x2136('0x47')](_0x5d6bcc[_0x2136('0x3c')],_0x170b94[_0x2136('0x3e')]),_0x27658b);if(_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x48')]){_0x332434[_0x2136('0x46')]=_[_0x2136('0x49')](_0x332434[_0x2136('0x46')],{'$or':_[_0x2136('0x37')](_0x27658b,function(_0x5e2b50){if(_0x5e2b50['type']!=='VIRTUAL'){var _0x3a5c15={};_0x3a5c15[_0x5e2b50[_0x2136('0x34')]]={'$like':'%'+_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x48')]+'%'};return _0x3a5c15;}})});}_0x332434=_[_0x2136('0x49')]({},_0x332434,_0x5d6bcc[_0x2136('0x4a')]);var _0x6edd15={'where':_0x332434[_0x2136('0x46')]};return db['ChatMessage'][_0x2136('0x4b')](_0x6edd15)['then'](function(_0x1cfdd2){_0x2e85b1['count']=_0x1cfdd2;if(_0x5d6bcc[_0x2136('0x3c')][_0x2136('0x4c')]){_0x332434[_0x2136('0x4d')]=[{'all':!![]}];}return db[_0x2136('0x38')][_0x2136('0x4e')](_0x332434);})[_0x2136('0x33')](function(_0x2f07b4){_0x2e85b1[_0x2136('0x4f')]=_0x2f07b4;return _0x2e85b1;})[_0x2136('0x33')](respondWithFilteredResult(_0x3e69ec,_0x332434))[_0x2136('0x50')](handleError(_0x3e69ec,null));};exports[_0x2136('0x51')]=function(_0x5a0bfd,_0x3f3dfb){var _0x53cb2f={'raw':!![],'where':{'id':_0x5a0bfd[_0x2136('0x52')]['id']}},_0x17e5f0={};_0x17e5f0[_0x2136('0x40')]=_[_0x2136('0x3d')](db[_0x2136('0x38')]['rawAttributes']);_0x17e5f0[_0x2136('0x3c')]=_[_0x2136('0x3d')](_0x5a0bfd['query']);_0x17e5f0['filters']=_['intersection'](_0x17e5f0[_0x2136('0x40')],_0x17e5f0['query']);_0x53cb2f[_0x2136('0x41')]=_['intersection'](_0x17e5f0['model'],qs[_0x2136('0x42')](_0x5a0bfd[_0x2136('0x3c')][_0x2136('0x42')]));_0x53cb2f['attributes']=_0x53cb2f[_0x2136('0x41')]['length']?_0x53cb2f[_0x2136('0x41')]:_0x17e5f0[_0x2136('0x40')];if(_0x5a0bfd[_0x2136('0x3c')]['includeAll']){_0x53cb2f[_0x2136('0x4d')]=[{'all':!![]}];}_0x53cb2f=_[_0x2136('0x49')]({},_0x53cb2f,_0x5a0bfd[_0x2136('0x4a')]);return db['ChatMessage'][_0x2136('0x53')](_0x53cb2f)[_0x2136('0x33')](handleEntityNotFound(_0x3f3dfb,null))[_0x2136('0x33')](respondWithResult(_0x3f3dfb,null))[_0x2136('0x50')](handleError(_0x3f3dfb,null));};exports[_0x2136('0x54')]=function(_0x5c0342,_0x17e70f){return db[_0x2136('0x38')][_0x2136('0x54')](_0x5c0342[_0x2136('0x55')],{})[_0x2136('0x33')](respondWithResult(_0x17e70f,0xc9))[_0x2136('0x50')](handleError(_0x17e70f,null));};exports['update']=function(_0xc81bdf,_0x2b023e){if(_0xc81bdf[_0x2136('0x55')]['id']){delete _0xc81bdf[_0x2136('0x55')]['id'];}return db['ChatMessage'][_0x2136('0x53')]({'where':{'id':_0xc81bdf['params']['id']}})[_0x2136('0x33')](handleEntityNotFound(_0x2b023e,null))['then'](saveUpdates(_0xc81bdf[_0x2136('0x55')],null))['then'](respondWithResult(_0x2b023e,null))[_0x2136('0x50')](handleError(_0x2b023e,null));};exports[_0x2136('0x56')]=function(_0x3d4123,_0x3fd5d1){return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x3d4123[_0x2136('0x52')]['id']}})['then'](handleEntityNotFound(_0x3fd5d1,null))[_0x2136('0x33')](removeEntity(_0x3fd5d1,null))[_0x2136('0x50')](handleError(_0x3fd5d1,null));};exports[_0x2136('0x57')]=function(_0x469a42,_0x16dbde){return db[_0x2136('0x38')][_0x2136('0x57')]()[_0x2136('0x33')](respondWithResult(_0x16dbde,null))[_0x2136('0x50')](handleError(_0x16dbde,null));};var interaction_log=require(_0x2136('0x58'))(_0x2136('0x59'));exports['accept']=function(_0x298acd,_0x51dfb4,_0x1d7e13){var _0x4c46da={'channel':_0x2136('0x5a')};if(_0x298acd[_0x2136('0x55')]['id']){delete _0x298acd[_0x2136('0x55')]['id'];}_0x298acd['body'][_0x2136('0x5b')]=!![];_0x298acd[_0x2136('0x55')][_0x2136('0x5c')]=moment()[_0x2136('0x5d')](_0x2136('0x5e'));_0x298acd['body'][_0x2136('0x5f')]=_0x298acd['body']['UserId']||_0x298acd['user']['id'];return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x298acd[_0x2136('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x2136('0x60')],'as':'Contact'}]})[_0x2136('0x33')](handleEntityNotFound(_0x51dfb4,null))['then'](saveUpdates(_0x298acd[_0x2136('0x55')],null))[_0x2136('0x33')](function(_0x3dd040){if(_0x3dd040){_0x4c46da[_0x2136('0x27')]=_0x3dd040[_0x2136('0x61')]({'plain':!![]});return db[_0x2136('0x62')]['find']({'where':{'id':_0x3dd040[_0x2136('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x51dfb4,null))['then'](function(_0x5d1bd2){if(_0x5d1bd2){return _0x5d1bd2[_0x2136('0x64')]({'UserId':_0x298acd[_0x2136('0x55')]['UserId'],'read1stAt':_['isNil'](_0x5d1bd2[_0x2136('0x65')])?moment()['format'](_0x2136('0x5e')):undefined});}return null;})['then'](function(_0x1d0429){if(_0x1d0429){_0x4c46da['interaction']=_0x1d0429[_0x2136('0x61')]({'plain':!![]});interaction_log[_0x2136('0x66')](_0x2136('0x67'),_0x298acd[_0x2136('0x68')]['id'],_0x298acd[_0x2136('0x68')]['name'],_0x298acd[_0x2136('0x68')][_0x2136('0x69')],_0x4c46da['interaction']['id'],_0x298acd[_0x2136('0x55')]?JSON[_0x2136('0x25')](_0x298acd[_0x2136('0x55')]):_0x2136('0x6a'));return respondWithRpcPromise(_0x2136('0x6b'),'acceptMessage',_0x4c46da);}return null;})[_0x2136('0x33')](function(_0x5d5248){if(_0x5d5248){if(_0x298acd[_0x2136('0x55')]['manual']){_0x4c46da[_0x2136('0x27')][_0x2136('0x6c')]=util[_0x2136('0x5d')](_0x2136('0x6d'),_0x298acd[_0x2136('0x68')][_0x2136('0x34')]);_0x4c46da['message'][_0x2136('0x6e')]=_0x4c46da[_0x2136('0x6e')];_0x4c46da[_0x2136('0x27')][_0x2136('0x6f')]=_0x2136('0x70');return respondWithRpcPromise('EventManager',_0x2136('0x71'),{'event':'acceptmessage','message':_[_0x2136('0x49')](_0x4c46da[_0x2136('0x27')],JSON[_0x2136('0x72')](_0x4c46da[_0x2136('0x73')]['formData']))},client9002)[_0x2136('0x33')](function(){return _0x4c46da;});}return _0x4c46da;}return null;})[_0x2136('0x33')](respondWithResult(_0x51dfb4,null))[_0x2136('0x50')](handleError(_0x51dfb4,null));};var interaction_log=require(_0x2136('0x58'))(_0x2136('0x59'));exports['reject']=function(_0x14d6f8,_0x507e26,_0x106d0d){var _0x5ad326={'agent':{},'channel':_0x2136('0x5a')};if(_0x14d6f8[_0x2136('0x55')]['id']){delete _0x14d6f8['body']['id'];}_0x14d6f8[_0x2136('0x55')][_0x2136('0x5f')]=_0x14d6f8[_0x2136('0x55')][_0x2136('0x5f')]||_0x14d6f8[_0x2136('0x68')]['id'];_0x5ad326[_0x2136('0x74')]['id']=_0x14d6f8[_0x2136('0x55')]['UserId'];return db[_0x2136('0x38')][_0x2136('0x53')]({'where':{'id':_0x14d6f8['params']['id'],'UserId':null}})[_0x2136('0x33')](handleEntityNotFound(_0x507e26,null))['then'](function(_0x4b7fc0){if(_0x4b7fc0){_0x5ad326['message']=_0x4b7fc0[_0x2136('0x61')]({'plain':!![]});return db[_0x2136('0x62')][_0x2136('0x53')]({'where':{'id':_0x4b7fc0['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x507e26,null))[_0x2136('0x33')](function(_0xb10a1f){if(_0xb10a1f){_0x5ad326[_0x2136('0x73')]=_0xb10a1f[_0x2136('0x61')]({'plain':!![]});interaction_log[_0x2136('0x66')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x14d6f8[_0x2136('0x68')]['id'],_0x14d6f8['user']['name'],_0x14d6f8[_0x2136('0x68')][_0x2136('0x69')],_0x5ad326['interaction']['id'],_0x14d6f8[_0x2136('0x55')]?JSON['stringify'](_0x14d6f8[_0x2136('0x55')]):'null');return respondWithRpcPromise(_0x2136('0x75'),'rejectMessage',_0x5ad326);}return null;})['then'](function(_0x289ca3){if(_0x289ca3){_0x289ca3[_0x2136('0x27')][_0x2136('0x6c')]=util[_0x2136('0x5d')](_0x2136('0x6d'),_0x14d6f8[_0x2136('0x68')][_0x2136('0x34')]);_0x289ca3['message'][_0x2136('0x6e')]=_0x5ad326[_0x2136('0x6e')];_0x289ca3['message'][_0x2136('0x6f')]='reject';respondWithRpcPromise('EventManager',_0x2136('0x71'),{'event':'rejectmessage','message':_0x289ca3['message']},client9002);return _0x5ad326;}return null;})[_0x2136('0x33')](respondWithResult(_0x507e26,null))['catch'](handleError(_0x507e26,null));}; \ No newline at end of file +var _0x5476=['stack','name','index','map','ChatMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','filter','options','include','findAll','show','params','rawAttributes','includeAll','find','create','body','describe','accept','chat','read','format','UserId','CmContact','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','acceptmessage','formData','../../config/logger','chat-interactions','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','rejectmessage','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','test','Sequelize','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','count','offset','set','Content-Range','apply','save','update','destroy'];(function(_0x41da1d,_0x691d6a){var _0x4aeb50=function(_0x3f3f51){while(--_0x3f3f51){_0x41da1d['push'](_0x41da1d['shift']());}};_0x4aeb50(++_0x691d6a);}(_0x5476,0xc5));var _0x6547=function(_0x3ae3c4,_0x156415){_0x3ae3c4=_0x3ae3c4-0x0;var _0x312fe2=_0x5476[_0x3ae3c4];return _0x312fe2;};'use strict';var pdf=require(_0x6547('0x0'));var emlformat=require(_0x6547('0x1'));var rimraf=require(_0x6547('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6547('0x3'));var moment=require(_0x6547('0x4'));var BPromise=require(_0x6547('0x5'));var Mustache=require(_0x6547('0x6'));var util=require(_0x6547('0x7'));var path=require('path');var sox=require(_0x6547('0x8'));var csv=require('to-csv');var ejs=require(_0x6547('0x9'));var fs=require('fs');var _=require(_0x6547('0xa'));var squel=require(_0x6547('0xb'));var crypto=require(_0x6547('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6547('0xd'));var toCsv=require(_0x6547('0xe'));var querystring=require(_0x6547('0xf'));var Papa=require(_0x6547('0x10'));var Redis=require(_0x6547('0x11'));var authService=require(_0x6547('0x12'));var qs=require(_0x6547('0x13'));var as=require(_0x6547('0x14'));var hardwareService=require(_0x6547('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6547('0x16'));var config=require(_0x6547('0x17'));var db=require(_0x6547('0x18'))['db'];config[_0x6547('0x19')]=_[_0x6547('0x1a')](config[_0x6547('0x19')],{'host':_0x6547('0x1b'),'port':0x18eb});var socket=require(_0x6547('0x1c'))(new Redis(config[_0x6547('0x19')]));require(_0x6547('0x1d'))[_0x6547('0x1e')](socket);var jayson=require(_0x6547('0x1f'));var client=jayson['client'][_0x6547('0x20')]({'port':0x232c});var client9002=jayson[_0x6547('0x21')][_0x6547('0x20')]({'port':0x232a});function checkPasswordPattern(_0x20d68e,_0x4a12fd,_0x18fa6e){if(_0x18fa6e){var _0x1c06b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c06b4[_0x6547('0x22')](_0x4a12fd)){return _0x20d68e;}else{throw new db[(_0x6547('0x23'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x20d68e;}}function respondWithRpcPromise(_0x8b740,_0x128c52,_0x4038e4,_0x5ce4ea){return new BPromise(function(_0x4be678,_0x3d7a95){var _0x4716df=_0x5ce4ea||client;return _0x4716df[_0x6547('0x24')](_0x8b740,_0x4038e4)[_0x6547('0x25')](function(_0x587234){logger[_0x6547('0x26')](_0x6547('0x27'),_0x128c52,_0x6547('0x28'));logger[_0x6547('0x29')](_0x6547('0x2a'),_0x128c52,_0x6547('0x28'),JSON[_0x6547('0x2b')](_0x587234));if(_0x587234['error']){if(_0x587234[_0x6547('0x2c')]['code']===0x1f4){logger['error'](_0x6547('0x27'),_0x128c52,_0x587234[_0x6547('0x2c')][_0x6547('0x2d')]);return _0x3d7a95(_0x587234[_0x6547('0x2c')][_0x6547('0x2d')]);}logger[_0x6547('0x2c')](_0x6547('0x27'),_0x128c52,_0x587234[_0x6547('0x2c')][_0x6547('0x2d')]);return _0x4be678(_0x587234[_0x6547('0x2c')]['message']);}else{logger[_0x6547('0x26')](_0x6547('0x27'),_0x128c52,_0x6547('0x28'));_0x4be678(_0x587234['result'][_0x6547('0x2d')]);}})[_0x6547('0x2e')](function(_0x3f225e){logger[_0x6547('0x2c')](_0x6547('0x27'),_0x128c52,_0x3f225e);_0x3d7a95(_0x3f225e);});});}function respondWithStatusCode(_0x73ec3f,_0x3a872f){_0x3a872f=_0x3a872f||0xcc;return function(_0x90c87f){if(_0x90c87f){return _0x73ec3f[_0x6547('0x2f')](_0x3a872f);}return _0x73ec3f[_0x6547('0x30')](_0x3a872f)['end']();};}function respondWithResult(_0x1c66a4,_0x284ca4){_0x284ca4=_0x284ca4||0xc8;return function(_0x2fa103){if(_0x2fa103){return _0x1c66a4[_0x6547('0x30')](_0x284ca4)['json'](_0x2fa103);}};}function respondWithFilteredResult(_0x194710,_0x4c4a88){return function(_0x28d314){if(_0x28d314){var _0x36e471=_0x28d314[_0x6547('0x31')],_0x801ff=_0x4c4a88['offset'],_0x8d024=_0x4c4a88[_0x6547('0x32')]+_0x4c4a88['limit'],_0xba0114;if(_0x8d024>=_0x36e471){_0x8d024=_0x36e471;_0xba0114=0xc8;}else{_0xba0114=0xce;}_0x194710[_0x6547('0x30')](_0xba0114);return _0x194710[_0x6547('0x33')](_0x6547('0x34'),_0x801ff+'-'+_0x8d024+'/'+_0x36e471)['json'](_0x28d314);}return null;};}function patchUpdates(_0x1da530){return function(_0x3317e3){try{jsonpatch[_0x6547('0x35')](_0x3317e3,_0x1da530,!![]);}catch(_0x98509){return BPromise['reject'](_0x98509);}return _0x3317e3[_0x6547('0x36')]();};}function saveUpdates(_0x6e59f3,_0x1a831d){return function(_0x50df3f){if(_0x50df3f){return _0x50df3f[_0x6547('0x37')](_0x6e59f3)[_0x6547('0x25')](function(_0x3ea071){return _0x3ea071;});}return null;};}function removeEntity(_0x1c414c,_0x4a1c93){return function(_0x34267e){if(_0x34267e){return _0x34267e[_0x6547('0x38')]()[_0x6547('0x25')](function(){_0x1c414c[_0x6547('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f448c,_0x4fb1ad){return function(_0x3b2aab){if(!_0x3b2aab){_0x9f448c[_0x6547('0x2f')](0x194);}return _0x3b2aab;};}function handleError(_0x4cf740,_0x5000b6){_0x5000b6=_0x5000b6||0x1f4;return function(_0x3d88aa){logger['error'](_0x3d88aa[_0x6547('0x39')]);if(_0x3d88aa[_0x6547('0x3a')]){delete _0x3d88aa[_0x6547('0x3a')];}_0x4cf740[_0x6547('0x30')](_0x5000b6)['send'](_0x3d88aa);};}exports[_0x6547('0x3b')]=function(_0x3c9fd7,_0xcb8c7f){var _0x475976={},_0x11996e={},_0x2e0ef3={'count':0x0,'rows':[]};var _0x420ea9=_[_0x6547('0x3c')](db[_0x6547('0x3d')]['rawAttributes'],function(_0x1d8433){return{'name':_0x1d8433[_0x6547('0x3e')],'type':_0x1d8433[_0x6547('0x3f')][_0x6547('0x40')]};});_0x11996e[_0x6547('0x41')]=_[_0x6547('0x3c')](_0x420ea9,'name');_0x11996e[_0x6547('0x42')]=_[_0x6547('0x43')](_0x3c9fd7[_0x6547('0x42')]);_0x11996e[_0x6547('0x44')]=_[_0x6547('0x45')](_0x11996e[_0x6547('0x41')],_0x11996e[_0x6547('0x42')]);_0x475976['attributes']=_['intersection'](_0x11996e[_0x6547('0x41')],qs[_0x6547('0x46')](_0x3c9fd7[_0x6547('0x42')][_0x6547('0x46')]));_0x475976[_0x6547('0x47')]=_0x475976[_0x6547('0x47')][_0x6547('0x48')]?_0x475976[_0x6547('0x47')]:_0x11996e[_0x6547('0x41')];if(!_0x3c9fd7[_0x6547('0x42')][_0x6547('0x49')](_0x6547('0x4a'))){_0x475976[_0x6547('0x4b')]=qs[_0x6547('0x4b')](_0x3c9fd7[_0x6547('0x42')]['limit']);_0x475976[_0x6547('0x32')]=qs['offset'](_0x3c9fd7['query'][_0x6547('0x32')]);}_0x475976[_0x6547('0x4c')]=qs['sort'](_0x3c9fd7['query'][_0x6547('0x4d')]);_0x475976['where']=qs[_0x6547('0x44')](_[_0x6547('0x4e')](_0x3c9fd7[_0x6547('0x42')],_0x11996e[_0x6547('0x44')]),_0x420ea9);if(_0x3c9fd7[_0x6547('0x42')]['filter']){_0x475976[_0x6547('0x4f')]=_[_0x6547('0x50')](_0x475976[_0x6547('0x4f')],{'$or':_[_0x6547('0x3c')](_0x420ea9,function(_0x33903f){if(_0x33903f[_0x6547('0x3f')]!=='VIRTUAL'){var _0x185658={};_0x185658[_0x33903f[_0x6547('0x3a')]]={'$like':'%'+_0x3c9fd7[_0x6547('0x42')][_0x6547('0x51')]+'%'};return _0x185658;}})});}_0x475976=_[_0x6547('0x50')]({},_0x475976,_0x3c9fd7[_0x6547('0x52')]);var _0x4c1257={'where':_0x475976[_0x6547('0x4f')]};return db[_0x6547('0x3d')][_0x6547('0x31')](_0x4c1257)[_0x6547('0x25')](function(_0x55acdb){_0x2e0ef3[_0x6547('0x31')]=_0x55acdb;if(_0x3c9fd7[_0x6547('0x42')]['includeAll']){_0x475976[_0x6547('0x53')]=[{'all':!![]}];}return db[_0x6547('0x3d')][_0x6547('0x54')](_0x475976);})[_0x6547('0x25')](function(_0x33adc5){_0x2e0ef3['rows']=_0x33adc5;return _0x2e0ef3;})[_0x6547('0x25')](respondWithFilteredResult(_0xcb8c7f,_0x475976))['catch'](handleError(_0xcb8c7f,null));};exports[_0x6547('0x55')]=function(_0x2519ea,_0xabea44){var _0x8cf291={'raw':!![],'where':{'id':_0x2519ea[_0x6547('0x56')]['id']}},_0x4d89e4={};_0x4d89e4['model']=_['keys'](db['ChatMessage'][_0x6547('0x57')]);_0x4d89e4[_0x6547('0x42')]=_['keys'](_0x2519ea['query']);_0x4d89e4['filters']=_[_0x6547('0x45')](_0x4d89e4['model'],_0x4d89e4[_0x6547('0x42')]);_0x8cf291[_0x6547('0x47')]=_[_0x6547('0x45')](_0x4d89e4[_0x6547('0x41')],qs[_0x6547('0x46')](_0x2519ea[_0x6547('0x42')]['fields']));_0x8cf291['attributes']=_0x8cf291[_0x6547('0x47')]['length']?_0x8cf291['attributes']:_0x4d89e4[_0x6547('0x41')];if(_0x2519ea[_0x6547('0x42')][_0x6547('0x58')]){_0x8cf291[_0x6547('0x53')]=[{'all':!![]}];}_0x8cf291=_[_0x6547('0x50')]({},_0x8cf291,_0x2519ea[_0x6547('0x52')]);return db[_0x6547('0x3d')][_0x6547('0x59')](_0x8cf291)[_0x6547('0x25')](handleEntityNotFound(_0xabea44,null))[_0x6547('0x25')](respondWithResult(_0xabea44,null))[_0x6547('0x2e')](handleError(_0xabea44,null));};exports[_0x6547('0x5a')]=function(_0x315c04,_0x33cfe5){return db[_0x6547('0x3d')][_0x6547('0x5a')](_0x315c04['body'],{})[_0x6547('0x25')](respondWithResult(_0x33cfe5,0xc9))[_0x6547('0x2e')](handleError(_0x33cfe5,null));};exports[_0x6547('0x37')]=function(_0x2b3c0e,_0x433ea7){if(_0x2b3c0e[_0x6547('0x5b')]['id']){delete _0x2b3c0e[_0x6547('0x5b')]['id'];}return db[_0x6547('0x3d')][_0x6547('0x59')]({'where':{'id':_0x2b3c0e[_0x6547('0x56')]['id']}})[_0x6547('0x25')](handleEntityNotFound(_0x433ea7,null))[_0x6547('0x25')](saveUpdates(_0x2b3c0e[_0x6547('0x5b')],null))[_0x6547('0x25')](respondWithResult(_0x433ea7,null))[_0x6547('0x2e')](handleError(_0x433ea7,null));};exports['destroy']=function(_0x503752,_0x2b2bfc){return db[_0x6547('0x3d')][_0x6547('0x59')]({'where':{'id':_0x503752[_0x6547('0x56')]['id']}})[_0x6547('0x25')](handleEntityNotFound(_0x2b2bfc,null))[_0x6547('0x25')](removeEntity(_0x2b2bfc,null))[_0x6547('0x2e')](handleError(_0x2b2bfc,null));};exports[_0x6547('0x5c')]=function(_0x319c7d,_0x3f0698){return db[_0x6547('0x3d')][_0x6547('0x5c')]()['then'](respondWithResult(_0x3f0698,null))[_0x6547('0x2e')](handleError(_0x3f0698,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x6547('0x5d')]=function(_0xa1d889,_0x11103f,_0x354c31){var _0x2e2e61={'channel':_0x6547('0x5e')};if(_0xa1d889[_0x6547('0x5b')]['id']){delete _0xa1d889[_0x6547('0x5b')]['id'];}_0xa1d889[_0x6547('0x5b')][_0x6547('0x5f')]=!![];_0xa1d889[_0x6547('0x5b')]['readAt']=moment()[_0x6547('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xa1d889['body'][_0x6547('0x61')]=_0xa1d889[_0x6547('0x5b')]['UserId']||_0xa1d889['user']['id'];return db['ChatMessage']['find']({'where':{'id':_0xa1d889[_0x6547('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x6547('0x62')],'as':'Contact'}]})[_0x6547('0x25')](handleEntityNotFound(_0x11103f,null))[_0x6547('0x25')](saveUpdates(_0xa1d889['body'],null))[_0x6547('0x25')](function(_0x440db4){if(_0x440db4){_0x2e2e61['message']=_0x440db4[_0x6547('0x63')]({'plain':!![]});return db[_0x6547('0x64')]['find']({'where':{'id':_0x440db4[_0x6547('0x65')]}});}return null;})[_0x6547('0x25')](handleEntityNotFound(_0x11103f,null))['then'](function(_0x53dc1a){if(_0x53dc1a){return _0x53dc1a[_0x6547('0x37')]({'UserId':_0xa1d889[_0x6547('0x5b')][_0x6547('0x61')],'read1stAt':_['isNil'](_0x53dc1a[_0x6547('0x66')])?moment()[_0x6547('0x60')](_0x6547('0x67')):undefined});}return null;})['then'](function(_0x508167){if(_0x508167){_0x2e2e61[_0x6547('0x68')]=_0x508167[_0x6547('0x63')]({'plain':!![]});interaction_log[_0x6547('0x26')](_0x6547('0x69'),_0xa1d889['user']['id'],_0xa1d889['user'][_0x6547('0x3a')],_0xa1d889[_0x6547('0x6a')][_0x6547('0x6b')],_0x2e2e61[_0x6547('0x68')]['id'],_0xa1d889['body']?JSON['stringify'](_0xa1d889[_0x6547('0x5b')]):_0x6547('0x6c'));return respondWithRpcPromise(_0x6547('0x6d'),_0x6547('0x6e'),_0x2e2e61);}return null;})[_0x6547('0x25')](function(_0x2a5090){if(_0x2a5090){if(_0xa1d889[_0x6547('0x5b')][_0x6547('0x6f')]){_0x2e2e61[_0x6547('0x2d')][_0x6547('0x70')]=util[_0x6547('0x60')](_0x6547('0x71'),_0xa1d889[_0x6547('0x6a')]['name']);_0x2e2e61['message'][_0x6547('0x72')]=_0x2e2e61[_0x6547('0x72')];_0x2e2e61['message'][_0x6547('0x73')]=_0x6547('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6547('0x74'),'message':_[_0x6547('0x50')](_0x2e2e61[_0x6547('0x2d')],JSON['parse'](_0x2e2e61['interaction'][_0x6547('0x75')]))},client9002)[_0x6547('0x25')](function(){return _0x2e2e61;});}return _0x2e2e61;}return null;})[_0x6547('0x25')](respondWithResult(_0x11103f,null))['catch'](handleError(_0x11103f,null));};var interaction_log=require(_0x6547('0x76'))(_0x6547('0x77'));exports[_0x6547('0x78')]=function(_0x292e6c,_0x4e95e0,_0x6a6ea7){var _0x1242cd={'agent':{},'channel':_0x6547('0x5e')};if(_0x292e6c[_0x6547('0x5b')]['id']){delete _0x292e6c[_0x6547('0x5b')]['id'];}_0x292e6c[_0x6547('0x5b')]['UserId']=_0x292e6c['body'][_0x6547('0x61')]||_0x292e6c[_0x6547('0x6a')]['id'];_0x1242cd[_0x6547('0x79')]['id']=_0x292e6c[_0x6547('0x5b')]['UserId'];return db[_0x6547('0x3d')]['find']({'where':{'id':_0x292e6c[_0x6547('0x56')]['id'],'UserId':null}})[_0x6547('0x25')](handleEntityNotFound(_0x4e95e0,null))[_0x6547('0x25')](function(_0x93347b){if(_0x93347b){_0x1242cd[_0x6547('0x2d')]=_0x93347b[_0x6547('0x63')]({'plain':!![]});return db[_0x6547('0x64')][_0x6547('0x59')]({'where':{'id':_0x93347b[_0x6547('0x65')]}});}return null;})[_0x6547('0x25')](handleEntityNotFound(_0x4e95e0,null))['then'](function(_0x47c819){if(_0x47c819){_0x1242cd[_0x6547('0x68')]=_0x47c819[_0x6547('0x63')]({'plain':!![]});interaction_log[_0x6547('0x26')](_0x6547('0x7a'),_0x292e6c[_0x6547('0x6a')]['id'],_0x292e6c[_0x6547('0x6a')]['name'],_0x292e6c['user'][_0x6547('0x6b')],_0x1242cd[_0x6547('0x68')]['id'],_0x292e6c['body']?JSON[_0x6547('0x2b')](_0x292e6c['body']):_0x6547('0x6c'));return respondWithRpcPromise(_0x6547('0x7b'),_0x6547('0x7c'),_0x1242cd);}return null;})[_0x6547('0x25')](function(_0x286106){if(_0x286106){_0x286106[_0x6547('0x2d')][_0x6547('0x70')]=util['format']('SIP/%s',_0x292e6c[_0x6547('0x6a')][_0x6547('0x3a')]);_0x286106[_0x6547('0x2d')][_0x6547('0x72')]=_0x1242cd[_0x6547('0x72')];_0x286106['message'][_0x6547('0x73')]='reject';respondWithRpcPromise(_0x6547('0x7d'),_0x6547('0x7d'),{'event':_0x6547('0x7e'),'message':_0x286106['message']},client9002);return _0x1242cd;}return null;})[_0x6547('0x25')](respondWithResult(_0x4e95e0,null))[_0x6547('0x2e')](handleError(_0x4e95e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8fad4db..2a3358f 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 _0xd416=['setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0xd416,0x19c));var _0x6d41=function(_0x118d84,_0x4f4071){_0x118d84=_0x118d84-0x0;var _0x3a9bf2=_0xd416[_0x118d84];return _0x3a9bf2;};'use strict';var EventEmitter=require(_0x6d41('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6d41('0x1')](0x0);var events={'afterCreate':_0x6d41('0x2'),'afterUpdate':_0x6d41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2eb193){return function(_0x14b01e,_0x1f7c37,_0x1eaebe){ChatMessageEvents[_0x6d41('0x4')](_0x2eb193+':'+_0x14b01e['id'],_0x14b01e);ChatMessageEvents['emit'](_0x2eb193,_0x14b01e);_0x1eaebe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6d41('0x5')](e,emitEvent(event));}}module[_0x6d41('0x6')]=ChatMessageEvents; \ No newline at end of file +var _0xc7f7=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x599a46,_0x59a4ec){var _0x42e18f=function(_0x2cafef){while(--_0x2cafef){_0x599a46['push'](_0x599a46['shift']());}};_0x42e18f(++_0x59a4ec);}(_0xc7f7,0x104));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7c7f('0x0'));var ChatMessage=require(_0x7c7f('0x1'))['db'][_0x7c7f('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7c7f('0x3')](0x0);var events={'afterCreate':_0x7c7f('0x4'),'afterUpdate':_0x7c7f('0x5'),'afterDestroy':_0x7c7f('0x6')};function emitEvent(_0x26304e){return function(_0x3195ba,_0x12488f,_0x2b8ce8){ChatMessageEvents[_0x7c7f('0x7')](_0x26304e+':'+_0x3195ba['id'],_0x3195ba);ChatMessageEvents[_0x7c7f('0x7')](_0x26304e,_0x3195ba);_0x2b8ce8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7c7f('0x8')](e,emitEvent(event));}}module[_0x7c7f('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a40af25..2f6c95e 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 _0x8032=['define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatMessage.attributes','exports'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x8032,0x1d7));var _0x2803=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x8032[_0x5ce3c8];return _0xa76867;};'use strict';var _=require('lodash');var util=require(_0x2803('0x0'));var logger=require(_0x2803('0x1'))(_0x2803('0x2'));var moment=require(_0x2803('0x3'));var BPromise=require(_0x2803('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2803('0x5'));var rimraf=require('rimraf');var config=require(_0x2803('0x6'));var attributes=require(_0x2803('0x7'));module[_0x2803('0x8')]=function(_0x1885d9,_0x357bef){return _0x1885d9[_0x2803('0x9')](_0x2803('0xa'),attributes,{'tableName':_0x2803('0xb'),'paranoid':![],'indexes':[{'name':_0x2803('0xc'),'fields':[_0x2803('0xd')],'type':_0x2803('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa6248a,_0x265c57,_0x45b904){var _0x2153f8=_0x1885d9[_0x2803('0xf')];var _0x3e8a46=_0xa6248a[_0x2803('0x10')]({'plain':!![]});if(_0x3e8a46[_0x2803('0x11')]['toLowerCase']()==='in'||_0x3e8a46[_0x2803('0x11')][_0x2803('0x12')]()===_0x2803('0x13')&&!_0x3e8a46[_0x2803('0x14')]&&!_[_0x2803('0x15')](_0x3e8a46[_0x2803('0x16')])){_0x2153f8[_0x2803('0x17')][_0x2803('0x18')]({'where':{'id':_0x3e8a46[_0x2803('0x19')]}})['then'](function(_0x259c9c){if(_0x259c9c){_0x259c9c[_0x2803('0x1a')]({'lastMsgAt':_0x3e8a46[_0x2803('0x1b')],'lastMsgDirection':_0x3e8a46[_0x2803('0x11')][_0x2803('0x12')]()});}})[_0x2803('0x1c')](function(_0x100b28){console['error'](_0x100b28);});}_0x45b904();}},'charset':'utf8mb4','collate':_0x2803('0x1d')});}; \ No newline at end of file +var _0xe1ee=['createdAt','error','utf8mb4_unicode_ci','moment','bluebird','path','rimraf','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update'];(function(_0x18cd61,_0x4d41d0){var _0x1a0d92=function(_0x46e2b2){while(--_0x46e2b2){_0x18cd61['push'](_0x18cd61['shift']());}};_0x1a0d92(++_0x4d41d0);}(_0xe1ee,0xbb));var _0xee1e=function(_0x25f8e3,_0x8b8dad){_0x25f8e3=_0x25f8e3-0x0;var _0x298cd5=_0xe1ee[_0x25f8e3];return _0x298cd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee1e('0x0'));var BPromise=require(_0xee1e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee1e('0x2'));var rimraf=require(_0xee1e('0x3'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module['exports']=function(_0x128527,_0x321a65){return _0x128527[_0xee1e('0x4')](_0xee1e('0x5'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xee1e('0x6'),'fields':[_0xee1e('0x7')],'type':_0xee1e('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19b7d4,_0x425a87,_0x17e399){var _0x23d6bc=_0x128527['models'];var _0x4c2ab8=_0x19b7d4[_0xee1e('0x9')]({'plain':!![]});if(_0x4c2ab8['direction'][_0xee1e('0xa')]()==='in'||_0x4c2ab8[_0xee1e('0xb')][_0xee1e('0xa')]()===_0xee1e('0xc')&&!_0x4c2ab8[_0xee1e('0xd')]&&!_[_0xee1e('0xe')](_0x4c2ab8[_0xee1e('0xf')])){_0x23d6bc['ChatInteraction'][_0xee1e('0x10')]({'where':{'id':_0x4c2ab8[_0xee1e('0x11')]}})[_0xee1e('0x12')](function(_0x30bf60){if(_0x30bf60){_0x30bf60[_0xee1e('0x13')]({'lastMsgAt':_0x4c2ab8[_0xee1e('0x14')],'lastMsgDirection':_0x4c2ab8['direction'][_0xee1e('0xa')]()});}})['catch'](function(_0x3bc340){console[_0xee1e('0x15')](_0x3bc340);});}_0x17e399();}},'charset':'utf8mb4','collate':_0xee1e('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3a71360..7d22442 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 _0x3d12=['error','code','message','result','catch','CreateChatMessage','create','body','options','raw','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x24472f,_0x469831){var _0x1f7ad1=function(_0x3e4607){while(--_0x3e4607){_0x24472f['push'](_0x24472f['shift']());}};_0x1f7ad1(++_0x469831);}(_0x3d12,0xf2));var _0x23d1=function(_0x4a2f94,_0x2dba60){_0x4a2f94=_0x4a2f94-0x0;var _0x297269=_0x3d12[_0x4a2f94];return _0x297269;};'use strict';var _=require(_0x23d1('0x0'));var util=require(_0x23d1('0x1'));var moment=require(_0x23d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x23d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23d1('0x4'))['db'];var utils=require(_0x23d1('0x5'));var logger=require(_0x23d1('0x6'))(_0x23d1('0x7'));var config=require(_0x23d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23d1('0x9')][_0x23d1('0xa')]({'port':0x232a});config[_0x23d1('0xb')]=_[_0x23d1('0xc')](config[_0x23d1('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x23d1('0xd'))(new Redis(config[_0x23d1('0xb')]));require(_0x23d1('0xe'))['register'](socket);function respondWithRpcPromise(_0x58fc59,_0x36c496,_0x307546){return new BPromise(function(_0x3b2b93,_0x1a1752){return client[_0x23d1('0xf')](_0x58fc59,_0x307546)[_0x23d1('0x10')](function(_0x35f365){logger[_0x23d1('0x11')](_0x23d1('0x12'),_0x36c496,_0x23d1('0x13'));logger[_0x23d1('0x14')](_0x23d1('0x15'),_0x36c496,'request\x20sent',JSON['stringify'](_0x35f365));if(_0x35f365[_0x23d1('0x16')]){if(_0x35f365[_0x23d1('0x16')][_0x23d1('0x17')]===0x1f4){logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x35f365[_0x23d1('0x16')]['message']);return _0x1a1752(_0x35f365[_0x23d1('0x16')][_0x23d1('0x18')]);}logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x35f365['error']['message']);return _0x3b2b93(_0x35f365[_0x23d1('0x16')]['message']);}else{logger['info'](_0x23d1('0x12'),_0x36c496,_0x23d1('0x13'));_0x3b2b93(_0x35f365[_0x23d1('0x19')][_0x23d1('0x18')]);}})[_0x23d1('0x1a')](function(_0x1ad5d1){logger[_0x23d1('0x16')](_0x23d1('0x12'),_0x36c496,_0x1ad5d1);_0x1a1752(_0x1ad5d1);});});}exports[_0x23d1('0x1b')]=function(_0x30f232){var _0x416220=this;return new Promise(function(_0x37d5a4,_0x1a3e04){return db['ChatMessage'][_0x23d1('0x1c')](_0x30f232[_0x23d1('0x1d')],{'raw':_0x30f232[_0x23d1('0x1e')]?_0x30f232[_0x23d1('0x1e')][_0x23d1('0x1f')]===undefined?!![]:![]:!![]})[_0x23d1('0x10')](function(_0x244538){logger[_0x23d1('0x11')]('CreateChatMessage',_0x30f232);logger[_0x23d1('0x14')](_0x23d1('0x1b'),_0x30f232,JSON[_0x23d1('0x20')](_0x244538));_0x37d5a4(_0x244538);})[_0x23d1('0x1a')](function(_0x5644ef){logger[_0x23d1('0x16')](_0x23d1('0x1b'),_0x5644ef['message'],_0x30f232);_0x1a3e04(_0x416220[_0x23d1('0x16')](0x1f4,_0x5644ef[_0x23d1('0x18')]));});});}; \ No newline at end of file +var _0x1ac2=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','raw'];(function(_0x49b5be,_0xe25fb5){var _0x46579a=function(_0x3d90c9){while(--_0x3d90c9){_0x49b5be['push'](_0x49b5be['shift']());}};_0x46579a(++_0xe25fb5);}(_0x1ac2,0x136));var _0x21ac=function(_0x5c0e31,_0x495a3f){_0x5c0e31=_0x5c0e31-0x0;var _0x1cc576=_0x1ac2[_0x5c0e31];return _0x1cc576;};'use strict';var _=require(_0x21ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x21ac('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21ac('0x2'));var db=require(_0x21ac('0x3'))['db'];var utils=require(_0x21ac('0x4'));var logger=require(_0x21ac('0x5'))(_0x21ac('0x6'));var config=require(_0x21ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x21ac('0x8')][_0x21ac('0x9')]({'port':0x232a});config[_0x21ac('0xa')]=_[_0x21ac('0xb')](config['redis'],{'host':_0x21ac('0xc'),'port':0x18eb});var socket=require(_0x21ac('0xd'))(new Redis(config[_0x21ac('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3e442f,_0x446446,_0x3d93cd){return new BPromise(function(_0x4f6208,_0x40577c){return client[_0x21ac('0xe')](_0x3e442f,_0x3d93cd)[_0x21ac('0xf')](function(_0x29e46a){logger['info'](_0x21ac('0x10'),_0x446446,'request\x20sent');logger[_0x21ac('0x11')](_0x21ac('0x12'),_0x446446,_0x21ac('0x13'),JSON[_0x21ac('0x14')](_0x29e46a));if(_0x29e46a[_0x21ac('0x15')]){if(_0x29e46a['error']['code']===0x1f4){logger[_0x21ac('0x15')]('ChatMessage,\x20%s,\x20%s',_0x446446,_0x29e46a[_0x21ac('0x15')]['message']);return _0x40577c(_0x29e46a['error']['message']);}logger[_0x21ac('0x15')](_0x21ac('0x10'),_0x446446,_0x29e46a[_0x21ac('0x15')][_0x21ac('0x16')]);return _0x4f6208(_0x29e46a[_0x21ac('0x15')]['message']);}else{logger[_0x21ac('0x17')](_0x21ac('0x10'),_0x446446,_0x21ac('0x13'));_0x4f6208(_0x29e46a[_0x21ac('0x18')]['message']);}})[_0x21ac('0x19')](function(_0x29eaf1){logger[_0x21ac('0x15')](_0x21ac('0x10'),_0x446446,_0x29eaf1);_0x40577c(_0x29eaf1);});});}exports[_0x21ac('0x1a')]=function(_0x41ccaf){var _0x2196c8=this;return new Promise(function(_0xe2c1a9,_0x2909c5){return db[_0x21ac('0x1b')][_0x21ac('0x1c')](_0x41ccaf[_0x21ac('0x1d')],{'raw':_0x41ccaf['options']?_0x41ccaf['options'][_0x21ac('0x1e')]===undefined?!![]:![]:!![]})[_0x21ac('0xf')](function(_0x22d21c){logger[_0x21ac('0x17')]('CreateChatMessage',_0x41ccaf);logger[_0x21ac('0x11')](_0x21ac('0x1a'),_0x41ccaf,JSON[_0x21ac('0x14')](_0x22d21c));_0xe2c1a9(_0x22d21c);})['catch'](function(_0x244e66){logger['error'](_0x21ac('0x1a'),_0x244e66['message'],_0x41ccaf);_0x2909c5(_0x2196c8[_0x21ac('0x15')](0x1f4,_0x244e66['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5c91b8e..a959789 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 _0xb016=['register','./chatMessage.events','save','emit'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0xb016,0x159));var _0x6b01=function(_0x507560,_0x4b348f){_0x507560=_0x507560-0x0;var _0x3137db=_0xb016[_0x507560];return _0x3137db;};'use strict';var ChatMessageEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){ChatMessageEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('chatMessage:'+_0x374aab,_0x65407a);ChatMessageEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file +var _0x9582=['update','emit','removeListener','register','length','./chatMessage.events','save','remove'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x9582,0x95));var _0x2958=function(_0x28191e,_0x2a27c0){_0x28191e=_0x28191e-0x0;var _0x3092de=_0x9582[_0x28191e];return _0x3092de;};'use strict';var ChatMessageEvents=require(_0x2958('0x0'));var events=[_0x2958('0x1'),_0x2958('0x2'),_0x2958('0x3')];function createListener(_0x42752c,_0x176287){return function(_0x559a01){_0x176287[_0x2958('0x4')](_0x42752c,_0x559a01);};}function removeListener(_0x3b907e,_0x136c77){return function(){ChatMessageEvents[_0x2958('0x5')](_0x3b907e,_0x136c77);};}exports[_0x2958('0x6')]=function(_0xbde128){for(var _0x88ffaa=0x0,_0x309525=events[_0x2958('0x7')];_0x88ffaa<_0x309525;_0x88ffaa++){var _0x2e571b=events[_0x88ffaa];var _0x56ca85=createListener('chatMessage:'+_0x2e571b,_0xbde128);ChatMessageEvents['on'](_0x2e571b,_0x56ca85);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 37faeac..084b300 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 _0x7e29=['show','post','tracked','chat','put','update','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x59ecf9,_0x9a29d){var _0x3c68c1=function(_0x4992c5){while(--_0x4992c5){_0x59ecf9['push'](_0x59ecf9['shift']());}};_0x3c68c1(++_0x9a29d);}(_0x7e29,0x9b));var _0x97e2=function(_0x5132c1,_0xa981d){_0x5132c1=_0x5132c1-0x0;var _0x106638=_0x7e29[_0x5132c1];return _0x106638;};'use strict';var multer=require(_0x97e2('0x0'));var util=require(_0x97e2('0x1'));var path=require('path');var timeout=require(_0x97e2('0x2'));var express=require(_0x97e2('0x3'));var router=express[_0x97e2('0x4')]();var auth=require(_0x97e2('0x5'));var interaction=require(_0x97e2('0x6'));var config=require(_0x97e2('0x7'));var controller=require('./chatMessage.controller');router[_0x97e2('0x8')]('/',auth['isAuthenticated'](),controller[_0x97e2('0x9')]);router['get']('/describe',auth[_0x97e2('0xa')](),controller[_0x97e2('0xb')]);router['get'](_0x97e2('0xc'),auth[_0x97e2('0xa')](),controller[_0x97e2('0xd')]);router[_0x97e2('0xe')]('/',auth[_0x97e2('0xa')](),interaction[_0x97e2('0xf')](_0x97e2('0x10'),'chatmessage:create'),controller['create']);router[_0x97e2('0x11')]('/:id',controller[_0x97e2('0x12')]);router[_0x97e2('0x11')](_0x97e2('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0x97e2('0x11')](_0x97e2('0x14'),auth['isAuthenticated'](),controller[_0x97e2('0x15')]);router[_0x97e2('0x16')](_0x97e2('0xc'),auth['isAuthenticated'](),controller[_0x97e2('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5dad=['index','get','/:id','tracked','chat','chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated'];(function(_0x1c2135,_0x4f6016){var _0x1e8377=function(_0x1df2b8){while(--_0x1df2b8){_0x1c2135['push'](_0x1c2135['shift']());}};_0x1e8377(++_0x4f6016);}(_0x5dad,0x1ad));var _0xd5da=function(_0x36d6a5,_0x443a64){_0x36d6a5=_0x36d6a5-0x0;var _0xb1af89=_0x5dad[_0x36d6a5];return _0xb1af89;};'use strict';var multer=require('multer');var util=require(_0xd5da('0x0'));var path=require('path');var timeout=require(_0xd5da('0x1'));var express=require('express');var router=express[_0xd5da('0x2')]();var auth=require(_0xd5da('0x3'));var interaction=require(_0xd5da('0x4'));var config=require(_0xd5da('0x5'));var controller=require(_0xd5da('0x6'));router['get']('/',auth[_0xd5da('0x7')](),controller[_0xd5da('0x8')]);router[_0xd5da('0x9')]('/describe',auth[_0xd5da('0x7')](),controller['describe']);router['get'](_0xd5da('0xa'),auth[_0xd5da('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xd5da('0xb')](_0xd5da('0xc'),_0xd5da('0xd')),controller[_0xd5da('0xe')]);router['put'](_0xd5da('0xa'),controller[_0xd5da('0xf')]);router[_0xd5da('0x10')](_0xd5da('0x11'),auth[_0xd5da('0x7')](),controller['accept']);router[_0xd5da('0x10')](_0xd5da('0x12'),auth[_0xd5da('0x7')](),controller[_0xd5da('0x13')]);router[_0xd5da('0x14')]('/:id',auth[_0xd5da('0x7')](),controller[_0xd5da('0x15')]);module[_0xd5da('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8ba2fa8..cc5d159 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 _0x19f2=['exports','TEXT','medium'];(function(_0x41c50f,_0x1b94fa){var _0x25523c=function(_0x52c06a){while(--_0x52c06a){_0x41c50f['push'](_0x41c50f['shift']());}};_0x25523c(++_0x1b94fa);}(_0x19f2,0x1ad));var _0x219f=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x19f2[_0x26a906];return _0x495575;};'use strict';var Sequelize=require('sequelize');module[_0x219f('0x0')]={'body':{'type':Sequelize[_0x219f('0x1')](_0x219f('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x3514=['sequelize','exports'];(function(_0x36f1fa,_0x3114ff){var _0x3054d5=function(_0x7d8b02){while(--_0x7d8b02){_0x36f1fa['push'](_0x36f1fa['shift']());}};_0x3054d5(++_0x3114ff);}(_0x3514,0xde));var _0x4351=function(_0xa77c1b,_0x473a68){_0xa77c1b=_0xa77c1b-0x0;var _0x3b2b36=_0x3514[_0xa77c1b];return _0x3b2b36;};'use strict';var Sequelize=require(_0x4351('0x0'));module[_0x4351('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 2dea8af..62d6b6b 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 _0xf494=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','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','sendStatus','status','end','count','offset','limit','apply','reject','update','then','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xf494,0x1c6));var _0x4f49=function(_0x5b0d30,_0x4e0eb9){_0x5b0d30=_0x5b0d30-0x0;var _0x471048=_0xf494[_0x5b0d30];return _0x471048;};'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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b9cd3,_0x12527d){_0x12527d=_0x12527d||0xcc;return function(_0x4bf89f){if(_0x4bf89f){return _0x4b9cd3[_0x4f49('0x18')](_0x12527d);}return _0x4b9cd3[_0x4f49('0x19')](_0x12527d)[_0x4f49('0x1a')]();};}function respondWithResult(_0x2efe49,_0x1a0f1e){_0x1a0f1e=_0x1a0f1e||0xc8;return function(_0x2f0131){if(_0x2f0131){return _0x2efe49[_0x4f49('0x19')](_0x1a0f1e)['json'](_0x2f0131);}};}function respondWithFilteredResult(_0x515ace,_0x1f2d0d){return function(_0x415e83){if(_0x415e83){var _0x5878f4=_0x415e83[_0x4f49('0x1b')],_0x5bdfaf=_0x1f2d0d['offset'],_0x2f0a0d=_0x1f2d0d[_0x4f49('0x1c')]+_0x1f2d0d[_0x4f49('0x1d')],_0x2ecaaa;if(_0x2f0a0d>=_0x5878f4){_0x2f0a0d=_0x5878f4;_0x2ecaaa=0xc8;}else{_0x2ecaaa=0xce;}_0x515ace[_0x4f49('0x19')](_0x2ecaaa);return _0x515ace['set']('Content-Range',_0x5bdfaf+'-'+_0x2f0a0d+'/'+_0x5878f4)['json'](_0x415e83);}return null;};}function patchUpdates(_0x47f1e8){return function(_0xb2081a){try{jsonpatch[_0x4f49('0x1e')](_0xb2081a,_0x47f1e8,!![]);}catch(_0x1c2d70){return BPromise[_0x4f49('0x1f')](_0x1c2d70);}return _0xb2081a['save']();};}function saveUpdates(_0x416893,_0x2aed27){return function(_0x197a49){if(_0x197a49){return _0x197a49[_0x4f49('0x20')](_0x416893)[_0x4f49('0x21')](function(_0x509f7c){return _0x509f7c;});}return null;};}function removeEntity(_0x3e7e28,_0x357446){return function(_0x3ae590){if(_0x3ae590){return _0x3ae590['destroy']()[_0x4f49('0x21')](function(){_0x3e7e28[_0x4f49('0x19')](0xcc)[_0x4f49('0x1a')]();});}};}function handleEntityNotFound(_0x43c458,_0x9d30aa){return function(_0x36187b){if(!_0x36187b){_0x43c458['sendStatus'](0x194);}return _0x36187b;};}function handleError(_0x4e9041,_0x3a947b){_0x3a947b=_0x3a947b||0x1f4;return function(_0x429de7){logger['error'](_0x429de7[_0x4f49('0x22')]);if(_0x429de7[_0x4f49('0x23')]){delete _0x429de7[_0x4f49('0x23')];}_0x4e9041['status'](_0x3a947b)[_0x4f49('0x24')](_0x429de7);};}exports[_0x4f49('0x25')]=function(_0x298785,_0x148153){var _0xfefbab={},_0x122404={},_0x4915af={'count':0x0,'rows':[]};var _0x50c571=_[_0x4f49('0x26')](db[_0x4f49('0x27')][_0x4f49('0x28')],function(_0x560050){return{'name':_0x560050[_0x4f49('0x29')],'type':_0x560050[_0x4f49('0x2a')][_0x4f49('0x2b')]};});_0x122404['model']=_['map'](_0x50c571,_0x4f49('0x23'));_0x122404[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x298785['query']);_0x122404[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],_0x122404[_0x4f49('0x2c')]);_0xfefbab[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x122404[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x32')]));_0xfefbab[_0x4f49('0x31')]=_0xfefbab[_0x4f49('0x31')][_0x4f49('0x33')]?_0xfefbab[_0x4f49('0x31')]:_0x122404[_0x4f49('0x30')];if(!_0x298785[_0x4f49('0x2c')][_0x4f49('0x34')](_0x4f49('0x35'))){_0xfefbab[_0x4f49('0x1d')]=qs['limit'](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1d')]);_0xfefbab[_0x4f49('0x1c')]=qs[_0x4f49('0x1c')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x1c')]);}_0xfefbab[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x298785[_0x4f49('0x2c')][_0x4f49('0x37')]);_0xfefbab[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_[_0x4f49('0x39')](_0x298785['query'],_0x122404[_0x4f49('0x2e')]),_0x50c571);if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]){_0xfefbab[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0xfefbab[_0x4f49('0x38')],{'$or':_[_0x4f49('0x26')](_0x50c571,function(_0x25fdf8){if(_0x25fdf8[_0x4f49('0x2a')]!==_0x4f49('0x3c')){var _0x173b6e={};_0x173b6e[_0x25fdf8[_0x4f49('0x23')]]={'$like':'%'+_0x298785[_0x4f49('0x2c')][_0x4f49('0x3a')]+'%'};return _0x173b6e;}})});}_0xfefbab=_['merge']({},_0xfefbab,_0x298785[_0x4f49('0x3d')]);var _0xb0e6c2={'where':_0xfefbab['where']};return db[_0x4f49('0x27')][_0x4f49('0x1b')](_0xb0e6c2)['then'](function(_0x29e762){_0x4915af[_0x4f49('0x1b')]=_0x29e762;if(_0x298785[_0x4f49('0x2c')][_0x4f49('0x3e')]){_0xfefbab[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x27')][_0x4f49('0x40')](_0xfefbab);})['then'](function(_0x5e1461){_0x4915af['rows']=_0x5e1461;return _0x4915af;})[_0x4f49('0x21')](respondWithFilteredResult(_0x148153,_0xfefbab))[_0x4f49('0x41')](handleError(_0x148153,null));};exports[_0x4f49('0x42')]=function(_0x373f90,_0x1053b2){var _0x1ecf6c={'raw':!![],'where':{'id':_0x373f90[_0x4f49('0x43')]['id']}},_0x38aff8={};_0x38aff8[_0x4f49('0x30')]=_['keys'](db['ChatOfflineMessage'][_0x4f49('0x28')]);_0x38aff8[_0x4f49('0x2c')]=_[_0x4f49('0x2d')](_0x373f90['query']);_0x38aff8[_0x4f49('0x2e')]=_['intersection'](_0x38aff8['model'],_0x38aff8[_0x4f49('0x2c')]);_0x1ecf6c[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x38aff8['model'],qs[_0x4f49('0x32')](_0x373f90[_0x4f49('0x2c')]['fields']));_0x1ecf6c[_0x4f49('0x31')]=_0x1ecf6c['attributes'][_0x4f49('0x33')]?_0x1ecf6c[_0x4f49('0x31')]:_0x38aff8[_0x4f49('0x30')];if(_0x373f90['query'][_0x4f49('0x3e')]){_0x1ecf6c[_0x4f49('0x3f')]=[{'all':!![]}];}_0x1ecf6c=_[_0x4f49('0x3b')]({},_0x1ecf6c,_0x373f90[_0x4f49('0x3d')]);return db[_0x4f49('0x27')][_0x4f49('0x44')](_0x1ecf6c)[_0x4f49('0x21')](handleEntityNotFound(_0x1053b2,null))[_0x4f49('0x21')](respondWithResult(_0x1053b2,null))[_0x4f49('0x41')](handleError(_0x1053b2,null));};exports[_0x4f49('0x45')]=function(_0x4fe382,_0x26c222){return db[_0x4f49('0x27')]['create'](_0x4fe382[_0x4f49('0x46')],{})['then'](respondWithResult(_0x26c222,0xc9))[_0x4f49('0x41')](handleError(_0x26c222,null));};exports[_0x4f49('0x20')]=function(_0x2d3dcd,_0x300230){if(_0x2d3dcd['body']['id']){delete _0x2d3dcd[_0x4f49('0x46')]['id'];}return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x2d3dcd[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x300230,null))[_0x4f49('0x21')](saveUpdates(_0x2d3dcd[_0x4f49('0x46')],null))[_0x4f49('0x21')](respondWithResult(_0x300230,null))[_0x4f49('0x41')](handleError(_0x300230,null));};exports[_0x4f49('0x47')]=function(_0x1be59a,_0x4482f7){return db[_0x4f49('0x27')][_0x4f49('0x44')]({'where':{'id':_0x1be59a[_0x4f49('0x43')]['id']}})[_0x4f49('0x21')](handleEntityNotFound(_0x4482f7,null))['then'](removeEntity(_0x4482f7,null))['catch'](handleError(_0x4482f7,null));};exports[_0x4f49('0x48')]=function(_0x197670,_0x36bcc2){return db[_0x4f49('0x27')][_0x4f49('0x48')]()[_0x4f49('0x21')](respondWithResult(_0x36bcc2,null))[_0x4f49('0x41')](handleError(_0x36bcc2,null));}; \ No newline at end of file +var _0xb4c7=['map','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x42fa73,_0x4dfe78){var _0x5168a4=function(_0x37ad88){while(--_0x37ad88){_0x42fa73['push'](_0x42fa73['shift']());}};_0x5168a4(++_0x4dfe78);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x507fcc,_0x4f8308){_0x507fcc=_0x507fcc-0x0;var _0x2eeafa=_0xb4c7[_0x507fcc];return _0x2eeafa;};'use strict';var pdf=require(_0x7b4c('0x0'));var emlformat=require(_0x7b4c('0x1'));var rimraf=require(_0x7b4c('0x2'));var zipdir=require(_0x7b4c('0x3'));var jsonpatch=require(_0x7b4c('0x4'));var rp=require('request-promise');var moment=require(_0x7b4c('0x5'));var BPromise=require(_0x7b4c('0x6'));var Mustache=require(_0x7b4c('0x7'));var util=require(_0x7b4c('0x8'));var path=require(_0x7b4c('0x9'));var sox=require('sox');var csv=require(_0x7b4c('0xa'));var ejs=require(_0x7b4c('0xb'));var fs=require('fs');var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xa'));var querystring=require(_0x7b4c('0xf'));var Papa=require(_0x7b4c('0x10'));var Redis=require(_0x7b4c('0x11'));var authService=require(_0x7b4c('0x12'));var qs=require(_0x7b4c('0x13'));var as=require(_0x7b4c('0x14'));var hardwareService=require(_0x7b4c('0x15'));var logger=require(_0x7b4c('0x16'))(_0x7b4c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7b4c('0x18'))['db'];function respondWithStatusCode(_0x18342b,_0x38656b){_0x38656b=_0x38656b||0xcc;return function(_0x1722ad){if(_0x1722ad){return _0x18342b[_0x7b4c('0x19')](_0x38656b);}return _0x18342b[_0x7b4c('0x1a')](_0x38656b)[_0x7b4c('0x1b')]();};}function respondWithResult(_0x40c830,_0x25b90b){_0x25b90b=_0x25b90b||0xc8;return function(_0x387488){if(_0x387488){return _0x40c830['status'](_0x25b90b)[_0x7b4c('0x1c')](_0x387488);}};}function respondWithFilteredResult(_0x3d8362,_0xdc71cd){return function(_0x2a0e2f){if(_0x2a0e2f){var _0xa0a812=_0x2a0e2f['count'],_0x2471b3=_0xdc71cd[_0x7b4c('0x1d')],_0x1642e1=_0xdc71cd[_0x7b4c('0x1d')]+_0xdc71cd[_0x7b4c('0x1e')],_0x22c409;if(_0x1642e1>=_0xa0a812){_0x1642e1=_0xa0a812;_0x22c409=0xc8;}else{_0x22c409=0xce;}_0x3d8362[_0x7b4c('0x1a')](_0x22c409);return _0x3d8362['set'](_0x7b4c('0x1f'),_0x2471b3+'-'+_0x1642e1+'/'+_0xa0a812)[_0x7b4c('0x1c')](_0x2a0e2f);}return null;};}function patchUpdates(_0x32110e){return function(_0x380b79){try{jsonpatch[_0x7b4c('0x20')](_0x380b79,_0x32110e,!![]);}catch(_0x1363b4){return BPromise[_0x7b4c('0x21')](_0x1363b4);}return _0x380b79[_0x7b4c('0x22')]();};}function saveUpdates(_0x3556d8,_0x55e3df){return function(_0x1f06ec){if(_0x1f06ec){return _0x1f06ec[_0x7b4c('0x23')](_0x3556d8)[_0x7b4c('0x24')](function(_0xabeffb){return _0xabeffb;});}return null;};}function removeEntity(_0x148a79,_0x168ac9){return function(_0x176704){if(_0x176704){return _0x176704[_0x7b4c('0x25')]()[_0x7b4c('0x24')](function(){_0x148a79[_0x7b4c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45438c,_0x4350c9){return function(_0x276271){if(!_0x276271){_0x45438c[_0x7b4c('0x19')](0x194);}return _0x276271;};}function handleError(_0x3124e7,_0x2bdc4d){_0x2bdc4d=_0x2bdc4d||0x1f4;return function(_0x37c059){logger[_0x7b4c('0x26')](_0x37c059[_0x7b4c('0x27')]);if(_0x37c059[_0x7b4c('0x28')]){delete _0x37c059[_0x7b4c('0x28')];}_0x3124e7[_0x7b4c('0x1a')](_0x2bdc4d)[_0x7b4c('0x29')](_0x37c059);};}exports['index']=function(_0x27f361,_0x3ab614){var _0x1fe0f5={},_0x3671c4={},_0x207c2f={'count':0x0,'rows':[]};var _0x4ce02c=_[_0x7b4c('0x2a')](db[_0x7b4c('0x2b')][_0x7b4c('0x2c')],function(_0x9a799b){return{'name':_0x9a799b[_0x7b4c('0x2d')],'type':_0x9a799b[_0x7b4c('0x2e')][_0x7b4c('0x2f')]};});_0x3671c4[_0x7b4c('0x30')]=_[_0x7b4c('0x2a')](_0x4ce02c,_0x7b4c('0x28'));_0x3671c4[_0x7b4c('0x31')]=_[_0x7b4c('0x32')](_0x27f361[_0x7b4c('0x31')]);_0x3671c4['filters']=_['intersection'](_0x3671c4['model'],_0x3671c4[_0x7b4c('0x31')]);_0x1fe0f5[_0x7b4c('0x33')]=_[_0x7b4c('0x34')](_0x3671c4[_0x7b4c('0x30')],qs['fields'](_0x27f361[_0x7b4c('0x31')][_0x7b4c('0x35')]));_0x1fe0f5['attributes']=_0x1fe0f5[_0x7b4c('0x33')]['length']?_0x1fe0f5[_0x7b4c('0x33')]:_0x3671c4[_0x7b4c('0x30')];if(!_0x27f361[_0x7b4c('0x31')]['hasOwnProperty'](_0x7b4c('0x36'))){_0x1fe0f5[_0x7b4c('0x1e')]=qs['limit'](_0x27f361[_0x7b4c('0x31')][_0x7b4c('0x1e')]);_0x1fe0f5[_0x7b4c('0x1d')]=qs[_0x7b4c('0x1d')](_0x27f361['query']['offset']);}_0x1fe0f5[_0x7b4c('0x37')]=qs[_0x7b4c('0x38')](_0x27f361['query'][_0x7b4c('0x38')]);_0x1fe0f5['where']=qs['filters'](_[_0x7b4c('0x39')](_0x27f361[_0x7b4c('0x31')],_0x3671c4[_0x7b4c('0x3a')]),_0x4ce02c);if(_0x27f361[_0x7b4c('0x31')]['filter']){_0x1fe0f5[_0x7b4c('0x3b')]=_[_0x7b4c('0x3c')](_0x1fe0f5[_0x7b4c('0x3b')],{'$or':_[_0x7b4c('0x2a')](_0x4ce02c,function(_0x346e0c){if(_0x346e0c[_0x7b4c('0x2e')]!==_0x7b4c('0x3d')){var _0x4c23cc={};_0x4c23cc[_0x346e0c['name']]={'$like':'%'+_0x27f361[_0x7b4c('0x31')][_0x7b4c('0x3e')]+'%'};return _0x4c23cc;}})});}_0x1fe0f5=_[_0x7b4c('0x3c')]({},_0x1fe0f5,_0x27f361[_0x7b4c('0x3f')]);var _0xb8486d={'where':_0x1fe0f5['where']};return db[_0x7b4c('0x2b')][_0x7b4c('0x40')](_0xb8486d)[_0x7b4c('0x24')](function(_0x26346a){_0x207c2f[_0x7b4c('0x40')]=_0x26346a;if(_0x27f361[_0x7b4c('0x31')][_0x7b4c('0x41')]){_0x1fe0f5[_0x7b4c('0x42')]=[{'all':!![]}];}return db[_0x7b4c('0x2b')]['findAll'](_0x1fe0f5);})[_0x7b4c('0x24')](function(_0x562838){_0x207c2f[_0x7b4c('0x43')]=_0x562838;return _0x207c2f;})['then'](respondWithFilteredResult(_0x3ab614,_0x1fe0f5))[_0x7b4c('0x44')](handleError(_0x3ab614,null));};exports[_0x7b4c('0x45')]=function(_0x5bb6d0,_0x50f2ed){var _0x354578={'raw':!![],'where':{'id':_0x5bb6d0[_0x7b4c('0x46')]['id']}},_0x4314b6={};_0x4314b6[_0x7b4c('0x30')]=_['keys'](db[_0x7b4c('0x2b')][_0x7b4c('0x2c')]);_0x4314b6[_0x7b4c('0x31')]=_['keys'](_0x5bb6d0[_0x7b4c('0x31')]);_0x4314b6['filters']=_['intersection'](_0x4314b6[_0x7b4c('0x30')],_0x4314b6['query']);_0x354578[_0x7b4c('0x33')]=_[_0x7b4c('0x34')](_0x4314b6[_0x7b4c('0x30')],qs[_0x7b4c('0x35')](_0x5bb6d0[_0x7b4c('0x31')][_0x7b4c('0x35')]));_0x354578[_0x7b4c('0x33')]=_0x354578[_0x7b4c('0x33')][_0x7b4c('0x47')]?_0x354578['attributes']:_0x4314b6[_0x7b4c('0x30')];if(_0x5bb6d0['query']['includeAll']){_0x354578[_0x7b4c('0x42')]=[{'all':!![]}];}_0x354578=_[_0x7b4c('0x3c')]({},_0x354578,_0x5bb6d0['options']);return db['ChatOfflineMessage'][_0x7b4c('0x48')](_0x354578)[_0x7b4c('0x24')](handleEntityNotFound(_0x50f2ed,null))[_0x7b4c('0x24')](respondWithResult(_0x50f2ed,null))[_0x7b4c('0x44')](handleError(_0x50f2ed,null));};exports[_0x7b4c('0x49')]=function(_0x4759e9,_0x336796){return db[_0x7b4c('0x2b')]['create'](_0x4759e9[_0x7b4c('0x4a')],{})[_0x7b4c('0x24')](respondWithResult(_0x336796,0xc9))[_0x7b4c('0x44')](handleError(_0x336796,null));};exports[_0x7b4c('0x23')]=function(_0xc76435,_0x379f15){if(_0xc76435[_0x7b4c('0x4a')]['id']){delete _0xc76435[_0x7b4c('0x4a')]['id'];}return db[_0x7b4c('0x2b')]['find']({'where':{'id':_0xc76435['params']['id']}})[_0x7b4c('0x24')](handleEntityNotFound(_0x379f15,null))[_0x7b4c('0x24')](saveUpdates(_0xc76435[_0x7b4c('0x4a')],null))['then'](respondWithResult(_0x379f15,null))[_0x7b4c('0x44')](handleError(_0x379f15,null));};exports[_0x7b4c('0x25')]=function(_0x5ddf41,_0x1d82ee){return db['ChatOfflineMessage'][_0x7b4c('0x48')]({'where':{'id':_0x5ddf41['params']['id']}})[_0x7b4c('0x24')](handleEntityNotFound(_0x1d82ee,null))['then'](removeEntity(_0x1d82ee,null))[_0x7b4c('0x44')](handleError(_0x1d82ee,null));};exports[_0x7b4c('0x4b')]=function(_0x51f9a8,_0x585f8f){return db[_0x7b4c('0x2b')][_0x7b4c('0x4b')]()[_0x7b4c('0x24')](respondWithResult(_0x585f8f,null))['catch'](handleError(_0x585f8f,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e05048e..51387d9 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 _0x9037=['bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4_unicode_ci','util','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9037,0xd9));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7903('0x0'));var logger=require('../../config/logger')(_0x7903('0x1'));var moment=require(_0x7903('0x2'));var BPromise=require(_0x7903('0x3'));var rp=require(_0x7903('0x4'));var fs=require('fs');var path=require(_0x7903('0x5'));var rimraf=require(_0x7903('0x6'));var config=require(_0x7903('0x7'));var attributes=require(_0x7903('0x8'));module['exports']=function(_0x24239f,_0x2ea219){return _0x24239f[_0x7903('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7903('0xa')});}; \ No newline at end of file +var _0x9e68=['rimraf','../../config/environment','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0x9e68,0x112));var _0x89e6=function(_0x21b634,_0x5e5152){_0x21b634=_0x21b634-0x0;var _0x3e4f35=_0x9e68[_0x21b634];return _0x3e4f35;};'use strict';var _=require(_0x89e6('0x0'));var util=require(_0x89e6('0x1'));var logger=require('../../config/logger')(_0x89e6('0x2'));var moment=require(_0x89e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x89e6('0x4'));var fs=require('fs');var path=require(_0x89e6('0x5'));var rimraf=require(_0x89e6('0x6'));var config=require(_0x89e6('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0x89e6('0x8')]=function(_0x22cc90,_0x59656e){return _0x22cc90[_0x89e6('0x9')](_0x89e6('0xa'),attributes,{'tableName':_0x89e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89e6('0xc'),'collate':_0x89e6('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 33b3f3e..c990263 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 _0xf212=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis'];(function(_0xd7845b,_0x3d84e8){var _0x53a9df=function(_0x58b910){while(--_0x58b910){_0xd7845b['push'](_0xd7845b['shift']());}};_0x53a9df(++_0x3d84e8);}(_0xf212,0x122));var _0x2f21=function(_0x294ff8,_0x51a22e){_0x294ff8=_0x294ff8-0x0;var _0x7e3eb7=_0xf212[_0x294ff8];return _0x7e3eb7;};'use strict';var _=require(_0x2f21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f21('0x1'));var rs=require(_0x2f21('0x2'));var fs=require('fs');var Redis=require(_0x2f21('0x3'));var db=require(_0x2f21('0x4'))['db'];var utils=require(_0x2f21('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f21('0x6'));var jayson=require(_0x2f21('0x7'));var client=jayson[_0x2f21('0x8')][_0x2f21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6d0d82,_0xa0021e,_0x44006e){return new BPromise(function(_0x2e5915,_0x5090d5){return client[_0x2f21('0xa')](_0x6d0d82,_0x44006e)[_0x2f21('0xb')](function(_0x35d8cb){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,_0x2f21('0xc'));logger[_0x2f21('0xd')](_0x2f21('0xe'),_0xa0021e,'request\x20sent',JSON[_0x2f21('0xf')](_0x35d8cb));if(_0x35d8cb[_0x2f21('0x10')]){if(_0x35d8cb[_0x2f21('0x10')]['code']===0x1f4){logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);return _0x5090d5(_0x35d8cb['error'][_0x2f21('0x12')]);}logger[_0x2f21('0x10')](_0x2f21('0x11'),_0xa0021e,_0x35d8cb[_0x2f21('0x10')]['message']);return _0x2e5915(_0x35d8cb[_0x2f21('0x10')][_0x2f21('0x12')]);}else{logger[_0x2f21('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0xa0021e,'request\x20sent');_0x2e5915(_0x35d8cb['result'][_0x2f21('0x12')]);}})[_0x2f21('0x14')](function(_0x2ff624){logger['error'](_0x2f21('0x11'),_0xa0021e,_0x2ff624);_0x5090d5(_0x2ff624);});});} \ No newline at end of file +var _0x0558=['catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2f5c99,_0x191861){var _0x1f851e=function(_0x4c4d61){while(--_0x4c4d61){_0x2f5c99['push'](_0x2f5c99['shift']());}};_0x1f851e(++_0x191861);}(_0x0558,0x105));var _0x8055=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x0558[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x8055('0x0'));var util=require('util');var moment=require(_0x8055('0x1'));var BPromise=require(_0x8055('0x2'));var rs=require(_0x8055('0x3'));var fs=require('fs');var Redis=require(_0x8055('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8055('0x5'));var config=require(_0x8055('0x6'));var jayson=require(_0x8055('0x7'));var client=jayson[_0x8055('0x8')][_0x8055('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19a38d,_0x4556b0,_0x2d8861){return new BPromise(function(_0x393dfd,_0x4af7e5){return client[_0x8055('0xa')](_0x19a38d,_0x2d8861)['then'](function(_0x43ad41){logger[_0x8055('0xb')](_0x8055('0xc'),_0x4556b0,_0x8055('0xd'));logger['debug'](_0x8055('0xe'),_0x4556b0,_0x8055('0xd'),JSON['stringify'](_0x43ad41));if(_0x43ad41[_0x8055('0xf')]){if(_0x43ad41[_0x8055('0xf')][_0x8055('0x10')]===0x1f4){logger['error'](_0x8055('0xc'),_0x4556b0,_0x43ad41['error'][_0x8055('0x11')]);return _0x4af7e5(_0x43ad41[_0x8055('0xf')][_0x8055('0x11')]);}logger[_0x8055('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4556b0,_0x43ad41[_0x8055('0xf')][_0x8055('0x11')]);return _0x393dfd(_0x43ad41['error'][_0x8055('0x11')]);}else{logger[_0x8055('0xb')](_0x8055('0xc'),_0x4556b0,'request\x20sent');_0x393dfd(_0x43ad41[_0x8055('0x12')][_0x8055('0x11')]);}})[_0x8055('0x13')](function(_0x5313b8){logger[_0x8055('0xf')](_0x8055('0xc'),_0x4556b0,_0x5313b8);_0x4af7e5(_0x5313b8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 346a78b..c443249 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 _0x2d7e=['index','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x1cf6dc,_0x521c93){var _0x56d1cf=function(_0x43fd2a){while(--_0x43fd2a){_0x1cf6dc['push'](_0x1cf6dc['shift']());}};_0x56d1cf(++_0x521c93);}(_0x2d7e,0xe6));var _0xe2d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d7e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe2d7('0x0'));var util=require(_0xe2d7('0x1'));var path=require(_0xe2d7('0x2'));var timeout=require(_0xe2d7('0x3'));var express=require(_0xe2d7('0x4'));var router=express[_0xe2d7('0x5')]();var auth=require(_0xe2d7('0x6'));var interaction=require(_0xe2d7('0x7'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xe2d7('0x8')]('/',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xa')]);router[_0xe2d7('0x8')]('/describe',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xb')]);router[_0xe2d7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe2d7('0xc')]);router[_0xe2d7('0xd')]('/',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0xe')]);router[_0xe2d7('0xf')](_0xe2d7('0x10'),auth[_0xe2d7('0x9')](),controller[_0xe2d7('0x11')]);router['delete']('/:id',auth[_0xe2d7('0x9')](),controller[_0xe2d7('0x12')]);module[_0xe2d7('0x13')]=router; \ No newline at end of file +var _0x2142=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2142,0x1c1));var _0x2214=function(_0x4c78ee,_0x1202fa){_0x4c78ee=_0x4c78ee-0x0;var _0x1124b8=_0x2142[_0x4c78ee];return _0x1124b8;};'use strict';var multer=require(_0x2214('0x0'));var util=require(_0x2214('0x1'));var path=require('path');var timeout=require(_0x2214('0x2'));var express=require(_0x2214('0x3'));var router=express[_0x2214('0x4')]();var auth=require(_0x2214('0x5'));var interaction=require(_0x2214('0x6'));var config=require(_0x2214('0x7'));var controller=require(_0x2214('0x8'));router[_0x2214('0x9')]('/',auth[_0x2214('0xa')](),controller['index']);router[_0x2214('0x9')](_0x2214('0xb'),auth['isAuthenticated'](),controller[_0x2214('0xc')]);router[_0x2214('0x9')](_0x2214('0xd'),auth['isAuthenticated'](),controller[_0x2214('0xe')]);router['post']('/',auth[_0x2214('0xa')](),controller['create']);router['put'](_0x2214('0xd'),auth[_0x2214('0xa')](),controller[_0x2214('0xf')]);router[_0x2214('0x10')](_0x2214('0xd'),auth[_0x2214('0xa')](),controller[_0x2214('0x11')]);module[_0x2214('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a318c9e..a4aaf64 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 _0x8cfe=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x334b65,_0x15a867){var _0x206cb5=function(_0x1647b6){while(--_0x1647b6){_0x334b65['push'](_0x334b65['shift']());}};_0x206cb5(++_0x15a867);}(_0x8cfe,0xaa));var _0xe8cf=function(_0x3f641c,_0x2f0aef){_0x3f641c=_0x3f641c-0x0;var _0x28af41=_0x8cfe[_0x3f641c];return _0x28af41;};'use strict';var Sequelize=require(_0xe8cf('0x0'));module[_0xe8cf('0x1')]={'name':{'type':Sequelize[_0xe8cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe8cf('0x3')](_0xe8cf('0x4'),_0xe8cf('0x5')),'defaultValue':_0xe8cf('0x4')},'selector':{'type':Sequelize[_0xe8cf('0x2')]},'timeout':{'type':Sequelize[_0xe8cf('0x6')]}}; \ No newline at end of file +var _0xe90a=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xe90a,0x1c8));var _0xae90=function(_0x4e36f4,_0x261ad8){_0x4e36f4=_0x4e36f4-0x0;var _0xeecf66=_0xe90a[_0x4e36f4];return _0xeecf66;};'use strict';var Sequelize=require('sequelize');module[_0xae90('0x0')]={'name':{'type':Sequelize[_0xae90('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xae90('0x2')](_0xae90('0x3'),_0xae90('0x4')),'defaultValue':_0xae90('0x3')},'selector':{'type':Sequelize[_0xae90('0x1')]},'timeout':{'type':Sequelize[_0xae90('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 82fd702..1587a0e 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 _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x8b3690,_0x56f97f){var _0x5cea29=function(_0x279487){while(--_0x279487){_0x8b3690['push'](_0x8b3690['shift']());}};_0x5cea29(++_0x56f97f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file +var _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0xcb91[_0x1a809b];return _0x5d90e6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1381dce..11eae4b 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 _0x2c1d=['ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define'];(function(_0x582501,_0x14d823){var _0x5b9392=function(_0x163049){while(--_0x163049){_0x582501['push'](_0x582501['shift']());}};_0x5b9392(++_0x14d823);}(_0x2c1d,0xf3));var _0xd2c1=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2c1d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd2c1('0x0'));var util=require(_0xd2c1('0x1'));var logger=require(_0xd2c1('0x2'))(_0xd2c1('0x3'));var moment=require(_0xd2c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2c1('0x6'));var config=require(_0xd2c1('0x7'));var attributes=require(_0xd2c1('0x8'));module['exports']=function(_0x5419f8,_0x2fc52f){return _0x5419f8[_0xd2c1('0x9')](_0xd2c1('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b51=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x2f4b47,_0xdaa94d){var _0x5f3a62=function(_0x57a828){while(--_0x57a828){_0x2f4b47['push'](_0x2f4b47['shift']());}};_0x5f3a62(++_0xdaa94d);}(_0x4b51,0x6f));var _0x14b5=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x4b51[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x14b5('0x0'));var util=require(_0x14b5('0x1'));var logger=require(_0x14b5('0x2'))(_0x14b5('0x3'));var moment=require(_0x14b5('0x4'));var BPromise=require(_0x14b5('0x5'));var rp=require(_0x14b5('0x6'));var fs=require('fs');var path=require(_0x14b5('0x7'));var rimraf=require('rimraf');var config=require(_0x14b5('0x8'));var attributes=require(_0x14b5('0x9'));module[_0x14b5('0xa')]=function(_0x1bc04b,_0xfd3a27){return _0x1bc04b[_0x14b5('0xb')](_0x14b5('0xc'),attributes,{'tableName':_0x14b5('0xd'),'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 462e65e..dfcacbe 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 _0x86dc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2387c5,_0xfcc74c){var _0x2c414c=function(_0x3d1881){while(--_0x3d1881){_0x2387c5['push'](_0x2387c5['shift']());}};_0x2c414c(++_0xfcc74c);}(_0x86dc,0x145));var _0xc86d=function(_0x555b04,_0x199407){_0x555b04=_0x555b04-0x0;var _0x33271e=_0x86dc[_0x555b04];return _0x33271e;};'use strict';var _=require(_0xc86d('0x0'));var util=require(_0xc86d('0x1'));var moment=require(_0xc86d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc86d('0x3'));var fs=require('fs');var Redis=require(_0xc86d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc86d('0x5'));var logger=require(_0xc86d('0x6'))(_0xc86d('0x7'));var config=require(_0xc86d('0x8'));var jayson=require(_0xc86d('0x9'));var client=jayson['client'][_0xc86d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d8597,_0x406d14,_0x4398d0){return new BPromise(function(_0xb7109a,_0x2daa74){return client['request'](_0x1d8597,_0x4398d0)[_0xc86d('0xb')](function(_0x530db8){logger['info'](_0xc86d('0xc'),_0x406d14,_0xc86d('0xd'));logger[_0xc86d('0xe')](_0xc86d('0xf'),_0x406d14,_0xc86d('0xd'),JSON[_0xc86d('0x10')](_0x530db8));if(_0x530db8[_0xc86d('0x11')]){if(_0x530db8[_0xc86d('0x11')]['code']===0x1f4){logger[_0xc86d('0x11')](_0xc86d('0xc'),_0x406d14,_0x530db8['error'][_0xc86d('0x12')]);return _0x2daa74(_0x530db8['error'][_0xc86d('0x12')]);}logger[_0xc86d('0x11')](_0xc86d('0xc'),_0x406d14,_0x530db8[_0xc86d('0x11')][_0xc86d('0x12')]);return _0xb7109a(_0x530db8[_0xc86d('0x11')][_0xc86d('0x12')]);}else{logger[_0xc86d('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x406d14,_0xc86d('0xd'));_0xb7109a(_0x530db8[_0xc86d('0x14')][_0xc86d('0x12')]);}})[_0xc86d('0x15')](function(_0x5a065c){logger['error'](_0xc86d('0xc'),_0x406d14,_0x5a065c);_0x2daa74(_0x5a065c);});});} \ No newline at end of file +var _0xcd2d=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xcd2d,0x79));var _0xdcd2=function(_0x5d5b86,_0x5f5130){_0x5d5b86=_0x5d5b86-0x0;var _0x1241bd=_0xcd2d[_0x5d5b86];return _0x1241bd;};'use strict';var _=require(_0xdcd2('0x0'));var util=require('util');var moment=require(_0xdcd2('0x1'));var BPromise=require(_0xdcd2('0x2'));var rs=require(_0xdcd2('0x3'));var fs=require('fs');var Redis=require(_0xdcd2('0x4'));var db=require(_0xdcd2('0x5'))['db'];var utils=require(_0xdcd2('0x6'));var logger=require(_0xdcd2('0x7'))(_0xdcd2('0x8'));var config=require('../../config/environment');var jayson=require(_0xdcd2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x314dca,_0x28d92d,_0x4178b6){return new BPromise(function(_0x517e9c,_0x73ff7e){return client[_0xdcd2('0xa')](_0x314dca,_0x4178b6)[_0xdcd2('0xb')](function(_0x495216){logger['info'](_0xdcd2('0xc'),_0x28d92d,_0xdcd2('0xd'));logger[_0xdcd2('0xe')](_0xdcd2('0xf'),_0x28d92d,_0xdcd2('0xd'),JSON[_0xdcd2('0x10')](_0x495216));if(_0x495216['error']){if(_0x495216[_0xdcd2('0x11')][_0xdcd2('0x12')]===0x1f4){logger['error'](_0xdcd2('0xc'),_0x28d92d,_0x495216[_0xdcd2('0x11')]['message']);return _0x73ff7e(_0x495216['error'][_0xdcd2('0x13')]);}logger[_0xdcd2('0x11')](_0xdcd2('0xc'),_0x28d92d,_0x495216[_0xdcd2('0x11')][_0xdcd2('0x13')]);return _0x517e9c(_0x495216[_0xdcd2('0x11')][_0xdcd2('0x13')]);}else{logger[_0xdcd2('0x14')](_0xdcd2('0xc'),_0x28d92d,'request\x20sent');_0x517e9c(_0x495216[_0xdcd2('0x15')][_0xdcd2('0x13')]);}})[_0xdcd2('0x16')](function(_0x31ae93){logger[_0xdcd2('0x11')](_0xdcd2('0xc'),_0x28d92d,_0x31ae93);_0x73ff7e(_0x31ae93);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 412d135..bbf11cb 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 _0xc809=['isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xc809,0x1b8));var _0x9c80=function(_0x196a66,_0x234bd2){_0x196a66=_0x196a66-0x0;var _0x5b07b1=_0xc809[_0x196a66];return _0x5b07b1;};'use strict';var multer=require(_0x9c80('0x0'));var util=require(_0x9c80('0x1'));var path=require(_0x9c80('0x2'));var timeout=require(_0x9c80('0x3'));var express=require(_0x9c80('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9c80('0x5'));var config=require(_0x9c80('0x6'));var controller=require(_0x9c80('0x7'));router[_0x9c80('0x8')](_0x9c80('0x9'),auth[_0x9c80('0xa')](),controller[_0x9c80('0xb')]);router[_0x9c80('0xc')]('/',auth['isAuthenticated'](),controller[_0x9c80('0xd')]);router[_0x9c80('0xe')]('/:id',auth[_0x9c80('0xa')](),controller['update']);router[_0x9c80('0xf')](_0x9c80('0x9'),auth['isAuthenticated'](),controller[_0x9c80('0x10')]);module[_0x9c80('0x11')]=router; \ No newline at end of file +var _0x5301=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','/:id'];(function(_0x38dcff,_0x5f249d){var _0x6cb881=function(_0x3d2494){while(--_0x3d2494){_0x38dcff['push'](_0x38dcff['shift']());}};_0x6cb881(++_0x5f249d);}(_0x5301,0x157));var _0x1530=function(_0x31b6b3,_0x4e3eb8){_0x31b6b3=_0x31b6b3-0x0;var _0x22a5a2=_0x5301[_0x31b6b3];return _0x22a5a2;};'use strict';var multer=require('multer');var util=require(_0x1530('0x0'));var path=require(_0x1530('0x1'));var timeout=require(_0x1530('0x2'));var express=require(_0x1530('0x3'));var router=express[_0x1530('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1530('0x5'));var config=require(_0x1530('0x6'));var controller=require(_0x1530('0x7'));router[_0x1530('0x8')]('/:id',auth[_0x1530('0x9')](),controller['show']);router[_0x1530('0xa')]('/',auth['isAuthenticated'](),controller[_0x1530('0xb')]);router[_0x1530('0xc')](_0x1530('0xd'),auth[_0x1530('0x9')](),controller[_0x1530('0xe')]);router['delete']('/:id',auth[_0x1530('0x9')](),controller[_0x1530('0xf')]);module[_0x1530('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 03d0317..8d5aaea 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 _0x80a8=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x1de9ef,_0x45fda8){var _0x10b9d6=function(_0x24c5cf){while(--_0x24c5cf){_0x1de9ef['push'](_0x1de9ef['shift']());}};_0x10b9d6(++_0x45fda8);}(_0x80a8,0xc6));var _0x880a=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x80a8[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require('sequelize');module[_0x880a('0x0')]={'name':{'type':Sequelize[_0x880a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x880a('0x1')]},'timeout':{'type':Sequelize[_0x880a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x880a('0x3'),_0x880a('0x4'),_0x880a('0x5'))}}; \ No newline at end of file +var _0xc85e=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xc85e,0xee));var _0xec85=function(_0x4fbb3e,_0x55785f){_0x4fbb3e=_0x4fbb3e-0x0;var _0x1eb197=_0xc85e[_0x4fbb3e];return _0x1eb197;};'use strict';var Sequelize=require(_0xec85('0x0'));module['exports']={'name':{'type':Sequelize[_0xec85('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xec85('0x1')]},'timeout':{'type':Sequelize[_0xec85('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xec85('0x3')](_0xec85('0x4'),_0xec85('0x5'),_0xec85('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b3c81d3..9ea7511 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 _0xfe5d=['offset','limit','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','User','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','ids','omit','spread','userChatQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','test','Sequelize','ValidationError','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0xfe5d,0x69));var _0xdfe5=function(_0x2ef354,_0x755dd4){_0x2ef354=_0x2ef354-0x0;var _0xe2af92=_0xfe5d[_0x2ef354];return _0xe2af92;};'use strict';var pdf=require(_0xdfe5('0x0'));var emlformat=require(_0xdfe5('0x1'));var rimraf=require(_0xdfe5('0x2'));var zipdir=require(_0xdfe5('0x3'));var jsonpatch=require(_0xdfe5('0x4'));var rp=require('request-promise');var moment=require(_0xdfe5('0x5'));var BPromise=require(_0xdfe5('0x6'));var Mustache=require(_0xdfe5('0x7'));var util=require('util');var path=require(_0xdfe5('0x8'));var sox=require(_0xdfe5('0x9'));var csv=require('to-csv');var ejs=require(_0xdfe5('0xa'));var fs=require('fs');var _=require(_0xdfe5('0xb'));var squel=require(_0xdfe5('0xc'));var crypto=require(_0xdfe5('0xd'));var jsforce=require(_0xdfe5('0xe'));var deskjs=require(_0xdfe5('0xf'));var toCsv=require(_0xdfe5('0x10'));var querystring=require(_0xdfe5('0x11'));var Papa=require('papaparse');var Redis=require(_0xdfe5('0x12'));var authService=require(_0xdfe5('0x13'));var qs=require(_0xdfe5('0x14'));var as=require(_0xdfe5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdfe5('0x16'));var utils=require('../../config/utils');var config=require(_0xdfe5('0x17'));var db=require(_0xdfe5('0x18'))['db'];config['redis']=_[_0xdfe5('0x19')](config[_0xdfe5('0x1a')],{'host':_0xdfe5('0x1b'),'port':0x18eb});var socket=require(_0xdfe5('0x1c'))(new Redis(config[_0xdfe5('0x1a')]));require(_0xdfe5('0x1d'))['register'](socket);var jayson=require(_0xdfe5('0x1e'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4ee4b7,_0x4cde0f,_0x1050c2){if(_0x1050c2){var _0xe02176=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe02176[_0xdfe5('0x1f')](_0x4cde0f)){return _0x4ee4b7;}else{throw new db[(_0xdfe5('0x20'))][(_0xdfe5('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4ee4b7;}}function respondWithRpcPromise(_0x40e38f,_0x360780,_0x5c122e,_0x11cc82){return new BPromise(function(_0x49fa39,_0x35a1b6){var _0x1b414a=_0x11cc82||client;return _0x1b414a[_0xdfe5('0x22')](_0x40e38f,_0x5c122e)[_0xdfe5('0x23')](function(_0x142c31){logger['info'](_0xdfe5('0x24'),_0x360780,_0xdfe5('0x25'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x360780,_0xdfe5('0x25'),JSON[_0xdfe5('0x26')](_0x142c31));if(_0x142c31[_0xdfe5('0x27')]){if(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x28')]===0x1f4){logger['error'](_0xdfe5('0x24'),_0x360780,_0x142c31['error'][_0xdfe5('0x29')]);return _0x35a1b6(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x29')]);}logger[_0xdfe5('0x27')](_0xdfe5('0x24'),_0x360780,_0x142c31[_0xdfe5('0x27')]['message']);return _0x49fa39(_0x142c31[_0xdfe5('0x27')][_0xdfe5('0x29')]);}else{logger[_0xdfe5('0x2a')](_0xdfe5('0x24'),_0x360780,_0xdfe5('0x25'));_0x49fa39(_0x142c31[_0xdfe5('0x2b')][_0xdfe5('0x29')]);}})['catch'](function(_0x31f5d4){logger[_0xdfe5('0x27')](_0xdfe5('0x24'),_0x360780,_0x31f5d4);_0x35a1b6(_0x31f5d4);});});}function respondWithStatusCode(_0x12e3e3,_0x2b503d){_0x2b503d=_0x2b503d||0xcc;return function(_0x2e774e){if(_0x2e774e){return _0x12e3e3[_0xdfe5('0x2c')](_0x2b503d);}return _0x12e3e3[_0xdfe5('0x2d')](_0x2b503d)[_0xdfe5('0x2e')]();};}function respondWithResult(_0xdc8c34,_0x58a203){_0x58a203=_0x58a203||0xc8;return function(_0x7e9f14){if(_0x7e9f14){return _0xdc8c34[_0xdfe5('0x2d')](_0x58a203)['json'](_0x7e9f14);}};}function respondWithFilteredResult(_0x2fcd8b,_0x28a6a8){return function(_0x405fe7){if(_0x405fe7){var _0x3dc096=_0x405fe7['count'],_0x67f4ce=_0x28a6a8[_0xdfe5('0x2f')],_0x77dd80=_0x28a6a8[_0xdfe5('0x2f')]+_0x28a6a8[_0xdfe5('0x30')],_0x2d7986;if(_0x77dd80>=_0x3dc096){_0x77dd80=_0x3dc096;_0x2d7986=0xc8;}else{_0x2d7986=0xce;}_0x2fcd8b[_0xdfe5('0x2d')](_0x2d7986);return _0x2fcd8b['set'](_0xdfe5('0x31'),_0x67f4ce+'-'+_0x77dd80+'/'+_0x3dc096)['json'](_0x405fe7);}return null;};}function patchUpdates(_0x173636){return function(_0x4b64c5){try{jsonpatch[_0xdfe5('0x32')](_0x4b64c5,_0x173636,!![]);}catch(_0x2d84da){return BPromise['reject'](_0x2d84da);}return _0x4b64c5[_0xdfe5('0x33')]();};}function saveUpdates(_0x43175e,_0x514465){return function(_0x322095){if(_0x322095){return _0x322095[_0xdfe5('0x34')](_0x43175e)['then'](function(_0x51b536){return _0x51b536;});}return null;};}function removeEntity(_0x3a80e8,_0x6a05d1){return function(_0x4d9adb){if(_0x4d9adb){return _0x4d9adb[_0xdfe5('0x35')]()[_0xdfe5('0x23')](function(){var _0xc2bc43=_0x4d9adb[_0xdfe5('0x36')]({'plain':!![]});var _0x5d9ac9=_0xdfe5('0x37');return db[_0xdfe5('0x38')][_0xdfe5('0x35')]({'where':{'type':_0x5d9ac9,'resourceId':_0xc2bc43['id']}})[_0xdfe5('0x23')](function(){return _0x4d9adb;});})[_0xdfe5('0x23')](function(){_0x3a80e8[_0xdfe5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e10e,_0x8ae6da){return function(_0x507fd9){if(!_0x507fd9){_0x35e10e['sendStatus'](0x194);}return _0x507fd9;};}function handleError(_0x2390b8,_0x52deb4){_0x52deb4=_0x52deb4||0x1f4;return function(_0x1a771d){logger['error'](_0x1a771d[_0xdfe5('0x39')]);if(_0x1a771d['name']){delete _0x1a771d['name'];}_0x2390b8[_0xdfe5('0x2d')](_0x52deb4)[_0xdfe5('0x3a')](_0x1a771d);};}exports[_0xdfe5('0x3b')]=function(_0x4caaba,_0x543ba4){var _0x46bb2a={},_0x3d7a46={},_0x27a257={'count':0x0,'rows':[]};var _0x57ea29=_[_0xdfe5('0x3c')](db[_0xdfe5('0x3d')][_0xdfe5('0x3e')],function(_0x508a31){return{'name':_0x508a31[_0xdfe5('0x3f')],'type':_0x508a31[_0xdfe5('0x40')][_0xdfe5('0x41')]};});_0x3d7a46[_0xdfe5('0x42')]=_[_0xdfe5('0x3c')](_0x57ea29,_0xdfe5('0x43'));_0x3d7a46[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x4caaba[_0xdfe5('0x44')]);_0x3d7a46['filters']=_['intersection'](_0x3d7a46[_0xdfe5('0x42')],_0x3d7a46[_0xdfe5('0x44')]);_0x46bb2a['attributes']=_[_0xdfe5('0x46')](_0x3d7a46[_0xdfe5('0x42')],qs[_0xdfe5('0x47')](_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x46bb2a[_0xdfe5('0x48')]=_0x46bb2a[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x46bb2a[_0xdfe5('0x48')]:_0x3d7a46[_0xdfe5('0x42')];if(!_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x46bb2a[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x4caaba[_0xdfe5('0x44')]['limit']);_0x46bb2a['offset']=qs[_0xdfe5('0x2f')](_0x4caaba['query'][_0xdfe5('0x2f')]);}_0x46bb2a[_0xdfe5('0x4c')]=qs['sort'](_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x46bb2a[_0xdfe5('0x4e')]=qs[_0xdfe5('0x4f')](_[_0xdfe5('0x50')](_0x4caaba[_0xdfe5('0x44')],_0x3d7a46[_0xdfe5('0x4f')]),_0x57ea29);if(_0x4caaba[_0xdfe5('0x44')][_0xdfe5('0x51')]){_0x46bb2a[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x46bb2a[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x57ea29,function(_0x108d0b){if(_0x108d0b[_0xdfe5('0x40')]!==_0xdfe5('0x53')){var _0x20ac48={};_0x20ac48[_0x108d0b[_0xdfe5('0x43')]]={'$like':'%'+_0x4caaba['query'][_0xdfe5('0x51')]+'%'};return _0x20ac48;}})});}_0x46bb2a=_[_0xdfe5('0x52')]({},_0x46bb2a,_0x4caaba[_0xdfe5('0x54')]);var _0x20e0f0={'where':_0x46bb2a['where']};return db[_0xdfe5('0x3d')][_0xdfe5('0x55')](_0x20e0f0)[_0xdfe5('0x23')](function(_0x22d1fa){_0x27a257[_0xdfe5('0x55')]=_0x22d1fa;if(_0x4caaba[_0xdfe5('0x44')]['includeAll']){_0x46bb2a[_0xdfe5('0x56')]=[{'all':!![]}];}return db['ChatQueue'][_0xdfe5('0x57')](_0x46bb2a);})[_0xdfe5('0x23')](function(_0x25d441){_0x27a257[_0xdfe5('0x58')]=_0x25d441;return _0x27a257;})[_0xdfe5('0x23')](respondWithFilteredResult(_0x543ba4,_0x46bb2a))[_0xdfe5('0x59')](handleError(_0x543ba4,null));};exports[_0xdfe5('0x5a')]=function(_0x26ffdc,_0x53303e){var _0x3ff822={'raw':!![],'where':{'id':_0x26ffdc[_0xdfe5('0x5b')]['id']}},_0x1ea366={};_0x1ea366[_0xdfe5('0x42')]=_['keys'](db[_0xdfe5('0x3d')]['rawAttributes']);_0x1ea366[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x26ffdc['query']);_0x1ea366['filters']=_[_0xdfe5('0x46')](_0x1ea366[_0xdfe5('0x42')],_0x1ea366['query']);_0x3ff822[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x1ea366['model'],qs['fields'](_0x26ffdc[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x3ff822[_0xdfe5('0x48')]=_0x3ff822[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x3ff822[_0xdfe5('0x48')]:_0x1ea366[_0xdfe5('0x42')];if(_0x26ffdc[_0xdfe5('0x44')][_0xdfe5('0x5c')]){_0x3ff822[_0xdfe5('0x56')]=[{'all':!![]}];}_0x3ff822=_['merge']({},_0x3ff822,_0x26ffdc[_0xdfe5('0x54')]);return db[_0xdfe5('0x3d')]['find'](_0x3ff822)[_0xdfe5('0x23')](handleEntityNotFound(_0x53303e,null))['then'](respondWithResult(_0x53303e,null))[_0xdfe5('0x59')](handleError(_0x53303e,null));};exports['create']=function(_0x2a598d,_0x25c3fd){return db['ChatQueue'][_0xdfe5('0x5d')](_0x2a598d[_0xdfe5('0x5e')],{})[_0xdfe5('0x23')](function(_0x79cb3){var _0x28edbd=_0x2a598d['user']['get']({'plain':!![]});if(!_0x28edbd)throw new Error(_0xdfe5('0x5f'));if(_0x28edbd[_0xdfe5('0x60')]==='user'){var _0x54566a=_0x79cb3[_0xdfe5('0x36')]({'plain':!![]});var _0x421693='ChatQueues';return db['UserProfileSection'][_0xdfe5('0x61')]({'where':{'name':_0x421693,'userProfileId':_0x28edbd[_0xdfe5('0x62')]},'raw':!![]})[_0xdfe5('0x23')](function(_0x335673){if(_0x335673&&_0x335673[_0xdfe5('0x63')]===0x0){return db[_0xdfe5('0x38')][_0xdfe5('0x5d')]({'name':_0x54566a[_0xdfe5('0x43')],'resourceId':_0x54566a['id'],'type':_0x335673[_0xdfe5('0x43')],'sectionId':_0x335673['id']},{})[_0xdfe5('0x23')](function(){return _0x79cb3;});}else{return _0x79cb3;}})[_0xdfe5('0x59')](function(_0xf1aade){logger[_0xdfe5('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf1aade);throw _0xf1aade;});}return _0x79cb3;})['then'](respondWithResult(_0x25c3fd,0xc9))[_0xdfe5('0x59')](handleError(_0x25c3fd,null));};exports[_0xdfe5('0x34')]=function(_0x1ab2dc,_0xe46d8e){if(_0x1ab2dc[_0xdfe5('0x5e')]['id']){delete _0x1ab2dc[_0xdfe5('0x5e')]['id'];}return db[_0xdfe5('0x3d')]['find']({'where':{'id':_0x1ab2dc[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0xe46d8e,null))[_0xdfe5('0x23')](saveUpdates(_0x1ab2dc['body'],null))[_0xdfe5('0x23')](respondWithResult(_0xe46d8e,null))['catch'](handleError(_0xe46d8e,null));};exports[_0xdfe5('0x35')]=function(_0x193932,_0x195448){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x193932[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x195448,null))[_0xdfe5('0x23')](removeEntity(_0x195448,null))['catch'](handleError(_0x195448,null));};exports[_0xdfe5('0x64')]=function(_0x2cca85,_0x148410){return db[_0xdfe5('0x3d')]['describe']()[_0xdfe5('0x23')](respondWithResult(_0x148410,null))['catch'](handleError(_0x148410,null));};exports[_0xdfe5('0x65')]=function(_0x494588,_0x14cb63,_0x59a892){var _0x33134c={'raw':!![],'where':{}},_0x2c51d0={},_0x3bf188;return db['ChatQueue'][_0xdfe5('0x66')]({'where':{'id':_0x494588[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x14cb63,null))[_0xdfe5('0x23')](function(_0x20f82b){if(_0x20f82b){_0x3bf188=_0x20f82b[_0xdfe5('0x36')]({'plain':!![]});_0x2c51d0['model']=_['keys'](db[_0xdfe5('0x67')][_0xdfe5('0x3e')]);_0x2c51d0['query']=_['keys'](_0x494588[_0xdfe5('0x44')]);_0x2c51d0['filters']=_['intersection'](_0x2c51d0[_0xdfe5('0x42')],_0x2c51d0[_0xdfe5('0x44')]);_0x33134c['attributes']=_[_0xdfe5('0x46')](_0x2c51d0[_0xdfe5('0x42')],qs[_0xdfe5('0x47')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x33134c[_0xdfe5('0x48')]=_0x33134c[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x33134c[_0xdfe5('0x48')]:_0x2c51d0[_0xdfe5('0x42')];if(!_0x494588[_0xdfe5('0x44')][_0xdfe5('0x4a')]('nolimit')){_0x33134c[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x30')]);_0x33134c[_0xdfe5('0x2f')]=qs[_0xdfe5('0x2f')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x2f')]);}_0x33134c['order']=qs[_0xdfe5('0x4d')](_0x494588[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x33134c[_0xdfe5('0x4e')]=qs['filters'](_[_0xdfe5('0x50')](_0x494588[_0xdfe5('0x44')],_0x2c51d0[_0xdfe5('0x4f')]));_0x33134c[_0xdfe5('0x4e')][_0xdfe5('0x68')]=_0x20f82b['id'];if(_0x494588['query']['filter']){_0x33134c[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x33134c[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x33134c['attributes'],function(_0xadb659){var _0x5a2e9a={};_0x5a2e9a[_0xadb659]={'$like':'%'+_0x494588[_0xdfe5('0x44')]['filter']+'%'};return _0x5a2e9a;})});}_0x33134c=_['merge']({},_0x33134c,_0x494588[_0xdfe5('0x54')]);return db[_0xdfe5('0x67')][_0xdfe5('0x57')](_0x33134c);}})[_0xdfe5('0x23')](function(_0x412c75){if(_0x412c75){return db['User'][_0xdfe5('0x69')]({'where':{'id':_[_0xdfe5('0x3c')](_0x412c75,_0xdfe5('0x6a')),'role':_0xdfe5('0x6b')},'attributes':['id',_0xdfe5('0x43'),_0xdfe5('0x6c'),_0xdfe5('0x6d'),'createdAt']});}})[_0xdfe5('0x23')](function(_0x399b23){if(_0x399b23){return{'count':_0x399b23[_0xdfe5('0x55')],'rows':_[_0xdfe5('0x3c')](_0x399b23[_0xdfe5('0x58')],function(_0x2acadb){return{'membername':_0x2acadb['name'],'UserId':_0x2acadb['id'],'queue_name':_0x3bf188[_0xdfe5('0x43')],'ChatQueueId':_0x3bf188['id'],'interface':util[_0xdfe5('0x6e')](_0xdfe5('0x6f'),'SIP',_0x2acadb['name']),'penalty':0x0,'paused':_0x2acadb['chatPause'],'createdAt':_0x2acadb[_0xdfe5('0x70')],'updatedAt':_0x2acadb[_0xdfe5('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfe5('0x23')](respondWithFilteredResult(_0x14cb63,_0x33134c))[_0xdfe5('0x59')](handleError(_0x14cb63,null));};exports[_0xdfe5('0x71')]=function(_0x356b0a,_0x23bdb0,_0x4395e0){var _0x1c9f7f={};var _0x3da8c9={};var _0x557793;var _0x3b2f73;return db[_0xdfe5('0x3d')]['findOne']({'where':{'id':_0x356b0a[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x23bdb0,null))[_0xdfe5('0x23')](function(_0x1df850){if(_0x1df850){_0x557793=_0x1df850;_0x3da8c9['model']=_['keys'](db[_0xdfe5('0x72')]['rawAttributes']);_0x3da8c9[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x356b0a[_0xdfe5('0x44')]);_0x3da8c9[_0xdfe5('0x4f')]=_['intersection'](_0x3da8c9[_0xdfe5('0x42')],_0x3da8c9[_0xdfe5('0x44')]);_0x1c9f7f[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x3da8c9['model'],qs[_0xdfe5('0x47')](_0x356b0a[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x1c9f7f[_0xdfe5('0x48')]=_0x1c9f7f[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x1c9f7f[_0xdfe5('0x48')]:_0x3da8c9['model'];_0x1c9f7f[_0xdfe5('0x4c')]=qs[_0xdfe5('0x4d')](_0x356b0a[_0xdfe5('0x44')]['sort']);_0x1c9f7f[_0xdfe5('0x4e')]=qs['filters'](_['pick'](_0x356b0a[_0xdfe5('0x44')],_0x3da8c9[_0xdfe5('0x4f')]));if(_0x356b0a['query'][_0xdfe5('0x51')]){_0x1c9f7f[_0xdfe5('0x4e')]=_[_0xdfe5('0x52')](_0x1c9f7f['where'],{'$or':_[_0xdfe5('0x3c')](_0x1c9f7f[_0xdfe5('0x48')],function(_0x372c2b){var _0x4b3c87={};_0x4b3c87[_0x372c2b]={'$like':'%'+_0x356b0a['query'][_0xdfe5('0x51')]+'%'};return _0x4b3c87;})});}_0x1c9f7f=_[_0xdfe5('0x52')]({},_0x1c9f7f,_0x356b0a[_0xdfe5('0x54')]);return _0x557793[_0xdfe5('0x71')](_0x1c9f7f);}})[_0xdfe5('0x23')](function(_0x575df4){if(_0x575df4){_0x3b2f73=_0x575df4[_0xdfe5('0x49')];if(!_0x356b0a[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x1c9f7f[_0xdfe5('0x30')]=qs[_0xdfe5('0x30')](_0x356b0a['query']['limit']);_0x1c9f7f['offset']=qs[_0xdfe5('0x2f')](_0x356b0a['query'][_0xdfe5('0x2f')]);}return _0x557793[_0xdfe5('0x71')](_0x1c9f7f);}})[_0xdfe5('0x23')](function(_0x1a2155){if(_0x1a2155){return _0x1a2155?{'count':_0x3b2f73,'rows':_0x1a2155}:null;}})[_0xdfe5('0x23')](respondWithResult(_0x23bdb0,null))[_0xdfe5('0x59')](handleError(_0x23bdb0,null));};exports['addTeams']=function(_0x534b6c,_0x4cc32f,_0x4a5bf9){var _0x4c7ae2=_0x534b6c[_0xdfe5('0x5e')]['ids'];return db[_0xdfe5('0x72')][_0xdfe5('0x57')]({'where':{'id':_0x4c7ae2},'attributes':['id'],'include':[{'model':db[_0xdfe5('0x73')],'as':_0xdfe5('0x74'),'attributes':['id',_0xdfe5('0x43'),'online','voicePause',_0xdfe5('0x75')],'raw':!![]}]})['then'](function(_0x2e0121){if(_0x2e0121){var _0x3a5422=_[_0xdfe5('0x76')](_0x2e0121,function(_0x5b71b1){var _0x419cb1=_0x5b71b1[_0xdfe5('0x36')]({'plain':!![]});return _0x419cb1['Agents'];});return db['ChatQueue'][_0xdfe5('0x61')]({'where':{'id':_0x534b6c['params']['id']}})[_0xdfe5('0x23')](function(_0x4da160){return db[_0xdfe5('0x77')][_0xdfe5('0x78')](function(_0x3ec7f0){return _0x4da160[_0xdfe5('0x79')](_0x4c7ae2,{'transaction':_0x3ec7f0})[_0xdfe5('0x23')](function(){return BPromise[_0xdfe5('0x7a')](_0x3a5422,function(_0x39db43){return db[_0xdfe5('0x67')][_0xdfe5('0x7b')]({'where':{'UserId':_0x39db43['id'],'ChatQueueId':_0x534b6c['params']['id']},'transaction':_0x3ec7f0});});})[_0xdfe5('0x23')](function(){_0x3a5422[_0xdfe5('0x7c')](function(_0x2e85af){socket[_0xdfe5('0x7d')]('userChatQueue:save',{'UserId':_0x2e85af['id'],'ChatQueueId':_0x4da160['id']});});});});});}})[_0xdfe5('0x23')](respondWithStatusCode(_0x4cc32f,null))[_0xdfe5('0x59')](handleError(_0x4cc32f,null));};exports[_0xdfe5('0x7e')]=function(_0x63fe1,_0x3093e7,_0x4dd7a1){return db[_0xdfe5('0x72')][_0xdfe5('0x57')]({'where':{'id':_0x63fe1[_0xdfe5('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0xdfe5('0x73')],'as':_0xdfe5('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3093e7,null))[_0xdfe5('0x23')](function(_0x11125c){var _0xe3bab4=_[_0xdfe5('0x3c')](_0x11125c,'id');var _0x2f7648=[];var _0x192bf4=[];var _0x24f21e=squel[_0xdfe5('0x7f')]();_0x24f21e[_0xdfe5('0x80')]('tq.TeamId')['from'](_0xdfe5('0x81'),'tq')[_0xdfe5('0x82')]('user_has_teams','ut',_0xdfe5('0x83'))[_0xdfe5('0x4e')](_0xdfe5('0x84'),_0x63fe1[_0xdfe5('0x5b')]['id']);for(var _0x2308f4=0x0;_0x2308f4<_0x11125c[_0xdfe5('0x49')];_0x2308f4+=0x1){let _0xd08eed=_0x11125c[_0x2308f4];for(var _0x2f3298=0x0;_0x2f3298<_0xd08eed[_0xdfe5('0x74')][_0xdfe5('0x49')];_0x2f3298+=0x1){let _0x478c90=_0xd08eed['Agents'][_0x2f3298];var _0x32a144=_0x24f21e[_0xdfe5('0x85')]();_0x32a144[_0xdfe5('0x4e')](_0xdfe5('0x86'),_0x478c90['id']);_0x192bf4[_0xdfe5('0x87')](db[_0xdfe5('0x77')][_0xdfe5('0x44')](_0x32a144['toString'](),{'type':db['sequelize'][_0xdfe5('0x88')][_0xdfe5('0x89')]})[_0xdfe5('0x23')](function(_0x274a32){if(_0x274a32[_0xdfe5('0x49')]===0x1){return _0x478c90['id'];}else{var _0x4a0396=_[_0xdfe5('0x8a')](_[_0xdfe5('0x3c')](_0x274a32,'TeamId'),function(_0x215751){return _[_0xdfe5('0x8b')](_0xe3bab4,_0x215751);});if(_0x4a0396){return _0x478c90['id'];}}}));}}return BPromise[_0xdfe5('0x8c')](_0x192bf4)[_0xdfe5('0x23')](function(_0xdcf642){_0x2f7648=_(_0x2f7648)[_0xdfe5('0x8d')](_0xdcf642)[_0xdfe5('0x8e')]()['value']();return db[_0xdfe5('0x3d')]['find']({'where':{'id':_0x63fe1[_0xdfe5('0x5b')]['id']}})['then'](function(_0x416d6b){return db[_0xdfe5('0x77')][_0xdfe5('0x78')](function(_0xc37cd1){return _0x416d6b[_0xdfe5('0x7e')](_0x63fe1['query']['ids'],{'transaction':_0xc37cd1})[_0xdfe5('0x23')](function(){if(!_['isEmpty'](_0x2f7648)){return _0x416d6b[_0xdfe5('0x8f')](_0x2f7648,{'transaction':_0xc37cd1});}})[_0xdfe5('0x23')](function(){_0x2f7648[_0xdfe5('0x7c')](function(_0x523982){socket['emit'](_0xdfe5('0x90'),{'UserId':_0x523982,'ChatQueueId':_0x416d6b['id']});});});});});});})[_0xdfe5('0x23')](respondWithStatusCode(_0x3093e7,null))['catch'](handleError(_0x3093e7,null));};exports[_0xdfe5('0x91')]=function(_0x567cea,_0x4847be,_0x1ed2a){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x567cea[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x4847be,null))[_0xdfe5('0x23')](function(_0x274c04){if(_0x274c04){return _0x274c04[_0xdfe5('0x91')](_0x567cea[_0xdfe5('0x5e')][_0xdfe5('0x92')],_[_0xdfe5('0x93')](_0x567cea[_0xdfe5('0x5e')],[_0xdfe5('0x92'),'id'])||{})[_0xdfe5('0x94')](function(_0x4178d7){for(var _0x351b2f=0x0;_0x351b2f<_0x567cea[_0xdfe5('0x5e')]['ids'][_0xdfe5('0x49')];_0x351b2f+=0x1){socket[_0xdfe5('0x7d')](_0xdfe5('0x95'),{'UserId':_0x567cea[_0xdfe5('0x5e')][_0xdfe5('0x92')][_0x351b2f],'ChatQueueId':_0x567cea[_0xdfe5('0x5b')]['id']});}return _0x4178d7;});}})[_0xdfe5('0x23')](respondWithResult(_0x4847be,null))[_0xdfe5('0x59')](handleError(_0x4847be,null));};exports['removeAgents']=function(_0x752ba9,_0x27f69a,_0x5c867){return db[_0xdfe5('0x3d')][_0xdfe5('0x61')]({'where':{'id':_0x752ba9[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x27f69a,null))[_0xdfe5('0x23')](function(_0x3637a6){if(_0x3637a6){return _0x3637a6['removeAgents'](_0x752ba9['query']['ids'])[_0xdfe5('0x23')](function(){if(_[_0xdfe5('0x96')](_0x752ba9[_0xdfe5('0x44')]['ids'])){for(var _0x5f30d7=0x0;_0x5f30d7<_0x752ba9[_0xdfe5('0x44')][_0xdfe5('0x92')][_0xdfe5('0x49')];_0x5f30d7+=0x1){socket[_0xdfe5('0x7d')](_0xdfe5('0x90'),{'UserId':Number(_0x752ba9[_0xdfe5('0x44')][_0xdfe5('0x92')][_0x5f30d7]),'ChatQueueId':Number(_0x752ba9[_0xdfe5('0x5b')]['id'])});}}else{socket[_0xdfe5('0x7d')](_0xdfe5('0x90'),{'UserId':Number(_0x752ba9[_0xdfe5('0x44')]['ids']),'ChatQueueId':Number(_0x752ba9[_0xdfe5('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x27f69a,null))[_0xdfe5('0x59')](handleError(_0x27f69a,null));};exports[_0xdfe5('0x97')]=function(_0x5ee5df,_0x175287,_0x1dad82){var _0x47ff3d={};var _0x448e73={};var _0x360ea8;var _0x2f0f03;return db['ChatQueue']['findOne']({'where':{'id':_0x5ee5df[_0xdfe5('0x5b')]['id']}})[_0xdfe5('0x23')](handleEntityNotFound(_0x175287,null))['then'](function(_0x57344b){if(_0x57344b){_0x360ea8=_0x57344b;_0x448e73[_0xdfe5('0x42')]=_['keys'](db[_0xdfe5('0x73')][_0xdfe5('0x3e')]);_0x448e73[_0xdfe5('0x44')]=_[_0xdfe5('0x45')](_0x5ee5df[_0xdfe5('0x44')]);_0x448e73['filters']=_[_0xdfe5('0x46')](_0x448e73[_0xdfe5('0x42')],_0x448e73[_0xdfe5('0x44')]);_0x47ff3d[_0xdfe5('0x48')]=_[_0xdfe5('0x46')](_0x448e73[_0xdfe5('0x42')],qs['fields'](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x47')]));_0x47ff3d[_0xdfe5('0x48')]=_0x47ff3d[_0xdfe5('0x48')][_0xdfe5('0x49')]?_0x47ff3d['attributes']:_0x448e73[_0xdfe5('0x42')];_0x47ff3d[_0xdfe5('0x4c')]=qs[_0xdfe5('0x4d')](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x4d')]);_0x47ff3d[_0xdfe5('0x4e')]=qs[_0xdfe5('0x4f')](_[_0xdfe5('0x50')](_0x5ee5df[_0xdfe5('0x44')],_0x448e73[_0xdfe5('0x4f')]));if(_0x5ee5df['query']['filter']){_0x47ff3d['where']=_[_0xdfe5('0x52')](_0x47ff3d[_0xdfe5('0x4e')],{'$or':_[_0xdfe5('0x3c')](_0x47ff3d[_0xdfe5('0x48')],function(_0x2c0d29){var _0x335389={};_0x335389[_0x2c0d29]={'$like':'%'+_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x51')]+'%'};return _0x335389;})});}_0x47ff3d=_[_0xdfe5('0x52')]({},_0x47ff3d,_0x5ee5df['options']);return _0x360ea8[_0xdfe5('0x97')](_0x47ff3d);}})[_0xdfe5('0x23')](function(_0x219433){if(_0x219433){_0x2f0f03=_0x219433[_0xdfe5('0x49')];if(!_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x4a')](_0xdfe5('0x4b'))){_0x47ff3d['limit']=qs[_0xdfe5('0x30')](_0x5ee5df[_0xdfe5('0x44')][_0xdfe5('0x30')]);_0x47ff3d[_0xdfe5('0x2f')]=qs[_0xdfe5('0x2f')](_0x5ee5df['query']['offset']);}return _0x360ea8[_0xdfe5('0x97')](_0x47ff3d);}})[_0xdfe5('0x23')](function(_0x5479cf){if(_0x5479cf){return _0x5479cf?{'count':_0x2f0f03,'rows':_0x5479cf}:null;}})[_0xdfe5('0x23')](respondWithResult(_0x175287,null))[_0xdfe5('0x59')](handleError(_0x175287,null));}; \ No newline at end of file +var _0xf53c=['querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','count','limit','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','query','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatQueue','includeAll','include','findAll','rows','catch','params','create','body','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','findAndCountAll','UserId','agent','chatPause','createdAt','format','updatedAt','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','ids','field','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x129327,_0x2f86d9){var _0x2757ca=function(_0x4d1d65){while(--_0x4d1d65){_0x129327['push'](_0x129327['shift']());}};_0x2757ca(++_0x2f86d9);}(_0xf53c,0x123));var _0xcf53=function(_0x4ed88c,_0x52de89){_0x4ed88c=_0x4ed88c-0x0;var _0x226786=_0xf53c[_0x4ed88c];return _0x226786;};'use strict';var pdf=require(_0xcf53('0x0'));var emlformat=require(_0xcf53('0x1'));var rimraf=require(_0xcf53('0x2'));var zipdir=require(_0xcf53('0x3'));var jsonpatch=require(_0xcf53('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf53('0x5'));var Mustache=require(_0xcf53('0x6'));var util=require(_0xcf53('0x7'));var path=require('path');var sox=require(_0xcf53('0x8'));var csv=require(_0xcf53('0x9'));var ejs=require(_0xcf53('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcf53('0xb'));var crypto=require(_0xcf53('0xc'));var jsforce=require(_0xcf53('0xd'));var deskjs=require(_0xcf53('0xe'));var toCsv=require(_0xcf53('0x9'));var querystring=require(_0xcf53('0xf'));var Papa=require(_0xcf53('0x10'));var Redis=require(_0xcf53('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf53('0x12'));var logger=require(_0xcf53('0x13'))('api');var utils=require(_0xcf53('0x14'));var config=require(_0xcf53('0x15'));var db=require(_0xcf53('0x16'))['db'];config[_0xcf53('0x17')]=_[_0xcf53('0x18')](config[_0xcf53('0x17')],{'host':_0xcf53('0x19'),'port':0x18eb});var socket=require(_0xcf53('0x1a'))(new Redis(config[_0xcf53('0x17')]));require(_0xcf53('0x1b'))[_0xcf53('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcf53('0x1d')][_0xcf53('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1d3f5e,_0x57ab41,_0x411f1e){if(_0x411f1e){var _0x30f36a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30f36a[_0xcf53('0x1f')](_0x57ab41)){return _0x1d3f5e;}else{throw new db[(_0xcf53('0x20'))]['ValidationError'](_0xcf53('0x21'));}}else{return _0x1d3f5e;}}function respondWithRpcPromise(_0x6aab69,_0x15bc5f,_0x1ba7ed,_0x508718){return new BPromise(function(_0x51dfe4,_0xffc7e8){var _0x840e69=_0x508718||client;return _0x840e69[_0xcf53('0x22')](_0x6aab69,_0x1ba7ed)[_0xcf53('0x23')](function(_0x233797){logger[_0xcf53('0x24')](_0xcf53('0x25'),_0x15bc5f,_0xcf53('0x26'));logger[_0xcf53('0x27')](_0xcf53('0x28'),_0x15bc5f,_0xcf53('0x26'),JSON[_0xcf53('0x29')](_0x233797));if(_0x233797[_0xcf53('0x2a')]){if(_0x233797[_0xcf53('0x2a')][_0xcf53('0x2b')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x15bc5f,_0x233797[_0xcf53('0x2a')][_0xcf53('0x2c')]);return _0xffc7e8(_0x233797[_0xcf53('0x2a')][_0xcf53('0x2c')]);}logger['error'](_0xcf53('0x25'),_0x15bc5f,_0x233797[_0xcf53('0x2a')][_0xcf53('0x2c')]);return _0x51dfe4(_0x233797['error'][_0xcf53('0x2c')]);}else{logger[_0xcf53('0x24')](_0xcf53('0x25'),_0x15bc5f,_0xcf53('0x26'));_0x51dfe4(_0x233797[_0xcf53('0x2d')][_0xcf53('0x2c')]);}})['catch'](function(_0x25464c){logger['error'](_0xcf53('0x25'),_0x15bc5f,_0x25464c);_0xffc7e8(_0x25464c);});});}function respondWithStatusCode(_0x327fa2,_0x522067){_0x522067=_0x522067||0xcc;return function(_0x711291){if(_0x711291){return _0x327fa2[_0xcf53('0x2e')](_0x522067);}return _0x327fa2['status'](_0x522067)[_0xcf53('0x2f')]();};}function respondWithResult(_0x1744de,_0xbbcb66){_0xbbcb66=_0xbbcb66||0xc8;return function(_0x46123d){if(_0x46123d){return _0x1744de[_0xcf53('0x30')](_0xbbcb66)['json'](_0x46123d);}};}function respondWithFilteredResult(_0x232a1d,_0x16bbd6){return function(_0x337301){if(_0x337301){var _0x5cdfee=_0x337301[_0xcf53('0x31')],_0x19fd29=_0x16bbd6['offset'],_0xb3981b=_0x16bbd6['offset']+_0x16bbd6[_0xcf53('0x32')],_0x35d20a;if(_0xb3981b>=_0x5cdfee){_0xb3981b=_0x5cdfee;_0x35d20a=0xc8;}else{_0x35d20a=0xce;}_0x232a1d[_0xcf53('0x30')](_0x35d20a);return _0x232a1d['set'](_0xcf53('0x33'),_0x19fd29+'-'+_0xb3981b+'/'+_0x5cdfee)[_0xcf53('0x34')](_0x337301);}return null;};}function patchUpdates(_0x522ce8){return function(_0x251877){try{jsonpatch[_0xcf53('0x35')](_0x251877,_0x522ce8,!![]);}catch(_0x352f91){return BPromise[_0xcf53('0x36')](_0x352f91);}return _0x251877[_0xcf53('0x37')]();};}function saveUpdates(_0x1705b2,_0x341f67){return function(_0x15e071){if(_0x15e071){return _0x15e071[_0xcf53('0x38')](_0x1705b2)[_0xcf53('0x23')](function(_0x58f526){return _0x58f526;});}return null;};}function removeEntity(_0x22737a,_0x46008b){return function(_0x31d696){if(_0x31d696){return _0x31d696[_0xcf53('0x39')]()['then'](function(){var _0xd88dd=_0x31d696[_0xcf53('0x3a')]({'plain':!![]});var _0x28f248=_0xcf53('0x3b');return db[_0xcf53('0x3c')][_0xcf53('0x39')]({'where':{'type':_0x28f248,'resourceId':_0xd88dd['id']}})[_0xcf53('0x23')](function(){return _0x31d696;});})[_0xcf53('0x23')](function(){_0x22737a[_0xcf53('0x30')](0xcc)[_0xcf53('0x2f')]();});}};}function handleEntityNotFound(_0x344ffc,_0x4dd94e){return function(_0x3747c9){if(!_0x3747c9){_0x344ffc[_0xcf53('0x2e')](0x194);}return _0x3747c9;};}function handleError(_0x54f1b1,_0x38eb68){_0x38eb68=_0x38eb68||0x1f4;return function(_0x351072){logger[_0xcf53('0x2a')](_0x351072[_0xcf53('0x3d')]);if(_0x351072[_0xcf53('0x3e')]){delete _0x351072['name'];}_0x54f1b1[_0xcf53('0x30')](_0x38eb68)['send'](_0x351072);};}exports[_0xcf53('0x3f')]=function(_0x1416d1,_0x3dc988){var _0x1b14cb={},_0x6f981a={},_0xeab932={'count':0x0,'rows':[]};var _0x48d8b3=_[_0xcf53('0x40')](db['ChatQueue'][_0xcf53('0x41')],function(_0x5295bf){return{'name':_0x5295bf[_0xcf53('0x42')],'type':_0x5295bf[_0xcf53('0x43')][_0xcf53('0x44')]};});_0x6f981a[_0xcf53('0x45')]=_['map'](_0x48d8b3,_0xcf53('0x3e'));_0x6f981a['query']=_[_0xcf53('0x46')](_0x1416d1['query']);_0x6f981a[_0xcf53('0x47')]=_['intersection'](_0x6f981a[_0xcf53('0x45')],_0x6f981a['query']);_0x1b14cb[_0xcf53('0x48')]=_[_0xcf53('0x49')](_0x6f981a[_0xcf53('0x45')],qs['fields'](_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x4b')]));_0x1b14cb['attributes']=_0x1b14cb[_0xcf53('0x48')][_0xcf53('0x4c')]?_0x1b14cb[_0xcf53('0x48')]:_0x6f981a[_0xcf53('0x45')];if(!_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x4d')](_0xcf53('0x4e'))){_0x1b14cb[_0xcf53('0x32')]=qs[_0xcf53('0x32')](_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x32')]);_0x1b14cb['offset']=qs[_0xcf53('0x4f')](_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x4f')]);}_0x1b14cb[_0xcf53('0x50')]=qs[_0xcf53('0x51')](_0x1416d1['query'][_0xcf53('0x51')]);_0x1b14cb[_0xcf53('0x52')]=qs[_0xcf53('0x47')](_[_0xcf53('0x53')](_0x1416d1[_0xcf53('0x4a')],_0x6f981a[_0xcf53('0x47')]),_0x48d8b3);if(_0x1416d1[_0xcf53('0x4a')]['filter']){_0x1b14cb[_0xcf53('0x52')]=_[_0xcf53('0x54')](_0x1b14cb[_0xcf53('0x52')],{'$or':_['map'](_0x48d8b3,function(_0x434b1e){if(_0x434b1e[_0xcf53('0x43')]!==_0xcf53('0x55')){var _0x17115c={};_0x17115c[_0x434b1e[_0xcf53('0x3e')]]={'$like':'%'+_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x56')]+'%'};return _0x17115c;}})});}_0x1b14cb=_[_0xcf53('0x54')]({},_0x1b14cb,_0x1416d1[_0xcf53('0x57')]);var _0x1c13c4={'where':_0x1b14cb[_0xcf53('0x52')]};return db[_0xcf53('0x58')][_0xcf53('0x31')](_0x1c13c4)[_0xcf53('0x23')](function(_0x1cd10c){_0xeab932[_0xcf53('0x31')]=_0x1cd10c;if(_0x1416d1[_0xcf53('0x4a')][_0xcf53('0x59')]){_0x1b14cb[_0xcf53('0x5a')]=[{'all':!![]}];}return db[_0xcf53('0x58')][_0xcf53('0x5b')](_0x1b14cb);})['then'](function(_0x55ade7){_0xeab932[_0xcf53('0x5c')]=_0x55ade7;return _0xeab932;})[_0xcf53('0x23')](respondWithFilteredResult(_0x3dc988,_0x1b14cb))[_0xcf53('0x5d')](handleError(_0x3dc988,null));};exports['show']=function(_0x48c9f2,_0x33ce80){var _0x39698e={'raw':!![],'where':{'id':_0x48c9f2[_0xcf53('0x5e')]['id']}},_0x8f44ac={};_0x8f44ac[_0xcf53('0x45')]=_[_0xcf53('0x46')](db['ChatQueue'][_0xcf53('0x41')]);_0x8f44ac[_0xcf53('0x4a')]=_[_0xcf53('0x46')](_0x48c9f2[_0xcf53('0x4a')]);_0x8f44ac['filters']=_[_0xcf53('0x49')](_0x8f44ac[_0xcf53('0x45')],_0x8f44ac[_0xcf53('0x4a')]);_0x39698e['attributes']=_[_0xcf53('0x49')](_0x8f44ac[_0xcf53('0x45')],qs[_0xcf53('0x4b')](_0x48c9f2[_0xcf53('0x4a')][_0xcf53('0x4b')]));_0x39698e[_0xcf53('0x48')]=_0x39698e[_0xcf53('0x48')][_0xcf53('0x4c')]?_0x39698e[_0xcf53('0x48')]:_0x8f44ac[_0xcf53('0x45')];if(_0x48c9f2[_0xcf53('0x4a')]['includeAll']){_0x39698e[_0xcf53('0x5a')]=[{'all':!![]}];}_0x39698e=_[_0xcf53('0x54')]({},_0x39698e,_0x48c9f2[_0xcf53('0x57')]);return db['ChatQueue']['find'](_0x39698e)['then'](handleEntityNotFound(_0x33ce80,null))[_0xcf53('0x23')](respondWithResult(_0x33ce80,null))['catch'](handleError(_0x33ce80,null));};exports[_0xcf53('0x5f')]=function(_0x46a89a,_0x5f43ce){return db['ChatQueue'][_0xcf53('0x5f')](_0x46a89a[_0xcf53('0x60')],{})[_0xcf53('0x23')](function(_0x537f4a){var _0x2466cc=_0x46a89a[_0xcf53('0x61')][_0xcf53('0x3a')]({'plain':!![]});if(!_0x2466cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2466cc['role']===_0xcf53('0x61')){var _0x685d1=_0x537f4a[_0xcf53('0x3a')]({'plain':!![]});var _0x37a36c='ChatQueues';return db[_0xcf53('0x62')][_0xcf53('0x63')]({'where':{'name':_0x37a36c,'userProfileId':_0x2466cc[_0xcf53('0x64')]},'raw':!![]})[_0xcf53('0x23')](function(_0xc41df8){if(_0xc41df8&&_0xc41df8['autoAssociation']===0x0){return db['UserProfileResource'][_0xcf53('0x5f')]({'name':_0x685d1[_0xcf53('0x3e')],'resourceId':_0x685d1['id'],'type':_0xc41df8[_0xcf53('0x3e')],'sectionId':_0xc41df8['id']},{})['then'](function(){return _0x537f4a;});}else{return _0x537f4a;}})[_0xcf53('0x5d')](function(_0x50c143){logger['error'](_0xcf53('0x65'),_0x50c143);throw _0x50c143;});}return _0x537f4a;})[_0xcf53('0x23')](respondWithResult(_0x5f43ce,0xc9))['catch'](handleError(_0x5f43ce,null));};exports[_0xcf53('0x38')]=function(_0x51edd4,_0x585ba1){if(_0x51edd4[_0xcf53('0x60')]['id']){delete _0x51edd4[_0xcf53('0x60')]['id'];}return db[_0xcf53('0x58')][_0xcf53('0x63')]({'where':{'id':_0x51edd4['params']['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x585ba1,null))[_0xcf53('0x23')](saveUpdates(_0x51edd4[_0xcf53('0x60')],null))[_0xcf53('0x23')](respondWithResult(_0x585ba1,null))[_0xcf53('0x5d')](handleError(_0x585ba1,null));};exports[_0xcf53('0x39')]=function(_0x13f4b1,_0x3e8275){return db['ChatQueue'][_0xcf53('0x63')]({'where':{'id':_0x13f4b1[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x3e8275,null))[_0xcf53('0x23')](removeEntity(_0x3e8275,null))['catch'](handleError(_0x3e8275,null));};exports[_0xcf53('0x66')]=function(_0x42c408,_0x5aa704){return db['ChatQueue'][_0xcf53('0x66')]()[_0xcf53('0x23')](respondWithResult(_0x5aa704,null))[_0xcf53('0x5d')](handleError(_0x5aa704,null));};exports[_0xcf53('0x67')]=function(_0x2b5cab,_0x143492,_0x28533a){var _0x3c05cc={'raw':!![],'where':{}},_0x2ade28={},_0x1dd0a7;return db[_0xcf53('0x58')][_0xcf53('0x68')]({'where':{'id':_0x2b5cab[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x143492,null))[_0xcf53('0x23')](function(_0x1f8f6c){if(_0x1f8f6c){_0x1dd0a7=_0x1f8f6c['get']({'plain':!![]});_0x2ade28[_0xcf53('0x45')]=_['keys'](db[_0xcf53('0x69')][_0xcf53('0x41')]);_0x2ade28[_0xcf53('0x4a')]=_[_0xcf53('0x46')](_0x2b5cab[_0xcf53('0x4a')]);_0x2ade28['filters']=_[_0xcf53('0x49')](_0x2ade28[_0xcf53('0x45')],_0x2ade28[_0xcf53('0x4a')]);_0x3c05cc[_0xcf53('0x48')]=_[_0xcf53('0x49')](_0x2ade28[_0xcf53('0x45')],qs[_0xcf53('0x4b')](_0x2b5cab[_0xcf53('0x4a')]['fields']));_0x3c05cc[_0xcf53('0x48')]=_0x3c05cc[_0xcf53('0x48')][_0xcf53('0x4c')]?_0x3c05cc[_0xcf53('0x48')]:_0x2ade28['model'];if(!_0x2b5cab[_0xcf53('0x4a')][_0xcf53('0x4d')](_0xcf53('0x4e'))){_0x3c05cc['limit']=qs['limit'](_0x2b5cab['query']['limit']);_0x3c05cc[_0xcf53('0x4f')]=qs[_0xcf53('0x4f')](_0x2b5cab[_0xcf53('0x4a')][_0xcf53('0x4f')]);}_0x3c05cc[_0xcf53('0x50')]=qs[_0xcf53('0x51')](_0x2b5cab[_0xcf53('0x4a')][_0xcf53('0x51')]);_0x3c05cc[_0xcf53('0x52')]=qs[_0xcf53('0x47')](_[_0xcf53('0x53')](_0x2b5cab['query'],_0x2ade28[_0xcf53('0x47')]));_0x3c05cc[_0xcf53('0x52')]['ChatQueueId']=_0x1f8f6c['id'];if(_0x2b5cab[_0xcf53('0x4a')]['filter']){_0x3c05cc[_0xcf53('0x52')]=_[_0xcf53('0x54')](_0x3c05cc[_0xcf53('0x52')],{'$or':_['map'](_0x3c05cc['attributes'],function(_0x452cad){var _0x2df315={};_0x2df315[_0x452cad]={'$like':'%'+_0x2b5cab[_0xcf53('0x4a')][_0xcf53('0x56')]+'%'};return _0x2df315;})});}_0x3c05cc=_[_0xcf53('0x54')]({},_0x3c05cc,_0x2b5cab[_0xcf53('0x57')]);return db[_0xcf53('0x69')][_0xcf53('0x5b')](_0x3c05cc);}})[_0xcf53('0x23')](function(_0x2c8cbf){if(_0x2c8cbf){return db['User'][_0xcf53('0x6a')]({'where':{'id':_['map'](_0x2c8cbf,_0xcf53('0x6b')),'role':_0xcf53('0x6c')},'attributes':['id','name',_0xcf53('0x6d'),'updatedAt',_0xcf53('0x6e')]});}})['then'](function(_0x42fbf1){if(_0x42fbf1){return{'count':_0x42fbf1[_0xcf53('0x31')],'rows':_[_0xcf53('0x40')](_0x42fbf1[_0xcf53('0x5c')],function(_0x2b0efb){return{'membername':_0x2b0efb[_0xcf53('0x3e')],'UserId':_0x2b0efb['id'],'queue_name':_0x1dd0a7[_0xcf53('0x3e')],'ChatQueueId':_0x1dd0a7['id'],'interface':util[_0xcf53('0x6f')]('%s/%s','SIP',_0x2b0efb[_0xcf53('0x3e')]),'penalty':0x0,'paused':_0x2b0efb[_0xcf53('0x6d')],'createdAt':_0x2b0efb[_0xcf53('0x6e')],'updatedAt':_0x2b0efb[_0xcf53('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x143492,_0x3c05cc))[_0xcf53('0x5d')](handleError(_0x143492,null));};exports[_0xcf53('0x71')]=function(_0xf94d4b,_0x57026e,_0x5d0df2){var _0x3838e1={};var _0x2b2e88={};var _0x197095;var _0x58dcb3;return db['ChatQueue'][_0xcf53('0x68')]({'where':{'id':_0xf94d4b['params']['id']}})['then'](handleEntityNotFound(_0x57026e,null))[_0xcf53('0x23')](function(_0x135916){if(_0x135916){_0x197095=_0x135916;_0x2b2e88[_0xcf53('0x45')]=_['keys'](db[_0xcf53('0x72')][_0xcf53('0x41')]);_0x2b2e88[_0xcf53('0x4a')]=_[_0xcf53('0x46')](_0xf94d4b[_0xcf53('0x4a')]);_0x2b2e88[_0xcf53('0x47')]=_[_0xcf53('0x49')](_0x2b2e88['model'],_0x2b2e88['query']);_0x3838e1['attributes']=_['intersection'](_0x2b2e88[_0xcf53('0x45')],qs[_0xcf53('0x4b')](_0xf94d4b['query'][_0xcf53('0x4b')]));_0x3838e1[_0xcf53('0x48')]=_0x3838e1[_0xcf53('0x48')]['length']?_0x3838e1[_0xcf53('0x48')]:_0x2b2e88['model'];_0x3838e1[_0xcf53('0x50')]=qs[_0xcf53('0x51')](_0xf94d4b[_0xcf53('0x4a')][_0xcf53('0x51')]);_0x3838e1[_0xcf53('0x52')]=qs['filters'](_[_0xcf53('0x53')](_0xf94d4b[_0xcf53('0x4a')],_0x2b2e88[_0xcf53('0x47')]));if(_0xf94d4b[_0xcf53('0x4a')]['filter']){_0x3838e1[_0xcf53('0x52')]=_[_0xcf53('0x54')](_0x3838e1[_0xcf53('0x52')],{'$or':_[_0xcf53('0x40')](_0x3838e1[_0xcf53('0x48')],function(_0x326774){var _0x55b8d8={};_0x55b8d8[_0x326774]={'$like':'%'+_0xf94d4b['query'][_0xcf53('0x56')]+'%'};return _0x55b8d8;})});}_0x3838e1=_[_0xcf53('0x54')]({},_0x3838e1,_0xf94d4b['options']);return _0x197095[_0xcf53('0x71')](_0x3838e1);}})['then'](function(_0x39447d){if(_0x39447d){_0x58dcb3=_0x39447d['length'];if(!_0xf94d4b['query']['hasOwnProperty'](_0xcf53('0x4e'))){_0x3838e1[_0xcf53('0x32')]=qs['limit'](_0xf94d4b[_0xcf53('0x4a')][_0xcf53('0x32')]);_0x3838e1[_0xcf53('0x4f')]=qs[_0xcf53('0x4f')](_0xf94d4b[_0xcf53('0x4a')]['offset']);}return _0x197095[_0xcf53('0x71')](_0x3838e1);}})[_0xcf53('0x23')](function(_0x6e8184){if(_0x6e8184){return _0x6e8184?{'count':_0x58dcb3,'rows':_0x6e8184}:null;}})[_0xcf53('0x23')](respondWithResult(_0x57026e,null))[_0xcf53('0x5d')](handleError(_0x57026e,null));};exports[_0xcf53('0x73')]=function(_0x127a0d,_0x91fb7,_0x4751e3){var _0x2925c4=_0x127a0d[_0xcf53('0x60')]['ids'];return db[_0xcf53('0x72')]['findAll']({'where':{'id':_0x2925c4},'attributes':['id'],'include':[{'model':db[_0xcf53('0x74')],'as':_0xcf53('0x75'),'attributes':['id',_0xcf53('0x3e'),'online',_0xcf53('0x76'),_0xcf53('0x77')],'raw':!![]}]})['then'](function(_0x589125){if(_0x589125){var _0x335281=_[_0xcf53('0x78')](_0x589125,function(_0x277025){var _0x198d6d=_0x277025[_0xcf53('0x3a')]({'plain':!![]});return _0x198d6d[_0xcf53('0x75')];});return db[_0xcf53('0x58')][_0xcf53('0x63')]({'where':{'id':_0x127a0d[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](function(_0x39f2b9){return db[_0xcf53('0x79')][_0xcf53('0x7a')](function(_0x217e34){return _0x39f2b9[_0xcf53('0x73')](_0x2925c4,{'transaction':_0x217e34})[_0xcf53('0x23')](function(){return BPromise['each'](_0x335281,function(_0x1bc587){return db[_0xcf53('0x69')][_0xcf53('0x7b')]({'where':{'UserId':_0x1bc587['id'],'ChatQueueId':_0x127a0d[_0xcf53('0x5e')]['id']},'transaction':_0x217e34});});})[_0xcf53('0x23')](function(){_0x335281[_0xcf53('0x7c')](function(_0x432b95){socket[_0xcf53('0x7d')]('userChatQueue:save',{'UserId':_0x432b95['id'],'ChatQueueId':_0x39f2b9['id']});});});});});}})['then'](respondWithStatusCode(_0x91fb7,null))[_0xcf53('0x5d')](handleError(_0x91fb7,null));};exports[_0xcf53('0x7e')]=function(_0x14414f,_0x14ecfe,_0x24b856){return db[_0xcf53('0x72')][_0xcf53('0x5b')]({'where':{'id':_0x14414f['query'][_0xcf53('0x7f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcf53('0x23')](handleEntityNotFound(_0x14ecfe,null))[_0xcf53('0x23')](function(_0x884576){var _0x2fea8e=_[_0xcf53('0x40')](_0x884576,'id');var _0x479a9f=[];var _0xaa7d13=[];var _0x2d19bc=squel['select']();_0x2d19bc[_0xcf53('0x80')]('tq.TeamId')['from'](_0xcf53('0x81'),'tq')[_0xcf53('0x82')]('user_has_teams','ut',_0xcf53('0x83'))[_0xcf53('0x52')](_0xcf53('0x84'),_0x14414f['params']['id']);for(var _0x45d840=0x0;_0x45d840<_0x884576['length'];_0x45d840+=0x1){let _0x1806e2=_0x884576[_0x45d840];for(var _0x4286d4=0x0;_0x4286d4<_0x1806e2['Agents']['length'];_0x4286d4+=0x1){let _0x492d79=_0x1806e2['Agents'][_0x4286d4];var _0x3caee3=_0x2d19bc[_0xcf53('0x85')]();_0x3caee3['where'](_0xcf53('0x86'),_0x492d79['id']);_0xaa7d13[_0xcf53('0x87')](db[_0xcf53('0x79')][_0xcf53('0x4a')](_0x3caee3[_0xcf53('0x88')](),{'type':db['sequelize'][_0xcf53('0x89')][_0xcf53('0x8a')]})['then'](function(_0x49d8aa){if(_0x49d8aa[_0xcf53('0x4c')]===0x1){return _0x492d79['id'];}else{var _0x50841d=_[_0xcf53('0x8b')](_['map'](_0x49d8aa,_0xcf53('0x8c')),function(_0x224e9a){return _[_0xcf53('0x8d')](_0x2fea8e,_0x224e9a);});if(_0x50841d){return _0x492d79['id'];}}}));}}return BPromise[_0xcf53('0x8e')](_0xaa7d13)[_0xcf53('0x23')](function(_0x54d277){_0x479a9f=_(_0x479a9f)['union'](_0x54d277)[_0xcf53('0x8f')]()[_0xcf53('0x90')]();return db[_0xcf53('0x58')]['find']({'where':{'id':_0x14414f[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](function(_0x3b01ed){return db[_0xcf53('0x79')][_0xcf53('0x7a')](function(_0x2bb694){return _0x3b01ed[_0xcf53('0x7e')](_0x14414f[_0xcf53('0x4a')][_0xcf53('0x7f')],{'transaction':_0x2bb694})['then'](function(){if(!_[_0xcf53('0x91')](_0x479a9f)){return _0x3b01ed[_0xcf53('0x92')](_0x479a9f,{'transaction':_0x2bb694});}})['then'](function(){_0x479a9f['forEach'](function(_0x312f4d){socket[_0xcf53('0x7d')](_0xcf53('0x93'),{'UserId':_0x312f4d,'ChatQueueId':_0x3b01ed['id']});});});});});});})[_0xcf53('0x23')](respondWithStatusCode(_0x14ecfe,null))[_0xcf53('0x5d')](handleError(_0x14ecfe,null));};exports['addAgents']=function(_0x59f7f6,_0x1fb5d1,_0x4750ed){return db['ChatQueue'][_0xcf53('0x63')]({'where':{'id':_0x59f7f6['params']['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x1fb5d1,null))[_0xcf53('0x23')](function(_0x252ed6){if(_0x252ed6){return _0x252ed6[_0xcf53('0x94')](_0x59f7f6['body'][_0xcf53('0x7f')],_[_0xcf53('0x95')](_0x59f7f6['body'],['ids','id'])||{})[_0xcf53('0x96')](function(_0x20977c){for(var _0x4a80a0=0x0;_0x4a80a0<_0x59f7f6[_0xcf53('0x60')]['ids']['length'];_0x4a80a0+=0x1){socket[_0xcf53('0x7d')]('userChatQueue:save',{'UserId':_0x59f7f6[_0xcf53('0x60')][_0xcf53('0x7f')][_0x4a80a0],'ChatQueueId':_0x59f7f6[_0xcf53('0x5e')]['id']});}return _0x20977c;});}})[_0xcf53('0x23')](respondWithResult(_0x1fb5d1,null))['catch'](handleError(_0x1fb5d1,null));};exports['removeAgents']=function(_0x6001a9,_0x2b9df6,_0x1931dd){return db[_0xcf53('0x58')][_0xcf53('0x63')]({'where':{'id':_0x6001a9[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x2b9df6,null))['then'](function(_0xe36d97){if(_0xe36d97){return _0xe36d97[_0xcf53('0x92')](_0x6001a9['query'][_0xcf53('0x7f')])['then'](function(){if(_[_0xcf53('0x97')](_0x6001a9['query'][_0xcf53('0x7f')])){for(var _0x201357=0x0;_0x201357<_0x6001a9[_0xcf53('0x4a')][_0xcf53('0x7f')]['length'];_0x201357+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x6001a9[_0xcf53('0x4a')]['ids'][_0x201357]),'ChatQueueId':Number(_0x6001a9[_0xcf53('0x5e')]['id'])});}}else{socket[_0xcf53('0x7d')](_0xcf53('0x93'),{'UserId':Number(_0x6001a9['query'][_0xcf53('0x7f')]),'ChatQueueId':Number(_0x6001a9[_0xcf53('0x5e')]['id'])});}});}})[_0xcf53('0x23')](respondWithStatusCode(_0x2b9df6,null))[_0xcf53('0x5d')](handleError(_0x2b9df6,null));};exports[_0xcf53('0x98')]=function(_0x159a51,_0x1b56f7,_0x3b9f6d){var _0x2bf316={};var _0x2c555e={};var _0x1264aa;var _0x3a84a2;return db[_0xcf53('0x58')][_0xcf53('0x68')]({'where':{'id':_0x159a51[_0xcf53('0x5e')]['id']}})[_0xcf53('0x23')](handleEntityNotFound(_0x1b56f7,null))[_0xcf53('0x23')](function(_0x30b19d){if(_0x30b19d){_0x1264aa=_0x30b19d;_0x2c555e[_0xcf53('0x45')]=_[_0xcf53('0x46')](db['User'][_0xcf53('0x41')]);_0x2c555e[_0xcf53('0x4a')]=_[_0xcf53('0x46')](_0x159a51[_0xcf53('0x4a')]);_0x2c555e[_0xcf53('0x47')]=_['intersection'](_0x2c555e[_0xcf53('0x45')],_0x2c555e[_0xcf53('0x4a')]);_0x2bf316[_0xcf53('0x48')]=_[_0xcf53('0x49')](_0x2c555e[_0xcf53('0x45')],qs[_0xcf53('0x4b')](_0x159a51['query']['fields']));_0x2bf316[_0xcf53('0x48')]=_0x2bf316[_0xcf53('0x48')][_0xcf53('0x4c')]?_0x2bf316[_0xcf53('0x48')]:_0x2c555e[_0xcf53('0x45')];_0x2bf316[_0xcf53('0x50')]=qs[_0xcf53('0x51')](_0x159a51[_0xcf53('0x4a')][_0xcf53('0x51')]);_0x2bf316[_0xcf53('0x52')]=qs['filters'](_[_0xcf53('0x53')](_0x159a51[_0xcf53('0x4a')],_0x2c555e[_0xcf53('0x47')]));if(_0x159a51[_0xcf53('0x4a')][_0xcf53('0x56')]){_0x2bf316[_0xcf53('0x52')]=_[_0xcf53('0x54')](_0x2bf316[_0xcf53('0x52')],{'$or':_[_0xcf53('0x40')](_0x2bf316[_0xcf53('0x48')],function(_0x2c87a0){var _0x2d84cf={};_0x2d84cf[_0x2c87a0]={'$like':'%'+_0x159a51['query'][_0xcf53('0x56')]+'%'};return _0x2d84cf;})});}_0x2bf316=_[_0xcf53('0x54')]({},_0x2bf316,_0x159a51[_0xcf53('0x57')]);return _0x1264aa['getAgents'](_0x2bf316);}})[_0xcf53('0x23')](function(_0xcf57f9){if(_0xcf57f9){_0x3a84a2=_0xcf57f9[_0xcf53('0x4c')];if(!_0x159a51['query'][_0xcf53('0x4d')](_0xcf53('0x4e'))){_0x2bf316['limit']=qs[_0xcf53('0x32')](_0x159a51[_0xcf53('0x4a')][_0xcf53('0x32')]);_0x2bf316[_0xcf53('0x4f')]=qs[_0xcf53('0x4f')](_0x159a51['query'][_0xcf53('0x4f')]);}return _0x1264aa[_0xcf53('0x98')](_0x2bf316);}})[_0xcf53('0x23')](function(_0x54f48c){if(_0x54f48c){return _0x54f48c?{'count':_0x3a84a2,'rows':_0x54f48c}:null;}})[_0xcf53('0x23')](respondWithResult(_0x1b56f7,null))['catch'](handleError(_0x1b56f7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d447be9..8773ee9 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x1e1704,_0xfbfcb0){var _0x5abf01=function(_0x14935d){while(--_0x14935d){_0x1e1704['push'](_0x1e1704['shift']());}};_0x5abf01(++_0xfbfcb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0xb10b[_0x3eff21];return _0x1945bb;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x5ded91,_0x5902d9){var _0x51890=function(_0x571585){while(--_0x571585){_0x5ded91['push'](_0x5ded91['shift']());}};_0x51890(++_0x5902d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x49a17d,_0x38066e){_0x49a17d=_0x49a17d-0x0;var _0x1810c0=_0xb10b[_0x49a17d];return _0x1810c0;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fc2164a..3d80442 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 _0x95fb=['define','ChatQueue','chat_queues','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95fb,0x174));var _0xb95f=function(_0x3c2a24,_0x5c67a0){_0x3c2a24=_0x3c2a24-0x0;var _0x1b29e1=_0x95fb[_0x3c2a24];return _0x1b29e1;};'use strict';var _=require(_0xb95f('0x0'));var util=require(_0xb95f('0x1'));var logger=require('../../config/logger')(_0xb95f('0x2'));var moment=require('moment');var BPromise=require(_0xb95f('0x3'));var rp=require(_0xb95f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb95f('0x5'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x5b864f,_0x1c5def){return _0x5b864f[_0xb95f('0x6')](_0xb95f('0x7'),attributes,{'tableName':_0xb95f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cfa=['bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','api','moment'];(function(_0x226c2c,_0x48331f){var _0x483ffa=function(_0x18532a){while(--_0x18532a){_0x226c2c['push'](_0x226c2c['shift']());}};_0x483ffa(++_0x48331f);}(_0x0cfa,0x74));var _0xa0cf=function(_0x975dd0,_0x35e9b7){_0x975dd0=_0x975dd0-0x0;var _0x31ff1a=_0x0cfa[_0x975dd0];return _0x31ff1a;};'use strict';var _=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var logger=require('../../config/logger')(_0xa0cf('0x2'));var moment=require(_0xa0cf('0x3'));var BPromise=require(_0xa0cf('0x4'));var rp=require(_0xa0cf('0x5'));var fs=require('fs');var path=require(_0xa0cf('0x6'));var rimraf=require(_0xa0cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0cf('0x8'));module[_0xa0cf('0x9')]=function(_0x2b0dab,_0x6f6ea7){return _0x2b0dab[_0xa0cf('0xa')](_0xa0cf('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 926dfbf..c860740 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e3=['localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x390b49,_0x5ecdc4){var _0x23c460=function(_0x3b815b){while(--_0x3b815b){_0x390b49['push'](_0x390b49['shift']());}};_0x23c460(++_0x5ecdc4);}(_0x11e3,0x6f));var _0x311e=function(_0x9bee87,_0x5db69e){_0x9bee87=_0x9bee87-0x0;var _0x3d8161=_0x11e3[_0x9bee87];return _0x3d8161;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var moment=require(_0x311e('0x2'));var BPromise=require(_0x311e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311e('0x4'));var db=require(_0x311e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x311e('0x6'))(_0x311e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x311e('0x8')][_0x311e('0x9')]({'port':0x232a});config[_0x311e('0xa')]=_[_0x311e('0xb')](config[_0x311e('0xa')],{'host':_0x311e('0xc'),'port':0x18eb});var socket=require(_0x311e('0xd'))(new Redis(config[_0x311e('0xa')]));require(_0x311e('0xe'))[_0x311e('0xf')](socket);function respondWithRpcPromise(_0x36b445,_0x2bde9f,_0x107912){return new BPromise(function(_0x5efdec,_0x3bab9b){return client['request'](_0x36b445,_0x107912)[_0x311e('0x10')](function(_0x33c300){logger[_0x311e('0x11')](_0x311e('0x12'),_0x2bde9f,'request\x20sent');logger['debug'](_0x311e('0x13'),_0x2bde9f,'request\x20sent',JSON['stringify'](_0x33c300));if(_0x33c300[_0x311e('0x14')]){if(_0x33c300[_0x311e('0x14')][_0x311e('0x15')]===0x1f4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x33c300[_0x311e('0x14')]['message']);return _0x3bab9b(_0x33c300[_0x311e('0x14')]['message']);}logger['error'](_0x311e('0x12'),_0x2bde9f,_0x33c300['error'][_0x311e('0x16')]);return _0x5efdec(_0x33c300['error'][_0x311e('0x16')]);}else{logger[_0x311e('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2bde9f,_0x311e('0x17'));_0x5efdec(_0x33c300[_0x311e('0x18')][_0x311e('0x16')]);}})['catch'](function(_0x30b7b4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x30b7b4);_0x3bab9b(_0x30b7b4);});});}exports[_0x311e('0x19')]=function(_0x399fc2){var _0x47f42f=this;return new Promise(function(_0x3a6ccd,_0x5c0a69){return db[_0x311e('0x1a')][_0x311e('0x1b')]({'raw':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x1d')]===undefined?!![]:![]:!![],'where':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1e')]||null:null,'attributes':_0x399fc2[_0x311e('0x1c')]?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'limit':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x20')]||null:null,'include':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0x399fc2[_0x311e('0x1c')]['include'],function(_0x45c3b6){return{'model':db[_0x45c3b6['model']],'as':_0x45c3b6['as'],'attributes':_0x45c3b6[_0x311e('0x1f')],'include':_0x45c3b6['include']?_[_0x311e('0x22')](_0x45c3b6[_0x311e('0x21')],function(_0x5e9fe2){return{'model':db[_0x5e9fe2[_0x311e('0x23')]],'as':_0x5e9fe2['as'],'attributes':_0x5e9fe2[_0x311e('0x1f')],'include':_0x5e9fe2[_0x311e('0x21')]?_[_0x311e('0x22')](_0x5e9fe2[_0x311e('0x21')],function(_0xb03d19){return{'model':db[_0xb03d19[_0x311e('0x23')]],'as':_0xb03d19['as'],'attributes':_0xb03d19[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae602){logger[_0x311e('0x11')](_0x311e('0x19'),_0x399fc2);logger[_0x311e('0x24')](_0x311e('0x19'),_0x399fc2,JSON[_0x311e('0x25')](_0x3ae602));_0x3a6ccd(_0x3ae602);})[_0x311e('0x26')](function(_0x2af62a){logger[_0x311e('0x14')](_0x311e('0x19'),_0x2af62a[_0x311e('0x16')],_0x399fc2);_0x5c0a69(_0x47f42f[_0x311e('0x14')](0x1f4,_0x2af62a[_0x311e('0x16')]));});});};exports['ShowChatQueue']=function(_0xa3139f){var _0x31ce52=this;return new Promise(function(_0x3cd5da,_0x272684){return db[_0x311e('0x1a')][_0x311e('0x27')]({'raw':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options']['raw']===undefined?!![]:![]:!![],'where':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options'][_0x311e('0x1e')]||null:null,'attributes':_0xa3139f[_0x311e('0x1c')]?_0xa3139f[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'include':_0xa3139f['options']?_0xa3139f[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0xa3139f[_0x311e('0x1c')]['include'],function(_0x2bd663){return{'model':db[_0x2bd663[_0x311e('0x23')]],'as':_0x2bd663['as'],'attributes':_0x2bd663[_0x311e('0x1f')],'include':_0x2bd663[_0x311e('0x21')]?_[_0x311e('0x22')](_0x2bd663[_0x311e('0x21')],function(_0xd6fafe){return{'model':db[_0xd6fafe['model']],'as':_0xd6fafe['as'],'attributes':_0xd6fafe[_0x311e('0x1f')],'include':_0xd6fafe[_0x311e('0x21')]?_[_0x311e('0x22')](_0xd6fafe['include'],function(_0x251b6f){return{'model':db[_0x251b6f[_0x311e('0x23')]],'as':_0x251b6f['as'],'attributes':_0x251b6f[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x311e('0x10')](function(_0xb12896){logger[_0x311e('0x11')](_0x311e('0x28'),_0xa3139f);logger[_0x311e('0x24')](_0x311e('0x28'),_0xa3139f,JSON['stringify'](_0xb12896));_0x3cd5da(_0xb12896);})[_0x311e('0x26')](function(_0x20149f){logger[_0x311e('0x14')](_0x311e('0x28'),_0x20149f['message'],_0xa3139f);_0x272684(_0x31ce52['error'](0x1f4,_0x20149f[_0x311e('0x16')]));});});}; \ No newline at end of file +var _0x81cb=['findAll','options','where','attributes','limit','include','map','model','then','catch','ShowChatQueue','find','raw','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetChatQueue','ChatQueue'];(function(_0x109866,_0x3854cd){var _0x2f2963=function(_0x22bd3c){while(--_0x22bd3c){_0x109866['push'](_0x109866['shift']());}};_0x2f2963(++_0x3854cd);}(_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 moment=require('moment');var BPromise=require(_0xb81c('0x2'));var rs=require(_0xb81c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb81c('0x4'))['db'];var utils=require(_0xb81c('0x5'));var logger=require(_0xb81c('0x6'))(_0xb81c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb81c('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb81c('0x9')]=_[_0xb81c('0xa')](config[_0xb81c('0x9')],{'host':_0xb81c('0xb'),'port':0x18eb});var socket=require(_0xb81c('0xc'))(new Redis(config[_0xb81c('0x9')]));require(_0xb81c('0xd'))[_0xb81c('0xe')](socket);function respondWithRpcPromise(_0x250dd4,_0x38bd0b,_0x115495){return new BPromise(function(_0xe05faf,_0x44dfb2){return client[_0xb81c('0xf')](_0x250dd4,_0x115495)['then'](function(_0x29a6f2){logger[_0xb81c('0x10')](_0xb81c('0x11'),_0x38bd0b,_0xb81c('0x12'));logger[_0xb81c('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x38bd0b,_0xb81c('0x12'),JSON['stringify'](_0x29a6f2));if(_0x29a6f2[_0xb81c('0x14')]){if(_0x29a6f2[_0xb81c('0x14')]['code']===0x1f4){logger[_0xb81c('0x14')](_0xb81c('0x11'),_0x38bd0b,_0x29a6f2['error'][_0xb81c('0x15')]);return _0x44dfb2(_0x29a6f2[_0xb81c('0x14')][_0xb81c('0x15')]);}logger['error'](_0xb81c('0x11'),_0x38bd0b,_0x29a6f2[_0xb81c('0x14')]['message']);return _0xe05faf(_0x29a6f2[_0xb81c('0x14')][_0xb81c('0x15')]);}else{logger[_0xb81c('0x10')]('ChatQueue,\x20%s,\x20%s',_0x38bd0b,_0xb81c('0x12'));_0xe05faf(_0x29a6f2[_0xb81c('0x16')][_0xb81c('0x15')]);}})['catch'](function(_0x174009){logger[_0xb81c('0x14')](_0xb81c('0x11'),_0x38bd0b,_0x174009);_0x44dfb2(_0x174009);});});}exports[_0xb81c('0x17')]=function(_0x3ca373){var _0x19f6c6=this;return new Promise(function(_0x445222,_0x4f09d7){return db[_0xb81c('0x18')][_0xb81c('0x19')]({'raw':_0x3ca373[_0xb81c('0x1a')]?_0x3ca373[_0xb81c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3ca373[_0xb81c('0x1a')]?_0x3ca373['options'][_0xb81c('0x1b')]||null:null,'attributes':_0x3ca373[_0xb81c('0x1a')]?_0x3ca373[_0xb81c('0x1a')][_0xb81c('0x1c')]||null:null,'limit':_0x3ca373['options']?_0x3ca373['options'][_0xb81c('0x1d')]||null:null,'include':_0x3ca373[_0xb81c('0x1a')]?_0x3ca373[_0xb81c('0x1a')][_0xb81c('0x1e')]?_[_0xb81c('0x1f')](_0x3ca373[_0xb81c('0x1a')][_0xb81c('0x1e')],function(_0xc1fadb){return{'model':db[_0xc1fadb[_0xb81c('0x20')]],'as':_0xc1fadb['as'],'attributes':_0xc1fadb[_0xb81c('0x1c')],'include':_0xc1fadb[_0xb81c('0x1e')]?_[_0xb81c('0x1f')](_0xc1fadb[_0xb81c('0x1e')],function(_0x20b7ea){return{'model':db[_0x20b7ea[_0xb81c('0x20')]],'as':_0x20b7ea['as'],'attributes':_0x20b7ea[_0xb81c('0x1c')],'include':_0x20b7ea[_0xb81c('0x1e')]?_['map'](_0x20b7ea['include'],function(_0x15f86e){return{'model':db[_0x15f86e[_0xb81c('0x20')]],'as':_0x15f86e['as'],'attributes':_0x15f86e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb81c('0x21')](function(_0x331692){logger['info'](_0xb81c('0x17'),_0x3ca373);logger['debug'](_0xb81c('0x17'),_0x3ca373,JSON['stringify'](_0x331692));_0x445222(_0x331692);})[_0xb81c('0x22')](function(_0x2c98ed){logger[_0xb81c('0x14')]('GetChatQueue',_0x2c98ed[_0xb81c('0x15')],_0x3ca373);_0x4f09d7(_0x19f6c6['error'](0x1f4,_0x2c98ed[_0xb81c('0x15')]));});});};exports[_0xb81c('0x23')]=function(_0x59776a){var _0x74ff46=this;return new Promise(function(_0x6d3949,_0x3ad282){return db['ChatQueue'][_0xb81c('0x24')]({'raw':_0x59776a[_0xb81c('0x1a')]?_0x59776a[_0xb81c('0x1a')][_0xb81c('0x25')]===undefined?!![]:![]:!![],'where':_0x59776a[_0xb81c('0x1a')]?_0x59776a[_0xb81c('0x1a')][_0xb81c('0x1b')]||null:null,'attributes':_0x59776a[_0xb81c('0x1a')]?_0x59776a[_0xb81c('0x1a')][_0xb81c('0x1c')]||null:null,'include':_0x59776a['options']?_0x59776a[_0xb81c('0x1a')]['include']?_['map'](_0x59776a[_0xb81c('0x1a')]['include'],function(_0x28f005){return{'model':db[_0x28f005['model']],'as':_0x28f005['as'],'attributes':_0x28f005[_0xb81c('0x1c')],'include':_0x28f005[_0xb81c('0x1e')]?_['map'](_0x28f005[_0xb81c('0x1e')],function(_0x455ab3){return{'model':db[_0x455ab3[_0xb81c('0x20')]],'as':_0x455ab3['as'],'attributes':_0x455ab3['attributes'],'include':_0x455ab3[_0xb81c('0x1e')]?_[_0xb81c('0x1f')](_0x455ab3[_0xb81c('0x1e')],function(_0x3c97f7){return{'model':db[_0x3c97f7['model']],'as':_0x3c97f7['as'],'attributes':_0x3c97f7[_0xb81c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb81c('0x21')](function(_0x17d228){logger[_0xb81c('0x10')](_0xb81c('0x23'),_0x59776a);logger[_0xb81c('0x13')](_0xb81c('0x23'),_0x59776a,JSON[_0xb81c('0x26')](_0x17d228));_0x6d3949(_0x17d228);})['catch'](function(_0x50f988){logger['error']('ShowChatQueue',_0x50f988['message'],_0x59776a);_0x3ad282(_0x74ff46[_0xb81c('0x14')](0x1f4,_0x50f988['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f7be946..25c955c 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(_0x11bc40,_0x537bbc){var _0x2b7a99=function(_0x50135b){while(--_0x50135b){_0x11bc40['push'](_0x11bc40['shift']());}};_0x2b7a99(++_0x537bbc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c5c49,_0x8640df){_0x2c5c49=_0x2c5c49-0x0;var _0x3b047d=_0x5f2f[_0x2c5c49];return _0x3b047d;};'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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x13a094,_0x250688){var _0xa3d083=function(_0xa272f4){while(--_0xa272f4){_0x13a094['push'](_0x13a094['shift']());}};_0xa3d083(++_0x250688);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2b4e,_0x5cba62){_0x3e2b4e=_0x3e2b4e-0x0;var _0xa545e9=_0xb10b[_0x3e2b4e];return _0xa545e9;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index b8516df..dc710ac 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 _0x3f7f=['get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller'];(function(_0x494ea1,_0x50df4a){var _0x1da9da=function(_0x1bc499){while(--_0x1bc499){_0x494ea1['push'](_0x494ea1['shift']());}};_0x1da9da(++_0x50df4a);}(_0x3f7f,0xbb));var _0xf3f7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3f7f[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xf3f7('0x0'));var util=require(_0xf3f7('0x1'));var path=require('path');var timeout=require(_0xf3f7('0x2'));var express=require(_0xf3f7('0x3'));var router=express[_0xf3f7('0x4')]();var auth=require(_0xf3f7('0x5'));var interaction=require(_0xf3f7('0x6'));var config=require(_0xf3f7('0x7'));var controller=require(_0xf3f7('0x8'));router[_0xf3f7('0x9')]('/',auth['isAuthenticated'](),controller[_0xf3f7('0xa')]);router[_0xf3f7('0x9')](_0xf3f7('0xb'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0xd')]);router['get']('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0xe')]);router[_0xf3f7('0x9')](_0xf3f7('0xf'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x10')]);router['get'](_0xf3f7('0x11'),auth[_0xf3f7('0xc')](),controller['getTeams']);router[_0xf3f7('0x9')](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x13')]);router[_0xf3f7('0x14')]('/',auth[_0xf3f7('0xc')](),controller['create']);router[_0xf3f7('0x14')](_0xf3f7('0x11'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x15')]);router[_0xf3f7('0x14')](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x16')]);router[_0xf3f7('0x17')]('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x18')]);router[_0xf3f7('0x19')]('/:id',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x1a')]);router[_0xf3f7('0x19')]('/:id/teams',auth[_0xf3f7('0xc')](),controller[_0xf3f7('0x1b')]);router['delete'](_0xf3f7('0x12'),auth[_0xf3f7('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x536f=['create','/:id/teams','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x536f,0xe4));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf536('0x0'));var util=require(_0xf536('0x1'));var path=require(_0xf536('0x2'));var timeout=require(_0xf536('0x3'));var express=require(_0xf536('0x4'));var router=express['Router']();var auth=require(_0xf536('0x5'));var interaction=require(_0xf536('0x6'));var config=require(_0xf536('0x7'));var controller=require(_0xf536('0x8'));router[_0xf536('0x9')]('/',auth[_0xf536('0xa')](),controller['index']);router['get'](_0xf536('0xb'),auth[_0xf536('0xa')](),controller['describe']);router[_0xf536('0x9')](_0xf536('0xc'),auth[_0xf536('0xa')](),controller[_0xf536('0xd')]);router['get'](_0xf536('0xe'),auth[_0xf536('0xa')](),controller[_0xf536('0xf')]);router[_0xf536('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf536('0x10')]);router[_0xf536('0x9')](_0xf536('0x11'),auth[_0xf536('0xa')](),controller[_0xf536('0x12')]);router[_0xf536('0x13')]('/',auth[_0xf536('0xa')](),controller[_0xf536('0x14')]);router[_0xf536('0x13')](_0xf536('0x15'),auth[_0xf536('0xa')](),controller[_0xf536('0x16')]);router[_0xf536('0x13')]('/:id/users',auth[_0xf536('0xa')](),controller[_0xf536('0x17')]);router[_0xf536('0x18')](_0xf536('0xc'),auth['isAuthenticated'](),controller[_0xf536('0x19')]);router['delete'](_0xf536('0xc'),auth['isAuthenticated'](),controller[_0xf536('0x1a')]);router[_0xf536('0x1b')]('/:id/teams',auth[_0xf536('0xa')](),controller[_0xf536('0x1c')]);router[_0xf536('0x1b')](_0xf536('0x11'),auth['isAuthenticated'](),controller[_0xf536('0x1d')]);module[_0xf536('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 300ffac..dd7b8ac 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 _0x9db1=['sequelize','exports','STRING','DATE','moment'];(function(_0x595775,_0x1d5665){var _0x5ad30f=function(_0xf245e3){while(--_0xf245e3){_0x595775['push'](_0x595775['shift']());}};_0x5ad30f(++_0x1d5665);}(_0x9db1,0x6d));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x19db('0x0'));var Sequelize=require(_0x19db('0x1'));module[_0x19db('0x2')]={'uniqueid':{'type':Sequelize[_0x19db('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x19db('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x19db('0x4')]},'exitAt':{'type':Sequelize[_0x19db('0x4')]},'reason':{'type':Sequelize[_0x19db('0x3')]}}; \ No newline at end of file +var _0xaee5=['DATE','moment','exports','STRING'];(function(_0x24f2ca,_0x4e4b65){var _0x2f6646=function(_0x40aa5a){while(--_0x40aa5a){_0x24f2ca['push'](_0x24f2ca['shift']());}};_0x2f6646(++_0x4e4b65);}(_0xaee5,0xd5));var _0x5aee=function(_0x38c062,_0x64d638){_0x38c062=_0x38c062-0x0;var _0x541b5a=_0xaee5[_0x38c062];return _0x541b5a;};'use strict';var moment=require(_0x5aee('0x0'));var Sequelize=require('sequelize');module[_0x5aee('0x1')]={'uniqueid':{'type':Sequelize[_0x5aee('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5aee('0x2')]},'joinAt':{'type':Sequelize[_0x5aee('0x3')]},'leaveAt':{'type':Sequelize[_0x5aee('0x3')]},'acceptAt':{'type':Sequelize[_0x5aee('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5aee('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 39f11a6..84a3ee2 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 _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x19f103,_0xf56bc6){var _0x543133=function(_0x2d73fd){while(--_0x2d73fd){_0x19f103['push'](_0x19f103['shift']());}};_0x543133(++_0xf56bc6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xcb91[_0x102977];return _0x15c466;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['ChatQueueReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['ChatQueueReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['ChatQueueReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x757a,0xde));var _0xa757=function(_0x2beb4d,_0x46c608){_0x2beb4d=_0x2beb4d-0x0;var _0x149741=_0x757a[_0x2beb4d];return _0x149741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 01048f2..6ae7325 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 _0x1e3e=['moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','ChatQueueReport','util','../../config/logger','api'];(function(_0x57e7f3,_0x208fb0){var _0x28a1c5=function(_0xe301a4){while(--_0xe301a4){_0x57e7f3['push'](_0x57e7f3['shift']());}};_0x28a1c5(++_0x208fb0);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1e3e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe1e3('0x0'));var logger=require(_0xe1e3('0x1'))(_0xe1e3('0x2'));var moment=require(_0xe1e3('0x3'));var BPromise=require(_0xe1e3('0x4'));var rp=require(_0xe1e3('0x5'));var fs=require('fs');var path=require(_0xe1e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe1e3('0x7'));var attributes=require(_0xe1e3('0x8'));module[_0xe1e3('0x9')]=function(_0x21f80e,_0x18f17f){return _0x21f80e['define'](_0xe1e3('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd080=['api','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd080,0x1bb));var _0x0d08=function(_0x566e2f,_0x4c351c){_0x566e2f=_0x566e2f-0x0;var _0x3654d8=_0xd080[_0x566e2f];return _0x3654d8;};'use strict';var _=require(_0x0d08('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d08('0x1'));var moment=require(_0x0d08('0x2'));var BPromise=require(_0x0d08('0x3'));var rp=require(_0x0d08('0x4'));var fs=require('fs');var path=require(_0x0d08('0x5'));var rimraf=require('rimraf');var config=require(_0x0d08('0x6'));var attributes=require(_0x0d08('0x7'));module[_0x0d08('0x8')]=function(_0x406ecc,_0x18ae14){return _0x406ecc[_0x0d08('0x9')](_0x0d08('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x0d08('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 d1091b7..50c5398 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 _0xf34f=['CreateChatQueueReport','create','options','raw','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xf34f,0x6b));var _0xff34=function(_0x84801a,_0x45fccc){_0x84801a=_0x84801a-0x0;var _0x3461ea=_0xf34f[_0x84801a];return _0x3461ea;};'use strict';var _=require('lodash');var util=require(_0xff34('0x0'));var moment=require('moment');var BPromise=require(_0xff34('0x1'));var rs=require(_0xff34('0x2'));var fs=require('fs');var Redis=require(_0xff34('0x3'));var db=require(_0xff34('0x4'))['db'];var utils=require(_0xff34('0x5'));var logger=require(_0xff34('0x6'))(_0xff34('0x7'));var config=require(_0xff34('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff34('0x9')][_0xff34('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dc18,_0x4e3ce3,_0x3529e9){return new BPromise(function(_0x69eb40,_0x5d2ea4){return client[_0xff34('0xb')](_0x17dc18,_0x3529e9)[_0xff34('0xc')](function(_0x4fd470){logger[_0xff34('0xd')](_0xff34('0xe'),_0x4e3ce3,'request\x20sent');logger[_0xff34('0xf')](_0xff34('0x10'),_0x4e3ce3,'request\x20sent',JSON[_0xff34('0x11')](_0x4fd470));if(_0x4fd470[_0xff34('0x12')]){if(_0x4fd470[_0xff34('0x12')]['code']===0x1f4){logger[_0xff34('0x12')](_0xff34('0xe'),_0x4e3ce3,_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);return _0x5d2ea4(_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);}logger[_0xff34('0x12')](_0xff34('0xe'),_0x4e3ce3,_0x4fd470[_0xff34('0x12')]['message']);return _0x69eb40(_0x4fd470[_0xff34('0x12')][_0xff34('0x13')]);}else{logger[_0xff34('0xd')](_0xff34('0xe'),_0x4e3ce3,'request\x20sent');_0x69eb40(_0x4fd470[_0xff34('0x14')][_0xff34('0x13')]);}})['catch'](function(_0xbb37ff){logger['error'](_0xff34('0xe'),_0x4e3ce3,_0xbb37ff);_0x5d2ea4(_0xbb37ff);});});}exports[_0xff34('0x15')]=function(_0x50bb3a){var _0x3f1397=this;return new Promise(function(_0x507ba3,_0x2635ae){return db['ChatQueueReport'][_0xff34('0x16')](_0x50bb3a['body'],{'raw':_0x50bb3a['options']?_0x50bb3a[_0xff34('0x17')][_0xff34('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xbcc486){logger['info']('CreateChatQueueReport',_0x50bb3a);logger[_0xff34('0xf')](_0xff34('0x15'),_0x50bb3a,JSON[_0xff34('0x11')](_0xbcc486));_0x507ba3(_0xbcc486);})['catch'](function(_0x4e0037){logger[_0xff34('0x12')](_0xff34('0x15'),_0x4e0037[_0xff34('0x13')],_0x50bb3a);_0x2635ae(_0x3f1397['error'](0x1f4,_0x4e0037['message']));});});};exports[_0xff34('0x19')]=function(_0x4eb14e){var _0x7f37a3=this;return new Promise(function(_0x5b5232,_0x496382){return db[_0xff34('0x1a')][_0xff34('0x1b')](_0x4eb14e['body'],{'raw':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e[_0xff34('0x17')][_0xff34('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1c')]||null:null,'attributes':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1d')]||null:null,'limit':_0x4eb14e[_0xff34('0x17')]?_0x4eb14e['options'][_0xff34('0x1e')]||null:null})[_0xff34('0xc')](function(_0x279e66){logger[_0xff34('0xd')](_0xff34('0x19'),_0x4eb14e);logger['debug'](_0xff34('0x19'),_0x4eb14e,JSON[_0xff34('0x11')](_0x279e66));_0x5b5232(_0x279e66);})[_0xff34('0x1f')](function(_0x19c837){logger['error'](_0xff34('0x19'),_0x19c837[_0xff34('0x13')],_0x4eb14e);_0x496382(_0x7f37a3['error'](0x1f4,_0x19c837['message']));});});}; \ No newline at end of file +var _0x743b=['http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport','create','options','raw','CreateChatQueueReport','catch','update','body','where','limit','UpdateChatQueueReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0x743b,0x117));var _0xb743=function(_0xc53cce,_0x1d5b00){_0xc53cce=_0xc53cce-0x0;var _0x20086f=_0x743b[_0xc53cce];return _0x20086f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb743('0x0'));var BPromise=require(_0xb743('0x1'));var rs=require(_0xb743('0x2'));var fs=require('fs');var Redis=require(_0xb743('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb743('0x4'));var logger=require(_0xb743('0x5'))(_0xb743('0x6'));var config=require('../../config/environment');var jayson=require(_0xb743('0x7'));var client=jayson[_0xb743('0x8')][_0xb743('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1201f9,_0x230b6b,_0x2e502c){return new BPromise(function(_0x460fda,_0x57477d){return client[_0xb743('0xa')](_0x1201f9,_0x2e502c)[_0xb743('0xb')](function(_0x78b3a){logger[_0xb743('0xc')](_0xb743('0xd'),_0x230b6b,_0xb743('0xe'));logger[_0xb743('0xf')](_0xb743('0x10'),_0x230b6b,_0xb743('0xe'),JSON[_0xb743('0x11')](_0x78b3a));if(_0x78b3a[_0xb743('0x12')]){if(_0x78b3a[_0xb743('0x12')][_0xb743('0x13')]===0x1f4){logger[_0xb743('0x12')](_0xb743('0xd'),_0x230b6b,_0x78b3a[_0xb743('0x12')]['message']);return _0x57477d(_0x78b3a[_0xb743('0x12')]['message']);}logger['error'](_0xb743('0xd'),_0x230b6b,_0x78b3a[_0xb743('0x12')]['message']);return _0x460fda(_0x78b3a[_0xb743('0x12')][_0xb743('0x14')]);}else{logger[_0xb743('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x230b6b,_0xb743('0xe'));_0x460fda(_0x78b3a['result']['message']);}})['catch'](function(_0x1015b5){logger['error'](_0xb743('0xd'),_0x230b6b,_0x1015b5);_0x57477d(_0x1015b5);});});}exports['CreateChatQueueReport']=function(_0x367ae1){var _0x264e96=this;return new Promise(function(_0x1f7d9d,_0x4650b8){return db[_0xb743('0x15')][_0xb743('0x16')](_0x367ae1['body'],{'raw':_0x367ae1['options']?_0x367ae1[_0xb743('0x17')][_0xb743('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x45e67c){logger[_0xb743('0xc')](_0xb743('0x19'),_0x367ae1);logger[_0xb743('0xf')]('CreateChatQueueReport',_0x367ae1,JSON['stringify'](_0x45e67c));_0x1f7d9d(_0x45e67c);})[_0xb743('0x1a')](function(_0x17e2d0){logger[_0xb743('0x12')](_0xb743('0x19'),_0x17e2d0[_0xb743('0x14')],_0x367ae1);_0x4650b8(_0x264e96[_0xb743('0x12')](0x1f4,_0x17e2d0['message']));});});};exports['UpdateChatQueueReport']=function(_0x237836){var _0x3f899b=this;return new Promise(function(_0xecfd1c,_0x2d253d){return db[_0xb743('0x15')][_0xb743('0x1b')](_0x237836[_0xb743('0x1c')],{'raw':_0x237836[_0xb743('0x17')]?_0x237836[_0xb743('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x237836['options']?_0x237836[_0xb743('0x17')][_0xb743('0x1d')]||null:null,'attributes':_0x237836['options']?_0x237836['options']['attributes']||null:null,'limit':_0x237836[_0xb743('0x17')]?_0x237836[_0xb743('0x17')][_0xb743('0x1e')]||null:null})[_0xb743('0xb')](function(_0x4d59f4){logger[_0xb743('0xc')](_0xb743('0x1f'),_0x237836);logger['debug'](_0xb743('0x1f'),_0x237836,JSON[_0xb743('0x11')](_0x4d59f4));_0xecfd1c(_0x4d59f4);})[_0xb743('0x1a')](function(_0x53ba19){logger[_0xb743('0x12')](_0xb743('0x1f'),_0x53ba19['message'],_0x237836);_0x2d253d(_0x3f899b['error'](0x1f4,_0x53ba19[_0xb743('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 699b29c..425c0d7 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 _0xd88e=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x14e0a6,_0x51a319){var _0x5f21f9=function(_0x48d33d){while(--_0x48d33d){_0x14e0a6['push'](_0x14e0a6['shift']());}};_0x5f21f9(++_0x51a319);}(_0xd88e,0x14d));var _0xed88=function(_0x15b64a,_0x231453){_0x15b64a=_0x15b64a-0x0;var _0x33b57d=_0xd88e[_0x15b64a];return _0x33b57d;};'use strict';var multer=require(_0xed88('0x0'));var util=require('util');var path=require(_0xed88('0x1'));var timeout=require(_0xed88('0x2'));var express=require(_0xed88('0x3'));var router=express['Router']();var auth=require(_0xed88('0x4'));var interaction=require(_0xed88('0x5'));var config=require(_0xed88('0x6'));var controller=require(_0xed88('0x7'));router[_0xed88('0x8')]('/',auth[_0xed88('0x9')](),controller[_0xed88('0xa')]);router['get'](_0xed88('0xb'),auth['isAuthenticated'](),controller[_0xed88('0xc')]);router[_0xed88('0x8')](_0xed88('0xd'),auth[_0xed88('0x9')](),controller[_0xed88('0xe')]);router[_0xed88('0xf')]('/',auth[_0xed88('0x9')](),controller[_0xed88('0x10')]);router[_0xed88('0x11')](_0xed88('0xd'),auth[_0xed88('0x9')](),controller[_0xed88('0x12')]);router[_0xed88('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xed88('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe596=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete'];(function(_0x36147b,_0x57f40b){var _0x141351=function(_0x219aa1){while(--_0x219aa1){_0x36147b['push'](_0x36147b['shift']());}};_0x141351(++_0x57f40b);}(_0xe596,0x156));var _0x6e59=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe596[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x6e59('0x0'));var util=require(_0x6e59('0x1'));var path=require(_0x6e59('0x2'));var timeout=require(_0x6e59('0x3'));var express=require(_0x6e59('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6e59('0x5'));var config=require(_0x6e59('0x6'));var controller=require(_0x6e59('0x7'));router[_0x6e59('0x8')]('/',auth['isAuthenticated'](),controller[_0x6e59('0x9')]);router['get'](_0x6e59('0xa'),auth[_0x6e59('0xb')](),controller[_0x6e59('0xc')]);router[_0x6e59('0x8')](_0x6e59('0xd'),auth[_0x6e59('0xb')](),controller['show']);router[_0x6e59('0xe')]('/',auth[_0x6e59('0xb')](),controller[_0x6e59('0xf')]);router['put'](_0x6e59('0xd'),auth['isAuthenticated'](),controller[_0x6e59('0x10')]);router[_0x6e59('0x11')](_0x6e59('0xd'),auth[_0x6e59('0xb')](),controller[_0x6e59('0x12')]);module[_0x6e59('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 8c2266b..b5eb057 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 _0x6e21=['account','agent','queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6e21,0x16d));var _0x16e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6e21[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x16e2('0x0'));var Sequelize=require(_0x16e2('0x1'));module[_0x16e2('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x16e2('0x3')](_0x16e2('0x4'),_0x16e2('0x5'),_0x16e2('0x6')),'allowNull':![],'defaultValue':_0x16e2('0x6')},'transferredAt':{'type':Sequelize[_0x16e2('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x16e2('0x8')]}}; \ No newline at end of file +var _0x7d69=['ENUM','account','agent','DATE','moment','sequelize','STRING'];(function(_0xa0564f,_0x4204f5){var _0x5ad6b6=function(_0x5d81c6){while(--_0x5d81c6){_0xa0564f['push'](_0xa0564f['shift']());}};_0x5ad6b6(++_0x4204f5);}(_0x7d69,0x193));var _0x97d6=function(_0x17bcce,_0x39ec4a){_0x17bcce=_0x17bcce-0x0;var _0x47fccb=_0x7d69[_0x17bcce];return _0x47fccb;};'use strict';var moment=require(_0x97d6('0x0'));var Sequelize=require(_0x97d6('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x97d6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x97d6('0x3')](_0x97d6('0x4'),_0x97d6('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x97d6('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e46d33a..55d64c9 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 _0xc7a1=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs'];(function(_0x373f8a,_0x4f9602){var _0x5200eb=function(_0xa8bd5){while(--_0xa8bd5){_0x373f8a['push'](_0x373f8a['shift']());}};_0x5200eb(++_0x4f9602);}(_0xc7a1,0x115));var _0x1c7a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc7a1[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x1c7a('0x0'));var emlformat=require(_0x1c7a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c7a('0x2'));var jsonpatch=require(_0x1c7a('0x3'));var rp=require(_0x1c7a('0x4'));var moment=require(_0x1c7a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1c7a('0x6'));var util=require(_0x1c7a('0x7'));var path=require('path');var sox=require(_0x1c7a('0x8'));var csv=require(_0x1c7a('0x9'));var ejs=require(_0x1c7a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c7a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1c7a('0x9'));var querystring=require(_0x1c7a('0xc'));var Papa=require(_0x1c7a('0xd'));var Redis=require(_0x1c7a('0xe'));var authService=require(_0x1c7a('0xf'));var qs=require(_0x1c7a('0x10'));var as=require(_0x1c7a('0x11'));var hardwareService=require(_0x1c7a('0x12'));var logger=require(_0x1c7a('0x13'))('api');var utils=require(_0x1c7a('0x14'));var config=require(_0x1c7a('0x15'));var db=require(_0x1c7a('0x16'))['db'];function respondWithStatusCode(_0x55561f,_0x54d791){_0x54d791=_0x54d791||0xcc;return function(_0x284d97){if(_0x284d97){return _0x55561f['sendStatus'](_0x54d791);}return _0x55561f[_0x1c7a('0x17')](_0x54d791)[_0x1c7a('0x18')]();};}function respondWithResult(_0x1f1137,_0x49871d){_0x49871d=_0x49871d||0xc8;return function(_0x226642){if(_0x226642){return _0x1f1137[_0x1c7a('0x17')](_0x49871d)[_0x1c7a('0x19')](_0x226642);}};}function respondWithFilteredResult(_0x39d14f,_0x1f252c){return function(_0x332e25){if(_0x332e25){var _0x2562ba=_0x332e25[_0x1c7a('0x1a')],_0x47a1eb=_0x1f252c[_0x1c7a('0x1b')],_0x5d80ab=_0x1f252c[_0x1c7a('0x1b')]+_0x1f252c[_0x1c7a('0x1c')],_0x440924;if(_0x5d80ab>=_0x2562ba){_0x5d80ab=_0x2562ba;_0x440924=0xc8;}else{_0x440924=0xce;}_0x39d14f[_0x1c7a('0x17')](_0x440924);return _0x39d14f[_0x1c7a('0x1d')](_0x1c7a('0x1e'),_0x47a1eb+'-'+_0x5d80ab+'/'+_0x2562ba)[_0x1c7a('0x19')](_0x332e25);}return null;};}function patchUpdates(_0x1b0a77){return function(_0x35f498){try{jsonpatch['apply'](_0x35f498,_0x1b0a77,!![]);}catch(_0x5147d){return BPromise['reject'](_0x5147d);}return _0x35f498[_0x1c7a('0x1f')]();};}function saveUpdates(_0x41ebcd,_0x239045){return function(_0x281b6e){if(_0x281b6e){return _0x281b6e[_0x1c7a('0x20')](_0x41ebcd)[_0x1c7a('0x21')](function(_0x5bcda5){return _0x5bcda5;});}return null;};}function removeEntity(_0x14ca1e,_0x355f36){return function(_0x26528e){if(_0x26528e){return _0x26528e['destroy']()[_0x1c7a('0x21')](function(){_0x14ca1e[_0x1c7a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471943,_0x3168bf){return function(_0x4b96cd){if(!_0x4b96cd){_0x471943[_0x1c7a('0x22')](0x194);}return _0x4b96cd;};}function handleError(_0x32e527,_0x45eaf0){_0x45eaf0=_0x45eaf0||0x1f4;return function(_0x1bd901){logger[_0x1c7a('0x23')](_0x1bd901[_0x1c7a('0x24')]);if(_0x1bd901['name']){delete _0x1bd901[_0x1c7a('0x25')];}_0x32e527['status'](_0x45eaf0)[_0x1c7a('0x26')](_0x1bd901);};}exports[_0x1c7a('0x27')]=function(_0x588a8f,_0x13cb8e){var _0x1bf403={},_0x134d90={},_0x353610={'count':0x0,'rows':[]};var _0x31951e=_[_0x1c7a('0x28')](db[_0x1c7a('0x29')][_0x1c7a('0x2a')],function(_0x214924){return{'name':_0x214924[_0x1c7a('0x2b')],'type':_0x214924[_0x1c7a('0x2c')]['key']};});_0x134d90[_0x1c7a('0x2d')]=_[_0x1c7a('0x28')](_0x31951e,_0x1c7a('0x25'));_0x134d90[_0x1c7a('0x2e')]=_[_0x1c7a('0x2f')](_0x588a8f[_0x1c7a('0x2e')]);_0x134d90['filters']=_[_0x1c7a('0x30')](_0x134d90[_0x1c7a('0x2d')],_0x134d90['query']);_0x1bf403[_0x1c7a('0x31')]=_['intersection'](_0x134d90['model'],qs[_0x1c7a('0x32')](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x32')]));_0x1bf403[_0x1c7a('0x31')]=_0x1bf403[_0x1c7a('0x31')][_0x1c7a('0x33')]?_0x1bf403[_0x1c7a('0x31')]:_0x134d90[_0x1c7a('0x2d')];if(!_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x34')]('nolimit')){_0x1bf403[_0x1c7a('0x1c')]=qs[_0x1c7a('0x1c')](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x1c')]);_0x1bf403['offset']=qs['offset'](_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x1b')]);}_0x1bf403[_0x1c7a('0x35')]=qs[_0x1c7a('0x36')](_0x588a8f[_0x1c7a('0x2e')]['sort']);_0x1bf403[_0x1c7a('0x37')]=qs[_0x1c7a('0x38')](_['pick'](_0x588a8f[_0x1c7a('0x2e')],_0x134d90[_0x1c7a('0x38')]),_0x31951e);if(_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x39')]){_0x1bf403[_0x1c7a('0x37')]=_[_0x1c7a('0x3a')](_0x1bf403['where'],{'$or':_[_0x1c7a('0x28')](_0x31951e,function(_0x5ad977){if(_0x5ad977[_0x1c7a('0x2c')]!==_0x1c7a('0x3b')){var _0x5d980b={};_0x5d980b[_0x5ad977['name']]={'$like':'%'+_0x588a8f[_0x1c7a('0x2e')][_0x1c7a('0x39')]+'%'};return _0x5d980b;}})});}_0x1bf403=_['merge']({},_0x1bf403,_0x588a8f[_0x1c7a('0x3c')]);var _0x113dbb={'where':_0x1bf403[_0x1c7a('0x37')]};return db['ChatTransferReport'][_0x1c7a('0x1a')](_0x113dbb)[_0x1c7a('0x21')](function(_0x5740f5){_0x353610[_0x1c7a('0x1a')]=_0x5740f5;if(_0x588a8f[_0x1c7a('0x2e')]['includeAll']){_0x1bf403['include']=[{'all':!![]}];}return db[_0x1c7a('0x29')][_0x1c7a('0x3d')](_0x1bf403);})[_0x1c7a('0x21')](function(_0x433bed){_0x353610[_0x1c7a('0x3e')]=_0x433bed;return _0x353610;})['then'](respondWithFilteredResult(_0x13cb8e,_0x1bf403))[_0x1c7a('0x3f')](handleError(_0x13cb8e,null));};exports[_0x1c7a('0x40')]=function(_0x4a41e1,_0x5b757a){var _0x55ec03={'raw':!![],'where':{'id':_0x4a41e1['params']['id']}},_0x2dbaf6={};_0x2dbaf6['model']=_['keys'](db[_0x1c7a('0x29')][_0x1c7a('0x2a')]);_0x2dbaf6[_0x1c7a('0x2e')]=_[_0x1c7a('0x2f')](_0x4a41e1[_0x1c7a('0x2e')]);_0x2dbaf6[_0x1c7a('0x38')]=_[_0x1c7a('0x30')](_0x2dbaf6[_0x1c7a('0x2d')],_0x2dbaf6[_0x1c7a('0x2e')]);_0x55ec03['attributes']=_['intersection'](_0x2dbaf6['model'],qs[_0x1c7a('0x32')](_0x4a41e1[_0x1c7a('0x2e')][_0x1c7a('0x32')]));_0x55ec03[_0x1c7a('0x31')]=_0x55ec03[_0x1c7a('0x31')][_0x1c7a('0x33')]?_0x55ec03[_0x1c7a('0x31')]:_0x2dbaf6[_0x1c7a('0x2d')];if(_0x4a41e1[_0x1c7a('0x2e')][_0x1c7a('0x41')]){_0x55ec03[_0x1c7a('0x42')]=[{'all':!![]}];}_0x55ec03=_['merge']({},_0x55ec03,_0x4a41e1[_0x1c7a('0x3c')]);return db[_0x1c7a('0x29')][_0x1c7a('0x43')](_0x55ec03)[_0x1c7a('0x21')](handleEntityNotFound(_0x5b757a,null))['then'](respondWithResult(_0x5b757a,null))['catch'](handleError(_0x5b757a,null));};exports[_0x1c7a('0x44')]=function(_0x5c7c76,_0x50092a){return db[_0x1c7a('0x29')]['create'](_0x5c7c76[_0x1c7a('0x45')],{})[_0x1c7a('0x21')](respondWithResult(_0x50092a,0xc9))[_0x1c7a('0x3f')](handleError(_0x50092a,null));};exports[_0x1c7a('0x20')]=function(_0x56eadb,_0x17d7f7){if(_0x56eadb[_0x1c7a('0x45')]['id']){delete _0x56eadb[_0x1c7a('0x45')]['id'];}return db[_0x1c7a('0x29')]['find']({'where':{'id':_0x56eadb[_0x1c7a('0x46')]['id']}})['then'](handleEntityNotFound(_0x17d7f7,null))[_0x1c7a('0x21')](saveUpdates(_0x56eadb['body'],null))[_0x1c7a('0x21')](respondWithResult(_0x17d7f7,null))[_0x1c7a('0x3f')](handleError(_0x17d7f7,null));};exports['destroy']=function(_0x1980e9,_0x1117f1){return db[_0x1c7a('0x29')][_0x1c7a('0x43')]({'where':{'id':_0x1980e9[_0x1c7a('0x46')]['id']}})[_0x1c7a('0x21')](handleEntityNotFound(_0x1117f1,null))[_0x1c7a('0x21')](removeEntity(_0x1117f1,null))[_0x1c7a('0x3f')](handleError(_0x1117f1,null));};exports[_0x1c7a('0x47')]=function(_0x6f6959,_0x47f09a){return db[_0x1c7a('0x29')]['describe']()[_0x1c7a('0x21')](respondWithResult(_0x47f09a,null))[_0x1c7a('0x3f')](handleError(_0x47f09a,null));}; \ No newline at end of file +var _0x37b5=['create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x4e5261,_0x389ce3){var _0x40b3ba=function(_0xfa9406){while(--_0xfa9406){_0x4e5261['push'](_0x4e5261['shift']());}};_0x40b3ba(++_0x389ce3);}(_0x37b5,0x95));var _0x537b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x37b5[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x537b('0x0'));var emlformat=require(_0x537b('0x1'));var rimraf=require(_0x537b('0x2'));var zipdir=require(_0x537b('0x3'));var jsonpatch=require(_0x537b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x537b('0x5'));var Mustache=require('mustache');var util=require(_0x537b('0x6'));var path=require(_0x537b('0x7'));var sox=require(_0x537b('0x8'));var csv=require(_0x537b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x537b('0xa'));var squel=require(_0x537b('0xb'));var crypto=require(_0x537b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x537b('0xd'));var toCsv=require(_0x537b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x537b('0xe'));var qs=require(_0x537b('0xf'));var as=require(_0x537b('0x10'));var hardwareService=require(_0x537b('0x11'));var logger=require(_0x537b('0x12'))(_0x537b('0x13'));var utils=require(_0x537b('0x14'));var config=require(_0x537b('0x15'));var db=require(_0x537b('0x16'))['db'];function respondWithStatusCode(_0x18b1cc,_0x21f832){_0x21f832=_0x21f832||0xcc;return function(_0x2722ae){if(_0x2722ae){return _0x18b1cc[_0x537b('0x17')](_0x21f832);}return _0x18b1cc[_0x537b('0x18')](_0x21f832)[_0x537b('0x19')]();};}function respondWithResult(_0x4d9941,_0x199f04){_0x199f04=_0x199f04||0xc8;return function(_0x31f701){if(_0x31f701){return _0x4d9941[_0x537b('0x18')](_0x199f04)[_0x537b('0x1a')](_0x31f701);}};}function respondWithFilteredResult(_0x2287b2,_0x5f5265){return function(_0x58e3f8){if(_0x58e3f8){var _0x1b4d3b=_0x58e3f8[_0x537b('0x1b')],_0x175ef6=_0x5f5265[_0x537b('0x1c')],_0x487aa4=_0x5f5265[_0x537b('0x1c')]+_0x5f5265['limit'],_0x179446;if(_0x487aa4>=_0x1b4d3b){_0x487aa4=_0x1b4d3b;_0x179446=0xc8;}else{_0x179446=0xce;}_0x2287b2['status'](_0x179446);return _0x2287b2[_0x537b('0x1d')](_0x537b('0x1e'),_0x175ef6+'-'+_0x487aa4+'/'+_0x1b4d3b)[_0x537b('0x1a')](_0x58e3f8);}return null;};}function patchUpdates(_0x50582a){return function(_0x459297){try{jsonpatch['apply'](_0x459297,_0x50582a,!![]);}catch(_0x16a2fd){return BPromise[_0x537b('0x1f')](_0x16a2fd);}return _0x459297['save']();};}function saveUpdates(_0x8372e,_0x53a92e){return function(_0xb51878){if(_0xb51878){return _0xb51878['update'](_0x8372e)['then'](function(_0x55872c){return _0x55872c;});}return null;};}function removeEntity(_0xb9e2c4,_0xae4b9c){return function(_0x5f4c6c){if(_0x5f4c6c){return _0x5f4c6c[_0x537b('0x20')]()['then'](function(){_0xb9e2c4[_0x537b('0x18')](0xcc)[_0x537b('0x19')]();});}};}function handleEntityNotFound(_0x4fcfe1,_0x1f55c9){return function(_0x4dbaa7){if(!_0x4dbaa7){_0x4fcfe1[_0x537b('0x17')](0x194);}return _0x4dbaa7;};}function handleError(_0x2e640e,_0x1400fd){_0x1400fd=_0x1400fd||0x1f4;return function(_0x21aeb7){logger[_0x537b('0x21')](_0x21aeb7[_0x537b('0x22')]);if(_0x21aeb7[_0x537b('0x23')]){delete _0x21aeb7[_0x537b('0x23')];}_0x2e640e[_0x537b('0x18')](_0x1400fd)[_0x537b('0x24')](_0x21aeb7);};}exports[_0x537b('0x25')]=function(_0x316211,_0x5b9b5b){var _0x4d9351={},_0x304f86={},_0x391806={'count':0x0,'rows':[]};var _0x2ec91c=_[_0x537b('0x26')](db[_0x537b('0x27')]['rawAttributes'],function(_0x3b4733){return{'name':_0x3b4733[_0x537b('0x28')],'type':_0x3b4733['type'][_0x537b('0x29')]};});_0x304f86[_0x537b('0x2a')]=_['map'](_0x2ec91c,_0x537b('0x23'));_0x304f86[_0x537b('0x2b')]=_[_0x537b('0x2c')](_0x316211[_0x537b('0x2b')]);_0x304f86[_0x537b('0x2d')]=_['intersection'](_0x304f86[_0x537b('0x2a')],_0x304f86[_0x537b('0x2b')]);_0x4d9351[_0x537b('0x2e')]=_[_0x537b('0x2f')](_0x304f86[_0x537b('0x2a')],qs[_0x537b('0x30')](_0x316211['query'][_0x537b('0x30')]));_0x4d9351[_0x537b('0x2e')]=_0x4d9351[_0x537b('0x2e')][_0x537b('0x31')]?_0x4d9351[_0x537b('0x2e')]:_0x304f86[_0x537b('0x2a')];if(!_0x316211[_0x537b('0x2b')][_0x537b('0x32')](_0x537b('0x33'))){_0x4d9351['limit']=qs['limit'](_0x316211[_0x537b('0x2b')][_0x537b('0x34')]);_0x4d9351[_0x537b('0x1c')]=qs['offset'](_0x316211[_0x537b('0x2b')][_0x537b('0x1c')]);}_0x4d9351['order']=qs[_0x537b('0x35')](_0x316211[_0x537b('0x2b')][_0x537b('0x35')]);_0x4d9351[_0x537b('0x36')]=qs[_0x537b('0x2d')](_[_0x537b('0x37')](_0x316211[_0x537b('0x2b')],_0x304f86['filters']),_0x2ec91c);if(_0x316211['query'][_0x537b('0x38')]){_0x4d9351[_0x537b('0x36')]=_[_0x537b('0x39')](_0x4d9351[_0x537b('0x36')],{'$or':_[_0x537b('0x26')](_0x2ec91c,function(_0x231862){if(_0x231862['type']!==_0x537b('0x3a')){var _0x1ef415={};_0x1ef415[_0x231862[_0x537b('0x23')]]={'$like':'%'+_0x316211['query'][_0x537b('0x38')]+'%'};return _0x1ef415;}})});}_0x4d9351=_[_0x537b('0x39')]({},_0x4d9351,_0x316211[_0x537b('0x3b')]);var _0x12961a={'where':_0x4d9351[_0x537b('0x36')]};return db['ChatTransferReport'][_0x537b('0x1b')](_0x12961a)[_0x537b('0x3c')](function(_0x2908c){_0x391806[_0x537b('0x1b')]=_0x2908c;if(_0x316211[_0x537b('0x2b')][_0x537b('0x3d')]){_0x4d9351[_0x537b('0x3e')]=[{'all':!![]}];}return db[_0x537b('0x27')][_0x537b('0x3f')](_0x4d9351);})['then'](function(_0x28a404){_0x391806[_0x537b('0x40')]=_0x28a404;return _0x391806;})['then'](respondWithFilteredResult(_0x5b9b5b,_0x4d9351))[_0x537b('0x41')](handleError(_0x5b9b5b,null));};exports[_0x537b('0x42')]=function(_0x39de55,_0x205015){var _0x3c84ce={'raw':!![],'where':{'id':_0x39de55[_0x537b('0x43')]['id']}},_0x41b0a9={};_0x41b0a9[_0x537b('0x2a')]=_['keys'](db['ChatTransferReport'][_0x537b('0x44')]);_0x41b0a9[_0x537b('0x2b')]=_[_0x537b('0x2c')](_0x39de55['query']);_0x41b0a9[_0x537b('0x2d')]=_[_0x537b('0x2f')](_0x41b0a9[_0x537b('0x2a')],_0x41b0a9[_0x537b('0x2b')]);_0x3c84ce[_0x537b('0x2e')]=_[_0x537b('0x2f')](_0x41b0a9[_0x537b('0x2a')],qs[_0x537b('0x30')](_0x39de55[_0x537b('0x2b')][_0x537b('0x30')]));_0x3c84ce[_0x537b('0x2e')]=_0x3c84ce[_0x537b('0x2e')][_0x537b('0x31')]?_0x3c84ce['attributes']:_0x41b0a9[_0x537b('0x2a')];if(_0x39de55[_0x537b('0x2b')][_0x537b('0x3d')]){_0x3c84ce['include']=[{'all':!![]}];}_0x3c84ce=_[_0x537b('0x39')]({},_0x3c84ce,_0x39de55['options']);return db['ChatTransferReport'][_0x537b('0x45')](_0x3c84ce)[_0x537b('0x3c')](handleEntityNotFound(_0x205015,null))[_0x537b('0x3c')](respondWithResult(_0x205015,null))[_0x537b('0x41')](handleError(_0x205015,null));};exports[_0x537b('0x46')]=function(_0x75f7a0,_0x1c707e){return db[_0x537b('0x27')][_0x537b('0x46')](_0x75f7a0[_0x537b('0x47')],{})[_0x537b('0x3c')](respondWithResult(_0x1c707e,0xc9))[_0x537b('0x41')](handleError(_0x1c707e,null));};exports['update']=function(_0xedfef5,_0x53118b){if(_0xedfef5[_0x537b('0x47')]['id']){delete _0xedfef5['body']['id'];}return db[_0x537b('0x27')][_0x537b('0x45')]({'where':{'id':_0xedfef5['params']['id']}})['then'](handleEntityNotFound(_0x53118b,null))[_0x537b('0x3c')](saveUpdates(_0xedfef5[_0x537b('0x47')],null))['then'](respondWithResult(_0x53118b,null))['catch'](handleError(_0x53118b,null));};exports[_0x537b('0x20')]=function(_0x5f54aa,_0x1b2232){return db[_0x537b('0x27')]['find']({'where':{'id':_0x5f54aa[_0x537b('0x43')]['id']}})[_0x537b('0x3c')](handleEntityNotFound(_0x1b2232,null))['then'](removeEntity(_0x1b2232,null))['catch'](handleError(_0x1b2232,null));};exports[_0x537b('0x48')]=function(_0x2c0c0d,_0x4d04fe){return db[_0x537b('0x27')][_0x537b('0x48')]()[_0x537b('0x3c')](respondWithResult(_0x4d04fe,null))[_0x537b('0x41')](handleError(_0x4d04fe,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2cb8505..4af8f82 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger'];(function(_0x4e1211,_0x1c0e26){var _0x4ae887=function(_0x6e55ff){while(--_0x6e55ff){_0x4e1211['push'](_0x4e1211['shift']());}};_0x4ae887(++_0x1c0e26);}(_0x7217,0x19e));var _0x7721=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7217[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8c3f0c3..d2885b8 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 _0xc93a=['client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x337bee,_0x53cbca){var _0x24c37d=function(_0x535b06){while(--_0x535b06){_0x337bee['push'](_0x337bee['shift']());}};_0x24c37d(++_0x53cbca);}(_0xc93a,0x11d));var _0xac93=function(_0x2908c4,_0x3e433c){_0x2908c4=_0x2908c4-0x0;var _0x4c5ef3=_0xc93a[_0x2908c4];return _0x4c5ef3;};'use strict';var _=require(_0xac93('0x0'));var util=require(_0xac93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac93('0x2'));var fs=require('fs');var Redis=require(_0xac93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xac93('0x4'));var logger=require(_0xac93('0x5'))(_0xac93('0x6'));var config=require(_0xac93('0x7'));var jayson=require(_0xac93('0x8'));var client=jayson[_0xac93('0x9')][_0xac93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6a9f,_0x133e61,_0x21a13e){return new BPromise(function(_0xa335f1,_0x3335d9){return client['request'](_0x5a6a9f,_0x21a13e)[_0xac93('0xb')](function(_0x12c9f7){logger[_0xac93('0xc')](_0xac93('0xd'),_0x133e61,_0xac93('0xe'));logger[_0xac93('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x133e61,_0xac93('0xe'),JSON[_0xac93('0x10')](_0x12c9f7));if(_0x12c9f7[_0xac93('0x11')]){if(_0x12c9f7[_0xac93('0x11')][_0xac93('0x12')]===0x1f4){logger[_0xac93('0x11')](_0xac93('0xd'),_0x133e61,_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);return _0x3335d9(_0x12c9f7[_0xac93('0x11')]['message']);}logger[_0xac93('0x11')](_0xac93('0xd'),_0x133e61,_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);return _0xa335f1(_0x12c9f7[_0xac93('0x11')][_0xac93('0x13')]);}else{logger[_0xac93('0xc')](_0xac93('0xd'),_0x133e61,_0xac93('0xe'));_0xa335f1(_0x12c9f7[_0xac93('0x14')][_0xac93('0x13')]);}})['catch'](function(_0x4448b1){logger[_0xac93('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x133e61,_0x4448b1);_0x3335d9(_0x4448b1);});});} \ No newline at end of file +var _0x9ef8=['../../config/logger','rpc','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x26d237,_0x4d3945){var _0x184541=function(_0x1edd11){while(--_0x1edd11){_0x26d237['push'](_0x26d237['shift']());}};_0x184541(++_0x4d3945);}(_0x9ef8,0x73));var _0x89ef=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x9ef8[_0xd2f4ac];return _0x9757b2;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x89ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x89ef('0x3'))['db'];var utils=require(_0x89ef('0x4'));var logger=require(_0x89ef('0x5'))(_0x89ef('0x6'));var config=require('../../config/environment');var jayson=require(_0x89ef('0x7'));var client=jayson[_0x89ef('0x8')][_0x89ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7255a9,_0x2c17bd,_0x3aa101){return new BPromise(function(_0x3d8d62,_0x768b22){return client['request'](_0x7255a9,_0x3aa101)[_0x89ef('0xa')](function(_0x3be5d6){logger[_0x89ef('0xb')](_0x89ef('0xc'),_0x2c17bd,'request\x20sent');logger[_0x89ef('0xd')](_0x89ef('0xe'),_0x2c17bd,'request\x20sent',JSON[_0x89ef('0xf')](_0x3be5d6));if(_0x3be5d6['error']){if(_0x3be5d6[_0x89ef('0x10')]['code']===0x1f4){logger['error'](_0x89ef('0xc'),_0x2c17bd,_0x3be5d6[_0x89ef('0x10')]['message']);return _0x768b22(_0x3be5d6[_0x89ef('0x10')][_0x89ef('0x11')]);}logger[_0x89ef('0x10')](_0x89ef('0xc'),_0x2c17bd,_0x3be5d6['error'][_0x89ef('0x11')]);return _0x3d8d62(_0x3be5d6['error'][_0x89ef('0x11')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2c17bd,'request\x20sent');_0x3d8d62(_0x3be5d6[_0x89ef('0x12')][_0x89ef('0x11')]);}})[_0x89ef('0x13')](function(_0x2c0f30){logger[_0x89ef('0x10')](_0x89ef('0xc'),_0x2c17bd,_0x2c0f30);_0x768b22(_0x2c0f30);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 4c2c549..688a857 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0x757a,0xde));var _0xa757=function(_0x1960fd,_0x3a9a34){_0x1960fd=_0x1960fd-0x0;var _0x3a12da=_0x757a[_0x1960fd];return _0x3a12da;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index dde9296..1063772 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 _0x7bb8=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','name','text','input','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','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','exports','STRING'];(function(_0x12553b,_0x5a9b35){var _0x86a99a=function(_0x459e12){while(--_0x459e12){_0x12553b['push'](_0x12553b['shift']());}};_0x86a99a(++_0x5a9b35);}(_0x7bb8,0xe8));var _0x87bb=function(_0x268a92,_0x1ff874){_0x268a92=_0x268a92-0x0;var _0x496fc8=_0x7bb8[_0x268a92];return _0x496fc8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x87bb('0x0'));module[_0x87bb('0x1')]={'name':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x87bb('0x2')]},'mapKey':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87bb('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'defaultValue':_0x87bb('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x87bb('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x87bb('0x2')]},'animation':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x87bb('0x9')](_0x87bb('0xa'),_0x87bb('0xb')),'defaultValue':_0x87bb('0xa')},'header_online':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xc')},'start_chat_button':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0xe')},'header_offline':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xf')},'download_transcript':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x87bb('0x10')]},'closingQuestion':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x13')},'closingMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0xe')},'skipMessageButton':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x14')},'conditionAgreement':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x15')},'ratingType':{'type':Sequelize[_0x87bb('0x9')](_0x87bb('0x16'),_0x87bb('0x17')),'defaultValue':_0x87bb('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return JSON[_0x87bb('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x87bb('0x19'),'type':_0x87bb('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x87bb('0x1b'),'props':{'title':_0x87bb('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x87bb('0x3'),'type':_0x87bb('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x87bb('0x1c')](_0x87bb('0x1d'))?JSON[_0x87bb('0x1e')](this['getDataValue'](_0x87bb('0x1d'))):{};},'set':function(_0x512a99){return this[_0x87bb('0x1f')](_0x87bb('0x1d'),JSON[_0x87bb('0x18')](_0x512a99));}},'offlineForm':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return JSON[_0x87bb('0x18')]({'items':[{'type':_0x87bb('0x1b'),'props':{'title':_0x87bb('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x87bb('0x3'),'type':_0x87bb('0x3')},'variable':null},{'type':_0x87bb('0x20'),'config':{'placeholder':_0x87bb('0x21')},'props':{'title':_0x87bb('0x21'),'helpText':_0x87bb('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x87bb('0x1c')](_0x87bb('0x23'))?JSON[_0x87bb('0x1e')](this['getDataValue'](_0x87bb('0x23'))):{};},'set':function(_0x5a3fc7){return this[_0x87bb('0x1f')]('offlineForm',JSON[_0x87bb('0x18')](_0x5a3fc7));}},'token':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':function(){return rs[_0x87bb('0x24')]();}},'autoclose':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x87bb('0x2')]},'forwardOffline':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x87bb('0x2')]},'waitingTitle':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x25')},'waitingMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x27')},'offlineMessageBody':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x87bb('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x87bb('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x87bb('0x2')]},'notificationTemplate':{'type':Sequelize[_0x87bb('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x29')},'verticalAlignment':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x2a')},'defaultTitle':{'type':Sequelize[_0x87bb('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x87bb('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x87bb('0x2')],'allowNull':![],'defaultValue':_0x87bb('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x87bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x87bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':_0x87bb('0x2c')},'systemAvatar':{'type':Sequelize[_0x87bb('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x87bb('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x87bb('0x8')],'defaultValue':![],'comment':_0x87bb('0x2d'),'set':function(_0x36f0da){if(!_0x36f0da)this[_0x87bb('0x1f')](_0x87bb('0x2e'),null);this[_0x87bb('0x1f')]('mandatoryDisposition',_0x36f0da);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x87bb('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x2dab=['sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','name','text','input','getDataValue','onlineForm','setDataValue','stringify','Comments','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','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x2dab,0x120));var _0xb2da=function(_0x441530,_0x564e7d){_0x441530=_0x441530-0x0;var _0x35a26c=_0x2dab[_0x441530];return _0x35a26c;};'use strict';var Sequelize=require(_0xb2da('0x0'));var rs=require(_0xb2da('0x1'));module[_0xb2da('0x2')]={'name':{'type':Sequelize[_0xb2da('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb2da('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xb2da('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb2da('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x4')},'key':{'type':Sequelize[_0xb2da('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x5')},'customerAlias':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb2da('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb2da('0x3')],'allowNull':![],'defaultValue':_0xb2da('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb2da('0x3')],'allowNull':![],'defaultValue':_0xb2da('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb2da('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb2da('0x3')]},'animation':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xb2da('0xa')),'defaultValue':_0xb2da('0xb')},'header_online':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xd')},'header_offline':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb2da('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb2da('0x10')]},'closingQuestion':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x12')},'closingMessage':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x13')},'closingMessageButton':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xd')},'skipMessageButton':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x14')},'conditionAgreement':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x15')},'ratingType':{'type':Sequelize[_0xb2da('0x16')](_0xb2da('0x17'),_0xb2da('0x18')),'defaultValue':_0xb2da('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xb2da('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb2da('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xb2da('0x19'),'type':_0xb2da('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xb2da('0x1b'),'props':{'title':_0xb2da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb2da('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb2da('0x1c')](_0xb2da('0x1d'))?JSON['parse'](this[_0xb2da('0x1c')]('onlineForm')):{};},'set':function(_0x3b1f88){return this[_0xb2da('0x1e')](_0xb2da('0x1d'),JSON['stringify'](_0x3b1f88));}},'offlineForm':{'type':Sequelize[_0xb2da('0x10')],'defaultValue':function(){return JSON[_0xb2da('0x1f')]({'items':[{'type':_0xb2da('0x1b'),'props':{'title':_0xb2da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb2da('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xb2da('0x20'),'helpText':_0xb2da('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xb2da('0x1c')](_0xb2da('0x22'))?JSON['parse'](this[_0xb2da('0x1c')](_0xb2da('0x22'))):{};},'set':function(_0x4e05f3){return this[_0xb2da('0x1e')](_0xb2da('0x22'),JSON[_0xb2da('0x1f')](_0x4e05f3));}},'token':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb2da('0x3')]},'forwardOffline':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb2da('0x23')},'waitingMessage':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x25')},'offlineMessageBody':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x27')},'skipUnmanaged':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x14')},'sendUnmanaged':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb2da('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb2da('0x10')],'defaultValue':function(){return _0xb2da('0x28');}},'notificationSound':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xb2da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x29')},'verticalAlignment':{'type':Sequelize[_0xb2da('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':_0xb2da('0x2a')},'defaultTitle':{'type':Sequelize[_0xb2da('0x3')]},'customerAvatar':{'type':Sequelize[_0xb2da('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb2da('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb2da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb2da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb2da('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb2da('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb2da('0x2d'),'set':function(_0x19bfa0){if(!_0x19bfa0)this['setDataValue'](_0xb2da('0x2e'),null);this[_0xb2da('0x1e')](_0xb2da('0x2f'),_0x19bfa0);}},'vidaooEscalation':{'type':Sequelize[_0xb2da('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb2da('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 96ce1b9..54b638f 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 _0xa0d0=['ChatWebsite','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Pause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','priority','asc','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','offline','createdAt','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','findOrCreate','spread','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','pick','Contact','Owner','fullname','internal','Tag','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','some','server/files/chat/iframe.js','x-real-ip','remoteAddress','render','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xa0d0,0xe5));var _0x0a0d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa0d0[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require(_0x0a0d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a0d('0x1'));var zipdir=require(_0x0a0d('0x2'));var jsonpatch=require(_0x0a0d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a0d('0x4'));var Mustache=require(_0x0a0d('0x5'));var util=require(_0x0a0d('0x6'));var path=require(_0x0a0d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a0d('0x8'));var squel=require('squel');var crypto=require(_0x0a0d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0a0d('0xa'));var toCsv=require(_0x0a0d('0xb'));var querystring=require(_0x0a0d('0xc'));var Papa=require(_0x0a0d('0xd'));var Redis=require(_0x0a0d('0xe'));var authService=require(_0x0a0d('0xf'));var qs=require(_0x0a0d('0x10'));var as=require(_0x0a0d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a0d('0x12'))(_0x0a0d('0x13'));var utils=require(_0x0a0d('0x14'));var config=require(_0x0a0d('0x15'));var db=require(_0x0a0d('0x16'))['db'];config[_0x0a0d('0x17')]=_[_0x0a0d('0x18')](config[_0x0a0d('0x17')],{'host':_0x0a0d('0x19'),'port':0x18eb});var socket=require(_0x0a0d('0x1a'))(new Redis(config['redis']));require(_0x0a0d('0x1b'))[_0x0a0d('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0a0d('0x1d')][_0x0a0d('0x1e')]({'port':0x232c});var client9002=jayson[_0x0a0d('0x1d')][_0x0a0d('0x1e')]({'port':0x232a});var client9003=jayson[_0x0a0d('0x1d')]['http']({'port':0x232b});function checkPasswordPattern(_0x2f2aa4,_0x319dc0,_0x6b120a){if(_0x6b120a){var _0x5d58cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d58cd[_0x0a0d('0x1f')](_0x319dc0)){return _0x2f2aa4;}else{throw new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0x21'));}}else{return _0x2f2aa4;}}function respondWithRpcPromise(_0x1dd1d1,_0x308219,_0x23ccec,_0x2534a0){return new BPromise(function(_0x14872f,_0x5d58f9){var _0x2184f9=_0x2534a0||client;return _0x2184f9['request'](_0x1dd1d1,_0x23ccec)[_0x0a0d('0x22')](function(_0x5d4233){logger[_0x0a0d('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x308219,_0x0a0d('0x24'));logger['debug'](_0x0a0d('0x25'),_0x308219,_0x0a0d('0x24'),JSON[_0x0a0d('0x26')](_0x5d4233));if(_0x5d4233['error']){if(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x28')]===0x1f4){logger[_0x0a0d('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x308219,_0x5d4233['error'][_0x0a0d('0x29')]);return _0x5d58f9(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x29')]);}logger[_0x0a0d('0x27')](_0x0a0d('0x2a'),_0x308219,_0x5d4233['error'][_0x0a0d('0x29')]);return _0x14872f(_0x5d4233[_0x0a0d('0x27')][_0x0a0d('0x29')]);}else{logger['info'](_0x0a0d('0x2a'),_0x308219,_0x0a0d('0x24'));_0x14872f(_0x5d4233['result'][_0x0a0d('0x29')]);}})[_0x0a0d('0x2b')](function(_0x4b942a){logger[_0x0a0d('0x27')](_0x0a0d('0x2a'),_0x308219,_0x4b942a);_0x5d58f9(_0x4b942a);});});}function respondWithStatusCode(_0x33a15d,_0x4a6ad0){_0x4a6ad0=_0x4a6ad0||0xcc;return function(_0x4f172b){if(_0x4f172b){return _0x33a15d['sendStatus'](_0x4a6ad0);}return _0x33a15d['status'](_0x4a6ad0)[_0x0a0d('0x2c')]();};}function respondWithResult(_0xefc33c,_0x17bb2c){_0x17bb2c=_0x17bb2c||0xc8;return function(_0x5cf7fb){if(_0x5cf7fb){return _0xefc33c[_0x0a0d('0x2d')](_0x17bb2c)[_0x0a0d('0x2e')](_0x5cf7fb);}};}function respondWithFilteredResult(_0x2c658e,_0x143d1f){return function(_0xf514dd){if(_0xf514dd){var _0xff613e=_0xf514dd['count'],_0x16b79c=_0x143d1f['offset'],_0x67f4e0=_0x143d1f[_0x0a0d('0x2f')]+_0x143d1f[_0x0a0d('0x30')],_0x4a647c;if(_0x67f4e0>=_0xff613e){_0x67f4e0=_0xff613e;_0x4a647c=0xc8;}else{_0x4a647c=0xce;}_0x2c658e['status'](_0x4a647c);return _0x2c658e[_0x0a0d('0x31')](_0x0a0d('0x32'),_0x16b79c+'-'+_0x67f4e0+'/'+_0xff613e)['json'](_0xf514dd);}return null;};}function patchUpdates(_0x161a87){return function(_0x172bb0){try{jsonpatch[_0x0a0d('0x33')](_0x172bb0,_0x161a87,!![]);}catch(_0x17b7c5){return BPromise[_0x0a0d('0x34')](_0x17b7c5);}return _0x172bb0['save']();};}function saveUpdates(_0x178536,_0x48ef77){return function(_0x22b149){if(_0x22b149){return _0x22b149[_0x0a0d('0x35')](_0x178536)[_0x0a0d('0x22')](function(_0x22c42c){return _0x22c42c;});}return null;};}function removeEntity(_0x29d16b,_0x4cdee4){return function(_0x104328){if(_0x104328){return _0x104328[_0x0a0d('0x36')]()[_0x0a0d('0x22')](function(){var _0xb943ed=_0x104328['get']({'plain':!![]});var _0x469723='ChatWebsites';return db[_0x0a0d('0x37')]['destroy']({'where':{'type':_0x469723,'resourceId':_0xb943ed['id']}})['then'](function(){return _0x104328;});})['then'](function(){_0x29d16b[_0x0a0d('0x2d')](0xcc)[_0x0a0d('0x2c')]();});}};}function handleEntityNotFound(_0x88478e,_0x19b23b){return function(_0x385336){if(!_0x385336){_0x88478e[_0x0a0d('0x38')](0x194);}return _0x385336;};}function handleError(_0x4ddc09,_0x431216){_0x431216=_0x431216||0x1f4;return function(_0xeff190){logger[_0x0a0d('0x27')](_0xeff190[_0x0a0d('0x39')]);if(_0xeff190[_0x0a0d('0x3a')]){delete _0xeff190['name'];}_0x4ddc09['status'](_0x431216)[_0x0a0d('0x3b')](_0xeff190);};}exports[_0x0a0d('0x3c')]=function(_0x400d52,_0x13e115){var _0x4e6279={'include':[{'model':db['Pause'],'as':_0x0a0d('0x3d')}]},_0x167ded={},_0x4d73ea={'count':0x0,'rows':[]};var _0x3d11e2=_['map'](db[_0x0a0d('0x3e')][_0x0a0d('0x3f')],function(_0x2cb746){return{'name':_0x2cb746[_0x0a0d('0x40')],'type':_0x2cb746[_0x0a0d('0x41')]['key']};});_0x167ded[_0x0a0d('0x42')]=_[_0x0a0d('0x43')](_0x3d11e2,_0x0a0d('0x3a'));_0x167ded['query']=_['keys'](_0x400d52[_0x0a0d('0x44')]);_0x167ded[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x167ded['model'],_0x167ded[_0x0a0d('0x44')]);_0x4e6279[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x167ded[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x4e6279[_0x0a0d('0x47')]=_0x4e6279[_0x0a0d('0x47')]['length']?_0x4e6279[_0x0a0d('0x47')]:_0x167ded[_0x0a0d('0x42')];if(!_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x4e6279[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x400d52[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x4e6279[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x400d52[_0x0a0d('0x44')]['offset']);}_0x4e6279['order']=qs[_0x0a0d('0x4b')](_0x400d52[_0x0a0d('0x44')]['sort']);_0x4e6279[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_['pick'](_0x400d52[_0x0a0d('0x44')],_0x167ded['filters']),_0x3d11e2);if(_0x400d52['query']['filter']){_0x4e6279[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x4e6279['where'],{'$or':_['map'](_0x3d11e2,function(_0x82fb3a){if(_0x82fb3a['type']!==_0x0a0d('0x4e')){var _0x3229aa={};_0x3229aa[_0x82fb3a[_0x0a0d('0x3a')]]={'$like':'%'+_0x400d52[_0x0a0d('0x44')]['filter']+'%'};return _0x3229aa;}})});}_0x4e6279=_[_0x0a0d('0x4d')]({},_0x4e6279,_0x400d52[_0x0a0d('0x4f')]);var _0x9e6fa2={'where':_0x4e6279[_0x0a0d('0x4c')]};return db['ChatWebsite'][_0x0a0d('0x50')](_0x9e6fa2)[_0x0a0d('0x22')](function(_0x327694){_0x4d73ea[_0x0a0d('0x50')]=_0x327694;if(_0x400d52['query'][_0x0a0d('0x51')]){_0x4e6279[_0x0a0d('0x52')]=[{'all':!![]}];}return db[_0x0a0d('0x3e')][_0x0a0d('0x53')](_0x4e6279);})[_0x0a0d('0x22')](function(_0x34f9e6){_0x4d73ea[_0x0a0d('0x54')]=_0x34f9e6;return _0x4d73ea;})['then'](respondWithFilteredResult(_0x13e115,_0x4e6279))[_0x0a0d('0x2b')](handleError(_0x13e115,null));};exports['show']=function(_0x5a57df,_0x3b2a54){var _0x3ed57b={'raw':![],'where':{'id':_0x5a57df['params']['id']},'include':[{'model':db['Pause'],'as':_0x0a0d('0x3d')}]},_0x567864={};_0x567864[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db[_0x0a0d('0x3e')][_0x0a0d('0x3f')]);_0x567864['query']=_[_0x0a0d('0x55')](_0x5a57df[_0x0a0d('0x44')]);_0x567864[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x567864[_0x0a0d('0x42')],_0x567864['query']);_0x3ed57b[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x567864[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x5a57df['query'][_0x0a0d('0x48')]));_0x3ed57b[_0x0a0d('0x47')]=_0x3ed57b[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x3ed57b[_0x0a0d('0x47')]:_0x567864[_0x0a0d('0x42')];if(_0x5a57df[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x3ed57b[_0x0a0d('0x52')]=[{'all':!![]}];}_0x3ed57b=_['merge']({},_0x3ed57b,_0x5a57df['options']);return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x3ed57b)[_0x0a0d('0x22')](handleEntityNotFound(_0x3b2a54,null))[_0x0a0d('0x22')](respondWithResult(_0x3b2a54,null))['catch'](handleError(_0x3b2a54,null));};exports[_0x0a0d('0x58')]=function(_0x49cef6,_0x1ad21c){return db[_0x0a0d('0x3e')][_0x0a0d('0x58')](_0x49cef6[_0x0a0d('0x59')],{})[_0x0a0d('0x22')](function(_0x281f11){var _0x57bfcf=_0x49cef6[_0x0a0d('0x5a')][_0x0a0d('0x5b')]({'plain':!![]});if(!_0x57bfcf)throw new Error(_0x0a0d('0x5c'));if(_0x57bfcf[_0x0a0d('0x5d')]===_0x0a0d('0x5a')){var _0x447f30=_0x281f11['get']({'plain':!![]});var _0x62880a=_0x0a0d('0x5e');return db[_0x0a0d('0x5f')]['find']({'where':{'name':_0x62880a,'userProfileId':_0x57bfcf[_0x0a0d('0x60')]},'raw':!![]})[_0x0a0d('0x22')](function(_0x2d093a){if(_0x2d093a&&_0x2d093a[_0x0a0d('0x61')]===0x0){return db[_0x0a0d('0x37')]['create']({'name':_0x447f30[_0x0a0d('0x3a')],'resourceId':_0x447f30['id'],'type':_0x2d093a[_0x0a0d('0x3a')],'sectionId':_0x2d093a['id']},{})[_0x0a0d('0x22')](function(){return _0x281f11;});}else{return _0x281f11;}})[_0x0a0d('0x2b')](function(_0x22ac13){logger[_0x0a0d('0x27')](_0x0a0d('0x62'),_0x22ac13);throw _0x22ac13;});}return _0x281f11;})['then'](respondWithResult(_0x1ad21c,0xc9))[_0x0a0d('0x2b')](handleError(_0x1ad21c,null));};exports['update']=function(_0x37e589,_0xd5ee55){if(_0x37e589['body']['id']){delete _0x37e589['body']['id'];}return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x37e589[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x64')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xd5ee55,null))[_0x0a0d('0x22')](saveUpdates(_0x37e589['body'],null))['then'](respondWithResult(_0xd5ee55,null))[_0x0a0d('0x2b')](handleError(_0xd5ee55,null));};exports[_0x0a0d('0x36')]=function(_0x3dad87,_0x485a8a){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x3dad87[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x485a8a,null))[_0x0a0d('0x22')](removeEntity(_0x485a8a,null))[_0x0a0d('0x2b')](handleError(_0x485a8a,null));};exports[_0x0a0d('0x65')]=function(_0x39633f,_0x509514){return db['ChatWebsite'][_0x0a0d('0x65')]()[_0x0a0d('0x22')](respondWithResult(_0x509514,null))[_0x0a0d('0x2b')](handleError(_0x509514,null));};exports[_0x0a0d('0x66')]=function(_0x5af912,_0x198076,_0x4cbd8a){if(_0x5af912[_0x0a0d('0x59')]['id']){delete _0x5af912['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5af912[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x198076,null))[_0x0a0d('0x22')](function(_0x2ff793){if(_0x2ff793){_0x5af912[_0x0a0d('0x59')][_0x0a0d('0x67')]=_0x2ff793['id'];return db[_0x0a0d('0x68')]['create'](_0x5af912['body']);}})[_0x0a0d('0x22')](respondWithResult(_0x198076,null))[_0x0a0d('0x2b')](handleError(_0x198076,null));};exports[_0x0a0d('0x69')]=function(_0x3e633d,_0x10f4c6,_0x1cebd1){var _0x42bf32={'raw':![],'where':{}};var _0x5068d1={};var _0x2d1883={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x3e633d['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x10f4c6,null))[_0x0a0d('0x22')](function(_0x28fa52){if(_0x28fa52){_0x5068d1[_0x0a0d('0x42')]=_['keys'](db[_0x0a0d('0x68')][_0x0a0d('0x3f')]);_0x5068d1[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x3e633d[_0x0a0d('0x44')]);_0x5068d1[_0x0a0d('0x45')]=_['intersection'](_0x5068d1[_0x0a0d('0x42')],_0x5068d1[_0x0a0d('0x44')]);_0x42bf32[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x5068d1[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x3e633d['query']['fields']));_0x42bf32[_0x0a0d('0x47')]=_0x42bf32[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x42bf32[_0x0a0d('0x47')]:_0x5068d1[_0x0a0d('0x42')];if(!_0x3e633d['query'][_0x0a0d('0x49')]('nolimit')){_0x42bf32[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x3e633d['query'][_0x0a0d('0x30')]);_0x42bf32[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x42bf32[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x3e633d['query'][_0x0a0d('0x4b')]);_0x42bf32[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_['pick'](_0x3e633d[_0x0a0d('0x44')],_0x5068d1[_0x0a0d('0x45')]));_0x42bf32['where']['ChatWebsiteId']=_0x28fa52['id'];if(_0x3e633d[_0x0a0d('0x44')]['filter']){_0x42bf32[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x42bf32[_0x0a0d('0x4c')],{'$or':_['map'](_0x42bf32[_0x0a0d('0x47')],function(_0x2a8461){var _0x40b1f6={};_0x40b1f6[_0x2a8461]={'$like':'%'+_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x40b1f6;})});}_0x42bf32=_[_0x0a0d('0x4d')]({},_0x42bf32,_0x3e633d['options']);return db[_0x0a0d('0x68')][_0x0a0d('0x50')]({'where':_0x42bf32[_0x0a0d('0x4c')]})[_0x0a0d('0x22')](function(_0x1105ef){_0x2d1883[_0x0a0d('0x50')]=_0x1105ef;if(_0x3e633d[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x42bf32[_0x0a0d('0x52')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x42bf32);})[_0x0a0d('0x22')](function(_0x4e23b0){_0x2d1883[_0x0a0d('0x54')]=_0x4e23b0;return _0x2d1883;});}})['then'](respondWithFilteredResult(_0x10f4c6,_0x42bf32))[_0x0a0d('0x2b')](handleError(_0x10f4c6,null));};exports[_0x0a0d('0x6d')]=function(_0x273874,_0x236ffb,_0x27dea7){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x273874[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x236ffb,null))[_0x0a0d('0x22')](function(_0x4e4b36){if(_0x4e4b36){return _0x4e4b36[_0x0a0d('0x6d')](_0x273874['query']['ids']);}})['then'](respondWithStatusCode(_0x236ffb,null))[_0x0a0d('0x2b')](handleError(_0x236ffb,null));};exports[_0x0a0d('0x6e')]=function(_0x568ad,_0x1bb636,_0x44d579){if(_0x568ad[_0x0a0d('0x59')]['id']){delete _0x568ad[_0x0a0d('0x59')]['id'];}return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x568ad['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x1bb636,null))['then'](function(_0x47217f){if(_0x47217f){_0x568ad['body'][_0x0a0d('0x67')]=_0x47217f['id'];return db[_0x0a0d('0x6f')][_0x0a0d('0x58')](_0x568ad[_0x0a0d('0x59')]);}})[_0x0a0d('0x22')](respondWithResult(_0x1bb636,null))[_0x0a0d('0x2b')](handleError(_0x1bb636,null));};exports[_0x0a0d('0x70')]=function(_0x1048f1,_0x585779,_0x5f3316){var _0x2cb4d7={'raw':![],'where':{}};var _0x28c36f={};var _0x596978={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x1048f1[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x585779,null))[_0x0a0d('0x22')](function(_0x4aee22){if(_0x4aee22){_0x28c36f[_0x0a0d('0x42')]=_['keys'](db['CannedAnswer'][_0x0a0d('0x3f')]);_0x28c36f[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x1048f1[_0x0a0d('0x44')]);_0x28c36f['filters']=_[_0x0a0d('0x46')](_0x28c36f[_0x0a0d('0x42')],_0x28c36f[_0x0a0d('0x44')]);_0x2cb4d7[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x28c36f[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x2cb4d7[_0x0a0d('0x47')]=_0x2cb4d7[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x2cb4d7[_0x0a0d('0x47')]:_0x28c36f[_0x0a0d('0x42')];if(!_0x1048f1['query'][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x2cb4d7[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x1048f1['query']['limit']);_0x2cb4d7['offset']=qs[_0x0a0d('0x2f')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x2cb4d7[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x2cb4d7['where']=qs[_0x0a0d('0x45')](_['pick'](_0x1048f1['query'],_0x28c36f[_0x0a0d('0x45')]));_0x2cb4d7['where'][_0x0a0d('0x67')]=_0x4aee22['id'];if(_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x2cb4d7[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x2cb4d7[_0x0a0d('0x4c')],{'$or':_['map'](_0x2cb4d7['attributes'],function(_0x5644b0){var _0x389310={};_0x389310[_0x5644b0]={'$like':'%'+_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x389310;})});}_0x2cb4d7=_['merge']({},_0x2cb4d7,_0x1048f1[_0x0a0d('0x4f')]);return db['CannedAnswer'][_0x0a0d('0x50')]({'where':_0x2cb4d7[_0x0a0d('0x4c')]})['then'](function(_0x53f3da){_0x596978[_0x0a0d('0x50')]=_0x53f3da;if(_0x1048f1[_0x0a0d('0x44')][_0x0a0d('0x51')]){_0x2cb4d7[_0x0a0d('0x52')]=[{'all':!![]}];}return db[_0x0a0d('0x6f')][_0x0a0d('0x53')](_0x2cb4d7);})[_0x0a0d('0x22')](function(_0xc3a95d){_0x596978[_0x0a0d('0x54')]=_0xc3a95d;return _0x596978;});}})['then'](respondWithFilteredResult(_0x585779,_0x2cb4d7))[_0x0a0d('0x2b')](handleError(_0x585779,null));};exports[_0x0a0d('0x71')]=function(_0x3e2e25,_0x5dbc3c,_0x3d0de1){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x3e2e25['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x5dbc3c,null))[_0x0a0d('0x22')](function(_0x47c424){if(_0x47c424){return _0x47c424[_0x0a0d('0x71')](_0x3e2e25[_0x0a0d('0x44')][_0x0a0d('0x72')]);}})[_0x0a0d('0x22')](respondWithStatusCode(_0x5dbc3c,null))[_0x0a0d('0x2b')](handleError(_0x5dbc3c,null));};exports[_0x0a0d('0x73')]=function(_0x33f25d,_0x120526,_0xe5b50){_0x33f25d[_0x0a0d('0x59')][_0x0a0d('0x74')]=_0x33f25d[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x33f25d[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x120526,null))[_0x0a0d('0x22')](saveUpdates(_0x33f25d[_0x0a0d('0x59')],null))['then'](respondWithResult(_0x120526,null))[_0x0a0d('0x2b')](handleError(_0x120526,null));};exports[_0x0a0d('0x77')]=function(_0x4b6f97,_0x46b7bf,_0x143272){_0x4b6f97['body'][_0x0a0d('0x78')]=_0x4b6f97[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x4b6f97['params']['id']}})['then'](handleEntityNotFound(_0x46b7bf,null))[_0x0a0d('0x22')](saveUpdates(_0x4b6f97[_0x0a0d('0x59')],null))[_0x0a0d('0x22')](respondWithResult(_0x46b7bf,null))['catch'](handleError(_0x46b7bf,null));};exports[_0x0a0d('0x79')]=function(_0x4eb84c,_0x12e342,_0x474e23){_0x4eb84c['body']['customerAvatar']=_0x4eb84c[_0x0a0d('0x75')][_0x0a0d('0x76')];return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x4eb84c[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x12e342,null))[_0x0a0d('0x22')](saveUpdates(_0x4eb84c[_0x0a0d('0x59')],null))[_0x0a0d('0x22')](respondWithResult(_0x12e342,null))[_0x0a0d('0x2b')](handleError(_0x12e342,null));};exports[_0x0a0d('0x7a')]=function(_0x522f2e,_0x52a36d,_0x478096){_0x522f2e[_0x0a0d('0x59')][_0x0a0d('0x7b')]=_0x522f2e[_0x0a0d('0x75')]['filename'];return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x522f2e[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x52a36d,null))['then'](saveUpdates(_0x522f2e['body'],null))[_0x0a0d('0x22')](respondWithResult(_0x52a36d,null))[_0x0a0d('0x2b')](handleError(_0x52a36d,null));};exports['getLogo']=function(_0x89b90f,_0x3178f4,_0xc0205b){var _0x165c57=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x7e'));var _0x1637b8={'where':{'id':_0x89b90f['params']['id']},'attributes':['id',_0x0a0d('0x74')],'raw':!![]};var _0x3e6011=![];return require(_0x0a0d('0x7f'))[_0x0a0d('0x80')]()[_0x0a0d('0x22')](function(_0x51b176){if(_0x51b176){_0x3e6011=_0x51b176[_0x0a0d('0x81')];}})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x1637b8);})['then'](handleEntityNotFound(_0x3178f4,null))['then'](function(_0x4c61b2){if(_0x4c61b2){if(!_['isNil'](_0x4c61b2[_0x0a0d('0x74')])){if(fs[_0x0a0d('0x82')](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x83'),_0x4c61b2[_0x0a0d('0x74')]))&&_0x3e6011){_0x165c57=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x83'),_0x4c61b2[_0x0a0d('0x74')]);}}return _0x3178f4['download'](_0x165c57);}})['catch'](handleError(_0x3178f4,null));};exports[_0x0a0d('0x84')]=function(_0x3bd7bd,_0x21c250,_0x2f0059){var _0x24ab28=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x85'));var _0x46fd54={'where':{'id':_0x3bd7bd['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x46fd54)[_0x0a0d('0x22')](handleEntityNotFound(_0x21c250,null))[_0x0a0d('0x22')](function(_0x48391f){if(_0x48391f){if(!_[_0x0a0d('0x86')](_0x48391f['agentAvatar'])){if(fs['existsSync'](path[_0x0a0d('0x7c')](config['root'],_0x0a0d('0x87'),_0x48391f[_0x0a0d('0x78')]))){_0x24ab28=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x48391f[_0x0a0d('0x78')]);}}return _0x21c250[_0x0a0d('0x88')](_0x24ab28);}})[_0x0a0d('0x2b')](handleError(_0x21c250,null));};exports[_0x0a0d('0x89')]=function(_0x1f8b2c,_0xc2490e,_0x5f2bc9){var _0x53f1f2=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x8a'));var _0x4b8d65={'where':{'id':_0x1f8b2c[_0x0a0d('0x63')]['id']},'attributes':['id',_0x0a0d('0x8b'),_0x0a0d('0x8c')],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x4b8d65)[_0x0a0d('0x22')](handleEntityNotFound(_0xc2490e,null))['then'](function(_0x505041){if(_0x505041){if(!_['isNil'](_0x505041[_0x0a0d('0x8b')])){if(fs['existsSync'](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x505041['customerAvatar']))&&_0x505041[_0x0a0d('0x8c')]){_0x53f1f2=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x505041[_0x0a0d('0x8b')]);}}return _0xc2490e[_0x0a0d('0x88')](_0x53f1f2);}})[_0x0a0d('0x2b')](handleError(_0xc2490e,null));};exports['getSystemAvatar']=function(_0x237c9f,_0x41da54,_0xf5dffc){var _0x5c62fd=path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x8d'));var _0x33c148={'where':{'id':_0x237c9f['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x0a0d('0x3e')][_0x0a0d('0x57')](_0x33c148)[_0x0a0d('0x22')](handleEntityNotFound(_0x41da54,null))[_0x0a0d('0x22')](function(_0x5a6004){if(_0x5a6004){if(!_[_0x0a0d('0x86')](_0x5a6004['systemAvatar'])){if(fs[_0x0a0d('0x82')](path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x5a6004[_0x0a0d('0x7b')]))){_0x5c62fd=path['join'](config[_0x0a0d('0x7d')],_0x0a0d('0x87'),_0x5a6004['systemAvatar']);}}return _0x41da54[_0x0a0d('0x88')](_0x5c62fd);}})[_0x0a0d('0x2b')](handleError(_0x41da54,null));};exports[_0x0a0d('0x8e')]=function(_0x42b55f,_0xfdef96,_0x14dfc6){var _0xc16b36=require('user-agent-parser');var _0x3dfbb0=new _0xc16b36();var _0x1c28af=_0x3dfbb0[_0x0a0d('0x8f')](_0x42b55f[_0x0a0d('0x90')]['user-agent'])[_0x0a0d('0x91')]();var _0x237339={'body':_0x42b55f[_0x0a0d('0x59')],'channel':_0x0a0d('0x92')};var _0x5325f5=[];var _0x485ab3=[];var _0x5ddc23={};var _0x2da561=![];return db[_0x0a0d('0x93')][_0x0a0d('0x65')]()[_0x0a0d('0x22')](function(_0x5d213a){if(!_0x5d213a){throw new db['Sequelize'][(_0x0a0d('0x94'))](_0x0a0d('0x95'));}_0x5325f5=_['difference'](_[_0x0a0d('0x55')](_0x5d213a),['createdAt',_0x0a0d('0x96')]);_0x485ab3=_[_0x0a0d('0x97')](_[_0x0a0d('0x55')](_0x5d213a),['createdAt',_0x0a0d('0x96'),'CompanyId','ListId']);if(_0x42b55f['body']['id']){delete _0x42b55f[_0x0a0d('0x59')]['id'];}if(_[_0x0a0d('0x86')](_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x98')])){throw new db['Sequelize'][(_0x0a0d('0x94'))](_0x0a0d('0x99'));}if(_[_0x0a0d('0x86')](_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x59')])||_0x42b55f[_0x0a0d('0x59')]['body']===''){throw new db[(_0x0a0d('0x20'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x42b55f['body']['mapKey'])){throw new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0x9a')+_0x485ab3);}if(!_[_0x0a0d('0x9b')](_0x485ab3,_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x9c')])){throw new db[(_0x0a0d('0x20'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x485ab3);}_0x5ddc23[_0x42b55f[_0x0a0d('0x59')]['mapKey']]=_0x42b55f['body'][_0x0a0d('0x98')];})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0x3e')]['find']({'where':{'id':_0x42b55f[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x9d')],'as':_0x0a0d('0x9e'),'include':[{'model':db[_0x0a0d('0x93')],'as':_0x0a0d('0x9f'),'where':_0x5ddc23,'limit':0x1,'order':[[_0x0a0d('0x96'),_0x0a0d('0xa0')]]}]},{'model':db[_0x0a0d('0xa1')],'as':_0x0a0d('0xa2')}]});})[_0x0a0d('0x22')](handleEntityNotFound(_0xfdef96,null))[_0x0a0d('0x22')](function(_0x200dfd){if(_0x200dfd&&_0x200dfd[_0x0a0d('0x9e')]){_0x237339[_0x0a0d('0xa3')]=_0x200dfd;_0x237339['applications']=_0x200dfd[_0x0a0d('0xa2')];_0x237339[_0x0a0d('0xa4')]=_0x200dfd[_0x0a0d('0x9e')];_0x237339[_0x0a0d('0xa5')]=_['orderBy'](_0x237339[_0x0a0d('0xa5')],[_0x0a0d('0xa6')],[_0x0a0d('0xa7')]);if(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0xa2')]){delete _0x237339[_0x0a0d('0xa3')]['Applications'];}if(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0x9e')]&&_0x237339[_0x0a0d('0xa3')][_0x0a0d('0x9e')][_0x0a0d('0x9f')][_0x0a0d('0x56')]){return _0x237339['account'][_0x0a0d('0x9e')][_0x0a0d('0x9f')][0x0];}var _0x21ca58=_[_0x0a0d('0x18')](_0x42b55f['body'],{'firstName':_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x98')],'ListId':_0x200dfd[_0x0a0d('0xa8')]});_0x21ca58[_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0x9c')]]=_0x42b55f[_0x0a0d('0x59')]['from'];return db[_0x0a0d('0x93')][_0x0a0d('0x58')](_0x21ca58,{'fields':_0x5325f5,'raw':!![]});}})[_0x0a0d('0x22')](handleEntityNotFound(_0xfdef96,null))[_0x0a0d('0x22')](function(_0x139e71){_0x237339['contact']=_0x139e71;var _0x35df9d=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xa9')];if(_0x42b55f[_0x0a0d('0x90')]['cf-connecting-ip']){_0x35df9d=_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xaa')];}else if(_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xab')]){_0x35df9d=_[_0x0a0d('0xac')](_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xab')][_0x0a0d('0xad')](','));}if(_0x139e71){var _0x3770c4={'ContactId':_0x139e71['id'],'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'from':(_0x139e71[_0x0a0d('0xae')]||'')+'\x20'+(_0x139e71[_0x0a0d('0xaf')]||''),'customerIp':_0x35df9d,'customerPort':_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xb0')]?_0x42b55f[_0x0a0d('0x90')][_0x0a0d('0xb0')]:null,'referer':_0x42b55f['body'][_0x0a0d('0xb1')],'browserName':_0x1c28af['browser'][_0x0a0d('0x3a')]&&_0x1c28af[_0x0a0d('0xb2')][_0x0a0d('0xb3')]?util[_0x0a0d('0xb4')](_0x0a0d('0xb5'),_0x1c28af['browser']['name'],_0x1c28af[_0x0a0d('0xb2')][_0x0a0d('0xb3')]):'unknown','browserVersion':_0x1c28af['browser']['version']||'unknown','osName':util[_0x0a0d('0xb4')](_0x0a0d('0xb5'),_0x1c28af['os'][_0x0a0d('0x3a')],_0x1c28af['os']['version']),'osVersion':_0x1c28af['os'][_0x0a0d('0xb3')],'deviceModel':_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x42')]&&_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')]?util[_0x0a0d('0xb4')]('%s\x20%s\x20%s',_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x42')],_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')],_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0x41')]):null,'deviceVendor':_0x1c28af[_0x0a0d('0xb6')][_0x0a0d('0xb7')],'deviceType':_0x1c28af[_0x0a0d('0xb6')]['type'],'formData':JSON[_0x0a0d('0x26')](_0x42b55f['body'])};var _0xb8cd31={'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'closed':![]};if(_0x42b55f['body'][_0x0a0d('0xb8')]){_0xb8cd31[_0x0a0d('0xb8')]=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')];return db['ChatInteraction'][_0x0a0d('0x57')]({'where':_0xb8cd31})[_0x0a0d('0x22')](function(_0x232b29){if(_0x232b29){return[_0x232b29,![]];}_0x3770c4[_0x0a0d('0xb8')]=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')];_0x3770c4['externalUrl']=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb9')];return db[_0x0a0d('0xba')][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0x22fb1c){return[_0x22fb1c,!![]];});});}_0xb8cd31[_0x0a0d('0xbb')]=_0x139e71['id'];if(_0x42b55f['body'][_0x0a0d('0xbc')]&&_0x42b55f['body'][_0x0a0d('0xbc')]['id']){_0xb8cd31['id']=_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xbc')]['id'];return db[_0x0a0d('0xba')][_0x0a0d('0x57')]({'where':_0xb8cd31})['then'](function(_0x47db43){if(_0x47db43){return[_0x47db43,![]];}return db['ChatInteraction'][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0x5cf9c4){return[_0x5cf9c4,!![]];});});}return db[_0x0a0d('0xba')][_0x0a0d('0x58')](_0x3770c4)[_0x0a0d('0x22')](function(_0xfc5715){return[_0xfc5715,!![]];});}})['spread'](function(_0x4205c5,_0x5f1b11){if(_0x4205c5){_0x2da561=_0x5f1b11;if(!_0x5f1b11){var _0xbd0deb={'from':(_0x237339[_0x0a0d('0xbd')][_0x0a0d('0xae')]||'')+'\x20'+(_0x237339[_0x0a0d('0xbd')][_0x0a0d('0xaf')]||'')};if(_0x42b55f['body']['threadId']&&_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xbe')]&&_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xb8')]!=_0x42b55f[_0x0a0d('0x59')]['messageId']){_0xbd0deb['threadId']=_0x42b55f['body'][_0x0a0d('0xbe')];}return _0x4205c5[_0x0a0d('0x35')](_0xbd0deb);}else{return _0x4205c5;}}})[_0x0a0d('0x22')](function(_0x1a8259){_0x237339[_0x0a0d('0xbc')]=_0x1a8259[_0x0a0d('0x5b')]({'plain':!![]});_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xbf')]=_0x2da561;if(_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xbf')]){if(_0x237339['account']['autoclose']){_0x237339[_0x0a0d('0xa5')][_0x0a0d('0xc0')]({'id':0x0,'priority':_0x237339['applications'][_0x0a0d('0x56')]+0x1,'app':_0x0a0d('0xc1'),'appdata':_0x0a0d('0xc2'),'interval':_0x0a0d('0xc3')});}}return db[_0x0a0d('0xc4')][_0x0a0d('0x58')]({'body':_0x42b55f['body'][_0x0a0d('0x59')],'ChatWebsiteId':_0x42b55f[_0x0a0d('0x63')]['id'],'ChatInteractionId':_0x1a8259['id'],'direction':'in','ContactId':_0x237339[_0x0a0d('0xbd')]['id'],'AttachmentId':_0x42b55f[_0x0a0d('0x59')][_0x0a0d('0xc5')]});})[_0x0a0d('0x22')](function(_0x3fba15){_0x237339[_0x0a0d('0x29')]=_0x3fba15;if(_0x237339[_0x0a0d('0xbc')]['UserId']){return db[_0x0a0d('0xc6')][_0x0a0d('0x57')]({'attributes':['id',_0x0a0d('0x3a')],'where':{'id':_0x237339[_0x0a0d('0xbc')][_0x0a0d('0xc7')]}})['then'](function(_0x354cae){if(_0x354cae){_0x237339[_0x0a0d('0xa5')][_0x0a0d('0xc8')]({'id':0x0,'priority':0x0,'app':_0x0a0d('0xc9'),'appdata':_0x354cae[_0x0a0d('0x3a')]+','+(_0x237339[_0x0a0d('0xa3')][_0x0a0d('0xca')]||0xa),'interval':_0x0a0d('0xc3')});_0x237339['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0a0d('0xcb'),_0x0a0d('0xcc'),_0x237339);});}return respondWithRpcPromise('Start','startRouting',_0x237339);})[_0x0a0d('0x22')](function(_0x2e8506){respondWithRpcPromise('EventManager','EventManager',{'event':_0x0a0d('0x8e'),'message':_0x2e8506},client9002);return _0x2e8506;})[_0x0a0d('0x22')](respondWithResult(_0xfdef96,null))['catch'](handleError(_0xfdef96,null));};exports[_0x0a0d('0xcd')]=function(_0x1e1d23,_0x5b74ee,_0x4881e5){var _0x36cad8,_0x511f63,_0x137214;var _0x28e503=[];var _0x899fa5=[];var _0x240bee={};return db['CmContact']['describe']()[_0x0a0d('0x22')](function(_0x527299){if(!_0x527299){throw new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0x95'));}_0x899fa5=_['difference'](_[_0x0a0d('0x55')](_0x527299),['createdAt',_0x0a0d('0x96')]);_0x28e503=_[_0x0a0d('0x97')](_[_0x0a0d('0x55')](_0x527299),[_0x0a0d('0xce'),_0x0a0d('0x96'),_0x0a0d('0xcf'),'ListId']);if(_0x1e1d23[_0x0a0d('0x59')]['id']){delete _0x1e1d23['body']['id'];}if(_[_0x0a0d('0x86')](_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')])){throw _0x5b74ee['status'](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0x99')));}if(_[_0x0a0d('0x86')](_0x1e1d23['body'][_0x0a0d('0x59')])||_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x59')]===''){throw _0x5b74ee[_0x0a0d('0x2d')](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))]['ValidationError'](_0x0a0d('0xd0')));}if(_[_0x0a0d('0x86')](_0x1e1d23[_0x0a0d('0x59')]['mapKeyOffline'])){throw _0x5b74ee['status'](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))](_0x0a0d('0xd1')+_0x28e503));}if(!_[_0x0a0d('0x9b')](_0x28e503,_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0xd2')])){throw _0x5b74ee[_0x0a0d('0x2d')](0x1f4)[_0x0a0d('0x3b')](new db[(_0x0a0d('0x20'))][(_0x0a0d('0x94'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28e503));}_0x240bee[_0x1e1d23[_0x0a0d('0x59')]['mapKeyOffline']]=_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1e1d23[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x9d')],'as':_0x0a0d('0x9e')}]});})['then'](handleEntityNotFound(_0x5b74ee,null))[_0x0a0d('0x22')](function(_0xeb56bf){if(_0xeb56bf&&_0xeb56bf[_0x0a0d('0x9e')]){_0x511f63=_0xeb56bf;var _0x39dbf0=_[_0x0a0d('0x18')](_0x1e1d23[_0x0a0d('0x59')],{'firstName':_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')],'phone':_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')],'ListId':_0xeb56bf[_0x0a0d('0xa8')]});_0x39dbf0[_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0xd2')]]=_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x98')];return db[_0x0a0d('0x93')][_0x0a0d('0xd3')]({'where':_0x240bee,'defaults':_0x39dbf0});}})[_0x0a0d('0xd4')](function(_0x526fa3){if(_0x526fa3){_0x137214=_0x526fa3;var _0x4d89c6=fs[_0x0a0d('0xd5')](path['join'](config[_0x0a0d('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),_0x0a0d('0xd6'));var _0x35e095=ejs['render'](_0x4d89c6,{'body':_[_0x0a0d('0xd7')](_0x1e1d23[_0x0a0d('0x59')][_0x0a0d('0x59')]),'bodyTitle':_0x511f63[_0x0a0d('0xd8')]});return db[_0x0a0d('0xd9')][_0x0a0d('0x58')]({'body':_0x35e095,'ContactId':_0x526fa3['id'],'ChatWebsiteId':_0x511f63['id']});}})[_0x0a0d('0x22')](function(_0x1098ed){if(_0x1098ed){_0x36cad8=_0x1098ed;return db[_0x0a0d('0xda')][_0x0a0d('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0x0a0d('0xdb')],'as':_0x0a0d('0xdc'),'raw':!![]}]});}})[_0x0a0d('0x22')](function(_0x5c22ab){if(_0x5c22ab&&_0x5c22ab['Smtp']&&_0x511f63['forwardOfflineAddress']){var _0x182171={'tls':{'rejectUnauthorized':![]}};if(_0x5c22ab[_0x0a0d('0xdc')]['service']){_0x182171['service']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xdd')];}else{_0x182171[_0x0a0d('0xde')]=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xde')];_0x182171['port']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xdf')];_0x182171['secure']=_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe0')];}if(_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe1')]){_0x182171[_0x0a0d('0xe2')]={'user':_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0x5a')],'pass':_0x5c22ab[_0x0a0d('0xdc')][_0x0a0d('0xe3')]};}return respondWithRpcPromise(_0x0a0d('0xe4'),_0x0a0d('0xe5'),{'account':_0x182171,'message':{'from':util[_0x0a0d('0xb4')](_0x0a0d('0xe6'),_0x5c22ab[_0x0a0d('0x3a')],_0x5c22ab[_0x0a0d('0xe7')]||_0x5c22ab[_0x0a0d('0xdc')]['user']),'to':_0x511f63[_0x0a0d('0xe8')],'subject':_0x511f63[_0x0a0d('0xe9')],'text':_0x36cad8[_0x0a0d('0x59')]}},client9003)[_0x0a0d('0x22')](function(){return _0x36cad8;})[_0x0a0d('0x2b')](function(_0x20bd55){console[_0x0a0d('0x27')](_0x20bd55);});}})[_0x0a0d('0x22')](function(){if(_0x36cad8){return _0x36cad8;}})['then'](respondWithResult(_0x5b74ee,null))[_0x0a0d('0x2b')](handleError(_0x5b74ee,null));};exports[_0x0a0d('0xea')]=function(_0x5d9f61,_0x3b5ef5,_0x392e5e){return db[_0x0a0d('0xba')][_0x0a0d('0x57')]({'where':{'id':_0x5d9f61[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x3b5ef5,null))[_0x0a0d('0x22')](function(_0x4c5382){if(_0x4c5382){return _0x4c5382['addInteraction'](_0x5d9f61['body'][_0x0a0d('0x72')],_[_0x0a0d('0xeb')](_0x5d9f61[_0x0a0d('0x59')],['ids','id'])||{});}})[_0x0a0d('0x22')](respondWithResult(_0x3b5ef5,null))[_0x0a0d('0x2b')](handleError(_0x3b5ef5,null));};exports[_0x0a0d('0xec')]=function(_0x24e58b,_0x1ab19d,_0x1f61f7){var _0x10e2c4={'raw':![],'where':{}};var _0x4f54e1={};var _0x33edb6={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x24e58b[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x1ab19d,null))[_0x0a0d('0x22')](function(_0x111b6a){if(_0x111b6a){_0x4f54e1[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatInteraction']['rawAttributes']);_0x4f54e1[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x24e58b[_0x0a0d('0x44')]);_0x4f54e1[_0x0a0d('0x45')]=_['intersection'](_0x4f54e1[_0x0a0d('0x42')],_0x4f54e1[_0x0a0d('0x44')]);_0x10e2c4[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x4f54e1[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x48')]));_0x10e2c4[_0x0a0d('0x47')]=_0x10e2c4[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x10e2c4['attributes']:_0x4f54e1[_0x0a0d('0x42')];if(!_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x10e2c4[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x10e2c4[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x24e58b['query'][_0x0a0d('0x2f')]);}_0x10e2c4[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x10e2c4[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x24e58b[_0x0a0d('0x44')],_0x4f54e1[_0x0a0d('0x45')]));_0x10e2c4[_0x0a0d('0x4c')]['ChatWebsiteId']=_0x111b6a['id'];if(_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x10e2c4[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x10e2c4[_0x0a0d('0x4c')],{'$or':_['map'](_0x10e2c4[_0x0a0d('0x47')],function(_0x16e12b){var _0x4c10f2={};_0x4c10f2[_0x16e12b]={'$like':'%'+_0x24e58b[_0x0a0d('0x44')]['filter']+'%'};return _0x4c10f2;})});}_0x10e2c4=_[_0x0a0d('0x4d')]({},_0x10e2c4,_0x24e58b['options']);return db[_0x0a0d('0xba')][_0x0a0d('0x50')]({'where':_0x10e2c4['where']})['then'](function(_0x4a6a5d){_0x33edb6['count']=_0x4a6a5d;if(_0x24e58b[_0x0a0d('0x44')]['includeAll']){_0x10e2c4[_0x0a0d('0x52')]=[{'model':db[_0x0a0d('0x93')],'as':_0x0a0d('0xee'),'required':![]},{'model':db[_0x0a0d('0xc6')],'as':_0x0a0d('0xef'),'attributes':[_0x0a0d('0x3a'),_0x0a0d('0xf0'),_0x0a0d('0xf1')],'required':![]},{'model':db[_0x0a0d('0xf2')],'as':_0x0a0d('0xf3'),'attributes':['id',_0x0a0d('0x3a'),_0x0a0d('0xf4')],'where':_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0xf5')]?{'id':_0x24e58b[_0x0a0d('0x44')]['tag']}:undefined,'required':_0x24e58b[_0x0a0d('0x44')][_0x0a0d('0xf5')]?!![]:![]}];}return db[_0x0a0d('0xba')][_0x0a0d('0x53')](_0x10e2c4);})[_0x0a0d('0x22')](function(_0x127a7c){_0x33edb6[_0x0a0d('0x54')]=_0x127a7c;return _0x33edb6;});}})[_0x0a0d('0x22')](respondWithFilteredResult(_0x1ab19d,_0x10e2c4))[_0x0a0d('0x2b')](handleError(_0x1ab19d,null));};function iftimePromise(_0x288ed0,_0x4ffcc2){return respondWithRpcPromise('Command',_0x0a0d('0xf6'),{'command':_0x4ffcc2[_0x0a0d('0xf7')]?util['format'](_0x0a0d('0xf8'),_0x288ed0[_0x0a0d('0xf9')],_0x4ffcc2['timezone']):util[_0x0a0d('0xb4')]('iftime\x20%s',_0x288ed0[_0x0a0d('0xf9')])},client9002)[_0x0a0d('0x22')](function(_0x5f4541){var _0x16ea9b=_0x5f4541&&_0x5f4541[_0x0a0d('0xfa')](_0x0a0d('0xfb'))>=0x0?!![]:![];logger['info'](_0x0a0d('0xfc'),_0x4ffcc2['id'],_0x288ed0['id'],_0x288ed0[_0x0a0d('0xf9')],_0x16ea9b?_0x0a0d('0xfd'):_0x0a0d('0xfe'),_0x4ffcc2[_0x0a0d('0xf7')]?_0x4ffcc2[_0x0a0d('0xf7')]:'No\x20timezone');return _0x16ea9b;})[_0x0a0d('0x2b')](function(_0x4b1ecd){logger['error'](_0x0a0d('0xfc'),_0x4ffcc2['id'],_0x288ed0['id'],_0x288ed0[_0x0a0d('0xf9')],util[_0x0a0d('0xff')](_0x4b1ecd,{'showHidden':![],'depth':null}),_0x4ffcc2[_0x0a0d('0xf7')]?_0x4ffcc2[_0x0a0d('0xf7')]:_0x0a0d('0x100'));return![];});}exports[_0x0a0d('0xf6')]=function(_0x263a72,_0x2c9776,_0x225af3){var _0x258d66=0x0;var _0x536fc2=0x0;var _0x385383=![];var _0xe1fcff;var _0x2879db;return db['ChatWebsite'][_0x0a0d('0x57')]({'where':{'id':_0x263a72[_0x0a0d('0x63')]['id']},'include':[{'model':db[_0x0a0d('0x101')],'as':_0x0a0d('0x101'),'include':[{'model':db['Interval'],'as':_0x0a0d('0x102'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x0a0d('0x22')](handleEntityNotFound(_0x2c9776,null))[_0x0a0d('0x22')](function(_0x57e273){if(_0x57e273){_0xe1fcff=_0x57e273;return _0x57e273[_0x0a0d('0x103')]({'raw':!![]});}})[_0x0a0d('0x22')](function(_0x100f88){if(_0xe1fcff){if(_0x100f88){_0x2879db=_0x100f88;}}return require(_0x0a0d('0x7f'))[_0x0a0d('0x80')]();})[_0x0a0d('0x22')](function(_0x2dc8db){if(_0x2dc8db){_0x536fc2=_0x2dc8db[_0x0a0d('0x104')];_0x385383=_0x2dc8db[_0x0a0d('0x81')];}})[_0x0a0d('0x22')](function(){return db[_0x0a0d('0xba')][_0x0a0d('0x50')]({'where':{'closed':![]}});})[_0x0a0d('0x22')](function(_0x5d77b0){_0x258d66=_0x5d77b0;if(_0x536fc2&&_0x5d77b0>_0x536fc2){return db[_0x0a0d('0x105')][_0x0a0d('0x6a')]({'where':{'id':0x1}})['then'](function(_0x1d870d){if(_0x1d870d){_0x1d870d['increment'](_0x0a0d('0x106'));}});}})[_0x0a0d('0x22')](function(){if(_0xe1fcff['Interval']&&_0xe1fcff[_0x0a0d('0x101')][_0x0a0d('0x102')]){var _0x19602c=[];for(var _0x21d64d=0x0;_0x21d64d<_0xe1fcff[_0x0a0d('0x101')][_0x0a0d('0x102')]['length'];_0x21d64d++){var _0x40cc06=_0xe1fcff[_0x0a0d('0x101')]['Intervals'][_0x21d64d]['get']({'plain':!![]});_0x19602c[_0x0a0d('0xc0')](iftimePromise(_0x40cc06,_0xe1fcff));}return BPromise['all'](_0x19602c)['then'](function(_0x8f1388){return _[_0x0a0d('0x107')](_0x8f1388);});}else{return!![];}})[_0x0a0d('0x22')](function(_0x1a6f61){var _0x53566f=fs['readFileSync'](path[_0x0a0d('0x7c')](config[_0x0a0d('0x7d')],_0x0a0d('0x108')),'utf8');var _0x14dea7={'remote':_0xe1fcff['remote'],'query':querystring[_0x0a0d('0x26')](_[_0x0a0d('0x4d')](_0xe1fcff['get']({'plain':!![]}),{'customerIp':_0x263a72[_0x0a0d('0x90')][_0x0a0d('0xab')]||_0x263a72[_0x0a0d('0x90')][_0x0a0d('0x109')]||_0x263a72['connection'][_0x0a0d('0x10a')]||_0x263a72['ip'],'referer':_0x263a72[_0x0a0d('0x90')]['referer'],'openedInteractions':_0x258d66,'maxInteractions':_0x536fc2,'virtual':_0x385383[_0x0a0d('0x104')],'online':_0x1a6f61,'custom':_0x385383}))['replace'](/'/g,'\x5c\x27')};_0x2c9776['send'](ejs[_0x0a0d('0x10b')](Mustache[_0x0a0d('0x10b')](_0x53566f,_0x14dea7),{'proactiveActions':_0x2879db,'alignment':_0xe1fcff[_0x0a0d('0x10c')],'verticalAlignment':_0xe1fcff[_0x0a0d('0x10d')],'div_color':_0xe1fcff[_0x0a0d('0xf4')],'text_color':_0xe1fcff[_0x0a0d('0x10e')]}));})[_0x0a0d('0x2b')](handleError(_0x2c9776,null));};exports[_0x0a0d('0x10f')]=function(_0x28ac67,_0x28b629,_0x2405e8){return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x28ac67[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x28b629,null))[_0x0a0d('0x22')](function(_0x21f4fd){if(_0x21f4fd){return db[_0x0a0d('0x110')][_0x0a0d('0x111')](function(_0x9ff7c4){return db[_0x0a0d('0xa1')][_0x0a0d('0x36')]({'where':{'ChatWebsiteId':_0x28ac67['params']['id']},'transaction':_0x9ff7c4})[_0x0a0d('0x22')](function(_0x3e62b5){var _0x1d7857=_['map'](_0x28ac67[_0x0a0d('0x59')],function(_0x1fc0b8){_0x1fc0b8[_0x0a0d('0x67')]=_0x28ac67['params']['id'];return _0x1fc0b8;});return db[_0x0a0d('0xa1')][_0x0a0d('0x112')](_0x1d7857,{'transaction':_0x9ff7c4});});})[_0x0a0d('0x22')](function(){return db['ChatApplication'][_0x0a0d('0x113')]({'where':{'ChatWebsiteId':_0x28ac67[_0x0a0d('0x63')]['id']},'order':_0x0a0d('0xa6')});});}})[_0x0a0d('0x22')](respondWithResult(_0x28b629,null))[_0x0a0d('0x2b')](handleError(_0x28b629,null));};exports[_0x0a0d('0x114')]=function(_0x17b2e9,_0x2a9475,_0x4ff694){var _0x2199c4={};var _0x27a9da={};var _0x2643fd;var _0x4e141b;return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x17b2e9[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x2a9475,null))[_0x0a0d('0x22')](function(_0xa440aa){if(_0xa440aa){_0x2643fd=_0xa440aa;_0x27a9da[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatApplication']['rawAttributes']);_0x27a9da['query']=_['keys'](_0x17b2e9[_0x0a0d('0x44')]);_0x27a9da[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x27a9da[_0x0a0d('0x42')],_0x27a9da[_0x0a0d('0x44')]);_0x2199c4[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x27a9da[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x17b2e9[_0x0a0d('0x44')]['fields']));_0x2199c4[_0x0a0d('0x47')]=_0x2199c4[_0x0a0d('0x47')]['length']?_0x2199c4[_0x0a0d('0x47')]:_0x27a9da[_0x0a0d('0x42')];_0x2199c4['order']=qs[_0x0a0d('0x4b')](_0x17b2e9[_0x0a0d('0x44')]['sort']);_0x2199c4[_0x0a0d('0x4c')]=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x17b2e9[_0x0a0d('0x44')],_0x27a9da[_0x0a0d('0x45')]));if(_0x17b2e9[_0x0a0d('0x44')]['filter']){_0x2199c4[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x2199c4[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x2199c4[_0x0a0d('0x47')],function(_0x1ccd8b){var _0x191c33={};_0x191c33[_0x1ccd8b]={'$like':'%'+_0x17b2e9[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x191c33;})});}_0x2199c4=_[_0x0a0d('0x4d')]({},_0x2199c4,_0x17b2e9['options']);return _0x2643fd['getApplications'](_0x2199c4);}})['then'](function(_0x4cd267){if(_0x4cd267){_0x4e141b=_0x4cd267[_0x0a0d('0x56')];if(!_0x17b2e9['query']['hasOwnProperty'](_0x0a0d('0x4a'))){_0x2199c4[_0x0a0d('0x30')]=qs['limit'](_0x17b2e9[_0x0a0d('0x44')]['limit']);_0x2199c4[_0x0a0d('0x2f')]=qs['offset'](_0x17b2e9[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}return _0x2643fd[_0x0a0d('0x114')](_0x2199c4);}})[_0x0a0d('0x22')](function(_0x1b4665){if(_0x1b4665){return _0x1b4665?{'count':_0x4e141b,'rows':_0x1b4665}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x2a9475,null))[_0x0a0d('0x2b')](handleError(_0x2a9475,null));};exports['addProactiveActions']=function(_0x45c253,_0x13045a,_0x30bcfc){return db['chatProactiveAction']['find']({'where':{'id':_0x45c253[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x13045a,null))['then'](function(_0x59fc96){if(_0x59fc96){return _0x59fc96[_0x0a0d('0x115')](_0x45c253[_0x0a0d('0x59')][_0x0a0d('0x72')],_['omit'](_0x45c253[_0x0a0d('0x59')],[_0x0a0d('0x72'),'id'])||{});}})[_0x0a0d('0x22')](respondWithResult(_0x13045a,null))[_0x0a0d('0x2b')](handleError(_0x13045a,null));};exports['getProactiveActions']=function(_0x30e493,_0x446096,_0xbfd121){var _0x214ee8={};var _0x1af65e={};var _0x4fd753;var _0x3f2147;return db['ChatWebsite'][_0x0a0d('0x6a')]({'where':{'id':_0x30e493['params']['id']}})['then'](handleEntityNotFound(_0x446096,null))[_0x0a0d('0x22')](function(_0x7d9e0e){if(_0x7d9e0e){_0x4fd753=_0x7d9e0e;_0x1af65e[_0x0a0d('0x42')]=_[_0x0a0d('0x55')](db['ChatProactiveAction'][_0x0a0d('0x3f')]);_0x1af65e[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x30e493[_0x0a0d('0x44')]);_0x1af65e[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x1af65e[_0x0a0d('0x42')],_0x1af65e[_0x0a0d('0x44')]);_0x214ee8[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x1af65e[_0x0a0d('0x42')],qs['fields'](_0x30e493[_0x0a0d('0x44')]['fields']));_0x214ee8[_0x0a0d('0x47')]=_0x214ee8[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x214ee8['attributes']:_0x1af65e[_0x0a0d('0x42')];_0x214ee8[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x30e493[_0x0a0d('0x44')]['sort']);_0x214ee8['where']=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x30e493[_0x0a0d('0x44')],_0x1af65e[_0x0a0d('0x45')]));if(_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x214ee8[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x214ee8['where'],{'$or':_[_0x0a0d('0x43')](_0x214ee8[_0x0a0d('0x47')],function(_0x3394c7){var _0x41f4fd={};_0x41f4fd[_0x3394c7]={'$like':'%'+_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x41f4fd;})});}_0x214ee8=_['merge']({},_0x214ee8,_0x30e493[_0x0a0d('0x4f')]);return _0x4fd753[_0x0a0d('0x103')](_0x214ee8);}})[_0x0a0d('0x22')](function(_0x1dfbbc){if(_0x1dfbbc){_0x3f2147=_0x1dfbbc[_0x0a0d('0x56')];if(!_0x30e493[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x214ee8[_0x0a0d('0x30')]=qs['limit'](_0x30e493['query']['limit']);_0x214ee8['offset']=qs['offset'](_0x30e493[_0x0a0d('0x44')]['offset']);}return _0x4fd753['getProactiveActions'](_0x214ee8);}})[_0x0a0d('0x22')](function(_0x30c201){if(_0x30c201){return _0x30c201?{'count':_0x3f2147,'rows':_0x30c201}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x446096,null))[_0x0a0d('0x2b')](handleError(_0x446096,null));};exports[_0x0a0d('0x116')]=function(_0x29f01c,_0x3cd323,_0x39de4c){var _0x575831=_0x29f01c[_0x0a0d('0x44')][_0x0a0d('0x117')]===_0x0a0d('0x118')?_0x0a0d('0x119'):_0x0a0d('0x11a');return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'attributes':['id',_0x575831],'where':{'id':_0x29f01c[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0x3cd323,null))[_0x0a0d('0x22')](function(_0xeef3f7){if(_0xeef3f7){var _0x49dbf9=_0xeef3f7[_0x575831];var _0x5c48cb=_0x49dbf9&&_0x49dbf9['items']?_0x49dbf9[_0x0a0d('0x11b')]:[];_0x3cd323[_0x0a0d('0x3b')]({'fromKey':_['isNil'](_0x49dbf9['fromKey'])?undefined:_0x49dbf9[_0x0a0d('0x11c')],'count':_0x5c48cb[_0x0a0d('0x56')],'rows':_0x5c48cb});}})[_0x0a0d('0x2b')](handleError(_0x3cd323,null));};exports['getOfflineMessages']=function(_0x8a73dc,_0xcf653e,_0x290353){var _0x193043={'raw':![],'where':{}};var _0x4d97ca={};var _0x494e25={'count':0x0,'rows':[]};return db[_0x0a0d('0x3e')][_0x0a0d('0x6a')]({'where':{'id':_0x8a73dc[_0x0a0d('0x63')]['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0xcf653e,null))[_0x0a0d('0x22')](function(_0x5dbb0e){if(_0x5dbb0e){_0x4d97ca['model']=_['keys'](db[_0x0a0d('0xd9')]['rawAttributes']);_0x4d97ca['query']=_[_0x0a0d('0x55')](_0x8a73dc[_0x0a0d('0x44')]);_0x4d97ca[_0x0a0d('0x45')]=_['intersection'](_0x4d97ca[_0x0a0d('0x42')],_0x4d97ca[_0x0a0d('0x44')]);_0x193043[_0x0a0d('0x47')]=_['intersection'](_0x4d97ca[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x8a73dc[_0x0a0d('0x44')]['fields']));_0x193043[_0x0a0d('0x47')]=_0x193043[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x193043[_0x0a0d('0x47')]:_0x4d97ca[_0x0a0d('0x42')];if(!_0x8a73dc[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x193043[_0x0a0d('0x30')]=qs[_0x0a0d('0x30')](_0x8a73dc['query'][_0x0a0d('0x30')]);_0x193043[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x8a73dc[_0x0a0d('0x44')][_0x0a0d('0x2f')]);}_0x193043[_0x0a0d('0x6b')]=qs[_0x0a0d('0x4b')](_0x8a73dc[_0x0a0d('0x44')]['sort']);_0x193043[_0x0a0d('0x4c')]=qs['filters'](_[_0x0a0d('0xed')](_0x8a73dc[_0x0a0d('0x44')],_0x4d97ca[_0x0a0d('0x45')]));_0x193043[_0x0a0d('0x4c')]['ChatWebsiteId']=_0x5dbb0e['id'];if(_0x8a73dc['query']['filter']){_0x193043['where']=_['merge'](_0x193043[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x193043[_0x0a0d('0x47')],function(_0x444e43){var _0x245f12={};_0x245f12[_0x444e43]={'$like':'%'+_0x8a73dc['query'][_0x0a0d('0x6c')]+'%'};return _0x245f12;})});}_0x193043=_[_0x0a0d('0x4d')]({},_0x193043,_0x8a73dc[_0x0a0d('0x4f')]);return db[_0x0a0d('0xd9')]['count']({'where':_0x193043['where']})['then'](function(_0x3468d7){_0x494e25[_0x0a0d('0x50')]=_0x3468d7;if(_0x8a73dc[_0x0a0d('0x44')]['includeAll']){_0x193043['include']=[{'all':!![]}];}else{_0x193043['include']=[{'model':db['CmContact'],'as':_0x0a0d('0xee'),'required':![]}];}return db[_0x0a0d('0xd9')][_0x0a0d('0x53')](_0x193043);})[_0x0a0d('0x22')](function(_0x57530f){_0x494e25[_0x0a0d('0x54')]=_0x57530f;return _0x494e25;});}})[_0x0a0d('0x22')](respondWithFilteredResult(_0xcf653e,_0x193043))['catch'](handleError(_0xcf653e,null));};exports[_0x0a0d('0x11d')]=function(_0x12bdcc,_0xd504c9,_0x52e69b){return db[_0x0a0d('0x3e')][_0x0a0d('0x57')]({'where':{'id':_0x12bdcc['params']['id']}})[_0x0a0d('0x22')](handleEntityNotFound(_0xd504c9,null))[_0x0a0d('0x22')](function(_0xcbc82b){if(_0xcbc82b){return _0xcbc82b[_0x0a0d('0x11d')](_0x12bdcc['body'][_0x0a0d('0x72')],_[_0x0a0d('0xeb')](_0x12bdcc[_0x0a0d('0x59')],['ids','id'])||{})[_0x0a0d('0xd4')](function(_0x47137b){for(var _0x55fdd5=0x0;_0x55fdd5<_0x12bdcc[_0x0a0d('0x59')][_0x0a0d('0x72')]['length'];_0x55fdd5+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x12bdcc[_0x0a0d('0x59')][_0x0a0d('0x72')][_0x55fdd5],'ChatWebsiteId':_0x12bdcc[_0x0a0d('0x63')]['id']});}return _0x47137b;});}})[_0x0a0d('0x22')](respondWithResult(_0xd504c9,null))['catch'](handleError(_0xd504c9,null));};exports[_0x0a0d('0x11e')]=function(_0x251d65,_0x3f1741,_0x3e5555){return db['ChatWebsite'][_0x0a0d('0x57')]({'where':{'id':_0x251d65[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x3f1741,null))[_0x0a0d('0x22')](function(_0x3e4e94){if(_0x3e4e94){return _0x3e4e94['removeAgents'](_0x251d65['query'][_0x0a0d('0x72')])[_0x0a0d('0x22')](function(){if(_[_0x0a0d('0x11f')](_0x251d65['query']['ids'])){for(var _0x70489b=0x0;_0x70489b<_0x251d65[_0x0a0d('0x44')]['ids'][_0x0a0d('0x56')];_0x70489b+=0x1){socket[_0x0a0d('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x251d65[_0x0a0d('0x44')][_0x0a0d('0x72')][_0x70489b]),'ChatWebsiteId':Number(_0x251d65[_0x0a0d('0x63')]['id'])});}}else{socket[_0x0a0d('0x120')](_0x0a0d('0x121'),{'UserId':Number(_0x251d65[_0x0a0d('0x44')]['ids']),'ChatWebsiteId':Number(_0x251d65['params']['id'])});}});}})[_0x0a0d('0x22')](respondWithStatusCode(_0x3f1741,null))[_0x0a0d('0x2b')](handleError(_0x3f1741,null));};exports[_0x0a0d('0x122')]=function(_0x324a1c,_0x2d1ed3,_0x1f178d){var _0x4681ee={};var _0x2fcf64={};var _0x329131;var _0x5e3cb8;return db['ChatWebsite'][_0x0a0d('0x6a')]({'where':{'id':_0x324a1c[_0x0a0d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2d1ed3,null))[_0x0a0d('0x22')](function(_0x5925c4){if(_0x5925c4){_0x329131=_0x5925c4;_0x2fcf64[_0x0a0d('0x42')]=_['keys'](db[_0x0a0d('0xc6')]['rawAttributes']);_0x2fcf64[_0x0a0d('0x44')]=_[_0x0a0d('0x55')](_0x324a1c[_0x0a0d('0x44')]);_0x2fcf64[_0x0a0d('0x45')]=_[_0x0a0d('0x46')](_0x2fcf64[_0x0a0d('0x42')],_0x2fcf64[_0x0a0d('0x44')]);_0x4681ee[_0x0a0d('0x47')]=_[_0x0a0d('0x46')](_0x2fcf64[_0x0a0d('0x42')],qs[_0x0a0d('0x48')](_0x324a1c['query'][_0x0a0d('0x48')]));_0x4681ee[_0x0a0d('0x47')]=_0x4681ee[_0x0a0d('0x47')][_0x0a0d('0x56')]?_0x4681ee[_0x0a0d('0x47')]:_0x2fcf64['model'];_0x4681ee[_0x0a0d('0x6b')]=qs['sort'](_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x4b')]);_0x4681ee['where']=qs[_0x0a0d('0x45')](_[_0x0a0d('0xed')](_0x324a1c[_0x0a0d('0x44')],_0x2fcf64[_0x0a0d('0x45')]));if(_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x6c')]){_0x4681ee[_0x0a0d('0x4c')]=_[_0x0a0d('0x4d')](_0x4681ee[_0x0a0d('0x4c')],{'$or':_[_0x0a0d('0x43')](_0x4681ee[_0x0a0d('0x47')],function(_0x1b8c11){var _0x7b1a31={};_0x7b1a31[_0x1b8c11]={'$like':'%'+_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x6c')]+'%'};return _0x7b1a31;})});}_0x4681ee=_[_0x0a0d('0x4d')]({},_0x4681ee,_0x324a1c[_0x0a0d('0x4f')]);return _0x329131[_0x0a0d('0x122')](_0x4681ee);}})['then'](function(_0x82766a){if(_0x82766a){_0x5e3cb8=_0x82766a['length'];if(!_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x49')](_0x0a0d('0x4a'))){_0x4681ee['limit']=qs['limit'](_0x324a1c[_0x0a0d('0x44')][_0x0a0d('0x30')]);_0x4681ee[_0x0a0d('0x2f')]=qs[_0x0a0d('0x2f')](_0x324a1c['query'][_0x0a0d('0x2f')]);}return _0x329131[_0x0a0d('0x122')](_0x4681ee);}})[_0x0a0d('0x22')](function(_0x416078){if(_0x416078){return _0x416078?{'count':_0x5e3cb8,'rows':_0x416078}:null;}})[_0x0a0d('0x22')](respondWithResult(_0x2d1ed3,null))[_0x0a0d('0x2b')](handleError(_0x2d1ed3,null));}; \ No newline at end of file +var _0x29f1=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','ChatWebsites','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','ChatWebsite','includeAll','include','findAll','show','params','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','User','UserId','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','getInteractions','pick','Contact','Owner','fullname','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','getLicense','virtual','custom','License','increment','Intervals','all','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','omit','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','rimraf'];(function(_0x75c346,_0x3aa49a){var _0x2b4b02=function(_0x48fdf3){while(--_0x48fdf3){_0x75c346['push'](_0x75c346['shift']());}};_0x2b4b02(++_0x3aa49a);}(_0x29f1,0x120));var _0x129f=function(_0x19beab,_0x2c9e3e){_0x19beab=_0x19beab-0x0;var _0x14d7fe=_0x29f1[_0x19beab];return _0x14d7fe;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x129f('0x0'));var rimraf=require(_0x129f('0x1'));var zipdir=require(_0x129f('0x2'));var jsonpatch=require(_0x129f('0x3'));var rp=require(_0x129f('0x4'));var moment=require(_0x129f('0x5'));var BPromise=require(_0x129f('0x6'));var Mustache=require(_0x129f('0x7'));var util=require('util');var path=require(_0x129f('0x8'));var sox=require(_0x129f('0x9'));var csv=require('to-csv');var ejs=require(_0x129f('0xa'));var fs=require('fs');var _=require(_0x129f('0xb'));var squel=require(_0x129f('0xc'));var crypto=require(_0x129f('0xd'));var jsforce=require(_0x129f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x129f('0xf'));var querystring=require(_0x129f('0x10'));var Papa=require(_0x129f('0x11'));var Redis=require('ioredis');var authService=require(_0x129f('0x12'));var qs=require(_0x129f('0x13'));var as=require(_0x129f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x129f('0x15'));var utils=require(_0x129f('0x16'));var config=require(_0x129f('0x17'));var db=require('../../mysqldb')['db'];config[_0x129f('0x18')]=_[_0x129f('0x19')](config[_0x129f('0x18')],{'host':_0x129f('0x1a'),'port':0x18eb});var socket=require(_0x129f('0x1b'))(new Redis(config[_0x129f('0x18')]));require(_0x129f('0x1c'))['register'](socket);var jayson=require(_0x129f('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x129f('0x1e')][_0x129f('0x1f')]({'port':0x232a});var client9003=jayson[_0x129f('0x1e')][_0x129f('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x2351f2,_0x356386,_0x393d0e){if(_0x393d0e){var _0xe1cbbd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe1cbbd[_0x129f('0x20')](_0x356386)){return _0x2351f2;}else{throw new db[(_0x129f('0x21'))][(_0x129f('0x22'))](_0x129f('0x23'));}}else{return _0x2351f2;}}function respondWithRpcPromise(_0x55eb86,_0x42fed4,_0x115cbb,_0x110152){return new BPromise(function(_0x215c0b,_0x2cbc08){var _0x419f78=_0x110152||client;return _0x419f78[_0x129f('0x24')](_0x55eb86,_0x115cbb)[_0x129f('0x25')](function(_0x3324b2){logger[_0x129f('0x26')](_0x129f('0x27'),_0x42fed4,'request\x20sent');logger[_0x129f('0x28')](_0x129f('0x29'),_0x42fed4,'request\x20sent',JSON[_0x129f('0x2a')](_0x3324b2));if(_0x3324b2[_0x129f('0x2b')]){if(_0x3324b2[_0x129f('0x2b')][_0x129f('0x2c')]===0x1f4){logger[_0x129f('0x2b')](_0x129f('0x27'),_0x42fed4,_0x3324b2[_0x129f('0x2b')]['message']);return _0x2cbc08(_0x3324b2[_0x129f('0x2b')]['message']);}logger[_0x129f('0x2b')](_0x129f('0x27'),_0x42fed4,_0x3324b2[_0x129f('0x2b')][_0x129f('0x2d')]);return _0x215c0b(_0x3324b2['error'][_0x129f('0x2d')]);}else{logger[_0x129f('0x26')](_0x129f('0x27'),_0x42fed4,_0x129f('0x2e'));_0x215c0b(_0x3324b2[_0x129f('0x2f')][_0x129f('0x2d')]);}})[_0x129f('0x30')](function(_0x565754){logger[_0x129f('0x2b')](_0x129f('0x27'),_0x42fed4,_0x565754);_0x2cbc08(_0x565754);});});}function respondWithStatusCode(_0x2d6f87,_0x2b89b2){_0x2b89b2=_0x2b89b2||0xcc;return function(_0x500424){if(_0x500424){return _0x2d6f87['sendStatus'](_0x2b89b2);}return _0x2d6f87[_0x129f('0x31')](_0x2b89b2)[_0x129f('0x32')]();};}function respondWithResult(_0x14c0bf,_0x1393be){_0x1393be=_0x1393be||0xc8;return function(_0x2a33d4){if(_0x2a33d4){return _0x14c0bf['status'](_0x1393be)[_0x129f('0x33')](_0x2a33d4);}};}function respondWithFilteredResult(_0x83804d,_0x542927){return function(_0x3e756f){if(_0x3e756f){var _0x55dcb9=_0x3e756f[_0x129f('0x34')],_0x59e8ca=_0x542927[_0x129f('0x35')],_0x2e1a35=_0x542927[_0x129f('0x35')]+_0x542927[_0x129f('0x36')],_0xd2e1ae;if(_0x2e1a35>=_0x55dcb9){_0x2e1a35=_0x55dcb9;_0xd2e1ae=0xc8;}else{_0xd2e1ae=0xce;}_0x83804d[_0x129f('0x31')](_0xd2e1ae);return _0x83804d[_0x129f('0x37')](_0x129f('0x38'),_0x59e8ca+'-'+_0x2e1a35+'/'+_0x55dcb9)[_0x129f('0x33')](_0x3e756f);}return null;};}function patchUpdates(_0x218adf){return function(_0x4bf491){try{jsonpatch[_0x129f('0x39')](_0x4bf491,_0x218adf,!![]);}catch(_0x56f761){return BPromise[_0x129f('0x3a')](_0x56f761);}return _0x4bf491[_0x129f('0x3b')]();};}function saveUpdates(_0xffa910,_0x3cc5bf){return function(_0x329a0e){if(_0x329a0e){return _0x329a0e['update'](_0xffa910)['then'](function(_0xe019c8){return _0xe019c8;});}return null;};}function removeEntity(_0x49250f,_0x4a9aa4){return function(_0xe44342){if(_0xe44342){return _0xe44342[_0x129f('0x3c')]()['then'](function(){var _0x1abe91=_0xe44342[_0x129f('0x3d')]({'plain':!![]});var _0x3400c6=_0x129f('0x3e');return db[_0x129f('0x3f')][_0x129f('0x3c')]({'where':{'type':_0x3400c6,'resourceId':_0x1abe91['id']}})['then'](function(){return _0xe44342;});})[_0x129f('0x25')](function(){_0x49250f[_0x129f('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d94c0,_0x3e3230){return function(_0x41f944){if(!_0x41f944){_0x2d94c0['sendStatus'](0x194);}return _0x41f944;};}function handleError(_0x37ed2e,_0x3cddfe){_0x3cddfe=_0x3cddfe||0x1f4;return function(_0x191d09){logger[_0x129f('0x2b')](_0x191d09['stack']);if(_0x191d09[_0x129f('0x40')]){delete _0x191d09[_0x129f('0x40')];}_0x37ed2e[_0x129f('0x31')](_0x3cddfe)[_0x129f('0x41')](_0x191d09);};}exports[_0x129f('0x42')]=function(_0x3f6730,_0x3a2423){var _0x234d09={'include':[{'model':db[_0x129f('0x43')],'as':_0x129f('0x44')}]},_0x515f27={},_0x4018ca={'count':0x0,'rows':[]};var _0x2000a0=_[_0x129f('0x45')](db['ChatWebsite'][_0x129f('0x46')],function(_0x2f9edc){return{'name':_0x2f9edc['fieldName'],'type':_0x2f9edc[_0x129f('0x47')][_0x129f('0x48')]};});_0x515f27['model']=_[_0x129f('0x45')](_0x2000a0,'name');_0x515f27[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x3f6730[_0x129f('0x49')]);_0x515f27[_0x129f('0x4b')]=_[_0x129f('0x4c')](_0x515f27['model'],_0x515f27[_0x129f('0x49')]);_0x234d09[_0x129f('0x4d')]=_['intersection'](_0x515f27[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x3f6730[_0x129f('0x49')][_0x129f('0x4f')]));_0x234d09[_0x129f('0x4d')]=_0x234d09['attributes'][_0x129f('0x50')]?_0x234d09[_0x129f('0x4d')]:_0x515f27['model'];if(!_0x3f6730[_0x129f('0x49')][_0x129f('0x51')](_0x129f('0x52'))){_0x234d09['limit']=qs[_0x129f('0x36')](_0x3f6730[_0x129f('0x49')][_0x129f('0x36')]);_0x234d09[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x3f6730[_0x129f('0x49')][_0x129f('0x35')]);}_0x234d09[_0x129f('0x53')]=qs[_0x129f('0x54')](_0x3f6730[_0x129f('0x49')][_0x129f('0x54')]);_0x234d09[_0x129f('0x55')]=qs[_0x129f('0x4b')](_['pick'](_0x3f6730[_0x129f('0x49')],_0x515f27[_0x129f('0x4b')]),_0x2000a0);if(_0x3f6730[_0x129f('0x49')][_0x129f('0x56')]){_0x234d09[_0x129f('0x55')]=_[_0x129f('0x57')](_0x234d09[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0x2000a0,function(_0x3e8407){if(_0x3e8407[_0x129f('0x47')]!==_0x129f('0x58')){var _0x1eedef={};_0x1eedef[_0x3e8407[_0x129f('0x40')]]={'$like':'%'+_0x3f6730['query'][_0x129f('0x56')]+'%'};return _0x1eedef;}})});}_0x234d09=_[_0x129f('0x57')]({},_0x234d09,_0x3f6730['options']);var _0x2b6872={'where':_0x234d09['where']};return db[_0x129f('0x59')]['count'](_0x2b6872)[_0x129f('0x25')](function(_0x165f0f){_0x4018ca[_0x129f('0x34')]=_0x165f0f;if(_0x3f6730[_0x129f('0x49')][_0x129f('0x5a')]){_0x234d09[_0x129f('0x5b')]=[{'all':!![]}];}return db[_0x129f('0x59')][_0x129f('0x5c')](_0x234d09);})[_0x129f('0x25')](function(_0x3cc056){_0x4018ca['rows']=_0x3cc056;return _0x4018ca;})[_0x129f('0x25')](respondWithFilteredResult(_0x3a2423,_0x234d09))[_0x129f('0x30')](handleError(_0x3a2423,null));};exports[_0x129f('0x5d')]=function(_0x4a20cc,_0x568a42){var _0x564da5={'raw':![],'where':{'id':_0x4a20cc[_0x129f('0x5e')]['id']},'include':[{'model':db[_0x129f('0x43')],'as':_0x129f('0x44')}]},_0x2fe7f3={};_0x2fe7f3[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0x59')]['rawAttributes']);_0x2fe7f3[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x4a20cc[_0x129f('0x49')]);_0x2fe7f3['filters']=_[_0x129f('0x4c')](_0x2fe7f3['model'],_0x2fe7f3[_0x129f('0x49')]);_0x564da5[_0x129f('0x4d')]=_[_0x129f('0x4c')](_0x2fe7f3['model'],qs['fields'](_0x4a20cc[_0x129f('0x49')]['fields']));_0x564da5[_0x129f('0x4d')]=_0x564da5['attributes'][_0x129f('0x50')]?_0x564da5['attributes']:_0x2fe7f3[_0x129f('0x4e')];if(_0x4a20cc[_0x129f('0x49')]['includeAll']){_0x564da5['include']=[{'all':!![]}];}_0x564da5=_[_0x129f('0x57')]({},_0x564da5,_0x4a20cc[_0x129f('0x5f')]);return db[_0x129f('0x59')]['find'](_0x564da5)[_0x129f('0x25')](handleEntityNotFound(_0x568a42,null))[_0x129f('0x25')](respondWithResult(_0x568a42,null))[_0x129f('0x30')](handleError(_0x568a42,null));};exports['create']=function(_0x3fab64,_0x3307e5){return db[_0x129f('0x59')][_0x129f('0x60')](_0x3fab64['body'],{})[_0x129f('0x25')](function(_0x28afcc){var _0x558db7=_0x3fab64[_0x129f('0x61')][_0x129f('0x3d')]({'plain':!![]});if(!_0x558db7)throw new Error(_0x129f('0x62'));if(_0x558db7[_0x129f('0x63')]==='user'){var _0x4743e7=_0x28afcc[_0x129f('0x3d')]({'plain':!![]});var _0x3b3892=_0x129f('0x3e');return db['UserProfileSection']['find']({'where':{'name':_0x3b3892,'userProfileId':_0x558db7[_0x129f('0x64')]},'raw':!![]})[_0x129f('0x25')](function(_0x4ce2c3){if(_0x4ce2c3&&_0x4ce2c3[_0x129f('0x65')]===0x0){return db[_0x129f('0x3f')][_0x129f('0x60')]({'name':_0x4743e7[_0x129f('0x40')],'resourceId':_0x4743e7['id'],'type':_0x4ce2c3[_0x129f('0x40')],'sectionId':_0x4ce2c3['id']},{})[_0x129f('0x25')](function(){return _0x28afcc;});}else{return _0x28afcc;}})[_0x129f('0x30')](function(_0x1eaaf2){logger[_0x129f('0x2b')](_0x129f('0x66'),_0x1eaaf2);throw _0x1eaaf2;});}return _0x28afcc;})[_0x129f('0x25')](respondWithResult(_0x3307e5,0xc9))['catch'](handleError(_0x3307e5,null));};exports[_0x129f('0x67')]=function(_0x37a3d9,_0x58858e){if(_0x37a3d9[_0x129f('0x68')]['id']){delete _0x37a3d9[_0x129f('0x68')]['id'];}return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x37a3d9[_0x129f('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x129f('0x44')}]})[_0x129f('0x25')](handleEntityNotFound(_0x58858e,null))['then'](saveUpdates(_0x37a3d9[_0x129f('0x68')],null))['then'](respondWithResult(_0x58858e,null))[_0x129f('0x30')](handleError(_0x58858e,null));};exports[_0x129f('0x3c')]=function(_0x41f812,_0x33196b){return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x41f812[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x33196b,null))[_0x129f('0x25')](removeEntity(_0x33196b,null))[_0x129f('0x30')](handleError(_0x33196b,null));};exports['describe']=function(_0x4be1b1,_0x527f96){return db[_0x129f('0x59')]['describe']()[_0x129f('0x25')](respondWithResult(_0x527f96,null))[_0x129f('0x30')](handleError(_0x527f96,null));};exports[_0x129f('0x6a')]=function(_0xd17aa4,_0x319c7c,_0x3911ec){if(_0xd17aa4[_0x129f('0x68')]['id']){delete _0xd17aa4[_0x129f('0x68')]['id'];}return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0xd17aa4['params']['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x319c7c,null))[_0x129f('0x25')](function(_0x530f9c){if(_0x530f9c){_0xd17aa4[_0x129f('0x68')][_0x129f('0x6b')]=_0x530f9c['id'];return db[_0x129f('0x6c')][_0x129f('0x60')](_0xd17aa4['body']);}})[_0x129f('0x25')](respondWithResult(_0x319c7c,null))[_0x129f('0x30')](handleError(_0x319c7c,null));};exports[_0x129f('0x6d')]=function(_0x3a9cfa,_0x5ab62a,_0x2b3e48){var _0xb951f6={'raw':![],'where':{}};var _0x2464d1={};var _0x30a839={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x129f('0x6e')]({'where':{'id':_0x3a9cfa['params']['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x5ab62a,null))[_0x129f('0x25')](function(_0x226eff){if(_0x226eff){_0x2464d1[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0x6c')]['rawAttributes']);_0x2464d1['query']=_[_0x129f('0x4a')](_0x3a9cfa[_0x129f('0x49')]);_0x2464d1[_0x129f('0x4b')]=_[_0x129f('0x4c')](_0x2464d1[_0x129f('0x4e')],_0x2464d1[_0x129f('0x49')]);_0xb951f6['attributes']=_[_0x129f('0x4c')](_0x2464d1[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x3a9cfa['query'][_0x129f('0x4f')]));_0xb951f6[_0x129f('0x4d')]=_0xb951f6[_0x129f('0x4d')][_0x129f('0x50')]?_0xb951f6[_0x129f('0x4d')]:_0x2464d1[_0x129f('0x4e')];if(!_0x3a9cfa['query']['hasOwnProperty'](_0x129f('0x52'))){_0xb951f6[_0x129f('0x36')]=qs[_0x129f('0x36')](_0x3a9cfa[_0x129f('0x49')][_0x129f('0x36')]);_0xb951f6['offset']=qs['offset'](_0x3a9cfa[_0x129f('0x49')]['offset']);}_0xb951f6['order']=qs[_0x129f('0x54')](_0x3a9cfa[_0x129f('0x49')]['sort']);_0xb951f6[_0x129f('0x55')]=qs['filters'](_['pick'](_0x3a9cfa[_0x129f('0x49')],_0x2464d1[_0x129f('0x4b')]));_0xb951f6[_0x129f('0x55')][_0x129f('0x6b')]=_0x226eff['id'];if(_0x3a9cfa[_0x129f('0x49')][_0x129f('0x56')]){_0xb951f6[_0x129f('0x55')]=_[_0x129f('0x57')](_0xb951f6[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0xb951f6[_0x129f('0x4d')],function(_0x24f629){var _0x480925={};_0x480925[_0x24f629]={'$like':'%'+_0x3a9cfa['query']['filter']+'%'};return _0x480925;})});}_0xb951f6=_[_0x129f('0x57')]({},_0xb951f6,_0x3a9cfa[_0x129f('0x5f')]);return db[_0x129f('0x6c')][_0x129f('0x34')]({'where':_0xb951f6['where']})[_0x129f('0x25')](function(_0x5d749e){_0x30a839['count']=_0x5d749e;if(_0x3a9cfa['query'][_0x129f('0x5a')]){_0xb951f6[_0x129f('0x5b')]=[{'all':!![]}];}return db[_0x129f('0x6c')][_0x129f('0x5c')](_0xb951f6);})[_0x129f('0x25')](function(_0x5010d5){_0x30a839['rows']=_0x5010d5;return _0x30a839;});}})['then'](respondWithFilteredResult(_0x5ab62a,_0xb951f6))[_0x129f('0x30')](handleError(_0x5ab62a,null));};exports[_0x129f('0x6f')]=function(_0x5567df,_0x12673f,_0x25f0e8){return db['ChatWebsite'][_0x129f('0x69')]({'where':{'id':_0x5567df[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x12673f,null))['then'](function(_0x29fe4e){if(_0x29fe4e){return _0x29fe4e[_0x129f('0x6f')](_0x5567df[_0x129f('0x49')][_0x129f('0x70')]);}})['then'](respondWithStatusCode(_0x12673f,null))[_0x129f('0x30')](handleError(_0x12673f,null));};exports[_0x129f('0x71')]=function(_0xd2f050,_0x49c6c8,_0x1af6ff){if(_0xd2f050[_0x129f('0x68')]['id']){delete _0xd2f050['body']['id'];}return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0xd2f050[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x49c6c8,null))['then'](function(_0x350335){if(_0x350335){_0xd2f050[_0x129f('0x68')][_0x129f('0x6b')]=_0x350335['id'];return db[_0x129f('0x72')][_0x129f('0x60')](_0xd2f050[_0x129f('0x68')]);}})['then'](respondWithResult(_0x49c6c8,null))[_0x129f('0x30')](handleError(_0x49c6c8,null));};exports['getAnswers']=function(_0x188398,_0x324dae,_0x5e6af5){var _0x1b9e33={'raw':![],'where':{}};var _0x595a00={};var _0x26724a={'count':0x0,'rows':[]};return db[_0x129f('0x59')][_0x129f('0x6e')]({'where':{'id':_0x188398[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x324dae,null))[_0x129f('0x25')](function(_0x2c2c1c){if(_0x2c2c1c){_0x595a00['model']=_[_0x129f('0x4a')](db[_0x129f('0x72')][_0x129f('0x46')]);_0x595a00[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x188398[_0x129f('0x49')]);_0x595a00['filters']=_[_0x129f('0x4c')](_0x595a00[_0x129f('0x4e')],_0x595a00[_0x129f('0x49')]);_0x1b9e33[_0x129f('0x4d')]=_['intersection'](_0x595a00[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x188398[_0x129f('0x49')][_0x129f('0x4f')]));_0x1b9e33[_0x129f('0x4d')]=_0x1b9e33[_0x129f('0x4d')]['length']?_0x1b9e33[_0x129f('0x4d')]:_0x595a00[_0x129f('0x4e')];if(!_0x188398[_0x129f('0x49')][_0x129f('0x51')](_0x129f('0x52'))){_0x1b9e33[_0x129f('0x36')]=qs[_0x129f('0x36')](_0x188398[_0x129f('0x49')]['limit']);_0x1b9e33[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x188398['query'][_0x129f('0x35')]);}_0x1b9e33[_0x129f('0x53')]=qs[_0x129f('0x54')](_0x188398['query'][_0x129f('0x54')]);_0x1b9e33['where']=qs[_0x129f('0x4b')](_['pick'](_0x188398[_0x129f('0x49')],_0x595a00['filters']));_0x1b9e33[_0x129f('0x55')][_0x129f('0x6b')]=_0x2c2c1c['id'];if(_0x188398[_0x129f('0x49')]['filter']){_0x1b9e33[_0x129f('0x55')]=_['merge'](_0x1b9e33[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0x1b9e33[_0x129f('0x4d')],function(_0x42cb27){var _0x594bee={};_0x594bee[_0x42cb27]={'$like':'%'+_0x188398[_0x129f('0x49')][_0x129f('0x56')]+'%'};return _0x594bee;})});}_0x1b9e33=_[_0x129f('0x57')]({},_0x1b9e33,_0x188398[_0x129f('0x5f')]);return db[_0x129f('0x72')][_0x129f('0x34')]({'where':_0x1b9e33['where']})[_0x129f('0x25')](function(_0x17dc03){_0x26724a[_0x129f('0x34')]=_0x17dc03;if(_0x188398[_0x129f('0x49')][_0x129f('0x5a')]){_0x1b9e33[_0x129f('0x5b')]=[{'all':!![]}];}return db[_0x129f('0x72')]['findAll'](_0x1b9e33);})[_0x129f('0x25')](function(_0x501aaa){_0x26724a[_0x129f('0x73')]=_0x501aaa;return _0x26724a;});}})[_0x129f('0x25')](respondWithFilteredResult(_0x324dae,_0x1b9e33))['catch'](handleError(_0x324dae,null));};exports[_0x129f('0x74')]=function(_0x3e4519,_0x2fb820,_0x10f5f6){return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x3e4519[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x2fb820,null))[_0x129f('0x25')](function(_0x56c338){if(_0x56c338){return _0x56c338['removeAnswers'](_0x3e4519[_0x129f('0x49')][_0x129f('0x70')]);}})['then'](respondWithStatusCode(_0x2fb820,null))[_0x129f('0x30')](handleError(_0x2fb820,null));};exports['addLogo']=function(_0x22e29c,_0x3ff9bf,_0x37b286){_0x22e29c['body'][_0x129f('0x75')]=_0x22e29c['file'][_0x129f('0x76')];return db[_0x129f('0x59')]['find']({'where':{'id':_0x22e29c['params']['id']}})['then'](handleEntityNotFound(_0x3ff9bf,null))[_0x129f('0x25')](saveUpdates(_0x22e29c[_0x129f('0x68')],null))[_0x129f('0x25')](respondWithResult(_0x3ff9bf,null))[_0x129f('0x30')](handleError(_0x3ff9bf,null));};exports[_0x129f('0x77')]=function(_0x4a9416,_0x2a0fff,_0x37e850){_0x4a9416[_0x129f('0x68')][_0x129f('0x78')]=_0x4a9416['file'][_0x129f('0x76')];return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x4a9416[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2a0fff,null))[_0x129f('0x25')](saveUpdates(_0x4a9416[_0x129f('0x68')],null))[_0x129f('0x25')](respondWithResult(_0x2a0fff,null))[_0x129f('0x30')](handleError(_0x2a0fff,null));};exports[_0x129f('0x79')]=function(_0x282dc8,_0x5ae180,_0x1add9f){_0x282dc8['body']['customerAvatar']=_0x282dc8[_0x129f('0x7a')][_0x129f('0x76')];return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x282dc8[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ae180,null))[_0x129f('0x25')](saveUpdates(_0x282dc8['body'],null))[_0x129f('0x25')](respondWithResult(_0x5ae180,null))['catch'](handleError(_0x5ae180,null));};exports[_0x129f('0x7b')]=function(_0x58eca3,_0x4b2910,_0x591ce8){_0x58eca3[_0x129f('0x68')][_0x129f('0x7c')]=_0x58eca3[_0x129f('0x7a')]['filename'];return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x58eca3[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x4b2910,null))[_0x129f('0x25')](saveUpdates(_0x58eca3[_0x129f('0x68')],null))[_0x129f('0x25')](respondWithResult(_0x4b2910,null))['catch'](handleError(_0x4b2910,null));};exports[_0x129f('0x7d')]=function(_0x5a2229,_0x535a2e,_0x20fe4a){var _0x1d1490=path[_0x129f('0x7e')](config[_0x129f('0x7f')],_0x129f('0x80'));var _0x3c4726={'where':{'id':_0x5a2229[_0x129f('0x5e')]['id']},'attributes':['id',_0x129f('0x75')],'raw':!![]};var _0x560ac8=![];return require(_0x129f('0x81'))['getLicense']()[_0x129f('0x25')](function(_0x1555a2){if(_0x1555a2){_0x560ac8=_0x1555a2['custom'];}})[_0x129f('0x25')](function(){return db[_0x129f('0x59')][_0x129f('0x69')](_0x3c4726);})['then'](handleEntityNotFound(_0x535a2e,null))[_0x129f('0x25')](function(_0x1c57f1){if(_0x1c57f1){if(!_[_0x129f('0x82')](_0x1c57f1[_0x129f('0x75')])){if(fs[_0x129f('0x83')](path['join'](config[_0x129f('0x7f')],_0x129f('0x84'),_0x1c57f1[_0x129f('0x75')]))&&_0x560ac8){_0x1d1490=path[_0x129f('0x7e')](config['root'],_0x129f('0x84'),_0x1c57f1[_0x129f('0x75')]);}}return _0x535a2e[_0x129f('0x85')](_0x1d1490);}})['catch'](handleError(_0x535a2e,null));};exports[_0x129f('0x86')]=function(_0x1288a6,_0x4980ec,_0x100463){var _0x69d2c3=path[_0x129f('0x7e')](config[_0x129f('0x7f')],_0x129f('0x87'));var _0x48e842={'where':{'id':_0x1288a6['params']['id']},'attributes':['id',_0x129f('0x78')],'raw':!![]};return db[_0x129f('0x59')][_0x129f('0x69')](_0x48e842)['then'](handleEntityNotFound(_0x4980ec,null))[_0x129f('0x25')](function(_0xa3be82){if(_0xa3be82){if(!_['isNil'](_0xa3be82[_0x129f('0x78')])){if(fs[_0x129f('0x83')](path[_0x129f('0x7e')](config[_0x129f('0x7f')],'server/files/images/avatars/',_0xa3be82['agentAvatar']))){_0x69d2c3=path[_0x129f('0x7e')](config['root'],_0x129f('0x88'),_0xa3be82[_0x129f('0x78')]);}}return _0x4980ec[_0x129f('0x85')](_0x69d2c3);}})[_0x129f('0x30')](handleError(_0x4980ec,null));};exports['getCustomerAvatar']=function(_0x1c820b,_0x2ba890,_0x2ce6eb){var _0x10fd6b=path['join'](config[_0x129f('0x7f')],'server/files/images/avatars/customer_avatar.png');var _0x376beb={'where':{'id':_0x1c820b[_0x129f('0x5e')]['id']},'attributes':['id',_0x129f('0x89'),_0x129f('0x8a')],'raw':!![]};return db[_0x129f('0x59')][_0x129f('0x69')](_0x376beb)['then'](handleEntityNotFound(_0x2ba890,null))['then'](function(_0x24541f){if(_0x24541f){if(!_[_0x129f('0x82')](_0x24541f['customerAvatar'])){if(fs[_0x129f('0x83')](path[_0x129f('0x7e')](config['root'],'server/files/images/avatars/',_0x24541f['customerAvatar']))&&_0x24541f['showCustomerAvatar']){_0x10fd6b=path['join'](config[_0x129f('0x7f')],'server/files/images/avatars/',_0x24541f[_0x129f('0x89')]);}}return _0x2ba890[_0x129f('0x85')](_0x10fd6b);}})['catch'](handleError(_0x2ba890,null));};exports[_0x129f('0x8b')]=function(_0x982c9d,_0x3492f0,_0x3899f9){var _0x47e0b5=path[_0x129f('0x7e')](config[_0x129f('0x7f')],_0x129f('0x8c'));var _0x39a9ea={'where':{'id':_0x982c9d[_0x129f('0x5e')]['id']},'attributes':['id',_0x129f('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x129f('0x69')](_0x39a9ea)[_0x129f('0x25')](handleEntityNotFound(_0x3492f0,null))[_0x129f('0x25')](function(_0x1bf149){if(_0x1bf149){if(!_[_0x129f('0x82')](_0x1bf149[_0x129f('0x7c')])){if(fs[_0x129f('0x83')](path[_0x129f('0x7e')](config[_0x129f('0x7f')],_0x129f('0x88'),_0x1bf149[_0x129f('0x7c')]))){_0x47e0b5=path[_0x129f('0x7e')](config[_0x129f('0x7f')],_0x129f('0x88'),_0x1bf149[_0x129f('0x7c')]);}}return _0x3492f0[_0x129f('0x85')](_0x47e0b5);}})[_0x129f('0x30')](handleError(_0x3492f0,null));};exports[_0x129f('0x8d')]=function(_0x43d3ae,_0x354c77,_0x46eb35){var _0x51706f=require(_0x129f('0x8e'));var _0x3d6525=new _0x51706f();var _0x1a40f6=_0x3d6525[_0x129f('0x8f')](_0x43d3ae[_0x129f('0x90')]['user-agent'])[_0x129f('0x91')]();var _0x527759={'body':_0x43d3ae[_0x129f('0x68')],'channel':_0x129f('0x92')};var _0x3e07c2=[];var _0x58170c=[];var _0x321852={};var _0x173d65=![];return db[_0x129f('0x93')]['describe']()[_0x129f('0x25')](function(_0x14d39e){if(!_0x14d39e){throw new db[(_0x129f('0x21'))]['ValidationError'](_0x129f('0x94'));}_0x3e07c2=_[_0x129f('0x95')](_[_0x129f('0x4a')](_0x14d39e),[_0x129f('0x96'),'updatedAt']);_0x58170c=_['difference'](_['keys'](_0x14d39e),[_0x129f('0x96'),_0x129f('0x97'),_0x129f('0x98'),_0x129f('0x99')]);if(_0x43d3ae['body']['id']){delete _0x43d3ae[_0x129f('0x68')]['id'];}if(_[_0x129f('0x82')](_0x43d3ae[_0x129f('0x68')][_0x129f('0x9a')])){throw new db[(_0x129f('0x21'))][(_0x129f('0x22'))](_0x129f('0x9b'));}if(_['isNil'](_0x43d3ae['body'][_0x129f('0x68')])||_0x43d3ae['body'][_0x129f('0x68')]===''){throw new db[(_0x129f('0x21'))][(_0x129f('0x22'))](_0x129f('0x9c'));}if(_[_0x129f('0x82')](_0x43d3ae[_0x129f('0x68')][_0x129f('0x9d')])){throw new db[(_0x129f('0x21'))][(_0x129f('0x22'))](_0x129f('0x9e')+_0x58170c);}if(!_[_0x129f('0x9f')](_0x58170c,_0x43d3ae[_0x129f('0x68')]['mapKey'])){throw new db['Sequelize'][(_0x129f('0x22'))](_0x129f('0xa0')+_0x58170c);}_0x321852[_0x43d3ae[_0x129f('0x68')][_0x129f('0x9d')]]=_0x43d3ae[_0x129f('0x68')][_0x129f('0x9a')];})[_0x129f('0x25')](function(){return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x43d3ae[_0x129f('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x129f('0xa1'),'include':[{'model':db['CmContact'],'as':_0x129f('0xa2'),'where':_0x321852,'limit':0x1,'order':[[_0x129f('0x97'),_0x129f('0xa3')]]}]},{'model':db[_0x129f('0xa4')],'as':_0x129f('0xa5')}]});})[_0x129f('0x25')](handleEntityNotFound(_0x354c77,null))['then'](function(_0x59f3de){if(_0x59f3de&&_0x59f3de[_0x129f('0xa1')]){_0x527759[_0x129f('0xa6')]=_0x59f3de;_0x527759[_0x129f('0xa7')]=_0x59f3de[_0x129f('0xa5')];_0x527759['list']=_0x59f3de[_0x129f('0xa1')];_0x527759[_0x129f('0xa7')]=_[_0x129f('0xa8')](_0x527759[_0x129f('0xa7')],[_0x129f('0xa9')],[_0x129f('0xaa')]);if(_0x527759[_0x129f('0xa6')][_0x129f('0xa5')]){delete _0x527759[_0x129f('0xa6')][_0x129f('0xa5')];}if(_0x527759[_0x129f('0xa6')][_0x129f('0xa1')]&&_0x527759[_0x129f('0xa6')][_0x129f('0xa1')][_0x129f('0xa2')]['length']){return _0x527759[_0x129f('0xa6')]['List'][_0x129f('0xa2')][0x0];}var _0x733964=_['defaults'](_0x43d3ae[_0x129f('0x68')],{'firstName':_0x43d3ae[_0x129f('0x68')][_0x129f('0x9a')],'ListId':_0x59f3de[_0x129f('0x99')]});_0x733964[_0x43d3ae[_0x129f('0x68')]['mapKey']]=_0x43d3ae[_0x129f('0x68')][_0x129f('0x9a')];return db[_0x129f('0x93')][_0x129f('0x60')](_0x733964,{'fields':_0x3e07c2,'raw':!![]});}})['then'](handleEntityNotFound(_0x354c77,null))[_0x129f('0x25')](function(_0x2fc7e0){_0x527759[_0x129f('0xab')]=_0x2fc7e0;var _0x448192=_0x43d3ae[_0x129f('0x68')][_0x129f('0xac')];if(_0x43d3ae[_0x129f('0x90')][_0x129f('0xad')]){_0x448192=_0x43d3ae[_0x129f('0x90')]['cf-connecting-ip'];}else if(_0x43d3ae[_0x129f('0x90')][_0x129f('0xae')]){_0x448192=_[_0x129f('0xaf')](_0x43d3ae[_0x129f('0x90')][_0x129f('0xae')][_0x129f('0xb0')](','));}if(_0x2fc7e0){var _0x30e57c={'ContactId':_0x2fc7e0['id'],'ChatWebsiteId':_0x43d3ae[_0x129f('0x5e')]['id'],'from':(_0x2fc7e0[_0x129f('0xb1')]||'')+'\x20'+(_0x2fc7e0[_0x129f('0xb2')]||''),'customerIp':_0x448192,'customerPort':_0x43d3ae[_0x129f('0x90')][_0x129f('0xb3')]?_0x43d3ae[_0x129f('0x90')][_0x129f('0xb3')]:null,'referer':_0x43d3ae[_0x129f('0x68')][_0x129f('0xb4')],'browserName':_0x1a40f6[_0x129f('0xb5')][_0x129f('0x40')]&&_0x1a40f6[_0x129f('0xb5')][_0x129f('0xb6')]?util[_0x129f('0xb7')](_0x129f('0xb8'),_0x1a40f6[_0x129f('0xb5')][_0x129f('0x40')],_0x1a40f6[_0x129f('0xb5')]['version']):'unknown','browserVersion':_0x1a40f6[_0x129f('0xb5')]['version']||'unknown','osName':util['format'](_0x129f('0xb8'),_0x1a40f6['os'][_0x129f('0x40')],_0x1a40f6['os'][_0x129f('0xb6')]),'osVersion':_0x1a40f6['os'][_0x129f('0xb6')],'deviceModel':_0x1a40f6['device'][_0x129f('0x4e')]&&_0x1a40f6[_0x129f('0xb9')][_0x129f('0xba')]?util[_0x129f('0xb7')]('%s\x20%s\x20%s',_0x1a40f6[_0x129f('0xb9')][_0x129f('0x4e')],_0x1a40f6[_0x129f('0xb9')][_0x129f('0xba')],_0x1a40f6[_0x129f('0xb9')]['type']):null,'deviceVendor':_0x1a40f6[_0x129f('0xb9')][_0x129f('0xba')],'deviceType':_0x1a40f6[_0x129f('0xb9')][_0x129f('0x47')],'formData':JSON[_0x129f('0x2a')](_0x43d3ae[_0x129f('0x68')])};var _0xae59d2={'ChatWebsiteId':_0x43d3ae['params']['id'],'closed':![]};if(_0x43d3ae[_0x129f('0x68')][_0x129f('0xbb')]){_0xae59d2[_0x129f('0xbb')]=_0x43d3ae['body'][_0x129f('0xbb')];return db['ChatInteraction']['find']({'where':_0xae59d2})[_0x129f('0x25')](function(_0x360979){if(_0x360979){return[_0x360979,![]];}_0x30e57c[_0x129f('0xbb')]=_0x43d3ae[_0x129f('0x68')][_0x129f('0xbb')];_0x30e57c[_0x129f('0xbc')]=_0x43d3ae[_0x129f('0x68')][_0x129f('0xbc')];return db[_0x129f('0xbd')][_0x129f('0x60')](_0x30e57c)[_0x129f('0x25')](function(_0x4b6fac){return[_0x4b6fac,!![]];});});}_0xae59d2[_0x129f('0xbe')]=_0x2fc7e0['id'];if(_0x43d3ae['body'][_0x129f('0xbf')]&&_0x43d3ae[_0x129f('0x68')][_0x129f('0xbf')]['id']){_0xae59d2['id']=_0x43d3ae['body'][_0x129f('0xbf')]['id'];return db[_0x129f('0xbd')][_0x129f('0x69')]({'where':_0xae59d2})[_0x129f('0x25')](function(_0xf30bee){if(_0xf30bee){return[_0xf30bee,![]];}return db[_0x129f('0xbd')]['create'](_0x30e57c)[_0x129f('0x25')](function(_0x476f61){return[_0x476f61,!![]];});});}return db[_0x129f('0xbd')]['create'](_0x30e57c)['then'](function(_0x353dab){return[_0x353dab,!![]];});}})['spread'](function(_0xa5fe2c,_0x7d4f73){if(_0xa5fe2c){_0x173d65=_0x7d4f73;if(!_0x7d4f73){var _0x2ed717={'from':(_0x527759['contact'][_0x129f('0xb1')]||'')+'\x20'+(_0x527759[_0x129f('0xab')][_0x129f('0xb2')]||'')};if(_0x43d3ae['body'][_0x129f('0xbb')]&&_0x43d3ae[_0x129f('0x68')]['messageId']&&_0x43d3ae[_0x129f('0x68')][_0x129f('0xbb')]!=_0x43d3ae[_0x129f('0x68')][_0x129f('0xc0')]){_0x2ed717[_0x129f('0xbb')]=_0x43d3ae[_0x129f('0x68')][_0x129f('0xc0')];}return _0xa5fe2c[_0x129f('0x67')](_0x2ed717);}else{return _0xa5fe2c;}}})['then'](function(_0x2b171d){_0x527759[_0x129f('0xbf')]=_0x2b171d[_0x129f('0x3d')]({'plain':!![]});_0x527759[_0x129f('0xbf')][_0x129f('0xc1')]=_0x173d65;if(_0x527759['interaction']['created']){if(_0x527759[_0x129f('0xa6')][_0x129f('0xc2')]){_0x527759[_0x129f('0xa7')][_0x129f('0xc3')]({'id':0x0,'priority':_0x527759[_0x129f('0xa7')][_0x129f('0x50')]+0x1,'app':'close','appdata':_0x129f('0xc4'),'interval':_0x129f('0xc5')});}}return db[_0x129f('0xc6')]['create']({'body':_0x43d3ae[_0x129f('0x68')]['body'],'ChatWebsiteId':_0x43d3ae[_0x129f('0x5e')]['id'],'ChatInteractionId':_0x2b171d['id'],'direction':'in','ContactId':_0x527759[_0x129f('0xab')]['id'],'AttachmentId':_0x43d3ae[_0x129f('0x68')]['AttachmentId']});})[_0x129f('0x25')](function(_0xa884ac){_0x527759[_0x129f('0x2d')]=_0xa884ac;if(_0x527759[_0x129f('0xbf')]['UserId']){return db[_0x129f('0xc7')]['find']({'attributes':['id',_0x129f('0x40')],'where':{'id':_0x527759[_0x129f('0xbf')][_0x129f('0xc8')]}})[_0x129f('0x25')](function(_0x5ed724){if(_0x5ed724){_0x527759[_0x129f('0xa7')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ed724[_0x129f('0x40')]+','+(_0x527759[_0x129f('0xa6')][_0x129f('0xc9')]||0xa),'interval':'*,*,*,*'});_0x527759[_0x129f('0xca')]=!![];}return respondWithRpcPromise(_0x129f('0xcb'),_0x129f('0xcc'),_0x527759);});}return respondWithRpcPromise('Start',_0x129f('0xcc'),_0x527759);})[_0x129f('0x25')](function(_0x3a51c5){respondWithRpcPromise(_0x129f('0xcd'),_0x129f('0xcd'),{'event':_0x129f('0x8d'),'message':_0x3a51c5},client9002);return _0x3a51c5;})[_0x129f('0x25')](respondWithResult(_0x354c77,null))[_0x129f('0x30')](handleError(_0x354c77,null));};exports['offline']=function(_0x234ea0,_0x14f574,_0x2e5aaa){var _0x50507e,_0x2a60ef,_0x4b33b9;var _0x343fcf=[];var _0x451b60=[];var _0x238623={};return db[_0x129f('0x93')]['describe']()[_0x129f('0x25')](function(_0x1b4c86){if(!_0x1b4c86){throw new db['Sequelize'][(_0x129f('0x22'))](_0x129f('0x94'));}_0x451b60=_[_0x129f('0x95')](_['keys'](_0x1b4c86),[_0x129f('0x96'),_0x129f('0x97')]);_0x343fcf=_[_0x129f('0x95')](_['keys'](_0x1b4c86),[_0x129f('0x96'),'updatedAt',_0x129f('0x98'),_0x129f('0x99')]);if(_0x234ea0[_0x129f('0x68')]['id']){delete _0x234ea0['body']['id'];}if(_[_0x129f('0x82')](_0x234ea0['body'][_0x129f('0x9a')])){throw _0x14f574[_0x129f('0x31')](0x1f4)['send'](new db['Sequelize'][(_0x129f('0x22'))](_0x129f('0x9b')));}if(_[_0x129f('0x82')](_0x234ea0[_0x129f('0x68')]['body'])||_0x234ea0[_0x129f('0x68')][_0x129f('0x68')]===''){throw _0x14f574['status'](0x1f4)[_0x129f('0x41')](new db[(_0x129f('0x21'))]['ValidationError'](_0x129f('0x9c')));}if(_[_0x129f('0x82')](_0x234ea0['body'][_0x129f('0xce')])){throw _0x14f574['status'](0x1f4)[_0x129f('0x41')](new db[(_0x129f('0x21'))][(_0x129f('0x22'))](_0x129f('0xcf')+_0x343fcf));}if(!_['includes'](_0x343fcf,_0x234ea0['body']['mapKeyOffline'])){throw _0x14f574[_0x129f('0x31')](0x1f4)[_0x129f('0x41')](new db['Sequelize']['ValidationError'](_0x129f('0xd0')+_0x343fcf));}_0x238623[_0x234ea0['body']['mapKeyOffline']]=_0x234ea0[_0x129f('0x68')][_0x129f('0x9a')];})[_0x129f('0x25')](function(){return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x234ea0[_0x129f('0x5e')]['id']},'include':[{'model':db[_0x129f('0xd1')],'as':_0x129f('0xa1')}]});})[_0x129f('0x25')](handleEntityNotFound(_0x14f574,null))['then'](function(_0x1ee36a){if(_0x1ee36a&&_0x1ee36a[_0x129f('0xa1')]){_0x2a60ef=_0x1ee36a;var _0x54f5da=_[_0x129f('0x19')](_0x234ea0[_0x129f('0x68')],{'firstName':_0x234ea0[_0x129f('0x68')][_0x129f('0x9a')],'phone':_0x234ea0[_0x129f('0x68')][_0x129f('0x9a')],'ListId':_0x1ee36a[_0x129f('0x99')]});_0x54f5da[_0x234ea0[_0x129f('0x68')][_0x129f('0xce')]]=_0x234ea0[_0x129f('0x68')]['from'];return db[_0x129f('0x93')]['findOrCreate']({'where':_0x238623,'defaults':_0x54f5da});}})[_0x129f('0xd2')](function(_0x6246fc){if(_0x6246fc){_0x4b33b9=_0x6246fc;var _0x27cdd2=fs[_0x129f('0xd3')](path[_0x129f('0x7e')](config['root'],'server/files/templates/chatOfflineMessage.ejs'),_0x129f('0xd4'));var _0x29631c=ejs[_0x129f('0xd5')](_0x27cdd2,{'body':_[_0x129f('0xd6')](_0x234ea0[_0x129f('0x68')][_0x129f('0x68')]),'bodyTitle':_0x2a60ef['offlineMessageBody']});return db[_0x129f('0xd7')][_0x129f('0x60')]({'body':_0x29631c,'ContactId':_0x6246fc['id'],'ChatWebsiteId':_0x2a60ef['id']});}})[_0x129f('0x25')](function(_0x36e553){if(_0x36e553){_0x50507e=_0x36e553;return db[_0x129f('0xd8')][_0x129f('0x6e')]({'where':{'service':!![]},'include':[{'model':db[_0x129f('0xd9')],'as':'Smtp','raw':!![]}]});}})[_0x129f('0x25')](function(_0x55aaf2){if(_0x55aaf2&&_0x55aaf2[_0x129f('0xda')]&&_0x2a60ef[_0x129f('0xdb')]){var _0x5d5500={'tls':{'rejectUnauthorized':![]}};if(_0x55aaf2['Smtp'][_0x129f('0xdc')]){_0x5d5500[_0x129f('0xdc')]=_0x55aaf2[_0x129f('0xda')]['service'];}else{_0x5d5500['host']=_0x55aaf2[_0x129f('0xda')][_0x129f('0xdd')];_0x5d5500[_0x129f('0xde')]=_0x55aaf2[_0x129f('0xda')][_0x129f('0xde')];_0x5d5500['secure']=_0x55aaf2[_0x129f('0xda')][_0x129f('0xdf')];}if(_0x55aaf2[_0x129f('0xda')][_0x129f('0xe0')]){_0x5d5500[_0x129f('0xe1')]={'user':_0x55aaf2[_0x129f('0xda')][_0x129f('0x61')],'pass':_0x55aaf2[_0x129f('0xda')][_0x129f('0xe2')]};}return respondWithRpcPromise(_0x129f('0xe3'),'sendMail',{'account':_0x5d5500,'message':{'from':util['format'](_0x129f('0xe4'),_0x55aaf2[_0x129f('0x40')],_0x55aaf2[_0x129f('0xe5')]||_0x55aaf2[_0x129f('0xda')]['user']),'to':_0x2a60ef[_0x129f('0xdb')],'subject':_0x2a60ef[_0x129f('0xe6')],'text':_0x50507e['body']}},client9003)['then'](function(){return _0x50507e;})[_0x129f('0x30')](function(_0x44e1fe){console[_0x129f('0x2b')](_0x44e1fe);});}})[_0x129f('0x25')](function(){if(_0x50507e){return _0x50507e;}})[_0x129f('0x25')](respondWithResult(_0x14f574,null))[_0x129f('0x30')](handleError(_0x14f574,null));};exports['addInteraction']=function(_0x13d51e,_0x5ee234,_0x368dd8){return db['ChatInteraction'][_0x129f('0x69')]({'where':{'id':_0x13d51e[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5ee234,null))['then'](function(_0x3d2d5d){if(_0x3d2d5d){return _0x3d2d5d['addInteraction'](_0x13d51e['body']['ids'],_['omit'](_0x13d51e[_0x129f('0x68')],[_0x129f('0x70'),'id'])||{});}})['then'](respondWithResult(_0x5ee234,null))[_0x129f('0x30')](handleError(_0x5ee234,null));};exports[_0x129f('0xe7')]=function(_0x3acdcb,_0xb24005,_0x311496){var _0x5bc936={'raw':![],'where':{}};var _0x4467a1={};var _0x3aa30f={'count':0x0,'rows':[]};return db[_0x129f('0x59')][_0x129f('0x6e')]({'where':{'id':_0x3acdcb[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb24005,null))[_0x129f('0x25')](function(_0x3ade7e){if(_0x3ade7e){_0x4467a1[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0xbd')][_0x129f('0x46')]);_0x4467a1['query']=_['keys'](_0x3acdcb[_0x129f('0x49')]);_0x4467a1[_0x129f('0x4b')]=_[_0x129f('0x4c')](_0x4467a1['model'],_0x4467a1[_0x129f('0x49')]);_0x5bc936[_0x129f('0x4d')]=_[_0x129f('0x4c')](_0x4467a1[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x3acdcb[_0x129f('0x49')][_0x129f('0x4f')]));_0x5bc936['attributes']=_0x5bc936[_0x129f('0x4d')][_0x129f('0x50')]?_0x5bc936[_0x129f('0x4d')]:_0x4467a1[_0x129f('0x4e')];if(!_0x3acdcb['query'][_0x129f('0x51')](_0x129f('0x52'))){_0x5bc936['limit']=qs[_0x129f('0x36')](_0x3acdcb[_0x129f('0x49')][_0x129f('0x36')]);_0x5bc936[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x3acdcb[_0x129f('0x49')][_0x129f('0x35')]);}_0x5bc936[_0x129f('0x53')]=qs[_0x129f('0x54')](_0x3acdcb[_0x129f('0x49')][_0x129f('0x54')]);_0x5bc936[_0x129f('0x55')]=qs[_0x129f('0x4b')](_[_0x129f('0xe8')](_0x3acdcb['query'],_0x4467a1[_0x129f('0x4b')]));_0x5bc936['where'][_0x129f('0x6b')]=_0x3ade7e['id'];if(_0x3acdcb['query'][_0x129f('0x56')]){_0x5bc936[_0x129f('0x55')]=_[_0x129f('0x57')](_0x5bc936[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0x5bc936[_0x129f('0x4d')],function(_0x37c123){var _0x3553cb={};_0x3553cb[_0x37c123]={'$like':'%'+_0x3acdcb[_0x129f('0x49')]['filter']+'%'};return _0x3553cb;})});}_0x5bc936=_['merge']({},_0x5bc936,_0x3acdcb[_0x129f('0x5f')]);return db[_0x129f('0xbd')][_0x129f('0x34')]({'where':_0x5bc936['where']})[_0x129f('0x25')](function(_0x316edc){_0x3aa30f['count']=_0x316edc;if(_0x3acdcb[_0x129f('0x49')][_0x129f('0x5a')]){_0x5bc936['include']=[{'model':db['CmContact'],'as':_0x129f('0xe9'),'required':![]},{'model':db[_0x129f('0xc7')],'as':_0x129f('0xea'),'attributes':[_0x129f('0x40'),_0x129f('0xeb'),'internal'],'required':![]},{'model':db[_0x129f('0xec')],'as':'Tags','attributes':['id',_0x129f('0x40'),_0x129f('0xed')],'where':_0x3acdcb['query'][_0x129f('0xee')]?{'id':_0x3acdcb[_0x129f('0x49')][_0x129f('0xee')]}:undefined,'required':_0x3acdcb[_0x129f('0x49')]['tag']?!![]:![]}];}return db[_0x129f('0xbd')][_0x129f('0x5c')](_0x5bc936);})[_0x129f('0x25')](function(_0x55ee8e){_0x3aa30f[_0x129f('0x73')]=_0x55ee8e;return _0x3aa30f;});}})[_0x129f('0x25')](respondWithFilteredResult(_0xb24005,_0x5bc936))[_0x129f('0x30')](handleError(_0xb24005,null));};function iftimePromise(_0x9cda22,_0x45a782){return respondWithRpcPromise(_0x129f('0xef'),_0x129f('0xf0'),{'command':_0x45a782[_0x129f('0xf1')]?util[_0x129f('0xb7')](_0x129f('0xf2'),_0x9cda22[_0x129f('0xf3')],_0x45a782[_0x129f('0xf1')]):util[_0x129f('0xb7')](_0x129f('0xf4'),_0x9cda22[_0x129f('0xf3')])},client9002)[_0x129f('0x25')](function(_0x53f2db){var _0xd8f11=_0x53f2db&&_0x53f2db[_0x129f('0xf5')](_0x129f('0xf6'))>=0x0?!![]:![];logger['info'](_0x129f('0xf7'),_0x45a782['id'],_0x9cda22['id'],_0x9cda22[_0x129f('0xf3')],_0xd8f11?_0x129f('0xf8'):_0x129f('0xf9'),_0x45a782[_0x129f('0xf1')]?_0x45a782[_0x129f('0xf1')]:_0x129f('0xfa'));return _0xd8f11;})[_0x129f('0x30')](function(_0x3ac144){logger[_0x129f('0x2b')](_0x129f('0xf7'),_0x45a782['id'],_0x9cda22['id'],_0x9cda22[_0x129f('0xf3')],util[_0x129f('0xfb')](_0x3ac144,{'showHidden':![],'depth':null}),_0x45a782[_0x129f('0xf1')]?_0x45a782[_0x129f('0xf1')]:'No\x20timezone');return![];});}exports[_0x129f('0xf0')]=function(_0x43bb8f,_0x4290ab,_0x4a0bda){var _0x1125a7=0x0;var _0x1ad2d4=0x0;var _0x20df09=![];var _0x46b759;var _0x7a8334;return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x43bb8f['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x129f('0xfc')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x129f('0x25')](handleEntityNotFound(_0x4290ab,null))[_0x129f('0x25')](function(_0x3cf5d8){if(_0x3cf5d8){_0x46b759=_0x3cf5d8;return _0x3cf5d8[_0x129f('0xfd')]({'raw':!![]});}})['then'](function(_0x7e7406){if(_0x46b759){if(_0x7e7406){_0x7a8334=_0x7e7406;}}return require(_0x129f('0x81'))[_0x129f('0xfe')]();})['then'](function(_0x26dfd1){if(_0x26dfd1){_0x1ad2d4=_0x26dfd1[_0x129f('0xff')];_0x20df09=_0x26dfd1[_0x129f('0x100')];}})[_0x129f('0x25')](function(){return db[_0x129f('0xbd')]['count']({'where':{'closed':![]}});})[_0x129f('0x25')](function(_0x28106c){_0x1125a7=_0x28106c;if(_0x1ad2d4&&_0x28106c>_0x1ad2d4){return db[_0x129f('0x101')][_0x129f('0x6e')]({'where':{'id':0x1}})[_0x129f('0x25')](function(_0x10bfff){if(_0x10bfff){_0x10bfff[_0x129f('0x102')]('chatLicenseExceeded');}});}})[_0x129f('0x25')](function(){if(_0x46b759[_0x129f('0xfc')]&&_0x46b759[_0x129f('0xfc')][_0x129f('0x103')]){var _0x3d36f5=[];for(var _0x144243=0x0;_0x144243<_0x46b759[_0x129f('0xfc')]['Intervals'][_0x129f('0x50')];_0x144243++){var _0x1b8091=_0x46b759[_0x129f('0xfc')][_0x129f('0x103')][_0x144243]['get']({'plain':!![]});_0x3d36f5[_0x129f('0xc3')](iftimePromise(_0x1b8091,_0x46b759));}return BPromise[_0x129f('0x104')](_0x3d36f5)[_0x129f('0x25')](function(_0x4e8151){return _['some'](_0x4e8151);});}else{return!![];}})[_0x129f('0x25')](function(_0x23c5b2){var _0x78dcfb=fs[_0x129f('0xd3')](path[_0x129f('0x7e')](config[_0x129f('0x7f')],'server/files/chat/iframe.js'),_0x129f('0xd4'));var _0x55b038={'remote':_0x46b759[_0x129f('0x105')],'query':querystring[_0x129f('0x2a')](_[_0x129f('0x57')](_0x46b759[_0x129f('0x3d')]({'plain':!![]}),{'customerIp':_0x43bb8f[_0x129f('0x90')][_0x129f('0xae')]||_0x43bb8f['headers'][_0x129f('0x106')]||_0x43bb8f[_0x129f('0x107')]['remoteAddress']||_0x43bb8f['ip'],'referer':_0x43bb8f[_0x129f('0x90')][_0x129f('0xb4')],'openedInteractions':_0x1125a7,'maxInteractions':_0x1ad2d4,'virtual':_0x20df09['virtual'],'online':_0x23c5b2,'custom':_0x20df09}))[_0x129f('0x108')](/'/g,'\x5c\x27')};_0x4290ab[_0x129f('0x41')](ejs['render'](Mustache[_0x129f('0xd5')](_0x78dcfb,_0x55b038),{'proactiveActions':_0x7a8334,'alignment':_0x46b759[_0x129f('0x109')],'verticalAlignment':_0x46b759[_0x129f('0x10a')],'div_color':_0x46b759['color'],'text_color':_0x46b759[_0x129f('0x10b')]}));})['catch'](handleError(_0x4290ab,null));};exports['addApplications']=function(_0x5461cb,_0x227697,_0x10617c){return db[_0x129f('0x59')]['findOne']({'where':{'id':_0x5461cb[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x227697,null))[_0x129f('0x25')](function(_0x470979){if(_0x470979){return db['sequelize'][_0x129f('0x10c')](function(_0x5e2cde){return db['ChatApplication'][_0x129f('0x3c')]({'where':{'ChatWebsiteId':_0x5461cb[_0x129f('0x5e')]['id']},'transaction':_0x5e2cde})[_0x129f('0x25')](function(_0x597503){var _0x58e2f6=_[_0x129f('0x45')](_0x5461cb[_0x129f('0x68')],function(_0xdd370a){_0xdd370a[_0x129f('0x6b')]=_0x5461cb[_0x129f('0x5e')]['id'];return _0xdd370a;});return db[_0x129f('0xa4')][_0x129f('0x10d')](_0x58e2f6,{'transaction':_0x5e2cde});});})['then'](function(){return db[_0x129f('0xa4')][_0x129f('0x10e')]({'where':{'ChatWebsiteId':_0x5461cb[_0x129f('0x5e')]['id']},'order':_0x129f('0xa9')});});}})[_0x129f('0x25')](respondWithResult(_0x227697,null))[_0x129f('0x30')](handleError(_0x227697,null));};exports[_0x129f('0x10f')]=function(_0x212d90,_0x45f119,_0x5a5051){var _0x160418={};var _0x38478b={};var _0x19d6f0;var _0x59c884;return db[_0x129f('0x59')][_0x129f('0x6e')]({'where':{'id':_0x212d90[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x45f119,null))[_0x129f('0x25')](function(_0x5e53e0){if(_0x5e53e0){_0x19d6f0=_0x5e53e0;_0x38478b[_0x129f('0x4e')]=_[_0x129f('0x4a')](db['ChatApplication'][_0x129f('0x46')]);_0x38478b['query']=_[_0x129f('0x4a')](_0x212d90[_0x129f('0x49')]);_0x38478b['filters']=_[_0x129f('0x4c')](_0x38478b[_0x129f('0x4e')],_0x38478b[_0x129f('0x49')]);_0x160418[_0x129f('0x4d')]=_[_0x129f('0x4c')](_0x38478b['model'],qs[_0x129f('0x4f')](_0x212d90['query']['fields']));_0x160418['attributes']=_0x160418[_0x129f('0x4d')][_0x129f('0x50')]?_0x160418[_0x129f('0x4d')]:_0x38478b[_0x129f('0x4e')];_0x160418[_0x129f('0x53')]=qs['sort'](_0x212d90['query'][_0x129f('0x54')]);_0x160418[_0x129f('0x55')]=qs['filters'](_[_0x129f('0xe8')](_0x212d90['query'],_0x38478b['filters']));if(_0x212d90[_0x129f('0x49')][_0x129f('0x56')]){_0x160418[_0x129f('0x55')]=_[_0x129f('0x57')](_0x160418['where'],{'$or':_[_0x129f('0x45')](_0x160418[_0x129f('0x4d')],function(_0x19e541){var _0x54f66d={};_0x54f66d[_0x19e541]={'$like':'%'+_0x212d90['query'][_0x129f('0x56')]+'%'};return _0x54f66d;})});}_0x160418=_[_0x129f('0x57')]({},_0x160418,_0x212d90['options']);return _0x19d6f0['getApplications'](_0x160418);}})['then'](function(_0x501757){if(_0x501757){_0x59c884=_0x501757[_0x129f('0x50')];if(!_0x212d90[_0x129f('0x49')][_0x129f('0x51')]('nolimit')){_0x160418[_0x129f('0x36')]=qs['limit'](_0x212d90['query'][_0x129f('0x36')]);_0x160418[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x212d90[_0x129f('0x49')]['offset']);}return _0x19d6f0[_0x129f('0x10f')](_0x160418);}})[_0x129f('0x25')](function(_0x2a874d){if(_0x2a874d){return _0x2a874d?{'count':_0x59c884,'rows':_0x2a874d}:null;}})[_0x129f('0x25')](respondWithResult(_0x45f119,null))['catch'](handleError(_0x45f119,null));};exports[_0x129f('0x110')]=function(_0x143528,_0x292da3,_0x1bbbc3){return db[_0x129f('0x111')][_0x129f('0x69')]({'where':{'id':_0x143528[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x292da3,null))[_0x129f('0x25')](function(_0x4a4a4f){if(_0x4a4a4f){return _0x4a4a4f['addProactiveActions'](_0x143528[_0x129f('0x68')]['ids'],_['omit'](_0x143528[_0x129f('0x68')],[_0x129f('0x70'),'id'])||{});}})[_0x129f('0x25')](respondWithResult(_0x292da3,null))[_0x129f('0x30')](handleError(_0x292da3,null));};exports['getProactiveActions']=function(_0x27b5b0,_0x2bde04,_0x35eca0){var _0x25edf6={};var _0x1178a7={};var _0x1537c0;var _0x5197d6;return db[_0x129f('0x59')][_0x129f('0x6e')]({'where':{'id':_0x27b5b0[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2bde04,null))[_0x129f('0x25')](function(_0x4cb9c0){if(_0x4cb9c0){_0x1537c0=_0x4cb9c0;_0x1178a7[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0x112')][_0x129f('0x46')]);_0x1178a7[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x27b5b0[_0x129f('0x49')]);_0x1178a7[_0x129f('0x4b')]=_[_0x129f('0x4c')](_0x1178a7[_0x129f('0x4e')],_0x1178a7[_0x129f('0x49')]);_0x25edf6[_0x129f('0x4d')]=_['intersection'](_0x1178a7[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x27b5b0['query'][_0x129f('0x4f')]));_0x25edf6[_0x129f('0x4d')]=_0x25edf6[_0x129f('0x4d')][_0x129f('0x50')]?_0x25edf6[_0x129f('0x4d')]:_0x1178a7[_0x129f('0x4e')];_0x25edf6['order']=qs[_0x129f('0x54')](_0x27b5b0[_0x129f('0x49')]['sort']);_0x25edf6[_0x129f('0x55')]=qs['filters'](_[_0x129f('0xe8')](_0x27b5b0[_0x129f('0x49')],_0x1178a7[_0x129f('0x4b')]));if(_0x27b5b0[_0x129f('0x49')][_0x129f('0x56')]){_0x25edf6[_0x129f('0x55')]=_[_0x129f('0x57')](_0x25edf6['where'],{'$or':_[_0x129f('0x45')](_0x25edf6[_0x129f('0x4d')],function(_0x38a14a){var _0x3477eb={};_0x3477eb[_0x38a14a]={'$like':'%'+_0x27b5b0[_0x129f('0x49')][_0x129f('0x56')]+'%'};return _0x3477eb;})});}_0x25edf6=_[_0x129f('0x57')]({},_0x25edf6,_0x27b5b0['options']);return _0x1537c0['getProactiveActions'](_0x25edf6);}})[_0x129f('0x25')](function(_0x7cafff){if(_0x7cafff){_0x5197d6=_0x7cafff[_0x129f('0x50')];if(!_0x27b5b0[_0x129f('0x49')][_0x129f('0x51')](_0x129f('0x52'))){_0x25edf6['limit']=qs[_0x129f('0x36')](_0x27b5b0[_0x129f('0x49')][_0x129f('0x36')]);_0x25edf6[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x27b5b0[_0x129f('0x49')][_0x129f('0x35')]);}return _0x1537c0['getProactiveActions'](_0x25edf6);}})[_0x129f('0x25')](function(_0x25a946){if(_0x25a946){return _0x25a946?{'count':_0x5197d6,'rows':_0x25a946}:null;}})['then'](respondWithResult(_0x2bde04,null))[_0x129f('0x30')](handleError(_0x2bde04,null));};exports['getFields']=function(_0x1a8f73,_0x568796,_0x4d8e9f){var _0x1a763a=_0x1a8f73['query'][_0x129f('0x113')]===_0x129f('0x114')?_0x129f('0x115'):_0x129f('0x116');return db[_0x129f('0x59')][_0x129f('0x69')]({'attributes':['id',_0x1a763a],'where':{'id':_0x1a8f73['params']['id']}})['then'](handleEntityNotFound(_0x568796,null))[_0x129f('0x25')](function(_0x2a201c){if(_0x2a201c){var _0x10ea5a=_0x2a201c[_0x1a763a];var _0x141c03=_0x10ea5a&&_0x10ea5a[_0x129f('0x117')]?_0x10ea5a[_0x129f('0x117')]:[];_0x568796[_0x129f('0x41')]({'fromKey':_[_0x129f('0x82')](_0x10ea5a[_0x129f('0x118')])?undefined:_0x10ea5a[_0x129f('0x118')],'count':_0x141c03[_0x129f('0x50')],'rows':_0x141c03});}})[_0x129f('0x30')](handleError(_0x568796,null));};exports[_0x129f('0x119')]=function(_0x2ee84,_0x375906,_0x4d4317){var _0xb1015e={'raw':![],'where':{}};var _0x3b4332={};var _0x5635c2={'count':0x0,'rows':[]};return db[_0x129f('0x59')]['findOne']({'where':{'id':_0x2ee84[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x375906,null))[_0x129f('0x25')](function(_0x316fd1){if(_0x316fd1){_0x3b4332[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0xd7')][_0x129f('0x46')]);_0x3b4332[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x2ee84[_0x129f('0x49')]);_0x3b4332[_0x129f('0x4b')]=_[_0x129f('0x4c')](_0x3b4332[_0x129f('0x4e')],_0x3b4332[_0x129f('0x49')]);_0xb1015e[_0x129f('0x4d')]=_[_0x129f('0x4c')](_0x3b4332[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x2ee84['query'][_0x129f('0x4f')]));_0xb1015e[_0x129f('0x4d')]=_0xb1015e[_0x129f('0x4d')][_0x129f('0x50')]?_0xb1015e[_0x129f('0x4d')]:_0x3b4332[_0x129f('0x4e')];if(!_0x2ee84[_0x129f('0x49')][_0x129f('0x51')](_0x129f('0x52'))){_0xb1015e[_0x129f('0x36')]=qs[_0x129f('0x36')](_0x2ee84[_0x129f('0x49')][_0x129f('0x36')]);_0xb1015e[_0x129f('0x35')]=qs[_0x129f('0x35')](_0x2ee84[_0x129f('0x49')][_0x129f('0x35')]);}_0xb1015e[_0x129f('0x53')]=qs['sort'](_0x2ee84['query'][_0x129f('0x54')]);_0xb1015e[_0x129f('0x55')]=qs[_0x129f('0x4b')](_[_0x129f('0xe8')](_0x2ee84[_0x129f('0x49')],_0x3b4332[_0x129f('0x4b')]));_0xb1015e[_0x129f('0x55')][_0x129f('0x6b')]=_0x316fd1['id'];if(_0x2ee84[_0x129f('0x49')][_0x129f('0x56')]){_0xb1015e[_0x129f('0x55')]=_[_0x129f('0x57')](_0xb1015e[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0xb1015e[_0x129f('0x4d')],function(_0x5b1d16){var _0x1c80eb={};_0x1c80eb[_0x5b1d16]={'$like':'%'+_0x2ee84[_0x129f('0x49')][_0x129f('0x56')]+'%'};return _0x1c80eb;})});}_0xb1015e=_[_0x129f('0x57')]({},_0xb1015e,_0x2ee84['options']);return db[_0x129f('0xd7')][_0x129f('0x34')]({'where':_0xb1015e[_0x129f('0x55')]})[_0x129f('0x25')](function(_0xfac7cf){_0x5635c2['count']=_0xfac7cf;if(_0x2ee84[_0x129f('0x49')][_0x129f('0x5a')]){_0xb1015e[_0x129f('0x5b')]=[{'all':!![]}];}else{_0xb1015e[_0x129f('0x5b')]=[{'model':db[_0x129f('0x93')],'as':_0x129f('0xe9'),'required':![]}];}return db[_0x129f('0xd7')]['findAll'](_0xb1015e);})[_0x129f('0x25')](function(_0x5e737e){_0x5635c2[_0x129f('0x73')]=_0x5e737e;return _0x5635c2;});}})[_0x129f('0x25')](respondWithFilteredResult(_0x375906,_0xb1015e))[_0x129f('0x30')](handleError(_0x375906,null));};exports[_0x129f('0x11a')]=function(_0x4e1d15,_0x575826,_0x251035){return db[_0x129f('0x59')][_0x129f('0x69')]({'where':{'id':_0x4e1d15[_0x129f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x575826,null))[_0x129f('0x25')](function(_0x27b06d){if(_0x27b06d){return _0x27b06d[_0x129f('0x11a')](_0x4e1d15['body'][_0x129f('0x70')],_[_0x129f('0x11b')](_0x4e1d15[_0x129f('0x68')],['ids','id'])||{})['spread'](function(_0x2d915f){for(var _0x5442b3=0x0;_0x5442b3<_0x4e1d15[_0x129f('0x68')][_0x129f('0x70')][_0x129f('0x50')];_0x5442b3+=0x1){socket['emit'](_0x129f('0x11c'),{'UserId':_0x4e1d15[_0x129f('0x68')][_0x129f('0x70')][_0x5442b3],'ChatWebsiteId':_0x4e1d15[_0x129f('0x5e')]['id']});}return _0x2d915f;});}})[_0x129f('0x25')](respondWithResult(_0x575826,null))[_0x129f('0x30')](handleError(_0x575826,null));};exports[_0x129f('0x11d')]=function(_0x197a1b,_0x1f53ca,_0x9cf7b6){return db[_0x129f('0x59')]['find']({'where':{'id':_0x197a1b[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x1f53ca,null))[_0x129f('0x25')](function(_0x17fa47){if(_0x17fa47){return _0x17fa47[_0x129f('0x11d')](_0x197a1b[_0x129f('0x49')][_0x129f('0x70')])['then'](function(){if(_[_0x129f('0x11e')](_0x197a1b[_0x129f('0x49')][_0x129f('0x70')])){for(var _0xba1e14=0x0;_0xba1e14<_0x197a1b['query']['ids'][_0x129f('0x50')];_0xba1e14+=0x1){socket[_0x129f('0x11f')](_0x129f('0x120'),{'UserId':Number(_0x197a1b[_0x129f('0x49')][_0x129f('0x70')][_0xba1e14]),'ChatWebsiteId':Number(_0x197a1b[_0x129f('0x5e')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x197a1b[_0x129f('0x49')][_0x129f('0x70')]),'ChatWebsiteId':Number(_0x197a1b[_0x129f('0x5e')]['id'])});}});}})[_0x129f('0x25')](respondWithStatusCode(_0x1f53ca,null))[_0x129f('0x30')](handleError(_0x1f53ca,null));};exports[_0x129f('0x121')]=function(_0x50059b,_0x430d60,_0xa60b42){var _0x363658={};var _0x53241a={};var _0x4892dd;var _0x376ce0;return db[_0x129f('0x59')][_0x129f('0x6e')]({'where':{'id':_0x50059b[_0x129f('0x5e')]['id']}})[_0x129f('0x25')](handleEntityNotFound(_0x430d60,null))['then'](function(_0x571ab1){if(_0x571ab1){_0x4892dd=_0x571ab1;_0x53241a[_0x129f('0x4e')]=_[_0x129f('0x4a')](db[_0x129f('0xc7')][_0x129f('0x46')]);_0x53241a[_0x129f('0x49')]=_[_0x129f('0x4a')](_0x50059b[_0x129f('0x49')]);_0x53241a['filters']=_[_0x129f('0x4c')](_0x53241a['model'],_0x53241a[_0x129f('0x49')]);_0x363658[_0x129f('0x4d')]=_[_0x129f('0x4c')](_0x53241a[_0x129f('0x4e')],qs[_0x129f('0x4f')](_0x50059b[_0x129f('0x49')]['fields']));_0x363658[_0x129f('0x4d')]=_0x363658[_0x129f('0x4d')]['length']?_0x363658['attributes']:_0x53241a[_0x129f('0x4e')];_0x363658[_0x129f('0x53')]=qs[_0x129f('0x54')](_0x50059b[_0x129f('0x49')][_0x129f('0x54')]);_0x363658['where']=qs[_0x129f('0x4b')](_[_0x129f('0xe8')](_0x50059b[_0x129f('0x49')],_0x53241a[_0x129f('0x4b')]));if(_0x50059b[_0x129f('0x49')][_0x129f('0x56')]){_0x363658[_0x129f('0x55')]=_['merge'](_0x363658[_0x129f('0x55')],{'$or':_[_0x129f('0x45')](_0x363658[_0x129f('0x4d')],function(_0x482b90){var _0x48e4fa={};_0x48e4fa[_0x482b90]={'$like':'%'+_0x50059b['query']['filter']+'%'};return _0x48e4fa;})});}_0x363658=_[_0x129f('0x57')]({},_0x363658,_0x50059b[_0x129f('0x5f')]);return _0x4892dd[_0x129f('0x121')](_0x363658);}})[_0x129f('0x25')](function(_0x4fb0bf){if(_0x4fb0bf){_0x376ce0=_0x4fb0bf[_0x129f('0x50')];if(!_0x50059b[_0x129f('0x49')][_0x129f('0x51')](_0x129f('0x52'))){_0x363658['limit']=qs[_0x129f('0x36')](_0x50059b[_0x129f('0x49')]['limit']);_0x363658['offset']=qs[_0x129f('0x35')](_0x50059b[_0x129f('0x49')][_0x129f('0x35')]);}return _0x4892dd[_0x129f('0x121')](_0x363658);}})[_0x129f('0x25')](function(_0x2d7ebd){if(_0x2d7ebd){return _0x2d7ebd?{'count':_0x376ce0,'rows':_0x2d7ebd}:null;}})[_0x129f('0x25')](respondWithResult(_0x430d60,null))[_0x129f('0x30')](handleError(_0x430d60,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 71d5a3f..36cbd1b 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 _0xde6c=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x89833e,_0x28bff9){var _0x3ad041=function(_0x5afb12){while(--_0x5afb12){_0x89833e['push'](_0x89833e['shift']());}};_0x3ad041(++_0x28bff9);}(_0xde6c,0x119));var _0xcde6=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0xde6c[_0x5c4d27];return _0x1dda1a;};'use strict';var EventEmitter=require(_0xcde6('0x0'));var ChatWebsite=require(_0xcde6('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcde6('0x2')](0x0);var events={'afterCreate':_0xcde6('0x3'),'afterUpdate':_0xcde6('0x4'),'afterDestroy':_0xcde6('0x5')};function emitEvent(_0x494a32){return function(_0x145150,_0x262a54,_0x30d074){ChatWebsiteEvents['emit'](_0x494a32+':'+_0x145150['id'],_0x145150);ChatWebsiteEvents[_0xcde6('0x6')](_0x494a32,_0x145150);_0x30d074(null);};}for(var e in events){if(events[_0xcde6('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x29e0=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x17ae26,_0x280890){var _0x1d2f90=function(_0x5668c6){while(--_0x5668c6){_0x17ae26['push'](_0x17ae26['shift']());}};_0x1d2f90(++_0x280890);}(_0x29e0,0x1c8));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x029e('0x0'));var ChatWebsite=require(_0x029e('0x1'))['db'][_0x029e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x029e('0x3')](0x0);var events={'afterCreate':_0x029e('0x4'),'afterUpdate':_0x029e('0x5'),'afterDestroy':_0x029e('0x6')};function emitEvent(_0x208ff7){return function(_0x16358b,_0x37ce30,_0x247d32){ChatWebsiteEvents['emit'](_0x208ff7+':'+_0x16358b['id'],_0x16358b);ChatWebsiteEvents['emit'](_0x208ff7,_0x16358b);_0x247d32(null);};}for(var e in events){if(events[_0x029e('0x7')](e)){var event=events[e];ChatWebsite[_0x029e('0x8')](e,emitEvent(event));}}module[_0x029e('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d2b43b4..240882b 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 _0x2a41=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','chat_websites','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a41,0x126));var _0x12a4=function(_0x3cf78d,_0x3a467a){_0x3cf78d=_0x3cf78d-0x0;var _0x35e8d6=_0x2a41[_0x3cf78d];return _0x35e8d6;};'use strict';var _=require(_0x12a4('0x0'));var util=require('util');var logger=require(_0x12a4('0x1'))(_0x12a4('0x2'));var moment=require(_0x12a4('0x3'));var BPromise=require(_0x12a4('0x4'));var rp=require(_0x12a4('0x5'));var fs=require('fs');var path=require(_0x12a4('0x6'));var rimraf=require(_0x12a4('0x7'));var config=require(_0x12a4('0x8'));var attributes=require(_0x12a4('0x9'));module['exports']=function(_0x379b3c,_0x7fc347){return _0x379b3c['define']('ChatWebsite',attributes,{'tableName':_0x12a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bca=['ChatWebsite','chat_websites','util','moment','request-promise','path','rimraf','./chatWebsite.attributes','exports'];(function(_0x527991,_0x3f3ce7){var _0x2439a3=function(_0x39bf03){while(--_0x39bf03){_0x527991['push'](_0x527991['shift']());}};_0x2439a3(++_0x3f3ce7);}(_0x1bca,0xb6));var _0xa1bc=function(_0x30df46,_0x4921d6){_0x30df46=_0x30df46-0x0;var _0x52629f=_0x1bca[_0x30df46];return _0x52629f;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));module[_0xa1bc('0x6')]=function(_0x168b44,_0x268ced){return _0x168b44['define'](_0xa1bc('0x7'),attributes,{'tableName':_0xa1bc('0x8'),'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 cad667d..3de687f 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 _0xef0f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58a51a,_0x223b82){var _0x8c56a1=function(_0x457686){while(--_0x457686){_0x58a51a['push'](_0x58a51a['shift']());}};_0x8c56a1(++_0x223b82);}(_0xef0f,0x168));var _0xfef0=function(_0x32a3a8,_0x1e2a47){_0x32a3a8=_0x32a3a8-0x0;var _0x94ce92=_0xef0f[_0x32a3a8];return _0x94ce92;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});} \ No newline at end of file +var _0x5c3c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util'];(function(_0x109fe4,_0x286340){var _0x50cc95=function(_0x27842c){while(--_0x27842c){_0x109fe4['push'](_0x109fe4['shift']());}};_0x50cc95(++_0x286340);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5c3c[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4edf938..c80c3cc 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4f94b1,_0x5d7170){var _0x4b7180=function(_0x503746){while(--_0x503746){_0x4f94b1['push'](_0x4f94b1['shift']());}};_0x4b7180(++_0x5d7170);}(_0x7a54,0x106));var _0x47a5=function(_0x1a4959,_0x4c26d0){_0x1a4959=_0x1a4959-0x0;var _0x22d465=_0x7a54[_0x1a4959];return _0x22d465;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x45c5f9,_0x1ad8c9){var _0x22cc60=function(_0x292959){while(--_0x292959){_0x45c5f9['push'](_0x45c5f9['shift']());}};_0x22cc60(++_0x1ad8c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x526a46,_0x119cc9){_0x526a46=_0x526a46-0x0;var _0x299cab=_0xb10b[_0x526a46];return _0x299cab;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8c2028f..909dc46 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 _0x71f1=['removeAnswers','exports','multer','util','connect-timeout','express','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','single','file','root','server/files/images/avatars/','format','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','notify','/:id/offline','addInteraction','/:id/applications','addProactiveActions','update','delete','removeDispositions'];(function(_0x16415b,_0x42b3b2){var _0x5c99d5=function(_0x4a9415){while(--_0x4a9415){_0x16415b['push'](_0x16415b['shift']());}};_0x5c99d5(++_0x42b3b2);}(_0x71f1,0xea));var _0x171f=function(_0x40d80a,_0x5e5089){_0x40d80a=_0x40d80a-0x0;var _0x335bfb=_0x71f1[_0x40d80a];return _0x335bfb;};'use strict';var multer=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var path=require('path');var timeout=require(_0x171f('0x2'));var express=require(_0x171f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x171f('0x4'));router[_0x171f('0x5')]('/',auth[_0x171f('0x6')](),controller['index']);router['get'](_0x171f('0x7'),auth[_0x171f('0x6')](),controller[_0x171f('0x8')]);router[_0x171f('0x5')](_0x171f('0x9'),auth[_0x171f('0x6')](),controller['show']);router['get'](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0xb')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x171f('0xc')]);router[_0x171f('0x5')](_0x171f('0xd'),controller[_0x171f('0xe')]);router['get'](_0x171f('0xf'),controller['getAvatar']);router[_0x171f('0x5')](_0x171f('0x10'),controller['getCustomerAvatar']);router[_0x171f('0x5')](_0x171f('0x11'),controller[_0x171f('0x12')]);router[_0x171f('0x5')](_0x171f('0x13'),auth[_0x171f('0x6')](),controller['getInteractions']);router[_0x171f('0x5')]('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth[_0x171f('0x6')](),controller[_0x171f('0x14')]);router[_0x171f('0x5')](_0x171f('0x15'),auth[_0x171f('0x6')](),controller[_0x171f('0x16')]);router[_0x171f('0x5')](_0x171f('0x17'),controller[_0x171f('0x18')]);router[_0x171f('0x5')](_0x171f('0x19'),auth['isAuthenticated'](),controller[_0x171f('0x1a')]);router[_0x171f('0x5')](_0x171f('0x1b'),auth[_0x171f('0x6')](),controller[_0x171f('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x171f('0x1d')]);router[_0x171f('0x1e')](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0x1f')]);router[_0x171f('0x1e')](_0x171f('0x20'),auth[_0x171f('0x6')](),controller[_0x171f('0x21')]);var upload=multer({'storage':multer[_0x171f('0x22')]({'destination':function(_0x30a64e,_0x28ce41,_0x5a3a65){_0x5a3a65(null,path[_0x171f('0x23')](config['root'],_0x171f('0x24')));},'filename':function(_0x276ef1,_0x342962,_0x4f7ca5){_0x4f7ca5(null,util['format'](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x342962['originalname']));}})});router[_0x171f('0x1e')](_0x171f('0xd'),upload[_0x171f('0x27')](_0x171f('0x28')),controller['addLogo']);var upload=multer({'storage':multer[_0x171f('0x22')]({'destination':function(_0x183b90,_0x55ed18,_0xa0aaeb){_0xa0aaeb(null,path[_0x171f('0x23')](config[_0x171f('0x29')],_0x171f('0x2a')));},'filename':function(_0x244c46,_0x46edf1,_0x5ef48e){_0x5ef48e(null,util[_0x171f('0x2b')](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x46edf1[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')](_0x171f('0xf'),upload[_0x171f('0x27')](_0x171f('0x28')),controller[_0x171f('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fde72,_0x28d64a,_0x590004){_0x590004(null,path['join'](config[_0x171f('0x29')],_0x171f('0x2a')));},'filename':function(_0x46be18,_0x58bf92,_0x2fed83){_0x2fed83(null,util[_0x171f('0x2b')](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x58bf92[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')]('/:id/customer_avatar',upload[_0x171f('0x27')](_0x171f('0x28')),controller[_0x171f('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f6ec0,_0x1fc8b8,_0x4dd55a){_0x4dd55a(null,path[_0x171f('0x23')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2e1b4a,_0x4697a2,_0x27b065){_0x27b065(null,util['format'](_0x171f('0x25'),Date[_0x171f('0x26')](),_0x4697a2[_0x171f('0x2c')]));}})});router[_0x171f('0x1e')](_0x171f('0x11'),upload[_0x171f('0x27')]('file'),controller[_0x171f('0x2f')]);router['post']('/:id/notify',controller[_0x171f('0x30')]);router['post'](_0x171f('0x31'),controller['offline']);router['post'](_0x171f('0x13'),auth['isAuthenticated'](),controller[_0x171f('0x32')]);router[_0x171f('0x1e')](_0x171f('0x33'),auth[_0x171f('0x6')](),controller['addApplications']);router[_0x171f('0x1e')](_0x171f('0x15'),auth[_0x171f('0x6')](),controller[_0x171f('0x34')]);router[_0x171f('0x1e')]('/:id/users',auth[_0x171f('0x6')](),controller['addAgents']);router['put'](_0x171f('0x9'),auth[_0x171f('0x6')](),controller[_0x171f('0x35')]);router[_0x171f('0x36')](_0x171f('0x9'),auth[_0x171f('0x6')](),controller['destroy']);router[_0x171f('0x36')](_0x171f('0xa'),auth[_0x171f('0x6')](),controller[_0x171f('0x37')]);router['delete'](_0x171f('0x20'),auth['isAuthenticated'](),controller[_0x171f('0x38')]);router[_0x171f('0x36')](_0x171f('0x1b'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x171f('0x39')]=router; \ No newline at end of file +var _0xa7bc=['addCustomerAvatar','/:id/system_avatar','addSystemAvatar','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','util','connect-timeout','express','Router','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','diskStorage','originalname','post','addAvatar','server/files/images/avatars/'];(function(_0x301b44,_0x136684){var _0xf20e8d=function(_0x21ec42){while(--_0x21ec42){_0x301b44['push'](_0x301b44['shift']());}};_0xf20e8d(++_0x136684);}(_0xa7bc,0x97));var _0xca7b=function(_0x396f00,_0x417a05){_0x396f00=_0x396f00-0x0;var _0x2eafdd=_0xa7bc[_0x396f00];return _0x2eafdd;};'use strict';var multer=require('multer');var util=require(_0xca7b('0x0'));var path=require('path');var timeout=require(_0xca7b('0x1'));var express=require(_0xca7b('0x2'));var router=express[_0xca7b('0x3')]();var auth=require(_0xca7b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xca7b('0x5'));router[_0xca7b('0x6')]('/',auth[_0xca7b('0x7')](),controller[_0xca7b('0x8')]);router[_0xca7b('0x6')](_0xca7b('0x9'),auth['isAuthenticated'](),controller[_0xca7b('0xa')]);router[_0xca7b('0x6')](_0xca7b('0xb'),auth[_0xca7b('0x7')](),controller[_0xca7b('0xc')]);router[_0xca7b('0x6')](_0xca7b('0xd'),auth[_0xca7b('0x7')](),controller[_0xca7b('0xe')]);router[_0xca7b('0x6')](_0xca7b('0xf'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x10')]);router[_0xca7b('0x6')](_0xca7b('0x11'),controller['getLogo']);router[_0xca7b('0x6')](_0xca7b('0x12'),controller[_0xca7b('0x13')]);router[_0xca7b('0x6')](_0xca7b('0x14'),controller[_0xca7b('0x15')]);router['get']('/:id/system_avatar',controller[_0xca7b('0x16')]);router[_0xca7b('0x6')](_0xca7b('0x17'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x18')]);router[_0xca7b('0x6')](_0xca7b('0x19'),controller[_0xca7b('0x1a')]);router['get'](_0xca7b('0x1b'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x1c')]);router[_0xca7b('0x6')](_0xca7b('0x1d'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x1e')]);router['get'](_0xca7b('0x1f'),controller[_0xca7b('0x20')]);router[_0xca7b('0x6')](_0xca7b('0x21'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x22')]);router['get'](_0xca7b('0x23'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x24')]);router['post']('/',auth[_0xca7b('0x7')](),controller['create']);router['post']('/:id/dispositions',auth[_0xca7b('0x7')](),controller[_0xca7b('0x25')]);router['post']('/:id/canned_answers',auth[_0xca7b('0x7')](),controller[_0xca7b('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42ebb6,_0x37322f,_0x56c2ca){_0x56c2ca(null,path[_0xca7b('0x27')](config[_0xca7b('0x28')],_0xca7b('0x29')));},'filename':function(_0x1c4737,_0x22eda4,_0x3eb483){_0x3eb483(null,util[_0xca7b('0x2a')](_0xca7b('0x2b'),Date[_0xca7b('0x2c')](),_0x22eda4['originalname']));}})});router['post']('/:id/logo',upload[_0xca7b('0x2d')](_0xca7b('0x2e')),controller[_0xca7b('0x2f')]);var upload=multer({'storage':multer[_0xca7b('0x30')]({'destination':function(_0x1c3c37,_0x3bc36c,_0x4f26b4){_0x4f26b4(null,path[_0xca7b('0x27')](config[_0xca7b('0x28')],'server/files/images/avatars/'));},'filename':function(_0x1b1ebd,_0x43d805,_0x3f8c13){_0x3f8c13(null,util[_0xca7b('0x2a')](_0xca7b('0x2b'),Date[_0xca7b('0x2c')](),_0x43d805[_0xca7b('0x31')]));}})});router[_0xca7b('0x32')](_0xca7b('0x12'),upload[_0xca7b('0x2d')](_0xca7b('0x2e')),controller[_0xca7b('0x33')]);var upload=multer({'storage':multer[_0xca7b('0x30')]({'destination':function(_0x27449a,_0x278f58,_0x402978){_0x402978(null,path[_0xca7b('0x27')](config['root'],_0xca7b('0x34')));},'filename':function(_0x112abf,_0x3d8422,_0x370e4c){_0x370e4c(null,util[_0xca7b('0x2a')](_0xca7b('0x2b'),Date[_0xca7b('0x2c')](),_0x3d8422[_0xca7b('0x31')]));}})});router[_0xca7b('0x32')](_0xca7b('0x14'),upload[_0xca7b('0x2d')](_0xca7b('0x2e')),controller[_0xca7b('0x35')]);var upload=multer({'storage':multer[_0xca7b('0x30')]({'destination':function(_0x119a38,_0x482ff2,_0x17c726){_0x17c726(null,path['join'](config[_0xca7b('0x28')],_0xca7b('0x34')));},'filename':function(_0x331117,_0x2afa80,_0xd2473b){_0xd2473b(null,util['format']('%s-%s',Date[_0xca7b('0x2c')](),_0x2afa80[_0xca7b('0x31')]));}})});router[_0xca7b('0x32')](_0xca7b('0x36'),upload['single']('file'),controller[_0xca7b('0x37')]);router[_0xca7b('0x32')]('/:id/notify',controller[_0xca7b('0x38')]);router[_0xca7b('0x32')](_0xca7b('0x39'),controller['offline']);router[_0xca7b('0x32')](_0xca7b('0x17'),auth['isAuthenticated'](),controller[_0xca7b('0x3a')]);router['post'](_0xca7b('0x1b'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x3b')]);router['post'](_0xca7b('0x1d'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x3c')]);router['post'](_0xca7b('0x23'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x3d')]);router[_0xca7b('0x3e')](_0xca7b('0xb'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x3f')]);router['delete'](_0xca7b('0xb'),auth[_0xca7b('0x7')](),controller['destroy']);router[_0xca7b('0x40')](_0xca7b('0xd'),auth[_0xca7b('0x7')](),controller[_0xca7b('0x41')]);router[_0xca7b('0x40')](_0xca7b('0xf'),auth['isAuthenticated'](),controller[_0xca7b('0x42')]);router[_0xca7b('0x40')](_0xca7b('0x23'),auth[_0xca7b('0x7')](),controller['removeAgents']);module[_0xca7b('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 93aafbf..9130b13 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 _0x363e=['exports','ENUM','AmazonAWS','Google','STRING','sequelize'];(function(_0x2536ad,_0x77ea35){var _0xdd5674=function(_0xe6094){while(--_0xe6094){_0x2536ad['push'](_0x2536ad['shift']());}};_0xdd5674(++_0x77ea35);}(_0x363e,0x179));var _0xe363=function(_0x56e7bc,_0xe3209f){_0x56e7bc=_0x56e7bc-0x0;var _0x48ced8=_0x363e[_0x56e7bc];return _0x48ced8;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe363('0x2')](_0xe363('0x3'),_0xe363('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe363('0x5')]},'data2':{'type':Sequelize[_0xe363('0x5')]}}; \ No newline at end of file +var _0x3981=['STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x4b0fc9,_0x2d1cad){var _0x18a896=function(_0x257045){while(--_0x257045){_0x4b0fc9['push'](_0x4b0fc9['shift']());}};_0x18a896(++_0x2d1cad);}(_0x3981,0x144));var _0x1398=function(_0x314174,_0x4c3fbd){_0x314174=_0x314174-0x0;var _0x4da958=_0x3981[_0x314174];return _0x4da958;};'use strict';var Sequelize=require(_0x1398('0x0'));module['exports']={'name':{'type':Sequelize[_0x1398('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1398('0x2')](_0x1398('0x3'),_0x1398('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1398('0x1')]},'data2':{'type':Sequelize[_0x1398('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9fbeaee..5761f2d 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 _0xb3f3=['includeAll','find','create','body','update','catch','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','then','rows','show','params'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb3f3,0x92));var _0x3b3f=function(_0x309df4,_0x3391db){_0x309df4=_0x309df4-0x0;var _0x4be8fc=_0xb3f3[_0x309df4];return _0x4be8fc;};'use strict';var pdf=require(_0x3b3f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b3f('0x2'));var rp=require(_0x3b3f('0x3'));var moment=require('moment');var BPromise=require(_0x3b3f('0x4'));var Mustache=require(_0x3b3f('0x5'));var util=require('util');var path=require(_0x3b3f('0x6'));var sox=require('sox');var csv=require(_0x3b3f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b3f('0x8'));var squel=require('squel');var crypto=require(_0x3b3f('0x9'));var jsforce=require(_0x3b3f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3b3f('0x7'));var querystring=require(_0x3b3f('0xb'));var Papa=require(_0x3b3f('0xc'));var Redis=require(_0x3b3f('0xd'));var authService=require(_0x3b3f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3b3f('0xf'));var hardwareService=require(_0x3b3f('0x10'));var logger=require(_0x3b3f('0x11'))(_0x3b3f('0x12'));var utils=require(_0x3b3f('0x13'));var config=require(_0x3b3f('0x14'));var db=require(_0x3b3f('0x15'))['db'];function respondWithStatusCode(_0x3cad50,_0xcbd6af){_0xcbd6af=_0xcbd6af||0xcc;return function(_0x5be39d){if(_0x5be39d){return _0x3cad50[_0x3b3f('0x16')](_0xcbd6af);}return _0x3cad50[_0x3b3f('0x17')](_0xcbd6af)[_0x3b3f('0x18')]();};}function respondWithResult(_0x3a198f,_0x46f9aa){_0x46f9aa=_0x46f9aa||0xc8;return function(_0x535f04){if(_0x535f04){return _0x3a198f[_0x3b3f('0x17')](_0x46f9aa)['json'](_0x535f04);}};}function respondWithFilteredResult(_0x855057,_0x21b29f){return function(_0x119e19){if(_0x119e19){var _0x3cba88=_0x119e19[_0x3b3f('0x19')],_0x2dbb0d=_0x21b29f[_0x3b3f('0x1a')],_0x26b5ac=_0x21b29f[_0x3b3f('0x1a')]+_0x21b29f[_0x3b3f('0x1b')],_0x1896f5;if(_0x26b5ac>=_0x3cba88){_0x26b5ac=_0x3cba88;_0x1896f5=0xc8;}else{_0x1896f5=0xce;}_0x855057[_0x3b3f('0x17')](_0x1896f5);return _0x855057[_0x3b3f('0x1c')](_0x3b3f('0x1d'),_0x2dbb0d+'-'+_0x26b5ac+'/'+_0x3cba88)['json'](_0x119e19);}return null;};}function patchUpdates(_0x4208bd){return function(_0x1e68c3){try{jsonpatch[_0x3b3f('0x1e')](_0x1e68c3,_0x4208bd,!![]);}catch(_0x15b4f0){return BPromise[_0x3b3f('0x1f')](_0x15b4f0);}return _0x1e68c3[_0x3b3f('0x20')]();};}function saveUpdates(_0x81294,_0x167e91){return function(_0x63c40c){if(_0x63c40c){return _0x63c40c['update'](_0x81294)['then'](function(_0x34696a){return _0x34696a;});}return null;};}function removeEntity(_0x3b833f,_0x9318f1){return function(_0x573e61){if(_0x573e61){return _0x573e61[_0x3b3f('0x21')]()['then'](function(){_0x3b833f[_0x3b3f('0x17')](0xcc)[_0x3b3f('0x18')]();});}};}function handleEntityNotFound(_0x459119,_0x1bb01e){return function(_0x2ea457){if(!_0x2ea457){_0x459119['sendStatus'](0x194);}return _0x2ea457;};}function handleError(_0x243d69,_0x4b05f7){_0x4b05f7=_0x4b05f7||0x1f4;return function(_0x2165fb){logger[_0x3b3f('0x22')](_0x2165fb[_0x3b3f('0x23')]);if(_0x2165fb['name']){delete _0x2165fb[_0x3b3f('0x24')];}_0x243d69['status'](_0x4b05f7)[_0x3b3f('0x25')](_0x2165fb);};}exports['index']=function(_0x2ca58d,_0x425d99){var _0x583d76={},_0xb954c1={},_0x5867d8={'count':0x0,'rows':[]};var _0x45accd=_[_0x3b3f('0x26')](db[_0x3b3f('0x27')][_0x3b3f('0x28')],function(_0x4d5f62){return{'name':_0x4d5f62[_0x3b3f('0x29')],'type':_0x4d5f62[_0x3b3f('0x2a')]['key']};});_0xb954c1['model']=_[_0x3b3f('0x26')](_0x45accd,_0x3b3f('0x24'));_0xb954c1[_0x3b3f('0x2b')]=_[_0x3b3f('0x2c')](_0x2ca58d[_0x3b3f('0x2b')]);_0xb954c1[_0x3b3f('0x2d')]=_[_0x3b3f('0x2e')](_0xb954c1[_0x3b3f('0x2f')],_0xb954c1['query']);_0x583d76['attributes']=_['intersection'](_0xb954c1[_0x3b3f('0x2f')],qs[_0x3b3f('0x30')](_0x2ca58d['query']['fields']));_0x583d76[_0x3b3f('0x31')]=_0x583d76[_0x3b3f('0x31')]['length']?_0x583d76[_0x3b3f('0x31')]:_0xb954c1[_0x3b3f('0x2f')];if(!_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x32')]('nolimit')){_0x583d76[_0x3b3f('0x1b')]=qs[_0x3b3f('0x1b')](_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x1b')]);_0x583d76[_0x3b3f('0x1a')]=qs[_0x3b3f('0x1a')](_0x2ca58d[_0x3b3f('0x2b')][_0x3b3f('0x1a')]);}_0x583d76[_0x3b3f('0x33')]=qs[_0x3b3f('0x34')](_0x2ca58d[_0x3b3f('0x2b')]['sort']);_0x583d76['where']=qs[_0x3b3f('0x2d')](_['pick'](_0x2ca58d[_0x3b3f('0x2b')],_0xb954c1[_0x3b3f('0x2d')]),_0x45accd);if(_0x2ca58d['query'][_0x3b3f('0x35')]){_0x583d76[_0x3b3f('0x36')]=_[_0x3b3f('0x37')](_0x583d76['where'],{'$or':_[_0x3b3f('0x26')](_0x45accd,function(_0x2a3204){if(_0x2a3204['type']!==_0x3b3f('0x38')){var _0x59ed63={};_0x59ed63[_0x2a3204[_0x3b3f('0x24')]]={'$like':'%'+_0x2ca58d['query'][_0x3b3f('0x35')]+'%'};return _0x59ed63;}})});}_0x583d76=_[_0x3b3f('0x37')]({},_0x583d76,_0x2ca58d[_0x3b3f('0x39')]);var _0xcedb09={'where':_0x583d76['where']};return db['CloudProvider'][_0x3b3f('0x19')](_0xcedb09)['then'](function(_0x4322be){_0x5867d8[_0x3b3f('0x19')]=_0x4322be;if(_0x2ca58d[_0x3b3f('0x2b')]['includeAll']){_0x583d76[_0x3b3f('0x3a')]=[{'all':!![]}];}return db['CloudProvider'][_0x3b3f('0x3b')](_0x583d76);})[_0x3b3f('0x3c')](function(_0x374da4){_0x5867d8[_0x3b3f('0x3d')]=_0x374da4;return _0x5867d8;})[_0x3b3f('0x3c')](respondWithFilteredResult(_0x425d99,_0x583d76))['catch'](handleError(_0x425d99,null));};exports[_0x3b3f('0x3e')]=function(_0x5dfdb1,_0x3507c9){var _0x2faa29={'raw':!![],'where':{'id':_0x5dfdb1[_0x3b3f('0x3f')]['id']}},_0x3e39fe={};_0x3e39fe[_0x3b3f('0x2f')]=_[_0x3b3f('0x2c')](db[_0x3b3f('0x27')][_0x3b3f('0x28')]);_0x3e39fe[_0x3b3f('0x2b')]=_['keys'](_0x5dfdb1['query']);_0x3e39fe[_0x3b3f('0x2d')]=_[_0x3b3f('0x2e')](_0x3e39fe[_0x3b3f('0x2f')],_0x3e39fe[_0x3b3f('0x2b')]);_0x2faa29[_0x3b3f('0x31')]=_[_0x3b3f('0x2e')](_0x3e39fe[_0x3b3f('0x2f')],qs[_0x3b3f('0x30')](_0x5dfdb1[_0x3b3f('0x2b')][_0x3b3f('0x30')]));_0x2faa29[_0x3b3f('0x31')]=_0x2faa29[_0x3b3f('0x31')]['length']?_0x2faa29[_0x3b3f('0x31')]:_0x3e39fe[_0x3b3f('0x2f')];if(_0x5dfdb1[_0x3b3f('0x2b')][_0x3b3f('0x40')]){_0x2faa29['include']=[{'all':!![]}];}_0x2faa29=_[_0x3b3f('0x37')]({},_0x2faa29,_0x5dfdb1[_0x3b3f('0x39')]);return db[_0x3b3f('0x27')][_0x3b3f('0x41')](_0x2faa29)[_0x3b3f('0x3c')](handleEntityNotFound(_0x3507c9,null))[_0x3b3f('0x3c')](respondWithResult(_0x3507c9,null))['catch'](handleError(_0x3507c9,null));};exports['create']=function(_0x34c825,_0x2c8587){return db[_0x3b3f('0x27')][_0x3b3f('0x42')](_0x34c825[_0x3b3f('0x43')],{})[_0x3b3f('0x3c')](respondWithResult(_0x2c8587,0xc9))['catch'](handleError(_0x2c8587,null));};exports[_0x3b3f('0x44')]=function(_0x520d3b,_0x16ed98){if(_0x520d3b['body']['id']){delete _0x520d3b[_0x3b3f('0x43')]['id'];}return db[_0x3b3f('0x27')][_0x3b3f('0x41')]({'where':{'id':_0x520d3b['params']['id']}})[_0x3b3f('0x3c')](handleEntityNotFound(_0x16ed98,null))[_0x3b3f('0x3c')](saveUpdates(_0x520d3b[_0x3b3f('0x43')],null))[_0x3b3f('0x3c')](respondWithResult(_0x16ed98,null))['catch'](handleError(_0x16ed98,null));};exports[_0x3b3f('0x21')]=function(_0x263004,_0x15459e){return db['CloudProvider']['find']({'where':{'id':_0x263004[_0x3b3f('0x3f')]['id']}})[_0x3b3f('0x3c')](handleEntityNotFound(_0x15459e,null))[_0x3b3f('0x3c')](removeEntity(_0x15459e,null))[_0x3b3f('0x45')](handleError(_0x15459e,null));}; \ No newline at end of file +var _0xedf3=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CloudProvider','include','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x20da1a,_0xd49a5c){var _0x374e08=function(_0x2c7d0d){while(--_0x2c7d0d){_0x20da1a['push'](_0x20da1a['shift']());}};_0x374e08(++_0xd49a5c);}(_0xedf3,0x124));var _0x3edf=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0xedf3[_0x3e85a4];return _0x21e7d1;};'use strict';var pdf=require(_0x3edf('0x0'));var emlformat=require(_0x3edf('0x1'));var rimraf=require(_0x3edf('0x2'));var zipdir=require(_0x3edf('0x3'));var jsonpatch=require(_0x3edf('0x4'));var rp=require(_0x3edf('0x5'));var moment=require(_0x3edf('0x6'));var BPromise=require(_0x3edf('0x7'));var Mustache=require(_0x3edf('0x8'));var util=require(_0x3edf('0x9'));var path=require(_0x3edf('0xa'));var sox=require(_0x3edf('0xb'));var csv=require(_0x3edf('0xc'));var ejs=require(_0x3edf('0xd'));var fs=require('fs');var _=require(_0x3edf('0xe'));var squel=require(_0x3edf('0xf'));var crypto=require(_0x3edf('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3edf('0x11'));var toCsv=require(_0x3edf('0xc'));var querystring=require(_0x3edf('0x12'));var Papa=require(_0x3edf('0x13'));var Redis=require(_0x3edf('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3edf('0x15'));var as=require(_0x3edf('0x16'));var hardwareService=require(_0x3edf('0x17'));var logger=require(_0x3edf('0x18'))('api');var utils=require(_0x3edf('0x19'));var config=require(_0x3edf('0x1a'));var db=require(_0x3edf('0x1b'))['db'];function respondWithStatusCode(_0x42d4b2,_0x128bbf){_0x128bbf=_0x128bbf||0xcc;return function(_0x46e4d8){if(_0x46e4d8){return _0x42d4b2[_0x3edf('0x1c')](_0x128bbf);}return _0x42d4b2['status'](_0x128bbf)[_0x3edf('0x1d')]();};}function respondWithResult(_0x1852b9,_0x4b8ead){_0x4b8ead=_0x4b8ead||0xc8;return function(_0x4bc8d2){if(_0x4bc8d2){return _0x1852b9[_0x3edf('0x1e')](_0x4b8ead)[_0x3edf('0x1f')](_0x4bc8d2);}};}function respondWithFilteredResult(_0x45f60c,_0x530b44){return function(_0x1fc449){if(_0x1fc449){var _0x96e4bb=_0x1fc449[_0x3edf('0x20')],_0x4a7f2d=_0x530b44[_0x3edf('0x21')],_0xd2b9aa=_0x530b44['offset']+_0x530b44[_0x3edf('0x22')],_0x4d191c;if(_0xd2b9aa>=_0x96e4bb){_0xd2b9aa=_0x96e4bb;_0x4d191c=0xc8;}else{_0x4d191c=0xce;}_0x45f60c[_0x3edf('0x1e')](_0x4d191c);return _0x45f60c[_0x3edf('0x23')]('Content-Range',_0x4a7f2d+'-'+_0xd2b9aa+'/'+_0x96e4bb)[_0x3edf('0x1f')](_0x1fc449);}return null;};}function patchUpdates(_0x321021){return function(_0x1fb3aa){try{jsonpatch['apply'](_0x1fb3aa,_0x321021,!![]);}catch(_0x4f6810){return BPromise[_0x3edf('0x24')](_0x4f6810);}return _0x1fb3aa['save']();};}function saveUpdates(_0x3c93af,_0x3c26ea){return function(_0x26070a){if(_0x26070a){return _0x26070a[_0x3edf('0x25')](_0x3c93af)[_0x3edf('0x26')](function(_0x12e6d6){return _0x12e6d6;});}return null;};}function removeEntity(_0x4daa10,_0x98df33){return function(_0x2bd74d){if(_0x2bd74d){return _0x2bd74d[_0x3edf('0x27')]()[_0x3edf('0x26')](function(){_0x4daa10[_0x3edf('0x1e')](0xcc)[_0x3edf('0x1d')]();});}};}function handleEntityNotFound(_0x561686,_0x28c531){return function(_0x5337c6){if(!_0x5337c6){_0x561686[_0x3edf('0x1c')](0x194);}return _0x5337c6;};}function handleError(_0x3dbc48,_0x226f68){_0x226f68=_0x226f68||0x1f4;return function(_0x101fe3){logger[_0x3edf('0x28')](_0x101fe3[_0x3edf('0x29')]);if(_0x101fe3[_0x3edf('0x2a')]){delete _0x101fe3['name'];}_0x3dbc48['status'](_0x226f68)[_0x3edf('0x2b')](_0x101fe3);};}exports[_0x3edf('0x2c')]=function(_0x2ebbb1,_0x50b118){var _0x99cd88={},_0x35bf0c={},_0x2cb26d={'count':0x0,'rows':[]};var _0x208169=_[_0x3edf('0x2d')](db['CloudProvider'][_0x3edf('0x2e')],function(_0x153785){return{'name':_0x153785['fieldName'],'type':_0x153785[_0x3edf('0x2f')]['key']};});_0x35bf0c[_0x3edf('0x30')]=_[_0x3edf('0x2d')](_0x208169,_0x3edf('0x2a'));_0x35bf0c[_0x3edf('0x31')]=_[_0x3edf('0x32')](_0x2ebbb1[_0x3edf('0x31')]);_0x35bf0c[_0x3edf('0x33')]=_['intersection'](_0x35bf0c[_0x3edf('0x30')],_0x35bf0c[_0x3edf('0x31')]);_0x99cd88[_0x3edf('0x34')]=_[_0x3edf('0x35')](_0x35bf0c[_0x3edf('0x30')],qs[_0x3edf('0x36')](_0x2ebbb1[_0x3edf('0x31')]['fields']));_0x99cd88[_0x3edf('0x34')]=_0x99cd88[_0x3edf('0x34')][_0x3edf('0x37')]?_0x99cd88[_0x3edf('0x34')]:_0x35bf0c[_0x3edf('0x30')];if(!_0x2ebbb1[_0x3edf('0x31')][_0x3edf('0x38')](_0x3edf('0x39'))){_0x99cd88[_0x3edf('0x22')]=qs['limit'](_0x2ebbb1[_0x3edf('0x31')][_0x3edf('0x22')]);_0x99cd88[_0x3edf('0x21')]=qs[_0x3edf('0x21')](_0x2ebbb1[_0x3edf('0x31')]['offset']);}_0x99cd88[_0x3edf('0x3a')]=qs[_0x3edf('0x3b')](_0x2ebbb1[_0x3edf('0x31')][_0x3edf('0x3b')]);_0x99cd88[_0x3edf('0x3c')]=qs[_0x3edf('0x33')](_[_0x3edf('0x3d')](_0x2ebbb1[_0x3edf('0x31')],_0x35bf0c[_0x3edf('0x33')]),_0x208169);if(_0x2ebbb1[_0x3edf('0x31')][_0x3edf('0x3e')]){_0x99cd88[_0x3edf('0x3c')]=_[_0x3edf('0x3f')](_0x99cd88[_0x3edf('0x3c')],{'$or':_[_0x3edf('0x2d')](_0x208169,function(_0x225502){if(_0x225502[_0x3edf('0x2f')]!=='VIRTUAL'){var _0x5e1d09={};_0x5e1d09[_0x225502[_0x3edf('0x2a')]]={'$like':'%'+_0x2ebbb1[_0x3edf('0x31')]['filter']+'%'};return _0x5e1d09;}})});}_0x99cd88=_[_0x3edf('0x3f')]({},_0x99cd88,_0x2ebbb1[_0x3edf('0x40')]);var _0x2e02ce={'where':_0x99cd88[_0x3edf('0x3c')]};return db[_0x3edf('0x41')][_0x3edf('0x20')](_0x2e02ce)[_0x3edf('0x26')](function(_0x4b3239){_0x2cb26d[_0x3edf('0x20')]=_0x4b3239;if(_0x2ebbb1[_0x3edf('0x31')]['includeAll']){_0x99cd88[_0x3edf('0x42')]=[{'all':!![]}];}return db[_0x3edf('0x41')]['findAll'](_0x99cd88);})[_0x3edf('0x26')](function(_0x26a177){_0x2cb26d[_0x3edf('0x43')]=_0x26a177;return _0x2cb26d;})[_0x3edf('0x26')](respondWithFilteredResult(_0x50b118,_0x99cd88))[_0x3edf('0x44')](handleError(_0x50b118,null));};exports[_0x3edf('0x45')]=function(_0x17b093,_0x5312a0){var _0xe5a3b0={'raw':!![],'where':{'id':_0x17b093[_0x3edf('0x46')]['id']}},_0x2e1718={};_0x2e1718[_0x3edf('0x30')]=_[_0x3edf('0x32')](db[_0x3edf('0x41')][_0x3edf('0x2e')]);_0x2e1718['query']=_[_0x3edf('0x32')](_0x17b093[_0x3edf('0x31')]);_0x2e1718[_0x3edf('0x33')]=_[_0x3edf('0x35')](_0x2e1718[_0x3edf('0x30')],_0x2e1718[_0x3edf('0x31')]);_0xe5a3b0[_0x3edf('0x34')]=_[_0x3edf('0x35')](_0x2e1718[_0x3edf('0x30')],qs[_0x3edf('0x36')](_0x17b093[_0x3edf('0x31')][_0x3edf('0x36')]));_0xe5a3b0['attributes']=_0xe5a3b0[_0x3edf('0x34')][_0x3edf('0x37')]?_0xe5a3b0['attributes']:_0x2e1718[_0x3edf('0x30')];if(_0x17b093[_0x3edf('0x31')][_0x3edf('0x47')]){_0xe5a3b0[_0x3edf('0x42')]=[{'all':!![]}];}_0xe5a3b0=_[_0x3edf('0x3f')]({},_0xe5a3b0,_0x17b093['options']);return db[_0x3edf('0x41')][_0x3edf('0x48')](_0xe5a3b0)[_0x3edf('0x26')](handleEntityNotFound(_0x5312a0,null))[_0x3edf('0x26')](respondWithResult(_0x5312a0,null))[_0x3edf('0x44')](handleError(_0x5312a0,null));};exports['create']=function(_0x4dcab5,_0x60e6b3){return db[_0x3edf('0x41')][_0x3edf('0x49')](_0x4dcab5[_0x3edf('0x4a')],{})[_0x3edf('0x26')](respondWithResult(_0x60e6b3,0xc9))[_0x3edf('0x44')](handleError(_0x60e6b3,null));};exports[_0x3edf('0x25')]=function(_0x48a80c,_0x1a9377){if(_0x48a80c[_0x3edf('0x4a')]['id']){delete _0x48a80c[_0x3edf('0x4a')]['id'];}return db[_0x3edf('0x41')][_0x3edf('0x48')]({'where':{'id':_0x48a80c['params']['id']}})[_0x3edf('0x26')](handleEntityNotFound(_0x1a9377,null))[_0x3edf('0x26')](saveUpdates(_0x48a80c[_0x3edf('0x4a')],null))[_0x3edf('0x26')](respondWithResult(_0x1a9377,null))[_0x3edf('0x44')](handleError(_0x1a9377,null));};exports['destroy']=function(_0x5ffbbf,_0x1f427f){return db['CloudProvider'][_0x3edf('0x48')]({'where':{'id':_0x5ffbbf[_0x3edf('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f427f,null))[_0x3edf('0x26')](removeEntity(_0x1f427f,null))[_0x3edf('0x44')](handleError(_0x1f427f,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0dd4aaa..4857717 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 _0x551a=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider'];(function(_0xbd926,_0x3c5a91){var _0x1d384b=function(_0x4a32a5){while(--_0x4a32a5){_0xbd926['push'](_0xbd926['shift']());}};_0x1d384b(++_0x3c5a91);}(_0x551a,0x1d5));var _0xa551=function(_0x31ec9e,_0x2c5bfa){_0x31ec9e=_0x31ec9e-0x0;var _0x5152be=_0x551a[_0x31ec9e];return _0x5152be;};'use strict';var _=require('lodash');var util=require(_0xa551('0x0'));var logger=require(_0xa551('0x1'))(_0xa551('0x2'));var moment=require(_0xa551('0x3'));var BPromise=require(_0xa551('0x4'));var rp=require(_0xa551('0x5'));var fs=require('fs');var path=require(_0xa551('0x6'));var rimraf=require(_0xa551('0x7'));var config=require(_0xa551('0x8'));var attributes=require(_0xa551('0x9'));module['exports']=function(_0x50cf85,_0x381cbc){return _0x50cf85['define'](_0xa551('0xa'),attributes,{'tableName':_0xa551('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3166=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x134f0c,_0x145af7){var _0x2576c9=function(_0x635664){while(--_0x635664){_0x134f0c['push'](_0x134f0c['shift']());}};_0x2576c9(++_0x145af7);}(_0x3166,0x76));var _0x6316=function(_0x272da9,_0x447806){_0x272da9=_0x272da9-0x0;var _0x4223bb=_0x3166[_0x272da9];return _0x4223bb;};'use strict';var _=require(_0x6316('0x0'));var util=require(_0x6316('0x1'));var logger=require(_0x6316('0x2'))(_0x6316('0x3'));var moment=require(_0x6316('0x4'));var BPromise=require(_0x6316('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6316('0x6'));var rimraf=require(_0x6316('0x7'));var config=require(_0x6316('0x8'));var attributes=require(_0x6316('0x9'));module[_0x6316('0xa')]=function(_0x28912f,_0x4d159d){return _0x28912f[_0x6316('0xb')](_0x6316('0xc'),attributes,{'tableName':_0x6316('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 00c1b86..67daeb4 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 _0xe37e=['http','request','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0xb175c7,_0x4b50b2){var _0x107183=function(_0x1b8aa2){while(--_0x1b8aa2){_0xb175c7['push'](_0xb175c7['shift']());}};_0x107183(++_0x4b50b2);}(_0xe37e,0xbc));var _0xee37=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe37e[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0xee37('0x0'));var moment=require(_0xee37('0x1'));var BPromise=require(_0xee37('0x2'));var rs=require(_0xee37('0x3'));var fs=require('fs');var Redis=require(_0xee37('0x4'));var db=require(_0xee37('0x5'))['db'];var utils=require(_0xee37('0x6'));var logger=require(_0xee37('0x7'))(_0xee37('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xee37('0x9')][_0xee37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59d554,_0x3f0059,_0x36510c){return new BPromise(function(_0x5c064d,_0x5cd337){return client[_0xee37('0xb')](_0x59d554,_0x36510c)[_0xee37('0xc')](function(_0x5d9586){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3f0059,_0xee37('0xd'));logger['debug'](_0xee37('0xe'),_0x3f0059,'request\x20sent',JSON[_0xee37('0xf')](_0x5d9586));if(_0x5d9586['error']){if(_0x5d9586[_0xee37('0x10')]['code']===0x1f4){logger['error'](_0xee37('0x11'),_0x3f0059,_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);return _0x5cd337(_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);}logger['error'](_0xee37('0x11'),_0x3f0059,_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);return _0x5c064d(_0x5d9586[_0xee37('0x10')][_0xee37('0x12')]);}else{logger[_0xee37('0x13')](_0xee37('0x11'),_0x3f0059,_0xee37('0xd'));_0x5c064d(_0x5d9586[_0xee37('0x14')][_0xee37('0x12')]);}})[_0xee37('0x15')](function(_0xee9159){logger[_0xee37('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3f0059,_0xee9159);_0x5cd337(_0xee9159);});});} \ No newline at end of file +var _0x0885=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x16cfb0,_0x28d646){var _0x3d8504=function(_0x415941){while(--_0x415941){_0x16cfb0['push'](_0x16cfb0['shift']());}};_0x3d8504(++_0x28d646);}(_0x0885,0x12d));var _0x5088=function(_0xe4854b,_0x414b50){_0xe4854b=_0xe4854b-0x0;var _0x1c3d72=_0x0885[_0xe4854b];return _0x1c3d72;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5088('0x0'));var BPromise=require(_0x5088('0x1'));var rs=require(_0x5088('0x2'));var fs=require('fs');var Redis=require(_0x5088('0x3'));var db=require(_0x5088('0x4'))['db'];var utils=require(_0x5088('0x5'));var logger=require(_0x5088('0x6'))(_0x5088('0x7'));var config=require(_0x5088('0x8'));var jayson=require(_0x5088('0x9'));var client=jayson[_0x5088('0xa')][_0x5088('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x519a67,_0x1f7d2e,_0x541c85){return new BPromise(function(_0x4f81dc,_0x1ebf2f){return client[_0x5088('0xc')](_0x519a67,_0x541c85)[_0x5088('0xd')](function(_0x1f6c01){logger[_0x5088('0xe')](_0x5088('0xf'),_0x1f7d2e,_0x5088('0x10'));logger[_0x5088('0x11')](_0x5088('0x12'),_0x1f7d2e,'request\x20sent',JSON[_0x5088('0x13')](_0x1f6c01));if(_0x1f6c01[_0x5088('0x14')]){if(_0x1f6c01[_0x5088('0x14')][_0x5088('0x15')]===0x1f4){logger[_0x5088('0x14')](_0x5088('0xf'),_0x1f7d2e,_0x1f6c01['error'][_0x5088('0x16')]);return _0x1ebf2f(_0x1f6c01['error']['message']);}logger[_0x5088('0x14')]('CloudProvider,\x20%s,\x20%s',_0x1f7d2e,_0x1f6c01['error']['message']);return _0x4f81dc(_0x1f6c01['error']['message']);}else{logger['info'](_0x5088('0xf'),_0x1f7d2e,_0x5088('0x10'));_0x4f81dc(_0x1f6c01[_0x5088('0x17')][_0x5088('0x16')]);}})[_0x5088('0x18')](function(_0x15f192){logger['error']('CloudProvider,\x20%s,\x20%s',_0x1f7d2e,_0x15f192);_0x1ebf2f(_0x15f192);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index bb0a233..2f98a27 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 _0xd46d=['../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x37a149,_0x3be794){var _0x3f2efc=function(_0x30aa19){while(--_0x30aa19){_0x37a149['push'](_0x37a149['shift']());}};_0x3f2efc(++_0x3be794);}(_0xd46d,0x6c));var _0xdd46=function(_0x4445bb,_0x1d23d4){_0x4445bb=_0x4445bb-0x0;var _0x54b20d=_0xd46d[_0x4445bb];return _0x54b20d;};'use strict';var multer=require(_0xdd46('0x0'));var util=require('util');var path=require(_0xdd46('0x1'));var timeout=require(_0xdd46('0x2'));var express=require(_0xdd46('0x3'));var router=express[_0xdd46('0x4')]();var auth=require(_0xdd46('0x5'));var interaction=require(_0xdd46('0x6'));var config=require(_0xdd46('0x7'));var controller=require(_0xdd46('0x8'));router[_0xdd46('0x9')]('/',auth[_0xdd46('0xa')](),controller[_0xdd46('0xb')]);router[_0xdd46('0x9')](_0xdd46('0xc'),auth['isAuthenticated'](),controller[_0xdd46('0xd')]);router[_0xdd46('0xe')]('/',auth['isAuthenticated'](),controller[_0xdd46('0xf')]);router[_0xdd46('0x10')](_0xdd46('0xc'),auth['isAuthenticated'](),controller[_0xdd46('0x11')]);router['delete']('/:id',auth[_0xdd46('0xa')](),controller[_0xdd46('0x12')]);module['exports']=router; \ No newline at end of file +var _0xeb90=['get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1db63c,_0x13cc69){var _0x317989=function(_0x12a802){while(--_0x12a802){_0x1db63c['push'](_0x1db63c['shift']());}};_0x317989(++_0x13cc69);}(_0xeb90,0x1ea));var _0x0eb9=function(_0x45a546,_0x40032a){_0x45a546=_0x45a546-0x0;var _0x51ee6a=_0xeb90[_0x45a546];return _0x51ee6a;};'use strict';var multer=require('multer');var util=require(_0x0eb9('0x0'));var path=require(_0x0eb9('0x1'));var timeout=require(_0x0eb9('0x2'));var express=require(_0x0eb9('0x3'));var router=express[_0x0eb9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0eb9('0x5'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x0eb9('0x6')]('/',auth[_0x0eb9('0x7')](),controller[_0x0eb9('0x8')]);router[_0x0eb9('0x6')](_0x0eb9('0x9'),auth[_0x0eb9('0x7')](),controller[_0x0eb9('0xa')]);router[_0x0eb9('0xb')]('/',auth[_0x0eb9('0x7')](),controller[_0x0eb9('0xc')]);router['put']('/:id',auth[_0x0eb9('0x7')](),controller[_0x0eb9('0xd')]);router[_0x0eb9('0xe')](_0x0eb9('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x0eb9('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c998e89..5778770 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 _0xe6ef=['name','sequelize','exports','STRING'];(function(_0x188363,_0xa749b2){var _0xd21b1b=function(_0x4a6a17){while(--_0x4a6a17){_0x188363['push'](_0x188363['shift']());}};_0xd21b1b(++_0xa749b2);}(_0xe6ef,0x91));var _0xfe6e=function(_0x1046c7,_0x3cd092){_0x1046c7=_0x1046c7-0x0;var _0x4cf13e=_0xe6ef[_0x1046c7];return _0x4cf13e;};'use strict';var Sequelize=require(_0xfe6e('0x0'));module[_0xfe6e('0x1')]={'name':{'type':Sequelize[_0xfe6e('0x2')],'unique':_0xfe6e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfe6e('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfe6e('0x2')]},'phone':{'type':Sequelize[_0xfe6e('0x2')]},'fax':{'type':Sequelize[_0xfe6e('0x2')]},'type':{'type':Sequelize[_0xfe6e('0x2')]},'street':{'type':Sequelize[_0xfe6e('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfe6e('0x2')]},'country':{'type':Sequelize[_0xfe6e('0x2')]},'email':{'type':Sequelize[_0xfe6e('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xfe6e('0x2')]},'sPostalCode':{'type':Sequelize[_0xfe6e('0x2')]},'sCity':{'type':Sequelize[_0xfe6e('0x2')]},'sCountry':{'type':Sequelize[_0xfe6e('0x2')]},'description':{'type':Sequelize[_0xfe6e('0x2')]}}; \ No newline at end of file +var _0x4e41=['sequelize','STRING','name'];(function(_0x1f3b6a,_0xee60e){var _0x5c6fbb=function(_0x19872a){while(--_0x19872a){_0x1f3b6a['push'](_0x1f3b6a['shift']());}};_0x5c6fbb(++_0xee60e);}(_0x4e41,0xa8));var _0x14e4=function(_0x1a68ec,_0x2ab029){_0x1a68ec=_0x1a68ec-0x0;var _0x59ecde=_0x4e41[_0x1a68ec];return _0x59ecde;};'use strict';var Sequelize=require(_0x14e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x14e4('0x1')],'unique':_0x14e4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x14e4('0x1')]},'companyId':{'type':Sequelize[_0x14e4('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x14e4('0x1')]},'fax':{'type':Sequelize[_0x14e4('0x1')]},'type':{'type':Sequelize[_0x14e4('0x1')]},'street':{'type':Sequelize[_0x14e4('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x14e4('0x1')]},'country':{'type':Sequelize[_0x14e4('0x1')]},'email':{'type':Sequelize[_0x14e4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x14e4('0x1')]},'sPostalCode':{'type':Sequelize[_0x14e4('0x1')]},'sCity':{'type':Sequelize[_0x14e4('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14e4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f5daa61..422135d 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 _0x3fc0=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContact','addContacts','ids','omit','getContacts','findOne','pick','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x3fc0,0x13c));var _0x03fc=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x3fc0[_0x36dfbd];return _0x4ecad9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x03fc('0x0'));var zipdir=require(_0x03fc('0x1'));var jsonpatch=require(_0x03fc('0x2'));var rp=require(_0x03fc('0x3'));var moment=require(_0x03fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x03fc('0x5'));var util=require(_0x03fc('0x6'));var path=require(_0x03fc('0x7'));var sox=require(_0x03fc('0x8'));var csv=require('to-csv');var ejs=require(_0x03fc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x03fc('0xa'));var crypto=require(_0x03fc('0xb'));var jsforce=require(_0x03fc('0xc'));var deskjs=require(_0x03fc('0xd'));var toCsv=require(_0x03fc('0xe'));var querystring=require(_0x03fc('0xf'));var Papa=require(_0x03fc('0x10'));var Redis=require(_0x03fc('0x11'));var authService=require(_0x03fc('0x12'));var qs=require(_0x03fc('0x13'));var as=require(_0x03fc('0x14'));var hardwareService=require(_0x03fc('0x15'));var logger=require(_0x03fc('0x16'))(_0x03fc('0x17'));var utils=require(_0x03fc('0x18'));var config=require(_0x03fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1d9f,_0xadb1f3){_0xadb1f3=_0xadb1f3||0xcc;return function(_0x3c2430){if(_0x3c2430){return _0x3c1d9f[_0x03fc('0x1a')](_0xadb1f3);}return _0x3c1d9f[_0x03fc('0x1b')](_0xadb1f3)[_0x03fc('0x1c')]();};}function respondWithResult(_0x4d1381,_0x11e45c){_0x11e45c=_0x11e45c||0xc8;return function(_0x4c8171){if(_0x4c8171){return _0x4d1381[_0x03fc('0x1b')](_0x11e45c)[_0x03fc('0x1d')](_0x4c8171);}};}function respondWithFilteredResult(_0x28c9fa,_0xfb4ee8){return function(_0x3e6902){if(_0x3e6902){var _0x529343=_0x3e6902[_0x03fc('0x1e')],_0x5acb46=_0xfb4ee8[_0x03fc('0x1f')],_0x4d5511=_0xfb4ee8['offset']+_0xfb4ee8[_0x03fc('0x20')],_0x34593d;if(_0x4d5511>=_0x529343){_0x4d5511=_0x529343;_0x34593d=0xc8;}else{_0x34593d=0xce;}_0x28c9fa[_0x03fc('0x1b')](_0x34593d);return _0x28c9fa[_0x03fc('0x21')](_0x03fc('0x22'),_0x5acb46+'-'+_0x4d5511+'/'+_0x529343)[_0x03fc('0x1d')](_0x3e6902);}return null;};}function patchUpdates(_0x26abbe){return function(_0x3a0a19){try{jsonpatch[_0x03fc('0x23')](_0x3a0a19,_0x26abbe,!![]);}catch(_0x16241e){return BPromise[_0x03fc('0x24')](_0x16241e);}return _0x3a0a19[_0x03fc('0x25')]();};}function saveUpdates(_0x400042,_0x4af1e7){return function(_0x40c17a){if(_0x40c17a){return _0x40c17a[_0x03fc('0x26')](_0x400042)[_0x03fc('0x27')](function(_0x1e178d){return _0x1e178d;});}return null;};}function removeEntity(_0x378493,_0xe20747){return function(_0x2e8392){if(_0x2e8392){return _0x2e8392[_0x03fc('0x28')]()[_0x03fc('0x27')](function(){var _0xa188a4=_0x2e8392[_0x03fc('0x29')]({'plain':!![]});var _0x4f0cd6='Companies';return db[_0x03fc('0x2a')][_0x03fc('0x28')]({'where':{'type':_0x4f0cd6,'resourceId':_0xa188a4['id']}})[_0x03fc('0x27')](function(){return _0x2e8392;});})[_0x03fc('0x27')](function(){_0x378493[_0x03fc('0x1b')](0xcc)[_0x03fc('0x1c')]();});}};}function handleEntityNotFound(_0x3f39ea,_0x138bac){return function(_0x2760f9){if(!_0x2760f9){_0x3f39ea['sendStatus'](0x194);}return _0x2760f9;};}function handleError(_0x32015d,_0x3b4059){_0x3b4059=_0x3b4059||0x1f4;return function(_0x422c94){logger[_0x03fc('0x2b')](_0x422c94['stack']);if(_0x422c94[_0x03fc('0x2c')]){delete _0x422c94[_0x03fc('0x2c')];}_0x32015d[_0x03fc('0x1b')](_0x3b4059)[_0x03fc('0x2d')](_0x422c94);};}exports['index']=function(_0x10b2e7,_0x30c96a){var _0x54c16d={},_0x48d1ef={},_0x58e602={'count':0x0,'rows':[]};return db[_0x03fc('0x2e')][_0x03fc('0x2f')]()[_0x03fc('0x27')](function(_0x4b91ce){_0x48d1ef[_0x03fc('0x30')]=_[_0x03fc('0x31')](_0x4b91ce);_0x48d1ef[_0x03fc('0x32')]=_['keys'](_0x10b2e7[_0x03fc('0x32')]);_0x48d1ef['filters']=_[_0x03fc('0x33')](_0x48d1ef[_0x03fc('0x30')],_0x48d1ef[_0x03fc('0x32')]);_0x54c16d[_0x03fc('0x34')]=_['intersection'](_0x48d1ef[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x10b2e7['query'][_0x03fc('0x35')]));_0x54c16d[_0x03fc('0x34')]=_0x54c16d['attributes'][_0x03fc('0x36')]?_0x54c16d['attributes']:_0x48d1ef[_0x03fc('0x30')];if(!_0x10b2e7['query'][_0x03fc('0x37')]('nolimit')){_0x54c16d[_0x03fc('0x20')]=qs[_0x03fc('0x20')](_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x20')]);_0x54c16d[_0x03fc('0x1f')]=qs[_0x03fc('0x1f')](_0x10b2e7[_0x03fc('0x32')]['offset']);}_0x54c16d[_0x03fc('0x38')]=qs[_0x03fc('0x39')](_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x39')]);_0x54c16d[_0x03fc('0x3a')]=qs[_0x03fc('0x3b')](_['pick'](_0x10b2e7['query'],_0x48d1ef[_0x03fc('0x3b')]),_0x4b91ce);if(_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x3c')]){_0x54c16d[_0x03fc('0x3a')]=_[_0x03fc('0x3d')](_0x54c16d[_0x03fc('0x3a')],{'$or':_['map'](_0x54c16d[_0x03fc('0x34')],function(_0x1484cf){var _0x5401a1={};_0x5401a1[_0x1484cf]={'$like':'%'+_0x10b2e7['query'][_0x03fc('0x3c')]+'%'};return _0x5401a1;})});}_0x54c16d=_[_0x03fc('0x3d')]({},_0x54c16d,_0x10b2e7[_0x03fc('0x3e')]);var _0x17c62c={'where':_0x54c16d[_0x03fc('0x3a')]};return db[_0x03fc('0x2e')][_0x03fc('0x1e')](_0x17c62c)[_0x03fc('0x27')](function(_0x143f17){_0x58e602[_0x03fc('0x1e')]=_0x143f17;if(_0x10b2e7[_0x03fc('0x32')][_0x03fc('0x3f')]){_0x54c16d[_0x03fc('0x40')]=[{'all':!![]}];}return db[_0x03fc('0x2e')][_0x03fc('0x41')](_0x54c16d);})[_0x03fc('0x27')](function(_0x462632){_0x58e602[_0x03fc('0x42')]=_0x462632;return _0x58e602;})['then'](respondWithFilteredResult(_0x30c96a,_0x54c16d))['catch'](handleError(_0x30c96a,null));})[_0x03fc('0x43')](handleError(_0x30c96a,null));};exports[_0x03fc('0x44')]=function(_0x2e3245,_0x54f5a4){var _0x2958d5={'raw':![],'where':{'id':_0x2e3245['params']['id']}},_0xe6c2c0={};_0xe6c2c0[_0x03fc('0x30')]=_['keys'](db['CmCompany'][_0x03fc('0x45')]);_0xe6c2c0[_0x03fc('0x32')]=_[_0x03fc('0x31')](_0x2e3245[_0x03fc('0x32')]);_0xe6c2c0[_0x03fc('0x3b')]=_[_0x03fc('0x33')](_0xe6c2c0['model'],_0xe6c2c0[_0x03fc('0x32')]);_0x2958d5[_0x03fc('0x34')]=_['intersection'](_0xe6c2c0[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x2e3245[_0x03fc('0x32')]['fields']));_0x2958d5[_0x03fc('0x34')]=_0x2958d5[_0x03fc('0x34')][_0x03fc('0x36')]?_0x2958d5['attributes']:_0xe6c2c0['model'];if(_0x2e3245[_0x03fc('0x32')][_0x03fc('0x3f')]){_0x2958d5[_0x03fc('0x40')]=[{'all':!![]}];}_0x2958d5=_[_0x03fc('0x3d')]({},_0x2958d5,_0x2e3245[_0x03fc('0x3e')]);return db['CmCompany'][_0x03fc('0x46')](_0x2958d5)[_0x03fc('0x27')](handleEntityNotFound(_0x54f5a4,null))[_0x03fc('0x27')](respondWithResult(_0x54f5a4,null))[_0x03fc('0x43')](handleError(_0x54f5a4,null));};exports['create']=function(_0x4fdc10,_0xb31356){return db[_0x03fc('0x2e')][_0x03fc('0x47')](_0x4fdc10[_0x03fc('0x48')],{})[_0x03fc('0x27')](function(_0xd086b){var _0x126330=_0x4fdc10['user'][_0x03fc('0x29')]({'plain':!![]});if(!_0x126330)throw new Error(_0x03fc('0x49'));if(_0x126330[_0x03fc('0x4a')]===_0x03fc('0x4b')){var _0xbc3ab7=_0xd086b['get']({'plain':!![]});var _0x204feb=_0x03fc('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x204feb,'userProfileId':_0x126330['userProfileId']},'raw':!![]})[_0x03fc('0x27')](function(_0x4d5bfb){if(_0x4d5bfb&&_0x4d5bfb['autoAssociation']===0x0){return db[_0x03fc('0x2a')][_0x03fc('0x47')]({'name':_0xbc3ab7[_0x03fc('0x2c')],'resourceId':_0xbc3ab7['id'],'type':_0x4d5bfb[_0x03fc('0x2c')],'sectionId':_0x4d5bfb['id']},{})[_0x03fc('0x27')](function(){return _0xd086b;});}else{return _0xd086b;}})[_0x03fc('0x43')](function(_0x2bf7d){logger[_0x03fc('0x2b')](_0x03fc('0x4d'),_0x2bf7d);throw _0x2bf7d;});}return _0xd086b;})[_0x03fc('0x27')](respondWithResult(_0xb31356,0xc9))['catch'](handleError(_0xb31356,null));};exports[_0x03fc('0x26')]=function(_0x2b7477,_0x43fcfc){if(_0x2b7477[_0x03fc('0x48')]['id']){delete _0x2b7477[_0x03fc('0x48')]['id'];}return db[_0x03fc('0x2e')][_0x03fc('0x46')]({'where':{'id':_0x2b7477['params']['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x43fcfc,null))[_0x03fc('0x27')](saveUpdates(_0x2b7477['body'],null))[_0x03fc('0x27')](respondWithResult(_0x43fcfc,null))[_0x03fc('0x43')](handleError(_0x43fcfc,null));};exports[_0x03fc('0x28')]=function(_0xb1bba2,_0x209ccc){return db[_0x03fc('0x2e')][_0x03fc('0x46')]({'where':{'id':_0xb1bba2[_0x03fc('0x4e')]['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x209ccc,null))['then'](removeEntity(_0x209ccc,null))['catch'](handleError(_0x209ccc,null));};exports[_0x03fc('0x2f')]=function(_0x377e43,_0x327f0a){return db[_0x03fc('0x2e')][_0x03fc('0x2f')]()[_0x03fc('0x27')](respondWithResult(_0x327f0a,null))['catch'](handleError(_0x327f0a,null));};exports['addContacts']=function(_0x3bf80d,_0x105d11,_0x406c7d){return db[_0x03fc('0x4f')]['find']({'where':{'id':_0x3bf80d[_0x03fc('0x4e')]['id']}})[_0x03fc('0x27')](handleEntityNotFound(_0x105d11,null))[_0x03fc('0x27')](function(_0x352de1){if(_0x352de1){return _0x352de1[_0x03fc('0x50')](_0x3bf80d[_0x03fc('0x48')][_0x03fc('0x51')],_[_0x03fc('0x52')](_0x3bf80d[_0x03fc('0x48')],[_0x03fc('0x51'),'id'])||{});}})[_0x03fc('0x27')](respondWithResult(_0x105d11,null))['catch'](handleError(_0x105d11,null));};exports[_0x03fc('0x53')]=function(_0x595de5,_0x18b2c8,_0x4b75bc){var _0x17626b={};var _0x945498={};var _0x31e665;var _0x108f81;return db[_0x03fc('0x2e')][_0x03fc('0x54')]({'where':{'id':_0x595de5[_0x03fc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x18b2c8,null))[_0x03fc('0x27')](function(_0x1ebef4){if(_0x1ebef4){_0x31e665=_0x1ebef4;_0x945498['model']=_[_0x03fc('0x31')](db[_0x03fc('0x4f')][_0x03fc('0x45')]);_0x945498[_0x03fc('0x32')]=_['keys'](_0x595de5[_0x03fc('0x32')]);_0x945498['filters']=_[_0x03fc('0x33')](_0x945498[_0x03fc('0x30')],_0x945498[_0x03fc('0x32')]);_0x17626b[_0x03fc('0x34')]=_[_0x03fc('0x33')](_0x945498[_0x03fc('0x30')],qs[_0x03fc('0x35')](_0x595de5[_0x03fc('0x32')][_0x03fc('0x35')]));_0x17626b[_0x03fc('0x34')]=_0x17626b[_0x03fc('0x34')][_0x03fc('0x36')]?_0x17626b[_0x03fc('0x34')]:_0x945498[_0x03fc('0x30')];_0x17626b[_0x03fc('0x38')]=qs[_0x03fc('0x39')](_0x595de5[_0x03fc('0x32')]['sort']);_0x17626b[_0x03fc('0x3a')]=qs[_0x03fc('0x3b')](_[_0x03fc('0x55')](_0x595de5['query'],_0x945498[_0x03fc('0x3b')]));if(_0x595de5[_0x03fc('0x32')][_0x03fc('0x3c')]){_0x17626b['where']=_[_0x03fc('0x3d')](_0x17626b[_0x03fc('0x3a')],{'$or':_[_0x03fc('0x56')](_0x17626b[_0x03fc('0x34')],function(_0x5980ec){var _0x15c8b6={};_0x15c8b6[_0x5980ec]={'$like':'%'+_0x595de5['query'][_0x03fc('0x3c')]+'%'};return _0x15c8b6;})});}_0x17626b=_['merge']({},_0x17626b,_0x595de5[_0x03fc('0x3e')]);return _0x31e665[_0x03fc('0x53')](_0x17626b);}})[_0x03fc('0x27')](function(_0x3204da){if(_0x3204da){_0x108f81=_0x3204da[_0x03fc('0x36')];if(!_0x595de5[_0x03fc('0x32')][_0x03fc('0x37')]('nolimit')){_0x17626b[_0x03fc('0x20')]=qs[_0x03fc('0x20')](_0x595de5[_0x03fc('0x32')]['limit']);_0x17626b['offset']=qs[_0x03fc('0x1f')](_0x595de5[_0x03fc('0x32')]['offset']);}return _0x31e665[_0x03fc('0x53')](_0x17626b);}})[_0x03fc('0x27')](function(_0x38fae2){if(_0x38fae2){return _0x38fae2?{'count':_0x108f81,'rows':_0x38fae2}:null;}})['then'](respondWithResult(_0x18b2c8,null))[_0x03fc('0x43')](handleError(_0x18b2c8,null));}; \ No newline at end of file +var _0x38c5=['count','offset','limit','apply','reject','update','then','get','Companies','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','map','options','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addContacts','CmContact','omit','getContacts','filter','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json'];(function(_0x1d78b2,_0x3754d6){var _0x111d85=function(_0x59718b){while(--_0x59718b){_0x1d78b2['push'](_0x1d78b2['shift']());}};_0x111d85(++_0x3754d6);}(_0x38c5,0x12f));var _0x538c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38c5[_0x3b380d];return _0x54502b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x538c('0x0'));var zipdir=require(_0x538c('0x1'));var jsonpatch=require(_0x538c('0x2'));var rp=require(_0x538c('0x3'));var moment=require('moment');var BPromise=require(_0x538c('0x4'));var Mustache=require('mustache');var util=require(_0x538c('0x5'));var path=require(_0x538c('0x6'));var sox=require(_0x538c('0x7'));var csv=require(_0x538c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x538c('0x9'));var squel=require(_0x538c('0xa'));var crypto=require(_0x538c('0xb'));var jsforce=require(_0x538c('0xc'));var deskjs=require(_0x538c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x538c('0xe'));var authService=require(_0x538c('0xf'));var qs=require(_0x538c('0x10'));var as=require(_0x538c('0x11'));var hardwareService=require(_0x538c('0x12'));var logger=require(_0x538c('0x13'))('api');var utils=require(_0x538c('0x14'));var config=require(_0x538c('0x15'));var db=require(_0x538c('0x16'))['db'];function respondWithStatusCode(_0x59f54c,_0x2fe3e8){_0x2fe3e8=_0x2fe3e8||0xcc;return function(_0x2f3b45){if(_0x2f3b45){return _0x59f54c['sendStatus'](_0x2fe3e8);}return _0x59f54c[_0x538c('0x17')](_0x2fe3e8)['end']();};}function respondWithResult(_0x31017a,_0x1b1415){_0x1b1415=_0x1b1415||0xc8;return function(_0x417cd9){if(_0x417cd9){return _0x31017a[_0x538c('0x17')](_0x1b1415)[_0x538c('0x18')](_0x417cd9);}};}function respondWithFilteredResult(_0xb52df8,_0x4694fe){return function(_0x235901){if(_0x235901){var _0x23464b=_0x235901[_0x538c('0x19')],_0x532a42=_0x4694fe[_0x538c('0x1a')],_0x33197a=_0x4694fe[_0x538c('0x1a')]+_0x4694fe[_0x538c('0x1b')],_0x15d63c;if(_0x33197a>=_0x23464b){_0x33197a=_0x23464b;_0x15d63c=0xc8;}else{_0x15d63c=0xce;}_0xb52df8['status'](_0x15d63c);return _0xb52df8['set']('Content-Range',_0x532a42+'-'+_0x33197a+'/'+_0x23464b)[_0x538c('0x18')](_0x235901);}return null;};}function patchUpdates(_0xeae795){return function(_0x11fd0f){try{jsonpatch[_0x538c('0x1c')](_0x11fd0f,_0xeae795,!![]);}catch(_0x12ff3d){return BPromise[_0x538c('0x1d')](_0x12ff3d);}return _0x11fd0f['save']();};}function saveUpdates(_0x2cc31d,_0x5502b7){return function(_0xd9dcbf){if(_0xd9dcbf){return _0xd9dcbf[_0x538c('0x1e')](_0x2cc31d)[_0x538c('0x1f')](function(_0x4f20d1){return _0x4f20d1;});}return null;};}function removeEntity(_0x470af0,_0x26ff22){return function(_0xd157de){if(_0xd157de){return _0xd157de['destroy']()[_0x538c('0x1f')](function(){var _0x5eb8c2=_0xd157de[_0x538c('0x20')]({'plain':!![]});var _0x24f4e4=_0x538c('0x21');return db[_0x538c('0x22')][_0x538c('0x23')]({'where':{'type':_0x24f4e4,'resourceId':_0x5eb8c2['id']}})['then'](function(){return _0xd157de;});})[_0x538c('0x1f')](function(){_0x470af0[_0x538c('0x17')](0xcc)[_0x538c('0x24')]();});}};}function handleEntityNotFound(_0x5204e3,_0x8a7630){return function(_0xadbd25){if(!_0xadbd25){_0x5204e3[_0x538c('0x25')](0x194);}return _0xadbd25;};}function handleError(_0x263764,_0x34b167){_0x34b167=_0x34b167||0x1f4;return function(_0xc2ec9d){logger[_0x538c('0x26')](_0xc2ec9d[_0x538c('0x27')]);if(_0xc2ec9d[_0x538c('0x28')]){delete _0xc2ec9d['name'];}_0x263764['status'](_0x34b167)[_0x538c('0x29')](_0xc2ec9d);};}exports[_0x538c('0x2a')]=function(_0x4d0ffa,_0x59564c){var _0x5a98dc={},_0x47383a={},_0x5d4230={'count':0x0,'rows':[]};return db[_0x538c('0x2b')][_0x538c('0x2c')]()[_0x538c('0x1f')](function(_0x277f88){_0x47383a[_0x538c('0x2d')]=_[_0x538c('0x2e')](_0x277f88);_0x47383a['query']=_[_0x538c('0x2e')](_0x4d0ffa[_0x538c('0x2f')]);_0x47383a[_0x538c('0x30')]=_[_0x538c('0x31')](_0x47383a[_0x538c('0x2d')],_0x47383a[_0x538c('0x2f')]);_0x5a98dc['attributes']=_[_0x538c('0x31')](_0x47383a[_0x538c('0x2d')],qs[_0x538c('0x32')](_0x4d0ffa[_0x538c('0x2f')][_0x538c('0x32')]));_0x5a98dc[_0x538c('0x33')]=_0x5a98dc[_0x538c('0x33')]['length']?_0x5a98dc['attributes']:_0x47383a[_0x538c('0x2d')];if(!_0x4d0ffa['query'][_0x538c('0x34')]('nolimit')){_0x5a98dc[_0x538c('0x1b')]=qs['limit'](_0x4d0ffa[_0x538c('0x2f')][_0x538c('0x1b')]);_0x5a98dc[_0x538c('0x1a')]=qs[_0x538c('0x1a')](_0x4d0ffa[_0x538c('0x2f')]['offset']);}_0x5a98dc[_0x538c('0x35')]=qs['sort'](_0x4d0ffa[_0x538c('0x2f')][_0x538c('0x36')]);_0x5a98dc[_0x538c('0x37')]=qs['filters'](_[_0x538c('0x38')](_0x4d0ffa[_0x538c('0x2f')],_0x47383a[_0x538c('0x30')]),_0x277f88);if(_0x4d0ffa['query']['filter']){_0x5a98dc[_0x538c('0x37')]=_[_0x538c('0x39')](_0x5a98dc[_0x538c('0x37')],{'$or':_[_0x538c('0x3a')](_0x5a98dc[_0x538c('0x33')],function(_0x46d56b){var _0x3e7bb3={};_0x3e7bb3[_0x46d56b]={'$like':'%'+_0x4d0ffa[_0x538c('0x2f')]['filter']+'%'};return _0x3e7bb3;})});}_0x5a98dc=_[_0x538c('0x39')]({},_0x5a98dc,_0x4d0ffa[_0x538c('0x3b')]);var _0x16a406={'where':_0x5a98dc[_0x538c('0x37')]};return db['CmCompany'][_0x538c('0x19')](_0x16a406)[_0x538c('0x1f')](function(_0x5b90d0){_0x5d4230['count']=_0x5b90d0;if(_0x4d0ffa[_0x538c('0x2f')]['includeAll']){_0x5a98dc[_0x538c('0x3c')]=[{'all':!![]}];}return db[_0x538c('0x2b')][_0x538c('0x3d')](_0x5a98dc);})['then'](function(_0x48cdd6){_0x5d4230[_0x538c('0x3e')]=_0x48cdd6;return _0x5d4230;})[_0x538c('0x1f')](respondWithFilteredResult(_0x59564c,_0x5a98dc))[_0x538c('0x3f')](handleError(_0x59564c,null));})[_0x538c('0x3f')](handleError(_0x59564c,null));};exports['show']=function(_0x53fcef,_0x2fe70a){var _0x1653ac={'raw':![],'where':{'id':_0x53fcef[_0x538c('0x40')]['id']}},_0x3f0650={};_0x3f0650[_0x538c('0x2d')]=_[_0x538c('0x2e')](db[_0x538c('0x2b')][_0x538c('0x41')]);_0x3f0650['query']=_[_0x538c('0x2e')](_0x53fcef[_0x538c('0x2f')]);_0x3f0650[_0x538c('0x30')]=_[_0x538c('0x31')](_0x3f0650[_0x538c('0x2d')],_0x3f0650[_0x538c('0x2f')]);_0x1653ac[_0x538c('0x33')]=_['intersection'](_0x3f0650[_0x538c('0x2d')],qs[_0x538c('0x32')](_0x53fcef[_0x538c('0x2f')][_0x538c('0x32')]));_0x1653ac['attributes']=_0x1653ac[_0x538c('0x33')][_0x538c('0x42')]?_0x1653ac[_0x538c('0x33')]:_0x3f0650['model'];if(_0x53fcef[_0x538c('0x2f')][_0x538c('0x43')]){_0x1653ac[_0x538c('0x3c')]=[{'all':!![]}];}_0x1653ac=_[_0x538c('0x39')]({},_0x1653ac,_0x53fcef['options']);return db[_0x538c('0x2b')]['find'](_0x1653ac)[_0x538c('0x1f')](handleEntityNotFound(_0x2fe70a,null))[_0x538c('0x1f')](respondWithResult(_0x2fe70a,null))['catch'](handleError(_0x2fe70a,null));};exports[_0x538c('0x44')]=function(_0x4b8b56,_0x271f85){return db[_0x538c('0x2b')][_0x538c('0x44')](_0x4b8b56[_0x538c('0x45')],{})['then'](function(_0x56f2d1){var _0x5ebbc3=_0x4b8b56['user'][_0x538c('0x20')]({'plain':!![]});if(!_0x5ebbc3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ebbc3[_0x538c('0x46')]==='user'){var _0x16c1a9=_0x56f2d1[_0x538c('0x20')]({'plain':!![]});var _0xb786bd='Companies';return db[_0x538c('0x47')]['find']({'where':{'name':_0xb786bd,'userProfileId':_0x5ebbc3[_0x538c('0x48')]},'raw':!![]})['then'](function(_0x43083d){if(_0x43083d&&_0x43083d[_0x538c('0x49')]===0x0){return db[_0x538c('0x22')][_0x538c('0x44')]({'name':_0x16c1a9['name'],'resourceId':_0x16c1a9['id'],'type':_0x43083d['name'],'sectionId':_0x43083d['id']},{})[_0x538c('0x1f')](function(){return _0x56f2d1;});}else{return _0x56f2d1;}})[_0x538c('0x3f')](function(_0x37b5dc){logger[_0x538c('0x26')](_0x538c('0x4a'),_0x37b5dc);throw _0x37b5dc;});}return _0x56f2d1;})['then'](respondWithResult(_0x271f85,0xc9))[_0x538c('0x3f')](handleError(_0x271f85,null));};exports[_0x538c('0x1e')]=function(_0x3684e8,_0x2d2580){if(_0x3684e8['body']['id']){delete _0x3684e8['body']['id'];}return db[_0x538c('0x2b')][_0x538c('0x4b')]({'where':{'id':_0x3684e8['params']['id']}})[_0x538c('0x1f')](handleEntityNotFound(_0x2d2580,null))[_0x538c('0x1f')](saveUpdates(_0x3684e8['body'],null))[_0x538c('0x1f')](respondWithResult(_0x2d2580,null))['catch'](handleError(_0x2d2580,null));};exports['destroy']=function(_0x14f5a2,_0x18d3fe){return db[_0x538c('0x2b')][_0x538c('0x4b')]({'where':{'id':_0x14f5a2[_0x538c('0x40')]['id']}})['then'](handleEntityNotFound(_0x18d3fe,null))[_0x538c('0x1f')](removeEntity(_0x18d3fe,null))[_0x538c('0x3f')](handleError(_0x18d3fe,null));};exports[_0x538c('0x2c')]=function(_0x2afa07,_0x586339){return db[_0x538c('0x2b')][_0x538c('0x2c')]()[_0x538c('0x1f')](respondWithResult(_0x586339,null))['catch'](handleError(_0x586339,null));};exports[_0x538c('0x4c')]=function(_0x32f025,_0x3d2b47,_0x199d86){return db[_0x538c('0x4d')][_0x538c('0x4b')]({'where':{'id':_0x32f025['params']['id']}})[_0x538c('0x1f')](handleEntityNotFound(_0x3d2b47,null))[_0x538c('0x1f')](function(_0x3ed687){if(_0x3ed687){return _0x3ed687[_0x538c('0x4c')](_0x32f025['body']['ids'],_[_0x538c('0x4e')](_0x32f025[_0x538c('0x45')],['ids','id'])||{});}})[_0x538c('0x1f')](respondWithResult(_0x3d2b47,null))[_0x538c('0x3f')](handleError(_0x3d2b47,null));};exports[_0x538c('0x4f')]=function(_0x538510,_0x5a866c,_0x3467b3){var _0xa490b6={};var _0x4df8da={};var _0x3a2f83;var _0x502215;return db[_0x538c('0x2b')]['findOne']({'where':{'id':_0x538510[_0x538c('0x40')]['id']}})[_0x538c('0x1f')](handleEntityNotFound(_0x5a866c,null))[_0x538c('0x1f')](function(_0x22764c){if(_0x22764c){_0x3a2f83=_0x22764c;_0x4df8da[_0x538c('0x2d')]=_[_0x538c('0x2e')](db[_0x538c('0x4d')][_0x538c('0x41')]);_0x4df8da[_0x538c('0x2f')]=_['keys'](_0x538510[_0x538c('0x2f')]);_0x4df8da[_0x538c('0x30')]=_['intersection'](_0x4df8da['model'],_0x4df8da['query']);_0xa490b6[_0x538c('0x33')]=_[_0x538c('0x31')](_0x4df8da[_0x538c('0x2d')],qs[_0x538c('0x32')](_0x538510[_0x538c('0x2f')][_0x538c('0x32')]));_0xa490b6[_0x538c('0x33')]=_0xa490b6[_0x538c('0x33')][_0x538c('0x42')]?_0xa490b6['attributes']:_0x4df8da[_0x538c('0x2d')];_0xa490b6[_0x538c('0x35')]=qs[_0x538c('0x36')](_0x538510[_0x538c('0x2f')][_0x538c('0x36')]);_0xa490b6[_0x538c('0x37')]=qs[_0x538c('0x30')](_[_0x538c('0x38')](_0x538510[_0x538c('0x2f')],_0x4df8da[_0x538c('0x30')]));if(_0x538510[_0x538c('0x2f')][_0x538c('0x50')]){_0xa490b6[_0x538c('0x37')]=_[_0x538c('0x39')](_0xa490b6[_0x538c('0x37')],{'$or':_['map'](_0xa490b6['attributes'],function(_0x3bd027){var _0x467d0d={};_0x467d0d[_0x3bd027]={'$like':'%'+_0x538510[_0x538c('0x2f')][_0x538c('0x50')]+'%'};return _0x467d0d;})});}_0xa490b6=_[_0x538c('0x39')]({},_0xa490b6,_0x538510[_0x538c('0x3b')]);return _0x3a2f83[_0x538c('0x4f')](_0xa490b6);}})[_0x538c('0x1f')](function(_0xd1bf4a){if(_0xd1bf4a){_0x502215=_0xd1bf4a[_0x538c('0x42')];if(!_0x538510['query'][_0x538c('0x34')](_0x538c('0x51'))){_0xa490b6[_0x538c('0x1b')]=qs['limit'](_0x538510[_0x538c('0x2f')][_0x538c('0x1b')]);_0xa490b6['offset']=qs[_0x538c('0x1a')](_0x538510[_0x538c('0x2f')][_0x538c('0x1a')]);}return _0x3a2f83[_0x538c('0x4f')](_0xa490b6);}})[_0x538c('0x1f')](function(_0x2506a3){if(_0x2506a3){return _0x2506a3?{'count':_0x502215,'rows':_0x2506a3}:null;}})[_0x538c('0x1f')](respondWithResult(_0x5a866c,null))[_0x538c('0x3f')](handleError(_0x5a866c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 41729f7..b4ca1f2 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 _0xc5c4=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xc5c4,0x65));var _0x4c5c=function(_0x44cb15,_0x47d0bf){_0x44cb15=_0x44cb15-0x0;var _0x1e1e68=_0xc5c4[_0x44cb15];return _0x1e1e68;};'use strict';var _=require('lodash');var util=require(_0x4c5c('0x0'));var logger=require(_0x4c5c('0x1'))(_0x4c5c('0x2'));var moment=require(_0x4c5c('0x3'));var BPromise=require(_0x4c5c('0x4'));var rp=require(_0x4c5c('0x5'));var fs=require('fs');var path=require(_0x4c5c('0x6'));var rimraf=require('rimraf');var config=require(_0x4c5c('0x7'));var attributes=require(_0x4c5c('0x8'));module[_0x4c5c('0x9')]=function(_0x25476b,_0xc1c5c9){return _0x25476b[_0x4c5c('0xa')](_0x4c5c('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7605=['bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','util','api','moment'];(function(_0x370a26,_0x1689ec){var _0x4ff66c=function(_0x2684ef){while(--_0x2684ef){_0x370a26['push'](_0x370a26['shift']());}};_0x4ff66c(++_0x1689ec);}(_0x7605,0x131));var _0x5760=function(_0x514049,_0xa288a0){_0x514049=_0x514049-0x0;var _0x48dae6=_0x7605[_0x514049];return _0x48dae6;};'use strict';var _=require('lodash');var util=require(_0x5760('0x0'));var logger=require('../../config/logger')(_0x5760('0x1'));var moment=require(_0x5760('0x2'));var BPromise=require(_0x5760('0x3'));var rp=require(_0x5760('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5760('0x5'));var config=require(_0x5760('0x6'));var attributes=require(_0x5760('0x7'));module[_0x5760('0x8')]=function(_0x2e7f74,_0x280e10){return _0x2e7f74[_0x5760('0x9')]('CmCompany',attributes,{'tableName':_0x5760('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 5740849..74f2c94 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 _0x1c57=['request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1c57,0x170));var _0x71c5=function(_0x2956fe,_0x1c4a6d){_0x2956fe=_0x2956fe-0x0;var _0x53f056=_0x1c57[_0x2956fe];return _0x53f056;};'use strict';var _=require(_0x71c5('0x0'));var util=require('util');var moment=require(_0x71c5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71c5('0x2'));var db=require(_0x71c5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x71c5('0x4'));var config=require(_0x71c5('0x5'));var jayson=require(_0x71c5('0x6'));var client=jayson[_0x71c5('0x7')][_0x71c5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58c86b,_0x158c13,_0x1e8104){return new BPromise(function(_0x36f34b,_0xb7b8d7){return client['request'](_0x58c86b,_0x1e8104)[_0x71c5('0x9')](function(_0x3f5a99){logger[_0x71c5('0xa')](_0x71c5('0xb'),_0x158c13,_0x71c5('0xc'));logger['debug'](_0x71c5('0xd'),_0x158c13,_0x71c5('0xc'),JSON[_0x71c5('0xe')](_0x3f5a99));if(_0x3f5a99[_0x71c5('0xf')]){if(_0x3f5a99['error'][_0x71c5('0x10')]===0x1f4){logger[_0x71c5('0xf')]('CmCompany,\x20%s,\x20%s',_0x158c13,_0x3f5a99['error'][_0x71c5('0x11')]);return _0xb7b8d7(_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);}logger[_0x71c5('0xf')](_0x71c5('0xb'),_0x158c13,_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);return _0x36f34b(_0x3f5a99[_0x71c5('0xf')][_0x71c5('0x11')]);}else{logger['info'](_0x71c5('0xb'),_0x158c13,'request\x20sent');_0x36f34b(_0x3f5a99[_0x71c5('0x12')][_0x71c5('0x11')]);}})[_0x71c5('0x13')](function(_0x165334){logger[_0x71c5('0xf')](_0x71c5('0xb'),_0x158c13,_0x165334);_0xb7b8d7(_0x165334);});});} \ No newline at end of file +var _0x13e7=['request','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x2e75d7,_0x3c84a1){var _0xad8375=function(_0x410b95){while(--_0x410b95){_0x2e75d7['push'](_0x2e75d7['shift']());}};_0xad8375(++_0x3c84a1);}(_0x13e7,0x69));var _0x713e=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x13e7[_0x5951e8];return _0x20a1f5;};'use strict';var _=require('lodash');var util=require(_0x713e('0x0'));var moment=require(_0x713e('0x1'));var BPromise=require(_0x713e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x713e('0x4'));var logger=require(_0x713e('0x5'))(_0x713e('0x6'));var config=require(_0x713e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x713e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc993f7,_0x4ee8db,_0x4caca4){return new BPromise(function(_0xc07d6e,_0x5c054c){return client[_0x713e('0x9')](_0xc993f7,_0x4caca4)['then'](function(_0x2917fb){logger[_0x713e('0xa')]('CmCompany,\x20%s,\x20%s',_0x4ee8db,'request\x20sent');logger[_0x713e('0xb')](_0x713e('0xc'),_0x4ee8db,'request\x20sent',JSON['stringify'](_0x2917fb));if(_0x2917fb[_0x713e('0xd')]){if(_0x2917fb['error'][_0x713e('0xe')]===0x1f4){logger[_0x713e('0xd')](_0x713e('0xf'),_0x4ee8db,_0x2917fb[_0x713e('0xd')][_0x713e('0x10')]);return _0x5c054c(_0x2917fb['error'][_0x713e('0x10')]);}logger['error'](_0x713e('0xf'),_0x4ee8db,_0x2917fb['error'][_0x713e('0x10')]);return _0xc07d6e(_0x2917fb[_0x713e('0xd')][_0x713e('0x10')]);}else{logger[_0x713e('0xa')](_0x713e('0xf'),_0x4ee8db,_0x713e('0x11'));_0xc07d6e(_0x2917fb['result'][_0x713e('0x10')]);}})[_0x713e('0x12')](function(_0x332c52){logger[_0x713e('0xd')](_0x713e('0xf'),_0x4ee8db,_0x332c52);_0x5c054c(_0x332c52);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b06f28e..89a367f 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x65ca71,_0x126845){_0x65ca71=_0x65ca71-0x0;var _0x5cb16e=_0x55ca[_0x65ca71];return _0x5cb16e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file +var _0x7217=['Router','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','post','create','addContacts','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2bc2bd,_0x19399c){var _0x51cd45=function(_0x173d7e){while(--_0x173d7e){_0x2bc2bd['push'](_0x2bc2bd['shift']());}};_0x51cd45(++_0x19399c);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'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('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['getContacts']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xf')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router['delete'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);module[_0x7721('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 03a956f..522abfb 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 _0x075e=['exports','STRING','TEXT','INTEGER','DATE','NOW'];(function(_0x127235,_0x1662ac){var _0x200234=function(_0x359be8){while(--_0x359be8){_0x127235['push'](_0x127235['shift']());}};_0x200234(++_0x1662ac);}(_0x075e,0x1a4));var _0xe075=function(_0x5c3db8,_0x203731){_0x5c3db8=_0x5c3db8-0x0;var _0x439513=_0x075e[_0x5c3db8];return _0x439513;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xe075('0x0')]={'firstName':{'type':Sequelize[_0xe075('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe075('0x1')]},'postalCode':{'type':Sequelize[_0xe075('0x1')]},'city':{'type':Sequelize[_0xe075('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xe075('0x1')]},'description':{'type':Sequelize[_0xe075('0x2')]},'phone':{'type':Sequelize[_0xe075('0x1')]},'mobile':{'type':Sequelize[_0xe075('0x1')]},'fax':{'type':Sequelize[_0xe075('0x1')]},'email':{'type':Sequelize[_0xe075('0x1')]},'url':{'type':Sequelize[_0xe075('0x1')]},'facebook':{'type':Sequelize[_0xe075('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xe075('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xe075('0x1')]},'line':{'type':Sequelize[_0xe075('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xe075('0x1')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xe075('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe075('0x4')],'defaultValue':Sequelize[_0xe075('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5ec6=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x5d6f63,_0x4b07e8){var _0x37d392=function(_0x28e146){while(--_0x28e146){_0x5d6f63['push'](_0x5d6f63['shift']());}};_0x37d392(++_0x4b07e8);}(_0x5ec6,0x7f));var _0x65ec=function(_0x4f0537,_0x5050c6){_0x4f0537=_0x4f0537-0x0;var _0x2ba26b=_0x5ec6[_0x4f0537];return _0x2ba26b;};'use strict';var _=require(_0x65ec('0x0'));var Sequelize=require(_0x65ec('0x1'));module[_0x65ec('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x65ec('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x65ec('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x65ec('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65ec('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x65ec('0x3')]},'fax':{'type':Sequelize[_0x65ec('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x65ec('0x3')]},'facebook':{'type':Sequelize[_0x65ec('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x65ec('0x3')]},'skype':{'type':Sequelize[_0x65ec('0x3')]},'teams':{'type':Sequelize[_0x65ec('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x65ec('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x65ec('0x5')]},'priority':{'type':Sequelize[_0x65ec('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x65ec('0x6')],'defaultValue':Sequelize[_0x65ec('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x65ec('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 51654d4..1b5f1d4 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 _0x69af=['html-pdf','eml-format','zip-dir','request-promise','moment','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','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','count','offset','status','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','field','color','from','tools_tags','select','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','parseSearch','search','conditions','Tag','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','tag','filter','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.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','merge','CmContact','c.firstName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','params','tags','columnName','displayName','alias','custom','values','body','findAll','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','create','bulkCreate','each','duplicates','$or','findOrCreate','error','show','$and','omit','format','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','options','setTags','ids','getHoppers','rawAttributes','ContactId','include','includeAll','getHopperFinals','CmHopperFinal','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','meta','import','agent','binding','firstName','stringify','message','start\x20child\x20process\x20correctly!','pid'];(function(_0x1b233f,_0x3bb003){var _0xb23b1f=function(_0x557cbe){while(--_0x557cbe){_0x1b233f['push'](_0x1b233f['shift']());}};_0xb23b1f(++_0x3bb003);}(_0x69af,0xf0));var _0xf69a=function(_0x2327e8,_0x5c4b14){_0x2327e8=_0x2327e8-0x0;var _0x36bd47=_0x69af[_0x2327e8];return _0x36bd47;};'use strict';var pdf=require(_0xf69a('0x0'));var emlformat=require(_0xf69a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf69a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf69a('0x3'));var moment=require(_0xf69a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf69a('0x5'));var path=require(_0xf69a('0x6'));var sox=require(_0xf69a('0x7'));var csv=require(_0xf69a('0x8'));var ejs=require(_0xf69a('0x9'));var fs=require('fs');var _=require(_0xf69a('0xa'));var squel=require(_0xf69a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf69a('0xc'));var toCsv=require(_0xf69a('0x8'));var querystring=require(_0xf69a('0xd'));var Papa=require(_0xf69a('0xe'));var Redis=require(_0xf69a('0xf'));var authService=require(_0xf69a('0x10'));var qs=require(_0xf69a('0x11'));var as=require(_0xf69a('0x12'));var hardwareService=require(_0xf69a('0x13'));var logger=require('../../config/logger')(_0xf69a('0x14'));var utils=require(_0xf69a('0x15'));var config=require('../../config/environment');var db=require(_0xf69a('0x16'))['db'];config[_0xf69a('0x17')]=_['defaults'](config[_0xf69a('0x17')],{'host':_0xf69a('0x18'),'port':0x18eb});var socket=require(_0xf69a('0x19'))(new Redis(config[_0xf69a('0x17')]));require('./cmContact.socket')[_0xf69a('0x1a')](socket);function respondWithStatusCode(_0x207c12,_0x1ae645){_0x1ae645=_0x1ae645||0xcc;return function(_0x59bd3b){if(_0x59bd3b){return _0x207c12[_0xf69a('0x1b')](_0x1ae645);}return _0x207c12['status'](_0x1ae645)[_0xf69a('0x1c')]();};}function respondWithResult(_0x5a16f7,_0x11c775){_0x11c775=_0x11c775||0xc8;return function(_0x2d17a5){if(_0x2d17a5){return _0x5a16f7['status'](_0x11c775)['json'](_0x2d17a5);}};}function respondWithFilteredResult(_0x514e97,_0x5a34d2){return function(_0x125a56){if(_0x125a56){var _0x5304c4=_0x125a56[_0xf69a('0x1d')],_0x353281=_0x5a34d2[_0xf69a('0x1e')],_0x29ca61=_0x5a34d2[_0xf69a('0x1e')]+_0x5a34d2['limit'],_0x45f43d;if(_0x29ca61>=_0x5304c4){_0x29ca61=_0x5304c4;_0x45f43d=0xc8;}else{_0x45f43d=0xce;}_0x514e97[_0xf69a('0x1f')](_0x45f43d);return _0x514e97[_0xf69a('0x20')](_0xf69a('0x21'),_0x353281+'-'+_0x29ca61+'/'+_0x5304c4)[_0xf69a('0x22')](_0x125a56);}return null;};}function patchUpdates(_0x3b2a7b){return function(_0x3f116d){try{jsonpatch[_0xf69a('0x23')](_0x3f116d,_0x3b2a7b,!![]);}catch(_0x57af27){return BPromise['reject'](_0x57af27);}return _0x3f116d[_0xf69a('0x24')]();};}function saveUpdates(_0x2c9f92,_0x268ed3){return function(_0x18fd4a){if(_0x18fd4a){return _0x18fd4a[_0xf69a('0x25')](_0x2c9f92)[_0xf69a('0x26')](function(_0x5224d8){return _0x5224d8;});}return null;};}function removeEntity(_0x3d0921,_0x403ebc){return function(_0x1a84f3){if(_0x1a84f3){return _0x1a84f3[_0xf69a('0x27')]()[_0xf69a('0x26')](function(){_0x3d0921[_0xf69a('0x1f')](0xcc)[_0xf69a('0x1c')]();});}};}function handleEntityNotFound(_0x3d348e,_0x5adafc){return function(_0x2437f1){if(!_0x2437f1){_0x3d348e[_0xf69a('0x1b')](0x194);}return _0x2437f1;};}function handleError(_0x356837,_0x4fa8e6){_0x4fa8e6=_0x4fa8e6||0x1f4;return function(_0x1ea893){logger['error'](_0x1ea893[_0xf69a('0x28')]);if(_0x1ea893[_0xf69a('0x29')]){delete _0x1ea893[_0xf69a('0x29')];}_0x356837['status'](_0x4fa8e6)[_0xf69a('0x2a')](_0x1ea893);};}exports[_0xf69a('0x2b')]=function(_0x2dc99b,_0xe3ec8b){var _0x5ecdbe={},_0x207e8c={},_0x2095da={'count':0x0,'rows':[]};return db['CmContact'][_0xf69a('0x2c')]()[_0xf69a('0x26')](function(_0x2726f5){var _0x144d24=[];for(var _0x178529=0x0;_0x1785290x1){_0x10a9e5['or'](_0xf69a('0x6e'),qs[_0xf69a('0x6f')](_0x44494d),null);}else{if(qs['isNumeric'](_0x44494d)){_0x10a9e5['or']('c.id\x20LIKE\x20?',_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x70'),_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x71'),_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x72'),_0x44494d+'%');}else if(qs[_0xf69a('0x73')](_0x44494d)){_0x10a9e5['or']('c.email\x20LIKE\x20?',_0x44494d+'%');}else{_0x10a9e5['or']('c.firstName\x20LIKE\x20?','%'+_0x44494d+'%');_0x10a9e5['or']('c.lastName\x20LIKE\x20?','%'+_0x44494d+'%');_0x10a9e5['or'](_0xf69a('0x74'),'%'+_0x44494d+'%');}}}}_0x530557['where'](_0x10a9e5);_0x530557[_0xf69a('0x75')](_0xf69a('0x76'));var _0x6b8658={'type':db[_0xf69a('0x77')][_0xf69a('0x78')][_0xf69a('0x79')],'raw':!![]};var _0x496306=_0x530557[_0xf69a('0x7a')]()['field'](_0xf69a('0x76'));if(_0x5ecdbe[_0xf69a('0x3d')]){_0x5ecdbe[_0xf69a('0x3d')][_0xf69a('0x55')](function(_0x1dd3fd){_0x530557[_0xf69a('0x3d')]('c.'+_0x1dd3fd[0x0],_0x1dd3fd[0x1]===_0xf69a('0x7b')?![]:!![]);});}if(!_[_0xf69a('0x66')](_0x3abedc)){_0x530557[_0xf69a('0x7c')](_0x512f41);_0x496306['where'](_0xf69a('0x7d'),_0x3abedc);}BPromise[_0xf69a('0x7e')]()['then'](function(){if(_0x400c68&&!_[_0xf69a('0x7f')](_0x400c68[_0xf69a('0x51')],[_0xf69a('0x42'),_0xf69a('0x58')])){return _0x2dc99b[_0xf69a('0x80')][_0xf69a('0x81')]({'attributes':['id'],'raw':!![]})[_0xf69a('0x26')](function(_0x1b9105){if(_[_0xf69a('0x66')](_0x1b9105)){_0x496306[_0xf69a('0x3f')](_0xf69a('0x82'));_0x530557[_0xf69a('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x496306[_0xf69a('0x3f')]('c.ListId\x20IN\x20?',_[_0xf69a('0x54')](_0x1b9105,'id'));_0x530557['where']('c.ListId\x20IN\x20?',_[_0xf69a('0x54')](_0x1b9105,'id'));}});}else{return;}})[_0xf69a('0x26')](function(){db[_0xf69a('0x83')]['query'](_0x496306[_0xf69a('0x84')](),_0x6b8658)['then'](function(_0x4f86d7){_0x2095da['count']=_0x4f86d7[_0xf69a('0x39')];if(_0x2095da[_0xf69a('0x1d')]===0x0)return[];return db[_0xf69a('0x83')][_0xf69a('0x34')](_0x8811dd['toString'](),_0x6b8658);})[_0xf69a('0x26')](function(_0x3a4072){_0x1d2b5a=_['keyBy'](_0x3a4072,'id');_0x6b8658=_[_0xf69a('0x85')](_0x6b8658,{'model':db[_0xf69a('0x86')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dc99b[_0xf69a('0x34')][_0xf69a('0x38')]){_0x5ecdbe['attributes'][_0xf69a('0x55')](function(_0x4c1809){_0x530557[_0xf69a('0x42')]('c.'+_0x4c1809);});}else{_0x530557[_0xf69a('0x42')](_0xf69a('0x76'));_0x530557[_0xf69a('0x42')](_0xf69a('0x87'));_0x530557[_0xf69a('0x42')]('c.lastName');_0x530557[_0xf69a('0x42')](_0xf69a('0x88'));_0x530557[_0xf69a('0x42')](_0xf69a('0x89'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8a'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8b'));_0x530557['field'](_0xf69a('0x8c'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8d'));_0x530557[_0xf69a('0x42')](_0xf69a('0x8e'),'TagIds');}if(_0x5ecdbe[_0xf69a('0x3c')])_0x530557[_0xf69a('0x3c')](_0x5ecdbe[_0xf69a('0x3c')]);if(_0x5ecdbe[_0xf69a('0x1e')])_0x530557[_0xf69a('0x1e')](_0x5ecdbe['offset']);return db[_0xf69a('0x83')][_0xf69a('0x34')](_0x530557['toString'](),_0x6b8658);})[_0xf69a('0x26')](function(_0x30d23c){_0x30d23c[_0xf69a('0x55')](function(_0x1cded4){if(_0x1cded4[_0xf69a('0x8f')]){_0x1cded4[_0xf69a('0x90')]=[];_0x1cded4[_0xf69a('0x8f')][_0xf69a('0x53')](',')['forEach'](function(_0xfe0211){_0x1cded4[_0xf69a('0x90')]['push'](_0x1d2b5a[_0xfe0211]);});}delete _0x1cded4[_0xf69a('0x8f')];});_0x2095da[_0xf69a('0x91')]=_0x30d23c;return _0x2095da;})['then'](respondWithFilteredResult(_0xe3ec8b,_0x5ecdbe));});})[_0xf69a('0x92')](handleError(_0xe3ec8b,null));};exports[_0xf69a('0x27')]=function(_0x521fda,_0x5e1327){return db[_0xf69a('0x86')][_0xf69a('0x93')]({'where':{'id':_0x521fda[_0xf69a('0x94')]['id']}})[_0xf69a('0x26')](handleEntityNotFound(_0x5e1327,null))['then'](removeEntity(_0x5e1327,null))[_0xf69a('0x92')](handleError(_0x5e1327,null));};exports['describe']=function(_0x486201,_0x9d5891){return db['CmContact'][_0xf69a('0x2c')]()[_0xf69a('0x26')](function(_0x3ac08f){delete _0x3ac08f[_0xf69a('0x95')];for(var _0x554358=0x0;_0x554358=_0x2c9165){_0x28f7ea=_0x2c9165;_0x10e264=0xc8;}else{_0x10e264=0xce;}_0x1ab95c['status'](_0x10e264);return _0x1ab95c[_0x75f0('0x20')]('Content-Range',_0xdbc432+'-'+_0x28f7ea+'/'+_0x2c9165)[_0x75f0('0x1d')](_0x34c52a);}return null;};}function patchUpdates(_0xa83a7a){return function(_0xd60168){try{jsonpatch['apply'](_0xd60168,_0xa83a7a,!![]);}catch(_0x170033){return BPromise[_0x75f0('0x21')](_0x170033);}return _0xd60168[_0x75f0('0x22')]();};}function saveUpdates(_0x584d71,_0x1725f1){return function(_0x12b379){if(_0x12b379){return _0x12b379[_0x75f0('0x23')](_0x584d71)[_0x75f0('0x24')](function(_0x370c6c){return _0x370c6c;});}return null;};}function removeEntity(_0x4fceed,_0x368fce){return function(_0x52e604){if(_0x52e604){return _0x52e604['destroy']()[_0x75f0('0x24')](function(){_0x4fceed[_0x75f0('0x1b')](0xcc)[_0x75f0('0x1c')]();});}};}function handleEntityNotFound(_0x3a1de6,_0x579ebd){return function(_0x1590e4){if(!_0x1590e4){_0x3a1de6['sendStatus'](0x194);}return _0x1590e4;};}function handleError(_0x594e8c,_0x3f7e0a){_0x3f7e0a=_0x3f7e0a||0x1f4;return function(_0x3a6bd4){logger[_0x75f0('0x25')](_0x3a6bd4['stack']);if(_0x3a6bd4['name']){delete _0x3a6bd4[_0x75f0('0x26')];}_0x594e8c[_0x75f0('0x1b')](_0x3f7e0a)[_0x75f0('0x27')](_0x3a6bd4);};}exports[_0x75f0('0x28')]=function(_0x5b62e5,_0x259b7f){var _0x53d57e={},_0x1cc0aa={},_0x4b9c0a={'count':0x0,'rows':[]};return db['CmContact'][_0x75f0('0x29')]()[_0x75f0('0x24')](function(_0xa73688){var _0x42eda5=[];for(var _0x2d6d96=0x0;_0x2d6d960x1){_0x2b587b['or'](_0x75f0('0x6e'),qs['getFullTextValue'](_0x152167),null);}else{if(qs['isNumeric'](_0x152167)){_0x2b587b['or'](_0x75f0('0x6f'),_0x152167+'%');_0x2b587b['or'](_0x75f0('0x70'),_0x152167+'%');_0x2b587b['or']('c.mobile\x20LIKE\x20?',_0x152167+'%');_0x2b587b['or'](_0x75f0('0x71'),_0x152167+'%');}else if(qs['isEmail'](_0x152167)){_0x2b587b['or'](_0x75f0('0x72'),_0x152167+'%');}else{_0x2b587b['or'](_0x75f0('0x73'),'%'+_0x152167+'%');_0x2b587b['or'](_0x75f0('0x74'),'%'+_0x152167+'%');_0x2b587b['or']('c.email\x20LIKE\x20?','%'+_0x152167+'%');}}}}_0x700cbf[_0x75f0('0x3e')](_0x2b587b);_0x700cbf[_0x75f0('0x75')]('c.id');var _0x527529={'type':db['Sequelize'][_0x75f0('0x76')]['SELECT'],'raw':!![]};var _0x22f7f2=_0x700cbf[_0x75f0('0x77')]()[_0x75f0('0x42')](_0x75f0('0x78'));if(_0x53d57e['order']){_0x53d57e[_0x75f0('0x3c')][_0x75f0('0x62')](function(_0x5d6fc3){_0x700cbf[_0x75f0('0x3c')]('c.'+_0x5d6fc3[0x0],_0x5d6fc3[0x1]===_0x75f0('0x79')?![]:!![]);});}if(!_['isEmpty'](_0x13587e)){_0x700cbf[_0x75f0('0x7a')](_0xda27d4);_0x22f7f2[_0x75f0('0x3e')](_0x75f0('0x7b'),_0x13587e);}BPromise[_0x75f0('0x7c')]()[_0x75f0('0x24')](function(){if(_0x29311a&&!_[_0x75f0('0x7d')](_0x29311a[_0x75f0('0x4e')],[_0x75f0('0x42'),_0x75f0('0x56')])){return _0x5b62e5[_0x75f0('0x7e')][_0x75f0('0x7f')]({'attributes':['id'],'raw':!![]})[_0x75f0('0x24')](function(_0x38b608){if(_['isEmpty'](_0x38b608)){_0x22f7f2[_0x75f0('0x3e')](_0x75f0('0x80'));_0x700cbf[_0x75f0('0x3e')](_0x75f0('0x80'));}else{_0x22f7f2['where'](_0x75f0('0x64'),_['map'](_0x38b608,'id'));_0x700cbf[_0x75f0('0x3e')](_0x75f0('0x64'),_[_0x75f0('0x53')](_0x38b608,'id'));}});}else{return;}})[_0x75f0('0x24')](function(){db[_0x75f0('0x81')][_0x75f0('0x35')](_0x22f7f2['toString'](),_0x527529)[_0x75f0('0x24')](function(_0x433c76){_0x4b9c0a[_0x75f0('0x1e')]=_0x433c76['length'];if(_0x4b9c0a['count']===0x0)return[];return db['sequelize']['query'](_0xa88bdb['toString'](),_0x527529);})[_0x75f0('0x24')](function(_0x34d105){_0x108345=_[_0x75f0('0x82')](_0x34d105,'id');_0x527529=_['merge'](_0x527529,{'model':db[_0x75f0('0x83')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b62e5['query'][_0x75f0('0x38')]){_0x53d57e[_0x75f0('0x37')][_0x75f0('0x62')](function(_0x15f584){_0x700cbf[_0x75f0('0x42')]('c.'+_0x15f584);});}else{_0x700cbf[_0x75f0('0x42')]('c.id');_0x700cbf['field'](_0x75f0('0x84'));_0x700cbf['field']('c.lastName');_0x700cbf[_0x75f0('0x42')]('c.phone');_0x700cbf[_0x75f0('0x42')](_0x75f0('0x85'));_0x700cbf['field'](_0x75f0('0x86'));_0x700cbf[_0x75f0('0x42')](_0x75f0('0x87'));_0x700cbf[_0x75f0('0x42')](_0x75f0('0x88'));_0x700cbf['field'](_0x75f0('0x89'));_0x700cbf['field'](_0x75f0('0x8a'),_0x75f0('0x8b'));}if(_0x53d57e['limit'])_0x700cbf[_0x75f0('0x1f')](_0x53d57e['limit']);if(_0x53d57e[_0x75f0('0x3b')])_0x700cbf[_0x75f0('0x3b')](_0x53d57e[_0x75f0('0x3b')]);return db[_0x75f0('0x81')][_0x75f0('0x35')](_0x700cbf[_0x75f0('0x8c')](),_0x527529);})[_0x75f0('0x24')](function(_0x480d7d){_0x480d7d[_0x75f0('0x62')](function(_0x535f51){if(_0x535f51['TagIds']){_0x535f51[_0x75f0('0x8d')]=[];_0x535f51[_0x75f0('0x8b')][_0x75f0('0x52')](',')[_0x75f0('0x62')](function(_0x55ba03){_0x535f51[_0x75f0('0x8d')][_0x75f0('0x2d')](_0x108345[_0x55ba03]);});}delete _0x535f51['TagIds'];});_0x4b9c0a[_0x75f0('0x8e')]=_0x480d7d;return _0x4b9c0a;})[_0x75f0('0x24')](respondWithFilteredResult(_0x259b7f,_0x53d57e));});})[_0x75f0('0x8f')](handleError(_0x259b7f,null));};exports[_0x75f0('0x90')]=function(_0x18d60c,_0x7d9d3f){return db[_0x75f0('0x83')][_0x75f0('0x4f')]({'where':{'id':_0x18d60c['params']['id']}})[_0x75f0('0x24')](handleEntityNotFound(_0x7d9d3f,null))['then'](removeEntity(_0x7d9d3f,null))[_0x75f0('0x8f')](handleError(_0x7d9d3f,null));};exports['describe']=function(_0x1a8a45,_0x15936c){return db[_0x75f0('0x83')][_0x75f0('0x29')]()[_0x75f0('0x24')](function(_0x4c7bac){delete _0x4c7bac['tags'];for(var _0x2d08d5=0x0;_0x2d08d5{}\s\\|]/g,'-');_0x15f7a4(null,util['format'](_0xe7fb('0x1e'),path[_0xe7fb('0x1f')](_0x51f01f[_0xe7fb('0x1c')],path['extname'](_0x51f01f[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path['extname'](_0x51f01f['originalname'])));}})});router['post'](_0xe7fb('0x21'),upload['single']('file'),controller[_0xe7fb('0x22')]);var upload=multer({'storage':multer[_0xe7fb('0x1a')]({'destination':function(_0x2996ae,_0x4f6c73,_0x6c930){_0x6c930(null,path[_0xe7fb('0x23')](config[_0xe7fb('0x1b')],_0xe7fb('0x24')));},'filename':function(_0x392d75,_0x16237a,_0x380130){_0x16237a['originalname']=_0x16237a['originalname'][_0xe7fb('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x380130(null,util[_0xe7fb('0x25')](_0xe7fb('0x1e'),path['basename'](_0x16237a[_0xe7fb('0x1c')],path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])),Date[_0xe7fb('0x20')](),path[_0xe7fb('0x26')](_0x16237a[_0xe7fb('0x1c')])));}})});router[_0xe7fb('0x17')](_0xe7fb('0x27'),upload['single'](_0xe7fb('0x28')),controller[_0xe7fb('0x29')]);router[_0xe7fb('0x17')]('/upload/:id',auth['isAuthenticated'](),controller[_0xe7fb('0x2a')]);router['put'](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2b')]);router[_0xe7fb('0x2c')]('/:id',auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x2d')]);module[_0xe7fb('0x2e')]=router; \ No newline at end of file +var _0xac9d=['getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/jscripty_sessions','/merge','post','create','/create_many','bulkCreate','setTags','join','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','server/files/tmp','/upload','upload','/upload/:id','import','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags'];(function(_0x48b008,_0x3466c1){var _0x5a8cbc=function(_0xe90668){while(--_0xe90668){_0x48b008['push'](_0x48b008['shift']());}};_0x5a8cbc(++_0x3466c1);}(_0xac9d,0x14d));var _0xdac9=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0xac9d[_0x166953];return _0x4a8baf;};'use strict';var multer=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var path=require(_0xdac9('0x2'));var timeout=require(_0xdac9('0x3'));var express=require(_0xdac9('0x4'));var router=express[_0xdac9('0x5')]();var auth=require(_0xdac9('0x6'));var interaction=require(_0xdac9('0x7'));var config=require('../../config/environment');var controller=require(_0xdac9('0x8'));router['get']('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0xa')]);router[_0xdac9('0xb')](_0xdac9('0xc'),auth[_0xdac9('0x9')](),controller[_0xdac9('0xd')]);router['get'](_0xdac9('0xe'),auth['isAuthenticated'](),controller[_0xdac9('0xf')]);router[_0xdac9('0xb')](_0xdac9('0x10'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x11')]);router[_0xdac9('0xb')](_0xdac9('0x12'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x13')]);router['get'](_0xdac9('0x14'),auth[_0xdac9('0x9')](),controller['getHopperHistories']);router[_0xdac9('0xb')](_0xdac9('0x15'),auth[_0xdac9('0x9')](),controller['getHopperFinals']);router[_0xdac9('0xb')](_0xdac9('0x16'),auth[_0xdac9('0x9')](),controller['getJscriptySessions']);router['post'](_0xdac9('0x17'),auth[_0xdac9('0x9')](),controller['merge']);router[_0xdac9('0x18')]('/',auth[_0xdac9('0x9')](),controller[_0xdac9('0x19')]);router[_0xdac9('0x18')](_0xdac9('0x1a'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x1b')]);router[_0xdac9('0x18')]('/:id/tags',auth[_0xdac9('0x9')](),controller[_0xdac9('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cd239,_0xa57f2d,_0x171df1){_0x171df1(null,path[_0xdac9('0x1d')](config['root'],'server/files/tmp'));},'filename':function(_0x4029fc,_0x20ece3,_0x2b9d91){_0x20ece3[_0xdac9('0x1e')]=_0x20ece3['originalname'][_0xdac9('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b9d91(null,util[_0xdac9('0x20')](_0xdac9('0x21'),path[_0xdac9('0x22')](_0x20ece3[_0xdac9('0x1e')],path[_0xdac9('0x23')](_0x20ece3[_0xdac9('0x1e')])),Date[_0xdac9('0x24')](),path[_0xdac9('0x23')](_0x20ece3[_0xdac9('0x1e')])));}})});router['post'](_0xdac9('0x25'),upload[_0xdac9('0x26')](_0xdac9('0x27')),controller[_0xdac9('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e631a,_0x5686db,_0x3ce475){_0x3ce475(null,path[_0xdac9('0x1d')](config['root'],_0xdac9('0x29')));},'filename':function(_0x5105f1,_0x450f91,_0x3743f7){_0x450f91[_0xdac9('0x1e')]=_0x450f91[_0xdac9('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3743f7(null,util['format'](_0xdac9('0x21'),path[_0xdac9('0x22')](_0x450f91['originalname'],path['extname'](_0x450f91[_0xdac9('0x1e')])),Date[_0xdac9('0x24')](),path[_0xdac9('0x23')](_0x450f91[_0xdac9('0x1e')])));}})});router[_0xdac9('0x18')](_0xdac9('0x2a'),upload[_0xdac9('0x26')](_0xdac9('0x27')),controller[_0xdac9('0x2b')]);router[_0xdac9('0x18')](_0xdac9('0x2c'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x2d')]);router[_0xdac9('0x2e')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x2f')]);router[_0xdac9('0x30')](_0xdac9('0xe'),auth[_0xdac9('0x9')](),controller[_0xdac9('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index b18d353..36431e5 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['STRING','PHONE','sequelize','INTEGER'];(function(_0x359590,_0x15ab26){var _0x4e6a94=function(_0x511629){while(--_0x511629){_0x359590['push'](_0x359590['shift']());}};_0x4e6a94(++_0x15ab26);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x7721('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7721('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7721('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7721('0x2')],'defaultValue':_0x7721('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x5353=['INTEGER','STRING','PHONE','sequelize'];(function(_0x5209ef,_0x3a4592){var _0x63f75f=function(_0x2591e1){while(--_0x2591e1){_0x5209ef['push'](_0x5209ef['shift']());}};_0x63f75f(++_0x3a4592);}(_0x5353,0x12f));var _0x3535=function(_0xa44485,_0x2d745b){_0xa44485=_0xa44485-0x0;var _0x186d00=_0x5353[_0xa44485];return _0x186d00;};'use strict';var Sequelize=require(_0x3535('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x3535('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3535('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x3535('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3535('0x2')],'defaultValue':_0x3535('0x3')},'OrderBy':{'type':Sequelize[_0x3535('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 99b453e..cc4db7a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e9e=['role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','save','update','then','destroy','CmContactHasItems','UserProfileResource','end','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','CmContactHasItem','rows','catch','params','keys','options','find','create','get'];(function(_0x4504b6,_0x4d1226){var _0x3b6d91=function(_0x488f35){while(--_0x488f35){_0x4504b6['push'](_0x4504b6['shift']());}};_0x3b6d91(++_0x4d1226);}(_0x2e9e,0x1e1));var _0xe2e9=function(_0x2bf098,_0x2085c2){_0x2bf098=_0x2bf098-0x0;var _0x320315=_0x2e9e[_0x2bf098];return _0x320315;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe2e9('0x0'));var zipdir=require(_0xe2e9('0x1'));var jsonpatch=require(_0xe2e9('0x2'));var rp=require(_0xe2e9('0x3'));var moment=require(_0xe2e9('0x4'));var BPromise=require(_0xe2e9('0x5'));var Mustache=require(_0xe2e9('0x6'));var util=require(_0xe2e9('0x7'));var path=require(_0xe2e9('0x8'));var sox=require(_0xe2e9('0x9'));var csv=require(_0xe2e9('0xa'));var ejs=require(_0xe2e9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe2e9('0xc'));var crypto=require(_0xe2e9('0xd'));var jsforce=require(_0xe2e9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2e9('0xa'));var querystring=require(_0xe2e9('0xf'));var Papa=require(_0xe2e9('0x10'));var Redis=require(_0xe2e9('0x11'));var authService=require(_0xe2e9('0x12'));var qs=require(_0xe2e9('0x13'));var as=require(_0xe2e9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2e9('0x15'))(_0xe2e9('0x16'));var utils=require(_0xe2e9('0x17'));var config=require(_0xe2e9('0x18'));var db=require(_0xe2e9('0x19'))['db'];function respondWithStatusCode(_0x50eb64,_0x1be50a){_0x1be50a=_0x1be50a||0xcc;return function(_0x5c7f20){if(_0x5c7f20){return _0x50eb64[_0xe2e9('0x1a')](_0x1be50a);}return _0x50eb64[_0xe2e9('0x1b')](_0x1be50a)['end']();};}function respondWithResult(_0x3f4859,_0x23efcd){_0x23efcd=_0x23efcd||0xc8;return function(_0x2c09c9){if(_0x2c09c9){return _0x3f4859['status'](_0x23efcd)['json'](_0x2c09c9);}};}function respondWithFilteredResult(_0x797a9f,_0x4b9ee2){return function(_0x1f30f5){if(_0x1f30f5){var _0x9000e9=_0x1f30f5[_0xe2e9('0x1c')],_0x401191=_0x4b9ee2[_0xe2e9('0x1d')],_0xe7288d=_0x4b9ee2[_0xe2e9('0x1d')]+_0x4b9ee2[_0xe2e9('0x1e')],_0x58c056;if(_0xe7288d>=_0x9000e9){_0xe7288d=_0x9000e9;_0x58c056=0xc8;}else{_0x58c056=0xce;}_0x797a9f[_0xe2e9('0x1b')](_0x58c056);return _0x797a9f['set']('Content-Range',_0x401191+'-'+_0xe7288d+'/'+_0x9000e9)['json'](_0x1f30f5);}return null;};}function patchUpdates(_0x1efbe2){return function(_0x5a14c6){try{jsonpatch['apply'](_0x5a14c6,_0x1efbe2,!![]);}catch(_0x2ec5cb){return BPromise['reject'](_0x2ec5cb);}return _0x5a14c6[_0xe2e9('0x1f')]();};}function saveUpdates(_0x1ec8f5,_0x466648){return function(_0x52a122){if(_0x52a122){return _0x52a122[_0xe2e9('0x20')](_0x1ec8f5)[_0xe2e9('0x21')](function(_0x213c7d){return _0x213c7d;});}return null;};}function removeEntity(_0x2574db,_0x42a722){return function(_0x2011a9){if(_0x2011a9){return _0x2011a9[_0xe2e9('0x22')]()['then'](function(){var _0x266081=_0x2011a9['get']({'plain':!![]});var _0x1e029a=_0xe2e9('0x23');return db[_0xe2e9('0x24')][_0xe2e9('0x22')]({'where':{'type':_0x1e029a,'resourceId':_0x266081['id']}})[_0xe2e9('0x21')](function(){return _0x2011a9;});})['then'](function(){_0x2574db[_0xe2e9('0x1b')](0xcc)[_0xe2e9('0x25')]();});}};}function handleEntityNotFound(_0x50c724,_0x2de605){return function(_0x43d637){if(!_0x43d637){_0x50c724['sendStatus'](0x194);}return _0x43d637;};}function handleError(_0x1ee581,_0x42cf26){_0x42cf26=_0x42cf26||0x1f4;return function(_0x430281){logger['error'](_0x430281[_0xe2e9('0x26')]);if(_0x430281[_0xe2e9('0x27')]){delete _0x430281['name'];}_0x1ee581[_0xe2e9('0x1b')](_0x42cf26)[_0xe2e9('0x28')](_0x430281);};}exports[_0xe2e9('0x29')]=function(_0xd170b4,_0xcd3805){var _0x1554e9={},_0x29f7ca={},_0x4df50e={'count':0x0,'rows':[]};var _0xeae732=_[_0xe2e9('0x2a')](db['CmContactHasItem'][_0xe2e9('0x2b')],function(_0x6ab424){return{'name':_0x6ab424['fieldName'],'type':_0x6ab424[_0xe2e9('0x2c')][_0xe2e9('0x2d')]};});_0x29f7ca['model']=_[_0xe2e9('0x2a')](_0xeae732,_0xe2e9('0x27'));_0x29f7ca[_0xe2e9('0x2e')]=_['keys'](_0xd170b4[_0xe2e9('0x2e')]);_0x29f7ca[_0xe2e9('0x2f')]=_[_0xe2e9('0x30')](_0x29f7ca[_0xe2e9('0x31')],_0x29f7ca[_0xe2e9('0x2e')]);_0x1554e9[_0xe2e9('0x32')]=_[_0xe2e9('0x30')](_0x29f7ca[_0xe2e9('0x31')],qs[_0xe2e9('0x33')](_0xd170b4[_0xe2e9('0x2e')]['fields']));_0x1554e9['attributes']=_0x1554e9[_0xe2e9('0x32')][_0xe2e9('0x34')]?_0x1554e9[_0xe2e9('0x32')]:_0x29f7ca['model'];if(!_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x35')]('nolimit')){_0x1554e9[_0xe2e9('0x1e')]=qs[_0xe2e9('0x1e')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x1e')]);_0x1554e9['offset']=qs[_0xe2e9('0x1d')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x1d')]);}_0x1554e9[_0xe2e9('0x36')]=qs[_0xe2e9('0x37')](_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x37')]);_0x1554e9[_0xe2e9('0x38')]=qs[_0xe2e9('0x2f')](_[_0xe2e9('0x39')](_0xd170b4[_0xe2e9('0x2e')],_0x29f7ca[_0xe2e9('0x2f')]),_0xeae732);if(_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x3a')]){_0x1554e9[_0xe2e9('0x38')]=_[_0xe2e9('0x3b')](_0x1554e9['where'],{'$or':_['map'](_0xeae732,function(_0xf7535b){if(_0xf7535b[_0xe2e9('0x2c')]!==_0xe2e9('0x3c')){var _0x2dd364={};_0x2dd364[_0xf7535b['name']]={'$like':'%'+_0xd170b4[_0xe2e9('0x2e')][_0xe2e9('0x3a')]+'%'};return _0x2dd364;}})});}_0x1554e9=_[_0xe2e9('0x3b')]({},_0x1554e9,_0xd170b4['options']);var _0x3c90e1={'where':_0x1554e9[_0xe2e9('0x38')]};return db['CmContactHasItem'][_0xe2e9('0x1c')](_0x3c90e1)[_0xe2e9('0x21')](function(_0x14e767){_0x4df50e[_0xe2e9('0x1c')]=_0x14e767;if(_0xd170b4['query'][_0xe2e9('0x3d')]){_0x1554e9[_0xe2e9('0x3e')]=[{'all':!![]}];}return db[_0xe2e9('0x3f')]['findAll'](_0x1554e9);})[_0xe2e9('0x21')](function(_0x295113){_0x4df50e[_0xe2e9('0x40')]=_0x295113;return _0x4df50e;})[_0xe2e9('0x21')](respondWithFilteredResult(_0xcd3805,_0x1554e9))[_0xe2e9('0x41')](handleError(_0xcd3805,null));};exports['show']=function(_0x566d93,_0x47c13e){var _0x5c9846={'raw':!![],'where':{'id':_0x566d93[_0xe2e9('0x42')]['id']}},_0x49b139={};_0x49b139[_0xe2e9('0x31')]=_['keys'](db[_0xe2e9('0x3f')][_0xe2e9('0x2b')]);_0x49b139[_0xe2e9('0x2e')]=_[_0xe2e9('0x43')](_0x566d93['query']);_0x49b139['filters']=_['intersection'](_0x49b139['model'],_0x49b139[_0xe2e9('0x2e')]);_0x5c9846[_0xe2e9('0x32')]=_[_0xe2e9('0x30')](_0x49b139[_0xe2e9('0x31')],qs['fields'](_0x566d93[_0xe2e9('0x2e')][_0xe2e9('0x33')]));_0x5c9846[_0xe2e9('0x32')]=_0x5c9846[_0xe2e9('0x32')][_0xe2e9('0x34')]?_0x5c9846['attributes']:_0x49b139[_0xe2e9('0x31')];if(_0x566d93[_0xe2e9('0x2e')][_0xe2e9('0x3d')]){_0x5c9846[_0xe2e9('0x3e')]=[{'all':!![]}];}_0x5c9846=_[_0xe2e9('0x3b')]({},_0x5c9846,_0x566d93[_0xe2e9('0x44')]);return db[_0xe2e9('0x3f')][_0xe2e9('0x45')](_0x5c9846)[_0xe2e9('0x21')](handleEntityNotFound(_0x47c13e,null))[_0xe2e9('0x21')](respondWithResult(_0x47c13e,null))[_0xe2e9('0x41')](handleError(_0x47c13e,null));};exports[_0xe2e9('0x46')]=function(_0x19ceb7,_0xdc9d5a){return db[_0xe2e9('0x3f')][_0xe2e9('0x46')](_0x19ceb7['body'],{})[_0xe2e9('0x21')](function(_0x5217f2){var _0x4709fb=_0x19ceb7['user'][_0xe2e9('0x47')]({'plain':!![]});if(!_0x4709fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4709fb[_0xe2e9('0x48')]===_0xe2e9('0x49')){var _0x29dc77=_0x5217f2['get']({'plain':!![]});var _0x27e4a8=_0xe2e9('0x23');return db[_0xe2e9('0x4a')][_0xe2e9('0x45')]({'where':{'name':_0x27e4a8,'userProfileId':_0x4709fb['userProfileId']},'raw':!![]})[_0xe2e9('0x21')](function(_0x154486){if(_0x154486&&_0x154486[_0xe2e9('0x4b')]===0x0){return db[_0xe2e9('0x24')][_0xe2e9('0x46')]({'name':_0x29dc77[_0xe2e9('0x27')],'resourceId':_0x29dc77['id'],'type':_0x154486[_0xe2e9('0x27')],'sectionId':_0x154486['id']},{})[_0xe2e9('0x21')](function(){return _0x5217f2;});}else{return _0x5217f2;}})[_0xe2e9('0x41')](function(_0x1d21f6){logger[_0xe2e9('0x4c')](_0xe2e9('0x4d'),_0x1d21f6);throw _0x1d21f6;});}return _0x5217f2;})[_0xe2e9('0x21')](respondWithResult(_0xdc9d5a,0xc9))['catch'](handleError(_0xdc9d5a,null));};exports[_0xe2e9('0x20')]=function(_0x5296b1,_0xdad23a){if(_0x5296b1[_0xe2e9('0x4e')]['id']){delete _0x5296b1[_0xe2e9('0x4e')]['id'];}return db[_0xe2e9('0x3f')][_0xe2e9('0x45')]({'where':{'id':_0x5296b1[_0xe2e9('0x42')]['id']}})[_0xe2e9('0x21')](handleEntityNotFound(_0xdad23a,null))[_0xe2e9('0x21')](saveUpdates(_0x5296b1[_0xe2e9('0x4e')],null))['then'](respondWithResult(_0xdad23a,null))[_0xe2e9('0x41')](handleError(_0xdad23a,null));};exports[_0xe2e9('0x22')]=function(_0x1bea22,_0x33b35e){return db[_0xe2e9('0x3f')][_0xe2e9('0x45')]({'where':{'id':_0x1bea22[_0xe2e9('0x42')]['id']}})[_0xe2e9('0x21')](handleEntityNotFound(_0x33b35e,null))[_0xe2e9('0x21')](removeEntity(_0x33b35e,null))[_0xe2e9('0x41')](handleError(_0x33b35e,null));}; \ No newline at end of file +var _0xd10c=['mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','limit','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','options','CmContactHasItem','includeAll','include','findAll','rows','show','params','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x1d0c7e,_0x40b36c){var _0x30cf02=function(_0x2c8b55){while(--_0x2c8b55){_0x1d0c7e['push'](_0x1d0c7e['shift']());}};_0x30cf02(++_0x40b36c);}(_0xd10c,0x1db));var _0xcd10=function(_0x38bb96,_0x145706){_0x38bb96=_0x38bb96-0x0;var _0x537b83=_0xd10c[_0x38bb96];return _0x537b83;};'use strict';var pdf=require(_0xcd10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcd10('0x1'));var zipdir=require(_0xcd10('0x2'));var jsonpatch=require(_0xcd10('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcd10('0x4'));var Mustache=require(_0xcd10('0x5'));var util=require(_0xcd10('0x6'));var path=require('path');var sox=require(_0xcd10('0x7'));var csv=require('to-csv');var ejs=require(_0xcd10('0x8'));var fs=require('fs');var _=require(_0xcd10('0x9'));var squel=require('squel');var crypto=require(_0xcd10('0xa'));var jsforce=require(_0xcd10('0xb'));var deskjs=require(_0xcd10('0xc'));var toCsv=require(_0xcd10('0xd'));var querystring=require(_0xcd10('0xe'));var Papa=require(_0xcd10('0xf'));var Redis=require(_0xcd10('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd10('0x11'));var hardwareService=require(_0xcd10('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xcd10('0x13'));var config=require(_0xcd10('0x14'));var db=require(_0xcd10('0x15'))['db'];function respondWithStatusCode(_0x26d8df,_0xde2bb2){_0xde2bb2=_0xde2bb2||0xcc;return function(_0x90cbb9){if(_0x90cbb9){return _0x26d8df[_0xcd10('0x16')](_0xde2bb2);}return _0x26d8df['status'](_0xde2bb2)[_0xcd10('0x17')]();};}function respondWithResult(_0x1a3663,_0x10af3c){_0x10af3c=_0x10af3c||0xc8;return function(_0x1ebdf9){if(_0x1ebdf9){return _0x1a3663[_0xcd10('0x18')](_0x10af3c)['json'](_0x1ebdf9);}};}function respondWithFilteredResult(_0x2ea909,_0x39fbbe){return function(_0x58f42d){if(_0x58f42d){var _0x36f6d5=_0x58f42d[_0xcd10('0x19')],_0x3166c5=_0x39fbbe['offset'],_0x42bee9=_0x39fbbe['offset']+_0x39fbbe[_0xcd10('0x1a')],_0x288e46;if(_0x42bee9>=_0x36f6d5){_0x42bee9=_0x36f6d5;_0x288e46=0xc8;}else{_0x288e46=0xce;}_0x2ea909['status'](_0x288e46);return _0x2ea909[_0xcd10('0x1b')](_0xcd10('0x1c'),_0x3166c5+'-'+_0x42bee9+'/'+_0x36f6d5)['json'](_0x58f42d);}return null;};}function patchUpdates(_0x2ad501){return function(_0x1680e7){try{jsonpatch[_0xcd10('0x1d')](_0x1680e7,_0x2ad501,!![]);}catch(_0x185d08){return BPromise['reject'](_0x185d08);}return _0x1680e7['save']();};}function saveUpdates(_0x2e85fb,_0x2a8ecd){return function(_0x1900b9){if(_0x1900b9){return _0x1900b9[_0xcd10('0x1e')](_0x2e85fb)[_0xcd10('0x1f')](function(_0x35f19c){return _0x35f19c;});}return null;};}function removeEntity(_0x25d2d3,_0x5f253d){return function(_0x12a07c){if(_0x12a07c){return _0x12a07c[_0xcd10('0x20')]()[_0xcd10('0x1f')](function(){var _0x5c1622=_0x12a07c[_0xcd10('0x21')]({'plain':!![]});var _0x484d36='CmContactHasItems';return db[_0xcd10('0x22')][_0xcd10('0x20')]({'where':{'type':_0x484d36,'resourceId':_0x5c1622['id']}})[_0xcd10('0x1f')](function(){return _0x12a07c;});})[_0xcd10('0x1f')](function(){_0x25d2d3[_0xcd10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c188,_0xf5d0fa){return function(_0x4de347){if(!_0x4de347){_0x36c188[_0xcd10('0x16')](0x194);}return _0x4de347;};}function handleError(_0x5d96d0,_0x2c21fd){_0x2c21fd=_0x2c21fd||0x1f4;return function(_0x13b69e){logger[_0xcd10('0x23')](_0x13b69e[_0xcd10('0x24')]);if(_0x13b69e['name']){delete _0x13b69e['name'];}_0x5d96d0[_0xcd10('0x18')](_0x2c21fd)[_0xcd10('0x25')](_0x13b69e);};}exports['index']=function(_0x2720bc,_0x1e115a){var _0x40b047={},_0x85b685={},_0x4c4ebb={'count':0x0,'rows':[]};var _0x302aec=_[_0xcd10('0x26')](db['CmContactHasItem'][_0xcd10('0x27')],function(_0x119754){return{'name':_0x119754[_0xcd10('0x28')],'type':_0x119754['type'][_0xcd10('0x29')]};});_0x85b685[_0xcd10('0x2a')]=_[_0xcd10('0x26')](_0x302aec,_0xcd10('0x2b'));_0x85b685[_0xcd10('0x2c')]=_[_0xcd10('0x2d')](_0x2720bc[_0xcd10('0x2c')]);_0x85b685[_0xcd10('0x2e')]=_['intersection'](_0x85b685[_0xcd10('0x2a')],_0x85b685[_0xcd10('0x2c')]);_0x40b047[_0xcd10('0x2f')]=_[_0xcd10('0x30')](_0x85b685['model'],qs[_0xcd10('0x31')](_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x31')]));_0x40b047[_0xcd10('0x2f')]=_0x40b047[_0xcd10('0x2f')]['length']?_0x40b047[_0xcd10('0x2f')]:_0x85b685[_0xcd10('0x2a')];if(!_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x32')]('nolimit')){_0x40b047[_0xcd10('0x1a')]=qs[_0xcd10('0x1a')](_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x1a')]);_0x40b047[_0xcd10('0x33')]=qs['offset'](_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x33')]);}_0x40b047[_0xcd10('0x34')]=qs['sort'](_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x35')]);_0x40b047[_0xcd10('0x36')]=qs[_0xcd10('0x2e')](_[_0xcd10('0x37')](_0x2720bc[_0xcd10('0x2c')],_0x85b685[_0xcd10('0x2e')]),_0x302aec);if(_0x2720bc[_0xcd10('0x2c')]['filter']){_0x40b047['where']=_[_0xcd10('0x38')](_0x40b047[_0xcd10('0x36')],{'$or':_['map'](_0x302aec,function(_0x49c415){if(_0x49c415[_0xcd10('0x39')]!==_0xcd10('0x3a')){var _0x548e8b={};_0x548e8b[_0x49c415['name']]={'$like':'%'+_0x2720bc[_0xcd10('0x2c')][_0xcd10('0x3b')]+'%'};return _0x548e8b;}})});}_0x40b047=_[_0xcd10('0x38')]({},_0x40b047,_0x2720bc[_0xcd10('0x3c')]);var _0x1f3231={'where':_0x40b047[_0xcd10('0x36')]};return db[_0xcd10('0x3d')][_0xcd10('0x19')](_0x1f3231)['then'](function(_0x32a617){_0x4c4ebb['count']=_0x32a617;if(_0x2720bc['query'][_0xcd10('0x3e')]){_0x40b047[_0xcd10('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xcd10('0x40')](_0x40b047);})[_0xcd10('0x1f')](function(_0x428b33){_0x4c4ebb[_0xcd10('0x41')]=_0x428b33;return _0x4c4ebb;})[_0xcd10('0x1f')](respondWithFilteredResult(_0x1e115a,_0x40b047))['catch'](handleError(_0x1e115a,null));};exports[_0xcd10('0x42')]=function(_0x21915d,_0x31f3a3){var _0x5bc4df={'raw':!![],'where':{'id':_0x21915d[_0xcd10('0x43')]['id']}},_0x3ed426={};_0x3ed426[_0xcd10('0x2a')]=_[_0xcd10('0x2d')](db[_0xcd10('0x3d')]['rawAttributes']);_0x3ed426['query']=_[_0xcd10('0x2d')](_0x21915d['query']);_0x3ed426[_0xcd10('0x2e')]=_[_0xcd10('0x30')](_0x3ed426[_0xcd10('0x2a')],_0x3ed426[_0xcd10('0x2c')]);_0x5bc4df[_0xcd10('0x2f')]=_[_0xcd10('0x30')](_0x3ed426['model'],qs[_0xcd10('0x31')](_0x21915d['query'][_0xcd10('0x31')]));_0x5bc4df[_0xcd10('0x2f')]=_0x5bc4df[_0xcd10('0x2f')][_0xcd10('0x44')]?_0x5bc4df['attributes']:_0x3ed426[_0xcd10('0x2a')];if(_0x21915d[_0xcd10('0x2c')][_0xcd10('0x3e')]){_0x5bc4df[_0xcd10('0x3f')]=[{'all':!![]}];}_0x5bc4df=_[_0xcd10('0x38')]({},_0x5bc4df,_0x21915d[_0xcd10('0x3c')]);return db[_0xcd10('0x3d')]['find'](_0x5bc4df)[_0xcd10('0x1f')](handleEntityNotFound(_0x31f3a3,null))[_0xcd10('0x1f')](respondWithResult(_0x31f3a3,null))[_0xcd10('0x45')](handleError(_0x31f3a3,null));};exports[_0xcd10('0x46')]=function(_0x493f1a,_0x159a5f){return db[_0xcd10('0x3d')][_0xcd10('0x46')](_0x493f1a[_0xcd10('0x47')],{})[_0xcd10('0x1f')](function(_0x20ba6b){var _0x45db87=_0x493f1a[_0xcd10('0x48')][_0xcd10('0x21')]({'plain':!![]});if(!_0x45db87)throw new Error(_0xcd10('0x49'));if(_0x45db87[_0xcd10('0x4a')]===_0xcd10('0x48')){var _0x2ab984=_0x20ba6b[_0xcd10('0x21')]({'plain':!![]});var _0x43ce15=_0xcd10('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x43ce15,'userProfileId':_0x45db87[_0xcd10('0x4c')]},'raw':!![]})[_0xcd10('0x1f')](function(_0x570f8a){if(_0x570f8a&&_0x570f8a[_0xcd10('0x4d')]===0x0){return db[_0xcd10('0x22')][_0xcd10('0x46')]({'name':_0x2ab984[_0xcd10('0x2b')],'resourceId':_0x2ab984['id'],'type':_0x570f8a['name'],'sectionId':_0x570f8a['id']},{})[_0xcd10('0x1f')](function(){return _0x20ba6b;});}else{return _0x20ba6b;}})[_0xcd10('0x45')](function(_0xe1a8e){logger[_0xcd10('0x23')](_0xcd10('0x4e'),_0xe1a8e);throw _0xe1a8e;});}return _0x20ba6b;})[_0xcd10('0x1f')](respondWithResult(_0x159a5f,0xc9))[_0xcd10('0x45')](handleError(_0x159a5f,null));};exports['update']=function(_0xe0e9ff,_0x487203){if(_0xe0e9ff['body']['id']){delete _0xe0e9ff[_0xcd10('0x47')]['id'];}return db[_0xcd10('0x3d')][_0xcd10('0x4f')]({'where':{'id':_0xe0e9ff[_0xcd10('0x43')]['id']}})['then'](handleEntityNotFound(_0x487203,null))[_0xcd10('0x1f')](saveUpdates(_0xe0e9ff[_0xcd10('0x47')],null))['then'](respondWithResult(_0x487203,null))[_0xcd10('0x45')](handleError(_0x487203,null));};exports[_0xcd10('0x20')]=function(_0x2b8232,_0x481ff5){return db[_0xcd10('0x3d')][_0xcd10('0x4f')]({'where':{'id':_0x2b8232[_0xcd10('0x43')]['id']}})[_0xcd10('0x1f')](handleEntityNotFound(_0x481ff5,null))[_0xcd10('0x1f')](removeEntity(_0x481ff5,null))[_0xcd10('0x45')](handleError(_0x481ff5,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 15f8f1c..31a73de 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b20=['../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x14ca3f,_0x31ebdc){var _0x50ec75=function(_0x53a99f){while(--_0x53a99f){_0x14ca3f['push'](_0x14ca3f['shift']());}};_0x50ec75(++_0x31ebdc);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var logger=require(_0x01b2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x01b2('0x2'));var rp=require(_0x01b2('0x3'));var fs=require('fs');var path=require(_0x01b2('0x4'));var rimraf=require(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var attributes=require(_0x01b2('0x7'));module[_0x01b2('0x8')]=function(_0x28de4a,_0x46e745){return _0x28de4a[_0x01b2('0x9')](_0x01b2('0xa'),attributes,{'tableName':_0x01b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x1ea425,_0x2d9392){var _0x390ef1=function(_0x3685b5){while(--_0x3685b5){_0x1ea425['push'](_0x1ea425['shift']());}};_0x390ef1(++_0x2d9392);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x32f030,_0x3dfaa0){_0x32f030=_0x32f030-0x0;var _0x324360=_0xc1c6[_0x32f030];return _0x324360;};'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('./cmContactHasItem.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9e14ad6..0725895 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a24=['message','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x3a24,0x19f));var _0x43a2=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x3a24[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0x43a2('0x0'));var util=require(_0x43a2('0x1'));var moment=require('moment');var BPromise=require(_0x43a2('0x2'));var rs=require(_0x43a2('0x3'));var fs=require('fs');var Redis=require(_0x43a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x43a2('0x5'));var config=require(_0x43a2('0x6'));var jayson=require(_0x43a2('0x7'));var client=jayson['client'][_0x43a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ef998,_0x7484e,_0x563724){return new BPromise(function(_0x57c0f0,_0x3275c7){return client[_0x43a2('0x9')](_0x1ef998,_0x563724)[_0x43a2('0xa')](function(_0x4444b9){logger[_0x43a2('0xb')](_0x43a2('0xc'),_0x7484e,_0x43a2('0xd'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x7484e,'request\x20sent',JSON[_0x43a2('0xe')](_0x4444b9));if(_0x4444b9[_0x43a2('0xf')]){if(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x10')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x7484e,_0x4444b9['error'][_0x43a2('0x11')]);return _0x3275c7(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);}logger[_0x43a2('0xf')](_0x43a2('0xc'),_0x7484e,_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);return _0x57c0f0(_0x4444b9[_0x43a2('0xf')][_0x43a2('0x11')]);}else{logger[_0x43a2('0xb')](_0x43a2('0xc'),_0x7484e,_0x43a2('0xd'));_0x57c0f0(_0x4444b9['result'][_0x43a2('0x11')]);}})['catch'](function(_0xef8554){logger[_0x43a2('0xf')](_0x43a2('0xc'),_0x7484e,_0xef8554);_0x3275c7(_0xef8554);});});} \ No newline at end of file +var _0x0ab2=['http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','client'];(function(_0x263b1f,_0x3f2376){var _0x4aa612=function(_0x3cae79){while(--_0x3cae79){_0x263b1f['push'](_0x263b1f['shift']());}};_0x4aa612(++_0x3f2376);}(_0x0ab2,0x1ae));var _0x20ab=function(_0x5d588c,_0x3232a0){_0x5d588c=_0x5d588c-0x0;var _0x148140=_0x0ab2[_0x5d588c];return _0x148140;};'use strict';var _=require(_0x20ab('0x0'));var util=require(_0x20ab('0x1'));var moment=require(_0x20ab('0x2'));var BPromise=require(_0x20ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20ab('0x4'));var logger=require(_0x20ab('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20ab('0x6')][_0x20ab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4df13c,_0x3110bf,_0x697caa){return new BPromise(function(_0x49ca67,_0x15f2fa){return client['request'](_0x4df13c,_0x697caa)[_0x20ab('0x8')](function(_0x39432a){logger['info'](_0x20ab('0x9'),_0x3110bf,_0x20ab('0xa'));logger[_0x20ab('0xb')](_0x20ab('0xc'),_0x3110bf,_0x20ab('0xa'),JSON['stringify'](_0x39432a));if(_0x39432a[_0x20ab('0xd')]){if(_0x39432a[_0x20ab('0xd')][_0x20ab('0xe')]===0x1f4){logger[_0x20ab('0xd')](_0x20ab('0x9'),_0x3110bf,_0x39432a[_0x20ab('0xd')][_0x20ab('0xf')]);return _0x15f2fa(_0x39432a[_0x20ab('0xd')]['message']);}logger[_0x20ab('0xd')](_0x20ab('0x9'),_0x3110bf,_0x39432a[_0x20ab('0xd')][_0x20ab('0xf')]);return _0x49ca67(_0x39432a[_0x20ab('0xd')]['message']);}else{logger[_0x20ab('0x10')](_0x20ab('0x9'),_0x3110bf,_0x20ab('0xa'));_0x49ca67(_0x39432a[_0x20ab('0x11')][_0x20ab('0xf')]);}})[_0x20ab('0x12')](function(_0x22b979){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3110bf,_0x22b979);_0x15f2fa(_0x22b979);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5debf75..b37d4d5 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed9b=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index'];(function(_0x3673bb,_0x538336){var _0x3ae507=function(_0xe79bc7){while(--_0xe79bc7){_0x3673bb['push'](_0x3673bb['shift']());}};_0x3ae507(++_0x538336);}(_0xed9b,0x75));var _0xbed9=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xed9b[_0x513545];return _0x18b7c5;};'use strict';var multer=require(_0xbed9('0x0'));var util=require('util');var path=require(_0xbed9('0x1'));var timeout=require('connect-timeout');var express=require(_0xbed9('0x2'));var router=express[_0xbed9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbed9('0x4'));var config=require(_0xbed9('0x5'));var controller=require(_0xbed9('0x6'));router[_0xbed9('0x7')]('/',auth['isAuthenticated'](),controller[_0xbed9('0x8')]);router[_0xbed9('0x7')](_0xbed9('0x9'),auth[_0xbed9('0xa')](),controller[_0xbed9('0xb')]);router[_0xbed9('0xc')]('/',auth[_0xbed9('0xa')](),controller[_0xbed9('0xd')]);router[_0xbed9('0xe')]('/:id',auth[_0xbed9('0xa')](),controller[_0xbed9('0xf')]);router['delete']('/:id',auth[_0xbed9('0xa')](),controller[_0xbed9('0x10')]);module[_0xbed9('0x11')]=router; \ No newline at end of file +var _0x295d=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post','create','update','delete'];(function(_0x254c9e,_0xab8a1b){var _0x2d4cb6=function(_0x15b027){while(--_0x15b027){_0x254c9e['push'](_0x254c9e['shift']());}};_0x2d4cb6(++_0xab8a1b);}(_0x295d,0x1ee));var _0xd295=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x295d[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xd295('0x0'));var util=require(_0xd295('0x1'));var path=require(_0xd295('0x2'));var timeout=require('connect-timeout');var express=require(_0xd295('0x3'));var router=express[_0xd295('0x4')]();var auth=require(_0xd295('0x5'));var interaction=require(_0xd295('0x6'));var config=require('../../config/environment');var controller=require(_0xd295('0x7'));router[_0xd295('0x8')]('/',auth[_0xd295('0x9')](),controller['index']);router[_0xd295('0x8')](_0xd295('0xa'),auth[_0xd295('0x9')](),controller[_0xd295('0xb')]);router[_0xd295('0xc')]('/',auth[_0xd295('0x9')](),controller[_0xd295('0xd')]);router['put'](_0xd295('0xa'),auth['isAuthenticated'](),controller[_0xd295('0xe')]);router[_0xd295('0xf')](_0xd295('0xa'),auth[_0xd295('0x9')](),controller[_0xd295('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 5357c3d..6cd23c1 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5cf0=['INTEGER','STRING','sequelize','exports'];(function(_0x5e5bfe,_0x1e69d0){var _0x2636de=function(_0x45da5a){while(--_0x45da5a){_0x5e5bfe['push'](_0x5e5bfe['shift']());}};_0x2636de(++_0x1e69d0);}(_0x5cf0,0x136));var _0x05cf=function(_0x1cac5a,_0x51c54a){_0x1cac5a=_0x1cac5a-0x0;var _0x89fc37=_0x5cf0[_0x1cac5a];return _0x89fc37;};'use strict';var Sequelize=require(_0x05cf('0x0'));module[_0x05cf('0x1')]={'CmContactId':{'type':Sequelize[_0x05cf('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x05cf('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xc02a=['exports','INTEGER','STRING','sequelize'];(function(_0x274082,_0x2842a9){var _0x56c11e=function(_0x3849d7){while(--_0x3849d7){_0x274082['push'](_0x274082['shift']());}};_0x56c11e(++_0x2842a9);}(_0xc02a,0x127));var _0xac02=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0xc02a[_0x35fb56];return _0x2fd52c;};'use strict';var Sequelize=require(_0xac02('0x0'));module[_0xac02('0x1')]={'CmContactId':{'type':Sequelize[_0xac02('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xac02('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 600ef43..2c060f2 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bb8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','then','get','CmContactHasPhones','UserProfileResource','error','name','send','index','map','CmContactHasPhone','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7bb8,0xa2));var _0x87bb=function(_0x18c927,_0x636a49){_0x18c927=_0x18c927-0x0;var _0x5e1484=_0x7bb8[_0x18c927];return _0x5e1484;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x87bb('0x0'));var rimraf=require(_0x87bb('0x1'));var zipdir=require(_0x87bb('0x2'));var jsonpatch=require(_0x87bb('0x3'));var rp=require(_0x87bb('0x4'));var moment=require(_0x87bb('0x5'));var BPromise=require(_0x87bb('0x6'));var Mustache=require('mustache');var util=require(_0x87bb('0x7'));var path=require(_0x87bb('0x8'));var sox=require('sox');var csv=require(_0x87bb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87bb('0xa'));var squel=require(_0x87bb('0xb'));var crypto=require(_0x87bb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x87bb('0xd'));var toCsv=require(_0x87bb('0x9'));var querystring=require(_0x87bb('0xe'));var Papa=require(_0x87bb('0xf'));var Redis=require(_0x87bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87bb('0x11'));var as=require(_0x87bb('0x12'));var hardwareService=require(_0x87bb('0x13'));var logger=require('../../config/logger')(_0x87bb('0x14'));var utils=require('../../config/utils');var config=require(_0x87bb('0x15'));var db=require(_0x87bb('0x16'))['db'];function respondWithStatusCode(_0xc48a73,_0x1e9eea){_0x1e9eea=_0x1e9eea||0xcc;return function(_0x5427b1){if(_0x5427b1){return _0xc48a73[_0x87bb('0x17')](_0x1e9eea);}return _0xc48a73[_0x87bb('0x18')](_0x1e9eea)['end']();};}function respondWithResult(_0x1f843e,_0x1e0beb){_0x1e0beb=_0x1e0beb||0xc8;return function(_0x2922a8){if(_0x2922a8){return _0x1f843e[_0x87bb('0x18')](_0x1e0beb)[_0x87bb('0x19')](_0x2922a8);}};}function respondWithFilteredResult(_0xce19,_0x1093b4){return function(_0x461a1c){if(_0x461a1c){var _0x4b3319=_0x461a1c['count'],_0x157b12=_0x1093b4[_0x87bb('0x1a')],_0x28637f=_0x1093b4['offset']+_0x1093b4[_0x87bb('0x1b')],_0x6dad58;if(_0x28637f>=_0x4b3319){_0x28637f=_0x4b3319;_0x6dad58=0xc8;}else{_0x6dad58=0xce;}_0xce19[_0x87bb('0x18')](_0x6dad58);return _0xce19[_0x87bb('0x1c')]('Content-Range',_0x157b12+'-'+_0x28637f+'/'+_0x4b3319)[_0x87bb('0x19')](_0x461a1c);}return null;};}function patchUpdates(_0x246dae){return function(_0x240356){try{jsonpatch[_0x87bb('0x1d')](_0x240356,_0x246dae,!![]);}catch(_0x20ef4e){return BPromise[_0x87bb('0x1e')](_0x20ef4e);}return _0x240356[_0x87bb('0x1f')]();};}function saveUpdates(_0x2fccf6,_0x578894){return function(_0x26cbe3){if(_0x26cbe3){return _0x26cbe3[_0x87bb('0x20')](_0x2fccf6)['then'](function(_0x2625c6){return _0x2625c6;});}return null;};}function removeEntity(_0x5533e9,_0x356206){return function(_0x5824ce){if(_0x5824ce){return _0x5824ce[_0x87bb('0x21')]()[_0x87bb('0x22')](function(){var _0x217d6a=_0x5824ce[_0x87bb('0x23')]({'plain':!![]});var _0x27fdf9=_0x87bb('0x24');return db[_0x87bb('0x25')][_0x87bb('0x21')]({'where':{'type':_0x27fdf9,'resourceId':_0x217d6a['id']}})[_0x87bb('0x22')](function(){return _0x5824ce;});})[_0x87bb('0x22')](function(){_0x5533e9[_0x87bb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb27e,_0x1c4b1e){return function(_0x1925b6){if(!_0x1925b6){_0x3eb27e[_0x87bb('0x17')](0x194);}return _0x1925b6;};}function handleError(_0x2ab518,_0x5d5819){_0x5d5819=_0x5d5819||0x1f4;return function(_0xf2452b){logger[_0x87bb('0x26')](_0xf2452b['stack']);if(_0xf2452b[_0x87bb('0x27')]){delete _0xf2452b['name'];}_0x2ab518['status'](_0x5d5819)[_0x87bb('0x28')](_0xf2452b);};}exports[_0x87bb('0x29')]=function(_0x4b0bf5,_0x598530){var _0x26543e={},_0x2e317d={},_0x53f033={'count':0x0,'rows':[]};var _0x4ad3de=_[_0x87bb('0x2a')](db[_0x87bb('0x2b')]['rawAttributes'],function(_0x5a3e42){return{'name':_0x5a3e42[_0x87bb('0x2c')],'type':_0x5a3e42[_0x87bb('0x2d')]['key']};});_0x2e317d[_0x87bb('0x2e')]=_[_0x87bb('0x2a')](_0x4ad3de,_0x87bb('0x27'));_0x2e317d[_0x87bb('0x2f')]=_[_0x87bb('0x30')](_0x4b0bf5[_0x87bb('0x2f')]);_0x2e317d[_0x87bb('0x31')]=_[_0x87bb('0x32')](_0x2e317d[_0x87bb('0x2e')],_0x2e317d[_0x87bb('0x2f')]);_0x26543e[_0x87bb('0x33')]=_[_0x87bb('0x32')](_0x2e317d[_0x87bb('0x2e')],qs[_0x87bb('0x34')](_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x34')]));_0x26543e[_0x87bb('0x33')]=_0x26543e[_0x87bb('0x33')][_0x87bb('0x35')]?_0x26543e[_0x87bb('0x33')]:_0x2e317d[_0x87bb('0x2e')];if(!_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x36')]('nolimit')){_0x26543e[_0x87bb('0x1b')]=qs[_0x87bb('0x1b')](_0x4b0bf5[_0x87bb('0x2f')]['limit']);_0x26543e[_0x87bb('0x1a')]=qs[_0x87bb('0x1a')](_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x1a')]);}_0x26543e[_0x87bb('0x37')]=qs[_0x87bb('0x38')](_0x4b0bf5[_0x87bb('0x2f')]['sort']);_0x26543e[_0x87bb('0x39')]=qs['filters'](_[_0x87bb('0x3a')](_0x4b0bf5[_0x87bb('0x2f')],_0x2e317d[_0x87bb('0x31')]),_0x4ad3de);if(_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x3b')]){_0x26543e['where']=_[_0x87bb('0x3c')](_0x26543e[_0x87bb('0x39')],{'$or':_['map'](_0x4ad3de,function(_0x28a658){if(_0x28a658[_0x87bb('0x2d')]!==_0x87bb('0x3d')){var _0x2407ff={};_0x2407ff[_0x28a658[_0x87bb('0x27')]]={'$like':'%'+_0x4b0bf5[_0x87bb('0x2f')][_0x87bb('0x3b')]+'%'};return _0x2407ff;}})});}_0x26543e=_[_0x87bb('0x3c')]({},_0x26543e,_0x4b0bf5[_0x87bb('0x3e')]);var _0x4546a7={'where':_0x26543e[_0x87bb('0x39')]};return db[_0x87bb('0x2b')][_0x87bb('0x3f')](_0x4546a7)[_0x87bb('0x22')](function(_0x288575){_0x53f033[_0x87bb('0x3f')]=_0x288575;if(_0x4b0bf5['query']['includeAll']){_0x26543e[_0x87bb('0x40')]=[{'all':!![]}];}return db[_0x87bb('0x2b')]['findAll'](_0x26543e);})['then'](function(_0x1c0530){_0x53f033['rows']=_0x1c0530;return _0x53f033;})['then'](respondWithFilteredResult(_0x598530,_0x26543e))[_0x87bb('0x41')](handleError(_0x598530,null));};exports[_0x87bb('0x42')]=function(_0x50231c,_0x2e445e){var _0x4950ad={'raw':!![],'where':{'id':_0x50231c[_0x87bb('0x43')]['id']}},_0x92191b={};_0x92191b[_0x87bb('0x2e')]=_['keys'](db['CmContactHasPhone'][_0x87bb('0x44')]);_0x92191b[_0x87bb('0x2f')]=_[_0x87bb('0x30')](_0x50231c[_0x87bb('0x2f')]);_0x92191b[_0x87bb('0x31')]=_[_0x87bb('0x32')](_0x92191b[_0x87bb('0x2e')],_0x92191b[_0x87bb('0x2f')]);_0x4950ad[_0x87bb('0x33')]=_[_0x87bb('0x32')](_0x92191b[_0x87bb('0x2e')],qs[_0x87bb('0x34')](_0x50231c['query'][_0x87bb('0x34')]));_0x4950ad[_0x87bb('0x33')]=_0x4950ad[_0x87bb('0x33')]['length']?_0x4950ad[_0x87bb('0x33')]:_0x92191b[_0x87bb('0x2e')];if(_0x50231c[_0x87bb('0x2f')][_0x87bb('0x45')]){_0x4950ad[_0x87bb('0x40')]=[{'all':!![]}];}_0x4950ad=_[_0x87bb('0x3c')]({},_0x4950ad,_0x50231c[_0x87bb('0x3e')]);return db['CmContactHasPhone'][_0x87bb('0x46')](_0x4950ad)['then'](handleEntityNotFound(_0x2e445e,null))[_0x87bb('0x22')](respondWithResult(_0x2e445e,null))[_0x87bb('0x41')](handleError(_0x2e445e,null));};exports[_0x87bb('0x47')]=function(_0x400f4c,_0x527015){return db[_0x87bb('0x2b')][_0x87bb('0x47')](_0x400f4c[_0x87bb('0x48')],{})[_0x87bb('0x22')](function(_0x3da6cb){var _0x19c991=_0x400f4c[_0x87bb('0x49')][_0x87bb('0x23')]({'plain':!![]});if(!_0x19c991)throw new Error(_0x87bb('0x4a'));if(_0x19c991[_0x87bb('0x4b')]==='user'){var _0x540c38=_0x3da6cb[_0x87bb('0x23')]({'plain':!![]});var _0x2ed408='CmContactHasPhones';return db[_0x87bb('0x4c')][_0x87bb('0x46')]({'where':{'name':_0x2ed408,'userProfileId':_0x19c991[_0x87bb('0x4d')]},'raw':!![]})['then'](function(_0x30e579){if(_0x30e579&&_0x30e579[_0x87bb('0x4e')]===0x0){return db[_0x87bb('0x25')][_0x87bb('0x47')]({'name':_0x540c38[_0x87bb('0x27')],'resourceId':_0x540c38['id'],'type':_0x30e579[_0x87bb('0x27')],'sectionId':_0x30e579['id']},{})[_0x87bb('0x22')](function(){return _0x3da6cb;});}else{return _0x3da6cb;}})[_0x87bb('0x41')](function(_0x2a9691){logger[_0x87bb('0x26')](_0x87bb('0x4f'),_0x2a9691);throw _0x2a9691;});}return _0x3da6cb;})[_0x87bb('0x22')](respondWithResult(_0x527015,0xc9))[_0x87bb('0x41')](handleError(_0x527015,null));};exports[_0x87bb('0x20')]=function(_0x4c6136,_0x3c564e){if(_0x4c6136[_0x87bb('0x48')]['id']){delete _0x4c6136[_0x87bb('0x48')]['id'];}return db[_0x87bb('0x2b')][_0x87bb('0x46')]({'where':{'id':_0x4c6136[_0x87bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c564e,null))['then'](saveUpdates(_0x4c6136[_0x87bb('0x48')],null))[_0x87bb('0x22')](respondWithResult(_0x3c564e,null))['catch'](handleError(_0x3c564e,null));};exports['destroy']=function(_0x524e24,_0x554fd1){return db[_0x87bb('0x2b')]['find']({'where':{'id':_0x524e24[_0x87bb('0x43')]['id']}})['then'](handleEntityNotFound(_0x554fd1,null))[_0x87bb('0x22')](removeEntity(_0x554fd1,null))[_0x87bb('0x41')](handleError(_0x554fd1,null));}; \ No newline at end of file +var _0xa90b=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','CmContactHasPhones','UserProfileResource','then','end','error','stack','name','send','map','CmContactHasPhone','rawAttributes','fieldName','model','query','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','options','include','catch','params','keys','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1c9086,_0x4a9633){var _0x34be2d=function(_0x1d5148){while(--_0x1d5148){_0x1c9086['push'](_0x1c9086['shift']());}};_0x34be2d(++_0x4a9633);}(_0xa90b,0x85));var _0xba90=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa90b[_0x176329];return _0x31997c;};'use strict';var pdf=require(_0xba90('0x0'));var emlformat=require(_0xba90('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba90('0x2'));var rp=require(_0xba90('0x3'));var moment=require(_0xba90('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba90('0x5'));var path=require(_0xba90('0x6'));var sox=require(_0xba90('0x7'));var csv=require(_0xba90('0x8'));var ejs=require(_0xba90('0x9'));var fs=require('fs');var _=require(_0xba90('0xa'));var squel=require(_0xba90('0xb'));var crypto=require(_0xba90('0xc'));var jsforce=require(_0xba90('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba90('0x8'));var querystring=require('querystring');var Papa=require(_0xba90('0xe'));var Redis=require(_0xba90('0xf'));var authService=require(_0xba90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xba90('0x11'));var hardwareService=require(_0xba90('0x12'));var logger=require(_0xba90('0x13'))('api');var utils=require(_0xba90('0x14'));var config=require(_0xba90('0x15'));var db=require(_0xba90('0x16'))['db'];function respondWithStatusCode(_0x1e1675,_0x423ca1){_0x423ca1=_0x423ca1||0xcc;return function(_0x420547){if(_0x420547){return _0x1e1675[_0xba90('0x17')](_0x423ca1);}return _0x1e1675[_0xba90('0x18')](_0x423ca1)['end']();};}function respondWithResult(_0x4b5904,_0x39d40a){_0x39d40a=_0x39d40a||0xc8;return function(_0x268b6d){if(_0x268b6d){return _0x4b5904[_0xba90('0x18')](_0x39d40a)[_0xba90('0x19')](_0x268b6d);}};}function respondWithFilteredResult(_0x398fd8,_0x57b93b){return function(_0x566c46){if(_0x566c46){var _0x21c804=_0x566c46[_0xba90('0x1a')],_0x5ad845=_0x57b93b[_0xba90('0x1b')],_0x4cf5a1=_0x57b93b[_0xba90('0x1b')]+_0x57b93b[_0xba90('0x1c')],_0x497e88;if(_0x4cf5a1>=_0x21c804){_0x4cf5a1=_0x21c804;_0x497e88=0xc8;}else{_0x497e88=0xce;}_0x398fd8[_0xba90('0x18')](_0x497e88);return _0x398fd8[_0xba90('0x1d')](_0xba90('0x1e'),_0x5ad845+'-'+_0x4cf5a1+'/'+_0x21c804)[_0xba90('0x19')](_0x566c46);}return null;};}function patchUpdates(_0x3d81fa){return function(_0x4c46dd){try{jsonpatch['apply'](_0x4c46dd,_0x3d81fa,!![]);}catch(_0x3f9d32){return BPromise[_0xba90('0x1f')](_0x3f9d32);}return _0x4c46dd[_0xba90('0x20')]();};}function saveUpdates(_0x379257,_0x5ee8cf){return function(_0x283fb8){if(_0x283fb8){return _0x283fb8[_0xba90('0x21')](_0x379257)['then'](function(_0x3038e6){return _0x3038e6;});}return null;};}function removeEntity(_0x1d3e23,_0x440ee7){return function(_0x4de315){if(_0x4de315){return _0x4de315[_0xba90('0x22')]()['then'](function(){var _0x5326c0=_0x4de315[_0xba90('0x23')]({'plain':!![]});var _0x7a7f9=_0xba90('0x24');return db[_0xba90('0x25')][_0xba90('0x22')]({'where':{'type':_0x7a7f9,'resourceId':_0x5326c0['id']}})[_0xba90('0x26')](function(){return _0x4de315;});})['then'](function(){_0x1d3e23[_0xba90('0x18')](0xcc)[_0xba90('0x27')]();});}};}function handleEntityNotFound(_0x154a4a,_0x26bd09){return function(_0x519a02){if(!_0x519a02){_0x154a4a['sendStatus'](0x194);}return _0x519a02;};}function handleError(_0x1c465c,_0x4532a0){_0x4532a0=_0x4532a0||0x1f4;return function(_0x12d15c){logger[_0xba90('0x28')](_0x12d15c[_0xba90('0x29')]);if(_0x12d15c[_0xba90('0x2a')]){delete _0x12d15c[_0xba90('0x2a')];}_0x1c465c[_0xba90('0x18')](_0x4532a0)[_0xba90('0x2b')](_0x12d15c);};}exports['index']=function(_0xa3bdfa,_0x4753d1){var _0x29a7eb={},_0x25f21c={},_0x142a20={'count':0x0,'rows':[]};var _0x4839b0=_[_0xba90('0x2c')](db[_0xba90('0x2d')][_0xba90('0x2e')],function(_0x32288a){return{'name':_0x32288a[_0xba90('0x2f')],'type':_0x32288a['type']['key']};});_0x25f21c[_0xba90('0x30')]=_['map'](_0x4839b0,_0xba90('0x2a'));_0x25f21c[_0xba90('0x31')]=_['keys'](_0xa3bdfa['query']);_0x25f21c['filters']=_['intersection'](_0x25f21c['model'],_0x25f21c[_0xba90('0x31')]);_0x29a7eb[_0xba90('0x32')]=_['intersection'](_0x25f21c[_0xba90('0x30')],qs[_0xba90('0x33')](_0xa3bdfa[_0xba90('0x31')][_0xba90('0x33')]));_0x29a7eb['attributes']=_0x29a7eb[_0xba90('0x32')][_0xba90('0x34')]?_0x29a7eb['attributes']:_0x25f21c['model'];if(!_0xa3bdfa['query']['hasOwnProperty']('nolimit')){_0x29a7eb['limit']=qs[_0xba90('0x1c')](_0xa3bdfa[_0xba90('0x31')][_0xba90('0x1c')]);_0x29a7eb[_0xba90('0x1b')]=qs[_0xba90('0x1b')](_0xa3bdfa[_0xba90('0x31')][_0xba90('0x1b')]);}_0x29a7eb[_0xba90('0x35')]=qs[_0xba90('0x36')](_0xa3bdfa[_0xba90('0x31')][_0xba90('0x36')]);_0x29a7eb[_0xba90('0x37')]=qs[_0xba90('0x38')](_[_0xba90('0x39')](_0xa3bdfa[_0xba90('0x31')],_0x25f21c['filters']),_0x4839b0);if(_0xa3bdfa[_0xba90('0x31')][_0xba90('0x3a')]){_0x29a7eb[_0xba90('0x37')]=_[_0xba90('0x3b')](_0x29a7eb['where'],{'$or':_[_0xba90('0x2c')](_0x4839b0,function(_0x16af82){if(_0x16af82[_0xba90('0x3c')]!=='VIRTUAL'){var _0x2156b6={};_0x2156b6[_0x16af82[_0xba90('0x2a')]]={'$like':'%'+_0xa3bdfa[_0xba90('0x31')]['filter']+'%'};return _0x2156b6;}})});}_0x29a7eb=_[_0xba90('0x3b')]({},_0x29a7eb,_0xa3bdfa[_0xba90('0x3d')]);var _0x2bae20={'where':_0x29a7eb[_0xba90('0x37')]};return db[_0xba90('0x2d')][_0xba90('0x1a')](_0x2bae20)[_0xba90('0x26')](function(_0x2cd662){_0x142a20[_0xba90('0x1a')]=_0x2cd662;if(_0xa3bdfa[_0xba90('0x31')]['includeAll']){_0x29a7eb[_0xba90('0x3e')]=[{'all':!![]}];}return db[_0xba90('0x2d')]['findAll'](_0x29a7eb);})[_0xba90('0x26')](function(_0x20bf4b){_0x142a20['rows']=_0x20bf4b;return _0x142a20;})['then'](respondWithFilteredResult(_0x4753d1,_0x29a7eb))[_0xba90('0x3f')](handleError(_0x4753d1,null));};exports['show']=function(_0x931cd0,_0xfab898){var _0x20060c={'raw':!![],'where':{'id':_0x931cd0[_0xba90('0x40')]['id']}},_0x1ab4d8={};_0x1ab4d8[_0xba90('0x30')]=_[_0xba90('0x41')](db[_0xba90('0x2d')][_0xba90('0x2e')]);_0x1ab4d8['query']=_[_0xba90('0x41')](_0x931cd0[_0xba90('0x31')]);_0x1ab4d8[_0xba90('0x38')]=_[_0xba90('0x42')](_0x1ab4d8[_0xba90('0x30')],_0x1ab4d8['query']);_0x20060c[_0xba90('0x32')]=_[_0xba90('0x42')](_0x1ab4d8[_0xba90('0x30')],qs[_0xba90('0x33')](_0x931cd0[_0xba90('0x31')][_0xba90('0x33')]));_0x20060c['attributes']=_0x20060c[_0xba90('0x32')][_0xba90('0x34')]?_0x20060c[_0xba90('0x32')]:_0x1ab4d8['model'];if(_0x931cd0[_0xba90('0x31')][_0xba90('0x43')]){_0x20060c[_0xba90('0x3e')]=[{'all':!![]}];}_0x20060c=_[_0xba90('0x3b')]({},_0x20060c,_0x931cd0[_0xba90('0x3d')]);return db[_0xba90('0x2d')][_0xba90('0x44')](_0x20060c)[_0xba90('0x26')](handleEntityNotFound(_0xfab898,null))[_0xba90('0x26')](respondWithResult(_0xfab898,null))[_0xba90('0x3f')](handleError(_0xfab898,null));};exports[_0xba90('0x45')]=function(_0x1b3ba2,_0x31c912){return db[_0xba90('0x2d')]['create'](_0x1b3ba2[_0xba90('0x46')],{})[_0xba90('0x26')](function(_0x34d9b6){var _0x201edc=_0x1b3ba2[_0xba90('0x47')][_0xba90('0x23')]({'plain':!![]});if(!_0x201edc)throw new Error(_0xba90('0x48'));if(_0x201edc[_0xba90('0x49')]===_0xba90('0x47')){var _0x354a6a=_0x34d9b6[_0xba90('0x23')]({'plain':!![]});var _0x3fcb9f=_0xba90('0x24');return db['UserProfileSection'][_0xba90('0x44')]({'where':{'name':_0x3fcb9f,'userProfileId':_0x201edc[_0xba90('0x4a')]},'raw':!![]})[_0xba90('0x26')](function(_0x15890d){if(_0x15890d&&_0x15890d['autoAssociation']===0x0){return db['UserProfileResource'][_0xba90('0x45')]({'name':_0x354a6a[_0xba90('0x2a')],'resourceId':_0x354a6a['id'],'type':_0x15890d['name'],'sectionId':_0x15890d['id']},{})['then'](function(){return _0x34d9b6;});}else{return _0x34d9b6;}})[_0xba90('0x3f')](function(_0x25687e){logger[_0xba90('0x28')](_0xba90('0x4b'),_0x25687e);throw _0x25687e;});}return _0x34d9b6;})[_0xba90('0x26')](respondWithResult(_0x31c912,0xc9))[_0xba90('0x3f')](handleError(_0x31c912,null));};exports[_0xba90('0x21')]=function(_0x2d34c7,_0x4b6503){if(_0x2d34c7[_0xba90('0x46')]['id']){delete _0x2d34c7[_0xba90('0x46')]['id'];}return db[_0xba90('0x2d')][_0xba90('0x44')]({'where':{'id':_0x2d34c7['params']['id']}})['then'](handleEntityNotFound(_0x4b6503,null))['then'](saveUpdates(_0x2d34c7[_0xba90('0x46')],null))['then'](respondWithResult(_0x4b6503,null))['catch'](handleError(_0x4b6503,null));};exports['destroy']=function(_0x16bd0e,_0x280c4f){return db['CmContactHasPhone'][_0xba90('0x44')]({'where':{'id':_0x16bd0e[_0xba90('0x40')]['id']}})['then'](handleEntityNotFound(_0x280c4f,null))[_0xba90('0x26')](removeEntity(_0x280c4f,null))[_0xba90('0x3f')](handleError(_0x280c4f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 4f7a466..1a674bc 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbf1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf1,0x1a3));var _0x1fbf=function(_0x46f07b,_0x2d4152){_0x46f07b=_0x46f07b-0x0;var _0x525815=_0xfbf1[_0x46f07b];return _0x525815;};'use strict';var _=require(_0x1fbf('0x0'));var util=require(_0x1fbf('0x1'));var logger=require(_0x1fbf('0x2'))(_0x1fbf('0x3'));var moment=require(_0x1fbf('0x4'));var BPromise=require(_0x1fbf('0x5'));var rp=require(_0x1fbf('0x6'));var fs=require('fs');var path=require(_0x1fbf('0x7'));var rimraf=require(_0x1fbf('0x8'));var config=require(_0x1fbf('0x9'));var attributes=require(_0x1fbf('0xa'));module[_0x1fbf('0xb')]=function(_0x22c09c,_0x52aafe){return _0x22c09c[_0x1fbf('0xc')](_0x1fbf('0xd'),attributes,{'tableName':_0x1fbf('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a30=['lodash','../../config/logger','moment','bluebird','rimraf','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','cm_contact_has_phones'];(function(_0x5318fe,_0x6465cc){var _0x535543=function(_0x2c99bf){while(--_0x2c99bf){_0x5318fe['push'](_0x5318fe['shift']());}};_0x535543(++_0x6465cc);}(_0x0a30,0xaa));var _0x00a3=function(_0x3d2320,_0x32997d){_0x3d2320=_0x3d2320-0x0;var _0x1947a8=_0x0a30[_0x3d2320];return _0x1947a8;};'use strict';var _=require(_0x00a3('0x0'));var util=require('util');var logger=require(_0x00a3('0x1'))('api');var moment=require(_0x00a3('0x2'));var BPromise=require(_0x00a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x00a3('0x4'));var config=require('../../config/environment');var attributes=require(_0x00a3('0x5'));module[_0x00a3('0x6')]=function(_0x2b152e,_0x129f34){return _0x2b152e[_0x00a3('0x7')](_0x00a3('0x8'),attributes,{'tableName':_0x00a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 9bb6cf5..410ef91 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f7=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','CmContactHasPhone,\x20%s,\x20%s','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x27fa6b,_0x42da89){var _0x2197ce=function(_0x172d25){while(--_0x172d25){_0x27fa6b['push'](_0x27fa6b['shift']());}};_0x2197ce(++_0x42da89);}(_0x95f7,0x143));var _0x795f=function(_0x495207,_0x58f561){_0x495207=_0x495207-0x0;var _0x41cbf9=_0x95f7[_0x495207];return _0x41cbf9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x795f('0x0'));var BPromise=require(_0x795f('0x1'));var rs=require(_0x795f('0x2'));var fs=require('fs');var Redis=require(_0x795f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x795f('0x4'))(_0x795f('0x5'));var config=require('../../config/environment');var jayson=require(_0x795f('0x6'));var client=jayson['client'][_0x795f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd693b6,_0x27bfd2,_0x6e5860){return new BPromise(function(_0x35539c,_0xeda01){return client[_0x795f('0x8')](_0xd693b6,_0x6e5860)[_0x795f('0x9')](function(_0x55fbe5){logger[_0x795f('0xa')](_0x795f('0xb'),_0x27bfd2,'request\x20sent');logger['debug'](_0x795f('0xc'),_0x27bfd2,_0x795f('0xd'),JSON[_0x795f('0xe')](_0x55fbe5));if(_0x55fbe5[_0x795f('0xf')]){if(_0x55fbe5['error'][_0x795f('0x10')]===0x1f4){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x55fbe5[_0x795f('0xf')][_0x795f('0x11')]);return _0xeda01(_0x55fbe5[_0x795f('0xf')][_0x795f('0x11')]);}logger[_0x795f('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x55fbe5[_0x795f('0xf')]['message']);return _0x35539c(_0x55fbe5['error']['message']);}else{logger[_0x795f('0xa')](_0x795f('0xb'),_0x27bfd2,_0x795f('0xd'));_0x35539c(_0x55fbe5['result'][_0x795f('0x11')]);}})[_0x795f('0x12')](function(_0x3d96d2){logger[_0x795f('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x27bfd2,_0x3d96d2);_0xeda01(_0x3d96d2);});});} \ No newline at end of file +var _0x2bc5=['CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmContactHasPhone,\x20%s,\x20%s','debug'];(function(_0x56aec7,_0x24f439){var _0x3076d4=function(_0xc1c3ce){while(--_0xc1c3ce){_0x56aec7['push'](_0x56aec7['shift']());}};_0x3076d4(++_0x24f439);}(_0x2bc5,0x1ab));var _0x52bc=function(_0x5dc7bb,_0x3c2edc){_0x5dc7bb=_0x5dc7bb-0x0;var _0x3569c3=_0x2bc5[_0x5dc7bb];return _0x3569c3;};'use strict';var _=require(_0x52bc('0x0'));var util=require(_0x52bc('0x1'));var moment=require(_0x52bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52bc('0x3'));var db=require(_0x52bc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52bc('0x5'))(_0x52bc('0x6'));var config=require(_0x52bc('0x7'));var jayson=require(_0x52bc('0x8'));var client=jayson[_0x52bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fa975,_0x3761ea,_0x3a3a91){return new BPromise(function(_0x653b89,_0x53ad3e){return client[_0x52bc('0xa')](_0x3fa975,_0x3a3a91)['then'](function(_0x5665da){logger[_0x52bc('0xb')](_0x52bc('0xc'),_0x3761ea,'request\x20sent');logger[_0x52bc('0xd')](_0x52bc('0xe'),_0x3761ea,_0x52bc('0xf'),JSON[_0x52bc('0x10')](_0x5665da));if(_0x5665da['error']){if(_0x5665da['error']['code']===0x1f4){logger[_0x52bc('0x11')](_0x52bc('0xc'),_0x3761ea,_0x5665da[_0x52bc('0x11')][_0x52bc('0x12')]);return _0x53ad3e(_0x5665da[_0x52bc('0x11')]['message']);}logger[_0x52bc('0x11')](_0x52bc('0xc'),_0x3761ea,_0x5665da[_0x52bc('0x11')][_0x52bc('0x12')]);return _0x653b89(_0x5665da[_0x52bc('0x11')][_0x52bc('0x12')]);}else{logger[_0x52bc('0xb')](_0x52bc('0xc'),_0x3761ea,_0x52bc('0xf'));_0x653b89(_0x5665da[_0x52bc('0x13')][_0x52bc('0x12')]);}})[_0x52bc('0x14')](function(_0x125643){logger['error']('CmContactHasPhone,\x20%s,\x20%s',_0x3761ea,_0x125643);_0x53ad3e(_0x125643);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index afb4063..84d7e11 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64b4=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','/:id','isAuthenticated','show','post','put','destroy','multer'];(function(_0x556bc0,_0x58a802){var _0x2a3462=function(_0x228dcc){while(--_0x228dcc){_0x556bc0['push'](_0x556bc0['shift']());}};_0x2a3462(++_0x58a802);}(_0x64b4,0x68));var _0x464b=function(_0x3f732a,_0x1b9502){_0x3f732a=_0x3f732a-0x0;var _0x3ef490=_0x64b4[_0x3f732a];return _0x3ef490;};'use strict';var multer=require(_0x464b('0x0'));var util=require(_0x464b('0x1'));var path=require(_0x464b('0x2'));var timeout=require('connect-timeout');var express=require(_0x464b('0x3'));var router=express['Router']();var auth=require(_0x464b('0x4'));var interaction=require(_0x464b('0x5'));var config=require(_0x464b('0x6'));var controller=require(_0x464b('0x7'));router[_0x464b('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x464b('0x8')](_0x464b('0x9'),auth[_0x464b('0xa')](),controller[_0x464b('0xb')]);router[_0x464b('0xc')]('/',auth[_0x464b('0xa')](),controller['create']);router[_0x464b('0xd')](_0x464b('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x464b('0x9'),auth[_0x464b('0xa')](),controller[_0x464b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4781=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','isAuthenticated','index','get','/:id','show','create','put','delete','exports','multer','util','path','express'];(function(_0xaa4677,_0x1f93a4){var _0x30f9cb=function(_0x1eee23){while(--_0x1eee23){_0xaa4677['push'](_0xaa4677['shift']());}};_0x30f9cb(++_0x1f93a4);}(_0x4781,0x1f4));var _0x1478=function(_0x2a7b7c,_0x2feff8){_0x2a7b7c=_0x2a7b7c-0x0;var _0x58aadb=_0x4781[_0x2a7b7c];return _0x58aadb;};'use strict';var multer=require(_0x1478('0x0'));var util=require(_0x1478('0x1'));var path=require(_0x1478('0x2'));var timeout=require('connect-timeout');var express=require(_0x1478('0x3'));var router=express[_0x1478('0x4')]();var auth=require(_0x1478('0x5'));var interaction=require(_0x1478('0x6'));var config=require(_0x1478('0x7'));var controller=require(_0x1478('0x8'));router['get']('/',auth[_0x1478('0x9')](),controller[_0x1478('0xa')]);router[_0x1478('0xb')](_0x1478('0xc'),auth[_0x1478('0x9')](),controller[_0x1478('0xd')]);router['post']('/',auth[_0x1478('0x9')](),controller[_0x1478('0xe')]);router[_0x1478('0xf')](_0x1478('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1478('0x10')](_0x1478('0xc'),auth[_0x1478('0x9')](),controller['destroy']);module[_0x1478('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e00eaab..e8ebb09 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 _0x9263=['VIRTUAL','STRING','setDataValue','alias','name','TEXT','long','getDataValue','type','select','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports'];(function(_0x513f8,_0x4df54c){var _0x5df9b0=function(_0x257ba2){while(--_0x257ba2){_0x513f8['push'](_0x513f8['shift']());}};_0x5df9b0(++_0x4df54c);}(_0x9263,0xc9));var _0x3926=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x9263[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0x3926('0x0'));var _=require(_0x3926('0x1'));module[_0x3926('0x2')]={'name':{'type':Sequelize[_0x3926('0x3')],'get':function(_0x436f59){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x3926('0x4')],'allowNull':![],'set':function(_0x18b4e0){this[_0x3926('0x5')](_0x3926('0x6'),_0x18b4e0?_0x18b4e0:this['getDataValue'](_0x3926('0x7')));}},'type':{'type':Sequelize[_0x3926('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x3926('0x8')](_0x3926('0x9')),'get':function(){if(this[_0x3926('0xa')](_0x3926('0xb'))===_0x3926('0xc')){return JSON['parse'](this[_0x3926('0xa')](_0x3926('0xd')));}else{return this[_0x3926('0xa')](_0x3926('0xd'));}},'set':function(_0x3553eb){if(Array[_0x3926('0xe')](_0x3553eb)){this[_0x3926('0x5')](_0x3926('0xd'),JSON[_0x3926('0xf')](_0x3553eb));}else{this[_0x3926('0x5')](_0x3926('0xd'),_0x3553eb);}}},'required':{'type':Sequelize[_0x3926('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x478b=['sequelize','lodash','exports','getDataValue','alias','STRING','name','type','select','parse','values','setDataValue','stringify'];(function(_0x394a61,_0x35d644){var _0x48ee7c=function(_0x69ed14){while(--_0x69ed14){_0x394a61['push'](_0x394a61['shift']());}};_0x48ee7c(++_0x35d644);}(_0x478b,0x152));var _0xb478=function(_0x30f0aa,_0x55ac09){_0x30f0aa=_0x30f0aa-0x0;var _0x2565a2=_0x478b[_0x30f0aa];return _0x2565a2;};'use strict';var Sequelize=require(_0xb478('0x0'));var _=require(_0xb478('0x1'));module[_0xb478('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x489108){return this[_0xb478('0x3')](_0xb478('0x4'));}},'alias':{'type':Sequelize[_0xb478('0x5')],'allowNull':![],'set':function(_0x234261){this['setDataValue'](_0xb478('0x4'),_0x234261?_0x234261:this[_0xb478('0x3')](_0xb478('0x6')));}},'type':{'type':Sequelize[_0xb478('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0xb478('0x3')](_0xb478('0x7'))===_0xb478('0x8')){return JSON[_0xb478('0x9')](this[_0xb478('0x3')]('values'));}else{return this[_0xb478('0x3')](_0xb478('0xa'));}},'set':function(_0x311a46){if(Array['isArray'](_0x311a46)){this[_0xb478('0xb')](_0xb478('0xa'),JSON[_0xb478('0xc')](_0x311a46));}else{this['setDataValue'](_0xb478('0xa'),_0x311a46);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3be5a56..6102cb4 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 _0xe736=['html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','index','map','CmCustomField','rawAttributes','fieldName','differenceBy','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','update','find','body','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%d'];(function(_0x56375d,_0x5401d7){var _0x5d9446=function(_0x7ea37a){while(--_0x7ea37a){_0x56375d['push'](_0x56375d['shift']());}};_0x5d9446(++_0x5401d7);}(_0xe736,0x14c));var _0x6e73=function(_0x428abc,_0x1afe32){_0x428abc=_0x428abc-0x0;var _0x4064c1=_0xe736[_0x428abc];return _0x4064c1;};'use strict';var pdf=require(_0x6e73('0x0'));var emlformat=require(_0x6e73('0x1'));var rimraf=require(_0x6e73('0x2'));var zipdir=require(_0x6e73('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e73('0x4'));var BPromise=require(_0x6e73('0x5'));var Mustache=require(_0x6e73('0x6'));var util=require('util');var path=require(_0x6e73('0x7'));var sox=require('sox');var csv=require(_0x6e73('0x8'));var ejs=require(_0x6e73('0x9'));var fs=require('fs');var _=require(_0x6e73('0xa'));var squel=require(_0x6e73('0xb'));var crypto=require(_0x6e73('0xc'));var jsforce=require(_0x6e73('0xd'));var deskjs=require(_0x6e73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6e73('0xf'));var Papa=require(_0x6e73('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e73('0x11'));var logger=require(_0x6e73('0x12'))(_0x6e73('0x13'));var utils=require(_0x6e73('0x14'));var config=require('../../config/environment');var db=require(_0x6e73('0x15'))['db'];function respondWithStatusCode(_0x4de718,_0x533808){_0x533808=_0x533808||0xcc;return function(_0x2694d7){if(_0x2694d7){return _0x4de718[_0x6e73('0x16')](_0x533808);}return _0x4de718[_0x6e73('0x17')](_0x533808)['end']();};}function respondWithResult(_0x5ec7a8,_0x575f90){_0x575f90=_0x575f90||0xc8;return function(_0x479377){if(_0x479377){return _0x5ec7a8[_0x6e73('0x17')](_0x575f90)[_0x6e73('0x18')](_0x479377);}};}function respondWithFilteredResult(_0x39fca2,_0x3a94a9){return function(_0x3c4f16){if(_0x3c4f16){var _0x37fec4=_0x3c4f16['count'],_0x1986ac=_0x3a94a9[_0x6e73('0x19')],_0xe8497a=_0x3a94a9[_0x6e73('0x19')]+_0x3a94a9[_0x6e73('0x1a')],_0x1bbbcc;if(_0xe8497a>=_0x37fec4){_0xe8497a=_0x37fec4;_0x1bbbcc=0xc8;}else{_0x1bbbcc=0xce;}_0x39fca2[_0x6e73('0x17')](_0x1bbbcc);return _0x39fca2[_0x6e73('0x1b')](_0x6e73('0x1c'),_0x1986ac+'-'+_0xe8497a+'/'+_0x37fec4)[_0x6e73('0x18')](_0x3c4f16);}return null;};}function patchUpdates(_0x1c6606){return function(_0x121b5e){try{jsonpatch['apply'](_0x121b5e,_0x1c6606,!![]);}catch(_0x48b1b9){return BPromise[_0x6e73('0x1d')](_0x48b1b9);}return _0x121b5e[_0x6e73('0x1e')]();};}function saveUpdates(_0x548ae3,_0x5927ef){return function(_0x399fd4){if(_0x399fd4){return _0x399fd4['update'](_0x548ae3)[_0x6e73('0x1f')](function(_0x21df78){return _0x21df78;});}return null;};}function removeEntity(_0x550d4f,_0x112179){return function(_0x2ea26b){if(_0x2ea26b){return _0x2ea26b[_0x6e73('0x20')]()[_0x6e73('0x1f')](function(){_0x550d4f[_0x6e73('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561545,_0x39abe7){return function(_0x886515){if(!_0x886515){_0x561545[_0x6e73('0x16')](0x194);}return _0x886515;};}function handleError(_0x4b51b4,_0x48c1e1){_0x48c1e1=_0x48c1e1||0x1f4;return function(_0x2dc31d){logger['error'](_0x2dc31d['stack']);if(_0x2dc31d[_0x6e73('0x21')]){delete _0x2dc31d[_0x6e73('0x21')];}_0x4b51b4[_0x6e73('0x17')](_0x48c1e1)[_0x6e73('0x22')](_0x2dc31d);};}exports[_0x6e73('0x23')]=function(_0x387512,_0x17b263){var _0xc6095d={},_0x37a6f6={},_0x18b1f9={'count':0x0,'rows':[]};var _0x180f96=_[_0x6e73('0x24')](db[_0x6e73('0x25')][_0x6e73('0x26')],function(_0x138b72){return{'name':_0x138b72[_0x6e73('0x27')],'type':_0x138b72['type']['key']};});_0x37a6f6['model']=_[_0x6e73('0x28')](_['map'](_0x180f96,_0x6e73('0x21')),[_0x6e73('0x21')]);_0x37a6f6['query']=_[_0x6e73('0x29')](_0x387512[_0x6e73('0x2a')]);_0x37a6f6[_0x6e73('0x2b')]=_['intersection'](_0x37a6f6[_0x6e73('0x2c')],_0x37a6f6[_0x6e73('0x2a')]);_0xc6095d['attributes']=_[_0x6e73('0x2d')](_0x37a6f6[_0x6e73('0x2c')],qs['fields'](_0x387512[_0x6e73('0x2a')][_0x6e73('0x2e')]));_0xc6095d[_0x6e73('0x2f')]=_0xc6095d[_0x6e73('0x2f')][_0x6e73('0x30')]?_0xc6095d['attributes']:_0x37a6f6[_0x6e73('0x2c')];if(!_0x387512[_0x6e73('0x2a')][_0x6e73('0x31')](_0x6e73('0x32'))){_0xc6095d[_0x6e73('0x1a')]=qs[_0x6e73('0x1a')](_0x387512['query'][_0x6e73('0x1a')]);_0xc6095d['offset']=qs[_0x6e73('0x19')](_0x387512[_0x6e73('0x2a')][_0x6e73('0x19')]);}_0xc6095d[_0x6e73('0x33')]=qs[_0x6e73('0x34')](_0x387512[_0x6e73('0x2a')][_0x6e73('0x34')]);_0xc6095d[_0x6e73('0x35')]=qs['filters'](_['pick'](_0x387512[_0x6e73('0x2a')],_0x37a6f6[_0x6e73('0x2b')]),_0x180f96);if(_0x387512[_0x6e73('0x2a')][_0x6e73('0x36')]){_0xc6095d[_0x6e73('0x35')]=_[_0x6e73('0x37')](_0xc6095d[_0x6e73('0x35')],{'$or':_['map'](_0x180f96,function(_0x3a4e12){if(_0x3a4e12['type']!==_0x6e73('0x38')){var _0x528f06={};_0x528f06[_0x3a4e12['name']]={'$like':'%'+_0x387512['query']['filter']+'%'};return _0x528f06;}})});}_0xc6095d=_['merge']({},_0xc6095d,_0x387512[_0x6e73('0x39')]);var _0x279367={'where':_0xc6095d['where']};return db['CmCustomField'][_0x6e73('0x3a')](_0x279367)[_0x6e73('0x1f')](function(_0x5d900a){_0x18b1f9[_0x6e73('0x3a')]=_0x5d900a;if(_0x387512[_0x6e73('0x2a')][_0x6e73('0x3b')]){_0xc6095d[_0x6e73('0x3c')]=[{'all':!![]}];}return db[_0x6e73('0x25')][_0x6e73('0x3d')](_0xc6095d);})[_0x6e73('0x1f')](function(_0x51c693){_0x18b1f9[_0x6e73('0x3e')]=_0x51c693;return _0x18b1f9;})[_0x6e73('0x1f')](respondWithFilteredResult(_0x17b263,_0xc6095d))[_0x6e73('0x3f')](handleError(_0x17b263,null));};exports[_0x6e73('0x40')]=function(_0x4a47fd,_0x55e095){var _0x3d87ce={'raw':!![],'where':{'id':_0x4a47fd[_0x6e73('0x41')]['id']}},_0x3e7719={};_0x3e7719[_0x6e73('0x2c')]=_[_0x6e73('0x29')](db['CmCustomField']['rawAttributes']);_0x3e7719[_0x6e73('0x2a')]=_[_0x6e73('0x29')](_0x4a47fd[_0x6e73('0x2a')]);_0x3e7719['filters']=_['intersection'](_0x3e7719[_0x6e73('0x2c')],_0x3e7719[_0x6e73('0x2a')]);_0x3d87ce['attributes']=_['intersection'](_0x3e7719[_0x6e73('0x2c')],qs[_0x6e73('0x2e')](_0x4a47fd['query']['fields']));_0x3d87ce['attributes']=_0x3d87ce[_0x6e73('0x2f')][_0x6e73('0x30')]?_0x3d87ce[_0x6e73('0x2f')]:_0x3e7719[_0x6e73('0x2c')];if(_0x4a47fd[_0x6e73('0x2a')]['includeAll']){_0x3d87ce[_0x6e73('0x3c')]=[{'all':!![]}];}_0x3d87ce=_['merge']({},_0x3d87ce,_0x4a47fd['options']);return db[_0x6e73('0x25')]['find'](_0x3d87ce)[_0x6e73('0x1f')](handleEntityNotFound(_0x55e095,null))[_0x6e73('0x1f')](respondWithResult(_0x55e095,null))[_0x6e73('0x3f')](handleError(_0x55e095,null));};exports[_0x6e73('0x42')]=function(_0x423cde,_0x3ef7a4){if(_0x423cde['body']['id']){delete _0x423cde['body']['id'];}return db[_0x6e73('0x25')][_0x6e73('0x43')]({'where':{'id':_0x423cde['params']['id']}})['then'](handleEntityNotFound(_0x3ef7a4,null))[_0x6e73('0x1f')](saveUpdates(_0x423cde[_0x6e73('0x44')],null))[_0x6e73('0x1f')](respondWithResult(_0x3ef7a4,null))[_0x6e73('0x3f')](handleError(_0x3ef7a4,null));};exports[_0x6e73('0x20')]=function(_0x5e9aa8,_0x1d10a8){return db['CmCustomField'][_0x6e73('0x43')]({'where':{'id':_0x5e9aa8[_0x6e73('0x41')]['id']}})[_0x6e73('0x1f')](handleEntityNotFound(_0x1d10a8,null))['then'](removeEntity(_0x1d10a8,null))[_0x6e73('0x3f')](handleError(_0x1d10a8,null));};exports[_0x6e73('0x45')]=function(_0x185b68,_0x1b6590){var _0x3357ae;return db[_0x6e73('0x46')][_0x6e73('0x47')](function(_0x52c321){return db[_0x6e73('0x25')][_0x6e73('0x45')](_0x185b68[_0x6e73('0x44')],{'transaction':_0x52c321})[_0x6e73('0x1f')](function(_0x9567a4){_0x3357ae=_0x9567a4;var _0x11e4c0={'type':db[_0x6e73('0x48')][_0x6e73('0x49')],'transaction':_0x52c321};switch(_0x185b68['body'][_0x6e73('0x4a')]){case _0x6e73('0x4b'):_0x11e4c0[_0x6e73('0x4a')]=db['Sequelize']['TEXT'];break;case _0x6e73('0x4c'):_0x11e4c0[_0x6e73('0x4a')]=db[_0x6e73('0x48')][_0x6e73('0x4d')];break;case _0x6e73('0x4e'):_0x11e4c0[_0x6e73('0x4a')]=db[_0x6e73('0x48')]['BOOLEAN'];_0x11e4c0[_0x6e73('0x4f')]=![];break;default:}return db['sequelize'][_0x6e73('0x50')][_0x6e73('0x51')]('cm_contacts',util['format'](_0x6e73('0x52'),_0x3357ae['id']),_0x11e4c0);})[_0x6e73('0x1f')](function(){return _0x3357ae;});})['then'](respondWithResult(_0x1b6590,0xc9))[_0x6e73('0x3f')](handleError(_0x1b6590,null));}; \ No newline at end of file +var _0x9147=['intersection','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params'];(function(_0x477281,_0x32ac6f){var _0xec201e=function(_0x554652){while(--_0x554652){_0x477281['push'](_0x477281['shift']());}};_0xec201e(++_0x32ac6f);}(_0x9147,0x1d3));var _0x7914=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x9147[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x7914('0x0'));var emlformat=require(_0x7914('0x1'));var rimraf=require(_0x7914('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var moment=require(_0x7914('0x5'));var BPromise=require(_0x7914('0x6'));var Mustache=require(_0x7914('0x7'));var util=require('util');var path=require(_0x7914('0x8'));var sox=require('sox');var csv=require(_0x7914('0x9'));var ejs=require(_0x7914('0xa'));var fs=require('fs');var _=require(_0x7914('0xb'));var squel=require('squel');var crypto=require(_0x7914('0xc'));var jsforce=require(_0x7914('0xd'));var deskjs=require(_0x7914('0xe'));var toCsv=require(_0x7914('0x9'));var querystring=require(_0x7914('0xf'));var Papa=require(_0x7914('0x10'));var Redis=require(_0x7914('0x11'));var authService=require(_0x7914('0x12'));var qs=require(_0x7914('0x13'));var as=require(_0x7914('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7914('0x15'))(_0x7914('0x16'));var utils=require('../../config/utils');var config=require(_0x7914('0x17'));var db=require(_0x7914('0x18'))['db'];function respondWithStatusCode(_0x1e82ff,_0xd9e4bc){_0xd9e4bc=_0xd9e4bc||0xcc;return function(_0x19a065){if(_0x19a065){return _0x1e82ff[_0x7914('0x19')](_0xd9e4bc);}return _0x1e82ff['status'](_0xd9e4bc)[_0x7914('0x1a')]();};}function respondWithResult(_0x318b85,_0x18a515){_0x18a515=_0x18a515||0xc8;return function(_0x2d3bde){if(_0x2d3bde){return _0x318b85[_0x7914('0x1b')](_0x18a515)[_0x7914('0x1c')](_0x2d3bde);}};}function respondWithFilteredResult(_0x463aaa,_0x5be0da){return function(_0x5a6a62){if(_0x5a6a62){var _0x441fde=_0x5a6a62[_0x7914('0x1d')],_0x540d94=_0x5be0da[_0x7914('0x1e')],_0x508786=_0x5be0da[_0x7914('0x1e')]+_0x5be0da['limit'],_0x16c464;if(_0x508786>=_0x441fde){_0x508786=_0x441fde;_0x16c464=0xc8;}else{_0x16c464=0xce;}_0x463aaa[_0x7914('0x1b')](_0x16c464);return _0x463aaa[_0x7914('0x1f')](_0x7914('0x20'),_0x540d94+'-'+_0x508786+'/'+_0x441fde)[_0x7914('0x1c')](_0x5a6a62);}return null;};}function patchUpdates(_0x1a5633){return function(_0x386a8d){try{jsonpatch[_0x7914('0x21')](_0x386a8d,_0x1a5633,!![]);}catch(_0x3a4934){return BPromise[_0x7914('0x22')](_0x3a4934);}return _0x386a8d[_0x7914('0x23')]();};}function saveUpdates(_0xab1665,_0x3d3cbc){return function(_0x101410){if(_0x101410){return _0x101410[_0x7914('0x24')](_0xab1665)['then'](function(_0x4e5b57){return _0x4e5b57;});}return null;};}function removeEntity(_0x1aebe6,_0xe593c6){return function(_0x3da896){if(_0x3da896){return _0x3da896[_0x7914('0x25')]()['then'](function(){_0x1aebe6[_0x7914('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e1a5f,_0x3e1b61){return function(_0x4b4e81){if(!_0x4b4e81){_0x4e1a5f[_0x7914('0x19')](0x194);}return _0x4b4e81;};}function handleError(_0x5367ed,_0x3ad60b){_0x3ad60b=_0x3ad60b||0x1f4;return function(_0x537b11){logger['error'](_0x537b11[_0x7914('0x26')]);if(_0x537b11[_0x7914('0x27')]){delete _0x537b11[_0x7914('0x27')];}_0x5367ed[_0x7914('0x1b')](_0x3ad60b)['send'](_0x537b11);};}exports[_0x7914('0x28')]=function(_0x3ea7c0,_0x570593){var _0x2e7054={},_0x299d15={},_0x2753c5={'count':0x0,'rows':[]};var _0x5674f2=_[_0x7914('0x29')](db[_0x7914('0x2a')][_0x7914('0x2b')],function(_0x209448){return{'name':_0x209448[_0x7914('0x2c')],'type':_0x209448[_0x7914('0x2d')][_0x7914('0x2e')]};});_0x299d15[_0x7914('0x2f')]=_[_0x7914('0x30')](_['map'](_0x5674f2,_0x7914('0x27')),['name']);_0x299d15[_0x7914('0x31')]=_[_0x7914('0x32')](_0x3ea7c0['query']);_0x299d15[_0x7914('0x33')]=_['intersection'](_0x299d15[_0x7914('0x2f')],_0x299d15['query']);_0x2e7054[_0x7914('0x34')]=_['intersection'](_0x299d15[_0x7914('0x2f')],qs[_0x7914('0x35')](_0x3ea7c0['query'][_0x7914('0x35')]));_0x2e7054[_0x7914('0x34')]=_0x2e7054['attributes'][_0x7914('0x36')]?_0x2e7054[_0x7914('0x34')]:_0x299d15['model'];if(!_0x3ea7c0[_0x7914('0x31')][_0x7914('0x37')](_0x7914('0x38'))){_0x2e7054[_0x7914('0x39')]=qs['limit'](_0x3ea7c0[_0x7914('0x31')][_0x7914('0x39')]);_0x2e7054[_0x7914('0x1e')]=qs['offset'](_0x3ea7c0[_0x7914('0x31')][_0x7914('0x1e')]);}_0x2e7054[_0x7914('0x3a')]=qs[_0x7914('0x3b')](_0x3ea7c0['query']['sort']);_0x2e7054['where']=qs[_0x7914('0x33')](_[_0x7914('0x3c')](_0x3ea7c0[_0x7914('0x31')],_0x299d15['filters']),_0x5674f2);if(_0x3ea7c0['query'][_0x7914('0x3d')]){_0x2e7054[_0x7914('0x3e')]=_[_0x7914('0x3f')](_0x2e7054[_0x7914('0x3e')],{'$or':_[_0x7914('0x29')](_0x5674f2,function(_0x4d8e12){if(_0x4d8e12[_0x7914('0x2d')]!=='VIRTUAL'){var _0x1b05ef={};_0x1b05ef[_0x4d8e12['name']]={'$like':'%'+_0x3ea7c0[_0x7914('0x31')][_0x7914('0x3d')]+'%'};return _0x1b05ef;}})});}_0x2e7054=_['merge']({},_0x2e7054,_0x3ea7c0[_0x7914('0x40')]);var _0x21cb07={'where':_0x2e7054['where']};return db[_0x7914('0x2a')][_0x7914('0x1d')](_0x21cb07)[_0x7914('0x41')](function(_0xc9e178){_0x2753c5['count']=_0xc9e178;if(_0x3ea7c0[_0x7914('0x31')][_0x7914('0x42')]){_0x2e7054[_0x7914('0x43')]=[{'all':!![]}];}return db[_0x7914('0x2a')][_0x7914('0x44')](_0x2e7054);})[_0x7914('0x41')](function(_0x3bfd83){_0x2753c5[_0x7914('0x45')]=_0x3bfd83;return _0x2753c5;})['then'](respondWithFilteredResult(_0x570593,_0x2e7054))[_0x7914('0x46')](handleError(_0x570593,null));};exports[_0x7914('0x47')]=function(_0x82a15d,_0x2ca403){var _0x56751c={'raw':!![],'where':{'id':_0x82a15d[_0x7914('0x48')]['id']}},_0x58712f={};_0x58712f[_0x7914('0x2f')]=_['keys'](db['CmCustomField'][_0x7914('0x2b')]);_0x58712f['query']=_['keys'](_0x82a15d['query']);_0x58712f[_0x7914('0x33')]=_[_0x7914('0x49')](_0x58712f['model'],_0x58712f['query']);_0x56751c[_0x7914('0x34')]=_['intersection'](_0x58712f[_0x7914('0x2f')],qs[_0x7914('0x35')](_0x82a15d['query'][_0x7914('0x35')]));_0x56751c[_0x7914('0x34')]=_0x56751c['attributes'][_0x7914('0x36')]?_0x56751c[_0x7914('0x34')]:_0x58712f[_0x7914('0x2f')];if(_0x82a15d[_0x7914('0x31')][_0x7914('0x42')]){_0x56751c['include']=[{'all':!![]}];}_0x56751c=_[_0x7914('0x3f')]({},_0x56751c,_0x82a15d[_0x7914('0x40')]);return db['CmCustomField'][_0x7914('0x4a')](_0x56751c)[_0x7914('0x41')](handleEntityNotFound(_0x2ca403,null))[_0x7914('0x41')](respondWithResult(_0x2ca403,null))[_0x7914('0x46')](handleError(_0x2ca403,null));};exports[_0x7914('0x24')]=function(_0x38d47b,_0xb665c){if(_0x38d47b['body']['id']){delete _0x38d47b[_0x7914('0x4b')]['id'];}return db[_0x7914('0x2a')][_0x7914('0x4a')]({'where':{'id':_0x38d47b[_0x7914('0x48')]['id']}})[_0x7914('0x41')](handleEntityNotFound(_0xb665c,null))[_0x7914('0x41')](saveUpdates(_0x38d47b[_0x7914('0x4b')],null))[_0x7914('0x41')](respondWithResult(_0xb665c,null))[_0x7914('0x46')](handleError(_0xb665c,null));};exports[_0x7914('0x25')]=function(_0xe24291,_0x1486ed){return db[_0x7914('0x2a')][_0x7914('0x4a')]({'where':{'id':_0xe24291[_0x7914('0x48')]['id']}})[_0x7914('0x41')](handleEntityNotFound(_0x1486ed,null))['then'](removeEntity(_0x1486ed,null))['catch'](handleError(_0x1486ed,null));};exports[_0x7914('0x4c')]=function(_0x561d2c,_0x24dcc3){var _0x593027;return db[_0x7914('0x4d')][_0x7914('0x4e')](function(_0x17e1b9){return db[_0x7914('0x2a')][_0x7914('0x4c')](_0x561d2c[_0x7914('0x4b')],{'transaction':_0x17e1b9})[_0x7914('0x41')](function(_0xbea37d){_0x593027=_0xbea37d;var _0x1461fe={'type':db[_0x7914('0x4f')][_0x7914('0x50')],'transaction':_0x17e1b9};switch(_0x561d2c[_0x7914('0x4b')][_0x7914('0x2d')]){case _0x7914('0x51'):_0x1461fe[_0x7914('0x2d')]=db[_0x7914('0x4f')][_0x7914('0x50')];break;case _0x7914('0x52'):_0x1461fe['type']=db[_0x7914('0x4f')][_0x7914('0x53')];break;case _0x7914('0x54'):_0x1461fe[_0x7914('0x2d')]=db[_0x7914('0x4f')][_0x7914('0x55')];_0x1461fe[_0x7914('0x56')]=![];break;default:}return db[_0x7914('0x4d')][_0x7914('0x57')]['addColumn'](_0x7914('0x58'),util['format'](_0x7914('0x59'),_0x593027['id']),_0x1461fe);})['then'](function(){return _0x593027;});})['then'](respondWithResult(_0x24dcc3,0xc9))[_0x7914('0x46')](handleError(_0x24dcc3,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index bda9c43..31ccb21 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 _0x0ffc=['./cmCustomField.attributes','exports','define','cm_custom_fields','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d2507,_0x556fac){var _0x198c07=function(_0x2e2b6b){while(--_0x2e2b6b){_0x5d2507['push'](_0x5d2507['shift']());}};_0x198c07(++_0x556fac);}(_0x0ffc,0x9e));var _0xc0ff=function(_0x3fe000,_0x1582ec){_0x3fe000=_0x3fe000-0x0;var _0x4da745=_0x0ffc[_0x3fe000];return _0x4da745;};'use strict';var _=require('lodash');var util=require(_0xc0ff('0x0'));var logger=require(_0xc0ff('0x1'))('api');var moment=require(_0xc0ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0ff('0x3'));var fs=require('fs');var path=require(_0xc0ff('0x4'));var rimraf=require(_0xc0ff('0x5'));var config=require(_0xc0ff('0x6'));var attributes=require(_0xc0ff('0x7'));module[_0xc0ff('0x8')]=function(_0x2fe7a2,_0x1b69a1){return _0x2fe7a2[_0xc0ff('0x9')]('CmCustomField',attributes,{'tableName':_0xc0ff('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f18=['path','rimraf','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','../../config/logger','moment','bluebird'];(function(_0x5ecef1,_0x44ae74){var _0x1a9a97=function(_0x97a1da){while(--_0x97a1da){_0x5ecef1['push'](_0x5ecef1['shift']());}};_0x1a9a97(++_0x44ae74);}(_0x6f18,0x1b4));var _0x86f1=function(_0x30ba59,_0x3324cd){_0x30ba59=_0x30ba59-0x0;var _0x8bf08c=_0x6f18[_0x30ba59];return _0x8bf08c;};'use strict';var _=require(_0x86f1('0x0'));var util=require('util');var logger=require(_0x86f1('0x1'))('api');var moment=require(_0x86f1('0x2'));var BPromise=require(_0x86f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86f1('0x4'));var rimraf=require(_0x86f1('0x5'));var config=require('../../config/environment');var attributes=require(_0x86f1('0x6'));module[_0x86f1('0x7')]=function(_0x3c91dc,_0x15a5e1){return _0x3c91dc[_0x86f1('0x8')]('CmCustomField',attributes,{'tableName':_0x86f1('0x9'),'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 5b7c0c1..b9a547f 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 _0xe5b3=['request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCustomField,\x20%s,\x20%s'];(function(_0x4144c0,_0x253e2b){var _0x424d45=function(_0x5f1644){while(--_0x5f1644){_0x4144c0['push'](_0x4144c0['shift']());}};_0x424d45(++_0x253e2b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3760f1,_0x498373){_0x3760f1=_0x3760f1-0x0;var _0x14d886=_0xe5b3[_0x3760f1];return _0x14d886;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('CmCustomField,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','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'];(function(_0x4c1ca9,_0x46c160){var _0x5bd74a=function(_0x451e9f){while(--_0x451e9f){_0x4c1ca9['push'](_0x4c1ca9['shift']());}};_0x5bd74a(++_0x46c160);}(_0x81bd,0x7c));var _0xd81b=function(_0x48dfc7,_0x28410f){_0x48dfc7=_0x48dfc7-0x0;var _0x553cbf=_0x81bd[_0x48dfc7];return _0x553cbf;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('CmCustomField,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('CmCustomField,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 683567d..9e0ea60 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 _0x194f=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x194f,0x188));var _0xf194=function(_0xa7f826,_0x508057){_0xa7f826=_0xa7f826-0x0;var _0x199210=_0x194f[_0xa7f826];return _0x199210;};'use strict';var multer=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var path=require('path');var timeout=require(_0xf194('0x2'));var express=require(_0xf194('0x3'));var router=express[_0xf194('0x4')]();var auth=require(_0xf194('0x5'));var interaction=require(_0xf194('0x6'));var config=require(_0xf194('0x7'));var controller=require(_0xf194('0x8'));router[_0xf194('0x9')]('/',auth[_0xf194('0xa')](),controller[_0xf194('0xb')]);router[_0xf194('0x9')]('/:id',auth[_0xf194('0xa')](),controller['show']);router[_0xf194('0xc')]('/',auth['isAuthenticated'](),controller[_0xf194('0xd')]);router[_0xf194('0xe')](_0xf194('0xf'),auth[_0xf194('0xa')](),controller['update']);router['delete'](_0xf194('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xf194('0x10')]=router; \ No newline at end of file +var _0xc425=['show','post','put','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xa8c447,_0x181dbe){var _0x87bdfa=function(_0x74dd56){while(--_0x74dd56){_0xa8c447['push'](_0xa8c447['shift']());}};_0x87bdfa(++_0x181dbe);}(_0xc425,0x149));var _0x5c42=function(_0x2ea985,_0x566d48){_0x2ea985=_0x2ea985-0x0;var _0x39db0a=_0xc425[_0x2ea985];return _0x39db0a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5c42('0x0'));var express=require(_0x5c42('0x1'));var router=express[_0x5c42('0x2')]();var auth=require(_0x5c42('0x3'));var interaction=require(_0x5c42('0x4'));var config=require('../../config/environment');var controller=require('./cmCustomField.controller');router[_0x5c42('0x5')]('/',auth[_0x5c42('0x6')](),controller[_0x5c42('0x7')]);router[_0x5c42('0x5')](_0x5c42('0x8'),auth[_0x5c42('0x6')](),controller[_0x5c42('0x9')]);router[_0x5c42('0xa')]('/',auth[_0x5c42('0x6')](),controller['create']);router[_0x5c42('0xb')](_0x5c42('0x8'),auth[_0x5c42('0x6')](),controller['update']);router['delete'](_0x5c42('0x8'),auth['isAuthenticated'](),controller[_0x5c42('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 4be07a4..014c5c4 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 _0x4819=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x17003a,_0x42e742){var _0xceb4a1=function(_0x3e2675){while(--_0x3e2675){_0x17003a['push'](_0x17003a['shift']());}};_0xceb4a1(++_0x42e742);}(_0x4819,0xcd));var _0x9481=function(_0xb4947e,_0x39de27){_0xb4947e=_0xb4947e-0x0;var _0x2af6df=_0x4819[_0xb4947e];return _0x2af6df;};'use strict';var moment=require('moment');var Sequelize=require(_0x9481('0x0'));module[_0x9481('0x1')]={'phone':{'type':Sequelize[_0x9481('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9481('0x4')],'defaultValue':moment()[_0x9481('0x5')](_0x9481('0x6'))},'countbusyretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9481('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9481('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9481('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9481('0x7')],'unique':_0x9481('0x9')},'ListId':{'type':Sequelize[_0x9481('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x9481('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x9481('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9481('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file +var _0xadb5=['DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN'];(function(_0x26f300,_0x3115c0){var _0x53bf7c=function(_0x5b7793){while(--_0x5b7793){_0x26f300['push'](_0x26f300['shift']());}};_0x53bf7c(++_0x3115c0);}(_0xadb5,0xad));var _0x5adb=function(_0x29a0e3,_0x100052){_0x29a0e3=_0x29a0e3-0x0;var _0x27f866=_0xadb5[_0x29a0e3];return _0x27f866;};'use strict';var moment=require('moment');var Sequelize=require(_0x5adb('0x0'));module['exports']={'phone':{'type':Sequelize[_0x5adb('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5adb('0x3')],'defaultValue':moment()['format'](_0x5adb('0x4'))},'countbusyretry':{'type':Sequelize[_0x5adb('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5adb('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5adb('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5adb('0x3')]},'priority':{'type':Sequelize[_0x5adb('0x5')](0x2)[_0x5adb('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5adb('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5adb('0x5')],'unique':_0x5adb('0x7')},'ListId':{'type':Sequelize[_0x5adb('0x5')],'unique':_0x5adb('0x7')},'UserId':{'type':Sequelize[_0x5adb('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x5adb('0x5')],'unique':_0x5adb('0x7')},'CampaignId':{'type':Sequelize[_0x5adb('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5adb('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5adb('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5adb('0x5')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9f2847b..87c97f3 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 _0xa7bd=['$contained','$any','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','getVoiceQueues','dialOrderByScheduledAt','sequelize','direction','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','outbound','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','push','utcOffset','timezones','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$contains'];(function(_0x4bc04d,_0x348a7d){var _0x5c7a77=function(_0x6886dd){while(--_0x6886dd){_0x4bc04d['push'](_0x4bc04d['shift']());}};_0x5c7a77(++_0x348a7d);}(_0xa7bd,0xe7));var _0xda7b=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0xa7bd[_0x1559a5];return _0x17a783;};'use strict';var pdf=require(_0xda7b('0x0'));var emlformat=require(_0xda7b('0x1'));var rimraf=require(_0xda7b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda7b('0x3'));var rp=require(_0xda7b('0x4'));var moment=require(_0xda7b('0x5'));var BPromise=require(_0xda7b('0x6'));var Mustache=require(_0xda7b('0x7'));var util=require(_0xda7b('0x8'));var path=require(_0xda7b('0x9'));var sox=require(_0xda7b('0xa'));var csv=require(_0xda7b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xda7b('0xc'));var crypto=require(_0xda7b('0xd'));var jsforce=require(_0xda7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xda7b('0xf'));var Papa=require(_0xda7b('0x10'));var Redis=require(_0xda7b('0x11'));var shared=require(_0xda7b('0x12'));var authService=require(_0xda7b('0x13'));var qs=require(_0xda7b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda7b('0x15'));var logger=require(_0xda7b('0x16'))(_0xda7b('0x17'));var utils=require(_0xda7b('0x18'));var config=require(_0xda7b('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ba56,_0x2340d7){_0x2340d7=_0x2340d7||0xcc;return function(_0x4f5d79){if(_0x4f5d79){return _0x40ba56[_0xda7b('0x19')](_0x2340d7);}return _0x40ba56[_0xda7b('0x1a')](_0x2340d7)['end']();};}function respondWithResult(_0x490709,_0x3c2107){_0x3c2107=_0x3c2107||0xc8;return function(_0x3bb1df){if(_0x3bb1df){return _0x490709[_0xda7b('0x1a')](_0x3c2107)[_0xda7b('0x1b')](_0x3bb1df);}};}function respondWithFilteredResult(_0x27b26d,_0x2f21a3){return function(_0x50577f){if(_0x50577f){var _0x322144=_0x50577f[_0xda7b('0x1c')],_0x299c68=_0x2f21a3[_0xda7b('0x1d')],_0x6d3fbb=_0x2f21a3[_0xda7b('0x1d')]+_0x2f21a3[_0xda7b('0x1e')],_0x4d7299;if(_0x6d3fbb>=_0x322144){_0x6d3fbb=_0x322144;_0x4d7299=0xc8;}else{_0x4d7299=0xce;}_0x27b26d[_0xda7b('0x1a')](_0x4d7299);return _0x27b26d[_0xda7b('0x1f')]('Content-Range',_0x299c68+'-'+_0x6d3fbb+'/'+_0x322144)['json'](_0x50577f);}return null;};}function patchUpdates(_0xd2092e){return function(_0x440b92){try{jsonpatch['apply'](_0x440b92,_0xd2092e,!![]);}catch(_0x35d38c){return BPromise[_0xda7b('0x20')](_0x35d38c);}return _0x440b92[_0xda7b('0x21')]();};}function saveUpdates(_0x5134c8,_0x1f3530){return function(_0xad4b28){if(_0xad4b28){return _0xad4b28[_0xda7b('0x22')](_0x5134c8)[_0xda7b('0x23')](function(_0x5e8ba4){return _0x5e8ba4;});}return null;};}function removeEntity(_0x15f2ad,_0x1de261){return function(_0x57fa3f){if(_0x57fa3f){return _0x57fa3f[_0xda7b('0x24')]()[_0xda7b('0x23')](function(){_0x15f2ad[_0xda7b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1da32b,_0x1bcc16){return function(_0x2cdf55){if(!_0x2cdf55){_0x1da32b[_0xda7b('0x19')](0x194);}return _0x2cdf55;};}function handleError(_0x136046,_0x13bdea){_0x13bdea=_0x13bdea||0x1f4;return function(_0x18073d){logger[_0xda7b('0x25')](_0x18073d['stack']);if(_0x18073d[_0xda7b('0x26')]){delete _0x18073d['name'];}_0x136046[_0xda7b('0x1a')](_0x13bdea)[_0xda7b('0x27')](_0x18073d);};}exports[_0xda7b('0x28')]=function(_0x2bad4d,_0x288ed7){var _0x1c2a39={},_0x3c617a={},_0x5e1b69={'count':0x0,'rows':[]};var _0x30021e=_[_0xda7b('0x29')](db[_0xda7b('0x2a')][_0xda7b('0x2b')],function(_0x22aa08){return{'name':_0x22aa08[_0xda7b('0x2c')],'type':_0x22aa08[_0xda7b('0x2d')][_0xda7b('0x2e')]};});_0x3c617a[_0xda7b('0x2f')]=_[_0xda7b('0x29')](_0x30021e,_0xda7b('0x26'));_0x3c617a[_0xda7b('0x30')]=_[_0xda7b('0x31')](_0x2bad4d[_0xda7b('0x30')]);_0x3c617a[_0xda7b('0x32')]=_[_0xda7b('0x33')](_0x3c617a[_0xda7b('0x2f')],_0x3c617a[_0xda7b('0x30')]);_0x3c617a['filters']=_['concat'](_0x3c617a[_0xda7b('0x32')],[_0xda7b('0x34'),_0xda7b('0x35'),_0xda7b('0x36'),_0xda7b('0x37'),'$lt',_0xda7b('0x38'),_0xda7b('0x39'),_0xda7b('0x3a'),_0xda7b('0x3b'),'$between',_0xda7b('0x3c'),'$in',_0xda7b('0x3d'),_0xda7b('0x3e'),_0xda7b('0x3f'),_0xda7b('0x40'),_0xda7b('0x41'),'$like','$overlap',_0xda7b('0x42'),_0xda7b('0x43'),_0xda7b('0x44')]);_0x1c2a39[_0xda7b('0x45')]=_[_0xda7b('0x33')](_0x3c617a[_0xda7b('0x2f')],qs[_0xda7b('0x46')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x46')]));_0x1c2a39[_0xda7b('0x45')]=_0x1c2a39[_0xda7b('0x45')]['length']?_0x1c2a39[_0xda7b('0x45')]:_0x3c617a[_0xda7b('0x2f')];if(!_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x47')]('nolimit')){_0x1c2a39['limit']=qs[_0xda7b('0x1e')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x1e')]);_0x1c2a39['offset']=qs[_0xda7b('0x1d')](_0x2bad4d[_0xda7b('0x30')][_0xda7b('0x1d')]);}_0x1c2a39[_0xda7b('0x48')]=qs[_0xda7b('0x49')](_0x2bad4d[_0xda7b('0x30')]['sort']);_0x1c2a39['where']=qs[_0xda7b('0x32')](_[_0xda7b('0x4a')](_0x2bad4d[_0xda7b('0x30')],_0x3c617a[_0xda7b('0x32')]),_0x30021e);if(_0x2bad4d[_0xda7b('0x30')]['filter']){_0x1c2a39[_0xda7b('0x4b')]=_[_0xda7b('0x4c')](_0x1c2a39[_0xda7b('0x4b')],{'$or':_[_0xda7b('0x29')](_0x30021e,function(_0x250ed8){if(_0x250ed8['type']!==_0xda7b('0x4d')){var _0x487faf={};_0x487faf[_0x250ed8[_0xda7b('0x26')]]={'$like':'%'+_0x2bad4d['query']['filter']+'%'};return _0x487faf;}})});}_0x1c2a39=_[_0xda7b('0x4c')]({},_0x1c2a39,_0x2bad4d[_0xda7b('0x4e')]);var _0x4609de={'where':_0x1c2a39['where']};return db[_0xda7b('0x2a')][_0xda7b('0x1c')](_0x4609de)[_0xda7b('0x23')](function(_0x5d04b7){_0x5e1b69[_0xda7b('0x1c')]=_0x5d04b7;if(_0x2bad4d[_0xda7b('0x30')]['includeAll']){_0x1c2a39[_0xda7b('0x4f')]=[{'all':!![]}];}return db[_0xda7b('0x2a')][_0xda7b('0x50')](_0x1c2a39);})[_0xda7b('0x23')](function(_0x23fe1a){_0x5e1b69[_0xda7b('0x51')]=_0x23fe1a;return _0x5e1b69;})[_0xda7b('0x23')](respondWithFilteredResult(_0x288ed7,_0x1c2a39))[_0xda7b('0x52')](handleError(_0x288ed7,null));};exports[_0xda7b('0x53')]=function(_0x15e8c4,_0x4eb253){var _0x4d469e={'raw':!![],'where':{'id':_0x15e8c4[_0xda7b('0x54')]['id']}},_0x20c8da={};_0x20c8da[_0xda7b('0x2f')]=_[_0xda7b('0x31')](db[_0xda7b('0x2a')][_0xda7b('0x2b')]);_0x20c8da[_0xda7b('0x30')]=_[_0xda7b('0x31')](_0x15e8c4[_0xda7b('0x30')]);_0x20c8da[_0xda7b('0x32')]=_['intersection'](_0x20c8da['model'],_0x20c8da['query']);_0x4d469e[_0xda7b('0x45')]=_[_0xda7b('0x33')](_0x20c8da[_0xda7b('0x2f')],qs[_0xda7b('0x46')](_0x15e8c4[_0xda7b('0x30')][_0xda7b('0x46')]));_0x4d469e[_0xda7b('0x45')]=_0x4d469e[_0xda7b('0x45')][_0xda7b('0x55')]?_0x4d469e['attributes']:_0x20c8da[_0xda7b('0x2f')];if(_0x15e8c4[_0xda7b('0x30')][_0xda7b('0x56')]){_0x4d469e[_0xda7b('0x4f')]=[{'all':!![]}];}_0x4d469e=_[_0xda7b('0x4c')]({},_0x4d469e,_0x15e8c4['options']);return db[_0xda7b('0x2a')][_0xda7b('0x57')](_0x4d469e)['then'](handleEntityNotFound(_0x4eb253,null))[_0xda7b('0x23')](respondWithResult(_0x4eb253,null))[_0xda7b('0x52')](handleError(_0x4eb253,null));};exports[_0xda7b('0x58')]=function(_0x57f06e,_0x530111){return db['CmHopper']['create'](_0x57f06e['body'],{})[_0xda7b('0x23')](respondWithResult(_0x530111,0xc9))[_0xda7b('0x52')](handleError(_0x530111,null));};exports[_0xda7b('0x22')]=function(_0x1fd282,_0x31c4e4){if(_0x1fd282[_0xda7b('0x59')]['id']){delete _0x1fd282[_0xda7b('0x59')]['id'];}return db[_0xda7b('0x2a')][_0xda7b('0x57')]({'where':{'id':_0x1fd282[_0xda7b('0x54')]['id']}})[_0xda7b('0x23')](handleEntityNotFound(_0x31c4e4,null))[_0xda7b('0x23')](saveUpdates(_0x1fd282[_0xda7b('0x59')],null))[_0xda7b('0x23')](respondWithResult(_0x31c4e4,null))[_0xda7b('0x52')](handleError(_0x31c4e4,null));};exports[_0xda7b('0x5a')]=function(_0xad35f4,_0x563a2c){return db[_0xda7b('0x2a')][_0xda7b('0x5a')]()['then'](respondWithResult(_0x563a2c,null))[_0xda7b('0x52')](handleError(_0x563a2c,null));};exports[_0xda7b('0x24')]=function(_0x1faaf4,_0x2d0dbb){var _0x67534a;return db['CmHopper']['find']({'where':{'id':_0x1faaf4[_0xda7b('0x54')]['id']}})[_0xda7b('0x23')](handleEntityNotFound(_0x2d0dbb,null))['then'](function(_0x5216a5){if(_0x5216a5){return _0x5216a5['destroy']()[_0xda7b('0x23')](function(_0x120125){return _0x120125;});}})[_0xda7b('0x23')](function(_0x15ec19){_0x67534a=_0x15ec19;if(_0x15ec19){if(_0x15ec19[_0xda7b('0x5b')]||_0x15ec19[_0xda7b('0x5c')]){return db[_0x15ec19['VoiceQueueId']?_0xda7b('0x5d'):_0xda7b('0x5e')][_0xda7b('0x57')]({'where':{'id':_0x15ec19['VoiceQueueId']?_0x15ec19[_0xda7b('0x5b')]:_0x15ec19[_0xda7b('0x5c')]},'attributes':['id',_0xda7b('0x26')],'raw':!![]});}}})['then'](function(_0x1b6dc2){var _0x2fd30c={};if(_0x1b6dc2){_[_0xda7b('0x4c')](_0x2fd30c,_[_0xda7b('0x5f')](_0x67534a[_0xda7b('0x60')],[_0xda7b('0x61'),_0xda7b('0x62'),'id']));_0x2fd30c[_0xda7b('0x63')]=0x15;_0x2fd30c['statedesc']='deleted';_0x2fd30c[_0xda7b('0x64')]=_0x1b6dc2[_0xda7b('0x26')];_0x2fd30c[_0xda7b('0x65')]=_0x1faaf4[_0xda7b('0x66')][_0xda7b('0x26')];_0x2fd30c[_0xda7b('0x67')]=_0x1faaf4[_0xda7b('0x66')]['id'];_0x2fd30c['deleted']=!![];_0x2fd30c['deletedat']=moment()[_0xda7b('0x68')](_0xda7b('0x69'));_0x2fd30c[_0xda7b('0x6a')]=_0x67534a['phone'];_0x2fd30c[_0xda7b('0x6b')]=_0x67534a[_0xda7b('0x5b')]?_0xda7b('0x6c'):'ivr';return db[_0xda7b('0x6d')][_0xda7b('0x57')]({'where':{'id':_0x2fd30c[_0xda7b('0x6e')]},'attributes':[_0xda7b('0x6f'),_0xda7b('0x70')]})[_0xda7b('0x23')](function(_0x364b55){if(!_[_0xda7b('0x71')](_0x2d0dbb)&&!_[_0xda7b('0x71')](_0x364b55[_0xda7b('0x6f')])){_0x2fd30c[_0xda7b('0x72')]=_0x364b55[_0xda7b('0x6f')];if(!_[_0xda7b('0x71')](_0x364b55[_0xda7b('0x70')])){_0x2fd30c['calleridname']+='\x20'+_0x364b55[_0xda7b('0x70')];}}})['finally'](function(){return db[_0xda7b('0x73')]['create'](_0x2fd30c);});}})[_0xda7b('0x23')](function(){return _0x2d0dbb[_0xda7b('0x1a')](0xcc)[_0xda7b('0x74')]();})[_0xda7b('0x52')](handleError(_0x2d0dbb,null));};exports[_0xda7b('0x75')]=function(_0x5ee305,_0x45a1a2,_0x1a4724){var _0x5dd7ba=[];return db[_0xda7b('0x6d')][_0xda7b('0x5a')]()[_0xda7b('0x23')](function(_0x13409b){_0x5dd7ba=_[_0xda7b('0x31')](_0x13409b);return _0x5ee305['user'][_0xda7b('0x76')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xda7b('0x77')],'raw':!![]});})[_0xda7b('0x23')](function(_0x2eb093){if(_0x2eb093&&_0x2eb093['length']){return db[_0xda7b('0x78')]['transaction'](function(_0x3baf55){var _0x377f79={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xda7b('0x68')](_0xda7b('0x69'))},'VoiceQueueId':{'$in':_[_0xda7b('0x29')](_0x2eb093,'id')},'$or':[{'UserId':null},{'UserId':_0x5ee305[_0xda7b('0x66')]['id']}]};var _0x31fff8=[];if(_0x5ee305[_0xda7b('0x59')][_0xda7b('0x79')]&&_0x5ee305['body']['direction']==='prev'){if(!_[_0xda7b('0x7a')](_0x5ee305[_0xda7b('0x59')]['hopperIds'])){_0x377f79['id']={'$in':_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')]};}_0x31fff8=[[_0xda7b('0x7c'),_0xda7b('0x7d')],['scheduledAt',_0x2eb093[0x0]['dialOrderByScheduledAt']===_0xda7b('0x7d')?_0xda7b('0x7e'):'ASC'],db['sequelize']['literal'](_0xda7b('0x7f')),['id',_0xda7b('0x7e')]];}else{if(!_[_0xda7b('0x7a')](_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')])){_0x377f79['id']={'$notIn':_0x5ee305[_0xda7b('0x59')][_0xda7b('0x7b')]};}_0x31fff8=[[_0xda7b('0x7c'),'DESC'],[_0xda7b('0x80'),_0x2eb093[0x0][_0xda7b('0x77')]],db['sequelize'][_0xda7b('0x81')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xda7b('0x7d')]];}return db[_0xda7b('0x2a')][_0xda7b('0x82')]({'attributes':['id',_0xda7b('0x83')],'where':_0x377f79,'order':_0x31fff8,'transaction':_0x3baf55,'lock':_0x3baf55[_0xda7b('0x84')][_0xda7b('0x85')],'include':[{'model':db[_0xda7b('0x6d')],'as':_0xda7b('0x86'),'attributes':_0x5dd7ba,'include':[{'model':db[_0xda7b('0x87')],'as':_0xda7b('0x88'),'attributes':['id',_0xda7b('0x26')]}]},{'model':db['CmList'],'as':_0xda7b('0x89'),'attributes':['id',_0xda7b('0x26')]},{'model':db[_0xda7b('0x5d')],'as':_0xda7b('0x8a'),'attributes':['id',_0xda7b('0x26'),_0xda7b('0x8b')]}]})[_0xda7b('0x23')](function(_0x50a64e){if(_0x50a64e){return _0x50a64e[_0xda7b('0x22')]({'UserId':_0x5ee305[_0xda7b('0x66')]['id']},{'transaction':_0x3baf55});}});});}})['then'](handleEntityNotFound(_0x45a1a2,null))[_0xda7b('0x23')](respondWithResult(_0x45a1a2,null))[_0xda7b('0x52')](handleError(_0x45a1a2,null));};exports[_0xda7b('0x8c')]=function(_0x2952fe,_0x4c03f3,_0x286a25){return _0x2952fe['user'][_0xda7b('0x76')]({'where':{'type':_0xda7b('0x8d'),'dialActive':!![],'dialMethod':_0xda7b('0x8e')},'attributes':['id'],'raw':!![]})[_0xda7b('0x23')](function(_0x51e627){if(_0x51e627&&_0x51e627[_0xda7b('0x55')]){return db['CmHopper'][_0xda7b('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xda7b('0x69'))},'VoiceQueueId':{'$in':_[_0xda7b('0x29')](_0x51e627,'id')},'$or':[{'UserId':null},{'UserId':_0x2952fe[_0xda7b('0x66')]['id']}]}});}return 0x0;})[_0xda7b('0x23')](function(_0x514ad2){if(!_['isNil'](_0x514ad2)&&_[_0xda7b('0x8f')](_0x514ad2)){return _0x4c03f3[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')]({'contacts':_0x514ad2});}else{logger[_0xda7b('0x25')](_0xda7b('0x90'),_0xda7b('0x8c'),0x194,_0xda7b('0x91'));_0x4c03f3[_0xda7b('0x19')](0x194);}})[_0xda7b('0x52')](handleError(_0x4c03f3,null));};exports['getTimezones']=function(_0x49ba73,_0x1af20f,_0x243578){var _0x5d4b19=shared['timezones'];var _0x100bba=[];_['map'](_0x5d4b19,function(_0x448a2a){_0x100bba[_0xda7b('0x92')]({'id':_0x448a2a['name'],'name':_0x448a2a[_0xda7b('0x26')],'utcOffset':_0x448a2a[_0xda7b('0x93')]});});return _0x1af20f[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')]({'tz':_0x100bba});};exports['getTimezone']=function(_0x3bed22,_0x1d1f8f,_0x487970){var _0x3d282e=shared[_0xda7b('0x94')];var _0x230b53={};if(!_[_0xda7b('0x71')](_0x3d282e[_0x3bed22[_0xda7b('0x59')]['id']]))_0x230b53=_0x3d282e[_0x3bed22[_0xda7b('0x59')]['id']];return _0x1d1f8f[_0xda7b('0x1a')](0xc8)[_0xda7b('0x1b')](_0x230b53);}; \ No newline at end of file +var _0x7d3c=['api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','name','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','$gt','$gte','$lt','$ne','$not','$between','$in','$notIn','$iLike','$like','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','catch','show','length','find','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','create','getVoiceQueues','outbound','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','preview','format','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3c7936,_0x4bf3ec){var _0x56df6c=function(_0x18a2cf){while(--_0x18a2cf){_0x3c7936['push'](_0x3c7936['shift']());}};_0x56df6c(++_0x4bf3ec);}(_0x7d3c,0x10f));var _0xc7d3=function(_0xa2f2c0,_0x1bd315){_0xa2f2c0=_0xa2f2c0-0x0;var _0x3f2623=_0x7d3c[_0xa2f2c0];return _0x3f2623;};'use strict';var pdf=require(_0xc7d3('0x0'));var emlformat=require(_0xc7d3('0x1'));var rimraf=require(_0xc7d3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7d3('0x3'));var rp=require('request-promise');var moment=require(_0xc7d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc7d3('0x5'));var util=require('util');var path=require(_0xc7d3('0x6'));var sox=require(_0xc7d3('0x7'));var csv=require(_0xc7d3('0x8'));var ejs=require(_0xc7d3('0x9'));var fs=require('fs');var _=require(_0xc7d3('0xa'));var squel=require(_0xc7d3('0xb'));var crypto=require(_0xc7d3('0xc'));var jsforce=require(_0xc7d3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc7d3('0x8'));var querystring=require(_0xc7d3('0xe'));var Papa=require(_0xc7d3('0xf'));var Redis=require('ioredis');var shared=require(_0xc7d3('0x10'));var authService=require(_0xc7d3('0x11'));var qs=require(_0xc7d3('0x12'));var as=require(_0xc7d3('0x13'));var hardwareService=require(_0xc7d3('0x14'));var logger=require('../../config/logger')(_0xc7d3('0x15'));var utils=require(_0xc7d3('0x16'));var config=require(_0xc7d3('0x10'));var db=require(_0xc7d3('0x17'))['db'];function respondWithStatusCode(_0x55261a,_0x531987){_0x531987=_0x531987||0xcc;return function(_0x512d47){if(_0x512d47){return _0x55261a[_0xc7d3('0x18')](_0x531987);}return _0x55261a[_0xc7d3('0x19')](_0x531987)[_0xc7d3('0x1a')]();};}function respondWithResult(_0x43e331,_0x540a14){_0x540a14=_0x540a14||0xc8;return function(_0x3ff720){if(_0x3ff720){return _0x43e331['status'](_0x540a14)[_0xc7d3('0x1b')](_0x3ff720);}};}function respondWithFilteredResult(_0x45df8f,_0x423bbe){return function(_0x5bd1fe){if(_0x5bd1fe){var _0x570e48=_0x5bd1fe[_0xc7d3('0x1c')],_0x339efa=_0x423bbe[_0xc7d3('0x1d')],_0x5b1dc5=_0x423bbe[_0xc7d3('0x1d')]+_0x423bbe[_0xc7d3('0x1e')],_0x26b560;if(_0x5b1dc5>=_0x570e48){_0x5b1dc5=_0x570e48;_0x26b560=0xc8;}else{_0x26b560=0xce;}_0x45df8f['status'](_0x26b560);return _0x45df8f[_0xc7d3('0x1f')]('Content-Range',_0x339efa+'-'+_0x5b1dc5+'/'+_0x570e48)[_0xc7d3('0x1b')](_0x5bd1fe);}return null;};}function patchUpdates(_0x1be9f3){return function(_0x5082c8){try{jsonpatch[_0xc7d3('0x20')](_0x5082c8,_0x1be9f3,!![]);}catch(_0x48647c){return BPromise['reject'](_0x48647c);}return _0x5082c8[_0xc7d3('0x21')]();};}function saveUpdates(_0xea22e5,_0xe636a){return function(_0x110780){if(_0x110780){return _0x110780[_0xc7d3('0x22')](_0xea22e5)['then'](function(_0x38f482){return _0x38f482;});}return null;};}function removeEntity(_0x5260b0,_0x4c2c61){return function(_0x5195c4){if(_0x5195c4){return _0x5195c4[_0xc7d3('0x23')]()['then'](function(){_0x5260b0[_0xc7d3('0x19')](0xcc)[_0xc7d3('0x1a')]();});}};}function handleEntityNotFound(_0x370c4c,_0x24528b){return function(_0x2ad0b7){if(!_0x2ad0b7){_0x370c4c[_0xc7d3('0x18')](0x194);}return _0x2ad0b7;};}function handleError(_0x199bf3,_0x1e433e){_0x1e433e=_0x1e433e||0x1f4;return function(_0x2cfeba){logger['error'](_0x2cfeba['stack']);if(_0x2cfeba[_0xc7d3('0x24')]){delete _0x2cfeba[_0xc7d3('0x24')];}_0x199bf3[_0xc7d3('0x19')](_0x1e433e)['send'](_0x2cfeba);};}exports['index']=function(_0x4b7c61,_0x3f33ae){var _0xb4d93d={},_0x1a6707={},_0xed779b={'count':0x0,'rows':[]};var _0x41adc0=_[_0xc7d3('0x25')](db[_0xc7d3('0x26')][_0xc7d3('0x27')],function(_0x45b68d){return{'name':_0x45b68d[_0xc7d3('0x28')],'type':_0x45b68d[_0xc7d3('0x29')][_0xc7d3('0x2a')]};});_0x1a6707['model']=_[_0xc7d3('0x25')](_0x41adc0,_0xc7d3('0x24'));_0x1a6707[_0xc7d3('0x2b')]=_[_0xc7d3('0x2c')](_0x4b7c61[_0xc7d3('0x2b')]);_0x1a6707[_0xc7d3('0x2d')]=_[_0xc7d3('0x2e')](_0x1a6707[_0xc7d3('0x2f')],_0x1a6707[_0xc7d3('0x2b')]);_0x1a6707[_0xc7d3('0x2d')]=_['concat'](_0x1a6707['filters'],['$and','$or',_0xc7d3('0x30'),_0xc7d3('0x31'),_0xc7d3('0x32'),'$lte',_0xc7d3('0x33'),'$eq',_0xc7d3('0x34'),_0xc7d3('0x35'),'$notBetween',_0xc7d3('0x36'),_0xc7d3('0x37'),'$like','$notLike',_0xc7d3('0x38'),'$notILike',_0xc7d3('0x39'),_0xc7d3('0x3a'),_0xc7d3('0x3b'),_0xc7d3('0x3c'),_0xc7d3('0x3d')]);_0xb4d93d[_0xc7d3('0x3e')]=_[_0xc7d3('0x2e')](_0x1a6707[_0xc7d3('0x2f')],qs[_0xc7d3('0x3f')](_0x4b7c61['query'][_0xc7d3('0x3f')]));_0xb4d93d[_0xc7d3('0x3e')]=_0xb4d93d['attributes']['length']?_0xb4d93d['attributes']:_0x1a6707[_0xc7d3('0x2f')];if(!_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x40')]('nolimit')){_0xb4d93d[_0xc7d3('0x1e')]=qs['limit'](_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x1e')]);_0xb4d93d[_0xc7d3('0x1d')]=qs[_0xc7d3('0x1d')](_0x4b7c61[_0xc7d3('0x2b')]['offset']);}_0xb4d93d[_0xc7d3('0x41')]=qs[_0xc7d3('0x42')](_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x42')]);_0xb4d93d[_0xc7d3('0x43')]=qs[_0xc7d3('0x2d')](_[_0xc7d3('0x44')](_0x4b7c61[_0xc7d3('0x2b')],_0x1a6707[_0xc7d3('0x2d')]),_0x41adc0);if(_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x45')]){_0xb4d93d['where']=_[_0xc7d3('0x46')](_0xb4d93d['where'],{'$or':_['map'](_0x41adc0,function(_0x4a1a04){if(_0x4a1a04['type']!==_0xc7d3('0x47')){var _0x5404b0={};_0x5404b0[_0x4a1a04[_0xc7d3('0x24')]]={'$like':'%'+_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x45')]+'%'};return _0x5404b0;}})});}_0xb4d93d=_[_0xc7d3('0x46')]({},_0xb4d93d,_0x4b7c61[_0xc7d3('0x48')]);var _0x45b4c3={'where':_0xb4d93d[_0xc7d3('0x43')]};return db[_0xc7d3('0x26')]['count'](_0x45b4c3)[_0xc7d3('0x49')](function(_0x20691f){_0xed779b[_0xc7d3('0x1c')]=_0x20691f;if(_0x4b7c61[_0xc7d3('0x2b')][_0xc7d3('0x4a')]){_0xb4d93d[_0xc7d3('0x4b')]=[{'all':!![]}];}return db[_0xc7d3('0x26')]['findAll'](_0xb4d93d);})[_0xc7d3('0x49')](function(_0x394022){_0xed779b['rows']=_0x394022;return _0xed779b;})[_0xc7d3('0x49')](respondWithFilteredResult(_0x3f33ae,_0xb4d93d))[_0xc7d3('0x4c')](handleError(_0x3f33ae,null));};exports[_0xc7d3('0x4d')]=function(_0x36cd2a,_0x240836){var _0x126d94={'raw':!![],'where':{'id':_0x36cd2a['params']['id']}},_0x46122d={};_0x46122d[_0xc7d3('0x2f')]=_['keys'](db[_0xc7d3('0x26')][_0xc7d3('0x27')]);_0x46122d[_0xc7d3('0x2b')]=_[_0xc7d3('0x2c')](_0x36cd2a[_0xc7d3('0x2b')]);_0x46122d[_0xc7d3('0x2d')]=_[_0xc7d3('0x2e')](_0x46122d[_0xc7d3('0x2f')],_0x46122d[_0xc7d3('0x2b')]);_0x126d94[_0xc7d3('0x3e')]=_[_0xc7d3('0x2e')](_0x46122d[_0xc7d3('0x2f')],qs['fields'](_0x36cd2a[_0xc7d3('0x2b')][_0xc7d3('0x3f')]));_0x126d94[_0xc7d3('0x3e')]=_0x126d94[_0xc7d3('0x3e')][_0xc7d3('0x4e')]?_0x126d94['attributes']:_0x46122d[_0xc7d3('0x2f')];if(_0x36cd2a[_0xc7d3('0x2b')]['includeAll']){_0x126d94['include']=[{'all':!![]}];}_0x126d94=_[_0xc7d3('0x46')]({},_0x126d94,_0x36cd2a[_0xc7d3('0x48')]);return db['CmHopper'][_0xc7d3('0x4f')](_0x126d94)['then'](handleEntityNotFound(_0x240836,null))['then'](respondWithResult(_0x240836,null))[_0xc7d3('0x4c')](handleError(_0x240836,null));};exports['create']=function(_0x4e42d4,_0x43f997){return db[_0xc7d3('0x26')]['create'](_0x4e42d4['body'],{})['then'](respondWithResult(_0x43f997,0xc9))[_0xc7d3('0x4c')](handleError(_0x43f997,null));};exports[_0xc7d3('0x22')]=function(_0x102254,_0x8fe9b0){if(_0x102254['body']['id']){delete _0x102254[_0xc7d3('0x50')]['id'];}return db[_0xc7d3('0x26')][_0xc7d3('0x4f')]({'where':{'id':_0x102254[_0xc7d3('0x51')]['id']}})[_0xc7d3('0x49')](handleEntityNotFound(_0x8fe9b0,null))[_0xc7d3('0x49')](saveUpdates(_0x102254[_0xc7d3('0x50')],null))[_0xc7d3('0x49')](respondWithResult(_0x8fe9b0,null))['catch'](handleError(_0x8fe9b0,null));};exports[_0xc7d3('0x52')]=function(_0x381ed4,_0x48d105){return db[_0xc7d3('0x26')][_0xc7d3('0x52')]()[_0xc7d3('0x49')](respondWithResult(_0x48d105,null))['catch'](handleError(_0x48d105,null));};exports[_0xc7d3('0x23')]=function(_0x223aa1,_0x20184b){var _0x4cb5ae;return db[_0xc7d3('0x26')]['find']({'where':{'id':_0x223aa1[_0xc7d3('0x51')]['id']}})[_0xc7d3('0x49')](handleEntityNotFound(_0x20184b,null))['then'](function(_0x2d5c5d){if(_0x2d5c5d){return _0x2d5c5d[_0xc7d3('0x23')]()[_0xc7d3('0x49')](function(_0x5c1dad){return _0x5c1dad;});}})[_0xc7d3('0x49')](function(_0xf1dc7d){_0x4cb5ae=_0xf1dc7d;if(_0xf1dc7d){if(_0xf1dc7d[_0xc7d3('0x53')]||_0xf1dc7d['CampaignId']){return db[_0xf1dc7d[_0xc7d3('0x53')]?_0xc7d3('0x54'):_0xc7d3('0x55')][_0xc7d3('0x4f')]({'where':{'id':_0xf1dc7d[_0xc7d3('0x53')]?_0xf1dc7d[_0xc7d3('0x53')]:_0xf1dc7d[_0xc7d3('0x56')]},'attributes':['id',_0xc7d3('0x24')],'raw':!![]});}}})[_0xc7d3('0x49')](function(_0x452eda){var _0x321671={};if(_0x452eda){_[_0xc7d3('0x46')](_0x321671,_['omit'](_0x4cb5ae[_0xc7d3('0x57')],[_0xc7d3('0x58'),_0xc7d3('0x59'),'id']));_0x321671[_0xc7d3('0x5a')]=0x15;_0x321671[_0xc7d3('0x5b')]=_0xc7d3('0x5c');_0x321671['campaign']=_0x452eda['name'];_0x321671[_0xc7d3('0x5d')]=_0x223aa1[_0xc7d3('0x5e')]['name'];_0x321671['UserId']=_0x223aa1[_0xc7d3('0x5e')]['id'];_0x321671[_0xc7d3('0x5c')]=!![];_0x321671[_0xc7d3('0x5f')]=moment()['format'](_0xc7d3('0x60'));_0x321671[_0xc7d3('0x61')]=_0x4cb5ae[_0xc7d3('0x62')];_0x321671[_0xc7d3('0x63')]=_0x4cb5ae[_0xc7d3('0x53')]?_0xc7d3('0x64'):_0xc7d3('0x65');return db[_0xc7d3('0x66')]['find']({'where':{'id':_0x321671['ContactId']},'attributes':[_0xc7d3('0x67'),_0xc7d3('0x68')]})[_0xc7d3('0x49')](function(_0x4b4e07){if(!_['isNil'](_0x20184b)&&!_[_0xc7d3('0x69')](_0x4b4e07[_0xc7d3('0x67')])){_0x321671['calleridname']=_0x4b4e07['firstName'];if(!_[_0xc7d3('0x69')](_0x4b4e07['lastName'])){_0x321671[_0xc7d3('0x6a')]+='\x20'+_0x4b4e07[_0xc7d3('0x68')];}}})[_0xc7d3('0x6b')](function(){return db[_0xc7d3('0x6c')][_0xc7d3('0x6d')](_0x321671);});}})['then'](function(){return _0x20184b['status'](0xcc)[_0xc7d3('0x1a')]();})[_0xc7d3('0x4c')](handleError(_0x20184b,null));};exports['getPreview']=function(_0x5c4711,_0x37dc18,_0x522155){var _0x369501=[];return db[_0xc7d3('0x66')]['describe']()[_0xc7d3('0x49')](function(_0x29cc36){_0x369501=_[_0xc7d3('0x2c')](_0x29cc36);return _0x5c4711['user'][_0xc7d3('0x6e')]({'where':{'type':_0xc7d3('0x6f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0xc7d3('0x49')](function(_0x58fdfe){if(_0x58fdfe&&_0x58fdfe[_0xc7d3('0x4e')]){return db[_0xc7d3('0x70')][_0xc7d3('0x71')](function(_0x5c09b1){var _0x511d12={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc7d3('0x60'))},'VoiceQueueId':{'$in':_[_0xc7d3('0x25')](_0x58fdfe,'id')},'$or':[{'UserId':null},{'UserId':_0x5c4711['user']['id']}]};var _0x1672c7=[];if(_0x5c4711[_0xc7d3('0x50')][_0xc7d3('0x72')]&&_0x5c4711[_0xc7d3('0x50')]['direction']==='prev'){if(!_['isEmpty'](_0x5c4711[_0xc7d3('0x50')]['hopperIds'])){_0x511d12['id']={'$in':_0x5c4711[_0xc7d3('0x50')][_0xc7d3('0x73')]};}_0x1672c7=[[_0xc7d3('0x74'),_0xc7d3('0x75')],[_0xc7d3('0x76'),_0x58fdfe[0x0][_0xc7d3('0x77')]==='ASC'?_0xc7d3('0x78'):'ASC'],db[_0xc7d3('0x70')]['literal'](_0xc7d3('0x79')),['id',_0xc7d3('0x78')]];}else{if(!_[_0xc7d3('0x7a')](_0x5c4711[_0xc7d3('0x50')]['hopperIds'])){_0x511d12['id']={'$notIn':_0x5c4711[_0xc7d3('0x50')][_0xc7d3('0x73')]};}_0x1672c7=[[_0xc7d3('0x74'),_0xc7d3('0x78')],[_0xc7d3('0x76'),_0x58fdfe[0x0]['dialOrderByScheduledAt']],db[_0xc7d3('0x70')][_0xc7d3('0x7b')](_0xc7d3('0x7c')),['id',_0xc7d3('0x75')]];}return db['CmHopper'][_0xc7d3('0x7d')]({'attributes':['id',_0xc7d3('0x7e')],'where':_0x511d12,'order':_0x1672c7,'transaction':_0x5c09b1,'lock':_0x5c09b1[_0xc7d3('0x7f')]['UPDATE'],'include':[{'model':db[_0xc7d3('0x66')],'as':_0xc7d3('0x80'),'attributes':_0x369501,'include':[{'model':db[_0xc7d3('0x81')],'as':_0xc7d3('0x82'),'attributes':['id','name']}]},{'model':db[_0xc7d3('0x83')],'as':_0xc7d3('0x84'),'attributes':['id',_0xc7d3('0x24')]},{'model':db['VoiceQueue'],'as':_0xc7d3('0x85'),'attributes':['id',_0xc7d3('0x24'),_0xc7d3('0x86')]}]})[_0xc7d3('0x49')](function(_0x1ee8e3){if(_0x1ee8e3){return _0x1ee8e3[_0xc7d3('0x22')]({'UserId':_0x5c4711[_0xc7d3('0x5e')]['id']},{'transaction':_0x5c09b1});}});});}})['then'](handleEntityNotFound(_0x37dc18,null))['then'](respondWithResult(_0x37dc18,null))[_0xc7d3('0x4c')](handleError(_0x37dc18,null));};exports[_0xc7d3('0x87')]=function(_0x16246e,_0x1c93c5,_0x37b5eb){return _0x16246e['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc7d3('0x88')},'attributes':['id'],'raw':!![]})['then'](function(_0x52984c){if(_0x52984c&&_0x52984c['length']){return db[_0xc7d3('0x26')][_0xc7d3('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc7d3('0x89')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xc7d3('0x25')](_0x52984c,'id')},'$or':[{'UserId':null},{'UserId':_0x16246e[_0xc7d3('0x5e')]['id']}]}});}return 0x0;})[_0xc7d3('0x49')](function(_0x4c9c5a){if(!_[_0xc7d3('0x69')](_0x4c9c5a)&&_[_0xc7d3('0x8a')](_0x4c9c5a)){return _0x1c93c5[_0xc7d3('0x19')](0xc8)['json']({'contacts':_0x4c9c5a});}else{logger[_0xc7d3('0x8b')](_0xc7d3('0x8c'),_0xc7d3('0x87'),0x194,_0xc7d3('0x8d'));_0x1c93c5['sendStatus'](0x194);}})[_0xc7d3('0x4c')](handleError(_0x1c93c5,null));};exports[_0xc7d3('0x8e')]=function(_0x537b6f,_0x4ff85b,_0x397f9b){var _0x242c05=shared[_0xc7d3('0x8f')];var _0x36e9c6=[];_[_0xc7d3('0x25')](_0x242c05,function(_0x194743){_0x36e9c6[_0xc7d3('0x90')]({'id':_0x194743['name'],'name':_0x194743[_0xc7d3('0x24')],'utcOffset':_0x194743[_0xc7d3('0x91')]});});return _0x4ff85b['status'](0xc8)[_0xc7d3('0x1b')]({'tz':_0x36e9c6});};exports['getTimezone']=function(_0x507948,_0x298d7a,_0x2483d1){var _0x5b317f=shared[_0xc7d3('0x8f')];var _0x4ef6ec={};if(!_[_0xc7d3('0x69')](_0x5b317f[_0x507948[_0xc7d3('0x50')]['id']]))_0x4ef6ec=_0x5b317f[_0x507948[_0xc7d3('0x50')]['id']];return _0x298d7a['status'](0xc8)[_0xc7d3('0x1b')](_0x4ef6ec);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 859df1c..5b3a9d8 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 _0xb6c4=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x4ebac4,_0x2498c1){var _0x487186=function(_0x40a954){while(--_0x40a954){_0x4ebac4['push'](_0x4ebac4['shift']());}};_0x487186(++_0x2498c1);}(_0xb6c4,0x1c2));var _0x4b6c=function(_0x19d561,_0x1dc2fe){_0x19d561=_0x19d561-0x0;var _0x4e486f=_0xb6c4[_0x19d561];return _0x4e486f;};'use strict';var _=require(_0x4b6c('0x0'));var util=require('util');var logger=require(_0x4b6c('0x1'))(_0x4b6c('0x2'));var moment=require(_0x4b6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b6c('0x5'));var config=require(_0x4b6c('0x6'));var attributes=require(_0x4b6c('0x7'));module[_0x4b6c('0x8')]=function(_0x680848,_0x6cf2fa){return _0x680848[_0x4b6c('0x9')](_0x4b6c('0xa'),attributes,{'tableName':_0x4b6c('0xb'),'paranoid':![],'indexes':[{'name':_0x4b6c('0xc'),'fields':['scheduledat']},{'name':_0x4b6c('0xd'),'fields':[_0x4b6c('0xd')]},{'name':_0x4b6c('0xe'),'fields':[_0x4b6c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd732=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','lodash','util'];(function(_0x753e62,_0x6f8cf3){var _0x40fa42=function(_0x4ddeaf){while(--_0x4ddeaf){_0x753e62['push'](_0x753e62['shift']());}};_0x40fa42(++_0x6f8cf3);}(_0xd732,0x16e));var _0x2d73=function(_0x496ef0,_0x119ab2){_0x496ef0=_0x496ef0-0x0;var _0x180802=_0xd732[_0x496ef0];return _0x180802;};'use strict';var _=require(_0x2d73('0x0'));var util=require(_0x2d73('0x1'));var logger=require(_0x2d73('0x2'))(_0x2d73('0x3'));var moment=require(_0x2d73('0x4'));var BPromise=require(_0x2d73('0x5'));var rp=require(_0x2d73('0x6'));var fs=require('fs');var path=require(_0x2d73('0x7'));var rimraf=require(_0x2d73('0x8'));var config=require(_0x2d73('0x9'));var attributes=require(_0x2d73('0xa'));module[_0x2d73('0xb')]=function(_0x20a190,_0xee806c){return _0x20a190[_0x2d73('0xc')](_0x2d73('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x2d73('0xe')]},{'name':_0x2d73('0xf'),'fields':[_0x2d73('0xf')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d22a79c..a1c34a4 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 _0x3826=['../../config/logger','../../config/environment','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','options','raw','where','attributes','include','map','model','then','ShowCmHopper','find','CreateCmHopper','CmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','findAll','order','LOCK','Contact','User','Agent','name','voicePause','length','includes','UserId','push','all','create','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','UPDATE','GetCmHopperPreview','keys','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0x3826,0x1aa));var _0x6382=function(_0x35fcb7,_0x3734c0){_0x35fcb7=_0x35fcb7-0x0;var _0x30f28a=_0x3826[_0x35fcb7];return _0x30f28a;};'use strict';var _=require('lodash');var util=require(_0x6382('0x0'));var moment=require('moment');var BPromise=require(_0x6382('0x1'));var rs=require(_0x6382('0x2'));var fs=require('fs');var Redis=require(_0x6382('0x3'));var db=require(_0x6382('0x4'))['db'];var utils=require(_0x6382('0x5'));var logger=require(_0x6382('0x6'))('rpc');var config=require(_0x6382('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6382('0x8')][_0x6382('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8984c9,_0x39c670,_0x973e24){return new BPromise(function(_0x151cd0,_0x246e2c){return client[_0x6382('0xa')](_0x8984c9,_0x973e24)['then'](function(_0xb7548){logger[_0x6382('0xb')](_0x6382('0xc'),_0x39c670,_0x6382('0xd'));logger[_0x6382('0xe')](_0x6382('0xf'),_0x39c670,_0x6382('0xd'),JSON[_0x6382('0x10')](_0xb7548));if(_0xb7548[_0x6382('0x11')]){if(_0xb7548[_0x6382('0x11')][_0x6382('0x12')]===0x1f4){logger[_0x6382('0x11')](_0x6382('0xc'),_0x39c670,_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);return _0x246e2c(_0xb7548['error'][_0x6382('0x13')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x39c670,_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);return _0x151cd0(_0xb7548[_0x6382('0x11')][_0x6382('0x13')]);}else{logger[_0x6382('0xb')](_0x6382('0xc'),_0x39c670,_0x6382('0xd'));_0x151cd0(_0xb7548[_0x6382('0x14')][_0x6382('0x13')]);}})[_0x6382('0x15')](function(_0x2bcde4){logger[_0x6382('0x11')]('CmHopper,\x20%s,\x20%s',_0x39c670,_0x2bcde4);_0x246e2c(_0x2bcde4);});});}exports[_0x6382('0x16')]=function(_0x190147){var _0x19e3ac=this;return new Promise(function(_0x2edc54,_0x1bb5ac){return db['CmHopper']['findAll']({'raw':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x190147['options']?_0x190147[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x190147['options']?_0x190147['options'][_0x6382('0x1a')]||null:null,'limit':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')]['limit']||null:null,'include':_0x190147[_0x6382('0x17')]?_0x190147[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x190147[_0x6382('0x17')][_0x6382('0x1b')],function(_0x223615){return{'model':db[_0x223615[_0x6382('0x1d')]],'as':_0x223615['as'],'attributes':_0x223615[_0x6382('0x1a')],'include':_0x223615[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x223615[_0x6382('0x1b')],function(_0x5e3fef){return{'model':db[_0x5e3fef[_0x6382('0x1d')]],'as':_0x5e3fef['as'],'attributes':_0x5e3fef[_0x6382('0x1a')],'include':_0x5e3fef[_0x6382('0x1b')]?_['map'](_0x5e3fef['include'],function(_0x3172c7){return{'model':db[_0x3172c7['model']],'as':_0x3172c7['as'],'attributes':_0x3172c7[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0xe3fbca){logger[_0x6382('0xb')]('GetCmHopper',_0x190147);logger[_0x6382('0xe')](_0x6382('0x16'),_0x190147,JSON[_0x6382('0x10')](_0xe3fbca));_0x2edc54(_0xe3fbca);})[_0x6382('0x15')](function(_0x5a2187){logger['error'](_0x6382('0x16'),_0x5a2187[_0x6382('0x13')],_0x190147);_0x1bb5ac(_0x19e3ac['error'](0x1f4,_0x5a2187[_0x6382('0x13')]));});});};exports[_0x6382('0x1f')]=function(_0x271a19){var _0x135018=this;return new Promise(function(_0xa35e77,_0xc47894){return db['CmHopper'][_0x6382('0x20')]({'raw':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x271a19[_0x6382('0x17')]?_0x271a19[_0x6382('0x17')]['attributes']||null:null,'include':_0x271a19[_0x6382('0x17')]?_0x271a19['options'][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x271a19[_0x6382('0x17')][_0x6382('0x1b')],function(_0x3462e0){return{'model':db[_0x3462e0[_0x6382('0x1d')]],'as':_0x3462e0['as'],'attributes':_0x3462e0[_0x6382('0x1a')],'include':_0x3462e0['include']?_[_0x6382('0x1c')](_0x3462e0[_0x6382('0x1b')],function(_0x3458a4){return{'model':db[_0x3458a4['model']],'as':_0x3458a4['as'],'attributes':_0x3458a4[_0x6382('0x1a')],'include':_0x3458a4[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x3458a4[_0x6382('0x1b')],function(_0x153870){return{'model':db[_0x153870[_0x6382('0x1d')]],'as':_0x153870['as'],'attributes':_0x153870['attributes']};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x3de367){logger['info']('ShowCmHopper',_0x271a19);logger[_0x6382('0xe')]('ShowCmHopper',_0x271a19,JSON[_0x6382('0x10')](_0x3de367));_0xa35e77(_0x3de367);})[_0x6382('0x15')](function(_0x2605a7){logger[_0x6382('0x11')]('ShowCmHopper',_0x2605a7['message'],_0x271a19);_0xc47894(_0x135018['error'](0x1f4,_0x2605a7[_0x6382('0x13')]));});});};exports[_0x6382('0x21')]=function(_0x5b65b4){var _0x20d8bc=this;return new Promise(function(_0x18211f,_0xa3f58c){return db[_0x6382('0x22')]['create'](_0x5b65b4[_0x6382('0x23')],{'raw':_0x5b65b4[_0x6382('0x17')]?_0x5b65b4[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![]})[_0x6382('0x1e')](function(_0x14d86f){logger['info'](_0x6382('0x21'),_0x5b65b4);logger['debug'](_0x6382('0x21'),_0x5b65b4,JSON['stringify'](_0x14d86f));_0x18211f(_0x14d86f);})['catch'](function(_0x41bf0f){logger['error'](_0x6382('0x21'),_0x41bf0f[_0x6382('0x13')],_0x5b65b4);_0xa3f58c(_0x20d8bc[_0x6382('0x11')](0x1f4,_0x41bf0f[_0x6382('0x13')]));});});};exports[_0x6382('0x24')]=function(_0x274e9c){var _0x439b0b=this;return new Promise(function(_0x356eb6,_0x4559ad){return db[_0x6382('0x22')][_0x6382('0x25')](_0x274e9c[_0x6382('0x23')],{'raw':_0x274e9c[_0x6382('0x17')]?_0x274e9c[_0x6382('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x274e9c['options']?_0x274e9c[_0x6382('0x17')]['where']||null:null,'attributes':_0x274e9c[_0x6382('0x17')]?_0x274e9c[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':_0x274e9c['options']?_0x274e9c['options'][_0x6382('0x26')]||null:null})[_0x6382('0x1e')](function(_0x34592b){logger[_0x6382('0xb')]('UpdateCmHopper',_0x274e9c);logger[_0x6382('0xe')](_0x6382('0x24'),_0x274e9c,JSON[_0x6382('0x10')](_0x34592b));_0x356eb6(_0x34592b);})[_0x6382('0x15')](function(_0x3799e5){logger[_0x6382('0x11')](_0x6382('0x24'),_0x3799e5['message'],_0x274e9c);_0x4559ad(_0x439b0b[_0x6382('0x11')](0x1f4,_0x3799e5[_0x6382('0x13')]));});});};exports[_0x6382('0x27')]=function(_0x5ea537){var _0x1f097d=this;return new Promise(function(_0x56a9ab,_0x25fab6){return db[_0x6382('0x22')][_0x6382('0x28')]({'where':_0x5ea537[_0x6382('0x17')]?_0x5ea537[_0x6382('0x17')][_0x6382('0x19')]||null:null})['then'](function(_0x24b4a6){logger['info'](_0x6382('0x27'),_0x5ea537);logger[_0x6382('0xe')](_0x6382('0x27'),_0x5ea537,JSON[_0x6382('0x10')](_0x24b4a6));_0x56a9ab(_0x24b4a6);})[_0x6382('0x15')](function(_0x2273e7){logger[_0x6382('0x11')](_0x6382('0x27'),_0x2273e7[_0x6382('0x13')],_0x5ea537);_0x25fab6(_0x1f097d[_0x6382('0x11')](0x1f4,_0x2273e7[_0x6382('0x13')]));});});};exports[_0x6382('0x29')]=function(_0x749f82){var _0x23a29b=this;return new Promise(function(_0x181446,_0x46b793){return db['CmContact'][_0x6382('0x2a')]()[_0x6382('0x1e')](function(_0x1d3339){return db[_0x6382('0x2b')][_0x6382('0x2c')](function(_0x266a4e){return db[_0x6382('0x22')][_0x6382('0x2d')]({'where':_0x749f82[_0x6382('0x17')]?_0x749f82[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x749f82['options']?_0x749f82[_0x6382('0x17')]['attributes']||null:null,'limit':_0x749f82[_0x6382('0x17')]?_0x749f82['options']['limit']||null:null,'order':_0x749f82[_0x6382('0x17')]?_0x749f82[_0x6382('0x17')][_0x6382('0x2e')]||null:null,'transaction':_0x266a4e,'lock':_0x266a4e[_0x6382('0x2f')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6382('0x30'),'attributes':_['keys'](_0x1d3339)},{'model':db[_0x6382('0x31')],'as':_0x6382('0x32'),'attributes':['id',_0x6382('0x33'),_0x6382('0x34')]}]})['then'](function(_0x35e0e4){var _0x30978d=[];var _0x249af1=[];for(var _0x354327=0x0;_0x354327<_0x35e0e4[_0x6382('0x35')];_0x354327+=0x1){if(!_0x249af1[_0x6382('0x36')](_0x35e0e4[_0x354327][_0x6382('0x37')])){_0x249af1['push'](_0x35e0e4[_0x354327][_0x6382('0x37')]);_0x30978d[_0x6382('0x38')](_0x35e0e4[_0x354327][_0x6382('0x25')](_0x749f82[_0x6382('0x23')],{'transaction':_0x266a4e}));}}return BPromise[_0x6382('0x39')](_0x30978d);});})[_0x6382('0x1e')](function(_0x3bc641){logger[_0x6382('0xb')](_0x6382('0x29'),_0x749f82);logger[_0x6382('0xe')](_0x6382('0x29'),_0x749f82,JSON['stringify'](_0x3bc641));_0x181446(_0x3bc641);})['catch'](function(_0x1f59cc){logger[_0x6382('0x11')](_0x6382('0x29'),_0x1f59cc[_0x6382('0x13')],_0x749f82);_0x46b793(_0x23a29b[_0x6382('0x11')](0x1f4,_0x1f59cc[_0x6382('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x430b12){var _0x37332b=this;return new Promise(function(_0x2ae313,_0x205e25){return db[_0x6382('0x2b')]['transaction'](function(_0xabf101){return db['CmHopperFinal'][_0x6382('0x3a')](_0x430b12[_0x6382('0x23')],{'raw':_0x430b12[_0x6382('0x17')]?_0x430b12[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'transaction':_0xabf101})[_0x6382('0x1e')](function(){return db[_0x6382('0x22')][_0x6382('0x28')]({'where':_0x430b12[_0x6382('0x17')]?_0x430b12[_0x6382('0x17')][_0x6382('0x19')]||null:null,'transaction':_0xabf101});});})['then'](function(_0x53313c){logger[_0x6382('0xb')](_0x6382('0x3b'),_0x430b12);logger['debug'](_0x6382('0x3b'),_0x430b12,JSON[_0x6382('0x10')](_0x53313c));_0x2ae313(_0x53313c);})[_0x6382('0x15')](function(_0x389992){logger[_0x6382('0x11')](_0x6382('0x3b'),_0x389992['message'],_0x430b12);_0x205e25(_0x37332b[_0x6382('0x11')](0x1f4,_0x389992['message']));});});};exports[_0x6382('0x3c')]=function(_0x2c4887){var _0x4cb33e=this;return new Promise(function(_0x17d015,_0x545a1c){return db['CmHopper'][_0x6382('0x2d')]({'raw':_0x2c4887['options']?_0x2c4887['options'][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x2c4887[_0x6382('0x17')]?_0x2c4887[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6382('0x3d'),db['sequelize']['fn']('IF',db[_0x6382('0x2b')]['literal'](_0x6382('0x3e')+util['format'](_0x6382('0x3f'),moment()[_0x6382('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6382('0x41')))),_0x6382('0x42')]]})[_0x6382('0x1e')](function(_0x11a6a5){logger[_0x6382('0xb')](_0x6382('0x3c'),_0x2c4887);logger[_0x6382('0xe')](_0x6382('0x3c'),_0x2c4887,JSON[_0x6382('0x10')](_0x11a6a5));_0x17d015(_0x11a6a5);})['catch'](function(_0xf0fb13){logger[_0x6382('0x11')]('CountReScheduled',_0xf0fb13[_0x6382('0x13')],_0x2c4887);_0x545a1c(_0x4cb33e[_0x6382('0x11')](0x1f4,_0xf0fb13['message']));});});};exports[_0x6382('0x43')]=function(_0x549868){var _0x430437=this;return new Promise(function(_0x1f1e8c,_0x1f8d96){return db[_0x6382('0x44')][_0x6382('0x2a')]()[_0x6382('0x1e')](function(_0x1fc174){return db[_0x6382('0x2b')]['transaction'](function(_0x5c5bf0){return db[_0x6382('0x22')][_0x6382('0x2d')]({'where':_0x549868['options']?_0x549868[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':0x1,'order':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x2e')]||null:null,'group':db[_0x6382('0x22')][_0x6382('0x37')],'transaction':_0x5c5bf0,'lock':_0x5c5bf0[_0x6382('0x2f')][_0x6382('0x45')],'include':_0x549868[_0x6382('0x17')]?_0x549868[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x549868[_0x6382('0x17')]['include'],function(_0x25d9de){return{'model':db[_0x25d9de[_0x6382('0x1d')]],'as':_0x25d9de['as'],'attributes':_0x25d9de[_0x6382('0x1a')],'include':_0x25d9de['include']?_[_0x6382('0x1c')](_0x25d9de[_0x6382('0x1b')],function(_0x5e6d62){return{'model':db[_0x5e6d62[_0x6382('0x1d')]],'as':_0x5e6d62['as'],'attributes':_0x5e6d62[_0x6382('0x1a')],'include':_0x5e6d62[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x5e6d62[_0x6382('0x1b')],function(_0xf3902e){return{'model':db[_0xf3902e[_0x6382('0x1d')]],'as':_0xf3902e['as'],'attributes':_0xf3902e[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x48ce0d){var _0x1eb12b=[];for(var _0x39f435=0x0;_0x39f435<_0x48ce0d[_0x6382('0x35')];_0x39f435+=0x1){_0x1eb12b[_0x6382('0x38')](_0x48ce0d[_0x39f435][_0x6382('0x25')](_0x549868[_0x6382('0x23')],{'transaction':_0x5c5bf0}));}return BPromise[_0x6382('0x39')](_0x1eb12b);});})['then'](function(_0xab44ad){logger[_0x6382('0xb')](_0x6382('0x43'),_0x549868);logger[_0x6382('0xe')](_0x6382('0x43'),_0x549868,JSON[_0x6382('0x10')](_0xab44ad));_0x1f1e8c(_0xab44ad);})[_0x6382('0x15')](function(_0x26c04d){logger[_0x6382('0x11')](_0x6382('0x43'),_0x26c04d[_0x6382('0x13')],_0x549868);_0x1f8d96(_0x430437['error'](0x1f4,_0x26c04d[_0x6382('0x13')]));});});});};exports[_0x6382('0x46')]=function(_0x2cb2e9){var _0x4c2af0=this;return new Promise(function(_0x4ba5a6,_0x1e823a){db['CmContact']['describe']()['then'](function(_0xc76a92){return db[_0x6382('0x22')]['findAll']({'raw':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x18')]===undefined?!![]:![]:!![],'where':_0x2cb2e9['options']?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x19')]||null:null,'attributes':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x1a')]||null:null,'limit':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')]['limit']||null:null,'include':_0x2cb2e9[_0x6382('0x17')]?_0x2cb2e9[_0x6382('0x17')][_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x2cb2e9['options']['include'],function(_0x18ea21){return{'model':db[_0x18ea21[_0x6382('0x1d')]],'as':_0x18ea21['as'],'attributes':_0x18ea21['as']===_0x6382('0x30')?_[_0x6382('0x47')](_0xc76a92):_0x18ea21[_0x6382('0x1a')],'include':_0x18ea21[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x18ea21[_0x6382('0x1b')],function(_0x52999d){return{'model':db[_0x52999d['model']],'as':_0x52999d['as'],'attributes':_0x52999d[_0x6382('0x1a')],'include':_0x52999d[_0x6382('0x1b')]?_[_0x6382('0x1c')](_0x52999d['include'],function(_0x2f2494){return{'model':db[_0x2f2494[_0x6382('0x1d')]],'as':_0x2f2494['as'],'attributes':_0x2f2494[_0x6382('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6382('0x1e')](function(_0x462657){logger['info']('GetCmHopper',_0x2cb2e9);logger[_0x6382('0xe')](_0x6382('0x16'),_0x2cb2e9,JSON[_0x6382('0x10')](_0x462657));_0x4ba5a6(_0x462657);})[_0x6382('0x15')](function(_0x2de8c9){logger[_0x6382('0x11')](_0x6382('0x16'),_0x2de8c9[_0x6382('0x13')],_0x2cb2e9);_0x1e823a(_0x4c2af0['error'](0x1f4,_0x2de8c9[_0x6382('0x13')]));});});});}; \ No newline at end of file +var _0xa9a9=['GetContactRecallMe','describe','UPDATE','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','options','where','limit','include','attributes','map','model','GetCmHopper','debug','find','raw','ShowCmHopper','CreateCmHopper','create','UpdateCmHopper','update','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','LOCK','Contact','keys','Agent','name','voicePause','length','push','UserId','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','findAll','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9a9,0x124));var _0x9a9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9a9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9a9a('0x0'));var util=require(_0x9a9a('0x1'));var moment=require(_0x9a9a('0x2'));var BPromise=require(_0x9a9a('0x3'));var rs=require(_0x9a9a('0x4'));var fs=require('fs');var Redis=require(_0x9a9a('0x5'));var db=require(_0x9a9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a9a('0x7'))(_0x9a9a('0x8'));var config=require(_0x9a9a('0x9'));var jayson=require(_0x9a9a('0xa'));var client=jayson[_0x9a9a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45c42a,_0x2cb638,_0x645bba){return new BPromise(function(_0x5eccec,_0x10c439){return client[_0x9a9a('0xc')](_0x45c42a,_0x645bba)[_0x9a9a('0xd')](function(_0x22b744){logger[_0x9a9a('0xe')]('CmHopper,\x20%s,\x20%s',_0x2cb638,_0x9a9a('0xf'));logger['debug'](_0x9a9a('0x10'),_0x2cb638,_0x9a9a('0xf'),JSON[_0x9a9a('0x11')](_0x22b744));if(_0x22b744[_0x9a9a('0x12')]){if(_0x22b744[_0x9a9a('0x12')][_0x9a9a('0x13')]===0x1f4){logger[_0x9a9a('0x12')](_0x9a9a('0x14'),_0x2cb638,_0x22b744[_0x9a9a('0x12')]['message']);return _0x10c439(_0x22b744[_0x9a9a('0x12')][_0x9a9a('0x15')]);}logger[_0x9a9a('0x12')](_0x9a9a('0x14'),_0x2cb638,_0x22b744[_0x9a9a('0x12')][_0x9a9a('0x15')]);return _0x5eccec(_0x22b744['error'][_0x9a9a('0x15')]);}else{logger[_0x9a9a('0xe')](_0x9a9a('0x14'),_0x2cb638,_0x9a9a('0xf'));_0x5eccec(_0x22b744[_0x9a9a('0x16')][_0x9a9a('0x15')]);}})[_0x9a9a('0x17')](function(_0x33076a){logger[_0x9a9a('0x12')](_0x9a9a('0x14'),_0x2cb638,_0x33076a);_0x10c439(_0x33076a);});});}exports['GetCmHopper']=function(_0x233a4a){var _0x1db0c3=this;return new Promise(function(_0x2a6b48,_0x5ea2e6){return db[_0x9a9a('0x18')]['findAll']({'raw':_0x233a4a[_0x9a9a('0x19')]?_0x233a4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x233a4a[_0x9a9a('0x19')]?_0x233a4a[_0x9a9a('0x19')][_0x9a9a('0x1a')]||null:null,'attributes':_0x233a4a['options']?_0x233a4a[_0x9a9a('0x19')]['attributes']||null:null,'limit':_0x233a4a['options']?_0x233a4a[_0x9a9a('0x19')][_0x9a9a('0x1b')]||null:null,'include':_0x233a4a['options']?_0x233a4a[_0x9a9a('0x19')][_0x9a9a('0x1c')]?_['map'](_0x233a4a[_0x9a9a('0x19')][_0x9a9a('0x1c')],function(_0x3f2384){return{'model':db[_0x3f2384['model']],'as':_0x3f2384['as'],'attributes':_0x3f2384[_0x9a9a('0x1d')],'include':_0x3f2384[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x3f2384[_0x9a9a('0x1c')],function(_0x9e819){return{'model':db[_0x9e819[_0x9a9a('0x1f')]],'as':_0x9e819['as'],'attributes':_0x9e819[_0x9a9a('0x1d')],'include':_0x9e819[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x9e819['include'],function(_0xb31cd2){return{'model':db[_0xb31cd2[_0x9a9a('0x1f')]],'as':_0xb31cd2['as'],'attributes':_0xb31cd2[_0x9a9a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a9a('0xd')](function(_0x5d6bf4){logger[_0x9a9a('0xe')](_0x9a9a('0x20'),_0x233a4a);logger[_0x9a9a('0x21')](_0x9a9a('0x20'),_0x233a4a,JSON[_0x9a9a('0x11')](_0x5d6bf4));_0x2a6b48(_0x5d6bf4);})['catch'](function(_0x5f0be1){logger[_0x9a9a('0x12')](_0x9a9a('0x20'),_0x5f0be1[_0x9a9a('0x15')],_0x233a4a);_0x5ea2e6(_0x1db0c3['error'](0x1f4,_0x5f0be1[_0x9a9a('0x15')]));});});};exports['ShowCmHopper']=function(_0x103280){var _0x9f4dcd=this;return new Promise(function(_0x22145b,_0xda6043){return db[_0x9a9a('0x18')][_0x9a9a('0x22')]({'raw':_0x103280['options']?_0x103280[_0x9a9a('0x19')][_0x9a9a('0x23')]===undefined?!![]:![]:!![],'where':_0x103280[_0x9a9a('0x19')]?_0x103280['options'][_0x9a9a('0x1a')]||null:null,'attributes':_0x103280['options']?_0x103280[_0x9a9a('0x19')][_0x9a9a('0x1d')]||null:null,'include':_0x103280[_0x9a9a('0x19')]?_0x103280[_0x9a9a('0x19')]['include']?_[_0x9a9a('0x1e')](_0x103280[_0x9a9a('0x19')][_0x9a9a('0x1c')],function(_0x11b079){return{'model':db[_0x11b079[_0x9a9a('0x1f')]],'as':_0x11b079['as'],'attributes':_0x11b079[_0x9a9a('0x1d')],'include':_0x11b079[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x11b079['include'],function(_0x200a4d){return{'model':db[_0x200a4d[_0x9a9a('0x1f')]],'as':_0x200a4d['as'],'attributes':_0x200a4d[_0x9a9a('0x1d')],'include':_0x200a4d[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x200a4d[_0x9a9a('0x1c')],function(_0x28327a){return{'model':db[_0x28327a['model']],'as':_0x28327a['as'],'attributes':_0x28327a[_0x9a9a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9a9a('0xd')](function(_0x1d83a0){logger[_0x9a9a('0xe')]('ShowCmHopper',_0x103280);logger['debug'](_0x9a9a('0x24'),_0x103280,JSON[_0x9a9a('0x11')](_0x1d83a0));_0x22145b(_0x1d83a0);})['catch'](function(_0x38277b){logger[_0x9a9a('0x12')](_0x9a9a('0x24'),_0x38277b['message'],_0x103280);_0xda6043(_0x9f4dcd[_0x9a9a('0x12')](0x1f4,_0x38277b[_0x9a9a('0x15')]));});});};exports[_0x9a9a('0x25')]=function(_0xc41114){var _0x3b8083=this;return new Promise(function(_0x1b9539,_0x249a35){return db[_0x9a9a('0x18')][_0x9a9a('0x26')](_0xc41114['body'],{'raw':_0xc41114[_0x9a9a('0x19')]?_0xc41114[_0x9a9a('0x19')][_0x9a9a('0x23')]===undefined?!![]:![]:!![]})[_0x9a9a('0xd')](function(_0x4863bc){logger[_0x9a9a('0xe')](_0x9a9a('0x25'),_0xc41114);logger[_0x9a9a('0x21')](_0x9a9a('0x25'),_0xc41114,JSON[_0x9a9a('0x11')](_0x4863bc));_0x1b9539(_0x4863bc);})[_0x9a9a('0x17')](function(_0x4468cf){logger[_0x9a9a('0x12')](_0x9a9a('0x25'),_0x4468cf[_0x9a9a('0x15')],_0xc41114);_0x249a35(_0x3b8083[_0x9a9a('0x12')](0x1f4,_0x4468cf[_0x9a9a('0x15')]));});});};exports[_0x9a9a('0x27')]=function(_0x562cdc){var _0x3eeb46=this;return new Promise(function(_0xedfabd,_0x4b8e72){return db[_0x9a9a('0x18')][_0x9a9a('0x28')](_0x562cdc[_0x9a9a('0x29')],{'raw':_0x562cdc[_0x9a9a('0x19')]?_0x562cdc[_0x9a9a('0x19')][_0x9a9a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x562cdc[_0x9a9a('0x19')]?_0x562cdc[_0x9a9a('0x19')]['where']||null:null,'attributes':_0x562cdc[_0x9a9a('0x19')]?_0x562cdc['options'][_0x9a9a('0x1d')]||null:null,'limit':_0x562cdc[_0x9a9a('0x19')]?_0x562cdc[_0x9a9a('0x19')][_0x9a9a('0x1b')]||null:null})[_0x9a9a('0xd')](function(_0x3c5d55){logger[_0x9a9a('0xe')](_0x9a9a('0x27'),_0x562cdc);logger['debug']('UpdateCmHopper',_0x562cdc,JSON[_0x9a9a('0x11')](_0x3c5d55));_0xedfabd(_0x3c5d55);})['catch'](function(_0x2bbc0f){logger[_0x9a9a('0x12')](_0x9a9a('0x27'),_0x2bbc0f['message'],_0x562cdc);_0x4b8e72(_0x3eeb46[_0x9a9a('0x12')](0x1f4,_0x2bbc0f[_0x9a9a('0x15')]));});});};exports[_0x9a9a('0x2a')]=function(_0x2e2829){var _0x4fe225=this;return new Promise(function(_0x5288ea,_0x1991ae){return db[_0x9a9a('0x18')][_0x9a9a('0x2b')]({'where':_0x2e2829['options']?_0x2e2829['options'][_0x9a9a('0x1a')]||null:null})[_0x9a9a('0xd')](function(_0x40901e){logger['info']('DestroyCmHopper',_0x2e2829);logger['debug'](_0x9a9a('0x2a'),_0x2e2829,JSON[_0x9a9a('0x11')](_0x40901e));_0x5288ea(_0x40901e);})['catch'](function(_0x435b85){logger[_0x9a9a('0x12')](_0x9a9a('0x2a'),_0x435b85[_0x9a9a('0x15')],_0x2e2829);_0x1991ae(_0x4fe225[_0x9a9a('0x12')](0x1f4,_0x435b85['message']));});});};exports[_0x9a9a('0x2c')]=function(_0x22abac){var _0x496567=this;return new Promise(function(_0x17cbc,_0x997056){return db[_0x9a9a('0x2d')]['describe']()['then'](function(_0x3c91c5){return db['sequelize']['transaction'](function(_0x4256ad){return db[_0x9a9a('0x18')]['findAll']({'where':_0x22abac[_0x9a9a('0x19')]?_0x22abac[_0x9a9a('0x19')][_0x9a9a('0x1a')]||null:null,'attributes':_0x22abac[_0x9a9a('0x19')]?_0x22abac[_0x9a9a('0x19')]['attributes']||null:null,'limit':_0x22abac[_0x9a9a('0x19')]?_0x22abac[_0x9a9a('0x19')]['limit']||null:null,'order':_0x22abac[_0x9a9a('0x19')]?_0x22abac['options']['order']||null:null,'transaction':_0x4256ad,'lock':_0x4256ad[_0x9a9a('0x2e')]['UPDATE'],'include':[{'model':db[_0x9a9a('0x2d')],'as':_0x9a9a('0x2f'),'attributes':_[_0x9a9a('0x30')](_0x3c91c5)},{'model':db['User'],'as':_0x9a9a('0x31'),'attributes':['id',_0x9a9a('0x32'),_0x9a9a('0x33')]}]})[_0x9a9a('0xd')](function(_0x3dbe24){var _0xcc79a2=[];var _0x4eb406=[];for(var _0x329b43=0x0;_0x329b43<_0x3dbe24[_0x9a9a('0x34')];_0x329b43+=0x1){if(!_0x4eb406['includes'](_0x3dbe24[_0x329b43]['UserId'])){_0x4eb406[_0x9a9a('0x35')](_0x3dbe24[_0x329b43][_0x9a9a('0x36')]);_0xcc79a2[_0x9a9a('0x35')](_0x3dbe24[_0x329b43]['update'](_0x22abac[_0x9a9a('0x29')],{'transaction':_0x4256ad}));}}return BPromise[_0x9a9a('0x37')](_0xcc79a2);});})['then'](function(_0x4d0df1){logger['info']('GetContactDialer',_0x22abac);logger[_0x9a9a('0x21')](_0x9a9a('0x2c'),_0x22abac,JSON['stringify'](_0x4d0df1));_0x17cbc(_0x4d0df1);})[_0x9a9a('0x17')](function(_0x3ccdba){logger[_0x9a9a('0x12')](_0x9a9a('0x2c'),_0x3ccdba[_0x9a9a('0x15')],_0x22abac);_0x997056(_0x496567['error'](0x1f4,_0x3ccdba[_0x9a9a('0x15')]));});});});};exports[_0x9a9a('0x38')]=function(_0x32989a){var _0x4c624c=this;return new Promise(function(_0x21d044,_0x4b112f){return db['sequelize']['transaction'](function(_0x1afb2f){return db[_0x9a9a('0x39')][_0x9a9a('0x26')](_0x32989a[_0x9a9a('0x29')],{'raw':_0x32989a[_0x9a9a('0x19')]?_0x32989a['options'][_0x9a9a('0x23')]===undefined?!![]:![]:!![],'transaction':_0x1afb2f})[_0x9a9a('0xd')](function(){return db[_0x9a9a('0x18')][_0x9a9a('0x2b')]({'where':_0x32989a[_0x9a9a('0x19')]?_0x32989a[_0x9a9a('0x19')][_0x9a9a('0x1a')]||null:null,'transaction':_0x1afb2f});});})[_0x9a9a('0xd')](function(_0x2a550b){logger['info'](_0x9a9a('0x38'),_0x32989a);logger[_0x9a9a('0x21')](_0x9a9a('0x38'),_0x32989a,JSON[_0x9a9a('0x11')](_0x2a550b));_0x21d044(_0x2a550b);})['catch'](function(_0x2fcb91){logger[_0x9a9a('0x12')](_0x9a9a('0x38'),_0x2fcb91['message'],_0x32989a);_0x4b112f(_0x4c624c[_0x9a9a('0x12')](0x1f4,_0x2fcb91[_0x9a9a('0x15')]));});});};exports[_0x9a9a('0x3a')]=function(_0x1ceefb){var _0xc91d14=this;return new Promise(function(_0x55811a,_0x1067a9){return db[_0x9a9a('0x18')][_0x9a9a('0x3b')]({'raw':_0x1ceefb[_0x9a9a('0x19')]?_0x1ceefb['options'][_0x9a9a('0x23')]===undefined?!![]:![]:!![],'where':_0x1ceefb[_0x9a9a('0x19')]?_0x1ceefb[_0x9a9a('0x19')][_0x9a9a('0x1a')]||null:null,'attributes':[[db[_0x9a9a('0x3c')]['fn'](_0x9a9a('0x3d'),db['sequelize']['fn']('IF',db['sequelize'][_0x9a9a('0x3e')](_0x9a9a('0x3f')+util[_0x9a9a('0x40')]('\x22%s\x22',moment()[_0x9a9a('0x40')](_0x9a9a('0x41')))+_0x9a9a('0x42')))),_0x9a9a('0x43')]]})[_0x9a9a('0xd')](function(_0x125347){logger[_0x9a9a('0xe')](_0x9a9a('0x3a'),_0x1ceefb);logger[_0x9a9a('0x21')](_0x9a9a('0x3a'),_0x1ceefb,JSON[_0x9a9a('0x11')](_0x125347));_0x55811a(_0x125347);})['catch'](function(_0x47179c){logger[_0x9a9a('0x12')]('CountReScheduled',_0x47179c['message'],_0x1ceefb);_0x1067a9(_0xc91d14[_0x9a9a('0x12')](0x1f4,_0x47179c[_0x9a9a('0x15')]));});});};exports[_0x9a9a('0x44')]=function(_0x31990a){var _0x275dc6=this;return new Promise(function(_0x16358f,_0x1a0ce3){return db[_0x9a9a('0x2d')][_0x9a9a('0x45')]()[_0x9a9a('0xd')](function(_0x13bedd){return db[_0x9a9a('0x3c')]['transaction'](function(_0x3b8966){return db[_0x9a9a('0x18')]['findAll']({'where':_0x31990a[_0x9a9a('0x19')]?_0x31990a['options'][_0x9a9a('0x1a')]||null:null,'attributes':_0x31990a[_0x9a9a('0x19')]?_0x31990a['options']['attributes']||null:null,'limit':0x1,'order':_0x31990a[_0x9a9a('0x19')]?_0x31990a[_0x9a9a('0x19')]['order']||null:null,'group':db[_0x9a9a('0x18')][_0x9a9a('0x36')],'transaction':_0x3b8966,'lock':_0x3b8966['LOCK'][_0x9a9a('0x46')],'include':_0x31990a['options']?_0x31990a[_0x9a9a('0x19')][_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x31990a[_0x9a9a('0x19')]['include'],function(_0x41f077){return{'model':db[_0x41f077['model']],'as':_0x41f077['as'],'attributes':_0x41f077[_0x9a9a('0x1d')],'include':_0x41f077[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x41f077['include'],function(_0x358c79){return{'model':db[_0x358c79[_0x9a9a('0x1f')]],'as':_0x358c79['as'],'attributes':_0x358c79['attributes'],'include':_0x358c79[_0x9a9a('0x1c')]?_['map'](_0x358c79['include'],function(_0x18f4b0){return{'model':db[_0x18f4b0[_0x9a9a('0x1f')]],'as':_0x18f4b0['as'],'attributes':_0x18f4b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a9a('0xd')](function(_0x200dd7){var _0xeb950f=[];for(var _0x4dd2c0=0x0;_0x4dd2c0<_0x200dd7['length'];_0x4dd2c0+=0x1){_0xeb950f[_0x9a9a('0x35')](_0x200dd7[_0x4dd2c0]['update'](_0x31990a[_0x9a9a('0x29')],{'transaction':_0x3b8966}));}return BPromise[_0x9a9a('0x37')](_0xeb950f);});})[_0x9a9a('0xd')](function(_0x288597){logger[_0x9a9a('0xe')](_0x9a9a('0x44'),_0x31990a);logger['debug'](_0x9a9a('0x44'),_0x31990a,JSON[_0x9a9a('0x11')](_0x288597));_0x16358f(_0x288597);})[_0x9a9a('0x17')](function(_0x5896fd){logger[_0x9a9a('0x12')]('GetContactRecallMe',_0x5896fd[_0x9a9a('0x15')],_0x31990a);_0x1a0ce3(_0x275dc6['error'](0x1f4,_0x5896fd[_0x9a9a('0x15')]));});});});};exports[_0x9a9a('0x47')]=function(_0x54b5f2){var _0x1eb8a1=this;return new Promise(function(_0x5661e6,_0xd667c7){db[_0x9a9a('0x2d')][_0x9a9a('0x45')]()['then'](function(_0x205209){return db[_0x9a9a('0x18')][_0x9a9a('0x3b')]({'raw':_0x54b5f2['options']?_0x54b5f2[_0x9a9a('0x19')][_0x9a9a('0x23')]===undefined?!![]:![]:!![],'where':_0x54b5f2[_0x9a9a('0x19')]?_0x54b5f2[_0x9a9a('0x19')]['where']||null:null,'attributes':_0x54b5f2[_0x9a9a('0x19')]?_0x54b5f2[_0x9a9a('0x19')]['attributes']||null:null,'limit':_0x54b5f2[_0x9a9a('0x19')]?_0x54b5f2[_0x9a9a('0x19')][_0x9a9a('0x1b')]||null:null,'include':_0x54b5f2[_0x9a9a('0x19')]?_0x54b5f2[_0x9a9a('0x19')][_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x54b5f2['options'][_0x9a9a('0x1c')],function(_0x11c285){return{'model':db[_0x11c285[_0x9a9a('0x1f')]],'as':_0x11c285['as'],'attributes':_0x11c285['as']===_0x9a9a('0x2f')?_['keys'](_0x205209):_0x11c285[_0x9a9a('0x1d')],'include':_0x11c285['include']?_[_0x9a9a('0x1e')](_0x11c285['include'],function(_0x81bbcf){return{'model':db[_0x81bbcf['model']],'as':_0x81bbcf['as'],'attributes':_0x81bbcf[_0x9a9a('0x1d')],'include':_0x81bbcf[_0x9a9a('0x1c')]?_[_0x9a9a('0x1e')](_0x81bbcf[_0x9a9a('0x1c')],function(_0x1569ea){return{'model':db[_0x1569ea[_0x9a9a('0x1f')]],'as':_0x1569ea['as'],'attributes':_0x1569ea[_0x9a9a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd76a8a){logger[_0x9a9a('0xe')]('GetCmHopper',_0x54b5f2);logger[_0x9a9a('0x21')]('GetCmHopper',_0x54b5f2,JSON[_0x9a9a('0x11')](_0xd76a8a));_0x5661e6(_0xd76a8a);})[_0x9a9a('0x17')](function(_0x305c54){logger[_0x9a9a('0x12')](_0x9a9a('0x20'),_0x305c54[_0x9a9a('0x15')],_0x54b5f2);_0xd667c7(_0x1eb8a1['error'](0x1f4,_0x305c54[_0x9a9a('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b005585..a2a9d58 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 _0x5fd1=['../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','/opencontacts','getTimezones','show','post','create','/preview','getPreview','put','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5fd1,0x155));var _0x15fd=function(_0x1d6558,_0x19ff10){_0x1d6558=_0x1d6558-0x0;var _0x57f383=_0x5fd1[_0x1d6558];return _0x57f383;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['getOpenContacts']);router[_0x15fd('0x9')]('/timezones',auth[_0x15fd('0x7')](),controller[_0x15fd('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xd')]);router[_0x15fd('0xe')]('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0xf')]);router[_0x15fd('0xe')](_0x15fd('0x10'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x11')]);router[_0x15fd('0xe')]('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router[_0x15fd('0x12')](_0x15fd('0x13'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x14')]);router[_0x15fd('0x15')](_0x15fd('0x13'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x16')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['getTimezone','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','getTimezones','/:id','show','post','create','getPreview'];(function(_0x343d36,_0x5f248a){var _0x3bd305=function(_0x611a1e){while(--_0x611a1e){_0x343d36['push'](_0x343d36['shift']());}};_0x3bd305(++_0x5f248a);}(_0x55ca,0x126));var _0xa55c=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0x55ca[_0x344128];return _0x693fae;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/opencontacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/timezones',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0x6')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xf')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0xf')]('/preview',auth['isAuthenticated'](),controller[_0xa55c('0x11')]);router['post']('/timezone',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router[_0xa55c('0x13')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0x16')]);module[_0xa55c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 700ee56..4abc7e8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00d9=['INTEGER','STRING','format','moment','sequelize','exports'];(function(_0x5985f7,_0x569722){var _0x3f76ba=function(_0x47d9cb){while(--_0x47d9cb){_0x5985f7['push'](_0x5985f7['shift']());}};_0x3f76ba(++_0x569722);}(_0x00d9,0x165));var _0x900d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x00d9[_0xefd519];return _0x4bb882;};'use strict';var moment=require(_0x900d('0x0'));var Sequelize=require(_0x900d('0x1'));module[_0x900d('0x2')]={'CmHopperId':{'type':Sequelize[_0x900d('0x3')]},'phone':{'type':Sequelize[_0x900d('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x900d('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x900d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd899=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x16ca76,_0x258915){var _0xbfbbad=function(_0x5e1266){while(--_0x5e1266){_0x16ca76['push'](_0x16ca76['shift']());}};_0xbfbbad(++_0x258915);}(_0xd899,0xa9));var _0x9d89=function(_0x4be03f,_0x572d3a){_0x4be03f=_0x4be03f-0x0;var _0x35d29c=_0xd899[_0x4be03f];return _0x35d29c;};'use strict';var moment=require(_0x9d89('0x0'));var Sequelize=require(_0x9d89('0x1'));module[_0x9d89('0x2')]={'CmHopperId':{'type':Sequelize[_0x9d89('0x3')]},'phone':{'type':Sequelize[_0x9d89('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9d89('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9d89('0x5')],'defaultValue':moment()[_0x9d89('0x6')](_0x9d89('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9d89('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9d89('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9d89('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9d89('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 6e91b55..ea1365a 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc13a=['merge','where','VIRTUAL','options','findAll','rows','catch','params','fields','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc13a,0xbd));var _0xac13=function(_0x2159b6,_0x475180){_0x2159b6=_0x2159b6-0x0;var _0x10ee92=_0xc13a[_0x2159b6];return _0x10ee92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xac13('0x0'));var rimraf=require(_0xac13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac13('0x2'));var rp=require(_0xac13('0x3'));var moment=require(_0xac13('0x4'));var BPromise=require(_0xac13('0x5'));var Mustache=require(_0xac13('0x6'));var util=require(_0xac13('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xac13('0x8'));var ejs=require(_0xac13('0x9'));var fs=require('fs');var _=require(_0xac13('0xa'));var squel=require(_0xac13('0xb'));var crypto=require(_0xac13('0xc'));var jsforce=require(_0xac13('0xd'));var deskjs=require(_0xac13('0xe'));var toCsv=require('to-csv');var querystring=require(_0xac13('0xf'));var Papa=require(_0xac13('0x10'));var Redis=require(_0xac13('0x11'));var authService=require(_0xac13('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac13('0x13'));var hardwareService=require(_0xac13('0x14'));var logger=require(_0xac13('0x15'))(_0xac13('0x16'));var utils=require('../../config/utils');var config=require(_0xac13('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30f63a,_0x4135c0){_0x4135c0=_0x4135c0||0xcc;return function(_0x102c37){if(_0x102c37){return _0x30f63a[_0xac13('0x18')](_0x4135c0);}return _0x30f63a[_0xac13('0x19')](_0x4135c0)['end']();};}function respondWithResult(_0xae7a1d,_0x321e2e){_0x321e2e=_0x321e2e||0xc8;return function(_0x2c82a5){if(_0x2c82a5){return _0xae7a1d[_0xac13('0x19')](_0x321e2e)['json'](_0x2c82a5);}};}function respondWithFilteredResult(_0x431dae,_0x1cfcfc){return function(_0x4aa789){if(_0x4aa789){var _0x4f90cb=_0x4aa789[_0xac13('0x1a')],_0x3c5000=_0x1cfcfc[_0xac13('0x1b')],_0x4f6bb7=_0x1cfcfc[_0xac13('0x1b')]+_0x1cfcfc[_0xac13('0x1c')],_0x5f2c7f;if(_0x4f6bb7>=_0x4f90cb){_0x4f6bb7=_0x4f90cb;_0x5f2c7f=0xc8;}else{_0x5f2c7f=0xce;}_0x431dae[_0xac13('0x19')](_0x5f2c7f);return _0x431dae[_0xac13('0x1d')](_0xac13('0x1e'),_0x3c5000+'-'+_0x4f6bb7+'/'+_0x4f90cb)['json'](_0x4aa789);}return null;};}function patchUpdates(_0x39316c){return function(_0x514d54){try{jsonpatch[_0xac13('0x1f')](_0x514d54,_0x39316c,!![]);}catch(_0x5f1425){return BPromise[_0xac13('0x20')](_0x5f1425);}return _0x514d54[_0xac13('0x21')]();};}function saveUpdates(_0x155289,_0x3ae857){return function(_0x30f793){if(_0x30f793){return _0x30f793[_0xac13('0x22')](_0x155289)[_0xac13('0x23')](function(_0x4dfe65){return _0x4dfe65;});}return null;};}function removeEntity(_0x201e01,_0x4be8d7){return function(_0x5eef5f){if(_0x5eef5f){return _0x5eef5f[_0xac13('0x24')]()[_0xac13('0x23')](function(){var _0x1dc516=_0x5eef5f[_0xac13('0x25')]({'plain':!![]});var _0xc0ae25=_0xac13('0x26');return db['UserProfileResource'][_0xac13('0x24')]({'where':{'type':_0xc0ae25,'resourceId':_0x1dc516['id']}})['then'](function(){return _0x5eef5f;});})[_0xac13('0x23')](function(){_0x201e01[_0xac13('0x19')](0xcc)[_0xac13('0x27')]();});}};}function handleEntityNotFound(_0x421914,_0x1dd53b){return function(_0x376994){if(!_0x376994){_0x421914[_0xac13('0x18')](0x194);}return _0x376994;};}function handleError(_0xc08003,_0x4aabb3){_0x4aabb3=_0x4aabb3||0x1f4;return function(_0x2f26b9){logger[_0xac13('0x28')](_0x2f26b9[_0xac13('0x29')]);if(_0x2f26b9[_0xac13('0x2a')]){delete _0x2f26b9[_0xac13('0x2a')];}_0xc08003[_0xac13('0x19')](_0x4aabb3)[_0xac13('0x2b')](_0x2f26b9);};}exports[_0xac13('0x2c')]=function(_0x146db2,_0x3deb10){var _0x274572={},_0x53263e={},_0x5c8642={'count':0x0,'rows':[]};var _0x2dc571=_[_0xac13('0x2d')](db[_0xac13('0x2e')][_0xac13('0x2f')],function(_0x3038ec){return{'name':_0x3038ec['fieldName'],'type':_0x3038ec[_0xac13('0x30')][_0xac13('0x31')]};});_0x53263e['model']=_['map'](_0x2dc571,_0xac13('0x2a'));_0x53263e[_0xac13('0x32')]=_[_0xac13('0x33')](_0x146db2[_0xac13('0x32')]);_0x53263e[_0xac13('0x34')]=_['intersection'](_0x53263e['model'],_0x53263e['query']);_0x274572[_0xac13('0x35')]=_[_0xac13('0x36')](_0x53263e[_0xac13('0x37')],qs['fields'](_0x146db2['query']['fields']));_0x274572[_0xac13('0x35')]=_0x274572[_0xac13('0x35')][_0xac13('0x38')]?_0x274572[_0xac13('0x35')]:_0x53263e['model'];if(!_0x146db2[_0xac13('0x32')][_0xac13('0x39')](_0xac13('0x3a'))){_0x274572[_0xac13('0x1c')]=qs[_0xac13('0x1c')](_0x146db2['query']['limit']);_0x274572[_0xac13('0x1b')]=qs[_0xac13('0x1b')](_0x146db2[_0xac13('0x32')][_0xac13('0x1b')]);}_0x274572[_0xac13('0x3b')]=qs[_0xac13('0x3c')](_0x146db2[_0xac13('0x32')]['sort']);_0x274572['where']=qs[_0xac13('0x34')](_[_0xac13('0x3d')](_0x146db2['query'],_0x53263e[_0xac13('0x34')]),_0x2dc571);if(_0x146db2[_0xac13('0x32')][_0xac13('0x3e')]){_0x274572['where']=_[_0xac13('0x3f')](_0x274572[_0xac13('0x40')],{'$or':_[_0xac13('0x2d')](_0x2dc571,function(_0x17707){if(_0x17707[_0xac13('0x30')]!==_0xac13('0x41')){var _0x3b0c29={};_0x3b0c29[_0x17707[_0xac13('0x2a')]]={'$like':'%'+_0x146db2['query'][_0xac13('0x3e')]+'%'};return _0x3b0c29;}})});}_0x274572=_[_0xac13('0x3f')]({},_0x274572,_0x146db2[_0xac13('0x42')]);var _0x2b55a1={'where':_0x274572[_0xac13('0x40')]};return db[_0xac13('0x2e')][_0xac13('0x1a')](_0x2b55a1)['then'](function(_0x53db13){_0x5c8642[_0xac13('0x1a')]=_0x53db13;if(_0x146db2[_0xac13('0x32')]['includeAll']){_0x274572['include']=[{'all':!![]}];}return db[_0xac13('0x2e')][_0xac13('0x43')](_0x274572);})['then'](function(_0x370dde){_0x5c8642[_0xac13('0x44')]=_0x370dde;return _0x5c8642;})['then'](respondWithFilteredResult(_0x3deb10,_0x274572))[_0xac13('0x45')](handleError(_0x3deb10,null));};exports['show']=function(_0x1a3d72,_0x52491d){var _0x346266={'raw':!![],'where':{'id':_0x1a3d72[_0xac13('0x46')]['id']}},_0x2089d3={};_0x2089d3[_0xac13('0x37')]=_[_0xac13('0x33')](db[_0xac13('0x2e')][_0xac13('0x2f')]);_0x2089d3['query']=_[_0xac13('0x33')](_0x1a3d72[_0xac13('0x32')]);_0x2089d3[_0xac13('0x34')]=_[_0xac13('0x36')](_0x2089d3['model'],_0x2089d3['query']);_0x346266[_0xac13('0x35')]=_[_0xac13('0x36')](_0x2089d3[_0xac13('0x37')],qs[_0xac13('0x47')](_0x1a3d72[_0xac13('0x32')][_0xac13('0x47')]));_0x346266[_0xac13('0x35')]=_0x346266[_0xac13('0x35')][_0xac13('0x38')]?_0x346266[_0xac13('0x35')]:_0x2089d3[_0xac13('0x37')];if(_0x1a3d72['query'][_0xac13('0x48')]){_0x346266[_0xac13('0x49')]=[{'all':!![]}];}_0x346266=_[_0xac13('0x3f')]({},_0x346266,_0x1a3d72['options']);return db[_0xac13('0x2e')][_0xac13('0x4a')](_0x346266)[_0xac13('0x23')](handleEntityNotFound(_0x52491d,null))['then'](respondWithResult(_0x52491d,null))['catch'](handleError(_0x52491d,null));};exports[_0xac13('0x4b')]=function(_0x2d075f,_0x5670b5){return db[_0xac13('0x2e')]['create'](_0x2d075f['body'],{})[_0xac13('0x23')](function(_0x351985){var _0x467636=_0x2d075f[_0xac13('0x4c')][_0xac13('0x25')]({'plain':!![]});if(!_0x467636)throw new Error(_0xac13('0x4d'));if(_0x467636[_0xac13('0x4e')]==='user'){var _0x3ef6ac=_0x351985[_0xac13('0x25')]({'plain':!![]});var _0x4684d0=_0xac13('0x26');return db[_0xac13('0x4f')][_0xac13('0x4a')]({'where':{'name':_0x4684d0,'userProfileId':_0x467636[_0xac13('0x50')]},'raw':!![]})[_0xac13('0x23')](function(_0x42c02a){if(_0x42c02a&&_0x42c02a[_0xac13('0x51')]===0x0){return db[_0xac13('0x52')]['create']({'name':_0x3ef6ac[_0xac13('0x2a')],'resourceId':_0x3ef6ac['id'],'type':_0x42c02a['name'],'sectionId':_0x42c02a['id']},{})[_0xac13('0x23')](function(){return _0x351985;});}else{return _0x351985;}})[_0xac13('0x45')](function(_0x32d703){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d703);throw _0x32d703;});}return _0x351985;})[_0xac13('0x23')](respondWithResult(_0x5670b5,0xc9))['catch'](handleError(_0x5670b5,null));};exports[_0xac13('0x22')]=function(_0x480b97,_0x2f7d8d){if(_0x480b97['body']['id']){delete _0x480b97[_0xac13('0x53')]['id'];}return db[_0xac13('0x2e')]['find']({'where':{'id':_0x480b97[_0xac13('0x46')]['id']}})[_0xac13('0x23')](handleEntityNotFound(_0x2f7d8d,null))[_0xac13('0x23')](saveUpdates(_0x480b97[_0xac13('0x53')],null))[_0xac13('0x23')](respondWithResult(_0x2f7d8d,null))[_0xac13('0x45')](handleError(_0x2f7d8d,null));};exports[_0xac13('0x24')]=function(_0x423f71,_0x10b288){return db[_0xac13('0x2e')][_0xac13('0x4a')]({'where':{'id':_0x423f71[_0xac13('0x46')]['id']}})['then'](handleEntityNotFound(_0x10b288,null))[_0xac13('0x23')](removeEntity(_0x10b288,null))[_0xac13('0x45')](handleError(_0x10b288,null));}; \ No newline at end of file +var _0xeff8=['send','index','rawAttributes','fieldName','model','map','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','CmHopperAdditionalPhone','findAll','rows','catch','show','params','keys','includeAll','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','CmHopperAdditionalPhones','UserProfileResource','error','name'];(function(_0x5712a4,_0x3f4bea){var _0x3dc497=function(_0x236520){while(--_0x236520){_0x5712a4['push'](_0x5712a4['shift']());}};_0x3dc497(++_0x3f4bea);}(_0xeff8,0x1a9));var _0x8eff=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0xeff8[_0x215e65];return _0xa85842;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8eff('0x0'));var zipdir=require(_0x8eff('0x1'));var jsonpatch=require(_0x8eff('0x2'));var rp=require('request-promise');var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8eff('0x7'));var ejs=require(_0x8eff('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8eff('0x9'));var crypto=require(_0x8eff('0xa'));var jsforce=require(_0x8eff('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8eff('0xc'));var Papa=require(_0x8eff('0xd'));var Redis=require('ioredis');var authService=require(_0x8eff('0xe'));var qs=require(_0x8eff('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eff('0x10'));var logger=require(_0x8eff('0x11'))(_0x8eff('0x12'));var utils=require(_0x8eff('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x80551,_0x4a856c){_0x4a856c=_0x4a856c||0xcc;return function(_0x485ca1){if(_0x485ca1){return _0x80551[_0x8eff('0x14')](_0x4a856c);}return _0x80551[_0x8eff('0x15')](_0x4a856c)[_0x8eff('0x16')]();};}function respondWithResult(_0x4c07dc,_0x2c45aa){_0x2c45aa=_0x2c45aa||0xc8;return function(_0x26e04f){if(_0x26e04f){return _0x4c07dc[_0x8eff('0x15')](_0x2c45aa)[_0x8eff('0x17')](_0x26e04f);}};}function respondWithFilteredResult(_0x4da0a0,_0x1875f8){return function(_0x37d348){if(_0x37d348){var _0x3b8792=_0x37d348[_0x8eff('0x18')],_0x398119=_0x1875f8['offset'],_0x19b53b=_0x1875f8[_0x8eff('0x19')]+_0x1875f8[_0x8eff('0x1a')],_0x5167ac;if(_0x19b53b>=_0x3b8792){_0x19b53b=_0x3b8792;_0x5167ac=0xc8;}else{_0x5167ac=0xce;}_0x4da0a0[_0x8eff('0x15')](_0x5167ac);return _0x4da0a0[_0x8eff('0x1b')]('Content-Range',_0x398119+'-'+_0x19b53b+'/'+_0x3b8792)[_0x8eff('0x17')](_0x37d348);}return null;};}function patchUpdates(_0x3b82f6){return function(_0x26f063){try{jsonpatch[_0x8eff('0x1c')](_0x26f063,_0x3b82f6,!![]);}catch(_0x22ac34){return BPromise[_0x8eff('0x1d')](_0x22ac34);}return _0x26f063[_0x8eff('0x1e')]();};}function saveUpdates(_0x57072f,_0xd4b544){return function(_0x209480){if(_0x209480){return _0x209480[_0x8eff('0x1f')](_0x57072f)['then'](function(_0x34ffc3){return _0x34ffc3;});}return null;};}function removeEntity(_0x2d2258,_0x23b4c3){return function(_0x4751b9){if(_0x4751b9){return _0x4751b9['destroy']()[_0x8eff('0x20')](function(){var _0x2e38e8=_0x4751b9['get']({'plain':!![]});var _0x4fa2b8=_0x8eff('0x21');return db[_0x8eff('0x22')]['destroy']({'where':{'type':_0x4fa2b8,'resourceId':_0x2e38e8['id']}})[_0x8eff('0x20')](function(){return _0x4751b9;});})[_0x8eff('0x20')](function(){_0x2d2258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5980e5,_0x142b58){return function(_0x24e928){if(!_0x24e928){_0x5980e5[_0x8eff('0x14')](0x194);}return _0x24e928;};}function handleError(_0x1562df,_0x1c56f7){_0x1c56f7=_0x1c56f7||0x1f4;return function(_0xbc3f55){logger[_0x8eff('0x23')](_0xbc3f55['stack']);if(_0xbc3f55[_0x8eff('0x24')]){delete _0xbc3f55[_0x8eff('0x24')];}_0x1562df[_0x8eff('0x15')](_0x1c56f7)[_0x8eff('0x25')](_0xbc3f55);};}exports[_0x8eff('0x26')]=function(_0x51417e,_0x37dcfb){var _0x59899e={},_0x51e10f={},_0x5e1be8={'count':0x0,'rows':[]};var _0x6b02ba=_['map'](db['CmHopperAdditionalPhone'][_0x8eff('0x27')],function(_0xd7bcec){return{'name':_0xd7bcec[_0x8eff('0x28')],'type':_0xd7bcec['type']['key']};});_0x51e10f[_0x8eff('0x29')]=_[_0x8eff('0x2a')](_0x6b02ba,_0x8eff('0x24'));_0x51e10f['query']=_['keys'](_0x51417e['query']);_0x51e10f[_0x8eff('0x2b')]=_['intersection'](_0x51e10f[_0x8eff('0x29')],_0x51e10f['query']);_0x59899e[_0x8eff('0x2c')]=_[_0x8eff('0x2d')](_0x51e10f[_0x8eff('0x29')],qs[_0x8eff('0x2e')](_0x51417e[_0x8eff('0x2f')]['fields']));_0x59899e[_0x8eff('0x2c')]=_0x59899e['attributes'][_0x8eff('0x30')]?_0x59899e[_0x8eff('0x2c')]:_0x51e10f[_0x8eff('0x29')];if(!_0x51417e[_0x8eff('0x2f')][_0x8eff('0x31')](_0x8eff('0x32'))){_0x59899e['limit']=qs[_0x8eff('0x1a')](_0x51417e[_0x8eff('0x2f')][_0x8eff('0x1a')]);_0x59899e['offset']=qs['offset'](_0x51417e['query']['offset']);}_0x59899e[_0x8eff('0x33')]=qs[_0x8eff('0x34')](_0x51417e['query'][_0x8eff('0x34')]);_0x59899e[_0x8eff('0x35')]=qs[_0x8eff('0x2b')](_[_0x8eff('0x36')](_0x51417e[_0x8eff('0x2f')],_0x51e10f[_0x8eff('0x2b')]),_0x6b02ba);if(_0x51417e[_0x8eff('0x2f')][_0x8eff('0x37')]){_0x59899e['where']=_['merge'](_0x59899e[_0x8eff('0x35')],{'$or':_[_0x8eff('0x2a')](_0x6b02ba,function(_0x1a5355){if(_0x1a5355['type']!==_0x8eff('0x38')){var _0x137fdd={};_0x137fdd[_0x1a5355[_0x8eff('0x24')]]={'$like':'%'+_0x51417e['query'][_0x8eff('0x37')]+'%'};return _0x137fdd;}})});}_0x59899e=_[_0x8eff('0x39')]({},_0x59899e,_0x51417e['options']);var _0x580f8c={'where':_0x59899e[_0x8eff('0x35')]};return db['CmHopperAdditionalPhone']['count'](_0x580f8c)[_0x8eff('0x20')](function(_0x2d06f0){_0x5e1be8[_0x8eff('0x18')]=_0x2d06f0;if(_0x51417e['query']['includeAll']){_0x59899e[_0x8eff('0x3a')]=[{'all':!![]}];}return db[_0x8eff('0x3b')][_0x8eff('0x3c')](_0x59899e);})[_0x8eff('0x20')](function(_0x3b346d){_0x5e1be8[_0x8eff('0x3d')]=_0x3b346d;return _0x5e1be8;})[_0x8eff('0x20')](respondWithFilteredResult(_0x37dcfb,_0x59899e))[_0x8eff('0x3e')](handleError(_0x37dcfb,null));};exports[_0x8eff('0x3f')]=function(_0x3c63e4,_0x342846){var _0x3b21e9={'raw':!![],'where':{'id':_0x3c63e4[_0x8eff('0x40')]['id']}},_0x5c7d69={};_0x5c7d69[_0x8eff('0x29')]=_[_0x8eff('0x41')](db['CmHopperAdditionalPhone'][_0x8eff('0x27')]);_0x5c7d69['query']=_['keys'](_0x3c63e4['query']);_0x5c7d69['filters']=_['intersection'](_0x5c7d69['model'],_0x5c7d69[_0x8eff('0x2f')]);_0x3b21e9[_0x8eff('0x2c')]=_[_0x8eff('0x2d')](_0x5c7d69[_0x8eff('0x29')],qs[_0x8eff('0x2e')](_0x3c63e4['query'][_0x8eff('0x2e')]));_0x3b21e9['attributes']=_0x3b21e9[_0x8eff('0x2c')]['length']?_0x3b21e9['attributes']:_0x5c7d69[_0x8eff('0x29')];if(_0x3c63e4[_0x8eff('0x2f')][_0x8eff('0x42')]){_0x3b21e9['include']=[{'all':!![]}];}_0x3b21e9=_[_0x8eff('0x39')]({},_0x3b21e9,_0x3c63e4[_0x8eff('0x43')]);return db[_0x8eff('0x3b')]['find'](_0x3b21e9)[_0x8eff('0x20')](handleEntityNotFound(_0x342846,null))[_0x8eff('0x20')](respondWithResult(_0x342846,null))['catch'](handleError(_0x342846,null));};exports['create']=function(_0x46f837,_0x14cc85){return db[_0x8eff('0x3b')][_0x8eff('0x44')](_0x46f837[_0x8eff('0x45')],{})[_0x8eff('0x20')](function(_0x3b7ef4){var _0x36636c=_0x46f837['user'][_0x8eff('0x46')]({'plain':!![]});if(!_0x36636c)throw new Error(_0x8eff('0x47'));if(_0x36636c[_0x8eff('0x48')]==='user'){var _0x1c3470=_0x3b7ef4[_0x8eff('0x46')]({'plain':!![]});var _0x4f4725='CmHopperAdditionalPhones';return db[_0x8eff('0x49')][_0x8eff('0x4a')]({'where':{'name':_0x4f4725,'userProfileId':_0x36636c['userProfileId']},'raw':!![]})[_0x8eff('0x20')](function(_0x413c66){if(_0x413c66&&_0x413c66['autoAssociation']===0x0){return db['UserProfileResource'][_0x8eff('0x44')]({'name':_0x1c3470[_0x8eff('0x24')],'resourceId':_0x1c3470['id'],'type':_0x413c66[_0x8eff('0x24')],'sectionId':_0x413c66['id']},{})[_0x8eff('0x20')](function(){return _0x3b7ef4;});}else{return _0x3b7ef4;}})[_0x8eff('0x3e')](function(_0x207e36){logger['error'](_0x8eff('0x4b'),_0x207e36);throw _0x207e36;});}return _0x3b7ef4;})[_0x8eff('0x20')](respondWithResult(_0x14cc85,0xc9))[_0x8eff('0x3e')](handleError(_0x14cc85,null));};exports[_0x8eff('0x1f')]=function(_0x6a6a9c,_0x4ba903){if(_0x6a6a9c[_0x8eff('0x45')]['id']){delete _0x6a6a9c[_0x8eff('0x45')]['id'];}return db[_0x8eff('0x3b')][_0x8eff('0x4a')]({'where':{'id':_0x6a6a9c[_0x8eff('0x40')]['id']}})[_0x8eff('0x20')](handleEntityNotFound(_0x4ba903,null))['then'](saveUpdates(_0x6a6a9c[_0x8eff('0x45')],null))[_0x8eff('0x20')](respondWithResult(_0x4ba903,null))[_0x8eff('0x3e')](handleError(_0x4ba903,null));};exports[_0x8eff('0x4c')]=function(_0x27e1e8,_0xaa67ab){return db[_0x8eff('0x3b')][_0x8eff('0x4a')]({'where':{'id':_0x27e1e8[_0x8eff('0x40')]['id']}})[_0x8eff('0x20')](handleEntityNotFound(_0xaa67ab,null))['then'](removeEntity(_0xaa67ab,null))[_0x8eff('0x3e')](handleError(_0xaa67ab,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 362b545..1890dfe 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcf0=['CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcf0,0x122));var _0x0dcf=function(_0xc6130f,_0xa02ab4){_0xc6130f=_0xc6130f-0x0;var _0x4b9ee7=_0xdcf0[_0xc6130f];return _0x4b9ee7;};'use strict';var _=require('lodash');var util=require(_0x0dcf('0x0'));var logger=require(_0x0dcf('0x1'))('api');var moment=require(_0x0dcf('0x2'));var BPromise=require('bluebird');var rp=require(_0x0dcf('0x3'));var fs=require('fs');var path=require(_0x0dcf('0x4'));var rimraf=require(_0x0dcf('0x5'));var config=require(_0x0dcf('0x6'));var attributes=require(_0x0dcf('0x7'));module[_0x0dcf('0x8')]=function(_0x274a8c,_0x2a8edf){return _0x274a8c[_0x0dcf('0x9')](_0x0dcf('0xa'),attributes,{'tableName':_0x0dcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc5e=['define','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x41023c,_0x368d46){var _0x1cb050=function(_0x58d765){while(--_0x58d765){_0x41023c['push'](_0x41023c['shift']());}};_0x1cb050(++_0x368d46);}(_0xdc5e,0x121));var _0xedc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xedc5('0x0'));var logger=require(_0xedc5('0x1'))('api');var moment=require(_0xedc5('0x2'));var BPromise=require('bluebird');var rp=require(_0xedc5('0x3'));var fs=require('fs');var path=require(_0xedc5('0x4'));var rimraf=require(_0xedc5('0x5'));var config=require(_0xedc5('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xedc5('0x7')]=function(_0x3d0579,_0x2597bf){return _0x3d0579[_0xedc5('0x8')](_0xedc5('0x9'),attributes,{'tableName':_0xedc5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 668e1c8..6783328 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0519=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','countdropretry','countagentrejectretry','entity','waitTime','duration','scheduledat','add','minutes','phone','isNil','countmachineretry','createdAt','updatedAt','hopperToAdd','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x0519,0x1ae));var _0x9051=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x0519[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0x9051('0x0'));var util=require(_0x9051('0x1'));var moment=require(_0x9051('0x2'));var BPromise=require(_0x9051('0x3'));var rs=require(_0x9051('0x4'));var fs=require('fs');var Redis=require(_0x9051('0x5'));var db=require(_0x9051('0x6'))['db'];var utils=require(_0x9051('0x7'));var logger=require(_0x9051('0x8'))(_0x9051('0x9'));var config=require('../../config/environment');var jayson=require(_0x9051('0xa'));var client=jayson['client'][_0x9051('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc8fd32,_0x26d157,_0x3024b2){return new BPromise(function(_0x2c75c9,_0x4e393a){return client[_0x9051('0xc')](_0xc8fd32,_0x3024b2)['then'](function(_0xa8c7cf){logger[_0x9051('0xd')](_0x9051('0xe'),_0x26d157,_0x9051('0xf'));logger[_0x9051('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x26d157,_0x9051('0xf'),JSON['stringify'](_0xa8c7cf));if(_0xa8c7cf[_0x9051('0x11')]){if(_0xa8c7cf[_0x9051('0x11')]['code']===0x1f4){logger['error'](_0x9051('0xe'),_0x26d157,_0xa8c7cf[_0x9051('0x11')]['message']);return _0x4e393a(_0xa8c7cf[_0x9051('0x11')]['message']);}logger[_0x9051('0x11')](_0x9051('0xe'),_0x26d157,_0xa8c7cf[_0x9051('0x11')][_0x9051('0x12')]);return _0x2c75c9(_0xa8c7cf[_0x9051('0x11')][_0x9051('0x12')]);}else{logger['info'](_0x9051('0xe'),_0x26d157,'request\x20sent');_0x2c75c9(_0xa8c7cf[_0x9051('0x13')]['message']);}})[_0x9051('0x14')](function(_0x4ee921){logger[_0x9051('0x11')](_0x9051('0xe'),_0x26d157,_0x4ee921);_0x4e393a(_0x4ee921);});});}exports[_0x9051('0x15')]=function(_0x3a0e8a){var _0x500c2e=this;return new Promise(function(_0x226798,_0x289870){return db[_0x9051('0x16')][_0x9051('0x17')]({'raw':!![],'where':{'ContactId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x19')],'ListId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1a')],'VoiceQueueId':_0x3a0e8a['body'][_0x9051('0x1b')]===undefined?null:_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1b')],'CampaignId':_0x3a0e8a[_0x9051('0x18')][_0x9051('0x1c')]===undefined?null:_0x3a0e8a['body'][_0x9051('0x1c')]}})[_0x9051('0x1d')](function(_0x43e09e){if(_0x43e09e!=null){return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x43e09e['id'],'OrderBy':{'$gt':_0x43e09e[_0x9051('0x1f')]}},'order':[['OrderBy',_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x50d150){var _0x2f6179=0x0;if(_0x50d150){if(_0x50d150[_0x9051('0x21')]+_0x50d150[_0x9051('0x22')]+_0x50d150[_0x9051('0x23')]+_0x50d150[_0x9051('0x24')]+_0x50d150['countdropretry']+_0x50d150[_0x9051('0x25')]+_0x50d150['countmachineretry']+_0x50d150['countagentrejectretry']<_0x3a0e8a['entity'][_0x9051('0x26')])_0x2f6179=0x1;_0x226798({'additional':_0x2f6179});}else{return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x43e09e['id']},'order':[[_0x9051('0x1f'),_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x582552){var _0x3f7dac=0x0;if(_0x582552){if(_0x582552[_0x9051('0x21')]+_0x582552[_0x9051('0x22')]+_0x582552[_0x9051('0x23')]+_0x582552[_0x9051('0x24')]+_0x582552[_0x9051('0x27')]+_0x582552[_0x9051('0x25')]+_0x582552['countmachineretry']+_0x582552[_0x9051('0x28')]<_0x3a0e8a[_0x9051('0x29')]['dialGlobalMaxRetry'])_0x3f7dac=0x1;_0x226798({'additional':_0x3f7dac});}else{_0x226798({'additional':0x0});}})[_0x9051('0x14')](function(_0x585302){logger[_0x9051('0x11')](_0x9051('0x15'),_0x585302[_0x9051('0x12')],_0x3a0e8a);_0x289870(_0x500c2e[_0x9051('0x11')](0x1f4,_0x585302[_0x9051('0x12')]));});}})[_0x9051('0x14')](function(_0x37bb17){logger[_0x9051('0x11')](_0x9051('0x15'),_0x37bb17[_0x9051('0x12')],_0x3a0e8a);_0x289870(_0x500c2e[_0x9051('0x11')](0x1f4,_0x37bb17['message']));});}else _0x226798({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2e6f45){var _0x2b6bd5=this;return new Promise(function(_0x19f802,_0x45453f){return db[_0x9051('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x2e6f45['body'][_0x9051('0x19')],'ListId':_0x2e6f45['body'][_0x9051('0x1a')],'VoiceQueueId':_0x2e6f45[_0x9051('0x18')][_0x9051('0x1b')]===undefined?null:_0x2e6f45[_0x9051('0x18')][_0x9051('0x1b')],'CampaignId':_0x2e6f45['body']['CampaignId']===undefined?null:_0x2e6f45[_0x9051('0x18')]['CampaignId']}})[_0x9051('0x1d')](function(_0x1661c5){if(_0x1661c5!=null){return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1661c5['id'],'OrderBy':{'$gt':_0x1661c5[_0x9051('0x1f')]}},'order':[['OrderBy',_0x9051('0x20')]]})[_0x9051('0x1d')](function(_0x5a2041){if(_0x5a2041)return activateAdditionalPhone(_0x1661c5,_0x2e6f45[_0x9051('0x18')],_0x5a2041,_0x2e6f45['duration'],_0x2e6f45[_0x9051('0x2a')])[_0x9051('0x1d')](function(_0x4c1776){_0x19f802(_0x4c1776);});else{return db[_0x9051('0x1e')][_0x9051('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1661c5['id']},'order':[[_0x9051('0x1f'),'ASC']]})['then'](function(_0x3545ea){if(_0x3545ea)return activateAdditionalPhone(_0x1661c5,_0x2e6f45['body'],_0x3545ea,_0x2e6f45[_0x9051('0x2b')],_0x2e6f45[_0x9051('0x2a')])['then'](function(_0x2d2180){_0x19f802(_0x2d2180);});else{_0x19f802({'id':_0x1661c5['id'],'phone':''});}})[_0x9051('0x14')](function(_0x50db3d){logger[_0x9051('0x11')](_0x9051('0x15'),_0x50db3d[_0x9051('0x12')],_0x2e6f45);_0x45453f(_0x2b6bd5[_0x9051('0x11')](0x1f4,_0x50db3d[_0x9051('0x12')]));});}})[_0x9051('0x14')](function(_0x33622e){logger[_0x9051('0x11')](_0x9051('0x15'),_0x33622e[_0x9051('0x12')],_0x2e6f45);_0x45453f(_0x2b6bd5[_0x9051('0x11')](0x1f4,_0x33622e[_0x9051('0x12')]));});}else _0x19f802(0x1);});});};function activateAdditionalPhone(_0xee4bb2,_0x772fec,_0x238876,_0x89e7f,_0x40bf88){return new Promise(function(_0x297477,_0x51a514){logger[_0x9051('0xd')](_0x9051('0x15'),_0x238876);var _0x53b205;if(moment()>moment(_0x238876[_0x9051('0x2c')])){_0x53b205=moment()[_0x9051('0x2d')](_0x40bf88||0x3,'minutes');}else{if(_0x238876[_0x9051('0x1f')]==0x0){_0x53b205=moment(_0x238876['scheduledat']);}else{_0x53b205=moment()[_0x9051('0x2d')](_0x40bf88||0x3,_0x9051('0x2e'));}}var _0x500b93={'phone':_0xee4bb2[_0x9051('0x2f')],'active':0x0,'OrderBy':_[_0x9051('0x30')](_0xee4bb2[_0x9051('0x1f')])?0x0:_0xee4bb2[_0x9051('0x1f')],'scheduledat':moment()[_0x9051('0x2d')](_0x89e7f||0x1,_0x9051('0x2e')),'countbusyretry':_0x772fec[_0x9051('0x21')],'countcongestionretry':_0x772fec[_0x9051('0x22')],'countnoanswerretry':_0x772fec[_0x9051('0x23')],'countnosuchnumberretry':_0x772fec[_0x9051('0x24')],'countdropretry':_0x772fec[_0x9051('0x27')],'countabandonedretry':_0x772fec['countabandonedretry'],'countmachineretry':_0x772fec[_0x9051('0x31')],'countagentrejectretry':_0x772fec[_0x9051('0x28')],'createdAt':_0x772fec[_0x9051('0x32')],'updatedAt':_0x772fec['updatedAt']};var _0x4cca85={'CmHopperId':_0xee4bb2['id'],'phone':_0x238876[_0x9051('0x2f')],'active':0x0,'OrderBy':_[_0x9051('0x30')](_0x238876[_0x9051('0x1f')])?0x0:_0x238876['OrderBy'],'scheduledat':_0x53b205,'countbusyretry':_0x238876['countbusyretry'],'countcongestionretry':_0x238876[_0x9051('0x22')],'countnoanswerretry':_0x238876[_0x9051('0x23')],'countnosuchnumberretry':_0x772fec['countnosuchnumberretry'],'countdropretry':_0x772fec[_0x9051('0x27')],'countabandonedretry':_0x772fec[_0x9051('0x25')],'countmachineretry':_0x772fec[_0x9051('0x31')],'countagentrejectretry':_0x772fec[_0x9051('0x28')],'createdAt':_0x238876[_0x9051('0x32')],'updatedAt':_0x238876[_0x9051('0x33')]};logger[_0x9051('0xd')](_0x9051('0x34'),_0x500b93);logger['info']('additionalToHop',_0x4cca85);return db[_0x9051('0x35')][_0x9051('0x36')](function(_0x220e92){return db[_0x9051('0x1e')]['update'](_0x500b93,{'where':{'id':_0x238876['id']}},{'transaction':_0x220e92})['then'](function(){return db['CmHopper'][_0x9051('0x37')](_0x4cca85,{'where':{'id':_0xee4bb2['id']}},{'transaction':_0x220e92});});})[_0x9051('0x1d')](function(_0x56c6b8){_0x297477({'id':_0xee4bb2['id'],'phone':_0x238876[_0x9051('0x2f')]});})[_0x9051('0x14')](function(_0xf7eb25){logger[_0x9051('0x11')](_0x9051('0x15'),_0xf7eb25['message'],req);_0x51a514(_this[_0x9051('0x11')](0x1f4,_0xf7eb25[_0x9051('0x12')]));});});}exports[_0x9051('0x38')]=function(_0x1227c9){var _0x12d976=this;return new Promise(function(_0x55d6db,_0x124f00){return db[_0x9051('0x16')][_0x9051('0x37')](_0x1227c9[_0x9051('0x18')][_0x9051('0x39')],{'where':{'id':_0x1227c9[_0x9051('0x18')]['id']}})[_0x9051('0x1d')](function(_0x281f46){_0x55d6db(_0x281f46);})[_0x9051('0x14')](function(_0x405a27){logger[_0x9051('0x11')](_0x9051('0x38'),_0x405a27[_0x9051('0x12')],_0x1227c9);_0x124f00(_0x12d976[_0x9051('0x11')](0x1f4,_0x405a27[_0x9051('0x12')]));});});}; \ No newline at end of file +var _0xa9f2=['ASC','countbusyretry','countcongestionretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','VerifyAdditionalPhones','SwapAdditionalPhones','ContactId','duration','waitTime','catch','scheduledat','minutes','add','phone','countdropretry','createdAt','updatedAt','isNil','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9f2,0x150));var _0x2a9f=function(_0x178c47,_0x104e50){_0x178c47=_0x178c47-0x0;var _0x77e996=_0xa9f2[_0x178c47];return _0x77e996;};'use strict';var _=require(_0x2a9f('0x0'));var util=require(_0x2a9f('0x1'));var moment=require(_0x2a9f('0x2'));var BPromise=require(_0x2a9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a9f('0x4'));var db=require(_0x2a9f('0x5'))['db'];var utils=require(_0x2a9f('0x6'));var logger=require('../../config/logger')(_0x2a9f('0x7'));var config=require(_0x2a9f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a9f('0x9')][_0x2a9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2492,_0x38a099,_0x5c7da3){return new BPromise(function(_0x37b1dc,_0x452493){return client['request'](_0x2a2492,_0x5c7da3)[_0x2a9f('0xb')](function(_0x240e4f){logger['info'](_0x2a9f('0xc'),_0x38a099,_0x2a9f('0xd'));logger[_0x2a9f('0xe')](_0x2a9f('0xf'),_0x38a099,_0x2a9f('0xd'),JSON[_0x2a9f('0x10')](_0x240e4f));if(_0x240e4f[_0x2a9f('0x11')]){if(_0x240e4f[_0x2a9f('0x11')][_0x2a9f('0x12')]===0x1f4){logger['error'](_0x2a9f('0xc'),_0x38a099,_0x240e4f[_0x2a9f('0x11')]['message']);return _0x452493(_0x240e4f[_0x2a9f('0x11')][_0x2a9f('0x13')]);}logger[_0x2a9f('0x11')](_0x2a9f('0xc'),_0x38a099,_0x240e4f[_0x2a9f('0x11')][_0x2a9f('0x13')]);return _0x37b1dc(_0x240e4f[_0x2a9f('0x11')][_0x2a9f('0x13')]);}else{logger[_0x2a9f('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x38a099,_0x2a9f('0xd'));_0x37b1dc(_0x240e4f[_0x2a9f('0x15')][_0x2a9f('0x13')]);}})['catch'](function(_0x2855b5){logger[_0x2a9f('0x11')](_0x2a9f('0xc'),_0x38a099,_0x2855b5);_0x452493(_0x2855b5);});});}exports['VerifyAdditionalPhones']=function(_0x5c4951){var _0x46b594=this;return new Promise(function(_0x4d4bb3,_0x5bf46b){return db[_0x2a9f('0x16')][_0x2a9f('0x17')]({'raw':!![],'where':{'ContactId':_0x5c4951[_0x2a9f('0x18')]['ContactId'],'ListId':_0x5c4951[_0x2a9f('0x18')][_0x2a9f('0x19')],'VoiceQueueId':_0x5c4951[_0x2a9f('0x18')]['VoiceQueueId']===undefined?null:_0x5c4951[_0x2a9f('0x18')][_0x2a9f('0x1a')],'CampaignId':_0x5c4951[_0x2a9f('0x18')][_0x2a9f('0x1b')]===undefined?null:_0x5c4951[_0x2a9f('0x18')]['CampaignId']}})[_0x2a9f('0xb')](function(_0x26e656){if(_0x26e656!=null){return db[_0x2a9f('0x1c')][_0x2a9f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x26e656['id'],'OrderBy':{'$gt':_0x26e656[_0x2a9f('0x1d')]}},'order':[[_0x2a9f('0x1d'),_0x2a9f('0x1e')]]})[_0x2a9f('0xb')](function(_0x2cff6d){var _0x54a218=0x0;if(_0x2cff6d){if(_0x2cff6d[_0x2a9f('0x1f')]+_0x2cff6d[_0x2a9f('0x20')]+_0x2cff6d['countnoanswerretry']+_0x2cff6d['countnosuchnumberretry']+_0x2cff6d['countdropretry']+_0x2cff6d[_0x2a9f('0x21')]+_0x2cff6d[_0x2a9f('0x22')]+_0x2cff6d[_0x2a9f('0x23')]<_0x5c4951[_0x2a9f('0x24')][_0x2a9f('0x25')])_0x54a218=0x1;_0x4d4bb3({'additional':_0x54a218});}else{return db[_0x2a9f('0x1c')][_0x2a9f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x26e656['id']},'order':[[_0x2a9f('0x1d'),_0x2a9f('0x1e')]]})[_0x2a9f('0xb')](function(_0x5a74fb){var _0x4d0c19=0x0;if(_0x5a74fb){if(_0x5a74fb[_0x2a9f('0x1f')]+_0x5a74fb[_0x2a9f('0x20')]+_0x5a74fb[_0x2a9f('0x26')]+_0x5a74fb[_0x2a9f('0x27')]+_0x5a74fb['countdropretry']+_0x5a74fb[_0x2a9f('0x21')]+_0x5a74fb[_0x2a9f('0x22')]+_0x5a74fb[_0x2a9f('0x23')]<_0x5c4951[_0x2a9f('0x24')][_0x2a9f('0x25')])_0x4d0c19=0x1;_0x4d4bb3({'additional':_0x4d0c19});}else{_0x4d4bb3({'additional':0x0});}})['catch'](function(_0x54ec6b){logger[_0x2a9f('0x11')](_0x2a9f('0x28'),_0x54ec6b[_0x2a9f('0x13')],_0x5c4951);_0x5bf46b(_0x46b594[_0x2a9f('0x11')](0x1f4,_0x54ec6b[_0x2a9f('0x13')]));});}})['catch'](function(_0x46b02d){logger[_0x2a9f('0x11')](_0x2a9f('0x28'),_0x46b02d[_0x2a9f('0x13')],_0x5c4951);_0x5bf46b(_0x46b594[_0x2a9f('0x11')](0x1f4,_0x46b02d[_0x2a9f('0x13')]));});}else _0x4d4bb3({'additional':0x0});});});};exports[_0x2a9f('0x29')]=function(_0x5c7f51){var _0x4dbac7=this;return new Promise(function(_0x405d45,_0x1de6d1){return db[_0x2a9f('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x5c7f51['body'][_0x2a9f('0x2a')],'ListId':_0x5c7f51['body'][_0x2a9f('0x19')],'VoiceQueueId':_0x5c7f51['body']['VoiceQueueId']===undefined?null:_0x5c7f51['body'][_0x2a9f('0x1a')],'CampaignId':_0x5c7f51['body'][_0x2a9f('0x1b')]===undefined?null:_0x5c7f51[_0x2a9f('0x18')]['CampaignId']}})['then'](function(_0x5be125){if(_0x5be125!=null){return db[_0x2a9f('0x1c')][_0x2a9f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5be125['id'],'OrderBy':{'$gt':_0x5be125[_0x2a9f('0x1d')]}},'order':[[_0x2a9f('0x1d'),_0x2a9f('0x1e')]]})[_0x2a9f('0xb')](function(_0x4d22ab){if(_0x4d22ab)return activateAdditionalPhone(_0x5be125,_0x5c7f51['body'],_0x4d22ab,_0x5c7f51[_0x2a9f('0x2b')],_0x5c7f51['waitTime'])[_0x2a9f('0xb')](function(_0x514225){_0x405d45(_0x514225);});else{return db[_0x2a9f('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5be125['id']},'order':[[_0x2a9f('0x1d'),'ASC']]})[_0x2a9f('0xb')](function(_0x51106a){if(_0x51106a)return activateAdditionalPhone(_0x5be125,_0x5c7f51[_0x2a9f('0x18')],_0x51106a,_0x5c7f51[_0x2a9f('0x2b')],_0x5c7f51[_0x2a9f('0x2c')])['then'](function(_0x569b32){_0x405d45(_0x569b32);});else{_0x405d45({'id':_0x5be125['id'],'phone':''});}})[_0x2a9f('0x2d')](function(_0x1c9f43){logger[_0x2a9f('0x11')](_0x2a9f('0x28'),_0x1c9f43[_0x2a9f('0x13')],_0x5c7f51);_0x1de6d1(_0x4dbac7[_0x2a9f('0x11')](0x1f4,_0x1c9f43['message']));});}})[_0x2a9f('0x2d')](function(_0x468a15){logger[_0x2a9f('0x11')](_0x2a9f('0x28'),_0x468a15[_0x2a9f('0x13')],_0x5c7f51);_0x1de6d1(_0x4dbac7[_0x2a9f('0x11')](0x1f4,_0x468a15['message']));});}else _0x405d45(0x1);});});};function activateAdditionalPhone(_0x2e9abc,_0x42de93,_0x5679f8,_0x5912f7,_0x18ac21){return new Promise(function(_0x2895fc,_0x45ac0f){logger[_0x2a9f('0x14')](_0x2a9f('0x28'),_0x5679f8);var _0x291499;if(moment()>moment(_0x5679f8[_0x2a9f('0x2e')])){_0x291499=moment()['add'](_0x18ac21||0x3,_0x2a9f('0x2f'));}else{if(_0x5679f8['OrderBy']==0x0){_0x291499=moment(_0x5679f8[_0x2a9f('0x2e')]);}else{_0x291499=moment()[_0x2a9f('0x30')](_0x18ac21||0x3,_0x2a9f('0x2f'));}}var _0x359c89={'phone':_0x2e9abc[_0x2a9f('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x2e9abc['OrderBy'])?0x0:_0x2e9abc[_0x2a9f('0x1d')],'scheduledat':moment()[_0x2a9f('0x30')](_0x5912f7||0x1,_0x2a9f('0x2f')),'countbusyretry':_0x42de93['countbusyretry'],'countcongestionretry':_0x42de93[_0x2a9f('0x20')],'countnoanswerretry':_0x42de93[_0x2a9f('0x26')],'countnosuchnumberretry':_0x42de93[_0x2a9f('0x27')],'countdropretry':_0x42de93[_0x2a9f('0x32')],'countabandonedretry':_0x42de93[_0x2a9f('0x21')],'countmachineretry':_0x42de93[_0x2a9f('0x22')],'countagentrejectretry':_0x42de93['countagentrejectretry'],'createdAt':_0x42de93[_0x2a9f('0x33')],'updatedAt':_0x42de93[_0x2a9f('0x34')]};var _0x89336a={'CmHopperId':_0x2e9abc['id'],'phone':_0x5679f8['phone'],'active':0x0,'OrderBy':_[_0x2a9f('0x35')](_0x5679f8[_0x2a9f('0x1d')])?0x0:_0x5679f8['OrderBy'],'scheduledat':_0x291499,'countbusyretry':_0x5679f8[_0x2a9f('0x1f')],'countcongestionretry':_0x5679f8[_0x2a9f('0x20')],'countnoanswerretry':_0x5679f8[_0x2a9f('0x26')],'countnosuchnumberretry':_0x42de93['countnosuchnumberretry'],'countdropretry':_0x42de93[_0x2a9f('0x32')],'countabandonedretry':_0x42de93[_0x2a9f('0x21')],'countmachineretry':_0x42de93['countmachineretry'],'countagentrejectretry':_0x42de93[_0x2a9f('0x23')],'createdAt':_0x5679f8[_0x2a9f('0x33')],'updatedAt':_0x5679f8[_0x2a9f('0x34')]};logger['info'](_0x2a9f('0x36'),_0x359c89);logger['info'](_0x2a9f('0x37'),_0x89336a);return db[_0x2a9f('0x38')][_0x2a9f('0x39')](function(_0x48631a){return db[_0x2a9f('0x1c')][_0x2a9f('0x3a')](_0x359c89,{'where':{'id':_0x5679f8['id']}},{'transaction':_0x48631a})[_0x2a9f('0xb')](function(){return db[_0x2a9f('0x16')][_0x2a9f('0x3a')](_0x89336a,{'where':{'id':_0x2e9abc['id']}},{'transaction':_0x48631a});});})[_0x2a9f('0xb')](function(_0x59948d){_0x2895fc({'id':_0x2e9abc['id'],'phone':_0x5679f8[_0x2a9f('0x31')]});})[_0x2a9f('0x2d')](function(_0x147a0c){logger[_0x2a9f('0x11')](_0x2a9f('0x28'),_0x147a0c[_0x2a9f('0x13')],req);_0x45ac0f(_this['error'](0x1f4,_0x147a0c[_0x2a9f('0x13')]));});});}exports[_0x2a9f('0x3b')]=function(_0x23b8d6){var _0x2bd71a=this;return new Promise(function(_0x518079,_0x5c45bf){return db[_0x2a9f('0x16')][_0x2a9f('0x3a')](_0x23b8d6[_0x2a9f('0x18')][_0x2a9f('0x3c')],{'where':{'id':_0x23b8d6[_0x2a9f('0x18')]['id']}})[_0x2a9f('0xb')](function(_0x1db069){_0x518079(_0x1db069);})[_0x2a9f('0x2d')](function(_0x375396){logger[_0x2a9f('0x11')](_0x2a9f('0x3b'),_0x375396[_0x2a9f('0x13')],_0x23b8d6);_0x5c45bf(_0x2bd71a[_0x2a9f('0x11')](0x1f4,_0x375396[_0x2a9f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index cbaff7b..30d1d70 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21f0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports','multer','path','connect-timeout'];(function(_0x19b5ed,_0x32ff8d){var _0x139dd5=function(_0x1d1f5b){while(--_0x1d1f5b){_0x19b5ed['push'](_0x19b5ed['shift']());}};_0x139dd5(++_0x32ff8d);}(_0x21f0,0x69));var _0x021f=function(_0x1cf638,_0x20fc2a){_0x1cf638=_0x1cf638-0x0;var _0x3a077c=_0x21f0[_0x1cf638];return _0x3a077c;};'use strict';var multer=require(_0x021f('0x0'));var util=require('util');var path=require(_0x021f('0x1'));var timeout=require(_0x021f('0x2'));var express=require(_0x021f('0x3'));var router=express[_0x021f('0x4')]();var auth=require(_0x021f('0x5'));var interaction=require(_0x021f('0x6'));var config=require(_0x021f('0x7'));var controller=require(_0x021f('0x8'));router[_0x021f('0x9')]('/',auth[_0x021f('0xa')](),controller[_0x021f('0xb')]);router[_0x021f('0x9')](_0x021f('0xc'),auth[_0x021f('0xa')](),controller['show']);router[_0x021f('0xd')]('/',auth[_0x021f('0xa')](),controller[_0x021f('0xe')]);router['put'](_0x021f('0xc'),auth[_0x021f('0xa')](),controller[_0x021f('0xf')]);router[_0x021f('0x10')](_0x021f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x021f('0x11')]=router; \ No newline at end of file +var _0xad0b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x4f92b0,_0x1281a0){var _0x1570cc=function(_0x59a5f9){while(--_0x59a5f9){_0x4f92b0['push'](_0x4f92b0['shift']());}};_0x1570cc(++_0x1281a0);}(_0xad0b,0xc9));var _0xbad0=function(_0x20f670,_0x2918e5){_0x20f670=_0x20f670-0x0;var _0x21a849=_0xad0b[_0x20f670];return _0x21a849;};'use strict';var multer=require(_0xbad0('0x0'));var util=require(_0xbad0('0x1'));var path=require(_0xbad0('0x2'));var timeout=require(_0xbad0('0x3'));var express=require(_0xbad0('0x4'));var router=express[_0xbad0('0x5')]();var auth=require(_0xbad0('0x6'));var interaction=require(_0xbad0('0x7'));var config=require(_0xbad0('0x8'));var controller=require(_0xbad0('0x9'));router[_0xbad0('0xa')]('/',auth[_0xbad0('0xb')](),controller['index']);router[_0xbad0('0xa')](_0xbad0('0xc'),auth[_0xbad0('0xb')](),controller[_0xbad0('0xd')]);router[_0xbad0('0xe')]('/',auth['isAuthenticated'](),controller[_0xbad0('0xf')]);router['put'](_0xbad0('0xc'),auth[_0xbad0('0xb')](),controller[_0xbad0('0x10')]);router[_0xbad0('0x11')]('/:id',auth[_0xbad0('0xb')](),controller[_0xbad0('0x12')]);module[_0xbad0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index bb78660..e786272 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 _0x959b=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x959b,0xc6));var _0xb959=function(_0xab478e,_0x3a36d5){_0xab478e=_0xab478e-0x0;var _0x1aa516=_0x959b[_0xab478e];return _0x1aa516;};'use strict';var moment=require('moment');var Sequelize=require(_0xb959('0x0'));module[_0xb959('0x1')]={'phone':{'type':Sequelize[_0xb959('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb959('0x3')],'unique':_0xb959('0x4')},'ListId':{'type':Sequelize[_0xb959('0x3')],'unique':_0xb959('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb959('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x10a5=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x4f12ea,_0x204723){var _0x1efe36=function(_0x12a22f){while(--_0x12a22f){_0x4f12ea['push'](_0x4f12ea['shift']());}};_0x1efe36(++_0x204723);}(_0x10a5,0x1c7));var _0x510a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x10a5[_0x278e3c];return _0x3e2d9b;};'use strict';var moment=require(_0x510a('0x0'));var Sequelize=require(_0x510a('0x1'));module['exports']={'phone':{'type':Sequelize[_0x510a('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x510a('0x3')],'unique':_0x510a('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x510a('0x3')],'unique':_0x510a('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index e2f0129..66d6ee4 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x34316b,_0x308ad3){var _0xbde4b3=function(_0x285cd0){while(--_0x285cd0){_0x34316b['push'](_0x34316b['shift']());}};_0xbde4b3(++_0x308ad3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x2cd647,_0x1a8d41){var _0x34e053=function(_0x4cb1db){while(--_0x4cb1db){_0x2cd647['push'](_0x2cd647['shift']());}};_0x34e053(++_0x1a8d41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index aba23b4..334125c 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0x70e0,0x17b));var _0x070e=function(_0x35669a,_0x2d2e20){_0x35669a=_0x35669a-0x0;var _0x4039d1=_0x70e0[_0x35669a];return _0x4039d1;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('CmHopperBlack',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0x47df81,_0x1a68b0){var _0x53851b=function(_0x4768f2){while(--_0x4768f2){_0x47df81['push'](_0x47df81['shift']());}};_0x53851b(++_0x1a68b0);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index e86617f..e5715e4 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 _0x0085=['destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','model','attributes','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack'];(function(_0x42a206,_0x2b1612){var _0x35eb3b=function(_0x3e5c46){while(--_0x3e5c46){_0x42a206['push'](_0x42a206['shift']());}};_0x35eb3b(++_0x2b1612);}(_0x0085,0xf7));var _0x5008=function(_0x1db929,_0x270726){_0x1db929=_0x1db929-0x0;var _0x111a43=_0x0085[_0x1db929];return _0x111a43;};'use strict';var _=require(_0x5008('0x0'));var util=require(_0x5008('0x1'));var moment=require(_0x5008('0x2'));var BPromise=require(_0x5008('0x3'));var rs=require(_0x5008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5008('0x5'))['db'];var utils=require(_0x5008('0x6'));var logger=require(_0x5008('0x7'))(_0x5008('0x8'));var config=require('../../config/environment');var jayson=require(_0x5008('0x9'));var client=jayson[_0x5008('0xa')][_0x5008('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52e5b5,_0x481038,_0x4c29b2){return new BPromise(function(_0x2ebc94,_0x1918c){return client[_0x5008('0xc')](_0x52e5b5,_0x4c29b2)[_0x5008('0xd')](function(_0x152a2e){logger[_0x5008('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x5008('0xf'));logger[_0x5008('0x10')](_0x5008('0x11'),_0x481038,_0x5008('0xf'),JSON[_0x5008('0x12')](_0x152a2e));if(_0x152a2e[_0x5008('0x13')]){if(_0x152a2e[_0x5008('0x13')][_0x5008('0x14')]===0x1f4){logger[_0x5008('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);return _0x1918c(_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);}logger[_0x5008('0x13')](_0x5008('0x16'),_0x481038,_0x152a2e[_0x5008('0x13')]['message']);return _0x2ebc94(_0x152a2e[_0x5008('0x13')][_0x5008('0x15')]);}else{logger[_0x5008('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x481038,_0x5008('0xf'));_0x2ebc94(_0x152a2e[_0x5008('0x17')]['message']);}})[_0x5008('0x18')](function(_0x5da9a2){logger[_0x5008('0x13')](_0x5008('0x16'),_0x481038,_0x5da9a2);_0x1918c(_0x5da9a2);});});}exports[_0x5008('0x19')]=function(_0x5969de){var _0xc6fc59=this;return new Promise(function(_0x3aed40,_0x36cf39){return db[_0x5008('0x1a')][_0x5008('0x1b')]({'raw':_0x5969de['options']?_0x5969de[_0x5008('0x1c')][_0x5008('0x1d')]===undefined?!![]:![]:!![],'where':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')][_0x5008('0x1e')]||null:null,'attributes':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')]['attributes']||null:null,'limit':_0x5969de[_0x5008('0x1c')]?_0x5969de[_0x5008('0x1c')][_0x5008('0x1f')]||null:null,'include':_0x5969de[_0x5008('0x1c')]?_0x5969de['options'][_0x5008('0x20')]?_['map'](_0x5969de[_0x5008('0x1c')][_0x5008('0x20')],function(_0x4f57b5){return{'model':db[_0x4f57b5[_0x5008('0x21')]],'as':_0x4f57b5['as'],'attributes':_0x4f57b5[_0x5008('0x22')],'include':_0x4f57b5[_0x5008('0x20')]?_[_0x5008('0x23')](_0x4f57b5['include'],function(_0x8e995a){return{'model':db[_0x8e995a[_0x5008('0x21')]],'as':_0x8e995a['as'],'attributes':_0x8e995a[_0x5008('0x22')],'include':_0x8e995a[_0x5008('0x20')]?_[_0x5008('0x23')](_0x8e995a[_0x5008('0x20')],function(_0x3915cb){return{'model':db[_0x3915cb[_0x5008('0x21')]],'as':_0x3915cb['as'],'attributes':_0x3915cb[_0x5008('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5008('0xd')](function(_0x4622a2){logger[_0x5008('0xe')]('GetCmHopperBlack',_0x5969de);logger[_0x5008('0x10')](_0x5008('0x19'),_0x5969de,JSON[_0x5008('0x12')](_0x4622a2));_0x3aed40(_0x4622a2);})[_0x5008('0x18')](function(_0x72605f){logger[_0x5008('0x13')](_0x5008('0x19'),_0x72605f[_0x5008('0x15')],_0x5969de);_0x36cf39(_0xc6fc59[_0x5008('0x13')](0x1f4,_0x72605f[_0x5008('0x15')]));});});};exports[_0x5008('0x24')]=function(_0x545bea){var _0x48db1a=this;return new Promise(function(_0x2a6959,_0x3764a4){return db['CmHopperBlack'][_0x5008('0x25')](_0x545bea[_0x5008('0x26')],{'raw':_0x545bea['options']?_0x545bea[_0x5008('0x1c')][_0x5008('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x545bea[_0x5008('0x1c')]?_0x545bea['options'][_0x5008('0x1e')]||null:null,'attributes':_0x545bea[_0x5008('0x1c')]?_0x545bea[_0x5008('0x1c')][_0x5008('0x22')]||null:null,'limit':_0x545bea['options']?_0x545bea[_0x5008('0x1c')]['limit']||null:null})[_0x5008('0xd')](function(_0x3bf782){logger['info'](_0x5008('0x24'),_0x545bea);logger[_0x5008('0x10')]('UpdateCmHopperBlack',_0x545bea,JSON[_0x5008('0x12')](_0x3bf782));_0x2a6959(_0x3bf782);})['catch'](function(_0x5ec227){logger[_0x5008('0x13')]('UpdateCmHopperBlack',_0x5ec227[_0x5008('0x15')],_0x545bea);_0x3764a4(_0x48db1a['error'](0x1f4,_0x5ec227['message']));});});};exports[_0x5008('0x27')]=function(_0x21b5ac){var _0x5a6532=this;return new Promise(function(_0xc115a4,_0x4283a0){return db[_0x5008('0x1a')][_0x5008('0x28')]({'where':_0x21b5ac[_0x5008('0x1c')]?_0x21b5ac['options']['where']||null:null})[_0x5008('0xd')](function(_0x2bc4d5){logger[_0x5008('0xe')](_0x5008('0x27'),_0x21b5ac);logger[_0x5008('0x10')](_0x5008('0x27'),_0x21b5ac,JSON[_0x5008('0x12')](_0x2bc4d5));_0xc115a4(_0x2bc4d5);})[_0x5008('0x18')](function(_0x2101bb){logger[_0x5008('0x13')]('DestroyCmHopperBlack',_0x2101bb[_0x5008('0x15')],_0x21b5ac);_0x4283a0(_0x5a6532[_0x5008('0x13')](0x1f4,_0x2101bb[_0x5008('0x15')]));});});}; \ No newline at end of file +var _0xdc99=['CmHopperBlack,\x20%s,\x20%s','message','info','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdc99,0x116));var _0x9dc9=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0xdc99[_0x1f9f5f];return _0x51d649;};'use strict';var _=require(_0x9dc9('0x0'));var util=require(_0x9dc9('0x1'));var moment=require('moment');var BPromise=require(_0x9dc9('0x2'));var rs=require(_0x9dc9('0x3'));var fs=require('fs');var Redis=require(_0x9dc9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dc9('0x5'));var logger=require(_0x9dc9('0x6'))(_0x9dc9('0x7'));var config=require(_0x9dc9('0x8'));var jayson=require(_0x9dc9('0x9'));var client=jayson[_0x9dc9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c881,_0x3f14e1,_0x7ec4e3){return new BPromise(function(_0xc95337,_0x13c2f8){return client[_0x9dc9('0xb')](_0x15c881,_0x7ec4e3)[_0x9dc9('0xc')](function(_0x3d780f){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3f14e1,_0x9dc9('0xd'));logger[_0x9dc9('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x3f14e1,_0x9dc9('0xd'),JSON[_0x9dc9('0xf')](_0x3d780f));if(_0x3d780f[_0x9dc9('0x10')]){if(_0x3d780f[_0x9dc9('0x10')][_0x9dc9('0x11')]===0x1f4){logger[_0x9dc9('0x10')](_0x9dc9('0x12'),_0x3f14e1,_0x3d780f['error'][_0x9dc9('0x13')]);return _0x13c2f8(_0x3d780f[_0x9dc9('0x10')]['message']);}logger[_0x9dc9('0x10')](_0x9dc9('0x12'),_0x3f14e1,_0x3d780f['error'][_0x9dc9('0x13')]);return _0xc95337(_0x3d780f[_0x9dc9('0x10')][_0x9dc9('0x13')]);}else{logger[_0x9dc9('0x14')](_0x9dc9('0x12'),_0x3f14e1,_0x9dc9('0xd'));_0xc95337(_0x3d780f['result'][_0x9dc9('0x13')]);}})['catch'](function(_0x5ad69b){logger[_0x9dc9('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3f14e1,_0x5ad69b);_0x13c2f8(_0x5ad69b);});});}exports[_0x9dc9('0x15')]=function(_0xda52aa){var _0x306933=this;return new Promise(function(_0x44fdf5,_0x5a608e){return db['CmHopperBlack'][_0x9dc9('0x16')]({'raw':_0xda52aa[_0x9dc9('0x17')]?_0xda52aa['options'][_0x9dc9('0x18')]===undefined?!![]:![]:!![],'where':_0xda52aa[_0x9dc9('0x17')]?_0xda52aa[_0x9dc9('0x17')][_0x9dc9('0x19')]||null:null,'attributes':_0xda52aa[_0x9dc9('0x17')]?_0xda52aa[_0x9dc9('0x17')][_0x9dc9('0x1a')]||null:null,'limit':_0xda52aa[_0x9dc9('0x17')]?_0xda52aa['options'][_0x9dc9('0x1b')]||null:null,'include':_0xda52aa[_0x9dc9('0x17')]?_0xda52aa[_0x9dc9('0x17')][_0x9dc9('0x1c')]?_[_0x9dc9('0x1d')](_0xda52aa[_0x9dc9('0x17')][_0x9dc9('0x1c')],function(_0x5c4b89){return{'model':db[_0x5c4b89[_0x9dc9('0x1e')]],'as':_0x5c4b89['as'],'attributes':_0x5c4b89[_0x9dc9('0x1a')],'include':_0x5c4b89['include']?_[_0x9dc9('0x1d')](_0x5c4b89[_0x9dc9('0x1c')],function(_0x506d3a){return{'model':db[_0x506d3a['model']],'as':_0x506d3a['as'],'attributes':_0x506d3a[_0x9dc9('0x1a')],'include':_0x506d3a[_0x9dc9('0x1c')]?_[_0x9dc9('0x1d')](_0x506d3a[_0x9dc9('0x1c')],function(_0x3ff934){return{'model':db[_0x3ff934['model']],'as':_0x3ff934['as'],'attributes':_0x3ff934['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dc9('0xc')](function(_0xe92dc1){logger[_0x9dc9('0x14')]('GetCmHopperBlack',_0xda52aa);logger[_0x9dc9('0xe')](_0x9dc9('0x15'),_0xda52aa,JSON['stringify'](_0xe92dc1));_0x44fdf5(_0xe92dc1);})[_0x9dc9('0x1f')](function(_0x4b0632){logger['error'](_0x9dc9('0x15'),_0x4b0632[_0x9dc9('0x13')],_0xda52aa);_0x5a608e(_0x306933[_0x9dc9('0x10')](0x1f4,_0x4b0632['message']));});});};exports[_0x9dc9('0x20')]=function(_0x424161){var _0x72149=this;return new Promise(function(_0x4a9c4c,_0x494db1){return db[_0x9dc9('0x21')]['update'](_0x424161[_0x9dc9('0x22')],{'raw':_0x424161['options']?_0x424161[_0x9dc9('0x17')][_0x9dc9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424161['options']?_0x424161[_0x9dc9('0x17')]['where']||null:null,'attributes':_0x424161[_0x9dc9('0x17')]?_0x424161[_0x9dc9('0x17')][_0x9dc9('0x1a')]||null:null,'limit':_0x424161[_0x9dc9('0x17')]?_0x424161[_0x9dc9('0x17')][_0x9dc9('0x1b')]||null:null})['then'](function(_0x74c4d1){logger[_0x9dc9('0x14')]('UpdateCmHopperBlack',_0x424161);logger[_0x9dc9('0xe')](_0x9dc9('0x20'),_0x424161,JSON[_0x9dc9('0xf')](_0x74c4d1));_0x4a9c4c(_0x74c4d1);})[_0x9dc9('0x1f')](function(_0x83404a){logger[_0x9dc9('0x10')](_0x9dc9('0x20'),_0x83404a[_0x9dc9('0x13')],_0x424161);_0x494db1(_0x72149[_0x9dc9('0x10')](0x1f4,_0x83404a[_0x9dc9('0x13')]));});});};exports[_0x9dc9('0x23')]=function(_0x3028bd){var _0x1ed4af=this;return new Promise(function(_0x25afb5,_0x576d16){return db[_0x9dc9('0x21')][_0x9dc9('0x24')]({'where':_0x3028bd['options']?_0x3028bd[_0x9dc9('0x17')][_0x9dc9('0x19')]||null:null})[_0x9dc9('0xc')](function(_0x3ff9fb){logger[_0x9dc9('0x14')](_0x9dc9('0x23'),_0x3028bd);logger[_0x9dc9('0xe')](_0x9dc9('0x23'),_0x3028bd,JSON['stringify'](_0x3ff9fb));_0x25afb5(_0x3ff9fb);})[_0x9dc9('0x1f')](function(_0x55b3c7){logger[_0x9dc9('0x10')]('DestroyCmHopperBlack',_0x55b3c7[_0x9dc9('0x13')],_0x3028bd);_0x576d16(_0x1ed4af['error'](0x1f4,_0x55b3c7[_0x9dc9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 610aa91..b914f98 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 _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa7,0x178));var _0x76aa=function(_0x258424,_0x313adf){_0x258424=_0x258424-0x0;var _0x445d2c=_0x6aa7[_0x258424];return _0x445d2c;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['get'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xd')]);router['put'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file +var _0xfd28=['index','/describe','/:id','put','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x14ed37,_0x24c155){var _0x3c9cef=function(_0x9b996b){while(--_0x9b996b){_0x14ed37['push'](_0x14ed37['shift']());}};_0x3c9cef(++_0x24c155);}(_0xfd28,0x148));var _0x8fd2=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xfd28[_0x52b7b9];return _0x5b5d30;};'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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 126d20e..235dc78 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 _0x8143=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x156451,_0x4e7f4a){var _0x3b75b1=function(_0x3d9986){while(--_0x3d9986){_0x156451['push'](_0x156451['shift']());}};_0x3b75b1(++_0x4e7f4a);}(_0x8143,0x135));var _0x3814=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8143[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3814('0x0'));var moment=require('moment');module[_0x3814('0x1')]={'state':{'type':Sequelize[_0x3814('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3814('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3814('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3814('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3814('0x3')]},'calleridname':{'type':Sequelize[_0x3814('0x3')]},'starttime':{'type':Sequelize[_0x3814('0x4')]},'responsetime':{'type':Sequelize[_0x3814('0x4')]},'answertime':{'type':Sequelize[_0x3814('0x4')]},'droptime':{'type':Sequelize[_0x3814('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3814('0x3')]},'campaigntype':{'type':Sequelize[_0x3814('0x3')]},'membername':{'type':Sequelize[_0x3814('0x3')]},'reason':{'type':Sequelize[_0x3814('0x3')]},'disposition':{'type':Sequelize[_0x3814('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x15ccd8){var _0x3441ae=this[_0x3814('0x5')](_0x3814('0x6'));if(_0x3441ae&&_0x15ccd8){this[_0x3814('0x7')](_0x3814('0x8'),moment(_0x15ccd8)[_0x3814('0x9')](moment(_0x3441ae),_0x3814('0xa')));}return this[_0x3814('0x7')]('dispositionat',_0x15ccd8);}},'amd':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3814('0x4')]},'callback':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3814('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x3814('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3814('0x4')]},'recallme':{'type':Sequelize[_0x3814('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3814('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1919=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat'];(function(_0x2ace15,_0x36687c){var _0x346870=function(_0x2dc023){while(--_0x2dc023){_0x2ace15['push'](_0x2ace15['shift']());}};_0x346870(++_0x36687c);}(_0x1919,0x105));var _0x9191=function(_0x544cc4,_0x307ff7){_0x544cc4=_0x544cc4-0x0;var _0x9afdb9=_0x1919[_0x544cc4];return _0x9afdb9;};'use strict';var Sequelize=require(_0x9191('0x0'));var moment=require(_0x9191('0x1'));module['exports']={'state':{'type':Sequelize[_0x9191('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9191('0x3')]},'scheduledat':{'type':Sequelize[_0x9191('0x4')]},'countbusyretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9191('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9191('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9191('0x3')]},'calleridnum':{'type':Sequelize[_0x9191('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9191('0x4')]},'responsetime':{'type':Sequelize[_0x9191('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x9191('0x4')]},'endtime':{'type':Sequelize[_0x9191('0x4')]},'ringtime':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9191('0x3')]},'campaign':{'type':Sequelize[_0x9191('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9191('0x3')]},'reason':{'type':Sequelize[_0x9191('0x3')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x9191('0x4')],'set':function(_0x81e488){var _0x156fd0=this[_0x9191('0x5')](_0x9191('0x6'));if(_0x156fd0&&_0x81e488){this[_0x9191('0x7')](_0x9191('0x8'),moment(_0x81e488)[_0x9191('0x9')](moment(_0x156fd0),_0x9191('0xa')));}return this[_0x9191('0x7')](_0x9191('0xb'),_0x81e488);}},'amd':{'type':Sequelize[_0x9191('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9191('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9191('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9191('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9191('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9191('0x4')]},'deleted':{'type':Sequelize[_0x9191('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9191('0x4')]},'recallme':{'type':Sequelize[_0x9191('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9191('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9191('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9191('0x2')],'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 bb44965..2033e72 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 _0x75dc=['model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','CmHopperFinal','count','includeAll','include','rows','catch','show','find','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','from','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key'];(function(_0xca7609,_0x54d886){var _0x215ce0=function(_0x1ec445){while(--_0x1ec445){_0xca7609['push'](_0xca7609['shift']());}};_0x215ce0(++_0x54d886);}(_0x75dc,0x1d7));var _0xc75d=function(_0x203271,_0x542139){_0x203271=_0x203271-0x0;var _0x37b0dd=_0x75dc[_0x203271];return _0x37b0dd;};'use strict';var pdf=require(_0xc75d('0x0'));var emlformat=require(_0xc75d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc75d('0x2'));var moment=require(_0xc75d('0x3'));var BPromise=require(_0xc75d('0x4'));var Mustache=require(_0xc75d('0x5'));var util=require(_0xc75d('0x6'));var path=require(_0xc75d('0x7'));var sox=require('sox');var csv=require(_0xc75d('0x8'));var ejs=require(_0xc75d('0x9'));var fs=require('fs');var _=require(_0xc75d('0xa'));var squel=require('squel');var crypto=require(_0xc75d('0xb'));var jsforce=require(_0xc75d('0xc'));var deskjs=require(_0xc75d('0xd'));var toCsv=require(_0xc75d('0x8'));var querystring=require('querystring');var Papa=require(_0xc75d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc75d('0xf'));var as=require(_0xc75d('0x10'));var hardwareService=require(_0xc75d('0x11'));var logger=require(_0xc75d('0x12'))('api');var utils=require(_0xc75d('0x13'));var config=require(_0xc75d('0x14'));var db=require(_0xc75d('0x15'))['db'];function respondWithStatusCode(_0x1b0911,_0x1a7984){_0x1a7984=_0x1a7984||0xcc;return function(_0x2521fd){if(_0x2521fd){return _0x1b0911[_0xc75d('0x16')](_0x1a7984);}return _0x1b0911['status'](_0x1a7984)[_0xc75d('0x17')]();};}function respondWithResult(_0x2313be,_0x3f01a0){_0x3f01a0=_0x3f01a0||0xc8;return function(_0x421b53){if(_0x421b53){return _0x2313be['status'](_0x3f01a0)['json'](_0x421b53);}};}function respondWithFilteredResult(_0x1208d7,_0x182f56){return function(_0x174998){if(_0x174998){var _0x1b0bfc=_0x174998['count'],_0x1d49b9=_0x182f56[_0xc75d('0x18')],_0x331d68=_0x182f56[_0xc75d('0x18')]+_0x182f56[_0xc75d('0x19')],_0x2bd581;if(_0x331d68>=_0x1b0bfc){_0x331d68=_0x1b0bfc;_0x2bd581=0xc8;}else{_0x2bd581=0xce;}_0x1208d7[_0xc75d('0x1a')](_0x2bd581);return _0x1208d7[_0xc75d('0x1b')]('Content-Range',_0x1d49b9+'-'+_0x331d68+'/'+_0x1b0bfc)[_0xc75d('0x1c')](_0x174998);}return null;};}function patchUpdates(_0x50e44f){return function(_0x54f089){try{jsonpatch[_0xc75d('0x1d')](_0x54f089,_0x50e44f,!![]);}catch(_0x431948){return BPromise[_0xc75d('0x1e')](_0x431948);}return _0x54f089[_0xc75d('0x1f')]();};}function saveUpdates(_0x84ded6,_0x576117){return function(_0x3d4141){if(_0x3d4141){return _0x3d4141[_0xc75d('0x20')](_0x84ded6)[_0xc75d('0x21')](function(_0x20739f){return _0x20739f;});}return null;};}function removeEntity(_0x1ae4e9,_0x1b614f){return function(_0x2181e1){if(_0x2181e1){return _0x2181e1[_0xc75d('0x22')]()['then'](function(){_0x1ae4e9[_0xc75d('0x1a')](0xcc)[_0xc75d('0x17')]();});}};}function handleEntityNotFound(_0x18589b,_0x4314cc){return function(_0x5ef8d0){if(!_0x5ef8d0){_0x18589b[_0xc75d('0x16')](0x194);}return _0x5ef8d0;};}function handleError(_0x2f7741,_0xdb14e1){_0xdb14e1=_0xdb14e1||0x1f4;return function(_0x3b10cd){logger[_0xc75d('0x23')](_0x3b10cd[_0xc75d('0x24')]);if(_0x3b10cd['name']){delete _0x3b10cd[_0xc75d('0x25')];}_0x2f7741[_0xc75d('0x1a')](_0xdb14e1)['send'](_0x3b10cd);};}exports['index']=function(_0x4b5c88,_0xd2b678){var _0x452c51={},_0x393694={},_0x2bf10e={'count':0x0,'rows':[]};var _0x6bee54=_['map'](db['CmHopperFinal'][_0xc75d('0x26')],function(_0x17f45b){return{'name':_0x17f45b['fieldName'],'type':_0x17f45b[_0xc75d('0x27')][_0xc75d('0x28')]};});_0x393694[_0xc75d('0x29')]=_[_0xc75d('0x2a')](_0x6bee54,'name');_0x393694[_0xc75d('0x2b')]=_[_0xc75d('0x2c')](_0x4b5c88[_0xc75d('0x2b')]);_0x393694['filters']=_['intersection'](_0x393694[_0xc75d('0x29')],_0x393694[_0xc75d('0x2b')]);_0x452c51['attributes']=_[_0xc75d('0x2d')](_0x393694[_0xc75d('0x29')],qs[_0xc75d('0x2e')](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x2e')]));_0x452c51[_0xc75d('0x2f')]=_0x452c51[_0xc75d('0x2f')][_0xc75d('0x30')]?_0x452c51[_0xc75d('0x2f')]:_0x393694[_0xc75d('0x29')];if(!_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x31')](_0xc75d('0x32'))){_0x452c51['limit']=qs[_0xc75d('0x19')](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x19')]);_0x452c51[_0xc75d('0x18')]=qs['offset'](_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x18')]);}_0x452c51[_0xc75d('0x33')]=qs['sort'](_0x4b5c88['query']['sort']);_0x452c51['where']=qs[_0xc75d('0x34')](_[_0xc75d('0x35')](_0x4b5c88['query'],_0x393694[_0xc75d('0x34')]),_0x6bee54);if(_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x36')]){_0x452c51[_0xc75d('0x37')]=_[_0xc75d('0x38')](_0x452c51[_0xc75d('0x37')],{'$or':_[_0xc75d('0x2a')](_0x6bee54,function(_0x3a2e54){if(_0x3a2e54[_0xc75d('0x27')]!==_0xc75d('0x39')){var _0x5de483={};_0x5de483[_0x3a2e54['name']]={'$like':'%'+_0x4b5c88[_0xc75d('0x2b')][_0xc75d('0x36')]+'%'};return _0x5de483;}})});}_0x452c51=_[_0xc75d('0x38')]({},_0x452c51,_0x4b5c88[_0xc75d('0x3a')]);var _0x339972={'where':_0x452c51['where']};return db[_0xc75d('0x3b')][_0xc75d('0x3c')](_0x339972)[_0xc75d('0x21')](function(_0x1e432a){_0x2bf10e[_0xc75d('0x3c')]=_0x1e432a;if(_0x4b5c88['query'][_0xc75d('0x3d')]){_0x452c51[_0xc75d('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x452c51);})[_0xc75d('0x21')](function(_0x38509b){_0x2bf10e[_0xc75d('0x3f')]=_0x38509b;return _0x2bf10e;})[_0xc75d('0x21')](respondWithFilteredResult(_0xd2b678,_0x452c51))[_0xc75d('0x40')](handleError(_0xd2b678,null));};exports[_0xc75d('0x41')]=function(_0x81af32,_0x499918){var _0x1a5698={'raw':!![],'where':{'id':_0x81af32['params']['id']}},_0x13a89b={};_0x13a89b['model']=_[_0xc75d('0x2c')](db[_0xc75d('0x3b')][_0xc75d('0x26')]);_0x13a89b['query']=_[_0xc75d('0x2c')](_0x81af32[_0xc75d('0x2b')]);_0x13a89b[_0xc75d('0x34')]=_[_0xc75d('0x2d')](_0x13a89b[_0xc75d('0x29')],_0x13a89b[_0xc75d('0x2b')]);_0x1a5698['attributes']=_['intersection'](_0x13a89b[_0xc75d('0x29')],qs[_0xc75d('0x2e')](_0x81af32[_0xc75d('0x2b')][_0xc75d('0x2e')]));_0x1a5698[_0xc75d('0x2f')]=_0x1a5698[_0xc75d('0x2f')][_0xc75d('0x30')]?_0x1a5698[_0xc75d('0x2f')]:_0x13a89b[_0xc75d('0x29')];if(_0x81af32[_0xc75d('0x2b')][_0xc75d('0x3d')]){_0x1a5698[_0xc75d('0x3e')]=[{'all':!![]}];}_0x1a5698=_[_0xc75d('0x38')]({},_0x1a5698,_0x81af32[_0xc75d('0x3a')]);return db[_0xc75d('0x3b')][_0xc75d('0x42')](_0x1a5698)[_0xc75d('0x21')](handleEntityNotFound(_0x499918,null))[_0xc75d('0x21')](respondWithResult(_0x499918,null))[_0xc75d('0x40')](handleError(_0x499918,null));};exports['describe']=function(_0x3c64f4,_0x24234d){return db[_0xc75d('0x3b')]['describe']()['then'](respondWithResult(_0x24234d,null))[_0xc75d('0x40')](handleError(_0x24234d,null));};exports['update']=function(_0x58f81d,_0x255225){if(_0x58f81d[_0xc75d('0x43')][_0xc75d('0x44')]){delete _0x58f81d[_0xc75d('0x43')]['uniqueid'];}return db[_0xc75d('0x3b')]['find']({'where':{'uniqueid':_0x58f81d[_0xc75d('0x45')]['id']}})[_0xc75d('0x21')](handleEntityNotFound(_0x255225,null))[_0xc75d('0x21')](saveUpdates(_0x58f81d[_0xc75d('0x43')],null))[_0xc75d('0x21')](respondWithResult(_0x255225,null))[_0xc75d('0x40')](handleError(_0x255225,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x59e694,_0x3e0b23,_0x35e9cd){return db['CmHopperFinal'][_0xc75d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x59e694['params']['id']},'attributes':[[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x49')))),'noSuchContacts'],[db[_0xc75d('0x47')]['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xc75d('0x4b')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x4c')))),_0xc75d('0x4d')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x4e')))),_0xc75d('0x4f')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc75d('0x50')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x51')))),_0xc75d('0x52')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xc75d('0x53')]]})[_0xc75d('0x21')](handleEntityNotFound(_0x3e0b23,null))[_0xc75d('0x21')](respondWithResult(_0x3e0b23,null))[_0xc75d('0x40')](handleError(_0x3e0b23,null));};exports[_0xc75d('0x54')]=function(_0x3e5b46,_0x4ebf7d,_0x304161){return db[_0xc75d('0x3b')][_0xc75d('0x46')]({'raw':![],'where':{'CampaignId':_0x3e5b46[_0xc75d('0x45')]['id']},'attributes':[[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x49')))),_0xc75d('0x55')],[db['sequelize']['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x56')))),_0xc75d('0x4b')],[db['sequelize']['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db[_0xc75d('0x47')]['literal'](_0xc75d('0x4c')))),'busyContacts'],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db[_0xc75d('0x47')][_0xc75d('0x4a')](_0xc75d('0x4e')))),_0xc75d('0x4f')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0xc75d('0x4a')](_0xc75d('0x57')))),_0xc75d('0x58')],[db[_0xc75d('0x47')]['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db['sequelize'][_0xc75d('0x4a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc75d('0x50')],[db['sequelize']['fn']('COUNT',db[_0xc75d('0x47')]['fn']('IF',db['sequelize'][_0xc75d('0x4a')]('`state`\x20=\x2022,\x201,\x20null'))),_0xc75d('0x52')],[db[_0xc75d('0x47')]['fn'](_0xc75d('0x48'),db[_0xc75d('0x47')]['fn']('IF',db['sequelize']['literal'](_0xc75d('0x59')))),'answeringMachine']]})[_0xc75d('0x21')](handleEntityNotFound(_0x4ebf7d,null))['then'](respondWithResult(_0x4ebf7d,null))[_0xc75d('0x40')](handleError(_0x4ebf7d,null));};exports[_0xc75d('0x5a')]=function(_0x270e54,_0x5934c6,_0x52abb8){return db['VoiceQueue'][_0xc75d('0x42')]({'where':{'id':_0x270e54[_0xc75d('0x45')]['id']}})[_0xc75d('0x21')](handleEntityNotFound(_0x5934c6,null))[_0xc75d('0x21')](function(_0x4c77d){var _0x349011;if(_0x4c77d){_0x349011=squel['insert']()[_0xc75d('0x5b')](_0xc75d('0x5c'))[_0xc75d('0x5d')]([_0xc75d('0x5e'),_0xc75d('0x5f'),'ContactId','ListId','VoiceQueueId','createdAt',_0xc75d('0x60')],squel[_0xc75d('0x61')]()[_0xc75d('0x62')](_0xc75d('0x63'),_0xc75d('0x5e'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x5f'))['field'](_0xc75d('0x65'),_0xc75d('0x66'))['field'](_0xc75d('0x67'),_0xc75d('0x68'))['field'](_0xc75d('0x69'),_0xc75d('0x6a'))['field'](_0xc75d('0x64'),_0xc75d('0x6b'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x60'))['from'](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x6f'),_0x270e54[_0xc75d('0x43')][_0xc75d('0x70')][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xc75d('0x62')](_0xc75d('0x5e'))['from']('cm_hopper')[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]()))['where'](_0xc75d('0x72'),squel[_0xc75d('0x61')]()['field'](_0xc75d('0x73'))[_0xc75d('0x74')](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x6d'),_0x270e54[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())['where']('state\x20=\x204'))[_0xc75d('0x75')]('ContactId'))[_0xc75d('0x6e')]();return db[_0xc75d('0x47')][_0xc75d('0x2b')](_0x349011);}return[];})[_0xc75d('0x21')](respondWithResult(_0x5934c6,null))[_0xc75d('0x40')](handleError(_0x5934c6,null));};exports[_0xc75d('0x76')]=function(_0x2f7175,_0x5b0407,_0x238ef0){return db[_0xc75d('0x77')][_0xc75d('0x42')]({'where':{'id':_0x2f7175['params']['id']}})['then'](handleEntityNotFound(_0x5b0407,null))[_0xc75d('0x21')](function(_0x4c171d){var _0xce67c2;if(_0x4c171d){_0xce67c2=squel[_0xc75d('0x78')]()[_0xc75d('0x5b')](_0xc75d('0x5c'))['fromQuery'](['phone','scheduledAt',_0xc75d('0x66'),_0xc75d('0x68'),_0xc75d('0x79'),'createdAt',_0xc75d('0x60')],squel[_0xc75d('0x61')]()[_0xc75d('0x62')]('ANY_VALUE(calleridnum)',_0xc75d('0x5e'))[_0xc75d('0x62')]('NOW()',_0xc75d('0x5f'))[_0xc75d('0x62')](_0xc75d('0x65'),_0xc75d('0x66'))[_0xc75d('0x62')](_0xc75d('0x67'),'ListId')[_0xc75d('0x62')](_0xc75d('0x7a'),_0xc75d('0x79'))[_0xc75d('0x62')](_0xc75d('0x64'),_0xc75d('0x6b'))['field'](_0xc75d('0x64'),'updatedAt')[_0xc75d('0x74')](_0xc75d('0x6c'))[_0xc75d('0x37')](_0xc75d('0x7b'),_0x2f7175[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x6f'),_0x2f7175[_0xc75d('0x43')][_0xc75d('0x70')][_0xc75d('0x6e')]())[_0xc75d('0x37')](_0xc75d('0x71'))[_0xc75d('0x37')](_0xc75d('0x72'),squel[_0xc75d('0x61')]()[_0xc75d('0x62')](_0xc75d('0x5e'))['from']('cm_hopper')[_0xc75d('0x37')]('CampaignId\x20=\x20?',_0x2f7175['params']['id']['toString']()))[_0xc75d('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xc75d('0x61')]()['field'](_0xc75d('0x73'))['from']('cm_hopper_final')['where'](_0xc75d('0x7b'),_0x2f7175[_0xc75d('0x45')]['id'][_0xc75d('0x6e')]())['where'](_0xc75d('0x7c')))['group'](_0xc75d('0x66')))['toString']();return db[_0xc75d('0x47')]['query'](_0xce67c2);}return[];})[_0xc75d('0x21')](respondWithResult(_0x5b0407,null))['catch'](handleError(_0x5b0407,null));};exports[_0xc75d('0x7d')]=function(_0x4f8c86,_0x121f22,_0x3a831a){return db[_0xc75d('0x7e')][_0xc75d('0x7f')]({'where':{'VoiceQueueId':_0x4f8c86[_0xc75d('0x43')][_0xc75d('0x6a')],'CampaignId':_0x4f8c86[_0xc75d('0x43')][_0xc75d('0x79')],'ContactId':_0x4f8c86[_0xc75d('0x43')]['ContactId']}})[_0xc75d('0x21')](handleEntityNotFound(_0x121f22,null))['then'](function(_0x2c4dc5){if(_0x2c4dc5){return _0x2c4dc5;}return null;})['then'](respondWithResult(_0x121f22,null))[_0xc75d('0x40')](handleError(_0x121f22,null));}; \ No newline at end of file +var _0x33af=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','phone','scheduledAt','ContactId','createdAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','VoiceQueueId','NOW()','updatedAt','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','cm_hopper_final','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x2eff0e,_0x2c8360){var _0x3acb0f=function(_0x288d46){while(--_0x288d46){_0x2eff0e['push'](_0x2eff0e['shift']());}};_0x3acb0f(++_0x2c8360);}(_0x33af,0xec));var _0xf33a=function(_0x221fbe,_0x16bc47){_0x221fbe=_0x221fbe-0x0;var _0x51c3eb=_0x33af[_0x221fbe];return _0x51c3eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf33a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf33a('0x1'));var jsonpatch=require(_0xf33a('0x2'));var rp=require(_0xf33a('0x3'));var moment=require(_0xf33a('0x4'));var BPromise=require(_0xf33a('0x5'));var Mustache=require(_0xf33a('0x6'));var util=require('util');var path=require(_0xf33a('0x7'));var sox=require(_0xf33a('0x8'));var csv=require('to-csv');var ejs=require(_0xf33a('0x9'));var fs=require('fs');var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var db=require(_0xf33a('0x18'))['db'];function respondWithStatusCode(_0x338d1b,_0x5959c9){_0x5959c9=_0x5959c9||0xcc;return function(_0x9f87bc){if(_0x9f87bc){return _0x338d1b[_0xf33a('0x19')](_0x5959c9);}return _0x338d1b['status'](_0x5959c9)['end']();};}function respondWithResult(_0x374b01,_0x1b3bf0){_0x1b3bf0=_0x1b3bf0||0xc8;return function(_0x17043){if(_0x17043){return _0x374b01[_0xf33a('0x1a')](_0x1b3bf0)[_0xf33a('0x1b')](_0x17043);}};}function respondWithFilteredResult(_0xc01217,_0x45e311){return function(_0x1f2b1b){if(_0x1f2b1b){var _0x507cb9=_0x1f2b1b[_0xf33a('0x1c')],_0x441f59=_0x45e311['offset'],_0x5b5f27=_0x45e311[_0xf33a('0x1d')]+_0x45e311[_0xf33a('0x1e')],_0x75848d;if(_0x5b5f27>=_0x507cb9){_0x5b5f27=_0x507cb9;_0x75848d=0xc8;}else{_0x75848d=0xce;}_0xc01217['status'](_0x75848d);return _0xc01217[_0xf33a('0x1f')](_0xf33a('0x20'),_0x441f59+'-'+_0x5b5f27+'/'+_0x507cb9)[_0xf33a('0x1b')](_0x1f2b1b);}return null;};}function patchUpdates(_0x2a9f0e){return function(_0x532502){try{jsonpatch[_0xf33a('0x21')](_0x532502,_0x2a9f0e,!![]);}catch(_0x366bda){return BPromise[_0xf33a('0x22')](_0x366bda);}return _0x532502[_0xf33a('0x23')]();};}function saveUpdates(_0x412727,_0x6cdf7b){return function(_0x19986f){if(_0x19986f){return _0x19986f[_0xf33a('0x24')](_0x412727)[_0xf33a('0x25')](function(_0x3cf525){return _0x3cf525;});}return null;};}function removeEntity(_0x520dc4,_0x3854b4){return function(_0x272e60){if(_0x272e60){return _0x272e60[_0xf33a('0x26')]()[_0xf33a('0x25')](function(){_0x520dc4[_0xf33a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44654c,_0x5882ba){return function(_0x492986){if(!_0x492986){_0x44654c[_0xf33a('0x19')](0x194);}return _0x492986;};}function handleError(_0x394468,_0x17b12d){_0x17b12d=_0x17b12d||0x1f4;return function(_0x429b83){logger['error'](_0x429b83[_0xf33a('0x27')]);if(_0x429b83[_0xf33a('0x28')]){delete _0x429b83['name'];}_0x394468['status'](_0x17b12d)[_0xf33a('0x29')](_0x429b83);};}exports['index']=function(_0x5cf981,_0x38eba2){var _0x4f60a4={},_0x79d653={},_0x553480={'count':0x0,'rows':[]};var _0x331115=_[_0xf33a('0x2a')](db[_0xf33a('0x2b')][_0xf33a('0x2c')],function(_0x4552c9){return{'name':_0x4552c9[_0xf33a('0x2d')],'type':_0x4552c9[_0xf33a('0x2e')][_0xf33a('0x2f')]};});_0x79d653[_0xf33a('0x30')]=_[_0xf33a('0x2a')](_0x331115,_0xf33a('0x28'));_0x79d653[_0xf33a('0x31')]=_[_0xf33a('0x32')](_0x5cf981[_0xf33a('0x31')]);_0x79d653[_0xf33a('0x33')]=_['intersection'](_0x79d653[_0xf33a('0x30')],_0x79d653[_0xf33a('0x31')]);_0x4f60a4[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x79d653['model'],qs[_0xf33a('0x36')](_0x5cf981[_0xf33a('0x31')][_0xf33a('0x36')]));_0x4f60a4[_0xf33a('0x34')]=_0x4f60a4[_0xf33a('0x34')][_0xf33a('0x37')]?_0x4f60a4['attributes']:_0x79d653[_0xf33a('0x30')];if(!_0x5cf981[_0xf33a('0x31')][_0xf33a('0x38')](_0xf33a('0x39'))){_0x4f60a4[_0xf33a('0x1e')]=qs['limit'](_0x5cf981['query'][_0xf33a('0x1e')]);_0x4f60a4['offset']=qs['offset'](_0x5cf981['query'][_0xf33a('0x1d')]);}_0x4f60a4[_0xf33a('0x3a')]=qs['sort'](_0x5cf981[_0xf33a('0x31')]['sort']);_0x4f60a4[_0xf33a('0x3b')]=qs[_0xf33a('0x33')](_[_0xf33a('0x3c')](_0x5cf981[_0xf33a('0x31')],_0x79d653[_0xf33a('0x33')]),_0x331115);if(_0x5cf981[_0xf33a('0x31')]['filter']){_0x4f60a4[_0xf33a('0x3b')]=_[_0xf33a('0x3d')](_0x4f60a4['where'],{'$or':_[_0xf33a('0x2a')](_0x331115,function(_0x3793b4){if(_0x3793b4[_0xf33a('0x2e')]!=='VIRTUAL'){var _0x7a06e1={};_0x7a06e1[_0x3793b4[_0xf33a('0x28')]]={'$like':'%'+_0x5cf981[_0xf33a('0x31')][_0xf33a('0x3e')]+'%'};return _0x7a06e1;}})});}_0x4f60a4=_[_0xf33a('0x3d')]({},_0x4f60a4,_0x5cf981[_0xf33a('0x3f')]);var _0x1b4d59={'where':_0x4f60a4[_0xf33a('0x3b')]};return db[_0xf33a('0x2b')]['count'](_0x1b4d59)[_0xf33a('0x25')](function(_0x3e80b6){_0x553480['count']=_0x3e80b6;if(_0x5cf981[_0xf33a('0x31')]['includeAll']){_0x4f60a4['include']=[{'all':!![]}];}return db[_0xf33a('0x2b')][_0xf33a('0x40')](_0x4f60a4);})['then'](function(_0x1db810){_0x553480[_0xf33a('0x41')]=_0x1db810;return _0x553480;})[_0xf33a('0x25')](respondWithFilteredResult(_0x38eba2,_0x4f60a4))['catch'](handleError(_0x38eba2,null));};exports[_0xf33a('0x42')]=function(_0x21b8da,_0x5a1acb){var _0x1e9748={'raw':!![],'where':{'id':_0x21b8da[_0xf33a('0x43')]['id']}},_0x20e57b={};_0x20e57b[_0xf33a('0x30')]=_[_0xf33a('0x32')](db['CmHopperFinal'][_0xf33a('0x2c')]);_0x20e57b[_0xf33a('0x31')]=_[_0xf33a('0x32')](_0x21b8da[_0xf33a('0x31')]);_0x20e57b[_0xf33a('0x33')]=_['intersection'](_0x20e57b[_0xf33a('0x30')],_0x20e57b[_0xf33a('0x31')]);_0x1e9748[_0xf33a('0x34')]=_['intersection'](_0x20e57b[_0xf33a('0x30')],qs[_0xf33a('0x36')](_0x21b8da[_0xf33a('0x31')][_0xf33a('0x36')]));_0x1e9748[_0xf33a('0x34')]=_0x1e9748[_0xf33a('0x34')]['length']?_0x1e9748[_0xf33a('0x34')]:_0x20e57b[_0xf33a('0x30')];if(_0x21b8da[_0xf33a('0x31')][_0xf33a('0x44')]){_0x1e9748[_0xf33a('0x45')]=[{'all':!![]}];}_0x1e9748=_['merge']({},_0x1e9748,_0x21b8da[_0xf33a('0x3f')]);return db[_0xf33a('0x2b')][_0xf33a('0x46')](_0x1e9748)['then'](handleEntityNotFound(_0x5a1acb,null))[_0xf33a('0x25')](respondWithResult(_0x5a1acb,null))[_0xf33a('0x47')](handleError(_0x5a1acb,null));};exports['describe']=function(_0x4c0f24,_0x3cb451){return db['CmHopperFinal'][_0xf33a('0x48')]()[_0xf33a('0x25')](respondWithResult(_0x3cb451,null))[_0xf33a('0x47')](handleError(_0x3cb451,null));};exports[_0xf33a('0x24')]=function(_0xecc82f,_0x1a98f9){if(_0xecc82f[_0xf33a('0x49')][_0xf33a('0x4a')]){delete _0xecc82f[_0xf33a('0x49')][_0xf33a('0x4a')];}return db[_0xf33a('0x2b')][_0xf33a('0x46')]({'where':{'uniqueid':_0xecc82f[_0xf33a('0x43')]['id']}})[_0xf33a('0x25')](handleEntityNotFound(_0x1a98f9,null))[_0xf33a('0x25')](saveUpdates(_0xecc82f[_0xf33a('0x49')],null))[_0xf33a('0x25')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x47')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x4b')]=function(_0x43e1f5,_0xc0f0d3,_0x3ddcdc){return db[_0xf33a('0x2b')][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x43e1f5[_0xf33a('0x43')]['id']},'attributes':[[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db['sequelize']['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')]['literal'](_0xf33a('0x50')))),_0xf33a('0x51')],[db[_0xf33a('0x4c')]['fn']('COUNT',db[_0xf33a('0x4c')]['fn']('IF',db['sequelize'][_0xf33a('0x52')](_0xf33a('0x53')))),'busyContacts'],[db['sequelize']['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')]['literal'](_0xf33a('0x54')))),_0xf33a('0x55')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xf33a('0x56')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x57')))),'abandonedContacts'],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0xf33a('0x4d'),db['sequelize']['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x58')))),_0xf33a('0x59')]]})[_0xf33a('0x25')](handleEntityNotFound(_0xc0f0d3,null))[_0xf33a('0x25')](respondWithResult(_0xc0f0d3,null))['catch'](handleError(_0xc0f0d3,null));};exports[_0xf33a('0x5a')]=function(_0xffd172,_0x176dee,_0x4e48d6){return db[_0xf33a('0x2b')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0xffd172[_0xf33a('0x43')]['id']},'attributes':[[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xf33a('0x51')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x53')))),_0xf33a('0x5b')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db['sequelize'][_0xf33a('0x52')](_0xf33a('0x54')))),_0xf33a('0x55')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x5c')))),'dropContacts'],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db['sequelize']['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x57')))),_0xf33a('0x5d')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db['sequelize']['fn']('IF',db[_0xf33a('0x4c')][_0xf33a('0x52')](_0xf33a('0x5e')))),_0xf33a('0x5f')],[db[_0xf33a('0x4c')]['fn'](_0xf33a('0x4d'),db[_0xf33a('0x4c')]['fn']('IF',db['sequelize'][_0xf33a('0x52')](_0xf33a('0x58')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x176dee,null))['then'](respondWithResult(_0x176dee,null))[_0xf33a('0x47')](handleError(_0x176dee,null));};exports[_0xf33a('0x60')]=function(_0xe23c77,_0xc328ab,_0x2a9995){return db[_0xf33a('0x61')][_0xf33a('0x46')]({'where':{'id':_0xe23c77[_0xf33a('0x43')]['id']}})[_0xf33a('0x25')](handleEntityNotFound(_0xc328ab,null))[_0xf33a('0x25')](function(_0x40bb02){var _0x10a271;if(_0x40bb02){_0x10a271=squel['insert']()[_0xf33a('0x62')]('cm_hopper')['fromQuery']([_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),'ListId','VoiceQueueId',_0xf33a('0x66'),'updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x63'))[_0xf33a('0x68')]('NOW()','scheduledAt')[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x65'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x6b'))[_0xf33a('0x68')]('ANY_VALUE(VoiceQueueId)',_0xf33a('0x6c'))[_0xf33a('0x68')](_0xf33a('0x6d'),'createdAt')[_0xf33a('0x68')](_0xf33a('0x6d'),_0xf33a('0x6e'))[_0xf33a('0x6f')]('cm_hopper_final')[_0xf33a('0x3b')](_0xf33a('0x70'),_0xe23c77[_0xf33a('0x43')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x71'),_0xe23c77[_0xf33a('0x49')][_0xf33a('0x72')][_0xf33a('0x73')]())[_0xf33a('0x3b')](_0xf33a('0x74'))[_0xf33a('0x3b')](_0xf33a('0x75'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x63'))[_0xf33a('0x6f')](_0xf33a('0x76'))[_0xf33a('0x3b')]('VoiceQueueId\x20=\x20?',_0xe23c77[_0xf33a('0x43')]['id'][_0xf33a('0x73')]()))[_0xf33a('0x3b')](_0xf33a('0x75'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))[_0xf33a('0x6f')](_0xf33a('0x78'))[_0xf33a('0x3b')](_0xf33a('0x70'),_0xe23c77[_0xf33a('0x43')]['id'][_0xf33a('0x73')]())[_0xf33a('0x3b')]('state\x20=\x204'))[_0xf33a('0x79')](_0xf33a('0x65')))[_0xf33a('0x73')]();return db[_0xf33a('0x4c')]['query'](_0x10a271);}return[];})[_0xf33a('0x25')](respondWithResult(_0xc328ab,null))[_0xf33a('0x47')](handleError(_0xc328ab,null));};exports[_0xf33a('0x7a')]=function(_0xfd113f,_0x3570bf,_0x38eecc){return db[_0xf33a('0x7b')][_0xf33a('0x46')]({'where':{'id':_0xfd113f['params']['id']}})[_0xf33a('0x25')](handleEntityNotFound(_0x3570bf,null))[_0xf33a('0x25')](function(_0x9c0b99){var _0x17b2fa;if(_0x9c0b99){_0x17b2fa=squel['insert']()['into'](_0xf33a('0x76'))['fromQuery']([_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x6b'),'CampaignId','createdAt',_0xf33a('0x6e')],squel['select']()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6d'),_0xf33a('0x64'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x7c'),_0xf33a('0x6b'))[_0xf33a('0x68')](_0xf33a('0x7d'),_0xf33a('0x7e'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x66'))['field'](_0xf33a('0x6d'),'updatedAt')['from']('cm_hopper_final')[_0xf33a('0x3b')](_0xf33a('0x7f'),_0xfd113f['params']['id'][_0xf33a('0x73')]())[_0xf33a('0x3b')](_0xf33a('0x71'),_0xfd113f[_0xf33a('0x49')][_0xf33a('0x72')][_0xf33a('0x73')]())['where'](_0xf33a('0x74'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x63'))['from'](_0xf33a('0x76'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0xfd113f[_0xf33a('0x43')]['id'][_0xf33a('0x73')]()))['where'](_0xf33a('0x75'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))[_0xf33a('0x6f')]('cm_hopper_final')[_0xf33a('0x3b')](_0xf33a('0x7f'),_0xfd113f[_0xf33a('0x43')]['id'][_0xf33a('0x73')]())[_0xf33a('0x3b')]('state\x20=\x204'))[_0xf33a('0x79')]('ContactId'))['toString']();return db[_0xf33a('0x4c')]['query'](_0x17b2fa);}return[];})[_0xf33a('0x25')](respondWithResult(_0x3570bf,null))[_0xf33a('0x47')](handleError(_0x3570bf,null));};exports['checkContactHopper']=function(_0x48e97,_0x13ad7d,_0x4740f6){return db[_0xf33a('0x80')][_0xf33a('0x81')]({'where':{'VoiceQueueId':_0x48e97[_0xf33a('0x49')][_0xf33a('0x6c')],'CampaignId':_0x48e97['body'][_0xf33a('0x7e')],'ContactId':_0x48e97[_0xf33a('0x49')][_0xf33a('0x65')]}})[_0xf33a('0x25')](handleEntityNotFound(_0x13ad7d,null))['then'](function(_0x2be895){if(_0x2be895){return _0x2be895;}return null;})['then'](respondWithResult(_0x13ad7d,null))[_0xf33a('0x47')](handleError(_0x13ad7d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 42efad6..c78e108 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 _0x80d9=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','cm_hopper_final','calleridnum','uniqueid'];(function(_0x4c6fc5,_0x959960){var _0x41744a=function(_0x3e407c){while(--_0x3e407c){_0x4c6fc5['push'](_0x4c6fc5['shift']());}};_0x41744a(++_0x959960);}(_0x80d9,0x15c));var _0x980d=function(_0x5d8788,_0x1e66f8){_0x5d8788=_0x5d8788-0x0;var _0x45c275=_0x80d9[_0x5d8788];return _0x45c275;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('CmHopperFinal',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[{'name':_0x980d('0xa'),'fields':[_0x980d('0xa')]},{'name':_0x980d('0xb'),'fields':[_0x980d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x130d=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1909f9,_0x1795ef){var _0x4fc488=function(_0x4fb79a){while(--_0x4fb79a){_0x1909f9['push'](_0x1909f9['shift']());}};_0x4fc488(++_0x1795ef);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[{'name':_0xd130('0xd'),'fields':['calleridnum']},{'name':_0xd130('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 36e5e13..2515530 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 _0xae1c=['stringify','code','error','message','info','result','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc594ba,_0x3e7bc6){var _0xd596e2=function(_0x1a7c7b){while(--_0x1a7c7b){_0xc594ba['push'](_0xc594ba['shift']());}};_0xd596e2(++_0x3e7bc6);}(_0xae1c,0xff));var _0xcae1=function(_0x22df14,_0x5bd7ea){_0x22df14=_0x22df14-0x0;var _0x52977b=_0xae1c[_0x22df14];return _0x52977b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcae1('0x0'));var fs=require('fs');var Redis=require(_0xcae1('0x1'));var db=require(_0xcae1('0x2'))['db'];var utils=require(_0xcae1('0x3'));var logger=require(_0xcae1('0x4'))(_0xcae1('0x5'));var config=require(_0xcae1('0x6'));var jayson=require(_0xcae1('0x7'));var client=jayson[_0xcae1('0x8')][_0xcae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c35c7,_0x38099e,_0x7a27b8){return new BPromise(function(_0x50d451,_0x4e419d){return client[_0xcae1('0xa')](_0x3c35c7,_0x7a27b8)[_0xcae1('0xb')](function(_0x3284aa){logger['info'](_0xcae1('0xc'),_0x38099e,_0xcae1('0xd'));logger[_0xcae1('0xe')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x38099e,_0xcae1('0xd'),JSON[_0xcae1('0xf')](_0x3284aa));if(_0x3284aa['error']){if(_0x3284aa['error'][_0xcae1('0x10')]===0x1f4){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x4e419d(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x50d451(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}else{logger[_0xcae1('0x13')](_0xcae1('0xc'),_0x38099e,'request\x20sent');_0x50d451(_0x3284aa[_0xcae1('0x14')][_0xcae1('0x12')]);}})['catch'](function(_0x4a7ef7){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x4a7ef7);_0x4e419d(_0x4a7ef7);});});}exports['CreateCmHopperFinal']=function(_0x5f18d5){var _0x73b7d=this;return new Promise(function(_0x4dcd4b,_0x15eac8){return db[_0xcae1('0x15')][_0xcae1('0x16')](_0x5f18d5[_0xcae1('0x17')],{'raw':_0x5f18d5[_0xcae1('0x18')]?_0x5f18d5[_0xcae1('0x18')][_0xcae1('0x19')]===undefined?!![]:![]:!![]})[_0xcae1('0xb')](function(_0x11fda8){logger[_0xcae1('0x13')](_0xcae1('0x1a'),_0x5f18d5);logger[_0xcae1('0xe')](_0xcae1('0x1a'),_0x5f18d5,JSON[_0xcae1('0xf')](_0x11fda8));_0x4dcd4b(_0x11fda8);})['catch'](function(_0x1f8beb){logger[_0xcae1('0x11')](_0xcae1('0x1a'),_0x1f8beb[_0xcae1('0x12')],_0x5f18d5);_0x15eac8(_0x73b7d['error'](0x1f4,_0x1f8beb[_0xcae1('0x12')]));});});}; \ No newline at end of file +var _0x2411=['stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','CreateCmHopperFinal','create','body','options','raw','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1bb4fe,_0x511630){var _0x473796=function(_0x1bf787){while(--_0x1bf787){_0x1bb4fe['push'](_0x1bb4fe['shift']());}};_0x473796(++_0x511630);}(_0x2411,0x175));var _0x1241=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x2411[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require('lodash');var util=require(_0x1241('0x0'));var moment=require(_0x1241('0x1'));var BPromise=require(_0x1241('0x2'));var rs=require(_0x1241('0x3'));var fs=require('fs');var Redis=require(_0x1241('0x4'));var db=require(_0x1241('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1241('0x6'))(_0x1241('0x7'));var config=require(_0x1241('0x8'));var jayson=require(_0x1241('0x9'));var client=jayson[_0x1241('0xa')][_0x1241('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x358ebb,_0x5a094a,_0x309200){return new BPromise(function(_0x136400,_0xd75ec4){return client[_0x1241('0xc')](_0x358ebb,_0x309200)[_0x1241('0xd')](function(_0x37488e){logger[_0x1241('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x5a094a,'request\x20sent');logger['debug'](_0x1241('0xf'),_0x5a094a,_0x1241('0x10'),JSON[_0x1241('0x11')](_0x37488e));if(_0x37488e['error']){if(_0x37488e[_0x1241('0x12')][_0x1241('0x13')]===0x1f4){logger[_0x1241('0x12')](_0x1241('0x14'),_0x5a094a,_0x37488e[_0x1241('0x12')][_0x1241('0x15')]);return _0xd75ec4(_0x37488e[_0x1241('0x12')][_0x1241('0x15')]);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x5a094a,_0x37488e[_0x1241('0x12')][_0x1241('0x15')]);return _0x136400(_0x37488e[_0x1241('0x12')][_0x1241('0x15')]);}else{logger['info'](_0x1241('0x14'),_0x5a094a,_0x1241('0x10'));_0x136400(_0x37488e[_0x1241('0x16')][_0x1241('0x15')]);}})['catch'](function(_0x275012){logger[_0x1241('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x5a094a,_0x275012);_0xd75ec4(_0x275012);});});}exports[_0x1241('0x17')]=function(_0x1f6d4d){var _0xaf1376=this;return new Promise(function(_0x3f3464,_0x204ddc){return db['CmHopperFinal'][_0x1241('0x18')](_0x1f6d4d[_0x1241('0x19')],{'raw':_0x1f6d4d[_0x1241('0x1a')]?_0x1f6d4d[_0x1241('0x1a')][_0x1241('0x1b')]===undefined?!![]:![]:!![]})[_0x1241('0xd')](function(_0x1146b4){logger[_0x1241('0xe')]('CreateCmHopperFinal',_0x1f6d4d);logger[_0x1241('0x1c')](_0x1241('0x17'),_0x1f6d4d,JSON['stringify'](_0x1146b4));_0x3f3464(_0x1146b4);})[_0x1241('0x1d')](function(_0x277470){logger[_0x1241('0x12')]('CreateCmHopperFinal',_0x277470['message'],_0x1f6d4d);_0x204ddc(_0xaf1376[_0x1241('0x12')](0x1f4,_0x277470[_0x1241('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a139166..d2a5637 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 _0x22ec=['/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','checkContactHopper','put','update','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0xddafcc,_0x5e601f){var _0x511cb1=function(_0x58d3ad){while(--_0x58d3ad){_0xddafcc['push'](_0xddafcc['shift']());}};_0x511cb1(++_0x5e601f);}(_0x22ec,0x1ee));var _0xc22e=function(_0xc0dc76,_0x11956c){_0xc0dc76=_0xc0dc76-0x0;var _0x445af1=_0x22ec[_0xc0dc76];return _0x445af1;};'use strict';var multer=require('multer');var util=require(_0xc22e('0x0'));var path=require(_0xc22e('0x1'));var timeout=require('connect-timeout');var express=require(_0xc22e('0x2'));var router=express[_0xc22e('0x3')]();var auth=require(_0xc22e('0x4'));var interaction=require(_0xc22e('0x5'));var config=require(_0xc22e('0x6'));var controller=require(_0xc22e('0x7'));router[_0xc22e('0x8')]('/',auth[_0xc22e('0x9')](),controller['index']);router['get'](_0xc22e('0xa'),auth[_0xc22e('0x9')](),controller[_0xc22e('0xb')]);router['get'](_0xc22e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc22e('0x8')](_0xc22e('0xd'),auth[_0xc22e('0x9')](),controller[_0xc22e('0xe')]);router['get'](_0xc22e('0xf'),auth[_0xc22e('0x9')](),controller[_0xc22e('0x10')]);router['post'](_0xc22e('0x11'),auth[_0xc22e('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0xc22e('0x12'),auth[_0xc22e('0x9')](),controller[_0xc22e('0x13')]);router[_0xc22e('0x14')]('/checkContactHopper',auth[_0xc22e('0x9')](),controller[_0xc22e('0x15')]);router[_0xc22e('0x16')]('/:id',auth[_0xc22e('0x9')](),controller[_0xc22e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x9dba=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','exports','multer','util','path','connect-timeout','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9dba,0x12f));var _0xa9db=function(_0x52cd35,_0x585702){_0x52cd35=_0x52cd35-0x0;var _0x3f724d=_0x9dba[_0x52cd35];return _0x3f724d;};'use strict';var multer=require(_0xa9db('0x0'));var util=require(_0xa9db('0x1'));var path=require(_0xa9db('0x2'));var timeout=require(_0xa9db('0x3'));var express=require('express');var router=express[_0xa9db('0x4')]();var auth=require(_0xa9db('0x5'));var interaction=require(_0xa9db('0x6'));var config=require(_0xa9db('0x7'));var controller=require('./cmHopperFinal.controller');router[_0xa9db('0x8')]('/',auth[_0xa9db('0x9')](),controller[_0xa9db('0xa')]);router['get'](_0xa9db('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa9db('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xa9db('0x8')](_0xa9db('0xc'),auth[_0xa9db('0x9')](),controller[_0xa9db('0xd')]);router['post'](_0xa9db('0xe'),auth[_0xa9db('0x9')](),controller[_0xa9db('0xf')]);router[_0xa9db('0x10')](_0xa9db('0x11'),auth['isAuthenticated'](),controller[_0xa9db('0x12')]);router[_0xa9db('0x10')](_0xa9db('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xa9db('0x14')]('/:id',auth[_0xa9db('0x9')](),controller['update']);module[_0xa9db('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e78d96b..70e7676 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 _0x8d3f=['STRING','DATE','INTEGER','BOOLEAN','exports'];(function(_0x595768,_0x90cee2){var _0x26c217=function(_0x35d477){while(--_0x35d477){_0x595768['push'](_0x595768['shift']());}};_0x26c217(++_0x90cee2);}(_0x8d3f,0x1c6));var _0xf8d3=function(_0x2068b1,_0x4c4fd9){_0x2068b1=_0x2068b1-0x0;var _0x266164=_0x8d3f[_0x2068b1];return _0x266164;};'use strict';var Sequelize=require('sequelize');module[_0xf8d3('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf8d3('0x1')]},'scheduledat':{'type':Sequelize[_0xf8d3('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf8d3('0x1')]},'originatecalleridname':{'type':Sequelize[_0xf8d3('0x1')]},'calleridnum':{'type':Sequelize[_0xf8d3('0x1')]},'calleridname':{'type':Sequelize[_0xf8d3('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf8d3('0x2')]},'answertime':{'type':Sequelize[_0xf8d3('0x2')]},'droptime':{'type':Sequelize[_0xf8d3('0x2')]},'endtime':{'type':Sequelize[_0xf8d3('0x2')]},'ringtime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf8d3('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf8d3('0x1')]},'membername':{'type':Sequelize[_0xf8d3('0x1')]},'reason':{'type':Sequelize[_0xf8d3('0x1')]},'amd':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf8d3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf8d3('0x2')]},'recallme':{'type':Sequelize[_0xf8d3('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf8d3('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf8d3('0x1')]}}; \ No newline at end of file +var _0xbf07=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0xc6a797,_0x471d57){var _0x57f558=function(_0x4d9473){while(--_0x4d9473){_0xc6a797['push'](_0xc6a797['shift']());}};_0x57f558(++_0x471d57);}(_0xbf07,0xea));var _0x7bf0=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0xbf07[_0x47cfa0];return _0x386b1d;};'use strict';var Sequelize=require(_0x7bf0('0x0'));module[_0x7bf0('0x1')]={'state':{'type':Sequelize[_0x7bf0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7bf0('0x3')]},'scheduledat':{'type':Sequelize[_0x7bf0('0x4')]},'countbusyretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7bf0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7bf0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7bf0('0x3')]},'calleridnum':{'type':Sequelize[_0x7bf0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7bf0('0x4')]},'responsetime':{'type':Sequelize[_0x7bf0('0x4')]},'answertime':{'type':Sequelize[_0x7bf0('0x4')]},'droptime':{'type':Sequelize[_0x7bf0('0x4')]},'endtime':{'type':Sequelize[_0x7bf0('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7bf0('0x3')]},'campaign':{'type':Sequelize[_0x7bf0('0x3')]},'campaigntype':{'type':Sequelize[_0x7bf0('0x3')]},'membername':{'type':Sequelize[_0x7bf0('0x3')]},'reason':{'type':Sequelize[_0x7bf0('0x3')]},'amd':{'type':Sequelize[_0x7bf0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7bf0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7bf0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7bf0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x7bf0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7bf0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7bf0('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 98a53f0..99c1d5d 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 _0xbd8a=['set','apply','reject','save','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','pick','merge','options','CmHopperHistory','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset'];(function(_0x59cb86,_0x493f63){var _0x515d2a=function(_0x4208d3){while(--_0x4208d3){_0x59cb86['push'](_0x59cb86['shift']());}};_0x515d2a(++_0x493f63);}(_0xbd8a,0xb5));var _0xabd8=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0xbd8a[_0x59e7e0];return _0x26b058;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xabd8('0x0'));var zipdir=require(_0xabd8('0x1'));var jsonpatch=require(_0xabd8('0x2'));var rp=require('request-promise');var moment=require(_0xabd8('0x3'));var BPromise=require(_0xabd8('0x4'));var Mustache=require(_0xabd8('0x5'));var util=require(_0xabd8('0x6'));var path=require(_0xabd8('0x7'));var sox=require('sox');var csv=require(_0xabd8('0x8'));var ejs=require(_0xabd8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xabd8('0xa'));var crypto=require(_0xabd8('0xb'));var jsforce=require(_0xabd8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xabd8('0x8'));var querystring=require(_0xabd8('0xd'));var Papa=require(_0xabd8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabd8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabd8('0x10'));var logger=require(_0xabd8('0x11'))(_0xabd8('0x12'));var utils=require(_0xabd8('0x13'));var config=require(_0xabd8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40d0b9,_0x50e17c){_0x50e17c=_0x50e17c||0xcc;return function(_0x39adce){if(_0x39adce){return _0x40d0b9[_0xabd8('0x15')](_0x50e17c);}return _0x40d0b9['status'](_0x50e17c)[_0xabd8('0x16')]();};}function respondWithResult(_0x1b3bc6,_0x21b84c){_0x21b84c=_0x21b84c||0xc8;return function(_0x251147){if(_0x251147){return _0x1b3bc6[_0xabd8('0x17')](_0x21b84c)[_0xabd8('0x18')](_0x251147);}};}function respondWithFilteredResult(_0x50c7b5,_0x1830b9){return function(_0x5be710){if(_0x5be710){var _0x2afe22=_0x5be710['count'],_0x332952=_0x1830b9[_0xabd8('0x19')],_0x4f4454=_0x1830b9[_0xabd8('0x19')]+_0x1830b9['limit'],_0x181df2;if(_0x4f4454>=_0x2afe22){_0x4f4454=_0x2afe22;_0x181df2=0xc8;}else{_0x181df2=0xce;}_0x50c7b5[_0xabd8('0x17')](_0x181df2);return _0x50c7b5[_0xabd8('0x1a')]('Content-Range',_0x332952+'-'+_0x4f4454+'/'+_0x2afe22)[_0xabd8('0x18')](_0x5be710);}return null;};}function patchUpdates(_0xc6c779){return function(_0x3f685b){try{jsonpatch[_0xabd8('0x1b')](_0x3f685b,_0xc6c779,!![]);}catch(_0xe8589a){return BPromise[_0xabd8('0x1c')](_0xe8589a);}return _0x3f685b[_0xabd8('0x1d')]();};}function saveUpdates(_0x4aed91,_0x8a6ff6){return function(_0x1c6cc6){if(_0x1c6cc6){return _0x1c6cc6['update'](_0x4aed91)[_0xabd8('0x1e')](function(_0x38c725){return _0x38c725;});}return null;};}function removeEntity(_0x996a70,_0xe5c20a){return function(_0x235599){if(_0x235599){return _0x235599[_0xabd8('0x1f')]()['then'](function(){_0x996a70[_0xabd8('0x17')](0xcc)[_0xabd8('0x16')]();});}};}function handleEntityNotFound(_0x5db64c,_0x17aee7){return function(_0xf8bc1c){if(!_0xf8bc1c){_0x5db64c[_0xabd8('0x15')](0x194);}return _0xf8bc1c;};}function handleError(_0x202050,_0x279005){_0x279005=_0x279005||0x1f4;return function(_0x2636fe){logger[_0xabd8('0x20')](_0x2636fe[_0xabd8('0x21')]);if(_0x2636fe[_0xabd8('0x22')]){delete _0x2636fe[_0xabd8('0x22')];}_0x202050[_0xabd8('0x17')](_0x279005)['send'](_0x2636fe);};}exports[_0xabd8('0x23')]=function(_0x5a513e,_0x1f9a9){var _0x39c88c={},_0x17134b={},_0x51aff3={'count':0x0,'rows':[]};var _0x9c640a=_[_0xabd8('0x24')](db['CmHopperHistory']['rawAttributes'],function(_0x3e0f23){return{'name':_0x3e0f23[_0xabd8('0x25')],'type':_0x3e0f23[_0xabd8('0x26')][_0xabd8('0x27')]};});_0x17134b[_0xabd8('0x28')]=_[_0xabd8('0x24')](_0x9c640a,_0xabd8('0x22'));_0x17134b[_0xabd8('0x29')]=_[_0xabd8('0x2a')](_0x5a513e[_0xabd8('0x29')]);_0x17134b['filters']=_['intersection'](_0x17134b[_0xabd8('0x28')],_0x17134b[_0xabd8('0x29')]);_0x39c88c[_0xabd8('0x2b')]=_[_0xabd8('0x2c')](_0x17134b[_0xabd8('0x28')],qs[_0xabd8('0x2d')](_0x5a513e[_0xabd8('0x29')][_0xabd8('0x2d')]));_0x39c88c[_0xabd8('0x2b')]=_0x39c88c[_0xabd8('0x2b')]['length']?_0x39c88c['attributes']:_0x17134b[_0xabd8('0x28')];if(!_0x5a513e[_0xabd8('0x29')]['hasOwnProperty'](_0xabd8('0x2e'))){_0x39c88c['limit']=qs[_0xabd8('0x2f')](_0x5a513e[_0xabd8('0x29')]['limit']);_0x39c88c[_0xabd8('0x19')]=qs[_0xabd8('0x19')](_0x5a513e[_0xabd8('0x29')][_0xabd8('0x19')]);}_0x39c88c['order']=qs[_0xabd8('0x30')](_0x5a513e[_0xabd8('0x29')]['sort']);_0x39c88c[_0xabd8('0x31')]=qs[_0xabd8('0x32')](_[_0xabd8('0x33')](_0x5a513e[_0xabd8('0x29')],_0x17134b[_0xabd8('0x32')]),_0x9c640a);if(_0x5a513e[_0xabd8('0x29')]['filter']){_0x39c88c[_0xabd8('0x31')]=_[_0xabd8('0x34')](_0x39c88c[_0xabd8('0x31')],{'$or':_[_0xabd8('0x24')](_0x9c640a,function(_0x2ee451){if(_0x2ee451['type']!=='VIRTUAL'){var _0x310931={};_0x310931[_0x2ee451[_0xabd8('0x22')]]={'$like':'%'+_0x5a513e[_0xabd8('0x29')]['filter']+'%'};return _0x310931;}})});}_0x39c88c=_[_0xabd8('0x34')]({},_0x39c88c,_0x5a513e[_0xabd8('0x35')]);var _0x1dab98={'where':_0x39c88c[_0xabd8('0x31')]};return db[_0xabd8('0x36')]['count'](_0x1dab98)['then'](function(_0x25cc8d){_0x51aff3[_0xabd8('0x37')]=_0x25cc8d;if(_0x5a513e[_0xabd8('0x29')][_0xabd8('0x38')]){_0x39c88c[_0xabd8('0x39')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xabd8('0x3a')](_0x39c88c);})[_0xabd8('0x1e')](function(_0x469933){_0x51aff3[_0xabd8('0x3b')]=_0x469933;return _0x51aff3;})[_0xabd8('0x1e')](respondWithFilteredResult(_0x1f9a9,_0x39c88c))[_0xabd8('0x3c')](handleError(_0x1f9a9,null));};exports[_0xabd8('0x3d')]=function(_0x5e1928,_0xc00b30){var _0x4aee34={'raw':!![],'where':{'id':_0x5e1928[_0xabd8('0x3e')]['id']}},_0x352efc={};_0x352efc['model']=_['keys'](db['CmHopperHistory'][_0xabd8('0x3f')]);_0x352efc[_0xabd8('0x29')]=_['keys'](_0x5e1928[_0xabd8('0x29')]);_0x352efc[_0xabd8('0x32')]=_[_0xabd8('0x2c')](_0x352efc['model'],_0x352efc[_0xabd8('0x29')]);_0x4aee34[_0xabd8('0x2b')]=_['intersection'](_0x352efc[_0xabd8('0x28')],qs[_0xabd8('0x2d')](_0x5e1928[_0xabd8('0x29')][_0xabd8('0x2d')]));_0x4aee34[_0xabd8('0x2b')]=_0x4aee34[_0xabd8('0x2b')]['length']?_0x4aee34[_0xabd8('0x2b')]:_0x352efc['model'];if(_0x5e1928['query']['includeAll']){_0x4aee34[_0xabd8('0x39')]=[{'all':!![]}];}_0x4aee34=_[_0xabd8('0x34')]({},_0x4aee34,_0x5e1928[_0xabd8('0x35')]);return db[_0xabd8('0x36')]['find'](_0x4aee34)[_0xabd8('0x1e')](handleEntityNotFound(_0xc00b30,null))['then'](respondWithResult(_0xc00b30,null))[_0xabd8('0x3c')](handleError(_0xc00b30,null));};exports[_0xabd8('0x40')]=function(_0x18a939,_0x230a2d){return db[_0xabd8('0x36')]['create'](_0x18a939[_0xabd8('0x41')],{})[_0xabd8('0x1e')](respondWithResult(_0x230a2d,0xc9))[_0xabd8('0x3c')](handleError(_0x230a2d,null));};exports[_0xabd8('0x42')]=function(_0x80a80b,_0xe4e19e){return db[_0xabd8('0x36')][_0xabd8('0x42')]()[_0xabd8('0x1e')](respondWithResult(_0xe4e19e,null))[_0xabd8('0x3c')](handleError(_0xe4e19e,null));};exports['update']=function(_0x2778da,_0xae95aa){if(_0x2778da[_0xabd8('0x41')][_0xabd8('0x43')]){delete _0x2778da[_0xabd8('0x41')][_0xabd8('0x43')];}return db['CmHopperHistory'][_0xabd8('0x44')]({'where':{'uniqueid':_0x2778da[_0xabd8('0x3e')]['id']}})[_0xabd8('0x1e')](handleEntityNotFound(_0xae95aa,null))['then'](saveUpdates(_0x2778da['body'],null))[_0xabd8('0x1e')](respondWithResult(_0xae95aa,null))[_0xabd8('0x3c')](handleError(_0xae95aa,null));}; \ No newline at end of file +var _0x0616=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','CmHopperHistory','options','create','describe','uniqueid','body','find','eml-format','zip-dir','fast-json-patch'];(function(_0x63af6c,_0x544156){var _0x5d97b4=function(_0x1b93b6){while(--_0x1b93b6){_0x63af6c['push'](_0x63af6c['shift']());}};_0x5d97b4(++_0x544156);}(_0x0616,0xe4));var _0x6061=function(_0x211de7,_0x2e6f69){_0x211de7=_0x211de7-0x0;var _0x2b29e0=_0x0616[_0x211de7];return _0x2b29e0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6061('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6061('0x1'));var jsonpatch=require(_0x6061('0x2'));var rp=require(_0x6061('0x3'));var moment=require('moment');var BPromise=require(_0x6061('0x4'));var Mustache=require(_0x6061('0x5'));var util=require(_0x6061('0x6'));var path=require(_0x6061('0x7'));var sox=require(_0x6061('0x8'));var csv=require(_0x6061('0x9'));var ejs=require(_0x6061('0xa'));var fs=require('fs');var _=require(_0x6061('0xb'));var squel=require(_0x6061('0xc'));var crypto=require(_0x6061('0xd'));var jsforce=require(_0x6061('0xe'));var deskjs=require(_0x6061('0xf'));var toCsv=require(_0x6061('0x9'));var querystring=require(_0x6061('0x10'));var Papa=require('papaparse');var Redis=require(_0x6061('0x11'));var authService=require(_0x6061('0x12'));var qs=require(_0x6061('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6061('0x14'));var logger=require(_0x6061('0x15'))(_0x6061('0x16'));var utils=require(_0x6061('0x17'));var config=require(_0x6061('0x18'));var db=require(_0x6061('0x19'))['db'];function respondWithStatusCode(_0x5ac2a1,_0x2825d6){_0x2825d6=_0x2825d6||0xcc;return function(_0x3aad62){if(_0x3aad62){return _0x5ac2a1['sendStatus'](_0x2825d6);}return _0x5ac2a1[_0x6061('0x1a')](_0x2825d6)[_0x6061('0x1b')]();};}function respondWithResult(_0x14dd34,_0x1a6ede){_0x1a6ede=_0x1a6ede||0xc8;return function(_0x12ba16){if(_0x12ba16){return _0x14dd34['status'](_0x1a6ede)[_0x6061('0x1c')](_0x12ba16);}};}function respondWithFilteredResult(_0x4e6739,_0x47f0ce){return function(_0x4da1a5){if(_0x4da1a5){var _0x1cf6e6=_0x4da1a5[_0x6061('0x1d')],_0x2326a4=_0x47f0ce[_0x6061('0x1e')],_0x118509=_0x47f0ce['offset']+_0x47f0ce[_0x6061('0x1f')],_0x2056ba;if(_0x118509>=_0x1cf6e6){_0x118509=_0x1cf6e6;_0x2056ba=0xc8;}else{_0x2056ba=0xce;}_0x4e6739[_0x6061('0x1a')](_0x2056ba);return _0x4e6739[_0x6061('0x20')](_0x6061('0x21'),_0x2326a4+'-'+_0x118509+'/'+_0x1cf6e6)[_0x6061('0x1c')](_0x4da1a5);}return null;};}function patchUpdates(_0x5bfa13){return function(_0xc14e8d){try{jsonpatch[_0x6061('0x22')](_0xc14e8d,_0x5bfa13,!![]);}catch(_0x11fdd9){return BPromise['reject'](_0x11fdd9);}return _0xc14e8d[_0x6061('0x23')]();};}function saveUpdates(_0x1a0d40,_0x27ae47){return function(_0x5dceb1){if(_0x5dceb1){return _0x5dceb1[_0x6061('0x24')](_0x1a0d40)[_0x6061('0x25')](function(_0x163fea){return _0x163fea;});}return null;};}function removeEntity(_0x52a479,_0x4f9881){return function(_0x473e11){if(_0x473e11){return _0x473e11['destroy']()[_0x6061('0x25')](function(){_0x52a479[_0x6061('0x1a')](0xcc)[_0x6061('0x1b')]();});}};}function handleEntityNotFound(_0x15ce9b,_0x3aa71d){return function(_0x2a6e98){if(!_0x2a6e98){_0x15ce9b['sendStatus'](0x194);}return _0x2a6e98;};}function handleError(_0x281855,_0x24281b){_0x24281b=_0x24281b||0x1f4;return function(_0x243df5){logger[_0x6061('0x26')](_0x243df5[_0x6061('0x27')]);if(_0x243df5[_0x6061('0x28')]){delete _0x243df5[_0x6061('0x28')];}_0x281855['status'](_0x24281b)[_0x6061('0x29')](_0x243df5);};}exports[_0x6061('0x2a')]=function(_0x1f21d5,_0x48a238){var _0x499d7f={},_0xe6a578={},_0x2dfe51={'count':0x0,'rows':[]};var _0x27f5ae=_[_0x6061('0x2b')](db['CmHopperHistory'][_0x6061('0x2c')],function(_0x58d929){return{'name':_0x58d929[_0x6061('0x2d')],'type':_0x58d929[_0x6061('0x2e')][_0x6061('0x2f')]};});_0xe6a578[_0x6061('0x30')]=_[_0x6061('0x2b')](_0x27f5ae,_0x6061('0x28'));_0xe6a578[_0x6061('0x31')]=_['keys'](_0x1f21d5['query']);_0xe6a578[_0x6061('0x32')]=_[_0x6061('0x33')](_0xe6a578[_0x6061('0x30')],_0xe6a578[_0x6061('0x31')]);_0x499d7f[_0x6061('0x34')]=_[_0x6061('0x33')](_0xe6a578[_0x6061('0x30')],qs[_0x6061('0x35')](_0x1f21d5[_0x6061('0x31')][_0x6061('0x35')]));_0x499d7f[_0x6061('0x34')]=_0x499d7f[_0x6061('0x34')][_0x6061('0x36')]?_0x499d7f[_0x6061('0x34')]:_0xe6a578['model'];if(!_0x1f21d5[_0x6061('0x31')][_0x6061('0x37')]('nolimit')){_0x499d7f['limit']=qs[_0x6061('0x1f')](_0x1f21d5['query'][_0x6061('0x1f')]);_0x499d7f[_0x6061('0x1e')]=qs[_0x6061('0x1e')](_0x1f21d5['query'][_0x6061('0x1e')]);}_0x499d7f[_0x6061('0x38')]=qs[_0x6061('0x39')](_0x1f21d5[_0x6061('0x31')][_0x6061('0x39')]);_0x499d7f[_0x6061('0x3a')]=qs[_0x6061('0x32')](_[_0x6061('0x3b')](_0x1f21d5['query'],_0xe6a578['filters']),_0x27f5ae);if(_0x1f21d5[_0x6061('0x31')][_0x6061('0x3c')]){_0x499d7f[_0x6061('0x3a')]=_['merge'](_0x499d7f[_0x6061('0x3a')],{'$or':_['map'](_0x27f5ae,function(_0x244325){if(_0x244325[_0x6061('0x2e')]!=='VIRTUAL'){var _0x2c30fb={};_0x2c30fb[_0x244325[_0x6061('0x28')]]={'$like':'%'+_0x1f21d5['query'][_0x6061('0x3c')]+'%'};return _0x2c30fb;}})});}_0x499d7f=_[_0x6061('0x3d')]({},_0x499d7f,_0x1f21d5['options']);var _0x1e44a2={'where':_0x499d7f[_0x6061('0x3a')]};return db['CmHopperHistory'][_0x6061('0x1d')](_0x1e44a2)[_0x6061('0x25')](function(_0x22bee7){_0x2dfe51[_0x6061('0x1d')]=_0x22bee7;if(_0x1f21d5['query'][_0x6061('0x3e')]){_0x499d7f[_0x6061('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6061('0x40')](_0x499d7f);})['then'](function(_0x5e4e9e){_0x2dfe51[_0x6061('0x41')]=_0x5e4e9e;return _0x2dfe51;})['then'](respondWithFilteredResult(_0x48a238,_0x499d7f))[_0x6061('0x42')](handleError(_0x48a238,null));};exports[_0x6061('0x43')]=function(_0x36ac15,_0x1bec2e){var _0x1e6e29={'raw':!![],'where':{'id':_0x36ac15[_0x6061('0x44')]['id']}},_0x2996fe={};_0x2996fe['model']=_[_0x6061('0x45')](db[_0x6061('0x46')][_0x6061('0x2c')]);_0x2996fe[_0x6061('0x31')]=_[_0x6061('0x45')](_0x36ac15[_0x6061('0x31')]);_0x2996fe[_0x6061('0x32')]=_['intersection'](_0x2996fe[_0x6061('0x30')],_0x2996fe[_0x6061('0x31')]);_0x1e6e29[_0x6061('0x34')]=_[_0x6061('0x33')](_0x2996fe[_0x6061('0x30')],qs[_0x6061('0x35')](_0x36ac15[_0x6061('0x31')]['fields']));_0x1e6e29[_0x6061('0x34')]=_0x1e6e29[_0x6061('0x34')][_0x6061('0x36')]?_0x1e6e29['attributes']:_0x2996fe[_0x6061('0x30')];if(_0x36ac15[_0x6061('0x31')][_0x6061('0x3e')]){_0x1e6e29[_0x6061('0x3f')]=[{'all':!![]}];}_0x1e6e29=_[_0x6061('0x3d')]({},_0x1e6e29,_0x36ac15[_0x6061('0x47')]);return db[_0x6061('0x46')]['find'](_0x1e6e29)[_0x6061('0x25')](handleEntityNotFound(_0x1bec2e,null))['then'](respondWithResult(_0x1bec2e,null))[_0x6061('0x42')](handleError(_0x1bec2e,null));};exports[_0x6061('0x48')]=function(_0x48a7f6,_0x4dd654){return db[_0x6061('0x46')]['create'](_0x48a7f6['body'],{})['then'](respondWithResult(_0x4dd654,0xc9))[_0x6061('0x42')](handleError(_0x4dd654,null));};exports[_0x6061('0x49')]=function(_0x2be2e5,_0x36c249){return db[_0x6061('0x46')][_0x6061('0x49')]()['then'](respondWithResult(_0x36c249,null))[_0x6061('0x42')](handleError(_0x36c249,null));};exports['update']=function(_0x1ec212,_0x5f3e37){if(_0x1ec212['body'][_0x6061('0x4a')]){delete _0x1ec212[_0x6061('0x4b')][_0x6061('0x4a')];}return db['CmHopperHistory'][_0x6061('0x4c')]({'where':{'uniqueid':_0x1ec212['params']['id']}})[_0x6061('0x25')](handleEntityNotFound(_0x5f3e37,null))[_0x6061('0x25')](saveUpdates(_0x1ec212[_0x6061('0x4b')],null))[_0x6061('0x25')](respondWithResult(_0x5f3e37,null))[_0x6061('0x42')](handleError(_0x5f3e37,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 48a0512..6295357 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 _0xde3b=['request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','lodash','../../config/logger','api','moment','bluebird'];(function(_0x418634,_0x8542b){var _0x284cb0=function(_0x5f4b9b){while(--_0x5f4b9b){_0x418634['push'](_0x418634['shift']());}};_0x284cb0(++_0x8542b);}(_0xde3b,0x1dc));var _0xbde3=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xde3b[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xbde3('0x0'));var util=require('util');var logger=require(_0xbde3('0x1'))(_0xbde3('0x2'));var moment=require(_0xbde3('0x3'));var BPromise=require(_0xbde3('0x4'));var rp=require(_0xbde3('0x5'));var fs=require('fs');var path=require(_0xbde3('0x6'));var rimraf=require(_0xbde3('0x7'));var config=require('../../config/environment');var attributes=require(_0xbde3('0x8'));module['exports']=function(_0xa299a6,_0x4fac23){return _0xa299a6[_0xbde3('0x9')](_0xbde3('0xa'),attributes,{'tableName':_0xbde3('0xb'),'paranoid':![],'indexes':[{'name':_0xbde3('0xc'),'fields':[_0xbde3('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2172=['rimraf','../../config/environment','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment','path'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2172,0x15b));var _0x2217=function(_0x1e4142,_0x58cd2d){_0x1e4142=_0x1e4142-0x0;var _0x212220=_0x2172[_0x1e4142];return _0x212220;};'use strict';var _=require('lodash');var util=require(_0x2217('0x0'));var logger=require(_0x2217('0x1'))(_0x2217('0x2'));var moment=require(_0x2217('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2217('0x4'));var rimraf=require(_0x2217('0x5'));var config=require(_0x2217('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x57adaa,_0x25ddb0){return _0x57adaa[_0x2217('0x7')](_0x2217('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x2217('0x9'),'fields':['endtime']},{'name':_0x2217('0xa'),'fields':[_0x2217('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b82b49f..0c7e310 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 _0x4cf8=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x32e8dd,_0x18b832){var _0x4eab85=function(_0x54a8ad){while(--_0x54a8ad){_0x32e8dd['push'](_0x32e8dd['shift']());}};_0x4eab85(++_0x18b832);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x4cf8[_0x14490c];return _0x2f6825;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['CmHopperHistory']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')]['where']||null:null,'attributes':[[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')][_0x84cf('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x23')))),_0x84cf('0x24')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x25')))),_0x84cf('0x26')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x27')))),_0x84cf('0x28')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x29'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x84cf('0x2a')],[db[_0x84cf('0x1f')]['fn']('AVG',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x2b')))),_0x84cf('0x2c')]]})[_0x84cf('0xd')](function(_0x172ce9){logger['info'](_0x84cf('0x1c'),_0x4c9d1c);logger['debug']('AvgHandleTime',_0x4c9d1c,JSON[_0x84cf('0x12')](_0x172ce9));_0x26db3f(_0x172ce9);})[_0x84cf('0x17')](function(_0x4c4676){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x4c4676[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x4c4676[_0x84cf('0x15')]));});});};exports[_0x84cf('0x2d')]=function(_0x56f798){var _0x2d2d4b=this;return new Promise(function(_0xb6d12d,_0x275cac){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x56f798[_0x84cf('0x1a')]?_0x56f798['options'][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x56f798['options']?_0x56f798[_0x84cf('0x1a')][_0x84cf('0x2e')]||null:null,'attributes':[[_0x84cf('0x2f'),_0x84cf('0x30')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x84cf('0x31')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x84cf('0x32')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x84cf('0x33')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x34')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x35')))),'outboundCongestionCallsDay'],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x36')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x84cf('0x37')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x84cf('0x38')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x84cf('0x39')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x3a')))),_0x84cf('0x3b')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x84cf('0x3c')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x3d')))),_0x84cf('0x3b')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x84cf('0x3e')]],'group':['campaign']})['then'](function(_0x147194){logger[_0x84cf('0xe')]('GetVoiceQueueHopperHistory',_0x56f798);logger['debug'](_0x84cf('0x2d'),_0x56f798,JSON[_0x84cf('0x12')](_0x147194));_0xb6d12d(_0x147194);})[_0x84cf('0x17')](function(_0x1e2676){logger[_0x84cf('0x14')](_0x84cf('0x2d'),_0x1e2676[_0x84cf('0x15')],_0x56f798);_0x275cac(_0x2d2d4b[_0x84cf('0x14')](0x1f4,_0x1e2676['message']));});});};exports[_0x84cf('0x3f')]=function(_0x11f3cc){var _0x52991f=this;return new Promise(function(_0x5a4003,_0x1537f3){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc['options'][_0x84cf('0x2e')]||null:null,'attributes':[['campaign',_0x84cf('0x30')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['col']('id')),_0x84cf('0x40')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x84cf('0x2f')]})[_0x84cf('0xd')](function(_0x10a229){logger[_0x84cf('0xe')]('GetCampaignHopperHistory',_0x11f3cc);logger[_0x84cf('0x11')](_0x84cf('0x3f'),_0x11f3cc,JSON['stringify'](_0x10a229));_0x5a4003(_0x10a229);})[_0x84cf('0x17')](function(_0x293fe9){logger[_0x84cf('0x14')](_0x84cf('0x3f'),_0x293fe9[_0x84cf('0x15')],_0x11f3cc);_0x1537f3(_0x52991f[_0x84cf('0x14')](0x1f4,_0x293fe9[_0x84cf('0x15')]));});});}; \ No newline at end of file +var _0x3423=['`state`\x20=\x204,\x201,\x20null','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','name','ivrTotalCallsDays','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','debug','catch','AvgHandleTime','where','col','predictiveIntervalTotalCalls','sequelize','literal'];(function(_0x16c7d4,_0x1fd6a5){var _0x54c042=function(_0x2ef67c){while(--_0x2ef67c){_0x16c7d4['push'](_0x16c7d4['shift']());}};_0x54c042(++_0x1fd6a5);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});}exports[_0x3342('0x15')]=function(_0x2075cb){var _0x12947a=this;return new Promise(function(_0x156c24,_0x45a3ca){return db[_0x3342('0x16')][_0x3342('0x17')](_0x2075cb['body'],{'raw':_0x2075cb[_0x3342('0x18')]?_0x2075cb[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3cb86f){logger[_0x3342('0x13')]('CreateCmHopperHistory',_0x2075cb);logger[_0x3342('0x1a')](_0x3342('0x15'),_0x2075cb,JSON['stringify'](_0x3cb86f));_0x156c24(_0x3cb86f);})[_0x3342('0x1b')](function(_0x5a0658){logger[_0x3342('0x10')](_0x3342('0x15'),_0x5a0658[_0x3342('0x12')],_0x2075cb);_0x45a3ca(_0x12947a[_0x3342('0x10')](0x1f4,_0x5a0658[_0x3342('0x12')]));});});};exports[_0x3342('0x1c')]=function(_0x26eb87){var _0x2d8622=this;return new Promise(function(_0x5d4f14,_0x30ffc9){return db['CmHopperHistory']['findAll']({'raw':_0x26eb87[_0x3342('0x18')]?_0x26eb87['options']['raw']===undefined?!![]:![]:!![],'where':_0x26eb87[_0x3342('0x18')]?_0x26eb87['options'][_0x3342('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x3342('0x1e')]('id')),_0x3342('0x1f')],[db[_0x3342('0x20')]['fn']('COUNT',db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x22')))),'predictiveIntervalAnsweredCalls'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x24')))),_0x3342('0x25')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3342('0x26')],[db[_0x3342('0x20')]['fn'](_0x3342('0x27'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x28')))),_0x3342('0x29')],[db[_0x3342('0x20')]['fn'](_0x3342('0x27'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x2a')))),_0x3342('0x2b')]]})[_0x3342('0xd')](function(_0x30dcea){logger['info']('AvgHandleTime',_0x26eb87);logger[_0x3342('0x1a')]('AvgHandleTime',_0x26eb87,JSON[_0x3342('0xf')](_0x30dcea));_0x5d4f14(_0x30dcea);})[_0x3342('0x1b')](function(_0x1a74d3){logger[_0x3342('0x10')](_0x3342('0x1c'),_0x1a74d3[_0x3342('0x12')],_0x26eb87);_0x30ffc9(_0x2d8622[_0x3342('0x10')](0x1f4,_0x1a74d3['message']));});});};exports[_0x3342('0x2c')]=function(_0x2db4ac){var _0x23dbe8=this;return new Promise(function(_0x155493,_0x32f644){return db['CmHopperHistory'][_0x3342('0x2d')]({'raw':_0x2db4ac['options']?_0x2db4ac[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x2db4ac[_0x3342('0x18')]?_0x2db4ac[_0x3342('0x18')]['where']||null:null,'attributes':[[_0x3342('0x2e'),'name'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x2f')))),_0x3342('0x30')],[db['sequelize']['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x31')))),'outboundNoAnswerCallsDay'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3342('0x22')))),_0x3342('0x32')],[db['sequelize']['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x33')))),_0x3342('0x34')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x35')))),_0x3342('0x36')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x37')))),_0x3342('0x38')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3342('0x39')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x3a')))),'outboundUnknownCallsDay'],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')]['literal'](_0x3342('0x3b')))),_0x3342('0x3c')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3342('0x21')](_0x3342('0x3d')))),_0x3342('0x3e')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x3342('0x3f')],[db['sequelize']['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3342('0x40')))),_0x3342('0x41')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3342('0x3f')],[db[_0x3342('0x20')]['fn'](_0x3342('0x23'),db['sequelize']['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')](_0x3342('0x42')))),_0x3342('0x43')]],'group':[_0x3342('0x2e')]})['then'](function(_0x2699d2){logger[_0x3342('0x13')](_0x3342('0x2c'),_0x2db4ac);logger[_0x3342('0x1a')](_0x3342('0x2c'),_0x2db4ac,JSON[_0x3342('0xf')](_0x2699d2));_0x155493(_0x2699d2);})[_0x3342('0x1b')](function(_0x47cf76){logger[_0x3342('0x10')]('GetVoiceQueueHopperHistory',_0x47cf76[_0x3342('0x12')],_0x2db4ac);_0x32f644(_0x23dbe8['error'](0x1f4,_0x47cf76[_0x3342('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x49e3c6){var _0x5bff74=this;return new Promise(function(_0x47b9b2,_0x204e35){return db[_0x3342('0x16')][_0x3342('0x2d')]({'raw':_0x49e3c6[_0x3342('0x18')]?_0x49e3c6[_0x3342('0x18')][_0x3342('0x19')]===undefined?!![]:![]:!![],'where':_0x49e3c6[_0x3342('0x18')]?_0x49e3c6[_0x3342('0x18')][_0x3342('0x1d')]||null:null,'attributes':[[_0x3342('0x2e'),_0x3342('0x44')],[db['sequelize']['fn']('COUNT',db[_0x3342('0x20')]['col']('id')),_0x3342('0x45')],[db['sequelize']['fn']('COUNT',db[_0x3342('0x20')]['fn']('IF',db[_0x3342('0x20')][_0x3342('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x3342('0x2e')]})[_0x3342('0xd')](function(_0x5e9161){logger[_0x3342('0x13')](_0x3342('0x46'),_0x49e3c6);logger[_0x3342('0x1a')]('GetCampaignHopperHistory',_0x49e3c6,JSON[_0x3342('0xf')](_0x5e9161));_0x47b9b2(_0x5e9161);})[_0x3342('0x1b')](function(_0x3dd926){logger[_0x3342('0x10')](_0x3342('0x46'),_0x3dd926[_0x3342('0x12')],_0x49e3c6);_0x204e35(_0x5bff74[_0x3342('0x10')](0x1f4,_0x3dd926['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2b28b3d..76f3ccd 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 _0xd33c=['describe','post','create','put','/:id','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x580f48,_0x2e34c1){var _0x16133f=function(_0x1f1959){while(--_0x1f1959){_0x580f48['push'](_0x580f48['shift']());}};_0x16133f(++_0x2e34c1);}(_0xd33c,0x115));var _0xcd33=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xd33c[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xcd33('0x0'));var util=require(_0xcd33('0x1'));var path=require('path');var timeout=require(_0xcd33('0x2'));var express=require(_0xcd33('0x3'));var router=express['Router']();var auth=require(_0xcd33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcd33('0x5'));var controller=require(_0xcd33('0x6'));router[_0xcd33('0x7')]('/',auth[_0xcd33('0x8')](),controller[_0xcd33('0x9')]);router['get'](_0xcd33('0xa'),auth['isAuthenticated'](),controller[_0xcd33('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd33('0xc')]('/',auth[_0xcd33('0x8')](),controller[_0xcd33('0xd')]);router[_0xcd33('0xe')](_0xcd33('0xf'),auth[_0xcd33('0x8')](),controller[_0xcd33('0x10')]);module[_0xcd33('0x11')]=router; \ No newline at end of file +var _0x036e=['../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','multer','util','connect-timeout','express','Router'];(function(_0xac470e,_0x2899d7){var _0x148d44=function(_0x2f5575){while(--_0x2f5575){_0xac470e['push'](_0xac470e['shift']());}};_0x148d44(++_0x2899d7);}(_0x036e,0x182));var _0xe036=function(_0x11adb6,_0x37549a){_0x11adb6=_0x11adb6-0x0;var _0x35b45a=_0x036e[_0x11adb6];return _0x35b45a;};'use strict';var multer=require(_0xe036('0x0'));var util=require(_0xe036('0x1'));var path=require('path');var timeout=require(_0xe036('0x2'));var express=require(_0xe036('0x3'));var router=express[_0xe036('0x4')]();var auth=require(_0xe036('0x5'));var interaction=require(_0xe036('0x6'));var config=require('../../config/environment');var controller=require(_0xe036('0x7'));router[_0xe036('0x8')]('/',auth[_0xe036('0x9')](),controller[_0xe036('0xa')]);router[_0xe036('0x8')](_0xe036('0xb'),auth['isAuthenticated'](),controller[_0xe036('0xc')]);router[_0xe036('0x8')](_0xe036('0xd'),auth['isAuthenticated'](),controller[_0xe036('0xe')]);router['post']('/',auth[_0xe036('0x9')](),controller[_0xe036('0xf')]);router['put']('/:id',auth[_0xe036('0x9')](),controller[_0xe036('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 07990ac..afc69d8 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 _0x006c=['STRING','name','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x006c,0x156));var _0xc006=function(_0x3c48b0,_0x327bfe){_0x3c48b0=_0x3c48b0-0x0;var _0x28a6e4=_0x006c[_0x3c48b0];return _0x28a6e4;};'use strict';var Sequelize=require(_0xc006('0x0'));module[_0xc006('0x1')]={'name':{'type':Sequelize[_0xc006('0x2')],'unique':_0xc006('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc006('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7eb0=['exports','STRING','name','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7eb0,0x13b));var _0x07eb=function(_0x481ada,_0x2624d4){_0x481ada=_0x481ada-0x0;var _0x16c3df=_0x7eb0[_0x481ada];return _0x16c3df;};'use strict';var Sequelize=require(_0x07eb('0x0'));module[_0x07eb('0x1')]={'name':{'type':Sequelize[_0x07eb('0x2')],'unique':_0x07eb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07eb('0x2')]},'dialPrefix':{'type':Sequelize[_0x07eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7f120f2..6080e00 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 _0xe836=['socket.io-emitter','./cmList.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','length','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','omit','success','push','dataValues','errors','message','getContacts','CmCustomField','CustomFields','cf_%d','raw','concat','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x6e326a,_0x52e8c7){var _0x5062c2=function(_0x2b5a7e){while(--_0x2b5a7e){_0x6e326a['push'](_0x6e326a['shift']());}};_0x5062c2(++_0x52e8c7);}(_0xe836,0x7c));var _0x6e83=function(_0x16fec1,_0x37b93a){_0x16fec1=_0x16fec1-0x0;var _0x4fa79e=_0xe836[_0x16fec1];return _0x4fa79e;};'use strict';var pdf=require(_0x6e83('0x0'));var emlformat=require(_0x6e83('0x1'));var rimraf=require(_0x6e83('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e83('0x3'));var rp=require(_0x6e83('0x4'));var moment=require(_0x6e83('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e83('0x6'));var path=require(_0x6e83('0x7'));var sox=require(_0x6e83('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6e83('0x9'));var crypto=require(_0x6e83('0xa'));var jsforce=require(_0x6e83('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e83('0xc'));var querystring=require(_0x6e83('0xd'));var Papa=require(_0x6e83('0xe'));var Redis=require(_0x6e83('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6e83('0x10'));var as=require(_0x6e83('0x11'));var hardwareService=require(_0x6e83('0x12'));var logger=require(_0x6e83('0x13'))(_0x6e83('0x14'));var utils=require(_0x6e83('0x15'));var config=require(_0x6e83('0x16'));var db=require(_0x6e83('0x17'))['db'];config[_0x6e83('0x18')]=_[_0x6e83('0x19')](config['redis'],{'host':_0x6e83('0x1a'),'port':0x18eb});var socket=require(_0x6e83('0x1b'))(new Redis(config['redis']));require(_0x6e83('0x1c'))[_0x6e83('0x1d')](socket);function respondWithStatusCode(_0x50be70,_0x4d2974){_0x4d2974=_0x4d2974||0xcc;return function(_0x57c964){if(_0x57c964){return _0x50be70['sendStatus'](_0x4d2974);}return _0x50be70[_0x6e83('0x1e')](_0x4d2974)[_0x6e83('0x1f')]();};}function respondWithResult(_0x33f819,_0x3229a4){_0x3229a4=_0x3229a4||0xc8;return function(_0x542e8d){if(_0x542e8d){return _0x33f819['status'](_0x3229a4)[_0x6e83('0x20')](_0x542e8d);}};}function respondWithFilteredResult(_0x2907e,_0x7ffb47){return function(_0x529e29){if(_0x529e29){var _0x3326bd=_0x529e29[_0x6e83('0x21')],_0x1524e6=_0x7ffb47[_0x6e83('0x22')],_0x515df4=_0x7ffb47[_0x6e83('0x22')]+_0x7ffb47[_0x6e83('0x23')],_0xec49f4;if(_0x515df4>=_0x3326bd){_0x515df4=_0x3326bd;_0xec49f4=0xc8;}else{_0xec49f4=0xce;}_0x2907e[_0x6e83('0x1e')](_0xec49f4);return _0x2907e[_0x6e83('0x24')](_0x6e83('0x25'),_0x1524e6+'-'+_0x515df4+'/'+_0x3326bd)['json'](_0x529e29);}return null;};}function patchUpdates(_0x9b499a){return function(_0x18daa4){try{jsonpatch[_0x6e83('0x26')](_0x18daa4,_0x9b499a,!![]);}catch(_0x114163){return BPromise[_0x6e83('0x27')](_0x114163);}return _0x18daa4[_0x6e83('0x28')]();};}function saveUpdates(_0x4ccc81,_0x592ef9){return function(_0xd71856){if(_0xd71856){return _0xd71856[_0x6e83('0x29')](_0x4ccc81)[_0x6e83('0x2a')](function(_0x63b78d){return _0x63b78d;});}return null;};}function removeEntity(_0x12614d,_0x16a5c7){return function(_0x55d944){if(_0x55d944){return _0x55d944[_0x6e83('0x2b')]()[_0x6e83('0x2a')](function(){var _0x4201a7=_0x55d944[_0x6e83('0x2c')]({'plain':!![]});var _0x30a663=_0x6e83('0x2d');return db['UserProfileResource'][_0x6e83('0x2b')]({'where':{'type':_0x30a663,'resourceId':_0x4201a7['id']}})['then'](function(){return _0x55d944;});})['then'](function(){_0x12614d[_0x6e83('0x1e')](0xcc)[_0x6e83('0x1f')]();});}};}function handleEntityNotFound(_0x1993cd,_0x1e91bc){return function(_0x3fe1b0){if(!_0x3fe1b0){_0x1993cd[_0x6e83('0x2e')](0x194);}return _0x3fe1b0;};}function handleError(_0x4564c5,_0x5dc580){_0x5dc580=_0x5dc580||0x1f4;return function(_0x20982b){logger[_0x6e83('0x2f')](_0x20982b[_0x6e83('0x30')]);if(_0x20982b['name']){delete _0x20982b[_0x6e83('0x31')];}_0x4564c5[_0x6e83('0x1e')](_0x5dc580)[_0x6e83('0x32')](_0x20982b);};}exports[_0x6e83('0x33')]=function(_0x227603,_0x48e66d){var _0x187bbc={},_0x18d956={},_0x2c2ac2={'count':0x0,'rows':[]};var _0x21ce29=_[_0x6e83('0x34')](db[_0x6e83('0x35')][_0x6e83('0x36')],function(_0x4b6951){return{'name':_0x4b6951[_0x6e83('0x37')],'type':_0x4b6951[_0x6e83('0x38')][_0x6e83('0x39')]};});_0x18d956[_0x6e83('0x3a')]=_[_0x6e83('0x34')](_0x21ce29,_0x6e83('0x31'));_0x18d956[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x227603[_0x6e83('0x3b')]);_0x18d956[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x18d956['model'],_0x18d956[_0x6e83('0x3b')]);_0x187bbc[_0x6e83('0x3f')]=_['intersection'](_0x18d956[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x227603[_0x6e83('0x3b')]['fields']));_0x187bbc[_0x6e83('0x3f')]=_0x187bbc[_0x6e83('0x3f')]['length']?_0x187bbc[_0x6e83('0x3f')]:_0x18d956['model'];if(!_0x227603[_0x6e83('0x3b')][_0x6e83('0x41')]('nolimit')){_0x187bbc[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x227603[_0x6e83('0x3b')]['limit']);_0x187bbc[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x227603[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x187bbc[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x227603[_0x6e83('0x3b')]['sort']);_0x187bbc[_0x6e83('0x44')]=qs['filters'](_[_0x6e83('0x45')](_0x227603[_0x6e83('0x3b')],_0x18d956[_0x6e83('0x3d')]),_0x21ce29);if(_0x227603[_0x6e83('0x3b')]['filter']){_0x187bbc[_0x6e83('0x44')]=_['merge'](_0x187bbc[_0x6e83('0x44')],{'$or':_['map'](_0x21ce29,function(_0x159636){if(_0x159636[_0x6e83('0x38')]!=='VIRTUAL'){var _0x1b131f={};_0x1b131f[_0x159636[_0x6e83('0x31')]]={'$like':'%'+_0x227603[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1b131f;}})});}_0x187bbc=_[_0x6e83('0x47')]({},_0x187bbc,_0x227603[_0x6e83('0x48')]);var _0x11cbdc={'where':_0x187bbc[_0x6e83('0x44')]};return db['CmList'][_0x6e83('0x21')](_0x11cbdc)[_0x6e83('0x2a')](function(_0x5bfb26){_0x2c2ac2[_0x6e83('0x21')]=_0x5bfb26;if(_0x227603[_0x6e83('0x3b')][_0x6e83('0x49')]){_0x187bbc['include']=[{'all':!![]}];}return db[_0x6e83('0x35')][_0x6e83('0x4a')](_0x187bbc);})[_0x6e83('0x2a')](function(_0x3909a3){_0x2c2ac2[_0x6e83('0x4b')]=_0x3909a3;return _0x2c2ac2;})['then'](respondWithFilteredResult(_0x48e66d,_0x187bbc))[_0x6e83('0x4c')](handleError(_0x48e66d,null));};exports[_0x6e83('0x4d')]=function(_0x2a863b,_0x4bebd7){var _0x311801={'raw':![],'where':{'id':_0x2a863b[_0x6e83('0x4e')]['id']}},_0x2fbd0a={};_0x2fbd0a[_0x6e83('0x3a')]=_[_0x6e83('0x3c')](db[_0x6e83('0x35')][_0x6e83('0x36')]);_0x2fbd0a['query']=_[_0x6e83('0x3c')](_0x2a863b[_0x6e83('0x3b')]);_0x2fbd0a['filters']=_[_0x6e83('0x3e')](_0x2fbd0a[_0x6e83('0x3a')],_0x2fbd0a[_0x6e83('0x3b')]);_0x311801[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x2fbd0a[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x2a863b['query'][_0x6e83('0x40')]));_0x311801['attributes']=_0x311801['attributes']['length']?_0x311801[_0x6e83('0x3f')]:_0x2fbd0a['model'];if(_0x2a863b['query']['includeAll']){_0x311801[_0x6e83('0x4f')]=[{'all':!![]}];}_0x311801=_[_0x6e83('0x47')]({},_0x311801,_0x2a863b[_0x6e83('0x48')]);return db[_0x6e83('0x35')][_0x6e83('0x50')](_0x311801)[_0x6e83('0x2a')](handleEntityNotFound(_0x4bebd7,null))['then'](respondWithResult(_0x4bebd7,null))[_0x6e83('0x4c')](handleError(_0x4bebd7,null));};exports[_0x6e83('0x51')]=function(_0x32c6b2,_0x13abf8){return db[_0x6e83('0x35')]['create'](_0x32c6b2[_0x6e83('0x52')],{})[_0x6e83('0x2a')](function(_0x46d10c){var _0x23e83a=_0x32c6b2[_0x6e83('0x53')][_0x6e83('0x2c')]({'plain':!![]});if(!_0x23e83a)throw new Error(_0x6e83('0x54'));if(_0x23e83a[_0x6e83('0x55')]===_0x6e83('0x53')){var _0x243b7d=_0x46d10c[_0x6e83('0x2c')]({'plain':!![]});var _0x18fa1b=_0x6e83('0x2d');return db[_0x6e83('0x56')][_0x6e83('0x50')]({'where':{'name':_0x18fa1b,'userProfileId':_0x23e83a[_0x6e83('0x57')]},'raw':!![]})[_0x6e83('0x2a')](function(_0x5248d5){if(_0x5248d5&&_0x5248d5['autoAssociation']===0x0){return db[_0x6e83('0x58')]['create']({'name':_0x243b7d[_0x6e83('0x31')],'resourceId':_0x243b7d['id'],'type':_0x5248d5[_0x6e83('0x31')],'sectionId':_0x5248d5['id']},{})['then'](function(){return _0x46d10c;});}else{return _0x46d10c;}})[_0x6e83('0x4c')](function(_0x4a8276){logger[_0x6e83('0x2f')](_0x6e83('0x59'),_0x4a8276);throw _0x4a8276;});}return _0x46d10c;})[_0x6e83('0x2a')](respondWithResult(_0x13abf8,0xc9))[_0x6e83('0x4c')](handleError(_0x13abf8,null));};exports[_0x6e83('0x29')]=function(_0x1eb651,_0x1fbfd8){if(_0x1eb651[_0x6e83('0x52')]['id']){delete _0x1eb651[_0x6e83('0x52')]['id'];}return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x1eb651[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fbfd8,null))[_0x6e83('0x2a')](saveUpdates(_0x1eb651[_0x6e83('0x52')],null))['then'](respondWithResult(_0x1fbfd8,null))[_0x6e83('0x4c')](handleError(_0x1fbfd8,null));};exports[_0x6e83('0x2b')]=function(_0x177344,_0x1af2de){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x177344[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1af2de,null))[_0x6e83('0x2a')](removeEntity(_0x1af2de,null))[_0x6e83('0x4c')](handleError(_0x1af2de,null));};exports['describe']=function(_0x435f71,_0x422af1){return db['CmList'][_0x6e83('0x5a')]()[_0x6e83('0x2a')](respondWithResult(_0x422af1,null))[_0x6e83('0x4c')](handleError(_0x422af1,null));};exports[_0x6e83('0x5b')]=function(_0x136dad,_0x434f9c,_0x2a9cf1){if(_0x136dad['body']['id']){delete _0x136dad['body']['id'];}return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x136dad[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x434f9c,null))[_0x6e83('0x2a')](function(_0x4f1b05){if(_0x4f1b05){_0x136dad[_0x6e83('0x52')][_0x6e83('0x5c')]=_0x4f1b05['id'];return db[_0x6e83('0x5d')]['create'](_0x136dad[_0x6e83('0x52')]);}})[_0x6e83('0x2a')](respondWithResult(_0x434f9c,null))[_0x6e83('0x4c')](handleError(_0x434f9c,null));};exports['getDispositions']=function(_0x2c9556,_0x27052b,_0x154428){var _0x58b7aa={'raw':![],'where':{}};var _0x280742={};var _0x267a5f={'count':0x0,'rows':[]};return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x2c9556['params']['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x27052b,null))[_0x6e83('0x2a')](function(_0x382231){if(_0x382231){_0x280742[_0x6e83('0x3a')]=_[_0x6e83('0x3c')](db[_0x6e83('0x5d')]['rawAttributes']);_0x280742['query']=_[_0x6e83('0x3c')](_0x2c9556[_0x6e83('0x3b')]);_0x280742['filters']=_[_0x6e83('0x3e')](_0x280742[_0x6e83('0x3a')],_0x280742[_0x6e83('0x3b')]);_0x58b7aa[_0x6e83('0x3f')]=_['intersection'](_0x280742[_0x6e83('0x3a')],qs[_0x6e83('0x40')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x58b7aa[_0x6e83('0x3f')]=_0x58b7aa[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x58b7aa[_0x6e83('0x3f')]:_0x280742[_0x6e83('0x3a')];if(!_0x2c9556['query']['hasOwnProperty'](_0x6e83('0x60'))){_0x58b7aa[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x58b7aa[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x58b7aa[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x2c9556[_0x6e83('0x3b')]['sort']);_0x58b7aa[_0x6e83('0x44')]=qs['filters'](_['pick'](_0x2c9556[_0x6e83('0x3b')],_0x280742[_0x6e83('0x3d')]));_0x58b7aa[_0x6e83('0x44')][_0x6e83('0x5c')]=_0x382231['id'];if(_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x58b7aa[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x58b7aa[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x58b7aa['attributes'],function(_0x2a17db){var _0x34649c={};_0x34649c[_0x2a17db]={'$like':'%'+_0x2c9556[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x34649c;})});}_0x58b7aa=_[_0x6e83('0x47')]({},_0x58b7aa,_0x2c9556[_0x6e83('0x48')]);return db[_0x6e83('0x5d')]['count']({'where':_0x58b7aa[_0x6e83('0x44')]})[_0x6e83('0x2a')](function(_0x273e3a){_0x267a5f['count']=_0x273e3a;if(_0x2c9556[_0x6e83('0x3b')]['includeAll']){_0x58b7aa['include']=[{'all':!![]}];}return db[_0x6e83('0x5d')][_0x6e83('0x4a')](_0x58b7aa);})[_0x6e83('0x2a')](function(_0x4117f9){_0x267a5f[_0x6e83('0x4b')]=_0x4117f9;return _0x267a5f;});}})['then'](respondWithFilteredResult(_0x27052b,_0x58b7aa))[_0x6e83('0x4c')](handleError(_0x27052b,null));};exports[_0x6e83('0x61')]=function(_0x581349,_0x4938d7,_0xd9124b){return db[_0x6e83('0x35')]['find']({'where':{'id':_0x581349[_0x6e83('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4938d7,null))[_0x6e83('0x2a')](function(_0x1006b4){if(_0x1006b4){return _0x1006b4[_0x6e83('0x61')](_0x581349[_0x6e83('0x3b')][_0x6e83('0x62')]);}})[_0x6e83('0x2a')](respondWithStatusCode(_0x4938d7,null))[_0x6e83('0x4c')](handleError(_0x4938d7,null));};exports[_0x6e83('0x63')]=function(_0x5e744a,_0x90f22c,_0x2795ea){return db['CmList'][_0x6e83('0x50')]({'where':{'id':_0x5e744a[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x90f22c,null))['then'](function(_0x4790a7){if(_0x4790a7){var _0x511954=[];var _0x7dba34={'success':[],'errors':[]};return db[_0x6e83('0x64')]['describe']()[_0x6e83('0x2a')](function(_0x1a4010){if(_0x5e744a['body'][_0x6e83('0x65')]&&_[_0x6e83('0x66')](_0x5e744a['body'][_0x6e83('0x65')])){if(_0x5e744a['body'][_0x6e83('0x65')][_0x6e83('0x5f')]){_0x5e744a[_0x6e83('0x52')]['tags']=_0x5e744a[_0x6e83('0x52')]['tags']['join'](';')+';';}else{_0x5e744a[_0x6e83('0x52')][_0x6e83('0x65')]=null;}}else{_0x5e744a[_0x6e83('0x52')][_0x6e83('0x65')]=null;}if(_0x5e744a['body']&&_['isArray'](_0x5e744a[_0x6e83('0x52')])){for(var _0x5c00be=0x0;_0x5c00be<_0x5e744a[_0x6e83('0x52')][_0x6e83('0x5f')];_0x5c00be+=0x1){_0x5e744a[_0x6e83('0x52')][_0x5c00be]['ListId']=_0x5e744a[_0x6e83('0x4e')]['id'];_0x511954['push'](_0x5e744a[_0x6e83('0x52')][_0x5c00be]);}return BPromise['each'](_0x511954,function(_0xe45c68){return db[_0x6e83('0x64')][_0x6e83('0x51')](_[_0x6e83('0x67')](_0xe45c68,['ids','id'])||{},{'fields':_[_0x6e83('0x3c')](_0x1a4010),'raw':!![]})['then'](function(_0x362ba2){_0x7dba34[_0x6e83('0x68')][_0x6e83('0x69')](_0x362ba2[_0x6e83('0x6a')]);})['catch'](function(_0x1c5ade){_0x7dba34[_0x6e83('0x6b')][_0x6e83('0x69')]({'data':_0xe45c68,'error':_0x1c5ade[_0x6e83('0x6c')]});});})[_0x6e83('0x2a')](function(_0x329c77){return _0x7dba34;})[_0x6e83('0x4c')](function(_0x443440){return _0x443440;});}else{_0x90f22c[_0x6e83('0x1e')](0x190)[_0x6e83('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x90f22c,null))[_0x6e83('0x4c')](handleError(_0x90f22c,null));};exports[_0x6e83('0x6d')]=function(_0x1fa37b,_0x1313dd,_0x43290b){var _0x3a9d67;return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x1fa37b['params']['id']},'include':[{'model':db[_0x6e83('0x6e')],'as':_0x6e83('0x6f')}]})[_0x6e83('0x2a')](handleEntityNotFound(_0x1313dd,null))['then'](function(_0x20ad27){if(_0x20ad27){_0x3a9d67=_0x20ad27;return db[_0x6e83('0x64')][_0x6e83('0x36')];}})[_0x6e83('0x2a')](function(_0x2a19e4){if(_0x2a19e4){var _0x1249e7={};var _0x474696={};_0x474696[_0x6e83('0x3a')]=_['concat'](_[_0x6e83('0x3c')](_0x2a19e4),_[_0x6e83('0x34')](_0x3a9d67[_0x6e83('0x6f')],function(_0x1d26a6){return util['format'](_0x6e83('0x70'),_0x1d26a6['id']);}));_0x474696[_0x6e83('0x3b')]=_['keys'](_0x1fa37b['query']);_0x474696[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x474696['model'],_0x474696[_0x6e83('0x3b')]);_0x1249e7[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x474696['model'],qs[_0x6e83('0x40')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x1249e7[_0x6e83('0x3f')]=_0x1249e7[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x1249e7[_0x6e83('0x3f')]:_0x474696[_0x6e83('0x3a')];if(!_0x1fa37b['query'][_0x6e83('0x41')](_0x6e83('0x60'))){_0x1249e7[_0x6e83('0x23')]=qs[_0x6e83('0x23')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x1249e7[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x22')]);}_0x1249e7[_0x6e83('0x42')]=qs[_0x6e83('0x43')](_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x1249e7[_0x6e83('0x44')]=qs['filters'](_['pick'](_0x1fa37b[_0x6e83('0x3b')],_0x474696[_0x6e83('0x3d')]));_0x1249e7[_0x6e83('0x71')]=!![];if(_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x1249e7['where']=_['merge'](_0x1249e7[_0x6e83('0x44')],{'$or':_['map'](_0x1249e7[_0x6e83('0x3f')],function(_0x34da27){var _0x498490={};_0x498490[_0x34da27]={'$like':'%'+_0x1fa37b[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x498490;})});}_0x1249e7=_[_0x6e83('0x47')]({},_0x1249e7,_0x1fa37b['options']);return _0x3a9d67[_0x6e83('0x6d')](_0x1249e7);}})[_0x6e83('0x2a')](respondWithResult(_0x1313dd,null))['catch'](handleError(_0x1313dd,null));};exports['getContactsCsv']=function(_0x4ec464,_0x29d1eb,_0x201bc8){var _0x3d11ed;return db['CmList'][_0x6e83('0x50')]({'where':{'id':_0x4ec464['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x6e83('0x6f')}]})[_0x6e83('0x2a')](handleEntityNotFound(_0x29d1eb,null))[_0x6e83('0x2a')](function(_0x17b68e){if(_0x17b68e){_0x3d11ed=_0x17b68e;return db[_0x6e83('0x64')]['rawAttributes'];}})[_0x6e83('0x2a')](function(_0x597071){if(_0x597071){var _0x25e51c={};var _0x392b6f={};_0x392b6f[_0x6e83('0x3a')]=_[_0x6e83('0x72')](_['keys'](_0x597071),_['map'](_0x3d11ed['CustomFields'],function(_0x542587){return util['format'](_0x6e83('0x70'),_0x542587['id']);}));_0x392b6f[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x4ec464[_0x6e83('0x3b')]);_0x392b6f[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x392b6f[_0x6e83('0x3a')],_0x392b6f['query']);_0x25e51c['attributes']=_['intersection'](_0x392b6f['model'],qs[_0x6e83('0x40')](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x25e51c[_0x6e83('0x3f')]=_0x25e51c[_0x6e83('0x3f')]['length']?_0x25e51c[_0x6e83('0x3f')]:_0x392b6f[_0x6e83('0x3a')];if(!_0x4ec464[_0x6e83('0x3b')]['hasOwnProperty'](_0x6e83('0x60'))){_0x25e51c[_0x6e83('0x23')]=qs['limit'](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x25e51c[_0x6e83('0x22')]=qs[_0x6e83('0x22')](_0x4ec464[_0x6e83('0x3b')]['offset']);}_0x25e51c['order']=qs[_0x6e83('0x43')](_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x25e51c[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x4ec464[_0x6e83('0x3b')],_0x392b6f['filters']));_0x25e51c[_0x6e83('0x71')]=!![];if(_0x4ec464[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x25e51c[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x25e51c[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x25e51c[_0x6e83('0x3f')],function(_0x4853d1){var _0x1b15df={};_0x1b15df[_0x4853d1]={'$like':'%'+_0x4ec464[_0x6e83('0x3b')]['filter']+'%'};return _0x1b15df;})});}_0x25e51c=_[_0x6e83('0x47')]({},_0x25e51c,_0x4ec464['options']);return _0x3d11ed[_0x6e83('0x6d')](_0x25e51c);}})[_0x6e83('0x2a')](function(_0x588231){if(!_[_0x6e83('0x73')](_0x588231)){var _0x592311=toCsv(_0x588231);var _0x2d11c9=Date[_0x6e83('0x74')]();fs[_0x6e83('0x75')](util[_0x6e83('0x76')](_0x6e83('0x77'),_0x3d11ed['id'],_0x2d11c9),_0x592311);_0x29d1eb[_0x6e83('0x78')](_0x6e83('0x79'),_0x6e83('0x7a')+util[_0x6e83('0x76')](_0x6e83('0x7b'),_0x3d11ed['id'],_0x2d11c9));_0x29d1eb[_0x6e83('0x78')](_0x6e83('0x7c'),_0x6e83('0x7d'));return _0x29d1eb[_0x6e83('0x7e')](util[_0x6e83('0x76')](_0x6e83('0x77'),_0x3d11ed['id'],_0x2d11c9));}else{return _0x29d1eb[_0x6e83('0x2e')](0xcc);}})[_0x6e83('0x4c')](handleError(_0x29d1eb,null));};exports[_0x6e83('0x7f')]=function(_0x117c1d,_0x2d1d8b,_0x2d2d07){var _0x171bb2;delete _0x117c1d['body']['id'];return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x117c1d[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x2d1d8b,null))[_0x6e83('0x2a')](function(_0x205a99){if(_0x205a99){return db[_0x6e83('0x80')][_0x6e83('0x81')](function(_0x5561e1){return db[_0x6e83('0x6e')]['create'](_0x117c1d[_0x6e83('0x52')],{'transaction':_0x5561e1})['then'](function(_0x32c7e8){_0x171bb2=_0x32c7e8;return _0x205a99[_0x6e83('0x82')](_0x32c7e8,{'transaction':_0x5561e1});})[_0x6e83('0x2a')](function(){var _0xfb8013={'type':db['Sequelize'][_0x6e83('0x83')],'transaction':_0x5561e1};switch(_0x117c1d['body'][_0x6e83('0x38')]){case _0x6e83('0x84'):_0xfb8013['type']=db[_0x6e83('0x85')][_0x6e83('0x83')];break;case _0x6e83('0x86'):_0xfb8013[_0x6e83('0x38')]=db['Sequelize'][_0x6e83('0x87')];break;case _0x6e83('0x88'):_0xfb8013[_0x6e83('0x38')]=db[_0x6e83('0x85')][_0x6e83('0x89')];_0xfb8013[_0x6e83('0x8a')]=![];break;default:}return db[_0x6e83('0x80')][_0x6e83('0x8b')]['addColumn'](_0x6e83('0x8c'),util[_0x6e83('0x76')]('cf_%s',_0x171bb2['id']),_0xfb8013);})[_0x6e83('0x2a')](function(){return _0x171bb2;});});}})[_0x6e83('0x2a')](respondWithResult(_0x2d1d8b,null))[_0x6e83('0x4c')](handleError(_0x2d1d8b,null));};exports[_0x6e83('0x8d')]=function(_0x489eb6,_0x511bde,_0x89c9a2){var _0x970e43={};var _0x2bc93e={};var _0x5d67e4;var _0x562ddb;return db[_0x6e83('0x35')][_0x6e83('0x5e')]({'where':{'id':_0x489eb6[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x511bde,null))[_0x6e83('0x2a')](function(_0xf63946){if(_0xf63946){_0x5d67e4=_0xf63946;_0x2bc93e['model']=_[_0x6e83('0x3c')](db['CmCustomField'][_0x6e83('0x36')]);_0x2bc93e[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x489eb6['query']);_0x2bc93e[_0x6e83('0x3d')]=_[_0x6e83('0x3e')](_0x2bc93e[_0x6e83('0x3a')],_0x2bc93e['query']);_0x970e43['attributes']=_[_0x6e83('0x3e')](_0x2bc93e[_0x6e83('0x3a')],qs['fields'](_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x970e43[_0x6e83('0x3f')]=_0x970e43[_0x6e83('0x3f')][_0x6e83('0x5f')]?_0x970e43['attributes']:_0x2bc93e['model'];_0x970e43[_0x6e83('0x42')]=qs['sort'](_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x970e43[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x489eb6[_0x6e83('0x3b')],_0x2bc93e[_0x6e83('0x3d')]));_0x970e43[_0x6e83('0x44')]=_[_0x6e83('0x47')](_0x970e43['where'],{'$or':[{'ListId':_0xf63946['id']},{'ListId':null}]});if(_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x970e43['where']=_[_0x6e83('0x47')](_0x970e43[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x970e43[_0x6e83('0x3f')],function(_0x5318c4){var _0x1f0fbe={};_0x1f0fbe[_0x5318c4]={'$like':'%'+_0x489eb6[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1f0fbe;})});}_0x970e43=_[_0x6e83('0x47')]({},_0x970e43,_0x489eb6[_0x6e83('0x48')]);return db['CmCustomField'][_0x6e83('0x8e')](_0x970e43);}})[_0x6e83('0x2a')](respondWithResult(_0x511bde,null))[_0x6e83('0x4c')](handleError(_0x511bde,null));};exports[_0x6e83('0x8f')]=function(_0x544d92,_0x4ac6fc,_0x35cfdb){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x544d92['params']['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x4ac6fc,null))[_0x6e83('0x2a')](function(_0x4f78a1){if(_0x4f78a1){return _0x4f78a1[_0x6e83('0x8f')](_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')],_['omit'](_0x544d92['body'],['ids','id'])||{})[_0x6e83('0x90')](function(_0x1e5478){for(var _0x35ece3=0x0;_0x35ece3<_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')][_0x6e83('0x5f')];_0x35ece3+=0x1){socket[_0x6e83('0x91')](_0x6e83('0x92'),{'UserId':_0x544d92[_0x6e83('0x52')][_0x6e83('0x62')][_0x35ece3],'CmListId':_0x544d92[_0x6e83('0x4e')]['id']});}return _0x1e5478;});}})[_0x6e83('0x2a')](respondWithResult(_0x4ac6fc,null))[_0x6e83('0x4c')](handleError(_0x4ac6fc,null));};exports[_0x6e83('0x93')]=function(_0x3631f5,_0x281b5c,_0x3c5f97){return db[_0x6e83('0x35')][_0x6e83('0x50')]({'where':{'id':_0x3631f5[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x281b5c,null))[_0x6e83('0x2a')](function(_0x5342eb){if(_0x5342eb){return _0x5342eb[_0x6e83('0x93')](_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')])['then'](function(){if(_[_0x6e83('0x66')](_0x3631f5['query'][_0x6e83('0x62')])){for(var _0x3488bb=0x0;_0x3488bb<_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')][_0x6e83('0x5f')];_0x3488bb+=0x1){socket[_0x6e83('0x91')](_0x6e83('0x94'),{'UserId':Number(_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')][_0x3488bb]),'CmListId':Number(_0x3631f5[_0x6e83('0x4e')]['id'])});}}else{socket['emit'](_0x6e83('0x94'),{'UserId':Number(_0x3631f5[_0x6e83('0x3b')][_0x6e83('0x62')]),'CmListId':Number(_0x3631f5['params']['id'])});}});}})['then'](respondWithStatusCode(_0x281b5c,null))[_0x6e83('0x4c')](handleError(_0x281b5c,null));};exports[_0x6e83('0x95')]=function(_0x36e7f7,_0x2e8030,_0xa71d12){var _0x51c94d={};var _0x44d5e8={};var _0x1e050b;var _0x1d6274;return db[_0x6e83('0x35')]['findOne']({'where':{'id':_0x36e7f7[_0x6e83('0x4e')]['id']}})[_0x6e83('0x2a')](handleEntityNotFound(_0x2e8030,null))[_0x6e83('0x2a')](function(_0x5d4a9b){if(_0x5d4a9b){_0x1e050b=_0x5d4a9b;_0x44d5e8[_0x6e83('0x3a')]=_['keys'](db[_0x6e83('0x96')][_0x6e83('0x36')]);_0x44d5e8[_0x6e83('0x3b')]=_[_0x6e83('0x3c')](_0x36e7f7['query']);_0x44d5e8[_0x6e83('0x3d')]=_['intersection'](_0x44d5e8[_0x6e83('0x3a')],_0x44d5e8[_0x6e83('0x3b')]);_0x51c94d[_0x6e83('0x3f')]=_[_0x6e83('0x3e')](_0x44d5e8['model'],qs[_0x6e83('0x40')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x40')]));_0x51c94d[_0x6e83('0x3f')]=_0x51c94d['attributes'][_0x6e83('0x5f')]?_0x51c94d[_0x6e83('0x3f')]:_0x44d5e8[_0x6e83('0x3a')];_0x51c94d['order']=qs[_0x6e83('0x43')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x43')]);_0x51c94d[_0x6e83('0x44')]=qs[_0x6e83('0x3d')](_[_0x6e83('0x45')](_0x36e7f7[_0x6e83('0x3b')],_0x44d5e8['filters']));if(_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x46')]){_0x51c94d[_0x6e83('0x44')]=_['merge'](_0x51c94d[_0x6e83('0x44')],{'$or':_[_0x6e83('0x34')](_0x51c94d['attributes'],function(_0x54fd3d){var _0x1ec157={};_0x1ec157[_0x54fd3d]={'$like':'%'+_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x46')]+'%'};return _0x1ec157;})});}_0x51c94d=_[_0x6e83('0x47')]({},_0x51c94d,_0x36e7f7[_0x6e83('0x48')]);return _0x1e050b[_0x6e83('0x95')](_0x51c94d);}})['then'](function(_0x288620){if(_0x288620){_0x1d6274=_0x288620[_0x6e83('0x5f')];if(!_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x41')](_0x6e83('0x60'))){_0x51c94d['limit']=qs[_0x6e83('0x23')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x23')]);_0x51c94d['offset']=qs[_0x6e83('0x22')](_0x36e7f7[_0x6e83('0x3b')][_0x6e83('0x22')]);}return _0x1e050b[_0x6e83('0x95')](_0x51c94d);}})['then'](function(_0x225dcb){if(_0x225dcb){return _0x225dcb?{'count':_0x1d6274,'rows':_0x225dcb}:null;}})[_0x6e83('0x2a')](respondWithResult(_0x2e8030,null))[_0x6e83('0x4c')](handleError(_0x2e8030,null));}; \ No newline at end of file +var _0x7b5c=['/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','then','get','destroy','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','fields','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','findOne','Disposition','options','removeDispositions','ids','CmContact','tags','isArray','join','each','omit','success','push','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','cf_%d','sort','pick','raw','concat','now','format'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7b5c,0x1bf));var _0xc7b5=function(_0x25db89,_0x4c8dbf){_0x25db89=_0x25db89-0x0;var _0x476b22=_0x7b5c[_0x25db89];return _0x476b22;};'use strict';var pdf=require(_0xc7b5('0x0'));var emlformat=require(_0xc7b5('0x1'));var rimraf=require(_0xc7b5('0x2'));var zipdir=require(_0xc7b5('0x3'));var jsonpatch=require(_0xc7b5('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc7b5('0x5'));var Mustache=require(_0xc7b5('0x6'));var util=require(_0xc7b5('0x7'));var path=require(_0xc7b5('0x8'));var sox=require(_0xc7b5('0x9'));var csv=require(_0xc7b5('0xa'));var ejs=require(_0xc7b5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc7b5('0xc'));var crypto=require(_0xc7b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc7b5('0xe'));var toCsv=require(_0xc7b5('0xa'));var querystring=require(_0xc7b5('0xf'));var Papa=require(_0xc7b5('0x10'));var Redis=require(_0xc7b5('0x11'));var authService=require(_0xc7b5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7b5('0x13'));var logger=require(_0xc7b5('0x14'))(_0xc7b5('0x15'));var utils=require(_0xc7b5('0x16'));var config=require('../../config/environment');var db=require(_0xc7b5('0x17'))['db'];config[_0xc7b5('0x18')]=_[_0xc7b5('0x19')](config[_0xc7b5('0x18')],{'host':_0xc7b5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc7b5('0x1b'))[_0xc7b5('0x1c')](socket);function respondWithStatusCode(_0x252e42,_0x1b4e47){_0x1b4e47=_0x1b4e47||0xcc;return function(_0x258d1d){if(_0x258d1d){return _0x252e42[_0xc7b5('0x1d')](_0x1b4e47);}return _0x252e42[_0xc7b5('0x1e')](_0x1b4e47)['end']();};}function respondWithResult(_0x2c3efe,_0x14ae7a){_0x14ae7a=_0x14ae7a||0xc8;return function(_0x556aeb){if(_0x556aeb){return _0x2c3efe['status'](_0x14ae7a)[_0xc7b5('0x1f')](_0x556aeb);}};}function respondWithFilteredResult(_0x1f45db,_0x1cc65c){return function(_0xb20182){if(_0xb20182){var _0x218fc1=_0xb20182[_0xc7b5('0x20')],_0x1d17a5=_0x1cc65c['offset'],_0x5aa605=_0x1cc65c[_0xc7b5('0x21')]+_0x1cc65c[_0xc7b5('0x22')],_0x5f3263;if(_0x5aa605>=_0x218fc1){_0x5aa605=_0x218fc1;_0x5f3263=0xc8;}else{_0x5f3263=0xce;}_0x1f45db['status'](_0x5f3263);return _0x1f45db[_0xc7b5('0x23')](_0xc7b5('0x24'),_0x1d17a5+'-'+_0x5aa605+'/'+_0x218fc1)['json'](_0xb20182);}return null;};}function patchUpdates(_0x44978f){return function(_0x24bde0){try{jsonpatch['apply'](_0x24bde0,_0x44978f,!![]);}catch(_0x17a73e){return BPromise['reject'](_0x17a73e);}return _0x24bde0['save']();};}function saveUpdates(_0x43a168,_0x3b7906){return function(_0x4b4f98){if(_0x4b4f98){return _0x4b4f98['update'](_0x43a168)[_0xc7b5('0x25')](function(_0xfaa0cd){return _0xfaa0cd;});}return null;};}function removeEntity(_0x2dab21,_0x45344a){return function(_0x25ed71){if(_0x25ed71){return _0x25ed71['destroy']()['then'](function(){var _0x389fbd=_0x25ed71[_0xc7b5('0x26')]({'plain':!![]});var _0x411e27='Lists';return db['UserProfileResource'][_0xc7b5('0x27')]({'where':{'type':_0x411e27,'resourceId':_0x389fbd['id']}})[_0xc7b5('0x25')](function(){return _0x25ed71;});})[_0xc7b5('0x25')](function(){_0x2dab21[_0xc7b5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23cc16,_0x38cee3){return function(_0x39eb78){if(!_0x39eb78){_0x23cc16[_0xc7b5('0x1d')](0x194);}return _0x39eb78;};}function handleError(_0x2e03fe,_0x37d889){_0x37d889=_0x37d889||0x1f4;return function(_0x57acd2){logger['error'](_0x57acd2[_0xc7b5('0x28')]);if(_0x57acd2[_0xc7b5('0x29')]){delete _0x57acd2['name'];}_0x2e03fe[_0xc7b5('0x1e')](_0x37d889)['send'](_0x57acd2);};}exports[_0xc7b5('0x2a')]=function(_0x3529a5,_0x3b5a75){var _0x55c6b4={},_0x41d83a={},_0x4316fb={'count':0x0,'rows':[]};var _0x1b7a9b=_[_0xc7b5('0x2b')](db[_0xc7b5('0x2c')][_0xc7b5('0x2d')],function(_0x49bd78){return{'name':_0x49bd78[_0xc7b5('0x2e')],'type':_0x49bd78[_0xc7b5('0x2f')][_0xc7b5('0x30')]};});_0x41d83a[_0xc7b5('0x31')]=_[_0xc7b5('0x2b')](_0x1b7a9b,_0xc7b5('0x29'));_0x41d83a[_0xc7b5('0x32')]=_['keys'](_0x3529a5[_0xc7b5('0x32')]);_0x41d83a[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x41d83a['model'],_0x41d83a[_0xc7b5('0x32')]);_0x55c6b4['attributes']=_[_0xc7b5('0x34')](_0x41d83a['model'],qs['fields'](_0x3529a5[_0xc7b5('0x32')]['fields']));_0x55c6b4[_0xc7b5('0x35')]=_0x55c6b4[_0xc7b5('0x35')][_0xc7b5('0x36')]?_0x55c6b4['attributes']:_0x41d83a[_0xc7b5('0x31')];if(!_0x3529a5[_0xc7b5('0x32')][_0xc7b5('0x37')](_0xc7b5('0x38'))){_0x55c6b4[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x3529a5[_0xc7b5('0x32')][_0xc7b5('0x22')]);_0x55c6b4['offset']=qs[_0xc7b5('0x21')](_0x3529a5[_0xc7b5('0x32')]['offset']);}_0x55c6b4[_0xc7b5('0x39')]=qs['sort'](_0x3529a5[_0xc7b5('0x32')]['sort']);_0x55c6b4[_0xc7b5('0x3a')]=qs[_0xc7b5('0x33')](_['pick'](_0x3529a5['query'],_0x41d83a[_0xc7b5('0x33')]),_0x1b7a9b);if(_0x3529a5[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x55c6b4[_0xc7b5('0x3a')]=_[_0xc7b5('0x3c')](_0x55c6b4[_0xc7b5('0x3a')],{'$or':_['map'](_0x1b7a9b,function(_0x4851b6){if(_0x4851b6['type']!==_0xc7b5('0x3d')){var _0x36a835={};_0x36a835[_0x4851b6[_0xc7b5('0x29')]]={'$like':'%'+_0x3529a5[_0xc7b5('0x32')][_0xc7b5('0x3b')]+'%'};return _0x36a835;}})});}_0x55c6b4=_['merge']({},_0x55c6b4,_0x3529a5['options']);var _0x30c928={'where':_0x55c6b4[_0xc7b5('0x3a')]};return db[_0xc7b5('0x2c')][_0xc7b5('0x20')](_0x30c928)[_0xc7b5('0x25')](function(_0x42930e){_0x4316fb['count']=_0x42930e;if(_0x3529a5[_0xc7b5('0x32')][_0xc7b5('0x3e')]){_0x55c6b4['include']=[{'all':!![]}];}return db[_0xc7b5('0x2c')][_0xc7b5('0x3f')](_0x55c6b4);})[_0xc7b5('0x25')](function(_0x5429ed){_0x4316fb[_0xc7b5('0x40')]=_0x5429ed;return _0x4316fb;})['then'](respondWithFilteredResult(_0x3b5a75,_0x55c6b4))[_0xc7b5('0x41')](handleError(_0x3b5a75,null));};exports[_0xc7b5('0x42')]=function(_0x24d07f,_0x282923){var _0x59b171={'raw':![],'where':{'id':_0x24d07f[_0xc7b5('0x43')]['id']}},_0x2e0fee={};_0x2e0fee[_0xc7b5('0x31')]=_['keys'](db['CmList'][_0xc7b5('0x2d')]);_0x2e0fee[_0xc7b5('0x32')]=_[_0xc7b5('0x44')](_0x24d07f[_0xc7b5('0x32')]);_0x2e0fee['filters']=_['intersection'](_0x2e0fee[_0xc7b5('0x31')],_0x2e0fee['query']);_0x59b171[_0xc7b5('0x35')]=_['intersection'](_0x2e0fee[_0xc7b5('0x31')],qs[_0xc7b5('0x45')](_0x24d07f[_0xc7b5('0x32')]['fields']));_0x59b171['attributes']=_0x59b171['attributes'][_0xc7b5('0x36')]?_0x59b171[_0xc7b5('0x35')]:_0x2e0fee[_0xc7b5('0x31')];if(_0x24d07f[_0xc7b5('0x32')]['includeAll']){_0x59b171[_0xc7b5('0x46')]=[{'all':!![]}];}_0x59b171=_['merge']({},_0x59b171,_0x24d07f['options']);return db[_0xc7b5('0x2c')][_0xc7b5('0x47')](_0x59b171)[_0xc7b5('0x25')](handleEntityNotFound(_0x282923,null))['then'](respondWithResult(_0x282923,null))[_0xc7b5('0x41')](handleError(_0x282923,null));};exports[_0xc7b5('0x48')]=function(_0x35c8c9,_0x5efaed){return db['CmList'][_0xc7b5('0x48')](_0x35c8c9[_0xc7b5('0x49')],{})[_0xc7b5('0x25')](function(_0x3e6869){var _0x2d5e0c=_0x35c8c9[_0xc7b5('0x4a')][_0xc7b5('0x26')]({'plain':!![]});if(!_0x2d5e0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d5e0c[_0xc7b5('0x4b')]==='user'){var _0x5f4ebe=_0x3e6869[_0xc7b5('0x26')]({'plain':!![]});var _0x47cf2f='Lists';return db[_0xc7b5('0x4c')][_0xc7b5('0x47')]({'where':{'name':_0x47cf2f,'userProfileId':_0x2d5e0c[_0xc7b5('0x4d')]},'raw':!![]})[_0xc7b5('0x25')](function(_0xc14a12){if(_0xc14a12&&_0xc14a12[_0xc7b5('0x4e')]===0x0){return db[_0xc7b5('0x4f')][_0xc7b5('0x48')]({'name':_0x5f4ebe[_0xc7b5('0x29')],'resourceId':_0x5f4ebe['id'],'type':_0xc14a12[_0xc7b5('0x29')],'sectionId':_0xc14a12['id']},{})[_0xc7b5('0x25')](function(){return _0x3e6869;});}else{return _0x3e6869;}})[_0xc7b5('0x41')](function(_0x3d9d22){logger[_0xc7b5('0x50')](_0xc7b5('0x51'),_0x3d9d22);throw _0x3d9d22;});}return _0x3e6869;})[_0xc7b5('0x25')](respondWithResult(_0x5efaed,0xc9))[_0xc7b5('0x41')](handleError(_0x5efaed,null));};exports['update']=function(_0xfbdce7,_0x149c76){if(_0xfbdce7[_0xc7b5('0x49')]['id']){delete _0xfbdce7[_0xc7b5('0x49')]['id'];}return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0xfbdce7[_0xc7b5('0x43')]['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x149c76,null))[_0xc7b5('0x25')](saveUpdates(_0xfbdce7[_0xc7b5('0x49')],null))[_0xc7b5('0x25')](respondWithResult(_0x149c76,null))[_0xc7b5('0x41')](handleError(_0x149c76,null));};exports[_0xc7b5('0x27')]=function(_0x6c41bf,_0x5b7abc){return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0x6c41bf[_0xc7b5('0x43')]['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x5b7abc,null))[_0xc7b5('0x25')](removeEntity(_0x5b7abc,null))['catch'](handleError(_0x5b7abc,null));};exports[_0xc7b5('0x52')]=function(_0x3509b0,_0x5f4815){return db[_0xc7b5('0x2c')][_0xc7b5('0x52')]()[_0xc7b5('0x25')](respondWithResult(_0x5f4815,null))[_0xc7b5('0x41')](handleError(_0x5f4815,null));};exports['addDisposition']=function(_0x4a5e6e,_0x3ca2ca,_0x3fc1b5){if(_0x4a5e6e[_0xc7b5('0x49')]['id']){delete _0x4a5e6e[_0xc7b5('0x49')]['id'];}return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0x4a5e6e[_0xc7b5('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ca2ca,null))[_0xc7b5('0x25')](function(_0x50ff1e){if(_0x50ff1e){_0x4a5e6e['body'][_0xc7b5('0x53')]=_0x50ff1e['id'];return db['Disposition'][_0xc7b5('0x48')](_0x4a5e6e[_0xc7b5('0x49')]);}})[_0xc7b5('0x25')](respondWithResult(_0x3ca2ca,null))['catch'](handleError(_0x3ca2ca,null));};exports['getDispositions']=function(_0x47b79d,_0x2d9417,_0x14fe1a){var _0x4d8241={'raw':![],'where':{}};var _0x400dbc={};var _0x506889={'count':0x0,'rows':[]};return db[_0xc7b5('0x2c')][_0xc7b5('0x54')]({'where':{'id':_0x47b79d['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x2d9417,null))['then'](function(_0x19d480){if(_0x19d480){_0x400dbc[_0xc7b5('0x31')]=_['keys'](db[_0xc7b5('0x55')]['rawAttributes']);_0x400dbc[_0xc7b5('0x32')]=_[_0xc7b5('0x44')](_0x47b79d[_0xc7b5('0x32')]);_0x400dbc[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x400dbc[_0xc7b5('0x31')],_0x400dbc[_0xc7b5('0x32')]);_0x4d8241[_0xc7b5('0x35')]=_[_0xc7b5('0x34')](_0x400dbc[_0xc7b5('0x31')],qs[_0xc7b5('0x45')](_0x47b79d[_0xc7b5('0x32')][_0xc7b5('0x45')]));_0x4d8241['attributes']=_0x4d8241[_0xc7b5('0x35')][_0xc7b5('0x36')]?_0x4d8241[_0xc7b5('0x35')]:_0x400dbc[_0xc7b5('0x31')];if(!_0x47b79d['query']['hasOwnProperty'](_0xc7b5('0x38'))){_0x4d8241['limit']=qs[_0xc7b5('0x22')](_0x47b79d['query'][_0xc7b5('0x22')]);_0x4d8241[_0xc7b5('0x21')]=qs['offset'](_0x47b79d[_0xc7b5('0x32')][_0xc7b5('0x21')]);}_0x4d8241['order']=qs['sort'](_0x47b79d[_0xc7b5('0x32')]['sort']);_0x4d8241[_0xc7b5('0x3a')]=qs[_0xc7b5('0x33')](_['pick'](_0x47b79d[_0xc7b5('0x32')],_0x400dbc[_0xc7b5('0x33')]));_0x4d8241[_0xc7b5('0x3a')][_0xc7b5('0x53')]=_0x19d480['id'];if(_0x47b79d[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x4d8241[_0xc7b5('0x3a')]=_[_0xc7b5('0x3c')](_0x4d8241[_0xc7b5('0x3a')],{'$or':_[_0xc7b5('0x2b')](_0x4d8241[_0xc7b5('0x35')],function(_0xaa125b){var _0x5dc058={};_0x5dc058[_0xaa125b]={'$like':'%'+_0x47b79d[_0xc7b5('0x32')][_0xc7b5('0x3b')]+'%'};return _0x5dc058;})});}_0x4d8241=_[_0xc7b5('0x3c')]({},_0x4d8241,_0x47b79d[_0xc7b5('0x56')]);return db[_0xc7b5('0x55')][_0xc7b5('0x20')]({'where':_0x4d8241[_0xc7b5('0x3a')]})[_0xc7b5('0x25')](function(_0x4d8a88){_0x506889['count']=_0x4d8a88;if(_0x47b79d[_0xc7b5('0x32')][_0xc7b5('0x3e')]){_0x4d8241['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4d8241);})['then'](function(_0x50a28c){_0x506889[_0xc7b5('0x40')]=_0x50a28c;return _0x506889;});}})[_0xc7b5('0x25')](respondWithFilteredResult(_0x2d9417,_0x4d8241))[_0xc7b5('0x41')](handleError(_0x2d9417,null));};exports[_0xc7b5('0x57')]=function(_0xcd3430,_0x5005c5,_0x3c2426){return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0xcd3430['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x5005c5,null))[_0xc7b5('0x25')](function(_0x1ff9d5){if(_0x1ff9d5){return _0x1ff9d5[_0xc7b5('0x57')](_0xcd3430['query'][_0xc7b5('0x58')]);}})[_0xc7b5('0x25')](respondWithStatusCode(_0x5005c5,null))[_0xc7b5('0x41')](handleError(_0x5005c5,null));};exports['addContacts']=function(_0x1ab2b0,_0x380ee0,_0x496022){return db[_0xc7b5('0x2c')]['find']({'where':{'id':_0x1ab2b0[_0xc7b5('0x43')]['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x380ee0,null))[_0xc7b5('0x25')](function(_0x8a3384){if(_0x8a3384){var _0x522f56=[];var _0x58c627={'success':[],'errors':[]};return db[_0xc7b5('0x59')][_0xc7b5('0x52')]()['then'](function(_0x127372){if(_0x1ab2b0[_0xc7b5('0x49')][_0xc7b5('0x5a')]&&_[_0xc7b5('0x5b')](_0x1ab2b0[_0xc7b5('0x49')]['tags'])){if(_0x1ab2b0[_0xc7b5('0x49')][_0xc7b5('0x5a')]['length']){_0x1ab2b0['body'][_0xc7b5('0x5a')]=_0x1ab2b0[_0xc7b5('0x49')][_0xc7b5('0x5a')][_0xc7b5('0x5c')](';')+';';}else{_0x1ab2b0['body']['tags']=null;}}else{_0x1ab2b0['body'][_0xc7b5('0x5a')]=null;}if(_0x1ab2b0[_0xc7b5('0x49')]&&_[_0xc7b5('0x5b')](_0x1ab2b0[_0xc7b5('0x49')])){for(var _0x537cc6=0x0;_0x537cc6<_0x1ab2b0[_0xc7b5('0x49')]['length'];_0x537cc6+=0x1){_0x1ab2b0['body'][_0x537cc6][_0xc7b5('0x53')]=_0x1ab2b0[_0xc7b5('0x43')]['id'];_0x522f56['push'](_0x1ab2b0[_0xc7b5('0x49')][_0x537cc6]);}return BPromise[_0xc7b5('0x5d')](_0x522f56,function(_0x159d6b){return db[_0xc7b5('0x59')][_0xc7b5('0x48')](_[_0xc7b5('0x5e')](_0x159d6b,['ids','id'])||{},{'fields':_[_0xc7b5('0x44')](_0x127372),'raw':!![]})[_0xc7b5('0x25')](function(_0x218e17){_0x58c627[_0xc7b5('0x5f')][_0xc7b5('0x60')](_0x218e17['dataValues']);})[_0xc7b5('0x41')](function(_0x44e0cf){_0x58c627[_0xc7b5('0x61')][_0xc7b5('0x60')]({'data':_0x159d6b,'error':_0x44e0cf['message']});});})['then'](function(_0x2a0d61){return _0x58c627;})[_0xc7b5('0x41')](function(_0xa848e4){return _0xa848e4;});}else{_0x380ee0[_0xc7b5('0x1e')](0x190)[_0xc7b5('0x1f')]({'message':_0xc7b5('0x62')});}});}})[_0xc7b5('0x25')](respondWithResult(_0x380ee0,null))['catch'](handleError(_0x380ee0,null));};exports[_0xc7b5('0x63')]=function(_0x1bdb51,_0x19103c,_0x1c8dab){var _0x201330;return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0x1bdb51[_0xc7b5('0x43')]['id']},'include':[{'model':db[_0xc7b5('0x64')],'as':_0xc7b5('0x65')}]})[_0xc7b5('0x25')](handleEntityNotFound(_0x19103c,null))[_0xc7b5('0x25')](function(_0x81245d){if(_0x81245d){_0x201330=_0x81245d;return db[_0xc7b5('0x59')][_0xc7b5('0x2d')];}})[_0xc7b5('0x25')](function(_0x286ca7){if(_0x286ca7){var _0x39d707={};var _0x6a6d45={};_0x6a6d45[_0xc7b5('0x31')]=_['concat'](_[_0xc7b5('0x44')](_0x286ca7),_[_0xc7b5('0x2b')](_0x201330[_0xc7b5('0x65')],function(_0x4d8054){return util['format'](_0xc7b5('0x66'),_0x4d8054['id']);}));_0x6a6d45[_0xc7b5('0x32')]=_[_0xc7b5('0x44')](_0x1bdb51[_0xc7b5('0x32')]);_0x6a6d45[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x6a6d45['model'],_0x6a6d45[_0xc7b5('0x32')]);_0x39d707[_0xc7b5('0x35')]=_[_0xc7b5('0x34')](_0x6a6d45[_0xc7b5('0x31')],qs[_0xc7b5('0x45')](_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x45')]));_0x39d707[_0xc7b5('0x35')]=_0x39d707[_0xc7b5('0x35')][_0xc7b5('0x36')]?_0x39d707['attributes']:_0x6a6d45[_0xc7b5('0x31')];if(!_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x37')](_0xc7b5('0x38'))){_0x39d707[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x22')]);_0x39d707[_0xc7b5('0x21')]=qs['offset'](_0x1bdb51['query'][_0xc7b5('0x21')]);}_0x39d707[_0xc7b5('0x39')]=qs['sort'](_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x67')]);_0x39d707[_0xc7b5('0x3a')]=qs[_0xc7b5('0x33')](_[_0xc7b5('0x68')](_0x1bdb51[_0xc7b5('0x32')],_0x6a6d45['filters']));_0x39d707[_0xc7b5('0x69')]=!![];if(_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x39d707['where']=_['merge'](_0x39d707[_0xc7b5('0x3a')],{'$or':_[_0xc7b5('0x2b')](_0x39d707['attributes'],function(_0x449800){var _0x3d8e24={};_0x3d8e24[_0x449800]={'$like':'%'+_0x1bdb51[_0xc7b5('0x32')][_0xc7b5('0x3b')]+'%'};return _0x3d8e24;})});}_0x39d707=_['merge']({},_0x39d707,_0x1bdb51[_0xc7b5('0x56')]);return _0x201330[_0xc7b5('0x63')](_0x39d707);}})[_0xc7b5('0x25')](respondWithResult(_0x19103c,null))[_0xc7b5('0x41')](handleError(_0x19103c,null));};exports['getContactsCsv']=function(_0x123188,_0x42a134,_0x291bdc){var _0x25c57b;return db[_0xc7b5('0x2c')]['find']({'where':{'id':_0x123188[_0xc7b5('0x43')]['id']},'include':[{'model':db[_0xc7b5('0x64')],'as':_0xc7b5('0x65')}]})[_0xc7b5('0x25')](handleEntityNotFound(_0x42a134,null))[_0xc7b5('0x25')](function(_0x3c6d44){if(_0x3c6d44){_0x25c57b=_0x3c6d44;return db[_0xc7b5('0x59')]['rawAttributes'];}})[_0xc7b5('0x25')](function(_0x27483c){if(_0x27483c){var _0x5a07a8={};var _0x1b0f77={};_0x1b0f77['model']=_[_0xc7b5('0x6a')](_[_0xc7b5('0x44')](_0x27483c),_[_0xc7b5('0x2b')](_0x25c57b[_0xc7b5('0x65')],function(_0x26b766){return util['format'](_0xc7b5('0x66'),_0x26b766['id']);}));_0x1b0f77[_0xc7b5('0x32')]=_[_0xc7b5('0x44')](_0x123188[_0xc7b5('0x32')]);_0x1b0f77[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x1b0f77[_0xc7b5('0x31')],_0x1b0f77[_0xc7b5('0x32')]);_0x5a07a8[_0xc7b5('0x35')]=_['intersection'](_0x1b0f77[_0xc7b5('0x31')],qs[_0xc7b5('0x45')](_0x123188[_0xc7b5('0x32')][_0xc7b5('0x45')]));_0x5a07a8[_0xc7b5('0x35')]=_0x5a07a8['attributes'][_0xc7b5('0x36')]?_0x5a07a8[_0xc7b5('0x35')]:_0x1b0f77[_0xc7b5('0x31')];if(!_0x123188[_0xc7b5('0x32')][_0xc7b5('0x37')](_0xc7b5('0x38'))){_0x5a07a8[_0xc7b5('0x22')]=qs['limit'](_0x123188[_0xc7b5('0x32')][_0xc7b5('0x22')]);_0x5a07a8[_0xc7b5('0x21')]=qs[_0xc7b5('0x21')](_0x123188[_0xc7b5('0x32')]['offset']);}_0x5a07a8[_0xc7b5('0x39')]=qs[_0xc7b5('0x67')](_0x123188[_0xc7b5('0x32')][_0xc7b5('0x67')]);_0x5a07a8[_0xc7b5('0x3a')]=qs[_0xc7b5('0x33')](_[_0xc7b5('0x68')](_0x123188[_0xc7b5('0x32')],_0x1b0f77[_0xc7b5('0x33')]));_0x5a07a8['raw']=!![];if(_0x123188[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x5a07a8[_0xc7b5('0x3a')]=_[_0xc7b5('0x3c')](_0x5a07a8[_0xc7b5('0x3a')],{'$or':_['map'](_0x5a07a8[_0xc7b5('0x35')],function(_0x584809){var _0x58bf6c={};_0x58bf6c[_0x584809]={'$like':'%'+_0x123188[_0xc7b5('0x32')][_0xc7b5('0x3b')]+'%'};return _0x58bf6c;})});}_0x5a07a8=_[_0xc7b5('0x3c')]({},_0x5a07a8,_0x123188['options']);return _0x25c57b[_0xc7b5('0x63')](_0x5a07a8);}})[_0xc7b5('0x25')](function(_0x2abe04){if(!_['isEmpty'](_0x2abe04)){var _0x3a181d=toCsv(_0x2abe04);var _0x4d11eb=Date[_0xc7b5('0x6b')]();fs['writeFileSync'](util[_0xc7b5('0x6c')](_0xc7b5('0x6d'),_0x25c57b['id'],_0x4d11eb),_0x3a181d);_0x42a134[_0xc7b5('0x6e')]('Content-disposition','attachment;\x20filename='+util['format'](_0xc7b5('0x6f'),_0x25c57b['id'],_0x4d11eb));_0x42a134['setHeader'](_0xc7b5('0x70'),_0xc7b5('0x71'));return _0x42a134[_0xc7b5('0x72')](util[_0xc7b5('0x6c')](_0xc7b5('0x6d'),_0x25c57b['id'],_0x4d11eb));}else{return _0x42a134['sendStatus'](0xcc);}})['catch'](handleError(_0x42a134,null));};exports[_0xc7b5('0x73')]=function(_0x385c48,_0x158972,_0x329ff1){var _0x2d93a4;delete _0x385c48[_0xc7b5('0x49')]['id'];return db[_0xc7b5('0x2c')]['findOne']({'where':{'id':_0x385c48['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x158972,null))[_0xc7b5('0x25')](function(_0x557b4b){if(_0x557b4b){return db[_0xc7b5('0x74')][_0xc7b5('0x75')](function(_0x1edc12){return db[_0xc7b5('0x64')][_0xc7b5('0x48')](_0x385c48[_0xc7b5('0x49')],{'transaction':_0x1edc12})[_0xc7b5('0x25')](function(_0x23f098){_0x2d93a4=_0x23f098;return _0x557b4b[_0xc7b5('0x76')](_0x23f098,{'transaction':_0x1edc12});})['then'](function(){var _0x4ab8e1={'type':db[_0xc7b5('0x77')][_0xc7b5('0x78')],'transaction':_0x1edc12};switch(_0x385c48[_0xc7b5('0x49')][_0xc7b5('0x2f')]){case _0xc7b5('0x79'):_0x4ab8e1[_0xc7b5('0x2f')]=db['Sequelize'][_0xc7b5('0x78')];break;case'number':_0x4ab8e1['type']=db[_0xc7b5('0x77')][_0xc7b5('0x7a')];break;case _0xc7b5('0x7b'):_0x4ab8e1[_0xc7b5('0x2f')]=db['Sequelize'][_0xc7b5('0x7c')];_0x4ab8e1[_0xc7b5('0x7d')]=![];break;default:}return db[_0xc7b5('0x74')][_0xc7b5('0x7e')][_0xc7b5('0x7f')](_0xc7b5('0x80'),util[_0xc7b5('0x6c')](_0xc7b5('0x81'),_0x2d93a4['id']),_0x4ab8e1);})['then'](function(){return _0x2d93a4;});});}})[_0xc7b5('0x25')](respondWithResult(_0x158972,null))['catch'](handleError(_0x158972,null));};exports[_0xc7b5('0x82')]=function(_0x252db9,_0x3cf70f,_0x48a04){var _0x317bfa={};var _0x4fd188={};var _0x242cf9;var _0xc39d0;return db[_0xc7b5('0x2c')][_0xc7b5('0x54')]({'where':{'id':_0x252db9[_0xc7b5('0x43')]['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x3cf70f,null))[_0xc7b5('0x25')](function(_0x42c8b5){if(_0x42c8b5){_0x242cf9=_0x42c8b5;_0x4fd188[_0xc7b5('0x31')]=_['keys'](db[_0xc7b5('0x64')]['rawAttributes']);_0x4fd188[_0xc7b5('0x32')]=_['keys'](_0x252db9[_0xc7b5('0x32')]);_0x4fd188[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x4fd188[_0xc7b5('0x31')],_0x4fd188['query']);_0x317bfa['attributes']=_['intersection'](_0x4fd188[_0xc7b5('0x31')],qs[_0xc7b5('0x45')](_0x252db9[_0xc7b5('0x32')][_0xc7b5('0x45')]));_0x317bfa[_0xc7b5('0x35')]=_0x317bfa[_0xc7b5('0x35')][_0xc7b5('0x36')]?_0x317bfa[_0xc7b5('0x35')]:_0x4fd188[_0xc7b5('0x31')];_0x317bfa[_0xc7b5('0x39')]=qs[_0xc7b5('0x67')](_0x252db9[_0xc7b5('0x32')]['sort']);_0x317bfa['where']=qs[_0xc7b5('0x33')](_[_0xc7b5('0x68')](_0x252db9[_0xc7b5('0x32')],_0x4fd188[_0xc7b5('0x33')]));_0x317bfa['where']=_[_0xc7b5('0x3c')](_0x317bfa[_0xc7b5('0x3a')],{'$or':[{'ListId':_0x42c8b5['id']},{'ListId':null}]});if(_0x252db9[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x317bfa[_0xc7b5('0x3a')]=_[_0xc7b5('0x3c')](_0x317bfa[_0xc7b5('0x3a')],{'$or':_[_0xc7b5('0x2b')](_0x317bfa[_0xc7b5('0x35')],function(_0x1e6880){var _0x506563={};_0x506563[_0x1e6880]={'$like':'%'+_0x252db9['query']['filter']+'%'};return _0x506563;})});}_0x317bfa=_[_0xc7b5('0x3c')]({},_0x317bfa,_0x252db9[_0xc7b5('0x56')]);return db[_0xc7b5('0x64')][_0xc7b5('0x83')](_0x317bfa);}})[_0xc7b5('0x25')](respondWithResult(_0x3cf70f,null))[_0xc7b5('0x41')](handleError(_0x3cf70f,null));};exports['addAgents']=function(_0x3881ef,_0x2e7548,_0x37657a){return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0x3881ef['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x2e7548,null))[_0xc7b5('0x25')](function(_0x2650c1){if(_0x2650c1){return _0x2650c1[_0xc7b5('0x84')](_0x3881ef[_0xc7b5('0x49')][_0xc7b5('0x58')],_[_0xc7b5('0x5e')](_0x3881ef[_0xc7b5('0x49')],[_0xc7b5('0x58'),'id'])||{})[_0xc7b5('0x85')](function(_0x2acf7a){for(var _0x227ce1=0x0;_0x227ce1<_0x3881ef['body']['ids'][_0xc7b5('0x36')];_0x227ce1+=0x1){socket['emit'](_0xc7b5('0x86'),{'UserId':_0x3881ef['body']['ids'][_0x227ce1],'CmListId':_0x3881ef[_0xc7b5('0x43')]['id']});}return _0x2acf7a;});}})['then'](respondWithResult(_0x2e7548,null))[_0xc7b5('0x41')](handleError(_0x2e7548,null));};exports[_0xc7b5('0x87')]=function(_0x1169b7,_0xa777d5,_0x54ae73){return db[_0xc7b5('0x2c')][_0xc7b5('0x47')]({'where':{'id':_0x1169b7['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0xa777d5,null))[_0xc7b5('0x25')](function(_0x11a4e7){if(_0x11a4e7){return _0x11a4e7['removeAgents'](_0x1169b7['query'][_0xc7b5('0x58')])[_0xc7b5('0x25')](function(){if(_[_0xc7b5('0x5b')](_0x1169b7[_0xc7b5('0x32')]['ids'])){for(var _0x298c87=0x0;_0x298c87<_0x1169b7[_0xc7b5('0x32')]['ids']['length'];_0x298c87+=0x1){socket[_0xc7b5('0x88')](_0xc7b5('0x89'),{'UserId':Number(_0x1169b7['query']['ids'][_0x298c87]),'CmListId':Number(_0x1169b7[_0xc7b5('0x43')]['id'])});}}else{socket[_0xc7b5('0x88')](_0xc7b5('0x89'),{'UserId':Number(_0x1169b7['query'][_0xc7b5('0x58')]),'CmListId':Number(_0x1169b7[_0xc7b5('0x43')]['id'])});}});}})[_0xc7b5('0x25')](respondWithStatusCode(_0xa777d5,null))[_0xc7b5('0x41')](handleError(_0xa777d5,null));};exports['getAgents']=function(_0x233260,_0x25453b,_0x1f0db9){var _0x103fb6={};var _0x4b38a1={};var _0x203580;var _0x28ab27;return db[_0xc7b5('0x2c')][_0xc7b5('0x54')]({'where':{'id':_0x233260['params']['id']}})[_0xc7b5('0x25')](handleEntityNotFound(_0x25453b,null))[_0xc7b5('0x25')](function(_0x1b7037){if(_0x1b7037){_0x203580=_0x1b7037;_0x4b38a1['model']=_[_0xc7b5('0x44')](db['User']['rawAttributes']);_0x4b38a1['query']=_[_0xc7b5('0x44')](_0x233260[_0xc7b5('0x32')]);_0x4b38a1[_0xc7b5('0x33')]=_[_0xc7b5('0x34')](_0x4b38a1[_0xc7b5('0x31')],_0x4b38a1[_0xc7b5('0x32')]);_0x103fb6['attributes']=_[_0xc7b5('0x34')](_0x4b38a1['model'],qs['fields'](_0x233260['query']['fields']));_0x103fb6[_0xc7b5('0x35')]=_0x103fb6[_0xc7b5('0x35')][_0xc7b5('0x36')]?_0x103fb6[_0xc7b5('0x35')]:_0x4b38a1[_0xc7b5('0x31')];_0x103fb6[_0xc7b5('0x39')]=qs[_0xc7b5('0x67')](_0x233260[_0xc7b5('0x32')]['sort']);_0x103fb6['where']=qs['filters'](_[_0xc7b5('0x68')](_0x233260[_0xc7b5('0x32')],_0x4b38a1[_0xc7b5('0x33')]));if(_0x233260[_0xc7b5('0x32')][_0xc7b5('0x3b')]){_0x103fb6[_0xc7b5('0x3a')]=_[_0xc7b5('0x3c')](_0x103fb6[_0xc7b5('0x3a')],{'$or':_['map'](_0x103fb6['attributes'],function(_0x24e7ff){var _0x89bc68={};_0x89bc68[_0x24e7ff]={'$like':'%'+_0x233260[_0xc7b5('0x32')][_0xc7b5('0x3b')]+'%'};return _0x89bc68;})});}_0x103fb6=_[_0xc7b5('0x3c')]({},_0x103fb6,_0x233260[_0xc7b5('0x56')]);return _0x203580['getAgents'](_0x103fb6);}})[_0xc7b5('0x25')](function(_0x3c999d){if(_0x3c999d){_0x28ab27=_0x3c999d[_0xc7b5('0x36')];if(!_0x233260[_0xc7b5('0x32')][_0xc7b5('0x37')](_0xc7b5('0x38'))){_0x103fb6[_0xc7b5('0x22')]=qs[_0xc7b5('0x22')](_0x233260[_0xc7b5('0x32')][_0xc7b5('0x22')]);_0x103fb6[_0xc7b5('0x21')]=qs[_0xc7b5('0x21')](_0x233260[_0xc7b5('0x32')][_0xc7b5('0x21')]);}return _0x203580[_0xc7b5('0x8a')](_0x103fb6);}})['then'](function(_0x241157){if(_0x241157){return _0x241157?{'count':_0x28ab27,'rows':_0x241157}:null;}})[_0xc7b5('0x25')](respondWithResult(_0x25453b,null))['catch'](handleError(_0x25453b,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index daa7e72..5ef6c75 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 _0xb62a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update'];(function(_0x4e4ce2,_0x1bc008){var _0x173e4c=function(_0x41627e){while(--_0x41627e){_0x4e4ce2['push'](_0x4e4ce2['shift']());}};_0x173e4c(++_0x1bc008);}(_0xb62a,0x165));var _0xab62=function(_0x3d0bd4,_0x318324){_0x3d0bd4=_0x3d0bd4-0x0;var _0xe80876=_0xb62a[_0x3d0bd4];return _0xe80876;};'use strict';var EventEmitter=require(_0xab62('0x0'));var CmList=require(_0xab62('0x1'))['db'][_0xab62('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xab62('0x3')](0x0);var events={'afterCreate':_0xab62('0x4'),'afterUpdate':_0xab62('0x5'),'afterDestroy':_0xab62('0x6')};function emitEvent(_0x2d0916){return function(_0x50c058,_0x3a6017,_0x2773f3){CmListEvents[_0xab62('0x7')](_0x2d0916+':'+_0x50c058['id'],_0x50c058);CmListEvents[_0xab62('0x7')](_0x2d0916,_0x50c058);_0x2773f3(null);};}for(var e in events){if(events[_0xab62('0x8')](e)){var event=events[e];CmList[_0xab62('0x9')](e,emitEvent(event));}}module[_0xab62('0xa')]=CmListEvents; \ No newline at end of file +var _0x30c0=['events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x30c0,0x13e));var _0x030c=function(_0x555be1,_0x5394b1){_0x555be1=_0x555be1-0x0;var _0x281584=_0x30c0[_0x555be1];return _0x281584;};'use strict';var EventEmitter=require(_0x030c('0x0'));var CmList=require(_0x030c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x030c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x030c('0x3'),'afterDestroy':_0x030c('0x4')};function emitEvent(_0x1e1400){return function(_0x31af39,_0x5d292a,_0x2b6dbd){CmListEvents[_0x030c('0x5')](_0x1e1400+':'+_0x31af39['id'],_0x31af39);CmListEvents[_0x030c('0x5')](_0x1e1400,_0x31af39);_0x2b6dbd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](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 33a3495..415ab2c 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 _0xa8fe=['define','CmList','cm_lists','api','request-promise','path','rimraf','../../config/environment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa8fe,0xbb));var _0xea8f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa8fe[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xea8f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea8f('0x1'));var fs=require('fs');var path=require(_0xea8f('0x2'));var rimraf=require(_0xea8f('0x3'));var config=require(_0xea8f('0x4'));var attributes=require('./cmList.attributes');module['exports']=function(_0x32983e,_0x4893d9){return _0x32983e[_0xea8f('0x5')](_0xea8f('0x6'),attributes,{'tableName':_0xea8f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbce=['moment','bluebird','request-promise','path','./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api'];(function(_0x4b9fa6,_0x5f56d8){var _0x5f07ec=function(_0x3d9e6a){while(--_0x3d9e6a){_0x4b9fa6['push'](_0x4b9fa6['shift']());}};_0x5f07ec(++_0x5f56d8);}(_0xbbce,0x98));var _0xebbc=function(_0x96d040,_0x40131b){_0x96d040=_0x96d040-0x0;var _0x48da4d=_0xbbce[_0x96d040];return _0x48da4d;};'use strict';var _=require(_0xebbc('0x0'));var util=require(_0xebbc('0x1'));var logger=require(_0xebbc('0x2'))(_0xebbc('0x3'));var moment=require(_0xebbc('0x4'));var BPromise=require(_0xebbc('0x5'));var rp=require(_0xebbc('0x6'));var fs=require('fs');var path=require(_0xebbc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xebbc('0x8'));module[_0xebbc('0x9')]=function(_0x40d0f1,_0x1fc8a8){return _0x40d0f1[_0xebbc('0xa')]('CmList',attributes,{'tableName':_0xebbc('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 d860cc1..0038e96 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 _0xb011=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0xb011,0x12a));var _0x1b01=function(_0x547ec1,_0x7a5a46){_0x547ec1=_0x547ec1-0x0;var _0x2a6069=_0xb011[_0x547ec1];return _0x2a6069;};'use strict';var _=require('lodash');var util=require(_0x1b01('0x0'));var moment=require(_0x1b01('0x1'));var BPromise=require(_0x1b01('0x2'));var rs=require(_0x1b01('0x3'));var fs=require('fs');var Redis=require(_0x1b01('0x4'));var db=require(_0x1b01('0x5'))['db'];var utils=require(_0x1b01('0x6'));var logger=require('../../config/logger')(_0x1b01('0x7'));var config=require(_0x1b01('0x8'));var jayson=require(_0x1b01('0x9'));var client=jayson[_0x1b01('0xa')][_0x1b01('0xb')]({'port':0x232a});config[_0x1b01('0xc')]=_[_0x1b01('0xd')](config[_0x1b01('0xc')],{'host':_0x1b01('0xe'),'port':0x18eb});var socket=require(_0x1b01('0xf'))(new Redis(config[_0x1b01('0xc')]));require('./cmList.socket')[_0x1b01('0x10')](socket);function respondWithRpcPromise(_0x22fa4c,_0x4d7b3a,_0x2d31ad){return new BPromise(function(_0x19aa77,_0x5b942b){return client[_0x1b01('0x11')](_0x22fa4c,_0x2d31ad)[_0x1b01('0x12')](function(_0x598c88){logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,_0x1b01('0x15'));logger[_0x1b01('0x16')]('CmList,\x20%s,\x20%s,\x20%s',_0x4d7b3a,_0x1b01('0x15'),JSON['stringify'](_0x598c88));if(_0x598c88[_0x1b01('0x17')]){if(_0x598c88['error'][_0x1b01('0x18')]===0x1f4){logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88[_0x1b01('0x17')]['message']);return _0x5b942b(_0x598c88[_0x1b01('0x17')][_0x1b01('0x19')]);}logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88['error'][_0x1b01('0x19')]);return _0x19aa77(_0x598c88['error'][_0x1b01('0x19')]);}else{logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,'request\x20sent');_0x19aa77(_0x598c88[_0x1b01('0x1a')][_0x1b01('0x19')]);}})[_0x1b01('0x1b')](function(_0x10dcbf){logger['error'](_0x1b01('0x14'),_0x4d7b3a,_0x10dcbf);_0x5b942b(_0x10dcbf);});});} \ No newline at end of file +var _0x1d22=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x1c7f72,_0x391abe){var _0x1f98b5=function(_0x19436b){while(--_0x19436b){_0x1c7f72['push'](_0x1c7f72['shift']());}};_0x1f98b5(++_0x391abe);}(_0x1d22,0xa1));var _0x21d2=function(_0x2ed2de,_0x1a861d){_0x2ed2de=_0x2ed2de-0x0;var _0x2e0081=_0x1d22[_0x2ed2de];return _0x2e0081;};'use strict';var _=require(_0x21d2('0x0'));var util=require('util');var moment=require(_0x21d2('0x1'));var BPromise=require(_0x21d2('0x2'));var rs=require(_0x21d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21d2('0x4'))['db'];var utils=require(_0x21d2('0x5'));var logger=require(_0x21d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x21d2('0x7'));var client=jayson['client'][_0x21d2('0x8')]({'port':0x232a});config['redis']=_[_0x21d2('0x9')](config[_0x21d2('0xa')],{'host':_0x21d2('0xb'),'port':0x18eb});var socket=require(_0x21d2('0xc'))(new Redis(config[_0x21d2('0xa')]));require(_0x21d2('0xd'))[_0x21d2('0xe')](socket);function respondWithRpcPromise(_0x33cd07,_0x4e04fb,_0x2a9fa9){return new BPromise(function(_0x44bd30,_0xc31d70){return client[_0x21d2('0xf')](_0x33cd07,_0x2a9fa9)[_0x21d2('0x10')](function(_0x264141){logger['info'](_0x21d2('0x11'),_0x4e04fb,_0x21d2('0x12'));logger[_0x21d2('0x13')](_0x21d2('0x14'),_0x4e04fb,_0x21d2('0x12'),JSON['stringify'](_0x264141));if(_0x264141[_0x21d2('0x15')]){if(_0x264141[_0x21d2('0x15')]['code']===0x1f4){logger[_0x21d2('0x15')](_0x21d2('0x11'),_0x4e04fb,_0x264141[_0x21d2('0x15')][_0x21d2('0x16')]);return _0xc31d70(_0x264141[_0x21d2('0x15')]['message']);}logger[_0x21d2('0x15')](_0x21d2('0x11'),_0x4e04fb,_0x264141['error'][_0x21d2('0x16')]);return _0x44bd30(_0x264141[_0x21d2('0x15')]['message']);}else{logger[_0x21d2('0x17')](_0x21d2('0x11'),_0x4e04fb,_0x21d2('0x12'));_0x44bd30(_0x264141[_0x21d2('0x18')][_0x21d2('0x16')]);}})[_0x21d2('0x19')](function(_0x555b2a){logger[_0x21d2('0x15')]('CmList,\x20%s,\x20%s',_0x4e04fb,_0x555b2a);_0xc31d70(_0x555b2a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c5696a1..036a533 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 _0x4c9d=['removeListener','register','length','cmList:','./cmList.events','save','remove','emit'];(function(_0x641f18,_0x2919e8){var _0x16eefe=function(_0x578a89){while(--_0x578a89){_0x641f18['push'](_0x641f18['shift']());}};_0x16eefe(++_0x2919e8);}(_0x4c9d,0x7c));var _0xd4c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4c9d[_0x3ab51d];return _0x29a04e;};'use strict';var CmListEvents=require(_0xd4c9('0x0'));var events=[_0xd4c9('0x1'),_0xd4c9('0x2'),'update'];function createListener(_0x11e4e7,_0x13c911){return function(_0x173031){_0x13c911[_0xd4c9('0x3')](_0x11e4e7,_0x173031);};}function removeListener(_0x102345,_0x2b30d0){return function(){CmListEvents[_0xd4c9('0x4')](_0x102345,_0x2b30d0);};}exports[_0xd4c9('0x5')]=function(_0x2c81cb){for(var _0x5980e0=0x0,_0x48b511=events[_0xd4c9('0x6')];_0x5980e0<_0x48b511;_0x5980e0++){var _0x37b94e=events[_0x5980e0];var _0x3f9d50=createListener(_0xd4c9('0x7')+_0x37b94e,_0x2c81cb);CmListEvents['on'](_0x37b94e,_0x3f9d50);}}; \ No newline at end of file +var _0x96f1=['emit','removeListener','register','cmList:','./cmList.events','save','remove','update'];(function(_0x274923,_0xd41e23){var _0x10371d=function(_0x39ae86){while(--_0x39ae86){_0x274923['push'](_0x274923['shift']());}};_0x10371d(++_0xd41e23);}(_0x96f1,0x19c));var _0x196f=function(_0xb328fb,_0x2c62f2){_0xb328fb=_0xb328fb-0x0;var _0x1965c3=_0x96f1[_0xb328fb];return _0x1965c3;};'use strict';var CmListEvents=require(_0x196f('0x0'));var events=[_0x196f('0x1'),_0x196f('0x2'),_0x196f('0x3')];function createListener(_0x227254,_0x219e87){return function(_0xe61e26){_0x219e87[_0x196f('0x4')](_0x227254,_0xe61e26);};}function removeListener(_0x5b8eb5,_0x56fc61){return function(){CmListEvents[_0x196f('0x5')](_0x5b8eb5,_0x56fc61);};}exports[_0x196f('0x6')]=function(_0x267906){for(var _0x1f401c=0x0,_0x17f603=events['length'];_0x1f401c<_0x17f603;_0x1f401c++){var _0x427333=events[_0x1f401c];var _0x425e5c=createListener(_0x196f('0x7')+_0x427333,_0x267906);CmListEvents['on'](_0x427333,_0x425e5c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 34280d7..1f00037 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 _0x5e98=['isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','create','addDisposition','post','/:id/contacts','addContacts','addCustomField','addAgents','put','delete','removeDispositions','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5e98,0x128));var _0x85e9=function(_0x5a7627,_0x1cbc06){_0x5a7627=_0x5a7627-0x0;var _0x263d7d=_0x5e98[_0x5a7627];return _0x263d7d;};'use strict';var multer=require('multer');var util=require(_0x85e9('0x0'));var path=require(_0x85e9('0x1'));var timeout=require(_0x85e9('0x2'));var express=require(_0x85e9('0x3'));var router=express[_0x85e9('0x4')]();var auth=require(_0x85e9('0x5'));var interaction=require(_0x85e9('0x6'));var config=require(_0x85e9('0x7'));var controller=require(_0x85e9('0x8'));router[_0x85e9('0x9')]('/',auth[_0x85e9('0xa')](),controller[_0x85e9('0xb')]);router['get'](_0x85e9('0xc'),auth[_0x85e9('0xa')](),controller[_0x85e9('0xd')]);router[_0x85e9('0x9')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller[_0x85e9('0xf')]);router[_0x85e9('0x9')](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller['getDispositions']);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x85e9('0x11')]);router[_0x85e9('0x9')](_0x85e9('0x12'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x13')]);router[_0x85e9('0x9')](_0x85e9('0x14'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x15')]);router['get'](_0x85e9('0x16'),auth[_0x85e9('0xa')](),controller['getAgents']);router['post']('/',auth[_0x85e9('0xa')](),controller[_0x85e9('0x17')]);router['post'](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x18')]);router[_0x85e9('0x19')](_0x85e9('0x1a'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x1b')]);router[_0x85e9('0x19')](_0x85e9('0x14'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x1c')]);router[_0x85e9('0x19')](_0x85e9('0x16'),auth['isAuthenticated'](),controller[_0x85e9('0x1d')]);router[_0x85e9('0x1e')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller['update']);router[_0x85e9('0x1f')](_0x85e9('0xe'),auth[_0x85e9('0xa')](),controller['destroy']);router[_0x85e9('0x1f')](_0x85e9('0x10'),auth[_0x85e9('0xa')](),controller[_0x85e9('0x20')]);router[_0x85e9('0x1f')](_0x85e9('0x16'),auth[_0x85e9('0xa')](),controller['removeAgents']);module[_0x85e9('0x21')]=router; \ No newline at end of file +var _0x21e5=['show','/:id/dispositions','getDispositions','getContacts','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','/:id/fields','put','/:id','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21e5,0x1a5));var _0x521e=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x21e5[_0x14a0a0];return _0x56b651;};'use strict';var multer=require(_0x521e('0x0'));var util=require(_0x521e('0x1'));var path=require(_0x521e('0x2'));var timeout=require(_0x521e('0x3'));var express=require('express');var router=express[_0x521e('0x4')]();var auth=require(_0x521e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x521e('0x6'));var controller=require(_0x521e('0x7'));router[_0x521e('0x8')]('/',auth[_0x521e('0x9')](),controller[_0x521e('0xa')]);router[_0x521e('0x8')](_0x521e('0xb'),auth[_0x521e('0x9')](),controller[_0x521e('0xc')]);router[_0x521e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x521e('0xd')]);router['get'](_0x521e('0xe'),auth[_0x521e('0x9')](),controller[_0x521e('0xf')]);router['get']('/:id/contacts',auth[_0x521e('0x9')](),controller[_0x521e('0x10')]);router['get']('/:id/contacts/csv',auth[_0x521e('0x9')](),controller['getContactsCsv']);router[_0x521e('0x8')]('/:id/fields',auth[_0x521e('0x9')](),controller['getCustomFields']);router[_0x521e('0x8')](_0x521e('0x11'),auth[_0x521e('0x9')](),controller[_0x521e('0x12')]);router[_0x521e('0x13')]('/',auth[_0x521e('0x9')](),controller[_0x521e('0x14')]);router[_0x521e('0x13')](_0x521e('0xe'),auth[_0x521e('0x9')](),controller[_0x521e('0x15')]);router['post'](_0x521e('0x16'),auth[_0x521e('0x9')](),controller[_0x521e('0x17')]);router['post'](_0x521e('0x18'),auth['isAuthenticated'](),controller['addCustomField']);router['post']('/:id/users',auth[_0x521e('0x9')](),controller['addAgents']);router[_0x521e('0x19')](_0x521e('0x1a'),auth[_0x521e('0x9')](),controller['update']);router[_0x521e('0x1b')](_0x521e('0x1a'),auth['isAuthenticated'](),controller[_0x521e('0x1c')]);router[_0x521e('0x1b')](_0x521e('0xe'),auth[_0x521e('0x9')](),controller[_0x521e('0x1d')]);router['delete'](_0x521e('0x11'),auth[_0x521e('0x9')](),controller['removeAgents']);module[_0x521e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 83d3d4f..4f885ed 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x45d9c0,_0x1a9bd0){var _0x427cab=function(_0x3a20a8){while(--_0x3a20a8){_0x45d9c0['push'](_0x45d9c0['shift']());}};_0x427cab(++_0x1a9bd0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x5ef518,_0x43f1cc){var _0x197343=function(_0x2956d7){while(--_0x2956d7){_0x5ef518['push'](_0x5ef518['shift']());}};_0x197343(++_0x43f1cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 a85c618..cf73ec7 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 _0xcdd2=['crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','body','find','params','Condition','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel'];(function(_0xff4dd9,_0xe27c95){var _0x1477e4=function(_0x3fd720){while(--_0x3fd720){_0xff4dd9['push'](_0xff4dd9['shift']());}};_0x1477e4(++_0xe27c95);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x2cdd('0x0'));var emlformat=require(_0x2cdd('0x1'));var rimraf=require(_0x2cdd('0x2'));var zipdir=require(_0x2cdd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cdd('0x4'));var moment=require(_0x2cdd('0x5'));var BPromise=require(_0x2cdd('0x6'));var Mustache=require(_0x2cdd('0x7'));var util=require('util');var path=require(_0x2cdd('0x8'));var sox=require(_0x2cdd('0x9'));var csv=require('to-csv');var ejs=require(_0x2cdd('0xa'));var fs=require('fs');var _=require(_0x2cdd('0xb'));var squel=require(_0x2cdd('0xc'));var crypto=require(_0x2cdd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2cdd('0xe'));var Papa=require('papaparse');var Redis=require(_0x2cdd('0xf'));var authService=require(_0x2cdd('0x10'));var qs=require(_0x2cdd('0x11'));var as=require(_0x2cdd('0x12'));var hardwareService=require(_0x2cdd('0x13'));var logger=require(_0x2cdd('0x14'))(_0x2cdd('0x15'));var utils=require(_0x2cdd('0x16'));var config=require(_0x2cdd('0x17'));var db=require(_0x2cdd('0x18'))['db'];function respondWithStatusCode(_0x4a808b,_0x53ea0b){_0x53ea0b=_0x53ea0b||0xcc;return function(_0xfddd1e){if(_0xfddd1e){return _0x4a808b[_0x2cdd('0x19')](_0x53ea0b);}return _0x4a808b['status'](_0x53ea0b)[_0x2cdd('0x1a')]();};}function respondWithResult(_0x2557b9,_0x345b45){_0x345b45=_0x345b45||0xc8;return function(_0x2932b3){if(_0x2932b3){return _0x2557b9[_0x2cdd('0x1b')](_0x345b45)['json'](_0x2932b3);}};}function respondWithFilteredResult(_0x367111,_0x25c36d){return function(_0x4849bc){if(_0x4849bc){var _0x159f31=_0x4849bc[_0x2cdd('0x1c')],_0x1c6bc7=_0x25c36d[_0x2cdd('0x1d')],_0x1e8479=_0x25c36d['offset']+_0x25c36d[_0x2cdd('0x1e')],_0x1767d5;if(_0x1e8479>=_0x159f31){_0x1e8479=_0x159f31;_0x1767d5=0xc8;}else{_0x1767d5=0xce;}_0x367111[_0x2cdd('0x1b')](_0x1767d5);return _0x367111[_0x2cdd('0x1f')](_0x2cdd('0x20'),_0x1c6bc7+'-'+_0x1e8479+'/'+_0x159f31)['json'](_0x4849bc);}return null;};}function patchUpdates(_0x23f7a6){return function(_0x204543){try{jsonpatch[_0x2cdd('0x21')](_0x204543,_0x23f7a6,!![]);}catch(_0x315f5b){return BPromise[_0x2cdd('0x22')](_0x315f5b);}return _0x204543[_0x2cdd('0x23')]();};}function saveUpdates(_0x2b0691,_0x442c18){return function(_0x3dc9ec){if(_0x3dc9ec){return _0x3dc9ec[_0x2cdd('0x24')](_0x2b0691)['then'](function(_0x4fab7a){return _0x4fab7a;});}return null;};}function removeEntity(_0x206942,_0x5e874e){return function(_0x50fdcb){if(_0x50fdcb){return _0x50fdcb[_0x2cdd('0x25')]()[_0x2cdd('0x26')](function(){_0x206942[_0x2cdd('0x1b')](0xcc)[_0x2cdd('0x1a')]();});}};}function handleEntityNotFound(_0x5bb57e,_0x5a7b76){return function(_0x444a10){if(!_0x444a10){_0x5bb57e[_0x2cdd('0x19')](0x194);}return _0x444a10;};}function handleError(_0x340a47,_0x284337){_0x284337=_0x284337||0x1f4;return function(_0x7a0d70){logger[_0x2cdd('0x27')](_0x7a0d70[_0x2cdd('0x28')]);if(_0x7a0d70['name']){delete _0x7a0d70[_0x2cdd('0x29')];}_0x340a47[_0x2cdd('0x1b')](_0x284337)[_0x2cdd('0x2a')](_0x7a0d70);};}exports['update']=function(_0x4cbc21,_0x5ef69f){if(_0x4cbc21[_0x2cdd('0x2b')]['id']){delete _0x4cbc21[_0x2cdd('0x2b')]['id'];}return db['Condition'][_0x2cdd('0x2c')]({'where':{'id':_0x4cbc21[_0x2cdd('0x2d')]['id']}})[_0x2cdd('0x26')](handleEntityNotFound(_0x5ef69f,null))[_0x2cdd('0x26')](saveUpdates(_0x4cbc21[_0x2cdd('0x2b')],null))[_0x2cdd('0x26')](respondWithResult(_0x5ef69f,null))['catch'](handleError(_0x5ef69f,null));};exports[_0x2cdd('0x25')]=function(_0x239fad,_0x1f837a){return db[_0x2cdd('0x2e')]['find']({'where':{'id':_0x239fad[_0x2cdd('0x2d')]['id']}})[_0x2cdd('0x26')](handleEntityNotFound(_0x1f837a,null))['then'](removeEntity(_0x1f837a,null))[_0x2cdd('0x2f')](handleError(_0x1f837a,null));}; \ No newline at end of file +var _0x68b7=['body','Condition','params','catch','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send'];(function(_0x359db,_0x399a39){var _0x361dc4=function(_0x4255fa){while(--_0x4255fa){_0x359db['push'](_0x359db['shift']());}};_0x361dc4(++_0x399a39);}(_0x68b7,0x8c));var _0x768b=function(_0x113afb,_0x456646){_0x113afb=_0x113afb-0x0;var _0x4f017b=_0x68b7[_0x113afb];return _0x4f017b;};'use strict';var pdf=require(_0x768b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x768b('0x1'));var zipdir=require(_0x768b('0x2'));var jsonpatch=require(_0x768b('0x3'));var rp=require('request-promise');var moment=require(_0x768b('0x4'));var BPromise=require(_0x768b('0x5'));var Mustache=require(_0x768b('0x6'));var util=require('util');var path=require(_0x768b('0x7'));var sox=require(_0x768b('0x8'));var csv=require(_0x768b('0x9'));var ejs=require(_0x768b('0xa'));var fs=require('fs');var _=require(_0x768b('0xb'));var squel=require(_0x768b('0xc'));var crypto=require(_0x768b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x768b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x768b('0xf'));var Papa=require(_0x768b('0x10'));var Redis=require(_0x768b('0x11'));var authService=require(_0x768b('0x12'));var qs=require(_0x768b('0x13'));var as=require(_0x768b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x768b('0x15'))(_0x768b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x768b('0x17'))['db'];function respondWithStatusCode(_0x1e26bd,_0x35689d){_0x35689d=_0x35689d||0xcc;return function(_0x9c3671){if(_0x9c3671){return _0x1e26bd[_0x768b('0x18')](_0x35689d);}return _0x1e26bd[_0x768b('0x19')](_0x35689d)[_0x768b('0x1a')]();};}function respondWithResult(_0x2ec66c,_0x37a8b5){_0x37a8b5=_0x37a8b5||0xc8;return function(_0x4cff45){if(_0x4cff45){return _0x2ec66c[_0x768b('0x19')](_0x37a8b5)[_0x768b('0x1b')](_0x4cff45);}};}function respondWithFilteredResult(_0x37106d,_0x3a40b6){return function(_0x1f655e){if(_0x1f655e){var _0x50306b=_0x1f655e[_0x768b('0x1c')],_0x17078f=_0x3a40b6[_0x768b('0x1d')],_0xbdef19=_0x3a40b6[_0x768b('0x1d')]+_0x3a40b6[_0x768b('0x1e')],_0x25819e;if(_0xbdef19>=_0x50306b){_0xbdef19=_0x50306b;_0x25819e=0xc8;}else{_0x25819e=0xce;}_0x37106d[_0x768b('0x19')](_0x25819e);return _0x37106d[_0x768b('0x1f')](_0x768b('0x20'),_0x17078f+'-'+_0xbdef19+'/'+_0x50306b)[_0x768b('0x1b')](_0x1f655e);}return null;};}function patchUpdates(_0x21aaa6){return function(_0x5b677b){try{jsonpatch['apply'](_0x5b677b,_0x21aaa6,!![]);}catch(_0x2ce978){return BPromise[_0x768b('0x21')](_0x2ce978);}return _0x5b677b['save']();};}function saveUpdates(_0x2105d6,_0x931aa0){return function(_0x5c81ca){if(_0x5c81ca){return _0x5c81ca[_0x768b('0x22')](_0x2105d6)[_0x768b('0x23')](function(_0x7a9f2d){return _0x7a9f2d;});}return null;};}function removeEntity(_0x55b141,_0xaa1538){return function(_0x4d63a2){if(_0x4d63a2){return _0x4d63a2['destroy']()[_0x768b('0x23')](function(){_0x55b141[_0x768b('0x19')](0xcc)[_0x768b('0x1a')]();});}};}function handleEntityNotFound(_0x207f99,_0x4694f6){return function(_0x1186ab){if(!_0x1186ab){_0x207f99[_0x768b('0x18')](0x194);}return _0x1186ab;};}function handleError(_0x3f5abe,_0x1a1733){_0x1a1733=_0x1a1733||0x1f4;return function(_0x2c0048){logger[_0x768b('0x24')](_0x2c0048[_0x768b('0x25')]);if(_0x2c0048[_0x768b('0x26')]){delete _0x2c0048[_0x768b('0x26')];}_0x3f5abe['status'](_0x1a1733)[_0x768b('0x27')](_0x2c0048);};}exports['update']=function(_0x584200,_0x5d1faf){if(_0x584200['body']['id']){delete _0x584200[_0x768b('0x28')]['id'];}return db[_0x768b('0x29')]['find']({'where':{'id':_0x584200[_0x768b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5d1faf,null))[_0x768b('0x23')](saveUpdates(_0x584200['body'],null))[_0x768b('0x23')](respondWithResult(_0x5d1faf,null))[_0x768b('0x2b')](handleError(_0x5d1faf,null));};exports[_0x768b('0x2c')]=function(_0x43b711,_0x5afca4){return db['Condition']['find']({'where':{'id':_0x43b711[_0x768b('0x2a')]['id']}})[_0x768b('0x23')](handleEntityNotFound(_0x5afca4,null))[_0x768b('0x23')](removeEntity(_0x5afca4,null))[_0x768b('0x2b')](handleError(_0x5afca4,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index da56e47..21bc05d 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 _0x8235=['moment','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','api'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x8235,0x111));var _0x5823=function(_0x3a0c22,_0x3191e8){_0x3a0c22=_0x3a0c22-0x0;var _0x4a38f7=_0x8235[_0x3a0c22];return _0x4a38f7;};'use strict';var _=require('lodash');var util=require(_0x5823('0x0'));var logger=require('../../config/logger')(_0x5823('0x1'));var moment=require(_0x5823('0x2'));var BPromise=require('bluebird');var rp=require(_0x5823('0x3'));var fs=require('fs');var path=require(_0x5823('0x4'));var rimraf=require('rimraf');var config=require(_0x5823('0x5'));var attributes=require(_0x5823('0x6'));module[_0x5823('0x7')]=function(_0x2f0e60,_0x582a6a){return _0x2f0e60[_0x5823('0x8')](_0x5823('0x9'),attributes,{'tableName':_0x5823('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04fc=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x407a5e,_0x3daf3e){var _0x1c55fa=function(_0x2a49d0){while(--_0x2a49d0){_0x407a5e['push'](_0x407a5e['shift']());}};_0x1c55fa(++_0x3daf3e);}(_0x04fc,0x12f));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc04f('0x0'));var util=require(_0xc04f('0x1'));var logger=require(_0xc04f('0x2'))(_0xc04f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc04f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc04f('0x5'));var config=require(_0xc04f('0x6'));var attributes=require(_0xc04f('0x7'));module[_0xc04f('0x8')]=function(_0x5362ef,_0x1db23c){return _0x5362ef[_0xc04f('0x9')](_0xc04f('0xa'),attributes,{'tableName':_0xc04f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 73829af..a380fc6 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 _0xdefd=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2ca265,_0x294075){var _0x2444da=function(_0x5628d6){while(--_0x5628d6){_0x2ca265['push'](_0x2ca265['shift']());}};_0x2444da(++_0x294075);}(_0xdefd,0x1cf));var _0xddef=function(_0x11a498,_0xba2074){_0x11a498=_0x11a498-0x0;var _0x447d83=_0xdefd[_0x11a498];return _0x447d83;};'use strict';var _=require(_0xddef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddef('0x1'));var fs=require('fs');var Redis=require(_0xddef('0x2'));var db=require(_0xddef('0x3'))['db'];var utils=require(_0xddef('0x4'));var logger=require(_0xddef('0x5'))(_0xddef('0x6'));var config=require(_0xddef('0x7'));var jayson=require(_0xddef('0x8'));var client=jayson['client'][_0xddef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7cc440,_0x584bcf,_0x44b307){return new BPromise(function(_0x9c09b9,_0x5cc980){return client[_0xddef('0xa')](_0x7cc440,_0x44b307)['then'](function(_0x408fa5){logger['info'](_0xddef('0xb'),_0x584bcf,_0xddef('0xc'));logger[_0xddef('0xd')](_0xddef('0xe'),_0x584bcf,_0xddef('0xc'),JSON[_0xddef('0xf')](_0x408fa5));if(_0x408fa5[_0xddef('0x10')]){if(_0x408fa5['error'][_0xddef('0x11')]===0x1f4){logger[_0xddef('0x10')]('Condition,\x20%s,\x20%s',_0x584bcf,_0x408fa5[_0xddef('0x10')][_0xddef('0x12')]);return _0x5cc980(_0x408fa5[_0xddef('0x10')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x584bcf,_0x408fa5['error'][_0xddef('0x12')]);return _0x9c09b9(_0x408fa5[_0xddef('0x10')][_0xddef('0x12')]);}else{logger[_0xddef('0x13')]('Condition,\x20%s,\x20%s',_0x584bcf,'request\x20sent');_0x9c09b9(_0x408fa5[_0xddef('0x14')][_0xddef('0x12')]);}})[_0xddef('0x15')](function(_0x37eba4){logger[_0xddef('0x10')](_0xddef('0xb'),_0x584bcf,_0x37eba4);_0x5cc980(_0x37eba4);});});} \ No newline at end of file +var _0x510f=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s'];(function(_0x25a6a7,_0x1986cb){var _0x20cfd1=function(_0x520e35){while(--_0x520e35){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x20cfd1(++_0x1986cb);}(_0x510f,0x15e));var _0xf510=function(_0x1ec836,_0x1ce2d6){_0x1ec836=_0x1ec836-0x0;var _0x4baf71=_0x510f[_0x1ec836];return _0x4baf71;};'use strict';var _=require(_0xf510('0x0'));var util=require(_0xf510('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf510('0x2'));var db=require(_0xf510('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf510('0x4'));var config=require(_0xf510('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf510('0x6')][_0xf510('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d80f3,_0x386415,_0x32e8ce){return new BPromise(function(_0x318499,_0x22fbff){return client[_0xf510('0x8')](_0x3d80f3,_0x32e8ce)['then'](function(_0x1c12ee){logger[_0xf510('0x9')](_0xf510('0xa'),_0x386415,'request\x20sent');logger['debug'](_0xf510('0xb'),_0x386415,'request\x20sent',JSON[_0xf510('0xc')](_0x1c12ee));if(_0x1c12ee['error']){if(_0x1c12ee[_0xf510('0xd')][_0xf510('0xe')]===0x1f4){logger[_0xf510('0xd')](_0xf510('0xa'),_0x386415,_0x1c12ee[_0xf510('0xd')]['message']);return _0x22fbff(_0x1c12ee[_0xf510('0xd')][_0xf510('0xf')]);}logger[_0xf510('0xd')]('Condition,\x20%s,\x20%s',_0x386415,_0x1c12ee['error']['message']);return _0x318499(_0x1c12ee['error']['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x386415,_0xf510('0x10'));_0x318499(_0x1c12ee[_0xf510('0x11')][_0xf510('0xf')]);}})[_0xf510('0x12')](function(_0x4bd17b){logger[_0xf510('0xd')](_0xf510('0xa'),_0x386415,_0x4bd17b);_0x22fbff(_0x4bd17b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index c26b2a8..103c169 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 _0x7176=['/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x52f94e,_0x1f5e45){var _0x3b2ada=function(_0x4e9d5b){while(--_0x4e9d5b){_0x52f94e['push'](_0x52f94e['shift']());}};_0x3b2ada(++_0x1f5e45);}(_0x7176,0x1f1));var _0x6717=function(_0x341fb2,_0x1b8dd9){_0x341fb2=_0x341fb2-0x0;var _0x408d0a=_0x7176[_0x341fb2];return _0x408d0a;};'use strict';var multer=require('multer');var util=require(_0x6717('0x0'));var path=require(_0x6717('0x1'));var timeout=require(_0x6717('0x2'));var express=require(_0x6717('0x3'));var router=express[_0x6717('0x4')]();var auth=require(_0x6717('0x5'));var interaction=require(_0x6717('0x6'));var config=require(_0x6717('0x7'));var controller=require(_0x6717('0x8'));router[_0x6717('0x9')]('/:id',auth[_0x6717('0xa')](),controller[_0x6717('0xb')]);router[_0x6717('0xc')](_0x6717('0xd'),auth[_0x6717('0xa')](),controller[_0x6717('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1918=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x3f0822,_0x3f94b6){var _0x485a35=function(_0x2046ee){while(--_0x2046ee){_0x3f0822['push'](_0x3f0822['shift']());}};_0x485a35(++_0x3f94b6);}(_0x1918,0xa3));var _0x8191=function(_0x2947ae,_0x41d4c2){_0x2947ae=_0x2947ae-0x0;var _0x4d46c6=_0x1918[_0x2947ae];return _0x4d46c6;};'use strict';var multer=require(_0x8191('0x0'));var util=require(_0x8191('0x1'));var path=require(_0x8191('0x2'));var timeout=require(_0x8191('0x3'));var express=require(_0x8191('0x4'));var router=express['Router']();var auth=require(_0x8191('0x5'));var interaction=require(_0x8191('0x6'));var config=require(_0x8191('0x7'));var controller=require(_0x8191('0x8'));router['put'](_0x8191('0x9'),auth[_0x8191('0xa')](),controller[_0x8191('0xb')]);router[_0x8191('0xc')]('/:id',auth[_0x8191('0xa')](),controller['destroy']);module[_0x8191('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5861abf..427da33 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f5d=['sequelize','exports','STRING','name','INTEGER'];(function(_0x5b47db,_0x1130a7){var _0x722a26=function(_0x456de3){while(--_0x456de3){_0x5b47db['push'](_0x5b47db['shift']());}};_0x722a26(++_0x1130a7);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4f5d[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0xd4f5('0x0'));module[_0xd4f5('0x1')]={'name':{'type':Sequelize[_0xd4f5('0x2')],'allowNull':![],'unique':_0xd4f5('0x3')},'OrderBy':{'type':Sequelize[_0xd4f5('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd4f5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xde9d=['name','INTEGER','sequelize','exports','STRING'];(function(_0x11a2df,_0x56503a){var _0x3e489e=function(_0xa2323e){while(--_0xa2323e){_0x11a2df['push'](_0x11a2df['shift']());}};_0x3e489e(++_0x56503a);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdde9('0x0'));module[_0xdde9('0x1')]={'name':{'type':Sequelize[_0xdde9('0x2')],'allowNull':![],'unique':_0xdde9('0x3')},'OrderBy':{'type':Sequelize[_0xdde9('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index a531ee1..6952755 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['then','ContactItemTypes','destroy','sendStatus','error','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34e8,0x12c));var _0x834e=function(_0x9bffd0,_0x24dce0){_0x9bffd0=_0x9bffd0-0x0;var _0x5b532d=_0x34e8[_0x9bffd0];return _0x5b532d;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']),_0xb5bc06);if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['ContactItemType'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x4a')]=function(_0x30568e,_0x40ff5a){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x30568e[_0x834e('0x4b')],{})[_0x834e('0x28')](function(_0x1419eb){var _0x390c45=_0x30568e[_0x834e('0x4c')][_0x834e('0x4d')]({'plain':!![]});if(!_0x390c45)throw new Error(_0x834e('0x4e'));if(_0x390c45[_0x834e('0x4f')]===_0x834e('0x4c')){var _0x1a3855=_0x1419eb[_0x834e('0x4d')]({'plain':!![]});var _0x32b8f7=_0x834e('0x29');return db[_0x834e('0x50')]['find']({'where':{'name':_0x32b8f7,'userProfileId':_0x390c45[_0x834e('0x51')]},'raw':!![]})[_0x834e('0x28')](function(_0x4e73e0){if(_0x4e73e0&&_0x4e73e0[_0x834e('0x52')]===0x0){return db[_0x834e('0x53')]['create']({'name':_0x1a3855[_0x834e('0x2e')],'resourceId':_0x1a3855['id'],'type':_0x4e73e0[_0x834e('0x2e')],'sectionId':_0x4e73e0['id']},{})[_0x834e('0x28')](function(){return _0x1419eb;});}else{return _0x1419eb;}})[_0x834e('0x46')](function(_0x4288e4){logger[_0x834e('0x2c')](_0x834e('0x54'),_0x4288e4);throw _0x4288e4;});}return _0x1419eb;})['then'](respondWithResult(_0x40ff5a,0xc9))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){if(_0x3e0550[_0x834e('0x4b')]['id']){delete _0x3e0550[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x3e0550['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x363675,null))['then'](saveUpdates(_0x3e0550[_0x834e('0x4b')],null))['then'](respondWithResult(_0x363675,null))[_0x834e('0x46')](handleError(_0x363675,null));};exports['destroy']=function(_0x527eef,_0x6c0b29){return db[_0x834e('0x30')]['find']({'where':{'id':_0x527eef['params']['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x6c0b29,null))[_0x834e('0x28')](removeEntity(_0x6c0b29,null))[_0x834e('0x46')](handleError(_0x6c0b29,null));}; \ No newline at end of file +var _0xa41a=['nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','fast-json-patch','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','ContactItemType','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa41a,0x6b));var _0xaa41=function(_0x4b508d,_0x15e8aa){_0x4b508d=_0x4b508d-0x0;var _0x330f54=_0xa41a[_0x4b508d];return _0x330f54;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54827c,_0x1d0a54){_0x1d0a54=_0x1d0a54||0xcc;return function(_0x518b5b){if(_0x518b5b){return _0x54827c[_0xaa41('0x18')](_0x1d0a54);}return _0x54827c[_0xaa41('0x19')](_0x1d0a54)[_0xaa41('0x1a')]();};}function respondWithResult(_0x889d44,_0x6f9ade){_0x6f9ade=_0x6f9ade||0xc8;return function(_0x4eaf81){if(_0x4eaf81){return _0x889d44[_0xaa41('0x19')](_0x6f9ade)[_0xaa41('0x1b')](_0x4eaf81);}};}function respondWithFilteredResult(_0x1934e9,_0x1ef7d9){return function(_0x2a6988){if(_0x2a6988){var _0x2005ae=_0x2a6988[_0xaa41('0x1c')],_0x1e1e02=_0x1ef7d9[_0xaa41('0x1d')],_0x550ad5=_0x1ef7d9[_0xaa41('0x1d')]+_0x1ef7d9[_0xaa41('0x1e')],_0x2d868a;if(_0x550ad5>=_0x2005ae){_0x550ad5=_0x2005ae;_0x2d868a=0xc8;}else{_0x2d868a=0xce;}_0x1934e9[_0xaa41('0x19')](_0x2d868a);return _0x1934e9[_0xaa41('0x1f')](_0xaa41('0x20'),_0x1e1e02+'-'+_0x550ad5+'/'+_0x2005ae)[_0xaa41('0x1b')](_0x2a6988);}return null;};}function patchUpdates(_0x4fe1a4){return function(_0x5cd936){try{jsonpatch[_0xaa41('0x21')](_0x5cd936,_0x4fe1a4,!![]);}catch(_0x22de55){return BPromise[_0xaa41('0x22')](_0x22de55);}return _0x5cd936['save']();};}function saveUpdates(_0x2bf794,_0x1f692b){return function(_0x4e768e){if(_0x4e768e){return _0x4e768e['update'](_0x2bf794)[_0xaa41('0x23')](function(_0x5d4374){return _0x5d4374;});}return null;};}function removeEntity(_0xafd672,_0x209c83){return function(_0x3e2175){if(_0x3e2175){return _0x3e2175[_0xaa41('0x24')]()[_0xaa41('0x23')](function(){var _0x4eb01f=_0x3e2175[_0xaa41('0x25')]({'plain':!![]});var _0x43a85c=_0xaa41('0x26');return db[_0xaa41('0x27')][_0xaa41('0x24')]({'where':{'type':_0x43a85c,'resourceId':_0x4eb01f['id']}})[_0xaa41('0x23')](function(){return _0x3e2175;});})['then'](function(){_0xafd672['status'](0xcc)[_0xaa41('0x1a')]();});}};}function handleEntityNotFound(_0x527cac,_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x527cac['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x28')](_0x9c8c21[_0xaa41('0x29')]);if(_0x9c8c21[_0xaa41('0x2a')]){delete _0x9c8c21[_0xaa41('0x2a')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x2b')](_0x9c8c21);};}exports[_0xaa41('0x2c')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={},_0x4466a3={},_0x30f88e={'count':0x0,'rows':[]};var _0x104a95=_['map'](db[_0xaa41('0x2d')]['rawAttributes'],function(_0x5dad80){return{'name':_0x5dad80[_0xaa41('0x2e')],'type':_0x5dad80[_0xaa41('0x2f')]['key']};});_0x4466a3[_0xaa41('0x30')]=_[_0xaa41('0x31')](_0x104a95,'name');_0x4466a3['query']=_['keys'](_0x63c18c[_0xaa41('0x32')]);_0x4466a3[_0xaa41('0x33')]=_[_0xaa41('0x34')](_0x4466a3[_0xaa41('0x30')],_0x4466a3['query']);_0x1d8c2b[_0xaa41('0x35')]=_[_0xaa41('0x34')](_0x4466a3[_0xaa41('0x30')],qs['fields'](_0x63c18c[_0xaa41('0x32')][_0xaa41('0x36')]));_0x1d8c2b[_0xaa41('0x35')]=_0x1d8c2b['attributes'][_0xaa41('0x37')]?_0x1d8c2b[_0xaa41('0x35')]:_0x4466a3['model'];if(!_0x63c18c[_0xaa41('0x32')][_0xaa41('0x38')](_0xaa41('0x39'))){_0x1d8c2b['limit']=qs[_0xaa41('0x1e')](_0x63c18c['query'][_0xaa41('0x1e')]);_0x1d8c2b[_0xaa41('0x1d')]=qs[_0xaa41('0x1d')](_0x63c18c['query']['offset']);}_0x1d8c2b['order']=qs[_0xaa41('0x3a')](_0x63c18c[_0xaa41('0x32')][_0xaa41('0x3a')]);_0x1d8c2b[_0xaa41('0x3b')]=qs['filters'](_['pick'](_0x63c18c[_0xaa41('0x32')],_0x4466a3[_0xaa41('0x33')]),_0x104a95);if(_0x63c18c[_0xaa41('0x32')][_0xaa41('0x3c')]){_0x1d8c2b[_0xaa41('0x3b')]=_[_0xaa41('0x3d')](_0x1d8c2b[_0xaa41('0x3b')],{'$or':_['map'](_0x104a95,function(_0x3adc28){if(_0x3adc28[_0xaa41('0x2f')]!==_0xaa41('0x3e')){var _0x27817f={};_0x27817f[_0x3adc28['name']]={'$like':'%'+_0x63c18c['query'][_0xaa41('0x3c')]+'%'};return _0x27817f;}})});}_0x1d8c2b=_[_0xaa41('0x3d')]({},_0x1d8c2b,_0x63c18c['options']);var _0x4101ab={'where':_0x1d8c2b['where']};return db[_0xaa41('0x2d')][_0xaa41('0x1c')](_0x4101ab)[_0xaa41('0x23')](function(_0x466eee){_0x30f88e[_0xaa41('0x1c')]=_0x466eee;if(_0x63c18c[_0xaa41('0x32')][_0xaa41('0x3f')]){_0x1d8c2b[_0xaa41('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0xaa41('0x41')](_0x1d8c2b);})[_0xaa41('0x23')](function(_0x35c685){_0x30f88e[_0xaa41('0x42')]=_0x35c685;return _0x30f88e;})[_0xaa41('0x23')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x43')](handleError(_0x9a16e3,null));};exports['show']=function(_0x5bb318,_0x87e2f4){var _0x4f9086={'raw':!![],'where':{'id':_0x5bb318[_0xaa41('0x44')]['id']}},_0x1ed366={};_0x1ed366[_0xaa41('0x30')]=_[_0xaa41('0x45')](db[_0xaa41('0x2d')][_0xaa41('0x46')]);_0x1ed366[_0xaa41('0x32')]=_['keys'](_0x5bb318[_0xaa41('0x32')]);_0x1ed366['filters']=_['intersection'](_0x1ed366[_0xaa41('0x30')],_0x1ed366['query']);_0x4f9086['attributes']=_['intersection'](_0x1ed366[_0xaa41('0x30')],qs['fields'](_0x5bb318[_0xaa41('0x32')][_0xaa41('0x36')]));_0x4f9086['attributes']=_0x4f9086['attributes'][_0xaa41('0x37')]?_0x4f9086[_0xaa41('0x35')]:_0x1ed366[_0xaa41('0x30')];if(_0x5bb318[_0xaa41('0x32')][_0xaa41('0x3f')]){_0x4f9086[_0xaa41('0x40')]=[{'all':!![]}];}_0x4f9086=_[_0xaa41('0x3d')]({},_0x4f9086,_0x5bb318[_0xaa41('0x47')]);return db[_0xaa41('0x2d')]['find'](_0x4f9086)[_0xaa41('0x23')](handleEntityNotFound(_0x87e2f4,null))[_0xaa41('0x23')](respondWithResult(_0x87e2f4,null))[_0xaa41('0x43')](handleError(_0x87e2f4,null));};exports[_0xaa41('0x48')]=function(_0x206d86,_0x1d6112){return db['ContactItemType'][_0xaa41('0x48')](_0x206d86[_0xaa41('0x49')],{})[_0xaa41('0x23')](function(_0x2288f8){var _0x57d1f6=_0x206d86[_0xaa41('0x4a')]['get']({'plain':!![]});if(!_0x57d1f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57d1f6[_0xaa41('0x4b')]===_0xaa41('0x4a')){var _0x3e16ef=_0x2288f8['get']({'plain':!![]});var _0xb4773b=_0xaa41('0x26');return db[_0xaa41('0x4c')]['find']({'where':{'name':_0xb4773b,'userProfileId':_0x57d1f6[_0xaa41('0x4d')]},'raw':!![]})[_0xaa41('0x23')](function(_0x2c68b3){if(_0x2c68b3&&_0x2c68b3[_0xaa41('0x4e')]===0x0){return db[_0xaa41('0x27')][_0xaa41('0x48')]({'name':_0x3e16ef[_0xaa41('0x2a')],'resourceId':_0x3e16ef['id'],'type':_0x2c68b3[_0xaa41('0x2a')],'sectionId':_0x2c68b3['id']},{})['then'](function(){return _0x2288f8;});}else{return _0x2288f8;}})[_0xaa41('0x43')](function(_0x5bef5f){logger['error'](_0xaa41('0x4f'),_0x5bef5f);throw _0x5bef5f;});}return _0x2288f8;})[_0xaa41('0x23')](respondWithResult(_0x1d6112,0xc9))[_0xaa41('0x43')](handleError(_0x1d6112,null));};exports[_0xaa41('0x50')]=function(_0x14aab0,_0x288db3){if(_0x14aab0[_0xaa41('0x49')]['id']){delete _0x14aab0[_0xaa41('0x49')]['id'];}return db['ContactItemType'][_0xaa41('0x51')]({'where':{'id':_0x14aab0[_0xaa41('0x44')]['id']}})[_0xaa41('0x23')](handleEntityNotFound(_0x288db3,null))['then'](saveUpdates(_0x14aab0[_0xaa41('0x49')],null))[_0xaa41('0x23')](respondWithResult(_0x288db3,null))['catch'](handleError(_0x288db3,null));};exports[_0xaa41('0x24')]=function(_0xd36d1a,_0x283b3b){return db['ContactItemType'][_0xaa41('0x51')]({'where':{'id':_0xd36d1a[_0xaa41('0x44')]['id']}})['then'](handleEntityNotFound(_0x283b3b,null))['then'](removeEntity(_0x283b3b,null))[_0xaa41('0x43')](handleError(_0x283b3b,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index c368c34..06fda49 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd2e=['./contactItemType.attributes','tools_contact_item_types','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1c5c32,_0x3e6148){var _0x4abe42=function(_0x5b7723){while(--_0x5b7723){_0x1c5c32['push'](_0x1c5c32['shift']());}};_0x4abe42(++_0x3e6148);}(_0xfd2e,0x6e));var _0xefd2=function(_0x7c1b9c,_0x3c6b9d){_0x7c1b9c=_0x7c1b9c-0x0;var _0x1b4a95=_0xfd2e[_0x7c1b9c];return _0x1b4a95;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var logger=require(_0xefd2('0x1'))('api');var moment=require(_0xefd2('0x2'));var BPromise=require('bluebird');var rp=require(_0xefd2('0x3'));var fs=require('fs');var path=require(_0xefd2('0x4'));var rimraf=require(_0xefd2('0x5'));var config=require(_0xefd2('0x6'));var attributes=require(_0xefd2('0x7'));module['exports']=function(_0x5124c6,_0x40e76c){return _0x5124c6['define']('ContactItemType',attributes,{'tableName':_0xefd2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb04=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x23ebde,_0x3e6227){var _0x16ab55=function(_0x595b2d){while(--_0x595b2d){_0x23ebde['push'](_0x23ebde['shift']());}};_0x16ab55(++_0x3e6227);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var logger=require(_0x4cb0('0x2'))(_0x4cb0('0x3'));var moment=require(_0x4cb0('0x4'));var BPromise=require(_0x4cb0('0x5'));var rp=require(_0x4cb0('0x6'));var fs=require('fs');var path=require(_0x4cb0('0x7'));var rimraf=require(_0x4cb0('0x8'));var config=require(_0x4cb0('0x9'));var attributes=require('./contactItemType.attributes');module[_0x4cb0('0xa')]=function(_0x2fb566,_0x247e05){return _0x2fb566[_0x4cb0('0xb')](_0x4cb0('0xc'),attributes,{'tableName':_0x4cb0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 25c6af2..8edb8ea 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaa2=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x58547b,_0x51dedc){var _0x13f848=function(_0xc8514c){while(--_0xc8514c){_0x58547b['push'](_0x58547b['shift']());}};_0x13f848(++_0x51dedc);}(_0xaaa2,0xac));var _0x2aaa=function(_0x10dd93,_0x1f2095){_0x10dd93=_0x10dd93-0x0;var _0x190b74=_0xaaa2[_0x10dd93];return _0x190b74;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('ContactItemType,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('ContactItemType,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});} \ No newline at end of file +var _0x00b3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x34788c,_0x1159d4){var _0x49add9=function(_0x569a4e){while(--_0x569a4e){_0x34788c['push'](_0x34788c['shift']());}};_0x49add9(++_0x1159d4);}(_0x00b3,0x17a));var _0x300b=function(_0x4d3008,_0x615c6){_0x4d3008=_0x4d3008-0x0;var _0x540e40=_0x00b3[_0x4d3008];return _0x540e40;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index bbb8a59..3368707 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdabf=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','post','create','/:id','update','destroy','multer','util','path','express'];(function(_0x3fc4ef,_0x57e071){var _0x20d7e2=function(_0x231af4){while(--_0x231af4){_0x3fc4ef['push'](_0x3fc4ef['shift']());}};_0x20d7e2(++_0x57e071);}(_0xdabf,0x1c7));var _0xfdab=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xdabf[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xfdab('0x0'));var util=require(_0xfdab('0x1'));var path=require(_0xfdab('0x2'));var timeout=require('connect-timeout');var express=require(_0xfdab('0x3'));var router=express[_0xfdab('0x4')]();var auth=require(_0xfdab('0x5'));var interaction=require(_0xfdab('0x6'));var config=require(_0xfdab('0x7'));var controller=require(_0xfdab('0x8'));router[_0xfdab('0x9')]('/',auth[_0xfdab('0xa')](),controller[_0xfdab('0xb')]);router['get']('/:id',auth[_0xfdab('0xa')](),controller['show']);router[_0xfdab('0xc')]('/',auth[_0xfdab('0xa')](),controller[_0xfdab('0xd')]);router['put'](_0xfdab('0xe'),auth[_0xfdab('0xa')](),controller[_0xfdab('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfdab('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4e8b=['express','Router','../../components/auth/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','put','exports','multer','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4e8b,0x66));var _0xb4e8=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x4e8b[_0xa9a245];return _0x2d0eaa;};'use strict';var multer=require(_0xb4e8('0x0'));var util=require('util');var path=require(_0xb4e8('0x1'));var timeout=require(_0xb4e8('0x2'));var express=require(_0xb4e8('0x3'));var router=express[_0xb4e8('0x4')]();var auth=require(_0xb4e8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4e8('0x6'));router[_0xb4e8('0x7')]('/',auth[_0xb4e8('0x8')](),controller[_0xb4e8('0x9')]);router[_0xb4e8('0x7')](_0xb4e8('0xa'),auth['isAuthenticated'](),controller[_0xb4e8('0xb')]);router['post']('/',auth[_0xb4e8('0x8')](),controller[_0xb4e8('0xc')]);router[_0xb4e8('0xd')](_0xb4e8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb4e8('0xa'),auth[_0xb4e8('0x8')](),controller['destroy']);module[_0xb4e8('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c156dc0..712906b 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 _0xef17=['STRING','name','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef17,0x136));var _0x7ef1=function(_0x394ae9,_0x34bdd6){_0x394ae9=_0x394ae9-0x0;var _0x3b7586=_0xef17[_0x394ae9];return _0x3b7586;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'allowNull':![],'unique':_0x7ef1('0x3')},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file +var _0xb079=['name','exports','STRING'];(function(_0x3766d5,_0x27f87a){var _0x39f5a3=function(_0x5c908b){while(--_0x5c908b){_0x3766d5['push'](_0x3766d5['shift']());}};_0x39f5a3(++_0x27f87a);}(_0xb079,0x1c9));var _0x9b07=function(_0x24182c,_0x4ee0bf){_0x24182c=_0x24182c-0x0;var _0x6f45db=_0xb079[_0x24182c];return _0x6f45db;};'use strict';var Sequelize=require('sequelize');module[_0x9b07('0x0')]={'name':{'type':Sequelize[_0x9b07('0x1')],'allowNull':![],'unique':_0x9b07('0x2')},'description':{'type':Sequelize[_0x9b07('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 73654a1..3ce715b 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 _0x69d8=['options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','updatedAt','omit','createdAt','CustomDashboards','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','findOne','DashboardItem','pick','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','filters','query','intersection','fields','attributes','hasOwnProperty','offset','sort','where','filter','VIRTUAL','merge','include','Dashboard','rows','catch','show','params','length'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x69d8,0x19c));var _0x869d=function(_0xf2992b,_0x8c0d4c){_0xf2992b=_0xf2992b-0x0;var _0x2e8306=_0x69d8[_0xf2992b];return _0x2e8306;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x869d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x869d('0x1'));var jsonpatch=require(_0x869d('0x2'));var rp=require(_0x869d('0x3'));var moment=require(_0x869d('0x4'));var BPromise=require(_0x869d('0x5'));var Mustache=require(_0x869d('0x6'));var util=require(_0x869d('0x7'));var path=require(_0x869d('0x8'));var sox=require(_0x869d('0x9'));var csv=require(_0x869d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x869d('0xb'));var squel=require(_0x869d('0xc'));var crypto=require(_0x869d('0xd'));var jsforce=require(_0x869d('0xe'));var deskjs=require(_0x869d('0xf'));var toCsv=require(_0x869d('0xa'));var querystring=require('querystring');var Papa=require(_0x869d('0x10'));var Redis=require(_0x869d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x869d('0x12'));var hardwareService=require(_0x869d('0x13'));var logger=require(_0x869d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x869d('0x15'));var db=require('../../mysqldb')['db'];config[_0x869d('0x16')]=_[_0x869d('0x17')](config[_0x869d('0x16')],{'host':_0x869d('0x18'),'port':0x18eb});var socket=require(_0x869d('0x19'))(new Redis(config[_0x869d('0x16')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1fcf1b,_0x53bb0e){_0x53bb0e=_0x53bb0e||0xcc;return function(_0x5b9adc){if(_0x5b9adc){return _0x1fcf1b[_0x869d('0x1a')](_0x53bb0e);}return _0x1fcf1b[_0x869d('0x1b')](_0x53bb0e)[_0x869d('0x1c')]();};}function respondWithResult(_0x14b678,_0x27d5d6){_0x27d5d6=_0x27d5d6||0xc8;return function(_0x5d3a30){if(_0x5d3a30){return _0x14b678[_0x869d('0x1b')](_0x27d5d6)[_0x869d('0x1d')](_0x5d3a30);}};}function respondWithFilteredResult(_0x63ea6f,_0x1a1b54){return function(_0x4865d2){if(_0x4865d2){var _0x4fe5ec=_0x4865d2[_0x869d('0x1e')],_0x19889e=_0x1a1b54['offset'],_0x5514b2=_0x1a1b54['offset']+_0x1a1b54[_0x869d('0x1f')],_0x340cd9;if(_0x5514b2>=_0x4fe5ec){_0x5514b2=_0x4fe5ec;_0x340cd9=0xc8;}else{_0x340cd9=0xce;}_0x63ea6f[_0x869d('0x1b')](_0x340cd9);return _0x63ea6f[_0x869d('0x20')](_0x869d('0x21'),_0x19889e+'-'+_0x5514b2+'/'+_0x4fe5ec)['json'](_0x4865d2);}return null;};}function patchUpdates(_0x402155){return function(_0x2ccf92){try{jsonpatch['apply'](_0x2ccf92,_0x402155,!![]);}catch(_0x8dd922){return BPromise['reject'](_0x8dd922);}return _0x2ccf92[_0x869d('0x22')]();};}function saveUpdates(_0x9e80f3,_0x4cb4b9){return function(_0x13d323){if(_0x13d323){return _0x13d323[_0x869d('0x23')](_0x9e80f3)[_0x869d('0x24')](function(_0x283ac){return _0x283ac;});}return null;};}function removeEntity(_0x245fb8,_0x70ce62){return function(_0x28c4e8){if(_0x28c4e8){return _0x28c4e8[_0x869d('0x25')]()[_0x869d('0x24')](function(){var _0x207df4=_0x28c4e8['get']({'plain':!![]});var _0x404398='CustomDashboards';return db['UserProfileResource'][_0x869d('0x25')]({'where':{'type':_0x404398,'resourceId':_0x207df4['id']}})[_0x869d('0x24')](function(){return _0x28c4e8;});})[_0x869d('0x24')](function(){_0x245fb8['status'](0xcc)[_0x869d('0x1c')]();});}};}function handleEntityNotFound(_0x33c6b1,_0x23afef){return function(_0x3b0cc5){if(!_0x3b0cc5){_0x33c6b1['sendStatus'](0x194);}return _0x3b0cc5;};}function handleError(_0x14267d,_0x3f5b94){_0x3f5b94=_0x3f5b94||0x1f4;return function(_0x55b6f8){logger[_0x869d('0x26')](_0x55b6f8[_0x869d('0x27')]);if(_0x55b6f8[_0x869d('0x28')]){delete _0x55b6f8[_0x869d('0x28')];}_0x14267d['status'](_0x3f5b94)[_0x869d('0x29')](_0x55b6f8);};}exports[_0x869d('0x2a')]=function(_0x90e276,_0x7552cf){var _0x176f38={},_0x450a55={},_0xc21a2={'count':0x0,'rows':[]};var _0x2436d8=_[_0x869d('0x2b')](db['Dashboard'][_0x869d('0x2c')],function(_0x209c81){return{'name':_0x209c81[_0x869d('0x2d')],'type':_0x209c81[_0x869d('0x2e')]['key']};});_0x450a55[_0x869d('0x2f')]=_[_0x869d('0x2b')](_0x2436d8,_0x869d('0x28'));_0x450a55['query']=_[_0x869d('0x30')](_0x90e276['query']);_0x450a55[_0x869d('0x31')]=_['intersection'](_0x450a55[_0x869d('0x2f')],_0x450a55[_0x869d('0x32')]);_0x176f38['attributes']=_[_0x869d('0x33')](_0x450a55[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x90e276['query'][_0x869d('0x34')]));_0x176f38[_0x869d('0x35')]=_0x176f38['attributes']['length']?_0x176f38[_0x869d('0x35')]:_0x450a55[_0x869d('0x2f')];if(!_0x90e276[_0x869d('0x32')][_0x869d('0x36')]('nolimit')){_0x176f38[_0x869d('0x1f')]=qs[_0x869d('0x1f')](_0x90e276[_0x869d('0x32')][_0x869d('0x1f')]);_0x176f38['offset']=qs['offset'](_0x90e276[_0x869d('0x32')][_0x869d('0x37')]);}_0x176f38['order']=qs[_0x869d('0x38')](_0x90e276[_0x869d('0x32')]['sort']);_0x176f38[_0x869d('0x39')]=qs['filters'](_['pick'](_0x90e276['query'],_0x450a55[_0x869d('0x31')]),_0x2436d8);if(_0x90e276[_0x869d('0x32')][_0x869d('0x3a')]){_0x176f38[_0x869d('0x39')]=_['merge'](_0x176f38['where'],{'$or':_['map'](_0x2436d8,function(_0x92f5d9){if(_0x92f5d9[_0x869d('0x2e')]!==_0x869d('0x3b')){var _0x3f8f42={};_0x3f8f42[_0x92f5d9[_0x869d('0x28')]]={'$like':'%'+_0x90e276[_0x869d('0x32')][_0x869d('0x3a')]+'%'};return _0x3f8f42;}})});}_0x176f38=_[_0x869d('0x3c')]({},_0x176f38,_0x90e276['options']);var _0x3a3a3b={'where':_0x176f38[_0x869d('0x39')]};return db['Dashboard']['count'](_0x3a3a3b)[_0x869d('0x24')](function(_0x299432){_0xc21a2['count']=_0x299432;if(_0x90e276[_0x869d('0x32')]['includeAll']){_0x176f38[_0x869d('0x3d')]=[{'all':!![]}];}return db[_0x869d('0x3e')]['findAll'](_0x176f38);})[_0x869d('0x24')](function(_0x5cb59c){_0xc21a2[_0x869d('0x3f')]=_0x5cb59c;return _0xc21a2;})[_0x869d('0x24')](respondWithFilteredResult(_0x7552cf,_0x176f38))[_0x869d('0x40')](handleError(_0x7552cf,null));};exports[_0x869d('0x41')]=function(_0x162e7f,_0x4ea410){var _0x501b23={'raw':![],'where':{'id':_0x162e7f[_0x869d('0x42')]['id']}},_0x12d394={};_0x12d394[_0x869d('0x2f')]=_[_0x869d('0x30')](db['Dashboard'][_0x869d('0x2c')]);_0x12d394[_0x869d('0x32')]=_[_0x869d('0x30')](_0x162e7f['query']);_0x12d394[_0x869d('0x31')]=_[_0x869d('0x33')](_0x12d394[_0x869d('0x2f')],_0x12d394[_0x869d('0x32')]);_0x501b23[_0x869d('0x35')]=_['intersection'](_0x12d394[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x162e7f[_0x869d('0x32')][_0x869d('0x34')]));_0x501b23['attributes']=_0x501b23[_0x869d('0x35')][_0x869d('0x43')]?_0x501b23[_0x869d('0x35')]:_0x12d394[_0x869d('0x2f')];if(_0x162e7f['query']['includeAll']){_0x501b23[_0x869d('0x3d')]=[{'all':!![]}];}_0x501b23=_['merge']({},_0x501b23,_0x162e7f[_0x869d('0x44')]);return db[_0x869d('0x3e')][_0x869d('0x45')](_0x501b23)[_0x869d('0x24')](handleEntityNotFound(_0x4ea410,null))['then'](respondWithResult(_0x4ea410,null))[_0x869d('0x40')](handleError(_0x4ea410,null));};exports[_0x869d('0x46')]=function(_0x557f7d,_0x26c1c8){return db[_0x869d('0x3e')][_0x869d('0x46')](_0x557f7d[_0x869d('0x47')],{})[_0x869d('0x24')](function(_0x562fcd){var _0x2fcca2=_0x557f7d['user'][_0x869d('0x48')]({'plain':!![]});if(!_0x2fcca2)throw new Error(_0x869d('0x49'));if(_0x2fcca2[_0x869d('0x4a')]===_0x869d('0x4b')){var _0x20c7af=_0x562fcd['get']({'plain':!![]});var _0x528636='CustomDashboards';return db[_0x869d('0x4c')]['find']({'where':{'name':_0x528636,'userProfileId':_0x2fcca2[_0x869d('0x4d')]},'raw':!![]})[_0x869d('0x24')](function(_0xb4325f){if(_0xb4325f&&_0xb4325f[_0x869d('0x4e')]===0x0){return db[_0x869d('0x4f')][_0x869d('0x46')]({'name':_0x20c7af[_0x869d('0x28')],'resourceId':_0x20c7af['id'],'type':_0xb4325f[_0x869d('0x28')],'sectionId':_0xb4325f['id']},{})['then'](function(){return _0x562fcd;});}else{return _0x562fcd;}})['catch'](function(_0x4ef5b0){logger[_0x869d('0x26')](_0x869d('0x50'),_0x4ef5b0);throw _0x4ef5b0;});}return _0x562fcd;})['then'](respondWithResult(_0x26c1c8,0xc9))[_0x869d('0x40')](handleError(_0x26c1c8,null));};exports[_0x869d('0x51')]=function(_0x3e209f,_0x36518f){var _0x5f3eba={'where':{'id':_0x3e209f['params']['id']}},_0x2f7f00={};_0x2f7f00[_0x869d('0x2f')]=_['keys'](db[_0x869d('0x3e')]['rawAttributes']);_0x5f3eba['attributes']=_[_0x869d('0x33')](_0x2f7f00[_0x869d('0x2f')],qs[_0x869d('0x34')](_0x3e209f[_0x869d('0x32')]['fields']));_0x5f3eba[_0x869d('0x35')]=_0x5f3eba[_0x869d('0x35')][_0x869d('0x43')]?_0x5f3eba['attributes']:_0x2f7f00[_0x869d('0x2f')];if(_0x3e209f['query'][_0x869d('0x52')]){_0x5f3eba[_0x869d('0x3d')]=[{'all':!![]}];}_0x5f3eba=_[_0x869d('0x3c')]({},_0x5f3eba,_0x3e209f[_0x869d('0x44')]);return db[_0x869d('0x3e')][_0x869d('0x45')](_0x5f3eba)[_0x869d('0x24')](handleEntityNotFound(_0x36518f,null))[_0x869d('0x24')](function(_0xbc568c){if(_0xbc568c){var _0xf3ab7f=_0xbc568c[_0x869d('0x48')]({'plain':!![]});_0xf3ab7f=qs['omit'](_0xf3ab7f,['id','createdAt',_0x869d('0x53')]);_0x3e209f[_0x869d('0x47')]=_[_0x869d('0x54')](_0x3e209f['body'],['id',_0x869d('0x55'),_0x869d('0x53')]);return db['Dashboard'][_0x869d('0x46')](_[_0x869d('0x3c')](_0xf3ab7f,_0x3e209f['body']),{'include':_0x3e209f['query'][_0x869d('0x52')]?[{'all':!![]}]:undefined})[_0x869d('0x24')](function(_0x4923ec){var _0x4512a3=_0x3e209f[_0x869d('0x4b')][_0x869d('0x48')]({'plain':!![]});if(!_0x4512a3)throw new Error(_0x869d('0x49'));if(_0x4512a3[_0x869d('0x4a')]===_0x869d('0x4b')){var _0x5efad1=_0x4923ec[_0x869d('0x48')]({'plain':!![]});var _0x11cc50=_0x869d('0x56');return db[_0x869d('0x4c')][_0x869d('0x45')]({'where':{'name':_0x11cc50,'userProfileId':_0x4512a3[_0x869d('0x4d')]},'raw':!![]})['then'](function(_0x323d41){if(_0x323d41&&_0x323d41['autoAssociation']===0x0){return db[_0x869d('0x4f')][_0x869d('0x46')]({'name':_0x5efad1[_0x869d('0x28')],'resourceId':_0x5efad1['id'],'type':_0x323d41[_0x869d('0x28')],'sectionId':_0x323d41['id']},{})[_0x869d('0x24')](function(){return _0x4923ec;});}else{return _0x4923ec;}})[_0x869d('0x40')](function(_0x1dca77){logger[_0x869d('0x26')](_0x869d('0x50'),_0x1dca77);throw _0x1dca77;});}return _0x4923ec;});}})['then'](respondWithResult(_0x36518f,0xc9))['catch'](handleError(_0x36518f,null));};exports[_0x869d('0x23')]=function(_0x53d8f2,_0x14e181){if(_0x53d8f2[_0x869d('0x47')]['id']){delete _0x53d8f2[_0x869d('0x47')]['id'];}return db[_0x869d('0x3e')][_0x869d('0x45')]({'where':{'id':_0x53d8f2['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x14e181,null))['then'](saveUpdates(_0x53d8f2[_0x869d('0x47')],null))[_0x869d('0x24')](respondWithResult(_0x14e181,null))[_0x869d('0x40')](handleError(_0x14e181,null));};exports[_0x869d('0x25')]=function(_0x341793,_0x2f35d4){return db[_0x869d('0x3e')][_0x869d('0x45')]({'where':{'id':_0x341793['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x2f35d4,null))[_0x869d('0x24')](removeEntity(_0x2f35d4,null))[_0x869d('0x40')](handleError(_0x2f35d4,null));};function widgetAttributes(_0x23560d){try{switch(_0x23560d[_0x869d('0x2e')]){case _0x869d('0x57'):return[{'name':_0x869d('0x58'),'value':_0x23560d[_0x869d('0x58')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||_0x869d('0x5b')}];case _0x869d('0x5c'):return[{'name':_0x869d('0x5d'),'value':_0x23560d[_0x869d('0x5d')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||''}];case _0x869d('0x5e'):return[{'name':_0x869d('0x5f'),'value':_0x23560d[_0x869d('0x5f')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||_0x869d('0x60')},{'name':_0x869d('0x61'),'value':_0x23560d[_0x869d('0x61')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d[_0x869d('0x59')][0x1][_0x869d('0x5a')]:undefined)||_0x869d('0x62')},{'name':_0x869d('0x63'),'value':_0x23560d[_0x869d('0x63')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x869d('0x64'),'value':_0x23560d[_0x869d('0x64')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0]['value']:undefined)||_0x869d('0x65')},{'name':'attrVoiceQueues','value':_0x23560d[_0x869d('0x66')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d['attrs'][0x1]['value']:undefined)||[]},{'name':_0x869d('0x63'),'value':_0x23560d[_0x869d('0x63')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d[_0x869d('0x59')][0x2][_0x869d('0x5a')]:undefined)||0x14}];case _0x869d('0x67'):case _0x869d('0x68'):return[{'name':_0x869d('0x69'),'value':_0x23560d['attrSerie1']||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||'total'},{'name':_0x869d('0x6a'),'value':_0x23560d['attrSerie2']||(_0x23560d['attrs']&&_0x23560d['attrs'][0x1]?_0x23560d['attrs'][0x1][_0x869d('0x5a')]:undefined)||null},{'name':_0x869d('0x6b'),'value':_0x23560d[_0x869d('0x6b')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x2]?_0x23560d[_0x869d('0x59')][0x2][_0x869d('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x23560d[_0x869d('0x66')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x3]?_0x23560d[_0x869d('0x59')][0x3][_0x869d('0x5a')]:undefined)||[]}];case _0x869d('0x6c'):return[{'name':'attrReport','type':_0x23560d[_0x869d('0x6d')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0]['type']:undefined)||null,'value':_0x23560d[_0x869d('0x6e')]||(_0x23560d['attrs']&&_0x23560d[_0x869d('0x59')][0x0]?_0x23560d[_0x869d('0x59')][0x0][_0x869d('0x5a')]:undefined)||null},{'name':_0x869d('0x6f'),'value':_0x23560d[_0x869d('0x6f')]||(_0x23560d[_0x869d('0x59')]&&_0x23560d[_0x869d('0x59')][0x1]?_0x23560d['attrs'][0x1][_0x869d('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x29a6c7){logger[_0x869d('0x26')](_0x869d('0x70'),JSON[_0x869d('0x71')](_0x29a6c7));return[];}}exports['addItem']=function(_0xb0375b,_0x15593b,_0x112f5b){if(_0xb0375b[_0x869d('0x47')]['id']){delete _0xb0375b['body']['id'];}return db['Dashboard'][_0x869d('0x45')]({'where':{'id':_0xb0375b[_0x869d('0x42')]['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x15593b,null))[_0x869d('0x24')](function(_0xa40956){if(_0xa40956){_0xb0375b[_0x869d('0x47')][_0x869d('0x72')]=_0xa40956['id'];_0xb0375b[_0x869d('0x47')][_0x869d('0x59')]=widgetAttributes(_0xb0375b[_0x869d('0x47')]);return db['DashboardItem'][_0x869d('0x46')](_0xb0375b['body']);}})['then'](respondWithResult(_0x15593b,null))[_0x869d('0x40')](handleError(_0x15593b,null));};exports[_0x869d('0x73')]=function(_0x97e2d0,_0x381784,_0x114397){var _0x556946={};var _0x47d1b4={};var _0x46b232;var _0x1ce9da;return db[_0x869d('0x3e')][_0x869d('0x74')]({'where':{'id':_0x97e2d0['params']['id']}})[_0x869d('0x24')](handleEntityNotFound(_0x381784,null))[_0x869d('0x24')](function(_0x2b1dee){if(_0x2b1dee){_0x46b232=_0x2b1dee;_0x47d1b4['model']=_[_0x869d('0x30')](db[_0x869d('0x75')][_0x869d('0x2c')]);_0x47d1b4[_0x869d('0x32')]=_[_0x869d('0x30')](_0x97e2d0[_0x869d('0x32')]);_0x47d1b4[_0x869d('0x31')]=_['intersection'](_0x47d1b4[_0x869d('0x2f')],_0x47d1b4[_0x869d('0x32')]);_0x556946[_0x869d('0x35')]=_['intersection'](_0x47d1b4[_0x869d('0x2f')],qs['fields'](_0x97e2d0[_0x869d('0x32')][_0x869d('0x34')]));_0x556946[_0x869d('0x35')]=_0x556946['attributes'][_0x869d('0x43')]?_0x556946['attributes']:_0x47d1b4[_0x869d('0x2f')];_0x556946['order']=qs[_0x869d('0x38')](_0x97e2d0[_0x869d('0x32')][_0x869d('0x38')]);_0x556946[_0x869d('0x39')]=qs[_0x869d('0x31')](_[_0x869d('0x76')](_0x97e2d0['query'],_0x47d1b4[_0x869d('0x31')]));if(_0x97e2d0[_0x869d('0x32')]['filter']){_0x556946['where']=_[_0x869d('0x3c')](_0x556946['where'],{'$or':_[_0x869d('0x2b')](_0x556946[_0x869d('0x35')],function(_0x379334){var _0x546c0d={};_0x546c0d[_0x379334]={'$like':'%'+_0x97e2d0[_0x869d('0x32')]['filter']+'%'};return _0x546c0d;})});}_0x556946=_['merge']({},_0x556946,_0x97e2d0[_0x869d('0x44')]);return _0x46b232['getItems'](_0x556946);}})[_0x869d('0x24')](function(_0x38aaf2){if(_0x38aaf2){_0x1ce9da=_0x38aaf2[_0x869d('0x43')];if(!_0x97e2d0[_0x869d('0x32')][_0x869d('0x36')](_0x869d('0x77'))){_0x556946['limit']=qs[_0x869d('0x1f')](_0x97e2d0[_0x869d('0x32')]['limit']);_0x556946[_0x869d('0x37')]=qs[_0x869d('0x37')](_0x97e2d0[_0x869d('0x32')][_0x869d('0x37')]);}return _0x46b232['getItems'](_0x556946);}})['then'](function(_0x2bc39f){if(_0x2bc39f){return _0x2bc39f?{'count':_0x1ce9da,'rows':_0x2bc39f}:null;}})[_0x869d('0x24')](respondWithResult(_0x381784,null))[_0x869d('0x40')](handleError(_0x381784,null));}; \ No newline at end of file +var _0x14b0=['omit','updatedAt','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','html-pdf','eml-format','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','index','Dashboard','rawAttributes','type','model','map','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','params'];(function(_0xba1df3,_0x468bf4){var _0x18ba20=function(_0x5eb274){while(--_0x5eb274){_0xba1df3['push'](_0xba1df3['shift']());}};_0x18ba20(++_0x468bf4);}(_0x14b0,0x110));var _0x014b=function(_0x22249f,_0x4db7ef){_0x22249f=_0x22249f-0x0;var _0x306a1b=_0x14b0[_0x22249f];return _0x306a1b;};'use strict';var pdf=require(_0x014b('0x0'));var emlformat=require(_0x014b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x014b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x014b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x014b('0x4'));var util=require(_0x014b('0x5'));var path=require(_0x014b('0x6'));var sox=require('sox');var csv=require(_0x014b('0x7'));var ejs=require(_0x014b('0x8'));var fs=require('fs');var _=require(_0x014b('0x9'));var squel=require('squel');var crypto=require(_0x014b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x014b('0x7'));var querystring=require(_0x014b('0xb'));var Papa=require(_0x014b('0xc'));var Redis=require(_0x014b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x014b('0xe'));var as=require(_0x014b('0xf'));var hardwareService=require(_0x014b('0x10'));var logger=require(_0x014b('0x11'))(_0x014b('0x12'));var utils=require('../../config/utils');var config=require(_0x014b('0x13'));var db=require(_0x014b('0x14'))['db'];config[_0x014b('0x15')]=_[_0x014b('0x16')](config['redis'],{'host':_0x014b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x014b('0x15')]));require(_0x014b('0x18'))[_0x014b('0x19')](socket);function respondWithStatusCode(_0x551ef2,_0x4b98d7){_0x4b98d7=_0x4b98d7||0xcc;return function(_0x36e1de){if(_0x36e1de){return _0x551ef2[_0x014b('0x1a')](_0x4b98d7);}return _0x551ef2[_0x014b('0x1b')](_0x4b98d7)[_0x014b('0x1c')]();};}function respondWithResult(_0x105b3f,_0x219643){_0x219643=_0x219643||0xc8;return function(_0x4562f6){if(_0x4562f6){return _0x105b3f[_0x014b('0x1b')](_0x219643)[_0x014b('0x1d')](_0x4562f6);}};}function respondWithFilteredResult(_0xb5ed8d,_0x1103f9){return function(_0xacb80c){if(_0xacb80c){var _0x187661=_0xacb80c[_0x014b('0x1e')],_0x519c12=_0x1103f9[_0x014b('0x1f')],_0x5ec626=_0x1103f9[_0x014b('0x1f')]+_0x1103f9[_0x014b('0x20')],_0xfe69f2;if(_0x5ec626>=_0x187661){_0x5ec626=_0x187661;_0xfe69f2=0xc8;}else{_0xfe69f2=0xce;}_0xb5ed8d[_0x014b('0x1b')](_0xfe69f2);return _0xb5ed8d[_0x014b('0x21')]('Content-Range',_0x519c12+'-'+_0x5ec626+'/'+_0x187661)[_0x014b('0x1d')](_0xacb80c);}return null;};}function patchUpdates(_0x4c78d5){return function(_0x586337){try{jsonpatch[_0x014b('0x22')](_0x586337,_0x4c78d5,!![]);}catch(_0x5c4b88){return BPromise[_0x014b('0x23')](_0x5c4b88);}return _0x586337['save']();};}function saveUpdates(_0x51085f,_0x52bf76){return function(_0x329c63){if(_0x329c63){return _0x329c63[_0x014b('0x24')](_0x51085f)[_0x014b('0x25')](function(_0x4f7ae9){return _0x4f7ae9;});}return null;};}function removeEntity(_0x11bb7a,_0x5c93d6){return function(_0x4c42bb){if(_0x4c42bb){return _0x4c42bb[_0x014b('0x26')]()[_0x014b('0x25')](function(){var _0x3bdde0=_0x4c42bb['get']({'plain':!![]});var _0x17d706=_0x014b('0x27');return db[_0x014b('0x28')]['destroy']({'where':{'type':_0x17d706,'resourceId':_0x3bdde0['id']}})[_0x014b('0x25')](function(){return _0x4c42bb;});})['then'](function(){_0x11bb7a[_0x014b('0x1b')](0xcc)[_0x014b('0x1c')]();});}};}function handleEntityNotFound(_0x19999e,_0x4373a6){return function(_0x32614b){if(!_0x32614b){_0x19999e[_0x014b('0x1a')](0x194);}return _0x32614b;};}function handleError(_0x4c9610,_0x327166){_0x327166=_0x327166||0x1f4;return function(_0x3bdb3d){logger[_0x014b('0x29')](_0x3bdb3d[_0x014b('0x2a')]);if(_0x3bdb3d[_0x014b('0x2b')]){delete _0x3bdb3d[_0x014b('0x2b')];}_0x4c9610[_0x014b('0x1b')](_0x327166)['send'](_0x3bdb3d);};}exports[_0x014b('0x2c')]=function(_0x51f714,_0x8161cc){var _0x505783={},_0x3a09c1={},_0x350a7a={'count':0x0,'rows':[]};var _0x3e0b80=_['map'](db[_0x014b('0x2d')][_0x014b('0x2e')],function(_0x29d951){return{'name':_0x29d951['fieldName'],'type':_0x29d951[_0x014b('0x2f')]['key']};});_0x3a09c1[_0x014b('0x30')]=_[_0x014b('0x31')](_0x3e0b80,'name');_0x3a09c1['query']=_['keys'](_0x51f714['query']);_0x3a09c1['filters']=_[_0x014b('0x32')](_0x3a09c1[_0x014b('0x30')],_0x3a09c1[_0x014b('0x33')]);_0x505783[_0x014b('0x34')]=_[_0x014b('0x32')](_0x3a09c1[_0x014b('0x30')],qs[_0x014b('0x35')](_0x51f714['query'][_0x014b('0x35')]));_0x505783[_0x014b('0x34')]=_0x505783[_0x014b('0x34')][_0x014b('0x36')]?_0x505783[_0x014b('0x34')]:_0x3a09c1[_0x014b('0x30')];if(!_0x51f714[_0x014b('0x33')][_0x014b('0x37')]('nolimit')){_0x505783[_0x014b('0x20')]=qs[_0x014b('0x20')](_0x51f714['query']['limit']);_0x505783[_0x014b('0x1f')]=qs['offset'](_0x51f714['query'][_0x014b('0x1f')]);}_0x505783[_0x014b('0x38')]=qs[_0x014b('0x39')](_0x51f714[_0x014b('0x33')][_0x014b('0x39')]);_0x505783[_0x014b('0x3a')]=qs[_0x014b('0x3b')](_[_0x014b('0x3c')](_0x51f714[_0x014b('0x33')],_0x3a09c1[_0x014b('0x3b')]),_0x3e0b80);if(_0x51f714[_0x014b('0x33')][_0x014b('0x3d')]){_0x505783[_0x014b('0x3a')]=_[_0x014b('0x3e')](_0x505783['where'],{'$or':_[_0x014b('0x31')](_0x3e0b80,function(_0x100628){if(_0x100628[_0x014b('0x2f')]!==_0x014b('0x3f')){var _0x51f0f3={};_0x51f0f3[_0x100628[_0x014b('0x2b')]]={'$like':'%'+_0x51f714[_0x014b('0x33')][_0x014b('0x3d')]+'%'};return _0x51f0f3;}})});}_0x505783=_['merge']({},_0x505783,_0x51f714[_0x014b('0x40')]);var _0x5505e5={'where':_0x505783[_0x014b('0x3a')]};return db[_0x014b('0x2d')][_0x014b('0x1e')](_0x5505e5)[_0x014b('0x25')](function(_0x5bcb5b){_0x350a7a[_0x014b('0x1e')]=_0x5bcb5b;if(_0x51f714[_0x014b('0x33')][_0x014b('0x41')]){_0x505783[_0x014b('0x42')]=[{'all':!![]}];}return db[_0x014b('0x2d')][_0x014b('0x43')](_0x505783);})['then'](function(_0x5a591e){_0x350a7a[_0x014b('0x44')]=_0x5a591e;return _0x350a7a;})[_0x014b('0x25')](respondWithFilteredResult(_0x8161cc,_0x505783))[_0x014b('0x45')](handleError(_0x8161cc,null));};exports[_0x014b('0x46')]=function(_0x93965b,_0x5dec2b){var _0x3f70f9={'raw':![],'where':{'id':_0x93965b['params']['id']}},_0x376b58={};_0x376b58[_0x014b('0x30')]=_[_0x014b('0x47')](db[_0x014b('0x2d')][_0x014b('0x2e')]);_0x376b58[_0x014b('0x33')]=_[_0x014b('0x47')](_0x93965b[_0x014b('0x33')]);_0x376b58[_0x014b('0x3b')]=_[_0x014b('0x32')](_0x376b58[_0x014b('0x30')],_0x376b58['query']);_0x3f70f9['attributes']=_[_0x014b('0x32')](_0x376b58['model'],qs['fields'](_0x93965b['query'][_0x014b('0x35')]));_0x3f70f9[_0x014b('0x34')]=_0x3f70f9[_0x014b('0x34')][_0x014b('0x36')]?_0x3f70f9[_0x014b('0x34')]:_0x376b58[_0x014b('0x30')];if(_0x93965b[_0x014b('0x33')][_0x014b('0x41')]){_0x3f70f9[_0x014b('0x42')]=[{'all':!![]}];}_0x3f70f9=_['merge']({},_0x3f70f9,_0x93965b[_0x014b('0x40')]);return db[_0x014b('0x2d')][_0x014b('0x48')](_0x3f70f9)['then'](handleEntityNotFound(_0x5dec2b,null))[_0x014b('0x25')](respondWithResult(_0x5dec2b,null))[_0x014b('0x45')](handleError(_0x5dec2b,null));};exports[_0x014b('0x49')]=function(_0x479452,_0x1c5159){return db[_0x014b('0x2d')][_0x014b('0x49')](_0x479452[_0x014b('0x4a')],{})[_0x014b('0x25')](function(_0x55490b){var _0x47959e=_0x479452['user'][_0x014b('0x4b')]({'plain':!![]});if(!_0x47959e)throw new Error(_0x014b('0x4c'));if(_0x47959e[_0x014b('0x4d')]===_0x014b('0x4e')){var _0x1333bc=_0x55490b[_0x014b('0x4b')]({'plain':!![]});var _0x551a68=_0x014b('0x27');return db[_0x014b('0x4f')]['find']({'where':{'name':_0x551a68,'userProfileId':_0x47959e['userProfileId']},'raw':!![]})['then'](function(_0x1246ef){if(_0x1246ef&&_0x1246ef[_0x014b('0x50')]===0x0){return db[_0x014b('0x28')][_0x014b('0x49')]({'name':_0x1333bc[_0x014b('0x2b')],'resourceId':_0x1333bc['id'],'type':_0x1246ef[_0x014b('0x2b')],'sectionId':_0x1246ef['id']},{})[_0x014b('0x25')](function(){return _0x55490b;});}else{return _0x55490b;}})[_0x014b('0x45')](function(_0x5f53a5){logger[_0x014b('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f53a5);throw _0x5f53a5;});}return _0x55490b;})['then'](respondWithResult(_0x1c5159,0xc9))[_0x014b('0x45')](handleError(_0x1c5159,null));};exports['clone']=function(_0x3eac18,_0x33eb43){var _0x30b13e={'where':{'id':_0x3eac18[_0x014b('0x51')]['id']}},_0x599f37={};_0x599f37[_0x014b('0x30')]=_['keys'](db[_0x014b('0x2d')][_0x014b('0x2e')]);_0x30b13e[_0x014b('0x34')]=_[_0x014b('0x32')](_0x599f37[_0x014b('0x30')],qs[_0x014b('0x35')](_0x3eac18[_0x014b('0x33')][_0x014b('0x35')]));_0x30b13e[_0x014b('0x34')]=_0x30b13e[_0x014b('0x34')][_0x014b('0x36')]?_0x30b13e['attributes']:_0x599f37[_0x014b('0x30')];if(_0x3eac18[_0x014b('0x33')][_0x014b('0x41')]){_0x30b13e[_0x014b('0x42')]=[{'all':!![]}];}_0x30b13e=_[_0x014b('0x3e')]({},_0x30b13e,_0x3eac18['options']);return db[_0x014b('0x2d')]['find'](_0x30b13e)[_0x014b('0x25')](handleEntityNotFound(_0x33eb43,null))[_0x014b('0x25')](function(_0x199f14){if(_0x199f14){var _0x199147=_0x199f14[_0x014b('0x4b')]({'plain':!![]});_0x199147=qs[_0x014b('0x52')](_0x199147,['id','createdAt',_0x014b('0x53')]);_0x3eac18[_0x014b('0x4a')]=_['omit'](_0x3eac18['body'],['id',_0x014b('0x54'),_0x014b('0x53')]);return db[_0x014b('0x2d')][_0x014b('0x49')](_['merge'](_0x199147,_0x3eac18[_0x014b('0x4a')]),{'include':_0x3eac18['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x26a27c){var _0x46849b=_0x3eac18[_0x014b('0x4e')][_0x014b('0x4b')]({'plain':!![]});if(!_0x46849b)throw new Error(_0x014b('0x4c'));if(_0x46849b['role']==='user'){var _0x47a459=_0x26a27c[_0x014b('0x4b')]({'plain':!![]});var _0x5cf973='CustomDashboards';return db[_0x014b('0x4f')][_0x014b('0x48')]({'where':{'name':_0x5cf973,'userProfileId':_0x46849b[_0x014b('0x55')]},'raw':!![]})[_0x014b('0x25')](function(_0x5414c4){if(_0x5414c4&&_0x5414c4[_0x014b('0x50')]===0x0){return db[_0x014b('0x28')][_0x014b('0x49')]({'name':_0x47a459[_0x014b('0x2b')],'resourceId':_0x47a459['id'],'type':_0x5414c4[_0x014b('0x2b')],'sectionId':_0x5414c4['id']},{})[_0x014b('0x25')](function(){return _0x26a27c;});}else{return _0x26a27c;}})['catch'](function(_0x47a022){logger['error'](_0x014b('0x56'),_0x47a022);throw _0x47a022;});}return _0x26a27c;});}})['then'](respondWithResult(_0x33eb43,0xc9))[_0x014b('0x45')](handleError(_0x33eb43,null));};exports[_0x014b('0x24')]=function(_0xbd8b3f,_0x389e9){if(_0xbd8b3f['body']['id']){delete _0xbd8b3f[_0x014b('0x4a')]['id'];}return db[_0x014b('0x2d')][_0x014b('0x48')]({'where':{'id':_0xbd8b3f[_0x014b('0x51')]['id']}})[_0x014b('0x25')](handleEntityNotFound(_0x389e9,null))[_0x014b('0x25')](saveUpdates(_0xbd8b3f['body'],null))[_0x014b('0x25')](respondWithResult(_0x389e9,null))['catch'](handleError(_0x389e9,null));};exports[_0x014b('0x26')]=function(_0x7bb9c6,_0x5170e3){return db[_0x014b('0x2d')][_0x014b('0x48')]({'where':{'id':_0x7bb9c6['params']['id']}})['then'](handleEntityNotFound(_0x5170e3,null))[_0x014b('0x25')](removeEntity(_0x5170e3,null))[_0x014b('0x45')](handleError(_0x5170e3,null));};function widgetAttributes(_0x40a546){try{switch(_0x40a546[_0x014b('0x2f')]){case _0x014b('0x57'):return[{'name':_0x014b('0x58'),'value':_0x40a546[_0x014b('0x58')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x0]?_0x40a546[_0x014b('0x59')][0x0][_0x014b('0x5a')]:undefined)||_0x014b('0x5b')}];case _0x014b('0x5c'):return[{'name':_0x014b('0x5d'),'value':_0x40a546[_0x014b('0x5d')]||(_0x40a546['attrs']&&_0x40a546['attrs'][0x0]?_0x40a546[_0x014b('0x59')][0x0][_0x014b('0x5a')]:undefined)||''}];case _0x014b('0x5e'):return[{'name':_0x014b('0x5f'),'value':_0x40a546['attrHourFormat']||(_0x40a546[_0x014b('0x59')]&&_0x40a546['attrs'][0x0]?_0x40a546[_0x014b('0x59')][0x0][_0x014b('0x5a')]:undefined)||_0x014b('0x60')},{'name':'attrTimezone','value':_0x40a546['attrTimezone']||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x1]?_0x40a546[_0x014b('0x59')][0x1]['value']:undefined)||_0x014b('0x61')},{'name':'attrFontSize','value':_0x40a546[_0x014b('0x62')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x2]?_0x40a546[_0x014b('0x59')][0x2][_0x014b('0x5a')]:undefined)||0xc}];case _0x014b('0x63'):return[{'name':_0x014b('0x64'),'value':_0x40a546[_0x014b('0x64')]||(_0x40a546['attrs']&&_0x40a546['attrs'][0x0]?_0x40a546[_0x014b('0x59')][0x0][_0x014b('0x5a')]:undefined)||'total'},{'name':_0x014b('0x65'),'value':_0x40a546[_0x014b('0x65')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x1]?_0x40a546[_0x014b('0x59')][0x1][_0x014b('0x5a')]:undefined)||[]},{'name':_0x014b('0x62'),'value':_0x40a546['attrFontSize']||(_0x40a546['attrs']&&_0x40a546[_0x014b('0x59')][0x2]?_0x40a546[_0x014b('0x59')][0x2]['value']:undefined)||0x14}];case _0x014b('0x66'):case _0x014b('0x67'):return[{'name':'attrSerie1','value':_0x40a546[_0x014b('0x68')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x0]?_0x40a546[_0x014b('0x59')][0x0]['value']:undefined)||'total'},{'name':_0x014b('0x69'),'value':_0x40a546['attrSerie2']||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x1]?_0x40a546[_0x014b('0x59')][0x1][_0x014b('0x5a')]:undefined)||null},{'name':'attrSerie3','value':_0x40a546[_0x014b('0x6a')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x2]?_0x40a546[_0x014b('0x59')][0x2][_0x014b('0x5a')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x40a546[_0x014b('0x65')]||(_0x40a546['attrs']&&_0x40a546[_0x014b('0x59')][0x3]?_0x40a546['attrs'][0x3][_0x014b('0x5a')]:undefined)||[]}];case _0x014b('0x6b'):return[{'name':_0x014b('0x6c'),'type':_0x40a546[_0x014b('0x6d')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x0]?_0x40a546['attrs'][0x0][_0x014b('0x2f')]:undefined)||null,'value':_0x40a546['attrReport']||(_0x40a546[_0x014b('0x59')]&&_0x40a546['attrs'][0x0]?_0x40a546[_0x014b('0x59')][0x0][_0x014b('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x40a546[_0x014b('0x6e')]||(_0x40a546[_0x014b('0x59')]&&_0x40a546[_0x014b('0x59')][0x1]?_0x40a546[_0x014b('0x59')][0x1][_0x014b('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x1db847){logger['error'](_0x014b('0x6f'),JSON[_0x014b('0x70')](_0x1db847));return[];}}exports[_0x014b('0x71')]=function(_0x18f348,_0x35de78,_0x3ad023){if(_0x18f348[_0x014b('0x4a')]['id']){delete _0x18f348['body']['id'];}return db[_0x014b('0x2d')][_0x014b('0x48')]({'where':{'id':_0x18f348[_0x014b('0x51')]['id']}})[_0x014b('0x25')](handleEntityNotFound(_0x35de78,null))['then'](function(_0x400c1f){if(_0x400c1f){_0x18f348['body'][_0x014b('0x72')]=_0x400c1f['id'];_0x18f348['body']['attrs']=widgetAttributes(_0x18f348['body']);return db[_0x014b('0x73')][_0x014b('0x49')](_0x18f348['body']);}})['then'](respondWithResult(_0x35de78,null))['catch'](handleError(_0x35de78,null));};exports[_0x014b('0x74')]=function(_0x5c8d35,_0x3bf437,_0x2ac2c2){var _0x1e99ab={};var _0x34894f={};var _0x4262b5;var _0x315bb8;return db[_0x014b('0x2d')]['findOne']({'where':{'id':_0x5c8d35[_0x014b('0x51')]['id']}})[_0x014b('0x25')](handleEntityNotFound(_0x3bf437,null))[_0x014b('0x25')](function(_0x5bccb6){if(_0x5bccb6){_0x4262b5=_0x5bccb6;_0x34894f[_0x014b('0x30')]=_['keys'](db['DashboardItem']['rawAttributes']);_0x34894f[_0x014b('0x33')]=_[_0x014b('0x47')](_0x5c8d35[_0x014b('0x33')]);_0x34894f[_0x014b('0x3b')]=_[_0x014b('0x32')](_0x34894f[_0x014b('0x30')],_0x34894f[_0x014b('0x33')]);_0x1e99ab[_0x014b('0x34')]=_[_0x014b('0x32')](_0x34894f['model'],qs[_0x014b('0x35')](_0x5c8d35['query'][_0x014b('0x35')]));_0x1e99ab['attributes']=_0x1e99ab[_0x014b('0x34')][_0x014b('0x36')]?_0x1e99ab[_0x014b('0x34')]:_0x34894f[_0x014b('0x30')];_0x1e99ab[_0x014b('0x38')]=qs[_0x014b('0x39')](_0x5c8d35[_0x014b('0x33')]['sort']);_0x1e99ab[_0x014b('0x3a')]=qs[_0x014b('0x3b')](_[_0x014b('0x3c')](_0x5c8d35[_0x014b('0x33')],_0x34894f['filters']));if(_0x5c8d35[_0x014b('0x33')]['filter']){_0x1e99ab[_0x014b('0x3a')]=_['merge'](_0x1e99ab[_0x014b('0x3a')],{'$or':_[_0x014b('0x31')](_0x1e99ab[_0x014b('0x34')],function(_0x1c9421){var _0x1e0992={};_0x1e0992[_0x1c9421]={'$like':'%'+_0x5c8d35['query'][_0x014b('0x3d')]+'%'};return _0x1e0992;})});}_0x1e99ab=_[_0x014b('0x3e')]({},_0x1e99ab,_0x5c8d35['options']);return _0x4262b5[_0x014b('0x74')](_0x1e99ab);}})[_0x014b('0x25')](function(_0x219530){if(_0x219530){_0x315bb8=_0x219530[_0x014b('0x36')];if(!_0x5c8d35['query'][_0x014b('0x37')](_0x014b('0x75'))){_0x1e99ab[_0x014b('0x20')]=qs[_0x014b('0x20')](_0x5c8d35[_0x014b('0x33')][_0x014b('0x20')]);_0x1e99ab[_0x014b('0x1f')]=qs['offset'](_0x5c8d35[_0x014b('0x33')][_0x014b('0x1f')]);}return _0x4262b5[_0x014b('0x74')](_0x1e99ab);}})[_0x014b('0x25')](function(_0x59ac89){if(_0x59ac89){return _0x59ac89?{'count':_0x315bb8,'rows':_0x59ac89}:null;}})[_0x014b('0x25')](respondWithResult(_0x3bf437,null))[_0x014b('0x45')](handleError(_0x3bf437,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 9013391..3a6e686 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 _0x9797=['../../mysqldb','Dashboard','save','remove','emit','hasOwnProperty','exports'];(function(_0xbc2d9e,_0x40ef4f){var _0x2e315c=function(_0x57fc55){while(--_0x57fc55){_0xbc2d9e['push'](_0xbc2d9e['shift']());}};_0x2e315c(++_0x40ef4f);}(_0x9797,0x149));var _0x7979=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x9797[_0xf4129c];return _0x426611;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x7979('0x0'))['db'][_0x7979('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7979('0x2'),'afterUpdate':'update','afterDestroy':_0x7979('0x3')};function emitEvent(_0x190833){return function(_0x4c4898,_0x5ee8b8,_0x56f3cd){DashboardEvents[_0x7979('0x4')](_0x190833+':'+_0x4c4898['id'],_0x4c4898);DashboardEvents[_0x7979('0x4')](_0x190833,_0x4c4898);_0x56f3cd(null);};}for(var e in events){if(events[_0x7979('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x7979('0x6')]=DashboardEvents; \ No newline at end of file +var _0x2e18=['exports','../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x227142,_0x409b1f){var _0x3446a0=function(_0x4a15cd){while(--_0x4a15cd){_0x227142['push'](_0x227142['shift']());}};_0x3446a0(++_0x409b1f);}(_0x2e18,0x181));var _0x82e1=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x2e18[_0x32b542];return _0x554d54;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x82e1('0x0'))['db'][_0x82e1('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x82e1('0x2')](0x0);var events={'afterCreate':_0x82e1('0x3'),'afterUpdate':_0x82e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ee746){return function(_0x32ae44,_0x39e258,_0x2997a2){DashboardEvents[_0x82e1('0x5')](_0x4ee746+':'+_0x32ae44['id'],_0x32ae44);DashboardEvents[_0x82e1('0x5')](_0x4ee746,_0x32ae44);_0x2997a2(null);};}for(var e in events){if(events[_0x82e1('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x82e1('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 278f579..6f15aeb 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 _0xfadc=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','api','request-promise','path','rimraf'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xfadc,0x8a));var _0xcfad=function(_0x38d940,_0x2f5291){_0x38d940=_0x38d940-0x0;var _0x4ea1b7=_0xfadc[_0x38d940];return _0x4ea1b7;};'use strict';var _=require(_0xcfad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcfad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcfad('0x2'));var fs=require('fs');var path=require(_0xcfad('0x3'));var rimraf=require(_0xcfad('0x4'));var config=require(_0xcfad('0x5'));var attributes=require(_0xcfad('0x6'));module[_0xcfad('0x7')]=function(_0x7a56f5,_0x38a2c1){return _0x7a56f5[_0xcfad('0x8')](_0xcfad('0x9'),attributes,{'tableName':_0xcfad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6361=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','lodash','util'];(function(_0x388b22,_0x5adea0){var _0x318b41=function(_0x3cc475){while(--_0x3cc475){_0x388b22['push'](_0x388b22['shift']());}};_0x318b41(++_0x5adea0);}(_0x6361,0x143));var _0x1636=function(_0x50bd02,_0x1cd414){_0x50bd02=_0x50bd02-0x0;var _0x37973e=_0x6361[_0x50bd02];return _0x37973e;};'use strict';var _=require(_0x1636('0x0'));var util=require(_0x1636('0x1'));var logger=require(_0x1636('0x2'))(_0x1636('0x3'));var moment=require(_0x1636('0x4'));var BPromise=require(_0x1636('0x5'));var rp=require(_0x1636('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1636('0x7'));var config=require(_0x1636('0x8'));var attributes=require(_0x1636('0x9'));module[_0x1636('0xa')]=function(_0x573e90,_0x3b0f7){return _0x573e90['define'](_0x1636('0xb'),attributes,{'tableName':_0x1636('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e15efcb..03e5bf4 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 _0x52d2=['Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','then','info'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x52d2,0x12b));var _0x252d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x52d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x252d('0x0'));var util=require('util');var moment=require(_0x252d('0x1'));var BPromise=require(_0x252d('0x2'));var rs=require(_0x252d('0x3'));var fs=require('fs');var Redis=require(_0x252d('0x4'));var db=require(_0x252d('0x5'))['db'];var utils=require(_0x252d('0x6'));var logger=require(_0x252d('0x7'))(_0x252d('0x8'));var config=require(_0x252d('0x9'));var jayson=require(_0x252d('0xa'));var client=jayson[_0x252d('0xb')][_0x252d('0xc')]({'port':0x232a});config[_0x252d('0xd')]=_[_0x252d('0xe')](config['redis'],{'host':_0x252d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x252d('0xd')]));require(_0x252d('0x10'))[_0x252d('0x11')](socket);function respondWithRpcPromise(_0x9360f4,_0x2240d5,_0x4d36a7){return new BPromise(function(_0x28d440,_0x400c95){return client['request'](_0x9360f4,_0x4d36a7)[_0x252d('0x12')](function(_0x136566){logger[_0x252d('0x13')](_0x252d('0x14'),_0x2240d5,_0x252d('0x15'));logger[_0x252d('0x16')](_0x252d('0x17'),_0x2240d5,_0x252d('0x15'),JSON['stringify'](_0x136566));if(_0x136566['error']){if(_0x136566[_0x252d('0x18')][_0x252d('0x19')]===0x1f4){logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x136566['error'][_0x252d('0x1a')]);return _0x400c95(_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);}logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);return _0x28d440(_0x136566[_0x252d('0x18')][_0x252d('0x1a')]);}else{logger[_0x252d('0x13')]('Dashboard,\x20%s,\x20%s',_0x2240d5,_0x252d('0x15'));_0x28d440(_0x136566[_0x252d('0x1b')]['message']);}})[_0x252d('0x1c')](function(_0x3c6bf5){logger[_0x252d('0x18')](_0x252d('0x14'),_0x2240d5,_0x3c6bf5);_0x400c95(_0x3c6bf5);});});} \ No newline at end of file +var _0x8d17=['client','http','redis','defaults','localhost','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment'];(function(_0x142b58,_0x4246a5){var _0x5622f8=function(_0x4e9948){while(--_0x4e9948){_0x142b58['push'](_0x142b58['shift']());}};_0x5622f8(++_0x4246a5);}(_0x8d17,0x10d));var _0x78d1=function(_0x2374c2,_0x22c0d8){_0x2374c2=_0x2374c2-0x0;var _0x49b687=_0x8d17[_0x2374c2];return _0x49b687;};'use strict';var _=require(_0x78d1('0x0'));var util=require('util');var moment=require(_0x78d1('0x1'));var BPromise=require(_0x78d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x78d1('0x3'));var logger=require('../../config/logger')(_0x78d1('0x4'));var config=require(_0x78d1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x78d1('0x6')][_0x78d1('0x7')]({'port':0x232a});config[_0x78d1('0x8')]=_[_0x78d1('0x9')](config[_0x78d1('0x8')],{'host':_0x78d1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x78d1('0xb'))[_0x78d1('0xc')](socket);function respondWithRpcPromise(_0x283da4,_0x3d3fae,_0x3bf805){return new BPromise(function(_0x45d35b,_0x490fd5){return client['request'](_0x283da4,_0x3bf805)[_0x78d1('0xd')](function(_0x4a7924){logger[_0x78d1('0xe')](_0x78d1('0xf'),_0x3d3fae,_0x78d1('0x10'));logger[_0x78d1('0x11')](_0x78d1('0x12'),_0x3d3fae,_0x78d1('0x10'),JSON[_0x78d1('0x13')](_0x4a7924));if(_0x4a7924[_0x78d1('0x14')]){if(_0x4a7924[_0x78d1('0x14')][_0x78d1('0x15')]===0x1f4){logger[_0x78d1('0x14')](_0x78d1('0xf'),_0x3d3fae,_0x4a7924[_0x78d1('0x14')]['message']);return _0x490fd5(_0x4a7924['error'][_0x78d1('0x16')]);}logger[_0x78d1('0x14')]('Dashboard,\x20%s,\x20%s',_0x3d3fae,_0x4a7924['error'][_0x78d1('0x16')]);return _0x45d35b(_0x4a7924[_0x78d1('0x14')][_0x78d1('0x16')]);}else{logger[_0x78d1('0xe')](_0x78d1('0xf'),_0x3d3fae,_0x78d1('0x10'));_0x45d35b(_0x4a7924[_0x78d1('0x17')][_0x78d1('0x16')]);}})[_0x78d1('0x18')](function(_0x184a71){logger[_0x78d1('0x14')](_0x78d1('0xf'),_0x3d3fae,_0x184a71);_0x490fd5(_0x184a71);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2dbf230..fc6048e 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 _0xbc9b=['update','register','length','dashboard:','remove'];(function(_0x418250,_0x2dbdb1){var _0x59b8d5=function(_0x19a4f5){while(--_0x19a4f5){_0x418250['push'](_0x418250['shift']());}};_0x59b8d5(++_0x2dbdb1);}(_0xbc9b,0x162));var _0xbbc9=function(_0x2f59d0,_0x18a4af){_0x2f59d0=_0x2f59d0-0x0;var _0x56b707=_0xbc9b[_0x2f59d0];return _0x56b707;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xbbc9('0x0'),_0xbbc9('0x1')];function createListener(_0x2dd43a,_0x120d37){return function(_0xa970c7){_0x120d37['emit'](_0x2dd43a,_0xa970c7);};}function removeListener(_0x235ca5,_0x3cb7a1){return function(){DashboardEvents['removeListener'](_0x235ca5,_0x3cb7a1);};}exports[_0xbbc9('0x2')]=function(_0x5c5d0e){for(var _0x56bad4=0x0,_0xbd1c6b=events[_0xbbc9('0x3')];_0x56bad4<_0xbd1c6b;_0x56bad4++){var _0x40b360=events[_0x56bad4];var _0x254c61=createListener(_0xbbc9('0x4')+_0x40b360,_0x5c5d0e);DashboardEvents['on'](_0x40b360,_0x254c61);}}; \ No newline at end of file +var _0xcc57=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','emit'];(function(_0x39ce39,_0x1bf84d){var _0x3a9824=function(_0xbb39b6){while(--_0xbb39b6){_0x39ce39['push'](_0x39ce39['shift']());}};_0x3a9824(++_0x1bf84d);}(_0xcc57,0x1ec));var _0x7cc5=function(_0x45475b,_0x2929bc){_0x45475b=_0x45475b-0x0;var _0x5d791d=_0xcc57[_0x45475b];return _0x5d791d;};'use strict';var DashboardEvents=require(_0x7cc5('0x0'));var events=[_0x7cc5('0x1'),_0x7cc5('0x2'),'update'];function createListener(_0x41f732,_0x5c80ac){return function(_0x211898){_0x5c80ac[_0x7cc5('0x3')](_0x41f732,_0x211898);};}function removeListener(_0x30618c,_0xb61b7f){return function(){DashboardEvents[_0x7cc5('0x4')](_0x30618c,_0xb61b7f);};}exports[_0x7cc5('0x5')]=function(_0x19e03e){for(var _0x64fab=0x0,_0x2aa689=events[_0x7cc5('0x6')];_0x64fab<_0x2aa689;_0x64fab++){var _0x5cc138=events[_0x64fab];var _0x4c1d4a=createListener(_0x7cc5('0x7')+_0x5cc138,_0x19e03e);DashboardEvents['on'](_0x5cc138,_0x4c1d4a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5263c66..4225009 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0xe706,0xa3));var _0x6e70=function(_0x252550,_0x1ffe4d){_0x252550=_0x252550-0x0;var _0x352629=_0xe706[_0x252550];return _0x352629;};'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('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcb91=['isAuthenticated','/:id','show','create','post','/:id/clone','/:id/items','addItem','put','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5837a4,_0x15c0f7){var _0x1feb62=function(_0x17d586){while(--_0x17d586){_0x5837a4['push'](_0x5837a4['shift']());}};_0x1feb62(++_0x15c0f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xcb91[_0x4599b6];return _0x2e014c;};'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('./dashboard.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id/items',auth[_0x1cb9('0x7')](),controller['getItems']);router['post']('/',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xa')]);router[_0x1cb9('0xb')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller['clone']);router[_0x1cb9('0xb')](_0x1cb9('0xd'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x10')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 9e9883c..18e67b9 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 _0x4d75=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','squel','lodash','exports','STRING','TEXT'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4d75,0x10f));var _0x54d7=function(_0x95203,_0x16b559){_0x95203=_0x95203-0x0;var _0x151e9d=_0x4d75[_0x95203];return _0x151e9d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x54d7('0x0'));var _=require(_0x54d7('0x1'));module[_0x54d7('0x2')]={'title':{'type':Sequelize[_0x54d7('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x54d7('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x54d7('0x4')](_0x54d7('0x5')),'get':function(){try{return JSON[_0x54d7('0x6')](this[_0x54d7('0x7')](_0x54d7('0x8')));}catch(_0x42a57a){return[];}},'set':function(_0x552787){try{this[_0x54d7('0x9')](_0x54d7('0x8'),JSON[_0x54d7('0xa')](_0x552787));}catch(_0x14c33d){this[_0x54d7('0x9')](_0x54d7('0x8'),JSON[_0x54d7('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x54d7('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x54d7('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x54d7('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x54d7('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x54d7('0x3')]}}; \ No newline at end of file +var _0x3285=['exports','TEXT','getDataValue','setDataValue','attrs','stringify','INTEGER','STRING','#2196f3','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3285,0x18f));var _0x5328=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x3285[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0x5328('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5328('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5328('0x2')]('long'),'get':function(){try{return JSON['parse'](this[_0x5328('0x3')]('attrs'));}catch(_0x45b59f){return[];}},'set':function(_0x33197c){try{this[_0x5328('0x4')](_0x5328('0x5'),JSON[_0x5328('0x6')](_0x33197c));}catch(_0x39b4fa){this['setDataValue']('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5328('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5328('0x7')]},'col':{'type':Sequelize[_0x5328('0x7')]},'background':{'type':Sequelize[_0x5328('0x8')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5328('0x9'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 105cd6b..9ae502c 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 _0x7117=['attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x7117,0x153));var _0x7711=function(_0x3c7130,_0x4abee0){_0x3c7130=_0x3c7130-0x0;var _0x477bf1=_0x7117[_0x3c7130];return _0x477bf1;};'use strict';var pdf=require(_0x7711('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7711('0x1'));var zipdir=require(_0x7711('0x2'));var jsonpatch=require(_0x7711('0x3'));var rp=require('request-promise');var moment=require(_0x7711('0x4'));var BPromise=require(_0x7711('0x5'));var Mustache=require(_0x7711('0x6'));var util=require(_0x7711('0x7'));var path=require(_0x7711('0x8'));var sox=require(_0x7711('0x9'));var csv=require(_0x7711('0xa'));var ejs=require(_0x7711('0xb'));var fs=require('fs');var _=require(_0x7711('0xc'));var squel=require(_0x7711('0xd'));var crypto=require('crypto');var jsforce=require(_0x7711('0xe'));var deskjs=require(_0x7711('0xf'));var toCsv=require(_0x7711('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7711('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7711('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7711('0x12'));var logger=require(_0x7711('0x13'))(_0x7711('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7711('0x15'))['db'];config[_0x7711('0x16')]=_['defaults'](config[_0x7711('0x16')],{'host':_0x7711('0x17'),'port':0x18eb});var socket=require(_0x7711('0x18'))(new Redis(config[_0x7711('0x16')]));require('./dashboardItem.socket')[_0x7711('0x19')](socket);function respondWithStatusCode(_0x307917,_0x5b01de){_0x5b01de=_0x5b01de||0xcc;return function(_0xbade62){if(_0xbade62){return _0x307917['sendStatus'](_0x5b01de);}return _0x307917[_0x7711('0x1a')](_0x5b01de)[_0x7711('0x1b')]();};}function respondWithResult(_0x178058,_0x80ba3){_0x80ba3=_0x80ba3||0xc8;return function(_0x222f0c){if(_0x222f0c){return _0x178058[_0x7711('0x1a')](_0x80ba3)[_0x7711('0x1c')](_0x222f0c);}};}function respondWithFilteredResult(_0x3c1df7,_0x216478){return function(_0xd9f9e4){if(_0xd9f9e4){var _0x122ff7=_0xd9f9e4['count'],_0x52c310=_0x216478[_0x7711('0x1d')],_0xf78ad=_0x216478[_0x7711('0x1d')]+_0x216478['limit'],_0x559b85;if(_0xf78ad>=_0x122ff7){_0xf78ad=_0x122ff7;_0x559b85=0xc8;}else{_0x559b85=0xce;}_0x3c1df7[_0x7711('0x1a')](_0x559b85);return _0x3c1df7[_0x7711('0x1e')]('Content-Range',_0x52c310+'-'+_0xf78ad+'/'+_0x122ff7)[_0x7711('0x1c')](_0xd9f9e4);}return null;};}function patchUpdates(_0x762ce1){return function(_0x246475){try{jsonpatch[_0x7711('0x1f')](_0x246475,_0x762ce1,!![]);}catch(_0x1e80e3){return BPromise[_0x7711('0x20')](_0x1e80e3);}return _0x246475[_0x7711('0x21')]();};}function saveUpdates(_0x423046,_0x2f0254){return function(_0x5db123){if(_0x5db123){return _0x5db123[_0x7711('0x22')](_0x423046)[_0x7711('0x23')](function(_0x47474b){return _0x47474b;});}return null;};}function removeEntity(_0x470ebc,_0x4a235d){return function(_0x823c7a){if(_0x823c7a){return _0x823c7a[_0x7711('0x24')]()[_0x7711('0x23')](function(){_0x470ebc[_0x7711('0x1a')](0xcc)[_0x7711('0x1b')]();});}};}function handleEntityNotFound(_0x2ffb3c,_0x550694){return function(_0xf6a43d){if(!_0xf6a43d){_0x2ffb3c['sendStatus'](0x194);}return _0xf6a43d;};}function handleError(_0x277063,_0x620e20){_0x620e20=_0x620e20||0x1f4;return function(_0x14bc32){logger[_0x7711('0x25')](_0x14bc32[_0x7711('0x26')]);if(_0x14bc32[_0x7711('0x27')]){delete _0x14bc32[_0x7711('0x27')];}_0x277063[_0x7711('0x1a')](_0x620e20)[_0x7711('0x28')](_0x14bc32);};}exports[_0x7711('0x29')]=function(_0x5cd77e,_0x397fc6){var _0x23de94={'raw':![],'where':{'id':_0x5cd77e['params']['id']}},_0x383f92={};_0x383f92[_0x7711('0x2a')]=_[_0x7711('0x2b')](db[_0x7711('0x2c')][_0x7711('0x2d')]);_0x383f92[_0x7711('0x2e')]=_['keys'](_0x5cd77e[_0x7711('0x2e')]);_0x383f92[_0x7711('0x2f')]=_[_0x7711('0x30')](_0x383f92[_0x7711('0x2a')],_0x383f92[_0x7711('0x2e')]);_0x23de94[_0x7711('0x31')]=_[_0x7711('0x30')](_0x383f92[_0x7711('0x2a')],qs['fields'](_0x5cd77e[_0x7711('0x2e')][_0x7711('0x32')]));_0x23de94[_0x7711('0x31')]=_0x23de94['attributes']['length']?_0x23de94['attributes']:_0x383f92[_0x7711('0x2a')];if(_0x5cd77e['query']['includeAll']){_0x23de94['include']=[{'all':!![]}];}_0x23de94=_['merge']({},_0x23de94,_0x5cd77e[_0x7711('0x33')]);return db['DashboardItem'][_0x7711('0x34')](_0x23de94)[_0x7711('0x23')](handleEntityNotFound(_0x397fc6,null))[_0x7711('0x23')](respondWithResult(_0x397fc6,null))[_0x7711('0x35')](handleError(_0x397fc6,null));};exports[_0x7711('0x24')]=function(_0x50aa0f,_0x3ee48e){return db[_0x7711('0x2c')][_0x7711('0x34')]({'where':{'id':_0x50aa0f['params']['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x3ee48e,null))['then'](removeEntity(_0x3ee48e,null))[_0x7711('0x35')](handleError(_0x3ee48e,null));};function widgetAttributes(_0x3b2c40){try{switch(_0x3b2c40[_0x7711('0x36')]){case _0x7711('0x37'):return[{'name':_0x7711('0x38'),'value':_0x3b2c40['attrUrl']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||_0x7711('0x3b')}];case _0x7711('0x3c'):return[{'name':_0x7711('0x3d'),'value':_0x3b2c40['attrPath']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||''}];case _0x7711('0x3e'):return[{'name':'attrHourFormat','value':_0x3b2c40[_0x7711('0x3f')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||_0x7711('0x40')},{'name':'attrTimezone','value':_0x3b2c40['attrTimezone']||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40['attrs'][0x1][_0x7711('0x3a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3b2c40[_0x7711('0x41')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x2]?_0x3b2c40[_0x7711('0x39')][0x2][_0x7711('0x3a')]:undefined)||0xc}];case _0x7711('0x42'):return[{'name':_0x7711('0x43'),'value':_0x3b2c40[_0x7711('0x43')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||'total'},{'name':_0x7711('0x44'),'value':_0x3b2c40[_0x7711('0x44')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40[_0x7711('0x39')][0x1][_0x7711('0x3a')]:undefined)||[]},{'name':_0x7711('0x41'),'value':_0x3b2c40[_0x7711('0x41')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40['attrs'][0x2]?_0x3b2c40[_0x7711('0x39')][0x2]['value']:undefined)||0x14}];case _0x7711('0x45'):case _0x7711('0x46'):return[{'name':_0x7711('0x47'),'value':_0x3b2c40[_0x7711('0x47')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||'total'},{'name':_0x7711('0x48'),'value':_0x3b2c40['attrSerie2']||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40['attrs'][0x1]['value']:undefined)||null},{'name':_0x7711('0x49'),'value':_0x3b2c40['attrSerie3']||(_0x3b2c40['attrs']&&_0x3b2c40['attrs'][0x2]?_0x3b2c40['attrs'][0x2]['value']:undefined)||null},{'name':_0x7711('0x44'),'value':_0x3b2c40[_0x7711('0x44')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x3]?_0x3b2c40[_0x7711('0x39')][0x3][_0x7711('0x3a')]:undefined)||[]}];case _0x7711('0x4a'):return[{'name':'attrReport','type':_0x3b2c40[_0x7711('0x4b')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40['attrs'][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x36')]:undefined)||null,'value':_0x3b2c40[_0x7711('0x4c')]||(_0x3b2c40['attrs']&&_0x3b2c40[_0x7711('0x39')][0x0]?_0x3b2c40[_0x7711('0x39')][0x0][_0x7711('0x3a')]:undefined)||null},{'name':_0x7711('0x4d'),'value':_0x3b2c40[_0x7711('0x4d')]||(_0x3b2c40[_0x7711('0x39')]&&_0x3b2c40[_0x7711('0x39')][0x1]?_0x3b2c40[_0x7711('0x39')][0x1][_0x7711('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x1dd90d){logger[_0x7711('0x25')](_0x7711('0x4e'),JSON[_0x7711('0x4f')](_0x1dd90d));return[];}}exports[_0x7711('0x50')]=function(_0x268fcb,_0x2c53d7){if(_0x268fcb[_0x7711('0x51')]){_0x268fcb[_0x7711('0x51')]['attrs']=widgetAttributes(_0x268fcb[_0x7711('0x51')]);}return db[_0x7711('0x2c')][_0x7711('0x50')](_0x268fcb[_0x7711('0x51')],{})[_0x7711('0x23')](respondWithResult(_0x2c53d7,0xc9))['catch'](handleError(_0x2c53d7,null));};exports[_0x7711('0x22')]=function(_0x5d2b1e,_0x2aeffd){if(_0x5d2b1e[_0x7711('0x51')]['id']){delete _0x5d2b1e[_0x7711('0x51')]['id'];}_0x5d2b1e[_0x7711('0x51')][_0x7711('0x39')]=widgetAttributes(_0x5d2b1e[_0x7711('0x51')]);return db[_0x7711('0x2c')][_0x7711('0x34')]({'where':{'id':_0x5d2b1e[_0x7711('0x52')]['id']}})[_0x7711('0x23')](handleEntityNotFound(_0x2aeffd,null))['then'](saveUpdates(_0x5d2b1e[_0x7711('0x51')],null))['then'](respondWithResult(_0x2aeffd,null))['catch'](handleError(_0x2aeffd,null));}; \ No newline at end of file +var _0xaef8=['fields','attributes','includeAll','include','merge','DashboardItem','then','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','error','stack','name','send','show','params','model','rawAttributes','query','keys','intersection'];(function(_0x5d1566,_0x3fed4b){var _0x3441a2=function(_0x57c3fe){while(--_0x57c3fe){_0x5d1566['push'](_0x5d1566['shift']());}};_0x3441a2(++_0x3fed4b);}(_0xaef8,0x1e3));var _0x8aef=function(_0x4e3843,_0x571529){_0x4e3843=_0x4e3843-0x0;var _0x2537db=_0xaef8[_0x4e3843];return _0x2537db;};'use strict';var pdf=require(_0x8aef('0x0'));var emlformat=require(_0x8aef('0x1'));var rimraf=require(_0x8aef('0x2'));var zipdir=require(_0x8aef('0x3'));var jsonpatch=require(_0x8aef('0x4'));var rp=require(_0x8aef('0x5'));var moment=require(_0x8aef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8aef('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8aef('0x8'));var csv=require(_0x8aef('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8aef('0xa'));var squel=require(_0x8aef('0xb'));var crypto=require(_0x8aef('0xc'));var jsforce=require(_0x8aef('0xd'));var deskjs=require(_0x8aef('0xe'));var toCsv=require(_0x8aef('0x9'));var querystring=require(_0x8aef('0xf'));var Papa=require(_0x8aef('0x10'));var Redis=require(_0x8aef('0x11'));var authService=require(_0x8aef('0x12'));var qs=require(_0x8aef('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8aef('0x14'));var logger=require(_0x8aef('0x15'))(_0x8aef('0x16'));var utils=require('../../config/utils');var config=require(_0x8aef('0x17'));var db=require(_0x8aef('0x18'))['db'];config[_0x8aef('0x19')]=_[_0x8aef('0x1a')](config[_0x8aef('0x19')],{'host':_0x8aef('0x1b'),'port':0x18eb});var socket=require(_0x8aef('0x1c'))(new Redis(config[_0x8aef('0x19')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x3e31a6,_0x10d44b){_0x10d44b=_0x10d44b||0xcc;return function(_0x1125a1){if(_0x1125a1){return _0x3e31a6['sendStatus'](_0x10d44b);}return _0x3e31a6[_0x8aef('0x1d')](_0x10d44b)['end']();};}function respondWithResult(_0x53cf32,_0x8da372){_0x8da372=_0x8da372||0xc8;return function(_0x44fe9c){if(_0x44fe9c){return _0x53cf32[_0x8aef('0x1d')](_0x8da372)[_0x8aef('0x1e')](_0x44fe9c);}};}function respondWithFilteredResult(_0x5a3299,_0x422838){return function(_0x1ab0be){if(_0x1ab0be){var _0x505fca=_0x1ab0be[_0x8aef('0x1f')],_0x114c3d=_0x422838['offset'],_0x2ac2ed=_0x422838[_0x8aef('0x20')]+_0x422838[_0x8aef('0x21')],_0xbf46d4;if(_0x2ac2ed>=_0x505fca){_0x2ac2ed=_0x505fca;_0xbf46d4=0xc8;}else{_0xbf46d4=0xce;}_0x5a3299[_0x8aef('0x1d')](_0xbf46d4);return _0x5a3299[_0x8aef('0x22')](_0x8aef('0x23'),_0x114c3d+'-'+_0x2ac2ed+'/'+_0x505fca)[_0x8aef('0x1e')](_0x1ab0be);}return null;};}function patchUpdates(_0x594535){return function(_0x37b7da){try{jsonpatch[_0x8aef('0x24')](_0x37b7da,_0x594535,!![]);}catch(_0x92bce9){return BPromise['reject'](_0x92bce9);}return _0x37b7da['save']();};}function saveUpdates(_0xe4c3f1,_0x548d5e){return function(_0x2e4be9){if(_0x2e4be9){return _0x2e4be9[_0x8aef('0x25')](_0xe4c3f1)['then'](function(_0x5b5ed1){return _0x5b5ed1;});}return null;};}function removeEntity(_0x100739,_0xb41f12){return function(_0x24fc6d){if(_0x24fc6d){return _0x24fc6d[_0x8aef('0x26')]()['then'](function(){_0x100739[_0x8aef('0x1d')](0xcc)[_0x8aef('0x27')]();});}};}function handleEntityNotFound(_0x4322be,_0x116c94){return function(_0x4a2cf5){if(!_0x4a2cf5){_0x4322be['sendStatus'](0x194);}return _0x4a2cf5;};}function handleError(_0xbb0ad2,_0x30e71a){_0x30e71a=_0x30e71a||0x1f4;return function(_0x3f4968){logger[_0x8aef('0x28')](_0x3f4968[_0x8aef('0x29')]);if(_0x3f4968[_0x8aef('0x2a')]){delete _0x3f4968[_0x8aef('0x2a')];}_0xbb0ad2['status'](_0x30e71a)[_0x8aef('0x2b')](_0x3f4968);};}exports[_0x8aef('0x2c')]=function(_0x2366c7,_0x1615d0){var _0x4efc6f={'raw':![],'where':{'id':_0x2366c7[_0x8aef('0x2d')]['id']}},_0x4441ab={};_0x4441ab[_0x8aef('0x2e')]=_['keys'](db['DashboardItem'][_0x8aef('0x2f')]);_0x4441ab[_0x8aef('0x30')]=_[_0x8aef('0x31')](_0x2366c7['query']);_0x4441ab['filters']=_['intersection'](_0x4441ab[_0x8aef('0x2e')],_0x4441ab[_0x8aef('0x30')]);_0x4efc6f['attributes']=_[_0x8aef('0x32')](_0x4441ab[_0x8aef('0x2e')],qs[_0x8aef('0x33')](_0x2366c7['query'][_0x8aef('0x33')]));_0x4efc6f['attributes']=_0x4efc6f['attributes']['length']?_0x4efc6f[_0x8aef('0x34')]:_0x4441ab[_0x8aef('0x2e')];if(_0x2366c7['query'][_0x8aef('0x35')]){_0x4efc6f[_0x8aef('0x36')]=[{'all':!![]}];}_0x4efc6f=_[_0x8aef('0x37')]({},_0x4efc6f,_0x2366c7['options']);return db[_0x8aef('0x38')]['find'](_0x4efc6f)['then'](handleEntityNotFound(_0x1615d0,null))[_0x8aef('0x39')](respondWithResult(_0x1615d0,null))[_0x8aef('0x3a')](handleError(_0x1615d0,null));};exports[_0x8aef('0x26')]=function(_0x5431d1,_0x1aa21f){return db[_0x8aef('0x38')][_0x8aef('0x3b')]({'where':{'id':_0x5431d1[_0x8aef('0x2d')]['id']}})[_0x8aef('0x39')](handleEntityNotFound(_0x1aa21f,null))[_0x8aef('0x39')](removeEntity(_0x1aa21f,null))[_0x8aef('0x3a')](handleError(_0x1aa21f,null));};function widgetAttributes(_0x57eb6b){try{switch(_0x57eb6b[_0x8aef('0x3c')]){case _0x8aef('0x3d'):return[{'name':_0x8aef('0x3e'),'value':_0x57eb6b[_0x8aef('0x3e')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x0]?_0x57eb6b['attrs'][0x0][_0x8aef('0x40')]:undefined)||_0x8aef('0x41')}];case _0x8aef('0x42'):return[{'name':_0x8aef('0x43'),'value':_0x57eb6b[_0x8aef('0x43')]||(_0x57eb6b['attrs']&&_0x57eb6b[_0x8aef('0x3f')][0x0]?_0x57eb6b['attrs'][0x0]['value']:undefined)||''}];case _0x8aef('0x44'):return[{'name':_0x8aef('0x45'),'value':_0x57eb6b[_0x8aef('0x45')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b['attrs'][0x0]?_0x57eb6b[_0x8aef('0x3f')][0x0][_0x8aef('0x40')]:undefined)||_0x8aef('0x46')},{'name':_0x8aef('0x47'),'value':_0x57eb6b[_0x8aef('0x47')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x1]?_0x57eb6b['attrs'][0x1][_0x8aef('0x40')]:undefined)||_0x8aef('0x48')},{'name':_0x8aef('0x49'),'value':_0x57eb6b[_0x8aef('0x49')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b['attrs'][0x2]?_0x57eb6b[_0x8aef('0x3f')][0x2]['value']:undefined)||0xc}];case _0x8aef('0x4a'):return[{'name':_0x8aef('0x4b'),'value':_0x57eb6b[_0x8aef('0x4b')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x0]?_0x57eb6b[_0x8aef('0x3f')][0x0]['value']:undefined)||_0x8aef('0x4c')},{'name':_0x8aef('0x4d'),'value':_0x57eb6b[_0x8aef('0x4d')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x1]?_0x57eb6b[_0x8aef('0x3f')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x57eb6b['attrFontSize']||(_0x57eb6b['attrs']&&_0x57eb6b[_0x8aef('0x3f')][0x2]?_0x57eb6b['attrs'][0x2][_0x8aef('0x40')]:undefined)||0x14}];case'multibar-chart':case _0x8aef('0x4e'):return[{'name':_0x8aef('0x4f'),'value':_0x57eb6b[_0x8aef('0x4f')]||(_0x57eb6b['attrs']&&_0x57eb6b[_0x8aef('0x3f')][0x0]?_0x57eb6b[_0x8aef('0x3f')][0x0]['value']:undefined)||_0x8aef('0x4c')},{'name':_0x8aef('0x50'),'value':_0x57eb6b[_0x8aef('0x50')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x1]?_0x57eb6b[_0x8aef('0x3f')][0x1][_0x8aef('0x40')]:undefined)||null},{'name':_0x8aef('0x51'),'value':_0x57eb6b[_0x8aef('0x51')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b['attrs'][0x2]?_0x57eb6b[_0x8aef('0x3f')][0x2][_0x8aef('0x40')]:undefined)||null},{'name':_0x8aef('0x4d'),'value':_0x57eb6b[_0x8aef('0x4d')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x3]?_0x57eb6b[_0x8aef('0x3f')][0x3]['value']:undefined)||[]}];case _0x8aef('0x52'):return[{'name':_0x8aef('0x53'),'type':_0x57eb6b[_0x8aef('0x54')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b['attrs'][0x0]?_0x57eb6b[_0x8aef('0x3f')][0x0]['type']:undefined)||null,'value':_0x57eb6b['attrReport']||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x0]?_0x57eb6b[_0x8aef('0x3f')][0x0][_0x8aef('0x40')]:undefined)||null},{'name':_0x8aef('0x55'),'value':_0x57eb6b[_0x8aef('0x55')]||(_0x57eb6b[_0x8aef('0x3f')]&&_0x57eb6b[_0x8aef('0x3f')][0x1]?_0x57eb6b[_0x8aef('0x3f')][0x1][_0x8aef('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x5d8847){logger[_0x8aef('0x28')](_0x8aef('0x56'),JSON[_0x8aef('0x57')](_0x5d8847));return[];}}exports['create']=function(_0x3fec04,_0xafb08d){if(_0x3fec04['body']){_0x3fec04[_0x8aef('0x58')]['attrs']=widgetAttributes(_0x3fec04[_0x8aef('0x58')]);}return db[_0x8aef('0x38')]['create'](_0x3fec04[_0x8aef('0x58')],{})[_0x8aef('0x39')](respondWithResult(_0xafb08d,0xc9))[_0x8aef('0x3a')](handleError(_0xafb08d,null));};exports[_0x8aef('0x25')]=function(_0x51f560,_0x3bde4f){if(_0x51f560[_0x8aef('0x58')]['id']){delete _0x51f560[_0x8aef('0x58')]['id'];}_0x51f560['body']['attrs']=widgetAttributes(_0x51f560[_0x8aef('0x58')]);return db[_0x8aef('0x38')]['find']({'where':{'id':_0x51f560['params']['id']}})[_0x8aef('0x39')](handleEntityNotFound(_0x3bde4f,null))[_0x8aef('0x39')](saveUpdates(_0x51f560['body'],null))[_0x8aef('0x39')](respondWithResult(_0x3bde4f,null))['catch'](handleError(_0x3bde4f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 1fb493d..412887d 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 _0x7914=['save','update','remove','emit','hook','exports','../../mysqldb','DashboardItem'];(function(_0x38ed5a,_0x435a0b){var _0x520e83=function(_0x3eea7f){while(--_0x3eea7f){_0x38ed5a['push'](_0x38ed5a['shift']());}};_0x520e83(++_0x435a0b);}(_0x7914,0x136));var _0x4791=function(_0x4e13ef,_0x4976c8){_0x4e13ef=_0x4e13ef-0x0;var _0x113664=_0x7914[_0x4e13ef];return _0x113664;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x4791('0x0'))['db'][_0x4791('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4791('0x2'),'afterUpdate':_0x4791('0x3'),'afterDestroy':_0x4791('0x4')};function emitEvent(_0x1e331b){return function(_0x2bd076,_0xc9014f,_0x4eec55){DashboardItemEvents[_0x4791('0x5')](_0x1e331b+':'+_0x2bd076['id'],_0x2bd076);DashboardItemEvents[_0x4791('0x5')](_0x1e331b,_0x2bd076);_0x4eec55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x4791('0x6')](e,emitEvent(event));}}module[_0x4791('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x10a9=['../../mysqldb','DashboardItem','setMaxListeners','save','update','emit','hook','events'];(function(_0x194b2f,_0x4d2bd7){var _0xffd7db=function(_0x387483){while(--_0x387483){_0x194b2f['push'](_0x194b2f['shift']());}};_0xffd7db(++_0x4d2bd7);}(_0x10a9,0x6f));var _0x910a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x10a9[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x910a('0x0'));var DashboardItem=require(_0x910a('0x1'))['db'][_0x910a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x910a('0x3')](0x0);var events={'afterCreate':_0x910a('0x4'),'afterUpdate':_0x910a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x8e3d61){return function(_0x293fe9,_0xda8d06,_0x158a3b){DashboardItemEvents['emit'](_0x8e3d61+':'+_0x293fe9['id'],_0x293fe9);DashboardItemEvents[_0x910a('0x6')](_0x8e3d61,_0x293fe9);_0x158a3b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x910a('0x7')](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 d83b795..c12b95c 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 _0xac7c=['DashboardItem','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define'];(function(_0x1cc1f5,_0x3ae510){var _0x5b70c7=function(_0x48d775){while(--_0x48d775){_0x1cc1f5['push'](_0x1cc1f5['shift']());}};_0x5b70c7(++_0x3ae510);}(_0xac7c,0x177));var _0xcac7=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0xac7c[_0xb7cb72];return _0x4b7570;};'use strict';var _=require(_0xcac7('0x0'));var util=require('util');var logger=require(_0xcac7('0x1'))(_0xcac7('0x2'));var moment=require('moment');var BPromise=require(_0xcac7('0x3'));var rp=require(_0xcac7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcac7('0x5'));var config=require(_0xcac7('0x6'));var attributes=require(_0xcac7('0x7'));module[_0xcac7('0x8')]=function(_0x468afa,_0x5c7f90){return _0x468afa[_0xcac7('0x9')](_0xcac7('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c03=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x262264,_0x5a18f8){var _0x446d3b=function(_0x2e9977){while(--_0x2e9977){_0x262264['push'](_0x262264['shift']());}};_0x446d3b(++_0x5a18f8);}(_0x0c03,0x8b));var _0x30c0=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0x0c03[_0x363b81];return _0x1d92fb;};'use strict';var _=require(_0x30c0('0x0'));var util=require(_0x30c0('0x1'));var logger=require(_0x30c0('0x2'))(_0x30c0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30c0('0x5'));var config=require(_0x30c0('0x6'));var attributes=require(_0x30c0('0x7'));module[_0x30c0('0x8')]=function(_0x1bd729,_0x4aa16a){return _0x1bd729['define'](_0x30c0('0x9'),attributes,{'tableName':_0x30c0('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 cff18b7..90ddaff 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 _0x31b5=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31b5,0x1ab));var _0x531b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x31b5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x531b('0x0'));var util=require(_0x531b('0x1'));var moment=require(_0x531b('0x2'));var BPromise=require(_0x531b('0x3'));var rs=require(_0x531b('0x4'));var fs=require('fs');var Redis=require(_0x531b('0x5'));var db=require(_0x531b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x531b('0x7'));var config=require(_0x531b('0x8'));var jayson=require(_0x531b('0x9'));var client=jayson[_0x531b('0xa')][_0x531b('0xb')]({'port':0x232a});config['redis']=_[_0x531b('0xc')](config[_0x531b('0xd')],{'host':_0x531b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x531b('0xd')]));require(_0x531b('0xf'))[_0x531b('0x10')](socket);function respondWithRpcPromise(_0x341a57,_0x1b5053,_0x1ac38a){return new BPromise(function(_0x1ca1fb,_0x2e2bd5){return client[_0x531b('0x11')](_0x341a57,_0x1ac38a)[_0x531b('0x12')](function(_0x25d698){logger[_0x531b('0x13')](_0x531b('0x14'),_0x1b5053,_0x531b('0x15'));logger[_0x531b('0x16')](_0x531b('0x17'),_0x1b5053,_0x531b('0x15'),JSON[_0x531b('0x18')](_0x25d698));if(_0x25d698[_0x531b('0x19')]){if(_0x25d698[_0x531b('0x19')]['code']===0x1f4){logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0x25d698[_0x531b('0x19')][_0x531b('0x1a')]);return _0x2e2bd5(_0x25d698[_0x531b('0x19')]['message']);}logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0x25d698[_0x531b('0x19')]['message']);return _0x1ca1fb(_0x25d698[_0x531b('0x19')][_0x531b('0x1a')]);}else{logger[_0x531b('0x13')]('DashboardItem,\x20%s,\x20%s',_0x1b5053,_0x531b('0x15'));_0x1ca1fb(_0x25d698[_0x531b('0x1b')][_0x531b('0x1a')]);}})[_0x531b('0x1c')](function(_0xd31cea){logger[_0x531b('0x19')](_0x531b('0x14'),_0x1b5053,_0xd31cea);_0x2e2bd5(_0xd31cea);});});} \ No newline at end of file +var _0x167e=['http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x167e,0x1c5));var _0xe167=function(_0x3ede1,_0x4d0a41){_0x3ede1=_0x3ede1-0x0;var _0x2b786e=_0x167e[_0x3ede1];return _0x2b786e;};'use strict';var _=require(_0xe167('0x0'));var util=require(_0xe167('0x1'));var moment=require(_0xe167('0x2'));var BPromise=require(_0xe167('0x3'));var rs=require(_0xe167('0x4'));var fs=require('fs');var Redis=require(_0xe167('0x5'));var db=require(_0xe167('0x6'))['db'];var utils=require(_0xe167('0x7'));var logger=require(_0xe167('0x8'))(_0xe167('0x9'));var config=require('../../config/environment');var jayson=require(_0xe167('0xa'));var client=jayson['client'][_0xe167('0xb')]({'port':0x232a});config[_0xe167('0xc')]=_[_0xe167('0xd')](config[_0xe167('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe167('0xe'))(new Redis(config[_0xe167('0xc')]));require(_0xe167('0xf'))[_0xe167('0x10')](socket);function respondWithRpcPromise(_0x28a03a,_0x233fa5,_0x14c763){return new BPromise(function(_0x2ef786,_0x1d4f06){return client[_0xe167('0x11')](_0x28a03a,_0x14c763)[_0xe167('0x12')](function(_0x406d4c){logger['info'](_0xe167('0x13'),_0x233fa5,'request\x20sent');logger[_0xe167('0x14')](_0xe167('0x15'),_0x233fa5,_0xe167('0x16'),JSON['stringify'](_0x406d4c));if(_0x406d4c[_0xe167('0x17')]){if(_0x406d4c[_0xe167('0x17')][_0xe167('0x18')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x233fa5,_0x406d4c[_0xe167('0x17')][_0xe167('0x19')]);return _0x1d4f06(_0x406d4c[_0xe167('0x17')]['message']);}logger[_0xe167('0x17')](_0xe167('0x13'),_0x233fa5,_0x406d4c[_0xe167('0x17')][_0xe167('0x19')]);return _0x2ef786(_0x406d4c['error'][_0xe167('0x19')]);}else{logger[_0xe167('0x1a')](_0xe167('0x13'),_0x233fa5,_0xe167('0x16'));_0x2ef786(_0x406d4c[_0xe167('0x1b')][_0xe167('0x19')]);}})[_0xe167('0x1c')](function(_0x2d5fdb){logger[_0xe167('0x17')](_0xe167('0x13'),_0x233fa5,_0x2d5fdb);_0x1d4f06(_0x2d5fdb);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7031385..9e3dedc 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 _0x26f1=['removeListener','length','dashboardItem:','./dashboardItem.events','save','update','emit'];(function(_0x5349ce,_0x1e6ec2){var _0x156fd5=function(_0x58baf7){while(--_0x58baf7){_0x5349ce['push'](_0x5349ce['shift']());}};_0x156fd5(++_0x1e6ec2);}(_0x26f1,0x8f));var _0x126f=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x26f1[_0x2b5eae];return _0x5f3ac9;};'use strict';var DashboardItemEvents=require(_0x126f('0x0'));var events=[_0x126f('0x1'),'remove',_0x126f('0x2')];function createListener(_0x74668c,_0x413fc6){return function(_0x4d52b3){_0x413fc6[_0x126f('0x3')](_0x74668c,_0x4d52b3);};}function removeListener(_0x635df6,_0x1af352){return function(){DashboardItemEvents[_0x126f('0x4')](_0x635df6,_0x1af352);};}exports['register']=function(_0x52ccfa){for(var _0x1e19a8=0x0,_0x397a60=events[_0x126f('0x5')];_0x1e19a8<_0x397a60;_0x1e19a8++){var _0x75838=events[_0x1e19a8];var _0x3d98a5=createListener(_0x126f('0x6')+_0x75838,_0x52ccfa);DashboardItemEvents['on'](_0x75838,_0x3d98a5);}}; \ No newline at end of file +var _0x10e6=['save','remove','update','emit','length','dashboardItem:','./dashboardItem.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x10e6,0x179));var _0x610e=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x10e6[_0x228641];return _0x5d5d78;};'use strict';var DashboardItemEvents=require(_0x610e('0x0'));var events=[_0x610e('0x1'),_0x610e('0x2'),_0x610e('0x3')];function createListener(_0x22386f,_0x2e3f19){return function(_0x25345b){_0x2e3f19[_0x610e('0x4')](_0x22386f,_0x25345b);};}function removeListener(_0x25f1c5,_0x41b6e5){return function(){DashboardItemEvents['removeListener'](_0x25f1c5,_0x41b6e5);};}exports['register']=function(_0x44ecc9){for(var _0x5a92c8=0x0,_0x186c21=events[_0x610e('0x5')];_0x5a92c8<_0x186c21;_0x5a92c8++){var _0x53140f=events[_0x5a92c8];var _0x33574b=createListener(_0x610e('0x6')+_0x53140f,_0x44ecc9);DashboardItemEvents['on'](_0x53140f,_0x33574b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index eeadbe8..28aeadc 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 _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','create','put','/:id'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/:id',auth[_0xeabc('0x8')](),controller['show']);router[_0xeabc('0x9')]('/',auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file +var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0xf2ca[_0x3a07c1];return _0x2bbe15;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 708c196..0ba1923 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 _0x05a3=['STRING'];(function(_0x3af74d,_0x1e7e2d){var _0x3811a7=function(_0x546cb2){while(--_0x546cb2){_0x3af74d['push'](_0x3af74d['shift']());}};_0x3811a7(++_0x1e7e2d);}(_0x05a3,0x1a3));var _0x305a=function(_0x7cd558,_0x39b5a4){_0x7cd558=_0x7cd558-0x0;var _0x95eeba=_0x05a3[_0x7cd558];return _0x95eeba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x305a('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x5ae5=['sequelize','exports','STRING'];(function(_0x502116,_0x242439){var _0x414095=function(_0x9b6dbc){while(--_0x9b6dbc){_0x502116['push'](_0x502116['shift']());}};_0x414095(++_0x242439);}(_0x5ae5,0x1d7));var _0x55ae=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x5ae5[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x55ae('0x0'));module[_0x55ae('0x1')]={'name':{'type':Sequelize[_0x55ae('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 06c73ee..ddc0ee5 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 _0x8a5f=['error','stack','name','send','map','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','nolimit','limit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource'];(function(_0x444bef,_0xd0afd7){var _0x67aff7=function(_0x27f3cc){while(--_0x27f3cc){_0x444bef['push'](_0x444bef['shift']());}};_0x67aff7(++_0xd0afd7);}(_0x8a5f,0x1c6));var _0xf8a5=function(_0x11ed6d,_0x157fc0){_0x11ed6d=_0x11ed6d-0x0;var _0x12d2bc=_0x8a5f[_0x11ed6d];return _0x12d2bc;};'use strict';var pdf=require(_0xf8a5('0x0'));var emlformat=require(_0xf8a5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf8a5('0x2'));var jsonpatch=require(_0xf8a5('0x3'));var rp=require(_0xf8a5('0x4'));var moment=require(_0xf8a5('0x5'));var BPromise=require(_0xf8a5('0x6'));var Mustache=require(_0xf8a5('0x7'));var util=require(_0xf8a5('0x8'));var path=require(_0xf8a5('0x9'));var sox=require(_0xf8a5('0xa'));var csv=require('to-csv');var ejs=require(_0xf8a5('0xb'));var fs=require('fs');var _=require(_0xf8a5('0xc'));var squel=require(_0xf8a5('0xd'));var crypto=require('crypto');var jsforce=require(_0xf8a5('0xe'));var deskjs=require(_0xf8a5('0xf'));var toCsv=require(_0xf8a5('0x10'));var querystring=require(_0xf8a5('0x11'));var Papa=require(_0xf8a5('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf8a5('0x14'))('api');var utils=require(_0xf8a5('0x15'));var config=require(_0xf8a5('0x16'));var db=require(_0xf8a5('0x17'))['db'];function respondWithStatusCode(_0x2ad1f3,_0x249295){_0x249295=_0x249295||0xcc;return function(_0x40a3c0){if(_0x40a3c0){return _0x2ad1f3['sendStatus'](_0x249295);}return _0x2ad1f3[_0xf8a5('0x18')](_0x249295)[_0xf8a5('0x19')]();};}function respondWithResult(_0x1be6b5,_0x2712e8){_0x2712e8=_0x2712e8||0xc8;return function(_0x15e2c5){if(_0x15e2c5){return _0x1be6b5['status'](_0x2712e8)[_0xf8a5('0x1a')](_0x15e2c5);}};}function respondWithFilteredResult(_0x287bdc,_0x58d560){return function(_0x16bf50){if(_0x16bf50){var _0x149dd1=_0x16bf50[_0xf8a5('0x1b')],_0x7ccd34=_0x58d560['offset'],_0x3b5643=_0x58d560['offset']+_0x58d560['limit'],_0x378143;if(_0x3b5643>=_0x149dd1){_0x3b5643=_0x149dd1;_0x378143=0xc8;}else{_0x378143=0xce;}_0x287bdc[_0xf8a5('0x18')](_0x378143);return _0x287bdc[_0xf8a5('0x1c')](_0xf8a5('0x1d'),_0x7ccd34+'-'+_0x3b5643+'/'+_0x149dd1)[_0xf8a5('0x1a')](_0x16bf50);}return null;};}function patchUpdates(_0x437194){return function(_0x29db3b){try{jsonpatch[_0xf8a5('0x1e')](_0x29db3b,_0x437194,!![]);}catch(_0x2f9ea6){return BPromise[_0xf8a5('0x1f')](_0x2f9ea6);}return _0x29db3b[_0xf8a5('0x20')]();};}function saveUpdates(_0x508433,_0x179ced){return function(_0x90b6d){if(_0x90b6d){return _0x90b6d[_0xf8a5('0x21')](_0x508433)[_0xf8a5('0x22')](function(_0x3a0251){return _0x3a0251;});}return null;};}function removeEntity(_0x2126df,_0x316653){return function(_0x1ec6f1){if(_0x1ec6f1){return _0x1ec6f1[_0xf8a5('0x23')]()['then'](function(){var _0x92c1ec=_0x1ec6f1['get']({'plain':!![]});var _0x4ee38c=_0xf8a5('0x24');return db[_0xf8a5('0x25')][_0xf8a5('0x23')]({'where':{'type':_0x4ee38c,'resourceId':_0x92c1ec['id']}})['then'](function(){return _0x1ec6f1;});})[_0xf8a5('0x22')](function(){_0x2126df[_0xf8a5('0x18')](0xcc)[_0xf8a5('0x19')]();});}};}function handleEntityNotFound(_0x3d156b,_0x236d5a){return function(_0x36b7e6){if(!_0x36b7e6){_0x3d156b['sendStatus'](0x194);}return _0x36b7e6;};}function handleError(_0x5f0a8a,_0x4c1424){_0x4c1424=_0x4c1424||0x1f4;return function(_0x29f76d){logger[_0xf8a5('0x26')](_0x29f76d[_0xf8a5('0x27')]);if(_0x29f76d[_0xf8a5('0x28')]){delete _0x29f76d[_0xf8a5('0x28')];}_0x5f0a8a[_0xf8a5('0x18')](_0x4c1424)[_0xf8a5('0x29')](_0x29f76d);};}exports['index']=function(_0x469e14,_0x3eb5a2){var _0x1114d9={},_0x177e6f={},_0x39c115={'count':0x0,'rows':[]};var _0x2cdf79=_[_0xf8a5('0x2a')](db['Disposition'][_0xf8a5('0x2b')],function(_0x29aca7){return{'name':_0x29aca7[_0xf8a5('0x2c')],'type':_0x29aca7['type']['key']};});_0x177e6f['model']=_[_0xf8a5('0x2a')](_0x2cdf79,'name');_0x177e6f['query']=_[_0xf8a5('0x2d')](_0x469e14[_0xf8a5('0x2e')]);_0x177e6f[_0xf8a5('0x2f')]=_[_0xf8a5('0x30')](_0x177e6f['model'],_0x177e6f[_0xf8a5('0x2e')]);_0x1114d9['attributes']=_['intersection'](_0x177e6f[_0xf8a5('0x31')],qs[_0xf8a5('0x32')](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x32')]));_0x1114d9[_0xf8a5('0x33')]=_0x1114d9[_0xf8a5('0x33')]['length']?_0x1114d9[_0xf8a5('0x33')]:_0x177e6f[_0xf8a5('0x31')];if(!_0x469e14['query']['hasOwnProperty'](_0xf8a5('0x34'))){_0x1114d9['limit']=qs[_0xf8a5('0x35')](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x35')]);_0x1114d9[_0xf8a5('0x36')]=qs['offset'](_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x36')]);}_0x1114d9[_0xf8a5('0x37')]=qs[_0xf8a5('0x38')](_0x469e14['query']['sort']);_0x1114d9[_0xf8a5('0x39')]=qs['filters'](_[_0xf8a5('0x3a')](_0x469e14[_0xf8a5('0x2e')],_0x177e6f[_0xf8a5('0x2f')]),_0x2cdf79);if(_0x469e14['query'][_0xf8a5('0x3b')]){_0x1114d9[_0xf8a5('0x39')]=_[_0xf8a5('0x3c')](_0x1114d9[_0xf8a5('0x39')],{'$or':_[_0xf8a5('0x2a')](_0x2cdf79,function(_0x566400){if(_0x566400[_0xf8a5('0x3d')]!==_0xf8a5('0x3e')){var _0x55ee02={};_0x55ee02[_0x566400[_0xf8a5('0x28')]]={'$like':'%'+_0x469e14[_0xf8a5('0x2e')]['filter']+'%'};return _0x55ee02;}})});}_0x1114d9=_['merge']({},_0x1114d9,_0x469e14[_0xf8a5('0x3f')]);var _0x149a94={'where':_0x1114d9['where']};return db[_0xf8a5('0x40')][_0xf8a5('0x1b')](_0x149a94)[_0xf8a5('0x22')](function(_0x234436){_0x39c115[_0xf8a5('0x1b')]=_0x234436;if(_0x469e14[_0xf8a5('0x2e')][_0xf8a5('0x41')]){_0x1114d9[_0xf8a5('0x42')]=[{'all':!![]}];}return db['Disposition'][_0xf8a5('0x43')](_0x1114d9);})['then'](function(_0x187b48){_0x39c115[_0xf8a5('0x44')]=_0x187b48;return _0x39c115;})[_0xf8a5('0x22')](respondWithFilteredResult(_0x3eb5a2,_0x1114d9))[_0xf8a5('0x45')](handleError(_0x3eb5a2,null));};exports['show']=function(_0x52b5ac,_0x389e4b){var _0x547e3a={'raw':!![],'where':{'id':_0x52b5ac['params']['id']}},_0x4c3b68={};_0x4c3b68['model']=_[_0xf8a5('0x2d')](db[_0xf8a5('0x40')][_0xf8a5('0x2b')]);_0x4c3b68[_0xf8a5('0x2e')]=_[_0xf8a5('0x2d')](_0x52b5ac[_0xf8a5('0x2e')]);_0x4c3b68[_0xf8a5('0x2f')]=_[_0xf8a5('0x30')](_0x4c3b68[_0xf8a5('0x31')],_0x4c3b68[_0xf8a5('0x2e')]);_0x547e3a[_0xf8a5('0x33')]=_['intersection'](_0x4c3b68['model'],qs['fields'](_0x52b5ac[_0xf8a5('0x2e')][_0xf8a5('0x32')]));_0x547e3a[_0xf8a5('0x33')]=_0x547e3a[_0xf8a5('0x33')][_0xf8a5('0x46')]?_0x547e3a[_0xf8a5('0x33')]:_0x4c3b68[_0xf8a5('0x31')];if(_0x52b5ac[_0xf8a5('0x2e')][_0xf8a5('0x41')]){_0x547e3a[_0xf8a5('0x42')]=[{'all':!![]}];}_0x547e3a=_['merge']({},_0x547e3a,_0x52b5ac[_0xf8a5('0x3f')]);return db[_0xf8a5('0x40')]['find'](_0x547e3a)[_0xf8a5('0x22')](handleEntityNotFound(_0x389e4b,null))[_0xf8a5('0x22')](respondWithResult(_0x389e4b,null))[_0xf8a5('0x45')](handleError(_0x389e4b,null));};exports[_0xf8a5('0x47')]=function(_0x20bea0,_0x4960d2){return db[_0xf8a5('0x40')][_0xf8a5('0x47')](_0x20bea0[_0xf8a5('0x48')],{})[_0xf8a5('0x22')](function(_0x568f19){var _0x3a791a=_0x20bea0[_0xf8a5('0x49')][_0xf8a5('0x4a')]({'plain':!![]});if(!_0x3a791a)throw new Error(_0xf8a5('0x4b'));if(_0x3a791a[_0xf8a5('0x4c')]===_0xf8a5('0x49')){var _0x243273=_0x568f19[_0xf8a5('0x4a')]({'plain':!![]});var _0xef339f=_0xf8a5('0x24');return db[_0xf8a5('0x4d')][_0xf8a5('0x4e')]({'where':{'name':_0xef339f,'userProfileId':_0x3a791a['userProfileId']},'raw':!![]})[_0xf8a5('0x22')](function(_0x1d1457){if(_0x1d1457&&_0x1d1457[_0xf8a5('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x243273[_0xf8a5('0x28')],'resourceId':_0x243273['id'],'type':_0x1d1457['name'],'sectionId':_0x1d1457['id']},{})[_0xf8a5('0x22')](function(){return _0x568f19;});}else{return _0x568f19;}})[_0xf8a5('0x45')](function(_0x2c176d){logger[_0xf8a5('0x26')](_0xf8a5('0x50'),_0x2c176d);throw _0x2c176d;});}return _0x568f19;})[_0xf8a5('0x22')](respondWithResult(_0x4960d2,0xc9))['catch'](handleError(_0x4960d2,null));};exports[_0xf8a5('0x21')]=function(_0x416449,_0x461c52){if(_0x416449[_0xf8a5('0x48')]['id']){delete _0x416449[_0xf8a5('0x48')]['id'];}return db[_0xf8a5('0x40')][_0xf8a5('0x4e')]({'where':{'id':_0x416449['params']['id']}})[_0xf8a5('0x22')](handleEntityNotFound(_0x461c52,null))[_0xf8a5('0x22')](saveUpdates(_0x416449[_0xf8a5('0x48')],null))[_0xf8a5('0x22')](respondWithResult(_0x461c52,null))['catch'](handleError(_0x461c52,null));};exports['destroy']=function(_0x51f4bc,_0x500a11){return db['Disposition']['find']({'where':{'id':_0x51f4bc[_0xf8a5('0x51')]['id']}})[_0xf8a5('0x22')](handleEntityNotFound(_0x500a11,null))[_0xf8a5('0x22')](removeEntity(_0x500a11,null))[_0xf8a5('0x45')](handleError(_0x500a11,null));}; \ No newline at end of file +var _0xf1ac=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','set','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','sendStatus','stack','name','send','map','Disposition','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','rawAttributes','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir'];(function(_0x3d6c76,_0x916dea){var _0x31b9e=function(_0x4d32ee){while(--_0x4d32ee){_0x3d6c76['push'](_0x3d6c76['shift']());}};_0x31b9e(++_0x916dea);}(_0xf1ac,0xed));var _0xcf1a=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xf1ac[_0x6dd5c];return _0x5a87fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf1a('0x0'));var rimraf=require(_0xcf1a('0x1'));var zipdir=require(_0xcf1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf1a('0x3'));var moment=require(_0xcf1a('0x4'));var BPromise=require(_0xcf1a('0x5'));var Mustache=require(_0xcf1a('0x6'));var util=require('util');var path=require(_0xcf1a('0x7'));var sox=require(_0xcf1a('0x8'));var csv=require(_0xcf1a('0x9'));var ejs=require(_0xcf1a('0xa'));var fs=require('fs');var _=require(_0xcf1a('0xb'));var squel=require(_0xcf1a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf1a('0xd'));var toCsv=require(_0xcf1a('0x9'));var querystring=require(_0xcf1a('0xe'));var Papa=require(_0xcf1a('0xf'));var Redis=require('ioredis');var authService=require(_0xcf1a('0x10'));var qs=require(_0xcf1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf1a('0x12'));var logger=require(_0xcf1a('0x13'))('api');var utils=require(_0xcf1a('0x14'));var config=require(_0xcf1a('0x15'));var db=require(_0xcf1a('0x16'))['db'];function respondWithStatusCode(_0x3f0fcf,_0x2d5119){_0x2d5119=_0x2d5119||0xcc;return function(_0x564676){if(_0x564676){return _0x3f0fcf['sendStatus'](_0x2d5119);}return _0x3f0fcf[_0xcf1a('0x17')](_0x2d5119)['end']();};}function respondWithResult(_0x5d8cbe,_0x3f9ac3){_0x3f9ac3=_0x3f9ac3||0xc8;return function(_0x445ee3){if(_0x445ee3){return _0x5d8cbe[_0xcf1a('0x17')](_0x3f9ac3)['json'](_0x445ee3);}};}function respondWithFilteredResult(_0x519d62,_0x5cf49f){return function(_0x34a76e){if(_0x34a76e){var _0x2f233b=_0x34a76e[_0xcf1a('0x18')],_0x523006=_0x5cf49f[_0xcf1a('0x19')],_0x6bfc5f=_0x5cf49f[_0xcf1a('0x19')]+_0x5cf49f['limit'],_0x26f47a;if(_0x6bfc5f>=_0x2f233b){_0x6bfc5f=_0x2f233b;_0x26f47a=0xc8;}else{_0x26f47a=0xce;}_0x519d62[_0xcf1a('0x17')](_0x26f47a);return _0x519d62[_0xcf1a('0x1a')]('Content-Range',_0x523006+'-'+_0x6bfc5f+'/'+_0x2f233b)[_0xcf1a('0x1b')](_0x34a76e);}return null;};}function patchUpdates(_0x4f2191){return function(_0xb20a92){try{jsonpatch[_0xcf1a('0x1c')](_0xb20a92,_0x4f2191,!![]);}catch(_0x256283){return BPromise[_0xcf1a('0x1d')](_0x256283);}return _0xb20a92[_0xcf1a('0x1e')]();};}function saveUpdates(_0x50b913,_0x456d7a){return function(_0x59babe){if(_0x59babe){return _0x59babe[_0xcf1a('0x1f')](_0x50b913)[_0xcf1a('0x20')](function(_0x221c6e){return _0x221c6e;});}return null;};}function removeEntity(_0x3ac032,_0xff3003){return function(_0x97d0fe){if(_0x97d0fe){return _0x97d0fe[_0xcf1a('0x21')]()[_0xcf1a('0x20')](function(){var _0x4c5ec8=_0x97d0fe[_0xcf1a('0x22')]({'plain':!![]});var _0x561df6=_0xcf1a('0x23');return db[_0xcf1a('0x24')][_0xcf1a('0x21')]({'where':{'type':_0x561df6,'resourceId':_0x4c5ec8['id']}})[_0xcf1a('0x20')](function(){return _0x97d0fe;});})[_0xcf1a('0x20')](function(){_0x3ac032[_0xcf1a('0x17')](0xcc)[_0xcf1a('0x25')]();});}};}function handleEntityNotFound(_0x165046,_0x4732de){return function(_0xb72310){if(!_0xb72310){_0x165046[_0xcf1a('0x26')](0x194);}return _0xb72310;};}function handleError(_0x3371c1,_0x137fbe){_0x137fbe=_0x137fbe||0x1f4;return function(_0xddab47){logger['error'](_0xddab47[_0xcf1a('0x27')]);if(_0xddab47[_0xcf1a('0x28')]){delete _0xddab47[_0xcf1a('0x28')];}_0x3371c1['status'](_0x137fbe)[_0xcf1a('0x29')](_0xddab47);};}exports['index']=function(_0x45bb2f,_0x417203){var _0x2db79f={},_0x37eecf={},_0x5020ed={'count':0x0,'rows':[]};var _0x3b8c1c=_[_0xcf1a('0x2a')](db[_0xcf1a('0x2b')]['rawAttributes'],function(_0xdd3bf8){return{'name':_0xdd3bf8['fieldName'],'type':_0xdd3bf8[_0xcf1a('0x2c')][_0xcf1a('0x2d')]};});_0x37eecf['model']=_[_0xcf1a('0x2a')](_0x3b8c1c,_0xcf1a('0x28'));_0x37eecf[_0xcf1a('0x2e')]=_[_0xcf1a('0x2f')](_0x45bb2f[_0xcf1a('0x2e')]);_0x37eecf[_0xcf1a('0x30')]=_['intersection'](_0x37eecf['model'],_0x37eecf[_0xcf1a('0x2e')]);_0x2db79f['attributes']=_[_0xcf1a('0x31')](_0x37eecf[_0xcf1a('0x32')],qs['fields'](_0x45bb2f['query'][_0xcf1a('0x33')]));_0x2db79f['attributes']=_0x2db79f[_0xcf1a('0x34')][_0xcf1a('0x35')]?_0x2db79f[_0xcf1a('0x34')]:_0x37eecf[_0xcf1a('0x32')];if(!_0x45bb2f[_0xcf1a('0x2e')][_0xcf1a('0x36')](_0xcf1a('0x37'))){_0x2db79f[_0xcf1a('0x38')]=qs['limit'](_0x45bb2f[_0xcf1a('0x2e')][_0xcf1a('0x38')]);_0x2db79f['offset']=qs[_0xcf1a('0x19')](_0x45bb2f[_0xcf1a('0x2e')]['offset']);}_0x2db79f['order']=qs[_0xcf1a('0x39')](_0x45bb2f[_0xcf1a('0x2e')]['sort']);_0x2db79f[_0xcf1a('0x3a')]=qs[_0xcf1a('0x30')](_[_0xcf1a('0x3b')](_0x45bb2f[_0xcf1a('0x2e')],_0x37eecf[_0xcf1a('0x30')]),_0x3b8c1c);if(_0x45bb2f['query'][_0xcf1a('0x3c')]){_0x2db79f[_0xcf1a('0x3a')]=_[_0xcf1a('0x3d')](_0x2db79f[_0xcf1a('0x3a')],{'$or':_[_0xcf1a('0x2a')](_0x3b8c1c,function(_0x4dda5c){if(_0x4dda5c['type']!==_0xcf1a('0x3e')){var _0x371530={};_0x371530[_0x4dda5c['name']]={'$like':'%'+_0x45bb2f[_0xcf1a('0x2e')][_0xcf1a('0x3c')]+'%'};return _0x371530;}})});}_0x2db79f=_[_0xcf1a('0x3d')]({},_0x2db79f,_0x45bb2f['options']);var _0x1e2e40={'where':_0x2db79f[_0xcf1a('0x3a')]};return db[_0xcf1a('0x2b')]['count'](_0x1e2e40)['then'](function(_0x57992b){_0x5020ed[_0xcf1a('0x18')]=_0x57992b;if(_0x45bb2f[_0xcf1a('0x2e')]['includeAll']){_0x2db79f['include']=[{'all':!![]}];}return db[_0xcf1a('0x2b')][_0xcf1a('0x3f')](_0x2db79f);})[_0xcf1a('0x20')](function(_0x566b85){_0x5020ed[_0xcf1a('0x40')]=_0x566b85;return _0x5020ed;})[_0xcf1a('0x20')](respondWithFilteredResult(_0x417203,_0x2db79f))[_0xcf1a('0x41')](handleError(_0x417203,null));};exports[_0xcf1a('0x42')]=function(_0x223891,_0x40fa8c){var _0x6189ab={'raw':!![],'where':{'id':_0x223891['params']['id']}},_0x2fafb3={};_0x2fafb3[_0xcf1a('0x32')]=_[_0xcf1a('0x2f')](db[_0xcf1a('0x2b')][_0xcf1a('0x43')]);_0x2fafb3[_0xcf1a('0x2e')]=_[_0xcf1a('0x2f')](_0x223891['query']);_0x2fafb3[_0xcf1a('0x30')]=_['intersection'](_0x2fafb3['model'],_0x2fafb3[_0xcf1a('0x2e')]);_0x6189ab['attributes']=_[_0xcf1a('0x31')](_0x2fafb3['model'],qs[_0xcf1a('0x33')](_0x223891['query'][_0xcf1a('0x33')]));_0x6189ab['attributes']=_0x6189ab[_0xcf1a('0x34')][_0xcf1a('0x35')]?_0x6189ab[_0xcf1a('0x34')]:_0x2fafb3[_0xcf1a('0x32')];if(_0x223891[_0xcf1a('0x2e')][_0xcf1a('0x44')]){_0x6189ab[_0xcf1a('0x45')]=[{'all':!![]}];}_0x6189ab=_[_0xcf1a('0x3d')]({},_0x6189ab,_0x223891[_0xcf1a('0x46')]);return db[_0xcf1a('0x2b')][_0xcf1a('0x47')](_0x6189ab)[_0xcf1a('0x20')](handleEntityNotFound(_0x40fa8c,null))[_0xcf1a('0x20')](respondWithResult(_0x40fa8c,null))[_0xcf1a('0x41')](handleError(_0x40fa8c,null));};exports[_0xcf1a('0x48')]=function(_0x58211f,_0x14b96d){return db['Disposition'][_0xcf1a('0x48')](_0x58211f[_0xcf1a('0x49')],{})[_0xcf1a('0x20')](function(_0x8fb1cf){var _0x408368=_0x58211f[_0xcf1a('0x4a')]['get']({'plain':!![]});if(!_0x408368)throw new Error(_0xcf1a('0x4b'));if(_0x408368['role']===_0xcf1a('0x4a')){var _0x21669f=_0x8fb1cf['get']({'plain':!![]});var _0x118de6=_0xcf1a('0x23');return db[_0xcf1a('0x4c')][_0xcf1a('0x47')]({'where':{'name':_0x118de6,'userProfileId':_0x408368[_0xcf1a('0x4d')]},'raw':!![]})[_0xcf1a('0x20')](function(_0x95a508){if(_0x95a508&&_0x95a508[_0xcf1a('0x4e')]===0x0){return db[_0xcf1a('0x24')][_0xcf1a('0x48')]({'name':_0x21669f[_0xcf1a('0x28')],'resourceId':_0x21669f['id'],'type':_0x95a508['name'],'sectionId':_0x95a508['id']},{})[_0xcf1a('0x20')](function(){return _0x8fb1cf;});}else{return _0x8fb1cf;}})[_0xcf1a('0x41')](function(_0x5d4091){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d4091);throw _0x5d4091;});}return _0x8fb1cf;})[_0xcf1a('0x20')](respondWithResult(_0x14b96d,0xc9))[_0xcf1a('0x41')](handleError(_0x14b96d,null));};exports[_0xcf1a('0x1f')]=function(_0xc7c0c4,_0x3d2084){if(_0xc7c0c4[_0xcf1a('0x49')]['id']){delete _0xc7c0c4['body']['id'];}return db[_0xcf1a('0x2b')][_0xcf1a('0x47')]({'where':{'id':_0xc7c0c4[_0xcf1a('0x4f')]['id']}})[_0xcf1a('0x20')](handleEntityNotFound(_0x3d2084,null))[_0xcf1a('0x20')](saveUpdates(_0xc7c0c4[_0xcf1a('0x49')],null))[_0xcf1a('0x20')](respondWithResult(_0x3d2084,null))[_0xcf1a('0x41')](handleError(_0x3d2084,null));};exports[_0xcf1a('0x21')]=function(_0x315a04,_0x441027){return db[_0xcf1a('0x2b')][_0xcf1a('0x47')]({'where':{'id':_0x315a04[_0xcf1a('0x4f')]['id']}})[_0xcf1a('0x20')](handleEntityNotFound(_0x441027,null))['then'](removeEntity(_0x441027,null))[_0xcf1a('0x41')](handleError(_0x441027,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 9a81f76..6b15870 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 _0x0ac6=['name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0ac6,0xd2));var _0x60ac=function(_0x42b27c,_0x4fd06b){_0x42b27c=_0x42b27c-0x0;var _0xd30c2=_0x0ac6[_0x42b27c];return _0xd30c2;};'use strict';var _=require(_0x60ac('0x0'));var util=require(_0x60ac('0x1'));var logger=require(_0x60ac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x60ac('0x3'));var rp=require(_0x60ac('0x4'));var fs=require('fs');var path=require(_0x60ac('0x5'));var rimraf=require(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var attributes=require(_0x60ac('0x8'));module[_0x60ac('0x9')]=function(_0x3b5a8e,_0x440bd5){return _0x3b5a8e[_0x60ac('0xa')]('Disposition',attributes,{'tableName':_0x60ac('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x60ac('0xc'),'fields':[_0x60ac('0xd'),_0x60ac('0xe')]},{'unique':!![],'name':_0x60ac('0xf'),'fields':['name',_0x60ac('0x10')]},{'unique':!![],'name':_0x60ac('0x11'),'fields':[_0x60ac('0xd'),_0x60ac('0x12')]},{'unique':!![],'name':_0x60ac('0x13'),'fields':['name',_0x60ac('0x14')]},{'unique':!![],'name':_0x60ac('0x15'),'fields':[_0x60ac('0xd'),_0x60ac('0x16')]},{'unique':!![],'name':_0x60ac('0x17'),'fields':[_0x60ac('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x60ac('0x18'),'fields':[_0x60ac('0xd'),_0x60ac('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc42=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xbc42,0x133));var _0x2bc4=function(_0x2d7a5f,_0x4d7e47){_0x2d7a5f=_0x2d7a5f-0x0;var _0x14c1e5=_0xbc42[_0x2d7a5f];return _0x14c1e5;};'use strict';var _=require(_0x2bc4('0x0'));var util=require(_0x2bc4('0x1'));var logger=require(_0x2bc4('0x2'))(_0x2bc4('0x3'));var moment=require(_0x2bc4('0x4'));var BPromise=require(_0x2bc4('0x5'));var rp=require(_0x2bc4('0x6'));var fs=require('fs');var path=require(_0x2bc4('0x7'));var rimraf=require(_0x2bc4('0x8'));var config=require(_0x2bc4('0x9'));var attributes=require(_0x2bc4('0xa'));module[_0x2bc4('0xb')]=function(_0x583c19,_0x3041a9){return _0x583c19[_0x2bc4('0xc')]('Disposition',attributes,{'tableName':_0x2bc4('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2bc4('0xe'),'fields':[_0x2bc4('0xf'),_0x2bc4('0x10')]},{'unique':!![],'name':_0x2bc4('0x11'),'fields':[_0x2bc4('0xf'),_0x2bc4('0x12')]},{'unique':!![],'name':_0x2bc4('0x13'),'fields':[_0x2bc4('0xf'),_0x2bc4('0x14')]},{'unique':!![],'name':'name_sms','fields':[_0x2bc4('0xf'),'SmsAccountId']},{'unique':!![],'name':_0x2bc4('0x15'),'fields':['name',_0x2bc4('0x16')]},{'unique':!![],'name':_0x2bc4('0x17'),'fields':['name',_0x2bc4('0x18')]},{'unique':!![],'name':_0x2bc4('0x19'),'fields':[_0x2bc4('0xf'),_0x2bc4('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4c8eeac..22d7114 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 _0xcd99=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa6b46b,_0x4dbf09){var _0x8cfe43=function(_0x3f4d9c){while(--_0x3f4d9c){_0xa6b46b['push'](_0xa6b46b['shift']());}};_0x8cfe43(++_0x4dbf09);}(_0xcd99,0x15d));var _0x9cd9=function(_0x4f5c17,_0x4e2658){_0x4f5c17=_0x4f5c17-0x0;var _0x1129da=_0xcd99[_0x4f5c17];return _0x1129da;};'use strict';var _=require(_0x9cd9('0x0'));var util=require(_0x9cd9('0x1'));var moment=require(_0x9cd9('0x2'));var BPromise=require(_0x9cd9('0x3'));var rs=require(_0x9cd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cd9('0x5'))['db'];var utils=require(_0x9cd9('0x6'));var logger=require('../../config/logger')(_0x9cd9('0x7'));var config=require(_0x9cd9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9cd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f2cf4,_0x5f0f02,_0xd9ef14){return new BPromise(function(_0x1a9895,_0x4c164d){return client[_0x9cd9('0xa')](_0x5f2cf4,_0xd9ef14)[_0x9cd9('0xb')](function(_0x366c93){logger[_0x9cd9('0xc')](_0x9cd9('0xd'),_0x5f0f02,_0x9cd9('0xe'));logger[_0x9cd9('0xf')](_0x9cd9('0x10'),_0x5f0f02,'request\x20sent',JSON[_0x9cd9('0x11')](_0x366c93));if(_0x366c93[_0x9cd9('0x12')]){if(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x13')]===0x1f4){logger[_0x9cd9('0x12')](_0x9cd9('0xd'),_0x5f0f02,_0x366c93['error'][_0x9cd9('0x14')]);return _0x4c164d(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x14')]);}logger['error'](_0x9cd9('0xd'),_0x5f0f02,_0x366c93['error']['message']);return _0x1a9895(_0x366c93[_0x9cd9('0x12')][_0x9cd9('0x14')]);}else{logger[_0x9cd9('0xc')]('Disposition,\x20%s,\x20%s',_0x5f0f02,'request\x20sent');_0x1a9895(_0x366c93[_0x9cd9('0x15')][_0x9cd9('0x14')]);}})[_0x9cd9('0x16')](function(_0x1ae56c){logger[_0x9cd9('0x12')](_0x9cd9('0xd'),_0x5f0f02,_0x1ae56c);_0x4c164d(_0x1ae56c);});});} \ No newline at end of file +var _0xac67=['Disposition,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac67,0x11e));var _0x7ac6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xac67[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x7ac6('0x0'));var moment=require(_0x7ac6('0x1'));var BPromise=require(_0x7ac6('0x2'));var rs=require(_0x7ac6('0x3'));var fs=require('fs');var Redis=require(_0x7ac6('0x4'));var db=require(_0x7ac6('0x5'))['db'];var utils=require(_0x7ac6('0x6'));var logger=require(_0x7ac6('0x7'))(_0x7ac6('0x8'));var config=require(_0x7ac6('0x9'));var jayson=require(_0x7ac6('0xa'));var client=jayson['client'][_0x7ac6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17ae32,_0x194abf,_0x1707af){return new BPromise(function(_0x3dc83d,_0x5545ae){return client['request'](_0x17ae32,_0x1707af)[_0x7ac6('0xc')](function(_0x18724c){logger[_0x7ac6('0xd')](_0x7ac6('0xe'),_0x194abf,_0x7ac6('0xf'));logger[_0x7ac6('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0x194abf,'request\x20sent',JSON['stringify'](_0x18724c));if(_0x18724c[_0x7ac6('0x11')]){if(_0x18724c[_0x7ac6('0x11')]['code']===0x1f4){logger[_0x7ac6('0x11')](_0x7ac6('0xe'),_0x194abf,_0x18724c[_0x7ac6('0x11')][_0x7ac6('0x12')]);return _0x5545ae(_0x18724c[_0x7ac6('0x11')][_0x7ac6('0x12')]);}logger[_0x7ac6('0x11')]('Disposition,\x20%s,\x20%s',_0x194abf,_0x18724c[_0x7ac6('0x11')][_0x7ac6('0x12')]);return _0x3dc83d(_0x18724c[_0x7ac6('0x11')][_0x7ac6('0x12')]);}else{logger[_0x7ac6('0xd')](_0x7ac6('0xe'),_0x194abf,_0x7ac6('0xf'));_0x3dc83d(_0x18724c['result']['message']);}})[_0x7ac6('0x13')](function(_0x3b6b1c){logger[_0x7ac6('0x11')](_0x7ac6('0xe'),_0x194abf,_0x3b6b1c);_0x5545ae(_0x3b6b1c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 63260bd..b2b8d15 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 _0x39d2=['../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1f6adc,_0x27b160){var _0x3eeba6=function(_0x25910c){while(--_0x25910c){_0x1f6adc['push'](_0x1f6adc['shift']());}};_0x3eeba6(++_0x27b160);}(_0x39d2,0xf5));var _0x239d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x39d2[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x239d('0x0'));var util=require('util');var path=require(_0x239d('0x1'));var timeout=require(_0x239d('0x2'));var express=require(_0x239d('0x3'));var router=express[_0x239d('0x4')]();var auth=require(_0x239d('0x5'));var interaction=require(_0x239d('0x6'));var config=require(_0x239d('0x7'));var controller=require(_0x239d('0x8'));router[_0x239d('0x9')]('/',auth[_0x239d('0xa')](),controller[_0x239d('0xb')]);router[_0x239d('0x9')](_0x239d('0xc'),auth['isAuthenticated'](),controller[_0x239d('0xd')]);router[_0x239d('0xe')]('/',auth[_0x239d('0xa')](),controller[_0x239d('0xf')]);router[_0x239d('0x10')](_0x239d('0xc'),auth[_0x239d('0xa')](),controller[_0x239d('0x11')]);router[_0x239d('0x12')](_0x239d('0xc'),auth[_0x239d('0xa')](),controller[_0x239d('0x13')]);module[_0x239d('0x14')]=router; \ No newline at end of file +var _0xdf92=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x18a73b,_0x3a7572){var _0x460753=function(_0x4b64b7){while(--_0x4b64b7){_0x18a73b['push'](_0x18a73b['shift']());}};_0x460753(++_0x3a7572);}(_0xdf92,0x10c));var _0x2df9=function(_0x2d50b6,_0x3d3874){_0x2d50b6=_0x2d50b6-0x0;var _0x1e89c2=_0xdf92[_0x2d50b6];return _0x1e89c2;};'use strict';var multer=require(_0x2df9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2df9('0x1'));var express=require(_0x2df9('0x2'));var router=express[_0x2df9('0x3')]();var auth=require(_0x2df9('0x4'));var interaction=require(_0x2df9('0x5'));var config=require(_0x2df9('0x6'));var controller=require(_0x2df9('0x7'));router[_0x2df9('0x8')]('/',auth[_0x2df9('0x9')](),controller[_0x2df9('0xa')]);router['get'](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0xc')]);router[_0x2df9('0xd')]('/',auth[_0x2df9('0x9')](),controller['create']);router[_0x2df9('0xe')](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0xf')]);router[_0x2df9('0x10')](_0x2df9('0xb'),auth[_0x2df9('0x9')](),controller[_0x2df9('0x11')]);module[_0x2df9('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3e5e0ee..0e24e7f 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 _0x0194=['7200','14400','9600','12000','v17,v27,v29','IAX','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800'];(function(_0x2e8c3a,_0x56ab17){var _0x4d7311=function(_0x12e45d){while(--_0x12e45d){_0x2e8c3a['push'](_0x2e8c3a['shift']());}};_0x4d7311(++_0x56ab17);}(_0x0194,0x101));var _0x4019=function(_0x28cb43,_0x226e0c){_0x28cb43=_0x28cb43-0x0;var _0x153f7a=_0x0194[_0x28cb43];return _0x153f7a;};'use strict';var Sequelize=require(_0x4019('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4019('0x1')]},'ecm':{'type':Sequelize[_0x4019('0x2')](_0x4019('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4019('0x1')],'defaultValue':_0x4019('0x4')},'localstationid':{'type':Sequelize[_0x4019('0x1')],'unique':_0x4019('0x5')},'minrate':{'type':Sequelize[_0x4019('0x2')]('2400',_0x4019('0x6'),_0x4019('0x7'),'9600','12000',_0x4019('0x8')),'defaultValue':_0x4019('0x6')},'maxrate':{'type':Sequelize[_0x4019('0x2')]('2400',_0x4019('0x6'),'7200',_0x4019('0x9'),_0x4019('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4019('0x1')],'defaultValue':_0x4019('0xb')},'gateway':{'type':Sequelize[_0x4019('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4019('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4019('0x2')]('SIP',_0x4019('0xc'),'DADHI',_0x4019('0xd')),'defaultValue':_0x4019('0xe')},'key':{'type':Sequelize[_0x4019('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4019('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4019('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4019('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4019('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4019('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4019('0x11')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4019('0x12'),'set':function(_0x3d6593){if(!_0x3d6593)this[_0x4019('0x13')](_0x4019('0x14'),null);this[_0x4019('0x13')](_0x4019('0x15'),_0x3d6593);}}}; \ No newline at end of file +var _0xdfdf=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','9600','12000','14400','4800','7200','v17,v27,v29','INTEGER','IAX','KHOMP','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdfdf,0x146));var _0xfdfd=function(_0x2f63ad,_0x1ae2b7){_0x2f63ad=_0x2f63ad-0x0;var _0x5466fa=_0xdfdf[_0x2f63ad];return _0x5466fa;};'use strict';var Sequelize=require(_0xfdfd('0x0'));module[_0xfdfd('0x1')]={'name':{'type':Sequelize[_0xfdfd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfdfd('0x2')]},'ecm':{'type':Sequelize[_0xfdfd('0x3')](_0xfdfd('0x4'),'no'),'defaultValue':_0xfdfd('0x4')},'headerinfo':{'type':Sequelize[_0xfdfd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xfdfd('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xfdfd('0x3')](_0xfdfd('0x5'),'4800','7200',_0xfdfd('0x6'),_0xfdfd('0x7'),_0xfdfd('0x8')),'defaultValue':_0xfdfd('0x9')},'maxrate':{'type':Sequelize[_0xfdfd('0x3')]('2400',_0xfdfd('0x9'),_0xfdfd('0xa'),_0xfdfd('0x6'),_0xfdfd('0x7'),_0xfdfd('0x8')),'defaultValue':_0xfdfd('0x8')},'modem':{'type':Sequelize[_0xfdfd('0x2')],'defaultValue':_0xfdfd('0xb')},'gateway':{'type':Sequelize[_0xfdfd('0x2')],'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[_0xfdfd('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xfdfd('0xd'),'DADHI',_0xfdfd('0xe')),'defaultValue':_0xfdfd('0xf')},'key':{'type':Sequelize[_0xfdfd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfdfd('0x10');}},'notificationSound':{'type':Sequelize[_0xfdfd('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfdfd('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfdfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfdfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfdfd('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfdfd('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfdfd('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xfdfd('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xfdfd('0x11')],'defaultValue':![],'comment':_0xfdfd('0x13'),'set':function(_0x1cd069){if(!_0x1cd069)this[_0xfdfd('0x14')](_0xfdfd('0x15'),null);this['setDataValue'](_0xfdfd('0x16'),_0x1cd069);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index f5f2601..c494f18 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 _0x2a9f=['ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','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','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','CmList','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','Pause','keys','intersection','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','findOne','removeDispositions'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x2a9f,0x1ec));var _0xf2a9=function(_0x16cd3a,_0x546c76){_0x16cd3a=_0x16cd3a-0x0;var _0x314c4c=_0x2a9f[_0x16cd3a];return _0x314c4c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2a9('0x0'));var rimraf=require(_0xf2a9('0x1'));var zipdir=require(_0xf2a9('0x2'));var jsonpatch=require(_0xf2a9('0x3'));var rp=require(_0xf2a9('0x4'));var moment=require(_0xf2a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf2a9('0x6'));var util=require(_0xf2a9('0x7'));var path=require(_0xf2a9('0x8'));var sox=require(_0xf2a9('0x9'));var csv=require(_0xf2a9('0xa'));var ejs=require(_0xf2a9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf2a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xf2a9('0xd'));var deskjs=require(_0xf2a9('0xe'));var toCsv=require(_0xf2a9('0xa'));var querystring=require(_0xf2a9('0xf'));var Papa=require(_0xf2a9('0x10'));var Redis=require(_0xf2a9('0x11'));var authService=require(_0xf2a9('0x12'));var qs=require(_0xf2a9('0x13'));var as=require(_0xf2a9('0x14'));var hardwareService=require(_0xf2a9('0x15'));var logger=require(_0xf2a9('0x16'))(_0xf2a9('0x17'));var utils=require('../../config/utils');var config=require(_0xf2a9('0x18'));var db=require(_0xf2a9('0x19'))['db'];config[_0xf2a9('0x1a')]=_['defaults'](config[_0xf2a9('0x1a')],{'host':_0xf2a9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf2a9('0x1a')]));require('./faxAccount.socket')[_0xf2a9('0x1c')](socket);var jayson=require(_0xf2a9('0x1d'));var client=jayson[_0xf2a9('0x1e')][_0xf2a9('0x1f')]({'port':0x232c});var client9002=jayson[_0xf2a9('0x1e')][_0xf2a9('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x53790e,_0x28decc,_0x136a5c){if(_0x136a5c){var _0xc2eeae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc2eeae[_0xf2a9('0x20')](_0x28decc)){return _0x53790e;}else{throw new db['Sequelize'][(_0xf2a9('0x21'))](_0xf2a9('0x22'));}}else{return _0x53790e;}}function respondWithRpcPromise(_0x110165,_0x31c7fe,_0x41dd90,_0x1d5283){return new BPromise(function(_0x2d83b6,_0x21a3ac){var _0x910b4c=_0x1d5283||client;return _0x910b4c[_0xf2a9('0x23')](_0x110165,_0x41dd90)[_0xf2a9('0x24')](function(_0x4b1be7){logger[_0xf2a9('0x25')]('FaxAccount,\x20%s,\x20%s',_0x31c7fe,_0xf2a9('0x26'));logger[_0xf2a9('0x27')](_0xf2a9('0x28'),_0x31c7fe,_0xf2a9('0x26'),JSON[_0xf2a9('0x29')](_0x4b1be7));if(_0x4b1be7['error']){if(_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2b')]===0x1f4){logger['error'](_0xf2a9('0x2c'),_0x31c7fe,_0x4b1be7['error'][_0xf2a9('0x2d')]);return _0x21a3ac(_0x4b1be7[_0xf2a9('0x2a')]['message']);}logger[_0xf2a9('0x2a')](_0xf2a9('0x2c'),_0x31c7fe,_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2d')]);return _0x2d83b6(_0x4b1be7[_0xf2a9('0x2a')][_0xf2a9('0x2d')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x31c7fe,_0xf2a9('0x26'));_0x2d83b6(_0x4b1be7[_0xf2a9('0x2e')][_0xf2a9('0x2d')]);}})['catch'](function(_0x38f4b3){logger[_0xf2a9('0x2a')](_0xf2a9('0x2c'),_0x31c7fe,_0x38f4b3);_0x21a3ac(_0x38f4b3);});});}function respondWithStatusCode(_0x56c2fc,_0x1b1ba0){_0x1b1ba0=_0x1b1ba0||0xcc;return function(_0x48b502){if(_0x48b502){return _0x56c2fc[_0xf2a9('0x2f')](_0x1b1ba0);}return _0x56c2fc[_0xf2a9('0x30')](_0x1b1ba0)[_0xf2a9('0x31')]();};}function respondWithResult(_0xe1d245,_0x4ed903){_0x4ed903=_0x4ed903||0xc8;return function(_0xe41cff){if(_0xe41cff){return _0xe1d245[_0xf2a9('0x30')](_0x4ed903)[_0xf2a9('0x32')](_0xe41cff);}};}function respondWithFilteredResult(_0x3bc74c,_0x40834e){return function(_0x2d4093){if(_0x2d4093){var _0x4c1fe1=_0x2d4093['count'],_0x237e5e=_0x40834e[_0xf2a9('0x33')],_0x4a08ce=_0x40834e[_0xf2a9('0x33')]+_0x40834e[_0xf2a9('0x34')],_0x35606d;if(_0x4a08ce>=_0x4c1fe1){_0x4a08ce=_0x4c1fe1;_0x35606d=0xc8;}else{_0x35606d=0xce;}_0x3bc74c[_0xf2a9('0x30')](_0x35606d);return _0x3bc74c[_0xf2a9('0x35')](_0xf2a9('0x36'),_0x237e5e+'-'+_0x4a08ce+'/'+_0x4c1fe1)['json'](_0x2d4093);}return null;};}function patchUpdates(_0x5500de){return function(_0x18a196){try{jsonpatch['apply'](_0x18a196,_0x5500de,!![]);}catch(_0x20d137){return BPromise[_0xf2a9('0x37')](_0x20d137);}return _0x18a196['save']();};}function saveUpdates(_0x163474,_0x2d48d5){return function(_0x48eb10){if(_0x48eb10){return _0x48eb10[_0xf2a9('0x38')](_0x163474)[_0xf2a9('0x24')](function(_0x4d0615){return _0x4d0615;});}return null;};}function removeEntity(_0x4efbb6,_0x11af86){return function(_0x132e31){if(_0x132e31){return _0x132e31[_0xf2a9('0x39')]()[_0xf2a9('0x24')](function(){var _0x384198=_0x132e31['get']({'plain':!![]});var _0x2f2be0='FaxAccounts';return db[_0xf2a9('0x3a')]['destroy']({'where':{'type':_0x2f2be0,'resourceId':_0x384198['id']}})[_0xf2a9('0x24')](function(){return _0x132e31;});})[_0xf2a9('0x24')](function(){_0x4efbb6[_0xf2a9('0x30')](0xcc)[_0xf2a9('0x31')]();});}};}function handleEntityNotFound(_0x382fc3,_0x79c73b){return function(_0x2483d1){if(!_0x2483d1){_0x382fc3[_0xf2a9('0x2f')](0x194);}return _0x2483d1;};}function handleError(_0x25bf36,_0x574811){_0x574811=_0x574811||0x1f4;return function(_0x489037){logger['error'](_0x489037[_0xf2a9('0x3b')]);if(_0x489037[_0xf2a9('0x3c')]){delete _0x489037[_0xf2a9('0x3c')];}_0x25bf36[_0xf2a9('0x30')](_0x574811)['send'](_0x489037);};}exports[_0xf2a9('0x3d')]=function(_0x2b34f5,_0x3f1e0e){var _0x2727eb={'include':[{'model':db['Pause'],'as':_0xf2a9('0x3e')}]},_0x398b5f={},_0x4ce210={'count':0x0,'rows':[]};var _0x16191e=_[_0xf2a9('0x3f')](db[_0xf2a9('0x40')]['rawAttributes'],function(_0xc6a495){return{'name':_0xc6a495[_0xf2a9('0x41')],'type':_0xc6a495[_0xf2a9('0x42')]['key']};});_0x398b5f[_0xf2a9('0x43')]=_[_0xf2a9('0x3f')](_0x16191e,'name');_0x398b5f[_0xf2a9('0x44')]=_['keys'](_0x2b34f5[_0xf2a9('0x44')]);_0x398b5f[_0xf2a9('0x45')]=_['intersection'](_0x398b5f[_0xf2a9('0x43')],_0x398b5f['query']);_0x2727eb[_0xf2a9('0x46')]=_['intersection'](_0x398b5f['model'],qs['fields'](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x2727eb['attributes']=_0x2727eb[_0xf2a9('0x46')]['length']?_0x2727eb['attributes']:_0x398b5f[_0xf2a9('0x43')];if(!_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x2727eb['limit']=qs[_0xf2a9('0x34')](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x2727eb[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x2727eb[_0xf2a9('0x4a')]=qs[_0xf2a9('0x4b')](_0x2b34f5[_0xf2a9('0x44')]['sort']);_0x2727eb['where']=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x2b34f5[_0xf2a9('0x44')],_0x398b5f[_0xf2a9('0x45')]),_0x16191e);if(_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x2727eb['where']=_['merge'](_0x2727eb[_0xf2a9('0x4e')],{'$or':_['map'](_0x16191e,function(_0x2d7601){if(_0x2d7601[_0xf2a9('0x42')]!==_0xf2a9('0x4f')){var _0x269c6e={};_0x269c6e[_0x2d7601[_0xf2a9('0x3c')]]={'$like':'%'+_0x2b34f5[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x269c6e;}})});}_0x2727eb=_[_0xf2a9('0x50')]({},_0x2727eb,_0x2b34f5[_0xf2a9('0x51')]);var _0x2a5aa1={'where':_0x2727eb[_0xf2a9('0x4e')]};return db[_0xf2a9('0x40')]['count'](_0x2a5aa1)[_0xf2a9('0x24')](function(_0x58308f){_0x4ce210[_0xf2a9('0x52')]=_0x58308f;if(_0x2b34f5['query']['includeAll']){_0x2727eb[_0xf2a9('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0xf2a9('0x54')](_0x2727eb);})[_0xf2a9('0x24')](function(_0x38aec1){_0x4ce210[_0xf2a9('0x55')]=_0x38aec1;return _0x4ce210;})[_0xf2a9('0x24')](respondWithFilteredResult(_0x3f1e0e,_0x2727eb))[_0xf2a9('0x56')](handleError(_0x3f1e0e,null));};exports[_0xf2a9('0x57')]=function(_0x49dd66,_0x6b29b0){var _0x5b3799={'raw':![],'where':{'id':_0x49dd66[_0xf2a9('0x58')]['id']},'include':[{'model':db[_0xf2a9('0x59')],'as':'mandatoryDispositionPause'}]},_0xdf6304={};_0xdf6304[_0xf2a9('0x43')]=_['keys'](db[_0xf2a9('0x40')]['rawAttributes']);_0xdf6304[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x49dd66[_0xf2a9('0x44')]);_0xdf6304['filters']=_[_0xf2a9('0x5b')](_0xdf6304[_0xf2a9('0x43')],_0xdf6304['query']);_0x5b3799[_0xf2a9('0x46')]=_[_0xf2a9('0x5b')](_0xdf6304[_0xf2a9('0x43')],qs['fields'](_0x49dd66[_0xf2a9('0x44')]['fields']));_0x5b3799[_0xf2a9('0x46')]=_0x5b3799[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x5b3799[_0xf2a9('0x46')]:_0xdf6304[_0xf2a9('0x43')];if(_0x49dd66[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x5b3799[_0xf2a9('0x53')]=[{'all':!![]}];}_0x5b3799=_['merge']({},_0x5b3799,_0x49dd66['options']);return db['FaxAccount'][_0xf2a9('0x5e')](_0x5b3799)[_0xf2a9('0x24')](handleEntityNotFound(_0x6b29b0,null))[_0xf2a9('0x24')](respondWithResult(_0x6b29b0,null))[_0xf2a9('0x56')](handleError(_0x6b29b0,null));};exports['create']=function(_0x48a7ba,_0x121632){return db[_0xf2a9('0x40')][_0xf2a9('0x5f')](_0x48a7ba['body'],{})['then'](function(_0x5ec997){var _0x4b461d=_0x48a7ba[_0xf2a9('0x60')]['get']({'plain':!![]});if(!_0x4b461d)throw new Error(_0xf2a9('0x61'));if(_0x4b461d['role']===_0xf2a9('0x60')){var _0x5c9703=_0x5ec997[_0xf2a9('0x62')]({'plain':!![]});var _0x2c9288='FaxAccounts';return db[_0xf2a9('0x63')]['find']({'where':{'name':_0x2c9288,'userProfileId':_0x4b461d['userProfileId']},'raw':!![]})[_0xf2a9('0x24')](function(_0x44008a){if(_0x44008a&&_0x44008a[_0xf2a9('0x64')]===0x0){return db[_0xf2a9('0x3a')][_0xf2a9('0x5f')]({'name':_0x5c9703['name'],'resourceId':_0x5c9703['id'],'type':_0x44008a[_0xf2a9('0x3c')],'sectionId':_0x44008a['id']},{})[_0xf2a9('0x24')](function(){return _0x5ec997;});}else{return _0x5ec997;}})[_0xf2a9('0x56')](function(_0x5978d9){logger[_0xf2a9('0x2a')](_0xf2a9('0x65'),_0x5978d9);throw _0x5978d9;});}return _0x5ec997;})[_0xf2a9('0x24')](respondWithResult(_0x121632,0xc9))[_0xf2a9('0x56')](handleError(_0x121632,null));};exports[_0xf2a9('0x38')]=function(_0x307753,_0x985cd4){if(_0x307753['body']['id']){delete _0x307753[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x307753[_0xf2a9('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x985cd4,null))['then'](saveUpdates(_0x307753[_0xf2a9('0x66')],null))['then'](respondWithResult(_0x985cd4,null))['catch'](handleError(_0x985cd4,null));};exports[_0xf2a9('0x39')]=function(_0x483d15,_0x5d96f0){return db['FaxAccount'][_0xf2a9('0x5e')]({'where':{'id':_0x483d15[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x5d96f0,null))[_0xf2a9('0x24')](removeEntity(_0x5d96f0,null))['catch'](handleError(_0x5d96f0,null));};exports[_0xf2a9('0x67')]=function(_0x2d288f,_0x22dbf1){return db[_0xf2a9('0x40')][_0xf2a9('0x67')]()[_0xf2a9('0x24')](respondWithResult(_0x22dbf1,null))[_0xf2a9('0x56')](handleError(_0x22dbf1,null));};exports['addDisposition']=function(_0x19ddc3,_0x4270c5,_0x36d463){if(_0x19ddc3[_0xf2a9('0x66')]['id']){delete _0x19ddc3[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x19ddc3[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x4270c5,null))['then'](function(_0x429e3d){if(_0x429e3d){_0x19ddc3['body'][_0xf2a9('0x68')]=_0x429e3d['id'];return db[_0xf2a9('0x69')][_0xf2a9('0x5f')](_0x19ddc3[_0xf2a9('0x66')]);}})[_0xf2a9('0x24')](respondWithResult(_0x4270c5,null))[_0xf2a9('0x56')](handleError(_0x4270c5,null));};exports['getDispositions']=function(_0x358120,_0x5819ff,_0x2e2c3f){var _0x4c4846={'raw':![],'where':{}};var _0x3e6cad={};var _0x1b601f={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x358120[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x5819ff,null))['then'](function(_0x2abcbc){if(_0x2abcbc){_0x3e6cad['model']=_[_0xf2a9('0x5a')](db[_0xf2a9('0x69')]['rawAttributes']);_0x3e6cad[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x358120[_0xf2a9('0x44')]);_0x3e6cad[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x3e6cad[_0xf2a9('0x43')],_0x3e6cad[_0xf2a9('0x44')]);_0x4c4846[_0xf2a9('0x46')]=_[_0xf2a9('0x5b')](_0x3e6cad['model'],qs[_0xf2a9('0x47')](_0x358120[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x4c4846[_0xf2a9('0x46')]=_0x4c4846[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x4c4846[_0xf2a9('0x46')]:_0x3e6cad[_0xf2a9('0x43')];if(!_0x358120['query'][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x4c4846['limit']=qs[_0xf2a9('0x34')](_0x358120[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x4c4846[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x358120[_0xf2a9('0x44')]['offset']);}_0x4c4846['order']=qs[_0xf2a9('0x4b')](_0x358120[_0xf2a9('0x44')]['sort']);_0x4c4846[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x358120[_0xf2a9('0x44')],_0x3e6cad[_0xf2a9('0x45')]));_0x4c4846['where']['FaxAccountId']=_0x2abcbc['id'];if(_0x358120[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x4c4846[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x4c4846['where'],{'$or':_[_0xf2a9('0x3f')](_0x4c4846[_0xf2a9('0x46')],function(_0x1da709){var _0x30bc50={};_0x30bc50[_0x1da709]={'$like':'%'+_0x358120[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x30bc50;})});}_0x4c4846=_[_0xf2a9('0x50')]({},_0x4c4846,_0x358120[_0xf2a9('0x51')]);return db[_0xf2a9('0x69')][_0xf2a9('0x52')]({'where':_0x4c4846[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x3d93cb){_0x1b601f[_0xf2a9('0x52')]=_0x3d93cb;if(_0x358120[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x4c4846['include']=[{'all':!![]}];}return db[_0xf2a9('0x69')][_0xf2a9('0x54')](_0x4c4846);})[_0xf2a9('0x24')](function(_0x38bc69){_0x1b601f['rows']=_0x38bc69;return _0x1b601f;});}})[_0xf2a9('0x24')](respondWithFilteredResult(_0x5819ff,_0x4c4846))[_0xf2a9('0x56')](handleError(_0x5819ff,null));};exports[_0xf2a9('0x6b')]=function(_0x25d9bc,_0x214dfa,_0x137510){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x25d9bc['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x214dfa,null))['then'](function(_0x4f378e){if(_0x4f378e){return _0x4f378e[_0xf2a9('0x6b')](_0x25d9bc[_0xf2a9('0x44')][_0xf2a9('0x6c')]);}})[_0xf2a9('0x24')](respondWithStatusCode(_0x214dfa,null))[_0xf2a9('0x56')](handleError(_0x214dfa,null));};exports[_0xf2a9('0x6d')]=function(_0x1424dc,_0xf9069a,_0xa3a12f){if(_0x1424dc[_0xf2a9('0x66')]['id']){delete _0x1424dc[_0xf2a9('0x66')]['id'];}return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x1424dc[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0xf9069a,null))[_0xf2a9('0x24')](function(_0x448033){if(_0x448033){_0x1424dc['body'][_0xf2a9('0x68')]=_0x448033['id'];return db[_0xf2a9('0x6e')][_0xf2a9('0x5f')](_0x1424dc['body']);}})['then'](respondWithResult(_0xf9069a,null))['catch'](handleError(_0xf9069a,null));};exports[_0xf2a9('0x6f')]=function(_0x22bb57,_0xb7ed45,_0x9e8f62){var _0xe84308={'raw':![],'where':{}};var _0x47c849={};var _0x2716ff={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x22bb57['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0xb7ed45,null))[_0xf2a9('0x24')](function(_0x8a414f){if(_0x8a414f){_0x47c849['model']=_['keys'](db[_0xf2a9('0x6e')][_0xf2a9('0x70')]);_0x47c849[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x22bb57[_0xf2a9('0x44')]);_0x47c849[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x47c849['model'],_0x47c849[_0xf2a9('0x44')]);_0xe84308['attributes']=_['intersection'](_0x47c849[_0xf2a9('0x43')],qs['fields'](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0xe84308['attributes']=_0xe84308[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0xe84308['attributes']:_0x47c849[_0xf2a9('0x43')];if(!_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0xe84308[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0xe84308[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x22bb57[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0xe84308[_0xf2a9('0x4a')]=qs['sort'](_0x22bb57['query'][_0xf2a9('0x4b')]);_0xe84308[_0xf2a9('0x4e')]=qs['filters'](_[_0xf2a9('0x4c')](_0x22bb57[_0xf2a9('0x44')],_0x47c849['filters']));_0xe84308[_0xf2a9('0x4e')][_0xf2a9('0x68')]=_0x8a414f['id'];if(_0x22bb57['query'][_0xf2a9('0x4d')]){_0xe84308[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0xe84308[_0xf2a9('0x4e')],{'$or':_[_0xf2a9('0x3f')](_0xe84308[_0xf2a9('0x46')],function(_0x2da4d5){var _0x16436e={};_0x16436e[_0x2da4d5]={'$like':'%'+_0x22bb57['query']['filter']+'%'};return _0x16436e;})});}_0xe84308=_[_0xf2a9('0x50')]({},_0xe84308,_0x22bb57[_0xf2a9('0x51')]);return db[_0xf2a9('0x6e')][_0xf2a9('0x52')]({'where':_0xe84308['where']})[_0xf2a9('0x24')](function(_0x3f056e){_0x2716ff[_0xf2a9('0x52')]=_0x3f056e;if(_0x22bb57[_0xf2a9('0x44')]['includeAll']){_0xe84308['include']=[{'all':!![]}];}return db[_0xf2a9('0x6e')][_0xf2a9('0x54')](_0xe84308);})['then'](function(_0x1be190){_0x2716ff[_0xf2a9('0x55')]=_0x1be190;return _0x2716ff;});}})['then'](respondWithFilteredResult(_0xb7ed45,_0xe84308))[_0xf2a9('0x56')](handleError(_0xb7ed45,null));};exports[_0xf2a9('0x71')]=function(_0x15a5d5,_0x2568b5,_0x33b966){return db[_0xf2a9('0x40')]['find']({'where':{'id':_0x15a5d5['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x2568b5,null))[_0xf2a9('0x24')](function(_0x1de22c){if(_0x1de22c){return _0x1de22c[_0xf2a9('0x71')](_0x15a5d5[_0xf2a9('0x44')][_0xf2a9('0x6c')]);}})[_0xf2a9('0x24')](respondWithStatusCode(_0x2568b5,null))[_0xf2a9('0x56')](handleError(_0x2568b5,null));};exports[_0xf2a9('0x72')]=function(_0x4c0e37,_0x384c0d,_0x4ebdf8){return db['FaxInteraction']['find']({'where':{'id':_0x4c0e37[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x384c0d,null))['then'](function(_0x51657c){if(_0x51657c){return _0x51657c['addInteraction'](_0x4c0e37[_0xf2a9('0x66')][_0xf2a9('0x6c')],_[_0xf2a9('0x73')](_0x4c0e37['body'],[_0xf2a9('0x6c'),'id'])||{});}})[_0xf2a9('0x24')](respondWithResult(_0x384c0d,null))[_0xf2a9('0x56')](handleError(_0x384c0d,null));};exports[_0xf2a9('0x74')]=function(_0x246edd,_0x2fddab,_0x540084){var _0x48d5b8={'raw':![],'where':{}};var _0xd9760c={};var _0x2d6ae9={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x246edd[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x2fddab,null))['then'](function(_0x4d4589){if(_0x4d4589){_0xd9760c[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x75')][_0xf2a9('0x70')]);_0xd9760c[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x246edd['query']);_0xd9760c[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0xd9760c[_0xf2a9('0x43')],_0xd9760c[_0xf2a9('0x44')]);_0x48d5b8[_0xf2a9('0x46')]=_['intersection'](_0xd9760c['model'],qs[_0xf2a9('0x47')](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x48d5b8[_0xf2a9('0x46')]=_0x48d5b8[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x48d5b8['attributes']:_0xd9760c[_0xf2a9('0x43')];if(!_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x48d5b8[_0xf2a9('0x34')]=qs['limit'](_0x246edd[_0xf2a9('0x44')]['limit']);_0x48d5b8['offset']=qs[_0xf2a9('0x33')](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x48d5b8[_0xf2a9('0x4a')]=qs['sort'](_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x48d5b8[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_['pick'](_0x246edd[_0xf2a9('0x44')],_0xd9760c[_0xf2a9('0x45')]));_0x48d5b8['where'][_0xf2a9('0x68')]=_0x4d4589['id'];if(_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x48d5b8[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x48d5b8['where'],{'$or':_['map'](_0x48d5b8['attributes'],function(_0x5cc581){var _0x79e254={};_0x79e254[_0x5cc581]={'$like':'%'+_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x79e254;})});}_0x48d5b8=_[_0xf2a9('0x50')]({},_0x48d5b8,_0x246edd[_0xf2a9('0x51')]);return db[_0xf2a9('0x75')][_0xf2a9('0x52')]({'where':_0x48d5b8[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x252806){_0x2d6ae9[_0xf2a9('0x52')]=_0x252806;if(_0x246edd['query'][_0xf2a9('0x5d')]){_0x48d5b8['include']=[{'model':db[_0xf2a9('0x76')],'as':_0xf2a9('0x77'),'required':![]},{'model':db[_0xf2a9('0x78')],'as':'Owner','attributes':[_0xf2a9('0x3c'),_0xf2a9('0x79'),_0xf2a9('0x7a')],'required':![]},{'model':db[_0xf2a9('0x7b')],'as':_0xf2a9('0x7c'),'attributes':['id','name','color'],'where':_0x246edd['query'][_0xf2a9('0x7d')]?{'id':_0x246edd[_0xf2a9('0x44')]['tag']}:undefined,'required':_0x246edd[_0xf2a9('0x44')][_0xf2a9('0x7d')]?!![]:![]}];}return db[_0xf2a9('0x75')][_0xf2a9('0x54')](_0x48d5b8);})[_0xf2a9('0x24')](function(_0xf9f1e2){_0x2d6ae9['rows']=_0xf9f1e2;return _0x2d6ae9;});}})[_0xf2a9('0x24')](respondWithFilteredResult(_0x2fddab,_0x48d5b8))[_0xf2a9('0x56')](handleError(_0x2fddab,null));};exports[_0xf2a9('0x7e')]=function(_0x33d2a4,_0x31f13e,_0xfa897e){return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x33d2a4['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x31f13e,null))[_0xf2a9('0x24')](function(_0x43419f){if(_0x43419f){return db[_0xf2a9('0x7f')][_0xf2a9('0x80')](function(_0x4acefe){return db[_0xf2a9('0x81')][_0xf2a9('0x39')]({'where':{'FaxAccountId':_0x33d2a4[_0xf2a9('0x58')]['id']},'transaction':_0x4acefe})[_0xf2a9('0x24')](function(_0x3a3477){var _0x469da7=_[_0xf2a9('0x3f')](_0x33d2a4[_0xf2a9('0x66')],function(_0x588f73){_0x588f73[_0xf2a9('0x68')]=_0x33d2a4[_0xf2a9('0x58')]['id'];return _0x588f73;});return db[_0xf2a9('0x81')][_0xf2a9('0x82')](_0x469da7,{'transaction':_0x4acefe});});})[_0xf2a9('0x24')](function(){return db[_0xf2a9('0x81')][_0xf2a9('0x83')]({'where':{'FaxAccountId':_0x33d2a4[_0xf2a9('0x58')]['id']},'order':_0xf2a9('0x84')});});}})['then'](respondWithResult(_0x31f13e,null))[_0xf2a9('0x56')](handleError(_0x31f13e,null));};exports[_0xf2a9('0x85')]=function(_0x28be5f,_0x393a5e,_0x75be2e){var _0x3cc912={};var _0x3ef0b4={};var _0x292bcf;var _0x2d902f;return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x28be5f[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x393a5e,null))[_0xf2a9('0x24')](function(_0xdb67fb){if(_0xdb67fb){_0x292bcf=_0xdb67fb;_0x3ef0b4[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x81')]['rawAttributes']);_0x3ef0b4[_0xf2a9('0x44')]=_[_0xf2a9('0x5a')](_0x28be5f[_0xf2a9('0x44')]);_0x3ef0b4[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x3ef0b4[_0xf2a9('0x43')],_0x3ef0b4[_0xf2a9('0x44')]);_0x3cc912['attributes']=_[_0xf2a9('0x5b')](_0x3ef0b4[_0xf2a9('0x43')],qs[_0xf2a9('0x47')](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x3cc912[_0xf2a9('0x46')]=_0x3cc912[_0xf2a9('0x46')][_0xf2a9('0x5c')]?_0x3cc912[_0xf2a9('0x46')]:_0x3ef0b4['model'];_0x3cc912[_0xf2a9('0x4a')]=qs[_0xf2a9('0x4b')](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x3cc912['where']=qs['filters'](_[_0xf2a9('0x4c')](_0x28be5f[_0xf2a9('0x44')],_0x3ef0b4[_0xf2a9('0x45')]));if(_0x28be5f['query'][_0xf2a9('0x4d')]){_0x3cc912[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x3cc912[_0xf2a9('0x4e')],{'$or':_['map'](_0x3cc912[_0xf2a9('0x46')],function(_0x5c1d29){var _0x3ddeff={};_0x3ddeff[_0x5c1d29]={'$like':'%'+_0x28be5f['query'][_0xf2a9('0x4d')]+'%'};return _0x3ddeff;})});}_0x3cc912=_['merge']({},_0x3cc912,_0x28be5f[_0xf2a9('0x51')]);return _0x292bcf['getApplications'](_0x3cc912);}})[_0xf2a9('0x24')](function(_0xfdb9e1){if(_0xfdb9e1){_0x2d902f=_0xfdb9e1[_0xf2a9('0x5c')];if(!_0x28be5f['query'][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x3cc912[_0xf2a9('0x34')]=qs['limit'](_0x28be5f[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x3cc912[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x28be5f[_0xf2a9('0x44')]['offset']);}return _0x292bcf[_0xf2a9('0x85')](_0x3cc912);}})[_0xf2a9('0x24')](function(_0x5b2b41){if(_0x5b2b41){return _0x5b2b41?{'count':_0x2d902f,'rows':_0x5b2b41}:null;}})[_0xf2a9('0x24')](respondWithResult(_0x393a5e,null))[_0xf2a9('0x56')](handleError(_0x393a5e,null));};function Extension(_0x102d3a,_0x119ec8,_0xd91de8,_0x21b279){this[_0xf2a9('0x86')]='from-voip-provider';this[_0xf2a9('0x87')]=_0x102d3a[_0xf2a9('0x88')];this[_0xf2a9('0x89')]=_0x21b279;this[_0xf2a9('0x42')]=_0xf2a9('0x8a');this[_0xf2a9('0x8b')]=_0xf2a9('0x8c');this[_0xf2a9('0x68')]=_0x102d3a['id'];this['priority']=_0x119ec8;this[_0xf2a9('0x8d')]=_0xd91de8;}function createExtensionsReciveFax(_0x403558){var _0x145d07=0x1;var _0x13b353=[];_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,'',_0xf2a9('0x8f')));_0x145d07+=0x1;_0x13b353['push'](new Extension(_0x403558,_0x145d07,_0xf2a9('0x90'),_0xf2a9('0x91')));_0x145d07+=0x1;for(var _0x4b6d08 in _0x403558){if(_0x403558[_0xf2a9('0x48')](_0x4b6d08)&&(_0x4b6d08==='ecm'||_0x4b6d08===_0xf2a9('0x88')||_0x4b6d08===_0xf2a9('0x92')||_0x4b6d08===_0xf2a9('0x93')||_0x4b6d08===_0xf2a9('0x94')||_0x4b6d08===_0xf2a9('0x95')||_0x4b6d08===_0xf2a9('0x96')||_0x4b6d08===_0xf2a9('0x97')||_0x4b6d08===_0xf2a9('0x98'))){_0x13b353['push'](new Extension(_0x403558,_0x145d07,'FAXOPT('+_0x4b6d08+')='+_0x403558[_0x4b6d08],_0xf2a9('0x91')));_0x145d07+=0x1;}}_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,'6',_0xf2a9('0x99')));_0x145d07+=0x1;_0x13b353[_0xf2a9('0x8e')](new Extension(_0x403558,_0x145d07,_0xf2a9('0x9a'),'ReceiveFax'));_0x145d07=0x0;return _0x13b353;}exports[_0xf2a9('0x9b')]=function(_0x245d5c,_0x36e8b4,_0x9f0686){var _0x36c4d5;return db['sequelize'][_0xf2a9('0x80')](function(_0x39312c){return db[_0xf2a9('0x40')]['create'](_0x245d5c[_0xf2a9('0x66')],{'transaction':_0x39312c})[_0xf2a9('0x24')](function(_0x20bce8){_0x36c4d5=_0x20bce8[_0xf2a9('0x62')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x36c4d5),{'transaction':_0x39312c});});})[_0xf2a9('0x24')](function(){return _0x36c4d5;})['then'](respondWithResult(_0x36e8b4,null))[_0xf2a9('0x56')](handleError(_0x36e8b4,null));};exports[_0xf2a9('0x9c')]=function(_0x4ee5ca,_0x15a5ac,_0x4ae347){var _0x2cf81f;return db[_0xf2a9('0x7f')][_0xf2a9('0x80')](function(_0x4053e7){return db[_0xf2a9('0x40')][_0xf2a9('0x38')](_0x4ee5ca['body'],{'where':{'id':_0x4ee5ca['body']['id']},'transaction':_0x4053e7})[_0xf2a9('0x24')](function(_0x222a1e){return db['VoiceExtension'][_0xf2a9('0x39')]({'where':{'FaxAccountId':_0x4ee5ca[_0xf2a9('0x66')]['id']},'transaction':_0x4053e7})[_0xf2a9('0x24')](function(_0x204a66){return db[_0xf2a9('0x9d')][_0xf2a9('0x82')](createExtensionsReciveFax(_[_0xf2a9('0x73')](_0x4ee5ca[_0xf2a9('0x66')],['tech','key',_0xf2a9('0x9e'),_0xf2a9('0x9f'),_0xf2a9('0xa0'),_0xf2a9('0xa1')])),{'transaction':_0x4053e7});});});})[_0xf2a9('0x24')](function(){return db['FaxAccount'][_0xf2a9('0xa2')](_0x4ee5ca[_0xf2a9('0x66')]['id']);})[_0xf2a9('0x24')](respondWithResult(_0x15a5ac,null))[_0xf2a9('0x56')](handleError(_0x15a5ac,null));};exports[_0xf2a9('0xa3')]=function(_0x389a26,_0x43333c,_0x41537a){var _0x150722={'raw':!![],'where':{}};var _0x32da86={};var _0x50ac73={'count':0x0,'rows':[]};return db[_0xf2a9('0x40')][_0xf2a9('0x6a')]({'where':{'id':_0x389a26['params']['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x43333c,null))[_0xf2a9('0x24')](function(_0x1142f3){if(_0x1142f3){_0x32da86[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db['FaxMessage'][_0xf2a9('0x70')]);_0x32da86[_0xf2a9('0x44')]=_['keys'](_0x389a26[_0xf2a9('0x44')]);_0x32da86[_0xf2a9('0x45')]=_[_0xf2a9('0x5b')](_0x32da86[_0xf2a9('0x43')],_0x32da86[_0xf2a9('0x44')]);_0x150722[_0xf2a9('0x46')]=_['intersection'](_0x32da86[_0xf2a9('0x43')],qs['fields'](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x47')]));_0x150722[_0xf2a9('0x46')]=_0x150722['attributes']['length']?_0x150722[_0xf2a9('0x46')]:_0x32da86[_0xf2a9('0x43')];if(!_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x48')]('nolimit')){_0x150722[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x34')]);_0x150722[_0xf2a9('0x33')]=qs[_0xf2a9('0x33')](_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x33')]);}_0x150722[_0xf2a9('0x4a')]=qs['sort'](_0x389a26[_0xf2a9('0x44')]['sort']);_0x150722[_0xf2a9('0x4e')]=qs[_0xf2a9('0x45')](_[_0xf2a9('0x4c')](_0x389a26['query'],_0x32da86[_0xf2a9('0x45')]));_0x150722[_0xf2a9('0x4e')][_0xf2a9('0x68')]=_0x1142f3['id'];if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x150722[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x150722['where'],{'$or':_[_0xf2a9('0x3f')](_0x150722[_0xf2a9('0x46')],function(_0x1faccd){var _0x2365cf={};_0x2365cf[_0x1faccd]={'$like':'%'+_0x389a26[_0xf2a9('0x44')]['filter']+'%'};return _0x2365cf;})});}if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0xa4')]){var _0x312a02=_0x389a26[_0xf2a9('0x44')]['$gte'][_0xf2a9('0xa5')](',');var _0x4b37f4={};_0x4b37f4[_0x312a02[0x0]]={'$gte':moment(_0x312a02[0x1])[_0xf2a9('0xa6')](_0xf2a9('0xa7'))};_0x150722[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x150722[_0xf2a9('0x4e')],_0x4b37f4);}_0x150722=_[_0xf2a9('0x50')]({},_0x150722,_0x389a26[_0xf2a9('0x51')]);return db[_0xf2a9('0xa8')]['count']({'where':_0x150722[_0xf2a9('0x4e')]})[_0xf2a9('0x24')](function(_0x40c047){_0x50ac73[_0xf2a9('0x52')]=_0x40c047;if(_0x389a26[_0xf2a9('0x44')][_0xf2a9('0x5d')]){_0x150722[_0xf2a9('0x53')]=[{'all':!![]}];}return db['FaxMessage'][_0xf2a9('0x54')](_0x150722);})[_0xf2a9('0x24')](function(_0x7ac5b0){_0x50ac73[_0xf2a9('0x55')]=_0x7ac5b0;return _0x50ac73;});}})['then'](respondWithFilteredResult(_0x43333c,_0x150722))['catch'](handleError(_0x43333c,null));};exports[_0xf2a9('0xa9')]=function(_0x55a669,_0x232347,_0x4abfff){var _0x13a289,_0x36528b={},_0x506304;if(_0x55a669[_0xf2a9('0x66')]['to']){_0x506304=_0x55a669[_0xf2a9('0x66')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x55a669[_0xf2a9('0x58')]['id']},'include':[{'model':db[_0xf2a9('0xaa')],'as':'List','include':[{'model':db[_0xf2a9('0x76')],'as':_0xf2a9('0xab'),'where':{'fax':_0x506304},'limit':0x1,'order':[[_0xf2a9('0x9f'),_0xf2a9('0xac')]]}]}]})[_0xf2a9('0x24')](handleEntityNotFound(_0x232347,null))[_0xf2a9('0x24')](function(_0x307f70){_0x13a289=_0x307f70;if(_0x55a669['body'][_0xf2a9('0xad')]&&_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')]['length']){for(var _0x5be22c=0x0;_0x5be22c<_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0xf2a9('0x5c')];_0x5be22c+=0x1){_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0x5be22c]={'filename':_0x55a669['body'][_0xf2a9('0xad')][_0x5be22c][_0xf2a9('0x3c')],'id':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][_0x5be22c]['id'],'path':path['join'](config[_0xf2a9('0xae')],_0xf2a9('0xaf'),_0x55a669['body'][_0xf2a9('0xad')][_0x5be22c][_0xf2a9('0xb0')])};}}return respondWithRpcPromise(_0xf2a9('0xb1'),_0xf2a9('0xb1'),{'FaxAccountId':_['isNil'](_0x55a669[_0xf2a9('0x58')]['id'])?undefined:_0x55a669['params']['id'],'path':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')])?undefined:_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')],'fax':_[_0xf2a9('0xb2')](_0x55a669['body']['to'][0x0])?undefined:_0x55a669[_0xf2a9('0x66')]['to'][0x0]},client9002);})[_0xf2a9('0x24')](function(){if(_0x13a289){if(_[_0xf2a9('0xb2')](_0x55a669['body']['from'])){_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xb3')]=util[_0xf2a9('0xa6')](_0xf2a9('0xb4'),_0x13a289[_0xf2a9('0x3c')],_0x13a289[_0xf2a9('0xb5')]);}if(_0x13a289[_0xf2a9('0xb6')]){if(_0x13a289[_0xf2a9('0xb6')][_0xf2a9('0xab')][_0xf2a9('0x5c')]){return _0x13a289[_0xf2a9('0xb6')][_0xf2a9('0xab')][0x0];}else{return db[_0xf2a9('0x76')][_0xf2a9('0x5f')](_[_0xf2a9('0xb7')](_0x55a669['body'],{'firstName':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'phone':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'fax':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'ListId':_0x13a289['ListId']}));}}else{throw new Error(_0xf2a9('0xb8'));}}else{throw new Error(_0xf2a9('0xb9'));}})[_0xf2a9('0x24')](function(_0x1d83df){if(_0x1d83df){return db['FaxInteraction']['find']({'where':{'ContactId':_0x1d83df['id'],'closed':![],'FaxAccountId':_0x13a289['id']}})[_0xf2a9('0x24')](function(_0x11dc8f){if(_0x11dc8f){return[_0x11dc8f,![]];}return db[_0xf2a9('0x75')][_0xf2a9('0x5f')]({'UserId':_0x55a669[_0xf2a9('0x60')]['id'],'ContactId':_0x1d83df['id'],'FaxAccountId':_0x13a289['id'],'fax':_0x55a669[_0xf2a9('0x66')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xf2a9('0x50')](_0x55a669['body'],{'read':![],'body':_0x55a669['body']['attachments'][0x0][_0xf2a9('0xba')],'FaxAccountId':_0x13a289['id'],'UserId':_0x55a669[_0xf2a9('0x60')]['id'],'ContactId':_0x1d83df['id'],'AttachmentId':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xf2a9('0xa8')],'as':_0xf2a9('0xbb')}]})[_0xf2a9('0x24')](function(_0x49dc87){return[_0x49dc87,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf2a9('0xbc')](function(_0x5569dc,_0x1b02f1){if(_0x1b02f1){return _0x5569dc;}return db['FaxMessage'][_0xf2a9('0x5f')]({'direction':_0xf2a9('0xbd'),'read':![],'body':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0][_0xf2a9('0xba')],'FaxAccountId':_0x13a289['id'],'FaxInteractionId':_0x5569dc['id'],'UserId':_0x55a669['user']['id'],'ContactId':_0x5569dc[_0xf2a9('0xbe')],'AttachmentId':_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['id']})[_0xf2a9('0x24')](function(_0x51fbc4){_0x5569dc[_0xf2a9('0xbf')][_0xf2a9('0xbb')]=[];_0x5569dc['dataValues'][_0xf2a9('0xbb')][_0xf2a9('0x8e')](_0x51fbc4[_0xf2a9('0xbf')]);return _0x5569dc;});})[_0xf2a9('0x24')](function(_0x2f0fec){respondWithRpcPromise(_0xf2a9('0xc0'),_0xf2a9('0xc0'),{'FaxAccountId':_[_0xf2a9('0xb2')](_0x55a669['params']['id'])?undefined:_0x55a669['params']['id'],'path':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')][_0xf2a9('0xad')][0x0]['path'])?undefined:_0x55a669['body'][_0xf2a9('0xad')][0x0][_0xf2a9('0x8')],'fax':_[_0xf2a9('0xb2')](_0x55a669[_0xf2a9('0x66')]['to'][0x0])?undefined:_0x55a669['body']['to'][0x0],'AttachmentId':_0x55a669[_0xf2a9('0x66')]['attachments'][0x0]['id']},client9002)[_0xf2a9('0x24')](function(_0x2a2738){logger[_0xf2a9('0x25')](_0xf2a9('0xc1'),_0x2a2738);})[_0xf2a9('0x56')](function(_0x486156){logger[_0xf2a9('0x25')]('SendFaxRpc,\x20%s',_0x486156);});return _0x2f0fec;})[_0xf2a9('0x24')](respondWithResult(_0x232347,null))[_0xf2a9('0x56')](handleError(_0x232347,null));};exports[_0xf2a9('0xc2')]=function(_0x128fe5,_0x302a9c,_0x2e51d7){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x128fe5[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x302a9c,null))[_0xf2a9('0x24')](function(_0x18e14a){if(_0x18e14a){return _0x18e14a[_0xf2a9('0xc2')](_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')],_['omit'](_0x128fe5[_0xf2a9('0x66')],['ids','id'])||{})[_0xf2a9('0xbc')](function(_0xcaf195){for(var _0x36efe7=0x0;_0x36efe7<_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')][_0xf2a9('0x5c')];_0x36efe7+=0x1){socket[_0xf2a9('0xc3')](_0xf2a9('0xc4'),{'UserId':_0x128fe5[_0xf2a9('0x66')][_0xf2a9('0x6c')][_0x36efe7],'FaxAccountId':_0x128fe5['params']['id']});}return _0xcaf195;});}})[_0xf2a9('0x24')](respondWithResult(_0x302a9c,null))[_0xf2a9('0x56')](handleError(_0x302a9c,null));};exports['removeAgents']=function(_0x9388f7,_0x53e872,_0x2a0759){return db[_0xf2a9('0x40')][_0xf2a9('0x5e')]({'where':{'id':_0x9388f7[_0xf2a9('0x58')]['id']}})[_0xf2a9('0x24')](handleEntityNotFound(_0x53e872,null))[_0xf2a9('0x24')](function(_0x19b9f5){if(_0x19b9f5){return _0x19b9f5[_0xf2a9('0xc5')](_0x9388f7['query'][_0xf2a9('0x6c')])[_0xf2a9('0x24')](function(){if(_['isArray'](_0x9388f7['query'][_0xf2a9('0x6c')])){for(var _0xb4b695=0x0;_0xb4b695<_0x9388f7[_0xf2a9('0x44')][_0xf2a9('0x6c')][_0xf2a9('0x5c')];_0xb4b695+=0x1){socket[_0xf2a9('0xc3')](_0xf2a9('0xc6'),{'UserId':Number(_0x9388f7['query'][_0xf2a9('0x6c')][_0xb4b695]),'FaxAccountId':Number(_0x9388f7[_0xf2a9('0x58')]['id'])});}}else{socket[_0xf2a9('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x9388f7[_0xf2a9('0x44')]['ids']),'FaxAccountId':Number(_0x9388f7[_0xf2a9('0x58')]['id'])});}});}})[_0xf2a9('0x24')](respondWithStatusCode(_0x53e872,null))[_0xf2a9('0x56')](handleError(_0x53e872,null));};exports['getAgents']=function(_0x24c8a7,_0x20db89,_0x3c851c){var _0x5a1311={};var _0x5ba011={};var _0x29a8a8;var _0x1869cd;return db['FaxAccount'][_0xf2a9('0x6a')]({'where':{'id':_0x24c8a7[_0xf2a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x20db89,null))[_0xf2a9('0x24')](function(_0x210dba){if(_0x210dba){_0x29a8a8=_0x210dba;_0x5ba011[_0xf2a9('0x43')]=_[_0xf2a9('0x5a')](db[_0xf2a9('0x78')][_0xf2a9('0x70')]);_0x5ba011[_0xf2a9('0x44')]=_['keys'](_0x24c8a7[_0xf2a9('0x44')]);_0x5ba011['filters']=_[_0xf2a9('0x5b')](_0x5ba011[_0xf2a9('0x43')],_0x5ba011['query']);_0x5a1311[_0xf2a9('0x46')]=_['intersection'](_0x5ba011[_0xf2a9('0x43')],qs[_0xf2a9('0x47')](_0x24c8a7['query']['fields']));_0x5a1311[_0xf2a9('0x46')]=_0x5a1311[_0xf2a9('0x46')]['length']?_0x5a1311[_0xf2a9('0x46')]:_0x5ba011[_0xf2a9('0x43')];_0x5a1311['order']=qs[_0xf2a9('0x4b')](_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4b')]);_0x5a1311['where']=qs['filters'](_[_0xf2a9('0x4c')](_0x24c8a7[_0xf2a9('0x44')],_0x5ba011[_0xf2a9('0x45')]));if(_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4d')]){_0x5a1311[_0xf2a9('0x4e')]=_[_0xf2a9('0x50')](_0x5a1311['where'],{'$or':_[_0xf2a9('0x3f')](_0x5a1311[_0xf2a9('0x46')],function(_0x27c3e1){var _0x20df0d={};_0x20df0d[_0x27c3e1]={'$like':'%'+_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x4d')]+'%'};return _0x20df0d;})});}_0x5a1311=_['merge']({},_0x5a1311,_0x24c8a7[_0xf2a9('0x51')]);return _0x29a8a8[_0xf2a9('0xc7')](_0x5a1311);}})[_0xf2a9('0x24')](function(_0xc44256){if(_0xc44256){_0x1869cd=_0xc44256[_0xf2a9('0x5c')];if(!_0x24c8a7[_0xf2a9('0x44')][_0xf2a9('0x48')](_0xf2a9('0x49'))){_0x5a1311[_0xf2a9('0x34')]=qs[_0xf2a9('0x34')](_0x24c8a7['query'][_0xf2a9('0x34')]);_0x5a1311[_0xf2a9('0x33')]=qs['offset'](_0x24c8a7['query']['offset']);}return _0x29a8a8[_0xf2a9('0xc7')](_0x5a1311);}})[_0xf2a9('0x24')](function(_0x5d62fe){if(_0x5d62fe){return _0x5d62fe?{'count':_0x1869cd,'rows':_0x5d62fe}:null;}})[_0xf2a9('0x24')](respondWithResult(_0x20db89,null))['catch'](handleError(_0x20db89,null));}; \ No newline at end of file +var _0xe8f8=['stack','send','FaxAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','show','params','Pause','mandatoryDispositionPause','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','Disposition','findOne','nolimit','FaxAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','FaxInteraction','rawAttributes','CmContact','Contact','Owner','fullname','internal','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','priority','getApplications','from-voip-provider','exten','localstationid','app','description','appdata','push','Answer','ecm','faxdetect','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','isArray','emit','userFaxAccount:remove','getAgents','User','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./faxAccount.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource'];(function(_0x310448,_0x59f6bd){var _0xc0124b=function(_0x311d94){while(--_0x311d94){_0x310448['push'](_0x310448['shift']());}};_0xc0124b(++_0x59f6bd);}(_0xe8f8,0x141));var _0x8e8f=function(_0x484ac5,_0x37d907){_0x484ac5=_0x484ac5-0x0;var _0x4766b7=_0xe8f8[_0x484ac5];return _0x4766b7;};'use strict';var pdf=require(_0x8e8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8e8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e8f('0x2'));var rp=require(_0x8e8f('0x3'));var moment=require(_0x8e8f('0x4'));var BPromise=require(_0x8e8f('0x5'));var Mustache=require(_0x8e8f('0x6'));var util=require(_0x8e8f('0x7'));var path=require(_0x8e8f('0x8'));var sox=require('sox');var csv=require(_0x8e8f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8e8f('0xa'));var squel=require(_0x8e8f('0xb'));var crypto=require(_0x8e8f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e8f('0x9'));var querystring=require('querystring');var Papa=require(_0x8e8f('0xd'));var Redis=require(_0x8e8f('0xe'));var authService=require(_0x8e8f('0xf'));var qs=require(_0x8e8f('0x10'));var as=require(_0x8e8f('0x11'));var hardwareService=require(_0x8e8f('0x12'));var logger=require(_0x8e8f('0x13'))(_0x8e8f('0x14'));var utils=require(_0x8e8f('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8e8f('0x16')]=_[_0x8e8f('0x17')](config[_0x8e8f('0x16')],{'host':_0x8e8f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e8f('0x16')]));require(_0x8e8f('0x19'))[_0x8e8f('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8e8f('0x1b')][_0x8e8f('0x1c')]({'port':0x232c});var client9002=jayson[_0x8e8f('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1cb36c,_0xfe005c,_0x24cb1f){if(_0x24cb1f){var _0x54df43=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54df43[_0x8e8f('0x1d')](_0xfe005c)){return _0x1cb36c;}else{throw new db[(_0x8e8f('0x1e'))][(_0x8e8f('0x1f'))](_0x8e8f('0x20'));}}else{return _0x1cb36c;}}function respondWithRpcPromise(_0x49f0a1,_0x4b9563,_0x13e53f,_0x2e659c){return new BPromise(function(_0x3b509a,_0x1891b8){var _0x4aa95e=_0x2e659c||client;return _0x4aa95e[_0x8e8f('0x21')](_0x49f0a1,_0x13e53f)[_0x8e8f('0x22')](function(_0x81caec){logger[_0x8e8f('0x23')](_0x8e8f('0x24'),_0x4b9563,_0x8e8f('0x25'));logger['debug'](_0x8e8f('0x26'),_0x4b9563,_0x8e8f('0x25'),JSON[_0x8e8f('0x27')](_0x81caec));if(_0x81caec[_0x8e8f('0x28')]){if(_0x81caec[_0x8e8f('0x28')][_0x8e8f('0x29')]===0x1f4){logger[_0x8e8f('0x28')](_0x8e8f('0x24'),_0x4b9563,_0x81caec[_0x8e8f('0x28')][_0x8e8f('0x2a')]);return _0x1891b8(_0x81caec[_0x8e8f('0x28')]['message']);}logger['error'](_0x8e8f('0x24'),_0x4b9563,_0x81caec[_0x8e8f('0x28')]['message']);return _0x3b509a(_0x81caec[_0x8e8f('0x28')][_0x8e8f('0x2a')]);}else{logger[_0x8e8f('0x23')](_0x8e8f('0x24'),_0x4b9563,_0x8e8f('0x25'));_0x3b509a(_0x81caec[_0x8e8f('0x2b')][_0x8e8f('0x2a')]);}})['catch'](function(_0x42dfd4){logger[_0x8e8f('0x28')](_0x8e8f('0x24'),_0x4b9563,_0x42dfd4);_0x1891b8(_0x42dfd4);});});}function respondWithStatusCode(_0x5298d1,_0x185673){_0x185673=_0x185673||0xcc;return function(_0x1e0011){if(_0x1e0011){return _0x5298d1[_0x8e8f('0x2c')](_0x185673);}return _0x5298d1[_0x8e8f('0x2d')](_0x185673)[_0x8e8f('0x2e')]();};}function respondWithResult(_0x153160,_0x70221){_0x70221=_0x70221||0xc8;return function(_0x353eab){if(_0x353eab){return _0x153160[_0x8e8f('0x2d')](_0x70221)['json'](_0x353eab);}};}function respondWithFilteredResult(_0x131e09,_0x25233c){return function(_0x56d98d){if(_0x56d98d){var _0x3d1ad1=_0x56d98d[_0x8e8f('0x2f')],_0x497a01=_0x25233c['offset'],_0x301dcf=_0x25233c['offset']+_0x25233c[_0x8e8f('0x30')],_0x5b8914;if(_0x301dcf>=_0x3d1ad1){_0x301dcf=_0x3d1ad1;_0x5b8914=0xc8;}else{_0x5b8914=0xce;}_0x131e09[_0x8e8f('0x2d')](_0x5b8914);return _0x131e09[_0x8e8f('0x31')](_0x8e8f('0x32'),_0x497a01+'-'+_0x301dcf+'/'+_0x3d1ad1)[_0x8e8f('0x33')](_0x56d98d);}return null;};}function patchUpdates(_0x165800){return function(_0x246980){try{jsonpatch[_0x8e8f('0x34')](_0x246980,_0x165800,!![]);}catch(_0x581ce4){return BPromise[_0x8e8f('0x35')](_0x581ce4);}return _0x246980[_0x8e8f('0x36')]();};}function saveUpdates(_0x269fef,_0x29112f){return function(_0x3cc8a1){if(_0x3cc8a1){return _0x3cc8a1[_0x8e8f('0x37')](_0x269fef)[_0x8e8f('0x22')](function(_0x4ae69c){return _0x4ae69c;});}return null;};}function removeEntity(_0x209adb,_0x252749){return function(_0xd9c397){if(_0xd9c397){return _0xd9c397[_0x8e8f('0x38')]()['then'](function(){var _0x5cfa60=_0xd9c397['get']({'plain':!![]});var _0x27b394=_0x8e8f('0x39');return db[_0x8e8f('0x3a')][_0x8e8f('0x38')]({'where':{'type':_0x27b394,'resourceId':_0x5cfa60['id']}})['then'](function(){return _0xd9c397;});})['then'](function(){_0x209adb['status'](0xcc)[_0x8e8f('0x2e')]();});}};}function handleEntityNotFound(_0x916a96,_0x5abc48){return function(_0x4d34f3){if(!_0x4d34f3){_0x916a96['sendStatus'](0x194);}return _0x4d34f3;};}function handleError(_0x9747a5,_0x199dd6){_0x199dd6=_0x199dd6||0x1f4;return function(_0x5e5b6a){logger[_0x8e8f('0x28')](_0x5e5b6a[_0x8e8f('0x3b')]);if(_0x5e5b6a['name']){delete _0x5e5b6a['name'];}_0x9747a5['status'](_0x199dd6)[_0x8e8f('0x3c')](_0x5e5b6a);};}exports['index']=function(_0x29964b,_0x3f0dea){var _0x5d51de={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x33ee4a={},_0x5b1198={'count':0x0,'rows':[]};var _0x5cf0d3=_['map'](db[_0x8e8f('0x3d')]['rawAttributes'],function(_0x41e93b){return{'name':_0x41e93b[_0x8e8f('0x3e')],'type':_0x41e93b[_0x8e8f('0x3f')][_0x8e8f('0x40')]};});_0x33ee4a[_0x8e8f('0x41')]=_[_0x8e8f('0x42')](_0x5cf0d3,'name');_0x33ee4a[_0x8e8f('0x43')]=_['keys'](_0x29964b[_0x8e8f('0x43')]);_0x33ee4a[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x33ee4a['model'],_0x33ee4a['query']);_0x5d51de[_0x8e8f('0x46')]=_['intersection'](_0x33ee4a['model'],qs['fields'](_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x47')]));_0x5d51de['attributes']=_0x5d51de[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x5d51de[_0x8e8f('0x46')]:_0x33ee4a[_0x8e8f('0x41')];if(!_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x49')]('nolimit')){_0x5d51de[_0x8e8f('0x30')]=qs['limit'](_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x30')]);_0x5d51de[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x29964b[_0x8e8f('0x43')]['offset']);}_0x5d51de[_0x8e8f('0x4b')]=qs[_0x8e8f('0x4c')](_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x4c')]);_0x5d51de['where']=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x29964b[_0x8e8f('0x43')],_0x33ee4a['filters']),_0x5cf0d3);if(_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x5d51de[_0x8e8f('0x4f')]=_[_0x8e8f('0x50')](_0x5d51de['where'],{'$or':_[_0x8e8f('0x42')](_0x5cf0d3,function(_0x51053f){if(_0x51053f['type']!==_0x8e8f('0x51')){var _0xacbe3f={};_0xacbe3f[_0x51053f[_0x8e8f('0x52')]]={'$like':'%'+_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0xacbe3f;}})});}_0x5d51de=_[_0x8e8f('0x50')]({},_0x5d51de,_0x29964b[_0x8e8f('0x53')]);var _0x1c51a6={'where':_0x5d51de[_0x8e8f('0x4f')]};return db[_0x8e8f('0x3d')]['count'](_0x1c51a6)['then'](function(_0x268b7a){_0x5b1198['count']=_0x268b7a;if(_0x29964b[_0x8e8f('0x43')][_0x8e8f('0x54')]){_0x5d51de[_0x8e8f('0x55')]=[{'all':!![]}];}return db['FaxAccount'][_0x8e8f('0x56')](_0x5d51de);})[_0x8e8f('0x22')](function(_0x15f007){_0x5b1198['rows']=_0x15f007;return _0x5b1198;})[_0x8e8f('0x22')](respondWithFilteredResult(_0x3f0dea,_0x5d51de))[_0x8e8f('0x57')](handleError(_0x3f0dea,null));};exports[_0x8e8f('0x58')]=function(_0x48404d,_0x45fe10){var _0x1d5c91={'raw':![],'where':{'id':_0x48404d[_0x8e8f('0x59')]['id']},'include':[{'model':db[_0x8e8f('0x5a')],'as':_0x8e8f('0x5b')}]},_0x1d6e95={};_0x1d6e95[_0x8e8f('0x41')]=_[_0x8e8f('0x5c')](db[_0x8e8f('0x3d')]['rawAttributes']);_0x1d6e95['query']=_[_0x8e8f('0x5c')](_0x48404d[_0x8e8f('0x43')]);_0x1d6e95[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x1d6e95[_0x8e8f('0x41')],_0x1d6e95[_0x8e8f('0x43')]);_0x1d5c91['attributes']=_[_0x8e8f('0x45')](_0x1d6e95[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x48404d[_0x8e8f('0x43')]['fields']));_0x1d5c91['attributes']=_0x1d5c91[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x1d5c91['attributes']:_0x1d6e95[_0x8e8f('0x41')];if(_0x48404d[_0x8e8f('0x43')][_0x8e8f('0x54')]){_0x1d5c91[_0x8e8f('0x55')]=[{'all':!![]}];}_0x1d5c91=_['merge']({},_0x1d5c91,_0x48404d['options']);return db[_0x8e8f('0x3d')]['find'](_0x1d5c91)[_0x8e8f('0x22')](handleEntityNotFound(_0x45fe10,null))['then'](respondWithResult(_0x45fe10,null))[_0x8e8f('0x57')](handleError(_0x45fe10,null));};exports['create']=function(_0x5dddf4,_0x316a23){return db['FaxAccount'][_0x8e8f('0x5d')](_0x5dddf4[_0x8e8f('0x5e')],{})[_0x8e8f('0x22')](function(_0x135059){var _0x3fd9a6=_0x5dddf4[_0x8e8f('0x5f')][_0x8e8f('0x60')]({'plain':!![]});if(!_0x3fd9a6)throw new Error(_0x8e8f('0x61'));if(_0x3fd9a6[_0x8e8f('0x62')]==='user'){var _0x5404e7=_0x135059['get']({'plain':!![]});var _0x3ccdf7=_0x8e8f('0x39');return db[_0x8e8f('0x63')][_0x8e8f('0x64')]({'where':{'name':_0x3ccdf7,'userProfileId':_0x3fd9a6[_0x8e8f('0x65')]},'raw':!![]})[_0x8e8f('0x22')](function(_0x2b324e){if(_0x2b324e&&_0x2b324e[_0x8e8f('0x66')]===0x0){return db[_0x8e8f('0x3a')][_0x8e8f('0x5d')]({'name':_0x5404e7['name'],'resourceId':_0x5404e7['id'],'type':_0x2b324e[_0x8e8f('0x52')],'sectionId':_0x2b324e['id']},{})['then'](function(){return _0x135059;});}else{return _0x135059;}})[_0x8e8f('0x57')](function(_0x19cccf){logger[_0x8e8f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19cccf);throw _0x19cccf;});}return _0x135059;})['then'](respondWithResult(_0x316a23,0xc9))['catch'](handleError(_0x316a23,null));};exports[_0x8e8f('0x37')]=function(_0x2ba48c,_0x545b4f){if(_0x2ba48c[_0x8e8f('0x5e')]['id']){delete _0x2ba48c[_0x8e8f('0x5e')]['id'];}return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x2ba48c[_0x8e8f('0x59')]['id']},'include':[{'model':db[_0x8e8f('0x5a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x545b4f,null))[_0x8e8f('0x22')](saveUpdates(_0x2ba48c[_0x8e8f('0x5e')],null))[_0x8e8f('0x22')](respondWithResult(_0x545b4f,null))['catch'](handleError(_0x545b4f,null));};exports['destroy']=function(_0x88e22,_0x4bd489){return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x88e22['params']['id']}})['then'](handleEntityNotFound(_0x4bd489,null))[_0x8e8f('0x22')](removeEntity(_0x4bd489,null))['catch'](handleError(_0x4bd489,null));};exports[_0x8e8f('0x67')]=function(_0x2e04a7,_0x5c3351){return db[_0x8e8f('0x3d')][_0x8e8f('0x67')]()['then'](respondWithResult(_0x5c3351,null))[_0x8e8f('0x57')](handleError(_0x5c3351,null));};exports['addDisposition']=function(_0x7093e,_0x4a1c6d,_0x21b0c6){if(_0x7093e['body']['id']){delete _0x7093e[_0x8e8f('0x5e')]['id'];}return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x7093e[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x4a1c6d,null))['then'](function(_0x5b01b3){if(_0x5b01b3){_0x7093e[_0x8e8f('0x5e')]['FaxAccountId']=_0x5b01b3['id'];return db[_0x8e8f('0x68')][_0x8e8f('0x5d')](_0x7093e[_0x8e8f('0x5e')]);}})[_0x8e8f('0x22')](respondWithResult(_0x4a1c6d,null))[_0x8e8f('0x57')](handleError(_0x4a1c6d,null));};exports['getDispositions']=function(_0x1359fb,_0x2967fc,_0x4283d6){var _0x40c83f={'raw':![],'where':{}};var _0x293cc5={};var _0x2d10a9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8e8f('0x69')]({'where':{'id':_0x1359fb[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x2967fc,null))[_0x8e8f('0x22')](function(_0x40ec86){if(_0x40ec86){_0x293cc5[_0x8e8f('0x41')]=_[_0x8e8f('0x5c')](db[_0x8e8f('0x68')]['rawAttributes']);_0x293cc5[_0x8e8f('0x43')]=_['keys'](_0x1359fb[_0x8e8f('0x43')]);_0x293cc5[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x293cc5[_0x8e8f('0x41')],_0x293cc5[_0x8e8f('0x43')]);_0x40c83f['attributes']=_['intersection'](_0x293cc5['model'],qs[_0x8e8f('0x47')](_0x1359fb[_0x8e8f('0x43')]['fields']));_0x40c83f[_0x8e8f('0x46')]=_0x40c83f[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x40c83f[_0x8e8f('0x46')]:_0x293cc5[_0x8e8f('0x41')];if(!_0x1359fb['query'][_0x8e8f('0x49')](_0x8e8f('0x6a'))){_0x40c83f['limit']=qs[_0x8e8f('0x30')](_0x1359fb[_0x8e8f('0x43')]['limit']);_0x40c83f[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x1359fb['query'][_0x8e8f('0x4a')]);}_0x40c83f[_0x8e8f('0x4b')]=qs['sort'](_0x1359fb['query']['sort']);_0x40c83f[_0x8e8f('0x4f')]=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x1359fb[_0x8e8f('0x43')],_0x293cc5[_0x8e8f('0x44')]));_0x40c83f[_0x8e8f('0x4f')][_0x8e8f('0x6b')]=_0x40ec86['id'];if(_0x1359fb['query'][_0x8e8f('0x4e')]){_0x40c83f[_0x8e8f('0x4f')]=_[_0x8e8f('0x50')](_0x40c83f[_0x8e8f('0x4f')],{'$or':_[_0x8e8f('0x42')](_0x40c83f[_0x8e8f('0x46')],function(_0x4ed174){var _0x54ef12={};_0x54ef12[_0x4ed174]={'$like':'%'+_0x1359fb[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0x54ef12;})});}_0x40c83f=_['merge']({},_0x40c83f,_0x1359fb[_0x8e8f('0x53')]);return db[_0x8e8f('0x68')][_0x8e8f('0x2f')]({'where':_0x40c83f['where']})[_0x8e8f('0x22')](function(_0x1070c1){_0x2d10a9[_0x8e8f('0x2f')]=_0x1070c1;if(_0x1359fb[_0x8e8f('0x43')][_0x8e8f('0x54')]){_0x40c83f[_0x8e8f('0x55')]=[{'all':!![]}];}return db[_0x8e8f('0x68')][_0x8e8f('0x56')](_0x40c83f);})[_0x8e8f('0x22')](function(_0x215568){_0x2d10a9[_0x8e8f('0x6c')]=_0x215568;return _0x2d10a9;});}})[_0x8e8f('0x22')](respondWithFilteredResult(_0x2967fc,_0x40c83f))['catch'](handleError(_0x2967fc,null));};exports[_0x8e8f('0x6d')]=function(_0x3e92e0,_0x4a3e02,_0x5320fa){return db['FaxAccount']['find']({'where':{'id':_0x3e92e0['params']['id']}})['then'](handleEntityNotFound(_0x4a3e02,null))[_0x8e8f('0x22')](function(_0x4aeeb8){if(_0x4aeeb8){return _0x4aeeb8[_0x8e8f('0x6d')](_0x3e92e0[_0x8e8f('0x43')][_0x8e8f('0x6e')]);}})[_0x8e8f('0x22')](respondWithStatusCode(_0x4a3e02,null))[_0x8e8f('0x57')](handleError(_0x4a3e02,null));};exports[_0x8e8f('0x6f')]=function(_0xff28c4,_0x50b192,_0x35a4b1){if(_0xff28c4[_0x8e8f('0x5e')]['id']){delete _0xff28c4[_0x8e8f('0x5e')]['id'];}return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0xff28c4['params']['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x50b192,null))[_0x8e8f('0x22')](function(_0x4197b0){if(_0x4197b0){_0xff28c4[_0x8e8f('0x5e')][_0x8e8f('0x6b')]=_0x4197b0['id'];return db[_0x8e8f('0x70')]['create'](_0xff28c4[_0x8e8f('0x5e')]);}})[_0x8e8f('0x22')](respondWithResult(_0x50b192,null))['catch'](handleError(_0x50b192,null));};exports[_0x8e8f('0x71')]=function(_0x106bd9,_0x29427f,_0xa651e7){var _0x40b529={'raw':![],'where':{}};var _0xd7f8c4={};var _0x4092b5={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8e8f('0x69')]({'where':{'id':_0x106bd9['params']['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x29427f,null))[_0x8e8f('0x22')](function(_0x1bc495){if(_0x1bc495){_0xd7f8c4['model']=_[_0x8e8f('0x5c')](db[_0x8e8f('0x70')]['rawAttributes']);_0xd7f8c4[_0x8e8f('0x43')]=_[_0x8e8f('0x5c')](_0x106bd9[_0x8e8f('0x43')]);_0xd7f8c4['filters']=_['intersection'](_0xd7f8c4[_0x8e8f('0x41')],_0xd7f8c4[_0x8e8f('0x43')]);_0x40b529[_0x8e8f('0x46')]=_[_0x8e8f('0x45')](_0xd7f8c4[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x106bd9[_0x8e8f('0x43')]['fields']));_0x40b529[_0x8e8f('0x46')]=_0x40b529[_0x8e8f('0x46')]['length']?_0x40b529[_0x8e8f('0x46')]:_0xd7f8c4[_0x8e8f('0x41')];if(!_0x106bd9[_0x8e8f('0x43')]['hasOwnProperty'](_0x8e8f('0x6a'))){_0x40b529[_0x8e8f('0x30')]=qs[_0x8e8f('0x30')](_0x106bd9[_0x8e8f('0x43')][_0x8e8f('0x30')]);_0x40b529[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x106bd9[_0x8e8f('0x43')][_0x8e8f('0x4a')]);}_0x40b529[_0x8e8f('0x4b')]=qs['sort'](_0x106bd9[_0x8e8f('0x43')][_0x8e8f('0x4c')]);_0x40b529[_0x8e8f('0x4f')]=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x106bd9[_0x8e8f('0x43')],_0xd7f8c4['filters']));_0x40b529[_0x8e8f('0x4f')]['FaxAccountId']=_0x1bc495['id'];if(_0x106bd9[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x40b529[_0x8e8f('0x4f')]=_['merge'](_0x40b529[_0x8e8f('0x4f')],{'$or':_[_0x8e8f('0x42')](_0x40b529['attributes'],function(_0x887757){var _0x17696b={};_0x17696b[_0x887757]={'$like':'%'+_0x106bd9[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0x17696b;})});}_0x40b529=_['merge']({},_0x40b529,_0x106bd9[_0x8e8f('0x53')]);return db[_0x8e8f('0x70')][_0x8e8f('0x2f')]({'where':_0x40b529[_0x8e8f('0x4f')]})['then'](function(_0xd3824d){_0x4092b5['count']=_0xd3824d;if(_0x106bd9[_0x8e8f('0x43')]['includeAll']){_0x40b529[_0x8e8f('0x55')]=[{'all':!![]}];}return db[_0x8e8f('0x70')][_0x8e8f('0x56')](_0x40b529);})[_0x8e8f('0x22')](function(_0x817ada){_0x4092b5[_0x8e8f('0x6c')]=_0x817ada;return _0x4092b5;});}})[_0x8e8f('0x22')](respondWithFilteredResult(_0x29427f,_0x40b529))[_0x8e8f('0x57')](handleError(_0x29427f,null));};exports['removeAnswers']=function(_0x352c32,_0x3f8c35,_0x1c6661){return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x352c32['params']['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x3f8c35,null))['then'](function(_0x38a2a4){if(_0x38a2a4){return _0x38a2a4[_0x8e8f('0x72')](_0x352c32[_0x8e8f('0x43')][_0x8e8f('0x6e')]);}})[_0x8e8f('0x22')](respondWithStatusCode(_0x3f8c35,null))[_0x8e8f('0x57')](handleError(_0x3f8c35,null));};exports[_0x8e8f('0x73')]=function(_0x23cd76,_0x5c3f51,_0x340eac){return db['FaxInteraction'][_0x8e8f('0x64')]({'where':{'id':_0x23cd76['params']['id']}})['then'](handleEntityNotFound(_0x5c3f51,null))['then'](function(_0x353b04){if(_0x353b04){return _0x353b04[_0x8e8f('0x73')](_0x23cd76[_0x8e8f('0x5e')][_0x8e8f('0x6e')],_[_0x8e8f('0x74')](_0x23cd76['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5c3f51,null))[_0x8e8f('0x57')](handleError(_0x5c3f51,null));};exports['getInteractions']=function(_0x2f744e,_0x1bd4d4,_0x4eb7ff){var _0x2f75e1={'raw':![],'where':{}};var _0x5a740a={};var _0x21f9b7={'count':0x0,'rows':[]};return db[_0x8e8f('0x3d')][_0x8e8f('0x69')]({'where':{'id':_0x2f744e[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x1bd4d4,null))[_0x8e8f('0x22')](function(_0x1898be){if(_0x1898be){_0x5a740a[_0x8e8f('0x41')]=_[_0x8e8f('0x5c')](db[_0x8e8f('0x75')][_0x8e8f('0x76')]);_0x5a740a['query']=_[_0x8e8f('0x5c')](_0x2f744e[_0x8e8f('0x43')]);_0x5a740a[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x5a740a[_0x8e8f('0x41')],_0x5a740a[_0x8e8f('0x43')]);_0x2f75e1['attributes']=_[_0x8e8f('0x45')](_0x5a740a[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x47')]));_0x2f75e1[_0x8e8f('0x46')]=_0x2f75e1[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x2f75e1[_0x8e8f('0x46')]:_0x5a740a['model'];if(!_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x49')]('nolimit')){_0x2f75e1[_0x8e8f('0x30')]=qs['limit'](_0x2f744e['query']['limit']);_0x2f75e1[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x4a')]);}_0x2f75e1['order']=qs[_0x8e8f('0x4c')](_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x4c')]);_0x2f75e1['where']=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x2f744e[_0x8e8f('0x43')],_0x5a740a['filters']));_0x2f75e1[_0x8e8f('0x4f')][_0x8e8f('0x6b')]=_0x1898be['id'];if(_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x2f75e1[_0x8e8f('0x4f')]=_['merge'](_0x2f75e1['where'],{'$or':_[_0x8e8f('0x42')](_0x2f75e1[_0x8e8f('0x46')],function(_0x5082e5){var _0x3ae01b={};_0x3ae01b[_0x5082e5]={'$like':'%'+_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0x3ae01b;})});}_0x2f75e1=_['merge']({},_0x2f75e1,_0x2f744e[_0x8e8f('0x53')]);return db['FaxInteraction'][_0x8e8f('0x2f')]({'where':_0x2f75e1[_0x8e8f('0x4f')]})[_0x8e8f('0x22')](function(_0x285c81){_0x21f9b7[_0x8e8f('0x2f')]=_0x285c81;if(_0x2f744e[_0x8e8f('0x43')]['includeAll']){_0x2f75e1[_0x8e8f('0x55')]=[{'model':db[_0x8e8f('0x77')],'as':_0x8e8f('0x78'),'required':![]},{'model':db['User'],'as':_0x8e8f('0x79'),'attributes':[_0x8e8f('0x52'),_0x8e8f('0x7a'),_0x8e8f('0x7b')],'required':![]},{'model':db['Tag'],'as':_0x8e8f('0x7c'),'attributes':['id',_0x8e8f('0x52'),_0x8e8f('0x7d')],'where':_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x7e')]?{'id':_0x2f744e[_0x8e8f('0x43')][_0x8e8f('0x7e')]}:undefined,'required':_0x2f744e['query'][_0x8e8f('0x7e')]?!![]:![]}];}return db[_0x8e8f('0x75')][_0x8e8f('0x56')](_0x2f75e1);})[_0x8e8f('0x22')](function(_0x40c1b6){_0x21f9b7[_0x8e8f('0x6c')]=_0x40c1b6;return _0x21f9b7;});}})['then'](respondWithFilteredResult(_0x1bd4d4,_0x2f75e1))[_0x8e8f('0x57')](handleError(_0x1bd4d4,null));};exports['addApplications']=function(_0x59ae4e,_0x1beb8b,_0x34c765){return db[_0x8e8f('0x3d')][_0x8e8f('0x69')]({'where':{'id':_0x59ae4e['params']['id']}})['then'](handleEntityNotFound(_0x1beb8b,null))['then'](function(_0x262271){if(_0x262271){return db[_0x8e8f('0x7f')][_0x8e8f('0x80')](function(_0x560135){return db['FaxApplication'][_0x8e8f('0x38')]({'where':{'FaxAccountId':_0x59ae4e[_0x8e8f('0x59')]['id']},'transaction':_0x560135})[_0x8e8f('0x22')](function(_0x3507a4){var _0x4735cf=_[_0x8e8f('0x42')](_0x59ae4e['body'],function(_0x2d0fdc){_0x2d0fdc[_0x8e8f('0x6b')]=_0x59ae4e[_0x8e8f('0x59')]['id'];return _0x2d0fdc;});return db[_0x8e8f('0x81')][_0x8e8f('0x82')](_0x4735cf,{'transaction':_0x560135});});})['then'](function(){return db[_0x8e8f('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x59ae4e[_0x8e8f('0x59')]['id']},'order':_0x8e8f('0x83')});});}})[_0x8e8f('0x22')](respondWithResult(_0x1beb8b,null))[_0x8e8f('0x57')](handleError(_0x1beb8b,null));};exports[_0x8e8f('0x84')]=function(_0x492cbc,_0x1ebf2,_0x4b042e){var _0x5bb423={};var _0x583b2f={};var _0x71a275;var _0x3934c1;return db['FaxAccount'][_0x8e8f('0x69')]({'where':{'id':_0x492cbc[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x1ebf2,null))[_0x8e8f('0x22')](function(_0x1914c0){if(_0x1914c0){_0x71a275=_0x1914c0;_0x583b2f[_0x8e8f('0x41')]=_[_0x8e8f('0x5c')](db['FaxApplication'][_0x8e8f('0x76')]);_0x583b2f[_0x8e8f('0x43')]=_[_0x8e8f('0x5c')](_0x492cbc['query']);_0x583b2f[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x583b2f[_0x8e8f('0x41')],_0x583b2f[_0x8e8f('0x43')]);_0x5bb423[_0x8e8f('0x46')]=_['intersection'](_0x583b2f[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x492cbc[_0x8e8f('0x43')][_0x8e8f('0x47')]));_0x5bb423[_0x8e8f('0x46')]=_0x5bb423[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x5bb423[_0x8e8f('0x46')]:_0x583b2f[_0x8e8f('0x41')];_0x5bb423['order']=qs[_0x8e8f('0x4c')](_0x492cbc['query'][_0x8e8f('0x4c')]);_0x5bb423['where']=qs['filters'](_[_0x8e8f('0x4d')](_0x492cbc[_0x8e8f('0x43')],_0x583b2f[_0x8e8f('0x44')]));if(_0x492cbc[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x5bb423[_0x8e8f('0x4f')]=_['merge'](_0x5bb423[_0x8e8f('0x4f')],{'$or':_['map'](_0x5bb423[_0x8e8f('0x46')],function(_0x56dcf2){var _0x3ce61e={};_0x3ce61e[_0x56dcf2]={'$like':'%'+_0x492cbc['query'][_0x8e8f('0x4e')]+'%'};return _0x3ce61e;})});}_0x5bb423=_[_0x8e8f('0x50')]({},_0x5bb423,_0x492cbc['options']);return _0x71a275[_0x8e8f('0x84')](_0x5bb423);}})[_0x8e8f('0x22')](function(_0x2a9910){if(_0x2a9910){_0x3934c1=_0x2a9910[_0x8e8f('0x48')];if(!_0x492cbc['query'][_0x8e8f('0x49')](_0x8e8f('0x6a'))){_0x5bb423[_0x8e8f('0x30')]=qs[_0x8e8f('0x30')](_0x492cbc['query']['limit']);_0x5bb423['offset']=qs[_0x8e8f('0x4a')](_0x492cbc[_0x8e8f('0x43')][_0x8e8f('0x4a')]);}return _0x71a275[_0x8e8f('0x84')](_0x5bb423);}})[_0x8e8f('0x22')](function(_0x315e75){if(_0x315e75){return _0x315e75?{'count':_0x3934c1,'rows':_0x315e75}:null;}})[_0x8e8f('0x22')](respondWithResult(_0x1ebf2,null))[_0x8e8f('0x57')](handleError(_0x1ebf2,null));};function Extension(_0x7f9638,_0x2efc9a,_0x3e70cc,_0x3c5bc1){this['context']=_0x8e8f('0x85');this[_0x8e8f('0x86')]=_0x7f9638[_0x8e8f('0x87')];this[_0x8e8f('0x88')]=_0x3c5bc1;this[_0x8e8f('0x3f')]='system';this[_0x8e8f('0x89')]='Fax\x20Extension';this[_0x8e8f('0x6b')]=_0x7f9638['id'];this[_0x8e8f('0x83')]=_0x2efc9a;this[_0x8e8f('0x8a')]=_0x3e70cc;}function createExtensionsReciveFax(_0x3ae8a2){var _0xbfa345=0x1;var _0x56b349=[];_0x56b349[_0x8e8f('0x8b')](new Extension(_0x3ae8a2,_0xbfa345,'',_0x8e8f('0x8c')));_0xbfa345+=0x1;_0x56b349[_0x8e8f('0x8b')](new Extension(_0x3ae8a2,_0xbfa345,'CDR(type)=inbound-fax','Set'));_0xbfa345+=0x1;for(var _0x1c0d87 in _0x3ae8a2){if(_0x3ae8a2[_0x8e8f('0x49')](_0x1c0d87)&&(_0x1c0d87===_0x8e8f('0x8d')||_0x1c0d87===_0x8e8f('0x87')||_0x1c0d87==='gateway'||_0x1c0d87===_0x8e8f('0x8e')||_0x1c0d87==='headerinfo'||_0x1c0d87===_0x8e8f('0x8f')||_0x1c0d87===_0x8e8f('0x90')||_0x1c0d87===_0x8e8f('0x91')||_0x1c0d87===_0x8e8f('0x92'))){_0x56b349[_0x8e8f('0x8b')](new Extension(_0x3ae8a2,_0xbfa345,_0x8e8f('0x93')+_0x1c0d87+')='+_0x3ae8a2[_0x1c0d87],_0x8e8f('0x94')));_0xbfa345+=0x1;}}_0x56b349[_0x8e8f('0x8b')](new Extension(_0x3ae8a2,_0xbfa345,'6',_0x8e8f('0x95')));_0xbfa345+=0x1;_0x56b349[_0x8e8f('0x8b')](new Extension(_0x3ae8a2,_0xbfa345,'/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',_0x8e8f('0x96')));_0xbfa345=0x0;return _0x56b349;}exports[_0x8e8f('0x97')]=function(_0x130340,_0xd1fb59,_0x1a775b){var _0x100eec;return db[_0x8e8f('0x7f')]['transaction'](function(_0x17106a){return db[_0x8e8f('0x3d')][_0x8e8f('0x5d')](_0x130340[_0x8e8f('0x5e')],{'transaction':_0x17106a})[_0x8e8f('0x22')](function(_0x39760b){_0x100eec=_0x39760b[_0x8e8f('0x60')]({'plain':!![]});return db['VoiceExtension'][_0x8e8f('0x82')](createExtensionsReciveFax(_0x100eec),{'transaction':_0x17106a});});})['then'](function(){return _0x100eec;})[_0x8e8f('0x22')](respondWithResult(_0xd1fb59,null))[_0x8e8f('0x57')](handleError(_0xd1fb59,null));};exports[_0x8e8f('0x98')]=function(_0x5cd32b,_0x234c6c,_0x46a17e){var _0x365455;return db[_0x8e8f('0x7f')][_0x8e8f('0x80')](function(_0x26c3cc){return db['FaxAccount'][_0x8e8f('0x37')](_0x5cd32b[_0x8e8f('0x5e')],{'where':{'id':_0x5cd32b[_0x8e8f('0x5e')]['id']},'transaction':_0x26c3cc})['then'](function(_0x496c29){return db[_0x8e8f('0x99')][_0x8e8f('0x38')]({'where':{'FaxAccountId':_0x5cd32b[_0x8e8f('0x5e')]['id']},'transaction':_0x26c3cc})[_0x8e8f('0x22')](function(_0x19b30c){return db[_0x8e8f('0x99')]['bulkCreate'](createExtensionsReciveFax(_[_0x8e8f('0x74')](_0x5cd32b[_0x8e8f('0x5e')],['tech','key',_0x8e8f('0x9a'),_0x8e8f('0x9b'),_0x8e8f('0x9c'),_0x8e8f('0x9d')])),{'transaction':_0x26c3cc});});});})['then'](function(){return db[_0x8e8f('0x3d')][_0x8e8f('0x9e')](_0x5cd32b[_0x8e8f('0x5e')]['id']);})['then'](respondWithResult(_0x234c6c,null))[_0x8e8f('0x57')](handleError(_0x234c6c,null));};exports[_0x8e8f('0x9f')]=function(_0x39e306,_0x2a5f9f,_0x3deef0){var _0x87117d={'raw':!![],'where':{}};var _0x224be0={};var _0xe46bbc={'count':0x0,'rows':[]};return db[_0x8e8f('0x3d')]['findOne']({'where':{'id':_0x39e306[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x2a5f9f,null))[_0x8e8f('0x22')](function(_0x1be3e5){if(_0x1be3e5){_0x224be0[_0x8e8f('0x41')]=_[_0x8e8f('0x5c')](db[_0x8e8f('0xa0')][_0x8e8f('0x76')]);_0x224be0[_0x8e8f('0x43')]=_[_0x8e8f('0x5c')](_0x39e306[_0x8e8f('0x43')]);_0x224be0[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x224be0['model'],_0x224be0[_0x8e8f('0x43')]);_0x87117d[_0x8e8f('0x46')]=_[_0x8e8f('0x45')](_0x224be0[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x47')]));_0x87117d['attributes']=_0x87117d['attributes'][_0x8e8f('0x48')]?_0x87117d['attributes']:_0x224be0[_0x8e8f('0x41')];if(!_0x39e306['query'][_0x8e8f('0x49')](_0x8e8f('0x6a'))){_0x87117d[_0x8e8f('0x30')]=qs[_0x8e8f('0x30')](_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x30')]);_0x87117d[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x4a')]);}_0x87117d[_0x8e8f('0x4b')]=qs['sort'](_0x39e306[_0x8e8f('0x43')]['sort']);_0x87117d[_0x8e8f('0x4f')]=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x39e306[_0x8e8f('0x43')],_0x224be0['filters']));_0x87117d[_0x8e8f('0x4f')]['FaxAccountId']=_0x1be3e5['id'];if(_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x87117d[_0x8e8f('0x4f')]=_[_0x8e8f('0x50')](_0x87117d['where'],{'$or':_[_0x8e8f('0x42')](_0x87117d[_0x8e8f('0x46')],function(_0x4c621a){var _0x9830c2={};_0x9830c2[_0x4c621a]={'$like':'%'+_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0x9830c2;})});}if(_0x39e306[_0x8e8f('0x43')]['$gte']){var _0x1cf455=_0x39e306[_0x8e8f('0x43')][_0x8e8f('0xa1')]['split'](',');var _0x37c13c={};_0x37c13c[_0x1cf455[0x0]]={'$gte':moment(_0x1cf455[0x1])[_0x8e8f('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x87117d[_0x8e8f('0x4f')]=_['merge'](_0x87117d['where'],_0x37c13c);}_0x87117d=_[_0x8e8f('0x50')]({},_0x87117d,_0x39e306['options']);return db[_0x8e8f('0xa0')][_0x8e8f('0x2f')]({'where':_0x87117d[_0x8e8f('0x4f')]})[_0x8e8f('0x22')](function(_0x2288b6){_0xe46bbc[_0x8e8f('0x2f')]=_0x2288b6;if(_0x39e306[_0x8e8f('0x43')][_0x8e8f('0x54')]){_0x87117d[_0x8e8f('0x55')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x87117d);})[_0x8e8f('0x22')](function(_0x29c177){_0xe46bbc['rows']=_0x29c177;return _0xe46bbc;});}})['then'](respondWithFilteredResult(_0x2a5f9f,_0x87117d))[_0x8e8f('0x57')](handleError(_0x2a5f9f,null));};exports[_0x8e8f('0x3c')]=function(_0x2a3752,_0x56d2f3,_0x2dab51){var _0x244386,_0x597b4f={},_0x501d08;if(_0x2a3752['body']['to']){_0x501d08=_0x2a3752[_0x8e8f('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x8e8f('0x64')]({'where':{'id':_0x2a3752[_0x8e8f('0x59')]['id']},'include':[{'model':db[_0x8e8f('0xa3')],'as':_0x8e8f('0xa4'),'include':[{'model':db[_0x8e8f('0x77')],'as':_0x8e8f('0xa5'),'where':{'fax':_0x501d08},'limit':0x1,'order':[[_0x8e8f('0x9b'),_0x8e8f('0xa6')]]}]}]})[_0x8e8f('0x22')](handleEntityNotFound(_0x56d2f3,null))[_0x8e8f('0x22')](function(_0x3129e4){_0x244386=_0x3129e4;if(_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')]&&_0x2a3752[_0x8e8f('0x5e')]['attachments'][_0x8e8f('0x48')]){for(var _0x58e05c=0x0;_0x58e05c<_0x2a3752['body'][_0x8e8f('0xa7')]['length'];_0x58e05c+=0x1){_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][_0x58e05c]={'filename':_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][_0x58e05c][_0x8e8f('0x52')],'id':_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][_0x58e05c]['id'],'path':path[_0x8e8f('0xa8')](config[_0x8e8f('0xa9')],_0x8e8f('0xaa'),_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][_0x58e05c]['basename'])};}}return respondWithRpcPromise(_0x8e8f('0xab'),_0x8e8f('0xab'),{'FaxAccountId':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x59')]['id'])?undefined:_0x2a3752[_0x8e8f('0x59')]['id'],'path':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x5e')]['attachments'][0x0][_0x8e8f('0x8')])?undefined:_0x2a3752['body'][_0x8e8f('0xa7')][0x0][_0x8e8f('0x8')],'fax':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x5e')]['to'][0x0])?undefined:_0x2a3752['body']['to'][0x0]},client9002);})[_0x8e8f('0x22')](function(){if(_0x244386){if(_['isNil'](_0x2a3752['body']['from'])){_0x2a3752[_0x8e8f('0x5e')]['from']=util['format'](_0x8e8f('0xad'),_0x244386['name'],_0x244386[_0x8e8f('0xae')]);}if(_0x244386[_0x8e8f('0xa4')]){if(_0x244386[_0x8e8f('0xa4')]['Contacts'][_0x8e8f('0x48')]){return _0x244386[_0x8e8f('0xa4')][_0x8e8f('0xa5')][0x0];}else{return db[_0x8e8f('0x77')][_0x8e8f('0x5d')](_[_0x8e8f('0x17')](_0x2a3752['body'],{'firstName':_0x2a3752['body']['to'][0x0],'phone':_0x2a3752[_0x8e8f('0x5e')]['to'][0x0],'fax':_0x2a3752[_0x8e8f('0x5e')]['to'][0x0],'ListId':_0x244386[_0x8e8f('0x9d')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x8e8f('0x22')](function(_0x2eb263){if(_0x2eb263){return db[_0x8e8f('0x75')][_0x8e8f('0x64')]({'where':{'ContactId':_0x2eb263['id'],'closed':![],'FaxAccountId':_0x244386['id']}})['then'](function(_0x584149){if(_0x584149){return[_0x584149,![]];}return db['FaxInteraction'][_0x8e8f('0x5d')]({'UserId':_0x2a3752[_0x8e8f('0x5f')]['id'],'ContactId':_0x2eb263['id'],'FaxAccountId':_0x244386['id'],'fax':_0x2a3752[_0x8e8f('0x5e')]['to'][0x0],'firstMsgDirection':_0x8e8f('0xaf'),'Messages':[_[_0x8e8f('0x50')](_0x2a3752[_0x8e8f('0x5e')],{'read':![],'body':_0x2a3752['body'][_0x8e8f('0xa7')][0x0]['filename'],'FaxAccountId':_0x244386['id'],'UserId':_0x2a3752['user']['id'],'ContactId':_0x2eb263['id'],'AttachmentId':_0x2a3752[_0x8e8f('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8e8f('0xa0')],'as':_0x8e8f('0xb0')}]})['then'](function(_0x253959){return[_0x253959,!![]];});});}else{throw new Error(_0x8e8f('0xb1'));}})[_0x8e8f('0xb2')](function(_0xc4615b,_0x45fb77){if(_0x45fb77){return _0xc4615b;}return db[_0x8e8f('0xa0')][_0x8e8f('0x5d')]({'direction':_0x8e8f('0xaf'),'read':![],'body':_0x2a3752['body'][_0x8e8f('0xa7')][0x0][_0x8e8f('0xb3')],'FaxAccountId':_0x244386['id'],'FaxInteractionId':_0xc4615b['id'],'UserId':_0x2a3752[_0x8e8f('0x5f')]['id'],'ContactId':_0xc4615b[_0x8e8f('0xb4')],'AttachmentId':_0x2a3752['body'][_0x8e8f('0xa7')][0x0]['id']})[_0x8e8f('0x22')](function(_0x1f7c56){_0xc4615b[_0x8e8f('0xb5')]['Messages']=[];_0xc4615b['dataValues'][_0x8e8f('0xb0')][_0x8e8f('0x8b')](_0x1f7c56[_0x8e8f('0xb5')]);return _0xc4615b;});})[_0x8e8f('0x22')](function(_0x5b8de1){respondWithRpcPromise(_0x8e8f('0xb6'),_0x8e8f('0xb6'),{'FaxAccountId':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x59')]['id'])?undefined:_0x2a3752[_0x8e8f('0x59')]['id'],'path':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][0x0][_0x8e8f('0x8')])?undefined:_0x2a3752[_0x8e8f('0x5e')][_0x8e8f('0xa7')][0x0][_0x8e8f('0x8')],'fax':_[_0x8e8f('0xac')](_0x2a3752[_0x8e8f('0x5e')]['to'][0x0])?undefined:_0x2a3752['body']['to'][0x0],'AttachmentId':_0x2a3752['body'][_0x8e8f('0xa7')][0x0]['id']},client9002)[_0x8e8f('0x22')](function(_0x59d901){logger[_0x8e8f('0x23')](_0x8e8f('0xb7'),_0x59d901);})[_0x8e8f('0x57')](function(_0x158156){logger[_0x8e8f('0x23')](_0x8e8f('0xb7'),_0x158156);});return _0x5b8de1;})['then'](respondWithResult(_0x56d2f3,null))[_0x8e8f('0x57')](handleError(_0x56d2f3,null));};exports[_0x8e8f('0xb8')]=function(_0x361782,_0x1250ac,_0x2bc634){return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x361782[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x1250ac,null))['then'](function(_0x41509c){if(_0x41509c){return _0x41509c[_0x8e8f('0xb8')](_0x361782['body'][_0x8e8f('0x6e')],_['omit'](_0x361782['body'],['ids','id'])||{})[_0x8e8f('0xb2')](function(_0x44d32b){for(var _0x128be6=0x0;_0x128be6<_0x361782[_0x8e8f('0x5e')]['ids'][_0x8e8f('0x48')];_0x128be6+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x361782[_0x8e8f('0x5e')]['ids'][_0x128be6],'FaxAccountId':_0x361782['params']['id']});}return _0x44d32b;});}})[_0x8e8f('0x22')](respondWithResult(_0x1250ac,null))[_0x8e8f('0x57')](handleError(_0x1250ac,null));};exports['removeAgents']=function(_0x3bad84,_0x1f1dac,_0x5bb349){return db[_0x8e8f('0x3d')][_0x8e8f('0x64')]({'where':{'id':_0x3bad84[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x1f1dac,null))[_0x8e8f('0x22')](function(_0x4d9c25){if(_0x4d9c25){return _0x4d9c25['removeAgents'](_0x3bad84[_0x8e8f('0x43')][_0x8e8f('0x6e')])[_0x8e8f('0x22')](function(){if(_[_0x8e8f('0xb9')](_0x3bad84[_0x8e8f('0x43')][_0x8e8f('0x6e')])){for(var _0x342158=0x0;_0x342158<_0x3bad84['query']['ids'][_0x8e8f('0x48')];_0x342158+=0x1){socket[_0x8e8f('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x3bad84[_0x8e8f('0x43')][_0x8e8f('0x6e')][_0x342158]),'FaxAccountId':Number(_0x3bad84[_0x8e8f('0x59')]['id'])});}}else{socket['emit'](_0x8e8f('0xbb'),{'UserId':Number(_0x3bad84['query'][_0x8e8f('0x6e')]),'FaxAccountId':Number(_0x3bad84[_0x8e8f('0x59')]['id'])});}});}})[_0x8e8f('0x22')](respondWithStatusCode(_0x1f1dac,null))[_0x8e8f('0x57')](handleError(_0x1f1dac,null));};exports[_0x8e8f('0xbc')]=function(_0x3e05d1,_0x3d3e14,_0x494db1){var _0x16ccf1={};var _0x316796={};var _0x4e4bfa;var _0x18a080;return db['FaxAccount']['findOne']({'where':{'id':_0x3e05d1[_0x8e8f('0x59')]['id']}})[_0x8e8f('0x22')](handleEntityNotFound(_0x3d3e14,null))[_0x8e8f('0x22')](function(_0x3e709e){if(_0x3e709e){_0x4e4bfa=_0x3e709e;_0x316796[_0x8e8f('0x41')]=_['keys'](db[_0x8e8f('0xbd')][_0x8e8f('0x76')]);_0x316796['query']=_['keys'](_0x3e05d1[_0x8e8f('0x43')]);_0x316796[_0x8e8f('0x44')]=_[_0x8e8f('0x45')](_0x316796[_0x8e8f('0x41')],_0x316796[_0x8e8f('0x43')]);_0x16ccf1[_0x8e8f('0x46')]=_['intersection'](_0x316796[_0x8e8f('0x41')],qs[_0x8e8f('0x47')](_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x47')]));_0x16ccf1['attributes']=_0x16ccf1[_0x8e8f('0x46')][_0x8e8f('0x48')]?_0x16ccf1['attributes']:_0x316796['model'];_0x16ccf1[_0x8e8f('0x4b')]=qs[_0x8e8f('0x4c')](_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x4c')]);_0x16ccf1[_0x8e8f('0x4f')]=qs[_0x8e8f('0x44')](_[_0x8e8f('0x4d')](_0x3e05d1[_0x8e8f('0x43')],_0x316796['filters']));if(_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x4e')]){_0x16ccf1[_0x8e8f('0x4f')]=_['merge'](_0x16ccf1[_0x8e8f('0x4f')],{'$or':_[_0x8e8f('0x42')](_0x16ccf1[_0x8e8f('0x46')],function(_0x3c2271){var _0x4b8488={};_0x4b8488[_0x3c2271]={'$like':'%'+_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x4e')]+'%'};return _0x4b8488;})});}_0x16ccf1=_[_0x8e8f('0x50')]({},_0x16ccf1,_0x3e05d1[_0x8e8f('0x53')]);return _0x4e4bfa[_0x8e8f('0xbc')](_0x16ccf1);}})[_0x8e8f('0x22')](function(_0x2e8885){if(_0x2e8885){_0x18a080=_0x2e8885[_0x8e8f('0x48')];if(!_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x49')](_0x8e8f('0x6a'))){_0x16ccf1[_0x8e8f('0x30')]=qs['limit'](_0x3e05d1['query'][_0x8e8f('0x30')]);_0x16ccf1[_0x8e8f('0x4a')]=qs[_0x8e8f('0x4a')](_0x3e05d1[_0x8e8f('0x43')][_0x8e8f('0x4a')]);}return _0x4e4bfa[_0x8e8f('0xbc')](_0x16ccf1);}})[_0x8e8f('0x22')](function(_0x58e012){if(_0x58e012){return _0x58e012?{'count':_0x18a080,'rows':_0x58e012}:null;}})[_0x8e8f('0x22')](respondWithResult(_0x3d3e14,null))[_0x8e8f('0x57')](handleError(_0x3d3e14,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 73dd5a0..790ed59 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 _0x3442=['hook','exports','events','../../mysqldb','FaxAccount','save','update','remove','hasOwnProperty'];(function(_0x2499e5,_0x41bdf0){var _0x496e0c=function(_0x40a6f){while(--_0x40a6f){_0x2499e5['push'](_0x2499e5['shift']());}};_0x496e0c(++_0x41bdf0);}(_0x3442,0xa4));var _0x2344=function(_0x4d5478,_0x17a715){_0x4d5478=_0x4d5478-0x0;var _0x1aa230=_0x3442[_0x4d5478];return _0x1aa230;};'use strict';var EventEmitter=require(_0x2344('0x0'));var FaxAccount=require(_0x2344('0x1'))['db'][_0x2344('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2344('0x3'),'afterUpdate':_0x2344('0x4'),'afterDestroy':_0x2344('0x5')};function emitEvent(_0x101639){return function(_0x192572,_0x34d87a,_0x15be17){FaxAccountEvents['emit'](_0x101639+':'+_0x192572['id'],_0x192572);FaxAccountEvents['emit'](_0x101639,_0x192572);_0x15be17(null);};}for(var e in events){if(events[_0x2344('0x6')](e)){var event=events[e];FaxAccount[_0x2344('0x7')](e,emitEvent(event));}}module[_0x2344('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x3c65=['events','../../mysqldb','save','update','remove','emit','exports'];(function(_0x4cdad4,_0x51751d){var _0x29ea70=function(_0x28f89d){while(--_0x28f89d){_0x4cdad4['push'](_0x4cdad4['shift']());}};_0x29ea70(++_0x51751d);}(_0x3c65,0xee));var _0x53c6=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0x3c65[_0x4eaa4c];return _0x15aec6;};'use strict';var EventEmitter=require(_0x53c6('0x0'));var FaxAccount=require(_0x53c6('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53c6('0x2'),'afterUpdate':_0x53c6('0x3'),'afterDestroy':_0x53c6('0x4')};function emitEvent(_0x53f5a6){return function(_0x9a0014,_0x136526,_0x22936a){FaxAccountEvents[_0x53c6('0x5')](_0x53f5a6+':'+_0x9a0014['id'],_0x9a0014);FaxAccountEvents[_0x53c6('0x5')](_0x53f5a6,_0x9a0014);_0x22936a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x53c6('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 443def8..41d6839 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 _0xa745=['fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xa745,0x1ef));var _0x5a74=function(_0x83b552,_0x29c8c7){_0x83b552=_0x83b552-0x0;var _0x150412=_0xa745[_0x83b552];return _0x150412;};'use strict';var _=require('lodash');var util=require(_0x5a74('0x0'));var logger=require(_0x5a74('0x1'))(_0x5a74('0x2'));var moment=require(_0x5a74('0x3'));var BPromise=require(_0x5a74('0x4'));var rp=require(_0x5a74('0x5'));var fs=require('fs');var path=require(_0x5a74('0x6'));var rimraf=require(_0x5a74('0x7'));var config=require('../../config/environment');var attributes=require(_0x5a74('0x8'));module[_0x5a74('0x9')]=function(_0x2795ef,_0x19017e){return _0x2795ef[_0x5a74('0xa')](_0x5a74('0xb'),attributes,{'tableName':_0x5a74('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe75=['fax_accounts','util','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','define'];(function(_0x380016,_0x178dd6){var _0x5c7ac0=function(_0xa8ddca){while(--_0xa8ddca){_0x380016['push'](_0x380016['shift']());}};_0x5c7ac0(++_0x178dd6);}(_0xbe75,0x119));var _0x5be7=function(_0x577f5d,_0x1ec8bf){_0x577f5d=_0x577f5d-0x0;var _0x1e6810=_0xbe75[_0x577f5d];return _0x1e6810;};'use strict';var _=require('lodash');var util=require(_0x5be7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5be7('0x1'));var BPromise=require(_0x5be7('0x2'));var rp=require(_0x5be7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5be7('0x4'));var config=require(_0x5be7('0x5'));var attributes=require(_0x5be7('0x6'));module[_0x5be7('0x7')]=function(_0x3e056d,_0x459ac6){return _0x3e056d[_0x5be7('0x8')]('FaxAccount',attributes,{'tableName':_0x5be7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index b434d3e..f66a6f2 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 _0x7ba4=['agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','then','info','request\x20sent','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','CompanyId','ListId','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','FaxApplication','Applications','get','applications','orderBy','priority','asc','Contacts','length','from','CmContact','contact','FaxInteraction','create','Contact\x20not\x20found','push','close','unmanaged','created','FaxMessage','AttachmentId','interaction','UserId','name','unshift'];(function(_0x380c46,_0x4bcad1){var _0x4f0ee2=function(_0x4e0a53){while(--_0x4e0a53){_0x380c46['push'](_0x380c46['shift']());}};_0x4f0ee2(++_0x4bcad1);}(_0x7ba4,0x104));var _0x47ba=function(_0x346148,_0x51ddc4){_0x346148=_0x346148-0x0;var _0x3ad67d=_0x7ba4[_0x346148];return _0x3ad67d;};'use strict';var _=require(_0x47ba('0x0'));var util=require('util');var moment=require(_0x47ba('0x1'));var BPromise=require(_0x47ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x47ba('0x4'));var logger=require(_0x47ba('0x5'))(_0x47ba('0x6'));var config=require(_0x47ba('0x7'));var jayson=require(_0x47ba('0x8'));var client=jayson[_0x47ba('0x9')]['http']({'port':0x232c});config['redis']=_[_0x47ba('0xa')](config[_0x47ba('0xb')],{'host':_0x47ba('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47ba('0xb')]));require('./faxAccount.socket')[_0x47ba('0xd')](socket);function respondWithRpcPromise(_0x1ee6b4,_0x1ad74f,_0x398943){return new BPromise(function(_0x4d873b,_0x5eeb7d){return client[_0x47ba('0xe')](_0x1ee6b4,_0x398943)[_0x47ba('0xf')](function(_0x52cb91){logger[_0x47ba('0x10')]('FaxAccount,\x20%s,\x20%s',_0x1ad74f,_0x47ba('0x11'));logger[_0x47ba('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1ad74f,_0x47ba('0x11'),JSON[_0x47ba('0x13')](_0x52cb91));if(_0x52cb91['error']){if(_0x52cb91[_0x47ba('0x14')]['code']===0x1f4){logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x52cb91['error']['message']);return _0x5eeb7d(_0x52cb91['error'][_0x47ba('0x16')]);}logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x52cb91[_0x47ba('0x14')]['message']);return _0x4d873b(_0x52cb91['error'][_0x47ba('0x16')]);}else{logger[_0x47ba('0x10')](_0x47ba('0x15'),_0x1ad74f,'request\x20sent');_0x4d873b(_0x52cb91[_0x47ba('0x17')][_0x47ba('0x16')]);}})[_0x47ba('0x18')](function(_0x7e7c01){logger[_0x47ba('0x14')](_0x47ba('0x15'),_0x1ad74f,_0x7e7c01);_0x5eeb7d(_0x7e7c01);});});}exports[_0x47ba('0x19')]=function(_0x11e85b){var _0x1c41d1=this;return new Promise(function(_0x22bb7a,_0x180c04){return db[_0x47ba('0x1a')][_0x47ba('0x1b')]({'raw':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x1d')]===undefined?!![]:![]:!![],'where':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x1e')]||null:null,'attributes':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x1f')]||null:null,'limit':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x20')]||null:null,'include':_0x11e85b[_0x47ba('0x1c')]?_0x11e85b['options'][_0x47ba('0x21')]?_[_0x47ba('0x22')](_0x11e85b[_0x47ba('0x1c')][_0x47ba('0x21')],function(_0x263bdf){return{'model':db[_0x263bdf[_0x47ba('0x23')]],'as':_0x263bdf['as'],'attributes':_0x263bdf[_0x47ba('0x1f')],'include':_0x263bdf[_0x47ba('0x21')]?_[_0x47ba('0x22')](_0x263bdf[_0x47ba('0x21')],function(_0x8f7821){return{'model':db[_0x8f7821[_0x47ba('0x23')]],'as':_0x8f7821['as'],'attributes':_0x8f7821[_0x47ba('0x1f')],'include':_0x8f7821[_0x47ba('0x21')]?_['map'](_0x8f7821[_0x47ba('0x21')],function(_0x2a7b5f){return{'model':db[_0x2a7b5f[_0x47ba('0x23')]],'as':_0x2a7b5f['as'],'attributes':_0x2a7b5f[_0x47ba('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x47ba('0xf')](function(_0x45eaa5){logger[_0x47ba('0x10')](_0x47ba('0x19'),_0x11e85b);logger[_0x47ba('0x12')](_0x47ba('0x19'),_0x11e85b,JSON['stringify'](_0x45eaa5));_0x22bb7a(_0x45eaa5);})[_0x47ba('0x18')](function(_0x2252da){logger[_0x47ba('0x14')](_0x47ba('0x19'),_0x2252da[_0x47ba('0x16')],_0x11e85b);_0x180c04(_0x1c41d1[_0x47ba('0x14')](0x1f4,_0x2252da[_0x47ba('0x16')]));});});};exports[_0x47ba('0x24')]=function(_0x54e615,_0xbb27a2,_0x12f455){var _0x16b419=this;return new Promise(function(_0x7a1343,_0x33130b){var _0x3e16dc={'body':_0x54e615[_0x47ba('0x25')],'channel':_0x47ba('0x26')};var _0x286cba=[];var _0x11c337=[];var _0x4ce3aa={};return db['CmContact']['describe']()[_0x47ba('0xf')](function(_0x7bc918){if(!_0x7bc918){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x29'));}_0x286cba=_[_0x47ba('0x2a')](_[_0x47ba('0x2b')](_0x7bc918),['createdAt',_0x47ba('0x2c')]);_0x11c337=_[_0x47ba('0x2a')](_[_0x47ba('0x2b')](_0x7bc918),['createdAt','updatedAt',_0x47ba('0x2d'),_0x47ba('0x2e')]);if(_0x54e615[_0x47ba('0x25')]['id']){delete _0x54e615['body']['id'];}if(_[_0x47ba('0x2f')](_0x54e615['body']['from'])){throw new db[(_0x47ba('0x27'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x47ba('0x2f')](_0x54e615['body'][_0x47ba('0x25')])||_0x54e615[_0x47ba('0x25')][_0x47ba('0x25')]===''){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47ba('0x2f')](_0x54e615[_0x47ba('0x25')]['mapKey'])){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x30')+_0x11c337);}if(!_[_0x47ba('0x31')](_0x11c337,_0x54e615[_0x47ba('0x25')][_0x47ba('0x32')])){throw new db[(_0x47ba('0x27'))][(_0x47ba('0x28'))](_0x47ba('0x33')+_0x11c337);}_0x4ce3aa[_0x54e615['body']['mapKey']]=_0x54e615[_0x47ba('0x25')]['from'];})['then'](function(){return db[_0x47ba('0x1a')][_0x47ba('0x34')]({'where':{'id':_0x54e615[_0x47ba('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x47ba('0x36'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4ce3aa,'limit':0x1,'order':[[_0x47ba('0x2c'),'DESC']]}]},{'model':db[_0x47ba('0x37')],'as':_0x47ba('0x38')}]});})['then'](function(_0x5434ad){if(_0x5434ad&&_0x5434ad[_0x47ba('0x36')]){var _0x37f8d5=_0x5434ad[_0x47ba('0x39')]({'plain':!![]});_0x3e16dc[_0x47ba('0x35')]=_0x37f8d5;_0x3e16dc[_0x47ba('0x3a')]=_0x37f8d5['Applications'];_0x3e16dc['list']=_0x37f8d5[_0x47ba('0x36')];_0x3e16dc['applications']=_[_0x47ba('0x3b')](_0x3e16dc['applications'],[_0x47ba('0x3c')],[_0x47ba('0x3d')]);if(_0x3e16dc[_0x47ba('0x35')][_0x47ba('0x38')]){delete _0x3e16dc[_0x47ba('0x35')][_0x47ba('0x38')];}if(_0x3e16dc[_0x47ba('0x35')]['List']&&_0x3e16dc['account'][_0x47ba('0x36')][_0x47ba('0x3e')][_0x47ba('0x3f')]){return _0x3e16dc[_0x47ba('0x35')][_0x47ba('0x36')][_0x47ba('0x3e')][0x0];}var _0x59558e=_[_0x47ba('0xa')](_0x54e615[_0x47ba('0x25')],{'firstName':_0x54e615['body'][_0x47ba('0x40')],'ListId':_0x37f8d5['ListId']});_0x59558e[_0x54e615[_0x47ba('0x25')][_0x47ba('0x32')]]=_0x54e615[_0x47ba('0x25')][_0x47ba('0x40')];return db[_0x47ba('0x41')]['create'](_0x59558e,{'fields':_0x286cba,'raw':!![]});}})['then'](function(_0x2c209e){_0x3e16dc[_0x47ba('0x42')]=_0x2c209e;if(_0x2c209e){var _0x322e82={'ContactId':_0x2c209e['id'],'FaxAccountId':_0x54e615['account']['id'],'fax':_0x2c209e[_0x47ba('0x26')]};return db[_0x47ba('0x43')][_0x47ba('0x34')]({'where':{'ContactId':_0x2c209e['id'],'closed':![],'FaxAccountId':_0x54e615[_0x47ba('0x35')]['id']}})[_0x47ba('0xf')](function(_0x401fcb){if(_0x401fcb){return[_0x401fcb,![]];}return db[_0x47ba('0x43')][_0x47ba('0x44')](_0x322e82)[_0x47ba('0xf')](function(_0xa1bda6){return[_0xa1bda6,!![]];});});}else{throw new Error(_0x47ba('0x45'));}})['spread'](function(_0x3e8809,_0x1cf5fa){var _0x4811ba=_0x3e8809[_0x47ba('0x39')]({'plain':!![]});if(_0x1cf5fa){if(_0x3e16dc[_0x47ba('0x35')]['autoclose']){_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x46')]({'id':0x0,'priority':_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x3f')]+0x1,'app':_0x47ba('0x47'),'appdata':_0x47ba('0x48'),'interval':'*,*,*,*'});}_0x4811ba[_0x47ba('0x49')]=!![];}else{_0x4811ba[_0x47ba('0x49')]=![];}_0x3e16dc['interaction']=_0x4811ba;return db[_0x47ba('0x4a')][_0x47ba('0x44')]({'body':_0x54e615[_0x47ba('0x25')]['body'],'FaxAccountId':_0x54e615[_0x47ba('0x35')]['id'],'FaxInteractionId':_0x3e8809['id'],'direction':'in','ContactId':_0x3e8809['ContactId'],'AttachmentId':_0x54e615['body'][_0x47ba('0x4b')]});})[_0x47ba('0xf')](function(_0xe57c2f){_0x3e16dc['message']=_0xe57c2f;if(_0x3e16dc[_0x47ba('0x4c')][_0x47ba('0x4d')]){return db['User'][_0x47ba('0x34')]({'attributes':['id',_0x47ba('0x4e')],'where':{'id':_0x3e16dc[_0x47ba('0x4c')][_0x47ba('0x4d')]}})[_0x47ba('0xf')](function(_0x158385){if(_0x158385){_0x3e16dc[_0x47ba('0x3a')][_0x47ba('0x4f')]({'id':0x0,'priority':0x0,'app':_0x47ba('0x50'),'appdata':_0x158385[_0x47ba('0x4e')]+','+(_0x3e16dc[_0x47ba('0x35')][_0x47ba('0x51')]||0xa),'interval':_0x47ba('0x52')});}return respondWithRpcPromise(_0x47ba('0x53'),_0x47ba('0x54'),_0x3e16dc);});}return respondWithRpcPromise(_0x47ba('0x53'),'startRouting',_0x3e16dc);})[_0x47ba('0xf')](function(_0x3f8db2){_0x7a1343(_0x3f8db2);})['catch'](function(_0x4198e7){_0x33130b(_0x16b419['error'](0x1f4,_0x4198e7['message']));});});}; \ No newline at end of file +var _0xe713=['name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetFaxAccount','FaxAccount','options','attributes','limit','map','include','model','then','info','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','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','find','account','CmList','FaxApplication','Applications','get','applications','List','orderBy','length','Contacts','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent'];(function(_0xb6a457,_0x517442){var _0x1700d0=function(_0xacb3e1){while(--_0xacb3e1){_0xb6a457['push'](_0xb6a457['shift']());}};_0x1700d0(++_0x517442);}(_0xe713,0x164));var _0x3e71=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0xe713[_0x641f18];return _0x16eefe;};'use strict';var _=require(_0x3e71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e71('0x1'));var rs=require(_0x3e71('0x2'));var fs=require('fs');var Redis=require(_0x3e71('0x3'));var db=require(_0x3e71('0x4'))['db'];var utils=require(_0x3e71('0x5'));var logger=require(_0x3e71('0x6'))('rpc');var config=require(_0x3e71('0x7'));var jayson=require(_0x3e71('0x8'));var client=jayson[_0x3e71('0x9')][_0x3e71('0xa')]({'port':0x232c});config[_0x3e71('0xb')]=_[_0x3e71('0xc')](config[_0x3e71('0xb')],{'host':_0x3e71('0xd'),'port':0x18eb});var socket=require(_0x3e71('0xe'))(new Redis(config[_0x3e71('0xb')]));require(_0x3e71('0xf'))[_0x3e71('0x10')](socket);function respondWithRpcPromise(_0x13cb25,_0x2cf91a,_0x3274ea){return new BPromise(function(_0x309cea,_0x3d6cdd){return client[_0x3e71('0x11')](_0x13cb25,_0x3274ea)['then'](function(_0x203f9d){logger['info'](_0x3e71('0x12'),_0x2cf91a,'request\x20sent');logger['debug'](_0x3e71('0x13'),_0x2cf91a,_0x3e71('0x14'),JSON[_0x3e71('0x15')](_0x203f9d));if(_0x203f9d['error']){if(_0x203f9d[_0x3e71('0x16')]['code']===0x1f4){logger['error'](_0x3e71('0x12'),_0x2cf91a,_0x203f9d['error']['message']);return _0x3d6cdd(_0x203f9d[_0x3e71('0x16')][_0x3e71('0x17')]);}logger[_0x3e71('0x16')](_0x3e71('0x12'),_0x2cf91a,_0x203f9d['error']['message']);return _0x309cea(_0x203f9d[_0x3e71('0x16')][_0x3e71('0x17')]);}else{logger['info'](_0x3e71('0x12'),_0x2cf91a,'request\x20sent');_0x309cea(_0x203f9d['result'][_0x3e71('0x17')]);}})[_0x3e71('0x18')](function(_0x2688e5){logger[_0x3e71('0x16')](_0x3e71('0x12'),_0x2cf91a,_0x2688e5);_0x3d6cdd(_0x2688e5);});});}exports[_0x3e71('0x19')]=function(_0xbfb0c2){var _0x3e5130=this;return new Promise(function(_0x3ba164,_0x3f1a4c){return db[_0x3e71('0x1a')]['findAll']({'raw':_0xbfb0c2[_0x3e71('0x1b')]?_0xbfb0c2['options']['raw']===undefined?!![]:![]:!![],'where':_0xbfb0c2[_0x3e71('0x1b')]?_0xbfb0c2[_0x3e71('0x1b')]['where']||null:null,'attributes':_0xbfb0c2[_0x3e71('0x1b')]?_0xbfb0c2['options'][_0x3e71('0x1c')]||null:null,'limit':_0xbfb0c2[_0x3e71('0x1b')]?_0xbfb0c2[_0x3e71('0x1b')][_0x3e71('0x1d')]||null:null,'include':_0xbfb0c2['options']?_0xbfb0c2[_0x3e71('0x1b')]['include']?_[_0x3e71('0x1e')](_0xbfb0c2['options'][_0x3e71('0x1f')],function(_0x4f31ed){return{'model':db[_0x4f31ed[_0x3e71('0x20')]],'as':_0x4f31ed['as'],'attributes':_0x4f31ed[_0x3e71('0x1c')],'include':_0x4f31ed['include']?_['map'](_0x4f31ed[_0x3e71('0x1f')],function(_0x2712da){return{'model':db[_0x2712da['model']],'as':_0x2712da['as'],'attributes':_0x2712da[_0x3e71('0x1c')],'include':_0x2712da[_0x3e71('0x1f')]?_['map'](_0x2712da[_0x3e71('0x1f')],function(_0x1ead23){return{'model':db[_0x1ead23['model']],'as':_0x1ead23['as'],'attributes':_0x1ead23[_0x3e71('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e71('0x21')](function(_0x2f0bab){logger[_0x3e71('0x22')](_0x3e71('0x19'),_0xbfb0c2);logger['debug'](_0x3e71('0x19'),_0xbfb0c2,JSON[_0x3e71('0x15')](_0x2f0bab));_0x3ba164(_0x2f0bab);})[_0x3e71('0x18')](function(_0x5f0996){logger[_0x3e71('0x16')]('GetFaxAccount',_0x5f0996[_0x3e71('0x17')],_0xbfb0c2);_0x3f1a4c(_0x3e5130['error'](0x1f4,_0x5f0996[_0x3e71('0x17')]));});});};exports[_0x3e71('0x23')]=function(_0x1f8d5b,_0x56f30a,_0xcccfb0){var _0xfad34=this;return new Promise(function(_0x15427c,_0xaa338){var _0x510339={'body':_0x1f8d5b[_0x3e71('0x24')],'channel':_0x3e71('0x25')};var _0x20bfae=[];var _0x356eed=[];var _0xfaff23={};return db[_0x3e71('0x26')][_0x3e71('0x27')]()[_0x3e71('0x21')](function(_0xc6ef35){if(!_0xc6ef35){throw new db[(_0x3e71('0x28'))][(_0x3e71('0x29'))](_0x3e71('0x2a'));}_0x20bfae=_['difference'](_[_0x3e71('0x2b')](_0xc6ef35),[_0x3e71('0x2c'),_0x3e71('0x2d')]);_0x356eed=_[_0x3e71('0x2e')](_[_0x3e71('0x2b')](_0xc6ef35),[_0x3e71('0x2c'),'updatedAt','CompanyId',_0x3e71('0x2f')]);if(_0x1f8d5b[_0x3e71('0x24')]['id']){delete _0x1f8d5b[_0x3e71('0x24')]['id'];}if(_[_0x3e71('0x30')](_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x31')])){throw new db[(_0x3e71('0x28'))][(_0x3e71('0x29'))](_0x3e71('0x32'));}if(_[_0x3e71('0x30')](_0x1f8d5b['body']['body'])||_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x24')]===''){throw new db[(_0x3e71('0x28'))][(_0x3e71('0x29'))](_0x3e71('0x33'));}if(_[_0x3e71('0x30')](_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x34')])){throw new db[(_0x3e71('0x28'))][(_0x3e71('0x29'))](_0x3e71('0x35')+_0x356eed);}if(!_[_0x3e71('0x36')](_0x356eed,_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x34')])){throw new db[(_0x3e71('0x28'))]['ValidationError'](_0x3e71('0x37')+_0x356eed);}_0xfaff23[_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x34')]]=_0x1f8d5b[_0x3e71('0x24')]['from'];})[_0x3e71('0x21')](function(){return db[_0x3e71('0x1a')][_0x3e71('0x38')]({'where':{'id':_0x1f8d5b[_0x3e71('0x39')]['id']},'include':[{'model':db[_0x3e71('0x3a')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0xfaff23,'limit':0x1,'order':[[_0x3e71('0x2d'),'DESC']]}]},{'model':db[_0x3e71('0x3b')],'as':_0x3e71('0x3c')}]});})['then'](function(_0x1265e5){if(_0x1265e5&&_0x1265e5['List']){var _0x24eef9=_0x1265e5[_0x3e71('0x3d')]({'plain':!![]});_0x510339['account']=_0x24eef9;_0x510339[_0x3e71('0x3e')]=_0x24eef9[_0x3e71('0x3c')];_0x510339['list']=_0x24eef9[_0x3e71('0x3f')];_0x510339[_0x3e71('0x3e')]=_[_0x3e71('0x40')](_0x510339[_0x3e71('0x3e')],['priority'],['asc']);if(_0x510339[_0x3e71('0x39')]['Applications']){delete _0x510339[_0x3e71('0x39')][_0x3e71('0x3c')];}if(_0x510339['account']['List']&&_0x510339[_0x3e71('0x39')][_0x3e71('0x3f')]['Contacts'][_0x3e71('0x41')]){return _0x510339[_0x3e71('0x39')][_0x3e71('0x3f')][_0x3e71('0x42')][0x0];}var _0x3bd3d0=_[_0x3e71('0xc')](_0x1f8d5b[_0x3e71('0x24')],{'firstName':_0x1f8d5b['body'][_0x3e71('0x31')],'ListId':_0x24eef9[_0x3e71('0x2f')]});_0x3bd3d0[_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x34')]]=_0x1f8d5b['body']['from'];return db[_0x3e71('0x26')][_0x3e71('0x43')](_0x3bd3d0,{'fields':_0x20bfae,'raw':!![]});}})['then'](function(_0x283bad){_0x510339[_0x3e71('0x44')]=_0x283bad;if(_0x283bad){var _0x17b936={'ContactId':_0x283bad['id'],'FaxAccountId':_0x1f8d5b[_0x3e71('0x39')]['id'],'fax':_0x283bad[_0x3e71('0x25')]};return db['FaxInteraction'][_0x3e71('0x38')]({'where':{'ContactId':_0x283bad['id'],'closed':![],'FaxAccountId':_0x1f8d5b['account']['id']}})[_0x3e71('0x21')](function(_0x2bbae7){if(_0x2bbae7){return[_0x2bbae7,![]];}return db[_0x3e71('0x45')]['create'](_0x17b936)['then'](function(_0x32d90d){return[_0x32d90d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3e71('0x46')](function(_0x580aa8,_0x506121){var _0x2651c6=_0x580aa8[_0x3e71('0x3d')]({'plain':!![]});if(_0x506121){if(_0x510339['account'][_0x3e71('0x47')]){_0x510339[_0x3e71('0x3e')][_0x3e71('0x48')]({'id':0x0,'priority':_0x510339[_0x3e71('0x3e')][_0x3e71('0x41')]+0x1,'app':_0x3e71('0x49'),'appdata':_0x3e71('0x4a'),'interval':_0x3e71('0x4b')});}_0x2651c6[_0x3e71('0x4c')]=!![];}else{_0x2651c6[_0x3e71('0x4c')]=![];}_0x510339[_0x3e71('0x4d')]=_0x2651c6;return db[_0x3e71('0x4e')][_0x3e71('0x43')]({'body':_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x24')],'FaxAccountId':_0x1f8d5b['account']['id'],'FaxInteractionId':_0x580aa8['id'],'direction':'in','ContactId':_0x580aa8[_0x3e71('0x4f')],'AttachmentId':_0x1f8d5b[_0x3e71('0x24')][_0x3e71('0x50')]});})[_0x3e71('0x21')](function(_0x5f4587){_0x510339[_0x3e71('0x17')]=_0x5f4587;if(_0x510339[_0x3e71('0x4d')]['UserId']){return db['User'][_0x3e71('0x38')]({'attributes':['id','name'],'where':{'id':_0x510339[_0x3e71('0x4d')][_0x3e71('0x51')]}})[_0x3e71('0x21')](function(_0x11ecba){if(_0x11ecba){_0x510339['applications'][_0x3e71('0x52')]({'id':0x0,'priority':0x0,'app':_0x3e71('0x53'),'appdata':_0x11ecba[_0x3e71('0x54')]+','+(_0x510339[_0x3e71('0x39')][_0x3e71('0x55')]||0xa),'interval':_0x3e71('0x4b')});}return respondWithRpcPromise(_0x3e71('0x56'),'startRouting',_0x510339);});}return respondWithRpcPromise(_0x3e71('0x56'),_0x3e71('0x57'),_0x510339);})['then'](function(_0x33a2f8){_0x15427c(_0x33a2f8);})[_0x3e71('0x18')](function(_0x5c618f){_0xaa338(_0xfad34[_0x3e71('0x16')](0x1f4,_0x5c618f[_0x3e71('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 45fec1b..1b49234 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 _0xa456=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa456,0x142));var _0x6a45=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xa456[_0x29d915];return _0x160f86;};'use strict';var FaxAccountEvents=require(_0x6a45('0x0'));var events=[_0x6a45('0x1'),_0x6a45('0x2'),_0x6a45('0x3')];function createListener(_0x587626,_0x3bfbe6){return function(_0x206f6b){_0x3bfbe6[_0x6a45('0x4')](_0x587626,_0x206f6b);};}function removeListener(_0x500c72,_0x1f0701){return function(){FaxAccountEvents[_0x6a45('0x5')](_0x500c72,_0x1f0701);};}exports[_0x6a45('0x6')]=function(_0x14da6b){for(var _0x4dfbfa=0x0,_0x25cf8d=events[_0x6a45('0x7')];_0x4dfbfa<_0x25cf8d;_0x4dfbfa++){var _0x214514=events[_0x4dfbfa];var _0x19e67c=createListener(_0x6a45('0x8')+_0x214514,_0x14da6b);FaxAccountEvents['on'](_0x214514,_0x19e67c);}}; \ No newline at end of file +var _0xba34=['faxAccount:','./faxAccount.events','save','remove','update','removeListener','register'];(function(_0x2c4a15,_0x5cd017){var _0x400a1e=function(_0x3c7a0a){while(--_0x3c7a0a){_0x2c4a15['push'](_0x2c4a15['shift']());}};_0x400a1e(++_0x5cd017);}(_0xba34,0x119));var _0x4ba3=function(_0x19514e,_0x3bdf08){_0x19514e=_0x19514e-0x0;var _0x222b69=_0xba34[_0x19514e];return _0x222b69;};'use strict';var FaxAccountEvents=require(_0x4ba3('0x0'));var events=[_0x4ba3('0x1'),_0x4ba3('0x2'),_0x4ba3('0x3')];function createListener(_0xeb0ac4,_0x4d6e75){return function(_0x5aa88e){_0x4d6e75['emit'](_0xeb0ac4,_0x5aa88e);};}function removeListener(_0x4592fc,_0x2947f2){return function(){FaxAccountEvents[_0x4ba3('0x4')](_0x4592fc,_0x2947f2);};}exports[_0x4ba3('0x5')]=function(_0x3590a1){for(var _0xb88621=0x0,_0xe5f99a=events['length'];_0xb88621<_0xe5f99a;_0xb88621++){var _0x6254fb=events[_0xb88621];var _0x368eee=createListener(_0x4ba3('0x6')+_0x6254fb,_0x3590a1);FaxAccountEvents['on'](_0x6254fb,_0x368eee);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 064d00f..bbcc1cd 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 _0x1a89=['/:id/users','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','put','update','destroy','delete','removeAnswers'];(function(_0x430535,_0x2753fb){var _0x568c4a=function(_0x1c935c){while(--_0x1c935c){_0x430535['push'](_0x430535['shift']());}};_0x568c4a(++_0x2753fb);}(_0x1a89,0x1bb));var _0x91a8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x1a89[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x91a8('0x0'));var util=require(_0x91a8('0x1'));var path=require(_0x91a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x91a8('0x3'));var router=express['Router']();var auth=require(_0x91a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x91a8('0x5'));var controller=require(_0x91a8('0x6'));router[_0x91a8('0x7')]('/',auth[_0x91a8('0x8')](),controller[_0x91a8('0x9')]);router[_0x91a8('0x7')](_0x91a8('0xa'),auth[_0x91a8('0x8')](),controller[_0x91a8('0xb')]);router[_0x91a8('0x7')](_0x91a8('0xc'),auth[_0x91a8('0x8')](),controller[_0x91a8('0xd')]);router[_0x91a8('0x7')]('/:id/dispositions',auth[_0x91a8('0x8')](),controller[_0x91a8('0xe')]);router['get'](_0x91a8('0xf'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x10')]);router[_0x91a8('0x7')](_0x91a8('0x11'),auth[_0x91a8('0x8')](),controller['getInteractions']);router['get'](_0x91a8('0x12'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x13')]);router[_0x91a8('0x7')](_0x91a8('0x14'),auth['isAuthenticated'](),controller[_0x91a8('0x15')]);router['get']('/:id/users',auth[_0x91a8('0x8')](),controller[_0x91a8('0x16')]);router[_0x91a8('0x17')]('/',auth[_0x91a8('0x8')](),controller[_0x91a8('0x18')]);router[_0x91a8('0x17')](_0x91a8('0x19'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1a')]);router[_0x91a8('0x17')](_0x91a8('0xf'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1b')]);router[_0x91a8('0x17')](_0x91a8('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x91a8('0x17')](_0x91a8('0x12'),auth['isAuthenticated'](),controller[_0x91a8('0x1c')]);router['post'](_0x91a8('0x1d'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x1e')]);router[_0x91a8('0x17')](_0x91a8('0x1f'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x20')]);router[_0x91a8('0x17')](_0x91a8('0x21'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x22')]);router[_0x91a8('0x17')]('/:id/users',auth[_0x91a8('0x8')](),controller[_0x91a8('0x23')]);router[_0x91a8('0x24')]('/:id',auth['isAuthenticated'](),controller[_0x91a8('0x25')]);router['delete'](_0x91a8('0xc'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x26')]);router[_0x91a8('0x27')](_0x91a8('0x19'),auth[_0x91a8('0x8')](),controller['removeDispositions']);router[_0x91a8('0x27')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x91a8('0x28')]);router[_0x91a8('0x27')](_0x91a8('0x29'),auth[_0x91a8('0x8')](),controller[_0x91a8('0x2a')]);module[_0x91a8('0x2b')]=router; \ No newline at end of file +var _0x800a=['../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/messages','getMessages','create','addDisposition','post','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router'];(function(_0x33ef8f,_0x567b29){var _0x397968=function(_0x1324a5){while(--_0x1324a5){_0x33ef8f['push'](_0x33ef8f['shift']());}};_0x397968(++_0x567b29);}(_0x800a,0xa7));var _0xa800=function(_0x44fb58,_0x56ee04){_0x44fb58=_0x44fb58-0x0;var _0x3d69be=_0x800a[_0x44fb58];return _0x3d69be;};'use strict';var multer=require(_0xa800('0x0'));var util=require('util');var path=require(_0xa800('0x1'));var timeout=require(_0xa800('0x2'));var express=require(_0xa800('0x3'));var router=express[_0xa800('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa800('0x5'));var config=require(_0xa800('0x6'));var controller=require(_0xa800('0x7'));router[_0xa800('0x8')]('/',auth[_0xa800('0x9')](),controller[_0xa800('0xa')]);router['get'](_0xa800('0xb'),auth[_0xa800('0x9')](),controller[_0xa800('0xc')]);router[_0xa800('0x8')](_0xa800('0xd'),auth[_0xa800('0x9')](),controller[_0xa800('0xe')]);router[_0xa800('0x8')](_0xa800('0xf'),auth['isAuthenticated'](),controller[_0xa800('0x10')]);router[_0xa800('0x8')](_0xa800('0x11'),auth[_0xa800('0x9')](),controller[_0xa800('0x12')]);router[_0xa800('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xa800('0x8')](_0xa800('0x13'),auth[_0xa800('0x9')](),controller[_0xa800('0x14')]);router['get'](_0xa800('0x15'),auth[_0xa800('0x9')](),controller[_0xa800('0x16')]);router['get']('/:id/users',auth[_0xa800('0x9')](),controller['getAgents']);router['post']('/',auth[_0xa800('0x9')](),controller[_0xa800('0x17')]);router['post'](_0xa800('0xf'),auth[_0xa800('0x9')](),controller[_0xa800('0x18')]);router[_0xa800('0x19')](_0xa800('0x11'),auth[_0xa800('0x9')](),controller[_0xa800('0x1a')]);router[_0xa800('0x19')]('/:id/interactions',auth[_0xa800('0x9')](),controller[_0xa800('0x1b')]);router[_0xa800('0x19')](_0xa800('0x13'),auth[_0xa800('0x9')](),controller[_0xa800('0x1c')]);router['post'](_0xa800('0x1d'),auth[_0xa800('0x9')](),controller[_0xa800('0x1e')]);router[_0xa800('0x19')](_0xa800('0x1f'),auth[_0xa800('0x9')](),controller[_0xa800('0x20')]);router[_0xa800('0x19')](_0xa800('0x21'),auth[_0xa800('0x9')](),controller[_0xa800('0x22')]);router['post'](_0xa800('0x23'),auth[_0xa800('0x9')](),controller[_0xa800('0x24')]);router['put'](_0xa800('0xd'),auth[_0xa800('0x9')](),controller['update']);router[_0xa800('0x25')]('/:id',auth[_0xa800('0x9')](),controller[_0xa800('0x26')]);router['delete'](_0xa800('0xf'),auth['isAuthenticated'](),controller[_0xa800('0x27')]);router[_0xa800('0x25')](_0xa800('0x11'),auth[_0xa800('0x9')](),controller[_0xa800('0x28')]);router['delete'](_0xa800('0x23'),auth['isAuthenticated'](),controller[_0xa800('0x29')]);module[_0xa800('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0f54e6b..74e63c0 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 _0xcaf2=['STRING','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x4654d5,_0x55fdf3){var _0x2da3f9=function(_0x8cd30a){while(--_0x8cd30a){_0x4654d5['push'](_0x4654d5['shift']());}};_0x2da3f9(++_0x55fdf3);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2226c1,_0x2bed75){_0x2226c1=_0x2226c1-0x0;var _0x178716=_0xcaf2[_0x2226c1];return _0x178716;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'priority':{'type':Sequelize[_0x2caf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2caf('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2caf('0x3')]()},'description':{'type':Sequelize[_0x2caf('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2caf('0x4')}}; \ No newline at end of file +var _0x3fce=['INTEGER','STRING','noop','TEXT','exports'];(function(_0x411aee,_0x544e64){var _0x36d73e=function(_0x3d98d1){while(--_0x3d98d1){_0x411aee['push'](_0x411aee['shift']());}};_0x36d73e(++_0x544e64);}(_0x3fce,0x121));var _0xe3fc=function(_0x39cbe4,_0x4a7958){_0x39cbe4=_0x39cbe4-0x0;var _0xe76ba7=_0x3fce[_0x39cbe4];return _0xe76ba7;};'use strict';var Sequelize=require('sequelize');module[_0xe3fc('0x0')]={'priority':{'type':Sequelize[_0xe3fc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe3fc('0x2')],'allowNull':![],'defaultValue':_0xe3fc('0x3')},'appdata':{'type':Sequelize[_0xe3fc('0x4')]()},'description':{'type':Sequelize[_0xe3fc('0x2')]},'interval':{'type':Sequelize[_0xe3fc('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f3bfa4c..eeb9ddc 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 _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x4ec596,_0x1d03ce){var _0x26e5db=function(_0x176d6b){while(--_0x176d6b){_0x4ec596['push'](_0x4ec596['shift']());}};_0x26e5db(++_0x1d03ce);}(_0x8ef6,0xf2));var _0x68ef=function(_0x457022,_0xf9a1fa){_0x457022=_0x457022-0x0;var _0x3e1186=_0x8ef6[_0x457022];return _0x3e1186;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file +var _0x7fbe=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','FaxApplication','includeAll','findAll','rows','show','params','include','options','catch','create','body','destroy','find','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','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','save','update','then','error','name','send','index'];(function(_0x157a8a,_0x34d072){var _0x5bf33f=function(_0x4fc182){while(--_0x4fc182){_0x157a8a['push'](_0x157a8a['shift']());}};_0x5bf33f(++_0x34d072);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5d869e,_0x1731bd){_0x5d869e=_0x5d869e-0x0;var _0x13a90b=_0x7fbe[_0x5d869e];return _0x13a90b;};'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 db=require(_0xe7fb('0x19'))['db'];function respondWithStatusCode(_0x2fe8ab,_0x2437d4){_0x2437d4=_0x2437d4||0xcc;return function(_0x188e1d){if(_0x188e1d){return _0x2fe8ab[_0xe7fb('0x1a')](_0x2437d4);}return _0x2fe8ab[_0xe7fb('0x1b')](_0x2437d4)[_0xe7fb('0x1c')]();};}function respondWithResult(_0x598729,_0x278b75){_0x278b75=_0x278b75||0xc8;return function(_0x2225e5){if(_0x2225e5){return _0x598729['status'](_0x278b75)[_0xe7fb('0x1d')](_0x2225e5);}};}function respondWithFilteredResult(_0x37eb9f,_0x482f7d){return function(_0xa76acf){if(_0xa76acf){var _0x559129=_0xa76acf[_0xe7fb('0x1e')],_0x12fff6=_0x482f7d['offset'],_0x18d23c=_0x482f7d[_0xe7fb('0x1f')]+_0x482f7d['limit'],_0x12603d;if(_0x18d23c>=_0x559129){_0x18d23c=_0x559129;_0x12603d=0xc8;}else{_0x12603d=0xce;}_0x37eb9f[_0xe7fb('0x1b')](_0x12603d);return _0x37eb9f['set'](_0xe7fb('0x20'),_0x12fff6+'-'+_0x18d23c+'/'+_0x559129)[_0xe7fb('0x1d')](_0xa76acf);}return null;};}function patchUpdates(_0x3f96a7){return function(_0x182269){try{jsonpatch['apply'](_0x182269,_0x3f96a7,!![]);}catch(_0x44466e){return BPromise['reject'](_0x44466e);}return _0x182269[_0xe7fb('0x21')]();};}function saveUpdates(_0x51f01f,_0x15f7a4){return function(_0x4ea664){if(_0x4ea664){return _0x4ea664[_0xe7fb('0x22')](_0x51f01f)[_0xe7fb('0x23')](function(_0x4a9994){return _0x4a9994;});}return null;};}function removeEntity(_0x143eb6,_0x4742bd){return function(_0x3ae8f1){if(_0x3ae8f1){return _0x3ae8f1['destroy']()[_0xe7fb('0x23')](function(){_0x143eb6[_0xe7fb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(!_0x35e4db){_0x5bea27['sendStatus'](0x194);}return _0x35e4db;};}function handleError(_0x49b219,_0x4026b1){_0x4026b1=_0x4026b1||0x1f4;return function(_0x32e8b2){logger[_0xe7fb('0x24')](_0x32e8b2['stack']);if(_0x32e8b2[_0xe7fb('0x25')]){delete _0x32e8b2[_0xe7fb('0x25')];}_0x49b219[_0xe7fb('0x1b')](_0x4026b1)[_0xe7fb('0x26')](_0x32e8b2);};}exports[_0xe7fb('0x27')]=function(_0x16237a,_0x380130){var _0x59e015={},_0x5df9f2={},_0x1086e6={'count':0x0,'rows':[]};var _0x3bdee9=_[_0xe7fb('0x28')](db['FaxApplication'][_0xe7fb('0x29')],function(_0x251807){return{'name':_0x251807[_0xe7fb('0x2a')],'type':_0x251807[_0xe7fb('0x2b')][_0xe7fb('0x2c')]};});_0x5df9f2[_0xe7fb('0x2d')]=_[_0xe7fb('0x28')](_0x3bdee9,_0xe7fb('0x25'));_0x5df9f2['query']=_[_0xe7fb('0x2e')](_0x16237a[_0xe7fb('0x2f')]);_0x5df9f2[_0xe7fb('0x30')]=_['intersection'](_0x5df9f2['model'],_0x5df9f2[_0xe7fb('0x2f')]);_0x59e015['attributes']=_[_0xe7fb('0x31')](_0x5df9f2[_0xe7fb('0x2d')],qs[_0xe7fb('0x32')](_0x16237a[_0xe7fb('0x2f')]['fields']));_0x59e015[_0xe7fb('0x33')]=_0x59e015[_0xe7fb('0x33')][_0xe7fb('0x34')]?_0x59e015[_0xe7fb('0x33')]:_0x5df9f2[_0xe7fb('0x2d')];if(!_0x16237a['query'][_0xe7fb('0x35')](_0xe7fb('0x36'))){_0x59e015[_0xe7fb('0x37')]=qs[_0xe7fb('0x37')](_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x37')]);_0x59e015[_0xe7fb('0x1f')]=qs[_0xe7fb('0x1f')](_0x16237a[_0xe7fb('0x2f')]['offset']);}_0x59e015[_0xe7fb('0x38')]=qs[_0xe7fb('0x39')](_0x16237a[_0xe7fb('0x2f')]['sort']);_0x59e015[_0xe7fb('0x3a')]=qs[_0xe7fb('0x30')](_[_0xe7fb('0x3b')](_0x16237a[_0xe7fb('0x2f')],_0x5df9f2[_0xe7fb('0x30')]),_0x3bdee9);if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]){_0x59e015[_0xe7fb('0x3a')]=_[_0xe7fb('0x3d')](_0x59e015[_0xe7fb('0x3a')],{'$or':_[_0xe7fb('0x28')](_0x3bdee9,function(_0x3c4f4b){if(_0x3c4f4b[_0xe7fb('0x2b')]!==_0xe7fb('0x3e')){var _0xeb7c29={};_0xeb7c29[_0x3c4f4b[_0xe7fb('0x25')]]={'$like':'%'+_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x3c')]+'%'};return _0xeb7c29;}})});}_0x59e015=_[_0xe7fb('0x3d')]({},_0x59e015,_0x16237a['options']);var _0x261ec5={'where':_0x59e015[_0xe7fb('0x3a')]};return db[_0xe7fb('0x3f')][_0xe7fb('0x1e')](_0x261ec5)['then'](function(_0x3426a9){_0x1086e6[_0xe7fb('0x1e')]=_0x3426a9;if(_0x16237a[_0xe7fb('0x2f')][_0xe7fb('0x40')]){_0x59e015['include']=[{'all':!![]}];}return db[_0xe7fb('0x3f')][_0xe7fb('0x41')](_0x59e015);})[_0xe7fb('0x23')](function(_0x62a8a1){_0x1086e6[_0xe7fb('0x42')]=_0x62a8a1;return _0x1086e6;})[_0xe7fb('0x23')](respondWithFilteredResult(_0x380130,_0x59e015))['catch'](handleError(_0x380130,null));};exports[_0xe7fb('0x43')]=function(_0x35139f,_0x3a96cd){var _0x4b263d={'raw':!![],'where':{'id':_0x35139f[_0xe7fb('0x44')]['id']}},_0x36a341={};_0x36a341['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x36a341['query']=_[_0xe7fb('0x2e')](_0x35139f[_0xe7fb('0x2f')]);_0x36a341[_0xe7fb('0x30')]=_['intersection'](_0x36a341[_0xe7fb('0x2d')],_0x36a341['query']);_0x4b263d[_0xe7fb('0x33')]=_[_0xe7fb('0x31')](_0x36a341['model'],qs[_0xe7fb('0x32')](_0x35139f[_0xe7fb('0x2f')][_0xe7fb('0x32')]));_0x4b263d[_0xe7fb('0x33')]=_0x4b263d['attributes'][_0xe7fb('0x34')]?_0x4b263d[_0xe7fb('0x33')]:_0x36a341[_0xe7fb('0x2d')];if(_0x35139f['query'][_0xe7fb('0x40')]){_0x4b263d[_0xe7fb('0x45')]=[{'all':!![]}];}_0x4b263d=_[_0xe7fb('0x3d')]({},_0x4b263d,_0x35139f[_0xe7fb('0x46')]);return db[_0xe7fb('0x3f')]['find'](_0x4b263d)[_0xe7fb('0x23')](handleEntityNotFound(_0x3a96cd,null))['then'](respondWithResult(_0x3a96cd,null))[_0xe7fb('0x47')](handleError(_0x3a96cd,null));};exports[_0xe7fb('0x48')]=function(_0x3520e3,_0x1ecbfd){return db[_0xe7fb('0x3f')]['create'](_0x3520e3[_0xe7fb('0x49')],{})['then'](respondWithResult(_0x1ecbfd,0xc9))['catch'](handleError(_0x1ecbfd,null));};exports[_0xe7fb('0x22')]=function(_0x3d740f,_0x16327f){if(_0x3d740f['body']['id']){delete _0x3d740f[_0xe7fb('0x49')]['id'];}return db[_0xe7fb('0x3f')]['find']({'where':{'id':_0x3d740f['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x16327f,null))[_0xe7fb('0x23')](saveUpdates(_0x3d740f[_0xe7fb('0x49')],null))[_0xe7fb('0x23')](respondWithResult(_0x16327f,null))[_0xe7fb('0x47')](handleError(_0x16327f,null));};exports[_0xe7fb('0x4a')]=function(_0x18a590,_0x347177){return db['FaxApplication'][_0xe7fb('0x4b')]({'where':{'id':_0x18a590['params']['id']}})[_0xe7fb('0x23')](handleEntityNotFound(_0x347177,null))[_0xe7fb('0x23')](removeEntity(_0x347177,null))['catch'](handleError(_0x347177,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4c07dd9..0015d1d 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 _0x34af=['FaxApplication','fax_applications','utf8mb4_unicode_ci','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0xc29e65,_0x7f1e9e){var _0x36240d=function(_0x29a1ce){while(--_0x29a1ce){_0xc29e65['push'](_0xc29e65['shift']());}};_0x36240d(++_0x7f1e9e);}(_0x34af,0xfd));var _0xf34a=function(_0x14a87e,_0x20d331){_0x14a87e=_0x14a87e-0x0;var _0x5509c2=_0x34af[_0x14a87e];return _0x5509c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf34a('0x0'));var moment=require(_0xf34a('0x1'));var BPromise=require(_0xf34a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf34a('0x3'));var rimraf=require('rimraf');var config=require(_0xf34a('0x4'));var attributes=require('./faxApplication.attributes');module[_0xf34a('0x5')]=function(_0x2bdf6b,_0x4610fb){return _0x2bdf6b[_0xf34a('0x6')](_0xf34a('0x7'),attributes,{'tableName':_0xf34a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf34a('0x9')});}; \ No newline at end of file +var _0x6100=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x50dd2d,_0x2ed7d5){var _0x7b56fc=function(_0x48ce66){while(--_0x48ce66){_0x50dd2d['push'](_0x50dd2d['shift']());}};_0x7b56fc(++_0x2ed7d5);}(_0x6100,0xa8));var _0x0610=function(_0x21eab1,_0x4242d0){_0x21eab1=_0x21eab1-0x0;var _0x30f982=_0x6100[_0x21eab1];return _0x30f982;};'use strict';var _=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var logger=require(_0x0610('0x2'))('api');var moment=require(_0x0610('0x3'));var BPromise=require(_0x0610('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0610('0x5'));var rimraf=require(_0x0610('0x6'));var config=require(_0x0610('0x7'));var attributes=require(_0x0610('0x8'));module[_0x0610('0x9')]=function(_0x18a3ef,_0x2924f9){return _0x18a3ef[_0x0610('0xa')](_0x0610('0xb'),attributes,{'tableName':_0x0610('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0610('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c413871..6bf0e83 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 _0x5c49=['stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','UpdateFaxApplication','update','body','options','where','attributes','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x26c4ec,_0x292d7c){var _0x455b9c=function(_0x27400f){while(--_0x27400f){_0x26c4ec['push'](_0x26c4ec['shift']());}};_0x455b9c(++_0x292d7c);}(_0x5c49,0x176));var _0x95c4=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x5c49[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0x95c4('0x0'));var util=require(_0x95c4('0x1'));var moment=require('moment');var BPromise=require(_0x95c4('0x2'));var rs=require(_0x95c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95c4('0x5'))('rpc');var config=require(_0x95c4('0x6'));var jayson=require(_0x95c4('0x7'));var client=jayson[_0x95c4('0x8')][_0x95c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5983fc,_0xd7f1a4,_0x33351d){return new BPromise(function(_0x3c1a39,_0x55838a){return client[_0x95c4('0xa')](_0x5983fc,_0x33351d)[_0x95c4('0xb')](function(_0x2bfe64){logger[_0x95c4('0xc')]('FaxApplication,\x20%s,\x20%s',_0xd7f1a4,_0x95c4('0xd'));logger[_0x95c4('0xe')](_0x95c4('0xf'),_0xd7f1a4,_0x95c4('0xd'),JSON[_0x95c4('0x10')](_0x2bfe64));if(_0x2bfe64[_0x95c4('0x11')]){if(_0x2bfe64['error'][_0x95c4('0x12')]===0x1f4){logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x2bfe64[_0x95c4('0x11')][_0x95c4('0x14')]);return _0x55838a(_0x2bfe64[_0x95c4('0x11')][_0x95c4('0x14')]);}logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x2bfe64[_0x95c4('0x11')]['message']);return _0x3c1a39(_0x2bfe64['error']['message']);}else{logger[_0x95c4('0xc')]('FaxApplication,\x20%s,\x20%s',_0xd7f1a4,_0x95c4('0xd'));_0x3c1a39(_0x2bfe64[_0x95c4('0x15')][_0x95c4('0x14')]);}})['catch'](function(_0x3d8ff0){logger[_0x95c4('0x11')](_0x95c4('0x13'),_0xd7f1a4,_0x3d8ff0);_0x55838a(_0x3d8ff0);});});}exports[_0x95c4('0x16')]=function(_0x169bd7){var _0x25a468=this;return new Promise(function(_0x55bc90,_0x150f2b){return db['FaxApplication'][_0x95c4('0x17')](_0x169bd7[_0x95c4('0x18')],{'raw':_0x169bd7['options']?_0x169bd7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1a')]||null:null,'attributes':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1b')]||null:null,'limit':_0x169bd7[_0x95c4('0x19')]?_0x169bd7[_0x95c4('0x19')][_0x95c4('0x1c')]||null:null})[_0x95c4('0xb')](function(_0x422149){logger['info'](_0x95c4('0x16'),_0x169bd7);logger[_0x95c4('0xe')](_0x95c4('0x16'),_0x169bd7,JSON['stringify'](_0x422149));_0x55bc90(_0x422149);})[_0x95c4('0x1d')](function(_0x46713a){logger['error'](_0x95c4('0x16'),_0x46713a[_0x95c4('0x14')],_0x169bd7);_0x150f2b(_0x25a468[_0x95c4('0x11')](0x1f4,_0x46713a['message']));});});}; \ No newline at end of file +var _0xa266=['stringify','error','code','message','info','result','catch','UpdateFaxApplication','update','body','options','raw','where','limit','then','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x24d5b5,_0x383522){var _0x39a57d=function(_0x1c5aa0){while(--_0x1c5aa0){_0x24d5b5['push'](_0x24d5b5['shift']());}};_0x39a57d(++_0x383522);}(_0xa266,0xdb));var _0x6a26=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xa266[_0xf26d40];return _0x50b68c;};'use strict';var _=require(_0x6a26('0x0'));var util=require(_0x6a26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a26('0x2'));var db=require(_0x6a26('0x3'))['db'];var utils=require(_0x6a26('0x4'));var logger=require('../../config/logger')(_0x6a26('0x5'));var config=require(_0x6a26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6a26('0x7')][_0x6a26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c7a67,_0x55000f,_0x2fab35){return new BPromise(function(_0x4b8b0c,_0x58fc71){return client[_0x6a26('0x9')](_0x4c7a67,_0x2fab35)['then'](function(_0x1ec5fb){logger['info'](_0x6a26('0xa'),_0x55000f,_0x6a26('0xb'));logger['debug'](_0x6a26('0xc'),_0x55000f,_0x6a26('0xb'),JSON[_0x6a26('0xd')](_0x1ec5fb));if(_0x1ec5fb[_0x6a26('0xe')]){if(_0x1ec5fb[_0x6a26('0xe')][_0x6a26('0xf')]===0x1f4){logger[_0x6a26('0xe')]('FaxApplication,\x20%s,\x20%s',_0x55000f,_0x1ec5fb[_0x6a26('0xe')][_0x6a26('0x10')]);return _0x58fc71(_0x1ec5fb[_0x6a26('0xe')][_0x6a26('0x10')]);}logger[_0x6a26('0xe')](_0x6a26('0xa'),_0x55000f,_0x1ec5fb['error'][_0x6a26('0x10')]);return _0x4b8b0c(_0x1ec5fb[_0x6a26('0xe')][_0x6a26('0x10')]);}else{logger[_0x6a26('0x11')](_0x6a26('0xa'),_0x55000f,'request\x20sent');_0x4b8b0c(_0x1ec5fb[_0x6a26('0x12')]['message']);}})[_0x6a26('0x13')](function(_0x2223c9){logger[_0x6a26('0xe')](_0x6a26('0xa'),_0x55000f,_0x2223c9);_0x58fc71(_0x2223c9);});});}exports[_0x6a26('0x14')]=function(_0x50c68e){var _0x51a550=this;return new Promise(function(_0x2b5004,_0x2a1697){return db['FaxApplication'][_0x6a26('0x15')](_0x50c68e[_0x6a26('0x16')],{'raw':_0x50c68e[_0x6a26('0x17')]?_0x50c68e[_0x6a26('0x17')][_0x6a26('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c68e['options']?_0x50c68e['options'][_0x6a26('0x19')]||null:null,'attributes':_0x50c68e['options']?_0x50c68e[_0x6a26('0x17')]['attributes']||null:null,'limit':_0x50c68e['options']?_0x50c68e[_0x6a26('0x17')][_0x6a26('0x1a')]||null:null})[_0x6a26('0x1b')](function(_0x187ddb){logger[_0x6a26('0x11')]('UpdateFaxApplication',_0x50c68e);logger[_0x6a26('0x1c')](_0x6a26('0x14'),_0x50c68e,JSON[_0x6a26('0xd')](_0x187ddb));_0x2b5004(_0x187ddb);})['catch'](function(_0x13b48f){logger[_0x6a26('0xe')](_0x6a26('0x14'),_0x13b48f[_0x6a26('0x10')],_0x50c68e);_0x2a1697(_0x51a550[_0x6a26('0xe')](0x1f4,_0x13b48f[_0x6a26('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 86acb34..cfc5cf4 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 _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated'];(function(_0x1ae6b3,_0x3290bb){var _0x311586=function(_0x5f3978){while(--_0x5f3978){_0x1ae6b3['push'](_0x1ae6b3['shift']());}};_0x311586(++_0x3290bb);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4ff30d,_0x822aa){_0x4ff30d=_0x4ff30d-0x0;var _0x15b604=_0x3f8a[_0x4ff30d];return _0x15b604;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xc166a1,_0x5412e2){var _0x448ef2=function(_0x2a118d){while(--_0x2a118d){_0xc166a1['push'](_0xc166a1['shift']());}};_0x448ef2(++_0x5412e2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x6e60b8,_0x41c325){_0x6e60b8=_0x6e60b8-0x0;var _0x28967d=_0x1cb9[_0x6e60b8];return _0x28967d;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./faxApplication.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0xb')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['put'](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xd')]);router[_0x91cb('0xe')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xf')]);module[_0x91cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 966069c..58f733b 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 _0xffdf=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffdf,0xc0));var _0xfffd=function(_0xe563d5,_0x417bf7){_0xe563d5=_0xe563d5-0x0;var _0x1572c8=_0xffdf[_0xe563d5];return _0x1572c8;};'use strict';var Sequelize=require(_0xfffd('0x0'));module[_0xfffd('0x1')]={'closed':{'type':Sequelize[_0xfffd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfffd('0x3')]},'disposition':{'type':Sequelize[_0xfffd('0x4')]},'note':{'type':Sequelize[_0xfffd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfffd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfffd('0x5')]('in',_0xfffd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfffd('0x5')]('in',_0xfffd('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x91c3=['DATE','STRING','ENUM','out','sequelize'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x91c3,0x72));var _0x391c=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0x91c3[_0x36b400];return _0x4d47bf;};'use strict';var Sequelize=require(_0x391c('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x391c('0x1')]},'disposition':{'type':Sequelize[_0x391c('0x2')]},'note':{'type':Sequelize[_0x391c('0x2')]},'read1stAt':{'type':Sequelize[_0x391c('0x1')]},'fax':{'type':Sequelize[_0x391c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x391c('0x3')]('in',_0x391c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x391c('0x3')]('in',_0x391c('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index d451718..3779870 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 _0xbd20=['getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','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','start','body','keys','some','isEmpty','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','count','keyBy','FaxInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','setTags','emit','faxInteractionTags:save','removeTags','download','unix','join','tmp','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fullname','TagIds','Tags','forEach','push','catch','index','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xbd20,0x14a));var _0x0bd2=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0xbd20[_0x103762];return _0x24844e;};'use strict';var pdf=require(_0x0bd2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bd2('0x1'));var jsonpatch=require(_0x0bd2('0x2'));var rp=require(_0x0bd2('0x3'));var moment=require(_0x0bd2('0x4'));var BPromise=require(_0x0bd2('0x5'));var Mustache=require('mustache');var util=require(_0x0bd2('0x6'));var path=require(_0x0bd2('0x7'));var sox=require(_0x0bd2('0x8'));var csv=require('to-csv');var ejs=require(_0x0bd2('0x9'));var fs=require('fs');var _=require(_0x0bd2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bd2('0xb'));var deskjs=require(_0x0bd2('0xc'));var toCsv=require(_0x0bd2('0xd'));var querystring=require(_0x0bd2('0xe'));var Papa=require(_0x0bd2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0bd2('0x10'));var as=require(_0x0bd2('0x11'));var hardwareService=require(_0x0bd2('0x12'));var logger=require(_0x0bd2('0x13'))(_0x0bd2('0x14'));var utils=require('../../config/utils');var config=require(_0x0bd2('0x15'));var db=require('../../mysqldb')['db'];config[_0x0bd2('0x16')]=_[_0x0bd2('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0bd2('0x18'))(new Redis(config[_0x0bd2('0x16')]));require(_0x0bd2('0x19'))[_0x0bd2('0x1a')](socket);function respondWithStatusCode(_0x2abcc8,_0x561b0f){_0x561b0f=_0x561b0f||0xcc;return function(_0x5009b4){if(_0x5009b4){return _0x2abcc8[_0x0bd2('0x1b')](_0x561b0f);}return _0x2abcc8[_0x0bd2('0x1c')](_0x561b0f)['end']();};}function respondWithResult(_0x283f31,_0xd988bb){_0xd988bb=_0xd988bb||0xc8;return function(_0x26dbe1){if(_0x26dbe1){return _0x283f31[_0x0bd2('0x1c')](_0xd988bb)[_0x0bd2('0x1d')](_0x26dbe1);}};}function respondWithFilteredResult(_0x19e2e3,_0x36001b){return function(_0x51d4d6){if(_0x51d4d6){var _0x56902d=_0x51d4d6['count'],_0x21aedf=_0x36001b[_0x0bd2('0x1e')],_0x5d6cef=_0x36001b['offset']+_0x36001b[_0x0bd2('0x1f')],_0x452a9b;if(_0x5d6cef>=_0x56902d){_0x5d6cef=_0x56902d;_0x452a9b=0xc8;}else{_0x452a9b=0xce;}_0x19e2e3['status'](_0x452a9b);return _0x19e2e3[_0x0bd2('0x20')](_0x0bd2('0x21'),_0x21aedf+'-'+_0x5d6cef+'/'+_0x56902d)[_0x0bd2('0x1d')](_0x51d4d6);}return null;};}function patchUpdates(_0x4b1a3e){return function(_0x21206b){try{jsonpatch[_0x0bd2('0x22')](_0x21206b,_0x4b1a3e,!![]);}catch(_0x18336d){return BPromise[_0x0bd2('0x23')](_0x18336d);}return _0x21206b[_0x0bd2('0x24')]();};}function saveUpdates(_0x5cdac7,_0x36b3c4){return function(_0x318b7d){if(_0x318b7d){return _0x318b7d[_0x0bd2('0x25')](_0x5cdac7)[_0x0bd2('0x26')](function(_0x277ae9){return _0x277ae9;});}return null;};}function removeEntity(_0x343a99,_0xe47fb){return function(_0x2cd160){if(_0x2cd160){return _0x2cd160[_0x0bd2('0x27')]()[_0x0bd2('0x26')](function(){_0x343a99[_0x0bd2('0x1c')](0xcc)[_0x0bd2('0x28')]();});}};}function handleEntityNotFound(_0x3760a4,_0x3a3eff){return function(_0x1b4c9e){if(!_0x1b4c9e){_0x3760a4[_0x0bd2('0x1b')](0x194);}return _0x1b4c9e;};}function handleError(_0x3d63f2,_0x5f0514){_0x5f0514=_0x5f0514||0x1f4;return function(_0x5b8061){logger[_0x0bd2('0x29')](_0x5b8061[_0x0bd2('0x2a')]);if(_0x5b8061[_0x0bd2('0x2b')]){delete _0x5b8061[_0x0bd2('0x2b')];}_0x3d63f2[_0x0bd2('0x1c')](_0x5f0514)[_0x0bd2('0x2c')](_0x5b8061);};}function getInteractionUsers(_0x4d7ba1,_0x459bd6){return new BPromise(function(_0x507a1e,_0x37e5a4){try{if(_0x459bd6[_0x4d7ba1['id']]){_0x4d7ba1['Users']=_[_0x0bd2('0x2d')](_0x459bd6[_0x4d7ba1['id']],function(_0x4a4e46){return{'id':_0x4a4e46['id'],'fullname':_0x4a4e46[_0x0bd2('0x2e')]};});}}catch(_0x2c7196){_0x37e5a4(_0x2c7196);}_0x507a1e(_0x4d7ba1);});}function getInteractionTags(_0x5bdbf5,_0x28d658){return new BPromise(function(_0x5681a0,_0x4ebc65){try{if(_0x5bdbf5[_0x0bd2('0x2f')]){_0x5bdbf5[_0x0bd2('0x30')]=[];_0x5bdbf5[_0x0bd2('0x2f')]['split'](',')[_0x0bd2('0x31')](function(_0x472414){_0x5bdbf5['Tags'][_0x0bd2('0x32')](_0x28d658[_0x472414]);});}delete _0x5bdbf5[_0x0bd2('0x2f')];}catch(_0x255afe){_0x4ebc65(_0x255afe);}_0x5681a0(_0x5bdbf5);});}function updateFaxInteraction(_0x5e60ee,_0x179786,_0x4138f2){return new BPromise(function(_0xce45ca,_0x2bf436){return getInteractionUsers(_0x5e60ee,_0x4138f2)[_0x0bd2('0x26')](function(_0x546ff3){return getInteractionTags(_0x546ff3,_0x179786);})[_0x0bd2('0x26')](function(_0x5adb10){_0xce45ca(_0x5adb10);})[_0x0bd2('0x33')](function(_0x344cff){_0x2bf436(_0x344cff);});});}exports[_0x0bd2('0x34')]=function(_0x350151,_0x377489){var _0x2c84d3={},_0x55bf9d={},_0x3e0e0e={'count':0x0,'rows':[]};var _0x469399=_[_0x0bd2('0x2d')](db['FaxInteraction']['rawAttributes'],function(_0x20d02a){return{'name':_0x20d02a[_0x0bd2('0x35')],'type':_0x20d02a[_0x0bd2('0x36')][_0x0bd2('0x37')]};});_0x55bf9d['model']=_['map'](_0x469399,_0x0bd2('0x2b'));_0x55bf9d[_0x0bd2('0x38')]=_['keys'](_0x350151[_0x0bd2('0x38')]);_0x55bf9d[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x55bf9d[_0x0bd2('0x3b')],_0x55bf9d[_0x0bd2('0x38')]);_0x2c84d3[_0x0bd2('0x3c')]=_['intersection'](_0x55bf9d[_0x0bd2('0x3b')],qs[_0x0bd2('0x3d')](_0x350151[_0x0bd2('0x38')][_0x0bd2('0x3d')]));_0x2c84d3[_0x0bd2('0x3c')]=_0x2c84d3[_0x0bd2('0x3c')][_0x0bd2('0x3e')]?_0x2c84d3[_0x0bd2('0x3c')]:_0x55bf9d[_0x0bd2('0x3b')];if(!_0x350151['query'][_0x0bd2('0x3f')](_0x0bd2('0x40'))){_0x2c84d3[_0x0bd2('0x1f')]=qs['limit'](_0x350151[_0x0bd2('0x38')][_0x0bd2('0x1f')]);_0x2c84d3[_0x0bd2('0x1e')]=qs['offset'](_0x350151[_0x0bd2('0x38')]['offset']);}_0x2c84d3[_0x0bd2('0x41')]=qs[_0x0bd2('0x42')](_0x350151[_0x0bd2('0x38')]['sort']);_0x2c84d3['where']=qs['filters'](_[_0x0bd2('0x43')](_0x350151['query'],_0x55bf9d[_0x0bd2('0x39')]),_0x469399);var _0x31d7f6=[];var _0x385dec=squel[_0x0bd2('0x44')]()[_0x0bd2('0x45')]('id')[_0x0bd2('0x45')](_0x0bd2('0x2b'))[_0x0bd2('0x45')](_0x0bd2('0x46'))[_0x0bd2('0x47')](_0x0bd2('0x48'));var _0xc7bc8e=squel[_0x0bd2('0x44')]()[_0x0bd2('0x45')](_0x0bd2('0x49'))[_0x0bd2('0x45')](_0x0bd2('0x4a'))[_0x0bd2('0x45')](_0x0bd2('0x4b'))[_0x0bd2('0x47')]('user_has_fax_interactions','ui')[_0x0bd2('0x4c')](_0x0bd2('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x4fef17=squel['select']()[_0x0bd2('0x47')](_0x0bd2('0x4e'),'i')[_0x0bd2('0x4c')](_0x0bd2('0x4f'),'c',_0x0bd2('0x50'))[_0x0bd2('0x4c')]('users','o',_0x0bd2('0x51'))[_0x0bd2('0x4c')](_0x0bd2('0x52'),'a',_0x0bd2('0x53'))['left_join']('fax_messages','me',_0x0bd2('0x54'))[_0x0bd2('0x4c')](_0x0bd2('0x55'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x0bd2('0x4c')](_0x0bd2('0x48'),'t',_0x0bd2('0x56'));var _0x59bbfb=squel[_0x0bd2('0x57')]();var _0x47475=[];var _0x286cb4=squel[_0x0bd2('0x57')]();var _0x54709c;if(_0x350151['query'][_0x0bd2('0x58')]){_0x54709c=as[_0x0bd2('0x59')](_0x350151['query']['search']);var _0x3f46b1=_0x54709c['sqlOperator'];for(var _0x4dbf8e=0x0;_0x4dbf8e<_0x54709c[_0x0bd2('0x5a')][_0x0bd2('0x3e')];_0x4dbf8e++){var _0x6a468b=_0x54709c[_0x0bd2('0x5a')][_0x4dbf8e];var _0x32f00e='i';var _0x5de5b4=_[_0x0bd2('0x5b')](_0x469399,[_0x0bd2('0x2b'),_0x6a468b['field']]);if(!_0x5de5b4){switch(_0x6a468b[_0x0bd2('0x45')]){case _0x0bd2('0x5c'):if(_0x6a468b[_0x0bd2('0x5d')]==0x1){_0x4fef17[_0x0bd2('0x5e')]('`'+_0x6a468b[_0x0bd2('0x45')]+_0x0bd2('0x5f'));}else{_0x4fef17['having']('`'+_0x6a468b[_0x0bd2('0x45')]+_0x0bd2('0x60'));}break;case _0x0bd2('0x61'):if(_0x6a468b['operator']===_0x0bd2('0x62')){if(_0x6a468b['value'][_0x0bd2('0x63')]('\x20')[_0x0bd2('0x3e')]>0x1){_0x59bbfb[_0x3f46b1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0bd2('0x64')](_0x6a468b[_0x0bd2('0x5d')]),null);}else{var _0x51af04='%'+_0x6a468b[_0x0bd2('0x5d')]+'%';_0x59bbfb[_0x3f46b1](_0x0bd2('0x65'),_0x51af04,_0x51af04,_0x51af04);}}else{_0x5de5b4=_['find'](_0x469399,[_0x0bd2('0x2b'),'ContactId']);_0x6a468b[_0x0bd2('0x45')]=_0x0bd2('0x66');_0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4[_0x0bd2('0x36')],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae['value']['start'],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);}break;case _0x0bd2('0x69'):var _0x5c6345=_0x6a468b[_0x0bd2('0x5d')]['split'](',')[_0x0bd2('0x2d')](function(_0x5b7fb6){return Number(_0x5b7fb6);});_0x5c6345[_0x0bd2('0x31')](function(_0x59e226){_0x286cb4['or'](_0x0bd2('0x6a'),'%,'+_0x59e226+',%');});_0x47475=_[_0x0bd2('0x6b')](_0x47475,_0x5c6345);break;case _0x0bd2('0x6c'):if(_0x6a468b[_0x0bd2('0x6d')]===_0x0bd2('0x62')){_0x59bbfb[_0x3f46b1](_0x0bd2('0x6e'),'%'+_0x6a468b[_0x0bd2('0x5d')]+'%',null);}else{_0x5de5b4=_[_0x0bd2('0x5b')](_0x469399,[_0x0bd2('0x2b'),_0x0bd2('0x6f')]);_0x6a468b[_0x0bd2('0x45')]='UserId';_0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4['type'],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae['text'],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')]['end']);}break;case _0x0bd2('0x71'):_0x2224ae=as['buildExpression']('me',null,_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae['value'][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);break;}}else{var _0x2224ae=as[_0x0bd2('0x67')](_0x32f00e,_0x5de5b4[_0x0bd2('0x36')],_0x6a468b);_0x59bbfb[_0x3f46b1](_0x2224ae[_0x0bd2('0x68')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x70')],_0x2224ae[_0x0bd2('0x5d')][_0x0bd2('0x28')]);}}}else{var _0x12e435=_(_0x350151['query'])[_0x0bd2('0x72')]()[_0x0bd2('0x2d')](function(_0x361fd8){return _[_0x0bd2('0x73')](_0x469399,[_0x0bd2('0x2b'),_0x361fd8])?_0x361fd8:undefined;})['compact']()['value']();if(!_[_0x0bd2('0x74')](_0x12e435)){_0x12e435[_0x0bd2('0x31')](function(_0x559d44){if(_0x559d44==='FaxAccountId'){_0x4fef17['where']('i.FaxAccountId\x20IN\x20?',[][_0x0bd2('0x75')](_0x350151[_0x0bd2('0x38')][_0x559d44]));}else if(_0x559d44==='createdAt'){var _0x1a060d=JSON[_0x0bd2('0x76')](_0x350151[_0x0bd2('0x38')][_0x559d44])[_0x0bd2('0x77')];var _0xdf2d06=JSON['parse'](_0x350151[_0x0bd2('0x38')][_0x559d44])[_0x0bd2('0x78')];_0x4fef17[_0x0bd2('0x79')](_0x0bd2('0x7a'),_0x1a060d,_0xdf2d06);}else{if(_0x350151['query'][_0x559d44]==='null'){_0x4fef17[_0x0bd2('0x79')]('i.'+_0x559d44+'\x20IS\x20NULL');}else{_0x4fef17['where']('i.'+_0x559d44+_0x0bd2('0x7b'),_0x350151[_0x0bd2('0x38')][_0x559d44]);}}});}if(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x7c')]){if(_0x350151['query'][_0x0bd2('0x7c')]==0x1){_0x4fef17[_0x0bd2('0x5e')](_0x0bd2('0x7d'));}else{_0x4fef17[_0x0bd2('0x5e')](_0x0bd2('0x7e'));}}if(_0x350151['query'][_0x0bd2('0x7f')]){_0x47475=_[_0x0bd2('0x80')](_0x350151['query'][_0x0bd2('0x7f')])?_0x350151[_0x0bd2('0x38')]['tag']:new Array(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x7f')]);_0x47475[_0x0bd2('0x31')](function(_0x20b4c2){_0x286cb4['or'](_0x0bd2('0x6a'),'%,'+_0x20b4c2+',%');});}if(_0x350151['query'][_0x0bd2('0x81')]){var _0x426900=_0x350151[_0x0bd2('0x38')][_0x0bd2('0x81')][_0x0bd2('0x82')]('\x5c','\x5c\x5c')[_0x0bd2('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x0bd2('0x83')](_0x426900)){_0x59bbfb['or'](_0x0bd2('0x84'),_0x426900+'%')['or'](_0x0bd2('0x85'),_0x426900+'%');}_0x59bbfb['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x426900+'%');}}_0x4fef17[_0x0bd2('0x79')](_0x59bbfb);_0x4fef17[_0x0bd2('0x86')]('i.id');var _0x204408={'type':db[_0x0bd2('0x87')][_0x0bd2('0x88')][_0x0bd2('0x89')],'raw':!![]};var _0x59646c=_0x4fef17[_0x0bd2('0x8a')]();_0x59646c[_0x0bd2('0x45')](_0x0bd2('0x8b'));_0x59646c[_0x0bd2('0x45')](_0x0bd2('0x8c'),'unreadMessages');if(_0x2c84d3['order']){_0x2c84d3[_0x0bd2('0x41')]['forEach'](function(_0x3bc572){_0x4fef17[_0x0bd2('0x41')]('i.'+_0x3bc572[0x0],_0x3bc572[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0bd2('0x74')](_0x47475)){_0x4fef17[_0x0bd2('0x5e')](_0x286cb4);_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x8d'),_0x47475);}BPromise[_0x0bd2('0x8e')]()[_0x0bd2('0x26')](function(){if(!_0x54709c){if(_0x350151[_0x0bd2('0x38')]['FaxAccountId']||_0x350151[_0x0bd2('0x38')][_0x0bd2('0x8f')])return;_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x90'));_0x4fef17[_0x0bd2('0x79')](_0x0bd2('0x90'));return;}return _0x350151[_0x0bd2('0x91')][_0x0bd2('0x92')]({'attributes':['id'],'raw':!![]})[_0x0bd2('0x26')](function(_0x2753a3){if(_[_0x0bd2('0x74')](_0x2753a3)){_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x93'));_0x4fef17['where'](_0x0bd2('0x93'));}else{_0x59646c[_0x0bd2('0x79')](_0x0bd2('0x94'),_[_0x0bd2('0x2d')](_0x2753a3,'id'));_0x4fef17[_0x0bd2('0x79')]('i.FaxAccountId\x20IN\x20?',_[_0x0bd2('0x2d')](_0x2753a3,'id'));}});})[_0x0bd2('0x26')](function(){db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x59646c[_0x0bd2('0x96')](),_0x204408)[_0x0bd2('0x26')](function(_0x34911b){_0x3e0e0e[_0x0bd2('0x97')]=_0x34911b[_0x0bd2('0x3e')];if(_0x3e0e0e[_0x0bd2('0x97')]===0x0)return[];return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x385dec['toString'](),_0x204408)[_0x0bd2('0x26')](function(_0x55856e){_0x31d7f6=_[_0x0bd2('0x98')](_0x55856e,'id');_0x204408=_['merge'](_0x204408,{'model':db[_0x0bd2('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x350151[_0x0bd2('0x38')][_0x0bd2('0x3d')]){_0x2c84d3[_0x0bd2('0x3c')][_0x0bd2('0x31')](function(_0x592e23){_0x4fef17['field']('i.'+_0x592e23);});}else{_0x4fef17['field'](_0x0bd2('0x8c'),_0x0bd2('0x5c'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9a'),'Account.key');_0x4fef17['field'](_0x0bd2('0x9b'),_0x0bd2('0x9c'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9d'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0x9e'),'Contact.firstName');_0x4fef17[_0x0bd2('0x45')]('c.lastName',_0x0bd2('0x9f'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa0'),_0x0bd2('0xa1'));_0x4fef17['field'](_0x0bd2('0xa2'),_0x0bd2('0xa3'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa4'),'Contact.mobile');_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa5'),_0x0bd2('0xa6'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa7'),_0x0bd2('0xa8'));_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xa9'),'Owner.internal');_0x4fef17[_0x0bd2('0x45')](_0x0bd2('0xaa'),'TagIds');}if(_0x2c84d3[_0x0bd2('0x1f')])_0x4fef17[_0x0bd2('0x1f')](_0x2c84d3[_0x0bd2('0x1f')]);if(_0x2c84d3[_0x0bd2('0x1e')])_0x4fef17[_0x0bd2('0x1e')](_0x2c84d3['offset']);return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0x4fef17[_0x0bd2('0x96')](),_0x204408);})[_0x0bd2('0x26')](function(_0x4fcef1){_0xc7bc8e[_0x0bd2('0x79')](_0x0bd2('0xab'),_[_0x0bd2('0x2d')](_0x4fcef1,'id'));return db[_0x0bd2('0x95')][_0x0bd2('0x38')](_0xc7bc8e[_0x0bd2('0x96')](),_0x204408)[_0x0bd2('0x26')](function(_0x176ab0){var _0x1d90a1=_[_0x0bd2('0xac')](_0x176ab0,'FaxInteractionId');var _0x45431c=[];_0x4fcef1[_0x0bd2('0x31')](function(_0x93eeaf){_0x45431c[_0x0bd2('0x32')](updateFaxInteraction(_0x93eeaf,_0x31d7f6,_0x1d90a1));});return BPromise[_0x0bd2('0xad')](_0x45431c);});});})['then'](function(_0x973f4){_0x3e0e0e[_0x0bd2('0xae')]=_0x973f4;return _0x3e0e0e;})['then'](respondWithFilteredResult(_0x377489,_0x2c84d3));})[_0x0bd2('0x33')](handleError(_0x377489,null));};exports[_0x0bd2('0xaf')]=function(_0x3574b9,_0x2b5058){var _0x462271={'raw':![],'where':{'id':_0x3574b9[_0x0bd2('0xb0')]['id']}},_0x38f791={};_0x38f791[_0x0bd2('0x3b')]=_[_0x0bd2('0x72')](db['FaxInteraction']['rawAttributes']);_0x38f791['query']=_[_0x0bd2('0x72')](_0x3574b9[_0x0bd2('0x38')]);_0x38f791[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x38f791[_0x0bd2('0x3b')],_0x38f791[_0x0bd2('0x38')]);_0x462271[_0x0bd2('0x3c')]=_[_0x0bd2('0x3a')](_0x38f791[_0x0bd2('0x3b')],qs['fields'](_0x3574b9[_0x0bd2('0x38')][_0x0bd2('0x3d')]));_0x462271['attributes']=_0x462271['attributes']['length']?_0x462271[_0x0bd2('0x3c')]:_0x38f791[_0x0bd2('0x3b')];if(_0x3574b9['query'][_0x0bd2('0xb1')]){_0x462271[_0x0bd2('0xb2')]=[{'all':!![]}];}_0x462271=_['merge']({},_0x462271,_0x3574b9[_0x0bd2('0xb3')]);return db[_0x0bd2('0x99')][_0x0bd2('0x5b')](_0x462271)[_0x0bd2('0x26')](handleEntityNotFound(_0x2b5058,null))[_0x0bd2('0x26')](respondWithResult(_0x2b5058,null))[_0x0bd2('0x33')](handleError(_0x2b5058,null));};exports['create']=function(_0x7789b1,_0x1498aa){return db[_0x0bd2('0x99')][_0x0bd2('0xb4')](_0x7789b1[_0x0bd2('0x71')],{})[_0x0bd2('0x26')](respondWithResult(_0x1498aa,0xc9))[_0x0bd2('0x33')](handleError(_0x1498aa,null));};exports[_0x0bd2('0x25')]=function(_0x5c080a,_0x5c147){if(_0x5c080a[_0x0bd2('0x71')]['id']){delete _0x5c080a[_0x0bd2('0x71')]['id'];}return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x5c080a[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x5c147,null))[_0x0bd2('0x26')](saveUpdates(_0x5c080a['body'],null))['then'](respondWithResult(_0x5c147,null))[_0x0bd2('0x33')](handleError(_0x5c147,null));};exports[_0x0bd2('0x27')]=function(_0x1298d2,_0x8baac6){return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x1298d2['params']['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x8baac6,null))[_0x0bd2('0x26')](removeEntity(_0x8baac6,null))[_0x0bd2('0x33')](handleError(_0x8baac6,null));};exports[_0x0bd2('0xb5')]=function(_0xedb4f7,_0x49f982){return db[_0x0bd2('0x99')][_0x0bd2('0xb5')]()[_0x0bd2('0x26')](respondWithResult(_0x49f982,null))[_0x0bd2('0x33')](handleError(_0x49f982,null));};exports['addMessage']=function(_0x4d7a9d,_0x21570c,_0x3a5e1e){return db['FaxMessage'][_0x0bd2('0x5b')]({'where':{'id':_0x4d7a9d['params']['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x21570c,null))[_0x0bd2('0x26')](function(_0x36be7a){if(_0x36be7a){return _0x36be7a[_0x0bd2('0xb6')](_0x4d7a9d[_0x0bd2('0x71')][_0x0bd2('0xb7')],_[_0x0bd2('0xb8')](_0x4d7a9d[_0x0bd2('0x71')],[_0x0bd2('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x21570c,null))[_0x0bd2('0x33')](handleError(_0x21570c,null));};exports[_0x0bd2('0xb9')]=function(_0x1a6f09,_0x1a42cf,_0x447d4d){var _0x4edf87={'raw':![],'where':{}};var _0x114771={};var _0x1c4cf4={'count':0x0,'rows':[]};return db[_0x0bd2('0x99')][_0x0bd2('0xba')]({'where':{'id':_0x1a6f09[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x1a42cf,null))[_0x0bd2('0x26')](function(_0x2fee87){if(_0x2fee87){_0x114771[_0x0bd2('0x3b')]=_[_0x0bd2('0x72')](db[_0x0bd2('0xbb')]['rawAttributes']);_0x114771[_0x0bd2('0x38')]=_[_0x0bd2('0x72')](_0x1a6f09[_0x0bd2('0x38')]);_0x114771[_0x0bd2('0x39')]=_[_0x0bd2('0x3a')](_0x114771[_0x0bd2('0x3b')],_0x114771[_0x0bd2('0x38')]);_0x4edf87[_0x0bd2('0x3c')]=_['intersection'](_0x114771[_0x0bd2('0x3b')],qs[_0x0bd2('0x3d')](_0x1a6f09['query'][_0x0bd2('0x3d')]));_0x4edf87[_0x0bd2('0x3c')]=_0x4edf87['attributes'][_0x0bd2('0x3e')]?_0x4edf87[_0x0bd2('0x3c')]:_0x114771[_0x0bd2('0x3b')];if(!_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x3f')](_0x0bd2('0x40'))){_0x4edf87[_0x0bd2('0x1f')]=qs[_0x0bd2('0x1f')](_0x1a6f09[_0x0bd2('0x38')]['limit']);_0x4edf87[_0x0bd2('0x1e')]=qs['offset'](_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x1e')]);}_0x4edf87['order']=qs[_0x0bd2('0x42')](_0x1a6f09[_0x0bd2('0x38')]['sort']);_0x4edf87[_0x0bd2('0x79')]=qs[_0x0bd2('0x39')](_['pick'](_0x1a6f09['query'],_0x114771[_0x0bd2('0x39')]));_0x4edf87[_0x0bd2('0x79')][_0x0bd2('0xbc')]=_0x2fee87['id'];if(_0x1a6f09[_0x0bd2('0x38')]['filter']){_0x4edf87['where']=_['merge'](_0x4edf87['where'],{'$or':_[_0x0bd2('0x2d')](_0x4edf87[_0x0bd2('0x3c')],function(_0x3b6f77){var _0x4b2f8b={};_0x4b2f8b[_0x3b6f77]={'$like':'%'+_0x1a6f09['query']['filter']+'%'};return _0x4b2f8b;})});}if(_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x77')]){var _0x35f756=_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0x77')]['split'](',');var _0x2c5613={};_0x2c5613[_0x35f756[0x0]]={'$gte':moment(_0x35f756[0x1])[_0x0bd2('0xbd')](_0x0bd2('0xbe'))};_0x4edf87[_0x0bd2('0x79')]=_[_0x0bd2('0xbf')](_0x4edf87[_0x0bd2('0x79')],_0x2c5613);}_0x4edf87=_['merge']({},_0x4edf87,_0x1a6f09['options']);return db['FaxMessage'][_0x0bd2('0x97')]({'where':_0x4edf87['where']})[_0x0bd2('0x26')](function(_0x222154){_0x1c4cf4[_0x0bd2('0x97')]=_0x222154;if(_0x1a6f09[_0x0bd2('0x38')][_0x0bd2('0xb1')]){_0x4edf87[_0x0bd2('0xb2')]=[{'all':!![]}];}return db[_0x0bd2('0xbb')][_0x0bd2('0xc0')](_0x4edf87);})['then'](function(_0x1a2b47){_0x1c4cf4['rows']=_0x1a2b47;return _0x1c4cf4;});}})[_0x0bd2('0x26')](respondWithFilteredResult(_0x1a42cf,_0x4edf87))['catch'](handleError(_0x1a42cf,null));};exports['addTags']=function(_0x1f334c,_0x35a664,_0x52c02a){return db['FaxInteraction']['find']({'where':{'id':_0x1f334c[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x35a664,null))[_0x0bd2('0x26')](function(_0x4464a6){if(_0x4464a6){return _0x4464a6[_0x0bd2('0xc1')](_0x1f334c[_0x0bd2('0x71')][_0x0bd2('0xb7')],_[_0x0bd2('0xb8')](_0x1f334c[_0x0bd2('0x71')],[_0x0bd2('0xb7'),'id'])||{})['spread'](function(){return db['Tag'][_0x0bd2('0xc0')]({'attributes':['id',_0x0bd2('0x2b'),_0x0bd2('0x46')],'where':{'id':_0x1f334c[_0x0bd2('0x71')][_0x0bd2('0xb7')]}});})[_0x0bd2('0x26')](function(_0x302976){socket[_0x0bd2('0xc2')](_0x0bd2('0xc3'),{'id':Number(_0x1f334c['params']['id']),'tags':_0x302976||[]});return{'id':Number(_0x1f334c[_0x0bd2('0xb0')]['id']),'tags':_0x302976||[]};});}})[_0x0bd2('0x26')](respondWithResult(_0x35a664,null))[_0x0bd2('0x33')](handleError(_0x35a664,null));};exports[_0x0bd2('0xc4')]=function(_0x46532c,_0x439e6f,_0x1174ee){return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x46532c[_0x0bd2('0xb0')]['id']}})[_0x0bd2('0x26')](handleEntityNotFound(_0x439e6f,null))[_0x0bd2('0x26')](function(_0x401cf3){if(_0x401cf3){return _0x401cf3[_0x0bd2('0xc4')](_0x46532c[_0x0bd2('0x38')][_0x0bd2('0xb7')]);}})[_0x0bd2('0x26')](respondWithStatusCode(_0x439e6f,null))['catch'](handleError(_0x439e6f,null));};exports[_0x0bd2('0xc5')]=function(_0x443b51,_0x23e8b0){var _0x2046bd=moment()[_0x0bd2('0xc6')]()[_0x0bd2('0x96')]();var _0x179af2=path[_0x0bd2('0xc7')](config['root'],'server','files',_0x0bd2('0xc8'));var _0x13ee3f=path[_0x0bd2('0xc7')](config['root'],_0x0bd2('0xc9'),_0x0bd2('0xca'),_0x0bd2('0xcb'));var _0x31a6f7=path[_0x0bd2('0xc7')](_0x179af2,_0x2046bd);var _0x4b743f=util['format'](_0x0bd2('0xcc'),_0x443b51[_0x0bd2('0xb0')]['id'],_0x2046bd);var _0x163821=path[_0x0bd2('0xc7')](_0x179af2,_0x4b743f);var _0x580256=[];_0x580256[_0x0bd2('0x32')]({'model':db[_0x0bd2('0xcd')],'as':_0x0bd2('0xcd'),'raw':!![]});var _0x186206=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x0bd2('0x71'),'createdAt'],'include':_0x580256}];return db[_0x0bd2('0x99')][_0x0bd2('0x5b')]({'where':{'id':_0x443b51['params']['id']},'include':_0x186206})[_0x0bd2('0x26')](handleEntityNotFound(_0x23e8b0,null))['then'](function(_0x3898ce){if(_0x3898ce&&_0x3898ce[_0x0bd2('0xce')]){var _0x236340=_0x3898ce[_0x0bd2('0xcf')]({'plain':!![]});fs[_0x0bd2('0xd0')](_0x31a6f7);for(var _0x47965f=0x0;_0x47965f<_0x236340[_0x0bd2('0xce')]['length'];_0x47965f++){var _0x3fc3c8=_0x236340[_0x0bd2('0xce')][_0x47965f][_0x0bd2('0xcd')];if(_0x3fc3c8){var _0x565a47=path[_0x0bd2('0xc7')](_0x13ee3f,_0x3fc3c8[_0x0bd2('0xd1')]);if(fs[_0x0bd2('0xd2')](_0x565a47)){fs[_0x0bd2('0xd3')](_0x565a47)[_0x0bd2('0xd4')](fs[_0x0bd2('0xd5')](path[_0x0bd2('0xc7')](_0x31a6f7,_0x3fc3c8[_0x0bd2('0xd1')])));}}}return BPromise[_0x0bd2('0x8e')]()['then'](function(){return new BPromise(function(_0x4b4ef7,_0x368356){zipdir(_0x31a6f7,{'saveTo':_0x163821},function(_0x4b81e8,_0x2a85af){if(_0x4b81e8)return _0x368356(_0x4b81e8);return _0x4b4ef7(_0x2a85af);});})[_0x0bd2('0x26')](function(){return new BPromise(function(_0x550211,_0x5d29c9){rimraf(_0x31a6f7,function(_0x5daafa){if(_0x5daafa)_0x5d29c9(_0x5daafa);return _0x550211();});});})[_0x0bd2('0x26')](function(){return _0x23e8b0['download'](_0x163821,_0x4b743f,function(_0x1aba49){if(_0x1aba49){console['log']('err',_0x1aba49);}else{fs[_0x0bd2('0xd6')](_0x163821);}});});});}else{return _0x23e8b0[_0x0bd2('0x1b')](0xc8);}})[_0x0bd2('0x33')](handleError(_0x23e8b0,null));}; \ No newline at end of file +var _0x8b1a=['having','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','rows','catch','show','params','keys','includeAll','options','create','update','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','pick','format','count','include','findAll','setTags','faxInteractionTags:save','removeTags','unix','root','tmp','join','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','status','end','json','offset','limit','apply','reject','save','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','index','FaxInteraction','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','where','filters','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','value','`\x20=\x200'];(function(_0x541e4f,_0x48d7fa){var _0x5c1711=function(_0x10fdb1){while(--_0x10fdb1){_0x541e4f['push'](_0x541e4f['shift']());}};_0x5c1711(++_0x48d7fa);}(_0x8b1a,0x152));var _0xa8b1=function(_0x7b6efc,_0x1b03ab){_0x7b6efc=_0x7b6efc-0x0;var _0x17cc28=_0x8b1a[_0x7b6efc];return _0x17cc28;};'use strict';var pdf=require(_0xa8b1('0x0'));var emlformat=require(_0xa8b1('0x1'));var rimraf=require(_0xa8b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8b1('0x3'));var rp=require(_0xa8b1('0x4'));var moment=require(_0xa8b1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa8b1('0x6'));var util=require(_0xa8b1('0x7'));var path=require(_0xa8b1('0x8'));var sox=require(_0xa8b1('0x9'));var csv=require(_0xa8b1('0xa'));var ejs=require(_0xa8b1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa8b1('0xc'));var crypto=require(_0xa8b1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa8b1('0xe'));var toCsv=require(_0xa8b1('0xa'));var querystring=require('querystring');var Papa=require(_0xa8b1('0xf'));var Redis=require(_0xa8b1('0x10'));var authService=require(_0xa8b1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8b1('0x12'));var logger=require('../../config/logger')(_0xa8b1('0x13'));var utils=require(_0xa8b1('0x14'));var config=require(_0xa8b1('0x15'));var db=require(_0xa8b1('0x16'))['db'];config[_0xa8b1('0x17')]=_[_0xa8b1('0x18')](config[_0xa8b1('0x17')],{'host':_0xa8b1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa8b1('0x17')]));require(_0xa8b1('0x1a'))['register'](socket);function respondWithStatusCode(_0x193d69,_0x541cc6){_0x541cc6=_0x541cc6||0xcc;return function(_0xa05f63){if(_0xa05f63){return _0x193d69['sendStatus'](_0x541cc6);}return _0x193d69[_0xa8b1('0x1b')](_0x541cc6)[_0xa8b1('0x1c')]();};}function respondWithResult(_0x459cd7,_0x1fbc70){_0x1fbc70=_0x1fbc70||0xc8;return function(_0x42fd26){if(_0x42fd26){return _0x459cd7[_0xa8b1('0x1b')](_0x1fbc70)[_0xa8b1('0x1d')](_0x42fd26);}};}function respondWithFilteredResult(_0x404c74,_0x4f8773){return function(_0x152484){if(_0x152484){var _0x457967=_0x152484['count'],_0x5a05ac=_0x4f8773['offset'],_0x59ff94=_0x4f8773[_0xa8b1('0x1e')]+_0x4f8773[_0xa8b1('0x1f')],_0x47c3be;if(_0x59ff94>=_0x457967){_0x59ff94=_0x457967;_0x47c3be=0xc8;}else{_0x47c3be=0xce;}_0x404c74[_0xa8b1('0x1b')](_0x47c3be);return _0x404c74['set']('Content-Range',_0x5a05ac+'-'+_0x59ff94+'/'+_0x457967)[_0xa8b1('0x1d')](_0x152484);}return null;};}function patchUpdates(_0x4c866d){return function(_0x3a184b){try{jsonpatch[_0xa8b1('0x20')](_0x3a184b,_0x4c866d,!![]);}catch(_0x58b2c9){return BPromise[_0xa8b1('0x21')](_0x58b2c9);}return _0x3a184b[_0xa8b1('0x22')]();};}function saveUpdates(_0x5dfba3,_0x2ab5a0){return function(_0x5b7d2b){if(_0x5b7d2b){return _0x5b7d2b['update'](_0x5dfba3)[_0xa8b1('0x23')](function(_0xebc2c4){return _0xebc2c4;});}return null;};}function removeEntity(_0x1f7c45,_0x8e156f){return function(_0xc557fa){if(_0xc557fa){return _0xc557fa[_0xa8b1('0x24')]()[_0xa8b1('0x23')](function(){_0x1f7c45[_0xa8b1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f000,_0x5c3f35){return function(_0x3212ff){if(!_0x3212ff){_0x45f000['sendStatus'](0x194);}return _0x3212ff;};}function handleError(_0x55d3e1,_0x7ffbc1){_0x7ffbc1=_0x7ffbc1||0x1f4;return function(_0x12ed10){logger[_0xa8b1('0x25')](_0x12ed10[_0xa8b1('0x26')]);if(_0x12ed10[_0xa8b1('0x27')]){delete _0x12ed10[_0xa8b1('0x27')];}_0x55d3e1[_0xa8b1('0x1b')](_0x7ffbc1)[_0xa8b1('0x28')](_0x12ed10);};}function getInteractionUsers(_0x1f5314,_0x13b5e2){return new BPromise(function(_0x315add,_0x245632){try{if(_0x13b5e2[_0x1f5314['id']]){_0x1f5314['Users']=_[_0xa8b1('0x29')](_0x13b5e2[_0x1f5314['id']],function(_0x22b98c){return{'id':_0x22b98c['id'],'fullname':_0x22b98c[_0xa8b1('0x2a')]};});}}catch(_0x5da543){_0x245632(_0x5da543);}_0x315add(_0x1f5314);});}function getInteractionTags(_0x2224f0,_0x3ab080){return new BPromise(function(_0x2c27f2,_0x44d393){try{if(_0x2224f0[_0xa8b1('0x2b')]){_0x2224f0[_0xa8b1('0x2c')]=[];_0x2224f0['TagIds']['split'](',')['forEach'](function(_0x5d01b5){_0x2224f0['Tags']['push'](_0x3ab080[_0x5d01b5]);});}delete _0x2224f0['TagIds'];}catch(_0x425d0b){_0x44d393(_0x425d0b);}_0x2c27f2(_0x2224f0);});}function updateFaxInteraction(_0x17a826,_0x13ee18,_0x33de4b){return new BPromise(function(_0x47a7d1,_0x1d8cc2){return getInteractionUsers(_0x17a826,_0x33de4b)[_0xa8b1('0x23')](function(_0x4f24a5){return getInteractionTags(_0x4f24a5,_0x13ee18);})[_0xa8b1('0x23')](function(_0x3888c2){_0x47a7d1(_0x3888c2);})['catch'](function(_0x536057){_0x1d8cc2(_0x536057);});});}exports[_0xa8b1('0x2d')]=function(_0x5615c2,_0x125511){var _0x26fb5e={},_0x1f63f7={},_0x401c4e={'count':0x0,'rows':[]};var _0x494865=_[_0xa8b1('0x29')](db[_0xa8b1('0x2e')][_0xa8b1('0x2f')],function(_0xe6fb78){return{'name':_0xe6fb78[_0xa8b1('0x30')],'type':_0xe6fb78[_0xa8b1('0x31')][_0xa8b1('0x32')]};});_0x1f63f7['model']=_['map'](_0x494865,_0xa8b1('0x27'));_0x1f63f7['query']=_['keys'](_0x5615c2[_0xa8b1('0x33')]);_0x1f63f7['filters']=_[_0xa8b1('0x34')](_0x1f63f7[_0xa8b1('0x35')],_0x1f63f7['query']);_0x26fb5e[_0xa8b1('0x36')]=_[_0xa8b1('0x34')](_0x1f63f7[_0xa8b1('0x35')],qs['fields'](_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x37')]));_0x26fb5e[_0xa8b1('0x36')]=_0x26fb5e[_0xa8b1('0x36')][_0xa8b1('0x38')]?_0x26fb5e['attributes']:_0x1f63f7['model'];if(!_0x5615c2[_0xa8b1('0x33')]['hasOwnProperty']('nolimit')){_0x26fb5e[_0xa8b1('0x1f')]=qs['limit'](_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x1f')]);_0x26fb5e[_0xa8b1('0x1e')]=qs['offset'](_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x1e')]);}_0x26fb5e['order']=qs['sort'](_0x5615c2[_0xa8b1('0x33')]['sort']);_0x26fb5e[_0xa8b1('0x39')]=qs[_0xa8b1('0x3a')](_['pick'](_0x5615c2['query'],_0x1f63f7[_0xa8b1('0x3a')]),_0x494865);var _0x563aff=[];var _0x2f1d67=squel[_0xa8b1('0x3b')]()[_0xa8b1('0x3c')]('id')[_0xa8b1('0x3c')]('name')[_0xa8b1('0x3c')](_0xa8b1('0x3d'))[_0xa8b1('0x3e')]('tools_tags');var _0x513ca6=squel[_0xa8b1('0x3b')]()['field'](_0xa8b1('0x3f'))[_0xa8b1('0x3c')](_0xa8b1('0x40'))[_0xa8b1('0x3c')](_0xa8b1('0x41'))['from'](_0xa8b1('0x42'),'ui')[_0xa8b1('0x43')](_0xa8b1('0x44'),'u',_0xa8b1('0x45'));var _0xd92af8=squel[_0xa8b1('0x3b')]()[_0xa8b1('0x3e')](_0xa8b1('0x46'),'i')[_0xa8b1('0x43')](_0xa8b1('0x47'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa8b1('0x43')](_0xa8b1('0x44'),'o','o.id\x20=\x20i.UserId')[_0xa8b1('0x43')](_0xa8b1('0x48'),'a',_0xa8b1('0x49'))[_0xa8b1('0x43')](_0xa8b1('0x4a'),'me',_0xa8b1('0x4b'))['left_join'](_0xa8b1('0x4c'),'it',_0xa8b1('0x4d'))[_0xa8b1('0x43')](_0xa8b1('0x4e'),'t',_0xa8b1('0x4f'));var _0x11e0ce=squel[_0xa8b1('0x50')]();var _0x181f39=[];var _0xe42ae6=squel[_0xa8b1('0x50')]();var _0x4f9d9e;if(_0x5615c2['query']['search']){_0x4f9d9e=as['parseSearch'](_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x51')]);var _0xc41037=_0x4f9d9e[_0xa8b1('0x52')];for(var _0x627167=0x0;_0x627167<_0x4f9d9e['conditions'][_0xa8b1('0x38')];_0x627167++){var _0x5b4e37=_0x4f9d9e[_0xa8b1('0x53')][_0x627167];var _0x5a216b='i';var _0x3287aa=_['find'](_0x494865,['name',_0x5b4e37['field']]);if(!_0x3287aa){switch(_0x5b4e37[_0xa8b1('0x3c')]){case'unreadMessages':if(_0x5b4e37[_0xa8b1('0x54')]==0x1){_0xd92af8['having']('`'+_0x5b4e37[_0xa8b1('0x3c')]+_0xa8b1('0x55'));}else{_0xd92af8[_0xa8b1('0x56')]('`'+_0x5b4e37[_0xa8b1('0x3c')]+_0xa8b1('0x57'));}break;case'Contact':if(_0x5b4e37[_0xa8b1('0x58')]===_0xa8b1('0x59')){if(_0x5b4e37['value'][_0xa8b1('0x5a')]('\x20')[_0xa8b1('0x38')]>0x1){_0x11e0ce[_0xc41037](_0xa8b1('0x5b'),qs[_0xa8b1('0x5c')](_0x5b4e37[_0xa8b1('0x54')]),null);}else{var _0x353a5a='%'+_0x5b4e37[_0xa8b1('0x54')]+'%';_0x11e0ce[_0xc41037](_0xa8b1('0x5d'),_0x353a5a,_0x353a5a,_0x353a5a);}}else{_0x3287aa=_[_0xa8b1('0x5e')](_0x494865,[_0xa8b1('0x27'),_0xa8b1('0x5f')]);_0x5b4e37[_0xa8b1('0x3c')]='ContactId';_0x2c9649=as[_0xa8b1('0x60')](_0x5a216b,_0x3287aa['type'],_0x5b4e37);_0x11e0ce[_0xc41037](_0x2c9649[_0xa8b1('0x61')],_0x2c9649[_0xa8b1('0x54')][_0xa8b1('0x62')],_0x2c9649[_0xa8b1('0x54')]['end']);}break;case _0xa8b1('0x63'):var _0x53f025=_0x5b4e37['value'][_0xa8b1('0x5a')](',')[_0xa8b1('0x29')](function(_0x16a8d5){return Number(_0x16a8d5);});_0x53f025[_0xa8b1('0x64')](function(_0x4bb274){_0xe42ae6['or'](_0xa8b1('0x65'),'%,'+_0x4bb274+',%');});_0x181f39=_['union'](_0x181f39,_0x53f025);break;case _0xa8b1('0x66'):if(_0x5b4e37[_0xa8b1('0x58')]===_0xa8b1('0x59')){_0x11e0ce[_0xc41037](_0xa8b1('0x67'),'%'+_0x5b4e37[_0xa8b1('0x54')]+'%',null);}else{_0x3287aa=_[_0xa8b1('0x5e')](_0x494865,[_0xa8b1('0x27'),_0xa8b1('0x68')]);_0x5b4e37['field']=_0xa8b1('0x68');_0x2c9649=as[_0xa8b1('0x60')](_0x5a216b,_0x3287aa[_0xa8b1('0x31')],_0x5b4e37);_0x11e0ce[_0xc41037](_0x2c9649[_0xa8b1('0x61')],_0x2c9649[_0xa8b1('0x54')][_0xa8b1('0x62')],_0x2c9649[_0xa8b1('0x54')][_0xa8b1('0x1c')]);}break;case _0xa8b1('0x69'):_0x2c9649=as[_0xa8b1('0x60')]('me',null,_0x5b4e37);_0x11e0ce[_0xc41037](_0x2c9649['text'],_0x2c9649[_0xa8b1('0x54')]['start'],_0x2c9649[_0xa8b1('0x54')]['end']);break;}}else{var _0x2c9649=as['buildExpression'](_0x5a216b,_0x3287aa['type'],_0x5b4e37);_0x11e0ce[_0xc41037](_0x2c9649['text'],_0x2c9649[_0xa8b1('0x54')]['start'],_0x2c9649[_0xa8b1('0x54')][_0xa8b1('0x1c')]);}}}else{var _0x45fd59=_(_0x5615c2[_0xa8b1('0x33')])['keys']()[_0xa8b1('0x29')](function(_0x1d2c1b){return _[_0xa8b1('0x6a')](_0x494865,[_0xa8b1('0x27'),_0x1d2c1b])?_0x1d2c1b:undefined;})[_0xa8b1('0x6b')]()[_0xa8b1('0x54')]();if(!_[_0xa8b1('0x6c')](_0x45fd59)){_0x45fd59[_0xa8b1('0x64')](function(_0x388604){if(_0x388604==='FaxAccountId'){_0xd92af8['where']('i.FaxAccountId\x20IN\x20?',[][_0xa8b1('0x6d')](_0x5615c2[_0xa8b1('0x33')][_0x388604]));}else if(_0x388604===_0xa8b1('0x6e')){var _0x3351b7=JSON[_0xa8b1('0x6f')](_0x5615c2[_0xa8b1('0x33')][_0x388604])['$gte'];var _0x243c1b=JSON[_0xa8b1('0x6f')](_0x5615c2['query'][_0x388604])[_0xa8b1('0x70')];_0xd92af8['where'](_0xa8b1('0x71'),_0x3351b7,_0x243c1b);}else{if(_0x5615c2[_0xa8b1('0x33')][_0x388604]==='null'){_0xd92af8[_0xa8b1('0x39')]('i.'+_0x388604+_0xa8b1('0x72'));}else{_0xd92af8[_0xa8b1('0x39')]('i.'+_0x388604+_0xa8b1('0x73'),_0x5615c2[_0xa8b1('0x33')][_0x388604]);}}});}if(_0x5615c2[_0xa8b1('0x33')]['read']){if(_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x74')]==0x1){_0xd92af8[_0xa8b1('0x56')]('`unreadMessages`\x20=\x200');}else{_0xd92af8[_0xa8b1('0x56')](_0xa8b1('0x75'));}}if(_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x76')]){_0x181f39=_[_0xa8b1('0x77')](_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x76')])?_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x76')]:new Array(_0x5615c2[_0xa8b1('0x33')]['tag']);_0x181f39[_0xa8b1('0x64')](function(_0x4f9d3c){_0xe42ae6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f9d3c+',%');});}if(_0x5615c2['query'][_0xa8b1('0x78')]){var _0x1ab138=_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x78')][_0xa8b1('0x79')]('\x5c','\x5c\x5c')[_0xa8b1('0x79')]('\x27\x27',_0xa8b1('0x7a'));if(qs['isNumeric'](_0x1ab138)){_0x11e0ce['or'](_0xa8b1('0x7b'),_0x1ab138+'%')['or'](_0xa8b1('0x7c'),_0x1ab138+'%');}_0x11e0ce['or'](_0xa8b1('0x7d'),_0x1ab138+'%');}}_0xd92af8['where'](_0x11e0ce);_0xd92af8[_0xa8b1('0x7e')](_0xa8b1('0x7f'));var _0x305972={'type':db['Sequelize'][_0xa8b1('0x80')][_0xa8b1('0x81')],'raw':!![]};var _0x3f4ab5=_0xd92af8[_0xa8b1('0x82')]();_0x3f4ab5[_0xa8b1('0x3c')](_0xa8b1('0x7f'));_0x3f4ab5['field'](_0xa8b1('0x83'),_0xa8b1('0x84'));if(_0x26fb5e[_0xa8b1('0x85')]){_0x26fb5e[_0xa8b1('0x85')]['forEach'](function(_0x49bb6c){_0xd92af8[_0xa8b1('0x85')]('i.'+_0x49bb6c[0x0],_0x49bb6c[0x1]===_0xa8b1('0x86')?![]:!![]);});}if(!_[_0xa8b1('0x6c')](_0x181f39)){_0xd92af8['having'](_0xe42ae6);_0x3f4ab5[_0xa8b1('0x39')](_0xa8b1('0x87'),_0x181f39);}BPromise[_0xa8b1('0x88')]()[_0xa8b1('0x23')](function(){if(!_0x4f9d9e){if(_0x5615c2[_0xa8b1('0x33')]['FaxAccountId']||_0x5615c2[_0xa8b1('0x33')][_0xa8b1('0x89')])return;_0x3f4ab5[_0xa8b1('0x39')](_0xa8b1('0x8a'));_0xd92af8[_0xa8b1('0x39')](_0xa8b1('0x8a'));return;}return _0x5615c2[_0xa8b1('0x8b')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xa8b1('0x23')](function(_0x246819){if(_[_0xa8b1('0x6c')](_0x246819)){_0x3f4ab5[_0xa8b1('0x39')]('i.FaxAccountId\x20IS\x20NULL');_0xd92af8[_0xa8b1('0x39')](_0xa8b1('0x8c'));}else{_0x3f4ab5['where'](_0xa8b1('0x8d'),_[_0xa8b1('0x29')](_0x246819,'id'));_0xd92af8[_0xa8b1('0x39')](_0xa8b1('0x8d'),_[_0xa8b1('0x29')](_0x246819,'id'));}});})['then'](function(){db[_0xa8b1('0x8e')][_0xa8b1('0x33')](_0x3f4ab5[_0xa8b1('0x8f')](),_0x305972)['then'](function(_0x2eadfb){_0x401c4e['count']=_0x2eadfb[_0xa8b1('0x38')];if(_0x401c4e['count']===0x0)return[];return db['sequelize'][_0xa8b1('0x33')](_0x2f1d67[_0xa8b1('0x8f')](),_0x305972)[_0xa8b1('0x23')](function(_0x1e6d22){_0x563aff=_[_0xa8b1('0x90')](_0x1e6d22,'id');_0x305972=_[_0xa8b1('0x91')](_0x305972,{'model':db[_0xa8b1('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5615c2[_0xa8b1('0x33')]['fields']){_0x26fb5e['attributes'][_0xa8b1('0x64')](function(_0x4e4aa1){_0xd92af8['field']('i.'+_0x4e4aa1);});}else{_0xd92af8[_0xa8b1('0x3c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa8b1('0x84'));_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0x92'),_0xa8b1('0x93'));_0xd92af8['field'](_0xa8b1('0x94'),_0xa8b1('0x95'));_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0x96'));_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0x97'),_0xa8b1('0x98'));_0xd92af8['field'](_0xa8b1('0x99'),_0xa8b1('0x9a'));_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0x9b'),'Contact.email');_0xd92af8['field'](_0xa8b1('0x9c'),'Contact.phone');_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0x9d'),'Contact.mobile');_0xd92af8['field'](_0xa8b1('0x9e'),_0xa8b1('0x9f'));_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0xa0'),_0xa8b1('0xa1'));_0xd92af8['field'](_0xa8b1('0xa2'),'Owner.internal');_0xd92af8[_0xa8b1('0x3c')](_0xa8b1('0xa3'),_0xa8b1('0x2b'));}if(_0x26fb5e['limit'])_0xd92af8['limit'](_0x26fb5e['limit']);if(_0x26fb5e['offset'])_0xd92af8['offset'](_0x26fb5e['offset']);return db[_0xa8b1('0x8e')]['query'](_0xd92af8[_0xa8b1('0x8f')](),_0x305972);})[_0xa8b1('0x23')](function(_0x1b35ae){_0x513ca6[_0xa8b1('0x39')]('ui.FaxInteractionId\x20IN\x20?',_[_0xa8b1('0x29')](_0x1b35ae,'id'));return db['sequelize'][_0xa8b1('0x33')](_0x513ca6['toString'](),_0x305972)[_0xa8b1('0x23')](function(_0x272390){var _0x129183=_[_0xa8b1('0xa4')](_0x272390,_0xa8b1('0xa5'));var _0x3eeafb=[];_0x1b35ae['forEach'](function(_0x2a388f){_0x3eeafb[_0xa8b1('0xa6')](updateFaxInteraction(_0x2a388f,_0x563aff,_0x129183));});return BPromise['all'](_0x3eeafb);});});})[_0xa8b1('0x23')](function(_0x4d73e0){_0x401c4e[_0xa8b1('0xa7')]=_0x4d73e0;return _0x401c4e;})[_0xa8b1('0x23')](respondWithFilteredResult(_0x125511,_0x26fb5e));})[_0xa8b1('0xa8')](handleError(_0x125511,null));};exports[_0xa8b1('0xa9')]=function(_0x48f5e6,_0x47d3a9){var _0x32bb0f={'raw':![],'where':{'id':_0x48f5e6[_0xa8b1('0xaa')]['id']}},_0x125217={};_0x125217[_0xa8b1('0x35')]=_[_0xa8b1('0xab')](db[_0xa8b1('0x2e')]['rawAttributes']);_0x125217['query']=_[_0xa8b1('0xab')](_0x48f5e6[_0xa8b1('0x33')]);_0x125217[_0xa8b1('0x3a')]=_[_0xa8b1('0x34')](_0x125217[_0xa8b1('0x35')],_0x125217[_0xa8b1('0x33')]);_0x32bb0f['attributes']=_['intersection'](_0x125217[_0xa8b1('0x35')],qs['fields'](_0x48f5e6[_0xa8b1('0x33')][_0xa8b1('0x37')]));_0x32bb0f[_0xa8b1('0x36')]=_0x32bb0f[_0xa8b1('0x36')]['length']?_0x32bb0f[_0xa8b1('0x36')]:_0x125217['model'];if(_0x48f5e6[_0xa8b1('0x33')][_0xa8b1('0xac')]){_0x32bb0f['include']=[{'all':!![]}];}_0x32bb0f=_[_0xa8b1('0x91')]({},_0x32bb0f,_0x48f5e6[_0xa8b1('0xad')]);return db[_0xa8b1('0x2e')][_0xa8b1('0x5e')](_0x32bb0f)[_0xa8b1('0x23')](handleEntityNotFound(_0x47d3a9,null))['then'](respondWithResult(_0x47d3a9,null))[_0xa8b1('0xa8')](handleError(_0x47d3a9,null));};exports[_0xa8b1('0xae')]=function(_0x3373bf,_0x24a15f){return db[_0xa8b1('0x2e')]['create'](_0x3373bf['body'],{})[_0xa8b1('0x23')](respondWithResult(_0x24a15f,0xc9))[_0xa8b1('0xa8')](handleError(_0x24a15f,null));};exports[_0xa8b1('0xaf')]=function(_0x18d043,_0x32c30d){if(_0x18d043[_0xa8b1('0x69')]['id']){delete _0x18d043[_0xa8b1('0x69')]['id'];}return db['FaxInteraction'][_0xa8b1('0x5e')]({'where':{'id':_0x18d043[_0xa8b1('0xaa')]['id']}})[_0xa8b1('0x23')](handleEntityNotFound(_0x32c30d,null))['then'](saveUpdates(_0x18d043[_0xa8b1('0x69')],null))[_0xa8b1('0x23')](respondWithResult(_0x32c30d,null))['catch'](handleError(_0x32c30d,null));};exports[_0xa8b1('0x24')]=function(_0x58e2aa,_0x2861ba){return db[_0xa8b1('0x2e')]['find']({'where':{'id':_0x58e2aa[_0xa8b1('0xaa')]['id']}})[_0xa8b1('0x23')](handleEntityNotFound(_0x2861ba,null))[_0xa8b1('0x23')](removeEntity(_0x2861ba,null))[_0xa8b1('0xa8')](handleError(_0x2861ba,null));};exports[_0xa8b1('0xb0')]=function(_0x316a83,_0x309061){return db[_0xa8b1('0x2e')][_0xa8b1('0xb0')]()[_0xa8b1('0x23')](respondWithResult(_0x309061,null))[_0xa8b1('0xa8')](handleError(_0x309061,null));};exports[_0xa8b1('0xb1')]=function(_0x22a6b7,_0x339404,_0x50a045){return db[_0xa8b1('0xb2')][_0xa8b1('0x5e')]({'where':{'id':_0x22a6b7[_0xa8b1('0xaa')]['id']}})[_0xa8b1('0x23')](handleEntityNotFound(_0x339404,null))[_0xa8b1('0x23')](function(_0x257a2c){if(_0x257a2c){return _0x257a2c['addMessage'](_0x22a6b7[_0xa8b1('0x69')][_0xa8b1('0xb3')],_[_0xa8b1('0xb4')](_0x22a6b7['body'],[_0xa8b1('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x339404,null))[_0xa8b1('0xa8')](handleError(_0x339404,null));};exports[_0xa8b1('0xb5')]=function(_0x36cbe9,_0x11e902,_0xdb72fb){var _0x1fcc3b={'raw':![],'where':{}};var _0x5defd7={};var _0x29f71a={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xa8b1('0xb6')]({'where':{'id':_0x36cbe9[_0xa8b1('0xaa')]['id']}})['then'](handleEntityNotFound(_0x11e902,null))[_0xa8b1('0x23')](function(_0x41383a){if(_0x41383a){_0x5defd7[_0xa8b1('0x35')]=_[_0xa8b1('0xab')](db[_0xa8b1('0xb2')][_0xa8b1('0x2f')]);_0x5defd7[_0xa8b1('0x33')]=_[_0xa8b1('0xab')](_0x36cbe9[_0xa8b1('0x33')]);_0x5defd7[_0xa8b1('0x3a')]=_[_0xa8b1('0x34')](_0x5defd7[_0xa8b1('0x35')],_0x5defd7['query']);_0x1fcc3b['attributes']=_[_0xa8b1('0x34')](_0x5defd7['model'],qs[_0xa8b1('0x37')](_0x36cbe9[_0xa8b1('0x33')][_0xa8b1('0x37')]));_0x1fcc3b[_0xa8b1('0x36')]=_0x1fcc3b[_0xa8b1('0x36')][_0xa8b1('0x38')]?_0x1fcc3b['attributes']:_0x5defd7[_0xa8b1('0x35')];if(!_0x36cbe9[_0xa8b1('0x33')][_0xa8b1('0xb7')](_0xa8b1('0xb8'))){_0x1fcc3b[_0xa8b1('0x1f')]=qs['limit'](_0x36cbe9[_0xa8b1('0x33')][_0xa8b1('0x1f')]);_0x1fcc3b[_0xa8b1('0x1e')]=qs[_0xa8b1('0x1e')](_0x36cbe9[_0xa8b1('0x33')][_0xa8b1('0x1e')]);}_0x1fcc3b[_0xa8b1('0x85')]=qs['sort'](_0x36cbe9[_0xa8b1('0x33')]['sort']);_0x1fcc3b[_0xa8b1('0x39')]=qs['filters'](_[_0xa8b1('0xb9')](_0x36cbe9['query'],_0x5defd7[_0xa8b1('0x3a')]));_0x1fcc3b['where']['FaxInteractionId']=_0x41383a['id'];if(_0x36cbe9['query']['filter']){_0x1fcc3b['where']=_[_0xa8b1('0x91')](_0x1fcc3b[_0xa8b1('0x39')],{'$or':_[_0xa8b1('0x29')](_0x1fcc3b[_0xa8b1('0x36')],function(_0x32f8b3){var _0x1d4adb={};_0x1d4adb[_0x32f8b3]={'$like':'%'+_0x36cbe9['query'][_0xa8b1('0x78')]+'%'};return _0x1d4adb;})});}if(_0x36cbe9['query']['$gte']){var _0x54d558=_0x36cbe9[_0xa8b1('0x33')]['$gte'][_0xa8b1('0x5a')](',');var _0x49a397={};_0x49a397[_0x54d558[0x0]]={'$gte':moment(_0x54d558[0x1])[_0xa8b1('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1fcc3b['where']=_[_0xa8b1('0x91')](_0x1fcc3b[_0xa8b1('0x39')],_0x49a397);}_0x1fcc3b=_[_0xa8b1('0x91')]({},_0x1fcc3b,_0x36cbe9[_0xa8b1('0xad')]);return db[_0xa8b1('0xb2')][_0xa8b1('0xbb')]({'where':_0x1fcc3b[_0xa8b1('0x39')]})[_0xa8b1('0x23')](function(_0x2e5518){_0x29f71a[_0xa8b1('0xbb')]=_0x2e5518;if(_0x36cbe9[_0xa8b1('0x33')]['includeAll']){_0x1fcc3b[_0xa8b1('0xbc')]=[{'all':!![]}];}return db[_0xa8b1('0xb2')][_0xa8b1('0xbd')](_0x1fcc3b);})[_0xa8b1('0x23')](function(_0x193043){_0x29f71a[_0xa8b1('0xa7')]=_0x193043;return _0x29f71a;});}})[_0xa8b1('0x23')](respondWithFilteredResult(_0x11e902,_0x1fcc3b))['catch'](handleError(_0x11e902,null));};exports['addTags']=function(_0x488419,_0x3f71d0,_0x512682){return db[_0xa8b1('0x2e')][_0xa8b1('0x5e')]({'where':{'id':_0x488419[_0xa8b1('0xaa')]['id']}})['then'](handleEntityNotFound(_0x3f71d0,null))[_0xa8b1('0x23')](function(_0xcbd929){if(_0xcbd929){return _0xcbd929[_0xa8b1('0xbe')](_0x488419[_0xa8b1('0x69')][_0xa8b1('0xb3')],_[_0xa8b1('0xb4')](_0x488419['body'],[_0xa8b1('0xb3'),'id'])||{})['spread'](function(){return db[_0xa8b1('0x63')]['findAll']({'attributes':['id',_0xa8b1('0x27'),'color'],'where':{'id':_0x488419[_0xa8b1('0x69')]['ids']}});})[_0xa8b1('0x23')](function(_0x4a20fe){socket['emit'](_0xa8b1('0xbf'),{'id':Number(_0x488419['params']['id']),'tags':_0x4a20fe||[]});return{'id':Number(_0x488419[_0xa8b1('0xaa')]['id']),'tags':_0x4a20fe||[]};});}})[_0xa8b1('0x23')](respondWithResult(_0x3f71d0,null))[_0xa8b1('0xa8')](handleError(_0x3f71d0,null));};exports[_0xa8b1('0xc0')]=function(_0x44b60f,_0x99dcbf,_0x4c927c){return db[_0xa8b1('0x2e')][_0xa8b1('0x5e')]({'where':{'id':_0x44b60f[_0xa8b1('0xaa')]['id']}})['then'](handleEntityNotFound(_0x99dcbf,null))[_0xa8b1('0x23')](function(_0x4de5e5){if(_0x4de5e5){return _0x4de5e5[_0xa8b1('0xc0')](_0x44b60f[_0xa8b1('0x33')][_0xa8b1('0xb3')]);}})[_0xa8b1('0x23')](respondWithStatusCode(_0x99dcbf,null))[_0xa8b1('0xa8')](handleError(_0x99dcbf,null));};exports['download']=function(_0x5e3b9d,_0x3f49b5){var _0x4bce83=moment()[_0xa8b1('0xc1')]()['toString']();var _0xe867d6=path['join'](config[_0xa8b1('0xc2')],'server','files',_0xa8b1('0xc3'));var _0x292c56=path[_0xa8b1('0xc4')](config[_0xa8b1('0xc2')],_0xa8b1('0xc5'),_0xa8b1('0xc6'),_0xa8b1('0xc7'));var _0x535633=path[_0xa8b1('0xc4')](_0xe867d6,_0x4bce83);var _0x463f13=util[_0xa8b1('0xba')](_0xa8b1('0xc8'),_0x5e3b9d['params']['id'],_0x4bce83);var _0x4000e3=path[_0xa8b1('0xc4')](_0xe867d6,_0x463f13);var _0x586e33=[];_0x586e33[_0xa8b1('0xa6')]({'model':db['Attachment'],'as':_0xa8b1('0xc9'),'raw':!![]});var _0x2ed7fc=[{'model':db[_0xa8b1('0xb2')],'as':_0xa8b1('0xca'),'attributes':['id',_0xa8b1('0x69'),_0xa8b1('0x6e')],'include':_0x586e33}];return db[_0xa8b1('0x2e')][_0xa8b1('0x5e')]({'where':{'id':_0x5e3b9d['params']['id']},'include':_0x2ed7fc})[_0xa8b1('0x23')](handleEntityNotFound(_0x3f49b5,null))[_0xa8b1('0x23')](function(_0x1fc885){if(_0x1fc885&&_0x1fc885[_0xa8b1('0xca')]){var _0x2f1c20=_0x1fc885[_0xa8b1('0xcb')]({'plain':!![]});fs[_0xa8b1('0xcc')](_0x535633);for(var _0x5b8293=0x0;_0x5b8293<_0x2f1c20[_0xa8b1('0xca')]['length'];_0x5b8293++){var _0x440fb8=_0x2f1c20[_0xa8b1('0xca')][_0x5b8293]['Attachment'];if(_0x440fb8){var _0x4769e5=path[_0xa8b1('0xc4')](_0x292c56,_0x440fb8[_0xa8b1('0xcd')]);if(fs['existsSync'](_0x4769e5)){fs[_0xa8b1('0xce')](_0x4769e5)[_0xa8b1('0xcf')](fs['createWriteStream'](path['join'](_0x535633,_0x440fb8[_0xa8b1('0xcd')])));}}}return BPromise[_0xa8b1('0x88')]()['then'](function(){return new BPromise(function(_0x1360ed,_0x45eadd){zipdir(_0x535633,{'saveTo':_0x4000e3},function(_0x1338d5,_0x53ff9c){if(_0x1338d5)return _0x45eadd(_0x1338d5);return _0x1360ed(_0x53ff9c);});})['then'](function(){return new BPromise(function(_0x40a3db,_0x49b6d6){rimraf(_0x535633,function(_0xb8dad){if(_0xb8dad)_0x49b6d6(_0xb8dad);return _0x40a3db();});});})[_0xa8b1('0x23')](function(){return _0x3f49b5[_0xa8b1('0xd0')](_0x4000e3,_0x463f13,function(_0x2cff8e){if(_0x2cff8e){console[_0xa8b1('0xd1')](_0xa8b1('0xd2'),_0x2cff8e);}else{fs[_0xa8b1('0xd3')](_0x4000e3);}});});});}else{return _0x3f49b5['sendStatus'](0xc8);}})[_0xa8b1('0xa8')](handleError(_0x3f49b5,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 0672666..cd0bd2c 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x2563f5,_0xe731c9){var _0x83a44f=function(_0x5d4ec8){while(--_0x5d4ec8){_0x2563f5['push'](_0x2563f5['shift']());}};_0x83a44f(++_0xe731c9);}(_0x1261,0x144));var _0x1126=function(_0xe95af,_0x4b849b){_0xe95af=_0xe95af-0x0;var _0x16effb=_0x1261[_0xe95af];return _0x16effb;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x1e7da5,_0x1fa82d){var _0x23d096=function(_0x1d6784){while(--_0x1d6784){_0x1e7da5['push'](_0x1e7da5['shift']());}};_0x23d096(++_0x1fa82d);}(_0x814b,0x1a2));var _0xb814=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0x814b[_0xefb4e];return _0x36c78c;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 0452609..6fc940e 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 _0xe706=['../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x42ad8b,_0x50b99c){var _0x1ef86a=function(_0x3a682d){while(--_0x3a682d){_0x42ad8b['push'](_0x42ad8b['shift']());}};_0x1ef86a(++_0x50b99c);}(_0xe706,0xa3));var _0x6e70=function(_0x54b4a8,_0x3abef0){_0x54b4a8=_0x54b4a8-0x0;var _0x4c7a5f=_0xe706[_0x54b4a8];return _0x4c7a5f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188ed3,_0x3c4843,_0x449b48){if(_0x188ed3[_0x6e70('0xe')](_0x6e70('0xf'))){_0x188ed3[_0x6e70('0x10')]=moment()[_0x6e70('0x11')](_0x6e70('0x12'));}_0x449b48(null,_0x188ed3);}}});}; \ No newline at end of file +var _0x70e0=['path','rimraf','./faxInteraction.attributes','fax_interactions','changed','closed','closedAt','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x2449cd,_0x2b4a79){var _0x261497=function(_0x21ff0e){while(--_0x21ff0e){_0x2449cd['push'](_0x2449cd['shift']());}};_0x261497(++_0x2b4a79);}(_0x70e0,0x17b));var _0x070e=function(_0x21bbc5,_0x178958){_0x21bbc5=_0x21bbc5-0x0;var _0x4b6bc1=_0x70e0[_0x21bbc5];return _0x4b6bc1;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('FaxInteraction',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e11f0,_0x604664,_0x2611e6){if(_0x1e11f0[_0x070e('0x9')](_0x070e('0xa'))){_0x1e11f0[_0x070e('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2611e6(null,_0x1e11f0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d04d308..ac12492 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 _0x5dba=['error','code','message','result','update','options','raw','where','limit','info','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x5dba,0x110));var _0xa5db=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x5dba[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0xa5db('0x0'));var util=require('util');var moment=require(_0xa5db('0x1'));var BPromise=require(_0xa5db('0x2'));var rs=require(_0xa5db('0x3'));var fs=require('fs');var Redis=require(_0xa5db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5db('0x5'))('rpc');var config=require(_0xa5db('0x6'));var jayson=require(_0xa5db('0x7'));var client=jayson[_0xa5db('0x8')][_0xa5db('0x9')]({'port':0x232a});config[_0xa5db('0xa')]=_[_0xa5db('0xb')](config['redis'],{'host':_0xa5db('0xc'),'port':0x18eb});var socket=require(_0xa5db('0xd'))(new Redis(config[_0xa5db('0xa')]));require(_0xa5db('0xe'))['register'](socket);function respondWithRpcPromise(_0x1b9b95,_0x405301,_0x65fa6b){return new BPromise(function(_0x7681c,_0xa94b20){return client[_0xa5db('0xf')](_0x1b9b95,_0x65fa6b)[_0xa5db('0x10')](function(_0x41e14a){logger['info'](_0xa5db('0x11'),_0x405301,'request\x20sent');logger[_0xa5db('0x12')](_0xa5db('0x13'),_0x405301,_0xa5db('0x14'),JSON[_0xa5db('0x15')](_0x41e14a));if(_0x41e14a[_0xa5db('0x16')]){if(_0x41e14a[_0xa5db('0x16')][_0xa5db('0x17')]===0x1f4){logger['error'](_0xa5db('0x11'),_0x405301,_0x41e14a['error']['message']);return _0xa94b20(_0x41e14a['error'][_0xa5db('0x18')]);}logger['error'](_0xa5db('0x11'),_0x405301,_0x41e14a[_0xa5db('0x16')]['message']);return _0x7681c(_0x41e14a[_0xa5db('0x16')][_0xa5db('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x405301,_0xa5db('0x14'));_0x7681c(_0x41e14a[_0xa5db('0x19')][_0xa5db('0x18')]);}})['catch'](function(_0x534db6){logger[_0xa5db('0x16')](_0xa5db('0x11'),_0x405301,_0x534db6);_0xa94b20(_0x534db6);});});}exports['UpdateFaxInteraction']=function(_0x1945c2){var _0x522e78=this;return new Promise(function(_0x15c22d,_0x321187){return db['FaxInteraction'][_0xa5db('0x1a')](_0x1945c2['body'],{'raw':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')][_0xa5db('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')][_0xa5db('0x1d')]||null:null,'attributes':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2[_0xa5db('0x1b')]['attributes']||null:null,'limit':_0x1945c2[_0xa5db('0x1b')]?_0x1945c2['options'][_0xa5db('0x1e')]||null:null})[_0xa5db('0x10')](function(_0x330b04){logger[_0xa5db('0x1f')](_0xa5db('0x20'),_0x1945c2);logger['debug'](_0xa5db('0x20'),_0x1945c2,JSON['stringify'](_0x330b04));_0x15c22d(_0x330b04);})[_0xa5db('0x21')](function(_0x2f8532){logger['error'](_0xa5db('0x20'),_0x2f8532[_0xa5db('0x18')],_0x1945c2);_0x321187(_0x522e78[_0xa5db('0x16')](0x1f4,_0x2f8532[_0xa5db('0x18')]));});});};exports[_0xa5db('0x22')]=function(_0x11f173){return new Promise(function(_0x2f297a,_0x1c9fe3){return db[_0xa5db('0x23')][_0xa5db('0x24')]({'where':_0x11f173[_0xa5db('0x1b')]?_0x11f173['options'][_0xa5db('0x1d')]||null:null})[_0xa5db('0x10')](function(_0x37b0b2){if(_0x37b0b2){return _0x37b0b2[_0xa5db('0x25')](_0x11f173[_0xa5db('0x26')][_0xa5db('0x27')],_[_0xa5db('0x28')](_0x11f173['body'],['ids','id'])||{});}})['spread'](function(_0x7c6df){logger['info'](_0xa5db('0x29'),_0x11f173);logger[_0xa5db('0x12')](_0xa5db('0x29'),_0x11f173,JSON[_0xa5db('0x15')](_0x7c6df));_0x2f297a(_0x7c6df);})['catch'](function(_0x16f2b5){logger[_0xa5db('0x16')](_0xa5db('0x29'),_0x16f2b5['message'],_0x11f173);_0x1c9fe3(_this['error'](0x1f4,_0x16f2b5[_0xa5db('0x18')]));});});}; \ No newline at end of file +var _0xa0bb=['body','ids','omit','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','then'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0xa0bb,0x19b));var _0xba0b=function(_0xd730d2,_0x1695eb){_0xd730d2=_0xd730d2-0x0;var _0x2c2bc1=_0xa0bb[_0xd730d2];return _0x2c2bc1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba0b('0x0'));var BPromise=require(_0xba0b('0x1'));var rs=require(_0xba0b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba0b('0x3'))['db'];var utils=require(_0xba0b('0x4'));var logger=require(_0xba0b('0x5'))('rpc');var config=require(_0xba0b('0x6'));var jayson=require(_0xba0b('0x7'));var client=jayson[_0xba0b('0x8')][_0xba0b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xba0b('0xa')],{'host':_0xba0b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba0b('0xa')]));require(_0xba0b('0xc'))[_0xba0b('0xd')](socket);function respondWithRpcPromise(_0x1476f3,_0x68dc41,_0x18cfe9){return new BPromise(function(_0x533661,_0x12d777){return client[_0xba0b('0xe')](_0x1476f3,_0x18cfe9)['then'](function(_0x442be9){logger[_0xba0b('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x68dc41,_0xba0b('0x10'));logger[_0xba0b('0x11')](_0xba0b('0x12'),_0x68dc41,_0xba0b('0x10'),JSON[_0xba0b('0x13')](_0x442be9));if(_0x442be9[_0xba0b('0x14')]){if(_0x442be9['error']['code']===0x1f4){logger[_0xba0b('0x14')](_0xba0b('0x15'),_0x68dc41,_0x442be9[_0xba0b('0x14')][_0xba0b('0x16')]);return _0x12d777(_0x442be9[_0xba0b('0x14')]['message']);}logger['error'](_0xba0b('0x15'),_0x68dc41,_0x442be9[_0xba0b('0x14')][_0xba0b('0x16')]);return _0x533661(_0x442be9[_0xba0b('0x14')]['message']);}else{logger[_0xba0b('0xf')](_0xba0b('0x15'),_0x68dc41,_0xba0b('0x10'));_0x533661(_0x442be9[_0xba0b('0x17')][_0xba0b('0x16')]);}})[_0xba0b('0x18')](function(_0xa92867){logger[_0xba0b('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x68dc41,_0xa92867);_0x12d777(_0xa92867);});});}exports[_0xba0b('0x19')]=function(_0x3a5922){var _0x27c42f=this;return new Promise(function(_0x209f76,_0x353dce){return db[_0xba0b('0x1a')]['update'](_0x3a5922['body'],{'raw':_0x3a5922['options']?_0x3a5922[_0xba0b('0x1b')][_0xba0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5922[_0xba0b('0x1b')]?_0x3a5922[_0xba0b('0x1b')][_0xba0b('0x1d')]||null:null,'attributes':_0x3a5922[_0xba0b('0x1b')]?_0x3a5922[_0xba0b('0x1b')][_0xba0b('0x1e')]||null:null,'limit':_0x3a5922[_0xba0b('0x1b')]?_0x3a5922['options'][_0xba0b('0x1f')]||null:null})[_0xba0b('0x20')](function(_0x6fe9e0){logger[_0xba0b('0xf')](_0xba0b('0x19'),_0x3a5922);logger[_0xba0b('0x11')](_0xba0b('0x19'),_0x3a5922,JSON['stringify'](_0x6fe9e0));_0x209f76(_0x6fe9e0);})[_0xba0b('0x18')](function(_0x2ff66c){logger[_0xba0b('0x14')]('UpdateFaxInteraction',_0x2ff66c['message'],_0x3a5922);_0x353dce(_0x27c42f[_0xba0b('0x14')](0x1f4,_0x2ff66c['message']));});});};exports['AddTagsToFaxInteraction']=function(_0xb854b1){return new Promise(function(_0x4197be,_0x25e28d){return db[_0xba0b('0x1a')]['find']({'where':_0xb854b1['options']?_0xb854b1[_0xba0b('0x1b')][_0xba0b('0x1d')]||null:null})[_0xba0b('0x20')](function(_0x186d95){if(_0x186d95){return _0x186d95['addTags'](_0xb854b1[_0xba0b('0x21')][_0xba0b('0x22')],_[_0xba0b('0x23')](_0xb854b1[_0xba0b('0x21')],[_0xba0b('0x22'),'id'])||{});}})['spread'](function(_0xea4893){logger['info'](_0xba0b('0x24'),_0xb854b1);logger[_0xba0b('0x11')]('AddTags',_0xb854b1,JSON[_0xba0b('0x13')](_0xea4893));_0x4197be(_0xea4893);})[_0xba0b('0x18')](function(_0x7a1faf){logger[_0xba0b('0x14')](_0xba0b('0x24'),_0x7a1faf[_0xba0b('0x16')],_0xb854b1);_0x25e28d(_this[_0xba0b('0x14')](0x1f4,_0x7a1faf['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 742bf69..2693ec7 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 _0x0c87=['removeListener','register','length','save','remove','update','emit'];(function(_0x4b7ef2,_0x17854d){var _0xf61f45=function(_0x114e5c){while(--_0x114e5c){_0x4b7ef2['push'](_0x4b7ef2['shift']());}};_0xf61f45(++_0x17854d);}(_0x0c87,0x10d));var _0x70c8=function(_0x431988,_0x290e33){_0x431988=_0x431988-0x0;var _0x113194=_0x0c87[_0x431988];return _0x113194;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x70c8('0x0'),_0x70c8('0x1'),_0x70c8('0x2')];function createListener(_0x3470fb,_0x51cb78){return function(_0x2ce6fb){_0x51cb78[_0x70c8('0x3')](_0x3470fb,_0x2ce6fb);};}function removeListener(_0x1aa15d,_0x152108){return function(){FaxInteractionEvents[_0x70c8('0x4')](_0x1aa15d,_0x152108);};}exports[_0x70c8('0x5')]=function(_0x2f0bf6){for(var _0x250d5b=0x0,_0x1ea93f=events[_0x70c8('0x6')];_0x250d5b<_0x1ea93f;_0x250d5b++){var _0x3083e8=events[_0x250d5b];var _0x564e61=createListener('faxInteraction:'+_0x3083e8,_0x2f0bf6);FaxInteractionEvents['on'](_0x3083e8,_0x564e61);}}; \ No newline at end of file +var _0x48ba=['remove','update','removeListener','register','length','save'];(function(_0x5463f8,_0x4671ae){var _0x343dda=function(_0x1c8f5e){while(--_0x1c8f5e){_0x5463f8['push'](_0x5463f8['shift']());}};_0x343dda(++_0x4671ae);}(_0x48ba,0x89));var _0xa48b=function(_0x2636b3,_0x4fdcb9){_0x2636b3=_0x2636b3-0x0;var _0x180436=_0x48ba[_0x2636b3];return _0x180436;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xa48b('0x0'),_0xa48b('0x1'),_0xa48b('0x2')];function createListener(_0x29ad62,_0xb325fc){return function(_0x266e0d){_0xb325fc['emit'](_0x29ad62,_0x266e0d);};}function removeListener(_0xe306d4,_0x4b7ab7){return function(){FaxInteractionEvents[_0xa48b('0x3')](_0xe306d4,_0x4b7ab7);};}exports[_0xa48b('0x4')]=function(_0x4ae446){for(var _0x69cb6b=0x0,_0x3a23ad=events[_0xa48b('0x5')];_0x69cb6b<_0x3a23ad;_0x69cb6b++){var _0x57f90d=events[_0x69cb6b];var _0x47c155=createListener('faxInteraction:'+_0x57f90d,_0x4ae446);FaxInteractionEvents['on'](_0x57f90d,_0x47c155);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7e59f65..03a8116 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 _0x9362=['post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','removeTags','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0xe5d5e5,_0x53e13a){var _0x26d457=function(_0x105fd8){while(--_0x105fd8){_0xe5d5e5['push'](_0xe5d5e5['shift']());}};_0x26d457(++_0x53e13a);}(_0x9362,0x169));var _0x2936=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9362[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2936('0x0'));var util=require('util');var path=require(_0x2936('0x1'));var timeout=require('connect-timeout');var express=require(_0x2936('0x2'));var router=express[_0x2936('0x3')]();var auth=require(_0x2936('0x4'));var interaction=require(_0x2936('0x5'));var config=require('../../config/environment');var controller=require(_0x2936('0x6'));router['get']('/',auth[_0x2936('0x7')](),controller[_0x2936('0x8')]);router[_0x2936('0x9')](_0x2936('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2936('0x9')](_0x2936('0xb'),auth[_0x2936('0x7')](),controller['show']);router[_0x2936('0x9')](_0x2936('0xc'),auth[_0x2936('0x7')](),controller[_0x2936('0xd')]);router['get'](_0x2936('0xe'),auth[_0x2936('0x7')](),controller[_0x2936('0xf')]);router[_0x2936('0x10')]('/',auth[_0x2936('0x7')](),controller[_0x2936('0x11')]);router[_0x2936('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2936('0x12')]);router[_0x2936('0x10')](_0x2936('0x13'),auth['isAuthenticated'](),interaction[_0x2936('0x14')](_0x2936('0x15'),_0x2936('0x16')),controller[_0x2936('0x17')]);router[_0x2936('0x18')](_0x2936('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x2936('0x15'),_0x2936('0x19')),controller[_0x2936('0x1a')]);router[_0x2936('0x1b')](_0x2936('0xb'),auth['isAuthenticated'](),interaction[_0x2936('0x14')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0x2936('0x1b')](_0x2936('0x13'),auth[_0x2936('0x7')](),controller[_0x2936('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xea03=['/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xea03,0x15e));var _0x3ea0=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xea03[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require(_0x3ea0('0x0'));var util=require(_0x3ea0('0x1'));var path=require(_0x3ea0('0x2'));var timeout=require(_0x3ea0('0x3'));var express=require(_0x3ea0('0x4'));var router=express[_0x3ea0('0x5')]();var auth=require(_0x3ea0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3ea0('0x7'));var controller=require(_0x3ea0('0x8'));router[_0x3ea0('0x9')]('/',auth[_0x3ea0('0xa')](),controller[_0x3ea0('0xb')]);router[_0x3ea0('0x9')](_0x3ea0('0xc'),auth[_0x3ea0('0xa')](),controller['describe']);router[_0x3ea0('0x9')](_0x3ea0('0xd'),auth[_0x3ea0('0xa')](),controller[_0x3ea0('0xe')]);router['get'](_0x3ea0('0xf'),auth['isAuthenticated'](),controller[_0x3ea0('0x10')]);router[_0x3ea0('0x9')](_0x3ea0('0x11'),auth[_0x3ea0('0xa')](),controller[_0x3ea0('0x12')]);router[_0x3ea0('0x13')]('/',auth['isAuthenticated'](),controller[_0x3ea0('0x14')]);router[_0x3ea0('0x13')](_0x3ea0('0xf'),auth[_0x3ea0('0xa')](),controller[_0x3ea0('0x15')]);router[_0x3ea0('0x13')](_0x3ea0('0x16'),auth[_0x3ea0('0xa')](),interaction[_0x3ea0('0x17')](_0x3ea0('0x18'),_0x3ea0('0x19')),controller[_0x3ea0('0x1a')]);router['put']('/:id',auth[_0x3ea0('0xa')](),interaction['tracked'](_0x3ea0('0x18'),_0x3ea0('0x1b')),controller[_0x3ea0('0x1c')]);router[_0x3ea0('0x1d')](_0x3ea0('0xd'),auth['isAuthenticated'](),interaction[_0x3ea0('0x17')]('fax',_0x3ea0('0x1e')),controller[_0x3ea0('0x1f')]);router['delete'](_0x3ea0('0x16'),auth[_0x3ea0('0xa')](),controller['removeTags']);module[_0x3ea0('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index e9716a1..6d55bd2 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 _0x5c5a=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0xccdffb,_0x17b96f){var _0x3b3bca=function(_0x2c9198){while(--_0x2c9198){_0xccdffb['push'](_0xccdffb['shift']());}};_0x3b3bca(++_0x17b96f);}(_0x5c5a,0x12f));var _0xa5c5=function(_0x40ae98,_0xd089a){_0x40ae98=_0x40ae98-0x0;var _0x507f6c=_0x5c5a[_0x40ae98];return _0x507f6c;};'use strict';var Sequelize=require(_0xa5c5('0x0'));module[_0xa5c5('0x1')]={'body':{'type':Sequelize[_0xa5c5('0x2')](_0xa5c5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa5c5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5c5('0x5')]('in',_0xa5c5('0x6')),'defaultValue':_0xa5c5('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa5c5('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa5c5('0x7')]}}; \ No newline at end of file +var _0x4e49=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x352599,_0x2ceced){var _0x30d70f=function(_0x51b6df){while(--_0x51b6df){_0x352599['push'](_0x352599['shift']());}};_0x30d70f(++_0x2ceced);}(_0x4e49,0x1f0));var _0x94e4=function(_0x23f68d,_0x2d1357){_0x23f68d=_0x23f68d-0x0;var _0x768964=_0x4e49[_0x23f68d];return _0x768964;};'use strict';var Sequelize=require(_0x94e4('0x0'));module[_0x94e4('0x1')]={'body':{'type':Sequelize['TEXT'](_0x94e4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x94e4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x94e4('0x4')]('in','out'),'defaultValue':_0x94e4('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x94e4('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x94e4('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a032664..cdb7d83 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 _0xa020=['register','jayson/promise','client','http','test','Sequelize','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','send','index','FaxMessage','rawAttributes','fieldName','type','model','map','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','body','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','info','role','interaction','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax','agent','null','RejectMessage','rejectMessage','event','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xa020,0x1eb));var _0x0a02=function(_0xd6ccc2,_0x23c534){_0xd6ccc2=_0xd6ccc2-0x0;var _0x228768=_0xa020[_0xd6ccc2];return _0x228768;};'use strict';var pdf=require(_0x0a02('0x0'));var emlformat=require(_0x0a02('0x1'));var rimraf=require(_0x0a02('0x2'));var zipdir=require(_0x0a02('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a02('0x4'));var moment=require(_0x0a02('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0a02('0x6'));var util=require('util');var path=require(_0x0a02('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a02('0x8'));var fs=require('fs');var _=require(_0x0a02('0x9'));var squel=require(_0x0a02('0xa'));var crypto=require('crypto');var jsforce=require(_0x0a02('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a02('0xc'));var Papa=require(_0x0a02('0xd'));var Redis=require(_0x0a02('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a02('0xf'));var hardwareService=require(_0x0a02('0x10'));var logger=require(_0x0a02('0x11'))('api');var utils=require(_0x0a02('0x12'));var config=require(_0x0a02('0x13'));var db=require(_0x0a02('0x14'))['db'];config[_0x0a02('0x15')]=_[_0x0a02('0x16')](config[_0x0a02('0x15')],{'host':_0x0a02('0x17'),'port':0x18eb});var socket=require(_0x0a02('0x18'))(new Redis(config[_0x0a02('0x15')]));require('./faxMessage.socket')[_0x0a02('0x19')](socket);var jayson=require(_0x0a02('0x1a'));var client=jayson[_0x0a02('0x1b')][_0x0a02('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a02('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x54318f,_0xdfc5f5,_0x4650c7){if(_0x4650c7){var _0x4d03c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d03c2[_0x0a02('0x1d')](_0xdfc5f5)){return _0x54318f;}else{throw new db[(_0x0a02('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54318f;}}function respondWithRpcPromise(_0x536c0d,_0x57faea,_0x2aacec,_0x1e6c9a){return new BPromise(function(_0x4ca66f,_0x2d0469){var _0x59b38b=_0x1e6c9a||client;return _0x59b38b[_0x0a02('0x1f')](_0x536c0d,_0x2aacec)[_0x0a02('0x20')](function(_0x2e1eda){logger['info'](_0x0a02('0x21'),_0x57faea,_0x0a02('0x22'));logger[_0x0a02('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x57faea,_0x0a02('0x22'),JSON[_0x0a02('0x24')](_0x2e1eda));if(_0x2e1eda[_0x0a02('0x25')]){if(_0x2e1eda[_0x0a02('0x25')]['code']===0x1f4){logger[_0x0a02('0x25')]('FaxMessage,\x20%s,\x20%s',_0x57faea,_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);return _0x2d0469(_0x2e1eda[_0x0a02('0x25')]['message']);}logger[_0x0a02('0x25')](_0x0a02('0x21'),_0x57faea,_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);return _0x4ca66f(_0x2e1eda[_0x0a02('0x25')][_0x0a02('0x26')]);}else{logger['info'](_0x0a02('0x21'),_0x57faea,_0x0a02('0x22'));_0x4ca66f(_0x2e1eda[_0x0a02('0x27')]['message']);}})['catch'](function(_0x7a783e){logger[_0x0a02('0x25')](_0x0a02('0x21'),_0x57faea,_0x7a783e);_0x2d0469(_0x7a783e);});});}function respondWithStatusCode(_0x3eb4f0,_0x2a0498){_0x2a0498=_0x2a0498||0xcc;return function(_0x2f2d61){if(_0x2f2d61){return _0x3eb4f0['sendStatus'](_0x2a0498);}return _0x3eb4f0[_0x0a02('0x28')](_0x2a0498)[_0x0a02('0x29')]();};}function respondWithResult(_0x442e73,_0x2e781e){_0x2e781e=_0x2e781e||0xc8;return function(_0x36d1e8){if(_0x36d1e8){return _0x442e73['status'](_0x2e781e)[_0x0a02('0x2a')](_0x36d1e8);}};}function respondWithFilteredResult(_0x3ca1e2,_0x29465c){return function(_0x3dde39){if(_0x3dde39){var _0x11f38d=_0x3dde39[_0x0a02('0x2b')],_0x553b13=_0x29465c[_0x0a02('0x2c')],_0x411760=_0x29465c[_0x0a02('0x2c')]+_0x29465c[_0x0a02('0x2d')],_0xb7009e;if(_0x411760>=_0x11f38d){_0x411760=_0x11f38d;_0xb7009e=0xc8;}else{_0xb7009e=0xce;}_0x3ca1e2[_0x0a02('0x28')](_0xb7009e);return _0x3ca1e2[_0x0a02('0x2e')](_0x0a02('0x2f'),_0x553b13+'-'+_0x411760+'/'+_0x11f38d)[_0x0a02('0x2a')](_0x3dde39);}return null;};}function patchUpdates(_0x1ed82e){return function(_0x389cac){try{jsonpatch['apply'](_0x389cac,_0x1ed82e,!![]);}catch(_0x24d2d3){return BPromise[_0x0a02('0x30')](_0x24d2d3);}return _0x389cac['save']();};}function saveUpdates(_0x34ff7f,_0x9d11b2){return function(_0x3b3665){if(_0x3b3665){return _0x3b3665[_0x0a02('0x31')](_0x34ff7f)[_0x0a02('0x20')](function(_0xe2eab){return _0xe2eab;});}return null;};}function removeEntity(_0x4affa1,_0x5cc97b){return function(_0x5b7ac1){if(_0x5b7ac1){return _0x5b7ac1[_0x0a02('0x32')]()[_0x0a02('0x20')](function(){_0x4affa1[_0x0a02('0x28')](0xcc)[_0x0a02('0x29')]();});}};}function handleEntityNotFound(_0x520948,_0x302d51){return function(_0x23329a){if(!_0x23329a){_0x520948[_0x0a02('0x33')](0x194);}return _0x23329a;};}function handleError(_0x2c0058,_0x1743be){_0x1743be=_0x1743be||0x1f4;return function(_0x339285){logger['error'](_0x339285[_0x0a02('0x34')]);if(_0x339285['name']){delete _0x339285['name'];}_0x2c0058[_0x0a02('0x28')](_0x1743be)[_0x0a02('0x35')](_0x339285);};}exports[_0x0a02('0x36')]=function(_0x4f2e0f,_0x8700d2){var _0x5ba31e={},_0xe2ec52={},_0x123dbb={'count':0x0,'rows':[]};var _0x479d53=_['map'](db[_0x0a02('0x37')][_0x0a02('0x38')],function(_0x66f011){return{'name':_0x66f011[_0x0a02('0x39')],'type':_0x66f011[_0x0a02('0x3a')]['key']};});_0xe2ec52[_0x0a02('0x3b')]=_[_0x0a02('0x3c')](_0x479d53,_0x0a02('0x3d'));_0xe2ec52['query']=_[_0x0a02('0x3e')](_0x4f2e0f[_0x0a02('0x3f')]);_0xe2ec52[_0x0a02('0x40')]=_[_0x0a02('0x41')](_0xe2ec52[_0x0a02('0x3b')],_0xe2ec52[_0x0a02('0x3f')]);_0x5ba31e['attributes']=_[_0x0a02('0x41')](_0xe2ec52[_0x0a02('0x3b')],qs[_0x0a02('0x42')](_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x42')]));_0x5ba31e[_0x0a02('0x43')]=_0x5ba31e['attributes'][_0x0a02('0x44')]?_0x5ba31e[_0x0a02('0x43')]:_0xe2ec52[_0x0a02('0x3b')];if(!_0x4f2e0f['query']['hasOwnProperty'](_0x0a02('0x45'))){_0x5ba31e[_0x0a02('0x2d')]=qs[_0x0a02('0x2d')](_0x4f2e0f['query'][_0x0a02('0x2d')]);_0x5ba31e[_0x0a02('0x2c')]=qs[_0x0a02('0x2c')](_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x2c')]);}_0x5ba31e[_0x0a02('0x46')]=qs[_0x0a02('0x47')](_0x4f2e0f['query']['sort']);_0x5ba31e[_0x0a02('0x48')]=qs[_0x0a02('0x40')](_[_0x0a02('0x49')](_0x4f2e0f['query'],_0xe2ec52[_0x0a02('0x40')]),_0x479d53);if(_0x4f2e0f['query']['filter']){_0x5ba31e[_0x0a02('0x48')]=_[_0x0a02('0x4a')](_0x5ba31e[_0x0a02('0x48')],{'$or':_[_0x0a02('0x3c')](_0x479d53,function(_0x30ed1c){if(_0x30ed1c[_0x0a02('0x3a')]!==_0x0a02('0x4b')){var _0x43b339={};_0x43b339[_0x30ed1c['name']]={'$like':'%'+_0x4f2e0f[_0x0a02('0x3f')][_0x0a02('0x4c')]+'%'};return _0x43b339;}})});}_0x5ba31e=_[_0x0a02('0x4a')]({},_0x5ba31e,_0x4f2e0f[_0x0a02('0x4d')]);var _0xb4ab50={'where':_0x5ba31e['where']};return db[_0x0a02('0x37')][_0x0a02('0x2b')](_0xb4ab50)[_0x0a02('0x20')](function(_0x172511){_0x123dbb[_0x0a02('0x2b')]=_0x172511;if(_0x4f2e0f[_0x0a02('0x3f')]['includeAll']){_0x5ba31e[_0x0a02('0x4e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5ba31e);})[_0x0a02('0x20')](function(_0x321783){_0x123dbb[_0x0a02('0x4f')]=_0x321783;return _0x123dbb;})[_0x0a02('0x20')](respondWithFilteredResult(_0x8700d2,_0x5ba31e))[_0x0a02('0x50')](handleError(_0x8700d2,null));};exports['show']=function(_0x4fffcd,_0x21a6f7){var _0xefd5c0={'raw':!![],'where':{'id':_0x4fffcd[_0x0a02('0x51')]['id']}},_0x27041e={};_0x27041e[_0x0a02('0x3b')]=_[_0x0a02('0x3e')](db[_0x0a02('0x37')][_0x0a02('0x38')]);_0x27041e[_0x0a02('0x3f')]=_[_0x0a02('0x3e')](_0x4fffcd[_0x0a02('0x3f')]);_0x27041e[_0x0a02('0x40')]=_[_0x0a02('0x41')](_0x27041e[_0x0a02('0x3b')],_0x27041e[_0x0a02('0x3f')]);_0xefd5c0[_0x0a02('0x43')]=_['intersection'](_0x27041e[_0x0a02('0x3b')],qs[_0x0a02('0x42')](_0x4fffcd[_0x0a02('0x3f')]['fields']));_0xefd5c0[_0x0a02('0x43')]=_0xefd5c0[_0x0a02('0x43')][_0x0a02('0x44')]?_0xefd5c0[_0x0a02('0x43')]:_0x27041e[_0x0a02('0x3b')];if(_0x4fffcd[_0x0a02('0x3f')][_0x0a02('0x52')]){_0xefd5c0['include']=[{'all':!![]}];}_0xefd5c0=_['merge']({},_0xefd5c0,_0x4fffcd[_0x0a02('0x4d')]);return db['FaxMessage'][_0x0a02('0x53')](_0xefd5c0)[_0x0a02('0x20')](handleEntityNotFound(_0x21a6f7,null))[_0x0a02('0x20')](respondWithResult(_0x21a6f7,null))[_0x0a02('0x50')](handleError(_0x21a6f7,null));};exports['update']=function(_0x1e357d,_0x2dc238){if(_0x1e357d[_0x0a02('0x54')]['id']){delete _0x1e357d['body']['id'];}return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x1e357d[_0x0a02('0x51')]['id']}})[_0x0a02('0x20')](handleEntityNotFound(_0x2dc238,null))['then'](saveUpdates(_0x1e357d['body'],null))[_0x0a02('0x20')](respondWithResult(_0x2dc238,null))[_0x0a02('0x50')](handleError(_0x2dc238,null));};exports['destroy']=function(_0x55014c,_0xaf1fcc){return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x55014c[_0x0a02('0x51')]['id']}})['then'](handleEntityNotFound(_0xaf1fcc,null))[_0x0a02('0x20')](removeEntity(_0xaf1fcc,null))['catch'](handleError(_0xaf1fcc,null));};exports[_0x0a02('0x55')]=function(_0x27a360,_0x1943f6){return db['FaxMessage'][_0x0a02('0x55')]()['then'](respondWithResult(_0x1943f6,null))[_0x0a02('0x50')](handleError(_0x1943f6,null));};var interaction_log=require(_0x0a02('0x11'))(_0x0a02('0x56'));exports[_0x0a02('0x57')]=function(_0x1b32c7,_0x31c2f1,_0x12771e){var _0x5644c1={'channel':'fax'};if(_0x1b32c7[_0x0a02('0x54')]['id']){delete _0x1b32c7[_0x0a02('0x54')]['id'];}_0x1b32c7['body']['read']=!![];_0x1b32c7['body'][_0x0a02('0x58')]=moment()[_0x0a02('0x59')](_0x0a02('0x5a'));_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x5b')]=_0x1b32c7['body'][_0x0a02('0x5b')]||_0x1b32c7[_0x0a02('0x5c')]['id'];return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x1b32c7[_0x0a02('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x0a02('0x5d')],'as':_0x0a02('0x5e')}]})[_0x0a02('0x20')](handleEntityNotFound(_0x31c2f1,null))[_0x0a02('0x20')](saveUpdates(_0x1b32c7['body'],null))[_0x0a02('0x20')](function(_0x70aae1){if(_0x70aae1){_0x5644c1[_0x0a02('0x26')]=_0x70aae1[_0x0a02('0x5f')]({'plain':!![]});return db[_0x0a02('0x60')][_0x0a02('0x53')]({'where':{'id':_0x70aae1[_0x0a02('0x61')]}});}return null;})[_0x0a02('0x20')](handleEntityNotFound(_0x31c2f1,null))[_0x0a02('0x20')](function(_0x1ef4f1){if(_0x1ef4f1){return _0x1ef4f1[_0x0a02('0x31')]({'UserId':_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x5b')],'read1stAt':_[_0x0a02('0x62')](_0x1ef4f1[_0x0a02('0x63')])?moment()[_0x0a02('0x59')](_0x0a02('0x5a')):undefined});}return null;})[_0x0a02('0x20')](function(_0x2b879e){if(_0x2b879e){_0x5644c1['interaction']=_0x2b879e[_0x0a02('0x5f')]({'plain':!![]});interaction_log[_0x0a02('0x64')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b32c7['user']['id'],_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x3d')],_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x65')],_0x5644c1[_0x0a02('0x66')]['id'],_0x1b32c7['body']?JSON[_0x0a02('0x24')](_0x1b32c7[_0x0a02('0x54')]):'null');return respondWithRpcPromise(_0x0a02('0x67'),'acceptMessage',_0x5644c1);}return null;})['then'](function(_0x1e5e19){if(_0x1e5e19){if(_0x1b32c7[_0x0a02('0x54')][_0x0a02('0x68')]){_0x5644c1[_0x0a02('0x26')][_0x0a02('0x69')]=util['format'](_0x0a02('0x6a'),_0x1b32c7[_0x0a02('0x5c')][_0x0a02('0x3d')]);_0x5644c1[_0x0a02('0x26')][_0x0a02('0x6b')]=_0x5644c1[_0x0a02('0x6b')];_0x5644c1['message']['event']=_0x0a02('0x57');return respondWithRpcPromise(_0x0a02('0x6c'),'EventManager',{'event':_0x0a02('0x6d'),'message':_0x5644c1[_0x0a02('0x26')]},client9002)[_0x0a02('0x20')](function(){return _0x5644c1;});}return _0x5644c1;}return null;})[_0x0a02('0x20')](respondWithResult(_0x31c2f1,null))[_0x0a02('0x50')](handleError(_0x31c2f1,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x0a02('0x30')]=function(_0xb2ff9e,_0xcb6d5e,_0x4ca7d7){var _0x112f23={'agent':{},'channel':_0x0a02('0x6e')};if(_0xb2ff9e[_0x0a02('0x54')]['id']){delete _0xb2ff9e['body']['id'];}_0xb2ff9e['body'][_0x0a02('0x5b')]=_0xb2ff9e['body']['UserId']||_0xb2ff9e[_0x0a02('0x5c')]['id'];_0x112f23[_0x0a02('0x6f')]['id']=_0xb2ff9e[_0x0a02('0x54')][_0x0a02('0x5b')];return db['FaxMessage'][_0x0a02('0x53')]({'where':{'id':_0xb2ff9e[_0x0a02('0x51')]['id'],'UserId':null}})[_0x0a02('0x20')](handleEntityNotFound(_0xcb6d5e,null))[_0x0a02('0x20')](function(_0x4cbbec){if(_0x4cbbec){_0x112f23[_0x0a02('0x26')]=_0x4cbbec[_0x0a02('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4cbbec[_0x0a02('0x61')]}});}return null;})[_0x0a02('0x20')](handleEntityNotFound(_0xcb6d5e,null))['then'](function(_0x3d6eb2){if(_0x3d6eb2){_0x112f23[_0x0a02('0x66')]=_0x3d6eb2[_0x0a02('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb2ff9e['user']['id'],_0xb2ff9e['user'][_0x0a02('0x3d')],_0xb2ff9e[_0x0a02('0x5c')][_0x0a02('0x65')],_0x112f23[_0x0a02('0x66')]['id'],_0xb2ff9e['body']?JSON[_0x0a02('0x24')](_0xb2ff9e[_0x0a02('0x54')]):_0x0a02('0x70'));return respondWithRpcPromise(_0x0a02('0x71'),_0x0a02('0x72'),_0x112f23);}return null;})[_0x0a02('0x20')](function(_0x7073c7){if(_0x7073c7){_0x7073c7['message'][_0x0a02('0x69')]=util['format']('SIP/%s',_0xb2ff9e['user'][_0x0a02('0x3d')]);_0x7073c7[_0x0a02('0x26')][_0x0a02('0x6b')]=_0x112f23['channel'];_0x7073c7[_0x0a02('0x26')][_0x0a02('0x73')]=_0x0a02('0x30');respondWithRpcPromise('EventManager',_0x0a02('0x6c'),{'event':'rejectmessage','message':_0x7073c7[_0x0a02('0x26')]},client9002);return _0x112f23;}return null;})[_0x0a02('0x20')](respondWithResult(_0xcb6d5e,null))[_0x0a02('0x50')](handleError(_0xcb6d5e,null));};exports[_0x0a02('0x74')]=function(_0x44bb49,_0x2edab1){var _0x256d16;return db[_0x0a02('0x37')][_0x0a02('0x74')](_0x44bb49[_0x0a02('0x54')],{})[_0x0a02('0x20')](function(_0x35fc41){_0x256d16=_0x35fc41;return db[_0x0a02('0x5d')][_0x0a02('0x75')]({'where':{'id':_0x256d16['ContactId']}});})[_0x0a02('0x20')](function(_0xc286ce){if(_[_0x0a02('0x62')](_0xc286ce)){return;}else{_0x256d16[_0x0a02('0x6e')]=_0xc286ce[_0x0a02('0x6e')];return db[_0x0a02('0x76')][_0x0a02('0x75')]({'where':{'id':_0x256d16[_0x0a02('0x77')]}});}})[_0x0a02('0x20')](function(_0x2c3c04){return respondWithRpcPromise('SendFax',_0x0a02('0x78'),{'FaxAccountId':_['isNil'](_0x44bb49[_0x0a02('0x54')])?undefined:_0x44bb49['body'][_0x0a02('0x79')],'path':_[_0x0a02('0x62')](_0x2c3c04)?undefined:util[_0x0a02('0x59')](_0x0a02('0x7a'),_0x2c3c04[_0x0a02('0x7b')]),'fax':_['isNil'](_0x256d16[_0x0a02('0x6e')])?undefined:_0x256d16[_0x0a02('0x6e')],'AttachmentId':_0x256d16[_0x0a02('0x77')]},client9002);})['then'](respondWithResult(_0x2edab1,0xc9))['catch'](handleError(_0x2edab1,null));};exports[_0x0a02('0x7c')]=function(_0x336b40,_0x5f539e){var _0x3825ab=path['join'](config[_0x0a02('0x7d')],_0x0a02('0x7e'),_0x0a02('0x7f'),'attachments');return db[_0x0a02('0x37')][_0x0a02('0x53')]({'where':{'id':_0x336b40[_0x0a02('0x51')]['id']},'include':[{'model':db['Attachment'],'as':_0x0a02('0x76')}]})[_0x0a02('0x20')](handleEntityNotFound(_0x5f539e,null))[_0x0a02('0x20')](function(_0x2d4fbd){if(_0x2d4fbd){return _0x5f539e[_0x0a02('0x7c')](path[_0x0a02('0x80')](_0x3825ab,_0x2d4fbd[_0x0a02('0x76')]['basename']));}})['catch'](handleError(_0x5f539e,null));}; \ No newline at end of file +var _0x03b0=['then','request\x20sent','debug','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','sort','filters','filter','where','merge','count','includeAll','include','rows','keys','find','body','destroy','describe','fax-interactions','accept','fax','read','readAt','UserId','user','CmContact','Contact','FaxInteractionId','isNil','read1stAt','format','interaction','get','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','channel','EventManager','acceptmessage','params','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','event','rejectmessage','create','findOne','ContactId','AttachmentId','SendFax','FaxAccountId','basename','join','server','Attachment','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x03b0,0xda));var _0x003b=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x03b0[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x003b('0x0'));var emlformat=require(_0x003b('0x1'));var rimraf=require(_0x003b('0x2'));var zipdir=require(_0x003b('0x3'));var jsonpatch=require(_0x003b('0x4'));var rp=require(_0x003b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x003b('0x6'));var util=require(_0x003b('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x003b('0x8'));var crypto=require(_0x003b('0x9'));var jsforce=require(_0x003b('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x003b('0xb'));var authService=require(_0x003b('0xc'));var qs=require(_0x003b('0xd'));var as=require(_0x003b('0xe'));var hardwareService=require(_0x003b('0xf'));var logger=require(_0x003b('0x10'))(_0x003b('0x11'));var utils=require(_0x003b('0x12'));var config=require(_0x003b('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x003b('0x14')](config['redis'],{'host':_0x003b('0x15'),'port':0x18eb});var socket=require(_0x003b('0x16'))(new Redis(config[_0x003b('0x17')]));require(_0x003b('0x18'))[_0x003b('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x003b('0x1a')][_0x003b('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x003b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x208d36,_0x1278f1,_0x1444f1){if(_0x1444f1){var _0x38a4fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38a4fd[_0x003b('0x1c')](_0x1278f1)){return _0x208d36;}else{throw new db[(_0x003b('0x1d'))][(_0x003b('0x1e'))](_0x003b('0x1f'));}}else{return _0x208d36;}}function respondWithRpcPromise(_0x3007c4,_0x14fe71,_0x282230,_0x1c7949){return new BPromise(function(_0x300fe5,_0x1118e2){var _0xf5331f=_0x1c7949||client;return _0xf5331f['request'](_0x3007c4,_0x282230)[_0x003b('0x20')](function(_0x2fff03){logger['info']('FaxMessage,\x20%s,\x20%s',_0x14fe71,_0x003b('0x21'));logger[_0x003b('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x14fe71,_0x003b('0x21'),JSON[_0x003b('0x23')](_0x2fff03));if(_0x2fff03[_0x003b('0x24')]){if(_0x2fff03[_0x003b('0x24')][_0x003b('0x25')]===0x1f4){logger[_0x003b('0x24')]('FaxMessage,\x20%s,\x20%s',_0x14fe71,_0x2fff03[_0x003b('0x24')][_0x003b('0x26')]);return _0x1118e2(_0x2fff03[_0x003b('0x24')]['message']);}logger[_0x003b('0x24')](_0x003b('0x27'),_0x14fe71,_0x2fff03[_0x003b('0x24')][_0x003b('0x26')]);return _0x300fe5(_0x2fff03[_0x003b('0x24')][_0x003b('0x26')]);}else{logger['info'](_0x003b('0x27'),_0x14fe71,_0x003b('0x21'));_0x300fe5(_0x2fff03['result'][_0x003b('0x26')]);}})[_0x003b('0x28')](function(_0x16a0de){logger['error'](_0x003b('0x27'),_0x14fe71,_0x16a0de);_0x1118e2(_0x16a0de);});});}function respondWithStatusCode(_0x222b73,_0x562fd8){_0x562fd8=_0x562fd8||0xcc;return function(_0x5716c5){if(_0x5716c5){return _0x222b73[_0x003b('0x29')](_0x562fd8);}return _0x222b73['status'](_0x562fd8)[_0x003b('0x2a')]();};}function respondWithResult(_0x355d0b,_0x5e576a){_0x5e576a=_0x5e576a||0xc8;return function(_0x5a76d6){if(_0x5a76d6){return _0x355d0b[_0x003b('0x2b')](_0x5e576a)[_0x003b('0x2c')](_0x5a76d6);}};}function respondWithFilteredResult(_0x5e5867,_0x49d8c7){return function(_0x245f39){if(_0x245f39){var _0x181d6c=_0x245f39['count'],_0x10a114=_0x49d8c7[_0x003b('0x2d')],_0x2dbdf2=_0x49d8c7[_0x003b('0x2d')]+_0x49d8c7[_0x003b('0x2e')],_0x2393ed;if(_0x2dbdf2>=_0x181d6c){_0x2dbdf2=_0x181d6c;_0x2393ed=0xc8;}else{_0x2393ed=0xce;}_0x5e5867['status'](_0x2393ed);return _0x5e5867['set'](_0x003b('0x2f'),_0x10a114+'-'+_0x2dbdf2+'/'+_0x181d6c)[_0x003b('0x2c')](_0x245f39);}return null;};}function patchUpdates(_0x3b3181){return function(_0x1d8732){try{jsonpatch[_0x003b('0x30')](_0x1d8732,_0x3b3181,!![]);}catch(_0x43d679){return BPromise[_0x003b('0x31')](_0x43d679);}return _0x1d8732[_0x003b('0x32')]();};}function saveUpdates(_0x4dc71c,_0x58bfd8){return function(_0x799392){if(_0x799392){return _0x799392['update'](_0x4dc71c)[_0x003b('0x20')](function(_0x414779){return _0x414779;});}return null;};}function removeEntity(_0x55c0f9,_0x3be8b7){return function(_0x243242){if(_0x243242){return _0x243242['destroy']()['then'](function(){_0x55c0f9[_0x003b('0x2b')](0xcc)[_0x003b('0x2a')]();});}};}function handleEntityNotFound(_0x50eb17,_0x355cb5){return function(_0x2286fd){if(!_0x2286fd){_0x50eb17['sendStatus'](0x194);}return _0x2286fd;};}function handleError(_0x27e3b4,_0x1ca8d4){_0x1ca8d4=_0x1ca8d4||0x1f4;return function(_0xf8439){logger[_0x003b('0x24')](_0xf8439[_0x003b('0x33')]);if(_0xf8439[_0x003b('0x34')]){delete _0xf8439['name'];}_0x27e3b4[_0x003b('0x2b')](_0x1ca8d4)[_0x003b('0x35')](_0xf8439);};}exports[_0x003b('0x36')]=function(_0x52993e,_0x46c0d1){var _0x121b3d={},_0x3e3df6={},_0xf9b0df={'count':0x0,'rows':[]};var _0x793809=_[_0x003b('0x37')](db[_0x003b('0x38')][_0x003b('0x39')],function(_0x574b90){return{'name':_0x574b90[_0x003b('0x3a')],'type':_0x574b90['type'][_0x003b('0x3b')]};});_0x3e3df6[_0x003b('0x3c')]=_['map'](_0x793809,_0x003b('0x34'));_0x3e3df6['query']=_['keys'](_0x52993e['query']);_0x3e3df6['filters']=_['intersection'](_0x3e3df6[_0x003b('0x3c')],_0x3e3df6['query']);_0x121b3d[_0x003b('0x3d')]=_[_0x003b('0x3e')](_0x3e3df6[_0x003b('0x3c')],qs[_0x003b('0x3f')](_0x52993e[_0x003b('0x40')][_0x003b('0x3f')]));_0x121b3d[_0x003b('0x3d')]=_0x121b3d[_0x003b('0x3d')]['length']?_0x121b3d[_0x003b('0x3d')]:_0x3e3df6[_0x003b('0x3c')];if(!_0x52993e['query'][_0x003b('0x41')](_0x003b('0x42'))){_0x121b3d[_0x003b('0x2e')]=qs[_0x003b('0x2e')](_0x52993e[_0x003b('0x40')][_0x003b('0x2e')]);_0x121b3d['offset']=qs[_0x003b('0x2d')](_0x52993e['query'][_0x003b('0x2d')]);}_0x121b3d['order']=qs['sort'](_0x52993e[_0x003b('0x40')][_0x003b('0x43')]);_0x121b3d['where']=qs['filters'](_['pick'](_0x52993e['query'],_0x3e3df6[_0x003b('0x44')]),_0x793809);if(_0x52993e[_0x003b('0x40')][_0x003b('0x45')]){_0x121b3d[_0x003b('0x46')]=_[_0x003b('0x47')](_0x121b3d['where'],{'$or':_['map'](_0x793809,function(_0x56b993){if(_0x56b993['type']!=='VIRTUAL'){var _0x1d0459={};_0x1d0459[_0x56b993[_0x003b('0x34')]]={'$like':'%'+_0x52993e[_0x003b('0x40')]['filter']+'%'};return _0x1d0459;}})});}_0x121b3d=_['merge']({},_0x121b3d,_0x52993e['options']);var _0x26bd4d={'where':_0x121b3d[_0x003b('0x46')]};return db['FaxMessage'][_0x003b('0x48')](_0x26bd4d)[_0x003b('0x20')](function(_0x39e6d5){_0xf9b0df[_0x003b('0x48')]=_0x39e6d5;if(_0x52993e['query'][_0x003b('0x49')]){_0x121b3d[_0x003b('0x4a')]=[{'all':!![]}];}return db[_0x003b('0x38')]['findAll'](_0x121b3d);})[_0x003b('0x20')](function(_0xf08b39){_0xf9b0df[_0x003b('0x4b')]=_0xf08b39;return _0xf9b0df;})['then'](respondWithFilteredResult(_0x46c0d1,_0x121b3d))[_0x003b('0x28')](handleError(_0x46c0d1,null));};exports['show']=function(_0x485f72,_0xb8abf6){var _0x52c782={'raw':!![],'where':{'id':_0x485f72['params']['id']}},_0x16d4df={};_0x16d4df['model']=_[_0x003b('0x4c')](db['FaxMessage'][_0x003b('0x39')]);_0x16d4df[_0x003b('0x40')]=_[_0x003b('0x4c')](_0x485f72[_0x003b('0x40')]);_0x16d4df[_0x003b('0x44')]=_[_0x003b('0x3e')](_0x16d4df[_0x003b('0x3c')],_0x16d4df[_0x003b('0x40')]);_0x52c782[_0x003b('0x3d')]=_[_0x003b('0x3e')](_0x16d4df[_0x003b('0x3c')],qs[_0x003b('0x3f')](_0x485f72['query'][_0x003b('0x3f')]));_0x52c782[_0x003b('0x3d')]=_0x52c782['attributes']['length']?_0x52c782[_0x003b('0x3d')]:_0x16d4df[_0x003b('0x3c')];if(_0x485f72[_0x003b('0x40')][_0x003b('0x49')]){_0x52c782['include']=[{'all':!![]}];}_0x52c782=_[_0x003b('0x47')]({},_0x52c782,_0x485f72['options']);return db['FaxMessage'][_0x003b('0x4d')](_0x52c782)[_0x003b('0x20')](handleEntityNotFound(_0xb8abf6,null))[_0x003b('0x20')](respondWithResult(_0xb8abf6,null))['catch'](handleError(_0xb8abf6,null));};exports['update']=function(_0x4f8d8a,_0x5a1814){if(_0x4f8d8a[_0x003b('0x4e')]['id']){delete _0x4f8d8a['body']['id'];}return db[_0x003b('0x38')][_0x003b('0x4d')]({'where':{'id':_0x4f8d8a['params']['id']}})['then'](handleEntityNotFound(_0x5a1814,null))[_0x003b('0x20')](saveUpdates(_0x4f8d8a[_0x003b('0x4e')],null))[_0x003b('0x20')](respondWithResult(_0x5a1814,null))['catch'](handleError(_0x5a1814,null));};exports[_0x003b('0x4f')]=function(_0x290910,_0x160145){return db['FaxMessage']['find']({'where':{'id':_0x290910['params']['id']}})[_0x003b('0x20')](handleEntityNotFound(_0x160145,null))[_0x003b('0x20')](removeEntity(_0x160145,null))[_0x003b('0x28')](handleError(_0x160145,null));};exports[_0x003b('0x50')]=function(_0x495e69,_0x923399){return db[_0x003b('0x38')][_0x003b('0x50')]()[_0x003b('0x20')](respondWithResult(_0x923399,null))['catch'](handleError(_0x923399,null));};var interaction_log=require(_0x003b('0x10'))(_0x003b('0x51'));exports[_0x003b('0x52')]=function(_0x8a4d1f,_0x44eb93,_0x4b3220){var _0x39b08d={'channel':_0x003b('0x53')};if(_0x8a4d1f[_0x003b('0x4e')]['id']){delete _0x8a4d1f[_0x003b('0x4e')]['id'];}_0x8a4d1f['body'][_0x003b('0x54')]=!![];_0x8a4d1f[_0x003b('0x4e')][_0x003b('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8a4d1f[_0x003b('0x4e')][_0x003b('0x56')]=_0x8a4d1f[_0x003b('0x4e')]['UserId']||_0x8a4d1f[_0x003b('0x57')]['id'];return db[_0x003b('0x38')]['find']({'where':{'id':_0x8a4d1f['params']['id'],'UserId':null},'include':[{'model':db[_0x003b('0x58')],'as':_0x003b('0x59')}]})[_0x003b('0x20')](handleEntityNotFound(_0x44eb93,null))['then'](saveUpdates(_0x8a4d1f[_0x003b('0x4e')],null))[_0x003b('0x20')](function(_0x24166d){if(_0x24166d){_0x39b08d[_0x003b('0x26')]=_0x24166d['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x24166d[_0x003b('0x5a')]}});}return null;})[_0x003b('0x20')](handleEntityNotFound(_0x44eb93,null))[_0x003b('0x20')](function(_0x42c424){if(_0x42c424){return _0x42c424['update']({'UserId':_0x8a4d1f[_0x003b('0x4e')][_0x003b('0x56')],'read1stAt':_[_0x003b('0x5b')](_0x42c424[_0x003b('0x5c')])?moment()[_0x003b('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x003b('0x20')](function(_0x5aaeec){if(_0x5aaeec){_0x39b08d[_0x003b('0x5e')]=_0x5aaeec[_0x003b('0x5f')]({'plain':!![]});interaction_log[_0x003b('0x60')](_0x003b('0x61'),_0x8a4d1f[_0x003b('0x57')]['id'],_0x8a4d1f[_0x003b('0x57')][_0x003b('0x34')],_0x8a4d1f[_0x003b('0x57')]['role'],_0x39b08d[_0x003b('0x5e')]['id'],_0x8a4d1f['body']?JSON['stringify'](_0x8a4d1f['body']):_0x003b('0x62'));return respondWithRpcPromise(_0x003b('0x63'),_0x003b('0x64'),_0x39b08d);}return null;})[_0x003b('0x20')](function(_0x4034cb){if(_0x4034cb){if(_0x8a4d1f[_0x003b('0x4e')][_0x003b('0x65')]){_0x39b08d[_0x003b('0x26')]['interface']=util[_0x003b('0x5d')]('SIP/%s',_0x8a4d1f[_0x003b('0x57')]['name']);_0x39b08d[_0x003b('0x26')][_0x003b('0x66')]=_0x39b08d['channel'];_0x39b08d[_0x003b('0x26')]['event']=_0x003b('0x52');return respondWithRpcPromise('EventManager',_0x003b('0x67'),{'event':_0x003b('0x68'),'message':_0x39b08d[_0x003b('0x26')]},client9002)[_0x003b('0x20')](function(){return _0x39b08d;});}return _0x39b08d;}return null;})[_0x003b('0x20')](respondWithResult(_0x44eb93,null))[_0x003b('0x28')](handleError(_0x44eb93,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x003b('0x31')]=function(_0x43ab96,_0x4e12fa,_0x3946ac){var _0xdaeadb={'agent':{},'channel':_0x003b('0x53')};if(_0x43ab96[_0x003b('0x4e')]['id']){delete _0x43ab96[_0x003b('0x4e')]['id'];}_0x43ab96[_0x003b('0x4e')][_0x003b('0x56')]=_0x43ab96['body'][_0x003b('0x56')]||_0x43ab96['user']['id'];_0xdaeadb['agent']['id']=_0x43ab96[_0x003b('0x4e')]['UserId'];return db['FaxMessage'][_0x003b('0x4d')]({'where':{'id':_0x43ab96[_0x003b('0x69')]['id'],'UserId':null}})[_0x003b('0x20')](handleEntityNotFound(_0x4e12fa,null))['then'](function(_0x2c9cf1){if(_0x2c9cf1){_0xdaeadb[_0x003b('0x26')]=_0x2c9cf1['get']({'plain':!![]});return db[_0x003b('0x6a')][_0x003b('0x4d')]({'where':{'id':_0x2c9cf1['FaxInteractionId']}});}return null;})[_0x003b('0x20')](handleEntityNotFound(_0x4e12fa,null))[_0x003b('0x20')](function(_0x19b124){if(_0x19b124){_0xdaeadb['interaction']=_0x19b124['get']({'plain':!![]});interaction_log[_0x003b('0x60')](_0x003b('0x6b'),_0x43ab96[_0x003b('0x57')]['id'],_0x43ab96['user']['name'],_0x43ab96[_0x003b('0x57')]['role'],_0xdaeadb[_0x003b('0x5e')]['id'],_0x43ab96[_0x003b('0x4e')]?JSON[_0x003b('0x23')](_0x43ab96[_0x003b('0x4e')]):_0x003b('0x62'));return respondWithRpcPromise(_0x003b('0x6c'),_0x003b('0x6d'),_0xdaeadb);}return null;})[_0x003b('0x20')](function(_0x283c0c){if(_0x283c0c){_0x283c0c[_0x003b('0x26')][_0x003b('0x6e')]=util[_0x003b('0x5d')](_0x003b('0x6f'),_0x43ab96['user'][_0x003b('0x34')]);_0x283c0c['message'][_0x003b('0x66')]=_0xdaeadb[_0x003b('0x66')];_0x283c0c[_0x003b('0x26')][_0x003b('0x70')]=_0x003b('0x31');respondWithRpcPromise(_0x003b('0x67'),_0x003b('0x67'),{'event':_0x003b('0x71'),'message':_0x283c0c[_0x003b('0x26')]},client9002);return _0xdaeadb;}return null;})[_0x003b('0x20')](respondWithResult(_0x4e12fa,null))['catch'](handleError(_0x4e12fa,null));};exports[_0x003b('0x72')]=function(_0x1c1c3d,_0x22e228){var _0x2eafb5;return db[_0x003b('0x38')][_0x003b('0x72')](_0x1c1c3d[_0x003b('0x4e')],{})['then'](function(_0x1b62e9){_0x2eafb5=_0x1b62e9;return db['CmContact'][_0x003b('0x73')]({'where':{'id':_0x2eafb5[_0x003b('0x74')]}});})[_0x003b('0x20')](function(_0x3b9b9e){if(_[_0x003b('0x5b')](_0x3b9b9e)){return;}else{_0x2eafb5['fax']=_0x3b9b9e[_0x003b('0x53')];return db['Attachment'][_0x003b('0x73')]({'where':{'id':_0x2eafb5[_0x003b('0x75')]}});}})[_0x003b('0x20')](function(_0x4b6b40){return respondWithRpcPromise('SendFax',_0x003b('0x76'),{'FaxAccountId':_[_0x003b('0x5b')](_0x1c1c3d[_0x003b('0x4e')])?undefined:_0x1c1c3d['body'][_0x003b('0x77')],'path':_[_0x003b('0x5b')](_0x4b6b40)?undefined:util[_0x003b('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x4b6b40[_0x003b('0x78')]),'fax':_[_0x003b('0x5b')](_0x2eafb5[_0x003b('0x53')])?undefined:_0x2eafb5['fax'],'AttachmentId':_0x2eafb5[_0x003b('0x75')]},client9002);})[_0x003b('0x20')](respondWithResult(_0x22e228,0xc9))[_0x003b('0x28')](handleError(_0x22e228,null));};exports['download']=function(_0x59b1ec,_0x1d3763){var _0x3c6248=path[_0x003b('0x79')](config['root'],_0x003b('0x7a'),'files','attachments');return db['FaxMessage'][_0x003b('0x4d')]({'where':{'id':_0x59b1ec[_0x003b('0x69')]['id']},'include':[{'model':db[_0x003b('0x7b')],'as':'Attachment'}]})[_0x003b('0x20')](handleEntityNotFound(_0x1d3763,null))[_0x003b('0x20')](function(_0xe93aeb){if(_0xe93aeb){return _0x1d3763[_0x003b('0x7c')](path[_0x003b('0x79')](_0x3c6248,_0xe93aeb[_0x003b('0x7b')][_0x003b('0x78')]));}})[_0x003b('0x28')](handleError(_0x1d3763,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index c0693c6..cf13cb7 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x34bc1e,_0x308714){var _0x4c402a=function(_0x533f8c){while(--_0x533f8c){_0x34bc1e['push'](_0x34bc1e['shift']());}};_0x4c402a(++_0x308714);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x5fc3[_0x4d1ee9];return _0x9a5456;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 76c916d..d35b98f 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 _0x6561=['error','utf8mb4','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6561,0x6e));var _0x1656=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0x6561[_0x39551a];return _0x4b0b62;};'use strict';var _=require(_0x1656('0x0'));var util=require(_0x1656('0x1'));var logger=require('../../config/logger')(_0x1656('0x2'));var moment=require(_0x1656('0x3'));var BPromise=require(_0x1656('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1656('0x5'));var config=require(_0x1656('0x6'));var attributes=require(_0x1656('0x7'));module['exports']=function(_0x1c76f1,_0xe37e54){return _0x1c76f1[_0x1656('0x8')](_0x1656('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x1656('0xa'),'fields':['body'],'type':_0x1656('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c994f,_0x1e3ff4,_0x4d76b8){var _0x4dfa81=_0x1c76f1['models'];var _0x7c4cc3=_0x2c994f[_0x1656('0xc')]({'plain':!![]});if(_0x7c4cc3[_0x1656('0xd')][_0x1656('0xe')]()==='in'||_0x7c4cc3['direction'][_0x1656('0xe')]()===_0x1656('0xf')&&!_0x7c4cc3[_0x1656('0x10')]&&!_[_0x1656('0x11')](_0x7c4cc3[_0x1656('0x12')])){_0x4dfa81[_0x1656('0x13')]['findOne']({'where':{'id':_0x7c4cc3[_0x1656('0x14')]}})[_0x1656('0x15')](function(_0x44bf5f){if(_0x44bf5f){_0x44bf5f[_0x1656('0x16')]({'lastMsgAt':_0x7c4cc3[_0x1656('0x17')],'lastMsgDirection':_0x7c4cc3['direction']['toLowerCase']()});}})[_0x1656('0x18')](function(_0x4c857d){console[_0x1656('0x19')](_0x4c857d);});}_0x4d76b8();}},'charset':_0x1656('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x318e=['UserId','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','out','secret'];(function(_0x4e7102,_0x283dee){var _0x58f5d1=function(_0x479955){while(--_0x479955){_0x4e7102['push'](_0x4e7102['shift']());}};_0x58f5d1(++_0x283dee);}(_0x318e,0x19e));var _0xe318=function(_0x108ed8,_0x35e304){_0x108ed8=_0x108ed8-0x0;var _0x54b623=_0x318e[_0x108ed8];return _0x54b623;};'use strict';var _=require(_0xe318('0x0'));var util=require(_0xe318('0x1'));var logger=require(_0xe318('0x2'))(_0xe318('0x3'));var moment=require(_0xe318('0x4'));var BPromise=require(_0xe318('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe318('0x6'));var rimraf=require(_0xe318('0x7'));var config=require('../../config/environment');var attributes=require(_0xe318('0x8'));module[_0xe318('0x9')]=function(_0x2747f4,_0x5ec243){return _0x2747f4[_0xe318('0xa')](_0xe318('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xe318('0xc'),'fields':[_0xe318('0xd')],'type':_0xe318('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48fcfa,_0x57f823,_0x571c48){var _0x24f310=_0x2747f4[_0xe318('0xf')];var _0x4d8580=_0x48fcfa[_0xe318('0x10')]({'plain':!![]});if(_0x4d8580[_0xe318('0x11')]['toLowerCase']()==='in'||_0x4d8580[_0xe318('0x11')]['toLowerCase']()===_0xe318('0x12')&&!_0x4d8580[_0xe318('0x13')]&&!_['isNil'](_0x4d8580[_0xe318('0x14')])){_0x24f310['FaxInteraction'][_0xe318('0x15')]({'where':{'id':_0x4d8580[_0xe318('0x16')]}})[_0xe318('0x17')](function(_0x4acd20){if(_0x4acd20){_0x4acd20[_0xe318('0x18')]({'lastMsgAt':_0x4d8580[_0xe318('0x19')],'lastMsgDirection':_0x4d8580[_0xe318('0x11')][_0xe318('0x1a')]()});}})[_0xe318('0x1b')](function(_0x19375f){console[_0xe318('0x1c')](_0x19375f);});}_0x571c48();}},'charset':_0xe318('0x1d'),'collate':_0xe318('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a68dd4a..a0942af 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 _0x8b2b=['rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','debug','stringify','update','where','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x23c569,_0x2440cf){_0x23c569=_0x23c569-0x0;var _0x19cb4b=_0x8b2b[_0x23c569];return _0x19cb4b;};'use strict';var _=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var moment=require(_0xb8b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xb8b2('0x3'));var fs=require('fs');var Redis=require(_0xb8b2('0x4'));var db=require(_0xb8b2('0x5'))['db'];var utils=require(_0xb8b2('0x6'));var logger=require(_0xb8b2('0x7'))(_0xb8b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb8b2('0x9')][_0xb8b2('0xa')]({'port':0x232a});config[_0xb8b2('0xb')]=_[_0xb8b2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb8b2('0xd'))(new Redis(config[_0xb8b2('0xb')]));require(_0xb8b2('0xe'))[_0xb8b2('0xf')](socket);function respondWithRpcPromise(_0x3542b6,_0x564fe2,_0x3adebc){return new BPromise(function(_0x501001,_0x51cae3){return client[_0xb8b2('0x10')](_0x3542b6,_0x3adebc)[_0xb8b2('0x11')](function(_0x58b67){logger[_0xb8b2('0x12')](_0xb8b2('0x13'),_0x564fe2,_0xb8b2('0x14'));logger['debug'](_0xb8b2('0x15'),_0x564fe2,'request\x20sent',JSON['stringify'](_0x58b67));if(_0x58b67['error']){if(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x17')]===0x1f4){logger['error'](_0xb8b2('0x13'),_0x564fe2,_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);return _0x51cae3(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x564fe2,_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);return _0x501001(_0x58b67[_0xb8b2('0x16')][_0xb8b2('0x18')]);}else{logger[_0xb8b2('0x12')]('FaxMessage,\x20%s,\x20%s',_0x564fe2,'request\x20sent');_0x501001(_0x58b67[_0xb8b2('0x19')][_0xb8b2('0x18')]);}})[_0xb8b2('0x1a')](function(_0x100f52){logger['error'](_0xb8b2('0x13'),_0x564fe2,_0x100f52);_0x51cae3(_0x100f52);});});}exports[_0xb8b2('0x1b')]=function(_0x9f4388){var _0x30c67f=this;return new Promise(function(_0x3d0be7,_0x1cbc65){return db[_0xb8b2('0x1c')]['create'](_0x9f4388[_0xb8b2('0x1d')],{'raw':_0x9f4388[_0xb8b2('0x1e')]?_0x9f4388[_0xb8b2('0x1e')][_0xb8b2('0x1f')]===undefined?!![]:![]:!![]})[_0xb8b2('0x11')](function(_0x5a0a43){logger[_0xb8b2('0x12')]('CreateFaxMessage',_0x9f4388);logger[_0xb8b2('0x20')](_0xb8b2('0x1b'),_0x9f4388,JSON[_0xb8b2('0x21')](_0x5a0a43));_0x3d0be7(_0x5a0a43);})[_0xb8b2('0x1a')](function(_0x5dc876){logger[_0xb8b2('0x16')](_0xb8b2('0x1b'),_0x5dc876[_0xb8b2('0x18')],_0x9f4388);_0x1cbc65(_0x30c67f['error'](0x1f4,_0x5dc876['message']));});});};exports['UpdateFaxMessage']=function(_0x585d5b){var _0x36ae2d=this;return new Promise(function(_0x10d8f3,_0x3bdb27){return db[_0xb8b2('0x1c')][_0xb8b2('0x22')](_0x585d5b[_0xb8b2('0x1d')],{'raw':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x23')]||null:null,'attributes':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')][_0xb8b2('0x24')]||null:null,'limit':_0x585d5b[_0xb8b2('0x1e')]?_0x585d5b[_0xb8b2('0x1e')]['limit']||null:null})[_0xb8b2('0x11')](function(_0x1899d9){logger[_0xb8b2('0x12')](_0xb8b2('0x25'),_0x585d5b);logger[_0xb8b2('0x20')]('UpdateFaxMessage',_0x585d5b,JSON[_0xb8b2('0x21')](_0x1899d9));_0x10d8f3(_0x1899d9);})[_0xb8b2('0x1a')](function(_0x26309e){logger['error'](_0xb8b2('0x25'),_0x26309e[_0xb8b2('0x18')],_0x585d5b);_0x3bdb27(_0x36ae2d['error'](0x1f4,_0x26309e[_0xb8b2('0x18')]));});});}; \ No newline at end of file +var _0xb151=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x2a92a4,_0x5ca2ec){var _0x383acc=function(_0x5a040d){while(--_0x5a040d){_0x2a92a4['push'](_0x2a92a4['shift']());}};_0x383acc(++_0x5ca2ec);}(_0xb151,0x151));var _0x1b15=function(_0x4c1acd,_0x1be1bc){_0x4c1acd=_0x4c1acd-0x0;var _0xa46490=_0xb151[_0x4c1acd];return _0xa46490;};'use strict';var _=require(_0x1b15('0x0'));var util=require(_0x1b15('0x1'));var moment=require(_0x1b15('0x2'));var BPromise=require(_0x1b15('0x3'));var rs=require(_0x1b15('0x4'));var fs=require('fs');var Redis=require(_0x1b15('0x5'));var db=require(_0x1b15('0x6'))['db'];var utils=require(_0x1b15('0x7'));var logger=require(_0x1b15('0x8'))('rpc');var config=require(_0x1b15('0x9'));var jayson=require(_0x1b15('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x1b15('0xb')]=_['defaults'](config[_0x1b15('0xb')],{'host':_0x1b15('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b15('0xb')]));require('./faxMessage.socket')[_0x1b15('0xd')](socket);function respondWithRpcPromise(_0x1b2c47,_0x2095da,_0x5a44b2){return new BPromise(function(_0x137b9d,_0x3bf8be){return client[_0x1b15('0xe')](_0x1b2c47,_0x5a44b2)[_0x1b15('0xf')](function(_0x54c7af){logger[_0x1b15('0x10')](_0x1b15('0x11'),_0x2095da,_0x1b15('0x12'));logger[_0x1b15('0x13')](_0x1b15('0x14'),_0x2095da,'request\x20sent',JSON[_0x1b15('0x15')](_0x54c7af));if(_0x54c7af[_0x1b15('0x16')]){if(_0x54c7af[_0x1b15('0x16')][_0x1b15('0x17')]===0x1f4){logger[_0x1b15('0x16')](_0x1b15('0x11'),_0x2095da,_0x54c7af[_0x1b15('0x16')][_0x1b15('0x18')]);return _0x3bf8be(_0x54c7af['error'][_0x1b15('0x18')]);}logger[_0x1b15('0x16')]('FaxMessage,\x20%s,\x20%s',_0x2095da,_0x54c7af['error'][_0x1b15('0x18')]);return _0x137b9d(_0x54c7af[_0x1b15('0x16')][_0x1b15('0x18')]);}else{logger[_0x1b15('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2095da,_0x1b15('0x12'));_0x137b9d(_0x54c7af[_0x1b15('0x19')][_0x1b15('0x18')]);}})[_0x1b15('0x1a')](function(_0x5aba1d){logger[_0x1b15('0x16')](_0x1b15('0x11'),_0x2095da,_0x5aba1d);_0x3bf8be(_0x5aba1d);});});}exports['CreateFaxMessage']=function(_0x53eeb5){var _0x2dee5c=this;return new Promise(function(_0xdb1cb9,_0x2e6821){return db['FaxMessage'][_0x1b15('0x1b')](_0x53eeb5[_0x1b15('0x1c')],{'raw':_0x53eeb5[_0x1b15('0x1d')]?_0x53eeb5['options'][_0x1b15('0x1e')]===undefined?!![]:![]:!![]})[_0x1b15('0xf')](function(_0x4e125f){logger[_0x1b15('0x10')](_0x1b15('0x1f'),_0x53eeb5);logger[_0x1b15('0x13')](_0x1b15('0x1f'),_0x53eeb5,JSON[_0x1b15('0x15')](_0x4e125f));_0xdb1cb9(_0x4e125f);})[_0x1b15('0x1a')](function(_0x529e83){logger[_0x1b15('0x16')]('CreateFaxMessage',_0x529e83[_0x1b15('0x18')],_0x53eeb5);_0x2e6821(_0x2dee5c[_0x1b15('0x16')](0x1f4,_0x529e83['message']));});});};exports[_0x1b15('0x20')]=function(_0x4ae394){var _0x15020e=this;return new Promise(function(_0x48e23f,_0x383bd8){return db[_0x1b15('0x21')][_0x1b15('0x22')](_0x4ae394['body'],{'raw':_0x4ae394[_0x1b15('0x1d')]?_0x4ae394['options'][_0x1b15('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ae394[_0x1b15('0x1d')]?_0x4ae394[_0x1b15('0x1d')][_0x1b15('0x23')]||null:null,'attributes':_0x4ae394[_0x1b15('0x1d')]?_0x4ae394[_0x1b15('0x1d')][_0x1b15('0x24')]||null:null,'limit':_0x4ae394['options']?_0x4ae394[_0x1b15('0x1d')][_0x1b15('0x25')]||null:null})['then'](function(_0x1eca37){logger[_0x1b15('0x10')](_0x1b15('0x20'),_0x4ae394);logger[_0x1b15('0x13')](_0x1b15('0x20'),_0x4ae394,JSON[_0x1b15('0x15')](_0x1eca37));_0x48e23f(_0x1eca37);})[_0x1b15('0x1a')](function(_0x28cec7){logger[_0x1b15('0x16')](_0x1b15('0x20'),_0x28cec7['message'],_0x4ae394);_0x383bd8(_0x15020e[_0x1b15('0x16')](0x1f4,_0x28cec7['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b725a6c..0e2d242 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_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 32c6c53..be078e6 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 _0x2470=['get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x2470,0xb6));var _0x0247=function(_0x4745a7,_0x37a893){_0x4745a7=_0x4745a7-0x0;var _0x8c5686=_0x2470[_0x4745a7];return _0x8c5686;};'use strict';var multer=require(_0x0247('0x0'));var util=require(_0x0247('0x1'));var path=require('path');var timeout=require(_0x0247('0x2'));var express=require(_0x0247('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0247('0x4'));var config=require(_0x0247('0x5'));var controller=require(_0x0247('0x6'));router[_0x0247('0x7')]('/',auth['isAuthenticated'](),controller[_0x0247('0x8')]);router[_0x0247('0x7')](_0x0247('0x9'),auth[_0x0247('0xa')](),controller[_0x0247('0xb')]);router['get'](_0x0247('0xc'),auth[_0x0247('0xa')](),controller[_0x0247('0xd')]);router['get'](_0x0247('0xe'),auth[_0x0247('0xa')](),controller[_0x0247('0xf')]);router[_0x0247('0x10')]('/',auth['isAuthenticated'](),interaction[_0x0247('0x11')](_0x0247('0x12'),_0x0247('0x13')),controller[_0x0247('0x14')]);router[_0x0247('0x15')](_0x0247('0xc'),auth[_0x0247('0xa')](),controller[_0x0247('0x16')]);router['put'](_0x0247('0x17'),auth['isAuthenticated'](),controller[_0x0247('0x18')]);router[_0x0247('0x15')]('/:id/reject',auth[_0x0247('0xa')](),controller[_0x0247('0x19')]);router[_0x0247('0x1a')](_0x0247('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbe3e=['create','put','update','/:id/accept','/:id/reject','reject','multer','util','path','connect-timeout','express','Router','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','tracked','faxmessage:create'];(function(_0x51ff37,_0x1abef6){var _0x33e4c4=function(_0xa4d86c){while(--_0xa4d86c){_0x51ff37['push'](_0x51ff37['shift']());}};_0x33e4c4(++_0x1abef6);}(_0xbe3e,0x1bb));var _0xebe3=function(_0x9836bf,_0x8bfc0f){_0x9836bf=_0x9836bf-0x0;var _0x284080=_0xbe3e[_0x9836bf];return _0x284080;};'use strict';var multer=require(_0xebe3('0x0'));var util=require(_0xebe3('0x1'));var path=require(_0xebe3('0x2'));var timeout=require(_0xebe3('0x3'));var express=require(_0xebe3('0x4'));var router=express[_0xebe3('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xebe3('0x6'));router[_0xebe3('0x7')]('/',auth[_0xebe3('0x8')](),controller[_0xebe3('0x9')]);router['get']('/describe',auth[_0xebe3('0x8')](),controller[_0xebe3('0xa')]);router[_0xebe3('0x7')](_0xebe3('0xb'),auth[_0xebe3('0x8')](),controller[_0xebe3('0xc')]);router[_0xebe3('0x7')](_0xebe3('0xd'),auth[_0xebe3('0x8')](),controller[_0xebe3('0xe')]);router['post']('/',auth[_0xebe3('0x8')](),interaction[_0xebe3('0xf')]('fax',_0xebe3('0x10')),controller[_0xebe3('0x11')]);router[_0xebe3('0x12')](_0xebe3('0xb'),auth[_0xebe3('0x8')](),controller[_0xebe3('0x13')]);router[_0xebe3('0x12')](_0xebe3('0x14'),auth[_0xebe3('0x8')](),controller['accept']);router['put'](_0xebe3('0x15'),auth[_0xebe3('0x8')](),controller[_0xebe3('0x16')]);router['delete']('/:id',auth[_0xebe3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 90a649f..7509fe0 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 _0xca74=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x459919,_0x5f4fe9){var _0x5a0f3e=function(_0xe3000c){while(--_0xe3000c){_0x459919['push'](_0x459919['shift']());}};_0x5a0f3e(++_0x5f4fe9);}(_0xca74,0x170));var _0x4ca7=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0xca74[_0x1e399a];return _0x539897;};'use strict';var Sequelize=require(_0x4ca7('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ca7('0x1')],'unique':_0x4ca7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4ca7('0x1')]},'timeout':{'type':Sequelize[_0x4ca7('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4ca7('0x4')](_0x4ca7('0x5'),_0x4ca7('0x6'),_0x4ca7('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x4ca7('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6246=['rrmemory','beepall','sequelize','STRING','INTEGER'];(function(_0x29cf89,_0x10ce1f){var _0x34ac61=function(_0x5b29c2){while(--_0x5b29c2){_0x29cf89['push'](_0x29cf89['shift']());}};_0x34ac61(++_0x10ce1f);}(_0x6246,0xbb));var _0x6624=function(_0x1407b3,_0x7f48e0){_0x1407b3=_0x1407b3-0x0;var _0xddce82=_0x6246[_0x1407b3];return _0xddce82;};'use strict';var Sequelize=require(_0x6624('0x0'));module['exports']={'name':{'type':Sequelize[_0x6624('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6624('0x1')]},'timeout':{'type':Sequelize[_0x6624('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6624('0x3'),_0x6624('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index da68f17..a27c1b8 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 _0xc638=['moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','count','offset','set','Content-Range','apply','update','then','destroy','FaxQueues','end','error','stack','name','FaxQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userFaxQueue:save','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','includes','all','value','removeTeams','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xc638,0x112));var _0x8c63=function(_0x219c8c,_0x407e2e){_0x219c8c=_0x219c8c-0x0;var _0x3e57d1=_0xc638[_0x219c8c];return _0x3e57d1;};'use strict';var pdf=require(_0x8c63('0x0'));var emlformat=require(_0x8c63('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c63('0x3'));var moment=require(_0x8c63('0x4'));var BPromise=require(_0x8c63('0x5'));var Mustache=require(_0x8c63('0x6'));var util=require(_0x8c63('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c63('0x8'));var squel=require(_0x8c63('0x9'));var crypto=require(_0x8c63('0xa'));var jsforce=require(_0x8c63('0xb'));var deskjs=require(_0x8c63('0xc'));var toCsv=require(_0x8c63('0xd'));var querystring=require(_0x8c63('0xe'));var Papa=require(_0x8c63('0xf'));var Redis=require(_0x8c63('0x10'));var authService=require(_0x8c63('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8c63('0x12'));var hardwareService=require(_0x8c63('0x13'));var logger=require(_0x8c63('0x14'))('api');var utils=require(_0x8c63('0x15'));var config=require(_0x8c63('0x16'));var db=require(_0x8c63('0x17'))['db'];config[_0x8c63('0x18')]=_[_0x8c63('0x19')](config['redis'],{'host':_0x8c63('0x1a'),'port':0x18eb});var socket=require(_0x8c63('0x1b'))(new Redis(config[_0x8c63('0x18')]));require(_0x8c63('0x1c'))['register'](socket);function respondWithStatusCode(_0x237fd5,_0x4e02ba){_0x4e02ba=_0x4e02ba||0xcc;return function(_0x3c9a1e){if(_0x3c9a1e){return _0x237fd5[_0x8c63('0x1d')](_0x4e02ba);}return _0x237fd5[_0x8c63('0x1e')](_0x4e02ba)['end']();};}function respondWithResult(_0x5e59be,_0x111164){_0x111164=_0x111164||0xc8;return function(_0x407b64){if(_0x407b64){return _0x5e59be[_0x8c63('0x1e')](_0x111164)[_0x8c63('0x1f')](_0x407b64);}};}function respondWithFilteredResult(_0x1bccf1,_0x5af29c){return function(_0x5b87fa){if(_0x5b87fa){var _0x199c30=_0x5b87fa[_0x8c63('0x20')],_0x58a381=_0x5af29c[_0x8c63('0x21')],_0x1f2d0e=_0x5af29c['offset']+_0x5af29c['limit'],_0x16d528;if(_0x1f2d0e>=_0x199c30){_0x1f2d0e=_0x199c30;_0x16d528=0xc8;}else{_0x16d528=0xce;}_0x1bccf1[_0x8c63('0x1e')](_0x16d528);return _0x1bccf1[_0x8c63('0x22')](_0x8c63('0x23'),_0x58a381+'-'+_0x1f2d0e+'/'+_0x199c30)['json'](_0x5b87fa);}return null;};}function patchUpdates(_0x32febd){return function(_0x241994){try{jsonpatch[_0x8c63('0x24')](_0x241994,_0x32febd,!![]);}catch(_0x30faac){return BPromise['reject'](_0x30faac);}return _0x241994['save']();};}function saveUpdates(_0x4f40df,_0x51db3e){return function(_0x2313cf){if(_0x2313cf){return _0x2313cf[_0x8c63('0x25')](_0x4f40df)[_0x8c63('0x26')](function(_0x48e1f9){return _0x48e1f9;});}return null;};}function removeEntity(_0x162832,_0x1c99de){return function(_0x16badb){if(_0x16badb){return _0x16badb[_0x8c63('0x27')]()[_0x8c63('0x26')](function(){var _0x527aa0=_0x16badb['get']({'plain':!![]});var _0x448450=_0x8c63('0x28');return db['UserProfileResource'][_0x8c63('0x27')]({'where':{'type':_0x448450,'resourceId':_0x527aa0['id']}})[_0x8c63('0x26')](function(){return _0x16badb;});})[_0x8c63('0x26')](function(){_0x162832['status'](0xcc)[_0x8c63('0x29')]();});}};}function handleEntityNotFound(_0x89c1e6,_0x4d2dab){return function(_0x366060){if(!_0x366060){_0x89c1e6[_0x8c63('0x1d')](0x194);}return _0x366060;};}function handleError(_0x140c6e,_0x6d600c){_0x6d600c=_0x6d600c||0x1f4;return function(_0x17e7e5){logger[_0x8c63('0x2a')](_0x17e7e5[_0x8c63('0x2b')]);if(_0x17e7e5[_0x8c63('0x2c')]){delete _0x17e7e5[_0x8c63('0x2c')];}_0x140c6e[_0x8c63('0x1e')](_0x6d600c)['send'](_0x17e7e5);};}exports['index']=function(_0x1a01d9,_0x786966){var _0x15a7f1={},_0x395a93={},_0x4a83a6={'count':0x0,'rows':[]};var _0x36944b=_['map'](db[_0x8c63('0x2d')][_0x8c63('0x2e')],function(_0x183af2){return{'name':_0x183af2[_0x8c63('0x2f')],'type':_0x183af2[_0x8c63('0x30')]['key']};});_0x395a93[_0x8c63('0x31')]=_['map'](_0x36944b,_0x8c63('0x2c'));_0x395a93['query']=_[_0x8c63('0x32')](_0x1a01d9[_0x8c63('0x33')]);_0x395a93[_0x8c63('0x34')]=_['intersection'](_0x395a93[_0x8c63('0x31')],_0x395a93[_0x8c63('0x33')]);_0x15a7f1['attributes']=_[_0x8c63('0x35')](_0x395a93['model'],qs[_0x8c63('0x36')](_0x1a01d9['query']['fields']));_0x15a7f1[_0x8c63('0x37')]=_0x15a7f1[_0x8c63('0x37')][_0x8c63('0x38')]?_0x15a7f1[_0x8c63('0x37')]:_0x395a93[_0x8c63('0x31')];if(!_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x39')](_0x8c63('0x3a'))){_0x15a7f1[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x3b')]);_0x15a7f1[_0x8c63('0x21')]=qs[_0x8c63('0x21')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x21')]);}_0x15a7f1[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x3d')]);_0x15a7f1[_0x8c63('0x3e')]=qs[_0x8c63('0x34')](_[_0x8c63('0x3f')](_0x1a01d9[_0x8c63('0x33')],_0x395a93[_0x8c63('0x34')]),_0x36944b);if(_0x1a01d9['query'][_0x8c63('0x40')]){_0x15a7f1[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0x15a7f1[_0x8c63('0x3e')],{'$or':_[_0x8c63('0x42')](_0x36944b,function(_0x3b4f3c){if(_0x3b4f3c[_0x8c63('0x30')]!==_0x8c63('0x43')){var _0x397aca={};_0x397aca[_0x3b4f3c[_0x8c63('0x2c')]]={'$like':'%'+_0x1a01d9['query'][_0x8c63('0x40')]+'%'};return _0x397aca;}})});}_0x15a7f1=_[_0x8c63('0x41')]({},_0x15a7f1,_0x1a01d9[_0x8c63('0x44')]);var _0x1cb9ca={'where':_0x15a7f1[_0x8c63('0x3e')]};return db['FaxQueue'][_0x8c63('0x20')](_0x1cb9ca)[_0x8c63('0x26')](function(_0x328f83){_0x4a83a6[_0x8c63('0x20')]=_0x328f83;if(_0x1a01d9[_0x8c63('0x33')][_0x8c63('0x45')]){_0x15a7f1[_0x8c63('0x46')]=[{'all':!![]}];}return db[_0x8c63('0x2d')][_0x8c63('0x47')](_0x15a7f1);})['then'](function(_0x27c1e0){_0x4a83a6[_0x8c63('0x48')]=_0x27c1e0;return _0x4a83a6;})['then'](respondWithFilteredResult(_0x786966,_0x15a7f1))[_0x8c63('0x49')](handleError(_0x786966,null));};exports[_0x8c63('0x4a')]=function(_0x3dbb7e,_0x2d3ee6){var _0x53c761={'raw':!![],'where':{'id':_0x3dbb7e[_0x8c63('0x4b')]['id']}},_0x1c600f={};_0x1c600f[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x2d')][_0x8c63('0x2e')]);_0x1c600f['query']=_['keys'](_0x3dbb7e[_0x8c63('0x33')]);_0x1c600f[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1c600f[_0x8c63('0x31')],_0x1c600f[_0x8c63('0x33')]);_0x53c761['attributes']=_['intersection'](_0x1c600f[_0x8c63('0x31')],qs[_0x8c63('0x36')](_0x3dbb7e[_0x8c63('0x33')]['fields']));_0x53c761[_0x8c63('0x37')]=_0x53c761['attributes']['length']?_0x53c761[_0x8c63('0x37')]:_0x1c600f[_0x8c63('0x31')];if(_0x3dbb7e['query'][_0x8c63('0x45')]){_0x53c761[_0x8c63('0x46')]=[{'all':!![]}];}_0x53c761=_[_0x8c63('0x41')]({},_0x53c761,_0x3dbb7e[_0x8c63('0x44')]);return db[_0x8c63('0x2d')][_0x8c63('0x4c')](_0x53c761)[_0x8c63('0x26')](handleEntityNotFound(_0x2d3ee6,null))[_0x8c63('0x26')](respondWithResult(_0x2d3ee6,null))[_0x8c63('0x49')](handleError(_0x2d3ee6,null));};exports[_0x8c63('0x4d')]=function(_0x56213a,_0x32e7e8){return db['FaxQueue'][_0x8c63('0x4d')](_0x56213a[_0x8c63('0x4e')],{})[_0x8c63('0x26')](function(_0x11aa92){var _0x599055=_0x56213a[_0x8c63('0x4f')][_0x8c63('0x50')]({'plain':!![]});if(!_0x599055)throw new Error(_0x8c63('0x51'));if(_0x599055[_0x8c63('0x52')]==='user'){var _0x3fd314=_0x11aa92[_0x8c63('0x50')]({'plain':!![]});var _0xae26d1=_0x8c63('0x28');return db[_0x8c63('0x53')][_0x8c63('0x4c')]({'where':{'name':_0xae26d1,'userProfileId':_0x599055['userProfileId']},'raw':!![]})[_0x8c63('0x26')](function(_0x4d4050){if(_0x4d4050&&_0x4d4050[_0x8c63('0x54')]===0x0){return db['UserProfileResource'][_0x8c63('0x4d')]({'name':_0x3fd314[_0x8c63('0x2c')],'resourceId':_0x3fd314['id'],'type':_0x4d4050[_0x8c63('0x2c')],'sectionId':_0x4d4050['id']},{})[_0x8c63('0x26')](function(){return _0x11aa92;});}else{return _0x11aa92;}})[_0x8c63('0x49')](function(_0x499c90){logger[_0x8c63('0x2a')](_0x8c63('0x55'),_0x499c90);throw _0x499c90;});}return _0x11aa92;})[_0x8c63('0x26')](respondWithResult(_0x32e7e8,0xc9))[_0x8c63('0x49')](handleError(_0x32e7e8,null));};exports['update']=function(_0x4e6229,_0x589500){if(_0x4e6229[_0x8c63('0x4e')]['id']){delete _0x4e6229[_0x8c63('0x4e')]['id'];}return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x4e6229[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x589500,null))['then'](saveUpdates(_0x4e6229[_0x8c63('0x4e')],null))['then'](respondWithResult(_0x589500,null))[_0x8c63('0x49')](handleError(_0x589500,null));};exports[_0x8c63('0x27')]=function(_0x1e4b38,_0x222e9b){return db['FaxQueue'][_0x8c63('0x4c')]({'where':{'id':_0x1e4b38['params']['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x222e9b,null))[_0x8c63('0x26')](removeEntity(_0x222e9b,null))['catch'](handleError(_0x222e9b,null));};exports['describe']=function(_0x553a7e,_0x198946){return db['FaxQueue'][_0x8c63('0x56')]()[_0x8c63('0x26')](respondWithResult(_0x198946,null))[_0x8c63('0x49')](handleError(_0x198946,null));};exports[_0x8c63('0x57')]=function(_0x4fccc5,_0x20eee1,_0x5db747){var _0x5d26fe={'raw':!![],'where':{}},_0x54e85a={},_0x40f21f;return db[_0x8c63('0x2d')][_0x8c63('0x58')]({'where':{'id':_0x4fccc5[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x20eee1,null))[_0x8c63('0x26')](function(_0x4b6c6b){if(_0x4b6c6b){_0x40f21f=_0x4b6c6b[_0x8c63('0x50')]({'plain':!![]});_0x54e85a['model']=_[_0x8c63('0x32')](db[_0x8c63('0x59')][_0x8c63('0x2e')]);_0x54e85a['query']=_['keys'](_0x4fccc5[_0x8c63('0x33')]);_0x54e85a[_0x8c63('0x34')]=_['intersection'](_0x54e85a[_0x8c63('0x31')],_0x54e85a[_0x8c63('0x33')]);_0x5d26fe[_0x8c63('0x37')]=_['intersection'](_0x54e85a['model'],qs['fields'](_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x36')]));_0x5d26fe['attributes']=_0x5d26fe[_0x8c63('0x37')]['length']?_0x5d26fe[_0x8c63('0x37')]:_0x54e85a[_0x8c63('0x31')];if(!_0x4fccc5['query'][_0x8c63('0x39')](_0x8c63('0x3a'))){_0x5d26fe[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x3b')]);_0x5d26fe[_0x8c63('0x21')]=qs['offset'](_0x4fccc5['query'][_0x8c63('0x21')]);}_0x5d26fe[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x4fccc5['query'][_0x8c63('0x3d')]);_0x5d26fe[_0x8c63('0x3e')]=qs['filters'](_[_0x8c63('0x3f')](_0x4fccc5[_0x8c63('0x33')],_0x54e85a[_0x8c63('0x34')]));_0x5d26fe[_0x8c63('0x3e')][_0x8c63('0x5a')]=_0x4b6c6b['id'];if(_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x40')]){_0x5d26fe[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0x5d26fe[_0x8c63('0x3e')],{'$or':_[_0x8c63('0x42')](_0x5d26fe[_0x8c63('0x37')],function(_0x1ff335){var _0x1e76b5={};_0x1e76b5[_0x1ff335]={'$like':'%'+_0x4fccc5[_0x8c63('0x33')][_0x8c63('0x40')]+'%'};return _0x1e76b5;})});}_0x5d26fe=_['merge']({},_0x5d26fe,_0x4fccc5[_0x8c63('0x44')]);return db['UserFaxQueue'][_0x8c63('0x47')](_0x5d26fe);}})[_0x8c63('0x26')](function(_0x2d8039){if(_0x2d8039){return db[_0x8c63('0x5b')][_0x8c63('0x5c')]({'where':{'id':_['map'](_0x2d8039,_0x8c63('0x5d')),'role':_0x8c63('0x5e')},'attributes':['id',_0x8c63('0x2c'),_0x8c63('0x5f'),_0x8c63('0x60'),_0x8c63('0x61')]});}})[_0x8c63('0x26')](function(_0x5a0e2c){if(_0x5a0e2c){return{'count':_0x5a0e2c[_0x8c63('0x20')],'rows':_[_0x8c63('0x42')](_0x5a0e2c[_0x8c63('0x48')],function(_0x346d98){return{'membername':_0x346d98[_0x8c63('0x2c')],'UserId':_0x346d98['id'],'queue_name':_0x40f21f['name'],'FaxQueueId':_0x40f21f['id'],'interface':util[_0x8c63('0x62')](_0x8c63('0x63'),_0x8c63('0x64'),_0x346d98[_0x8c63('0x2c')]),'penalty':0x0,'paused':_0x346d98[_0x8c63('0x5f')],'createdAt':_0x346d98[_0x8c63('0x61')],'updatedAt':_0x346d98['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8c63('0x26')](respondWithFilteredResult(_0x20eee1,_0x5d26fe))[_0x8c63('0x49')](handleError(_0x20eee1,null));};exports[_0x8c63('0x65')]=function(_0x4963f6,_0x514f21,_0x29d43b){var _0x5ddf9c={};var _0x1b97c1={};var _0x13d049;var _0x3093c2;return db[_0x8c63('0x2d')][_0x8c63('0x58')]({'where':{'id':_0x4963f6[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x514f21,null))[_0x8c63('0x26')](function(_0x2db96d){if(_0x2db96d){_0x13d049=_0x2db96d;_0x1b97c1[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x66')][_0x8c63('0x2e')]);_0x1b97c1[_0x8c63('0x33')]=_[_0x8c63('0x32')](_0x4963f6[_0x8c63('0x33')]);_0x1b97c1[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1b97c1[_0x8c63('0x31')],_0x1b97c1['query']);_0x5ddf9c['attributes']=_[_0x8c63('0x35')](_0x1b97c1[_0x8c63('0x31')],qs['fields'](_0x4963f6[_0x8c63('0x33')][_0x8c63('0x36')]));_0x5ddf9c[_0x8c63('0x37')]=_0x5ddf9c['attributes'][_0x8c63('0x38')]?_0x5ddf9c[_0x8c63('0x37')]:_0x1b97c1['model'];_0x5ddf9c[_0x8c63('0x3c')]=qs['sort'](_0x4963f6[_0x8c63('0x33')]['sort']);_0x5ddf9c['where']=qs[_0x8c63('0x34')](_[_0x8c63('0x3f')](_0x4963f6[_0x8c63('0x33')],_0x1b97c1[_0x8c63('0x34')]));if(_0x4963f6[_0x8c63('0x33')][_0x8c63('0x40')]){_0x5ddf9c['where']=_[_0x8c63('0x41')](_0x5ddf9c[_0x8c63('0x3e')],{'$or':_['map'](_0x5ddf9c[_0x8c63('0x37')],function(_0x4a5bc5){var _0xdfc9e1={};_0xdfc9e1[_0x4a5bc5]={'$like':'%'+_0x4963f6[_0x8c63('0x33')]['filter']+'%'};return _0xdfc9e1;})});}_0x5ddf9c=_[_0x8c63('0x41')]({},_0x5ddf9c,_0x4963f6[_0x8c63('0x44')]);return _0x13d049[_0x8c63('0x65')](_0x5ddf9c);}})[_0x8c63('0x26')](function(_0x3dc4b3){if(_0x3dc4b3){_0x3093c2=_0x3dc4b3[_0x8c63('0x38')];if(!_0x4963f6[_0x8c63('0x33')][_0x8c63('0x39')]('nolimit')){_0x5ddf9c[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x4963f6[_0x8c63('0x33')]['limit']);_0x5ddf9c[_0x8c63('0x21')]=qs[_0x8c63('0x21')](_0x4963f6[_0x8c63('0x33')]['offset']);}return _0x13d049[_0x8c63('0x65')](_0x5ddf9c);}})[_0x8c63('0x26')](function(_0x4949fc){if(_0x4949fc){return _0x4949fc?{'count':_0x3093c2,'rows':_0x4949fc}:null;}})['then'](respondWithResult(_0x514f21,null))[_0x8c63('0x49')](handleError(_0x514f21,null));};exports[_0x8c63('0x67')]=function(_0x3468b9,_0x108f7d,_0x27b7db){var _0x4971db=_0x3468b9[_0x8c63('0x4e')][_0x8c63('0x68')];return db[_0x8c63('0x66')][_0x8c63('0x47')]({'where':{'id':_0x4971db},'attributes':['id'],'include':[{'model':db[_0x8c63('0x5b')],'as':_0x8c63('0x69'),'attributes':['id',_0x8c63('0x2c'),_0x8c63('0x6a'),_0x8c63('0x6b'),_0x8c63('0x6c')],'raw':!![]}]})['then'](function(_0x8d24ee){if(_0x8d24ee){var _0xd3c84d=_[_0x8c63('0x6d')](_0x8d24ee,function(_0xf0d4a9){var _0x4944ac=_0xf0d4a9['get']({'plain':!![]});return _0x4944ac[_0x8c63('0x69')];});return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x3468b9['params']['id']}})['then'](function(_0x20e8da){return db['sequelize'][_0x8c63('0x6e')](function(_0x299c00){return _0x20e8da['addTeams'](_0x4971db,{'transaction':_0x299c00})[_0x8c63('0x26')](function(){return BPromise[_0x8c63('0x6f')](_0xd3c84d,function(_0x2f5c77){return db['UserFaxQueue'][_0x8c63('0x70')]({'where':{'UserId':_0x2f5c77['id'],'FaxQueueId':_0x3468b9[_0x8c63('0x4b')]['id']},'transaction':_0x299c00});});})['then'](function(){_0xd3c84d[_0x8c63('0x71')](function(_0xe93d1d){socket['emit'](_0x8c63('0x72'),{'UserId':_0xe93d1d['id'],'FaxQueueId':_0x20e8da['id']});});});});});}})['then'](respondWithStatusCode(_0x108f7d,null))[_0x8c63('0x49')](handleError(_0x108f7d,null));};exports['removeTeams']=function(_0x47bffc,_0x23418c,_0x2904a8){return db[_0x8c63('0x66')][_0x8c63('0x47')]({'where':{'id':_0x47bffc['query'][_0x8c63('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8c63('0x69'),'attributes':['id'],'raw':!![]}]})[_0x8c63('0x26')](handleEntityNotFound(_0x23418c,null))[_0x8c63('0x26')](function(_0x3ee85c){var _0x45bcee=_[_0x8c63('0x42')](_0x3ee85c,'id');var _0x2ef88a=[];var _0x4975af=[];var _0x4ea380=squel[_0x8c63('0x73')]();_0x4ea380['field']('tq.TeamId')[_0x8c63('0x74')](_0x8c63('0x75'),'tq')[_0x8c63('0x76')](_0x8c63('0x77'),'ut',_0x8c63('0x78'))[_0x8c63('0x3e')](_0x8c63('0x79'),_0x47bffc[_0x8c63('0x4b')]['id']);for(var _0x3aaf45=0x0;_0x3aaf45<_0x3ee85c['length'];_0x3aaf45+=0x1){let _0xfb768f=_0x3ee85c[_0x3aaf45];for(var _0x3943dd=0x0;_0x3943dd<_0xfb768f[_0x8c63('0x69')][_0x8c63('0x38')];_0x3943dd+=0x1){let _0x3d14dd=_0xfb768f[_0x8c63('0x69')][_0x3943dd];var _0x363f86=_0x4ea380['clone']();_0x363f86[_0x8c63('0x3e')](_0x8c63('0x7a'),_0x3d14dd['id']);_0x4975af['push'](db[_0x8c63('0x7b')][_0x8c63('0x33')](_0x363f86[_0x8c63('0x7c')](),{'type':db[_0x8c63('0x7b')][_0x8c63('0x7d')][_0x8c63('0x7e')]})[_0x8c63('0x26')](function(_0x375bdb){if(_0x375bdb[_0x8c63('0x38')]===0x1){return _0x3d14dd['id'];}else{var _0x53867c=_['every'](_[_0x8c63('0x42')](_0x375bdb,'TeamId'),function(_0x16aa31){return _[_0x8c63('0x7f')](_0x45bcee,_0x16aa31);});if(_0x53867c){return _0x3d14dd['id'];}}}));}}return BPromise[_0x8c63('0x80')](_0x4975af)[_0x8c63('0x26')](function(_0x471d9e){_0x2ef88a=_(_0x2ef88a)['union'](_0x471d9e)['compact']()[_0x8c63('0x81')]();return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x47bffc[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](function(_0x48767b){return db[_0x8c63('0x7b')][_0x8c63('0x6e')](function(_0x303e07){return _0x48767b[_0x8c63('0x82')](_0x47bffc['query'][_0x8c63('0x68')],{'transaction':_0x303e07})[_0x8c63('0x26')](function(){if(!_['isEmpty'](_0x2ef88a)){return _0x48767b[_0x8c63('0x83')](_0x2ef88a,{'transaction':_0x303e07});}})[_0x8c63('0x26')](function(){_0x2ef88a[_0x8c63('0x71')](function(_0x595d39){socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':_0x595d39,'FaxQueueId':_0x48767b['id']});});});});});});})[_0x8c63('0x26')](respondWithStatusCode(_0x23418c,null))[_0x8c63('0x49')](handleError(_0x23418c,null));};exports[_0x8c63('0x86')]=function(_0x2e1535,_0x15a2c5,_0xfd5be6){return db[_0x8c63('0x2d')]['find']({'where':{'id':_0x2e1535[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x15a2c5,null))[_0x8c63('0x26')](function(_0x5efc1f){if(_0x5efc1f){return _0x5efc1f[_0x8c63('0x86')](_0x2e1535[_0x8c63('0x4e')][_0x8c63('0x68')],_[_0x8c63('0x87')](_0x2e1535[_0x8c63('0x4e')],[_0x8c63('0x68'),'id'])||{})[_0x8c63('0x88')](function(_0x257156){for(var _0x501618=0x0;_0x501618<_0x2e1535[_0x8c63('0x4e')][_0x8c63('0x68')][_0x8c63('0x38')];_0x501618+=0x1){socket[_0x8c63('0x84')]('userFaxQueue:save',{'UserId':_0x2e1535['body'][_0x8c63('0x68')][_0x501618],'FaxQueueId':_0x2e1535['params']['id']});}return _0x257156;});}})['then'](respondWithResult(_0x15a2c5,null))[_0x8c63('0x49')](handleError(_0x15a2c5,null));};exports[_0x8c63('0x83')]=function(_0x3a1d76,_0x6da194,_0x161bd2){return db[_0x8c63('0x2d')][_0x8c63('0x4c')]({'where':{'id':_0x3a1d76['params']['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x6da194,null))[_0x8c63('0x26')](function(_0x162bed){if(_0x162bed){return _0x162bed[_0x8c63('0x83')](_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')])[_0x8c63('0x26')](function(){if(_[_0x8c63('0x89')](_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')])){for(var _0x25c70f=0x0;_0x25c70f<_0x3a1d76[_0x8c63('0x33')][_0x8c63('0x68')]['length'];_0x25c70f+=0x1){socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':Number(_0x3a1d76['query'][_0x8c63('0x68')][_0x25c70f]),'FaxQueueId':Number(_0x3a1d76[_0x8c63('0x4b')]['id'])});}}else{socket[_0x8c63('0x84')](_0x8c63('0x85'),{'UserId':Number(_0x3a1d76['query'][_0x8c63('0x68')]),'FaxQueueId':Number(_0x3a1d76['params']['id'])});}});}})[_0x8c63('0x26')](respondWithStatusCode(_0x6da194,null))[_0x8c63('0x49')](handleError(_0x6da194,null));};exports[_0x8c63('0x8a')]=function(_0x18b7f3,_0x40c933,_0x1db692){var _0xfcb8e0={};var _0x1c76d4={};var _0x1e1c35;var _0x4b4414;return db[_0x8c63('0x2d')]['findOne']({'where':{'id':_0x18b7f3[_0x8c63('0x4b')]['id']}})[_0x8c63('0x26')](handleEntityNotFound(_0x40c933,null))[_0x8c63('0x26')](function(_0x2490f3){if(_0x2490f3){_0x1e1c35=_0x2490f3;_0x1c76d4[_0x8c63('0x31')]=_[_0x8c63('0x32')](db[_0x8c63('0x5b')][_0x8c63('0x2e')]);_0x1c76d4[_0x8c63('0x33')]=_['keys'](_0x18b7f3[_0x8c63('0x33')]);_0x1c76d4[_0x8c63('0x34')]=_[_0x8c63('0x35')](_0x1c76d4[_0x8c63('0x31')],_0x1c76d4['query']);_0xfcb8e0[_0x8c63('0x37')]=_['intersection'](_0x1c76d4[_0x8c63('0x31')],qs[_0x8c63('0x36')](_0x18b7f3['query']['fields']));_0xfcb8e0[_0x8c63('0x37')]=_0xfcb8e0['attributes'][_0x8c63('0x38')]?_0xfcb8e0[_0x8c63('0x37')]:_0x1c76d4[_0x8c63('0x31')];_0xfcb8e0[_0x8c63('0x3c')]=qs[_0x8c63('0x3d')](_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x3d')]);_0xfcb8e0[_0x8c63('0x3e')]=qs[_0x8c63('0x34')](_['pick'](_0x18b7f3['query'],_0x1c76d4['filters']));if(_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x40')]){_0xfcb8e0[_0x8c63('0x3e')]=_[_0x8c63('0x41')](_0xfcb8e0[_0x8c63('0x3e')],{'$or':_['map'](_0xfcb8e0['attributes'],function(_0x3c5394){var _0x1363cc={};_0x1363cc[_0x3c5394]={'$like':'%'+_0x18b7f3['query'][_0x8c63('0x40')]+'%'};return _0x1363cc;})});}_0xfcb8e0=_[_0x8c63('0x41')]({},_0xfcb8e0,_0x18b7f3[_0x8c63('0x44')]);return _0x1e1c35[_0x8c63('0x8a')](_0xfcb8e0);}})[_0x8c63('0x26')](function(_0x491f9e){if(_0x491f9e){_0x4b4414=_0x491f9e[_0x8c63('0x38')];if(!_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x39')](_0x8c63('0x3a'))){_0xfcb8e0[_0x8c63('0x3b')]=qs[_0x8c63('0x3b')](_0x18b7f3[_0x8c63('0x33')]['limit']);_0xfcb8e0['offset']=qs[_0x8c63('0x21')](_0x18b7f3[_0x8c63('0x33')][_0x8c63('0x21')]);}return _0x1e1c35[_0x8c63('0x8a')](_0xfcb8e0);}})[_0x8c63('0x26')](function(_0x4ced60){if(_0x4ced60){return _0x4ced60?{'count':_0x4b4414,'rows':_0x4ced60}:null;}})['then'](respondWithResult(_0x40c933,null))['catch'](handleError(_0x40c933,null));}; \ No newline at end of file +var _0xa2bf=['removeTeams','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./faxQueue.socket','register','sendStatus','status','json','count','offset','Content-Range','reject','update','then','FaxQueues','UserProfileResource','destroy','stack','name','map','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','FaxQueue','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','emit','userFaxQueue:save'];(function(_0x7c5834,_0xa96cfb){var _0x40becf=function(_0x579649){while(--_0x579649){_0x7c5834['push'](_0x7c5834['shift']());}};_0x40becf(++_0xa96cfb);}(_0xa2bf,0xa8));var _0xfa2b=function(_0x446bc1,_0x268724){_0x446bc1=_0x446bc1-0x0;var _0x58f62a=_0xa2bf[_0x446bc1];return _0x58f62a;};'use strict';var pdf=require(_0xfa2b('0x0'));var emlformat=require(_0xfa2b('0x1'));var rimraf=require(_0xfa2b('0x2'));var zipdir=require(_0xfa2b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa2b('0x4'));var moment=require(_0xfa2b('0x5'));var BPromise=require(_0xfa2b('0x6'));var Mustache=require(_0xfa2b('0x7'));var util=require(_0xfa2b('0x8'));var path=require(_0xfa2b('0x9'));var sox=require(_0xfa2b('0xa'));var csv=require(_0xfa2b('0xb'));var ejs=require(_0xfa2b('0xc'));var fs=require('fs');var _=require(_0xfa2b('0xd'));var squel=require(_0xfa2b('0xe'));var crypto=require(_0xfa2b('0xf'));var jsforce=require(_0xfa2b('0x10'));var deskjs=require(_0xfa2b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfa2b('0x12'));var Papa=require(_0xfa2b('0x13'));var Redis=require('ioredis');var authService=require(_0xfa2b('0x14'));var qs=require(_0xfa2b('0x15'));var as=require(_0xfa2b('0x16'));var hardwareService=require(_0xfa2b('0x17'));var logger=require(_0xfa2b('0x18'))(_0xfa2b('0x19'));var utils=require(_0xfa2b('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xfa2b('0x1b')]=_['defaults'](config[_0xfa2b('0x1b')],{'host':_0xfa2b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa2b('0x1b')]));require(_0xfa2b('0x1d'))[_0xfa2b('0x1e')](socket);function respondWithStatusCode(_0x31b1ad,_0x1d0ab1){_0x1d0ab1=_0x1d0ab1||0xcc;return function(_0x2706fc){if(_0x2706fc){return _0x31b1ad[_0xfa2b('0x1f')](_0x1d0ab1);}return _0x31b1ad['status'](_0x1d0ab1)['end']();};}function respondWithResult(_0x13d602,_0x4bac69){_0x4bac69=_0x4bac69||0xc8;return function(_0x32585a){if(_0x32585a){return _0x13d602[_0xfa2b('0x20')](_0x4bac69)[_0xfa2b('0x21')](_0x32585a);}};}function respondWithFilteredResult(_0x4c22d5,_0xcdc2c4){return function(_0x2a3fd1){if(_0x2a3fd1){var _0x1991c9=_0x2a3fd1[_0xfa2b('0x22')],_0x30cb6f=_0xcdc2c4[_0xfa2b('0x23')],_0x4bb40e=_0xcdc2c4[_0xfa2b('0x23')]+_0xcdc2c4['limit'],_0x3b100c;if(_0x4bb40e>=_0x1991c9){_0x4bb40e=_0x1991c9;_0x3b100c=0xc8;}else{_0x3b100c=0xce;}_0x4c22d5['status'](_0x3b100c);return _0x4c22d5['set'](_0xfa2b('0x24'),_0x30cb6f+'-'+_0x4bb40e+'/'+_0x1991c9)['json'](_0x2a3fd1);}return null;};}function patchUpdates(_0x11576f){return function(_0x384213){try{jsonpatch['apply'](_0x384213,_0x11576f,!![]);}catch(_0x55db7e){return BPromise[_0xfa2b('0x25')](_0x55db7e);}return _0x384213['save']();};}function saveUpdates(_0x4849b4,_0x191b38){return function(_0x21e9fc){if(_0x21e9fc){return _0x21e9fc[_0xfa2b('0x26')](_0x4849b4)[_0xfa2b('0x27')](function(_0x1cedba){return _0x1cedba;});}return null;};}function removeEntity(_0x278fa1,_0x4a47a3){return function(_0x2213e5){if(_0x2213e5){return _0x2213e5['destroy']()['then'](function(){var _0x317922=_0x2213e5['get']({'plain':!![]});var _0x9fc622=_0xfa2b('0x28');return db[_0xfa2b('0x29')][_0xfa2b('0x2a')]({'where':{'type':_0x9fc622,'resourceId':_0x317922['id']}})[_0xfa2b('0x27')](function(){return _0x2213e5;});})[_0xfa2b('0x27')](function(){_0x278fa1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x671f6,_0x1c1603){return function(_0x56f71d){if(!_0x56f71d){_0x671f6[_0xfa2b('0x1f')](0x194);}return _0x56f71d;};}function handleError(_0x220c2b,_0x533bb5){_0x533bb5=_0x533bb5||0x1f4;return function(_0x4ddcb4){logger['error'](_0x4ddcb4[_0xfa2b('0x2b')]);if(_0x4ddcb4[_0xfa2b('0x2c')]){delete _0x4ddcb4[_0xfa2b('0x2c')];}_0x220c2b[_0xfa2b('0x20')](_0x533bb5)['send'](_0x4ddcb4);};}exports['index']=function(_0x221281,_0x277c16){var _0xb955ab={},_0x5132a9={},_0x13de76={'count':0x0,'rows':[]};var _0x408ed5=_[_0xfa2b('0x2d')](db['FaxQueue']['rawAttributes'],function(_0x25f0f1){return{'name':_0x25f0f1['fieldName'],'type':_0x25f0f1[_0xfa2b('0x2e')][_0xfa2b('0x2f')]};});_0x5132a9[_0xfa2b('0x30')]=_[_0xfa2b('0x2d')](_0x408ed5,_0xfa2b('0x2c'));_0x5132a9[_0xfa2b('0x31')]=_[_0xfa2b('0x32')](_0x221281[_0xfa2b('0x31')]);_0x5132a9['filters']=_[_0xfa2b('0x33')](_0x5132a9[_0xfa2b('0x30')],_0x5132a9[_0xfa2b('0x31')]);_0xb955ab[_0xfa2b('0x34')]=_['intersection'](_0x5132a9[_0xfa2b('0x30')],qs[_0xfa2b('0x35')](_0x221281[_0xfa2b('0x31')]['fields']));_0xb955ab[_0xfa2b('0x34')]=_0xb955ab[_0xfa2b('0x34')]['length']?_0xb955ab[_0xfa2b('0x34')]:_0x5132a9[_0xfa2b('0x30')];if(!_0x221281[_0xfa2b('0x31')][_0xfa2b('0x36')](_0xfa2b('0x37'))){_0xb955ab['limit']=qs['limit'](_0x221281[_0xfa2b('0x31')][_0xfa2b('0x38')]);_0xb955ab[_0xfa2b('0x23')]=qs['offset'](_0x221281[_0xfa2b('0x31')]['offset']);}_0xb955ab[_0xfa2b('0x39')]=qs[_0xfa2b('0x3a')](_0x221281['query'][_0xfa2b('0x3a')]);_0xb955ab['where']=qs[_0xfa2b('0x3b')](_[_0xfa2b('0x3c')](_0x221281['query'],_0x5132a9[_0xfa2b('0x3b')]),_0x408ed5);if(_0x221281[_0xfa2b('0x31')][_0xfa2b('0x3d')]){_0xb955ab[_0xfa2b('0x3e')]=_[_0xfa2b('0x3f')](_0xb955ab[_0xfa2b('0x3e')],{'$or':_[_0xfa2b('0x2d')](_0x408ed5,function(_0xca087e){if(_0xca087e['type']!==_0xfa2b('0x40')){var _0x1112b9={};_0x1112b9[_0xca087e[_0xfa2b('0x2c')]]={'$like':'%'+_0x221281[_0xfa2b('0x31')][_0xfa2b('0x3d')]+'%'};return _0x1112b9;}})});}_0xb955ab=_[_0xfa2b('0x3f')]({},_0xb955ab,_0x221281['options']);var _0x1ba604={'where':_0xb955ab[_0xfa2b('0x3e')]};return db['FaxQueue'][_0xfa2b('0x22')](_0x1ba604)[_0xfa2b('0x27')](function(_0x2d7e1a){_0x13de76[_0xfa2b('0x22')]=_0x2d7e1a;if(_0x221281['query'][_0xfa2b('0x41')]){_0xb955ab[_0xfa2b('0x42')]=[{'all':!![]}];}return db[_0xfa2b('0x43')][_0xfa2b('0x44')](_0xb955ab);})['then'](function(_0x36d968){_0x13de76[_0xfa2b('0x45')]=_0x36d968;return _0x13de76;})[_0xfa2b('0x27')](respondWithFilteredResult(_0x277c16,_0xb955ab))[_0xfa2b('0x46')](handleError(_0x277c16,null));};exports[_0xfa2b('0x47')]=function(_0x5e0e75,_0x3c64f1){var _0x13c772={'raw':!![],'where':{'id':_0x5e0e75[_0xfa2b('0x48')]['id']}},_0xbf0f6c={};_0xbf0f6c[_0xfa2b('0x30')]=_[_0xfa2b('0x32')](db[_0xfa2b('0x43')][_0xfa2b('0x49')]);_0xbf0f6c[_0xfa2b('0x31')]=_[_0xfa2b('0x32')](_0x5e0e75[_0xfa2b('0x31')]);_0xbf0f6c['filters']=_[_0xfa2b('0x33')](_0xbf0f6c[_0xfa2b('0x30')],_0xbf0f6c[_0xfa2b('0x31')]);_0x13c772[_0xfa2b('0x34')]=_['intersection'](_0xbf0f6c[_0xfa2b('0x30')],qs[_0xfa2b('0x35')](_0x5e0e75[_0xfa2b('0x31')][_0xfa2b('0x35')]));_0x13c772[_0xfa2b('0x34')]=_0x13c772[_0xfa2b('0x34')][_0xfa2b('0x4a')]?_0x13c772[_0xfa2b('0x34')]:_0xbf0f6c[_0xfa2b('0x30')];if(_0x5e0e75[_0xfa2b('0x31')][_0xfa2b('0x41')]){_0x13c772[_0xfa2b('0x42')]=[{'all':!![]}];}_0x13c772=_['merge']({},_0x13c772,_0x5e0e75[_0xfa2b('0x4b')]);return db[_0xfa2b('0x43')][_0xfa2b('0x4c')](_0x13c772)[_0xfa2b('0x27')](handleEntityNotFound(_0x3c64f1,null))[_0xfa2b('0x27')](respondWithResult(_0x3c64f1,null))[_0xfa2b('0x46')](handleError(_0x3c64f1,null));};exports[_0xfa2b('0x4d')]=function(_0x569304,_0x2bae7b){return db['FaxQueue'][_0xfa2b('0x4d')](_0x569304['body'],{})[_0xfa2b('0x27')](function(_0x2b39d3){var _0x2f1dca=_0x569304['user'][_0xfa2b('0x4e')]({'plain':!![]});if(!_0x2f1dca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f1dca['role']==='user'){var _0x4a4601=_0x2b39d3[_0xfa2b('0x4e')]({'plain':!![]});var _0x10e2b0=_0xfa2b('0x28');return db[_0xfa2b('0x4f')][_0xfa2b('0x4c')]({'where':{'name':_0x10e2b0,'userProfileId':_0x2f1dca[_0xfa2b('0x50')]},'raw':!![]})['then'](function(_0x2eb075){if(_0x2eb075&&_0x2eb075[_0xfa2b('0x51')]===0x0){return db['UserProfileResource'][_0xfa2b('0x4d')]({'name':_0x4a4601['name'],'resourceId':_0x4a4601['id'],'type':_0x2eb075[_0xfa2b('0x2c')],'sectionId':_0x2eb075['id']},{})[_0xfa2b('0x27')](function(){return _0x2b39d3;});}else{return _0x2b39d3;}})[_0xfa2b('0x46')](function(_0x2a017e){logger[_0xfa2b('0x52')](_0xfa2b('0x53'),_0x2a017e);throw _0x2a017e;});}return _0x2b39d3;})['then'](respondWithResult(_0x2bae7b,0xc9))['catch'](handleError(_0x2bae7b,null));};exports[_0xfa2b('0x26')]=function(_0x349865,_0x20d970){if(_0x349865[_0xfa2b('0x54')]['id']){delete _0x349865[_0xfa2b('0x54')]['id'];}return db[_0xfa2b('0x43')]['find']({'where':{'id':_0x349865['params']['id']}})['then'](handleEntityNotFound(_0x20d970,null))['then'](saveUpdates(_0x349865[_0xfa2b('0x54')],null))[_0xfa2b('0x27')](respondWithResult(_0x20d970,null))[_0xfa2b('0x46')](handleError(_0x20d970,null));};exports[_0xfa2b('0x2a')]=function(_0x5e0e57,_0x186eef){return db[_0xfa2b('0x43')]['find']({'where':{'id':_0x5e0e57['params']['id']}})['then'](handleEntityNotFound(_0x186eef,null))['then'](removeEntity(_0x186eef,null))[_0xfa2b('0x46')](handleError(_0x186eef,null));};exports[_0xfa2b('0x55')]=function(_0x271513,_0x575767){return db[_0xfa2b('0x43')][_0xfa2b('0x55')]()[_0xfa2b('0x27')](respondWithResult(_0x575767,null))['catch'](handleError(_0x575767,null));};exports[_0xfa2b('0x56')]=function(_0x1aef43,_0x335f84,_0x48dce5){var _0x15c63b={'raw':!![],'where':{}},_0x247f6b={},_0x547034;return db[_0xfa2b('0x43')]['findOne']({'where':{'id':_0x1aef43['params']['id']}})['then'](handleEntityNotFound(_0x335f84,null))[_0xfa2b('0x27')](function(_0x714ee9){if(_0x714ee9){_0x547034=_0x714ee9[_0xfa2b('0x4e')]({'plain':!![]});_0x247f6b[_0xfa2b('0x30')]=_[_0xfa2b('0x32')](db[_0xfa2b('0x57')][_0xfa2b('0x49')]);_0x247f6b[_0xfa2b('0x31')]=_[_0xfa2b('0x32')](_0x1aef43['query']);_0x247f6b[_0xfa2b('0x3b')]=_[_0xfa2b('0x33')](_0x247f6b[_0xfa2b('0x30')],_0x247f6b[_0xfa2b('0x31')]);_0x15c63b[_0xfa2b('0x34')]=_['intersection'](_0x247f6b[_0xfa2b('0x30')],qs[_0xfa2b('0x35')](_0x1aef43['query'][_0xfa2b('0x35')]));_0x15c63b['attributes']=_0x15c63b[_0xfa2b('0x34')][_0xfa2b('0x4a')]?_0x15c63b['attributes']:_0x247f6b[_0xfa2b('0x30')];if(!_0x1aef43[_0xfa2b('0x31')][_0xfa2b('0x36')](_0xfa2b('0x37'))){_0x15c63b[_0xfa2b('0x38')]=qs['limit'](_0x1aef43['query']['limit']);_0x15c63b[_0xfa2b('0x23')]=qs[_0xfa2b('0x23')](_0x1aef43[_0xfa2b('0x31')][_0xfa2b('0x23')]);}_0x15c63b[_0xfa2b('0x39')]=qs[_0xfa2b('0x3a')](_0x1aef43[_0xfa2b('0x31')][_0xfa2b('0x3a')]);_0x15c63b['where']=qs[_0xfa2b('0x3b')](_[_0xfa2b('0x3c')](_0x1aef43['query'],_0x247f6b['filters']));_0x15c63b[_0xfa2b('0x3e')][_0xfa2b('0x58')]=_0x714ee9['id'];if(_0x1aef43[_0xfa2b('0x31')]['filter']){_0x15c63b[_0xfa2b('0x3e')]=_[_0xfa2b('0x3f')](_0x15c63b[_0xfa2b('0x3e')],{'$or':_['map'](_0x15c63b[_0xfa2b('0x34')],function(_0x271204){var _0x2d9751={};_0x2d9751[_0x271204]={'$like':'%'+_0x1aef43['query'][_0xfa2b('0x3d')]+'%'};return _0x2d9751;})});}_0x15c63b=_['merge']({},_0x15c63b,_0x1aef43[_0xfa2b('0x4b')]);return db[_0xfa2b('0x57')][_0xfa2b('0x44')](_0x15c63b);}})[_0xfa2b('0x27')](function(_0x2e99c1){if(_0x2e99c1){return db[_0xfa2b('0x59')][_0xfa2b('0x5a')]({'where':{'id':_[_0xfa2b('0x2d')](_0x2e99c1,_0xfa2b('0x5b')),'role':_0xfa2b('0x5c')},'attributes':['id',_0xfa2b('0x2c'),_0xfa2b('0x5d'),_0xfa2b('0x5e'),_0xfa2b('0x5f')]});}})[_0xfa2b('0x27')](function(_0xb9a9d4){if(_0xb9a9d4){return{'count':_0xb9a9d4[_0xfa2b('0x22')],'rows':_[_0xfa2b('0x2d')](_0xb9a9d4[_0xfa2b('0x45')],function(_0x22c3d0){return{'membername':_0x22c3d0[_0xfa2b('0x2c')],'UserId':_0x22c3d0['id'],'queue_name':_0x547034[_0xfa2b('0x2c')],'FaxQueueId':_0x547034['id'],'interface':util[_0xfa2b('0x60')](_0xfa2b('0x61'),_0xfa2b('0x62'),_0x22c3d0[_0xfa2b('0x2c')]),'penalty':0x0,'paused':_0x22c3d0['faxPause'],'createdAt':_0x22c3d0[_0xfa2b('0x5f')],'updatedAt':_0x22c3d0['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa2b('0x27')](respondWithFilteredResult(_0x335f84,_0x15c63b))[_0xfa2b('0x46')](handleError(_0x335f84,null));};exports['getTeams']=function(_0x316de2,_0x97a512,_0x73dda0){var _0x428e81={};var _0x1b4b18={};var _0x58841e;var _0x3a200;return db['FaxQueue'][_0xfa2b('0x63')]({'where':{'id':_0x316de2['params']['id']}})[_0xfa2b('0x27')](handleEntityNotFound(_0x97a512,null))[_0xfa2b('0x27')](function(_0x24bbbd){if(_0x24bbbd){_0x58841e=_0x24bbbd;_0x1b4b18[_0xfa2b('0x30')]=_[_0xfa2b('0x32')](db[_0xfa2b('0x64')]['rawAttributes']);_0x1b4b18[_0xfa2b('0x31')]=_[_0xfa2b('0x32')](_0x316de2['query']);_0x1b4b18['filters']=_[_0xfa2b('0x33')](_0x1b4b18[_0xfa2b('0x30')],_0x1b4b18['query']);_0x428e81[_0xfa2b('0x34')]=_[_0xfa2b('0x33')](_0x1b4b18[_0xfa2b('0x30')],qs[_0xfa2b('0x35')](_0x316de2[_0xfa2b('0x31')][_0xfa2b('0x35')]));_0x428e81[_0xfa2b('0x34')]=_0x428e81[_0xfa2b('0x34')]['length']?_0x428e81['attributes']:_0x1b4b18[_0xfa2b('0x30')];_0x428e81['order']=qs[_0xfa2b('0x3a')](_0x316de2[_0xfa2b('0x31')]['sort']);_0x428e81[_0xfa2b('0x3e')]=qs[_0xfa2b('0x3b')](_[_0xfa2b('0x3c')](_0x316de2[_0xfa2b('0x31')],_0x1b4b18[_0xfa2b('0x3b')]));if(_0x316de2['query'][_0xfa2b('0x3d')]){_0x428e81[_0xfa2b('0x3e')]=_[_0xfa2b('0x3f')](_0x428e81['where'],{'$or':_[_0xfa2b('0x2d')](_0x428e81['attributes'],function(_0xabdbca){var _0x59b645={};_0x59b645[_0xabdbca]={'$like':'%'+_0x316de2[_0xfa2b('0x31')][_0xfa2b('0x3d')]+'%'};return _0x59b645;})});}_0x428e81=_[_0xfa2b('0x3f')]({},_0x428e81,_0x316de2[_0xfa2b('0x4b')]);return _0x58841e[_0xfa2b('0x65')](_0x428e81);}})['then'](function(_0xe7f039){if(_0xe7f039){_0x3a200=_0xe7f039[_0xfa2b('0x4a')];if(!_0x316de2[_0xfa2b('0x31')][_0xfa2b('0x36')](_0xfa2b('0x37'))){_0x428e81[_0xfa2b('0x38')]=qs[_0xfa2b('0x38')](_0x316de2[_0xfa2b('0x31')]['limit']);_0x428e81[_0xfa2b('0x23')]=qs[_0xfa2b('0x23')](_0x316de2[_0xfa2b('0x31')][_0xfa2b('0x23')]);}return _0x58841e['getTeams'](_0x428e81);}})['then'](function(_0x5477e5){if(_0x5477e5){return _0x5477e5?{'count':_0x3a200,'rows':_0x5477e5}:null;}})[_0xfa2b('0x27')](respondWithResult(_0x97a512,null))[_0xfa2b('0x46')](handleError(_0x97a512,null));};exports[_0xfa2b('0x66')]=function(_0x26c224,_0x126336,_0x47e00e){var _0x17ecf5=_0x26c224['body'][_0xfa2b('0x67')];return db[_0xfa2b('0x64')][_0xfa2b('0x44')]({'where':{'id':_0x17ecf5},'attributes':['id'],'include':[{'model':db[_0xfa2b('0x59')],'as':_0xfa2b('0x68'),'attributes':['id','name','online',_0xfa2b('0x69'),_0xfa2b('0x6a')],'raw':!![]}]})[_0xfa2b('0x27')](function(_0x135999){if(_0x135999){var _0x522c25=_['flatMap'](_0x135999,function(_0x571cc3){var _0x30d6bd=_0x571cc3[_0xfa2b('0x4e')]({'plain':!![]});return _0x30d6bd[_0xfa2b('0x68')];});return db['FaxQueue'][_0xfa2b('0x4c')]({'where':{'id':_0x26c224[_0xfa2b('0x48')]['id']}})[_0xfa2b('0x27')](function(_0x2d426b){return db[_0xfa2b('0x6b')]['transaction'](function(_0x55c448){return _0x2d426b['addTeams'](_0x17ecf5,{'transaction':_0x55c448})[_0xfa2b('0x27')](function(){return BPromise[_0xfa2b('0x6c')](_0x522c25,function(_0x460777){return db[_0xfa2b('0x57')][_0xfa2b('0x6d')]({'where':{'UserId':_0x460777['id'],'FaxQueueId':_0x26c224[_0xfa2b('0x48')]['id']},'transaction':_0x55c448});});})[_0xfa2b('0x27')](function(){_0x522c25['forEach'](function(_0x3d7e79){socket[_0xfa2b('0x6e')](_0xfa2b('0x6f'),{'UserId':_0x3d7e79['id'],'FaxQueueId':_0x2d426b['id']});});});});});}})[_0xfa2b('0x27')](respondWithStatusCode(_0x126336,null))[_0xfa2b('0x46')](handleError(_0x126336,null));};exports[_0xfa2b('0x70')]=function(_0x2ba4f8,_0x1c60d6,_0x1d0aa5){return db[_0xfa2b('0x64')]['findAll']({'where':{'id':_0x2ba4f8[_0xfa2b('0x31')][_0xfa2b('0x67')]},'attributes':['id'],'include':[{'model':db[_0xfa2b('0x59')],'as':_0xfa2b('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c60d6,null))[_0xfa2b('0x27')](function(_0x4ab344){var _0x14e729=_[_0xfa2b('0x2d')](_0x4ab344,'id');var _0x154d08=[];var _0x50399b=[];var _0xf7ebc0=squel['select']();_0xf7ebc0[_0xfa2b('0x71')](_0xfa2b('0x72'))[_0xfa2b('0x73')](_0xfa2b('0x74'),'tq')['join'](_0xfa2b('0x75'),'ut',_0xfa2b('0x76'))['where'](_0xfa2b('0x77'),_0x2ba4f8[_0xfa2b('0x48')]['id']);for(var _0x2b8edd=0x0;_0x2b8edd<_0x4ab344[_0xfa2b('0x4a')];_0x2b8edd+=0x1){let _0x56e36e=_0x4ab344[_0x2b8edd];for(var _0x1e9752=0x0;_0x1e9752<_0x56e36e['Agents'][_0xfa2b('0x4a')];_0x1e9752+=0x1){let _0x26befe=_0x56e36e[_0xfa2b('0x68')][_0x1e9752];var _0xec5926=_0xf7ebc0[_0xfa2b('0x78')]();_0xec5926[_0xfa2b('0x3e')](_0xfa2b('0x79'),_0x26befe['id']);_0x50399b[_0xfa2b('0x7a')](db[_0xfa2b('0x6b')][_0xfa2b('0x31')](_0xec5926['toString'](),{'type':db['sequelize'][_0xfa2b('0x7b')][_0xfa2b('0x7c')]})['then'](function(_0x451462){if(_0x451462[_0xfa2b('0x4a')]===0x1){return _0x26befe['id'];}else{var _0xc5bb5c=_[_0xfa2b('0x7d')](_[_0xfa2b('0x2d')](_0x451462,'TeamId'),function(_0x4315bb){return _[_0xfa2b('0x7e')](_0x14e729,_0x4315bb);});if(_0xc5bb5c){return _0x26befe['id'];}}}));}}return BPromise[_0xfa2b('0x7f')](_0x50399b)['then'](function(_0x579714){_0x154d08=_(_0x154d08)[_0xfa2b('0x80')](_0x579714)[_0xfa2b('0x81')]()[_0xfa2b('0x82')]();return db[_0xfa2b('0x43')]['find']({'where':{'id':_0x2ba4f8[_0xfa2b('0x48')]['id']}})[_0xfa2b('0x27')](function(_0x4a5818){return db['sequelize'][_0xfa2b('0x83')](function(_0x43c8f1){return _0x4a5818[_0xfa2b('0x70')](_0x2ba4f8[_0xfa2b('0x31')][_0xfa2b('0x67')],{'transaction':_0x43c8f1})[_0xfa2b('0x27')](function(){if(!_['isEmpty'](_0x154d08)){return _0x4a5818[_0xfa2b('0x84')](_0x154d08,{'transaction':_0x43c8f1});}})[_0xfa2b('0x27')](function(){_0x154d08[_0xfa2b('0x85')](function(_0x16a000){socket[_0xfa2b('0x6e')](_0xfa2b('0x86'),{'UserId':_0x16a000,'FaxQueueId':_0x4a5818['id']});});});});});});})['then'](respondWithStatusCode(_0x1c60d6,null))['catch'](handleError(_0x1c60d6,null));};exports[_0xfa2b('0x87')]=function(_0x1523ff,_0x343b50,_0x59c8d1){return db[_0xfa2b('0x43')][_0xfa2b('0x4c')]({'where':{'id':_0x1523ff[_0xfa2b('0x48')]['id']}})[_0xfa2b('0x27')](handleEntityNotFound(_0x343b50,null))[_0xfa2b('0x27')](function(_0x173932){if(_0x173932){return _0x173932[_0xfa2b('0x87')](_0x1523ff[_0xfa2b('0x54')]['ids'],_[_0xfa2b('0x88')](_0x1523ff['body'],[_0xfa2b('0x67'),'id'])||{})[_0xfa2b('0x89')](function(_0x2feb95){for(var _0x393f31=0x0;_0x393f31<_0x1523ff[_0xfa2b('0x54')][_0xfa2b('0x67')][_0xfa2b('0x4a')];_0x393f31+=0x1){socket[_0xfa2b('0x6e')](_0xfa2b('0x6f'),{'UserId':_0x1523ff[_0xfa2b('0x54')][_0xfa2b('0x67')][_0x393f31],'FaxQueueId':_0x1523ff[_0xfa2b('0x48')]['id']});}return _0x2feb95;});}})[_0xfa2b('0x27')](respondWithResult(_0x343b50,null))[_0xfa2b('0x46')](handleError(_0x343b50,null));};exports[_0xfa2b('0x84')]=function(_0x20a97f,_0x28a0aa,_0x178c24){return db['FaxQueue'][_0xfa2b('0x4c')]({'where':{'id':_0x20a97f[_0xfa2b('0x48')]['id']}})['then'](handleEntityNotFound(_0x28a0aa,null))[_0xfa2b('0x27')](function(_0x53a285){if(_0x53a285){return _0x53a285[_0xfa2b('0x84')](_0x20a97f[_0xfa2b('0x31')]['ids'])[_0xfa2b('0x27')](function(){if(_[_0xfa2b('0x8a')](_0x20a97f[_0xfa2b('0x31')][_0xfa2b('0x67')])){for(var _0x479694=0x0;_0x479694<_0x20a97f[_0xfa2b('0x31')][_0xfa2b('0x67')][_0xfa2b('0x4a')];_0x479694+=0x1){socket[_0xfa2b('0x6e')](_0xfa2b('0x86'),{'UserId':Number(_0x20a97f[_0xfa2b('0x31')]['ids'][_0x479694]),'FaxQueueId':Number(_0x20a97f[_0xfa2b('0x48')]['id'])});}}else{socket[_0xfa2b('0x6e')](_0xfa2b('0x86'),{'UserId':Number(_0x20a97f[_0xfa2b('0x31')][_0xfa2b('0x67')]),'FaxQueueId':Number(_0x20a97f['params']['id'])});}});}})[_0xfa2b('0x27')](respondWithStatusCode(_0x28a0aa,null))[_0xfa2b('0x46')](handleError(_0x28a0aa,null));};exports[_0xfa2b('0x8b')]=function(_0x2a9b79,_0x4d89b0,_0x36937a){var _0x338ba0={};var _0x201736={};var _0x5ac539;var _0x5f5da7;return db[_0xfa2b('0x43')][_0xfa2b('0x63')]({'where':{'id':_0x2a9b79['params']['id']}})[_0xfa2b('0x27')](handleEntityNotFound(_0x4d89b0,null))['then'](function(_0x357447){if(_0x357447){_0x5ac539=_0x357447;_0x201736['model']=_['keys'](db['User'][_0xfa2b('0x49')]);_0x201736[_0xfa2b('0x31')]=_['keys'](_0x2a9b79[_0xfa2b('0x31')]);_0x201736[_0xfa2b('0x3b')]=_[_0xfa2b('0x33')](_0x201736[_0xfa2b('0x30')],_0x201736[_0xfa2b('0x31')]);_0x338ba0[_0xfa2b('0x34')]=_[_0xfa2b('0x33')](_0x201736[_0xfa2b('0x30')],qs['fields'](_0x2a9b79[_0xfa2b('0x31')][_0xfa2b('0x35')]));_0x338ba0[_0xfa2b('0x34')]=_0x338ba0['attributes'][_0xfa2b('0x4a')]?_0x338ba0[_0xfa2b('0x34')]:_0x201736[_0xfa2b('0x30')];_0x338ba0[_0xfa2b('0x39')]=qs[_0xfa2b('0x3a')](_0x2a9b79[_0xfa2b('0x31')][_0xfa2b('0x3a')]);_0x338ba0[_0xfa2b('0x3e')]=qs[_0xfa2b('0x3b')](_[_0xfa2b('0x3c')](_0x2a9b79[_0xfa2b('0x31')],_0x201736['filters']));if(_0x2a9b79[_0xfa2b('0x31')][_0xfa2b('0x3d')]){_0x338ba0[_0xfa2b('0x3e')]=_['merge'](_0x338ba0[_0xfa2b('0x3e')],{'$or':_[_0xfa2b('0x2d')](_0x338ba0[_0xfa2b('0x34')],function(_0x314029){var _0x3fe8be={};_0x3fe8be[_0x314029]={'$like':'%'+_0x2a9b79[_0xfa2b('0x31')]['filter']+'%'};return _0x3fe8be;})});}_0x338ba0=_[_0xfa2b('0x3f')]({},_0x338ba0,_0x2a9b79[_0xfa2b('0x4b')]);return _0x5ac539[_0xfa2b('0x8b')](_0x338ba0);}})[_0xfa2b('0x27')](function(_0x1e90be){if(_0x1e90be){_0x5f5da7=_0x1e90be[_0xfa2b('0x4a')];if(!_0x2a9b79[_0xfa2b('0x31')][_0xfa2b('0x36')]('nolimit')){_0x338ba0['limit']=qs[_0xfa2b('0x38')](_0x2a9b79[_0xfa2b('0x31')][_0xfa2b('0x38')]);_0x338ba0[_0xfa2b('0x23')]=qs['offset'](_0x2a9b79['query'][_0xfa2b('0x23')]);}return _0x5ac539[_0xfa2b('0x8b')](_0x338ba0);}})[_0xfa2b('0x27')](function(_0x4f2ae9){if(_0x4f2ae9){return _0x4f2ae9?{'count':_0x5f5da7,'rows':_0x4f2ae9}:null;}})['then'](respondWithResult(_0x4d89b0,null))['catch'](handleError(_0x4d89b0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c2e2643..2ac6222 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 _0x9c53=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4db631,_0x4a82b6){var _0x46a3a9=function(_0xa2537d){while(--_0xa2537d){_0x4db631['push'](_0x4db631['shift']());}};_0x46a3a9(++_0x4a82b6);}(_0x9c53,0x1ae));var _0x39c5=function(_0x579bdf,_0x570502){_0x579bdf=_0x579bdf-0x0;var _0x15ae27=_0x9c53[_0x579bdf];return _0x15ae27;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x39c5('0x0'))['db'][_0x39c5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x39c5('0x2')](0x0);var events={'afterCreate':_0x39c5('0x3'),'afterUpdate':_0x39c5('0x4'),'afterDestroy':_0x39c5('0x5')};function emitEvent(_0x43964f){return function(_0x42fa7a,_0x6beaab,_0x4ae2fd){FaxQueueEvents[_0x39c5('0x6')](_0x43964f+':'+_0x42fa7a['id'],_0x42fa7a);FaxQueueEvents[_0x39c5('0x6')](_0x43964f,_0x42fa7a);_0x4ae2fd(null);};}for(var e in events){if(events[_0x39c5('0x7')](e)){var event=events[e];FaxQueue[_0x39c5('0x8')](e,emitEvent(event));}}module[_0x39c5('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x1163=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x543242,_0xeac9fd){var _0x4c99b6=function(_0x47d087){while(--_0x47d087){_0x543242['push'](_0x543242['shift']());}};_0x4c99b6(++_0xeac9fd);}(_0x1163,0x14e));var _0x3116=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x1163[_0x376b45];return _0x2341b3;};'use strict';var EventEmitter=require(_0x3116('0x0'));var FaxQueue=require(_0x3116('0x1'))['db'][_0x3116('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3116('0x3')](0x0);var events={'afterCreate':_0x3116('0x4'),'afterUpdate':_0x3116('0x5'),'afterDestroy':_0x3116('0x6')};function emitEvent(_0x496a51){return function(_0x2dda65,_0x254502,_0x1d0233){FaxQueueEvents[_0x3116('0x7')](_0x496a51+':'+_0x2dda65['id'],_0x2dda65);FaxQueueEvents['emit'](_0x496a51,_0x2dda65);_0x1d0233(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x3116('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index daf1f14..8ff33b5 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 _0x02b2=['request-promise','path','rimraf','./faxQueue.attributes','exports','define','fax_queues','lodash','../../config/logger','moment','bluebird'];(function(_0xa9cc9c,_0x1f82d3){var _0x266274=function(_0x2907ca){while(--_0x2907ca){_0xa9cc9c['push'](_0xa9cc9c['shift']());}};_0x266274(++_0x1f82d3);}(_0x02b2,0x172));var _0x202b=function(_0xb7c6b4,_0x3e275c){_0xb7c6b4=_0xb7c6b4-0x0;var _0x51e8e0=_0x02b2[_0xb7c6b4];return _0x51e8e0;};'use strict';var _=require(_0x202b('0x0'));var util=require('util');var logger=require(_0x202b('0x1'))('api');var moment=require(_0x202b('0x2'));var BPromise=require(_0x202b('0x3'));var rp=require(_0x202b('0x4'));var fs=require('fs');var path=require(_0x202b('0x5'));var rimraf=require(_0x202b('0x6'));var config=require('../../config/environment');var attributes=require(_0x202b('0x7'));module[_0x202b('0x8')]=function(_0x518f17,_0x12a3e0){return _0x518f17[_0x202b('0x9')]('FaxQueue',attributes,{'tableName':_0x202b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c37=['moment','bluebird','path','rimraf','exports','define','FaxQueue','fax_queues','lodash','../../config/logger'];(function(_0x2fa09e,_0x1d301d){var _0xbf7c82=function(_0x1773a9){while(--_0x1773a9){_0x2fa09e['push'](_0x2fa09e['shift']());}};_0xbf7c82(++_0x1d301d);}(_0x5c37,0x1ca));var _0x75c3=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x5c37[_0x4536a4];return _0x4fd1c1;};'use strict';var _=require(_0x75c3('0x0'));var util=require('util');var logger=require(_0x75c3('0x1'))('api');var moment=require(_0x75c3('0x2'));var BPromise=require(_0x75c3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75c3('0x4'));var rimraf=require(_0x75c3('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x75c3('0x6')]=function(_0x4a26da,_0x289a64){return _0x4a26da[_0x75c3('0x7')](_0x75c3('0x8'),attributes,{'tableName':_0x75c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 830861a..13a0ea9 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 _0xdbaf=['then','info','request\x20sent','debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','FaxQueue','options','raw','where','limit','model','attributes','include','map','GetFaxQueue','find','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x2a88ce,_0x4eaced){var _0x3ba682=function(_0x3cbcce){while(--_0x3cbcce){_0x2a88ce['push'](_0x2a88ce['shift']());}};_0x3ba682(++_0x4eaced);}(_0xdbaf,0x1ce));var _0xfdba=function(_0x290566,_0x229ea2){_0x290566=_0x290566-0x0;var _0x7e4a50=_0xdbaf[_0x290566];return _0x7e4a50;};'use strict';var _=require(_0xfdba('0x0'));var util=require(_0xfdba('0x1'));var moment=require(_0xfdba('0x2'));var BPromise=require(_0xfdba('0x3'));var rs=require(_0xfdba('0x4'));var fs=require('fs');var Redis=require(_0xfdba('0x5'));var db=require(_0xfdba('0x6'))['db'];var utils=require(_0xfdba('0x7'));var logger=require('../../config/logger')(_0xfdba('0x8'));var config=require(_0xfdba('0x9'));var jayson=require(_0xfdba('0xa'));var client=jayson[_0xfdba('0xb')][_0xfdba('0xc')]({'port':0x232a});config[_0xfdba('0xd')]=_[_0xfdba('0xe')](config['redis'],{'host':_0xfdba('0xf'),'port':0x18eb});var socket=require(_0xfdba('0x10'))(new Redis(config['redis']));require(_0xfdba('0x11'))['register'](socket);function respondWithRpcPromise(_0x1d69d6,_0x2fdee9,_0x13b962){return new BPromise(function(_0x5276f8,_0x59ad0b){return client['request'](_0x1d69d6,_0x13b962)[_0xfdba('0x12')](function(_0xd805eb){logger[_0xfdba('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2fdee9,_0xfdba('0x14'));logger[_0xfdba('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2fdee9,_0xfdba('0x14'),JSON[_0xfdba('0x16')](_0xd805eb));if(_0xd805eb[_0xfdba('0x17')]){if(_0xd805eb[_0xfdba('0x17')][_0xfdba('0x18')]===0x1f4){logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0xd805eb[_0xfdba('0x17')]['message']);return _0x59ad0b(_0xd805eb[_0xfdba('0x17')]['message']);}logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0xd805eb[_0xfdba('0x17')][_0xfdba('0x1a')]);return _0x5276f8(_0xd805eb[_0xfdba('0x17')][_0xfdba('0x1a')]);}else{logger[_0xfdba('0x13')](_0xfdba('0x19'),_0x2fdee9,_0xfdba('0x14'));_0x5276f8(_0xd805eb['result']['message']);}})[_0xfdba('0x1b')](function(_0x58bf17){logger[_0xfdba('0x17')](_0xfdba('0x19'),_0x2fdee9,_0x58bf17);_0x59ad0b(_0x58bf17);});});}exports['GetFaxQueue']=function(_0x463aaa){var _0x5c592e=this;return new Promise(function(_0x291cf2,_0x220377){return db[_0xfdba('0x1c')]['findAll']({'raw':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x1e')]===undefined?!![]:![]:!![],'where':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x1f')]||null:null,'attributes':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')]['attributes']||null:null,'limit':_0x463aaa[_0xfdba('0x1d')]?_0x463aaa[_0xfdba('0x1d')][_0xfdba('0x20')]||null:null,'include':_0x463aaa['options']?_0x463aaa[_0xfdba('0x1d')]['include']?_['map'](_0x463aaa[_0xfdba('0x1d')]['include'],function(_0x2d7afd){return{'model':db[_0x2d7afd[_0xfdba('0x21')]],'as':_0x2d7afd['as'],'attributes':_0x2d7afd[_0xfdba('0x22')],'include':_0x2d7afd[_0xfdba('0x23')]?_[_0xfdba('0x24')](_0x2d7afd[_0xfdba('0x23')],function(_0x3af858){return{'model':db[_0x3af858[_0xfdba('0x21')]],'as':_0x3af858['as'],'attributes':_0x3af858[_0xfdba('0x22')],'include':_0x3af858[_0xfdba('0x23')]?_['map'](_0x3af858[_0xfdba('0x23')],function(_0x330786){return{'model':db[_0x330786[_0xfdba('0x21')]],'as':_0x330786['as'],'attributes':_0x330786['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdba('0x12')](function(_0x793d74){logger['info'](_0xfdba('0x25'),_0x463aaa);logger['debug']('GetFaxQueue',_0x463aaa,JSON[_0xfdba('0x16')](_0x793d74));_0x291cf2(_0x793d74);})[_0xfdba('0x1b')](function(_0x20b06f){logger['error']('GetFaxQueue',_0x20b06f[_0xfdba('0x1a')],_0x463aaa);_0x220377(_0x5c592e['error'](0x1f4,_0x20b06f[_0xfdba('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x4a1d97){var _0x7a85bc=this;return new Promise(function(_0x4bd8a4,_0x5f1e5e){return db[_0xfdba('0x1c')][_0xfdba('0x26')]({'raw':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')][_0xfdba('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97['options'][_0xfdba('0x1f')]||null:null,'attributes':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')]['attributes']||null:null,'include':_0x4a1d97[_0xfdba('0x1d')]?_0x4a1d97[_0xfdba('0x1d')]['include']?_[_0xfdba('0x24')](_0x4a1d97['options'][_0xfdba('0x23')],function(_0x5a3f40){return{'model':db[_0x5a3f40[_0xfdba('0x21')]],'as':_0x5a3f40['as'],'attributes':_0x5a3f40[_0xfdba('0x22')],'include':_0x5a3f40[_0xfdba('0x23')]?_['map'](_0x5a3f40[_0xfdba('0x23')],function(_0x57bc0c){return{'model':db[_0x57bc0c[_0xfdba('0x21')]],'as':_0x57bc0c['as'],'attributes':_0x57bc0c[_0xfdba('0x22')],'include':_0x57bc0c[_0xfdba('0x23')]?_[_0xfdba('0x24')](_0x57bc0c[_0xfdba('0x23')],function(_0x10e4ab){return{'model':db[_0x10e4ab['model']],'as':_0x10e4ab['as'],'attributes':_0x10e4ab[_0xfdba('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfdba('0x12')](function(_0x187f0e){logger['info'](_0xfdba('0x27'),_0x4a1d97);logger[_0xfdba('0x15')](_0xfdba('0x27'),_0x4a1d97,JSON['stringify'](_0x187f0e));_0x4bd8a4(_0x187f0e);})[_0xfdba('0x1b')](function(_0x33b367){logger['error']('ShowFaxQueue',_0x33b367['message'],_0x4a1d97);_0x5f1e5e(_0x7a85bc[_0xfdba('0x17')](0x1f4,_0x33b367[_0xfdba('0x1a')]));});});}; \ No newline at end of file +var _0x78c2=['localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowFaxQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x6a493b,_0x43efa3){var _0x53da2a=function(_0x50a3a5){while(--_0x50a3a5){_0x6a493b['push'](_0x6a493b['shift']());}};_0x53da2a(++_0x43efa3);}(_0x78c2,0x1b7));var _0x278c=function(_0x4a6f67,_0x4e8223){_0x4a6f67=_0x4a6f67-0x0;var _0x5e12c0=_0x78c2[_0x4a6f67];return _0x5e12c0;};'use strict';var _=require(_0x278c('0x0'));var util=require(_0x278c('0x1'));var moment=require(_0x278c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x278c('0x3'));var db=require(_0x278c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x278c('0x5'))(_0x278c('0x6'));var config=require(_0x278c('0x7'));var jayson=require(_0x278c('0x8'));var client=jayson[_0x278c('0x9')][_0x278c('0xa')]({'port':0x232a});config[_0x278c('0xb')]=_['defaults'](config[_0x278c('0xb')],{'host':_0x278c('0xc'),'port':0x18eb});var socket=require(_0x278c('0xd'))(new Redis(config[_0x278c('0xb')]));require(_0x278c('0xe'))[_0x278c('0xf')](socket);function respondWithRpcPromise(_0x6ae2f8,_0x18c74f,_0x4038c5){return new BPromise(function(_0x2abaf7,_0x43ba15){return client[_0x278c('0x10')](_0x6ae2f8,_0x4038c5)[_0x278c('0x11')](function(_0x5886c9){logger[_0x278c('0x12')]('FaxQueue,\x20%s,\x20%s',_0x18c74f,_0x278c('0x13'));logger[_0x278c('0x14')](_0x278c('0x15'),_0x18c74f,_0x278c('0x13'),JSON[_0x278c('0x16')](_0x5886c9));if(_0x5886c9[_0x278c('0x17')]){if(_0x5886c9['error'][_0x278c('0x18')]===0x1f4){logger[_0x278c('0x17')](_0x278c('0x19'),_0x18c74f,_0x5886c9[_0x278c('0x17')][_0x278c('0x1a')]);return _0x43ba15(_0x5886c9[_0x278c('0x17')]['message']);}logger[_0x278c('0x17')](_0x278c('0x19'),_0x18c74f,_0x5886c9[_0x278c('0x17')][_0x278c('0x1a')]);return _0x2abaf7(_0x5886c9[_0x278c('0x17')]['message']);}else{logger[_0x278c('0x12')](_0x278c('0x19'),_0x18c74f,_0x278c('0x13'));_0x2abaf7(_0x5886c9['result'][_0x278c('0x1a')]);}})[_0x278c('0x1b')](function(_0x29967a){logger[_0x278c('0x17')]('FaxQueue,\x20%s,\x20%s',_0x18c74f,_0x29967a);_0x43ba15(_0x29967a);});});}exports[_0x278c('0x1c')]=function(_0x229cba){var _0x3e36bb=this;return new Promise(function(_0x34c438,_0x210eee){return db[_0x278c('0x1d')][_0x278c('0x1e')]({'raw':_0x229cba[_0x278c('0x1f')]?_0x229cba[_0x278c('0x1f')][_0x278c('0x20')]===undefined?!![]:![]:!![],'where':_0x229cba['options']?_0x229cba[_0x278c('0x1f')][_0x278c('0x21')]||null:null,'attributes':_0x229cba[_0x278c('0x1f')]?_0x229cba[_0x278c('0x1f')][_0x278c('0x22')]||null:null,'limit':_0x229cba['options']?_0x229cba[_0x278c('0x1f')][_0x278c('0x23')]||null:null,'include':_0x229cba[_0x278c('0x1f')]?_0x229cba['options'][_0x278c('0x24')]?_[_0x278c('0x25')](_0x229cba[_0x278c('0x1f')][_0x278c('0x24')],function(_0x52d683){return{'model':db[_0x52d683[_0x278c('0x26')]],'as':_0x52d683['as'],'attributes':_0x52d683['attributes'],'include':_0x52d683[_0x278c('0x24')]?_[_0x278c('0x25')](_0x52d683[_0x278c('0x24')],function(_0x10fbfd){return{'model':db[_0x10fbfd[_0x278c('0x26')]],'as':_0x10fbfd['as'],'attributes':_0x10fbfd[_0x278c('0x22')],'include':_0x10fbfd['include']?_[_0x278c('0x25')](_0x10fbfd['include'],function(_0x4e1cd3){return{'model':db[_0x4e1cd3['model']],'as':_0x4e1cd3['as'],'attributes':_0x4e1cd3['attributes']};}):[]};}):[]};}):[]:[]})[_0x278c('0x11')](function(_0x182b9c){logger[_0x278c('0x12')](_0x278c('0x1c'),_0x229cba);logger[_0x278c('0x14')]('GetFaxQueue',_0x229cba,JSON[_0x278c('0x16')](_0x182b9c));_0x34c438(_0x182b9c);})['catch'](function(_0x10f043){logger[_0x278c('0x17')](_0x278c('0x1c'),_0x10f043[_0x278c('0x1a')],_0x229cba);_0x210eee(_0x3e36bb[_0x278c('0x17')](0x1f4,_0x10f043[_0x278c('0x1a')]));});});};exports['ShowFaxQueue']=function(_0x5625fe){var _0x382f8c=this;return new Promise(function(_0x23fd05,_0x37d289){return db[_0x278c('0x1d')][_0x278c('0x27')]({'raw':_0x5625fe[_0x278c('0x1f')]?_0x5625fe[_0x278c('0x1f')][_0x278c('0x20')]===undefined?!![]:![]:!![],'where':_0x5625fe['options']?_0x5625fe[_0x278c('0x1f')][_0x278c('0x21')]||null:null,'attributes':_0x5625fe[_0x278c('0x1f')]?_0x5625fe[_0x278c('0x1f')]['attributes']||null:null,'include':_0x5625fe[_0x278c('0x1f')]?_0x5625fe[_0x278c('0x1f')][_0x278c('0x24')]?_['map'](_0x5625fe[_0x278c('0x1f')][_0x278c('0x24')],function(_0x518009){return{'model':db[_0x518009[_0x278c('0x26')]],'as':_0x518009['as'],'attributes':_0x518009['attributes'],'include':_0x518009[_0x278c('0x24')]?_[_0x278c('0x25')](_0x518009['include'],function(_0x19241b){return{'model':db[_0x19241b['model']],'as':_0x19241b['as'],'attributes':_0x19241b[_0x278c('0x22')],'include':_0x19241b[_0x278c('0x24')]?_['map'](_0x19241b['include'],function(_0x233f6a){return{'model':db[_0x233f6a['model']],'as':_0x233f6a['as'],'attributes':_0x233f6a[_0x278c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x278c('0x11')](function(_0x208bf2){logger[_0x278c('0x12')]('ShowFaxQueue',_0x5625fe);logger[_0x278c('0x14')](_0x278c('0x28'),_0x5625fe,JSON['stringify'](_0x208bf2));_0x23fd05(_0x208bf2);})['catch'](function(_0x255e8d){logger[_0x278c('0x17')]('ShowFaxQueue',_0x255e8d['message'],_0x5625fe);_0x37d289(_0x382f8c[_0x278c('0x17')](0x1f4,_0x255e8d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 500922b..d039665 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 _0x5cff=['remove','emit','removeListener','length','faxQueue:','save'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x5cff,0x107));var _0xf5cf=function(_0x520f86,_0x240cc0){_0x520f86=_0x520f86-0x0;var _0x4b6523=_0x5cff[_0x520f86];return _0x4b6523;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf5cf('0x0'),_0xf5cf('0x1'),'update'];function createListener(_0x403fe9,_0x49b105){return function(_0xf35361){_0x49b105[_0xf5cf('0x2')](_0x403fe9,_0xf35361);};}function removeListener(_0x5b803c,_0x3bf260){return function(){FaxQueueEvents[_0xf5cf('0x3')](_0x5b803c,_0x3bf260);};}exports['register']=function(_0x326b54){for(var _0x3cce6f=0x0,_0x36e2f7=events[_0xf5cf('0x4')];_0x3cce6f<_0x36e2f7;_0x3cce6f++){var _0x47d518=events[_0x3cce6f];var _0x1eb3df=createListener(_0xf5cf('0x5')+_0x47d518,_0x326b54);FaxQueueEvents['on'](_0x47d518,_0x1eb3df);}}; \ No newline at end of file +var _0xe531=['./faxQueue.events','save','remove','update','removeListener','register','length','faxQueue:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe531,0x190));var _0x1e53=function(_0x39d2de,_0x25dcb6){_0x39d2de=_0x39d2de-0x0;var _0x211d52=_0xe531[_0x39d2de];return _0x211d52;};'use strict';var FaxQueueEvents=require(_0x1e53('0x0'));var events=[_0x1e53('0x1'),_0x1e53('0x2'),_0x1e53('0x3')];function createListener(_0x1cabf2,_0x32c233){return function(_0x24d148){_0x32c233['emit'](_0x1cabf2,_0x24d148);};}function removeListener(_0x2fe86a,_0x1dbbbc){return function(){FaxQueueEvents[_0x1e53('0x4')](_0x2fe86a,_0x1dbbbc);};}exports[_0x1e53('0x5')]=function(_0x3db960){for(var _0x509fea=0x0,_0x350937=events[_0x1e53('0x6')];_0x509fea<_0x350937;_0x509fea++){var _0x47890d=events[_0x509fea];var _0x3b7984=createListener(_0x1e53('0x7')+_0x47890d,_0x3db960);FaxQueueEvents['on'](_0x47890d,_0x3b7984);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ce68a98..77a83ae 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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x56d3a2,_0x5f191b){var _0x2c14d0=function(_0xb776e2){while(--_0xb776e2){_0x56d3a2['push'](_0x56d3a2['shift']());}};_0x2c14d0(++_0x5f191b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file +var _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x5a6355,_0x2b5c5b){var _0x14b0f6=function(_0x10f4fe){while(--_0x10f4fe){_0x5a6355['push'](_0x5a6355['shift']());}};_0x14b0f6(++_0x2b5c5b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('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 13f6ebc..356cac3 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 _0xc2e3=['DATE','moment','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2e3,0xe1));var _0x3c2e=function(_0x151b87,_0x2af01f){_0x151b87=_0x151b87-0x0;var _0x3a450b=_0xc2e3[_0x151b87];return _0x3a450b;};'use strict';var moment=require(_0x3c2e('0x0'));var Sequelize=require('sequelize');module[_0x3c2e('0x1')]={'uniqueid':{'type':Sequelize[_0x3c2e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3c2e('0x2')]},'joinAt':{'type':Sequelize[_0x3c2e('0x3')]},'leaveAt':{'type':Sequelize[_0x3c2e('0x3')]},'acceptAt':{'type':Sequelize[_0x3c2e('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd04=['STRING','DATE','moment'];(function(_0x2f8900,_0x3e7b3d){var _0x14e0e3=function(_0x55358d){while(--_0x55358d){_0x2f8900['push'](_0x2f8900['shift']());}};_0x14e0e3(++_0x3e7b3d);}(_0xdd04,0x125));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4dd0('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4dd0('0x1')]},'joinAt':{'type':Sequelize[_0x4dd0('0x2')]},'leaveAt':{'type':Sequelize[_0x4dd0('0x2')]},'acceptAt':{'type':Sequelize[_0x4dd0('0x2')]},'exitAt':{'type':Sequelize[_0x4dd0('0x2')]},'reason':{'type':Sequelize[_0x4dd0('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1fbddf3..5fa2b6a 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 _0x0ffd=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','sendStatus','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body'];(function(_0x46857f,_0x1c73ad){var _0x30bebc=function(_0x38e9bd){while(--_0x38e9bd){_0x46857f['push'](_0x46857f['shift']());}};_0x30bebc(++_0x1c73ad);}(_0x0ffd,0x129));var _0xd0ff=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x0ffd[_0x3054be];return _0x3df150;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0ff('0x0'));var rimraf=require(_0xd0ff('0x1'));var zipdir=require(_0xd0ff('0x2'));var jsonpatch=require(_0xd0ff('0x3'));var rp=require(_0xd0ff('0x4'));var moment=require(_0xd0ff('0x5'));var BPromise=require(_0xd0ff('0x6'));var Mustache=require(_0xd0ff('0x7'));var util=require(_0xd0ff('0x8'));var path=require(_0xd0ff('0x9'));var sox=require(_0xd0ff('0xa'));var csv=require(_0xd0ff('0xb'));var ejs=require(_0xd0ff('0xc'));var fs=require('fs');var _=require(_0xd0ff('0xd'));var squel=require(_0xd0ff('0xe'));var crypto=require(_0xd0ff('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd0ff('0x10'));var toCsv=require(_0xd0ff('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd0ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd0ff('0x12'));var as=require(_0xd0ff('0x13'));var hardwareService=require(_0xd0ff('0x14'));var logger=require(_0xd0ff('0x15'))('api');var utils=require(_0xd0ff('0x16'));var config=require(_0xd0ff('0x17'));var db=require(_0xd0ff('0x18'))['db'];function respondWithStatusCode(_0x2db806,_0x565f64){_0x565f64=_0x565f64||0xcc;return function(_0xbcd8cb){if(_0xbcd8cb){return _0x2db806['sendStatus'](_0x565f64);}return _0x2db806[_0xd0ff('0x19')](_0x565f64)[_0xd0ff('0x1a')]();};}function respondWithResult(_0x253906,_0xcc2008){_0xcc2008=_0xcc2008||0xc8;return function(_0x2616b1){if(_0x2616b1){return _0x253906[_0xd0ff('0x19')](_0xcc2008)['json'](_0x2616b1);}};}function respondWithFilteredResult(_0x1d927b,_0x44f694){return function(_0x432a7b){if(_0x432a7b){var _0x1ba5be=_0x432a7b[_0xd0ff('0x1b')],_0xa9180b=_0x44f694['offset'],_0x22af58=_0x44f694[_0xd0ff('0x1c')]+_0x44f694[_0xd0ff('0x1d')],_0x9ea1c7;if(_0x22af58>=_0x1ba5be){_0x22af58=_0x1ba5be;_0x9ea1c7=0xc8;}else{_0x9ea1c7=0xce;}_0x1d927b[_0xd0ff('0x19')](_0x9ea1c7);return _0x1d927b[_0xd0ff('0x1e')](_0xd0ff('0x1f'),_0xa9180b+'-'+_0x22af58+'/'+_0x1ba5be)[_0xd0ff('0x20')](_0x432a7b);}return null;};}function patchUpdates(_0x576825){return function(_0x19b2a4){try{jsonpatch['apply'](_0x19b2a4,_0x576825,!![]);}catch(_0x4c03b4){return BPromise[_0xd0ff('0x21')](_0x4c03b4);}return _0x19b2a4['save']();};}function saveUpdates(_0x296bc8,_0x5d0f9a){return function(_0x1a7612){if(_0x1a7612){return _0x1a7612[_0xd0ff('0x22')](_0x296bc8)['then'](function(_0x361105){return _0x361105;});}return null;};}function removeEntity(_0x71312f,_0x1b575b){return function(_0x1f6bad){if(_0x1f6bad){return _0x1f6bad[_0xd0ff('0x23')]()[_0xd0ff('0x24')](function(){_0x71312f[_0xd0ff('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16772f,_0x4e971d){return function(_0x47c2ce){if(!_0x47c2ce){_0x16772f[_0xd0ff('0x25')](0x194);}return _0x47c2ce;};}function handleError(_0x11e3d5,_0x4c3a89){_0x4c3a89=_0x4c3a89||0x1f4;return function(_0x452ebe){logger['error'](_0x452ebe[_0xd0ff('0x26')]);if(_0x452ebe[_0xd0ff('0x27')]){delete _0x452ebe[_0xd0ff('0x27')];}_0x11e3d5[_0xd0ff('0x19')](_0x4c3a89)['send'](_0x452ebe);};}exports[_0xd0ff('0x28')]=function(_0x4de9e5,_0x38f023){var _0x512b32={},_0x10d6ae={},_0x5a09c1={'count':0x0,'rows':[]};var _0x4c07f9=_[_0xd0ff('0x29')](db[_0xd0ff('0x2a')][_0xd0ff('0x2b')],function(_0x21aa7f){return{'name':_0x21aa7f[_0xd0ff('0x2c')],'type':_0x21aa7f[_0xd0ff('0x2d')][_0xd0ff('0x2e')]};});_0x10d6ae['model']=_[_0xd0ff('0x29')](_0x4c07f9,_0xd0ff('0x27'));_0x10d6ae['query']=_['keys'](_0x4de9e5[_0xd0ff('0x2f')]);_0x10d6ae['filters']=_['intersection'](_0x10d6ae[_0xd0ff('0x30')],_0x10d6ae['query']);_0x512b32[_0xd0ff('0x31')]=_[_0xd0ff('0x32')](_0x10d6ae['model'],qs[_0xd0ff('0x33')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x33')]));_0x512b32[_0xd0ff('0x31')]=_0x512b32[_0xd0ff('0x31')][_0xd0ff('0x34')]?_0x512b32[_0xd0ff('0x31')]:_0x10d6ae[_0xd0ff('0x30')];if(!_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x35')]('nolimit')){_0x512b32[_0xd0ff('0x1d')]=qs[_0xd0ff('0x1d')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x1d')]);_0x512b32[_0xd0ff('0x1c')]=qs['offset'](_0x4de9e5[_0xd0ff('0x2f')]['offset']);}_0x512b32[_0xd0ff('0x36')]=qs[_0xd0ff('0x37')](_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x37')]);_0x512b32['where']=qs[_0xd0ff('0x38')](_[_0xd0ff('0x39')](_0x4de9e5[_0xd0ff('0x2f')],_0x10d6ae[_0xd0ff('0x38')]),_0x4c07f9);if(_0x4de9e5[_0xd0ff('0x2f')][_0xd0ff('0x3a')]){_0x512b32[_0xd0ff('0x3b')]=_[_0xd0ff('0x3c')](_0x512b32['where'],{'$or':_['map'](_0x4c07f9,function(_0x47e9e8){if(_0x47e9e8[_0xd0ff('0x2d')]!==_0xd0ff('0x3d')){var _0x324809={};_0x324809[_0x47e9e8[_0xd0ff('0x27')]]={'$like':'%'+_0x4de9e5['query']['filter']+'%'};return _0x324809;}})});}_0x512b32=_[_0xd0ff('0x3c')]({},_0x512b32,_0x4de9e5[_0xd0ff('0x3e')]);var _0x23cff3={'where':_0x512b32[_0xd0ff('0x3b')]};return db['FaxQueueReport'][_0xd0ff('0x1b')](_0x23cff3)[_0xd0ff('0x24')](function(_0x1559de){_0x5a09c1[_0xd0ff('0x1b')]=_0x1559de;if(_0x4de9e5[_0xd0ff('0x2f')]['includeAll']){_0x512b32[_0xd0ff('0x3f')]=[{'all':!![]}];}return db[_0xd0ff('0x2a')][_0xd0ff('0x40')](_0x512b32);})[_0xd0ff('0x24')](function(_0x3671f8){_0x5a09c1[_0xd0ff('0x41')]=_0x3671f8;return _0x5a09c1;})['then'](respondWithFilteredResult(_0x38f023,_0x512b32))['catch'](handleError(_0x38f023,null));};exports[_0xd0ff('0x42')]=function(_0x1c5b2e,_0xde9281){var _0x3f7312={'raw':!![],'where':{'id':_0x1c5b2e[_0xd0ff('0x43')]['id']}},_0x4650e8={};_0x4650e8[_0xd0ff('0x30')]=_['keys'](db['FaxQueueReport'][_0xd0ff('0x2b')]);_0x4650e8['query']=_['keys'](_0x1c5b2e['query']);_0x4650e8['filters']=_[_0xd0ff('0x32')](_0x4650e8[_0xd0ff('0x30')],_0x4650e8['query']);_0x3f7312[_0xd0ff('0x31')]=_[_0xd0ff('0x32')](_0x4650e8[_0xd0ff('0x30')],qs['fields'](_0x1c5b2e[_0xd0ff('0x2f')][_0xd0ff('0x33')]));_0x3f7312['attributes']=_0x3f7312[_0xd0ff('0x31')]['length']?_0x3f7312[_0xd0ff('0x31')]:_0x4650e8['model'];if(_0x1c5b2e[_0xd0ff('0x2f')][_0xd0ff('0x44')]){_0x3f7312[_0xd0ff('0x3f')]=[{'all':!![]}];}_0x3f7312=_[_0xd0ff('0x3c')]({},_0x3f7312,_0x1c5b2e['options']);return db[_0xd0ff('0x2a')][_0xd0ff('0x45')](_0x3f7312)[_0xd0ff('0x24')](handleEntityNotFound(_0xde9281,null))[_0xd0ff('0x24')](respondWithResult(_0xde9281,null))[_0xd0ff('0x46')](handleError(_0xde9281,null));};exports[_0xd0ff('0x47')]=function(_0x173a40,_0x2ed46d){return db['FaxQueueReport'][_0xd0ff('0x47')](_0x173a40['body'],{})[_0xd0ff('0x24')](respondWithResult(_0x2ed46d,0xc9))['catch'](handleError(_0x2ed46d,null));};exports[_0xd0ff('0x22')]=function(_0x271cbb,_0x2be3ba){if(_0x271cbb[_0xd0ff('0x48')]['id']){delete _0x271cbb[_0xd0ff('0x48')]['id'];}return db['FaxQueueReport'][_0xd0ff('0x45')]({'where':{'id':_0x271cbb[_0xd0ff('0x43')]['id']}})[_0xd0ff('0x24')](handleEntityNotFound(_0x2be3ba,null))[_0xd0ff('0x24')](saveUpdates(_0x271cbb['body'],null))[_0xd0ff('0x24')](respondWithResult(_0x2be3ba,null))['catch'](handleError(_0x2be3ba,null));};exports[_0xd0ff('0x23')]=function(_0x8d4c51,_0xc16570){return db[_0xd0ff('0x2a')]['find']({'where':{'id':_0x8d4c51['params']['id']}})[_0xd0ff('0x24')](handleEntityNotFound(_0xc16570,null))['then'](removeEntity(_0xc16570,null))['catch'](handleError(_0xc16570,null));};exports[_0xd0ff('0x49')]=function(_0x456c3d,_0x37f696){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x37f696,null))[_0xd0ff('0x46')](handleError(_0x37f696,null));}; \ No newline at end of file +var _0x6b27=['catch','show','fields','includeAll','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','update','then','destroy','stack','name','send','FaxQueueReport','rawAttributes','fieldName','model','map','keys','filters','intersection','query','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x51704c,_0x403db8){var _0x1dc180=function(_0x37a4fc){while(--_0x37a4fc){_0x51704c['push'](_0x51704c['shift']());}};_0x1dc180(++_0x403db8);}(_0x6b27,0x176));var _0x76b2=function(_0x33ef32,_0x343b10){_0x33ef32=_0x33ef32-0x0;var _0x246b86=_0x6b27[_0x33ef32];return _0x246b86;};'use strict';var pdf=require(_0x76b2('0x0'));var emlformat=require(_0x76b2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x76b2('0x2'));var jsonpatch=require(_0x76b2('0x3'));var rp=require(_0x76b2('0x4'));var moment=require(_0x76b2('0x5'));var BPromise=require(_0x76b2('0x6'));var Mustache=require(_0x76b2('0x7'));var util=require(_0x76b2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x76b2('0x9'));var ejs=require(_0x76b2('0xa'));var fs=require('fs');var _=require(_0x76b2('0xb'));var squel=require(_0x76b2('0xc'));var crypto=require(_0x76b2('0xd'));var jsforce=require(_0x76b2('0xe'));var deskjs=require(_0x76b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x76b2('0x10'));var Papa=require('papaparse');var Redis=require(_0x76b2('0x11'));var authService=require(_0x76b2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x76b2('0x13'));var hardwareService=require(_0x76b2('0x14'));var logger=require(_0x76b2('0x15'))(_0x76b2('0x16'));var utils=require(_0x76b2('0x17'));var config=require(_0x76b2('0x18'));var db=require(_0x76b2('0x19'))['db'];function respondWithStatusCode(_0x47acbc,_0xbfd995){_0xbfd995=_0xbfd995||0xcc;return function(_0x2ee06d){if(_0x2ee06d){return _0x47acbc[_0x76b2('0x1a')](_0xbfd995);}return _0x47acbc[_0x76b2('0x1b')](_0xbfd995)[_0x76b2('0x1c')]();};}function respondWithResult(_0x5c52f7,_0x21a25b){_0x21a25b=_0x21a25b||0xc8;return function(_0x47abfa){if(_0x47abfa){return _0x5c52f7[_0x76b2('0x1b')](_0x21a25b)[_0x76b2('0x1d')](_0x47abfa);}};}function respondWithFilteredResult(_0x19ae97,_0xc574c8){return function(_0x11de21){if(_0x11de21){var _0x2f070a=_0x11de21[_0x76b2('0x1e')],_0x2429cb=_0xc574c8[_0x76b2('0x1f')],_0x237c0c=_0xc574c8[_0x76b2('0x1f')]+_0xc574c8['limit'],_0x51f39d;if(_0x237c0c>=_0x2f070a){_0x237c0c=_0x2f070a;_0x51f39d=0xc8;}else{_0x51f39d=0xce;}_0x19ae97[_0x76b2('0x1b')](_0x51f39d);return _0x19ae97['set']('Content-Range',_0x2429cb+'-'+_0x237c0c+'/'+_0x2f070a)['json'](_0x11de21);}return null;};}function patchUpdates(_0x248cb5){return function(_0x1c2e48){try{jsonpatch[_0x76b2('0x20')](_0x1c2e48,_0x248cb5,!![]);}catch(_0x3fb6b5){return BPromise[_0x76b2('0x21')](_0x3fb6b5);}return _0x1c2e48['save']();};}function saveUpdates(_0x5f06cd,_0x4bcaab){return function(_0x3dbfd8){if(_0x3dbfd8){return _0x3dbfd8[_0x76b2('0x22')](_0x5f06cd)[_0x76b2('0x23')](function(_0x5d4bb8){return _0x5d4bb8;});}return null;};}function removeEntity(_0x86813d,_0xfc929f){return function(_0x24df03){if(_0x24df03){return _0x24df03[_0x76b2('0x24')]()[_0x76b2('0x23')](function(){_0x86813d['status'](0xcc)[_0x76b2('0x1c')]();});}};}function handleEntityNotFound(_0x1f4ec1,_0x5424cf){return function(_0x3b7f12){if(!_0x3b7f12){_0x1f4ec1[_0x76b2('0x1a')](0x194);}return _0x3b7f12;};}function handleError(_0x59efc4,_0x1f5d4d){_0x1f5d4d=_0x1f5d4d||0x1f4;return function(_0x46930e){logger['error'](_0x46930e[_0x76b2('0x25')]);if(_0x46930e[_0x76b2('0x26')]){delete _0x46930e[_0x76b2('0x26')];}_0x59efc4[_0x76b2('0x1b')](_0x1f5d4d)[_0x76b2('0x27')](_0x46930e);};}exports['index']=function(_0xf9556,_0x4dd049){var _0x17f8f1={},_0x922f62={},_0x5a67d9={'count':0x0,'rows':[]};var _0x184ca6=_['map'](db[_0x76b2('0x28')][_0x76b2('0x29')],function(_0x312ab3){return{'name':_0x312ab3[_0x76b2('0x2a')],'type':_0x312ab3['type']['key']};});_0x922f62[_0x76b2('0x2b')]=_[_0x76b2('0x2c')](_0x184ca6,_0x76b2('0x26'));_0x922f62['query']=_[_0x76b2('0x2d')](_0xf9556['query']);_0x922f62[_0x76b2('0x2e')]=_[_0x76b2('0x2f')](_0x922f62[_0x76b2('0x2b')],_0x922f62[_0x76b2('0x30')]);_0x17f8f1['attributes']=_[_0x76b2('0x2f')](_0x922f62['model'],qs['fields'](_0xf9556['query']['fields']));_0x17f8f1[_0x76b2('0x31')]=_0x17f8f1[_0x76b2('0x31')][_0x76b2('0x32')]?_0x17f8f1[_0x76b2('0x31')]:_0x922f62['model'];if(!_0xf9556[_0x76b2('0x30')]['hasOwnProperty'](_0x76b2('0x33'))){_0x17f8f1[_0x76b2('0x34')]=qs['limit'](_0xf9556[_0x76b2('0x30')]['limit']);_0x17f8f1[_0x76b2('0x1f')]=qs['offset'](_0xf9556[_0x76b2('0x30')]['offset']);}_0x17f8f1[_0x76b2('0x35')]=qs[_0x76b2('0x36')](_0xf9556['query'][_0x76b2('0x36')]);_0x17f8f1[_0x76b2('0x37')]=qs[_0x76b2('0x2e')](_[_0x76b2('0x38')](_0xf9556[_0x76b2('0x30')],_0x922f62[_0x76b2('0x2e')]),_0x184ca6);if(_0xf9556[_0x76b2('0x30')][_0x76b2('0x39')]){_0x17f8f1['where']=_[_0x76b2('0x3a')](_0x17f8f1[_0x76b2('0x37')],{'$or':_[_0x76b2('0x2c')](_0x184ca6,function(_0x1624d0){if(_0x1624d0['type']!==_0x76b2('0x3b')){var _0x33e8dc={};_0x33e8dc[_0x1624d0[_0x76b2('0x26')]]={'$like':'%'+_0xf9556['query'][_0x76b2('0x39')]+'%'};return _0x33e8dc;}})});}_0x17f8f1=_['merge']({},_0x17f8f1,_0xf9556[_0x76b2('0x3c')]);var _0x159e11={'where':_0x17f8f1[_0x76b2('0x37')]};return db[_0x76b2('0x28')][_0x76b2('0x1e')](_0x159e11)['then'](function(_0x4dff65){_0x5a67d9[_0x76b2('0x1e')]=_0x4dff65;if(_0xf9556[_0x76b2('0x30')]['includeAll']){_0x17f8f1[_0x76b2('0x3d')]=[{'all':!![]}];}return db[_0x76b2('0x28')][_0x76b2('0x3e')](_0x17f8f1);})[_0x76b2('0x23')](function(_0x3e9f53){_0x5a67d9[_0x76b2('0x3f')]=_0x3e9f53;return _0x5a67d9;})[_0x76b2('0x23')](respondWithFilteredResult(_0x4dd049,_0x17f8f1))[_0x76b2('0x40')](handleError(_0x4dd049,null));};exports[_0x76b2('0x41')]=function(_0x22fcea,_0x2db6b9){var _0x372dce={'raw':!![],'where':{'id':_0x22fcea['params']['id']}},_0x19bb92={};_0x19bb92[_0x76b2('0x2b')]=_[_0x76b2('0x2d')](db['FaxQueueReport']['rawAttributes']);_0x19bb92['query']=_[_0x76b2('0x2d')](_0x22fcea[_0x76b2('0x30')]);_0x19bb92[_0x76b2('0x2e')]=_[_0x76b2('0x2f')](_0x19bb92[_0x76b2('0x2b')],_0x19bb92['query']);_0x372dce[_0x76b2('0x31')]=_[_0x76b2('0x2f')](_0x19bb92['model'],qs['fields'](_0x22fcea[_0x76b2('0x30')][_0x76b2('0x42')]));_0x372dce['attributes']=_0x372dce[_0x76b2('0x31')][_0x76b2('0x32')]?_0x372dce[_0x76b2('0x31')]:_0x19bb92[_0x76b2('0x2b')];if(_0x22fcea[_0x76b2('0x30')][_0x76b2('0x43')]){_0x372dce[_0x76b2('0x3d')]=[{'all':!![]}];}_0x372dce=_['merge']({},_0x372dce,_0x22fcea[_0x76b2('0x3c')]);return db[_0x76b2('0x28')][_0x76b2('0x44')](_0x372dce)['then'](handleEntityNotFound(_0x2db6b9,null))[_0x76b2('0x23')](respondWithResult(_0x2db6b9,null))[_0x76b2('0x40')](handleError(_0x2db6b9,null));};exports[_0x76b2('0x45')]=function(_0x220812,_0x397460){return db['FaxQueueReport'][_0x76b2('0x45')](_0x220812['body'],{})['then'](respondWithResult(_0x397460,0xc9))[_0x76b2('0x40')](handleError(_0x397460,null));};exports[_0x76b2('0x22')]=function(_0x37863a,_0x551caf){if(_0x37863a[_0x76b2('0x46')]['id']){delete _0x37863a[_0x76b2('0x46')]['id'];}return db[_0x76b2('0x28')][_0x76b2('0x44')]({'where':{'id':_0x37863a['params']['id']}})['then'](handleEntityNotFound(_0x551caf,null))['then'](saveUpdates(_0x37863a[_0x76b2('0x46')],null))[_0x76b2('0x23')](respondWithResult(_0x551caf,null))['catch'](handleError(_0x551caf,null));};exports[_0x76b2('0x24')]=function(_0x44f0c3,_0x264c8d){return db[_0x76b2('0x28')][_0x76b2('0x44')]({'where':{'id':_0x44f0c3[_0x76b2('0x47')]['id']}})[_0x76b2('0x23')](handleEntityNotFound(_0x264c8d,null))['then'](removeEntity(_0x264c8d,null))[_0x76b2('0x40')](handleError(_0x264c8d,null));};exports[_0x76b2('0x48')]=function(_0x459cd0,_0x4cde4a){return db[_0x76b2('0x28')][_0x76b2('0x48')]()[_0x76b2('0x23')](respondWithResult(_0x4cde4a,null))['catch'](handleError(_0x4cde4a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index bc51613..9c8e29c 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 _0x6d11=['exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','moment','request-promise','path','./faxQueueReport.attributes'];(function(_0x18bf71,_0x29dfd0){var _0x928504=function(_0x45f5fa){while(--_0x45f5fa){_0x18bf71['push'](_0x18bf71['shift']());}};_0x928504(++_0x29dfd0);}(_0x6d11,0xbf));var _0x16d1=function(_0x576e35,_0x36fbe4){_0x576e35=_0x576e35-0x0;var _0x2c870c=_0x6d11[_0x576e35];return _0x2c870c;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7524=['rimraf','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x7524,0xce));var _0x4752=function(_0x212659,_0x74c1f9){_0x212659=_0x212659-0x0;var _0x4736f5=_0x7524[_0x212659];return _0x4736f5;};'use strict';var _=require('lodash');var util=require(_0x4752('0x0'));var logger=require(_0x4752('0x1'))('api');var moment=require(_0x4752('0x2'));var BPromise=require(_0x4752('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4752('0x4'));var config=require('../../config/environment');var attributes=require(_0x4752('0x5'));module[_0x4752('0x6')]=function(_0x66a421,_0x55b411){return _0x66a421[_0x4752('0x7')]('FaxQueueReport',attributes,{'tableName':_0x4752('0x8'),'paranoid':![],'indexes':[{'name':_0x4752('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 48ad853..59021a7 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 _0x2e88=['body','options','debug','UpdateFaxQueueReport','update','raw','where','attributes','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x165d6d,_0x29eda1){var _0x164c91=function(_0x509a85){while(--_0x509a85){_0x165d6d['push'](_0x165d6d['shift']());}};_0x164c91(++_0x29eda1);}(_0x2e88,0x15e));var _0x82e8=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0x2e88[_0x4551f6];return _0x581dc2;};'use strict';var _=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x82e8('0x2'));var fs=require('fs');var Redis=require(_0x82e8('0x3'));var db=require(_0x82e8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82e8('0x5'))(_0x82e8('0x6'));var config=require(_0x82e8('0x7'));var jayson=require(_0x82e8('0x8'));var client=jayson[_0x82e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bb11b,_0x2a5f2b,_0x3f3cb5){return new BPromise(function(_0x1546be,_0x246ba0){return client[_0x82e8('0xa')](_0x4bb11b,_0x3f3cb5)[_0x82e8('0xb')](function(_0x452cab){logger[_0x82e8('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,'request\x20sent');logger['debug'](_0x82e8('0xd'),_0x2a5f2b,_0x82e8('0xe'),JSON[_0x82e8('0xf')](_0x452cab));if(_0x452cab[_0x82e8('0x10')]){if(_0x452cab[_0x82e8('0x10')][_0x82e8('0x11')]===0x1f4){logger[_0x82e8('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,_0x452cab['error'][_0x82e8('0x12')]);return _0x246ba0(_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);}logger[_0x82e8('0x10')](_0x82e8('0x13'),_0x2a5f2b,_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);return _0x1546be(_0x452cab[_0x82e8('0x10')][_0x82e8('0x12')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2a5f2b,_0x82e8('0xe'));_0x1546be(_0x452cab[_0x82e8('0x14')]['message']);}})['catch'](function(_0x3d9ee5){logger[_0x82e8('0x10')](_0x82e8('0x13'),_0x2a5f2b,_0x3d9ee5);_0x246ba0(_0x3d9ee5);});});}exports[_0x82e8('0x15')]=function(_0x2dedb7){var _0x51169b=this;return new Promise(function(_0xf00abe,_0x4d2ffb){return db[_0x82e8('0x16')][_0x82e8('0x17')](_0x2dedb7[_0x82e8('0x18')],{'raw':_0x2dedb7[_0x82e8('0x19')]?_0x2dedb7['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x408fec){logger[_0x82e8('0xc')]('CreateFaxQueueReport',_0x2dedb7);logger[_0x82e8('0x1a')](_0x82e8('0x15'),_0x2dedb7,JSON[_0x82e8('0xf')](_0x408fec));_0xf00abe(_0x408fec);})['catch'](function(_0x1c81ba){logger['error']('CreateFaxQueueReport',_0x1c81ba['message'],_0x2dedb7);_0x4d2ffb(_0x51169b['error'](0x1f4,_0x1c81ba[_0x82e8('0x12')]));});});};exports[_0x82e8('0x1b')]=function(_0x520d13){var _0x2bae1d=this;return new Promise(function(_0x40d8e4,_0x1f0cdc){return db[_0x82e8('0x16')][_0x82e8('0x1c')](_0x520d13[_0x82e8('0x18')],{'raw':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1e')]||null:null,'attributes':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x1f')]||null:null,'limit':_0x520d13[_0x82e8('0x19')]?_0x520d13[_0x82e8('0x19')][_0x82e8('0x20')]||null:null})[_0x82e8('0xb')](function(_0x3e1042){logger[_0x82e8('0xc')](_0x82e8('0x1b'),_0x520d13);logger[_0x82e8('0x1a')](_0x82e8('0x1b'),_0x520d13,JSON['stringify'](_0x3e1042));_0x40d8e4(_0x3e1042);})[_0x82e8('0x21')](function(_0x504ecb){logger[_0x82e8('0x10')]('UpdateFaxQueueReport',_0x504ecb[_0x82e8('0x12')],_0x520d13);_0x1f0cdc(_0x2bae1d['error'](0x1f4,_0x504ecb['message']));});});}; \ No newline at end of file +var _0x7eb6=['CreateFaxQueueReport','FaxQueueReport','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x7eb6,0x9f));var _0x67eb=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x7eb6[_0x1bd3ab];return _0x37e394;};'use strict';var _=require(_0x67eb('0x0'));var util=require(_0x67eb('0x1'));var moment=require('moment');var BPromise=require(_0x67eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67eb('0x3'));var db=require(_0x67eb('0x4'))['db'];var utils=require(_0x67eb('0x5'));var logger=require(_0x67eb('0x6'))(_0x67eb('0x7'));var config=require(_0x67eb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x67eb('0x9')][_0x67eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4169f7,_0x3913d5,_0x4510df){return new BPromise(function(_0x33eeca,_0x2ee380){return client['request'](_0x4169f7,_0x4510df)[_0x67eb('0xb')](function(_0x50e77c){logger[_0x67eb('0xc')](_0x67eb('0xd'),_0x3913d5,_0x67eb('0xe'));logger[_0x67eb('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x3913d5,_0x67eb('0xe'),JSON[_0x67eb('0x10')](_0x50e77c));if(_0x50e77c[_0x67eb('0x11')]){if(_0x50e77c[_0x67eb('0x11')]['code']===0x1f4){logger[_0x67eb('0x11')](_0x67eb('0xd'),_0x3913d5,_0x50e77c[_0x67eb('0x11')][_0x67eb('0x12')]);return _0x2ee380(_0x50e77c[_0x67eb('0x11')]['message']);}logger[_0x67eb('0x11')](_0x67eb('0xd'),_0x3913d5,_0x50e77c['error']['message']);return _0x33eeca(_0x50e77c[_0x67eb('0x11')][_0x67eb('0x12')]);}else{logger[_0x67eb('0xc')](_0x67eb('0xd'),_0x3913d5,'request\x20sent');_0x33eeca(_0x50e77c[_0x67eb('0x13')][_0x67eb('0x12')]);}})[_0x67eb('0x14')](function(_0xac1bd3){logger[_0x67eb('0x11')](_0x67eb('0xd'),_0x3913d5,_0xac1bd3);_0x2ee380(_0xac1bd3);});});}exports[_0x67eb('0x15')]=function(_0x4315a4){var _0x21ef63=this;return new Promise(function(_0x50cd82,_0x1fcdee){return db[_0x67eb('0x16')]['create'](_0x4315a4[_0x67eb('0x17')],{'raw':_0x4315a4['options']?_0x4315a4[_0x67eb('0x18')][_0x67eb('0x19')]===undefined?!![]:![]:!![]})[_0x67eb('0xb')](function(_0x13da35){logger['info'](_0x67eb('0x15'),_0x4315a4);logger['debug'](_0x67eb('0x15'),_0x4315a4,JSON[_0x67eb('0x10')](_0x13da35));_0x50cd82(_0x13da35);})['catch'](function(_0x3cb85c){logger[_0x67eb('0x11')](_0x67eb('0x15'),_0x3cb85c[_0x67eb('0x12')],_0x4315a4);_0x1fcdee(_0x21ef63['error'](0x1f4,_0x3cb85c[_0x67eb('0x12')]));});});};exports[_0x67eb('0x1a')]=function(_0x363aa7){var _0x566745=this;return new Promise(function(_0x59bb3b,_0x41b069){return db['FaxQueueReport'][_0x67eb('0x1b')](_0x363aa7['body'],{'raw':_0x363aa7['options']?_0x363aa7[_0x67eb('0x18')][_0x67eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x363aa7[_0x67eb('0x18')]?_0x363aa7[_0x67eb('0x18')][_0x67eb('0x1c')]||null:null,'attributes':_0x363aa7[_0x67eb('0x18')]?_0x363aa7[_0x67eb('0x18')]['attributes']||null:null,'limit':_0x363aa7[_0x67eb('0x18')]?_0x363aa7[_0x67eb('0x18')][_0x67eb('0x1d')]||null:null})[_0x67eb('0xb')](function(_0x11713d){logger['info'](_0x67eb('0x1a'),_0x363aa7);logger['debug'](_0x67eb('0x1a'),_0x363aa7,JSON[_0x67eb('0x10')](_0x11713d));_0x59bb3b(_0x11713d);})[_0x67eb('0x14')](function(_0x314b14){logger[_0x67eb('0x11')](_0x67eb('0x1a'),_0x314b14[_0x67eb('0x12')],_0x363aa7);_0x41b069(_0x566745[_0x67eb('0x11')](0x1f4,_0x314b14['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ee7c6fb..d8d07c2 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 _0xf444=['update','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','create','put'];(function(_0x11fd2b,_0x5c77b2){var _0x1d948c=function(_0x324cf1){while(--_0x324cf1){_0x11fd2b['push'](_0x11fd2b['shift']());}};_0x1d948c(++_0x5c77b2);}(_0xf444,0x17a));var _0x4f44=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf444[_0x47b58b];return _0x46bebe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f44('0x0'));var router=express[_0x4f44('0x1')]();var auth=require(_0x4f44('0x2'));var interaction=require(_0x4f44('0x3'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x4f44('0x4')]('/',auth[_0x4f44('0x5')](),controller[_0x4f44('0x6')]);router[_0x4f44('0x4')](_0x4f44('0x7'),auth[_0x4f44('0x5')](),controller[_0x4f44('0x8')]);router['get'](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller['show']);router['post']('/',auth[_0x4f44('0x5')](),controller[_0x4f44('0xa')]);router[_0x4f44('0xb')](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller[_0x4f44('0xc')]);router['delete'](_0x4f44('0x9'),auth[_0x4f44('0x5')](),controller[_0x4f44('0xd')]);module[_0x4f44('0xe')]=router; \ No newline at end of file +var _0xdb27=['put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./faxQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x571df0,_0x52749e){var _0x9b1a1b=function(_0x260ac7){while(--_0x260ac7){_0x571df0['push'](_0x571df0['shift']());}};_0x9b1a1b(++_0x52749e);}(_0xdb27,0x93));var _0x7db2=function(_0x3d3c3a,_0x10bedc){_0x3d3c3a=_0x3d3c3a-0x0;var _0x5b9c8e=_0xdb27[_0x3d3c3a];return _0x5b9c8e;};'use strict';var multer=require(_0x7db2('0x0'));var util=require(_0x7db2('0x1'));var path=require(_0x7db2('0x2'));var timeout=require(_0x7db2('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7db2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7db2('0x5'));var controller=require(_0x7db2('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7db2('0x7')]);router[_0x7db2('0x8')](_0x7db2('0x9'),auth[_0x7db2('0xa')](),controller[_0x7db2('0xb')]);router['get'](_0x7db2('0xc'),auth[_0x7db2('0xa')](),controller['show']);router[_0x7db2('0xd')]('/',auth[_0x7db2('0xa')](),controller[_0x7db2('0xe')]);router[_0x7db2('0xf')](_0x7db2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7db2('0x10')](_0x7db2('0xc'),auth[_0x7db2('0xa')](),controller[_0x7db2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 5bdf57a..6c781e7 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 _0xae40=['ENUM','account','agent','DATE','NOW','sequelize','exports','STRING'];(function(_0x4716b1,_0x1bb2b7){var _0x4f7045=function(_0x3bc1bb){while(--_0x3bc1bb){_0x4716b1['push'](_0x4716b1['shift']());}};_0x4f7045(++_0x1bb2b7);}(_0xae40,0xf5));var _0x0ae4=function(_0x2f8f78,_0x19c238){_0x2f8f78=_0x2f8f78-0x0;var _0x33c2d6=_0xae40[_0x2f8f78];return _0x33c2d6;};'use strict';var moment=require('moment');var Sequelize=require(_0x0ae4('0x0'));module[_0x0ae4('0x1')]={'uniqueid':{'type':Sequelize[_0x0ae4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ae4('0x3')](_0x0ae4('0x4'),_0x0ae4('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0ae4('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0ae4('0x7')]}}; \ No newline at end of file +var _0xa4d9=['account','exports','STRING','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa4d9,0xc9));var _0x9a4d=function(_0x2b0b96,_0x3ceb27){_0x2b0b96=_0x2b0b96-0x0;var _0x51a55d=_0xa4d9[_0x2b0b96];return _0x51a55d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9a4d('0x0')]={'uniqueid':{'type':Sequelize[_0x9a4d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9a4d('0x2')](_0x9a4d('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b9d7ac9..9c10900 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55d86b,_0x55a8cb){_0x55d86b=_0x55d86b-0x0;var _0x487cc8=_0x5f2f[_0x55d86b];return _0x487cc8;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file +var _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x2bb5b5,_0x1f8b95){var _0x4a44e0=function(_0x4662e9){while(--_0x4662e9){_0x2bb5b5['push'](_0x2bb5b5['shift']());}};_0x4a44e0(++_0x1f8b95);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 3591acc..deab169 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 _0xec08=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x5dac08,_0x4b11a1){var _0x1ad882=function(_0x3b2f3e){while(--_0x3b2f3e){_0x5dac08['push'](_0x5dac08['shift']());}};_0x1ad882(++_0x4b11a1);}(_0xec08,0xad));var _0x8ec0=function(_0x35e2e8,_0x1d90ec){_0x35e2e8=_0x35e2e8-0x0;var _0x4bc1d=_0xec08[_0x35e2e8];return _0x4bc1d;};'use strict';var _=require('lodash');var util=require(_0x8ec0('0x0'));var logger=require('../../config/logger')(_0x8ec0('0x1'));var moment=require(_0x8ec0('0x2'));var BPromise=require(_0x8ec0('0x3'));var rp=require(_0x8ec0('0x4'));var fs=require('fs');var path=require(_0x8ec0('0x5'));var rimraf=require(_0x8ec0('0x6'));var config=require(_0x8ec0('0x7'));var attributes=require(_0x8ec0('0x8'));module[_0x8ec0('0x9')]=function(_0xb911ef,_0x3e50c7){return _0xb911ef[_0x8ec0('0xa')](_0x8ec0('0xb'),attributes,{'tableName':_0x8ec0('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8ec0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5987=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x41a4bb,_0x36b115){var _0x4d4239=function(_0x572b5c){while(--_0x572b5c){_0x41a4bb['push'](_0x41a4bb['shift']());}};_0x4d4239(++_0x36b115);}(_0x5987,0x128));var _0x7598=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5987[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7598('0x0'));var util=require(_0x7598('0x1'));var logger=require(_0x7598('0x2'))(_0x7598('0x3'));var moment=require('moment');var BPromise=require(_0x7598('0x4'));var rp=require(_0x7598('0x5'));var fs=require('fs');var path=require(_0x7598('0x6'));var rimraf=require(_0x7598('0x7'));var config=require(_0x7598('0x8'));var attributes=require(_0x7598('0x9'));module[_0x7598('0xa')]=function(_0x56cc44,_0x1c78e){return _0x56cc44['define'](_0x7598('0xb'),attributes,{'tableName':_0x7598('0xc'),'paranoid':![],'indexes':[{'name':_0x7598('0xd'),'fields':[_0x7598('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index baf0177..28c6289 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 _0xe800=['jayson/promise','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe800,0xb7));var _0x0e80=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe800[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e80('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e80('0x1'));var db=require(_0x0e80('0x2'))['db'];var utils=require(_0x0e80('0x3'));var logger=require(_0x0e80('0x4'))(_0x0e80('0x5'));var config=require(_0x0e80('0x6'));var jayson=require(_0x0e80('0x7'));var client=jayson['client'][_0x0e80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x440c35,_0x346bcd,_0x2f0f41){return new BPromise(function(_0x45dde1,_0x5070a4){return client['request'](_0x440c35,_0x2f0f41)[_0x0e80('0x9')](function(_0x30db9c){logger[_0x0e80('0xa')](_0x0e80('0xb'),_0x346bcd,_0x0e80('0xc'));logger[_0x0e80('0xd')](_0x0e80('0xe'),_0x346bcd,'request\x20sent',JSON[_0x0e80('0xf')](_0x30db9c));if(_0x30db9c[_0x0e80('0x10')]){if(_0x30db9c['error'][_0x0e80('0x11')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x346bcd,_0x30db9c['error'][_0x0e80('0x12')]);return _0x5070a4(_0x30db9c[_0x0e80('0x10')]['message']);}logger[_0x0e80('0x10')](_0x0e80('0xb'),_0x346bcd,_0x30db9c[_0x0e80('0x10')][_0x0e80('0x12')]);return _0x45dde1(_0x30db9c[_0x0e80('0x10')][_0x0e80('0x12')]);}else{logger[_0x0e80('0xa')](_0x0e80('0xb'),_0x346bcd,'request\x20sent');_0x45dde1(_0x30db9c['result'][_0x0e80('0x12')]);}})['catch'](function(_0x37aed8){logger[_0x0e80('0x10')](_0x0e80('0xb'),_0x346bcd,_0x37aed8);_0x5070a4(_0x37aed8);});});} \ No newline at end of file +var _0xa23b=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xa23b,0x114));var _0xba23=function(_0x12f576,_0xd32564){_0x12f576=_0x12f576-0x0;var _0x1cb5a5=_0xa23b[_0x12f576];return _0x1cb5a5;};'use strict';var _=require(_0xba23('0x0'));var util=require('util');var moment=require(_0xba23('0x1'));var BPromise=require(_0xba23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba23('0x4'))(_0xba23('0x5'));var config=require(_0xba23('0x6'));var jayson=require(_0xba23('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5cc0c,_0x1fd945,_0x1db2e1){return new BPromise(function(_0x587398,_0x429dfc){return client[_0xba23('0x8')](_0xe5cc0c,_0x1db2e1)[_0xba23('0x9')](function(_0x385846){logger[_0xba23('0xa')](_0xba23('0xb'),_0x1fd945,'request\x20sent');logger['debug'](_0xba23('0xc'),_0x1fd945,_0xba23('0xd'),JSON[_0xba23('0xe')](_0x385846));if(_0x385846['error']){if(_0x385846['error'][_0xba23('0xf')]===0x1f4){logger[_0xba23('0x10')](_0xba23('0xb'),_0x1fd945,_0x385846['error']['message']);return _0x429dfc(_0x385846['error']['message']);}logger[_0xba23('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1fd945,_0x385846[_0xba23('0x10')][_0xba23('0x11')]);return _0x587398(_0x385846[_0xba23('0x10')]['message']);}else{logger['info'](_0xba23('0xb'),_0x1fd945,_0xba23('0xd'));_0x587398(_0x385846[_0xba23('0x12')][_0xba23('0x11')]);}})[_0xba23('0x13')](function(_0x25094c){logger[_0xba23('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x1fd945,_0x25094c);_0x429dfc(_0x25094c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1ec7202..04666a3 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 _0x49a7=['describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x552a40,_0x5d3c91){var _0x3164b8=function(_0x3fcb0c){while(--_0x3fcb0c){_0x552a40['push'](_0x552a40['shift']());}};_0x3164b8(++_0x5d3c91);}(_0x49a7,0x119));var _0x749a=function(_0x4f48d2,_0x4b30a6){_0x4f48d2=_0x4f48d2-0x0;var _0x219bf9=_0x49a7[_0x4f48d2];return _0x219bf9;};'use strict';var multer=require(_0x749a('0x0'));var util=require(_0x749a('0x1'));var path=require('path');var timeout=require(_0x749a('0x2'));var express=require(_0x749a('0x3'));var router=express[_0x749a('0x4')]();var auth=require(_0x749a('0x5'));var interaction=require(_0x749a('0x6'));var config=require(_0x749a('0x7'));var controller=require(_0x749a('0x8'));router[_0x749a('0x9')]('/',auth['isAuthenticated'](),controller[_0x749a('0xa')]);router[_0x749a('0x9')](_0x749a('0xb'),auth[_0x749a('0xc')](),controller[_0x749a('0xd')]);router[_0x749a('0x9')](_0x749a('0xe'),auth[_0x749a('0xc')](),controller[_0x749a('0xf')]);router[_0x749a('0x10')]('/',auth[_0x749a('0xc')](),controller['create']);router[_0x749a('0x11')](_0x749a('0xe'),auth[_0x749a('0xc')](),controller[_0x749a('0x12')]);router[_0x749a('0x13')]('/:id',auth[_0x749a('0xc')](),controller['destroy']);module[_0x749a('0x14')]=router; \ No newline at end of file +var _0xb95d=['get','isAuthenticated','index','/describe','show','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xb95d,0x198));var _0xdb95=function(_0x37ac10,_0xab13e3){_0x37ac10=_0x37ac10-0x0;var _0x39970d=_0xb95d[_0x37ac10];return _0x39970d;};'use strict';var multer=require(_0xdb95('0x0'));var util=require(_0xdb95('0x1'));var path=require(_0xdb95('0x2'));var timeout=require(_0xdb95('0x3'));var express=require(_0xdb95('0x4'));var router=express[_0xdb95('0x5')]();var auth=require(_0xdb95('0x6'));var interaction=require(_0xdb95('0x7'));var config=require(_0xdb95('0x8'));var controller=require(_0xdb95('0x9'));router[_0xdb95('0xa')]('/',auth[_0xdb95('0xb')](),controller[_0xdb95('0xc')]);router[_0xdb95('0xa')](_0xdb95('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xdb95('0xa')]('/:id',auth[_0xdb95('0xb')](),controller[_0xdb95('0xe')]);router[_0xdb95('0xf')]('/',auth[_0xdb95('0xb')](),controller[_0xdb95('0x10')]);router[_0xdb95('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xdb95('0x12')]);router[_0xdb95('0x13')](_0xdb95('0x14'),auth[_0xdb95('0xb')](),controller[_0xdb95('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5c31e6b..528400b 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 _0x3eea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5a0613,_0x4bac4c){var _0x3e7796=function(_0x2c8196){while(--_0x2c8196){_0x5a0613['push'](_0x5a0613['shift']());}};_0x3e7796(++_0x4bac4c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1d4b85,_0x3d86aa){_0x1d4b85=_0x1d4b85-0x0;var _0x5d0e7e=_0x3eea[_0x1d4b85];return _0x5d0e7e;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var auth=require(_0xa3ee('0x5'));var interaction=require(_0xa3ee('0x6'));var config=require(_0xa3ee('0x7'));var controller=require(_0xa3ee('0x8'));router[_0xa3ee('0x9')]('/',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xb')]);router['get']('/:id',auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0x9')]('/:id/configurations',auth[_0xa3ee('0xa')](),controller['getConfigurations']);router[_0xa3ee('0x9')]('/:id/fields',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0xc')]);router[_0xa3ee('0xd')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router[_0xa3ee('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')](_0xa3ee('0x11'),auth[_0xa3ee('0xa')](),controller['update']);router[_0xa3ee('0x12')]('/:id',auth[_0xa3ee('0xa')](),controller[_0xa3ee('0x13')]);module[_0xa3ee('0x14')]=router; \ No newline at end of file +var _0xa7e6=['express','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','create','post','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x248153,_0x3e682f){var _0x3d836a=function(_0x435319){while(--_0x435319){_0x248153['push'](_0x248153['shift']());}};_0x3d836a(++_0x3e682f);}(_0xa7e6,0x74));var _0x6a7e=function(_0x308c6a,_0xe04d64){_0x308c6a=_0x308c6a-0x0;var _0x257b4d=_0xa7e6[_0x308c6a];return _0x257b4d;};'use strict';var multer=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var path=require(_0x6a7e('0x2'));var timeout=require(_0x6a7e('0x3'));var express=require(_0x6a7e('0x4'));var router=express[_0x6a7e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a7e('0x6'));var config=require(_0x6a7e('0x7'));var controller=require(_0x6a7e('0x8'));router[_0x6a7e('0x9')]('/',auth[_0x6a7e('0xa')](),controller['index']);router[_0x6a7e('0x9')](_0x6a7e('0xb'),auth[_0x6a7e('0xa')](),controller[_0x6a7e('0xc')]);router[_0x6a7e('0x9')](_0x6a7e('0xd'),auth[_0x6a7e('0xa')](),controller[_0x6a7e('0xe')]);router[_0x6a7e('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x6a7e('0xa')](),controller[_0x6a7e('0xf')]);router[_0x6a7e('0x10')](_0x6a7e('0xd'),auth[_0x6a7e('0xa')](),controller['addConfiguration']);router[_0x6a7e('0x11')](_0x6a7e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6a7e('0x12')](_0x6a7e('0xb'),auth[_0x6a7e('0xa')](),controller[_0x6a7e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a5019d6..1420650 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 _0x16ff=['exports','STRING','basic','ENUM','integrationTab','newTab','sequelize'];(function(_0x17dcb2,_0x92191a){var _0x1262d4=function(_0x572661){while(--_0x572661){_0x17dcb2['push'](_0x17dcb2['shift']());}};_0x1262d4(++_0x92191a);}(_0x16ff,0x8b));var _0xf16f=function(_0x4ca4ef,_0x9e82fa){_0x4ca4ef=_0x4ca4ef-0x0;var _0x3e9f35=_0x16ff[_0x4ca4ef];return _0x3e9f35;};'use strict';var Sequelize=require(_0xf16f('0x0'));module[_0xf16f('0x1')]={'name':{'type':Sequelize[_0xf16f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf16f('0x2')]},'remoteUri':{'type':Sequelize[_0xf16f('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xf16f('0x3')),'defaultValue':_0xf16f('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf16f('0x2')]},'consumerSecret':{'type':Sequelize[_0xf16f('0x2')]},'token':{'type':Sequelize[_0xf16f('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf16f('0x4')](_0xf16f('0x5'),_0xf16f('0x6')),'defaultValue':_0xf16f('0x5')}}; \ No newline at end of file +var _0x2d73=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2d73,0x13e));var _0x32d7=function(_0x3dda0f,_0x5b9902){_0x3dda0f=_0x3dda0f-0x0;var _0x1b0488=_0x2d73[_0x3dda0f];return _0x1b0488;};'use strict';var Sequelize=require(_0x32d7('0x0'));module[_0x32d7('0x1')]={'name':{'type':Sequelize[_0x32d7('0x2')]},'description':{'type':Sequelize[_0x32d7('0x2')]},'username':{'type':Sequelize[_0x32d7('0x2')]},'remoteUri':{'type':Sequelize[_0x32d7('0x2')]},'authType':{'type':Sequelize[_0x32d7('0x3')](_0x32d7('0x4')),'defaultValue':_0x32d7('0x4')},'password':{'type':Sequelize[_0x32d7('0x2')]},'consumerKey':{'type':Sequelize[_0x32d7('0x2')]},'consumerSecret':{'type':Sequelize[_0x32d7('0x2')]},'token':{'type':Sequelize[_0x32d7('0x2')]},'tokenSecret':{'type':Sequelize[_0x32d7('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x32d7('0x3')](_0x32d7('0x5'),_0x32d7('0x6')),'defaultValue':_0x32d7('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1635304..dfb646a 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 _0x6bc4=['apply','save','update','then','destroy','end','stack','send','map','DeskAccount','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','fields','includeAll','find','create','body','params','getConfigurations','DeskConfiguration','nolimit','Subjects','getSubjects','channel','getDescriptions','DeskField','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','toString','base64','concat','label','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json'];(function(_0x4bb19c,_0x154418){var _0x4bc00d=function(_0x12b906){while(--_0x12b906){_0x4bb19c['push'](_0x4bb19c['shift']());}};_0x4bc00d(++_0x154418);}(_0x6bc4,0xc6));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x46bc('0x0'));var emlformat=require(_0x46bc('0x1'));var rimraf=require(_0x46bc('0x2'));var zipdir=require(_0x46bc('0x3'));var jsonpatch=require(_0x46bc('0x4'));var rp=require(_0x46bc('0x5'));var moment=require(_0x46bc('0x6'));var BPromise=require(_0x46bc('0x7'));var Mustache=require('mustache');var util=require(_0x46bc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x46bc('0x9'));var ejs=require(_0x46bc('0xa'));var fs=require('fs');var _=require(_0x46bc('0xb'));var squel=require(_0x46bc('0xc'));var crypto=require(_0x46bc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x46bc('0xe'));var toCsv=require(_0x46bc('0x9'));var querystring=require(_0x46bc('0xf'));var Papa=require(_0x46bc('0x10'));var Redis=require(_0x46bc('0x11'));var authService=require(_0x46bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x46bc('0x13'));var hardwareService=require(_0x46bc('0x14'));var logger=require(_0x46bc('0x15'))(_0x46bc('0x16'));var utils=require(_0x46bc('0x17'));var config=require('../../config/environment');var db=require(_0x46bc('0x18'))['db'];var integrations=require(_0x46bc('0x19'));var jayson=require(_0x46bc('0x1a'));var client=jayson[_0x46bc('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x4fa982,_0x2e87f8,_0x6d6bae){if(_0x6d6bae){var _0x6f96a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f96a5[_0x46bc('0x1c')](_0x2e87f8)){return _0x4fa982;}else{throw new db['Sequelize']['ValidationError'](_0x46bc('0x1d'));}}else{return _0x4fa982;}}function respondWithRpcPromise(_0x368292,_0x51fc85,_0x376343,_0x40650a){return new BPromise(function(_0x5a4bff,_0x338d72){var _0x2594c4=_0x40650a||client;return _0x2594c4[_0x46bc('0x1e')](_0x368292,_0x376343)['then'](function(_0x35780c){logger[_0x46bc('0x1f')](_0x46bc('0x20'),_0x51fc85,'request\x20sent');logger['debug'](_0x46bc('0x21'),_0x51fc85,_0x46bc('0x22'),JSON['stringify'](_0x35780c));if(_0x35780c[_0x46bc('0x23')]){if(_0x35780c['error'][_0x46bc('0x24')]===0x1f4){logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x35780c[_0x46bc('0x23')][_0x46bc('0x25')]);return _0x338d72(_0x35780c[_0x46bc('0x23')]['message']);}logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x35780c['error'][_0x46bc('0x25')]);return _0x5a4bff(_0x35780c[_0x46bc('0x23')][_0x46bc('0x25')]);}else{logger['info'](_0x46bc('0x20'),_0x51fc85,_0x46bc('0x22'));_0x5a4bff(_0x35780c[_0x46bc('0x26')][_0x46bc('0x25')]);}})[_0x46bc('0x27')](function(_0x290ec4){logger[_0x46bc('0x23')](_0x46bc('0x20'),_0x51fc85,_0x290ec4);_0x338d72(_0x290ec4);});});}function respondWithStatusCode(_0x3db2a,_0x12ef35){_0x12ef35=_0x12ef35||0xcc;return function(_0x2911b6){if(_0x2911b6){return _0x3db2a[_0x46bc('0x28')](_0x12ef35);}return _0x3db2a[_0x46bc('0x29')](_0x12ef35)['end']();};}function respondWithResult(_0x26604c,_0x3d7d87){_0x3d7d87=_0x3d7d87||0xc8;return function(_0x267e9e){if(_0x267e9e){return _0x26604c[_0x46bc('0x29')](_0x3d7d87)['json'](_0x267e9e);}};}function respondWithFilteredResult(_0x9f6bf,_0x411809){return function(_0x52768a){if(_0x52768a){var _0x479cbe=_0x52768a[_0x46bc('0x2a')],_0xcd5c83=_0x411809[_0x46bc('0x2b')],_0xb8cf1d=_0x411809[_0x46bc('0x2b')]+_0x411809[_0x46bc('0x2c')],_0x24ac79;if(_0xb8cf1d>=_0x479cbe){_0xb8cf1d=_0x479cbe;_0x24ac79=0xc8;}else{_0x24ac79=0xce;}_0x9f6bf[_0x46bc('0x29')](_0x24ac79);return _0x9f6bf[_0x46bc('0x2d')](_0x46bc('0x2e'),_0xcd5c83+'-'+_0xb8cf1d+'/'+_0x479cbe)[_0x46bc('0x2f')](_0x52768a);}return null;};}function patchUpdates(_0x12a943){return function(_0x22f0b0){try{jsonpatch[_0x46bc('0x30')](_0x22f0b0,_0x12a943,!![]);}catch(_0x3bb604){return BPromise['reject'](_0x3bb604);}return _0x22f0b0[_0x46bc('0x31')]();};}function saveUpdates(_0x1cdcaf,_0x1d32d4){return function(_0x5dbbc2){if(_0x5dbbc2){return _0x5dbbc2[_0x46bc('0x32')](_0x1cdcaf)[_0x46bc('0x33')](function(_0x187ba7){return _0x187ba7;});}return null;};}function removeEntity(_0x5d1037,_0x236cae){return function(_0xed404a){if(_0xed404a){return _0xed404a[_0x46bc('0x34')]()[_0x46bc('0x33')](function(){_0x5d1037[_0x46bc('0x29')](0xcc)[_0x46bc('0x35')]();});}};}function handleEntityNotFound(_0x10837b,_0x140e8d){return function(_0x26640f){if(!_0x26640f){_0x10837b[_0x46bc('0x28')](0x194);}return _0x26640f;};}function handleError(_0x4339b7,_0x30f481){_0x30f481=_0x30f481||0x1f4;return function(_0x59b313){logger['error'](_0x59b313[_0x46bc('0x36')]);if(_0x59b313['name']){delete _0x59b313['name'];}_0x4339b7['status'](_0x30f481)[_0x46bc('0x37')](_0x59b313);};}exports['index']=function(_0x59926f,_0x5c5cc1){var _0x3a6b88={},_0x177ed1={},_0x3e8412={'count':0x0,'rows':[]};var _0x27a0ba=_[_0x46bc('0x38')](db[_0x46bc('0x39')][_0x46bc('0x3a')],function(_0x2d5bd2){return{'name':_0x2d5bd2[_0x46bc('0x3b')],'type':_0x2d5bd2[_0x46bc('0x3c')][_0x46bc('0x3d')]};});_0x177ed1['model']=_[_0x46bc('0x38')](_0x27a0ba,_0x46bc('0x3e'));_0x177ed1[_0x46bc('0x3f')]=_['keys'](_0x59926f[_0x46bc('0x3f')]);_0x177ed1[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x177ed1['model'],_0x177ed1[_0x46bc('0x3f')]);_0x3a6b88[_0x46bc('0x42')]=_[_0x46bc('0x41')](_0x177ed1[_0x46bc('0x43')],qs['fields'](_0x59926f[_0x46bc('0x3f')]['fields']));_0x3a6b88[_0x46bc('0x42')]=_0x3a6b88[_0x46bc('0x42')][_0x46bc('0x44')]?_0x3a6b88[_0x46bc('0x42')]:_0x177ed1[_0x46bc('0x43')];if(!_0x59926f[_0x46bc('0x3f')][_0x46bc('0x45')]('nolimit')){_0x3a6b88['limit']=qs[_0x46bc('0x2c')](_0x59926f['query'][_0x46bc('0x2c')]);_0x3a6b88['offset']=qs[_0x46bc('0x2b')](_0x59926f['query'][_0x46bc('0x2b')]);}_0x3a6b88[_0x46bc('0x46')]=qs[_0x46bc('0x47')](_0x59926f[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x3a6b88[_0x46bc('0x48')]=qs['filters'](_[_0x46bc('0x49')](_0x59926f['query'],_0x177ed1[_0x46bc('0x40')]),_0x27a0ba);if(_0x59926f[_0x46bc('0x3f')][_0x46bc('0x4a')]){_0x3a6b88[_0x46bc('0x48')]=_[_0x46bc('0x4b')](_0x3a6b88[_0x46bc('0x48')],{'$or':_[_0x46bc('0x38')](_0x27a0ba,function(_0x38c30e){if(_0x38c30e[_0x46bc('0x3c')]!==_0x46bc('0x4c')){var _0xa6490={};_0xa6490[_0x38c30e[_0x46bc('0x3e')]]={'$like':'%'+_0x59926f['query'][_0x46bc('0x4a')]+'%'};return _0xa6490;}})});}_0x3a6b88=_[_0x46bc('0x4b')]({},_0x3a6b88,_0x59926f[_0x46bc('0x4d')]);var _0xb7265={'where':_0x3a6b88[_0x46bc('0x48')]};return db[_0x46bc('0x39')][_0x46bc('0x2a')](_0xb7265)[_0x46bc('0x33')](function(_0x1b5bd9){_0x3e8412[_0x46bc('0x2a')]=_0x1b5bd9;if(_0x59926f['query']['includeAll']){_0x3a6b88['include']=[{'all':!![]}];}return db['DeskAccount'][_0x46bc('0x4e')](_0x3a6b88);})[_0x46bc('0x33')](function(_0x21c9e7){_0x3e8412[_0x46bc('0x4f')]=_0x21c9e7;return _0x3e8412;})[_0x46bc('0x33')](respondWithFilteredResult(_0x5c5cc1,_0x3a6b88))[_0x46bc('0x27')](handleError(_0x5c5cc1,null));};exports[_0x46bc('0x50')]=function(_0x135a5d,_0x4fa88f){var _0x4e76d0={'raw':![],'where':{'id':_0x135a5d['params']['id']}},_0x56f3b7={};_0x56f3b7[_0x46bc('0x43')]=_[_0x46bc('0x51')](db[_0x46bc('0x39')][_0x46bc('0x3a')]);_0x56f3b7[_0x46bc('0x3f')]=_['keys'](_0x135a5d['query']);_0x56f3b7[_0x46bc('0x40')]=_[_0x46bc('0x41')](_0x56f3b7[_0x46bc('0x43')],_0x56f3b7['query']);_0x4e76d0[_0x46bc('0x42')]=_['intersection'](_0x56f3b7[_0x46bc('0x43')],qs['fields'](_0x135a5d[_0x46bc('0x3f')][_0x46bc('0x52')]));_0x4e76d0[_0x46bc('0x42')]=_0x4e76d0[_0x46bc('0x42')][_0x46bc('0x44')]?_0x4e76d0[_0x46bc('0x42')]:_0x56f3b7[_0x46bc('0x43')];if(_0x135a5d[_0x46bc('0x3f')][_0x46bc('0x53')]){_0x4e76d0['include']=[{'all':!![]}];}_0x4e76d0=_[_0x46bc('0x4b')]({},_0x4e76d0,_0x135a5d[_0x46bc('0x4d')]);return db[_0x46bc('0x39')][_0x46bc('0x54')](_0x4e76d0)[_0x46bc('0x33')](handleEntityNotFound(_0x4fa88f,null))[_0x46bc('0x33')](respondWithResult(_0x4fa88f,null))[_0x46bc('0x27')](handleError(_0x4fa88f,null));};exports[_0x46bc('0x55')]=function(_0x4852e5,_0x517b39){return db[_0x46bc('0x39')][_0x46bc('0x55')](_0x4852e5[_0x46bc('0x56')],{})['then'](respondWithResult(_0x517b39,0xc9))[_0x46bc('0x27')](handleError(_0x517b39,null));};exports[_0x46bc('0x32')]=function(_0x2e0762,_0x411b36){if(_0x2e0762[_0x46bc('0x56')]['id']){delete _0x2e0762['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x2e0762[_0x46bc('0x57')]['id']}})['then'](handleEntityNotFound(_0x411b36,null))['then'](saveUpdates(_0x2e0762[_0x46bc('0x56')],null))[_0x46bc('0x33')](respondWithResult(_0x411b36,null))[_0x46bc('0x27')](handleError(_0x411b36,null));};exports[_0x46bc('0x34')]=function(_0x2b97ca,_0x506dc5){return db[_0x46bc('0x39')][_0x46bc('0x54')]({'where':{'id':_0x2b97ca['params']['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x506dc5,null))[_0x46bc('0x33')](removeEntity(_0x506dc5,null))[_0x46bc('0x27')](handleError(_0x506dc5,null));};exports[_0x46bc('0x58')]=function(_0x21a9a7,_0x55dc3d,_0x11896b){var _0x1b9ae0={};var _0x1c7a06={};var _0x4b594e;var _0x46ec40;return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x21a9a7[_0x46bc('0x57')]['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x55dc3d,null))[_0x46bc('0x33')](function(_0x47187d){if(_0x47187d){_0x4b594e=_0x47187d;_0x1c7a06[_0x46bc('0x43')]=_[_0x46bc('0x51')](db[_0x46bc('0x59')]['rawAttributes']);_0x1c7a06[_0x46bc('0x3f')]=_['keys'](_0x21a9a7[_0x46bc('0x3f')]);_0x1c7a06[_0x46bc('0x40')]=_['intersection'](_0x1c7a06['model'],_0x1c7a06[_0x46bc('0x3f')]);_0x1b9ae0['attributes']=_[_0x46bc('0x41')](_0x1c7a06[_0x46bc('0x43')],qs[_0x46bc('0x52')](_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x52')]));_0x1b9ae0['attributes']=_0x1b9ae0[_0x46bc('0x42')][_0x46bc('0x44')]?_0x1b9ae0['attributes']:_0x1c7a06[_0x46bc('0x43')];_0x1b9ae0['order']=qs[_0x46bc('0x47')](_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x47')]);_0x1b9ae0[_0x46bc('0x48')]=qs[_0x46bc('0x40')](_[_0x46bc('0x49')](_0x21a9a7[_0x46bc('0x3f')],_0x1c7a06['filters']));if(_0x21a9a7[_0x46bc('0x3f')][_0x46bc('0x4a')]){_0x1b9ae0[_0x46bc('0x48')]=_[_0x46bc('0x4b')](_0x1b9ae0[_0x46bc('0x48')],{'$or':_[_0x46bc('0x38')](_0x1b9ae0[_0x46bc('0x42')],function(_0x4edfc9){var _0x178cd7={};_0x178cd7[_0x4edfc9]={'$like':'%'+_0x21a9a7['query'][_0x46bc('0x4a')]+'%'};return _0x178cd7;})});}_0x1b9ae0=_[_0x46bc('0x4b')]({},_0x1b9ae0,_0x21a9a7[_0x46bc('0x4d')]);return _0x4b594e[_0x46bc('0x58')](_0x1b9ae0);}})[_0x46bc('0x33')](function(_0x3c0520){if(_0x3c0520){_0x46ec40=_0x3c0520[_0x46bc('0x44')];if(!_0x21a9a7['query'][_0x46bc('0x45')](_0x46bc('0x5a'))){_0x1b9ae0[_0x46bc('0x2c')]=qs['limit'](_0x21a9a7['query'][_0x46bc('0x2c')]);_0x1b9ae0[_0x46bc('0x2b')]=qs[_0x46bc('0x2b')](_0x21a9a7['query'][_0x46bc('0x2b')]);}return _0x4b594e[_0x46bc('0x58')](_0x1b9ae0);}})[_0x46bc('0x33')](function(_0x4d7a38){if(_0x4d7a38){return _0x4d7a38?{'count':_0x46ec40,'rows':_0x4d7a38}:null;}})[_0x46bc('0x33')](respondWithResult(_0x55dc3d,null))['catch'](handleError(_0x55dc3d,null));};exports['addConfiguration']=function(_0x404498,_0x2021e6,_0x2ec578){if(_0x404498[_0x46bc('0x56')]['id']){delete _0x404498[_0x46bc('0x56')]['id'];}return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x404498['params']['id']}})[_0x46bc('0x33')](handleEntityNotFound(_0x2021e6,null))[_0x46bc('0x33')](function(_0x2966e3){if(_0x2966e3){_0x404498[_0x46bc('0x56')]['AccountId']=_0x2966e3['id'];_0x404498['body'][_0x46bc('0x5b')]=integrations[_0x46bc('0x5c')](_0x404498[_0x46bc('0x56')][_0x46bc('0x5d')],_0x404498[_0x46bc('0x56')][_0x46bc('0x3c')]);_0x404498[_0x46bc('0x56')]['Descriptions']=integrations[_0x46bc('0x5e')](_0x404498[_0x46bc('0x56')][_0x46bc('0x5d')],_0x404498['body'][_0x46bc('0x3c')]);return db[_0x46bc('0x59')][_0x46bc('0x55')](_0x404498[_0x46bc('0x56')],{'include':[{'model':db[_0x46bc('0x5f')],'as':_0x46bc('0x5b')},{'model':db[_0x46bc('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2021e6,null))[_0x46bc('0x27')](handleError(_0x2021e6,null));};exports['getFields']=function(_0x1b318b,_0x5ea97f,_0x2b5c84){var _0x33cffd=[{'name':'priority','label':_0x46bc('0x60'),'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 _0x39e661='';return db[_0x46bc('0x39')]['findOne']({'where':{'id':_0x1b318b[_0x46bc('0x57')]['id']},'attributes':['id','remoteUri',_0x46bc('0x61'),_0x46bc('0x62'),_0x46bc('0x63'),_0x46bc('0x64'),_0x46bc('0x65'),_0x46bc('0x66'),_0x46bc('0x67')]})[_0x46bc('0x33')](handleEntityNotFound(_0x5ea97f,null))[_0x46bc('0x33')](function(_0x4eb227){if(_0x4eb227){_0x39e661=_0x4eb227[_0x46bc('0x68')];var _0x4dd3d6=_0x39e661[_0x46bc('0x69')](-0x1);if(_0x4dd3d6==='/'){_0x39e661=_0x39e661[_0x46bc('0x6a')](0x0,_0x39e661['lastIndexOf'](_0x4dd3d6));}var _0x27ab48={'method':_0x46bc('0x6b'),'uri':util[_0x46bc('0x6c')](_0x46bc('0x6d'),_0x39e661),'headers':{'Content-Type':'application/json','Accept':_0x46bc('0x6e')},'json':!![]};if(_0x4eb227[_0x46bc('0x61')]===_0x46bc('0x6f')){_0x27ab48['headers'][_0x46bc('0x70')]=util[_0x46bc('0x6c')](_0x46bc('0x71'),new Buffer(util[_0x46bc('0x6c')]('%s:%s',_0x4eb227[_0x46bc('0x62')],_0x4eb227[_0x46bc('0x63')]))[_0x46bc('0x72')](_0x46bc('0x73')));}return rp(_0x27ab48)[_0x46bc('0x33')](function(_0x57a0c1){return _0x33cffd[_0x46bc('0x74')](_[_0x46bc('0x38')](_0x57a0c1['_embedded']['entries'],function(_0x5281fa){return{'id':_0x5281fa['name'],'name':_0x5281fa[_0x46bc('0x3e')],'type':_0x5281fa[_0x46bc('0x3c')],'active':_0x5281fa['active'],'label':_0x5281fa[_0x46bc('0x75')],'custom':!![]};}));});}})[_0x46bc('0x33')](function(_0x5d9d9e){return{'count':_0x5d9d9e[_0x46bc('0x44')],'rows':_0x5d9d9e};})[_0x46bc('0x33')](respondWithResult(_0x5ea97f,null))['catch'](function(_0x5a0580){var _0xcc475e=_0x1b318b['query'][_0x46bc('0x1c')]?0x1f4:_0x5a0580['statusCode']||0x1f4;logger[_0x46bc('0x23')](_0x46bc('0x76'),_0x46bc('0x77'),_0xcc475e,JSON[_0x46bc('0x78')](_0x5a0580));delete _0x5a0580[_0x46bc('0x3e')];if(_0xcc475e===0x191){_0xcc475e=0x190;}_0x5ea97f[_0x46bc('0x29')](_0xcc475e)[_0x46bc('0x37')](_0x1b318b['query'][_0x46bc('0x1c')]?{'message':_0x46bc('0x79'),'statusCode':_0x5a0580[_0x46bc('0x7a')]}:_0x5a0580);});}; \ No newline at end of file +var _0x972c=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x370627,_0x2ba63d){var _0x391d54=function(_0x254205){while(--_0x254205){_0x370627['push'](_0x370627['shift']());}};_0x391d54(++_0x2ba63d);}(_0x972c,0x1aa));var _0xc972=function(_0x29ba76,_0x485cad){_0x29ba76=_0x29ba76-0x0;var _0xf92e6d=_0x972c[_0x29ba76];return _0xf92e6d;};'use strict';var pdf=require(_0xc972('0x0'));var emlformat=require(_0xc972('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc972('0x2'));var jsonpatch=require(_0xc972('0x3'));var rp=require(_0xc972('0x4'));var moment=require(_0xc972('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc972('0x6'));var path=require(_0xc972('0x7'));var sox=require(_0xc972('0x8'));var csv=require(_0xc972('0x9'));var ejs=require(_0xc972('0xa'));var fs=require('fs');var _=require(_0xc972('0xb'));var squel=require(_0xc972('0xc'));var crypto=require(_0xc972('0xd'));var jsforce=require(_0xc972('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc972('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc972('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc972('0x11'))(_0xc972('0x12'));var utils=require(_0xc972('0x13'));var config=require(_0xc972('0x14'));var db=require(_0xc972('0x15'))['db'];var integrations=require(_0xc972('0x16'));var jayson=require(_0xc972('0x17'));var client=jayson[_0xc972('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5a7b44,_0xf98339,_0x578a74){if(_0x578a74){var _0x459b55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x459b55[_0xc972('0x19')](_0xf98339)){return _0x5a7b44;}else{throw new db['Sequelize'][(_0xc972('0x1a'))](_0xc972('0x1b'));}}else{return _0x5a7b44;}}function respondWithRpcPromise(_0x1a381c,_0x5d527a,_0x24358f,_0x40ceb3){return new BPromise(function(_0x4b3713,_0x2592b7){var _0x429e41=_0x40ceb3||client;return _0x429e41[_0xc972('0x1c')](_0x1a381c,_0x24358f)[_0xc972('0x1d')](function(_0xcf8f59){logger[_0xc972('0x1e')](_0xc972('0x1f'),_0x5d527a,_0xc972('0x20'));logger[_0xc972('0x21')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5d527a,'request\x20sent',JSON[_0xc972('0x22')](_0xcf8f59));if(_0xcf8f59[_0xc972('0x23')]){if(_0xcf8f59[_0xc972('0x23')][_0xc972('0x24')]===0x1f4){logger[_0xc972('0x23')](_0xc972('0x1f'),_0x5d527a,_0xcf8f59[_0xc972('0x23')][_0xc972('0x25')]);return _0x2592b7(_0xcf8f59['error'][_0xc972('0x25')]);}logger[_0xc972('0x23')]('DeskAccount,\x20%s,\x20%s',_0x5d527a,_0xcf8f59[_0xc972('0x23')][_0xc972('0x25')]);return _0x4b3713(_0xcf8f59[_0xc972('0x23')]['message']);}else{logger[_0xc972('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x5d527a,_0xc972('0x20'));_0x4b3713(_0xcf8f59[_0xc972('0x26')][_0xc972('0x25')]);}})['catch'](function(_0xa52ed6){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5d527a,_0xa52ed6);_0x2592b7(_0xa52ed6);});});}function respondWithStatusCode(_0x122132,_0x4090ee){_0x4090ee=_0x4090ee||0xcc;return function(_0xf6e763){if(_0xf6e763){return _0x122132[_0xc972('0x27')](_0x4090ee);}return _0x122132[_0xc972('0x28')](_0x4090ee)[_0xc972('0x29')]();};}function respondWithResult(_0x34d46c,_0xb7f3c2){_0xb7f3c2=_0xb7f3c2||0xc8;return function(_0x48e63f){if(_0x48e63f){return _0x34d46c[_0xc972('0x28')](_0xb7f3c2)[_0xc972('0x2a')](_0x48e63f);}};}function respondWithFilteredResult(_0x2ba166,_0x1eaa8d){return function(_0x5cebc6){if(_0x5cebc6){var _0x3f0639=_0x5cebc6['count'],_0x40e7ce=_0x1eaa8d[_0xc972('0x2b')],_0x3912e4=_0x1eaa8d[_0xc972('0x2b')]+_0x1eaa8d[_0xc972('0x2c')],_0x452c30;if(_0x3912e4>=_0x3f0639){_0x3912e4=_0x3f0639;_0x452c30=0xc8;}else{_0x452c30=0xce;}_0x2ba166[_0xc972('0x28')](_0x452c30);return _0x2ba166['set'](_0xc972('0x2d'),_0x40e7ce+'-'+_0x3912e4+'/'+_0x3f0639)['json'](_0x5cebc6);}return null;};}function patchUpdates(_0x217629){return function(_0x31460e){try{jsonpatch[_0xc972('0x2e')](_0x31460e,_0x217629,!![]);}catch(_0x306255){return BPromise['reject'](_0x306255);}return _0x31460e['save']();};}function saveUpdates(_0x1d6673,_0x22d5a1){return function(_0x3afa9d){if(_0x3afa9d){return _0x3afa9d[_0xc972('0x2f')](_0x1d6673)[_0xc972('0x1d')](function(_0x3d0fe2){return _0x3d0fe2;});}return null;};}function removeEntity(_0x22bde4,_0xf7302d){return function(_0x46ddec){if(_0x46ddec){return _0x46ddec['destroy']()[_0xc972('0x1d')](function(){_0x22bde4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x506245,_0xe9b89a){return function(_0x5b0849){if(!_0x5b0849){_0x506245[_0xc972('0x27')](0x194);}return _0x5b0849;};}function handleError(_0x45f385,_0x176093){_0x176093=_0x176093||0x1f4;return function(_0x442300){logger['error'](_0x442300['stack']);if(_0x442300[_0xc972('0x30')]){delete _0x442300['name'];}_0x45f385['status'](_0x176093)[_0xc972('0x31')](_0x442300);};}exports[_0xc972('0x32')]=function(_0x1fc58c,_0x2dded0){var _0x3b339b={},_0x557d4d={},_0x52b733={'count':0x0,'rows':[]};var _0x5c06ad=_[_0xc972('0x33')](db[_0xc972('0x34')][_0xc972('0x35')],function(_0x2357a9){return{'name':_0x2357a9[_0xc972('0x36')],'type':_0x2357a9[_0xc972('0x37')][_0xc972('0x38')]};});_0x557d4d[_0xc972('0x39')]=_['map'](_0x5c06ad,_0xc972('0x30'));_0x557d4d[_0xc972('0x3a')]=_['keys'](_0x1fc58c['query']);_0x557d4d[_0xc972('0x3b')]=_[_0xc972('0x3c')](_0x557d4d[_0xc972('0x39')],_0x557d4d[_0xc972('0x3a')]);_0x3b339b[_0xc972('0x3d')]=_[_0xc972('0x3c')](_0x557d4d[_0xc972('0x39')],qs[_0xc972('0x3e')](_0x1fc58c['query'][_0xc972('0x3e')]));_0x3b339b[_0xc972('0x3d')]=_0x3b339b['attributes'][_0xc972('0x3f')]?_0x3b339b[_0xc972('0x3d')]:_0x557d4d['model'];if(!_0x1fc58c[_0xc972('0x3a')][_0xc972('0x40')](_0xc972('0x41'))){_0x3b339b['limit']=qs[_0xc972('0x2c')](_0x1fc58c['query']['limit']);_0x3b339b['offset']=qs[_0xc972('0x2b')](_0x1fc58c[_0xc972('0x3a')][_0xc972('0x2b')]);}_0x3b339b['order']=qs[_0xc972('0x42')](_0x1fc58c['query'][_0xc972('0x42')]);_0x3b339b[_0xc972('0x43')]=qs[_0xc972('0x3b')](_[_0xc972('0x44')](_0x1fc58c[_0xc972('0x3a')],_0x557d4d['filters']),_0x5c06ad);if(_0x1fc58c[_0xc972('0x3a')][_0xc972('0x45')]){_0x3b339b[_0xc972('0x43')]=_[_0xc972('0x46')](_0x3b339b['where'],{'$or':_[_0xc972('0x33')](_0x5c06ad,function(_0xe4ac01){if(_0xe4ac01[_0xc972('0x37')]!==_0xc972('0x47')){var _0x42f488={};_0x42f488[_0xe4ac01[_0xc972('0x30')]]={'$like':'%'+_0x1fc58c[_0xc972('0x3a')][_0xc972('0x45')]+'%'};return _0x42f488;}})});}_0x3b339b=_['merge']({},_0x3b339b,_0x1fc58c[_0xc972('0x48')]);var _0x45265e={'where':_0x3b339b['where']};return db['DeskAccount'][_0xc972('0x49')](_0x45265e)[_0xc972('0x1d')](function(_0x649305){_0x52b733[_0xc972('0x49')]=_0x649305;if(_0x1fc58c['query'][_0xc972('0x4a')]){_0x3b339b[_0xc972('0x4b')]=[{'all':!![]}];}return db['DeskAccount'][_0xc972('0x4c')](_0x3b339b);})[_0xc972('0x1d')](function(_0x38913a){_0x52b733[_0xc972('0x4d')]=_0x38913a;return _0x52b733;})[_0xc972('0x1d')](respondWithFilteredResult(_0x2dded0,_0x3b339b))[_0xc972('0x4e')](handleError(_0x2dded0,null));};exports['show']=function(_0x2d48a5,_0x376a1a){var _0x2c40fb={'raw':![],'where':{'id':_0x2d48a5[_0xc972('0x4f')]['id']}},_0xc2c07a={};_0xc2c07a[_0xc972('0x39')]=_['keys'](db['DeskAccount'][_0xc972('0x35')]);_0xc2c07a[_0xc972('0x3a')]=_[_0xc972('0x50')](_0x2d48a5[_0xc972('0x3a')]);_0xc2c07a[_0xc972('0x3b')]=_[_0xc972('0x3c')](_0xc2c07a[_0xc972('0x39')],_0xc2c07a[_0xc972('0x3a')]);_0x2c40fb[_0xc972('0x3d')]=_['intersection'](_0xc2c07a[_0xc972('0x39')],qs[_0xc972('0x3e')](_0x2d48a5['query']['fields']));_0x2c40fb['attributes']=_0x2c40fb['attributes'][_0xc972('0x3f')]?_0x2c40fb[_0xc972('0x3d')]:_0xc2c07a[_0xc972('0x39')];if(_0x2d48a5[_0xc972('0x3a')][_0xc972('0x4a')]){_0x2c40fb[_0xc972('0x4b')]=[{'all':!![]}];}_0x2c40fb=_['merge']({},_0x2c40fb,_0x2d48a5['options']);return db[_0xc972('0x34')][_0xc972('0x51')](_0x2c40fb)[_0xc972('0x1d')](handleEntityNotFound(_0x376a1a,null))[_0xc972('0x1d')](respondWithResult(_0x376a1a,null))[_0xc972('0x4e')](handleError(_0x376a1a,null));};exports[_0xc972('0x52')]=function(_0x2f13c4,_0x339c15){return db[_0xc972('0x34')][_0xc972('0x52')](_0x2f13c4[_0xc972('0x53')],{})[_0xc972('0x1d')](respondWithResult(_0x339c15,0xc9))[_0xc972('0x4e')](handleError(_0x339c15,null));};exports['update']=function(_0x40a065,_0x40f36e){if(_0x40a065[_0xc972('0x53')]['id']){delete _0x40a065[_0xc972('0x53')]['id'];}return db[_0xc972('0x34')][_0xc972('0x51')]({'where':{'id':_0x40a065[_0xc972('0x4f')]['id']}})[_0xc972('0x1d')](handleEntityNotFound(_0x40f36e,null))[_0xc972('0x1d')](saveUpdates(_0x40a065[_0xc972('0x53')],null))['then'](respondWithResult(_0x40f36e,null))[_0xc972('0x4e')](handleError(_0x40f36e,null));};exports[_0xc972('0x54')]=function(_0x3abe5f,_0x19e80a){return db[_0xc972('0x34')][_0xc972('0x51')]({'where':{'id':_0x3abe5f[_0xc972('0x4f')]['id']}})[_0xc972('0x1d')](handleEntityNotFound(_0x19e80a,null))[_0xc972('0x1d')](removeEntity(_0x19e80a,null))[_0xc972('0x4e')](handleError(_0x19e80a,null));};exports[_0xc972('0x55')]=function(_0x32fd04,_0x3d3638,_0x20b6a0){var _0x1d5607={};var _0x4766f9={};var _0x366c50;var _0x16b22b;return db[_0xc972('0x34')][_0xc972('0x56')]({'where':{'id':_0x32fd04[_0xc972('0x4f')]['id']}})[_0xc972('0x1d')](handleEntityNotFound(_0x3d3638,null))[_0xc972('0x1d')](function(_0x5d345e){if(_0x5d345e){_0x366c50=_0x5d345e;_0x4766f9['model']=_['keys'](db[_0xc972('0x57')][_0xc972('0x35')]);_0x4766f9[_0xc972('0x3a')]=_[_0xc972('0x50')](_0x32fd04[_0xc972('0x3a')]);_0x4766f9[_0xc972('0x3b')]=_['intersection'](_0x4766f9[_0xc972('0x39')],_0x4766f9[_0xc972('0x3a')]);_0x1d5607[_0xc972('0x3d')]=_['intersection'](_0x4766f9[_0xc972('0x39')],qs[_0xc972('0x3e')](_0x32fd04[_0xc972('0x3a')][_0xc972('0x3e')]));_0x1d5607['attributes']=_0x1d5607['attributes'][_0xc972('0x3f')]?_0x1d5607[_0xc972('0x3d')]:_0x4766f9[_0xc972('0x39')];_0x1d5607[_0xc972('0x58')]=qs[_0xc972('0x42')](_0x32fd04[_0xc972('0x3a')][_0xc972('0x42')]);_0x1d5607[_0xc972('0x43')]=qs[_0xc972('0x3b')](_[_0xc972('0x44')](_0x32fd04[_0xc972('0x3a')],_0x4766f9[_0xc972('0x3b')]));if(_0x32fd04['query'][_0xc972('0x45')]){_0x1d5607[_0xc972('0x43')]=_[_0xc972('0x46')](_0x1d5607[_0xc972('0x43')],{'$or':_[_0xc972('0x33')](_0x1d5607[_0xc972('0x3d')],function(_0x1e022c){var _0x333e9b={};_0x333e9b[_0x1e022c]={'$like':'%'+_0x32fd04[_0xc972('0x3a')][_0xc972('0x45')]+'%'};return _0x333e9b;})});}_0x1d5607=_[_0xc972('0x46')]({},_0x1d5607,_0x32fd04[_0xc972('0x48')]);return _0x366c50['getConfigurations'](_0x1d5607);}})['then'](function(_0x4fdaaa){if(_0x4fdaaa){_0x16b22b=_0x4fdaaa[_0xc972('0x3f')];if(!_0x32fd04[_0xc972('0x3a')]['hasOwnProperty'](_0xc972('0x41'))){_0x1d5607[_0xc972('0x2c')]=qs['limit'](_0x32fd04['query']['limit']);_0x1d5607[_0xc972('0x2b')]=qs[_0xc972('0x2b')](_0x32fd04[_0xc972('0x3a')][_0xc972('0x2b')]);}return _0x366c50[_0xc972('0x55')](_0x1d5607);}})[_0xc972('0x1d')](function(_0x46a16a){if(_0x46a16a){return _0x46a16a?{'count':_0x16b22b,'rows':_0x46a16a}:null;}})[_0xc972('0x1d')](respondWithResult(_0x3d3638,null))[_0xc972('0x4e')](handleError(_0x3d3638,null));};exports[_0xc972('0x59')]=function(_0x107606,_0x5e6d38,_0x54cbc0){if(_0x107606[_0xc972('0x53')]['id']){delete _0x107606['body']['id'];}return db['DeskAccount'][_0xc972('0x56')]({'where':{'id':_0x107606['params']['id']}})[_0xc972('0x1d')](handleEntityNotFound(_0x5e6d38,null))[_0xc972('0x1d')](function(_0x558e5e){if(_0x558e5e){_0x107606[_0xc972('0x53')]['AccountId']=_0x558e5e['id'];_0x107606[_0xc972('0x53')]['Subjects']=integrations['getSubjects'](_0x107606['body'][_0xc972('0x5a')],_0x107606['body'][_0xc972('0x37')]);_0x107606['body'][_0xc972('0x5b')]=integrations[_0xc972('0x5c')](_0x107606[_0xc972('0x53')]['channel'],_0x107606['body'][_0xc972('0x37')]);return db[_0xc972('0x57')]['create'](_0x107606[_0xc972('0x53')],{'include':[{'model':db[_0xc972('0x5d')],'as':'Subjects'},{'model':db[_0xc972('0x5d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5e6d38,null))[_0xc972('0x4e')](handleError(_0x5e6d38,null));};exports['getFields']=function(_0x55a72f,_0x39b5fb,_0x232e5f){var _0x16b80b=[{'name':'priority','label':_0xc972('0x5e'),'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 _0x20e5b8='';return db[_0xc972('0x34')][_0xc972('0x56')]({'where':{'id':_0x55a72f[_0xc972('0x4f')]['id']},'attributes':['id',_0xc972('0x5f'),_0xc972('0x60'),_0xc972('0x61'),_0xc972('0x62'),_0xc972('0x63'),_0xc972('0x64'),'token',_0xc972('0x65')]})[_0xc972('0x1d')](handleEntityNotFound(_0x39b5fb,null))['then'](function(_0x105983){if(_0x105983){_0x20e5b8=_0x105983[_0xc972('0x5f')];var _0x36102c=_0x20e5b8['slice'](-0x1);if(_0x36102c==='/'){_0x20e5b8=_0x20e5b8[_0xc972('0x66')](0x0,_0x20e5b8[_0xc972('0x67')](_0x36102c));}var _0x1543f6={'method':_0xc972('0x68'),'uri':util[_0xc972('0x69')](_0xc972('0x6a'),_0x20e5b8),'headers':{'Content-Type':_0xc972('0x6b'),'Accept':_0xc972('0x6b')},'json':!![]};if(_0x105983['authType']===_0xc972('0x6c')){_0x1543f6[_0xc972('0x6d')][_0xc972('0x6e')]=util[_0xc972('0x69')](_0xc972('0x6f'),new Buffer(util[_0xc972('0x69')](_0xc972('0x70'),_0x105983['username'],_0x105983[_0xc972('0x62')]))[_0xc972('0x71')]('base64'));}return rp(_0x1543f6)[_0xc972('0x1d')](function(_0xfdf72e){return _0x16b80b[_0xc972('0x72')](_[_0xc972('0x33')](_0xfdf72e[_0xc972('0x73')][_0xc972('0x74')],function(_0x3bd29e){return{'id':_0x3bd29e[_0xc972('0x30')],'name':_0x3bd29e[_0xc972('0x30')],'type':_0x3bd29e[_0xc972('0x37')],'active':_0x3bd29e['active'],'label':_0x3bd29e[_0xc972('0x75')],'custom':!![]};}));});}})[_0xc972('0x1d')](function(_0xfac61c){return{'count':_0xfac61c[_0xc972('0x3f')],'rows':_0xfac61c};})[_0xc972('0x1d')](respondWithResult(_0x39b5fb,null))['catch'](function(_0x2da132){var _0x192336=_0x55a72f[_0xc972('0x3a')]['test']?0x1f4:_0x2da132[_0xc972('0x76')]||0x1f4;logger['error'](_0xc972('0x77'),_0xc972('0x78'),_0x192336,JSON[_0xc972('0x22')](_0x2da132));delete _0x2da132[_0xc972('0x30')];if(_0x192336===0x191){_0x192336=0x190;}_0x39b5fb[_0xc972('0x28')](_0x192336)[_0xc972('0x31')](_0x55a72f[_0xc972('0x3a')][_0xc972('0x19')]?{'message':_0xc972('0x79'),'statusCode':_0x2da132[_0xc972('0x76')]}:_0x2da132);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5394678..b85891e 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 _0x4832=['util','../../config/logger','api','moment','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash'];(function(_0x496013,_0x34865a){var _0x419838=function(_0x177a7b){while(--_0x177a7b){_0x496013['push'](_0x496013['shift']());}};_0x419838(++_0x34865a);}(_0x4832,0x12b));var _0x2483=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x4832[_0x24cc72];return _0xd49f1e;};'use strict';var _=require(_0x2483('0x0'));var util=require(_0x2483('0x1'));var logger=require(_0x2483('0x2'))(_0x2483('0x3'));var moment=require(_0x2483('0x4'));var BPromise=require('bluebird');var rp=require(_0x2483('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2483('0x6'));var attributes=require(_0x2483('0x7'));var integrations=require(_0x2483('0x8'));module[_0x2483('0x9')]=function(_0x309728,_0x174e9f){return _0x309728['define'](_0x2483('0xa'),attributes,{'tableName':_0x2483('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebb1=['define','int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x4be4e6,_0x36a64e){var _0x340c2b=function(_0x3db29b){while(--_0x3db29b){_0x4be4e6['push'](_0x4be4e6['shift']());}};_0x340c2b(++_0x36a64e);}(_0xebb1,0x1d8));var _0x1ebb=function(_0x341b0e,_0x47c6ad){_0x341b0e=_0x341b0e-0x0;var _0x3d0956=_0xebb1[_0x341b0e];return _0x3d0956;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require(_0x1ebb('0x2'))(_0x1ebb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ebb('0x4'));var fs=require('fs');var path=require(_0x1ebb('0x5'));var rimraf=require('rimraf');var config=require(_0x1ebb('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1ebb('0x7')]=function(_0x18d8b4,_0x2e8e0a){return _0x18d8b4[_0x1ebb('0x8')]('DeskAccount',attributes,{'tableName':_0x1ebb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 07762aa..24aa476 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 _0xc771=['stringify','error','code','DeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug'];(function(_0x1cd267,_0x3c432d){var _0x1f5c90=function(_0x430400){while(--_0x430400){_0x1cd267['push'](_0x1cd267['shift']());}};_0x1f5c90(++_0x3c432d);}(_0xc771,0x1ef));var _0x1c77=function(_0x4c351c,_0x358a56){_0x4c351c=_0x4c351c-0x0;var _0xc76f5d=_0xc771[_0x4c351c];return _0xc76f5d;};'use strict';var _=require(_0x1c77('0x0'));var util=require(_0x1c77('0x1'));var moment=require('moment');var BPromise=require(_0x1c77('0x2'));var rs=require(_0x1c77('0x3'));var fs=require('fs');var Redis=require(_0x1c77('0x4'));var db=require(_0x1c77('0x5'))['db'];var utils=require(_0x1c77('0x6'));var logger=require(_0x1c77('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c77('0x8'));var client=jayson[_0x1c77('0x9')][_0x1c77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x149922,_0xee59f7,_0x4a8b58){return new BPromise(function(_0x1aaf7e,_0x35404e){return client[_0x1c77('0xb')](_0x149922,_0x4a8b58)[_0x1c77('0xc')](function(_0x59bc82){logger[_0x1c77('0xd')]('DeskAccount,\x20%s,\x20%s',_0xee59f7,'request\x20sent');logger[_0x1c77('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xee59f7,'request\x20sent',JSON[_0x1c77('0xf')](_0x59bc82));if(_0x59bc82[_0x1c77('0x10')]){if(_0x59bc82['error'][_0x1c77('0x11')]===0x1f4){logger['error'](_0x1c77('0x12'),_0xee59f7,_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);return _0x35404e(_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);}logger[_0x1c77('0x10')]('DeskAccount,\x20%s,\x20%s',_0xee59f7,_0x59bc82[_0x1c77('0x10')]['message']);return _0x1aaf7e(_0x59bc82[_0x1c77('0x10')][_0x1c77('0x13')]);}else{logger['info'](_0x1c77('0x12'),_0xee59f7,_0x1c77('0x14'));_0x1aaf7e(_0x59bc82[_0x1c77('0x15')]['message']);}})[_0x1c77('0x16')](function(_0xeaf11){logger['error']('DeskAccount,\x20%s,\x20%s',_0xee59f7,_0xeaf11);_0x35404e(_0xeaf11);});});}exports[_0x1c77('0x17')]=function(_0x4c5d2a){var _0x483724=this;return new Promise(function(_0x24317f,_0x4361ef){return db[_0x1c77('0x18')]['findAll']({'raw':_0x4c5d2a['options']?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1b')]||null:null,'attributes':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1c')]||null:null,'limit':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')]['limit']||null:null,'include':_0x4c5d2a[_0x1c77('0x19')]?_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x4c5d2a[_0x1c77('0x19')][_0x1c77('0x1d')],function(_0x1430fc){return{'model':db[_0x1430fc['model']],'as':_0x1430fc['as'],'attributes':_0x1430fc[_0x1c77('0x1c')],'include':_0x1430fc[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x1430fc[_0x1c77('0x1d')],function(_0x4bc824){return{'model':db[_0x4bc824['model']],'as':_0x4bc824['as'],'attributes':_0x4bc824['attributes'],'include':_0x4bc824[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x4bc824['include'],function(_0x5337e8){return{'model':db[_0x5337e8[_0x1c77('0x1f')]],'as':_0x5337e8['as'],'attributes':_0x5337e8[_0x1c77('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c77('0xc')](function(_0x3af54c){logger['info'](_0x1c77('0x17'),_0x4c5d2a);logger[_0x1c77('0xe')](_0x1c77('0x17'),_0x4c5d2a,JSON[_0x1c77('0xf')](_0x3af54c));_0x24317f(_0x3af54c);})[_0x1c77('0x16')](function(_0x2993d){logger['error'](_0x1c77('0x17'),_0x2993d[_0x1c77('0x13')],_0x4c5d2a);_0x4361ef(_0x483724[_0x1c77('0x10')](0x1f4,_0x2993d[_0x1c77('0x13')]));});});};exports[_0x1c77('0x20')]=function(_0x2f00bf){var _0x42e22d=this;return new Promise(function(_0x222022,_0x4e56fd){return db['DeskAccount'][_0x1c77('0x21')]({'raw':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')][_0x1c77('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')]['where']||null:null,'attributes':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')][_0x1c77('0x1c')]||null:null,'include':_0x2f00bf[_0x1c77('0x19')]?_0x2f00bf[_0x1c77('0x19')]['include']?_[_0x1c77('0x1e')](_0x2f00bf[_0x1c77('0x19')]['include'],function(_0x262917){return{'model':db[_0x262917[_0x1c77('0x1f')]],'as':_0x262917['as'],'attributes':_0x262917[_0x1c77('0x1c')],'include':_0x262917[_0x1c77('0x1d')]?_['map'](_0x262917['include'],function(_0x2fed6e){return{'model':db[_0x2fed6e[_0x1c77('0x1f')]],'as':_0x2fed6e['as'],'attributes':_0x2fed6e[_0x1c77('0x1c')],'include':_0x2fed6e[_0x1c77('0x1d')]?_[_0x1c77('0x1e')](_0x2fed6e[_0x1c77('0x1d')],function(_0x283524){return{'model':db[_0x283524[_0x1c77('0x1f')]],'as':_0x283524['as'],'attributes':_0x283524[_0x1c77('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c77('0xc')](function(_0x2bf319){logger[_0x1c77('0xd')]('ShowDeskAccount',_0x2f00bf);logger['debug'](_0x1c77('0x20'),_0x2f00bf,JSON[_0x1c77('0xf')](_0x2bf319));_0x222022(_0x2bf319);})['catch'](function(_0x38eb62){logger['error']('ShowDeskAccount',_0x38eb62['message'],_0x2f00bf);_0x4e56fd(_0x42e22d[_0x1c77('0x10')](0x1f4,_0x38eb62[_0x1c77('0x13')]));});});}; \ No newline at end of file +var _0xdf39=['options','raw','where','attributes','limit','map','include','model','GetDeskAccount','ShowDeskAccount','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','info','catch','DeskAccount','findAll'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xdf39,0x149));var _0x9df3=function(_0x481e8d,_0x36aedb){_0x481e8d=_0x481e8d-0x0;var _0x79e7cc=_0xdf39[_0x481e8d];return _0x79e7cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9df3('0x0'));var rs=require(_0x9df3('0x1'));var fs=require('fs');var Redis=require(_0x9df3('0x2'));var db=require(_0x9df3('0x3'))['db'];var utils=require(_0x9df3('0x4'));var logger=require(_0x9df3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9df3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3aeb3b,_0x5f1060,_0xa46700){return new BPromise(function(_0x3ede09,_0x329379){return client[_0x9df3('0x7')](_0x3aeb3b,_0xa46700)[_0x9df3('0x8')](function(_0x333a7d){logger['info'](_0x9df3('0x9'),_0x5f1060,_0x9df3('0xa'));logger[_0x9df3('0xb')](_0x9df3('0xc'),_0x5f1060,_0x9df3('0xa'),JSON['stringify'](_0x333a7d));if(_0x333a7d[_0x9df3('0xd')]){if(_0x333a7d['error']['code']===0x1f4){logger[_0x9df3('0xd')]('DeskAccount,\x20%s,\x20%s',_0x5f1060,_0x333a7d[_0x9df3('0xd')][_0x9df3('0xe')]);return _0x329379(_0x333a7d[_0x9df3('0xd')][_0x9df3('0xe')]);}logger['error'](_0x9df3('0x9'),_0x5f1060,_0x333a7d['error'][_0x9df3('0xe')]);return _0x3ede09(_0x333a7d[_0x9df3('0xd')][_0x9df3('0xe')]);}else{logger[_0x9df3('0xf')](_0x9df3('0x9'),_0x5f1060,_0x9df3('0xa'));_0x3ede09(_0x333a7d['result'][_0x9df3('0xe')]);}})[_0x9df3('0x10')](function(_0x3ef3b1){logger['error'](_0x9df3('0x9'),_0x5f1060,_0x3ef3b1);_0x329379(_0x3ef3b1);});});}exports['GetDeskAccount']=function(_0x78a1f1){var _0x1c6842=this;return new Promise(function(_0x89d080,_0x18c252){return db[_0x9df3('0x11')][_0x9df3('0x12')]({'raw':_0x78a1f1[_0x9df3('0x13')]?_0x78a1f1[_0x9df3('0x13')][_0x9df3('0x14')]===undefined?!![]:![]:!![],'where':_0x78a1f1['options']?_0x78a1f1[_0x9df3('0x13')][_0x9df3('0x15')]||null:null,'attributes':_0x78a1f1[_0x9df3('0x13')]?_0x78a1f1[_0x9df3('0x13')][_0x9df3('0x16')]||null:null,'limit':_0x78a1f1['options']?_0x78a1f1[_0x9df3('0x13')][_0x9df3('0x17')]||null:null,'include':_0x78a1f1[_0x9df3('0x13')]?_0x78a1f1[_0x9df3('0x13')]['include']?_[_0x9df3('0x18')](_0x78a1f1[_0x9df3('0x13')][_0x9df3('0x19')],function(_0x27cf9b){return{'model':db[_0x27cf9b['model']],'as':_0x27cf9b['as'],'attributes':_0x27cf9b[_0x9df3('0x16')],'include':_0x27cf9b[_0x9df3('0x19')]?_[_0x9df3('0x18')](_0x27cf9b[_0x9df3('0x19')],function(_0x40f120){return{'model':db[_0x40f120[_0x9df3('0x1a')]],'as':_0x40f120['as'],'attributes':_0x40f120[_0x9df3('0x16')],'include':_0x40f120['include']?_[_0x9df3('0x18')](_0x40f120[_0x9df3('0x19')],function(_0x40fd9c){return{'model':db[_0x40fd9c['model']],'as':_0x40fd9c['as'],'attributes':_0x40fd9c[_0x9df3('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9df3('0x8')](function(_0x1f687c){logger[_0x9df3('0xf')](_0x9df3('0x1b'),_0x78a1f1);logger[_0x9df3('0xb')](_0x9df3('0x1b'),_0x78a1f1,JSON['stringify'](_0x1f687c));_0x89d080(_0x1f687c);})[_0x9df3('0x10')](function(_0x5ef909){logger[_0x9df3('0xd')]('GetDeskAccount',_0x5ef909[_0x9df3('0xe')],_0x78a1f1);_0x18c252(_0x1c6842['error'](0x1f4,_0x5ef909[_0x9df3('0xe')]));});});};exports[_0x9df3('0x1c')]=function(_0xd8919a){var _0x36ea37=this;return new Promise(function(_0x736e67,_0x3188c3){return db[_0x9df3('0x11')]['find']({'raw':_0xd8919a['options']?_0xd8919a[_0x9df3('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xd8919a[_0x9df3('0x13')]?_0xd8919a[_0x9df3('0x13')][_0x9df3('0x15')]||null:null,'attributes':_0xd8919a[_0x9df3('0x13')]?_0xd8919a[_0x9df3('0x13')][_0x9df3('0x16')]||null:null,'include':_0xd8919a[_0x9df3('0x13')]?_0xd8919a['options']['include']?_[_0x9df3('0x18')](_0xd8919a[_0x9df3('0x13')][_0x9df3('0x19')],function(_0x313793){return{'model':db[_0x313793[_0x9df3('0x1a')]],'as':_0x313793['as'],'attributes':_0x313793[_0x9df3('0x16')],'include':_0x313793[_0x9df3('0x19')]?_['map'](_0x313793['include'],function(_0x8811af){return{'model':db[_0x8811af['model']],'as':_0x8811af['as'],'attributes':_0x8811af[_0x9df3('0x16')],'include':_0x8811af[_0x9df3('0x19')]?_[_0x9df3('0x18')](_0x8811af[_0x9df3('0x19')],function(_0x49d66b){return{'model':db[_0x49d66b[_0x9df3('0x1a')]],'as':_0x49d66b['as'],'attributes':_0x49d66b[_0x9df3('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2343b6){logger[_0x9df3('0xf')](_0x9df3('0x1c'),_0xd8919a);logger[_0x9df3('0xb')]('ShowDeskAccount',_0xd8919a,JSON['stringify'](_0x2343b6));_0x736e67(_0x2343b6);})[_0x9df3('0x10')](function(_0x1a3e3b){logger[_0x9df3('0xd')](_0x9df3('0x1c'),_0x1a3e3b[_0x9df3('0xe')],_0xd8919a);_0x3188c3(_0x36ea37[_0x9df3('0xd')](0x1f4,_0x1a3e3b[_0x9df3('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 833ef24..00d9840 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 _0x4ccb=['isAuthenticated','index','get','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller'];(function(_0x5bc57b,_0x7698b4){var _0x56333f=function(_0x336303){while(--_0x336303){_0x5bc57b['push'](_0x5bc57b['shift']());}};_0x56333f(++_0x7698b4);}(_0x4ccb,0x196));var _0xb4cc=function(_0x5eb2d2,_0x1d0d80){_0x5eb2d2=_0x5eb2d2-0x0;var _0x566859=_0x4ccb[_0x5eb2d2];return _0x566859;};'use strict';var multer=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var path=require(_0xb4cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xb4cc('0x3'));var router=express[_0xb4cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb4cc('0x5'));var config=require(_0xb4cc('0x6'));var controller=require(_0xb4cc('0x7'));router['get']('/',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x9')]);router[_0xb4cc('0xa')]('/:id',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xb')]);router[_0xb4cc('0xa')]('/:id/fields',auth[_0xb4cc('0x8')](),controller[_0xb4cc('0xc')]);router[_0xb4cc('0xa')](_0xb4cc('0xd'),auth[_0xb4cc('0x8')](),controller['getSubjects']);router[_0xb4cc('0xa')](_0xb4cc('0xe'),auth['isAuthenticated'](),controller[_0xb4cc('0xf')]);router['get'](_0xb4cc('0x10'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb4cc('0x12')]);router['post']('/:id/tags',auth[_0xb4cc('0x8')](),controller['setTags']);router['put'](_0xb4cc('0x13'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x14')]);router['delete'](_0xb4cc('0x13'),auth[_0xb4cc('0x8')](),controller[_0xb4cc('0x15')]);module[_0xb4cc('0x16')]=router; \ No newline at end of file +var _0x4d68=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','delete','destroy'];(function(_0x347044,_0x3f4099){var _0x5d0309=function(_0x458fef){while(--_0x458fef){_0x347044['push'](_0x347044['shift']());}};_0x5d0309(++_0x3f4099);}(_0x4d68,0x1c3));var _0x84d6=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x4d68[_0x1663ae];return _0x30ffb8;};'use strict';var multer=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var path=require(_0x84d6('0x2'));var timeout=require(_0x84d6('0x3'));var express=require(_0x84d6('0x4'));var router=express[_0x84d6('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x84d6('0x6'));var config=require('../../config/environment');var controller=require(_0x84d6('0x7'));router['get']('/',auth[_0x84d6('0x8')](),controller[_0x84d6('0x9')]);router[_0x84d6('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x84d6('0xb')]);router[_0x84d6('0xa')](_0x84d6('0xc'),auth[_0x84d6('0x8')](),controller['getFields']);router[_0x84d6('0xa')]('/:id/subjects',auth[_0x84d6('0x8')](),controller[_0x84d6('0xd')]);router[_0x84d6('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x84d6('0xe')]);router['get'](_0x84d6('0xf'),auth[_0x84d6('0x8')](),controller[_0x84d6('0x10')]);router[_0x84d6('0x11')]('/',auth[_0x84d6('0x8')](),controller['create']);router[_0x84d6('0x11')]('/:id/tags',auth[_0x84d6('0x8')](),controller[_0x84d6('0x12')]);router[_0x84d6('0x13')](_0x84d6('0x14'),auth[_0x84d6('0x8')](),controller[_0x84d6('0x15')]);router[_0x84d6('0x16')]('/:id',auth[_0x84d6('0x8')](),controller[_0x84d6('0x17')]);module[_0x84d6('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4326783..36cb87b 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 _0x2d47=['STRING','exports'];(function(_0x3039f9,_0x2ead6f){var _0x2125f4=function(_0x43cca4){while(--_0x43cca4){_0x3039f9['push'](_0x3039f9['shift']());}};_0x2125f4(++_0x2ead6f);}(_0x2d47,0x123));var _0x72d4=function(_0x15f732,_0x2d006a){_0x15f732=_0x15f732-0x0;var _0x2c1243=_0x2d47[_0x15f732];return _0x2c1243;};'use strict';var Sequelize=require('sequelize');module[_0x72d4('0x0')]={'name':{'type':Sequelize[_0x72d4('0x1')]},'description':{'type':Sequelize[_0x72d4('0x1')]}}; \ No newline at end of file +var _0xbca9=['STRING','exports'];(function(_0x2482a0,_0x92f113){var _0x50e1f5=function(_0x2a6154){while(--_0x2a6154){_0x2482a0['push'](_0x2482a0['shift']());}};_0x50e1f5(++_0x92f113);}(_0xbca9,0xfb));var _0x9bca=function(_0x1eae73,_0x5a029b){_0x1eae73=_0x1eae73-0x0;var _0x2714dc=_0xbca9[_0x1eae73];return _0x2714dc;};'use strict';var Sequelize=require('sequelize');module[_0x9bca('0x0')]={'name':{'type':Sequelize[_0x9bca('0x1')]},'description':{'type':Sequelize[_0x9bca('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c47866a..0f03752 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 _0x99e9=['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','../../mysqldb','jayson/promise','client','test','ValidationError','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','DeskConfiguration','includeAll','include','rows','show','rawAttributes','find','create','body','params','findOne','DeskField','pick','map','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x1cacfd,_0x5af578){var _0xf925a7=function(_0x1b6967){while(--_0x1b6967){_0x1cacfd['push'](_0x1cacfd['shift']());}};_0xf925a7(++_0x5af578);}(_0x99e9,0xb4));var _0x999e=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x99e9[_0x2142c8];return _0x4286e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x999e('0x0'));var rimraf=require(_0x999e('0x1'));var zipdir=require(_0x999e('0x2'));var jsonpatch=require(_0x999e('0x3'));var rp=require('request-promise');var moment=require(_0x999e('0x4'));var BPromise=require(_0x999e('0x5'));var Mustache=require(_0x999e('0x6'));var util=require('util');var path=require(_0x999e('0x7'));var sox=require('sox');var csv=require(_0x999e('0x8'));var ejs=require(_0x999e('0x9'));var fs=require('fs');var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0x8'));var querystring=require(_0x999e('0xe'));var Papa=require(_0x999e('0xf'));var Redis=require(_0x999e('0x10'));var authService=require(_0x999e('0x11'));var qs=require(_0x999e('0x12'));var as=require(_0x999e('0x13'));var hardwareService=require(_0x999e('0x14'));var logger=require(_0x999e('0x15'))(_0x999e('0x16'));var utils=require(_0x999e('0x17'));var config=require(_0x999e('0x18'));var db=require(_0x999e('0x19'))['db'];var jayson=require(_0x999e('0x1a'));var client=jayson[_0x999e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x15f771,_0x54afad,_0x3e6f5a){if(_0x3e6f5a){var _0x387924=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x387924[_0x999e('0x1c')](_0x54afad)){return _0x15f771;}else{throw new db['Sequelize'][(_0x999e('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x15f771;}}function respondWithRpcPromise(_0xa44e4c,_0x539598,_0x549ad4,_0x1eee64){return new BPromise(function(_0x22feac,_0x2dd5f4){var _0x289e0e=_0x1eee64||client;return _0x289e0e[_0x999e('0x1e')](_0xa44e4c,_0x549ad4)[_0x999e('0x1f')](function(_0x4aac66){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x539598,_0x999e('0x20'));logger[_0x999e('0x21')](_0x999e('0x22'),_0x539598,_0x999e('0x20'),JSON[_0x999e('0x23')](_0x4aac66));if(_0x4aac66[_0x999e('0x24')]){if(_0x4aac66['error']['code']===0x1f4){logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x4aac66[_0x999e('0x24')]['message']);return _0x2dd5f4(_0x4aac66[_0x999e('0x24')][_0x999e('0x26')]);}logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x4aac66[_0x999e('0x24')][_0x999e('0x26')]);return _0x22feac(_0x4aac66[_0x999e('0x24')]['message']);}else{logger['info'](_0x999e('0x25'),_0x539598,_0x999e('0x20'));_0x22feac(_0x4aac66['result'][_0x999e('0x26')]);}})[_0x999e('0x27')](function(_0x3f548e){logger[_0x999e('0x24')](_0x999e('0x25'),_0x539598,_0x3f548e);_0x2dd5f4(_0x3f548e);});});}function respondWithStatusCode(_0x320634,_0x4f8406){_0x4f8406=_0x4f8406||0xcc;return function(_0x2e1cc5){if(_0x2e1cc5){return _0x320634[_0x999e('0x28')](_0x4f8406);}return _0x320634[_0x999e('0x29')](_0x4f8406)[_0x999e('0x2a')]();};}function respondWithResult(_0x1b7adb,_0x1d2dc6){_0x1d2dc6=_0x1d2dc6||0xc8;return function(_0x44b790){if(_0x44b790){return _0x1b7adb['status'](_0x1d2dc6)[_0x999e('0x2b')](_0x44b790);}};}function respondWithFilteredResult(_0x5ba8b0,_0x4fed13){return function(_0x3dff6b){if(_0x3dff6b){var _0x1059bd=_0x3dff6b[_0x999e('0x2c')],_0x1f89f2=_0x4fed13[_0x999e('0x2d')],_0x555ca0=_0x4fed13[_0x999e('0x2d')]+_0x4fed13[_0x999e('0x2e')],_0x1ea0e4;if(_0x555ca0>=_0x1059bd){_0x555ca0=_0x1059bd;_0x1ea0e4=0xc8;}else{_0x1ea0e4=0xce;}_0x5ba8b0[_0x999e('0x29')](_0x1ea0e4);return _0x5ba8b0[_0x999e('0x2f')](_0x999e('0x30'),_0x1f89f2+'-'+_0x555ca0+'/'+_0x1059bd)[_0x999e('0x2b')](_0x3dff6b);}return null;};}function patchUpdates(_0x3ddacb){return function(_0x53ece1){try{jsonpatch[_0x999e('0x31')](_0x53ece1,_0x3ddacb,!![]);}catch(_0x1cd206){return BPromise[_0x999e('0x32')](_0x1cd206);}return _0x53ece1['save']();};}function saveUpdates(_0x2ca5b8,_0x5af72c){return function(_0x5dce40){if(_0x5dce40){return _0x5dce40[_0x999e('0x33')](_0x2ca5b8)[_0x999e('0x1f')](function(_0x5aa206){return _0x5aa206;});}return null;};}function removeEntity(_0x53ebb2,_0x5def61){return function(_0x12eb93){if(_0x12eb93){return _0x12eb93[_0x999e('0x34')]()[_0x999e('0x1f')](function(){_0x53ebb2['status'](0xcc)[_0x999e('0x2a')]();});}};}function handleEntityNotFound(_0x41d6f1,_0x37f662){return function(_0x30247a){if(!_0x30247a){_0x41d6f1['sendStatus'](0x194);}return _0x30247a;};}function handleError(_0x4ebcb7,_0x44fb32){_0x44fb32=_0x44fb32||0x1f4;return function(_0x490694){logger[_0x999e('0x24')](_0x490694[_0x999e('0x35')]);if(_0x490694[_0x999e('0x36')]){delete _0x490694[_0x999e('0x36')];}_0x4ebcb7['status'](_0x44fb32)[_0x999e('0x37')](_0x490694);};}exports[_0x999e('0x38')]=function(_0x5bd468,_0x4808d1){var _0x327866={},_0x4aa98c={},_0xa0c150={'count':0x0,'rows':[]};var _0x5dac45=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x17e257){return{'name':_0x17e257['fieldName'],'type':_0x17e257[_0x999e('0x39')]['key']};});_0x4aa98c['model']=_['map'](_0x5dac45,_0x999e('0x36'));_0x4aa98c[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x5bd468[_0x999e('0x3a')]);_0x4aa98c[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x4aa98c[_0x999e('0x3e')],_0x4aa98c[_0x999e('0x3a')]);_0x327866['attributes']=_[_0x999e('0x3d')](_0x4aa98c[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x5bd468[_0x999e('0x3a')]['fields']));_0x327866[_0x999e('0x40')]=_0x327866['attributes'][_0x999e('0x41')]?_0x327866[_0x999e('0x40')]:_0x4aa98c[_0x999e('0x3e')];if(!_0x5bd468[_0x999e('0x3a')]['hasOwnProperty'](_0x999e('0x42'))){_0x327866[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x5bd468['query']['limit']);_0x327866[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x5bd468[_0x999e('0x3a')][_0x999e('0x2d')]);}_0x327866[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x5bd468[_0x999e('0x3a')][_0x999e('0x44')]);_0x327866[_0x999e('0x45')]=qs[_0x999e('0x3c')](_['pick'](_0x5bd468['query'],_0x4aa98c[_0x999e('0x3c')]),_0x5dac45);if(_0x5bd468[_0x999e('0x3a')][_0x999e('0x46')]){_0x327866[_0x999e('0x45')]=_[_0x999e('0x47')](_0x327866[_0x999e('0x45')],{'$or':_['map'](_0x5dac45,function(_0x33f2c6){if(_0x33f2c6['type']!=='VIRTUAL'){var _0x88b11e={};_0x88b11e[_0x33f2c6['name']]={'$like':'%'+_0x5bd468['query']['filter']+'%'};return _0x88b11e;}})});}_0x327866=_['merge']({},_0x327866,_0x5bd468[_0x999e('0x48')]);var _0x2841f7={'where':_0x327866['where']};return db[_0x999e('0x49')][_0x999e('0x2c')](_0x2841f7)[_0x999e('0x1f')](function(_0x57aaa9){_0xa0c150['count']=_0x57aaa9;if(_0x5bd468[_0x999e('0x3a')][_0x999e('0x4a')]){_0x327866[_0x999e('0x4b')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x327866);})['then'](function(_0x5ee14d){_0xa0c150[_0x999e('0x4c')]=_0x5ee14d;return _0xa0c150;})['then'](respondWithFilteredResult(_0x4808d1,_0x327866))['catch'](handleError(_0x4808d1,null));};exports[_0x999e('0x4d')]=function(_0x29a27f,_0x5843f1){var _0xa50dc6={'raw':![],'where':{'id':_0x29a27f['params']['id']}},_0x1a5c3d={};_0x1a5c3d[_0x999e('0x3e')]=_['keys'](db[_0x999e('0x49')][_0x999e('0x4e')]);_0x1a5c3d['query']=_[_0x999e('0x3b')](_0x29a27f[_0x999e('0x3a')]);_0x1a5c3d['filters']=_['intersection'](_0x1a5c3d[_0x999e('0x3e')],_0x1a5c3d['query']);_0xa50dc6['attributes']=_['intersection'](_0x1a5c3d[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x29a27f[_0x999e('0x3a')][_0x999e('0x3f')]));_0xa50dc6[_0x999e('0x40')]=_0xa50dc6[_0x999e('0x40')]['length']?_0xa50dc6[_0x999e('0x40')]:_0x1a5c3d[_0x999e('0x3e')];if(_0x29a27f['query'][_0x999e('0x4a')]){_0xa50dc6[_0x999e('0x4b')]=[{'all':!![]}];}_0xa50dc6=_[_0x999e('0x47')]({},_0xa50dc6,_0x29a27f[_0x999e('0x48')]);return db[_0x999e('0x49')][_0x999e('0x4f')](_0xa50dc6)[_0x999e('0x1f')](handleEntityNotFound(_0x5843f1,null))[_0x999e('0x1f')](respondWithResult(_0x5843f1,null))[_0x999e('0x27')](handleError(_0x5843f1,null));};exports['create']=function(_0x9f3f7a,_0x45b61a){return db[_0x999e('0x49')][_0x999e('0x50')](_0x9f3f7a['body'],{})[_0x999e('0x1f')](respondWithResult(_0x45b61a,0xc9))[_0x999e('0x27')](handleError(_0x45b61a,null));};exports[_0x999e('0x33')]=function(_0x291b73,_0x3e475b){if(_0x291b73[_0x999e('0x51')]['id']){delete _0x291b73[_0x999e('0x51')]['id'];}return db[_0x999e('0x49')]['find']({'where':{'id':_0x291b73['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x3e475b,null))[_0x999e('0x1f')](saveUpdates(_0x291b73[_0x999e('0x51')],null))[_0x999e('0x1f')](respondWithResult(_0x3e475b,null))[_0x999e('0x27')](handleError(_0x3e475b,null));};exports[_0x999e('0x34')]=function(_0x23c5fb,_0x56d4b2){return db['DeskConfiguration'][_0x999e('0x4f')]({'where':{'id':_0x23c5fb[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x56d4b2,null))[_0x999e('0x1f')](removeEntity(_0x56d4b2,null))[_0x999e('0x27')](handleError(_0x56d4b2,null));};exports['getFields']=function(_0x10f82f,_0x1e7ad2,_0x30a49d){var _0x3c8ecf={};var _0x502c9={};var _0x434e13;var _0x2b4bbe;return db['DeskConfiguration'][_0x999e('0x53')]({'where':{'id':_0x10f82f['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x1e7ad2,null))[_0x999e('0x1f')](function(_0x2ce0b3){if(_0x2ce0b3){_0x434e13=_0x2ce0b3;_0x502c9[_0x999e('0x3e')]=_[_0x999e('0x3b')](db[_0x999e('0x54')]['rawAttributes']);_0x502c9[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x10f82f[_0x999e('0x3a')]);_0x502c9[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],_0x502c9[_0x999e('0x3a')]);_0x3c8ecf[_0x999e('0x40')]=_[_0x999e('0x3d')](_0x502c9[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x3f')]));_0x3c8ecf[_0x999e('0x40')]=_0x3c8ecf[_0x999e('0x40')]['length']?_0x3c8ecf[_0x999e('0x40')]:_0x502c9[_0x999e('0x3e')];_0x3c8ecf[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x10f82f['query']['sort']);_0x3c8ecf[_0x999e('0x45')]=qs[_0x999e('0x3c')](_[_0x999e('0x55')](_0x10f82f[_0x999e('0x3a')],_0x502c9[_0x999e('0x3c')]));if(_0x10f82f[_0x999e('0x3a')][_0x999e('0x46')]){_0x3c8ecf[_0x999e('0x45')]=_[_0x999e('0x47')](_0x3c8ecf['where'],{'$or':_[_0x999e('0x56')](_0x3c8ecf['attributes'],function(_0x184b3e){var _0x21a04a={};_0x21a04a[_0x184b3e]={'$like':'%'+_0x10f82f['query'][_0x999e('0x46')]+'%'};return _0x21a04a;})});}_0x3c8ecf=_[_0x999e('0x47')]({},_0x3c8ecf,_0x10f82f[_0x999e('0x48')]);return _0x434e13[_0x999e('0x57')](_0x3c8ecf);}})[_0x999e('0x1f')](function(_0x4ba9cd){if(_0x4ba9cd){_0x2b4bbe=_0x4ba9cd[_0x999e('0x41')];if(!_0x10f82f[_0x999e('0x3a')]['hasOwnProperty']('nolimit')){_0x3c8ecf['limit']=qs[_0x999e('0x2e')](_0x10f82f[_0x999e('0x3a')][_0x999e('0x2e')]);_0x3c8ecf[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x10f82f['query']['offset']);}return _0x434e13['getFields'](_0x3c8ecf);}})[_0x999e('0x1f')](function(_0x513580){if(_0x513580){return _0x513580?{'count':_0x2b4bbe,'rows':_0x513580}:null;}})['then'](respondWithResult(_0x1e7ad2,null))[_0x999e('0x27')](handleError(_0x1e7ad2,null));};exports['getSubjects']=function(_0x294f2a,_0x3131c7,_0xb5ac06){var _0x5b8a0d={};var _0x3ca455={};var _0x3c2bce;var _0x2ddf00;return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x294f2a[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x3131c7,null))['then'](function(_0x1fdc45){if(_0x1fdc45){_0x3c2bce=_0x1fdc45;_0x3ca455[_0x999e('0x3e')]=_[_0x999e('0x3b')](db['DeskField'][_0x999e('0x4e')]);_0x3ca455[_0x999e('0x3a')]=_['keys'](_0x294f2a[_0x999e('0x3a')]);_0x3ca455[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x3ca455[_0x999e('0x3e')],_0x3ca455[_0x999e('0x3a')]);_0x5b8a0d[_0x999e('0x40')]=_[_0x999e('0x3d')](_0x3ca455[_0x999e('0x3e')],qs[_0x999e('0x3f')](_0x294f2a['query'][_0x999e('0x3f')]));_0x5b8a0d[_0x999e('0x40')]=_0x5b8a0d[_0x999e('0x40')]['length']?_0x5b8a0d[_0x999e('0x40')]:_0x3ca455['model'];_0x5b8a0d[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x294f2a[_0x999e('0x3a')]['sort']);_0x5b8a0d[_0x999e('0x45')]=qs[_0x999e('0x3c')](_[_0x999e('0x55')](_0x294f2a[_0x999e('0x3a')],_0x3ca455[_0x999e('0x3c')]));if(_0x294f2a[_0x999e('0x3a')]['filter']){_0x5b8a0d[_0x999e('0x45')]=_['merge'](_0x5b8a0d[_0x999e('0x45')],{'$or':_['map'](_0x5b8a0d['attributes'],function(_0x3ef0c0){var _0x5d136c={};_0x5d136c[_0x3ef0c0]={'$like':'%'+_0x294f2a[_0x999e('0x3a')][_0x999e('0x46')]+'%'};return _0x5d136c;})});}_0x5b8a0d=_['merge']({},_0x5b8a0d,_0x294f2a[_0x999e('0x48')]);return _0x3c2bce[_0x999e('0x58')](_0x5b8a0d);}})['then'](function(_0x2a4d85){if(_0x2a4d85){_0x2ddf00=_0x2a4d85[_0x999e('0x41')];if(!_0x294f2a[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x5b8a0d[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x294f2a[_0x999e('0x3a')]['limit']);_0x5b8a0d['offset']=qs[_0x999e('0x2d')](_0x294f2a[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x3c2bce[_0x999e('0x58')](_0x5b8a0d);}})[_0x999e('0x1f')](function(_0x4be2fa){if(_0x4be2fa){return _0x4be2fa?{'count':_0x2ddf00,'rows':_0x4be2fa}:null;}})['then'](respondWithResult(_0x3131c7,null))[_0x999e('0x27')](handleError(_0x3131c7,null));};exports[_0x999e('0x5a')]=function(_0x5c9439,_0x2405f5,_0x404391){var _0x40d407={};var _0x54742b={};var _0x389520;var _0x1a53c9;return db[_0x999e('0x49')]['findOne']({'where':{'id':_0x5c9439[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x2405f5,null))[_0x999e('0x1f')](function(_0x53cf4d){if(_0x53cf4d){_0x389520=_0x53cf4d;_0x54742b['model']=_[_0x999e('0x3b')](db['DeskField'][_0x999e('0x4e')]);_0x54742b[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x5c9439[_0x999e('0x3a')]);_0x54742b[_0x999e('0x3c')]=_[_0x999e('0x3d')](_0x54742b[_0x999e('0x3e')],_0x54742b['query']);_0x40d407[_0x999e('0x40')]=_['intersection'](_0x54742b['model'],qs[_0x999e('0x3f')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x3f')]));_0x40d407[_0x999e('0x40')]=_0x40d407[_0x999e('0x40')][_0x999e('0x41')]?_0x40d407['attributes']:_0x54742b[_0x999e('0x3e')];_0x40d407['order']=qs[_0x999e('0x44')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x44')]);_0x40d407['where']=qs[_0x999e('0x3c')](_['pick'](_0x5c9439[_0x999e('0x3a')],_0x54742b[_0x999e('0x3c')]));if(_0x5c9439[_0x999e('0x3a')][_0x999e('0x46')]){_0x40d407[_0x999e('0x45')]=_['merge'](_0x40d407['where'],{'$or':_[_0x999e('0x56')](_0x40d407[_0x999e('0x40')],function(_0x34e2be){var _0x283d61={};_0x283d61[_0x34e2be]={'$like':'%'+_0x5c9439[_0x999e('0x3a')][_0x999e('0x46')]+'%'};return _0x283d61;})});}_0x40d407=_[_0x999e('0x47')]({},_0x40d407,_0x5c9439[_0x999e('0x48')]);return _0x389520['getDescriptions'](_0x40d407);}})[_0x999e('0x1f')](function(_0xaed39c){if(_0xaed39c){_0x1a53c9=_0xaed39c[_0x999e('0x41')];if(!_0x5c9439[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x40d407[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x5c9439['query'][_0x999e('0x2e')]);_0x40d407[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x5c9439[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x389520[_0x999e('0x5a')](_0x40d407);}})[_0x999e('0x1f')](function(_0x360ce9){if(_0x360ce9){return _0x360ce9?{'count':_0x1a53c9,'rows':_0x360ce9}:null;}})['then'](respondWithResult(_0x2405f5,null))[_0x999e('0x27')](handleError(_0x2405f5,null));};exports[_0x999e('0x5b')]=function(_0x34d75e,_0x4b0d85,_0x2b036d){var _0x3edea2={};var _0x3b5b20={};var _0x2cd575;var _0x35fcd5;return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x34d75e[_0x999e('0x52')]['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x4b0d85,null))['then'](function(_0xbd2dac){if(_0xbd2dac){_0x2cd575=_0xbd2dac;_0x3b5b20[_0x999e('0x3e')]=_[_0x999e('0x3b')](db['Tag']['rawAttributes']);_0x3b5b20[_0x999e('0x3a')]=_[_0x999e('0x3b')](_0x34d75e[_0x999e('0x3a')]);_0x3b5b20['filters']=_[_0x999e('0x3d')](_0x3b5b20[_0x999e('0x3e')],_0x3b5b20[_0x999e('0x3a')]);_0x3edea2['attributes']=_[_0x999e('0x3d')](_0x3b5b20[_0x999e('0x3e')],qs['fields'](_0x34d75e[_0x999e('0x3a')]['fields']));_0x3edea2['attributes']=_0x3edea2[_0x999e('0x40')][_0x999e('0x41')]?_0x3edea2[_0x999e('0x40')]:_0x3b5b20[_0x999e('0x3e')];_0x3edea2['order']=qs[_0x999e('0x44')](_0x34d75e[_0x999e('0x3a')][_0x999e('0x44')]);_0x3edea2[_0x999e('0x45')]=qs[_0x999e('0x3c')](_['pick'](_0x34d75e[_0x999e('0x3a')],_0x3b5b20[_0x999e('0x3c')]));if(_0x34d75e[_0x999e('0x3a')]['filter']){_0x3edea2[_0x999e('0x45')]=_[_0x999e('0x47')](_0x3edea2[_0x999e('0x45')],{'$or':_[_0x999e('0x56')](_0x3edea2[_0x999e('0x40')],function(_0x1b6cfd){var _0x1d885d={};_0x1d885d[_0x1b6cfd]={'$like':'%'+_0x34d75e[_0x999e('0x3a')]['filter']+'%'};return _0x1d885d;})});}_0x3edea2=_[_0x999e('0x47')]({},_0x3edea2,_0x34d75e[_0x999e('0x48')]);return _0x2cd575[_0x999e('0x5b')](_0x3edea2);}})[_0x999e('0x1f')](function(_0x4787d3){if(_0x4787d3){_0x35fcd5=_0x4787d3[_0x999e('0x41')];if(!_0x34d75e[_0x999e('0x3a')][_0x999e('0x59')](_0x999e('0x42'))){_0x3edea2[_0x999e('0x2e')]=qs['limit'](_0x34d75e[_0x999e('0x3a')][_0x999e('0x2e')]);_0x3edea2[_0x999e('0x2d')]=qs[_0x999e('0x2d')](_0x34d75e[_0x999e('0x3a')][_0x999e('0x2d')]);}return _0x2cd575['getTags'](_0x3edea2);}})['then'](function(_0x2b2368){if(_0x2b2368){return _0x2b2368?{'count':_0x35fcd5,'rows':_0x2b2368}:null;}})[_0x999e('0x1f')](respondWithResult(_0x4b0d85,null))['catch'](handleError(_0x4b0d85,null));};exports[_0x999e('0x5c')]=function(_0x346afc,_0x593111,_0x413c81){if(_0x346afc[_0x999e('0x51')]['id']){delete _0x346afc[_0x999e('0x51')]['id'];}return db[_0x999e('0x49')][_0x999e('0x53')]({'where':{'id':_0x346afc['params']['id']}})[_0x999e('0x1f')](handleEntityNotFound(_0x593111,null))[_0x999e('0x1f')](function(_0x2e86ac){if(_0x2e86ac){return _0x2e86ac[_0x999e('0x5c')](_0x346afc[_0x999e('0x51')][_0x999e('0x5d')]||[]);}return null;})[_0x999e('0x1f')](respondWithResult(_0x593111,null))['catch'](handleError(_0x593111,null));}; \ No newline at end of file +var _0xf452=['findAll','catch','show','params','find','create','body','getFields','DeskField','findOne','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x3373b3,_0x1429c1){var _0x45fdf3=function(_0x4c173e){while(--_0x4c173e){_0x3373b3['push'](_0x3373b3['shift']());}};_0x45fdf3(++_0x1429c1);}(_0xf452,0x13b));var _0x2f45=function(_0x4977ae,_0x573938){_0x4977ae=_0x4977ae-0x0;var _0x383c13=_0xf452[_0x4977ae];return _0x383c13;};'use strict';var pdf=require(_0x2f45('0x0'));var emlformat=require(_0x2f45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2f45('0x2'));var jsonpatch=require(_0x2f45('0x3'));var rp=require(_0x2f45('0x4'));var moment=require(_0x2f45('0x5'));var BPromise=require(_0x2f45('0x6'));var Mustache=require(_0x2f45('0x7'));var util=require(_0x2f45('0x8'));var path=require(_0x2f45('0x9'));var sox=require(_0x2f45('0xa'));var csv=require(_0x2f45('0xb'));var ejs=require(_0x2f45('0xc'));var fs=require('fs');var _=require(_0x2f45('0xd'));var squel=require(_0x2f45('0xe'));var crypto=require(_0x2f45('0xf'));var jsforce=require(_0x2f45('0x10'));var deskjs=require(_0x2f45('0x11'));var toCsv=require(_0x2f45('0xb'));var querystring=require(_0x2f45('0x12'));var Papa=require(_0x2f45('0x13'));var Redis=require(_0x2f45('0x14'));var authService=require(_0x2f45('0x15'));var qs=require(_0x2f45('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f45('0x17'))(_0x2f45('0x18'));var utils=require(_0x2f45('0x19'));var config=require(_0x2f45('0x1a'));var db=require(_0x2f45('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2f45('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x33534,_0x28f051,_0x4b6ee9){if(_0x4b6ee9){var _0x2c3a9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c3a9d[_0x2f45('0x1d')](_0x28f051)){return _0x33534;}else{throw new db[(_0x2f45('0x1e'))]['ValidationError'](_0x2f45('0x1f'));}}else{return _0x33534;}}function respondWithRpcPromise(_0x4c8274,_0x70b84b,_0x469fbe,_0x5bd134){return new BPromise(function(_0x2ac0bf,_0xf24703){var _0x42a708=_0x5bd134||client;return _0x42a708['request'](_0x4c8274,_0x469fbe)['then'](function(_0x58b92e){logger[_0x2f45('0x20')](_0x2f45('0x21'),_0x70b84b,_0x2f45('0x22'));logger[_0x2f45('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x70b84b,_0x2f45('0x22'),JSON[_0x2f45('0x24')](_0x58b92e));if(_0x58b92e[_0x2f45('0x25')]){if(_0x58b92e[_0x2f45('0x25')][_0x2f45('0x26')]===0x1f4){logger[_0x2f45('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x70b84b,_0x58b92e['error'][_0x2f45('0x27')]);return _0xf24703(_0x58b92e[_0x2f45('0x25')][_0x2f45('0x27')]);}logger[_0x2f45('0x25')](_0x2f45('0x21'),_0x70b84b,_0x58b92e[_0x2f45('0x25')][_0x2f45('0x27')]);return _0x2ac0bf(_0x58b92e[_0x2f45('0x25')]['message']);}else{logger[_0x2f45('0x20')](_0x2f45('0x21'),_0x70b84b,'request\x20sent');_0x2ac0bf(_0x58b92e[_0x2f45('0x28')][_0x2f45('0x27')]);}})['catch'](function(_0x1b8870){logger[_0x2f45('0x25')](_0x2f45('0x21'),_0x70b84b,_0x1b8870);_0xf24703(_0x1b8870);});});}function respondWithStatusCode(_0x3d8f12,_0x1c1c3e){_0x1c1c3e=_0x1c1c3e||0xcc;return function(_0x4fc861){if(_0x4fc861){return _0x3d8f12['sendStatus'](_0x1c1c3e);}return _0x3d8f12[_0x2f45('0x29')](_0x1c1c3e)['end']();};}function respondWithResult(_0x4a5df2,_0x3c9541){_0x3c9541=_0x3c9541||0xc8;return function(_0x507d86){if(_0x507d86){return _0x4a5df2[_0x2f45('0x29')](_0x3c9541)[_0x2f45('0x2a')](_0x507d86);}};}function respondWithFilteredResult(_0x166792,_0x237dce){return function(_0xf41751){if(_0xf41751){var _0x2b10cf=_0xf41751[_0x2f45('0x2b')],_0x2f3ecc=_0x237dce[_0x2f45('0x2c')],_0x38eb3b=_0x237dce['offset']+_0x237dce[_0x2f45('0x2d')],_0x531bc7;if(_0x38eb3b>=_0x2b10cf){_0x38eb3b=_0x2b10cf;_0x531bc7=0xc8;}else{_0x531bc7=0xce;}_0x166792['status'](_0x531bc7);return _0x166792[_0x2f45('0x2e')](_0x2f45('0x2f'),_0x2f3ecc+'-'+_0x38eb3b+'/'+_0x2b10cf)[_0x2f45('0x2a')](_0xf41751);}return null;};}function patchUpdates(_0x4d17a1){return function(_0x5b4f4a){try{jsonpatch[_0x2f45('0x30')](_0x5b4f4a,_0x4d17a1,!![]);}catch(_0x493ecd){return BPromise[_0x2f45('0x31')](_0x493ecd);}return _0x5b4f4a[_0x2f45('0x32')]();};}function saveUpdates(_0x4c1999,_0xd62c2d){return function(_0xa751){if(_0xa751){return _0xa751[_0x2f45('0x33')](_0x4c1999)[_0x2f45('0x34')](function(_0x1cb0d0){return _0x1cb0d0;});}return null;};}function removeEntity(_0x5edcfd,_0x19572b){return function(_0x140b1f){if(_0x140b1f){return _0x140b1f[_0x2f45('0x35')]()['then'](function(){_0x5edcfd[_0x2f45('0x29')](0xcc)[_0x2f45('0x36')]();});}};}function handleEntityNotFound(_0x5b6994,_0x31844b){return function(_0x1300d5){if(!_0x1300d5){_0x5b6994[_0x2f45('0x37')](0x194);}return _0x1300d5;};}function handleError(_0xe24e38,_0x3e6835){_0x3e6835=_0x3e6835||0x1f4;return function(_0x1ac306){logger['error'](_0x1ac306['stack']);if(_0x1ac306[_0x2f45('0x38')]){delete _0x1ac306[_0x2f45('0x38')];}_0xe24e38[_0x2f45('0x29')](_0x3e6835)[_0x2f45('0x39')](_0x1ac306);};}exports[_0x2f45('0x3a')]=function(_0x7d2916,_0x5cb0dd){var _0x1b4bb4={},_0xc34a31={},_0x22a967={'count':0x0,'rows':[]};var _0x4d4219=_[_0x2f45('0x3b')](db[_0x2f45('0x3c')][_0x2f45('0x3d')],function(_0x542b38){return{'name':_0x542b38[_0x2f45('0x3e')],'type':_0x542b38[_0x2f45('0x3f')][_0x2f45('0x40')]};});_0xc34a31[_0x2f45('0x41')]=_[_0x2f45('0x3b')](_0x4d4219,'name');_0xc34a31[_0x2f45('0x42')]=_[_0x2f45('0x43')](_0x7d2916[_0x2f45('0x42')]);_0xc34a31[_0x2f45('0x44')]=_[_0x2f45('0x45')](_0xc34a31['model'],_0xc34a31[_0x2f45('0x42')]);_0x1b4bb4[_0x2f45('0x46')]=_[_0x2f45('0x45')](_0xc34a31[_0x2f45('0x41')],qs[_0x2f45('0x47')](_0x7d2916[_0x2f45('0x42')]['fields']));_0x1b4bb4['attributes']=_0x1b4bb4['attributes'][_0x2f45('0x48')]?_0x1b4bb4[_0x2f45('0x46')]:_0xc34a31[_0x2f45('0x41')];if(!_0x7d2916[_0x2f45('0x42')][_0x2f45('0x49')](_0x2f45('0x4a'))){_0x1b4bb4[_0x2f45('0x2d')]=qs['limit'](_0x7d2916['query'][_0x2f45('0x2d')]);_0x1b4bb4['offset']=qs['offset'](_0x7d2916[_0x2f45('0x42')][_0x2f45('0x2c')]);}_0x1b4bb4[_0x2f45('0x4b')]=qs[_0x2f45('0x4c')](_0x7d2916['query'][_0x2f45('0x4c')]);_0x1b4bb4[_0x2f45('0x4d')]=qs[_0x2f45('0x44')](_[_0x2f45('0x4e')](_0x7d2916[_0x2f45('0x42')],_0xc34a31['filters']),_0x4d4219);if(_0x7d2916[_0x2f45('0x42')]['filter']){_0x1b4bb4[_0x2f45('0x4d')]=_[_0x2f45('0x4f')](_0x1b4bb4[_0x2f45('0x4d')],{'$or':_[_0x2f45('0x3b')](_0x4d4219,function(_0x481ca7){if(_0x481ca7[_0x2f45('0x3f')]!==_0x2f45('0x50')){var _0x2a5c8e={};_0x2a5c8e[_0x481ca7['name']]={'$like':'%'+_0x7d2916[_0x2f45('0x42')][_0x2f45('0x51')]+'%'};return _0x2a5c8e;}})});}_0x1b4bb4=_[_0x2f45('0x4f')]({},_0x1b4bb4,_0x7d2916[_0x2f45('0x52')]);var _0x5f3677={'where':_0x1b4bb4['where']};return db[_0x2f45('0x3c')]['count'](_0x5f3677)[_0x2f45('0x34')](function(_0x5adc8e){_0x22a967[_0x2f45('0x2b')]=_0x5adc8e;if(_0x7d2916['query'][_0x2f45('0x53')]){_0x1b4bb4[_0x2f45('0x54')]=[{'all':!![]}];}return db[_0x2f45('0x3c')][_0x2f45('0x55')](_0x1b4bb4);})['then'](function(_0x3a5a73){_0x22a967['rows']=_0x3a5a73;return _0x22a967;})[_0x2f45('0x34')](respondWithFilteredResult(_0x5cb0dd,_0x1b4bb4))[_0x2f45('0x56')](handleError(_0x5cb0dd,null));};exports[_0x2f45('0x57')]=function(_0x1ccb5e,_0x93e709){var _0x34eca8={'raw':![],'where':{'id':_0x1ccb5e[_0x2f45('0x58')]['id']}},_0x5c9afe={};_0x5c9afe[_0x2f45('0x41')]=_[_0x2f45('0x43')](db['DeskConfiguration'][_0x2f45('0x3d')]);_0x5c9afe[_0x2f45('0x42')]=_[_0x2f45('0x43')](_0x1ccb5e[_0x2f45('0x42')]);_0x5c9afe[_0x2f45('0x44')]=_[_0x2f45('0x45')](_0x5c9afe[_0x2f45('0x41')],_0x5c9afe[_0x2f45('0x42')]);_0x34eca8[_0x2f45('0x46')]=_[_0x2f45('0x45')](_0x5c9afe[_0x2f45('0x41')],qs[_0x2f45('0x47')](_0x1ccb5e[_0x2f45('0x42')][_0x2f45('0x47')]));_0x34eca8['attributes']=_0x34eca8[_0x2f45('0x46')]['length']?_0x34eca8[_0x2f45('0x46')]:_0x5c9afe[_0x2f45('0x41')];if(_0x1ccb5e[_0x2f45('0x42')][_0x2f45('0x53')]){_0x34eca8[_0x2f45('0x54')]=[{'all':!![]}];}_0x34eca8=_[_0x2f45('0x4f')]({},_0x34eca8,_0x1ccb5e[_0x2f45('0x52')]);return db[_0x2f45('0x3c')][_0x2f45('0x59')](_0x34eca8)['then'](handleEntityNotFound(_0x93e709,null))[_0x2f45('0x34')](respondWithResult(_0x93e709,null))[_0x2f45('0x56')](handleError(_0x93e709,null));};exports[_0x2f45('0x5a')]=function(_0x101716,_0xb7a1c4){return db[_0x2f45('0x3c')]['create'](_0x101716[_0x2f45('0x5b')],{})[_0x2f45('0x34')](respondWithResult(_0xb7a1c4,0xc9))[_0x2f45('0x56')](handleError(_0xb7a1c4,null));};exports[_0x2f45('0x33')]=function(_0x1c1eec,_0x3bf7c8){if(_0x1c1eec[_0x2f45('0x5b')]['id']){delete _0x1c1eec[_0x2f45('0x5b')]['id'];}return db[_0x2f45('0x3c')]['find']({'where':{'id':_0x1c1eec['params']['id']}})[_0x2f45('0x34')](handleEntityNotFound(_0x3bf7c8,null))[_0x2f45('0x34')](saveUpdates(_0x1c1eec[_0x2f45('0x5b')],null))[_0x2f45('0x34')](respondWithResult(_0x3bf7c8,null))[_0x2f45('0x56')](handleError(_0x3bf7c8,null));};exports[_0x2f45('0x35')]=function(_0x4f5808,_0x25b1fe){return db['DeskConfiguration']['find']({'where':{'id':_0x4f5808['params']['id']}})['then'](handleEntityNotFound(_0x25b1fe,null))[_0x2f45('0x34')](removeEntity(_0x25b1fe,null))['catch'](handleError(_0x25b1fe,null));};exports[_0x2f45('0x5c')]=function(_0x4d7904,_0xd26ce7,_0x4992f0){var _0x4c93ac={};var _0x4b5125={};var _0x4d788a;var _0x121952;return db[_0x2f45('0x3c')]['findOne']({'where':{'id':_0x4d7904[_0x2f45('0x58')]['id']}})['then'](handleEntityNotFound(_0xd26ce7,null))[_0x2f45('0x34')](function(_0x793c4c){if(_0x793c4c){_0x4d788a=_0x793c4c;_0x4b5125['model']=_[_0x2f45('0x43')](db[_0x2f45('0x5d')]['rawAttributes']);_0x4b5125[_0x2f45('0x42')]=_[_0x2f45('0x43')](_0x4d7904[_0x2f45('0x42')]);_0x4b5125[_0x2f45('0x44')]=_['intersection'](_0x4b5125[_0x2f45('0x41')],_0x4b5125[_0x2f45('0x42')]);_0x4c93ac[_0x2f45('0x46')]=_[_0x2f45('0x45')](_0x4b5125[_0x2f45('0x41')],qs['fields'](_0x4d7904[_0x2f45('0x42')]['fields']));_0x4c93ac[_0x2f45('0x46')]=_0x4c93ac[_0x2f45('0x46')][_0x2f45('0x48')]?_0x4c93ac[_0x2f45('0x46')]:_0x4b5125[_0x2f45('0x41')];_0x4c93ac['order']=qs[_0x2f45('0x4c')](_0x4d7904[_0x2f45('0x42')][_0x2f45('0x4c')]);_0x4c93ac['where']=qs[_0x2f45('0x44')](_['pick'](_0x4d7904[_0x2f45('0x42')],_0x4b5125[_0x2f45('0x44')]));if(_0x4d7904[_0x2f45('0x42')][_0x2f45('0x51')]){_0x4c93ac[_0x2f45('0x4d')]=_[_0x2f45('0x4f')](_0x4c93ac['where'],{'$or':_[_0x2f45('0x3b')](_0x4c93ac['attributes'],function(_0x568e0a){var _0x792e45={};_0x792e45[_0x568e0a]={'$like':'%'+_0x4d7904[_0x2f45('0x42')][_0x2f45('0x51')]+'%'};return _0x792e45;})});}_0x4c93ac=_[_0x2f45('0x4f')]({},_0x4c93ac,_0x4d7904[_0x2f45('0x52')]);return _0x4d788a[_0x2f45('0x5c')](_0x4c93ac);}})[_0x2f45('0x34')](function(_0x38c176){if(_0x38c176){_0x121952=_0x38c176[_0x2f45('0x48')];if(!_0x4d7904[_0x2f45('0x42')]['hasOwnProperty'](_0x2f45('0x4a'))){_0x4c93ac[_0x2f45('0x2d')]=qs[_0x2f45('0x2d')](_0x4d7904[_0x2f45('0x42')]['limit']);_0x4c93ac[_0x2f45('0x2c')]=qs[_0x2f45('0x2c')](_0x4d7904[_0x2f45('0x42')][_0x2f45('0x2c')]);}return _0x4d788a[_0x2f45('0x5c')](_0x4c93ac);}})[_0x2f45('0x34')](function(_0x28863c){if(_0x28863c){return _0x28863c?{'count':_0x121952,'rows':_0x28863c}:null;}})[_0x2f45('0x34')](respondWithResult(_0xd26ce7,null))[_0x2f45('0x56')](handleError(_0xd26ce7,null));};exports['getSubjects']=function(_0xaf2369,_0x4b2e78,_0x22d6c7){var _0x3aacd5={};var _0x17a3c7={};var _0x367802;var _0x3e81be;return db[_0x2f45('0x3c')][_0x2f45('0x5e')]({'where':{'id':_0xaf2369[_0x2f45('0x58')]['id']}})[_0x2f45('0x34')](handleEntityNotFound(_0x4b2e78,null))[_0x2f45('0x34')](function(_0x3f6c2a){if(_0x3f6c2a){_0x367802=_0x3f6c2a;_0x17a3c7[_0x2f45('0x41')]=_[_0x2f45('0x43')](db[_0x2f45('0x5d')][_0x2f45('0x3d')]);_0x17a3c7['query']=_[_0x2f45('0x43')](_0xaf2369[_0x2f45('0x42')]);_0x17a3c7[_0x2f45('0x44')]=_[_0x2f45('0x45')](_0x17a3c7[_0x2f45('0x41')],_0x17a3c7['query']);_0x3aacd5['attributes']=_[_0x2f45('0x45')](_0x17a3c7[_0x2f45('0x41')],qs[_0x2f45('0x47')](_0xaf2369[_0x2f45('0x42')][_0x2f45('0x47')]));_0x3aacd5[_0x2f45('0x46')]=_0x3aacd5['attributes'][_0x2f45('0x48')]?_0x3aacd5[_0x2f45('0x46')]:_0x17a3c7[_0x2f45('0x41')];_0x3aacd5[_0x2f45('0x4b')]=qs['sort'](_0xaf2369[_0x2f45('0x42')][_0x2f45('0x4c')]);_0x3aacd5['where']=qs[_0x2f45('0x44')](_[_0x2f45('0x4e')](_0xaf2369[_0x2f45('0x42')],_0x17a3c7[_0x2f45('0x44')]));if(_0xaf2369[_0x2f45('0x42')][_0x2f45('0x51')]){_0x3aacd5[_0x2f45('0x4d')]=_['merge'](_0x3aacd5[_0x2f45('0x4d')],{'$or':_['map'](_0x3aacd5[_0x2f45('0x46')],function(_0x41d42d){var _0x522b1a={};_0x522b1a[_0x41d42d]={'$like':'%'+_0xaf2369['query'][_0x2f45('0x51')]+'%'};return _0x522b1a;})});}_0x3aacd5=_['merge']({},_0x3aacd5,_0xaf2369[_0x2f45('0x52')]);return _0x367802[_0x2f45('0x5f')](_0x3aacd5);}})[_0x2f45('0x34')](function(_0xf7afea){if(_0xf7afea){_0x3e81be=_0xf7afea[_0x2f45('0x48')];if(!_0xaf2369[_0x2f45('0x42')][_0x2f45('0x49')]('nolimit')){_0x3aacd5['limit']=qs[_0x2f45('0x2d')](_0xaf2369[_0x2f45('0x42')][_0x2f45('0x2d')]);_0x3aacd5[_0x2f45('0x2c')]=qs[_0x2f45('0x2c')](_0xaf2369[_0x2f45('0x42')][_0x2f45('0x2c')]);}return _0x367802[_0x2f45('0x5f')](_0x3aacd5);}})['then'](function(_0x10905d){if(_0x10905d){return _0x10905d?{'count':_0x3e81be,'rows':_0x10905d}:null;}})[_0x2f45('0x34')](respondWithResult(_0x4b2e78,null))[_0x2f45('0x56')](handleError(_0x4b2e78,null));};exports['getDescriptions']=function(_0x28f8a0,_0x17c920,_0x3e62ce){var _0x51e8d9={};var _0x40668d={};var _0x55e25b;var _0x33273d;return db['DeskConfiguration'][_0x2f45('0x5e')]({'where':{'id':_0x28f8a0['params']['id']}})[_0x2f45('0x34')](handleEntityNotFound(_0x17c920,null))[_0x2f45('0x34')](function(_0x357382){if(_0x357382){_0x55e25b=_0x357382;_0x40668d['model']=_[_0x2f45('0x43')](db['DeskField']['rawAttributes']);_0x40668d[_0x2f45('0x42')]=_[_0x2f45('0x43')](_0x28f8a0[_0x2f45('0x42')]);_0x40668d[_0x2f45('0x44')]=_['intersection'](_0x40668d['model'],_0x40668d[_0x2f45('0x42')]);_0x51e8d9[_0x2f45('0x46')]=_[_0x2f45('0x45')](_0x40668d[_0x2f45('0x41')],qs[_0x2f45('0x47')](_0x28f8a0[_0x2f45('0x42')][_0x2f45('0x47')]));_0x51e8d9['attributes']=_0x51e8d9['attributes'][_0x2f45('0x48')]?_0x51e8d9['attributes']:_0x40668d[_0x2f45('0x41')];_0x51e8d9[_0x2f45('0x4b')]=qs[_0x2f45('0x4c')](_0x28f8a0['query'][_0x2f45('0x4c')]);_0x51e8d9[_0x2f45('0x4d')]=qs[_0x2f45('0x44')](_[_0x2f45('0x4e')](_0x28f8a0['query'],_0x40668d[_0x2f45('0x44')]));if(_0x28f8a0[_0x2f45('0x42')][_0x2f45('0x51')]){_0x51e8d9['where']=_[_0x2f45('0x4f')](_0x51e8d9[_0x2f45('0x4d')],{'$or':_[_0x2f45('0x3b')](_0x51e8d9[_0x2f45('0x46')],function(_0x22ba5b){var _0xa829f6={};_0xa829f6[_0x22ba5b]={'$like':'%'+_0x28f8a0[_0x2f45('0x42')][_0x2f45('0x51')]+'%'};return _0xa829f6;})});}_0x51e8d9=_[_0x2f45('0x4f')]({},_0x51e8d9,_0x28f8a0[_0x2f45('0x52')]);return _0x55e25b[_0x2f45('0x60')](_0x51e8d9);}})[_0x2f45('0x34')](function(_0x481e44){if(_0x481e44){_0x33273d=_0x481e44[_0x2f45('0x48')];if(!_0x28f8a0['query'][_0x2f45('0x49')](_0x2f45('0x4a'))){_0x51e8d9[_0x2f45('0x2d')]=qs['limit'](_0x28f8a0['query']['limit']);_0x51e8d9[_0x2f45('0x2c')]=qs[_0x2f45('0x2c')](_0x28f8a0[_0x2f45('0x42')][_0x2f45('0x2c')]);}return _0x55e25b[_0x2f45('0x60')](_0x51e8d9);}})['then'](function(_0x5065e3){if(_0x5065e3){return _0x5065e3?{'count':_0x33273d,'rows':_0x5065e3}:null;}})[_0x2f45('0x34')](respondWithResult(_0x17c920,null))['catch'](handleError(_0x17c920,null));};exports['getTags']=function(_0x12fbc8,_0x3c4070,_0x44b7ff){var _0x139b87={};var _0x2cc4c6={};var _0x20a8ea;var _0x279ea1;return db[_0x2f45('0x3c')][_0x2f45('0x5e')]({'where':{'id':_0x12fbc8[_0x2f45('0x58')]['id']}})['then'](handleEntityNotFound(_0x3c4070,null))[_0x2f45('0x34')](function(_0x16841b){if(_0x16841b){_0x20a8ea=_0x16841b;_0x2cc4c6['model']=_[_0x2f45('0x43')](db['Tag'][_0x2f45('0x3d')]);_0x2cc4c6[_0x2f45('0x42')]=_[_0x2f45('0x43')](_0x12fbc8[_0x2f45('0x42')]);_0x2cc4c6[_0x2f45('0x44')]=_[_0x2f45('0x45')](_0x2cc4c6[_0x2f45('0x41')],_0x2cc4c6[_0x2f45('0x42')]);_0x139b87['attributes']=_[_0x2f45('0x45')](_0x2cc4c6[_0x2f45('0x41')],qs['fields'](_0x12fbc8[_0x2f45('0x42')][_0x2f45('0x47')]));_0x139b87[_0x2f45('0x46')]=_0x139b87[_0x2f45('0x46')][_0x2f45('0x48')]?_0x139b87[_0x2f45('0x46')]:_0x2cc4c6['model'];_0x139b87[_0x2f45('0x4b')]=qs[_0x2f45('0x4c')](_0x12fbc8['query'][_0x2f45('0x4c')]);_0x139b87['where']=qs[_0x2f45('0x44')](_[_0x2f45('0x4e')](_0x12fbc8[_0x2f45('0x42')],_0x2cc4c6[_0x2f45('0x44')]));if(_0x12fbc8[_0x2f45('0x42')][_0x2f45('0x51')]){_0x139b87[_0x2f45('0x4d')]=_[_0x2f45('0x4f')](_0x139b87[_0x2f45('0x4d')],{'$or':_[_0x2f45('0x3b')](_0x139b87['attributes'],function(_0x56a42a){var _0x373f04={};_0x373f04[_0x56a42a]={'$like':'%'+_0x12fbc8['query'][_0x2f45('0x51')]+'%'};return _0x373f04;})});}_0x139b87=_['merge']({},_0x139b87,_0x12fbc8[_0x2f45('0x52')]);return _0x20a8ea['getTags'](_0x139b87);}})['then'](function(_0x55e73b){if(_0x55e73b){_0x279ea1=_0x55e73b[_0x2f45('0x48')];if(!_0x12fbc8[_0x2f45('0x42')]['hasOwnProperty'](_0x2f45('0x4a'))){_0x139b87[_0x2f45('0x2d')]=qs[_0x2f45('0x2d')](_0x12fbc8['query'][_0x2f45('0x2d')]);_0x139b87[_0x2f45('0x2c')]=qs[_0x2f45('0x2c')](_0x12fbc8[_0x2f45('0x42')][_0x2f45('0x2c')]);}return _0x20a8ea[_0x2f45('0x61')](_0x139b87);}})['then'](function(_0x4d909a){if(_0x4d909a){return _0x4d909a?{'count':_0x279ea1,'rows':_0x4d909a}:null;}})['then'](respondWithResult(_0x3c4070,null))[_0x2f45('0x56')](handleError(_0x3c4070,null));};exports[_0x2f45('0x62')]=function(_0x12168d,_0x4a4116,_0x552381){if(_0x12168d['body']['id']){delete _0x12168d[_0x2f45('0x5b')]['id'];}return db[_0x2f45('0x3c')][_0x2f45('0x5e')]({'where':{'id':_0x12168d['params']['id']}})[_0x2f45('0x34')](handleEntityNotFound(_0x4a4116,null))[_0x2f45('0x34')](function(_0x35546e){if(_0x35546e){return _0x35546e[_0x2f45('0x62')](_0x12168d[_0x2f45('0x5b')][_0x2f45('0x63')]||[]);}return null;})[_0x2f45('0x34')](respondWithResult(_0x4a4116,null))[_0x2f45('0x56')](handleError(_0x4a4116,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2f528a2..fae3391 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 _0x36a7=['exports','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','request-promise','path','rimraf','./intDeskConfiguration.attributes'];(function(_0x4f9ea8,_0x12d448){var _0x35baef=function(_0x33593d){while(--_0x33593d){_0x4f9ea8['push'](_0x4f9ea8['shift']());}};_0x35baef(++_0x12d448);}(_0x36a7,0x138));var _0x736a=function(_0x331f4e,_0x1a3ea4){_0x331f4e=_0x331f4e-0x0;var _0x50fa46=_0x36a7[_0x331f4e];return _0x50fa46;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x736a('0x0'))(_0x736a('0x1'));var moment=require(_0x736a('0x2'));var BPromise=require('bluebird');var rp=require(_0x736a('0x3'));var fs=require('fs');var path=require(_0x736a('0x4'));var rimraf=require(_0x736a('0x5'));var config=require('../../config/environment');var attributes=require(_0x736a('0x6'));module[_0x736a('0x7')]=function(_0x5b9808,_0x2b19fc){return _0x5b9808[_0x736a('0x8')](_0x736a('0x9'),attributes,{'tableName':_0x736a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x334d=['define','DeskConfiguration','int_desk_configurations','moment','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x36e20e,_0x5130ac){var _0x42d30c=function(_0x479192){while(--_0x479192){_0x36e20e['push'](_0x36e20e['shift']());}};_0x42d30c(++_0x5130ac);}(_0x334d,0xcb));var _0xd334=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x334d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd334('0x0'));var BPromise=require(_0xd334('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd334('0x2'));var rimraf=require(_0xd334('0x3'));var config=require(_0xd334('0x4'));var attributes=require(_0xd334('0x5'));module[_0xd334('0x6')]=function(_0x5b3eab,_0x51389b){return _0x5b3eab[_0xd334('0x7')](_0xd334('0x8'),attributes,{'tableName':_0xd334('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 9227683..d313699 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 _0x0713=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x462f62,_0x48db92){var _0x5724e5=function(_0x223639){while(--_0x223639){_0x462f62['push'](_0x462f62['shift']());}};_0x5724e5(++_0x48db92);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x34e5=['jayson/promise','client','http','request','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x34e5,0x172));var _0x534e=function(_0x53436a,_0x532489){_0x53436a=_0x53436a-0x0;var _0x532062=_0x34e5[_0x53436a];return _0x532062;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var moment=require('moment');var BPromise=require(_0x534e('0x1'));var rs=require(_0x534e('0x2'));var fs=require('fs');var Redis=require(_0x534e('0x3'));var db=require(_0x534e('0x4'))['db'];var utils=require(_0x534e('0x5'));var logger=require('../../config/logger')(_0x534e('0x6'));var config=require(_0x534e('0x7'));var jayson=require(_0x534e('0x8'));var client=jayson[_0x534e('0x9')][_0x534e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d0370,_0x2760e7,_0x5620d4){return new BPromise(function(_0x24d562,_0x929597){return client[_0x534e('0xb')](_0x2d0370,_0x5620d4)['then'](function(_0x59fcff){logger[_0x534e('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2760e7,_0x534e('0xd'));logger['debug'](_0x534e('0xe'),_0x2760e7,_0x534e('0xd'),JSON[_0x534e('0xf')](_0x59fcff));if(_0x59fcff['error']){if(_0x59fcff[_0x534e('0x10')][_0x534e('0x11')]===0x1f4){logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x59fcff[_0x534e('0x10')]['message']);return _0x929597(_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);}logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);return _0x24d562(_0x59fcff[_0x534e('0x10')][_0x534e('0x13')]);}else{logger[_0x534e('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2760e7,_0x534e('0xd'));_0x24d562(_0x59fcff[_0x534e('0x14')]['message']);}})['catch'](function(_0x2de9d0){logger[_0x534e('0x10')](_0x534e('0x12'),_0x2760e7,_0x2de9d0);_0x929597(_0x2de9d0);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7414469..dc17ba7 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 _0x8016=['get','index','isAuthenticated','show','post','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x5d7ff0,_0x39a2a7){var _0x31cf71=function(_0x14a802){while(--_0x14a802){_0x5d7ff0['push'](_0x5d7ff0['shift']());}};_0x31cf71(++_0x39a2a7);}(_0x8016,0x70));var _0x6801=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0x8016[_0x3e27ba];return _0x10b3f2;};'use strict';var multer=require('multer');var util=require(_0x6801('0x0'));var path=require(_0x6801('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6801('0x2')]();var auth=require(_0x6801('0x3'));var interaction=require(_0x6801('0x4'));var config=require(_0x6801('0x5'));var controller=require(_0x6801('0x6'));router[_0x6801('0x7')]('/',auth['isAuthenticated'](),controller[_0x6801('0x8')]);router['get']('/:id',auth[_0x6801('0x9')](),controller[_0x6801('0xa')]);router[_0x6801('0xb')]('/',auth[_0x6801('0x9')](),controller['create']);router['put'](_0x6801('0xc'),auth[_0x6801('0x9')](),controller[_0x6801('0xd')]);router[_0x6801('0xe')](_0x6801('0xc'),auth[_0x6801('0x9')](),controller[_0x6801('0xf')]);module[_0x6801('0x10')]=router; \ No newline at end of file +var _0x5b84=['post','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4fb982,_0x47314b){var _0x50242c=function(_0xfb1235){while(--_0xfb1235){_0x4fb982['push'](_0x4fb982['shift']());}};_0x50242c(++_0x47314b);}(_0x5b84,0x15c));var _0x45b8=function(_0x44b863,_0x51c6e6){_0x44b863=_0x44b863-0x0;var _0x452a18=_0x5b84[_0x44b863];return _0x452a18;};'use strict';var multer=require(_0x45b8('0x0'));var util=require(_0x45b8('0x1'));var path=require(_0x45b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x45b8('0x3'));var router=express['Router']();var auth=require(_0x45b8('0x4'));var interaction=require(_0x45b8('0x5'));var config=require('../../config/environment');var controller=require(_0x45b8('0x6'));router[_0x45b8('0x7')]('/',auth['isAuthenticated'](),controller[_0x45b8('0x8')]);router[_0x45b8('0x7')](_0x45b8('0x9'),auth[_0x45b8('0xa')](),controller[_0x45b8('0xb')]);router[_0x45b8('0xc')]('/',auth[_0x45b8('0xa')](),controller['create']);router['put'](_0x45b8('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x45b8('0x9'),auth[_0x45b8('0xa')](),controller[_0x45b8('0xd')]);module[_0x45b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 3ef65ba..8ca3be7 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 _0xef48=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x54b301,_0x3c7d79){var _0x30a7a8=function(_0x43d742){while(--_0x43d742){_0x54b301['push'](_0x54b301['shift']());}};_0x30a7a8(++_0x3c7d79);}(_0xef48,0x184));var _0x8ef4=function(_0x50afc8,_0x534c32){_0x50afc8=_0x50afc8-0x0;var _0x1d56cd=_0xef48[_0x50afc8];return _0x1d56cd;};'use strict';var Sequelize=require(_0x8ef4('0x0'));module['exports']={'type':{'type':Sequelize[_0x8ef4('0x1')](_0x8ef4('0x2'),_0x8ef4('0x3'),_0x8ef4('0x4'),_0x8ef4('0x5')),'defaultValue':_0x8ef4('0x2')},'content':{'type':Sequelize[_0x8ef4('0x6')]},'key':{'type':Sequelize[_0x8ef4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8ef4('0x2'),_0x8ef4('0x3'),_0x8ef4('0x4'))},'keyContent':{'type':Sequelize[_0x8ef4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8ef4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8ef4('0x6')]}}; \ No newline at end of file +var _0x4c5c=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x355558,_0x50307e){var _0x10c2ae=function(_0x2c2489){while(--_0x2c2489){_0x355558['push'](_0x355558['shift']());}};_0x10c2ae(++_0x50307e);}(_0x4c5c,0x8f));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4c5('0x0'));module[_0xc4c5('0x1')]={'type':{'type':Sequelize[_0xc4c5('0x2')](_0xc4c5('0x3'),_0xc4c5('0x4'),_0xc4c5('0x5'),_0xc4c5('0x6')),'defaultValue':_0xc4c5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc4c5('0x7')]},'keyType':{'type':Sequelize[_0xc4c5('0x2')]('string','variable',_0xc4c5('0x5'))},'keyContent':{'type':Sequelize[_0xc4c5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc4c5('0x7')]},'customField':{'type':Sequelize[_0xc4c5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 124e788..5cbb310 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 _0x1928=['moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1928,0x1ab));var _0x8192=function(_0x4f1cd3,_0x354c89){_0x4f1cd3=_0x4f1cd3-0x0;var _0x1d671c=_0x1928[_0x4f1cd3];return _0x1d671c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8192('0x0'));var rimraf=require(_0x8192('0x1'));var zipdir=require(_0x8192('0x2'));var jsonpatch=require(_0x8192('0x3'));var rp=require(_0x8192('0x4'));var moment=require(_0x8192('0x5'));var BPromise=require(_0x8192('0x6'));var Mustache=require(_0x8192('0x7'));var util=require(_0x8192('0x8'));var path=require(_0x8192('0x9'));var sox=require(_0x8192('0xa'));var csv=require(_0x8192('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8192('0xc'));var squel=require(_0x8192('0xd'));var crypto=require(_0x8192('0xe'));var jsforce=require(_0x8192('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8192('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8192('0x11'));var as=require(_0x8192('0x12'));var hardwareService=require(_0x8192('0x13'));var logger=require(_0x8192('0x14'))(_0x8192('0x15'));var utils=require(_0x8192('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aedaa,_0xcb204e){_0xcb204e=_0xcb204e||0xcc;return function(_0x275d){if(_0x275d){return _0x5aedaa[_0x8192('0x17')](_0xcb204e);}return _0x5aedaa[_0x8192('0x18')](_0xcb204e)[_0x8192('0x19')]();};}function respondWithResult(_0x599202,_0x190c32){_0x190c32=_0x190c32||0xc8;return function(_0x40e83b){if(_0x40e83b){return _0x599202['status'](_0x190c32)[_0x8192('0x1a')](_0x40e83b);}};}function respondWithFilteredResult(_0x2a181e,_0x1f3261){return function(_0x378e1d){if(_0x378e1d){var _0x11db8d=_0x378e1d[_0x8192('0x1b')],_0x41f602=_0x1f3261[_0x8192('0x1c')],_0x1c9926=_0x1f3261[_0x8192('0x1c')]+_0x1f3261[_0x8192('0x1d')],_0x598b1d;if(_0x1c9926>=_0x11db8d){_0x1c9926=_0x11db8d;_0x598b1d=0xc8;}else{_0x598b1d=0xce;}_0x2a181e[_0x8192('0x18')](_0x598b1d);return _0x2a181e[_0x8192('0x1e')]('Content-Range',_0x41f602+'-'+_0x1c9926+'/'+_0x11db8d)['json'](_0x378e1d);}return null;};}function patchUpdates(_0x29aa0b){return function(_0x5d7047){try{jsonpatch[_0x8192('0x1f')](_0x5d7047,_0x29aa0b,!![]);}catch(_0x513ad3){return BPromise[_0x8192('0x20')](_0x513ad3);}return _0x5d7047['save']();};}function saveUpdates(_0x4c199e,_0x49cc84){return function(_0x241ef5){if(_0x241ef5){return _0x241ef5[_0x8192('0x21')](_0x4c199e)[_0x8192('0x22')](function(_0x444312){return _0x444312;});}return null;};}function removeEntity(_0x41ae50,_0x44c03a){return function(_0x51b5e4){if(_0x51b5e4){return _0x51b5e4[_0x8192('0x23')]()[_0x8192('0x22')](function(){_0x41ae50['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197b5c,_0x491e51){return function(_0x1ea6f8){if(!_0x1ea6f8){_0x197b5c[_0x8192('0x17')](0x194);}return _0x1ea6f8;};}function handleError(_0x56b037,_0x2a291a){_0x2a291a=_0x2a291a||0x1f4;return function(_0xe60f43){logger[_0x8192('0x24')](_0xe60f43[_0x8192('0x25')]);if(_0xe60f43['name']){delete _0xe60f43[_0x8192('0x26')];}_0x56b037['status'](_0x2a291a)[_0x8192('0x27')](_0xe60f43);};}exports['index']=function(_0x47f632,_0x31066a){var _0xa97b5d={},_0x12f08c={},_0xe52f9f={'count':0x0,'rows':[]};var _0x4a3628=_[_0x8192('0x28')](db[_0x8192('0x29')][_0x8192('0x2a')],function(_0x1576cd){return{'name':_0x1576cd[_0x8192('0x2b')],'type':_0x1576cd[_0x8192('0x2c')]['key']};});_0x12f08c[_0x8192('0x2d')]=_[_0x8192('0x28')](_0x4a3628,_0x8192('0x26'));_0x12f08c['query']=_[_0x8192('0x2e')](_0x47f632[_0x8192('0x2f')]);_0x12f08c['filters']=_[_0x8192('0x30')](_0x12f08c[_0x8192('0x2d')],_0x12f08c[_0x8192('0x2f')]);_0xa97b5d[_0x8192('0x31')]=_[_0x8192('0x30')](_0x12f08c[_0x8192('0x2d')],qs[_0x8192('0x32')](_0x47f632[_0x8192('0x2f')]['fields']));_0xa97b5d[_0x8192('0x31')]=_0xa97b5d[_0x8192('0x31')]['length']?_0xa97b5d[_0x8192('0x31')]:_0x12f08c[_0x8192('0x2d')];if(!_0x47f632[_0x8192('0x2f')][_0x8192('0x33')](_0x8192('0x34'))){_0xa97b5d['limit']=qs[_0x8192('0x1d')](_0x47f632['query'][_0x8192('0x1d')]);_0xa97b5d[_0x8192('0x1c')]=qs['offset'](_0x47f632['query'][_0x8192('0x1c')]);}_0xa97b5d[_0x8192('0x35')]=qs[_0x8192('0x36')](_0x47f632[_0x8192('0x2f')][_0x8192('0x36')]);_0xa97b5d[_0x8192('0x37')]=qs['filters'](_[_0x8192('0x38')](_0x47f632[_0x8192('0x2f')],_0x12f08c[_0x8192('0x39')]),_0x4a3628);if(_0x47f632[_0x8192('0x2f')][_0x8192('0x3a')]){_0xa97b5d[_0x8192('0x37')]=_['merge'](_0xa97b5d[_0x8192('0x37')],{'$or':_['map'](_0x4a3628,function(_0x4a44e8){if(_0x4a44e8[_0x8192('0x2c')]!==_0x8192('0x3b')){var _0x962a4a={};_0x962a4a[_0x4a44e8[_0x8192('0x26')]]={'$like':'%'+_0x47f632[_0x8192('0x2f')][_0x8192('0x3a')]+'%'};return _0x962a4a;}})});}_0xa97b5d=_[_0x8192('0x3c')]({},_0xa97b5d,_0x47f632[_0x8192('0x3d')]);var _0x9f83d1={'where':_0xa97b5d[_0x8192('0x37')]};return db[_0x8192('0x29')][_0x8192('0x1b')](_0x9f83d1)[_0x8192('0x22')](function(_0x5b5b47){_0xe52f9f[_0x8192('0x1b')]=_0x5b5b47;if(_0x47f632[_0x8192('0x2f')][_0x8192('0x3e')]){_0xa97b5d['include']=[{'all':!![]}];}return db[_0x8192('0x29')][_0x8192('0x3f')](_0xa97b5d);})[_0x8192('0x22')](function(_0xf3e012){_0xe52f9f['rows']=_0xf3e012;return _0xe52f9f;})[_0x8192('0x22')](respondWithFilteredResult(_0x31066a,_0xa97b5d))[_0x8192('0x40')](handleError(_0x31066a,null));};exports[_0x8192('0x41')]=function(_0x135415,_0x2c2204){var _0x55024e={'raw':!![],'where':{'id':_0x135415[_0x8192('0x42')]['id']}},_0x5430d0={};_0x5430d0[_0x8192('0x2d')]=_[_0x8192('0x2e')](db['DeskField']['rawAttributes']);_0x5430d0[_0x8192('0x2f')]=_[_0x8192('0x2e')](_0x135415[_0x8192('0x2f')]);_0x5430d0[_0x8192('0x39')]=_['intersection'](_0x5430d0['model'],_0x5430d0[_0x8192('0x2f')]);_0x55024e[_0x8192('0x31')]=_[_0x8192('0x30')](_0x5430d0[_0x8192('0x2d')],qs[_0x8192('0x32')](_0x135415[_0x8192('0x2f')][_0x8192('0x32')]));_0x55024e[_0x8192('0x31')]=_0x55024e['attributes'][_0x8192('0x43')]?_0x55024e[_0x8192('0x31')]:_0x5430d0[_0x8192('0x2d')];if(_0x135415[_0x8192('0x2f')][_0x8192('0x3e')]){_0x55024e[_0x8192('0x44')]=[{'all':!![]}];}_0x55024e=_[_0x8192('0x3c')]({},_0x55024e,_0x135415['options']);return db[_0x8192('0x29')][_0x8192('0x45')](_0x55024e)[_0x8192('0x22')](handleEntityNotFound(_0x2c2204,null))['then'](respondWithResult(_0x2c2204,null))[_0x8192('0x40')](handleError(_0x2c2204,null));};exports[_0x8192('0x46')]=function(_0x16905d,_0x520c3d){return db[_0x8192('0x29')]['create'](_0x16905d[_0x8192('0x47')],{})['then'](respondWithResult(_0x520c3d,0xc9))[_0x8192('0x40')](handleError(_0x520c3d,null));};exports['update']=function(_0x118805,_0x439d73){if(_0x118805[_0x8192('0x47')]['id']){delete _0x118805[_0x8192('0x47')]['id'];}return db[_0x8192('0x29')][_0x8192('0x45')]({'where':{'id':_0x118805['params']['id']}})['then'](handleEntityNotFound(_0x439d73,null))[_0x8192('0x22')](saveUpdates(_0x118805['body'],null))[_0x8192('0x22')](respondWithResult(_0x439d73,null))['catch'](handleError(_0x439d73,null));};exports[_0x8192('0x23')]=function(_0x42fd58,_0xbf6188){return db['DeskField'][_0x8192('0x45')]({'where':{'id':_0x42fd58[_0x8192('0x42')]['id']}})['then'](handleEntityNotFound(_0xbf6188,null))[_0x8192('0x22')](removeEntity(_0xbf6188,null))['catch'](handleError(_0xbf6188,null));}; \ No newline at end of file +var _0x4ab4=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','count','offset','set','apply','reject','then','sendStatus','error','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','DeskField','findAll','catch','show','params','includeAll','include','options','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x473bd8,_0x248764){var _0x1eb569=function(_0x1f1e80){while(--_0x1f1e80){_0x473bd8['push'](_0x473bd8['shift']());}};_0x1eb569(++_0x248764);}(_0x4ab4,0x160));var _0x44ab=function(_0x122ea3,_0x13d58b){_0x122ea3=_0x122ea3-0x0;var _0x44e217=_0x4ab4[_0x122ea3];return _0x44e217;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x44ab('0x0'));var zipdir=require(_0x44ab('0x1'));var jsonpatch=require(_0x44ab('0x2'));var rp=require(_0x44ab('0x3'));var moment=require(_0x44ab('0x4'));var BPromise=require(_0x44ab('0x5'));var Mustache=require(_0x44ab('0x6'));var util=require('util');var path=require(_0x44ab('0x7'));var sox=require(_0x44ab('0x8'));var csv=require(_0x44ab('0x9'));var ejs=require(_0x44ab('0xa'));var fs=require('fs');var _=require(_0x44ab('0xb'));var squel=require(_0x44ab('0xc'));var crypto=require(_0x44ab('0xd'));var jsforce=require(_0x44ab('0xe'));var deskjs=require(_0x44ab('0xf'));var toCsv=require(_0x44ab('0x9'));var querystring=require(_0x44ab('0x10'));var Papa=require(_0x44ab('0x11'));var Redis=require(_0x44ab('0x12'));var authService=require(_0x44ab('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44ab('0x14'));var logger=require(_0x44ab('0x15'))('api');var utils=require(_0x44ab('0x16'));var config=require('../../config/environment');var db=require(_0x44ab('0x17'))['db'];function respondWithStatusCode(_0x5018d9,_0x24d1e9){_0x24d1e9=_0x24d1e9||0xcc;return function(_0x369894){if(_0x369894){return _0x5018d9['sendStatus'](_0x24d1e9);}return _0x5018d9[_0x44ab('0x18')](_0x24d1e9)[_0x44ab('0x19')]();};}function respondWithResult(_0x551a55,_0x18826a){_0x18826a=_0x18826a||0xc8;return function(_0x3abb09){if(_0x3abb09){return _0x551a55[_0x44ab('0x18')](_0x18826a)[_0x44ab('0x1a')](_0x3abb09);}};}function respondWithFilteredResult(_0x3e07bb,_0x1ac774){return function(_0x5d844b){if(_0x5d844b){var _0x55aea0=_0x5d844b[_0x44ab('0x1b')],_0x2e4c6f=_0x1ac774[_0x44ab('0x1c')],_0x4b0212=_0x1ac774[_0x44ab('0x1c')]+_0x1ac774['limit'],_0x595b4a;if(_0x4b0212>=_0x55aea0){_0x4b0212=_0x55aea0;_0x595b4a=0xc8;}else{_0x595b4a=0xce;}_0x3e07bb[_0x44ab('0x18')](_0x595b4a);return _0x3e07bb[_0x44ab('0x1d')]('Content-Range',_0x2e4c6f+'-'+_0x4b0212+'/'+_0x55aea0)[_0x44ab('0x1a')](_0x5d844b);}return null;};}function patchUpdates(_0x31547c){return function(_0x4fd054){try{jsonpatch[_0x44ab('0x1e')](_0x4fd054,_0x31547c,!![]);}catch(_0x40dc83){return BPromise[_0x44ab('0x1f')](_0x40dc83);}return _0x4fd054['save']();};}function saveUpdates(_0x15aeed,_0xad308b){return function(_0x3d14ec){if(_0x3d14ec){return _0x3d14ec['update'](_0x15aeed)['then'](function(_0x29da41){return _0x29da41;});}return null;};}function removeEntity(_0x51b882,_0xfc5f42){return function(_0x54c7f8){if(_0x54c7f8){return _0x54c7f8['destroy']()[_0x44ab('0x20')](function(){_0x51b882['status'](0xcc)[_0x44ab('0x19')]();});}};}function handleEntityNotFound(_0x244cbb,_0x3d2ea4){return function(_0xc5a346){if(!_0xc5a346){_0x244cbb[_0x44ab('0x21')](0x194);}return _0xc5a346;};}function handleError(_0x276546,_0x13240c){_0x13240c=_0x13240c||0x1f4;return function(_0x36ad50){logger[_0x44ab('0x22')](_0x36ad50['stack']);if(_0x36ad50['name']){delete _0x36ad50['name'];}_0x276546[_0x44ab('0x18')](_0x13240c)[_0x44ab('0x23')](_0x36ad50);};}exports['index']=function(_0x573900,_0xf95a40){var _0x142212={},_0x213e6f={},_0x2aa0de={'count':0x0,'rows':[]};var _0x36ce13=_[_0x44ab('0x24')](db['DeskField'][_0x44ab('0x25')],function(_0x3fd555){return{'name':_0x3fd555[_0x44ab('0x26')],'type':_0x3fd555[_0x44ab('0x27')][_0x44ab('0x28')]};});_0x213e6f['model']=_[_0x44ab('0x24')](_0x36ce13,'name');_0x213e6f[_0x44ab('0x29')]=_[_0x44ab('0x2a')](_0x573900[_0x44ab('0x29')]);_0x213e6f[_0x44ab('0x2b')]=_[_0x44ab('0x2c')](_0x213e6f[_0x44ab('0x2d')],_0x213e6f['query']);_0x142212[_0x44ab('0x2e')]=_['intersection'](_0x213e6f['model'],qs[_0x44ab('0x2f')](_0x573900[_0x44ab('0x29')][_0x44ab('0x2f')]));_0x142212[_0x44ab('0x2e')]=_0x142212[_0x44ab('0x2e')][_0x44ab('0x30')]?_0x142212[_0x44ab('0x2e')]:_0x213e6f[_0x44ab('0x2d')];if(!_0x573900['query'][_0x44ab('0x31')](_0x44ab('0x32'))){_0x142212[_0x44ab('0x33')]=qs['limit'](_0x573900[_0x44ab('0x29')]['limit']);_0x142212[_0x44ab('0x1c')]=qs[_0x44ab('0x1c')](_0x573900[_0x44ab('0x29')][_0x44ab('0x1c')]);}_0x142212[_0x44ab('0x34')]=qs[_0x44ab('0x35')](_0x573900['query'][_0x44ab('0x35')]);_0x142212[_0x44ab('0x36')]=qs[_0x44ab('0x2b')](_[_0x44ab('0x37')](_0x573900[_0x44ab('0x29')],_0x213e6f['filters']),_0x36ce13);if(_0x573900['query']['filter']){_0x142212[_0x44ab('0x36')]=_[_0x44ab('0x38')](_0x142212[_0x44ab('0x36')],{'$or':_[_0x44ab('0x24')](_0x36ce13,function(_0x2d132b){if(_0x2d132b[_0x44ab('0x27')]!==_0x44ab('0x39')){var _0x5036b3={};_0x5036b3[_0x2d132b['name']]={'$like':'%'+_0x573900['query'][_0x44ab('0x3a')]+'%'};return _0x5036b3;}})});}_0x142212=_['merge']({},_0x142212,_0x573900['options']);var _0x38f754={'where':_0x142212[_0x44ab('0x36')]};return db[_0x44ab('0x3b')]['count'](_0x38f754)[_0x44ab('0x20')](function(_0x37b9a7){_0x2aa0de[_0x44ab('0x1b')]=_0x37b9a7;if(_0x573900[_0x44ab('0x29')]['includeAll']){_0x142212['include']=[{'all':!![]}];}return db[_0x44ab('0x3b')][_0x44ab('0x3c')](_0x142212);})[_0x44ab('0x20')](function(_0x5cc247){_0x2aa0de['rows']=_0x5cc247;return _0x2aa0de;})[_0x44ab('0x20')](respondWithFilteredResult(_0xf95a40,_0x142212))[_0x44ab('0x3d')](handleError(_0xf95a40,null));};exports[_0x44ab('0x3e')]=function(_0x1c9e60,_0x80a264){var _0x17849b={'raw':!![],'where':{'id':_0x1c9e60[_0x44ab('0x3f')]['id']}},_0x14157b={};_0x14157b[_0x44ab('0x2d')]=_['keys'](db['DeskField'][_0x44ab('0x25')]);_0x14157b['query']=_[_0x44ab('0x2a')](_0x1c9e60[_0x44ab('0x29')]);_0x14157b[_0x44ab('0x2b')]=_[_0x44ab('0x2c')](_0x14157b[_0x44ab('0x2d')],_0x14157b['query']);_0x17849b[_0x44ab('0x2e')]=_[_0x44ab('0x2c')](_0x14157b['model'],qs[_0x44ab('0x2f')](_0x1c9e60[_0x44ab('0x29')][_0x44ab('0x2f')]));_0x17849b[_0x44ab('0x2e')]=_0x17849b[_0x44ab('0x2e')][_0x44ab('0x30')]?_0x17849b['attributes']:_0x14157b['model'];if(_0x1c9e60['query'][_0x44ab('0x40')]){_0x17849b[_0x44ab('0x41')]=[{'all':!![]}];}_0x17849b=_[_0x44ab('0x38')]({},_0x17849b,_0x1c9e60[_0x44ab('0x42')]);return db['DeskField'][_0x44ab('0x43')](_0x17849b)['then'](handleEntityNotFound(_0x80a264,null))[_0x44ab('0x20')](respondWithResult(_0x80a264,null))[_0x44ab('0x3d')](handleError(_0x80a264,null));};exports[_0x44ab('0x44')]=function(_0x2d93d4,_0x3c1b18){return db[_0x44ab('0x3b')][_0x44ab('0x44')](_0x2d93d4[_0x44ab('0x45')],{})[_0x44ab('0x20')](respondWithResult(_0x3c1b18,0xc9))['catch'](handleError(_0x3c1b18,null));};exports[_0x44ab('0x46')]=function(_0x448c6a,_0x5837fe){if(_0x448c6a['body']['id']){delete _0x448c6a['body']['id'];}return db[_0x44ab('0x3b')][_0x44ab('0x43')]({'where':{'id':_0x448c6a[_0x44ab('0x3f')]['id']}})[_0x44ab('0x20')](handleEntityNotFound(_0x5837fe,null))[_0x44ab('0x20')](saveUpdates(_0x448c6a[_0x44ab('0x45')],null))[_0x44ab('0x20')](respondWithResult(_0x5837fe,null))[_0x44ab('0x3d')](handleError(_0x5837fe,null));};exports[_0x44ab('0x47')]=function(_0x5b1306,_0x2d6094){return db['DeskField']['find']({'where':{'id':_0x5b1306[_0x44ab('0x3f')]['id']}})[_0x44ab('0x20')](handleEntityNotFound(_0x2d6094,null))[_0x44ab('0x20')](removeEntity(_0x2d6094,null))[_0x44ab('0x3d')](handleError(_0x2d6094,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 086bfa7..186855f 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 _0xb93a=['rimraf','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0xb93a,0x104));var _0xab93=function(_0x18d7cb,_0xe8fb8d){_0x18d7cb=_0x18d7cb-0x0;var _0x548013=_0xb93a[_0x18d7cb];return _0x548013;};'use strict';var _=require(_0xab93('0x0'));var util=require(_0xab93('0x1'));var logger=require(_0xab93('0x2'))(_0xab93('0x3'));var moment=require(_0xab93('0x4'));var BPromise=require('bluebird');var rp=require(_0xab93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab93('0x6'));var config=require('../../config/environment');var attributes=require(_0xab93('0x7'));module[_0xab93('0x8')]=function(_0x1601f1,_0x191a45){return _0x1601f1[_0xab93('0x9')]('DeskField',attributes,{'tableName':_0xab93('0xa'),'paranoid':![],'indexes':[{'name':_0xab93('0xb'),'fields':[_0xab93('0xc'),_0xab93('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34ca=['../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xbb5943,_0x36c0bb){var _0x1c8856=function(_0x31f20f){while(--_0x31f20f){_0xbb5943['push'](_0xbb5943['shift']());}};_0x1c8856(++_0x36c0bb);}(_0x34ca,0x14c));var _0xa34c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x34ca[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa34c('0x0'))('api');var moment=require(_0xa34c('0x1'));var BPromise=require(_0xa34c('0x2'));var rp=require(_0xa34c('0x3'));var fs=require('fs');var path=require(_0xa34c('0x4'));var rimraf=require(_0xa34c('0x5'));var config=require(_0xa34c('0x6'));var attributes=require(_0xa34c('0x7'));module[_0xa34c('0x8')]=function(_0xa43e09,_0x597487){return _0xa43e09[_0xa34c('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa34c('0xa'),'fields':[_0xa34c('0xb'),_0xa34c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index a7f14d3..208bfea 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 _0x77d9=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2cfd2a,_0x426163){var _0x47d0d1=function(_0x25ea39){while(--_0x25ea39){_0x2cfd2a['push'](_0x2cfd2a['shift']());}};_0x47d0d1(++_0x426163);}(_0x77d9,0x1b7));var _0x977d=function(_0x406e9f,_0x49adee){_0x406e9f=_0x406e9f-0x0;var _0x500565=_0x77d9[_0x406e9f];return _0x500565;};'use strict';var _=require(_0x977d('0x0'));var util=require(_0x977d('0x1'));var moment=require(_0x977d('0x2'));var BPromise=require(_0x977d('0x3'));var rs=require(_0x977d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x977d('0x5'))['db'];var utils=require(_0x977d('0x6'));var logger=require('../../config/logger')(_0x977d('0x7'));var config=require(_0x977d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x977d('0x9')][_0x977d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x340552,_0x152a0b,_0x44c1b6){return new BPromise(function(_0x2c9aab,_0x5480f1){return client[_0x977d('0xb')](_0x340552,_0x44c1b6)[_0x977d('0xc')](function(_0x2fd537){logger['info'](_0x977d('0xd'),_0x152a0b,_0x977d('0xe'));logger['debug'](_0x977d('0xf'),_0x152a0b,_0x977d('0xe'),JSON[_0x977d('0x10')](_0x2fd537));if(_0x2fd537[_0x977d('0x11')]){if(_0x2fd537[_0x977d('0x11')][_0x977d('0x12')]===0x1f4){logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x2fd537[_0x977d('0x11')][_0x977d('0x13')]);return _0x5480f1(_0x2fd537[_0x977d('0x11')]['message']);}logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x2fd537['error'][_0x977d('0x13')]);return _0x2c9aab(_0x2fd537['error'][_0x977d('0x13')]);}else{logger[_0x977d('0x14')](_0x977d('0xd'),_0x152a0b,_0x977d('0xe'));_0x2c9aab(_0x2fd537[_0x977d('0x15')][_0x977d('0x13')]);}})[_0x977d('0x16')](function(_0x20906e){logger[_0x977d('0x11')](_0x977d('0xd'),_0x152a0b,_0x20906e);_0x5480f1(_0x20906e);});});} \ No newline at end of file +var _0x89d8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2b5ac0,_0xb5a7f4){var _0x158a55=function(_0x3672c2){while(--_0x3672c2){_0x2b5ac0['push'](_0x2b5ac0['shift']());}};_0x158a55(++_0xb5a7f4);}(_0x89d8,0xbf));var _0x889d=function(_0x1c2558,_0x5753be){_0x1c2558=_0x1c2558-0x0;var _0x527cfb=_0x89d8[_0x1c2558];return _0x527cfb;};'use strict';var _=require(_0x889d('0x0'));var util=require(_0x889d('0x1'));var moment=require(_0x889d('0x2'));var BPromise=require(_0x889d('0x3'));var rs=require(_0x889d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x889d('0x5'))['db'];var utils=require(_0x889d('0x6'));var logger=require(_0x889d('0x7'))(_0x889d('0x8'));var config=require(_0x889d('0x9'));var jayson=require(_0x889d('0xa'));var client=jayson['client'][_0x889d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3c3d,_0x457d47,_0x43cbd0){return new BPromise(function(_0x413348,_0x19b760){return client[_0x889d('0xc')](_0x2d3c3d,_0x43cbd0)['then'](function(_0x5624ef){logger[_0x889d('0xd')](_0x889d('0xe'),_0x457d47,_0x889d('0xf'));logger[_0x889d('0x10')](_0x889d('0x11'),_0x457d47,_0x889d('0xf'),JSON[_0x889d('0x12')](_0x5624ef));if(_0x5624ef['error']){if(_0x5624ef[_0x889d('0x13')]['code']===0x1f4){logger['error'](_0x889d('0xe'),_0x457d47,_0x5624ef['error'][_0x889d('0x14')]);return _0x19b760(_0x5624ef[_0x889d('0x13')][_0x889d('0x14')]);}logger[_0x889d('0x13')]('DeskField,\x20%s,\x20%s',_0x457d47,_0x5624ef[_0x889d('0x13')][_0x889d('0x14')]);return _0x413348(_0x5624ef['error']['message']);}else{logger[_0x889d('0xd')](_0x889d('0xe'),_0x457d47,_0x889d('0xf'));_0x413348(_0x5624ef[_0x889d('0x15')][_0x889d('0x14')]);}})['catch'](function(_0x222d4a){logger['error']('DeskField,\x20%s,\x20%s',_0x457d47,_0x222d4a);_0x19b760(_0x222d4a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 09ec797..f290aa6 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 _0x5192=['get','/:id/fields','getFields','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','isAuthenticated','show','/:id/configurations'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0x5192,0x153));var _0x2519=function(_0x326393,_0x62ce5a){_0x326393=_0x326393-0x0;var _0x4037a2=_0x5192[_0x326393];return _0x4037a2;};'use strict';var multer=require(_0x2519('0x0'));var util=require(_0x2519('0x1'));var path=require(_0x2519('0x2'));var timeout=require(_0x2519('0x3'));var express=require(_0x2519('0x4'));var router=express['Router']();var auth=require(_0x2519('0x5'));var interaction=require(_0x2519('0x6'));var config=require(_0x2519('0x7'));var controller=require(_0x2519('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2519('0x9')]);router['get']('/:id',auth[_0x2519('0xa')](),controller[_0x2519('0xb')]);router['get'](_0x2519('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2519('0xd')](_0x2519('0xe'),auth[_0x2519('0xa')](),controller[_0x2519('0xf')]);router[_0x2519('0x10')]('/',auth[_0x2519('0xa')](),controller['create']);router[_0x2519('0x10')](_0x2519('0xc'),auth[_0x2519('0xa')](),controller['addConfiguration']);router[_0x2519('0x11')](_0x2519('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x2519('0x13')](_0x2519('0x12'),auth['isAuthenticated'](),controller[_0x2519('0x14')]);module[_0x2519('0x15')]=router; \ No newline at end of file +var _0xaefe=['index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x35a047,_0x182466){var _0x46adf6=function(_0x3be8dc){while(--_0x3be8dc){_0x35a047['push'](_0x35a047['shift']());}};_0x46adf6(++_0x182466);}(_0xaefe,0x156));var _0xeaef=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xaefe[_0x3f2d02];return _0x54092b;};'use strict';var multer=require(_0xeaef('0x0'));var util=require(_0xeaef('0x1'));var path=require('path');var timeout=require(_0xeaef('0x2'));var express=require(_0xeaef('0x3'));var router=express['Router']();var auth=require(_0xeaef('0x4'));var interaction=require(_0xeaef('0x5'));var config=require(_0xeaef('0x6'));var controller=require(_0xeaef('0x7'));router[_0xeaef('0x8')]('/',auth[_0xeaef('0x9')](),controller[_0xeaef('0xa')]);router[_0xeaef('0x8')](_0xeaef('0xb'),auth[_0xeaef('0x9')](),controller[_0xeaef('0xc')]);router['get'](_0xeaef('0xd'),auth[_0xeaef('0x9')](),controller['getConfigurations']);router[_0xeaef('0x8')](_0xeaef('0xe'),auth['isAuthenticated'](),controller[_0xeaef('0xf')]);router[_0xeaef('0x10')]('/',auth[_0xeaef('0x9')](),controller[_0xeaef('0x11')]);router[_0xeaef('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xeaef('0x12')]);router['put'](_0xeaef('0xb'),auth[_0xeaef('0x9')](),controller['update']);router[_0xeaef('0x13')](_0xeaef('0xb'),auth[_0xeaef('0x9')](),controller[_0xeaef('0x14')]);module[_0xeaef('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 f9f6f38..394f97a 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 _0xead0=['STRING','sequelize'];(function(_0x31c3d5,_0x40a38c){var _0x5424ba=function(_0x15b7fa){while(--_0x15b7fa){_0x31c3d5['push'](_0x31c3d5['shift']());}};_0x5424ba(++_0x40a38c);}(_0xead0,0x193));var _0x0ead=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xead0[_0x456b77];return _0x118bb6;};'use strict';var Sequelize=require(_0x0ead('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0ead('0x1')]},'password':{'type':Sequelize[_0x0ead('0x1')]},'remoteUri':{'type':Sequelize[_0x0ead('0x1')]},'tenantId':{'type':Sequelize[_0x0ead('0x1')]},'clientId':{'type':Sequelize[_0x0ead('0x1')]},'clientSecret':{'type':Sequelize[_0x0ead('0x1')]},'serverUrl':{'type':Sequelize[_0x0ead('0x1')]},'description':{'type':Sequelize[_0x0ead('0x1')]}}; \ No newline at end of file +var _0x1953=['exports','STRING','sequelize'];(function(_0x212d96,_0x320b7){var _0x4f356c=function(_0x2f0dcd){while(--_0x2f0dcd){_0x212d96['push'](_0x212d96['shift']());}};_0x4f356c(++_0x320b7);}(_0x1953,0x170));var _0x3195=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1953[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x3195('0x0'));module[_0x3195('0x1')]={'name':{'type':Sequelize[_0x3195('0x2')]},'username':{'type':Sequelize[_0x3195('0x2')]},'password':{'type':Sequelize[_0x3195('0x2')]},'remoteUri':{'type':Sequelize[_0x3195('0x2')]},'tenantId':{'type':Sequelize[_0x3195('0x2')]},'clientId':{'type':Sequelize[_0x3195('0x2')]},'clientSecret':{'type':Sequelize[_0x3195('0x2')]},'serverUrl':{'type':Sequelize[_0x3195('0x2')]},'description':{'type':Sequelize[_0x3195('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index e860041..99d6787 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 _0x4c6e=['timezoneruleversionnumber','traversedpath','versionnumber','concat','username','remoteUri','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','Bearer\x20','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','stack','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','update','destroy','name','send','map','Dynamics365Account','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','type','Descriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber'];(function(_0x13c5df,_0xc3bfde){var _0x170647=function(_0x2c885b){while(--_0x2c885b){_0x13c5df['push'](_0x13c5df['shift']());}};_0x170647(++_0xc3bfde);}(_0x4c6e,0x105));var _0xe4c6=function(_0x729164,_0x55025a){_0x729164=_0x729164-0x0;var _0x4e677a=_0x4c6e[_0x729164];return _0x4e677a;};'use strict';var pdf=require(_0xe4c6('0x0'));var emlformat=require(_0xe4c6('0x1'));var rimraf=require(_0xe4c6('0x2'));var zipdir=require(_0xe4c6('0x3'));var jsonpatch=require(_0xe4c6('0x4'));var rp=require('request-promise');var moment=require(_0xe4c6('0x5'));var BPromise=require(_0xe4c6('0x6'));var Mustache=require(_0xe4c6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe4c6('0x8'));var ejs=require(_0xe4c6('0x9'));var fs=require('fs');var _=require(_0xe4c6('0xa'));var squel=require(_0xe4c6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4c6('0x8'));var querystring=require('querystring');var Papa=require(_0xe4c6('0xc'));var Redis=require(_0xe4c6('0xd'));var authService=require(_0xe4c6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c6('0xf'));var hardwareService=require(_0xe4c6('0x10'));var logger=require(_0xe4c6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe4c6('0x12'));var db=require(_0xe4c6('0x13'))['db'];var integrations=require(_0xe4c6('0x14'));var jayson=require(_0xe4c6('0x15'));var client=jayson['client'][_0xe4c6('0x16')]({'port':0x232a});function checkPasswordPattern(_0x118b6b,_0x3fdb0e,_0x503be3){if(_0x503be3){var _0x455e13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x455e13[_0xe4c6('0x17')](_0x3fdb0e)){return _0x118b6b;}else{throw new db[(_0xe4c6('0x18'))][(_0xe4c6('0x19'))](_0xe4c6('0x1a'));}}else{return _0x118b6b;}}function respondWithRpcPromise(_0xbc4e4a,_0x3c2c9a,_0x4889a3,_0x4adf00){return new BPromise(function(_0x12c15e,_0x358a1e){var _0x563de3=_0x4adf00||client;return _0x563de3['request'](_0xbc4e4a,_0x4889a3)[_0xe4c6('0x1b')](function(_0xbb448c){logger[_0xe4c6('0x1c')](_0xe4c6('0x1d'),_0x3c2c9a,_0xe4c6('0x1e'));logger[_0xe4c6('0x1f')](_0xe4c6('0x20'),_0x3c2c9a,_0xe4c6('0x1e'),JSON[_0xe4c6('0x21')](_0xbb448c));if(_0xbb448c[_0xe4c6('0x22')]){if(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x23')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3c2c9a,_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);return _0x358a1e(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);}logger['error'](_0xe4c6('0x1d'),_0x3c2c9a,_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);return _0x12c15e(_0xbb448c[_0xe4c6('0x22')][_0xe4c6('0x24')]);}else{logger[_0xe4c6('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x3c2c9a,_0xe4c6('0x1e'));_0x12c15e(_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x24')]);}})['catch'](function(_0x2d7a8a){logger[_0xe4c6('0x22')](_0xe4c6('0x1d'),_0x3c2c9a,_0x2d7a8a);_0x358a1e(_0x2d7a8a);});});}function respondWithStatusCode(_0x1d1d3b,_0x2464d5){_0x2464d5=_0x2464d5||0xcc;return function(_0x24d7a2){if(_0x24d7a2){return _0x1d1d3b[_0xe4c6('0x26')](_0x2464d5);}return _0x1d1d3b[_0xe4c6('0x27')](_0x2464d5)[_0xe4c6('0x28')]();};}function respondWithResult(_0x46b180,_0x414f52){_0x414f52=_0x414f52||0xc8;return function(_0x59555b){if(_0x59555b){return _0x46b180['status'](_0x414f52)['json'](_0x59555b);}};}function respondWithFilteredResult(_0x1ce1c8,_0x17d842){return function(_0x19cbd5){if(_0x19cbd5){var _0x2a1bb8=_0x19cbd5[_0xe4c6('0x29')],_0x295da7=_0x17d842['offset'],_0xaa0b98=_0x17d842[_0xe4c6('0x2a')]+_0x17d842['limit'],_0x26232a;if(_0xaa0b98>=_0x2a1bb8){_0xaa0b98=_0x2a1bb8;_0x26232a=0xc8;}else{_0x26232a=0xce;}_0x1ce1c8[_0xe4c6('0x27')](_0x26232a);return _0x1ce1c8['set'](_0xe4c6('0x2b'),_0x295da7+'-'+_0xaa0b98+'/'+_0x2a1bb8)[_0xe4c6('0x2c')](_0x19cbd5);}return null;};}function patchUpdates(_0x4d3707){return function(_0x5eb190){try{jsonpatch[_0xe4c6('0x2d')](_0x5eb190,_0x4d3707,!![]);}catch(_0x57e372){return BPromise[_0xe4c6('0x2e')](_0x57e372);}return _0x5eb190['save']();};}function saveUpdates(_0xac7548,_0x295dfa){return function(_0x5a9132){if(_0x5a9132){return _0x5a9132[_0xe4c6('0x2f')](_0xac7548)[_0xe4c6('0x1b')](function(_0x4b3e78){return _0x4b3e78;});}return null;};}function removeEntity(_0x230daf,_0x1d484b){return function(_0x347d33){if(_0x347d33){return _0x347d33[_0xe4c6('0x30')]()[_0xe4c6('0x1b')](function(){_0x230daf['status'](0xcc)[_0xe4c6('0x28')]();});}};}function handleEntityNotFound(_0x3e93c8,_0x2dabae){return function(_0x5aa468){if(!_0x5aa468){_0x3e93c8[_0xe4c6('0x26')](0x194);}return _0x5aa468;};}function handleError(_0x4061e9,_0x1a5c66){_0x1a5c66=_0x1a5c66||0x1f4;return function(_0xf6d54){logger[_0xe4c6('0x22')](_0xf6d54['stack']);if(_0xf6d54[_0xe4c6('0x31')]){delete _0xf6d54[_0xe4c6('0x31')];}_0x4061e9[_0xe4c6('0x27')](_0x1a5c66)[_0xe4c6('0x32')](_0xf6d54);};}exports['index']=function(_0x4bb787,_0x20dc13){var _0xc59ba9={},_0x2d7aa3={},_0x1110f8={'count':0x0,'rows':[]};var _0x50f833=_[_0xe4c6('0x33')](db[_0xe4c6('0x34')]['rawAttributes'],function(_0x34b98f){return{'name':_0x34b98f[_0xe4c6('0x35')],'type':_0x34b98f['type'][_0xe4c6('0x36')]};});_0x2d7aa3[_0xe4c6('0x37')]=_[_0xe4c6('0x33')](_0x50f833,'name');_0x2d7aa3['query']=_[_0xe4c6('0x38')](_0x4bb787[_0xe4c6('0x39')]);_0x2d7aa3[_0xe4c6('0x3a')]=_[_0xe4c6('0x3b')](_0x2d7aa3[_0xe4c6('0x37')],_0x2d7aa3['query']);_0xc59ba9[_0xe4c6('0x3c')]=_[_0xe4c6('0x3b')](_0x2d7aa3[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0xc59ba9['attributes']=_0xc59ba9[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0xc59ba9[_0xe4c6('0x3c')]:_0x2d7aa3[_0xe4c6('0x37')];if(!_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x3f')](_0xe4c6('0x40'))){_0xc59ba9[_0xe4c6('0x41')]=qs['limit'](_0x4bb787[_0xe4c6('0x39')]['limit']);_0xc59ba9[_0xe4c6('0x2a')]=qs['offset'](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x2a')]);}_0xc59ba9[_0xe4c6('0x42')]=qs[_0xe4c6('0x43')](_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x43')]);_0xc59ba9[_0xe4c6('0x44')]=qs[_0xe4c6('0x3a')](_[_0xe4c6('0x45')](_0x4bb787[_0xe4c6('0x39')],_0x2d7aa3[_0xe4c6('0x3a')]),_0x50f833);if(_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x46')]){_0xc59ba9[_0xe4c6('0x44')]=_['merge'](_0xc59ba9[_0xe4c6('0x44')],{'$or':_[_0xe4c6('0x33')](_0x50f833,function(_0x1887a7){if(_0x1887a7['type']!==_0xe4c6('0x47')){var _0x1bd6e8={};_0x1bd6e8[_0x1887a7[_0xe4c6('0x31')]]={'$like':'%'+_0x4bb787[_0xe4c6('0x39')][_0xe4c6('0x46')]+'%'};return _0x1bd6e8;}})});}_0xc59ba9=_['merge']({},_0xc59ba9,_0x4bb787[_0xe4c6('0x48')]);var _0x31932e={'where':_0xc59ba9[_0xe4c6('0x44')]};return db[_0xe4c6('0x34')][_0xe4c6('0x29')](_0x31932e)['then'](function(_0x204fb1){_0x1110f8[_0xe4c6('0x29')]=_0x204fb1;if(_0x4bb787['query'][_0xe4c6('0x49')]){_0xc59ba9[_0xe4c6('0x4a')]=[{'all':!![]}];}return db[_0xe4c6('0x34')][_0xe4c6('0x4b')](_0xc59ba9);})['then'](function(_0x2e6114){_0x1110f8[_0xe4c6('0x4c')]=_0x2e6114;return _0x1110f8;})[_0xe4c6('0x1b')](respondWithFilteredResult(_0x20dc13,_0xc59ba9))[_0xe4c6('0x4d')](handleError(_0x20dc13,null));};exports['show']=function(_0x5840ad,_0x1f89ba){var _0x28a081={'raw':![],'where':{'id':_0x5840ad[_0xe4c6('0x4e')]['id']}},_0x47f624={};_0x47f624['model']=_['keys'](db[_0xe4c6('0x34')][_0xe4c6('0x4f')]);_0x47f624['query']=_['keys'](_0x5840ad[_0xe4c6('0x39')]);_0x47f624[_0xe4c6('0x3a')]=_['intersection'](_0x47f624[_0xe4c6('0x37')],_0x47f624[_0xe4c6('0x39')]);_0x28a081[_0xe4c6('0x3c')]=_['intersection'](_0x47f624[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x5840ad[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0x28a081[_0xe4c6('0x3c')]=_0x28a081[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0x28a081[_0xe4c6('0x3c')]:_0x47f624[_0xe4c6('0x37')];if(_0x5840ad[_0xe4c6('0x39')]['includeAll']){_0x28a081[_0xe4c6('0x4a')]=[{'all':!![]}];}_0x28a081=_[_0xe4c6('0x50')]({},_0x28a081,_0x5840ad[_0xe4c6('0x48')]);return db[_0xe4c6('0x34')][_0xe4c6('0x51')](_0x28a081)['then'](handleEntityNotFound(_0x1f89ba,null))[_0xe4c6('0x1b')](respondWithResult(_0x1f89ba,null))[_0xe4c6('0x4d')](handleError(_0x1f89ba,null));};exports[_0xe4c6('0x52')]=function(_0xc390d9,_0x53d41d){return db[_0xe4c6('0x34')][_0xe4c6('0x52')](_0xc390d9[_0xe4c6('0x53')],{})[_0xe4c6('0x1b')](respondWithResult(_0x53d41d,0xc9))[_0xe4c6('0x4d')](handleError(_0x53d41d,null));};exports[_0xe4c6('0x2f')]=function(_0x155f15,_0x422b61){if(_0x155f15[_0xe4c6('0x53')]['id']){delete _0x155f15['body']['id'];}return db[_0xe4c6('0x34')][_0xe4c6('0x51')]({'where':{'id':_0x155f15[_0xe4c6('0x4e')]['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x422b61,null))[_0xe4c6('0x1b')](saveUpdates(_0x155f15[_0xe4c6('0x53')],null))['then'](respondWithResult(_0x422b61,null))[_0xe4c6('0x4d')](handleError(_0x422b61,null));};exports[_0xe4c6('0x30')]=function(_0x3a36be,_0x5f223b){return db[_0xe4c6('0x34')][_0xe4c6('0x51')]({'where':{'id':_0x3a36be['params']['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x5f223b,null))[_0xe4c6('0x1b')](removeEntity(_0x5f223b,null))['catch'](handleError(_0x5f223b,null));};exports[_0xe4c6('0x54')]=function(_0x325ada,_0x2967a7,_0x249b20){var _0x1a23f5={};var _0x5bb8a2={};var _0x3e6a43;var _0x2e404e;return db['Dynamics365Account']['findOne']({'where':{'id':_0x325ada['params']['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x2967a7,null))[_0xe4c6('0x1b')](function(_0x5565a0){if(_0x5565a0){_0x3e6a43=_0x5565a0;_0x5bb8a2['model']=_[_0xe4c6('0x38')](db['Dynamics365Configuration'][_0xe4c6('0x4f')]);_0x5bb8a2[_0xe4c6('0x39')]=_[_0xe4c6('0x38')](_0x325ada[_0xe4c6('0x39')]);_0x5bb8a2[_0xe4c6('0x3a')]=_['intersection'](_0x5bb8a2[_0xe4c6('0x37')],_0x5bb8a2[_0xe4c6('0x39')]);_0x1a23f5[_0xe4c6('0x3c')]=_[_0xe4c6('0x3b')](_0x5bb8a2[_0xe4c6('0x37')],qs[_0xe4c6('0x3d')](_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x3d')]));_0x1a23f5[_0xe4c6('0x3c')]=_0x1a23f5[_0xe4c6('0x3c')][_0xe4c6('0x3e')]?_0x1a23f5[_0xe4c6('0x3c')]:_0x5bb8a2[_0xe4c6('0x37')];_0x1a23f5[_0xe4c6('0x42')]=qs['sort'](_0x325ada[_0xe4c6('0x39')]['sort']);_0x1a23f5[_0xe4c6('0x44')]=qs[_0xe4c6('0x3a')](_[_0xe4c6('0x45')](_0x325ada[_0xe4c6('0x39')],_0x5bb8a2[_0xe4c6('0x3a')]));if(_0x325ada['query']['filter']){_0x1a23f5[_0xe4c6('0x44')]=_[_0xe4c6('0x50')](_0x1a23f5['where'],{'$or':_[_0xe4c6('0x33')](_0x1a23f5[_0xe4c6('0x3c')],function(_0x1c7195){var _0x2b5520={};_0x2b5520[_0x1c7195]={'$like':'%'+_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x46')]+'%'};return _0x2b5520;})});}_0x1a23f5=_[_0xe4c6('0x50')]({},_0x1a23f5,_0x325ada['options']);return _0x3e6a43[_0xe4c6('0x54')](_0x1a23f5);}})[_0xe4c6('0x1b')](function(_0x5b1264){if(_0x5b1264){_0x2e404e=_0x5b1264['length'];if(!_0x325ada[_0xe4c6('0x39')]['hasOwnProperty'](_0xe4c6('0x40'))){_0x1a23f5[_0xe4c6('0x41')]=qs[_0xe4c6('0x41')](_0x325ada['query']['limit']);_0x1a23f5[_0xe4c6('0x2a')]=qs[_0xe4c6('0x2a')](_0x325ada[_0xe4c6('0x39')][_0xe4c6('0x2a')]);}return _0x3e6a43['getConfigurations'](_0x1a23f5);}})[_0xe4c6('0x1b')](function(_0x51c6d2){if(_0x51c6d2){return _0x51c6d2?{'count':_0x2e404e,'rows':_0x51c6d2}:null;}})[_0xe4c6('0x1b')](respondWithResult(_0x2967a7,null))[_0xe4c6('0x4d')](handleError(_0x2967a7,null));};exports[_0xe4c6('0x55')]=function(_0x2d5c33,_0x1a3b68,_0x4a175c){if(_0x2d5c33['body']['id']){delete _0x2d5c33[_0xe4c6('0x53')]['id'];}return db['Dynamics365Account'][_0xe4c6('0x56')]({'where':{'id':_0x2d5c33[_0xe4c6('0x4e')]['id']}})[_0xe4c6('0x1b')](handleEntityNotFound(_0x1a3b68,null))[_0xe4c6('0x1b')](function(_0x2c60fd){if(_0x2c60fd){_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x57')]=_0x2c60fd['id'];_0x2d5c33['body']['Subjects']=integrations[_0xe4c6('0x58')](_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x59')],_0x2d5c33['body'][_0xe4c6('0x5a')]);_0x2d5c33['body'][_0xe4c6('0x5b')]=integrations['getDescriptions'](_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x59')],_0x2d5c33[_0xe4c6('0x53')][_0xe4c6('0x5a')]);return db[_0xe4c6('0x5c')][_0xe4c6('0x52')](_0x2d5c33[_0xe4c6('0x53')],{'include':[{'model':db[_0xe4c6('0x5d')],'as':'Subjects'},{'model':db[_0xe4c6('0x5d')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a3b68,null))[_0xe4c6('0x4d')](handleError(_0x1a3b68,null));};exports[_0xe4c6('0x5e')]=function(_0xffc7aa,_0x81a5d7,_0x200b95){var _0x2d1d02=_0xffc7aa[_0xe4c6('0x39')][_0xe4c6('0x5f')];var _0xdd1d58=_0x2d1d02===_0xe4c6('0x60')?_0xe4c6('0x61'):'PhoneCall';var _0x58bf59='';var _0x442bdd='';var _0x17b905='';var _0x99a6c4='';var _0x109875='';var _0x92b507='';var _0x5388e5='';var _0x1ed9ab='';var _0x382238=['title',_0xe4c6('0x62'),_0xe4c6('0x63'),_0xe4c6('0x64'),_0xe4c6('0x65'),'subject',_0xe4c6('0x66'),'regardingobjectid',_0xe4c6('0x67'),_0xe4c6('0x68')];var _0x38706c=[_0xe4c6('0x69'),'accountidyominame',_0xe4c6('0x6a'),'billedserviceunits','contactidname',_0xe4c6('0x6b'),_0xe4c6('0x6c'),'contractidname',_0xe4c6('0x6d'),'createdbyexternalpartyyominame',_0xe4c6('0x6e'),_0xe4c6('0x6f'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame',_0xe4c6('0x70'),_0xe4c6('0x71'),_0xe4c6('0x72'),'emailaddress',_0xe4c6('0x73'),'entityimage_timestamp','entityimage_url',_0xe4c6('0x74'),_0xe4c6('0x75'),'firstresponsebykpiidname',_0xe4c6('0x76'),_0xe4c6('0x77'),_0xe4c6('0x78'),_0xe4c6('0x79'),_0xe4c6('0x7a'),_0xe4c6('0x7b'),_0xe4c6('0x7c'),_0xe4c6('0x7d'),_0xe4c6('0x7e'),_0xe4c6('0x7f'),_0xe4c6('0x80'),'modifiedonbehalfbyname',_0xe4c6('0x81'),_0xe4c6('0x82'),_0xe4c6('0x83'),'numberofchildincidents',_0xe4c6('0x84'),'overriddencreatedon','owneridname',_0xe4c6('0x85'),'owneridyominame',_0xe4c6('0x86'),_0xe4c6('0x87'),_0xe4c6('0x88'),'prioritycodename',_0xe4c6('0x89'),'productserialnumber',_0xe4c6('0x8a'),'resolvebykpiidname',_0xe4c6('0x8b'),_0xe4c6('0x8c'),'responsiblecontactidyominame',_0xe4c6('0x8d'),_0xe4c6('0x8e'),_0xe4c6('0x8f'),_0xe4c6('0x90'),'statecode',_0xe4c6('0x91'),'subjectidname',_0xe4c6('0x92'),_0xe4c6('0x93'),'transactioncurrencyidname',_0xe4c6('0x94'),'utcconversiontimezonecode',_0xe4c6('0x95')];var _0x6670c5=_0x382238[_0xe4c6('0x96')](_0x38706c);return db['Dynamics365Account'][_0xe4c6('0x56')]({'where':{'id':_0xffc7aa[_0xe4c6('0x4e')]['id']},'attributes':['id',_0xe4c6('0x97'),'password',_0xe4c6('0x98'),'tenantId',_0xe4c6('0x99'),_0xe4c6('0x9a')]})['then'](handleEntityNotFound(_0x81a5d7,null))[_0xe4c6('0x1b')](function(_0xa04e3){if(_0xa04e3){_0x1ed9ab=_0xa04e3[_0xe4c6('0x98')];var _0xabac87=_0x1ed9ab[_0xe4c6('0x9b')](-0x1);if(_0xabac87==='/'){_0x1ed9ab=_0x1ed9ab['substring'](0x0,_0x1ed9ab[_0xe4c6('0x9c')](_0xabac87));}_0x5388e5=util[_0xe4c6('0x9d')](_0xe4c6('0x9e'),_0x1ed9ab);var _0x5e45d2={'method':'POST','uri':_0xe4c6('0x9f')+_0xa04e3['tenantId']+_0xe4c6('0xa0'),'form':{'client_id':_0xa04e3['clientId'],'resource':_0x1ed9ab,'username':_0xa04e3[_0xe4c6('0x97')],'password':_0xa04e3[_0xe4c6('0xa1')],'grant_type':_0xe4c6('0xa1'),'client_secret':_0xa04e3[_0xe4c6('0x9a')]},'json':!![]};return rp(_0x5e45d2);}})[_0xe4c6('0x1b')](function(_0x598897){_0x92b507=_0x598897[_0xe4c6('0xa2')];var _0x241e58={'method':_0xe4c6('0xa3'),'uri':encodeURI(_0x5388e5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xdd1d58+'\x27'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x92b507,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x241e58);})[_0xe4c6('0x1b')](function(_0x3c2f0c){var _0x32ce72=_0x3c2f0c['value'][0x0];var _0x9e0406=_0x32ce72[_0xe4c6('0xa5')];var _0x18dd5d={'method':_0xe4c6('0xa3'),'uri':_0x5388e5+'EntityDefinitions('+_0x9e0406+_0xe4c6('0xa6'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x92b507,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18dd5d);})[_0xe4c6('0x1b')](function(_0x22ba1d){_0x58bf59=_0x22ba1d;_0x442bdd=_0x58bf59[_0xe4c6('0xa7')];_0x442bdd=_['remove'](_0x442bdd,function(_0x3ff03f){return!_0x6670c5['includes'](_0x3ff03f[_0xe4c6('0xa8')]);});var _0x496606=[];var _0x3f0e40=[];_0x442bdd[_0xe4c6('0xa9')](function(_0x5b81fa){if(_0x5b81fa['@odata.type']){var _0x319fcc=_0x5b81fa[_0xe4c6('0xaa')][_0xe4c6('0xab')](_0x5b81fa[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x319fcc===_0xe4c6('0xac')){_0x496606['push'](getSelectList(_0x5388e5,_0x2d1d02,_0x3f0e40,_0x58bf59[_0xe4c6('0xa5')],_0x5b81fa[_0xe4c6('0xa5')],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x496606);})[_0xe4c6('0x1b')](function(_0x3f19cf){_0x17b905=_0x3f19cf[0x0];var _0x2dc458=[];var _0x516e07=[];_0x442bdd['forEach'](function(_0x14b6c9){if(!_[_0xe4c6('0xae')](_0x14b6c9[_0xe4c6('0xaa')])){var _0x211fdb=_0x14b6c9[_0xe4c6('0xaa')]['substring'](_0x14b6c9[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x211fdb===_0xe4c6('0xaf')){_0x2dc458[_0xe4c6('0xb0')](getBooleanList(_0x5388e5,_0x2d1d02,_0x516e07,_0x58bf59[_0xe4c6('0xa5')],_0x14b6c9[_0xe4c6('0xa5')],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x2dc458);})[_0xe4c6('0x1b')](function(_0x25680a){_0x99a6c4=_0x25680a[0x0];var _0x1f897b=[];var _0x3ffa1d=[];_0x442bdd[_0xe4c6('0xa9')](function(_0x206fb8){if(_0x206fb8[_0xe4c6('0xaa')]){var _0x1e24f5=_0x206fb8[_0xe4c6('0xaa')]['substring'](_0x206fb8[_0xe4c6('0xaa')]['lastIndexOf']('.')+0x1);if(_0x1e24f5===_0xe4c6('0xb1')||_0x1e24f5===_0xe4c6('0xb2')||_0x1e24f5==='BigIntAttributeMetadata'||_0x1e24f5===_0xe4c6('0xb3')||_0x1e24f5===_0xe4c6('0xb4')||_0x1e24f5===_0xe4c6('0xb5')||_0x1e24f5===_0xe4c6('0xb6')||_0x1e24f5===_0xe4c6('0xb7')||_0x1e24f5===_0xe4c6('0xb8')||_0x1e24f5==='DecimalAttributeMetadata'){_0x1f897b[_0xe4c6('0xb0')](getInputList(_0x5388e5,_0x2d1d02,_0x1e24f5,_0x3ffa1d,_0x58bf59[_0xe4c6('0xa5')],_0x206fb8['MetadataId'],_0x92b507));}}});return Promise[_0xe4c6('0xad')](_0x1f897b);})[_0xe4c6('0x1b')](function(_0x844f21){_0x109875=_0x844f21[0x0];var _0x3a4dce=_0x17b905[_0xe4c6('0x96')](_0x99a6c4)['concat'](_0x109875);var _0xdbd627={'count':_0x3a4dce[_0xe4c6('0x3e')],'rows':_0x3a4dce};return _0xdbd627;})[_0xe4c6('0x1b')](respondWithResult(_0x81a5d7,null))[_0xe4c6('0x4d')](function(_0x43940a){var _0x337ab5=_0xffc7aa[_0xe4c6('0x39')]['test']?0x1f4:_0x43940a[_0xe4c6('0xb9')]||0x1f4;logger[_0xe4c6('0x22')](_0x43940a[_0xe4c6('0xba')]);delete _0x43940a['name'];if(_0x337ab5===0x191){_0x337ab5=0x190;}_0x81a5d7[_0xe4c6('0x27')](_0x337ab5)[_0xe4c6('0x32')](_0xffc7aa[_0xe4c6('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x43940a[_0xe4c6('0xb9')]}:_0x43940a);});};function getSelectList(_0x4936b3,_0x5f3963,_0x581563,_0x3405ec,_0x42c859,_0x358c25){var _0x4b2af0={'method':_0xe4c6('0xa3'),'uri':_0x4936b3+_0xe4c6('0xbb')+_0x3405ec+_0xe4c6('0xbc')+_0x42c859+_0xe4c6('0xbd')+_0xe4c6('0xbe'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x358c25,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x4b2af0)[_0xe4c6('0x1b')](function(_0x1a0466){var _0x1847de=[];var _0x2d336b=_0x1a0466[_0xe4c6('0xc0')][_0xe4c6('0xc1')];_0x2d336b[_0xe4c6('0xa9')](function(_0x3bed0a){_0x1847de[_0xe4c6('0xb0')]({'name':_0x3bed0a[_0xe4c6('0xc2')][_0xe4c6('0xc3')][_0xe4c6('0xc2')],'value':String(_0x3bed0a[_0xe4c6('0xc4')])});});var _0x122222={'id':_0x5f3963+'_'+_0x1a0466['LogicalName'],'name':_0x1a0466[_0xe4c6('0xc5')][_0xe4c6('0xc3')][_0xe4c6('0xc2')],'custom':![],'options':_0x1847de};_0x581563[_0xe4c6('0xb0')](_0x122222);return _0x581563;});}function getBooleanList(_0x3acfac,_0x42d2c0,_0x322c84,_0x23c07d,_0x3ac2e0,_0x54a6d5){var _0x2d121c={'method':_0xe4c6('0xa3'),'uri':_0x3acfac+_0xe4c6('0xbb')+_0x23c07d+')/Attributes('+_0x3ac2e0+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe4c6('0xa4')+_0x54a6d5,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x2d121c)[_0xe4c6('0x1b')](function(_0x5bcc0d){var _0x4b6022=[];_0x4b6022[_0xe4c6('0xb0')]({'name':_0x5bcc0d['OptionSet'][_0xe4c6('0xc6')]['Label']['UserLocalizedLabel'][_0xe4c6('0xc2')],'value':_0xe4c6('0xc7')},{'name':_0x5bcc0d[_0xe4c6('0xc0')][_0xe4c6('0xc8')]['Label']['UserLocalizedLabel'][_0xe4c6('0xc2')],'value':_0xe4c6('0xc9')});var _0x1fa27e={'id':_0x42d2c0+'_'+_0x5bcc0d[_0xe4c6('0xa8')],'name':_0x5bcc0d['DisplayName']['UserLocalizedLabel'][_0xe4c6('0xc2')],'custom':![],'options':_0x4b6022};_0x322c84[_0xe4c6('0xb0')](_0x1fa27e);return _0x322c84;});}function getInputList(_0x1273b3,_0x4b96f3,_0x50bf65,_0x3a6469,_0x4a0649,_0xf51806,_0x3364d4){var _0x2ecab5={'method':_0xe4c6('0xa3'),'uri':_0x1273b3+_0xe4c6('0xbb')+_0x4a0649+_0xe4c6('0xbc')+_0xf51806+_0xe4c6('0xca')+_0x50bf65+_0xe4c6('0xcb'),'headers':{'Authorization':_0xe4c6('0xa4')+_0x3364d4,'If-None-Match':null,'OData-Version':_0xe4c6('0xbf')},'json':!![]};return rp(_0x2ecab5)[_0xe4c6('0x1b')](function(_0x55a796){var _0x1bde73={'id':_0x4b96f3+'_'+_0x55a796['LogicalName'],'name':_0x55a796['DisplayName'][_0xe4c6('0xc3')]?_0x55a796[_0xe4c6('0xc5')][_0xe4c6('0xc3')][_0xe4c6('0xc2')]:_0x55a796[_0xe4c6('0xa8')],'custom':![],'options':[]};_0x3a6469[_0xe4c6('0xb0')](_0x1bde73);return _0x3a6469;});} \ No newline at end of file +var _0x6836=['onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','POST','https://login.microsoftonline.com/','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','GET','EntityDefinitions(','Attributes','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','rows','show','find','create','body','params','getConfigurations','findOne','order','options','addConfiguration','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','contactidname','contractidname','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents'];(function(_0x339d45,_0x5b91d4){var _0x5e4a60=function(_0x4de526){while(--_0x4de526){_0x339d45['push'](_0x339d45['shift']());}};_0x5e4a60(++_0x5b91d4);}(_0x6836,0x1f2));var _0x6683=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x6836[_0x13b8f3];return _0x1a6d06;};'use strict';var pdf=require(_0x6683('0x0'));var emlformat=require(_0x6683('0x1'));var rimraf=require(_0x6683('0x2'));var zipdir=require(_0x6683('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6683('0x4'));var moment=require(_0x6683('0x5'));var BPromise=require(_0x6683('0x6'));var Mustache=require(_0x6683('0x7'));var util=require(_0x6683('0x8'));var path=require(_0x6683('0x9'));var sox=require(_0x6683('0xa'));var csv=require('to-csv');var ejs=require(_0x6683('0xb'));var fs=require('fs');var _=require(_0x6683('0xc'));var squel=require(_0x6683('0xd'));var crypto=require(_0x6683('0xe'));var jsforce=require(_0x6683('0xf'));var deskjs=require(_0x6683('0x10'));var toCsv=require(_0x6683('0x11'));var querystring=require(_0x6683('0x12'));var Papa=require(_0x6683('0x13'));var Redis=require(_0x6683('0x14'));var authService=require(_0x6683('0x15'));var qs=require(_0x6683('0x16'));var as=require(_0x6683('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6683('0x18'));var utils=require(_0x6683('0x19'));var config=require(_0x6683('0x1a'));var db=require(_0x6683('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x6683('0x1c'));var client=jayson['client'][_0x6683('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x37777c,_0x38880e,_0x17b785){if(_0x17b785){var _0x181577=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x181577[_0x6683('0x1e')](_0x38880e)){return _0x37777c;}else{throw new db['Sequelize'][(_0x6683('0x1f'))](_0x6683('0x20'));}}else{return _0x37777c;}}function respondWithRpcPromise(_0x16ae62,_0xff82a1,_0x47f0cf,_0x45f826){return new BPromise(function(_0x3e63c2,_0x2d025b){var _0x106a97=_0x45f826||client;return _0x106a97[_0x6683('0x21')](_0x16ae62,_0x47f0cf)[_0x6683('0x22')](function(_0x3176a3){logger[_0x6683('0x23')](_0x6683('0x24'),_0xff82a1,_0x6683('0x25'));logger[_0x6683('0x26')](_0x6683('0x27'),_0xff82a1,_0x6683('0x25'),JSON['stringify'](_0x3176a3));if(_0x3176a3['error']){if(_0x3176a3[_0x6683('0x28')]['code']===0x1f4){logger[_0x6683('0x28')](_0x6683('0x24'),_0xff82a1,_0x3176a3['error'][_0x6683('0x29')]);return _0x2d025b(_0x3176a3['error'][_0x6683('0x29')]);}logger[_0x6683('0x28')](_0x6683('0x24'),_0xff82a1,_0x3176a3[_0x6683('0x28')][_0x6683('0x29')]);return _0x3e63c2(_0x3176a3[_0x6683('0x28')][_0x6683('0x29')]);}else{logger[_0x6683('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0xff82a1,'request\x20sent');_0x3e63c2(_0x3176a3['result'][_0x6683('0x29')]);}})[_0x6683('0x2a')](function(_0x2824d9){logger[_0x6683('0x28')](_0x6683('0x24'),_0xff82a1,_0x2824d9);_0x2d025b(_0x2824d9);});});}function respondWithStatusCode(_0x4b06b1,_0x192ba6){_0x192ba6=_0x192ba6||0xcc;return function(_0x2797a7){if(_0x2797a7){return _0x4b06b1[_0x6683('0x2b')](_0x192ba6);}return _0x4b06b1['status'](_0x192ba6)[_0x6683('0x2c')]();};}function respondWithResult(_0x35dd41,_0x51bd10){_0x51bd10=_0x51bd10||0xc8;return function(_0x26d9c9){if(_0x26d9c9){return _0x35dd41['status'](_0x51bd10)[_0x6683('0x2d')](_0x26d9c9);}};}function respondWithFilteredResult(_0x5d4b8e,_0x5e5fd2){return function(_0x10164c){if(_0x10164c){var _0x335f8c=_0x10164c[_0x6683('0x2e')],_0x2e9ccc=_0x5e5fd2[_0x6683('0x2f')],_0x4adf92=_0x5e5fd2[_0x6683('0x2f')]+_0x5e5fd2[_0x6683('0x30')],_0x32a153;if(_0x4adf92>=_0x335f8c){_0x4adf92=_0x335f8c;_0x32a153=0xc8;}else{_0x32a153=0xce;}_0x5d4b8e[_0x6683('0x31')](_0x32a153);return _0x5d4b8e['set'](_0x6683('0x32'),_0x2e9ccc+'-'+_0x4adf92+'/'+_0x335f8c)[_0x6683('0x2d')](_0x10164c);}return null;};}function patchUpdates(_0x5323b0){return function(_0x236421){try{jsonpatch[_0x6683('0x33')](_0x236421,_0x5323b0,!![]);}catch(_0x3bcbc3){return BPromise[_0x6683('0x34')](_0x3bcbc3);}return _0x236421[_0x6683('0x35')]();};}function saveUpdates(_0x3a1875,_0x3db4f0){return function(_0x532ccd){if(_0x532ccd){return _0x532ccd[_0x6683('0x36')](_0x3a1875)[_0x6683('0x22')](function(_0x4c7fd8){return _0x4c7fd8;});}return null;};}function removeEntity(_0x4e0a0f,_0x35381a){return function(_0x3a6fbe){if(_0x3a6fbe){return _0x3a6fbe[_0x6683('0x37')]()['then'](function(){_0x4e0a0f[_0x6683('0x31')](0xcc)[_0x6683('0x2c')]();});}};}function handleEntityNotFound(_0x19e32f,_0xf2d458){return function(_0x2733ad){if(!_0x2733ad){_0x19e32f[_0x6683('0x2b')](0x194);}return _0x2733ad;};}function handleError(_0x14a230,_0x2991d7){_0x2991d7=_0x2991d7||0x1f4;return function(_0x1585e7){logger[_0x6683('0x28')](_0x1585e7[_0x6683('0x38')]);if(_0x1585e7[_0x6683('0x39')]){delete _0x1585e7['name'];}_0x14a230['status'](_0x2991d7)['send'](_0x1585e7);};}exports['index']=function(_0x2ffa7e,_0x2c66d1){var _0x47982c={},_0x172c48={},_0x2eca3e={'count':0x0,'rows':[]};var _0x1abee1=_[_0x6683('0x3a')](db[_0x6683('0x3b')][_0x6683('0x3c')],function(_0x518522){return{'name':_0x518522[_0x6683('0x3d')],'type':_0x518522[_0x6683('0x3e')]['key']};});_0x172c48[_0x6683('0x3f')]=_['map'](_0x1abee1,_0x6683('0x39'));_0x172c48['query']=_[_0x6683('0x40')](_0x2ffa7e[_0x6683('0x41')]);_0x172c48[_0x6683('0x42')]=_[_0x6683('0x43')](_0x172c48[_0x6683('0x3f')],_0x172c48[_0x6683('0x41')]);_0x47982c['attributes']=_['intersection'](_0x172c48[_0x6683('0x3f')],qs['fields'](_0x2ffa7e[_0x6683('0x41')][_0x6683('0x44')]));_0x47982c[_0x6683('0x45')]=_0x47982c['attributes'][_0x6683('0x46')]?_0x47982c[_0x6683('0x45')]:_0x172c48[_0x6683('0x3f')];if(!_0x2ffa7e[_0x6683('0x41')][_0x6683('0x47')](_0x6683('0x48'))){_0x47982c[_0x6683('0x30')]=qs[_0x6683('0x30')](_0x2ffa7e[_0x6683('0x41')][_0x6683('0x30')]);_0x47982c['offset']=qs['offset'](_0x2ffa7e[_0x6683('0x41')][_0x6683('0x2f')]);}_0x47982c['order']=qs[_0x6683('0x49')](_0x2ffa7e[_0x6683('0x41')][_0x6683('0x49')]);_0x47982c[_0x6683('0x4a')]=qs[_0x6683('0x42')](_[_0x6683('0x4b')](_0x2ffa7e[_0x6683('0x41')],_0x172c48[_0x6683('0x42')]),_0x1abee1);if(_0x2ffa7e['query'][_0x6683('0x4c')]){_0x47982c[_0x6683('0x4a')]=_['merge'](_0x47982c[_0x6683('0x4a')],{'$or':_[_0x6683('0x3a')](_0x1abee1,function(_0x43ebb3){if(_0x43ebb3['type']!=='VIRTUAL'){var _0x33e078={};_0x33e078[_0x43ebb3[_0x6683('0x39')]]={'$like':'%'+_0x2ffa7e[_0x6683('0x41')]['filter']+'%'};return _0x33e078;}})});}_0x47982c=_[_0x6683('0x4d')]({},_0x47982c,_0x2ffa7e['options']);var _0x259377={'where':_0x47982c[_0x6683('0x4a')]};return db[_0x6683('0x3b')]['count'](_0x259377)[_0x6683('0x22')](function(_0x59be40){_0x2eca3e[_0x6683('0x2e')]=_0x59be40;if(_0x2ffa7e[_0x6683('0x41')]['includeAll']){_0x47982c[_0x6683('0x4e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x6683('0x4f')](_0x47982c);})['then'](function(_0x27e180){_0x2eca3e[_0x6683('0x50')]=_0x27e180;return _0x2eca3e;})[_0x6683('0x22')](respondWithFilteredResult(_0x2c66d1,_0x47982c))[_0x6683('0x2a')](handleError(_0x2c66d1,null));};exports[_0x6683('0x51')]=function(_0x32b444,_0x56fc7e){var _0x4587b9={'raw':![],'where':{'id':_0x32b444['params']['id']}},_0x59a139={};_0x59a139[_0x6683('0x3f')]=_['keys'](db[_0x6683('0x3b')][_0x6683('0x3c')]);_0x59a139['query']=_[_0x6683('0x40')](_0x32b444[_0x6683('0x41')]);_0x59a139[_0x6683('0x42')]=_[_0x6683('0x43')](_0x59a139[_0x6683('0x3f')],_0x59a139[_0x6683('0x41')]);_0x4587b9[_0x6683('0x45')]=_[_0x6683('0x43')](_0x59a139[_0x6683('0x3f')],qs[_0x6683('0x44')](_0x32b444[_0x6683('0x41')][_0x6683('0x44')]));_0x4587b9[_0x6683('0x45')]=_0x4587b9['attributes'][_0x6683('0x46')]?_0x4587b9[_0x6683('0x45')]:_0x59a139[_0x6683('0x3f')];if(_0x32b444[_0x6683('0x41')]['includeAll']){_0x4587b9[_0x6683('0x4e')]=[{'all':!![]}];}_0x4587b9=_[_0x6683('0x4d')]({},_0x4587b9,_0x32b444['options']);return db[_0x6683('0x3b')][_0x6683('0x52')](_0x4587b9)[_0x6683('0x22')](handleEntityNotFound(_0x56fc7e,null))['then'](respondWithResult(_0x56fc7e,null))[_0x6683('0x2a')](handleError(_0x56fc7e,null));};exports[_0x6683('0x53')]=function(_0x1a36b7,_0x10012a){return db[_0x6683('0x3b')]['create'](_0x1a36b7[_0x6683('0x54')],{})[_0x6683('0x22')](respondWithResult(_0x10012a,0xc9))[_0x6683('0x2a')](handleError(_0x10012a,null));};exports['update']=function(_0x1135e9,_0x1780e3){if(_0x1135e9[_0x6683('0x54')]['id']){delete _0x1135e9[_0x6683('0x54')]['id'];}return db[_0x6683('0x3b')][_0x6683('0x52')]({'where':{'id':_0x1135e9['params']['id']}})[_0x6683('0x22')](handleEntityNotFound(_0x1780e3,null))[_0x6683('0x22')](saveUpdates(_0x1135e9[_0x6683('0x54')],null))[_0x6683('0x22')](respondWithResult(_0x1780e3,null))[_0x6683('0x2a')](handleError(_0x1780e3,null));};exports['destroy']=function(_0x244c4d,_0x201066){return db[_0x6683('0x3b')][_0x6683('0x52')]({'where':{'id':_0x244c4d[_0x6683('0x55')]['id']}})['then'](handleEntityNotFound(_0x201066,null))[_0x6683('0x22')](removeEntity(_0x201066,null))['catch'](handleError(_0x201066,null));};exports[_0x6683('0x56')]=function(_0x5242b9,_0x35dc32,_0x540ef1){var _0x414c3b={};var _0x5dd053={};var _0x377668;var _0x3d0031;return db[_0x6683('0x3b')][_0x6683('0x57')]({'where':{'id':_0x5242b9[_0x6683('0x55')]['id']}})[_0x6683('0x22')](handleEntityNotFound(_0x35dc32,null))[_0x6683('0x22')](function(_0x3a945f){if(_0x3a945f){_0x377668=_0x3a945f;_0x5dd053[_0x6683('0x3f')]=_[_0x6683('0x40')](db['Dynamics365Configuration']['rawAttributes']);_0x5dd053['query']=_[_0x6683('0x40')](_0x5242b9[_0x6683('0x41')]);_0x5dd053[_0x6683('0x42')]=_['intersection'](_0x5dd053[_0x6683('0x3f')],_0x5dd053[_0x6683('0x41')]);_0x414c3b[_0x6683('0x45')]=_[_0x6683('0x43')](_0x5dd053[_0x6683('0x3f')],qs[_0x6683('0x44')](_0x5242b9[_0x6683('0x41')][_0x6683('0x44')]));_0x414c3b[_0x6683('0x45')]=_0x414c3b[_0x6683('0x45')][_0x6683('0x46')]?_0x414c3b[_0x6683('0x45')]:_0x5dd053['model'];_0x414c3b[_0x6683('0x58')]=qs[_0x6683('0x49')](_0x5242b9[_0x6683('0x41')][_0x6683('0x49')]);_0x414c3b['where']=qs[_0x6683('0x42')](_['pick'](_0x5242b9[_0x6683('0x41')],_0x5dd053[_0x6683('0x42')]));if(_0x5242b9[_0x6683('0x41')][_0x6683('0x4c')]){_0x414c3b[_0x6683('0x4a')]=_[_0x6683('0x4d')](_0x414c3b['where'],{'$or':_[_0x6683('0x3a')](_0x414c3b[_0x6683('0x45')],function(_0x46cf31){var _0x5f4531={};_0x5f4531[_0x46cf31]={'$like':'%'+_0x5242b9[_0x6683('0x41')][_0x6683('0x4c')]+'%'};return _0x5f4531;})});}_0x414c3b=_[_0x6683('0x4d')]({},_0x414c3b,_0x5242b9[_0x6683('0x59')]);return _0x377668[_0x6683('0x56')](_0x414c3b);}})[_0x6683('0x22')](function(_0x1c9d7d){if(_0x1c9d7d){_0x3d0031=_0x1c9d7d[_0x6683('0x46')];if(!_0x5242b9['query'][_0x6683('0x47')]('nolimit')){_0x414c3b['limit']=qs[_0x6683('0x30')](_0x5242b9['query'][_0x6683('0x30')]);_0x414c3b[_0x6683('0x2f')]=qs['offset'](_0x5242b9[_0x6683('0x41')]['offset']);}return _0x377668[_0x6683('0x56')](_0x414c3b);}})['then'](function(_0x29471a){if(_0x29471a){return _0x29471a?{'count':_0x3d0031,'rows':_0x29471a}:null;}})[_0x6683('0x22')](respondWithResult(_0x35dc32,null))[_0x6683('0x2a')](handleError(_0x35dc32,null));};exports[_0x6683('0x5a')]=function(_0x320964,_0x12eb43,_0x1426bf){if(_0x320964[_0x6683('0x54')]['id']){delete _0x320964[_0x6683('0x54')]['id'];}return db[_0x6683('0x3b')]['findOne']({'where':{'id':_0x320964[_0x6683('0x55')]['id']}})['then'](handleEntityNotFound(_0x12eb43,null))[_0x6683('0x22')](function(_0x3b5ca8){if(_0x3b5ca8){_0x320964[_0x6683('0x54')]['AccountId']=_0x3b5ca8['id'];_0x320964[_0x6683('0x54')][_0x6683('0x5b')]=integrations[_0x6683('0x5c')](_0x320964[_0x6683('0x54')][_0x6683('0x5d')],_0x320964[_0x6683('0x54')][_0x6683('0x3e')]);_0x320964[_0x6683('0x54')][_0x6683('0x5e')]=integrations['getDescriptions'](_0x320964[_0x6683('0x54')][_0x6683('0x5d')],_0x320964[_0x6683('0x54')][_0x6683('0x3e')]);return db[_0x6683('0x5f')][_0x6683('0x53')](_0x320964['body'],{'include':[{'model':db[_0x6683('0x60')],'as':_0x6683('0x5b')},{'model':db[_0x6683('0x60')],'as':'Descriptions'}]});}return null;})[_0x6683('0x22')](respondWithResult(_0x12eb43,null))[_0x6683('0x2a')](handleError(_0x12eb43,null));};exports['getFields']=function(_0x4096cc,_0x5cbbcd,_0x47fa17){var _0x1c402c=_0x4096cc[_0x6683('0x41')][_0x6683('0x61')];var _0x3a63ee=_0x1c402c===_0x6683('0x62')?_0x6683('0x63'):_0x6683('0x64');var _0x365b76='';var _0x14513e='';var _0x462bf5='';var _0x466aa7='';var _0x2cec3c='';var _0x2ef14d='';var _0x3a139b='';var _0x188245='';var _0xe2f636=[_0x6683('0x65'),_0x6683('0x66'),_0x6683('0x67'),_0x6683('0x68'),_0x6683('0x69'),_0x6683('0x6a'),_0x6683('0x6b'),'regardingobjectid',_0x6683('0x6c'),_0x6683('0x6d')];var _0x28a2d1=['accountidname',_0x6683('0x6e'),'actualserviceunits','billedserviceunits',_0x6683('0x6f'),'contactidyominame','contractdetailidname',_0x6683('0x70'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x6683('0x71'),'createdbyyominame',_0x6683('0x72'),'createdonbehalfbyname',_0x6683('0x73'),_0x6683('0x74'),_0x6683('0x75'),_0x6683('0x76'),_0x6683('0x77'),_0x6683('0x78'),_0x6683('0x79'),_0x6683('0x7a'),_0x6683('0x7b'),_0x6683('0x7c'),'firstresponsebykpiidname',_0x6683('0x7d'),_0x6683('0x7e'),_0x6683('0x7f'),_0x6683('0x80'),_0x6683('0x81'),_0x6683('0x82'),_0x6683('0x83'),_0x6683('0x84'),_0x6683('0x85'),_0x6683('0x86'),'modifiedon','modifiedonbehalfbyname',_0x6683('0x87'),'msdyn_incidenttypename',_0x6683('0x88'),_0x6683('0x89'),_0x6683('0x8a'),'overriddencreatedon',_0x6683('0x8b'),_0x6683('0x8c'),_0x6683('0x8d'),_0x6683('0x8e'),'primarycontactidname',_0x6683('0x8f'),_0x6683('0x90'),'productidname','productserialnumber',_0x6683('0x91'),'resolvebykpiidname',_0x6683('0x92'),_0x6683('0x93'),_0x6683('0x94'),_0x6683('0x95'),_0x6683('0x96'),'slaname',_0x6683('0x97'),_0x6683('0x98'),_0x6683('0x99'),'subjectidname',_0x6683('0x9a'),_0x6683('0x9b'),'transactioncurrencyidname',_0x6683('0x9c'),'utcconversiontimezonecode',_0x6683('0x9d')];var _0x1c1c37=_0xe2f636[_0x6683('0x9e')](_0x28a2d1);return db[_0x6683('0x3b')][_0x6683('0x57')]({'where':{'id':_0x4096cc[_0x6683('0x55')]['id']},'attributes':['id',_0x6683('0x9f'),_0x6683('0xa0'),_0x6683('0xa1'),_0x6683('0xa2'),_0x6683('0xa3'),_0x6683('0xa4')]})[_0x6683('0x22')](handleEntityNotFound(_0x5cbbcd,null))[_0x6683('0x22')](function(_0x4ff6c4){if(_0x4ff6c4){_0x188245=_0x4ff6c4['remoteUri'];var _0x413cca=_0x188245[_0x6683('0xa5')](-0x1);if(_0x413cca==='/'){_0x188245=_0x188245['substring'](0x0,_0x188245[_0x6683('0xa6')](_0x413cca));}_0x3a139b=util[_0x6683('0xa7')]('%s/api/data/v9.0/',_0x188245);var _0x114997={'method':_0x6683('0xa8'),'uri':_0x6683('0xa9')+_0x4ff6c4['tenantId']+'/oauth2/token','form':{'client_id':_0x4ff6c4[_0x6683('0xa3')],'resource':_0x188245,'username':_0x4ff6c4[_0x6683('0x9f')],'password':_0x4ff6c4[_0x6683('0xa0')],'grant_type':_0x6683('0xa0'),'client_secret':_0x4ff6c4[_0x6683('0xa4')]},'json':!![]};return rp(_0x114997);}})['then'](function(_0x24d2d3){_0x2ef14d=_0x24d2d3[_0x6683('0xaa')];var _0x47ec1a={'method':'GET','uri':encodeURI(_0x3a139b+_0x6683('0xab')+_0x3a63ee+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2ef14d,'If-None-Match':null,'OData-Version':_0x6683('0xac')},'json':!![]};return rp(_0x47ec1a);})[_0x6683('0x22')](function(_0x29a5ef){var _0x22501f=_0x29a5ef['value'][0x0];var _0x4e5e2d=_0x22501f[_0x6683('0xad')];var _0x4810f1={'method':_0x6683('0xae'),'uri':_0x3a139b+_0x6683('0xaf')+_0x4e5e2d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x2ef14d,'If-None-Match':null,'OData-Version':_0x6683('0xac')},'json':!![]};return rp(_0x4810f1);})[_0x6683('0x22')](function(_0x2ea24a){_0x365b76=_0x2ea24a;_0x14513e=_0x365b76[_0x6683('0xb0')];_0x14513e=_['remove'](_0x14513e,function(_0x44db1b){return!_0x1c1c37[_0x6683('0xb1')](_0x44db1b['LogicalName']);});var _0x4523fc=[];var _0x1e373c=[];_0x14513e[_0x6683('0xb2')](function(_0xcd313d){if(_0xcd313d[_0x6683('0xb3')]){var _0x22364b=_0xcd313d[_0x6683('0xb3')][_0x6683('0xb4')](_0xcd313d[_0x6683('0xb3')][_0x6683('0xa6')]('.')+0x1);if(_0x22364b===_0x6683('0xb5')){_0x4523fc[_0x6683('0xb6')](getSelectList(_0x3a139b,_0x1c402c,_0x1e373c,_0x365b76[_0x6683('0xad')],_0xcd313d[_0x6683('0xad')],_0x2ef14d));}}});return Promise[_0x6683('0xb7')](_0x4523fc);})[_0x6683('0x22')](function(_0x34c7e3){_0x462bf5=_0x34c7e3[0x0];var _0x5bc7c5=[];var _0x36f2d7=[];_0x14513e[_0x6683('0xb2')](function(_0x17e7bc){if(!_[_0x6683('0xb8')](_0x17e7bc[_0x6683('0xb3')])){var _0x1f1c31=_0x17e7bc[_0x6683('0xb3')]['substring'](_0x17e7bc[_0x6683('0xb3')][_0x6683('0xa6')]('.')+0x1);if(_0x1f1c31===_0x6683('0xb9')){_0x5bc7c5['push'](getBooleanList(_0x3a139b,_0x1c402c,_0x36f2d7,_0x365b76[_0x6683('0xad')],_0x17e7bc[_0x6683('0xad')],_0x2ef14d));}}});return Promise['all'](_0x5bc7c5);})[_0x6683('0x22')](function(_0x4e30b2){_0x466aa7=_0x4e30b2[0x0];var _0x1f7623=[];var _0x39e7cb=[];_0x14513e[_0x6683('0xb2')](function(_0x9c0324){if(_0x9c0324[_0x6683('0xb3')]){var _0x39d5b4=_0x9c0324['@odata.type']['substring'](_0x9c0324[_0x6683('0xb3')][_0x6683('0xa6')]('.')+0x1);if(_0x39d5b4===_0x6683('0xba')||_0x39d5b4===_0x6683('0xbb')||_0x39d5b4==='BigIntAttributeMetadata'||_0x39d5b4===_0x6683('0xbc')||_0x39d5b4==='MemoAttributeMetadata'||_0x39d5b4===_0x6683('0xbd')||_0x39d5b4===_0x6683('0xbe')||_0x39d5b4===_0x6683('0xbf')||_0x39d5b4===_0x6683('0xc0')||_0x39d5b4===_0x6683('0xc1')){_0x1f7623['push'](getInputList(_0x3a139b,_0x1c402c,_0x39d5b4,_0x39e7cb,_0x365b76[_0x6683('0xad')],_0x9c0324[_0x6683('0xad')],_0x2ef14d));}}});return Promise[_0x6683('0xb7')](_0x1f7623);})[_0x6683('0x22')](function(_0x3f3281){_0x2cec3c=_0x3f3281[0x0];var _0xdc8925=_0x462bf5[_0x6683('0x9e')](_0x466aa7)['concat'](_0x2cec3c);var _0x226687={'count':_0xdc8925[_0x6683('0x46')],'rows':_0xdc8925};return _0x226687;})[_0x6683('0x22')](respondWithResult(_0x5cbbcd,null))[_0x6683('0x2a')](function(_0x1207a4){var _0x4a8cf6=_0x4096cc['query']['test']?0x1f4:_0x1207a4[_0x6683('0xc2')]||0x1f4;logger[_0x6683('0x28')](_0x1207a4['stack']);delete _0x1207a4['name'];if(_0x4a8cf6===0x191){_0x4a8cf6=0x190;}_0x5cbbcd[_0x6683('0x31')](_0x4a8cf6)[_0x6683('0xc3')](_0x4096cc[_0x6683('0x41')][_0x6683('0x1e')]?{'message':_0x6683('0xc4'),'statusCode':_0x1207a4[_0x6683('0xc2')]}:_0x1207a4);});};function getSelectList(_0x3537d3,_0x3f60b4,_0xca9ac2,_0xd8d9c5,_0x541c4d,_0x544010){var _0x228791={'method':_0x6683('0xae'),'uri':_0x3537d3+_0x6683('0xaf')+_0xd8d9c5+_0x6683('0xc5')+_0x541c4d+_0x6683('0xc6')+_0x6683('0xc7'),'headers':{'Authorization':_0x6683('0xc8')+_0x544010,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x228791)[_0x6683('0x22')](function(_0x59a137){var _0x261df0=[];var _0x53b811=_0x59a137[_0x6683('0xc9')][_0x6683('0xca')];_0x53b811[_0x6683('0xb2')](function(_0x2030e6){_0x261df0[_0x6683('0xb6')]({'name':_0x2030e6[_0x6683('0xcb')][_0x6683('0xcc')][_0x6683('0xcb')],'value':String(_0x2030e6[_0x6683('0xcd')])});});var _0x5bc7bf={'id':_0x3f60b4+'_'+_0x59a137[_0x6683('0xce')],'name':_0x59a137[_0x6683('0xcf')]['UserLocalizedLabel'][_0x6683('0xcb')],'custom':![],'options':_0x261df0};_0xca9ac2[_0x6683('0xb6')](_0x5bc7bf);return _0xca9ac2;});}function getBooleanList(_0x1c2a71,_0x3c36fe,_0x5c19a9,_0x4f2252,_0x14cda4,_0x55cf4d){var _0x32b7ba={'method':_0x6683('0xae'),'uri':_0x1c2a71+_0x6683('0xaf')+_0x4f2252+')/Attributes('+_0x14cda4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x6683('0xc8')+_0x55cf4d,'If-None-Match':null,'OData-Version':_0x6683('0xac')},'json':!![]};return rp(_0x32b7ba)[_0x6683('0x22')](function(_0x4c67b3){var _0x376197=[];_0x376197[_0x6683('0xb6')]({'name':_0x4c67b3[_0x6683('0xc9')]['TrueOption']['Label']['UserLocalizedLabel'][_0x6683('0xcb')],'value':_0x6683('0xd0')},{'name':_0x4c67b3[_0x6683('0xc9')][_0x6683('0xd1')][_0x6683('0xcb')][_0x6683('0xcc')][_0x6683('0xcb')],'value':_0x6683('0xd2')});var _0x5e7339={'id':_0x3c36fe+'_'+_0x4c67b3[_0x6683('0xce')],'name':_0x4c67b3[_0x6683('0xcf')][_0x6683('0xcc')][_0x6683('0xcb')],'custom':![],'options':_0x376197};_0x5c19a9['push'](_0x5e7339);return _0x5c19a9;});}function getInputList(_0x50fe4b,_0xd6ef17,_0x8d1e8e,_0xf18a0d,_0x5728fe,_0x26845a,_0x9bcb37){var _0x5556c7={'method':'GET','uri':_0x50fe4b+'EntityDefinitions('+_0x5728fe+_0x6683('0xc5')+_0x26845a+_0x6683('0xd3')+_0x8d1e8e+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x6683('0xc8')+_0x9bcb37,'If-None-Match':null,'OData-Version':_0x6683('0xac')},'json':!![]};return rp(_0x5556c7)[_0x6683('0x22')](function(_0x1b3aed){var _0x433ee5={'id':_0xd6ef17+'_'+_0x1b3aed[_0x6683('0xce')],'name':_0x1b3aed['DisplayName']['UserLocalizedLabel']?_0x1b3aed['DisplayName'][_0x6683('0xcc')][_0x6683('0xcb')]:_0x1b3aed[_0x6683('0xce')],'custom':![],'options':[]};_0xf18a0d[_0x6683('0xb6')](_0x433ee5);return _0xf18a0d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2272d29..aa8c89a 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 _0x183e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_dynamics365_accounts'];(function(_0x47581f,_0x2cbf9c){var _0x169d4d=function(_0x43d3dd){while(--_0x43d3dd){_0x47581f['push'](_0x47581f['shift']());}};_0x169d4d(++_0x2cbf9c);}(_0x183e,0x193));var _0xe183=function(_0x3d492e,_0x3843b5){_0x3d492e=_0x3d492e-0x0;var _0x220848=_0x183e[_0x3d492e];return _0x220848;};'use strict';var _=require(_0xe183('0x0'));var util=require(_0xe183('0x1'));var logger=require(_0xe183('0x2'))('api');var moment=require(_0xe183('0x3'));var BPromise=require(_0xe183('0x4'));var rp=require(_0xe183('0x5'));var fs=require('fs');var path=require(_0xe183('0x6'));var rimraf=require(_0xe183('0x7'));var config=require(_0xe183('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xe183('0x9'));module[_0xe183('0xa')]=function(_0x5e08ee,_0x1692c8){return _0x5e08ee[_0xe183('0xb')]('Dynamics365Account',attributes,{'tableName':_0xe183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x004b=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','Dynamics365Account','lodash','util','../../config/logger','api','bluebird'];(function(_0xbcdb3b,_0x3d5e74){var _0x3042dc=function(_0x55c785){while(--_0x55c785){_0xbcdb3b['push'](_0xbcdb3b['shift']());}};_0x3042dc(++_0x3d5e74);}(_0x004b,0x11b));var _0xb004=function(_0x4e67a5,_0x107d1d){_0x4e67a5=_0x4e67a5-0x0;var _0x8384c7=_0x004b[_0x4e67a5];return _0x8384c7;};'use strict';var _=require(_0xb004('0x0'));var util=require(_0xb004('0x1'));var logger=require(_0xb004('0x2'))(_0xb004('0x3'));var moment=require('moment');var BPromise=require(_0xb004('0x4'));var rp=require(_0xb004('0x5'));var fs=require('fs');var path=require(_0xb004('0x6'));var rimraf=require(_0xb004('0x7'));var config=require(_0xb004('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xb004('0x9'));module[_0xb004('0xa')]=function(_0x3798c7,_0x35d1b3){return _0x3798c7['define'](_0xb004('0xb'),attributes,{'tableName':'int_dynamics365_accounts','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 ee7fcac..a77ab0f 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 _0x5502=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x314085,_0x4235c6){var _0x26190a=function(_0x2314a2){while(--_0x2314a2){_0x314085['push'](_0x314085['shift']());}};_0x26190a(++_0x4235c6);}(_0x5502,0x69));var _0x2550=function(_0x3862d9,_0x483475){_0x3862d9=_0x3862d9-0x0;var _0x46877c=_0x5502[_0x3862d9];return _0x46877c;};'use strict';var _=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var moment=require(_0x2550('0x2'));var BPromise=require(_0x2550('0x3'));var rs=require(_0x2550('0x4'));var fs=require('fs');var Redis=require(_0x2550('0x5'));var db=require(_0x2550('0x6'))['db'];var utils=require(_0x2550('0x7'));var logger=require(_0x2550('0x8'))(_0x2550('0x9'));var config=require(_0x2550('0xa'));var jayson=require(_0x2550('0xb'));var client=jayson[_0x2550('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fdfc5,_0x557e76,_0x51a38d){return new BPromise(function(_0x410692,_0x40ead6){return client['request'](_0x1fdfc5,_0x51a38d)[_0x2550('0xd')](function(_0x59ac75){logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));logger[_0x2550('0x11')](_0x2550('0x12'),_0x557e76,_0x2550('0x10'),JSON['stringify'](_0x59ac75));if(_0x59ac75[_0x2550('0x13')]){if(_0x59ac75[_0x2550('0x13')][_0x2550('0x14')]===0x1f4){logger[_0x2550('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x40ead6(_0x59ac75['error'][_0x2550('0x15')]);}logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x59ac75[_0x2550('0x13')][_0x2550('0x15')]);return _0x410692(_0x59ac75[_0x2550('0x13')]['message']);}else{logger[_0x2550('0xe')](_0x2550('0xf'),_0x557e76,_0x2550('0x10'));_0x410692(_0x59ac75[_0x2550('0x16')][_0x2550('0x15')]);}})[_0x2550('0x17')](function(_0x4fcabb){logger[_0x2550('0x13')](_0x2550('0xf'),_0x557e76,_0x4fcabb);_0x40ead6(_0x4fcabb);});});}exports[_0x2550('0x18')]=function(_0x5c1bcb){var _0x98f713=this;return new Promise(function(_0x5451de,_0x50d45d){return db[_0x2550('0x19')]['findAll']({'raw':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')]['where']||null:null,'attributes':_0x5c1bcb['options']?_0x5c1bcb['options'][_0x2550('0x1c')]||null:null,'limit':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1d')]||null:null,'include':_0x5c1bcb[_0x2550('0x1a')]?_0x5c1bcb[_0x2550('0x1a')][_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5c1bcb[_0x2550('0x1a')]['include'],function(_0x3dadc8){return{'model':db[_0x3dadc8[_0x2550('0x20')]],'as':_0x3dadc8['as'],'attributes':_0x3dadc8['attributes'],'include':_0x3dadc8[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x3dadc8['include'],function(_0x418828){return{'model':db[_0x418828[_0x2550('0x20')]],'as':_0x418828['as'],'attributes':_0x418828[_0x2550('0x1c')],'include':_0x418828[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x418828[_0x2550('0x1e')],function(_0x66ac37){return{'model':db[_0x66ac37[_0x2550('0x20')]],'as':_0x66ac37['as'],'attributes':_0x66ac37[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0xe2744b){logger[_0x2550('0xe')](_0x2550('0x18'),_0x5c1bcb);logger['debug'](_0x2550('0x18'),_0x5c1bcb,JSON[_0x2550('0x21')](_0xe2744b));_0x5451de(_0xe2744b);})[_0x2550('0x17')](function(_0x38f07a){logger[_0x2550('0x13')](_0x2550('0x18'),_0x38f07a[_0x2550('0x15')],_0x5c1bcb);_0x50d45d(_0x98f713[_0x2550('0x13')](0x1f4,_0x38f07a[_0x2550('0x15')]));});});};exports[_0x2550('0x22')]=function(_0x222f62){var _0x3c6613=this;return new Promise(function(_0x561e7d,_0x3edad6){return db[_0x2550('0x19')][_0x2550('0x23')]({'raw':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x222f62['options']?_0x222f62[_0x2550('0x1a')][_0x2550('0x24')]||null:null,'attributes':_0x222f62[_0x2550('0x1a')]?_0x222f62['options'][_0x2550('0x1c')]||null:null,'include':_0x222f62[_0x2550('0x1a')]?_0x222f62[_0x2550('0x1a')]['include']?_[_0x2550('0x1f')](_0x222f62[_0x2550('0x1a')][_0x2550('0x1e')],function(_0x5bce72){return{'model':db[_0x5bce72[_0x2550('0x20')]],'as':_0x5bce72['as'],'attributes':_0x5bce72['attributes'],'include':_0x5bce72[_0x2550('0x1e')]?_[_0x2550('0x1f')](_0x5bce72[_0x2550('0x1e')],function(_0x5dcf5a){return{'model':db[_0x5dcf5a[_0x2550('0x20')]],'as':_0x5dcf5a['as'],'attributes':_0x5dcf5a[_0x2550('0x1c')],'include':_0x5dcf5a['include']?_['map'](_0x5dcf5a[_0x2550('0x1e')],function(_0x40105b){return{'model':db[_0x40105b[_0x2550('0x20')]],'as':_0x40105b['as'],'attributes':_0x40105b[_0x2550('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2550('0xd')](function(_0x254456){logger[_0x2550('0xe')](_0x2550('0x22'),_0x222f62);logger[_0x2550('0x11')](_0x2550('0x22'),_0x222f62,JSON[_0x2550('0x21')](_0x254456));_0x561e7d(_0x254456);})[_0x2550('0x17')](function(_0x1f7e04){logger[_0x2550('0x13')](_0x2550('0x22'),_0x1f7e04['message'],_0x222f62);_0x3edad6(_0x3c6613['error'](0x1f4,_0x1f7e04[_0x2550('0x15')]));});});}; \ No newline at end of file +var _0x6299=['find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','ShowDynamics365Account','Dynamics365Account'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6299,0x169));var _0x9629=function(_0x5cdd4d,_0x2b2807){_0x5cdd4d=_0x5cdd4d-0x0;var _0x1cde38=_0x6299[_0x5cdd4d];return _0x1cde38;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9629('0x0'));var BPromise=require(_0x9629('0x1'));var rs=require(_0x9629('0x2'));var fs=require('fs');var Redis=require(_0x9629('0x3'));var db=require(_0x9629('0x4'))['db'];var utils=require(_0x9629('0x5'));var logger=require('../../config/logger')(_0x9629('0x6'));var config=require(_0x9629('0x7'));var jayson=require(_0x9629('0x8'));var client=jayson[_0x9629('0x9')][_0x9629('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d5981,_0x57c6fe,_0x2c5ca5){return new BPromise(function(_0x1754e6,_0x533868){return client['request'](_0x5d5981,_0x2c5ca5)['then'](function(_0x439129){logger[_0x9629('0xb')](_0x9629('0xc'),_0x57c6fe,'request\x20sent');logger[_0x9629('0xd')](_0x9629('0xe'),_0x57c6fe,_0x9629('0xf'),JSON['stringify'](_0x439129));if(_0x439129[_0x9629('0x10')]){if(_0x439129[_0x9629('0x10')][_0x9629('0x11')]===0x1f4){logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x439129['error'][_0x9629('0x12')]);return _0x533868(_0x439129[_0x9629('0x10')][_0x9629('0x12')]);}logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x439129[_0x9629('0x10')]['message']);return _0x1754e6(_0x439129[_0x9629('0x10')][_0x9629('0x12')]);}else{logger[_0x9629('0xb')](_0x9629('0xc'),_0x57c6fe,_0x9629('0xf'));_0x1754e6(_0x439129[_0x9629('0x13')]['message']);}})[_0x9629('0x14')](function(_0x3524f8){logger[_0x9629('0x10')](_0x9629('0xc'),_0x57c6fe,_0x3524f8);_0x533868(_0x3524f8);});});}exports[_0x9629('0x15')]=function(_0x3f777a){var _0x3df55f=this;return new Promise(function(_0x447f28,_0x1fbacf){return db['Dynamics365Account'][_0x9629('0x16')]({'raw':_0x3f777a['options']?_0x3f777a[_0x9629('0x17')][_0x9629('0x18')]===undefined?!![]:![]:!![],'where':_0x3f777a['options']?_0x3f777a[_0x9629('0x17')][_0x9629('0x19')]||null:null,'attributes':_0x3f777a[_0x9629('0x17')]?_0x3f777a[_0x9629('0x17')][_0x9629('0x1a')]||null:null,'limit':_0x3f777a['options']?_0x3f777a['options'][_0x9629('0x1b')]||null:null,'include':_0x3f777a[_0x9629('0x17')]?_0x3f777a[_0x9629('0x17')]['include']?_[_0x9629('0x1c')](_0x3f777a[_0x9629('0x17')][_0x9629('0x1d')],function(_0x4ae0c7){return{'model':db[_0x4ae0c7['model']],'as':_0x4ae0c7['as'],'attributes':_0x4ae0c7[_0x9629('0x1a')],'include':_0x4ae0c7[_0x9629('0x1d')]?_[_0x9629('0x1c')](_0x4ae0c7[_0x9629('0x1d')],function(_0x1232ec){return{'model':db[_0x1232ec[_0x9629('0x1e')]],'as':_0x1232ec['as'],'attributes':_0x1232ec['attributes'],'include':_0x1232ec[_0x9629('0x1d')]?_['map'](_0x1232ec[_0x9629('0x1d')],function(_0x1db0d9){return{'model':db[_0x1db0d9[_0x9629('0x1e')]],'as':_0x1db0d9['as'],'attributes':_0x1db0d9[_0x9629('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9629('0x1f')](function(_0xe7c85c){logger[_0x9629('0xb')](_0x9629('0x15'),_0x3f777a);logger[_0x9629('0xd')]('GetDynamics365Account',_0x3f777a,JSON[_0x9629('0x20')](_0xe7c85c));_0x447f28(_0xe7c85c);})[_0x9629('0x14')](function(_0x596376){logger[_0x9629('0x10')](_0x9629('0x15'),_0x596376[_0x9629('0x12')],_0x3f777a);_0x1fbacf(_0x3df55f[_0x9629('0x10')](0x1f4,_0x596376['message']));});});};exports[_0x9629('0x21')]=function(_0x2de66e){var _0x5cf1b6=this;return new Promise(function(_0x160eb9,_0x505590){return db[_0x9629('0x22')][_0x9629('0x23')]({'raw':_0x2de66e['options']?_0x2de66e['options'][_0x9629('0x18')]===undefined?!![]:![]:!![],'where':_0x2de66e[_0x9629('0x17')]?_0x2de66e[_0x9629('0x17')][_0x9629('0x19')]||null:null,'attributes':_0x2de66e[_0x9629('0x17')]?_0x2de66e[_0x9629('0x17')][_0x9629('0x1a')]||null:null,'include':_0x2de66e[_0x9629('0x17')]?_0x2de66e[_0x9629('0x17')][_0x9629('0x1d')]?_[_0x9629('0x1c')](_0x2de66e['options'][_0x9629('0x1d')],function(_0x4c4e22){return{'model':db[_0x4c4e22[_0x9629('0x1e')]],'as':_0x4c4e22['as'],'attributes':_0x4c4e22[_0x9629('0x1a')],'include':_0x4c4e22[_0x9629('0x1d')]?_[_0x9629('0x1c')](_0x4c4e22[_0x9629('0x1d')],function(_0x5c9c41){return{'model':db[_0x5c9c41[_0x9629('0x1e')]],'as':_0x5c9c41['as'],'attributes':_0x5c9c41[_0x9629('0x1a')],'include':_0x5c9c41[_0x9629('0x1d')]?_[_0x9629('0x1c')](_0x5c9c41[_0x9629('0x1d')],function(_0x168c7b){return{'model':db[_0x168c7b['model']],'as':_0x168c7b['as'],'attributes':_0x168c7b[_0x9629('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9629('0x1f')](function(_0x528b35){logger['info'](_0x9629('0x21'),_0x2de66e);logger[_0x9629('0xd')](_0x9629('0x21'),_0x2de66e,JSON['stringify'](_0x528b35));_0x160eb9(_0x528b35);})[_0x9629('0x14')](function(_0x3b8d6b){logger[_0x9629('0x10')](_0x9629('0x21'),_0x3b8d6b[_0x9629('0x12')],_0x2de66e);_0x505590(_0x5cf1b6[_0x9629('0x10')](0x1f4,_0x3b8d6b[_0x9629('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a0d8717..74fa4e5 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 _0x48f9=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy'];(function(_0x1381ad,_0x153441){var _0x7f4eec=function(_0x256cea){while(--_0x256cea){_0x1381ad['push'](_0x1381ad['shift']());}};_0x7f4eec(++_0x153441);}(_0x48f9,0x127));var _0x948f=function(_0x4bfbe7,_0x183140){_0x4bfbe7=_0x4bfbe7-0x0;var _0x5cb49f=_0x48f9[_0x4bfbe7];return _0x5cb49f;};'use strict';var multer=require(_0x948f('0x0'));var util=require(_0x948f('0x1'));var path=require(_0x948f('0x2'));var timeout=require(_0x948f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x948f('0x4'));var interaction=require(_0x948f('0x5'));var config=require('../../config/environment');var controller=require(_0x948f('0x6'));router[_0x948f('0x7')]('/',auth[_0x948f('0x8')](),controller['index']);router[_0x948f('0x7')](_0x948f('0x9'),auth[_0x948f('0x8')](),controller[_0x948f('0xa')]);router[_0x948f('0x7')](_0x948f('0xb'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x948f('0xc'),auth[_0x948f('0x8')](),controller[_0x948f('0xd')]);router[_0x948f('0x7')](_0x948f('0xe'),auth[_0x948f('0x8')](),controller['getDescriptions']);router[_0x948f('0xf')]('/',auth[_0x948f('0x8')](),controller[_0x948f('0x10')]);router[_0x948f('0x11')]('/:id',auth[_0x948f('0x8')](),controller[_0x948f('0x12')]);router['delete'](_0x948f('0x9'),auth[_0x948f('0x8')](),controller[_0x948f('0x13')]);module[_0x948f('0x14')]=router; \ No newline at end of file +var _0x2d90=['./intDynamics365Configuration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dc953,_0x53cfcc){var _0x4e7ba1=function(_0xbaa638){while(--_0xbaa638){_0x3dc953['push'](_0x3dc953['shift']());}};_0x4e7ba1(++_0x53cfcc);}(_0x2d90,0x6b));var _0x02d9=function(_0x437767,_0x3e7b25){_0x437767=_0x437767-0x0;var _0x341ab1=_0x2d90[_0x437767];return _0x341ab1;};'use strict';var multer=require(_0x02d9('0x0'));var util=require(_0x02d9('0x1'));var path=require(_0x02d9('0x2'));var timeout=require(_0x02d9('0x3'));var express=require(_0x02d9('0x4'));var router=express['Router']();var auth=require(_0x02d9('0x5'));var interaction=require(_0x02d9('0x6'));var config=require(_0x02d9('0x7'));var controller=require(_0x02d9('0x8'));router[_0x02d9('0x9')]('/',auth['isAuthenticated'](),controller[_0x02d9('0xa')]);router[_0x02d9('0x9')](_0x02d9('0xb'),auth['isAuthenticated'](),controller[_0x02d9('0xc')]);router[_0x02d9('0x9')](_0x02d9('0xd'),auth[_0x02d9('0xe')](),controller['getFields']);router[_0x02d9('0x9')](_0x02d9('0xf'),auth['isAuthenticated'](),controller[_0x02d9('0x10')]);router[_0x02d9('0x9')](_0x02d9('0x11'),auth[_0x02d9('0xe')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x02d9('0x12')]);router[_0x02d9('0x13')](_0x02d9('0xb'),auth[_0x02d9('0xe')](),controller[_0x02d9('0x14')]);router[_0x02d9('0x15')](_0x02d9('0xb'),auth[_0x02d9('0xe')](),controller[_0x02d9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b27f5f7..f22acae 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 _0x83be=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83be,0xa1));var _0xe83b=function(_0x515998,_0x2625ba){_0x515998=_0x515998-0x0;var _0x128304=_0x83be[_0x515998];return _0x128304;};'use strict';var Sequelize=require(_0xe83b('0x0'));module[_0xe83b('0x1')]={'name':{'type':Sequelize[_0xe83b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xe83b('0x3')](_0xe83b('0x4'),_0xe83b('0x5')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xc5ce=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5ce,0x170));var _0xec5c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc5ce[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0xec5c('0x0'));module[_0xec5c('0x1')]={'name':{'type':Sequelize[_0xec5c('0x2')]},'description':{'type':Sequelize[_0xec5c('0x2')]},'ticketType':{'type':Sequelize[_0xec5c('0x3')](_0xec5c('0x4'),_0xec5c('0x5')),'defaultValue':_0xec5c('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0da9c76..570cbd8 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 _0x5dd6=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','Content-Range','apply','reject','update','end','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne','Dynamics365Field','order','getFields','getSubjects','hasOwnProperty','length','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x5dd6,0x1b3));var _0x65dd=function(_0x480ee3,_0x4ce5b6){_0x480ee3=_0x480ee3-0x0;var _0x378987=_0x5dd6[_0x480ee3];return _0x378987;};'use strict';var pdf=require(_0x65dd('0x0'));var emlformat=require(_0x65dd('0x1'));var rimraf=require(_0x65dd('0x2'));var zipdir=require(_0x65dd('0x3'));var jsonpatch=require(_0x65dd('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65dd('0x5'));var path=require(_0x65dd('0x6'));var sox=require(_0x65dd('0x7'));var csv=require(_0x65dd('0x8'));var ejs=require(_0x65dd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65dd('0xa'));var crypto=require(_0x65dd('0xb'));var jsforce=require(_0x65dd('0xc'));var deskjs=require(_0x65dd('0xd'));var toCsv=require(_0x65dd('0x8'));var querystring=require(_0x65dd('0xe'));var Papa=require(_0x65dd('0xf'));var Redis=require(_0x65dd('0x10'));var authService=require(_0x65dd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x65dd('0x12'));var hardwareService=require(_0x65dd('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65dd('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x65dd('0x15'));var client=jayson[_0x65dd('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0xcd14b0,_0xc0401c,_0x375e8f){if(_0x375e8f){var _0x2ddab7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ddab7[_0x65dd('0x17')](_0xc0401c)){return _0xcd14b0;}else{throw new db[(_0x65dd('0x18'))][(_0x65dd('0x19'))](_0x65dd('0x1a'));}}else{return _0xcd14b0;}}function respondWithRpcPromise(_0x4fba64,_0x7d0d36,_0x1a5ed7,_0x377823){return new BPromise(function(_0x455f0a,_0x264c41){var _0x2929b5=_0x377823||client;return _0x2929b5[_0x65dd('0x1b')](_0x4fba64,_0x1a5ed7)[_0x65dd('0x1c')](function(_0x8e67f7){logger[_0x65dd('0x1d')](_0x65dd('0x1e'),_0x7d0d36,_0x65dd('0x1f'));logger[_0x65dd('0x20')](_0x65dd('0x21'),_0x7d0d36,_0x65dd('0x1f'),JSON[_0x65dd('0x22')](_0x8e67f7));if(_0x8e67f7[_0x65dd('0x23')]){if(_0x8e67f7['error'][_0x65dd('0x24')]===0x1f4){logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x8e67f7['error'][_0x65dd('0x25')]);return _0x264c41(_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);}logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);return _0x455f0a(_0x8e67f7[_0x65dd('0x23')][_0x65dd('0x25')]);}else{logger['info'](_0x65dd('0x1e'),_0x7d0d36,_0x65dd('0x1f'));_0x455f0a(_0x8e67f7[_0x65dd('0x26')][_0x65dd('0x25')]);}})[_0x65dd('0x27')](function(_0x5d2db5){logger[_0x65dd('0x23')](_0x65dd('0x1e'),_0x7d0d36,_0x5d2db5);_0x264c41(_0x5d2db5);});});}function respondWithStatusCode(_0x11e77e,_0x755344){_0x755344=_0x755344||0xcc;return function(_0x4f041a){if(_0x4f041a){return _0x11e77e[_0x65dd('0x28')](_0x755344);}return _0x11e77e[_0x65dd('0x29')](_0x755344)['end']();};}function respondWithResult(_0xbba743,_0x39bb28){_0x39bb28=_0x39bb28||0xc8;return function(_0x3b8e1d){if(_0x3b8e1d){return _0xbba743[_0x65dd('0x29')](_0x39bb28)[_0x65dd('0x2a')](_0x3b8e1d);}};}function respondWithFilteredResult(_0x4b3f38,_0x5798a5){return function(_0x4d68f8){if(_0x4d68f8){var _0x2de836=_0x4d68f8['count'],_0x352b02=_0x5798a5[_0x65dd('0x2b')],_0x503ea1=_0x5798a5[_0x65dd('0x2b')]+_0x5798a5['limit'],_0x483a4e;if(_0x503ea1>=_0x2de836){_0x503ea1=_0x2de836;_0x483a4e=0xc8;}else{_0x483a4e=0xce;}_0x4b3f38[_0x65dd('0x29')](_0x483a4e);return _0x4b3f38['set'](_0x65dd('0x2c'),_0x352b02+'-'+_0x503ea1+'/'+_0x2de836)[_0x65dd('0x2a')](_0x4d68f8);}return null;};}function patchUpdates(_0x1fe927){return function(_0x581e4a){try{jsonpatch[_0x65dd('0x2d')](_0x581e4a,_0x1fe927,!![]);}catch(_0x34317b){return BPromise[_0x65dd('0x2e')](_0x34317b);}return _0x581e4a['save']();};}function saveUpdates(_0x1bb030,_0x58077c){return function(_0x109464){if(_0x109464){return _0x109464[_0x65dd('0x2f')](_0x1bb030)[_0x65dd('0x1c')](function(_0x433e87){return _0x433e87;});}return null;};}function removeEntity(_0x966a31,_0x358168){return function(_0x75fedc){if(_0x75fedc){return _0x75fedc['destroy']()['then'](function(){_0x966a31['status'](0xcc)[_0x65dd('0x30')]();});}};}function handleEntityNotFound(_0x2ed8c0,_0x2f73c6){return function(_0x1212b7){if(!_0x1212b7){_0x2ed8c0[_0x65dd('0x28')](0x194);}return _0x1212b7;};}function handleError(_0x6b587a,_0x1bebb1){_0x1bebb1=_0x1bebb1||0x1f4;return function(_0x52569c){logger[_0x65dd('0x23')](_0x52569c[_0x65dd('0x31')]);if(_0x52569c[_0x65dd('0x32')]){delete _0x52569c[_0x65dd('0x32')];}_0x6b587a['status'](_0x1bebb1)[_0x65dd('0x33')](_0x52569c);};}exports[_0x65dd('0x34')]=function(_0x578a6a,_0x557836){var _0x3f3e54={},_0x421540={},_0x4d98b8={'count':0x0,'rows':[]};var _0xc9eebf=_['map'](db[_0x65dd('0x35')][_0x65dd('0x36')],function(_0x47ea2a){return{'name':_0x47ea2a['fieldName'],'type':_0x47ea2a[_0x65dd('0x37')][_0x65dd('0x38')]};});_0x421540[_0x65dd('0x39')]=_['map'](_0xc9eebf,_0x65dd('0x32'));_0x421540[_0x65dd('0x3a')]=_['keys'](_0x578a6a['query']);_0x421540[_0x65dd('0x3b')]=_[_0x65dd('0x3c')](_0x421540['model'],_0x421540['query']);_0x3f3e54[_0x65dd('0x3d')]=_[_0x65dd('0x3c')](_0x421540[_0x65dd('0x39')],qs[_0x65dd('0x3e')](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0x3f3e54[_0x65dd('0x3d')]=_0x3f3e54[_0x65dd('0x3d')]['length']?_0x3f3e54['attributes']:_0x421540[_0x65dd('0x39')];if(!_0x578a6a['query']['hasOwnProperty'](_0x65dd('0x3f'))){_0x3f3e54[_0x65dd('0x40')]=qs[_0x65dd('0x40')](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x3f3e54[_0x65dd('0x2b')]=qs['offset'](_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x2b')]);}_0x3f3e54['order']=qs[_0x65dd('0x41')](_0x578a6a[_0x65dd('0x3a')]['sort']);_0x3f3e54[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x578a6a[_0x65dd('0x3a')],_0x421540['filters']),_0xc9eebf);if(_0x578a6a[_0x65dd('0x3a')][_0x65dd('0x44')]){_0x3f3e54[_0x65dd('0x42')]=_['merge'](_0x3f3e54[_0x65dd('0x42')],{'$or':_[_0x65dd('0x45')](_0xc9eebf,function(_0x38fc1d){if(_0x38fc1d['type']!==_0x65dd('0x46')){var _0x43b45c={};_0x43b45c[_0x38fc1d[_0x65dd('0x32')]]={'$like':'%'+_0x578a6a['query']['filter']+'%'};return _0x43b45c;}})});}_0x3f3e54=_[_0x65dd('0x47')]({},_0x3f3e54,_0x578a6a[_0x65dd('0x48')]);var _0x4e4c6e={'where':_0x3f3e54[_0x65dd('0x42')]};return db[_0x65dd('0x35')]['count'](_0x4e4c6e)[_0x65dd('0x1c')](function(_0x149470){_0x4d98b8[_0x65dd('0x49')]=_0x149470;if(_0x578a6a['query'][_0x65dd('0x4a')]){_0x3f3e54[_0x65dd('0x4b')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x65dd('0x4c')](_0x3f3e54);})['then'](function(_0x25170a){_0x4d98b8[_0x65dd('0x4d')]=_0x25170a;return _0x4d98b8;})[_0x65dd('0x1c')](respondWithFilteredResult(_0x557836,_0x3f3e54))[_0x65dd('0x27')](handleError(_0x557836,null));};exports[_0x65dd('0x4e')]=function(_0x5f4ba2,_0x224a99){var _0x3b801c={'raw':![],'where':{'id':_0x5f4ba2[_0x65dd('0x4f')]['id']}},_0x687c12={};_0x687c12[_0x65dd('0x39')]=_[_0x65dd('0x50')](db[_0x65dd('0x35')][_0x65dd('0x36')]);_0x687c12['query']=_['keys'](_0x5f4ba2[_0x65dd('0x3a')]);_0x687c12['filters']=_[_0x65dd('0x3c')](_0x687c12[_0x65dd('0x39')],_0x687c12[_0x65dd('0x3a')]);_0x3b801c[_0x65dd('0x3d')]=_['intersection'](_0x687c12['model'],qs[_0x65dd('0x3e')](_0x5f4ba2[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0x3b801c[_0x65dd('0x3d')]=_0x3b801c[_0x65dd('0x3d')]['length']?_0x3b801c['attributes']:_0x687c12[_0x65dd('0x39')];if(_0x5f4ba2[_0x65dd('0x3a')][_0x65dd('0x4a')]){_0x3b801c['include']=[{'all':!![]}];}_0x3b801c=_[_0x65dd('0x47')]({},_0x3b801c,_0x5f4ba2['options']);return db[_0x65dd('0x35')][_0x65dd('0x51')](_0x3b801c)[_0x65dd('0x1c')](handleEntityNotFound(_0x224a99,null))[_0x65dd('0x1c')](respondWithResult(_0x224a99,null))[_0x65dd('0x27')](handleError(_0x224a99,null));};exports[_0x65dd('0x52')]=function(_0x3b5fda,_0x2728e0){return db[_0x65dd('0x35')]['create'](_0x3b5fda['body'],{})[_0x65dd('0x1c')](respondWithResult(_0x2728e0,0xc9))['catch'](handleError(_0x2728e0,null));};exports['update']=function(_0x495fcf,_0x4b22e8){if(_0x495fcf[_0x65dd('0x53')]['id']){delete _0x495fcf[_0x65dd('0x53')]['id'];}return db[_0x65dd('0x35')][_0x65dd('0x51')]({'where':{'id':_0x495fcf[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x4b22e8,null))[_0x65dd('0x1c')](saveUpdates(_0x495fcf[_0x65dd('0x53')],null))[_0x65dd('0x1c')](respondWithResult(_0x4b22e8,null))['catch'](handleError(_0x4b22e8,null));};exports[_0x65dd('0x54')]=function(_0x173767,_0x38f906){return db['Dynamics365Configuration'][_0x65dd('0x51')]({'where':{'id':_0x173767[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x38f906,null))[_0x65dd('0x1c')](removeEntity(_0x38f906,null))[_0x65dd('0x27')](handleError(_0x38f906,null));};exports['getFields']=function(_0x4864aa,_0x58520a,_0x28de5a){var _0xf8522f={};var _0x4a8761={};var _0x345e64;var _0x4fe7c8;return db[_0x65dd('0x35')][_0x65dd('0x55')]({'where':{'id':_0x4864aa[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x58520a,null))[_0x65dd('0x1c')](function(_0x5cdd6f){if(_0x5cdd6f){_0x345e64=_0x5cdd6f;_0x4a8761['model']=_[_0x65dd('0x50')](db[_0x65dd('0x56')][_0x65dd('0x36')]);_0x4a8761[_0x65dd('0x3a')]=_[_0x65dd('0x50')](_0x4864aa['query']);_0x4a8761['filters']=_[_0x65dd('0x3c')](_0x4a8761[_0x65dd('0x39')],_0x4a8761[_0x65dd('0x3a')]);_0xf8522f['attributes']=_[_0x65dd('0x3c')](_0x4a8761['model'],qs['fields'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x3e')]));_0xf8522f[_0x65dd('0x3d')]=_0xf8522f[_0x65dd('0x3d')]['length']?_0xf8522f['attributes']:_0x4a8761[_0x65dd('0x39')];_0xf8522f[_0x65dd('0x57')]=qs['sort'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x41')]);_0xf8522f['where']=qs['filters'](_[_0x65dd('0x43')](_0x4864aa['query'],_0x4a8761[_0x65dd('0x3b')]));if(_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x44')]){_0xf8522f[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0xf8522f['where'],{'$or':_[_0x65dd('0x45')](_0xf8522f['attributes'],function(_0x2e544a){var _0x407b6c={};_0x407b6c[_0x2e544a]={'$like':'%'+_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x44')]+'%'};return _0x407b6c;})});}_0xf8522f=_['merge']({},_0xf8522f,_0x4864aa['options']);return _0x345e64[_0x65dd('0x58')](_0xf8522f);}})['then'](function(_0x559698){if(_0x559698){_0x4fe7c8=_0x559698['length'];if(!_0x4864aa[_0x65dd('0x3a')]['hasOwnProperty'](_0x65dd('0x3f'))){_0xf8522f[_0x65dd('0x40')]=qs['limit'](_0x4864aa[_0x65dd('0x3a')][_0x65dd('0x40')]);_0xf8522f['offset']=qs['offset'](_0x4864aa[_0x65dd('0x3a')]['offset']);}return _0x345e64['getFields'](_0xf8522f);}})[_0x65dd('0x1c')](function(_0x16a08c){if(_0x16a08c){return _0x16a08c?{'count':_0x4fe7c8,'rows':_0x16a08c}:null;}})[_0x65dd('0x1c')](respondWithResult(_0x58520a,null))[_0x65dd('0x27')](handleError(_0x58520a,null));};exports[_0x65dd('0x59')]=function(_0x3b1d1f,_0x5ee564,_0x5638dc){var _0x4e6d9d={};var _0x22be20={};var _0x2e265f;var _0x17f010;return db[_0x65dd('0x35')][_0x65dd('0x55')]({'where':{'id':_0x3b1d1f[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x5ee564,null))[_0x65dd('0x1c')](function(_0x3dc814){if(_0x3dc814){_0x2e265f=_0x3dc814;_0x22be20[_0x65dd('0x39')]=_[_0x65dd('0x50')](db[_0x65dd('0x56')][_0x65dd('0x36')]);_0x22be20['query']=_[_0x65dd('0x50')](_0x3b1d1f['query']);_0x22be20[_0x65dd('0x3b')]=_[_0x65dd('0x3c')](_0x22be20[_0x65dd('0x39')],_0x22be20[_0x65dd('0x3a')]);_0x4e6d9d[_0x65dd('0x3d')]=_[_0x65dd('0x3c')](_0x22be20[_0x65dd('0x39')],qs['fields'](_0x3b1d1f[_0x65dd('0x3a')]['fields']));_0x4e6d9d[_0x65dd('0x3d')]=_0x4e6d9d[_0x65dd('0x3d')]['length']?_0x4e6d9d['attributes']:_0x22be20[_0x65dd('0x39')];_0x4e6d9d['order']=qs[_0x65dd('0x41')](_0x3b1d1f['query']['sort']);_0x4e6d9d[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x3b1d1f[_0x65dd('0x3a')],_0x22be20[_0x65dd('0x3b')]));if(_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x44')]){_0x4e6d9d[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0x4e6d9d['where'],{'$or':_['map'](_0x4e6d9d[_0x65dd('0x3d')],function(_0x2b1295){var _0x2b66ce={};_0x2b66ce[_0x2b1295]={'$like':'%'+_0x3b1d1f['query']['filter']+'%'};return _0x2b66ce;})});}_0x4e6d9d=_[_0x65dd('0x47')]({},_0x4e6d9d,_0x3b1d1f['options']);return _0x2e265f['getSubjects'](_0x4e6d9d);}})[_0x65dd('0x1c')](function(_0x2ca190){if(_0x2ca190){_0x17f010=_0x2ca190['length'];if(!_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x5a')](_0x65dd('0x3f'))){_0x4e6d9d['limit']=qs[_0x65dd('0x40')](_0x3b1d1f[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x4e6d9d[_0x65dd('0x2b')]=qs['offset'](_0x3b1d1f['query'][_0x65dd('0x2b')]);}return _0x2e265f[_0x65dd('0x59')](_0x4e6d9d);}})[_0x65dd('0x1c')](function(_0x1050b3){if(_0x1050b3){return _0x1050b3?{'count':_0x17f010,'rows':_0x1050b3}:null;}})['then'](respondWithResult(_0x5ee564,null))[_0x65dd('0x27')](handleError(_0x5ee564,null));};exports['getDescriptions']=function(_0x5dcb5c,_0x468961,_0x4b07e6){var _0x16fb29={};var _0x410c5a={};var _0x16c666;var _0x516943;return db[_0x65dd('0x35')]['findOne']({'where':{'id':_0x5dcb5c[_0x65dd('0x4f')]['id']}})[_0x65dd('0x1c')](handleEntityNotFound(_0x468961,null))[_0x65dd('0x1c')](function(_0x1bec42){if(_0x1bec42){_0x16c666=_0x1bec42;_0x410c5a[_0x65dd('0x39')]=_['keys'](db['Dynamics365Field'][_0x65dd('0x36')]);_0x410c5a[_0x65dd('0x3a')]=_[_0x65dd('0x50')](_0x5dcb5c[_0x65dd('0x3a')]);_0x410c5a['filters']=_[_0x65dd('0x3c')](_0x410c5a['model'],_0x410c5a['query']);_0x16fb29['attributes']=_[_0x65dd('0x3c')](_0x410c5a['model'],qs[_0x65dd('0x3e')](_0x5dcb5c[_0x65dd('0x3a')]['fields']));_0x16fb29[_0x65dd('0x3d')]=_0x16fb29[_0x65dd('0x3d')][_0x65dd('0x5b')]?_0x16fb29[_0x65dd('0x3d')]:_0x410c5a[_0x65dd('0x39')];_0x16fb29[_0x65dd('0x57')]=qs[_0x65dd('0x41')](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x41')]);_0x16fb29[_0x65dd('0x42')]=qs[_0x65dd('0x3b')](_[_0x65dd('0x43')](_0x5dcb5c[_0x65dd('0x3a')],_0x410c5a['filters']));if(_0x5dcb5c['query'][_0x65dd('0x44')]){_0x16fb29[_0x65dd('0x42')]=_[_0x65dd('0x47')](_0x16fb29[_0x65dd('0x42')],{'$or':_[_0x65dd('0x45')](_0x16fb29[_0x65dd('0x3d')],function(_0x5e4a3f){var _0x3f4722={};_0x3f4722[_0x5e4a3f]={'$like':'%'+_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x44')]+'%'};return _0x3f4722;})});}_0x16fb29=_[_0x65dd('0x47')]({},_0x16fb29,_0x5dcb5c[_0x65dd('0x48')]);return _0x16c666[_0x65dd('0x5c')](_0x16fb29);}})[_0x65dd('0x1c')](function(_0x39c0bf){if(_0x39c0bf){_0x516943=_0x39c0bf['length'];if(!_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x5a')](_0x65dd('0x3f'))){_0x16fb29['limit']=qs[_0x65dd('0x40')](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x40')]);_0x16fb29[_0x65dd('0x2b')]=qs['offset'](_0x5dcb5c[_0x65dd('0x3a')][_0x65dd('0x2b')]);}return _0x16c666[_0x65dd('0x5c')](_0x16fb29);}})[_0x65dd('0x1c')](function(_0x22d3cf){if(_0x22d3cf){return _0x22d3cf?{'count':_0x516943,'rows':_0x22d3cf}:null;}})[_0x65dd('0x1c')](respondWithResult(_0x468961,null))['catch'](handleError(_0x468961,null));}; \ No newline at end of file +var _0x7fc9=['catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','destroy','stack','name','send','index','map','Dynamics365Configuration','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','merge','count','includeAll','include','findAll','rows','params','rawAttributes','length','options','find','update','body','Dynamics365Field','getFields','nolimit','getSubjects','getDescriptions','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','request','then','info','request\x20sent','debug','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result'];(function(_0xc9bd7c,_0x310bc2){var _0x26e21b=function(_0x4c7a9e){while(--_0x4c7a9e){_0xc9bd7c['push'](_0xc9bd7c['shift']());}};_0x26e21b(++_0x310bc2);}(_0x7fc9,0x18b));var _0x97fc=function(_0x26307f,_0x562b44){_0x26307f=_0x26307f-0x0;var _0x5ac553=_0x7fc9[_0x26307f];return _0x5ac553;};'use strict';var pdf=require(_0x97fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x97fc('0x1'));var zipdir=require(_0x97fc('0x2'));var jsonpatch=require(_0x97fc('0x3'));var rp=require(_0x97fc('0x4'));var moment=require(_0x97fc('0x5'));var BPromise=require(_0x97fc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x97fc('0x7'));var sox=require('sox');var csv=require(_0x97fc('0x8'));var ejs=require(_0x97fc('0x9'));var fs=require('fs');var _=require(_0x97fc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97fc('0xb'));var deskjs=require(_0x97fc('0xc'));var toCsv=require(_0x97fc('0x8'));var querystring=require(_0x97fc('0xd'));var Papa=require(_0x97fc('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x97fc('0xf'));var as=require(_0x97fc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97fc('0x11'))('api');var utils=require(_0x97fc('0x12'));var config=require(_0x97fc('0x13'));var db=require(_0x97fc('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x97fc('0x15')][_0x97fc('0x16')]({'port':0x232a});function checkPasswordPattern(_0xb0a9e1,_0x107094,_0x3bb6eb){if(_0x3bb6eb){var _0x467dc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x467dc8['test'](_0x107094)){return _0xb0a9e1;}else{throw new db[(_0x97fc('0x17'))][(_0x97fc('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xb0a9e1;}}function respondWithRpcPromise(_0x290ed0,_0x3e0b9b,_0x2c4d8c,_0x3611b8){return new BPromise(function(_0x44c034,_0x572e88){var _0x49c09f=_0x3611b8||client;return _0x49c09f[_0x97fc('0x19')](_0x290ed0,_0x2c4d8c)[_0x97fc('0x1a')](function(_0x39f831){logger[_0x97fc('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3e0b9b,_0x97fc('0x1c'));logger[_0x97fc('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3e0b9b,_0x97fc('0x1c'),JSON[_0x97fc('0x1e')](_0x39f831));if(_0x39f831[_0x97fc('0x1f')]){if(_0x39f831[_0x97fc('0x1f')]['code']===0x1f4){logger[_0x97fc('0x1f')](_0x97fc('0x20'),_0x3e0b9b,_0x39f831[_0x97fc('0x1f')][_0x97fc('0x21')]);return _0x572e88(_0x39f831[_0x97fc('0x1f')]['message']);}logger[_0x97fc('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3e0b9b,_0x39f831[_0x97fc('0x1f')]['message']);return _0x44c034(_0x39f831['error'][_0x97fc('0x21')]);}else{logger['info'](_0x97fc('0x20'),_0x3e0b9b,_0x97fc('0x1c'));_0x44c034(_0x39f831[_0x97fc('0x22')]['message']);}})[_0x97fc('0x23')](function(_0x22d798){logger[_0x97fc('0x1f')](_0x97fc('0x20'),_0x3e0b9b,_0x22d798);_0x572e88(_0x22d798);});});}function respondWithStatusCode(_0x25dbc2,_0x504df6){_0x504df6=_0x504df6||0xcc;return function(_0x33d9d6){if(_0x33d9d6){return _0x25dbc2[_0x97fc('0x24')](_0x504df6);}return _0x25dbc2[_0x97fc('0x25')](_0x504df6)[_0x97fc('0x26')]();};}function respondWithResult(_0x3372f4,_0x3ce483){_0x3ce483=_0x3ce483||0xc8;return function(_0x2263a4){if(_0x2263a4){return _0x3372f4[_0x97fc('0x25')](_0x3ce483)[_0x97fc('0x27')](_0x2263a4);}};}function respondWithFilteredResult(_0x148412,_0x53dee5){return function(_0x327659){if(_0x327659){var _0x369fd0=_0x327659['count'],_0x2538de=_0x53dee5[_0x97fc('0x28')],_0x4d7b83=_0x53dee5['offset']+_0x53dee5[_0x97fc('0x29')],_0x3c764c;if(_0x4d7b83>=_0x369fd0){_0x4d7b83=_0x369fd0;_0x3c764c=0xc8;}else{_0x3c764c=0xce;}_0x148412[_0x97fc('0x25')](_0x3c764c);return _0x148412['set'](_0x97fc('0x2a'),_0x2538de+'-'+_0x4d7b83+'/'+_0x369fd0)['json'](_0x327659);}return null;};}function patchUpdates(_0x5f5451){return function(_0x49c91b){try{jsonpatch[_0x97fc('0x2b')](_0x49c91b,_0x5f5451,!![]);}catch(_0xa81fd7){return BPromise[_0x97fc('0x2c')](_0xa81fd7);}return _0x49c91b['save']();};}function saveUpdates(_0x255603,_0xc4dd06){return function(_0x1e2472){if(_0x1e2472){return _0x1e2472['update'](_0x255603)[_0x97fc('0x1a')](function(_0x3b1348){return _0x3b1348;});}return null;};}function removeEntity(_0x47bfdc,_0x528cc2){return function(_0x235fce){if(_0x235fce){return _0x235fce[_0x97fc('0x2d')]()['then'](function(){_0x47bfdc[_0x97fc('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5191,_0x12a185){return function(_0xd23129){if(!_0xd23129){_0x3b5191[_0x97fc('0x24')](0x194);}return _0xd23129;};}function handleError(_0x1ef836,_0x15bc19){_0x15bc19=_0x15bc19||0x1f4;return function(_0x3fe525){logger['error'](_0x3fe525[_0x97fc('0x2e')]);if(_0x3fe525[_0x97fc('0x2f')]){delete _0x3fe525[_0x97fc('0x2f')];}_0x1ef836['status'](_0x15bc19)[_0x97fc('0x30')](_0x3fe525);};}exports[_0x97fc('0x31')]=function(_0x242196,_0x4c9c51){var _0x37721f={},_0x1c8fbc={},_0x155ff9={'count':0x0,'rows':[]};var _0x4d820d=_[_0x97fc('0x32')](db[_0x97fc('0x33')]['rawAttributes'],function(_0x1d6d1e){return{'name':_0x1d6d1e[_0x97fc('0x34')],'type':_0x1d6d1e['type']['key']};});_0x1c8fbc[_0x97fc('0x35')]=_[_0x97fc('0x32')](_0x4d820d,_0x97fc('0x2f'));_0x1c8fbc['query']=_[_0x97fc('0x36')](_0x242196[_0x97fc('0x37')]);_0x1c8fbc[_0x97fc('0x38')]=_[_0x97fc('0x39')](_0x1c8fbc['model'],_0x1c8fbc['query']);_0x37721f[_0x97fc('0x3a')]=_[_0x97fc('0x39')](_0x1c8fbc['model'],qs[_0x97fc('0x3b')](_0x242196['query']['fields']));_0x37721f['attributes']=_0x37721f['attributes']['length']?_0x37721f[_0x97fc('0x3a')]:_0x1c8fbc[_0x97fc('0x35')];if(!_0x242196['query'][_0x97fc('0x3c')]('nolimit')){_0x37721f[_0x97fc('0x29')]=qs[_0x97fc('0x29')](_0x242196[_0x97fc('0x37')][_0x97fc('0x29')]);_0x37721f[_0x97fc('0x28')]=qs[_0x97fc('0x28')](_0x242196[_0x97fc('0x37')][_0x97fc('0x28')]);}_0x37721f[_0x97fc('0x3d')]=qs['sort'](_0x242196[_0x97fc('0x37')][_0x97fc('0x3e')]);_0x37721f[_0x97fc('0x3f')]=qs[_0x97fc('0x38')](_[_0x97fc('0x40')](_0x242196['query'],_0x1c8fbc[_0x97fc('0x38')]),_0x4d820d);if(_0x242196[_0x97fc('0x37')][_0x97fc('0x41')]){_0x37721f[_0x97fc('0x3f')]=_['merge'](_0x37721f[_0x97fc('0x3f')],{'$or':_[_0x97fc('0x32')](_0x4d820d,function(_0x1f3cf3){if(_0x1f3cf3[_0x97fc('0x42')]!=='VIRTUAL'){var _0x1a0796={};_0x1a0796[_0x1f3cf3[_0x97fc('0x2f')]]={'$like':'%'+_0x242196[_0x97fc('0x37')][_0x97fc('0x41')]+'%'};return _0x1a0796;}})});}_0x37721f=_[_0x97fc('0x43')]({},_0x37721f,_0x242196['options']);var _0x45a6a6={'where':_0x37721f[_0x97fc('0x3f')]};return db[_0x97fc('0x33')]['count'](_0x45a6a6)[_0x97fc('0x1a')](function(_0x4f3748){_0x155ff9[_0x97fc('0x44')]=_0x4f3748;if(_0x242196[_0x97fc('0x37')][_0x97fc('0x45')]){_0x37721f[_0x97fc('0x46')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x97fc('0x47')](_0x37721f);})['then'](function(_0x3825fe){_0x155ff9[_0x97fc('0x48')]=_0x3825fe;return _0x155ff9;})[_0x97fc('0x1a')](respondWithFilteredResult(_0x4c9c51,_0x37721f))[_0x97fc('0x23')](handleError(_0x4c9c51,null));};exports['show']=function(_0x3c20b5,_0x7686c9){var _0x4fbdc7={'raw':![],'where':{'id':_0x3c20b5[_0x97fc('0x49')]['id']}},_0x10d9bc={};_0x10d9bc['model']=_[_0x97fc('0x36')](db[_0x97fc('0x33')][_0x97fc('0x4a')]);_0x10d9bc[_0x97fc('0x37')]=_['keys'](_0x3c20b5['query']);_0x10d9bc[_0x97fc('0x38')]=_['intersection'](_0x10d9bc[_0x97fc('0x35')],_0x10d9bc['query']);_0x4fbdc7['attributes']=_['intersection'](_0x10d9bc['model'],qs[_0x97fc('0x3b')](_0x3c20b5[_0x97fc('0x37')]['fields']));_0x4fbdc7['attributes']=_0x4fbdc7['attributes'][_0x97fc('0x4b')]?_0x4fbdc7[_0x97fc('0x3a')]:_0x10d9bc[_0x97fc('0x35')];if(_0x3c20b5[_0x97fc('0x37')]['includeAll']){_0x4fbdc7[_0x97fc('0x46')]=[{'all':!![]}];}_0x4fbdc7=_[_0x97fc('0x43')]({},_0x4fbdc7,_0x3c20b5[_0x97fc('0x4c')]);return db[_0x97fc('0x33')][_0x97fc('0x4d')](_0x4fbdc7)[_0x97fc('0x1a')](handleEntityNotFound(_0x7686c9,null))[_0x97fc('0x1a')](respondWithResult(_0x7686c9,null))[_0x97fc('0x23')](handleError(_0x7686c9,null));};exports['create']=function(_0x586767,_0x38886d){return db[_0x97fc('0x33')]['create'](_0x586767['body'],{})['then'](respondWithResult(_0x38886d,0xc9))[_0x97fc('0x23')](handleError(_0x38886d,null));};exports[_0x97fc('0x4e')]=function(_0x466cb2,_0x27830c){if(_0x466cb2[_0x97fc('0x4f')]['id']){delete _0x466cb2[_0x97fc('0x4f')]['id'];}return db[_0x97fc('0x33')][_0x97fc('0x4d')]({'where':{'id':_0x466cb2[_0x97fc('0x49')]['id']}})[_0x97fc('0x1a')](handleEntityNotFound(_0x27830c,null))['then'](saveUpdates(_0x466cb2['body'],null))[_0x97fc('0x1a')](respondWithResult(_0x27830c,null))['catch'](handleError(_0x27830c,null));};exports['destroy']=function(_0x423815,_0x4227b9){return db[_0x97fc('0x33')][_0x97fc('0x4d')]({'where':{'id':_0x423815[_0x97fc('0x49')]['id']}})[_0x97fc('0x1a')](handleEntityNotFound(_0x4227b9,null))[_0x97fc('0x1a')](removeEntity(_0x4227b9,null))['catch'](handleError(_0x4227b9,null));};exports['getFields']=function(_0x129ff9,_0x3d6c60,_0x2d26e5){var _0x3cc0d4={};var _0x41dc06={};var _0x2fc428;var _0x489ee9;return db[_0x97fc('0x33')]['findOne']({'where':{'id':_0x129ff9[_0x97fc('0x49')]['id']}})[_0x97fc('0x1a')](handleEntityNotFound(_0x3d6c60,null))[_0x97fc('0x1a')](function(_0x5c4aeb){if(_0x5c4aeb){_0x2fc428=_0x5c4aeb;_0x41dc06['model']=_['keys'](db[_0x97fc('0x50')][_0x97fc('0x4a')]);_0x41dc06['query']=_[_0x97fc('0x36')](_0x129ff9[_0x97fc('0x37')]);_0x41dc06[_0x97fc('0x38')]=_['intersection'](_0x41dc06[_0x97fc('0x35')],_0x41dc06[_0x97fc('0x37')]);_0x3cc0d4[_0x97fc('0x3a')]=_[_0x97fc('0x39')](_0x41dc06[_0x97fc('0x35')],qs['fields'](_0x129ff9['query'][_0x97fc('0x3b')]));_0x3cc0d4[_0x97fc('0x3a')]=_0x3cc0d4[_0x97fc('0x3a')][_0x97fc('0x4b')]?_0x3cc0d4[_0x97fc('0x3a')]:_0x41dc06[_0x97fc('0x35')];_0x3cc0d4[_0x97fc('0x3d')]=qs['sort'](_0x129ff9[_0x97fc('0x37')][_0x97fc('0x3e')]);_0x3cc0d4[_0x97fc('0x3f')]=qs[_0x97fc('0x38')](_[_0x97fc('0x40')](_0x129ff9['query'],_0x41dc06[_0x97fc('0x38')]));if(_0x129ff9[_0x97fc('0x37')][_0x97fc('0x41')]){_0x3cc0d4[_0x97fc('0x3f')]=_['merge'](_0x3cc0d4[_0x97fc('0x3f')],{'$or':_[_0x97fc('0x32')](_0x3cc0d4[_0x97fc('0x3a')],function(_0x3fb45c){var _0x336878={};_0x336878[_0x3fb45c]={'$like':'%'+_0x129ff9[_0x97fc('0x37')][_0x97fc('0x41')]+'%'};return _0x336878;})});}_0x3cc0d4=_['merge']({},_0x3cc0d4,_0x129ff9['options']);return _0x2fc428[_0x97fc('0x51')](_0x3cc0d4);}})['then'](function(_0x4d7e9f){if(_0x4d7e9f){_0x489ee9=_0x4d7e9f[_0x97fc('0x4b')];if(!_0x129ff9[_0x97fc('0x37')][_0x97fc('0x3c')](_0x97fc('0x52'))){_0x3cc0d4[_0x97fc('0x29')]=qs['limit'](_0x129ff9[_0x97fc('0x37')][_0x97fc('0x29')]);_0x3cc0d4[_0x97fc('0x28')]=qs[_0x97fc('0x28')](_0x129ff9[_0x97fc('0x37')][_0x97fc('0x28')]);}return _0x2fc428[_0x97fc('0x51')](_0x3cc0d4);}})['then'](function(_0x7e9def){if(_0x7e9def){return _0x7e9def?{'count':_0x489ee9,'rows':_0x7e9def}:null;}})[_0x97fc('0x1a')](respondWithResult(_0x3d6c60,null))[_0x97fc('0x23')](handleError(_0x3d6c60,null));};exports[_0x97fc('0x53')]=function(_0x4a2fa6,_0x31de61,_0x465a64){var _0x21f2b0={};var _0x3c2433={};var _0x231607;var _0x3e4f34;return db[_0x97fc('0x33')]['findOne']({'where':{'id':_0x4a2fa6[_0x97fc('0x49')]['id']}})['then'](handleEntityNotFound(_0x31de61,null))[_0x97fc('0x1a')](function(_0x1d6efc){if(_0x1d6efc){_0x231607=_0x1d6efc;_0x3c2433['model']=_[_0x97fc('0x36')](db[_0x97fc('0x50')][_0x97fc('0x4a')]);_0x3c2433[_0x97fc('0x37')]=_[_0x97fc('0x36')](_0x4a2fa6['query']);_0x3c2433['filters']=_['intersection'](_0x3c2433[_0x97fc('0x35')],_0x3c2433['query']);_0x21f2b0[_0x97fc('0x3a')]=_[_0x97fc('0x39')](_0x3c2433[_0x97fc('0x35')],qs[_0x97fc('0x3b')](_0x4a2fa6[_0x97fc('0x37')][_0x97fc('0x3b')]));_0x21f2b0['attributes']=_0x21f2b0[_0x97fc('0x3a')][_0x97fc('0x4b')]?_0x21f2b0[_0x97fc('0x3a')]:_0x3c2433[_0x97fc('0x35')];_0x21f2b0['order']=qs['sort'](_0x4a2fa6[_0x97fc('0x37')][_0x97fc('0x3e')]);_0x21f2b0['where']=qs['filters'](_[_0x97fc('0x40')](_0x4a2fa6[_0x97fc('0x37')],_0x3c2433['filters']));if(_0x4a2fa6[_0x97fc('0x37')][_0x97fc('0x41')]){_0x21f2b0[_0x97fc('0x3f')]=_[_0x97fc('0x43')](_0x21f2b0[_0x97fc('0x3f')],{'$or':_[_0x97fc('0x32')](_0x21f2b0[_0x97fc('0x3a')],function(_0x36a898){var _0x889ef5={};_0x889ef5[_0x36a898]={'$like':'%'+_0x4a2fa6['query'][_0x97fc('0x41')]+'%'};return _0x889ef5;})});}_0x21f2b0=_[_0x97fc('0x43')]({},_0x21f2b0,_0x4a2fa6['options']);return _0x231607[_0x97fc('0x53')](_0x21f2b0);}})[_0x97fc('0x1a')](function(_0x31791e){if(_0x31791e){_0x3e4f34=_0x31791e['length'];if(!_0x4a2fa6[_0x97fc('0x37')][_0x97fc('0x3c')](_0x97fc('0x52'))){_0x21f2b0['limit']=qs[_0x97fc('0x29')](_0x4a2fa6[_0x97fc('0x37')][_0x97fc('0x29')]);_0x21f2b0['offset']=qs['offset'](_0x4a2fa6['query'][_0x97fc('0x28')]);}return _0x231607[_0x97fc('0x53')](_0x21f2b0);}})['then'](function(_0x58cceb){if(_0x58cceb){return _0x58cceb?{'count':_0x3e4f34,'rows':_0x58cceb}:null;}})['then'](respondWithResult(_0x31de61,null))[_0x97fc('0x23')](handleError(_0x31de61,null));};exports[_0x97fc('0x54')]=function(_0x4e61a5,_0x188844,_0x432ec){var _0x110f1e={};var _0x49bedd={};var _0xaa58a2;var _0x16c3da;return db['Dynamics365Configuration'][_0x97fc('0x55')]({'where':{'id':_0x4e61a5['params']['id']}})[_0x97fc('0x1a')](handleEntityNotFound(_0x188844,null))[_0x97fc('0x1a')](function(_0x528457){if(_0x528457){_0xaa58a2=_0x528457;_0x49bedd[_0x97fc('0x35')]=_[_0x97fc('0x36')](db['Dynamics365Field'][_0x97fc('0x4a')]);_0x49bedd['query']=_[_0x97fc('0x36')](_0x4e61a5[_0x97fc('0x37')]);_0x49bedd[_0x97fc('0x38')]=_['intersection'](_0x49bedd['model'],_0x49bedd[_0x97fc('0x37')]);_0x110f1e['attributes']=_[_0x97fc('0x39')](_0x49bedd[_0x97fc('0x35')],qs[_0x97fc('0x3b')](_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x3b')]));_0x110f1e[_0x97fc('0x3a')]=_0x110f1e['attributes'][_0x97fc('0x4b')]?_0x110f1e[_0x97fc('0x3a')]:_0x49bedd[_0x97fc('0x35')];_0x110f1e['order']=qs[_0x97fc('0x3e')](_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x3e')]);_0x110f1e[_0x97fc('0x3f')]=qs[_0x97fc('0x38')](_[_0x97fc('0x40')](_0x4e61a5[_0x97fc('0x37')],_0x49bedd[_0x97fc('0x38')]));if(_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x41')]){_0x110f1e[_0x97fc('0x3f')]=_[_0x97fc('0x43')](_0x110f1e['where'],{'$or':_[_0x97fc('0x32')](_0x110f1e['attributes'],function(_0x4b38d2){var _0x27e37a={};_0x27e37a[_0x4b38d2]={'$like':'%'+_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x41')]+'%'};return _0x27e37a;})});}_0x110f1e=_[_0x97fc('0x43')]({},_0x110f1e,_0x4e61a5[_0x97fc('0x4c')]);return _0xaa58a2[_0x97fc('0x54')](_0x110f1e);}})[_0x97fc('0x1a')](function(_0x1588f8){if(_0x1588f8){_0x16c3da=_0x1588f8[_0x97fc('0x4b')];if(!_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x3c')](_0x97fc('0x52'))){_0x110f1e[_0x97fc('0x29')]=qs[_0x97fc('0x29')](_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x29')]);_0x110f1e['offset']=qs[_0x97fc('0x28')](_0x4e61a5[_0x97fc('0x37')][_0x97fc('0x28')]);}return _0xaa58a2[_0x97fc('0x54')](_0x110f1e);}})[_0x97fc('0x1a')](function(_0x480ee0){if(_0x480ee0){return _0x480ee0?{'count':_0x16c3da,'rows':_0x480ee0}:null;}})['then'](respondWithResult(_0x188844,null))[_0x97fc('0x23')](handleError(_0x188844,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index acaea2e..68a8e04 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 _0x0986=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','define','Dynamics365Configuration','int_dynamics365_configurations'];(function(_0xb85b0e,_0x42fc5d){var _0x2b4c68=function(_0x1b0938){while(--_0x1b0938){_0xb85b0e['push'](_0xb85b0e['shift']());}};_0x2b4c68(++_0x42fc5d);}(_0x0986,0x82));var _0x6098=function(_0x19addb,_0x54191f){_0x19addb=_0x19addb-0x0;var _0x17529c=_0x0986[_0x19addb];return _0x17529c;};'use strict';var _=require(_0x6098('0x0'));var util=require(_0x6098('0x1'));var logger=require(_0x6098('0x2'))('api');var moment=require(_0x6098('0x3'));var BPromise=require(_0x6098('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6098('0x5'));var rimraf=require('rimraf');var config=require(_0x6098('0x6'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x19f183,_0x503188){return _0x19f183[_0x6098('0x7')](_0x6098('0x8'),attributes,{'tableName':_0x6098('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4eb0=['../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eb0,0x94));var _0x04eb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4eb0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x04eb('0x0'));var logger=require(_0x04eb('0x1'))('api');var moment=require(_0x04eb('0x2'));var BPromise=require(_0x04eb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04eb('0x4'));var rimraf=require(_0x04eb('0x5'));var config=require(_0x04eb('0x6'));var attributes=require(_0x04eb('0x7'));module[_0x04eb('0x8')]=function(_0x4957b6,_0x17223c){return _0x4957b6['define'](_0x04eb('0x9'),attributes,{'tableName':_0x04eb('0xa'),'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 af0ab3f..b4b3350 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 _0x4bd8=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x2fb1e4,_0x499f49){var _0xc0aad2=function(_0x285376){while(--_0x285376){_0x2fb1e4['push'](_0x2fb1e4['shift']());}};_0xc0aad2(++_0x499f49);}(_0x4bd8,0x86));var _0x84bd=function(_0x89e67a,_0xd56842){_0x89e67a=_0x89e67a-0x0;var _0x331078=_0x4bd8[_0x89e67a];return _0x331078;};'use strict';var _=require(_0x84bd('0x0'));var util=require('util');var moment=require(_0x84bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x84bd('0x2'));var fs=require('fs');var Redis=require(_0x84bd('0x3'));var db=require(_0x84bd('0x4'))['db'];var utils=require(_0x84bd('0x5'));var logger=require(_0x84bd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84bd('0x7'));var client=jayson['client'][_0x84bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2140,_0x32e9b0,_0x5f421e){return new BPromise(function(_0x45f384,_0x1ecc3b){return client[_0x84bd('0x9')](_0x3d2140,_0x5f421e)[_0x84bd('0xa')](function(_0x2ec86c){logger['info'](_0x84bd('0xb'),_0x32e9b0,_0x84bd('0xc'));logger[_0x84bd('0xd')](_0x84bd('0xe'),_0x32e9b0,_0x84bd('0xc'),JSON[_0x84bd('0xf')](_0x2ec86c));if(_0x2ec86c['error']){if(_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x11')]===0x1f4){logger[_0x84bd('0x10')](_0x84bd('0xb'),_0x32e9b0,_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);return _0x1ecc3b(_0x2ec86c['error'][_0x84bd('0x12')]);}logger['error'](_0x84bd('0xb'),_0x32e9b0,_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);return _0x45f384(_0x2ec86c[_0x84bd('0x10')][_0x84bd('0x12')]);}else{logger['info'](_0x84bd('0xb'),_0x32e9b0,_0x84bd('0xc'));_0x45f384(_0x2ec86c[_0x84bd('0x13')][_0x84bd('0x12')]);}})[_0x84bd('0x14')](function(_0x1cbd01){logger[_0x84bd('0x10')](_0x84bd('0xb'),_0x32e9b0,_0x1cbd01);_0x1ecc3b(_0x1cbd01);});});} \ No newline at end of file +var _0x4b9e=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e2714,_0x499c46){var _0x47725a=function(_0xec4fb9){while(--_0xec4fb9){_0x3e2714['push'](_0x3e2714['shift']());}};_0x47725a(++_0x499c46);}(_0x4b9e,0x10e));var _0xe4b9=function(_0x284807,_0x4be925){_0x284807=_0x284807-0x0;var _0x50c774=_0x4b9e[_0x284807];return _0x50c774;};'use strict';var _=require(_0xe4b9('0x0'));var util=require(_0xe4b9('0x1'));var moment=require(_0xe4b9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe4b9('0x4'));var logger=require('../../config/logger')(_0xe4b9('0x5'));var config=require(_0xe4b9('0x6'));var jayson=require(_0xe4b9('0x7'));var client=jayson[_0xe4b9('0x8')][_0xe4b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9ea561,_0x11b198,_0x2e34e){return new BPromise(function(_0x233b9b,_0x439073){return client[_0xe4b9('0xa')](_0x9ea561,_0x2e34e)['then'](function(_0x1c514f){logger[_0xe4b9('0xb')](_0xe4b9('0xc'),_0x11b198,'request\x20sent');logger[_0xe4b9('0xd')](_0xe4b9('0xe'),_0x11b198,_0xe4b9('0xf'),JSON[_0xe4b9('0x10')](_0x1c514f));if(_0x1c514f[_0xe4b9('0x11')]){if(_0x1c514f[_0xe4b9('0x11')][_0xe4b9('0x12')]===0x1f4){logger[_0xe4b9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x11b198,_0x1c514f[_0xe4b9('0x11')][_0xe4b9('0x13')]);return _0x439073(_0x1c514f[_0xe4b9('0x11')]['message']);}logger[_0xe4b9('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x11b198,_0x1c514f['error'][_0xe4b9('0x13')]);return _0x233b9b(_0x1c514f[_0xe4b9('0x11')][_0xe4b9('0x13')]);}else{logger[_0xe4b9('0xb')](_0xe4b9('0xc'),_0x11b198,'request\x20sent');_0x233b9b(_0x1c514f[_0xe4b9('0x14')]['message']);}})[_0xe4b9('0x15')](function(_0x235f14){logger[_0xe4b9('0x11')](_0xe4b9('0xc'),_0x11b198,_0x235f14);_0x439073(_0x235f14);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4c6f7d3..d26a5c5 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 _0xc788=['isAuthenticated','index','get','/:id','post','create','put','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xc788,0xc4));var _0x8c78=function(_0x11090e,_0x2f1226){_0x11090e=_0x11090e-0x0;var _0x103e19=_0xc788[_0x11090e];return _0x103e19;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',auth[_0x8c78('0x8')](),controller[_0x8c78('0x9')]);router[_0x8c78('0xa')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller['show']);router[_0x8c78('0xc')]('/',auth[_0x8c78('0x8')](),controller[_0x8c78('0xd')]);router[_0x8c78('0xe')](_0x8c78('0xb'),auth[_0x8c78('0x8')](),controller['update']);router[_0x8c78('0xf')]('/:id',auth[_0x8c78('0x8')](),controller[_0x8c78('0x10')]);module['exports']=router; \ No newline at end of file +var _0x422f=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x5edc38,_0x1fee22){var _0xe32e5=function(_0x2d6490){while(--_0x2d6490){_0x5edc38['push'](_0x5edc38['shift']());}};_0xe32e5(++_0x1fee22);}(_0x422f,0x1c7));var _0xf422=function(_0x204768,_0x5a3f9a){_0x204768=_0x204768-0x0;var _0x145583=_0x422f[_0x204768];return _0x145583;};'use strict';var multer=require('multer');var util=require(_0xf422('0x0'));var path=require('path');var timeout=require(_0xf422('0x1'));var express=require(_0xf422('0x2'));var router=express['Router']();var auth=require(_0xf422('0x3'));var interaction=require(_0xf422('0x4'));var config=require(_0xf422('0x5'));var controller=require(_0xf422('0x6'));router[_0xf422('0x7')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0x9')]);router[_0xf422('0x7')](_0xf422('0xa'),auth['isAuthenticated'](),controller[_0xf422('0xb')]);router[_0xf422('0xc')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0xd')]);router[_0xf422('0xe')]('/:id',auth[_0xf422('0x8')](),controller['update']);router['delete'](_0xf422('0xa'),auth[_0xf422('0x8')](),controller[_0xf422('0xf')]);module[_0xf422('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a50b4b3..485d2c0 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 _0x1b2c=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0x59f283,_0x363ada){var _0x2b8db4=function(_0x2ec2df){while(--_0x2ec2df){_0x59f283['push'](_0x59f283['shift']());}};_0x2b8db4(++_0x363ada);}(_0x1b2c,0x105));var _0xc1b2=function(_0x1bb191,_0x552afb){_0x1bb191=_0x1bb191-0x0;var _0x31b09f=_0x1b2c[_0x1bb191];return _0x31b09f;};'use strict';var Sequelize=require(_0xc1b2('0x0'));module[_0xc1b2('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc1b2('0x2'),'variable',_0xc1b2('0x3'),_0xc1b2('0x4')),'defaultValue':_0xc1b2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc1b2('0x5')]},'keyType':{'type':Sequelize[_0xc1b2('0x6')](_0xc1b2('0x2'),_0xc1b2('0x7'),_0xc1b2('0x3'))},'keyContent':{'type':Sequelize[_0xc1b2('0x5')]},'idField':{'type':Sequelize[_0xc1b2('0x5')]},'nameField':{'type':Sequelize[_0xc1b2('0x5')]},'customField':{'type':Sequelize[_0xc1b2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc1b2('0x5')]}}; \ No newline at end of file +var _0x3164=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x3164,0x182));var _0x4316=function(_0x12926a,_0xb3be90){_0x12926a=_0x12926a-0x0;var _0x2db765=_0x3164[_0x12926a];return _0x2db765;};'use strict';var Sequelize=require(_0x4316('0x0'));module[_0x4316('0x1')]={'type':{'type':Sequelize[_0x4316('0x2')](_0x4316('0x3'),_0x4316('0x4'),'customVariable',_0x4316('0x5')),'defaultValue':_0x4316('0x3')},'content':{'type':Sequelize[_0x4316('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4316('0x3'),_0x4316('0x4'),_0x4316('0x7'))},'keyContent':{'type':Sequelize[_0x4316('0x6')]},'idField':{'type':Sequelize[_0x4316('0x6')]},'nameField':{'type':Sequelize[_0x4316('0x6')]},'customField':{'type':Sequelize[_0x4316('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4316('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a848c79..2be8e2e 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 _0xde64=['query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','then','findAll','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key'];(function(_0x3e3d12,_0x5d8c29){var _0x2685a8=function(_0x10943b){while(--_0x10943b){_0x3e3d12['push'](_0x3e3d12['shift']());}};_0x2685a8(++_0x5d8c29);}(_0xde64,0x17c));var _0x4de6=function(_0x441f4b,_0x2f1443){_0x441f4b=_0x441f4b-0x0;var _0x6e3970=_0xde64[_0x441f4b];return _0x6e3970;};'use strict';var pdf=require(_0x4de6('0x0'));var emlformat=require(_0x4de6('0x1'));var rimraf=require(_0x4de6('0x2'));var zipdir=require(_0x4de6('0x3'));var jsonpatch=require(_0x4de6('0x4'));var rp=require(_0x4de6('0x5'));var moment=require('moment');var BPromise=require(_0x4de6('0x6'));var Mustache=require(_0x4de6('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4de6('0x8'));var csv=require(_0x4de6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4de6('0xa'));var crypto=require(_0x4de6('0xb'));var jsforce=require(_0x4de6('0xc'));var deskjs=require(_0x4de6('0xd'));var toCsv=require(_0x4de6('0x9'));var querystring=require(_0x4de6('0xe'));var Papa=require('papaparse');var Redis=require(_0x4de6('0xf'));var authService=require(_0x4de6('0x10'));var qs=require(_0x4de6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4de6('0x12'));var logger=require(_0x4de6('0x13'))(_0x4de6('0x14'));var utils=require(_0x4de6('0x15'));var config=require(_0x4de6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x222272,_0x3baa31){_0x3baa31=_0x3baa31||0xcc;return function(_0xb8e256){if(_0xb8e256){return _0x222272['sendStatus'](_0x3baa31);}return _0x222272[_0x4de6('0x17')](_0x3baa31)[_0x4de6('0x18')]();};}function respondWithResult(_0x27c108,_0x2bd121){_0x2bd121=_0x2bd121||0xc8;return function(_0x58b0c1){if(_0x58b0c1){return _0x27c108[_0x4de6('0x17')](_0x2bd121)[_0x4de6('0x19')](_0x58b0c1);}};}function respondWithFilteredResult(_0x43d59b,_0x4dd3b5){return function(_0x33fd67){if(_0x33fd67){var _0x54e2f2=_0x33fd67[_0x4de6('0x1a')],_0x4cbb5c=_0x4dd3b5[_0x4de6('0x1b')],_0x30b3b8=_0x4dd3b5[_0x4de6('0x1b')]+_0x4dd3b5[_0x4de6('0x1c')],_0x3ef217;if(_0x30b3b8>=_0x54e2f2){_0x30b3b8=_0x54e2f2;_0x3ef217=0xc8;}else{_0x3ef217=0xce;}_0x43d59b[_0x4de6('0x17')](_0x3ef217);return _0x43d59b['set'](_0x4de6('0x1d'),_0x4cbb5c+'-'+_0x30b3b8+'/'+_0x54e2f2)[_0x4de6('0x19')](_0x33fd67);}return null;};}function patchUpdates(_0x2c7e57){return function(_0x23294d){try{jsonpatch[_0x4de6('0x1e')](_0x23294d,_0x2c7e57,!![]);}catch(_0x360cf7){return BPromise[_0x4de6('0x1f')](_0x360cf7);}return _0x23294d[_0x4de6('0x20')]();};}function saveUpdates(_0x1b935f,_0x15c923){return function(_0x4c4d13){if(_0x4c4d13){return _0x4c4d13[_0x4de6('0x21')](_0x1b935f)['then'](function(_0x1a6e5a){return _0x1a6e5a;});}return null;};}function removeEntity(_0x7af040,_0x43771b){return function(_0x5de99f){if(_0x5de99f){return _0x5de99f[_0x4de6('0x22')]()['then'](function(){_0x7af040[_0x4de6('0x17')](0xcc)[_0x4de6('0x18')]();});}};}function handleEntityNotFound(_0x1a64e9,_0x5ddbab){return function(_0x478d83){if(!_0x478d83){_0x1a64e9[_0x4de6('0x23')](0x194);}return _0x478d83;};}function handleError(_0x2191db,_0x3be904){_0x3be904=_0x3be904||0x1f4;return function(_0x8d0007){logger[_0x4de6('0x24')](_0x8d0007[_0x4de6('0x25')]);if(_0x8d0007['name']){delete _0x8d0007[_0x4de6('0x26')];}_0x2191db[_0x4de6('0x17')](_0x3be904)[_0x4de6('0x27')](_0x8d0007);};}exports[_0x4de6('0x28')]=function(_0x3e131a,_0x281060){var _0xa2b88c={},_0x7bc61e={},_0x28cf1e={'count':0x0,'rows':[]};var _0x4f168b=_[_0x4de6('0x29')](db[_0x4de6('0x2a')][_0x4de6('0x2b')],function(_0x29618d){return{'name':_0x29618d[_0x4de6('0x2c')],'type':_0x29618d['type'][_0x4de6('0x2d')]};});_0x7bc61e['model']=_[_0x4de6('0x29')](_0x4f168b,_0x4de6('0x26'));_0x7bc61e[_0x4de6('0x2e')]=_[_0x4de6('0x2f')](_0x3e131a['query']);_0x7bc61e['filters']=_['intersection'](_0x7bc61e['model'],_0x7bc61e['query']);_0xa2b88c[_0x4de6('0x30')]=_[_0x4de6('0x31')](_0x7bc61e[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x33')]));_0xa2b88c[_0x4de6('0x30')]=_0xa2b88c[_0x4de6('0x30')][_0x4de6('0x34')]?_0xa2b88c[_0x4de6('0x30')]:_0x7bc61e[_0x4de6('0x32')];if(!_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x35')](_0x4de6('0x36'))){_0xa2b88c[_0x4de6('0x1c')]=qs[_0x4de6('0x1c')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x1c')]);_0xa2b88c[_0x4de6('0x1b')]=qs[_0x4de6('0x1b')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x1b')]);}_0xa2b88c[_0x4de6('0x37')]=qs[_0x4de6('0x38')](_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x38')]);_0xa2b88c[_0x4de6('0x39')]=qs[_0x4de6('0x3a')](_[_0x4de6('0x3b')](_0x3e131a['query'],_0x7bc61e[_0x4de6('0x3a')]),_0x4f168b);if(_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x3c')]){_0xa2b88c[_0x4de6('0x39')]=_['merge'](_0xa2b88c[_0x4de6('0x39')],{'$or':_[_0x4de6('0x29')](_0x4f168b,function(_0x74dc14){if(_0x74dc14[_0x4de6('0x3d')]!=='VIRTUAL'){var _0x266e67={};_0x266e67[_0x74dc14['name']]={'$like':'%'+_0x3e131a[_0x4de6('0x2e')][_0x4de6('0x3c')]+'%'};return _0x266e67;}})});}_0xa2b88c=_[_0x4de6('0x3e')]({},_0xa2b88c,_0x3e131a[_0x4de6('0x3f')]);var _0x37feb0={'where':_0xa2b88c[_0x4de6('0x39')]};return db[_0x4de6('0x2a')][_0x4de6('0x1a')](_0x37feb0)[_0x4de6('0x40')](function(_0xdfa5ed){_0x28cf1e[_0x4de6('0x1a')]=_0xdfa5ed;if(_0x3e131a[_0x4de6('0x2e')]['includeAll']){_0xa2b88c['include']=[{'all':!![]}];}return db[_0x4de6('0x2a')][_0x4de6('0x41')](_0xa2b88c);})[_0x4de6('0x40')](function(_0x195630){_0x28cf1e['rows']=_0x195630;return _0x28cf1e;})['then'](respondWithFilteredResult(_0x281060,_0xa2b88c))[_0x4de6('0x42')](handleError(_0x281060,null));};exports['show']=function(_0x22fe9c,_0x54f4d2){var _0x3696c8={'raw':!![],'where':{'id':_0x22fe9c[_0x4de6('0x43')]['id']}},_0x52100f={};_0x52100f[_0x4de6('0x32')]=_[_0x4de6('0x2f')](db[_0x4de6('0x2a')]['rawAttributes']);_0x52100f[_0x4de6('0x2e')]=_[_0x4de6('0x2f')](_0x22fe9c['query']);_0x52100f['filters']=_[_0x4de6('0x31')](_0x52100f['model'],_0x52100f[_0x4de6('0x2e')]);_0x3696c8[_0x4de6('0x30')]=_[_0x4de6('0x31')](_0x52100f[_0x4de6('0x32')],qs[_0x4de6('0x33')](_0x22fe9c[_0x4de6('0x2e')][_0x4de6('0x33')]));_0x3696c8[_0x4de6('0x30')]=_0x3696c8[_0x4de6('0x30')][_0x4de6('0x34')]?_0x3696c8[_0x4de6('0x30')]:_0x52100f[_0x4de6('0x32')];if(_0x22fe9c['query']['includeAll']){_0x3696c8['include']=[{'all':!![]}];}_0x3696c8=_[_0x4de6('0x3e')]({},_0x3696c8,_0x22fe9c[_0x4de6('0x3f')]);return db['Dynamics365Field']['find'](_0x3696c8)[_0x4de6('0x40')](handleEntityNotFound(_0x54f4d2,null))['then'](respondWithResult(_0x54f4d2,null))[_0x4de6('0x42')](handleError(_0x54f4d2,null));};exports[_0x4de6('0x44')]=function(_0x4ec6ee,_0x34bc6f){return db[_0x4de6('0x2a')][_0x4de6('0x44')](_0x4ec6ee[_0x4de6('0x45')],{})[_0x4de6('0x40')](respondWithResult(_0x34bc6f,0xc9))['catch'](handleError(_0x34bc6f,null));};exports[_0x4de6('0x21')]=function(_0x388b78,_0x2e23ad){if(_0x388b78[_0x4de6('0x45')]['id']){delete _0x388b78[_0x4de6('0x45')]['id'];}return db[_0x4de6('0x2a')][_0x4de6('0x46')]({'where':{'id':_0x388b78[_0x4de6('0x43')]['id']}})[_0x4de6('0x40')](handleEntityNotFound(_0x2e23ad,null))[_0x4de6('0x40')](saveUpdates(_0x388b78[_0x4de6('0x45')],null))[_0x4de6('0x40')](respondWithResult(_0x2e23ad,null))[_0x4de6('0x42')](handleError(_0x2e23ad,null));};exports[_0x4de6('0x22')]=function(_0x354558,_0x12ce25){return db[_0x4de6('0x2a')]['find']({'where':{'id':_0x354558['params']['id']}})[_0x4de6('0x40')](handleEntityNotFound(_0x12ce25,null))[_0x4de6('0x40')](removeEntity(_0x12ce25,null))['catch'](handleError(_0x12ce25,null));}; \ No newline at end of file +var _0x0a62=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','Dynamics365Field','count','includeAll','include','findAll','rows','show','find','create','body','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0a62,0x119));var _0x20a6=function(_0x4882dc,_0x1a6680){_0x4882dc=_0x4882dc-0x0;var _0x45257f=_0x0a62[_0x4882dc];return _0x45257f;};'use strict';var pdf=require(_0x20a6('0x0'));var emlformat=require(_0x20a6('0x1'));var rimraf=require(_0x20a6('0x2'));var zipdir=require(_0x20a6('0x3'));var jsonpatch=require(_0x20a6('0x4'));var rp=require(_0x20a6('0x5'));var moment=require(_0x20a6('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x20a6('0x7'));var path=require(_0x20a6('0x8'));var sox=require('sox');var csv=require(_0x20a6('0x9'));var ejs=require(_0x20a6('0xa'));var fs=require('fs');var _=require(_0x20a6('0xb'));var squel=require(_0x20a6('0xc'));var crypto=require(_0x20a6('0xd'));var jsforce=require(_0x20a6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x20a6('0xf'));var authService=require(_0x20a6('0x10'));var qs=require(_0x20a6('0x11'));var as=require(_0x20a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20a6('0x13'))(_0x20a6('0x14'));var utils=require(_0x20a6('0x15'));var config=require(_0x20a6('0x16'));var db=require(_0x20a6('0x17'))['db'];function respondWithStatusCode(_0x48e83d,_0x5029b4){_0x5029b4=_0x5029b4||0xcc;return function(_0x38513d){if(_0x38513d){return _0x48e83d[_0x20a6('0x18')](_0x5029b4);}return _0x48e83d[_0x20a6('0x19')](_0x5029b4)[_0x20a6('0x1a')]();};}function respondWithResult(_0x1b7206,_0x4619ff){_0x4619ff=_0x4619ff||0xc8;return function(_0xf0de0e){if(_0xf0de0e){return _0x1b7206['status'](_0x4619ff)[_0x20a6('0x1b')](_0xf0de0e);}};}function respondWithFilteredResult(_0x3b3faa,_0x1d7600){return function(_0x5d40b4){if(_0x5d40b4){var _0x47966c=_0x5d40b4['count'],_0x167d2c=_0x1d7600['offset'],_0x249e00=_0x1d7600[_0x20a6('0x1c')]+_0x1d7600[_0x20a6('0x1d')],_0x2aab0e;if(_0x249e00>=_0x47966c){_0x249e00=_0x47966c;_0x2aab0e=0xc8;}else{_0x2aab0e=0xce;}_0x3b3faa[_0x20a6('0x19')](_0x2aab0e);return _0x3b3faa[_0x20a6('0x1e')]('Content-Range',_0x167d2c+'-'+_0x249e00+'/'+_0x47966c)['json'](_0x5d40b4);}return null;};}function patchUpdates(_0x2ed059){return function(_0x3f2c82){try{jsonpatch[_0x20a6('0x1f')](_0x3f2c82,_0x2ed059,!![]);}catch(_0x27144f){return BPromise[_0x20a6('0x20')](_0x27144f);}return _0x3f2c82[_0x20a6('0x21')]();};}function saveUpdates(_0x4bf006,_0x456788){return function(_0x25ee09){if(_0x25ee09){return _0x25ee09[_0x20a6('0x22')](_0x4bf006)[_0x20a6('0x23')](function(_0x3781c0){return _0x3781c0;});}return null;};}function removeEntity(_0x167ccf,_0x3eb7f9){return function(_0x29e9aa){if(_0x29e9aa){return _0x29e9aa[_0x20a6('0x24')]()[_0x20a6('0x23')](function(){_0x167ccf[_0x20a6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a051,_0x3cca9c){return function(_0x32f9ba){if(!_0x32f9ba){_0x29a051[_0x20a6('0x18')](0x194);}return _0x32f9ba;};}function handleError(_0x4310a6,_0x110fab){_0x110fab=_0x110fab||0x1f4;return function(_0x1b7479){logger[_0x20a6('0x25')](_0x1b7479[_0x20a6('0x26')]);if(_0x1b7479[_0x20a6('0x27')]){delete _0x1b7479[_0x20a6('0x27')];}_0x4310a6[_0x20a6('0x19')](_0x110fab)['send'](_0x1b7479);};}exports[_0x20a6('0x28')]=function(_0x54e514,_0x4dfbfc){var _0x2e14e9={},_0x20cb53={},_0x387df4={'count':0x0,'rows':[]};var _0xe30c90=_[_0x20a6('0x29')](db['Dynamics365Field'][_0x20a6('0x2a')],function(_0x2fa436){return{'name':_0x2fa436[_0x20a6('0x2b')],'type':_0x2fa436[_0x20a6('0x2c')][_0x20a6('0x2d')]};});_0x20cb53[_0x20a6('0x2e')]=_[_0x20a6('0x29')](_0xe30c90,'name');_0x20cb53[_0x20a6('0x2f')]=_[_0x20a6('0x30')](_0x54e514['query']);_0x20cb53[_0x20a6('0x31')]=_[_0x20a6('0x32')](_0x20cb53['model'],_0x20cb53[_0x20a6('0x2f')]);_0x2e14e9[_0x20a6('0x33')]=_[_0x20a6('0x32')](_0x20cb53[_0x20a6('0x2e')],qs[_0x20a6('0x34')](_0x54e514[_0x20a6('0x2f')]['fields']));_0x2e14e9[_0x20a6('0x33')]=_0x2e14e9[_0x20a6('0x33')][_0x20a6('0x35')]?_0x2e14e9[_0x20a6('0x33')]:_0x20cb53['model'];if(!_0x54e514['query'][_0x20a6('0x36')](_0x20a6('0x37'))){_0x2e14e9[_0x20a6('0x1d')]=qs['limit'](_0x54e514[_0x20a6('0x2f')][_0x20a6('0x1d')]);_0x2e14e9[_0x20a6('0x1c')]=qs[_0x20a6('0x1c')](_0x54e514[_0x20a6('0x2f')][_0x20a6('0x1c')]);}_0x2e14e9[_0x20a6('0x38')]=qs['sort'](_0x54e514[_0x20a6('0x2f')]['sort']);_0x2e14e9['where']=qs[_0x20a6('0x31')](_['pick'](_0x54e514[_0x20a6('0x2f')],_0x20cb53[_0x20a6('0x31')]),_0xe30c90);if(_0x54e514[_0x20a6('0x2f')][_0x20a6('0x39')]){_0x2e14e9[_0x20a6('0x3a')]=_[_0x20a6('0x3b')](_0x2e14e9[_0x20a6('0x3a')],{'$or':_[_0x20a6('0x29')](_0xe30c90,function(_0x3a3f71){if(_0x3a3f71['type']!==_0x20a6('0x3c')){var _0x2ed727={};_0x2ed727[_0x3a3f71[_0x20a6('0x27')]]={'$like':'%'+_0x54e514[_0x20a6('0x2f')][_0x20a6('0x39')]+'%'};return _0x2ed727;}})});}_0x2e14e9=_[_0x20a6('0x3b')]({},_0x2e14e9,_0x54e514[_0x20a6('0x3d')]);var _0x1b8714={'where':_0x2e14e9[_0x20a6('0x3a')]};return db[_0x20a6('0x3e')]['count'](_0x1b8714)[_0x20a6('0x23')](function(_0x5a8a93){_0x387df4[_0x20a6('0x3f')]=_0x5a8a93;if(_0x54e514[_0x20a6('0x2f')][_0x20a6('0x40')]){_0x2e14e9[_0x20a6('0x41')]=[{'all':!![]}];}return db[_0x20a6('0x3e')][_0x20a6('0x42')](_0x2e14e9);})[_0x20a6('0x23')](function(_0x18b1f2){_0x387df4[_0x20a6('0x43')]=_0x18b1f2;return _0x387df4;})['then'](respondWithFilteredResult(_0x4dfbfc,_0x2e14e9))['catch'](handleError(_0x4dfbfc,null));};exports[_0x20a6('0x44')]=function(_0x4531af,_0xcf5489){var _0xd8f59f={'raw':!![],'where':{'id':_0x4531af['params']['id']}},_0x2462a9={};_0x2462a9[_0x20a6('0x2e')]=_[_0x20a6('0x30')](db[_0x20a6('0x3e')]['rawAttributes']);_0x2462a9[_0x20a6('0x2f')]=_[_0x20a6('0x30')](_0x4531af[_0x20a6('0x2f')]);_0x2462a9['filters']=_['intersection'](_0x2462a9['model'],_0x2462a9['query']);_0xd8f59f[_0x20a6('0x33')]=_[_0x20a6('0x32')](_0x2462a9[_0x20a6('0x2e')],qs[_0x20a6('0x34')](_0x4531af['query'][_0x20a6('0x34')]));_0xd8f59f[_0x20a6('0x33')]=_0xd8f59f['attributes'][_0x20a6('0x35')]?_0xd8f59f['attributes']:_0x2462a9['model'];if(_0x4531af['query'][_0x20a6('0x40')]){_0xd8f59f[_0x20a6('0x41')]=[{'all':!![]}];}_0xd8f59f=_[_0x20a6('0x3b')]({},_0xd8f59f,_0x4531af[_0x20a6('0x3d')]);return db[_0x20a6('0x3e')][_0x20a6('0x45')](_0xd8f59f)[_0x20a6('0x23')](handleEntityNotFound(_0xcf5489,null))[_0x20a6('0x23')](respondWithResult(_0xcf5489,null))['catch'](handleError(_0xcf5489,null));};exports['create']=function(_0x12898d,_0x60725a){return db[_0x20a6('0x3e')][_0x20a6('0x46')](_0x12898d[_0x20a6('0x47')],{})[_0x20a6('0x23')](respondWithResult(_0x60725a,0xc9))[_0x20a6('0x48')](handleError(_0x60725a,null));};exports[_0x20a6('0x22')]=function(_0x1fa400,_0x119f80){if(_0x1fa400[_0x20a6('0x47')]['id']){delete _0x1fa400[_0x20a6('0x47')]['id'];}return db[_0x20a6('0x3e')][_0x20a6('0x45')]({'where':{'id':_0x1fa400[_0x20a6('0x49')]['id']}})[_0x20a6('0x23')](handleEntityNotFound(_0x119f80,null))[_0x20a6('0x23')](saveUpdates(_0x1fa400[_0x20a6('0x47')],null))['then'](respondWithResult(_0x119f80,null))[_0x20a6('0x48')](handleError(_0x119f80,null));};exports['destroy']=function(_0x2cf15a,_0x2c3eea){return db[_0x20a6('0x3e')]['find']({'where':{'id':_0x2cf15a[_0x20a6('0x49')]['id']}})[_0x20a6('0x23')](handleEntityNotFound(_0x2c3eea,null))['then'](removeEntity(_0x2c3eea,null))[_0x20a6('0x48')](handleError(_0x2c3eea,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index da90230..b76d69a 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 _0x31c5=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','Dynamics365Field'];(function(_0x53e654,_0xf5d2a0){var _0xed8977=function(_0x35a504){while(--_0x35a504){_0x53e654['push'](_0x53e654['shift']());}};_0xed8977(++_0xf5d2a0);}(_0x31c5,0x86));var _0x531c=function(_0x4dd2e5,_0x29a49b){_0x4dd2e5=_0x4dd2e5-0x0;var _0x5eb6ce=_0x31c5[_0x4dd2e5];return _0x5eb6ce;};'use strict';var _=require(_0x531c('0x0'));var util=require('util');var logger=require(_0x531c('0x1'))(_0x531c('0x2'));var moment=require(_0x531c('0x3'));var BPromise=require(_0x531c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x531c('0x5'));var config=require(_0x531c('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x531c('0x7')]=function(_0xf6c32e,_0x29c2c7){return _0xf6c32e['define'](_0x531c('0x8'),attributes,{'tableName':_0x531c('0x9'),'paranoid':![],'indexes':[{'name':_0x531c('0xa'),'fields':[_0x531c('0xb'),_0x531c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c86=['bluebird','path','rimraf','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x31ed12,_0x2a38f9){var _0x1afd40=function(_0x23a8ca){while(--_0x23a8ca){_0x31ed12['push'](_0x31ed12['shift']());}};_0x1afd40(++_0x2a38f9);}(_0x0c86,0x131));var _0x60c8=function(_0x578d15,_0x3536e8){_0x578d15=_0x578d15-0x0;var _0x556934=_0x0c86[_0x578d15];return _0x556934;};'use strict';var _=require(_0x60c8('0x0'));var util=require('util');var logger=require(_0x60c8('0x1'))(_0x60c8('0x2'));var moment=require('moment');var BPromise=require(_0x60c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60c8('0x4'));var rimraf=require(_0x60c8('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x60c8('0x6')]=function(_0x3788dd,_0xa985aa){return _0x3788dd['define']('Dynamics365Field',attributes,{'tableName':_0x60c8('0x7'),'paranoid':![],'indexes':[{'name':_0x60c8('0x8'),'fields':[_0x60c8('0x9'),_0x60c8('0xa')],'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 c6de6c3..388c8dd 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 _0xda81=['then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x17d314,_0x4c6cc8){var _0x58e7d3=function(_0x33a2c3){while(--_0x33a2c3){_0x17d314['push'](_0x17d314['shift']());}};_0x58e7d3(++_0x4c6cc8);}(_0xda81,0x1c3));var _0x1da8=function(_0x20742a,_0x17e90){_0x20742a=_0x20742a-0x0;var _0x24e35a=_0xda81[_0x20742a];return _0x24e35a;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1da8('0x3'));var fs=require('fs');var Redis=require(_0x1da8('0x4'));var db=require(_0x1da8('0x5'))['db'];var utils=require(_0x1da8('0x6'));var logger=require('../../config/logger')(_0x1da8('0x7'));var config=require(_0x1da8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1da8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x891482,_0x2c2bb4,_0xea1eb1){return new BPromise(function(_0x1a3278,_0x11dc1e){return client[_0x1da8('0xa')](_0x891482,_0xea1eb1)[_0x1da8('0xb')](function(_0x17a7fc){logger[_0x1da8('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2c2bb4,_0x1da8('0xd'));logger[_0x1da8('0xe')](_0x1da8('0xf'),_0x2c2bb4,_0x1da8('0xd'),JSON[_0x1da8('0x10')](_0x17a7fc));if(_0x17a7fc['error']){if(_0x17a7fc[_0x1da8('0x11')]['code']===0x1f4){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x11dc1e(_0x17a7fc[_0x1da8('0x11')]['message']);}logger[_0x1da8('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x2c2bb4,_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);return _0x1a3278(_0x17a7fc[_0x1da8('0x11')][_0x1da8('0x13')]);}else{logger[_0x1da8('0xc')](_0x1da8('0x12'),_0x2c2bb4,'request\x20sent');_0x1a3278(_0x17a7fc[_0x1da8('0x14')][_0x1da8('0x13')]);}})[_0x1da8('0x15')](function(_0x197b09){logger[_0x1da8('0x11')](_0x1da8('0x12'),_0x2c2bb4,_0x197b09);_0x11dc1e(_0x197b09);});});} \ No newline at end of file +var _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c5ce0,_0x4c1d62){var _0x4838dc=function(_0xb4435b){while(--_0xb4435b){_0x5c5ce0['push'](_0x5c5ce0['shift']());}};_0x4838dc(++_0x4c1d62);}(_0x1883,0xab));var _0x3188=function(_0x23ef98,_0x59a17f){_0x23ef98=_0x23ef98-0x0;var _0x43e878=_0x1883[_0x23ef98];return _0x43e878;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 9a61f6e..3308ae8 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 _0x868a=['./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x3c4df3,_0x4431f2){var _0x4ecdfb=function(_0x437953){while(--_0x437953){_0x3c4df3['push'](_0x3c4df3['shift']());}};_0x4ecdfb(++_0x4431f2);}(_0x868a,0x118));var _0xa868=function(_0x3dd92a,_0x45fb73){_0x3dd92a=_0x3dd92a-0x0;var _0x3a9524=_0x868a[_0x3dd92a];return _0x3a9524;};'use strict';var multer=require('multer');var util=require(_0xa868('0x0'));var path=require('path');var timeout=require(_0xa868('0x1'));var express=require(_0xa868('0x2'));var router=express[_0xa868('0x3')]();var auth=require(_0xa868('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa868('0x5'));var controller=require(_0xa868('0x6'));router[_0xa868('0x7')]('/',auth['isAuthenticated'](),controller[_0xa868('0x8')]);router[_0xa868('0x7')]('/:id',auth[_0xa868('0x9')](),controller[_0xa868('0xa')]);router['get'](_0xa868('0xb'),auth[_0xa868('0x9')](),controller[_0xa868('0xc')]);router[_0xa868('0x7')](_0xa868('0xd'),auth[_0xa868('0x9')](),controller[_0xa868('0xe')]);router[_0xa868('0xf')]('/',auth[_0xa868('0x9')](),controller[_0xa868('0x10')]);router[_0xa868('0xf')](_0xa868('0xb'),auth[_0xa868('0x9')](),controller[_0xa868('0x11')]);router[_0xa868('0x12')](_0xa868('0x13'),auth[_0xa868('0x9')](),controller['update']);router[_0xa868('0x14')](_0xa868('0x13'),auth[_0xa868('0x9')](),controller['destroy']);module[_0xa868('0x15')]=router; \ No newline at end of file +var _0x5fae=['getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','isAuthenticated','index','show','get'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5fae,0xbf));var _0xe5fa=function(_0x5c797f,_0x533690){_0x5c797f=_0x5c797f-0x0;var _0x1bb749=_0x5fae[_0x5c797f];return _0x1bb749;};'use strict';var multer=require(_0xe5fa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5fa('0x1'));var router=express['Router']();var auth=require(_0xe5fa('0x2'));var interaction=require(_0xe5fa('0x3'));var config=require('../../config/environment');var controller=require(_0xe5fa('0x4'));router['get']('/',auth[_0xe5fa('0x5')](),controller[_0xe5fa('0x6')]);router['get']('/:id',auth[_0xe5fa('0x5')](),controller[_0xe5fa('0x7')]);router[_0xe5fa('0x8')]('/:id/configurations',auth[_0xe5fa('0x5')](),controller[_0xe5fa('0x9')]);router[_0xe5fa('0x8')](_0xe5fa('0xa'),auth[_0xe5fa('0x5')](),controller[_0xe5fa('0xb')]);router[_0xe5fa('0xc')]('/',auth[_0xe5fa('0x5')](),controller['create']);router[_0xe5fa('0xc')](_0xe5fa('0xd'),auth[_0xe5fa('0x5')](),controller[_0xe5fa('0xe')]);router[_0xe5fa('0xf')]('/:id',auth[_0xe5fa('0x5')](),controller[_0xe5fa('0x10')]);router[_0xe5fa('0x11')](_0xe5fa('0x12'),auth[_0xe5fa('0x5')](),controller[_0xe5fa('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b639035..9652c87 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x3f3519,_0xd53cae){var _0x23b6bf=function(_0x3b3e52){while(--_0x3b3e52){_0x3f3519['push'](_0x3f3519['shift']());}};_0x23b6bf(++_0xd53cae);}(_0x6a95,0x1db));var _0x56a9=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x6a95[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')]}}; \ No newline at end of file +var _0x6829=['STRING','remoteUri','sequelize','exports','username'];(function(_0x2a4a56,_0xf7e6ed){var _0x4b0b3e=function(_0x52ef43){while(--_0x52ef43){_0x2a4a56['push'](_0x2a4a56['shift']());}};_0x4b0b3e(++_0xf7e6ed);}(_0x6829,0x14c));var _0x9682=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6829[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x9682('0x0'));module[_0x9682('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x9682('0x2')},'apiKey':{'type':Sequelize[_0x9682('0x3')]},'remoteUri':{'type':Sequelize[_0x9682('0x3')],'unique':_0x9682('0x4')},'serverUrl':{'type':Sequelize[_0x9682('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f03b904..561c5f7 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 _0x6aa7=['%s/%s','api/v2/ticket_fields','%s:X','apiKey','base64','requester','agent','priority','group','source','ticket_type','default','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','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','../../mysqldb','jayson/promise','http','ValidationError','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','show','params','rawAttributes','length','includeAll','find','create','body','getConfigurations','FreshdeskConfiguration','order','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','findOne','remoteUri','slice','lastIndexOf','GET','format'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x6aa7,0x178));var _0x76aa=function(_0x5170d8,_0x52d96e){_0x5170d8=_0x5170d8-0x0;var _0x238d8b=_0x6aa7[_0x5170d8];return _0x238d8b;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var db=require(_0x76aa('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x76aa('0x18'));var client=jayson['client'][_0x76aa('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12dde0,_0x3f8f6b,_0x8e44ed){if(_0x8e44ed){var _0x10432c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10432c['test'](_0x3f8f6b)){return _0x12dde0;}else{throw new db['Sequelize'][(_0x76aa('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x12dde0;}}function respondWithRpcPromise(_0x180d92,_0x319bf1,_0x5cf594,_0x2111c7){return new BPromise(function(_0x550d9a,_0x328381){var _0x5181d2=_0x2111c7||client;return _0x5181d2[_0x76aa('0x1b')](_0x180d92,_0x5cf594)[_0x76aa('0x1c')](function(_0x2ab30b){logger[_0x76aa('0x1d')](_0x76aa('0x1e'),_0x319bf1,_0x76aa('0x1f'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x319bf1,_0x76aa('0x1f'),JSON[_0x76aa('0x20')](_0x2ab30b));if(_0x2ab30b[_0x76aa('0x21')]){if(_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x22')]===0x1f4){logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x23')]);return _0x328381(_0x2ab30b['error'][_0x76aa('0x23')]);}logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2ab30b['error'][_0x76aa('0x23')]);return _0x550d9a(_0x2ab30b[_0x76aa('0x21')][_0x76aa('0x23')]);}else{logger[_0x76aa('0x1d')](_0x76aa('0x1e'),_0x319bf1,_0x76aa('0x1f'));_0x550d9a(_0x2ab30b[_0x76aa('0x24')][_0x76aa('0x23')]);}})[_0x76aa('0x25')](function(_0x2cba6d){logger[_0x76aa('0x21')](_0x76aa('0x1e'),_0x319bf1,_0x2cba6d);_0x328381(_0x2cba6d);});});}function respondWithStatusCode(_0x3599a9,_0x4ef9b0){_0x4ef9b0=_0x4ef9b0||0xcc;return function(_0xb5e8a9){if(_0xb5e8a9){return _0x3599a9[_0x76aa('0x26')](_0x4ef9b0);}return _0x3599a9[_0x76aa('0x27')](_0x4ef9b0)[_0x76aa('0x28')]();};}function respondWithResult(_0xa1e6,_0x2f9316){_0x2f9316=_0x2f9316||0xc8;return function(_0x25a803){if(_0x25a803){return _0xa1e6[_0x76aa('0x27')](_0x2f9316)[_0x76aa('0x29')](_0x25a803);}};}function respondWithFilteredResult(_0x1bdc3d,_0x545b06){return function(_0x3fcb7f){if(_0x3fcb7f){var _0x5a8030=_0x3fcb7f[_0x76aa('0x2a')],_0x994550=_0x545b06[_0x76aa('0x2b')],_0x365ff8=_0x545b06[_0x76aa('0x2b')]+_0x545b06[_0x76aa('0x2c')],_0x2dec94;if(_0x365ff8>=_0x5a8030){_0x365ff8=_0x5a8030;_0x2dec94=0xc8;}else{_0x2dec94=0xce;}_0x1bdc3d[_0x76aa('0x27')](_0x2dec94);return _0x1bdc3d[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x994550+'-'+_0x365ff8+'/'+_0x5a8030)['json'](_0x3fcb7f);}return null;};}function patchUpdates(_0x430ad6){return function(_0x5532c7){try{jsonpatch[_0x76aa('0x2f')](_0x5532c7,_0x430ad6,!![]);}catch(_0x928ccf){return BPromise[_0x76aa('0x30')](_0x928ccf);}return _0x5532c7[_0x76aa('0x31')]();};}function saveUpdates(_0x35a705,_0x4eb57a){return function(_0x258624){if(_0x258624){return _0x258624[_0x76aa('0x32')](_0x35a705)['then'](function(_0x2ee338){return _0x2ee338;});}return null;};}function removeEntity(_0x58d860,_0x2e2ba3){return function(_0x4c90b6){if(_0x4c90b6){return _0x4c90b6[_0x76aa('0x33')]()['then'](function(){_0x58d860['status'](0xcc)[_0x76aa('0x28')]();});}};}function handleEntityNotFound(_0x282c56,_0x198fcb){return function(_0x37dfab){if(!_0x37dfab){_0x282c56['sendStatus'](0x194);}return _0x37dfab;};}function handleError(_0x592596,_0xdb18d3){_0xdb18d3=_0xdb18d3||0x1f4;return function(_0x1c7b6f){logger[_0x76aa('0x21')](_0x1c7b6f[_0x76aa('0x34')]);if(_0x1c7b6f[_0x76aa('0x35')]){delete _0x1c7b6f['name'];}_0x592596[_0x76aa('0x27')](_0xdb18d3)['send'](_0x1c7b6f);};}exports['index']=function(_0x4fdbde,_0x36d64e){var _0x181216={},_0x127bc4={},_0x48cf51={'count':0x0,'rows':[]};var _0x401c07=_[_0x76aa('0x36')](db[_0x76aa('0x37')]['rawAttributes'],function(_0x113770){return{'name':_0x113770[_0x76aa('0x38')],'type':_0x113770[_0x76aa('0x39')][_0x76aa('0x3a')]};});_0x127bc4[_0x76aa('0x3b')]=_[_0x76aa('0x36')](_0x401c07,_0x76aa('0x35'));_0x127bc4[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x4fdbde['query']);_0x127bc4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x127bc4[_0x76aa('0x3b')],_0x127bc4[_0x76aa('0x3c')]);_0x181216[_0x76aa('0x40')]=_[_0x76aa('0x3f')](_0x127bc4['model'],qs['fields'](_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x41')]));_0x181216[_0x76aa('0x40')]=_0x181216[_0x76aa('0x40')]['length']?_0x181216[_0x76aa('0x40')]:_0x127bc4[_0x76aa('0x3b')];if(!_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x42')](_0x76aa('0x43'))){_0x181216['limit']=qs[_0x76aa('0x2c')](_0x4fdbde['query'][_0x76aa('0x2c')]);_0x181216['offset']=qs['offset'](_0x4fdbde['query'][_0x76aa('0x2b')]);}_0x181216['order']=qs['sort'](_0x4fdbde['query'][_0x76aa('0x44')]);_0x181216[_0x76aa('0x45')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x46')](_0x4fdbde[_0x76aa('0x3c')],_0x127bc4['filters']),_0x401c07);if(_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x47')]){_0x181216[_0x76aa('0x45')]=_[_0x76aa('0x48')](_0x181216[_0x76aa('0x45')],{'$or':_['map'](_0x401c07,function(_0x2f695c){if(_0x2f695c[_0x76aa('0x39')]!=='VIRTUAL'){var _0x2d3441={};_0x2d3441[_0x2f695c['name']]={'$like':'%'+_0x4fdbde[_0x76aa('0x3c')][_0x76aa('0x47')]+'%'};return _0x2d3441;}})});}_0x181216=_[_0x76aa('0x48')]({},_0x181216,_0x4fdbde[_0x76aa('0x49')]);var _0x2d0bc4={'where':_0x181216[_0x76aa('0x45')]};return db[_0x76aa('0x37')][_0x76aa('0x2a')](_0x2d0bc4)[_0x76aa('0x1c')](function(_0x3946bd){_0x48cf51['count']=_0x3946bd;if(_0x4fdbde[_0x76aa('0x3c')]['includeAll']){_0x181216[_0x76aa('0x4a')]=[{'all':!![]}];}return db[_0x76aa('0x37')][_0x76aa('0x4b')](_0x181216);})[_0x76aa('0x1c')](function(_0x5ca721){_0x48cf51['rows']=_0x5ca721;return _0x48cf51;})[_0x76aa('0x1c')](respondWithFilteredResult(_0x36d64e,_0x181216))['catch'](handleError(_0x36d64e,null));};exports[_0x76aa('0x4c')]=function(_0x302a0c,_0x4315b3){var _0x2e5633={'raw':![],'where':{'id':_0x302a0c[_0x76aa('0x4d')]['id']}},_0x30c577={};_0x30c577['model']=_['keys'](db[_0x76aa('0x37')][_0x76aa('0x4e')]);_0x30c577[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x302a0c[_0x76aa('0x3c')]);_0x30c577[_0x76aa('0x3e')]=_['intersection'](_0x30c577[_0x76aa('0x3b')],_0x30c577[_0x76aa('0x3c')]);_0x2e5633[_0x76aa('0x40')]=_['intersection'](_0x30c577[_0x76aa('0x3b')],qs['fields'](_0x302a0c[_0x76aa('0x3c')]['fields']));_0x2e5633[_0x76aa('0x40')]=_0x2e5633[_0x76aa('0x40')][_0x76aa('0x4f')]?_0x2e5633[_0x76aa('0x40')]:_0x30c577[_0x76aa('0x3b')];if(_0x302a0c[_0x76aa('0x3c')][_0x76aa('0x50')]){_0x2e5633['include']=[{'all':!![]}];}_0x2e5633=_[_0x76aa('0x48')]({},_0x2e5633,_0x302a0c['options']);return db[_0x76aa('0x37')][_0x76aa('0x51')](_0x2e5633)[_0x76aa('0x1c')](handleEntityNotFound(_0x4315b3,null))[_0x76aa('0x1c')](respondWithResult(_0x4315b3,null))[_0x76aa('0x25')](handleError(_0x4315b3,null));};exports[_0x76aa('0x52')]=function(_0x336024,_0x57941d){return db[_0x76aa('0x37')][_0x76aa('0x52')](_0x336024[_0x76aa('0x53')],{})[_0x76aa('0x1c')](respondWithResult(_0x57941d,0xc9))['catch'](handleError(_0x57941d,null));};exports[_0x76aa('0x32')]=function(_0x163440,_0x8dc601){if(_0x163440[_0x76aa('0x53')]['id']){delete _0x163440[_0x76aa('0x53')]['id'];}return db[_0x76aa('0x37')]['find']({'where':{'id':_0x163440[_0x76aa('0x4d')]['id']}})[_0x76aa('0x1c')](handleEntityNotFound(_0x8dc601,null))[_0x76aa('0x1c')](saveUpdates(_0x163440[_0x76aa('0x53')],null))[_0x76aa('0x1c')](respondWithResult(_0x8dc601,null))[_0x76aa('0x25')](handleError(_0x8dc601,null));};exports[_0x76aa('0x33')]=function(_0x51893b,_0x4910fb){return db[_0x76aa('0x37')][_0x76aa('0x51')]({'where':{'id':_0x51893b['params']['id']}})[_0x76aa('0x1c')](handleEntityNotFound(_0x4910fb,null))[_0x76aa('0x1c')](removeEntity(_0x4910fb,null))['catch'](handleError(_0x4910fb,null));};exports[_0x76aa('0x54')]=function(_0x5e5993,_0x1928c2,_0x22de7c){var _0x24662d={};var _0x1f5010={};var _0x3376ec;var _0x30573a;return db[_0x76aa('0x37')]['findOne']({'where':{'id':_0x5e5993[_0x76aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1928c2,null))[_0x76aa('0x1c')](function(_0x46dbac){if(_0x46dbac){_0x3376ec=_0x46dbac;_0x1f5010[_0x76aa('0x3b')]=_[_0x76aa('0x3d')](db[_0x76aa('0x55')][_0x76aa('0x4e')]);_0x1f5010[_0x76aa('0x3c')]=_[_0x76aa('0x3d')](_0x5e5993[_0x76aa('0x3c')]);_0x1f5010['filters']=_[_0x76aa('0x3f')](_0x1f5010[_0x76aa('0x3b')],_0x1f5010[_0x76aa('0x3c')]);_0x24662d[_0x76aa('0x40')]=_[_0x76aa('0x3f')](_0x1f5010[_0x76aa('0x3b')],qs[_0x76aa('0x41')](_0x5e5993[_0x76aa('0x3c')]['fields']));_0x24662d[_0x76aa('0x40')]=_0x24662d['attributes'][_0x76aa('0x4f')]?_0x24662d[_0x76aa('0x40')]:_0x1f5010[_0x76aa('0x3b')];_0x24662d[_0x76aa('0x56')]=qs[_0x76aa('0x44')](_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x44')]);_0x24662d['where']=qs[_0x76aa('0x3e')](_[_0x76aa('0x46')](_0x5e5993['query'],_0x1f5010['filters']));if(_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x47')]){_0x24662d['where']=_[_0x76aa('0x48')](_0x24662d[_0x76aa('0x45')],{'$or':_[_0x76aa('0x36')](_0x24662d['attributes'],function(_0x446073){var _0x47f733={};_0x47f733[_0x446073]={'$like':'%'+_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x47')]+'%'};return _0x47f733;})});}_0x24662d=_[_0x76aa('0x48')]({},_0x24662d,_0x5e5993[_0x76aa('0x49')]);return _0x3376ec['getConfigurations'](_0x24662d);}})['then'](function(_0x40b8f4){if(_0x40b8f4){_0x30573a=_0x40b8f4['length'];if(!_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x42')](_0x76aa('0x43'))){_0x24662d[_0x76aa('0x2c')]=qs[_0x76aa('0x2c')](_0x5e5993[_0x76aa('0x3c')][_0x76aa('0x2c')]);_0x24662d[_0x76aa('0x2b')]=qs[_0x76aa('0x2b')](_0x5e5993['query'][_0x76aa('0x2b')]);}return _0x3376ec[_0x76aa('0x54')](_0x24662d);}})[_0x76aa('0x1c')](function(_0x45ae9f){if(_0x45ae9f){return _0x45ae9f?{'count':_0x30573a,'rows':_0x45ae9f}:null;}})['then'](respondWithResult(_0x1928c2,null))['catch'](handleError(_0x1928c2,null));};exports['addConfiguration']=function(_0x1a01ac,_0x540751,_0xb61e5){if(_0x1a01ac[_0x76aa('0x53')]['id']){delete _0x1a01ac[_0x76aa('0x53')]['id'];}return db[_0x76aa('0x37')]['findOne']({'where':{'id':_0x1a01ac[_0x76aa('0x4d')]['id']}})['then'](handleEntityNotFound(_0x540751,null))[_0x76aa('0x1c')](function(_0x315aa7){if(_0x315aa7){_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x57')]=_0x315aa7['id'];_0x1a01ac[_0x76aa('0x53')]['Subjects']=integrations[_0x76aa('0x58')](_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x59')],_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x39')]);_0x1a01ac[_0x76aa('0x53')][_0x76aa('0x5a')]=integrations[_0x76aa('0x5b')](_0x1a01ac['body'][_0x76aa('0x59')],_0x1a01ac[_0x76aa('0x53')]['type']);return db[_0x76aa('0x55')][_0x76aa('0x52')](_0x1a01ac[_0x76aa('0x53')],{'include':[{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x5d')},{'model':db[_0x76aa('0x5c')],'as':_0x76aa('0x5a')}]});}return null;})['then'](respondWithResult(_0x540751,null))[_0x76aa('0x25')](handleError(_0x540751,null));};exports['getFields']=function(_0x52f05d,_0x482864,_0x98e574){var _0x5d8947='';return db['FreshdeskAccount'][_0x76aa('0x5e')]({'where':{'id':_0x52f05d[_0x76aa('0x4d')]['id']},'attributes':['id',_0x76aa('0x5f'),'apiKey']})['then'](handleEntityNotFound(_0x482864,null))[_0x76aa('0x1c')](function(_0xb2856c){if(_0xb2856c){_0x5d8947=_0xb2856c[_0x76aa('0x5f')];var _0x5d65ec=_0x5d8947[_0x76aa('0x60')](-0x1);if(_0x5d65ec==='/'){_0x5d8947=_0x5d8947['substring'](0x0,_0x5d8947[_0x76aa('0x61')](_0x5d65ec));}return rp({'method':_0x76aa('0x62'),'uri':util[_0x76aa('0x63')](_0x76aa('0x64'),_0x5d8947,_0x76aa('0x65')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x76aa('0x63')](_0x76aa('0x66'),_0xb2856c[_0x76aa('0x67')]))['toString'](_0x76aa('0x68')))},'json':!![]});}})[_0x76aa('0x1c')](function(_0x2ce07f){if(_0x2ce07f){var _0x42cfc3=[_0x76aa('0x69'),'subject',_0x76aa('0x6a'),'description',_0x76aa('0x27'),_0x76aa('0x6b'),_0x76aa('0x6c'),_0x76aa('0x6d'),_0x76aa('0x6e'),_0x76aa('0x6c'),'company'];_['remove'](_0x2ce07f,function(_0x547411){return _0x42cfc3['includes'](_0x547411['name'])||!_0x547411[_0x76aa('0x6f')]&&_0x547411[_0x76aa('0x39')]!=='custom_text'&&_0x547411['type']!=='custom_dropdown';});return{'count':_0x2ce07f[_0x76aa('0x4f')],'rows':_[_0x76aa('0x36')](_0x2ce07f,function(_0x161593){return{'id':_0x161593['name'],'name':_0x161593['label'],'custom':!_0x161593[_0x76aa('0x6f')],'options':_0x161593[_0x76aa('0x70')]?_[_0x76aa('0x36')](_0x161593[_0x76aa('0x70')],function(_0x354c7b){return{'name':_['capitalize'](_0x354c7b),'value':_0x354c7b};}):[]};})};}})['then'](respondWithResult(_0x482864,null))[_0x76aa('0x25')](function(_0x5c18b4){var _0x5d9381=_0x52f05d['query'][_0x76aa('0x71')]?0x1f4:_0x5c18b4[_0x76aa('0x72')]||0x1f4;logger['error'](_0x76aa('0x73'),_0x76aa('0x74'),_0x5d9381,JSON['stringify'](_0x5c18b4));delete _0x5c18b4[_0x76aa('0x35')];if(_0x5d9381===0x191){_0x5d9381=0x190;}_0x482864[_0x76aa('0x27')](_0x5d9381)[_0x76aa('0x75')](_0x52f05d[_0x76aa('0x3c')][_0x76aa('0x71')]?{'message':_0x76aa('0x76'),'statusCode':_0x5c18b4[_0x76aa('0x72')]}:_0x5c18b4);});}; \ No newline at end of file +var _0x9957=['requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','count','set','Content-Range','reject','update','end','stack','send','map','FreshdeskAccount','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','limit','offset','sort','where','pick','filter','merge','VIRTUAL','include','findAll','params','keys','length','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X'];(function(_0x50c6ce,_0x2c3085){var _0x4ed8=function(_0x15408b){while(--_0x15408b){_0x50c6ce['push'](_0x50c6ce['shift']());}};_0x4ed8(++_0x2c3085);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var integrations=require(_0x7995('0x1a'));var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x23999f,_0x2bbe7a,_0x4cc004){if(_0x4cc004){var _0x58f5ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58f5ad[_0x7995('0x1e')](_0x2bbe7a)){return _0x23999f;}else{throw new db[(_0x7995('0x1f'))][(_0x7995('0x20'))](_0x7995('0x21'));}}else{return _0x23999f;}}function respondWithRpcPromise(_0x3f1d3e,_0x1a5310,_0x2202ce,_0x41cbf0){return new BPromise(function(_0x5377e5,_0x2eeacc){var _0x565d97=_0x41cbf0||client;return _0x565d97[_0x7995('0x22')](_0x3f1d3e,_0x2202ce)[_0x7995('0x23')](function(_0x43d4b8){logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1a5310,_0x7995('0x26'),JSON['stringify'](_0x43d4b8));if(_0x43d4b8['error']){if(_0x43d4b8[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger['error'](_0x7995('0x25'),_0x1a5310,_0x43d4b8['error']['message']);return _0x2eeacc(_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x25'),_0x1a5310,_0x43d4b8[_0x7995('0x27')][_0x7995('0x29')]);return _0x5377e5(_0x43d4b8['error'][_0x7995('0x29')]);}else{logger[_0x7995('0x24')](_0x7995('0x25'),_0x1a5310,_0x7995('0x26'));_0x5377e5(_0x43d4b8[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x472195){logger['error'](_0x7995('0x25'),_0x1a5310,_0x472195);_0x2eeacc(_0x472195);});});}function respondWithStatusCode(_0x34e70c,_0x401dc3){_0x401dc3=_0x401dc3||0xcc;return function(_0x268ce7){if(_0x268ce7){return _0x34e70c[_0x7995('0x2c')](_0x401dc3);}return _0x34e70c[_0x7995('0x2d')](_0x401dc3)['end']();};}function respondWithResult(_0x47625f,_0x5911c3){_0x5911c3=_0x5911c3||0xc8;return function(_0x229742){if(_0x229742){return _0x47625f[_0x7995('0x2d')](_0x5911c3)[_0x7995('0x2e')](_0x229742);}};}function respondWithFilteredResult(_0x132a42,_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){var _0x9b2a15=_0x4b6f99[_0x7995('0x2f')],_0x514445=_0x11c1eb['offset'],_0x456a28=_0x11c1eb['offset']+_0x11c1eb['limit'],_0x3250e0;if(_0x456a28>=_0x9b2a15){_0x456a28=_0x9b2a15;_0x3250e0=0xc8;}else{_0x3250e0=0xce;}_0x132a42[_0x7995('0x2d')](_0x3250e0);return _0x132a42[_0x7995('0x30')](_0x7995('0x31'),_0x514445+'-'+_0x456a28+'/'+_0x9b2a15)[_0x7995('0x2e')](_0x4b6f99);}return null;};}function patchUpdates(_0x2e3493){return function(_0x1ca460){try{jsonpatch['apply'](_0x1ca460,_0x2e3493,!![]);}catch(_0x481c74){return BPromise[_0x7995('0x32')](_0x481c74);}return _0x1ca460['save']();};}function saveUpdates(_0x553671,_0x3eb566){return function(_0x29fac5){if(_0x29fac5){return _0x29fac5[_0x7995('0x33')](_0x553671)[_0x7995('0x23')](function(_0x510841){return _0x510841;});}return null;};}function removeEntity(_0x44309d,_0x33e24e){return function(_0x5dd802){if(_0x5dd802){return _0x5dd802['destroy']()['then'](function(){_0x44309d[_0x7995('0x2d')](0xcc)[_0x7995('0x34')]();});}};}function handleEntityNotFound(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(!_0x51b95d){_0x4a176f[_0x7995('0x2c')](0x194);}return _0x51b95d;};}function handleError(_0x1cb058,_0x177cb4){_0x177cb4=_0x177cb4||0x1f4;return function(_0x5014d2){logger['error'](_0x5014d2[_0x7995('0x35')]);if(_0x5014d2['name']){delete _0x5014d2['name'];}_0x1cb058[_0x7995('0x2d')](_0x177cb4)[_0x7995('0x36')](_0x5014d2);};}exports['index']=function(_0x1baa15,_0x1922b4){var _0x2b772f={},_0x18667c={},_0x1e3dbf={'count':0x0,'rows':[]};var _0x53002a=_[_0x7995('0x37')](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x1d60b8){return{'name':_0x1d60b8['fieldName'],'type':_0x1d60b8[_0x7995('0x3a')][_0x7995('0x3b')]};});_0x18667c[_0x7995('0x3c')]=_[_0x7995('0x37')](_0x53002a,_0x7995('0x3d'));_0x18667c[_0x7995('0x3e')]=_['keys'](_0x1baa15[_0x7995('0x3e')]);_0x18667c[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],_0x18667c[_0x7995('0x3e')]);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x40')](_0x18667c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x1baa15[_0x7995('0x3e')][_0x7995('0x42')]));_0x2b772f[_0x7995('0x41')]=_0x2b772f[_0x7995('0x41')]['length']?_0x2b772f['attributes']:_0x18667c[_0x7995('0x3c')];if(!_0x1baa15[_0x7995('0x3e')]['hasOwnProperty']('nolimit')){_0x2b772f[_0x7995('0x43')]=qs['limit'](_0x1baa15['query'][_0x7995('0x43')]);_0x2b772f[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x1baa15['query'][_0x7995('0x44')]);}_0x2b772f['order']=qs[_0x7995('0x45')](_0x1baa15['query']['sort']);_0x2b772f[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x1baa15[_0x7995('0x3e')],_0x18667c['filters']),_0x53002a);if(_0x1baa15[_0x7995('0x3e')][_0x7995('0x48')]){_0x2b772f[_0x7995('0x46')]=_[_0x7995('0x49')](_0x2b772f['where'],{'$or':_['map'](_0x53002a,function(_0x1c37c6){if(_0x1c37c6['type']!==_0x7995('0x4a')){var _0x59c153={};_0x59c153[_0x1c37c6[_0x7995('0x3d')]]={'$like':'%'+_0x1baa15['query'][_0x7995('0x48')]+'%'};return _0x59c153;}})});}_0x2b772f=_[_0x7995('0x49')]({},_0x2b772f,_0x1baa15['options']);var _0x3e9e62={'where':_0x2b772f[_0x7995('0x46')]};return db[_0x7995('0x38')][_0x7995('0x2f')](_0x3e9e62)['then'](function(_0x2458cb){_0x1e3dbf[_0x7995('0x2f')]=_0x2458cb;if(_0x1baa15[_0x7995('0x3e')]['includeAll']){_0x2b772f[_0x7995('0x4b')]=[{'all':!![]}];}return db[_0x7995('0x38')][_0x7995('0x4c')](_0x2b772f);})[_0x7995('0x23')](function(_0x255313){_0x1e3dbf['rows']=_0x255313;return _0x1e3dbf;})[_0x7995('0x23')](respondWithFilteredResult(_0x1922b4,_0x2b772f))[_0x7995('0x2b')](handleError(_0x1922b4,null));};exports['show']=function(_0x3d1dbb,_0x5843ba){var _0x1d87f9={'raw':![],'where':{'id':_0x3d1dbb[_0x7995('0x4d')]['id']}},_0x187735={};_0x187735[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x38')][_0x7995('0x39')]);_0x187735['query']=_[_0x7995('0x4e')](_0x3d1dbb[_0x7995('0x3e')]);_0x187735[_0x7995('0x3f')]=_['intersection'](_0x187735[_0x7995('0x3c')],_0x187735[_0x7995('0x3e')]);_0x1d87f9[_0x7995('0x41')]=_['intersection'](_0x187735['model'],qs['fields'](_0x3d1dbb[_0x7995('0x3e')][_0x7995('0x42')]));_0x1d87f9['attributes']=_0x1d87f9[_0x7995('0x41')][_0x7995('0x4f')]?_0x1d87f9[_0x7995('0x41')]:_0x187735[_0x7995('0x3c')];if(_0x3d1dbb[_0x7995('0x3e')]['includeAll']){_0x1d87f9[_0x7995('0x4b')]=[{'all':!![]}];}_0x1d87f9=_['merge']({},_0x1d87f9,_0x3d1dbb[_0x7995('0x50')]);return db[_0x7995('0x38')][_0x7995('0x51')](_0x1d87f9)['then'](handleEntityNotFound(_0x5843ba,null))['then'](respondWithResult(_0x5843ba,null))['catch'](handleError(_0x5843ba,null));};exports['create']=function(_0x2e13b0,_0x3709de){return db[_0x7995('0x38')][_0x7995('0x52')](_0x2e13b0[_0x7995('0x53')],{})[_0x7995('0x23')](respondWithResult(_0x3709de,0xc9))[_0x7995('0x2b')](handleError(_0x3709de,null));};exports[_0x7995('0x33')]=function(_0x328671,_0x17ecd3){if(_0x328671[_0x7995('0x53')]['id']){delete _0x328671[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x51')]({'where':{'id':_0x328671[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x17ecd3,null))[_0x7995('0x23')](saveUpdates(_0x328671[_0x7995('0x53')],null))[_0x7995('0x23')](respondWithResult(_0x17ecd3,null))['catch'](handleError(_0x17ecd3,null));};exports[_0x7995('0x54')]=function(_0x630737,_0x3b8a54){return db[_0x7995('0x38')]['find']({'where':{'id':_0x630737['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3b8a54,null))[_0x7995('0x23')](removeEntity(_0x3b8a54,null))[_0x7995('0x2b')](handleError(_0x3b8a54,null));};exports[_0x7995('0x55')]=function(_0x51c50b,_0x13cd7b,_0x74ff38){var _0xef5044={};var _0x33c49c={};var _0x502d43;var _0x5e2d97;return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x51c50b[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x13cd7b,null))[_0x7995('0x23')](function(_0x27c5cd){if(_0x27c5cd){_0x502d43=_0x27c5cd;_0x33c49c[_0x7995('0x3c')]=_[_0x7995('0x4e')](db[_0x7995('0x57')]['rawAttributes']);_0x33c49c[_0x7995('0x3e')]=_[_0x7995('0x4e')](_0x51c50b[_0x7995('0x3e')]);_0x33c49c[_0x7995('0x3f')]=_['intersection'](_0x33c49c['model'],_0x33c49c[_0x7995('0x3e')]);_0xef5044[_0x7995('0x41')]=_['intersection'](_0x33c49c[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x42')]));_0xef5044[_0x7995('0x41')]=_0xef5044['attributes'][_0x7995('0x4f')]?_0xef5044['attributes']:_0x33c49c[_0x7995('0x3c')];_0xef5044[_0x7995('0x58')]=qs[_0x7995('0x45')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x45')]);_0xef5044[_0x7995('0x46')]=qs[_0x7995('0x3f')](_[_0x7995('0x47')](_0x51c50b[_0x7995('0x3e')],_0x33c49c[_0x7995('0x3f')]));if(_0x51c50b[_0x7995('0x3e')][_0x7995('0x48')]){_0xef5044['where']=_[_0x7995('0x49')](_0xef5044[_0x7995('0x46')],{'$or':_[_0x7995('0x37')](_0xef5044[_0x7995('0x41')],function(_0x2c6548){var _0x54a2e0={};_0x54a2e0[_0x2c6548]={'$like':'%'+_0x51c50b['query'][_0x7995('0x48')]+'%'};return _0x54a2e0;})});}_0xef5044=_[_0x7995('0x49')]({},_0xef5044,_0x51c50b[_0x7995('0x50')]);return _0x502d43[_0x7995('0x55')](_0xef5044);}})['then'](function(_0x22d317){if(_0x22d317){_0x5e2d97=_0x22d317['length'];if(!_0x51c50b['query'][_0x7995('0x59')](_0x7995('0x5a'))){_0xef5044[_0x7995('0x43')]=qs[_0x7995('0x43')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x43')]);_0xef5044[_0x7995('0x44')]=qs[_0x7995('0x44')](_0x51c50b[_0x7995('0x3e')][_0x7995('0x44')]);}return _0x502d43['getConfigurations'](_0xef5044);}})[_0x7995('0x23')](function(_0x8908cd){if(_0x8908cd){return _0x8908cd?{'count':_0x5e2d97,'rows':_0x8908cd}:null;}})[_0x7995('0x23')](respondWithResult(_0x13cd7b,null))['catch'](handleError(_0x13cd7b,null));};exports[_0x7995('0x5b')]=function(_0x1d2f9d,_0x705f0,_0x3a7d9d){if(_0x1d2f9d[_0x7995('0x53')]['id']){delete _0x1d2f9d[_0x7995('0x53')]['id'];}return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x1d2f9d[_0x7995('0x4d')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x705f0,null))[_0x7995('0x23')](function(_0x535131){if(_0x535131){_0x1d2f9d['body'][_0x7995('0x5c')]=_0x535131['id'];_0x1d2f9d[_0x7995('0x53')][_0x7995('0x5d')]=integrations[_0x7995('0x5e')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d[_0x7995('0x53')]['type']);_0x1d2f9d['body'][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x1d2f9d['body'][_0x7995('0x5f')],_0x1d2f9d['body'][_0x7995('0x3a')]);return db[_0x7995('0x57')]['create'](_0x1d2f9d['body'],{'include':[{'model':db[_0x7995('0x62')],'as':'Subjects'},{'model':db[_0x7995('0x62')],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x23')](respondWithResult(_0x705f0,null))[_0x7995('0x2b')](handleError(_0x705f0,null));};exports[_0x7995('0x63')]=function(_0x18cff7,_0x8af865,_0x14cb17){var _0x29e0ee='';return db[_0x7995('0x38')][_0x7995('0x56')]({'where':{'id':_0x18cff7[_0x7995('0x4d')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x23')](handleEntityNotFound(_0x8af865,null))[_0x7995('0x23')](function(_0x6ad274){if(_0x6ad274){_0x29e0ee=_0x6ad274[_0x7995('0x64')];var _0x2ff7ba=_0x29e0ee[_0x7995('0x66')](-0x1);if(_0x2ff7ba==='/'){_0x29e0ee=_0x29e0ee[_0x7995('0x67')](0x0,_0x29e0ee[_0x7995('0x68')](_0x2ff7ba));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0x29e0ee,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util['format'](_0x7995('0x6e'),_0x6ad274[_0x7995('0x65')]))['toString']('base64'))},'json':!![]});}})[_0x7995('0x23')](function(_0x3fe8fc){if(_0x3fe8fc){var _0x2d45d5=[_0x7995('0x6f'),_0x7995('0x70'),_0x7995('0x71'),'description',_0x7995('0x2d'),_0x7995('0x72'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x73'),_0x7995('0x76')];_[_0x7995('0x77')](_0x3fe8fc,function(_0x560095){return _0x2d45d5[_0x7995('0x78')](_0x560095[_0x7995('0x3d')])||!_0x560095['default']&&_0x560095['type']!==_0x7995('0x79')&&_0x560095[_0x7995('0x3a')]!==_0x7995('0x7a');});return{'count':_0x3fe8fc[_0x7995('0x4f')],'rows':_[_0x7995('0x37')](_0x3fe8fc,function(_0x4a02ea){return{'id':_0x4a02ea[_0x7995('0x3d')],'name':_0x4a02ea[_0x7995('0x7b')],'custom':!_0x4a02ea['default'],'options':_0x4a02ea[_0x7995('0x7c')]?_[_0x7995('0x37')](_0x4a02ea['choices'],function(_0x1535a3){return{'name':_['capitalize'](_0x1535a3),'value':_0x1535a3};}):[]};})};}})[_0x7995('0x23')](respondWithResult(_0x8af865,null))[_0x7995('0x2b')](function(_0x3ab421){var _0x428a1b=_0x18cff7[_0x7995('0x3e')]['test']?0x1f4:_0x3ab421[_0x7995('0x7d')]||0x1f4;logger[_0x7995('0x27')](_0x7995('0x7e'),'getFields',_0x428a1b,JSON[_0x7995('0x7f')](_0x3ab421));delete _0x3ab421[_0x7995('0x3d')];if(_0x428a1b===0x191){_0x428a1b=0x190;}_0x8af865[_0x7995('0x2d')](_0x428a1b)[_0x7995('0x36')](_0x18cff7['query'][_0x7995('0x1e')]?{'message':_0x7995('0x80'),'statusCode':_0x3ab421[_0x7995('0x7d')]}:_0x3ab421);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index f7d1540..914e5eb 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 _0xc262=['util','api','moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_freshdesk_accounts','lodash'];(function(_0x376dd6,_0x2cc7b7){var _0x45cb12=function(_0x150f7e){while(--_0x150f7e){_0x376dd6['push'](_0x376dd6['shift']());}};_0x45cb12(++_0x2cc7b7);}(_0xc262,0xa4));var _0x2c26=function(_0x34eddf,_0x386e8a){_0x34eddf=_0x34eddf-0x0;var _0x2e87ee=_0xc262[_0x34eddf];return _0x2e87ee;};'use strict';var _=require(_0x2c26('0x0'));var util=require(_0x2c26('0x1'));var logger=require('../../config/logger')(_0x2c26('0x2'));var moment=require(_0x2c26('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c26('0x4'));var fs=require('fs');var path=require(_0x2c26('0x5'));var rimraf=require(_0x2c26('0x6'));var config=require(_0x2c26('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x2c26('0x8'));module[_0x2c26('0x9')]=function(_0x346fa2,_0x39da1b){return _0x346fa2['define']('FreshdeskAccount',attributes,{'tableName':_0x2c26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce4c=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x3e0eec,_0x544939){var _0x3c8976=function(_0x45b9b7){while(--_0x45b9b7){_0x3e0eec['push'](_0x3e0eec['shift']());}};_0x3c8976(++_0x544939);}(_0xce4c,0x99));var _0xcce4=function(_0x59f69b,_0x19ec3f){_0x59f69b=_0x59f69b-0x0;var _0x1638d6=_0xce4c[_0x59f69b];return _0x1638d6;};'use strict';var _=require(_0xcce4('0x0'));var util=require(_0xcce4('0x1'));var logger=require(_0xcce4('0x2'))('api');var moment=require(_0xcce4('0x3'));var BPromise=require(_0xcce4('0x4'));var rp=require(_0xcce4('0x5'));var fs=require('fs');var path=require(_0xcce4('0x6'));var rimraf=require(_0xcce4('0x7'));var config=require(_0xcce4('0x8'));var attributes=require(_0xcce4('0x9'));var integrations=require(_0xcce4('0xa'));module[_0xcce4('0xb')]=function(_0x5e57e1,_0x16a185){return _0x5e57e1['define'](_0xcce4('0xc'),attributes,{'tableName':_0xcce4('0xd'),'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 eab9f07..384ff3d 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 _0x220c=['include','map','model','GetFreshdeskAccount','catch','ShowFreshdeskAccount','FreshdeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','info','result','options','where','attributes','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x220c,0x14d));var _0xc220=function(_0x229f1b,_0x1eca63){_0x229f1b=_0x229f1b-0x0;var _0x7e7505=_0x220c[_0x229f1b];return _0x7e7505;};'use strict';var _=require('lodash');var util=require(_0xc220('0x0'));var moment=require(_0xc220('0x1'));var BPromise=require(_0xc220('0x2'));var rs=require(_0xc220('0x3'));var fs=require('fs');var Redis=require(_0xc220('0x4'));var db=require(_0xc220('0x5'))['db'];var utils=require(_0xc220('0x6'));var logger=require(_0xc220('0x7'))(_0xc220('0x8'));var config=require('../../config/environment');var jayson=require(_0xc220('0x9'));var client=jayson[_0xc220('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb95bc,_0x4ea5ba,_0x3be979){return new BPromise(function(_0x534561,_0x50dfbe){return client[_0xc220('0xb')](_0xfb95bc,_0x3be979)[_0xc220('0xc')](function(_0x27aeca){logger['info'](_0xc220('0xd'),_0x4ea5ba,'request\x20sent');logger[_0xc220('0xe')](_0xc220('0xf'),_0x4ea5ba,_0xc220('0x10'),JSON[_0xc220('0x11')](_0x27aeca));if(_0x27aeca['error']){if(_0x27aeca['error'][_0xc220('0x12')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0x27aeca['error'][_0xc220('0x13')]);return _0x50dfbe(_0x27aeca[_0xc220('0x14')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0x27aeca['error'][_0xc220('0x13')]);return _0x534561(_0x27aeca[_0xc220('0x14')][_0xc220('0x13')]);}else{logger[_0xc220('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ea5ba,_0xc220('0x10'));_0x534561(_0x27aeca[_0xc220('0x16')][_0xc220('0x13')]);}})['catch'](function(_0x57831b){logger[_0xc220('0x14')](_0xc220('0xd'),_0x4ea5ba,_0x57831b);_0x50dfbe(_0x57831b);});});}exports['GetFreshdeskAccount']=function(_0x37e4f7){var _0x461063=this;return new Promise(function(_0x29ab7d,_0x19c4d3){return db['FreshdeskAccount']['findAll']({'raw':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x18')]||null:null,'attributes':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7['options'][_0xc220('0x19')]||null:null,'limit':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x1a')]||null:null,'include':_0x37e4f7[_0xc220('0x17')]?_0x37e4f7[_0xc220('0x17')][_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x37e4f7[_0xc220('0x17')]['include'],function(_0x2a2fcf){return{'model':db[_0x2a2fcf['model']],'as':_0x2a2fcf['as'],'attributes':_0x2a2fcf[_0xc220('0x19')],'include':_0x2a2fcf['include']?_[_0xc220('0x1c')](_0x2a2fcf[_0xc220('0x1b')],function(_0x10de3a){return{'model':db[_0x10de3a['model']],'as':_0x10de3a['as'],'attributes':_0x10de3a[_0xc220('0x19')],'include':_0x10de3a[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x10de3a[_0xc220('0x1b')],function(_0x17c091){return{'model':db[_0x17c091[_0xc220('0x1d')]],'as':_0x17c091['as'],'attributes':_0x17c091['attributes']};}):[]};}):[]};}):[]:[]})[_0xc220('0xc')](function(_0x22db65){logger[_0xc220('0x15')]('GetFreshdeskAccount',_0x37e4f7);logger['debug'](_0xc220('0x1e'),_0x37e4f7,JSON[_0xc220('0x11')](_0x22db65));_0x29ab7d(_0x22db65);})[_0xc220('0x1f')](function(_0x722025){logger[_0xc220('0x14')]('GetFreshdeskAccount',_0x722025[_0xc220('0x13')],_0x37e4f7);_0x19c4d3(_0x461063['error'](0x1f4,_0x722025[_0xc220('0x13')]));});});};exports[_0xc220('0x20')]=function(_0x6634b5){var _0x1a19bd=this;return new Promise(function(_0x24c914,_0x4996f0){return db[_0xc220('0x21')][_0xc220('0x22')]({'raw':_0x6634b5['options']?_0x6634b5['options'][_0xc220('0x23')]===undefined?!![]:![]:!![],'where':_0x6634b5[_0xc220('0x17')]?_0x6634b5['options']['where']||null:null,'attributes':_0x6634b5[_0xc220('0x17')]?_0x6634b5['options'][_0xc220('0x19')]||null:null,'include':_0x6634b5['options']?_0x6634b5[_0xc220('0x17')][_0xc220('0x1b')]?_['map'](_0x6634b5['options'][_0xc220('0x1b')],function(_0x47935c){return{'model':db[_0x47935c[_0xc220('0x1d')]],'as':_0x47935c['as'],'attributes':_0x47935c[_0xc220('0x19')],'include':_0x47935c[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x47935c[_0xc220('0x1b')],function(_0x4dac66){return{'model':db[_0x4dac66[_0xc220('0x1d')]],'as':_0x4dac66['as'],'attributes':_0x4dac66['attributes'],'include':_0x4dac66[_0xc220('0x1b')]?_[_0xc220('0x1c')](_0x4dac66[_0xc220('0x1b')],function(_0x5adc73){return{'model':db[_0x5adc73[_0xc220('0x1d')]],'as':_0x5adc73['as'],'attributes':_0x5adc73['attributes']};}):[]};}):[]};}):[]:[]})[_0xc220('0xc')](function(_0x555f90){logger[_0xc220('0x15')](_0xc220('0x20'),_0x6634b5);logger[_0xc220('0xe')](_0xc220('0x20'),_0x6634b5,JSON[_0xc220('0x11')](_0x555f90));_0x24c914(_0x555f90);})['catch'](function(_0x13741b){logger[_0xc220('0x14')]('ShowFreshdeskAccount',_0x13741b[_0xc220('0x13')],_0x6634b5);_0x4996f0(_0x1a19bd[_0xc220('0x14')](0x1f4,_0x13741b[_0xc220('0x13')]));});});}; \ No newline at end of file +var _0xe56e=['error','message','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','FreshdeskAccount','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x15f941,_0x4637f4){var _0x473b27=function(_0x2a63f3){while(--_0x2a63f3){_0x15f941['push'](_0x15f941['shift']());}};_0x473b27(++_0x4637f4);}(_0xe56e,0x137));var _0xee56=function(_0x4e8ca0,_0x3efd38){_0x4e8ca0=_0x4e8ca0-0x0;var _0x564e5e=_0xe56e[_0x4e8ca0];return _0x564e5e;};'use strict';var _=require(_0xee56('0x0'));var util=require(_0xee56('0x1'));var moment=require(_0xee56('0x2'));var BPromise=require(_0xee56('0x3'));var rs=require(_0xee56('0x4'));var fs=require('fs');var Redis=require(_0xee56('0x5'));var db=require(_0xee56('0x6'))['db'];var utils=require(_0xee56('0x7'));var logger=require(_0xee56('0x8'))(_0xee56('0x9'));var config=require('../../config/environment');var jayson=require(_0xee56('0xa'));var client=jayson[_0xee56('0xb')][_0xee56('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32ef50,_0x3a2edc,_0x43828c){return new BPromise(function(_0xd7090c,_0x59fafa){return client[_0xee56('0xd')](_0x32ef50,_0x43828c)[_0xee56('0xe')](function(_0x2a3917){logger[_0xee56('0xf')](_0xee56('0x10'),_0x3a2edc,_0xee56('0x11'));logger[_0xee56('0x12')](_0xee56('0x13'),_0x3a2edc,_0xee56('0x11'),JSON[_0xee56('0x14')](_0x2a3917));if(_0x2a3917['error']){if(_0x2a3917['error'][_0xee56('0x15')]===0x1f4){logger[_0xee56('0x16')](_0xee56('0x10'),_0x3a2edc,_0x2a3917['error'][_0xee56('0x17')]);return _0x59fafa(_0x2a3917[_0xee56('0x16')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3a2edc,_0x2a3917[_0xee56('0x16')][_0xee56('0x17')]);return _0xd7090c(_0x2a3917[_0xee56('0x16')][_0xee56('0x17')]);}else{logger[_0xee56('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x3a2edc,'request\x20sent');_0xd7090c(_0x2a3917['result'][_0xee56('0x17')]);}})[_0xee56('0x18')](function(_0x32a822){logger[_0xee56('0x16')](_0xee56('0x10'),_0x3a2edc,_0x32a822);_0x59fafa(_0x32a822);});});}exports[_0xee56('0x19')]=function(_0x279b86){var _0x5af4de=this;return new Promise(function(_0x54630e,_0x7cd19e){return db['FreshdeskAccount'][_0xee56('0x1a')]({'raw':_0x279b86['options']?_0x279b86[_0xee56('0x1b')][_0xee56('0x1c')]===undefined?!![]:![]:!![],'where':_0x279b86[_0xee56('0x1b')]?_0x279b86[_0xee56('0x1b')][_0xee56('0x1d')]||null:null,'attributes':_0x279b86[_0xee56('0x1b')]?_0x279b86[_0xee56('0x1b')][_0xee56('0x1e')]||null:null,'limit':_0x279b86[_0xee56('0x1b')]?_0x279b86['options']['limit']||null:null,'include':_0x279b86[_0xee56('0x1b')]?_0x279b86[_0xee56('0x1b')][_0xee56('0x1f')]?_[_0xee56('0x20')](_0x279b86['options'][_0xee56('0x1f')],function(_0x5ba066){return{'model':db[_0x5ba066[_0xee56('0x21')]],'as':_0x5ba066['as'],'attributes':_0x5ba066[_0xee56('0x1e')],'include':_0x5ba066[_0xee56('0x1f')]?_['map'](_0x5ba066[_0xee56('0x1f')],function(_0x23468b){return{'model':db[_0x23468b[_0xee56('0x21')]],'as':_0x23468b['as'],'attributes':_0x23468b['attributes'],'include':_0x23468b[_0xee56('0x1f')]?_['map'](_0x23468b[_0xee56('0x1f')],function(_0x1e3ccf){return{'model':db[_0x1e3ccf[_0xee56('0x21')]],'as':_0x1e3ccf['as'],'attributes':_0x1e3ccf[_0xee56('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xee56('0xe')](function(_0x150649){logger['info'](_0xee56('0x19'),_0x279b86);logger['debug'](_0xee56('0x19'),_0x279b86,JSON[_0xee56('0x14')](_0x150649));_0x54630e(_0x150649);})['catch'](function(_0x630c26){logger['error']('GetFreshdeskAccount',_0x630c26[_0xee56('0x17')],_0x279b86);_0x7cd19e(_0x5af4de[_0xee56('0x16')](0x1f4,_0x630c26[_0xee56('0x17')]));});});};exports['ShowFreshdeskAccount']=function(_0x565e7d){var _0x3052d5=this;return new Promise(function(_0x4e200c,_0x92c94a){return db[_0xee56('0x22')][_0xee56('0x23')]({'raw':_0x565e7d[_0xee56('0x1b')]?_0x565e7d['options'][_0xee56('0x1c')]===undefined?!![]:![]:!![],'where':_0x565e7d['options']?_0x565e7d[_0xee56('0x1b')][_0xee56('0x1d')]||null:null,'attributes':_0x565e7d[_0xee56('0x1b')]?_0x565e7d[_0xee56('0x1b')][_0xee56('0x1e')]||null:null,'include':_0x565e7d[_0xee56('0x1b')]?_0x565e7d[_0xee56('0x1b')][_0xee56('0x1f')]?_[_0xee56('0x20')](_0x565e7d[_0xee56('0x1b')]['include'],function(_0x51de5a){return{'model':db[_0x51de5a[_0xee56('0x21')]],'as':_0x51de5a['as'],'attributes':_0x51de5a[_0xee56('0x1e')],'include':_0x51de5a[_0xee56('0x1f')]?_[_0xee56('0x20')](_0x51de5a[_0xee56('0x1f')],function(_0x112fa4){return{'model':db[_0x112fa4[_0xee56('0x21')]],'as':_0x112fa4['as'],'attributes':_0x112fa4['attributes'],'include':_0x112fa4[_0xee56('0x1f')]?_[_0xee56('0x20')](_0x112fa4[_0xee56('0x1f')],function(_0x4ac972){return{'model':db[_0x4ac972['model']],'as':_0x4ac972['as'],'attributes':_0x4ac972['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a42f2){logger[_0xee56('0xf')]('ShowFreshdeskAccount',_0x565e7d);logger[_0xee56('0x12')](_0xee56('0x24'),_0x565e7d,JSON[_0xee56('0x14')](_0x4a42f2));_0x4e200c(_0x4a42f2);})[_0xee56('0x18')](function(_0x5f2cf2){logger[_0xee56('0x16')]('ShowFreshdeskAccount',_0x5f2cf2[_0xee56('0x17')],_0x565e7d);_0x92c94a(_0x3052d5['error'](0x1f4,_0x5f2cf2[_0xee56('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index b4408bf..444238c 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 _0xc86a=['getDescriptions','/:id/tags','getTags','post','create','update','delete','destroy','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions'];(function(_0x530d32,_0x298dfc){var _0x198ed1=function(_0x31f586){while(--_0x31f586){_0x530d32['push'](_0x530d32['shift']());}};_0x198ed1(++_0x298dfc);}(_0xc86a,0x1d5));var _0xac86=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xc86a[_0x3a7a9c];return _0x59156e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xac86('0x0'));var express=require(_0xac86('0x1'));var router=express['Router']();var auth=require(_0xac86('0x2'));var interaction=require(_0xac86('0x3'));var config=require('../../config/environment');var controller=require(_0xac86('0x4'));router[_0xac86('0x5')]('/',auth[_0xac86('0x6')](),controller[_0xac86('0x7')]);router[_0xac86('0x5')](_0xac86('0x8'),auth['isAuthenticated'](),controller[_0xac86('0x9')]);router['get'](_0xac86('0xa'),auth[_0xac86('0x6')](),controller[_0xac86('0xb')]);router[_0xac86('0x5')](_0xac86('0xc'),auth[_0xac86('0x6')](),controller['getSubjects']);router[_0xac86('0x5')](_0xac86('0xd'),auth[_0xac86('0x6')](),controller[_0xac86('0xe')]);router[_0xac86('0x5')](_0xac86('0xf'),auth[_0xac86('0x6')](),controller[_0xac86('0x10')]);router[_0xac86('0x11')]('/',auth[_0xac86('0x6')](),controller[_0xac86('0x12')]);router[_0xac86('0x11')](_0xac86('0xf'),auth[_0xac86('0x6')](),controller['setTags']);router['put'](_0xac86('0x8'),auth['isAuthenticated'](),controller[_0xac86('0x13')]);router[_0xac86('0x14')](_0xac86('0x8'),auth[_0xac86('0x6')](),controller[_0xac86('0x15')]);module[_0xac86('0x16')]=router; \ No newline at end of file +var _0x8bdb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','/:id','update','delete','destroy','exports'];(function(_0x5ac767,_0x4cf5ce){var _0x33ed0f=function(_0x4f92f7){while(--_0x4f92f7){_0x5ac767['push'](_0x5ac767['shift']());}};_0x33ed0f(++_0x4cf5ce);}(_0x8bdb,0x1a9));var _0xb8bd=function(_0x22a768,_0x4c4ef0){_0x22a768=_0x22a768-0x0;var _0x3c3cc0=_0x8bdb[_0x22a768];return _0x3c3cc0;};'use strict';var multer=require(_0xb8bd('0x0'));var util=require(_0xb8bd('0x1'));var path=require(_0xb8bd('0x2'));var timeout=require(_0xb8bd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb8bd('0x4'));var interaction=require(_0xb8bd('0x5'));var config=require('../../config/environment');var controller=require(_0xb8bd('0x6'));router[_0xb8bd('0x7')]('/',auth[_0xb8bd('0x8')](),controller[_0xb8bd('0x9')]);router[_0xb8bd('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb8bd('0x7')](_0xb8bd('0xa'),auth[_0xb8bd('0x8')](),controller['getFields']);router[_0xb8bd('0x7')](_0xb8bd('0xb'),auth[_0xb8bd('0x8')](),controller[_0xb8bd('0xc')]);router[_0xb8bd('0x7')](_0xb8bd('0xd'),auth[_0xb8bd('0x8')](),controller[_0xb8bd('0xe')]);router[_0xb8bd('0x7')](_0xb8bd('0xf'),auth[_0xb8bd('0x8')](),controller['getTags']);router[_0xb8bd('0x10')]('/',auth[_0xb8bd('0x8')](),controller[_0xb8bd('0x11')]);router[_0xb8bd('0x10')](_0xb8bd('0xf'),auth[_0xb8bd('0x8')](),controller[_0xb8bd('0x12')]);router[_0xb8bd('0x13')](_0xb8bd('0x14'),auth[_0xb8bd('0x8')](),controller[_0xb8bd('0x15')]);router[_0xb8bd('0x16')](_0xb8bd('0x14'),auth[_0xb8bd('0x8')](),controller[_0xb8bd('0x17')]);module[_0xb8bd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b296cbe..7604d1d 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 _0xb97d=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97d,0x132));var _0xdb97=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xb97d[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0xdb97('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb97('0x1')]},'description':{'type':Sequelize[_0xdb97('0x1')]}}; \ No newline at end of file +var _0x746c=['exports','STRING','sequelize'];(function(_0x4e9242,_0x491885){var _0x49941f=function(_0x39bbad){while(--_0x39bbad){_0x4e9242['push'](_0x4e9242['shift']());}};_0x49941f(++_0x491885);}(_0x746c,0x107));var _0xc746=function(_0x21dd37,_0x2f1ff9){_0x21dd37=_0x21dd37-0x0;var _0x4d4884=_0x746c[_0x21dd37];return _0x4d4884;};'use strict';var Sequelize=require(_0xc746('0x0'));module[_0xc746('0x1')]={'name':{'type':Sequelize[_0xc746('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e2a2c32..fa8121c 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 _0xc746=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','apply','update','then','end','stack','name','send','FreshdeskConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc746,0xc9));var _0x6c74=function(_0x4edbe6,_0x9234aa){_0x4edbe6=_0x4edbe6-0x0;var _0x32edbb=_0xc746[_0x4edbe6];return _0x32edbb;};'use strict';var pdf=require(_0x6c74('0x0'));var emlformat=require(_0x6c74('0x1'));var rimraf=require(_0x6c74('0x2'));var zipdir=require(_0x6c74('0x3'));var jsonpatch=require(_0x6c74('0x4'));var rp=require(_0x6c74('0x5'));var moment=require(_0x6c74('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c74('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6c74('0x8'));var ejs=require(_0x6c74('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c74('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6c74('0x8'));var querystring=require(_0x6c74('0xb'));var Papa=require(_0x6c74('0xc'));var Redis=require(_0x6c74('0xd'));var authService=require(_0x6c74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6c74('0xf'));var hardwareService=require(_0x6c74('0x10'));var logger=require(_0x6c74('0x11'))('api');var utils=require(_0x6c74('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6c74('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x4a534d,_0x2e93a5,_0x34adfb){if(_0x34adfb){var _0x23bd7e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23bd7e[_0x6c74('0x14')](_0x2e93a5)){return _0x4a534d;}else{throw new db['Sequelize'][(_0x6c74('0x15'))](_0x6c74('0x16'));}}else{return _0x4a534d;}}function respondWithRpcPromise(_0x663634,_0x3f7b2a,_0x19bb25,_0x1d2ae1){return new BPromise(function(_0x55ec61,_0x3820a0){var _0x5b91c8=_0x1d2ae1||client;return _0x5b91c8[_0x6c74('0x17')](_0x663634,_0x19bb25)['then'](function(_0x2cc3be){logger[_0x6c74('0x18')](_0x6c74('0x19'),_0x3f7b2a,_0x6c74('0x1a'));logger[_0x6c74('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f7b2a,_0x6c74('0x1a'),JSON[_0x6c74('0x1c')](_0x2cc3be));if(_0x2cc3be['error']){if(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1e')]===0x1f4){logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);return _0x3820a0(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);}logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);return _0x55ec61(_0x2cc3be[_0x6c74('0x1d')][_0x6c74('0x1f')]);}else{logger[_0x6c74('0x18')](_0x6c74('0x19'),_0x3f7b2a,_0x6c74('0x1a'));_0x55ec61(_0x2cc3be[_0x6c74('0x20')]['message']);}})['catch'](function(_0x3dc841){logger[_0x6c74('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f7b2a,_0x3dc841);_0x3820a0(_0x3dc841);});});}function respondWithStatusCode(_0x56c7d3,_0x1d1cea){_0x1d1cea=_0x1d1cea||0xcc;return function(_0x377282){if(_0x377282){return _0x56c7d3[_0x6c74('0x21')](_0x1d1cea);}return _0x56c7d3[_0x6c74('0x22')](_0x1d1cea)['end']();};}function respondWithResult(_0x5f53c9,_0x1731b3){_0x1731b3=_0x1731b3||0xc8;return function(_0x92e6df){if(_0x92e6df){return _0x5f53c9[_0x6c74('0x22')](_0x1731b3)[_0x6c74('0x23')](_0x92e6df);}};}function respondWithFilteredResult(_0x426d4f,_0x42c451){return function(_0x21f019){if(_0x21f019){var _0x2b422c=_0x21f019[_0x6c74('0x24')],_0x106bd4=_0x42c451[_0x6c74('0x25')],_0x37112f=_0x42c451[_0x6c74('0x25')]+_0x42c451[_0x6c74('0x26')],_0x1a67e3;if(_0x37112f>=_0x2b422c){_0x37112f=_0x2b422c;_0x1a67e3=0xc8;}else{_0x1a67e3=0xce;}_0x426d4f['status'](_0x1a67e3);return _0x426d4f['set']('Content-Range',_0x106bd4+'-'+_0x37112f+'/'+_0x2b422c)[_0x6c74('0x23')](_0x21f019);}return null;};}function patchUpdates(_0x41e5f5){return function(_0x5120b5){try{jsonpatch[_0x6c74('0x27')](_0x5120b5,_0x41e5f5,!![]);}catch(_0x2a9257){return BPromise['reject'](_0x2a9257);}return _0x5120b5['save']();};}function saveUpdates(_0x1d326c,_0xf36af3){return function(_0x4a148d){if(_0x4a148d){return _0x4a148d[_0x6c74('0x28')](_0x1d326c)['then'](function(_0x5d1970){return _0x5d1970;});}return null;};}function removeEntity(_0x51620a,_0x8cf5ac){return function(_0x404e9f){if(_0x404e9f){return _0x404e9f['destroy']()[_0x6c74('0x29')](function(){_0x51620a[_0x6c74('0x22')](0xcc)[_0x6c74('0x2a')]();});}};}function handleEntityNotFound(_0x24414a,_0x1d8428){return function(_0x9a338d){if(!_0x9a338d){_0x24414a[_0x6c74('0x21')](0x194);}return _0x9a338d;};}function handleError(_0x3a9acc,_0x10803b){_0x10803b=_0x10803b||0x1f4;return function(_0x1e4dce){logger[_0x6c74('0x1d')](_0x1e4dce[_0x6c74('0x2b')]);if(_0x1e4dce[_0x6c74('0x2c')]){delete _0x1e4dce[_0x6c74('0x2c')];}_0x3a9acc[_0x6c74('0x22')](_0x10803b)[_0x6c74('0x2d')](_0x1e4dce);};}exports['index']=function(_0x32bafa,_0x1a9bb9){var _0x34c3dc={},_0x1ec89c={},_0x295641={'count':0x0,'rows':[]};var _0x30c2b1=_['map'](db[_0x6c74('0x2e')][_0x6c74('0x2f')],function(_0x1a2ab2){return{'name':_0x1a2ab2['fieldName'],'type':_0x1a2ab2[_0x6c74('0x30')][_0x6c74('0x31')]};});_0x1ec89c[_0x6c74('0x32')]=_[_0x6c74('0x33')](_0x30c2b1,_0x6c74('0x2c'));_0x1ec89c[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x32bafa[_0x6c74('0x34')]);_0x1ec89c[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x1ec89c[_0x6c74('0x32')],_0x1ec89c['query']);_0x34c3dc[_0x6c74('0x38')]=_['intersection'](_0x1ec89c['model'],qs[_0x6c74('0x39')](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x39')]));_0x34c3dc[_0x6c74('0x38')]=_0x34c3dc[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x34c3dc[_0x6c74('0x38')]:_0x1ec89c[_0x6c74('0x32')];if(!_0x32bafa[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x34c3dc['limit']=qs['limit'](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x26')]);_0x34c3dc[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x32bafa[_0x6c74('0x34')][_0x6c74('0x25')]);}_0x34c3dc[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x32bafa['query'][_0x6c74('0x3e')]);_0x34c3dc[_0x6c74('0x3f')]=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0x32bafa[_0x6c74('0x34')],_0x1ec89c['filters']),_0x30c2b1);if(_0x32bafa[_0x6c74('0x34')][_0x6c74('0x41')]){_0x34c3dc[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x34c3dc[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x30c2b1,function(_0x404c4e){if(_0x404c4e[_0x6c74('0x30')]!==_0x6c74('0x43')){var _0x208eb3={};_0x208eb3[_0x404c4e[_0x6c74('0x2c')]]={'$like':'%'+_0x32bafa[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x208eb3;}})});}_0x34c3dc=_[_0x6c74('0x42')]({},_0x34c3dc,_0x32bafa['options']);var _0x2ab3fc={'where':_0x34c3dc['where']};return db[_0x6c74('0x2e')][_0x6c74('0x24')](_0x2ab3fc)['then'](function(_0x5755eb){_0x295641[_0x6c74('0x24')]=_0x5755eb;if(_0x32bafa['query'][_0x6c74('0x44')]){_0x34c3dc[_0x6c74('0x45')]=[{'all':!![]}];}return db[_0x6c74('0x2e')][_0x6c74('0x46')](_0x34c3dc);})['then'](function(_0x5bd50a){_0x295641['rows']=_0x5bd50a;return _0x295641;})[_0x6c74('0x29')](respondWithFilteredResult(_0x1a9bb9,_0x34c3dc))[_0x6c74('0x47')](handleError(_0x1a9bb9,null));};exports[_0x6c74('0x48')]=function(_0x8569d3,_0x5d46f4){var _0x204d7d={'raw':![],'where':{'id':_0x8569d3[_0x6c74('0x49')]['id']}},_0x207148={};_0x207148['model']=_[_0x6c74('0x35')](db[_0x6c74('0x2e')][_0x6c74('0x2f')]);_0x207148[_0x6c74('0x34')]=_['keys'](_0x8569d3[_0x6c74('0x34')]);_0x207148[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x207148['model'],_0x207148[_0x6c74('0x34')]);_0x204d7d[_0x6c74('0x38')]=_['intersection'](_0x207148['model'],qs[_0x6c74('0x39')](_0x8569d3[_0x6c74('0x34')]['fields']));_0x204d7d[_0x6c74('0x38')]=_0x204d7d[_0x6c74('0x38')]['length']?_0x204d7d['attributes']:_0x207148[_0x6c74('0x32')];if(_0x8569d3['query'][_0x6c74('0x44')]){_0x204d7d[_0x6c74('0x45')]=[{'all':!![]}];}_0x204d7d=_[_0x6c74('0x42')]({},_0x204d7d,_0x8569d3[_0x6c74('0x4a')]);return db[_0x6c74('0x2e')][_0x6c74('0x4b')](_0x204d7d)[_0x6c74('0x29')](handleEntityNotFound(_0x5d46f4,null))[_0x6c74('0x29')](respondWithResult(_0x5d46f4,null))[_0x6c74('0x47')](handleError(_0x5d46f4,null));};exports['create']=function(_0x214330,_0x487588){return db[_0x6c74('0x2e')][_0x6c74('0x4c')](_0x214330['body'],{})[_0x6c74('0x29')](respondWithResult(_0x487588,0xc9))[_0x6c74('0x47')](handleError(_0x487588,null));};exports[_0x6c74('0x28')]=function(_0x36fa53,_0x41f1ec){if(_0x36fa53[_0x6c74('0x4d')]['id']){delete _0x36fa53[_0x6c74('0x4d')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x36fa53[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x41f1ec,null))[_0x6c74('0x29')](saveUpdates(_0x36fa53[_0x6c74('0x4d')],null))[_0x6c74('0x29')](respondWithResult(_0x41f1ec,null))['catch'](handleError(_0x41f1ec,null));};exports[_0x6c74('0x4e')]=function(_0x25b4c1,_0x57d71f){return db[_0x6c74('0x2e')]['find']({'where':{'id':_0x25b4c1[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x57d71f,null))[_0x6c74('0x29')](removeEntity(_0x57d71f,null))[_0x6c74('0x47')](handleError(_0x57d71f,null));};exports[_0x6c74('0x4f')]=function(_0x3cfcdd,_0x461573,_0x443993){var _0xbb4994={};var _0x5ae319={};var _0x4c0e73;var _0x12a3aa;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x3cfcdd[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x461573,null))[_0x6c74('0x29')](function(_0x70aeca){if(_0x70aeca){_0x4c0e73=_0x70aeca;_0x5ae319[_0x6c74('0x32')]=_[_0x6c74('0x35')](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x5ae319[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x3cfcdd[_0x6c74('0x34')]);_0x5ae319[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x5ae319[_0x6c74('0x32')],_0x5ae319[_0x6c74('0x34')]);_0xbb4994[_0x6c74('0x38')]=_[_0x6c74('0x37')](_0x5ae319['model'],qs['fields'](_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x39')]));_0xbb4994['attributes']=_0xbb4994[_0x6c74('0x38')]['length']?_0xbb4994[_0x6c74('0x38')]:_0x5ae319[_0x6c74('0x32')];_0xbb4994[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x3cfcdd[_0x6c74('0x34')]['sort']);_0xbb4994['where']=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0x3cfcdd['query'],_0x5ae319[_0x6c74('0x36')]));if(_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x41')]){_0xbb4994[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0xbb4994['where'],{'$or':_[_0x6c74('0x33')](_0xbb4994[_0x6c74('0x38')],function(_0x1d3dd8){var _0x59c3f1={};_0x59c3f1[_0x1d3dd8]={'$like':'%'+_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x59c3f1;})});}_0xbb4994=_[_0x6c74('0x42')]({},_0xbb4994,_0x3cfcdd['options']);return _0x4c0e73[_0x6c74('0x4f')](_0xbb4994);}})['then'](function(_0x39b1fb){if(_0x39b1fb){_0x12a3aa=_0x39b1fb['length'];if(!_0x3cfcdd[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0xbb4994['limit']=qs['limit'](_0x3cfcdd['query'][_0x6c74('0x26')]);_0xbb4994[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x3cfcdd['query'][_0x6c74('0x25')]);}return _0x4c0e73[_0x6c74('0x4f')](_0xbb4994);}})['then'](function(_0x22caa3){if(_0x22caa3){return _0x22caa3?{'count':_0x12a3aa,'rows':_0x22caa3}:null;}})[_0x6c74('0x29')](respondWithResult(_0x461573,null))['catch'](handleError(_0x461573,null));};exports['getSubjects']=function(_0xd5cd1,_0x34d843,_0x3ed124){var _0x65ab0f={};var _0x36d9ae={};var _0x1a8cd6;var _0x3779c;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0xd5cd1[_0x6c74('0x49')]['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x34d843,null))['then'](function(_0x3ae0b9){if(_0x3ae0b9){_0x1a8cd6=_0x3ae0b9;_0x36d9ae[_0x6c74('0x32')]=_['keys'](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x36d9ae[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0xd5cd1['query']);_0x36d9ae[_0x6c74('0x36')]=_[_0x6c74('0x37')](_0x36d9ae[_0x6c74('0x32')],_0x36d9ae[_0x6c74('0x34')]);_0x65ab0f['attributes']=_[_0x6c74('0x37')](_0x36d9ae[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x39')]));_0x65ab0f[_0x6c74('0x38')]=_0x65ab0f[_0x6c74('0x38')]['length']?_0x65ab0f['attributes']:_0x36d9ae[_0x6c74('0x32')];_0x65ab0f['order']=qs['sort'](_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x65ab0f[_0x6c74('0x3f')]=qs[_0x6c74('0x36')](_[_0x6c74('0x40')](_0xd5cd1[_0x6c74('0x34')],_0x36d9ae[_0x6c74('0x36')]));if(_0xd5cd1['query'][_0x6c74('0x41')]){_0x65ab0f[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x65ab0f[_0x6c74('0x3f')],{'$or':_['map'](_0x65ab0f[_0x6c74('0x38')],function(_0x2e2a36){var _0x4d4341={};_0x4d4341[_0x2e2a36]={'$like':'%'+_0xd5cd1['query'][_0x6c74('0x41')]+'%'};return _0x4d4341;})});}_0x65ab0f=_[_0x6c74('0x42')]({},_0x65ab0f,_0xd5cd1[_0x6c74('0x4a')]);return _0x1a8cd6[_0x6c74('0x52')](_0x65ab0f);}})[_0x6c74('0x29')](function(_0x6ef144){if(_0x6ef144){_0x3779c=_0x6ef144[_0x6c74('0x3a')];if(!_0xd5cd1[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x65ab0f['limit']=qs[_0x6c74('0x26')](_0xd5cd1[_0x6c74('0x34')]['limit']);_0x65ab0f['offset']=qs['offset'](_0xd5cd1['query'][_0x6c74('0x25')]);}return _0x1a8cd6['getSubjects'](_0x65ab0f);}})[_0x6c74('0x29')](function(_0x5ccd0c){if(_0x5ccd0c){return _0x5ccd0c?{'count':_0x3779c,'rows':_0x5ccd0c}:null;}})[_0x6c74('0x29')](respondWithResult(_0x34d843,null))[_0x6c74('0x47')](handleError(_0x34d843,null));};exports['getDescriptions']=function(_0x275573,_0x36ac06,_0x520160){var _0x46c5e8={};var _0x137af5={};var _0x3a30f5;var _0x5d9ce5;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x275573[_0x6c74('0x49')]['id']}})['then'](handleEntityNotFound(_0x36ac06,null))[_0x6c74('0x29')](function(_0x38730c){if(_0x38730c){_0x3a30f5=_0x38730c;_0x137af5[_0x6c74('0x32')]=_['keys'](db[_0x6c74('0x51')][_0x6c74('0x2f')]);_0x137af5[_0x6c74('0x34')]=_[_0x6c74('0x35')](_0x275573[_0x6c74('0x34')]);_0x137af5['filters']=_[_0x6c74('0x37')](_0x137af5['model'],_0x137af5['query']);_0x46c5e8[_0x6c74('0x38')]=_[_0x6c74('0x37')](_0x137af5[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0x275573[_0x6c74('0x34')][_0x6c74('0x39')]));_0x46c5e8[_0x6c74('0x38')]=_0x46c5e8[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x46c5e8['attributes']:_0x137af5[_0x6c74('0x32')];_0x46c5e8[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x275573[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x46c5e8['where']=qs[_0x6c74('0x36')](_['pick'](_0x275573[_0x6c74('0x34')],_0x137af5[_0x6c74('0x36')]));if(_0x275573[_0x6c74('0x34')][_0x6c74('0x41')]){_0x46c5e8[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x46c5e8[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x46c5e8[_0x6c74('0x38')],function(_0x30be70){var _0x12330b={};_0x12330b[_0x30be70]={'$like':'%'+_0x275573[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x12330b;})});}_0x46c5e8=_[_0x6c74('0x42')]({},_0x46c5e8,_0x275573['options']);return _0x3a30f5[_0x6c74('0x53')](_0x46c5e8);}})[_0x6c74('0x29')](function(_0x9ea77c){if(_0x9ea77c){_0x5d9ce5=_0x9ea77c[_0x6c74('0x3a')];if(!_0x275573[_0x6c74('0x34')][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x46c5e8[_0x6c74('0x26')]=qs[_0x6c74('0x26')](_0x275573['query'][_0x6c74('0x26')]);_0x46c5e8[_0x6c74('0x25')]=qs[_0x6c74('0x25')](_0x275573[_0x6c74('0x34')]['offset']);}return _0x3a30f5[_0x6c74('0x53')](_0x46c5e8);}})[_0x6c74('0x29')](function(_0x1e19f9){if(_0x1e19f9){return _0x1e19f9?{'count':_0x5d9ce5,'rows':_0x1e19f9}:null;}})[_0x6c74('0x29')](respondWithResult(_0x36ac06,null))[_0x6c74('0x47')](handleError(_0x36ac06,null));};exports['getTags']=function(_0x469671,_0x394b5e,_0x27590d){var _0x1e3f75={};var _0x36247f={};var _0x223d26;var _0x8cfcc1;return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x469671['params']['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x394b5e,null))['then'](function(_0x1803ba){if(_0x1803ba){_0x223d26=_0x1803ba;_0x36247f['model']=_['keys'](db['Tag']['rawAttributes']);_0x36247f['query']=_[_0x6c74('0x35')](_0x469671[_0x6c74('0x34')]);_0x36247f['filters']=_[_0x6c74('0x37')](_0x36247f[_0x6c74('0x32')],_0x36247f[_0x6c74('0x34')]);_0x1e3f75['attributes']=_[_0x6c74('0x37')](_0x36247f[_0x6c74('0x32')],qs[_0x6c74('0x39')](_0x469671[_0x6c74('0x34')][_0x6c74('0x39')]));_0x1e3f75[_0x6c74('0x38')]=_0x1e3f75[_0x6c74('0x38')][_0x6c74('0x3a')]?_0x1e3f75[_0x6c74('0x38')]:_0x36247f['model'];_0x1e3f75[_0x6c74('0x3d')]=qs[_0x6c74('0x3e')](_0x469671[_0x6c74('0x34')][_0x6c74('0x3e')]);_0x1e3f75[_0x6c74('0x3f')]=qs['filters'](_[_0x6c74('0x40')](_0x469671[_0x6c74('0x34')],_0x36247f['filters']));if(_0x469671[_0x6c74('0x34')][_0x6c74('0x41')]){_0x1e3f75[_0x6c74('0x3f')]=_[_0x6c74('0x42')](_0x1e3f75[_0x6c74('0x3f')],{'$or':_[_0x6c74('0x33')](_0x1e3f75[_0x6c74('0x38')],function(_0xd409a8){var _0x2dc0d6={};_0x2dc0d6[_0xd409a8]={'$like':'%'+_0x469671[_0x6c74('0x34')][_0x6c74('0x41')]+'%'};return _0x2dc0d6;})});}_0x1e3f75=_['merge']({},_0x1e3f75,_0x469671[_0x6c74('0x4a')]);return _0x223d26[_0x6c74('0x54')](_0x1e3f75);}})[_0x6c74('0x29')](function(_0xe326e7){if(_0xe326e7){_0x8cfcc1=_0xe326e7[_0x6c74('0x3a')];if(!_0x469671['query'][_0x6c74('0x3b')](_0x6c74('0x3c'))){_0x1e3f75['limit']=qs[_0x6c74('0x26')](_0x469671[_0x6c74('0x34')][_0x6c74('0x26')]);_0x1e3f75['offset']=qs['offset'](_0x469671['query'][_0x6c74('0x25')]);}return _0x223d26[_0x6c74('0x54')](_0x1e3f75);}})['then'](function(_0x489f40){if(_0x489f40){return _0x489f40?{'count':_0x8cfcc1,'rows':_0x489f40}:null;}})['then'](respondWithResult(_0x394b5e,null))['catch'](handleError(_0x394b5e,null));};exports['setTags']=function(_0x5b57c3,_0x4a7810,_0x14f71e){if(_0x5b57c3[_0x6c74('0x4d')]['id']){delete _0x5b57c3[_0x6c74('0x4d')]['id'];}return db[_0x6c74('0x2e')][_0x6c74('0x50')]({'where':{'id':_0x5b57c3['params']['id']}})[_0x6c74('0x29')](handleEntityNotFound(_0x4a7810,null))[_0x6c74('0x29')](function(_0x563189){if(_0x563189){return _0x563189[_0x6c74('0x55')](_0x5b57c3['body'][_0x6c74('0x56')]||[]);}return null;})[_0x6c74('0x29')](respondWithResult(_0x4a7810,null))[_0x6c74('0x47')](handleError(_0x4a7810,null));}; \ No newline at end of file +var _0x39d9=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','update','body','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x39d9,0x17f));var _0x939d=function(_0x542e36,_0x1d5513){_0x542e36=_0x542e36-0x0;var _0x5796b3=_0x39d9[_0x542e36];return _0x5796b3;};'use strict';var pdf=require(_0x939d('0x0'));var emlformat=require(_0x939d('0x1'));var rimraf=require(_0x939d('0x2'));var zipdir=require(_0x939d('0x3'));var jsonpatch=require(_0x939d('0x4'));var rp=require(_0x939d('0x5'));var moment=require(_0x939d('0x6'));var BPromise=require(_0x939d('0x7'));var Mustache=require('mustache');var util=require(_0x939d('0x8'));var path=require(_0x939d('0x9'));var sox=require(_0x939d('0xa'));var csv=require('to-csv');var ejs=require(_0x939d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x939d('0xc'));var crypto=require(_0x939d('0xd'));var jsforce=require(_0x939d('0xe'));var deskjs=require(_0x939d('0xf'));var toCsv=require(_0x939d('0x10'));var querystring=require(_0x939d('0x11'));var Papa=require(_0x939d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x939d('0x13'));var as=require(_0x939d('0x14'));var hardwareService=require(_0x939d('0x15'));var logger=require(_0x939d('0x16'))(_0x939d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x939d('0x18'));var client=jayson[_0x939d('0x19')][_0x939d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x51f46d,_0x32a37f,_0x474de8){if(_0x474de8){var _0x4d9721=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d9721[_0x939d('0x1b')](_0x32a37f)){return _0x51f46d;}else{throw new db[(_0x939d('0x1c'))][(_0x939d('0x1d'))](_0x939d('0x1e'));}}else{return _0x51f46d;}}function respondWithRpcPromise(_0x44aa1b,_0x1b9d52,_0x4bd0ab,_0x5539a7){return new BPromise(function(_0x40e252,_0x4f97e1){var _0x3577db=_0x5539a7||client;return _0x3577db[_0x939d('0x1f')](_0x44aa1b,_0x4bd0ab)['then'](function(_0x6bea18){logger[_0x939d('0x20')](_0x939d('0x21'),_0x1b9d52,'request\x20sent');logger[_0x939d('0x22')](_0x939d('0x23'),_0x1b9d52,_0x939d('0x24'),JSON[_0x939d('0x25')](_0x6bea18));if(_0x6bea18[_0x939d('0x26')]){if(_0x6bea18[_0x939d('0x26')]['code']===0x1f4){logger['error'](_0x939d('0x21'),_0x1b9d52,_0x6bea18['error'][_0x939d('0x27')]);return _0x4f97e1(_0x6bea18[_0x939d('0x26')][_0x939d('0x27')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1b9d52,_0x6bea18[_0x939d('0x26')]['message']);return _0x40e252(_0x6bea18['error']['message']);}else{logger[_0x939d('0x20')](_0x939d('0x21'),_0x1b9d52,_0x939d('0x24'));_0x40e252(_0x6bea18[_0x939d('0x28')]['message']);}})[_0x939d('0x29')](function(_0x48c73d){logger['error'](_0x939d('0x21'),_0x1b9d52,_0x48c73d);_0x4f97e1(_0x48c73d);});});}function respondWithStatusCode(_0x59c200,_0x5a00ef){_0x5a00ef=_0x5a00ef||0xcc;return function(_0x2bc482){if(_0x2bc482){return _0x59c200[_0x939d('0x2a')](_0x5a00ef);}return _0x59c200[_0x939d('0x2b')](_0x5a00ef)[_0x939d('0x2c')]();};}function respondWithResult(_0x4ab0e6,_0x435bb3){_0x435bb3=_0x435bb3||0xc8;return function(_0x5b75e9){if(_0x5b75e9){return _0x4ab0e6[_0x939d('0x2b')](_0x435bb3)[_0x939d('0x2d')](_0x5b75e9);}};}function respondWithFilteredResult(_0x123cda,_0x371359){return function(_0x244097){if(_0x244097){var _0x31a8bb=_0x244097[_0x939d('0x2e')],_0x584696=_0x371359[_0x939d('0x2f')],_0x150543=_0x371359[_0x939d('0x2f')]+_0x371359['limit'],_0x203f07;if(_0x150543>=_0x31a8bb){_0x150543=_0x31a8bb;_0x203f07=0xc8;}else{_0x203f07=0xce;}_0x123cda['status'](_0x203f07);return _0x123cda[_0x939d('0x30')](_0x939d('0x31'),_0x584696+'-'+_0x150543+'/'+_0x31a8bb)[_0x939d('0x2d')](_0x244097);}return null;};}function patchUpdates(_0x3c5b33){return function(_0x7258d8){try{jsonpatch[_0x939d('0x32')](_0x7258d8,_0x3c5b33,!![]);}catch(_0x5e29b6){return BPromise[_0x939d('0x33')](_0x5e29b6);}return _0x7258d8['save']();};}function saveUpdates(_0x2f1028,_0x15fd58){return function(_0x4fa881){if(_0x4fa881){return _0x4fa881['update'](_0x2f1028)[_0x939d('0x34')](function(_0x52f385){return _0x52f385;});}return null;};}function removeEntity(_0x52f421,_0x8b0314){return function(_0x58ec3e){if(_0x58ec3e){return _0x58ec3e[_0x939d('0x35')]()[_0x939d('0x34')](function(){_0x52f421[_0x939d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508299,_0x443f71){return function(_0x3d513b){if(!_0x3d513b){_0x508299[_0x939d('0x2a')](0x194);}return _0x3d513b;};}function handleError(_0x4adb16,_0x56ea6e){_0x56ea6e=_0x56ea6e||0x1f4;return function(_0x1bdc68){logger['error'](_0x1bdc68[_0x939d('0x36')]);if(_0x1bdc68[_0x939d('0x37')]){delete _0x1bdc68[_0x939d('0x37')];}_0x4adb16['status'](_0x56ea6e)[_0x939d('0x38')](_0x1bdc68);};}exports[_0x939d('0x39')]=function(_0x1cda25,_0x5b1ad2){var _0x3b81a4={},_0x548504={},_0x493522={'count':0x0,'rows':[]};var _0x1938ff=_[_0x939d('0x3a')](db[_0x939d('0x3b')][_0x939d('0x3c')],function(_0x12b3ea){return{'name':_0x12b3ea['fieldName'],'type':_0x12b3ea[_0x939d('0x3d')]['key']};});_0x548504[_0x939d('0x3e')]=_['map'](_0x1938ff,_0x939d('0x37'));_0x548504[_0x939d('0x3f')]=_[_0x939d('0x40')](_0x1cda25[_0x939d('0x3f')]);_0x548504[_0x939d('0x41')]=_[_0x939d('0x42')](_0x548504[_0x939d('0x3e')],_0x548504[_0x939d('0x3f')]);_0x3b81a4[_0x939d('0x43')]=_[_0x939d('0x42')](_0x548504['model'],qs[_0x939d('0x44')](_0x1cda25[_0x939d('0x3f')][_0x939d('0x44')]));_0x3b81a4[_0x939d('0x43')]=_0x3b81a4[_0x939d('0x43')][_0x939d('0x45')]?_0x3b81a4[_0x939d('0x43')]:_0x548504[_0x939d('0x3e')];if(!_0x1cda25[_0x939d('0x3f')][_0x939d('0x46')](_0x939d('0x47'))){_0x3b81a4['limit']=qs[_0x939d('0x48')](_0x1cda25[_0x939d('0x3f')][_0x939d('0x48')]);_0x3b81a4[_0x939d('0x2f')]=qs[_0x939d('0x2f')](_0x1cda25['query']['offset']);}_0x3b81a4['order']=qs[_0x939d('0x49')](_0x1cda25[_0x939d('0x3f')][_0x939d('0x49')]);_0x3b81a4[_0x939d('0x4a')]=qs[_0x939d('0x41')](_[_0x939d('0x4b')](_0x1cda25[_0x939d('0x3f')],_0x548504['filters']),_0x1938ff);if(_0x1cda25[_0x939d('0x3f')][_0x939d('0x4c')]){_0x3b81a4[_0x939d('0x4a')]=_[_0x939d('0x4d')](_0x3b81a4[_0x939d('0x4a')],{'$or':_[_0x939d('0x3a')](_0x1938ff,function(_0x3ce8d3){if(_0x3ce8d3[_0x939d('0x3d')]!==_0x939d('0x4e')){var _0x449559={};_0x449559[_0x3ce8d3[_0x939d('0x37')]]={'$like':'%'+_0x1cda25[_0x939d('0x3f')][_0x939d('0x4c')]+'%'};return _0x449559;}})});}_0x3b81a4=_[_0x939d('0x4d')]({},_0x3b81a4,_0x1cda25[_0x939d('0x4f')]);var _0x2feb51={'where':_0x3b81a4[_0x939d('0x4a')]};return db[_0x939d('0x3b')]['count'](_0x2feb51)[_0x939d('0x34')](function(_0x57aa00){_0x493522[_0x939d('0x2e')]=_0x57aa00;if(_0x1cda25[_0x939d('0x3f')][_0x939d('0x50')]){_0x3b81a4[_0x939d('0x51')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x939d('0x52')](_0x3b81a4);})[_0x939d('0x34')](function(_0x354a54){_0x493522[_0x939d('0x53')]=_0x354a54;return _0x493522;})[_0x939d('0x34')](respondWithFilteredResult(_0x5b1ad2,_0x3b81a4))['catch'](handleError(_0x5b1ad2,null));};exports[_0x939d('0x54')]=function(_0x3f7224,_0xc9f41){var _0x54276b={'raw':![],'where':{'id':_0x3f7224[_0x939d('0x55')]['id']}},_0x5981a1={};_0x5981a1[_0x939d('0x3e')]=_[_0x939d('0x40')](db[_0x939d('0x3b')][_0x939d('0x3c')]);_0x5981a1['query']=_[_0x939d('0x40')](_0x3f7224[_0x939d('0x3f')]);_0x5981a1[_0x939d('0x41')]=_[_0x939d('0x42')](_0x5981a1[_0x939d('0x3e')],_0x5981a1['query']);_0x54276b[_0x939d('0x43')]=_[_0x939d('0x42')](_0x5981a1[_0x939d('0x3e')],qs[_0x939d('0x44')](_0x3f7224[_0x939d('0x3f')][_0x939d('0x44')]));_0x54276b[_0x939d('0x43')]=_0x54276b[_0x939d('0x43')][_0x939d('0x45')]?_0x54276b[_0x939d('0x43')]:_0x5981a1[_0x939d('0x3e')];if(_0x3f7224[_0x939d('0x3f')][_0x939d('0x50')]){_0x54276b[_0x939d('0x51')]=[{'all':!![]}];}_0x54276b=_[_0x939d('0x4d')]({},_0x54276b,_0x3f7224['options']);return db['FreshdeskConfiguration'][_0x939d('0x56')](_0x54276b)[_0x939d('0x34')](handleEntityNotFound(_0xc9f41,null))[_0x939d('0x34')](respondWithResult(_0xc9f41,null))[_0x939d('0x29')](handleError(_0xc9f41,null));};exports['create']=function(_0x1b3a10,_0x5dcb8d){return db[_0x939d('0x3b')][_0x939d('0x57')](_0x1b3a10['body'],{})[_0x939d('0x34')](respondWithResult(_0x5dcb8d,0xc9))[_0x939d('0x29')](handleError(_0x5dcb8d,null));};exports[_0x939d('0x58')]=function(_0x837fa7,_0x1a46cc){if(_0x837fa7[_0x939d('0x59')]['id']){delete _0x837fa7[_0x939d('0x59')]['id'];}return db[_0x939d('0x3b')][_0x939d('0x56')]({'where':{'id':_0x837fa7['params']['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x1a46cc,null))['then'](saveUpdates(_0x837fa7['body'],null))[_0x939d('0x34')](respondWithResult(_0x1a46cc,null))[_0x939d('0x29')](handleError(_0x1a46cc,null));};exports['destroy']=function(_0x46b6af,_0x22a415){return db[_0x939d('0x3b')][_0x939d('0x56')]({'where':{'id':_0x46b6af[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x22a415,null))[_0x939d('0x34')](removeEntity(_0x22a415,null))['catch'](handleError(_0x22a415,null));};exports[_0x939d('0x5a')]=function(_0x3b7aa9,_0x5cbb34,_0x48c3d0){var _0x3f6025={};var _0x4e23b1={};var _0x396a84;var _0x111d96;return db[_0x939d('0x3b')]['findOne']({'where':{'id':_0x3b7aa9[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x5cbb34,null))[_0x939d('0x34')](function(_0x4ca1e4){if(_0x4ca1e4){_0x396a84=_0x4ca1e4;_0x4e23b1[_0x939d('0x3e')]=_[_0x939d('0x40')](db[_0x939d('0x5b')][_0x939d('0x3c')]);_0x4e23b1[_0x939d('0x3f')]=_[_0x939d('0x40')](_0x3b7aa9[_0x939d('0x3f')]);_0x4e23b1[_0x939d('0x41')]=_[_0x939d('0x42')](_0x4e23b1['model'],_0x4e23b1[_0x939d('0x3f')]);_0x3f6025[_0x939d('0x43')]=_['intersection'](_0x4e23b1[_0x939d('0x3e')],qs[_0x939d('0x44')](_0x3b7aa9[_0x939d('0x3f')][_0x939d('0x44')]));_0x3f6025['attributes']=_0x3f6025[_0x939d('0x43')][_0x939d('0x45')]?_0x3f6025[_0x939d('0x43')]:_0x4e23b1['model'];_0x3f6025[_0x939d('0x5c')]=qs[_0x939d('0x49')](_0x3b7aa9['query'][_0x939d('0x49')]);_0x3f6025[_0x939d('0x4a')]=qs[_0x939d('0x41')](_[_0x939d('0x4b')](_0x3b7aa9['query'],_0x4e23b1[_0x939d('0x41')]));if(_0x3b7aa9[_0x939d('0x3f')][_0x939d('0x4c')]){_0x3f6025[_0x939d('0x4a')]=_[_0x939d('0x4d')](_0x3f6025['where'],{'$or':_[_0x939d('0x3a')](_0x3f6025['attributes'],function(_0x2ddbe8){var _0x383c77={};_0x383c77[_0x2ddbe8]={'$like':'%'+_0x3b7aa9[_0x939d('0x3f')][_0x939d('0x4c')]+'%'};return _0x383c77;})});}_0x3f6025=_[_0x939d('0x4d')]({},_0x3f6025,_0x3b7aa9[_0x939d('0x4f')]);return _0x396a84[_0x939d('0x5a')](_0x3f6025);}})[_0x939d('0x34')](function(_0x201220){if(_0x201220){_0x111d96=_0x201220[_0x939d('0x45')];if(!_0x3b7aa9[_0x939d('0x3f')]['hasOwnProperty'](_0x939d('0x47'))){_0x3f6025[_0x939d('0x48')]=qs[_0x939d('0x48')](_0x3b7aa9[_0x939d('0x3f')][_0x939d('0x48')]);_0x3f6025[_0x939d('0x2f')]=qs[_0x939d('0x2f')](_0x3b7aa9[_0x939d('0x3f')]['offset']);}return _0x396a84[_0x939d('0x5a')](_0x3f6025);}})[_0x939d('0x34')](function(_0x393822){if(_0x393822){return _0x393822?{'count':_0x111d96,'rows':_0x393822}:null;}})[_0x939d('0x34')](respondWithResult(_0x5cbb34,null))[_0x939d('0x29')](handleError(_0x5cbb34,null));};exports[_0x939d('0x5d')]=function(_0x20f3f4,_0x4ebccf,_0x12d6a6){var _0x4fa7fb={};var _0x23b8fa={};var _0x34427d;var _0x119d31;return db['FreshdeskConfiguration'][_0x939d('0x5e')]({'where':{'id':_0x20f3f4[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x4ebccf,null))[_0x939d('0x34')](function(_0x21e169){if(_0x21e169){_0x34427d=_0x21e169;_0x23b8fa[_0x939d('0x3e')]=_[_0x939d('0x40')](db[_0x939d('0x5b')][_0x939d('0x3c')]);_0x23b8fa[_0x939d('0x3f')]=_[_0x939d('0x40')](_0x20f3f4['query']);_0x23b8fa[_0x939d('0x41')]=_[_0x939d('0x42')](_0x23b8fa[_0x939d('0x3e')],_0x23b8fa['query']);_0x4fa7fb['attributes']=_[_0x939d('0x42')](_0x23b8fa['model'],qs['fields'](_0x20f3f4[_0x939d('0x3f')][_0x939d('0x44')]));_0x4fa7fb[_0x939d('0x43')]=_0x4fa7fb['attributes'][_0x939d('0x45')]?_0x4fa7fb[_0x939d('0x43')]:_0x23b8fa[_0x939d('0x3e')];_0x4fa7fb['order']=qs[_0x939d('0x49')](_0x20f3f4[_0x939d('0x3f')]['sort']);_0x4fa7fb[_0x939d('0x4a')]=qs[_0x939d('0x41')](_['pick'](_0x20f3f4[_0x939d('0x3f')],_0x23b8fa[_0x939d('0x41')]));if(_0x20f3f4[_0x939d('0x3f')][_0x939d('0x4c')]){_0x4fa7fb[_0x939d('0x4a')]=_[_0x939d('0x4d')](_0x4fa7fb[_0x939d('0x4a')],{'$or':_[_0x939d('0x3a')](_0x4fa7fb[_0x939d('0x43')],function(_0x341e61){var _0x244e31={};_0x244e31[_0x341e61]={'$like':'%'+_0x20f3f4[_0x939d('0x3f')][_0x939d('0x4c')]+'%'};return _0x244e31;})});}_0x4fa7fb=_[_0x939d('0x4d')]({},_0x4fa7fb,_0x20f3f4[_0x939d('0x4f')]);return _0x34427d[_0x939d('0x5d')](_0x4fa7fb);}})[_0x939d('0x34')](function(_0x263624){if(_0x263624){_0x119d31=_0x263624[_0x939d('0x45')];if(!_0x20f3f4[_0x939d('0x3f')][_0x939d('0x46')](_0x939d('0x47'))){_0x4fa7fb[_0x939d('0x48')]=qs[_0x939d('0x48')](_0x20f3f4[_0x939d('0x3f')]['limit']);_0x4fa7fb[_0x939d('0x2f')]=qs[_0x939d('0x2f')](_0x20f3f4[_0x939d('0x3f')][_0x939d('0x2f')]);}return _0x34427d['getSubjects'](_0x4fa7fb);}})[_0x939d('0x34')](function(_0xb35ce7){if(_0xb35ce7){return _0xb35ce7?{'count':_0x119d31,'rows':_0xb35ce7}:null;}})[_0x939d('0x34')](respondWithResult(_0x4ebccf,null))[_0x939d('0x29')](handleError(_0x4ebccf,null));};exports[_0x939d('0x5f')]=function(_0x3eaa48,_0x1ac468,_0x286dc7){var _0x252133={};var _0x1cfbfe={};var _0xc256ac;var _0x4e3df5;return db[_0x939d('0x3b')][_0x939d('0x5e')]({'where':{'id':_0x3eaa48[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x1ac468,null))[_0x939d('0x34')](function(_0x56cf63){if(_0x56cf63){_0xc256ac=_0x56cf63;_0x1cfbfe[_0x939d('0x3e')]=_[_0x939d('0x40')](db[_0x939d('0x5b')]['rawAttributes']);_0x1cfbfe[_0x939d('0x3f')]=_[_0x939d('0x40')](_0x3eaa48['query']);_0x1cfbfe[_0x939d('0x41')]=_[_0x939d('0x42')](_0x1cfbfe[_0x939d('0x3e')],_0x1cfbfe[_0x939d('0x3f')]);_0x252133[_0x939d('0x43')]=_[_0x939d('0x42')](_0x1cfbfe[_0x939d('0x3e')],qs[_0x939d('0x44')](_0x3eaa48[_0x939d('0x3f')]['fields']));_0x252133[_0x939d('0x43')]=_0x252133[_0x939d('0x43')]['length']?_0x252133[_0x939d('0x43')]:_0x1cfbfe[_0x939d('0x3e')];_0x252133[_0x939d('0x5c')]=qs[_0x939d('0x49')](_0x3eaa48['query'][_0x939d('0x49')]);_0x252133[_0x939d('0x4a')]=qs['filters'](_[_0x939d('0x4b')](_0x3eaa48[_0x939d('0x3f')],_0x1cfbfe[_0x939d('0x41')]));if(_0x3eaa48[_0x939d('0x3f')][_0x939d('0x4c')]){_0x252133[_0x939d('0x4a')]=_[_0x939d('0x4d')](_0x252133['where'],{'$or':_[_0x939d('0x3a')](_0x252133[_0x939d('0x43')],function(_0x2b0e90){var _0x27afdd={};_0x27afdd[_0x2b0e90]={'$like':'%'+_0x3eaa48[_0x939d('0x3f')][_0x939d('0x4c')]+'%'};return _0x27afdd;})});}_0x252133=_['merge']({},_0x252133,_0x3eaa48[_0x939d('0x4f')]);return _0xc256ac[_0x939d('0x5f')](_0x252133);}})['then'](function(_0x277781){if(_0x277781){_0x4e3df5=_0x277781[_0x939d('0x45')];if(!_0x3eaa48[_0x939d('0x3f')][_0x939d('0x46')](_0x939d('0x47'))){_0x252133[_0x939d('0x48')]=qs[_0x939d('0x48')](_0x3eaa48[_0x939d('0x3f')][_0x939d('0x48')]);_0x252133[_0x939d('0x2f')]=qs[_0x939d('0x2f')](_0x3eaa48[_0x939d('0x3f')][_0x939d('0x2f')]);}return _0xc256ac[_0x939d('0x5f')](_0x252133);}})[_0x939d('0x34')](function(_0x4083f8){if(_0x4083f8){return _0x4083f8?{'count':_0x4e3df5,'rows':_0x4083f8}:null;}})[_0x939d('0x34')](respondWithResult(_0x1ac468,null))[_0x939d('0x29')](handleError(_0x1ac468,null));};exports[_0x939d('0x60')]=function(_0x3ee9cd,_0x2f657c,_0xd66a48){var _0x34d573={};var _0x40e222={};var _0x1aead5;var _0x2dbb48;return db[_0x939d('0x3b')][_0x939d('0x5e')]({'where':{'id':_0x3ee9cd[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x2f657c,null))[_0x939d('0x34')](function(_0x3894cf){if(_0x3894cf){_0x1aead5=_0x3894cf;_0x40e222[_0x939d('0x3e')]=_[_0x939d('0x40')](db['Tag'][_0x939d('0x3c')]);_0x40e222['query']=_[_0x939d('0x40')](_0x3ee9cd[_0x939d('0x3f')]);_0x40e222[_0x939d('0x41')]=_[_0x939d('0x42')](_0x40e222['model'],_0x40e222[_0x939d('0x3f')]);_0x34d573['attributes']=_[_0x939d('0x42')](_0x40e222['model'],qs[_0x939d('0x44')](_0x3ee9cd[_0x939d('0x3f')][_0x939d('0x44')]));_0x34d573[_0x939d('0x43')]=_0x34d573[_0x939d('0x43')][_0x939d('0x45')]?_0x34d573[_0x939d('0x43')]:_0x40e222[_0x939d('0x3e')];_0x34d573['order']=qs['sort'](_0x3ee9cd[_0x939d('0x3f')]['sort']);_0x34d573[_0x939d('0x4a')]=qs[_0x939d('0x41')](_[_0x939d('0x4b')](_0x3ee9cd['query'],_0x40e222['filters']));if(_0x3ee9cd[_0x939d('0x3f')][_0x939d('0x4c')]){_0x34d573['where']=_[_0x939d('0x4d')](_0x34d573[_0x939d('0x4a')],{'$or':_[_0x939d('0x3a')](_0x34d573[_0x939d('0x43')],function(_0x526338){var _0x468b09={};_0x468b09[_0x526338]={'$like':'%'+_0x3ee9cd[_0x939d('0x3f')][_0x939d('0x4c')]+'%'};return _0x468b09;})});}_0x34d573=_[_0x939d('0x4d')]({},_0x34d573,_0x3ee9cd[_0x939d('0x4f')]);return _0x1aead5[_0x939d('0x60')](_0x34d573);}})[_0x939d('0x34')](function(_0xd721fb){if(_0xd721fb){_0x2dbb48=_0xd721fb['length'];if(!_0x3ee9cd[_0x939d('0x3f')][_0x939d('0x46')](_0x939d('0x47'))){_0x34d573[_0x939d('0x48')]=qs[_0x939d('0x48')](_0x3ee9cd[_0x939d('0x3f')]['limit']);_0x34d573[_0x939d('0x2f')]=qs[_0x939d('0x2f')](_0x3ee9cd['query'][_0x939d('0x2f')]);}return _0x1aead5[_0x939d('0x60')](_0x34d573);}})['then'](function(_0x277a75){if(_0x277a75){return _0x277a75?{'count':_0x2dbb48,'rows':_0x277a75}:null;}})[_0x939d('0x34')](respondWithResult(_0x2f657c,null))[_0x939d('0x29')](handleError(_0x2f657c,null));};exports[_0x939d('0x61')]=function(_0x393bcc,_0x4e386f,_0x2ffdce){if(_0x393bcc[_0x939d('0x59')]['id']){delete _0x393bcc['body']['id'];}return db[_0x939d('0x3b')][_0x939d('0x5e')]({'where':{'id':_0x393bcc[_0x939d('0x55')]['id']}})[_0x939d('0x34')](handleEntityNotFound(_0x4e386f,null))[_0x939d('0x34')](function(_0x44e71f){if(_0x44e71f){return _0x44e71f[_0x939d('0x61')](_0x393bcc[_0x939d('0x59')][_0x939d('0x62')]||[]);}return null;})[_0x939d('0x34')](respondWithResult(_0x4e386f,null))[_0x939d('0x29')](handleError(_0x4e386f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d684f68..e92ef0f 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 _0x9957=['exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6aa7,0x178));var _0x76aa=function(_0x16e5f0,_0x5c1ce9){_0x16e5f0=_0x16e5f0-0x0;var _0x49c09b=_0x6aa7[_0x16e5f0];return _0x49c09b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('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 78a8669..81f1205 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 _0xe1a3=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/utils','jayson/promise','client'];(function(_0x40fd2b,_0x365d8b){var _0x114adc=function(_0x34ed35){while(--_0x34ed35){_0x40fd2b['push'](_0x40fd2b['shift']());}};_0x114adc(++_0x365d8b);}(_0xe1a3,0x19b));var _0x3e1a=function(_0x5ab34a,_0x2547c4){_0x5ab34a=_0x5ab34a-0x0;var _0x4a3d81=_0xe1a3[_0x5ab34a];return _0x4a3d81;};'use strict';var _=require(_0x3e1a('0x0'));var util=require(_0x3e1a('0x1'));var moment=require('moment');var BPromise=require(_0x3e1a('0x2'));var rs=require(_0x3e1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e1a('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3e1a('0x5'));var client=jayson[_0x3e1a('0x6')][_0x3e1a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21b8a0,_0x1fa13b,_0x29513c){return new BPromise(function(_0x340af1,_0x211215){return client[_0x3e1a('0x8')](_0x21b8a0,_0x29513c)[_0x3e1a('0x9')](function(_0x3c5ca8){logger[_0x3e1a('0xa')](_0x3e1a('0xb'),_0x1fa13b,_0x3e1a('0xc'));logger[_0x3e1a('0xd')](_0x3e1a('0xe'),_0x1fa13b,_0x3e1a('0xc'),JSON['stringify'](_0x3c5ca8));if(_0x3c5ca8[_0x3e1a('0xf')]){if(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x10')]===0x1f4){logger['error'](_0x3e1a('0xb'),_0x1fa13b,_0x3c5ca8[_0x3e1a('0xf')]['message']);return _0x211215(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);}logger[_0x3e1a('0xf')](_0x3e1a('0xb'),_0x1fa13b,_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);return _0x340af1(_0x3c5ca8[_0x3e1a('0xf')][_0x3e1a('0x11')]);}else{logger[_0x3e1a('0xa')](_0x3e1a('0xb'),_0x1fa13b,_0x3e1a('0xc'));_0x340af1(_0x3c5ca8['result']['message']);}})[_0x3e1a('0x12')](function(_0x3ef48b){logger[_0x3e1a('0xf')](_0x3e1a('0xb'),_0x1fa13b,_0x3ef48b);_0x211215(_0x3ef48b);});});} \ No newline at end of file +var _0xc7ff=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x9dca4c,_0xc09e49){var _0x4c8506=function(_0x8305bf){while(--_0x8305bf){_0x9dca4c['push'](_0x9dca4c['shift']());}};_0x4c8506(++_0xc09e49);}(_0xc7ff,0x95));var _0xfc7f=function(_0x557741,_0x43d009){_0x557741=_0x557741-0x0;var _0x4cd544=_0xc7ff[_0x557741];return _0x4cd544;};'use strict';var _=require('lodash');var util=require(_0xfc7f('0x0'));var moment=require(_0xfc7f('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc7f('0x2'));var fs=require('fs');var Redis=require(_0xfc7f('0x3'));var db=require(_0xfc7f('0x4'))['db'];var utils=require(_0xfc7f('0x5'));var logger=require(_0xfc7f('0x6'))(_0xfc7f('0x7'));var config=require(_0xfc7f('0x8'));var jayson=require(_0xfc7f('0x9'));var client=jayson[_0xfc7f('0xa')][_0xfc7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8dd56e,_0xdb810c,_0x5b3873){return new BPromise(function(_0x3e0841,_0x35495d){return client[_0xfc7f('0xc')](_0x8dd56e,_0x5b3873)[_0xfc7f('0xd')](function(_0x57b279){logger[_0xfc7f('0xe')](_0xfc7f('0xf'),_0xdb810c,_0xfc7f('0x10'));logger['debug'](_0xfc7f('0x11'),_0xdb810c,_0xfc7f('0x10'),JSON[_0xfc7f('0x12')](_0x57b279));if(_0x57b279[_0xfc7f('0x13')]){if(_0x57b279[_0xfc7f('0x13')]['code']===0x1f4){logger['error'](_0xfc7f('0xf'),_0xdb810c,_0x57b279[_0xfc7f('0x13')][_0xfc7f('0x14')]);return _0x35495d(_0x57b279[_0xfc7f('0x13')][_0xfc7f('0x14')]);}logger[_0xfc7f('0x13')](_0xfc7f('0xf'),_0xdb810c,_0x57b279['error']['message']);return _0x3e0841(_0x57b279['error'][_0xfc7f('0x14')]);}else{logger['info'](_0xfc7f('0xf'),_0xdb810c,'request\x20sent');_0x3e0841(_0x57b279[_0xfc7f('0x15')][_0xfc7f('0x14')]);}})[_0xfc7f('0x16')](function(_0x339647){logger[_0xfc7f('0x13')](_0xfc7f('0xf'),_0xdb810c,_0x339647);_0x35495d(_0x339647);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 42ab4fc..d65cce2 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xcb91[_0x5ae8f7];return _0x54c636;};'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 +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xedd9,0xfc));var _0x9edd=function(_0x36f11a,_0x59db42){_0x36f11a=_0x36f11a-0x0;var _0x5f3e09=_0xedd9[_0x36f11a];return _0x5f3e09;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 457b918..891be5c 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x668b=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x572989,_0x4f8cb4){var _0x4760e3=function(_0x5067ae){while(--_0x5067ae){_0x572989['push'](_0x572989['shift']());}};_0x4760e3(++_0x4f8cb4);}(_0x668b,0x8d));var _0xb668=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x668b[_0x2d8434];return _0x26b9e4;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'type':{'type':Sequelize[_0xb668('0x2')](_0xb668('0x3'),_0xb668('0x4'),_0xb668('0x5'),_0xb668('0x6')),'defaultValue':_0xb668('0x3')},'content':{'type':Sequelize[_0xb668('0x7')]},'key':{'type':Sequelize[_0xb668('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb668('0x3'),_0xb668('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb668('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb668('0x7')]},'customField':{'type':Sequelize[_0xb668('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb668('0x7')]}}; \ No newline at end of file +var _0x4a25=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x31377e,_0x4c41e7){var _0x3c2ae2=function(_0x52b3d0){while(--_0x52b3d0){_0x31377e['push'](_0x31377e['shift']());}};_0x3c2ae2(++_0x4c41e7);}(_0x4a25,0x1d4));var _0x54a2=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x4a25[_0x516ffb];return _0x319667;};'use strict';var Sequelize=require(_0x54a2('0x0'));module['exports']={'type':{'type':Sequelize[_0x54a2('0x1')]('string',_0x54a2('0x2'),_0x54a2('0x3'),_0x54a2('0x4')),'defaultValue':_0x54a2('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x54a2('0x6')]},'keyType':{'type':Sequelize[_0x54a2('0x1')](_0x54a2('0x5'),_0x54a2('0x2'),_0x54a2('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x54a2('0x6')]},'nameField':{'type':Sequelize[_0x54a2('0x6')]},'customField':{'type':Sequelize[_0x54a2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e4b8d5b..fc995b9 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 _0x9946=['type','key','model','map','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','fieldName'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9946,0xb0));var _0x6994=function(_0x456322,_0x16285b){_0x456322=_0x456322-0x0;var _0x3a0313=_0x9946[_0x456322];return _0x3a0313;};'use strict';var pdf=require(_0x6994('0x0'));var emlformat=require(_0x6994('0x1'));var rimraf=require(_0x6994('0x2'));var zipdir=require(_0x6994('0x3'));var jsonpatch=require(_0x6994('0x4'));var rp=require(_0x6994('0x5'));var moment=require(_0x6994('0x6'));var BPromise=require(_0x6994('0x7'));var Mustache=require(_0x6994('0x8'));var util=require(_0x6994('0x9'));var path=require(_0x6994('0xa'));var sox=require('sox');var csv=require(_0x6994('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6994('0xc'));var squel=require('squel');var crypto=require(_0x6994('0xd'));var jsforce=require(_0x6994('0xe'));var deskjs=require(_0x6994('0xf'));var toCsv=require(_0x6994('0xb'));var querystring=require(_0x6994('0x10'));var Papa=require('papaparse');var Redis=require(_0x6994('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6994('0x12'));var as=require(_0x6994('0x13'));var hardwareService=require(_0x6994('0x14'));var logger=require(_0x6994('0x15'))(_0x6994('0x16'));var utils=require(_0x6994('0x17'));var config=require('../../config/environment');var db=require(_0x6994('0x18'))['db'];function respondWithStatusCode(_0x5a1650,_0x54cc22){_0x54cc22=_0x54cc22||0xcc;return function(_0x2d03d2){if(_0x2d03d2){return _0x5a1650[_0x6994('0x19')](_0x54cc22);}return _0x5a1650['status'](_0x54cc22)[_0x6994('0x1a')]();};}function respondWithResult(_0x41a2be,_0x790d6f){_0x790d6f=_0x790d6f||0xc8;return function(_0x40859f){if(_0x40859f){return _0x41a2be['status'](_0x790d6f)[_0x6994('0x1b')](_0x40859f);}};}function respondWithFilteredResult(_0x101a13,_0x337c4e){return function(_0x1c5138){if(_0x1c5138){var _0x370c0e=_0x1c5138[_0x6994('0x1c')],_0x2b9bb7=_0x337c4e['offset'],_0x316c58=_0x337c4e[_0x6994('0x1d')]+_0x337c4e[_0x6994('0x1e')],_0x4183b1;if(_0x316c58>=_0x370c0e){_0x316c58=_0x370c0e;_0x4183b1=0xc8;}else{_0x4183b1=0xce;}_0x101a13[_0x6994('0x1f')](_0x4183b1);return _0x101a13[_0x6994('0x20')]('Content-Range',_0x2b9bb7+'-'+_0x316c58+'/'+_0x370c0e)[_0x6994('0x1b')](_0x1c5138);}return null;};}function patchUpdates(_0x38b3f7){return function(_0x336464){try{jsonpatch[_0x6994('0x21')](_0x336464,_0x38b3f7,!![]);}catch(_0x218d91){return BPromise[_0x6994('0x22')](_0x218d91);}return _0x336464[_0x6994('0x23')]();};}function saveUpdates(_0x580757,_0x5c454c){return function(_0x68255e){if(_0x68255e){return _0x68255e[_0x6994('0x24')](_0x580757)[_0x6994('0x25')](function(_0x31705f){return _0x31705f;});}return null;};}function removeEntity(_0x20c943,_0xf6c422){return function(_0x5f24dd){if(_0x5f24dd){return _0x5f24dd[_0x6994('0x26')]()[_0x6994('0x25')](function(){_0x20c943[_0x6994('0x1f')](0xcc)[_0x6994('0x1a')]();});}};}function handleEntityNotFound(_0x3099d2,_0x5620bb){return function(_0x2dfacd){if(!_0x2dfacd){_0x3099d2[_0x6994('0x19')](0x194);}return _0x2dfacd;};}function handleError(_0x34aa0d,_0x209a6e){_0x209a6e=_0x209a6e||0x1f4;return function(_0x43da83){logger['error'](_0x43da83[_0x6994('0x27')]);if(_0x43da83[_0x6994('0x28')]){delete _0x43da83['name'];}_0x34aa0d[_0x6994('0x1f')](_0x209a6e)[_0x6994('0x29')](_0x43da83);};}exports[_0x6994('0x2a')]=function(_0x17abd7,_0x2d2265){var _0x44be12={},_0x3a449f={},_0x501366={'count':0x0,'rows':[]};var _0x203f85=_['map'](db[_0x6994('0x2b')][_0x6994('0x2c')],function(_0x8d8536){return{'name':_0x8d8536[_0x6994('0x2d')],'type':_0x8d8536[_0x6994('0x2e')][_0x6994('0x2f')]};});_0x3a449f[_0x6994('0x30')]=_[_0x6994('0x31')](_0x203f85,_0x6994('0x28'));_0x3a449f[_0x6994('0x32')]=_[_0x6994('0x33')](_0x17abd7[_0x6994('0x32')]);_0x3a449f['filters']=_[_0x6994('0x34')](_0x3a449f['model'],_0x3a449f['query']);_0x44be12[_0x6994('0x35')]=_[_0x6994('0x34')](_0x3a449f[_0x6994('0x30')],qs[_0x6994('0x36')](_0x17abd7[_0x6994('0x32')][_0x6994('0x36')]));_0x44be12[_0x6994('0x35')]=_0x44be12[_0x6994('0x35')]['length']?_0x44be12[_0x6994('0x35')]:_0x3a449f[_0x6994('0x30')];if(!_0x17abd7[_0x6994('0x32')]['hasOwnProperty'](_0x6994('0x37'))){_0x44be12['limit']=qs[_0x6994('0x1e')](_0x17abd7[_0x6994('0x32')][_0x6994('0x1e')]);_0x44be12[_0x6994('0x1d')]=qs['offset'](_0x17abd7[_0x6994('0x32')][_0x6994('0x1d')]);}_0x44be12['order']=qs[_0x6994('0x38')](_0x17abd7[_0x6994('0x32')][_0x6994('0x38')]);_0x44be12[_0x6994('0x39')]=qs['filters'](_['pick'](_0x17abd7['query'],_0x3a449f[_0x6994('0x3a')]),_0x203f85);if(_0x17abd7['query'][_0x6994('0x3b')]){_0x44be12['where']=_[_0x6994('0x3c')](_0x44be12[_0x6994('0x39')],{'$or':_[_0x6994('0x31')](_0x203f85,function(_0x105ee8){if(_0x105ee8[_0x6994('0x2e')]!==_0x6994('0x3d')){var _0x1f866f={};_0x1f866f[_0x105ee8[_0x6994('0x28')]]={'$like':'%'+_0x17abd7[_0x6994('0x32')][_0x6994('0x3b')]+'%'};return _0x1f866f;}})});}_0x44be12=_[_0x6994('0x3c')]({},_0x44be12,_0x17abd7[_0x6994('0x3e')]);var _0x39862e={'where':_0x44be12['where']};return db['FreshdeskField']['count'](_0x39862e)[_0x6994('0x25')](function(_0x33f0ce){_0x501366[_0x6994('0x1c')]=_0x33f0ce;if(_0x17abd7[_0x6994('0x32')][_0x6994('0x3f')]){_0x44be12[_0x6994('0x40')]=[{'all':!![]}];}return db['FreshdeskField'][_0x6994('0x41')](_0x44be12);})[_0x6994('0x25')](function(_0x47e5d6){_0x501366[_0x6994('0x42')]=_0x47e5d6;return _0x501366;})[_0x6994('0x25')](respondWithFilteredResult(_0x2d2265,_0x44be12))[_0x6994('0x43')](handleError(_0x2d2265,null));};exports[_0x6994('0x44')]=function(_0x372b5c,_0x28491d){var _0x2cfd8a={'raw':!![],'where':{'id':_0x372b5c['params']['id']}},_0x591822={};_0x591822[_0x6994('0x30')]=_[_0x6994('0x33')](db['FreshdeskField']['rawAttributes']);_0x591822[_0x6994('0x32')]=_[_0x6994('0x33')](_0x372b5c[_0x6994('0x32')]);_0x591822['filters']=_[_0x6994('0x34')](_0x591822[_0x6994('0x30')],_0x591822[_0x6994('0x32')]);_0x2cfd8a[_0x6994('0x35')]=_[_0x6994('0x34')](_0x591822[_0x6994('0x30')],qs[_0x6994('0x36')](_0x372b5c[_0x6994('0x32')][_0x6994('0x36')]));_0x2cfd8a['attributes']=_0x2cfd8a[_0x6994('0x35')][_0x6994('0x45')]?_0x2cfd8a[_0x6994('0x35')]:_0x591822[_0x6994('0x30')];if(_0x372b5c[_0x6994('0x32')][_0x6994('0x3f')]){_0x2cfd8a[_0x6994('0x40')]=[{'all':!![]}];}_0x2cfd8a=_[_0x6994('0x3c')]({},_0x2cfd8a,_0x372b5c[_0x6994('0x3e')]);return db['FreshdeskField'][_0x6994('0x46')](_0x2cfd8a)['then'](handleEntityNotFound(_0x28491d,null))['then'](respondWithResult(_0x28491d,null))[_0x6994('0x43')](handleError(_0x28491d,null));};exports[_0x6994('0x47')]=function(_0xd114c4,_0x371caf){return db[_0x6994('0x2b')][_0x6994('0x47')](_0xd114c4[_0x6994('0x48')],{})['then'](respondWithResult(_0x371caf,0xc9))[_0x6994('0x43')](handleError(_0x371caf,null));};exports['update']=function(_0x1d61ff,_0x5518c1){if(_0x1d61ff[_0x6994('0x48')]['id']){delete _0x1d61ff[_0x6994('0x48')]['id'];}return db[_0x6994('0x2b')]['find']({'where':{'id':_0x1d61ff[_0x6994('0x49')]['id']}})[_0x6994('0x25')](handleEntityNotFound(_0x5518c1,null))[_0x6994('0x25')](saveUpdates(_0x1d61ff[_0x6994('0x48')],null))['then'](respondWithResult(_0x5518c1,null))['catch'](handleError(_0x5518c1,null));};exports[_0x6994('0x26')]=function(_0x11e3bd,_0x3fb29a){return db[_0x6994('0x2b')][_0x6994('0x46')]({'where':{'id':_0x11e3bd[_0x6994('0x49')]['id']}})[_0x6994('0x25')](handleEntityNotFound(_0x3fb29a,null))[_0x6994('0x25')](removeEntity(_0x3fb29a,null))[_0x6994('0x43')](handleError(_0x3fb29a,null));}; \ No newline at end of file +var _0xaeb1=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2c9b98,_0x21b1a0){var _0x179c39=function(_0x5a68bd){while(--_0x5a68bd){_0x2c9b98['push'](_0x2c9b98['shift']());}};_0x179c39(++_0x21b1a0);}(_0xaeb1,0x126));var _0x1aeb=function(_0x2553ba,_0x210811){_0x2553ba=_0x2553ba-0x0;var _0x46e128=_0xaeb1[_0x2553ba];return _0x46e128;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1aeb('0x0'));var rimraf=require(_0x1aeb('0x1'));var zipdir=require(_0x1aeb('0x2'));var jsonpatch=require(_0x1aeb('0x3'));var rp=require(_0x1aeb('0x4'));var moment=require(_0x1aeb('0x5'));var BPromise=require(_0x1aeb('0x6'));var Mustache=require('mustache');var util=require(_0x1aeb('0x7'));var path=require(_0x1aeb('0x8'));var sox=require(_0x1aeb('0x9'));var csv=require(_0x1aeb('0xa'));var ejs=require(_0x1aeb('0xb'));var fs=require('fs');var _=require(_0x1aeb('0xc'));var squel=require(_0x1aeb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1aeb('0xa'));var querystring=require(_0x1aeb('0xe'));var Papa=require(_0x1aeb('0xf'));var Redis=require('ioredis');var authService=require(_0x1aeb('0x10'));var qs=require(_0x1aeb('0x11'));var as=require(_0x1aeb('0x12'));var hardwareService=require(_0x1aeb('0x13'));var logger=require(_0x1aeb('0x14'))(_0x1aeb('0x15'));var utils=require(_0x1aeb('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x393c7a,_0x47ca25){_0x47ca25=_0x47ca25||0xcc;return function(_0x137cc7){if(_0x137cc7){return _0x393c7a[_0x1aeb('0x17')](_0x47ca25);}return _0x393c7a[_0x1aeb('0x18')](_0x47ca25)[_0x1aeb('0x19')]();};}function respondWithResult(_0xf465bb,_0x4741dc){_0x4741dc=_0x4741dc||0xc8;return function(_0x2f0397){if(_0x2f0397){return _0xf465bb[_0x1aeb('0x18')](_0x4741dc)[_0x1aeb('0x1a')](_0x2f0397);}};}function respondWithFilteredResult(_0x535d42,_0x596ec2){return function(_0xaaea2f){if(_0xaaea2f){var _0x251c27=_0xaaea2f[_0x1aeb('0x1b')],_0x342f39=_0x596ec2[_0x1aeb('0x1c')],_0x8b1f3c=_0x596ec2['offset']+_0x596ec2[_0x1aeb('0x1d')],_0x59532b;if(_0x8b1f3c>=_0x251c27){_0x8b1f3c=_0x251c27;_0x59532b=0xc8;}else{_0x59532b=0xce;}_0x535d42[_0x1aeb('0x18')](_0x59532b);return _0x535d42[_0x1aeb('0x1e')](_0x1aeb('0x1f'),_0x342f39+'-'+_0x8b1f3c+'/'+_0x251c27)['json'](_0xaaea2f);}return null;};}function patchUpdates(_0x4b2836){return function(_0x297afe){try{jsonpatch[_0x1aeb('0x20')](_0x297afe,_0x4b2836,!![]);}catch(_0x560bf8){return BPromise['reject'](_0x560bf8);}return _0x297afe[_0x1aeb('0x21')]();};}function saveUpdates(_0x3ae46a,_0x596790){return function(_0x1ab12c){if(_0x1ab12c){return _0x1ab12c[_0x1aeb('0x22')](_0x3ae46a)[_0x1aeb('0x23')](function(_0x5aafba){return _0x5aafba;});}return null;};}function removeEntity(_0x5b7ade,_0x22d46f){return function(_0x3e4d48){if(_0x3e4d48){return _0x3e4d48[_0x1aeb('0x24')]()[_0x1aeb('0x23')](function(){_0x5b7ade[_0x1aeb('0x18')](0xcc)[_0x1aeb('0x19')]();});}};}function handleEntityNotFound(_0x3d88fc,_0x462268){return function(_0x4b928a){if(!_0x4b928a){_0x3d88fc[_0x1aeb('0x17')](0x194);}return _0x4b928a;};}function handleError(_0x376148,_0x17c00e){_0x17c00e=_0x17c00e||0x1f4;return function(_0x2ef008){logger[_0x1aeb('0x25')](_0x2ef008[_0x1aeb('0x26')]);if(_0x2ef008[_0x1aeb('0x27')]){delete _0x2ef008['name'];}_0x376148[_0x1aeb('0x18')](_0x17c00e)[_0x1aeb('0x28')](_0x2ef008);};}exports['index']=function(_0x6a244e,_0x43f79f){var _0x489620={},_0x1116db={},_0x410025={'count':0x0,'rows':[]};var _0x2ad9b3=_[_0x1aeb('0x29')](db[_0x1aeb('0x2a')][_0x1aeb('0x2b')],function(_0x917124){return{'name':_0x917124[_0x1aeb('0x2c')],'type':_0x917124['type'][_0x1aeb('0x2d')]};});_0x1116db[_0x1aeb('0x2e')]=_['map'](_0x2ad9b3,'name');_0x1116db[_0x1aeb('0x2f')]=_['keys'](_0x6a244e['query']);_0x1116db['filters']=_[_0x1aeb('0x30')](_0x1116db[_0x1aeb('0x2e')],_0x1116db[_0x1aeb('0x2f')]);_0x489620[_0x1aeb('0x31')]=_[_0x1aeb('0x30')](_0x1116db[_0x1aeb('0x2e')],qs[_0x1aeb('0x32')](_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x32')]));_0x489620[_0x1aeb('0x31')]=_0x489620[_0x1aeb('0x31')][_0x1aeb('0x33')]?_0x489620[_0x1aeb('0x31')]:_0x1116db[_0x1aeb('0x2e')];if(!_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x34')]('nolimit')){_0x489620['limit']=qs[_0x1aeb('0x1d')](_0x6a244e['query'][_0x1aeb('0x1d')]);_0x489620[_0x1aeb('0x1c')]=qs[_0x1aeb('0x1c')](_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x1c')]);}_0x489620[_0x1aeb('0x35')]=qs['sort'](_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x36')]);_0x489620[_0x1aeb('0x37')]=qs['filters'](_[_0x1aeb('0x38')](_0x6a244e[_0x1aeb('0x2f')],_0x1116db[_0x1aeb('0x39')]),_0x2ad9b3);if(_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x3a')]){_0x489620[_0x1aeb('0x37')]=_[_0x1aeb('0x3b')](_0x489620[_0x1aeb('0x37')],{'$or':_[_0x1aeb('0x29')](_0x2ad9b3,function(_0x641f30){if(_0x641f30[_0x1aeb('0x3c')]!==_0x1aeb('0x3d')){var _0x512591={};_0x512591[_0x641f30['name']]={'$like':'%'+_0x6a244e[_0x1aeb('0x2f')][_0x1aeb('0x3a')]+'%'};return _0x512591;}})});}_0x489620=_[_0x1aeb('0x3b')]({},_0x489620,_0x6a244e[_0x1aeb('0x3e')]);var _0xa67363={'where':_0x489620[_0x1aeb('0x37')]};return db[_0x1aeb('0x2a')][_0x1aeb('0x1b')](_0xa67363)[_0x1aeb('0x23')](function(_0x366a06){_0x410025[_0x1aeb('0x1b')]=_0x366a06;if(_0x6a244e[_0x1aeb('0x2f')]['includeAll']){_0x489620[_0x1aeb('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x1aeb('0x40')](_0x489620);})[_0x1aeb('0x23')](function(_0x3d28d0){_0x410025[_0x1aeb('0x41')]=_0x3d28d0;return _0x410025;})[_0x1aeb('0x23')](respondWithFilteredResult(_0x43f79f,_0x489620))[_0x1aeb('0x42')](handleError(_0x43f79f,null));};exports[_0x1aeb('0x43')]=function(_0x99b461,_0x1a89c1){var _0x486489={'raw':!![],'where':{'id':_0x99b461[_0x1aeb('0x44')]['id']}},_0x166346={};_0x166346['model']=_[_0x1aeb('0x45')](db['FreshdeskField'][_0x1aeb('0x2b')]);_0x166346[_0x1aeb('0x2f')]=_['keys'](_0x99b461['query']);_0x166346[_0x1aeb('0x39')]=_[_0x1aeb('0x30')](_0x166346['model'],_0x166346['query']);_0x486489[_0x1aeb('0x31')]=_[_0x1aeb('0x30')](_0x166346[_0x1aeb('0x2e')],qs[_0x1aeb('0x32')](_0x99b461['query']['fields']));_0x486489[_0x1aeb('0x31')]=_0x486489[_0x1aeb('0x31')][_0x1aeb('0x33')]?_0x486489[_0x1aeb('0x31')]:_0x166346[_0x1aeb('0x2e')];if(_0x99b461[_0x1aeb('0x2f')]['includeAll']){_0x486489[_0x1aeb('0x3f')]=[{'all':!![]}];}_0x486489=_[_0x1aeb('0x3b')]({},_0x486489,_0x99b461['options']);return db['FreshdeskField'][_0x1aeb('0x46')](_0x486489)[_0x1aeb('0x23')](handleEntityNotFound(_0x1a89c1,null))[_0x1aeb('0x23')](respondWithResult(_0x1a89c1,null))[_0x1aeb('0x42')](handleError(_0x1a89c1,null));};exports[_0x1aeb('0x47')]=function(_0x9cbcd3,_0x52ba6e){return db[_0x1aeb('0x2a')][_0x1aeb('0x47')](_0x9cbcd3[_0x1aeb('0x48')],{})['then'](respondWithResult(_0x52ba6e,0xc9))[_0x1aeb('0x42')](handleError(_0x52ba6e,null));};exports['update']=function(_0x281e38,_0x544d10){if(_0x281e38[_0x1aeb('0x48')]['id']){delete _0x281e38[_0x1aeb('0x48')]['id'];}return db[_0x1aeb('0x2a')]['find']({'where':{'id':_0x281e38[_0x1aeb('0x44')]['id']}})[_0x1aeb('0x23')](handleEntityNotFound(_0x544d10,null))[_0x1aeb('0x23')](saveUpdates(_0x281e38[_0x1aeb('0x48')],null))['then'](respondWithResult(_0x544d10,null))['catch'](handleError(_0x544d10,null));};exports[_0x1aeb('0x24')]=function(_0x47e497,_0x27936c){return db[_0x1aeb('0x2a')][_0x1aeb('0x46')]({'where':{'id':_0x47e497[_0x1aeb('0x44')]['id']}})['then'](handleEntityNotFound(_0x27936c,null))[_0x1aeb('0x23')](removeEntity(_0x27936c,null))[_0x1aeb('0x42')](handleError(_0x27936c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a98e7b7..4361715 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 _0xb050=['util','../../config/logger','api','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x56f709,_0x49b81c){var _0xf2a807=function(_0x328a09){while(--_0x328a09){_0x56f709['push'](_0x56f709['shift']());}};_0xf2a807(++_0x49b81c);}(_0xb050,0x114));var _0x0b05=function(_0x40dfc2,_0x4acade){_0x40dfc2=_0x40dfc2-0x0;var _0x1bd738=_0xb050[_0x40dfc2];return _0x1bd738;};'use strict';var _=require('lodash');var util=require(_0x0b05('0x0'));var logger=require(_0x0b05('0x1'))(_0x0b05('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b05('0x4'));var config=require('../../config/environment');var attributes=require(_0x0b05('0x5'));module[_0x0b05('0x6')]=function(_0x1a4a8b,_0x32aebc){return _0x1a4a8b[_0x0b05('0x7')](_0x0b05('0x8'),attributes,{'tableName':_0x0b05('0x9'),'paranoid':![],'indexes':[{'name':_0x0b05('0xa'),'fields':[_0x0b05('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a46=['moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','util','api'];(function(_0x51806f,_0x207dbd){var _0x4bb4ab=function(_0x2653f1){while(--_0x2653f1){_0x51806f['push'](_0x51806f['shift']());}};_0x4bb4ab(++_0x207dbd);}(_0x1a46,0xbe));var _0x61a4=function(_0x218eea,_0xf97f47){_0x218eea=_0x218eea-0x0;var _0x504c41=_0x1a46[_0x218eea];return _0x504c41;};'use strict';var _=require('lodash');var util=require(_0x61a4('0x0'));var logger=require('../../config/logger')(_0x61a4('0x1'));var moment=require(_0x61a4('0x2'));var BPromise=require(_0x61a4('0x3'));var rp=require(_0x61a4('0x4'));var fs=require('fs');var path=require(_0x61a4('0x5'));var rimraf=require(_0x61a4('0x6'));var config=require('../../config/environment');var attributes=require(_0x61a4('0x7'));module[_0x61a4('0x8')]=function(_0x1d67f6,_0x4cf447){return _0x1d67f6['define'](_0x61a4('0x9'),attributes,{'tableName':_0x61a4('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x61a4('0xb')],'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 9c5c973..67ab4d2 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 _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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x5ee009,_0x13b1b9){_0x5ee009=_0x5ee009-0x0;var _0xf417de=_0x7a54[_0x5ee009];return _0xf417de;};'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 +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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x32ef2f,_0x20ce6c){_0x32ef2f=_0x32ef2f-0x0;var _0x204c84=_0x7a54[_0x32ef2f];return _0x204c84;};'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 b54e343..b08d38d 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 _0xad1e=['show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','isAuthenticated','index','/:id'];(function(_0xbae966,_0x1e93ed){var _0x5764a4=function(_0x16025b){while(--_0x16025b){_0xbae966['push'](_0xbae966['shift']());}};_0x5764a4(++_0x1e93ed);}(_0xad1e,0x1c3));var _0xead1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xad1e[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xead1('0x0'));var util=require(_0xead1('0x1'));var path=require('path');var timeout=require(_0xead1('0x2'));var express=require(_0xead1('0x3'));var router=express['Router']();var auth=require(_0xead1('0x4'));var interaction=require(_0xead1('0x5'));var config=require(_0xead1('0x6'));var controller=require(_0xead1('0x7'));router['get']('/',auth[_0xead1('0x8')](),controller[_0xead1('0x9')]);router['get'](_0xead1('0xa'),auth[_0xead1('0x8')](),controller[_0xead1('0xb')]);router[_0xead1('0xc')](_0xead1('0xd'),auth[_0xead1('0x8')](),controller[_0xead1('0xe')]);router[_0xead1('0xc')](_0xead1('0xf'),auth[_0xead1('0x8')](),controller['getFields']);router[_0xead1('0x10')]('/',auth['isAuthenticated'](),controller[_0xead1('0x11')]);router[_0xead1('0x10')](_0xead1('0xd'),auth[_0xead1('0x8')](),controller['addConfiguration']);router['put'](_0xead1('0xa'),auth['isAuthenticated'](),controller[_0xead1('0x12')]);router['delete'](_0xead1('0xa'),auth[_0xead1('0x8')](),controller[_0xead1('0x13')]);module[_0xead1('0x14')]=router; \ No newline at end of file +var _0xd769=['addConfiguration','delete','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create'];(function(_0x5c63ab,_0x220ec5){var _0xb20baa=function(_0x491e41){while(--_0x491e41){_0x5c63ab['push'](_0x5c63ab['shift']());}};_0xb20baa(++_0x220ec5);}(_0xd769,0x18e));var _0x9d76=function(_0x58512c,_0x17d18b){_0x58512c=_0x58512c-0x0;var _0x115b3b=_0xd769[_0x58512c];return _0x115b3b;};'use strict';var multer=require('multer');var util=require(_0x9d76('0x0'));var path=require(_0x9d76('0x1'));var timeout=require('connect-timeout');var express=require(_0x9d76('0x2'));var router=express[_0x9d76('0x3')]();var auth=require(_0x9d76('0x4'));var interaction=require(_0x9d76('0x5'));var config=require('../../config/environment');var controller=require(_0x9d76('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9d76('0x7')]);router[_0x9d76('0x8')](_0x9d76('0x9'),auth[_0x9d76('0xa')](),controller[_0x9d76('0xb')]);router[_0x9d76('0x8')](_0x9d76('0xc'),auth[_0x9d76('0xa')](),controller['getConfigurations']);router[_0x9d76('0x8')](_0x9d76('0xd'),auth[_0x9d76('0xa')](),controller['getFields']);router[_0x9d76('0xe')]('/',auth[_0x9d76('0xa')](),controller[_0x9d76('0xf')]);router[_0x9d76('0xe')](_0x9d76('0xc'),auth[_0x9d76('0xa')](),controller[_0x9d76('0x10')]);router['put'](_0x9d76('0x9'),auth[_0x9d76('0xa')](),controller['update']);router[_0x9d76('0x11')](_0x9d76('0x9'),auth[_0x9d76('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bb48956..b8b0b98 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 _0x8a9a=['STRING','username','remoteUri','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8a9a[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');module[_0xa8a9('0x0')]={'name':{'type':Sequelize[_0xa8a9('0x1')]},'description':{'type':Sequelize[_0xa8a9('0x1')]},'username':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x2')},'apiKey':{'type':Sequelize[_0xa8a9('0x1')]},'remoteUri':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x3')},'serverUrl':{'type':Sequelize[_0xa8a9('0x1')]}}; \ No newline at end of file +var _0x9bd9=['sequelize','exports','STRING','username'];(function(_0x297fc0,_0x297784){var _0x5d76ab=function(_0x51af61){while(--_0x51af61){_0x297fc0['push'](_0x297fc0['shift']());}};_0x5d76ab(++_0x297784);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x16a42b,_0x2d9468){_0x16a42b=_0x16a42b-0x0;var _0x1feccb=_0x9bd9[_0x16a42b];return _0x1feccb;};'use strict';var Sequelize=require(_0x99bd('0x0'));module[_0x99bd('0x1')]={'name':{'type':Sequelize[_0x99bd('0x2')]},'description':{'type':Sequelize[_0x99bd('0x2')]},'username':{'type':Sequelize[_0x99bd('0x2')],'unique':_0x99bd('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x99bd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x99bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d5eaed6..724673a 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 _0xf1e0=['Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','set','Content-Range','reject','save','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','VIRTUAL','filter','merge','count','findAll','catch','show','keys','rawAttributes','include','options','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','order','nolimit','addConfiguration'];(function(_0x28b3a4,_0x3eef59){var _0x37ed76=function(_0xda9bd4){while(--_0xda9bd4){_0x28b3a4['push'](_0x28b3a4['shift']());}};_0x37ed76(++_0x3eef59);}(_0xf1e0,0x1e3));var _0x0f1e=function(_0x567f86,_0x45c97b){_0x567f86=_0x567f86-0x0;var _0x3a1c35=_0xf1e0[_0x567f86];return _0x3a1c35;};'use strict';var pdf=require(_0x0f1e('0x0'));var emlformat=require(_0x0f1e('0x1'));var rimraf=require(_0x0f1e('0x2'));var zipdir=require(_0x0f1e('0x3'));var jsonpatch=require(_0x0f1e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f1e('0x5'));var Mustache=require(_0x0f1e('0x6'));var util=require(_0x0f1e('0x7'));var path=require('path');var sox=require(_0x0f1e('0x8'));var csv=require(_0x0f1e('0x9'));var ejs=require(_0x0f1e('0xa'));var fs=require('fs');var _=require(_0x0f1e('0xb'));var squel=require(_0x0f1e('0xc'));var crypto=require(_0x0f1e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f1e('0xe'));var toCsv=require(_0x0f1e('0x9'));var querystring=require(_0x0f1e('0xf'));var Papa=require(_0x0f1e('0x10'));var Redis=require(_0x0f1e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f1e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f1e('0x13'))(_0x0f1e('0x14'));var utils=require(_0x0f1e('0x15'));var config=require('../../config/environment');var db=require(_0x0f1e('0x16'))['db'];var integrations=require(_0x0f1e('0x17'));var jayson=require(_0x0f1e('0x18'));var client=jayson[_0x0f1e('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x40bb07,_0x59bad0,_0x4f865a){if(_0x4f865a){var _0xf7f785=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf7f785['test'](_0x59bad0)){return _0x40bb07;}else{throw new db[(_0x0f1e('0x1a'))][(_0x0f1e('0x1b'))](_0x0f1e('0x1c'));}}else{return _0x40bb07;}}function respondWithRpcPromise(_0x24bb37,_0x5e2300,_0x4b739e,_0x5e3ff6){return new BPromise(function(_0x6d3d4b,_0x45df74){var _0x1c6976=_0x5e3ff6||client;return _0x1c6976[_0x0f1e('0x1d')](_0x24bb37,_0x4b739e)[_0x0f1e('0x1e')](function(_0x3754e1){logger[_0x0f1e('0x1f')](_0x0f1e('0x20'),_0x5e2300,_0x0f1e('0x21'));logger['debug'](_0x0f1e('0x22'),_0x5e2300,_0x0f1e('0x21'),JSON['stringify'](_0x3754e1));if(_0x3754e1[_0x0f1e('0x23')]){if(_0x3754e1['error'][_0x0f1e('0x24')]===0x1f4){logger['error'](_0x0f1e('0x20'),_0x5e2300,_0x3754e1[_0x0f1e('0x23')]['message']);return _0x45df74(_0x3754e1[_0x0f1e('0x23')][_0x0f1e('0x25')]);}logger[_0x0f1e('0x23')](_0x0f1e('0x20'),_0x5e2300,_0x3754e1['error'][_0x0f1e('0x25')]);return _0x6d3d4b(_0x3754e1['error'][_0x0f1e('0x25')]);}else{logger[_0x0f1e('0x1f')](_0x0f1e('0x20'),_0x5e2300,'request\x20sent');_0x6d3d4b(_0x3754e1[_0x0f1e('0x26')]['message']);}})['catch'](function(_0x381908){logger[_0x0f1e('0x23')](_0x0f1e('0x20'),_0x5e2300,_0x381908);_0x45df74(_0x381908);});});}function respondWithStatusCode(_0x59a015,_0x25c6fe){_0x25c6fe=_0x25c6fe||0xcc;return function(_0x354091){if(_0x354091){return _0x59a015[_0x0f1e('0x27')](_0x25c6fe);}return _0x59a015[_0x0f1e('0x28')](_0x25c6fe)[_0x0f1e('0x29')]();};}function respondWithResult(_0x46b73e,_0x4cd4ab){_0x4cd4ab=_0x4cd4ab||0xc8;return function(_0x3aecbf){if(_0x3aecbf){return _0x46b73e['status'](_0x4cd4ab)[_0x0f1e('0x2a')](_0x3aecbf);}};}function respondWithFilteredResult(_0x5185d2,_0x58c06e){return function(_0x1c2850){if(_0x1c2850){var _0x15b7ad=_0x1c2850['count'],_0x4939c9=_0x58c06e[_0x0f1e('0x2b')],_0x4e65df=_0x58c06e[_0x0f1e('0x2b')]+_0x58c06e['limit'],_0x31035d;if(_0x4e65df>=_0x15b7ad){_0x4e65df=_0x15b7ad;_0x31035d=0xc8;}else{_0x31035d=0xce;}_0x5185d2[_0x0f1e('0x28')](_0x31035d);return _0x5185d2[_0x0f1e('0x2c')](_0x0f1e('0x2d'),_0x4939c9+'-'+_0x4e65df+'/'+_0x15b7ad)[_0x0f1e('0x2a')](_0x1c2850);}return null;};}function patchUpdates(_0xdd29ff){return function(_0x315a81){try{jsonpatch['apply'](_0x315a81,_0xdd29ff,!![]);}catch(_0x3ba8dd){return BPromise[_0x0f1e('0x2e')](_0x3ba8dd);}return _0x315a81[_0x0f1e('0x2f')]();};}function saveUpdates(_0x8dd12f,_0x2b1bd2){return function(_0x2b3f64){if(_0x2b3f64){return _0x2b3f64['update'](_0x8dd12f)[_0x0f1e('0x1e')](function(_0x18acde){return _0x18acde;});}return null;};}function removeEntity(_0x21c078,_0x148833){return function(_0x15ddc9){if(_0x15ddc9){return _0x15ddc9[_0x0f1e('0x30')]()[_0x0f1e('0x1e')](function(){_0x21c078[_0x0f1e('0x28')](0xcc)[_0x0f1e('0x29')]();});}};}function handleEntityNotFound(_0x45e65a,_0x3e9922){return function(_0x2412b2){if(!_0x2412b2){_0x45e65a[_0x0f1e('0x27')](0x194);}return _0x2412b2;};}function handleError(_0x2f5714,_0x409471){_0x409471=_0x409471||0x1f4;return function(_0x1ff660){logger[_0x0f1e('0x23')](_0x1ff660[_0x0f1e('0x31')]);if(_0x1ff660[_0x0f1e('0x32')]){delete _0x1ff660[_0x0f1e('0x32')];}_0x2f5714['status'](_0x409471)[_0x0f1e('0x33')](_0x1ff660);};}exports[_0x0f1e('0x34')]=function(_0x48b8a9,_0x4de21f){var _0x154463={},_0x37d62e={},_0x5564d3={'count':0x0,'rows':[]};var _0x3fda9a=_[_0x0f1e('0x35')](db[_0x0f1e('0x36')]['rawAttributes'],function(_0xda6d4f){return{'name':_0xda6d4f[_0x0f1e('0x37')],'type':_0xda6d4f[_0x0f1e('0x38')][_0x0f1e('0x39')]};});_0x37d62e[_0x0f1e('0x3a')]=_[_0x0f1e('0x35')](_0x3fda9a,_0x0f1e('0x32'));_0x37d62e[_0x0f1e('0x3b')]=_['keys'](_0x48b8a9[_0x0f1e('0x3b')]);_0x37d62e[_0x0f1e('0x3c')]=_['intersection'](_0x37d62e[_0x0f1e('0x3a')],_0x37d62e['query']);_0x154463[_0x0f1e('0x3d')]=_[_0x0f1e('0x3e')](_0x37d62e[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x3f')]));_0x154463[_0x0f1e('0x3d')]=_0x154463[_0x0f1e('0x3d')][_0x0f1e('0x40')]?_0x154463[_0x0f1e('0x3d')]:_0x37d62e['model'];if(!_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x41')]('nolimit')){_0x154463[_0x0f1e('0x42')]=qs[_0x0f1e('0x42')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x42')]);_0x154463['offset']=qs[_0x0f1e('0x2b')](_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x2b')]);}_0x154463['order']=qs[_0x0f1e('0x43')](_0x48b8a9[_0x0f1e('0x3b')]['sort']);_0x154463[_0x0f1e('0x44')]=qs[_0x0f1e('0x3c')](_[_0x0f1e('0x45')](_0x48b8a9['query'],_0x37d62e[_0x0f1e('0x3c')]),_0x3fda9a);if(_0x48b8a9[_0x0f1e('0x3b')]['filter']){_0x154463[_0x0f1e('0x44')]=_['merge'](_0x154463[_0x0f1e('0x44')],{'$or':_['map'](_0x3fda9a,function(_0x28a7d6){if(_0x28a7d6[_0x0f1e('0x38')]!==_0x0f1e('0x46')){var _0x18cf84={};_0x18cf84[_0x28a7d6[_0x0f1e('0x32')]]={'$like':'%'+_0x48b8a9[_0x0f1e('0x3b')][_0x0f1e('0x47')]+'%'};return _0x18cf84;}})});}_0x154463=_[_0x0f1e('0x48')]({},_0x154463,_0x48b8a9['options']);var _0xcb1c24={'where':_0x154463[_0x0f1e('0x44')]};return db[_0x0f1e('0x36')]['count'](_0xcb1c24)['then'](function(_0xa0028c){_0x5564d3[_0x0f1e('0x49')]=_0xa0028c;if(_0x48b8a9['query']['includeAll']){_0x154463['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0f1e('0x4a')](_0x154463);})[_0x0f1e('0x1e')](function(_0x109b1e){_0x5564d3['rows']=_0x109b1e;return _0x5564d3;})[_0x0f1e('0x1e')](respondWithFilteredResult(_0x4de21f,_0x154463))[_0x0f1e('0x4b')](handleError(_0x4de21f,null));};exports[_0x0f1e('0x4c')]=function(_0x58e251,_0x2563d8){var _0x334d08={'raw':![],'where':{'id':_0x58e251['params']['id']}},_0x1aae2f={};_0x1aae2f[_0x0f1e('0x3a')]=_[_0x0f1e('0x4d')](db[_0x0f1e('0x36')][_0x0f1e('0x4e')]);_0x1aae2f[_0x0f1e('0x3b')]=_[_0x0f1e('0x4d')](_0x58e251[_0x0f1e('0x3b')]);_0x1aae2f[_0x0f1e('0x3c')]=_[_0x0f1e('0x3e')](_0x1aae2f['model'],_0x1aae2f['query']);_0x334d08[_0x0f1e('0x3d')]=_[_0x0f1e('0x3e')](_0x1aae2f[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x58e251['query'][_0x0f1e('0x3f')]));_0x334d08[_0x0f1e('0x3d')]=_0x334d08['attributes'][_0x0f1e('0x40')]?_0x334d08[_0x0f1e('0x3d')]:_0x1aae2f['model'];if(_0x58e251[_0x0f1e('0x3b')]['includeAll']){_0x334d08[_0x0f1e('0x4f')]=[{'all':!![]}];}_0x334d08=_['merge']({},_0x334d08,_0x58e251[_0x0f1e('0x50')]);return db['FreshsalesAccount'][_0x0f1e('0x51')](_0x334d08)['then'](handleEntityNotFound(_0x2563d8,null))[_0x0f1e('0x1e')](respondWithResult(_0x2563d8,null))[_0x0f1e('0x4b')](handleError(_0x2563d8,null));};exports[_0x0f1e('0x52')]=function(_0x2bd517,_0x39ec1e){return db[_0x0f1e('0x36')][_0x0f1e('0x52')](_0x2bd517[_0x0f1e('0x53')],{})[_0x0f1e('0x1e')](respondWithResult(_0x39ec1e,0xc9))['catch'](handleError(_0x39ec1e,null));};exports[_0x0f1e('0x54')]=function(_0x5011cc,_0x57ed39){if(_0x5011cc[_0x0f1e('0x53')]['id']){delete _0x5011cc[_0x0f1e('0x53')]['id'];}return db[_0x0f1e('0x36')][_0x0f1e('0x51')]({'where':{'id':_0x5011cc[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x57ed39,null))['then'](saveUpdates(_0x5011cc['body'],null))[_0x0f1e('0x1e')](respondWithResult(_0x57ed39,null))[_0x0f1e('0x4b')](handleError(_0x57ed39,null));};exports[_0x0f1e('0x30')]=function(_0x33cb65,_0x410dbe){return db['FreshsalesAccount']['find']({'where':{'id':_0x33cb65[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x410dbe,null))['then'](removeEntity(_0x410dbe,null))[_0x0f1e('0x4b')](handleError(_0x410dbe,null));};exports[_0x0f1e('0x56')]=function(_0x2599e4,_0x413c42,_0x5c200c){var _0x3cfca6={};var _0x12262f={};var _0x119876;var _0x687256;return db['FreshsalesAccount'][_0x0f1e('0x57')]({'where':{'id':_0x2599e4[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x413c42,null))[_0x0f1e('0x1e')](function(_0xa13a29){if(_0xa13a29){_0x119876=_0xa13a29;_0x12262f[_0x0f1e('0x3a')]=_[_0x0f1e('0x4d')](db[_0x0f1e('0x58')][_0x0f1e('0x4e')]);_0x12262f['query']=_[_0x0f1e('0x4d')](_0x2599e4[_0x0f1e('0x3b')]);_0x12262f[_0x0f1e('0x3c')]=_[_0x0f1e('0x3e')](_0x12262f[_0x0f1e('0x3a')],_0x12262f[_0x0f1e('0x3b')]);_0x3cfca6[_0x0f1e('0x3d')]=_['intersection'](_0x12262f[_0x0f1e('0x3a')],qs[_0x0f1e('0x3f')](_0x2599e4[_0x0f1e('0x3b')]['fields']));_0x3cfca6['attributes']=_0x3cfca6['attributes'][_0x0f1e('0x40')]?_0x3cfca6[_0x0f1e('0x3d')]:_0x12262f['model'];_0x3cfca6[_0x0f1e('0x59')]=qs['sort'](_0x2599e4[_0x0f1e('0x3b')]['sort']);_0x3cfca6['where']=qs['filters'](_['pick'](_0x2599e4[_0x0f1e('0x3b')],_0x12262f['filters']));if(_0x2599e4['query'][_0x0f1e('0x47')]){_0x3cfca6[_0x0f1e('0x44')]=_[_0x0f1e('0x48')](_0x3cfca6[_0x0f1e('0x44')],{'$or':_['map'](_0x3cfca6['attributes'],function(_0x2e5519){var _0x32d074={};_0x32d074[_0x2e5519]={'$like':'%'+_0x2599e4[_0x0f1e('0x3b')][_0x0f1e('0x47')]+'%'};return _0x32d074;})});}_0x3cfca6=_[_0x0f1e('0x48')]({},_0x3cfca6,_0x2599e4['options']);return _0x119876[_0x0f1e('0x56')](_0x3cfca6);}})['then'](function(_0x9a2b55){if(_0x9a2b55){_0x687256=_0x9a2b55[_0x0f1e('0x40')];if(!_0x2599e4['query'][_0x0f1e('0x41')](_0x0f1e('0x5a'))){_0x3cfca6[_0x0f1e('0x42')]=qs['limit'](_0x2599e4['query'][_0x0f1e('0x42')]);_0x3cfca6[_0x0f1e('0x2b')]=qs[_0x0f1e('0x2b')](_0x2599e4['query'][_0x0f1e('0x2b')]);}return _0x119876[_0x0f1e('0x56')](_0x3cfca6);}})['then'](function(_0x1f74d3){if(_0x1f74d3){return _0x1f74d3?{'count':_0x687256,'rows':_0x1f74d3}:null;}})[_0x0f1e('0x1e')](respondWithResult(_0x413c42,null))[_0x0f1e('0x4b')](handleError(_0x413c42,null));};exports[_0x0f1e('0x5b')]=function(_0x5a9a05,_0x5c45e9,_0x5be985){if(_0x5a9a05[_0x0f1e('0x53')]['id']){delete _0x5a9a05['body']['id'];}return db[_0x0f1e('0x36')][_0x0f1e('0x57')]({'where':{'id':_0x5a9a05[_0x0f1e('0x55')]['id']}})[_0x0f1e('0x1e')](handleEntityNotFound(_0x5c45e9,null))[_0x0f1e('0x1e')](function(_0x2d8d01){if(_0x2d8d01){_0x5a9a05[_0x0f1e('0x53')]['AccountId']=_0x2d8d01['id'];_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x5c')]=integrations[_0x0f1e('0x5d')](_0x5a9a05[_0x0f1e('0x53')]['channel'],_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x38')]);_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x5e')]=integrations[_0x0f1e('0x5f')](_0x5a9a05[_0x0f1e('0x53')]['channel'],_0x5a9a05[_0x0f1e('0x53')][_0x0f1e('0x38')]);return db['FreshsalesConfiguration'][_0x0f1e('0x52')](_0x5a9a05[_0x0f1e('0x53')],{'include':[{'model':db['FreshsalesField'],'as':_0x0f1e('0x5c')},{'model':db[_0x0f1e('0x60')],'as':_0x0f1e('0x5e')}]});}return null;})['then'](respondWithResult(_0x5c45e9,null))[_0x0f1e('0x4b')](handleError(_0x5c45e9,null));};exports[_0x0f1e('0x61')]=function(_0x519594,_0x2d6bc2,_0x271201){var _0x224d08='';var _0x47a894='';return db[_0x0f1e('0x36')][_0x0f1e('0x57')]({'where':{'id':_0x519594[_0x0f1e('0x55')]['id']},'attributes':['id',_0x0f1e('0x62'),_0x0f1e('0x63'),_0x0f1e('0x64')]})[_0x0f1e('0x1e')](handleEntityNotFound(_0x2d6bc2,null))[_0x0f1e('0x1e')](function(_0x3fb658){if(_0x3fb658){_0x47a894=_0x3fb658[_0x0f1e('0x62')];_0x224d08=_0x3fb658[_0x0f1e('0x63')];var _0x5785ef=_0x3fb658['remoteUri'][_0x0f1e('0x65')](-0x1);if(_0x5785ef==='/'){_0x224d08=_0x224d08[_0x0f1e('0x66')](0x0,_0x224d08[_0x0f1e('0x67')](_0x5785ef));}return rp({'method':_0x0f1e('0x68'),'uri':util[_0x0f1e('0x69')](_0x0f1e('0x6a'),_0x224d08,_0x0f1e('0x6b')),'headers':{'Authorization':_0x0f1e('0x6c')+_0x3fb658[_0x0f1e('0x64')]},'json':!![]});}})[_0x0f1e('0x1e')](function(_0x507a3d){if(_0x507a3d){var _0x5ac4e8=_0x507a3d['users'];var _0x1919c1=![];var _0x173cc2=null;for(_0x173cc2=0x0;_0x173cc2<_0x5ac4e8[_0x0f1e('0x40')];_0x173cc2++){if(_0x5ac4e8[_0x173cc2][_0x0f1e('0x6d')]===_0x47a894){_0x1919c1=!![];}}if(_0x1919c1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0f1e('0x6e')});}}})[_0x0f1e('0x1e')](respondWithResult(_0x2d6bc2,null))['catch'](function(_0x2bebfb){var _0xcfbf0a=_0x519594[_0x0f1e('0x3b')][_0x0f1e('0x6f')]?0x1f4:_0x2bebfb[_0x0f1e('0x70')]||0x1f4;logger[_0x0f1e('0x23')](_0x0f1e('0x71'),'getFields',_0xcfbf0a,JSON['stringify'](_0x2bebfb));delete _0x2bebfb['name'];if(_0xcfbf0a===0x191){_0xcfbf0a=0x190;}_0x2d6bc2[_0x0f1e('0x28')](_0xcfbf0a)[_0x0f1e('0x33')](_0x519594[_0x0f1e('0x3b')][_0x0f1e('0x6f')]?{'message':_0x0f1e('0x72'),'statusCode':_0x2bebfb[_0x0f1e('0x70')]}:_0x2bebfb);});}; \ No newline at end of file +var _0x0228=['username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','set','Content-Range','update','end','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','count','includeAll','FreshsalesAccount','rows','catch','show','params','keys','include','options','find','create','body','destroy','findOne','FreshsalesConfiguration','length','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields'];(function(_0x39db90,_0x59a4a9){var _0xf12a24=function(_0x676fbc){while(--_0x676fbc){_0x39db90['push'](_0x39db90['shift']());}};_0xf12a24(++_0x59a4a9);}(_0x0228,0x1dc));var _0x8022=function(_0x820843,_0x4b6f7e){_0x820843=_0x820843-0x0;var _0x2077c2=_0x0228[_0x820843];return _0x2077c2;};'use strict';var pdf=require(_0x8022('0x0'));var emlformat=require(_0x8022('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8022('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8022('0x3'));var moment=require(_0x8022('0x4'));var BPromise=require(_0x8022('0x5'));var Mustache=require(_0x8022('0x6'));var util=require(_0x8022('0x7'));var path=require(_0x8022('0x8'));var sox=require(_0x8022('0x9'));var csv=require(_0x8022('0xa'));var ejs=require(_0x8022('0xb'));var fs=require('fs');var _=require(_0x8022('0xc'));var squel=require('squel');var crypto=require(_0x8022('0xd'));var jsforce=require(_0x8022('0xe'));var deskjs=require(_0x8022('0xf'));var toCsv=require(_0x8022('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8022('0x10'));var qs=require(_0x8022('0x11'));var as=require(_0x8022('0x12'));var hardwareService=require(_0x8022('0x13'));var logger=require(_0x8022('0x14'))('api');var utils=require(_0x8022('0x15'));var config=require(_0x8022('0x16'));var db=require(_0x8022('0x17'))['db'];var integrations=require(_0x8022('0x18'));var jayson=require(_0x8022('0x19'));var client=jayson[_0x8022('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x392726,_0x51e663,_0x3cfbc2){if(_0x3cfbc2){var _0xa6a098=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa6a098['test'](_0x51e663)){return _0x392726;}else{throw new db[(_0x8022('0x1b'))][(_0x8022('0x1c'))](_0x8022('0x1d'));}}else{return _0x392726;}}function respondWithRpcPromise(_0x1890e3,_0x3bd43a,_0x1d39aa,_0x1fae7a){return new BPromise(function(_0x3f9aad,_0x2e4e57){var _0x5d8e18=_0x1fae7a||client;return _0x5d8e18[_0x8022('0x1e')](_0x1890e3,_0x1d39aa)[_0x8022('0x1f')](function(_0xab76b5){logger[_0x8022('0x20')](_0x8022('0x21'),_0x3bd43a,_0x8022('0x22'));logger[_0x8022('0x23')](_0x8022('0x24'),_0x3bd43a,_0x8022('0x22'),JSON[_0x8022('0x25')](_0xab76b5));if(_0xab76b5[_0x8022('0x26')]){if(_0xab76b5['error'][_0x8022('0x27')]===0x1f4){logger[_0x8022('0x26')](_0x8022('0x21'),_0x3bd43a,_0xab76b5['error']['message']);return _0x2e4e57(_0xab76b5['error'][_0x8022('0x28')]);}logger[_0x8022('0x26')](_0x8022('0x21'),_0x3bd43a,_0xab76b5[_0x8022('0x26')][_0x8022('0x28')]);return _0x3f9aad(_0xab76b5[_0x8022('0x26')][_0x8022('0x28')]);}else{logger['info'](_0x8022('0x21'),_0x3bd43a,_0x8022('0x22'));_0x3f9aad(_0xab76b5['result'][_0x8022('0x28')]);}})['catch'](function(_0x1d2517){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3bd43a,_0x1d2517);_0x2e4e57(_0x1d2517);});});}function respondWithStatusCode(_0xf2f083,_0x139e5f){_0x139e5f=_0x139e5f||0xcc;return function(_0x285c20){if(_0x285c20){return _0xf2f083[_0x8022('0x29')](_0x139e5f);}return _0xf2f083[_0x8022('0x2a')](_0x139e5f)['end']();};}function respondWithResult(_0xb36a60,_0x63dc53){_0x63dc53=_0x63dc53||0xc8;return function(_0x3bda6e){if(_0x3bda6e){return _0xb36a60['status'](_0x63dc53)[_0x8022('0x2b')](_0x3bda6e);}};}function respondWithFilteredResult(_0x508670,_0x28eb06){return function(_0x53f131){if(_0x53f131){var _0xc25e05=_0x53f131['count'],_0x4ae20a=_0x28eb06[_0x8022('0x2c')],_0x5e0acd=_0x28eb06['offset']+_0x28eb06[_0x8022('0x2d')],_0x537cac;if(_0x5e0acd>=_0xc25e05){_0x5e0acd=_0xc25e05;_0x537cac=0xc8;}else{_0x537cac=0xce;}_0x508670[_0x8022('0x2a')](_0x537cac);return _0x508670[_0x8022('0x2e')](_0x8022('0x2f'),_0x4ae20a+'-'+_0x5e0acd+'/'+_0xc25e05)[_0x8022('0x2b')](_0x53f131);}return null;};}function patchUpdates(_0x27327a){return function(_0x373ece){try{jsonpatch['apply'](_0x373ece,_0x27327a,!![]);}catch(_0x12cd02){return BPromise['reject'](_0x12cd02);}return _0x373ece['save']();};}function saveUpdates(_0x5222c9,_0xf8537d){return function(_0x35fe40){if(_0x35fe40){return _0x35fe40[_0x8022('0x30')](_0x5222c9)[_0x8022('0x1f')](function(_0x43636d){return _0x43636d;});}return null;};}function removeEntity(_0x538bfc,_0x15ad15){return function(_0x310613){if(_0x310613){return _0x310613['destroy']()['then'](function(){_0x538bfc[_0x8022('0x2a')](0xcc)[_0x8022('0x31')]();});}};}function handleEntityNotFound(_0x5edd3b,_0x2b6981){return function(_0x32bf83){if(!_0x32bf83){_0x5edd3b[_0x8022('0x29')](0x194);}return _0x32bf83;};}function handleError(_0x1a74f2,_0x1beac4){_0x1beac4=_0x1beac4||0x1f4;return function(_0x1a5722){logger[_0x8022('0x26')](_0x1a5722[_0x8022('0x32')]);if(_0x1a5722['name']){delete _0x1a5722['name'];}_0x1a74f2['status'](_0x1beac4)[_0x8022('0x33')](_0x1a5722);};}exports['index']=function(_0x157b4c,_0x489095){var _0x24e303={},_0x4210a6={},_0x3a9c54={'count':0x0,'rows':[]};var _0x1aac22=_[_0x8022('0x34')](db['FreshsalesAccount'][_0x8022('0x35')],function(_0x50a5d7){return{'name':_0x50a5d7[_0x8022('0x36')],'type':_0x50a5d7[_0x8022('0x37')][_0x8022('0x38')]};});_0x4210a6[_0x8022('0x39')]=_[_0x8022('0x34')](_0x1aac22,_0x8022('0x3a'));_0x4210a6[_0x8022('0x3b')]=_['keys'](_0x157b4c[_0x8022('0x3b')]);_0x4210a6[_0x8022('0x3c')]=_[_0x8022('0x3d')](_0x4210a6['model'],_0x4210a6['query']);_0x24e303['attributes']=_[_0x8022('0x3d')](_0x4210a6['model'],qs[_0x8022('0x3e')](_0x157b4c[_0x8022('0x3b')]['fields']));_0x24e303[_0x8022('0x3f')]=_0x24e303['attributes']['length']?_0x24e303[_0x8022('0x3f')]:_0x4210a6[_0x8022('0x39')];if(!_0x157b4c[_0x8022('0x3b')][_0x8022('0x40')]('nolimit')){_0x24e303[_0x8022('0x2d')]=qs[_0x8022('0x2d')](_0x157b4c[_0x8022('0x3b')][_0x8022('0x2d')]);_0x24e303[_0x8022('0x2c')]=qs[_0x8022('0x2c')](_0x157b4c[_0x8022('0x3b')][_0x8022('0x2c')]);}_0x24e303[_0x8022('0x41')]=qs[_0x8022('0x42')](_0x157b4c[_0x8022('0x3b')]['sort']);_0x24e303[_0x8022('0x43')]=qs['filters'](_[_0x8022('0x44')](_0x157b4c[_0x8022('0x3b')],_0x4210a6[_0x8022('0x3c')]),_0x1aac22);if(_0x157b4c['query']['filter']){_0x24e303[_0x8022('0x43')]=_[_0x8022('0x45')](_0x24e303[_0x8022('0x43')],{'$or':_['map'](_0x1aac22,function(_0x513ca0){if(_0x513ca0[_0x8022('0x37')]!==_0x8022('0x46')){var _0x48ab8b={};_0x48ab8b[_0x513ca0[_0x8022('0x3a')]]={'$like':'%'+_0x157b4c['query']['filter']+'%'};return _0x48ab8b;}})});}_0x24e303=_[_0x8022('0x45')]({},_0x24e303,_0x157b4c['options']);var _0x35ff0e={'where':_0x24e303[_0x8022('0x43')]};return db['FreshsalesAccount'][_0x8022('0x47')](_0x35ff0e)[_0x8022('0x1f')](function(_0x242e07){_0x3a9c54[_0x8022('0x47')]=_0x242e07;if(_0x157b4c[_0x8022('0x3b')][_0x8022('0x48')]){_0x24e303['include']=[{'all':!![]}];}return db[_0x8022('0x49')]['findAll'](_0x24e303);})['then'](function(_0x1ffb5d){_0x3a9c54[_0x8022('0x4a')]=_0x1ffb5d;return _0x3a9c54;})[_0x8022('0x1f')](respondWithFilteredResult(_0x489095,_0x24e303))[_0x8022('0x4b')](handleError(_0x489095,null));};exports[_0x8022('0x4c')]=function(_0x4b66d9,_0x516a0c){var _0x2cbe85={'raw':![],'where':{'id':_0x4b66d9[_0x8022('0x4d')]['id']}},_0x245d81={};_0x245d81[_0x8022('0x39')]=_[_0x8022('0x4e')](db['FreshsalesAccount']['rawAttributes']);_0x245d81['query']=_[_0x8022('0x4e')](_0x4b66d9[_0x8022('0x3b')]);_0x245d81[_0x8022('0x3c')]=_[_0x8022('0x3d')](_0x245d81[_0x8022('0x39')],_0x245d81['query']);_0x2cbe85[_0x8022('0x3f')]=_[_0x8022('0x3d')](_0x245d81[_0x8022('0x39')],qs[_0x8022('0x3e')](_0x4b66d9[_0x8022('0x3b')][_0x8022('0x3e')]));_0x2cbe85[_0x8022('0x3f')]=_0x2cbe85[_0x8022('0x3f')]['length']?_0x2cbe85[_0x8022('0x3f')]:_0x245d81[_0x8022('0x39')];if(_0x4b66d9[_0x8022('0x3b')][_0x8022('0x48')]){_0x2cbe85[_0x8022('0x4f')]=[{'all':!![]}];}_0x2cbe85=_['merge']({},_0x2cbe85,_0x4b66d9[_0x8022('0x50')]);return db[_0x8022('0x49')][_0x8022('0x51')](_0x2cbe85)['then'](handleEntityNotFound(_0x516a0c,null))[_0x8022('0x1f')](respondWithResult(_0x516a0c,null))[_0x8022('0x4b')](handleError(_0x516a0c,null));};exports[_0x8022('0x52')]=function(_0x5053d8,_0x5fd0b2){return db[_0x8022('0x49')]['create'](_0x5053d8[_0x8022('0x53')],{})['then'](respondWithResult(_0x5fd0b2,0xc9))[_0x8022('0x4b')](handleError(_0x5fd0b2,null));};exports[_0x8022('0x30')]=function(_0x483bb7,_0x5136a0){if(_0x483bb7[_0x8022('0x53')]['id']){delete _0x483bb7[_0x8022('0x53')]['id'];}return db[_0x8022('0x49')][_0x8022('0x51')]({'where':{'id':_0x483bb7[_0x8022('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5136a0,null))[_0x8022('0x1f')](saveUpdates(_0x483bb7['body'],null))[_0x8022('0x1f')](respondWithResult(_0x5136a0,null))[_0x8022('0x4b')](handleError(_0x5136a0,null));};exports[_0x8022('0x54')]=function(_0x275e53,_0x349cc9){return db[_0x8022('0x49')][_0x8022('0x51')]({'where':{'id':_0x275e53[_0x8022('0x4d')]['id']}})[_0x8022('0x1f')](handleEntityNotFound(_0x349cc9,null))[_0x8022('0x1f')](removeEntity(_0x349cc9,null))[_0x8022('0x4b')](handleError(_0x349cc9,null));};exports['getConfigurations']=function(_0x482200,_0x3c7d21,_0x48d8c4){var _0x46ff26={};var _0x572a9d={};var _0x54f290;var _0x94fb78;return db[_0x8022('0x49')][_0x8022('0x55')]({'where':{'id':_0x482200[_0x8022('0x4d')]['id']}})[_0x8022('0x1f')](handleEntityNotFound(_0x3c7d21,null))['then'](function(_0x5e6aaa){if(_0x5e6aaa){_0x54f290=_0x5e6aaa;_0x572a9d[_0x8022('0x39')]=_['keys'](db[_0x8022('0x56')][_0x8022('0x35')]);_0x572a9d[_0x8022('0x3b')]=_[_0x8022('0x4e')](_0x482200[_0x8022('0x3b')]);_0x572a9d[_0x8022('0x3c')]=_['intersection'](_0x572a9d['model'],_0x572a9d['query']);_0x46ff26[_0x8022('0x3f')]=_[_0x8022('0x3d')](_0x572a9d[_0x8022('0x39')],qs[_0x8022('0x3e')](_0x482200[_0x8022('0x3b')][_0x8022('0x3e')]));_0x46ff26[_0x8022('0x3f')]=_0x46ff26[_0x8022('0x3f')][_0x8022('0x57')]?_0x46ff26['attributes']:_0x572a9d[_0x8022('0x39')];_0x46ff26['order']=qs[_0x8022('0x42')](_0x482200[_0x8022('0x3b')][_0x8022('0x42')]);_0x46ff26[_0x8022('0x43')]=qs['filters'](_[_0x8022('0x44')](_0x482200[_0x8022('0x3b')],_0x572a9d[_0x8022('0x3c')]));if(_0x482200[_0x8022('0x3b')][_0x8022('0x58')]){_0x46ff26[_0x8022('0x43')]=_['merge'](_0x46ff26['where'],{'$or':_[_0x8022('0x34')](_0x46ff26[_0x8022('0x3f')],function(_0x6b1cb5){var _0xb3fff={};_0xb3fff[_0x6b1cb5]={'$like':'%'+_0x482200[_0x8022('0x3b')]['filter']+'%'};return _0xb3fff;})});}_0x46ff26=_[_0x8022('0x45')]({},_0x46ff26,_0x482200[_0x8022('0x50')]);return _0x54f290['getConfigurations'](_0x46ff26);}})[_0x8022('0x1f')](function(_0xa1bbdb){if(_0xa1bbdb){_0x94fb78=_0xa1bbdb['length'];if(!_0x482200[_0x8022('0x3b')][_0x8022('0x40')](_0x8022('0x59'))){_0x46ff26[_0x8022('0x2d')]=qs[_0x8022('0x2d')](_0x482200[_0x8022('0x3b')]['limit']);_0x46ff26[_0x8022('0x2c')]=qs[_0x8022('0x2c')](_0x482200[_0x8022('0x3b')][_0x8022('0x2c')]);}return _0x54f290['getConfigurations'](_0x46ff26);}})['then'](function(_0x382f92){if(_0x382f92){return _0x382f92?{'count':_0x94fb78,'rows':_0x382f92}:null;}})['then'](respondWithResult(_0x3c7d21,null))[_0x8022('0x4b')](handleError(_0x3c7d21,null));};exports[_0x8022('0x5a')]=function(_0x52550b,_0x23e10f,_0x20361e){if(_0x52550b[_0x8022('0x53')]['id']){delete _0x52550b['body']['id'];}return db[_0x8022('0x49')]['findOne']({'where':{'id':_0x52550b[_0x8022('0x4d')]['id']}})[_0x8022('0x1f')](handleEntityNotFound(_0x23e10f,null))['then'](function(_0x140a45){if(_0x140a45){_0x52550b[_0x8022('0x53')][_0x8022('0x5b')]=_0x140a45['id'];_0x52550b[_0x8022('0x53')][_0x8022('0x5c')]=integrations[_0x8022('0x5d')](_0x52550b[_0x8022('0x53')][_0x8022('0x5e')],_0x52550b[_0x8022('0x53')][_0x8022('0x37')]);_0x52550b[_0x8022('0x53')][_0x8022('0x5f')]=integrations[_0x8022('0x60')](_0x52550b[_0x8022('0x53')][_0x8022('0x5e')],_0x52550b[_0x8022('0x53')][_0x8022('0x37')]);return db[_0x8022('0x56')]['create'](_0x52550b[_0x8022('0x53')],{'include':[{'model':db[_0x8022('0x61')],'as':'Subjects'},{'model':db[_0x8022('0x61')],'as':_0x8022('0x5f')}]});}return null;})[_0x8022('0x1f')](respondWithResult(_0x23e10f,null))['catch'](handleError(_0x23e10f,null));};exports[_0x8022('0x62')]=function(_0x2bac10,_0x72a8ee,_0x2e8e7b){var _0x96b239='';var _0x334938='';return db['FreshsalesAccount'][_0x8022('0x55')]({'where':{'id':_0x2bac10[_0x8022('0x4d')]['id']},'attributes':['id',_0x8022('0x63'),_0x8022('0x64'),_0x8022('0x65')]})['then'](handleEntityNotFound(_0x72a8ee,null))['then'](function(_0x23f264){if(_0x23f264){_0x334938=_0x23f264[_0x8022('0x63')];_0x96b239=_0x23f264[_0x8022('0x64')];var _0x4a3e1f=_0x23f264[_0x8022('0x64')][_0x8022('0x66')](-0x1);if(_0x4a3e1f==='/'){_0x96b239=_0x96b239[_0x8022('0x67')](0x0,_0x96b239[_0x8022('0x68')](_0x4a3e1f));}return rp({'method':_0x8022('0x69'),'uri':util[_0x8022('0x6a')]('%s%s',_0x96b239,_0x8022('0x6b')),'headers':{'Authorization':_0x8022('0x6c')+_0x23f264[_0x8022('0x65')]},'json':!![]});}})[_0x8022('0x1f')](function(_0x51969f){if(_0x51969f){var _0x2eaffd=_0x51969f[_0x8022('0x6d')];var _0x233362=![];var _0x381dd3=null;for(_0x381dd3=0x0;_0x381dd3<_0x2eaffd['length'];_0x381dd3++){if(_0x2eaffd[_0x381dd3][_0x8022('0x6e')]===_0x334938){_0x233362=!![];}}if(_0x233362){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x8022('0x6f')});}}})['then'](respondWithResult(_0x72a8ee,null))['catch'](function(_0x8a62d2){var _0x8e7bba=_0x2bac10[_0x8022('0x3b')][_0x8022('0x70')]?0x1f4:_0x8a62d2[_0x8022('0x71')]||0x1f4;logger[_0x8022('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x8022('0x62'),_0x8e7bba,JSON[_0x8022('0x25')](_0x8a62d2));delete _0x8a62d2[_0x8022('0x3a')];if(_0x8e7bba===0x191){_0x8e7bba=0x190;}_0x72a8ee[_0x8022('0x2a')](_0x8e7bba)[_0x8022('0x33')](_0x2bac10[_0x8022('0x3b')]['test']?{'message':_0x8022('0x72'),'statusCode':_0x8a62d2['statusCode']}:_0x8a62d2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9a7546e..fcfe2c2 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 _0x4bc3=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x4bc3,0x16e));var _0x34bc=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x4bc3[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));var integrations=require(_0x34bc('0x9'));module[_0x34bc('0xa')]=function(_0x4c63a1,_0x21451b){return _0x4c63a1['define']('FreshsalesAccount',attributes,{'tableName':_0x34bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x826a=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise','path','rimraf'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x826a,0x1aa));var _0xa826=function(_0x30ffad,_0x3fbd88){_0x30ffad=_0x30ffad-0x0;var _0x559364=_0x826a[_0x30ffad];return _0x559364;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var logger=require('../../config/logger')(_0xa826('0x1'));var moment=require('moment');var BPromise=require(_0xa826('0x2'));var rp=require(_0xa826('0x3'));var fs=require('fs');var path=require(_0xa826('0x4'));var rimraf=require(_0xa826('0x5'));var config=require('../../config/environment');var attributes=require(_0xa826('0x6'));var integrations=require(_0xa826('0x7'));module[_0xa826('0x8')]=function(_0x34327b,_0x45154f){return _0x34327b[_0xa826('0x9')](_0xa826('0xa'),attributes,{'tableName':_0xa826('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index bd69012..2ab9701 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 _0x5ea2=['client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','limit','include','attributes','model','map','find','raw','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x15852b,_0xe912b5){var _0x440508=function(_0xf417da){while(--_0xf417da){_0x15852b['push'](_0x15852b['shift']());}};_0x440508(++_0xe912b5);}(_0x5ea2,0x99));var _0x25ea=function(_0xbd5396,_0x1e2044){_0xbd5396=_0xbd5396-0x0;var _0x38853e=_0x5ea2[_0xbd5396];return _0x38853e;};'use strict';var _=require(_0x25ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x25ea('0x1'));var rs=require(_0x25ea('0x2'));var fs=require('fs');var Redis=require(_0x25ea('0x3'));var db=require(_0x25ea('0x4'))['db'];var utils=require(_0x25ea('0x5'));var logger=require('../../config/logger')(_0x25ea('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25ea('0x7')][_0x25ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ca48f,_0x214ed8,_0x274f48){return new BPromise(function(_0x254d54,_0x1c5b5d){return client[_0x25ea('0x9')](_0x3ca48f,_0x274f48)[_0x25ea('0xa')](function(_0x52b281){logger[_0x25ea('0xb')](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));logger[_0x25ea('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x214ed8,_0x25ea('0xd'),JSON[_0x25ea('0xf')](_0x52b281));if(_0x52b281[_0x25ea('0x10')]){if(_0x52b281[_0x25ea('0x10')][_0x25ea('0x11')]===0x1f4){logger[_0x25ea('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x214ed8,_0x52b281['error'][_0x25ea('0x12')]);return _0x1c5b5d(_0x52b281[_0x25ea('0x10')]['message']);}logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);return _0x254d54(_0x52b281[_0x25ea('0x10')][_0x25ea('0x12')]);}else{logger['info'](_0x25ea('0xc'),_0x214ed8,_0x25ea('0xd'));_0x254d54(_0x52b281['result'][_0x25ea('0x12')]);}})[_0x25ea('0x13')](function(_0x111c5b){logger[_0x25ea('0x10')](_0x25ea('0xc'),_0x214ed8,_0x111c5b);_0x1c5b5d(_0x111c5b);});});}exports[_0x25ea('0x14')]=function(_0x586d4d){var _0x29878b=this;return new Promise(function(_0x454b8e,_0x3b327e){return db[_0x25ea('0x15')][_0x25ea('0x16')]({'raw':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')]['where']||null:null,'attributes':_0x586d4d[_0x25ea('0x17')]?_0x586d4d['options']['attributes']||null:null,'limit':_0x586d4d[_0x25ea('0x17')]?_0x586d4d['options'][_0x25ea('0x18')]||null:null,'include':_0x586d4d[_0x25ea('0x17')]?_0x586d4d[_0x25ea('0x17')][_0x25ea('0x19')]?_['map'](_0x586d4d[_0x25ea('0x17')][_0x25ea('0x19')],function(_0xf34d84){return{'model':db[_0xf34d84['model']],'as':_0xf34d84['as'],'attributes':_0xf34d84[_0x25ea('0x1a')],'include':_0xf34d84[_0x25ea('0x19')]?_['map'](_0xf34d84[_0x25ea('0x19')],function(_0x2b5351){return{'model':db[_0x2b5351[_0x25ea('0x1b')]],'as':_0x2b5351['as'],'attributes':_0x2b5351[_0x25ea('0x1a')],'include':_0x2b5351[_0x25ea('0x19')]?_[_0x25ea('0x1c')](_0x2b5351[_0x25ea('0x19')],function(_0x20c65b){return{'model':db[_0x20c65b[_0x25ea('0x1b')]],'as':_0x20c65b['as'],'attributes':_0x20c65b[_0x25ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x25ea('0xa')](function(_0x12e061){logger[_0x25ea('0xb')](_0x25ea('0x14'),_0x586d4d);logger[_0x25ea('0xe')](_0x25ea('0x14'),_0x586d4d,JSON['stringify'](_0x12e061));_0x454b8e(_0x12e061);})['catch'](function(_0x3599c3){logger[_0x25ea('0x10')]('GetFreshsalesAccount',_0x3599c3[_0x25ea('0x12')],_0x586d4d);_0x3b327e(_0x29878b[_0x25ea('0x10')](0x1f4,_0x3599c3[_0x25ea('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x54459c){var _0x9b5919=this;return new Promise(function(_0x2a71aa,_0x51e3ee){return db[_0x25ea('0x15')][_0x25ea('0x1d')]({'raw':_0x54459c['options']?_0x54459c[_0x25ea('0x17')][_0x25ea('0x1e')]===undefined?!![]:![]:!![],'where':_0x54459c[_0x25ea('0x17')]?_0x54459c[_0x25ea('0x17')]['where']||null:null,'attributes':_0x54459c[_0x25ea('0x17')]?_0x54459c['options'][_0x25ea('0x1a')]||null:null,'include':_0x54459c[_0x25ea('0x17')]?_0x54459c[_0x25ea('0x17')][_0x25ea('0x19')]?_['map'](_0x54459c['options'][_0x25ea('0x19')],function(_0x4bed9e){return{'model':db[_0x4bed9e[_0x25ea('0x1b')]],'as':_0x4bed9e['as'],'attributes':_0x4bed9e[_0x25ea('0x1a')],'include':_0x4bed9e['include']?_[_0x25ea('0x1c')](_0x4bed9e['include'],function(_0x54e37c){return{'model':db[_0x54e37c[_0x25ea('0x1b')]],'as':_0x54e37c['as'],'attributes':_0x54e37c[_0x25ea('0x1a')],'include':_0x54e37c[_0x25ea('0x19')]?_[_0x25ea('0x1c')](_0x54e37c[_0x25ea('0x19')],function(_0x22ea49){return{'model':db[_0x22ea49['model']],'as':_0x22ea49['as'],'attributes':_0x22ea49['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da04e){logger[_0x25ea('0xb')](_0x25ea('0x1f'),_0x54459c);logger[_0x25ea('0xe')](_0x25ea('0x1f'),_0x54459c,JSON['stringify'](_0x1da04e));_0x2a71aa(_0x1da04e);})[_0x25ea('0x13')](function(_0x2ecbf8){logger[_0x25ea('0x10')](_0x25ea('0x1f'),_0x2ecbf8[_0x25ea('0x12')],_0x54459c);_0x51e3ee(_0x9b5919['error'](0x1f4,_0x2ecbf8[_0x25ea('0x12')]));});});}; \ No newline at end of file +var _0xa613=['jayson/promise','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','debug','ShowFreshsalesAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x175697,_0x8c0f37){var _0x14493c=function(_0x19a55d){while(--_0x19a55d){_0x175697['push'](_0x175697['shift']());}};_0x14493c(++_0x8c0f37);}(_0xa613,0x8a));var _0x3a61=function(_0x1e6e99,_0xd3bb5f){_0x1e6e99=_0x1e6e99-0x0;var _0x6b6ca8=_0xa613[_0x1e6e99];return _0x6b6ca8;};'use strict';var _=require(_0x3a61('0x0'));var util=require('util');var moment=require(_0x3a61('0x1'));var BPromise=require(_0x3a61('0x2'));var rs=require(_0x3a61('0x3'));var fs=require('fs');var Redis=require(_0x3a61('0x4'));var db=require(_0x3a61('0x5'))['db'];var utils=require(_0x3a61('0x6'));var logger=require(_0x3a61('0x7'))(_0x3a61('0x8'));var config=require(_0x3a61('0x9'));var jayson=require(_0x3a61('0xa'));var client=jayson['client'][_0x3a61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25bb94,_0x5ba604,_0xcb9ceb){return new BPromise(function(_0x255a69,_0x3c7bdd){return client[_0x3a61('0xc')](_0x25bb94,_0xcb9ceb)[_0x3a61('0xd')](function(_0x538238){logger[_0x3a61('0xe')](_0x3a61('0xf'),_0x5ba604,'request\x20sent');logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5ba604,_0x3a61('0x10'),JSON[_0x3a61('0x11')](_0x538238));if(_0x538238['error']){if(_0x538238[_0x3a61('0x12')][_0x3a61('0x13')]===0x1f4){logger[_0x3a61('0x12')](_0x3a61('0xf'),_0x5ba604,_0x538238[_0x3a61('0x12')][_0x3a61('0x14')]);return _0x3c7bdd(_0x538238['error']['message']);}logger[_0x3a61('0x12')](_0x3a61('0xf'),_0x5ba604,_0x538238[_0x3a61('0x12')][_0x3a61('0x14')]);return _0x255a69(_0x538238[_0x3a61('0x12')]['message']);}else{logger['info'](_0x3a61('0xf'),_0x5ba604,'request\x20sent');_0x255a69(_0x538238[_0x3a61('0x15')]['message']);}})[_0x3a61('0x16')](function(_0x29d99a){logger['error'](_0x3a61('0xf'),_0x5ba604,_0x29d99a);_0x3c7bdd(_0x29d99a);});});}exports['GetFreshsalesAccount']=function(_0x24e4e6){var _0x57e816=this;return new Promise(function(_0x94bdcb,_0x52da1b){return db[_0x3a61('0x17')][_0x3a61('0x18')]({'raw':_0x24e4e6[_0x3a61('0x19')]?_0x24e4e6[_0x3a61('0x19')][_0x3a61('0x1a')]===undefined?!![]:![]:!![],'where':_0x24e4e6[_0x3a61('0x19')]?_0x24e4e6[_0x3a61('0x19')][_0x3a61('0x1b')]||null:null,'attributes':_0x24e4e6[_0x3a61('0x19')]?_0x24e4e6[_0x3a61('0x19')][_0x3a61('0x1c')]||null:null,'limit':_0x24e4e6[_0x3a61('0x19')]?_0x24e4e6[_0x3a61('0x19')][_0x3a61('0x1d')]||null:null,'include':_0x24e4e6[_0x3a61('0x19')]?_0x24e4e6['options'][_0x3a61('0x1e')]?_[_0x3a61('0x1f')](_0x24e4e6[_0x3a61('0x19')][_0x3a61('0x1e')],function(_0x5aaf73){return{'model':db[_0x5aaf73[_0x3a61('0x20')]],'as':_0x5aaf73['as'],'attributes':_0x5aaf73['attributes'],'include':_0x5aaf73[_0x3a61('0x1e')]?_[_0x3a61('0x1f')](_0x5aaf73[_0x3a61('0x1e')],function(_0x378ea7){return{'model':db[_0x378ea7[_0x3a61('0x20')]],'as':_0x378ea7['as'],'attributes':_0x378ea7[_0x3a61('0x1c')],'include':_0x378ea7[_0x3a61('0x1e')]?_[_0x3a61('0x1f')](_0x378ea7[_0x3a61('0x1e')],function(_0x1e33f3){return{'model':db[_0x1e33f3[_0x3a61('0x20')]],'as':_0x1e33f3['as'],'attributes':_0x1e33f3[_0x3a61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a61('0xd')](function(_0x3ee46a){logger[_0x3a61('0xe')](_0x3a61('0x21'),_0x24e4e6);logger[_0x3a61('0x22')](_0x3a61('0x21'),_0x24e4e6,JSON[_0x3a61('0x11')](_0x3ee46a));_0x94bdcb(_0x3ee46a);})[_0x3a61('0x16')](function(_0x4d572a){logger[_0x3a61('0x12')](_0x3a61('0x21'),_0x4d572a[_0x3a61('0x14')],_0x24e4e6);_0x52da1b(_0x57e816[_0x3a61('0x12')](0x1f4,_0x4d572a[_0x3a61('0x14')]));});});};exports[_0x3a61('0x23')]=function(_0x1484e4){var _0x10b23c=this;return new Promise(function(_0x18aa79,_0x1be408){return db[_0x3a61('0x17')][_0x3a61('0x24')]({'raw':_0x1484e4['options']?_0x1484e4[_0x3a61('0x19')][_0x3a61('0x1a')]===undefined?!![]:![]:!![],'where':_0x1484e4[_0x3a61('0x19')]?_0x1484e4[_0x3a61('0x19')][_0x3a61('0x1b')]||null:null,'attributes':_0x1484e4['options']?_0x1484e4[_0x3a61('0x19')]['attributes']||null:null,'include':_0x1484e4[_0x3a61('0x19')]?_0x1484e4[_0x3a61('0x19')][_0x3a61('0x1e')]?_[_0x3a61('0x1f')](_0x1484e4[_0x3a61('0x19')]['include'],function(_0x194428){return{'model':db[_0x194428['model']],'as':_0x194428['as'],'attributes':_0x194428[_0x3a61('0x1c')],'include':_0x194428[_0x3a61('0x1e')]?_['map'](_0x194428[_0x3a61('0x1e')],function(_0x38c64d){return{'model':db[_0x38c64d[_0x3a61('0x20')]],'as':_0x38c64d['as'],'attributes':_0x38c64d['attributes'],'include':_0x38c64d[_0x3a61('0x1e')]?_[_0x3a61('0x1f')](_0x38c64d[_0x3a61('0x1e')],function(_0x2485e4){return{'model':db[_0x2485e4[_0x3a61('0x20')]],'as':_0x2485e4['as'],'attributes':_0x2485e4[_0x3a61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3a61('0xd')](function(_0x1be402){logger[_0x3a61('0xe')](_0x3a61('0x23'),_0x1484e4);logger[_0x3a61('0x22')]('ShowFreshsalesAccount',_0x1484e4,JSON[_0x3a61('0x11')](_0x1be402));_0x18aa79(_0x1be402);})[_0x3a61('0x16')](function(_0x534a01){logger[_0x3a61('0x12')]('ShowFreshsalesAccount',_0x534a01[_0x3a61('0x14')],_0x1484e4);_0x1be408(_0x10b23c[_0x3a61('0x12')](0x1f4,_0x534a01[_0x3a61('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index daea7ab..263993b 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 _0x7f39=['create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSubjects','/:id/fields','getFields','post'];(function(_0x30270c,_0x54e186){var _0x17cc89=function(_0x2d31d5){while(--_0x2d31d5){_0x30270c['push'](_0x30270c['shift']());}};_0x17cc89(++_0x54e186);}(_0x7f39,0xcb));var _0x97f3=function(_0x466e89,_0x237ae3){_0x466e89=_0x466e89-0x0;var _0x580986=_0x7f39[_0x466e89];return _0x580986;};'use strict';var multer=require(_0x97f3('0x0'));var util=require(_0x97f3('0x1'));var path=require('path');var timeout=require(_0x97f3('0x2'));var express=require(_0x97f3('0x3'));var router=express[_0x97f3('0x4')]();var auth=require(_0x97f3('0x5'));var interaction=require(_0x97f3('0x6'));var config=require(_0x97f3('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x97f3('0x8')]('/',auth[_0x97f3('0x9')](),controller[_0x97f3('0xa')]);router[_0x97f3('0x8')](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x97f3('0xd')]);router[_0x97f3('0x8')]('/:id/descriptions',auth[_0x97f3('0x9')](),controller['getDescriptions']);router[_0x97f3('0x8')](_0x97f3('0xe'),auth[_0x97f3('0x9')](),controller[_0x97f3('0xf')]);router[_0x97f3('0x10')]('/',auth[_0x97f3('0x9')](),controller[_0x97f3('0x11')]);router['put'](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0x12')]);router[_0x97f3('0x13')](_0x97f3('0xb'),auth[_0x97f3('0x9')](),controller[_0x97f3('0x14')]);module[_0x97f3('0x15')]=router; \ No newline at end of file +var _0x59e6=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','getSubjects','/:id/descriptions','getDescriptions','getFields','create','update','delete'];(function(_0x507240,_0x445436){var _0x3ca4e5=function(_0xc0cfae){while(--_0xc0cfae){_0x507240['push'](_0x507240['shift']());}};_0x3ca4e5(++_0x445436);}(_0x59e6,0xa3));var _0x659e=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x59e6[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x659e('0x0'));var util=require(_0x659e('0x1'));var path=require(_0x659e('0x2'));var timeout=require(_0x659e('0x3'));var express=require(_0x659e('0x4'));var router=express[_0x659e('0x5')]();var auth=require(_0x659e('0x6'));var interaction=require(_0x659e('0x7'));var config=require(_0x659e('0x8'));var controller=require(_0x659e('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x659e('0xa')](_0x659e('0xb'),auth[_0x659e('0xc')](),controller[_0x659e('0xd')]);router[_0x659e('0xa')]('/:id/subjects',auth[_0x659e('0xc')](),controller[_0x659e('0xe')]);router[_0x659e('0xa')](_0x659e('0xf'),auth['isAuthenticated'](),controller[_0x659e('0x10')]);router[_0x659e('0xa')]('/:id/fields',auth[_0x659e('0xc')](),controller[_0x659e('0x11')]);router['post']('/',auth[_0x659e('0xc')](),controller[_0x659e('0x12')]);router['put'](_0x659e('0xb'),auth[_0x659e('0xc')](),controller[_0x659e('0x13')]);router[_0x659e('0x14')](_0x659e('0xb'),auth[_0x659e('0xc')](),controller[_0x659e('0x15')]);module[_0x659e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 31d6e14..1b70a0c 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 _0xc2ae=['STRING','sequelize','exports'];(function(_0x3aeb17,_0x2fb375){var _0x3e4ac3=function(_0x2ef73e){while(--_0x2ef73e){_0x3aeb17['push'](_0x3aeb17['shift']());}};_0x3e4ac3(++_0x2fb375);}(_0xc2ae,0x184));var _0xec2a=function(_0x44cb05,_0x260296){_0x44cb05=_0x44cb05-0x0;var _0x1f3e80=_0xc2ae[_0x44cb05];return _0x1f3e80;};'use strict';var Sequelize=require(_0xec2a('0x0'));module[_0xec2a('0x1')]={'name':{'type':Sequelize[_0xec2a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5af5=['exports','STRING','sequelize'];(function(_0xe2ee23,_0x4fbdde){var _0x2ae642=function(_0x9a3dc8){while(--_0x9a3dc8){_0xe2ee23['push'](_0xe2ee23['shift']());}};_0x2ae642(++_0x4fbdde);}(_0x5af5,0x6e));var _0x55af=function(_0x2005b6,_0x5c7f29){_0x2005b6=_0x2005b6-0x0;var _0x7da11e=_0x5af5[_0x2005b6];return _0x7da11e;};'use strict';var Sequelize=require(_0x55af('0x0'));module[_0x55af('0x1')]={'name':{'type':Sequelize[_0x55af('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 dccae20..5ba94d3 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 _0x6513=['params','findOne','FreshsalesField','order','options','getSubjects','nolimit','getDescriptions','pick','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','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','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','fields','find','create','body'];(function(_0x264744,_0x3be9c9){var _0x547fcf=function(_0x351cd4){while(--_0x351cd4){_0x264744['push'](_0x264744['shift']());}};_0x547fcf(++_0x3be9c9);}(_0x6513,0xc8));var _0x3651=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x6513[_0x5beda8];return _0x2aa042;};'use strict';var pdf=require(_0x3651('0x0'));var emlformat=require(_0x3651('0x1'));var rimraf=require(_0x3651('0x2'));var zipdir=require(_0x3651('0x3'));var jsonpatch=require(_0x3651('0x4'));var rp=require(_0x3651('0x5'));var moment=require(_0x3651('0x6'));var BPromise=require(_0x3651('0x7'));var Mustache=require(_0x3651('0x8'));var util=require(_0x3651('0x9'));var path=require(_0x3651('0xa'));var sox=require('sox');var csv=require(_0x3651('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3651('0xc'));var squel=require(_0x3651('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3651('0xb'));var querystring=require(_0x3651('0xe'));var Papa=require(_0x3651('0xf'));var Redis=require(_0x3651('0x10'));var authService=require(_0x3651('0x11'));var qs=require(_0x3651('0x12'));var as=require(_0x3651('0x13'));var hardwareService=require(_0x3651('0x14'));var logger=require(_0x3651('0x15'))(_0x3651('0x16'));var utils=require(_0x3651('0x17'));var config=require(_0x3651('0x18'));var db=require(_0x3651('0x19'))['db'];var jayson=require(_0x3651('0x1a'));var client=jayson[_0x3651('0x1b')][_0x3651('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3c1c90,_0xac75a4,_0x2e885d){if(_0x2e885d){var _0x4b14d9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b14d9[_0x3651('0x1d')](_0xac75a4)){return _0x3c1c90;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x3c1c90;}}function respondWithRpcPromise(_0x4f1b67,_0x3f0dce,_0x242d61,_0x426629){return new BPromise(function(_0x5c2fb7,_0x2beac4){var _0x2e4313=_0x426629||client;return _0x2e4313['request'](_0x4f1b67,_0x242d61)[_0x3651('0x1e')](function(_0x5383c2){logger[_0x3651('0x1f')](_0x3651('0x20'),_0x3f0dce,_0x3651('0x21'));logger['debug'](_0x3651('0x22'),_0x3f0dce,_0x3651('0x21'),JSON[_0x3651('0x23')](_0x5383c2));if(_0x5383c2['error']){if(_0x5383c2[_0x3651('0x24')][_0x3651('0x25')]===0x1f4){logger[_0x3651('0x24')](_0x3651('0x20'),_0x3f0dce,_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);return _0x2beac4(_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);}logger['error'](_0x3651('0x20'),_0x3f0dce,_0x5383c2[_0x3651('0x24')][_0x3651('0x26')]);return _0x5c2fb7(_0x5383c2['error']['message']);}else{logger[_0x3651('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f0dce,_0x3651('0x21'));_0x5c2fb7(_0x5383c2[_0x3651('0x27')][_0x3651('0x26')]);}})[_0x3651('0x28')](function(_0x8f95ef){logger[_0x3651('0x24')](_0x3651('0x20'),_0x3f0dce,_0x8f95ef);_0x2beac4(_0x8f95ef);});});}function respondWithStatusCode(_0x47ca13,_0x44e523){_0x44e523=_0x44e523||0xcc;return function(_0x4d6940){if(_0x4d6940){return _0x47ca13['sendStatus'](_0x44e523);}return _0x47ca13[_0x3651('0x29')](_0x44e523)[_0x3651('0x2a')]();};}function respondWithResult(_0x219184,_0x1e2a22){_0x1e2a22=_0x1e2a22||0xc8;return function(_0x1da8a2){if(_0x1da8a2){return _0x219184['status'](_0x1e2a22)[_0x3651('0x2b')](_0x1da8a2);}};}function respondWithFilteredResult(_0x37b67d,_0x53f260){return function(_0x147780){if(_0x147780){var _0x3b18b1=_0x147780[_0x3651('0x2c')],_0x8011d8=_0x53f260[_0x3651('0x2d')],_0x53d59e=_0x53f260['offset']+_0x53f260[_0x3651('0x2e')],_0x548933;if(_0x53d59e>=_0x3b18b1){_0x53d59e=_0x3b18b1;_0x548933=0xc8;}else{_0x548933=0xce;}_0x37b67d[_0x3651('0x29')](_0x548933);return _0x37b67d[_0x3651('0x2f')](_0x3651('0x30'),_0x8011d8+'-'+_0x53d59e+'/'+_0x3b18b1)[_0x3651('0x2b')](_0x147780);}return null;};}function patchUpdates(_0x3ab390){return function(_0x600524){try{jsonpatch[_0x3651('0x31')](_0x600524,_0x3ab390,!![]);}catch(_0x5783ae){return BPromise[_0x3651('0x32')](_0x5783ae);}return _0x600524[_0x3651('0x33')]();};}function saveUpdates(_0x1ee7c0,_0x39b006){return function(_0x2cd25b){if(_0x2cd25b){return _0x2cd25b[_0x3651('0x34')](_0x1ee7c0)[_0x3651('0x1e')](function(_0x429e46){return _0x429e46;});}return null;};}function removeEntity(_0x508ac8,_0x434f79){return function(_0x129ee7){if(_0x129ee7){return _0x129ee7[_0x3651('0x35')]()[_0x3651('0x1e')](function(){_0x508ac8['status'](0xcc)[_0x3651('0x2a')]();});}};}function handleEntityNotFound(_0x439925,_0x2a309d){return function(_0x96a441){if(!_0x96a441){_0x439925[_0x3651('0x36')](0x194);}return _0x96a441;};}function handleError(_0x2ad34d,_0x5f46b4){_0x5f46b4=_0x5f46b4||0x1f4;return function(_0x2c6056){logger[_0x3651('0x24')](_0x2c6056[_0x3651('0x37')]);if(_0x2c6056[_0x3651('0x38')]){delete _0x2c6056[_0x3651('0x38')];}_0x2ad34d['status'](_0x5f46b4)['send'](_0x2c6056);};}exports[_0x3651('0x39')]=function(_0x13abc2,_0x5bb9c1){var _0x23543a={},_0x13c798={},_0x4787d8={'count':0x0,'rows':[]};var _0x25889e=_['map'](db[_0x3651('0x3a')][_0x3651('0x3b')],function(_0x5e0de1){return{'name':_0x5e0de1[_0x3651('0x3c')],'type':_0x5e0de1['type'][_0x3651('0x3d')]};});_0x13c798[_0x3651('0x3e')]=_[_0x3651('0x3f')](_0x25889e,_0x3651('0x38'));_0x13c798[_0x3651('0x40')]=_[_0x3651('0x41')](_0x13abc2[_0x3651('0x40')]);_0x13c798[_0x3651('0x42')]=_['intersection'](_0x13c798[_0x3651('0x3e')],_0x13c798[_0x3651('0x40')]);_0x23543a[_0x3651('0x43')]=_[_0x3651('0x44')](_0x13c798['model'],qs['fields'](_0x13abc2[_0x3651('0x40')]['fields']));_0x23543a['attributes']=_0x23543a[_0x3651('0x43')][_0x3651('0x45')]?_0x23543a['attributes']:_0x13c798[_0x3651('0x3e')];if(!_0x13abc2[_0x3651('0x40')][_0x3651('0x46')]('nolimit')){_0x23543a[_0x3651('0x2e')]=qs[_0x3651('0x2e')](_0x13abc2[_0x3651('0x40')][_0x3651('0x2e')]);_0x23543a[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x13abc2[_0x3651('0x40')][_0x3651('0x2d')]);}_0x23543a['order']=qs[_0x3651('0x47')](_0x13abc2[_0x3651('0x40')]['sort']);_0x23543a[_0x3651('0x48')]=qs['filters'](_['pick'](_0x13abc2['query'],_0x13c798['filters']),_0x25889e);if(_0x13abc2['query'][_0x3651('0x49')]){_0x23543a[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x23543a[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x25889e,function(_0x55a9e9){if(_0x55a9e9[_0x3651('0x4b')]!==_0x3651('0x4c')){var _0xb70b0e={};_0xb70b0e[_0x55a9e9['name']]={'$like':'%'+_0x13abc2[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0xb70b0e;}})});}_0x23543a=_[_0x3651('0x4a')]({},_0x23543a,_0x13abc2['options']);var _0x4be364={'where':_0x23543a[_0x3651('0x48')]};return db[_0x3651('0x3a')][_0x3651('0x2c')](_0x4be364)['then'](function(_0x267dbe){_0x4787d8[_0x3651('0x2c')]=_0x267dbe;if(_0x13abc2['query'][_0x3651('0x4d')]){_0x23543a[_0x3651('0x4e')]=[{'all':!![]}];}return db[_0x3651('0x3a')][_0x3651('0x4f')](_0x23543a);})['then'](function(_0x127d93){_0x4787d8[_0x3651('0x50')]=_0x127d93;return _0x4787d8;})[_0x3651('0x1e')](respondWithFilteredResult(_0x5bb9c1,_0x23543a))[_0x3651('0x28')](handleError(_0x5bb9c1,null));};exports['show']=function(_0x29299e,_0x37d631){var _0x468ba2={'raw':![],'where':{'id':_0x29299e['params']['id']}},_0x1c8d75={};_0x1c8d75[_0x3651('0x3e')]=_[_0x3651('0x41')](db['FreshsalesConfiguration'][_0x3651('0x3b')]);_0x1c8d75[_0x3651('0x40')]=_['keys'](_0x29299e[_0x3651('0x40')]);_0x1c8d75[_0x3651('0x42')]=_[_0x3651('0x44')](_0x1c8d75['model'],_0x1c8d75[_0x3651('0x40')]);_0x468ba2[_0x3651('0x43')]=_[_0x3651('0x44')](_0x1c8d75['model'],qs['fields'](_0x29299e[_0x3651('0x40')][_0x3651('0x51')]));_0x468ba2[_0x3651('0x43')]=_0x468ba2[_0x3651('0x43')]['length']?_0x468ba2[_0x3651('0x43')]:_0x1c8d75[_0x3651('0x3e')];if(_0x29299e['query'][_0x3651('0x4d')]){_0x468ba2[_0x3651('0x4e')]=[{'all':!![]}];}_0x468ba2=_['merge']({},_0x468ba2,_0x29299e['options']);return db[_0x3651('0x3a')][_0x3651('0x52')](_0x468ba2)['then'](handleEntityNotFound(_0x37d631,null))['then'](respondWithResult(_0x37d631,null))[_0x3651('0x28')](handleError(_0x37d631,null));};exports['create']=function(_0x516d3f,_0x2f479d){return db['FreshsalesConfiguration'][_0x3651('0x53')](_0x516d3f[_0x3651('0x54')],{})['then'](respondWithResult(_0x2f479d,0xc9))[_0x3651('0x28')](handleError(_0x2f479d,null));};exports['update']=function(_0x4565a5,_0x280851){if(_0x4565a5[_0x3651('0x54')]['id']){delete _0x4565a5[_0x3651('0x54')]['id'];}return db[_0x3651('0x3a')][_0x3651('0x52')]({'where':{'id':_0x4565a5['params']['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x280851,null))['then'](saveUpdates(_0x4565a5[_0x3651('0x54')],null))[_0x3651('0x1e')](respondWithResult(_0x280851,null))[_0x3651('0x28')](handleError(_0x280851,null));};exports[_0x3651('0x35')]=function(_0x39cfee,_0x3ce68b){return db['FreshsalesConfiguration'][_0x3651('0x52')]({'where':{'id':_0x39cfee[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x3ce68b,null))['then'](removeEntity(_0x3ce68b,null))[_0x3651('0x28')](handleError(_0x3ce68b,null));};exports['getSubjects']=function(_0x58c47a,_0x47484a,_0x323924){var _0x492549={};var _0x4d92bc={};var _0x20ae0e;var _0x46674e;return db[_0x3651('0x3a')][_0x3651('0x56')]({'where':{'id':_0x58c47a[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x47484a,null))[_0x3651('0x1e')](function(_0x1df85f){if(_0x1df85f){_0x20ae0e=_0x1df85f;_0x4d92bc[_0x3651('0x3e')]=_[_0x3651('0x41')](db[_0x3651('0x57')][_0x3651('0x3b')]);_0x4d92bc[_0x3651('0x40')]=_[_0x3651('0x41')](_0x58c47a[_0x3651('0x40')]);_0x4d92bc[_0x3651('0x42')]=_[_0x3651('0x44')](_0x4d92bc[_0x3651('0x3e')],_0x4d92bc['query']);_0x492549[_0x3651('0x43')]=_[_0x3651('0x44')](_0x4d92bc[_0x3651('0x3e')],qs[_0x3651('0x51')](_0x58c47a['query'][_0x3651('0x51')]));_0x492549[_0x3651('0x43')]=_0x492549[_0x3651('0x43')][_0x3651('0x45')]?_0x492549['attributes']:_0x4d92bc[_0x3651('0x3e')];_0x492549[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x58c47a[_0x3651('0x40')]['sort']);_0x492549[_0x3651('0x48')]=qs['filters'](_['pick'](_0x58c47a[_0x3651('0x40')],_0x4d92bc[_0x3651('0x42')]));if(_0x58c47a[_0x3651('0x40')]['filter']){_0x492549[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x492549['where'],{'$or':_['map'](_0x492549['attributes'],function(_0x4bd53d){var _0x1c52a3={};_0x1c52a3[_0x4bd53d]={'$like':'%'+_0x58c47a[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x1c52a3;})});}_0x492549=_[_0x3651('0x4a')]({},_0x492549,_0x58c47a[_0x3651('0x59')]);return _0x20ae0e[_0x3651('0x5a')](_0x492549);}})[_0x3651('0x1e')](function(_0x337cde){if(_0x337cde){_0x46674e=_0x337cde[_0x3651('0x45')];if(!_0x58c47a[_0x3651('0x40')][_0x3651('0x46')](_0x3651('0x5b'))){_0x492549['limit']=qs[_0x3651('0x2e')](_0x58c47a[_0x3651('0x40')][_0x3651('0x2e')]);_0x492549[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x58c47a[_0x3651('0x40')][_0x3651('0x2d')]);}return _0x20ae0e[_0x3651('0x5a')](_0x492549);}})[_0x3651('0x1e')](function(_0x3fe528){if(_0x3fe528){return _0x3fe528?{'count':_0x46674e,'rows':_0x3fe528}:null;}})[_0x3651('0x1e')](respondWithResult(_0x47484a,null))[_0x3651('0x28')](handleError(_0x47484a,null));};exports[_0x3651('0x5c')]=function(_0x1c013f,_0x201b7a,_0x1604a6){var _0x27d695={};var _0x5f0de9={};var _0x4154ca;var _0x343252;return db['FreshsalesConfiguration'][_0x3651('0x56')]({'where':{'id':_0x1c013f['params']['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x201b7a,null))[_0x3651('0x1e')](function(_0x3c9f61){if(_0x3c9f61){_0x4154ca=_0x3c9f61;_0x5f0de9[_0x3651('0x3e')]=_['keys'](db[_0x3651('0x57')][_0x3651('0x3b')]);_0x5f0de9[_0x3651('0x40')]=_[_0x3651('0x41')](_0x1c013f[_0x3651('0x40')]);_0x5f0de9[_0x3651('0x42')]=_[_0x3651('0x44')](_0x5f0de9[_0x3651('0x3e')],_0x5f0de9[_0x3651('0x40')]);_0x27d695[_0x3651('0x43')]=_[_0x3651('0x44')](_0x5f0de9['model'],qs[_0x3651('0x51')](_0x1c013f[_0x3651('0x40')]['fields']));_0x27d695['attributes']=_0x27d695[_0x3651('0x43')][_0x3651('0x45')]?_0x27d695[_0x3651('0x43')]:_0x5f0de9[_0x3651('0x3e')];_0x27d695[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x1c013f[_0x3651('0x40')][_0x3651('0x47')]);_0x27d695[_0x3651('0x48')]=qs[_0x3651('0x42')](_[_0x3651('0x5d')](_0x1c013f[_0x3651('0x40')],_0x5f0de9[_0x3651('0x42')]));if(_0x1c013f[_0x3651('0x40')][_0x3651('0x49')]){_0x27d695[_0x3651('0x48')]=_[_0x3651('0x4a')](_0x27d695[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x27d695['attributes'],function(_0x1ecfd2){var _0x5ceb78={};_0x5ceb78[_0x1ecfd2]={'$like':'%'+_0x1c013f[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x5ceb78;})});}_0x27d695=_['merge']({},_0x27d695,_0x1c013f['options']);return _0x4154ca[_0x3651('0x5c')](_0x27d695);}})[_0x3651('0x1e')](function(_0x10a475){if(_0x10a475){_0x343252=_0x10a475['length'];if(!_0x1c013f[_0x3651('0x40')]['hasOwnProperty'](_0x3651('0x5b'))){_0x27d695[_0x3651('0x2e')]=qs[_0x3651('0x2e')](_0x1c013f['query'][_0x3651('0x2e')]);_0x27d695[_0x3651('0x2d')]=qs['offset'](_0x1c013f[_0x3651('0x40')][_0x3651('0x2d')]);}return _0x4154ca[_0x3651('0x5c')](_0x27d695);}})[_0x3651('0x1e')](function(_0x543e71){if(_0x543e71){return _0x543e71?{'count':_0x343252,'rows':_0x543e71}:null;}})[_0x3651('0x1e')](respondWithResult(_0x201b7a,null))['catch'](handleError(_0x201b7a,null));};exports['getFields']=function(_0x281daa,_0x2b745e,_0x4aa66c){var _0x4172b8={};var _0xc12c3a={};var _0x133f7e;var _0x2a263c;return db['FreshsalesConfiguration'][_0x3651('0x56')]({'where':{'id':_0x281daa[_0x3651('0x55')]['id']}})[_0x3651('0x1e')](handleEntityNotFound(_0x2b745e,null))[_0x3651('0x1e')](function(_0x3fb520){if(_0x3fb520){_0x133f7e=_0x3fb520;_0xc12c3a[_0x3651('0x3e')]=_[_0x3651('0x41')](db[_0x3651('0x57')][_0x3651('0x3b')]);_0xc12c3a[_0x3651('0x40')]=_[_0x3651('0x41')](_0x281daa['query']);_0xc12c3a[_0x3651('0x42')]=_[_0x3651('0x44')](_0xc12c3a[_0x3651('0x3e')],_0xc12c3a[_0x3651('0x40')]);_0x4172b8['attributes']=_[_0x3651('0x44')](_0xc12c3a[_0x3651('0x3e')],qs[_0x3651('0x51')](_0x281daa['query'][_0x3651('0x51')]));_0x4172b8['attributes']=_0x4172b8[_0x3651('0x43')][_0x3651('0x45')]?_0x4172b8[_0x3651('0x43')]:_0xc12c3a['model'];_0x4172b8[_0x3651('0x58')]=qs[_0x3651('0x47')](_0x281daa['query'][_0x3651('0x47')]);_0x4172b8['where']=qs['filters'](_['pick'](_0x281daa[_0x3651('0x40')],_0xc12c3a[_0x3651('0x42')]));if(_0x281daa[_0x3651('0x40')][_0x3651('0x49')]){_0x4172b8[_0x3651('0x48')]=_['merge'](_0x4172b8[_0x3651('0x48')],{'$or':_[_0x3651('0x3f')](_0x4172b8[_0x3651('0x43')],function(_0x2b694b){var _0x40d5b6={};_0x40d5b6[_0x2b694b]={'$like':'%'+_0x281daa[_0x3651('0x40')][_0x3651('0x49')]+'%'};return _0x40d5b6;})});}_0x4172b8=_[_0x3651('0x4a')]({},_0x4172b8,_0x281daa[_0x3651('0x59')]);return _0x133f7e[_0x3651('0x5e')](_0x4172b8);}})[_0x3651('0x1e')](function(_0x571722){if(_0x571722){_0x2a263c=_0x571722[_0x3651('0x45')];if(!_0x281daa['query'][_0x3651('0x46')](_0x3651('0x5b'))){_0x4172b8['limit']=qs[_0x3651('0x2e')](_0x281daa[_0x3651('0x40')][_0x3651('0x2e')]);_0x4172b8[_0x3651('0x2d')]=qs[_0x3651('0x2d')](_0x281daa[_0x3651('0x40')]['offset']);}return _0x133f7e['getFields'](_0x4172b8);}})[_0x3651('0x1e')](function(_0x5cdb6b){if(_0x5cdb6b){return _0x5cdb6b?{'count':_0x2a263c,'rows':_0x5cdb6b}:null;}})[_0x3651('0x1e')](respondWithResult(_0x2b745e,null))['catch'](handleError(_0x2b745e,null));}; \ No newline at end of file +var _0xe2c7=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','limit','set','json','apply','reject','save','update','end','stack','name','send','map','FreshsalesConfiguration','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','offset','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getSubjects','findOne','order','nolimit','getDescriptions','pick','getFields','FreshsalesField','html-pdf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','test'];(function(_0x390637,_0x2ea5cf){var _0x35b5bb=function(_0x4ffff9){while(--_0x4ffff9){_0x390637['push'](_0x390637['shift']());}};_0x35b5bb(++_0x2ea5cf);}(_0xe2c7,0x17b));var _0x7e2c=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe2c7[_0x24237f];return _0x48298e;};'use strict';var pdf=require(_0x7e2c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e2c('0x2'));var moment=require(_0x7e2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7e2c('0x4'));var util=require('util');var path=require(_0x7e2c('0x5'));var sox=require('sox');var csv=require(_0x7e2c('0x6'));var ejs=require(_0x7e2c('0x7'));var fs=require('fs');var _=require(_0x7e2c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7e2c('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e2c('0xa'));var authService=require(_0x7e2c('0xb'));var qs=require(_0x7e2c('0xc'));var as=require(_0x7e2c('0xd'));var hardwareService=require(_0x7e2c('0xe'));var logger=require(_0x7e2c('0xf'))(_0x7e2c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7e2c('0x11'))['db'];var jayson=require(_0x7e2c('0x12'));var client=jayson[_0x7e2c('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x12c9e3,_0x56e9d7,_0x463339){if(_0x463339){var _0x4c147f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c147f[_0x7e2c('0x14')](_0x56e9d7)){return _0x12c9e3;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x12c9e3;}}function respondWithRpcPromise(_0x299162,_0x1a576a,_0x12a3f1,_0x38c706){return new BPromise(function(_0x2dd127,_0x4e6cbd){var _0x35d222=_0x38c706||client;return _0x35d222['request'](_0x299162,_0x12a3f1)[_0x7e2c('0x15')](function(_0x3dc687){logger[_0x7e2c('0x16')](_0x7e2c('0x17'),_0x1a576a,_0x7e2c('0x18'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1a576a,'request\x20sent',JSON['stringify'](_0x3dc687));if(_0x3dc687[_0x7e2c('0x19')]){if(_0x3dc687[_0x7e2c('0x19')]['code']===0x1f4){logger['error'](_0x7e2c('0x17'),_0x1a576a,_0x3dc687[_0x7e2c('0x19')][_0x7e2c('0x1a')]);return _0x4e6cbd(_0x3dc687[_0x7e2c('0x19')][_0x7e2c('0x1a')]);}logger['error'](_0x7e2c('0x17'),_0x1a576a,_0x3dc687[_0x7e2c('0x19')][_0x7e2c('0x1a')]);return _0x2dd127(_0x3dc687[_0x7e2c('0x19')]['message']);}else{logger[_0x7e2c('0x16')](_0x7e2c('0x17'),_0x1a576a,_0x7e2c('0x18'));_0x2dd127(_0x3dc687[_0x7e2c('0x1b')][_0x7e2c('0x1a')]);}})[_0x7e2c('0x1c')](function(_0x168de5){logger[_0x7e2c('0x19')](_0x7e2c('0x17'),_0x1a576a,_0x168de5);_0x4e6cbd(_0x168de5);});});}function respondWithStatusCode(_0x467c3e,_0x7d5616){_0x7d5616=_0x7d5616||0xcc;return function(_0x9b59d7){if(_0x9b59d7){return _0x467c3e['sendStatus'](_0x7d5616);}return _0x467c3e[_0x7e2c('0x1d')](_0x7d5616)['end']();};}function respondWithResult(_0x2cd6c6,_0x447863){_0x447863=_0x447863||0xc8;return function(_0x1dbc53){if(_0x1dbc53){return _0x2cd6c6[_0x7e2c('0x1d')](_0x447863)['json'](_0x1dbc53);}};}function respondWithFilteredResult(_0x2cd59e,_0x739ad0){return function(_0x1ff938){if(_0x1ff938){var _0x2a57d1=_0x1ff938['count'],_0x184896=_0x739ad0['offset'],_0x4cd0ed=_0x739ad0['offset']+_0x739ad0[_0x7e2c('0x1e')],_0x267839;if(_0x4cd0ed>=_0x2a57d1){_0x4cd0ed=_0x2a57d1;_0x267839=0xc8;}else{_0x267839=0xce;}_0x2cd59e[_0x7e2c('0x1d')](_0x267839);return _0x2cd59e[_0x7e2c('0x1f')]('Content-Range',_0x184896+'-'+_0x4cd0ed+'/'+_0x2a57d1)[_0x7e2c('0x20')](_0x1ff938);}return null;};}function patchUpdates(_0x3c7e72){return function(_0x4677aa){try{jsonpatch[_0x7e2c('0x21')](_0x4677aa,_0x3c7e72,!![]);}catch(_0x4bd83d){return BPromise[_0x7e2c('0x22')](_0x4bd83d);}return _0x4677aa[_0x7e2c('0x23')]();};}function saveUpdates(_0x11e1af,_0x1eec9c){return function(_0x2dc328){if(_0x2dc328){return _0x2dc328[_0x7e2c('0x24')](_0x11e1af)['then'](function(_0x7fc8){return _0x7fc8;});}return null;};}function removeEntity(_0x116307,_0xf9addf){return function(_0x58c9d8){if(_0x58c9d8){return _0x58c9d8['destroy']()[_0x7e2c('0x15')](function(){_0x116307['status'](0xcc)[_0x7e2c('0x25')]();});}};}function handleEntityNotFound(_0x27d4fc,_0x44b6f9){return function(_0x50e139){if(!_0x50e139){_0x27d4fc['sendStatus'](0x194);}return _0x50e139;};}function handleError(_0x3fcc60,_0x372893){_0x372893=_0x372893||0x1f4;return function(_0x26fac2){logger[_0x7e2c('0x19')](_0x26fac2[_0x7e2c('0x26')]);if(_0x26fac2[_0x7e2c('0x27')]){delete _0x26fac2['name'];}_0x3fcc60['status'](_0x372893)[_0x7e2c('0x28')](_0x26fac2);};}exports['index']=function(_0x23d4ec,_0xbe3ffc){var _0x2ef678={},_0x4a97f2={},_0x42cfe3={'count':0x0,'rows':[]};var _0x4a16df=_[_0x7e2c('0x29')](db[_0x7e2c('0x2a')]['rawAttributes'],function(_0x31a930){return{'name':_0x31a930[_0x7e2c('0x2b')],'type':_0x31a930[_0x7e2c('0x2c')]['key']};});_0x4a97f2[_0x7e2c('0x2d')]=_[_0x7e2c('0x29')](_0x4a16df,_0x7e2c('0x27'));_0x4a97f2['query']=_[_0x7e2c('0x2e')](_0x23d4ec[_0x7e2c('0x2f')]);_0x4a97f2[_0x7e2c('0x30')]=_[_0x7e2c('0x31')](_0x4a97f2[_0x7e2c('0x2d')],_0x4a97f2[_0x7e2c('0x2f')]);_0x2ef678['attributes']=_['intersection'](_0x4a97f2[_0x7e2c('0x2d')],qs['fields'](_0x23d4ec[_0x7e2c('0x2f')][_0x7e2c('0x32')]));_0x2ef678['attributes']=_0x2ef678[_0x7e2c('0x33')][_0x7e2c('0x34')]?_0x2ef678['attributes']:_0x4a97f2[_0x7e2c('0x2d')];if(!_0x23d4ec['query'][_0x7e2c('0x35')]('nolimit')){_0x2ef678['limit']=qs[_0x7e2c('0x1e')](_0x23d4ec['query'][_0x7e2c('0x1e')]);_0x2ef678[_0x7e2c('0x36')]=qs[_0x7e2c('0x36')](_0x23d4ec[_0x7e2c('0x2f')][_0x7e2c('0x36')]);}_0x2ef678['order']=qs[_0x7e2c('0x37')](_0x23d4ec[_0x7e2c('0x2f')]['sort']);_0x2ef678[_0x7e2c('0x38')]=qs[_0x7e2c('0x30')](_['pick'](_0x23d4ec['query'],_0x4a97f2[_0x7e2c('0x30')]),_0x4a16df);if(_0x23d4ec[_0x7e2c('0x2f')][_0x7e2c('0x39')]){_0x2ef678[_0x7e2c('0x38')]=_[_0x7e2c('0x3a')](_0x2ef678[_0x7e2c('0x38')],{'$or':_[_0x7e2c('0x29')](_0x4a16df,function(_0x4d90cd){if(_0x4d90cd['type']!==_0x7e2c('0x3b')){var _0x189a12={};_0x189a12[_0x4d90cd[_0x7e2c('0x27')]]={'$like':'%'+_0x23d4ec[_0x7e2c('0x2f')][_0x7e2c('0x39')]+'%'};return _0x189a12;}})});}_0x2ef678=_[_0x7e2c('0x3a')]({},_0x2ef678,_0x23d4ec[_0x7e2c('0x3c')]);var _0x535d6b={'where':_0x2ef678[_0x7e2c('0x38')]};return db[_0x7e2c('0x2a')]['count'](_0x535d6b)[_0x7e2c('0x15')](function(_0x3c4b44){_0x42cfe3[_0x7e2c('0x3d')]=_0x3c4b44;if(_0x23d4ec[_0x7e2c('0x2f')][_0x7e2c('0x3e')]){_0x2ef678[_0x7e2c('0x3f')]=[{'all':!![]}];}return db[_0x7e2c('0x2a')][_0x7e2c('0x40')](_0x2ef678);})[_0x7e2c('0x15')](function(_0x32b72c){_0x42cfe3[_0x7e2c('0x41')]=_0x32b72c;return _0x42cfe3;})['then'](respondWithFilteredResult(_0xbe3ffc,_0x2ef678))[_0x7e2c('0x1c')](handleError(_0xbe3ffc,null));};exports[_0x7e2c('0x42')]=function(_0x24f468,_0x143322){var _0xaf6f0d={'raw':![],'where':{'id':_0x24f468[_0x7e2c('0x43')]['id']}},_0x102e77={};_0x102e77[_0x7e2c('0x2d')]=_[_0x7e2c('0x2e')](db[_0x7e2c('0x2a')][_0x7e2c('0x44')]);_0x102e77[_0x7e2c('0x2f')]=_[_0x7e2c('0x2e')](_0x24f468[_0x7e2c('0x2f')]);_0x102e77[_0x7e2c('0x30')]=_[_0x7e2c('0x31')](_0x102e77['model'],_0x102e77[_0x7e2c('0x2f')]);_0xaf6f0d['attributes']=_[_0x7e2c('0x31')](_0x102e77['model'],qs['fields'](_0x24f468[_0x7e2c('0x2f')][_0x7e2c('0x32')]));_0xaf6f0d[_0x7e2c('0x33')]=_0xaf6f0d['attributes'][_0x7e2c('0x34')]?_0xaf6f0d['attributes']:_0x102e77[_0x7e2c('0x2d')];if(_0x24f468[_0x7e2c('0x2f')]['includeAll']){_0xaf6f0d[_0x7e2c('0x3f')]=[{'all':!![]}];}_0xaf6f0d=_[_0x7e2c('0x3a')]({},_0xaf6f0d,_0x24f468[_0x7e2c('0x3c')]);return db[_0x7e2c('0x2a')][_0x7e2c('0x45')](_0xaf6f0d)['then'](handleEntityNotFound(_0x143322,null))[_0x7e2c('0x15')](respondWithResult(_0x143322,null))['catch'](handleError(_0x143322,null));};exports[_0x7e2c('0x46')]=function(_0x313b44,_0x40f40d){return db[_0x7e2c('0x2a')][_0x7e2c('0x46')](_0x313b44[_0x7e2c('0x47')],{})[_0x7e2c('0x15')](respondWithResult(_0x40f40d,0xc9))[_0x7e2c('0x1c')](handleError(_0x40f40d,null));};exports[_0x7e2c('0x24')]=function(_0x57a9cf,_0x4ceb6f){if(_0x57a9cf['body']['id']){delete _0x57a9cf['body']['id'];}return db[_0x7e2c('0x2a')]['find']({'where':{'id':_0x57a9cf[_0x7e2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ceb6f,null))[_0x7e2c('0x15')](saveUpdates(_0x57a9cf[_0x7e2c('0x47')],null))[_0x7e2c('0x15')](respondWithResult(_0x4ceb6f,null))[_0x7e2c('0x1c')](handleError(_0x4ceb6f,null));};exports['destroy']=function(_0x289868,_0xec9ebc){return db[_0x7e2c('0x2a')]['find']({'where':{'id':_0x289868[_0x7e2c('0x43')]['id']}})['then'](handleEntityNotFound(_0xec9ebc,null))[_0x7e2c('0x15')](removeEntity(_0xec9ebc,null))['catch'](handleError(_0xec9ebc,null));};exports[_0x7e2c('0x48')]=function(_0x375a68,_0x2f814c,_0xf1acd3){var _0x1c8586={};var _0x3752fe={};var _0x46b0d2;var _0x158e25;return db[_0x7e2c('0x2a')][_0x7e2c('0x49')]({'where':{'id':_0x375a68[_0x7e2c('0x43')]['id']}})[_0x7e2c('0x15')](handleEntityNotFound(_0x2f814c,null))[_0x7e2c('0x15')](function(_0x53e980){if(_0x53e980){_0x46b0d2=_0x53e980;_0x3752fe[_0x7e2c('0x2d')]=_['keys'](db['FreshsalesField'][_0x7e2c('0x44')]);_0x3752fe[_0x7e2c('0x2f')]=_[_0x7e2c('0x2e')](_0x375a68[_0x7e2c('0x2f')]);_0x3752fe[_0x7e2c('0x30')]=_['intersection'](_0x3752fe[_0x7e2c('0x2d')],_0x3752fe[_0x7e2c('0x2f')]);_0x1c8586[_0x7e2c('0x33')]=_[_0x7e2c('0x31')](_0x3752fe[_0x7e2c('0x2d')],qs[_0x7e2c('0x32')](_0x375a68[_0x7e2c('0x2f')][_0x7e2c('0x32')]));_0x1c8586['attributes']=_0x1c8586[_0x7e2c('0x33')][_0x7e2c('0x34')]?_0x1c8586[_0x7e2c('0x33')]:_0x3752fe[_0x7e2c('0x2d')];_0x1c8586[_0x7e2c('0x4a')]=qs[_0x7e2c('0x37')](_0x375a68[_0x7e2c('0x2f')][_0x7e2c('0x37')]);_0x1c8586['where']=qs[_0x7e2c('0x30')](_['pick'](_0x375a68[_0x7e2c('0x2f')],_0x3752fe[_0x7e2c('0x30')]));if(_0x375a68['query'][_0x7e2c('0x39')]){_0x1c8586[_0x7e2c('0x38')]=_[_0x7e2c('0x3a')](_0x1c8586[_0x7e2c('0x38')],{'$or':_[_0x7e2c('0x29')](_0x1c8586[_0x7e2c('0x33')],function(_0x491838){var _0x52ff10={};_0x52ff10[_0x491838]={'$like':'%'+_0x375a68['query']['filter']+'%'};return _0x52ff10;})});}_0x1c8586=_['merge']({},_0x1c8586,_0x375a68['options']);return _0x46b0d2[_0x7e2c('0x48')](_0x1c8586);}})['then'](function(_0x2d00b2){if(_0x2d00b2){_0x158e25=_0x2d00b2[_0x7e2c('0x34')];if(!_0x375a68['query'][_0x7e2c('0x35')](_0x7e2c('0x4b'))){_0x1c8586[_0x7e2c('0x1e')]=qs[_0x7e2c('0x1e')](_0x375a68[_0x7e2c('0x2f')][_0x7e2c('0x1e')]);_0x1c8586['offset']=qs[_0x7e2c('0x36')](_0x375a68[_0x7e2c('0x2f')][_0x7e2c('0x36')]);}return _0x46b0d2['getSubjects'](_0x1c8586);}})[_0x7e2c('0x15')](function(_0x3ae005){if(_0x3ae005){return _0x3ae005?{'count':_0x158e25,'rows':_0x3ae005}:null;}})[_0x7e2c('0x15')](respondWithResult(_0x2f814c,null))[_0x7e2c('0x1c')](handleError(_0x2f814c,null));};exports[_0x7e2c('0x4c')]=function(_0x4fcf7e,_0x19705b,_0x47ec6d){var _0x48cb83={};var _0x5bde78={};var _0x4b89e0;var _0x2cc7ac;return db['FreshsalesConfiguration'][_0x7e2c('0x49')]({'where':{'id':_0x4fcf7e[_0x7e2c('0x43')]['id']}})[_0x7e2c('0x15')](handleEntityNotFound(_0x19705b,null))[_0x7e2c('0x15')](function(_0x22d155){if(_0x22d155){_0x4b89e0=_0x22d155;_0x5bde78[_0x7e2c('0x2d')]=_[_0x7e2c('0x2e')](db['FreshsalesField'][_0x7e2c('0x44')]);_0x5bde78[_0x7e2c('0x2f')]=_[_0x7e2c('0x2e')](_0x4fcf7e[_0x7e2c('0x2f')]);_0x5bde78[_0x7e2c('0x30')]=_['intersection'](_0x5bde78[_0x7e2c('0x2d')],_0x5bde78[_0x7e2c('0x2f')]);_0x48cb83[_0x7e2c('0x33')]=_[_0x7e2c('0x31')](_0x5bde78[_0x7e2c('0x2d')],qs['fields'](_0x4fcf7e[_0x7e2c('0x2f')]['fields']));_0x48cb83['attributes']=_0x48cb83[_0x7e2c('0x33')]['length']?_0x48cb83[_0x7e2c('0x33')]:_0x5bde78[_0x7e2c('0x2d')];_0x48cb83[_0x7e2c('0x4a')]=qs[_0x7e2c('0x37')](_0x4fcf7e[_0x7e2c('0x2f')][_0x7e2c('0x37')]);_0x48cb83[_0x7e2c('0x38')]=qs[_0x7e2c('0x30')](_[_0x7e2c('0x4d')](_0x4fcf7e[_0x7e2c('0x2f')],_0x5bde78['filters']));if(_0x4fcf7e[_0x7e2c('0x2f')][_0x7e2c('0x39')]){_0x48cb83[_0x7e2c('0x38')]=_[_0x7e2c('0x3a')](_0x48cb83[_0x7e2c('0x38')],{'$or':_[_0x7e2c('0x29')](_0x48cb83[_0x7e2c('0x33')],function(_0x7bd6ed){var _0x52d737={};_0x52d737[_0x7bd6ed]={'$like':'%'+_0x4fcf7e[_0x7e2c('0x2f')][_0x7e2c('0x39')]+'%'};return _0x52d737;})});}_0x48cb83=_[_0x7e2c('0x3a')]({},_0x48cb83,_0x4fcf7e[_0x7e2c('0x3c')]);return _0x4b89e0[_0x7e2c('0x4c')](_0x48cb83);}})[_0x7e2c('0x15')](function(_0x8dd6b){if(_0x8dd6b){_0x2cc7ac=_0x8dd6b[_0x7e2c('0x34')];if(!_0x4fcf7e[_0x7e2c('0x2f')][_0x7e2c('0x35')](_0x7e2c('0x4b'))){_0x48cb83[_0x7e2c('0x1e')]=qs['limit'](_0x4fcf7e['query'][_0x7e2c('0x1e')]);_0x48cb83[_0x7e2c('0x36')]=qs[_0x7e2c('0x36')](_0x4fcf7e['query'][_0x7e2c('0x36')]);}return _0x4b89e0[_0x7e2c('0x4c')](_0x48cb83);}})[_0x7e2c('0x15')](function(_0x3347fe){if(_0x3347fe){return _0x3347fe?{'count':_0x2cc7ac,'rows':_0x3347fe}:null;}})[_0x7e2c('0x15')](respondWithResult(_0x19705b,null))[_0x7e2c('0x1c')](handleError(_0x19705b,null));};exports[_0x7e2c('0x4e')]=function(_0x3b40f6,_0xdc36af,_0x5543cd){var _0x3f6fa6={};var _0x54fe21={};var _0x208dcf;var _0x542452;return db[_0x7e2c('0x2a')][_0x7e2c('0x49')]({'where':{'id':_0x3b40f6['params']['id']}})[_0x7e2c('0x15')](handleEntityNotFound(_0xdc36af,null))[_0x7e2c('0x15')](function(_0x10221f){if(_0x10221f){_0x208dcf=_0x10221f;_0x54fe21[_0x7e2c('0x2d')]=_[_0x7e2c('0x2e')](db[_0x7e2c('0x4f')]['rawAttributes']);_0x54fe21[_0x7e2c('0x2f')]=_[_0x7e2c('0x2e')](_0x3b40f6[_0x7e2c('0x2f')]);_0x54fe21[_0x7e2c('0x30')]=_[_0x7e2c('0x31')](_0x54fe21['model'],_0x54fe21[_0x7e2c('0x2f')]);_0x3f6fa6[_0x7e2c('0x33')]=_['intersection'](_0x54fe21[_0x7e2c('0x2d')],qs[_0x7e2c('0x32')](_0x3b40f6[_0x7e2c('0x2f')][_0x7e2c('0x32')]));_0x3f6fa6['attributes']=_0x3f6fa6[_0x7e2c('0x33')]['length']?_0x3f6fa6['attributes']:_0x54fe21[_0x7e2c('0x2d')];_0x3f6fa6['order']=qs[_0x7e2c('0x37')](_0x3b40f6[_0x7e2c('0x2f')]['sort']);_0x3f6fa6[_0x7e2c('0x38')]=qs[_0x7e2c('0x30')](_['pick'](_0x3b40f6[_0x7e2c('0x2f')],_0x54fe21[_0x7e2c('0x30')]));if(_0x3b40f6[_0x7e2c('0x2f')][_0x7e2c('0x39')]){_0x3f6fa6[_0x7e2c('0x38')]=_[_0x7e2c('0x3a')](_0x3f6fa6['where'],{'$or':_[_0x7e2c('0x29')](_0x3f6fa6[_0x7e2c('0x33')],function(_0x20617e){var _0xf8e341={};_0xf8e341[_0x20617e]={'$like':'%'+_0x3b40f6['query'][_0x7e2c('0x39')]+'%'};return _0xf8e341;})});}_0x3f6fa6=_[_0x7e2c('0x3a')]({},_0x3f6fa6,_0x3b40f6[_0x7e2c('0x3c')]);return _0x208dcf[_0x7e2c('0x4e')](_0x3f6fa6);}})['then'](function(_0x2d75c4){if(_0x2d75c4){_0x542452=_0x2d75c4[_0x7e2c('0x34')];if(!_0x3b40f6[_0x7e2c('0x2f')][_0x7e2c('0x35')]('nolimit')){_0x3f6fa6[_0x7e2c('0x1e')]=qs[_0x7e2c('0x1e')](_0x3b40f6[_0x7e2c('0x2f')][_0x7e2c('0x1e')]);_0x3f6fa6[_0x7e2c('0x36')]=qs[_0x7e2c('0x36')](_0x3b40f6[_0x7e2c('0x2f')][_0x7e2c('0x36')]);}return _0x208dcf['getFields'](_0x3f6fa6);}})[_0x7e2c('0x15')](function(_0x14cd3f){if(_0x14cd3f){return _0x14cd3f?{'count':_0x542452,'rows':_0x14cd3f}:null;}})['then'](respondWithResult(_0xdc36af,null))[_0x7e2c('0x1c')](handleError(_0xdc36af,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ce6a067..4f5c340 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 _0x383f=['api','moment','bluebird','request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger'];(function(_0x44da01,_0x57c833){var _0x544d85=function(_0x128edf){while(--_0x128edf){_0x44da01['push'](_0x44da01['shift']());}};_0x544d85(++_0x57c833);}(_0x383f,0x9a));var _0xf383=function(_0x5469e2,_0x1cb459){_0x5469e2=_0x5469e2-0x0;var _0x5849a2=_0x383f[_0x5469e2];return _0x5849a2;};'use strict';var _=require('lodash');var util=require(_0xf383('0x0'));var logger=require(_0xf383('0x1'))(_0xf383('0x2'));var moment=require(_0xf383('0x3'));var BPromise=require(_0xf383('0x4'));var rp=require(_0xf383('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf383('0x6'));var attributes=require(_0xf383('0x7'));module[_0xf383('0x8')]=function(_0x2e4438,_0xdbec68){return _0x2e4438[_0xf383('0x9')](_0xf383('0xa'),attributes,{'tableName':_0xf383('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc554=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0xc554,0x195));var _0x4c55=function(_0x35ba71,_0xa2fbbd){_0x35ba71=_0x35ba71-0x0;var _0x5f04f4=_0xc554[_0x35ba71];return _0x5f04f4;};'use strict';var _=require(_0x4c55('0x0'));var util=require(_0x4c55('0x1'));var logger=require(_0x4c55('0x2'))(_0x4c55('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c55('0x4'));var fs=require('fs');var path=require(_0x4c55('0x5'));var rimraf=require(_0x4c55('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c55('0x7'));module['exports']=function(_0x1ec18c,_0x3a3130){return _0x1ec18c['define'](_0x4c55('0x8'),attributes,{'tableName':'int_freshsales_configurations','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 912bf18..d424fc8 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 _0x2977=['client','request','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x2977,0xa5));var _0x7297=function(_0x21d067,_0x237d1a){_0x21d067=_0x21d067-0x0;var _0x542ad6=_0x2977[_0x21d067];return _0x542ad6;};'use strict';var _=require(_0x7297('0x0'));var util=require('util');var moment=require(_0x7297('0x1'));var BPromise=require(_0x7297('0x2'));var rs=require(_0x7297('0x3'));var fs=require('fs');var Redis=require(_0x7297('0x4'));var db=require(_0x7297('0x5'))['db'];var utils=require(_0x7297('0x6'));var logger=require(_0x7297('0x7'))(_0x7297('0x8'));var config=require(_0x7297('0x9'));var jayson=require(_0x7297('0xa'));var client=jayson[_0x7297('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9e570,_0x581d60,_0x2be768){return new BPromise(function(_0x4fc888,_0x4c5832){return client[_0x7297('0xc')](_0xc9e570,_0x2be768)['then'](function(_0x909a14){logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,'request\x20sent');logger['debug'](_0x7297('0xf'),_0x581d60,_0x7297('0x10'),JSON[_0x7297('0x11')](_0x909a14));if(_0x909a14[_0x7297('0x12')]){if(_0x909a14['error'][_0x7297('0x13')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x581d60,_0x909a14[_0x7297('0x12')]['message']);return _0x4c5832(_0x909a14[_0x7297('0x12')]['message']);}logger[_0x7297('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x581d60,_0x909a14['error'][_0x7297('0x14')]);return _0x4fc888(_0x909a14[_0x7297('0x12')][_0x7297('0x14')]);}else{logger[_0x7297('0xd')](_0x7297('0xe'),_0x581d60,_0x7297('0x10'));_0x4fc888(_0x909a14[_0x7297('0x15')][_0x7297('0x14')]);}})['catch'](function(_0x558f04){logger[_0x7297('0x12')](_0x7297('0xe'),_0x581d60,_0x558f04);_0x4c5832(_0x558f04);});});} \ No newline at end of file +var _0x3451=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message'];(function(_0x50cf67,_0x10eb50){var _0x1b1743=function(_0x392adf){while(--_0x392adf){_0x50cf67['push'](_0x50cf67['shift']());}};_0x1b1743(++_0x10eb50);}(_0x3451,0x19a));var _0x1345=function(_0x39cbdb,_0x255131){_0x39cbdb=_0x39cbdb-0x0;var _0x2bd8aa=_0x3451[_0x39cbdb];return _0x2bd8aa;};'use strict';var _=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var moment=require('moment');var BPromise=require(_0x1345('0x2'));var rs=require(_0x1345('0x3'));var fs=require('fs');var Redis=require(_0x1345('0x4'));var db=require(_0x1345('0x5'))['db'];var utils=require(_0x1345('0x6'));var logger=require(_0x1345('0x7'))(_0x1345('0x8'));var config=require(_0x1345('0x9'));var jayson=require(_0x1345('0xa'));var client=jayson[_0x1345('0xb')][_0x1345('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c716,_0x4b90dd,_0x3e236d){return new BPromise(function(_0x40689f,_0x516d55){return client[_0x1345('0xd')](_0x34c716,_0x3e236d)['then'](function(_0x4b9de8){logger[_0x1345('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b90dd,_0x1345('0xf'));logger[_0x1345('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4b90dd,'request\x20sent',JSON[_0x1345('0x11')](_0x4b9de8));if(_0x4b9de8['error']){if(_0x4b9de8[_0x1345('0x12')][_0x1345('0x13')]===0x1f4){logger[_0x1345('0x12')](_0x1345('0x14'),_0x4b90dd,_0x4b9de8['error'][_0x1345('0x15')]);return _0x516d55(_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);}logger[_0x1345('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b90dd,_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);return _0x40689f(_0x4b9de8[_0x1345('0x12')][_0x1345('0x15')]);}else{logger[_0x1345('0xe')](_0x1345('0x14'),_0x4b90dd,_0x1345('0xf'));_0x40689f(_0x4b9de8[_0x1345('0x16')][_0x1345('0x15')]);}})[_0x1345('0x17')](function(_0x318a0d){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b90dd,_0x318a0d);_0x516d55(_0x318a0d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c8c323b..d97a4d3 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 _0xf274=['isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x446f11,_0x95cf21){var _0x385cb5=function(_0x426715){while(--_0x426715){_0x446f11['push'](_0x446f11['shift']());}};_0x385cb5(++_0x95cf21);}(_0xf274,0x1ca));var _0x4f27=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xf274[_0x172747];return _0x509692;};'use strict';var multer=require(_0x4f27('0x0'));var util=require(_0x4f27('0x1'));var path=require(_0x4f27('0x2'));var timeout=require(_0x4f27('0x3'));var express=require(_0x4f27('0x4'));var router=express['Router']();var auth=require(_0x4f27('0x5'));var interaction=require(_0x4f27('0x6'));var config=require(_0x4f27('0x7'));var controller=require(_0x4f27('0x8'));router[_0x4f27('0x9')]('/',auth[_0x4f27('0xa')](),controller['index']);router[_0x4f27('0x9')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller['show']);router[_0x4f27('0xc')]('/',auth[_0x4f27('0xa')](),controller[_0x4f27('0xd')]);router[_0x4f27('0xe')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller[_0x4f27('0xf')]);router[_0x4f27('0x10')](_0x4f27('0xb'),auth[_0x4f27('0xa')](),controller[_0x4f27('0x11')]);module['exports']=router; \ No newline at end of file +var _0x003d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','post','create','update','delete','destroy','util','path','connect-timeout'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0x003d,0xed));var _0xd003=function(_0x20715c,_0x29c829){_0x20715c=_0x20715c-0x0;var _0x4bb85e=_0x003d[_0x20715c];return _0x4bb85e;};'use strict';var multer=require('multer');var util=require(_0xd003('0x0'));var path=require(_0xd003('0x1'));var timeout=require(_0xd003('0x2'));var express=require('express');var router=express[_0xd003('0x3')]();var auth=require(_0xd003('0x4'));var interaction=require(_0xd003('0x5'));var config=require(_0xd003('0x6'));var controller=require(_0xd003('0x7'));router['get']('/',auth[_0xd003('0x8')](),controller['index']);router['get'](_0xd003('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xd003('0xa')]('/',auth[_0xd003('0x8')](),controller[_0xd003('0xb')]);router['put'](_0xd003('0x9'),auth['isAuthenticated'](),controller[_0xd003('0xc')]);router[_0xd003('0xd')](_0xd003('0x9'),auth[_0xd003('0x8')](),controller[_0xd003('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8a123e5..07cb1a1 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 _0x546c=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x24d9c8,_0x5d98a2){var _0x3ffe8b=function(_0x544210){while(--_0x544210){_0x24d9c8['push'](_0x24d9c8['shift']());}};_0x3ffe8b(++_0x5d98a2);}(_0x546c,0x1c9));var _0xc546=function(_0x3dd963,_0x5a3208){_0x3dd963=_0x3dd963-0x0;var _0x352294=_0x546c[_0x3dd963];return _0x352294;};'use strict';var Sequelize=require(_0xc546('0x0'));module[_0xc546('0x1')]={'type':{'type':Sequelize[_0xc546('0x2')](_0xc546('0x3'),_0xc546('0x4'),_0xc546('0x5'),_0xc546('0x6')),'defaultValue':_0xc546('0x3')},'content':{'type':Sequelize[_0xc546('0x7')]},'key':{'type':Sequelize[_0xc546('0x7')]},'keyType':{'type':Sequelize[_0xc546('0x2')]('string',_0xc546('0x4'),_0xc546('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc546('0x7')]},'customField':{'type':Sequelize[_0xc546('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc546('0x7')]}}; \ No newline at end of file +var _0x54ef=['keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x1195ed,_0xc5857e){var _0x26e1a6=function(_0x36232c){while(--_0x36232c){_0x1195ed['push'](_0x1195ed['shift']());}};_0x26e1a6(++_0xc5857e);}(_0x54ef,0x112));var _0xf54e=function(_0x1d7ab0,_0x519607){_0x1d7ab0=_0x1d7ab0-0x0;var _0x3a0156=_0x54ef[_0x1d7ab0];return _0x3a0156;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'type':{'type':Sequelize[_0xf54e('0x2')]('string',_0xf54e('0x3'),_0xf54e('0x4'),_0xf54e('0x5')),'defaultValue':_0xf54e('0x6')},'content':{'type':Sequelize[_0xf54e('0x7')]},'key':{'type':Sequelize[_0xf54e('0x7')]},'keyType':{'type':Sequelize[_0xf54e('0x2')]('string','variable',_0xf54e('0x4'))},'keyContent':{'type':Sequelize[_0xf54e('0x7')]},'idField':{'type':Sequelize[_0xf54e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf54e('0x8')],'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 119c854..bc5c020 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 _0x4768=['../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','FreshsalesField','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4768,0xc6));var _0x8476=function(_0x2b3708,_0x150567){_0x2b3708=_0x2b3708-0x0;var _0xef7bd0=_0x4768[_0x2b3708];return _0xef7bd0;};'use strict';var pdf=require(_0x8476('0x0'));var emlformat=require(_0x8476('0x1'));var rimraf=require(_0x8476('0x2'));var zipdir=require(_0x8476('0x3'));var jsonpatch=require(_0x8476('0x4'));var rp=require(_0x8476('0x5'));var moment=require(_0x8476('0x6'));var BPromise=require(_0x8476('0x7'));var Mustache=require(_0x8476('0x8'));var util=require(_0x8476('0x9'));var path=require('path');var sox=require(_0x8476('0xa'));var csv=require(_0x8476('0xb'));var ejs=require(_0x8476('0xc'));var fs=require('fs');var _=require(_0x8476('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8476('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8476('0xb'));var querystring=require(_0x8476('0xf'));var Papa=require(_0x8476('0x10'));var Redis=require(_0x8476('0x11'));var authService=require(_0x8476('0x12'));var qs=require(_0x8476('0x13'));var as=require(_0x8476('0x14'));var hardwareService=require(_0x8476('0x15'));var logger=require(_0x8476('0x16'))(_0x8476('0x17'));var utils=require('../../config/utils');var config=require(_0x8476('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aad5b,_0x57df90){_0x57df90=_0x57df90||0xcc;return function(_0x154166){if(_0x154166){return _0x1aad5b[_0x8476('0x19')](_0x57df90);}return _0x1aad5b[_0x8476('0x1a')](_0x57df90)[_0x8476('0x1b')]();};}function respondWithResult(_0x2cd73b,_0x2765ae){_0x2765ae=_0x2765ae||0xc8;return function(_0x47f1be){if(_0x47f1be){return _0x2cd73b[_0x8476('0x1a')](_0x2765ae)[_0x8476('0x1c')](_0x47f1be);}};}function respondWithFilteredResult(_0x518411,_0xe66752){return function(_0x398d4a){if(_0x398d4a){var _0x14d371=_0x398d4a[_0x8476('0x1d')],_0x14653e=_0xe66752[_0x8476('0x1e')],_0x5eaae0=_0xe66752[_0x8476('0x1e')]+_0xe66752[_0x8476('0x1f')],_0x25753d;if(_0x5eaae0>=_0x14d371){_0x5eaae0=_0x14d371;_0x25753d=0xc8;}else{_0x25753d=0xce;}_0x518411[_0x8476('0x1a')](_0x25753d);return _0x518411['set'](_0x8476('0x20'),_0x14653e+'-'+_0x5eaae0+'/'+_0x14d371)[_0x8476('0x1c')](_0x398d4a);}return null;};}function patchUpdates(_0x19b405){return function(_0x1a75ef){try{jsonpatch[_0x8476('0x21')](_0x1a75ef,_0x19b405,!![]);}catch(_0x50f297){return BPromise[_0x8476('0x22')](_0x50f297);}return _0x1a75ef[_0x8476('0x23')]();};}function saveUpdates(_0x1fc6d1,_0x25b7e6){return function(_0x251833){if(_0x251833){return _0x251833['update'](_0x1fc6d1)['then'](function(_0x5dee23){return _0x5dee23;});}return null;};}function removeEntity(_0x2032ca,_0x33c7bd){return function(_0x54f0e5){if(_0x54f0e5){return _0x54f0e5[_0x8476('0x24')]()[_0x8476('0x25')](function(){_0x2032ca[_0x8476('0x1a')](0xcc)[_0x8476('0x1b')]();});}};}function handleEntityNotFound(_0x3a4a6a,_0x4af1e4){return function(_0x3cac1b){if(!_0x3cac1b){_0x3a4a6a[_0x8476('0x19')](0x194);}return _0x3cac1b;};}function handleError(_0x4f389e,_0x323209){_0x323209=_0x323209||0x1f4;return function(_0x1aa159){logger[_0x8476('0x26')](_0x1aa159[_0x8476('0x27')]);if(_0x1aa159[_0x8476('0x28')]){delete _0x1aa159[_0x8476('0x28')];}_0x4f389e[_0x8476('0x1a')](_0x323209)[_0x8476('0x29')](_0x1aa159);};}exports['index']=function(_0x57a90d,_0x88a4f7){var _0x4d763b={},_0x227973={},_0x3d3ab6={'count':0x0,'rows':[]};var _0x52fe4c=_['map'](db[_0x8476('0x2a')]['rawAttributes'],function(_0x597765){return{'name':_0x597765['fieldName'],'type':_0x597765[_0x8476('0x2b')]['key']};});_0x227973[_0x8476('0x2c')]=_[_0x8476('0x2d')](_0x52fe4c,_0x8476('0x28'));_0x227973[_0x8476('0x2e')]=_['keys'](_0x57a90d[_0x8476('0x2e')]);_0x227973[_0x8476('0x2f')]=_['intersection'](_0x227973[_0x8476('0x2c')],_0x227973[_0x8476('0x2e')]);_0x4d763b[_0x8476('0x30')]=_['intersection'](_0x227973[_0x8476('0x2c')],qs[_0x8476('0x31')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x31')]));_0x4d763b[_0x8476('0x30')]=_0x4d763b[_0x8476('0x30')][_0x8476('0x32')]?_0x4d763b['attributes']:_0x227973[_0x8476('0x2c')];if(!_0x57a90d['query'][_0x8476('0x33')](_0x8476('0x34'))){_0x4d763b[_0x8476('0x1f')]=qs[_0x8476('0x1f')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x1f')]);_0x4d763b[_0x8476('0x1e')]=qs[_0x8476('0x1e')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x1e')]);}_0x4d763b[_0x8476('0x35')]=qs[_0x8476('0x36')](_0x57a90d[_0x8476('0x2e')][_0x8476('0x36')]);_0x4d763b[_0x8476('0x37')]=qs[_0x8476('0x2f')](_[_0x8476('0x38')](_0x57a90d[_0x8476('0x2e')],_0x227973['filters']),_0x52fe4c);if(_0x57a90d[_0x8476('0x2e')][_0x8476('0x39')]){_0x4d763b[_0x8476('0x37')]=_['merge'](_0x4d763b['where'],{'$or':_['map'](_0x52fe4c,function(_0x1df4a8){if(_0x1df4a8[_0x8476('0x2b')]!==_0x8476('0x3a')){var _0x470fd1={};_0x470fd1[_0x1df4a8['name']]={'$like':'%'+_0x57a90d[_0x8476('0x2e')][_0x8476('0x39')]+'%'};return _0x470fd1;}})});}_0x4d763b=_[_0x8476('0x3b')]({},_0x4d763b,_0x57a90d[_0x8476('0x3c')]);var _0x579d76={'where':_0x4d763b['where']};return db[_0x8476('0x2a')]['count'](_0x579d76)[_0x8476('0x25')](function(_0x44b7bc){_0x3d3ab6[_0x8476('0x1d')]=_0x44b7bc;if(_0x57a90d['query'][_0x8476('0x3d')]){_0x4d763b[_0x8476('0x3e')]=[{'all':!![]}];}return db[_0x8476('0x2a')][_0x8476('0x3f')](_0x4d763b);})[_0x8476('0x25')](function(_0x2f6786){_0x3d3ab6[_0x8476('0x40')]=_0x2f6786;return _0x3d3ab6;})[_0x8476('0x25')](respondWithFilteredResult(_0x88a4f7,_0x4d763b))[_0x8476('0x41')](handleError(_0x88a4f7,null));};exports[_0x8476('0x42')]=function(_0x39620b,_0x568f8a){var _0x2fc0d1={'raw':!![],'where':{'id':_0x39620b[_0x8476('0x43')]['id']}},_0x15da82={};_0x15da82[_0x8476('0x2c')]=_[_0x8476('0x44')](db[_0x8476('0x2a')][_0x8476('0x45')]);_0x15da82[_0x8476('0x2e')]=_['keys'](_0x39620b[_0x8476('0x2e')]);_0x15da82[_0x8476('0x2f')]=_['intersection'](_0x15da82['model'],_0x15da82[_0x8476('0x2e')]);_0x2fc0d1['attributes']=_[_0x8476('0x46')](_0x15da82['model'],qs[_0x8476('0x31')](_0x39620b[_0x8476('0x2e')][_0x8476('0x31')]));_0x2fc0d1[_0x8476('0x30')]=_0x2fc0d1['attributes'][_0x8476('0x32')]?_0x2fc0d1['attributes']:_0x15da82[_0x8476('0x2c')];if(_0x39620b[_0x8476('0x2e')][_0x8476('0x3d')]){_0x2fc0d1[_0x8476('0x3e')]=[{'all':!![]}];}_0x2fc0d1=_['merge']({},_0x2fc0d1,_0x39620b[_0x8476('0x3c')]);return db[_0x8476('0x2a')][_0x8476('0x47')](_0x2fc0d1)[_0x8476('0x25')](handleEntityNotFound(_0x568f8a,null))['then'](respondWithResult(_0x568f8a,null))['catch'](handleError(_0x568f8a,null));};exports[_0x8476('0x48')]=function(_0x182988,_0x3d7430){return db[_0x8476('0x2a')][_0x8476('0x48')](_0x182988[_0x8476('0x49')],{})[_0x8476('0x25')](respondWithResult(_0x3d7430,0xc9))[_0x8476('0x41')](handleError(_0x3d7430,null));};exports['update']=function(_0x371f3a,_0x365352){if(_0x371f3a[_0x8476('0x49')]['id']){delete _0x371f3a['body']['id'];}return db['FreshsalesField'][_0x8476('0x47')]({'where':{'id':_0x371f3a['params']['id']}})[_0x8476('0x25')](handleEntityNotFound(_0x365352,null))[_0x8476('0x25')](saveUpdates(_0x371f3a[_0x8476('0x49')],null))[_0x8476('0x25')](respondWithResult(_0x365352,null))[_0x8476('0x41')](handleError(_0x365352,null));};exports['destroy']=function(_0x556311,_0x12442f){return db[_0x8476('0x2a')][_0x8476('0x47')]({'where':{'id':_0x556311[_0x8476('0x43')]['id']}})[_0x8476('0x25')](handleEntityNotFound(_0x12442f,null))[_0x8476('0x25')](removeEntity(_0x12442f,null))[_0x8476('0x41')](handleError(_0x12442f,null));}; \ No newline at end of file +var _0x9320=['rawAttributes','intersection','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','FreshsalesField','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show'];(function(_0x31c38f,_0x5cc209){var _0x7306e3=function(_0x3b4f2c){while(--_0x3b4f2c){_0x31c38f['push'](_0x31c38f['shift']());}};_0x7306e3(++_0x5cc209);}(_0x9320,0x1ab));var _0x0932=function(_0x131209,_0x56dc0e){_0x131209=_0x131209-0x0;var _0x44dbc2=_0x9320[_0x131209];return _0x44dbc2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0932('0x0'));var zipdir=require(_0x0932('0x1'));var jsonpatch=require(_0x0932('0x2'));var rp=require(_0x0932('0x3'));var moment=require(_0x0932('0x4'));var BPromise=require(_0x0932('0x5'));var Mustache=require(_0x0932('0x6'));var util=require('util');var path=require(_0x0932('0x7'));var sox=require(_0x0932('0x8'));var csv=require(_0x0932('0x9'));var ejs=require(_0x0932('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0932('0xb'));var jsforce=require(_0x0932('0xc'));var deskjs=require(_0x0932('0xd'));var toCsv=require(_0x0932('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0932('0xe'));var authService=require(_0x0932('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0932('0x10'));var logger=require('../../config/logger')(_0x0932('0x11'));var utils=require(_0x0932('0x12'));var config=require('../../config/environment');var db=require(_0x0932('0x13'))['db'];function respondWithStatusCode(_0x405c2e,_0x41cd63){_0x41cd63=_0x41cd63||0xcc;return function(_0x3e80ce){if(_0x3e80ce){return _0x405c2e[_0x0932('0x14')](_0x41cd63);}return _0x405c2e[_0x0932('0x15')](_0x41cd63)[_0x0932('0x16')]();};}function respondWithResult(_0xdb2b54,_0x4ac7b2){_0x4ac7b2=_0x4ac7b2||0xc8;return function(_0x4ced8c){if(_0x4ced8c){return _0xdb2b54[_0x0932('0x15')](_0x4ac7b2)['json'](_0x4ced8c);}};}function respondWithFilteredResult(_0x3f10c0,_0x5d8ccf){return function(_0x276253){if(_0x276253){var _0x351d39=_0x276253[_0x0932('0x17')],_0x4f78ce=_0x5d8ccf[_0x0932('0x18')],_0x8f240=_0x5d8ccf['offset']+_0x5d8ccf['limit'],_0x54cd8d;if(_0x8f240>=_0x351d39){_0x8f240=_0x351d39;_0x54cd8d=0xc8;}else{_0x54cd8d=0xce;}_0x3f10c0[_0x0932('0x15')](_0x54cd8d);return _0x3f10c0[_0x0932('0x19')](_0x0932('0x1a'),_0x4f78ce+'-'+_0x8f240+'/'+_0x351d39)[_0x0932('0x1b')](_0x276253);}return null;};}function patchUpdates(_0x135878){return function(_0x118927){try{jsonpatch['apply'](_0x118927,_0x135878,!![]);}catch(_0x2a8d2e){return BPromise[_0x0932('0x1c')](_0x2a8d2e);}return _0x118927[_0x0932('0x1d')]();};}function saveUpdates(_0x5874a9,_0x10af3c){return function(_0x5a2348){if(_0x5a2348){return _0x5a2348[_0x0932('0x1e')](_0x5874a9)[_0x0932('0x1f')](function(_0x550a8e){return _0x550a8e;});}return null;};}function removeEntity(_0x337350,_0x310d6c){return function(_0x267f30){if(_0x267f30){return _0x267f30[_0x0932('0x20')]()[_0x0932('0x1f')](function(){_0x337350['status'](0xcc)[_0x0932('0x16')]();});}};}function handleEntityNotFound(_0x5a6673,_0x7a0884){return function(_0x171219){if(!_0x171219){_0x5a6673[_0x0932('0x14')](0x194);}return _0x171219;};}function handleError(_0x837a72,_0x34296b){_0x34296b=_0x34296b||0x1f4;return function(_0x25ba42){logger[_0x0932('0x21')](_0x25ba42[_0x0932('0x22')]);if(_0x25ba42[_0x0932('0x23')]){delete _0x25ba42[_0x0932('0x23')];}_0x837a72[_0x0932('0x15')](_0x34296b)['send'](_0x25ba42);};}exports[_0x0932('0x24')]=function(_0x3f4f4c,_0x14a58a){var _0x557d40={},_0x5567e7={},_0x370b16={'count':0x0,'rows':[]};var _0x219060=_['map'](db[_0x0932('0x25')]['rawAttributes'],function(_0x112e6a){return{'name':_0x112e6a[_0x0932('0x26')],'type':_0x112e6a[_0x0932('0x27')][_0x0932('0x28')]};});_0x5567e7[_0x0932('0x29')]=_[_0x0932('0x2a')](_0x219060,_0x0932('0x23'));_0x5567e7[_0x0932('0x2b')]=_[_0x0932('0x2c')](_0x3f4f4c[_0x0932('0x2b')]);_0x5567e7[_0x0932('0x2d')]=_['intersection'](_0x5567e7[_0x0932('0x29')],_0x5567e7[_0x0932('0x2b')]);_0x557d40[_0x0932('0x2e')]=_['intersection'](_0x5567e7['model'],qs[_0x0932('0x2f')](_0x3f4f4c[_0x0932('0x2b')]['fields']));_0x557d40[_0x0932('0x2e')]=_0x557d40['attributes'][_0x0932('0x30')]?_0x557d40[_0x0932('0x2e')]:_0x5567e7[_0x0932('0x29')];if(!_0x3f4f4c[_0x0932('0x2b')][_0x0932('0x31')](_0x0932('0x32'))){_0x557d40[_0x0932('0x33')]=qs['limit'](_0x3f4f4c[_0x0932('0x2b')][_0x0932('0x33')]);_0x557d40['offset']=qs['offset'](_0x3f4f4c[_0x0932('0x2b')][_0x0932('0x18')]);}_0x557d40['order']=qs[_0x0932('0x34')](_0x3f4f4c['query']['sort']);_0x557d40['where']=qs[_0x0932('0x2d')](_[_0x0932('0x35')](_0x3f4f4c[_0x0932('0x2b')],_0x5567e7[_0x0932('0x2d')]),_0x219060);if(_0x3f4f4c[_0x0932('0x2b')]['filter']){_0x557d40['where']=_[_0x0932('0x36')](_0x557d40['where'],{'$or':_[_0x0932('0x2a')](_0x219060,function(_0x4622c1){if(_0x4622c1[_0x0932('0x27')]!==_0x0932('0x37')){var _0x4324b9={};_0x4324b9[_0x4622c1[_0x0932('0x23')]]={'$like':'%'+_0x3f4f4c[_0x0932('0x2b')]['filter']+'%'};return _0x4324b9;}})});}_0x557d40=_[_0x0932('0x36')]({},_0x557d40,_0x3f4f4c[_0x0932('0x38')]);var _0x2e0610={'where':_0x557d40[_0x0932('0x39')]};return db[_0x0932('0x25')][_0x0932('0x17')](_0x2e0610)[_0x0932('0x1f')](function(_0x3b1f22){_0x370b16['count']=_0x3b1f22;if(_0x3f4f4c[_0x0932('0x2b')][_0x0932('0x3a')]){_0x557d40['include']=[{'all':!![]}];}return db[_0x0932('0x25')][_0x0932('0x3b')](_0x557d40);})[_0x0932('0x1f')](function(_0x58dbff){_0x370b16[_0x0932('0x3c')]=_0x58dbff;return _0x370b16;})[_0x0932('0x1f')](respondWithFilteredResult(_0x14a58a,_0x557d40))[_0x0932('0x3d')](handleError(_0x14a58a,null));};exports[_0x0932('0x3e')]=function(_0x329072,_0x2ee95a){var _0x407d11={'raw':!![],'where':{'id':_0x329072['params']['id']}},_0x591bc5={};_0x591bc5['model']=_[_0x0932('0x2c')](db[_0x0932('0x25')][_0x0932('0x3f')]);_0x591bc5[_0x0932('0x2b')]=_[_0x0932('0x2c')](_0x329072['query']);_0x591bc5[_0x0932('0x2d')]=_['intersection'](_0x591bc5[_0x0932('0x29')],_0x591bc5[_0x0932('0x2b')]);_0x407d11[_0x0932('0x2e')]=_[_0x0932('0x40')](_0x591bc5[_0x0932('0x29')],qs[_0x0932('0x2f')](_0x329072[_0x0932('0x2b')][_0x0932('0x2f')]));_0x407d11['attributes']=_0x407d11['attributes'][_0x0932('0x30')]?_0x407d11[_0x0932('0x2e')]:_0x591bc5[_0x0932('0x29')];if(_0x329072[_0x0932('0x2b')][_0x0932('0x3a')]){_0x407d11[_0x0932('0x41')]=[{'all':!![]}];}_0x407d11=_['merge']({},_0x407d11,_0x329072['options']);return db[_0x0932('0x25')][_0x0932('0x42')](_0x407d11)['then'](handleEntityNotFound(_0x2ee95a,null))[_0x0932('0x1f')](respondWithResult(_0x2ee95a,null))['catch'](handleError(_0x2ee95a,null));};exports['create']=function(_0x4d56b0,_0x5508a6){return db[_0x0932('0x25')][_0x0932('0x43')](_0x4d56b0[_0x0932('0x44')],{})[_0x0932('0x1f')](respondWithResult(_0x5508a6,0xc9))['catch'](handleError(_0x5508a6,null));};exports[_0x0932('0x1e')]=function(_0x527fd5,_0x119249){if(_0x527fd5[_0x0932('0x44')]['id']){delete _0x527fd5['body']['id'];}return db[_0x0932('0x25')][_0x0932('0x42')]({'where':{'id':_0x527fd5[_0x0932('0x45')]['id']}})[_0x0932('0x1f')](handleEntityNotFound(_0x119249,null))['then'](saveUpdates(_0x527fd5[_0x0932('0x44')],null))[_0x0932('0x1f')](respondWithResult(_0x119249,null))[_0x0932('0x3d')](handleError(_0x119249,null));};exports['destroy']=function(_0x5dd530,_0x1e62d8){return db[_0x0932('0x25')]['find']({'where':{'id':_0x5dd530[_0x0932('0x45')]['id']}})[_0x0932('0x1f')](handleEntityNotFound(_0x1e62d8,null))[_0x0932('0x1f')](removeEntity(_0x1e62d8,null))[_0x0932('0x3d')](handleError(_0x1e62d8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d0c9af0..45093a1 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 _0x3a77=['exports','define','FreshsalesField','idField','util','api','moment','bluebird','request-promise','./intFreshsalesField.attributes'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x3a77,0x1c6));var _0x73a7=function(_0x239904,_0x4b11e2){_0x239904=_0x239904-0x0;var _0x259609=_0x3a77[_0x239904];return _0x259609;};'use strict';var _=require('lodash');var util=require(_0x73a7('0x0'));var logger=require('../../config/logger')(_0x73a7('0x1'));var moment=require(_0x73a7('0x2'));var BPromise=require(_0x73a7('0x3'));var rp=require(_0x73a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x73a7('0x5'));module[_0x73a7('0x6')]=function(_0x18d238,_0xc61fa9){return _0x18d238[_0x73a7('0x7')](_0x73a7('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x73a7('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80ee=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2d7ced,_0x55aaba){var _0x104d1d=function(_0x22ed44){while(--_0x22ed44){_0x2d7ced['push'](_0x2d7ced['shift']());}};_0x104d1d(++_0x55aaba);}(_0x80ee,0x1b8));var _0xe80e=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0x80ee[_0x4c3a36];return _0x40f945;};'use strict';var _=require(_0xe80e('0x0'));var util=require(_0xe80e('0x1'));var logger=require(_0xe80e('0x2'))(_0xe80e('0x3'));var moment=require(_0xe80e('0x4'));var BPromise=require(_0xe80e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe80e('0x6'));var rimraf=require(_0xe80e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe80e('0x8'));module[_0xe80e('0x9')]=function(_0x32a5fe,_0x5c3583){return _0x32a5fe[_0xe80e('0xa')](_0xe80e('0xb'),attributes,{'tableName':_0xe80e('0xc'),'paranoid':![],'indexes':[{'name':_0xe80e('0xd'),'fields':[_0xe80e('0xe'),_0xe80e('0xf')],'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 2a3000d..e6529f1 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 _0x6a90=['request','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x6a90,0x14e));var _0x06a9=function(_0x5e8653,_0x368047){_0x5e8653=_0x5e8653-0x0;var _0x3291d7=_0x6a90[_0x5e8653];return _0x3291d7;};'use strict';var _=require('lodash');var util=require(_0x06a9('0x0'));var moment=require(_0x06a9('0x1'));var BPromise=require(_0x06a9('0x2'));var rs=require(_0x06a9('0x3'));var fs=require('fs');var Redis=require(_0x06a9('0x4'));var db=require(_0x06a9('0x5'))['db'];var utils=require(_0x06a9('0x6'));var logger=require(_0x06a9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06a9('0x8'));var client=jayson[_0x06a9('0x9')][_0x06a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8db,_0x242016,_0x47529c){return new BPromise(function(_0x5bfc28,_0x54b797){return client[_0x06a9('0xb')](_0x5ad8db,_0x47529c)['then'](function(_0x1e84a5){logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));logger[_0x06a9('0xe')](_0x06a9('0xf'),_0x242016,_0x06a9('0xd'),JSON[_0x06a9('0x10')](_0x1e84a5));if(_0x1e84a5['error']){if(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x12')]===0x1f4){logger['error'](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')]['message']);return _0x54b797(_0x1e84a5[_0x06a9('0x11')]['message']);}logger[_0x06a9('0x11')](_0x06a9('0x13'),_0x242016,_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);return _0x5bfc28(_0x1e84a5[_0x06a9('0x11')][_0x06a9('0x14')]);}else{logger[_0x06a9('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x242016,_0x06a9('0xd'));_0x5bfc28(_0x1e84a5[_0x06a9('0x15')][_0x06a9('0x14')]);}})[_0x06a9('0x16')](function(_0x13c551){logger['error'](_0x06a9('0x13'),_0x242016,_0x13c551);_0x54b797(_0x13c551);});});} \ No newline at end of file +var _0xa37a=['../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13097c,_0x4c814b){var _0x42dcd4=function(_0x4ea002){while(--_0x4ea002){_0x13097c['push'](_0x13097c['shift']());}};_0x42dcd4(++_0x4c814b);}(_0xa37a,0x135));var _0xaa37=function(_0xb22c99,_0x35cb99){_0xb22c99=_0xb22c99-0x0;var _0x1f8948=_0xa37a[_0xb22c99];return _0x1f8948;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa37('0x1'));var db=require(_0xaa37('0x2'))['db'];var utils=require(_0xaa37('0x3'));var logger=require(_0xaa37('0x4'))(_0xaa37('0x5'));var config=require(_0xaa37('0x6'));var jayson=require(_0xaa37('0x7'));var client=jayson[_0xaa37('0x8')][_0xaa37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a806,_0x1ca119,_0xaa05ca){return new BPromise(function(_0x312d48,_0x2d4d55){return client[_0xaa37('0xa')](_0x52a806,_0xaa05ca)['then'](function(_0x2fc903){logger[_0xaa37('0xb')](_0xaa37('0xc'),_0x1ca119,_0xaa37('0xd'));logger['debug'](_0xaa37('0xe'),_0x1ca119,_0xaa37('0xd'),JSON[_0xaa37('0xf')](_0x2fc903));if(_0x2fc903[_0xaa37('0x10')]){if(_0x2fc903[_0xaa37('0x10')][_0xaa37('0x11')]===0x1f4){logger[_0xaa37('0x10')](_0xaa37('0xc'),_0x1ca119,_0x2fc903[_0xaa37('0x10')][_0xaa37('0x12')]);return _0x2d4d55(_0x2fc903[_0xaa37('0x10')][_0xaa37('0x12')]);}logger[_0xaa37('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1ca119,_0x2fc903[_0xaa37('0x10')][_0xaa37('0x12')]);return _0x312d48(_0x2fc903[_0xaa37('0x10')][_0xaa37('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x1ca119,'request\x20sent');_0x312d48(_0x2fc903[_0xaa37('0x13')][_0xaa37('0x12')]);}})[_0xaa37('0x14')](function(_0x4c7709){logger[_0xaa37('0x10')](_0xaa37('0xc'),_0x1ca119,_0x4c7709);_0x2d4d55(_0x4c7709);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 326643a..307d307 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 _0x818f=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get'];(function(_0xd13cad,_0xea397a){var _0xc744f2=function(_0x770ba1){while(--_0x770ba1){_0xd13cad['push'](_0xd13cad['shift']());}};_0xc744f2(++_0xea397a);}(_0x818f,0x1da));var _0xf818=function(_0x20bfe4,_0x2a5b58){_0x20bfe4=_0x20bfe4-0x0;var _0x3a23b6=_0x818f[_0x20bfe4];return _0x3a23b6;};'use strict';var multer=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var path=require(_0xf818('0x2'));var timeout=require(_0xf818('0x3'));var express=require(_0xf818('0x4'));var router=express[_0xf818('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf818('0x6'));var config=require(_0xf818('0x7'));var controller=require(_0xf818('0x8'));router[_0xf818('0x9')]('/',auth[_0xf818('0xa')](),controller[_0xf818('0xb')]);router[_0xf818('0x9')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['show']);router[_0xf818('0x9')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller['getConfigurations']);router['get'](_0xf818('0xe'),auth[_0xf818('0xa')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')]('/',auth[_0xf818('0xa')](),controller['create']);router[_0xf818('0x10')](_0xf818('0xd'),auth[_0xf818('0xa')](),controller[_0xf818('0x11')]);router[_0xf818('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf818('0x13')]);router[_0xf818('0x14')](_0xf818('0xc'),auth[_0xf818('0xa')](),controller['destroy']);module[_0xf818('0x15')]=router; \ No newline at end of file +var _0x2318=['create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./intSalesforceAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x50bd21,_0x25ea9e){var _0x22fa54=function(_0x19f443){while(--_0x19f443){_0x50bd21['push'](_0x50bd21['shift']());}};_0x22fa54(++_0x25ea9e);}(_0x2318,0x149));var _0x8231=function(_0x238ab8,_0x570f8d){_0x238ab8=_0x238ab8-0x0;var _0x242b06=_0x2318[_0x238ab8];return _0x242b06;};'use strict';var multer=require(_0x8231('0x0'));var util=require(_0x8231('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8231('0x2'));var router=express[_0x8231('0x3')]();var auth=require(_0x8231('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8231('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8231('0x6')]);router[_0x8231('0x7')](_0x8231('0x8'),auth[_0x8231('0x9')](),controller[_0x8231('0xa')]);router['get'](_0x8231('0xb'),auth[_0x8231('0x9')](),controller[_0x8231('0xc')]);router[_0x8231('0x7')](_0x8231('0xd'),auth['isAuthenticated'](),controller[_0x8231('0xe')]);router[_0x8231('0xf')]('/',auth[_0x8231('0x9')](),controller[_0x8231('0x10')]);router[_0x8231('0xf')](_0x8231('0xb'),auth['isAuthenticated'](),controller[_0x8231('0x11')]);router[_0x8231('0x12')]('/:id',auth[_0x8231('0x9')](),controller[_0x8231('0x13')]);router[_0x8231('0x14')](_0x8231('0x8'),auth['isAuthenticated'](),controller[_0x8231('0x15')]);module[_0x8231('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c1ac856..fad9944 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 _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x5fc3[_0x5bc5fe];return _0x298ea7;};'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 +var _0x8ef6=['newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x31d454,_0x40ec23){var _0x116b9c=function(_0x176c60){while(--_0x176c60){_0x31d454['push'](_0x31d454['shift']());}};_0x116b9c(++_0x40ec23);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5afde4,_0x2b2d72){_0x5afde4=_0x5afde4-0x0;var _0x136008=_0x8ef6[_0x5afde4];return _0x136008;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')]},'description':{'type':Sequelize[_0x68ef('0x2')]},'username':{'type':Sequelize[_0x68ef('0x2')],'unique':_0x68ef('0x3')},'remoteUri':{'type':Sequelize[_0x68ef('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x68ef('0x2')]},'clientSecret':{'type':Sequelize[_0x68ef('0x2')]},'securityToken':{'type':Sequelize[_0x68ef('0x2')]},'serverUrl':{'type':Sequelize[_0x68ef('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x68ef('0x4')),'defaultValue':_0x68ef('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index be3044e..778077d 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 _0xfd25=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','SalesforceAccount','rawAttributes','type','key','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientSecret','username','password','slice','substring','lastIndexOf','clientId','login','concat','securityToken','isNil','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','ticketType','Case','Origin','SuppliedName','remove','custom','picklistValues','label','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf'];(function(_0x4f8bd4,_0xec5450){var _0x4c4078=function(_0x5f04be){while(--_0x5f04be){_0x4f8bd4['push'](_0x4f8bd4['shift']());}};_0x4c4078(++_0xec5450);}(_0xfd25,0x88));var _0x5fd2=function(_0x4f1086,_0x32d642){_0x4f1086=_0x4f1086-0x0;var _0x1bbe11=_0xfd25[_0x4f1086];return _0x1bbe11;};'use strict';var pdf=require(_0x5fd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5fd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fd2('0x2'));var rp=require(_0x5fd2('0x3'));var moment=require(_0x5fd2('0x4'));var BPromise=require(_0x5fd2('0x5'));var Mustache=require(_0x5fd2('0x6'));var util=require('util');var path=require(_0x5fd2('0x7'));var sox=require(_0x5fd2('0x8'));var csv=require(_0x5fd2('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5fd2('0xa'));var crypto=require(_0x5fd2('0xb'));var jsforce=require(_0x5fd2('0xc'));var deskjs=require(_0x5fd2('0xd'));var toCsv=require(_0x5fd2('0x9'));var querystring=require('querystring');var Papa=require(_0x5fd2('0xe'));var Redis=require(_0x5fd2('0xf'));var authService=require(_0x5fd2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5fd2('0x11'));var hardwareService=require(_0x5fd2('0x12'));var logger=require(_0x5fd2('0x13'))(_0x5fd2('0x14'));var utils=require(_0x5fd2('0x15'));var config=require(_0x5fd2('0x16'));var db=require(_0x5fd2('0x17'))['db'];var integrations=require(_0x5fd2('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5fd2('0x19')]({'port':0x232a});function checkPasswordPattern(_0x120b35,_0x4aaa37,_0x79b183){if(_0x79b183){var _0x500063=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x500063[_0x5fd2('0x1a')](_0x4aaa37)){return _0x120b35;}else{throw new db['Sequelize'][(_0x5fd2('0x1b'))](_0x5fd2('0x1c'));}}else{return _0x120b35;}}function respondWithRpcPromise(_0xfeddda,_0x21249d,_0x57c8cd,_0x3542d5){return new BPromise(function(_0x248ed5,_0x535881){var _0x55ce67=_0x3542d5||client;return _0x55ce67[_0x5fd2('0x1d')](_0xfeddda,_0x57c8cd)['then'](function(_0x2a9fba){logger['info'](_0x5fd2('0x1e'),_0x21249d,_0x5fd2('0x1f'));logger[_0x5fd2('0x20')](_0x5fd2('0x21'),_0x21249d,'request\x20sent',JSON[_0x5fd2('0x22')](_0x2a9fba));if(_0x2a9fba[_0x5fd2('0x23')]){if(_0x2a9fba['error']['code']===0x1f4){logger[_0x5fd2('0x23')](_0x5fd2('0x1e'),_0x21249d,_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);return _0x535881(_0x2a9fba[_0x5fd2('0x23')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x21249d,_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);return _0x248ed5(_0x2a9fba[_0x5fd2('0x23')][_0x5fd2('0x24')]);}else{logger['info'](_0x5fd2('0x1e'),_0x21249d,_0x5fd2('0x1f'));_0x248ed5(_0x2a9fba[_0x5fd2('0x25')][_0x5fd2('0x24')]);}})[_0x5fd2('0x26')](function(_0x494963){logger[_0x5fd2('0x23')](_0x5fd2('0x1e'),_0x21249d,_0x494963);_0x535881(_0x494963);});});}function respondWithStatusCode(_0x424f6d,_0x3c8c7a){_0x3c8c7a=_0x3c8c7a||0xcc;return function(_0x11b78f){if(_0x11b78f){return _0x424f6d['sendStatus'](_0x3c8c7a);}return _0x424f6d['status'](_0x3c8c7a)[_0x5fd2('0x27')]();};}function respondWithResult(_0x2d7388,_0x598715){_0x598715=_0x598715||0xc8;return function(_0x4fb514){if(_0x4fb514){return _0x2d7388[_0x5fd2('0x28')](_0x598715)[_0x5fd2('0x29')](_0x4fb514);}};}function respondWithFilteredResult(_0x350e32,_0x1454f4){return function(_0x4c01c6){if(_0x4c01c6){var _0x1784aa=_0x4c01c6[_0x5fd2('0x2a')],_0x1debf8=_0x1454f4[_0x5fd2('0x2b')],_0x472c97=_0x1454f4[_0x5fd2('0x2b')]+_0x1454f4[_0x5fd2('0x2c')],_0x411431;if(_0x472c97>=_0x1784aa){_0x472c97=_0x1784aa;_0x411431=0xc8;}else{_0x411431=0xce;}_0x350e32[_0x5fd2('0x28')](_0x411431);return _0x350e32['set'](_0x5fd2('0x2d'),_0x1debf8+'-'+_0x472c97+'/'+_0x1784aa)[_0x5fd2('0x29')](_0x4c01c6);}return null;};}function patchUpdates(_0x5c8257){return function(_0x167be4){try{jsonpatch[_0x5fd2('0x2e')](_0x167be4,_0x5c8257,!![]);}catch(_0x11763b){return BPromise[_0x5fd2('0x2f')](_0x11763b);}return _0x167be4[_0x5fd2('0x30')]();};}function saveUpdates(_0x22e636,_0x4c3676){return function(_0x44f13d){if(_0x44f13d){return _0x44f13d[_0x5fd2('0x31')](_0x22e636)[_0x5fd2('0x32')](function(_0x1694aa){return _0x1694aa;});}return null;};}function removeEntity(_0x5f0672,_0x4fa739){return function(_0x3d46f1){if(_0x3d46f1){return _0x3d46f1['destroy']()[_0x5fd2('0x32')](function(){_0x5f0672['status'](0xcc)[_0x5fd2('0x27')]();});}};}function handleEntityNotFound(_0x2b3198,_0x402c16){return function(_0x5024f1){if(!_0x5024f1){_0x2b3198[_0x5fd2('0x33')](0x194);}return _0x5024f1;};}function handleError(_0xf99049,_0x5bfca6){_0x5bfca6=_0x5bfca6||0x1f4;return function(_0x2ae0dd){logger[_0x5fd2('0x23')](_0x2ae0dd[_0x5fd2('0x34')]);if(_0x2ae0dd[_0x5fd2('0x35')]){delete _0x2ae0dd[_0x5fd2('0x35')];}_0xf99049[_0x5fd2('0x28')](_0x5bfca6)[_0x5fd2('0x36')](_0x2ae0dd);};}exports['index']=function(_0x1f9951,_0x5de456){var _0x3b5473={},_0x345a4b={},_0x326983={'count':0x0,'rows':[]};var _0xf07717=_['map'](db[_0x5fd2('0x37')][_0x5fd2('0x38')],function(_0x110b9c){return{'name':_0x110b9c['fieldName'],'type':_0x110b9c[_0x5fd2('0x39')][_0x5fd2('0x3a')]};});_0x345a4b[_0x5fd2('0x3b')]=_[_0x5fd2('0x3c')](_0xf07717,_0x5fd2('0x35'));_0x345a4b['query']=_['keys'](_0x1f9951['query']);_0x345a4b[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x345a4b[_0x5fd2('0x3b')],_0x345a4b[_0x5fd2('0x3f')]);_0x3b5473['attributes']=_['intersection'](_0x345a4b[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x40')]));_0x3b5473[_0x5fd2('0x41')]=_0x3b5473[_0x5fd2('0x41')]['length']?_0x3b5473[_0x5fd2('0x41')]:_0x345a4b['model'];if(!_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x42')](_0x5fd2('0x43'))){_0x3b5473[_0x5fd2('0x2c')]=qs[_0x5fd2('0x2c')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x2c')]);_0x3b5473[_0x5fd2('0x2b')]=qs[_0x5fd2('0x2b')](_0x1f9951['query'][_0x5fd2('0x2b')]);}_0x3b5473[_0x5fd2('0x44')]=qs[_0x5fd2('0x45')](_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x45')]);_0x3b5473[_0x5fd2('0x46')]=qs[_0x5fd2('0x3d')](_[_0x5fd2('0x47')](_0x1f9951[_0x5fd2('0x3f')],_0x345a4b[_0x5fd2('0x3d')]),_0xf07717);if(_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x48')]){_0x3b5473['where']=_[_0x5fd2('0x49')](_0x3b5473[_0x5fd2('0x46')],{'$or':_[_0x5fd2('0x3c')](_0xf07717,function(_0x141e84){if(_0x141e84[_0x5fd2('0x39')]!==_0x5fd2('0x4a')){var _0x1c7673={};_0x1c7673[_0x141e84['name']]={'$like':'%'+_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x48')]+'%'};return _0x1c7673;}})});}_0x3b5473=_['merge']({},_0x3b5473,_0x1f9951[_0x5fd2('0x4b')]);var _0x2d663f={'where':_0x3b5473['where']};return db[_0x5fd2('0x37')][_0x5fd2('0x2a')](_0x2d663f)[_0x5fd2('0x32')](function(_0x2cf40c){_0x326983[_0x5fd2('0x2a')]=_0x2cf40c;if(_0x1f9951[_0x5fd2('0x3f')][_0x5fd2('0x4c')]){_0x3b5473[_0x5fd2('0x4d')]=[{'all':!![]}];}return db[_0x5fd2('0x37')][_0x5fd2('0x4e')](_0x3b5473);})[_0x5fd2('0x32')](function(_0x1a6f4f){_0x326983[_0x5fd2('0x4f')]=_0x1a6f4f;return _0x326983;})['then'](respondWithFilteredResult(_0x5de456,_0x3b5473))[_0x5fd2('0x26')](handleError(_0x5de456,null));};exports[_0x5fd2('0x50')]=function(_0x57a535,_0x255118){var _0x1420e1={'raw':![],'where':{'id':_0x57a535['params']['id']}},_0x109301={};_0x109301[_0x5fd2('0x3b')]=_[_0x5fd2('0x51')](db[_0x5fd2('0x37')]['rawAttributes']);_0x109301['query']=_[_0x5fd2('0x51')](_0x57a535[_0x5fd2('0x3f')]);_0x109301[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x109301['model'],_0x109301['query']);_0x1420e1['attributes']=_[_0x5fd2('0x3e')](_0x109301[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x57a535[_0x5fd2('0x3f')][_0x5fd2('0x40')]));_0x1420e1['attributes']=_0x1420e1[_0x5fd2('0x41')]['length']?_0x1420e1[_0x5fd2('0x41')]:_0x109301[_0x5fd2('0x3b')];if(_0x57a535['query'][_0x5fd2('0x4c')]){_0x1420e1['include']=[{'all':!![]}];}_0x1420e1=_[_0x5fd2('0x49')]({},_0x1420e1,_0x57a535[_0x5fd2('0x4b')]);return db['SalesforceAccount'][_0x5fd2('0x52')](_0x1420e1)['then'](handleEntityNotFound(_0x255118,null))[_0x5fd2('0x32')](respondWithResult(_0x255118,null))['catch'](handleError(_0x255118,null));};exports['create']=function(_0x28e6cd,_0x403401){return db[_0x5fd2('0x37')][_0x5fd2('0x53')](_0x28e6cd['body'],{})['then'](respondWithResult(_0x403401,0xc9))[_0x5fd2('0x26')](handleError(_0x403401,null));};exports[_0x5fd2('0x31')]=function(_0x4bdf85,_0x326cab){if(_0x4bdf85[_0x5fd2('0x54')]['id']){delete _0x4bdf85[_0x5fd2('0x54')]['id'];}return db['SalesforceAccount'][_0x5fd2('0x52')]({'where':{'id':_0x4bdf85[_0x5fd2('0x55')]['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0x326cab,null))[_0x5fd2('0x32')](saveUpdates(_0x4bdf85['body'],null))['then'](respondWithResult(_0x326cab,null))[_0x5fd2('0x26')](handleError(_0x326cab,null));};exports['destroy']=function(_0x26695d,_0x23c406){return db[_0x5fd2('0x37')][_0x5fd2('0x52')]({'where':{'id':_0x26695d['params']['id']}})['then'](handleEntityNotFound(_0x23c406,null))[_0x5fd2('0x32')](removeEntity(_0x23c406,null))['catch'](handleError(_0x23c406,null));};exports[_0x5fd2('0x56')]=function(_0x48209f,_0xb62ae8,_0x1cbfd9){var _0x2bacdc={};var _0x8591a1={};var _0x1c44ab;var _0x504088;return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x48209f[_0x5fd2('0x55')]['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0xb62ae8,null))['then'](function(_0x11dbeb){if(_0x11dbeb){_0x1c44ab=_0x11dbeb;_0x8591a1[_0x5fd2('0x3b')]=_[_0x5fd2('0x51')](db[_0x5fd2('0x58')]['rawAttributes']);_0x8591a1['query']=_['keys'](_0x48209f[_0x5fd2('0x3f')]);_0x8591a1[_0x5fd2('0x3d')]=_[_0x5fd2('0x3e')](_0x8591a1[_0x5fd2('0x3b')],_0x8591a1[_0x5fd2('0x3f')]);_0x2bacdc[_0x5fd2('0x41')]=_[_0x5fd2('0x3e')](_0x8591a1[_0x5fd2('0x3b')],qs[_0x5fd2('0x40')](_0x48209f['query']['fields']));_0x2bacdc[_0x5fd2('0x41')]=_0x2bacdc[_0x5fd2('0x41')]['length']?_0x2bacdc['attributes']:_0x8591a1[_0x5fd2('0x3b')];_0x2bacdc[_0x5fd2('0x44')]=qs['sort'](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x45')]);_0x2bacdc[_0x5fd2('0x46')]=qs[_0x5fd2('0x3d')](_[_0x5fd2('0x47')](_0x48209f[_0x5fd2('0x3f')],_0x8591a1[_0x5fd2('0x3d')]));if(_0x48209f[_0x5fd2('0x3f')]['filter']){_0x2bacdc['where']=_[_0x5fd2('0x49')](_0x2bacdc[_0x5fd2('0x46')],{'$or':_[_0x5fd2('0x3c')](_0x2bacdc[_0x5fd2('0x41')],function(_0x558edf){var _0xf64916={};_0xf64916[_0x558edf]={'$like':'%'+_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x48')]+'%'};return _0xf64916;})});}_0x2bacdc=_[_0x5fd2('0x49')]({},_0x2bacdc,_0x48209f['options']);return _0x1c44ab['getConfigurations'](_0x2bacdc);}})[_0x5fd2('0x32')](function(_0x3f4e51){if(_0x3f4e51){_0x504088=_0x3f4e51[_0x5fd2('0x59')];if(!_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x42')](_0x5fd2('0x43'))){_0x2bacdc[_0x5fd2('0x2c')]=qs[_0x5fd2('0x2c')](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x2c')]);_0x2bacdc[_0x5fd2('0x2b')]=qs[_0x5fd2('0x2b')](_0x48209f[_0x5fd2('0x3f')][_0x5fd2('0x2b')]);}return _0x1c44ab['getConfigurations'](_0x2bacdc);}})[_0x5fd2('0x32')](function(_0x2f8179){if(_0x2f8179){return _0x2f8179?{'count':_0x504088,'rows':_0x2f8179}:null;}})[_0x5fd2('0x32')](respondWithResult(_0xb62ae8,null))['catch'](handleError(_0xb62ae8,null));};exports[_0x5fd2('0x5a')]=function(_0x32f017,_0x1a8149,_0x1f7d5b){if(_0x32f017['body']['id']){delete _0x32f017[_0x5fd2('0x54')]['id'];}return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x32f017['params']['id']}})[_0x5fd2('0x32')](handleEntityNotFound(_0x1a8149,null))[_0x5fd2('0x32')](function(_0x57800a){if(_0x57800a){_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5b')]=_0x57800a['id'];_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5c')]=integrations[_0x5fd2('0x5d')](_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5e')],_0x32f017[_0x5fd2('0x54')]['type']);_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5f')]=integrations[_0x5fd2('0x60')](_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x5e')],_0x32f017[_0x5fd2('0x54')][_0x5fd2('0x39')]);return db['SalesforceConfiguration'][_0x5fd2('0x53')](_0x32f017[_0x5fd2('0x54')],{'include':[{'model':db[_0x5fd2('0x61')],'as':_0x5fd2('0x5c')},{'model':db[_0x5fd2('0x61')],'as':_0x5fd2('0x5f')}]});}return null;})[_0x5fd2('0x32')](respondWithResult(_0x1a8149,null))[_0x5fd2('0x26')](handleError(_0x1a8149,null));};exports['getFields']=function(_0x6c5b82,_0x934ac3,_0x3f1806){var _0x901eb3;var _0xcd6682='';var _0x178cc5=_0x5fd2('0x62');return db[_0x5fd2('0x37')][_0x5fd2('0x57')]({'where':{'id':_0x6c5b82[_0x5fd2('0x55')]['id']},'attributes':['id',_0x5fd2('0x63'),'clientId',_0x5fd2('0x64'),_0x5fd2('0x65'),_0x5fd2('0x66'),'securityToken']})[_0x5fd2('0x32')](handleEntityNotFound(_0x934ac3,null))[_0x5fd2('0x32')](function(_0x222875){if(_0x222875){_0xcd6682=_0x222875['remoteUri'];var _0x715a9d=_0xcd6682[_0x5fd2('0x67')](-0x1);if(_0x715a9d==='/'){_0xcd6682=_0xcd6682[_0x5fd2('0x68')](0x0,_0xcd6682[_0x5fd2('0x69')](_0x715a9d));}_0x901eb3=new jsforce['Connection']({'oauth2':{'loginUrl':_0xcd6682,'clientId':_0x222875[_0x5fd2('0x6a')],'clientSecret':_0x222875['clientSecret']}});return _0x901eb3[_0x5fd2('0x6b')](_0x222875['username'],_0x222875['password'][_0x5fd2('0x6c')](_0x222875[_0x5fd2('0x6d')]));}})[_0x5fd2('0x32')](function(_0xe57ac7){if(_0xe57ac7){if(!_[_0x5fd2('0x6e')](_0x6c5b82['query']['ticketType'])){_0x178cc5=_0x6c5b82['query']['ticketType'];}return _0x901eb3[_0x5fd2('0x6f')](_0x178cc5)[_0x5fd2('0x70')]();}})[_0x5fd2('0x32')](function(_0x5ab8d8){var _0x478067=[_0x5fd2('0x71'),_0x5fd2('0x72'),_0x5fd2('0x73'),_0x5fd2('0x74'),_0x5fd2('0x75'),_0x5fd2('0x76'),_0x5fd2('0x77'),_0x5fd2('0x78')];if(!_['isNil'](_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x79')])&&_0x6c5b82[_0x5fd2('0x3f')]['ticketType']===_0x5fd2('0x7a')){_0x478067=[_0x5fd2('0x78'),_0x5fd2('0x7b'),'Reason',_0x5fd2('0x77'),'Priority','IsEscalated',_0x5fd2('0x7c'),'SuppliedCompany'];}if(_0x5ab8d8){_[_0x5fd2('0x7d')](_0x5ab8d8[_0x5fd2('0x40')],function(_0x1335af){return _0x1335af[_0x5fd2('0x7e')]===![]&&!_0x478067['includes'](_0x1335af['name']);});return{'count':_0x5ab8d8['fields']['length'],'rows':_[_0x5fd2('0x3c')](_0x5ab8d8[_0x5fd2('0x40')],function(_0x3ec504){return{'id':_0x3ec504[_0x5fd2('0x35')],'name':_0x3ec504['label'],'custom':_0x3ec504[_0x5fd2('0x7e')],'options':_0x3ec504[_0x5fd2('0x7f')][_0x5fd2('0x59')]>0x0?_['map'](_0x3ec504['picklistValues'],function(_0x5e3d28){return{'name':_0x5e3d28[_0x5fd2('0x80')],'value':_0x5e3d28[_0x5fd2('0x81')]};}):_0x3ec504['type']=='boolean'?[{'name':_0x5fd2('0x82'),'value':_0x5fd2('0x83')},{'name':_0x5fd2('0x84'),'value':_0x5fd2('0x85')}]:[]};})};}})[_0x5fd2('0x32')](respondWithResult(_0x934ac3,null))['catch'](function(_0x4cc633){var _0x546e23=_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x1a')]?0x1f4:_0x4cc633[_0x5fd2('0x86')]||0x1f4;logger[_0x5fd2('0x23')](_0x5fd2('0x87'),_0x5fd2('0x88'),_0x546e23,JSON['stringify'](_0x4cc633));delete _0x4cc633['name'];if(_0x546e23===0x191){_0x546e23=0x190;}_0x934ac3[_0x5fd2('0x28')](_0x546e23)['send'](_0x6c5b82[_0x5fd2('0x3f')][_0x5fd2('0x1a')]?{'message':_0x5fd2('0x89'),'statusCode':_0x4cc633[_0x5fd2('0x86')]}:_0x4cc633);});}; \ No newline at end of file +var _0x1124=['SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','limit','Content-Range','apply','save','update','then','destroy','status','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','filters','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','Type','Origin','Priority','SuppliedCompany','custom','includes','label','picklistValues','boolean','True','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x1124,0xeb));var _0x4112=function(_0x51bc58,_0x3d55c1){_0x51bc58=_0x51bc58-0x0;var _0xfda00a=_0x1124[_0x51bc58];return _0xfda00a;};'use strict';var pdf=require(_0x4112('0x0'));var emlformat=require(_0x4112('0x1'));var rimraf=require(_0x4112('0x2'));var zipdir=require(_0x4112('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4112('0x4'));var BPromise=require(_0x4112('0x5'));var Mustache=require(_0x4112('0x6'));var util=require('util');var path=require(_0x4112('0x7'));var sox=require(_0x4112('0x8'));var csv=require(_0x4112('0x9'));var ejs=require(_0x4112('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4112('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4112('0xc'));var toCsv=require(_0x4112('0x9'));var querystring=require('querystring');var Papa=require(_0x4112('0xd'));var Redis=require(_0x4112('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4112('0xf'));var as=require(_0x4112('0x10'));var hardwareService=require(_0x4112('0x11'));var logger=require(_0x4112('0x12'))(_0x4112('0x13'));var utils=require(_0x4112('0x14'));var config=require('../../config/environment');var db=require(_0x4112('0x15'))['db'];var integrations=require(_0x4112('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x4112('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x337c8f,_0x23f95c,_0x3b56ca){if(_0x3b56ca){var _0x5ec0e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ec0e9['test'](_0x23f95c)){return _0x337c8f;}else{throw new db['Sequelize'][(_0x4112('0x18'))](_0x4112('0x19'));}}else{return _0x337c8f;}}function respondWithRpcPromise(_0x1eeb12,_0x4176d4,_0x366387,_0x5c1fb7){return new BPromise(function(_0x258d95,_0x8b509e){var _0x2e5b01=_0x5c1fb7||client;return _0x2e5b01[_0x4112('0x1a')](_0x1eeb12,_0x366387)['then'](function(_0x4d98cc){logger[_0x4112('0x1b')](_0x4112('0x1c'),_0x4176d4,_0x4112('0x1d'));logger[_0x4112('0x1e')](_0x4112('0x1f'),_0x4176d4,_0x4112('0x1d'),JSON[_0x4112('0x20')](_0x4d98cc));if(_0x4d98cc[_0x4112('0x21')]){if(_0x4d98cc['error'][_0x4112('0x22')]===0x1f4){logger[_0x4112('0x21')](_0x4112('0x1c'),_0x4176d4,_0x4d98cc[_0x4112('0x21')][_0x4112('0x23')]);return _0x8b509e(_0x4d98cc[_0x4112('0x21')]['message']);}logger[_0x4112('0x21')](_0x4112('0x1c'),_0x4176d4,_0x4d98cc[_0x4112('0x21')][_0x4112('0x23')]);return _0x258d95(_0x4d98cc['error'][_0x4112('0x23')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4176d4,_0x4112('0x1d'));_0x258d95(_0x4d98cc[_0x4112('0x24')][_0x4112('0x23')]);}})[_0x4112('0x25')](function(_0x2d1557){logger['error'](_0x4112('0x1c'),_0x4176d4,_0x2d1557);_0x8b509e(_0x2d1557);});});}function respondWithStatusCode(_0x5f4a75,_0x263c79){_0x263c79=_0x263c79||0xcc;return function(_0x163475){if(_0x163475){return _0x5f4a75[_0x4112('0x26')](_0x263c79);}return _0x5f4a75['status'](_0x263c79)[_0x4112('0x27')]();};}function respondWithResult(_0x33ff20,_0x5c92e1){_0x5c92e1=_0x5c92e1||0xc8;return function(_0xf607b8){if(_0xf607b8){return _0x33ff20['status'](_0x5c92e1)[_0x4112('0x28')](_0xf607b8);}};}function respondWithFilteredResult(_0x583ae0,_0x5389b3){return function(_0x2a8717){if(_0x2a8717){var _0x43beea=_0x2a8717['count'],_0x4aa64d=_0x5389b3['offset'],_0x1243ec=_0x5389b3[_0x4112('0x29')]+_0x5389b3[_0x4112('0x2a')],_0x4e214c;if(_0x1243ec>=_0x43beea){_0x1243ec=_0x43beea;_0x4e214c=0xc8;}else{_0x4e214c=0xce;}_0x583ae0['status'](_0x4e214c);return _0x583ae0['set'](_0x4112('0x2b'),_0x4aa64d+'-'+_0x1243ec+'/'+_0x43beea)['json'](_0x2a8717);}return null;};}function patchUpdates(_0x4f5e45){return function(_0x1ef7d6){try{jsonpatch[_0x4112('0x2c')](_0x1ef7d6,_0x4f5e45,!![]);}catch(_0x42ad1d){return BPromise['reject'](_0x42ad1d);}return _0x1ef7d6[_0x4112('0x2d')]();};}function saveUpdates(_0x359b89,_0x3ca3f0){return function(_0x49f15e){if(_0x49f15e){return _0x49f15e[_0x4112('0x2e')](_0x359b89)[_0x4112('0x2f')](function(_0x466102){return _0x466102;});}return null;};}function removeEntity(_0x584fe6,_0x2f27cd){return function(_0x37008b){if(_0x37008b){return _0x37008b[_0x4112('0x30')]()[_0x4112('0x2f')](function(){_0x584fe6[_0x4112('0x31')](0xcc)[_0x4112('0x27')]();});}};}function handleEntityNotFound(_0x5cd9bd,_0x5e01b2){return function(_0x1a6f25){if(!_0x1a6f25){_0x5cd9bd[_0x4112('0x26')](0x194);}return _0x1a6f25;};}function handleError(_0x4d436f,_0x4ca97f){_0x4ca97f=_0x4ca97f||0x1f4;return function(_0xef8e39){logger[_0x4112('0x21')](_0xef8e39[_0x4112('0x32')]);if(_0xef8e39[_0x4112('0x33')]){delete _0xef8e39['name'];}_0x4d436f['status'](_0x4ca97f)[_0x4112('0x34')](_0xef8e39);};}exports[_0x4112('0x35')]=function(_0x3ffeb0,_0x4e5159){var _0x1d0345={},_0xc5738e={},_0x151b12={'count':0x0,'rows':[]};var _0x2dece6=_[_0x4112('0x36')](db[_0x4112('0x37')][_0x4112('0x38')],function(_0x5916c5){return{'name':_0x5916c5[_0x4112('0x39')],'type':_0x5916c5['type'][_0x4112('0x3a')]};});_0xc5738e[_0x4112('0x3b')]=_[_0x4112('0x36')](_0x2dece6,_0x4112('0x33'));_0xc5738e[_0x4112('0x3c')]=_['keys'](_0x3ffeb0['query']);_0xc5738e[_0x4112('0x3d')]=_['intersection'](_0xc5738e['model'],_0xc5738e[_0x4112('0x3c')]);_0x1d0345[_0x4112('0x3e')]=_['intersection'](_0xc5738e['model'],qs[_0x4112('0x3f')](_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x3f')]));_0x1d0345[_0x4112('0x3e')]=_0x1d0345[_0x4112('0x3e')]['length']?_0x1d0345[_0x4112('0x3e')]:_0xc5738e[_0x4112('0x3b')];if(!_0x3ffeb0[_0x4112('0x3c')]['hasOwnProperty'](_0x4112('0x40'))){_0x1d0345[_0x4112('0x2a')]=qs[_0x4112('0x2a')](_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x2a')]);_0x1d0345[_0x4112('0x29')]=qs[_0x4112('0x29')](_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x29')]);}_0x1d0345[_0x4112('0x41')]=qs['sort'](_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x42')]);_0x1d0345['where']=qs['filters'](_[_0x4112('0x43')](_0x3ffeb0['query'],_0xc5738e[_0x4112('0x3d')]),_0x2dece6);if(_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x44')]){_0x1d0345[_0x4112('0x45')]=_[_0x4112('0x46')](_0x1d0345[_0x4112('0x45')],{'$or':_['map'](_0x2dece6,function(_0xf28cfd){if(_0xf28cfd[_0x4112('0x47')]!=='VIRTUAL'){var _0x55846c={};_0x55846c[_0xf28cfd[_0x4112('0x33')]]={'$like':'%'+_0x3ffeb0['query'][_0x4112('0x44')]+'%'};return _0x55846c;}})});}_0x1d0345=_['merge']({},_0x1d0345,_0x3ffeb0[_0x4112('0x48')]);var _0xd8a1e={'where':_0x1d0345[_0x4112('0x45')]};return db[_0x4112('0x37')]['count'](_0xd8a1e)['then'](function(_0x2b79aa){_0x151b12[_0x4112('0x49')]=_0x2b79aa;if(_0x3ffeb0[_0x4112('0x3c')][_0x4112('0x4a')]){_0x1d0345[_0x4112('0x4b')]=[{'all':!![]}];}return db[_0x4112('0x37')][_0x4112('0x4c')](_0x1d0345);})[_0x4112('0x2f')](function(_0x53809c){_0x151b12[_0x4112('0x4d')]=_0x53809c;return _0x151b12;})[_0x4112('0x2f')](respondWithFilteredResult(_0x4e5159,_0x1d0345))['catch'](handleError(_0x4e5159,null));};exports[_0x4112('0x4e')]=function(_0x39643f,_0x31b112){var _0x483dd8={'raw':![],'where':{'id':_0x39643f[_0x4112('0x4f')]['id']}},_0xd58e30={};_0xd58e30['model']=_['keys'](db['SalesforceAccount']['rawAttributes']);_0xd58e30[_0x4112('0x3c')]=_[_0x4112('0x50')](_0x39643f[_0x4112('0x3c')]);_0xd58e30['filters']=_[_0x4112('0x51')](_0xd58e30[_0x4112('0x3b')],_0xd58e30['query']);_0x483dd8['attributes']=_[_0x4112('0x51')](_0xd58e30[_0x4112('0x3b')],qs[_0x4112('0x3f')](_0x39643f[_0x4112('0x3c')][_0x4112('0x3f')]));_0x483dd8['attributes']=_0x483dd8[_0x4112('0x3e')][_0x4112('0x52')]?_0x483dd8['attributes']:_0xd58e30[_0x4112('0x3b')];if(_0x39643f[_0x4112('0x3c')][_0x4112('0x4a')]){_0x483dd8[_0x4112('0x4b')]=[{'all':!![]}];}_0x483dd8=_[_0x4112('0x46')]({},_0x483dd8,_0x39643f['options']);return db[_0x4112('0x37')][_0x4112('0x53')](_0x483dd8)[_0x4112('0x2f')](handleEntityNotFound(_0x31b112,null))['then'](respondWithResult(_0x31b112,null))['catch'](handleError(_0x31b112,null));};exports[_0x4112('0x54')]=function(_0x16a8de,_0x484610){return db[_0x4112('0x37')][_0x4112('0x54')](_0x16a8de[_0x4112('0x55')],{})[_0x4112('0x2f')](respondWithResult(_0x484610,0xc9))[_0x4112('0x25')](handleError(_0x484610,null));};exports['update']=function(_0x4283d5,_0x15b2eb){if(_0x4283d5[_0x4112('0x55')]['id']){delete _0x4283d5['body']['id'];}return db['SalesforceAccount'][_0x4112('0x53')]({'where':{'id':_0x4283d5['params']['id']}})[_0x4112('0x2f')](handleEntityNotFound(_0x15b2eb,null))[_0x4112('0x2f')](saveUpdates(_0x4283d5[_0x4112('0x55')],null))[_0x4112('0x2f')](respondWithResult(_0x15b2eb,null))[_0x4112('0x25')](handleError(_0x15b2eb,null));};exports['destroy']=function(_0x2548b2,_0x34847d){return db[_0x4112('0x37')][_0x4112('0x53')]({'where':{'id':_0x2548b2[_0x4112('0x4f')]['id']}})[_0x4112('0x2f')](handleEntityNotFound(_0x34847d,null))[_0x4112('0x2f')](removeEntity(_0x34847d,null))[_0x4112('0x25')](handleError(_0x34847d,null));};exports[_0x4112('0x56')]=function(_0x2670ba,_0x3c31e5,_0x26990d){var _0x22c41e={};var _0x4eb759={};var _0x41dfcc;var _0x53449e;return db['SalesforceAccount'][_0x4112('0x57')]({'where':{'id':_0x2670ba['params']['id']}})[_0x4112('0x2f')](handleEntityNotFound(_0x3c31e5,null))[_0x4112('0x2f')](function(_0x5bdcb9){if(_0x5bdcb9){_0x41dfcc=_0x5bdcb9;_0x4eb759[_0x4112('0x3b')]=_['keys'](db[_0x4112('0x58')][_0x4112('0x38')]);_0x4eb759[_0x4112('0x3c')]=_[_0x4112('0x50')](_0x2670ba[_0x4112('0x3c')]);_0x4eb759[_0x4112('0x3d')]=_[_0x4112('0x51')](_0x4eb759[_0x4112('0x3b')],_0x4eb759[_0x4112('0x3c')]);_0x22c41e[_0x4112('0x3e')]=_['intersection'](_0x4eb759[_0x4112('0x3b')],qs[_0x4112('0x3f')](_0x2670ba[_0x4112('0x3c')]['fields']));_0x22c41e[_0x4112('0x3e')]=_0x22c41e[_0x4112('0x3e')]['length']?_0x22c41e[_0x4112('0x3e')]:_0x4eb759['model'];_0x22c41e[_0x4112('0x41')]=qs[_0x4112('0x42')](_0x2670ba['query'][_0x4112('0x42')]);_0x22c41e[_0x4112('0x45')]=qs['filters'](_[_0x4112('0x43')](_0x2670ba[_0x4112('0x3c')],_0x4eb759['filters']));if(_0x2670ba['query'][_0x4112('0x44')]){_0x22c41e['where']=_[_0x4112('0x46')](_0x22c41e['where'],{'$or':_[_0x4112('0x36')](_0x22c41e[_0x4112('0x3e')],function(_0xab978f){var _0x49a76c={};_0x49a76c[_0xab978f]={'$like':'%'+_0x2670ba[_0x4112('0x3c')][_0x4112('0x44')]+'%'};return _0x49a76c;})});}_0x22c41e=_['merge']({},_0x22c41e,_0x2670ba[_0x4112('0x48')]);return _0x41dfcc[_0x4112('0x56')](_0x22c41e);}})[_0x4112('0x2f')](function(_0x5dd228){if(_0x5dd228){_0x53449e=_0x5dd228['length'];if(!_0x2670ba[_0x4112('0x3c')][_0x4112('0x59')](_0x4112('0x40'))){_0x22c41e['limit']=qs[_0x4112('0x2a')](_0x2670ba['query'][_0x4112('0x2a')]);_0x22c41e[_0x4112('0x29')]=qs[_0x4112('0x29')](_0x2670ba[_0x4112('0x3c')][_0x4112('0x29')]);}return _0x41dfcc[_0x4112('0x56')](_0x22c41e);}})[_0x4112('0x2f')](function(_0x38eba3){if(_0x38eba3){return _0x38eba3?{'count':_0x53449e,'rows':_0x38eba3}:null;}})[_0x4112('0x2f')](respondWithResult(_0x3c31e5,null))[_0x4112('0x25')](handleError(_0x3c31e5,null));};exports[_0x4112('0x5a')]=function(_0x3d0080,_0x4d79bb,_0x41b41e){if(_0x3d0080[_0x4112('0x55')]['id']){delete _0x3d0080[_0x4112('0x55')]['id'];}return db[_0x4112('0x37')][_0x4112('0x57')]({'where':{'id':_0x3d0080[_0x4112('0x4f')]['id']}})[_0x4112('0x2f')](handleEntityNotFound(_0x4d79bb,null))[_0x4112('0x2f')](function(_0x4ccb9f){if(_0x4ccb9f){_0x3d0080[_0x4112('0x55')][_0x4112('0x5b')]=_0x4ccb9f['id'];_0x3d0080[_0x4112('0x55')][_0x4112('0x5c')]=integrations[_0x4112('0x5d')](_0x3d0080['body'][_0x4112('0x5e')],_0x3d0080[_0x4112('0x55')]['type']);_0x3d0080['body'][_0x4112('0x5f')]=integrations[_0x4112('0x60')](_0x3d0080[_0x4112('0x55')]['channel'],_0x3d0080[_0x4112('0x55')][_0x4112('0x47')]);return db[_0x4112('0x58')]['create'](_0x3d0080[_0x4112('0x55')],{'include':[{'model':db[_0x4112('0x61')],'as':_0x4112('0x5c')},{'model':db[_0x4112('0x61')],'as':_0x4112('0x5f')}]});}return null;})[_0x4112('0x2f')](respondWithResult(_0x4d79bb,null))[_0x4112('0x25')](handleError(_0x4d79bb,null));};exports['getFields']=function(_0x33d5e9,_0x38b7ff,_0x36fa55){var _0x112919;var _0x1e1d5d='';var _0x3a969a='Task';return db['SalesforceAccount'][_0x4112('0x57')]({'where':{'id':_0x33d5e9['params']['id']},'attributes':['id',_0x4112('0x62'),_0x4112('0x63'),_0x4112('0x64'),_0x4112('0x65'),_0x4112('0x66'),_0x4112('0x67')]})['then'](handleEntityNotFound(_0x38b7ff,null))['then'](function(_0x192e91){if(_0x192e91){_0x1e1d5d=_0x192e91[_0x4112('0x62')];var _0x59ed2c=_0x1e1d5d[_0x4112('0x68')](-0x1);if(_0x59ed2c==='/'){_0x1e1d5d=_0x1e1d5d[_0x4112('0x69')](0x0,_0x1e1d5d[_0x4112('0x6a')](_0x59ed2c));}_0x112919=new jsforce[(_0x4112('0x6b'))]({'oauth2':{'loginUrl':_0x1e1d5d,'clientId':_0x192e91[_0x4112('0x63')],'clientSecret':_0x192e91['clientSecret']}});return _0x112919[_0x4112('0x6c')](_0x192e91[_0x4112('0x65')],_0x192e91['password'][_0x4112('0x6d')](_0x192e91[_0x4112('0x67')]));}})['then'](function(_0x211520){if(_0x211520){if(!_[_0x4112('0x6e')](_0x33d5e9['query'][_0x4112('0x6f')])){_0x3a969a=_0x33d5e9[_0x4112('0x3c')]['ticketType'];}return _0x112919[_0x4112('0x70')](_0x3a969a)[_0x4112('0x71')]();}})[_0x4112('0x2f')](function(_0x418d48){var _0x3c4ca8=[_0x4112('0x72'),_0x4112('0x73'),_0x4112('0x74'),_0x4112('0x75'),'IsArchived','Priority','Status',_0x4112('0x76')];if(!_['isNil'](_0x33d5e9[_0x4112('0x3c')][_0x4112('0x6f')])&&_0x33d5e9['query'][_0x4112('0x6f')]==='Case'){_0x3c4ca8=[_0x4112('0x76'),_0x4112('0x77'),'Reason','Status',_0x4112('0x78'),'IsEscalated','SuppliedName',_0x4112('0x79')];}if(_0x418d48){_['remove'](_0x418d48['fields'],function(_0x16dced){return _0x16dced[_0x4112('0x7a')]===![]&&!_0x3c4ca8[_0x4112('0x7b')](_0x16dced[_0x4112('0x33')]);});return{'count':_0x418d48[_0x4112('0x3f')][_0x4112('0x52')],'rows':_[_0x4112('0x36')](_0x418d48[_0x4112('0x3f')],function(_0xda9365){return{'id':_0xda9365[_0x4112('0x33')],'name':_0xda9365[_0x4112('0x7c')],'custom':_0xda9365[_0x4112('0x7a')],'options':_0xda9365[_0x4112('0x7d')][_0x4112('0x52')]>0x0?_[_0x4112('0x36')](_0xda9365[_0x4112('0x7d')],function(_0x147c70){return{'name':_0x147c70[_0x4112('0x7c')],'value':_0x147c70['value']};}):_0xda9365[_0x4112('0x47')]==_0x4112('0x7e')?[{'name':_0x4112('0x7f'),'value':_0x4112('0x80')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x38b7ff,null))['catch'](function(_0x49fc9b){var _0x10c293=_0x33d5e9[_0x4112('0x3c')][_0x4112('0x81')]?0x1f4:_0x49fc9b[_0x4112('0x82')]||0x1f4;logger[_0x4112('0x21')](_0x4112('0x83'),_0x4112('0x84'),_0x10c293,JSON[_0x4112('0x20')](_0x49fc9b));delete _0x49fc9b[_0x4112('0x33')];if(_0x10c293===0x191){_0x10c293=0x190;}_0x38b7ff[_0x4112('0x31')](_0x10c293)[_0x4112('0x34')](_0x33d5e9[_0x4112('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x49fc9b['statusCode']}:_0x49fc9b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8ad0707..0901273 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 _0xc9a8=['SalesforceAccount','int_salesforce_accounts','lodash','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xc9a8,0x65));var _0x8c9a=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xc9a8[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x8c9a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c9a('0x1'));var moment=require('moment');var BPromise=require(_0x8c9a('0x2'));var rp=require(_0x8c9a('0x3'));var fs=require('fs');var path=require(_0x8c9a('0x4'));var rimraf=require('rimraf');var config=require(_0x8c9a('0x5'));var attributes=require(_0x8c9a('0x6'));var integrations=require(_0x8c9a('0x7'));module[_0x8c9a('0x8')]=function(_0xa2ccfc,_0x435346){return _0xa2ccfc['define'](_0x8c9a('0x9'),attributes,{'tableName':_0x8c9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa82b=['./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x27cb19,_0x4408f7){var _0x34e83a=function(_0x232757){while(--_0x232757){_0x27cb19['push'](_0x27cb19['shift']());}};_0x34e83a(++_0x4408f7);}(_0xa82b,0x86));var _0xba82=function(_0x414658,_0x32591f){_0x414658=_0x414658-0x0;var _0x3f33b8=_0xa82b[_0x414658];return _0x3f33b8;};'use strict';var _=require(_0xba82('0x0'));var util=require(_0xba82('0x1'));var logger=require('../../config/logger')(_0xba82('0x2'));var moment=require(_0xba82('0x3'));var BPromise=require(_0xba82('0x4'));var rp=require(_0xba82('0x5'));var fs=require('fs');var path=require(_0xba82('0x6'));var rimraf=require(_0xba82('0x7'));var config=require(_0xba82('0x8'));var attributes=require(_0xba82('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xba82('0xa')]=function(_0x593e98,_0x5d6762){return _0x593e98['define'](_0xba82('0xb'),attributes,{'tableName':_0xba82('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 a11848e..2d0217e 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 _0xc6d8=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc6d8,0xd7));var _0x8c6d=function(_0xcc2c66,_0x27cf7b){_0xcc2c66=_0xcc2c66-0x0;var _0x2197b2=_0xc6d8[_0xcc2c66];return _0x2197b2;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetSalesforceAccount']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['SalesforceAccount'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetSalesforceAccount',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});};exports[_0x8c6d('0x1c')]=function(_0x15a508){var _0x4e5203=this;return new Promise(function(_0x3af625,_0x332f6a){return db[_0x8c6d('0x1d')][_0x8c6d('0x1e')]({'raw':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')]['where']||null:null,'attributes':_0x15a508[_0x8c6d('0x14')]?_0x15a508['options'][_0x8c6d('0x17')]||null:null,'include':_0x15a508[_0x8c6d('0x14')]?_0x15a508[_0x8c6d('0x14')][_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a508[_0x8c6d('0x14')]['include'],function(_0x5ae56b){return{'model':db[_0x5ae56b[_0x8c6d('0x16')]],'as':_0x5ae56b['as'],'attributes':_0x5ae56b[_0x8c6d('0x17')],'include':_0x5ae56b[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x5ae56b['include'],function(_0x2818fa){return{'model':db[_0x2818fa[_0x8c6d('0x16')]],'as':_0x2818fa['as'],'attributes':_0x2818fa[_0x8c6d('0x17')],'include':_0x2818fa[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x2818fa[_0x8c6d('0x19')],function(_0x4a0fb3){return{'model':db[_0x4a0fb3[_0x8c6d('0x16')]],'as':_0x4a0fb3['as'],'attributes':_0x4a0fb3[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x2ef932){logger[_0x8c6d('0xa')](_0x8c6d('0x1c'),_0x15a508);logger[_0x8c6d('0xd')](_0x8c6d('0x1c'),_0x15a508,JSON[_0x8c6d('0xf')](_0x2ef932));_0x3af625(_0x2ef932);})[_0x8c6d('0x12')](function(_0x16b2cd){logger[_0x8c6d('0x10')]('ShowSalesforceAccount',_0x16b2cd[_0x8c6d('0x11')],_0x15a508);_0x332f6a(_0x4e5203[_0x8c6d('0x10')](0x1f4,_0x16b2cd[_0x8c6d('0x11')]));});});}; \ No newline at end of file +var _0xf4eb=['SalesforceAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowSalesforceAccount','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount'];(function(_0x4224aa,_0x36e0cd){var _0xe786ad=function(_0x47a40d){while(--_0x47a40d){_0x4224aa['push'](_0x4224aa['shift']());}};_0xe786ad(++_0x36e0cd);}(_0xf4eb,0xec));var _0xbf4e=function(_0x40536c,_0x212dca){_0x40536c=_0x40536c-0x0;var _0x4ec077=_0xf4eb[_0x40536c];return _0x4ec077;};'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')]('SalesforceAccount,\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')]('SalesforceAccount,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')]({'raw':_0x577c27[_0xbf4e('0x16')]?_0x577c27['options']['raw']===undefined?!![]:![]:!![],'where':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x18')]||null:null,'limit':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x19')]||null:null,'include':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')]['include']?_[_0xbf4e('0x1a')](_0x577c27[_0xbf4e('0x16')]['include'],function(_0x31e3f5){return{'model':db[_0x31e3f5[_0xbf4e('0x1b')]],'as':_0x31e3f5['as'],'attributes':_0x31e3f5[_0xbf4e('0x18')],'include':_0x31e3f5[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x31e3f5['include'],function(_0x90635e){return{'model':db[_0x90635e[_0xbf4e('0x1b')]],'as':_0x90635e['as'],'attributes':_0x90635e[_0xbf4e('0x18')],'include':_0x90635e['include']?_[_0xbf4e('0x1a')](_0x90635e['include'],function(_0x5bcf71){return{'model':db[_0x5bcf71[_0xbf4e('0x1b')]],'as':_0x5bcf71['as'],'attributes':_0x5bcf71['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf4e('0x9')](function(_0x315df3){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger['debug'](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x315df3));_0x566ec3(_0x315df3);})[_0xbf4e('0x12')](function(_0x4cd4a1){logger[_0xbf4e('0xf')]('GetSalesforceAccount',_0x4cd4a1[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x4cd4a1[_0xbf4e('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0x1d12e2){var _0x362716=this;return new Promise(function(_0x2f3cf8,_0xc7ca87){return db[_0xbf4e('0x14')][_0xbf4e('0x1d')]({'raw':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')]['attributes']||null:null,'include':_0x1d12e2[_0xbf4e('0x16')]?_0x1d12e2['options'][_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x1d12e2[_0xbf4e('0x16')]['include'],function(_0x2716b7){return{'model':db[_0x2716b7[_0xbf4e('0x1b')]],'as':_0x2716b7['as'],'attributes':_0x2716b7[_0xbf4e('0x18')],'include':_0x2716b7[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x2716b7[_0xbf4e('0x1c')],function(_0x5b8440){return{'model':db[_0x5b8440[_0xbf4e('0x1b')]],'as':_0x5b8440['as'],'attributes':_0x5b8440[_0xbf4e('0x18')],'include':_0x5b8440[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x5b8440[_0xbf4e('0x1c')],function(_0x5b7ea1){return{'model':db[_0x5b7ea1['model']],'as':_0x5b7ea1['as'],'attributes':_0x5b7ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x429c07){logger[_0xbf4e('0xa')](_0xbf4e('0x1f'),_0x1d12e2);logger[_0xbf4e('0xd')](_0xbf4e('0x1f'),_0x1d12e2,JSON[_0xbf4e('0xe')](_0x429c07));_0x2f3cf8(_0x429c07);})[_0xbf4e('0x12')](function(_0x467b74){logger[_0xbf4e('0xf')]('ShowSalesforceAccount',_0x467b74['message'],_0x1d12e2);_0xc7ca87(_0x362716[_0xbf4e('0xf')](0x1f4,_0x467b74[_0xbf4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1d33ec6..e734095 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 _0x3ca1=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x1659b8,_0x2babe1){var _0x2f716a=function(_0x5efb61){while(--_0x5efb61){_0x1659b8['push'](_0x1659b8['shift']());}};_0x2f716a(++_0x2babe1);}(_0x3ca1,0x11a));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x13ca('0x0'));var util=require(_0x13ca('0x1'));var path=require('path');var timeout=require(_0x13ca('0x2'));var express=require(_0x13ca('0x3'));var router=express['Router']();var auth=require(_0x13ca('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x13ca('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0x13ca('0x6')]('/',auth['isAuthenticated'](),controller[_0x13ca('0x7')]);router[_0x13ca('0x6')](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller['show']);router[_0x13ca('0x6')](_0x13ca('0xa'),auth['isAuthenticated'](),controller[_0x13ca('0xb')]);router[_0x13ca('0x6')](_0x13ca('0xc'),auth[_0x13ca('0x9')](),controller['getSubjects']);router[_0x13ca('0x6')](_0x13ca('0xd'),auth[_0x13ca('0x9')](),controller[_0x13ca('0xe')]);router[_0x13ca('0xf')]('/',auth[_0x13ca('0x9')](),controller[_0x13ca('0x10')]);router['put'](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller[_0x13ca('0x11')]);router['delete'](_0x13ca('0x8'),auth[_0x13ca('0x9')](),controller[_0x13ca('0x12')]);module[_0x13ca('0x13')]=router; \ No newline at end of file +var _0xcc0b=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','delete','destroy','exports','util'];(function(_0x52373e,_0x3fe32b){var _0x13ca4e=function(_0x5235d5){while(--_0x5235d5){_0x52373e['push'](_0x52373e['shift']());}};_0x13ca4e(++_0x3fe32b);}(_0xcc0b,0xa0));var _0xbcc0=function(_0x460013,_0x2ebc73){_0x460013=_0x460013-0x0;var _0x55924f=_0xcc0b[_0x460013];return _0x55924f;};'use strict';var multer=require('multer');var util=require(_0xbcc0('0x0'));var path=require(_0xbcc0('0x1'));var timeout=require(_0xbcc0('0x2'));var express=require('express');var router=express[_0xbcc0('0x3')]();var auth=require(_0xbcc0('0x4'));var interaction=require(_0xbcc0('0x5'));var config=require(_0xbcc0('0x6'));var controller=require(_0xbcc0('0x7'));router[_0xbcc0('0x8')]('/',auth[_0xbcc0('0x9')](),controller[_0xbcc0('0xa')]);router[_0xbcc0('0x8')](_0xbcc0('0xb'),auth[_0xbcc0('0x9')](),controller[_0xbcc0('0xc')]);router[_0xbcc0('0x8')](_0xbcc0('0xd'),auth[_0xbcc0('0x9')](),controller['getFields']);router[_0xbcc0('0x8')](_0xbcc0('0xe'),auth[_0xbcc0('0x9')](),controller[_0xbcc0('0xf')]);router['get'](_0xbcc0('0x10'),auth[_0xbcc0('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xbcc0('0x9')](),controller[_0xbcc0('0x11')]);router[_0xbcc0('0x12')](_0xbcc0('0xb'),auth[_0xbcc0('0x9')](),controller[_0xbcc0('0x13')]);router[_0xbcc0('0x14')](_0xbcc0('0xb'),auth[_0xbcc0('0x9')](),controller[_0xbcc0('0x15')]);module[_0xbcc0('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 12b15dd..4f71905 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 _0xdbfa=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','nothing'];(function(_0xe8e9bb,_0x12a4eb){var _0xcfc757=function(_0x156f87){while(--_0x156f87){_0xe8e9bb['push'](_0xe8e9bb['shift']());}};_0xcfc757(++_0x12a4eb);}(_0xdbfa,0x1f4));var _0xadbf=function(_0x2c080e,_0x249a91){_0x2c080e=_0x2c080e-0x0;var _0x59e08c=_0xdbfa[_0x2c080e];return _0x59e08c;};'use strict';var Sequelize=require(_0xadbf('0x0'));module[_0xadbf('0x1')]={'name':{'type':Sequelize[_0xadbf('0x2')]},'description':{'type':Sequelize[_0xadbf('0x2')]},'ticketType':{'type':Sequelize[_0xadbf('0x3')](_0xadbf('0x4'),_0xadbf('0x5')),'defaultValue':_0xadbf('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xadbf('0x6'),_0xadbf('0x7'),_0xadbf('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xadbf('0x3')](_0xadbf('0x9'),'contact',_0xadbf('0x8')),'defaultValue':_0xadbf('0x8')}}; \ No newline at end of file +var _0x4576=['contact_lead','nothing','exports','STRING','ENUM','Task','Case','contact','lead'];(function(_0x1df51b,_0x10b7cd){var _0x377d89=function(_0x60c6bb){while(--_0x60c6bb){_0x1df51b['push'](_0x1df51b['shift']());}};_0x377d89(++_0x10b7cd);}(_0x4576,0x12b));var _0x6457=function(_0x58b8ff,_0x5b1e14){_0x58b8ff=_0x58b8ff-0x0;var _0x4f5495=_0x4576[_0x58b8ff];return _0x4f5495;};'use strict';var Sequelize=require('sequelize');module[_0x6457('0x0')]={'name':{'type':Sequelize[_0x6457('0x1')]},'description':{'type':Sequelize[_0x6457('0x1')]},'ticketType':{'type':Sequelize[_0x6457('0x2')](_0x6457('0x3'),_0x6457('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x6457('0x2')]('contact_lead',_0x6457('0x5'),_0x6457('0x6')),'defaultValue':_0x6457('0x7')},'moduleCreate':{'type':Sequelize[_0x6457('0x2')](_0x6457('0x8'),_0x6457('0x5'),_0x6457('0x6')),'defaultValue':_0x6457('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e565dfb..b4c6df1 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 _0x810c=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','options','SalesforceConfiguration','find','create','body','params','getFields','findOne','getSubjects','getDescriptions','SalesforceField','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type'];(function(_0x207955,_0x5927fd){var _0x2f5f8c=function(_0x1f3365){while(--_0x1f3365){_0x207955['push'](_0x207955['shift']());}};_0x2f5f8c(++_0x5927fd);}(_0x810c,0x1a5));var _0xc810=function(_0x3f8fa5,_0xa2656){_0x3f8fa5=_0x3f8fa5-0x0;var _0x42542e=_0x810c[_0x3f8fa5];return _0x42542e;};'use strict';var pdf=require(_0xc810('0x0'));var emlformat=require(_0xc810('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc810('0x2'));var jsonpatch=require(_0xc810('0x3'));var rp=require('request-promise');var moment=require(_0xc810('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc810('0x5'));var util=require(_0xc810('0x6'));var path=require(_0xc810('0x7'));var sox=require(_0xc810('0x8'));var csv=require(_0xc810('0x9'));var ejs=require(_0xc810('0xa'));var fs=require('fs');var _=require(_0xc810('0xb'));var squel=require('squel');var crypto=require(_0xc810('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc810('0xd'));var toCsv=require(_0xc810('0x9'));var querystring=require(_0xc810('0xe'));var Papa=require(_0xc810('0xf'));var Redis=require(_0xc810('0x10'));var authService=require(_0xc810('0x11'));var qs=require(_0xc810('0x12'));var as=require(_0xc810('0x13'));var hardwareService=require(_0xc810('0x14'));var logger=require('../../config/logger')(_0xc810('0x15'));var utils=require(_0xc810('0x16'));var config=require(_0xc810('0x17'));var db=require(_0xc810('0x18'))['db'];var jayson=require(_0xc810('0x19'));var client=jayson[_0xc810('0x1a')][_0xc810('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x26a44f,_0xe54ac9,_0x588872){if(_0x588872){var _0x1df482=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1df482[_0xc810('0x1c')](_0xe54ac9)){return _0x26a44f;}else{throw new db[(_0xc810('0x1d'))][(_0xc810('0x1e'))](_0xc810('0x1f'));}}else{return _0x26a44f;}}function respondWithRpcPromise(_0x371e50,_0x5451c6,_0x18671d,_0x4a5b37){return new BPromise(function(_0x303e7f,_0xd5eac3){var _0x2ae6a=_0x4a5b37||client;return _0x2ae6a[_0xc810('0x20')](_0x371e50,_0x18671d)['then'](function(_0x387b4c){logger[_0xc810('0x21')](_0xc810('0x22'),_0x5451c6,_0xc810('0x23'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5451c6,'request\x20sent',JSON[_0xc810('0x24')](_0x387b4c));if(_0x387b4c[_0xc810('0x25')]){if(_0x387b4c[_0xc810('0x25')][_0xc810('0x26')]===0x1f4){logger[_0xc810('0x25')](_0xc810('0x22'),_0x5451c6,_0x387b4c['error'][_0xc810('0x27')]);return _0xd5eac3(_0x387b4c['error'][_0xc810('0x27')]);}logger[_0xc810('0x25')](_0xc810('0x22'),_0x5451c6,_0x387b4c[_0xc810('0x25')][_0xc810('0x27')]);return _0x303e7f(_0x387b4c[_0xc810('0x25')][_0xc810('0x27')]);}else{logger[_0xc810('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5451c6,_0xc810('0x23'));_0x303e7f(_0x387b4c[_0xc810('0x28')][_0xc810('0x27')]);}})[_0xc810('0x29')](function(_0x225c56){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5451c6,_0x225c56);_0xd5eac3(_0x225c56);});});}function respondWithStatusCode(_0x21d0c5,_0x1327da){_0x1327da=_0x1327da||0xcc;return function(_0x2fa362){if(_0x2fa362){return _0x21d0c5[_0xc810('0x2a')](_0x1327da);}return _0x21d0c5[_0xc810('0x2b')](_0x1327da)['end']();};}function respondWithResult(_0x4dc329,_0x2000ba){_0x2000ba=_0x2000ba||0xc8;return function(_0x4e3658){if(_0x4e3658){return _0x4dc329[_0xc810('0x2b')](_0x2000ba)['json'](_0x4e3658);}};}function respondWithFilteredResult(_0x26fb11,_0x362f55){return function(_0x31341){if(_0x31341){var _0x1cb53a=_0x31341[_0xc810('0x2c')],_0x273576=_0x362f55[_0xc810('0x2d')],_0x2d3b06=_0x362f55[_0xc810('0x2d')]+_0x362f55[_0xc810('0x2e')],_0x1a427e;if(_0x2d3b06>=_0x1cb53a){_0x2d3b06=_0x1cb53a;_0x1a427e=0xc8;}else{_0x1a427e=0xce;}_0x26fb11[_0xc810('0x2b')](_0x1a427e);return _0x26fb11[_0xc810('0x2f')](_0xc810('0x30'),_0x273576+'-'+_0x2d3b06+'/'+_0x1cb53a)[_0xc810('0x31')](_0x31341);}return null;};}function patchUpdates(_0x2bab05){return function(_0x1d3dd4){try{jsonpatch[_0xc810('0x32')](_0x1d3dd4,_0x2bab05,!![]);}catch(_0x51710b){return BPromise[_0xc810('0x33')](_0x51710b);}return _0x1d3dd4[_0xc810('0x34')]();};}function saveUpdates(_0x27d7a7,_0x59d7d6){return function(_0x4d7025){if(_0x4d7025){return _0x4d7025[_0xc810('0x35')](_0x27d7a7)[_0xc810('0x36')](function(_0x461dc5){return _0x461dc5;});}return null;};}function removeEntity(_0xd71712,_0x257191){return function(_0x3a21fc){if(_0x3a21fc){return _0x3a21fc[_0xc810('0x37')]()['then'](function(){_0xd71712[_0xc810('0x2b')](0xcc)[_0xc810('0x38')]();});}};}function handleEntityNotFound(_0x360e0f,_0x27d030){return function(_0x35965a){if(!_0x35965a){_0x360e0f[_0xc810('0x2a')](0x194);}return _0x35965a;};}function handleError(_0x2a8c6d,_0xa6611d){_0xa6611d=_0xa6611d||0x1f4;return function(_0x31f0b8){logger['error'](_0x31f0b8[_0xc810('0x39')]);if(_0x31f0b8[_0xc810('0x3a')]){delete _0x31f0b8[_0xc810('0x3a')];}_0x2a8c6d[_0xc810('0x2b')](_0xa6611d)[_0xc810('0x3b')](_0x31f0b8);};}exports[_0xc810('0x3c')]=function(_0x1ca324,_0x409ffc){var _0x55cd85={},_0x42c000={},_0x2a79e7={'count':0x0,'rows':[]};var _0x4c340d=_[_0xc810('0x3d')](db['SalesforceConfiguration'][_0xc810('0x3e')],function(_0x1fd7e6){return{'name':_0x1fd7e6['fieldName'],'type':_0x1fd7e6[_0xc810('0x3f')][_0xc810('0x40')]};});_0x42c000[_0xc810('0x41')]=_['map'](_0x4c340d,_0xc810('0x3a'));_0x42c000[_0xc810('0x42')]=_[_0xc810('0x43')](_0x1ca324[_0xc810('0x42')]);_0x42c000[_0xc810('0x44')]=_[_0xc810('0x45')](_0x42c000[_0xc810('0x41')],_0x42c000[_0xc810('0x42')]);_0x55cd85[_0xc810('0x46')]=_[_0xc810('0x45')](_0x42c000[_0xc810('0x41')],qs[_0xc810('0x47')](_0x1ca324[_0xc810('0x42')][_0xc810('0x47')]));_0x55cd85[_0xc810('0x46')]=_0x55cd85[_0xc810('0x46')][_0xc810('0x48')]?_0x55cd85[_0xc810('0x46')]:_0x42c000['model'];if(!_0x1ca324['query'][_0xc810('0x49')](_0xc810('0x4a'))){_0x55cd85['limit']=qs[_0xc810('0x2e')](_0x1ca324[_0xc810('0x42')]['limit']);_0x55cd85[_0xc810('0x2d')]=qs['offset'](_0x1ca324['query'][_0xc810('0x2d')]);}_0x55cd85[_0xc810('0x4b')]=qs[_0xc810('0x4c')](_0x1ca324[_0xc810('0x42')][_0xc810('0x4c')]);_0x55cd85['where']=qs['filters'](_[_0xc810('0x4d')](_0x1ca324[_0xc810('0x42')],_0x42c000[_0xc810('0x44')]),_0x4c340d);if(_0x1ca324[_0xc810('0x42')][_0xc810('0x4e')]){_0x55cd85[_0xc810('0x4f')]=_[_0xc810('0x50')](_0x55cd85[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x4c340d,function(_0x121e6f){if(_0x121e6f[_0xc810('0x3f')]!==_0xc810('0x51')){var _0x543075={};_0x543075[_0x121e6f[_0xc810('0x3a')]]={'$like':'%'+_0x1ca324['query']['filter']+'%'};return _0x543075;}})});}_0x55cd85=_[_0xc810('0x50')]({},_0x55cd85,_0x1ca324['options']);var _0x4e22f6={'where':_0x55cd85[_0xc810('0x4f')]};return db['SalesforceConfiguration']['count'](_0x4e22f6)['then'](function(_0x5020c8){_0x2a79e7[_0xc810('0x2c')]=_0x5020c8;if(_0x1ca324[_0xc810('0x42')]['includeAll']){_0x55cd85[_0xc810('0x52')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc810('0x53')](_0x55cd85);})[_0xc810('0x36')](function(_0x36c92e){_0x2a79e7[_0xc810('0x54')]=_0x36c92e;return _0x2a79e7;})[_0xc810('0x36')](respondWithFilteredResult(_0x409ffc,_0x55cd85))[_0xc810('0x29')](handleError(_0x409ffc,null));};exports[_0xc810('0x55')]=function(_0x54c8f0,_0x158fd8){var _0x4bbc05={'raw':![],'where':{'id':_0x54c8f0['params']['id']}},_0x15f52e={};_0x15f52e[_0xc810('0x41')]=_[_0xc810('0x43')](db['SalesforceConfiguration'][_0xc810('0x3e')]);_0x15f52e[_0xc810('0x42')]=_['keys'](_0x54c8f0[_0xc810('0x42')]);_0x15f52e[_0xc810('0x44')]=_[_0xc810('0x45')](_0x15f52e[_0xc810('0x41')],_0x15f52e[_0xc810('0x42')]);_0x4bbc05[_0xc810('0x46')]=_[_0xc810('0x45')](_0x15f52e['model'],qs[_0xc810('0x47')](_0x54c8f0['query'][_0xc810('0x47')]));_0x4bbc05['attributes']=_0x4bbc05[_0xc810('0x46')][_0xc810('0x48')]?_0x4bbc05[_0xc810('0x46')]:_0x15f52e[_0xc810('0x41')];if(_0x54c8f0['query']['includeAll']){_0x4bbc05['include']=[{'all':!![]}];}_0x4bbc05=_[_0xc810('0x50')]({},_0x4bbc05,_0x54c8f0[_0xc810('0x56')]);return db[_0xc810('0x57')][_0xc810('0x58')](_0x4bbc05)[_0xc810('0x36')](handleEntityNotFound(_0x158fd8,null))[_0xc810('0x36')](respondWithResult(_0x158fd8,null))['catch'](handleError(_0x158fd8,null));};exports[_0xc810('0x59')]=function(_0x3cb4b4,_0x478122){return db[_0xc810('0x57')][_0xc810('0x59')](_0x3cb4b4[_0xc810('0x5a')],{})[_0xc810('0x36')](respondWithResult(_0x478122,0xc9))[_0xc810('0x29')](handleError(_0x478122,null));};exports[_0xc810('0x35')]=function(_0x2dd9d3,_0x5aebc2){if(_0x2dd9d3[_0xc810('0x5a')]['id']){delete _0x2dd9d3[_0xc810('0x5a')]['id'];}return db[_0xc810('0x57')][_0xc810('0x58')]({'where':{'id':_0x2dd9d3[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x5aebc2,null))[_0xc810('0x36')](saveUpdates(_0x2dd9d3['body'],null))[_0xc810('0x36')](respondWithResult(_0x5aebc2,null))[_0xc810('0x29')](handleError(_0x5aebc2,null));};exports[_0xc810('0x37')]=function(_0x51ecc1,_0x386360){return db[_0xc810('0x57')][_0xc810('0x58')]({'where':{'id':_0x51ecc1[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x386360,null))[_0xc810('0x36')](removeEntity(_0x386360,null))[_0xc810('0x29')](handleError(_0x386360,null));};exports[_0xc810('0x5c')]=function(_0x47b0d8,_0x557a9d,_0x24b9d4){var _0x5534ca={};var _0x35af40={};var _0x307fba;var _0x913ead;return db[_0xc810('0x57')][_0xc810('0x5d')]({'where':{'id':_0x47b0d8[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x557a9d,null))['then'](function(_0x57b905){if(_0x57b905){_0x307fba=_0x57b905;_0x35af40[_0xc810('0x41')]=_[_0xc810('0x43')](db['SalesforceField'][_0xc810('0x3e')]);_0x35af40[_0xc810('0x42')]=_['keys'](_0x47b0d8[_0xc810('0x42')]);_0x35af40['filters']=_[_0xc810('0x45')](_0x35af40[_0xc810('0x41')],_0x35af40[_0xc810('0x42')]);_0x5534ca[_0xc810('0x46')]=_[_0xc810('0x45')](_0x35af40[_0xc810('0x41')],qs[_0xc810('0x47')](_0x47b0d8['query'][_0xc810('0x47')]));_0x5534ca[_0xc810('0x46')]=_0x5534ca[_0xc810('0x46')]['length']?_0x5534ca[_0xc810('0x46')]:_0x35af40[_0xc810('0x41')];_0x5534ca[_0xc810('0x4b')]=qs[_0xc810('0x4c')](_0x47b0d8[_0xc810('0x42')]['sort']);_0x5534ca[_0xc810('0x4f')]=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x47b0d8[_0xc810('0x42')],_0x35af40[_0xc810('0x44')]));if(_0x47b0d8[_0xc810('0x42')][_0xc810('0x4e')]){_0x5534ca['where']=_['merge'](_0x5534ca[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x5534ca[_0xc810('0x46')],function(_0x1c284b){var _0x245028={};_0x245028[_0x1c284b]={'$like':'%'+_0x47b0d8[_0xc810('0x42')][_0xc810('0x4e')]+'%'};return _0x245028;})});}_0x5534ca=_[_0xc810('0x50')]({},_0x5534ca,_0x47b0d8[_0xc810('0x56')]);return _0x307fba[_0xc810('0x5c')](_0x5534ca);}})['then'](function(_0x3ae15e){if(_0x3ae15e){_0x913ead=_0x3ae15e[_0xc810('0x48')];if(!_0x47b0d8['query'][_0xc810('0x49')](_0xc810('0x4a'))){_0x5534ca[_0xc810('0x2e')]=qs[_0xc810('0x2e')](_0x47b0d8[_0xc810('0x42')][_0xc810('0x2e')]);_0x5534ca['offset']=qs['offset'](_0x47b0d8[_0xc810('0x42')][_0xc810('0x2d')]);}return _0x307fba[_0xc810('0x5c')](_0x5534ca);}})[_0xc810('0x36')](function(_0x1fc7b1){if(_0x1fc7b1){return _0x1fc7b1?{'count':_0x913ead,'rows':_0x1fc7b1}:null;}})[_0xc810('0x36')](respondWithResult(_0x557a9d,null))[_0xc810('0x29')](handleError(_0x557a9d,null));};exports[_0xc810('0x5e')]=function(_0x19ef0d,_0x1a6b52,_0x5ba7ad){var _0x127bdd={};var _0x2ecfac={};var _0x2dc138;var _0x27b484;return db['SalesforceConfiguration'][_0xc810('0x5d')]({'where':{'id':_0x19ef0d['params']['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x1a6b52,null))['then'](function(_0x5e8020){if(_0x5e8020){_0x2dc138=_0x5e8020;_0x2ecfac['model']=_[_0xc810('0x43')](db['SalesforceField']['rawAttributes']);_0x2ecfac[_0xc810('0x42')]=_['keys'](_0x19ef0d[_0xc810('0x42')]);_0x2ecfac[_0xc810('0x44')]=_['intersection'](_0x2ecfac[_0xc810('0x41')],_0x2ecfac['query']);_0x127bdd['attributes']=_[_0xc810('0x45')](_0x2ecfac['model'],qs[_0xc810('0x47')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x47')]));_0x127bdd['attributes']=_0x127bdd['attributes'][_0xc810('0x48')]?_0x127bdd['attributes']:_0x2ecfac['model'];_0x127bdd['order']=qs[_0xc810('0x4c')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x4c')]);_0x127bdd[_0xc810('0x4f')]=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x19ef0d[_0xc810('0x42')],_0x2ecfac['filters']));if(_0x19ef0d[_0xc810('0x42')][_0xc810('0x4e')]){_0x127bdd[_0xc810('0x4f')]=_['merge'](_0x127bdd['where'],{'$or':_[_0xc810('0x3d')](_0x127bdd[_0xc810('0x46')],function(_0xe4df8e){var _0x5dff2f={};_0x5dff2f[_0xe4df8e]={'$like':'%'+_0x19ef0d[_0xc810('0x42')][_0xc810('0x4e')]+'%'};return _0x5dff2f;})});}_0x127bdd=_[_0xc810('0x50')]({},_0x127bdd,_0x19ef0d[_0xc810('0x56')]);return _0x2dc138[_0xc810('0x5e')](_0x127bdd);}})[_0xc810('0x36')](function(_0x402c1b){if(_0x402c1b){_0x27b484=_0x402c1b[_0xc810('0x48')];if(!_0x19ef0d[_0xc810('0x42')][_0xc810('0x49')](_0xc810('0x4a'))){_0x127bdd['limit']=qs[_0xc810('0x2e')](_0x19ef0d[_0xc810('0x42')][_0xc810('0x2e')]);_0x127bdd[_0xc810('0x2d')]=qs[_0xc810('0x2d')](_0x19ef0d['query']['offset']);}return _0x2dc138[_0xc810('0x5e')](_0x127bdd);}})[_0xc810('0x36')](function(_0x26cac4){if(_0x26cac4){return _0x26cac4?{'count':_0x27b484,'rows':_0x26cac4}:null;}})['then'](respondWithResult(_0x1a6b52,null))[_0xc810('0x29')](handleError(_0x1a6b52,null));};exports[_0xc810('0x5f')]=function(_0x1f45d5,_0x155828,_0x1c5d9d){var _0x3385af={};var _0x15c2f6={};var _0x3176ab;var _0x4ab032;return db[_0xc810('0x57')]['findOne']({'where':{'id':_0x1f45d5[_0xc810('0x5b')]['id']}})[_0xc810('0x36')](handleEntityNotFound(_0x155828,null))[_0xc810('0x36')](function(_0x4f5fed){if(_0x4f5fed){_0x3176ab=_0x4f5fed;_0x15c2f6[_0xc810('0x41')]=_[_0xc810('0x43')](db[_0xc810('0x60')][_0xc810('0x3e')]);_0x15c2f6[_0xc810('0x42')]=_['keys'](_0x1f45d5[_0xc810('0x42')]);_0x15c2f6['filters']=_[_0xc810('0x45')](_0x15c2f6[_0xc810('0x41')],_0x15c2f6['query']);_0x3385af[_0xc810('0x46')]=_[_0xc810('0x45')](_0x15c2f6[_0xc810('0x41')],qs[_0xc810('0x47')](_0x1f45d5['query'][_0xc810('0x47')]));_0x3385af[_0xc810('0x46')]=_0x3385af['attributes'][_0xc810('0x48')]?_0x3385af[_0xc810('0x46')]:_0x15c2f6[_0xc810('0x41')];_0x3385af['order']=qs[_0xc810('0x4c')](_0x1f45d5[_0xc810('0x42')][_0xc810('0x4c')]);_0x3385af['where']=qs[_0xc810('0x44')](_[_0xc810('0x4d')](_0x1f45d5[_0xc810('0x42')],_0x15c2f6[_0xc810('0x44')]));if(_0x1f45d5[_0xc810('0x42')]['filter']){_0x3385af[_0xc810('0x4f')]=_[_0xc810('0x50')](_0x3385af[_0xc810('0x4f')],{'$or':_[_0xc810('0x3d')](_0x3385af[_0xc810('0x46')],function(_0x27918e){var _0x455d7c={};_0x455d7c[_0x27918e]={'$like':'%'+_0x1f45d5[_0xc810('0x42')]['filter']+'%'};return _0x455d7c;})});}_0x3385af=_['merge']({},_0x3385af,_0x1f45d5[_0xc810('0x56')]);return _0x3176ab[_0xc810('0x5f')](_0x3385af);}})[_0xc810('0x36')](function(_0xc0b675){if(_0xc0b675){_0x4ab032=_0xc0b675[_0xc810('0x48')];if(!_0x1f45d5[_0xc810('0x42')][_0xc810('0x49')](_0xc810('0x4a'))){_0x3385af['limit']=qs[_0xc810('0x2e')](_0x1f45d5[_0xc810('0x42')]['limit']);_0x3385af[_0xc810('0x2d')]=qs['offset'](_0x1f45d5[_0xc810('0x42')][_0xc810('0x2d')]);}return _0x3176ab[_0xc810('0x5f')](_0x3385af);}})['then'](function(_0x3cd8ef){if(_0x3cd8ef){return _0x3cd8ef?{'count':_0x4ab032,'rows':_0x3cd8ef}:null;}})[_0xc810('0x36')](respondWithResult(_0x155828,null))['catch'](handleError(_0x155828,null));}; \ No newline at end of file +var _0x3d8f=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59026b,_0x12ace5){var _0x2c6152=function(_0x193dc2){while(--_0x193dc2){_0x59026b['push'](_0x59026b['shift']());}};_0x2c6152(++_0x12ace5);}(_0x3d8f,0x1d3));var _0xf3d8=function(_0x52805d,_0x3c2b48){_0x52805d=_0x52805d-0x0;var _0x4de6e1=_0x3d8f[_0x52805d];return _0x4de6e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3d8('0x0'));var rimraf=require(_0xf3d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3d8('0x2'));var rp=require(_0xf3d8('0x3'));var moment=require(_0xf3d8('0x4'));var BPromise=require(_0xf3d8('0x5'));var Mustache=require(_0xf3d8('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf3d8('0x7'));var ejs=require(_0xf3d8('0x8'));var fs=require('fs');var _=require(_0xf3d8('0x9'));var squel=require(_0xf3d8('0xa'));var crypto=require(_0xf3d8('0xb'));var jsforce=require(_0xf3d8('0xc'));var deskjs=require(_0xf3d8('0xd'));var toCsv=require(_0xf3d8('0x7'));var querystring=require(_0xf3d8('0xe'));var Papa=require(_0xf3d8('0xf'));var Redis=require(_0xf3d8('0x10'));var authService=require(_0xf3d8('0x11'));var qs=require(_0xf3d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3d8('0x13'))(_0xf3d8('0x14'));var utils=require(_0xf3d8('0x15'));var config=require(_0xf3d8('0x16'));var db=require(_0xf3d8('0x17'))['db'];var jayson=require(_0xf3d8('0x18'));var client=jayson['client'][_0xf3d8('0x19')]({'port':0x232a});function checkPasswordPattern(_0xb92ed4,_0x81c74f,_0x1d9b98){if(_0x1d9b98){var _0x3e7aab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e7aab['test'](_0x81c74f)){return _0xb92ed4;}else{throw new db[(_0xf3d8('0x1a'))][(_0xf3d8('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xb92ed4;}}function respondWithRpcPromise(_0x148b47,_0x15780d,_0x262437,_0x34b3e1){return new BPromise(function(_0x247aeb,_0x3c67de){var _0x115773=_0x34b3e1||client;return _0x115773[_0xf3d8('0x1c')](_0x148b47,_0x262437)[_0xf3d8('0x1d')](function(_0x37941b){logger['info'](_0xf3d8('0x1e'),_0x15780d,_0xf3d8('0x1f'));logger[_0xf3d8('0x20')](_0xf3d8('0x21'),_0x15780d,_0xf3d8('0x1f'),JSON[_0xf3d8('0x22')](_0x37941b));if(_0x37941b[_0xf3d8('0x23')]){if(_0x37941b[_0xf3d8('0x23')][_0xf3d8('0x24')]===0x1f4){logger[_0xf3d8('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x15780d,_0x37941b[_0xf3d8('0x23')][_0xf3d8('0x25')]);return _0x3c67de(_0x37941b[_0xf3d8('0x23')][_0xf3d8('0x25')]);}logger[_0xf3d8('0x23')](_0xf3d8('0x1e'),_0x15780d,_0x37941b[_0xf3d8('0x23')][_0xf3d8('0x25')]);return _0x247aeb(_0x37941b[_0xf3d8('0x23')][_0xf3d8('0x25')]);}else{logger[_0xf3d8('0x26')]('SalesforceConfiguration,\x20%s,\x20%s',_0x15780d,'request\x20sent');_0x247aeb(_0x37941b[_0xf3d8('0x27')]['message']);}})[_0xf3d8('0x28')](function(_0x58f61a){logger['error'](_0xf3d8('0x1e'),_0x15780d,_0x58f61a);_0x3c67de(_0x58f61a);});});}function respondWithStatusCode(_0x150f15,_0x39c8e5){_0x39c8e5=_0x39c8e5||0xcc;return function(_0x23229e){if(_0x23229e){return _0x150f15[_0xf3d8('0x29')](_0x39c8e5);}return _0x150f15['status'](_0x39c8e5)['end']();};}function respondWithResult(_0x3a537e,_0x50839a){_0x50839a=_0x50839a||0xc8;return function(_0x244989){if(_0x244989){return _0x3a537e[_0xf3d8('0x2a')](_0x50839a)[_0xf3d8('0x2b')](_0x244989);}};}function respondWithFilteredResult(_0x114320,_0x5223fb){return function(_0x31e763){if(_0x31e763){var _0x3bc7ec=_0x31e763[_0xf3d8('0x2c')],_0x35d45a=_0x5223fb['offset'],_0x2481f3=_0x5223fb[_0xf3d8('0x2d')]+_0x5223fb[_0xf3d8('0x2e')],_0x35acdc;if(_0x2481f3>=_0x3bc7ec){_0x2481f3=_0x3bc7ec;_0x35acdc=0xc8;}else{_0x35acdc=0xce;}_0x114320[_0xf3d8('0x2a')](_0x35acdc);return _0x114320[_0xf3d8('0x2f')](_0xf3d8('0x30'),_0x35d45a+'-'+_0x2481f3+'/'+_0x3bc7ec)[_0xf3d8('0x2b')](_0x31e763);}return null;};}function patchUpdates(_0x4033cc){return function(_0x41e9cb){try{jsonpatch[_0xf3d8('0x31')](_0x41e9cb,_0x4033cc,!![]);}catch(_0x2a8b44){return BPromise[_0xf3d8('0x32')](_0x2a8b44);}return _0x41e9cb[_0xf3d8('0x33')]();};}function saveUpdates(_0x5a2dad,_0x10272b){return function(_0x4d9605){if(_0x4d9605){return _0x4d9605[_0xf3d8('0x34')](_0x5a2dad)['then'](function(_0x348711){return _0x348711;});}return null;};}function removeEntity(_0x1bed8f,_0x3fdeae){return function(_0x59408c){if(_0x59408c){return _0x59408c[_0xf3d8('0x35')]()['then'](function(){_0x1bed8f[_0xf3d8('0x2a')](0xcc)[_0xf3d8('0x36')]();});}};}function handleEntityNotFound(_0x57ed39,_0x75c8c){return function(_0x14bc56){if(!_0x14bc56){_0x57ed39['sendStatus'](0x194);}return _0x14bc56;};}function handleError(_0x21bf4f,_0x52e9d5){_0x52e9d5=_0x52e9d5||0x1f4;return function(_0xb3e579){logger['error'](_0xb3e579[_0xf3d8('0x37')]);if(_0xb3e579[_0xf3d8('0x38')]){delete _0xb3e579[_0xf3d8('0x38')];}_0x21bf4f[_0xf3d8('0x2a')](_0x52e9d5)[_0xf3d8('0x39')](_0xb3e579);};}exports[_0xf3d8('0x3a')]=function(_0x494e38,_0x243edc){var _0x2139ea={},_0xd5dd93={},_0x30ee7a={'count':0x0,'rows':[]};var _0x3f39a7=_[_0xf3d8('0x3b')](db[_0xf3d8('0x3c')][_0xf3d8('0x3d')],function(_0x16d525){return{'name':_0x16d525[_0xf3d8('0x3e')],'type':_0x16d525[_0xf3d8('0x3f')][_0xf3d8('0x40')]};});_0xd5dd93[_0xf3d8('0x41')]=_[_0xf3d8('0x3b')](_0x3f39a7,_0xf3d8('0x38'));_0xd5dd93[_0xf3d8('0x42')]=_[_0xf3d8('0x43')](_0x494e38[_0xf3d8('0x42')]);_0xd5dd93[_0xf3d8('0x44')]=_[_0xf3d8('0x45')](_0xd5dd93[_0xf3d8('0x41')],_0xd5dd93[_0xf3d8('0x42')]);_0x2139ea['attributes']=_[_0xf3d8('0x45')](_0xd5dd93[_0xf3d8('0x41')],qs['fields'](_0x494e38['query']['fields']));_0x2139ea[_0xf3d8('0x46')]=_0x2139ea['attributes'][_0xf3d8('0x47')]?_0x2139ea[_0xf3d8('0x46')]:_0xd5dd93['model'];if(!_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x48')](_0xf3d8('0x49'))){_0x2139ea[_0xf3d8('0x2e')]=qs[_0xf3d8('0x2e')](_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x2e')]);_0x2139ea['offset']=qs[_0xf3d8('0x2d')](_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x2d')]);}_0x2139ea[_0xf3d8('0x4a')]=qs[_0xf3d8('0x4b')](_0x494e38[_0xf3d8('0x42')]['sort']);_0x2139ea[_0xf3d8('0x4c')]=qs[_0xf3d8('0x44')](_[_0xf3d8('0x4d')](_0x494e38['query'],_0xd5dd93[_0xf3d8('0x44')]),_0x3f39a7);if(_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x4e')]){_0x2139ea[_0xf3d8('0x4c')]=_[_0xf3d8('0x4f')](_0x2139ea[_0xf3d8('0x4c')],{'$or':_[_0xf3d8('0x3b')](_0x3f39a7,function(_0x136242){if(_0x136242[_0xf3d8('0x3f')]!==_0xf3d8('0x50')){var _0x4cdf4e={};_0x4cdf4e[_0x136242['name']]={'$like':'%'+_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x4e')]+'%'};return _0x4cdf4e;}})});}_0x2139ea=_[_0xf3d8('0x4f')]({},_0x2139ea,_0x494e38[_0xf3d8('0x51')]);var _0x141850={'where':_0x2139ea['where']};return db[_0xf3d8('0x3c')][_0xf3d8('0x2c')](_0x141850)[_0xf3d8('0x1d')](function(_0x3dc682){_0x30ee7a['count']=_0x3dc682;if(_0x494e38[_0xf3d8('0x42')][_0xf3d8('0x52')]){_0x2139ea[_0xf3d8('0x53')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xf3d8('0x54')](_0x2139ea);})[_0xf3d8('0x1d')](function(_0x447ad0){_0x30ee7a[_0xf3d8('0x55')]=_0x447ad0;return _0x30ee7a;})[_0xf3d8('0x1d')](respondWithFilteredResult(_0x243edc,_0x2139ea))[_0xf3d8('0x28')](handleError(_0x243edc,null));};exports[_0xf3d8('0x56')]=function(_0x207bdc,_0x30503d){var _0x26da1f={'raw':![],'where':{'id':_0x207bdc[_0xf3d8('0x57')]['id']}},_0x3e1085={};_0x3e1085[_0xf3d8('0x41')]=_[_0xf3d8('0x43')](db['SalesforceConfiguration'][_0xf3d8('0x3d')]);_0x3e1085['query']=_['keys'](_0x207bdc['query']);_0x3e1085[_0xf3d8('0x44')]=_[_0xf3d8('0x45')](_0x3e1085[_0xf3d8('0x41')],_0x3e1085[_0xf3d8('0x42')]);_0x26da1f[_0xf3d8('0x46')]=_['intersection'](_0x3e1085[_0xf3d8('0x41')],qs[_0xf3d8('0x58')](_0x207bdc['query'][_0xf3d8('0x58')]));_0x26da1f['attributes']=_0x26da1f[_0xf3d8('0x46')][_0xf3d8('0x47')]?_0x26da1f[_0xf3d8('0x46')]:_0x3e1085[_0xf3d8('0x41')];if(_0x207bdc[_0xf3d8('0x42')][_0xf3d8('0x52')]){_0x26da1f[_0xf3d8('0x53')]=[{'all':!![]}];}_0x26da1f=_[_0xf3d8('0x4f')]({},_0x26da1f,_0x207bdc[_0xf3d8('0x51')]);return db[_0xf3d8('0x3c')][_0xf3d8('0x59')](_0x26da1f)[_0xf3d8('0x1d')](handleEntityNotFound(_0x30503d,null))[_0xf3d8('0x1d')](respondWithResult(_0x30503d,null))['catch'](handleError(_0x30503d,null));};exports[_0xf3d8('0x5a')]=function(_0x1ecbf8,_0x5e78fa){return db[_0xf3d8('0x3c')][_0xf3d8('0x5a')](_0x1ecbf8[_0xf3d8('0x5b')],{})[_0xf3d8('0x1d')](respondWithResult(_0x5e78fa,0xc9))[_0xf3d8('0x28')](handleError(_0x5e78fa,null));};exports[_0xf3d8('0x34')]=function(_0x468af8,_0x4e0838){if(_0x468af8[_0xf3d8('0x5b')]['id']){delete _0x468af8['body']['id'];}return db[_0xf3d8('0x3c')]['find']({'where':{'id':_0x468af8[_0xf3d8('0x57')]['id']}})[_0xf3d8('0x1d')](handleEntityNotFound(_0x4e0838,null))[_0xf3d8('0x1d')](saveUpdates(_0x468af8[_0xf3d8('0x5b')],null))[_0xf3d8('0x1d')](respondWithResult(_0x4e0838,null))['catch'](handleError(_0x4e0838,null));};exports[_0xf3d8('0x35')]=function(_0x4af301,_0x1d7d00){return db[_0xf3d8('0x3c')][_0xf3d8('0x59')]({'where':{'id':_0x4af301[_0xf3d8('0x57')]['id']}})[_0xf3d8('0x1d')](handleEntityNotFound(_0x1d7d00,null))[_0xf3d8('0x1d')](removeEntity(_0x1d7d00,null))[_0xf3d8('0x28')](handleError(_0x1d7d00,null));};exports[_0xf3d8('0x5c')]=function(_0x3039f8,_0x4c26c6,_0x6db05e){var _0x110475={};var _0x5993f0={};var _0x2582a0;var _0x13ca90;return db[_0xf3d8('0x3c')][_0xf3d8('0x5d')]({'where':{'id':_0x3039f8[_0xf3d8('0x57')]['id']}})[_0xf3d8('0x1d')](handleEntityNotFound(_0x4c26c6,null))[_0xf3d8('0x1d')](function(_0x51c7ce){if(_0x51c7ce){_0x2582a0=_0x51c7ce;_0x5993f0[_0xf3d8('0x41')]=_[_0xf3d8('0x43')](db[_0xf3d8('0x5e')]['rawAttributes']);_0x5993f0[_0xf3d8('0x42')]=_['keys'](_0x3039f8[_0xf3d8('0x42')]);_0x5993f0[_0xf3d8('0x44')]=_['intersection'](_0x5993f0[_0xf3d8('0x41')],_0x5993f0['query']);_0x110475['attributes']=_[_0xf3d8('0x45')](_0x5993f0[_0xf3d8('0x41')],qs[_0xf3d8('0x58')](_0x3039f8[_0xf3d8('0x42')]['fields']));_0x110475['attributes']=_0x110475[_0xf3d8('0x46')]['length']?_0x110475[_0xf3d8('0x46')]:_0x5993f0['model'];_0x110475['order']=qs[_0xf3d8('0x4b')](_0x3039f8[_0xf3d8('0x42')][_0xf3d8('0x4b')]);_0x110475[_0xf3d8('0x4c')]=qs[_0xf3d8('0x44')](_[_0xf3d8('0x4d')](_0x3039f8['query'],_0x5993f0[_0xf3d8('0x44')]));if(_0x3039f8[_0xf3d8('0x42')][_0xf3d8('0x4e')]){_0x110475[_0xf3d8('0x4c')]=_['merge'](_0x110475[_0xf3d8('0x4c')],{'$or':_[_0xf3d8('0x3b')](_0x110475['attributes'],function(_0x1395b2){var _0x204768={};_0x204768[_0x1395b2]={'$like':'%'+_0x3039f8[_0xf3d8('0x42')][_0xf3d8('0x4e')]+'%'};return _0x204768;})});}_0x110475=_[_0xf3d8('0x4f')]({},_0x110475,_0x3039f8['options']);return _0x2582a0[_0xf3d8('0x5c')](_0x110475);}})[_0xf3d8('0x1d')](function(_0x407cb0){if(_0x407cb0){_0x13ca90=_0x407cb0[_0xf3d8('0x47')];if(!_0x3039f8['query'][_0xf3d8('0x48')](_0xf3d8('0x49'))){_0x110475[_0xf3d8('0x2e')]=qs[_0xf3d8('0x2e')](_0x3039f8[_0xf3d8('0x42')]['limit']);_0x110475[_0xf3d8('0x2d')]=qs['offset'](_0x3039f8[_0xf3d8('0x42')][_0xf3d8('0x2d')]);}return _0x2582a0[_0xf3d8('0x5c')](_0x110475);}})[_0xf3d8('0x1d')](function(_0x23ffb7){if(_0x23ffb7){return _0x23ffb7?{'count':_0x13ca90,'rows':_0x23ffb7}:null;}})['then'](respondWithResult(_0x4c26c6,null))[_0xf3d8('0x28')](handleError(_0x4c26c6,null));};exports[_0xf3d8('0x5f')]=function(_0x31af19,_0x594f31,_0x38880a){var _0x1fcc51={};var _0x49e5eb={};var _0x4513a3;var _0x391360;return db['SalesforceConfiguration'][_0xf3d8('0x5d')]({'where':{'id':_0x31af19[_0xf3d8('0x57')]['id']}})[_0xf3d8('0x1d')](handleEntityNotFound(_0x594f31,null))['then'](function(_0x3e6055){if(_0x3e6055){_0x4513a3=_0x3e6055;_0x49e5eb['model']=_[_0xf3d8('0x43')](db[_0xf3d8('0x5e')]['rawAttributes']);_0x49e5eb[_0xf3d8('0x42')]=_[_0xf3d8('0x43')](_0x31af19['query']);_0x49e5eb[_0xf3d8('0x44')]=_['intersection'](_0x49e5eb['model'],_0x49e5eb[_0xf3d8('0x42')]);_0x1fcc51[_0xf3d8('0x46')]=_[_0xf3d8('0x45')](_0x49e5eb[_0xf3d8('0x41')],qs[_0xf3d8('0x58')](_0x31af19['query'][_0xf3d8('0x58')]));_0x1fcc51[_0xf3d8('0x46')]=_0x1fcc51[_0xf3d8('0x46')][_0xf3d8('0x47')]?_0x1fcc51[_0xf3d8('0x46')]:_0x49e5eb[_0xf3d8('0x41')];_0x1fcc51['order']=qs[_0xf3d8('0x4b')](_0x31af19[_0xf3d8('0x42')][_0xf3d8('0x4b')]);_0x1fcc51[_0xf3d8('0x4c')]=qs[_0xf3d8('0x44')](_[_0xf3d8('0x4d')](_0x31af19[_0xf3d8('0x42')],_0x49e5eb['filters']));if(_0x31af19[_0xf3d8('0x42')]['filter']){_0x1fcc51[_0xf3d8('0x4c')]=_[_0xf3d8('0x4f')](_0x1fcc51[_0xf3d8('0x4c')],{'$or':_[_0xf3d8('0x3b')](_0x1fcc51[_0xf3d8('0x46')],function(_0x52c262){var _0x3e22dd={};_0x3e22dd[_0x52c262]={'$like':'%'+_0x31af19[_0xf3d8('0x42')][_0xf3d8('0x4e')]+'%'};return _0x3e22dd;})});}_0x1fcc51=_[_0xf3d8('0x4f')]({},_0x1fcc51,_0x31af19[_0xf3d8('0x51')]);return _0x4513a3['getSubjects'](_0x1fcc51);}})[_0xf3d8('0x1d')](function(_0x50a3ab){if(_0x50a3ab){_0x391360=_0x50a3ab['length'];if(!_0x31af19[_0xf3d8('0x42')][_0xf3d8('0x48')]('nolimit')){_0x1fcc51[_0xf3d8('0x2e')]=qs[_0xf3d8('0x2e')](_0x31af19[_0xf3d8('0x42')][_0xf3d8('0x2e')]);_0x1fcc51['offset']=qs['offset'](_0x31af19['query'][_0xf3d8('0x2d')]);}return _0x4513a3[_0xf3d8('0x5f')](_0x1fcc51);}})[_0xf3d8('0x1d')](function(_0x4bcef9){if(_0x4bcef9){return _0x4bcef9?{'count':_0x391360,'rows':_0x4bcef9}:null;}})[_0xf3d8('0x1d')](respondWithResult(_0x594f31,null))[_0xf3d8('0x28')](handleError(_0x594f31,null));};exports['getDescriptions']=function(_0x191574,_0x1688fe,_0x538b52){var _0xd0a102={};var _0x469568={};var _0x4bd442;var _0x52a97c;return db[_0xf3d8('0x3c')]['findOne']({'where':{'id':_0x191574[_0xf3d8('0x57')]['id']}})[_0xf3d8('0x1d')](handleEntityNotFound(_0x1688fe,null))[_0xf3d8('0x1d')](function(_0x4ba491){if(_0x4ba491){_0x4bd442=_0x4ba491;_0x469568['model']=_['keys'](db[_0xf3d8('0x5e')][_0xf3d8('0x3d')]);_0x469568[_0xf3d8('0x42')]=_[_0xf3d8('0x43')](_0x191574[_0xf3d8('0x42')]);_0x469568[_0xf3d8('0x44')]=_[_0xf3d8('0x45')](_0x469568[_0xf3d8('0x41')],_0x469568[_0xf3d8('0x42')]);_0xd0a102[_0xf3d8('0x46')]=_['intersection'](_0x469568[_0xf3d8('0x41')],qs['fields'](_0x191574[_0xf3d8('0x42')]['fields']));_0xd0a102[_0xf3d8('0x46')]=_0xd0a102[_0xf3d8('0x46')][_0xf3d8('0x47')]?_0xd0a102[_0xf3d8('0x46')]:_0x469568['model'];_0xd0a102[_0xf3d8('0x4a')]=qs[_0xf3d8('0x4b')](_0x191574[_0xf3d8('0x42')]['sort']);_0xd0a102[_0xf3d8('0x4c')]=qs[_0xf3d8('0x44')](_['pick'](_0x191574[_0xf3d8('0x42')],_0x469568[_0xf3d8('0x44')]));if(_0x191574[_0xf3d8('0x42')][_0xf3d8('0x4e')]){_0xd0a102['where']=_['merge'](_0xd0a102['where'],{'$or':_[_0xf3d8('0x3b')](_0xd0a102[_0xf3d8('0x46')],function(_0x44d8cf){var _0x65c935={};_0x65c935[_0x44d8cf]={'$like':'%'+_0x191574[_0xf3d8('0x42')]['filter']+'%'};return _0x65c935;})});}_0xd0a102=_['merge']({},_0xd0a102,_0x191574[_0xf3d8('0x51')]);return _0x4bd442['getDescriptions'](_0xd0a102);}})[_0xf3d8('0x1d')](function(_0x2bffcc){if(_0x2bffcc){_0x52a97c=_0x2bffcc['length'];if(!_0x191574['query'][_0xf3d8('0x48')](_0xf3d8('0x49'))){_0xd0a102[_0xf3d8('0x2e')]=qs[_0xf3d8('0x2e')](_0x191574[_0xf3d8('0x42')][_0xf3d8('0x2e')]);_0xd0a102[_0xf3d8('0x2d')]=qs[_0xf3d8('0x2d')](_0x191574[_0xf3d8('0x42')][_0xf3d8('0x2d')]);}return _0x4bd442[_0xf3d8('0x60')](_0xd0a102);}})[_0xf3d8('0x1d')](function(_0x1ceff2){if(_0x1ceff2){return _0x1ceff2?{'count':_0x52a97c,'rows':_0x1ceff2}:null;}})['then'](respondWithResult(_0x1688fe,null))['catch'](handleError(_0x1688fe,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index aee29eb..3113685 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 _0xcd1e=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x31fdb2,_0x13fe10){var _0x47d857=function(_0x5542c3){while(--_0x5542c3){_0x31fdb2['push'](_0x31fdb2['shift']());}};_0x47d857(++_0x13fe10);}(_0xcd1e,0x67));var _0xecd1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcd1e[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xecd1('0x0'));var util=require(_0xecd1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xecd1('0x2'));var BPromise=require(_0xecd1('0x3'));var rp=require(_0xecd1('0x4'));var fs=require('fs');var path=require(_0xecd1('0x5'));var rimraf=require(_0xecd1('0x6'));var config=require(_0xecd1('0x7'));var attributes=require(_0xecd1('0x8'));module[_0xecd1('0x9')]=function(_0x3fb003,_0x28010a){return _0x3fb003[_0xecd1('0xa')](_0xecd1('0xb'),attributes,{'tableName':_0xecd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebe6=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xe1dc01,_0x42cde4){var _0x46b6ad=function(_0x4fd59e){while(--_0x4fd59e){_0xe1dc01['push'](_0xe1dc01['shift']());}};_0x46b6ad(++_0x42cde4);}(_0xebe6,0x14f));var _0x6ebe=function(_0x468dac,_0x1ffdb3){_0x468dac=_0x468dac-0x0;var _0x62391=_0xebe6[_0x468dac];return _0x62391;};'use strict';var _=require('lodash');var util=require(_0x6ebe('0x0'));var logger=require(_0x6ebe('0x1'))(_0x6ebe('0x2'));var moment=require(_0x6ebe('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ebe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ebe('0x5'));var config=require('../../config/environment');var attributes=require(_0x6ebe('0x6'));module[_0x6ebe('0x7')]=function(_0x58da10,_0x3be824){return _0x58da10[_0x6ebe('0x8')](_0x6ebe('0x9'),attributes,{'tableName':_0x6ebe('0xa'),'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 d8b6de7..1b6c516 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 _0xd703=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','ioredis'];(function(_0x198752,_0x410d18){var _0x3e749b=function(_0x55c334){while(--_0x55c334){_0x198752['push'](_0x198752['shift']());}};_0x3e749b(++_0x410d18);}(_0xd703,0x1d8));var _0x3d70=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xd703[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x3d70('0x0'));var util=require(_0x3d70('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d70('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d70('0x3'));var logger=require(_0x3d70('0x4'))(_0x3d70('0x5'));var config=require(_0x3d70('0x6'));var jayson=require(_0x3d70('0x7'));var client=jayson[_0x3d70('0x8')][_0x3d70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1addaf,_0xf16b29,_0x314283){return new BPromise(function(_0x4b5fa1,_0x1b0b7a){return client['request'](_0x1addaf,_0x314283)[_0x3d70('0xa')](function(_0x2d34e7){logger[_0x3d70('0xb')](_0x3d70('0xc'),_0xf16b29,_0x3d70('0xd'));logger[_0x3d70('0xe')](_0x3d70('0xf'),_0xf16b29,_0x3d70('0xd'),JSON['stringify'](_0x2d34e7));if(_0x2d34e7[_0x3d70('0x10')]){if(_0x2d34e7[_0x3d70('0x10')]['code']===0x1f4){logger[_0x3d70('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0xf16b29,_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);return _0x1b0b7a(_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);}logger[_0x3d70('0x10')](_0x3d70('0xc'),_0xf16b29,_0x2d34e7['error'][_0x3d70('0x11')]);return _0x4b5fa1(_0x2d34e7[_0x3d70('0x10')][_0x3d70('0x11')]);}else{logger[_0x3d70('0xb')](_0x3d70('0xc'),_0xf16b29,_0x3d70('0xd'));_0x4b5fa1(_0x2d34e7['result']['message']);}})[_0x3d70('0x12')](function(_0x248a1e){logger[_0x3d70('0x10')](_0x3d70('0xc'),_0xf16b29,_0x248a1e);_0x1b0b7a(_0x248a1e);});});} \ No newline at end of file +var _0xa563=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cd29a,_0x30be39){var _0x43b24c=function(_0x57ab2d){while(--_0x57ab2d){_0x4cd29a['push'](_0x4cd29a['shift']());}};_0x43b24c(++_0x30be39);}(_0xa563,0x7b));var _0x3a56=function(_0x53d74f,_0x22463f){_0x53d74f=_0x53d74f-0x0;var _0x4cfd67=_0xa563[_0x53d74f];return _0x4cfd67;};'use strict';var _=require(_0x3a56('0x0'));var util=require(_0x3a56('0x1'));var moment=require(_0x3a56('0x2'));var BPromise=require(_0x3a56('0x3'));var rs=require(_0x3a56('0x4'));var fs=require('fs');var Redis=require(_0x3a56('0x5'));var db=require(_0x3a56('0x6'))['db'];var utils=require(_0x3a56('0x7'));var logger=require(_0x3a56('0x8'))(_0x3a56('0x9'));var config=require(_0x3a56('0xa'));var jayson=require(_0x3a56('0xb'));var client=jayson[_0x3a56('0xc')][_0x3a56('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e5c2b,_0x528d38,_0xe4ab6c){return new BPromise(function(_0xc54ab8,_0x29c8ab){return client[_0x3a56('0xe')](_0x1e5c2b,_0xe4ab6c)[_0x3a56('0xf')](function(_0x491453){logger['info'](_0x3a56('0x10'),_0x528d38,_0x3a56('0x11'));logger[_0x3a56('0x12')](_0x3a56('0x13'),_0x528d38,_0x3a56('0x11'),JSON[_0x3a56('0x14')](_0x491453));if(_0x491453[_0x3a56('0x15')]){if(_0x491453[_0x3a56('0x15')][_0x3a56('0x16')]===0x1f4){logger[_0x3a56('0x15')](_0x3a56('0x10'),_0x528d38,_0x491453['error'][_0x3a56('0x17')]);return _0x29c8ab(_0x491453[_0x3a56('0x15')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x528d38,_0x491453[_0x3a56('0x15')][_0x3a56('0x17')]);return _0xc54ab8(_0x491453[_0x3a56('0x15')][_0x3a56('0x17')]);}else{logger[_0x3a56('0x18')](_0x3a56('0x10'),_0x528d38,_0x3a56('0x11'));_0xc54ab8(_0x491453['result'][_0x3a56('0x17')]);}})[_0x3a56('0x19')](function(_0x5d53cf){logger[_0x3a56('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x528d38,_0x5d53cf);_0x29c8ab(_0x5d53cf);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b943c82..daee60c 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 _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x1261,0x144));var _0x1126=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x1261[_0x543c51];return _0x360555;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0xc')]('/',auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router[_0x1126('0xf')]('/:id',auth[_0x1126('0xd')](),controller[_0x1126('0x10')]);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a6b=['show','post','/:id','update','delete','destroy','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x5cb29e,_0x237e9d){var _0x462274=function(_0x187343){while(--_0x187343){_0x5cb29e['push'](_0x5cb29e['shift']());}};_0x462274(++_0x237e9d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x10a4db,_0x1b1dbb){_0x10a4db=_0x10a4db-0x0;var _0x332573=_0x0a6b[_0x10a4db];return _0x332573;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var auth=require(_0xb0a6('0x2'));var interaction=require(_0xb0a6('0x3'));var config=require(_0xb0a6('0x4'));var controller=require('./intSalesforceField.controller');router[_0xb0a6('0x5')]('/',auth['isAuthenticated'](),controller[_0xb0a6('0x6')]);router[_0xb0a6('0x5')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0x8')]);router[_0xb0a6('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb0a6('0xa'),auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xb')]);router[_0xb0a6('0xc')]('/:id',auth[_0xb0a6('0x7')](),controller[_0xb0a6('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2fa1b79..d9e4183 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 _0x731e=['string','customVariable','keyValue','variable','STRING','sequelize','exports','ENUM'];(function(_0x4054e9,_0x29b091){var _0xb06d6f=function(_0x35db75){while(--_0x35db75){_0x4054e9['push'](_0x4054e9['shift']());}};_0xb06d6f(++_0x29b091);}(_0x731e,0x9d));var _0xe731=function(_0x3c451c,_0x3cc3ff){_0x3c451c=_0x3c451c-0x0;var _0x799bf0=_0x731e[_0x3c451c];return _0x799bf0;};'use strict';var Sequelize=require(_0xe731('0x0'));module[_0xe731('0x1')]={'type':{'type':Sequelize[_0xe731('0x2')](_0xe731('0x3'),'variable',_0xe731('0x4'),_0xe731('0x5')),'defaultValue':_0xe731('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe731('0x6'),_0xe731('0x4'))},'keyContent':{'type':Sequelize[_0xe731('0x7')]},'idField':{'type':Sequelize[_0xe731('0x7')]},'variableName':{'type':Sequelize[_0xe731('0x7')]}}; \ No newline at end of file +var _0x1023=['STRING','sequelize','exports','string','keyValue','ENUM'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1023,0xbb));var _0x3102=function(_0x11b83a,_0x343aa5){_0x11b83a=_0x11b83a-0x0;var _0x1784cd=_0x1023[_0x11b83a];return _0x1784cd;};'use strict';var Sequelize=require(_0x3102('0x0'));module[_0x3102('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3102('0x2'),'variable','customVariable',_0x3102('0x3')),'defaultValue':_0x3102('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3102('0x4')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x3102('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x3102('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6b50479..986123f 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 _0xcecb=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','json','reject','then','error','stack','name','send','index','map','SalesforceField'];(function(_0x108bf5,_0x211fd6){var _0x2d846d=function(_0xec9c28){while(--_0xec9c28){_0x108bf5['push'](_0x108bf5['shift']());}};_0x2d846d(++_0x211fd6);}(_0xcecb,0x66));var _0xbcec=function(_0x486775,_0x2630f9){_0x486775=_0x486775-0x0;var _0x35451e=_0xcecb[_0x486775];return _0x35451e;};'use strict';var pdf=require(_0xbcec('0x0'));var emlformat=require(_0xbcec('0x1'));var rimraf=require(_0xbcec('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcec('0x3'));var rp=require(_0xbcec('0x4'));var moment=require(_0xbcec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbcec('0x6'));var util=require(_0xbcec('0x7'));var path=require(_0xbcec('0x8'));var sox=require(_0xbcec('0x9'));var csv=require('to-csv');var ejs=require(_0xbcec('0xa'));var fs=require('fs');var _=require(_0xbcec('0xb'));var squel=require(_0xbcec('0xc'));var crypto=require(_0xbcec('0xd'));var jsforce=require(_0xbcec('0xe'));var deskjs=require(_0xbcec('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbcec('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbcec('0x11'));var qs=require(_0xbcec('0x12'));var as=require(_0xbcec('0x13'));var hardwareService=require(_0xbcec('0x14'));var logger=require(_0xbcec('0x15'))(_0xbcec('0x16'));var utils=require(_0xbcec('0x17'));var config=require(_0xbcec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d97b1,_0x35e239){_0x35e239=_0x35e239||0xcc;return function(_0x1260be){if(_0x1260be){return _0x5d97b1[_0xbcec('0x19')](_0x35e239);}return _0x5d97b1['status'](_0x35e239)[_0xbcec('0x1a')]();};}function respondWithResult(_0x5619d0,_0x4e93d9){_0x4e93d9=_0x4e93d9||0xc8;return function(_0x3af3f6){if(_0x3af3f6){return _0x5619d0[_0xbcec('0x1b')](_0x4e93d9)['json'](_0x3af3f6);}};}function respondWithFilteredResult(_0x9521ff,_0xf7a3){return function(_0x5c4062){if(_0x5c4062){var _0x4650f4=_0x5c4062[_0xbcec('0x1c')],_0x3e6781=_0xf7a3[_0xbcec('0x1d')],_0x1b6c8c=_0xf7a3[_0xbcec('0x1d')]+_0xf7a3[_0xbcec('0x1e')],_0x2a535b;if(_0x1b6c8c>=_0x4650f4){_0x1b6c8c=_0x4650f4;_0x2a535b=0xc8;}else{_0x2a535b=0xce;}_0x9521ff[_0xbcec('0x1b')](_0x2a535b);return _0x9521ff[_0xbcec('0x1f')]('Content-Range',_0x3e6781+'-'+_0x1b6c8c+'/'+_0x4650f4)[_0xbcec('0x20')](_0x5c4062);}return null;};}function patchUpdates(_0x3d2e32){return function(_0xa9ad09){try{jsonpatch['apply'](_0xa9ad09,_0x3d2e32,!![]);}catch(_0x420d6c){return BPromise[_0xbcec('0x21')](_0x420d6c);}return _0xa9ad09['save']();};}function saveUpdates(_0x850987,_0x39d684){return function(_0x4847b9){if(_0x4847b9){return _0x4847b9['update'](_0x850987)[_0xbcec('0x22')](function(_0x37a93c){return _0x37a93c;});}return null;};}function removeEntity(_0x1423f9,_0x59e9ac){return function(_0x2c8cbf){if(_0x2c8cbf){return _0x2c8cbf['destroy']()[_0xbcec('0x22')](function(){_0x1423f9[_0xbcec('0x1b')](0xcc)[_0xbcec('0x1a')]();});}};}function handleEntityNotFound(_0x450c0a,_0x2b46b7){return function(_0x106fcc){if(!_0x106fcc){_0x450c0a['sendStatus'](0x194);}return _0x106fcc;};}function handleError(_0x58fbfb,_0x5d9cb7){_0x5d9cb7=_0x5d9cb7||0x1f4;return function(_0x4888ab){logger[_0xbcec('0x23')](_0x4888ab[_0xbcec('0x24')]);if(_0x4888ab[_0xbcec('0x25')]){delete _0x4888ab[_0xbcec('0x25')];}_0x58fbfb[_0xbcec('0x1b')](_0x5d9cb7)[_0xbcec('0x26')](_0x4888ab);};}exports[_0xbcec('0x27')]=function(_0x2f6be5,_0x100e6c){var _0x1bb9f4={},_0x59b836={},_0x5236bc={'count':0x0,'rows':[]};var _0x3771a1=_[_0xbcec('0x28')](db[_0xbcec('0x29')][_0xbcec('0x2a')],function(_0x51e773){return{'name':_0x51e773[_0xbcec('0x2b')],'type':_0x51e773[_0xbcec('0x2c')][_0xbcec('0x2d')]};});_0x59b836[_0xbcec('0x2e')]=_[_0xbcec('0x28')](_0x3771a1,_0xbcec('0x25'));_0x59b836[_0xbcec('0x2f')]=_[_0xbcec('0x30')](_0x2f6be5[_0xbcec('0x2f')]);_0x59b836[_0xbcec('0x31')]=_[_0xbcec('0x32')](_0x59b836[_0xbcec('0x2e')],_0x59b836[_0xbcec('0x2f')]);_0x1bb9f4[_0xbcec('0x33')]=_[_0xbcec('0x32')](_0x59b836[_0xbcec('0x2e')],qs[_0xbcec('0x34')](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x34')]));_0x1bb9f4[_0xbcec('0x33')]=_0x1bb9f4[_0xbcec('0x33')][_0xbcec('0x35')]?_0x1bb9f4[_0xbcec('0x33')]:_0x59b836[_0xbcec('0x2e')];if(!_0x2f6be5[_0xbcec('0x2f')]['hasOwnProperty'](_0xbcec('0x36'))){_0x1bb9f4[_0xbcec('0x1e')]=qs[_0xbcec('0x1e')](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x1e')]);_0x1bb9f4[_0xbcec('0x1d')]=qs[_0xbcec('0x1d')](_0x2f6be5[_0xbcec('0x2f')]['offset']);}_0x1bb9f4['order']=qs['sort'](_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x37')]);_0x1bb9f4['where']=qs['filters'](_[_0xbcec('0x38')](_0x2f6be5[_0xbcec('0x2f')],_0x59b836[_0xbcec('0x31')]),_0x3771a1);if(_0x2f6be5[_0xbcec('0x2f')]['filter']){_0x1bb9f4[_0xbcec('0x39')]=_['merge'](_0x1bb9f4['where'],{'$or':_['map'](_0x3771a1,function(_0x53e659){if(_0x53e659[_0xbcec('0x2c')]!==_0xbcec('0x3a')){var _0x267ecd={};_0x267ecd[_0x53e659[_0xbcec('0x25')]]={'$like':'%'+_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x3b')]+'%'};return _0x267ecd;}})});}_0x1bb9f4=_[_0xbcec('0x3c')]({},_0x1bb9f4,_0x2f6be5[_0xbcec('0x3d')]);var _0x53cccf={'where':_0x1bb9f4[_0xbcec('0x39')]};return db[_0xbcec('0x29')][_0xbcec('0x1c')](_0x53cccf)['then'](function(_0x560ce5){_0x5236bc[_0xbcec('0x1c')]=_0x560ce5;if(_0x2f6be5[_0xbcec('0x2f')][_0xbcec('0x3e')]){_0x1bb9f4[_0xbcec('0x3f')]=[{'all':!![]}];}return db[_0xbcec('0x29')][_0xbcec('0x40')](_0x1bb9f4);})['then'](function(_0x482841){_0x5236bc['rows']=_0x482841;return _0x5236bc;})['then'](respondWithFilteredResult(_0x100e6c,_0x1bb9f4))[_0xbcec('0x41')](handleError(_0x100e6c,null));};exports[_0xbcec('0x42')]=function(_0x19a4ae,_0x4a2f96){var _0x5a521b={'raw':!![],'where':{'id':_0x19a4ae[_0xbcec('0x43')]['id']}},_0x20e673={};_0x20e673[_0xbcec('0x2e')]=_[_0xbcec('0x30')](db[_0xbcec('0x29')][_0xbcec('0x2a')]);_0x20e673[_0xbcec('0x2f')]=_[_0xbcec('0x30')](_0x19a4ae[_0xbcec('0x2f')]);_0x20e673[_0xbcec('0x31')]=_[_0xbcec('0x32')](_0x20e673[_0xbcec('0x2e')],_0x20e673[_0xbcec('0x2f')]);_0x5a521b[_0xbcec('0x33')]=_[_0xbcec('0x32')](_0x20e673[_0xbcec('0x2e')],qs['fields'](_0x19a4ae[_0xbcec('0x2f')]['fields']));_0x5a521b[_0xbcec('0x33')]=_0x5a521b[_0xbcec('0x33')]['length']?_0x5a521b[_0xbcec('0x33')]:_0x20e673[_0xbcec('0x2e')];if(_0x19a4ae[_0xbcec('0x2f')][_0xbcec('0x3e')]){_0x5a521b['include']=[{'all':!![]}];}_0x5a521b=_[_0xbcec('0x3c')]({},_0x5a521b,_0x19a4ae[_0xbcec('0x3d')]);return db['SalesforceField'][_0xbcec('0x44')](_0x5a521b)[_0xbcec('0x22')](handleEntityNotFound(_0x4a2f96,null))['then'](respondWithResult(_0x4a2f96,null))['catch'](handleError(_0x4a2f96,null));};exports[_0xbcec('0x45')]=function(_0x110181,_0xd218ce){return db[_0xbcec('0x29')][_0xbcec('0x45')](_0x110181[_0xbcec('0x46')],{})[_0xbcec('0x22')](respondWithResult(_0xd218ce,0xc9))[_0xbcec('0x41')](handleError(_0xd218ce,null));};exports[_0xbcec('0x47')]=function(_0x13ea8d,_0x16f5d6){if(_0x13ea8d[_0xbcec('0x46')]['id']){delete _0x13ea8d[_0xbcec('0x46')]['id'];}return db[_0xbcec('0x29')]['find']({'where':{'id':_0x13ea8d[_0xbcec('0x43')]['id']}})[_0xbcec('0x22')](handleEntityNotFound(_0x16f5d6,null))[_0xbcec('0x22')](saveUpdates(_0x13ea8d['body'],null))['then'](respondWithResult(_0x16f5d6,null))[_0xbcec('0x41')](handleError(_0x16f5d6,null));};exports['destroy']=function(_0xf154db,_0x588ed8){return db[_0xbcec('0x29')][_0xbcec('0x44')]({'where':{'id':_0xf154db[_0xbcec('0x43')]['id']}})[_0xbcec('0x22')](handleEntityNotFound(_0x588ed8,null))['then'](removeEntity(_0x588ed8,null))[_0xbcec('0x41')](handleError(_0x588ed8,null));}; \ No newline at end of file +var _0xd367=['include','SalesforceField','findAll','rows','catch','show','params','rawAttributes','find','create','body','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','end','error','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd367,0x1e7));var _0x7d36=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd367[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d36('0x0'));var jsonpatch=require(_0x7d36('0x1'));var rp=require(_0x7d36('0x2'));var moment=require('moment');var BPromise=require(_0x7d36('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d36('0x4'));var sox=require(_0x7d36('0x5'));var csv=require(_0x7d36('0x6'));var ejs=require(_0x7d36('0x7'));var fs=require('fs');var _=require(_0x7d36('0x8'));var squel=require(_0x7d36('0x9'));var crypto=require(_0x7d36('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7d36('0xb'));var toCsv=require(_0x7d36('0x6'));var querystring=require(_0x7d36('0xc'));var Papa=require(_0x7d36('0xd'));var Redis=require('ioredis');var authService=require(_0x7d36('0xe'));var qs=require(_0x7d36('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d36('0x10'))(_0x7d36('0x11'));var utils=require(_0x7d36('0x12'));var config=require('../../config/environment');var db=require(_0x7d36('0x13'))['db'];function respondWithStatusCode(_0x2f8d3e,_0x22bdef){_0x22bdef=_0x22bdef||0xcc;return function(_0x422270){if(_0x422270){return _0x2f8d3e[_0x7d36('0x14')](_0x22bdef);}return _0x2f8d3e[_0x7d36('0x15')](_0x22bdef)['end']();};}function respondWithResult(_0x2b6a8a,_0x2a40a8){_0x2a40a8=_0x2a40a8||0xc8;return function(_0x582ec7){if(_0x582ec7){return _0x2b6a8a[_0x7d36('0x15')](_0x2a40a8)[_0x7d36('0x16')](_0x582ec7);}};}function respondWithFilteredResult(_0x42d34b,_0x1ede12){return function(_0x2be224){if(_0x2be224){var _0x30ef64=_0x2be224[_0x7d36('0x17')],_0x57f603=_0x1ede12[_0x7d36('0x18')],_0x46d8d4=_0x1ede12[_0x7d36('0x18')]+_0x1ede12[_0x7d36('0x19')],_0xfe465a;if(_0x46d8d4>=_0x30ef64){_0x46d8d4=_0x30ef64;_0xfe465a=0xc8;}else{_0xfe465a=0xce;}_0x42d34b[_0x7d36('0x15')](_0xfe465a);return _0x42d34b['set']('Content-Range',_0x57f603+'-'+_0x46d8d4+'/'+_0x30ef64)['json'](_0x2be224);}return null;};}function patchUpdates(_0x1cb20c){return function(_0x4dc560){try{jsonpatch[_0x7d36('0x1a')](_0x4dc560,_0x1cb20c,!![]);}catch(_0xf47ae2){return BPromise[_0x7d36('0x1b')](_0xf47ae2);}return _0x4dc560[_0x7d36('0x1c')]();};}function saveUpdates(_0x4521cf,_0x391f22){return function(_0x4d9732){if(_0x4d9732){return _0x4d9732[_0x7d36('0x1d')](_0x4521cf)[_0x7d36('0x1e')](function(_0x5e57e3){return _0x5e57e3;});}return null;};}function removeEntity(_0x20e136,_0x329a33){return function(_0x468a8f){if(_0x468a8f){return _0x468a8f[_0x7d36('0x1f')]()[_0x7d36('0x1e')](function(){_0x20e136[_0x7d36('0x15')](0xcc)[_0x7d36('0x20')]();});}};}function handleEntityNotFound(_0x4869c5,_0x64a084){return function(_0x2e156b){if(!_0x2e156b){_0x4869c5[_0x7d36('0x14')](0x194);}return _0x2e156b;};}function handleError(_0x55c835,_0x1ee921){_0x1ee921=_0x1ee921||0x1f4;return function(_0x3c381f){logger[_0x7d36('0x21')](_0x3c381f['stack']);if(_0x3c381f[_0x7d36('0x22')]){delete _0x3c381f[_0x7d36('0x22')];}_0x55c835[_0x7d36('0x15')](_0x1ee921)[_0x7d36('0x23')](_0x3c381f);};}exports[_0x7d36('0x24')]=function(_0x74bf49,_0x2d4d4f){var _0x24e0ac={},_0xb92721={},_0x346d83={'count':0x0,'rows':[]};var _0x33071b=_['map'](db['SalesforceField']['rawAttributes'],function(_0x29e757){return{'name':_0x29e757[_0x7d36('0x25')],'type':_0x29e757['type'][_0x7d36('0x26')]};});_0xb92721[_0x7d36('0x27')]=_[_0x7d36('0x28')](_0x33071b,_0x7d36('0x22'));_0xb92721[_0x7d36('0x29')]=_[_0x7d36('0x2a')](_0x74bf49[_0x7d36('0x29')]);_0xb92721[_0x7d36('0x2b')]=_[_0x7d36('0x2c')](_0xb92721[_0x7d36('0x27')],_0xb92721[_0x7d36('0x29')]);_0x24e0ac[_0x7d36('0x2d')]=_[_0x7d36('0x2c')](_0xb92721['model'],qs[_0x7d36('0x2e')](_0x74bf49[_0x7d36('0x29')]['fields']));_0x24e0ac['attributes']=_0x24e0ac['attributes'][_0x7d36('0x2f')]?_0x24e0ac[_0x7d36('0x2d')]:_0xb92721['model'];if(!_0x74bf49[_0x7d36('0x29')]['hasOwnProperty']('nolimit')){_0x24e0ac[_0x7d36('0x19')]=qs['limit'](_0x74bf49[_0x7d36('0x29')][_0x7d36('0x19')]);_0x24e0ac[_0x7d36('0x18')]=qs[_0x7d36('0x18')](_0x74bf49[_0x7d36('0x29')][_0x7d36('0x18')]);}_0x24e0ac[_0x7d36('0x30')]=qs[_0x7d36('0x31')](_0x74bf49[_0x7d36('0x29')][_0x7d36('0x31')]);_0x24e0ac[_0x7d36('0x32')]=qs[_0x7d36('0x2b')](_['pick'](_0x74bf49[_0x7d36('0x29')],_0xb92721[_0x7d36('0x2b')]),_0x33071b);if(_0x74bf49[_0x7d36('0x29')][_0x7d36('0x33')]){_0x24e0ac['where']=_['merge'](_0x24e0ac['where'],{'$or':_['map'](_0x33071b,function(_0x4bdf13){if(_0x4bdf13[_0x7d36('0x34')]!==_0x7d36('0x35')){var _0x24579a={};_0x24579a[_0x4bdf13[_0x7d36('0x22')]]={'$like':'%'+_0x74bf49[_0x7d36('0x29')][_0x7d36('0x33')]+'%'};return _0x24579a;}})});}_0x24e0ac=_[_0x7d36('0x36')]({},_0x24e0ac,_0x74bf49[_0x7d36('0x37')]);var _0x21a56a={'where':_0x24e0ac['where']};return db['SalesforceField'][_0x7d36('0x17')](_0x21a56a)[_0x7d36('0x1e')](function(_0x3225db){_0x346d83[_0x7d36('0x17')]=_0x3225db;if(_0x74bf49['query'][_0x7d36('0x38')]){_0x24e0ac[_0x7d36('0x39')]=[{'all':!![]}];}return db[_0x7d36('0x3a')][_0x7d36('0x3b')](_0x24e0ac);})[_0x7d36('0x1e')](function(_0x46b809){_0x346d83[_0x7d36('0x3c')]=_0x46b809;return _0x346d83;})['then'](respondWithFilteredResult(_0x2d4d4f,_0x24e0ac))[_0x7d36('0x3d')](handleError(_0x2d4d4f,null));};exports[_0x7d36('0x3e')]=function(_0x46666a,_0x422803){var _0x5099f7={'raw':!![],'where':{'id':_0x46666a[_0x7d36('0x3f')]['id']}},_0x532add={};_0x532add['model']=_[_0x7d36('0x2a')](db[_0x7d36('0x3a')][_0x7d36('0x40')]);_0x532add['query']=_[_0x7d36('0x2a')](_0x46666a['query']);_0x532add[_0x7d36('0x2b')]=_[_0x7d36('0x2c')](_0x532add[_0x7d36('0x27')],_0x532add['query']);_0x5099f7['attributes']=_[_0x7d36('0x2c')](_0x532add[_0x7d36('0x27')],qs[_0x7d36('0x2e')](_0x46666a[_0x7d36('0x29')]['fields']));_0x5099f7[_0x7d36('0x2d')]=_0x5099f7[_0x7d36('0x2d')][_0x7d36('0x2f')]?_0x5099f7['attributes']:_0x532add[_0x7d36('0x27')];if(_0x46666a['query']['includeAll']){_0x5099f7['include']=[{'all':!![]}];}_0x5099f7=_['merge']({},_0x5099f7,_0x46666a[_0x7d36('0x37')]);return db[_0x7d36('0x3a')][_0x7d36('0x41')](_0x5099f7)[_0x7d36('0x1e')](handleEntityNotFound(_0x422803,null))[_0x7d36('0x1e')](respondWithResult(_0x422803,null))['catch'](handleError(_0x422803,null));};exports[_0x7d36('0x42')]=function(_0x595da4,_0x1e3548){return db[_0x7d36('0x3a')][_0x7d36('0x42')](_0x595da4[_0x7d36('0x43')],{})['then'](respondWithResult(_0x1e3548,0xc9))['catch'](handleError(_0x1e3548,null));};exports['update']=function(_0x33a26c,_0x599faf){if(_0x33a26c[_0x7d36('0x43')]['id']){delete _0x33a26c[_0x7d36('0x43')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x33a26c[_0x7d36('0x3f')]['id']}})[_0x7d36('0x1e')](handleEntityNotFound(_0x599faf,null))[_0x7d36('0x1e')](saveUpdates(_0x33a26c[_0x7d36('0x43')],null))[_0x7d36('0x1e')](respondWithResult(_0x599faf,null))[_0x7d36('0x3d')](handleError(_0x599faf,null));};exports['destroy']=function(_0x8799e1,_0x487970){return db[_0x7d36('0x3a')][_0x7d36('0x41')]({'where':{'id':_0x8799e1['params']['id']}})[_0x7d36('0x1e')](handleEntityNotFound(_0x487970,null))[_0x7d36('0x1e')](removeEntity(_0x487970,null))['catch'](handleError(_0x487970,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 004cdf4..8679990 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 _0xf4af=['idField','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf4af,0x1de));var _0xff4a=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0xf4af[_0x102376];return _0x29bc9c;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))(_0xff4a('0x2'));var moment=require(_0xff4a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff4a('0x4'));var rimraf=require(_0xff4a('0x5'));var config=require(_0xff4a('0x6'));var attributes=require(_0xff4a('0x7'));module[_0xff4a('0x8')]=function(_0x50666c,_0x2dac12){return _0x50666c[_0xff4a('0x9')](_0xff4a('0xa'),attributes,{'tableName':_0xff4a('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xff4a('0xc'),_0xff4a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf789=['path','../../config/environment','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf789,0x1c2));var _0x9f78=function(_0x8f1729,_0x36591f){_0x8f1729=_0x8f1729-0x0;var _0x5a8d83=_0xf789[_0x8f1729];return _0x5a8d83;};'use strict';var _=require(_0x9f78('0x0'));var util=require('util');var logger=require(_0x9f78('0x1'))(_0x9f78('0x2'));var moment=require('moment');var BPromise=require(_0x9f78('0x3'));var rp=require(_0x9f78('0x4'));var fs=require('fs');var path=require(_0x9f78('0x5'));var rimraf=require('rimraf');var config=require(_0x9f78('0x6'));var attributes=require(_0x9f78('0x7'));module[_0x9f78('0x8')]=function(_0x3137a0,_0x5ca941){return _0x3137a0[_0x9f78('0x9')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x9f78('0xa'),'fields':[_0x9f78('0xb'),_0x9f78('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index b35c541..bedb818 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 _0x0713=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x13b506,_0xd8922e){var _0x402b22=function(_0x3c9c20){while(--_0x3c9c20){_0x13b506['push'](_0x13b506['shift']());}};_0x402b22(++_0xd8922e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c00,0x17e));var _0x05c0=function(_0xe525c9,_0x5c612d){_0xe525c9=_0xe525c9-0x0;var _0x5dc0d9=_0x5c00[_0xe525c9];return _0x5dc0d9;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index d5090ed..2050c2e 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 _0xf350=['getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','/:id','isAuthenticated','/:id/fields'];(function(_0x332581,_0x11feb6){var _0x3674ff=function(_0x354b74){while(--_0x354b74){_0x332581['push'](_0x332581['shift']());}};_0x3674ff(++_0x11feb6);}(_0xf350,0x105));var _0x0f35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf350[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x0f35('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0f35('0x1'));var express=require(_0x0f35('0x2'));var router=express[_0x0f35('0x3')]();var auth=require(_0x0f35('0x4'));var interaction=require(_0x0f35('0x5'));var config=require(_0x0f35('0x6'));var controller=require(_0x0f35('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0f35('0x8')](_0x0f35('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0f35('0x8')]('/:id/configurations',auth[_0x0f35('0xa')](),controller['getConfigurations']);router[_0x0f35('0x8')](_0x0f35('0xb'),auth[_0x0f35('0xa')](),controller[_0x0f35('0xc')]);router[_0x0f35('0xd')]('/',auth[_0x0f35('0xa')](),controller[_0x0f35('0xe')]);router[_0x0f35('0xd')](_0x0f35('0xf'),auth['isAuthenticated'](),controller[_0x0f35('0x10')]);router[_0x0f35('0x11')]('/:id',auth[_0x0f35('0xa')](),controller['update']);router[_0x0f35('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0f35('0x13')]);module[_0x0f35('0x14')]=router; \ No newline at end of file +var _0xbc9d=['addConfiguration','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','/:id/configurations','/:id/fields','getFields','post'];(function(_0x41398a,_0x3f0c92){var _0x54da5e=function(_0x2648fc){while(--_0x2648fc){_0x41398a['push'](_0x41398a['shift']());}};_0x54da5e(++_0x3f0c92);}(_0xbc9d,0xcc));var _0xdbc9=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xbc9d[_0x4ec3ab];return _0x229613;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require('express');var router=express[_0xdbc9('0x4')]();var auth=require(_0xdbc9('0x5'));var interaction=require(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var controller=require(_0xdbc9('0x8'));router['get']('/',auth[_0xdbc9('0x9')](),controller['index']);router[_0xdbc9('0xa')](_0xdbc9('0xb'),auth[_0xdbc9('0x9')](),controller['show']);router[_0xdbc9('0xa')](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller['getConfigurations']);router[_0xdbc9('0xa')](_0xdbc9('0xd'),auth['isAuthenticated'](),controller[_0xdbc9('0xe')]);router['post']('/',auth[_0xdbc9('0x9')](),controller['create']);router[_0xdbc9('0xf')](_0xdbc9('0xc'),auth['isAuthenticated'](),controller[_0xdbc9('0x10')]);router[_0xdbc9('0x11')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x12')]);router['delete'](_0xdbc9('0xb'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x13')]);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 8de9577..de11a08 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 _0x0bc6=['STRING','remoteUri','sequelize','exports'];(function(_0x3a2a78,_0x56c496){var _0x21fb7f=function(_0x1b7cfd){while(--_0x1b7cfd){_0x3a2a78['push'](_0x3a2a78['shift']());}};_0x21fb7f(++_0x56c496);}(_0x0bc6,0x10a));var _0x60bc=function(_0x41c10a,_0x402241){_0x41c10a=_0x41c10a-0x0;var _0x45ce43=_0x0bc6[_0x41c10a];return _0x45ce43;};'use strict';var Sequelize=require(_0x60bc('0x0'));module[_0x60bc('0x1')]={'name':{'type':Sequelize[_0x60bc('0x2')]},'description':{'type':Sequelize[_0x60bc('0x2')]},'username':{'type':Sequelize[_0x60bc('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x60bc('0x2')]},'email':{'type':Sequelize[_0x60bc('0x2')]},'remoteUri':{'type':Sequelize[_0x60bc('0x2')],'unique':_0x60bc('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x813f=['STRING','username','remoteUri','exports'];(function(_0x2b765d,_0x24c08d){var _0x274804=function(_0x2babd8){while(--_0x2babd8){_0x2b765d['push'](_0x2b765d['shift']());}};_0x274804(++_0x24c08d);}(_0x813f,0x16b));var _0xf813=function(_0x5c1b91,_0x26e26b){_0x5c1b91=_0x5c1b91-0x0;var _0x5c62e9=_0x813f[_0x5c1b91];return _0x5c62e9;};'use strict';var Sequelize=require('sequelize');module[_0xf813('0x0')]={'name':{'type':Sequelize[_0xf813('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf813('0x1')],'unique':_0xf813('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf813('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf813('0x3')},'serverUrl':{'type':Sequelize[_0xf813('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 594b9e5..6e26e43 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 _0x0e60=['upon_approval','correlation_id','location','password','email','remoteUri','serverUrl','substring','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','log','remove','forEach','internalType','label','push','all','assign','includes','ServiceNow\x20error:\x20','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','filters','attributes','intersection','query','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ServicenowField','Descriptions','hold_reason','knowledge','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','impact','work_notes_list','sys_domain_path','time_worked','expected_start','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation'];(function(_0x56846d,_0x33e88f){var _0x3d680e=function(_0x1f6a92){while(--_0x1f6a92){_0x56846d['push'](_0x56846d['shift']());}};_0x3d680e(++_0x33e88f);}(_0x0e60,0x1ab));var _0x00e6=function(_0x57a848,_0x249d4e){_0x57a848=_0x57a848-0x0;var _0x20a189=_0x0e60[_0x57a848];return _0x20a189;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x00e6('0x0'));var rimraf=require(_0x00e6('0x1'));var zipdir=require(_0x00e6('0x2'));var jsonpatch=require(_0x00e6('0x3'));var rp=require(_0x00e6('0x4'));var moment=require(_0x00e6('0x5'));var BPromise=require(_0x00e6('0x6'));var Mustache=require(_0x00e6('0x7'));var util=require(_0x00e6('0x8'));var path=require(_0x00e6('0x9'));var sox=require(_0x00e6('0xa'));var csv=require(_0x00e6('0xb'));var ejs=require(_0x00e6('0xc'));var fs=require('fs');var _=require(_0x00e6('0xd'));var squel=require(_0x00e6('0xe'));var crypto=require(_0x00e6('0xf'));var jsforce=require(_0x00e6('0x10'));var deskjs=require(_0x00e6('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x00e6('0x12'));var Redis=require(_0x00e6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x00e6('0x14'));var as=require(_0x00e6('0x15'));var hardwareService=require(_0x00e6('0x16'));var logger=require(_0x00e6('0x17'))(_0x00e6('0x18'));var utils=require('../../config/utils');var config=require(_0x00e6('0x19'));var db=require(_0x00e6('0x1a'))['db'];var integrations=require(_0x00e6('0x1b'));var jayson=require(_0x00e6('0x1c'));var client=jayson[_0x00e6('0x1d')][_0x00e6('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x4ae529,_0x130d76,_0x28a8f4){if(_0x28a8f4){var _0x486737=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x486737['test'](_0x130d76)){return _0x4ae529;}else{throw new db[(_0x00e6('0x1f'))][(_0x00e6('0x20'))](_0x00e6('0x21'));}}else{return _0x4ae529;}}function respondWithRpcPromise(_0x2a167f,_0x313ebb,_0x47888c,_0x40121d){return new BPromise(function(_0xf01d78,_0x4fd713){var _0x2526d7=_0x40121d||client;return _0x2526d7[_0x00e6('0x22')](_0x2a167f,_0x47888c)[_0x00e6('0x23')](function(_0x5488f2){logger[_0x00e6('0x24')](_0x00e6('0x25'),_0x313ebb,_0x00e6('0x26'));logger['debug'](_0x00e6('0x27'),_0x313ebb,_0x00e6('0x26'),JSON[_0x00e6('0x28')](_0x5488f2));if(_0x5488f2[_0x00e6('0x29')]){if(_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2a')]===0x1f4){logger[_0x00e6('0x29')](_0x00e6('0x25'),_0x313ebb,_0x5488f2[_0x00e6('0x29')]['message']);return _0x4fd713(_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2b')]);}logger['error'](_0x00e6('0x25'),_0x313ebb,_0x5488f2[_0x00e6('0x29')][_0x00e6('0x2b')]);return _0xf01d78(_0x5488f2[_0x00e6('0x29')]['message']);}else{logger[_0x00e6('0x24')](_0x00e6('0x25'),_0x313ebb,_0x00e6('0x26'));_0xf01d78(_0x5488f2[_0x00e6('0x2c')]['message']);}})['catch'](function(_0x3a77cf){logger[_0x00e6('0x29')](_0x00e6('0x25'),_0x313ebb,_0x3a77cf);_0x4fd713(_0x3a77cf);});});}function respondWithStatusCode(_0x4fca85,_0x4d7d23){_0x4d7d23=_0x4d7d23||0xcc;return function(_0xa7d48a){if(_0xa7d48a){return _0x4fca85[_0x00e6('0x2d')](_0x4d7d23);}return _0x4fca85[_0x00e6('0x2e')](_0x4d7d23)[_0x00e6('0x2f')]();};}function respondWithResult(_0x44c706,_0x392b01){_0x392b01=_0x392b01||0xc8;return function(_0x1311ed){if(_0x1311ed){return _0x44c706[_0x00e6('0x2e')](_0x392b01)[_0x00e6('0x30')](_0x1311ed);}};}function respondWithFilteredResult(_0x1b9a72,_0x1565e7){return function(_0x56aa02){if(_0x56aa02){var _0x5af742=_0x56aa02['count'],_0x2fd9f3=_0x1565e7[_0x00e6('0x31')],_0x5eaf04=_0x1565e7[_0x00e6('0x31')]+_0x1565e7[_0x00e6('0x32')],_0x57e447;if(_0x5eaf04>=_0x5af742){_0x5eaf04=_0x5af742;_0x57e447=0xc8;}else{_0x57e447=0xce;}_0x1b9a72[_0x00e6('0x2e')](_0x57e447);return _0x1b9a72[_0x00e6('0x33')]('Content-Range',_0x2fd9f3+'-'+_0x5eaf04+'/'+_0x5af742)[_0x00e6('0x30')](_0x56aa02);}return null;};}function patchUpdates(_0x14dff5){return function(_0x2c9eb0){try{jsonpatch[_0x00e6('0x34')](_0x2c9eb0,_0x14dff5,!![]);}catch(_0x311af8){return BPromise[_0x00e6('0x35')](_0x311af8);}return _0x2c9eb0[_0x00e6('0x36')]();};}function saveUpdates(_0x52ef63,_0x150218){return function(_0x23d416){if(_0x23d416){return _0x23d416[_0x00e6('0x37')](_0x52ef63)[_0x00e6('0x23')](function(_0x5a12d4){return _0x5a12d4;});}return null;};}function removeEntity(_0x5ac8e5,_0x21c66e){return function(_0x3fe140){if(_0x3fe140){return _0x3fe140[_0x00e6('0x38')]()[_0x00e6('0x23')](function(){_0x5ac8e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdcd3,_0x3cc087){return function(_0x5bac49){if(!_0x5bac49){_0x4fdcd3['sendStatus'](0x194);}return _0x5bac49;};}function handleError(_0x4c1e3b,_0x552630){_0x552630=_0x552630||0x1f4;return function(_0x2f5b76){logger[_0x00e6('0x29')](_0x2f5b76[_0x00e6('0x39')]);if(_0x2f5b76[_0x00e6('0x3a')]){delete _0x2f5b76['name'];}_0x4c1e3b['status'](_0x552630)['send'](_0x2f5b76);};}exports['index']=function(_0x1aebf7,_0x1a5ac0){var _0x2920eb={},_0x1564da={},_0x1dc155={'count':0x0,'rows':[]};var _0x4d0d9a=_['map'](db[_0x00e6('0x3b')][_0x00e6('0x3c')],function(_0x451e8c){return{'name':_0x451e8c[_0x00e6('0x3d')],'type':_0x451e8c[_0x00e6('0x3e')][_0x00e6('0x3f')]};});_0x1564da[_0x00e6('0x40')]=_[_0x00e6('0x41')](_0x4d0d9a,_0x00e6('0x3a'));_0x1564da['query']=_['keys'](_0x1aebf7['query']);_0x1564da[_0x00e6('0x42')]=_['intersection'](_0x1564da[_0x00e6('0x40')],_0x1564da['query']);_0x2920eb[_0x00e6('0x43')]=_[_0x00e6('0x44')](_0x1564da[_0x00e6('0x40')],qs['fields'](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x46')]));_0x2920eb[_0x00e6('0x43')]=_0x2920eb[_0x00e6('0x43')]['length']?_0x2920eb['attributes']:_0x1564da['model'];if(!_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x47')](_0x00e6('0x48'))){_0x2920eb[_0x00e6('0x32')]=qs[_0x00e6('0x32')](_0x1aebf7['query']['limit']);_0x2920eb[_0x00e6('0x31')]=qs['offset'](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x31')]);}_0x2920eb['order']=qs[_0x00e6('0x49')](_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x49')]);_0x2920eb['where']=qs[_0x00e6('0x42')](_[_0x00e6('0x4a')](_0x1aebf7[_0x00e6('0x45')],_0x1564da[_0x00e6('0x42')]),_0x4d0d9a);if(_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x4b')]){_0x2920eb[_0x00e6('0x4c')]=_[_0x00e6('0x4d')](_0x2920eb[_0x00e6('0x4c')],{'$or':_['map'](_0x4d0d9a,function(_0x377e0a){if(_0x377e0a[_0x00e6('0x3e')]!==_0x00e6('0x4e')){var _0x1f93dc={};_0x1f93dc[_0x377e0a[_0x00e6('0x3a')]]={'$like':'%'+_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x4b')]+'%'};return _0x1f93dc;}})});}_0x2920eb=_['merge']({},_0x2920eb,_0x1aebf7[_0x00e6('0x4f')]);var _0x3e7b21={'where':_0x2920eb[_0x00e6('0x4c')]};return db[_0x00e6('0x3b')]['count'](_0x3e7b21)['then'](function(_0x1e7896){_0x1dc155['count']=_0x1e7896;if(_0x1aebf7[_0x00e6('0x45')][_0x00e6('0x50')]){_0x2920eb[_0x00e6('0x51')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x00e6('0x52')](_0x2920eb);})[_0x00e6('0x23')](function(_0x883dd3){_0x1dc155[_0x00e6('0x53')]=_0x883dd3;return _0x1dc155;})['then'](respondWithFilteredResult(_0x1a5ac0,_0x2920eb))[_0x00e6('0x54')](handleError(_0x1a5ac0,null));};exports['show']=function(_0x4ba55a,_0xc7e4a8){var _0x2d4a19={'raw':![],'where':{'id':_0x4ba55a[_0x00e6('0x55')]['id']}},_0x465317={};_0x465317[_0x00e6('0x40')]=_[_0x00e6('0x56')](db['ServicenowAccount'][_0x00e6('0x3c')]);_0x465317[_0x00e6('0x45')]=_[_0x00e6('0x56')](_0x4ba55a[_0x00e6('0x45')]);_0x465317[_0x00e6('0x42')]=_[_0x00e6('0x44')](_0x465317['model'],_0x465317[_0x00e6('0x45')]);_0x2d4a19['attributes']=_[_0x00e6('0x44')](_0x465317[_0x00e6('0x40')],qs['fields'](_0x4ba55a[_0x00e6('0x45')][_0x00e6('0x46')]));_0x2d4a19[_0x00e6('0x43')]=_0x2d4a19[_0x00e6('0x43')][_0x00e6('0x57')]?_0x2d4a19[_0x00e6('0x43')]:_0x465317['model'];if(_0x4ba55a[_0x00e6('0x45')][_0x00e6('0x50')]){_0x2d4a19[_0x00e6('0x51')]=[{'all':!![]}];}_0x2d4a19=_[_0x00e6('0x4d')]({},_0x2d4a19,_0x4ba55a['options']);return db[_0x00e6('0x3b')][_0x00e6('0x58')](_0x2d4a19)[_0x00e6('0x23')](handleEntityNotFound(_0xc7e4a8,null))['then'](respondWithResult(_0xc7e4a8,null))[_0x00e6('0x54')](handleError(_0xc7e4a8,null));};exports[_0x00e6('0x59')]=function(_0x5d225a,_0xb0a4a2){return db[_0x00e6('0x3b')][_0x00e6('0x59')](_0x5d225a[_0x00e6('0x5a')],{})[_0x00e6('0x23')](respondWithResult(_0xb0a4a2,0xc9))[_0x00e6('0x54')](handleError(_0xb0a4a2,null));};exports[_0x00e6('0x37')]=function(_0x26967d,_0x547f7b){if(_0x26967d[_0x00e6('0x5a')]['id']){delete _0x26967d[_0x00e6('0x5a')]['id'];}return db[_0x00e6('0x3b')][_0x00e6('0x58')]({'where':{'id':_0x26967d[_0x00e6('0x55')]['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x547f7b,null))[_0x00e6('0x23')](saveUpdates(_0x26967d[_0x00e6('0x5a')],null))[_0x00e6('0x23')](respondWithResult(_0x547f7b,null))[_0x00e6('0x54')](handleError(_0x547f7b,null));};exports[_0x00e6('0x38')]=function(_0x2cb896,_0x22b368){return db[_0x00e6('0x3b')][_0x00e6('0x58')]({'where':{'id':_0x2cb896['params']['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x22b368,null))[_0x00e6('0x23')](removeEntity(_0x22b368,null))[_0x00e6('0x54')](handleError(_0x22b368,null));};exports[_0x00e6('0x5b')]=function(_0x18afb9,_0x1a3100,_0xe71364){var _0x3edf3a={};var _0x254851={};var _0x5dfc02;var _0x388858;return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x18afb9[_0x00e6('0x55')]['id']}})[_0x00e6('0x23')](handleEntityNotFound(_0x1a3100,null))[_0x00e6('0x23')](function(_0xb205bd){if(_0xb205bd){_0x5dfc02=_0xb205bd;_0x254851['model']=_[_0x00e6('0x56')](db[_0x00e6('0x5d')][_0x00e6('0x3c')]);_0x254851['query']=_[_0x00e6('0x56')](_0x18afb9[_0x00e6('0x45')]);_0x254851['filters']=_[_0x00e6('0x44')](_0x254851[_0x00e6('0x40')],_0x254851[_0x00e6('0x45')]);_0x3edf3a[_0x00e6('0x43')]=_[_0x00e6('0x44')](_0x254851[_0x00e6('0x40')],qs[_0x00e6('0x46')](_0x18afb9['query'][_0x00e6('0x46')]));_0x3edf3a[_0x00e6('0x43')]=_0x3edf3a[_0x00e6('0x43')]['length']?_0x3edf3a[_0x00e6('0x43')]:_0x254851[_0x00e6('0x40')];_0x3edf3a[_0x00e6('0x5e')]=qs[_0x00e6('0x49')](_0x18afb9[_0x00e6('0x45')][_0x00e6('0x49')]);_0x3edf3a[_0x00e6('0x4c')]=qs[_0x00e6('0x42')](_[_0x00e6('0x4a')](_0x18afb9[_0x00e6('0x45')],_0x254851[_0x00e6('0x42')]));if(_0x18afb9[_0x00e6('0x45')][_0x00e6('0x4b')]){_0x3edf3a[_0x00e6('0x4c')]=_[_0x00e6('0x4d')](_0x3edf3a[_0x00e6('0x4c')],{'$or':_['map'](_0x3edf3a[_0x00e6('0x43')],function(_0x506bd1){var _0xce4381={};_0xce4381[_0x506bd1]={'$like':'%'+_0x18afb9[_0x00e6('0x45')][_0x00e6('0x4b')]+'%'};return _0xce4381;})});}_0x3edf3a=_[_0x00e6('0x4d')]({},_0x3edf3a,_0x18afb9['options']);return _0x5dfc02['getConfigurations'](_0x3edf3a);}})[_0x00e6('0x23')](function(_0x110bd2){if(_0x110bd2){_0x388858=_0x110bd2[_0x00e6('0x57')];if(!_0x18afb9[_0x00e6('0x45')][_0x00e6('0x47')]('nolimit')){_0x3edf3a[_0x00e6('0x32')]=qs[_0x00e6('0x32')](_0x18afb9[_0x00e6('0x45')][_0x00e6('0x32')]);_0x3edf3a[_0x00e6('0x31')]=qs['offset'](_0x18afb9['query']['offset']);}return _0x5dfc02[_0x00e6('0x5b')](_0x3edf3a);}})[_0x00e6('0x23')](function(_0x352cfa){if(_0x352cfa){return _0x352cfa?{'count':_0x388858,'rows':_0x352cfa}:null;}})[_0x00e6('0x23')](respondWithResult(_0x1a3100,null))[_0x00e6('0x54')](handleError(_0x1a3100,null));};exports[_0x00e6('0x5f')]=function(_0x408fae,_0x3e3d32,_0x5691b3){if(_0x408fae[_0x00e6('0x5a')]['id']){delete _0x408fae[_0x00e6('0x5a')]['id'];}return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x408fae['params']['id']}})['then'](handleEntityNotFound(_0x3e3d32,null))[_0x00e6('0x23')](function(_0x4664b1){if(_0x4664b1){_0x408fae[_0x00e6('0x5a')][_0x00e6('0x60')]=_0x4664b1['id'];_0x408fae[_0x00e6('0x5a')]['Subjects']=integrations[_0x00e6('0x61')](_0x408fae[_0x00e6('0x5a')][_0x00e6('0x62')],_0x408fae['body'][_0x00e6('0x3e')]);_0x408fae['body']['Descriptions']=integrations[_0x00e6('0x63')](_0x408fae[_0x00e6('0x5a')][_0x00e6('0x62')],_0x408fae[_0x00e6('0x5a')][_0x00e6('0x3e')]);return db[_0x00e6('0x5d')][_0x00e6('0x59')](_0x408fae[_0x00e6('0x5a')],{'include':[{'model':db[_0x00e6('0x64')],'as':'Subjects'},{'model':db[_0x00e6('0x64')],'as':_0x00e6('0x65')}]});}return null;})['then'](respondWithResult(_0x3e3d32,null))[_0x00e6('0x54')](handleError(_0x3e3d32,null));};exports['getFields']=function(_0x1c29cb,_0x27c7ad,_0x5200e2){var _0x115963=['made_sla',_0x00e6('0x66'),_0x00e6('0x67'),_0x00e6('0x68'),'close_code',_0x00e6('0x69'),_0x00e6('0x6a'),'severity',_0x00e6('0x6b')];var _0x203b6f=[_0x00e6('0x6c'),'made_sla',_0x00e6('0x6d'),_0x00e6('0x6e'),_0x00e6('0x6f'),_0x00e6('0x70'),_0x00e6('0x71'),_0x00e6('0x66'),_0x00e6('0x72'),_0x00e6('0x73'),_0x00e6('0x74'),_0x00e6('0x75'),'opened_by',_0x00e6('0x76'),_0x00e6('0x77'),_0x00e6('0x78'),_0x00e6('0x79'),'sys_created_by','knowledge',_0x00e6('0x5e'),_0x00e6('0x7a'),'closed_at',_0x00e6('0x7b'),_0x00e6('0x7c'),_0x00e6('0x7d'),'active',_0x00e6('0x7e'),'business_service','priority',_0x00e6('0x7f'),'rfc',_0x00e6('0x80'),_0x00e6('0x81'),'opened_at',_0x00e6('0x82'),'group_list',_0x00e6('0x83'),_0x00e6('0x84'),'resolved_at',_0x00e6('0x85'),_0x00e6('0x86'),_0x00e6('0x68'),_0x00e6('0x87'),_0x00e6('0x88'),_0x00e6('0x89'),_0x00e6('0x8a'),_0x00e6('0x8b'),_0x00e6('0x8c'),_0x00e6('0x8d'),'business_stc','additional_assignee_list',_0x00e6('0x8e'),_0x00e6('0x8f'),_0x00e6('0x69'),'sys_class_name',_0x00e6('0x90'),'closed_by',_0x00e6('0x91'),_0x00e6('0x92'),_0x00e6('0x93'),_0x00e6('0x94'),_0x00e6('0x95'),_0x00e6('0x6a'),_0x00e6('0x96'),'problem_id',_0x00e6('0x97'),_0x00e6('0x98'),_0x00e6('0x99'),_0x00e6('0x9a'),_0x00e6('0x9b'),_0x00e6('0x9c'),_0x00e6('0x9d'),_0x00e6('0x9e'),_0x00e6('0x9f'),'due_date',_0x00e6('0xa0'),_0x00e6('0xa1'),_0x00e6('0xa2'),_0x00e6('0xa3'),_0x00e6('0xa4'),_0x00e6('0xa5'),_0x00e6('0xa6'),_0x00e6('0x6b')];var _0x10ff42='';var _0xf7f3e7='';var _0x36a3c0=[];var _0x4b7f3e='';var _0x35172c='';var _0x17ab5b=[];var _0x4539ee='';var _0x4da64a='';var _0x3a658e={};var _0x486c7c='';return db[_0x00e6('0x3b')][_0x00e6('0x5c')]({'where':{'id':_0x1c29cb[_0x00e6('0x55')]['id']},'attributes':['id','username',_0x00e6('0xa7'),_0x00e6('0xa8'),_0x00e6('0xa9'),_0x00e6('0xaa')]})[_0x00e6('0x23')](handleEntityNotFound(_0x27c7ad,null))[_0x00e6('0x23')](function(_0x1aae36){if(_0x1aae36){_0x486c7c=_0x1aae36[_0x00e6('0xa9')];var _0x2e6460=_0x486c7c['slice'](-0x1);if(_0x2e6460==='/'){_0x486c7c=_0x486c7c[_0x00e6('0xab')](0x0,_0x486c7c[_0x00e6('0xac')](_0x2e6460));}_0x4da64a=util['format'](_0x00e6('0xad'),_0x486c7c);_0x4539ee=util['format'](_0x00e6('0xae'),_0x486c7c);_0x3a658e={'user':_0x1aae36[_0x00e6('0xaf')],'pass':_0x1aae36[_0x00e6('0xa7')]};var _0xf15e78={'method':_0x00e6('0xb0'),'uri':_0x4da64a+_0x00e6('0xb1'),'auth':_0x3a658e,'json':!![]};return rp(_0xf15e78);}})['then'](function(_0xaf17ad){if(_0xaf17ad[_0x00e6('0x2c')]['length']>0x0){_0x10ff42=_0xaf17ad[_0x00e6('0x2c')];}console[_0x00e6('0xb2')]('incident\x20table\x20objects',_0x10ff42);_0x17ab5b=[];_0xf7f3e7=Object['assign']([],_0x10ff42);_[_0x00e6('0xb3')](_0xf7f3e7,function(_0x27e239){return!_0x115963['includes'](_0x27e239[_0x00e6('0x3a')]);});_0xf7f3e7[_0x00e6('0xb4')](function(_0xaf43dd){var _0x26baef=createFieldObject(_0x4539ee,_0x3a658e,_0xaf43dd[_0x00e6('0xb5')],_0xaf43dd['name'],_0xaf43dd[_0x00e6('0xb6')],![]);_0x17ab5b[_0x00e6('0xb7')](_0x26baef);});return Promise[_0x00e6('0xb8')](_0x17ab5b);})['then'](function(_0xa85192){_0x36a3c0=_0xa85192;_0x4b7f3e=Object[_0x00e6('0xb9')]([],_0x10ff42);console[_0x00e6('0xb2')]('TCL:\x20_object',_0x10ff42);_[_0x00e6('0xb3')](_0x4b7f3e,function(_0x37c995){return _0x203b6f[_0x00e6('0xba')](_0x37c995['name']);});console[_0x00e6('0xb2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4b7f3e);_0x17ab5b=[];_0x4b7f3e[_0x00e6('0xb4')](function(_0x3791ae){var _0x463399=createFieldObject(_0x4539ee,_0x3a658e,_0x3791ae[_0x00e6('0xb5')],_0x3791ae['name'],_0x3791ae['label'],!![]);_0x17ab5b[_0x00e6('0xb7')](_0x463399);});return Promise[_0x00e6('0xb8')](_0x17ab5b);})[_0x00e6('0x23')](function(_0x160d40){_0x35172c=_0x160d40;var _0x1a9958=_0x36a3c0['concat'](_0x35172c);return{'count':_0x1a9958[_0x00e6('0x57')],'rows':_0x1a9958};})['then'](respondWithResult(_0x27c7ad,null))[_0x00e6('0x54')](function(_0x2ba848){console[_0x00e6('0xb2')](_0x00e6('0xbb')+_0x2ba848);var _0x317acf=_0x1c29cb[_0x00e6('0x45')][_0x00e6('0xbc')]?0x1f4:_0x2ba848['statusCode']||0x1f4;logger[_0x00e6('0x29')](_0x2ba848[_0x00e6('0x39')]);delete _0x2ba848[_0x00e6('0x3a')];if(_0x317acf===0x191){_0x317acf=0x190;}_0x27c7ad[_0x00e6('0x2e')](_0x317acf)['send'](_0x1c29cb[_0x00e6('0x45')][_0x00e6('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x2ba848[_0x00e6('0xbd')]}:_0x2ba848);});};function createFieldObject(_0x8f8dda,_0x42bf4d,_0x3545fe,_0x380f1c,_0x52fca8,_0x49e015){return new Promise(function(_0xe8cf97,_0x1c6c0b){var _0x4fb51e={'id':_0x380f1c,'name':_0x52fca8,'custom':_0x49e015};if(_0x3545fe===_0x00e6('0xbe')){_0x4fb51e[_0x00e6('0x4f')]=[{'name':_0x00e6('0xbf'),'value':'true'},{'name':_0x00e6('0xc0'),'value':_0x00e6('0xc1')}];_0xe8cf97(_0x4fb51e);}else{var _0xd568c0={'method':'GET','uri':_0x8f8dda+_0x00e6('0xc2')+_0x380f1c,'auth':_0x42bf4d,'json':!![]};return rp(_0xd568c0)[_0x00e6('0x23')](function(_0x307292){var _0x5db3ef=[];if(_0x307292['result'][_0x00e6('0x57')]>0x0){_0x307292[_0x00e6('0x2c')]['forEach'](function(_0x54cecb){if(_0x54cecb[_0x00e6('0xc3')]===_0x00e6('0xc1')){var _0x226011={'name':_0x54cecb['label'],'value':_0x54cecb[_0x00e6('0xc4')]};_0x5db3ef['push'](_0x226011);}});}_0x4fb51e[_0x00e6('0x4f')]=_0x5db3ef;if(_0x4fb51e[_0x00e6('0x4f')][_0x00e6('0x57')]>0x0){_0xe8cf97(_0x4fb51e);}else{if(_0x49e015==![]){_0xe8cf97();}else{_0xe8cf97(_0x4fb51e);}}});}});} \ No newline at end of file +var _0x7981=['keys','ServicenowAccount','includeAll','find','create','body','findOne','ServicenowConfiguration','rawAttributes','getConfigurations','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','close_code','notify','incident_state','severity','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority','sys_domain_path','opened_at','group_list','work_end','reopened_time','subcategory','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','correlation_id','category','username','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','log','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','status','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0x7981,0x132));var _0x1798=function(_0x2421d9,_0x2cb31b){_0x2421d9=_0x2421d9-0x0;var _0x4cb837=_0x7981[_0x2421d9];return _0x4cb837;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1798('0x0'));var jsonpatch=require(_0x1798('0x1'));var rp=require(_0x1798('0x2'));var moment=require(_0x1798('0x3'));var BPromise=require(_0x1798('0x4'));var Mustache=require(_0x1798('0x5'));var util=require(_0x1798('0x6'));var path=require(_0x1798('0x7'));var sox=require(_0x1798('0x8'));var csv=require(_0x1798('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1798('0xa'));var crypto=require(_0x1798('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1798('0x9'));var querystring=require(_0x1798('0xc'));var Papa=require('papaparse');var Redis=require(_0x1798('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1798('0xe'));var as=require(_0x1798('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1798('0x10'))(_0x1798('0x11'));var utils=require(_0x1798('0x12'));var config=require(_0x1798('0x13'));var db=require(_0x1798('0x14'))['db'];var integrations=require(_0x1798('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x1798('0x16')][_0x1798('0x17')]({'port':0x232a});function checkPasswordPattern(_0x58573d,_0x296cb0,_0x48001c){if(_0x48001c){var _0x1ff957=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ff957[_0x1798('0x18')](_0x296cb0)){return _0x58573d;}else{throw new db[(_0x1798('0x19'))]['ValidationError'](_0x1798('0x1a'));}}else{return _0x58573d;}}function respondWithRpcPromise(_0x41f6ca,_0x3d2b8b,_0x4348d6,_0x1335e9){return new BPromise(function(_0x4a9100,_0x10d5c2){var _0x4535ae=_0x1335e9||client;return _0x4535ae['request'](_0x41f6ca,_0x4348d6)[_0x1798('0x1b')](function(_0x3e659e){logger[_0x1798('0x1c')](_0x1798('0x1d'),_0x3d2b8b,'request\x20sent');logger[_0x1798('0x1e')](_0x1798('0x1f'),_0x3d2b8b,_0x1798('0x20'),JSON[_0x1798('0x21')](_0x3e659e));if(_0x3e659e['error']){if(_0x3e659e['error'][_0x1798('0x22')]===0x1f4){logger['error'](_0x1798('0x1d'),_0x3d2b8b,_0x3e659e[_0x1798('0x23')][_0x1798('0x24')]);return _0x10d5c2(_0x3e659e[_0x1798('0x23')][_0x1798('0x24')]);}logger[_0x1798('0x23')](_0x1798('0x1d'),_0x3d2b8b,_0x3e659e[_0x1798('0x23')][_0x1798('0x24')]);return _0x4a9100(_0x3e659e[_0x1798('0x23')][_0x1798('0x24')]);}else{logger[_0x1798('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x3d2b8b,_0x1798('0x20'));_0x4a9100(_0x3e659e[_0x1798('0x25')][_0x1798('0x24')]);}})[_0x1798('0x26')](function(_0x189389){logger['error'](_0x1798('0x1d'),_0x3d2b8b,_0x189389);_0x10d5c2(_0x189389);});});}function respondWithStatusCode(_0x3235eb,_0x2fefe0){_0x2fefe0=_0x2fefe0||0xcc;return function(_0x370f38){if(_0x370f38){return _0x3235eb[_0x1798('0x27')](_0x2fefe0);}return _0x3235eb['status'](_0x2fefe0)[_0x1798('0x28')]();};}function respondWithResult(_0x4777ec,_0x418c0b){_0x418c0b=_0x418c0b||0xc8;return function(_0x5554ac){if(_0x5554ac){return _0x4777ec['status'](_0x418c0b)[_0x1798('0x29')](_0x5554ac);}};}function respondWithFilteredResult(_0x5eb305,_0x21e5d6){return function(_0x151944){if(_0x151944){var _0x520387=_0x151944[_0x1798('0x2a')],_0x205414=_0x21e5d6[_0x1798('0x2b')],_0x4d50bb=_0x21e5d6[_0x1798('0x2b')]+_0x21e5d6[_0x1798('0x2c')],_0x2d82a0;if(_0x4d50bb>=_0x520387){_0x4d50bb=_0x520387;_0x2d82a0=0xc8;}else{_0x2d82a0=0xce;}_0x5eb305['status'](_0x2d82a0);return _0x5eb305[_0x1798('0x2d')](_0x1798('0x2e'),_0x205414+'-'+_0x4d50bb+'/'+_0x520387)[_0x1798('0x29')](_0x151944);}return null;};}function patchUpdates(_0x250523){return function(_0xc19b7f){try{jsonpatch[_0x1798('0x2f')](_0xc19b7f,_0x250523,!![]);}catch(_0x3223ea){return BPromise['reject'](_0x3223ea);}return _0xc19b7f[_0x1798('0x30')]();};}function saveUpdates(_0x426c1c,_0xa02788){return function(_0xf5dcd2){if(_0xf5dcd2){return _0xf5dcd2[_0x1798('0x31')](_0x426c1c)['then'](function(_0x2dc88b){return _0x2dc88b;});}return null;};}function removeEntity(_0x582e4e,_0x31e727){return function(_0x4a91a3){if(_0x4a91a3){return _0x4a91a3[_0x1798('0x32')]()[_0x1798('0x1b')](function(){_0x582e4e[_0x1798('0x33')](0xcc)[_0x1798('0x28')]();});}};}function handleEntityNotFound(_0x43aaad,_0x426a7a){return function(_0xb7abe2){if(!_0xb7abe2){_0x43aaad[_0x1798('0x27')](0x194);}return _0xb7abe2;};}function handleError(_0x27fc29,_0x25d645){_0x25d645=_0x25d645||0x1f4;return function(_0x4a4f02){logger[_0x1798('0x23')](_0x4a4f02[_0x1798('0x34')]);if(_0x4a4f02[_0x1798('0x35')]){delete _0x4a4f02[_0x1798('0x35')];}_0x27fc29[_0x1798('0x33')](_0x25d645)[_0x1798('0x36')](_0x4a4f02);};}exports[_0x1798('0x37')]=function(_0x4f35be,_0x142b4f){var _0x161f8f={},_0x12c541={},_0x4fd94c={'count':0x0,'rows':[]};var _0x479738=_[_0x1798('0x38')](db['ServicenowAccount']['rawAttributes'],function(_0xe24e81){return{'name':_0xe24e81[_0x1798('0x39')],'type':_0xe24e81[_0x1798('0x3a')][_0x1798('0x3b')]};});_0x12c541[_0x1798('0x3c')]=_['map'](_0x479738,_0x1798('0x35'));_0x12c541[_0x1798('0x3d')]=_['keys'](_0x4f35be[_0x1798('0x3d')]);_0x12c541[_0x1798('0x3e')]=_[_0x1798('0x3f')](_0x12c541['model'],_0x12c541[_0x1798('0x3d')]);_0x161f8f['attributes']=_['intersection'](_0x12c541[_0x1798('0x3c')],qs[_0x1798('0x40')](_0x4f35be[_0x1798('0x3d')][_0x1798('0x40')]));_0x161f8f[_0x1798('0x41')]=_0x161f8f['attributes'][_0x1798('0x42')]?_0x161f8f[_0x1798('0x41')]:_0x12c541[_0x1798('0x3c')];if(!_0x4f35be[_0x1798('0x3d')][_0x1798('0x43')](_0x1798('0x44'))){_0x161f8f[_0x1798('0x2c')]=qs['limit'](_0x4f35be[_0x1798('0x3d')][_0x1798('0x2c')]);_0x161f8f[_0x1798('0x2b')]=qs['offset'](_0x4f35be['query'][_0x1798('0x2b')]);}_0x161f8f[_0x1798('0x45')]=qs[_0x1798('0x46')](_0x4f35be[_0x1798('0x3d')]['sort']);_0x161f8f[_0x1798('0x47')]=qs['filters'](_[_0x1798('0x48')](_0x4f35be[_0x1798('0x3d')],_0x12c541[_0x1798('0x3e')]),_0x479738);if(_0x4f35be['query'][_0x1798('0x49')]){_0x161f8f['where']=_[_0x1798('0x4a')](_0x161f8f[_0x1798('0x47')],{'$or':_['map'](_0x479738,function(_0x32463f){if(_0x32463f[_0x1798('0x3a')]!==_0x1798('0x4b')){var _0x145297={};_0x145297[_0x32463f['name']]={'$like':'%'+_0x4f35be['query']['filter']+'%'};return _0x145297;}})});}_0x161f8f=_[_0x1798('0x4a')]({},_0x161f8f,_0x4f35be[_0x1798('0x4c')]);var _0x4b7b1f={'where':_0x161f8f[_0x1798('0x47')]};return db['ServicenowAccount'][_0x1798('0x2a')](_0x4b7b1f)[_0x1798('0x1b')](function(_0x53ce91){_0x4fd94c[_0x1798('0x2a')]=_0x53ce91;if(_0x4f35be[_0x1798('0x3d')]['includeAll']){_0x161f8f[_0x1798('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1798('0x4e')](_0x161f8f);})[_0x1798('0x1b')](function(_0x24984a){_0x4fd94c[_0x1798('0x4f')]=_0x24984a;return _0x4fd94c;})[_0x1798('0x1b')](respondWithFilteredResult(_0x142b4f,_0x161f8f))['catch'](handleError(_0x142b4f,null));};exports[_0x1798('0x50')]=function(_0x436576,_0x29ac45){var _0x23f556={'raw':![],'where':{'id':_0x436576[_0x1798('0x51')]['id']}},_0x15aa1c={};_0x15aa1c[_0x1798('0x3c')]=_[_0x1798('0x52')](db[_0x1798('0x53')]['rawAttributes']);_0x15aa1c[_0x1798('0x3d')]=_['keys'](_0x436576[_0x1798('0x3d')]);_0x15aa1c[_0x1798('0x3e')]=_['intersection'](_0x15aa1c['model'],_0x15aa1c[_0x1798('0x3d')]);_0x23f556[_0x1798('0x41')]=_['intersection'](_0x15aa1c[_0x1798('0x3c')],qs[_0x1798('0x40')](_0x436576[_0x1798('0x3d')][_0x1798('0x40')]));_0x23f556[_0x1798('0x41')]=_0x23f556[_0x1798('0x41')]['length']?_0x23f556[_0x1798('0x41')]:_0x15aa1c['model'];if(_0x436576[_0x1798('0x3d')][_0x1798('0x54')]){_0x23f556['include']=[{'all':!![]}];}_0x23f556=_[_0x1798('0x4a')]({},_0x23f556,_0x436576[_0x1798('0x4c')]);return db['ServicenowAccount'][_0x1798('0x55')](_0x23f556)['then'](handleEntityNotFound(_0x29ac45,null))[_0x1798('0x1b')](respondWithResult(_0x29ac45,null))[_0x1798('0x26')](handleError(_0x29ac45,null));};exports[_0x1798('0x56')]=function(_0x14cd11,_0x5eb40d){return db[_0x1798('0x53')]['create'](_0x14cd11['body'],{})['then'](respondWithResult(_0x5eb40d,0xc9))[_0x1798('0x26')](handleError(_0x5eb40d,null));};exports['update']=function(_0x3effeb,_0x115cef){if(_0x3effeb['body']['id']){delete _0x3effeb[_0x1798('0x57')]['id'];}return db[_0x1798('0x53')][_0x1798('0x55')]({'where':{'id':_0x3effeb[_0x1798('0x51')]['id']}})[_0x1798('0x1b')](handleEntityNotFound(_0x115cef,null))[_0x1798('0x1b')](saveUpdates(_0x3effeb[_0x1798('0x57')],null))[_0x1798('0x1b')](respondWithResult(_0x115cef,null))[_0x1798('0x26')](handleError(_0x115cef,null));};exports[_0x1798('0x32')]=function(_0xaac7d0,_0x494503){return db['ServicenowAccount']['find']({'where':{'id':_0xaac7d0[_0x1798('0x51')]['id']}})[_0x1798('0x1b')](handleEntityNotFound(_0x494503,null))[_0x1798('0x1b')](removeEntity(_0x494503,null))[_0x1798('0x26')](handleError(_0x494503,null));};exports['getConfigurations']=function(_0x39cb42,_0x96e6d3,_0x54a558){var _0x57ea1a={};var _0x934e75={};var _0x33644c;var _0x3d3133;return db['ServicenowAccount'][_0x1798('0x58')]({'where':{'id':_0x39cb42[_0x1798('0x51')]['id']}})[_0x1798('0x1b')](handleEntityNotFound(_0x96e6d3,null))[_0x1798('0x1b')](function(_0x39d30a){if(_0x39d30a){_0x33644c=_0x39d30a;_0x934e75[_0x1798('0x3c')]=_[_0x1798('0x52')](db[_0x1798('0x59')][_0x1798('0x5a')]);_0x934e75[_0x1798('0x3d')]=_['keys'](_0x39cb42[_0x1798('0x3d')]);_0x934e75[_0x1798('0x3e')]=_['intersection'](_0x934e75[_0x1798('0x3c')],_0x934e75['query']);_0x57ea1a['attributes']=_[_0x1798('0x3f')](_0x934e75[_0x1798('0x3c')],qs[_0x1798('0x40')](_0x39cb42[_0x1798('0x3d')][_0x1798('0x40')]));_0x57ea1a['attributes']=_0x57ea1a[_0x1798('0x41')]['length']?_0x57ea1a['attributes']:_0x934e75[_0x1798('0x3c')];_0x57ea1a[_0x1798('0x45')]=qs[_0x1798('0x46')](_0x39cb42[_0x1798('0x3d')]['sort']);_0x57ea1a[_0x1798('0x47')]=qs['filters'](_[_0x1798('0x48')](_0x39cb42[_0x1798('0x3d')],_0x934e75[_0x1798('0x3e')]));if(_0x39cb42['query'][_0x1798('0x49')]){_0x57ea1a[_0x1798('0x47')]=_[_0x1798('0x4a')](_0x57ea1a[_0x1798('0x47')],{'$or':_[_0x1798('0x38')](_0x57ea1a['attributes'],function(_0x4470f3){var _0x597a83={};_0x597a83[_0x4470f3]={'$like':'%'+_0x39cb42[_0x1798('0x3d')]['filter']+'%'};return _0x597a83;})});}_0x57ea1a=_[_0x1798('0x4a')]({},_0x57ea1a,_0x39cb42[_0x1798('0x4c')]);return _0x33644c[_0x1798('0x5b')](_0x57ea1a);}})[_0x1798('0x1b')](function(_0x2f2dd1){if(_0x2f2dd1){_0x3d3133=_0x2f2dd1[_0x1798('0x42')];if(!_0x39cb42[_0x1798('0x3d')]['hasOwnProperty']('nolimit')){_0x57ea1a[_0x1798('0x2c')]=qs[_0x1798('0x2c')](_0x39cb42[_0x1798('0x3d')]['limit']);_0x57ea1a[_0x1798('0x2b')]=qs['offset'](_0x39cb42[_0x1798('0x3d')][_0x1798('0x2b')]);}return _0x33644c[_0x1798('0x5b')](_0x57ea1a);}})['then'](function(_0x55a8d2){if(_0x55a8d2){return _0x55a8d2?{'count':_0x3d3133,'rows':_0x55a8d2}:null;}})[_0x1798('0x1b')](respondWithResult(_0x96e6d3,null))[_0x1798('0x26')](handleError(_0x96e6d3,null));};exports['addConfiguration']=function(_0x13842d,_0x13684c,_0x435cfa){if(_0x13842d[_0x1798('0x57')]['id']){delete _0x13842d[_0x1798('0x57')]['id'];}return db[_0x1798('0x53')][_0x1798('0x58')]({'where':{'id':_0x13842d[_0x1798('0x51')]['id']}})[_0x1798('0x1b')](handleEntityNotFound(_0x13684c,null))[_0x1798('0x1b')](function(_0xda9ed0){if(_0xda9ed0){_0x13842d['body'][_0x1798('0x5c')]=_0xda9ed0['id'];_0x13842d['body'][_0x1798('0x5d')]=integrations['getSubjects'](_0x13842d[_0x1798('0x57')][_0x1798('0x5e')],_0x13842d[_0x1798('0x57')][_0x1798('0x3a')]);_0x13842d[_0x1798('0x57')]['Descriptions']=integrations[_0x1798('0x5f')](_0x13842d[_0x1798('0x57')][_0x1798('0x5e')],_0x13842d[_0x1798('0x57')]['type']);return db[_0x1798('0x59')]['create'](_0x13842d[_0x1798('0x57')],{'include':[{'model':db['ServicenowField'],'as':_0x1798('0x5d')},{'model':db[_0x1798('0x60')],'as':_0x1798('0x61')}]});}return null;})[_0x1798('0x1b')](respondWithResult(_0x13684c,null))[_0x1798('0x26')](handleError(_0x13684c,null));};exports[_0x1798('0x62')]=function(_0x326ee8,_0x2e0d85,_0x3ecd06){var _0x3570ec=['made_sla',_0x1798('0x63'),'knowledge','subcategory',_0x1798('0x64'),_0x1798('0x65'),_0x1798('0x66'),_0x1798('0x67'),'category'];var _0x47b9c3=[_0x1798('0x68'),_0x1798('0x69'),_0x1798('0x6a'),'watch_list',_0x1798('0x6b'),_0x1798('0x6c'),_0x1798('0x6d'),'hold_reason',_0x1798('0x6e'),_0x1798('0x6f'),'resolved_by',_0x1798('0x70'),'opened_by',_0x1798('0x71'),_0x1798('0x72'),_0x1798('0x73'),_0x1798('0x74'),_0x1798('0x75'),_0x1798('0x76'),_0x1798('0x45'),_0x1798('0x77'),_0x1798('0x78'),'cmdb_ci','delivery_plan',_0x1798('0x79'),_0x1798('0x7a'),_0x1798('0x7b'),_0x1798('0x7c'),_0x1798('0x7d'),_0x1798('0x7e'),'rfc','time_worked','expected_start',_0x1798('0x7f'),'business_duration',_0x1798('0x80'),_0x1798('0x81'),_0x1798('0x82'),'resolved_at','caller_id','approval_set',_0x1798('0x83'),_0x1798('0x84'),_0x1798('0x85'),_0x1798('0x64'),_0x1798('0x86'),'delivery_task',_0x1798('0x87'),_0x1798('0x88'),_0x1798('0x89'),'additional_assignee_list','description',_0x1798('0x8a'),'notify',_0x1798('0x8b'),_0x1798('0x8c'),_0x1798('0x8d'),_0x1798('0x8e'),_0x1798('0x8f'),_0x1798('0x90'),_0x1798('0x91'),_0x1798('0x92'),_0x1798('0x66'),_0x1798('0x93'),_0x1798('0x94'),_0x1798('0x95'),'reassignment_count',_0x1798('0x96'),_0x1798('0x97'),_0x1798('0x67'),_0x1798('0x98'),_0x1798('0x99'),_0x1798('0x9a'),_0x1798('0x9b'),'due_date','sys_mod_count',_0x1798('0x9c'),_0x1798('0x9d'),_0x1798('0x9e'),_0x1798('0x9f'),_0x1798('0xa0'),'location',_0x1798('0xa1')];var _0x222fd0='';var _0x5ef039='';var _0x2af3c3=[];var _0x3aa471='';var _0x5703bc='';var _0x1dd354=[];var _0x4a94ab='';var _0x3e5f57='';var _0x3ce3b7={};var _0x166eb9='';return db[_0x1798('0x53')][_0x1798('0x58')]({'where':{'id':_0x326ee8[_0x1798('0x51')]['id']},'attributes':['id',_0x1798('0xa2'),'password',_0x1798('0xa3'),'remoteUri',_0x1798('0xa4')]})[_0x1798('0x1b')](handleEntityNotFound(_0x2e0d85,null))[_0x1798('0x1b')](function(_0x7ad51e){if(_0x7ad51e){_0x166eb9=_0x7ad51e[_0x1798('0xa5')];var _0x2bb36d=_0x166eb9[_0x1798('0xa6')](-0x1);if(_0x2bb36d==='/'){_0x166eb9=_0x166eb9[_0x1798('0xa7')](0x0,_0x166eb9[_0x1798('0xa8')](_0x2bb36d));}_0x3e5f57=util[_0x1798('0xa9')](_0x1798('0xaa'),_0x166eb9);_0x4a94ab=util['format'](_0x1798('0xab'),_0x166eb9);_0x3ce3b7={'user':_0x7ad51e['username'],'pass':_0x7ad51e['password']};var _0x3b05a6={'method':_0x1798('0xac'),'uri':_0x3e5f57+'incident?sysparm_display_value=all','auth':_0x3ce3b7,'json':!![]};return rp(_0x3b05a6);}})[_0x1798('0x1b')](function(_0x5b5920){if(_0x5b5920[_0x1798('0x25')][_0x1798('0x42')]>0x0){_0x222fd0=_0x5b5920[_0x1798('0x25')];}console[_0x1798('0xad')]('incident\x20table\x20objects',_0x222fd0);_0x1dd354=[];_0x5ef039=Object[_0x1798('0xae')]([],_0x222fd0);_[_0x1798('0xaf')](_0x5ef039,function(_0x9af5a1){return!_0x3570ec['includes'](_0x9af5a1[_0x1798('0x35')]);});_0x5ef039[_0x1798('0xb0')](function(_0x5bada9){var _0x15c8cf=createFieldObject(_0x4a94ab,_0x3ce3b7,_0x5bada9[_0x1798('0xb1')],_0x5bada9[_0x1798('0x35')],_0x5bada9[_0x1798('0xb2')],![]);_0x1dd354[_0x1798('0xb3')](_0x15c8cf);});return Promise[_0x1798('0xb4')](_0x1dd354);})[_0x1798('0x1b')](function(_0x29a060){_0x2af3c3=_0x29a060;_0x3aa471=Object[_0x1798('0xae')]([],_0x222fd0);console['log'](_0x1798('0xb5'),_0x222fd0);_[_0x1798('0xaf')](_0x3aa471,function(_0x4b8909){return _0x47b9c3[_0x1798('0xb6')](_0x4b8909[_0x1798('0x35')]);});console['log'](_0x1798('0xb7'),_0x3aa471);_0x1dd354=[];_0x3aa471[_0x1798('0xb0')](function(_0x953770){var _0x54ad3a=createFieldObject(_0x4a94ab,_0x3ce3b7,_0x953770[_0x1798('0xb1')],_0x953770[_0x1798('0x35')],_0x953770['label'],!![]);_0x1dd354[_0x1798('0xb3')](_0x54ad3a);});return Promise[_0x1798('0xb4')](_0x1dd354);})['then'](function(_0x9c1b22){_0x5703bc=_0x9c1b22;var _0x3dd2cb=_0x2af3c3['concat'](_0x5703bc);return{'count':_0x3dd2cb[_0x1798('0x42')],'rows':_0x3dd2cb};})[_0x1798('0x1b')](respondWithResult(_0x2e0d85,null))[_0x1798('0x26')](function(_0x39a44b){console[_0x1798('0xad')]('ServiceNow\x20error:\x20'+_0x39a44b);var _0x478fb7=_0x326ee8[_0x1798('0x3d')]['test']?0x1f4:_0x39a44b[_0x1798('0xb8')]||0x1f4;logger[_0x1798('0x23')](_0x39a44b['stack']);delete _0x39a44b[_0x1798('0x35')];if(_0x478fb7===0x191){_0x478fb7=0x190;}_0x2e0d85[_0x1798('0x33')](_0x478fb7)[_0x1798('0x36')](_0x326ee8['query'][_0x1798('0x18')]?{'message':_0x1798('0xb9'),'statusCode':_0x39a44b[_0x1798('0xb8')]}:_0x39a44b);});};function createFieldObject(_0xe2e72b,_0x4e7bd0,_0x1496d3,_0x51befe,_0x231e65,_0x3bb27c){return new Promise(function(_0x30f37f,_0x2467cd){var _0x513763={'id':_0x51befe,'name':_0x231e65,'custom':_0x3bb27c};if(_0x1496d3===_0x1798('0xba')){_0x513763['options']=[{'name':_0x1798('0xbb'),'value':_0x1798('0xbc')},{'name':_0x1798('0xbd'),'value':_0x1798('0xbe')}];_0x30f37f(_0x513763);}else{var _0x3e2878={'method':_0x1798('0xac'),'uri':_0xe2e72b+_0x1798('0xbf')+_0x51befe,'auth':_0x4e7bd0,'json':!![]};return rp(_0x3e2878)[_0x1798('0x1b')](function(_0x460c19){var _0x5ce397=[];if(_0x460c19['result']['length']>0x0){_0x460c19[_0x1798('0x25')][_0x1798('0xb0')](function(_0x2acb91){if(_0x2acb91[_0x1798('0xc0')]==='false'){var _0x1719cf={'name':_0x2acb91[_0x1798('0xb2')],'value':_0x2acb91[_0x1798('0xc1')]};_0x5ce397['push'](_0x1719cf);}});}_0x513763['options']=_0x5ce397;if(_0x513763[_0x1798('0x4c')][_0x1798('0x42')]>0x0){_0x30f37f(_0x513763);}else{if(_0x3bb27c==![]){_0x30f37f();}else{_0x30f37f(_0x513763);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 50d6bfb..551fd93 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 _0x0fd0=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x9bfe80,_0xb45f70){var _0x872eb0=function(_0x4586fe){while(--_0x4586fe){_0x9bfe80['push'](_0x9bfe80['shift']());}};_0x872eb0(++_0xb45f70);}(_0x0fd0,0x8f));var _0x00fd=function(_0x4ac391,_0xbd274b){_0x4ac391=_0x4ac391-0x0;var _0x281e74=_0x0fd0[_0x4ac391];return _0x281e74;};'use strict';var _=require(_0x00fd('0x0'));var util=require(_0x00fd('0x1'));var logger=require(_0x00fd('0x2'))(_0x00fd('0x3'));var moment=require(_0x00fd('0x4'));var BPromise=require(_0x00fd('0x5'));var rp=require(_0x00fd('0x6'));var fs=require('fs');var path=require(_0x00fd('0x7'));var rimraf=require('rimraf');var config=require(_0x00fd('0x8'));var attributes=require(_0x00fd('0x9'));var integrations=require(_0x00fd('0xa'));module[_0x00fd('0xb')]=function(_0x27f932,_0x30c2b9){return _0x27f932[_0x00fd('0xc')](_0x00fd('0xd'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x746e=['../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x746e,0x67));var _0xe746=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x746e[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0xe746('0x0'));var util=require(_0xe746('0x1'));var logger=require(_0xe746('0x2'))(_0xe746('0x3'));var moment=require(_0xe746('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe746('0x5'));var rimraf=require(_0xe746('0x6'));var config=require(_0xe746('0x7'));var attributes=require(_0xe746('0x8'));var integrations=require(_0xe746('0x9'));module[_0xe746('0xa')]=function(_0x3f57c0,_0x38fe6b){return _0x3f57c0[_0xe746('0xb')](_0xe746('0xc'),attributes,{'tableName':_0xe746('0xd'),'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 f61b982..8891798 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 _0x4466=['jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','ServicenowAccount','findAll','raw','options','where','limit','include','map','model','attributes','GetServicenowAccount','stringify','ShowServicenowAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32b30c,_0x4c5567){var _0x59bc79=function(_0x5ef43d){while(--_0x5ef43d){_0x32b30c['push'](_0x32b30c['shift']());}};_0x59bc79(++_0x4c5567);}(_0x4466,0xa3));var _0x6446=function(_0x523d5b,_0x1808f0){_0x523d5b=_0x523d5b-0x0;var _0x4d5b4c=_0x4466[_0x523d5b];return _0x4d5b4c;};'use strict';var _=require(_0x6446('0x0'));var util=require('util');var moment=require(_0x6446('0x1'));var BPromise=require('bluebird');var rs=require(_0x6446('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6446('0x3'))['db'];var utils=require(_0x6446('0x4'));var logger=require(_0x6446('0x5'))(_0x6446('0x6'));var config=require('../../config/environment');var jayson=require(_0x6446('0x7'));var client=jayson[_0x6446('0x8')][_0x6446('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x267d5a,_0x5c9195,_0x25b7ee){return new BPromise(function(_0x4da189,_0x1c1769){return client[_0x6446('0xa')](_0x267d5a,_0x25b7ee)[_0x6446('0xb')](function(_0x5dbf8c){logger[_0x6446('0xc')](_0x6446('0xd'),_0x5c9195,_0x6446('0xe'));logger[_0x6446('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5c9195,_0x6446('0xe'),JSON['stringify'](_0x5dbf8c));if(_0x5dbf8c[_0x6446('0x10')]){if(_0x5dbf8c['error'][_0x6446('0x11')]===0x1f4){logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);return _0x1c1769(_0x5dbf8c['error']['message']);}logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);return _0x4da189(_0x5dbf8c[_0x6446('0x10')][_0x6446('0x12')]);}else{logger['info'](_0x6446('0xd'),_0x5c9195,_0x6446('0xe'));_0x4da189(_0x5dbf8c['result'][_0x6446('0x12')]);}})[_0x6446('0x13')](function(_0x42e5fc){logger[_0x6446('0x10')](_0x6446('0xd'),_0x5c9195,_0x42e5fc);_0x1c1769(_0x42e5fc);});});}exports['GetServicenowAccount']=function(_0xc49166){var _0x30d36d=this;return new Promise(function(_0x103498,_0x3b8ba2){return db[_0x6446('0x14')][_0x6446('0x15')]({'raw':_0xc49166['options']?_0xc49166['options'][_0x6446('0x16')]===undefined?!![]:![]:!![],'where':_0xc49166['options']?_0xc49166[_0x6446('0x17')][_0x6446('0x18')]||null:null,'attributes':_0xc49166[_0x6446('0x17')]?_0xc49166['options']['attributes']||null:null,'limit':_0xc49166[_0x6446('0x17')]?_0xc49166['options'][_0x6446('0x19')]||null:null,'include':_0xc49166['options']?_0xc49166[_0x6446('0x17')][_0x6446('0x1a')]?_[_0x6446('0x1b')](_0xc49166[_0x6446('0x17')][_0x6446('0x1a')],function(_0x432529){return{'model':db[_0x432529[_0x6446('0x1c')]],'as':_0x432529['as'],'attributes':_0x432529[_0x6446('0x1d')],'include':_0x432529[_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x432529[_0x6446('0x1a')],function(_0x548527){return{'model':db[_0x548527['model']],'as':_0x548527['as'],'attributes':_0x548527[_0x6446('0x1d')],'include':_0x548527[_0x6446('0x1a')]?_['map'](_0x548527[_0x6446('0x1a')],function(_0x50e66a){return{'model':db[_0x50e66a['model']],'as':_0x50e66a['as'],'attributes':_0x50e66a[_0x6446('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6446('0xb')](function(_0x3a6e09){logger['info'](_0x6446('0x1e'),_0xc49166);logger[_0x6446('0xf')](_0x6446('0x1e'),_0xc49166,JSON[_0x6446('0x1f')](_0x3a6e09));_0x103498(_0x3a6e09);})['catch'](function(_0x3d5279){logger[_0x6446('0x10')](_0x6446('0x1e'),_0x3d5279[_0x6446('0x12')],_0xc49166);_0x3b8ba2(_0x30d36d[_0x6446('0x10')](0x1f4,_0x3d5279[_0x6446('0x12')]));});});};exports[_0x6446('0x20')]=function(_0x3dc0f5){var _0x5e2c98=this;return new Promise(function(_0x12e642,_0x49f8c8){return db[_0x6446('0x14')][_0x6446('0x21')]({'raw':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3dc0f5['options']?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x18')]||null:null,'attributes':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x1d')]||null:null,'include':_0x3dc0f5[_0x6446('0x17')]?_0x3dc0f5[_0x6446('0x17')][_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x3dc0f5[_0x6446('0x17')]['include'],function(_0x1e4561){return{'model':db[_0x1e4561['model']],'as':_0x1e4561['as'],'attributes':_0x1e4561[_0x6446('0x1d')],'include':_0x1e4561['include']?_['map'](_0x1e4561[_0x6446('0x1a')],function(_0x5cb006){return{'model':db[_0x5cb006['model']],'as':_0x5cb006['as'],'attributes':_0x5cb006[_0x6446('0x1d')],'include':_0x5cb006[_0x6446('0x1a')]?_[_0x6446('0x1b')](_0x5cb006['include'],function(_0x452d6f){return{'model':db[_0x452d6f[_0x6446('0x1c')]],'as':_0x452d6f['as'],'attributes':_0x452d6f[_0x6446('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x564546){logger[_0x6446('0xc')](_0x6446('0x20'),_0x3dc0f5);logger['debug'](_0x6446('0x20'),_0x3dc0f5,JSON[_0x6446('0x1f')](_0x564546));_0x12e642(_0x564546);})[_0x6446('0x13')](function(_0x23298f){logger[_0x6446('0x10')](_0x6446('0x20'),_0x23298f[_0x6446('0x12')],_0x3dc0f5);_0x49f8c8(_0x5e2c98[_0x6446('0x10')](0x1f4,_0x23298f[_0x6446('0x12')]));});});}; \ No newline at end of file +var _0x4670=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include','map','attributes','model','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','ServicenowAccount,\x20%s,\x20%s'];(function(_0x1e52f4,_0x5dca44){var _0x38ef2f=function(_0x1ee867){while(--_0x1ee867){_0x1e52f4['push'](_0x1e52f4['shift']());}};_0x38ef2f(++_0x5dca44);}(_0x4670,0x152));var _0x0467=function(_0xdc8632,_0x316b73){_0xdc8632=_0xdc8632-0x0;var _0x28ad9b=_0x4670[_0xdc8632];return _0x28ad9b;};'use strict';var _=require(_0x0467('0x0'));var util=require('util');var moment=require(_0x0467('0x1'));var BPromise=require(_0x0467('0x2'));var rs=require(_0x0467('0x3'));var fs=require('fs');var Redis=require(_0x0467('0x4'));var db=require(_0x0467('0x5'))['db'];var utils=require(_0x0467('0x6'));var logger=require('../../config/logger')(_0x0467('0x7'));var config=require('../../config/environment');var jayson=require(_0x0467('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aef1e,_0x4baf1e,_0x410d9c){return new BPromise(function(_0x2afc7c,_0x37cd11){return client[_0x0467('0x9')](_0x5aef1e,_0x410d9c)[_0x0467('0xa')](function(_0x3eb8d1){logger['info'](_0x0467('0xb'),_0x4baf1e,_0x0467('0xc'));logger[_0x0467('0xd')](_0x0467('0xe'),_0x4baf1e,_0x0467('0xc'),JSON[_0x0467('0xf')](_0x3eb8d1));if(_0x3eb8d1[_0x0467('0x10')]){if(_0x3eb8d1[_0x0467('0x10')][_0x0467('0x11')]===0x1f4){logger[_0x0467('0x10')](_0x0467('0xb'),_0x4baf1e,_0x3eb8d1['error'][_0x0467('0x12')]);return _0x37cd11(_0x3eb8d1[_0x0467('0x10')][_0x0467('0x12')]);}logger['error'](_0x0467('0xb'),_0x4baf1e,_0x3eb8d1[_0x0467('0x10')][_0x0467('0x12')]);return _0x2afc7c(_0x3eb8d1[_0x0467('0x10')][_0x0467('0x12')]);}else{logger[_0x0467('0x13')](_0x0467('0xb'),_0x4baf1e,'request\x20sent');_0x2afc7c(_0x3eb8d1[_0x0467('0x14')][_0x0467('0x12')]);}})[_0x0467('0x15')](function(_0x4c5774){logger[_0x0467('0x10')](_0x0467('0xb'),_0x4baf1e,_0x4c5774);_0x37cd11(_0x4c5774);});});}exports[_0x0467('0x16')]=function(_0x608db6){var _0x4f4f59=this;return new Promise(function(_0xbd73a1,_0x188e24){return db[_0x0467('0x17')][_0x0467('0x18')]({'raw':_0x608db6[_0x0467('0x19')]?_0x608db6[_0x0467('0x19')][_0x0467('0x1a')]===undefined?!![]:![]:!![],'where':_0x608db6[_0x0467('0x19')]?_0x608db6['options'][_0x0467('0x1b')]||null:null,'attributes':_0x608db6[_0x0467('0x19')]?_0x608db6[_0x0467('0x19')]['attributes']||null:null,'limit':_0x608db6[_0x0467('0x19')]?_0x608db6[_0x0467('0x19')][_0x0467('0x1c')]||null:null,'include':_0x608db6['options']?_0x608db6[_0x0467('0x19')][_0x0467('0x1d')]?_[_0x0467('0x1e')](_0x608db6[_0x0467('0x19')]['include'],function(_0x48b530){return{'model':db[_0x48b530['model']],'as':_0x48b530['as'],'attributes':_0x48b530[_0x0467('0x1f')],'include':_0x48b530[_0x0467('0x1d')]?_[_0x0467('0x1e')](_0x48b530[_0x0467('0x1d')],function(_0x5e63c2){return{'model':db[_0x5e63c2['model']],'as':_0x5e63c2['as'],'attributes':_0x5e63c2['attributes'],'include':_0x5e63c2['include']?_['map'](_0x5e63c2[_0x0467('0x1d')],function(_0x61f64c){return{'model':db[_0x61f64c[_0x0467('0x20')]],'as':_0x61f64c['as'],'attributes':_0x61f64c[_0x0467('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56274e){logger[_0x0467('0x13')](_0x0467('0x16'),_0x608db6);logger['debug'](_0x0467('0x16'),_0x608db6,JSON['stringify'](_0x56274e));_0xbd73a1(_0x56274e);})['catch'](function(_0x5c912b){logger[_0x0467('0x10')]('GetServicenowAccount',_0x5c912b[_0x0467('0x12')],_0x608db6);_0x188e24(_0x4f4f59[_0x0467('0x10')](0x1f4,_0x5c912b[_0x0467('0x12')]));});});};exports[_0x0467('0x21')]=function(_0x61dbe7){var _0x484418=this;return new Promise(function(_0x36972b,_0x53ad87){return db[_0x0467('0x17')][_0x0467('0x22')]({'raw':_0x61dbe7[_0x0467('0x19')]?_0x61dbe7[_0x0467('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x61dbe7[_0x0467('0x19')]?_0x61dbe7[_0x0467('0x19')][_0x0467('0x1b')]||null:null,'attributes':_0x61dbe7['options']?_0x61dbe7[_0x0467('0x19')][_0x0467('0x1f')]||null:null,'include':_0x61dbe7[_0x0467('0x19')]?_0x61dbe7[_0x0467('0x19')][_0x0467('0x1d')]?_['map'](_0x61dbe7[_0x0467('0x19')][_0x0467('0x1d')],function(_0x1d4e01){return{'model':db[_0x1d4e01[_0x0467('0x20')]],'as':_0x1d4e01['as'],'attributes':_0x1d4e01['attributes'],'include':_0x1d4e01[_0x0467('0x1d')]?_[_0x0467('0x1e')](_0x1d4e01['include'],function(_0x1fff77){return{'model':db[_0x1fff77[_0x0467('0x20')]],'as':_0x1fff77['as'],'attributes':_0x1fff77[_0x0467('0x1f')],'include':_0x1fff77[_0x0467('0x1d')]?_[_0x0467('0x1e')](_0x1fff77[_0x0467('0x1d')],function(_0x242483){return{'model':db[_0x242483[_0x0467('0x20')]],'as':_0x242483['as'],'attributes':_0x242483[_0x0467('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1dd6cd){logger[_0x0467('0x13')](_0x0467('0x21'),_0x61dbe7);logger[_0x0467('0xd')](_0x0467('0x21'),_0x61dbe7,JSON[_0x0467('0xf')](_0x1dd6cd));_0x36972b(_0x1dd6cd);})[_0x0467('0x15')](function(_0x177026){logger[_0x0467('0x10')](_0x0467('0x21'),_0x177026[_0x0467('0x12')],_0x61dbe7);_0x53ad87(_0x484418[_0x0467('0x10')](0x1f4,_0x177026[_0x0467('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index c649b04..5d31826 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 _0x88ec=['isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get'];(function(_0xf20b6,_0x49ddbb){var _0x4ff567=function(_0x3ccc7f){while(--_0x3ccc7f){_0xf20b6['push'](_0xf20b6['shift']());}};_0x4ff567(++_0x49ddbb);}(_0x88ec,0x1d2));var _0xc88e=function(_0x1ecc0c,_0xce40a8){_0x1ecc0c=_0x1ecc0c-0x0;var _0x28e3f3=_0x88ec[_0x1ecc0c];return _0x28e3f3;};'use strict';var multer=require(_0xc88e('0x0'));var util=require(_0xc88e('0x1'));var path=require(_0xc88e('0x2'));var timeout=require('connect-timeout');var express=require(_0xc88e('0x3'));var router=express[_0xc88e('0x4')]();var auth=require(_0xc88e('0x5'));var interaction=require(_0xc88e('0x6'));var config=require('../../config/environment');var controller=require(_0xc88e('0x7'));router[_0xc88e('0x8')]('/',auth[_0xc88e('0x9')](),controller[_0xc88e('0xa')]);router[_0xc88e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xc88e('0xb')]);router[_0xc88e('0x8')](_0xc88e('0xc'),auth['isAuthenticated'](),controller[_0xc88e('0xd')]);router[_0xc88e('0x8')](_0xc88e('0xe'),auth['isAuthenticated'](),controller[_0xc88e('0xf')]);router[_0xc88e('0x8')](_0xc88e('0x10'),auth['isAuthenticated'](),controller[_0xc88e('0x11')]);router[_0xc88e('0x12')]('/',auth[_0xc88e('0x9')](),controller[_0xc88e('0x13')]);router[_0xc88e('0x14')](_0xc88e('0x15'),auth['isAuthenticated'](),controller[_0xc88e('0x16')]);router[_0xc88e('0x17')](_0xc88e('0x15'),auth[_0xc88e('0x9')](),controller[_0xc88e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4634=['exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x100849,_0x19f1d6){var _0x234dcc=function(_0x3c6434){while(--_0x3c6434){_0x100849['push'](_0x100849['shift']());}};_0x234dcc(++_0x19f1d6);}(_0x4634,0x143));var _0x4463=function(_0x4f6d9c,_0x572a9f){_0x4f6d9c=_0x4f6d9c-0x0;var _0x52fd20=_0x4634[_0x4f6d9c];return _0x52fd20;};'use strict';var multer=require('multer');var util=require(_0x4463('0x0'));var path=require('path');var timeout=require(_0x4463('0x1'));var express=require('express');var router=express[_0x4463('0x2')]();var auth=require(_0x4463('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4463('0x4'));var controller=require(_0x4463('0x5'));router[_0x4463('0x6')]('/',auth['isAuthenticated'](),controller[_0x4463('0x7')]);router[_0x4463('0x6')](_0x4463('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4463('0x9'),auth['isAuthenticated'](),controller[_0x4463('0xa')]);router[_0x4463('0x6')](_0x4463('0xb'),auth[_0x4463('0xc')](),controller[_0x4463('0xd')]);router['get'](_0x4463('0xe'),auth['isAuthenticated'](),controller[_0x4463('0xf')]);router[_0x4463('0x10')]('/',auth[_0x4463('0xc')](),controller[_0x4463('0x11')]);router[_0x4463('0x12')](_0x4463('0x8'),auth[_0x4463('0xc')](),controller[_0x4463('0x13')]);router[_0x4463('0x14')]('/:id',auth[_0x4463('0xc')](),controller[_0x4463('0x15')]);module[_0x4463('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8bddfd9..8b376d1 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 _0xd663=['STRING','sequelize','exports'];(function(_0x311179,_0x5d935e){var _0x562c42=function(_0x34fdf1){while(--_0x34fdf1){_0x311179['push'](_0x311179['shift']());}};_0x562c42(++_0x5d935e);}(_0xd663,0x1cc));var _0x3d66=function(_0x154277,_0x70f042){_0x154277=_0x154277-0x0;var _0x14d1f9=_0xd663[_0x154277];return _0x14d1f9;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'name':{'type':Sequelize[_0x3d66('0x2')]},'description':{'type':Sequelize[_0x3d66('0x2')]}}; \ No newline at end of file +var _0x22eb=['STRING','sequelize','exports'];(function(_0x387c18,_0x104dea){var _0x17bc43=function(_0x17ead3){while(--_0x17ead3){_0x387c18['push'](_0x387c18['shift']());}};_0x17bc43(++_0x104dea);}(_0x22eb,0x1a5));var _0xb22e=function(_0x333744,_0x5810c8){_0x333744=_0x333744-0x0;var _0x16b224=_0x22eb[_0x333744];return _0x16b224;};'use strict';var Sequelize=require(_0xb22e('0x0'));module[_0xb22e('0x1')]={'name':{'type':Sequelize[_0xb22e('0x2')]},'description':{'type':Sequelize[_0xb22e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 973757f..c6ccd95 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 _0xb58b=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','getFields','findOne','ServicenowField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb58b,0x1f1));var _0xbb58=function(_0x60334f,_0x419bb9){_0x60334f=_0x60334f-0x0;var _0x4252a6=_0xb58b[_0x60334f];return _0x4252a6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb58('0x0'));var rimraf=require(_0xbb58('0x1'));var zipdir=require(_0xbb58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb58('0x3'));var moment=require(_0xbb58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb58('0x5'));var util=require('util');var path=require(_0xbb58('0x6'));var sox=require(_0xbb58('0x7'));var csv=require(_0xbb58('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x8'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var db=require(_0xbb58('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbb58('0x18')][_0xbb58('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4cda21,_0x132511,_0xdc68b9){if(_0xdc68b9){var _0x14106f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14106f[_0xbb58('0x1a')](_0x132511)){return _0x4cda21;}else{throw new db[(_0xbb58('0x1b'))]['ValidationError'](_0xbb58('0x1c'));}}else{return _0x4cda21;}}function respondWithRpcPromise(_0x23fd15,_0x5f4751,_0x4ba30e,_0x33c20f){return new BPromise(function(_0x445b1f,_0x38d69a){var _0x47c927=_0x33c20f||client;return _0x47c927['request'](_0x23fd15,_0x4ba30e)['then'](function(_0x55156e){logger[_0xbb58('0x1d')](_0xbb58('0x1e'),_0x5f4751,'request\x20sent');logger[_0xbb58('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5f4751,_0xbb58('0x20'),JSON[_0xbb58('0x21')](_0x55156e));if(_0x55156e[_0xbb58('0x22')]){if(_0x55156e[_0xbb58('0x22')][_0xbb58('0x23')]===0x1f4){logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x55156e['error'][_0xbb58('0x24')]);return _0x38d69a(_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);}logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);return _0x445b1f(_0x55156e[_0xbb58('0x22')][_0xbb58('0x24')]);}else{logger['info'](_0xbb58('0x1e'),_0x5f4751,'request\x20sent');_0x445b1f(_0x55156e[_0xbb58('0x25')][_0xbb58('0x24')]);}})[_0xbb58('0x26')](function(_0x3e215c){logger[_0xbb58('0x22')](_0xbb58('0x1e'),_0x5f4751,_0x3e215c);_0x38d69a(_0x3e215c);});});}function respondWithStatusCode(_0x2d556a,_0x15e4c5){_0x15e4c5=_0x15e4c5||0xcc;return function(_0x4e0303){if(_0x4e0303){return _0x2d556a[_0xbb58('0x27')](_0x15e4c5);}return _0x2d556a[_0xbb58('0x28')](_0x15e4c5)[_0xbb58('0x29')]();};}function respondWithResult(_0x129094,_0x8e9ed9){_0x8e9ed9=_0x8e9ed9||0xc8;return function(_0x521d0c){if(_0x521d0c){return _0x129094[_0xbb58('0x28')](_0x8e9ed9)[_0xbb58('0x2a')](_0x521d0c);}};}function respondWithFilteredResult(_0x16df29,_0x2d5b39){return function(_0xf6687e){if(_0xf6687e){var _0x28b3a3=_0xf6687e['count'],_0x2a0481=_0x2d5b39[_0xbb58('0x2b')],_0x4157c4=_0x2d5b39[_0xbb58('0x2b')]+_0x2d5b39[_0xbb58('0x2c')],_0x3559b6;if(_0x4157c4>=_0x28b3a3){_0x4157c4=_0x28b3a3;_0x3559b6=0xc8;}else{_0x3559b6=0xce;}_0x16df29[_0xbb58('0x28')](_0x3559b6);return _0x16df29[_0xbb58('0x2d')](_0xbb58('0x2e'),_0x2a0481+'-'+_0x4157c4+'/'+_0x28b3a3)[_0xbb58('0x2a')](_0xf6687e);}return null;};}function patchUpdates(_0x643e0e){return function(_0x3f8db3){try{jsonpatch['apply'](_0x3f8db3,_0x643e0e,!![]);}catch(_0xc39e3f){return BPromise[_0xbb58('0x2f')](_0xc39e3f);}return _0x3f8db3[_0xbb58('0x30')]();};}function saveUpdates(_0x3a1e46,_0xdbbe7b){return function(_0x33f931){if(_0x33f931){return _0x33f931[_0xbb58('0x31')](_0x3a1e46)[_0xbb58('0x32')](function(_0x23816c){return _0x23816c;});}return null;};}function removeEntity(_0x1cae1c,_0x389187){return function(_0x34583e){if(_0x34583e){return _0x34583e[_0xbb58('0x33')]()['then'](function(){_0x1cae1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1def9f,_0x19324e){return function(_0x1c207b){if(!_0x1c207b){_0x1def9f[_0xbb58('0x27')](0x194);}return _0x1c207b;};}function handleError(_0xb28e63,_0x3333e5){_0x3333e5=_0x3333e5||0x1f4;return function(_0x3093bf){logger[_0xbb58('0x22')](_0x3093bf['stack']);if(_0x3093bf[_0xbb58('0x34')]){delete _0x3093bf[_0xbb58('0x34')];}_0xb28e63['status'](_0x3333e5)[_0xbb58('0x35')](_0x3093bf);};}exports['index']=function(_0x2a82e,_0x4de9db){var _0x86372e={},_0x36c7b4={},_0x52f4af={'count':0x0,'rows':[]};var _0x3d3aee=_[_0xbb58('0x36')](db[_0xbb58('0x37')][_0xbb58('0x38')],function(_0x1b86a6){return{'name':_0x1b86a6[_0xbb58('0x39')],'type':_0x1b86a6[_0xbb58('0x3a')][_0xbb58('0x3b')]};});_0x36c7b4['model']=_[_0xbb58('0x36')](_0x3d3aee,_0xbb58('0x34'));_0x36c7b4[_0xbb58('0x3c')]=_['keys'](_0x2a82e['query']);_0x36c7b4[_0xbb58('0x3d')]=_['intersection'](_0x36c7b4[_0xbb58('0x3e')],_0x36c7b4[_0xbb58('0x3c')]);_0x86372e[_0xbb58('0x3f')]=_['intersection'](_0x36c7b4['model'],qs[_0xbb58('0x40')](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x40')]));_0x86372e[_0xbb58('0x3f')]=_0x86372e[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x86372e['attributes']:_0x36c7b4[_0xbb58('0x3e')];if(!_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x86372e[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x2a82e['query'][_0xbb58('0x2c')]);_0x86372e['offset']=qs[_0xbb58('0x2b')](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x2b')]);}_0x86372e[_0xbb58('0x44')]=qs['sort'](_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x86372e[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_['pick'](_0x2a82e[_0xbb58('0x3c')],_0x36c7b4['filters']),_0x3d3aee);if(_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x86372e[_0xbb58('0x46')]=_[_0xbb58('0x48')](_0x86372e[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x3d3aee,function(_0x666a57){if(_0x666a57[_0xbb58('0x3a')]!==_0xbb58('0x49')){var _0x444906={};_0x444906[_0x666a57[_0xbb58('0x34')]]={'$like':'%'+_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x47')]+'%'};return _0x444906;}})});}_0x86372e=_['merge']({},_0x86372e,_0x2a82e[_0xbb58('0x4a')]);var _0x5b5190={'where':_0x86372e['where']};return db[_0xbb58('0x37')][_0xbb58('0x4b')](_0x5b5190)[_0xbb58('0x32')](function(_0x1aaad9){_0x52f4af[_0xbb58('0x4b')]=_0x1aaad9;if(_0x2a82e[_0xbb58('0x3c')][_0xbb58('0x4c')]){_0x86372e[_0xbb58('0x4d')]=[{'all':!![]}];}return db[_0xbb58('0x37')][_0xbb58('0x4e')](_0x86372e);})[_0xbb58('0x32')](function(_0x59a8cf){_0x52f4af[_0xbb58('0x4f')]=_0x59a8cf;return _0x52f4af;})[_0xbb58('0x32')](respondWithFilteredResult(_0x4de9db,_0x86372e))['catch'](handleError(_0x4de9db,null));};exports[_0xbb58('0x50')]=function(_0x230cf4,_0xf94897){var _0xdb0ff7={'raw':![],'where':{'id':_0x230cf4[_0xbb58('0x51')]['id']}},_0x5de68e={};_0x5de68e['model']=_[_0xbb58('0x52')](db[_0xbb58('0x37')][_0xbb58('0x38')]);_0x5de68e['query']=_[_0xbb58('0x52')](_0x230cf4[_0xbb58('0x3c')]);_0x5de68e['filters']=_[_0xbb58('0x53')](_0x5de68e['model'],_0x5de68e[_0xbb58('0x3c')]);_0xdb0ff7[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x5de68e[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x230cf4[_0xbb58('0x3c')][_0xbb58('0x40')]));_0xdb0ff7['attributes']=_0xdb0ff7[_0xbb58('0x3f')][_0xbb58('0x41')]?_0xdb0ff7['attributes']:_0x5de68e[_0xbb58('0x3e')];if(_0x230cf4[_0xbb58('0x3c')]['includeAll']){_0xdb0ff7[_0xbb58('0x4d')]=[{'all':!![]}];}_0xdb0ff7=_[_0xbb58('0x48')]({},_0xdb0ff7,_0x230cf4[_0xbb58('0x4a')]);return db['ServicenowConfiguration'][_0xbb58('0x54')](_0xdb0ff7)[_0xbb58('0x32')](handleEntityNotFound(_0xf94897,null))[_0xbb58('0x32')](respondWithResult(_0xf94897,null))['catch'](handleError(_0xf94897,null));};exports[_0xbb58('0x55')]=function(_0x5cf2b9,_0x200e82){return db[_0xbb58('0x37')][_0xbb58('0x55')](_0x5cf2b9['body'],{})['then'](respondWithResult(_0x200e82,0xc9))[_0xbb58('0x26')](handleError(_0x200e82,null));};exports[_0xbb58('0x31')]=function(_0x37bb99,_0x23ed08){if(_0x37bb99[_0xbb58('0x56')]['id']){delete _0x37bb99['body']['id'];}return db[_0xbb58('0x37')][_0xbb58('0x54')]({'where':{'id':_0x37bb99[_0xbb58('0x51')]['id']}})['then'](handleEntityNotFound(_0x23ed08,null))[_0xbb58('0x32')](saveUpdates(_0x37bb99[_0xbb58('0x56')],null))[_0xbb58('0x32')](respondWithResult(_0x23ed08,null))[_0xbb58('0x26')](handleError(_0x23ed08,null));};exports[_0xbb58('0x33')]=function(_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x37')][_0xbb58('0x54')]({'where':{'id':_0x5e7ae0[_0xbb58('0x51')]['id']}})[_0xbb58('0x32')](handleEntityNotFound(_0x1174b1,null))[_0xbb58('0x32')](removeEntity(_0x1174b1,null))[_0xbb58('0x26')](handleError(_0x1174b1,null));};exports[_0xbb58('0x57')]=function(_0x55d5be,_0x344b0d,_0x502338){var _0x1033e0={};var _0x29c28b={};var _0x3862c9;var _0x2a6963;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0x55d5be[_0xbb58('0x51')]['id']}})[_0xbb58('0x32')](handleEntityNotFound(_0x344b0d,null))[_0xbb58('0x32')](function(_0x11ddd7){if(_0x11ddd7){_0x3862c9=_0x11ddd7;_0x29c28b[_0xbb58('0x3e')]=_['keys'](db[_0xbb58('0x59')][_0xbb58('0x38')]);_0x29c28b[_0xbb58('0x3c')]=_['keys'](_0x55d5be[_0xbb58('0x3c')]);_0x29c28b['filters']=_[_0xbb58('0x53')](_0x29c28b[_0xbb58('0x3e')],_0x29c28b['query']);_0x1033e0[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x29c28b[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x55d5be[_0xbb58('0x3c')]['fields']));_0x1033e0['attributes']=_0x1033e0[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x1033e0[_0xbb58('0x3f')]:_0x29c28b['model'];_0x1033e0[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0x55d5be['query'][_0xbb58('0x45')]);_0x1033e0[_0xbb58('0x46')]=qs['filters'](_[_0xbb58('0x5a')](_0x55d5be[_0xbb58('0x3c')],_0x29c28b[_0xbb58('0x3d')]));if(_0x55d5be[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x1033e0['where']=_[_0xbb58('0x48')](_0x1033e0[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x1033e0[_0xbb58('0x3f')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x55d5be['query'][_0xbb58('0x47')]+'%'};return _0x5e17fc;})});}_0x1033e0=_['merge']({},_0x1033e0,_0x55d5be[_0xbb58('0x4a')]);return _0x3862c9[_0xbb58('0x57')](_0x1033e0);}})[_0xbb58('0x32')](function(_0xe5b33a){if(_0xe5b33a){_0x2a6963=_0xe5b33a[_0xbb58('0x41')];if(!_0x55d5be[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x1033e0[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x55d5be['query'][_0xbb58('0x2c')]);_0x1033e0[_0xbb58('0x2b')]=qs[_0xbb58('0x2b')](_0x55d5be['query'][_0xbb58('0x2b')]);}return _0x3862c9['getFields'](_0x1033e0);}})['then'](function(_0x1e315e){if(_0x1e315e){return _0x1e315e?{'count':_0x2a6963,'rows':_0x1e315e}:null;}})[_0xbb58('0x32')](respondWithResult(_0x344b0d,null))[_0xbb58('0x26')](handleError(_0x344b0d,null));};exports[_0xbb58('0x5b')]=function(_0x4e19b1,_0x51c6f9,_0x3210d7){var _0x1853d1={};var _0x4d2091={};var _0x27c861;var _0x2ba4a9;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0x4e19b1[_0xbb58('0x51')]['id']}})['then'](handleEntityNotFound(_0x51c6f9,null))[_0xbb58('0x32')](function(_0x5b27d2){if(_0x5b27d2){_0x27c861=_0x5b27d2;_0x4d2091['model']=_[_0xbb58('0x52')](db[_0xbb58('0x59')][_0xbb58('0x38')]);_0x4d2091['query']=_[_0xbb58('0x52')](_0x4e19b1[_0xbb58('0x3c')]);_0x4d2091[_0xbb58('0x3d')]=_[_0xbb58('0x53')](_0x4d2091['model'],_0x4d2091[_0xbb58('0x3c')]);_0x1853d1['attributes']=_['intersection'](_0x4d2091[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0x4e19b1[_0xbb58('0x3c')]['fields']));_0x1853d1['attributes']=_0x1853d1[_0xbb58('0x3f')][_0xbb58('0x41')]?_0x1853d1[_0xbb58('0x3f')]:_0x4d2091[_0xbb58('0x3e')];_0x1853d1[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0x4e19b1[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x1853d1[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_[_0xbb58('0x5a')](_0x4e19b1['query'],_0x4d2091['filters']));if(_0x4e19b1[_0xbb58('0x3c')][_0xbb58('0x47')]){_0x1853d1[_0xbb58('0x46')]=_['merge'](_0x1853d1[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x1853d1[_0xbb58('0x3f')],function(_0x494c33){var _0x2d70d2={};_0x2d70d2[_0x494c33]={'$like':'%'+_0x4e19b1['query'][_0xbb58('0x47')]+'%'};return _0x2d70d2;})});}_0x1853d1=_['merge']({},_0x1853d1,_0x4e19b1[_0xbb58('0x4a')]);return _0x27c861[_0xbb58('0x5b')](_0x1853d1);}})[_0xbb58('0x32')](function(_0x1f1b74){if(_0x1f1b74){_0x2ba4a9=_0x1f1b74[_0xbb58('0x41')];if(!_0x4e19b1[_0xbb58('0x3c')]['hasOwnProperty']('nolimit')){_0x1853d1[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0x4e19b1['query'][_0xbb58('0x2c')]);_0x1853d1[_0xbb58('0x2b')]=qs[_0xbb58('0x2b')](_0x4e19b1['query'][_0xbb58('0x2b')]);}return _0x27c861['getSubjects'](_0x1853d1);}})[_0xbb58('0x32')](function(_0x2616ad){if(_0x2616ad){return _0x2616ad?{'count':_0x2ba4a9,'rows':_0x2616ad}:null;}})[_0xbb58('0x32')](respondWithResult(_0x51c6f9,null))[_0xbb58('0x26')](handleError(_0x51c6f9,null));};exports[_0xbb58('0x5c')]=function(_0xe57872,_0x195a23,_0x5a80ef){var _0x10828e={};var _0x2562cf={};var _0xa6182a;var _0x51c68b;return db[_0xbb58('0x37')][_0xbb58('0x58')]({'where':{'id':_0xe57872['params']['id']}})['then'](handleEntityNotFound(_0x195a23,null))[_0xbb58('0x32')](function(_0x1dc157){if(_0x1dc157){_0xa6182a=_0x1dc157;_0x2562cf[_0xbb58('0x3e')]=_['keys'](db['ServicenowField'][_0xbb58('0x38')]);_0x2562cf[_0xbb58('0x3c')]=_[_0xbb58('0x52')](_0xe57872[_0xbb58('0x3c')]);_0x2562cf[_0xbb58('0x3d')]=_[_0xbb58('0x53')](_0x2562cf[_0xbb58('0x3e')],_0x2562cf[_0xbb58('0x3c')]);_0x10828e[_0xbb58('0x3f')]=_[_0xbb58('0x53')](_0x2562cf[_0xbb58('0x3e')],qs[_0xbb58('0x40')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x40')]));_0x10828e[_0xbb58('0x3f')]=_0x10828e['attributes'][_0xbb58('0x41')]?_0x10828e['attributes']:_0x2562cf[_0xbb58('0x3e')];_0x10828e[_0xbb58('0x44')]=qs[_0xbb58('0x45')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x45')]);_0x10828e[_0xbb58('0x46')]=qs[_0xbb58('0x3d')](_[_0xbb58('0x5a')](_0xe57872[_0xbb58('0x3c')],_0x2562cf[_0xbb58('0x3d')]));if(_0xe57872['query'][_0xbb58('0x47')]){_0x10828e[_0xbb58('0x46')]=_[_0xbb58('0x48')](_0x10828e[_0xbb58('0x46')],{'$or':_[_0xbb58('0x36')](_0x10828e['attributes'],function(_0x6ef032){var _0x4c8531={};_0x4c8531[_0x6ef032]={'$like':'%'+_0xe57872['query'][_0xbb58('0x47')]+'%'};return _0x4c8531;})});}_0x10828e=_['merge']({},_0x10828e,_0xe57872[_0xbb58('0x4a')]);return _0xa6182a['getDescriptions'](_0x10828e);}})[_0xbb58('0x32')](function(_0x4a794f){if(_0x4a794f){_0x51c68b=_0x4a794f[_0xbb58('0x41')];if(!_0xe57872[_0xbb58('0x3c')][_0xbb58('0x42')](_0xbb58('0x43'))){_0x10828e[_0xbb58('0x2c')]=qs[_0xbb58('0x2c')](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x2c')]);_0x10828e['offset']=qs['offset'](_0xe57872[_0xbb58('0x3c')][_0xbb58('0x2b')]);}return _0xa6182a['getDescriptions'](_0x10828e);}})['then'](function(_0x56722e){if(_0x56722e){return _0x56722e?{'count':_0x51c68b,'rows':_0x56722e}:null;}})[_0xbb58('0x32')](respondWithResult(_0x195a23,null))[_0xbb58('0x26')](handleError(_0x195a23,null));}; \ No newline at end of file +var _0xe605=['result','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','destroy','stack','name','index','ServicenowConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','ServicenowField','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x1d1fb4,_0x4b0565){var _0x443c49=function(_0x4a3856){while(--_0x4a3856){_0x1d1fb4['push'](_0x1d1fb4['shift']());}};_0x443c49(++_0x4b0565);}(_0xe605,0x92));var _0x5e60=function(_0x22a56b,_0x1e4661){_0x22a56b=_0x22a56b-0x0;var _0x101ad1=_0xe605[_0x22a56b];return _0x101ad1;};'use strict';var pdf=require(_0x5e60('0x0'));var emlformat=require(_0x5e60('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5e60('0x2'));var jsonpatch=require(_0x5e60('0x3'));var rp=require(_0x5e60('0x4'));var moment=require(_0x5e60('0x5'));var BPromise=require(_0x5e60('0x6'));var Mustache=require(_0x5e60('0x7'));var util=require(_0x5e60('0x8'));var path=require(_0x5e60('0x9'));var sox=require(_0x5e60('0xa'));var csv=require(_0x5e60('0xb'));var ejs=require(_0x5e60('0xc'));var fs=require('fs');var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var db=require(_0x5e60('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5e60('0x19')][_0x5e60('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1f4e14,_0xe039de,_0x2874c4){if(_0x2874c4){var _0xe124cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe124cd['test'](_0xe039de)){return _0x1f4e14;}else{throw new db[(_0x5e60('0x1b'))][(_0x5e60('0x1c'))](_0x5e60('0x1d'));}}else{return _0x1f4e14;}}function respondWithRpcPromise(_0x2a1c55,_0x5b028f,_0x20af5f,_0x529ffe){return new BPromise(function(_0x1ffd77,_0x3bc7d8){var _0x4cf084=_0x529ffe||client;return _0x4cf084[_0x5e60('0x1e')](_0x2a1c55,_0x20af5f)[_0x5e60('0x1f')](function(_0xaa7d05){logger[_0x5e60('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b028f,_0x5e60('0x21'));logger[_0x5e60('0x22')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5b028f,_0x5e60('0x21'),JSON[_0x5e60('0x23')](_0xaa7d05));if(_0xaa7d05[_0x5e60('0x24')]){if(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x25')]===0x1f4){logger[_0x5e60('0x24')](_0x5e60('0x26'),_0x5b028f,_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);return _0x3bc7d8(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);}logger['error'](_0x5e60('0x26'),_0x5b028f,_0xaa7d05['error'][_0x5e60('0x27')]);return _0x1ffd77(_0xaa7d05[_0x5e60('0x24')][_0x5e60('0x27')]);}else{logger[_0x5e60('0x20')](_0x5e60('0x26'),_0x5b028f,_0x5e60('0x21'));_0x1ffd77(_0xaa7d05[_0x5e60('0x28')]['message']);}})[_0x5e60('0x29')](function(_0x7dbdb7){logger[_0x5e60('0x24')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b028f,_0x7dbdb7);_0x3bc7d8(_0x7dbdb7);});});}function respondWithStatusCode(_0x45cb62,_0x56e3a5){_0x56e3a5=_0x56e3a5||0xcc;return function(_0x2d8aac){if(_0x2d8aac){return _0x45cb62[_0x5e60('0x2a')](_0x56e3a5);}return _0x45cb62['status'](_0x56e3a5)[_0x5e60('0x2b')]();};}function respondWithResult(_0x5712f7,_0x23d187){_0x23d187=_0x23d187||0xc8;return function(_0x221322){if(_0x221322){return _0x5712f7['status'](_0x23d187)[_0x5e60('0x2c')](_0x221322);}};}function respondWithFilteredResult(_0x19e5ab,_0x5b1b46){return function(_0x1ee931){if(_0x1ee931){var _0xac9c7a=_0x1ee931[_0x5e60('0x2d')],_0x52c97c=_0x5b1b46[_0x5e60('0x2e')],_0x5431a8=_0x5b1b46[_0x5e60('0x2e')]+_0x5b1b46[_0x5e60('0x2f')],_0x52f668;if(_0x5431a8>=_0xac9c7a){_0x5431a8=_0xac9c7a;_0x52f668=0xc8;}else{_0x52f668=0xce;}_0x19e5ab[_0x5e60('0x30')](_0x52f668);return _0x19e5ab['set'](_0x5e60('0x31'),_0x52c97c+'-'+_0x5431a8+'/'+_0xac9c7a)[_0x5e60('0x2c')](_0x1ee931);}return null;};}function patchUpdates(_0x4d4b55){return function(_0x11fc87){try{jsonpatch['apply'](_0x11fc87,_0x4d4b55,!![]);}catch(_0x50f024){return BPromise[_0x5e60('0x32')](_0x50f024);}return _0x11fc87[_0x5e60('0x33')]();};}function saveUpdates(_0x1f474b,_0x385c77){return function(_0xaf3a35){if(_0xaf3a35){return _0xaf3a35[_0x5e60('0x34')](_0x1f474b)[_0x5e60('0x1f')](function(_0x2ff2b7){return _0x2ff2b7;});}return null;};}function removeEntity(_0xc1489a,_0x4702a6){return function(_0x5c429c){if(_0x5c429c){return _0x5c429c[_0x5e60('0x35')]()['then'](function(){_0xc1489a['status'](0xcc)[_0x5e60('0x2b')]();});}};}function handleEntityNotFound(_0x317206,_0x4fd910){return function(_0x307e54){if(!_0x307e54){_0x317206['sendStatus'](0x194);}return _0x307e54;};}function handleError(_0x3757fc,_0x45d979){_0x45d979=_0x45d979||0x1f4;return function(_0x2b2426){logger[_0x5e60('0x24')](_0x2b2426[_0x5e60('0x36')]);if(_0x2b2426[_0x5e60('0x37')]){delete _0x2b2426[_0x5e60('0x37')];}_0x3757fc[_0x5e60('0x30')](_0x45d979)['send'](_0x2b2426);};}exports[_0x5e60('0x38')]=function(_0x3f744d,_0x22d4ad){var _0x1a3782={},_0x200744={},_0x2aa7d4={'count':0x0,'rows':[]};var _0x261245=_['map'](db[_0x5e60('0x39')][_0x5e60('0x3a')],function(_0x4cba18){return{'name':_0x4cba18['fieldName'],'type':_0x4cba18[_0x5e60('0x3b')][_0x5e60('0x3c')]};});_0x200744[_0x5e60('0x3d')]=_[_0x5e60('0x3e')](_0x261245,_0x5e60('0x37'));_0x200744['query']=_[_0x5e60('0x3f')](_0x3f744d[_0x5e60('0x40')]);_0x200744[_0x5e60('0x41')]=_[_0x5e60('0x42')](_0x200744[_0x5e60('0x3d')],_0x200744[_0x5e60('0x40')]);_0x1a3782[_0x5e60('0x43')]=_['intersection'](_0x200744[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x3f744d['query']['fields']));_0x1a3782['attributes']=_0x1a3782[_0x5e60('0x43')][_0x5e60('0x45')]?_0x1a3782[_0x5e60('0x43')]:_0x200744[_0x5e60('0x3d')];if(!_0x3f744d['query'][_0x5e60('0x46')](_0x5e60('0x47'))){_0x1a3782['limit']=qs['limit'](_0x3f744d[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x1a3782[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x3f744d[_0x5e60('0x40')][_0x5e60('0x2e')]);}_0x1a3782[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x3f744d[_0x5e60('0x40')]['sort']);_0x1a3782[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_['pick'](_0x3f744d[_0x5e60('0x40')],_0x200744[_0x5e60('0x41')]),_0x261245);if(_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x1a3782[_0x5e60('0x4a')]=_['merge'](_0x1a3782[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x261245,function(_0x172aff){if(_0x172aff[_0x5e60('0x3b')]!=='VIRTUAL'){var _0x4d9787={};_0x4d9787[_0x172aff['name']]={'$like':'%'+_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x4d9787;}})});}_0x1a3782=_[_0x5e60('0x4c')]({},_0x1a3782,_0x3f744d[_0x5e60('0x4d')]);var _0x39c131={'where':_0x1a3782[_0x5e60('0x4a')]};return db['ServicenowConfiguration'][_0x5e60('0x2d')](_0x39c131)[_0x5e60('0x1f')](function(_0x165bea){_0x2aa7d4[_0x5e60('0x2d')]=_0x165bea;if(_0x3f744d[_0x5e60('0x40')][_0x5e60('0x4e')]){_0x1a3782[_0x5e60('0x4f')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x5e60('0x50')](_0x1a3782);})[_0x5e60('0x1f')](function(_0x21a116){_0x2aa7d4[_0x5e60('0x51')]=_0x21a116;return _0x2aa7d4;})[_0x5e60('0x1f')](respondWithFilteredResult(_0x22d4ad,_0x1a3782))[_0x5e60('0x29')](handleError(_0x22d4ad,null));};exports[_0x5e60('0x52')]=function(_0x4470bd,_0x1518bd){var _0x350d6d={'raw':![],'where':{'id':_0x4470bd[_0x5e60('0x53')]['id']}},_0xe5e675={};_0xe5e675[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x39')][_0x5e60('0x3a')]);_0xe5e675[_0x5e60('0x40')]=_[_0x5e60('0x3f')](_0x4470bd['query']);_0xe5e675['filters']=_[_0x5e60('0x42')](_0xe5e675['model'],_0xe5e675[_0x5e60('0x40')]);_0x350d6d[_0x5e60('0x43')]=_[_0x5e60('0x42')](_0xe5e675[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x4470bd[_0x5e60('0x40')]['fields']));_0x350d6d['attributes']=_0x350d6d[_0x5e60('0x43')][_0x5e60('0x45')]?_0x350d6d[_0x5e60('0x43')]:_0xe5e675['model'];if(_0x4470bd['query'][_0x5e60('0x4e')]){_0x350d6d[_0x5e60('0x4f')]=[{'all':!![]}];}_0x350d6d=_[_0x5e60('0x4c')]({},_0x350d6d,_0x4470bd['options']);return db[_0x5e60('0x39')][_0x5e60('0x54')](_0x350d6d)[_0x5e60('0x1f')](handleEntityNotFound(_0x1518bd,null))[_0x5e60('0x1f')](respondWithResult(_0x1518bd,null))[_0x5e60('0x29')](handleError(_0x1518bd,null));};exports[_0x5e60('0x55')]=function(_0x4ae313,_0x412be1){return db[_0x5e60('0x39')]['create'](_0x4ae313[_0x5e60('0x56')],{})[_0x5e60('0x1f')](respondWithResult(_0x412be1,0xc9))[_0x5e60('0x29')](handleError(_0x412be1,null));};exports['update']=function(_0xbe0bd5,_0x17429d){if(_0xbe0bd5['body']['id']){delete _0xbe0bd5[_0x5e60('0x56')]['id'];}return db[_0x5e60('0x39')][_0x5e60('0x54')]({'where':{'id':_0xbe0bd5[_0x5e60('0x53')]['id']}})['then'](handleEntityNotFound(_0x17429d,null))[_0x5e60('0x1f')](saveUpdates(_0xbe0bd5[_0x5e60('0x56')],null))['then'](respondWithResult(_0x17429d,null))[_0x5e60('0x29')](handleError(_0x17429d,null));};exports['destroy']=function(_0x8d00b9,_0x5220fc){return db[_0x5e60('0x39')][_0x5e60('0x54')]({'where':{'id':_0x8d00b9['params']['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x5220fc,null))['then'](removeEntity(_0x5220fc,null))[_0x5e60('0x29')](handleError(_0x5220fc,null));};exports['getFields']=function(_0x157787,_0x5b4daa,_0x1481d0){var _0x17e178={};var _0xb1ef22={};var _0x28c2de;var _0x252fa3;return db[_0x5e60('0x39')][_0x5e60('0x57')]({'where':{'id':_0x157787['params']['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x5b4daa,null))[_0x5e60('0x1f')](function(_0x442dbf){if(_0x442dbf){_0x28c2de=_0x442dbf;_0xb1ef22[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')]['rawAttributes']);_0xb1ef22['query']=_['keys'](_0x157787[_0x5e60('0x40')]);_0xb1ef22[_0x5e60('0x41')]=_['intersection'](_0xb1ef22[_0x5e60('0x3d')],_0xb1ef22[_0x5e60('0x40')]);_0x17e178['attributes']=_[_0x5e60('0x42')](_0xb1ef22[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x157787[_0x5e60('0x40')][_0x5e60('0x44')]));_0x17e178[_0x5e60('0x43')]=_0x17e178[_0x5e60('0x43')][_0x5e60('0x45')]?_0x17e178[_0x5e60('0x43')]:_0xb1ef22[_0x5e60('0x3d')];_0x17e178[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x157787[_0x5e60('0x40')][_0x5e60('0x49')]);_0x17e178[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_[_0x5e60('0x59')](_0x157787['query'],_0xb1ef22[_0x5e60('0x41')]));if(_0x157787[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x17e178['where']=_[_0x5e60('0x4c')](_0x17e178[_0x5e60('0x4a')],{'$or':_['map'](_0x17e178[_0x5e60('0x43')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x157787[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x5bbaaf;})});}_0x17e178=_[_0x5e60('0x4c')]({},_0x17e178,_0x157787[_0x5e60('0x4d')]);return _0x28c2de[_0x5e60('0x5a')](_0x17e178);}})[_0x5e60('0x1f')](function(_0x221f35){if(_0x221f35){_0x252fa3=_0x221f35[_0x5e60('0x45')];if(!_0x157787[_0x5e60('0x40')]['hasOwnProperty'](_0x5e60('0x47'))){_0x17e178[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x157787['query'][_0x5e60('0x2f')]);_0x17e178[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x157787[_0x5e60('0x40')][_0x5e60('0x2e')]);}return _0x28c2de['getFields'](_0x17e178);}})[_0x5e60('0x1f')](function(_0x213c7e){if(_0x213c7e){return _0x213c7e?{'count':_0x252fa3,'rows':_0x213c7e}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x5b4daa,null))['catch'](handleError(_0x5b4daa,null));};exports['getSubjects']=function(_0x3ecfbe,_0x265b5a,_0x13c6dc){var _0x25f6cb={};var _0x14fb46={};var _0x44ddaa;var _0x2c5b45;return db['ServicenowConfiguration'][_0x5e60('0x57')]({'where':{'id':_0x3ecfbe[_0x5e60('0x53')]['id']}})[_0x5e60('0x1f')](handleEntityNotFound(_0x265b5a,null))['then'](function(_0x5dd41b){if(_0x5dd41b){_0x44ddaa=_0x5dd41b;_0x14fb46[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')]['rawAttributes']);_0x14fb46['query']=_[_0x5e60('0x3f')](_0x3ecfbe[_0x5e60('0x40')]);_0x14fb46[_0x5e60('0x41')]=_[_0x5e60('0x42')](_0x14fb46[_0x5e60('0x3d')],_0x14fb46[_0x5e60('0x40')]);_0x25f6cb['attributes']=_[_0x5e60('0x42')](_0x14fb46[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x44')]));_0x25f6cb[_0x5e60('0x43')]=_0x25f6cb[_0x5e60('0x43')][_0x5e60('0x45')]?_0x25f6cb[_0x5e60('0x43')]:_0x14fb46['model'];_0x25f6cb[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x3ecfbe['query'][_0x5e60('0x49')]);_0x25f6cb[_0x5e60('0x4a')]=qs['filters'](_[_0x5e60('0x59')](_0x3ecfbe[_0x5e60('0x40')],_0x14fb46[_0x5e60('0x41')]));if(_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x25f6cb[_0x5e60('0x4a')]=_['merge'](_0x25f6cb[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x25f6cb[_0x5e60('0x43')],function(_0x222d94){var _0x95d1c5={};_0x95d1c5[_0x222d94]={'$like':'%'+_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x4b')]+'%'};return _0x95d1c5;})});}_0x25f6cb=_[_0x5e60('0x4c')]({},_0x25f6cb,_0x3ecfbe[_0x5e60('0x4d')]);return _0x44ddaa['getSubjects'](_0x25f6cb);}})[_0x5e60('0x1f')](function(_0x6f826){if(_0x6f826){_0x2c5b45=_0x6f826[_0x5e60('0x45')];if(!_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x46')](_0x5e60('0x47'))){_0x25f6cb[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x3ecfbe[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x25f6cb['offset']=qs['offset'](_0x3ecfbe['query'][_0x5e60('0x2e')]);}return _0x44ddaa[_0x5e60('0x5b')](_0x25f6cb);}})[_0x5e60('0x1f')](function(_0x1a911a){if(_0x1a911a){return _0x1a911a?{'count':_0x2c5b45,'rows':_0x1a911a}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x265b5a,null))[_0x5e60('0x29')](handleError(_0x265b5a,null));};exports[_0x5e60('0x5c')]=function(_0x58640c,_0x120fab,_0x4f9164){var _0x1d95fd={};var _0x42ac7c={};var _0x2afb9c;var _0x530e04;return db[_0x5e60('0x39')]['findOne']({'where':{'id':_0x58640c['params']['id']}})['then'](handleEntityNotFound(_0x120fab,null))[_0x5e60('0x1f')](function(_0x43803c){if(_0x43803c){_0x2afb9c=_0x43803c;_0x42ac7c[_0x5e60('0x3d')]=_[_0x5e60('0x3f')](db[_0x5e60('0x58')][_0x5e60('0x3a')]);_0x42ac7c[_0x5e60('0x40')]=_[_0x5e60('0x3f')](_0x58640c[_0x5e60('0x40')]);_0x42ac7c['filters']=_[_0x5e60('0x42')](_0x42ac7c[_0x5e60('0x3d')],_0x42ac7c[_0x5e60('0x40')]);_0x1d95fd[_0x5e60('0x43')]=_[_0x5e60('0x42')](_0x42ac7c[_0x5e60('0x3d')],qs[_0x5e60('0x44')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x44')]));_0x1d95fd[_0x5e60('0x43')]=_0x1d95fd[_0x5e60('0x43')][_0x5e60('0x45')]?_0x1d95fd['attributes']:_0x42ac7c[_0x5e60('0x3d')];_0x1d95fd[_0x5e60('0x48')]=qs[_0x5e60('0x49')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x49')]);_0x1d95fd[_0x5e60('0x4a')]=qs[_0x5e60('0x41')](_[_0x5e60('0x59')](_0x58640c[_0x5e60('0x40')],_0x42ac7c[_0x5e60('0x41')]));if(_0x58640c[_0x5e60('0x40')][_0x5e60('0x4b')]){_0x1d95fd[_0x5e60('0x4a')]=_[_0x5e60('0x4c')](_0x1d95fd[_0x5e60('0x4a')],{'$or':_[_0x5e60('0x3e')](_0x1d95fd[_0x5e60('0x43')],function(_0x36d256){var _0x358bb5={};_0x358bb5[_0x36d256]={'$like':'%'+_0x58640c[_0x5e60('0x40')]['filter']+'%'};return _0x358bb5;})});}_0x1d95fd=_[_0x5e60('0x4c')]({},_0x1d95fd,_0x58640c[_0x5e60('0x4d')]);return _0x2afb9c[_0x5e60('0x5c')](_0x1d95fd);}})['then'](function(_0x4a4417){if(_0x4a4417){_0x530e04=_0x4a4417[_0x5e60('0x45')];if(!_0x58640c[_0x5e60('0x40')][_0x5e60('0x46')](_0x5e60('0x47'))){_0x1d95fd[_0x5e60('0x2f')]=qs[_0x5e60('0x2f')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x2f')]);_0x1d95fd[_0x5e60('0x2e')]=qs[_0x5e60('0x2e')](_0x58640c[_0x5e60('0x40')][_0x5e60('0x2e')]);}return _0x2afb9c[_0x5e60('0x5c')](_0x1d95fd);}})[_0x5e60('0x1f')](function(_0x30e4a7){if(_0x30e4a7){return _0x30e4a7?{'count':_0x530e04,'rows':_0x30e4a7}:null;}})[_0x5e60('0x1f')](respondWithResult(_0x120fab,null))[_0x5e60('0x29')](handleError(_0x120fab,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 43c3808..5b85a2b 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 _0x9bbd=['int_servicenow_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x9bbd,0x198));var _0xd9bb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9bbd[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9bb('0x0'))(_0xd9bb('0x1'));var moment=require(_0xd9bb('0x2'));var BPromise=require(_0xd9bb('0x3'));var rp=require(_0xd9bb('0x4'));var fs=require('fs');var path=require(_0xd9bb('0x5'));var rimraf=require(_0xd9bb('0x6'));var config=require(_0xd9bb('0x7'));var attributes=require(_0xd9bb('0x8'));module[_0xd9bb('0x9')]=function(_0x2a6001,_0x5a7e41){return _0x2a6001['define']('ServicenowConfiguration',attributes,{'tableName':_0xd9bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a0a=['ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x2bea9e,_0x24366b){var _0x5395c6=function(_0x35a35d){while(--_0x35a35d){_0x2bea9e['push'](_0x2bea9e['shift']());}};_0x5395c6(++_0x24366b);}(_0x4a0a,0x9c));var _0xa4a0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4a0a[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0xa4a0('0x0'));var logger=require(_0xa4a0('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa4a0('0x2'));var rp=require(_0xa4a0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a0('0x4'));var config=require(_0xa4a0('0x5'));var attributes=require(_0xa4a0('0x6'));module[_0xa4a0('0x7')]=function(_0x12205f,_0x34521d){return _0x12205f[_0xa4a0('0x8')](_0xa4a0('0x9'),attributes,{'tableName':_0xa4a0('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 ea5ad9c..cdad8ec 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 _0xf9e0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x383e67,_0x502254){var _0x1c63f4=function(_0x5efa98){while(--_0x5efa98){_0x383e67['push'](_0x383e67['shift']());}};_0x1c63f4(++_0x502254);}(_0xf9e0,0x65));var _0x0f9e=function(_0x48028d,_0x204d4e){_0x48028d=_0x48028d-0x0;var _0x4b177d=_0xf9e0[_0x48028d];return _0x4b177d;};'use strict';var _=require(_0x0f9e('0x0'));var util=require(_0x0f9e('0x1'));var moment=require(_0x0f9e('0x2'));var BPromise=require(_0x0f9e('0x3'));var rs=require(_0x0f9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f9e('0x5'))['db'];var utils=require(_0x0f9e('0x6'));var logger=require(_0x0f9e('0x7'))(_0x0f9e('0x8'));var config=require(_0x0f9e('0x9'));var jayson=require(_0x0f9e('0xa'));var client=jayson[_0x0f9e('0xb')][_0x0f9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4d79e9,_0xcfbbf4,_0x3bb29d){return new BPromise(function(_0x39ef86,_0xf0544b){return client[_0x0f9e('0xd')](_0x4d79e9,_0x3bb29d)[_0x0f9e('0xe')](function(_0x1cdb5a){logger[_0x0f9e('0xf')](_0x0f9e('0x10'),_0xcfbbf4,'request\x20sent');logger[_0x0f9e('0x11')](_0x0f9e('0x12'),_0xcfbbf4,_0x0f9e('0x13'),JSON[_0x0f9e('0x14')](_0x1cdb5a));if(_0x1cdb5a['error']){if(_0x1cdb5a['error']['code']===0x1f4){logger[_0x0f9e('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0xcfbbf4,_0x1cdb5a[_0x0f9e('0x15')][_0x0f9e('0x16')]);return _0xf0544b(_0x1cdb5a['error'][_0x0f9e('0x16')]);}logger[_0x0f9e('0x15')](_0x0f9e('0x10'),_0xcfbbf4,_0x1cdb5a[_0x0f9e('0x15')][_0x0f9e('0x16')]);return _0x39ef86(_0x1cdb5a[_0x0f9e('0x15')]['message']);}else{logger[_0x0f9e('0xf')](_0x0f9e('0x10'),_0xcfbbf4,_0x0f9e('0x13'));_0x39ef86(_0x1cdb5a[_0x0f9e('0x17')]['message']);}})[_0x0f9e('0x18')](function(_0x1b60c2){logger['error'](_0x0f9e('0x10'),_0xcfbbf4,_0x1b60c2);_0xf0544b(_0x1b60c2);});});} \ No newline at end of file +var _0xaefa=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x35b4ed,_0x46193c){var _0x4f594a=function(_0x5e7140){while(--_0x5e7140){_0x35b4ed['push'](_0x35b4ed['shift']());}};_0x4f594a(++_0x46193c);}(_0xaefa,0xe6));var _0xaaef=function(_0x59eeac,_0x3b7109){_0x59eeac=_0x59eeac-0x0;var _0x5e11da=_0xaefa[_0x59eeac];return _0x5e11da;};'use strict';var _=require('lodash');var util=require(_0xaaef('0x0'));var moment=require(_0xaaef('0x1'));var BPromise=require(_0xaaef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaef('0x3'));var db=require(_0xaaef('0x4'))['db'];var utils=require(_0xaaef('0x5'));var logger=require(_0xaaef('0x6'))('rpc');var config=require(_0xaaef('0x7'));var jayson=require(_0xaaef('0x8'));var client=jayson[_0xaaef('0x9')][_0xaaef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26779a,_0x13ee62,_0x2282da){return new BPromise(function(_0x39e53c,_0x42e29e){return client[_0xaaef('0xb')](_0x26779a,_0x2282da)[_0xaaef('0xc')](function(_0x40cb56){logger[_0xaaef('0xd')](_0xaaef('0xe'),_0x13ee62,_0xaaef('0xf'));logger[_0xaaef('0x10')](_0xaaef('0x11'),_0x13ee62,_0xaaef('0xf'),JSON['stringify'](_0x40cb56));if(_0x40cb56[_0xaaef('0x12')]){if(_0x40cb56['error']['code']===0x1f4){logger[_0xaaef('0x12')](_0xaaef('0xe'),_0x13ee62,_0x40cb56['error'][_0xaaef('0x13')]);return _0x42e29e(_0x40cb56[_0xaaef('0x12')][_0xaaef('0x13')]);}logger[_0xaaef('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13ee62,_0x40cb56[_0xaaef('0x12')]['message']);return _0x39e53c(_0x40cb56['error'][_0xaaef('0x13')]);}else{logger[_0xaaef('0xd')](_0xaaef('0xe'),_0x13ee62,_0xaaef('0xf'));_0x39e53c(_0x40cb56[_0xaaef('0x14')][_0xaaef('0x13')]);}})[_0xaaef('0x15')](function(_0x308d38){logger[_0xaaef('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x13ee62,_0x308d38);_0x42e29e(_0x308d38);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c24ac77..809b074 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 _0xa90d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','create','update','delete','/:id','destroy','exports'];(function(_0x294cf1,_0x5d6a40){var _0x334402=function(_0x5b07f0){while(--_0x5b07f0){_0x294cf1['push'](_0x294cf1['shift']());}};_0x334402(++_0x5d6a40);}(_0xa90d,0x77));var _0xda90=function(_0x59696e,_0x317b40){_0x59696e=_0x59696e-0x0;var _0x46dd2f=_0xa90d[_0x59696e];return _0x46dd2f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda90('0x0'));var timeout=require(_0xda90('0x1'));var express=require(_0xda90('0x2'));var router=express[_0xda90('0x3')]();var auth=require(_0xda90('0x4'));var interaction=require(_0xda90('0x5'));var config=require(_0xda90('0x6'));var controller=require(_0xda90('0x7'));router['get']('/',auth[_0xda90('0x8')](),controller[_0xda90('0x9')]);router[_0xda90('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xda90('0x8')](),controller[_0xda90('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xda90('0xc')]);router[_0xda90('0xd')](_0xda90('0xe'),auth[_0xda90('0x8')](),controller[_0xda90('0xf')]);module[_0xda90('0x10')]=router; \ No newline at end of file +var _0x14bf=['put','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create'];(function(_0x104869,_0x33bf2a){var _0x4afff6=function(_0x1de8f9){while(--_0x1de8f9){_0x104869['push'](_0x104869['shift']());}};_0x4afff6(++_0x33bf2a);}(_0x14bf,0x89));var _0xf14b=function(_0x229a7f,_0x2afec8){_0x229a7f=_0x229a7f-0x0;var _0x547a77=_0x14bf[_0x229a7f];return _0x547a77;};'use strict';var multer=require(_0xf14b('0x0'));var util=require(_0xf14b('0x1'));var path=require('path');var timeout=require(_0xf14b('0x2'));var express=require(_0xf14b('0x3'));var router=express[_0xf14b('0x4')]();var auth=require(_0xf14b('0x5'));var interaction=require(_0xf14b('0x6'));var config=require(_0xf14b('0x7'));var controller=require('./intServicenowField.controller');router[_0xf14b('0x8')]('/',auth[_0xf14b('0x9')](),controller[_0xf14b('0xa')]);router[_0xf14b('0x8')](_0xf14b('0xb'),auth[_0xf14b('0x9')](),controller['show']);router['post']('/',auth[_0xf14b('0x9')](),controller[_0xf14b('0xc')]);router[_0xf14b('0xd')](_0xf14b('0xb'),auth[_0xf14b('0x9')](),controller['update']);router[_0xf14b('0xe')](_0xf14b('0xb'),auth[_0xf14b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 002b267..3ae9710 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 _0x6082=['customVariable','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x482d01,_0x43f5e8){var _0x4bd836=function(_0x44d9ec){while(--_0x44d9ec){_0x482d01['push'](_0x482d01['shift']());}};_0x4bd836(++_0x43f5e8);}(_0x6082,0x134));var _0x2608=function(_0x195ade,_0x5bac67){_0x195ade=_0x195ade-0x0;var _0x372178=_0x6082[_0x195ade];return _0x372178;};'use strict';var Sequelize=require(_0x2608('0x0'));module[_0x2608('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2608('0x2'),_0x2608('0x3'),_0x2608('0x4'),'keyValue'),'defaultValue':_0x2608('0x2')},'content':{'type':Sequelize[_0x2608('0x5')]},'key':{'type':Sequelize[_0x2608('0x5')]},'keyType':{'type':Sequelize[_0x2608('0x6')](_0x2608('0x2'),_0x2608('0x3'),_0x2608('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2608('0x5')]},'customField':{'type':Sequelize[_0x2608('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2608('0x5')]}}; \ No newline at end of file +var _0x6a7b=['customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x46f66d,_0xfd7c7a){var _0x56dbd2=function(_0x2600d7){while(--_0x2600d7){_0x46f66d['push'](_0x46f66d['shift']());}};_0x56dbd2(++_0xfd7c7a);}(_0x6a7b,0x9d));var _0xb6a7=function(_0x547b27,_0x146be0){_0x547b27=_0x547b27-0x0;var _0x3ed0eb=_0x6a7b[_0x547b27];return _0x3ed0eb;};'use strict';var Sequelize=require(_0xb6a7('0x0'));module['exports']={'type':{'type':Sequelize[_0xb6a7('0x1')](_0xb6a7('0x2'),'variable',_0xb6a7('0x3'),_0xb6a7('0x4')),'defaultValue':_0xb6a7('0x2')},'content':{'type':Sequelize[_0xb6a7('0x5')]},'key':{'type':Sequelize[_0xb6a7('0x5')]},'keyType':{'type':Sequelize[_0xb6a7('0x1')]('string',_0xb6a7('0x6'),_0xb6a7('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb6a7('0x5')]},'nameField':{'type':Sequelize[_0xb6a7('0x5')]},'customField':{'type':Sequelize[_0xb6a7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb6a7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f9ebd64..9c7bdb8 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x584dbc,_0x4b102c){var _0x554b9a=function(_0x17b669){while(--_0x17b669){_0x584dbc['push'](_0x584dbc['shift']());}};_0x554b9a(++_0x4b102c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x5b3ccf,_0x52a11a){var _0x197442=function(_0x51cfe8){while(--_0x51cfe8){_0x5b3ccf['push'](_0x5b3ccf['shift']());}};_0x197442(++_0x52a11a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 484e61b..ecb274c 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 _0xc685=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0xc685,0x1a9));var _0x5c68=function(_0x1bcdc8,_0x27b1bf){_0x1bcdc8=_0x1bcdc8-0x0;var _0x1cb6ed=_0xc685[_0x1bcdc8];return _0x1cb6ed;};'use strict';var _=require(_0x5c68('0x0'));var util=require(_0x5c68('0x1'));var logger=require(_0x5c68('0x2'))('api');var moment=require(_0x5c68('0x3'));var BPromise=require(_0x5c68('0x4'));var rp=require(_0x5c68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c68('0x6'));var config=require(_0x5c68('0x7'));var attributes=require(_0x5c68('0x8'));module[_0x5c68('0x9')]=function(_0x51d11b,_0x192fdb){return _0x51d11b[_0x5c68('0xa')](_0x5c68('0xb'),attributes,{'tableName':_0x5c68('0xc'),'paranoid':![],'indexes':[{'name':_0x5c68('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89f5=['rimraf','./intServicenowField.attributes','define','ServicenowField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1266d4,_0x325423){var _0x4698bb=function(_0xf5edd2){while(--_0xf5edd2){_0x1266d4['push'](_0x1266d4['shift']());}};_0x4698bb(++_0x325423);}(_0x89f5,0x119));var _0x589f=function(_0x359877,_0x2434a7){_0x359877=_0x359877-0x0;var _0x4d783c=_0x89f5[_0x359877];return _0x4d783c;};'use strict';var _=require(_0x589f('0x0'));var util=require(_0x589f('0x1'));var logger=require(_0x589f('0x2'))(_0x589f('0x3'));var moment=require(_0x589f('0x4'));var BPromise=require(_0x589f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x589f('0x6'));var rimraf=require(_0x589f('0x7'));var config=require('../../config/environment');var attributes=require(_0x589f('0x8'));module['exports']=function(_0x5d9314,_0x5a0157){return _0x5d9314[_0x589f('0x9')](_0x589f('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x589f('0xb')],'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 4dc4b73..efee47f 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 _0xf591=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf591,0x1e2));var _0x1f59=function(_0x37c279,_0x4f9587){_0x37c279=_0x37c279-0x0;var _0x1024bc=_0xf591[_0x37c279];return _0x1024bc;};'use strict';var _=require('lodash');var util=require(_0x1f59('0x0'));var moment=require('moment');var BPromise=require(_0x1f59('0x1'));var rs=require(_0x1f59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f59('0x3'))['db'];var utils=require(_0x1f59('0x4'));var logger=require(_0x1f59('0x5'))(_0x1f59('0x6'));var config=require('../../config/environment');var jayson=require(_0x1f59('0x7'));var client=jayson[_0x1f59('0x8')][_0x1f59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6f9be,_0x1c321f,_0x3b15b5){return new BPromise(function(_0xebfeb4,_0x326cf1){return client['request'](_0x6f9be,_0x3b15b5)['then'](function(_0x3e0c76){logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,_0x1f59('0xc'));logger[_0x1f59('0xd')](_0x1f59('0xe'),_0x1c321f,_0x1f59('0xc'),JSON[_0x1f59('0xf')](_0x3e0c76));if(_0x3e0c76[_0x1f59('0x10')]){if(_0x3e0c76[_0x1f59('0x10')]['code']===0x1f4){logger['error'](_0x1f59('0xb'),_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0x326cf1(_0x3e0c76[_0x1f59('0x10')]['message']);}logger[_0x1f59('0x10')]('ServicenowField,\x20%s,\x20%s',_0x1c321f,_0x3e0c76['error'][_0x1f59('0x11')]);return _0xebfeb4(_0x3e0c76['error'][_0x1f59('0x11')]);}else{logger[_0x1f59('0xa')](_0x1f59('0xb'),_0x1c321f,'request\x20sent');_0xebfeb4(_0x3e0c76[_0x1f59('0x12')][_0x1f59('0x11')]);}})[_0x1f59('0x13')](function(_0x4520ff){logger[_0x1f59('0x10')](_0x1f59('0xb'),_0x1c321f,_0x4520ff);_0x326cf1(_0x4520ff);});});} \ No newline at end of file +var _0xe686=['../../config/environment','client','http','then','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4299f9,_0x2e94f6){var _0x521f3a=function(_0x3e64cb){while(--_0x3e64cb){_0x4299f9['push'](_0x4299f9['shift']());}};_0x521f3a(++_0x2e94f6);}(_0xe686,0xbe));var _0x6e68=function(_0x3ee9ca,_0x453505){_0x3ee9ca=_0x3ee9ca-0x0;var _0x3d1bcb=_0xe686[_0x3ee9ca];return _0x3d1bcb;};'use strict';var _=require(_0x6e68('0x0'));var util=require(_0x6e68('0x1'));var moment=require(_0x6e68('0x2'));var BPromise=require(_0x6e68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e68('0x5'));var logger=require(_0x6e68('0x6'))(_0x6e68('0x7'));var config=require(_0x6e68('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6e68('0x9')][_0x6e68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55950a,_0x26f389,_0x420ca8){return new BPromise(function(_0x37d09a,_0x29c4b5){return client['request'](_0x55950a,_0x420ca8)[_0x6e68('0xb')](function(_0x17d923){logger['info'](_0x6e68('0xc'),_0x26f389,_0x6e68('0xd'));logger[_0x6e68('0xe')](_0x6e68('0xf'),_0x26f389,_0x6e68('0xd'),JSON[_0x6e68('0x10')](_0x17d923));if(_0x17d923[_0x6e68('0x11')]){if(_0x17d923[_0x6e68('0x11')][_0x6e68('0x12')]===0x1f4){logger[_0x6e68('0x11')](_0x6e68('0xc'),_0x26f389,_0x17d923[_0x6e68('0x11')][_0x6e68('0x13')]);return _0x29c4b5(_0x17d923[_0x6e68('0x11')][_0x6e68('0x13')]);}logger['error'](_0x6e68('0xc'),_0x26f389,_0x17d923[_0x6e68('0x11')][_0x6e68('0x13')]);return _0x37d09a(_0x17d923[_0x6e68('0x11')]['message']);}else{logger[_0x6e68('0x14')]('ServicenowField,\x20%s,\x20%s',_0x26f389,_0x6e68('0xd'));_0x37d09a(_0x17d923['result'][_0x6e68('0x13')]);}})[_0x6e68('0x15')](function(_0x1c060a){logger[_0x6e68('0x11')](_0x6e68('0xc'),_0x26f389,_0x1c060a);_0x29c4b5(_0x1c060a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e70499a..3f5299d 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 _0xba9d=['/:id','/:id/configurations','getConfigurations','post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x44de94,_0x58cc91){var _0x5718c6=function(_0x245db1){while(--_0x245db1){_0x44de94['push'](_0x44de94['shift']());}};_0x5718c6(++_0x58cc91);}(_0xba9d,0xa9));var _0xdba9=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xba9d[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xdba9('0x0'));var util=require(_0xdba9('0x1'));var path=require(_0xdba9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdba9('0x3')]();var auth=require(_0xdba9('0x4'));var interaction=require(_0xdba9('0x5'));var config=require(_0xdba9('0x6'));var controller=require(_0xdba9('0x7'));router[_0xdba9('0x8')]('/',auth[_0xdba9('0x9')](),controller[_0xdba9('0xa')]);router[_0xdba9('0x8')](_0xdba9('0xb'),auth[_0xdba9('0x9')](),controller['show']);router[_0xdba9('0x8')](_0xdba9('0xc'),auth['isAuthenticated'](),controller[_0xdba9('0xd')]);router[_0xdba9('0x8')]('/:id/fields',auth[_0xdba9('0x9')](),controller['getFields']);router[_0xdba9('0xe')]('/',auth[_0xdba9('0x9')](),controller[_0xdba9('0xf')]);router[_0xdba9('0xe')](_0xdba9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xdba9('0x10')](_0xdba9('0xb'),auth['isAuthenticated'](),controller[_0xdba9('0x11')]);router[_0xdba9('0x12')](_0xdba9('0xb'),auth[_0xdba9('0x9')](),controller['destroy']);module[_0xdba9('0x13')]=router; \ No newline at end of file +var _0xd5ba=['getConfigurations','/:id/fields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x1abf16,_0x1557e8){var _0x4d6204=function(_0x5f4d23){while(--_0x5f4d23){_0x1abf16['push'](_0x1abf16['shift']());}};_0x4d6204(++_0x1557e8);}(_0xd5ba,0x77));var _0xad5b=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xd5ba[_0x599e60];return _0x468e19;};'use strict';var multer=require(_0xad5b('0x0'));var util=require(_0xad5b('0x1'));var path=require('path');var timeout=require(_0xad5b('0x2'));var express=require(_0xad5b('0x3'));var router=express[_0xad5b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xad5b('0x5'));var config=require(_0xad5b('0x6'));var controller=require(_0xad5b('0x7'));router['get']('/',auth[_0xad5b('0x8')](),controller[_0xad5b('0x9')]);router[_0xad5b('0xa')](_0xad5b('0xb'),auth['isAuthenticated'](),controller[_0xad5b('0xc')]);router[_0xad5b('0xa')]('/:id/configurations',auth[_0xad5b('0x8')](),controller[_0xad5b('0xd')]);router[_0xad5b('0xa')](_0xad5b('0xe'),auth[_0xad5b('0x8')](),controller['getFields']);router['post']('/',auth[_0xad5b('0x8')](),controller[_0xad5b('0xf')]);router['post']('/:id/configurations',auth[_0xad5b('0x8')](),controller[_0xad5b('0x10')]);router[_0xad5b('0x11')](_0xad5b('0xb'),auth['isAuthenticated'](),controller[_0xad5b('0x12')]);router[_0xad5b('0x13')](_0xad5b('0xb'),auth[_0xad5b('0x8')](),controller[_0xad5b('0x14')]);module[_0xad5b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index d23be98..b2bd87b 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 _0xa031=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5cf48a,_0x4c16d6){var _0x480965=function(_0xefec16){while(--_0xefec16){_0x5cf48a['push'](_0x5cf48a['shift']());}};_0x480965(++_0x4c16d6);}(_0xa031,0x8b));var _0x1a03=function(_0x5d81ec,_0x34eeb1){_0x5d81ec=_0x5d81ec-0x0;var _0x3107e4=_0xa031[_0x5d81ec];return _0x3107e4;};'use strict';var Sequelize=require(_0x1a03('0x0'));module[_0x1a03('0x1')]={'name':{'type':Sequelize[_0x1a03('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1a03('0x2')],'unique':_0x1a03('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1a03('0x2')],'unique':_0x1a03('0x4')},'serverUrl':{'type':Sequelize[_0x1a03('0x2')]}}; \ No newline at end of file +var _0x67cb=['sequelize','STRING','username'];(function(_0x328299,_0x2d7a89){var _0x4a6b3c=function(_0x241dd6){while(--_0x241dd6){_0x328299['push'](_0x328299['shift']());}};_0x4a6b3c(++_0x2d7a89);}(_0x67cb,0x19e));var _0xb67c=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x67cb[_0x5235a6];return _0x1cf37e;};'use strict';var Sequelize=require(_0xb67c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb67c('0x1')]},'description':{'type':Sequelize[_0xb67c('0x1')]},'username':{'type':Sequelize[_0xb67c('0x1')],'unique':_0xb67c('0x2')},'password':{'type':Sequelize[_0xb67c('0x1')]},'remoteUri':{'type':Sequelize[_0xb67c('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 06eb8e0..f25a3a7 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 _0x9adb=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','sort','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','Sequelize','ValidationError','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','end','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5e6ef3,_0x5a092f){var _0x1a82b2=function(_0x176265){while(--_0x176265){_0x5e6ef3['push'](_0x5e6ef3['shift']());}};_0x1a82b2(++_0x5a092f);}(_0x9adb,0x1b8));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xb9ad('0x0'));var emlformat=require(_0xb9ad('0x1'));var rimraf=require(_0xb9ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9ad('0x3'));var rp=require(_0xb9ad('0x4'));var moment=require(_0xb9ad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb9ad('0x6'));var path=require(_0xb9ad('0x7'));var sox=require(_0xb9ad('0x8'));var csv=require(_0xb9ad('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb9ad('0xa'));var crypto=require(_0xb9ad('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb9ad('0xc'));var toCsv=require(_0xb9ad('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9ad('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9ad('0xe'));var logger=require('../../config/logger')(_0xb9ad('0xf'));var utils=require('../../config/utils');var config=require(_0xb9ad('0x10'));var db=require(_0xb9ad('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb9ad('0x12')]['http']({'port':0x232a});function checkPasswordPattern(_0x2a94b1,_0x3eebfa,_0x53fc05){if(_0x53fc05){var _0x738351=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x738351['test'](_0x3eebfa)){return _0x2a94b1;}else{throw new db[(_0xb9ad('0x13'))][(_0xb9ad('0x14'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2a94b1;}}function respondWithRpcPromise(_0xc036db,_0x390541,_0x3db6ec,_0xdaefb4){return new BPromise(function(_0x3ee7b0,_0x48f9fc){var _0x393a34=_0xdaefb4||client;return _0x393a34[_0xb9ad('0x15')](_0xc036db,_0x3db6ec)[_0xb9ad('0x16')](function(_0x5033d3){logger[_0xb9ad('0x17')](_0xb9ad('0x18'),_0x390541,_0xb9ad('0x19'));logger[_0xb9ad('0x1a')](_0xb9ad('0x1b'),_0x390541,'request\x20sent',JSON[_0xb9ad('0x1c')](_0x5033d3));if(_0x5033d3[_0xb9ad('0x1d')]){if(_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1e')]===0x1f4){logger[_0xb9ad('0x1d')](_0xb9ad('0x18'),_0x390541,_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1f')]);return _0x48f9fc(_0x5033d3['error'][_0xb9ad('0x1f')]);}logger[_0xb9ad('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x390541,_0x5033d3[_0xb9ad('0x1d')]['message']);return _0x3ee7b0(_0x5033d3[_0xb9ad('0x1d')][_0xb9ad('0x1f')]);}else{logger[_0xb9ad('0x17')](_0xb9ad('0x18'),_0x390541,_0xb9ad('0x19'));_0x3ee7b0(_0x5033d3['result']['message']);}})['catch'](function(_0xdacc49){logger['error'](_0xb9ad('0x18'),_0x390541,_0xdacc49);_0x48f9fc(_0xdacc49);});});}function respondWithStatusCode(_0x183a03,_0x93909c){_0x93909c=_0x93909c||0xcc;return function(_0x5b68e0){if(_0x5b68e0){return _0x183a03[_0xb9ad('0x20')](_0x93909c);}return _0x183a03[_0xb9ad('0x21')](_0x93909c)['end']();};}function respondWithResult(_0x3b8653,_0x3f589a){_0x3f589a=_0x3f589a||0xc8;return function(_0x39b055){if(_0x39b055){return _0x3b8653['status'](_0x3f589a)[_0xb9ad('0x22')](_0x39b055);}};}function respondWithFilteredResult(_0x5c336f,_0x2f2de4){return function(_0x197db1){if(_0x197db1){var _0x57aff8=_0x197db1[_0xb9ad('0x23')],_0x55d213=_0x2f2de4[_0xb9ad('0x24')],_0x1e08a2=_0x2f2de4[_0xb9ad('0x24')]+_0x2f2de4[_0xb9ad('0x25')],_0x58ddad;if(_0x1e08a2>=_0x57aff8){_0x1e08a2=_0x57aff8;_0x58ddad=0xc8;}else{_0x58ddad=0xce;}_0x5c336f[_0xb9ad('0x21')](_0x58ddad);return _0x5c336f[_0xb9ad('0x26')](_0xb9ad('0x27'),_0x55d213+'-'+_0x1e08a2+'/'+_0x57aff8)[_0xb9ad('0x22')](_0x197db1);}return null;};}function patchUpdates(_0x1233b2){return function(_0x4e06af){try{jsonpatch['apply'](_0x4e06af,_0x1233b2,!![]);}catch(_0x344dfd){return BPromise[_0xb9ad('0x28')](_0x344dfd);}return _0x4e06af['save']();};}function saveUpdates(_0x21c375,_0x5581fd){return function(_0x23346c){if(_0x23346c){return _0x23346c[_0xb9ad('0x29')](_0x21c375)[_0xb9ad('0x16')](function(_0x19e4df){return _0x19e4df;});}return null;};}function removeEntity(_0x28fcab,_0xef58cf){return function(_0x53034f){if(_0x53034f){return _0x53034f[_0xb9ad('0x2a')]()[_0xb9ad('0x16')](function(){_0x28fcab[_0xb9ad('0x21')](0xcc)[_0xb9ad('0x2b')]();});}};}function handleEntityNotFound(_0x226a3c,_0x4c2dcf){return function(_0x2063fb){if(!_0x2063fb){_0x226a3c[_0xb9ad('0x20')](0x194);}return _0x2063fb;};}function handleError(_0x8fade8,_0x4fdaab){_0x4fdaab=_0x4fdaab||0x1f4;return function(_0x67ea58){logger[_0xb9ad('0x1d')](_0x67ea58[_0xb9ad('0x2c')]);if(_0x67ea58[_0xb9ad('0x2d')]){delete _0x67ea58[_0xb9ad('0x2d')];}_0x8fade8[_0xb9ad('0x21')](_0x4fdaab)[_0xb9ad('0x2e')](_0x67ea58);};}exports[_0xb9ad('0x2f')]=function(_0x5a8afc,_0x576b32){var _0x538777={},_0x154ded={},_0xf17b61={'count':0x0,'rows':[]};var _0x3f626c=_[_0xb9ad('0x30')](db[_0xb9ad('0x31')]['rawAttributes'],function(_0x185cb6){return{'name':_0x185cb6[_0xb9ad('0x32')],'type':_0x185cb6[_0xb9ad('0x33')][_0xb9ad('0x34')]};});_0x154ded[_0xb9ad('0x35')]=_[_0xb9ad('0x30')](_0x3f626c,_0xb9ad('0x2d'));_0x154ded['query']=_['keys'](_0x5a8afc[_0xb9ad('0x36')]);_0x154ded[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x154ded['model'],_0x154ded[_0xb9ad('0x36')]);_0x538777['attributes']=_['intersection'](_0x154ded['model'],qs[_0xb9ad('0x39')](_0x5a8afc[_0xb9ad('0x36')]['fields']));_0x538777[_0xb9ad('0x3a')]=_0x538777[_0xb9ad('0x3a')]['length']?_0x538777[_0xb9ad('0x3a')]:_0x154ded[_0xb9ad('0x35')];if(!_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x3b')](_0xb9ad('0x3c'))){_0x538777[_0xb9ad('0x25')]=qs['limit'](_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x25')]);_0x538777['offset']=qs[_0xb9ad('0x24')](_0x5a8afc['query'][_0xb9ad('0x24')]);}_0x538777[_0xb9ad('0x3d')]=qs['sort'](_0x5a8afc['query']['sort']);_0x538777[_0xb9ad('0x3e')]=qs[_0xb9ad('0x37')](_[_0xb9ad('0x3f')](_0x5a8afc[_0xb9ad('0x36')],_0x154ded[_0xb9ad('0x37')]),_0x3f626c);if(_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x40')]){_0x538777[_0xb9ad('0x3e')]=_[_0xb9ad('0x41')](_0x538777['where'],{'$or':_['map'](_0x3f626c,function(_0xe027a7){if(_0xe027a7[_0xb9ad('0x33')]!==_0xb9ad('0x42')){var _0x469c8e={};_0x469c8e[_0xe027a7[_0xb9ad('0x2d')]]={'$like':'%'+_0x5a8afc['query'][_0xb9ad('0x40')]+'%'};return _0x469c8e;}})});}_0x538777=_[_0xb9ad('0x41')]({},_0x538777,_0x5a8afc[_0xb9ad('0x43')]);var _0x56587a={'where':_0x538777[_0xb9ad('0x3e')]};return db['SugarcrmAccount'][_0xb9ad('0x23')](_0x56587a)['then'](function(_0x15f152){_0xf17b61[_0xb9ad('0x23')]=_0x15f152;if(_0x5a8afc[_0xb9ad('0x36')][_0xb9ad('0x44')]){_0x538777[_0xb9ad('0x45')]=[{'all':!![]}];}return db[_0xb9ad('0x31')][_0xb9ad('0x46')](_0x538777);})[_0xb9ad('0x16')](function(_0x40c097){_0xf17b61[_0xb9ad('0x47')]=_0x40c097;return _0xf17b61;})[_0xb9ad('0x16')](respondWithFilteredResult(_0x576b32,_0x538777))[_0xb9ad('0x48')](handleError(_0x576b32,null));};exports[_0xb9ad('0x49')]=function(_0x21d58d,_0x4349e8){var _0x142e53={'raw':![],'where':{'id':_0x21d58d[_0xb9ad('0x4a')]['id']}},_0x4d2fd4={};_0x4d2fd4['model']=_['keys'](db[_0xb9ad('0x31')][_0xb9ad('0x4b')]);_0x4d2fd4[_0xb9ad('0x36')]=_[_0xb9ad('0x4c')](_0x21d58d[_0xb9ad('0x36')]);_0x4d2fd4[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x4d2fd4['model'],_0x4d2fd4[_0xb9ad('0x36')]);_0x142e53[_0xb9ad('0x3a')]=_[_0xb9ad('0x38')](_0x4d2fd4[_0xb9ad('0x35')],qs[_0xb9ad('0x39')](_0x21d58d[_0xb9ad('0x36')][_0xb9ad('0x39')]));_0x142e53['attributes']=_0x142e53[_0xb9ad('0x3a')][_0xb9ad('0x4d')]?_0x142e53['attributes']:_0x4d2fd4[_0xb9ad('0x35')];if(_0x21d58d[_0xb9ad('0x36')][_0xb9ad('0x44')]){_0x142e53[_0xb9ad('0x45')]=[{'all':!![]}];}_0x142e53=_[_0xb9ad('0x41')]({},_0x142e53,_0x21d58d['options']);return db[_0xb9ad('0x31')][_0xb9ad('0x4e')](_0x142e53)[_0xb9ad('0x16')](handleEntityNotFound(_0x4349e8,null))[_0xb9ad('0x16')](respondWithResult(_0x4349e8,null))[_0xb9ad('0x48')](handleError(_0x4349e8,null));};exports[_0xb9ad('0x4f')]=function(_0x457f18,_0xfea18c){return db[_0xb9ad('0x31')][_0xb9ad('0x4f')](_0x457f18[_0xb9ad('0x50')],{})[_0xb9ad('0x16')](respondWithResult(_0xfea18c,0xc9))[_0xb9ad('0x48')](handleError(_0xfea18c,null));};exports[_0xb9ad('0x29')]=function(_0x40c9a2,_0x19e0ec){if(_0x40c9a2['body']['id']){delete _0x40c9a2[_0xb9ad('0x50')]['id'];}return db[_0xb9ad('0x31')][_0xb9ad('0x4e')]({'where':{'id':_0x40c9a2[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x19e0ec,null))[_0xb9ad('0x16')](saveUpdates(_0x40c9a2[_0xb9ad('0x50')],null))[_0xb9ad('0x16')](respondWithResult(_0x19e0ec,null))['catch'](handleError(_0x19e0ec,null));};exports[_0xb9ad('0x2a')]=function(_0x3518b8,_0x360387){return db[_0xb9ad('0x31')]['find']({'where':{'id':_0x3518b8['params']['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x360387,null))[_0xb9ad('0x16')](removeEntity(_0x360387,null))[_0xb9ad('0x48')](handleError(_0x360387,null));};exports[_0xb9ad('0x51')]=function(_0xf83216,_0x1b72bd,_0x54a993){var _0x3dac99={};var _0x1e3099={};var _0x3bf62e;var _0x1b4cca;return db[_0xb9ad('0x31')][_0xb9ad('0x52')]({'where':{'id':_0xf83216[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x1b72bd,null))[_0xb9ad('0x16')](function(_0x16ee7c){if(_0x16ee7c){_0x3bf62e=_0x16ee7c;_0x1e3099[_0xb9ad('0x35')]=_[_0xb9ad('0x4c')](db[_0xb9ad('0x53')][_0xb9ad('0x4b')]);_0x1e3099[_0xb9ad('0x36')]=_[_0xb9ad('0x4c')](_0xf83216[_0xb9ad('0x36')]);_0x1e3099[_0xb9ad('0x37')]=_[_0xb9ad('0x38')](_0x1e3099[_0xb9ad('0x35')],_0x1e3099[_0xb9ad('0x36')]);_0x3dac99[_0xb9ad('0x3a')]=_[_0xb9ad('0x38')](_0x1e3099[_0xb9ad('0x35')],qs[_0xb9ad('0x39')](_0xf83216[_0xb9ad('0x36')]['fields']));_0x3dac99[_0xb9ad('0x3a')]=_0x3dac99[_0xb9ad('0x3a')]['length']?_0x3dac99['attributes']:_0x1e3099['model'];_0x3dac99['order']=qs[_0xb9ad('0x54')](_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x54')]);_0x3dac99[_0xb9ad('0x3e')]=qs[_0xb9ad('0x37')](_[_0xb9ad('0x3f')](_0xf83216[_0xb9ad('0x36')],_0x1e3099[_0xb9ad('0x37')]));if(_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x40')]){_0x3dac99[_0xb9ad('0x3e')]=_['merge'](_0x3dac99['where'],{'$or':_[_0xb9ad('0x30')](_0x3dac99[_0xb9ad('0x3a')],function(_0x334818){var _0x214ec4={};_0x214ec4[_0x334818]={'$like':'%'+_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x40')]+'%'};return _0x214ec4;})});}_0x3dac99=_[_0xb9ad('0x41')]({},_0x3dac99,_0xf83216[_0xb9ad('0x43')]);return _0x3bf62e[_0xb9ad('0x51')](_0x3dac99);}})[_0xb9ad('0x16')](function(_0x847d88){if(_0x847d88){_0x1b4cca=_0x847d88[_0xb9ad('0x4d')];if(!_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x3b')](_0xb9ad('0x3c'))){_0x3dac99['limit']=qs['limit'](_0xf83216[_0xb9ad('0x36')]['limit']);_0x3dac99[_0xb9ad('0x24')]=qs['offset'](_0xf83216[_0xb9ad('0x36')][_0xb9ad('0x24')]);}return _0x3bf62e[_0xb9ad('0x51')](_0x3dac99);}})[_0xb9ad('0x16')](function(_0x361c32){if(_0x361c32){return _0x361c32?{'count':_0x1b4cca,'rows':_0x361c32}:null;}})[_0xb9ad('0x16')](respondWithResult(_0x1b72bd,null))[_0xb9ad('0x48')](handleError(_0x1b72bd,null));};exports['addConfiguration']=function(_0x4e13a9,_0x5c82ec,_0x137fe7){if(_0x4e13a9[_0xb9ad('0x50')]['id']){delete _0x4e13a9[_0xb9ad('0x50')]['id'];}return db[_0xb9ad('0x31')]['findOne']({'where':{'id':_0x4e13a9[_0xb9ad('0x4a')]['id']}})[_0xb9ad('0x16')](handleEntityNotFound(_0x5c82ec,null))[_0xb9ad('0x16')](function(_0x4cb6e3){if(_0x4cb6e3){_0x4e13a9[_0xb9ad('0x50')]['AccountId']=_0x4cb6e3['id'];_0x4e13a9[_0xb9ad('0x50')]['Subjects']=integrations[_0xb9ad('0x55')](_0x4e13a9['body'][_0xb9ad('0x56')],_0x4e13a9['body']['type']);_0x4e13a9['body'][_0xb9ad('0x57')]=integrations[_0xb9ad('0x58')](_0x4e13a9['body'][_0xb9ad('0x56')],_0x4e13a9[_0xb9ad('0x50')][_0xb9ad('0x33')]);return db[_0xb9ad('0x53')][_0xb9ad('0x4f')](_0x4e13a9[_0xb9ad('0x50')],{'include':[{'model':db[_0xb9ad('0x59')],'as':_0xb9ad('0x5a')},{'model':db[_0xb9ad('0x59')],'as':_0xb9ad('0x57')}]});}return null;})[_0xb9ad('0x16')](respondWithResult(_0x5c82ec,null))[_0xb9ad('0x48')](handleError(_0x5c82ec,null));};exports[_0xb9ad('0x5b')]=function(_0x106915,_0x2f59ee,_0x221430){var _0x179ba6='';var _0x409390=['id',_0xb9ad('0x2d'),_0xb9ad('0x5c'),_0xb9ad('0x5d'),_0xb9ad('0x5e'),_0xb9ad('0x5f'),_0xb9ad('0x60'),_0xb9ad('0x61'),_0xb9ad('0x62'),_0xb9ad('0x63'),_0xb9ad('0x64'),_0xb9ad('0x65')];return db[_0xb9ad('0x31')]['findOne']({'where':{'id':_0x106915[_0xb9ad('0x4a')]['id']},'attributes':['id',_0xb9ad('0x66'),_0xb9ad('0x67'),_0xb9ad('0x68')]})[_0xb9ad('0x16')](handleEntityNotFound(_0x2f59ee,null))['then'](function(_0x4af69d){if(_0x4af69d){_0x179ba6=_0x4af69d[_0xb9ad('0x68')];var _0x2b7981=_0x179ba6[_0xb9ad('0x69')](-0x1);if(_0x2b7981==='/'){_0x179ba6=_0x179ba6[_0xb9ad('0x6a')](0x0,_0x179ba6[_0xb9ad('0x6b')](_0x2b7981));}return rp({'method':_0xb9ad('0x6c'),'uri':util[_0xb9ad('0x6d')](_0xb9ad('0x6e'),_0x179ba6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb9ad('0x6f'),'input_type':_0xb9ad('0x70'),'response_type':_0xb9ad('0x70'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4af69d[_0xb9ad('0x66')],'password':_0x4af69d[_0xb9ad('0x67')],'encryption':_0xb9ad('0x71')},'application':_0xb9ad('0x72')})}});}})[_0xb9ad('0x16')](function(_0x4b569c){if(_0x4b569c&&_0x4b569c[_0xb9ad('0x2d')]!==_0xb9ad('0x73')&&_0x4b569c[_0xb9ad('0x2d')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xb9ad('0x6d')](_0xb9ad('0x6e'),_0x179ba6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xb9ad('0x74'),'input_type':_0xb9ad('0x70'),'response_type':_0xb9ad('0x70'),'rest_data':JSON['stringify']({'session':_0x4b569c['id'],'module_name':_0xb9ad('0x75')})}})[_0xb9ad('0x16')](function(_0x41760d){if(_0x41760d){var _0x5a0606=_[_0xb9ad('0x76')](_0x41760d[_0xb9ad('0x77')]);_[_0xb9ad('0x78')](_0x5a0606,function(_0x36d548){return _0x409390['includes'](_0x36d548['name']);});return{'count':_0x5a0606[_0xb9ad('0x4d')],'rows':_[_0xb9ad('0x30')](_0x5a0606,function(_0x103dd4){return{'id':_0x103dd4[_0xb9ad('0x2d')],'name':_0x103dd4[_0xb9ad('0x79')],'custom':_[_0xb9ad('0x7a')](_0x103dd4['name'],'_c')?!![]:![],'options':_0x103dd4['options']?_[_0xb9ad('0x30')](_['values'](_0x103dd4[_0xb9ad('0x43')]),function(_0x45ad3d){return{'name':_0x45ad3d[_0xb9ad('0x7b')],'value':_0x45ad3d[_0xb9ad('0x2d')]};}):[]};})};}})['then'](respondWithResult(_0x2f59ee,null))[_0xb9ad('0x48')](function(_0x3653a2){var _0xd0b8a1=_0x106915[_0xb9ad('0x36')][_0xb9ad('0x7c')]?0x1f4:_0x3653a2[_0xb9ad('0x7d')]||0x1f4;logger[_0xb9ad('0x1d')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xd0b8a1,JSON[_0xb9ad('0x1c')](_0x3653a2));delete _0x3653a2[_0xb9ad('0x2d')];if(_0xd0b8a1===0x191){_0xd0b8a1=0x190;}_0x2f59ee[_0xb9ad('0x21')](_0xd0b8a1)['send'](_0x106915[_0xb9ad('0x36')][_0xb9ad('0x7c')]?{'message':_0xb9ad('0x7e'),'statusCode':_0x3653a2['statusCode']}:_0x3653a2);});}else{var _0x25e9ff=0x1f4;_0x2f59ee[_0xb9ad('0x21')](_0x25e9ff)['send']({'message':_0xb9ad('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x307d=['intersection','attributes','fields','length','nolimit','sort','where','pick','merge','options','includeAll','include','rows','find','body','params','destroy','getConfigurations','filter','findOne','getSubjects','channel','Descriptions','SugarcrmConfiguration','create','Subjects','created_by','date_start','duration_hours','parent_type','parent_name','direction','username','password','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','remove','includes','label','value','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','test','Sequelize','ValidationError','request','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','end','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x85db10,_0x42ebe6){var _0xcb78ad=function(_0x295bb1){while(--_0x295bb1){_0x85db10['push'](_0x85db10['shift']());}};_0xcb78ad(++_0x42ebe6);}(_0x307d,0x129));var _0xd307=function(_0x195384,_0x3d7d7f){_0x195384=_0x195384-0x0;var _0x238e68=_0x307d[_0x195384];return _0x238e68;};'use strict';var pdf=require(_0xd307('0x0'));var emlformat=require(_0xd307('0x1'));var rimraf=require(_0xd307('0x2'));var zipdir=require(_0xd307('0x3'));var jsonpatch=require(_0xd307('0x4'));var rp=require('request-promise');var moment=require(_0xd307('0x5'));var BPromise=require(_0xd307('0x6'));var Mustache=require(_0xd307('0x7'));var util=require(_0xd307('0x8'));var path=require('path');var sox=require(_0xd307('0x9'));var csv=require(_0xd307('0xa'));var ejs=require(_0xd307('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd307('0xc'));var crypto=require('crypto');var jsforce=require(_0xd307('0xd'));var deskjs=require(_0xd307('0xe'));var toCsv=require(_0xd307('0xa'));var querystring=require(_0xd307('0xf'));var Papa=require('papaparse');var Redis=require(_0xd307('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd307('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd307('0x12'));var logger=require(_0xd307('0x13'))(_0xd307('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd307('0x15'))['db'];var integrations=require(_0xd307('0x16'));var jayson=require(_0xd307('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xe94b26,_0x28cbec,_0x1693b0){if(_0x1693b0){var _0x126bbd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x126bbd[_0xd307('0x18')](_0x28cbec)){return _0xe94b26;}else{throw new db[(_0xd307('0x19'))][(_0xd307('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xe94b26;}}function respondWithRpcPromise(_0x2650fa,_0x25c21d,_0x28b1c4,_0x2fe9d4){return new BPromise(function(_0x7d10ea,_0x5026ef){var _0x184c1d=_0x2fe9d4||client;return _0x184c1d[_0xd307('0x1b')](_0x2650fa,_0x28b1c4)[_0xd307('0x1c')](function(_0x1367e3){logger[_0xd307('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x25c21d,'request\x20sent');logger[_0xd307('0x1e')](_0xd307('0x1f'),_0x25c21d,'request\x20sent',JSON['stringify'](_0x1367e3));if(_0x1367e3[_0xd307('0x20')]){if(_0x1367e3['error'][_0xd307('0x21')]===0x1f4){logger[_0xd307('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x25c21d,_0x1367e3[_0xd307('0x20')][_0xd307('0x22')]);return _0x5026ef(_0x1367e3[_0xd307('0x20')][_0xd307('0x22')]);}logger[_0xd307('0x20')](_0xd307('0x23'),_0x25c21d,_0x1367e3['error'][_0xd307('0x22')]);return _0x7d10ea(_0x1367e3[_0xd307('0x20')][_0xd307('0x22')]);}else{logger[_0xd307('0x1d')](_0xd307('0x23'),_0x25c21d,'request\x20sent');_0x7d10ea(_0x1367e3[_0xd307('0x24')]['message']);}})[_0xd307('0x25')](function(_0x3b3952){logger[_0xd307('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x25c21d,_0x3b3952);_0x5026ef(_0x3b3952);});});}function respondWithStatusCode(_0x2d09fb,_0x3730d5){_0x3730d5=_0x3730d5||0xcc;return function(_0x58dca3){if(_0x58dca3){return _0x2d09fb[_0xd307('0x26')](_0x3730d5);}return _0x2d09fb[_0xd307('0x27')](_0x3730d5)['end']();};}function respondWithResult(_0x4f535a,_0x3ad6fe){_0x3ad6fe=_0x3ad6fe||0xc8;return function(_0x5759fe){if(_0x5759fe){return _0x4f535a[_0xd307('0x27')](_0x3ad6fe)['json'](_0x5759fe);}};}function respondWithFilteredResult(_0x4e93d0,_0x2b0be6){return function(_0x184d3a){if(_0x184d3a){var _0x5badeb=_0x184d3a[_0xd307('0x28')],_0x825f4d=_0x2b0be6[_0xd307('0x29')],_0xeb0f55=_0x2b0be6['offset']+_0x2b0be6[_0xd307('0x2a')],_0x2577ec;if(_0xeb0f55>=_0x5badeb){_0xeb0f55=_0x5badeb;_0x2577ec=0xc8;}else{_0x2577ec=0xce;}_0x4e93d0[_0xd307('0x27')](_0x2577ec);return _0x4e93d0[_0xd307('0x2b')](_0xd307('0x2c'),_0x825f4d+'-'+_0xeb0f55+'/'+_0x5badeb)[_0xd307('0x2d')](_0x184d3a);}return null;};}function patchUpdates(_0x475097){return function(_0x1da6aa){try{jsonpatch[_0xd307('0x2e')](_0x1da6aa,_0x475097,!![]);}catch(_0x4a08f6){return BPromise[_0xd307('0x2f')](_0x4a08f6);}return _0x1da6aa['save']();};}function saveUpdates(_0x194d5f,_0x2049cf){return function(_0x266401){if(_0x266401){return _0x266401[_0xd307('0x30')](_0x194d5f)[_0xd307('0x1c')](function(_0x5cd1be){return _0x5cd1be;});}return null;};}function removeEntity(_0xba7ed,_0x1c87ef){return function(_0x276bcd){if(_0x276bcd){return _0x276bcd['destroy']()[_0xd307('0x1c')](function(){_0xba7ed[_0xd307('0x27')](0xcc)[_0xd307('0x31')]();});}};}function handleEntityNotFound(_0x1a9365,_0x4857c8){return function(_0x3d7ccb){if(!_0x3d7ccb){_0x1a9365[_0xd307('0x26')](0x194);}return _0x3d7ccb;};}function handleError(_0x2679ef,_0xa126d){_0xa126d=_0xa126d||0x1f4;return function(_0x4cd6a2){logger[_0xd307('0x20')](_0x4cd6a2['stack']);if(_0x4cd6a2[_0xd307('0x32')]){delete _0x4cd6a2[_0xd307('0x32')];}_0x2679ef[_0xd307('0x27')](_0xa126d)[_0xd307('0x33')](_0x4cd6a2);};}exports[_0xd307('0x34')]=function(_0x18a12a,_0x1d2a6e){var _0x178048={},_0x2c0a1c={},_0xd9eddb={'count':0x0,'rows':[]};var _0x4367de=_['map'](db[_0xd307('0x35')][_0xd307('0x36')],function(_0x1ea9bf){return{'name':_0x1ea9bf[_0xd307('0x37')],'type':_0x1ea9bf[_0xd307('0x38')][_0xd307('0x39')]};});_0x2c0a1c[_0xd307('0x3a')]=_[_0xd307('0x3b')](_0x4367de,_0xd307('0x32'));_0x2c0a1c[_0xd307('0x3c')]=_[_0xd307('0x3d')](_0x18a12a[_0xd307('0x3c')]);_0x2c0a1c[_0xd307('0x3e')]=_[_0xd307('0x3f')](_0x2c0a1c['model'],_0x2c0a1c[_0xd307('0x3c')]);_0x178048[_0xd307('0x40')]=_[_0xd307('0x3f')](_0x2c0a1c[_0xd307('0x3a')],qs['fields'](_0x18a12a['query'][_0xd307('0x41')]));_0x178048[_0xd307('0x40')]=_0x178048[_0xd307('0x40')][_0xd307('0x42')]?_0x178048[_0xd307('0x40')]:_0x2c0a1c[_0xd307('0x3a')];if(!_0x18a12a['query']['hasOwnProperty'](_0xd307('0x43'))){_0x178048[_0xd307('0x2a')]=qs[_0xd307('0x2a')](_0x18a12a[_0xd307('0x3c')][_0xd307('0x2a')]);_0x178048[_0xd307('0x29')]=qs[_0xd307('0x29')](_0x18a12a[_0xd307('0x3c')][_0xd307('0x29')]);}_0x178048['order']=qs[_0xd307('0x44')](_0x18a12a['query'][_0xd307('0x44')]);_0x178048[_0xd307('0x45')]=qs[_0xd307('0x3e')](_[_0xd307('0x46')](_0x18a12a['query'],_0x2c0a1c[_0xd307('0x3e')]),_0x4367de);if(_0x18a12a['query']['filter']){_0x178048[_0xd307('0x45')]=_[_0xd307('0x47')](_0x178048[_0xd307('0x45')],{'$or':_[_0xd307('0x3b')](_0x4367de,function(_0x3e19c8){if(_0x3e19c8[_0xd307('0x38')]!=='VIRTUAL'){var _0x1eae58={};_0x1eae58[_0x3e19c8[_0xd307('0x32')]]={'$like':'%'+_0x18a12a[_0xd307('0x3c')]['filter']+'%'};return _0x1eae58;}})});}_0x178048=_[_0xd307('0x47')]({},_0x178048,_0x18a12a[_0xd307('0x48')]);var _0x5664d4={'where':_0x178048[_0xd307('0x45')]};return db['SugarcrmAccount'][_0xd307('0x28')](_0x5664d4)[_0xd307('0x1c')](function(_0xa3a00b){_0xd9eddb['count']=_0xa3a00b;if(_0x18a12a[_0xd307('0x3c')][_0xd307('0x49')]){_0x178048[_0xd307('0x4a')]=[{'all':!![]}];}return db[_0xd307('0x35')]['findAll'](_0x178048);})[_0xd307('0x1c')](function(_0x22eecd){_0xd9eddb[_0xd307('0x4b')]=_0x22eecd;return _0xd9eddb;})[_0xd307('0x1c')](respondWithFilteredResult(_0x1d2a6e,_0x178048))[_0xd307('0x25')](handleError(_0x1d2a6e,null));};exports['show']=function(_0x147d3f,_0xd47c4e){var _0x15d0ed={'raw':![],'where':{'id':_0x147d3f['params']['id']}},_0x4c9396={};_0x4c9396[_0xd307('0x3a')]=_[_0xd307('0x3d')](db[_0xd307('0x35')][_0xd307('0x36')]);_0x4c9396[_0xd307('0x3c')]=_['keys'](_0x147d3f[_0xd307('0x3c')]);_0x4c9396[_0xd307('0x3e')]=_[_0xd307('0x3f')](_0x4c9396[_0xd307('0x3a')],_0x4c9396[_0xd307('0x3c')]);_0x15d0ed[_0xd307('0x40')]=_[_0xd307('0x3f')](_0x4c9396[_0xd307('0x3a')],qs[_0xd307('0x41')](_0x147d3f[_0xd307('0x3c')][_0xd307('0x41')]));_0x15d0ed[_0xd307('0x40')]=_0x15d0ed[_0xd307('0x40')][_0xd307('0x42')]?_0x15d0ed[_0xd307('0x40')]:_0x4c9396[_0xd307('0x3a')];if(_0x147d3f['query']['includeAll']){_0x15d0ed[_0xd307('0x4a')]=[{'all':!![]}];}_0x15d0ed=_['merge']({},_0x15d0ed,_0x147d3f['options']);return db[_0xd307('0x35')][_0xd307('0x4c')](_0x15d0ed)['then'](handleEntityNotFound(_0xd47c4e,null))[_0xd307('0x1c')](respondWithResult(_0xd47c4e,null))['catch'](handleError(_0xd47c4e,null));};exports['create']=function(_0x80069a,_0xa5aac6){return db['SugarcrmAccount']['create'](_0x80069a[_0xd307('0x4d')],{})[_0xd307('0x1c')](respondWithResult(_0xa5aac6,0xc9))[_0xd307('0x25')](handleError(_0xa5aac6,null));};exports[_0xd307('0x30')]=function(_0x46234e,_0x535945){if(_0x46234e['body']['id']){delete _0x46234e[_0xd307('0x4d')]['id'];}return db['SugarcrmAccount'][_0xd307('0x4c')]({'where':{'id':_0x46234e[_0xd307('0x4e')]['id']}})['then'](handleEntityNotFound(_0x535945,null))[_0xd307('0x1c')](saveUpdates(_0x46234e[_0xd307('0x4d')],null))[_0xd307('0x1c')](respondWithResult(_0x535945,null))[_0xd307('0x25')](handleError(_0x535945,null));};exports[_0xd307('0x4f')]=function(_0x436603,_0x203fa1){return db['SugarcrmAccount'][_0xd307('0x4c')]({'where':{'id':_0x436603['params']['id']}})[_0xd307('0x1c')](handleEntityNotFound(_0x203fa1,null))[_0xd307('0x1c')](removeEntity(_0x203fa1,null))[_0xd307('0x25')](handleError(_0x203fa1,null));};exports[_0xd307('0x50')]=function(_0x281ac4,_0x537837,_0x2c1d02){var _0x33da72={};var _0x374c22={};var _0xd9ca5a;var _0x376df8;return db[_0xd307('0x35')]['findOne']({'where':{'id':_0x281ac4[_0xd307('0x4e')]['id']}})['then'](handleEntityNotFound(_0x537837,null))[_0xd307('0x1c')](function(_0x428259){if(_0x428259){_0xd9ca5a=_0x428259;_0x374c22[_0xd307('0x3a')]=_[_0xd307('0x3d')](db['SugarcrmConfiguration'][_0xd307('0x36')]);_0x374c22[_0xd307('0x3c')]=_[_0xd307('0x3d')](_0x281ac4[_0xd307('0x3c')]);_0x374c22[_0xd307('0x3e')]=_[_0xd307('0x3f')](_0x374c22[_0xd307('0x3a')],_0x374c22[_0xd307('0x3c')]);_0x33da72[_0xd307('0x40')]=_[_0xd307('0x3f')](_0x374c22[_0xd307('0x3a')],qs[_0xd307('0x41')](_0x281ac4['query']['fields']));_0x33da72[_0xd307('0x40')]=_0x33da72[_0xd307('0x40')][_0xd307('0x42')]?_0x33da72[_0xd307('0x40')]:_0x374c22[_0xd307('0x3a')];_0x33da72['order']=qs['sort'](_0x281ac4[_0xd307('0x3c')][_0xd307('0x44')]);_0x33da72[_0xd307('0x45')]=qs[_0xd307('0x3e')](_[_0xd307('0x46')](_0x281ac4[_0xd307('0x3c')],_0x374c22[_0xd307('0x3e')]));if(_0x281ac4['query'][_0xd307('0x51')]){_0x33da72[_0xd307('0x45')]=_[_0xd307('0x47')](_0x33da72['where'],{'$or':_[_0xd307('0x3b')](_0x33da72[_0xd307('0x40')],function(_0x2baf07){var _0x10db0e={};_0x10db0e[_0x2baf07]={'$like':'%'+_0x281ac4[_0xd307('0x3c')][_0xd307('0x51')]+'%'};return _0x10db0e;})});}_0x33da72=_[_0xd307('0x47')]({},_0x33da72,_0x281ac4['options']);return _0xd9ca5a['getConfigurations'](_0x33da72);}})[_0xd307('0x1c')](function(_0x444cab){if(_0x444cab){_0x376df8=_0x444cab[_0xd307('0x42')];if(!_0x281ac4[_0xd307('0x3c')]['hasOwnProperty'](_0xd307('0x43'))){_0x33da72[_0xd307('0x2a')]=qs[_0xd307('0x2a')](_0x281ac4[_0xd307('0x3c')][_0xd307('0x2a')]);_0x33da72[_0xd307('0x29')]=qs['offset'](_0x281ac4[_0xd307('0x3c')][_0xd307('0x29')]);}return _0xd9ca5a[_0xd307('0x50')](_0x33da72);}})[_0xd307('0x1c')](function(_0xeb516){if(_0xeb516){return _0xeb516?{'count':_0x376df8,'rows':_0xeb516}:null;}})['then'](respondWithResult(_0x537837,null))['catch'](handleError(_0x537837,null));};exports['addConfiguration']=function(_0x4d2875,_0x44348c,_0x3e5c3b){if(_0x4d2875[_0xd307('0x4d')]['id']){delete _0x4d2875[_0xd307('0x4d')]['id'];}return db[_0xd307('0x35')][_0xd307('0x52')]({'where':{'id':_0x4d2875[_0xd307('0x4e')]['id']}})['then'](handleEntityNotFound(_0x44348c,null))[_0xd307('0x1c')](function(_0x125012){if(_0x125012){_0x4d2875[_0xd307('0x4d')]['AccountId']=_0x125012['id'];_0x4d2875[_0xd307('0x4d')]['Subjects']=integrations[_0xd307('0x53')](_0x4d2875[_0xd307('0x4d')][_0xd307('0x54')],_0x4d2875[_0xd307('0x4d')][_0xd307('0x38')]);_0x4d2875['body'][_0xd307('0x55')]=integrations['getDescriptions'](_0x4d2875[_0xd307('0x4d')][_0xd307('0x54')],_0x4d2875[_0xd307('0x4d')][_0xd307('0x38')]);return db[_0xd307('0x56')][_0xd307('0x57')](_0x4d2875[_0xd307('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':_0xd307('0x58')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd307('0x1c')](respondWithResult(_0x44348c,null))[_0xd307('0x25')](handleError(_0x44348c,null));};exports['getFields']=function(_0x3437dc,_0x39e41e,_0x5f224a){var _0xed636d='';var _0x5acb8d=['id',_0xd307('0x32'),'assigned_user_id',_0xd307('0x59'),'description',_0xd307('0x5a'),_0xd307('0x5b'),'duration_minutes','parent_id',_0xd307('0x5c'),_0xd307('0x5d'),_0xd307('0x5e')];return db[_0xd307('0x35')][_0xd307('0x52')]({'where':{'id':_0x3437dc[_0xd307('0x4e')]['id']},'attributes':['id',_0xd307('0x5f'),_0xd307('0x60'),'remoteUri']})[_0xd307('0x1c')](handleEntityNotFound(_0x39e41e,null))[_0xd307('0x1c')](function(_0x1e2e7c){if(_0x1e2e7c){_0xed636d=_0x1e2e7c['remoteUri'];var _0xeeb8c=_0xed636d['slice'](-0x1);if(_0xeeb8c==='/'){_0xed636d=_0xed636d[_0xd307('0x61')](0x0,_0xed636d[_0xd307('0x62')](_0xeeb8c));}return rp({'method':_0xd307('0x63'),'uri':util['format'](_0xd307('0x64'),_0xed636d,_0xd307('0x65')),'json':!![],'form':{'method':_0xd307('0x66'),'input_type':_0xd307('0x67'),'response_type':'JSON','rest_data':JSON[_0xd307('0x68')]({'user_auth':{'user_name':_0x1e2e7c[_0xd307('0x5f')],'password':_0x1e2e7c[_0xd307('0x60')],'encryption':_0xd307('0x69')},'application':_0xd307('0x6a')})}});}})[_0xd307('0x1c')](function(_0x34d38c){if(_0x34d38c&&_0x34d38c[_0xd307('0x32')]!==_0xd307('0x6b')&&_0x34d38c[_0xd307('0x32')]!==_0xd307('0x6c')){return rp({'method':_0xd307('0x63'),'uri':util[_0xd307('0x6d')](_0xd307('0x64'),_0xed636d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd307('0x6e'),'input_type':_0xd307('0x67'),'response_type':'JSON','rest_data':JSON[_0xd307('0x68')]({'session':_0x34d38c['id'],'module_name':_0xd307('0x6f')})}})[_0xd307('0x1c')](function(_0x440a7b){if(_0x440a7b){var _0x897344=_[_0xd307('0x70')](_0x440a7b['module_fields']);_[_0xd307('0x71')](_0x897344,function(_0x118b5a){return _0x5acb8d[_0xd307('0x72')](_0x118b5a[_0xd307('0x32')]);});return{'count':_0x897344[_0xd307('0x42')],'rows':_[_0xd307('0x3b')](_0x897344,function(_0x212739){return{'id':_0x212739['name'],'name':_0x212739[_0xd307('0x73')],'custom':_['endsWith'](_0x212739[_0xd307('0x32')],'_c')?!![]:![],'options':_0x212739[_0xd307('0x48')]?_[_0xd307('0x3b')](_[_0xd307('0x70')](_0x212739[_0xd307('0x48')]),function(_0x270a36){return{'name':_0x270a36[_0xd307('0x74')],'value':_0x270a36[_0xd307('0x32')]};}):[]};})};}})['then'](respondWithResult(_0x39e41e,null))['catch'](function(_0x55c0bc){var _0x3672b6=_0x3437dc[_0xd307('0x3c')]['test']?0x1f4:_0x55c0bc['statusCode']||0x1f4;logger[_0xd307('0x20')](_0xd307('0x75'),'getFields',_0x3672b6,JSON[_0xd307('0x68')](_0x55c0bc));delete _0x55c0bc[_0xd307('0x32')];if(_0x3672b6===0x191){_0x3672b6=0x190;}_0x39e41e[_0xd307('0x27')](_0x3672b6)[_0xd307('0x33')](_0x3437dc[_0xd307('0x3c')][_0xd307('0x18')]?{'message':_0xd307('0x76'),'statusCode':_0x55c0bc[_0xd307('0x77')]}:_0x55c0bc);});}else{var _0x39ec3f=0x1f4;_0x39e41e[_0xd307('0x27')](_0x39ec3f)[_0xd307('0x33')]({'message':_0xd307('0x76'),'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 0890535..d5c2575 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 _0x3d4d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x3d4d,0x198));var _0xd3d4=function(_0x49e913,_0x14dbe3){_0x49e913=_0x49e913-0x0;var _0x3f9f12=_0x3d4d[_0x49e913];return _0x3f9f12;};'use strict';var _=require('lodash');var util=require(_0xd3d4('0x0'));var logger=require(_0xd3d4('0x1'))(_0xd3d4('0x2'));var moment=require(_0xd3d4('0x3'));var BPromise=require(_0xd3d4('0x4'));var rp=require(_0xd3d4('0x5'));var fs=require('fs');var path=require(_0xd3d4('0x6'));var rimraf=require(_0xd3d4('0x7'));var config=require(_0xd3d4('0x8'));var attributes=require(_0xd3d4('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2b9f98,_0x5765ae){return _0x2b9f98[_0xd3d4('0xa')](_0xd3d4('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts'];(function(_0x41557c,_0x21f0e0){var _0x39ea88=function(_0x4bf792){while(--_0x4bf792){_0x41557c['push'](_0x41557c['shift']());}};_0x39ea88(++_0x21f0e0);}(_0x894d,0x193));var _0xd894=function(_0x2c3bb9,_0x4d333b){_0x2c3bb9=_0x2c3bb9-0x0;var _0x1e944b=_0x894d[_0x2c3bb9];return _0x1e944b;};'use strict';var _=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var logger=require(_0xd894('0x2'))(_0xd894('0x3'));var moment=require(_0xd894('0x4'));var BPromise=require(_0xd894('0x5'));var rp=require(_0xd894('0x6'));var fs=require('fs');var path=require(_0xd894('0x7'));var rimraf=require('rimraf');var config=require(_0xd894('0x8'));var attributes=require(_0xd894('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xd894('0xa')]=function(_0x5a6cab,_0x16283d){return _0x5a6cab[_0xd894('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xd894('0xc'),'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 89d5b4d..77ab713 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 _0x38c8=['message','result','catch','GetSugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','ShowSugarcrmAccount','raw','info','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a9810,_0x1827f7){var _0x4ee4df=function(_0xbae215){while(--_0xbae215){_0x5a9810['push'](_0x5a9810['shift']());}};_0x4ee4df(++_0x1827f7);}(_0x38c8,0x16f));var _0x838c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x38c8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x838c('0x0'));var util=require('util');var moment=require(_0x838c('0x1'));var BPromise=require('bluebird');var rs=require(_0x838c('0x2'));var fs=require('fs');var Redis=require(_0x838c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x838c('0x4'));var logger=require(_0x838c('0x5'))('rpc');var config=require(_0x838c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x838c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16dd0a,_0x3f109b,_0x332f1c){return new BPromise(function(_0x58d235,_0x3dd148){return client[_0x838c('0x8')](_0x16dd0a,_0x332f1c)[_0x838c('0x9')](function(_0x35fb15){logger['info'](_0x838c('0xa'),_0x3f109b,_0x838c('0xb'));logger[_0x838c('0xc')](_0x838c('0xd'),_0x3f109b,_0x838c('0xb'),JSON[_0x838c('0xe')](_0x35fb15));if(_0x35fb15['error']){if(_0x35fb15[_0x838c('0xf')][_0x838c('0x10')]===0x1f4){logger[_0x838c('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);return _0x3dd148(_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);}logger[_0x838c('0xf')](_0x838c('0xa'),_0x3f109b,_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);return _0x58d235(_0x35fb15[_0x838c('0xf')][_0x838c('0x11')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,'request\x20sent');_0x58d235(_0x35fb15[_0x838c('0x12')][_0x838c('0x11')]);}})[_0x838c('0x13')](function(_0x4e275d){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3f109b,_0x4e275d);_0x3dd148(_0x4e275d);});});}exports[_0x838c('0x14')]=function(_0xe06b12){var _0x1f2a4f=this;return new Promise(function(_0x523843,_0x1015c5){return db['SugarcrmAccount'][_0x838c('0x15')]({'raw':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options']['raw']===undefined?!![]:![]:!![],'where':_0xe06b12[_0x838c('0x16')]?_0xe06b12[_0x838c('0x16')][_0x838c('0x17')]||null:null,'attributes':_0xe06b12['options']?_0xe06b12[_0x838c('0x16')][_0x838c('0x18')]||null:null,'limit':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options'][_0x838c('0x19')]||null:null,'include':_0xe06b12[_0x838c('0x16')]?_0xe06b12['options'][_0x838c('0x1a')]?_[_0x838c('0x1b')](_0xe06b12['options'][_0x838c('0x1a')],function(_0x5d5604){return{'model':db[_0x5d5604['model']],'as':_0x5d5604['as'],'attributes':_0x5d5604['attributes'],'include':_0x5d5604[_0x838c('0x1a')]?_['map'](_0x5d5604['include'],function(_0x45a6fb){return{'model':db[_0x45a6fb[_0x838c('0x1c')]],'as':_0x45a6fb['as'],'attributes':_0x45a6fb[_0x838c('0x18')],'include':_0x45a6fb['include']?_[_0x838c('0x1b')](_0x45a6fb['include'],function(_0x25256e){return{'model':db[_0x25256e[_0x838c('0x1c')]],'as':_0x25256e['as'],'attributes':_0x25256e[_0x838c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x838c('0x9')](function(_0x548e71){logger['info'](_0x838c('0x14'),_0xe06b12);logger[_0x838c('0xc')](_0x838c('0x14'),_0xe06b12,JSON[_0x838c('0xe')](_0x548e71));_0x523843(_0x548e71);})['catch'](function(_0x449241){logger[_0x838c('0xf')](_0x838c('0x14'),_0x449241[_0x838c('0x11')],_0xe06b12);_0x1015c5(_0x1f2a4f[_0x838c('0xf')](0x1f4,_0x449241[_0x838c('0x11')]));});});};exports[_0x838c('0x1d')]=function(_0x326874){var _0x3d9918=this;return new Promise(function(_0x1e4bee,_0x5522e1){return db['SugarcrmAccount']['find']({'raw':_0x326874[_0x838c('0x16')]?_0x326874[_0x838c('0x16')][_0x838c('0x1e')]===undefined?!![]:![]:!![],'where':_0x326874['options']?_0x326874[_0x838c('0x16')]['where']||null:null,'attributes':_0x326874[_0x838c('0x16')]?_0x326874['options']['attributes']||null:null,'include':_0x326874[_0x838c('0x16')]?_0x326874[_0x838c('0x16')][_0x838c('0x1a')]?_['map'](_0x326874['options'][_0x838c('0x1a')],function(_0x2fa8f0){return{'model':db[_0x2fa8f0[_0x838c('0x1c')]],'as':_0x2fa8f0['as'],'attributes':_0x2fa8f0[_0x838c('0x18')],'include':_0x2fa8f0[_0x838c('0x1a')]?_[_0x838c('0x1b')](_0x2fa8f0['include'],function(_0xa9c44f){return{'model':db[_0xa9c44f['model']],'as':_0xa9c44f['as'],'attributes':_0xa9c44f[_0x838c('0x18')],'include':_0xa9c44f[_0x838c('0x1a')]?_[_0x838c('0x1b')](_0xa9c44f['include'],function(_0x166910){return{'model':db[_0x166910['model']],'as':_0x166910['as'],'attributes':_0x166910[_0x838c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bed4c){logger[_0x838c('0x1f')](_0x838c('0x1d'),_0x326874);logger[_0x838c('0xc')](_0x838c('0x1d'),_0x326874,JSON[_0x838c('0xe')](_0x2bed4c));_0x1e4bee(_0x2bed4c);})['catch'](function(_0x4e1a89){logger[_0x838c('0xf')](_0x838c('0x1d'),_0x4e1a89[_0x838c('0x11')],_0x326874);_0x5522e1(_0x3d9918[_0x838c('0xf')](0x1f4,_0x4e1a89['message']));});});}; \ No newline at end of file +var _0x6920=['attributes','limit','include','map','model','info','GetSugarcrmAccount','stringify','catch','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','SugarcrmAccount','findAll','options','raw','where'];(function(_0x1403ff,_0x4f0d62){var _0x207cde=function(_0x17e1be){while(--_0x17e1be){_0x1403ff['push'](_0x1403ff['shift']());}};_0x207cde(++_0x4f0d62);}(_0x6920,0x172));var _0x0692=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x6920[_0xb7a459];return _0x104ab5;};'use strict';var _=require(_0x0692('0x0'));var util=require(_0x0692('0x1'));var moment=require(_0x0692('0x2'));var BPromise=require('bluebird');var rs=require(_0x0692('0x3'));var fs=require('fs');var Redis=require(_0x0692('0x4'));var db=require(_0x0692('0x5'))['db'];var utils=require(_0x0692('0x6'));var logger=require(_0x0692('0x7'))(_0x0692('0x8'));var config=require('../../config/environment');var jayson=require(_0x0692('0x9'));var client=jayson[_0x0692('0xa')][_0x0692('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x414010,_0x4a2ea2,_0x265925){return new BPromise(function(_0x4af769,_0x2b3dd4){return client[_0x0692('0xc')](_0x414010,_0x265925)[_0x0692('0xd')](function(_0x298616){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4a2ea2,_0x0692('0xe'));logger[_0x0692('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4a2ea2,_0x0692('0xe'),JSON['stringify'](_0x298616));if(_0x298616[_0x0692('0x10')]){if(_0x298616['error'][_0x0692('0x11')]===0x1f4){logger[_0x0692('0x10')](_0x0692('0x12'),_0x4a2ea2,_0x298616['error']['message']);return _0x2b3dd4(_0x298616['error'][_0x0692('0x13')]);}logger['error'](_0x0692('0x12'),_0x4a2ea2,_0x298616[_0x0692('0x10')][_0x0692('0x13')]);return _0x4af769(_0x298616[_0x0692('0x10')][_0x0692('0x13')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x4a2ea2,'request\x20sent');_0x4af769(_0x298616[_0x0692('0x14')][_0x0692('0x13')]);}})['catch'](function(_0x5c1548){logger[_0x0692('0x10')](_0x0692('0x12'),_0x4a2ea2,_0x5c1548);_0x2b3dd4(_0x5c1548);});});}exports['GetSugarcrmAccount']=function(_0x274c24){var _0x42dcdc=this;return new Promise(function(_0x203231,_0x2d501b){return db[_0x0692('0x15')][_0x0692('0x16')]({'raw':_0x274c24['options']?_0x274c24[_0x0692('0x17')][_0x0692('0x18')]===undefined?!![]:![]:!![],'where':_0x274c24['options']?_0x274c24[_0x0692('0x17')][_0x0692('0x19')]||null:null,'attributes':_0x274c24['options']?_0x274c24['options'][_0x0692('0x1a')]||null:null,'limit':_0x274c24['options']?_0x274c24[_0x0692('0x17')][_0x0692('0x1b')]||null:null,'include':_0x274c24[_0x0692('0x17')]?_0x274c24[_0x0692('0x17')][_0x0692('0x1c')]?_[_0x0692('0x1d')](_0x274c24[_0x0692('0x17')][_0x0692('0x1c')],function(_0x338774){return{'model':db[_0x338774[_0x0692('0x1e')]],'as':_0x338774['as'],'attributes':_0x338774[_0x0692('0x1a')],'include':_0x338774['include']?_[_0x0692('0x1d')](_0x338774[_0x0692('0x1c')],function(_0x33ba39){return{'model':db[_0x33ba39['model']],'as':_0x33ba39['as'],'attributes':_0x33ba39['attributes'],'include':_0x33ba39[_0x0692('0x1c')]?_[_0x0692('0x1d')](_0x33ba39[_0x0692('0x1c')],function(_0x40b348){return{'model':db[_0x40b348[_0x0692('0x1e')]],'as':_0x40b348['as'],'attributes':_0x40b348[_0x0692('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0692('0xd')](function(_0x57844a){logger[_0x0692('0x1f')]('GetSugarcrmAccount',_0x274c24);logger[_0x0692('0xf')](_0x0692('0x20'),_0x274c24,JSON[_0x0692('0x21')](_0x57844a));_0x203231(_0x57844a);})[_0x0692('0x22')](function(_0xc9fdc5){logger[_0x0692('0x10')](_0x0692('0x20'),_0xc9fdc5[_0x0692('0x13')],_0x274c24);_0x2d501b(_0x42dcdc[_0x0692('0x10')](0x1f4,_0xc9fdc5[_0x0692('0x13')]));});});};exports[_0x0692('0x23')]=function(_0x562fd3){var _0x3138fb=this;return new Promise(function(_0x16b7b6,_0x29e936){return db[_0x0692('0x15')]['find']({'raw':_0x562fd3[_0x0692('0x17')]?_0x562fd3[_0x0692('0x17')][_0x0692('0x18')]===undefined?!![]:![]:!![],'where':_0x562fd3['options']?_0x562fd3[_0x0692('0x17')][_0x0692('0x19')]||null:null,'attributes':_0x562fd3[_0x0692('0x17')]?_0x562fd3[_0x0692('0x17')][_0x0692('0x1a')]||null:null,'include':_0x562fd3[_0x0692('0x17')]?_0x562fd3['options'][_0x0692('0x1c')]?_[_0x0692('0x1d')](_0x562fd3[_0x0692('0x17')]['include'],function(_0x39f8d2){return{'model':db[_0x39f8d2['model']],'as':_0x39f8d2['as'],'attributes':_0x39f8d2[_0x0692('0x1a')],'include':_0x39f8d2[_0x0692('0x1c')]?_['map'](_0x39f8d2[_0x0692('0x1c')],function(_0x54f094){return{'model':db[_0x54f094[_0x0692('0x1e')]],'as':_0x54f094['as'],'attributes':_0x54f094[_0x0692('0x1a')],'include':_0x54f094[_0x0692('0x1c')]?_[_0x0692('0x1d')](_0x54f094[_0x0692('0x1c')],function(_0x28ebdc){return{'model':db[_0x28ebdc['model']],'as':_0x28ebdc['as'],'attributes':_0x28ebdc[_0x0692('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39691b){logger['info'](_0x0692('0x23'),_0x562fd3);logger['debug'](_0x0692('0x23'),_0x562fd3,JSON[_0x0692('0x21')](_0x39691b));_0x16b7b6(_0x39691b);})[_0x0692('0x22')](function(_0x57f276){logger['error'](_0x0692('0x23'),_0x57f276[_0x0692('0x13')],_0x562fd3);_0x29e936(_0x3138fb['error'](0x1f4,_0x57f276[_0x0692('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index c299caf..1415c56 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 _0x1763=['/:id/descriptions','getDescriptions','post','update','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/subjects'];(function(_0x2c1b3b,_0xfb61cf){var _0x571c6c=function(_0x95bacb){while(--_0x95bacb){_0x2c1b3b['push'](_0x2c1b3b['shift']());}};_0x571c6c(++_0xfb61cf);}(_0x1763,0x14a));var _0x3176=function(_0x54cefb,_0x192225){_0x54cefb=_0x54cefb-0x0;var _0x5e4fbb=_0x1763[_0x54cefb];return _0x5e4fbb;};'use strict';var multer=require(_0x3176('0x0'));var util=require(_0x3176('0x1'));var path=require(_0x3176('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3176('0x3')]();var auth=require(_0x3176('0x4'));var interaction=require(_0x3176('0x5'));var config=require(_0x3176('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x3176('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3176('0x7')]('/:id',auth[_0x3176('0x8')](),controller['show']);router[_0x3176('0x7')]('/:id/fields',auth[_0x3176('0x8')](),controller['getFields']);router[_0x3176('0x7')](_0x3176('0x9'),auth[_0x3176('0x8')](),controller['getSubjects']);router[_0x3176('0x7')](_0x3176('0xa'),auth[_0x3176('0x8')](),controller[_0x3176('0xb')]);router[_0x3176('0xc')]('/',auth[_0x3176('0x8')](),controller['create']);router['put']('/:id',auth[_0x3176('0x8')](),controller[_0x3176('0xd')]);router[_0x3176('0xe')](_0x3176('0xf'),auth[_0x3176('0x8')](),controller[_0x3176('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8d3a=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x495ebf,_0x27df21){var _0x5841ef=function(_0x35bdfd){while(--_0x35bdfd){_0x495ebf['push'](_0x495ebf['shift']());}};_0x5841ef(++_0x27df21);}(_0x8d3a,0x112));var _0xa8d3=function(_0x1dd74c,_0x879fdf){_0x1dd74c=_0x1dd74c-0x0;var _0x3c16df=_0x8d3a[_0x1dd74c];return _0x3c16df;};'use strict';var multer=require(_0xa8d3('0x0'));var util=require(_0xa8d3('0x1'));var path=require(_0xa8d3('0x2'));var timeout=require(_0xa8d3('0x3'));var express=require(_0xa8d3('0x4'));var router=express[_0xa8d3('0x5')]();var auth=require(_0xa8d3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xa8d3('0x7')]('/',auth['isAuthenticated'](),controller[_0xa8d3('0x8')]);router['get'](_0xa8d3('0x9'),auth[_0xa8d3('0xa')](),controller[_0xa8d3('0xb')]);router[_0xa8d3('0x7')](_0xa8d3('0xc'),auth[_0xa8d3('0xa')](),controller[_0xa8d3('0xd')]);router['get'](_0xa8d3('0xe'),auth['isAuthenticated'](),controller[_0xa8d3('0xf')]);router['get'](_0xa8d3('0x10'),auth[_0xa8d3('0xa')](),controller[_0xa8d3('0x11')]);router[_0xa8d3('0x12')]('/',auth['isAuthenticated'](),controller[_0xa8d3('0x13')]);router[_0xa8d3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xa8d3('0x15')]);router[_0xa8d3('0x16')](_0xa8d3('0x9'),auth[_0xa8d3('0xa')](),controller[_0xa8d3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 77938c2..2589cc4 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 _0xec36=['exports','STRING'];(function(_0x13da36,_0x452a8c){var _0x4e9813=function(_0x122950){while(--_0x122950){_0x13da36['push'](_0x13da36['shift']());}};_0x4e9813(++_0x452a8c);}(_0xec36,0x100));var _0x6ec3=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xec36[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x6ec3('0x0')]={'name':{'type':Sequelize[_0x6ec3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8344=['sequelize','STRING'];(function(_0x243863,_0x52aebd){var _0x4aca75=function(_0x113eb0){while(--_0x113eb0){_0x243863['push'](_0x243863['shift']());}};_0x4aca75(++_0x52aebd);}(_0x8344,0xb2));var _0x4834=function(_0x9927aa,_0x291c0b){_0x9927aa=_0x9927aa-0x0;var _0x2dbe1f=_0x8344[_0x9927aa];return _0x2dbe1f;};'use strict';var Sequelize=require(_0x4834('0x0'));module['exports']={'name':{'type':Sequelize[_0x4834('0x1')]},'description':{'type':Sequelize[_0x4834('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 3bbadad..852c899 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 _0xae25=['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','api','../../config/environment','jayson/promise','http','Sequelize','ValidationError','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','options','find','create','body','params','destroy','getFields','SugarcrmField','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x109b07,_0x4df3a1){var _0x2b1add=function(_0x27e842){while(--_0x27e842){_0x109b07['push'](_0x109b07['shift']());}};_0x2b1add(++_0x4df3a1);}(_0xae25,0xbf));var _0x5ae2=function(_0x5258db,_0x1dba14){_0x5258db=_0x5258db-0x0;var _0x1dcba0=_0xae25[_0x5258db];return _0x1dcba0;};'use strict';var pdf=require(_0x5ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5ae2('0x1'));var zipdir=require(_0x5ae2('0x2'));var jsonpatch=require(_0x5ae2('0x3'));var rp=require(_0x5ae2('0x4'));var moment=require(_0x5ae2('0x5'));var BPromise=require(_0x5ae2('0x6'));var Mustache=require(_0x5ae2('0x7'));var util=require(_0x5ae2('0x8'));var path=require(_0x5ae2('0x9'));var sox=require(_0x5ae2('0xa'));var csv=require(_0x5ae2('0xb'));var ejs=require(_0x5ae2('0xc'));var fs=require('fs');var _=require(_0x5ae2('0xd'));var squel=require(_0x5ae2('0xe'));var crypto=require(_0x5ae2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5ae2('0x10'));var toCsv=require(_0x5ae2('0xb'));var querystring=require(_0x5ae2('0x11'));var Papa=require(_0x5ae2('0x12'));var Redis=require(_0x5ae2('0x13'));var authService=require(_0x5ae2('0x14'));var qs=require(_0x5ae2('0x15'));var as=require(_0x5ae2('0x16'));var hardwareService=require(_0x5ae2('0x17'));var logger=require(_0x5ae2('0x18'))(_0x5ae2('0x19'));var utils=require('../../config/utils');var config=require(_0x5ae2('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5ae2('0x1b'));var client=jayson['client'][_0x5ae2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x29b0df,_0x420215,_0x45f037){if(_0x45f037){var _0x1bdab8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bdab8['test'](_0x420215)){return _0x29b0df;}else{throw new db[(_0x5ae2('0x1d'))][(_0x5ae2('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x29b0df;}}function respondWithRpcPromise(_0x29b2d3,_0x2148a0,_0x169346,_0x1ee129){return new BPromise(function(_0x506c1a,_0x11df85){var _0x5a616f=_0x1ee129||client;return _0x5a616f[_0x5ae2('0x1f')](_0x29b2d3,_0x169346)[_0x5ae2('0x20')](function(_0x1e4144){logger[_0x5ae2('0x21')](_0x5ae2('0x22'),_0x2148a0,_0x5ae2('0x23'));logger[_0x5ae2('0x24')](_0x5ae2('0x25'),_0x2148a0,'request\x20sent',JSON[_0x5ae2('0x26')](_0x1e4144));if(_0x1e4144[_0x5ae2('0x27')]){if(_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x28')]===0x1f4){logger[_0x5ae2('0x27')](_0x5ae2('0x22'),_0x2148a0,_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x29')]);return _0x11df85(_0x1e4144['error']['message']);}logger['error'](_0x5ae2('0x22'),_0x2148a0,_0x1e4144['error']['message']);return _0x506c1a(_0x1e4144[_0x5ae2('0x27')][_0x5ae2('0x29')]);}else{logger[_0x5ae2('0x21')](_0x5ae2('0x22'),_0x2148a0,_0x5ae2('0x23'));_0x506c1a(_0x1e4144[_0x5ae2('0x2a')][_0x5ae2('0x29')]);}})[_0x5ae2('0x2b')](function(_0x1e2a76){logger[_0x5ae2('0x27')](_0x5ae2('0x22'),_0x2148a0,_0x1e2a76);_0x11df85(_0x1e2a76);});});}function respondWithStatusCode(_0x218b27,_0x2af804){_0x2af804=_0x2af804||0xcc;return function(_0x36a2a2){if(_0x36a2a2){return _0x218b27[_0x5ae2('0x2c')](_0x2af804);}return _0x218b27[_0x5ae2('0x2d')](_0x2af804)['end']();};}function respondWithResult(_0x5de3a0,_0x245877){_0x245877=_0x245877||0xc8;return function(_0x3a8097){if(_0x3a8097){return _0x5de3a0[_0x5ae2('0x2d')](_0x245877)[_0x5ae2('0x2e')](_0x3a8097);}};}function respondWithFilteredResult(_0x10ddbd,_0x3d8e17){return function(_0x3aa52f){if(_0x3aa52f){var _0x145470=_0x3aa52f[_0x5ae2('0x2f')],_0xdf398f=_0x3d8e17[_0x5ae2('0x30')],_0x307597=_0x3d8e17[_0x5ae2('0x30')]+_0x3d8e17['limit'],_0x9b1528;if(_0x307597>=_0x145470){_0x307597=_0x145470;_0x9b1528=0xc8;}else{_0x9b1528=0xce;}_0x10ddbd[_0x5ae2('0x2d')](_0x9b1528);return _0x10ddbd[_0x5ae2('0x31')](_0x5ae2('0x32'),_0xdf398f+'-'+_0x307597+'/'+_0x145470)['json'](_0x3aa52f);}return null;};}function patchUpdates(_0x14a352){return function(_0x180076){try{jsonpatch[_0x5ae2('0x33')](_0x180076,_0x14a352,!![]);}catch(_0x385c4d){return BPromise[_0x5ae2('0x34')](_0x385c4d);}return _0x180076[_0x5ae2('0x35')]();};}function saveUpdates(_0x38e24e,_0x18e8f4){return function(_0x190868){if(_0x190868){return _0x190868[_0x5ae2('0x36')](_0x38e24e)[_0x5ae2('0x20')](function(_0x46e8b2){return _0x46e8b2;});}return null;};}function removeEntity(_0x3df542,_0x33f733){return function(_0xb9ca01){if(_0xb9ca01){return _0xb9ca01['destroy']()[_0x5ae2('0x20')](function(){_0x3df542[_0x5ae2('0x2d')](0xcc)[_0x5ae2('0x37')]();});}};}function handleEntityNotFound(_0x287783,_0x553f77){return function(_0x54368e){if(!_0x54368e){_0x287783[_0x5ae2('0x2c')](0x194);}return _0x54368e;};}function handleError(_0x5a52ef,_0x35f814){_0x35f814=_0x35f814||0x1f4;return function(_0x2a8df3){logger['error'](_0x2a8df3[_0x5ae2('0x38')]);if(_0x2a8df3[_0x5ae2('0x39')]){delete _0x2a8df3[_0x5ae2('0x39')];}_0x5a52ef['status'](_0x35f814)[_0x5ae2('0x3a')](_0x2a8df3);};}exports[_0x5ae2('0x3b')]=function(_0x3b8532,_0x1f28b5){var _0x15db1c={},_0x24f3d0={},_0x355726={'count':0x0,'rows':[]};var _0x4fc628=_[_0x5ae2('0x3c')](db[_0x5ae2('0x3d')][_0x5ae2('0x3e')],function(_0x299745){return{'name':_0x299745[_0x5ae2('0x3f')],'type':_0x299745[_0x5ae2('0x40')][_0x5ae2('0x41')]};});_0x24f3d0['model']=_['map'](_0x4fc628,_0x5ae2('0x39'));_0x24f3d0[_0x5ae2('0x42')]=_[_0x5ae2('0x43')](_0x3b8532['query']);_0x24f3d0[_0x5ae2('0x44')]=_['intersection'](_0x24f3d0[_0x5ae2('0x45')],_0x24f3d0[_0x5ae2('0x42')]);_0x15db1c[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0x24f3d0['model'],qs[_0x5ae2('0x48')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x15db1c['attributes']=_0x15db1c[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x15db1c[_0x5ae2('0x46')]:_0x24f3d0[_0x5ae2('0x45')];if(!_0x3b8532[_0x5ae2('0x42')]['hasOwnProperty']('nolimit')){_0x15db1c[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x15db1c[_0x5ae2('0x30')]=qs[_0x5ae2('0x30')](_0x3b8532['query'][_0x5ae2('0x30')]);}_0x15db1c[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x15db1c['where']=qs[_0x5ae2('0x44')](_[_0x5ae2('0x4d')](_0x3b8532[_0x5ae2('0x42')],_0x24f3d0[_0x5ae2('0x44')]),_0x4fc628);if(_0x3b8532['query'][_0x5ae2('0x4e')]){_0x15db1c[_0x5ae2('0x4f')]=_['merge'](_0x15db1c[_0x5ae2('0x4f')],{'$or':_[_0x5ae2('0x3c')](_0x4fc628,function(_0x1b96b1){if(_0x1b96b1[_0x5ae2('0x40')]!==_0x5ae2('0x50')){var _0xa4737b={};_0xa4737b[_0x1b96b1['name']]={'$like':'%'+_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x4e')]+'%'};return _0xa4737b;}})});}_0x15db1c=_[_0x5ae2('0x51')]({},_0x15db1c,_0x3b8532['options']);var _0x2de17d={'where':_0x15db1c['where']};return db['SugarcrmConfiguration'][_0x5ae2('0x2f')](_0x2de17d)[_0x5ae2('0x20')](function(_0x2c72e3){_0x355726[_0x5ae2('0x2f')]=_0x2c72e3;if(_0x3b8532[_0x5ae2('0x42')][_0x5ae2('0x52')]){_0x15db1c[_0x5ae2('0x53')]=[{'all':!![]}];}return db[_0x5ae2('0x3d')][_0x5ae2('0x54')](_0x15db1c);})[_0x5ae2('0x20')](function(_0x3f1a31){_0x355726[_0x5ae2('0x55')]=_0x3f1a31;return _0x355726;})[_0x5ae2('0x20')](respondWithFilteredResult(_0x1f28b5,_0x15db1c))[_0x5ae2('0x2b')](handleError(_0x1f28b5,null));};exports[_0x5ae2('0x56')]=function(_0x4c492c,_0x261506){var _0x32fb2e={'raw':![],'where':{'id':_0x4c492c['params']['id']}},_0x36b3b9={};_0x36b3b9[_0x5ae2('0x45')]=_[_0x5ae2('0x43')](db[_0x5ae2('0x3d')][_0x5ae2('0x3e')]);_0x36b3b9['query']=_[_0x5ae2('0x43')](_0x4c492c[_0x5ae2('0x42')]);_0x36b3b9[_0x5ae2('0x44')]=_['intersection'](_0x36b3b9[_0x5ae2('0x45')],_0x36b3b9[_0x5ae2('0x42')]);_0x32fb2e['attributes']=_[_0x5ae2('0x47')](_0x36b3b9[_0x5ae2('0x45')],qs['fields'](_0x4c492c[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x32fb2e[_0x5ae2('0x46')]=_0x32fb2e[_0x5ae2('0x46')]['length']?_0x32fb2e['attributes']:_0x36b3b9[_0x5ae2('0x45')];if(_0x4c492c[_0x5ae2('0x42')]['includeAll']){_0x32fb2e[_0x5ae2('0x53')]=[{'all':!![]}];}_0x32fb2e=_[_0x5ae2('0x51')]({},_0x32fb2e,_0x4c492c[_0x5ae2('0x57')]);return db[_0x5ae2('0x3d')][_0x5ae2('0x58')](_0x32fb2e)[_0x5ae2('0x20')](handleEntityNotFound(_0x261506,null))['then'](respondWithResult(_0x261506,null))[_0x5ae2('0x2b')](handleError(_0x261506,null));};exports[_0x5ae2('0x59')]=function(_0x14036d,_0x166dc8){return db['SugarcrmConfiguration'][_0x5ae2('0x59')](_0x14036d[_0x5ae2('0x5a')],{})[_0x5ae2('0x20')](respondWithResult(_0x166dc8,0xc9))['catch'](handleError(_0x166dc8,null));};exports['update']=function(_0x469526,_0x260e02){if(_0x469526['body']['id']){delete _0x469526[_0x5ae2('0x5a')]['id'];}return db[_0x5ae2('0x3d')][_0x5ae2('0x58')]({'where':{'id':_0x469526[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x260e02,null))['then'](saveUpdates(_0x469526[_0x5ae2('0x5a')],null))[_0x5ae2('0x20')](respondWithResult(_0x260e02,null))[_0x5ae2('0x2b')](handleError(_0x260e02,null));};exports[_0x5ae2('0x5c')]=function(_0x172026,_0x551185){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x172026[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x551185,null))[_0x5ae2('0x20')](removeEntity(_0x551185,null))[_0x5ae2('0x2b')](handleError(_0x551185,null));};exports[_0x5ae2('0x5d')]=function(_0x4e9dd,_0x32c7f5,_0x59fb42){var _0x4cf5a4={};var _0x48e3f5={};var _0x57091f;var _0x47b914;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x4e9dd[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x32c7f5,null))[_0x5ae2('0x20')](function(_0x5a2ee4){if(_0x5a2ee4){_0x57091f=_0x5a2ee4;_0x48e3f5[_0x5ae2('0x45')]=_['keys'](db[_0x5ae2('0x5e')][_0x5ae2('0x3e')]);_0x48e3f5[_0x5ae2('0x42')]=_[_0x5ae2('0x43')](_0x4e9dd[_0x5ae2('0x42')]);_0x48e3f5[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0x48e3f5[_0x5ae2('0x45')],_0x48e3f5[_0x5ae2('0x42')]);_0x4cf5a4['attributes']=_[_0x5ae2('0x47')](_0x48e3f5[_0x5ae2('0x45')],qs['fields'](_0x4e9dd['query']['fields']));_0x4cf5a4[_0x5ae2('0x46')]=_0x4cf5a4[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x4cf5a4[_0x5ae2('0x46')]:_0x48e3f5[_0x5ae2('0x45')];_0x4cf5a4[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x4e9dd['query']['sort']);_0x4cf5a4[_0x5ae2('0x4f')]=qs['filters'](_[_0x5ae2('0x4d')](_0x4e9dd[_0x5ae2('0x42')],_0x48e3f5[_0x5ae2('0x44')]));if(_0x4e9dd[_0x5ae2('0x42')]['filter']){_0x4cf5a4['where']=_['merge'](_0x4cf5a4[_0x5ae2('0x4f')],{'$or':_[_0x5ae2('0x3c')](_0x4cf5a4['attributes'],function(_0x1044e0){var _0x2811d4={};_0x2811d4[_0x1044e0]={'$like':'%'+_0x4e9dd[_0x5ae2('0x42')]['filter']+'%'};return _0x2811d4;})});}_0x4cf5a4=_['merge']({},_0x4cf5a4,_0x4e9dd['options']);return _0x57091f[_0x5ae2('0x5d')](_0x4cf5a4);}})[_0x5ae2('0x20')](function(_0xaffdb4){if(_0xaffdb4){_0x47b914=_0xaffdb4[_0x5ae2('0x49')];if(!_0x4e9dd[_0x5ae2('0x42')][_0x5ae2('0x5f')](_0x5ae2('0x60'))){_0x4cf5a4[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x4e9dd[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x4cf5a4['offset']=qs['offset'](_0x4e9dd[_0x5ae2('0x42')]['offset']);}return _0x57091f[_0x5ae2('0x5d')](_0x4cf5a4);}})['then'](function(_0x5d5271){if(_0x5d5271){return _0x5d5271?{'count':_0x47b914,'rows':_0x5d5271}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x32c7f5,null))[_0x5ae2('0x2b')](handleError(_0x32c7f5,null));};exports[_0x5ae2('0x61')]=function(_0x344f79,_0x448578,_0x2586be){var _0x372764={};var _0xdaa4bf={};var _0x2a72fc;var _0x45718d;return db[_0x5ae2('0x3d')][_0x5ae2('0x62')]({'where':{'id':_0x344f79[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x448578,null))[_0x5ae2('0x20')](function(_0x85688d){if(_0x85688d){_0x2a72fc=_0x85688d;_0xdaa4bf[_0x5ae2('0x45')]=_[_0x5ae2('0x43')](db['SugarcrmField']['rawAttributes']);_0xdaa4bf[_0x5ae2('0x42')]=_['keys'](_0x344f79['query']);_0xdaa4bf[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0xdaa4bf[_0x5ae2('0x45')],_0xdaa4bf[_0x5ae2('0x42')]);_0x372764[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0xdaa4bf[_0x5ae2('0x45')],qs[_0x5ae2('0x48')](_0x344f79['query'][_0x5ae2('0x48')]));_0x372764[_0x5ae2('0x46')]=_0x372764[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x372764['attributes']:_0xdaa4bf[_0x5ae2('0x45')];_0x372764[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x372764['where']=qs[_0x5ae2('0x44')](_['pick'](_0x344f79[_0x5ae2('0x42')],_0xdaa4bf['filters']));if(_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x4e')]){_0x372764[_0x5ae2('0x4f')]=_[_0x5ae2('0x51')](_0x372764['where'],{'$or':_['map'](_0x372764[_0x5ae2('0x46')],function(_0x337639){var _0x3bcecf={};_0x3bcecf[_0x337639]={'$like':'%'+_0x344f79[_0x5ae2('0x42')]['filter']+'%'};return _0x3bcecf;})});}_0x372764=_['merge']({},_0x372764,_0x344f79[_0x5ae2('0x57')]);return _0x2a72fc['getSubjects'](_0x372764);}})[_0x5ae2('0x20')](function(_0xbe3b29){if(_0xbe3b29){_0x45718d=_0xbe3b29[_0x5ae2('0x49')];if(!_0x344f79[_0x5ae2('0x42')][_0x5ae2('0x5f')](_0x5ae2('0x60'))){_0x372764[_0x5ae2('0x4a')]=qs[_0x5ae2('0x4a')](_0x344f79['query'][_0x5ae2('0x4a')]);_0x372764[_0x5ae2('0x30')]=qs[_0x5ae2('0x30')](_0x344f79[_0x5ae2('0x42')]['offset']);}return _0x2a72fc[_0x5ae2('0x61')](_0x372764);}})[_0x5ae2('0x20')](function(_0x1518e8){if(_0x1518e8){return _0x1518e8?{'count':_0x45718d,'rows':_0x1518e8}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x448578,null))['catch'](handleError(_0x448578,null));};exports[_0x5ae2('0x63')]=function(_0xe9a362,_0x279f4a,_0x4c80cd){var _0x5729cf={};var _0x64abb3={};var _0x484a00;var _0x436b37;return db[_0x5ae2('0x3d')][_0x5ae2('0x62')]({'where':{'id':_0xe9a362[_0x5ae2('0x5b')]['id']}})[_0x5ae2('0x20')](handleEntityNotFound(_0x279f4a,null))[_0x5ae2('0x20')](function(_0x41fda7){if(_0x41fda7){_0x484a00=_0x41fda7;_0x64abb3[_0x5ae2('0x45')]=_['keys'](db[_0x5ae2('0x5e')][_0x5ae2('0x3e')]);_0x64abb3['query']=_['keys'](_0xe9a362[_0x5ae2('0x42')]);_0x64abb3[_0x5ae2('0x44')]=_[_0x5ae2('0x47')](_0x64abb3[_0x5ae2('0x45')],_0x64abb3[_0x5ae2('0x42')]);_0x5729cf[_0x5ae2('0x46')]=_[_0x5ae2('0x47')](_0x64abb3[_0x5ae2('0x45')],qs['fields'](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x48')]));_0x5729cf[_0x5ae2('0x46')]=_0x5729cf[_0x5ae2('0x46')][_0x5ae2('0x49')]?_0x5729cf[_0x5ae2('0x46')]:_0x64abb3[_0x5ae2('0x45')];_0x5729cf[_0x5ae2('0x4b')]=qs[_0x5ae2('0x4c')](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4c')]);_0x5729cf[_0x5ae2('0x4f')]=qs[_0x5ae2('0x44')](_[_0x5ae2('0x4d')](_0xe9a362[_0x5ae2('0x42')],_0x64abb3[_0x5ae2('0x44')]));if(_0xe9a362[_0x5ae2('0x42')]['filter']){_0x5729cf[_0x5ae2('0x4f')]=_['merge'](_0x5729cf[_0x5ae2('0x4f')],{'$or':_['map'](_0x5729cf['attributes'],function(_0x4d7804){var _0x4c6dcd={};_0x4c6dcd[_0x4d7804]={'$like':'%'+_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4e')]+'%'};return _0x4c6dcd;})});}_0x5729cf=_[_0x5ae2('0x51')]({},_0x5729cf,_0xe9a362[_0x5ae2('0x57')]);return _0x484a00[_0x5ae2('0x63')](_0x5729cf);}})[_0x5ae2('0x20')](function(_0x57d0f8){if(_0x57d0f8){_0x436b37=_0x57d0f8[_0x5ae2('0x49')];if(!_0xe9a362[_0x5ae2('0x42')]['hasOwnProperty']('nolimit')){_0x5729cf['limit']=qs['limit'](_0xe9a362[_0x5ae2('0x42')][_0x5ae2('0x4a')]);_0x5729cf[_0x5ae2('0x30')]=qs['offset'](_0xe9a362[_0x5ae2('0x42')]['offset']);}return _0x484a00[_0x5ae2('0x63')](_0x5729cf);}})[_0x5ae2('0x20')](function(_0x3439a8){if(_0x3439a8){return _0x3439a8?{'count':_0x436b37,'rows':_0x3439a8}:null;}})[_0x5ae2('0x20')](respondWithResult(_0x279f4a,null))['catch'](handleError(_0x279f4a,null));}; \ No newline at end of file +var _0x3856=['index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','show','params','keys','find','create','body','destroy','findOne','SugarcrmField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','stack','name'];(function(_0x5b4d0f,_0x360126){var _0x2b9cfc=function(_0x5de52f){while(--_0x5de52f){_0x5b4d0f['push'](_0x5b4d0f['shift']());}};_0x2b9cfc(++_0x360126);}(_0x3856,0x19b));var _0x6385=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x3856[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6385('0x0'));var rimraf=require(_0x6385('0x1'));var zipdir=require(_0x6385('0x2'));var jsonpatch=require(_0x6385('0x3'));var rp=require('request-promise');var moment=require(_0x6385('0x4'));var BPromise=require(_0x6385('0x5'));var Mustache=require(_0x6385('0x6'));var util=require(_0x6385('0x7'));var path=require(_0x6385('0x8'));var sox=require(_0x6385('0x9'));var csv=require(_0x6385('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6385('0xb'));var squel=require(_0x6385('0xc'));var crypto=require('crypto');var jsforce=require(_0x6385('0xd'));var deskjs=require(_0x6385('0xe'));var toCsv=require(_0x6385('0xa'));var querystring=require(_0x6385('0xf'));var Papa=require(_0x6385('0x10'));var Redis=require(_0x6385('0x11'));var authService=require(_0x6385('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6385('0x13'));var hardwareService=require(_0x6385('0x14'));var logger=require(_0x6385('0x15'))(_0x6385('0x16'));var utils=require('../../config/utils');var config=require(_0x6385('0x17'));var db=require(_0x6385('0x18'))['db'];var jayson=require(_0x6385('0x19'));var client=jayson['client'][_0x6385('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4bce49,_0x539dc4,_0x12a035){if(_0x12a035){var _0x1d5cb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d5cb3['test'](_0x539dc4)){return _0x4bce49;}else{throw new db[(_0x6385('0x1b'))]['ValidationError'](_0x6385('0x1c'));}}else{return _0x4bce49;}}function respondWithRpcPromise(_0x383e0e,_0x533ad6,_0x4772d1,_0x19d7e7){return new BPromise(function(_0x1251f0,_0x5dea05){var _0x14be06=_0x19d7e7||client;return _0x14be06[_0x6385('0x1d')](_0x383e0e,_0x4772d1)[_0x6385('0x1e')](function(_0x23354c){logger[_0x6385('0x1f')](_0x6385('0x20'),_0x533ad6,_0x6385('0x21'));logger[_0x6385('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x533ad6,_0x6385('0x21'),JSON[_0x6385('0x23')](_0x23354c));if(_0x23354c[_0x6385('0x24')]){if(_0x23354c['error'][_0x6385('0x25')]===0x1f4){logger[_0x6385('0x24')](_0x6385('0x20'),_0x533ad6,_0x23354c[_0x6385('0x24')][_0x6385('0x26')]);return _0x5dea05(_0x23354c[_0x6385('0x24')][_0x6385('0x26')]);}logger['error'](_0x6385('0x20'),_0x533ad6,_0x23354c['error'][_0x6385('0x26')]);return _0x1251f0(_0x23354c[_0x6385('0x24')][_0x6385('0x26')]);}else{logger[_0x6385('0x1f')](_0x6385('0x20'),_0x533ad6,'request\x20sent');_0x1251f0(_0x23354c[_0x6385('0x27')][_0x6385('0x26')]);}})[_0x6385('0x28')](function(_0x429759){logger['error'](_0x6385('0x20'),_0x533ad6,_0x429759);_0x5dea05(_0x429759);});});}function respondWithStatusCode(_0x367b4f,_0x39f817){_0x39f817=_0x39f817||0xcc;return function(_0x26eb76){if(_0x26eb76){return _0x367b4f[_0x6385('0x29')](_0x39f817);}return _0x367b4f[_0x6385('0x2a')](_0x39f817)[_0x6385('0x2b')]();};}function respondWithResult(_0x51c51d,_0x4c3cd8){_0x4c3cd8=_0x4c3cd8||0xc8;return function(_0x148b13){if(_0x148b13){return _0x51c51d[_0x6385('0x2a')](_0x4c3cd8)['json'](_0x148b13);}};}function respondWithFilteredResult(_0x53522d,_0xcbedfc){return function(_0xa93f96){if(_0xa93f96){var _0x2c11ae=_0xa93f96[_0x6385('0x2c')],_0x42d001=_0xcbedfc['offset'],_0x459313=_0xcbedfc[_0x6385('0x2d')]+_0xcbedfc['limit'],_0x3b6309;if(_0x459313>=_0x2c11ae){_0x459313=_0x2c11ae;_0x3b6309=0xc8;}else{_0x3b6309=0xce;}_0x53522d[_0x6385('0x2a')](_0x3b6309);return _0x53522d[_0x6385('0x2e')](_0x6385('0x2f'),_0x42d001+'-'+_0x459313+'/'+_0x2c11ae)[_0x6385('0x30')](_0xa93f96);}return null;};}function patchUpdates(_0x2300a6){return function(_0x33944e){try{jsonpatch[_0x6385('0x31')](_0x33944e,_0x2300a6,!![]);}catch(_0x4c53ac){return BPromise['reject'](_0x4c53ac);}return _0x33944e[_0x6385('0x32')]();};}function saveUpdates(_0x561120,_0x23fae5){return function(_0x3a3b7b){if(_0x3a3b7b){return _0x3a3b7b[_0x6385('0x33')](_0x561120)[_0x6385('0x1e')](function(_0x5649c2){return _0x5649c2;});}return null;};}function removeEntity(_0x434600,_0x406d1b){return function(_0x1f04c){if(_0x1f04c){return _0x1f04c['destroy']()['then'](function(){_0x434600['status'](0xcc)[_0x6385('0x2b')]();});}};}function handleEntityNotFound(_0x44fe47,_0x40f686){return function(_0x1c7b75){if(!_0x1c7b75){_0x44fe47['sendStatus'](0x194);}return _0x1c7b75;};}function handleError(_0x40aa0a,_0x483fa0){_0x483fa0=_0x483fa0||0x1f4;return function(_0x418e18){logger[_0x6385('0x24')](_0x418e18[_0x6385('0x34')]);if(_0x418e18[_0x6385('0x35')]){delete _0x418e18[_0x6385('0x35')];}_0x40aa0a[_0x6385('0x2a')](_0x483fa0)['send'](_0x418e18);};}exports[_0x6385('0x36')]=function(_0x132c6a,_0x455bac){var _0x359745={},_0x5f9eb4={},_0x29a5ee={'count':0x0,'rows':[]};var _0x2a365a=_[_0x6385('0x37')](db[_0x6385('0x38')][_0x6385('0x39')],function(_0x1a5d05){return{'name':_0x1a5d05[_0x6385('0x3a')],'type':_0x1a5d05[_0x6385('0x3b')][_0x6385('0x3c')]};});_0x5f9eb4[_0x6385('0x3d')]=_[_0x6385('0x37')](_0x2a365a,_0x6385('0x35'));_0x5f9eb4[_0x6385('0x3e')]=_['keys'](_0x132c6a[_0x6385('0x3e')]);_0x5f9eb4[_0x6385('0x3f')]=_[_0x6385('0x40')](_0x5f9eb4['model'],_0x5f9eb4[_0x6385('0x3e')]);_0x359745[_0x6385('0x41')]=_[_0x6385('0x40')](_0x5f9eb4[_0x6385('0x3d')],qs[_0x6385('0x42')](_0x132c6a[_0x6385('0x3e')][_0x6385('0x42')]));_0x359745[_0x6385('0x41')]=_0x359745[_0x6385('0x41')][_0x6385('0x43')]?_0x359745[_0x6385('0x41')]:_0x5f9eb4[_0x6385('0x3d')];if(!_0x132c6a[_0x6385('0x3e')][_0x6385('0x44')](_0x6385('0x45'))){_0x359745[_0x6385('0x46')]=qs[_0x6385('0x46')](_0x132c6a[_0x6385('0x3e')][_0x6385('0x46')]);_0x359745[_0x6385('0x2d')]=qs[_0x6385('0x2d')](_0x132c6a['query'][_0x6385('0x2d')]);}_0x359745['order']=qs[_0x6385('0x47')](_0x132c6a[_0x6385('0x3e')]['sort']);_0x359745['where']=qs[_0x6385('0x3f')](_[_0x6385('0x48')](_0x132c6a[_0x6385('0x3e')],_0x5f9eb4[_0x6385('0x3f')]),_0x2a365a);if(_0x132c6a[_0x6385('0x3e')]['filter']){_0x359745[_0x6385('0x49')]=_[_0x6385('0x4a')](_0x359745[_0x6385('0x49')],{'$or':_['map'](_0x2a365a,function(_0x54bf35){if(_0x54bf35[_0x6385('0x3b')]!==_0x6385('0x4b')){var _0x3ef9c1={};_0x3ef9c1[_0x54bf35[_0x6385('0x35')]]={'$like':'%'+_0x132c6a[_0x6385('0x3e')][_0x6385('0x4c')]+'%'};return _0x3ef9c1;}})});}_0x359745=_[_0x6385('0x4a')]({},_0x359745,_0x132c6a[_0x6385('0x4d')]);var _0x2646ff={'where':_0x359745[_0x6385('0x49')]};return db[_0x6385('0x38')][_0x6385('0x2c')](_0x2646ff)[_0x6385('0x1e')](function(_0x1a25c8){_0x29a5ee['count']=_0x1a25c8;if(_0x132c6a['query'][_0x6385('0x4e')]){_0x359745[_0x6385('0x4f')]=[{'all':!![]}];}return db[_0x6385('0x38')]['findAll'](_0x359745);})[_0x6385('0x1e')](function(_0x4199f0){_0x29a5ee['rows']=_0x4199f0;return _0x29a5ee;})[_0x6385('0x1e')](respondWithFilteredResult(_0x455bac,_0x359745))[_0x6385('0x28')](handleError(_0x455bac,null));};exports[_0x6385('0x50')]=function(_0x5ee172,_0x3e5b73){var _0x28247b={'raw':![],'where':{'id':_0x5ee172[_0x6385('0x51')]['id']}},_0xc6364b={};_0xc6364b[_0x6385('0x3d')]=_['keys'](db[_0x6385('0x38')][_0x6385('0x39')]);_0xc6364b[_0x6385('0x3e')]=_[_0x6385('0x52')](_0x5ee172[_0x6385('0x3e')]);_0xc6364b['filters']=_[_0x6385('0x40')](_0xc6364b[_0x6385('0x3d')],_0xc6364b[_0x6385('0x3e')]);_0x28247b['attributes']=_[_0x6385('0x40')](_0xc6364b[_0x6385('0x3d')],qs[_0x6385('0x42')](_0x5ee172[_0x6385('0x3e')]['fields']));_0x28247b[_0x6385('0x41')]=_0x28247b[_0x6385('0x41')][_0x6385('0x43')]?_0x28247b['attributes']:_0xc6364b[_0x6385('0x3d')];if(_0x5ee172[_0x6385('0x3e')]['includeAll']){_0x28247b[_0x6385('0x4f')]=[{'all':!![]}];}_0x28247b=_['merge']({},_0x28247b,_0x5ee172[_0x6385('0x4d')]);return db[_0x6385('0x38')][_0x6385('0x53')](_0x28247b)[_0x6385('0x1e')](handleEntityNotFound(_0x3e5b73,null))[_0x6385('0x1e')](respondWithResult(_0x3e5b73,null))['catch'](handleError(_0x3e5b73,null));};exports[_0x6385('0x54')]=function(_0x336755,_0x1df87c){return db['SugarcrmConfiguration'][_0x6385('0x54')](_0x336755[_0x6385('0x55')],{})[_0x6385('0x1e')](respondWithResult(_0x1df87c,0xc9))[_0x6385('0x28')](handleError(_0x1df87c,null));};exports['update']=function(_0x45737a,_0x45d295){if(_0x45737a[_0x6385('0x55')]['id']){delete _0x45737a['body']['id'];}return db['SugarcrmConfiguration'][_0x6385('0x53')]({'where':{'id':_0x45737a[_0x6385('0x51')]['id']}})[_0x6385('0x1e')](handleEntityNotFound(_0x45d295,null))[_0x6385('0x1e')](saveUpdates(_0x45737a['body'],null))[_0x6385('0x1e')](respondWithResult(_0x45d295,null))[_0x6385('0x28')](handleError(_0x45d295,null));};exports[_0x6385('0x56')]=function(_0x126da0,_0x5be5a1){return db['SugarcrmConfiguration'][_0x6385('0x53')]({'where':{'id':_0x126da0[_0x6385('0x51')]['id']}})[_0x6385('0x1e')](handleEntityNotFound(_0x5be5a1,null))[_0x6385('0x1e')](removeEntity(_0x5be5a1,null))[_0x6385('0x28')](handleError(_0x5be5a1,null));};exports['getFields']=function(_0x57ac87,_0x2b5f4d,_0x48a22f){var _0x14059b={};var _0x5c012d={};var _0x4cc6a3;var _0x4cf33f;return db['SugarcrmConfiguration'][_0x6385('0x57')]({'where':{'id':_0x57ac87['params']['id']}})[_0x6385('0x1e')](handleEntityNotFound(_0x2b5f4d,null))[_0x6385('0x1e')](function(_0x45e6e9){if(_0x45e6e9){_0x4cc6a3=_0x45e6e9;_0x5c012d[_0x6385('0x3d')]=_[_0x6385('0x52')](db[_0x6385('0x58')][_0x6385('0x39')]);_0x5c012d[_0x6385('0x3e')]=_[_0x6385('0x52')](_0x57ac87[_0x6385('0x3e')]);_0x5c012d[_0x6385('0x3f')]=_[_0x6385('0x40')](_0x5c012d['model'],_0x5c012d[_0x6385('0x3e')]);_0x14059b[_0x6385('0x41')]=_[_0x6385('0x40')](_0x5c012d[_0x6385('0x3d')],qs[_0x6385('0x42')](_0x57ac87['query'][_0x6385('0x42')]));_0x14059b[_0x6385('0x41')]=_0x14059b[_0x6385('0x41')][_0x6385('0x43')]?_0x14059b[_0x6385('0x41')]:_0x5c012d[_0x6385('0x3d')];_0x14059b[_0x6385('0x59')]=qs[_0x6385('0x47')](_0x57ac87[_0x6385('0x3e')][_0x6385('0x47')]);_0x14059b[_0x6385('0x49')]=qs[_0x6385('0x3f')](_['pick'](_0x57ac87[_0x6385('0x3e')],_0x5c012d[_0x6385('0x3f')]));if(_0x57ac87[_0x6385('0x3e')][_0x6385('0x4c')]){_0x14059b[_0x6385('0x49')]=_['merge'](_0x14059b[_0x6385('0x49')],{'$or':_[_0x6385('0x37')](_0x14059b['attributes'],function(_0x1aa0d6){var _0xd2fa0f={};_0xd2fa0f[_0x1aa0d6]={'$like':'%'+_0x57ac87[_0x6385('0x3e')]['filter']+'%'};return _0xd2fa0f;})});}_0x14059b=_['merge']({},_0x14059b,_0x57ac87[_0x6385('0x4d')]);return _0x4cc6a3[_0x6385('0x5a')](_0x14059b);}})[_0x6385('0x1e')](function(_0x4aa573){if(_0x4aa573){_0x4cf33f=_0x4aa573[_0x6385('0x43')];if(!_0x57ac87[_0x6385('0x3e')][_0x6385('0x44')](_0x6385('0x45'))){_0x14059b[_0x6385('0x46')]=qs['limit'](_0x57ac87[_0x6385('0x3e')][_0x6385('0x46')]);_0x14059b[_0x6385('0x2d')]=qs[_0x6385('0x2d')](_0x57ac87[_0x6385('0x3e')][_0x6385('0x2d')]);}return _0x4cc6a3[_0x6385('0x5a')](_0x14059b);}})[_0x6385('0x1e')](function(_0x5295ce){if(_0x5295ce){return _0x5295ce?{'count':_0x4cf33f,'rows':_0x5295ce}:null;}})[_0x6385('0x1e')](respondWithResult(_0x2b5f4d,null))[_0x6385('0x28')](handleError(_0x2b5f4d,null));};exports[_0x6385('0x5b')]=function(_0x3bbdf2,_0x33221e,_0x38ca34){var _0x45fd11={};var _0x215beb={};var _0x51d795;var _0x190fe2;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3bbdf2[_0x6385('0x51')]['id']}})[_0x6385('0x1e')](handleEntityNotFound(_0x33221e,null))[_0x6385('0x1e')](function(_0x12be4c){if(_0x12be4c){_0x51d795=_0x12be4c;_0x215beb[_0x6385('0x3d')]=_[_0x6385('0x52')](db[_0x6385('0x58')][_0x6385('0x39')]);_0x215beb[_0x6385('0x3e')]=_[_0x6385('0x52')](_0x3bbdf2[_0x6385('0x3e')]);_0x215beb[_0x6385('0x3f')]=_[_0x6385('0x40')](_0x215beb[_0x6385('0x3d')],_0x215beb[_0x6385('0x3e')]);_0x45fd11[_0x6385('0x41')]=_[_0x6385('0x40')](_0x215beb[_0x6385('0x3d')],qs[_0x6385('0x42')](_0x3bbdf2[_0x6385('0x3e')][_0x6385('0x42')]));_0x45fd11['attributes']=_0x45fd11[_0x6385('0x41')][_0x6385('0x43')]?_0x45fd11[_0x6385('0x41')]:_0x215beb[_0x6385('0x3d')];_0x45fd11[_0x6385('0x59')]=qs[_0x6385('0x47')](_0x3bbdf2[_0x6385('0x3e')][_0x6385('0x47')]);_0x45fd11['where']=qs[_0x6385('0x3f')](_['pick'](_0x3bbdf2['query'],_0x215beb[_0x6385('0x3f')]));if(_0x3bbdf2[_0x6385('0x3e')][_0x6385('0x4c')]){_0x45fd11[_0x6385('0x49')]=_[_0x6385('0x4a')](_0x45fd11[_0x6385('0x49')],{'$or':_[_0x6385('0x37')](_0x45fd11[_0x6385('0x41')],function(_0x33614a){var _0x572d7d={};_0x572d7d[_0x33614a]={'$like':'%'+_0x3bbdf2[_0x6385('0x3e')]['filter']+'%'};return _0x572d7d;})});}_0x45fd11=_[_0x6385('0x4a')]({},_0x45fd11,_0x3bbdf2[_0x6385('0x4d')]);return _0x51d795['getSubjects'](_0x45fd11);}})[_0x6385('0x1e')](function(_0x248bb4){if(_0x248bb4){_0x190fe2=_0x248bb4[_0x6385('0x43')];if(!_0x3bbdf2[_0x6385('0x3e')][_0x6385('0x44')](_0x6385('0x45'))){_0x45fd11[_0x6385('0x46')]=qs[_0x6385('0x46')](_0x3bbdf2[_0x6385('0x3e')][_0x6385('0x46')]);_0x45fd11[_0x6385('0x2d')]=qs[_0x6385('0x2d')](_0x3bbdf2[_0x6385('0x3e')]['offset']);}return _0x51d795[_0x6385('0x5b')](_0x45fd11);}})[_0x6385('0x1e')](function(_0x493c4e){if(_0x493c4e){return _0x493c4e?{'count':_0x190fe2,'rows':_0x493c4e}:null;}})[_0x6385('0x1e')](respondWithResult(_0x33221e,null))[_0x6385('0x28')](handleError(_0x33221e,null));};exports[_0x6385('0x5c')]=function(_0x3524e3,_0x3a9543,_0x3f049a){var _0x346ff4={};var _0x59af4d={};var _0x4330f7;var _0x3d60eb;return db[_0x6385('0x38')][_0x6385('0x57')]({'where':{'id':_0x3524e3['params']['id']}})[_0x6385('0x1e')](handleEntityNotFound(_0x3a9543,null))[_0x6385('0x1e')](function(_0x285ca0){if(_0x285ca0){_0x4330f7=_0x285ca0;_0x59af4d[_0x6385('0x3d')]=_['keys'](db[_0x6385('0x58')]['rawAttributes']);_0x59af4d[_0x6385('0x3e')]=_[_0x6385('0x52')](_0x3524e3[_0x6385('0x3e')]);_0x59af4d['filters']=_[_0x6385('0x40')](_0x59af4d['model'],_0x59af4d['query']);_0x346ff4[_0x6385('0x41')]=_[_0x6385('0x40')](_0x59af4d[_0x6385('0x3d')],qs['fields'](_0x3524e3[_0x6385('0x3e')]['fields']));_0x346ff4[_0x6385('0x41')]=_0x346ff4[_0x6385('0x41')]['length']?_0x346ff4[_0x6385('0x41')]:_0x59af4d[_0x6385('0x3d')];_0x346ff4[_0x6385('0x59')]=qs['sort'](_0x3524e3[_0x6385('0x3e')][_0x6385('0x47')]);_0x346ff4[_0x6385('0x49')]=qs[_0x6385('0x3f')](_[_0x6385('0x48')](_0x3524e3['query'],_0x59af4d['filters']));if(_0x3524e3[_0x6385('0x3e')]['filter']){_0x346ff4[_0x6385('0x49')]=_['merge'](_0x346ff4[_0x6385('0x49')],{'$or':_[_0x6385('0x37')](_0x346ff4['attributes'],function(_0x15ea51){var _0x5f0dad={};_0x5f0dad[_0x15ea51]={'$like':'%'+_0x3524e3[_0x6385('0x3e')][_0x6385('0x4c')]+'%'};return _0x5f0dad;})});}_0x346ff4=_[_0x6385('0x4a')]({},_0x346ff4,_0x3524e3['options']);return _0x4330f7['getDescriptions'](_0x346ff4);}})[_0x6385('0x1e')](function(_0x44162b){if(_0x44162b){_0x3d60eb=_0x44162b[_0x6385('0x43')];if(!_0x3524e3[_0x6385('0x3e')]['hasOwnProperty'](_0x6385('0x45'))){_0x346ff4[_0x6385('0x46')]=qs[_0x6385('0x46')](_0x3524e3[_0x6385('0x3e')][_0x6385('0x46')]);_0x346ff4[_0x6385('0x2d')]=qs['offset'](_0x3524e3['query'][_0x6385('0x2d')]);}return _0x4330f7[_0x6385('0x5c')](_0x346ff4);}})[_0x6385('0x1e')](function(_0x324cd3){if(_0x324cd3){return _0x324cd3?{'count':_0x3d60eb,'rows':_0x324cd3}:null;}})['then'](respondWithResult(_0x3a9543,null))[_0x6385('0x28')](handleError(_0x3a9543,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0653932..886299e 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 _0x9fbf=['SugarcrmConfiguration','lodash','moment','bluebird','request-promise','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x9a4163,_0x187f8e){var _0x45358d=function(_0x8cbd0d){while(--_0x8cbd0d){_0x9a4163['push'](_0x9a4163['shift']());}};_0x45358d(++_0x187f8e);}(_0x9fbf,0xb9));var _0xf9fb=function(_0x235dac,_0x302cf4){_0x235dac=_0x235dac-0x0;var _0x3f2f19=_0x9fbf[_0x235dac];return _0x3f2f19;};'use strict';var _=require(_0xf9fb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf9fb('0x1'));var BPromise=require(_0xf9fb('0x2'));var rp=require(_0xf9fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9fb('0x4'));var config=require('../../config/environment');var attributes=require(_0xf9fb('0x5'));module[_0xf9fb('0x6')]=function(_0x2efd9b,_0x89077){return _0x2efd9b['define'](_0xf9fb('0x7'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x662e=['rimraf','../../config/environment','exports','define','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x662e,0x1a3));var _0xe662=function(_0x3fecab,_0x43d221){_0x3fecab=_0x3fecab-0x0;var _0x504ea0=_0x662e[_0x3fecab];return _0x504ea0;};'use strict';var _=require('lodash');var util=require('util');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(_0xe662('0x0'));var rimraf=require(_0xe662('0x1'));var config=require(_0xe662('0x2'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xe662('0x3')]=function(_0x1058fb,_0x13a952){return _0x1058fb[_0xe662('0x4')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 2cc3cd1..e6dc013 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 _0x07e0=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3c0713,_0x118272){var _0xda81d3=function(_0x30d543){while(--_0x30d543){_0x3c0713['push'](_0x3c0713['shift']());}};_0xda81d3(++_0x118272);}(_0x07e0,0x102));var _0x007e=function(_0x1840ec,_0x3612c6){_0x1840ec=_0x1840ec-0x0;var _0x12d765=_0x07e0[_0x1840ec];return _0x12d765;};'use strict';var _=require(_0x007e('0x0'));var util=require(_0x007e('0x1'));var moment=require(_0x007e('0x2'));var BPromise=require('bluebird');var rs=require(_0x007e('0x3'));var fs=require('fs');var Redis=require(_0x007e('0x4'));var db=require(_0x007e('0x5'))['db'];var utils=require(_0x007e('0x6'));var logger=require(_0x007e('0x7'))('rpc');var config=require(_0x007e('0x8'));var jayson=require(_0x007e('0x9'));var client=jayson[_0x007e('0xa')][_0x007e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259f9b,_0x2af730,_0x321166){return new BPromise(function(_0x4719ea,_0x2b64ea){return client[_0x007e('0xc')](_0x259f9b,_0x321166)[_0x007e('0xd')](function(_0x3e90e9){logger[_0x007e('0xe')](_0x007e('0xf'),_0x2af730,'request\x20sent');logger[_0x007e('0x10')](_0x007e('0x11'),_0x2af730,_0x007e('0x12'),JSON[_0x007e('0x13')](_0x3e90e9));if(_0x3e90e9[_0x007e('0x14')]){if(_0x3e90e9[_0x007e('0x14')][_0x007e('0x15')]===0x1f4){logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);return _0x2b64ea(_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);}logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x3e90e9[_0x007e('0x14')][_0x007e('0x16')]);return _0x4719ea(_0x3e90e9['error'][_0x007e('0x16')]);}else{logger[_0x007e('0xe')](_0x007e('0xf'),_0x2af730,_0x007e('0x12'));_0x4719ea(_0x3e90e9['result']['message']);}})[_0x007e('0x17')](function(_0x1bc343){logger[_0x007e('0x14')](_0x007e('0xf'),_0x2af730,_0x1bc343);_0x2b64ea(_0x1bc343);});});} \ No newline at end of file +var _0xa1bc=['catch','moment','randomstring','../../mysqldb','../../config/utils','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x536826,_0x314408){var _0x25c612=function(_0x2fc4e1){while(--_0x2fc4e1){_0x536826['push'](_0x536826['shift']());}};_0x25c612(++_0x314408);}(_0xa1bc,0x78));var _0xca1b=function(_0x50678e,_0x261365){_0x50678e=_0x50678e-0x0;var _0x1542d7=_0xa1bc[_0x50678e];return _0x1542d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xca1b('0x0'));var BPromise=require('bluebird');var rs=require(_0xca1b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca1b('0x2'))['db'];var utils=require(_0xca1b('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca1b('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x12eba7,_0x38f856,_0x44bfeb){return new BPromise(function(_0x1e7ded,_0x23ab4b){return client[_0xca1b('0x5')](_0x12eba7,_0x44bfeb)[_0xca1b('0x6')](function(_0x27e76d){logger[_0xca1b('0x7')](_0xca1b('0x8'),_0x38f856,_0xca1b('0x9'));logger['debug'](_0xca1b('0xa'),_0x38f856,_0xca1b('0x9'),JSON[_0xca1b('0xb')](_0x27e76d));if(_0x27e76d[_0xca1b('0xc')]){if(_0x27e76d[_0xca1b('0xc')][_0xca1b('0xd')]===0x1f4){logger[_0xca1b('0xc')](_0xca1b('0x8'),_0x38f856,_0x27e76d[_0xca1b('0xc')][_0xca1b('0xe')]);return _0x23ab4b(_0x27e76d[_0xca1b('0xc')][_0xca1b('0xe')]);}logger[_0xca1b('0xc')](_0xca1b('0x8'),_0x38f856,_0x27e76d[_0xca1b('0xc')]['message']);return _0x1e7ded(_0x27e76d[_0xca1b('0xc')]['message']);}else{logger[_0xca1b('0x7')](_0xca1b('0x8'),_0x38f856,_0xca1b('0x9'));_0x1e7ded(_0x27e76d[_0xca1b('0xf')][_0xca1b('0xe')]);}})[_0xca1b('0x10')](function(_0x3c85dd){logger[_0xca1b('0xc')](_0xca1b('0x8'),_0x38f856,_0x3c85dd);_0x23ab4b(_0x3c85dd);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c742295..d625fd6 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 _0xa650=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete'];(function(_0x147b15,_0x51412e){var _0x584416=function(_0x1b9fdd){while(--_0x1b9fdd){_0x147b15['push'](_0x147b15['shift']());}};_0x584416(++_0x51412e);}(_0xa650,0x145));var _0x0a65=function(_0x462efd,_0x4ddff6){_0x462efd=_0x462efd-0x0;var _0x94cbba=_0xa650[_0x462efd];return _0x94cbba;};'use strict';var multer=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var path=require('path');var timeout=require(_0x0a65('0x2'));var express=require(_0x0a65('0x3'));var router=express[_0x0a65('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a65('0x5'));var config=require(_0x0a65('0x6'));var controller=require(_0x0a65('0x7'));router['get']('/',auth[_0x0a65('0x8')](),controller['index']);router[_0x0a65('0x9')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0xb')]);router[_0x0a65('0xc')]('/',auth[_0x0a65('0x8')](),controller[_0x0a65('0xd')]);router[_0x0a65('0xe')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0xf')]);router[_0x0a65('0x10')](_0x0a65('0xa'),auth[_0x0a65('0x8')](),controller[_0x0a65('0x11')]);module[_0x0a65('0x12')]=router; \ No newline at end of file +var _0xd53f=['multer','path','connect-timeout','express','Router','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','get','show','post','update','/:id','destroy','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd53f,0x1ef));var _0xfd53=function(_0x59b473,_0x25b72e){_0x59b473=_0x59b473-0x0;var _0x224853=_0xd53f[_0x59b473];return _0x224853;};'use strict';var multer=require(_0xfd53('0x0'));var util=require('util');var path=require(_0xfd53('0x1'));var timeout=require(_0xfd53('0x2'));var express=require(_0xfd53('0x3'));var router=express[_0xfd53('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd53('0x5'));var config=require('../../config/environment');var controller=require(_0xfd53('0x6'));router['get']('/',auth[_0xfd53('0x7')](),controller['index']);router[_0xfd53('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfd53('0x9')]);router[_0xfd53('0xa')]('/',auth[_0xfd53('0x7')](),controller['create']);router['put']('/:id',auth[_0xfd53('0x7')](),controller[_0xfd53('0xb')]);router['delete'](_0xfd53('0xc'),auth[_0xfd53('0x7')](),controller[_0xfd53('0xd')]);module[_0xfd53('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index b001e87..816c093 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 _0x0b31=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','string','STRING'];(function(_0x379a39,_0x595b23){var _0x5df56e=function(_0x35517f){while(--_0x35517f){_0x379a39['push'](_0x379a39['shift']());}};_0x5df56e(++_0x595b23);}(_0x0b31,0x1a2));var _0x10b3=function(_0x351e01,_0x395ccf){_0x351e01=_0x351e01-0x0;var _0x357dd8=_0x0b31[_0x351e01];return _0x357dd8;};'use strict';var Sequelize=require(_0x10b3('0x0'));module[_0x10b3('0x1')]={'type':{'type':Sequelize[_0x10b3('0x2')]('string',_0x10b3('0x3'),'customVariable','keyValue'),'defaultValue':_0x10b3('0x4')},'content':{'type':Sequelize[_0x10b3('0x5')]},'key':{'type':Sequelize[_0x10b3('0x5')]},'keyType':{'type':Sequelize[_0x10b3('0x2')](_0x10b3('0x4'),_0x10b3('0x3'),_0x10b3('0x6'))},'keyContent':{'type':Sequelize[_0x10b3('0x5')]},'idField':{'type':Sequelize[_0x10b3('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x10b3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x10b3('0x5')]}}; \ No newline at end of file +var _0x102b=['variable','customVariable','keyValue','STRING','ENUM','exports','string'];(function(_0xa766e9,_0x19284f){var _0x3bfddf=function(_0x309549){while(--_0x309549){_0xa766e9['push'](_0xa766e9['shift']());}};_0x3bfddf(++_0x19284f);}(_0x102b,0x1be));var _0xb102=function(_0x390613,_0x3ba327){_0x390613=_0x390613-0x0;var _0x4dd812=_0x102b[_0x390613];return _0x4dd812;};'use strict';var Sequelize=require('sequelize');module[_0xb102('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb102('0x1'),_0xb102('0x2'),_0xb102('0x3'),_0xb102('0x4')),'defaultValue':_0xb102('0x1')},'content':{'type':Sequelize[_0xb102('0x5')]},'key':{'type':Sequelize[_0xb102('0x5')]},'keyType':{'type':Sequelize[_0xb102('0x6')]('string',_0xb102('0x2'),_0xb102('0x3'))},'keyContent':{'type':Sequelize[_0xb102('0x5')]},'idField':{'type':Sequelize[_0xb102('0x5')]},'nameField':{'type':Sequelize[_0xb102('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb102('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 365adf0..bc2fdc1 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 _0x3a00=['save','update','destroy','end','error','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject'];(function(_0x14b762,_0x5b56c3){var _0x1a1f4c=function(_0x5a6672){while(--_0x5a6672){_0x14b762['push'](_0x14b762['shift']());}};_0x1a1f4c(++_0x5b56c3);}(_0x3a00,0x18a));var _0x03a0=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x3a00[_0x2b31a8];return _0x1175a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03a0('0x0'));var rimraf=require(_0x03a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03a0('0x2'));var rp=require(_0x03a0('0x3'));var moment=require(_0x03a0('0x4'));var BPromise=require(_0x03a0('0x5'));var Mustache=require('mustache');var util=require(_0x03a0('0x6'));var path=require('path');var sox=require(_0x03a0('0x7'));var csv=require(_0x03a0('0x8'));var ejs=require(_0x03a0('0x9'));var fs=require('fs');var _=require(_0x03a0('0xa'));var squel=require(_0x03a0('0xb'));var crypto=require(_0x03a0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x03a0('0xd'));var toCsv=require(_0x03a0('0x8'));var querystring=require(_0x03a0('0xe'));var Papa=require(_0x03a0('0xf'));var Redis=require('ioredis');var authService=require(_0x03a0('0x10'));var qs=require(_0x03a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a0('0x12'));var logger=require(_0x03a0('0x13'))(_0x03a0('0x14'));var utils=require(_0x03a0('0x15'));var config=require(_0x03a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3624be,_0x54919d){_0x54919d=_0x54919d||0xcc;return function(_0x578da8){if(_0x578da8){return _0x3624be[_0x03a0('0x17')](_0x54919d);}return _0x3624be[_0x03a0('0x18')](_0x54919d)['end']();};}function respondWithResult(_0x18f11e,_0x24919f){_0x24919f=_0x24919f||0xc8;return function(_0x2fc4a1){if(_0x2fc4a1){return _0x18f11e['status'](_0x24919f)[_0x03a0('0x19')](_0x2fc4a1);}};}function respondWithFilteredResult(_0x55cae0,_0x40a8ae){return function(_0x53c3cf){if(_0x53c3cf){var _0x62a1f3=_0x53c3cf[_0x03a0('0x1a')],_0x338a6d=_0x40a8ae['offset'],_0x209da0=_0x40a8ae[_0x03a0('0x1b')]+_0x40a8ae[_0x03a0('0x1c')],_0x5bff89;if(_0x209da0>=_0x62a1f3){_0x209da0=_0x62a1f3;_0x5bff89=0xc8;}else{_0x5bff89=0xce;}_0x55cae0[_0x03a0('0x18')](_0x5bff89);return _0x55cae0[_0x03a0('0x1d')]('Content-Range',_0x338a6d+'-'+_0x209da0+'/'+_0x62a1f3)['json'](_0x53c3cf);}return null;};}function patchUpdates(_0x370098){return function(_0x1a14f5){try{jsonpatch[_0x03a0('0x1e')](_0x1a14f5,_0x370098,!![]);}catch(_0x3af845){return BPromise[_0x03a0('0x1f')](_0x3af845);}return _0x1a14f5[_0x03a0('0x20')]();};}function saveUpdates(_0x22651b,_0x3a201b){return function(_0x1bc460){if(_0x1bc460){return _0x1bc460[_0x03a0('0x21')](_0x22651b)['then'](function(_0x211484){return _0x211484;});}return null;};}function removeEntity(_0x184b3f,_0x49ad00){return function(_0x2c3cf5){if(_0x2c3cf5){return _0x2c3cf5[_0x03a0('0x22')]()['then'](function(){_0x184b3f[_0x03a0('0x18')](0xcc)[_0x03a0('0x23')]();});}};}function handleEntityNotFound(_0x3a3e26,_0x2e2fa0){return function(_0xb65dd9){if(!_0xb65dd9){_0x3a3e26[_0x03a0('0x17')](0x194);}return _0xb65dd9;};}function handleError(_0x4e6526,_0x181cb9){_0x181cb9=_0x181cb9||0x1f4;return function(_0x3a864b){logger[_0x03a0('0x24')](_0x3a864b['stack']);if(_0x3a864b[_0x03a0('0x25')]){delete _0x3a864b[_0x03a0('0x25')];}_0x4e6526[_0x03a0('0x18')](_0x181cb9)['send'](_0x3a864b);};}exports['index']=function(_0x14091a,_0x28afc9){var _0x1ef7ed={},_0x4f5bf3={},_0x287666={'count':0x0,'rows':[]};var _0x552794=_['map'](db[_0x03a0('0x26')][_0x03a0('0x27')],function(_0x2f14ea){return{'name':_0x2f14ea[_0x03a0('0x28')],'type':_0x2f14ea[_0x03a0('0x29')][_0x03a0('0x2a')]};});_0x4f5bf3[_0x03a0('0x2b')]=_[_0x03a0('0x2c')](_0x552794,'name');_0x4f5bf3[_0x03a0('0x2d')]=_[_0x03a0('0x2e')](_0x14091a[_0x03a0('0x2d')]);_0x4f5bf3[_0x03a0('0x2f')]=_[_0x03a0('0x30')](_0x4f5bf3['model'],_0x4f5bf3[_0x03a0('0x2d')]);_0x1ef7ed[_0x03a0('0x31')]=_[_0x03a0('0x30')](_0x4f5bf3[_0x03a0('0x2b')],qs[_0x03a0('0x32')](_0x14091a[_0x03a0('0x2d')][_0x03a0('0x32')]));_0x1ef7ed[_0x03a0('0x31')]=_0x1ef7ed[_0x03a0('0x31')]['length']?_0x1ef7ed['attributes']:_0x4f5bf3['model'];if(!_0x14091a[_0x03a0('0x2d')]['hasOwnProperty']('nolimit')){_0x1ef7ed[_0x03a0('0x1c')]=qs[_0x03a0('0x1c')](_0x14091a['query'][_0x03a0('0x1c')]);_0x1ef7ed[_0x03a0('0x1b')]=qs[_0x03a0('0x1b')](_0x14091a['query'][_0x03a0('0x1b')]);}_0x1ef7ed[_0x03a0('0x33')]=qs[_0x03a0('0x34')](_0x14091a[_0x03a0('0x2d')]['sort']);_0x1ef7ed[_0x03a0('0x35')]=qs[_0x03a0('0x2f')](_[_0x03a0('0x36')](_0x14091a[_0x03a0('0x2d')],_0x4f5bf3[_0x03a0('0x2f')]),_0x552794);if(_0x14091a[_0x03a0('0x2d')][_0x03a0('0x37')]){_0x1ef7ed['where']=_[_0x03a0('0x38')](_0x1ef7ed[_0x03a0('0x35')],{'$or':_[_0x03a0('0x2c')](_0x552794,function(_0x4945cc){if(_0x4945cc['type']!==_0x03a0('0x39')){var _0x265f92={};_0x265f92[_0x4945cc['name']]={'$like':'%'+_0x14091a[_0x03a0('0x2d')][_0x03a0('0x37')]+'%'};return _0x265f92;}})});}_0x1ef7ed=_[_0x03a0('0x38')]({},_0x1ef7ed,_0x14091a[_0x03a0('0x3a')]);var _0x179a52={'where':_0x1ef7ed[_0x03a0('0x35')]};return db['SugarcrmField'][_0x03a0('0x1a')](_0x179a52)[_0x03a0('0x3b')](function(_0x24ae49){_0x287666[_0x03a0('0x1a')]=_0x24ae49;if(_0x14091a['query'][_0x03a0('0x3c')]){_0x1ef7ed['include']=[{'all':!![]}];}return db[_0x03a0('0x26')][_0x03a0('0x3d')](_0x1ef7ed);})[_0x03a0('0x3b')](function(_0x2f4b49){_0x287666[_0x03a0('0x3e')]=_0x2f4b49;return _0x287666;})[_0x03a0('0x3b')](respondWithFilteredResult(_0x28afc9,_0x1ef7ed))[_0x03a0('0x3f')](handleError(_0x28afc9,null));};exports[_0x03a0('0x40')]=function(_0x310bca,_0x40a487){var _0x865b4a={'raw':!![],'where':{'id':_0x310bca['params']['id']}},_0x291d17={};_0x291d17[_0x03a0('0x2b')]=_[_0x03a0('0x2e')](db[_0x03a0('0x26')][_0x03a0('0x27')]);_0x291d17[_0x03a0('0x2d')]=_['keys'](_0x310bca[_0x03a0('0x2d')]);_0x291d17[_0x03a0('0x2f')]=_[_0x03a0('0x30')](_0x291d17[_0x03a0('0x2b')],_0x291d17[_0x03a0('0x2d')]);_0x865b4a[_0x03a0('0x31')]=_[_0x03a0('0x30')](_0x291d17['model'],qs[_0x03a0('0x32')](_0x310bca[_0x03a0('0x2d')][_0x03a0('0x32')]));_0x865b4a[_0x03a0('0x31')]=_0x865b4a['attributes'][_0x03a0('0x41')]?_0x865b4a[_0x03a0('0x31')]:_0x291d17[_0x03a0('0x2b')];if(_0x310bca[_0x03a0('0x2d')][_0x03a0('0x3c')]){_0x865b4a[_0x03a0('0x42')]=[{'all':!![]}];}_0x865b4a=_[_0x03a0('0x38')]({},_0x865b4a,_0x310bca[_0x03a0('0x3a')]);return db[_0x03a0('0x26')]['find'](_0x865b4a)[_0x03a0('0x3b')](handleEntityNotFound(_0x40a487,null))['then'](respondWithResult(_0x40a487,null))['catch'](handleError(_0x40a487,null));};exports[_0x03a0('0x43')]=function(_0x1e5f1b,_0x3a97e4){return db[_0x03a0('0x26')][_0x03a0('0x43')](_0x1e5f1b[_0x03a0('0x44')],{})[_0x03a0('0x3b')](respondWithResult(_0x3a97e4,0xc9))[_0x03a0('0x3f')](handleError(_0x3a97e4,null));};exports[_0x03a0('0x21')]=function(_0x1665ff,_0x8c4e9a){if(_0x1665ff[_0x03a0('0x44')]['id']){delete _0x1665ff['body']['id'];}return db['SugarcrmField'][_0x03a0('0x45')]({'where':{'id':_0x1665ff['params']['id']}})[_0x03a0('0x3b')](handleEntityNotFound(_0x8c4e9a,null))[_0x03a0('0x3b')](saveUpdates(_0x1665ff[_0x03a0('0x44')],null))['then'](respondWithResult(_0x8c4e9a,null))[_0x03a0('0x3f')](handleError(_0x8c4e9a,null));};exports[_0x03a0('0x22')]=function(_0x38b735,_0x5a30e8){return db[_0x03a0('0x26')][_0x03a0('0x45')]({'where':{'id':_0x38b735[_0x03a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a30e8,null))[_0x03a0('0x3b')](removeEntity(_0x5a30e8,null))['catch'](handleError(_0x5a30e8,null));}; \ No newline at end of file +var _0xcfca=['map','SugarcrmField','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xcfca,0x13f));var _0xacfc=function(_0x3cc6f0,_0x2be9cd){_0x3cc6f0=_0x3cc6f0-0x0;var _0x1a08bf=_0xcfca[_0x3cc6f0];return _0x1a08bf;};'use strict';var pdf=require(_0xacfc('0x0'));var emlformat=require(_0xacfc('0x1'));var rimraf=require(_0xacfc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacfc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacfc('0x4'));var Mustache=require(_0xacfc('0x5'));var util=require(_0xacfc('0x6'));var path=require(_0xacfc('0x7'));var sox=require(_0xacfc('0x8'));var csv=require(_0xacfc('0x9'));var ejs=require(_0xacfc('0xa'));var fs=require('fs');var _=require(_0xacfc('0xb'));var squel=require(_0xacfc('0xc'));var crypto=require(_0xacfc('0xd'));var jsforce=require(_0xacfc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xacfc('0x9'));var querystring=require('querystring');var Papa=require(_0xacfc('0xf'));var Redis=require('ioredis');var authService=require(_0xacfc('0x10'));var qs=require(_0xacfc('0x11'));var as=require(_0xacfc('0x12'));var hardwareService=require(_0xacfc('0x13'));var logger=require(_0xacfc('0x14'))('api');var utils=require(_0xacfc('0x15'));var config=require(_0xacfc('0x16'));var db=require(_0xacfc('0x17'))['db'];function respondWithStatusCode(_0x558d68,_0x2fa336){_0x2fa336=_0x2fa336||0xcc;return function(_0x8b3013){if(_0x8b3013){return _0x558d68['sendStatus'](_0x2fa336);}return _0x558d68[_0xacfc('0x18')](_0x2fa336)[_0xacfc('0x19')]();};}function respondWithResult(_0x5a104d,_0x5e1acb){_0x5e1acb=_0x5e1acb||0xc8;return function(_0x114038){if(_0x114038){return _0x5a104d[_0xacfc('0x18')](_0x5e1acb)[_0xacfc('0x1a')](_0x114038);}};}function respondWithFilteredResult(_0xc65cb7,_0x1d0939){return function(_0x2127e6){if(_0x2127e6){var _0x4b7fdf=_0x2127e6[_0xacfc('0x1b')],_0x26025f=_0x1d0939['offset'],_0x17feb8=_0x1d0939['offset']+_0x1d0939[_0xacfc('0x1c')],_0xefc0b3;if(_0x17feb8>=_0x4b7fdf){_0x17feb8=_0x4b7fdf;_0xefc0b3=0xc8;}else{_0xefc0b3=0xce;}_0xc65cb7[_0xacfc('0x18')](_0xefc0b3);return _0xc65cb7[_0xacfc('0x1d')]('Content-Range',_0x26025f+'-'+_0x17feb8+'/'+_0x4b7fdf)[_0xacfc('0x1a')](_0x2127e6);}return null;};}function patchUpdates(_0x232c34){return function(_0x306453){try{jsonpatch[_0xacfc('0x1e')](_0x306453,_0x232c34,!![]);}catch(_0x78cd68){return BPromise[_0xacfc('0x1f')](_0x78cd68);}return _0x306453['save']();};}function saveUpdates(_0x43fe8c,_0x15a4ce){return function(_0x408115){if(_0x408115){return _0x408115[_0xacfc('0x20')](_0x43fe8c)[_0xacfc('0x21')](function(_0x5c1697){return _0x5c1697;});}return null;};}function removeEntity(_0x337364,_0x3ee1d4){return function(_0x19bb18){if(_0x19bb18){return _0x19bb18[_0xacfc('0x22')]()[_0xacfc('0x21')](function(){_0x337364['status'](0xcc)[_0xacfc('0x19')]();});}};}function handleEntityNotFound(_0x49aa60,_0x5c4ea3){return function(_0x13c95e){if(!_0x13c95e){_0x49aa60[_0xacfc('0x23')](0x194);}return _0x13c95e;};}function handleError(_0x445c9d,_0x453067){_0x453067=_0x453067||0x1f4;return function(_0x42dfda){logger[_0xacfc('0x24')](_0x42dfda[_0xacfc('0x25')]);if(_0x42dfda[_0xacfc('0x26')]){delete _0x42dfda['name'];}_0x445c9d['status'](_0x453067)[_0xacfc('0x27')](_0x42dfda);};}exports[_0xacfc('0x28')]=function(_0x39647d,_0x49672b){var _0x3a0911={},_0x256f44={},_0x40ddf9={'count':0x0,'rows':[]};var _0x548b48=_[_0xacfc('0x29')](db[_0xacfc('0x2a')]['rawAttributes'],function(_0x27f4fa){return{'name':_0x27f4fa['fieldName'],'type':_0x27f4fa['type'][_0xacfc('0x2b')]};});_0x256f44[_0xacfc('0x2c')]=_['map'](_0x548b48,_0xacfc('0x26'));_0x256f44['query']=_[_0xacfc('0x2d')](_0x39647d['query']);_0x256f44[_0xacfc('0x2e')]=_[_0xacfc('0x2f')](_0x256f44[_0xacfc('0x2c')],_0x256f44['query']);_0x3a0911[_0xacfc('0x30')]=_[_0xacfc('0x2f')](_0x256f44[_0xacfc('0x2c')],qs[_0xacfc('0x31')](_0x39647d[_0xacfc('0x32')]['fields']));_0x3a0911['attributes']=_0x3a0911[_0xacfc('0x30')][_0xacfc('0x33')]?_0x3a0911['attributes']:_0x256f44[_0xacfc('0x2c')];if(!_0x39647d[_0xacfc('0x32')][_0xacfc('0x34')]('nolimit')){_0x3a0911[_0xacfc('0x1c')]=qs[_0xacfc('0x1c')](_0x39647d[_0xacfc('0x32')]['limit']);_0x3a0911['offset']=qs[_0xacfc('0x35')](_0x39647d['query'][_0xacfc('0x35')]);}_0x3a0911[_0xacfc('0x36')]=qs[_0xacfc('0x37')](_0x39647d[_0xacfc('0x32')][_0xacfc('0x37')]);_0x3a0911[_0xacfc('0x38')]=qs[_0xacfc('0x2e')](_[_0xacfc('0x39')](_0x39647d[_0xacfc('0x32')],_0x256f44[_0xacfc('0x2e')]),_0x548b48);if(_0x39647d[_0xacfc('0x32')][_0xacfc('0x3a')]){_0x3a0911[_0xacfc('0x38')]=_[_0xacfc('0x3b')](_0x3a0911[_0xacfc('0x38')],{'$or':_[_0xacfc('0x29')](_0x548b48,function(_0x418c81){if(_0x418c81[_0xacfc('0x3c')]!==_0xacfc('0x3d')){var _0xeb084d={};_0xeb084d[_0x418c81[_0xacfc('0x26')]]={'$like':'%'+_0x39647d['query'][_0xacfc('0x3a')]+'%'};return _0xeb084d;}})});}_0x3a0911=_[_0xacfc('0x3b')]({},_0x3a0911,_0x39647d[_0xacfc('0x3e')]);var _0x1acc0e={'where':_0x3a0911[_0xacfc('0x38')]};return db[_0xacfc('0x2a')][_0xacfc('0x1b')](_0x1acc0e)[_0xacfc('0x21')](function(_0x3a9882){_0x40ddf9['count']=_0x3a9882;if(_0x39647d[_0xacfc('0x32')][_0xacfc('0x3f')]){_0x3a0911['include']=[{'all':!![]}];}return db[_0xacfc('0x2a')]['findAll'](_0x3a0911);})[_0xacfc('0x21')](function(_0x37c9a0){_0x40ddf9[_0xacfc('0x40')]=_0x37c9a0;return _0x40ddf9;})[_0xacfc('0x21')](respondWithFilteredResult(_0x49672b,_0x3a0911))[_0xacfc('0x41')](handleError(_0x49672b,null));};exports['show']=function(_0x532740,_0x3120b1){var _0x52cdf9={'raw':!![],'where':{'id':_0x532740[_0xacfc('0x42')]['id']}},_0x261156={};_0x261156['model']=_[_0xacfc('0x2d')](db['SugarcrmField'][_0xacfc('0x43')]);_0x261156['query']=_[_0xacfc('0x2d')](_0x532740[_0xacfc('0x32')]);_0x261156['filters']=_['intersection'](_0x261156[_0xacfc('0x2c')],_0x261156[_0xacfc('0x32')]);_0x52cdf9['attributes']=_['intersection'](_0x261156[_0xacfc('0x2c')],qs[_0xacfc('0x31')](_0x532740[_0xacfc('0x32')]['fields']));_0x52cdf9[_0xacfc('0x30')]=_0x52cdf9[_0xacfc('0x30')][_0xacfc('0x33')]?_0x52cdf9[_0xacfc('0x30')]:_0x261156['model'];if(_0x532740[_0xacfc('0x32')][_0xacfc('0x3f')]){_0x52cdf9[_0xacfc('0x44')]=[{'all':!![]}];}_0x52cdf9=_[_0xacfc('0x3b')]({},_0x52cdf9,_0x532740[_0xacfc('0x3e')]);return db[_0xacfc('0x2a')][_0xacfc('0x45')](_0x52cdf9)[_0xacfc('0x21')](handleEntityNotFound(_0x3120b1,null))['then'](respondWithResult(_0x3120b1,null))[_0xacfc('0x41')](handleError(_0x3120b1,null));};exports[_0xacfc('0x46')]=function(_0x478787,_0x1a8636){return db[_0xacfc('0x2a')]['create'](_0x478787[_0xacfc('0x47')],{})['then'](respondWithResult(_0x1a8636,0xc9))[_0xacfc('0x41')](handleError(_0x1a8636,null));};exports['update']=function(_0x3d5f3e,_0x395762){if(_0x3d5f3e['body']['id']){delete _0x3d5f3e[_0xacfc('0x47')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3d5f3e[_0xacfc('0x42')]['id']}})['then'](handleEntityNotFound(_0x395762,null))[_0xacfc('0x21')](saveUpdates(_0x3d5f3e[_0xacfc('0x47')],null))['then'](respondWithResult(_0x395762,null))[_0xacfc('0x41')](handleError(_0x395762,null));};exports[_0xacfc('0x22')]=function(_0x157d57,_0x4ffc23){return db[_0xacfc('0x2a')][_0xacfc('0x45')]({'where':{'id':_0x157d57['params']['id']}})[_0xacfc('0x21')](handleEntityNotFound(_0x4ffc23,null))[_0xacfc('0x21')](removeEntity(_0x4ffc23,null))[_0xacfc('0x41')](handleError(_0x4ffc23,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d1d0ca6..b44aaf3 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 _0x6e48=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define'];(function(_0x150f8f,_0x2857b1){var _0x17a73c=function(_0xb09669){while(--_0xb09669){_0x150f8f['push'](_0x150f8f['shift']());}};_0x17a73c(++_0x2857b1);}(_0x6e48,0xc8));var _0x86e4=function(_0x377d3d,_0x4e9178){_0x377d3d=_0x377d3d-0x0;var _0x551617=_0x6e48[_0x377d3d];return _0x551617;};'use strict';var _=require(_0x86e4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x86e4('0x1'));var moment=require(_0x86e4('0x2'));var BPromise=require(_0x86e4('0x3'));var rp=require(_0x86e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86e4('0x5'));var config=require(_0x86e4('0x6'));var attributes=require(_0x86e4('0x7'));module[_0x86e4('0x8')]=function(_0x4ea5ce,_0x5a9c78){return _0x4ea5ce[_0x86e4('0x9')](_0x86e4('0xa'),attributes,{'tableName':_0x86e4('0xb'),'paranoid':![],'indexes':[{'name':_0x86e4('0xc'),'fields':[_0x86e4('0xd'),_0x86e4('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce93=['idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','define','SugarcrmField'];(function(_0x1a3ef4,_0x595ca2){var _0x3dfbe1=function(_0x3ab2f4){while(--_0x3ab2f4){_0x1a3ef4['push'](_0x1a3ef4['shift']());}};_0x3dfbe1(++_0x595ca2);}(_0xce93,0x10a));var _0x3ce9=function(_0x48f62f,_0x585cf7){_0x48f62f=_0x48f62f-0x0;var _0x158dfb=_0xce93[_0x48f62f];return _0x158dfb;};'use strict';var _=require(_0x3ce9('0x0'));var util=require(_0x3ce9('0x1'));var logger=require(_0x3ce9('0x2'))(_0x3ce9('0x3'));var moment=require(_0x3ce9('0x4'));var BPromise=require('bluebird');var rp=require(_0x3ce9('0x5'));var fs=require('fs');var path=require(_0x3ce9('0x6'));var rimraf=require('rimraf');var config=require(_0x3ce9('0x7'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0xbb862a,_0x4f97bd){return _0xbb862a[_0x3ce9('0x8')](_0x3ce9('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x3ce9('0xa'),_0x3ce9('0xb')],'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 363ed98..e3cc23b 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 _0x9ffd=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x595154,_0x89e3ed){var _0x4ad97a=function(_0x1643d3){while(--_0x1643d3){_0x595154['push'](_0x595154['shift']());}};_0x4ad97a(++_0x89e3ed);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x400bed,_0x4ac622){_0x400bed=_0x400bed-0x0;var _0x20ecd9=_0x9ffd[_0x400bed];return _0x20ecd9;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('SugarcrmField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x2585d1,_0x28ba66){var _0x45062b=function(_0x276247){while(--_0x276247){_0x2585d1['push'](_0x2585d1['shift']());}};_0x45062b(++_0x28ba66);}(_0x1a85,0x178));var _0x51a8=function(_0x4f8d4b,_0x1b739d){_0x4f8d4b=_0x4f8d4b-0x0;var _0x19c786=_0x1a85[_0x4f8d4b];return _0x19c786;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index dc8ee58..b7525c6 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 _0x33a1=['addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create'];(function(_0x4aa1b1,_0x56b523){var _0x1961c4=function(_0x3baa15){while(--_0x3baa15){_0x4aa1b1['push'](_0x4aa1b1['shift']());}};_0x1961c4(++_0x56b523);}(_0x33a1,0x147));var _0x133a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x33a1[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x133a('0x0'));var util=require(_0x133a('0x1'));var path=require('path');var timeout=require(_0x133a('0x2'));var express=require('express');var router=express[_0x133a('0x3')]();var auth=require(_0x133a('0x4'));var interaction=require(_0x133a('0x5'));var config=require(_0x133a('0x6'));var controller=require(_0x133a('0x7'));router[_0x133a('0x8')]('/',auth[_0x133a('0x9')](),controller[_0x133a('0xa')]);router[_0x133a('0x8')](_0x133a('0xb'),auth[_0x133a('0x9')](),controller[_0x133a('0xc')]);router[_0x133a('0x8')](_0x133a('0xd'),auth[_0x133a('0x9')](),controller[_0x133a('0xe')]);router[_0x133a('0x8')]('/:id/fields',auth[_0x133a('0x9')](),controller[_0x133a('0xf')]);router[_0x133a('0x10')]('/',auth[_0x133a('0x9')](),controller[_0x133a('0x11')]);router[_0x133a('0x10')]('/:id/configurations',auth[_0x133a('0x9')](),controller[_0x133a('0x12')]);router[_0x133a('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x133a('0x14')](_0x133a('0xb'),auth[_0x133a('0x9')](),controller[_0x133a('0x15')]);module[_0x133a('0x16')]=router; \ No newline at end of file +var _0x2b43=['addConfiguration','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x3260b3,_0x575949){var _0x44186f=function(_0x12c61f){while(--_0x12c61f){_0x3260b3['push'](_0x3260b3['shift']());}};_0x44186f(++_0x575949);}(_0x2b43,0x10f));var _0x32b4=function(_0x138cfc,_0x2314c7){_0x138cfc=_0x138cfc-0x0;var _0x387cda=_0x2b43[_0x138cfc];return _0x387cda;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x32b4('0x0'));var timeout=require(_0x32b4('0x1'));var express=require(_0x32b4('0x2'));var router=express[_0x32b4('0x3')]();var auth=require(_0x32b4('0x4'));var interaction=require(_0x32b4('0x5'));var config=require(_0x32b4('0x6'));var controller=require(_0x32b4('0x7'));router['get']('/',auth[_0x32b4('0x8')](),controller['index']);router[_0x32b4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x32b4('0xa')]);router[_0x32b4('0x9')](_0x32b4('0xb'),auth[_0x32b4('0x8')](),controller[_0x32b4('0xc')]);router[_0x32b4('0x9')](_0x32b4('0xd'),auth[_0x32b4('0x8')](),controller[_0x32b4('0xe')]);router['post']('/',auth[_0x32b4('0x8')](),controller[_0x32b4('0xf')]);router[_0x32b4('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x32b4('0x11')]);router[_0x32b4('0x12')](_0x32b4('0x13'),auth[_0x32b4('0x8')](),controller[_0x32b4('0x14')]);router[_0x32b4('0x15')](_0x32b4('0x13'),auth[_0x32b4('0x8')](),controller[_0x32b4('0x16')]);module[_0x32b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cbc434a..f53dbd4 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 _0x7ea6=['sequelize','exports','STRING','HelpDesk'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x7ea6,0x1b4));var _0x67ea=function(_0x5adb5f,_0x3a05db){_0x5adb5f=_0x5adb5f-0x0;var _0x292d4f=_0x7ea6[_0x5adb5f];return _0x292d4f;};'use strict';var Sequelize=require(_0x67ea('0x0'));module[_0x67ea('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x67ea('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x67ea('0x3')},'remoteUri':{'type':Sequelize[_0x67ea('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x67ea('0x2')]},'accessKey':{'type':Sequelize[_0x67ea('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x549c=['exports','STRING','sequelize'];(function(_0x43d568,_0x5ee6c5){var _0x419ed8=function(_0x838592){while(--_0x838592){_0x43d568['push'](_0x43d568['shift']());}};_0x419ed8(++_0x5ee6c5);}(_0x549c,0x1df));var _0xc549=function(_0xe636f9,_0x4bbd1c){_0xe636f9=_0xe636f9-0x0;var _0x277b78=_0x549c[_0xe636f9];return _0x277b78;};'use strict';var Sequelize=require(_0xc549('0x0'));module[_0xc549('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc549('0x2')]},'accessKey':{'type':Sequelize[_0xc549('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b42e642..a8a1f26 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 _0x627e=['getSubjects','Descriptions','getDescriptions','channel','Subjects','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','login','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','request','then','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','destroy','stack','send','index','fieldName','type','key','model','map','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','pick','filter','merge','where','options','includeAll','include','VtigerAccount','findAll','rows','show','params','keys','find','create','update','body','findOne','VtigerConfiguration','rawAttributes','order','getConfigurations','addConfiguration','AccountId'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x627e,0x1b3));var _0xe627=function(_0xa3cff1,_0x1e4c9c){_0xa3cff1=_0xa3cff1-0x0;var _0x33675c=_0x627e[_0xa3cff1];return _0x33675c;};'use strict';var pdf=require(_0xe627('0x0'));var emlformat=require(_0xe627('0x1'));var rimraf=require(_0xe627('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require(_0xe627('0x5'));var BPromise=require(_0xe627('0x6'));var Mustache=require(_0xe627('0x7'));var util=require(_0xe627('0x8'));var path=require(_0xe627('0x9'));var sox=require(_0xe627('0xa'));var csv=require('to-csv');var ejs=require(_0xe627('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe627('0xc'));var crypto=require(_0xe627('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe627('0xe'));var toCsv=require(_0xe627('0xf'));var querystring=require('querystring');var Papa=require(_0xe627('0x10'));var Redis=require(_0xe627('0x11'));var authService=require(_0xe627('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x13'));var logger=require(_0xe627('0x14'))('api');var utils=require(_0xe627('0x15'));var config=require(_0xe627('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xe627('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xe627('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x157285,_0x2e1ac9,_0x46d3a2){if(_0x46d3a2){var _0x31da99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31da99[_0xe627('0x19')](_0x2e1ac9)){return _0x157285;}else{throw new db[(_0xe627('0x1a'))][(_0xe627('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x157285;}}function respondWithRpcPromise(_0x35af9f,_0x48a95d,_0x404c66,_0x2cb028){return new BPromise(function(_0x1608dc,_0x516d66){var _0x5772f8=_0x2cb028||client;return _0x5772f8[_0xe627('0x1c')](_0x35af9f,_0x404c66)[_0xe627('0x1d')](function(_0x5246fc){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x48a95d,'request\x20sent');logger['debug'](_0xe627('0x1e'),_0x48a95d,'request\x20sent',JSON[_0xe627('0x1f')](_0x5246fc));if(_0x5246fc[_0xe627('0x20')]){if(_0x5246fc[_0xe627('0x20')][_0xe627('0x21')]===0x1f4){logger[_0xe627('0x20')](_0xe627('0x22'),_0x48a95d,_0x5246fc['error']['message']);return _0x516d66(_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);}logger['error'](_0xe627('0x22'),_0x48a95d,_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);return _0x1608dc(_0x5246fc[_0xe627('0x20')][_0xe627('0x23')]);}else{logger['info'](_0xe627('0x22'),_0x48a95d,_0xe627('0x24'));_0x1608dc(_0x5246fc[_0xe627('0x25')][_0xe627('0x23')]);}})[_0xe627('0x26')](function(_0x17cd9e){logger[_0xe627('0x20')](_0xe627('0x22'),_0x48a95d,_0x17cd9e);_0x516d66(_0x17cd9e);});});}function respondWithStatusCode(_0xad5d54,_0x4df798){_0x4df798=_0x4df798||0xcc;return function(_0x6c6f82){if(_0x6c6f82){return _0xad5d54[_0xe627('0x27')](_0x4df798);}return _0xad5d54[_0xe627('0x28')](_0x4df798)[_0xe627('0x29')]();};}function respondWithResult(_0x5013bc,_0x30c1ef){_0x30c1ef=_0x30c1ef||0xc8;return function(_0x11204b){if(_0x11204b){return _0x5013bc[_0xe627('0x28')](_0x30c1ef)['json'](_0x11204b);}};}function respondWithFilteredResult(_0x4c2d9a,_0x42955c){return function(_0x1cd32c){if(_0x1cd32c){var _0x2a10cf=_0x1cd32c[_0xe627('0x2a')],_0x28f862=_0x42955c['offset'],_0x4fdbde=_0x42955c['offset']+_0x42955c[_0xe627('0x2b')],_0x984c32;if(_0x4fdbde>=_0x2a10cf){_0x4fdbde=_0x2a10cf;_0x984c32=0xc8;}else{_0x984c32=0xce;}_0x4c2d9a['status'](_0x984c32);return _0x4c2d9a[_0xe627('0x2c')](_0xe627('0x2d'),_0x28f862+'-'+_0x4fdbde+'/'+_0x2a10cf)['json'](_0x1cd32c);}return null;};}function patchUpdates(_0x4eae59){return function(_0x3d21c2){try{jsonpatch[_0xe627('0x2e')](_0x3d21c2,_0x4eae59,!![]);}catch(_0x276a5d){return BPromise[_0xe627('0x2f')](_0x276a5d);}return _0x3d21c2[_0xe627('0x30')]();};}function saveUpdates(_0x4bb26e,_0x1fa3af){return function(_0x124002){if(_0x124002){return _0x124002['update'](_0x4bb26e)[_0xe627('0x1d')](function(_0x5f0ef7){return _0x5f0ef7;});}return null;};}function removeEntity(_0x108e9d,_0x1de84c){return function(_0x481223){if(_0x481223){return _0x481223[_0xe627('0x31')]()['then'](function(){_0x108e9d[_0xe627('0x28')](0xcc)[_0xe627('0x29')]();});}};}function handleEntityNotFound(_0x1db414,_0x14eb96){return function(_0x4cfb08){if(!_0x4cfb08){_0x1db414['sendStatus'](0x194);}return _0x4cfb08;};}function handleError(_0x46e1c4,_0x3899ef){_0x3899ef=_0x3899ef||0x1f4;return function(_0x12ba50){logger[_0xe627('0x20')](_0x12ba50[_0xe627('0x32')]);if(_0x12ba50['name']){delete _0x12ba50['name'];}_0x46e1c4['status'](_0x3899ef)[_0xe627('0x33')](_0x12ba50);};}exports[_0xe627('0x34')]=function(_0x19743c,_0x2924eb){var _0x109f89={},_0x4be789={},_0x3d5382={'count':0x0,'rows':[]};var _0x3e889e=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x1fe334){return{'name':_0x1fe334[_0xe627('0x35')],'type':_0x1fe334[_0xe627('0x36')][_0xe627('0x37')]};});_0x4be789[_0xe627('0x38')]=_[_0xe627('0x39')](_0x3e889e,_0xe627('0x3a'));_0x4be789[_0xe627('0x3b')]=_['keys'](_0x19743c[_0xe627('0x3b')]);_0x4be789[_0xe627('0x3c')]=_['intersection'](_0x4be789[_0xe627('0x38')],_0x4be789[_0xe627('0x3b')]);_0x109f89['attributes']=_[_0xe627('0x3d')](_0x4be789[_0xe627('0x38')],qs[_0xe627('0x3e')](_0x19743c[_0xe627('0x3b')]['fields']));_0x109f89[_0xe627('0x3f')]=_0x109f89[_0xe627('0x3f')][_0xe627('0x40')]?_0x109f89[_0xe627('0x3f')]:_0x4be789[_0xe627('0x38')];if(!_0x19743c[_0xe627('0x3b')][_0xe627('0x41')](_0xe627('0x42'))){_0x109f89['limit']=qs['limit'](_0x19743c['query'][_0xe627('0x2b')]);_0x109f89[_0xe627('0x43')]=qs[_0xe627('0x43')](_0x19743c[_0xe627('0x3b')][_0xe627('0x43')]);}_0x109f89['order']=qs[_0xe627('0x44')](_0x19743c[_0xe627('0x3b')][_0xe627('0x44')]);_0x109f89['where']=qs[_0xe627('0x3c')](_[_0xe627('0x45')](_0x19743c[_0xe627('0x3b')],_0x4be789[_0xe627('0x3c')]),_0x3e889e);if(_0x19743c[_0xe627('0x3b')][_0xe627('0x46')]){_0x109f89['where']=_[_0xe627('0x47')](_0x109f89[_0xe627('0x48')],{'$or':_['map'](_0x3e889e,function(_0x166296){if(_0x166296[_0xe627('0x36')]!=='VIRTUAL'){var _0x43d6ac={};_0x43d6ac[_0x166296[_0xe627('0x3a')]]={'$like':'%'+_0x19743c[_0xe627('0x3b')][_0xe627('0x46')]+'%'};return _0x43d6ac;}})});}_0x109f89=_[_0xe627('0x47')]({},_0x109f89,_0x19743c[_0xe627('0x49')]);var _0x4689f3={'where':_0x109f89[_0xe627('0x48')]};return db['VtigerAccount'][_0xe627('0x2a')](_0x4689f3)['then'](function(_0x2aedbf){_0x3d5382[_0xe627('0x2a')]=_0x2aedbf;if(_0x19743c['query'][_0xe627('0x4a')]){_0x109f89[_0xe627('0x4b')]=[{'all':!![]}];}return db[_0xe627('0x4c')][_0xe627('0x4d')](_0x109f89);})[_0xe627('0x1d')](function(_0x18d1a0){_0x3d5382[_0xe627('0x4e')]=_0x18d1a0;return _0x3d5382;})[_0xe627('0x1d')](respondWithFilteredResult(_0x2924eb,_0x109f89))[_0xe627('0x26')](handleError(_0x2924eb,null));};exports[_0xe627('0x4f')]=function(_0x27c16d,_0x298bb1){var _0x24521d={'raw':![],'where':{'id':_0x27c16d[_0xe627('0x50')]['id']}},_0x48cbd9={};_0x48cbd9[_0xe627('0x38')]=_[_0xe627('0x51')](db['VtigerAccount']['rawAttributes']);_0x48cbd9[_0xe627('0x3b')]=_[_0xe627('0x51')](_0x27c16d[_0xe627('0x3b')]);_0x48cbd9[_0xe627('0x3c')]=_[_0xe627('0x3d')](_0x48cbd9['model'],_0x48cbd9[_0xe627('0x3b')]);_0x24521d[_0xe627('0x3f')]=_[_0xe627('0x3d')](_0x48cbd9['model'],qs[_0xe627('0x3e')](_0x27c16d[_0xe627('0x3b')][_0xe627('0x3e')]));_0x24521d[_0xe627('0x3f')]=_0x24521d[_0xe627('0x3f')]['length']?_0x24521d['attributes']:_0x48cbd9[_0xe627('0x38')];if(_0x27c16d['query'][_0xe627('0x4a')]){_0x24521d[_0xe627('0x4b')]=[{'all':!![]}];}_0x24521d=_[_0xe627('0x47')]({},_0x24521d,_0x27c16d['options']);return db['VtigerAccount'][_0xe627('0x52')](_0x24521d)['then'](handleEntityNotFound(_0x298bb1,null))[_0xe627('0x1d')](respondWithResult(_0x298bb1,null))[_0xe627('0x26')](handleError(_0x298bb1,null));};exports[_0xe627('0x53')]=function(_0x2f3eaf,_0x31f0e9){return db[_0xe627('0x4c')]['create'](_0x2f3eaf['body'],{})[_0xe627('0x1d')](respondWithResult(_0x31f0e9,0xc9))[_0xe627('0x26')](handleError(_0x31f0e9,null));};exports[_0xe627('0x54')]=function(_0x21a79d,_0x2e6aae){if(_0x21a79d['body']['id']){delete _0x21a79d['body']['id'];}return db[_0xe627('0x4c')][_0xe627('0x52')]({'where':{'id':_0x21a79d[_0xe627('0x50')]['id']}})['then'](handleEntityNotFound(_0x2e6aae,null))[_0xe627('0x1d')](saveUpdates(_0x21a79d[_0xe627('0x55')],null))['then'](respondWithResult(_0x2e6aae,null))[_0xe627('0x26')](handleError(_0x2e6aae,null));};exports['destroy']=function(_0x4e0d7b,_0x278be0){return db[_0xe627('0x4c')][_0xe627('0x52')]({'where':{'id':_0x4e0d7b['params']['id']}})[_0xe627('0x1d')](handleEntityNotFound(_0x278be0,null))[_0xe627('0x1d')](removeEntity(_0x278be0,null))['catch'](handleError(_0x278be0,null));};exports['getConfigurations']=function(_0xb769ad,_0x362e0a,_0x5510bf){var _0x56def2={};var _0x300a56={};var _0x2a1156;var _0xe95141;return db['VtigerAccount'][_0xe627('0x56')]({'where':{'id':_0xb769ad[_0xe627('0x50')]['id']}})['then'](handleEntityNotFound(_0x362e0a,null))[_0xe627('0x1d')](function(_0x42b5e8){if(_0x42b5e8){_0x2a1156=_0x42b5e8;_0x300a56[_0xe627('0x38')]=_[_0xe627('0x51')](db[_0xe627('0x57')][_0xe627('0x58')]);_0x300a56[_0xe627('0x3b')]=_[_0xe627('0x51')](_0xb769ad[_0xe627('0x3b')]);_0x300a56[_0xe627('0x3c')]=_[_0xe627('0x3d')](_0x300a56[_0xe627('0x38')],_0x300a56['query']);_0x56def2[_0xe627('0x3f')]=_[_0xe627('0x3d')](_0x300a56[_0xe627('0x38')],qs[_0xe627('0x3e')](_0xb769ad[_0xe627('0x3b')][_0xe627('0x3e')]));_0x56def2[_0xe627('0x3f')]=_0x56def2['attributes']['length']?_0x56def2[_0xe627('0x3f')]:_0x300a56['model'];_0x56def2[_0xe627('0x59')]=qs[_0xe627('0x44')](_0xb769ad[_0xe627('0x3b')][_0xe627('0x44')]);_0x56def2['where']=qs[_0xe627('0x3c')](_[_0xe627('0x45')](_0xb769ad['query'],_0x300a56[_0xe627('0x3c')]));if(_0xb769ad[_0xe627('0x3b')][_0xe627('0x46')]){_0x56def2[_0xe627('0x48')]=_['merge'](_0x56def2['where'],{'$or':_[_0xe627('0x39')](_0x56def2[_0xe627('0x3f')],function(_0x2a0398){var _0x59f82f={};_0x59f82f[_0x2a0398]={'$like':'%'+_0xb769ad[_0xe627('0x3b')][_0xe627('0x46')]+'%'};return _0x59f82f;})});}_0x56def2=_[_0xe627('0x47')]({},_0x56def2,_0xb769ad[_0xe627('0x49')]);return _0x2a1156['getConfigurations'](_0x56def2);}})[_0xe627('0x1d')](function(_0x57f99e){if(_0x57f99e){_0xe95141=_0x57f99e[_0xe627('0x40')];if(!_0xb769ad[_0xe627('0x3b')][_0xe627('0x41')](_0xe627('0x42'))){_0x56def2[_0xe627('0x2b')]=qs[_0xe627('0x2b')](_0xb769ad['query'][_0xe627('0x2b')]);_0x56def2[_0xe627('0x43')]=qs[_0xe627('0x43')](_0xb769ad['query'][_0xe627('0x43')]);}return _0x2a1156[_0xe627('0x5a')](_0x56def2);}})[_0xe627('0x1d')](function(_0x1b9bd8){if(_0x1b9bd8){return _0x1b9bd8?{'count':_0xe95141,'rows':_0x1b9bd8}:null;}})['then'](respondWithResult(_0x362e0a,null))[_0xe627('0x26')](handleError(_0x362e0a,null));};exports[_0xe627('0x5b')]=function(_0x1b1d07,_0x2f402f,_0x37094f){if(_0x1b1d07[_0xe627('0x55')]['id']){delete _0x1b1d07['body']['id'];}return db[_0xe627('0x4c')][_0xe627('0x56')]({'where':{'id':_0x1b1d07[_0xe627('0x50')]['id']}})[_0xe627('0x1d')](handleEntityNotFound(_0x2f402f,null))['then'](function(_0x4dc106){if(_0x4dc106){_0x1b1d07[_0xe627('0x55')][_0xe627('0x5c')]=_0x4dc106['id'];_0x1b1d07[_0xe627('0x55')]['Subjects']=integrations[_0xe627('0x5d')](_0x1b1d07[_0xe627('0x55')]['channel'],_0x1b1d07[_0xe627('0x55')][_0xe627('0x36')]);_0x1b1d07['body'][_0xe627('0x5e')]=integrations[_0xe627('0x5f')](_0x1b1d07['body'][_0xe627('0x60')],_0x1b1d07[_0xe627('0x55')]['type']);return db[_0xe627('0x57')][_0xe627('0x53')](_0x1b1d07[_0xe627('0x55')],{'include':[{'model':db['VtigerField'],'as':_0xe627('0x61')},{'model':db[_0xe627('0x62')],'as':'Descriptions'}]});}return null;})[_0xe627('0x1d')](respondWithResult(_0x2f402f,null))['catch'](handleError(_0x2f402f,null));};var md5=require(_0xe627('0x63'));exports[_0xe627('0x64')]=function(_0x42967c,_0x53d91c,_0xdbeed9){var _0x2611cf=null;var _0xd9f245=null;var _0x56cd63=null;var _0x5e927f=null;var _0x91c4c9='';return db[_0xe627('0x4c')][_0xe627('0x56')]({'where':{'id':_0x42967c['params']['id']},'attributes':['id',_0xe627('0x3a'),_0xe627('0x65'),_0xe627('0x66'),_0xe627('0x67'),_0xe627('0x68'),'serverUrl',_0xe627('0x69')]})[_0xe627('0x1d')](handleEntityNotFound(_0x53d91c,null))['then'](function(_0x496a07){if(_0x496a07){_0x2611cf=_0x496a07[_0xe627('0x65')];_0xd9f245=_0x496a07[_0xe627('0x69')];_0x56cd63=_0x496a07[_0xe627('0x67')];_0x91c4c9=_0x496a07[_0xe627('0x68')];var _0x60e34=_0x91c4c9[_0xe627('0x6a')](-0x1);if(_0x60e34==='/'){_0x91c4c9=_0x91c4c9[_0xe627('0x6b')](0x0,_0x91c4c9[_0xe627('0x6c')](_0x60e34));}_0x5e927f=util[_0xe627('0x6d')](_0xe627('0x6e'),_0x91c4c9);var _0x5b9b86={'method':'GET','uri':_0x5e927f,'qs':{'operation':_0xe627('0x6f'),'username':_0x496a07['username']},'json':!![]};return rp(_0x5b9b86);}})[_0xe627('0x1d')](function(_0x5e91ca){if(_0x5e91ca[_0xe627('0x70')]){var _0x444cb4={'method':'POST','uri':_0x5e927f,'form':{'operation':_0xe627('0x71'),'username':_0x2611cf,'accessKey':md5(_0x5e91ca[_0xe627('0x25')][_0xe627('0x72')]+_0xd9f245)},'json':!![]};return rp(_0x444cb4);}})[_0xe627('0x1d')](function(_0x54aab8){if(_0x54aab8['success']){var _0x840692={'method':'GET','uri':_0x5e927f,'qs':{'operation':_0xe627('0x73'),'username':_0x2611cf,'sessionName':_0x54aab8[_0xe627('0x25')][_0xe627('0x74')],'elementType':_0x56cd63},'json':!![]};return rp(_0x840692);}})['then'](function(_0xcc7335){if(_0xcc7335[_0xe627('0x70')]){var _0x1429a2=[_0xe627('0x75'),_0xe627('0x76'),_0xe627('0x77')];_[_0xe627('0x78')](_0xcc7335[_0xe627('0x25')][_0xe627('0x3e')],function(_0x26465d){return _0x1429a2[_0xe627('0x79')](_0x26465d['type'][_0xe627('0x3a')]);});_[_0xe627('0x78')](_0xcc7335['result']['fields'],function(_0x2720ac){return _0x2720ac[_0xe627('0x7a')]==='false';});return{'count':_0xcc7335[_0xe627('0x25')]['fields']['length'],'rows':_[_0xe627('0x39')](_0xcc7335[_0xe627('0x25')][_0xe627('0x3e')],function(_0x170a7b){return{'id':_0x170a7b[_0xe627('0x3a')],'name':_0x170a7b[_0xe627('0x7b')],'custom':_[_0xe627('0x7c')](_0x170a7b['name'],_0xe627('0x7d'))?!![]:![],'options':_0x170a7b['type'][_0xe627('0x3a')]===_0xe627('0x7e')&&_0x170a7b[_0xe627('0x36')][_0xe627('0x7f')]['length']>0x0?_[_0xe627('0x39')](_0x170a7b['type'][_0xe627('0x7f')],function(_0x4790d4){return{'name':_0x4790d4[_0xe627('0x7b')],'value':_0x4790d4[_0xe627('0x80')]};}):[]};})};}})[_0xe627('0x1d')](respondWithResult(_0x53d91c,null))[_0xe627('0x26')](function(_0x1fe293){console[_0xe627('0x81')]('vTiger\x20error:\x20'+_0x1fe293);var _0x26e1e0=_0x42967c[_0xe627('0x3b')][_0xe627('0x19')]?0x1f4:_0x1fe293[_0xe627('0x82')]||0x1f4;logger[_0xe627('0x20')](_0xe627('0x83'),_0xe627('0x64'),_0x26e1e0,JSON[_0xe627('0x1f')](_0x1fe293));delete _0x1fe293[_0xe627('0x3a')];if(_0x26e1e0===0x191){_0x26e1e0=0x190;}_0x53d91c[_0xe627('0x28')](_0x26e1e0)['send'](_0x42967c['query'][_0xe627('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x1fe293[_0xe627('0x82')]}:_0x1fe293);});}; \ No newline at end of file +var _0xccb0=['Subjects','getSubjects','channel','Descriptions','VtigerField','username','description','remoteUri','accessKey','slice','substring','lastIndexOf','%s/webservice.php','success','login','token','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','request','info','VtigerAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','AccountId'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0xccb0,0x11d));var _0x0ccb=function(_0x4ea3aa,_0x23677d){_0x4ea3aa=_0x4ea3aa-0x0;var _0x10e1b1=_0xccb0[_0x4ea3aa];return _0x10e1b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ccb('0x0'));var rimraf=require(_0x0ccb('0x1'));var zipdir=require(_0x0ccb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ccb('0x3'));var moment=require(_0x0ccb('0x4'));var BPromise=require(_0x0ccb('0x5'));var Mustache=require(_0x0ccb('0x6'));var util=require(_0x0ccb('0x7'));var path=require(_0x0ccb('0x8'));var sox=require(_0x0ccb('0x9'));var csv=require('to-csv');var ejs=require(_0x0ccb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0ccb('0xb'));var crypto=require(_0x0ccb('0xc'));var jsforce=require(_0x0ccb('0xd'));var deskjs=require(_0x0ccb('0xe'));var toCsv=require(_0x0ccb('0xf'));var querystring=require(_0x0ccb('0x10'));var Papa=require('papaparse');var Redis=require(_0x0ccb('0x11'));var authService=require(_0x0ccb('0x12'));var qs=require(_0x0ccb('0x13'));var as=require(_0x0ccb('0x14'));var hardwareService=require(_0x0ccb('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x0ccb('0x16'));var config=require('../../config/environment');var db=require(_0x0ccb('0x17'))['db'];var integrations=require(_0x0ccb('0x18'));var jayson=require(_0x0ccb('0x19'));var client=jayson['client'][_0x0ccb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x533245,_0x5e986e,_0x3f51ce){if(_0x3f51ce){var _0x498d8c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x498d8c[_0x0ccb('0x1b')](_0x5e986e)){return _0x533245;}else{throw new db[(_0x0ccb('0x1c'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x533245;}}function respondWithRpcPromise(_0x53a714,_0x1a9b36,_0x2c46ff,_0x29fbfd){return new BPromise(function(_0x4bedc3,_0x25e718){var _0x252b0c=_0x29fbfd||client;return _0x252b0c[_0x0ccb('0x1d')](_0x53a714,_0x2c46ff)['then'](function(_0x8dc426){logger[_0x0ccb('0x1e')](_0x0ccb('0x1f'),_0x1a9b36,'request\x20sent');logger[_0x0ccb('0x20')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1a9b36,_0x0ccb('0x21'),JSON[_0x0ccb('0x22')](_0x8dc426));if(_0x8dc426[_0x0ccb('0x23')]){if(_0x8dc426[_0x0ccb('0x23')][_0x0ccb('0x24')]===0x1f4){logger['error'](_0x0ccb('0x1f'),_0x1a9b36,_0x8dc426['error'][_0x0ccb('0x25')]);return _0x25e718(_0x8dc426[_0x0ccb('0x23')][_0x0ccb('0x25')]);}logger[_0x0ccb('0x23')](_0x0ccb('0x1f'),_0x1a9b36,_0x8dc426[_0x0ccb('0x23')][_0x0ccb('0x25')]);return _0x4bedc3(_0x8dc426['error'][_0x0ccb('0x25')]);}else{logger[_0x0ccb('0x1e')]('VtigerAccount,\x20%s,\x20%s',_0x1a9b36,_0x0ccb('0x21'));_0x4bedc3(_0x8dc426[_0x0ccb('0x26')][_0x0ccb('0x25')]);}})[_0x0ccb('0x27')](function(_0x102c75){logger[_0x0ccb('0x23')](_0x0ccb('0x1f'),_0x1a9b36,_0x102c75);_0x25e718(_0x102c75);});});}function respondWithStatusCode(_0x1119e6,_0x5a90d0){_0x5a90d0=_0x5a90d0||0xcc;return function(_0x46e9e1){if(_0x46e9e1){return _0x1119e6['sendStatus'](_0x5a90d0);}return _0x1119e6[_0x0ccb('0x28')](_0x5a90d0)[_0x0ccb('0x29')]();};}function respondWithResult(_0x59ffcc,_0x3b684a){_0x3b684a=_0x3b684a||0xc8;return function(_0x550b36){if(_0x550b36){return _0x59ffcc[_0x0ccb('0x28')](_0x3b684a)[_0x0ccb('0x2a')](_0x550b36);}};}function respondWithFilteredResult(_0x41c513,_0x1eef32){return function(_0x2198b7){if(_0x2198b7){var _0x4c1b97=_0x2198b7[_0x0ccb('0x2b')],_0x55c361=_0x1eef32[_0x0ccb('0x2c')],_0x50baf0=_0x1eef32[_0x0ccb('0x2c')]+_0x1eef32[_0x0ccb('0x2d')],_0x4494f1;if(_0x50baf0>=_0x4c1b97){_0x50baf0=_0x4c1b97;_0x4494f1=0xc8;}else{_0x4494f1=0xce;}_0x41c513[_0x0ccb('0x28')](_0x4494f1);return _0x41c513[_0x0ccb('0x2e')](_0x0ccb('0x2f'),_0x55c361+'-'+_0x50baf0+'/'+_0x4c1b97)['json'](_0x2198b7);}return null;};}function patchUpdates(_0x3b15db){return function(_0x24df83){try{jsonpatch[_0x0ccb('0x30')](_0x24df83,_0x3b15db,!![]);}catch(_0x2e1913){return BPromise[_0x0ccb('0x31')](_0x2e1913);}return _0x24df83[_0x0ccb('0x32')]();};}function saveUpdates(_0x693679,_0x2a06c2){return function(_0x9ceaa5){if(_0x9ceaa5){return _0x9ceaa5[_0x0ccb('0x33')](_0x693679)['then'](function(_0x196103){return _0x196103;});}return null;};}function removeEntity(_0x1b3f40,_0x66713e){return function(_0x3be85a){if(_0x3be85a){return _0x3be85a['destroy']()[_0x0ccb('0x34')](function(){_0x1b3f40[_0x0ccb('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2df31c,_0x373f20){return function(_0x5386f1){if(!_0x5386f1){_0x2df31c['sendStatus'](0x194);}return _0x5386f1;};}function handleError(_0x5a6799,_0x5699bd){_0x5699bd=_0x5699bd||0x1f4;return function(_0x350aef){logger['error'](_0x350aef[_0x0ccb('0x35')]);if(_0x350aef['name']){delete _0x350aef[_0x0ccb('0x36')];}_0x5a6799[_0x0ccb('0x28')](_0x5699bd)[_0x0ccb('0x37')](_0x350aef);};}exports[_0x0ccb('0x38')]=function(_0x51e23b,_0x4c6741){var _0x363016={},_0x444a29={},_0x20db42={'count':0x0,'rows':[]};var _0x1524b0=_[_0x0ccb('0x39')](db[_0x0ccb('0x3a')]['rawAttributes'],function(_0x4d0b1d){return{'name':_0x4d0b1d[_0x0ccb('0x3b')],'type':_0x4d0b1d[_0x0ccb('0x3c')][_0x0ccb('0x3d')]};});_0x444a29[_0x0ccb('0x3e')]=_[_0x0ccb('0x39')](_0x1524b0,_0x0ccb('0x36'));_0x444a29[_0x0ccb('0x3f')]=_[_0x0ccb('0x40')](_0x51e23b['query']);_0x444a29[_0x0ccb('0x41')]=_[_0x0ccb('0x42')](_0x444a29['model'],_0x444a29[_0x0ccb('0x3f')]);_0x363016[_0x0ccb('0x43')]=_[_0x0ccb('0x42')](_0x444a29[_0x0ccb('0x3e')],qs[_0x0ccb('0x44')](_0x51e23b[_0x0ccb('0x3f')][_0x0ccb('0x44')]));_0x363016[_0x0ccb('0x43')]=_0x363016[_0x0ccb('0x43')][_0x0ccb('0x45')]?_0x363016['attributes']:_0x444a29[_0x0ccb('0x3e')];if(!_0x51e23b[_0x0ccb('0x3f')][_0x0ccb('0x46')](_0x0ccb('0x47'))){_0x363016[_0x0ccb('0x2d')]=qs[_0x0ccb('0x2d')](_0x51e23b[_0x0ccb('0x3f')]['limit']);_0x363016['offset']=qs[_0x0ccb('0x2c')](_0x51e23b[_0x0ccb('0x3f')][_0x0ccb('0x2c')]);}_0x363016['order']=qs[_0x0ccb('0x48')](_0x51e23b['query'][_0x0ccb('0x48')]);_0x363016[_0x0ccb('0x49')]=qs[_0x0ccb('0x41')](_[_0x0ccb('0x4a')](_0x51e23b[_0x0ccb('0x3f')],_0x444a29[_0x0ccb('0x41')]),_0x1524b0);if(_0x51e23b[_0x0ccb('0x3f')][_0x0ccb('0x4b')]){_0x363016[_0x0ccb('0x49')]=_['merge'](_0x363016[_0x0ccb('0x49')],{'$or':_[_0x0ccb('0x39')](_0x1524b0,function(_0x647045){if(_0x647045['type']!=='VIRTUAL'){var _0xb4575b={};_0xb4575b[_0x647045[_0x0ccb('0x36')]]={'$like':'%'+_0x51e23b[_0x0ccb('0x3f')]['filter']+'%'};return _0xb4575b;}})});}_0x363016=_['merge']({},_0x363016,_0x51e23b[_0x0ccb('0x4c')]);var _0x3704f7={'where':_0x363016['where']};return db[_0x0ccb('0x3a')]['count'](_0x3704f7)['then'](function(_0x1c1dd2){_0x20db42[_0x0ccb('0x2b')]=_0x1c1dd2;if(_0x51e23b[_0x0ccb('0x3f')][_0x0ccb('0x4d')]){_0x363016[_0x0ccb('0x4e')]=[{'all':!![]}];}return db[_0x0ccb('0x3a')][_0x0ccb('0x4f')](_0x363016);})[_0x0ccb('0x34')](function(_0x911a5f){_0x20db42[_0x0ccb('0x50')]=_0x911a5f;return _0x20db42;})['then'](respondWithFilteredResult(_0x4c6741,_0x363016))[_0x0ccb('0x27')](handleError(_0x4c6741,null));};exports[_0x0ccb('0x51')]=function(_0x349f2d,_0x45705b){var _0x331a07={'raw':![],'where':{'id':_0x349f2d[_0x0ccb('0x52')]['id']}},_0x1c2946={};_0x1c2946[_0x0ccb('0x3e')]=_['keys'](db[_0x0ccb('0x3a')][_0x0ccb('0x53')]);_0x1c2946[_0x0ccb('0x3f')]=_['keys'](_0x349f2d[_0x0ccb('0x3f')]);_0x1c2946[_0x0ccb('0x41')]=_[_0x0ccb('0x42')](_0x1c2946['model'],_0x1c2946[_0x0ccb('0x3f')]);_0x331a07['attributes']=_['intersection'](_0x1c2946['model'],qs[_0x0ccb('0x44')](_0x349f2d['query'][_0x0ccb('0x44')]));_0x331a07[_0x0ccb('0x43')]=_0x331a07[_0x0ccb('0x43')][_0x0ccb('0x45')]?_0x331a07[_0x0ccb('0x43')]:_0x1c2946[_0x0ccb('0x3e')];if(_0x349f2d[_0x0ccb('0x3f')]['includeAll']){_0x331a07['include']=[{'all':!![]}];}_0x331a07=_[_0x0ccb('0x54')]({},_0x331a07,_0x349f2d[_0x0ccb('0x4c')]);return db[_0x0ccb('0x3a')][_0x0ccb('0x55')](_0x331a07)[_0x0ccb('0x34')](handleEntityNotFound(_0x45705b,null))[_0x0ccb('0x34')](respondWithResult(_0x45705b,null))['catch'](handleError(_0x45705b,null));};exports[_0x0ccb('0x56')]=function(_0x4a7fee,_0x362032){return db[_0x0ccb('0x3a')][_0x0ccb('0x56')](_0x4a7fee[_0x0ccb('0x57')],{})[_0x0ccb('0x34')](respondWithResult(_0x362032,0xc9))[_0x0ccb('0x27')](handleError(_0x362032,null));};exports[_0x0ccb('0x33')]=function(_0x7165d2,_0x92f110){if(_0x7165d2['body']['id']){delete _0x7165d2['body']['id'];}return db[_0x0ccb('0x3a')][_0x0ccb('0x55')]({'where':{'id':_0x7165d2[_0x0ccb('0x52')]['id']}})['then'](handleEntityNotFound(_0x92f110,null))[_0x0ccb('0x34')](saveUpdates(_0x7165d2[_0x0ccb('0x57')],null))[_0x0ccb('0x34')](respondWithResult(_0x92f110,null))[_0x0ccb('0x27')](handleError(_0x92f110,null));};exports['destroy']=function(_0x5d4cb7,_0x5be02e){return db['VtigerAccount'][_0x0ccb('0x55')]({'where':{'id':_0x5d4cb7[_0x0ccb('0x52')]['id']}})['then'](handleEntityNotFound(_0x5be02e,null))[_0x0ccb('0x34')](removeEntity(_0x5be02e,null))[_0x0ccb('0x27')](handleError(_0x5be02e,null));};exports[_0x0ccb('0x58')]=function(_0x2d6b5d,_0x7855ae,_0xd9e065){var _0x210945={};var _0x1160b8={};var _0x52eb31;var _0x2bda18;return db['VtigerAccount'][_0x0ccb('0x59')]({'where':{'id':_0x2d6b5d[_0x0ccb('0x52')]['id']}})['then'](handleEntityNotFound(_0x7855ae,null))[_0x0ccb('0x34')](function(_0x264542){if(_0x264542){_0x52eb31=_0x264542;_0x1160b8[_0x0ccb('0x3e')]=_[_0x0ccb('0x40')](db[_0x0ccb('0x5a')][_0x0ccb('0x53')]);_0x1160b8[_0x0ccb('0x3f')]=_[_0x0ccb('0x40')](_0x2d6b5d[_0x0ccb('0x3f')]);_0x1160b8[_0x0ccb('0x41')]=_[_0x0ccb('0x42')](_0x1160b8[_0x0ccb('0x3e')],_0x1160b8[_0x0ccb('0x3f')]);_0x210945[_0x0ccb('0x43')]=_[_0x0ccb('0x42')](_0x1160b8[_0x0ccb('0x3e')],qs[_0x0ccb('0x44')](_0x2d6b5d['query'][_0x0ccb('0x44')]));_0x210945['attributes']=_0x210945[_0x0ccb('0x43')][_0x0ccb('0x45')]?_0x210945[_0x0ccb('0x43')]:_0x1160b8[_0x0ccb('0x3e')];_0x210945[_0x0ccb('0x5b')]=qs[_0x0ccb('0x48')](_0x2d6b5d[_0x0ccb('0x3f')][_0x0ccb('0x48')]);_0x210945[_0x0ccb('0x49')]=qs['filters'](_[_0x0ccb('0x4a')](_0x2d6b5d[_0x0ccb('0x3f')],_0x1160b8[_0x0ccb('0x41')]));if(_0x2d6b5d[_0x0ccb('0x3f')][_0x0ccb('0x4b')]){_0x210945[_0x0ccb('0x49')]=_[_0x0ccb('0x54')](_0x210945[_0x0ccb('0x49')],{'$or':_[_0x0ccb('0x39')](_0x210945[_0x0ccb('0x43')],function(_0x24f300){var _0x28e062={};_0x28e062[_0x24f300]={'$like':'%'+_0x2d6b5d[_0x0ccb('0x3f')][_0x0ccb('0x4b')]+'%'};return _0x28e062;})});}_0x210945=_['merge']({},_0x210945,_0x2d6b5d['options']);return _0x52eb31[_0x0ccb('0x58')](_0x210945);}})[_0x0ccb('0x34')](function(_0x5b9e7a){if(_0x5b9e7a){_0x2bda18=_0x5b9e7a[_0x0ccb('0x45')];if(!_0x2d6b5d[_0x0ccb('0x3f')][_0x0ccb('0x46')](_0x0ccb('0x47'))){_0x210945['limit']=qs[_0x0ccb('0x2d')](_0x2d6b5d[_0x0ccb('0x3f')]['limit']);_0x210945[_0x0ccb('0x2c')]=qs[_0x0ccb('0x2c')](_0x2d6b5d[_0x0ccb('0x3f')][_0x0ccb('0x2c')]);}return _0x52eb31[_0x0ccb('0x58')](_0x210945);}})['then'](function(_0x4d4e7b){if(_0x4d4e7b){return _0x4d4e7b?{'count':_0x2bda18,'rows':_0x4d4e7b}:null;}})[_0x0ccb('0x34')](respondWithResult(_0x7855ae,null))[_0x0ccb('0x27')](handleError(_0x7855ae,null));};exports['addConfiguration']=function(_0xc635c3,_0x31f5ae,_0x455ad4){if(_0xc635c3['body']['id']){delete _0xc635c3[_0x0ccb('0x57')]['id'];}return db[_0x0ccb('0x3a')]['findOne']({'where':{'id':_0xc635c3['params']['id']}})[_0x0ccb('0x34')](handleEntityNotFound(_0x31f5ae,null))[_0x0ccb('0x34')](function(_0x3acfd0){if(_0x3acfd0){_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x5c')]=_0x3acfd0['id'];_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x5d')]=integrations[_0x0ccb('0x5e')](_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x5f')],_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x3c')]);_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x60')]=integrations['getDescriptions'](_0xc635c3[_0x0ccb('0x57')][_0x0ccb('0x5f')],_0xc635c3['body']['type']);return db[_0x0ccb('0x5a')]['create'](_0xc635c3[_0x0ccb('0x57')],{'include':[{'model':db[_0x0ccb('0x61')],'as':'Subjects'},{'model':db[_0x0ccb('0x61')],'as':_0x0ccb('0x60')}]});}return null;})[_0x0ccb('0x34')](respondWithResult(_0x31f5ae,null))['catch'](handleError(_0x31f5ae,null));};var md5=require('md5');exports['getFields']=function(_0x21ebb8,_0x1be5f6,_0x16e101){var _0x2043da=null;var _0x49d134=null;var _0xa72c31=null;var _0x272f63=null;var _0x1e0a3a='';return db['VtigerAccount'][_0x0ccb('0x59')]({'where':{'id':_0x21ebb8['params']['id']},'attributes':['id',_0x0ccb('0x36'),_0x0ccb('0x62'),_0x0ccb('0x63'),'moduleName',_0x0ccb('0x64'),'serverUrl',_0x0ccb('0x65')]})[_0x0ccb('0x34')](handleEntityNotFound(_0x1be5f6,null))[_0x0ccb('0x34')](function(_0x15b792){if(_0x15b792){_0x2043da=_0x15b792[_0x0ccb('0x62')];_0x49d134=_0x15b792[_0x0ccb('0x65')];_0xa72c31=_0x15b792['moduleName'];_0x1e0a3a=_0x15b792[_0x0ccb('0x64')];var _0x51c6c6=_0x1e0a3a[_0x0ccb('0x66')](-0x1);if(_0x51c6c6==='/'){_0x1e0a3a=_0x1e0a3a[_0x0ccb('0x67')](0x0,_0x1e0a3a[_0x0ccb('0x68')](_0x51c6c6));}_0x272f63=util['format'](_0x0ccb('0x69'),_0x1e0a3a);var _0x347c13={'method':'GET','uri':_0x272f63,'qs':{'operation':'getchallenge','username':_0x15b792[_0x0ccb('0x62')]},'json':!![]};return rp(_0x347c13);}})[_0x0ccb('0x34')](function(_0x56ec31){if(_0x56ec31[_0x0ccb('0x6a')]){var _0xc3ed1b={'method':'POST','uri':_0x272f63,'form':{'operation':_0x0ccb('0x6b'),'username':_0x2043da,'accessKey':md5(_0x56ec31['result'][_0x0ccb('0x6c')]+_0x49d134)},'json':!![]};return rp(_0xc3ed1b);}})[_0x0ccb('0x34')](function(_0x3eb100){if(_0x3eb100[_0x0ccb('0x6a')]){var _0x2937c6={'method':'GET','uri':_0x272f63,'qs':{'operation':_0x0ccb('0x6d'),'username':_0x2043da,'sessionName':_0x3eb100['result'][_0x0ccb('0x6e')],'elementType':_0xa72c31},'json':!![]};return rp(_0x2937c6);}})['then'](function(_0x3b94fc){if(_0x3b94fc[_0x0ccb('0x6a')]){var _0x1bab33=[_0x0ccb('0x6f'),_0x0ccb('0x70'),_0x0ccb('0x71')];_[_0x0ccb('0x72')](_0x3b94fc[_0x0ccb('0x26')][_0x0ccb('0x44')],function(_0x4098bc){return _0x1bab33['includes'](_0x4098bc[_0x0ccb('0x3c')]['name']);});_[_0x0ccb('0x72')](_0x3b94fc[_0x0ccb('0x26')]['fields'],function(_0x24b941){return _0x24b941[_0x0ccb('0x73')]===_0x0ccb('0x74');});return{'count':_0x3b94fc['result'][_0x0ccb('0x44')][_0x0ccb('0x45')],'rows':_[_0x0ccb('0x39')](_0x3b94fc[_0x0ccb('0x26')][_0x0ccb('0x44')],function(_0xf0d336){return{'id':_0xf0d336[_0x0ccb('0x36')],'name':_0xf0d336[_0x0ccb('0x75')],'custom':_[_0x0ccb('0x76')](_0xf0d336[_0x0ccb('0x36')],_0x0ccb('0x77'))?!![]:![],'options':_0xf0d336[_0x0ccb('0x3c')][_0x0ccb('0x36')]==='picklist'&&_0xf0d336[_0x0ccb('0x3c')]['picklistValues'][_0x0ccb('0x45')]>0x0?_['map'](_0xf0d336[_0x0ccb('0x3c')][_0x0ccb('0x78')],function(_0x4a69d1){return{'name':_0x4a69d1[_0x0ccb('0x75')],'value':_0x4a69d1[_0x0ccb('0x79')]};}):[]};})};}})['then'](respondWithResult(_0x1be5f6,null))[_0x0ccb('0x27')](function(_0x4e914e){console[_0x0ccb('0x7a')](_0x0ccb('0x7b')+_0x4e914e);var _0x12fb86=_0x21ebb8['query']['test']?0x1f4:_0x4e914e['statusCode']||0x1f4;logger[_0x0ccb('0x23')](_0x0ccb('0x7c'),'getFields',_0x12fb86,JSON[_0x0ccb('0x22')](_0x4e914e));delete _0x4e914e[_0x0ccb('0x36')];if(_0x12fb86===0x191){_0x12fb86=0x190;}_0x1be5f6[_0x0ccb('0x28')](_0x12fb86)[_0x0ccb('0x37')](_0x21ebb8[_0x0ccb('0x3f')]['test']?{'message':_0x0ccb('0x7d'),'statusCode':_0x4e914e['statusCode']}:_0x4e914e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index aa4e5bf..7f30f9b 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 _0xc304=['exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x4b0946,_0x19ea1e){var _0x402989=function(_0x388500){while(--_0x388500){_0x4b0946['push'](_0x4b0946['shift']());}};_0x402989(++_0x19ea1e);}(_0xc304,0xdb));var _0x4c30=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xc304[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4c30('0x0'));var util=require(_0x4c30('0x1'));var logger=require(_0x4c30('0x2'))(_0x4c30('0x3'));var moment=require(_0x4c30('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c30('0x5'));var rimraf=require(_0x4c30('0x6'));var config=require(_0x4c30('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4c30('0x8'));module[_0x4c30('0x9')]=function(_0x3149d3,_0xf20128){return _0x3149d3[_0x4c30('0xa')](_0x4c30('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f8d=['bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x39d1c2,_0x275c6f){var _0x5106f0=function(_0x2d657d){while(--_0x2d657d){_0x39d1c2['push'](_0x39d1c2['shift']());}};_0x5106f0(++_0x275c6f);}(_0x5f8d,0xf0));var _0xd5f8=function(_0x3084ef,_0x44ae18){_0x3084ef=_0x3084ef-0x0;var _0x5a7cb5=_0x5f8d[_0x3084ef];return _0x5a7cb5;};'use strict';var _=require(_0xd5f8('0x0'));var util=require('util');var logger=require(_0xd5f8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd5f8('0x2'));var rp=require(_0xd5f8('0x3'));var fs=require('fs');var path=require(_0xd5f8('0x4'));var rimraf=require('rimraf');var config=require(_0xd5f8('0x5'));var attributes=require(_0xd5f8('0x6'));var integrations=require(_0xd5f8('0x7'));module['exports']=function(_0x4856d7,_0xcbfc97){return _0x4856d7[_0xd5f8('0x8')](_0xd5f8('0x9'),attributes,{'tableName':_0xd5f8('0xa'),'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 757d691..378a1c0 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 _0xb9b5=['model','then','stringify','find','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','include','map'];(function(_0x28d867,_0x3898db){var _0x2d2a1f=function(_0x59c447){while(--_0x59c447){_0x28d867['push'](_0x28d867['shift']());}};_0x2d2a1f(++_0x3898db);}(_0xb9b5,0xd1));var _0x5b9b=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0xb9b5[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0x5b9b('0x0'));var util=require('util');var moment=require(_0x5b9b('0x1'));var BPromise=require(_0x5b9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b9b('0x3'));var db=require(_0x5b9b('0x4'))['db'];var utils=require(_0x5b9b('0x5'));var logger=require(_0x5b9b('0x6'))(_0x5b9b('0x7'));var config=require(_0x5b9b('0x8'));var jayson=require(_0x5b9b('0x9'));var client=jayson[_0x5b9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b7f5e,_0x103aa8,_0x113a8e){return new BPromise(function(_0x138993,_0x5e61d2){return client[_0x5b9b('0xb')](_0x1b7f5e,_0x113a8e)['then'](function(_0x56f552){logger[_0x5b9b('0xc')](_0x5b9b('0xd'),_0x103aa8,_0x5b9b('0xe'));logger[_0x5b9b('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x103aa8,_0x5b9b('0xe'),JSON['stringify'](_0x56f552));if(_0x56f552[_0x5b9b('0x10')]){if(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x11')]===0x1f4){logger[_0x5b9b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);return _0x5e61d2(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);}logger[_0x5b9b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);return _0x138993(_0x56f552[_0x5b9b('0x10')][_0x5b9b('0x12')]);}else{logger[_0x5b9b('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x103aa8,_0x5b9b('0xe'));_0x138993(_0x56f552[_0x5b9b('0x13')][_0x5b9b('0x12')]);}})[_0x5b9b('0x14')](function(_0xde145f){logger[_0x5b9b('0x10')](_0x5b9b('0xd'),_0x103aa8,_0xde145f);_0x5e61d2(_0xde145f);});});}exports[_0x5b9b('0x15')]=function(_0x4664ec){var _0xc7d8c6=this;return new Promise(function(_0x50d15f,_0x200105){return db[_0x5b9b('0x16')]['findAll']({'raw':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x18')]===undefined?!![]:![]:!![],'where':_0x4664ec['options']?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x19')]||null:null,'attributes':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x1a')]||null:null,'limit':_0x4664ec[_0x5b9b('0x17')]?_0x4664ec[_0x5b9b('0x17')]['limit']||null:null,'include':_0x4664ec['options']?_0x4664ec['options'][_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x4664ec[_0x5b9b('0x17')][_0x5b9b('0x1b')],function(_0x1bdc4e){return{'model':db[_0x1bdc4e[_0x5b9b('0x1d')]],'as':_0x1bdc4e['as'],'attributes':_0x1bdc4e[_0x5b9b('0x1a')],'include':_0x1bdc4e[_0x5b9b('0x1b')]?_['map'](_0x1bdc4e[_0x5b9b('0x1b')],function(_0x3eee5b){return{'model':db[_0x3eee5b[_0x5b9b('0x1d')]],'as':_0x3eee5b['as'],'attributes':_0x3eee5b[_0x5b9b('0x1a')],'include':_0x3eee5b[_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x3eee5b[_0x5b9b('0x1b')],function(_0x2bbe58){return{'model':db[_0x2bbe58[_0x5b9b('0x1d')]],'as':_0x2bbe58['as'],'attributes':_0x2bbe58[_0x5b9b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b9b('0x1e')](function(_0x24fa54){logger[_0x5b9b('0xc')](_0x5b9b('0x15'),_0x4664ec);logger[_0x5b9b('0xf')]('GetVtigerAccount',_0x4664ec,JSON[_0x5b9b('0x1f')](_0x24fa54));_0x50d15f(_0x24fa54);})['catch'](function(_0x5126d3){logger['error'](_0x5b9b('0x15'),_0x5126d3[_0x5b9b('0x12')],_0x4664ec);_0x200105(_0xc7d8c6[_0x5b9b('0x10')](0x1f4,_0x5126d3[_0x5b9b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0xe13188){var _0x4b85d3=this;return new Promise(function(_0x2214c4,_0xa215e0){return db[_0x5b9b('0x16')][_0x5b9b('0x20')]({'raw':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x18')]===undefined?!![]:![]:!![],'where':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x19')]||null:null,'attributes':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')]['attributes']||null:null,'include':_0xe13188[_0x5b9b('0x17')]?_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x1b')]?_['map'](_0xe13188[_0x5b9b('0x17')][_0x5b9b('0x1b')],function(_0x12ec68){return{'model':db[_0x12ec68[_0x5b9b('0x1d')]],'as':_0x12ec68['as'],'attributes':_0x12ec68[_0x5b9b('0x1a')],'include':_0x12ec68[_0x5b9b('0x1b')]?_[_0x5b9b('0x1c')](_0x12ec68['include'],function(_0x250f8a){return{'model':db[_0x250f8a[_0x5b9b('0x1d')]],'as':_0x250f8a['as'],'attributes':_0x250f8a['attributes'],'include':_0x250f8a['include']?_['map'](_0x250f8a[_0x5b9b('0x1b')],function(_0x178713){return{'model':db[_0x178713[_0x5b9b('0x1d')]],'as':_0x178713['as'],'attributes':_0x178713[_0x5b9b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5b9b('0x1e')](function(_0xe4dc2c){logger['info']('ShowVtigerAccount',_0xe13188);logger[_0x5b9b('0xf')](_0x5b9b('0x21'),_0xe13188,JSON['stringify'](_0xe4dc2c));_0x2214c4(_0xe4dc2c);})[_0x5b9b('0x14')](function(_0x4665d5){logger[_0x5b9b('0x10')](_0x5b9b('0x21'),_0x4665d5[_0x5b9b('0x12')],_0xe13188);_0xa215e0(_0x4b85d3[_0x5b9b('0x10')](0x1f4,_0x4665d5['message']));});});}; \ No newline at end of file +var _0xea92=['find','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetVtigerAccount','findAll','options','where','limit','include','map','attributes','model','debug','VtigerAccount'];(function(_0x87a5e9,_0x51642b){var _0x1e6c81=function(_0x37a13){while(--_0x37a13){_0x87a5e9['push'](_0x87a5e9['shift']());}};_0x1e6c81(++_0x51642b);}(_0xea92,0x146));var _0x2ea9=function(_0x5e4752,_0x327bcb){_0x5e4752=_0x5e4752-0x0;var _0x51690f=_0xea92[_0x5e4752];return _0x51690f;};'use strict';var _=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var moment=require('moment');var BPromise=require(_0x2ea9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ea9('0x3'));var db=require(_0x2ea9('0x4'))['db'];var utils=require(_0x2ea9('0x5'));var logger=require(_0x2ea9('0x6'))(_0x2ea9('0x7'));var config=require(_0x2ea9('0x8'));var jayson=require(_0x2ea9('0x9'));var client=jayson['client'][_0x2ea9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd6b5,_0x436123,_0xdfa3c){return new BPromise(function(_0x114529,_0x4e7538){return client[_0x2ea9('0xb')](_0x3dd6b5,_0xdfa3c)[_0x2ea9('0xc')](function(_0x57b010){logger[_0x2ea9('0xd')](_0x2ea9('0xe'),_0x436123,'request\x20sent');logger['debug'](_0x2ea9('0xf'),_0x436123,_0x2ea9('0x10'),JSON[_0x2ea9('0x11')](_0x57b010));if(_0x57b010['error']){if(_0x57b010['error'][_0x2ea9('0x12')]===0x1f4){logger[_0x2ea9('0x13')](_0x2ea9('0xe'),_0x436123,_0x57b010['error']['message']);return _0x4e7538(_0x57b010['error'][_0x2ea9('0x14')]);}logger[_0x2ea9('0x13')](_0x2ea9('0xe'),_0x436123,_0x57b010[_0x2ea9('0x13')]['message']);return _0x114529(_0x57b010[_0x2ea9('0x13')][_0x2ea9('0x14')]);}else{logger[_0x2ea9('0xd')](_0x2ea9('0xe'),_0x436123,_0x2ea9('0x10'));_0x114529(_0x57b010[_0x2ea9('0x15')][_0x2ea9('0x14')]);}})[_0x2ea9('0x16')](function(_0xa173de){logger[_0x2ea9('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x436123,_0xa173de);_0x4e7538(_0xa173de);});});}exports[_0x2ea9('0x17')]=function(_0x34cf4f){var _0x1538eb=this;return new Promise(function(_0x473d05,_0x6af24a){return db['VtigerAccount'][_0x2ea9('0x18')]({'raw':_0x34cf4f[_0x2ea9('0x19')]?_0x34cf4f['options']['raw']===undefined?!![]:![]:!![],'where':_0x34cf4f[_0x2ea9('0x19')]?_0x34cf4f[_0x2ea9('0x19')][_0x2ea9('0x1a')]||null:null,'attributes':_0x34cf4f[_0x2ea9('0x19')]?_0x34cf4f[_0x2ea9('0x19')]['attributes']||null:null,'limit':_0x34cf4f[_0x2ea9('0x19')]?_0x34cf4f[_0x2ea9('0x19')][_0x2ea9('0x1b')]||null:null,'include':_0x34cf4f[_0x2ea9('0x19')]?_0x34cf4f[_0x2ea9('0x19')][_0x2ea9('0x1c')]?_[_0x2ea9('0x1d')](_0x34cf4f[_0x2ea9('0x19')][_0x2ea9('0x1c')],function(_0x15eaf6){return{'model':db[_0x15eaf6['model']],'as':_0x15eaf6['as'],'attributes':_0x15eaf6[_0x2ea9('0x1e')],'include':_0x15eaf6['include']?_[_0x2ea9('0x1d')](_0x15eaf6[_0x2ea9('0x1c')],function(_0x35c3fa){return{'model':db[_0x35c3fa['model']],'as':_0x35c3fa['as'],'attributes':_0x35c3fa[_0x2ea9('0x1e')],'include':_0x35c3fa[_0x2ea9('0x1c')]?_[_0x2ea9('0x1d')](_0x35c3fa[_0x2ea9('0x1c')],function(_0x3a02f7){return{'model':db[_0x3a02f7[_0x2ea9('0x1f')]],'as':_0x3a02f7['as'],'attributes':_0x3a02f7[_0x2ea9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2ea9('0xc')](function(_0x3d3f2b){logger[_0x2ea9('0xd')](_0x2ea9('0x17'),_0x34cf4f);logger[_0x2ea9('0x20')](_0x2ea9('0x17'),_0x34cf4f,JSON[_0x2ea9('0x11')](_0x3d3f2b));_0x473d05(_0x3d3f2b);})[_0x2ea9('0x16')](function(_0x9ef422){logger[_0x2ea9('0x13')](_0x2ea9('0x17'),_0x9ef422[_0x2ea9('0x14')],_0x34cf4f);_0x6af24a(_0x1538eb[_0x2ea9('0x13')](0x1f4,_0x9ef422[_0x2ea9('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3192f9){var _0x5ecde8=this;return new Promise(function(_0xfdc2b3,_0x522729){return db[_0x2ea9('0x21')][_0x2ea9('0x22')]({'raw':_0x3192f9['options']?_0x3192f9[_0x2ea9('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3192f9['options']?_0x3192f9['options']['where']||null:null,'attributes':_0x3192f9[_0x2ea9('0x19')]?_0x3192f9[_0x2ea9('0x19')]['attributes']||null:null,'include':_0x3192f9[_0x2ea9('0x19')]?_0x3192f9['options'][_0x2ea9('0x1c')]?_[_0x2ea9('0x1d')](_0x3192f9[_0x2ea9('0x19')][_0x2ea9('0x1c')],function(_0x4b4481){return{'model':db[_0x4b4481[_0x2ea9('0x1f')]],'as':_0x4b4481['as'],'attributes':_0x4b4481['attributes'],'include':_0x4b4481[_0x2ea9('0x1c')]?_['map'](_0x4b4481[_0x2ea9('0x1c')],function(_0xae302e){return{'model':db[_0xae302e['model']],'as':_0xae302e['as'],'attributes':_0xae302e[_0x2ea9('0x1e')],'include':_0xae302e['include']?_[_0x2ea9('0x1d')](_0xae302e['include'],function(_0x2e21cf){return{'model':db[_0x2e21cf['model']],'as':_0x2e21cf['as'],'attributes':_0x2e21cf[_0x2ea9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x448f2c){logger[_0x2ea9('0xd')](_0x2ea9('0x23'),_0x3192f9);logger[_0x2ea9('0x20')](_0x2ea9('0x23'),_0x3192f9,JSON[_0x2ea9('0x11')](_0x448f2c));_0xfdc2b3(_0x448f2c);})['catch'](function(_0x572bd1){logger[_0x2ea9('0x13')](_0x2ea9('0x23'),_0x572bd1[_0x2ea9('0x14')],_0x3192f9);_0x522729(_0x5ecde8[_0x2ea9('0x13')](0x1f4,_0x572bd1[_0x2ea9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0b8f771..b56ee75 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 _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x479650,_0x2bee99){var _0x26b288=function(_0x1ba49f){while(--_0x1ba49f){_0x479650['push'](_0x479650['shift']());}};_0x26b288(++_0x2bee99);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',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['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=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(_0x2edbef,_0x5c5cb0){var _0x5991bf=function(_0xf1706b){while(--_0xf1706b){_0x2edbef['push'](_0x2edbef['shift']());}};_0x5991bf(++_0x5c5cb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a3b3e,_0x415238){_0x2a3b3e=_0x2a3b3e-0x0;var _0x3bb5f6=_0xb10b[_0x2a3b3e];return _0x3bb5f6;};'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 d599b78..f4fbf2b 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 _0x56b5=['STRING'];(function(_0x29367d,_0x9f08da){var _0x2acac8=function(_0x22bfc5){while(--_0x22bfc5){_0x29367d['push'](_0x29367d['shift']());}};_0x2acac8(++_0x9f08da);}(_0x56b5,0x1d4));var _0x556b=function(_0x5a0b58,_0x4f8e6e){_0x5a0b58=_0x5a0b58-0x0;var _0x110d33=_0x56b5[_0x5a0b58];return _0x110d33;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x556b('0x0')]},'description':{'type':Sequelize[_0x556b('0x0')]}}; \ No newline at end of file +var _0x6131=['sequelize','exports','STRING'];(function(_0x43050e,_0x139495){var _0xc66ba8=function(_0x2ba781){while(--_0x2ba781){_0x43050e['push'](_0x43050e['shift']());}};_0xc66ba8(++_0x139495);}(_0x6131,0x7b));var _0x1613=function(_0x55679f,_0x19319d){_0x55679f=_0x55679f-0x0;var _0x33ca0b=_0x6131[_0x55679f];return _0x33ca0b;};'use strict';var Sequelize=require(_0x1613('0x0'));module[_0x1613('0x1')]={'name':{'type':Sequelize[_0x1613('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d34038b..7be57ea 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 _0x17b6=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','VtigerConfiguration','include','findAll','rows','show','params','rawAttributes','create','body','findOne','VtigerField','getFields','hasOwnProperty','getSubjects','options','getDescriptions','html-pdf','eml-format','moment','bluebird','mustache','path','sox','ejs'];(function(_0x5b8919,_0x3d2103){var _0x5baa5b=function(_0x406c5e){while(--_0x406c5e){_0x5b8919['push'](_0x5b8919['shift']());}};_0x5baa5b(++_0x3d2103);}(_0x17b6,0xf7));var _0x617b=function(_0x5b2123,_0x3989ed){_0x5b2123=_0x5b2123-0x0;var _0x59bb71=_0x17b6[_0x5b2123];return _0x59bb71;};'use strict';var pdf=require(_0x617b('0x0'));var emlformat=require(_0x617b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x617b('0x2'));var BPromise=require(_0x617b('0x3'));var Mustache=require(_0x617b('0x4'));var util=require('util');var path=require(_0x617b('0x5'));var sox=require(_0x617b('0x6'));var csv=require('to-csv');var ejs=require(_0x617b('0x7'));var fs=require('fs');var _=require(_0x617b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x617b('0x9'));var deskjs=require(_0x617b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x617b('0xb'));var Papa=require(_0x617b('0xc'));var Redis=require(_0x617b('0xd'));var authService=require(_0x617b('0xe'));var qs=require(_0x617b('0xf'));var as=require(_0x617b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x617b('0x11'));var utils=require('../../config/utils');var config=require(_0x617b('0x12'));var db=require(_0x617b('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x617b('0x14')][_0x617b('0x15')]({'port':0x232a});function checkPasswordPattern(_0x196ba6,_0x282ce9,_0x25b756){if(_0x25b756){var _0x35b8a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35b8a7['test'](_0x282ce9)){return _0x196ba6;}else{throw new db['Sequelize'][(_0x617b('0x16'))](_0x617b('0x17'));}}else{return _0x196ba6;}}function respondWithRpcPromise(_0xbc1203,_0x3eda14,_0xfc8565,_0x80279d){return new BPromise(function(_0xea2332,_0x47b826){var _0xd785ba=_0x80279d||client;return _0xd785ba['request'](_0xbc1203,_0xfc8565)[_0x617b('0x18')](function(_0x130a90){logger[_0x617b('0x19')](_0x617b('0x1a'),_0x3eda14,_0x617b('0x1b'));logger['debug'](_0x617b('0x1c'),_0x3eda14,_0x617b('0x1b'),JSON['stringify'](_0x130a90));if(_0x130a90[_0x617b('0x1d')]){if(_0x130a90[_0x617b('0x1d')][_0x617b('0x1e')]===0x1f4){logger['error'](_0x617b('0x1a'),_0x3eda14,_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);return _0x47b826(_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);}logger[_0x617b('0x1d')](_0x617b('0x1a'),_0x3eda14,_0x130a90[_0x617b('0x1d')][_0x617b('0x1f')]);return _0xea2332(_0x130a90['error'][_0x617b('0x1f')]);}else{logger[_0x617b('0x19')](_0x617b('0x1a'),_0x3eda14,_0x617b('0x1b'));_0xea2332(_0x130a90[_0x617b('0x20')][_0x617b('0x1f')]);}})[_0x617b('0x21')](function(_0x57fdca){logger[_0x617b('0x1d')](_0x617b('0x1a'),_0x3eda14,_0x57fdca);_0x47b826(_0x57fdca);});});}function respondWithStatusCode(_0x39698c,_0xdff26c){_0xdff26c=_0xdff26c||0xcc;return function(_0x2674bc){if(_0x2674bc){return _0x39698c['sendStatus'](_0xdff26c);}return _0x39698c['status'](_0xdff26c)['end']();};}function respondWithResult(_0x1bc467,_0x5a50fc){_0x5a50fc=_0x5a50fc||0xc8;return function(_0x50b652){if(_0x50b652){return _0x1bc467[_0x617b('0x22')](_0x5a50fc)[_0x617b('0x23')](_0x50b652);}};}function respondWithFilteredResult(_0x5f0503,_0x23c14b){return function(_0x4a36d1){if(_0x4a36d1){var _0x2f9542=_0x4a36d1[_0x617b('0x24')],_0x21f896=_0x23c14b[_0x617b('0x25')],_0x437ba7=_0x23c14b[_0x617b('0x25')]+_0x23c14b[_0x617b('0x26')],_0x2697f1;if(_0x437ba7>=_0x2f9542){_0x437ba7=_0x2f9542;_0x2697f1=0xc8;}else{_0x2697f1=0xce;}_0x5f0503[_0x617b('0x22')](_0x2697f1);return _0x5f0503[_0x617b('0x27')](_0x617b('0x28'),_0x21f896+'-'+_0x437ba7+'/'+_0x2f9542)[_0x617b('0x23')](_0x4a36d1);}return null;};}function patchUpdates(_0x262253){return function(_0x469d7f){try{jsonpatch[_0x617b('0x29')](_0x469d7f,_0x262253,!![]);}catch(_0x11f40f){return BPromise[_0x617b('0x2a')](_0x11f40f);}return _0x469d7f[_0x617b('0x2b')]();};}function saveUpdates(_0xf8d7ab,_0x503d03){return function(_0x2fc367){if(_0x2fc367){return _0x2fc367[_0x617b('0x2c')](_0xf8d7ab)[_0x617b('0x18')](function(_0x94f206){return _0x94f206;});}return null;};}function removeEntity(_0x2c4941,_0x185b70){return function(_0x46e8ba){if(_0x46e8ba){return _0x46e8ba[_0x617b('0x2d')]()[_0x617b('0x18')](function(){_0x2c4941[_0x617b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a0cc,_0xc1d7f0){return function(_0x540f95){if(!_0x540f95){_0x7a0cc[_0x617b('0x2e')](0x194);}return _0x540f95;};}function handleError(_0x2ad51c,_0x1bb840){_0x1bb840=_0x1bb840||0x1f4;return function(_0x3d98b5){logger[_0x617b('0x1d')](_0x3d98b5[_0x617b('0x2f')]);if(_0x3d98b5[_0x617b('0x30')]){delete _0x3d98b5[_0x617b('0x30')];}_0x2ad51c[_0x617b('0x22')](_0x1bb840)[_0x617b('0x31')](_0x3d98b5);};}exports[_0x617b('0x32')]=function(_0x2b35b9,_0x9fd5e){var _0x2af8fa={},_0x11dedd={},_0x20d5fd={'count':0x0,'rows':[]};var _0x19ef5e=_[_0x617b('0x33')](db['VtigerConfiguration']['rawAttributes'],function(_0x25054b){return{'name':_0x25054b['fieldName'],'type':_0x25054b[_0x617b('0x34')][_0x617b('0x35')]};});_0x11dedd[_0x617b('0x36')]=_[_0x617b('0x33')](_0x19ef5e,_0x617b('0x30'));_0x11dedd[_0x617b('0x37')]=_[_0x617b('0x38')](_0x2b35b9[_0x617b('0x37')]);_0x11dedd[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x11dedd[_0x617b('0x36')],_0x11dedd[_0x617b('0x37')]);_0x2af8fa[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x11dedd[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x3c')]));_0x2af8fa[_0x617b('0x3b')]=_0x2af8fa['attributes'][_0x617b('0x3d')]?_0x2af8fa['attributes']:_0x11dedd[_0x617b('0x36')];if(!_0x2b35b9[_0x617b('0x37')]['hasOwnProperty'](_0x617b('0x3e'))){_0x2af8fa['limit']=qs[_0x617b('0x26')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x26')]);_0x2af8fa[_0x617b('0x25')]=qs[_0x617b('0x25')](_0x2b35b9[_0x617b('0x37')][_0x617b('0x25')]);}_0x2af8fa[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x2b35b9[_0x617b('0x37')]['sort']);_0x2af8fa['where']=qs[_0x617b('0x39')](_['pick'](_0x2b35b9[_0x617b('0x37')],_0x11dedd[_0x617b('0x39')]),_0x19ef5e);if(_0x2b35b9[_0x617b('0x37')][_0x617b('0x41')]){_0x2af8fa['where']=_[_0x617b('0x42')](_0x2af8fa[_0x617b('0x43')],{'$or':_['map'](_0x19ef5e,function(_0x4199dd){if(_0x4199dd[_0x617b('0x34')]!==_0x617b('0x44')){var _0xcfa5ef={};_0xcfa5ef[_0x4199dd[_0x617b('0x30')]]={'$like':'%'+_0x2b35b9[_0x617b('0x37')][_0x617b('0x41')]+'%'};return _0xcfa5ef;}})});}_0x2af8fa=_[_0x617b('0x42')]({},_0x2af8fa,_0x2b35b9['options']);var _0x433cdf={'where':_0x2af8fa[_0x617b('0x43')]};return db[_0x617b('0x45')][_0x617b('0x24')](_0x433cdf)[_0x617b('0x18')](function(_0xaef51){_0x20d5fd[_0x617b('0x24')]=_0xaef51;if(_0x2b35b9['query']['includeAll']){_0x2af8fa[_0x617b('0x46')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x617b('0x47')](_0x2af8fa);})['then'](function(_0x7ee064){_0x20d5fd[_0x617b('0x48')]=_0x7ee064;return _0x20d5fd;})[_0x617b('0x18')](respondWithFilteredResult(_0x9fd5e,_0x2af8fa))[_0x617b('0x21')](handleError(_0x9fd5e,null));};exports[_0x617b('0x49')]=function(_0x4d3360,_0x4ee4d7){var _0x151eb8={'raw':![],'where':{'id':_0x4d3360[_0x617b('0x4a')]['id']}},_0x5c7713={};_0x5c7713[_0x617b('0x36')]=_[_0x617b('0x38')](db[_0x617b('0x45')][_0x617b('0x4b')]);_0x5c7713['query']=_[_0x617b('0x38')](_0x4d3360['query']);_0x5c7713[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x5c7713[_0x617b('0x36')],_0x5c7713['query']);_0x151eb8[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x5c7713[_0x617b('0x36')],qs['fields'](_0x4d3360[_0x617b('0x37')][_0x617b('0x3c')]));_0x151eb8['attributes']=_0x151eb8[_0x617b('0x3b')][_0x617b('0x3d')]?_0x151eb8[_0x617b('0x3b')]:_0x5c7713[_0x617b('0x36')];if(_0x4d3360['query']['includeAll']){_0x151eb8[_0x617b('0x46')]=[{'all':!![]}];}_0x151eb8=_['merge']({},_0x151eb8,_0x4d3360['options']);return db[_0x617b('0x45')]['find'](_0x151eb8)[_0x617b('0x18')](handleEntityNotFound(_0x4ee4d7,null))[_0x617b('0x18')](respondWithResult(_0x4ee4d7,null))[_0x617b('0x21')](handleError(_0x4ee4d7,null));};exports[_0x617b('0x4c')]=function(_0x5e76ee,_0x4116ce){return db[_0x617b('0x45')][_0x617b('0x4c')](_0x5e76ee['body'],{})[_0x617b('0x18')](respondWithResult(_0x4116ce,0xc9))[_0x617b('0x21')](handleError(_0x4116ce,null));};exports[_0x617b('0x2c')]=function(_0x1a71a3,_0x5f49dd){if(_0x1a71a3['body']['id']){delete _0x1a71a3[_0x617b('0x4d')]['id'];}return db[_0x617b('0x45')]['find']({'where':{'id':_0x1a71a3[_0x617b('0x4a')]['id']}})[_0x617b('0x18')](handleEntityNotFound(_0x5f49dd,null))[_0x617b('0x18')](saveUpdates(_0x1a71a3[_0x617b('0x4d')],null))[_0x617b('0x18')](respondWithResult(_0x5f49dd,null))[_0x617b('0x21')](handleError(_0x5f49dd,null));};exports['destroy']=function(_0x40c6c1,_0x4e4934){return db['VtigerConfiguration']['find']({'where':{'id':_0x40c6c1['params']['id']}})['then'](handleEntityNotFound(_0x4e4934,null))[_0x617b('0x18')](removeEntity(_0x4e4934,null))[_0x617b('0x21')](handleError(_0x4e4934,null));};exports['getFields']=function(_0x2b6658,_0x3ed728,_0x43f0bc){var _0x4d0a8a={};var _0x71f7f4={};var _0x43fcaf;var _0x40c82a;return db[_0x617b('0x45')][_0x617b('0x4e')]({'where':{'id':_0x2b6658[_0x617b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ed728,null))[_0x617b('0x18')](function(_0x480e78){if(_0x480e78){_0x43fcaf=_0x480e78;_0x71f7f4[_0x617b('0x36')]=_['keys'](db[_0x617b('0x4f')][_0x617b('0x4b')]);_0x71f7f4['query']=_[_0x617b('0x38')](_0x2b6658['query']);_0x71f7f4[_0x617b('0x39')]=_['intersection'](_0x71f7f4[_0x617b('0x36')],_0x71f7f4[_0x617b('0x37')]);_0x4d0a8a[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x71f7f4['model'],qs[_0x617b('0x3c')](_0x2b6658[_0x617b('0x37')][_0x617b('0x3c')]));_0x4d0a8a[_0x617b('0x3b')]=_0x4d0a8a[_0x617b('0x3b')][_0x617b('0x3d')]?_0x4d0a8a['attributes']:_0x71f7f4[_0x617b('0x36')];_0x4d0a8a[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x2b6658[_0x617b('0x37')][_0x617b('0x40')]);_0x4d0a8a[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x2b6658['query'],_0x71f7f4['filters']));if(_0x2b6658['query'][_0x617b('0x41')]){_0x4d0a8a['where']=_['merge'](_0x4d0a8a[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x4d0a8a[_0x617b('0x3b')],function(_0xe94d68){var _0x18b0cc={};_0x18b0cc[_0xe94d68]={'$like':'%'+_0x2b6658[_0x617b('0x37')]['filter']+'%'};return _0x18b0cc;})});}_0x4d0a8a=_[_0x617b('0x42')]({},_0x4d0a8a,_0x2b6658['options']);return _0x43fcaf[_0x617b('0x50')](_0x4d0a8a);}})[_0x617b('0x18')](function(_0x52b84f){if(_0x52b84f){_0x40c82a=_0x52b84f['length'];if(!_0x2b6658[_0x617b('0x37')][_0x617b('0x51')]('nolimit')){_0x4d0a8a['limit']=qs['limit'](_0x2b6658[_0x617b('0x37')][_0x617b('0x26')]);_0x4d0a8a[_0x617b('0x25')]=qs['offset'](_0x2b6658[_0x617b('0x37')]['offset']);}return _0x43fcaf[_0x617b('0x50')](_0x4d0a8a);}})['then'](function(_0x1461a9){if(_0x1461a9){return _0x1461a9?{'count':_0x40c82a,'rows':_0x1461a9}:null;}})[_0x617b('0x18')](respondWithResult(_0x3ed728,null))[_0x617b('0x21')](handleError(_0x3ed728,null));};exports[_0x617b('0x52')]=function(_0x291279,_0x248b4a,_0x20e3df){var _0x2b411e={};var _0xeb18de={};var _0x2cc756;var _0x1f6b12;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x291279[_0x617b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x248b4a,null))[_0x617b('0x18')](function(_0x23c4e2){if(_0x23c4e2){_0x2cc756=_0x23c4e2;_0xeb18de[_0x617b('0x36')]=_['keys'](db['VtigerField']['rawAttributes']);_0xeb18de['query']=_[_0x617b('0x38')](_0x291279[_0x617b('0x37')]);_0xeb18de['filters']=_[_0x617b('0x3a')](_0xeb18de[_0x617b('0x36')],_0xeb18de[_0x617b('0x37')]);_0x2b411e['attributes']=_[_0x617b('0x3a')](_0xeb18de[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x291279['query'][_0x617b('0x3c')]));_0x2b411e[_0x617b('0x3b')]=_0x2b411e[_0x617b('0x3b')][_0x617b('0x3d')]?_0x2b411e[_0x617b('0x3b')]:_0xeb18de[_0x617b('0x36')];_0x2b411e[_0x617b('0x3f')]=qs['sort'](_0x291279[_0x617b('0x37')]['sort']);_0x2b411e[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x291279[_0x617b('0x37')],_0xeb18de[_0x617b('0x39')]));if(_0x291279[_0x617b('0x37')][_0x617b('0x41')]){_0x2b411e[_0x617b('0x43')]=_[_0x617b('0x42')](_0x2b411e[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x2b411e[_0x617b('0x3b')],function(_0x4dd9df){var _0x50506f={};_0x50506f[_0x4dd9df]={'$like':'%'+_0x291279[_0x617b('0x37')]['filter']+'%'};return _0x50506f;})});}_0x2b411e=_[_0x617b('0x42')]({},_0x2b411e,_0x291279[_0x617b('0x53')]);return _0x2cc756[_0x617b('0x52')](_0x2b411e);}})[_0x617b('0x18')](function(_0x39d867){if(_0x39d867){_0x1f6b12=_0x39d867[_0x617b('0x3d')];if(!_0x291279[_0x617b('0x37')][_0x617b('0x51')](_0x617b('0x3e'))){_0x2b411e[_0x617b('0x26')]=qs[_0x617b('0x26')](_0x291279[_0x617b('0x37')][_0x617b('0x26')]);_0x2b411e[_0x617b('0x25')]=qs[_0x617b('0x25')](_0x291279['query']['offset']);}return _0x2cc756[_0x617b('0x52')](_0x2b411e);}})[_0x617b('0x18')](function(_0x33938d){if(_0x33938d){return _0x33938d?{'count':_0x1f6b12,'rows':_0x33938d}:null;}})[_0x617b('0x18')](respondWithResult(_0x248b4a,null))[_0x617b('0x21')](handleError(_0x248b4a,null));};exports['getDescriptions']=function(_0x3d2099,_0x44b800,_0x3ba9c6){var _0x4a1581={};var _0x4c6da8={};var _0x34a759;var _0xea071;return db[_0x617b('0x45')][_0x617b('0x4e')]({'where':{'id':_0x3d2099['params']['id']}})[_0x617b('0x18')](handleEntityNotFound(_0x44b800,null))[_0x617b('0x18')](function(_0x293ec5){if(_0x293ec5){_0x34a759=_0x293ec5;_0x4c6da8[_0x617b('0x36')]=_['keys'](db[_0x617b('0x4f')][_0x617b('0x4b')]);_0x4c6da8[_0x617b('0x37')]=_[_0x617b('0x38')](_0x3d2099['query']);_0x4c6da8[_0x617b('0x39')]=_[_0x617b('0x3a')](_0x4c6da8[_0x617b('0x36')],_0x4c6da8['query']);_0x4a1581[_0x617b('0x3b')]=_[_0x617b('0x3a')](_0x4c6da8[_0x617b('0x36')],qs[_0x617b('0x3c')](_0x3d2099[_0x617b('0x37')][_0x617b('0x3c')]));_0x4a1581['attributes']=_0x4a1581[_0x617b('0x3b')][_0x617b('0x3d')]?_0x4a1581[_0x617b('0x3b')]:_0x4c6da8['model'];_0x4a1581[_0x617b('0x3f')]=qs[_0x617b('0x40')](_0x3d2099[_0x617b('0x37')][_0x617b('0x40')]);_0x4a1581[_0x617b('0x43')]=qs[_0x617b('0x39')](_['pick'](_0x3d2099[_0x617b('0x37')],_0x4c6da8['filters']));if(_0x3d2099[_0x617b('0x37')]['filter']){_0x4a1581[_0x617b('0x43')]=_[_0x617b('0x42')](_0x4a1581[_0x617b('0x43')],{'$or':_[_0x617b('0x33')](_0x4a1581['attributes'],function(_0x383742){var _0x3f4087={};_0x3f4087[_0x383742]={'$like':'%'+_0x3d2099['query'][_0x617b('0x41')]+'%'};return _0x3f4087;})});}_0x4a1581=_['merge']({},_0x4a1581,_0x3d2099['options']);return _0x34a759[_0x617b('0x54')](_0x4a1581);}})[_0x617b('0x18')](function(_0x2310e7){if(_0x2310e7){_0xea071=_0x2310e7[_0x617b('0x3d')];if(!_0x3d2099[_0x617b('0x37')][_0x617b('0x51')](_0x617b('0x3e'))){_0x4a1581['limit']=qs[_0x617b('0x26')](_0x3d2099[_0x617b('0x37')][_0x617b('0x26')]);_0x4a1581['offset']=qs[_0x617b('0x25')](_0x3d2099[_0x617b('0x37')]['offset']);}return _0x34a759[_0x617b('0x54')](_0x4a1581);}})[_0x617b('0x18')](function(_0x3c7cd3){if(_0x3c7cd3){return _0x3c7cd3?{'count':_0xea071,'rows':_0x3c7cd3}:null;}})[_0x617b('0x18')](respondWithResult(_0x44b800,null))[_0x617b('0x21')](handleError(_0x44b800,null));}; \ No newline at end of file +var _0x565c=['length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','include','rows','params','intersection','includeAll','create','body','find','getFields','findOne','VtigerField','order','sort','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x30b7d7,_0x597481){var _0x541557=function(_0x50f3e1){while(--_0x50f3e1){_0x30b7d7['push'](_0x30b7d7['shift']());}};_0x541557(++_0x597481);}(_0x565c,0x73));var _0xc565=function(_0x4f2c13,_0x1b3e0f){_0x4f2c13=_0x4f2c13-0x0;var _0x3b4a02=_0x565c[_0x4f2c13];return _0x3b4a02;};'use strict';var pdf=require(_0xc565('0x0'));var emlformat=require(_0xc565('0x1'));var rimraf=require(_0xc565('0x2'));var zipdir=require(_0xc565('0x3'));var jsonpatch=require(_0xc565('0x4'));var rp=require(_0xc565('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc565('0x6'));var path=require(_0xc565('0x7'));var sox=require(_0xc565('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc565('0x9'));var squel=require('squel');var crypto=require(_0xc565('0xa'));var jsforce=require(_0xc565('0xb'));var deskjs=require(_0xc565('0xc'));var toCsv=require(_0xc565('0xd'));var querystring=require(_0xc565('0xe'));var Papa=require(_0xc565('0xf'));var Redis=require('ioredis');var authService=require(_0xc565('0x10'));var qs=require(_0xc565('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc565('0x12'));var logger=require(_0xc565('0x13'))(_0xc565('0x14'));var utils=require(_0xc565('0x15'));var config=require(_0xc565('0x16'));var db=require(_0xc565('0x17'))['db'];var jayson=require(_0xc565('0x18'));var client=jayson[_0xc565('0x19')][_0xc565('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x54d900,_0x55ad6a,_0x505279){if(_0x505279){var _0x514495=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x514495[_0xc565('0x1b')](_0x55ad6a)){return _0x54d900;}else{throw new db[(_0xc565('0x1c'))]['ValidationError'](_0xc565('0x1d'));}}else{return _0x54d900;}}function respondWithRpcPromise(_0x3069bb,_0x297d35,_0x200ebb,_0x66c6cb){return new BPromise(function(_0x11d3f1,_0x29c1c1){var _0x4712d6=_0x66c6cb||client;return _0x4712d6[_0xc565('0x1e')](_0x3069bb,_0x200ebb)[_0xc565('0x1f')](function(_0x1de92c){logger[_0xc565('0x20')](_0xc565('0x21'),_0x297d35,_0xc565('0x22'));logger[_0xc565('0x23')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x297d35,'request\x20sent',JSON[_0xc565('0x24')](_0x1de92c));if(_0x1de92c[_0xc565('0x25')]){if(_0x1de92c[_0xc565('0x25')][_0xc565('0x26')]===0x1f4){logger['error'](_0xc565('0x21'),_0x297d35,_0x1de92c[_0xc565('0x25')][_0xc565('0x27')]);return _0x29c1c1(_0x1de92c[_0xc565('0x25')]['message']);}logger[_0xc565('0x25')](_0xc565('0x21'),_0x297d35,_0x1de92c[_0xc565('0x25')][_0xc565('0x27')]);return _0x11d3f1(_0x1de92c[_0xc565('0x25')][_0xc565('0x27')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x297d35,_0xc565('0x22'));_0x11d3f1(_0x1de92c[_0xc565('0x28')][_0xc565('0x27')]);}})[_0xc565('0x29')](function(_0x403811){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x297d35,_0x403811);_0x29c1c1(_0x403811);});});}function respondWithStatusCode(_0x2d3961,_0x285b03){_0x285b03=_0x285b03||0xcc;return function(_0x1081cb){if(_0x1081cb){return _0x2d3961['sendStatus'](_0x285b03);}return _0x2d3961[_0xc565('0x2a')](_0x285b03)[_0xc565('0x2b')]();};}function respondWithResult(_0x39c49d,_0x205553){_0x205553=_0x205553||0xc8;return function(_0x175d05){if(_0x175d05){return _0x39c49d['status'](_0x205553)[_0xc565('0x2c')](_0x175d05);}};}function respondWithFilteredResult(_0x509e8b,_0xf4272c){return function(_0x512d68){if(_0x512d68){var _0x2149ee=_0x512d68[_0xc565('0x2d')],_0x348746=_0xf4272c[_0xc565('0x2e')],_0x3a19ef=_0xf4272c[_0xc565('0x2e')]+_0xf4272c['limit'],_0xd8ea12;if(_0x3a19ef>=_0x2149ee){_0x3a19ef=_0x2149ee;_0xd8ea12=0xc8;}else{_0xd8ea12=0xce;}_0x509e8b[_0xc565('0x2a')](_0xd8ea12);return _0x509e8b[_0xc565('0x2f')](_0xc565('0x30'),_0x348746+'-'+_0x3a19ef+'/'+_0x2149ee)[_0xc565('0x2c')](_0x512d68);}return null;};}function patchUpdates(_0x2f8671){return function(_0x270b63){try{jsonpatch[_0xc565('0x31')](_0x270b63,_0x2f8671,!![]);}catch(_0x3dc129){return BPromise['reject'](_0x3dc129);}return _0x270b63['save']();};}function saveUpdates(_0xbb1cb2,_0x382f3d){return function(_0x5eed82){if(_0x5eed82){return _0x5eed82[_0xc565('0x32')](_0xbb1cb2)[_0xc565('0x1f')](function(_0x246710){return _0x246710;});}return null;};}function removeEntity(_0x270615,_0x10598d){return function(_0xff79b){if(_0xff79b){return _0xff79b[_0xc565('0x33')]()['then'](function(){_0x270615[_0xc565('0x2a')](0xcc)[_0xc565('0x2b')]();});}};}function handleEntityNotFound(_0x10794f,_0x58e6d1){return function(_0x118200){if(!_0x118200){_0x10794f['sendStatus'](0x194);}return _0x118200;};}function handleError(_0x4d8097,_0x5ea4ce){_0x5ea4ce=_0x5ea4ce||0x1f4;return function(_0x3fc61c){logger[_0xc565('0x25')](_0x3fc61c[_0xc565('0x34')]);if(_0x3fc61c[_0xc565('0x35')]){delete _0x3fc61c[_0xc565('0x35')];}_0x4d8097[_0xc565('0x2a')](_0x5ea4ce)[_0xc565('0x36')](_0x3fc61c);};}exports[_0xc565('0x37')]=function(_0x40a421,_0x57cb5e){var _0x5a88b8={},_0x2c5fbd={},_0x4254c1={'count':0x0,'rows':[]};var _0x3f6536=_[_0xc565('0x38')](db[_0xc565('0x39')][_0xc565('0x3a')],function(_0x54357a){return{'name':_0x54357a['fieldName'],'type':_0x54357a[_0xc565('0x3b')][_0xc565('0x3c')]};});_0x2c5fbd[_0xc565('0x3d')]=_[_0xc565('0x38')](_0x3f6536,_0xc565('0x35'));_0x2c5fbd[_0xc565('0x3e')]=_[_0xc565('0x3f')](_0x40a421['query']);_0x2c5fbd[_0xc565('0x40')]=_['intersection'](_0x2c5fbd[_0xc565('0x3d')],_0x2c5fbd[_0xc565('0x3e')]);_0x5a88b8[_0xc565('0x41')]=_['intersection'](_0x2c5fbd['model'],qs[_0xc565('0x42')](_0x40a421[_0xc565('0x3e')][_0xc565('0x42')]));_0x5a88b8[_0xc565('0x41')]=_0x5a88b8[_0xc565('0x41')][_0xc565('0x43')]?_0x5a88b8[_0xc565('0x41')]:_0x2c5fbd[_0xc565('0x3d')];if(!_0x40a421['query'][_0xc565('0x44')](_0xc565('0x45'))){_0x5a88b8[_0xc565('0x46')]=qs[_0xc565('0x46')](_0x40a421[_0xc565('0x3e')][_0xc565('0x46')]);_0x5a88b8[_0xc565('0x2e')]=qs['offset'](_0x40a421[_0xc565('0x3e')][_0xc565('0x2e')]);}_0x5a88b8['order']=qs['sort'](_0x40a421[_0xc565('0x3e')]['sort']);_0x5a88b8[_0xc565('0x47')]=qs[_0xc565('0x40')](_[_0xc565('0x48')](_0x40a421[_0xc565('0x3e')],_0x2c5fbd[_0xc565('0x40')]),_0x3f6536);if(_0x40a421[_0xc565('0x3e')][_0xc565('0x49')]){_0x5a88b8['where']=_['merge'](_0x5a88b8[_0xc565('0x47')],{'$or':_[_0xc565('0x38')](_0x3f6536,function(_0x2e3838){if(_0x2e3838[_0xc565('0x3b')]!=='VIRTUAL'){var _0x2a8129={};_0x2a8129[_0x2e3838[_0xc565('0x35')]]={'$like':'%'+_0x40a421[_0xc565('0x3e')][_0xc565('0x49')]+'%'};return _0x2a8129;}})});}_0x5a88b8=_[_0xc565('0x4a')]({},_0x5a88b8,_0x40a421[_0xc565('0x4b')]);var _0x376730={'where':_0x5a88b8['where']};return db[_0xc565('0x39')][_0xc565('0x2d')](_0x376730)[_0xc565('0x1f')](function(_0x30290c){_0x4254c1[_0xc565('0x2d')]=_0x30290c;if(_0x40a421['query']['includeAll']){_0x5a88b8[_0xc565('0x4c')]=[{'all':!![]}];}return db[_0xc565('0x39')]['findAll'](_0x5a88b8);})[_0xc565('0x1f')](function(_0x20d08d){_0x4254c1[_0xc565('0x4d')]=_0x20d08d;return _0x4254c1;})[_0xc565('0x1f')](respondWithFilteredResult(_0x57cb5e,_0x5a88b8))[_0xc565('0x29')](handleError(_0x57cb5e,null));};exports['show']=function(_0x5672d7,_0x42b435){var _0x296816={'raw':![],'where':{'id':_0x5672d7[_0xc565('0x4e')]['id']}},_0x50419c={};_0x50419c[_0xc565('0x3d')]=_[_0xc565('0x3f')](db[_0xc565('0x39')][_0xc565('0x3a')]);_0x50419c[_0xc565('0x3e')]=_[_0xc565('0x3f')](_0x5672d7[_0xc565('0x3e')]);_0x50419c['filters']=_[_0xc565('0x4f')](_0x50419c['model'],_0x50419c['query']);_0x296816[_0xc565('0x41')]=_[_0xc565('0x4f')](_0x50419c[_0xc565('0x3d')],qs['fields'](_0x5672d7[_0xc565('0x3e')][_0xc565('0x42')]));_0x296816['attributes']=_0x296816[_0xc565('0x41')][_0xc565('0x43')]?_0x296816[_0xc565('0x41')]:_0x50419c['model'];if(_0x5672d7[_0xc565('0x3e')][_0xc565('0x50')]){_0x296816['include']=[{'all':!![]}];}_0x296816=_[_0xc565('0x4a')]({},_0x296816,_0x5672d7[_0xc565('0x4b')]);return db[_0xc565('0x39')]['find'](_0x296816)[_0xc565('0x1f')](handleEntityNotFound(_0x42b435,null))[_0xc565('0x1f')](respondWithResult(_0x42b435,null))[_0xc565('0x29')](handleError(_0x42b435,null));};exports[_0xc565('0x51')]=function(_0x3505b5,_0x13d28c){return db['VtigerConfiguration'][_0xc565('0x51')](_0x3505b5[_0xc565('0x52')],{})[_0xc565('0x1f')](respondWithResult(_0x13d28c,0xc9))[_0xc565('0x29')](handleError(_0x13d28c,null));};exports[_0xc565('0x32')]=function(_0xde53f6,_0x8cff48){if(_0xde53f6[_0xc565('0x52')]['id']){delete _0xde53f6[_0xc565('0x52')]['id'];}return db[_0xc565('0x39')][_0xc565('0x53')]({'where':{'id':_0xde53f6['params']['id']}})[_0xc565('0x1f')](handleEntityNotFound(_0x8cff48,null))[_0xc565('0x1f')](saveUpdates(_0xde53f6[_0xc565('0x52')],null))[_0xc565('0x1f')](respondWithResult(_0x8cff48,null))[_0xc565('0x29')](handleError(_0x8cff48,null));};exports['destroy']=function(_0x39cbca,_0x31250c){return db['VtigerConfiguration'][_0xc565('0x53')]({'where':{'id':_0x39cbca[_0xc565('0x4e')]['id']}})[_0xc565('0x1f')](handleEntityNotFound(_0x31250c,null))['then'](removeEntity(_0x31250c,null))['catch'](handleError(_0x31250c,null));};exports[_0xc565('0x54')]=function(_0x452188,_0x3124f4,_0x51a99b){var _0x48b3d0={};var _0x20682e={};var _0x107986;var _0x12d6f7;return db[_0xc565('0x39')][_0xc565('0x55')]({'where':{'id':_0x452188[_0xc565('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3124f4,null))['then'](function(_0x202a1d){if(_0x202a1d){_0x107986=_0x202a1d;_0x20682e[_0xc565('0x3d')]=_[_0xc565('0x3f')](db[_0xc565('0x56')][_0xc565('0x3a')]);_0x20682e[_0xc565('0x3e')]=_[_0xc565('0x3f')](_0x452188[_0xc565('0x3e')]);_0x20682e['filters']=_[_0xc565('0x4f')](_0x20682e['model'],_0x20682e[_0xc565('0x3e')]);_0x48b3d0[_0xc565('0x41')]=_[_0xc565('0x4f')](_0x20682e['model'],qs[_0xc565('0x42')](_0x452188[_0xc565('0x3e')][_0xc565('0x42')]));_0x48b3d0[_0xc565('0x41')]=_0x48b3d0[_0xc565('0x41')][_0xc565('0x43')]?_0x48b3d0[_0xc565('0x41')]:_0x20682e[_0xc565('0x3d')];_0x48b3d0[_0xc565('0x57')]=qs[_0xc565('0x58')](_0x452188[_0xc565('0x3e')][_0xc565('0x58')]);_0x48b3d0['where']=qs[_0xc565('0x40')](_['pick'](_0x452188[_0xc565('0x3e')],_0x20682e[_0xc565('0x40')]));if(_0x452188['query']['filter']){_0x48b3d0['where']=_[_0xc565('0x4a')](_0x48b3d0[_0xc565('0x47')],{'$or':_[_0xc565('0x38')](_0x48b3d0[_0xc565('0x41')],function(_0x4489a3){var _0x564408={};_0x564408[_0x4489a3]={'$like':'%'+_0x452188[_0xc565('0x3e')][_0xc565('0x49')]+'%'};return _0x564408;})});}_0x48b3d0=_[_0xc565('0x4a')]({},_0x48b3d0,_0x452188['options']);return _0x107986[_0xc565('0x54')](_0x48b3d0);}})[_0xc565('0x1f')](function(_0xb31432){if(_0xb31432){_0x12d6f7=_0xb31432[_0xc565('0x43')];if(!_0x452188['query'][_0xc565('0x44')]('nolimit')){_0x48b3d0['limit']=qs['limit'](_0x452188[_0xc565('0x3e')]['limit']);_0x48b3d0[_0xc565('0x2e')]=qs[_0xc565('0x2e')](_0x452188[_0xc565('0x3e')][_0xc565('0x2e')]);}return _0x107986[_0xc565('0x54')](_0x48b3d0);}})[_0xc565('0x1f')](function(_0x35fd00){if(_0x35fd00){return _0x35fd00?{'count':_0x12d6f7,'rows':_0x35fd00}:null;}})[_0xc565('0x1f')](respondWithResult(_0x3124f4,null))[_0xc565('0x29')](handleError(_0x3124f4,null));};exports[_0xc565('0x59')]=function(_0x4c5bdc,_0x1306d8,_0x1ea1c8){var _0x107237={};var _0x287f50={};var _0x5c5b7c;var _0x436a9b;return db[_0xc565('0x39')]['findOne']({'where':{'id':_0x4c5bdc[_0xc565('0x4e')]['id']}})[_0xc565('0x1f')](handleEntityNotFound(_0x1306d8,null))[_0xc565('0x1f')](function(_0x29a97c){if(_0x29a97c){_0x5c5b7c=_0x29a97c;_0x287f50[_0xc565('0x3d')]=_[_0xc565('0x3f')](db['VtigerField'][_0xc565('0x3a')]);_0x287f50[_0xc565('0x3e')]=_[_0xc565('0x3f')](_0x4c5bdc[_0xc565('0x3e')]);_0x287f50[_0xc565('0x40')]=_['intersection'](_0x287f50[_0xc565('0x3d')],_0x287f50['query']);_0x107237['attributes']=_['intersection'](_0x287f50['model'],qs['fields'](_0x4c5bdc['query']['fields']));_0x107237['attributes']=_0x107237[_0xc565('0x41')][_0xc565('0x43')]?_0x107237[_0xc565('0x41')]:_0x287f50[_0xc565('0x3d')];_0x107237[_0xc565('0x57')]=qs[_0xc565('0x58')](_0x4c5bdc[_0xc565('0x3e')][_0xc565('0x58')]);_0x107237[_0xc565('0x47')]=qs[_0xc565('0x40')](_[_0xc565('0x48')](_0x4c5bdc[_0xc565('0x3e')],_0x287f50[_0xc565('0x40')]));if(_0x4c5bdc['query'][_0xc565('0x49')]){_0x107237[_0xc565('0x47')]=_['merge'](_0x107237[_0xc565('0x47')],{'$or':_[_0xc565('0x38')](_0x107237[_0xc565('0x41')],function(_0x5e8b12){var _0x8dff3e={};_0x8dff3e[_0x5e8b12]={'$like':'%'+_0x4c5bdc[_0xc565('0x3e')]['filter']+'%'};return _0x8dff3e;})});}_0x107237=_['merge']({},_0x107237,_0x4c5bdc[_0xc565('0x4b')]);return _0x5c5b7c[_0xc565('0x59')](_0x107237);}})['then'](function(_0x1e255b){if(_0x1e255b){_0x436a9b=_0x1e255b[_0xc565('0x43')];if(!_0x4c5bdc[_0xc565('0x3e')]['hasOwnProperty'](_0xc565('0x45'))){_0x107237[_0xc565('0x46')]=qs[_0xc565('0x46')](_0x4c5bdc[_0xc565('0x3e')][_0xc565('0x46')]);_0x107237[_0xc565('0x2e')]=qs['offset'](_0x4c5bdc['query'][_0xc565('0x2e')]);}return _0x5c5b7c[_0xc565('0x59')](_0x107237);}})[_0xc565('0x1f')](function(_0x25a42c){if(_0x25a42c){return _0x25a42c?{'count':_0x436a9b,'rows':_0x25a42c}:null;}})[_0xc565('0x1f')](respondWithResult(_0x1306d8,null))[_0xc565('0x29')](handleError(_0x1306d8,null));};exports['getDescriptions']=function(_0x519e44,_0x194202,_0x302a92){var _0x3b506e={};var _0x29c7ab={};var _0x362d82;var _0x478d12;return db[_0xc565('0x39')][_0xc565('0x55')]({'where':{'id':_0x519e44[_0xc565('0x4e')]['id']}})[_0xc565('0x1f')](handleEntityNotFound(_0x194202,null))['then'](function(_0x268bac){if(_0x268bac){_0x362d82=_0x268bac;_0x29c7ab['model']=_[_0xc565('0x3f')](db[_0xc565('0x56')]['rawAttributes']);_0x29c7ab[_0xc565('0x3e')]=_[_0xc565('0x3f')](_0x519e44[_0xc565('0x3e')]);_0x29c7ab[_0xc565('0x40')]=_[_0xc565('0x4f')](_0x29c7ab['model'],_0x29c7ab[_0xc565('0x3e')]);_0x3b506e['attributes']=_[_0xc565('0x4f')](_0x29c7ab['model'],qs['fields'](_0x519e44[_0xc565('0x3e')][_0xc565('0x42')]));_0x3b506e[_0xc565('0x41')]=_0x3b506e[_0xc565('0x41')]['length']?_0x3b506e[_0xc565('0x41')]:_0x29c7ab['model'];_0x3b506e[_0xc565('0x57')]=qs['sort'](_0x519e44[_0xc565('0x3e')][_0xc565('0x58')]);_0x3b506e[_0xc565('0x47')]=qs[_0xc565('0x40')](_[_0xc565('0x48')](_0x519e44['query'],_0x29c7ab['filters']));if(_0x519e44[_0xc565('0x3e')]['filter']){_0x3b506e[_0xc565('0x47')]=_[_0xc565('0x4a')](_0x3b506e['where'],{'$or':_[_0xc565('0x38')](_0x3b506e[_0xc565('0x41')],function(_0x2cd393){var _0x3994a7={};_0x3994a7[_0x2cd393]={'$like':'%'+_0x519e44[_0xc565('0x3e')][_0xc565('0x49')]+'%'};return _0x3994a7;})});}_0x3b506e=_[_0xc565('0x4a')]({},_0x3b506e,_0x519e44[_0xc565('0x4b')]);return _0x362d82['getDescriptions'](_0x3b506e);}})[_0xc565('0x1f')](function(_0x234a51){if(_0x234a51){_0x478d12=_0x234a51['length'];if(!_0x519e44[_0xc565('0x3e')][_0xc565('0x44')](_0xc565('0x45'))){_0x3b506e[_0xc565('0x46')]=qs[_0xc565('0x46')](_0x519e44[_0xc565('0x3e')][_0xc565('0x46')]);_0x3b506e[_0xc565('0x2e')]=qs[_0xc565('0x2e')](_0x519e44[_0xc565('0x3e')][_0xc565('0x2e')]);}return _0x362d82[_0xc565('0x5a')](_0x3b506e);}})[_0xc565('0x1f')](function(_0xc259b4){if(_0xc259b4){return _0xc259b4?{'count':_0x478d12,'rows':_0xc259b4}:null;}})[_0xc565('0x1f')](respondWithResult(_0x194202,null))[_0xc565('0x29')](handleError(_0x194202,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d4af0db..4cefdc1 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 _0xd267=['bluebird','path','rimraf','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xd267,0x13f));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require(_0x7d26('0x1'));var logger=require(_0x7d26('0x2'))(_0x7d26('0x3'));var moment=require(_0x7d26('0x4'));var BPromise=require(_0x7d26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d26('0x6'));var rimraf=require(_0x7d26('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d26('0x8'));module[_0x7d26('0x9')]=function(_0x5ad880,_0x1cb931){return _0x5ad880['define'](_0x7d26('0xa'),attributes,{'tableName':_0x7d26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c8c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','lodash','util','../../config/logger','api'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x1c8c,0x98));var _0xc1c8=function(_0x57950a,_0x2961aa){_0x57950a=_0x57950a-0x0;var _0x12fd16=_0x1c8c[_0x57950a];return _0x12fd16;};'use strict';var _=require(_0xc1c8('0x0'));var util=require(_0xc1c8('0x1'));var logger=require(_0xc1c8('0x2'))(_0xc1c8('0x3'));var moment=require(_0xc1c8('0x4'));var BPromise=require(_0xc1c8('0x5'));var rp=require(_0xc1c8('0x6'));var fs=require('fs');var path=require(_0xc1c8('0x7'));var rimraf=require(_0xc1c8('0x8'));var config=require(_0xc1c8('0x9'));var attributes=require(_0xc1c8('0xa'));module['exports']=function(_0x1feb19,_0x11b814){return _0x1feb19['define'](_0xc1c8('0xb'),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 708d88d..d10df21 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 _0xded1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','moment','bluebird','randomstring'];(function(_0x3199ea,_0x4d36e5){var _0x41abc4=function(_0x1da2e8){while(--_0x1da2e8){_0x3199ea['push'](_0x3199ea['shift']());}};_0x41abc4(++_0x4d36e5);}(_0xded1,0xd9));var _0x1ded=function(_0x446301,_0x15b238){_0x446301=_0x446301-0x0;var _0x268e22=_0xded1[_0x446301];return _0x268e22;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ded('0x0'));var BPromise=require(_0x1ded('0x1'));var rs=require(_0x1ded('0x2'));var fs=require('fs');var Redis=require(_0x1ded('0x3'));var db=require(_0x1ded('0x4'))['db'];var utils=require(_0x1ded('0x5'));var logger=require(_0x1ded('0x6'))(_0x1ded('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ded('0x8'));var client=jayson[_0x1ded('0x9')][_0x1ded('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298384,_0x433971,_0x45009c){return new BPromise(function(_0x47d4cc,_0x18da34){return client[_0x1ded('0xb')](_0x298384,_0x45009c)['then'](function(_0x5e772c){logger[_0x1ded('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x433971,_0x1ded('0xd'));logger[_0x1ded('0xe')](_0x1ded('0xf'),_0x433971,_0x1ded('0xd'),JSON[_0x1ded('0x10')](_0x5e772c));if(_0x5e772c[_0x1ded('0x11')]){if(_0x5e772c[_0x1ded('0x11')][_0x1ded('0x12')]===0x1f4){logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);return _0x18da34(_0x5e772c[_0x1ded('0x11')]['message']);}logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);return _0x47d4cc(_0x5e772c[_0x1ded('0x11')][_0x1ded('0x14')]);}else{logger[_0x1ded('0xc')](_0x1ded('0x13'),_0x433971,'request\x20sent');_0x47d4cc(_0x5e772c[_0x1ded('0x15')][_0x1ded('0x14')]);}})['catch'](function(_0x3e5f60){logger[_0x1ded('0x11')](_0x1ded('0x13'),_0x433971,_0x3e5f60);_0x18da34(_0x3e5f60);});});} \ No newline at end of file +var _0xd165=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x25db26,_0x48f45f){var _0x748fa6=function(_0x27e011){while(--_0x27e011){_0x25db26['push'](_0x25db26['shift']());}};_0x748fa6(++_0x48f45f);}(_0xd165,0x148));var _0x5d16=function(_0x38e495,_0x46092b){_0x38e495=_0x38e495-0x0;var _0x1ca938=_0xd165[_0x38e495];return _0x1ca938;};'use strict';var _=require(_0x5d16('0x0'));var util=require(_0x5d16('0x1'));var moment=require(_0x5d16('0x2'));var BPromise=require(_0x5d16('0x3'));var rs=require(_0x5d16('0x4'));var fs=require('fs');var Redis=require(_0x5d16('0x5'));var db=require(_0x5d16('0x6'))['db'];var utils=require(_0x5d16('0x7'));var logger=require('../../config/logger')(_0x5d16('0x8'));var config=require(_0x5d16('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223052,_0x18e695,_0x66fb9c){return new BPromise(function(_0xbc07c7,_0x121b92){return client[_0x5d16('0xb')](_0x223052,_0x66fb9c)['then'](function(_0x1f58cc){logger[_0x5d16('0xc')](_0x5d16('0xd'),_0x18e695,_0x5d16('0xe'));logger[_0x5d16('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x18e695,_0x5d16('0xe'),JSON[_0x5d16('0x10')](_0x1f58cc));if(_0x1f58cc[_0x5d16('0x11')]){if(_0x1f58cc[_0x5d16('0x11')][_0x5d16('0x12')]===0x1f4){logger[_0x5d16('0x11')](_0x5d16('0xd'),_0x18e695,_0x1f58cc[_0x5d16('0x11')][_0x5d16('0x13')]);return _0x121b92(_0x1f58cc[_0x5d16('0x11')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x18e695,_0x1f58cc[_0x5d16('0x11')]['message']);return _0xbc07c7(_0x1f58cc[_0x5d16('0x11')][_0x5d16('0x13')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x18e695,_0x5d16('0xe'));_0xbc07c7(_0x1f58cc[_0x5d16('0x14')][_0x5d16('0x13')]);}})[_0x5d16('0x15')](function(_0x460841){logger[_0x5d16('0x11')](_0x5d16('0xd'),_0x18e695,_0x460841);_0x121b92(_0x460841);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8aec689..addcc1e 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 _0xf69a=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','util'];(function(_0x119b3a,_0x5d581b){var _0x4fb4da=function(_0x1adc7d){while(--_0x1adc7d){_0x119b3a['push'](_0x119b3a['shift']());}};_0x4fb4da(++_0x5d581b);}(_0xf69a,0x174));var _0xaf69=function(_0x484e47,_0x155a54){_0x484e47=_0x484e47-0x0;var _0x5c6ea5=_0xf69a[_0x484e47];return _0x5c6ea5;};'use strict';var multer=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var path=require(_0xaf69('0x2'));var timeout=require(_0xaf69('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xaf69('0x4'));var interaction=require(_0xaf69('0x5'));var config=require(_0xaf69('0x6'));var controller=require(_0xaf69('0x7'));router[_0xaf69('0x8')]('/',auth[_0xaf69('0x9')](),controller[_0xaf69('0xa')]);router[_0xaf69('0x8')](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller['show']);router[_0xaf69('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf69('0xd')]);router['put'](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller[_0xaf69('0xe')]);router['delete'](_0xaf69('0xb'),auth[_0xaf69('0x9')](),controller[_0xaf69('0xf')]);module[_0xaf69('0x10')]=router; \ No newline at end of file +var _0xf9da=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x299b8b,_0x2b8113){var _0x2df8d6=function(_0x4a7449){while(--_0x4a7449){_0x299b8b['push'](_0x299b8b['shift']());}};_0x2df8d6(++_0x2b8113);}(_0xf9da,0x17a));var _0xaf9d=function(_0x557817,_0x170697){_0x557817=_0x557817-0x0;var _0x108fbf=_0xf9da[_0x557817];return _0x108fbf;};'use strict';var multer=require(_0xaf9d('0x0'));var util=require(_0xaf9d('0x1'));var path=require(_0xaf9d('0x2'));var timeout=require(_0xaf9d('0x3'));var express=require(_0xaf9d('0x4'));var router=express['Router']();var auth=require(_0xaf9d('0x5'));var interaction=require(_0xaf9d('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0xaf9d('0x7')]('/',auth['isAuthenticated'](),controller[_0xaf9d('0x8')]);router[_0xaf9d('0x7')](_0xaf9d('0x9'),auth[_0xaf9d('0xa')](),controller['show']);router[_0xaf9d('0xb')]('/',auth[_0xaf9d('0xa')](),controller[_0xaf9d('0xc')]);router[_0xaf9d('0xd')](_0xaf9d('0x9'),auth[_0xaf9d('0xa')](),controller[_0xaf9d('0xe')]);router[_0xaf9d('0xf')](_0xaf9d('0x9'),auth['isAuthenticated'](),controller[_0xaf9d('0x10')]);module[_0xaf9d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6e5ec65..64022af 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 _0xe700=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x33db28,_0x3ae8f2){var _0xfe4d18=function(_0x560e23){while(--_0x560e23){_0x33db28['push'](_0x33db28['shift']());}};_0xfe4d18(++_0x3ae8f2);}(_0xe700,0x16a));var _0x0e70=function(_0x17cbab,_0x519f4a){_0x17cbab=_0x17cbab-0x0;var _0x39e746=_0xe700[_0x17cbab];return _0x39e746;};'use strict';var Sequelize=require(_0x0e70('0x0'));module[_0x0e70('0x1')]={'type':{'type':Sequelize[_0x0e70('0x2')](_0x0e70('0x3'),_0x0e70('0x4'),'customVariable',_0x0e70('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0e70('0x6')]},'key':{'type':Sequelize[_0x0e70('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x0e70('0x4'),_0x0e70('0x7'))},'keyContent':{'type':Sequelize[_0x0e70('0x6')]},'idField':{'type':Sequelize[_0x0e70('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e70('0x6')]}}; \ No newline at end of file +var _0x5458=['exports','ENUM','string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x370e01,_0x4f286a){var _0x4738d4=function(_0x1c2c2c){while(--_0x1c2c2c){_0x370e01['push'](_0x370e01['shift']());}};_0x4738d4(++_0x4f286a);}(_0x5458,0x1d7));var _0x8545=function(_0x38b288,_0x4058aa){_0x38b288=_0x38b288-0x0;var _0x19c3fc=_0x5458[_0x38b288];return _0x19c3fc;};'use strict';var Sequelize=require(_0x8545('0x0'));module[_0x8545('0x1')]={'type':{'type':Sequelize[_0x8545('0x2')](_0x8545('0x3'),'variable','customVariable','keyValue'),'defaultValue':_0x8545('0x3')},'content':{'type':Sequelize[_0x8545('0x4')]},'key':{'type':Sequelize[_0x8545('0x4')]},'keyType':{'type':Sequelize[_0x8545('0x2')](_0x8545('0x3'),_0x8545('0x5'),_0x8545('0x6'))},'keyContent':{'type':Sequelize[_0x8545('0x4')]},'idField':{'type':Sequelize[_0x8545('0x4')]},'nameField':{'type':Sequelize[_0x8545('0x4')]},'customField':{'type':Sequelize[_0x8545('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8545('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 27d48b2..cf92592 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 _0xbe33=['count','includeAll','findAll','rows','catch','show','include','find','create','body','destroy','params','rimraf','fast-json-patch','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','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options'];(function(_0x40e6b7,_0x3cd89e){var _0x3aa580=function(_0x456fc2){while(--_0x456fc2){_0x40e6b7['push'](_0x40e6b7['shift']());}};_0x3aa580(++_0x3cd89e);}(_0xbe33,0x183));var _0x3be3=function(_0x4996dd,_0x1613fc){_0x4996dd=_0x4996dd-0x0;var _0x98b206=_0xbe33[_0x4996dd];return _0x98b206;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3be3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3be3('0x1'));var rp=require('request-promise');var moment=require(_0x3be3('0x2'));var BPromise=require(_0x3be3('0x3'));var Mustache=require(_0x3be3('0x4'));var util=require('util');var path=require(_0x3be3('0x5'));var sox=require(_0x3be3('0x6'));var csv=require(_0x3be3('0x7'));var ejs=require(_0x3be3('0x8'));var fs=require('fs');var _=require(_0x3be3('0x9'));var squel=require(_0x3be3('0xa'));var crypto=require(_0x3be3('0xb'));var jsforce=require(_0x3be3('0xc'));var deskjs=require(_0x3be3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3be3('0xe'));var Redis=require(_0x3be3('0xf'));var authService=require(_0x3be3('0x10'));var qs=require(_0x3be3('0x11'));var as=require(_0x3be3('0x12'));var hardwareService=require(_0x3be3('0x13'));var logger=require(_0x3be3('0x14'))(_0x3be3('0x15'));var utils=require('../../config/utils');var config=require(_0x3be3('0x16'));var db=require(_0x3be3('0x17'))['db'];function respondWithStatusCode(_0x54e235,_0x140a7e){_0x140a7e=_0x140a7e||0xcc;return function(_0xab8828){if(_0xab8828){return _0x54e235[_0x3be3('0x18')](_0x140a7e);}return _0x54e235[_0x3be3('0x19')](_0x140a7e)[_0x3be3('0x1a')]();};}function respondWithResult(_0x31c05e,_0x51fc75){_0x51fc75=_0x51fc75||0xc8;return function(_0xdb7aec){if(_0xdb7aec){return _0x31c05e[_0x3be3('0x19')](_0x51fc75)[_0x3be3('0x1b')](_0xdb7aec);}};}function respondWithFilteredResult(_0x210af3,_0x5425cb){return function(_0x2c4a6b){if(_0x2c4a6b){var _0x5e8839=_0x2c4a6b['count'],_0x5ae019=_0x5425cb[_0x3be3('0x1c')],_0xdb3074=_0x5425cb[_0x3be3('0x1c')]+_0x5425cb[_0x3be3('0x1d')],_0x25371d;if(_0xdb3074>=_0x5e8839){_0xdb3074=_0x5e8839;_0x25371d=0xc8;}else{_0x25371d=0xce;}_0x210af3[_0x3be3('0x19')](_0x25371d);return _0x210af3[_0x3be3('0x1e')]('Content-Range',_0x5ae019+'-'+_0xdb3074+'/'+_0x5e8839)[_0x3be3('0x1b')](_0x2c4a6b);}return null;};}function patchUpdates(_0x232dc2){return function(_0x1ba286){try{jsonpatch['apply'](_0x1ba286,_0x232dc2,!![]);}catch(_0x29af12){return BPromise[_0x3be3('0x1f')](_0x29af12);}return _0x1ba286[_0x3be3('0x20')]();};}function saveUpdates(_0x21a168,_0x537046){return function(_0x22b53d){if(_0x22b53d){return _0x22b53d['update'](_0x21a168)[_0x3be3('0x21')](function(_0x474f9f){return _0x474f9f;});}return null;};}function removeEntity(_0x1e2bad,_0x4b72cf){return function(_0x322a7f){if(_0x322a7f){return _0x322a7f['destroy']()[_0x3be3('0x21')](function(){_0x1e2bad['status'](0xcc)[_0x3be3('0x1a')]();});}};}function handleEntityNotFound(_0x4af7a2,_0x9dc31f){return function(_0x22fcc4){if(!_0x22fcc4){_0x4af7a2['sendStatus'](0x194);}return _0x22fcc4;};}function handleError(_0x1e12c2,_0x307490){_0x307490=_0x307490||0x1f4;return function(_0xc9535c){logger[_0x3be3('0x22')](_0xc9535c[_0x3be3('0x23')]);if(_0xc9535c['name']){delete _0xc9535c[_0x3be3('0x24')];}_0x1e12c2[_0x3be3('0x19')](_0x307490)[_0x3be3('0x25')](_0xc9535c);};}exports[_0x3be3('0x26')]=function(_0x300072,_0x382656){var _0x951437={},_0x2b0d69={},_0x63883f={'count':0x0,'rows':[]};var _0x1a3315=_[_0x3be3('0x27')](db[_0x3be3('0x28')][_0x3be3('0x29')],function(_0x3749f1){return{'name':_0x3749f1[_0x3be3('0x2a')],'type':_0x3749f1['type'][_0x3be3('0x2b')]};});_0x2b0d69[_0x3be3('0x2c')]=_[_0x3be3('0x27')](_0x1a3315,'name');_0x2b0d69[_0x3be3('0x2d')]=_[_0x3be3('0x2e')](_0x300072['query']);_0x2b0d69['filters']=_['intersection'](_0x2b0d69[_0x3be3('0x2c')],_0x2b0d69['query']);_0x951437[_0x3be3('0x2f')]=_[_0x3be3('0x30')](_0x2b0d69[_0x3be3('0x2c')],qs[_0x3be3('0x31')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x31')]));_0x951437[_0x3be3('0x2f')]=_0x951437[_0x3be3('0x2f')][_0x3be3('0x32')]?_0x951437[_0x3be3('0x2f')]:_0x2b0d69['model'];if(!_0x300072['query'][_0x3be3('0x33')](_0x3be3('0x34'))){_0x951437[_0x3be3('0x1d')]=qs[_0x3be3('0x1d')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x1d')]);_0x951437['offset']=qs[_0x3be3('0x1c')](_0x300072[_0x3be3('0x2d')][_0x3be3('0x1c')]);}_0x951437[_0x3be3('0x35')]=qs['sort'](_0x300072['query'][_0x3be3('0x36')]);_0x951437[_0x3be3('0x37')]=qs['filters'](_[_0x3be3('0x38')](_0x300072[_0x3be3('0x2d')],_0x2b0d69[_0x3be3('0x39')]),_0x1a3315);if(_0x300072['query'][_0x3be3('0x3a')]){_0x951437[_0x3be3('0x37')]=_[_0x3be3('0x3b')](_0x951437['where'],{'$or':_[_0x3be3('0x27')](_0x1a3315,function(_0x4eb2c4){if(_0x4eb2c4[_0x3be3('0x3c')]!==_0x3be3('0x3d')){var _0x333b8a={};_0x333b8a[_0x4eb2c4[_0x3be3('0x24')]]={'$like':'%'+_0x300072[_0x3be3('0x2d')][_0x3be3('0x3a')]+'%'};return _0x333b8a;}})});}_0x951437=_[_0x3be3('0x3b')]({},_0x951437,_0x300072[_0x3be3('0x3e')]);var _0x4d54ff={'where':_0x951437[_0x3be3('0x37')]};return db[_0x3be3('0x28')][_0x3be3('0x3f')](_0x4d54ff)[_0x3be3('0x21')](function(_0x3446f0){_0x63883f['count']=_0x3446f0;if(_0x300072[_0x3be3('0x2d')][_0x3be3('0x40')]){_0x951437['include']=[{'all':!![]}];}return db['VtigerField'][_0x3be3('0x41')](_0x951437);})[_0x3be3('0x21')](function(_0x3619a1){_0x63883f[_0x3be3('0x42')]=_0x3619a1;return _0x63883f;})[_0x3be3('0x21')](respondWithFilteredResult(_0x382656,_0x951437))[_0x3be3('0x43')](handleError(_0x382656,null));};exports[_0x3be3('0x44')]=function(_0xdb7497,_0x285449){var _0x33a506={'raw':!![],'where':{'id':_0xdb7497['params']['id']}},_0x35cdd8={};_0x35cdd8[_0x3be3('0x2c')]=_['keys'](db[_0x3be3('0x28')]['rawAttributes']);_0x35cdd8[_0x3be3('0x2d')]=_[_0x3be3('0x2e')](_0xdb7497[_0x3be3('0x2d')]);_0x35cdd8[_0x3be3('0x39')]=_[_0x3be3('0x30')](_0x35cdd8[_0x3be3('0x2c')],_0x35cdd8[_0x3be3('0x2d')]);_0x33a506[_0x3be3('0x2f')]=_[_0x3be3('0x30')](_0x35cdd8[_0x3be3('0x2c')],qs[_0x3be3('0x31')](_0xdb7497[_0x3be3('0x2d')][_0x3be3('0x31')]));_0x33a506[_0x3be3('0x2f')]=_0x33a506[_0x3be3('0x2f')]['length']?_0x33a506[_0x3be3('0x2f')]:_0x35cdd8[_0x3be3('0x2c')];if(_0xdb7497[_0x3be3('0x2d')][_0x3be3('0x40')]){_0x33a506[_0x3be3('0x45')]=[{'all':!![]}];}_0x33a506=_[_0x3be3('0x3b')]({},_0x33a506,_0xdb7497[_0x3be3('0x3e')]);return db[_0x3be3('0x28')][_0x3be3('0x46')](_0x33a506)['then'](handleEntityNotFound(_0x285449,null))['then'](respondWithResult(_0x285449,null))[_0x3be3('0x43')](handleError(_0x285449,null));};exports[_0x3be3('0x47')]=function(_0x5651f7,_0x58f890){return db['VtigerField']['create'](_0x5651f7['body'],{})[_0x3be3('0x21')](respondWithResult(_0x58f890,0xc9))[_0x3be3('0x43')](handleError(_0x58f890,null));};exports['update']=function(_0x45a478,_0x2dc769){if(_0x45a478[_0x3be3('0x48')]['id']){delete _0x45a478['body']['id'];}return db[_0x3be3('0x28')]['find']({'where':{'id':_0x45a478['params']['id']}})[_0x3be3('0x21')](handleEntityNotFound(_0x2dc769,null))['then'](saveUpdates(_0x45a478[_0x3be3('0x48')],null))['then'](respondWithResult(_0x2dc769,null))['catch'](handleError(_0x2dc769,null));};exports[_0x3be3('0x49')]=function(_0x563964,_0x2f1d85){return db[_0x3be3('0x28')]['find']({'where':{'id':_0x563964[_0x3be3('0x4a')]['id']}})[_0x3be3('0x21')](handleEntityNotFound(_0x2f1d85,null))[_0x3be3('0x21')](removeEntity(_0x2f1d85,null))[_0x3be3('0x43')](handleError(_0x2f1d85,null));}; \ No newline at end of file +var _0x711f=['model','map','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','fields','length','includeAll','update','body','find','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','index','VtigerField','rawAttributes','fieldName','type','key'];(function(_0x2c1362,_0x344e65){var _0x284371=function(_0x477c62){while(--_0x477c62){_0x2c1362['push'](_0x2c1362['shift']());}};_0x284371(++_0x344e65);}(_0x711f,0x17a));var _0xf711=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0x711f[_0x3fc31d];return _0x31bb91;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf711('0x0'));var jsonpatch=require(_0xf711('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf711('0x2'));var Mustache=require(_0xf711('0x3'));var util=require(_0xf711('0x4'));var path=require(_0xf711('0x5'));var sox=require('sox');var csv=require(_0xf711('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf711('0x7'));var squel=require('squel');var crypto=require(_0xf711('0x8'));var jsforce=require(_0xf711('0x9'));var deskjs=require(_0xf711('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf711('0xb'));var Papa=require(_0xf711('0xc'));var Redis=require(_0xf711('0xd'));var authService=require(_0xf711('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf711('0xf'));var hardwareService=require(_0xf711('0x10'));var logger=require('../../config/logger')(_0xf711('0x11'));var utils=require(_0xf711('0x12'));var config=require(_0xf711('0x13'));var db=require(_0xf711('0x14'))['db'];function respondWithStatusCode(_0x336e2d,_0x1741e3){_0x1741e3=_0x1741e3||0xcc;return function(_0x1cd099){if(_0x1cd099){return _0x336e2d[_0xf711('0x15')](_0x1741e3);}return _0x336e2d['status'](_0x1741e3)[_0xf711('0x16')]();};}function respondWithResult(_0x2b9d6f,_0x47b8e1){_0x47b8e1=_0x47b8e1||0xc8;return function(_0x458614){if(_0x458614){return _0x2b9d6f[_0xf711('0x17')](_0x47b8e1)[_0xf711('0x18')](_0x458614);}};}function respondWithFilteredResult(_0x558ab1,_0x46c8ce){return function(_0x5085f4){if(_0x5085f4){var _0x4ccc3d=_0x5085f4[_0xf711('0x19')],_0x8a453e=_0x46c8ce[_0xf711('0x1a')],_0x2162fe=_0x46c8ce[_0xf711('0x1a')]+_0x46c8ce[_0xf711('0x1b')],_0x14ca74;if(_0x2162fe>=_0x4ccc3d){_0x2162fe=_0x4ccc3d;_0x14ca74=0xc8;}else{_0x14ca74=0xce;}_0x558ab1['status'](_0x14ca74);return _0x558ab1['set'](_0xf711('0x1c'),_0x8a453e+'-'+_0x2162fe+'/'+_0x4ccc3d)[_0xf711('0x18')](_0x5085f4);}return null;};}function patchUpdates(_0x177f13){return function(_0x3ce911){try{jsonpatch[_0xf711('0x1d')](_0x3ce911,_0x177f13,!![]);}catch(_0x5d18e3){return BPromise[_0xf711('0x1e')](_0x5d18e3);}return _0x3ce911[_0xf711('0x1f')]();};}function saveUpdates(_0x42ba55,_0x1cd647){return function(_0x4ca153){if(_0x4ca153){return _0x4ca153['update'](_0x42ba55)[_0xf711('0x20')](function(_0x2773be){return _0x2773be;});}return null;};}function removeEntity(_0x15f2c0,_0x32a34a){return function(_0x594588){if(_0x594588){return _0x594588[_0xf711('0x21')]()[_0xf711('0x20')](function(){_0x15f2c0[_0xf711('0x17')](0xcc)[_0xf711('0x16')]();});}};}function handleEntityNotFound(_0x20cd3f,_0x1ccf39){return function(_0x3c2304){if(!_0x3c2304){_0x20cd3f[_0xf711('0x15')](0x194);}return _0x3c2304;};}function handleError(_0x36e3a4,_0x1753a9){_0x1753a9=_0x1753a9||0x1f4;return function(_0x2f1756){logger[_0xf711('0x22')](_0x2f1756['stack']);if(_0x2f1756['name']){delete _0x2f1756[_0xf711('0x23')];}_0x36e3a4[_0xf711('0x17')](_0x1753a9)['send'](_0x2f1756);};}exports[_0xf711('0x24')]=function(_0x327704,_0x4b5040){var _0x2a8913={},_0x46cc6e={},_0x813e6={'count':0x0,'rows':[]};var _0x7f4165=_['map'](db[_0xf711('0x25')][_0xf711('0x26')],function(_0x1ffead){return{'name':_0x1ffead[_0xf711('0x27')],'type':_0x1ffead[_0xf711('0x28')][_0xf711('0x29')]};});_0x46cc6e[_0xf711('0x2a')]=_[_0xf711('0x2b')](_0x7f4165,_0xf711('0x23'));_0x46cc6e['query']=_[_0xf711('0x2c')](_0x327704[_0xf711('0x2d')]);_0x46cc6e[_0xf711('0x2e')]=_['intersection'](_0x46cc6e[_0xf711('0x2a')],_0x46cc6e[_0xf711('0x2d')]);_0x2a8913[_0xf711('0x2f')]=_[_0xf711('0x30')](_0x46cc6e['model'],qs['fields'](_0x327704[_0xf711('0x2d')]['fields']));_0x2a8913[_0xf711('0x2f')]=_0x2a8913['attributes']['length']?_0x2a8913[_0xf711('0x2f')]:_0x46cc6e[_0xf711('0x2a')];if(!_0x327704[_0xf711('0x2d')][_0xf711('0x31')](_0xf711('0x32'))){_0x2a8913[_0xf711('0x1b')]=qs[_0xf711('0x1b')](_0x327704['query'][_0xf711('0x1b')]);_0x2a8913[_0xf711('0x1a')]=qs[_0xf711('0x1a')](_0x327704['query'][_0xf711('0x1a')]);}_0x2a8913[_0xf711('0x33')]=qs[_0xf711('0x34')](_0x327704[_0xf711('0x2d')]['sort']);_0x2a8913[_0xf711('0x35')]=qs[_0xf711('0x2e')](_[_0xf711('0x36')](_0x327704['query'],_0x46cc6e[_0xf711('0x2e')]),_0x7f4165);if(_0x327704[_0xf711('0x2d')]['filter']){_0x2a8913[_0xf711('0x35')]=_[_0xf711('0x37')](_0x2a8913['where'],{'$or':_['map'](_0x7f4165,function(_0x514347){if(_0x514347['type']!=='VIRTUAL'){var _0x1be757={};_0x1be757[_0x514347[_0xf711('0x23')]]={'$like':'%'+_0x327704[_0xf711('0x2d')][_0xf711('0x38')]+'%'};return _0x1be757;}})});}_0x2a8913=_[_0xf711('0x37')]({},_0x2a8913,_0x327704[_0xf711('0x39')]);var _0x5e783a={'where':_0x2a8913[_0xf711('0x35')]};return db[_0xf711('0x25')][_0xf711('0x19')](_0x5e783a)[_0xf711('0x20')](function(_0x1008cf){_0x813e6[_0xf711('0x19')]=_0x1008cf;if(_0x327704[_0xf711('0x2d')]['includeAll']){_0x2a8913[_0xf711('0x3a')]=[{'all':!![]}];}return db[_0xf711('0x25')][_0xf711('0x3b')](_0x2a8913);})[_0xf711('0x20')](function(_0x5b1969){_0x813e6[_0xf711('0x3c')]=_0x5b1969;return _0x813e6;})[_0xf711('0x20')](respondWithFilteredResult(_0x4b5040,_0x2a8913))[_0xf711('0x3d')](handleError(_0x4b5040,null));};exports[_0xf711('0x3e')]=function(_0x4c6a58,_0x441253){var _0x58c62e={'raw':!![],'where':{'id':_0x4c6a58[_0xf711('0x3f')]['id']}},_0x5b0ebd={};_0x5b0ebd[_0xf711('0x2a')]=_['keys'](db[_0xf711('0x25')][_0xf711('0x26')]);_0x5b0ebd['query']=_[_0xf711('0x2c')](_0x4c6a58[_0xf711('0x2d')]);_0x5b0ebd[_0xf711('0x2e')]=_[_0xf711('0x30')](_0x5b0ebd[_0xf711('0x2a')],_0x5b0ebd[_0xf711('0x2d')]);_0x58c62e['attributes']=_[_0xf711('0x30')](_0x5b0ebd[_0xf711('0x2a')],qs[_0xf711('0x40')](_0x4c6a58[_0xf711('0x2d')]['fields']));_0x58c62e[_0xf711('0x2f')]=_0x58c62e[_0xf711('0x2f')][_0xf711('0x41')]?_0x58c62e[_0xf711('0x2f')]:_0x5b0ebd[_0xf711('0x2a')];if(_0x4c6a58[_0xf711('0x2d')][_0xf711('0x42')]){_0x58c62e[_0xf711('0x3a')]=[{'all':!![]}];}_0x58c62e=_[_0xf711('0x37')]({},_0x58c62e,_0x4c6a58['options']);return db[_0xf711('0x25')]['find'](_0x58c62e)[_0xf711('0x20')](handleEntityNotFound(_0x441253,null))['then'](respondWithResult(_0x441253,null))[_0xf711('0x3d')](handleError(_0x441253,null));};exports['create']=function(_0x2e5efb,_0x307ae7){return db['VtigerField']['create'](_0x2e5efb['body'],{})[_0xf711('0x20')](respondWithResult(_0x307ae7,0xc9))[_0xf711('0x3d')](handleError(_0x307ae7,null));};exports[_0xf711('0x43')]=function(_0x36dbef,_0x17741e){if(_0x36dbef[_0xf711('0x44')]['id']){delete _0x36dbef['body']['id'];}return db[_0xf711('0x25')]['find']({'where':{'id':_0x36dbef[_0xf711('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17741e,null))[_0xf711('0x20')](saveUpdates(_0x36dbef[_0xf711('0x44')],null))[_0xf711('0x20')](respondWithResult(_0x17741e,null))['catch'](handleError(_0x17741e,null));};exports['destroy']=function(_0x45c675,_0x6da363){return db[_0xf711('0x25')][_0xf711('0x45')]({'where':{'id':_0x45c675[_0xf711('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6da363,null))['then'](removeEntity(_0x6da363,null))[_0xf711('0x3d')](handleError(_0x6da363,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a7acbf8..03f030f 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 _0xedd9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x408103,_0xa00464){var _0x135a73=function(_0x202aef){while(--_0x202aef){_0x408103['push'](_0x408103['shift']());}};_0x135a73(++_0xa00464);}(_0xedd9,0xfc));var _0x9edd=function(_0x59df00,_0xfc0aa){_0x59df00=_0x59df00-0x0;var _0x32bcb6=_0xedd9[_0x59df00];return _0x32bcb6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),_0x9edd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4aefc9,_0x27bfdc){var _0x1537a4=function(_0x3836a6){while(--_0x3836a6){_0x4aefc9['push'](_0x4aefc9['shift']());}};_0x1537a4(++_0x27bfdc);}(_0xe706,0xa3));var _0x6e70=function(_0x3af384,_0x2b2160){_0x3af384=_0x3af384-0x0;var _0x194aad=_0xe706[_0x3af384];return _0x194aad;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xf'),_0x6e70('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index da10a2e..8b31a82 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 _0x6582=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6582,0x108));var _0x2658=function(_0xc3a71f,_0x54fe71){_0xc3a71f=_0xc3a71f-0x0;var _0x46a474=_0x6582[_0xc3a71f];return _0x46a474;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cb94f,_0x3f53e7,_0x443df){return new BPromise(function(_0x412a9f,_0x52ef38){return client[_0x2658('0xa')](_0x2cb94f,_0x443df)[_0x2658('0xb')](function(_0x426744){logger[_0x2658('0xc')](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));logger[_0x2658('0xf')](_0x2658('0x10'),_0x3f53e7,_0x2658('0xe'),JSON['stringify'](_0x426744));if(_0x426744[_0x2658('0x11')]){if(_0x426744['error'][_0x2658('0x12')]===0x1f4){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x52ef38(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}logger['error'](_0x2658('0xd'),_0x3f53e7,_0x426744[_0x2658('0x11')][_0x2658('0x13')]);return _0x412a9f(_0x426744[_0x2658('0x11')][_0x2658('0x13')]);}else{logger['info'](_0x2658('0xd'),_0x3f53e7,_0x2658('0xe'));_0x412a9f(_0x426744[_0x2658('0x14')]['message']);}})[_0x2658('0x15')](function(_0x44c6d2){logger[_0x2658('0x11')](_0x2658('0xd'),_0x3f53e7,_0x44c6d2);_0x52ef38(_0x44c6d2);});});} \ No newline at end of file +var _0xbc4a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5d4761,_0x5d200f){var _0x51c59a=function(_0x2ad520){while(--_0x2ad520){_0x5d4761['push'](_0x5d4761['shift']());}};_0x51c59a(++_0x5d200f);}(_0xbc4a,0x1dd));var _0xabc4=function(_0x4b8df4,_0x4f6b5a){_0x4b8df4=_0x4b8df4-0x0;var _0x3f7068=_0xbc4a[_0x4b8df4];return _0x3f7068;};'use strict';var _=require(_0xabc4('0x0'));var util=require(_0xabc4('0x1'));var moment=require(_0xabc4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xabc4('0x3'))('rpc');var config=require(_0xabc4('0x4'));var jayson=require(_0xabc4('0x5'));var client=jayson[_0xabc4('0x6')][_0xabc4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x244d3a,_0x1a33c4,_0x244a46){return new BPromise(function(_0x28ea0b,_0x159741){return client[_0xabc4('0x8')](_0x244d3a,_0x244a46)[_0xabc4('0x9')](function(_0x7ca67d){logger[_0xabc4('0xa')](_0xabc4('0xb'),_0x1a33c4,_0xabc4('0xc'));logger[_0xabc4('0xd')](_0xabc4('0xe'),_0x1a33c4,_0xabc4('0xc'),JSON[_0xabc4('0xf')](_0x7ca67d));if(_0x7ca67d[_0xabc4('0x10')]){if(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x11')]===0x1f4){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);return _0x159741(_0x7ca67d[_0xabc4('0x10')]['message']);}logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d['error']['message']);return _0x28ea0b(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);}else{logger[_0xabc4('0xa')]('VtigerField,\x20%s,\x20%s',_0x1a33c4,'request\x20sent');_0x28ea0b(_0x7ca67d['result'][_0xabc4('0x12')]);}})[_0xabc4('0x13')](function(_0xa4ea8){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0xa4ea8);_0x159741(_0xa4ea8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 257691c..1d801ae 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 _0x24e1=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','/:id'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x24e1,0x178));var _0x124e=function(_0x28dfde,_0x867f69){_0x28dfde=_0x28dfde-0x0;var _0xa3414d=_0x24e1[_0x28dfde];return _0xa3414d;};'use strict';var multer=require(_0x124e('0x0'));var util=require(_0x124e('0x1'));var path=require(_0x124e('0x2'));var timeout=require(_0x124e('0x3'));var express=require(_0x124e('0x4'));var router=express[_0x124e('0x5')]();var auth=require(_0x124e('0x6'));var interaction=require(_0x124e('0x7'));var config=require('../../config/environment');var controller=require(_0x124e('0x8'));router[_0x124e('0x9')]('/',auth[_0x124e('0xa')](),controller[_0x124e('0xb')]);router[_0x124e('0x9')]('/:id',auth[_0x124e('0xa')](),controller['show']);router[_0x124e('0x9')]('/:id/configurations',auth[_0x124e('0xa')](),controller[_0x124e('0xc')]);router[_0x124e('0x9')](_0x124e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x124e('0xe')]('/',auth['isAuthenticated'](),controller[_0x124e('0xf')]);router['post'](_0x124e('0x10'),auth[_0x124e('0xa')](),controller[_0x124e('0x11')]);router[_0x124e('0x12')](_0x124e('0x13'),auth['isAuthenticated'](),controller[_0x124e('0x14')]);router['delete'](_0x124e('0x13'),auth[_0x124e('0xa')](),controller['destroy']);module[_0x124e('0x15')]=router; \ No newline at end of file +var _0x26ff=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x424e71,_0x50ef84){var _0x2eb769=function(_0x2a846e){while(--_0x2a846e){_0x424e71['push'](_0x424e71['shift']());}};_0x2eb769(++_0x50ef84);}(_0x26ff,0xd2));var _0xf26f=function(_0x262e2a,_0xef01e2){_0x262e2a=_0x262e2a-0x0;var _0x4f6c68=_0x26ff[_0x262e2a];return _0x4f6c68;};'use strict';var multer=require(_0xf26f('0x0'));var util=require(_0xf26f('0x1'));var path=require(_0xf26f('0x2'));var timeout=require(_0xf26f('0x3'));var express=require(_0xf26f('0x4'));var router=express[_0xf26f('0x5')]();var auth=require(_0xf26f('0x6'));var interaction=require(_0xf26f('0x7'));var config=require(_0xf26f('0x8'));var controller=require(_0xf26f('0x9'));router[_0xf26f('0xa')]('/',auth[_0xf26f('0xb')](),controller[_0xf26f('0xc')]);router['get'](_0xf26f('0xd'),auth['isAuthenticated'](),controller[_0xf26f('0xe')]);router['get'](_0xf26f('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf26f('0xa')](_0xf26f('0x10'),auth[_0xf26f('0xb')](),controller[_0xf26f('0x11')]);router[_0xf26f('0x12')]('/',auth['isAuthenticated'](),controller[_0xf26f('0x13')]);router[_0xf26f('0x12')](_0xf26f('0xf'),auth['isAuthenticated'](),controller[_0xf26f('0x14')]);router[_0xf26f('0x15')](_0xf26f('0xd'),auth[_0xf26f('0xb')](),controller[_0xf26f('0x16')]);router['delete'](_0xf26f('0xd'),auth[_0xf26f('0xb')](),controller[_0xf26f('0x17')]);module[_0xf26f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 645b31b..22da1f1 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 _0xb64f=['STRING','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','exports'];(function(_0x5c68af,_0x590273){var _0x567544=function(_0x2825e5){while(--_0x2825e5){_0x5c68af['push'](_0x5c68af['shift']());}};_0x567544(++_0x590273);}(_0xb64f,0x18a));var _0xfb64=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xb64f[_0x4c2f30];return _0xb8854d;};'use strict';var Sequelize=require(_0xfb64('0x0'));module[_0xfb64('0x1')]={'name':{'type':Sequelize[_0xfb64('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfb64('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xfb64('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfb64('0x3')},'authType':{'type':Sequelize[_0xfb64('0x4')](_0xfb64('0x5'),_0xfb64('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xfb64('0x7'),_0xfb64('0x8')),'defaultValue':_0xfb64('0x7')}}; \ No newline at end of file +var _0xe203=['integrationTab','sequelize','STRING','username','remoteUri','ENUM','password','token'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xe203,0xf9));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e20('0x0'));module['exports']={'name':{'type':Sequelize[_0x3e20('0x1')]},'description':{'type':Sequelize[_0x3e20('0x1')]},'username':{'type':Sequelize[_0x3e20('0x1')],'unique':_0x3e20('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3e20('0x1')]},'remoteUri':{'type':Sequelize[_0x3e20('0x1')],'unique':_0x3e20('0x3')},'authType':{'type':Sequelize[_0x3e20('0x4')](_0x3e20('0x5'),_0x3e20('0x6')),'defaultValue':_0x3e20('0x5')},'serverUrl':{'type':Sequelize[_0x3e20('0x1')]},'type':{'type':Sequelize[_0x3e20('0x4')](_0x3e20('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index ae91712..a3da804 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 _0x3aee=['test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','model','length','create','body','find','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','headers','format','%s:%s','base64','token','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options'];(function(_0x5a1fc0,_0x307f13){var _0x31897a=function(_0x56bb26){while(--_0x56bb26){_0x5a1fc0['push'](_0x5a1fc0['shift']());}};_0x31897a(++_0x307f13);}(_0x3aee,0x104));var _0xe3ae=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x3aee[_0x4358f5];return _0x4d8104;};'use strict';var pdf=require(_0xe3ae('0x0'));var emlformat=require(_0xe3ae('0x1'));var rimraf=require(_0xe3ae('0x2'));var zipdir=require(_0xe3ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3ae('0x4'));var BPromise=require(_0xe3ae('0x5'));var Mustache=require(_0xe3ae('0x6'));var util=require('util');var path=require(_0xe3ae('0x7'));var sox=require(_0xe3ae('0x8'));var csv=require(_0xe3ae('0x9'));var ejs=require(_0xe3ae('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe3ae('0xb'));var jsforce=require(_0xe3ae('0xc'));var deskjs=require(_0xe3ae('0xd'));var toCsv=require(_0xe3ae('0x9'));var querystring=require('querystring');var Papa=require(_0xe3ae('0xe'));var Redis=require(_0xe3ae('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe3ae('0x10'));var as=require(_0xe3ae('0x11'));var hardwareService=require(_0xe3ae('0x12'));var logger=require('../../config/logger')(_0xe3ae('0x13'));var utils=require(_0xe3ae('0x14'));var config=require(_0xe3ae('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe3ae('0x16'));var client=jayson['client'][_0xe3ae('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1a9536,_0x5a3734,_0x1098d9){if(_0x1098d9){var _0x4027d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4027d5['test'](_0x5a3734)){return _0x1a9536;}else{throw new db[(_0xe3ae('0x18'))][(_0xe3ae('0x19'))](_0xe3ae('0x1a'));}}else{return _0x1a9536;}}function respondWithRpcPromise(_0x379795,_0x5df276,_0x59fbf8,_0x1e9dd5){return new BPromise(function(_0x27c5c1,_0x23f473){var _0x5adf3=_0x1e9dd5||client;return _0x5adf3[_0xe3ae('0x1b')](_0x379795,_0x59fbf8)[_0xe3ae('0x1c')](function(_0x545639){logger['info'](_0xe3ae('0x1d'),_0x5df276,_0xe3ae('0x1e'));logger[_0xe3ae('0x1f')](_0xe3ae('0x20'),_0x5df276,'request\x20sent',JSON[_0xe3ae('0x21')](_0x545639));if(_0x545639[_0xe3ae('0x22')]){if(_0x545639[_0xe3ae('0x22')]['code']===0x1f4){logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0x545639[_0xe3ae('0x22')]['message']);return _0x23f473(_0x545639[_0xe3ae('0x22')][_0xe3ae('0x23')]);}logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0x545639[_0xe3ae('0x22')]['message']);return _0x27c5c1(_0x545639['error'][_0xe3ae('0x23')]);}else{logger[_0xe3ae('0x24')](_0xe3ae('0x1d'),_0x5df276,'request\x20sent');_0x27c5c1(_0x545639[_0xe3ae('0x25')]['message']);}})[_0xe3ae('0x26')](function(_0xdf79ca){logger[_0xe3ae('0x22')](_0xe3ae('0x1d'),_0x5df276,_0xdf79ca);_0x23f473(_0xdf79ca);});});}function respondWithStatusCode(_0x216bd2,_0x2ad57f){_0x2ad57f=_0x2ad57f||0xcc;return function(_0x5e2518){if(_0x5e2518){return _0x216bd2[_0xe3ae('0x27')](_0x2ad57f);}return _0x216bd2[_0xe3ae('0x28')](_0x2ad57f)[_0xe3ae('0x29')]();};}function respondWithResult(_0x5eefd6,_0x4230cd){_0x4230cd=_0x4230cd||0xc8;return function(_0x4f5046){if(_0x4f5046){return _0x5eefd6[_0xe3ae('0x28')](_0x4230cd)[_0xe3ae('0x2a')](_0x4f5046);}};}function respondWithFilteredResult(_0x360273,_0x71bc54){return function(_0x42915b){if(_0x42915b){var _0x4df257=_0x42915b[_0xe3ae('0x2b')],_0x4222d9=_0x71bc54[_0xe3ae('0x2c')],_0x66ebd2=_0x71bc54['offset']+_0x71bc54[_0xe3ae('0x2d')],_0x5b6e74;if(_0x66ebd2>=_0x4df257){_0x66ebd2=_0x4df257;_0x5b6e74=0xc8;}else{_0x5b6e74=0xce;}_0x360273[_0xe3ae('0x28')](_0x5b6e74);return _0x360273[_0xe3ae('0x2e')](_0xe3ae('0x2f'),_0x4222d9+'-'+_0x66ebd2+'/'+_0x4df257)[_0xe3ae('0x2a')](_0x42915b);}return null;};}function patchUpdates(_0x44733a){return function(_0x4d941a){try{jsonpatch['apply'](_0x4d941a,_0x44733a,!![]);}catch(_0x5d8011){return BPromise[_0xe3ae('0x30')](_0x5d8011);}return _0x4d941a[_0xe3ae('0x31')]();};}function saveUpdates(_0xeb2845,_0x8c6d4d){return function(_0x45ded6){if(_0x45ded6){return _0x45ded6['update'](_0xeb2845)[_0xe3ae('0x1c')](function(_0x44070a){return _0x44070a;});}return null;};}function removeEntity(_0x1abc6e,_0xce4bdf){return function(_0x232b48){if(_0x232b48){return _0x232b48[_0xe3ae('0x32')]()[_0xe3ae('0x1c')](function(){_0x1abc6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c123e,_0xed1e6c){return function(_0x4d3646){if(!_0x4d3646){_0x2c123e[_0xe3ae('0x27')](0x194);}return _0x4d3646;};}function handleError(_0x1358b3,_0xab160c){_0xab160c=_0xab160c||0x1f4;return function(_0x2013f1){logger[_0xe3ae('0x22')](_0x2013f1['stack']);if(_0x2013f1[_0xe3ae('0x33')]){delete _0x2013f1[_0xe3ae('0x33')];}_0x1358b3[_0xe3ae('0x28')](_0xab160c)[_0xe3ae('0x34')](_0x2013f1);};}exports[_0xe3ae('0x35')]=function(_0x3b4725,_0x1c8d80){var _0x517d6c={},_0x5e93a6={},_0x36711f={'count':0x0,'rows':[]};var _0x354460=_[_0xe3ae('0x36')](db[_0xe3ae('0x37')][_0xe3ae('0x38')],function(_0x21ba9c){return{'name':_0x21ba9c[_0xe3ae('0x39')],'type':_0x21ba9c[_0xe3ae('0x3a')][_0xe3ae('0x3b')]};});_0x5e93a6['model']=_[_0xe3ae('0x36')](_0x354460,_0xe3ae('0x33'));_0x5e93a6[_0xe3ae('0x3c')]=_[_0xe3ae('0x3d')](_0x3b4725[_0xe3ae('0x3c')]);_0x5e93a6['filters']=_[_0xe3ae('0x3e')](_0x5e93a6['model'],_0x5e93a6[_0xe3ae('0x3c')]);_0x517d6c[_0xe3ae('0x3f')]=_['intersection'](_0x5e93a6['model'],qs[_0xe3ae('0x40')](_0x3b4725[_0xe3ae('0x3c')]['fields']));_0x517d6c['attributes']=_0x517d6c[_0xe3ae('0x3f')]['length']?_0x517d6c['attributes']:_0x5e93a6['model'];if(!_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x41')](_0xe3ae('0x42'))){_0x517d6c[_0xe3ae('0x2d')]=qs[_0xe3ae('0x2d')](_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x2d')]);_0x517d6c['offset']=qs['offset'](_0x3b4725[_0xe3ae('0x3c')]['offset']);}_0x517d6c[_0xe3ae('0x43')]=qs['sort'](_0x3b4725[_0xe3ae('0x3c')][_0xe3ae('0x44')]);_0x517d6c[_0xe3ae('0x45')]=qs[_0xe3ae('0x46')](_[_0xe3ae('0x47')](_0x3b4725['query'],_0x5e93a6[_0xe3ae('0x46')]),_0x354460);if(_0x3b4725['query'][_0xe3ae('0x48')]){_0x517d6c[_0xe3ae('0x45')]=_[_0xe3ae('0x49')](_0x517d6c[_0xe3ae('0x45')],{'$or':_[_0xe3ae('0x36')](_0x354460,function(_0x44dceb){if(_0x44dceb[_0xe3ae('0x3a')]!==_0xe3ae('0x4a')){var _0x2fe441={};_0x2fe441[_0x44dceb[_0xe3ae('0x33')]]={'$like':'%'+_0x3b4725['query'][_0xe3ae('0x48')]+'%'};return _0x2fe441;}})});}_0x517d6c=_[_0xe3ae('0x49')]({},_0x517d6c,_0x3b4725[_0xe3ae('0x4b')]);var _0x100af1={'where':_0x517d6c[_0xe3ae('0x45')]};return db[_0xe3ae('0x37')][_0xe3ae('0x2b')](_0x100af1)[_0xe3ae('0x1c')](function(_0x5bef35){_0x36711f[_0xe3ae('0x2b')]=_0x5bef35;if(_0x3b4725['query'][_0xe3ae('0x4c')]){_0x517d6c[_0xe3ae('0x4d')]=[{'all':!![]}];}return db[_0xe3ae('0x37')][_0xe3ae('0x4e')](_0x517d6c);})[_0xe3ae('0x1c')](function(_0x42bacd){_0x36711f['rows']=_0x42bacd;return _0x36711f;})[_0xe3ae('0x1c')](respondWithFilteredResult(_0x1c8d80,_0x517d6c))[_0xe3ae('0x26')](handleError(_0x1c8d80,null));};exports[_0xe3ae('0x4f')]=function(_0x402a62,_0x38a15f){var _0xa9bf21={'raw':![],'where':{'id':_0x402a62['params']['id']}},_0x10e8fc={};_0x10e8fc[_0xe3ae('0x50')]=_[_0xe3ae('0x3d')](db[_0xe3ae('0x37')][_0xe3ae('0x38')]);_0x10e8fc[_0xe3ae('0x3c')]=_[_0xe3ae('0x3d')](_0x402a62[_0xe3ae('0x3c')]);_0x10e8fc[_0xe3ae('0x46')]=_[_0xe3ae('0x3e')](_0x10e8fc[_0xe3ae('0x50')],_0x10e8fc[_0xe3ae('0x3c')]);_0xa9bf21[_0xe3ae('0x3f')]=_[_0xe3ae('0x3e')](_0x10e8fc[_0xe3ae('0x50')],qs[_0xe3ae('0x40')](_0x402a62[_0xe3ae('0x3c')][_0xe3ae('0x40')]));_0xa9bf21[_0xe3ae('0x3f')]=_0xa9bf21[_0xe3ae('0x3f')][_0xe3ae('0x51')]?_0xa9bf21[_0xe3ae('0x3f')]:_0x10e8fc[_0xe3ae('0x50')];if(_0x402a62['query'][_0xe3ae('0x4c')]){_0xa9bf21['include']=[{'all':!![]}];}_0xa9bf21=_[_0xe3ae('0x49')]({},_0xa9bf21,_0x402a62[_0xe3ae('0x4b')]);return db[_0xe3ae('0x37')]['find'](_0xa9bf21)[_0xe3ae('0x1c')](handleEntityNotFound(_0x38a15f,null))[_0xe3ae('0x1c')](respondWithResult(_0x38a15f,null))[_0xe3ae('0x26')](handleError(_0x38a15f,null));};exports[_0xe3ae('0x52')]=function(_0x58f33b,_0x5ed360){return db[_0xe3ae('0x37')]['create'](_0x58f33b[_0xe3ae('0x53')],{})[_0xe3ae('0x1c')](respondWithResult(_0x5ed360,0xc9))['catch'](handleError(_0x5ed360,null));};exports['update']=function(_0x48ef85,_0x55ff92){if(_0x48ef85[_0xe3ae('0x53')]['id']){delete _0x48ef85[_0xe3ae('0x53')]['id'];}return db[_0xe3ae('0x37')][_0xe3ae('0x54')]({'where':{'id':_0x48ef85['params']['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x55ff92,null))[_0xe3ae('0x1c')](saveUpdates(_0x48ef85['body'],null))[_0xe3ae('0x1c')](respondWithResult(_0x55ff92,null))[_0xe3ae('0x26')](handleError(_0x55ff92,null));};exports[_0xe3ae('0x32')]=function(_0x9a5d84,_0x2a097d){return db[_0xe3ae('0x37')][_0xe3ae('0x54')]({'where':{'id':_0x9a5d84[_0xe3ae('0x55')]['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x2a097d,null))[_0xe3ae('0x1c')](removeEntity(_0x2a097d,null))[_0xe3ae('0x26')](handleError(_0x2a097d,null));};exports[_0xe3ae('0x56')]=function(_0x19a0a0,_0x1882e5,_0x3094df){var _0x48ae4f={};var _0xb3a63a={};var _0x1ebb2a;var _0x3c81be;return db['ZendeskAccount'][_0xe3ae('0x57')]({'where':{'id':_0x19a0a0['params']['id']}})[_0xe3ae('0x1c')](handleEntityNotFound(_0x1882e5,null))[_0xe3ae('0x1c')](function(_0x1c2163){if(_0x1c2163){_0x1ebb2a=_0x1c2163;_0xb3a63a[_0xe3ae('0x50')]=_[_0xe3ae('0x3d')](db[_0xe3ae('0x58')][_0xe3ae('0x38')]);_0xb3a63a['query']=_[_0xe3ae('0x3d')](_0x19a0a0[_0xe3ae('0x3c')]);_0xb3a63a[_0xe3ae('0x46')]=_[_0xe3ae('0x3e')](_0xb3a63a[_0xe3ae('0x50')],_0xb3a63a[_0xe3ae('0x3c')]);_0x48ae4f[_0xe3ae('0x3f')]=_[_0xe3ae('0x3e')](_0xb3a63a[_0xe3ae('0x50')],qs[_0xe3ae('0x40')](_0x19a0a0[_0xe3ae('0x3c')]['fields']));_0x48ae4f[_0xe3ae('0x3f')]=_0x48ae4f[_0xe3ae('0x3f')]['length']?_0x48ae4f['attributes']:_0xb3a63a[_0xe3ae('0x50')];_0x48ae4f[_0xe3ae('0x43')]=qs[_0xe3ae('0x44')](_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x44')]);_0x48ae4f['where']=qs[_0xe3ae('0x46')](_['pick'](_0x19a0a0[_0xe3ae('0x3c')],_0xb3a63a[_0xe3ae('0x46')]));if(_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x48')]){_0x48ae4f[_0xe3ae('0x45')]=_[_0xe3ae('0x49')](_0x48ae4f['where'],{'$or':_[_0xe3ae('0x36')](_0x48ae4f['attributes'],function(_0x419209){var _0x3aa4bb={};_0x3aa4bb[_0x419209]={'$like':'%'+_0x19a0a0['query'][_0xe3ae('0x48')]+'%'};return _0x3aa4bb;})});}_0x48ae4f=_[_0xe3ae('0x49')]({},_0x48ae4f,_0x19a0a0['options']);return _0x1ebb2a[_0xe3ae('0x56')](_0x48ae4f);}})[_0xe3ae('0x1c')](function(_0x8a6f4f){if(_0x8a6f4f){_0x3c81be=_0x8a6f4f[_0xe3ae('0x51')];if(!_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x41')]('nolimit')){_0x48ae4f[_0xe3ae('0x2d')]=qs[_0xe3ae('0x2d')](_0x19a0a0[_0xe3ae('0x3c')][_0xe3ae('0x2d')]);_0x48ae4f['offset']=qs[_0xe3ae('0x2c')](_0x19a0a0['query'][_0xe3ae('0x2c')]);}return _0x1ebb2a[_0xe3ae('0x56')](_0x48ae4f);}})[_0xe3ae('0x1c')](function(_0x3d58c7){if(_0x3d58c7){return _0x3d58c7?{'count':_0x3c81be,'rows':_0x3d58c7}:null;}})[_0xe3ae('0x1c')](respondWithResult(_0x1882e5,null))[_0xe3ae('0x26')](handleError(_0x1882e5,null));};exports['addConfiguration']=function(_0x3e93ab,_0xc30cb6,_0x35fc4d){if(_0x3e93ab[_0xe3ae('0x53')]['id']){delete _0x3e93ab['body']['id'];}return db[_0xe3ae('0x37')]['findOne']({'where':{'id':_0x3e93ab['params']['id']}})['then'](handleEntityNotFound(_0xc30cb6,null))['then'](function(_0xfc76b3){if(_0xfc76b3){_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x59')]=_0xfc76b3['id'];_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x5a')]=integrations[_0xe3ae('0x5b')](_0x3e93ab['body']['channel'],_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x3a')]);_0x3e93ab['body'][_0xe3ae('0x5c')]=integrations[_0xe3ae('0x5d')](_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x5e')],_0x3e93ab[_0xe3ae('0x53')][_0xe3ae('0x3a')]);return db[_0xe3ae('0x58')][_0xe3ae('0x52')](_0x3e93ab[_0xe3ae('0x53')],{'include':[{'model':db[_0xe3ae('0x5f')],'as':_0xe3ae('0x5a')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xe3ae('0x1c')](respondWithResult(_0xc30cb6,null))[_0xe3ae('0x26')](handleError(_0xc30cb6,null));};exports[_0xe3ae('0x60')]=function(_0x3138d4,_0x26a598,_0x6ea43){var _0x3340cf='';return db['ZendeskAccount'][_0xe3ae('0x57')]({'where':{'id':_0x3138d4[_0xe3ae('0x55')]['id']},'attributes':['id',_0xe3ae('0x61'),_0xe3ae('0x62'),'token',_0xe3ae('0x63'),_0xe3ae('0x64')]})[_0xe3ae('0x1c')](handleEntityNotFound(_0x26a598,null))[_0xe3ae('0x1c')](function(_0x298829){if(_0x298829){_0x3340cf=_0x298829['remoteUri'];var _0x2e24fd=_0x3340cf[_0xe3ae('0x65')](-0x1);if(_0x2e24fd==='/'){_0x3340cf=_0x3340cf[_0xe3ae('0x66')](0x0,_0x3340cf[_0xe3ae('0x67')](_0x2e24fd));}var _0x37fea1={'method':_0xe3ae('0x68'),'uri':util['format'](_0xe3ae('0x69'),_0x3340cf,'ticket_fields'),'json':!![]};switch(_0x298829[_0xe3ae('0x63')]){case _0xe3ae('0x62'):_0x37fea1[_0xe3ae('0x6a')]={'Authorization':util[_0xe3ae('0x6b')]('Basic\x20%s',new Buffer(util[_0xe3ae('0x6b')](_0xe3ae('0x6c'),_0x298829[_0xe3ae('0x61')],_0x298829[_0xe3ae('0x62')]))['toString'](_0xe3ae('0x6d')))};break;case _0xe3ae('0x6e'):_0x37fea1[_0xe3ae('0x6a')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe3ae('0x6b')](_0xe3ae('0x6f'),_0x298829[_0xe3ae('0x61')],_0x298829[_0xe3ae('0x6e')]))['toString'](_0xe3ae('0x6d')))};break;default:throw new db[(_0xe3ae('0x18'))][(_0xe3ae('0x19'))](_0xe3ae('0x70'));}return rp(_0x37fea1);}})[_0xe3ae('0x1c')](function(_0x2e50d1){if(_0x2e50d1){var _0x4d2189=[_0xe3ae('0x71'),_0xe3ae('0x72'),_0xe3ae('0x73'),_0xe3ae('0x74')];_[_0xe3ae('0x75')](_0x2e50d1[_0xe3ae('0x76')],function(_0x3edce9){return _0x4d2189[_0xe3ae('0x77')](_0x3edce9[_0xe3ae('0x3a')]);});return{'count':_0x2e50d1['ticket_fields'][_0xe3ae('0x51')],'rows':_[_0xe3ae('0x36')](_0x2e50d1[_0xe3ae('0x76')],function(_0xeb484e){return{'id':_0xeb484e['id'],'name':_0xeb484e[_0xe3ae('0x78')]>0x7?_0xeb484e[_0xe3ae('0x79')]:_0xeb484e[_0xe3ae('0x3a')],'custom':_0xeb484e[_0xe3ae('0x78')]>0x7?!![]:![],'options':_0xeb484e[_0xe3ae('0x7a')]?_0xeb484e[_0xe3ae('0x7a')]:_0xeb484e[_0xe3ae('0x7b')]?_0xeb484e['custom_field_options']:[]};})};}})[_0xe3ae('0x1c')](respondWithResult(_0x26a598,null))[_0xe3ae('0x26')](function(_0xd4ec74){var _0x37ed1e=_0x3138d4['query'][_0xe3ae('0x7c')]?0x1f4:_0xd4ec74['statusCode']||0x1f4;logger['error'](_0xe3ae('0x7d'),'getFields',_0x37ed1e,JSON[_0xe3ae('0x21')](_0xd4ec74));delete _0xd4ec74[_0xe3ae('0x33')];if(_0x37ed1e===0x191){_0x37ed1e=0x190;}_0x26a598['status'](_0x37ed1e)[_0xe3ae('0x34')](_0x3138d4[_0xe3ae('0x3c')]['test']?{'message':_0xe3ae('0x7e'),'statusCode':_0xd4ec74[_0xe3ae('0x7f')]}:_0xd4ec74);});}; \ No newline at end of file +var _0x5462=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','getConfigurations','findOne','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','slice','substring','lastIndexOf','GET','format','authType','password','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Unknown\x20authentication\x20type','description','assignee','remove','ticket_fields','includes','title','system_field_options','custom_field_options','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x13442f,_0x1a65f6){var _0x9c01e8=function(_0x5b5cb0){while(--_0x5b5cb0){_0x13442f['push'](_0x13442f['shift']());}};_0x9c01e8(++_0x1a65f6);}(_0x5462,0x171));var _0x2546=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5462[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x2546('0x0'));var emlformat=require(_0x2546('0x1'));var rimraf=require(_0x2546('0x2'));var zipdir=require(_0x2546('0x3'));var jsonpatch=require(_0x2546('0x4'));var rp=require(_0x2546('0x5'));var moment=require(_0x2546('0x6'));var BPromise=require(_0x2546('0x7'));var Mustache=require('mustache');var util=require(_0x2546('0x8'));var path=require(_0x2546('0x9'));var sox=require(_0x2546('0xa'));var csv=require(_0x2546('0xb'));var ejs=require(_0x2546('0xc'));var fs=require('fs');var _=require(_0x2546('0xd'));var squel=require(_0x2546('0xe'));var crypto=require('crypto');var jsforce=require(_0x2546('0xf'));var deskjs=require(_0x2546('0x10'));var toCsv=require(_0x2546('0xb'));var querystring=require(_0x2546('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2546('0x12'));var qs=require(_0x2546('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2546('0x14'));var logger=require(_0x2546('0x15'))(_0x2546('0x16'));var utils=require(_0x2546('0x17'));var config=require(_0x2546('0x18'));var db=require(_0x2546('0x19'))['db'];var integrations=require(_0x2546('0x1a'));var jayson=require(_0x2546('0x1b'));var client=jayson[_0x2546('0x1c')][_0x2546('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1bb538,_0x3d573b,_0x342cc3){if(_0x342cc3){var _0x20d23a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20d23a[_0x2546('0x1e')](_0x3d573b)){return _0x1bb538;}else{throw new db['Sequelize'][(_0x2546('0x1f'))](_0x2546('0x20'));}}else{return _0x1bb538;}}function respondWithRpcPromise(_0x29603b,_0x153f9f,_0x9f8784,_0x36c721){return new BPromise(function(_0x4a17c8,_0x1bd15e){var _0x52e330=_0x36c721||client;return _0x52e330[_0x2546('0x21')](_0x29603b,_0x9f8784)[_0x2546('0x22')](function(_0x411174){logger[_0x2546('0x23')](_0x2546('0x24'),_0x153f9f,_0x2546('0x25'));logger[_0x2546('0x26')](_0x2546('0x27'),_0x153f9f,_0x2546('0x25'),JSON['stringify'](_0x411174));if(_0x411174['error']){if(_0x411174['error'][_0x2546('0x28')]===0x1f4){logger[_0x2546('0x29')](_0x2546('0x24'),_0x153f9f,_0x411174[_0x2546('0x29')][_0x2546('0x2a')]);return _0x1bd15e(_0x411174[_0x2546('0x29')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x153f9f,_0x411174[_0x2546('0x29')][_0x2546('0x2a')]);return _0x4a17c8(_0x411174[_0x2546('0x29')][_0x2546('0x2a')]);}else{logger[_0x2546('0x23')](_0x2546('0x24'),_0x153f9f,_0x2546('0x25'));_0x4a17c8(_0x411174['result']['message']);}})[_0x2546('0x2b')](function(_0x4f26af){logger[_0x2546('0x29')](_0x2546('0x24'),_0x153f9f,_0x4f26af);_0x1bd15e(_0x4f26af);});});}function respondWithStatusCode(_0x2194de,_0x5b8d25){_0x5b8d25=_0x5b8d25||0xcc;return function(_0x53471f){if(_0x53471f){return _0x2194de[_0x2546('0x2c')](_0x5b8d25);}return _0x2194de['status'](_0x5b8d25)['end']();};}function respondWithResult(_0x2b542a,_0x4647fe){_0x4647fe=_0x4647fe||0xc8;return function(_0x5993dc){if(_0x5993dc){return _0x2b542a[_0x2546('0x2d')](_0x4647fe)[_0x2546('0x2e')](_0x5993dc);}};}function respondWithFilteredResult(_0x2a007d,_0x207ad3){return function(_0x255928){if(_0x255928){var _0x58cbf6=_0x255928[_0x2546('0x2f')],_0x2db91b=_0x207ad3['offset'],_0x2a0a7b=_0x207ad3['offset']+_0x207ad3[_0x2546('0x30')],_0x1dc684;if(_0x2a0a7b>=_0x58cbf6){_0x2a0a7b=_0x58cbf6;_0x1dc684=0xc8;}else{_0x1dc684=0xce;}_0x2a007d[_0x2546('0x2d')](_0x1dc684);return _0x2a007d[_0x2546('0x31')]('Content-Range',_0x2db91b+'-'+_0x2a0a7b+'/'+_0x58cbf6)[_0x2546('0x2e')](_0x255928);}return null;};}function patchUpdates(_0x370270){return function(_0x3f29dc){try{jsonpatch[_0x2546('0x32')](_0x3f29dc,_0x370270,!![]);}catch(_0x485d6f){return BPromise[_0x2546('0x33')](_0x485d6f);}return _0x3f29dc[_0x2546('0x34')]();};}function saveUpdates(_0x5589ad,_0x758641){return function(_0x5e2afe){if(_0x5e2afe){return _0x5e2afe[_0x2546('0x35')](_0x5589ad)[_0x2546('0x22')](function(_0x10cefa){return _0x10cefa;});}return null;};}function removeEntity(_0x5ed999,_0xab334f){return function(_0x11a175){if(_0x11a175){return _0x11a175[_0x2546('0x36')]()[_0x2546('0x22')](function(){_0x5ed999['status'](0xcc)[_0x2546('0x37')]();});}};}function handleEntityNotFound(_0x151fae,_0x41be73){return function(_0x35d24a){if(!_0x35d24a){_0x151fae[_0x2546('0x2c')](0x194);}return _0x35d24a;};}function handleError(_0x4c69a4,_0xa1a967){_0xa1a967=_0xa1a967||0x1f4;return function(_0x50d85d){logger[_0x2546('0x29')](_0x50d85d[_0x2546('0x38')]);if(_0x50d85d[_0x2546('0x39')]){delete _0x50d85d[_0x2546('0x39')];}_0x4c69a4['status'](_0xa1a967)[_0x2546('0x3a')](_0x50d85d);};}exports[_0x2546('0x3b')]=function(_0x41f39b,_0x180770){var _0xa86abd={},_0x84cf51={},_0x21aec6={'count':0x0,'rows':[]};var _0x626c41=_[_0x2546('0x3c')](db[_0x2546('0x3d')][_0x2546('0x3e')],function(_0x404f68){return{'name':_0x404f68[_0x2546('0x3f')],'type':_0x404f68[_0x2546('0x40')][_0x2546('0x41')]};});_0x84cf51[_0x2546('0x42')]=_[_0x2546('0x3c')](_0x626c41,_0x2546('0x39'));_0x84cf51[_0x2546('0x43')]=_[_0x2546('0x44')](_0x41f39b[_0x2546('0x43')]);_0x84cf51[_0x2546('0x45')]=_[_0x2546('0x46')](_0x84cf51['model'],_0x84cf51['query']);_0xa86abd['attributes']=_[_0x2546('0x46')](_0x84cf51[_0x2546('0x42')],qs['fields'](_0x41f39b['query'][_0x2546('0x47')]));_0xa86abd['attributes']=_0xa86abd[_0x2546('0x48')]['length']?_0xa86abd['attributes']:_0x84cf51[_0x2546('0x42')];if(!_0x41f39b[_0x2546('0x43')][_0x2546('0x49')](_0x2546('0x4a'))){_0xa86abd['limit']=qs[_0x2546('0x30')](_0x41f39b[_0x2546('0x43')][_0x2546('0x30')]);_0xa86abd[_0x2546('0x4b')]=qs[_0x2546('0x4b')](_0x41f39b['query']['offset']);}_0xa86abd[_0x2546('0x4c')]=qs[_0x2546('0x4d')](_0x41f39b['query'][_0x2546('0x4d')]);_0xa86abd[_0x2546('0x4e')]=qs[_0x2546('0x45')](_['pick'](_0x41f39b[_0x2546('0x43')],_0x84cf51['filters']),_0x626c41);if(_0x41f39b['query'][_0x2546('0x4f')]){_0xa86abd[_0x2546('0x4e')]=_[_0x2546('0x50')](_0xa86abd[_0x2546('0x4e')],{'$or':_[_0x2546('0x3c')](_0x626c41,function(_0x5a1987){if(_0x5a1987[_0x2546('0x40')]!==_0x2546('0x51')){var _0x4be347={};_0x4be347[_0x5a1987[_0x2546('0x39')]]={'$like':'%'+_0x41f39b[_0x2546('0x43')][_0x2546('0x4f')]+'%'};return _0x4be347;}})});}_0xa86abd=_[_0x2546('0x50')]({},_0xa86abd,_0x41f39b[_0x2546('0x52')]);var _0x286ca5={'where':_0xa86abd[_0x2546('0x4e')]};return db['ZendeskAccount']['count'](_0x286ca5)[_0x2546('0x22')](function(_0x1e5d6c){_0x21aec6[_0x2546('0x2f')]=_0x1e5d6c;if(_0x41f39b['query'][_0x2546('0x53')]){_0xa86abd[_0x2546('0x54')]=[{'all':!![]}];}return db[_0x2546('0x3d')][_0x2546('0x55')](_0xa86abd);})[_0x2546('0x22')](function(_0x2245db){_0x21aec6[_0x2546('0x56')]=_0x2245db;return _0x21aec6;})[_0x2546('0x22')](respondWithFilteredResult(_0x180770,_0xa86abd))[_0x2546('0x2b')](handleError(_0x180770,null));};exports[_0x2546('0x57')]=function(_0x27c516,_0x1cdc00){var _0x41a77b={'raw':![],'where':{'id':_0x27c516[_0x2546('0x58')]['id']}},_0x5ef3fe={};_0x5ef3fe['model']=_[_0x2546('0x44')](db[_0x2546('0x3d')][_0x2546('0x3e')]);_0x5ef3fe[_0x2546('0x43')]=_['keys'](_0x27c516[_0x2546('0x43')]);_0x5ef3fe[_0x2546('0x45')]=_[_0x2546('0x46')](_0x5ef3fe[_0x2546('0x42')],_0x5ef3fe[_0x2546('0x43')]);_0x41a77b[_0x2546('0x48')]=_['intersection'](_0x5ef3fe[_0x2546('0x42')],qs[_0x2546('0x47')](_0x27c516[_0x2546('0x43')][_0x2546('0x47')]));_0x41a77b['attributes']=_0x41a77b[_0x2546('0x48')][_0x2546('0x59')]?_0x41a77b['attributes']:_0x5ef3fe[_0x2546('0x42')];if(_0x27c516[_0x2546('0x43')][_0x2546('0x53')]){_0x41a77b[_0x2546('0x54')]=[{'all':!![]}];}_0x41a77b=_[_0x2546('0x50')]({},_0x41a77b,_0x27c516[_0x2546('0x52')]);return db['ZendeskAccount'][_0x2546('0x5a')](_0x41a77b)['then'](handleEntityNotFound(_0x1cdc00,null))['then'](respondWithResult(_0x1cdc00,null))['catch'](handleError(_0x1cdc00,null));};exports[_0x2546('0x5b')]=function(_0x3dc71e,_0x11a8fc){return db[_0x2546('0x3d')][_0x2546('0x5b')](_0x3dc71e[_0x2546('0x5c')],{})['then'](respondWithResult(_0x11a8fc,0xc9))[_0x2546('0x2b')](handleError(_0x11a8fc,null));};exports['update']=function(_0x11689e,_0x3c22da){if(_0x11689e[_0x2546('0x5c')]['id']){delete _0x11689e[_0x2546('0x5c')]['id'];}return db[_0x2546('0x3d')]['find']({'where':{'id':_0x11689e[_0x2546('0x58')]['id']}})[_0x2546('0x22')](handleEntityNotFound(_0x3c22da,null))['then'](saveUpdates(_0x11689e[_0x2546('0x5c')],null))['then'](respondWithResult(_0x3c22da,null))['catch'](handleError(_0x3c22da,null));};exports[_0x2546('0x36')]=function(_0x4bb82c,_0x1568fb){return db['ZendeskAccount'][_0x2546('0x5a')]({'where':{'id':_0x4bb82c['params']['id']}})[_0x2546('0x22')](handleEntityNotFound(_0x1568fb,null))['then'](removeEntity(_0x1568fb,null))[_0x2546('0x2b')](handleError(_0x1568fb,null));};exports[_0x2546('0x5d')]=function(_0x218e01,_0x3b9e82,_0x12ca96){var _0x271ef1={};var _0x462354={};var _0x19770d;var _0x500f06;return db[_0x2546('0x3d')][_0x2546('0x5e')]({'where':{'id':_0x218e01['params']['id']}})[_0x2546('0x22')](handleEntityNotFound(_0x3b9e82,null))[_0x2546('0x22')](function(_0x175cc7){if(_0x175cc7){_0x19770d=_0x175cc7;_0x462354['model']=_['keys'](db['ZendeskConfiguration'][_0x2546('0x3e')]);_0x462354[_0x2546('0x43')]=_['keys'](_0x218e01[_0x2546('0x43')]);_0x462354[_0x2546('0x45')]=_[_0x2546('0x46')](_0x462354[_0x2546('0x42')],_0x462354[_0x2546('0x43')]);_0x271ef1[_0x2546('0x48')]=_[_0x2546('0x46')](_0x462354[_0x2546('0x42')],qs['fields'](_0x218e01[_0x2546('0x43')]['fields']));_0x271ef1['attributes']=_0x271ef1[_0x2546('0x48')]['length']?_0x271ef1['attributes']:_0x462354[_0x2546('0x42')];_0x271ef1[_0x2546('0x4c')]=qs[_0x2546('0x4d')](_0x218e01[_0x2546('0x43')][_0x2546('0x4d')]);_0x271ef1[_0x2546('0x4e')]=qs[_0x2546('0x45')](_['pick'](_0x218e01[_0x2546('0x43')],_0x462354[_0x2546('0x45')]));if(_0x218e01[_0x2546('0x43')][_0x2546('0x4f')]){_0x271ef1['where']=_[_0x2546('0x50')](_0x271ef1[_0x2546('0x4e')],{'$or':_[_0x2546('0x3c')](_0x271ef1[_0x2546('0x48')],function(_0x5c2fd6){var _0x477946={};_0x477946[_0x5c2fd6]={'$like':'%'+_0x218e01[_0x2546('0x43')]['filter']+'%'};return _0x477946;})});}_0x271ef1=_['merge']({},_0x271ef1,_0x218e01['options']);return _0x19770d['getConfigurations'](_0x271ef1);}})[_0x2546('0x22')](function(_0x4c4ead){if(_0x4c4ead){_0x500f06=_0x4c4ead['length'];if(!_0x218e01[_0x2546('0x43')][_0x2546('0x49')]('nolimit')){_0x271ef1['limit']=qs[_0x2546('0x30')](_0x218e01[_0x2546('0x43')][_0x2546('0x30')]);_0x271ef1[_0x2546('0x4b')]=qs[_0x2546('0x4b')](_0x218e01[_0x2546('0x43')][_0x2546('0x4b')]);}return _0x19770d[_0x2546('0x5d')](_0x271ef1);}})[_0x2546('0x22')](function(_0xd16c0){if(_0xd16c0){return _0xd16c0?{'count':_0x500f06,'rows':_0xd16c0}:null;}})['then'](respondWithResult(_0x3b9e82,null))[_0x2546('0x2b')](handleError(_0x3b9e82,null));};exports[_0x2546('0x5f')]=function(_0x192b5d,_0x4897e9,_0x35de5e){if(_0x192b5d[_0x2546('0x5c')]['id']){delete _0x192b5d['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x192b5d[_0x2546('0x58')]['id']}})['then'](handleEntityNotFound(_0x4897e9,null))[_0x2546('0x22')](function(_0x16b881){if(_0x16b881){_0x192b5d['body']['AccountId']=_0x16b881['id'];_0x192b5d[_0x2546('0x5c')]['Subjects']=integrations[_0x2546('0x60')](_0x192b5d[_0x2546('0x5c')]['channel'],_0x192b5d[_0x2546('0x5c')][_0x2546('0x40')]);_0x192b5d[_0x2546('0x5c')][_0x2546('0x61')]=integrations[_0x2546('0x62')](_0x192b5d[_0x2546('0x5c')][_0x2546('0x63')],_0x192b5d['body'][_0x2546('0x40')]);return db['ZendeskConfiguration'][_0x2546('0x5b')](_0x192b5d[_0x2546('0x5c')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x2546('0x64')],'as':_0x2546('0x61')}]});}return null;})['then'](respondWithResult(_0x4897e9,null))['catch'](handleError(_0x4897e9,null));};exports[_0x2546('0x65')]=function(_0x300b56,_0x2ded80,_0x3f8017){var _0x26d449='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x300b56[_0x2546('0x58')]['id']},'attributes':['id',_0x2546('0x66'),'password','token','authType','remoteUri']})['then'](handleEntityNotFound(_0x2ded80,null))[_0x2546('0x22')](function(_0x39e506){if(_0x39e506){_0x26d449=_0x39e506['remoteUri'];var _0x2b0103=_0x26d449[_0x2546('0x67')](-0x1);if(_0x2b0103==='/'){_0x26d449=_0x26d449[_0x2546('0x68')](0x0,_0x26d449[_0x2546('0x69')](_0x2b0103));}var _0x4d5b94={'method':_0x2546('0x6a'),'uri':util[_0x2546('0x6b')]('%s/%s',_0x26d449,'ticket_fields'),'json':!![]};switch(_0x39e506[_0x2546('0x6c')]){case _0x2546('0x6d'):_0x4d5b94[_0x2546('0x6e')]={'Authorization':util[_0x2546('0x6b')](_0x2546('0x6f'),new Buffer(util[_0x2546('0x6b')](_0x2546('0x70'),_0x39e506[_0x2546('0x66')],_0x39e506['password']))[_0x2546('0x71')](_0x2546('0x72')))};break;case _0x2546('0x73'):_0x4d5b94[_0x2546('0x6e')]={'Authorization':util[_0x2546('0x6b')]('Basic\x20%s',new Buffer(util[_0x2546('0x6b')](_0x2546('0x74'),_0x39e506[_0x2546('0x66')],_0x39e506[_0x2546('0x73')]))[_0x2546('0x71')](_0x2546('0x72')))};break;default:throw new db['Sequelize'][(_0x2546('0x1f'))](_0x2546('0x75'));}return rp(_0x4d5b94);}})[_0x2546('0x22')](function(_0x3df6df){if(_0x3df6df){var _0x37f29d=['subject',_0x2546('0x76'),'group',_0x2546('0x77')];_[_0x2546('0x78')](_0x3df6df[_0x2546('0x79')],function(_0x65fe67){return _0x37f29d[_0x2546('0x7a')](_0x65fe67[_0x2546('0x40')]);});return{'count':_0x3df6df[_0x2546('0x79')]['length'],'rows':_[_0x2546('0x3c')](_0x3df6df[_0x2546('0x79')],function(_0x435c4c){return{'id':_0x435c4c['id'],'name':_0x435c4c['position']>0x7?_0x435c4c[_0x2546('0x7b')]:_0x435c4c[_0x2546('0x40')],'custom':_0x435c4c['position']>0x7?!![]:![],'options':_0x435c4c[_0x2546('0x7c')]?_0x435c4c[_0x2546('0x7c')]:_0x435c4c[_0x2546('0x7d')]?_0x435c4c[_0x2546('0x7d')]:[]};})};}})['then'](respondWithResult(_0x2ded80,null))[_0x2546('0x2b')](function(_0x825538){var _0x535357=_0x300b56[_0x2546('0x43')][_0x2546('0x1e')]?0x1f4:_0x825538[_0x2546('0x7e')]||0x1f4;logger[_0x2546('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x2546('0x65'),_0x535357,JSON[_0x2546('0x7f')](_0x825538));delete _0x825538[_0x2546('0x39')];if(_0x535357===0x191){_0x535357=0x190;}_0x2ded80['status'](_0x535357)['send'](_0x300b56[_0x2546('0x43')][_0x2546('0x1e')]?{'message':_0x2546('0x80'),'statusCode':_0x825538[_0x2546('0x7e')]}:_0x825538);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8bde922..83dbde8 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 _0x2d59=['../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x2d59,0x94));var _0x92d5=function(_0x394437,_0x390b4d){_0x394437=_0x394437-0x0;var _0x595440=_0x2d59[_0x394437];return _0x595440;};'use strict';var _=require('lodash');var util=require(_0x92d5('0x0'));var logger=require(_0x92d5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x92d5('0x2'));var rp=require(_0x92d5('0x3'));var fs=require('fs');var path=require(_0x92d5('0x4'));var rimraf=require(_0x92d5('0x5'));var config=require(_0x92d5('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x92d5('0x7')]=function(_0x235e19,_0x147629){return _0x235e19[_0x92d5('0x8')](_0x92d5('0x9'),attributes,{'tableName':_0x92d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4fb=['request-promise','rimraf','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0xb73f5f,_0x33b643){var _0xbae1f5=function(_0x36c330){while(--_0x36c330){_0xb73f5f['push'](_0xb73f5f['shift']());}};_0xbae1f5(++_0x33b643);}(_0xb4fb,0x1d4));var _0xbb4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb4fb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xbb4f('0x0'));var util=require(_0xbb4f('0x1'));var logger=require(_0xbb4f('0x2'))(_0xbb4f('0x3'));var moment=require('moment');var BPromise=require(_0xbb4f('0x4'));var rp=require(_0xbb4f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb4f('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xbb4f('0x7'));module[_0xbb4f('0x8')]=function(_0x52bb45,_0x3b5e65){return _0x52bb45[_0xbb4f('0x9')]('ZendeskAccount',attributes,{'tableName':_0xbb4f('0xa'),'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 a879497..cc8ecc9 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 _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x166563,_0x1412a2){var _0x48572f=function(_0x755282){while(--_0x755282){_0x166563['push'](_0x166563['shift']());}};_0x48572f(++_0x1412a2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x20ed80,_0x2465d8){var _0x2ca8bb=function(_0x381f76){while(--_0x381f76){_0x20ed80['push'](_0x20ed80['shift']());}};_0x2ca8bb(++_0x2465d8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'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')]('ZendeskAccount,\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);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 644a066..2269bf4 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 _0x866b=['isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x13d5a3,_0x4fe4ec){var _0xf5e40d=function(_0x240fe2){while(--_0x240fe2){_0x13d5a3['push'](_0x13d5a3['shift']());}};_0xf5e40d(++_0x4fe4ec);}(_0x866b,0x17f));var _0xb866=function(_0x55d829,_0x43f06c){_0x55d829=_0x55d829-0x0;var _0x52163b=_0x866b[_0x55d829];return _0x52163b;};'use strict';var multer=require(_0xb866('0x0'));var util=require(_0xb866('0x1'));var path=require('path');var timeout=require(_0xb866('0x2'));var express=require('express');var router=express[_0xb866('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb866('0x4'));var config=require(_0xb866('0x5'));var controller=require(_0xb866('0x6'));router[_0xb866('0x7')]('/',auth[_0xb866('0x8')](),controller['index']);router[_0xb866('0x7')](_0xb866('0x9'),auth[_0xb866('0x8')](),controller['show']);router['get'](_0xb866('0xa'),auth[_0xb866('0x8')](),controller[_0xb866('0xb')]);router[_0xb866('0x7')](_0xb866('0xc'),auth[_0xb866('0x8')](),controller['getSubjects']);router[_0xb866('0x7')]('/:id/descriptions',auth[_0xb866('0x8')](),controller[_0xb866('0xd')]);router['get'](_0xb866('0xe'),auth[_0xb866('0x8')](),controller[_0xb866('0xf')]);router[_0xb866('0x10')]('/',auth[_0xb866('0x8')](),controller[_0xb866('0x11')]);router[_0xb866('0x10')]('/:id/tags',auth[_0xb866('0x8')](),controller[_0xb866('0x12')]);router[_0xb866('0x13')](_0xb866('0x9'),auth[_0xb866('0x8')](),controller[_0xb866('0x14')]);router[_0xb866('0x15')](_0xb866('0x9'),auth['isAuthenticated'](),controller[_0xb866('0x16')]);module['exports']=router; \ No newline at end of file +var _0xdab2=['getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','path','express','Router','get','index','/:id','show','/:id/fields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions'];(function(_0x2b9869,_0x5026e8){var _0x190abd=function(_0x1949ee){while(--_0x1949ee){_0x2b9869['push'](_0x2b9869['shift']());}};_0x190abd(++_0x5026e8);}(_0xdab2,0x1a8));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2dab('0x0'));var util=require('util');var path=require(_0x2dab('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dab('0x2'));var router=express[_0x2dab('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskConfiguration.controller');router[_0x2dab('0x4')]('/',auth['isAuthenticated'](),controller[_0x2dab('0x5')]);router[_0x2dab('0x4')](_0x2dab('0x6'),auth['isAuthenticated'](),controller[_0x2dab('0x7')]);router[_0x2dab('0x4')](_0x2dab('0x8'),auth['isAuthenticated'](),controller['getFields']);router[_0x2dab('0x4')](_0x2dab('0x9'),auth[_0x2dab('0xa')](),controller[_0x2dab('0xb')]);router[_0x2dab('0x4')](_0x2dab('0xc'),auth[_0x2dab('0xa')](),controller[_0x2dab('0xd')]);router[_0x2dab('0x4')](_0x2dab('0xe'),auth[_0x2dab('0xa')](),controller[_0x2dab('0xf')]);router[_0x2dab('0x10')]('/',auth[_0x2dab('0xa')](),controller[_0x2dab('0x11')]);router[_0x2dab('0x10')](_0x2dab('0xe'),auth['isAuthenticated'](),controller[_0x2dab('0x12')]);router[_0x2dab('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2dab('0x14')]);router[_0x2dab('0x15')](_0x2dab('0x6'),auth[_0x2dab('0xa')](),controller['destroy']);module[_0x2dab('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 9684d34..9b8c728 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 _0x27ae=['STRING'];(function(_0x2c0399,_0x15c979){var _0x8af475=function(_0x49cac8){while(--_0x49cac8){_0x2c0399['push'](_0x2c0399['shift']());}};_0x8af475(++_0x15c979);}(_0x27ae,0x16f));var _0xe27a=function(_0x51fc7c,_0x475586){_0x51fc7c=_0x51fc7c-0x0;var _0x1482a7=_0x27ae[_0x51fc7c];return _0x1482a7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe27a('0x0')]},'description':{'type':Sequelize[_0xe27a('0x0')]}}; \ No newline at end of file +var _0x5c63=['sequelize','STRING'];(function(_0x34b64f,_0x2cbd48){var _0x40c2c7=function(_0x3693c1){while(--_0x3693c1){_0x34b64f['push'](_0x34b64f['shift']());}};_0x40c2c7(++_0x2cbd48);}(_0x5c63,0x1a4));var _0x35c6=function(_0x3cd003,_0x1a7985){_0x3cd003=_0x3cd003-0x0;var _0x5063c6=_0x5c63[_0x3cd003];return _0x5063c6;};'use strict';var Sequelize=require(_0x35c6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35c6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8b7fcaf..7832393 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 _0xf0a9=['apply','save','update','stack','index','map','ZendeskConfiguration','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','then','rows','catch','params','intersection','options','find','create','body','destroy','getFields','ZendeskField','getSubjects','findOne','getDescriptions','rawAttributes','getTags','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range'];(function(_0x45f3bd,_0x387fbe){var _0x5590fb=function(_0x5c07d1){while(--_0x5c07d1){_0x45f3bd['push'](_0x45f3bd['shift']());}};_0x5590fb(++_0x387fbe);}(_0xf0a9,0xf8));var _0x9f0a=function(_0x259f25,_0x5bf811){_0x259f25=_0x259f25-0x0;var _0x1a6f86=_0xf0a9[_0x259f25];return _0x1a6f86;};'use strict';var pdf=require(_0x9f0a('0x0'));var emlformat=require(_0x9f0a('0x1'));var rimraf=require(_0x9f0a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f0a('0x3'));var rp=require(_0x9f0a('0x4'));var moment=require(_0x9f0a('0x5'));var BPromise=require(_0x9f0a('0x6'));var Mustache=require(_0x9f0a('0x7'));var util=require(_0x9f0a('0x8'));var path=require(_0x9f0a('0x9'));var sox=require(_0x9f0a('0xa'));var csv=require('to-csv');var ejs=require(_0x9f0a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f0a('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f0a('0xd'));var deskjs=require(_0x9f0a('0xe'));var toCsv=require(_0x9f0a('0xf'));var querystring=require(_0x9f0a('0x10'));var Papa=require(_0x9f0a('0x11'));var Redis=require(_0x9f0a('0x12'));var authService=require(_0x9f0a('0x13'));var qs=require(_0x9f0a('0x14'));var as=require(_0x9f0a('0x15'));var hardwareService=require(_0x9f0a('0x16'));var logger=require(_0x9f0a('0x17'))('api');var utils=require(_0x9f0a('0x18'));var config=require('../../config/environment');var db=require(_0x9f0a('0x19'))['db'];var jayson=require(_0x9f0a('0x1a'));var client=jayson[_0x9f0a('0x1b')][_0x9f0a('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x20d2e1,_0x2589f5,_0x4ec796){if(_0x4ec796){var _0x59d5d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59d5d6[_0x9f0a('0x1d')](_0x2589f5)){return _0x20d2e1;}else{throw new db[(_0x9f0a('0x1e'))][(_0x9f0a('0x1f'))](_0x9f0a('0x20'));}}else{return _0x20d2e1;}}function respondWithRpcPromise(_0x19c072,_0xfe05c8,_0x259a82,_0x4b8b0b){return new BPromise(function(_0x402d3d,_0x54bcee){var _0x557f1d=_0x4b8b0b||client;return _0x557f1d[_0x9f0a('0x21')](_0x19c072,_0x259a82)['then'](function(_0x410f90){logger['info'](_0x9f0a('0x22'),_0xfe05c8,_0x9f0a('0x23'));logger[_0x9f0a('0x24')](_0x9f0a('0x25'),_0xfe05c8,'request\x20sent',JSON[_0x9f0a('0x26')](_0x410f90));if(_0x410f90[_0x9f0a('0x27')]){if(_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x28')]===0x1f4){logger[_0x9f0a('0x27')]('ZendeskConfiguration,\x20%s,\x20%s',_0xfe05c8,_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x29')]);return _0x54bcee(_0x410f90['error'][_0x9f0a('0x29')]);}logger[_0x9f0a('0x27')](_0x9f0a('0x22'),_0xfe05c8,_0x410f90[_0x9f0a('0x27')][_0x9f0a('0x29')]);return _0x402d3d(_0x410f90[_0x9f0a('0x27')]['message']);}else{logger[_0x9f0a('0x2a')]('ZendeskConfiguration,\x20%s,\x20%s',_0xfe05c8,_0x9f0a('0x23'));_0x402d3d(_0x410f90[_0x9f0a('0x2b')]['message']);}})['catch'](function(_0x486b35){logger[_0x9f0a('0x27')](_0x9f0a('0x22'),_0xfe05c8,_0x486b35);_0x54bcee(_0x486b35);});});}function respondWithStatusCode(_0x5d5c51,_0x284508){_0x284508=_0x284508||0xcc;return function(_0x4481c0){if(_0x4481c0){return _0x5d5c51[_0x9f0a('0x2c')](_0x284508);}return _0x5d5c51[_0x9f0a('0x2d')](_0x284508)[_0x9f0a('0x2e')]();};}function respondWithResult(_0x1b2078,_0x3d1525){_0x3d1525=_0x3d1525||0xc8;return function(_0x1ba2fc){if(_0x1ba2fc){return _0x1b2078[_0x9f0a('0x2d')](_0x3d1525)[_0x9f0a('0x2f')](_0x1ba2fc);}};}function respondWithFilteredResult(_0x4fe0bd,_0x14bfe8){return function(_0x2b94d9){if(_0x2b94d9){var _0x5129bf=_0x2b94d9[_0x9f0a('0x30')],_0xdd9a80=_0x14bfe8[_0x9f0a('0x31')],_0x3f36ba=_0x14bfe8[_0x9f0a('0x31')]+_0x14bfe8['limit'],_0x43520b;if(_0x3f36ba>=_0x5129bf){_0x3f36ba=_0x5129bf;_0x43520b=0xc8;}else{_0x43520b=0xce;}_0x4fe0bd[_0x9f0a('0x2d')](_0x43520b);return _0x4fe0bd[_0x9f0a('0x32')](_0x9f0a('0x33'),_0xdd9a80+'-'+_0x3f36ba+'/'+_0x5129bf)[_0x9f0a('0x2f')](_0x2b94d9);}return null;};}function patchUpdates(_0x1d10cd){return function(_0x38f14f){try{jsonpatch[_0x9f0a('0x34')](_0x38f14f,_0x1d10cd,!![]);}catch(_0x3bfd44){return BPromise['reject'](_0x3bfd44);}return _0x38f14f[_0x9f0a('0x35')]();};}function saveUpdates(_0x7053ce,_0x530d25){return function(_0x46ebed){if(_0x46ebed){return _0x46ebed[_0x9f0a('0x36')](_0x7053ce)['then'](function(_0x44cec4){return _0x44cec4;});}return null;};}function removeEntity(_0x776eb4,_0x499b41){return function(_0x5395c5){if(_0x5395c5){return _0x5395c5['destroy']()['then'](function(){_0x776eb4[_0x9f0a('0x2d')](0xcc)[_0x9f0a('0x2e')]();});}};}function handleEntityNotFound(_0x543255,_0xddbe06){return function(_0x276c7b){if(!_0x276c7b){_0x543255['sendStatus'](0x194);}return _0x276c7b;};}function handleError(_0x511b2f,_0x37318f){_0x37318f=_0x37318f||0x1f4;return function(_0x5bae53){logger[_0x9f0a('0x27')](_0x5bae53[_0x9f0a('0x37')]);if(_0x5bae53['name']){delete _0x5bae53['name'];}_0x511b2f['status'](_0x37318f)['send'](_0x5bae53);};}exports[_0x9f0a('0x38')]=function(_0x2456ce,_0x106b67){var _0x277c57={},_0x12109f={},_0x232963={'count':0x0,'rows':[]};var _0x208a4a=_[_0x9f0a('0x39')](db[_0x9f0a('0x3a')]['rawAttributes'],function(_0x4c92f8){return{'name':_0x4c92f8[_0x9f0a('0x3b')],'type':_0x4c92f8[_0x9f0a('0x3c')][_0x9f0a('0x3d')]};});_0x12109f[_0x9f0a('0x3e')]=_[_0x9f0a('0x39')](_0x208a4a,'name');_0x12109f['query']=_[_0x9f0a('0x3f')](_0x2456ce[_0x9f0a('0x40')]);_0x12109f[_0x9f0a('0x41')]=_['intersection'](_0x12109f['model'],_0x12109f[_0x9f0a('0x40')]);_0x277c57[_0x9f0a('0x42')]=_['intersection'](_0x12109f['model'],qs[_0x9f0a('0x43')](_0x2456ce['query'][_0x9f0a('0x43')]));_0x277c57['attributes']=_0x277c57['attributes'][_0x9f0a('0x44')]?_0x277c57['attributes']:_0x12109f['model'];if(!_0x2456ce['query'][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0x277c57['limit']=qs[_0x9f0a('0x47')](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0x277c57[_0x9f0a('0x31')]=qs['offset'](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x31')]);}_0x277c57[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x277c57[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x2456ce[_0x9f0a('0x40')],_0x12109f['filters']),_0x208a4a);if(_0x2456ce[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x277c57[_0x9f0a('0x4a')]=_[_0x9f0a('0x4d')](_0x277c57['where'],{'$or':_[_0x9f0a('0x39')](_0x208a4a,function(_0x5585b2){if(_0x5585b2['type']!==_0x9f0a('0x4e')){var _0x452658={};_0x452658[_0x5585b2[_0x9f0a('0x4f')]]={'$like':'%'+_0x2456ce['query'][_0x9f0a('0x4c')]+'%'};return _0x452658;}})});}_0x277c57=_['merge']({},_0x277c57,_0x2456ce['options']);var _0x3bd2bb={'where':_0x277c57[_0x9f0a('0x4a')]};return db[_0x9f0a('0x3a')][_0x9f0a('0x30')](_0x3bd2bb)['then'](function(_0x387dbc){_0x232963[_0x9f0a('0x30')]=_0x387dbc;if(_0x2456ce['query'][_0x9f0a('0x50')]){_0x277c57[_0x9f0a('0x51')]=[{'all':!![]}];}return db[_0x9f0a('0x3a')]['findAll'](_0x277c57);})[_0x9f0a('0x52')](function(_0x4d0fa8){_0x232963[_0x9f0a('0x53')]=_0x4d0fa8;return _0x232963;})[_0x9f0a('0x52')](respondWithFilteredResult(_0x106b67,_0x277c57))[_0x9f0a('0x54')](handleError(_0x106b67,null));};exports['show']=function(_0x2c411b,_0x2c766b){var _0x4d0c42={'raw':![],'where':{'id':_0x2c411b[_0x9f0a('0x55')]['id']}},_0x227f80={};_0x227f80['model']=_[_0x9f0a('0x3f')](db[_0x9f0a('0x3a')]['rawAttributes']);_0x227f80[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x2c411b[_0x9f0a('0x40')]);_0x227f80[_0x9f0a('0x41')]=_[_0x9f0a('0x56')](_0x227f80[_0x9f0a('0x3e')],_0x227f80[_0x9f0a('0x40')]);_0x4d0c42['attributes']=_[_0x9f0a('0x56')](_0x227f80[_0x9f0a('0x3e')],qs['fields'](_0x2c411b[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0x4d0c42['attributes']=_0x4d0c42[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0x4d0c42[_0x9f0a('0x42')]:_0x227f80[_0x9f0a('0x3e')];if(_0x2c411b['query']['includeAll']){_0x4d0c42[_0x9f0a('0x51')]=[{'all':!![]}];}_0x4d0c42=_[_0x9f0a('0x4d')]({},_0x4d0c42,_0x2c411b[_0x9f0a('0x57')]);return db[_0x9f0a('0x3a')][_0x9f0a('0x58')](_0x4d0c42)[_0x9f0a('0x52')](handleEntityNotFound(_0x2c766b,null))[_0x9f0a('0x52')](respondWithResult(_0x2c766b,null))[_0x9f0a('0x54')](handleError(_0x2c766b,null));};exports[_0x9f0a('0x59')]=function(_0x4e11d7,_0x1706d9){return db[_0x9f0a('0x3a')][_0x9f0a('0x59')](_0x4e11d7[_0x9f0a('0x5a')],{})['then'](respondWithResult(_0x1706d9,0xc9))[_0x9f0a('0x54')](handleError(_0x1706d9,null));};exports[_0x9f0a('0x36')]=function(_0x562a76,_0x4734bb){if(_0x562a76[_0x9f0a('0x5a')]['id']){delete _0x562a76[_0x9f0a('0x5a')]['id'];}return db['ZendeskConfiguration'][_0x9f0a('0x58')]({'where':{'id':_0x562a76[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x4734bb,null))[_0x9f0a('0x52')](saveUpdates(_0x562a76[_0x9f0a('0x5a')],null))[_0x9f0a('0x52')](respondWithResult(_0x4734bb,null))[_0x9f0a('0x54')](handleError(_0x4734bb,null));};exports[_0x9f0a('0x5b')]=function(_0x2aeeb1,_0x12f153){return db[_0x9f0a('0x3a')]['find']({'where':{'id':_0x2aeeb1['params']['id']}})['then'](handleEntityNotFound(_0x12f153,null))['then'](removeEntity(_0x12f153,null))['catch'](handleError(_0x12f153,null));};exports[_0x9f0a('0x5c')]=function(_0xe71f87,_0x515732,_0x1f3858){var _0xc0a208={};var _0x430ab4={};var _0x5c54a2;var _0x2a539d;return db[_0x9f0a('0x3a')]['findOne']({'where':{'id':_0xe71f87[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x515732,null))[_0x9f0a('0x52')](function(_0x45b8fd){if(_0x45b8fd){_0x5c54a2=_0x45b8fd;_0x430ab4[_0x9f0a('0x3e')]=_['keys'](db[_0x9f0a('0x5d')]['rawAttributes']);_0x430ab4[_0x9f0a('0x40')]=_['keys'](_0xe71f87[_0x9f0a('0x40')]);_0x430ab4['filters']=_[_0x9f0a('0x56')](_0x430ab4[_0x9f0a('0x3e')],_0x430ab4[_0x9f0a('0x40')]);_0xc0a208['attributes']=_[_0x9f0a('0x56')](_0x430ab4[_0x9f0a('0x3e')],qs['fields'](_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0xc0a208['attributes']=_0xc0a208[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0xc0a208[_0x9f0a('0x42')]:_0x430ab4['model'];_0xc0a208[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0xe71f87[_0x9f0a('0x40')]['sort']);_0xc0a208[_0x9f0a('0x4a')]=qs['filters'](_['pick'](_0xe71f87[_0x9f0a('0x40')],_0x430ab4[_0x9f0a('0x41')]));if(_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0xc0a208['where']=_[_0x9f0a('0x4d')](_0xc0a208[_0x9f0a('0x4a')],{'$or':_[_0x9f0a('0x39')](_0xc0a208[_0x9f0a('0x42')],function(_0x1aa083){var _0x51f213={};_0x51f213[_0x1aa083]={'$like':'%'+_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x4c')]+'%'};return _0x51f213;})});}_0xc0a208=_[_0x9f0a('0x4d')]({},_0xc0a208,_0xe71f87[_0x9f0a('0x57')]);return _0x5c54a2[_0x9f0a('0x5c')](_0xc0a208);}})[_0x9f0a('0x52')](function(_0xc40c7a){if(_0xc40c7a){_0x2a539d=_0xc40c7a[_0x9f0a('0x44')];if(!_0xe71f87['query'][_0x9f0a('0x45')]('nolimit')){_0xc0a208['limit']=qs[_0x9f0a('0x47')](_0xe71f87[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0xc0a208[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0xe71f87['query']['offset']);}return _0x5c54a2[_0x9f0a('0x5c')](_0xc0a208);}})[_0x9f0a('0x52')](function(_0x3e2d9b){if(_0x3e2d9b){return _0x3e2d9b?{'count':_0x2a539d,'rows':_0x3e2d9b}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x515732,null))[_0x9f0a('0x54')](handleError(_0x515732,null));};exports[_0x9f0a('0x5e')]=function(_0x38cffc,_0x4e5179,_0x15a190){var _0xf326e8={};var _0x2d51d9={};var _0xaba9d1;var _0xeba8f1;return db['ZendeskConfiguration'][_0x9f0a('0x5f')]({'where':{'id':_0x38cffc['params']['id']}})['then'](handleEntityNotFound(_0x4e5179,null))[_0x9f0a('0x52')](function(_0xd9c9c5){if(_0xd9c9c5){_0xaba9d1=_0xd9c9c5;_0x2d51d9[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db[_0x9f0a('0x5d')]['rawAttributes']);_0x2d51d9[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x38cffc['query']);_0x2d51d9[_0x9f0a('0x41')]=_['intersection'](_0x2d51d9[_0x9f0a('0x3e')],_0x2d51d9[_0x9f0a('0x40')]);_0xf326e8[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x2d51d9[_0x9f0a('0x3e')],qs[_0x9f0a('0x43')](_0x38cffc[_0x9f0a('0x40')]['fields']));_0xf326e8[_0x9f0a('0x42')]=_0xf326e8[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0xf326e8[_0x9f0a('0x42')]:_0x2d51d9[_0x9f0a('0x3e')];_0xf326e8[_0x9f0a('0x48')]=qs[_0x9f0a('0x49')](_0x38cffc['query'][_0x9f0a('0x49')]);_0xf326e8['where']=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x38cffc[_0x9f0a('0x40')],_0x2d51d9[_0x9f0a('0x41')]));if(_0x38cffc['query']['filter']){_0xf326e8[_0x9f0a('0x4a')]=_['merge'](_0xf326e8[_0x9f0a('0x4a')],{'$or':_[_0x9f0a('0x39')](_0xf326e8['attributes'],function(_0x2ceb0d){var _0x209593={};_0x209593[_0x2ceb0d]={'$like':'%'+_0x38cffc['query'][_0x9f0a('0x4c')]+'%'};return _0x209593;})});}_0xf326e8=_[_0x9f0a('0x4d')]({},_0xf326e8,_0x38cffc[_0x9f0a('0x57')]);return _0xaba9d1[_0x9f0a('0x5e')](_0xf326e8);}})[_0x9f0a('0x52')](function(_0x22fe4a){if(_0x22fe4a){_0xeba8f1=_0x22fe4a[_0x9f0a('0x44')];if(!_0x38cffc[_0x9f0a('0x40')][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0xf326e8[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x38cffc[_0x9f0a('0x40')]['limit']);_0xf326e8[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0x38cffc[_0x9f0a('0x40')][_0x9f0a('0x31')]);}return _0xaba9d1['getSubjects'](_0xf326e8);}})['then'](function(_0x2e6b31){if(_0x2e6b31){return _0x2e6b31?{'count':_0xeba8f1,'rows':_0x2e6b31}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x4e5179,null))[_0x9f0a('0x54')](handleError(_0x4e5179,null));};exports[_0x9f0a('0x60')]=function(_0x6e5053,_0x5568e3,_0x4afd3b){var _0x108081={};var _0x4485da={};var _0x55b702;var _0x4b7b9f;return db[_0x9f0a('0x3a')][_0x9f0a('0x5f')]({'where':{'id':_0x6e5053[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x5568e3,null))[_0x9f0a('0x52')](function(_0x4a0bfa){if(_0x4a0bfa){_0x55b702=_0x4a0bfa;_0x4485da[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db[_0x9f0a('0x5d')][_0x9f0a('0x61')]);_0x4485da[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x6e5053[_0x9f0a('0x40')]);_0x4485da['filters']=_[_0x9f0a('0x56')](_0x4485da[_0x9f0a('0x3e')],_0x4485da[_0x9f0a('0x40')]);_0x108081[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x4485da[_0x9f0a('0x3e')],qs[_0x9f0a('0x43')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x43')]));_0x108081[_0x9f0a('0x42')]=_0x108081[_0x9f0a('0x42')]['length']?_0x108081['attributes']:_0x4485da[_0x9f0a('0x3e')];_0x108081['order']=qs[_0x9f0a('0x49')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x108081[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x6e5053[_0x9f0a('0x40')],_0x4485da['filters']));if(_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x108081[_0x9f0a('0x4a')]=_[_0x9f0a('0x4d')](_0x108081['where'],{'$or':_[_0x9f0a('0x39')](_0x108081[_0x9f0a('0x42')],function(_0x1db22b){var _0x5811eb={};_0x5811eb[_0x1db22b]={'$like':'%'+_0x6e5053['query'][_0x9f0a('0x4c')]+'%'};return _0x5811eb;})});}_0x108081=_['merge']({},_0x108081,_0x6e5053[_0x9f0a('0x57')]);return _0x55b702[_0x9f0a('0x60')](_0x108081);}})[_0x9f0a('0x52')](function(_0x38f772){if(_0x38f772){_0x4b7b9f=_0x38f772['length'];if(!_0x6e5053['query'][_0x9f0a('0x45')](_0x9f0a('0x46'))){_0x108081[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x6e5053[_0x9f0a('0x40')][_0x9f0a('0x47')]);_0x108081['offset']=qs[_0x9f0a('0x31')](_0x6e5053['query'][_0x9f0a('0x31')]);}return _0x55b702[_0x9f0a('0x60')](_0x108081);}})[_0x9f0a('0x52')](function(_0x5e5397){if(_0x5e5397){return _0x5e5397?{'count':_0x4b7b9f,'rows':_0x5e5397}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x5568e3,null))['catch'](handleError(_0x5568e3,null));};exports['getTags']=function(_0x13e463,_0x3ce9a2,_0x2ed99c){var _0x2c5e81={};var _0x60980b={};var _0x43604b;var _0x28f7d8;return db[_0x9f0a('0x3a')][_0x9f0a('0x5f')]({'where':{'id':_0x13e463[_0x9f0a('0x55')]['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x3ce9a2,null))[_0x9f0a('0x52')](function(_0x27624e){if(_0x27624e){_0x43604b=_0x27624e;_0x60980b[_0x9f0a('0x3e')]=_[_0x9f0a('0x3f')](db['Tag'][_0x9f0a('0x61')]);_0x60980b[_0x9f0a('0x40')]=_[_0x9f0a('0x3f')](_0x13e463[_0x9f0a('0x40')]);_0x60980b[_0x9f0a('0x41')]=_[_0x9f0a('0x56')](_0x60980b[_0x9f0a('0x3e')],_0x60980b[_0x9f0a('0x40')]);_0x2c5e81[_0x9f0a('0x42')]=_[_0x9f0a('0x56')](_0x60980b['model'],qs[_0x9f0a('0x43')](_0x13e463['query'][_0x9f0a('0x43')]));_0x2c5e81[_0x9f0a('0x42')]=_0x2c5e81[_0x9f0a('0x42')][_0x9f0a('0x44')]?_0x2c5e81['attributes']:_0x60980b[_0x9f0a('0x3e')];_0x2c5e81['order']=qs[_0x9f0a('0x49')](_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x49')]);_0x2c5e81[_0x9f0a('0x4a')]=qs[_0x9f0a('0x41')](_[_0x9f0a('0x4b')](_0x13e463[_0x9f0a('0x40')],_0x60980b[_0x9f0a('0x41')]));if(_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x4c')]){_0x2c5e81[_0x9f0a('0x4a')]=_['merge'](_0x2c5e81['where'],{'$or':_['map'](_0x2c5e81[_0x9f0a('0x42')],function(_0xc5f06d){var _0x2cc15e={};_0x2cc15e[_0xc5f06d]={'$like':'%'+_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x4c')]+'%'};return _0x2cc15e;})});}_0x2c5e81=_[_0x9f0a('0x4d')]({},_0x2c5e81,_0x13e463[_0x9f0a('0x57')]);return _0x43604b[_0x9f0a('0x62')](_0x2c5e81);}})[_0x9f0a('0x52')](function(_0x36fe49){if(_0x36fe49){_0x28f7d8=_0x36fe49[_0x9f0a('0x44')];if(!_0x13e463[_0x9f0a('0x40')]['hasOwnProperty'](_0x9f0a('0x46'))){_0x2c5e81[_0x9f0a('0x47')]=qs[_0x9f0a('0x47')](_0x13e463['query']['limit']);_0x2c5e81[_0x9f0a('0x31')]=qs[_0x9f0a('0x31')](_0x13e463[_0x9f0a('0x40')][_0x9f0a('0x31')]);}return _0x43604b[_0x9f0a('0x62')](_0x2c5e81);}})[_0x9f0a('0x52')](function(_0x241c7a){if(_0x241c7a){return _0x241c7a?{'count':_0x28f7d8,'rows':_0x241c7a}:null;}})[_0x9f0a('0x52')](respondWithResult(_0x3ce9a2,null))[_0x9f0a('0x54')](handleError(_0x3ce9a2,null));};exports[_0x9f0a('0x63')]=function(_0x1fcdae,_0x4fab1a,_0x120516){if(_0x1fcdae[_0x9f0a('0x5a')]['id']){delete _0x1fcdae[_0x9f0a('0x5a')]['id'];}return db[_0x9f0a('0x3a')]['findOne']({'where':{'id':_0x1fcdae['params']['id']}})[_0x9f0a('0x52')](handleEntityNotFound(_0x4fab1a,null))[_0x9f0a('0x52')](function(_0xd9004a){if(_0xd9004a){return _0xd9004a[_0x9f0a('0x63')](_0x1fcdae[_0x9f0a('0x5a')]['ids']||[]);}return null;})[_0x9f0a('0x52')](respondWithResult(_0x4fab1a,null))['catch'](handleError(_0x4fab1a,null));}; \ No newline at end of file +var _0x4d1a=['find','create','body','findOne','ZendeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../mysqldb','test','Sequelize','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x29617f,_0x35d1bf){var _0x1d02c8=function(_0x1754e4){while(--_0x1754e4){_0x29617f['push'](_0x29617f['shift']());}};_0x1d02c8(++_0x35d1bf);}(_0x4d1a,0x17c));var _0xa4d1=function(_0x2f288a,_0x329910){_0x2f288a=_0x2f288a-0x0;var _0x32dec3=_0x4d1a[_0x2f288a];return _0x32dec3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa4d1('0x0'));var rimraf=require(_0xa4d1('0x1'));var zipdir=require(_0xa4d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa4d1('0x3'));var moment=require('moment');var BPromise=require(_0xa4d1('0x4'));var Mustache=require(_0xa4d1('0x5'));var util=require(_0xa4d1('0x6'));var path=require(_0xa4d1('0x7'));var sox=require(_0xa4d1('0x8'));var csv=require(_0xa4d1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa4d1('0xa'));var squel=require(_0xa4d1('0xb'));var crypto=require(_0xa4d1('0xc'));var jsforce=require(_0xa4d1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa4d1('0xe'));var Redis=require(_0xa4d1('0xf'));var authService=require(_0xa4d1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4d1('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa4d1('0x12'));var config=require('../../config/environment');var db=require(_0xa4d1('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x58eaaf,_0x5a5a09,_0x5ffebd){if(_0x5ffebd){var _0x2da89b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2da89b[_0xa4d1('0x14')](_0x5a5a09)){return _0x58eaaf;}else{throw new db[(_0xa4d1('0x15'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x58eaaf;}}function respondWithRpcPromise(_0x5692fa,_0xe4c565,_0x18e3c7,_0x3fb0f4){return new BPromise(function(_0x557390,_0x2d13f4){var _0x17596e=_0x3fb0f4||client;return _0x17596e[_0xa4d1('0x16')](_0x5692fa,_0x18e3c7)['then'](function(_0x580f83){logger[_0xa4d1('0x17')]('ZendeskConfiguration,\x20%s,\x20%s',_0xe4c565,_0xa4d1('0x18'));logger[_0xa4d1('0x19')](_0xa4d1('0x1a'),_0xe4c565,'request\x20sent',JSON[_0xa4d1('0x1b')](_0x580f83));if(_0x580f83[_0xa4d1('0x1c')]){if(_0x580f83['error'][_0xa4d1('0x1d')]===0x1f4){logger['error'](_0xa4d1('0x1e'),_0xe4c565,_0x580f83['error'][_0xa4d1('0x1f')]);return _0x2d13f4(_0x580f83[_0xa4d1('0x1c')][_0xa4d1('0x1f')]);}logger[_0xa4d1('0x1c')](_0xa4d1('0x1e'),_0xe4c565,_0x580f83['error']['message']);return _0x557390(_0x580f83['error'][_0xa4d1('0x1f')]);}else{logger[_0xa4d1('0x17')](_0xa4d1('0x1e'),_0xe4c565,'request\x20sent');_0x557390(_0x580f83[_0xa4d1('0x20')][_0xa4d1('0x1f')]);}})[_0xa4d1('0x21')](function(_0x4a0759){logger[_0xa4d1('0x1c')](_0xa4d1('0x1e'),_0xe4c565,_0x4a0759);_0x2d13f4(_0x4a0759);});});}function respondWithStatusCode(_0x2a06b1,_0x481ebf){_0x481ebf=_0x481ebf||0xcc;return function(_0x5e037f){if(_0x5e037f){return _0x2a06b1['sendStatus'](_0x481ebf);}return _0x2a06b1[_0xa4d1('0x22')](_0x481ebf)[_0xa4d1('0x23')]();};}function respondWithResult(_0x13a8df,_0x3d7b26){_0x3d7b26=_0x3d7b26||0xc8;return function(_0x4631f0){if(_0x4631f0){return _0x13a8df[_0xa4d1('0x22')](_0x3d7b26)['json'](_0x4631f0);}};}function respondWithFilteredResult(_0x1af06d,_0x4773ba){return function(_0x31aa58){if(_0x31aa58){var _0x4b93fd=_0x31aa58[_0xa4d1('0x24')],_0x5d1446=_0x4773ba['offset'],_0x55da1f=_0x4773ba[_0xa4d1('0x25')]+_0x4773ba[_0xa4d1('0x26')],_0x56d764;if(_0x55da1f>=_0x4b93fd){_0x55da1f=_0x4b93fd;_0x56d764=0xc8;}else{_0x56d764=0xce;}_0x1af06d[_0xa4d1('0x22')](_0x56d764);return _0x1af06d[_0xa4d1('0x27')](_0xa4d1('0x28'),_0x5d1446+'-'+_0x55da1f+'/'+_0x4b93fd)[_0xa4d1('0x29')](_0x31aa58);}return null;};}function patchUpdates(_0x58a9fc){return function(_0x47aab0){try{jsonpatch['apply'](_0x47aab0,_0x58a9fc,!![]);}catch(_0x213a08){return BPromise[_0xa4d1('0x2a')](_0x213a08);}return _0x47aab0[_0xa4d1('0x2b')]();};}function saveUpdates(_0x2c8a02,_0x516f3e){return function(_0x334e4a){if(_0x334e4a){return _0x334e4a['update'](_0x2c8a02)[_0xa4d1('0x2c')](function(_0x35c530){return _0x35c530;});}return null;};}function removeEntity(_0xe2b20c,_0x4483d4){return function(_0x37d0ee){if(_0x37d0ee){return _0x37d0ee[_0xa4d1('0x2d')]()['then'](function(){_0xe2b20c[_0xa4d1('0x22')](0xcc)[_0xa4d1('0x23')]();});}};}function handleEntityNotFound(_0x4f1920,_0x54f9cc){return function(_0x57d69f){if(!_0x57d69f){_0x4f1920[_0xa4d1('0x2e')](0x194);}return _0x57d69f;};}function handleError(_0x2289a7,_0x3e2518){_0x3e2518=_0x3e2518||0x1f4;return function(_0xd0d962){logger[_0xa4d1('0x1c')](_0xd0d962[_0xa4d1('0x2f')]);if(_0xd0d962[_0xa4d1('0x30')]){delete _0xd0d962[_0xa4d1('0x30')];}_0x2289a7[_0xa4d1('0x22')](_0x3e2518)[_0xa4d1('0x31')](_0xd0d962);};}exports[_0xa4d1('0x32')]=function(_0x581e6b,_0x51eab9){var _0x41008a={},_0x401d2b={},_0x4d20a3={'count':0x0,'rows':[]};var _0x3065fb=_[_0xa4d1('0x33')](db[_0xa4d1('0x34')][_0xa4d1('0x35')],function(_0x3c212e){return{'name':_0x3c212e[_0xa4d1('0x36')],'type':_0x3c212e[_0xa4d1('0x37')][_0xa4d1('0x38')]};});_0x401d2b[_0xa4d1('0x39')]=_['map'](_0x3065fb,_0xa4d1('0x30'));_0x401d2b['query']=_[_0xa4d1('0x3a')](_0x581e6b['query']);_0x401d2b['filters']=_[_0xa4d1('0x3b')](_0x401d2b[_0xa4d1('0x39')],_0x401d2b[_0xa4d1('0x3c')]);_0x41008a[_0xa4d1('0x3d')]=_['intersection'](_0x401d2b[_0xa4d1('0x39')],qs[_0xa4d1('0x3e')](_0x581e6b[_0xa4d1('0x3c')][_0xa4d1('0x3e')]));_0x41008a[_0xa4d1('0x3d')]=_0x41008a[_0xa4d1('0x3d')]['length']?_0x41008a[_0xa4d1('0x3d')]:_0x401d2b['model'];if(!_0x581e6b['query'][_0xa4d1('0x3f')](_0xa4d1('0x40'))){_0x41008a['limit']=qs[_0xa4d1('0x26')](_0x581e6b[_0xa4d1('0x3c')]['limit']);_0x41008a['offset']=qs[_0xa4d1('0x25')](_0x581e6b[_0xa4d1('0x3c')][_0xa4d1('0x25')]);}_0x41008a['order']=qs[_0xa4d1('0x41')](_0x581e6b[_0xa4d1('0x3c')][_0xa4d1('0x41')]);_0x41008a[_0xa4d1('0x42')]=qs[_0xa4d1('0x43')](_[_0xa4d1('0x44')](_0x581e6b[_0xa4d1('0x3c')],_0x401d2b[_0xa4d1('0x43')]),_0x3065fb);if(_0x581e6b[_0xa4d1('0x3c')][_0xa4d1('0x45')]){_0x41008a['where']=_[_0xa4d1('0x46')](_0x41008a[_0xa4d1('0x42')],{'$or':_[_0xa4d1('0x33')](_0x3065fb,function(_0xe8e278){if(_0xe8e278[_0xa4d1('0x37')]!==_0xa4d1('0x47')){var _0x56b78e={};_0x56b78e[_0xe8e278['name']]={'$like':'%'+_0x581e6b[_0xa4d1('0x3c')]['filter']+'%'};return _0x56b78e;}})});}_0x41008a=_[_0xa4d1('0x46')]({},_0x41008a,_0x581e6b[_0xa4d1('0x48')]);var _0x3f5a93={'where':_0x41008a[_0xa4d1('0x42')]};return db['ZendeskConfiguration']['count'](_0x3f5a93)[_0xa4d1('0x2c')](function(_0xe087f9){_0x4d20a3[_0xa4d1('0x24')]=_0xe087f9;if(_0x581e6b['query'][_0xa4d1('0x49')]){_0x41008a[_0xa4d1('0x4a')]=[{'all':!![]}];}return db[_0xa4d1('0x34')][_0xa4d1('0x4b')](_0x41008a);})[_0xa4d1('0x2c')](function(_0x21f9c0){_0x4d20a3[_0xa4d1('0x4c')]=_0x21f9c0;return _0x4d20a3;})[_0xa4d1('0x2c')](respondWithFilteredResult(_0x51eab9,_0x41008a))[_0xa4d1('0x21')](handleError(_0x51eab9,null));};exports[_0xa4d1('0x4d')]=function(_0x3ca309,_0x5e13ad){var _0xcfd43={'raw':![],'where':{'id':_0x3ca309[_0xa4d1('0x4e')]['id']}},_0x349b70={};_0x349b70[_0xa4d1('0x39')]=_[_0xa4d1('0x3a')](db[_0xa4d1('0x34')]['rawAttributes']);_0x349b70['query']=_[_0xa4d1('0x3a')](_0x3ca309[_0xa4d1('0x3c')]);_0x349b70[_0xa4d1('0x43')]=_[_0xa4d1('0x3b')](_0x349b70[_0xa4d1('0x39')],_0x349b70[_0xa4d1('0x3c')]);_0xcfd43[_0xa4d1('0x3d')]=_[_0xa4d1('0x3b')](_0x349b70[_0xa4d1('0x39')],qs[_0xa4d1('0x3e')](_0x3ca309['query'][_0xa4d1('0x3e')]));_0xcfd43[_0xa4d1('0x3d')]=_0xcfd43[_0xa4d1('0x3d')][_0xa4d1('0x4f')]?_0xcfd43[_0xa4d1('0x3d')]:_0x349b70[_0xa4d1('0x39')];if(_0x3ca309['query']['includeAll']){_0xcfd43[_0xa4d1('0x4a')]=[{'all':!![]}];}_0xcfd43=_['merge']({},_0xcfd43,_0x3ca309[_0xa4d1('0x48')]);return db[_0xa4d1('0x34')][_0xa4d1('0x50')](_0xcfd43)['then'](handleEntityNotFound(_0x5e13ad,null))[_0xa4d1('0x2c')](respondWithResult(_0x5e13ad,null))[_0xa4d1('0x21')](handleError(_0x5e13ad,null));};exports[_0xa4d1('0x51')]=function(_0x232a5e,_0x14bf27){return db[_0xa4d1('0x34')][_0xa4d1('0x51')](_0x232a5e[_0xa4d1('0x52')],{})[_0xa4d1('0x2c')](respondWithResult(_0x14bf27,0xc9))[_0xa4d1('0x21')](handleError(_0x14bf27,null));};exports['update']=function(_0x5063d9,_0x46f7eb){if(_0x5063d9[_0xa4d1('0x52')]['id']){delete _0x5063d9[_0xa4d1('0x52')]['id'];}return db[_0xa4d1('0x34')]['find']({'where':{'id':_0x5063d9[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x46f7eb,null))['then'](saveUpdates(_0x5063d9[_0xa4d1('0x52')],null))[_0xa4d1('0x2c')](respondWithResult(_0x46f7eb,null))[_0xa4d1('0x21')](handleError(_0x46f7eb,null));};exports[_0xa4d1('0x2d')]=function(_0x1daf91,_0x4906ef){return db[_0xa4d1('0x34')][_0xa4d1('0x50')]({'where':{'id':_0x1daf91[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x4906ef,null))[_0xa4d1('0x2c')](removeEntity(_0x4906ef,null))[_0xa4d1('0x21')](handleError(_0x4906ef,null));};exports['getFields']=function(_0xa1630b,_0x16baa1,_0x31310a){var _0x56b648={};var _0x3367dd={};var _0x73c6ce;var _0x27bb5d;return db[_0xa4d1('0x34')][_0xa4d1('0x53')]({'where':{'id':_0xa1630b[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x16baa1,null))['then'](function(_0x2e4938){if(_0x2e4938){_0x73c6ce=_0x2e4938;_0x3367dd['model']=_[_0xa4d1('0x3a')](db[_0xa4d1('0x54')][_0xa4d1('0x35')]);_0x3367dd[_0xa4d1('0x3c')]=_[_0xa4d1('0x3a')](_0xa1630b[_0xa4d1('0x3c')]);_0x3367dd[_0xa4d1('0x43')]=_[_0xa4d1('0x3b')](_0x3367dd[_0xa4d1('0x39')],_0x3367dd[_0xa4d1('0x3c')]);_0x56b648['attributes']=_[_0xa4d1('0x3b')](_0x3367dd[_0xa4d1('0x39')],qs['fields'](_0xa1630b[_0xa4d1('0x3c')][_0xa4d1('0x3e')]));_0x56b648[_0xa4d1('0x3d')]=_0x56b648['attributes']['length']?_0x56b648['attributes']:_0x3367dd[_0xa4d1('0x39')];_0x56b648[_0xa4d1('0x55')]=qs['sort'](_0xa1630b['query'][_0xa4d1('0x41')]);_0x56b648[_0xa4d1('0x42')]=qs[_0xa4d1('0x43')](_[_0xa4d1('0x44')](_0xa1630b[_0xa4d1('0x3c')],_0x3367dd[_0xa4d1('0x43')]));if(_0xa1630b[_0xa4d1('0x3c')][_0xa4d1('0x45')]){_0x56b648[_0xa4d1('0x42')]=_[_0xa4d1('0x46')](_0x56b648['where'],{'$or':_[_0xa4d1('0x33')](_0x56b648['attributes'],function(_0x42aae0){var _0x5b030f={};_0x5b030f[_0x42aae0]={'$like':'%'+_0xa1630b[_0xa4d1('0x3c')][_0xa4d1('0x45')]+'%'};return _0x5b030f;})});}_0x56b648=_[_0xa4d1('0x46')]({},_0x56b648,_0xa1630b['options']);return _0x73c6ce[_0xa4d1('0x56')](_0x56b648);}})[_0xa4d1('0x2c')](function(_0xf71b3){if(_0xf71b3){_0x27bb5d=_0xf71b3[_0xa4d1('0x4f')];if(!_0xa1630b[_0xa4d1('0x3c')][_0xa4d1('0x3f')]('nolimit')){_0x56b648['limit']=qs[_0xa4d1('0x26')](_0xa1630b[_0xa4d1('0x3c')][_0xa4d1('0x26')]);_0x56b648['offset']=qs[_0xa4d1('0x25')](_0xa1630b['query'][_0xa4d1('0x25')]);}return _0x73c6ce[_0xa4d1('0x56')](_0x56b648);}})['then'](function(_0x4173bb){if(_0x4173bb){return _0x4173bb?{'count':_0x27bb5d,'rows':_0x4173bb}:null;}})[_0xa4d1('0x2c')](respondWithResult(_0x16baa1,null))[_0xa4d1('0x21')](handleError(_0x16baa1,null));};exports['getSubjects']=function(_0x1fe51d,_0x103a3f,_0x2479c8){var _0x1ace15={};var _0x1a2a88={};var _0x30ae76;var _0x44bdc3;return db[_0xa4d1('0x34')]['findOne']({'where':{'id':_0x1fe51d[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x103a3f,null))[_0xa4d1('0x2c')](function(_0x3d0df2){if(_0x3d0df2){_0x30ae76=_0x3d0df2;_0x1a2a88['model']=_[_0xa4d1('0x3a')](db['ZendeskField'][_0xa4d1('0x35')]);_0x1a2a88['query']=_[_0xa4d1('0x3a')](_0x1fe51d[_0xa4d1('0x3c')]);_0x1a2a88[_0xa4d1('0x43')]=_[_0xa4d1('0x3b')](_0x1a2a88[_0xa4d1('0x39')],_0x1a2a88['query']);_0x1ace15[_0xa4d1('0x3d')]=_[_0xa4d1('0x3b')](_0x1a2a88['model'],qs['fields'](_0x1fe51d[_0xa4d1('0x3c')][_0xa4d1('0x3e')]));_0x1ace15[_0xa4d1('0x3d')]=_0x1ace15[_0xa4d1('0x3d')][_0xa4d1('0x4f')]?_0x1ace15['attributes']:_0x1a2a88['model'];_0x1ace15[_0xa4d1('0x55')]=qs[_0xa4d1('0x41')](_0x1fe51d[_0xa4d1('0x3c')]['sort']);_0x1ace15['where']=qs[_0xa4d1('0x43')](_[_0xa4d1('0x44')](_0x1fe51d[_0xa4d1('0x3c')],_0x1a2a88[_0xa4d1('0x43')]));if(_0x1fe51d[_0xa4d1('0x3c')][_0xa4d1('0x45')]){_0x1ace15['where']=_['merge'](_0x1ace15[_0xa4d1('0x42')],{'$or':_['map'](_0x1ace15[_0xa4d1('0x3d')],function(_0x35a00e){var _0x24effd={};_0x24effd[_0x35a00e]={'$like':'%'+_0x1fe51d['query'][_0xa4d1('0x45')]+'%'};return _0x24effd;})});}_0x1ace15=_[_0xa4d1('0x46')]({},_0x1ace15,_0x1fe51d['options']);return _0x30ae76[_0xa4d1('0x57')](_0x1ace15);}})['then'](function(_0x6e213d){if(_0x6e213d){_0x44bdc3=_0x6e213d[_0xa4d1('0x4f')];if(!_0x1fe51d[_0xa4d1('0x3c')][_0xa4d1('0x3f')](_0xa4d1('0x40'))){_0x1ace15[_0xa4d1('0x26')]=qs['limit'](_0x1fe51d[_0xa4d1('0x3c')][_0xa4d1('0x26')]);_0x1ace15[_0xa4d1('0x25')]=qs[_0xa4d1('0x25')](_0x1fe51d[_0xa4d1('0x3c')][_0xa4d1('0x25')]);}return _0x30ae76[_0xa4d1('0x57')](_0x1ace15);}})['then'](function(_0x5dc5f7){if(_0x5dc5f7){return _0x5dc5f7?{'count':_0x44bdc3,'rows':_0x5dc5f7}:null;}})[_0xa4d1('0x2c')](respondWithResult(_0x103a3f,null))['catch'](handleError(_0x103a3f,null));};exports['getDescriptions']=function(_0x3ae8e9,_0x219700,_0x38c830){var _0x270db1={};var _0x38b830={};var _0x6ff9cb;var _0x151409;return db[_0xa4d1('0x34')][_0xa4d1('0x53')]({'where':{'id':_0x3ae8e9[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x219700,null))[_0xa4d1('0x2c')](function(_0x463423){if(_0x463423){_0x6ff9cb=_0x463423;_0x38b830['model']=_['keys'](db['ZendeskField'][_0xa4d1('0x35')]);_0x38b830[_0xa4d1('0x3c')]=_[_0xa4d1('0x3a')](_0x3ae8e9['query']);_0x38b830[_0xa4d1('0x43')]=_[_0xa4d1('0x3b')](_0x38b830['model'],_0x38b830[_0xa4d1('0x3c')]);_0x270db1[_0xa4d1('0x3d')]=_[_0xa4d1('0x3b')](_0x38b830[_0xa4d1('0x39')],qs['fields'](_0x3ae8e9[_0xa4d1('0x3c')][_0xa4d1('0x3e')]));_0x270db1[_0xa4d1('0x3d')]=_0x270db1[_0xa4d1('0x3d')][_0xa4d1('0x4f')]?_0x270db1[_0xa4d1('0x3d')]:_0x38b830[_0xa4d1('0x39')];_0x270db1['order']=qs[_0xa4d1('0x41')](_0x3ae8e9[_0xa4d1('0x3c')]['sort']);_0x270db1[_0xa4d1('0x42')]=qs['filters'](_[_0xa4d1('0x44')](_0x3ae8e9[_0xa4d1('0x3c')],_0x38b830[_0xa4d1('0x43')]));if(_0x3ae8e9[_0xa4d1('0x3c')][_0xa4d1('0x45')]){_0x270db1[_0xa4d1('0x42')]=_[_0xa4d1('0x46')](_0x270db1[_0xa4d1('0x42')],{'$or':_['map'](_0x270db1[_0xa4d1('0x3d')],function(_0x5b49bd){var _0x4fe761={};_0x4fe761[_0x5b49bd]={'$like':'%'+_0x3ae8e9['query'][_0xa4d1('0x45')]+'%'};return _0x4fe761;})});}_0x270db1=_['merge']({},_0x270db1,_0x3ae8e9[_0xa4d1('0x48')]);return _0x6ff9cb[_0xa4d1('0x58')](_0x270db1);}})['then'](function(_0x2f44e5){if(_0x2f44e5){_0x151409=_0x2f44e5[_0xa4d1('0x4f')];if(!_0x3ae8e9['query'][_0xa4d1('0x3f')](_0xa4d1('0x40'))){_0x270db1[_0xa4d1('0x26')]=qs[_0xa4d1('0x26')](_0x3ae8e9[_0xa4d1('0x3c')]['limit']);_0x270db1['offset']=qs['offset'](_0x3ae8e9[_0xa4d1('0x3c')][_0xa4d1('0x25')]);}return _0x6ff9cb['getDescriptions'](_0x270db1);}})['then'](function(_0x5383b8){if(_0x5383b8){return _0x5383b8?{'count':_0x151409,'rows':_0x5383b8}:null;}})[_0xa4d1('0x2c')](respondWithResult(_0x219700,null))[_0xa4d1('0x21')](handleError(_0x219700,null));};exports[_0xa4d1('0x59')]=function(_0xd65e90,_0x1c35bd,_0x235c86){var _0xed08dc={};var _0x52e77e={};var _0x9f57da;var _0x3512ff;return db[_0xa4d1('0x34')][_0xa4d1('0x53')]({'where':{'id':_0xd65e90[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x1c35bd,null))[_0xa4d1('0x2c')](function(_0x2b534e){if(_0x2b534e){_0x9f57da=_0x2b534e;_0x52e77e[_0xa4d1('0x39')]=_['keys'](db[_0xa4d1('0x5a')]['rawAttributes']);_0x52e77e[_0xa4d1('0x3c')]=_['keys'](_0xd65e90[_0xa4d1('0x3c')]);_0x52e77e[_0xa4d1('0x43')]=_[_0xa4d1('0x3b')](_0x52e77e[_0xa4d1('0x39')],_0x52e77e[_0xa4d1('0x3c')]);_0xed08dc[_0xa4d1('0x3d')]=_['intersection'](_0x52e77e[_0xa4d1('0x39')],qs[_0xa4d1('0x3e')](_0xd65e90[_0xa4d1('0x3c')]['fields']));_0xed08dc['attributes']=_0xed08dc[_0xa4d1('0x3d')][_0xa4d1('0x4f')]?_0xed08dc[_0xa4d1('0x3d')]:_0x52e77e[_0xa4d1('0x39')];_0xed08dc['order']=qs[_0xa4d1('0x41')](_0xd65e90['query'][_0xa4d1('0x41')]);_0xed08dc['where']=qs['filters'](_[_0xa4d1('0x44')](_0xd65e90['query'],_0x52e77e['filters']));if(_0xd65e90[_0xa4d1('0x3c')]['filter']){_0xed08dc['where']=_['merge'](_0xed08dc[_0xa4d1('0x42')],{'$or':_[_0xa4d1('0x33')](_0xed08dc[_0xa4d1('0x3d')],function(_0x51e18a){var _0x39bbbe={};_0x39bbbe[_0x51e18a]={'$like':'%'+_0xd65e90[_0xa4d1('0x3c')][_0xa4d1('0x45')]+'%'};return _0x39bbbe;})});}_0xed08dc=_[_0xa4d1('0x46')]({},_0xed08dc,_0xd65e90['options']);return _0x9f57da[_0xa4d1('0x59')](_0xed08dc);}})[_0xa4d1('0x2c')](function(_0x290c0a){if(_0x290c0a){_0x3512ff=_0x290c0a[_0xa4d1('0x4f')];if(!_0xd65e90[_0xa4d1('0x3c')][_0xa4d1('0x3f')]('nolimit')){_0xed08dc[_0xa4d1('0x26')]=qs[_0xa4d1('0x26')](_0xd65e90[_0xa4d1('0x3c')]['limit']);_0xed08dc['offset']=qs[_0xa4d1('0x25')](_0xd65e90[_0xa4d1('0x3c')][_0xa4d1('0x25')]);}return _0x9f57da[_0xa4d1('0x59')](_0xed08dc);}})['then'](function(_0xbc8b1a){if(_0xbc8b1a){return _0xbc8b1a?{'count':_0x3512ff,'rows':_0xbc8b1a}:null;}})['then'](respondWithResult(_0x1c35bd,null))[_0xa4d1('0x21')](handleError(_0x1c35bd,null));};exports['setTags']=function(_0x20735c,_0x52b41d,_0x3c584a){if(_0x20735c[_0xa4d1('0x52')]['id']){delete _0x20735c['body']['id'];}return db['ZendeskConfiguration'][_0xa4d1('0x53')]({'where':{'id':_0x20735c[_0xa4d1('0x4e')]['id']}})[_0xa4d1('0x2c')](handleEntityNotFound(_0x52b41d,null))[_0xa4d1('0x2c')](function(_0x5bd04a){if(_0x5bd04a){return _0x5bd04a[_0xa4d1('0x5b')](_0x20735c[_0xa4d1('0x52')]['ids']||[]);}return null;})[_0xa4d1('0x2c')](respondWithResult(_0x52b41d,null))[_0xa4d1('0x21')](handleError(_0x52b41d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index b94329f..a7ba397 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 _0x7a96=['api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x7a96,0xb3));var _0x67a9=function(_0x57062a,_0x123026){_0x57062a=_0x57062a-0x0;var _0xa178da=_0x7a96[_0x57062a];return _0xa178da;};'use strict';var _=require('lodash');var util=require(_0x67a9('0x0'));var logger=require('../../config/logger')(_0x67a9('0x1'));var moment=require(_0x67a9('0x2'));var BPromise=require(_0x67a9('0x3'));var rp=require(_0x67a9('0x4'));var fs=require('fs');var path=require(_0x67a9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x67a9('0x6'));module[_0x67a9('0x7')]=function(_0x217ea4,_0x360c65){return _0x217ea4[_0x67a9('0x8')](_0x67a9('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffed=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0xffed,0x14d));var _0xdffe=function(_0xcb7038,_0x4d1a62){_0xcb7038=_0xcb7038-0x0;var _0x524703=_0xffed[_0xcb7038];return _0x524703;};'use strict';var _=require(_0xdffe('0x0'));var util=require(_0xdffe('0x1'));var logger=require(_0xdffe('0x2'))(_0xdffe('0x3'));var moment=require(_0xdffe('0x4'));var BPromise=require(_0xdffe('0x5'));var rp=require(_0xdffe('0x6'));var fs=require('fs');var path=require(_0xdffe('0x7'));var rimraf=require(_0xdffe('0x8'));var config=require(_0xdffe('0x9'));var attributes=require(_0xdffe('0xa'));module[_0xdffe('0xb')]=function(_0x44a128,_0x35fb78){return _0x44a128['define'](_0xdffe('0xc'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index eb54aa8..c8110c9 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 _0x356d=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5ba820,_0x344a48){var _0x3d8804=function(_0x1ca44e){while(--_0x1ca44e){_0x5ba820['push'](_0x5ba820['shift']());}};_0x3d8804(++_0x344a48);}(_0x356d,0xba));var _0xd356=function(_0x2862b1,_0x51a367){_0x2862b1=_0x2862b1-0x0;var _0x817ee6=_0x356d[_0x2862b1];return _0x817ee6;};'use strict';var _=require(_0xd356('0x0'));var util=require('util');var moment=require(_0xd356('0x1'));var BPromise=require(_0xd356('0x2'));var rs=require(_0xd356('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd356('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd356('0x5'))('rpc');var config=require(_0xd356('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd356('0x7')][_0xd356('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f31a5,_0x2a4300,_0x2218f0){return new BPromise(function(_0x40de95,_0x359d25){return client[_0xd356('0x9')](_0x1f31a5,_0x2218f0)['then'](function(_0x402b95){logger[_0xd356('0xa')](_0xd356('0xb'),_0x2a4300,_0xd356('0xc'));logger[_0xd356('0xd')](_0xd356('0xe'),_0x2a4300,'request\x20sent',JSON[_0xd356('0xf')](_0x402b95));if(_0x402b95[_0xd356('0x10')]){if(_0x402b95[_0xd356('0x10')][_0xd356('0x11')]===0x1f4){logger[_0xd356('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2a4300,_0x402b95[_0xd356('0x10')]['message']);return _0x359d25(_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);}logger[_0xd356('0x10')](_0xd356('0xb'),_0x2a4300,_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);return _0x40de95(_0x402b95[_0xd356('0x10')][_0xd356('0x12')]);}else{logger[_0xd356('0xa')](_0xd356('0xb'),_0x2a4300,_0xd356('0xc'));_0x40de95(_0x402b95[_0xd356('0x13')][_0xd356('0x12')]);}})[_0xd356('0x14')](function(_0x155f23){logger['error'](_0xd356('0xb'),_0x2a4300,_0x155f23);_0x359d25(_0x155f23);});});} \ No newline at end of file +var _0xf56e=['result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xa3f274,_0x238e17){var _0x215afd=function(_0x247ff3){while(--_0x247ff3){_0xa3f274['push'](_0xa3f274['shift']());}};_0x215afd(++_0x238e17);}(_0xf56e,0xfe));var _0xef56=function(_0x19e915,_0x3ac017){_0x19e915=_0x19e915-0x0;var _0x23c76c=_0xf56e[_0x19e915];return _0x23c76c;};'use strict';var _=require(_0xef56('0x0'));var util=require('util');var moment=require(_0xef56('0x1'));var BPromise=require('bluebird');var rs=require(_0xef56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef56('0x3'))['db'];var utils=require(_0xef56('0x4'));var logger=require(_0xef56('0x5'))(_0xef56('0x6'));var config=require(_0xef56('0x7'));var jayson=require(_0xef56('0x8'));var client=jayson['client'][_0xef56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12e8f8,_0x2fb00b,_0x3c4c29){return new BPromise(function(_0x2354d2,_0x20a18f){return client[_0xef56('0xa')](_0x12e8f8,_0x3c4c29)['then'](function(_0x542c2d){logger[_0xef56('0xb')](_0xef56('0xc'),_0x2fb00b,_0xef56('0xd'));logger[_0xef56('0xe')](_0xef56('0xf'),_0x2fb00b,_0xef56('0xd'),JSON['stringify'](_0x542c2d));if(_0x542c2d[_0xef56('0x10')]){if(_0x542c2d[_0xef56('0x10')][_0xef56('0x11')]===0x1f4){logger[_0xef56('0x10')](_0xef56('0xc'),_0x2fb00b,_0x542c2d[_0xef56('0x10')][_0xef56('0x12')]);return _0x20a18f(_0x542c2d[_0xef56('0x10')][_0xef56('0x12')]);}logger[_0xef56('0x10')](_0xef56('0xc'),_0x2fb00b,_0x542c2d[_0xef56('0x10')][_0xef56('0x12')]);return _0x2354d2(_0x542c2d[_0xef56('0x10')]['message']);}else{logger[_0xef56('0xb')](_0xef56('0xc'),_0x2fb00b,_0xef56('0xd'));_0x2354d2(_0x542c2d[_0xef56('0x13')][_0xef56('0x12')]);}})[_0xef56('0x14')](function(_0x2c967c){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2fb00b,_0x2c967c);_0x20a18f(_0x2c967c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d331181..f1dbe89 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 _0x951a=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','show','put'];(function(_0x24bee7,_0x4d0347){var _0x447945=function(_0x49b14f){while(--_0x49b14f){_0x24bee7['push'](_0x24bee7['shift']());}};_0x447945(++_0x4d0347);}(_0x951a,0x101));var _0xa951=function(_0x26cf65,_0x5ce84b){_0x26cf65=_0x26cf65-0x0;var _0x3259c5=_0x951a[_0x26cf65];return _0x3259c5;};'use strict';var multer=require(_0xa951('0x0'));var util=require(_0xa951('0x1'));var path=require(_0xa951('0x2'));var timeout=require(_0xa951('0x3'));var express=require(_0xa951('0x4'));var router=express['Router']();var auth=require(_0xa951('0x5'));var interaction=require(_0xa951('0x6'));var config=require(_0xa951('0x7'));var controller=require(_0xa951('0x8'));router[_0xa951('0x9')]('/',auth[_0xa951('0xa')](),controller['index']);router[_0xa951('0x9')]('/:id',auth[_0xa951('0xa')](),controller[_0xa951('0xb')]);router['post']('/',auth[_0xa951('0xa')](),controller['create']);router[_0xa951('0xc')](_0xa951('0xd'),auth[_0xa951('0xa')](),controller[_0xa951('0xe')]);router[_0xa951('0xf')]('/:id',auth[_0xa951('0xa')](),controller[_0xa951('0x10')]);module[_0xa951('0x11')]=router; \ No newline at end of file +var _0xeea2=['delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x26b29a,_0x22ee6d){var _0x4daf57=function(_0x456b98){while(--_0x456b98){_0x26b29a['push'](_0x26b29a['shift']());}};_0x4daf57(++_0x22ee6d);}(_0xeea2,0xce));var _0x2eea=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xeea2[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x2eea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2eea('0x1'));var express=require(_0x2eea('0x2'));var router=express[_0x2eea('0x3')]();var auth=require(_0x2eea('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2eea('0x5'));var controller=require(_0x2eea('0x6'));router[_0x2eea('0x7')]('/',auth[_0x2eea('0x8')](),controller[_0x2eea('0x9')]);router['get'](_0x2eea('0xa'),auth[_0x2eea('0x8')](),controller[_0x2eea('0xb')]);router['post']('/',auth[_0x2eea('0x8')](),controller[_0x2eea('0xc')]);router[_0x2eea('0xd')](_0x2eea('0xa'),auth[_0x2eea('0x8')](),controller[_0x2eea('0xe')]);router[_0x2eea('0xf')](_0x2eea('0xa'),auth[_0x2eea('0x8')](),controller[_0x2eea('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 5071dbd..703890f 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 _0xdcf6=['string','variable','customVariable','keyValue','STRING','BOOLEAN','exports','ENUM'];(function(_0x4cd5d2,_0x53db42){var _0x5eb689=function(_0x431ae8){while(--_0x431ae8){_0x4cd5d2['push'](_0x4cd5d2['shift']());}};_0x5eb689(++_0x53db42);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x260e07,_0x2dd0e4){_0x260e07=_0x260e07-0x0;var _0x28ba4e=_0xdcf6[_0x260e07];return _0x28ba4e;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'type':{'type':Sequelize[_0x6dcf('0x1')](_0x6dcf('0x2'),_0x6dcf('0x3'),_0x6dcf('0x4'),_0x6dcf('0x5')),'defaultValue':_0x6dcf('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6dcf('0x6')]},'keyType':{'type':Sequelize[_0x6dcf('0x1')]('string',_0x6dcf('0x3'),_0x6dcf('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6dcf('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c94=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x4d12de,_0x57195d){var _0x162853=function(_0x32a81d){while(--_0x32a81d){_0x4d12de['push'](_0x4d12de['shift']());}};_0x162853(++_0x57195d);}(_0x3c94,0xcd));var _0x43c9=function(_0x1cd65a,_0x29fa8f){_0x1cd65a=_0x1cd65a-0x0;var _0xf93849=_0x3c94[_0x1cd65a];return _0xf93849;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'type':{'type':Sequelize[_0x43c9('0x2')](_0x43c9('0x3'),_0x43c9('0x4'),_0x43c9('0x5'),_0x43c9('0x6')),'defaultValue':_0x43c9('0x3')},'content':{'type':Sequelize[_0x43c9('0x7')]},'key':{'type':Sequelize[_0x43c9('0x7')]},'keyType':{'type':Sequelize[_0x43c9('0x2')](_0x43c9('0x3'),'variable',_0x43c9('0x5'))},'keyContent':{'type':Sequelize[_0x43c9('0x7')]},'idField':{'type':Sequelize[_0x43c9('0x7')]},'nameField':{'type':Sequelize[_0x43c9('0x7')]},'customField':{'type':Sequelize[_0x43c9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43c9('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index abb91ee..4ce82a7 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 _0xd535=['request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','includeAll','find','create','body','params','html-pdf','eml-format'];(function(_0x20fa82,_0x285243){var _0x544947=function(_0x33d0d3){while(--_0x33d0d3){_0x20fa82['push'](_0x20fa82['shift']());}};_0x544947(++_0x285243);}(_0xd535,0x161));var _0x5d53=function(_0x49f424,_0x8ced94){_0x49f424=_0x49f424-0x0;var _0x5305ed=_0xd535[_0x49f424];return _0x5305ed;};'use strict';var pdf=require(_0x5d53('0x0'));var emlformat=require(_0x5d53('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5d53('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d53('0x3'));var util=require(_0x5d53('0x4'));var path=require(_0x5d53('0x5'));var sox=require(_0x5d53('0x6'));var csv=require(_0x5d53('0x7'));var ejs=require(_0x5d53('0x8'));var fs=require('fs');var _=require(_0x5d53('0x9'));var squel=require(_0x5d53('0xa'));var crypto=require(_0x5d53('0xb'));var jsforce=require(_0x5d53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d53('0x7'));var querystring=require('querystring');var Papa=require(_0x5d53('0xd'));var Redis=require(_0x5d53('0xe'));var authService=require(_0x5d53('0xf'));var qs=require(_0x5d53('0x10'));var as=require(_0x5d53('0x11'));var hardwareService=require(_0x5d53('0x12'));var logger=require(_0x5d53('0x13'))(_0x5d53('0x14'));var utils=require(_0x5d53('0x15'));var config=require(_0x5d53('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31c9bc,_0x2dff7c){_0x2dff7c=_0x2dff7c||0xcc;return function(_0x1b9721){if(_0x1b9721){return _0x31c9bc[_0x5d53('0x17')](_0x2dff7c);}return _0x31c9bc[_0x5d53('0x18')](_0x2dff7c)[_0x5d53('0x19')]();};}function respondWithResult(_0x9822ad,_0x24e819){_0x24e819=_0x24e819||0xc8;return function(_0x3d7e34){if(_0x3d7e34){return _0x9822ad[_0x5d53('0x18')](_0x24e819)[_0x5d53('0x1a')](_0x3d7e34);}};}function respondWithFilteredResult(_0x1262d6,_0x3e8d72){return function(_0x336c39){if(_0x336c39){var _0x3c4143=_0x336c39['count'],_0x5f2453=_0x3e8d72[_0x5d53('0x1b')],_0x4e716b=_0x3e8d72[_0x5d53('0x1b')]+_0x3e8d72[_0x5d53('0x1c')],_0x894bcc;if(_0x4e716b>=_0x3c4143){_0x4e716b=_0x3c4143;_0x894bcc=0xc8;}else{_0x894bcc=0xce;}_0x1262d6[_0x5d53('0x18')](_0x894bcc);return _0x1262d6[_0x5d53('0x1d')](_0x5d53('0x1e'),_0x5f2453+'-'+_0x4e716b+'/'+_0x3c4143)[_0x5d53('0x1a')](_0x336c39);}return null;};}function patchUpdates(_0x33cdaa){return function(_0x2684bf){try{jsonpatch['apply'](_0x2684bf,_0x33cdaa,!![]);}catch(_0x264c18){return BPromise[_0x5d53('0x1f')](_0x264c18);}return _0x2684bf['save']();};}function saveUpdates(_0x44b614,_0x3d3e3d){return function(_0x5f4d6e){if(_0x5f4d6e){return _0x5f4d6e[_0x5d53('0x20')](_0x44b614)[_0x5d53('0x21')](function(_0xb06567){return _0xb06567;});}return null;};}function removeEntity(_0x1afcac,_0x1c26cf){return function(_0x438a61){if(_0x438a61){return _0x438a61[_0x5d53('0x22')]()['then'](function(){_0x1afcac[_0x5d53('0x18')](0xcc)[_0x5d53('0x19')]();});}};}function handleEntityNotFound(_0x3a4058,_0x441b66){return function(_0x39d964){if(!_0x39d964){_0x3a4058[_0x5d53('0x17')](0x194);}return _0x39d964;};}function handleError(_0x4c64ac,_0x96ea19){_0x96ea19=_0x96ea19||0x1f4;return function(_0xda339e){logger['error'](_0xda339e[_0x5d53('0x23')]);if(_0xda339e[_0x5d53('0x24')]){delete _0xda339e[_0x5d53('0x24')];}_0x4c64ac['status'](_0x96ea19)[_0x5d53('0x25')](_0xda339e);};}exports[_0x5d53('0x26')]=function(_0x46ad96,_0x19fb92){var _0x1b1abc={},_0x1cc864={},_0x5f336b={'count':0x0,'rows':[]};var _0x54f140=_[_0x5d53('0x27')](db[_0x5d53('0x28')][_0x5d53('0x29')],function(_0x4c2ee8){return{'name':_0x4c2ee8[_0x5d53('0x2a')],'type':_0x4c2ee8['type'][_0x5d53('0x2b')]};});_0x1cc864[_0x5d53('0x2c')]=_[_0x5d53('0x27')](_0x54f140,'name');_0x1cc864[_0x5d53('0x2d')]=_[_0x5d53('0x2e')](_0x46ad96['query']);_0x1cc864['filters']=_[_0x5d53('0x2f')](_0x1cc864['model'],_0x1cc864['query']);_0x1b1abc[_0x5d53('0x30')]=_[_0x5d53('0x2f')](_0x1cc864[_0x5d53('0x2c')],qs['fields'](_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x31')]));_0x1b1abc[_0x5d53('0x30')]=_0x1b1abc[_0x5d53('0x30')][_0x5d53('0x32')]?_0x1b1abc[_0x5d53('0x30')]:_0x1cc864[_0x5d53('0x2c')];if(!_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x33')](_0x5d53('0x34'))){_0x1b1abc['limit']=qs['limit'](_0x46ad96['query'][_0x5d53('0x1c')]);_0x1b1abc[_0x5d53('0x1b')]=qs[_0x5d53('0x1b')](_0x46ad96[_0x5d53('0x2d')]['offset']);}_0x1b1abc[_0x5d53('0x35')]=qs[_0x5d53('0x36')](_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x36')]);_0x1b1abc[_0x5d53('0x37')]=qs[_0x5d53('0x38')](_['pick'](_0x46ad96[_0x5d53('0x2d')],_0x1cc864[_0x5d53('0x38')]),_0x54f140);if(_0x46ad96['query'][_0x5d53('0x39')]){_0x1b1abc[_0x5d53('0x37')]=_[_0x5d53('0x3a')](_0x1b1abc['where'],{'$or':_[_0x5d53('0x27')](_0x54f140,function(_0x22fce9){if(_0x22fce9[_0x5d53('0x3b')]!==_0x5d53('0x3c')){var _0x334ba2={};_0x334ba2[_0x22fce9[_0x5d53('0x24')]]={'$like':'%'+_0x46ad96[_0x5d53('0x2d')][_0x5d53('0x39')]+'%'};return _0x334ba2;}})});}_0x1b1abc=_[_0x5d53('0x3a')]({},_0x1b1abc,_0x46ad96[_0x5d53('0x3d')]);var _0x5a4c06={'where':_0x1b1abc[_0x5d53('0x37')]};return db[_0x5d53('0x28')][_0x5d53('0x3e')](_0x5a4c06)[_0x5d53('0x21')](function(_0x3c766a){_0x5f336b[_0x5d53('0x3e')]=_0x3c766a;if(_0x46ad96['query']['includeAll']){_0x1b1abc[_0x5d53('0x3f')]=[{'all':!![]}];}return db[_0x5d53('0x28')][_0x5d53('0x40')](_0x1b1abc);})[_0x5d53('0x21')](function(_0x42bafe){_0x5f336b['rows']=_0x42bafe;return _0x5f336b;})[_0x5d53('0x21')](respondWithFilteredResult(_0x19fb92,_0x1b1abc))[_0x5d53('0x41')](handleError(_0x19fb92,null));};exports['show']=function(_0x3d5570,_0x3a3b3e){var _0x468a5b={'raw':!![],'where':{'id':_0x3d5570['params']['id']}},_0x557c69={};_0x557c69['model']=_[_0x5d53('0x2e')](db[_0x5d53('0x28')][_0x5d53('0x29')]);_0x557c69['query']=_[_0x5d53('0x2e')](_0x3d5570[_0x5d53('0x2d')]);_0x557c69[_0x5d53('0x38')]=_[_0x5d53('0x2f')](_0x557c69[_0x5d53('0x2c')],_0x557c69[_0x5d53('0x2d')]);_0x468a5b[_0x5d53('0x30')]=_[_0x5d53('0x2f')](_0x557c69[_0x5d53('0x2c')],qs[_0x5d53('0x31')](_0x3d5570[_0x5d53('0x2d')][_0x5d53('0x31')]));_0x468a5b[_0x5d53('0x30')]=_0x468a5b['attributes'][_0x5d53('0x32')]?_0x468a5b[_0x5d53('0x30')]:_0x557c69['model'];if(_0x3d5570[_0x5d53('0x2d')][_0x5d53('0x42')]){_0x468a5b['include']=[{'all':!![]}];}_0x468a5b=_['merge']({},_0x468a5b,_0x3d5570['options']);return db['ZendeskField'][_0x5d53('0x43')](_0x468a5b)[_0x5d53('0x21')](handleEntityNotFound(_0x3a3b3e,null))['then'](respondWithResult(_0x3a3b3e,null))[_0x5d53('0x41')](handleError(_0x3a3b3e,null));};exports[_0x5d53('0x44')]=function(_0x5b3208,_0x4d9e16){return db[_0x5d53('0x28')][_0x5d53('0x44')](_0x5b3208[_0x5d53('0x45')],{})['then'](respondWithResult(_0x4d9e16,0xc9))['catch'](handleError(_0x4d9e16,null));};exports['update']=function(_0x3b9d80,_0x3c979b){if(_0x3b9d80[_0x5d53('0x45')]['id']){delete _0x3b9d80['body']['id'];}return db[_0x5d53('0x28')][_0x5d53('0x43')]({'where':{'id':_0x3b9d80['params']['id']}})[_0x5d53('0x21')](handleEntityNotFound(_0x3c979b,null))[_0x5d53('0x21')](saveUpdates(_0x3b9d80[_0x5d53('0x45')],null))[_0x5d53('0x21')](respondWithResult(_0x3c979b,null))['catch'](handleError(_0x3c979b,null));};exports[_0x5d53('0x22')]=function(_0x5b8947,_0x42a65a){return db[_0x5d53('0x28')][_0x5d53('0x43')]({'where':{'id':_0x5b8947[_0x5d53('0x46')]['id']}})[_0x5d53('0x21')](handleEntityNotFound(_0x42a65a,null))[_0x5d53('0x21')](removeEntity(_0x42a65a,null))[_0x5d53('0x41')](handleError(_0x42a65a,null));}; \ No newline at end of file +var _0x9c29=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','map','keys','query','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','count','includeAll','include','catch','merge','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x9c29,0x10c));var _0x99c2=function(_0x31f96c,_0x201667){_0x31f96c=_0x31f96c-0x0;var _0x59210e=_0x9c29[_0x31f96c];return _0x59210e;};'use strict';var pdf=require(_0x99c2('0x0'));var emlformat=require(_0x99c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x99c2('0x2'));var jsonpatch=require(_0x99c2('0x3'));var rp=require(_0x99c2('0x4'));var moment=require('moment');var BPromise=require(_0x99c2('0x5'));var Mustache=require('mustache');var util=require(_0x99c2('0x6'));var path=require(_0x99c2('0x7'));var sox=require(_0x99c2('0x8'));var csv=require(_0x99c2('0x9'));var ejs=require(_0x99c2('0xa'));var fs=require('fs');var _=require(_0x99c2('0xb'));var squel=require(_0x99c2('0xc'));var crypto=require(_0x99c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x99c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x99c2('0xf'));var Papa=require(_0x99c2('0x10'));var Redis=require('ioredis');var authService=require(_0x99c2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99c2('0x12'));var logger=require('../../config/logger')(_0x99c2('0x13'));var utils=require(_0x99c2('0x14'));var config=require(_0x99c2('0x15'));var db=require(_0x99c2('0x16'))['db'];function respondWithStatusCode(_0x2c085d,_0x11caa3){_0x11caa3=_0x11caa3||0xcc;return function(_0x239c87){if(_0x239c87){return _0x2c085d[_0x99c2('0x17')](_0x11caa3);}return _0x2c085d[_0x99c2('0x18')](_0x11caa3)[_0x99c2('0x19')]();};}function respondWithResult(_0x5b7695,_0x3cda40){_0x3cda40=_0x3cda40||0xc8;return function(_0x4f7ea8){if(_0x4f7ea8){return _0x5b7695[_0x99c2('0x18')](_0x3cda40)[_0x99c2('0x1a')](_0x4f7ea8);}};}function respondWithFilteredResult(_0x568a4b,_0x18bc76){return function(_0x588d59){if(_0x588d59){var _0x57e753=_0x588d59['count'],_0x4ae51a=_0x18bc76[_0x99c2('0x1b')],_0x12fd2c=_0x18bc76[_0x99c2('0x1b')]+_0x18bc76[_0x99c2('0x1c')],_0x30b284;if(_0x12fd2c>=_0x57e753){_0x12fd2c=_0x57e753;_0x30b284=0xc8;}else{_0x30b284=0xce;}_0x568a4b[_0x99c2('0x18')](_0x30b284);return _0x568a4b[_0x99c2('0x1d')](_0x99c2('0x1e'),_0x4ae51a+'-'+_0x12fd2c+'/'+_0x57e753)[_0x99c2('0x1a')](_0x588d59);}return null;};}function patchUpdates(_0x515034){return function(_0x5ced9f){try{jsonpatch['apply'](_0x5ced9f,_0x515034,!![]);}catch(_0x30233c){return BPromise['reject'](_0x30233c);}return _0x5ced9f[_0x99c2('0x1f')]();};}function saveUpdates(_0x1f4af4,_0x179827){return function(_0xfb2d3e){if(_0xfb2d3e){return _0xfb2d3e[_0x99c2('0x20')](_0x1f4af4)[_0x99c2('0x21')](function(_0x332937){return _0x332937;});}return null;};}function removeEntity(_0xecf3ca,_0x29efb0){return function(_0x30745c){if(_0x30745c){return _0x30745c[_0x99c2('0x22')]()[_0x99c2('0x21')](function(){_0xecf3ca[_0x99c2('0x18')](0xcc)[_0x99c2('0x19')]();});}};}function handleEntityNotFound(_0x5b55a7,_0x7f2fd4){return function(_0x1d9540){if(!_0x1d9540){_0x5b55a7[_0x99c2('0x17')](0x194);}return _0x1d9540;};}function handleError(_0x3762b3,_0x20baa2){_0x20baa2=_0x20baa2||0x1f4;return function(_0x4bc041){logger[_0x99c2('0x23')](_0x4bc041[_0x99c2('0x24')]);if(_0x4bc041['name']){delete _0x4bc041[_0x99c2('0x25')];}_0x3762b3[_0x99c2('0x18')](_0x20baa2)[_0x99c2('0x26')](_0x4bc041);};}exports[_0x99c2('0x27')]=function(_0x562d2a,_0x13dacd){var _0x1ef2d6={},_0x4a4a68={},_0x164b1a={'count':0x0,'rows':[]};var _0x31cdb3=_['map'](db[_0x99c2('0x28')][_0x99c2('0x29')],function(_0x394b32){return{'name':_0x394b32[_0x99c2('0x2a')],'type':_0x394b32[_0x99c2('0x2b')][_0x99c2('0x2c')]};});_0x4a4a68['model']=_[_0x99c2('0x2d')](_0x31cdb3,'name');_0x4a4a68['query']=_[_0x99c2('0x2e')](_0x562d2a[_0x99c2('0x2f')]);_0x4a4a68[_0x99c2('0x30')]=_['intersection'](_0x4a4a68[_0x99c2('0x31')],_0x4a4a68[_0x99c2('0x2f')]);_0x1ef2d6['attributes']=_[_0x99c2('0x32')](_0x4a4a68[_0x99c2('0x31')],qs['fields'](_0x562d2a['query'][_0x99c2('0x33')]));_0x1ef2d6['attributes']=_0x1ef2d6[_0x99c2('0x34')][_0x99c2('0x35')]?_0x1ef2d6[_0x99c2('0x34')]:_0x4a4a68[_0x99c2('0x31')];if(!_0x562d2a[_0x99c2('0x2f')]['hasOwnProperty'](_0x99c2('0x36'))){_0x1ef2d6[_0x99c2('0x1c')]=qs[_0x99c2('0x1c')](_0x562d2a[_0x99c2('0x2f')][_0x99c2('0x1c')]);_0x1ef2d6[_0x99c2('0x1b')]=qs[_0x99c2('0x1b')](_0x562d2a[_0x99c2('0x2f')][_0x99c2('0x1b')]);}_0x1ef2d6['order']=qs[_0x99c2('0x37')](_0x562d2a[_0x99c2('0x2f')][_0x99c2('0x37')]);_0x1ef2d6[_0x99c2('0x38')]=qs[_0x99c2('0x30')](_[_0x99c2('0x39')](_0x562d2a[_0x99c2('0x2f')],_0x4a4a68[_0x99c2('0x30')]),_0x31cdb3);if(_0x562d2a[_0x99c2('0x2f')][_0x99c2('0x3a')]){_0x1ef2d6['where']=_['merge'](_0x1ef2d6[_0x99c2('0x38')],{'$or':_[_0x99c2('0x2d')](_0x31cdb3,function(_0x36e4fa){if(_0x36e4fa[_0x99c2('0x2b')]!==_0x99c2('0x3b')){var _0x455c54={};_0x455c54[_0x36e4fa[_0x99c2('0x25')]]={'$like':'%'+_0x562d2a['query']['filter']+'%'};return _0x455c54;}})});}_0x1ef2d6=_['merge']({},_0x1ef2d6,_0x562d2a['options']);var _0x414c11={'where':_0x1ef2d6[_0x99c2('0x38')]};return db[_0x99c2('0x28')][_0x99c2('0x3c')](_0x414c11)[_0x99c2('0x21')](function(_0x310310){_0x164b1a[_0x99c2('0x3c')]=_0x310310;if(_0x562d2a[_0x99c2('0x2f')][_0x99c2('0x3d')]){_0x1ef2d6[_0x99c2('0x3e')]=[{'all':!![]}];}return db[_0x99c2('0x28')]['findAll'](_0x1ef2d6);})[_0x99c2('0x21')](function(_0x5877bf){_0x164b1a['rows']=_0x5877bf;return _0x164b1a;})[_0x99c2('0x21')](respondWithFilteredResult(_0x13dacd,_0x1ef2d6))[_0x99c2('0x3f')](handleError(_0x13dacd,null));};exports['show']=function(_0x2a400c,_0x280119){var _0x1148e9={'raw':!![],'where':{'id':_0x2a400c['params']['id']}},_0x5ab101={};_0x5ab101['model']=_[_0x99c2('0x2e')](db[_0x99c2('0x28')]['rawAttributes']);_0x5ab101['query']=_['keys'](_0x2a400c[_0x99c2('0x2f')]);_0x5ab101['filters']=_[_0x99c2('0x32')](_0x5ab101[_0x99c2('0x31')],_0x5ab101['query']);_0x1148e9[_0x99c2('0x34')]=_[_0x99c2('0x32')](_0x5ab101['model'],qs['fields'](_0x2a400c[_0x99c2('0x2f')][_0x99c2('0x33')]));_0x1148e9[_0x99c2('0x34')]=_0x1148e9['attributes'][_0x99c2('0x35')]?_0x1148e9['attributes']:_0x5ab101[_0x99c2('0x31')];if(_0x2a400c[_0x99c2('0x2f')][_0x99c2('0x3d')]){_0x1148e9[_0x99c2('0x3e')]=[{'all':!![]}];}_0x1148e9=_[_0x99c2('0x40')]({},_0x1148e9,_0x2a400c['options']);return db[_0x99c2('0x28')][_0x99c2('0x41')](_0x1148e9)['then'](handleEntityNotFound(_0x280119,null))[_0x99c2('0x21')](respondWithResult(_0x280119,null))[_0x99c2('0x3f')](handleError(_0x280119,null));};exports[_0x99c2('0x42')]=function(_0x2e211c,_0x533f3f){return db[_0x99c2('0x28')][_0x99c2('0x42')](_0x2e211c[_0x99c2('0x43')],{})['then'](respondWithResult(_0x533f3f,0xc9))[_0x99c2('0x3f')](handleError(_0x533f3f,null));};exports[_0x99c2('0x20')]=function(_0x53ba1d,_0x564c02){if(_0x53ba1d['body']['id']){delete _0x53ba1d['body']['id'];}return db[_0x99c2('0x28')][_0x99c2('0x41')]({'where':{'id':_0x53ba1d[_0x99c2('0x44')]['id']}})[_0x99c2('0x21')](handleEntityNotFound(_0x564c02,null))[_0x99c2('0x21')](saveUpdates(_0x53ba1d['body'],null))[_0x99c2('0x21')](respondWithResult(_0x564c02,null))[_0x99c2('0x3f')](handleError(_0x564c02,null));};exports[_0x99c2('0x22')]=function(_0x16e4b3,_0x105310){return db[_0x99c2('0x28')][_0x99c2('0x41')]({'where':{'id':_0x16e4b3[_0x99c2('0x44')]['id']}})[_0x99c2('0x21')](handleEntityNotFound(_0x105310,null))[_0x99c2('0x21')](removeEntity(_0x105310,null))[_0x99c2('0x3f')](handleError(_0x105310,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fce5c02..f2e1300 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 _0xccde=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId'];(function(_0x752005,_0x14dc74){var _0x40629c=function(_0x189e3d){while(--_0x189e3d){_0x752005['push'](_0x752005['shift']());}};_0x40629c(++_0x14dc74);}(_0xccde,0x1e1));var _0xeccd=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xccde[_0x582274];return _0x8f14d3;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var logger=require(_0xeccd('0x1'))('api');var moment=require(_0xeccd('0x2'));var BPromise=require(_0xeccd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeccd('0x4'));var config=require(_0xeccd('0x5'));var attributes=require(_0xeccd('0x6'));module[_0xeccd('0x7')]=function(_0x323c74,_0x56972a){return _0x323c74[_0xeccd('0x8')](_0xeccd('0x9'),attributes,{'tableName':_0xeccd('0xa'),'paranoid':![],'indexes':[{'name':_0xeccd('0xb'),'fields':['idField',_0xeccd('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b29=['../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0x8b29,0xbe));var _0x98b2=function(_0x2262d8,_0x2f3862){_0x2262d8=_0x2262d8-0x0;var _0x530f20=_0x8b29[_0x2262d8];return _0x530f20;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x98b2('0x3'));var fs=require('fs');var path=require(_0x98b2('0x4'));var rimraf=require('rimraf');var config=require(_0x98b2('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x98b2('0x6')]=function(_0xa3c251,_0xb0082c){return _0xa3c251[_0x98b2('0x7')](_0x98b2('0x8'),attributes,{'tableName':_0x98b2('0x9'),'paranoid':![],'indexes':[{'name':_0x98b2('0xa'),'fields':[_0x98b2('0xb'),_0x98b2('0xc')],'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 ce118db..c0f9062 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 _0xd88d=['info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x58368a,_0x5dd9e0){var _0x400f31=function(_0x339469){while(--_0x339469){_0x58368a['push'](_0x58368a['shift']());}};_0x400f31(++_0x5dd9e0);}(_0xd88d,0x113));var _0xdd88=function(_0x10b61a,_0x218f4c){_0x10b61a=_0x10b61a-0x0;var _0x2a95e8=_0xd88d[_0x10b61a];return _0x2a95e8;};'use strict';var _=require('lodash');var util=require(_0xdd88('0x0'));var moment=require('moment');var BPromise=require(_0xdd88('0x1'));var rs=require(_0xdd88('0x2'));var fs=require('fs');var Redis=require(_0xdd88('0x3'));var db=require(_0xdd88('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd88('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd88('0x6'));var client=jayson[_0xdd88('0x7')][_0xdd88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaf3d4a,_0x35101e,_0x2ce3d6){return new BPromise(function(_0x3726ee,_0x56c4d3){return client[_0xdd88('0x9')](_0xaf3d4a,_0x2ce3d6)['then'](function(_0x5f1460){logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x35101e,'request\x20sent');logger[_0xdd88('0xc')](_0xdd88('0xd'),_0x35101e,_0xdd88('0xe'),JSON[_0xdd88('0xf')](_0x5f1460));if(_0x5f1460['error']){if(_0x5f1460[_0xdd88('0x10')]['code']===0x1f4){logger[_0xdd88('0x10')](_0xdd88('0xb'),_0x35101e,_0x5f1460[_0xdd88('0x10')]['message']);return _0x56c4d3(_0x5f1460[_0xdd88('0x10')][_0xdd88('0x11')]);}logger[_0xdd88('0x10')]('ZendeskField,\x20%s,\x20%s',_0x35101e,_0x5f1460[_0xdd88('0x10')][_0xdd88('0x11')]);return _0x3726ee(_0x5f1460['error'][_0xdd88('0x11')]);}else{logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x35101e,'request\x20sent');_0x3726ee(_0x5f1460['result']['message']);}})[_0xdd88('0x12')](function(_0x3c8168){logger[_0xdd88('0x10')](_0xdd88('0xb'),_0x35101e,_0x3c8168);_0x56c4d3(_0x3c8168);});});} \ No newline at end of file +var _0xf67f=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xa932d7,_0xbaa80b){var _0x542846=function(_0x4f6136){while(--_0x4f6136){_0xa932d7['push'](_0xa932d7['shift']());}};_0x542846(++_0xbaa80b);}(_0xf67f,0x13d));var _0xff67=function(_0x5b4d06,_0x3edc8d){_0x5b4d06=_0x5b4d06-0x0;var _0xad4053=_0xf67f[_0x5b4d06];return _0xad4053;};'use strict';var _=require(_0xff67('0x0'));var util=require('util');var moment=require(_0xff67('0x1'));var BPromise=require(_0xff67('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff67('0x3'));var db=require(_0xff67('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xff67('0x5'))(_0xff67('0x6'));var config=require(_0xff67('0x7'));var jayson=require(_0xff67('0x8'));var client=jayson[_0xff67('0x9')][_0xff67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb63af9,_0x87edf6,_0x47ddb7){return new BPromise(function(_0x3a40cb,_0x39ae24){return client[_0xff67('0xb')](_0xb63af9,_0x47ddb7)[_0xff67('0xc')](function(_0x51e1fb){logger[_0xff67('0xd')](_0xff67('0xe'),_0x87edf6,_0xff67('0xf'));logger[_0xff67('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x87edf6,'request\x20sent',JSON[_0xff67('0x11')](_0x51e1fb));if(_0x51e1fb['error']){if(_0x51e1fb[_0xff67('0x12')][_0xff67('0x13')]===0x1f4){logger['error'](_0xff67('0xe'),_0x87edf6,_0x51e1fb['error'][_0xff67('0x14')]);return _0x39ae24(_0x51e1fb[_0xff67('0x12')]['message']);}logger[_0xff67('0x12')](_0xff67('0xe'),_0x87edf6,_0x51e1fb[_0xff67('0x12')][_0xff67('0x14')]);return _0x3a40cb(_0x51e1fb[_0xff67('0x12')][_0xff67('0x14')]);}else{logger[_0xff67('0xd')]('ZendeskField,\x20%s,\x20%s',_0x87edf6,'request\x20sent');_0x3a40cb(_0x51e1fb[_0xff67('0x15')]['message']);}})['catch'](function(_0x32054d){logger['error'](_0xff67('0xe'),_0x87edf6,_0x32054d);_0x39ae24(_0x32054d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f221c0c..0e59a58 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 _0x53f2=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x365763,_0x556437){var _0x50184f=function(_0x4871cd){while(--_0x4871cd){_0x365763['push'](_0x365763['shift']());}};_0x50184f(++_0x556437);}(_0x53f2,0x1e0));var _0x253f=function(_0x15b84e,_0x43fe33){_0x15b84e=_0x15b84e-0x0;var _0x42c56b=_0x53f2[_0x15b84e];return _0x42c56b;};'use strict';var multer=require(_0x253f('0x0'));var util=require('util');var path=require(_0x253f('0x1'));var timeout=require(_0x253f('0x2'));var express=require('express');var router=express[_0x253f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x253f('0x4'));var config=require(_0x253f('0x5'));var controller=require(_0x253f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x253f('0x7')]);router[_0x253f('0x8')](_0x253f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x253f('0x8')](_0x253f('0xa'),auth[_0x253f('0xb')](),controller[_0x253f('0xc')]);router[_0x253f('0x8')](_0x253f('0xd'),auth[_0x253f('0xb')](),controller[_0x253f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x253f('0xf')]);router[_0x253f('0x10')](_0x253f('0xa'),auth[_0x253f('0xb')](),controller[_0x253f('0x11')]);router[_0x253f('0x12')]('/:id',auth[_0x253f('0xb')](),controller[_0x253f('0x13')]);router['delete'](_0x253f('0x9'),auth[_0x253f('0xb')](),controller[_0x253f('0x14')]);module[_0x253f('0x15')]=router; \ No newline at end of file +var _0x7d9d=['./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e8bea,_0x47bde9){var _0x29f756=function(_0x37bb53){while(--_0x37bb53){_0x1e8bea['push'](_0x1e8bea['shift']());}};_0x29f756(++_0x47bde9);}(_0x7d9d,0x13e));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7d9('0x0'));var util=require('util');var path=require(_0xd7d9('0x1'));var timeout=require(_0xd7d9('0x2'));var express=require(_0xd7d9('0x3'));var router=express[_0xd7d9('0x4')]();var auth=require(_0xd7d9('0x5'));var interaction=require(_0xd7d9('0x6'));var config=require('../../config/environment');var controller=require(_0xd7d9('0x7'));router[_0xd7d9('0x8')]('/',auth[_0xd7d9('0x9')](),controller[_0xd7d9('0xa')]);router[_0xd7d9('0x8')]('/:id',auth[_0xd7d9('0x9')](),controller[_0xd7d9('0xb')]);router[_0xd7d9('0x8')](_0xd7d9('0xc'),auth[_0xd7d9('0x9')](),controller[_0xd7d9('0xd')]);router[_0xd7d9('0x8')](_0xd7d9('0xe'),auth['isAuthenticated'](),controller[_0xd7d9('0xf')]);router[_0xd7d9('0x10')]('/',auth['isAuthenticated'](),controller[_0xd7d9('0x11')]);router[_0xd7d9('0x10')](_0xd7d9('0xc'),auth['isAuthenticated'](),controller[_0xd7d9('0x12')]);router[_0xd7d9('0x13')](_0xd7d9('0x14'),auth[_0xd7d9('0x9')](),controller[_0xd7d9('0x15')]);router[_0xd7d9('0x16')](_0xd7d9('0x14'),auth[_0xd7d9('0x9')](),controller[_0xd7d9('0x17')]);module[_0xd7d9('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index fb681a3..12bab62 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 _0x234c=['STRING','exports'];(function(_0x14e6b1,_0x2a1806){var _0x3b709b=function(_0x1f9c13){while(--_0x1f9c13){_0x14e6b1['push'](_0x14e6b1['shift']());}};_0x3b709b(++_0x2a1806);}(_0x234c,0xeb));var _0xc234=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x234c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc234('0x0')]={'name':{'type':Sequelize[_0xc234('0x1')]},'description':{'type':Sequelize[_0xc234('0x1')]},'host':{'type':Sequelize[_0xc234('0x1')]},'zone':{'type':Sequelize[_0xc234('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc234('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xc234('0x1')]}}; \ No newline at end of file +var _0x8709=['STRING','sequelize'];(function(_0x1e9529,_0x558752){var _0x31d086=function(_0x56bc18){while(--_0x56bc18){_0x1e9529['push'](_0x1e9529['shift']());}};_0x31d086(++_0x558752);}(_0x8709,0x129));var _0x9870=function(_0x55cf52,_0x2cf5c8){_0x55cf52=_0x55cf52-0x0;var _0x3a56de=_0x8709[_0x55cf52];return _0x3a56de;};'use strict';var Sequelize=require(_0x9870('0x0'));module['exports']={'name':{'type':Sequelize[_0x9870('0x1')]},'description':{'type':Sequelize[_0x9870('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9870('0x1')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9870('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d767b60..1a126e2 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 _0x38af=['util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','status','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','show','params','includeAll','options','create','body','find','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','ZohoField','Descriptions','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','zoho.eu','com','slice','substring','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','push','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0x38af,0x111));var _0xf38a=function(_0x38815c,_0x3fdeed){_0x38815c=_0x38815c-0x0;var _0x15cf2e=_0x38af[_0x38815c];return _0x15cf2e;};'use strict';var pdf=require(_0xf38a('0x0'));var emlformat=require(_0xf38a('0x1'));var rimraf=require(_0xf38a('0x2'));var zipdir=require(_0xf38a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf38a('0x4'));var moment=require(_0xf38a('0x5'));var BPromise=require(_0xf38a('0x6'));var Mustache=require('mustache');var util=require(_0xf38a('0x7'));var path=require(_0xf38a('0x8'));var sox=require('sox');var csv=require(_0xf38a('0x9'));var ejs=require(_0xf38a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf38a('0xb'));var crypto=require(_0xf38a('0xc'));var jsforce=require(_0xf38a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf38a('0x9'));var querystring=require(_0xf38a('0xe'));var Papa=require(_0xf38a('0xf'));var Redis=require(_0xf38a('0x10'));var authService=require(_0xf38a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf38a('0x12'));var hardwareService=require(_0xf38a('0x13'));var logger=require('../../config/logger')(_0xf38a('0x14'));var utils=require(_0xf38a('0x15'));var config=require(_0xf38a('0x16'));var db=require(_0xf38a('0x17'))['db'];var integrations=require(_0xf38a('0x18'));var jayson=require(_0xf38a('0x19'));var client=jayson[_0xf38a('0x1a')][_0xf38a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4633eb,_0x3680e9,_0x30c886){if(_0x30c886){var _0x4b1a07=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b1a07[_0xf38a('0x1c')](_0x3680e9)){return _0x4633eb;}else{throw new db[(_0xf38a('0x1d'))][(_0xf38a('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4633eb;}}function respondWithRpcPromise(_0x3bbfa3,_0x4119cd,_0x5b0365,_0x51571b){return new BPromise(function(_0x2e36d5,_0x4dc5f7){var _0x5268e8=_0x51571b||client;return _0x5268e8[_0xf38a('0x1f')](_0x3bbfa3,_0x5b0365)['then'](function(_0x3eab79){logger[_0xf38a('0x20')](_0xf38a('0x21'),_0x4119cd,_0xf38a('0x22'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4119cd,_0xf38a('0x22'),JSON[_0xf38a('0x23')](_0x3eab79));if(_0x3eab79['error']){if(_0x3eab79[_0xf38a('0x24')][_0xf38a('0x25')]===0x1f4){logger[_0xf38a('0x24')](_0xf38a('0x21'),_0x4119cd,_0x3eab79[_0xf38a('0x24')][_0xf38a('0x26')]);return _0x4dc5f7(_0x3eab79[_0xf38a('0x24')][_0xf38a('0x26')]);}logger[_0xf38a('0x24')](_0xf38a('0x21'),_0x4119cd,_0x3eab79[_0xf38a('0x24')]['message']);return _0x2e36d5(_0x3eab79[_0xf38a('0x24')]['message']);}else{logger[_0xf38a('0x20')](_0xf38a('0x21'),_0x4119cd,_0xf38a('0x22'));_0x2e36d5(_0x3eab79[_0xf38a('0x27')][_0xf38a('0x26')]);}})[_0xf38a('0x28')](function(_0x3da8d2){logger[_0xf38a('0x24')]('ZohoAccount,\x20%s,\x20%s',_0x4119cd,_0x3da8d2);_0x4dc5f7(_0x3da8d2);});});}function respondWithStatusCode(_0xac70f2,_0x3806f9){_0x3806f9=_0x3806f9||0xcc;return function(_0x2ba487){if(_0x2ba487){return _0xac70f2[_0xf38a('0x29')](_0x3806f9);}return _0xac70f2['status'](_0x3806f9)[_0xf38a('0x2a')]();};}function respondWithResult(_0x177634,_0x44b5d4){_0x44b5d4=_0x44b5d4||0xc8;return function(_0x16d14f){if(_0x16d14f){return _0x177634['status'](_0x44b5d4)[_0xf38a('0x2b')](_0x16d14f);}};}function respondWithFilteredResult(_0x180c97,_0x1c2712){return function(_0x54eeb2){if(_0x54eeb2){var _0x326338=_0x54eeb2[_0xf38a('0x2c')],_0x2cfa40=_0x1c2712[_0xf38a('0x2d')],_0x393448=_0x1c2712['offset']+_0x1c2712['limit'],_0x10f634;if(_0x393448>=_0x326338){_0x393448=_0x326338;_0x10f634=0xc8;}else{_0x10f634=0xce;}_0x180c97[_0xf38a('0x2e')](_0x10f634);return _0x180c97[_0xf38a('0x2f')](_0xf38a('0x30'),_0x2cfa40+'-'+_0x393448+'/'+_0x326338)['json'](_0x54eeb2);}return null;};}function patchUpdates(_0x383d13){return function(_0x5aef98){try{jsonpatch[_0xf38a('0x31')](_0x5aef98,_0x383d13,!![]);}catch(_0x2a40b8){return BPromise['reject'](_0x2a40b8);}return _0x5aef98[_0xf38a('0x32')]();};}function saveUpdates(_0x1e6b32,_0x5cee71){return function(_0x27e872){if(_0x27e872){return _0x27e872[_0xf38a('0x33')](_0x1e6b32)[_0xf38a('0x34')](function(_0x3c24cf){return _0x3c24cf;});}return null;};}function removeEntity(_0x1a2563,_0x2473d7){return function(_0xf5ead7){if(_0xf5ead7){return _0xf5ead7[_0xf38a('0x35')]()[_0xf38a('0x34')](function(){_0x1a2563[_0xf38a('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d725,_0x57b42b){return function(_0x37917c){if(!_0x37917c){_0x45d725[_0xf38a('0x29')](0x194);}return _0x37917c;};}function handleError(_0x48bd67,_0x4af47d){_0x4af47d=_0x4af47d||0x1f4;return function(_0x3a59d0){logger['error'](_0x3a59d0[_0xf38a('0x36')]);if(_0x3a59d0[_0xf38a('0x37')]){delete _0x3a59d0[_0xf38a('0x37')];}_0x48bd67[_0xf38a('0x2e')](_0x4af47d)['send'](_0x3a59d0);};}exports[_0xf38a('0x38')]=function(_0x4dad2a,_0x2641c4){var _0xe6cae0={},_0x5da4d3={},_0x1759fe={'count':0x0,'rows':[]};var _0x5c67b7=_[_0xf38a('0x39')](db[_0xf38a('0x3a')][_0xf38a('0x3b')],function(_0x5851dd){return{'name':_0x5851dd[_0xf38a('0x3c')],'type':_0x5851dd[_0xf38a('0x3d')][_0xf38a('0x3e')]};});_0x5da4d3[_0xf38a('0x3f')]=_[_0xf38a('0x39')](_0x5c67b7,'name');_0x5da4d3['query']=_[_0xf38a('0x40')](_0x4dad2a[_0xf38a('0x41')]);_0x5da4d3[_0xf38a('0x42')]=_[_0xf38a('0x43')](_0x5da4d3[_0xf38a('0x3f')],_0x5da4d3[_0xf38a('0x41')]);_0xe6cae0[_0xf38a('0x44')]=_['intersection'](_0x5da4d3['model'],qs[_0xf38a('0x45')](_0x4dad2a['query']['fields']));_0xe6cae0[_0xf38a('0x44')]=_0xe6cae0[_0xf38a('0x44')][_0xf38a('0x46')]?_0xe6cae0['attributes']:_0x5da4d3[_0xf38a('0x3f')];if(!_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x47')]('nolimit')){_0xe6cae0[_0xf38a('0x48')]=qs[_0xf38a('0x48')](_0x4dad2a[_0xf38a('0x41')]['limit']);_0xe6cae0[_0xf38a('0x2d')]=qs[_0xf38a('0x2d')](_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x2d')]);}_0xe6cae0[_0xf38a('0x49')]=qs[_0xf38a('0x4a')](_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4a')]);_0xe6cae0['where']=qs[_0xf38a('0x42')](_[_0xf38a('0x4b')](_0x4dad2a['query'],_0x5da4d3[_0xf38a('0x42')]),_0x5c67b7);if(_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4c')]){_0xe6cae0['where']=_[_0xf38a('0x4d')](_0xe6cae0[_0xf38a('0x4e')],{'$or':_[_0xf38a('0x39')](_0x5c67b7,function(_0x5e0916){if(_0x5e0916['type']!==_0xf38a('0x4f')){var _0x2eec47={};_0x2eec47[_0x5e0916[_0xf38a('0x37')]]={'$like':'%'+_0x4dad2a[_0xf38a('0x41')][_0xf38a('0x4c')]+'%'};return _0x2eec47;}})});}_0xe6cae0=_[_0xf38a('0x4d')]({},_0xe6cae0,_0x4dad2a['options']);var _0x2a5743={'where':_0xe6cae0[_0xf38a('0x4e')]};return db[_0xf38a('0x3a')][_0xf38a('0x2c')](_0x2a5743)['then'](function(_0x1c0854){_0x1759fe[_0xf38a('0x2c')]=_0x1c0854;if(_0x4dad2a[_0xf38a('0x41')]['includeAll']){_0xe6cae0[_0xf38a('0x50')]=[{'all':!![]}];}return db[_0xf38a('0x3a')][_0xf38a('0x51')](_0xe6cae0);})[_0xf38a('0x34')](function(_0xa07dce){_0x1759fe['rows']=_0xa07dce;return _0x1759fe;})[_0xf38a('0x34')](respondWithFilteredResult(_0x2641c4,_0xe6cae0))[_0xf38a('0x28')](handleError(_0x2641c4,null));};exports[_0xf38a('0x52')]=function(_0x261b5f,_0x512451){var _0x2da5d8={'raw':![],'where':{'id':_0x261b5f[_0xf38a('0x53')]['id']}},_0x38ae17={};_0x38ae17[_0xf38a('0x3f')]=_['keys'](db[_0xf38a('0x3a')]['rawAttributes']);_0x38ae17[_0xf38a('0x41')]=_[_0xf38a('0x40')](_0x261b5f[_0xf38a('0x41')]);_0x38ae17[_0xf38a('0x42')]=_['intersection'](_0x38ae17['model'],_0x38ae17[_0xf38a('0x41')]);_0x2da5d8[_0xf38a('0x44')]=_[_0xf38a('0x43')](_0x38ae17[_0xf38a('0x3f')],qs['fields'](_0x261b5f['query'][_0xf38a('0x45')]));_0x2da5d8['attributes']=_0x2da5d8[_0xf38a('0x44')][_0xf38a('0x46')]?_0x2da5d8[_0xf38a('0x44')]:_0x38ae17[_0xf38a('0x3f')];if(_0x261b5f[_0xf38a('0x41')][_0xf38a('0x54')]){_0x2da5d8[_0xf38a('0x50')]=[{'all':!![]}];}_0x2da5d8=_[_0xf38a('0x4d')]({},_0x2da5d8,_0x261b5f[_0xf38a('0x55')]);return db[_0xf38a('0x3a')]['find'](_0x2da5d8)[_0xf38a('0x34')](handleEntityNotFound(_0x512451,null))[_0xf38a('0x34')](respondWithResult(_0x512451,null))[_0xf38a('0x28')](handleError(_0x512451,null));};exports[_0xf38a('0x56')]=function(_0x53001d,_0x4d675e){return db[_0xf38a('0x3a')][_0xf38a('0x56')](_0x53001d[_0xf38a('0x57')],{})[_0xf38a('0x34')](respondWithResult(_0x4d675e,0xc9))[_0xf38a('0x28')](handleError(_0x4d675e,null));};exports[_0xf38a('0x33')]=function(_0x13a082,_0x1c4070){if(_0x13a082['body']['id']){delete _0x13a082[_0xf38a('0x57')]['id'];}return db[_0xf38a('0x3a')][_0xf38a('0x58')]({'where':{'id':_0x13a082[_0xf38a('0x53')]['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x1c4070,null))[_0xf38a('0x34')](saveUpdates(_0x13a082[_0xf38a('0x57')],null))[_0xf38a('0x34')](respondWithResult(_0x1c4070,null))[_0xf38a('0x28')](handleError(_0x1c4070,null));};exports[_0xf38a('0x35')]=function(_0x4370e8,_0x17686b){return db['ZohoAccount'][_0xf38a('0x58')]({'where':{'id':_0x4370e8[_0xf38a('0x53')]['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x17686b,null))[_0xf38a('0x34')](removeEntity(_0x17686b,null))[_0xf38a('0x28')](handleError(_0x17686b,null));};exports[_0xf38a('0x59')]=function(_0xa6887f,_0x4de723,_0x16d31c){var _0x34d76c={};var _0x1a09d3={};var _0x340481;var _0x41ac9d;return db['ZohoAccount']['findOne']({'where':{'id':_0xa6887f['params']['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0x4de723,null))[_0xf38a('0x34')](function(_0x56663a){if(_0x56663a){_0x340481=_0x56663a;_0x1a09d3['model']=_[_0xf38a('0x40')](db[_0xf38a('0x5a')][_0xf38a('0x3b')]);_0x1a09d3[_0xf38a('0x41')]=_[_0xf38a('0x40')](_0xa6887f[_0xf38a('0x41')]);_0x1a09d3['filters']=_[_0xf38a('0x43')](_0x1a09d3[_0xf38a('0x3f')],_0x1a09d3[_0xf38a('0x41')]);_0x34d76c[_0xf38a('0x44')]=_[_0xf38a('0x43')](_0x1a09d3[_0xf38a('0x3f')],qs[_0xf38a('0x45')](_0xa6887f[_0xf38a('0x41')][_0xf38a('0x45')]));_0x34d76c['attributes']=_0x34d76c[_0xf38a('0x44')]['length']?_0x34d76c[_0xf38a('0x44')]:_0x1a09d3[_0xf38a('0x3f')];_0x34d76c[_0xf38a('0x49')]=qs[_0xf38a('0x4a')](_0xa6887f['query']['sort']);_0x34d76c[_0xf38a('0x4e')]=qs[_0xf38a('0x42')](_['pick'](_0xa6887f['query'],_0x1a09d3['filters']));if(_0xa6887f[_0xf38a('0x41')][_0xf38a('0x4c')]){_0x34d76c[_0xf38a('0x4e')]=_[_0xf38a('0x4d')](_0x34d76c[_0xf38a('0x4e')],{'$or':_[_0xf38a('0x39')](_0x34d76c[_0xf38a('0x44')],function(_0x3827a){var _0x241752={};_0x241752[_0x3827a]={'$like':'%'+_0xa6887f[_0xf38a('0x41')][_0xf38a('0x4c')]+'%'};return _0x241752;})});}_0x34d76c=_[_0xf38a('0x4d')]({},_0x34d76c,_0xa6887f[_0xf38a('0x55')]);return _0x340481['getConfigurations'](_0x34d76c);}})['then'](function(_0x29d19a){if(_0x29d19a){_0x41ac9d=_0x29d19a['length'];if(!_0xa6887f['query']['hasOwnProperty']('nolimit')){_0x34d76c[_0xf38a('0x48')]=qs['limit'](_0xa6887f['query'][_0xf38a('0x48')]);_0x34d76c[_0xf38a('0x2d')]=qs[_0xf38a('0x2d')](_0xa6887f['query'][_0xf38a('0x2d')]);}return _0x340481[_0xf38a('0x59')](_0x34d76c);}})[_0xf38a('0x34')](function(_0x354ec1){if(_0x354ec1){return _0x354ec1?{'count':_0x41ac9d,'rows':_0x354ec1}:null;}})['then'](respondWithResult(_0x4de723,null))['catch'](handleError(_0x4de723,null));};exports['addConfiguration']=function(_0x5251a6,_0xd13a59,_0x36d142){if(_0x5251a6[_0xf38a('0x57')]['id']){delete _0x5251a6[_0xf38a('0x57')]['id'];}return db['ZohoAccount'][_0xf38a('0x5b')]({'where':{'id':_0x5251a6['params']['id']}})[_0xf38a('0x34')](handleEntityNotFound(_0xd13a59,null))[_0xf38a('0x34')](function(_0x2a23c3){if(_0x2a23c3){_0x5251a6[_0xf38a('0x57')][_0xf38a('0x5c')]=_0x2a23c3['id'];_0x5251a6[_0xf38a('0x57')][_0xf38a('0x5d')]=integrations[_0xf38a('0x5e')](_0x5251a6[_0xf38a('0x57')]['channel'],_0x5251a6[_0xf38a('0x57')][_0xf38a('0x3d')]);_0x5251a6[_0xf38a('0x57')]['Descriptions']=integrations[_0xf38a('0x5f')](_0x5251a6['body'][_0xf38a('0x60')],_0x5251a6['body']['type']);return db[_0xf38a('0x5a')][_0xf38a('0x56')](_0x5251a6[_0xf38a('0x57')],{'include':[{'model':db[_0xf38a('0x61')],'as':_0xf38a('0x5d')},{'model':db[_0xf38a('0x61')],'as':_0xf38a('0x62')}]});}return null;})['then'](respondWithResult(_0xd13a59,null))[_0xf38a('0x28')](handleError(_0xd13a59,null));};function getAccessToken(_0x952ec7){return new Promise(function(_0x380c6e,_0x5ed544){var _0x4f12b0;switch(_0x952ec7[_0xf38a('0x63')]){case'US':_0x4f12b0=_0xf38a('0x64');break;case'AU':_0x4f12b0=_0xf38a('0x65');break;case'EU':_0x4f12b0=_0xf38a('0x66');break;case'IN':_0x4f12b0=_0xf38a('0x67');break;case'CN':_0x4f12b0=_0xf38a('0x68');break;default:_0x4f12b0=_0xf38a('0x66');break;}var _0x19efc8={'method':_0xf38a('0x69'),'uri':_0x4f12b0+_0xf38a('0x6a'),'qs':{'refresh_token':_0x952ec7[_0xf38a('0x6b')],'client_id':_0x952ec7[_0xf38a('0x6c')],'client_secret':_0x952ec7[_0xf38a('0x6d')],'grant_type':_0xf38a('0x6e')},'json':!![]};return rp(_0x19efc8)['then'](function(_0x2f233c){if(_0x2f233c[_0xf38a('0x6f')]){_0x380c6e(_0x2f233c[_0xf38a('0x6f')]);}else{_0x5ed544(_0xf38a('0x70'));}})[_0xf38a('0x28')](function(_0x262ee9){_0x5ed544(_0x262ee9);});});}exports[_0xf38a('0x71')]=function(_0x493fba,_0x1513ef,_0x14ffb4){var _0x30acf0,_0x1b455d,_0x7a7cc6,_0x25dd9f,_0x2421f8;return db['ZohoAccount']['findOne']({'where':{'id':_0x493fba['params']['id']},'attributes':['id',_0xf38a('0x72'),_0xf38a('0x63'),'clientId',_0xf38a('0x6d'),_0xf38a('0x73'),_0xf38a('0x25'),_0xf38a('0x6b')]})[_0xf38a('0x34')](handleEntityNotFound(_0x1513ef,null))[_0xf38a('0x34')](function(_0x535ed1){_0x2421f8=_0x535ed1;_0x30acf0=_0x2421f8[_0xf38a('0x72')];_0x1b455d=_0x30acf0===_0xf38a('0x74')?'eu':_0xf38a('0x75');_0x7a7cc6=_0x2421f8[_0xf38a('0x73')];var _0x3467f5=_0x7a7cc6[_0xf38a('0x76')](-0x1);if(_0x3467f5==='/'||_0x3467f5==='\x5c'||_0x3467f5===':'){_0x7a7cc6=_0x7a7cc6[_0xf38a('0x77')](0x0,_0x7a7cc6['lastIndexOf'](_0x3467f5));}if(!_0x2421f8[_0xf38a('0x6b')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2421f8);})[_0xf38a('0x34')](function(_0x4ba5ee){if(_0x4ba5ee){return rp({'method':_0xf38a('0x78'),'uri':util['format'](_0xf38a('0x79'),_0x1b455d),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf38a('0x7a')+_0x4ba5ee},'json':!![]});}})[_0xf38a('0x34')](function(_0x5e00a7){if(_0x5e00a7){if(_0x5e00a7[_0xf38a('0x7b')]&&_0x5e00a7[_0xf38a('0x7b')][_0xf38a('0x24')]){throw new Error(_0x5e00a7[_0xf38a('0x7b')][_0xf38a('0x24')][_0xf38a('0x26')]);}var _0x46eab7=[];var _0x346642=[];var _0x136241=[_0xf38a('0x7c'),_0xf38a('0x7d'),_0xf38a('0x7e'),_0xf38a('0x7f'),_0xf38a('0x80'),_0xf38a('0x81'),'Call_Start_Time',_0xf38a('0x82')];_0x346642=_['remove'](_0x5e00a7[_0xf38a('0x45')],function(_0x560330){return _0x136241[_0xf38a('0x83')](_0x560330[_0xf38a('0x84')]);});for(var _0x3792a3=0x0;_0x3792a3<_0x346642['length'];_0x3792a3++){if(_0x346642[_0x3792a3][_0xf38a('0x85')]===![]){_0x46eab7[_0xf38a('0x86')]({'id':_0x346642[_0x3792a3]['id'],'name':_0x346642[_0x3792a3]['display_label'],'custom':_0x346642[_0x3792a3]['custom_field'],'options':_0x346642[_0x3792a3][_0xf38a('0x87')]==='picklist'&&_0x346642[_0x3792a3][_0xf38a('0x88')][_0xf38a('0x46')]>-0x1?_[_0xf38a('0x39')](_0x346642[_0x3792a3][_0xf38a('0x88')],function(_0x1cb9a9){return{'name':_0x1cb9a9,'value':_0x1cb9a9};}):[]});}}return{'count':_0x46eab7[_0xf38a('0x46')],'rows':_0x46eab7};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1513ef,null))[_0xf38a('0x28')](function(_0x3783d3){var _0x3fd5bc=_0x493fba[_0xf38a('0x41')][_0xf38a('0x1c')]?0x1f4:_0x3783d3[_0xf38a('0x89')]||0x1f4;logger[_0xf38a('0x24')](_0xf38a('0x8a'),'getFields',_0x3fd5bc,JSON['stringify'](_0x3783d3));delete _0x3783d3[_0xf38a('0x37')];if(_0x3fd5bc===0x191){_0x3fd5bc=0x190;}_0x1513ef[_0xf38a('0x2e')](_0x3fd5bc)['send'](_0x493fba[_0xf38a('0x41')][_0xf38a('0x1c')]?{'message':_0xf38a('0x8b'),'statusCode':_0x3783d3[_0xf38a('0x89')]}:_0x3783d3);});}; \ No newline at end of file +var _0x3773=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','show','params','options','find','create','body','getConfigurations','keys','ZohoConfiguration','order','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','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','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1ea726,_0xc3ed05){var _0x33a8c2=function(_0x493a0){while(--_0x493a0){_0x1ea726['push'](_0x1ea726['shift']());}};_0x33a8c2(++_0xc3ed05);}(_0x3773,0x107));var _0x3377=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3773[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0x3377('0x0'));var emlformat=require(_0x3377('0x1'));var rimraf=require(_0x3377('0x2'));var zipdir=require(_0x3377('0x3'));var jsonpatch=require(_0x3377('0x4'));var rp=require(_0x3377('0x5'));var moment=require(_0x3377('0x6'));var BPromise=require(_0x3377('0x7'));var Mustache=require(_0x3377('0x8'));var util=require(_0x3377('0x9'));var path=require(_0x3377('0xa'));var sox=require(_0x3377('0xb'));var csv=require(_0x3377('0xc'));var ejs=require(_0x3377('0xd'));var fs=require('fs');var _=require(_0x3377('0xe'));var squel=require(_0x3377('0xf'));var crypto=require(_0x3377('0x10'));var jsforce=require(_0x3377('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x3377('0xc'));var querystring=require(_0x3377('0x12'));var Papa=require(_0x3377('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3377('0x14'));var as=require(_0x3377('0x15'));var hardwareService=require(_0x3377('0x16'));var logger=require(_0x3377('0x17'))('api');var utils=require(_0x3377('0x18'));var config=require(_0x3377('0x19'));var db=require(_0x3377('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3377('0x1b'));var client=jayson['client'][_0x3377('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x25054c,_0x1b8212,_0x12e0ff){if(_0x12e0ff){var _0x5bf103=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bf103[_0x3377('0x1d')](_0x1b8212)){return _0x25054c;}else{throw new db['Sequelize'][(_0x3377('0x1e'))](_0x3377('0x1f'));}}else{return _0x25054c;}}function respondWithRpcPromise(_0x248ddb,_0x1ca24f,_0x28e27e,_0x3aff89){return new BPromise(function(_0x1f010b,_0x1191de){var _0x5ad057=_0x3aff89||client;return _0x5ad057[_0x3377('0x20')](_0x248ddb,_0x28e27e)[_0x3377('0x21')](function(_0x1bbb02){logger['info'](_0x3377('0x22'),_0x1ca24f,'request\x20sent');logger[_0x3377('0x23')](_0x3377('0x24'),_0x1ca24f,'request\x20sent',JSON['stringify'](_0x1bbb02));if(_0x1bbb02[_0x3377('0x25')]){if(_0x1bbb02[_0x3377('0x25')][_0x3377('0x26')]===0x1f4){logger['error'](_0x3377('0x22'),_0x1ca24f,_0x1bbb02[_0x3377('0x25')][_0x3377('0x27')]);return _0x1191de(_0x1bbb02[_0x3377('0x25')][_0x3377('0x27')]);}logger[_0x3377('0x25')](_0x3377('0x22'),_0x1ca24f,_0x1bbb02[_0x3377('0x25')][_0x3377('0x27')]);return _0x1f010b(_0x1bbb02[_0x3377('0x25')]['message']);}else{logger[_0x3377('0x28')](_0x3377('0x22'),_0x1ca24f,_0x3377('0x29'));_0x1f010b(_0x1bbb02['result'][_0x3377('0x27')]);}})[_0x3377('0x2a')](function(_0x41c8cd){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1ca24f,_0x41c8cd);_0x1191de(_0x41c8cd);});});}function respondWithStatusCode(_0x30dc83,_0x47fd4f){_0x47fd4f=_0x47fd4f||0xcc;return function(_0x42aa44){if(_0x42aa44){return _0x30dc83[_0x3377('0x2b')](_0x47fd4f);}return _0x30dc83['status'](_0x47fd4f)[_0x3377('0x2c')]();};}function respondWithResult(_0xe6c85,_0x3ca7fe){_0x3ca7fe=_0x3ca7fe||0xc8;return function(_0x5218b6){if(_0x5218b6){return _0xe6c85['status'](_0x3ca7fe)[_0x3377('0x2d')](_0x5218b6);}};}function respondWithFilteredResult(_0x4ce8b1,_0x58f6d5){return function(_0x23656d){if(_0x23656d){var _0xf263c6=_0x23656d[_0x3377('0x2e')],_0x748982=_0x58f6d5[_0x3377('0x2f')],_0x19a25e=_0x58f6d5[_0x3377('0x2f')]+_0x58f6d5[_0x3377('0x30')],_0x2d0e12;if(_0x19a25e>=_0xf263c6){_0x19a25e=_0xf263c6;_0x2d0e12=0xc8;}else{_0x2d0e12=0xce;}_0x4ce8b1[_0x3377('0x31')](_0x2d0e12);return _0x4ce8b1[_0x3377('0x32')](_0x3377('0x33'),_0x748982+'-'+_0x19a25e+'/'+_0xf263c6)[_0x3377('0x2d')](_0x23656d);}return null;};}function patchUpdates(_0x103561){return function(_0x24b422){try{jsonpatch[_0x3377('0x34')](_0x24b422,_0x103561,!![]);}catch(_0x58242d){return BPromise['reject'](_0x58242d);}return _0x24b422[_0x3377('0x35')]();};}function saveUpdates(_0x3a6498,_0x3b2fd6){return function(_0x57ce90){if(_0x57ce90){return _0x57ce90[_0x3377('0x36')](_0x3a6498)[_0x3377('0x21')](function(_0x19f450){return _0x19f450;});}return null;};}function removeEntity(_0x25731c,_0x3c1de7){return function(_0x58d64e){if(_0x58d64e){return _0x58d64e[_0x3377('0x37')]()[_0x3377('0x21')](function(){_0x25731c[_0x3377('0x31')](0xcc)[_0x3377('0x2c')]();});}};}function handleEntityNotFound(_0x29e8b2,_0x4788f2){return function(_0x4c00c6){if(!_0x4c00c6){_0x29e8b2[_0x3377('0x2b')](0x194);}return _0x4c00c6;};}function handleError(_0x5d79c4,_0x2a73d6){_0x2a73d6=_0x2a73d6||0x1f4;return function(_0x276699){logger[_0x3377('0x25')](_0x276699[_0x3377('0x38')]);if(_0x276699[_0x3377('0x39')]){delete _0x276699[_0x3377('0x39')];}_0x5d79c4[_0x3377('0x31')](_0x2a73d6)[_0x3377('0x3a')](_0x276699);};}exports[_0x3377('0x3b')]=function(_0x1694d5,_0x4bcaf9){var _0x277510={},_0x152284={},_0x334af1={'count':0x0,'rows':[]};var _0x147843=_[_0x3377('0x3c')](db[_0x3377('0x3d')][_0x3377('0x3e')],function(_0x3dfc5d){return{'name':_0x3dfc5d[_0x3377('0x3f')],'type':_0x3dfc5d['type']['key']};});_0x152284[_0x3377('0x40')]=_[_0x3377('0x3c')](_0x147843,_0x3377('0x39'));_0x152284[_0x3377('0x41')]=_['keys'](_0x1694d5[_0x3377('0x41')]);_0x152284[_0x3377('0x42')]=_[_0x3377('0x43')](_0x152284[_0x3377('0x40')],_0x152284[_0x3377('0x41')]);_0x277510[_0x3377('0x44')]=_['intersection'](_0x152284['model'],qs[_0x3377('0x45')](_0x1694d5[_0x3377('0x41')][_0x3377('0x45')]));_0x277510[_0x3377('0x44')]=_0x277510[_0x3377('0x44')][_0x3377('0x46')]?_0x277510[_0x3377('0x44')]:_0x152284[_0x3377('0x40')];if(!_0x1694d5[_0x3377('0x41')][_0x3377('0x47')]('nolimit')){_0x277510[_0x3377('0x30')]=qs[_0x3377('0x30')](_0x1694d5[_0x3377('0x41')]['limit']);_0x277510['offset']=qs[_0x3377('0x2f')](_0x1694d5[_0x3377('0x41')][_0x3377('0x2f')]);}_0x277510['order']=qs['sort'](_0x1694d5[_0x3377('0x41')][_0x3377('0x48')]);_0x277510[_0x3377('0x49')]=qs[_0x3377('0x42')](_[_0x3377('0x4a')](_0x1694d5['query'],_0x152284[_0x3377('0x42')]),_0x147843);if(_0x1694d5[_0x3377('0x41')][_0x3377('0x4b')]){_0x277510['where']=_['merge'](_0x277510[_0x3377('0x49')],{'$or':_[_0x3377('0x3c')](_0x147843,function(_0x496240){if(_0x496240[_0x3377('0x4c')]!==_0x3377('0x4d')){var _0x5398bf={};_0x5398bf[_0x496240['name']]={'$like':'%'+_0x1694d5[_0x3377('0x41')][_0x3377('0x4b')]+'%'};return _0x5398bf;}})});}_0x277510=_[_0x3377('0x4e')]({},_0x277510,_0x1694d5['options']);var _0x50efc9={'where':_0x277510['where']};return db[_0x3377('0x3d')][_0x3377('0x2e')](_0x50efc9)[_0x3377('0x21')](function(_0x215ac7){_0x334af1[_0x3377('0x2e')]=_0x215ac7;if(_0x1694d5[_0x3377('0x41')]['includeAll']){_0x277510[_0x3377('0x4f')]=[{'all':!![]}];}return db[_0x3377('0x3d')][_0x3377('0x50')](_0x277510);})[_0x3377('0x21')](function(_0x3eb9a6){_0x334af1[_0x3377('0x51')]=_0x3eb9a6;return _0x334af1;})['then'](respondWithFilteredResult(_0x4bcaf9,_0x277510))[_0x3377('0x2a')](handleError(_0x4bcaf9,null));};exports[_0x3377('0x52')]=function(_0x529860,_0xb4c743){var _0x59a8e7={'raw':![],'where':{'id':_0x529860[_0x3377('0x53')]['id']}},_0xbf1f3e={};_0xbf1f3e[_0x3377('0x40')]=_['keys'](db[_0x3377('0x3d')][_0x3377('0x3e')]);_0xbf1f3e[_0x3377('0x41')]=_['keys'](_0x529860[_0x3377('0x41')]);_0xbf1f3e[_0x3377('0x42')]=_[_0x3377('0x43')](_0xbf1f3e[_0x3377('0x40')],_0xbf1f3e[_0x3377('0x41')]);_0x59a8e7[_0x3377('0x44')]=_[_0x3377('0x43')](_0xbf1f3e[_0x3377('0x40')],qs[_0x3377('0x45')](_0x529860[_0x3377('0x41')][_0x3377('0x45')]));_0x59a8e7[_0x3377('0x44')]=_0x59a8e7[_0x3377('0x44')][_0x3377('0x46')]?_0x59a8e7[_0x3377('0x44')]:_0xbf1f3e['model'];if(_0x529860[_0x3377('0x41')]['includeAll']){_0x59a8e7[_0x3377('0x4f')]=[{'all':!![]}];}_0x59a8e7=_[_0x3377('0x4e')]({},_0x59a8e7,_0x529860[_0x3377('0x54')]);return db[_0x3377('0x3d')][_0x3377('0x55')](_0x59a8e7)[_0x3377('0x21')](handleEntityNotFound(_0xb4c743,null))['then'](respondWithResult(_0xb4c743,null))[_0x3377('0x2a')](handleError(_0xb4c743,null));};exports[_0x3377('0x56')]=function(_0x5b1ba8,_0x49fc02){return db['ZohoAccount'][_0x3377('0x56')](_0x5b1ba8[_0x3377('0x57')],{})[_0x3377('0x21')](respondWithResult(_0x49fc02,0xc9))['catch'](handleError(_0x49fc02,null));};exports[_0x3377('0x36')]=function(_0x3f3987,_0x162156){if(_0x3f3987[_0x3377('0x57')]['id']){delete _0x3f3987[_0x3377('0x57')]['id'];}return db[_0x3377('0x3d')]['find']({'where':{'id':_0x3f3987['params']['id']}})[_0x3377('0x21')](handleEntityNotFound(_0x162156,null))['then'](saveUpdates(_0x3f3987[_0x3377('0x57')],null))['then'](respondWithResult(_0x162156,null))[_0x3377('0x2a')](handleError(_0x162156,null));};exports[_0x3377('0x37')]=function(_0x5c3346,_0x468ca8){return db[_0x3377('0x3d')][_0x3377('0x55')]({'where':{'id':_0x5c3346[_0x3377('0x53')]['id']}})[_0x3377('0x21')](handleEntityNotFound(_0x468ca8,null))[_0x3377('0x21')](removeEntity(_0x468ca8,null))[_0x3377('0x2a')](handleError(_0x468ca8,null));};exports[_0x3377('0x58')]=function(_0x17c46b,_0x569973,_0x38db39){var _0x5967e0={};var _0x1ac4d6={};var _0x2ae34c;var _0x18e066;return db[_0x3377('0x3d')]['findOne']({'where':{'id':_0x17c46b[_0x3377('0x53')]['id']}})[_0x3377('0x21')](handleEntityNotFound(_0x569973,null))['then'](function(_0x107bf2){if(_0x107bf2){_0x2ae34c=_0x107bf2;_0x1ac4d6[_0x3377('0x40')]=_[_0x3377('0x59')](db[_0x3377('0x5a')][_0x3377('0x3e')]);_0x1ac4d6['query']=_['keys'](_0x17c46b[_0x3377('0x41')]);_0x1ac4d6[_0x3377('0x42')]=_[_0x3377('0x43')](_0x1ac4d6[_0x3377('0x40')],_0x1ac4d6[_0x3377('0x41')]);_0x5967e0[_0x3377('0x44')]=_[_0x3377('0x43')](_0x1ac4d6[_0x3377('0x40')],qs['fields'](_0x17c46b[_0x3377('0x41')][_0x3377('0x45')]));_0x5967e0[_0x3377('0x44')]=_0x5967e0[_0x3377('0x44')][_0x3377('0x46')]?_0x5967e0['attributes']:_0x1ac4d6[_0x3377('0x40')];_0x5967e0[_0x3377('0x5b')]=qs[_0x3377('0x48')](_0x17c46b[_0x3377('0x41')]['sort']);_0x5967e0[_0x3377('0x49')]=qs['filters'](_[_0x3377('0x4a')](_0x17c46b[_0x3377('0x41')],_0x1ac4d6[_0x3377('0x42')]));if(_0x17c46b['query'][_0x3377('0x4b')]){_0x5967e0[_0x3377('0x49')]=_[_0x3377('0x4e')](_0x5967e0[_0x3377('0x49')],{'$or':_[_0x3377('0x3c')](_0x5967e0[_0x3377('0x44')],function(_0xf8835f){var _0x1fef2c={};_0x1fef2c[_0xf8835f]={'$like':'%'+_0x17c46b[_0x3377('0x41')]['filter']+'%'};return _0x1fef2c;})});}_0x5967e0=_[_0x3377('0x4e')]({},_0x5967e0,_0x17c46b[_0x3377('0x54')]);return _0x2ae34c['getConfigurations'](_0x5967e0);}})[_0x3377('0x21')](function(_0x557b7c){if(_0x557b7c){_0x18e066=_0x557b7c[_0x3377('0x46')];if(!_0x17c46b['query']['hasOwnProperty'](_0x3377('0x5c'))){_0x5967e0[_0x3377('0x30')]=qs['limit'](_0x17c46b['query'][_0x3377('0x30')]);_0x5967e0['offset']=qs['offset'](_0x17c46b[_0x3377('0x41')]['offset']);}return _0x2ae34c['getConfigurations'](_0x5967e0);}})[_0x3377('0x21')](function(_0x259ba4){if(_0x259ba4){return _0x259ba4?{'count':_0x18e066,'rows':_0x259ba4}:null;}})[_0x3377('0x21')](respondWithResult(_0x569973,null))[_0x3377('0x2a')](handleError(_0x569973,null));};exports[_0x3377('0x5d')]=function(_0x5676d1,_0x1fcddb,_0x8af83c){if(_0x5676d1[_0x3377('0x57')]['id']){delete _0x5676d1['body']['id'];}return db[_0x3377('0x3d')][_0x3377('0x5e')]({'where':{'id':_0x5676d1[_0x3377('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fcddb,null))[_0x3377('0x21')](function(_0x5e2dab){if(_0x5e2dab){_0x5676d1[_0x3377('0x57')][_0x3377('0x5f')]=_0x5e2dab['id'];_0x5676d1[_0x3377('0x57')][_0x3377('0x60')]=integrations[_0x3377('0x61')](_0x5676d1[_0x3377('0x57')][_0x3377('0x62')],_0x5676d1[_0x3377('0x57')]['type']);_0x5676d1[_0x3377('0x57')]['Descriptions']=integrations[_0x3377('0x63')](_0x5676d1[_0x3377('0x57')][_0x3377('0x62')],_0x5676d1[_0x3377('0x57')][_0x3377('0x4c')]);return db['ZohoConfiguration'][_0x3377('0x56')](_0x5676d1[_0x3377('0x57')],{'include':[{'model':db['ZohoField'],'as':_0x3377('0x60')},{'model':db[_0x3377('0x64')],'as':_0x3377('0x65')}]});}return null;})[_0x3377('0x21')](respondWithResult(_0x1fcddb,null))[_0x3377('0x2a')](handleError(_0x1fcddb,null));};function getAccessToken(_0x490455){return new Promise(function(_0x5e2e29,_0x1ba85a){var _0x43efa0;switch(_0x490455[_0x3377('0x66')]){case'US':_0x43efa0='https://accounts.zoho.com';break;case'AU':_0x43efa0=_0x3377('0x67');break;case'EU':_0x43efa0=_0x3377('0x68');break;case'IN':_0x43efa0=_0x3377('0x69');break;case'CN':_0x43efa0=_0x3377('0x6a');break;default:_0x43efa0=_0x3377('0x68');break;}var _0x410c55={'method':'POST','uri':_0x43efa0+_0x3377('0x6b'),'qs':{'refresh_token':_0x490455[_0x3377('0x6c')],'client_id':_0x490455[_0x3377('0x6d')],'client_secret':_0x490455[_0x3377('0x6e')],'grant_type':_0x3377('0x6f')},'json':!![]};return rp(_0x410c55)['then'](function(_0x191d9c){if(_0x191d9c[_0x3377('0x70')]){_0x5e2e29(_0x191d9c[_0x3377('0x70')]);}else{_0x1ba85a(_0x3377('0x71'));}})[_0x3377('0x2a')](function(_0x5324a9){_0x1ba85a(_0x5324a9);});});}exports[_0x3377('0x72')]=function(_0x3ab4d,_0x3b737c,_0x146ae7){var _0x325c4f,_0x2b2e79,_0x1954a7,_0x40f04d,_0x1e8dd5;return db[_0x3377('0x3d')][_0x3377('0x5e')]({'where':{'id':_0x3ab4d[_0x3377('0x53')]['id']},'attributes':['id','host',_0x3377('0x66'),_0x3377('0x6d'),_0x3377('0x6e'),_0x3377('0x73'),_0x3377('0x26'),_0x3377('0x6c')]})[_0x3377('0x21')](handleEntityNotFound(_0x3b737c,null))[_0x3377('0x21')](function(_0x2afd9b){_0x1e8dd5=_0x2afd9b;_0x325c4f=_0x1e8dd5['host'];_0x2b2e79=_0x325c4f===_0x3377('0x74')?'eu':_0x3377('0x75');_0x1954a7=_0x1e8dd5[_0x3377('0x73')];var _0xd32981=_0x1954a7[_0x3377('0x76')](-0x1);if(_0xd32981==='/'||_0xd32981==='\x5c'||_0xd32981===':'){_0x1954a7=_0x1954a7[_0x3377('0x77')](0x0,_0x1954a7[_0x3377('0x78')](_0xd32981));}if(!_0x1e8dd5[_0x3377('0x6c')]){throw new Error(_0x3377('0x79'));}return getAccessToken(_0x1e8dd5);})[_0x3377('0x21')](function(_0x380e04){if(_0x380e04){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2b2e79),'qs':{'module':_0x3377('0x7a')},'headers':{'Authorization':_0x3377('0x7b')+_0x380e04},'json':!![]});}})['then'](function(_0x40ba62){if(_0x40ba62){if(_0x40ba62[_0x3377('0x7c')]&&_0x40ba62[_0x3377('0x7c')][_0x3377('0x25')]){throw new Error(_0x40ba62[_0x3377('0x7c')][_0x3377('0x25')]['message']);}var _0x4bc48e=[];var _0x5782b3=[];var _0x1b36c1=[_0x3377('0x7d'),_0x3377('0x7e'),'Description',_0x3377('0x7f'),_0x3377('0x80'),_0x3377('0x81'),_0x3377('0x82'),_0x3377('0x83')];_0x5782b3=_[_0x3377('0x84')](_0x40ba62['fields'],function(_0x5728d9){return _0x1b36c1[_0x3377('0x85')](_0x5728d9[_0x3377('0x86')]);});for(var _0x468c44=0x0;_0x468c44<_0x5782b3[_0x3377('0x46')];_0x468c44++){if(_0x5782b3[_0x468c44]['system_mandatory']===![]){_0x4bc48e[_0x3377('0x87')]({'id':_0x5782b3[_0x468c44]['id'],'name':_0x5782b3[_0x468c44][_0x3377('0x88')],'custom':_0x5782b3[_0x468c44][_0x3377('0x89')],'options':_0x5782b3[_0x468c44]['data_type']===_0x3377('0x8a')&&_0x5782b3[_0x468c44][_0x3377('0x8b')][_0x3377('0x46')]>-0x1?_[_0x3377('0x3c')](_0x5782b3[_0x468c44][_0x3377('0x8b')],function(_0x7c7039){return{'name':_0x7c7039,'value':_0x7c7039};}):[]});}}return{'count':_0x4bc48e[_0x3377('0x46')],'rows':_0x4bc48e};}else{return{'count':0x0,'rows':[]};}})[_0x3377('0x21')](respondWithResult(_0x3b737c,null))[_0x3377('0x2a')](function(_0xa6ab1b){var _0x5eddc3=_0x3ab4d[_0x3377('0x41')][_0x3377('0x1d')]?0x1f4:_0xa6ab1b['statusCode']||0x1f4;logger['error'](_0x3377('0x8c'),_0x3377('0x72'),_0x5eddc3,JSON['stringify'](_0xa6ab1b));delete _0xa6ab1b[_0x3377('0x39')];if(_0x5eddc3===0x191){_0x5eddc3=0x190;}_0x3b737c[_0x3377('0x31')](_0x5eddc3)[_0x3377('0x3a')](_0x3ab4d['query'][_0x3377('0x1d')]?{'message':_0x3377('0x8d'),'statusCode':_0xa6ab1b[_0x3377('0x8e')]}:_0xa6ab1b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0e9725a..2cf7f8c 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 _0x7eff=['clientId','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientSecret','then','parse','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.cn','https://accounts.zoho.eu','application/x-www-form-urlencoded','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','changed','zone','serverUrl'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7eff,0x96));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var logger=require(_0xf7ef('0x1'))(_0xf7ef('0x2'));var moment=require(_0xf7ef('0x3'));var BPromise=require(_0xf7ef('0x4'));var rp=require(_0xf7ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7ef('0x6'));var config=require(_0xf7ef('0x7'));var attributes=require(_0xf7ef('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xf7ef('0x9')]=function(_0x50a4d7,_0x5c472f){return _0x50a4d7['define'](_0xf7ef('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x323db4,_0x54a51a,_0x4b031f){if(_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xc'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xd'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xe'))||_0x323db4['changed']('clientSecret')||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0xf'))||_0x323db4[_0xf7ef('0xb')](_0xf7ef('0x10'))){var _0x5829cc,_0x5a1077;_0x5829cc=_0x323db4[_0xf7ef('0xd')];var _0x4a01e7=_0x5829cc[_0xf7ef('0x11')](-0x1);if(_0x4a01e7==='/'||_0x4a01e7==='\x5c'||_0x4a01e7===':'){_0x5829cc=_0x5829cc[_0xf7ef('0x12')](0x0,_0x5829cc[_0xf7ef('0x13')](_0x4a01e7));}switch(_0x323db4[_0xf7ef('0xc')]){case'US':_0x5a1077='https://accounts.zoho.com';break;case'AU':_0x5a1077=_0xf7ef('0x14');break;case'IN':_0x5a1077=_0xf7ef('0x15');break;case'CN':_0x5a1077='https://accounts.zoho.com.cn';break;default:_0x5a1077='https://accounts.zoho.eu';break;}var _0x827262={'method':_0xf7ef('0x16'),'uri':_0x5a1077+_0xf7ef('0x17'),'form':{'grant_type':_0xf7ef('0x18'),'client_id':_0x323db4[_0xf7ef('0xe')],'client_secret':_0x323db4[_0xf7ef('0x19')],'redirect_uri':_0x323db4[_0xf7ef('0xd')],'code':_0x323db4[_0xf7ef('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x827262)[_0xf7ef('0x1a')](function(_0x181f28){var _0x146aef=JSON[_0xf7ef('0x1b')](_0x181f28);if(_0x146aef[_0xf7ef('0x1c')]){_0x323db4['refreshToken']=_0x146aef['refresh_token'];logger[_0xf7ef('0x1d')](util[_0xf7ef('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']));}else{logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']),util[_0xf7ef('0x22')](_0x146aef,{'showHidden':![],'depth':null}));}return _0x4b031f(null,_0x54a51a);})[_0xf7ef('0x23')](function(_0x33aece){logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x323db4[_0xf7ef('0x1f')],_0x323db4['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4b031f(_0x33aece);});}else{return _0x4b031f(null,_0x54a51a);}},'beforeUpdate':function(_0x40f0ac,_0x173e17,_0x61db4a){if(_0x40f0ac[_0xf7ef('0xb')](_0xf7ef('0xc'))||_0x40f0ac['changed'](_0xf7ef('0xd'))||_0x40f0ac['changed'](_0xf7ef('0xe'))||_0x40f0ac[_0xf7ef('0xb')]('clientSecret')||_0x40f0ac[_0xf7ef('0xb')]('code')||_0x40f0ac['changed'](_0xf7ef('0x10'))){var _0x2e71a0,_0x2f4f5c;_0x2e71a0=_0x40f0ac[_0xf7ef('0xd')];var _0x3a7c4a=_0x2e71a0[_0xf7ef('0x11')](-0x1);if(_0x3a7c4a==='/'||_0x3a7c4a==='\x5c'||_0x3a7c4a===':'){_0x2e71a0=_0x2e71a0[_0xf7ef('0x12')](0x0,_0x2e71a0[_0xf7ef('0x13')](_0x3a7c4a));}switch(_0x40f0ac[_0xf7ef('0xc')]){case'US':_0x2f4f5c='https://accounts.zoho.com';break;case'AU':_0x2f4f5c='https://accounts.zoho.com.au';break;case'IN':_0x2f4f5c='https://accounts.zoho.in';break;case'CN':_0x2f4f5c=_0xf7ef('0x24');break;default:_0x2f4f5c=_0xf7ef('0x25');break;}var _0x213abb={'method':'POST','uri':_0x2f4f5c+_0xf7ef('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x40f0ac[_0xf7ef('0xe')],'client_secret':_0x40f0ac[_0xf7ef('0x19')],'redirect_uri':_0x40f0ac[_0xf7ef('0xd')],'code':_0x40f0ac[_0xf7ef('0xf')]},'headers':{'Content-Type':_0xf7ef('0x26')}};return rp(_0x213abb)[_0xf7ef('0x1a')](function(_0x3507da){var _0x29f7e4=JSON['parse'](_0x3507da);if(_0x29f7e4['refresh_token']){_0x40f0ac[_0xf7ef('0x27')]=_0x29f7e4[_0xf7ef('0x1c')];logger[_0xf7ef('0x1d')](util[_0xf7ef('0x1e')](_0xf7ef('0x28'),_0x40f0ac['name'],_0x40f0ac['id']));}else{logger[_0xf7ef('0x20')](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x40f0ac[_0xf7ef('0x1f')],_0x40f0ac['id']),util[_0xf7ef('0x22')](_0x29f7e4,{'showHidden':![],'depth':null}));}return _0x61db4a(null,_0x173e17);})[_0xf7ef('0x23')](function(_0x24673a){logger['error'](util[_0xf7ef('0x1e')](_0xf7ef('0x21'),_0x40f0ac[_0xf7ef('0x1f')],_0x40f0ac['id']),util[_0xf7ef('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x61db4a(_0x24673a);});}else{return _0x61db4a(null,_0x173e17);}}}});}; \ No newline at end of file +var _0xc0ee=['ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','lastIndexOf','https://accounts.zoho.com.cn','/oauth/v2/token','then','refreshToken','catch','lodash','api','moment','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','zone','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','info','format'];(function(_0x56d947,_0x16e412){var _0x5b4f56=function(_0x5127d7){while(--_0x5127d7){_0x56d947['push'](_0x56d947['shift']());}};_0x5b4f56(++_0x16e412);}(_0xc0ee,0xd8));var _0xec0e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc0ee[_0x432682];return _0x463d05;};'use strict';var _=require(_0xec0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec0e('0x1'));var moment=require(_0xec0e('0x2'));var BPromise=require(_0xec0e('0x3'));var rp=require(_0xec0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec0e('0x5'));var attributes=require(_0xec0e('0x6'));var integrations=require(_0xec0e('0x7'));module[_0xec0e('0x8')]=function(_0x2c1422,_0x353952){return _0x2c1422[_0xec0e('0x9')](_0xec0e('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x117e9a,_0x58ad37,_0x442e03){if(_0x117e9a['changed'](_0xec0e('0xb'))||_0x117e9a[_0xec0e('0xc')]('serverUrl')||_0x117e9a[_0xec0e('0xc')](_0xec0e('0xd'))||_0x117e9a[_0xec0e('0xc')](_0xec0e('0xe'))||_0x117e9a[_0xec0e('0xc')](_0xec0e('0xf'))||_0x117e9a[_0xec0e('0xc')](_0xec0e('0x10'))){var _0x452662,_0x48c638;_0x452662=_0x117e9a[_0xec0e('0x11')];var _0x24042e=_0x452662[_0xec0e('0x12')](-0x1);if(_0x24042e==='/'||_0x24042e==='\x5c'||_0x24042e===':'){_0x452662=_0x452662[_0xec0e('0x13')](0x0,_0x452662['lastIndexOf'](_0x24042e));}switch(_0x117e9a[_0xec0e('0xb')]){case'US':_0x48c638=_0xec0e('0x14');break;case'AU':_0x48c638=_0xec0e('0x15');break;case'IN':_0x48c638=_0xec0e('0x16');break;case'CN':_0x48c638='https://accounts.zoho.com.cn';break;default:_0x48c638='https://accounts.zoho.eu';break;}var _0x52c869={'method':_0xec0e('0x17'),'uri':_0x48c638+'/oauth/v2/token','form':{'grant_type':_0xec0e('0x18'),'client_id':_0x117e9a[_0xec0e('0xd')],'client_secret':_0x117e9a[_0xec0e('0xe')],'redirect_uri':_0x117e9a['serverUrl'],'code':_0x117e9a['code']},'headers':{'Content-Type':_0xec0e('0x19')}};return rp(_0x52c869)['then'](function(_0x3b8403){var _0xa9ade3=JSON[_0xec0e('0x1a')](_0x3b8403);if(_0xa9ade3[_0xec0e('0x1b')]){_0x117e9a['refreshToken']=_0xa9ade3['refresh_token'];logger[_0xec0e('0x1c')](util[_0xec0e('0x1d')](_0xec0e('0x1e'),_0x117e9a['name'],_0x117e9a['id']));}else{logger['error'](util[_0xec0e('0x1d')](_0xec0e('0x1f'),_0x117e9a[_0xec0e('0x20')],_0x117e9a['id']),util['inspect'](_0xa9ade3,{'showHidden':![],'depth':null}));}return _0x442e03(null,_0x58ad37);})['catch'](function(_0x1e8c3b){logger[_0xec0e('0x21')](util[_0xec0e('0x1d')](_0xec0e('0x1f'),_0x117e9a[_0xec0e('0x20')],_0x117e9a['id']),util[_0xec0e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x442e03(_0x1e8c3b);});}else{return _0x442e03(null,_0x58ad37);}},'beforeUpdate':function(_0x1bd682,_0x51b9dd,_0x9a6404){if(_0x1bd682[_0xec0e('0xc')](_0xec0e('0xb'))||_0x1bd682['changed'](_0xec0e('0x11'))||_0x1bd682['changed'](_0xec0e('0xd'))||_0x1bd682[_0xec0e('0xc')]('clientSecret')||_0x1bd682['changed']('code')||_0x1bd682[_0xec0e('0xc')](_0xec0e('0x10'))){var _0x567527,_0x405ec7;_0x567527=_0x1bd682[_0xec0e('0x11')];var _0x22b4be=_0x567527['slice'](-0x1);if(_0x22b4be==='/'||_0x22b4be==='\x5c'||_0x22b4be===':'){_0x567527=_0x567527[_0xec0e('0x13')](0x0,_0x567527[_0xec0e('0x23')](_0x22b4be));}switch(_0x1bd682[_0xec0e('0xb')]){case'US':_0x405ec7='https://accounts.zoho.com';break;case'AU':_0x405ec7=_0xec0e('0x15');break;case'IN':_0x405ec7=_0xec0e('0x16');break;case'CN':_0x405ec7=_0xec0e('0x24');break;default:_0x405ec7='https://accounts.zoho.eu';break;}var _0x583556={'method':_0xec0e('0x17'),'uri':_0x405ec7+_0xec0e('0x25'),'form':{'grant_type':_0xec0e('0x18'),'client_id':_0x1bd682[_0xec0e('0xd')],'client_secret':_0x1bd682['clientSecret'],'redirect_uri':_0x1bd682[_0xec0e('0x11')],'code':_0x1bd682[_0xec0e('0xf')]},'headers':{'Content-Type':_0xec0e('0x19')}};return rp(_0x583556)[_0xec0e('0x26')](function(_0x145119){var _0x2c4d79=JSON[_0xec0e('0x1a')](_0x145119);if(_0x2c4d79[_0xec0e('0x1b')]){_0x1bd682[_0xec0e('0x27')]=_0x2c4d79[_0xec0e('0x1b')];logger['info'](util['format'](_0xec0e('0x1e'),_0x1bd682['name'],_0x1bd682['id']));}else{logger[_0xec0e('0x21')](util[_0xec0e('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bd682[_0xec0e('0x20')],_0x1bd682['id']),util[_0xec0e('0x22')](_0x2c4d79,{'showHidden':![],'depth':null}));}return _0x9a6404(null,_0x51b9dd);})[_0xec0e('0x28')](function(_0x14dff0){logger[_0xec0e('0x21')](util[_0xec0e('0x1d')](_0xec0e('0x1f'),_0x1bd682[_0xec0e('0x20')],_0x1bd682['id']),util[_0xec0e('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x9a6404(_0x14dff0);});}else{return _0x9a6404(null,_0x51b9dd);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 871fc38..30db4dd 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 _0xd08b=['where','attributes','limit','map','include','model','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd08b,0x156));var _0xbd08=function(_0x3bca2d,_0x1af8f4){_0x3bca2d=_0x3bca2d-0x0;var _0x144a7c=_0xd08b[_0x3bca2d];return _0x144a7c;};'use strict';var _=require(_0xbd08('0x0'));var util=require(_0xbd08('0x1'));var moment=require(_0xbd08('0x2'));var BPromise=require(_0xbd08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd08('0x5'));var logger=require(_0xbd08('0x6'))(_0xbd08('0x7'));var config=require(_0xbd08('0x8'));var jayson=require(_0xbd08('0x9'));var client=jayson[_0xbd08('0xa')][_0xbd08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7cdb6f,_0x1e0790,_0x503b77){return new BPromise(function(_0x2c4533,_0x1655be){return client[_0xbd08('0xc')](_0x7cdb6f,_0x503b77)[_0xbd08('0xd')](function(_0xfbc661){logger[_0xbd08('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1e0790,_0xbd08('0xf'));logger[_0xbd08('0x10')](_0xbd08('0x11'),_0x1e0790,_0xbd08('0xf'),JSON[_0xbd08('0x12')](_0xfbc661));if(_0xfbc661[_0xbd08('0x13')]){if(_0xfbc661[_0xbd08('0x13')][_0xbd08('0x14')]===0x1f4){logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0xfbc661['error']['message']);return _0x1655be(_0xfbc661[_0xbd08('0x13')][_0xbd08('0x16')]);}logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0xfbc661[_0xbd08('0x13')][_0xbd08('0x16')]);return _0x2c4533(_0xfbc661[_0xbd08('0x13')]['message']);}else{logger[_0xbd08('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1e0790,'request\x20sent');_0x2c4533(_0xfbc661['result'][_0xbd08('0x16')]);}})[_0xbd08('0x17')](function(_0x5402b0){logger[_0xbd08('0x13')](_0xbd08('0x15'),_0x1e0790,_0x5402b0);_0x1655be(_0x5402b0);});});}exports[_0xbd08('0x18')]=function(_0x1722a3){var _0x486186=this;return new Promise(function(_0x2b3e81,_0x1bebfe){return db[_0xbd08('0x19')][_0xbd08('0x1a')]({'raw':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1c')]||null:null,'attributes':_0x1722a3['options']?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1d')]||null:null,'limit':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')][_0xbd08('0x1e')]||null:null,'include':_0x1722a3[_0xbd08('0x1b')]?_0x1722a3[_0xbd08('0x1b')]['include']?_[_0xbd08('0x1f')](_0x1722a3[_0xbd08('0x1b')]['include'],function(_0x4cecca){return{'model':db[_0x4cecca['model']],'as':_0x4cecca['as'],'attributes':_0x4cecca['attributes'],'include':_0x4cecca[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x4cecca[_0xbd08('0x20')],function(_0x42e7e7){return{'model':db[_0x42e7e7[_0xbd08('0x21')]],'as':_0x42e7e7['as'],'attributes':_0x42e7e7['attributes'],'include':_0x42e7e7[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x42e7e7[_0xbd08('0x20')],function(_0x1d89a3){return{'model':db[_0x1d89a3[_0xbd08('0x21')]],'as':_0x1d89a3['as'],'attributes':_0x1d89a3[_0xbd08('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd08('0xd')](function(_0x27554a){logger[_0xbd08('0xe')](_0xbd08('0x18'),_0x1722a3);logger[_0xbd08('0x10')]('GetZohoAccount',_0x1722a3,JSON[_0xbd08('0x12')](_0x27554a));_0x2b3e81(_0x27554a);})[_0xbd08('0x17')](function(_0x4fd6f5){logger[_0xbd08('0x13')](_0xbd08('0x18'),_0x4fd6f5[_0xbd08('0x16')],_0x1722a3);_0x1bebfe(_0x486186[_0xbd08('0x13')](0x1f4,_0x4fd6f5[_0xbd08('0x16')]));});});};exports[_0xbd08('0x22')]=function(_0x293e0f){var _0xa4adcd=this;return new Promise(function(_0x3f4d05,_0x453872){return db[_0xbd08('0x19')][_0xbd08('0x23')]({'raw':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x24')]===undefined?!![]:![]:!![],'where':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x1c')]||null:null,'attributes':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x1d')]||null:null,'include':_0x293e0f[_0xbd08('0x1b')]?_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x293e0f[_0xbd08('0x1b')][_0xbd08('0x20')],function(_0x2fb225){return{'model':db[_0x2fb225['model']],'as':_0x2fb225['as'],'attributes':_0x2fb225[_0xbd08('0x1d')],'include':_0x2fb225[_0xbd08('0x20')]?_['map'](_0x2fb225[_0xbd08('0x20')],function(_0x23410f){return{'model':db[_0x23410f[_0xbd08('0x21')]],'as':_0x23410f['as'],'attributes':_0x23410f[_0xbd08('0x1d')],'include':_0x23410f[_0xbd08('0x20')]?_[_0xbd08('0x1f')](_0x23410f[_0xbd08('0x20')],function(_0x584539){return{'model':db[_0x584539['model']],'as':_0x584539['as'],'attributes':_0x584539[_0xbd08('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd08('0xd')](function(_0x930272){logger[_0xbd08('0xe')](_0xbd08('0x22'),_0x293e0f);logger[_0xbd08('0x10')](_0xbd08('0x22'),_0x293e0f,JSON[_0xbd08('0x12')](_0x930272));_0x3f4d05(_0x930272);})[_0xbd08('0x17')](function(_0x5a63fa){logger['error'](_0xbd08('0x22'),_0x5a63fa['message'],_0x293e0f);_0x453872(_0xa4adcd[_0xbd08('0x13')](0x1f4,_0x5a63fa[_0xbd08('0x16')]));});});}; \ No newline at end of file +var _0x5ec3=['attributes','map','ShowZohoAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','limit','include','model'];(function(_0x5b60f0,_0x2f0586){var _0x39adc9=function(_0x484fa6){while(--_0x484fa6){_0x5b60f0['push'](_0x5b60f0['shift']());}};_0x39adc9(++_0x2f0586);}(_0x5ec3,0xf2));var _0x35ec=function(_0x35ecad,_0x3d79b7){_0x35ecad=_0x35ecad-0x0;var _0x1f184a=_0x5ec3[_0x35ecad];return _0x1f184a;};'use strict';var _=require(_0x35ec('0x0'));var util=require('util');var moment=require(_0x35ec('0x1'));var BPromise=require(_0x35ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ec('0x3'));var db=require(_0x35ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ec('0x5'))(_0x35ec('0x6'));var config=require(_0x35ec('0x7'));var jayson=require(_0x35ec('0x8'));var client=jayson[_0x35ec('0x9')][_0x35ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc6c653,_0x13b8a1,_0x40528f){return new BPromise(function(_0x4dacf4,_0x1659d0){return client[_0x35ec('0xb')](_0xc6c653,_0x40528f)[_0x35ec('0xc')](function(_0x166fb6){logger['info'](_0x35ec('0xd'),_0x13b8a1,_0x35ec('0xe'));logger['debug'](_0x35ec('0xf'),_0x13b8a1,_0x35ec('0xe'),JSON[_0x35ec('0x10')](_0x166fb6));if(_0x166fb6[_0x35ec('0x11')]){if(_0x166fb6[_0x35ec('0x11')]['code']===0x1f4){logger[_0x35ec('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x13b8a1,_0x166fb6[_0x35ec('0x11')][_0x35ec('0x12')]);return _0x1659d0(_0x166fb6[_0x35ec('0x11')][_0x35ec('0x12')]);}logger[_0x35ec('0x11')](_0x35ec('0xd'),_0x13b8a1,_0x166fb6['error']['message']);return _0x4dacf4(_0x166fb6[_0x35ec('0x11')][_0x35ec('0x12')]);}else{logger[_0x35ec('0x13')](_0x35ec('0xd'),_0x13b8a1,'request\x20sent');_0x4dacf4(_0x166fb6[_0x35ec('0x14')][_0x35ec('0x12')]);}})[_0x35ec('0x15')](function(_0x588f50){logger[_0x35ec('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x13b8a1,_0x588f50);_0x1659d0(_0x588f50);});});}exports[_0x35ec('0x16')]=function(_0x1f4ccf){var _0x4e50a9=this;return new Promise(function(_0x2ba6fc,_0x18e6d3){return db['ZohoAccount'][_0x35ec('0x17')]({'raw':_0x1f4ccf[_0x35ec('0x18')]?_0x1f4ccf[_0x35ec('0x18')][_0x35ec('0x19')]===undefined?!![]:![]:!![],'where':_0x1f4ccf[_0x35ec('0x18')]?_0x1f4ccf[_0x35ec('0x18')][_0x35ec('0x1a')]||null:null,'attributes':_0x1f4ccf[_0x35ec('0x18')]?_0x1f4ccf[_0x35ec('0x18')]['attributes']||null:null,'limit':_0x1f4ccf[_0x35ec('0x18')]?_0x1f4ccf[_0x35ec('0x18')][_0x35ec('0x1b')]||null:null,'include':_0x1f4ccf[_0x35ec('0x18')]?_0x1f4ccf[_0x35ec('0x18')][_0x35ec('0x1c')]?_['map'](_0x1f4ccf['options']['include'],function(_0x57babe){return{'model':db[_0x57babe[_0x35ec('0x1d')]],'as':_0x57babe['as'],'attributes':_0x57babe[_0x35ec('0x1e')],'include':_0x57babe[_0x35ec('0x1c')]?_['map'](_0x57babe[_0x35ec('0x1c')],function(_0x2b6cc2){return{'model':db[_0x2b6cc2[_0x35ec('0x1d')]],'as':_0x2b6cc2['as'],'attributes':_0x2b6cc2[_0x35ec('0x1e')],'include':_0x2b6cc2[_0x35ec('0x1c')]?_[_0x35ec('0x1f')](_0x2b6cc2[_0x35ec('0x1c')],function(_0x558747){return{'model':db[_0x558747[_0x35ec('0x1d')]],'as':_0x558747['as'],'attributes':_0x558747[_0x35ec('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x311932){logger[_0x35ec('0x13')](_0x35ec('0x16'),_0x1f4ccf);logger['debug'](_0x35ec('0x16'),_0x1f4ccf,JSON[_0x35ec('0x10')](_0x311932));_0x2ba6fc(_0x311932);})[_0x35ec('0x15')](function(_0x349878){logger[_0x35ec('0x11')](_0x35ec('0x16'),_0x349878[_0x35ec('0x12')],_0x1f4ccf);_0x18e6d3(_0x4e50a9[_0x35ec('0x11')](0x1f4,_0x349878['message']));});});};exports[_0x35ec('0x20')]=function(_0x3e6319){var _0xd017e6=this;return new Promise(function(_0x33b7e7,_0x12b487){return db['ZohoAccount'][_0x35ec('0x21')]({'raw':_0x3e6319[_0x35ec('0x18')]?_0x3e6319[_0x35ec('0x18')][_0x35ec('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6319[_0x35ec('0x18')]?_0x3e6319[_0x35ec('0x18')][_0x35ec('0x1a')]||null:null,'attributes':_0x3e6319[_0x35ec('0x18')]?_0x3e6319['options'][_0x35ec('0x1e')]||null:null,'include':_0x3e6319['options']?_0x3e6319['options'][_0x35ec('0x1c')]?_[_0x35ec('0x1f')](_0x3e6319['options'][_0x35ec('0x1c')],function(_0x1f1f73){return{'model':db[_0x1f1f73[_0x35ec('0x1d')]],'as':_0x1f1f73['as'],'attributes':_0x1f1f73[_0x35ec('0x1e')],'include':_0x1f1f73[_0x35ec('0x1c')]?_[_0x35ec('0x1f')](_0x1f1f73[_0x35ec('0x1c')],function(_0x62cb1d){return{'model':db[_0x62cb1d[_0x35ec('0x1d')]],'as':_0x62cb1d['as'],'attributes':_0x62cb1d[_0x35ec('0x1e')],'include':_0x62cb1d[_0x35ec('0x1c')]?_[_0x35ec('0x1f')](_0x62cb1d['include'],function(_0xab3cf9){return{'model':db[_0xab3cf9[_0x35ec('0x1d')]],'as':_0xab3cf9['as'],'attributes':_0xab3cf9[_0x35ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x35ec('0xc')](function(_0x5de5eb){logger[_0x35ec('0x13')](_0x35ec('0x20'),_0x3e6319);logger['debug']('ShowZohoAccount',_0x3e6319,JSON[_0x35ec('0x10')](_0x5de5eb));_0x33b7e7(_0x5de5eb);})['catch'](function(_0x2c6d9b){logger['error'](_0x35ec('0x20'),_0x2c6d9b[_0x35ec('0x12')],_0x3e6319);_0x12b487(_0xd017e6['error'](0x1f4,_0x2c6d9b[_0x35ec('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 8663fa5..ba5b20c 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 _0x7b37=['getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','/:id/subjects'];(function(_0x54b3f9,_0x47a40e){var _0x1789a9=function(_0xfaf50a){while(--_0xfaf50a){_0x54b3f9['push'](_0x54b3f9['shift']());}};_0x1789a9(++_0x47a40e);}(_0x7b37,0xd9));var _0x77b3=function(_0x5b9986,_0x5d376a){_0x5b9986=_0x5b9986-0x0;var _0x2c3085=_0x7b37[_0x5b9986];return _0x2c3085;};'use strict';var multer=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var path=require('path');var timeout=require(_0x77b3('0x2'));var express=require(_0x77b3('0x3'));var router=express['Router']();var auth=require(_0x77b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77b3('0x5'));var controller=require(_0x77b3('0x6'));router[_0x77b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x77b3('0x8')]);router[_0x77b3('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x77b3('0x9')]);router['get'](_0x77b3('0xa'),auth[_0x77b3('0xb')](),controller['getFields']);router[_0x77b3('0x7')](_0x77b3('0xc'),auth[_0x77b3('0xb')](),controller[_0x77b3('0xd')]);router[_0x77b3('0x7')](_0x77b3('0xe'),auth[_0x77b3('0xb')](),controller[_0x77b3('0xf')]);router[_0x77b3('0x10')]('/',auth[_0x77b3('0xb')](),controller['create']);router[_0x77b3('0x11')](_0x77b3('0x12'),auth[_0x77b3('0xb')](),controller[_0x77b3('0x13')]);router[_0x77b3('0x14')](_0x77b3('0x12'),auth[_0x77b3('0xb')](),controller[_0x77b3('0x15')]);module[_0x77b3('0x16')]=router; \ No newline at end of file +var _0xe493=['show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x2b6095,_0x3662d0){var _0x4adf6b=function(_0x3c90cc){while(--_0x3c90cc){_0x2b6095['push'](_0x2b6095['shift']());}};_0x4adf6b(++_0x3662d0);}(_0xe493,0x7e));var _0x3e49=function(_0x4e170c,_0x2838c2){_0x4e170c=_0x4e170c-0x0;var _0x26a21b=_0xe493[_0x4e170c];return _0x26a21b;};'use strict';var multer=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var path=require(_0x3e49('0x2'));var timeout=require(_0x3e49('0x3'));var express=require(_0x3e49('0x4'));var router=express['Router']();var auth=require(_0x3e49('0x5'));var interaction=require(_0x3e49('0x6'));var config=require('../../config/environment');var controller=require(_0x3e49('0x7'));router['get']('/',auth[_0x3e49('0x8')](),controller[_0x3e49('0x9')]);router[_0x3e49('0xa')](_0x3e49('0xb'),auth[_0x3e49('0x8')](),controller[_0x3e49('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x3e49('0xd')]);router[_0x3e49('0xa')](_0x3e49('0xe'),auth[_0x3e49('0x8')](),controller[_0x3e49('0xf')]);router[_0x3e49('0xa')](_0x3e49('0x10'),auth[_0x3e49('0x8')](),controller[_0x3e49('0x11')]);router[_0x3e49('0x12')]('/',auth[_0x3e49('0x8')](),controller['create']);router[_0x3e49('0x13')](_0x3e49('0xb'),auth['isAuthenticated'](),controller[_0x3e49('0x14')]);router[_0x3e49('0x15')]('/:id',auth[_0x3e49('0x8')](),controller[_0x3e49('0x16')]);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 999711c..274ca9b 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 _0x5095=['nothing','ENUM','contact_lead','sequelize','exports','STRING','lead','contact'];(function(_0x501019,_0x37cc47){var _0x594059=function(_0x4320f7){while(--_0x4320f7){_0x501019['push'](_0x501019['shift']());}};_0x594059(++_0x37cc47);}(_0x5095,0xe3));var _0x5509=function(_0x3b66e5,_0x1c23f8){_0x3b66e5=_0x3b66e5-0x0;var _0x1a4c31=_0x5095[_0x3b66e5];return _0x1a4c31;};'use strict';var Sequelize=require(_0x5509('0x0'));module[_0x5509('0x1')]={'name':{'type':Sequelize[_0x5509('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x5509('0x3'),_0x5509('0x4'),_0x5509('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x5509('0x6')]('contact_lead',_0x5509('0x4'),'lead'),'defaultValue':_0x5509('0x7')},'description':{'type':Sequelize[_0x5509('0x2')]}}; \ No newline at end of file +var _0x5465=['ENUM','lead','contact_lead','contact','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5465,0x1d8));var _0x5546=function(_0x3dd5d2,_0x52b2f5){_0x3dd5d2=_0x3dd5d2-0x0;var _0x8b5683=_0x5465[_0x3dd5d2];return _0x8b5683;};'use strict';var Sequelize=require(_0x5546('0x0'));module['exports']={'name':{'type':Sequelize[_0x5546('0x1')]},'moduleCreate':{'type':Sequelize[_0x5546('0x2')](_0x5546('0x3'),'contact','nothing'),'defaultValue':_0x5546('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5546('0x4'),_0x5546('0x5'),_0x5546('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index f318ff6..5816686 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 _0x6070=['jsforce','desk.js','to-csv','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','include','find','create','body','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x6070,0x19a));var _0x0607=function(_0x43819f,_0x1ab95b){_0x43819f=_0x43819f-0x0;var _0x8d9f39=_0x6070[_0x43819f];return _0x8d9f39;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0607('0x0'));var rimraf=require(_0x0607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0607('0x2'));var rp=require(_0x0607('0x3'));var moment=require('moment');var BPromise=require(_0x0607('0x4'));var Mustache=require(_0x0607('0x5'));var util=require(_0x0607('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0607('0x7'));var squel=require(_0x0607('0x8'));var crypto=require(_0x0607('0x9'));var jsforce=require(_0x0607('0xa'));var deskjs=require(_0x0607('0xb'));var toCsv=require(_0x0607('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0607('0xd'));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(_0x0607('0xe'))(_0x0607('0xf'));var utils=require('../../config/utils');var config=require(_0x0607('0x10'));var db=require(_0x0607('0x11'))['db'];var jayson=require(_0x0607('0x12'));var client=jayson[_0x0607('0x13')][_0x0607('0x14')]({'port':0x232a});function checkPasswordPattern(_0x134c48,_0x1bdab4,_0x4965a1){if(_0x4965a1){var _0x2f2287=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2f2287['test'](_0x1bdab4)){return _0x134c48;}else{throw new db[(_0x0607('0x15'))][(_0x0607('0x16'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x134c48;}}function respondWithRpcPromise(_0x41c87a,_0x36090d,_0x5473f5,_0x5b4dde){return new BPromise(function(_0x55041d,_0x3c0421){var _0x52004e=_0x5b4dde||client;return _0x52004e[_0x0607('0x17')](_0x41c87a,_0x5473f5)[_0x0607('0x18')](function(_0x474595){logger[_0x0607('0x19')](_0x0607('0x1a'),_0x36090d,_0x0607('0x1b'));logger['debug'](_0x0607('0x1c'),_0x36090d,'request\x20sent',JSON[_0x0607('0x1d')](_0x474595));if(_0x474595[_0x0607('0x1e')]){if(_0x474595[_0x0607('0x1e')]['code']===0x1f4){logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);return _0x3c0421(_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);}logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);return _0x55041d(_0x474595[_0x0607('0x1e')][_0x0607('0x1f')]);}else{logger[_0x0607('0x19')](_0x0607('0x1a'),_0x36090d,_0x0607('0x1b'));_0x55041d(_0x474595['result']['message']);}})[_0x0607('0x20')](function(_0x2aca92){logger[_0x0607('0x1e')](_0x0607('0x1a'),_0x36090d,_0x2aca92);_0x3c0421(_0x2aca92);});});}function respondWithStatusCode(_0x4f382c,_0x4b591c){_0x4b591c=_0x4b591c||0xcc;return function(_0x1092a4){if(_0x1092a4){return _0x4f382c[_0x0607('0x21')](_0x4b591c);}return _0x4f382c[_0x0607('0x22')](_0x4b591c)[_0x0607('0x23')]();};}function respondWithResult(_0x4b61e5,_0x395dcd){_0x395dcd=_0x395dcd||0xc8;return function(_0xee0a22){if(_0xee0a22){return _0x4b61e5[_0x0607('0x22')](_0x395dcd)[_0x0607('0x24')](_0xee0a22);}};}function respondWithFilteredResult(_0x4cb0e0,_0x397161){return function(_0x30d6d1){if(_0x30d6d1){var _0x2634a1=_0x30d6d1['count'],_0x3217f9=_0x397161[_0x0607('0x25')],_0x15e0e1=_0x397161['offset']+_0x397161[_0x0607('0x26')],_0xdd4e4d;if(_0x15e0e1>=_0x2634a1){_0x15e0e1=_0x2634a1;_0xdd4e4d=0xc8;}else{_0xdd4e4d=0xce;}_0x4cb0e0[_0x0607('0x22')](_0xdd4e4d);return _0x4cb0e0['set'](_0x0607('0x27'),_0x3217f9+'-'+_0x15e0e1+'/'+_0x2634a1)[_0x0607('0x24')](_0x30d6d1);}return null;};}function patchUpdates(_0x17ce6c){return function(_0x28442b){try{jsonpatch[_0x0607('0x28')](_0x28442b,_0x17ce6c,!![]);}catch(_0x2fe94e){return BPromise['reject'](_0x2fe94e);}return _0x28442b[_0x0607('0x29')]();};}function saveUpdates(_0x2946f6,_0x2b0d0e){return function(_0x3fe1a4){if(_0x3fe1a4){return _0x3fe1a4[_0x0607('0x2a')](_0x2946f6)[_0x0607('0x18')](function(_0x2438ee){return _0x2438ee;});}return null;};}function removeEntity(_0x4378f0,_0x2440b2){return function(_0x55fe91){if(_0x55fe91){return _0x55fe91[_0x0607('0x2b')]()['then'](function(){_0x4378f0[_0x0607('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300a0f,_0x3301b5){return function(_0x5b7e4c){if(!_0x5b7e4c){_0x300a0f[_0x0607('0x21')](0x194);}return _0x5b7e4c;};}function handleError(_0x8e5513,_0x507c22){_0x507c22=_0x507c22||0x1f4;return function(_0x207b7e){logger[_0x0607('0x1e')](_0x207b7e[_0x0607('0x2c')]);if(_0x207b7e[_0x0607('0x2d')]){delete _0x207b7e[_0x0607('0x2d')];}_0x8e5513[_0x0607('0x22')](_0x507c22)[_0x0607('0x2e')](_0x207b7e);};}exports['index']=function(_0x2ae4d4,_0x49df57){var _0x47e5ff={},_0xaa829b={},_0xd9c3d0={'count':0x0,'rows':[]};var _0x4dd1f3=_[_0x0607('0x2f')](db[_0x0607('0x30')][_0x0607('0x31')],function(_0xe82283){return{'name':_0xe82283[_0x0607('0x32')],'type':_0xe82283[_0x0607('0x33')]['key']};});_0xaa829b[_0x0607('0x34')]=_[_0x0607('0x2f')](_0x4dd1f3,'name');_0xaa829b['query']=_[_0x0607('0x35')](_0x2ae4d4['query']);_0xaa829b[_0x0607('0x36')]=_[_0x0607('0x37')](_0xaa829b[_0x0607('0x34')],_0xaa829b[_0x0607('0x38')]);_0x47e5ff['attributes']=_[_0x0607('0x37')](_0xaa829b['model'],qs[_0x0607('0x39')](_0x2ae4d4['query'][_0x0607('0x39')]));_0x47e5ff[_0x0607('0x3a')]=_0x47e5ff[_0x0607('0x3a')][_0x0607('0x3b')]?_0x47e5ff[_0x0607('0x3a')]:_0xaa829b[_0x0607('0x34')];if(!_0x2ae4d4[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x47e5ff[_0x0607('0x26')]=qs[_0x0607('0x26')](_0x2ae4d4[_0x0607('0x38')]['limit']);_0x47e5ff[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x2ae4d4[_0x0607('0x38')][_0x0607('0x25')]);}_0x47e5ff[_0x0607('0x3e')]=qs['sort'](_0x2ae4d4[_0x0607('0x38')][_0x0607('0x3f')]);_0x47e5ff[_0x0607('0x40')]=qs[_0x0607('0x36')](_[_0x0607('0x41')](_0x2ae4d4['query'],_0xaa829b[_0x0607('0x36')]),_0x4dd1f3);if(_0x2ae4d4['query'][_0x0607('0x42')]){_0x47e5ff[_0x0607('0x40')]=_[_0x0607('0x43')](_0x47e5ff['where'],{'$or':_[_0x0607('0x2f')](_0x4dd1f3,function(_0xe2520){if(_0xe2520[_0x0607('0x33')]!==_0x0607('0x44')){var _0x11eff7={};_0x11eff7[_0xe2520[_0x0607('0x2d')]]={'$like':'%'+_0x2ae4d4['query'][_0x0607('0x42')]+'%'};return _0x11eff7;}})});}_0x47e5ff=_[_0x0607('0x43')]({},_0x47e5ff,_0x2ae4d4[_0x0607('0x45')]);var _0x284e2c={'where':_0x47e5ff['where']};return db[_0x0607('0x30')][_0x0607('0x46')](_0x284e2c)[_0x0607('0x18')](function(_0x3e8b61){_0xd9c3d0[_0x0607('0x46')]=_0x3e8b61;if(_0x2ae4d4[_0x0607('0x38')][_0x0607('0x47')]){_0x47e5ff['include']=[{'all':!![]}];}return db[_0x0607('0x30')][_0x0607('0x48')](_0x47e5ff);})[_0x0607('0x18')](function(_0xbd6b07){_0xd9c3d0['rows']=_0xbd6b07;return _0xd9c3d0;})[_0x0607('0x18')](respondWithFilteredResult(_0x49df57,_0x47e5ff))[_0x0607('0x20')](handleError(_0x49df57,null));};exports[_0x0607('0x49')]=function(_0x4be0d0,_0x2f0314){var _0x1011d6={'raw':![],'where':{'id':_0x4be0d0[_0x0607('0x4a')]['id']}},_0x4ba85b={};_0x4ba85b[_0x0607('0x34')]=_[_0x0607('0x35')](db[_0x0607('0x30')][_0x0607('0x31')]);_0x4ba85b[_0x0607('0x38')]=_[_0x0607('0x35')](_0x4be0d0['query']);_0x4ba85b[_0x0607('0x36')]=_[_0x0607('0x37')](_0x4ba85b[_0x0607('0x34')],_0x4ba85b[_0x0607('0x38')]);_0x1011d6[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x4ba85b['model'],qs[_0x0607('0x39')](_0x4be0d0[_0x0607('0x38')][_0x0607('0x39')]));_0x1011d6['attributes']=_0x1011d6[_0x0607('0x3a')]['length']?_0x1011d6[_0x0607('0x3a')]:_0x4ba85b[_0x0607('0x34')];if(_0x4be0d0[_0x0607('0x38')][_0x0607('0x47')]){_0x1011d6[_0x0607('0x4b')]=[{'all':!![]}];}_0x1011d6=_['merge']({},_0x1011d6,_0x4be0d0['options']);return db[_0x0607('0x30')][_0x0607('0x4c')](_0x1011d6)[_0x0607('0x18')](handleEntityNotFound(_0x2f0314,null))['then'](respondWithResult(_0x2f0314,null))[_0x0607('0x20')](handleError(_0x2f0314,null));};exports[_0x0607('0x4d')]=function(_0x355136,_0x323317){return db['ZohoConfiguration'][_0x0607('0x4d')](_0x355136['body'],{})[_0x0607('0x18')](respondWithResult(_0x323317,0xc9))[_0x0607('0x20')](handleError(_0x323317,null));};exports[_0x0607('0x2a')]=function(_0x42f172,_0x349974){if(_0x42f172[_0x0607('0x4e')]['id']){delete _0x42f172[_0x0607('0x4e')]['id'];}return db[_0x0607('0x30')]['find']({'where':{'id':_0x42f172[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x349974,null))[_0x0607('0x18')](saveUpdates(_0x42f172[_0x0607('0x4e')],null))[_0x0607('0x18')](respondWithResult(_0x349974,null))[_0x0607('0x20')](handleError(_0x349974,null));};exports[_0x0607('0x2b')]=function(_0x555a99,_0xb5e1f){return db[_0x0607('0x30')][_0x0607('0x4c')]({'where':{'id':_0x555a99[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0xb5e1f,null))[_0x0607('0x18')](removeEntity(_0xb5e1f,null))['catch'](handleError(_0xb5e1f,null));};exports[_0x0607('0x4f')]=function(_0x204ed0,_0x135f12,_0x302929){var _0x2c70de={};var _0x513f29={};var _0xaddbfb;var _0x4359d3;return db[_0x0607('0x30')][_0x0607('0x50')]({'where':{'id':_0x204ed0[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x135f12,null))['then'](function(_0x4d26b9){if(_0x4d26b9){_0xaddbfb=_0x4d26b9;_0x513f29['model']=_[_0x0607('0x35')](db['ZohoField'][_0x0607('0x31')]);_0x513f29['query']=_['keys'](_0x204ed0[_0x0607('0x38')]);_0x513f29[_0x0607('0x36')]=_[_0x0607('0x37')](_0x513f29['model'],_0x513f29['query']);_0x2c70de[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x513f29[_0x0607('0x34')],qs['fields'](_0x204ed0['query']['fields']));_0x2c70de[_0x0607('0x3a')]=_0x2c70de[_0x0607('0x3a')][_0x0607('0x3b')]?_0x2c70de['attributes']:_0x513f29[_0x0607('0x34')];_0x2c70de[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x204ed0[_0x0607('0x38')]['sort']);_0x2c70de[_0x0607('0x40')]=qs['filters'](_['pick'](_0x204ed0[_0x0607('0x38')],_0x513f29[_0x0607('0x36')]));if(_0x204ed0[_0x0607('0x38')][_0x0607('0x42')]){_0x2c70de[_0x0607('0x40')]=_[_0x0607('0x43')](_0x2c70de[_0x0607('0x40')],{'$or':_[_0x0607('0x2f')](_0x2c70de[_0x0607('0x3a')],function(_0x21842b){var _0x488a07={};_0x488a07[_0x21842b]={'$like':'%'+_0x204ed0[_0x0607('0x38')][_0x0607('0x42')]+'%'};return _0x488a07;})});}_0x2c70de=_[_0x0607('0x43')]({},_0x2c70de,_0x204ed0['options']);return _0xaddbfb[_0x0607('0x4f')](_0x2c70de);}})[_0x0607('0x18')](function(_0x1b71de){if(_0x1b71de){_0x4359d3=_0x1b71de[_0x0607('0x3b')];if(!_0x204ed0[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x2c70de['limit']=qs[_0x0607('0x26')](_0x204ed0[_0x0607('0x38')][_0x0607('0x26')]);_0x2c70de['offset']=qs['offset'](_0x204ed0[_0x0607('0x38')]['offset']);}return _0xaddbfb[_0x0607('0x4f')](_0x2c70de);}})[_0x0607('0x18')](function(_0x269434){if(_0x269434){return _0x269434?{'count':_0x4359d3,'rows':_0x269434}:null;}})[_0x0607('0x18')](respondWithResult(_0x135f12,null))[_0x0607('0x20')](handleError(_0x135f12,null));};exports[_0x0607('0x51')]=function(_0x23941a,_0x2aaf8a,_0x4ce959){var _0x5e2c48={};var _0x4c4b5c={};var _0x4d549d;var _0x19e166;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x23941a[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x2aaf8a,null))[_0x0607('0x18')](function(_0x44b97e){if(_0x44b97e){_0x4d549d=_0x44b97e;_0x4c4b5c['model']=_['keys'](db[_0x0607('0x52')][_0x0607('0x31')]);_0x4c4b5c['query']=_[_0x0607('0x35')](_0x23941a[_0x0607('0x38')]);_0x4c4b5c['filters']=_[_0x0607('0x37')](_0x4c4b5c[_0x0607('0x34')],_0x4c4b5c['query']);_0x5e2c48[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x4c4b5c['model'],qs[_0x0607('0x39')](_0x23941a[_0x0607('0x38')][_0x0607('0x39')]));_0x5e2c48['attributes']=_0x5e2c48[_0x0607('0x3a')][_0x0607('0x3b')]?_0x5e2c48[_0x0607('0x3a')]:_0x4c4b5c[_0x0607('0x34')];_0x5e2c48[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x23941a['query'][_0x0607('0x3f')]);_0x5e2c48[_0x0607('0x40')]=qs['filters'](_[_0x0607('0x41')](_0x23941a[_0x0607('0x38')],_0x4c4b5c['filters']));if(_0x23941a[_0x0607('0x38')][_0x0607('0x42')]){_0x5e2c48[_0x0607('0x40')]=_[_0x0607('0x43')](_0x5e2c48[_0x0607('0x40')],{'$or':_[_0x0607('0x2f')](_0x5e2c48[_0x0607('0x3a')],function(_0x55e7d9){var _0x47412e={};_0x47412e[_0x55e7d9]={'$like':'%'+_0x23941a[_0x0607('0x38')][_0x0607('0x42')]+'%'};return _0x47412e;})});}_0x5e2c48=_[_0x0607('0x43')]({},_0x5e2c48,_0x23941a[_0x0607('0x45')]);return _0x4d549d[_0x0607('0x51')](_0x5e2c48);}})[_0x0607('0x18')](function(_0x28480a){if(_0x28480a){_0x19e166=_0x28480a[_0x0607('0x3b')];if(!_0x23941a['query'][_0x0607('0x3c')](_0x0607('0x3d'))){_0x5e2c48['limit']=qs[_0x0607('0x26')](_0x23941a[_0x0607('0x38')][_0x0607('0x26')]);_0x5e2c48[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x23941a[_0x0607('0x38')][_0x0607('0x25')]);}return _0x4d549d[_0x0607('0x51')](_0x5e2c48);}})[_0x0607('0x18')](function(_0xb13e0f){if(_0xb13e0f){return _0xb13e0f?{'count':_0x19e166,'rows':_0xb13e0f}:null;}})[_0x0607('0x18')](respondWithResult(_0x2aaf8a,null))[_0x0607('0x20')](handleError(_0x2aaf8a,null));};exports[_0x0607('0x53')]=function(_0x5c817b,_0x4a74a4,_0x27808d){var _0x378c60={};var _0x715d1c={};var _0x401424;var _0x3541d5;return db[_0x0607('0x30')][_0x0607('0x50')]({'where':{'id':_0x5c817b[_0x0607('0x4a')]['id']}})[_0x0607('0x18')](handleEntityNotFound(_0x4a74a4,null))[_0x0607('0x18')](function(_0x5bbc5f){if(_0x5bbc5f){_0x401424=_0x5bbc5f;_0x715d1c[_0x0607('0x34')]=_[_0x0607('0x35')](db['ZohoField']['rawAttributes']);_0x715d1c['query']=_['keys'](_0x5c817b[_0x0607('0x38')]);_0x715d1c[_0x0607('0x36')]=_[_0x0607('0x37')](_0x715d1c[_0x0607('0x34')],_0x715d1c[_0x0607('0x38')]);_0x378c60[_0x0607('0x3a')]=_[_0x0607('0x37')](_0x715d1c[_0x0607('0x34')],qs['fields'](_0x5c817b['query'][_0x0607('0x39')]));_0x378c60[_0x0607('0x3a')]=_0x378c60[_0x0607('0x3a')][_0x0607('0x3b')]?_0x378c60[_0x0607('0x3a')]:_0x715d1c['model'];_0x378c60[_0x0607('0x3e')]=qs[_0x0607('0x3f')](_0x5c817b['query'][_0x0607('0x3f')]);_0x378c60[_0x0607('0x40')]=qs['filters'](_['pick'](_0x5c817b['query'],_0x715d1c[_0x0607('0x36')]));if(_0x5c817b[_0x0607('0x38')][_0x0607('0x42')]){_0x378c60[_0x0607('0x40')]=_['merge'](_0x378c60['where'],{'$or':_['map'](_0x378c60['attributes'],function(_0x2bf0bd){var _0x3d063d={};_0x3d063d[_0x2bf0bd]={'$like':'%'+_0x5c817b[_0x0607('0x38')]['filter']+'%'};return _0x3d063d;})});}_0x378c60=_[_0x0607('0x43')]({},_0x378c60,_0x5c817b[_0x0607('0x45')]);return _0x401424[_0x0607('0x53')](_0x378c60);}})[_0x0607('0x18')](function(_0x144f94){if(_0x144f94){_0x3541d5=_0x144f94['length'];if(!_0x5c817b[_0x0607('0x38')][_0x0607('0x3c')](_0x0607('0x3d'))){_0x378c60[_0x0607('0x26')]=qs[_0x0607('0x26')](_0x5c817b[_0x0607('0x38')][_0x0607('0x26')]);_0x378c60[_0x0607('0x25')]=qs[_0x0607('0x25')](_0x5c817b[_0x0607('0x38')][_0x0607('0x25')]);}return _0x401424[_0x0607('0x53')](_0x378c60);}})[_0x0607('0x18')](function(_0x2add81){if(_0x2add81){return _0x2add81?{'count':_0x3541d5,'rows':_0x2add81}:null;}})['then'](respondWithResult(_0x4a74a4,null))[_0x0607('0x20')](handleError(_0x4a74a4,null));}; \ No newline at end of file +var _0x2005=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','stack','name','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','ZohoConfiguration','includeAll','include','findAll','rows','params','rawAttributes','length','options','create','body','destroy','find','getFields','findOne','ZohoField','nolimit','getSubjects','getDescriptions','html-pdf'];(function(_0x24368d,_0x3656d4){var _0x42fd3c=function(_0xc73891){while(--_0xc73891){_0x24368d['push'](_0x24368d['shift']());}};_0x42fd3c(++_0x3656d4);}(_0x2005,0xb7));var _0x5200=function(_0x206192,_0x111bb2){_0x206192=_0x206192-0x0;var _0x27e778=_0x2005[_0x206192];return _0x27e778;};'use strict';var pdf=require(_0x5200('0x0'));var emlformat=require(_0x5200('0x1'));var rimraf=require(_0x5200('0x2'));var zipdir=require(_0x5200('0x3'));var jsonpatch=require(_0x5200('0x4'));var rp=require(_0x5200('0x5'));var moment=require('moment');var BPromise=require(_0x5200('0x6'));var Mustache=require(_0x5200('0x7'));var util=require(_0x5200('0x8'));var path=require(_0x5200('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5200('0xa'));var fs=require('fs');var _=require(_0x5200('0xb'));var squel=require(_0x5200('0xc'));var crypto=require('crypto');var jsforce=require(_0x5200('0xd'));var deskjs=require(_0x5200('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5200('0xf'));var Papa=require(_0x5200('0x10'));var Redis=require(_0x5200('0x11'));var authService=require(_0x5200('0x12'));var qs=require(_0x5200('0x13'));var as=require(_0x5200('0x14'));var hardwareService=require(_0x5200('0x15'));var logger=require(_0x5200('0x16'))(_0x5200('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5200('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5200('0x19')][_0x5200('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x534893,_0x168a4b,_0x495882){if(_0x495882){var _0x337d4e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x337d4e[_0x5200('0x1b')](_0x168a4b)){return _0x534893;}else{throw new db[(_0x5200('0x1c'))]['ValidationError'](_0x5200('0x1d'));}}else{return _0x534893;}}function respondWithRpcPromise(_0x40cdeb,_0x290cfb,_0x2bbd3a,_0x5f3844){return new BPromise(function(_0x5d199c,_0x5ec46b){var _0x1667be=_0x5f3844||client;return _0x1667be[_0x5200('0x1e')](_0x40cdeb,_0x2bbd3a)['then'](function(_0x3f5d18){logger[_0x5200('0x1f')](_0x5200('0x20'),_0x290cfb,'request\x20sent');logger[_0x5200('0x21')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x290cfb,_0x5200('0x22'),JSON['stringify'](_0x3f5d18));if(_0x3f5d18[_0x5200('0x23')]){if(_0x3f5d18[_0x5200('0x23')][_0x5200('0x24')]===0x1f4){logger[_0x5200('0x23')](_0x5200('0x20'),_0x290cfb,_0x3f5d18['error'][_0x5200('0x25')]);return _0x5ec46b(_0x3f5d18[_0x5200('0x23')][_0x5200('0x25')]);}logger['error'](_0x5200('0x20'),_0x290cfb,_0x3f5d18[_0x5200('0x23')][_0x5200('0x25')]);return _0x5d199c(_0x3f5d18[_0x5200('0x23')][_0x5200('0x25')]);}else{logger['info'](_0x5200('0x20'),_0x290cfb,_0x5200('0x22'));_0x5d199c(_0x3f5d18['result']['message']);}})[_0x5200('0x26')](function(_0x402126){logger[_0x5200('0x23')](_0x5200('0x20'),_0x290cfb,_0x402126);_0x5ec46b(_0x402126);});});}function respondWithStatusCode(_0x3cba6e,_0x6cf86e){_0x6cf86e=_0x6cf86e||0xcc;return function(_0x22a3dc){if(_0x22a3dc){return _0x3cba6e[_0x5200('0x27')](_0x6cf86e);}return _0x3cba6e[_0x5200('0x28')](_0x6cf86e)[_0x5200('0x29')]();};}function respondWithResult(_0x43e8d9,_0x42550c){_0x42550c=_0x42550c||0xc8;return function(_0x1dbf37){if(_0x1dbf37){return _0x43e8d9[_0x5200('0x28')](_0x42550c)['json'](_0x1dbf37);}};}function respondWithFilteredResult(_0x543833,_0x54f64e){return function(_0x2d2df6){if(_0x2d2df6){var _0x31c81b=_0x2d2df6[_0x5200('0x2a')],_0xd9a47c=_0x54f64e[_0x5200('0x2b')],_0x1e6174=_0x54f64e[_0x5200('0x2b')]+_0x54f64e[_0x5200('0x2c')],_0x334d69;if(_0x1e6174>=_0x31c81b){_0x1e6174=_0x31c81b;_0x334d69=0xc8;}else{_0x334d69=0xce;}_0x543833[_0x5200('0x28')](_0x334d69);return _0x543833[_0x5200('0x2d')](_0x5200('0x2e'),_0xd9a47c+'-'+_0x1e6174+'/'+_0x31c81b)[_0x5200('0x2f')](_0x2d2df6);}return null;};}function patchUpdates(_0x5d0c07){return function(_0x954f2b){try{jsonpatch[_0x5200('0x30')](_0x954f2b,_0x5d0c07,!![]);}catch(_0x294b60){return BPromise[_0x5200('0x31')](_0x294b60);}return _0x954f2b['save']();};}function saveUpdates(_0x48e9a8,_0x5a7489){return function(_0x3dfeaa){if(_0x3dfeaa){return _0x3dfeaa[_0x5200('0x32')](_0x48e9a8)[_0x5200('0x33')](function(_0x188389){return _0x188389;});}return null;};}function removeEntity(_0x31f6cd,_0x21fc3f){return function(_0x4776dc){if(_0x4776dc){return _0x4776dc['destroy']()[_0x5200('0x33')](function(){_0x31f6cd[_0x5200('0x28')](0xcc)[_0x5200('0x29')]();});}};}function handleEntityNotFound(_0x1222d9,_0x51de90){return function(_0x1f6b75){if(!_0x1f6b75){_0x1222d9['sendStatus'](0x194);}return _0x1f6b75;};}function handleError(_0x4b1b38,_0x62d9af){_0x62d9af=_0x62d9af||0x1f4;return function(_0x51892f){logger[_0x5200('0x23')](_0x51892f[_0x5200('0x34')]);if(_0x51892f['name']){delete _0x51892f[_0x5200('0x35')];}_0x4b1b38['status'](_0x62d9af)['send'](_0x51892f);};}exports['index']=function(_0x5657ac,_0x55901f){var _0x25ee5e={},_0x114ec4={},_0x4d333d={'count':0x0,'rows':[]};var _0x5485a5=_[_0x5200('0x36')](db['ZohoConfiguration']['rawAttributes'],function(_0x402804){return{'name':_0x402804[_0x5200('0x37')],'type':_0x402804[_0x5200('0x38')][_0x5200('0x39')]};});_0x114ec4[_0x5200('0x3a')]=_[_0x5200('0x36')](_0x5485a5,_0x5200('0x35'));_0x114ec4[_0x5200('0x3b')]=_[_0x5200('0x3c')](_0x5657ac[_0x5200('0x3b')]);_0x114ec4[_0x5200('0x3d')]=_['intersection'](_0x114ec4[_0x5200('0x3a')],_0x114ec4[_0x5200('0x3b')]);_0x25ee5e[_0x5200('0x3e')]=_[_0x5200('0x3f')](_0x114ec4['model'],qs[_0x5200('0x40')](_0x5657ac['query'][_0x5200('0x40')]));_0x25ee5e[_0x5200('0x3e')]=_0x25ee5e['attributes']['length']?_0x25ee5e[_0x5200('0x3e')]:_0x114ec4[_0x5200('0x3a')];if(!_0x5657ac[_0x5200('0x3b')][_0x5200('0x41')]('nolimit')){_0x25ee5e[_0x5200('0x2c')]=qs[_0x5200('0x2c')](_0x5657ac['query'][_0x5200('0x2c')]);_0x25ee5e[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x5657ac[_0x5200('0x3b')]['offset']);}_0x25ee5e[_0x5200('0x42')]=qs[_0x5200('0x43')](_0x5657ac['query'][_0x5200('0x43')]);_0x25ee5e[_0x5200('0x44')]=qs[_0x5200('0x3d')](_[_0x5200('0x45')](_0x5657ac[_0x5200('0x3b')],_0x114ec4[_0x5200('0x3d')]),_0x5485a5);if(_0x5657ac[_0x5200('0x3b')][_0x5200('0x46')]){_0x25ee5e[_0x5200('0x44')]=_['merge'](_0x25ee5e['where'],{'$or':_[_0x5200('0x36')](_0x5485a5,function(_0x22af3b){if(_0x22af3b[_0x5200('0x38')]!==_0x5200('0x47')){var _0x3fd96d={};_0x3fd96d[_0x22af3b[_0x5200('0x35')]]={'$like':'%'+_0x5657ac[_0x5200('0x3b')][_0x5200('0x46')]+'%'};return _0x3fd96d;}})});}_0x25ee5e=_[_0x5200('0x48')]({},_0x25ee5e,_0x5657ac['options']);var _0xd76694={'where':_0x25ee5e[_0x5200('0x44')]};return db[_0x5200('0x49')][_0x5200('0x2a')](_0xd76694)[_0x5200('0x33')](function(_0x3e2e48){_0x4d333d[_0x5200('0x2a')]=_0x3e2e48;if(_0x5657ac[_0x5200('0x3b')][_0x5200('0x4a')]){_0x25ee5e[_0x5200('0x4b')]=[{'all':!![]}];}return db[_0x5200('0x49')][_0x5200('0x4c')](_0x25ee5e);})[_0x5200('0x33')](function(_0x1e789a){_0x4d333d[_0x5200('0x4d')]=_0x1e789a;return _0x4d333d;})[_0x5200('0x33')](respondWithFilteredResult(_0x55901f,_0x25ee5e))[_0x5200('0x26')](handleError(_0x55901f,null));};exports['show']=function(_0xa0f3eb,_0xccfb5){var _0x57ad26={'raw':![],'where':{'id':_0xa0f3eb[_0x5200('0x4e')]['id']}},_0x3e92e0={};_0x3e92e0[_0x5200('0x3a')]=_[_0x5200('0x3c')](db['ZohoConfiguration'][_0x5200('0x4f')]);_0x3e92e0[_0x5200('0x3b')]=_[_0x5200('0x3c')](_0xa0f3eb[_0x5200('0x3b')]);_0x3e92e0[_0x5200('0x3d')]=_[_0x5200('0x3f')](_0x3e92e0[_0x5200('0x3a')],_0x3e92e0['query']);_0x57ad26[_0x5200('0x3e')]=_[_0x5200('0x3f')](_0x3e92e0['model'],qs[_0x5200('0x40')](_0xa0f3eb[_0x5200('0x3b')][_0x5200('0x40')]));_0x57ad26[_0x5200('0x3e')]=_0x57ad26['attributes'][_0x5200('0x50')]?_0x57ad26[_0x5200('0x3e')]:_0x3e92e0[_0x5200('0x3a')];if(_0xa0f3eb['query'][_0x5200('0x4a')]){_0x57ad26[_0x5200('0x4b')]=[{'all':!![]}];}_0x57ad26=_[_0x5200('0x48')]({},_0x57ad26,_0xa0f3eb[_0x5200('0x51')]);return db[_0x5200('0x49')]['find'](_0x57ad26)[_0x5200('0x33')](handleEntityNotFound(_0xccfb5,null))['then'](respondWithResult(_0xccfb5,null))[_0x5200('0x26')](handleError(_0xccfb5,null));};exports['create']=function(_0x1a6122,_0x5d7512){return db[_0x5200('0x49')][_0x5200('0x52')](_0x1a6122[_0x5200('0x53')],{})['then'](respondWithResult(_0x5d7512,0xc9))[_0x5200('0x26')](handleError(_0x5d7512,null));};exports[_0x5200('0x32')]=function(_0x2ffb54,_0x11f30c){if(_0x2ffb54['body']['id']){delete _0x2ffb54[_0x5200('0x53')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x2ffb54[_0x5200('0x4e')]['id']}})[_0x5200('0x33')](handleEntityNotFound(_0x11f30c,null))['then'](saveUpdates(_0x2ffb54[_0x5200('0x53')],null))[_0x5200('0x33')](respondWithResult(_0x11f30c,null))['catch'](handleError(_0x11f30c,null));};exports[_0x5200('0x54')]=function(_0x4a48b8,_0x4b4660){return db['ZohoConfiguration'][_0x5200('0x55')]({'where':{'id':_0x4a48b8['params']['id']}})[_0x5200('0x33')](handleEntityNotFound(_0x4b4660,null))[_0x5200('0x33')](removeEntity(_0x4b4660,null))['catch'](handleError(_0x4b4660,null));};exports[_0x5200('0x56')]=function(_0x414ee5,_0x3e98b1,_0x2350f6){var _0x2a800d={};var _0x30ab11={};var _0x13170a;var _0x4ec4c0;return db[_0x5200('0x49')][_0x5200('0x57')]({'where':{'id':_0x414ee5['params']['id']}})[_0x5200('0x33')](handleEntityNotFound(_0x3e98b1,null))[_0x5200('0x33')](function(_0x120fc7){if(_0x120fc7){_0x13170a=_0x120fc7;_0x30ab11[_0x5200('0x3a')]=_[_0x5200('0x3c')](db[_0x5200('0x58')][_0x5200('0x4f')]);_0x30ab11[_0x5200('0x3b')]=_[_0x5200('0x3c')](_0x414ee5[_0x5200('0x3b')]);_0x30ab11[_0x5200('0x3d')]=_['intersection'](_0x30ab11[_0x5200('0x3a')],_0x30ab11[_0x5200('0x3b')]);_0x2a800d[_0x5200('0x3e')]=_[_0x5200('0x3f')](_0x30ab11[_0x5200('0x3a')],qs[_0x5200('0x40')](_0x414ee5[_0x5200('0x3b')][_0x5200('0x40')]));_0x2a800d['attributes']=_0x2a800d[_0x5200('0x3e')][_0x5200('0x50')]?_0x2a800d[_0x5200('0x3e')]:_0x30ab11['model'];_0x2a800d[_0x5200('0x42')]=qs[_0x5200('0x43')](_0x414ee5['query'][_0x5200('0x43')]);_0x2a800d[_0x5200('0x44')]=qs[_0x5200('0x3d')](_[_0x5200('0x45')](_0x414ee5['query'],_0x30ab11[_0x5200('0x3d')]));if(_0x414ee5[_0x5200('0x3b')][_0x5200('0x46')]){_0x2a800d[_0x5200('0x44')]=_[_0x5200('0x48')](_0x2a800d[_0x5200('0x44')],{'$or':_[_0x5200('0x36')](_0x2a800d[_0x5200('0x3e')],function(_0x3ca9e5){var _0x3e3fb5={};_0x3e3fb5[_0x3ca9e5]={'$like':'%'+_0x414ee5[_0x5200('0x3b')][_0x5200('0x46')]+'%'};return _0x3e3fb5;})});}_0x2a800d=_[_0x5200('0x48')]({},_0x2a800d,_0x414ee5[_0x5200('0x51')]);return _0x13170a['getFields'](_0x2a800d);}})[_0x5200('0x33')](function(_0x5bd3e0){if(_0x5bd3e0){_0x4ec4c0=_0x5bd3e0[_0x5200('0x50')];if(!_0x414ee5['query']['hasOwnProperty'](_0x5200('0x59'))){_0x2a800d[_0x5200('0x2c')]=qs[_0x5200('0x2c')](_0x414ee5[_0x5200('0x3b')]['limit']);_0x2a800d[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x414ee5[_0x5200('0x3b')][_0x5200('0x2b')]);}return _0x13170a[_0x5200('0x56')](_0x2a800d);}})[_0x5200('0x33')](function(_0x35ce90){if(_0x35ce90){return _0x35ce90?{'count':_0x4ec4c0,'rows':_0x35ce90}:null;}})[_0x5200('0x33')](respondWithResult(_0x3e98b1,null))['catch'](handleError(_0x3e98b1,null));};exports[_0x5200('0x5a')]=function(_0x2d72ff,_0x154f4a,_0x506844){var _0x28afbc={};var _0x27e3e5={};var _0x65a75b;var _0x5c4be1;return db['ZohoConfiguration'][_0x5200('0x57')]({'where':{'id':_0x2d72ff[_0x5200('0x4e')]['id']}})[_0x5200('0x33')](handleEntityNotFound(_0x154f4a,null))[_0x5200('0x33')](function(_0x377f7b){if(_0x377f7b){_0x65a75b=_0x377f7b;_0x27e3e5[_0x5200('0x3a')]=_[_0x5200('0x3c')](db[_0x5200('0x58')][_0x5200('0x4f')]);_0x27e3e5[_0x5200('0x3b')]=_[_0x5200('0x3c')](_0x2d72ff[_0x5200('0x3b')]);_0x27e3e5[_0x5200('0x3d')]=_[_0x5200('0x3f')](_0x27e3e5['model'],_0x27e3e5[_0x5200('0x3b')]);_0x28afbc['attributes']=_[_0x5200('0x3f')](_0x27e3e5[_0x5200('0x3a')],qs['fields'](_0x2d72ff[_0x5200('0x3b')][_0x5200('0x40')]));_0x28afbc[_0x5200('0x3e')]=_0x28afbc[_0x5200('0x3e')]['length']?_0x28afbc['attributes']:_0x27e3e5['model'];_0x28afbc[_0x5200('0x42')]=qs[_0x5200('0x43')](_0x2d72ff[_0x5200('0x3b')][_0x5200('0x43')]);_0x28afbc[_0x5200('0x44')]=qs[_0x5200('0x3d')](_['pick'](_0x2d72ff[_0x5200('0x3b')],_0x27e3e5[_0x5200('0x3d')]));if(_0x2d72ff[_0x5200('0x3b')][_0x5200('0x46')]){_0x28afbc['where']=_[_0x5200('0x48')](_0x28afbc[_0x5200('0x44')],{'$or':_[_0x5200('0x36')](_0x28afbc[_0x5200('0x3e')],function(_0x189de9){var _0x29dcf4={};_0x29dcf4[_0x189de9]={'$like':'%'+_0x2d72ff[_0x5200('0x3b')][_0x5200('0x46')]+'%'};return _0x29dcf4;})});}_0x28afbc=_['merge']({},_0x28afbc,_0x2d72ff['options']);return _0x65a75b[_0x5200('0x5a')](_0x28afbc);}})['then'](function(_0x369779){if(_0x369779){_0x5c4be1=_0x369779[_0x5200('0x50')];if(!_0x2d72ff['query'][_0x5200('0x41')]('nolimit')){_0x28afbc[_0x5200('0x2c')]=qs[_0x5200('0x2c')](_0x2d72ff[_0x5200('0x3b')][_0x5200('0x2c')]);_0x28afbc[_0x5200('0x2b')]=qs[_0x5200('0x2b')](_0x2d72ff[_0x5200('0x3b')][_0x5200('0x2b')]);}return _0x65a75b[_0x5200('0x5a')](_0x28afbc);}})[_0x5200('0x33')](function(_0x4b7764){if(_0x4b7764){return _0x4b7764?{'count':_0x5c4be1,'rows':_0x4b7764}:null;}})[_0x5200('0x33')](respondWithResult(_0x154f4a,null))['catch'](handleError(_0x154f4a,null));};exports['getDescriptions']=function(_0x469db4,_0x7fb1ed,_0x54db60){var _0x20b2ba={};var _0x4ae6e1={};var _0x5d40e2;var _0x5cdc19;return db[_0x5200('0x49')][_0x5200('0x57')]({'where':{'id':_0x469db4[_0x5200('0x4e')]['id']}})[_0x5200('0x33')](handleEntityNotFound(_0x7fb1ed,null))[_0x5200('0x33')](function(_0x1bca1d){if(_0x1bca1d){_0x5d40e2=_0x1bca1d;_0x4ae6e1[_0x5200('0x3a')]=_[_0x5200('0x3c')](db['ZohoField'][_0x5200('0x4f')]);_0x4ae6e1[_0x5200('0x3b')]=_['keys'](_0x469db4['query']);_0x4ae6e1['filters']=_['intersection'](_0x4ae6e1[_0x5200('0x3a')],_0x4ae6e1[_0x5200('0x3b')]);_0x20b2ba[_0x5200('0x3e')]=_[_0x5200('0x3f')](_0x4ae6e1[_0x5200('0x3a')],qs[_0x5200('0x40')](_0x469db4[_0x5200('0x3b')][_0x5200('0x40')]));_0x20b2ba[_0x5200('0x3e')]=_0x20b2ba['attributes'][_0x5200('0x50')]?_0x20b2ba[_0x5200('0x3e')]:_0x4ae6e1[_0x5200('0x3a')];_0x20b2ba[_0x5200('0x42')]=qs['sort'](_0x469db4[_0x5200('0x3b')][_0x5200('0x43')]);_0x20b2ba['where']=qs[_0x5200('0x3d')](_[_0x5200('0x45')](_0x469db4[_0x5200('0x3b')],_0x4ae6e1[_0x5200('0x3d')]));if(_0x469db4[_0x5200('0x3b')]['filter']){_0x20b2ba[_0x5200('0x44')]=_[_0x5200('0x48')](_0x20b2ba[_0x5200('0x44')],{'$or':_[_0x5200('0x36')](_0x20b2ba[_0x5200('0x3e')],function(_0x4d6c3c){var _0x350a54={};_0x350a54[_0x4d6c3c]={'$like':'%'+_0x469db4[_0x5200('0x3b')][_0x5200('0x46')]+'%'};return _0x350a54;})});}_0x20b2ba=_[_0x5200('0x48')]({},_0x20b2ba,_0x469db4[_0x5200('0x51')]);return _0x5d40e2[_0x5200('0x5b')](_0x20b2ba);}})[_0x5200('0x33')](function(_0x5aa228){if(_0x5aa228){_0x5cdc19=_0x5aa228[_0x5200('0x50')];if(!_0x469db4['query']['hasOwnProperty'](_0x5200('0x59'))){_0x20b2ba[_0x5200('0x2c')]=qs[_0x5200('0x2c')](_0x469db4[_0x5200('0x3b')][_0x5200('0x2c')]);_0x20b2ba['offset']=qs[_0x5200('0x2b')](_0x469db4[_0x5200('0x3b')][_0x5200('0x2b')]);}return _0x5d40e2[_0x5200('0x5b')](_0x20b2ba);}})[_0x5200('0x33')](function(_0x25efc7){if(_0x25efc7){return _0x25efc7?{'count':_0x5cdc19,'rows':_0x25efc7}:null;}})['then'](respondWithResult(_0x7fb1ed,null))[_0x5200('0x26')](handleError(_0x7fb1ed,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4cf8962..e44d874 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 _0xca47=['ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x277425,_0x1d46ef){var _0x33d33c=function(_0x18a19d){while(--_0x18a19d){_0x277425['push'](_0x277425['shift']());}};_0x33d33c(++_0x1d46ef);}(_0xca47,0x1e3));var _0x7ca4=function(_0x47170b,_0x38aa89){_0x47170b=_0x47170b-0x0;var _0x87f57f=_0xca47[_0x47170b];return _0x87f57f;};'use strict';var _=require(_0x7ca4('0x0'));var util=require(_0x7ca4('0x1'));var logger=require('../../config/logger')(_0x7ca4('0x2'));var moment=require(_0x7ca4('0x3'));var BPromise=require(_0x7ca4('0x4'));var rp=require(_0x7ca4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca4('0x6'));var config=require(_0x7ca4('0x7'));var attributes=require(_0x7ca4('0x8'));module[_0x7ca4('0x9')]=function(_0x47b101,_0x4629a0){return _0x47b101[_0x7ca4('0xa')](_0x7ca4('0xb'),attributes,{'tableName':_0x7ca4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x859a=['lodash','api','moment','bluebird','path','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations'];(function(_0x54f746,_0x1f5abd){var _0x4c260c=function(_0x3c6e41){while(--_0x3c6e41){_0x54f746['push'](_0x54f746['shift']());}};_0x4c260c(++_0x1f5abd);}(_0x859a,0x10e));var _0xa859=function(_0x4fb41e,_0x3f46ca){_0x4fb41e=_0x4fb41e-0x0;var _0x55bee9=_0x859a[_0x4fb41e];return _0x55bee9;};'use strict';var _=require(_0xa859('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa859('0x1'));var moment=require(_0xa859('0x2'));var BPromise=require(_0xa859('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa859('0x4'));var rimraf=require('rimraf');var config=require(_0xa859('0x5'));var attributes=require(_0xa859('0x6'));module['exports']=function(_0x521f40,_0x16d80f){return _0x521f40[_0xa859('0x7')]('ZohoConfiguration',attributes,{'tableName':_0xa859('0x8'),'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 908664f..6590f00 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 _0x39e1=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','ioredis'];(function(_0x39b86c,_0x5a8b64){var _0x120b7a=function(_0x3478f7){while(--_0x3478f7){_0x39b86c['push'](_0x39b86c['shift']());}};_0x120b7a(++_0x5a8b64);}(_0x39e1,0xf9));var _0x139e=function(_0x4f0cfd,_0x2e0eb3){_0x4f0cfd=_0x4f0cfd-0x0;var _0x525f02=_0x39e1[_0x4f0cfd];return _0x525f02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x139e('0x0'));var BPromise=require(_0x139e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x139e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x139e('0x3'));var logger=require(_0x139e('0x4'))('rpc');var config=require(_0x139e('0x5'));var jayson=require(_0x139e('0x6'));var client=jayson[_0x139e('0x7')][_0x139e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43f49c,_0x579e5e,_0xac09b6){return new BPromise(function(_0x56eb15,_0x2b3ae6){return client[_0x139e('0x9')](_0x43f49c,_0xac09b6)[_0x139e('0xa')](function(_0x4eb941){logger[_0x139e('0xb')](_0x139e('0xc'),_0x579e5e,_0x139e('0xd'));logger[_0x139e('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x579e5e,_0x139e('0xd'),JSON[_0x139e('0xf')](_0x4eb941));if(_0x4eb941[_0x139e('0x10')]){if(_0x4eb941[_0x139e('0x10')][_0x139e('0x11')]===0x1f4){logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x4eb941['error'][_0x139e('0x12')]);return _0x2b3ae6(_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);}logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);return _0x56eb15(_0x4eb941[_0x139e('0x10')][_0x139e('0x12')]);}else{logger[_0x139e('0xb')](_0x139e('0xc'),_0x579e5e,_0x139e('0xd'));_0x56eb15(_0x4eb941[_0x139e('0x13')][_0x139e('0x12')]);}})[_0x139e('0x14')](function(_0x45486b){logger[_0x139e('0x10')](_0x139e('0xc'),_0x579e5e,_0x45486b);_0x2b3ae6(_0x45486b);});});} \ No newline at end of file +var _0xf323=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x245d2a,_0x1e8ae5){var _0xe03d6c=function(_0x3bad3d){while(--_0x3bad3d){_0x245d2a['push'](_0x245d2a['shift']());}};_0xe03d6c(++_0x1e8ae5);}(_0xf323,0x152));var _0x3f32=function(_0x4dd32a,_0x4ef984){_0x4dd32a=_0x4dd32a-0x0;var _0xbaec73=_0xf323[_0x4dd32a];return _0xbaec73;};'use strict';var _=require(_0x3f32('0x0'));var util=require(_0x3f32('0x1'));var moment=require(_0x3f32('0x2'));var BPromise=require(_0x3f32('0x3'));var rs=require(_0x3f32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f32('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f32('0x6'));var config=require(_0x3f32('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3f32('0x8')][_0x3f32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5774da,_0xcbd4d3,_0x1880e7){return new BPromise(function(_0x44f47d,_0x593710){return client[_0x3f32('0xa')](_0x5774da,_0x1880e7)['then'](function(_0x4cf68f){logger[_0x3f32('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0xcbd4d3,_0x3f32('0xc'));logger[_0x3f32('0xd')](_0x3f32('0xe'),_0xcbd4d3,_0x3f32('0xc'),JSON[_0x3f32('0xf')](_0x4cf68f));if(_0x4cf68f[_0x3f32('0x10')]){if(_0x4cf68f[_0x3f32('0x10')]['code']===0x1f4){logger[_0x3f32('0x10')](_0x3f32('0x11'),_0xcbd4d3,_0x4cf68f[_0x3f32('0x10')][_0x3f32('0x12')]);return _0x593710(_0x4cf68f['error'][_0x3f32('0x12')]);}logger['error'](_0x3f32('0x11'),_0xcbd4d3,_0x4cf68f[_0x3f32('0x10')][_0x3f32('0x12')]);return _0x44f47d(_0x4cf68f[_0x3f32('0x10')][_0x3f32('0x12')]);}else{logger[_0x3f32('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0xcbd4d3,_0x3f32('0xc'));_0x44f47d(_0x4cf68f['result'][_0x3f32('0x12')]);}})[_0x3f32('0x13')](function(_0x367071){logger[_0x3f32('0x10')](_0x3f32('0x11'),_0xcbd4d3,_0x367071);_0x593710(_0x367071);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f6fe7ad..b390c45 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 _0x0adf=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4f9acb,_0x2d9b1d){var _0x363dcd=function(_0x4414b4){while(--_0x4414b4){_0x4f9acb['push'](_0x4f9acb['shift']());}};_0x363dcd(++_0x2d9b1d);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x35e9cc,_0x4be673){_0x35e9cc=_0x35e9cc-0x0;var _0x4203f1=_0x0adf[_0x35e9cc];return _0x4203f1;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router[_0xf0ad('0x10')]('/:id',auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x11')](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x12')]);module[_0xf0ad('0x13')]=router; \ No newline at end of file +var _0x5430=['express','Router','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5c4b91,_0xc78c6){var _0x24fe38=function(_0x11edef){while(--_0x11edef){_0x5c4b91['push'](_0x5c4b91['shift']());}};_0x24fe38(++_0xc78c6);}(_0x5430,0x10c));var _0x0543=function(_0xce01e3,_0x199a0a){_0xce01e3=_0xce01e3-0x0;var _0x13b019=_0x5430[_0xce01e3];return _0x13b019;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0543('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x0543('0x7')](),controller[_0x0543('0x8')]);router[_0x0543('0x9')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['show']);router[_0x0543('0xb')]('/',auth[_0x0543('0x7')](),controller[_0x0543('0xc')]);router[_0x0543('0xd')](_0x0543('0xa'),auth[_0x0543('0x7')](),controller['update']);router[_0x0543('0xe')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xf')]);module[_0x0543('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 61ab838..a65d177 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 _0x34e2=['sequelize','ENUM','string','STRING','variable','BOOLEAN'];(function(_0x35ff86,_0xc18b87){var _0xeeecdb=function(_0x100670){while(--_0x100670){_0x35ff86['push'](_0x35ff86['shift']());}};_0xeeecdb(++_0xc18b87);}(_0x34e2,0x126));var _0x234e=function(_0x2683e5,_0x3f8e61){_0x2683e5=_0x2683e5-0x0;var _0x259021=_0x34e2[_0x2683e5];return _0x259021;};'use strict';var Sequelize=require(_0x234e('0x0'));module['exports']={'type':{'type':Sequelize[_0x234e('0x1')](_0x234e('0x2'),'variable','customVariable','keyValue'),'defaultValue':_0x234e('0x2')},'content':{'type':Sequelize[_0x234e('0x3')]},'key':{'type':Sequelize[_0x234e('0x3')]},'keyType':{'type':Sequelize['ENUM']('string',_0x234e('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x234e('0x3')]},'idField':{'type':Sequelize[_0x234e('0x3')]},'nameField':{'type':Sequelize[_0x234e('0x3')]},'customField':{'type':Sequelize[_0x234e('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x234e('0x3')]}}; \ No newline at end of file +var _0xf360=['keyValue','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x25d5e9,_0x340fda){var _0xa351e2=function(_0x14bc4a){while(--_0x14bc4a){_0x25d5e9['push'](_0x25d5e9['shift']());}};_0xa351e2(++_0x340fda);}(_0xf360,0x9e));var _0x0f36=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf360[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'type':{'type':Sequelize[_0x0f36('0x2')]('string',_0x0f36('0x3'),'customVariable',_0x0f36('0x4')),'defaultValue':_0x0f36('0x5')},'content':{'type':Sequelize[_0x0f36('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f36('0x2')](_0x0f36('0x5'),_0x0f36('0x3'),_0x0f36('0x7'))},'keyContent':{'type':Sequelize[_0x0f36('0x6')]},'idField':{'type':Sequelize[_0x0f36('0x6')]},'nameField':{'type':Sequelize[_0x0f36('0x6')]},'customField':{'type':Sequelize[_0x0f36('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5e151e8..376f44d 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x23929d,_0x2d8984){var _0x52d817=function(_0x45ef82){while(--_0x45ef82){_0x23929d['push'](_0x23929d['shift']());}};_0x52d817(++_0x2d8984);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xccd329,_0xc7b4d6){var _0x1f815b=function(_0x1e1226){while(--_0x1e1226){_0xccd329['push'](_0xccd329['shift']());}};_0x1f815b(++_0xc7b4d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0266842..66bac23 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 _0x7785=['int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x4aa604,_0x19ebc8){var _0x301f30=function(_0x175747){while(--_0x175747){_0x4aa604['push'](_0x4aa604['shift']());}};_0x301f30(++_0x19ebc8);}(_0x7785,0xe4));var _0x5778=function(_0xdb4619,_0x60f394){_0xdb4619=_0xdb4619-0x0;var _0xa3894f=_0x7785[_0xdb4619];return _0xa3894f;};'use strict';var _=require(_0x5778('0x0'));var util=require('util');var logger=require(_0x5778('0x1'))(_0x5778('0x2'));var moment=require('moment');var BPromise=require(_0x5778('0x3'));var rp=require(_0x5778('0x4'));var fs=require('fs');var path=require(_0x5778('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5778('0x6'));module[_0x5778('0x7')]=function(_0x2e03fa,_0x24786a){return _0x2e03fa[_0x5778('0x8')](_0x5778('0x9'),attributes,{'tableName':_0x5778('0xa'),'paranoid':![],'indexes':[{'name':_0x5778('0xb'),'fields':[_0x5778('0xc'),_0x5778('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38f8=['idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields'];(function(_0x25afbd,_0x176a50){var _0x4cb342=function(_0xf24a3c){while(--_0xf24a3c){_0x25afbd['push'](_0x25afbd['shift']());}};_0x4cb342(++_0x176a50);}(_0x38f8,0x64));var _0x838f=function(_0x275fe4,_0x5b1047){_0x275fe4=_0x275fe4-0x0;var _0x26c16f=_0x38f8[_0x275fe4];return _0x26c16f;};'use strict';var _=require(_0x838f('0x0'));var util=require(_0x838f('0x1'));var logger=require(_0x838f('0x2'))(_0x838f('0x3'));var moment=require(_0x838f('0x4'));var BPromise=require('bluebird');var rp=require(_0x838f('0x5'));var fs=require('fs');var path=require(_0x838f('0x6'));var rimraf=require('rimraf');var config=require(_0x838f('0x7'));var attributes=require(_0x838f('0x8'));module[_0x838f('0x9')]=function(_0x2ff236,_0x2571ed){return _0x2ff236['define'](_0x838f('0xa'),attributes,{'tableName':_0x838f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x838f('0xc'),_0x838f('0xd')],'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 0b0a4dc..e867e95 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 _0xeec6=['then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xeec6,0x1c2));var _0x6eec=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xeec6[_0x118653];return _0xc11fa6;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('ZohoField,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x252277,_0x37e1e2){var _0x3131fe=function(_0x14c44e){while(--_0x14c44e){_0x252277['push'](_0x252277['shift']());}};_0x3131fe(++_0x37e1e2);}(_0x425d,0x1e0));var _0xd425=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x425d[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('ZohoField,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 301f311..78e23ea 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 _0x1a04=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','util','connect-timeout'];(function(_0x2ba4e6,_0x101413){var _0x5cc4ac=function(_0x7a8b5b){while(--_0x7a8b5b){_0x2ba4e6['push'](_0x2ba4e6['shift']());}};_0x5cc4ac(++_0x101413);}(_0x1a04,0xc9));var _0x41a0=function(_0x5047c8,_0x3cb660){_0x5047c8=_0x5047c8-0x0;var _0x23afb1=_0x1a04[_0x5047c8];return _0x23afb1;};'use strict';var multer=require('multer');var util=require(_0x41a0('0x0'));var path=require('path');var timeout=require(_0x41a0('0x1'));var express=require(_0x41a0('0x2'));var router=express[_0x41a0('0x3')]();var auth=require(_0x41a0('0x4'));var interaction=require(_0x41a0('0x5'));var config=require(_0x41a0('0x6'));module['exports']=router; \ No newline at end of file +var _0xe411=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe411,0x154));var _0x1e41=function(_0x17a7bf,_0x188be2){_0x17a7bf=_0x17a7bf-0x0;var _0xbf131e=_0xe411[_0x17a7bf];return _0xbf131e;};'use strict';var multer=require(_0x1e41('0x0'));var util=require(_0x1e41('0x1'));var path=require(_0x1e41('0x2'));var timeout=require(_0x1e41('0x3'));var express=require('express');var router=express[_0x1e41('0x4')]();var auth=require(_0x1e41('0x5'));var interaction=require(_0x1e41('0x6'));var config=require('../../config/environment');module[_0x1e41('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a29b1a6..0ec2877 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 _0x57c4=['STRING','unique_name_and_version','app.js','BOOLEAN','sequelize','exports'];(function(_0x5e1fb6,_0xf3495b){var _0x2cf20e=function(_0x4e51b4){while(--_0x4e51b4){_0x5e1fb6['push'](_0x5e1fb6['shift']());}};_0x2cf20e(++_0xf3495b);}(_0x57c4,0x100));var _0x457c=function(_0x5a30e2,_0x1c8019){_0x5a30e2=_0x5a30e2-0x0;var _0x4bb675=_0x57c4[_0x5a30e2];return _0x4bb675;};'use strict';var Sequelize=require(_0x457c('0x0'));module[_0x457c('0x1')]={'name':{'type':Sequelize[_0x457c('0x2')],'allowNull':![],'unique':_0x457c('0x3')},'version':{'type':Sequelize[_0x457c('0x2')],'allowNull':![],'unique':_0x457c('0x3')},'main':{'type':Sequelize[_0x457c('0x2')],'defaultValue':_0x457c('0x4')},'filename':{'type':Sequelize[_0x457c('0x2')]},'path':{'type':Sequelize[_0x457c('0x2')]},'type':{'type':Sequelize[_0x457c('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x457c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x457c('0x2')],'unique':'state'},'description':{'type':Sequelize[_0x457c('0x2')]},'title':{'type':Sequelize[_0x457c('0x2')]},'remoteUri':{'type':Sequelize[_0x457c('0x2')]},'link':{'type':Sequelize[_0x457c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x944e=['sequelize','STRING','unique_name_and_version','app.js','BOOLEAN','state'];(function(_0x38657e,_0x473e8f){var _0x1c5d78=function(_0x4a7964){while(--_0x4a7964){_0x38657e['push'](_0x38657e['shift']());}};_0x1c5d78(++_0x473e8f);}(_0x944e,0xa8));var _0xe944=function(_0x225e67,_0x2acaa1){_0x225e67=_0x225e67-0x0;var _0x53f022=_0x944e[_0x225e67];return _0x53f022;};'use strict';var Sequelize=require(_0xe944('0x0'));module['exports']={'name':{'type':Sequelize[_0xe944('0x1')],'allowNull':![],'unique':_0xe944('0x2')},'version':{'type':Sequelize[_0xe944('0x1')],'allowNull':![],'unique':_0xe944('0x2')},'main':{'type':Sequelize[_0xe944('0x1')],'defaultValue':_0xe944('0x3')},'filename':{'type':Sequelize[_0xe944('0x1')]},'path':{'type':Sequelize[_0xe944('0x1')]},'type':{'type':Sequelize[_0xe944('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xe944('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xe944('0x1')]},'logo':{'type':Sequelize[_0xe944('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xe944('0x5')},'description':{'type':Sequelize[_0xe944('0x1')]},'title':{'type':Sequelize[_0xe944('0x1')]},'remoteUri':{'type':Sequelize[_0xe944('0x1')]},'link':{'type':Sequelize[_0xe944('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index f01a73a..b4e0ee5 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 _0xc6a4=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','error','name','map','Integration','fieldName','type','key','model','keys','intersection','attributes','fields','query','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x4aaedd,_0x1d997d){var _0x3b6de5=function(_0x2e4ffa){while(--_0x2e4ffa){_0x4aaedd['push'](_0x4aaedd['shift']());}};_0x3b6de5(++_0x1d997d);}(_0xc6a4,0x1e7));var _0x4c6a=function(_0x114cac,_0xef0d8d){_0x114cac=_0x114cac-0x0;var _0x504594=_0xc6a4[_0x114cac];return _0x504594;};'use strict';var pdf=require(_0x4c6a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4c6a('0x1'));var zipdir=require(_0x4c6a('0x2'));var jsonpatch=require(_0x4c6a('0x3'));var rp=require(_0x4c6a('0x4'));var moment=require(_0x4c6a('0x5'));var BPromise=require(_0x4c6a('0x6'));var Mustache=require(_0x4c6a('0x7'));var util=require(_0x4c6a('0x8'));var path=require(_0x4c6a('0x9'));var sox=require(_0x4c6a('0xa'));var csv=require(_0x4c6a('0xb'));var ejs=require(_0x4c6a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c6a('0xd'));var deskjs=require(_0x4c6a('0xe'));var toCsv=require(_0x4c6a('0xb'));var querystring=require('querystring');var Papa=require(_0x4c6a('0xf'));var Redis=require(_0x4c6a('0x10'));var authService=require(_0x4c6a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c6a('0x12'));var hardwareService=require(_0x4c6a('0x13'));var logger=require(_0x4c6a('0x14'))(_0x4c6a('0x15'));var utils=require('../../config/utils');var config=require(_0x4c6a('0x16'));var db=require(_0x4c6a('0x17'))['db'];function respondWithStatusCode(_0x36a62c,_0x437a83){_0x437a83=_0x437a83||0xcc;return function(_0x49dbae){if(_0x49dbae){return _0x36a62c[_0x4c6a('0x18')](_0x437a83);}return _0x36a62c[_0x4c6a('0x19')](_0x437a83)[_0x4c6a('0x1a')]();};}function respondWithResult(_0x48b87d,_0x13b263){_0x13b263=_0x13b263||0xc8;return function(_0x267b5d){if(_0x267b5d){return _0x48b87d[_0x4c6a('0x19')](_0x13b263)[_0x4c6a('0x1b')](_0x267b5d);}};}function respondWithFilteredResult(_0x50e7fb,_0x53b769){return function(_0xa71659){if(_0xa71659){var _0x2c276c=_0xa71659[_0x4c6a('0x1c')],_0x26ffe9=_0x53b769[_0x4c6a('0x1d')],_0x4de857=_0x53b769['offset']+_0x53b769[_0x4c6a('0x1e')],_0x21673f;if(_0x4de857>=_0x2c276c){_0x4de857=_0x2c276c;_0x21673f=0xc8;}else{_0x21673f=0xce;}_0x50e7fb[_0x4c6a('0x19')](_0x21673f);return _0x50e7fb['set']('Content-Range',_0x26ffe9+'-'+_0x4de857+'/'+_0x2c276c)['json'](_0xa71659);}return null;};}function patchUpdates(_0x422c7d){return function(_0x49174d){try{jsonpatch[_0x4c6a('0x1f')](_0x49174d,_0x422c7d,!![]);}catch(_0x506dcd){return BPromise[_0x4c6a('0x20')](_0x506dcd);}return _0x49174d[_0x4c6a('0x21')]();};}function saveUpdates(_0x51194a,_0x49f762){return function(_0x35958d){if(_0x35958d){return _0x35958d['update'](_0x51194a)[_0x4c6a('0x22')](function(_0x176b38){return _0x176b38;});}return null;};}function removeEntity(_0xede2ac,_0x27be60){return function(_0x4ab4a9){if(_0x4ab4a9){return _0x4ab4a9['destroy']()[_0x4c6a('0x22')](function(){_0xede2ac[_0x4c6a('0x19')](0xcc)[_0x4c6a('0x1a')]();});}};}function handleEntityNotFound(_0x2f7df4,_0x350b30){return function(_0x3583d8){if(!_0x3583d8){_0x2f7df4[_0x4c6a('0x18')](0x194);}return _0x3583d8;};}function handleError(_0x279fb1,_0x475e6d){_0x475e6d=_0x475e6d||0x1f4;return function(_0x119793){logger[_0x4c6a('0x23')](_0x119793['stack']);if(_0x119793[_0x4c6a('0x24')]){delete _0x119793[_0x4c6a('0x24')];}_0x279fb1[_0x4c6a('0x19')](_0x475e6d)['send'](_0x119793);};}exports['index']=function(_0x782f6b,_0x575ca9){var _0x323a09={},_0xe26cb4={},_0x441cd8={'count':0x0,'rows':[]};var _0x1ca422=_[_0x4c6a('0x25')](db[_0x4c6a('0x26')]['rawAttributes'],function(_0x1bb0f3){return{'name':_0x1bb0f3[_0x4c6a('0x27')],'type':_0x1bb0f3[_0x4c6a('0x28')][_0x4c6a('0x29')]};});_0xe26cb4[_0x4c6a('0x2a')]=_['map'](_0x1ca422,_0x4c6a('0x24'));_0xe26cb4['query']=_[_0x4c6a('0x2b')](_0x782f6b['query']);_0xe26cb4['filters']=_[_0x4c6a('0x2c')](_0xe26cb4[_0x4c6a('0x2a')],_0xe26cb4['query']);_0x323a09[_0x4c6a('0x2d')]=_[_0x4c6a('0x2c')](_0xe26cb4['model'],qs[_0x4c6a('0x2e')](_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x2e')]));_0x323a09['attributes']=_0x323a09[_0x4c6a('0x2d')]['length']?_0x323a09[_0x4c6a('0x2d')]:_0xe26cb4['model'];if(!_0x782f6b['query']['hasOwnProperty'](_0x4c6a('0x30'))){_0x323a09['limit']=qs[_0x4c6a('0x1e')](_0x782f6b['query']['limit']);_0x323a09[_0x4c6a('0x1d')]=qs['offset'](_0x782f6b[_0x4c6a('0x2f')]['offset']);}_0x323a09[_0x4c6a('0x31')]=qs[_0x4c6a('0x32')](_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x32')]);_0x323a09[_0x4c6a('0x33')]=qs[_0x4c6a('0x34')](_[_0x4c6a('0x35')](_0x782f6b['query'],_0xe26cb4[_0x4c6a('0x34')]),_0x1ca422);if(_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x36')]){_0x323a09[_0x4c6a('0x33')]=_[_0x4c6a('0x37')](_0x323a09[_0x4c6a('0x33')],{'$or':_[_0x4c6a('0x25')](_0x1ca422,function(_0x28a3bd){if(_0x28a3bd['type']!==_0x4c6a('0x38')){var _0x5ac979={};_0x5ac979[_0x28a3bd[_0x4c6a('0x24')]]={'$like':'%'+_0x782f6b[_0x4c6a('0x2f')]['filter']+'%'};return _0x5ac979;}})});}_0x323a09=_['merge']({},_0x323a09,_0x782f6b[_0x4c6a('0x39')]);var _0x3de91a={'where':_0x323a09[_0x4c6a('0x33')]};return db['Integration']['count'](_0x3de91a)[_0x4c6a('0x22')](function(_0x38a3e8){_0x441cd8[_0x4c6a('0x1c')]=_0x38a3e8;if(_0x782f6b[_0x4c6a('0x2f')][_0x4c6a('0x3a')]){_0x323a09[_0x4c6a('0x3b')]=[{'all':!![]}];}return db[_0x4c6a('0x26')][_0x4c6a('0x3c')](_0x323a09);})[_0x4c6a('0x22')](function(_0x18766b){_0x441cd8[_0x4c6a('0x3d')]=_0x18766b;return _0x441cd8;})[_0x4c6a('0x22')](respondWithFilteredResult(_0x575ca9,_0x323a09))[_0x4c6a('0x3e')](handleError(_0x575ca9,null));};exports[_0x4c6a('0x3f')]=function(_0x4969a6,_0x495607){var _0x436cf={'raw':![],'where':{'id':_0x4969a6[_0x4c6a('0x40')]['id']}},_0x31a09c={};_0x31a09c['model']=_['keys'](db['Integration'][_0x4c6a('0x41')]);_0x31a09c[_0x4c6a('0x2f')]=_[_0x4c6a('0x2b')](_0x4969a6[_0x4c6a('0x2f')]);_0x31a09c[_0x4c6a('0x34')]=_[_0x4c6a('0x2c')](_0x31a09c[_0x4c6a('0x2a')],_0x31a09c[_0x4c6a('0x2f')]);_0x436cf[_0x4c6a('0x2d')]=_[_0x4c6a('0x2c')](_0x31a09c['model'],qs['fields'](_0x4969a6[_0x4c6a('0x2f')][_0x4c6a('0x2e')]));_0x436cf[_0x4c6a('0x2d')]=_0x436cf[_0x4c6a('0x2d')]['length']?_0x436cf[_0x4c6a('0x2d')]:_0x31a09c[_0x4c6a('0x2a')];if(_0x4969a6['query'][_0x4c6a('0x3a')]){_0x436cf[_0x4c6a('0x3b')]=[{'all':!![]}];}_0x436cf=_[_0x4c6a('0x37')]({},_0x436cf,_0x4969a6[_0x4c6a('0x39')]);return db[_0x4c6a('0x26')][_0x4c6a('0x42')](_0x436cf)[_0x4c6a('0x22')](handleEntityNotFound(_0x495607,null))['then'](respondWithResult(_0x495607,null))[_0x4c6a('0x3e')](handleError(_0x495607,null));};exports['create']=function(_0x8cbb54,_0xd9ec96){return db[_0x4c6a('0x26')]['create'](_0x8cbb54[_0x4c6a('0x43')],{})[_0x4c6a('0x22')](respondWithResult(_0xd9ec96,0xc9))['catch'](handleError(_0xd9ec96,null));};exports['update']=function(_0x3cc5bc,_0x2e3a49){if(_0x3cc5bc[_0x4c6a('0x43')]['id']){delete _0x3cc5bc[_0x4c6a('0x43')]['id'];}return db[_0x4c6a('0x26')][_0x4c6a('0x42')]({'where':{'id':_0x3cc5bc[_0x4c6a('0x40')]['id']}})[_0x4c6a('0x22')](handleEntityNotFound(_0x2e3a49,null))[_0x4c6a('0x22')](saveUpdates(_0x3cc5bc[_0x4c6a('0x43')],null))['then'](respondWithResult(_0x2e3a49,null))['catch'](handleError(_0x2e3a49,null));};exports['destroy']=function(_0x221204,_0xd3aed7){return db['Integration'][_0x4c6a('0x42')]({'where':{'id':_0x221204['params']['id']}})[_0x4c6a('0x22')](handleEntityNotFound(_0xd3aed7,null))[_0x4c6a('0x22')](removeEntity(_0xd3aed7,null))['catch'](handleError(_0xd3aed7,null));}; \ No newline at end of file +var _0x730f=['moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','update','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','then','includeAll','include','catch','params','length','find','body','html-pdf','eml-format','zip-dir','request-promise'];(function(_0x4f99a5,_0x2a6c5d){var _0x1fb6c2=function(_0x2e28d7){while(--_0x2e28d7){_0x4f99a5['push'](_0x4f99a5['shift']());}};_0x1fb6c2(++_0x2a6c5d);}(_0x730f,0xce));var _0xf730=function(_0x2244dd,_0x44633f){_0x2244dd=_0x2244dd-0x0;var _0x143a95=_0x730f[_0x2244dd];return _0x143a95;};'use strict';var pdf=require(_0xf730('0x0'));var emlformat=require(_0xf730('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf730('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf730('0x3'));var moment=require(_0xf730('0x4'));var BPromise=require(_0xf730('0x5'));var Mustache=require(_0xf730('0x6'));var util=require(_0xf730('0x7'));var path=require(_0xf730('0x8'));var sox=require(_0xf730('0x9'));var csv=require(_0xf730('0xa'));var ejs=require(_0xf730('0xb'));var fs=require('fs');var _=require(_0xf730('0xc'));var squel=require('squel');var crypto=require(_0xf730('0xd'));var jsforce=require(_0xf730('0xe'));var deskjs=require(_0xf730('0xf'));var toCsv=require(_0xf730('0xa'));var querystring=require(_0xf730('0x10'));var Papa=require(_0xf730('0x11'));var Redis=require('ioredis');var authService=require(_0xf730('0x12'));var qs=require(_0xf730('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf730('0x14'));var logger=require(_0xf730('0x15'))(_0xf730('0x16'));var utils=require('../../config/utils');var config=require(_0xf730('0x17'));var db=require(_0xf730('0x18'))['db'];function respondWithStatusCode(_0x47e33d,_0x43fd56){_0x43fd56=_0x43fd56||0xcc;return function(_0x19558e){if(_0x19558e){return _0x47e33d[_0xf730('0x19')](_0x43fd56);}return _0x47e33d['status'](_0x43fd56)['end']();};}function respondWithResult(_0x31c8cc,_0x4085bc){_0x4085bc=_0x4085bc||0xc8;return function(_0xde8c1c){if(_0xde8c1c){return _0x31c8cc[_0xf730('0x1a')](_0x4085bc)[_0xf730('0x1b')](_0xde8c1c);}};}function respondWithFilteredResult(_0x14ba66,_0x2bd9c7){return function(_0x2ff1bb){if(_0x2ff1bb){var _0x34a83d=_0x2ff1bb[_0xf730('0x1c')],_0x1f605b=_0x2bd9c7[_0xf730('0x1d')],_0x1f3a9c=_0x2bd9c7[_0xf730('0x1d')]+_0x2bd9c7['limit'],_0x1ee6de;if(_0x1f3a9c>=_0x34a83d){_0x1f3a9c=_0x34a83d;_0x1ee6de=0xc8;}else{_0x1ee6de=0xce;}_0x14ba66[_0xf730('0x1a')](_0x1ee6de);return _0x14ba66[_0xf730('0x1e')](_0xf730('0x1f'),_0x1f605b+'-'+_0x1f3a9c+'/'+_0x34a83d)[_0xf730('0x1b')](_0x2ff1bb);}return null;};}function patchUpdates(_0xd2b9d6){return function(_0x22d1e2){try{jsonpatch[_0xf730('0x20')](_0x22d1e2,_0xd2b9d6,!![]);}catch(_0x8c4030){return BPromise['reject'](_0x8c4030);}return _0x22d1e2['save']();};}function saveUpdates(_0xe50901,_0x4beb9a){return function(_0xf2c5a){if(_0xf2c5a){return _0xf2c5a[_0xf730('0x21')](_0xe50901)['then'](function(_0x53486a){return _0x53486a;});}return null;};}function removeEntity(_0x5572fc,_0x329334){return function(_0x50beb6){if(_0x50beb6){return _0x50beb6[_0xf730('0x22')]()['then'](function(){_0x5572fc['status'](0xcc)[_0xf730('0x23')]();});}};}function handleEntityNotFound(_0x5bf59c,_0x12940e){return function(_0x53965f){if(!_0x53965f){_0x5bf59c[_0xf730('0x19')](0x194);}return _0x53965f;};}function handleError(_0x23bdd2,_0x5d1d87){_0x5d1d87=_0x5d1d87||0x1f4;return function(_0x1d3f3a){logger[_0xf730('0x24')](_0x1d3f3a[_0xf730('0x25')]);if(_0x1d3f3a[_0xf730('0x26')]){delete _0x1d3f3a[_0xf730('0x26')];}_0x23bdd2[_0xf730('0x1a')](_0x5d1d87)[_0xf730('0x27')](_0x1d3f3a);};}exports[_0xf730('0x28')]=function(_0x344ed4,_0x2f5f89){var _0x29d09a={},_0x51e208={},_0x1a3083={'count':0x0,'rows':[]};var _0x4c88bd=_[_0xf730('0x29')](db[_0xf730('0x2a')][_0xf730('0x2b')],function(_0x46bdc7){return{'name':_0x46bdc7['fieldName'],'type':_0x46bdc7[_0xf730('0x2c')]['key']};});_0x51e208[_0xf730('0x2d')]=_[_0xf730('0x29')](_0x4c88bd,_0xf730('0x26'));_0x51e208[_0xf730('0x2e')]=_[_0xf730('0x2f')](_0x344ed4['query']);_0x51e208[_0xf730('0x30')]=_[_0xf730('0x31')](_0x51e208[_0xf730('0x2d')],_0x51e208[_0xf730('0x2e')]);_0x29d09a[_0xf730('0x32')]=_[_0xf730('0x31')](_0x51e208[_0xf730('0x2d')],qs[_0xf730('0x33')](_0x344ed4['query'][_0xf730('0x33')]));_0x29d09a[_0xf730('0x32')]=_0x29d09a[_0xf730('0x32')]['length']?_0x29d09a['attributes']:_0x51e208['model'];if(!_0x344ed4['query'][_0xf730('0x34')](_0xf730('0x35'))){_0x29d09a['limit']=qs[_0xf730('0x36')](_0x344ed4[_0xf730('0x2e')][_0xf730('0x36')]);_0x29d09a[_0xf730('0x1d')]=qs['offset'](_0x344ed4['query']['offset']);}_0x29d09a[_0xf730('0x37')]=qs['sort'](_0x344ed4[_0xf730('0x2e')][_0xf730('0x38')]);_0x29d09a[_0xf730('0x39')]=qs[_0xf730('0x30')](_[_0xf730('0x3a')](_0x344ed4['query'],_0x51e208[_0xf730('0x30')]),_0x4c88bd);if(_0x344ed4[_0xf730('0x2e')]['filter']){_0x29d09a[_0xf730('0x39')]=_['merge'](_0x29d09a[_0xf730('0x39')],{'$or':_[_0xf730('0x29')](_0x4c88bd,function(_0x24e59){if(_0x24e59['type']!=='VIRTUAL'){var _0x371b62={};_0x371b62[_0x24e59['name']]={'$like':'%'+_0x344ed4[_0xf730('0x2e')][_0xf730('0x3b')]+'%'};return _0x371b62;}})});}_0x29d09a=_[_0xf730('0x3c')]({},_0x29d09a,_0x344ed4[_0xf730('0x3d')]);var _0x591b55={'where':_0x29d09a[_0xf730('0x39')]};return db[_0xf730('0x2a')][_0xf730('0x1c')](_0x591b55)[_0xf730('0x3e')](function(_0x1c83ad){_0x1a3083[_0xf730('0x1c')]=_0x1c83ad;if(_0x344ed4[_0xf730('0x2e')][_0xf730('0x3f')]){_0x29d09a[_0xf730('0x40')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x29d09a);})[_0xf730('0x3e')](function(_0x14cbd3){_0x1a3083['rows']=_0x14cbd3;return _0x1a3083;})[_0xf730('0x3e')](respondWithFilteredResult(_0x2f5f89,_0x29d09a))[_0xf730('0x41')](handleError(_0x2f5f89,null));};exports['show']=function(_0x2fd172,_0x577f38){var _0x22f42a={'raw':![],'where':{'id':_0x2fd172[_0xf730('0x42')]['id']}},_0x222a2e={};_0x222a2e[_0xf730('0x2d')]=_[_0xf730('0x2f')](db[_0xf730('0x2a')][_0xf730('0x2b')]);_0x222a2e[_0xf730('0x2e')]=_[_0xf730('0x2f')](_0x2fd172['query']);_0x222a2e[_0xf730('0x30')]=_['intersection'](_0x222a2e[_0xf730('0x2d')],_0x222a2e['query']);_0x22f42a['attributes']=_[_0xf730('0x31')](_0x222a2e[_0xf730('0x2d')],qs[_0xf730('0x33')](_0x2fd172[_0xf730('0x2e')][_0xf730('0x33')]));_0x22f42a[_0xf730('0x32')]=_0x22f42a['attributes'][_0xf730('0x43')]?_0x22f42a[_0xf730('0x32')]:_0x222a2e[_0xf730('0x2d')];if(_0x2fd172[_0xf730('0x2e')]['includeAll']){_0x22f42a[_0xf730('0x40')]=[{'all':!![]}];}_0x22f42a=_[_0xf730('0x3c')]({},_0x22f42a,_0x2fd172['options']);return db[_0xf730('0x2a')][_0xf730('0x44')](_0x22f42a)[_0xf730('0x3e')](handleEntityNotFound(_0x577f38,null))[_0xf730('0x3e')](respondWithResult(_0x577f38,null))[_0xf730('0x41')](handleError(_0x577f38,null));};exports['create']=function(_0x21c715,_0x4e4608){return db[_0xf730('0x2a')]['create'](_0x21c715[_0xf730('0x45')],{})[_0xf730('0x3e')](respondWithResult(_0x4e4608,0xc9))[_0xf730('0x41')](handleError(_0x4e4608,null));};exports[_0xf730('0x21')]=function(_0x32fb1a,_0x1c3581){if(_0x32fb1a[_0xf730('0x45')]['id']){delete _0x32fb1a[_0xf730('0x45')]['id'];}return db[_0xf730('0x2a')][_0xf730('0x44')]({'where':{'id':_0x32fb1a[_0xf730('0x42')]['id']}})[_0xf730('0x3e')](handleEntityNotFound(_0x1c3581,null))[_0xf730('0x3e')](saveUpdates(_0x32fb1a[_0xf730('0x45')],null))['then'](respondWithResult(_0x1c3581,null))[_0xf730('0x41')](handleError(_0x1c3581,null));};exports['destroy']=function(_0x13556e,_0x28bbeb){return db[_0xf730('0x2a')][_0xf730('0x44')]({'where':{'id':_0x13556e[_0xf730('0x42')]['id']}})[_0xf730('0x3e')](handleEntityNotFound(_0x28bbeb,null))[_0xf730('0x3e')](removeEntity(_0x28bbeb,null))['catch'](handleError(_0x28bbeb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b759fa5..1b48f92 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 _0x2651=['exports','integrations','lodash','api','moment','bluebird','../../config/environment','./integration.attributes'];(function(_0x1bfe2b,_0x34856e){var _0x1477d4=function(_0x1d558c){while(--_0x1d558c){_0x1bfe2b['push'](_0x1bfe2b['shift']());}};_0x1477d4(++_0x34856e);}(_0x2651,0x1a2));var _0x1265=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2651[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x1265('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1265('0x1'));var moment=require(_0x1265('0x2'));var BPromise=require(_0x1265('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1265('0x4'));var attributes=require(_0x1265('0x5'));module[_0x1265('0x6')]=function(_0x214061,_0x598389){return _0x214061['define']('Integration',attributes,{'tableName':_0x1265('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x900f=['api','bluebird','request-promise','path','./integration.attributes','exports','define','Integration','integrations','util'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x900f,0x1ad));var _0xf900=function(_0x411bd1,_0x416106){_0x411bd1=_0x411bd1-0x0;var _0x320464=_0x900f[_0x411bd1];return _0x320464;};'use strict';var _=require('lodash');var util=require(_0xf900('0x0'));var logger=require('../../config/logger')(_0xf900('0x1'));var moment=require('moment');var BPromise=require(_0xf900('0x2'));var rp=require(_0xf900('0x3'));var fs=require('fs');var path=require(_0xf900('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf900('0x5'));module[_0xf900('0x6')]=function(_0x450dd0,_0x1ad35e){return _0x450dd0[_0xf900('0x7')](_0xf900('0x8'),attributes,{'tableName':_0xf900('0x9'),'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 fa074a6..a8daaf5 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 _0xb8ba=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8ba,0x6d));var _0xab8b=function(_0x118b5e,_0x3567bc){_0x118b5e=_0x118b5e-0x0;var _0x1e6d84=_0xb8ba[_0x118b5e];return _0x1e6d84;};'use strict';var _=require(_0xab8b('0x0'));var util=require(_0xab8b('0x1'));var moment=require(_0xab8b('0x2'));var BPromise=require('bluebird');var rs=require(_0xab8b('0x3'));var fs=require('fs');var Redis=require(_0xab8b('0x4'));var db=require(_0xab8b('0x5'))['db'];var utils=require(_0xab8b('0x6'));var logger=require(_0xab8b('0x7'))(_0xab8b('0x8'));var config=require(_0xab8b('0x9'));var jayson=require(_0xab8b('0xa'));var client=jayson['client'][_0xab8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5300bf,_0x1121e2,_0x57f8ba){return new BPromise(function(_0x233bfd,_0xb1ec1e){return client[_0xab8b('0xc')](_0x5300bf,_0x57f8ba)['then'](function(_0x5215cd){logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));logger[_0xab8b('0x10')](_0xab8b('0x11'),_0x1121e2,_0xab8b('0xf'),JSON[_0xab8b('0x12')](_0x5215cd));if(_0x5215cd[_0xab8b('0x13')]){if(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x14')]===0x1f4){logger[_0xab8b('0x13')]('Integration,\x20%s,\x20%s',_0x1121e2,_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);return _0xb1ec1e(_0x5215cd['error'][_0xab8b('0x15')]);}logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5215cd['error']['message']);return _0x233bfd(_0x5215cd[_0xab8b('0x13')][_0xab8b('0x15')]);}else{logger[_0xab8b('0xd')](_0xab8b('0xe'),_0x1121e2,_0xab8b('0xf'));_0x233bfd(_0x5215cd['result'][_0xab8b('0x15')]);}})['catch'](function(_0x5241b2){logger[_0xab8b('0x13')](_0xab8b('0xe'),_0x1121e2,_0x5241b2);_0xb1ec1e(_0x5241b2);});});} \ No newline at end of file +var _0xcb26=['error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2f380e,_0x4dad06){var _0x4b53c0=function(_0x58bd2e){while(--_0x58bd2e){_0x2f380e['push'](_0x2f380e['shift']());}};_0x4b53c0(++_0x4dad06);}(_0xcb26,0xf6));var _0x6cb2=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcb26[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6cb2('0x0'));var util=require(_0x6cb2('0x1'));var moment=require(_0x6cb2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cb2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb2('0x4'));var logger=require(_0x6cb2('0x5'))('rpc');var config=require(_0x6cb2('0x6'));var jayson=require(_0x6cb2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x446656,_0x5ca77d,_0x42c7d6){return new BPromise(function(_0x456916,_0xf7e38d){return client['request'](_0x446656,_0x42c7d6)[_0x6cb2('0x8')](function(_0x11681e){logger['info'](_0x6cb2('0x9'),_0x5ca77d,'request\x20sent');logger[_0x6cb2('0xa')](_0x6cb2('0xb'),_0x5ca77d,_0x6cb2('0xc'),JSON[_0x6cb2('0xd')](_0x11681e));if(_0x11681e[_0x6cb2('0xe')]){if(_0x11681e[_0x6cb2('0xe')][_0x6cb2('0xf')]===0x1f4){logger[_0x6cb2('0xe')](_0x6cb2('0x9'),_0x5ca77d,_0x11681e[_0x6cb2('0xe')][_0x6cb2('0x10')]);return _0xf7e38d(_0x11681e[_0x6cb2('0xe')][_0x6cb2('0x10')]);}logger[_0x6cb2('0xe')](_0x6cb2('0x9'),_0x5ca77d,_0x11681e[_0x6cb2('0xe')]['message']);return _0x456916(_0x11681e[_0x6cb2('0xe')][_0x6cb2('0x10')]);}else{logger[_0x6cb2('0x11')](_0x6cb2('0x9'),_0x5ca77d,'request\x20sent');_0x456916(_0x11681e[_0x6cb2('0x12')][_0x6cb2('0x10')]);}})[_0x6cb2('0x13')](function(_0x40c677){logger['error'](_0x6cb2('0x9'),_0x5ca77d,_0x40c677);_0xf7e38d(_0x40c677);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7cd8f7f..4677425 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 _0xde44=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','/:id','post','create','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x41926b,_0x502a39){var _0x2b40ee=function(_0x51fcc8){while(--_0x51fcc8){_0x41926b['push'](_0x41926b['shift']());}};_0x2b40ee(++_0x502a39);}(_0xde44,0x160));var _0x4de4=function(_0x5d4ac0,_0x1fd7c2){_0x5d4ac0=_0x5d4ac0-0x0;var _0x359260=_0xde44[_0x5d4ac0];return _0x359260;};'use strict';var multer=require(_0x4de4('0x0'));var util=require(_0x4de4('0x1'));var path=require(_0x4de4('0x2'));var timeout=require(_0x4de4('0x3'));var express=require('express');var router=express[_0x4de4('0x4')]();var auth=require(_0x4de4('0x5'));var interaction=require(_0x4de4('0x6'));var config=require(_0x4de4('0x7'));var controller=require(_0x4de4('0x8'));router['get']('/',auth[_0x4de4('0x9')](),controller['index']);router[_0x4de4('0xa')](_0x4de4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4de4('0xa')](_0x4de4('0xc'),auth[_0x4de4('0x9')](),controller['show']);router[_0x4de4('0xd')]('/',auth['isAuthenticated'](),controller[_0x4de4('0xe')]);router['put'](_0x4de4('0xc'),auth[_0x4de4('0x9')](),controller['update']);router[_0x4de4('0xf')](_0x4de4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4de4('0x10')]=router; \ No newline at end of file +var _0x756a=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','describe','get','/:id','show','put','update','delete'];(function(_0x2da563,_0x52eb28){var _0x518093=function(_0x3cad82){while(--_0x3cad82){_0x2da563['push'](_0x2da563['shift']());}};_0x518093(++_0x52eb28);}(_0x756a,0x144));var _0xa756=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x756a[_0x999b85];return _0x1d7124;};'use strict';var multer=require(_0xa756('0x0'));var util=require(_0xa756('0x1'));var path=require(_0xa756('0x2'));var timeout=require(_0xa756('0x3'));var express=require(_0xa756('0x4'));var router=express[_0xa756('0x5')]();var auth=require(_0xa756('0x6'));var interaction=require(_0xa756('0x7'));var config=require(_0xa756('0x8'));var controller=require(_0xa756('0x9'));router['get']('/',auth[_0xa756('0xa')](),controller['index']);router['get']('/describe',auth[_0xa756('0xa')](),controller[_0xa756('0xb')]);router[_0xa756('0xc')](_0xa756('0xd'),auth[_0xa756('0xa')](),controller[_0xa756('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa756('0xf')]('/:id',auth[_0xa756('0xa')](),controller[_0xa756('0x10')]);router[_0xa756('0x11')](_0xa756('0xd'),auth[_0xa756('0xa')](),controller[_0xa756('0x12')]);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 89799d3..98747ad 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 _0x23a6=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','STRING','INTEGER','DATE'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x23a6,0x164));var _0x623a=function(_0x2ce584,_0x18fc6c){_0x2ce584=_0x2ce584-0x0;var _0x311200=_0x23a6[_0x2ce584];return _0x311200;};'use strict';var Sequelize=require(_0x623a('0x0'));module['exports']={'integration':{'type':Sequelize[_0x623a('0x1')]},'eventChannel':{'type':Sequelize[_0x623a('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x623a('0x1')]},'integrationId':{'type':Sequelize[_0x623a('0x2')]},'contacts':{'type':Sequelize[_0x623a('0x1')]},'uniqueid':{'type':Sequelize[_0x623a('0x1')]},'calleridnum':{'type':Sequelize[_0x623a('0x1')]},'calleridname':{'type':Sequelize[_0x623a('0x1')]},'queue':{'type':Sequelize[_0x623a('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x623a('0x1')]},'agentcalledAt':{'type':Sequelize[_0x623a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x623a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x623a('0x2')]},'agentacw':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x623a('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x623a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x623a('0x3')]},'lastevent':{'type':Sequelize[_0x623a('0x1')]},'channel':{'type':Sequelize[_0x623a('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x623a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x623a('0x1')]},'connectedlinename':{'type':Sequelize[_0x623a('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x623a('0x1')]},'context':{'type':Sequelize[_0x623a('0x1')]},'exten':{'type':Sequelize[_0x623a('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x623a('0x1')]},'destchannelstate':{'type':Sequelize[_0x623a('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x623a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x623a('0x1')]},'destcalleridname':{'type':Sequelize[_0x623a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x623a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x623a('0x1')]},'destaccountcode':{'type':Sequelize[_0x623a('0x1')]},'destcontext':{'type':Sequelize[_0x623a('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x623a('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x623a('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x623a('0x1')]},'from':{'type':Sequelize[_0x623a('0x1')]},'to':{'type':Sequelize[_0x623a('0x1')]},'cc':{'type':Sequelize[_0x623a('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x623a('0x5')]},'text':{'type':Sequelize[_0x623a('0x5')]},'status':{'type':Sequelize[_0x623a('0x6')](_0x623a('0x7'),_0x623a('0x8'),_0x623a('0x9'),'FAILED')},'url':{'type':Sequelize[_0x623a('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x623a('0x2')]}}; \ No newline at end of file +var _0xc191=['SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM'];(function(_0x1ea1eb,_0x4c79ff){var _0x467614=function(_0x4a9394){while(--_0x4a9394){_0x1ea1eb['push'](_0x1ea1eb['shift']());}};_0x467614(++_0x4c79ff);}(_0xc191,0x93));var _0x1c19=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xc191[_0x74892f];return _0x10ee61;};'use strict';var Sequelize=require(_0x1c19('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x1c19('0x1')]},'ticketId':{'type':Sequelize[_0x1c19('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x1c19('0x1')]},'uniqueid':{'type':Sequelize[_0x1c19('0x1')]},'calleridnum':{'type':Sequelize[_0x1c19('0x1')]},'calleridname':{'type':Sequelize[_0x1c19('0x1')]},'queue':{'type':Sequelize[_0x1c19('0x1')]},'interface':{'type':Sequelize[_0x1c19('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1c19('0x2')]},'holdtime':{'type':Sequelize[_0x1c19('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1c19('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x1c19('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x1c19('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x1c19('0x2')]},'agentdump':{'type':Sequelize[_0x1c19('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1c19('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x1c19('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1c19('0x1')]},'connectedlinename':{'type':Sequelize[_0x1c19('0x1')]},'language':{'type':Sequelize[_0x1c19('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1c19('0x1')]},'priority':{'type':Sequelize[_0x1c19('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1c19('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1c19('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1c19('0x1')]},'destcalleridname':{'type':Sequelize[_0x1c19('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1c19('0x1')]},'destcontext':{'type':Sequelize[_0x1c19('0x1')]},'destexten':{'type':Sequelize[_0x1c19('0x1')]},'destpriority':{'type':Sequelize[_0x1c19('0x1')]},'destuniqueid':{'type':Sequelize[_0x1c19('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1c19('0x1')]},'subject':{'type':Sequelize[_0x1c19('0x1')]},'from':{'type':Sequelize[_0x1c19('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x1c19('0x5')]},'html':{'type':Sequelize[_0x1c19('0x5')]},'text':{'type':Sequelize[_0x1c19('0x5')]},'status':{'type':Sequelize[_0x1c19('0x6')](_0x1c19('0x7'),_0x1c19('0x8'),_0x1c19('0x9'),_0x1c19('0xa'))},'url':{'type':Sequelize[_0x1c19('0x1')]},'app':{'type':Sequelize[_0x1c19('0x1')]},'appdata':{'type':Sequelize[_0x1c19('0x1')]},'projectId':{'type':Sequelize[_0x1c19('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 40a5b67..456441e 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 _0x46f0=['include','findAll','catch','show','params','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../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','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','sort','where','filter','merge','options','includeAll'];(function(_0x2fbaf9,_0x37fc52){var _0x17bb22=function(_0x1740de){while(--_0x1740de){_0x2fbaf9['push'](_0x2fbaf9['shift']());}};_0x17bb22(++_0x37fc52);}(_0x46f0,0xde));var _0x046f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46f0[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0x046f('0x0'));var emlformat=require(_0x046f('0x1'));var rimraf=require(_0x046f('0x2'));var zipdir=require(_0x046f('0x3'));var jsonpatch=require(_0x046f('0x4'));var rp=require(_0x046f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x046f('0x6'));var util=require(_0x046f('0x7'));var path=require(_0x046f('0x8'));var sox=require(_0x046f('0x9'));var csv=require(_0x046f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x046f('0xb'));var squel=require(_0x046f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x046f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x046f('0xe'));var Papa=require(_0x046f('0xf'));var Redis=require('ioredis');var authService=require(_0x046f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x046f('0x11'));var hardwareService=require(_0x046f('0x12'));var logger=require('../../config/logger')(_0x046f('0x13'));var utils=require(_0x046f('0x14'));var config=require(_0x046f('0x15'));var db=require(_0x046f('0x16'))['db'];function respondWithStatusCode(_0x7193b1,_0x549e39){_0x549e39=_0x549e39||0xcc;return function(_0xe71b38){if(_0xe71b38){return _0x7193b1[_0x046f('0x17')](_0x549e39);}return _0x7193b1[_0x046f('0x18')](_0x549e39)[_0x046f('0x19')]();};}function respondWithResult(_0x144308,_0x107dad){_0x107dad=_0x107dad||0xc8;return function(_0x4e3573){if(_0x4e3573){return _0x144308['status'](_0x107dad)[_0x046f('0x1a')](_0x4e3573);}};}function respondWithFilteredResult(_0x54e846,_0x589861){return function(_0x46e28e){if(_0x46e28e){var _0x4b155e=_0x46e28e[_0x046f('0x1b')],_0x15e59e=_0x589861['offset'],_0x18a4d1=_0x589861[_0x046f('0x1c')]+_0x589861[_0x046f('0x1d')],_0x48b122;if(_0x18a4d1>=_0x4b155e){_0x18a4d1=_0x4b155e;_0x48b122=0xc8;}else{_0x48b122=0xce;}_0x54e846[_0x046f('0x18')](_0x48b122);return _0x54e846[_0x046f('0x1e')](_0x046f('0x1f'),_0x15e59e+'-'+_0x18a4d1+'/'+_0x4b155e)[_0x046f('0x1a')](_0x46e28e);}return null;};}function patchUpdates(_0x1c35d5){return function(_0x37ae5d){try{jsonpatch[_0x046f('0x20')](_0x37ae5d,_0x1c35d5,!![]);}catch(_0x3946dc){return BPromise[_0x046f('0x21')](_0x3946dc);}return _0x37ae5d[_0x046f('0x22')]();};}function saveUpdates(_0x3f9a1d,_0x16b4d0){return function(_0x8ca5d){if(_0x8ca5d){return _0x8ca5d[_0x046f('0x23')](_0x3f9a1d)[_0x046f('0x24')](function(_0x5112fb){return _0x5112fb;});}return null;};}function removeEntity(_0xc8cc79,_0x4c7564){return function(_0x4f8cd6){if(_0x4f8cd6){return _0x4f8cd6[_0x046f('0x25')]()[_0x046f('0x24')](function(){_0xc8cc79[_0x046f('0x18')](0xcc)[_0x046f('0x19')]();});}};}function handleEntityNotFound(_0x546c2e,_0x32c6e8){return function(_0x477b6b){if(!_0x477b6b){_0x546c2e['sendStatus'](0x194);}return _0x477b6b;};}function handleError(_0x43447e,_0x270747){_0x270747=_0x270747||0x1f4;return function(_0x517664){logger[_0x046f('0x26')](_0x517664[_0x046f('0x27')]);if(_0x517664[_0x046f('0x28')]){delete _0x517664['name'];}_0x43447e['status'](_0x270747)[_0x046f('0x29')](_0x517664);};}exports['index']=function(_0x19a49f,_0x47fd1c){var _0x3fd067={},_0x142a41={},_0x1e7412={'count':0x0,'rows':[]};var _0x152f44=_[_0x046f('0x2a')](db[_0x046f('0x2b')][_0x046f('0x2c')],function(_0x1b7434){return{'name':_0x1b7434[_0x046f('0x2d')],'type':_0x1b7434[_0x046f('0x2e')][_0x046f('0x2f')]};});_0x142a41[_0x046f('0x30')]=_[_0x046f('0x2a')](_0x152f44,_0x046f('0x28'));_0x142a41['query']=_[_0x046f('0x31')](_0x19a49f[_0x046f('0x32')]);_0x142a41[_0x046f('0x33')]=_['intersection'](_0x142a41['model'],_0x142a41[_0x046f('0x32')]);_0x3fd067[_0x046f('0x34')]=_['intersection'](_0x142a41[_0x046f('0x30')],qs['fields'](_0x19a49f[_0x046f('0x32')][_0x046f('0x35')]));_0x3fd067[_0x046f('0x34')]=_0x3fd067[_0x046f('0x34')][_0x046f('0x36')]?_0x3fd067[_0x046f('0x34')]:_0x142a41['model'];if(!_0x19a49f[_0x046f('0x32')]['hasOwnProperty'](_0x046f('0x37'))){_0x3fd067[_0x046f('0x1d')]=qs['limit'](_0x19a49f[_0x046f('0x32')][_0x046f('0x1d')]);_0x3fd067[_0x046f('0x1c')]=qs[_0x046f('0x1c')](_0x19a49f[_0x046f('0x32')]['offset']);}_0x3fd067['order']=qs['sort'](_0x19a49f[_0x046f('0x32')][_0x046f('0x38')]);_0x3fd067[_0x046f('0x39')]=qs[_0x046f('0x33')](_['pick'](_0x19a49f[_0x046f('0x32')],_0x142a41[_0x046f('0x33')]),_0x152f44);if(_0x19a49f[_0x046f('0x32')][_0x046f('0x3a')]){_0x3fd067['where']=_[_0x046f('0x3b')](_0x3fd067[_0x046f('0x39')],{'$or':_['map'](_0x152f44,function(_0x14e7d9){if(_0x14e7d9[_0x046f('0x2e')]!=='VIRTUAL'){var _0x2cf009={};_0x2cf009[_0x14e7d9['name']]={'$like':'%'+_0x19a49f[_0x046f('0x32')][_0x046f('0x3a')]+'%'};return _0x2cf009;}})});}_0x3fd067=_[_0x046f('0x3b')]({},_0x3fd067,_0x19a49f[_0x046f('0x3c')]);var _0xb8769a={'where':_0x3fd067[_0x046f('0x39')]};return db[_0x046f('0x2b')][_0x046f('0x1b')](_0xb8769a)[_0x046f('0x24')](function(_0x5ed1ba){_0x1e7412[_0x046f('0x1b')]=_0x5ed1ba;if(_0x19a49f['query'][_0x046f('0x3d')]){_0x3fd067[_0x046f('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x046f('0x3f')](_0x3fd067);})['then'](function(_0x387645){_0x1e7412['rows']=_0x387645;return _0x1e7412;})[_0x046f('0x24')](respondWithFilteredResult(_0x47fd1c,_0x3fd067))[_0x046f('0x40')](handleError(_0x47fd1c,null));};exports[_0x046f('0x41')]=function(_0x4e3476,_0x3861cc){var _0x5054d8={'raw':![],'where':{'id':_0x4e3476[_0x046f('0x42')]['id']}},_0xde2682={};_0xde2682[_0x046f('0x30')]=_['keys'](db[_0x046f('0x2b')]['rawAttributes']);_0xde2682[_0x046f('0x32')]=_[_0x046f('0x31')](_0x4e3476[_0x046f('0x32')]);_0xde2682[_0x046f('0x33')]=_[_0x046f('0x43')](_0xde2682[_0x046f('0x30')],_0xde2682[_0x046f('0x32')]);_0x5054d8[_0x046f('0x34')]=_[_0x046f('0x43')](_0xde2682[_0x046f('0x30')],qs[_0x046f('0x35')](_0x4e3476[_0x046f('0x32')][_0x046f('0x35')]));_0x5054d8[_0x046f('0x34')]=_0x5054d8[_0x046f('0x34')][_0x046f('0x36')]?_0x5054d8[_0x046f('0x34')]:_0xde2682[_0x046f('0x30')];if(_0x4e3476[_0x046f('0x32')][_0x046f('0x3d')]){_0x5054d8[_0x046f('0x3e')]=[{'all':!![]}];}_0x5054d8=_[_0x046f('0x3b')]({},_0x5054d8,_0x4e3476[_0x046f('0x3c')]);return db[_0x046f('0x2b')][_0x046f('0x44')](_0x5054d8)[_0x046f('0x24')](handleEntityNotFound(_0x3861cc,null))[_0x046f('0x24')](respondWithResult(_0x3861cc,null))[_0x046f('0x40')](handleError(_0x3861cc,null));};exports[_0x046f('0x45')]=function(_0x4e310c,_0x4fe65a){return db[_0x046f('0x2b')][_0x046f('0x45')](_0x4e310c[_0x046f('0x46')],{})[_0x046f('0x24')](respondWithResult(_0x4fe65a,0xc9))['catch'](handleError(_0x4fe65a,null));};exports[_0x046f('0x23')]=function(_0x454efe,_0x4850bd){if(_0x454efe[_0x046f('0x46')]['id']){delete _0x454efe[_0x046f('0x46')]['id'];}return db[_0x046f('0x2b')][_0x046f('0x44')]({'where':{'id':_0x454efe[_0x046f('0x42')]['id']}})[_0x046f('0x24')](handleEntityNotFound(_0x4850bd,null))[_0x046f('0x24')](saveUpdates(_0x454efe[_0x046f('0x46')],null))[_0x046f('0x24')](respondWithResult(_0x4850bd,null))[_0x046f('0x40')](handleError(_0x4850bd,null));};exports['destroy']=function(_0x8f8714,_0x50b165){return db[_0x046f('0x2b')][_0x046f('0x44')]({'where':{'id':_0x8f8714[_0x046f('0x42')]['id']}})[_0x046f('0x24')](handleEntityNotFound(_0x50b165,null))[_0x046f('0x24')](removeEntity(_0x50b165,null))['catch'](handleError(_0x50b165,null));};exports['describe']=function(_0x4fbe7e,_0x138286){return db['IntegrationReport']['describe']()[_0x046f('0x24')](respondWithResult(_0x138286,null))[_0x046f('0x40')](handleError(_0x138286,null));}; \ No newline at end of file +var _0x8a90=['where','merge','map','VIRTUAL','options','includeAll','include','catch','show','params','keys','attributes','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','error','name','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','intersection','query','fields','length','hasOwnProperty','nolimit','sort','filters','filter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a90,0xe0));var _0x08a9=function(_0xa86d7f,_0x37c258){_0xa86d7f=_0xa86d7f-0x0;var _0x42b4ed=_0x8a90[_0xa86d7f];return _0x42b4ed;};'use strict';var pdf=require(_0x08a9('0x0'));var emlformat=require(_0x08a9('0x1'));var rimraf=require(_0x08a9('0x2'));var zipdir=require(_0x08a9('0x3'));var jsonpatch=require(_0x08a9('0x4'));var rp=require(_0x08a9('0x5'));var moment=require('moment');var BPromise=require(_0x08a9('0x6'));var Mustache=require(_0x08a9('0x7'));var util=require(_0x08a9('0x8'));var path=require(_0x08a9('0x9'));var sox=require('sox');var csv=require(_0x08a9('0xa'));var ejs=require(_0x08a9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x08a9('0xc'));var crypto=require(_0x08a9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08a9('0xe'));var toCsv=require(_0x08a9('0xa'));var querystring=require(_0x08a9('0xf'));var Papa=require(_0x08a9('0x10'));var Redis=require(_0x08a9('0x11'));var authService=require(_0x08a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x08a9('0x13'));var hardwareService=require(_0x08a9('0x14'));var logger=require('../../config/logger')(_0x08a9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x272c9f,_0x4bf00a){_0x4bf00a=_0x4bf00a||0xcc;return function(_0x18f1c9){if(_0x18f1c9){return _0x272c9f[_0x08a9('0x16')](_0x4bf00a);}return _0x272c9f[_0x08a9('0x17')](_0x4bf00a)[_0x08a9('0x18')]();};}function respondWithResult(_0x1a82f3,_0x4f9619){_0x4f9619=_0x4f9619||0xc8;return function(_0x487d0a){if(_0x487d0a){return _0x1a82f3[_0x08a9('0x17')](_0x4f9619)[_0x08a9('0x19')](_0x487d0a);}};}function respondWithFilteredResult(_0x5a099e,_0x19cdcb){return function(_0x33c18a){if(_0x33c18a){var _0x22232c=_0x33c18a[_0x08a9('0x1a')],_0x4e8ea5=_0x19cdcb[_0x08a9('0x1b')],_0x65809c=_0x19cdcb[_0x08a9('0x1b')]+_0x19cdcb[_0x08a9('0x1c')],_0x482daf;if(_0x65809c>=_0x22232c){_0x65809c=_0x22232c;_0x482daf=0xc8;}else{_0x482daf=0xce;}_0x5a099e['status'](_0x482daf);return _0x5a099e['set']('Content-Range',_0x4e8ea5+'-'+_0x65809c+'/'+_0x22232c)[_0x08a9('0x19')](_0x33c18a);}return null;};}function patchUpdates(_0x193d17){return function(_0x2ea7df){try{jsonpatch[_0x08a9('0x1d')](_0x2ea7df,_0x193d17,!![]);}catch(_0x246e7d){return BPromise['reject'](_0x246e7d);}return _0x2ea7df[_0x08a9('0x1e')]();};}function saveUpdates(_0x23f51c,_0x384c51){return function(_0x5449be){if(_0x5449be){return _0x5449be[_0x08a9('0x1f')](_0x23f51c)[_0x08a9('0x20')](function(_0xb57269){return _0xb57269;});}return null;};}function removeEntity(_0x47cdba,_0x37837a){return function(_0x399d70){if(_0x399d70){return _0x399d70['destroy']()[_0x08a9('0x20')](function(){_0x47cdba['status'](0xcc)[_0x08a9('0x18')]();});}};}function handleEntityNotFound(_0xb9d228,_0x3c91b3){return function(_0x440c43){if(!_0x440c43){_0xb9d228[_0x08a9('0x16')](0x194);}return _0x440c43;};}function handleError(_0x445d8c,_0x297b20){_0x297b20=_0x297b20||0x1f4;return function(_0x2f465f){logger[_0x08a9('0x21')](_0x2f465f['stack']);if(_0x2f465f['name']){delete _0x2f465f[_0x08a9('0x22')];}_0x445d8c['status'](_0x297b20)[_0x08a9('0x23')](_0x2f465f);};}exports[_0x08a9('0x24')]=function(_0x1c1f47,_0x1f81be){var _0x42488c={},_0x478ded={},_0xac7393={'count':0x0,'rows':[]};var _0x3adaa9=_['map'](db[_0x08a9('0x25')][_0x08a9('0x26')],function(_0x14265a){return{'name':_0x14265a[_0x08a9('0x27')],'type':_0x14265a[_0x08a9('0x28')][_0x08a9('0x29')]};});_0x478ded[_0x08a9('0x2a')]=_['map'](_0x3adaa9,'name');_0x478ded['query']=_['keys'](_0x1c1f47['query']);_0x478ded['filters']=_[_0x08a9('0x2b')](_0x478ded['model'],_0x478ded[_0x08a9('0x2c')]);_0x42488c['attributes']=_['intersection'](_0x478ded[_0x08a9('0x2a')],qs[_0x08a9('0x2d')](_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x2d')]));_0x42488c['attributes']=_0x42488c['attributes'][_0x08a9('0x2e')]?_0x42488c['attributes']:_0x478ded['model'];if(!_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x2f')](_0x08a9('0x30'))){_0x42488c[_0x08a9('0x1c')]=qs[_0x08a9('0x1c')](_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x1c')]);_0x42488c[_0x08a9('0x1b')]=qs[_0x08a9('0x1b')](_0x1c1f47[_0x08a9('0x2c')]['offset']);}_0x42488c['order']=qs[_0x08a9('0x31')](_0x1c1f47['query'][_0x08a9('0x31')]);_0x42488c['where']=qs[_0x08a9('0x32')](_['pick'](_0x1c1f47[_0x08a9('0x2c')],_0x478ded[_0x08a9('0x32')]),_0x3adaa9);if(_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x33')]){_0x42488c[_0x08a9('0x34')]=_[_0x08a9('0x35')](_0x42488c[_0x08a9('0x34')],{'$or':_[_0x08a9('0x36')](_0x3adaa9,function(_0x40f702){if(_0x40f702['type']!==_0x08a9('0x37')){var _0x4d628f={};_0x4d628f[_0x40f702[_0x08a9('0x22')]]={'$like':'%'+_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x33')]+'%'};return _0x4d628f;}})});}_0x42488c=_['merge']({},_0x42488c,_0x1c1f47[_0x08a9('0x38')]);var _0x5d30fe={'where':_0x42488c[_0x08a9('0x34')]};return db[_0x08a9('0x25')]['count'](_0x5d30fe)[_0x08a9('0x20')](function(_0x72f649){_0xac7393[_0x08a9('0x1a')]=_0x72f649;if(_0x1c1f47[_0x08a9('0x2c')][_0x08a9('0x39')]){_0x42488c[_0x08a9('0x3a')]=[{'all':!![]}];}return db[_0x08a9('0x25')]['findAll'](_0x42488c);})[_0x08a9('0x20')](function(_0x10bbf0){_0xac7393['rows']=_0x10bbf0;return _0xac7393;})[_0x08a9('0x20')](respondWithFilteredResult(_0x1f81be,_0x42488c))[_0x08a9('0x3b')](handleError(_0x1f81be,null));};exports[_0x08a9('0x3c')]=function(_0x43edd1,_0x33be65){var _0xb4f225={'raw':![],'where':{'id':_0x43edd1[_0x08a9('0x3d')]['id']}},_0x3a6540={};_0x3a6540['model']=_[_0x08a9('0x3e')](db[_0x08a9('0x25')][_0x08a9('0x26')]);_0x3a6540['query']=_[_0x08a9('0x3e')](_0x43edd1[_0x08a9('0x2c')]);_0x3a6540[_0x08a9('0x32')]=_[_0x08a9('0x2b')](_0x3a6540[_0x08a9('0x2a')],_0x3a6540['query']);_0xb4f225['attributes']=_[_0x08a9('0x2b')](_0x3a6540[_0x08a9('0x2a')],qs[_0x08a9('0x2d')](_0x43edd1[_0x08a9('0x2c')][_0x08a9('0x2d')]));_0xb4f225[_0x08a9('0x3f')]=_0xb4f225[_0x08a9('0x3f')][_0x08a9('0x2e')]?_0xb4f225['attributes']:_0x3a6540[_0x08a9('0x2a')];if(_0x43edd1['query']['includeAll']){_0xb4f225['include']=[{'all':!![]}];}_0xb4f225=_['merge']({},_0xb4f225,_0x43edd1[_0x08a9('0x38')]);return db[_0x08a9('0x25')][_0x08a9('0x40')](_0xb4f225)[_0x08a9('0x20')](handleEntityNotFound(_0x33be65,null))[_0x08a9('0x20')](respondWithResult(_0x33be65,null))['catch'](handleError(_0x33be65,null));};exports['create']=function(_0x5987c9,_0x4be5a1){return db[_0x08a9('0x25')][_0x08a9('0x41')](_0x5987c9[_0x08a9('0x42')],{})[_0x08a9('0x20')](respondWithResult(_0x4be5a1,0xc9))['catch'](handleError(_0x4be5a1,null));};exports[_0x08a9('0x1f')]=function(_0xaa8b67,_0x31e7d4){if(_0xaa8b67['body']['id']){delete _0xaa8b67[_0x08a9('0x42')]['id'];}return db['IntegrationReport'][_0x08a9('0x40')]({'where':{'id':_0xaa8b67[_0x08a9('0x3d')]['id']}})[_0x08a9('0x20')](handleEntityNotFound(_0x31e7d4,null))[_0x08a9('0x20')](saveUpdates(_0xaa8b67[_0x08a9('0x42')],null))[_0x08a9('0x20')](respondWithResult(_0x31e7d4,null))['catch'](handleError(_0x31e7d4,null));};exports[_0x08a9('0x43')]=function(_0x4adc4d,_0x21ebd0){return db[_0x08a9('0x25')][_0x08a9('0x40')]({'where':{'id':_0x4adc4d[_0x08a9('0x3d')]['id']}})[_0x08a9('0x20')](handleEntityNotFound(_0x21ebd0,null))[_0x08a9('0x20')](removeEntity(_0x21ebd0,null))[_0x08a9('0x3b')](handleError(_0x21ebd0,null));};exports['describe']=function(_0x785e4a,_0x334e51){return db['IntegrationReport'][_0x08a9('0x44')]()[_0x08a9('0x20')](respondWithResult(_0x334e51,null))['catch'](handleError(_0x334e51,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index db1aec6..3ae61ea 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 _0xaa30=['util','moment','bluebird','path','rimraf','../../config/environment','exports','define','IntegrationReport','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa30,0x171));var _0x0aa3=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xaa30[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0aa3('0x0'));var util=require(_0x0aa3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0aa3('0x2'));var BPromise=require(_0x0aa3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aa3('0x4'));var rimraf=require(_0x0aa3('0x5'));var config=require(_0x0aa3('0x6'));var attributes=require('./integrationReport.attributes');module[_0x0aa3('0x7')]=function(_0x2fc88a,_0x26d9d1){return _0x2fc88a[_0x0aa3('0x8')](_0x0aa3('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f6b=['report_integration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','define','IntegrationReport'];(function(_0x380974,_0x2f9563){var _0x12700b=function(_0xdc143e){while(--_0xdc143e){_0x380974['push'](_0x380974['shift']());}};_0x12700b(++_0x2f9563);}(_0x8f6b,0x6d));var _0xb8f6=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x8f6b[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xb8f6('0x0'));var util=require('util');var logger=require(_0xb8f6('0x1'))(_0xb8f6('0x2'));var moment=require(_0xb8f6('0x3'));var BPromise=require(_0xb8f6('0x4'));var rp=require(_0xb8f6('0x5'));var fs=require('fs');var path=require(_0xb8f6('0x6'));var rimraf=require('rimraf');var config=require(_0xb8f6('0x7'));var attributes=require(_0xb8f6('0x8'));module['exports']=function(_0x5cdc83,_0x5c802a){return _0x5cdc83[_0xb8f6('0x9')](_0xb8f6('0xa'),attributes,{'tableName':_0xb8f6('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 c4b1ce1..9e43139 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x0b0e,0x187));var _0xe0b0=function(_0x549b29,_0x2e2b00){_0x549b29=_0x549b29-0x0;var _0x2b813f=_0x0b0e[_0x549b29];return _0x2b813f;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _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(_0x3190d6,_0x3a66b2){var _0x11ca6b=function(_0x2b375e){while(--_0x2b375e){_0x3190d6['push'](_0x3190d6['shift']());}};_0x11ca6b(++_0x3a66b2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'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 f0db11d..02d1527 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x2e8b4f,_0x5295ae){var _0x3e7b41=function(_0x14ffd8){while(--_0x14ffd8){_0x2e8b4f['push'](_0x2e8b4f['shift']());}};_0x3e7b41(++_0x5295ae);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file +var _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(_0x2813dd,_0x489575){var _0x110db2=function(_0x514b92){while(--_0x514b92){_0x2813dd['push'](_0x2813dd['shift']());}};_0x110db2(++_0x489575);}(_0x3e74,0x175));var _0x43e7=function(_0x182c5f,_0x3a8a21){_0x182c5f=_0x182c5f-0x0;var _0x4c78d5=_0x3e74[_0x182c5f];return _0x4c78d5;};'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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 29bd073..e169541 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 _0x1ef0=['exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1ef0,0xda));var _0x01ef=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0x1ef0[_0x617084];return _0x384ac0;};'use strict';var Sequelize=require('sequelize');module[_0x01ef('0x0')]={'name':{'type':Sequelize[_0x01ef('0x1')]},'description':{'type':Sequelize[_0x01ef('0x1')]},'interval':{'type':Sequelize[_0x01ef('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x5a83=['exports','STRING','sequelize'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x5a83,0x1b2));var _0x35a8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5a83[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x35a8('0x0'));module[_0x35a8('0x1')]={'name':{'type':Sequelize[_0x35a8('0x2')]},'description':{'type':Sequelize[_0x35a8('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c90854c..768be80 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 _0xe1a2=['set','Content-Range','reject','save','update','then','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','addInterval','getIntervals','findOne','pick','sequelize','transaction','IntervalId','bulkCreate','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset'];(function(_0x5e765f,_0x2f0668){var _0x12cda6=function(_0x53cf9c){while(--_0x53cf9c){_0x5e765f['push'](_0x5e765f['shift']());}};_0x12cda6(++_0x2f0668);}(_0xe1a2,0x147));var _0x2e1a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xe1a2[_0x2ca616];return _0x53155f;};'use strict';var pdf=require(_0x2e1a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e1a('0x1'));var zipdir=require(_0x2e1a('0x2'));var jsonpatch=require(_0x2e1a('0x3'));var rp=require(_0x2e1a('0x4'));var moment=require(_0x2e1a('0x5'));var BPromise=require(_0x2e1a('0x6'));var Mustache=require(_0x2e1a('0x7'));var util=require(_0x2e1a('0x8'));var path=require(_0x2e1a('0x9'));var sox=require(_0x2e1a('0xa'));var csv=require(_0x2e1a('0xb'));var ejs=require(_0x2e1a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e1a('0xd'));var jsforce=require(_0x2e1a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e1a('0xb'));var querystring=require(_0x2e1a('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e1a('0x10'));var authService=require(_0x2e1a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e1a('0x12'));var logger=require(_0x2e1a('0x13'))(_0x2e1a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2e1a('0x15'))['db'];var extensions=require(_0x2e1a('0x16'));function respondWithStatusCode(_0x1d296c,_0x3d1bf5){_0x3d1bf5=_0x3d1bf5||0xcc;return function(_0x564aeb){if(_0x564aeb){return _0x1d296c[_0x2e1a('0x17')](_0x3d1bf5);}return _0x1d296c[_0x2e1a('0x18')](_0x3d1bf5)[_0x2e1a('0x19')]();};}function respondWithResult(_0x1c4e2a,_0x428ac4){_0x428ac4=_0x428ac4||0xc8;return function(_0x5c1988){if(_0x5c1988){return _0x1c4e2a[_0x2e1a('0x18')](_0x428ac4)[_0x2e1a('0x1a')](_0x5c1988);}};}function respondWithFilteredResult(_0x52b3c4,_0x4d3c9b){return function(_0x15e138){if(_0x15e138){var _0x34431=_0x15e138[_0x2e1a('0x1b')],_0x5a9f54=_0x4d3c9b[_0x2e1a('0x1c')],_0x23dc58=_0x4d3c9b[_0x2e1a('0x1c')]+_0x4d3c9b['limit'],_0x1a6549;if(_0x23dc58>=_0x34431){_0x23dc58=_0x34431;_0x1a6549=0xc8;}else{_0x1a6549=0xce;}_0x52b3c4[_0x2e1a('0x18')](_0x1a6549);return _0x52b3c4[_0x2e1a('0x1d')](_0x2e1a('0x1e'),_0x5a9f54+'-'+_0x23dc58+'/'+_0x34431)[_0x2e1a('0x1a')](_0x15e138);}return null;};}function patchUpdates(_0x50a7f8){return function(_0x3c08ec){try{jsonpatch['apply'](_0x3c08ec,_0x50a7f8,!![]);}catch(_0x5c0e12){return BPromise[_0x2e1a('0x1f')](_0x5c0e12);}return _0x3c08ec[_0x2e1a('0x20')]();};}function saveUpdates(_0x50489f,_0x2cb952){return function(_0x1e56ca){if(_0x1e56ca){return _0x1e56ca[_0x2e1a('0x21')](_0x50489f)[_0x2e1a('0x22')](function(_0x292e75){return _0x292e75;});}return null;};}function removeEntity(_0x263f2a,_0x16e981){return function(_0x11d9c8){if(_0x11d9c8){return _0x11d9c8['destroy']()[_0x2e1a('0x22')](function(){var _0x169505=_0x11d9c8['get']({'plain':!![]});var _0x25dde1=_0x2e1a('0x23');return db[_0x2e1a('0x24')][_0x2e1a('0x25')]({'where':{'type':_0x25dde1,'resourceId':_0x169505['id']}})[_0x2e1a('0x22')](function(){return _0x11d9c8;});})[_0x2e1a('0x22')](function(){_0x263f2a['status'](0xcc)[_0x2e1a('0x19')]();});}};}function handleEntityNotFound(_0x534cf7,_0x51b328){return function(_0x594713){if(!_0x594713){_0x534cf7['sendStatus'](0x194);}return _0x594713;};}function handleError(_0xec66a8,_0x53abee){_0x53abee=_0x53abee||0x1f4;return function(_0x4cb60f){logger[_0x2e1a('0x26')](_0x4cb60f[_0x2e1a('0x27')]);if(_0x4cb60f[_0x2e1a('0x28')]){delete _0x4cb60f['name'];}_0xec66a8[_0x2e1a('0x18')](_0x53abee)[_0x2e1a('0x29')](_0x4cb60f);};}exports['index']=function(_0x74d74f,_0x45ce29){var _0x42a6a7={},_0x205832={},_0x4ee151={'count':0x0,'rows':[]};var _0xc838ef=_[_0x2e1a('0x2a')](db[_0x2e1a('0x2b')][_0x2e1a('0x2c')],function(_0x3e1437){return{'name':_0x3e1437[_0x2e1a('0x2d')],'type':_0x3e1437[_0x2e1a('0x2e')]['key']};});_0x205832['model']=_[_0x2e1a('0x2a')](_0xc838ef,_0x2e1a('0x28'));_0x205832[_0x2e1a('0x2f')]=_[_0x2e1a('0x30')](_0x74d74f['query']);_0x205832['filters']=_[_0x2e1a('0x31')](_0x205832[_0x2e1a('0x32')],_0x205832[_0x2e1a('0x2f')]);_0x42a6a7[_0x2e1a('0x33')]=_[_0x2e1a('0x31')](_0x205832[_0x2e1a('0x32')],qs[_0x2e1a('0x34')](_0x74d74f['query']['fields']));_0x42a6a7[_0x2e1a('0x33')]=_0x42a6a7[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x42a6a7[_0x2e1a('0x33')]:_0x205832[_0x2e1a('0x32')];if(!_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x36')](_0x2e1a('0x37'))){_0x42a6a7[_0x2e1a('0x38')]=qs[_0x2e1a('0x38')](_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x38')]);_0x42a6a7['offset']=qs[_0x2e1a('0x1c')](_0x74d74f['query'][_0x2e1a('0x1c')]);}_0x42a6a7[_0x2e1a('0x39')]=qs[_0x2e1a('0x3a')](_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x3a')]);_0x42a6a7[_0x2e1a('0x3b')]=qs[_0x2e1a('0x3c')](_['pick'](_0x74d74f[_0x2e1a('0x2f')],_0x205832['filters']),_0xc838ef);if(_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x3d')]){_0x42a6a7[_0x2e1a('0x3b')]=_[_0x2e1a('0x3e')](_0x42a6a7[_0x2e1a('0x3b')],{'$or':_[_0x2e1a('0x2a')](_0xc838ef,function(_0x55e1fe){if(_0x55e1fe[_0x2e1a('0x2e')]!==_0x2e1a('0x3f')){var _0xa1427f={};_0xa1427f[_0x55e1fe[_0x2e1a('0x28')]]={'$like':'%'+_0x74d74f['query'][_0x2e1a('0x3d')]+'%'};return _0xa1427f;}})});}_0x42a6a7=_[_0x2e1a('0x3e')]({},_0x42a6a7,_0x74d74f[_0x2e1a('0x40')]);var _0x15dc7d={'where':_0x42a6a7[_0x2e1a('0x3b')]};return db[_0x2e1a('0x2b')][_0x2e1a('0x1b')](_0x15dc7d)[_0x2e1a('0x22')](function(_0x54e9eb){_0x4ee151[_0x2e1a('0x1b')]=_0x54e9eb;if(_0x74d74f[_0x2e1a('0x2f')][_0x2e1a('0x41')]){_0x42a6a7[_0x2e1a('0x42')]=[{'all':!![]}];}return db[_0x2e1a('0x2b')][_0x2e1a('0x43')](_0x42a6a7);})[_0x2e1a('0x22')](function(_0x5c6fc7){_0x4ee151[_0x2e1a('0x44')]=_0x5c6fc7;return _0x4ee151;})[_0x2e1a('0x22')](respondWithFilteredResult(_0x45ce29,_0x42a6a7))[_0x2e1a('0x45')](handleError(_0x45ce29,null));};exports[_0x2e1a('0x46')]=function(_0x4e2e1b,_0x70b240){var _0x5e4615={'raw':!![],'where':{'id':_0x4e2e1b[_0x2e1a('0x47')]['id']}},_0x4f5084={};_0x4f5084[_0x2e1a('0x32')]=_['keys'](db['Interval']['rawAttributes']);_0x4f5084[_0x2e1a('0x2f')]=_['keys'](_0x4e2e1b[_0x2e1a('0x2f')]);_0x4f5084[_0x2e1a('0x3c')]=_[_0x2e1a('0x31')](_0x4f5084[_0x2e1a('0x32')],_0x4f5084['query']);_0x5e4615[_0x2e1a('0x33')]=_['intersection'](_0x4f5084['model'],qs['fields'](_0x4e2e1b[_0x2e1a('0x2f')][_0x2e1a('0x34')]));_0x5e4615[_0x2e1a('0x33')]=_0x5e4615[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x5e4615[_0x2e1a('0x33')]:_0x4f5084[_0x2e1a('0x32')];if(_0x4e2e1b[_0x2e1a('0x2f')][_0x2e1a('0x41')]){_0x5e4615[_0x2e1a('0x42')]=[{'all':!![]}];}_0x5e4615=_['merge']({},_0x5e4615,_0x4e2e1b[_0x2e1a('0x40')]);return db[_0x2e1a('0x2b')][_0x2e1a('0x48')](_0x5e4615)[_0x2e1a('0x22')](handleEntityNotFound(_0x70b240,null))[_0x2e1a('0x22')](respondWithResult(_0x70b240,null))[_0x2e1a('0x45')](handleError(_0x70b240,null));};exports[_0x2e1a('0x49')]=function(_0x361772,_0x29ec77){return db['Interval'][_0x2e1a('0x49')](_0x361772[_0x2e1a('0x4a')],{})['then'](function(_0xaf9f6c){var _0x31eb94=_0x361772[_0x2e1a('0x4b')]['get']({'plain':!![]});if(!_0x31eb94)throw new Error(_0x2e1a('0x4c'));if(_0x31eb94[_0x2e1a('0x4d')]===_0x2e1a('0x4b')){var _0x4785fc=_0xaf9f6c[_0x2e1a('0x4e')]({'plain':!![]});var _0x5b8c45='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x5b8c45,'userProfileId':_0x31eb94[_0x2e1a('0x4f')]},'raw':!![]})[_0x2e1a('0x22')](function(_0x3292af){if(_0x3292af&&_0x3292af[_0x2e1a('0x50')]===0x0){return db[_0x2e1a('0x24')][_0x2e1a('0x49')]({'name':_0x4785fc[_0x2e1a('0x28')],'resourceId':_0x4785fc['id'],'type':_0x3292af[_0x2e1a('0x28')],'sectionId':_0x3292af['id']},{})[_0x2e1a('0x22')](function(){return _0xaf9f6c;});}else{return _0xaf9f6c;}})[_0x2e1a('0x45')](function(_0x135701){logger[_0x2e1a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x135701);throw _0x135701;});}return _0xaf9f6c;})[_0x2e1a('0x22')](respondWithResult(_0x29ec77,0xc9))[_0x2e1a('0x45')](handleError(_0x29ec77,null));};exports[_0x2e1a('0x21')]=function(_0x48a2c6,_0x39b2cc){if(_0x48a2c6[_0x2e1a('0x4a')]['id']){delete _0x48a2c6['body']['id'];}return db[_0x2e1a('0x2b')][_0x2e1a('0x48')]({'where':{'id':_0x48a2c6[_0x2e1a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39b2cc,null))['then'](saveUpdates(_0x48a2c6[_0x2e1a('0x4a')],null))[_0x2e1a('0x22')](respondWithResult(_0x39b2cc,null))['catch'](handleError(_0x39b2cc,null));};exports[_0x2e1a('0x25')]=function(_0x2cc750,_0x501af1){return db[_0x2e1a('0x2b')][_0x2e1a('0x48')]({'where':{'id':_0x2cc750['params']['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x501af1,null))['then'](removeEntity(_0x501af1,null))[_0x2e1a('0x45')](handleError(_0x501af1,null));};exports[_0x2e1a('0x51')]=function(_0xfc9e33,_0x24624d,_0x1e37b9){if(_0xfc9e33[_0x2e1a('0x4a')]['id']){delete _0xfc9e33['body']['id'];}return db['Interval'][_0x2e1a('0x48')]({'where':{'id':_0xfc9e33['params']['id']}})['then'](handleEntityNotFound(_0x24624d,null))[_0x2e1a('0x22')](function(_0x896403){if(_0x896403){_0xfc9e33[_0x2e1a('0x4a')]['IntervalId']=_0x896403['id'];return db['Interval'][_0x2e1a('0x49')](_0xfc9e33['body']);}})['then'](respondWithResult(_0x24624d,null))[_0x2e1a('0x45')](handleError(_0x24624d,null));};exports[_0x2e1a('0x52')]=function(_0x535db7,_0x14a40f,_0x23fc00){var _0x1121f8={};var _0x1b3af1={};var _0x108b30;var _0x4cad0d;return db[_0x2e1a('0x2b')][_0x2e1a('0x53')]({'where':{'id':_0x535db7[_0x2e1a('0x47')]['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x14a40f,null))[_0x2e1a('0x22')](function(_0x115c29){if(_0x115c29){_0x108b30=_0x115c29;_0x1b3af1[_0x2e1a('0x32')]=_[_0x2e1a('0x30')](db[_0x2e1a('0x2b')][_0x2e1a('0x2c')]);_0x1b3af1['query']=_[_0x2e1a('0x30')](_0x535db7[_0x2e1a('0x2f')]);_0x1b3af1[_0x2e1a('0x3c')]=_['intersection'](_0x1b3af1[_0x2e1a('0x32')],_0x1b3af1[_0x2e1a('0x2f')]);_0x1121f8[_0x2e1a('0x33')]=_[_0x2e1a('0x31')](_0x1b3af1[_0x2e1a('0x32')],qs['fields'](_0x535db7[_0x2e1a('0x2f')]['fields']));_0x1121f8[_0x2e1a('0x33')]=_0x1121f8[_0x2e1a('0x33')][_0x2e1a('0x35')]?_0x1121f8[_0x2e1a('0x33')]:_0x1b3af1[_0x2e1a('0x32')];_0x1121f8[_0x2e1a('0x39')]=qs[_0x2e1a('0x3a')](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x3a')]);_0x1121f8[_0x2e1a('0x3b')]=qs[_0x2e1a('0x3c')](_[_0x2e1a('0x54')](_0x535db7[_0x2e1a('0x2f')],_0x1b3af1['filters']));if(_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x3d')]){_0x1121f8[_0x2e1a('0x3b')]=_[_0x2e1a('0x3e')](_0x1121f8[_0x2e1a('0x3b')],{'$or':_[_0x2e1a('0x2a')](_0x1121f8['attributes'],function(_0x35a59c){var _0x2c80c5={};_0x2c80c5[_0x35a59c]={'$like':'%'+_0x535db7['query']['filter']+'%'};return _0x2c80c5;})});}_0x1121f8=_[_0x2e1a('0x3e')]({},_0x1121f8,_0x535db7[_0x2e1a('0x40')]);return _0x108b30[_0x2e1a('0x52')](_0x1121f8);}})[_0x2e1a('0x22')](function(_0x331bdc){if(_0x331bdc){_0x4cad0d=_0x331bdc[_0x2e1a('0x35')];if(!_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x36')](_0x2e1a('0x37'))){_0x1121f8[_0x2e1a('0x38')]=qs['limit'](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x38')]);_0x1121f8['offset']=qs[_0x2e1a('0x1c')](_0x535db7[_0x2e1a('0x2f')][_0x2e1a('0x1c')]);}return _0x108b30[_0x2e1a('0x52')](_0x1121f8);}})[_0x2e1a('0x22')](function(_0x531cb1){if(_0x531cb1){return _0x531cb1?{'count':_0x4cad0d,'rows':_0x531cb1}:null;}})[_0x2e1a('0x22')](respondWithResult(_0x14a40f,null))[_0x2e1a('0x45')](handleError(_0x14a40f,null));};exports['addIntervals']=function(_0x269b7d,_0x13ec06,_0x583de3){return db['Interval'][_0x2e1a('0x53')]({'where':{'id':_0x269b7d['params']['id']}})[_0x2e1a('0x22')](handleEntityNotFound(_0x13ec06,null))['then'](function(_0x2936fd){if(_0x2936fd){return db[_0x2e1a('0x55')][_0x2e1a('0x56')](function(_0x3bca39){return db[_0x2e1a('0x2b')][_0x2e1a('0x25')]({'where':{'IntervalId':_0x269b7d[_0x2e1a('0x47')]['id']},'transaction':_0x3bca39})['then'](function(_0x40b8ce){var _0x474c51=_['map'](_0x269b7d[_0x2e1a('0x4a')],function(_0x5d1f73){delete _0x5d1f73['id'];_0x5d1f73[_0x2e1a('0x57')]=_0x269b7d[_0x2e1a('0x47')]['id'];return _0x5d1f73;});return db[_0x2e1a('0x2b')][_0x2e1a('0x58')](_0x474c51,{'transaction':_0x3bca39});});})[_0x2e1a('0x22')](function(){return db['Interval'][_0x2e1a('0x43')]({'where':{'IntervalId':_0x269b7d[_0x2e1a('0x47')]['id']}});});}})['then'](respondWithResult(_0x13ec06,null))[_0x2e1a('0x45')](handleError(_0x13ec06,null));}; \ No newline at end of file +var _0xeab6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','findOne','order','map','getIntervals','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Intervals','error','stack','name','send','index','Interval','rawAttributes','fieldName','key','keys','query','intersection','fields','attributes','model','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x582d65,_0x57ad6b){var _0x2d2ba1=function(_0x1ca959){while(--_0x1ca959){_0x582d65['push'](_0x582d65['shift']());}};_0x2d2ba1(++_0x57ad6b);}(_0xeab6,0xbb));var _0x6eab=function(_0x2634a7,_0x118508){_0x2634a7=_0x2634a7-0x0;var _0xa52e2c=_0xeab6[_0x2634a7];return _0xa52e2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6eab('0x0'));var rimraf=require(_0x6eab('0x1'));var zipdir=require(_0x6eab('0x2'));var jsonpatch=require(_0x6eab('0x3'));var rp=require(_0x6eab('0x4'));var moment=require(_0x6eab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6eab('0x6'));var util=require(_0x6eab('0x7'));var path=require(_0x6eab('0x8'));var sox=require(_0x6eab('0x9'));var csv=require(_0x6eab('0xa'));var ejs=require(_0x6eab('0xb'));var fs=require('fs');var _=require(_0x6eab('0xc'));var squel=require('squel');var crypto=require(_0x6eab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6eab('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6eab('0xf'));var Papa=require(_0x6eab('0x10'));var Redis=require('ioredis');var authService=require(_0x6eab('0x11'));var qs=require(_0x6eab('0x12'));var as=require(_0x6eab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6eab('0x14'));var utils=require(_0x6eab('0x15'));var config=require(_0x6eab('0x16'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6eab('0x17'));function respondWithStatusCode(_0x545f25,_0x2abbdb){_0x2abbdb=_0x2abbdb||0xcc;return function(_0x39dec2){if(_0x39dec2){return _0x545f25[_0x6eab('0x18')](_0x2abbdb);}return _0x545f25[_0x6eab('0x19')](_0x2abbdb)[_0x6eab('0x1a')]();};}function respondWithResult(_0x2f58c3,_0x5be743){_0x5be743=_0x5be743||0xc8;return function(_0x1306a2){if(_0x1306a2){return _0x2f58c3[_0x6eab('0x19')](_0x5be743)['json'](_0x1306a2);}};}function respondWithFilteredResult(_0x2902b0,_0x566221){return function(_0x283924){if(_0x283924){var _0x28366d=_0x283924['count'],_0x106796=_0x566221[_0x6eab('0x1b')],_0x5291f5=_0x566221[_0x6eab('0x1b')]+_0x566221[_0x6eab('0x1c')],_0x11f759;if(_0x5291f5>=_0x28366d){_0x5291f5=_0x28366d;_0x11f759=0xc8;}else{_0x11f759=0xce;}_0x2902b0[_0x6eab('0x19')](_0x11f759);return _0x2902b0[_0x6eab('0x1d')](_0x6eab('0x1e'),_0x106796+'-'+_0x5291f5+'/'+_0x28366d)['json'](_0x283924);}return null;};}function patchUpdates(_0x4a6eb1){return function(_0x110bf9){try{jsonpatch[_0x6eab('0x1f')](_0x110bf9,_0x4a6eb1,!![]);}catch(_0x3a5cbd){return BPromise['reject'](_0x3a5cbd);}return _0x110bf9[_0x6eab('0x20')]();};}function saveUpdates(_0x4bb623,_0x2353d9){return function(_0x491da0){if(_0x491da0){return _0x491da0[_0x6eab('0x21')](_0x4bb623)[_0x6eab('0x22')](function(_0x11eea2){return _0x11eea2;});}return null;};}function removeEntity(_0x38ceee,_0x56a4f8){return function(_0x44bb84){if(_0x44bb84){return _0x44bb84[_0x6eab('0x23')]()['then'](function(){var _0x591972=_0x44bb84[_0x6eab('0x24')]({'plain':!![]});var _0x3aa757=_0x6eab('0x25');return db['UserProfileResource'][_0x6eab('0x23')]({'where':{'type':_0x3aa757,'resourceId':_0x591972['id']}})[_0x6eab('0x22')](function(){return _0x44bb84;});})[_0x6eab('0x22')](function(){_0x38ceee[_0x6eab('0x19')](0xcc)[_0x6eab('0x1a')]();});}};}function handleEntityNotFound(_0x198dcc,_0x46d7d2){return function(_0x5de6e4){if(!_0x5de6e4){_0x198dcc[_0x6eab('0x18')](0x194);}return _0x5de6e4;};}function handleError(_0x4b17c9,_0x2dcbe2){_0x2dcbe2=_0x2dcbe2||0x1f4;return function(_0x2e438b){logger[_0x6eab('0x26')](_0x2e438b[_0x6eab('0x27')]);if(_0x2e438b['name']){delete _0x2e438b[_0x6eab('0x28')];}_0x4b17c9[_0x6eab('0x19')](_0x2dcbe2)[_0x6eab('0x29')](_0x2e438b);};}exports[_0x6eab('0x2a')]=function(_0x5d515e,_0x38af2b){var _0x42711d={},_0x43d811={},_0x139319={'count':0x0,'rows':[]};var _0x43ae85=_['map'](db[_0x6eab('0x2b')][_0x6eab('0x2c')],function(_0x420848){return{'name':_0x420848[_0x6eab('0x2d')],'type':_0x420848['type'][_0x6eab('0x2e')]};});_0x43d811['model']=_['map'](_0x43ae85,_0x6eab('0x28'));_0x43d811['query']=_[_0x6eab('0x2f')](_0x5d515e[_0x6eab('0x30')]);_0x43d811['filters']=_[_0x6eab('0x31')](_0x43d811['model'],_0x43d811[_0x6eab('0x30')]);_0x42711d['attributes']=_[_0x6eab('0x31')](_0x43d811['model'],qs[_0x6eab('0x32')](_0x5d515e[_0x6eab('0x30')]['fields']));_0x42711d['attributes']=_0x42711d[_0x6eab('0x33')]['length']?_0x42711d[_0x6eab('0x33')]:_0x43d811[_0x6eab('0x34')];if(!_0x5d515e[_0x6eab('0x30')][_0x6eab('0x35')](_0x6eab('0x36'))){_0x42711d['limit']=qs['limit'](_0x5d515e[_0x6eab('0x30')][_0x6eab('0x1c')]);_0x42711d[_0x6eab('0x1b')]=qs['offset'](_0x5d515e['query'][_0x6eab('0x1b')]);}_0x42711d['order']=qs[_0x6eab('0x37')](_0x5d515e['query'][_0x6eab('0x37')]);_0x42711d['where']=qs[_0x6eab('0x38')](_[_0x6eab('0x39')](_0x5d515e[_0x6eab('0x30')],_0x43d811[_0x6eab('0x38')]),_0x43ae85);if(_0x5d515e['query'][_0x6eab('0x3a')]){_0x42711d[_0x6eab('0x3b')]=_[_0x6eab('0x3c')](_0x42711d[_0x6eab('0x3b')],{'$or':_['map'](_0x43ae85,function(_0x6b26ff){if(_0x6b26ff[_0x6eab('0x3d')]!==_0x6eab('0x3e')){var _0xb09d00={};_0xb09d00[_0x6b26ff[_0x6eab('0x28')]]={'$like':'%'+_0x5d515e[_0x6eab('0x30')]['filter']+'%'};return _0xb09d00;}})});}_0x42711d=_[_0x6eab('0x3c')]({},_0x42711d,_0x5d515e[_0x6eab('0x3f')]);var _0x18a251={'where':_0x42711d[_0x6eab('0x3b')]};return db[_0x6eab('0x2b')][_0x6eab('0x40')](_0x18a251)[_0x6eab('0x22')](function(_0x4c14c2){_0x139319['count']=_0x4c14c2;if(_0x5d515e[_0x6eab('0x30')]['includeAll']){_0x42711d[_0x6eab('0x41')]=[{'all':!![]}];}return db[_0x6eab('0x2b')][_0x6eab('0x42')](_0x42711d);})[_0x6eab('0x22')](function(_0xaba5d8){_0x139319[_0x6eab('0x43')]=_0xaba5d8;return _0x139319;})[_0x6eab('0x22')](respondWithFilteredResult(_0x38af2b,_0x42711d))[_0x6eab('0x44')](handleError(_0x38af2b,null));};exports['show']=function(_0x9d9a5,_0x4b170d){var _0x2af2d3={'raw':!![],'where':{'id':_0x9d9a5[_0x6eab('0x45')]['id']}},_0x5e67f7={};_0x5e67f7[_0x6eab('0x34')]=_[_0x6eab('0x2f')](db['Interval'][_0x6eab('0x2c')]);_0x5e67f7['query']=_[_0x6eab('0x2f')](_0x9d9a5[_0x6eab('0x30')]);_0x5e67f7[_0x6eab('0x38')]=_['intersection'](_0x5e67f7[_0x6eab('0x34')],_0x5e67f7[_0x6eab('0x30')]);_0x2af2d3[_0x6eab('0x33')]=_[_0x6eab('0x31')](_0x5e67f7['model'],qs[_0x6eab('0x32')](_0x9d9a5[_0x6eab('0x30')][_0x6eab('0x32')]));_0x2af2d3['attributes']=_0x2af2d3[_0x6eab('0x33')][_0x6eab('0x46')]?_0x2af2d3[_0x6eab('0x33')]:_0x5e67f7[_0x6eab('0x34')];if(_0x9d9a5[_0x6eab('0x30')][_0x6eab('0x47')]){_0x2af2d3[_0x6eab('0x41')]=[{'all':!![]}];}_0x2af2d3=_[_0x6eab('0x3c')]({},_0x2af2d3,_0x9d9a5[_0x6eab('0x3f')]);return db[_0x6eab('0x2b')][_0x6eab('0x48')](_0x2af2d3)[_0x6eab('0x22')](handleEntityNotFound(_0x4b170d,null))['then'](respondWithResult(_0x4b170d,null))['catch'](handleError(_0x4b170d,null));};exports[_0x6eab('0x49')]=function(_0x53425e,_0x295585){return db[_0x6eab('0x2b')]['create'](_0x53425e['body'],{})['then'](function(_0x3af337){var _0x384bae=_0x53425e[_0x6eab('0x4a')]['get']({'plain':!![]});if(!_0x384bae)throw new Error(_0x6eab('0x4b'));if(_0x384bae[_0x6eab('0x4c')]===_0x6eab('0x4a')){var _0x566503=_0x3af337[_0x6eab('0x24')]({'plain':!![]});var _0x30003f=_0x6eab('0x25');return db['UserProfileSection'][_0x6eab('0x48')]({'where':{'name':_0x30003f,'userProfileId':_0x384bae['userProfileId']},'raw':!![]})[_0x6eab('0x22')](function(_0x733629){if(_0x733629&&_0x733629['autoAssociation']===0x0){return db['UserProfileResource'][_0x6eab('0x49')]({'name':_0x566503[_0x6eab('0x28')],'resourceId':_0x566503['id'],'type':_0x733629['name'],'sectionId':_0x733629['id']},{})[_0x6eab('0x22')](function(){return _0x3af337;});}else{return _0x3af337;}})['catch'](function(_0x13b803){logger[_0x6eab('0x26')](_0x6eab('0x4d'),_0x13b803);throw _0x13b803;});}return _0x3af337;})[_0x6eab('0x22')](respondWithResult(_0x295585,0xc9))[_0x6eab('0x44')](handleError(_0x295585,null));};exports[_0x6eab('0x21')]=function(_0x4dea77,_0x546810){if(_0x4dea77[_0x6eab('0x4e')]['id']){delete _0x4dea77['body']['id'];}return db[_0x6eab('0x2b')]['find']({'where':{'id':_0x4dea77[_0x6eab('0x45')]['id']}})[_0x6eab('0x22')](handleEntityNotFound(_0x546810,null))['then'](saveUpdates(_0x4dea77[_0x6eab('0x4e')],null))[_0x6eab('0x22')](respondWithResult(_0x546810,null))[_0x6eab('0x44')](handleError(_0x546810,null));};exports[_0x6eab('0x23')]=function(_0x29b979,_0x1484d8){return db[_0x6eab('0x2b')][_0x6eab('0x48')]({'where':{'id':_0x29b979[_0x6eab('0x45')]['id']}})[_0x6eab('0x22')](handleEntityNotFound(_0x1484d8,null))['then'](removeEntity(_0x1484d8,null))['catch'](handleError(_0x1484d8,null));};exports[_0x6eab('0x4f')]=function(_0x42e824,_0x33b3c4,_0x4627e7){if(_0x42e824[_0x6eab('0x4e')]['id']){delete _0x42e824['body']['id'];}return db[_0x6eab('0x2b')][_0x6eab('0x48')]({'where':{'id':_0x42e824[_0x6eab('0x45')]['id']}})[_0x6eab('0x22')](handleEntityNotFound(_0x33b3c4,null))['then'](function(_0x3fa8df){if(_0x3fa8df){_0x42e824['body'][_0x6eab('0x50')]=_0x3fa8df['id'];return db['Interval']['create'](_0x42e824['body']);}})[_0x6eab('0x22')](respondWithResult(_0x33b3c4,null))[_0x6eab('0x44')](handleError(_0x33b3c4,null));};exports['getIntervals']=function(_0x5cef16,_0x134b59,_0x32529c){var _0x806ab9={};var _0x57a10d={};var _0xd7c835;var _0x563aac;return db[_0x6eab('0x2b')][_0x6eab('0x51')]({'where':{'id':_0x5cef16[_0x6eab('0x45')]['id']}})['then'](handleEntityNotFound(_0x134b59,null))[_0x6eab('0x22')](function(_0x2a0713){if(_0x2a0713){_0xd7c835=_0x2a0713;_0x57a10d[_0x6eab('0x34')]=_[_0x6eab('0x2f')](db[_0x6eab('0x2b')]['rawAttributes']);_0x57a10d[_0x6eab('0x30')]=_[_0x6eab('0x2f')](_0x5cef16[_0x6eab('0x30')]);_0x57a10d[_0x6eab('0x38')]=_[_0x6eab('0x31')](_0x57a10d[_0x6eab('0x34')],_0x57a10d[_0x6eab('0x30')]);_0x806ab9[_0x6eab('0x33')]=_['intersection'](_0x57a10d[_0x6eab('0x34')],qs[_0x6eab('0x32')](_0x5cef16[_0x6eab('0x30')]['fields']));_0x806ab9[_0x6eab('0x33')]=_0x806ab9[_0x6eab('0x33')][_0x6eab('0x46')]?_0x806ab9[_0x6eab('0x33')]:_0x57a10d['model'];_0x806ab9[_0x6eab('0x52')]=qs['sort'](_0x5cef16['query']['sort']);_0x806ab9[_0x6eab('0x3b')]=qs[_0x6eab('0x38')](_['pick'](_0x5cef16[_0x6eab('0x30')],_0x57a10d[_0x6eab('0x38')]));if(_0x5cef16['query'][_0x6eab('0x3a')]){_0x806ab9[_0x6eab('0x3b')]=_[_0x6eab('0x3c')](_0x806ab9[_0x6eab('0x3b')],{'$or':_[_0x6eab('0x53')](_0x806ab9[_0x6eab('0x33')],function(_0x53acf5){var _0x1e8b90={};_0x1e8b90[_0x53acf5]={'$like':'%'+_0x5cef16[_0x6eab('0x30')][_0x6eab('0x3a')]+'%'};return _0x1e8b90;})});}_0x806ab9=_[_0x6eab('0x3c')]({},_0x806ab9,_0x5cef16[_0x6eab('0x3f')]);return _0xd7c835[_0x6eab('0x54')](_0x806ab9);}})[_0x6eab('0x22')](function(_0x3aa004){if(_0x3aa004){_0x563aac=_0x3aa004['length'];if(!_0x5cef16['query'][_0x6eab('0x35')]('nolimit')){_0x806ab9['limit']=qs['limit'](_0x5cef16[_0x6eab('0x30')][_0x6eab('0x1c')]);_0x806ab9[_0x6eab('0x1b')]=qs[_0x6eab('0x1b')](_0x5cef16[_0x6eab('0x30')][_0x6eab('0x1b')]);}return _0xd7c835[_0x6eab('0x54')](_0x806ab9);}})[_0x6eab('0x22')](function(_0x23b953){if(_0x23b953){return _0x23b953?{'count':_0x563aac,'rows':_0x23b953}:null;}})[_0x6eab('0x22')](respondWithResult(_0x134b59,null))['catch'](handleError(_0x134b59,null));};exports[_0x6eab('0x55')]=function(_0x42311b,_0x3b72a9,_0x551e38){return db[_0x6eab('0x2b')][_0x6eab('0x51')]({'where':{'id':_0x42311b[_0x6eab('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b72a9,null))['then'](function(_0x2d5eeb){if(_0x2d5eeb){return db[_0x6eab('0x56')]['transaction'](function(_0x128e86){return db['Interval'][_0x6eab('0x23')]({'where':{'IntervalId':_0x42311b['params']['id']},'transaction':_0x128e86})[_0x6eab('0x22')](function(_0x1050cd){var _0x525ac6=_[_0x6eab('0x53')](_0x42311b[_0x6eab('0x4e')],function(_0xfe9354){delete _0xfe9354['id'];_0xfe9354[_0x6eab('0x50')]=_0x42311b[_0x6eab('0x45')]['id'];return _0xfe9354;});return db[_0x6eab('0x2b')][_0x6eab('0x57')](_0x525ac6,{'transaction':_0x128e86});});})['then'](function(){return db[_0x6eab('0x2b')]['findAll']({'where':{'IntervalId':_0x42311b[_0x6eab('0x45')]['id']}});});}})['then'](respondWithResult(_0x3b72a9,null))[_0x6eab('0x44')](handleError(_0x3b72a9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 7a4615a..8ac7730 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 _0xe3ed=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','exports','define','tools_intervals'];(function(_0x48b541,_0x2774ea){var _0x480397=function(_0x30a8f1){while(--_0x30a8f1){_0x48b541['push'](_0x48b541['shift']());}};_0x480397(++_0x2774ea);}(_0xe3ed,0x8d));var _0xde3e=function(_0x58a56a,_0x1387b2){_0x58a56a=_0x58a56a-0x0;var _0x144322=_0xe3ed[_0x58a56a];return _0x144322;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var logger=require(_0xde3e('0x2'))(_0xde3e('0x3'));var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var rp=require(_0xde3e('0x6'));var fs=require('fs');var path=require(_0xde3e('0x7'));var rimraf=require('rimraf');var config=require(_0xde3e('0x8'));var attributes=require(_0xde3e('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xde3e('0xa')]=function(_0x5e9013,_0x184b02){return _0x5e9013[_0xde3e('0xb')]('Interval',attributes,{'tableName':_0xde3e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b1597,_0xceed52){extensions[_0xde3e('0xd')](_0x5e9013,_0x3b1597);},'afterBulkCreate':function(_0x76daf5,_0x4aec4d,_0x1ca45c){_0x1ca45c();extensions[_0xde3e('0xd')](_0x5e9013,_0x76daf5[0x0]);},'afterUpdate':function(_0x3e251b,_0x137bf2){extensions['rewrite'](_0x5e9013,_0x3e251b);},'afterDestroy':function(_0xf8e2c3,_0x3b50df){extensions['rewrite'](_0x5e9013,_0xf8e2c3);}}});}; \ No newline at end of file +var _0x0506=['exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','path','../../config/environment'];(function(_0x449925,_0x4bc4d5){var _0xcc43ed=function(_0x93ea7c){while(--_0x93ea7c){_0x449925['push'](_0x449925['shift']());}};_0xcc43ed(++_0x4bc4d5);}(_0x0506,0x1d1));var _0x6050=function(_0x3e58a9,_0x353cc4){_0x3e58a9=_0x3e58a9-0x0;var _0x3b36fd=_0x0506[_0x3e58a9];return _0x3b36fd;};'use strict';var _=require(_0x6050('0x0'));var util=require(_0x6050('0x1'));var logger=require(_0x6050('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6050('0x3'));var rimraf=require('rimraf');var config=require(_0x6050('0x4'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x6050('0x5')]=function(_0x269be3,_0x2a3644){return _0x269be3[_0x6050('0x6')](_0x6050('0x7'),attributes,{'tableName':_0x6050('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4068d3,_0x3ae4c8){extensions['rewrite'](_0x269be3,_0x4068d3);},'afterBulkCreate':function(_0x312217,_0x4f149a,_0x15ad99){_0x15ad99();extensions[_0x6050('0x9')](_0x269be3,_0x312217[0x0]);},'afterUpdate':function(_0xd01ae7,_0x24f726){extensions[_0x6050('0x9')](_0x269be3,_0xd01ae7);},'afterDestroy':function(_0x1b8d24,_0x105915){extensions[_0x6050('0x9')](_0x269be3,_0x1b8d24);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 6ff5c6a..0268312 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 _0x312e=['attributes','limit','include','model','map','catch','ShowInterval','Interval','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','result','GetInterval','findAll','options','raw'];(function(_0x48bef2,_0x15347a){var _0x5e88b0=function(_0x375d15){while(--_0x375d15){_0x48bef2['push'](_0x48bef2['shift']());}};_0x5e88b0(++_0x15347a);}(_0x312e,0xd0));var _0xe312=function(_0x53c309,_0x3e3c71){_0x53c309=_0x53c309-0x0;var _0xe1c297=_0x312e[_0x53c309];return _0xe1c297;};'use strict';var _=require(_0xe312('0x0'));var util=require('util');var moment=require(_0xe312('0x1'));var BPromise=require(_0xe312('0x2'));var rs=require(_0xe312('0x3'));var fs=require('fs');var Redis=require(_0xe312('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe312('0x5'));var logger=require(_0xe312('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe312('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5dfa,_0x17ee7c,_0x173ca5){return new BPromise(function(_0x3cdc7d,_0x1615b9){return client['request'](_0x2f5dfa,_0x173ca5)[_0xe312('0x8')](function(_0x346552){logger[_0xe312('0x9')]('Interval,\x20%s,\x20%s',_0x17ee7c,_0xe312('0xa'));logger[_0xe312('0xb')](_0xe312('0xc'),_0x17ee7c,_0xe312('0xa'),JSON[_0xe312('0xd')](_0x346552));if(_0x346552[_0xe312('0xe')]){if(_0x346552['error'][_0xe312('0xf')]===0x1f4){logger[_0xe312('0xe')](_0xe312('0x10'),_0x17ee7c,_0x346552[_0xe312('0xe')][_0xe312('0x11')]);return _0x1615b9(_0x346552[_0xe312('0xe')][_0xe312('0x11')]);}logger[_0xe312('0xe')](_0xe312('0x10'),_0x17ee7c,_0x346552[_0xe312('0xe')][_0xe312('0x11')]);return _0x3cdc7d(_0x346552[_0xe312('0xe')]['message']);}else{logger['info'](_0xe312('0x10'),_0x17ee7c,'request\x20sent');_0x3cdc7d(_0x346552[_0xe312('0x12')][_0xe312('0x11')]);}})['catch'](function(_0x5f45cd){logger[_0xe312('0xe')]('Interval,\x20%s,\x20%s',_0x17ee7c,_0x5f45cd);_0x1615b9(_0x5f45cd);});});}exports[_0xe312('0x13')]=function(_0x174fd3){var _0xa0d230=this;return new Promise(function(_0x502b42,_0x2ca879){return db['Interval'][_0xe312('0x14')]({'raw':_0x174fd3[_0xe312('0x15')]?_0x174fd3[_0xe312('0x15')][_0xe312('0x16')]===undefined?!![]:![]:!![],'where':_0x174fd3[_0xe312('0x15')]?_0x174fd3[_0xe312('0x15')]['where']||null:null,'attributes':_0x174fd3[_0xe312('0x15')]?_0x174fd3['options'][_0xe312('0x17')]||null:null,'limit':_0x174fd3['options']?_0x174fd3[_0xe312('0x15')][_0xe312('0x18')]||null:null,'include':_0x174fd3['options']?_0x174fd3[_0xe312('0x15')][_0xe312('0x19')]?_['map'](_0x174fd3['options'][_0xe312('0x19')],function(_0x574e6b){return{'model':db[_0x574e6b[_0xe312('0x1a')]],'as':_0x574e6b['as'],'attributes':_0x574e6b[_0xe312('0x17')],'include':_0x574e6b['include']?_[_0xe312('0x1b')](_0x574e6b[_0xe312('0x19')],function(_0x33e3d1){return{'model':db[_0x33e3d1['model']],'as':_0x33e3d1['as'],'attributes':_0x33e3d1[_0xe312('0x17')],'include':_0x33e3d1[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x33e3d1[_0xe312('0x19')],function(_0xa68b54){return{'model':db[_0xa68b54['model']],'as':_0xa68b54['as'],'attributes':_0xa68b54[_0xe312('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe312('0x8')](function(_0x42a54d){logger[_0xe312('0x9')](_0xe312('0x13'),_0x174fd3);logger[_0xe312('0xb')](_0xe312('0x13'),_0x174fd3,JSON[_0xe312('0xd')](_0x42a54d));_0x502b42(_0x42a54d);})[_0xe312('0x1c')](function(_0x20d76f){logger[_0xe312('0xe')](_0xe312('0x13'),_0x20d76f['message'],_0x174fd3);_0x2ca879(_0xa0d230[_0xe312('0xe')](0x1f4,_0x20d76f[_0xe312('0x11')]));});});};exports[_0xe312('0x1d')]=function(_0xea34f3){var _0x4eaa8e=this;return new Promise(function(_0x2834bc,_0x230de3){return db[_0xe312('0x1e')][_0xe312('0x1f')]({'raw':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')][_0xe312('0x20')]||null:null,'attributes':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')][_0xe312('0x17')]||null:null,'include':_0xea34f3[_0xe312('0x15')]?_0xea34f3[_0xe312('0x15')]['include']?_[_0xe312('0x1b')](_0xea34f3[_0xe312('0x15')]['include'],function(_0x2a9555){return{'model':db[_0x2a9555['model']],'as':_0x2a9555['as'],'attributes':_0x2a9555['attributes'],'include':_0x2a9555[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x2a9555['include'],function(_0x37df66){return{'model':db[_0x37df66[_0xe312('0x1a')]],'as':_0x37df66['as'],'attributes':_0x37df66[_0xe312('0x17')],'include':_0x37df66[_0xe312('0x19')]?_[_0xe312('0x1b')](_0x37df66[_0xe312('0x19')],function(_0x13e4bc){return{'model':db[_0x13e4bc[_0xe312('0x1a')]],'as':_0x13e4bc['as'],'attributes':_0x13e4bc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cdf5b){logger[_0xe312('0x9')](_0xe312('0x1d'),_0xea34f3);logger[_0xe312('0xb')](_0xe312('0x1d'),_0xea34f3,JSON[_0xe312('0xd')](_0x4cdf5b));_0x2834bc(_0x4cdf5b);})[_0xe312('0x1c')](function(_0x23286a){logger['error'](_0xe312('0x1d'),_0x23286a[_0xe312('0x11')],_0xea34f3);_0x230de3(_0x4eaa8e[_0xe312('0xe')](0x1f4,_0x23286a[_0xe312('0x11')]));});});}; \ No newline at end of file +var _0x8a69=['attributes','limit','include','map','model','stringify','ShowInterval','raw','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','error','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','Interval','options'];(function(_0x41c304,_0x44919c){var _0x213a3f=function(_0x144f4b){while(--_0x144f4b){_0x41c304['push'](_0x41c304['shift']());}};_0x213a3f(++_0x44919c);}(_0x8a69,0xa4));var _0x98a6=function(_0x1c69dc,_0x201b9d){_0x1c69dc=_0x1c69dc-0x0;var _0x25b238=_0x8a69[_0x1c69dc];return _0x25b238;};'use strict';var _=require(_0x98a6('0x0'));var util=require(_0x98a6('0x1'));var moment=require(_0x98a6('0x2'));var BPromise=require(_0x98a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98a6('0x5'));var logger=require(_0x98a6('0x6'))(_0x98a6('0x7'));var config=require(_0x98a6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98a6('0x9')][_0x98a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x192409,_0x3ad08c,_0xd7080d){return new BPromise(function(_0xe5b337,_0x9c3052){return client['request'](_0x192409,_0xd7080d)[_0x98a6('0xb')](function(_0x1de14e){logger['info']('Interval,\x20%s,\x20%s',_0x3ad08c,_0x98a6('0xc'));logger[_0x98a6('0xd')]('Interval,\x20%s,\x20%s,\x20%s',_0x3ad08c,_0x98a6('0xc'),JSON['stringify'](_0x1de14e));if(_0x1de14e['error']){if(_0x1de14e[_0x98a6('0xe')]['code']===0x1f4){logger['error'](_0x98a6('0xf'),_0x3ad08c,_0x1de14e[_0x98a6('0xe')][_0x98a6('0x10')]);return _0x9c3052(_0x1de14e[_0x98a6('0xe')][_0x98a6('0x10')]);}logger[_0x98a6('0xe')]('Interval,\x20%s,\x20%s',_0x3ad08c,_0x1de14e[_0x98a6('0xe')][_0x98a6('0x10')]);return _0xe5b337(_0x1de14e[_0x98a6('0xe')][_0x98a6('0x10')]);}else{logger['info'](_0x98a6('0xf'),_0x3ad08c,'request\x20sent');_0xe5b337(_0x1de14e[_0x98a6('0x11')][_0x98a6('0x10')]);}})[_0x98a6('0x12')](function(_0x234fa9){logger[_0x98a6('0xe')](_0x98a6('0xf'),_0x3ad08c,_0x234fa9);_0x9c3052(_0x234fa9);});});}exports[_0x98a6('0x13')]=function(_0x174a2b){var _0x39d493=this;return new Promise(function(_0x1b6599,_0x52baa2){return db[_0x98a6('0x14')]['findAll']({'raw':_0x174a2b['options']?_0x174a2b['options']['raw']===undefined?!![]:![]:!![],'where':_0x174a2b[_0x98a6('0x15')]?_0x174a2b['options']['where']||null:null,'attributes':_0x174a2b[_0x98a6('0x15')]?_0x174a2b['options'][_0x98a6('0x16')]||null:null,'limit':_0x174a2b[_0x98a6('0x15')]?_0x174a2b[_0x98a6('0x15')][_0x98a6('0x17')]||null:null,'include':_0x174a2b['options']?_0x174a2b[_0x98a6('0x15')][_0x98a6('0x18')]?_[_0x98a6('0x19')](_0x174a2b[_0x98a6('0x15')][_0x98a6('0x18')],function(_0x13e3b8){return{'model':db[_0x13e3b8[_0x98a6('0x1a')]],'as':_0x13e3b8['as'],'attributes':_0x13e3b8[_0x98a6('0x16')],'include':_0x13e3b8[_0x98a6('0x18')]?_[_0x98a6('0x19')](_0x13e3b8[_0x98a6('0x18')],function(_0x919cb9){return{'model':db[_0x919cb9[_0x98a6('0x1a')]],'as':_0x919cb9['as'],'attributes':_0x919cb9[_0x98a6('0x16')],'include':_0x919cb9[_0x98a6('0x18')]?_[_0x98a6('0x19')](_0x919cb9[_0x98a6('0x18')],function(_0x30c11b){return{'model':db[_0x30c11b[_0x98a6('0x1a')]],'as':_0x30c11b['as'],'attributes':_0x30c11b[_0x98a6('0x16')]};}):[]};}):[]};}):[]:[]})[_0x98a6('0xb')](function(_0x1e5fee){logger['info'](_0x98a6('0x13'),_0x174a2b);logger[_0x98a6('0xd')](_0x98a6('0x13'),_0x174a2b,JSON[_0x98a6('0x1b')](_0x1e5fee));_0x1b6599(_0x1e5fee);})[_0x98a6('0x12')](function(_0x1865a7){logger['error'](_0x98a6('0x13'),_0x1865a7[_0x98a6('0x10')],_0x174a2b);_0x52baa2(_0x39d493[_0x98a6('0xe')](0x1f4,_0x1865a7[_0x98a6('0x10')]));});});};exports[_0x98a6('0x1c')]=function(_0x2049b4){var _0x5e5875=this;return new Promise(function(_0x1889fd,_0x177ad9){return db[_0x98a6('0x14')]['find']({'raw':_0x2049b4[_0x98a6('0x15')]?_0x2049b4[_0x98a6('0x15')][_0x98a6('0x1d')]===undefined?!![]:![]:!![],'where':_0x2049b4['options']?_0x2049b4[_0x98a6('0x15')][_0x98a6('0x1e')]||null:null,'attributes':_0x2049b4['options']?_0x2049b4[_0x98a6('0x15')]['attributes']||null:null,'include':_0x2049b4[_0x98a6('0x15')]?_0x2049b4[_0x98a6('0x15')][_0x98a6('0x18')]?_[_0x98a6('0x19')](_0x2049b4[_0x98a6('0x15')][_0x98a6('0x18')],function(_0x3c5abf){return{'model':db[_0x3c5abf[_0x98a6('0x1a')]],'as':_0x3c5abf['as'],'attributes':_0x3c5abf[_0x98a6('0x16')],'include':_0x3c5abf['include']?_[_0x98a6('0x19')](_0x3c5abf[_0x98a6('0x18')],function(_0x3ef908){return{'model':db[_0x3ef908[_0x98a6('0x1a')]],'as':_0x3ef908['as'],'attributes':_0x3ef908[_0x98a6('0x16')],'include':_0x3ef908[_0x98a6('0x18')]?_[_0x98a6('0x19')](_0x3ef908[_0x98a6('0x18')],function(_0x58bd00){return{'model':db[_0x58bd00['model']],'as':_0x58bd00['as'],'attributes':_0x58bd00['attributes']};}):[]};}):[]};}):[]:[]})[_0x98a6('0xb')](function(_0x135e9b){logger['info'](_0x98a6('0x1c'),_0x2049b4);logger[_0x98a6('0xd')](_0x98a6('0x1c'),_0x2049b4,JSON[_0x98a6('0x1b')](_0x135e9b));_0x1889fd(_0x135e9b);})['catch'](function(_0x370c49){logger[_0x98a6('0xe')](_0x98a6('0x1c'),_0x370c49[_0x98a6('0x10')],_0x2049b4);_0x177ad9(_0x5e5875[_0x98a6('0xe')](0x1f4,_0x370c49[_0x98a6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 7213bb6..41f0337 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 _0x0609=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','express'];(function(_0x44e279,_0xbb5db0){var _0x35c0ab=function(_0x3c5218){while(--_0x3c5218){_0x44e279['push'](_0x44e279['shift']());}};_0x35c0ab(++_0xbb5db0);}(_0x0609,0x187));var _0x9060=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0609[_0x53ccf2];return _0x5a2964;};'use strict';var express=require(_0x9060('0x0'));var router=express[_0x9060('0x1')]();var auth=require(_0x9060('0x2'));var controller=require(_0x9060('0x3'));router[_0x9060('0x4')]('/',auth[_0x9060('0x5')](),controller[_0x9060('0x6')]);module['exports']=router; \ No newline at end of file +var _0x69e0=['isAuthenticated','send','exports','express','./jira.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69e0,0x71));var _0x069e=function(_0x221424,_0x5eb364){_0x221424=_0x221424-0x0;var _0x401094=_0x69e0[_0x221424];return _0x401094;};'use strict';var express=require(_0x069e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x069e('0x1'));router['post']('/',auth[_0x069e('0x2')](),controller[_0x069e('0x3')]);module[_0x069e('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 71ed2b7..46a97b3 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 _0xc701=['api.jira','write','body','headers','x-forwarded-for','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','summary','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x200ebe,_0x43e591){var _0x3249b6=function(_0x286e4b){while(--_0x286e4b){_0x200ebe['push'](_0x200ebe['shift']());}};_0x3249b6(++_0x43e591);}(_0xc701,0x82));var _0x1c70=function(_0x485865,_0x11d29a){_0x485865=_0x485865-0x0;var _0x11ef06=_0xc701[_0x485865];return _0x11ef06;};'use strict';var BPromise=require(_0x1c70('0x0'));var https=require(_0x1c70('0x1'));var logger=require(_0x1c70('0x2'))(_0x1c70('0x3'));var USERNAME=_0x1c70('0x4');var PASSWORD=_0x1c70('0x5');function openIssue(_0x30a02f,_0x3af13f){var _0xab0089={'fields':{'project':{'key':_0x30a02f[_0x1c70('0x6')]||'MOTGUI'},'summary':(_0x30a02f[_0x1c70('0x7')]||'Report')+_0x1c70('0x8')+_0x30a02f['ip'],'description':_0x30a02f[_0x1c70('0x9')]||JSON[_0x1c70('0xa')](_0x30a02f),'issuetype':{'name':_0x30a02f['issuetype']||_0x1c70('0xb')}}};_0xab0089['fields'][_0x1c70('0xc')]=_0x30a02f[_0x1c70('0xd')];_0xab0089[_0x1c70('0xe')][_0x1c70('0xf')]=_0x30a02f[_0x1c70('0x10')];_0xab0089['fields']['customfield_11502']=_0x30a02f[_0x1c70('0x11')];_0xab0089[_0x1c70('0xe')][_0x1c70('0x12')]=_0x30a02f[_0x1c70('0x13')];_0xab0089['fields']['customfield_11504']=_0x30a02f['reason'];_0xab0089[_0x1c70('0xe')][_0x1c70('0x14')]=_0x30a02f['ip'];var _0x2eef35={'host':_0x1c70('0x15'),'port':0x1bb,'path':_0x1c70('0x16'),'method':_0x1c70('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1c70('0x18'),'Authorization':_0x1c70('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1c70('0x1a')](_0x1c70('0x1b'))}};var _0xee91d=JSON['stringify'](_0xab0089);var _0x1c9278=https['request'](_0x2eef35,function(_0x52ee54){_0x52ee54[_0x1c70('0x1c')]('utf8');var _0x300e30='';_0x52ee54['on']('data',function(_0x1424ee){_0x300e30+=_0x1424ee;});_0x52ee54['on'](_0x1c70('0x1d'),function(){if(_0x3af13f){return _0x3af13f[_0x1c70('0x1e')](_0x52ee54['statusCode'])[_0x1c70('0x1f')](JSON['parse'](_0x300e30));}});});_0x1c9278['on'](_0x1c70('0x20'),function(_0x60e98c){if(_0x3af13f){return _0x3af13f[_0x1c70('0x1e')](0x1f4)[_0x1c70('0x1f')]({'errors':[{'message':_0x1c70('0x21'),'type':_0x1c70('0x22')}]});}});_0x1c9278[_0x1c70('0x23')](_0xee91d);_0x1c9278[_0x1c70('0x1d')]();}exports['openIssue']=openIssue;exports['send']=function(_0x5217f3,_0x15b290){_0x5217f3[_0x1c70('0x24')]['ip']=_0x5217f3[_0x1c70('0x25')][_0x1c70('0x26')]||_0x5217f3['connection'][_0x1c70('0x27')]||_0x5217f3['socket'][_0x1c70('0x27')]||_0x5217f3['connection'][_0x1c70('0x28')]['remoteAddress'];return openIssue(_0x5217f3[_0x1c70('0x24')],_0x15b290);}; \ No newline at end of file +var _0x55fd=['newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','customfield_11500','email','fields','customfield_11501'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x55fd,0x7f));var _0xd55f=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x55fd[_0x12d033];return _0x3b4e80;};'use strict';var BPromise=require(_0xd55f('0x0'));var https=require(_0xd55f('0x1'));var logger=require(_0xd55f('0x2'))(_0xd55f('0x3'));var USERNAME=_0xd55f('0x4');var PASSWORD=_0xd55f('0x5');function openIssue(_0x1fe1f2,_0x383fc2){var _0x162d7b={'fields':{'project':{'key':_0x1fe1f2[_0xd55f('0x6')]||_0xd55f('0x7')},'summary':(_0x1fe1f2[_0xd55f('0x8')]||_0xd55f('0x9'))+_0xd55f('0xa')+_0x1fe1f2['ip'],'description':_0x1fe1f2[_0xd55f('0xb')]||JSON['stringify'](_0x1fe1f2),'issuetype':{'name':_0x1fe1f2[_0xd55f('0xc')]||'Bug'}}};_0x162d7b['fields'][_0xd55f('0xd')]=_0x1fe1f2[_0xd55f('0xe')];_0x162d7b[_0xd55f('0xf')][_0xd55f('0x10')]=_0x1fe1f2['oldToken'];_0x162d7b['fields']['customfield_11502']=_0x1fe1f2[_0xd55f('0x11')];_0x162d7b[_0xd55f('0xf')][_0xd55f('0x12')]=_0x1fe1f2[_0xd55f('0x13')];_0x162d7b['fields'][_0xd55f('0x14')]=_0x1fe1f2[_0xd55f('0x15')];_0x162d7b['fields'][_0xd55f('0x16')]=_0x1fe1f2['ip'];var _0x568a25={'host':_0xd55f('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xd55f('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xd55f('0x19'),'Authorization':_0xd55f('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xd55f('0x1b')](_0xd55f('0x1c'))}};var _0x214c4c=JSON[_0xd55f('0x1d')](_0x162d7b);var _0x98bf34=https[_0xd55f('0x1e')](_0x568a25,function(_0x35e0f4){_0x35e0f4[_0xd55f('0x1f')](_0xd55f('0x20'));var _0x495746='';_0x35e0f4['on'](_0xd55f('0x21'),function(_0x387e9e){_0x495746+=_0x387e9e;});_0x35e0f4['on'](_0xd55f('0x22'),function(){if(_0x383fc2){return _0x383fc2[_0xd55f('0x23')](_0x35e0f4[_0xd55f('0x24')])['json'](JSON[_0xd55f('0x25')](_0x495746));}});});_0x98bf34['on'](_0xd55f('0x26'),function(_0x17cabf){if(_0x383fc2){return _0x383fc2['status'](0x1f4)[_0xd55f('0x27')]({'errors':[{'message':_0xd55f('0x28'),'type':'api.jira'}]});}});_0x98bf34['write'](_0x214c4c);_0x98bf34[_0xd55f('0x22')]();}exports[_0xd55f('0x29')]=openIssue;exports[_0xd55f('0x2a')]=function(_0x691fa8,_0x3ff024){_0x691fa8[_0xd55f('0x2b')]['ip']=_0x691fa8['headers'][_0xd55f('0x2c')]||_0x691fa8[_0xd55f('0x2d')][_0xd55f('0x2e')]||_0x691fa8[_0xd55f('0x2f')][_0xd55f('0x2e')]||_0x691fa8[_0xd55f('0x2d')][_0xd55f('0x2f')]['remoteAddress'];return openIssue(_0x691fa8[_0xd55f('0x2b')],_0x3ff024);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 92fdf54..b91e85a 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 _0x5279=['delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','show','post','create','put','update'];(function(_0xdf636a,_0x29562a){var _0x3f9204=function(_0x331616){while(--_0x331616){_0xdf636a['push'](_0xdf636a['shift']());}};_0x3f9204(++_0x29562a);}(_0x5279,0xb6));var _0x9527=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0x5279[_0x1030ce];return _0x3367fd;};'use strict';var multer=require('multer');var util=require(_0x9527('0x0'));var path=require(_0x9527('0x1'));var timeout=require(_0x9527('0x2'));var express=require(_0x9527('0x3'));var router=express['Router']();var auth=require(_0x9527('0x4'));var interaction=require(_0x9527('0x5'));var config=require(_0x9527('0x6'));var controller=require(_0x9527('0x7'));router[_0x9527('0x8')]('/',auth[_0x9527('0x9')](),controller[_0x9527('0xa')]);router[_0x9527('0x8')]('/describe',auth[_0x9527('0x9')](),controller['describe']);router[_0x9527('0x8')]('/:id',auth[_0x9527('0x9')](),controller[_0x9527('0xb')]);router[_0x9527('0xc')]('/',auth[_0x9527('0x9')](),controller[_0x9527('0xd')]);router[_0x9527('0xe')]('/:id',auth[_0x9527('0x9')](),controller[_0x9527('0xf')]);router[_0x9527('0x10')]('/:id',auth[_0x9527('0x9')](),controller['destroy']);module[_0x9527('0x11')]=router; \ No newline at end of file +var _0x4e33=['exports','path','connect-timeout','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','show','post','create','put','delete','/:id','destroy'];(function(_0x3eb230,_0x537e1a){var _0x1fb503=function(_0x154b40){while(--_0x154b40){_0x3eb230['push'](_0x3eb230['shift']());}};_0x1fb503(++_0x537e1a);}(_0x4e33,0xb1));var _0x34e3=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x4e33[_0x35d8af];return _0x1d08b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x34e3('0x0'));var timeout=require(_0x34e3('0x1'));var express=require('express');var router=express[_0x34e3('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x34e3('0x3'));var config=require('../../config/environment');var controller=require(_0x34e3('0x4'));router[_0x34e3('0x5')]('/',auth[_0x34e3('0x6')](),controller['index']);router[_0x34e3('0x5')](_0x34e3('0x7'),auth[_0x34e3('0x6')](),controller['describe']);router['get']('/:id',auth[_0x34e3('0x6')](),controller[_0x34e3('0x8')]);router[_0x34e3('0x9')]('/',auth[_0x34e3('0x6')](),controller[_0x34e3('0xa')]);router[_0x34e3('0xb')]('/:id',auth[_0x34e3('0x6')](),controller['update']);router[_0x34e3('0xc')](_0x34e3('0xd'),auth[_0x34e3('0x6')](),controller[_0x34e3('0xe')]);module[_0x34e3('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 8f0e50e..e314c83 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 _0xf68d=['STRING','TEXT','long','sequelize','exports'];(function(_0x2943da,_0x312c9e){var _0x177bb4=function(_0x1be998){while(--_0x1be998){_0x2943da['push'](_0x2943da['shift']());}};_0x177bb4(++_0x312c9e);}(_0xf68d,0x1e8));var _0xdf68=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf68d[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0xdf68('0x0'));module[_0xdf68('0x1')]={'question':{'type':Sequelize[_0xdf68('0x2')]},'answer':{'type':Sequelize[_0xdf68('0x3')](_0xdf68('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdf68('0x2')]},'uniqueid':{'type':Sequelize[_0xdf68('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdf68('0x2')]},'questionId':{'type':Sequelize[_0xdf68('0x2')]}}; \ No newline at end of file +var _0xc01c=['STRING','TEXT','sequelize','exports'];(function(_0x1f136f,_0x3283a9){var _0x209117=function(_0x24da21){while(--_0x24da21){_0x1f136f['push'](_0x1f136f['shift']());}};_0x209117(++_0x3283a9);}(_0xc01c,0xfa));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcc01('0x0'));module[_0xcc01('0x1')]={'question':{'type':Sequelize[_0xcc01('0x2')]},'answer':{'type':Sequelize[_0xcc01('0x3')]('long')},'membername':{'type':Sequelize[_0xcc01('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xcc01('0x2')]},'calleridname':{'type':Sequelize[_0xcc01('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xcc01('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 8fcc321..567feab 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 _0x6d9b=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','limit','sort','where','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','keys','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','path','to-csv','ejs','lodash'];(function(_0x55cddd,_0x106d53){var _0xc8a549=function(_0x6a33af){while(--_0x6a33af){_0x55cddd['push'](_0x55cddd['shift']());}};_0xc8a549(++_0x106d53);}(_0x6d9b,0x1d2));var _0xb6d9=function(_0x57d87e,_0x42a175){_0x57d87e=_0x57d87e-0x0;var _0x49bd31=_0x6d9b[_0x57d87e];return _0x49bd31;};'use strict';var pdf=require(_0xb6d9('0x0'));var emlformat=require(_0xb6d9('0x1'));var rimraf=require(_0xb6d9('0x2'));var zipdir=require(_0xb6d9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d9('0x4'));var moment=require(_0xb6d9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb6d9('0x6'));var sox=require('sox');var csv=require(_0xb6d9('0x7'));var ejs=require(_0xb6d9('0x8'));var fs=require('fs');var _=require(_0xb6d9('0x9'));var squel=require('squel');var crypto=require(_0xb6d9('0xa'));var jsforce=require(_0xb6d9('0xb'));var deskjs=require(_0xb6d9('0xc'));var toCsv=require(_0xb6d9('0x7'));var querystring=require(_0xb6d9('0xd'));var Papa=require(_0xb6d9('0xe'));var Redis=require('ioredis');var authService=require(_0xb6d9('0xf'));var qs=require(_0xb6d9('0x10'));var as=require(_0xb6d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb6d9('0x12'))('api');var utils=require(_0xb6d9('0x13'));var config=require(_0xb6d9('0x14'));var db=require(_0xb6d9('0x15'))['db'];function respondWithStatusCode(_0x443108,_0x238ced){_0x238ced=_0x238ced||0xcc;return function(_0x18135e){if(_0x18135e){return _0x443108[_0xb6d9('0x16')](_0x238ced);}return _0x443108[_0xb6d9('0x17')](_0x238ced)[_0xb6d9('0x18')]();};}function respondWithResult(_0x543143,_0x5ceeb1){_0x5ceeb1=_0x5ceeb1||0xc8;return function(_0x2625f0){if(_0x2625f0){return _0x543143[_0xb6d9('0x17')](_0x5ceeb1)[_0xb6d9('0x19')](_0x2625f0);}};}function respondWithFilteredResult(_0x5c4873,_0x3ed4ec){return function(_0x25247d){if(_0x25247d){var _0x54b580=_0x25247d[_0xb6d9('0x1a')],_0x2a5152=_0x3ed4ec[_0xb6d9('0x1b')],_0x38c060=_0x3ed4ec[_0xb6d9('0x1b')]+_0x3ed4ec['limit'],_0x58b878;if(_0x38c060>=_0x54b580){_0x38c060=_0x54b580;_0x58b878=0xc8;}else{_0x58b878=0xce;}_0x5c4873[_0xb6d9('0x17')](_0x58b878);return _0x5c4873[_0xb6d9('0x1c')](_0xb6d9('0x1d'),_0x2a5152+'-'+_0x38c060+'/'+_0x54b580)[_0xb6d9('0x19')](_0x25247d);}return null;};}function patchUpdates(_0x1e6a10){return function(_0x178d78){try{jsonpatch[_0xb6d9('0x1e')](_0x178d78,_0x1e6a10,!![]);}catch(_0x51f6e5){return BPromise[_0xb6d9('0x1f')](_0x51f6e5);}return _0x178d78[_0xb6d9('0x20')]();};}function saveUpdates(_0x4ccc0f,_0x115be7){return function(_0x14ce49){if(_0x14ce49){return _0x14ce49['update'](_0x4ccc0f)['then'](function(_0x441cae){return _0x441cae;});}return null;};}function removeEntity(_0x2d7e6e,_0x473280){return function(_0x2cc44b){if(_0x2cc44b){return _0x2cc44b['destroy']()['then'](function(){_0x2d7e6e[_0xb6d9('0x17')](0xcc)[_0xb6d9('0x18')]();});}};}function handleEntityNotFound(_0x3d3476,_0x37ae9d){return function(_0x2b6360){if(!_0x2b6360){_0x3d3476[_0xb6d9('0x16')](0x194);}return _0x2b6360;};}function handleError(_0x5aaa9e,_0x4c99af){_0x4c99af=_0x4c99af||0x1f4;return function(_0x4cee76){logger[_0xb6d9('0x21')](_0x4cee76['stack']);if(_0x4cee76[_0xb6d9('0x22')]){delete _0x4cee76['name'];}_0x5aaa9e['status'](_0x4c99af)[_0xb6d9('0x23')](_0x4cee76);};}exports['index']=function(_0x3fa2a0,_0x3b954f){var _0x4b7d39={},_0x26a4a3={},_0x240980={'count':0x0,'rows':[]};var _0x177bc4=_[_0xb6d9('0x24')](db[_0xb6d9('0x25')][_0xb6d9('0x26')],function(_0x1462f4){return{'name':_0x1462f4[_0xb6d9('0x27')],'type':_0x1462f4['type'][_0xb6d9('0x28')]};});_0x26a4a3['model']=_[_0xb6d9('0x24')](_0x177bc4,'name');_0x26a4a3[_0xb6d9('0x29')]=_['keys'](_0x3fa2a0[_0xb6d9('0x29')]);_0x26a4a3[_0xb6d9('0x2a')]=_[_0xb6d9('0x2b')](_0x26a4a3[_0xb6d9('0x2c')],_0x26a4a3['query']);_0x4b7d39[_0xb6d9('0x2d')]=_[_0xb6d9('0x2b')](_0x26a4a3[_0xb6d9('0x2c')],qs[_0xb6d9('0x2e')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x2e')]));_0x4b7d39[_0xb6d9('0x2d')]=_0x4b7d39[_0xb6d9('0x2d')][_0xb6d9('0x2f')]?_0x4b7d39[_0xb6d9('0x2d')]:_0x26a4a3['model'];if(!_0x3fa2a0['query']['hasOwnProperty']('nolimit')){_0x4b7d39['limit']=qs[_0xb6d9('0x30')](_0x3fa2a0[_0xb6d9('0x29')]['limit']);_0x4b7d39[_0xb6d9('0x1b')]=qs[_0xb6d9('0x1b')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x1b')]);}_0x4b7d39['order']=qs[_0xb6d9('0x31')](_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x31')]);_0x4b7d39[_0xb6d9('0x32')]=qs[_0xb6d9('0x2a')](_['pick'](_0x3fa2a0['query'],_0x26a4a3['filters']),_0x177bc4);if(_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x33')]){_0x4b7d39[_0xb6d9('0x32')]=_['merge'](_0x4b7d39['where'],{'$or':_['map'](_0x177bc4,function(_0x4d42b6){if(_0x4d42b6['type']!==_0xb6d9('0x34')){var _0x4f884a={};_0x4f884a[_0x4d42b6['name']]={'$like':'%'+_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x33')]+'%'};return _0x4f884a;}})});}_0x4b7d39=_[_0xb6d9('0x35')]({},_0x4b7d39,_0x3fa2a0[_0xb6d9('0x36')]);var _0x2ca419={'where':_0x4b7d39[_0xb6d9('0x32')]};return db[_0xb6d9('0x25')]['count'](_0x2ca419)[_0xb6d9('0x37')](function(_0x3b042c){_0x240980['count']=_0x3b042c;if(_0x3fa2a0[_0xb6d9('0x29')][_0xb6d9('0x38')]){_0x4b7d39[_0xb6d9('0x39')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb6d9('0x3a')](_0x4b7d39);})['then'](function(_0x53c3a6){_0x240980[_0xb6d9('0x3b')]=_0x53c3a6;return _0x240980;})[_0xb6d9('0x37')](respondWithFilteredResult(_0x3b954f,_0x4b7d39))[_0xb6d9('0x3c')](handleError(_0x3b954f,null));};exports[_0xb6d9('0x3d')]=function(_0x579bc1,_0x48e053){var _0x14537d={'raw':!![],'where':{'id':_0x579bc1[_0xb6d9('0x3e')]['id']}},_0x2e1538={};_0x2e1538['model']=_['keys'](db[_0xb6d9('0x25')]['rawAttributes']);_0x2e1538[_0xb6d9('0x29')]=_[_0xb6d9('0x3f')](_0x579bc1[_0xb6d9('0x29')]);_0x2e1538['filters']=_[_0xb6d9('0x2b')](_0x2e1538[_0xb6d9('0x2c')],_0x2e1538[_0xb6d9('0x29')]);_0x14537d[_0xb6d9('0x2d')]=_[_0xb6d9('0x2b')](_0x2e1538[_0xb6d9('0x2c')],qs[_0xb6d9('0x2e')](_0x579bc1[_0xb6d9('0x29')][_0xb6d9('0x2e')]));_0x14537d[_0xb6d9('0x2d')]=_0x14537d[_0xb6d9('0x2d')][_0xb6d9('0x2f')]?_0x14537d['attributes']:_0x2e1538[_0xb6d9('0x2c')];if(_0x579bc1[_0xb6d9('0x29')][_0xb6d9('0x38')]){_0x14537d[_0xb6d9('0x39')]=[{'all':!![]}];}_0x14537d=_[_0xb6d9('0x35')]({},_0x14537d,_0x579bc1[_0xb6d9('0x36')]);return db[_0xb6d9('0x25')]['find'](_0x14537d)[_0xb6d9('0x37')](handleEntityNotFound(_0x48e053,null))[_0xb6d9('0x37')](respondWithResult(_0x48e053,null))[_0xb6d9('0x3c')](handleError(_0x48e053,null));};exports['create']=function(_0x2a11e0,_0x4cfbb7){return db['JscriptyAnswerReport']['create'](_0x2a11e0[_0xb6d9('0x40')],{})[_0xb6d9('0x37')](respondWithResult(_0x4cfbb7,0xc9))[_0xb6d9('0x3c')](handleError(_0x4cfbb7,null));};exports['update']=function(_0x3d9141,_0x4b20b7){if(_0x3d9141['body']['id']){delete _0x3d9141['body']['id'];}return db['JscriptyAnswerReport'][_0xb6d9('0x41')]({'where':{'id':_0x3d9141[_0xb6d9('0x3e')]['id']}})[_0xb6d9('0x37')](handleEntityNotFound(_0x4b20b7,null))[_0xb6d9('0x37')](saveUpdates(_0x3d9141[_0xb6d9('0x40')],null))[_0xb6d9('0x37')](respondWithResult(_0x4b20b7,null))[_0xb6d9('0x3c')](handleError(_0x4b20b7,null));};exports[_0xb6d9('0x42')]=function(_0x5917a8,_0x389f97){return db[_0xb6d9('0x25')]['find']({'where':{'id':_0x5917a8['params']['id']}})[_0xb6d9('0x37')](handleEntityNotFound(_0x389f97,null))[_0xb6d9('0x37')](removeEntity(_0x389f97,null))[_0xb6d9('0x3c')](handleError(_0x389f97,null));};exports['describe']=function(_0x38c5f7,_0x3f072f){return db[_0xb6d9('0x25')][_0xb6d9('0x43')]()[_0xb6d9('0x37')](respondWithResult(_0x3f072f,null))[_0xb6d9('0x3c')](handleError(_0x3f072f,null));}; \ No newline at end of file +var _0x7607=['include','options','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','map','count','includeAll','rows','catch','show','params','rawAttributes'];(function(_0x22b4ce,_0x2fa1c2){var _0x18d8d6=function(_0x42cc7f){while(--_0x42cc7f){_0x22b4ce['push'](_0x22b4ce['shift']());}};_0x18d8d6(++_0x2fa1c2);}(_0x7607,0x182));var _0x7760=function(_0xd12ce8,_0xa6320e){_0xd12ce8=_0xd12ce8-0x0;var _0x58c135=_0x7607[_0xd12ce8];return _0x58c135;};'use strict';var pdf=require(_0x7760('0x0'));var emlformat=require(_0x7760('0x1'));var rimraf=require(_0x7760('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7760('0x3'));var rp=require(_0x7760('0x4'));var moment=require(_0x7760('0x5'));var BPromise=require(_0x7760('0x6'));var Mustache=require(_0x7760('0x7'));var util=require(_0x7760('0x8'));var path=require(_0x7760('0x9'));var sox=require(_0x7760('0xa'));var csv=require('to-csv');var ejs=require(_0x7760('0xb'));var fs=require('fs');var _=require(_0x7760('0xc'));var squel=require(_0x7760('0xd'));var crypto=require(_0x7760('0xe'));var jsforce=require(_0x7760('0xf'));var deskjs=require(_0x7760('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7760('0x11'));var Redis=require('ioredis');var authService=require(_0x7760('0x12'));var qs=require(_0x7760('0x13'));var as=require(_0x7760('0x14'));var hardwareService=require(_0x7760('0x15'));var logger=require(_0x7760('0x16'))(_0x7760('0x17'));var utils=require('../../config/utils');var config=require(_0x7760('0x18'));var db=require(_0x7760('0x19'))['db'];function respondWithStatusCode(_0x4f1143,_0x5ab91e){_0x5ab91e=_0x5ab91e||0xcc;return function(_0x3a2f5e){if(_0x3a2f5e){return _0x4f1143[_0x7760('0x1a')](_0x5ab91e);}return _0x4f1143['status'](_0x5ab91e)[_0x7760('0x1b')]();};}function respondWithResult(_0x45f64a,_0x3886fb){_0x3886fb=_0x3886fb||0xc8;return function(_0xcaf3d5){if(_0xcaf3d5){return _0x45f64a[_0x7760('0x1c')](_0x3886fb)[_0x7760('0x1d')](_0xcaf3d5);}};}function respondWithFilteredResult(_0x463a71,_0x141738){return function(_0x3a3569){if(_0x3a3569){var _0x2bd5c8=_0x3a3569['count'],_0x346bd0=_0x141738[_0x7760('0x1e')],_0x11c2ad=_0x141738[_0x7760('0x1e')]+_0x141738[_0x7760('0x1f')],_0x477d12;if(_0x11c2ad>=_0x2bd5c8){_0x11c2ad=_0x2bd5c8;_0x477d12=0xc8;}else{_0x477d12=0xce;}_0x463a71[_0x7760('0x1c')](_0x477d12);return _0x463a71[_0x7760('0x20')](_0x7760('0x21'),_0x346bd0+'-'+_0x11c2ad+'/'+_0x2bd5c8)[_0x7760('0x1d')](_0x3a3569);}return null;};}function patchUpdates(_0x4f7b37){return function(_0x2e25ae){try{jsonpatch['apply'](_0x2e25ae,_0x4f7b37,!![]);}catch(_0x43b203){return BPromise[_0x7760('0x22')](_0x43b203);}return _0x2e25ae[_0x7760('0x23')]();};}function saveUpdates(_0xea109d,_0x5da0d2){return function(_0x2e5df6){if(_0x2e5df6){return _0x2e5df6[_0x7760('0x24')](_0xea109d)[_0x7760('0x25')](function(_0x4c5d0e){return _0x4c5d0e;});}return null;};}function removeEntity(_0x455f8e,_0x456762){return function(_0x47ff92){if(_0x47ff92){return _0x47ff92[_0x7760('0x26')]()[_0x7760('0x25')](function(){_0x455f8e['status'](0xcc)[_0x7760('0x1b')]();});}};}function handleEntityNotFound(_0x281642,_0x11161c){return function(_0x531a68){if(!_0x531a68){_0x281642['sendStatus'](0x194);}return _0x531a68;};}function handleError(_0x22098a,_0x12124a){_0x12124a=_0x12124a||0x1f4;return function(_0x439d18){logger[_0x7760('0x27')](_0x439d18[_0x7760('0x28')]);if(_0x439d18[_0x7760('0x29')]){delete _0x439d18[_0x7760('0x29')];}_0x22098a[_0x7760('0x1c')](_0x12124a)[_0x7760('0x2a')](_0x439d18);};}exports[_0x7760('0x2b')]=function(_0x3d63cc,_0x2e8f1d){var _0x5e0d35={},_0x22f968={},_0x119b81={'count':0x0,'rows':[]};var _0x35df50=_['map'](db[_0x7760('0x2c')]['rawAttributes'],function(_0x2b4174){return{'name':_0x2b4174[_0x7760('0x2d')],'type':_0x2b4174[_0x7760('0x2e')][_0x7760('0x2f')]};});_0x22f968[_0x7760('0x30')]=_['map'](_0x35df50,_0x7760('0x29'));_0x22f968['query']=_[_0x7760('0x31')](_0x3d63cc[_0x7760('0x32')]);_0x22f968[_0x7760('0x33')]=_['intersection'](_0x22f968[_0x7760('0x30')],_0x22f968[_0x7760('0x32')]);_0x5e0d35[_0x7760('0x34')]=_[_0x7760('0x35')](_0x22f968[_0x7760('0x30')],qs[_0x7760('0x36')](_0x3d63cc[_0x7760('0x32')]['fields']));_0x5e0d35[_0x7760('0x34')]=_0x5e0d35[_0x7760('0x34')][_0x7760('0x37')]?_0x5e0d35[_0x7760('0x34')]:_0x22f968['model'];if(!_0x3d63cc[_0x7760('0x32')]['hasOwnProperty'](_0x7760('0x38'))){_0x5e0d35['limit']=qs[_0x7760('0x1f')](_0x3d63cc[_0x7760('0x32')][_0x7760('0x1f')]);_0x5e0d35['offset']=qs[_0x7760('0x1e')](_0x3d63cc[_0x7760('0x32')][_0x7760('0x1e')]);}_0x5e0d35['order']=qs[_0x7760('0x39')](_0x3d63cc[_0x7760('0x32')][_0x7760('0x39')]);_0x5e0d35[_0x7760('0x3a')]=qs['filters'](_[_0x7760('0x3b')](_0x3d63cc['query'],_0x22f968[_0x7760('0x33')]),_0x35df50);if(_0x3d63cc[_0x7760('0x32')][_0x7760('0x3c')]){_0x5e0d35[_0x7760('0x3a')]=_[_0x7760('0x3d')](_0x5e0d35[_0x7760('0x3a')],{'$or':_[_0x7760('0x3e')](_0x35df50,function(_0x323da2){if(_0x323da2['type']!=='VIRTUAL'){var _0x3039d3={};_0x3039d3[_0x323da2[_0x7760('0x29')]]={'$like':'%'+_0x3d63cc[_0x7760('0x32')]['filter']+'%'};return _0x3039d3;}})});}_0x5e0d35=_[_0x7760('0x3d')]({},_0x5e0d35,_0x3d63cc['options']);var _0x1e71a4={'where':_0x5e0d35[_0x7760('0x3a')]};return db[_0x7760('0x2c')][_0x7760('0x3f')](_0x1e71a4)['then'](function(_0x3239c8){_0x119b81['count']=_0x3239c8;if(_0x3d63cc[_0x7760('0x32')][_0x7760('0x40')]){_0x5e0d35['include']=[{'all':!![]}];}return db[_0x7760('0x2c')]['findAll'](_0x5e0d35);})[_0x7760('0x25')](function(_0x1a732e){_0x119b81[_0x7760('0x41')]=_0x1a732e;return _0x119b81;})[_0x7760('0x25')](respondWithFilteredResult(_0x2e8f1d,_0x5e0d35))[_0x7760('0x42')](handleError(_0x2e8f1d,null));};exports[_0x7760('0x43')]=function(_0x1599db,_0x2a9eeb){var _0x2bb77a={'raw':!![],'where':{'id':_0x1599db[_0x7760('0x44')]['id']}},_0x22c13f={};_0x22c13f[_0x7760('0x30')]=_[_0x7760('0x31')](db[_0x7760('0x2c')][_0x7760('0x45')]);_0x22c13f[_0x7760('0x32')]=_[_0x7760('0x31')](_0x1599db[_0x7760('0x32')]);_0x22c13f[_0x7760('0x33')]=_['intersection'](_0x22c13f[_0x7760('0x30')],_0x22c13f['query']);_0x2bb77a[_0x7760('0x34')]=_['intersection'](_0x22c13f[_0x7760('0x30')],qs[_0x7760('0x36')](_0x1599db[_0x7760('0x32')][_0x7760('0x36')]));_0x2bb77a['attributes']=_0x2bb77a[_0x7760('0x34')][_0x7760('0x37')]?_0x2bb77a['attributes']:_0x22c13f[_0x7760('0x30')];if(_0x1599db['query'][_0x7760('0x40')]){_0x2bb77a[_0x7760('0x46')]=[{'all':!![]}];}_0x2bb77a=_[_0x7760('0x3d')]({},_0x2bb77a,_0x1599db[_0x7760('0x47')]);return db[_0x7760('0x2c')][_0x7760('0x48')](_0x2bb77a)[_0x7760('0x25')](handleEntityNotFound(_0x2a9eeb,null))['then'](respondWithResult(_0x2a9eeb,null))[_0x7760('0x42')](handleError(_0x2a9eeb,null));};exports[_0x7760('0x49')]=function(_0x25d981,_0xae0bad){return db[_0x7760('0x2c')][_0x7760('0x49')](_0x25d981[_0x7760('0x4a')],{})[_0x7760('0x25')](respondWithResult(_0xae0bad,0xc9))[_0x7760('0x42')](handleError(_0xae0bad,null));};exports[_0x7760('0x24')]=function(_0x6be377,_0x5de8fd){if(_0x6be377[_0x7760('0x4a')]['id']){delete _0x6be377['body']['id'];}return db[_0x7760('0x2c')]['find']({'where':{'id':_0x6be377['params']['id']}})[_0x7760('0x25')](handleEntityNotFound(_0x5de8fd,null))['then'](saveUpdates(_0x6be377['body'],null))['then'](respondWithResult(_0x5de8fd,null))[_0x7760('0x42')](handleError(_0x5de8fd,null));};exports[_0x7760('0x26')]=function(_0x2af478,_0x1bbba0){return db[_0x7760('0x2c')][_0x7760('0x48')]({'where':{'id':_0x2af478[_0x7760('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bbba0,null))['then'](removeEntity(_0x1bbba0,null))[_0x7760('0x42')](handleError(_0x1bbba0,null));};exports[_0x7760('0x4b')]=function(_0x18c9b7,_0x4a16db){return db['JscriptyAnswerReport'][_0x7760('0x4b')]()[_0x7760('0x25')](respondWithResult(_0x4a16db,null))[_0x7760('0x42')](handleError(_0x4a16db,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index b110816..5528abc 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 _0x08d1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0xd95979,_0x3b95a2){var _0x574da5=function(_0x3e6b41){while(--_0x3e6b41){_0xd95979['push'](_0xd95979['shift']());}};_0x574da5(++_0x3b95a2);}(_0x08d1,0x112));var _0x108d=function(_0x4a962c,_0x6e176f){_0x4a962c=_0x4a962c-0x0;var _0x1ba3f2=_0x08d1[_0x4a962c];return _0x1ba3f2;};'use strict';var _=require(_0x108d('0x0'));var util=require('util');var logger=require(_0x108d('0x1'))(_0x108d('0x2'));var moment=require(_0x108d('0x3'));var BPromise=require(_0x108d('0x4'));var rp=require(_0x108d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x108d('0x6'));var config=require('../../config/environment');var attributes=require(_0x108d('0x7'));module[_0x108d('0x8')]=function(_0x3089e5,_0x19174f){return _0x3089e5['define'](_0x108d('0x9'),attributes,{'tableName':_0x108d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0e3=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x17ba97,_0x249d04){var _0x1d99f3=function(_0x3818b8){while(--_0x3818b8){_0x17ba97['push'](_0x17ba97['shift']());}};_0x1d99f3(++_0x249d04);}(_0xe0e3,0x1a6));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0e('0x0'));var util=require('util');var logger=require(_0x3e0e('0x1'))(_0x3e0e('0x2'));var moment=require(_0x3e0e('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e0e('0x4'));var fs=require('fs');var path=require(_0x3e0e('0x5'));var rimraf=require(_0x3e0e('0x6'));var config=require(_0x3e0e('0x7'));var attributes=require(_0x3e0e('0x8'));module[_0x3e0e('0x9')]=function(_0xe381f3,_0x5e4ae5){return _0xe381f3[_0x3e0e('0xa')](_0x3e0e('0xb'),attributes,{'tableName':_0x3e0e('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 ddc834c..93bf345 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 _0x2e0b=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x2e0b,0x171));var _0xb2e0=function(_0x57784b,_0x49a858){_0x57784b=_0x57784b-0x0;var _0x4505fa=_0x2e0b[_0x57784b];return _0x4505fa;};'use strict';var _=require(_0xb2e0('0x0'));var util=require(_0xb2e0('0x1'));var moment=require(_0xb2e0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2e0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2e0('0x4'))(_0xb2e0('0x5'));var config=require(_0xb2e0('0x6'));var jayson=require(_0xb2e0('0x7'));var client=jayson[_0xb2e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47951b,_0x4628dc,_0x51d8b6){return new BPromise(function(_0x3088bf,_0x47cf80){return client[_0xb2e0('0x9')](_0x47951b,_0x51d8b6)[_0xb2e0('0xa')](function(_0x1043a6){logger[_0xb2e0('0xb')](_0xb2e0('0xc'),_0x4628dc,_0xb2e0('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x4628dc,_0xb2e0('0xd'),JSON[_0xb2e0('0xe')](_0x1043a6));if(_0x1043a6[_0xb2e0('0xf')]){if(_0x1043a6[_0xb2e0('0xf')]['code']===0x1f4){logger[_0xb2e0('0xf')](_0xb2e0('0xc'),_0x4628dc,_0x1043a6['error'][_0xb2e0('0x10')]);return _0x47cf80(_0x1043a6[_0xb2e0('0xf')][_0xb2e0('0x10')]);}logger[_0xb2e0('0xf')](_0xb2e0('0xc'),_0x4628dc,_0x1043a6['error'][_0xb2e0('0x10')]);return _0x3088bf(_0x1043a6[_0xb2e0('0xf')]['message']);}else{logger[_0xb2e0('0xb')](_0xb2e0('0xc'),_0x4628dc,_0xb2e0('0xd'));_0x3088bf(_0x1043a6[_0xb2e0('0x11')]['message']);}})[_0xb2e0('0x12')](function(_0x3965d7){logger[_0xb2e0('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4628dc,_0x3965d7);_0x47cf80(_0x3965d7);});});} \ No newline at end of file +var _0xe0cf=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0xe0cf,0x16f));var _0xfe0c=function(_0x333683,_0x2e51dc){_0x333683=_0x333683-0x0;var _0x570c76=_0xe0cf[_0x333683];return _0x570c76;};'use strict';var _=require('lodash');var util=require(_0xfe0c('0x0'));var moment=require(_0xfe0c('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe0c('0x2'));var fs=require('fs');var Redis=require(_0xfe0c('0x3'));var db=require(_0xfe0c('0x4'))['db'];var utils=require(_0xfe0c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfe0c('0x6'));var jayson=require(_0xfe0c('0x7'));var client=jayson[_0xfe0c('0x8')][_0xfe0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c44ed,_0xc31678,_0x57e34e){return new BPromise(function(_0x30ef3b,_0x190c81){return client[_0xfe0c('0xa')](_0x3c44ed,_0x57e34e)[_0xfe0c('0xb')](function(_0x4b5135){logger[_0xfe0c('0xc')](_0xfe0c('0xd'),_0xc31678,_0xfe0c('0xe'));logger[_0xfe0c('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xc31678,_0xfe0c('0xe'),JSON[_0xfe0c('0x10')](_0x4b5135));if(_0x4b5135[_0xfe0c('0x11')]){if(_0x4b5135['error'][_0xfe0c('0x12')]===0x1f4){logger[_0xfe0c('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xc31678,_0x4b5135[_0xfe0c('0x11')]['message']);return _0x190c81(_0x4b5135['error'][_0xfe0c('0x13')]);}logger[_0xfe0c('0x11')](_0xfe0c('0xd'),_0xc31678,_0x4b5135[_0xfe0c('0x11')][_0xfe0c('0x13')]);return _0x30ef3b(_0x4b5135[_0xfe0c('0x11')][_0xfe0c('0x13')]);}else{logger[_0xfe0c('0xc')](_0xfe0c('0xd'),_0xc31678,_0xfe0c('0xe'));_0x30ef3b(_0x4b5135[_0xfe0c('0x14')][_0xfe0c('0x13')]);}})[_0xfe0c('0x15')](function(_0x400f89){logger[_0xfe0c('0x11')](_0xfe0c('0xd'),_0xc31678,_0x400f89);_0x190c81(_0x400f89);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index acfe8f7..43af269 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 _0x0a1c=['show','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','destroy','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x0a1c[_0x139a3c];return _0x2b375b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc0a1('0x3'));var config=require(_0xc0a1('0x4'));var controller=require(_0xc0a1('0x5'));router[_0xc0a1('0x6')]('/',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x8')]);router[_0xc0a1('0x6')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xa')]);router[_0xc0a1('0x6')](_0xc0a1('0xb'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0xc')]);router[_0xc0a1('0x6')](_0xc0a1('0xd'),auth[_0xc0a1('0x7')](),controller['getAnswers']);router[_0xc0a1('0x6')](_0xc0a1('0xe'),auth[_0xc0a1('0x7')](),timeout('30s'),controller[_0xc0a1('0xf')]);router[_0xc0a1('0x10')]('/',auth[_0xc0a1('0x7')](),controller['create']);router[_0xc0a1('0x10')](_0xc0a1('0x11'),auth['isAuthenticated'](),controller[_0xc0a1('0x12')]);router[_0xc0a1('0x13')](_0xc0a1('0x9'),auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x14')]);router['delete']('/:id',auth[_0xc0a1('0x7')](),controller[_0xc0a1('0x15')]);module['exports']=router; \ No newline at end of file +var _0x60b7=['/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x60b7,0x1ef));var _0x760b=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x60b7[_0x175a55];return _0x167adf;};'use strict';var multer=require(_0x760b('0x0'));var util=require('util');var path=require(_0x760b('0x1'));var timeout=require(_0x760b('0x2'));var express=require(_0x760b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x760b('0x4'));var config=require(_0x760b('0x5'));var controller=require('./jscriptyProject.controller');router[_0x760b('0x6')]('/',auth[_0x760b('0x7')](),controller[_0x760b('0x8')]);router[_0x760b('0x6')]('/:id',auth[_0x760b('0x7')](),controller['show']);router[_0x760b('0x6')](_0x760b('0x9'),auth['isAuthenticated'](),controller[_0x760b('0xa')]);router[_0x760b('0x6')](_0x760b('0xb'),auth['isAuthenticated'](),controller[_0x760b('0xc')]);router['get'](_0x760b('0xd'),auth[_0x760b('0x7')](),timeout(_0x760b('0xe')),controller[_0x760b('0xf')]);router[_0x760b('0x10')]('/',auth[_0x760b('0x7')](),controller[_0x760b('0x11')]);router['post'](_0x760b('0x12'),auth[_0x760b('0x7')](),controller[_0x760b('0x13')]);router[_0x760b('0x14')]('/:id',auth[_0x760b('0x7')](),controller['update']);router['delete'](_0x760b('0x15'),auth[_0x760b('0x7')](),controller[_0x760b('0x16')]);module[_0x760b('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 8a2b964..2f1db78 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 _0xb8aa=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','getDataValue','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','isObjectLike','setDataValue'];(function(_0x260cf5,_0x405fcf){var _0x48c107=function(_0x270767){while(--_0x270767){_0x260cf5['push'](_0x260cf5['shift']());}};_0x48c107(++_0x405fcf);}(_0xb8aa,0x98));var _0xab8a=function(_0x4c2b49,_0x20a689){_0x4c2b49=_0x4c2b49-0x0;var _0x6df97a=_0xb8aa[_0x4c2b49];return _0x6df97a;};'use strict';var Sequelize=require(_0xab8a('0x0'));var _=require(_0xab8a('0x1'));var util=require(_0xab8a('0x2'));module['exports']={'name':{'type':Sequelize[_0xab8a('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xab8a('0x4')](_0xab8a('0x5')),'set':function(_0x374a02){if(_[_0xab8a('0x6')](_0x374a02)){this[_0xab8a('0x7')](_0xab8a('0x8'),JSON[_0xab8a('0x9')](_0x374a02));}else if(_[_0xab8a('0xa')](_0x374a02)){this[_0xab8a('0x7')](_0xab8a('0x8'),_0x374a02);}else{this[_0xab8a('0x7')](_0xab8a('0x8'),util[_0xab8a('0xb')](_0xab8a('0xc'),this['getDataValue'](_0xab8a('0xd'))||'',this[_0xab8a('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xab8a('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xab8a('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xb0ae=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util','STRING','name','TEXT','long','stringify','isString','setDataValue','formData'];(function(_0x150790,_0xedb860){var _0x4e90a7=function(_0x19ed06){while(--_0x19ed06){_0x150790['push'](_0x150790['shift']());}};_0x4e90a7(++_0xedb860);}(_0xb0ae,0x1f3));var _0xeb0a=function(_0x47982a,_0x287f48){_0x47982a=_0x47982a-0x0;var _0x56159d=_0xb0ae[_0x47982a];return _0x56159d;};'use strict';var Sequelize=require(_0xeb0a('0x0'));var _=require(_0xeb0a('0x1'));var util=require(_0xeb0a('0x2'));module['exports']={'name':{'type':Sequelize[_0xeb0a('0x3')],'unique':_0xeb0a('0x4')},'description':{'type':Sequelize[_0xeb0a('0x3')]},'formData':{'type':Sequelize[_0xeb0a('0x5')](_0xeb0a('0x6')),'set':function(_0x34f5a9){if(_['isObjectLike'](_0x34f5a9)){this['setDataValue']('formData',JSON[_0xeb0a('0x7')](_0x34f5a9));}else if(_[_0xeb0a('0x8')](_0x34f5a9)){this[_0xeb0a('0x9')]('formData',_0x34f5a9);}else{this['setDataValue'](_0xeb0a('0xa'),util[_0xeb0a('0xb')](_0xeb0a('0xc'),this['getDataValue']('name')||'',this[_0xeb0a('0xd')](_0xeb0a('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'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 1863bc1..7f08231 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 _0xc161=['find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','body','role','UserProfileSection','autoAssociation','findOne','JscriptySessionReport','sort','rows','getAnswers','nolimit','ProjectId','JscriptyAnswerReport','number','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','show','params'];(function(_0xbed8a2,_0x578ae3){var _0x11d4f2=function(_0x49e846){while(--_0x49e846){_0xbed8a2['push'](_0xbed8a2['shift']());}};_0x11d4f2(++_0x578ae3);}(_0xc161,0x183));var _0x1c16=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xc161[_0x50f392];return _0x5926f2;};'use strict';var pdf=require(_0x1c16('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c16('0x1'));var zipdir=require(_0x1c16('0x2'));var jsonpatch=require(_0x1c16('0x3'));var rp=require('request-promise');var moment=require(_0x1c16('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c16('0x5'));var path=require(_0x1c16('0x6'));var sox=require(_0x1c16('0x7'));var csv=require(_0x1c16('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c16('0x9'));var squel=require(_0x1c16('0xa'));var crypto=require(_0x1c16('0xb'));var jsforce=require(_0x1c16('0xc'));var deskjs=require(_0x1c16('0xd'));var toCsv=require(_0x1c16('0x8'));var querystring=require(_0x1c16('0xe'));var Papa=require(_0x1c16('0xf'));var Redis=require(_0x1c16('0x10'));var authService=require(_0x1c16('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c16('0x12'));var logger=require(_0x1c16('0x13'))(_0x1c16('0x14'));var utils=require('../../config/utils');var config=require(_0x1c16('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281802,_0x1cf2d3){_0x1cf2d3=_0x1cf2d3||0xcc;return function(_0x56c89f){if(_0x56c89f){return _0x281802['sendStatus'](_0x1cf2d3);}return _0x281802[_0x1c16('0x16')](_0x1cf2d3)[_0x1c16('0x17')]();};}function respondWithResult(_0x567a79,_0x317cd0){_0x317cd0=_0x317cd0||0xc8;return function(_0x83e958){if(_0x83e958){return _0x567a79[_0x1c16('0x16')](_0x317cd0)[_0x1c16('0x18')](_0x83e958);}};}function respondWithFilteredResult(_0x18ab2b,_0x31e4a4){return function(_0x274c30){if(_0x274c30){var _0x18ee3c=_0x274c30['count'],_0x57643c=_0x31e4a4[_0x1c16('0x19')],_0x3f976b=_0x31e4a4[_0x1c16('0x19')]+_0x31e4a4[_0x1c16('0x1a')],_0x592dd8;if(_0x3f976b>=_0x18ee3c){_0x3f976b=_0x18ee3c;_0x592dd8=0xc8;}else{_0x592dd8=0xce;}_0x18ab2b[_0x1c16('0x16')](_0x592dd8);return _0x18ab2b[_0x1c16('0x1b')](_0x1c16('0x1c'),_0x57643c+'-'+_0x3f976b+'/'+_0x18ee3c)[_0x1c16('0x18')](_0x274c30);}return null;};}function patchUpdates(_0x4a51db){return function(_0x3b5fdb){try{jsonpatch[_0x1c16('0x1d')](_0x3b5fdb,_0x4a51db,!![]);}catch(_0x56dffa){return BPromise[_0x1c16('0x1e')](_0x56dffa);}return _0x3b5fdb[_0x1c16('0x1f')]();};}function saveUpdates(_0x29321b,_0x1e7fd7){return function(_0x1a8c16){if(_0x1a8c16){return _0x1a8c16[_0x1c16('0x20')](_0x29321b)[_0x1c16('0x21')](function(_0x76b294){return _0x76b294;});}return null;};}function removeEntity(_0x187d79,_0x2e21ee){return function(_0x2cfff5){if(_0x2cfff5){return _0x2cfff5[_0x1c16('0x22')]()['then'](function(){var _0x471068=_0x2cfff5['get']({'plain':!![]});var _0x2aca85=_0x1c16('0x23');return db[_0x1c16('0x24')][_0x1c16('0x22')]({'where':{'type':_0x2aca85,'resourceId':_0x471068['id']}})['then'](function(){return _0x2cfff5;});})['then'](function(){_0x187d79[_0x1c16('0x16')](0xcc)[_0x1c16('0x17')]();});}};}function handleEntityNotFound(_0x53cd9f,_0x292ecb){return function(_0x233fff){if(!_0x233fff){_0x53cd9f['sendStatus'](0x194);}return _0x233fff;};}function handleError(_0x23a14a,_0x135e66){_0x135e66=_0x135e66||0x1f4;return function(_0x2f0631){logger[_0x1c16('0x25')](_0x2f0631[_0x1c16('0x26')]);if(_0x2f0631['name']){delete _0x2f0631[_0x1c16('0x27')];}_0x23a14a['status'](_0x135e66)[_0x1c16('0x28')](_0x2f0631);};}exports[_0x1c16('0x29')]=function(_0x4e6cae,_0x2e0d39){var _0x247084={},_0x386a5f={},_0xc2b38e={'count':0x0,'rows':[]};var _0xa2dd31=_[_0x1c16('0x2a')](db[_0x1c16('0x2b')][_0x1c16('0x2c')],function(_0x3ba3e1){return{'name':_0x3ba3e1[_0x1c16('0x2d')],'type':_0x3ba3e1[_0x1c16('0x2e')][_0x1c16('0x2f')]};});_0x386a5f[_0x1c16('0x30')]=_[_0x1c16('0x2a')](_0xa2dd31,_0x1c16('0x27'));_0x386a5f['query']=_[_0x1c16('0x31')](_0x4e6cae[_0x1c16('0x32')]);_0x386a5f[_0x1c16('0x33')]=_[_0x1c16('0x34')](_0x386a5f[_0x1c16('0x30')],_0x386a5f[_0x1c16('0x32')]);_0x247084['attributes']=_[_0x1c16('0x34')](_0x386a5f['model'],qs[_0x1c16('0x35')](_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x35')]));_0x247084[_0x1c16('0x36')]=_0x247084[_0x1c16('0x36')]['length']?_0x247084[_0x1c16('0x36')]:_0x386a5f[_0x1c16('0x30')];if(!_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x37')]('nolimit')){_0x247084[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0x4e6cae[_0x1c16('0x32')]['limit']);_0x247084['offset']=qs['offset'](_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x19')]);}_0x247084[_0x1c16('0x38')]=qs['sort'](_0x4e6cae['query']['sort']);_0x247084['where']=qs['filters'](_[_0x1c16('0x39')](_0x4e6cae[_0x1c16('0x32')],_0x386a5f['filters']),_0xa2dd31);if(_0x4e6cae[_0x1c16('0x32')]['filter']){_0x247084['where']=_['merge'](_0x247084[_0x1c16('0x3a')],{'$or':_[_0x1c16('0x2a')](_0xa2dd31,function(_0x20fcb7){if(_0x20fcb7[_0x1c16('0x2e')]!==_0x1c16('0x3b')){var _0x17f174={};_0x17f174[_0x20fcb7[_0x1c16('0x27')]]={'$like':'%'+_0x4e6cae[_0x1c16('0x32')][_0x1c16('0x3c')]+'%'};return _0x17f174;}})});}_0x247084=_[_0x1c16('0x3d')]({},_0x247084,_0x4e6cae[_0x1c16('0x3e')]);var _0x21f0ca={'where':_0x247084[_0x1c16('0x3a')]};return db[_0x1c16('0x2b')][_0x1c16('0x3f')](_0x21f0ca)[_0x1c16('0x21')](function(_0x13020){_0xc2b38e[_0x1c16('0x3f')]=_0x13020;if(_0x4e6cae['query'][_0x1c16('0x40')]){_0x247084[_0x1c16('0x41')]=[{'all':!![]}];}return db[_0x1c16('0x2b')][_0x1c16('0x42')](_0x247084);})[_0x1c16('0x21')](function(_0x5915f8){_0xc2b38e['rows']=_0x5915f8;return _0xc2b38e;})[_0x1c16('0x21')](respondWithFilteredResult(_0x2e0d39,_0x247084))['catch'](handleError(_0x2e0d39,null));};exports[_0x1c16('0x43')]=function(_0x42414d,_0x2592f4){var _0xc469a5={'raw':![],'where':{'id':_0x42414d[_0x1c16('0x44')]['id']}},_0x57e6bf={};_0x57e6bf[_0x1c16('0x30')]=_[_0x1c16('0x31')](db[_0x1c16('0x2b')][_0x1c16('0x2c')]);_0x57e6bf[_0x1c16('0x32')]=_[_0x1c16('0x31')](_0x42414d[_0x1c16('0x32')]);_0x57e6bf['filters']=_[_0x1c16('0x34')](_0x57e6bf[_0x1c16('0x30')],_0x57e6bf[_0x1c16('0x32')]);_0xc469a5['attributes']=_[_0x1c16('0x34')](_0x57e6bf['model'],qs[_0x1c16('0x35')](_0x42414d[_0x1c16('0x32')][_0x1c16('0x35')]));_0xc469a5[_0x1c16('0x36')]=_0xc469a5['attributes']['length']?_0xc469a5[_0x1c16('0x36')]:_0x57e6bf[_0x1c16('0x30')];if(_0x42414d[_0x1c16('0x32')][_0x1c16('0x40')]){_0xc469a5[_0x1c16('0x41')]=[{'all':!![]}];}_0xc469a5=_[_0x1c16('0x3d')]({},_0xc469a5,_0x42414d[_0x1c16('0x3e')]);return db[_0x1c16('0x2b')][_0x1c16('0x45')](_0xc469a5)[_0x1c16('0x21')](handleEntityNotFound(_0x2592f4,null))['then'](respondWithResult(_0x2592f4,null))[_0x1c16('0x46')](handleError(_0x2592f4,null));};exports[_0x1c16('0x47')]=function(_0x3b5705,_0x3c8ee0){return db['JscriptyProject'][_0x1c16('0x47')](_0x3b5705['body'],{})[_0x1c16('0x21')](function(_0xc244a1){var _0xbd8bbd=_0x3b5705['user'][_0x1c16('0x48')]({'plain':!![]});if(!_0xbd8bbd)throw new Error(_0x1c16('0x49'));if(_0xbd8bbd['role']===_0x1c16('0x4a')){var _0x4c963e=_0xc244a1[_0x1c16('0x48')]({'plain':!![]});var _0x1ddf11=_0x1c16('0x23');return db['UserProfileSection'][_0x1c16('0x45')]({'where':{'name':_0x1ddf11,'userProfileId':_0xbd8bbd[_0x1c16('0x4b')]},'raw':!![]})[_0x1c16('0x21')](function(_0x2e3673){if(_0x2e3673&&_0x2e3673['autoAssociation']===0x0){return db['UserProfileResource'][_0x1c16('0x47')]({'name':_0x4c963e[_0x1c16('0x27')],'resourceId':_0x4c963e['id'],'type':_0x2e3673[_0x1c16('0x27')],'sectionId':_0x2e3673['id']},{})[_0x1c16('0x21')](function(){return _0xc244a1;});}else{return _0xc244a1;}})[_0x1c16('0x46')](function(_0x135fc2){logger[_0x1c16('0x25')](_0x1c16('0x4c'),_0x135fc2);throw _0x135fc2;});}return _0xc244a1;})['then'](respondWithResult(_0x3c8ee0,0xc9))[_0x1c16('0x46')](handleError(_0x3c8ee0,null));};exports[_0x1c16('0x4d')]=function(_0x212659,_0x5360e4){var _0x790f06={'where':{'id':_0x212659[_0x1c16('0x44')]['id']}},_0x1472ac={};_0x1472ac[_0x1c16('0x30')]=_[_0x1c16('0x31')](db['JscriptyProject'][_0x1c16('0x2c')]);_0x790f06[_0x1c16('0x36')]=_[_0x1c16('0x34')](_0x1472ac[_0x1c16('0x30')],qs[_0x1c16('0x35')](_0x212659['query'][_0x1c16('0x35')]));_0x790f06[_0x1c16('0x36')]=_0x790f06[_0x1c16('0x36')][_0x1c16('0x4e')]?_0x790f06['attributes']:_0x1472ac[_0x1c16('0x30')];if(_0x212659['query'][_0x1c16('0x40')]){_0x790f06[_0x1c16('0x41')]=[{'all':!![]}];}_0x790f06=_['merge']({},_0x790f06,_0x212659['options']);return db[_0x1c16('0x2b')][_0x1c16('0x45')](_0x790f06)[_0x1c16('0x21')](handleEntityNotFound(_0x5360e4,null))[_0x1c16('0x21')](function(_0x1c9001){if(_0x1c9001){var _0x57358f=_0x1c9001[_0x1c16('0x48')]({'plain':!![]});_0x57358f=qs['omit'](_0x57358f,['id',_0x1c16('0x4f'),_0x1c16('0x50')]);_0x212659['body']=_['omit'](_0x212659['body'],['id',_0x1c16('0x4f'),_0x1c16('0x50')]);return db['JscriptyProject'][_0x1c16('0x47')](_[_0x1c16('0x3d')](_0x57358f,_0x212659[_0x1c16('0x51')]),{'include':_0x212659[_0x1c16('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x20e111){var _0x16dc79=_0x212659[_0x1c16('0x4a')]['get']({'plain':!![]});if(!_0x16dc79)throw new Error(_0x1c16('0x49'));if(_0x16dc79[_0x1c16('0x52')]==='user'){var _0x2a01e0=_0x20e111[_0x1c16('0x48')]({'plain':!![]});var _0x42363c=_0x1c16('0x23');return db[_0x1c16('0x53')][_0x1c16('0x45')]({'where':{'name':_0x42363c,'userProfileId':_0x16dc79[_0x1c16('0x4b')]},'raw':!![]})[_0x1c16('0x21')](function(_0x433bfc){if(_0x433bfc&&_0x433bfc[_0x1c16('0x54')]===0x0){return db[_0x1c16('0x24')][_0x1c16('0x47')]({'name':_0x2a01e0[_0x1c16('0x27')],'resourceId':_0x2a01e0['id'],'type':_0x433bfc['name'],'sectionId':_0x433bfc['id']},{})[_0x1c16('0x21')](function(){return _0x20e111;});}else{return _0x20e111;}})[_0x1c16('0x46')](function(_0x18a849){logger[_0x1c16('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a849);throw _0x18a849;});}return _0x20e111;});}})[_0x1c16('0x21')](respondWithResult(_0x5360e4,0xc9))[_0x1c16('0x46')](handleError(_0x5360e4,null));};exports[_0x1c16('0x20')]=function(_0x4219f2,_0x429d55){if(_0x4219f2[_0x1c16('0x51')]['id']){delete _0x4219f2[_0x1c16('0x51')]['id'];}return db[_0x1c16('0x2b')][_0x1c16('0x45')]({'where':{'id':_0x4219f2['params']['id']}})[_0x1c16('0x21')](handleEntityNotFound(_0x429d55,null))[_0x1c16('0x21')](saveUpdates(_0x4219f2[_0x1c16('0x51')],null))[_0x1c16('0x21')](respondWithResult(_0x429d55,null))[_0x1c16('0x46')](handleError(_0x429d55,null));};exports[_0x1c16('0x22')]=function(_0x43542b,_0x581d95){return db['JscriptyProject'][_0x1c16('0x45')]({'where':{'id':_0x43542b[_0x1c16('0x44')]['id']}})['then'](handleEntityNotFound(_0x581d95,null))['then'](removeEntity(_0x581d95,null))['catch'](handleError(_0x581d95,null));};exports['getSessions']=function(_0xb35c23,_0x21214c,_0x2761b4){var _0x58844b={'raw':!![],'where':{}};var _0x2a82fb={};var _0x15a0c4={'count':0x0,'rows':[]};return db[_0x1c16('0x2b')][_0x1c16('0x55')]({'where':{'id':_0xb35c23[_0x1c16('0x44')]['id']}})[_0x1c16('0x21')](handleEntityNotFound(_0x21214c,null))[_0x1c16('0x21')](function(_0x243d29){if(_0x243d29){_0x2a82fb[_0x1c16('0x30')]=_[_0x1c16('0x31')](db[_0x1c16('0x56')][_0x1c16('0x2c')]);_0x2a82fb[_0x1c16('0x32')]=_['keys'](_0xb35c23['query']);_0x2a82fb['filters']=_[_0x1c16('0x34')](_0x2a82fb[_0x1c16('0x30')],_0x2a82fb[_0x1c16('0x32')]);_0x58844b['attributes']=_[_0x1c16('0x34')](_0x2a82fb['model'],qs[_0x1c16('0x35')](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x35')]));_0x58844b[_0x1c16('0x36')]=_0x58844b[_0x1c16('0x36')][_0x1c16('0x4e')]?_0x58844b[_0x1c16('0x36')]:_0x2a82fb[_0x1c16('0x30')];if(!_0xb35c23[_0x1c16('0x32')][_0x1c16('0x37')]('nolimit')){_0x58844b[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0xb35c23[_0x1c16('0x32')]['limit']);_0x58844b[_0x1c16('0x19')]=qs[_0x1c16('0x19')](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x19')]);}_0x58844b['order']=qs['sort'](_0xb35c23[_0x1c16('0x32')][_0x1c16('0x57')]);_0x58844b['where']=qs[_0x1c16('0x33')](_['pick'](_0xb35c23[_0x1c16('0x32')],_0x2a82fb[_0x1c16('0x33')]));_0x58844b[_0x1c16('0x3a')]['ProjectId']=_0x243d29['id'];if(_0xb35c23[_0x1c16('0x32')][_0x1c16('0x3c')]){_0x58844b[_0x1c16('0x3a')]=_[_0x1c16('0x3d')](_0x58844b[_0x1c16('0x3a')],{'$or':_[_0x1c16('0x2a')](_0x58844b[_0x1c16('0x36')],function(_0x15482d){var _0x1ae952={};_0x1ae952[_0x15482d]={'$like':'%'+_0xb35c23['query'][_0x1c16('0x3c')]+'%'};return _0x1ae952;})});}_0x58844b=_['merge']({},_0x58844b,_0xb35c23[_0x1c16('0x3e')]);return db[_0x1c16('0x56')][_0x1c16('0x3f')]({'where':_0x58844b['where']})[_0x1c16('0x21')](function(_0xc03ebc){_0x15a0c4[_0x1c16('0x3f')]=_0xc03ebc;if(_0xb35c23[_0x1c16('0x32')][_0x1c16('0x40')]){_0x58844b['include']=[{'all':!![]}];}return db[_0x1c16('0x56')][_0x1c16('0x42')](_0x58844b);})[_0x1c16('0x21')](function(_0x32d2ee){_0x15a0c4[_0x1c16('0x58')]=_0x32d2ee;return _0x15a0c4;});}})[_0x1c16('0x21')](respondWithFilteredResult(_0x21214c,_0x58844b))[_0x1c16('0x46')](handleError(_0x21214c,null));};exports[_0x1c16('0x59')]=function(_0x5ce9b8,_0x44ba5d,_0x16d358){var _0x37a229={'raw':!![],'where':{}};var _0x5e7b95={};var _0x143cb5={'count':0x0,'rows':[]};return db[_0x1c16('0x2b')][_0x1c16('0x55')]({'where':{'id':_0x5ce9b8['params']['id']}})['then'](handleEntityNotFound(_0x44ba5d,null))[_0x1c16('0x21')](function(_0x334d2a){if(_0x334d2a){_0x5e7b95[_0x1c16('0x30')]=_[_0x1c16('0x31')](db['JscriptyAnswerReport'][_0x1c16('0x2c')]);_0x5e7b95[_0x1c16('0x32')]=_[_0x1c16('0x31')](_0x5ce9b8[_0x1c16('0x32')]);_0x5e7b95[_0x1c16('0x33')]=_[_0x1c16('0x34')](_0x5e7b95[_0x1c16('0x30')],_0x5e7b95[_0x1c16('0x32')]);_0x37a229[_0x1c16('0x36')]=_[_0x1c16('0x34')](_0x5e7b95['model'],qs['fields'](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x35')]));_0x37a229[_0x1c16('0x36')]=_0x37a229['attributes'][_0x1c16('0x4e')]?_0x37a229[_0x1c16('0x36')]:_0x5e7b95[_0x1c16('0x30')];if(!_0x5ce9b8[_0x1c16('0x32')]['hasOwnProperty'](_0x1c16('0x5a'))){_0x37a229[_0x1c16('0x1a')]=qs[_0x1c16('0x1a')](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x1a')]);_0x37a229[_0x1c16('0x19')]=qs['offset'](_0x5ce9b8['query'][_0x1c16('0x19')]);}_0x37a229[_0x1c16('0x38')]=qs['sort'](_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x57')]);_0x37a229['where']=qs[_0x1c16('0x33')](_[_0x1c16('0x39')](_0x5ce9b8[_0x1c16('0x32')],_0x5e7b95[_0x1c16('0x33')]));_0x37a229[_0x1c16('0x3a')][_0x1c16('0x5b')]=_0x334d2a['id'];if(_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x3c')]){_0x37a229[_0x1c16('0x3a')]=_[_0x1c16('0x3d')](_0x37a229['where'],{'$or':_['map'](_0x37a229[_0x1c16('0x36')],function(_0x419b91){var _0x721262={};_0x721262[_0x419b91]={'$like':'%'+_0x5ce9b8[_0x1c16('0x32')]['filter']+'%'};return _0x721262;})});}_0x37a229=_['merge']({},_0x37a229,_0x5ce9b8['options']);return db['JscriptyAnswerReport'][_0x1c16('0x3f')]({'where':_0x37a229['where']})[_0x1c16('0x21')](function(_0x58925d){_0x143cb5[_0x1c16('0x3f')]=_0x58925d;if(_0x5ce9b8[_0x1c16('0x32')][_0x1c16('0x40')]){_0x37a229[_0x1c16('0x41')]=[{'all':!![]}];}return db[_0x1c16('0x5c')][_0x1c16('0x42')](_0x37a229);})[_0x1c16('0x21')](function(_0x19c98d){_0x143cb5[_0x1c16('0x58')]=_0x19c98d;return _0x143cb5;});}})[_0x1c16('0x21')](respondWithFilteredResult(_0x44ba5d,_0x37a229))[_0x1c16('0x46')](handleError(_0x44ba5d,null));};function char(_0x1c5d6a){return _0x1c16('0x5d')===typeof _0x1c5d6a?String['fromCharCode'][_0x1c16('0x1d')](null,arguments):_0x1c5d6a;}function needsEncapsulation(_0x20da49){return!!_0x20da49&&(_0x20da49['toString']()[_0x1c16('0x5e')](char(0xd))>=0x0||_0x20da49[_0x1c16('0x5f')]()[_0x1c16('0x5e')](char(0xa))>=0x0||_0x20da49[_0x1c16('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x20da49[_0x1c16('0x5f')]()[_0x1c16('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4909da){var _0x4a42e1=char(0x22),_0x140fd3='\x5c'+char(0x22),_0x6a0a09=_0x4909da['toString']()[_0x1c16('0x60')](new RegExp(_0x4a42e1,'g'),_0x140fd3);return _0x4a42e1+_0x6a0a09+_0x4a42e1;}exports[_0x1c16('0x61')]=function(_0x5af8fe,_0x1564c8,_0x54b6ab){var _0x26a7ac,_0x1fc88c;var _0x4ef3c6={'where':{'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id']}};if(_0x5af8fe[_0x1c16('0x32')][_0x1c16('0x62')]){_0x4ef3c6[_0x1c16('0x3a')][_0x1c16('0x63')]=JSON['parse'](_0x5af8fe[_0x1c16('0x32')]['startTime']);}return db['JscriptySessionReport'][_0x1c16('0x42')](_0x4ef3c6)[_0x1c16('0x21')](handleEntityNotFound(_0x1564c8,null))[_0x1c16('0x21')](function(_0x5b6a85){if(_0x5b6a85){_0x26a7ac=_0x5b6a85;return db[_0x1c16('0x64')][_0x1c16('0x42')]({'where':{'SessionId':{'$in':_[_0x1c16('0x2a')](_0x26a7ac,'id')},'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id']},'order':_0x1c16('0x65')});}})[_0x1c16('0x21')](handleEntityNotFound(_0x1564c8,null))[_0x1c16('0x21')](function(_0xa7e0f0){if(_0xa7e0f0){_0x1fc88c=_0xa7e0f0;var _0x8b7330={};for(var _0x259acf=0x0,_0x51cfb1=_0x1fc88c['length'];_0x259acf<_0x51cfb1;_0x259acf++){if(!_0x8b7330[_0x1c16('0x37')](_0x1fc88c[_0x259acf][_0x1c16('0x66')])){_0x8b7330[_0x1fc88c[_0x259acf][_0x1c16('0x66')]]=needsEncapsulation(_0x1fc88c[_0x259acf][_0x1c16('0x67')])?encapsulate(_0x1fc88c[_0x259acf][_0x1c16('0x67')]):_0x1fc88c[_0x259acf][_0x1c16('0x67')];}}var _0x12162d=[],_0x9d107d={};for(var _0x40d956=0x0,_0x5c6a88=_0x26a7ac[_0x1c16('0x4e')];_0x40d956<_0x5c6a88;_0x40d956++){_0x9d107d={'ProjectId':_0x5af8fe[_0x1c16('0x44')]['id'],'SessionId':_0x26a7ac[_0x40d956]['id'],'StartTime':moment(_0x26a7ac[_0x40d956]['starttime'])[_0x1c16('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5c1ec8=0x0,_0x5592ea=_0x1fc88c[_0x1c16('0x4e')];_0x5c1ec8<_0x5592ea;_0x5c1ec8++){if(_0x1fc88c[_0x5c1ec8]['SessionId']==_0x26a7ac[_0x40d956]['id']&&_0x8b7330[_0x1c16('0x37')](_0x1fc88c[_0x5c1ec8][_0x1c16('0x66')])){_0x9d107d[_0x8b7330[_0x1fc88c[_0x5c1ec8]['questionId']]]=_0x1fc88c[_0x5c1ec8][_0x1c16('0x69')];}}for(var _0x184e4c in _0x8b7330){if(!_0x9d107d[_0x1c16('0x37')](_0x8b7330[_0x184e4c])){_0x9d107d[_0x8b7330[_0x184e4c]]=null;}}_0x12162d[_0x1c16('0x6a')](_0x9d107d);}return _0x12162d;}})[_0x1c16('0x21')](function(_0x453418){if(!_['isEmpty'](_0x453418)){var _0x31a718=toCsv(_0x453418);var _0x5efb5c=Date['now']();fs[_0x1c16('0x6b')](util['format'](_0x1c16('0x6c'),_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c),_0x31a718);_0x1564c8[_0x1c16('0x6d')](_0x1c16('0x6e'),_0x1c16('0x6f')+util[_0x1c16('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c));_0x1564c8['setHeader']('Content-type','text/csv');return _0x1564c8[_0x1c16('0x70')](util['format'](_0x1c16('0x6c'),_0x5af8fe[_0x1c16('0x44')]['id'],_0x5efb5c));}else{return _0x1564c8[_0x1c16('0x71')](0xcc);}})[_0x1c16('0x46')](handleError(_0x1564c8,null));}; \ No newline at end of file +var _0x0996=['include','findAll','rows','catch','show','params','rawAttributes','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','clone','createdAt','updatedAt','omit','getSessions','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyProject','includeAll'];(function(_0x37ac1b,_0x512f02){var _0x1abd0e=function(_0x59df36){while(--_0x59df36){_0x37ac1b['push'](_0x37ac1b['shift']());}};_0x1abd0e(++_0x512f02);}(_0x0996,0xa2));var _0x6099=function(_0x2dced1,_0x1c3f60){_0x2dced1=_0x2dced1-0x0;var _0x321fdc=_0x0996[_0x2dced1];return _0x321fdc;};'use strict';var pdf=require(_0x6099('0x0'));var emlformat=require(_0x6099('0x1'));var rimraf=require(_0x6099('0x2'));var zipdir=require(_0x6099('0x3'));var jsonpatch=require(_0x6099('0x4'));var rp=require(_0x6099('0x5'));var moment=require(_0x6099('0x6'));var BPromise=require(_0x6099('0x7'));var Mustache=require(_0x6099('0x8'));var util=require(_0x6099('0x9'));var path=require('path');var sox=require(_0x6099('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6099('0xb'));var squel=require(_0x6099('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6099('0xd'));var toCsv=require(_0x6099('0xe'));var querystring=require('querystring');var Papa=require(_0x6099('0xf'));var Redis=require('ioredis');var authService=require(_0x6099('0x10'));var qs=require(_0x6099('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6099('0x12'));var logger=require(_0x6099('0x13'))(_0x6099('0x14'));var utils=require(_0x6099('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x266c27,_0x93f8ab){_0x93f8ab=_0x93f8ab||0xcc;return function(_0xa78c3e){if(_0xa78c3e){return _0x266c27[_0x6099('0x16')](_0x93f8ab);}return _0x266c27[_0x6099('0x17')](_0x93f8ab)['end']();};}function respondWithResult(_0x41300a,_0x13db13){_0x13db13=_0x13db13||0xc8;return function(_0x3ff244){if(_0x3ff244){return _0x41300a[_0x6099('0x17')](_0x13db13)['json'](_0x3ff244);}};}function respondWithFilteredResult(_0x842e42,_0x4743e6){return function(_0x1fdd02){if(_0x1fdd02){var _0x3afd4a=_0x1fdd02[_0x6099('0x18')],_0x187188=_0x4743e6[_0x6099('0x19')],_0x2db099=_0x4743e6['offset']+_0x4743e6[_0x6099('0x1a')],_0x18c8e0;if(_0x2db099>=_0x3afd4a){_0x2db099=_0x3afd4a;_0x18c8e0=0xc8;}else{_0x18c8e0=0xce;}_0x842e42[_0x6099('0x17')](_0x18c8e0);return _0x842e42['set'](_0x6099('0x1b'),_0x187188+'-'+_0x2db099+'/'+_0x3afd4a)[_0x6099('0x1c')](_0x1fdd02);}return null;};}function patchUpdates(_0x3faa50){return function(_0x177b2c){try{jsonpatch[_0x6099('0x1d')](_0x177b2c,_0x3faa50,!![]);}catch(_0x34c34f){return BPromise[_0x6099('0x1e')](_0x34c34f);}return _0x177b2c[_0x6099('0x1f')]();};}function saveUpdates(_0x19b720,_0x10a2c4){return function(_0x1946bb){if(_0x1946bb){return _0x1946bb[_0x6099('0x20')](_0x19b720)[_0x6099('0x21')](function(_0x1c253c){return _0x1c253c;});}return null;};}function removeEntity(_0x3db511,_0x5d4239){return function(_0xba4686){if(_0xba4686){return _0xba4686[_0x6099('0x22')]()[_0x6099('0x21')](function(){var _0x83c35c=_0xba4686[_0x6099('0x23')]({'plain':!![]});var _0x1d27c1=_0x6099('0x24');return db[_0x6099('0x25')][_0x6099('0x22')]({'where':{'type':_0x1d27c1,'resourceId':_0x83c35c['id']}})[_0x6099('0x21')](function(){return _0xba4686;});})[_0x6099('0x21')](function(){_0x3db511['status'](0xcc)[_0x6099('0x26')]();});}};}function handleEntityNotFound(_0x47ab94,_0x988f7){return function(_0x1595dc){if(!_0x1595dc){_0x47ab94[_0x6099('0x16')](0x194);}return _0x1595dc;};}function handleError(_0x4c2ec5,_0x4e622b){_0x4e622b=_0x4e622b||0x1f4;return function(_0x4799a5){logger[_0x6099('0x27')](_0x4799a5[_0x6099('0x28')]);if(_0x4799a5[_0x6099('0x29')]){delete _0x4799a5['name'];}_0x4c2ec5[_0x6099('0x17')](_0x4e622b)['send'](_0x4799a5);};}exports[_0x6099('0x2a')]=function(_0x1a9b59,_0x473771){var _0x29258d={},_0x1498cc={},_0x55f786={'count':0x0,'rows':[]};var _0xd9ba90=_[_0x6099('0x2b')](db['JscriptyProject']['rawAttributes'],function(_0x377ef6){return{'name':_0x377ef6[_0x6099('0x2c')],'type':_0x377ef6[_0x6099('0x2d')][_0x6099('0x2e')]};});_0x1498cc[_0x6099('0x2f')]=_[_0x6099('0x2b')](_0xd9ba90,_0x6099('0x29'));_0x1498cc['query']=_[_0x6099('0x30')](_0x1a9b59[_0x6099('0x31')]);_0x1498cc[_0x6099('0x32')]=_[_0x6099('0x33')](_0x1498cc['model'],_0x1498cc[_0x6099('0x31')]);_0x29258d[_0x6099('0x34')]=_[_0x6099('0x33')](_0x1498cc[_0x6099('0x2f')],qs[_0x6099('0x35')](_0x1a9b59[_0x6099('0x31')][_0x6099('0x35')]));_0x29258d[_0x6099('0x34')]=_0x29258d[_0x6099('0x34')][_0x6099('0x36')]?_0x29258d[_0x6099('0x34')]:_0x1498cc['model'];if(!_0x1a9b59[_0x6099('0x31')]['hasOwnProperty'](_0x6099('0x37'))){_0x29258d[_0x6099('0x1a')]=qs['limit'](_0x1a9b59['query'][_0x6099('0x1a')]);_0x29258d[_0x6099('0x19')]=qs['offset'](_0x1a9b59[_0x6099('0x31')][_0x6099('0x19')]);}_0x29258d[_0x6099('0x38')]=qs['sort'](_0x1a9b59[_0x6099('0x31')][_0x6099('0x39')]);_0x29258d[_0x6099('0x3a')]=qs[_0x6099('0x32')](_[_0x6099('0x3b')](_0x1a9b59[_0x6099('0x31')],_0x1498cc['filters']),_0xd9ba90);if(_0x1a9b59[_0x6099('0x31')]['filter']){_0x29258d[_0x6099('0x3a')]=_[_0x6099('0x3c')](_0x29258d['where'],{'$or':_[_0x6099('0x2b')](_0xd9ba90,function(_0x4d95f7){if(_0x4d95f7[_0x6099('0x2d')]!==_0x6099('0x3d')){var _0x2b188c={};_0x2b188c[_0x4d95f7[_0x6099('0x29')]]={'$like':'%'+_0x1a9b59[_0x6099('0x31')][_0x6099('0x3e')]+'%'};return _0x2b188c;}})});}_0x29258d=_[_0x6099('0x3c')]({},_0x29258d,_0x1a9b59[_0x6099('0x3f')]);var _0x3a6604={'where':_0x29258d['where']};return db[_0x6099('0x40')][_0x6099('0x18')](_0x3a6604)['then'](function(_0x55b2a3){_0x55f786['count']=_0x55b2a3;if(_0x1a9b59[_0x6099('0x31')][_0x6099('0x41')]){_0x29258d[_0x6099('0x42')]=[{'all':!![]}];}return db[_0x6099('0x40')][_0x6099('0x43')](_0x29258d);})[_0x6099('0x21')](function(_0x2509b0){_0x55f786[_0x6099('0x44')]=_0x2509b0;return _0x55f786;})[_0x6099('0x21')](respondWithFilteredResult(_0x473771,_0x29258d))[_0x6099('0x45')](handleError(_0x473771,null));};exports[_0x6099('0x46')]=function(_0x326c75,_0x379f6a){var _0xf3efa5={'raw':![],'where':{'id':_0x326c75[_0x6099('0x47')]['id']}},_0x4d04a2={};_0x4d04a2['model']=_[_0x6099('0x30')](db['JscriptyProject'][_0x6099('0x48')]);_0x4d04a2[_0x6099('0x31')]=_[_0x6099('0x30')](_0x326c75[_0x6099('0x31')]);_0x4d04a2['filters']=_['intersection'](_0x4d04a2[_0x6099('0x2f')],_0x4d04a2[_0x6099('0x31')]);_0xf3efa5['attributes']=_[_0x6099('0x33')](_0x4d04a2['model'],qs[_0x6099('0x35')](_0x326c75[_0x6099('0x31')][_0x6099('0x35')]));_0xf3efa5[_0x6099('0x34')]=_0xf3efa5['attributes'][_0x6099('0x36')]?_0xf3efa5['attributes']:_0x4d04a2[_0x6099('0x2f')];if(_0x326c75[_0x6099('0x31')][_0x6099('0x41')]){_0xf3efa5['include']=[{'all':!![]}];}_0xf3efa5=_[_0x6099('0x3c')]({},_0xf3efa5,_0x326c75['options']);return db[_0x6099('0x40')][_0x6099('0x49')](_0xf3efa5)[_0x6099('0x21')](handleEntityNotFound(_0x379f6a,null))[_0x6099('0x21')](respondWithResult(_0x379f6a,null))['catch'](handleError(_0x379f6a,null));};exports[_0x6099('0x4a')]=function(_0x1ac5db,_0x3652e2){return db['JscriptyProject'][_0x6099('0x4a')](_0x1ac5db[_0x6099('0x4b')],{})[_0x6099('0x21')](function(_0x8f0090){var _0x5b587a=_0x1ac5db[_0x6099('0x4c')][_0x6099('0x23')]({'plain':!![]});if(!_0x5b587a)throw new Error(_0x6099('0x4d'));if(_0x5b587a[_0x6099('0x4e')]===_0x6099('0x4c')){var _0x497ada=_0x8f0090[_0x6099('0x23')]({'plain':!![]});var _0x28c5bd='Projects';return db[_0x6099('0x4f')][_0x6099('0x49')]({'where':{'name':_0x28c5bd,'userProfileId':_0x5b587a[_0x6099('0x50')]},'raw':!![]})[_0x6099('0x21')](function(_0x1e56cf){if(_0x1e56cf&&_0x1e56cf[_0x6099('0x51')]===0x0){return db[_0x6099('0x25')][_0x6099('0x4a')]({'name':_0x497ada[_0x6099('0x29')],'resourceId':_0x497ada['id'],'type':_0x1e56cf[_0x6099('0x29')],'sectionId':_0x1e56cf['id']},{})['then'](function(){return _0x8f0090;});}else{return _0x8f0090;}})[_0x6099('0x45')](function(_0x444ebf){logger[_0x6099('0x27')](_0x6099('0x52'),_0x444ebf);throw _0x444ebf;});}return _0x8f0090;})[_0x6099('0x21')](respondWithResult(_0x3652e2,0xc9))['catch'](handleError(_0x3652e2,null));};exports[_0x6099('0x53')]=function(_0x336d28,_0x4ae6d){var _0x47bfbf={'where':{'id':_0x336d28['params']['id']}},_0x151d1e={};_0x151d1e[_0x6099('0x2f')]=_[_0x6099('0x30')](db[_0x6099('0x40')]['rawAttributes']);_0x47bfbf[_0x6099('0x34')]=_[_0x6099('0x33')](_0x151d1e[_0x6099('0x2f')],qs[_0x6099('0x35')](_0x336d28[_0x6099('0x31')]['fields']));_0x47bfbf[_0x6099('0x34')]=_0x47bfbf['attributes']['length']?_0x47bfbf[_0x6099('0x34')]:_0x151d1e[_0x6099('0x2f')];if(_0x336d28['query'][_0x6099('0x41')]){_0x47bfbf[_0x6099('0x42')]=[{'all':!![]}];}_0x47bfbf=_[_0x6099('0x3c')]({},_0x47bfbf,_0x336d28[_0x6099('0x3f')]);return db[_0x6099('0x40')][_0x6099('0x49')](_0x47bfbf)[_0x6099('0x21')](handleEntityNotFound(_0x4ae6d,null))[_0x6099('0x21')](function(_0xebfc4d){if(_0xebfc4d){var _0x21e093=_0xebfc4d[_0x6099('0x23')]({'plain':!![]});_0x21e093=qs['omit'](_0x21e093,['id',_0x6099('0x54'),_0x6099('0x55')]);_0x336d28[_0x6099('0x4b')]=_[_0x6099('0x56')](_0x336d28[_0x6099('0x4b')],['id','createdAt','updatedAt']);return db['JscriptyProject'][_0x6099('0x4a')](_[_0x6099('0x3c')](_0x21e093,_0x336d28[_0x6099('0x4b')]),{'include':_0x336d28[_0x6099('0x31')][_0x6099('0x41')]?[{'all':!![]}]:undefined})[_0x6099('0x21')](function(_0x257d95){var _0x388104=_0x336d28[_0x6099('0x4c')][_0x6099('0x23')]({'plain':!![]});if(!_0x388104)throw new Error(_0x6099('0x4d'));if(_0x388104[_0x6099('0x4e')]==='user'){var _0x45a2bd=_0x257d95['get']({'plain':!![]});var _0x4664a5=_0x6099('0x24');return db['UserProfileSection'][_0x6099('0x49')]({'where':{'name':_0x4664a5,'userProfileId':_0x388104[_0x6099('0x50')]},'raw':!![]})[_0x6099('0x21')](function(_0x56dade){if(_0x56dade&&_0x56dade[_0x6099('0x51')]===0x0){return db['UserProfileResource'][_0x6099('0x4a')]({'name':_0x45a2bd[_0x6099('0x29')],'resourceId':_0x45a2bd['id'],'type':_0x56dade[_0x6099('0x29')],'sectionId':_0x56dade['id']},{})[_0x6099('0x21')](function(){return _0x257d95;});}else{return _0x257d95;}})['catch'](function(_0x21e81b){logger[_0x6099('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21e81b);throw _0x21e81b;});}return _0x257d95;});}})[_0x6099('0x21')](respondWithResult(_0x4ae6d,0xc9))['catch'](handleError(_0x4ae6d,null));};exports['update']=function(_0x294330,_0x3c8a4f){if(_0x294330[_0x6099('0x4b')]['id']){delete _0x294330[_0x6099('0x4b')]['id'];}return db[_0x6099('0x40')][_0x6099('0x49')]({'where':{'id':_0x294330[_0x6099('0x47')]['id']}})[_0x6099('0x21')](handleEntityNotFound(_0x3c8a4f,null))[_0x6099('0x21')](saveUpdates(_0x294330[_0x6099('0x4b')],null))[_0x6099('0x21')](respondWithResult(_0x3c8a4f,null))[_0x6099('0x45')](handleError(_0x3c8a4f,null));};exports[_0x6099('0x22')]=function(_0x1bcbbb,_0x4dae71){return db[_0x6099('0x40')][_0x6099('0x49')]({'where':{'id':_0x1bcbbb['params']['id']}})[_0x6099('0x21')](handleEntityNotFound(_0x4dae71,null))[_0x6099('0x21')](removeEntity(_0x4dae71,null))[_0x6099('0x45')](handleError(_0x4dae71,null));};exports[_0x6099('0x57')]=function(_0x4a39e3,_0x210876,_0x17abe8){var _0x4b68cd={'raw':!![],'where':{}};var _0x5bcfeb={};var _0x5b8871={'count':0x0,'rows':[]};return db[_0x6099('0x40')]['findOne']({'where':{'id':_0x4a39e3[_0x6099('0x47')]['id']}})['then'](handleEntityNotFound(_0x210876,null))['then'](function(_0x10fb3e){if(_0x10fb3e){_0x5bcfeb[_0x6099('0x2f')]=_[_0x6099('0x30')](db[_0x6099('0x58')][_0x6099('0x48')]);_0x5bcfeb[_0x6099('0x31')]=_['keys'](_0x4a39e3['query']);_0x5bcfeb[_0x6099('0x32')]=_['intersection'](_0x5bcfeb[_0x6099('0x2f')],_0x5bcfeb[_0x6099('0x31')]);_0x4b68cd[_0x6099('0x34')]=_[_0x6099('0x33')](_0x5bcfeb[_0x6099('0x2f')],qs[_0x6099('0x35')](_0x4a39e3[_0x6099('0x31')][_0x6099('0x35')]));_0x4b68cd[_0x6099('0x34')]=_0x4b68cd[_0x6099('0x34')]['length']?_0x4b68cd[_0x6099('0x34')]:_0x5bcfeb[_0x6099('0x2f')];if(!_0x4a39e3[_0x6099('0x31')][_0x6099('0x59')](_0x6099('0x37'))){_0x4b68cd[_0x6099('0x1a')]=qs[_0x6099('0x1a')](_0x4a39e3[_0x6099('0x31')][_0x6099('0x1a')]);_0x4b68cd[_0x6099('0x19')]=qs['offset'](_0x4a39e3[_0x6099('0x31')][_0x6099('0x19')]);}_0x4b68cd[_0x6099('0x38')]=qs[_0x6099('0x39')](_0x4a39e3[_0x6099('0x31')][_0x6099('0x39')]);_0x4b68cd['where']=qs[_0x6099('0x32')](_[_0x6099('0x3b')](_0x4a39e3['query'],_0x5bcfeb[_0x6099('0x32')]));_0x4b68cd['where'][_0x6099('0x5a')]=_0x10fb3e['id'];if(_0x4a39e3[_0x6099('0x31')]['filter']){_0x4b68cd[_0x6099('0x3a')]=_[_0x6099('0x3c')](_0x4b68cd['where'],{'$or':_[_0x6099('0x2b')](_0x4b68cd[_0x6099('0x34')],function(_0x114b79){var _0x1eb373={};_0x1eb373[_0x114b79]={'$like':'%'+_0x4a39e3[_0x6099('0x31')][_0x6099('0x3e')]+'%'};return _0x1eb373;})});}_0x4b68cd=_['merge']({},_0x4b68cd,_0x4a39e3[_0x6099('0x3f')]);return db[_0x6099('0x58')][_0x6099('0x18')]({'where':_0x4b68cd[_0x6099('0x3a')]})[_0x6099('0x21')](function(_0x5e198c){_0x5b8871[_0x6099('0x18')]=_0x5e198c;if(_0x4a39e3[_0x6099('0x31')]['includeAll']){_0x4b68cd['include']=[{'all':!![]}];}return db[_0x6099('0x58')][_0x6099('0x43')](_0x4b68cd);})[_0x6099('0x21')](function(_0x277a82){_0x5b8871[_0x6099('0x44')]=_0x277a82;return _0x5b8871;});}})[_0x6099('0x21')](respondWithFilteredResult(_0x210876,_0x4b68cd))[_0x6099('0x45')](handleError(_0x210876,null));};exports[_0x6099('0x5b')]=function(_0x3b5de0,_0x4b31c0,_0x32f21a){var _0x1ceea6={'raw':!![],'where':{}};var _0x51e4ad={};var _0x5e6645={'count':0x0,'rows':[]};return db[_0x6099('0x40')][_0x6099('0x5c')]({'where':{'id':_0x3b5de0['params']['id']}})[_0x6099('0x21')](handleEntityNotFound(_0x4b31c0,null))['then'](function(_0x1dfcd2){if(_0x1dfcd2){_0x51e4ad[_0x6099('0x2f')]=_[_0x6099('0x30')](db[_0x6099('0x5d')]['rawAttributes']);_0x51e4ad[_0x6099('0x31')]=_['keys'](_0x3b5de0[_0x6099('0x31')]);_0x51e4ad[_0x6099('0x32')]=_[_0x6099('0x33')](_0x51e4ad['model'],_0x51e4ad['query']);_0x1ceea6[_0x6099('0x34')]=_[_0x6099('0x33')](_0x51e4ad[_0x6099('0x2f')],qs[_0x6099('0x35')](_0x3b5de0['query'][_0x6099('0x35')]));_0x1ceea6['attributes']=_0x1ceea6[_0x6099('0x34')][_0x6099('0x36')]?_0x1ceea6[_0x6099('0x34')]:_0x51e4ad['model'];if(!_0x3b5de0[_0x6099('0x31')]['hasOwnProperty']('nolimit')){_0x1ceea6[_0x6099('0x1a')]=qs['limit'](_0x3b5de0[_0x6099('0x31')][_0x6099('0x1a')]);_0x1ceea6['offset']=qs[_0x6099('0x19')](_0x3b5de0[_0x6099('0x31')][_0x6099('0x19')]);}_0x1ceea6[_0x6099('0x38')]=qs[_0x6099('0x39')](_0x3b5de0[_0x6099('0x31')]['sort']);_0x1ceea6[_0x6099('0x3a')]=qs[_0x6099('0x32')](_[_0x6099('0x3b')](_0x3b5de0[_0x6099('0x31')],_0x51e4ad[_0x6099('0x32')]));_0x1ceea6[_0x6099('0x3a')][_0x6099('0x5a')]=_0x1dfcd2['id'];if(_0x3b5de0[_0x6099('0x31')][_0x6099('0x3e')]){_0x1ceea6[_0x6099('0x3a')]=_[_0x6099('0x3c')](_0x1ceea6[_0x6099('0x3a')],{'$or':_[_0x6099('0x2b')](_0x1ceea6[_0x6099('0x34')],function(_0x1c25ef){var _0x492d7b={};_0x492d7b[_0x1c25ef]={'$like':'%'+_0x3b5de0[_0x6099('0x31')][_0x6099('0x3e')]+'%'};return _0x492d7b;})});}_0x1ceea6=_[_0x6099('0x3c')]({},_0x1ceea6,_0x3b5de0['options']);return db['JscriptyAnswerReport'][_0x6099('0x18')]({'where':_0x1ceea6['where']})[_0x6099('0x21')](function(_0x539494){_0x5e6645['count']=_0x539494;if(_0x3b5de0[_0x6099('0x31')][_0x6099('0x41')]){_0x1ceea6[_0x6099('0x42')]=[{'all':!![]}];}return db[_0x6099('0x5d')][_0x6099('0x43')](_0x1ceea6);})['then'](function(_0x2a9371){_0x5e6645[_0x6099('0x44')]=_0x2a9371;return _0x5e6645;});}})[_0x6099('0x21')](respondWithFilteredResult(_0x4b31c0,_0x1ceea6))[_0x6099('0x45')](handleError(_0x4b31c0,null));};function char(_0x566772){return'number'===typeof _0x566772?String[_0x6099('0x5e')][_0x6099('0x1d')](null,arguments):_0x566772;}function needsEncapsulation(_0xa3c920){return!!_0xa3c920&&(_0xa3c920[_0x6099('0x5f')]()[_0x6099('0x60')](char(0xd))>=0x0||_0xa3c920[_0x6099('0x5f')]()[_0x6099('0x60')](char(0xa))>=0x0||_0xa3c920[_0x6099('0x5f')]()[_0x6099('0x60')](char(0x2c))>=0x0||_0xa3c920['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3d807c){var _0x28c755=char(0x22),_0x44dd30='\x5c'+char(0x22),_0x238bf0=_0x3d807c[_0x6099('0x5f')]()['replace'](new RegExp(_0x28c755,'g'),_0x44dd30);return _0x28c755+_0x238bf0+_0x28c755;}exports['getSummary']=function(_0x435f9e,_0x48fbfc,_0x3fdd01){var _0x33d394,_0x1093f4;var _0x38cb6e={'where':{'ProjectId':_0x435f9e['params']['id']}};if(_0x435f9e['query'][_0x6099('0x61')]){_0x38cb6e[_0x6099('0x3a')][_0x6099('0x62')]=JSON[_0x6099('0x63')](_0x435f9e[_0x6099('0x31')][_0x6099('0x61')]);}return db['JscriptySessionReport']['findAll'](_0x38cb6e)[_0x6099('0x21')](handleEntityNotFound(_0x48fbfc,null))[_0x6099('0x21')](function(_0x574706){if(_0x574706){_0x33d394=_0x574706;return db['JscriptyQuestionReport'][_0x6099('0x43')]({'where':{'SessionId':{'$in':_[_0x6099('0x2b')](_0x33d394,'id')},'ProjectId':_0x435f9e[_0x6099('0x47')]['id']},'order':_0x6099('0x64')});}})['then'](handleEntityNotFound(_0x48fbfc,null))['then'](function(_0x11274a){if(_0x11274a){_0x1093f4=_0x11274a;var _0x451b5f={};for(var _0x3aa8ba=0x0,_0x467873=_0x1093f4['length'];_0x3aa8ba<_0x467873;_0x3aa8ba++){if(!_0x451b5f[_0x6099('0x59')](_0x1093f4[_0x3aa8ba][_0x6099('0x65')])){_0x451b5f[_0x1093f4[_0x3aa8ba][_0x6099('0x65')]]=needsEncapsulation(_0x1093f4[_0x3aa8ba][_0x6099('0x66')])?encapsulate(_0x1093f4[_0x3aa8ba][_0x6099('0x66')]):_0x1093f4[_0x3aa8ba][_0x6099('0x66')];}}var _0x13bba6=[],_0x551ae5={};for(var _0x158d4=0x0,_0x32156f=_0x33d394[_0x6099('0x36')];_0x158d4<_0x32156f;_0x158d4++){_0x551ae5={'ProjectId':_0x435f9e[_0x6099('0x47')]['id'],'SessionId':_0x33d394[_0x158d4]['id'],'StartTime':moment(_0x33d394[_0x158d4]['starttime'])[_0x6099('0x67')](_0x6099('0x68'))};for(var _0x56e285=0x0,_0x578682=_0x1093f4[_0x6099('0x36')];_0x56e285<_0x578682;_0x56e285++){if(_0x1093f4[_0x56e285]['SessionId']==_0x33d394[_0x158d4]['id']&&_0x451b5f[_0x6099('0x59')](_0x1093f4[_0x56e285]['questionId'])){_0x551ae5[_0x451b5f[_0x1093f4[_0x56e285][_0x6099('0x65')]]]=_0x1093f4[_0x56e285][_0x6099('0x69')];}}for(var _0x3fa88b in _0x451b5f){if(!_0x551ae5[_0x6099('0x59')](_0x451b5f[_0x3fa88b])){_0x551ae5[_0x451b5f[_0x3fa88b]]=null;}}_0x13bba6[_0x6099('0x6a')](_0x551ae5);}return _0x13bba6;}})[_0x6099('0x21')](function(_0x4cf035){if(!_[_0x6099('0x6b')](_0x4cf035)){var _0x58bc10=toCsv(_0x4cf035);var _0x57d1e3=Date['now']();fs[_0x6099('0x6c')](util[_0x6099('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x435f9e['params']['id'],_0x57d1e3),_0x58bc10);_0x48fbfc[_0x6099('0x6d')](_0x6099('0x6e'),'attachment;\x20filename='+util[_0x6099('0x67')](_0x6099('0x6f'),_0x435f9e[_0x6099('0x47')]['id'],_0x57d1e3));_0x48fbfc[_0x6099('0x6d')]('Content-type',_0x6099('0x70'));return _0x48fbfc[_0x6099('0x71')](util[_0x6099('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x435f9e[_0x6099('0x47')]['id'],_0x57d1e3));}else{return _0x48fbfc[_0x6099('0x16')](0xcc);}})[_0x6099('0x45')](handleError(_0x48fbfc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e39c7d6..4329540 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 _0xf5be=['request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','moment','bluebird'];(function(_0x534346,_0x5c791e){var _0x16eb9f=function(_0xf109f){while(--_0xf109f){_0x534346['push'](_0x534346['shift']());}};_0x16eb9f(++_0x5c791e);}(_0xf5be,0x1e7));var _0xef5b=function(_0x858388,_0x269676){_0x858388=_0x858388-0x0;var _0x3acdba=_0xf5be[_0x858388];return _0x3acdba;};'use strict';var _=require(_0xef5b('0x0'));var util=require(_0xef5b('0x1'));var logger=require(_0xef5b('0x2'))('api');var moment=require(_0xef5b('0x3'));var BPromise=require(_0xef5b('0x4'));var rp=require(_0xef5b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef5b('0x6'));var config=require(_0xef5b('0x7'));var attributes=require(_0xef5b('0x8'));module[_0xef5b('0x9')]=function(_0x399aff,_0x591971){return _0x399aff[_0xef5b('0xa')](_0xef5b('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8809=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x625393,_0x56dde7){var _0x498c48=function(_0x276a9d){while(--_0x276a9d){_0x625393['push'](_0x625393['shift']());}};_0x498c48(++_0x56dde7);}(_0x8809,0x171));var _0x9880=function(_0x2a9658,_0x22f838){_0x2a9658=_0x2a9658-0x0;var _0x375348=_0x8809[_0x2a9658];return _0x375348;};'use strict';var _=require('lodash');var util=require(_0x9880('0x0'));var logger=require(_0x9880('0x1'))(_0x9880('0x2'));var moment=require(_0x9880('0x3'));var BPromise=require(_0x9880('0x4'));var rp=require(_0x9880('0x5'));var fs=require('fs');var path=require(_0x9880('0x6'));var rimraf=require(_0x9880('0x7'));var config=require(_0x9880('0x8'));var attributes=require(_0x9880('0x9'));module[_0x9880('0xa')]=function(_0x552323,_0x33dfe4){return _0x552323[_0x9880('0xb')](_0x9880('0xc'),attributes,{'tableName':_0x9880('0xd'),'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 5f3ccf8..3e52653 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 _0x8b3e=['util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x200c7f,_0x1e43de){var _0x5950c1=function(_0x253d8c){while(--_0x253d8c){_0x200c7f['push'](_0x200c7f['shift']());}};_0x5950c1(++_0x1e43de);}(_0x8b3e,0x68));var _0xe8b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8b3('0x0'));var util=require(_0xe8b3('0x1'));var moment=require('moment');var BPromise=require(_0xe8b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8b3('0x3'));var db=require(_0xe8b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8b3('0x5'))('rpc');var config=require(_0xe8b3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe8b3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21a558,_0x44f807,_0xe72224){return new BPromise(function(_0x260a41,_0x3ec18c){return client[_0xe8b3('0x8')](_0x21a558,_0xe72224)[_0xe8b3('0x9')](function(_0x244390){logger[_0xe8b3('0xa')](_0xe8b3('0xb'),_0x44f807,_0xe8b3('0xc'));logger[_0xe8b3('0xd')](_0xe8b3('0xe'),_0x44f807,_0xe8b3('0xc'),JSON[_0xe8b3('0xf')](_0x244390));if(_0x244390[_0xe8b3('0x10')]){if(_0x244390['error'][_0xe8b3('0x11')]===0x1f4){logger[_0xe8b3('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x44f807,_0x244390[_0xe8b3('0x10')][_0xe8b3('0x12')]);return _0x3ec18c(_0x244390[_0xe8b3('0x10')]['message']);}logger[_0xe8b3('0x10')](_0xe8b3('0xb'),_0x44f807,_0x244390['error']['message']);return _0x260a41(_0x244390[_0xe8b3('0x10')][_0xe8b3('0x12')]);}else{logger[_0xe8b3('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x44f807,'request\x20sent');_0x260a41(_0x244390[_0xe8b3('0x13')][_0xe8b3('0x12')]);}})[_0xe8b3('0x14')](function(_0x21a53e){logger[_0xe8b3('0x10')](_0xe8b3('0xb'),_0x44f807,_0x21a53e);_0x3ec18c(_0x21a53e);});});} \ No newline at end of file +var _0x55f2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','randomstring','ioredis'];(function(_0x79f71b,_0x4946d2){var _0x2495af=function(_0x82572){while(--_0x82572){_0x79f71b['push'](_0x79f71b['shift']());}};_0x2495af(++_0x4946d2);}(_0x55f2,0x8f));var _0x255f=function(_0x118ef3,_0x5dc914){_0x118ef3=_0x118ef3-0x0;var _0x1f50d0=_0x55f2[_0x118ef3];return _0x1f50d0;};'use strict';var _=require(_0x255f('0x0'));var util=require(_0x255f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x255f('0x2'));var fs=require('fs');var Redis=require(_0x255f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x255f('0x4'));var logger=require(_0x255f('0x5'))(_0x255f('0x6'));var config=require(_0x255f('0x7'));var jayson=require(_0x255f('0x8'));var client=jayson[_0x255f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2163c7,_0x1844d2,_0x3f0cc1){return new BPromise(function(_0x38c637,_0x3035e6){return client['request'](_0x2163c7,_0x3f0cc1)[_0x255f('0xa')](function(_0x14d698){logger['info'](_0x255f('0xb'),_0x1844d2,_0x255f('0xc'));logger['debug'](_0x255f('0xd'),_0x1844d2,'request\x20sent',JSON[_0x255f('0xe')](_0x14d698));if(_0x14d698['error']){if(_0x14d698['error'][_0x255f('0xf')]===0x1f4){logger[_0x255f('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x1844d2,_0x14d698[_0x255f('0x10')][_0x255f('0x11')]);return _0x3035e6(_0x14d698[_0x255f('0x10')][_0x255f('0x11')]);}logger[_0x255f('0x10')](_0x255f('0xb'),_0x1844d2,_0x14d698[_0x255f('0x10')][_0x255f('0x11')]);return _0x38c637(_0x14d698[_0x255f('0x10')][_0x255f('0x11')]);}else{logger[_0x255f('0x12')](_0x255f('0xb'),_0x1844d2,_0x255f('0xc'));_0x38c637(_0x14d698[_0x255f('0x13')]['message']);}})[_0x255f('0x14')](function(_0x523d41){logger[_0x255f('0x10')](_0x255f('0xb'),_0x1844d2,_0x523d41);_0x3035e6(_0x523d41);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 8c4e940..4718bcb 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 _0x781e=['/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x9f7af3,_0x4f4872){var _0x2a1d6d=function(_0x3d9484){while(--_0x3d9484){_0x9f7af3['push'](_0x9f7af3['shift']());}};_0x2a1d6d(++_0x4f4872);}(_0x781e,0x15e));var _0xe781=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x781e[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xe781('0x0'));var util=require(_0xe781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe781('0x2'));var router=express[_0xe781('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe781('0x4'));var config=require(_0xe781('0x5'));var controller=require(_0xe781('0x6'));router[_0xe781('0x7')]('/',auth[_0xe781('0x8')](),controller[_0xe781('0x9')]);router[_0xe781('0x7')](_0xe781('0xa'),auth[_0xe781('0x8')](),controller[_0xe781('0xb')]);router[_0xe781('0x7')](_0xe781('0xc'),auth[_0xe781('0x8')](),controller[_0xe781('0xd')]);router[_0xe781('0xe')]('/',auth[_0xe781('0x8')](),controller[_0xe781('0xf')]);router[_0xe781('0x10')](_0xe781('0xc'),auth[_0xe781('0x8')](),controller[_0xe781('0x11')]);router['delete'](_0xe781('0xc'),auth['isAuthenticated'](),controller[_0xe781('0x12')]);module[_0xe781('0x13')]=router; \ No newline at end of file +var _0x416f=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x33356b,_0x2d0bb7){var _0x47d078=function(_0xee36d6){while(--_0xee36d6){_0x33356b['push'](_0x33356b['shift']());}};_0x47d078(++_0x2d0bb7);}(_0x416f,0x179));var _0xf416=function(_0x5ae0b6,_0x218d06){_0x5ae0b6=_0x5ae0b6-0x0;var _0x226f10=_0x416f[_0x5ae0b6];return _0x226f10;};'use strict';var multer=require(_0xf416('0x0'));var util=require(_0xf416('0x1'));var path=require(_0xf416('0x2'));var timeout=require(_0xf416('0x3'));var express=require(_0xf416('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf416('0x5'));var config=require(_0xf416('0x6'));var controller=require(_0xf416('0x7'));router[_0xf416('0x8')]('/',auth[_0xf416('0x9')](),controller[_0xf416('0xa')]);router[_0xf416('0x8')](_0xf416('0xb'),auth[_0xf416('0x9')](),controller[_0xf416('0xc')]);router['get'](_0xf416('0xd'),auth[_0xf416('0x9')](),controller[_0xf416('0xe')]);router[_0xf416('0xf')]('/',auth[_0xf416('0x9')](),controller[_0xf416('0x10')]);router['put'](_0xf416('0xd'),auth[_0xf416('0x9')](),controller[_0xf416('0x11')]);router[_0xf416('0x12')]('/:id',auth[_0xf416('0x9')](),controller[_0xf416('0x13')]);module[_0xf416('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 53a197b..fb08bb2 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 _0x456c=['STRING','TEXT','long'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x456c,0x190));var _0xc456=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0x456c[_0x3ebbcd];return _0x210c43;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xc456('0x0')](_0xc456('0x1'))},'membername':{'type':Sequelize[_0xc456('0x2')]},'projectname':{'type':Sequelize[_0xc456('0x2')]},'queue':{'type':Sequelize[_0xc456('0x2')]},'uniqueid':{'type':Sequelize[_0xc456('0x2')]},'calleridname':{'type':Sequelize[_0xc456('0x2')]},'calleridnum':{'type':Sequelize[_0xc456('0x2')]},'questionId':{'type':Sequelize[_0xc456('0x2')]}}; \ No newline at end of file +var _0xafdd=['TEXT','long','sequelize','exports','STRING'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xafdd,0x129));var _0xdafd=function(_0x3f9bc8,_0x2a8872){_0x3f9bc8=_0x3f9bc8-0x0;var _0x2e843b=_0xafdd[_0x3f9bc8];return _0x2e843b;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'question':{'type':Sequelize[_0xdafd('0x2')]},'answer':{'type':Sequelize[_0xdafd('0x3')](_0xdafd('0x4'))},'membername':{'type':Sequelize[_0xdafd('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xdafd('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdafd('0x2')]},'calleridnum':{'type':Sequelize[_0xdafd('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index e32e935..752e4a0 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 _0xd33d=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','apply','reject','save','then','sendStatus','error','name','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xc21ae,_0x173f65){var _0x358c22=function(_0x2445d3){while(--_0x2445d3){_0xc21ae['push'](_0xc21ae['shift']());}};_0x358c22(++_0x173f65);}(_0xd33d,0x7a));var _0xdd33=function(_0x95fc3d,_0x10dc31){_0x95fc3d=_0x95fc3d-0x0;var _0x159c86=_0xd33d[_0x95fc3d];return _0x159c86;};'use strict';var pdf=require(_0xdd33('0x0'));var emlformat=require(_0xdd33('0x1'));var rimraf=require(_0xdd33('0x2'));var zipdir=require(_0xdd33('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd33('0x4'));var moment=require(_0xdd33('0x5'));var BPromise=require(_0xdd33('0x6'));var Mustache=require('mustache');var util=require(_0xdd33('0x7'));var path=require(_0xdd33('0x8'));var sox=require(_0xdd33('0x9'));var csv=require(_0xdd33('0xa'));var ejs=require(_0xdd33('0xb'));var fs=require('fs');var _=require(_0xdd33('0xc'));var squel=require(_0xdd33('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd33('0xe'));var deskjs=require(_0xdd33('0xf'));var toCsv=require(_0xdd33('0xa'));var querystring=require(_0xdd33('0x10'));var Papa=require(_0xdd33('0x11'));var Redis=require(_0xdd33('0x12'));var authService=require(_0xdd33('0x13'));var qs=require(_0xdd33('0x14'));var as=require(_0xdd33('0x15'));var hardwareService=require(_0xdd33('0x16'));var logger=require(_0xdd33('0x17'))('api');var utils=require(_0xdd33('0x18'));var config=require(_0xdd33('0x19'));var db=require(_0xdd33('0x1a'))['db'];function respondWithStatusCode(_0x58db09,_0x216376){_0x216376=_0x216376||0xcc;return function(_0x534413){if(_0x534413){return _0x58db09['sendStatus'](_0x216376);}return _0x58db09[_0xdd33('0x1b')](_0x216376)[_0xdd33('0x1c')]();};}function respondWithResult(_0x1af194,_0x4be3fc){_0x4be3fc=_0x4be3fc||0xc8;return function(_0x1911ce){if(_0x1911ce){return _0x1af194[_0xdd33('0x1b')](_0x4be3fc)['json'](_0x1911ce);}};}function respondWithFilteredResult(_0x47ec89,_0x27a637){return function(_0x1c3b57){if(_0x1c3b57){var _0x24a96d=_0x1c3b57[_0xdd33('0x1d')],_0x2507f9=_0x27a637[_0xdd33('0x1e')],_0x178699=_0x27a637[_0xdd33('0x1e')]+_0x27a637['limit'],_0x2721bd;if(_0x178699>=_0x24a96d){_0x178699=_0x24a96d;_0x2721bd=0xc8;}else{_0x2721bd=0xce;}_0x47ec89[_0xdd33('0x1b')](_0x2721bd);return _0x47ec89['set'](_0xdd33('0x1f'),_0x2507f9+'-'+_0x178699+'/'+_0x24a96d)['json'](_0x1c3b57);}return null;};}function patchUpdates(_0x1ac4ab){return function(_0x225d3f){try{jsonpatch[_0xdd33('0x20')](_0x225d3f,_0x1ac4ab,!![]);}catch(_0x12db2a){return BPromise[_0xdd33('0x21')](_0x12db2a);}return _0x225d3f[_0xdd33('0x22')]();};}function saveUpdates(_0x4a5066,_0xcf63b3){return function(_0x196625){if(_0x196625){return _0x196625['update'](_0x4a5066)[_0xdd33('0x23')](function(_0x467113){return _0x467113;});}return null;};}function removeEntity(_0x35bc39,_0x27ca72){return function(_0x1aa268){if(_0x1aa268){return _0x1aa268['destroy']()[_0xdd33('0x23')](function(){_0x35bc39[_0xdd33('0x1b')](0xcc)[_0xdd33('0x1c')]();});}};}function handleEntityNotFound(_0x164212,_0xa56fac){return function(_0x72b0a3){if(!_0x72b0a3){_0x164212[_0xdd33('0x24')](0x194);}return _0x72b0a3;};}function handleError(_0x49507d,_0x785a0a){_0x785a0a=_0x785a0a||0x1f4;return function(_0x1bf8b4){logger[_0xdd33('0x25')](_0x1bf8b4['stack']);if(_0x1bf8b4[_0xdd33('0x26')]){delete _0x1bf8b4[_0xdd33('0x26')];}_0x49507d[_0xdd33('0x1b')](_0x785a0a)['send'](_0x1bf8b4);};}exports['index']=function(_0x1b41a0,_0x33ec25){var _0x5ab037={},_0x3cd3e9={},_0x30e010={'count':0x0,'rows':[]};var _0xb2b083=_[_0xdd33('0x27')](db[_0xdd33('0x28')]['rawAttributes'],function(_0x557f72){return{'name':_0x557f72[_0xdd33('0x29')],'type':_0x557f72[_0xdd33('0x2a')][_0xdd33('0x2b')]};});_0x3cd3e9[_0xdd33('0x2c')]=_[_0xdd33('0x27')](_0xb2b083,_0xdd33('0x26'));_0x3cd3e9[_0xdd33('0x2d')]=_[_0xdd33('0x2e')](_0x1b41a0[_0xdd33('0x2d')]);_0x3cd3e9['filters']=_[_0xdd33('0x2f')](_0x3cd3e9['model'],_0x3cd3e9[_0xdd33('0x2d')]);_0x5ab037['attributes']=_[_0xdd33('0x2f')](_0x3cd3e9[_0xdd33('0x2c')],qs[_0xdd33('0x30')](_0x1b41a0['query'][_0xdd33('0x30')]));_0x5ab037['attributes']=_0x5ab037[_0xdd33('0x31')][_0xdd33('0x32')]?_0x5ab037[_0xdd33('0x31')]:_0x3cd3e9['model'];if(!_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x33')]('nolimit')){_0x5ab037[_0xdd33('0x34')]=qs[_0xdd33('0x34')](_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x34')]);_0x5ab037['offset']=qs[_0xdd33('0x1e')](_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x1e')]);}_0x5ab037[_0xdd33('0x35')]=qs['sort'](_0x1b41a0['query']['sort']);_0x5ab037[_0xdd33('0x36')]=qs[_0xdd33('0x37')](_['pick'](_0x1b41a0[_0xdd33('0x2d')],_0x3cd3e9['filters']),_0xb2b083);if(_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x38')]){_0x5ab037['where']=_[_0xdd33('0x39')](_0x5ab037[_0xdd33('0x36')],{'$or':_['map'](_0xb2b083,function(_0x530208){if(_0x530208[_0xdd33('0x2a')]!==_0xdd33('0x3a')){var _0x46f598={};_0x46f598[_0x530208[_0xdd33('0x26')]]={'$like':'%'+_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x38')]+'%'};return _0x46f598;}})});}_0x5ab037=_['merge']({},_0x5ab037,_0x1b41a0['options']);var _0x458e72={'where':_0x5ab037['where']};return db[_0xdd33('0x28')][_0xdd33('0x1d')](_0x458e72)[_0xdd33('0x23')](function(_0x333c04){_0x30e010[_0xdd33('0x1d')]=_0x333c04;if(_0x1b41a0[_0xdd33('0x2d')][_0xdd33('0x3b')]){_0x5ab037['include']=[{'all':!![]}];}return db[_0xdd33('0x28')][_0xdd33('0x3c')](_0x5ab037);})[_0xdd33('0x23')](function(_0x4b746b){_0x30e010[_0xdd33('0x3d')]=_0x4b746b;return _0x30e010;})['then'](respondWithFilteredResult(_0x33ec25,_0x5ab037))[_0xdd33('0x3e')](handleError(_0x33ec25,null));};exports[_0xdd33('0x3f')]=function(_0x36e479,_0x1c42c0){var _0xe32045={'raw':!![],'where':{'id':_0x36e479[_0xdd33('0x40')]['id']}},_0x1a9749={};_0x1a9749[_0xdd33('0x2c')]=_[_0xdd33('0x2e')](db[_0xdd33('0x28')][_0xdd33('0x41')]);_0x1a9749[_0xdd33('0x2d')]=_[_0xdd33('0x2e')](_0x36e479[_0xdd33('0x2d')]);_0x1a9749[_0xdd33('0x37')]=_[_0xdd33('0x2f')](_0x1a9749['model'],_0x1a9749[_0xdd33('0x2d')]);_0xe32045[_0xdd33('0x31')]=_[_0xdd33('0x2f')](_0x1a9749[_0xdd33('0x2c')],qs[_0xdd33('0x30')](_0x36e479[_0xdd33('0x2d')][_0xdd33('0x30')]));_0xe32045[_0xdd33('0x31')]=_0xe32045[_0xdd33('0x31')]['length']?_0xe32045[_0xdd33('0x31')]:_0x1a9749['model'];if(_0x36e479[_0xdd33('0x2d')]['includeAll']){_0xe32045['include']=[{'all':!![]}];}_0xe32045=_['merge']({},_0xe32045,_0x36e479[_0xdd33('0x42')]);return db['JscriptyQuestionReport'][_0xdd33('0x43')](_0xe32045)[_0xdd33('0x23')](handleEntityNotFound(_0x1c42c0,null))[_0xdd33('0x23')](respondWithResult(_0x1c42c0,null))['catch'](handleError(_0x1c42c0,null));};exports[_0xdd33('0x44')]=function(_0x35e4c2,_0x65abed){return db['JscriptyQuestionReport'][_0xdd33('0x44')](_0x35e4c2[_0xdd33('0x45')],{})[_0xdd33('0x23')](respondWithResult(_0x65abed,0xc9))[_0xdd33('0x3e')](handleError(_0x65abed,null));};exports[_0xdd33('0x46')]=function(_0x24a84b,_0x31b815){if(_0x24a84b[_0xdd33('0x45')]['id']){delete _0x24a84b[_0xdd33('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xdd33('0x43')]({'where':{'id':_0x24a84b['params']['id']}})[_0xdd33('0x23')](handleEntityNotFound(_0x31b815,null))['then'](saveUpdates(_0x24a84b[_0xdd33('0x45')],null))['then'](respondWithResult(_0x31b815,null))[_0xdd33('0x3e')](handleError(_0x31b815,null));};exports['destroy']=function(_0x475754,_0x16cc8b){return db[_0xdd33('0x28')][_0xdd33('0x43')]({'where':{'id':_0x475754[_0xdd33('0x40')]['id']}})['then'](handleEntityNotFound(_0x16cc8b,null))[_0xdd33('0x23')](removeEntity(_0x16cc8b,null))['catch'](handleError(_0x16cc8b,null));};exports[_0xdd33('0x47')]=function(_0x34c7fa,_0x2bbd82){return db['JscriptyQuestionReport'][_0xdd33('0x47')]()[_0xdd33('0x23')](respondWithResult(_0x2bbd82,null))[_0xdd33('0x3e')](handleError(_0x2bbd82,null));}; \ No newline at end of file +var _0x8d30=['rimraf','fast-json-patch','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','JscriptyQuestionReport','then','count','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','describe','html-pdf'];(function(_0x3341bf,_0x3230bf){var _0x3cf9c7=function(_0x25f3ce){while(--_0x25f3ce){_0x3341bf['push'](_0x3341bf['shift']());}};_0x3cf9c7(++_0x3230bf);}(_0x8d30,0x87));var _0x08d3=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x8d30[_0x1b5aea];return _0x15cfc6;};'use strict';var pdf=require(_0x08d3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x08d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x08d3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x08d3('0x4'));var csv=require(_0x08d3('0x5'));var ejs=require(_0x08d3('0x6'));var fs=require('fs');var _=require(_0x08d3('0x7'));var squel=require('squel');var crypto=require(_0x08d3('0x8'));var jsforce=require(_0x08d3('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x08d3('0x5'));var querystring=require(_0x08d3('0xa'));var Papa=require(_0x08d3('0xb'));var Redis=require(_0x08d3('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x08d3('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x08d3('0xe'));var utils=require(_0x08d3('0xf'));var config=require(_0x08d3('0x10'));var db=require(_0x08d3('0x11'))['db'];function respondWithStatusCode(_0x405521,_0x58da33){_0x58da33=_0x58da33||0xcc;return function(_0x529796){if(_0x529796){return _0x405521['sendStatus'](_0x58da33);}return _0x405521[_0x08d3('0x12')](_0x58da33)[_0x08d3('0x13')]();};}function respondWithResult(_0x4067e0,_0x5dde0c){_0x5dde0c=_0x5dde0c||0xc8;return function(_0x1bc76d){if(_0x1bc76d){return _0x4067e0[_0x08d3('0x12')](_0x5dde0c)['json'](_0x1bc76d);}};}function respondWithFilteredResult(_0x331945,_0x414153){return function(_0xad66ba){if(_0xad66ba){var _0x981780=_0xad66ba['count'],_0x28f8ee=_0x414153[_0x08d3('0x14')],_0x45740d=_0x414153[_0x08d3('0x14')]+_0x414153[_0x08d3('0x15')],_0x4b8f43;if(_0x45740d>=_0x981780){_0x45740d=_0x981780;_0x4b8f43=0xc8;}else{_0x4b8f43=0xce;}_0x331945[_0x08d3('0x12')](_0x4b8f43);return _0x331945[_0x08d3('0x16')](_0x08d3('0x17'),_0x28f8ee+'-'+_0x45740d+'/'+_0x981780)[_0x08d3('0x18')](_0xad66ba);}return null;};}function patchUpdates(_0x27367f){return function(_0x211371){try{jsonpatch[_0x08d3('0x19')](_0x211371,_0x27367f,!![]);}catch(_0xffdfce){return BPromise[_0x08d3('0x1a')](_0xffdfce);}return _0x211371[_0x08d3('0x1b')]();};}function saveUpdates(_0x2afcc2,_0xfac918){return function(_0x5da1b4){if(_0x5da1b4){return _0x5da1b4[_0x08d3('0x1c')](_0x2afcc2)['then'](function(_0x2f5756){return _0x2f5756;});}return null;};}function removeEntity(_0x4dba73,_0x1dec42){return function(_0x1e2483){if(_0x1e2483){return _0x1e2483[_0x08d3('0x1d')]()['then'](function(){_0x4dba73[_0x08d3('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ab66,_0x2dbb36){return function(_0x3aefe6){if(!_0x3aefe6){_0x39ab66['sendStatus'](0x194);}return _0x3aefe6;};}function handleError(_0x4544ea,_0x56ad3a){_0x56ad3a=_0x56ad3a||0x1f4;return function(_0x77c090){logger[_0x08d3('0x1e')](_0x77c090[_0x08d3('0x1f')]);if(_0x77c090['name']){delete _0x77c090[_0x08d3('0x20')];}_0x4544ea[_0x08d3('0x12')](_0x56ad3a)[_0x08d3('0x21')](_0x77c090);};}exports[_0x08d3('0x22')]=function(_0x219dd3,_0x1e2a05){var _0x317588={},_0x355de4={},_0x2ac122={'count':0x0,'rows':[]};var _0xb5eda4=_['map'](db['JscriptyQuestionReport'][_0x08d3('0x23')],function(_0x4654b4){return{'name':_0x4654b4[_0x08d3('0x24')],'type':_0x4654b4['type']['key']};});_0x355de4[_0x08d3('0x25')]=_[_0x08d3('0x26')](_0xb5eda4,_0x08d3('0x20'));_0x355de4['query']=_[_0x08d3('0x27')](_0x219dd3[_0x08d3('0x28')]);_0x355de4['filters']=_[_0x08d3('0x29')](_0x355de4[_0x08d3('0x25')],_0x355de4[_0x08d3('0x28')]);_0x317588[_0x08d3('0x2a')]=_['intersection'](_0x355de4[_0x08d3('0x25')],qs['fields'](_0x219dd3[_0x08d3('0x28')]['fields']));_0x317588[_0x08d3('0x2a')]=_0x317588[_0x08d3('0x2a')][_0x08d3('0x2b')]?_0x317588[_0x08d3('0x2a')]:_0x355de4[_0x08d3('0x25')];if(!_0x219dd3[_0x08d3('0x28')][_0x08d3('0x2c')](_0x08d3('0x2d'))){_0x317588['limit']=qs[_0x08d3('0x15')](_0x219dd3[_0x08d3('0x28')][_0x08d3('0x15')]);_0x317588[_0x08d3('0x14')]=qs[_0x08d3('0x14')](_0x219dd3[_0x08d3('0x28')]['offset']);}_0x317588['order']=qs[_0x08d3('0x2e')](_0x219dd3[_0x08d3('0x28')][_0x08d3('0x2e')]);_0x317588[_0x08d3('0x2f')]=qs[_0x08d3('0x30')](_[_0x08d3('0x31')](_0x219dd3[_0x08d3('0x28')],_0x355de4[_0x08d3('0x30')]),_0xb5eda4);if(_0x219dd3[_0x08d3('0x28')]['filter']){_0x317588[_0x08d3('0x2f')]=_[_0x08d3('0x32')](_0x317588[_0x08d3('0x2f')],{'$or':_[_0x08d3('0x26')](_0xb5eda4,function(_0x4529c4){if(_0x4529c4[_0x08d3('0x33')]!==_0x08d3('0x34')){var _0xb3ab99={};_0xb3ab99[_0x4529c4[_0x08d3('0x20')]]={'$like':'%'+_0x219dd3[_0x08d3('0x28')]['filter']+'%'};return _0xb3ab99;}})});}_0x317588=_[_0x08d3('0x32')]({},_0x317588,_0x219dd3['options']);var _0x531025={'where':_0x317588[_0x08d3('0x2f')]};return db[_0x08d3('0x35')]['count'](_0x531025)[_0x08d3('0x36')](function(_0x6ac022){_0x2ac122[_0x08d3('0x37')]=_0x6ac022;if(_0x219dd3[_0x08d3('0x28')][_0x08d3('0x38')]){_0x317588[_0x08d3('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x08d3('0x3a')](_0x317588);})['then'](function(_0x575bd9){_0x2ac122[_0x08d3('0x3b')]=_0x575bd9;return _0x2ac122;})[_0x08d3('0x36')](respondWithFilteredResult(_0x1e2a05,_0x317588))['catch'](handleError(_0x1e2a05,null));};exports[_0x08d3('0x3c')]=function(_0x3e2884,_0x5bca85){var _0x123b72={'raw':!![],'where':{'id':_0x3e2884[_0x08d3('0x3d')]['id']}},_0x40d2fb={};_0x40d2fb[_0x08d3('0x25')]=_[_0x08d3('0x27')](db[_0x08d3('0x35')]['rawAttributes']);_0x40d2fb['query']=_[_0x08d3('0x27')](_0x3e2884[_0x08d3('0x28')]);_0x40d2fb['filters']=_[_0x08d3('0x29')](_0x40d2fb['model'],_0x40d2fb['query']);_0x123b72['attributes']=_[_0x08d3('0x29')](_0x40d2fb[_0x08d3('0x25')],qs[_0x08d3('0x3e')](_0x3e2884[_0x08d3('0x28')][_0x08d3('0x3e')]));_0x123b72[_0x08d3('0x2a')]=_0x123b72[_0x08d3('0x2a')]['length']?_0x123b72[_0x08d3('0x2a')]:_0x40d2fb[_0x08d3('0x25')];if(_0x3e2884['query'][_0x08d3('0x38')]){_0x123b72[_0x08d3('0x39')]=[{'all':!![]}];}_0x123b72=_[_0x08d3('0x32')]({},_0x123b72,_0x3e2884['options']);return db[_0x08d3('0x35')][_0x08d3('0x3f')](_0x123b72)['then'](handleEntityNotFound(_0x5bca85,null))['then'](respondWithResult(_0x5bca85,null))[_0x08d3('0x40')](handleError(_0x5bca85,null));};exports['create']=function(_0x367017,_0x500d2c){return db['JscriptyQuestionReport'][_0x08d3('0x41')](_0x367017[_0x08d3('0x42')],{})[_0x08d3('0x36')](respondWithResult(_0x500d2c,0xc9))[_0x08d3('0x40')](handleError(_0x500d2c,null));};exports['update']=function(_0x62276f,_0x1f2f6e){if(_0x62276f[_0x08d3('0x42')]['id']){delete _0x62276f[_0x08d3('0x42')]['id'];}return db[_0x08d3('0x35')]['find']({'where':{'id':_0x62276f[_0x08d3('0x3d')]['id']}})[_0x08d3('0x36')](handleEntityNotFound(_0x1f2f6e,null))['then'](saveUpdates(_0x62276f['body'],null))[_0x08d3('0x36')](respondWithResult(_0x1f2f6e,null))['catch'](handleError(_0x1f2f6e,null));};exports[_0x08d3('0x1d')]=function(_0x43df04,_0x16c33d){return db[_0x08d3('0x35')][_0x08d3('0x3f')]({'where':{'id':_0x43df04[_0x08d3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16c33d,null))[_0x08d3('0x36')](removeEntity(_0x16c33d,null))[_0x08d3('0x40')](handleError(_0x16c33d,null));};exports[_0x08d3('0x43')]=function(_0x4ff01c,_0x137be6){return db['JscriptyQuestionReport'][_0x08d3('0x43')]()[_0x08d3('0x36')](respondWithResult(_0x137be6,null))[_0x08d3('0x40')](handleError(_0x137be6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 25afc5a..96c22fc 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 _0x06fe=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','lodash','util','../../config/logger'];(function(_0x1bc4d1,_0x1530d0){var _0x34abaf=function(_0x2508b9){while(--_0x2508b9){_0x1bc4d1['push'](_0x1bc4d1['shift']());}};_0x34abaf(++_0x1530d0);}(_0x06fe,0x1e1));var _0xe06f=function(_0x52c538,_0x48f45a){_0x52c538=_0x52c538-0x0;var _0x33cb72=_0x06fe[_0x52c538];return _0x33cb72;};'use strict';var _=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var logger=require(_0xe06f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe06f('0x3'));var rp=require(_0xe06f('0x4'));var fs=require('fs');var path=require(_0xe06f('0x5'));var rimraf=require(_0xe06f('0x6'));var config=require(_0xe06f('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe06f('0x8')]=function(_0x2474d3,_0x22a778){return _0x2474d3[_0xe06f('0x9')](_0xe06f('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd04=['request-promise','rimraf','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment'];(function(_0x40ebc3,_0x5b7f78){var _0x1d8b08=function(_0x367fdd){while(--_0x367fdd){_0x40ebc3['push'](_0x40ebc3['shift']());}};_0x1d8b08(++_0x5b7f78);}(_0xdd04,0xb5));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4dd0('0x0'));var logger=require(_0x4dd0('0x1'))('api');var moment=require(_0x4dd0('0x2'));var BPromise=require('bluebird');var rp=require(_0x4dd0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dd0('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x59f282,_0x3d2f26){return _0x59f282[_0x4dd0('0x5')](_0x4dd0('0x6'),attributes,{'tableName':_0x4dd0('0x7'),'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 d38da57..0e19069 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 _0x6443=['info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','JscriptyQuestionReport,\x20%s,\x20%s','message'];(function(_0x55f10e,_0x3e3923){var _0x367a61=function(_0x4ce63f){while(--_0x4ce63f){_0x55f10e['push'](_0x55f10e['shift']());}};_0x367a61(++_0x3e3923);}(_0x6443,0x17d));var _0x3644=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0x6443[_0x4e4519];return _0x340044;};'use strict';var _=require('lodash');var util=require(_0x3644('0x0'));var moment=require(_0x3644('0x1'));var BPromise=require(_0x3644('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3644('0x3'));var db=require(_0x3644('0x4'))['db'];var utils=require(_0x3644('0x5'));var logger=require('../../config/logger')(_0x3644('0x6'));var config=require(_0x3644('0x7'));var jayson=require(_0x3644('0x8'));var client=jayson[_0x3644('0x9')][_0x3644('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c39ec,_0xccae8d,_0x451e7c){return new BPromise(function(_0xffcd36,_0x6b9969){return client[_0x3644('0xb')](_0x4c39ec,_0x451e7c)['then'](function(_0x372ac6){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xccae8d,_0x3644('0xc'));logger[_0x3644('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xccae8d,'request\x20sent',JSON[_0x3644('0xe')](_0x372ac6));if(_0x372ac6[_0x3644('0xf')]){if(_0x372ac6[_0x3644('0xf')]['code']===0x1f4){logger['error'](_0x3644('0x10'),_0xccae8d,_0x372ac6[_0x3644('0xf')]['message']);return _0x6b9969(_0x372ac6[_0x3644('0xf')][_0x3644('0x11')]);}logger[_0x3644('0xf')](_0x3644('0x10'),_0xccae8d,_0x372ac6['error'][_0x3644('0x11')]);return _0xffcd36(_0x372ac6['error'][_0x3644('0x11')]);}else{logger[_0x3644('0x12')](_0x3644('0x10'),_0xccae8d,_0x3644('0xc'));_0xffcd36(_0x372ac6[_0x3644('0x13')]['message']);}})[_0x3644('0x14')](function(_0x2324e9){logger[_0x3644('0xf')](_0x3644('0x10'),_0xccae8d,_0x2324e9);_0x6b9969(_0x2324e9);});});} \ No newline at end of file +var _0x1c34=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59344e,_0x1a60de){var _0x5b3979=function(_0x6d626e){while(--_0x6d626e){_0x59344e['push'](_0x59344e['shift']());}};_0x5b3979(++_0x1a60de);}(_0x1c34,0x1aa));var _0x41c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c34[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41c3('0x0'));var util=require(_0x41c3('0x1'));var moment=require(_0x41c3('0x2'));var BPromise=require(_0x41c3('0x3'));var rs=require(_0x41c3('0x4'));var fs=require('fs');var Redis=require(_0x41c3('0x5'));var db=require(_0x41c3('0x6'))['db'];var utils=require(_0x41c3('0x7'));var logger=require(_0x41c3('0x8'))(_0x41c3('0x9'));var config=require(_0x41c3('0xa'));var jayson=require(_0x41c3('0xb'));var client=jayson[_0x41c3('0xc')][_0x41c3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40166c,_0x4bf814,_0x4a3063){return new BPromise(function(_0x213e50,_0x5288d7){return client[_0x41c3('0xe')](_0x40166c,_0x4a3063)['then'](function(_0x345659){logger['info'](_0x41c3('0xf'),_0x4bf814,_0x41c3('0x10'));logger[_0x41c3('0x11')](_0x41c3('0x12'),_0x4bf814,_0x41c3('0x10'),JSON[_0x41c3('0x13')](_0x345659));if(_0x345659['error']){if(_0x345659[_0x41c3('0x14')][_0x41c3('0x15')]===0x1f4){logger[_0x41c3('0x14')](_0x41c3('0xf'),_0x4bf814,_0x345659[_0x41c3('0x14')]['message']);return _0x5288d7(_0x345659['error'][_0x41c3('0x16')]);}logger[_0x41c3('0x14')](_0x41c3('0xf'),_0x4bf814,_0x345659[_0x41c3('0x14')][_0x41c3('0x16')]);return _0x213e50(_0x345659[_0x41c3('0x14')][_0x41c3('0x16')]);}else{logger['info'](_0x41c3('0xf'),_0x4bf814,'request\x20sent');_0x213e50(_0x345659[_0x41c3('0x17')][_0x41c3('0x16')]);}})[_0x41c3('0x18')](function(_0x3d9de8){logger[_0x41c3('0x14')](_0x41c3('0xf'),_0x4bf814,_0x3d9de8);_0x5288d7(_0x3d9de8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1b76e42..6f2a9d2 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 _0xb18e=['create','put','update','/:id','exports','path','express','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xb18e,0x181));var _0xeb18=function(_0x3c6b7d,_0x5f0d90){_0x3c6b7d=_0x3c6b7d-0x0;var _0x1d3ed2=_0xb18e[_0x3c6b7d];return _0x1d3ed2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeb18('0x0'));var timeout=require('connect-timeout');var express=require(_0xeb18('0x1'));var router=express['Router']();var auth=require(_0xeb18('0x2'));var interaction=require(_0xeb18('0x3'));var config=require('../../config/environment');var controller=require(_0xeb18('0x4'));router[_0xeb18('0x5')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0x7')]);router[_0xeb18('0x5')](_0xeb18('0x8'),auth['isAuthenticated'](),controller[_0xeb18('0x9')]);router[_0xeb18('0x5')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0xa')]);router[_0xeb18('0x5')](_0xeb18('0xb'),auth[_0xeb18('0x6')](),controller[_0xeb18('0xc')]);router[_0xeb18('0xd')]('/',auth[_0xeb18('0x6')](),controller[_0xeb18('0xe')]);router[_0xeb18('0xf')]('/:id',auth[_0xeb18('0x6')](),controller[_0xeb18('0x10')]);router['delete'](_0xeb18('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb18('0x12')]=router; \ No newline at end of file +var _0xeb5d=['update','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','put'];(function(_0x150322,_0x2199fb){var _0x606a08=function(_0x22cace){while(--_0x22cace){_0x150322['push'](_0x150322['shift']());}};_0x606a08(++_0x2199fb);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xeb5d[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0xdeb5('0x0'));var path=require(_0xdeb5('0x1'));var timeout=require(_0xdeb5('0x2'));var express=require(_0xdeb5('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdeb5('0x4'));var config=require(_0xdeb5('0x5'));var controller=require('./jscriptySessionReport.controller');router[_0xdeb5('0x6')]('/',auth[_0xdeb5('0x7')](),controller[_0xdeb5('0x8')]);router[_0xdeb5('0x6')](_0xdeb5('0x9'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xa')]);router[_0xdeb5('0x6')](_0xdeb5('0xb'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xc')]);router[_0xdeb5('0x6')](_0xdeb5('0xd'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0xe')]);router[_0xdeb5('0xf')]('/',auth[_0xdeb5('0x7')](),controller['create']);router[_0xdeb5('0x10')](_0xdeb5('0xb'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('0x11')]);router[_0xdeb5('0x12')](_0xdeb5('0xb'),auth[_0xdeb5('0x7')](),controller[_0xdeb5('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 250a7cc..aed66c9 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 _0xcf71=['STRING','moment','sequelize','exports','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x494fc8,_0x20acdd){var _0x1c4333=function(_0x98728c){while(--_0x98728c){_0x494fc8['push'](_0x494fc8['shift']());}};_0x1c4333(++_0x20acdd);}(_0xcf71,0xbf));var _0x1cf7=function(_0x21f588,_0x3f63ae){_0x21f588=_0x21f588-0x0;var _0x3b28cb=_0xcf71[_0x21f588];return _0x3b28cb;};'use strict';var moment=require(_0x1cf7('0x0'));var Sequelize=require(_0x1cf7('0x1'));module[_0x1cf7('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4cbaea){this['setDataValue'](_0x1cf7('0x3'),_0x4cbaea);this[_0x1cf7('0x4')](_0x1cf7('0x5'),moment()[_0x1cf7('0x6')](_0x1cf7('0x7')));}},'endtime':{'type':Sequelize[_0x1cf7('0x8')]},'membername':{'type':Sequelize[_0x1cf7('0x9')]},'projectname':{'type':Sequelize[_0x1cf7('0x9')]},'queue':{'type':Sequelize[_0x1cf7('0x9')]},'uniqueid':{'type':Sequelize[_0x1cf7('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1cf7('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x818b=['sequelize','exports','DATE','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x520bcc,_0x54aa59){var _0x55e792=function(_0x2d49a2){while(--_0x2d49a2){_0x520bcc['push'](_0x520bcc['shift']());}};_0x55e792(++_0x54aa59);}(_0x818b,0x104));var _0xb818=function(_0x1a9303,_0x5993ec){_0x1a9303=_0x1a9303-0x0;var _0x4c5242=_0x818b[_0x1a9303];return _0x4c5242;};'use strict';var moment=require(_0xb818('0x0'));var Sequelize=require(_0xb818('0x1'));module[_0xb818('0x2')]={'starttime':{'type':Sequelize[_0xb818('0x3')],'set':function(_0x1667bf){this['setDataValue']('starttime',_0x1667bf);this['setDataValue'](_0xb818('0x4'),moment()[_0xb818('0x5')](_0xb818('0x6')));}},'endtime':{'type':Sequelize[_0xb818('0x3')]},'membername':{'type':Sequelize[_0xb818('0x7')]},'projectname':{'type':Sequelize[_0xb818('0x7')]},'queue':{'type':Sequelize[_0xb818('0x7')]},'uniqueid':{'type':Sequelize[_0xb818('0x7')]},'calleridname':{'type':Sequelize[_0xb818('0x7')]},'calleridnum':{'type':Sequelize[_0xb818('0x7')]},'completed':{'type':Sequelize[_0xb818('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8fd631b..5404633 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 _0x7b40=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','catch','keys','intersection','includeAll','create','body','update','find','params','describe','findOne','hasOwnProperty','nolimit','order','JscriptyQuestionReport','rows','html-pdf','eml-format'];(function(_0x4f0346,_0x1470b0){var _0x435859=function(_0x4b7984){while(--_0x4b7984){_0x4f0346['push'](_0x4f0346['shift']());}};_0x435859(++_0x1470b0);}(_0x7b40,0x122));var _0x07b4=function(_0x4b5c69,_0x4f1fc2){_0x4b5c69=_0x4b5c69-0x0;var _0x2ec847=_0x7b40[_0x4b5c69];return _0x2ec847;};'use strict';var pdf=require(_0x07b4('0x0'));var emlformat=require(_0x07b4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x07b4('0x2'));var jsonpatch=require(_0x07b4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x07b4('0x4'));var Mustache=require(_0x07b4('0x5'));var util=require(_0x07b4('0x6'));var path=require(_0x07b4('0x7'));var sox=require(_0x07b4('0x8'));var csv=require(_0x07b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07b4('0xa'));var squel=require('squel');var crypto=require(_0x07b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x07b4('0xc'));var toCsv=require(_0x07b4('0x9'));var querystring=require('querystring');var Papa=require(_0x07b4('0xd'));var Redis=require(_0x07b4('0xe'));var authService=require(_0x07b4('0xf'));var qs=require(_0x07b4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07b4('0x11'));var logger=require('../../config/logger')(_0x07b4('0x12'));var utils=require('../../config/utils');var config=require(_0x07b4('0x13'));var db=require(_0x07b4('0x14'))['db'];function respondWithStatusCode(_0x194d4b,_0x574fc2){_0x574fc2=_0x574fc2||0xcc;return function(_0x16f651){if(_0x16f651){return _0x194d4b[_0x07b4('0x15')](_0x574fc2);}return _0x194d4b['status'](_0x574fc2)[_0x07b4('0x16')]();};}function respondWithResult(_0x25ecb8,_0x25a54b){_0x25a54b=_0x25a54b||0xc8;return function(_0x35a4b6){if(_0x35a4b6){return _0x25ecb8['status'](_0x25a54b)['json'](_0x35a4b6);}};}function respondWithFilteredResult(_0x5105e5,_0x5aeeb8){return function(_0x18ba9b){if(_0x18ba9b){var _0xc7a24=_0x18ba9b[_0x07b4('0x17')],_0x47eeba=_0x5aeeb8[_0x07b4('0x18')],_0x3b9dc8=_0x5aeeb8[_0x07b4('0x18')]+_0x5aeeb8[_0x07b4('0x19')],_0x3ac106;if(_0x3b9dc8>=_0xc7a24){_0x3b9dc8=_0xc7a24;_0x3ac106=0xc8;}else{_0x3ac106=0xce;}_0x5105e5['status'](_0x3ac106);return _0x5105e5[_0x07b4('0x1a')](_0x07b4('0x1b'),_0x47eeba+'-'+_0x3b9dc8+'/'+_0xc7a24)['json'](_0x18ba9b);}return null;};}function patchUpdates(_0x468499){return function(_0x5b3843){try{jsonpatch[_0x07b4('0x1c')](_0x5b3843,_0x468499,!![]);}catch(_0x207b32){return BPromise[_0x07b4('0x1d')](_0x207b32);}return _0x5b3843[_0x07b4('0x1e')]();};}function saveUpdates(_0x23166a,_0x497180){return function(_0x5e4662){if(_0x5e4662){return _0x5e4662['update'](_0x23166a)[_0x07b4('0x1f')](function(_0x29569f){return _0x29569f;});}return null;};}function removeEntity(_0xdc538b,_0x22c25b){return function(_0x43863){if(_0x43863){return _0x43863[_0x07b4('0x20')]()[_0x07b4('0x1f')](function(){_0xdc538b[_0x07b4('0x21')](0xcc)[_0x07b4('0x16')]();});}};}function handleEntityNotFound(_0x40690b,_0x1cf22f){return function(_0x3bad6b){if(!_0x3bad6b){_0x40690b[_0x07b4('0x15')](0x194);}return _0x3bad6b;};}function handleError(_0x46d0dd,_0x208fed){_0x208fed=_0x208fed||0x1f4;return function(_0x2cbe9e){logger[_0x07b4('0x22')](_0x2cbe9e[_0x07b4('0x23')]);if(_0x2cbe9e[_0x07b4('0x24')]){delete _0x2cbe9e[_0x07b4('0x24')];}_0x46d0dd['status'](_0x208fed)['send'](_0x2cbe9e);};}exports['index']=function(_0x7a4dc,_0x32d1a3){var _0x5a60f8={},_0x142c32={},_0x3dc80d={'count':0x0,'rows':[]};var _0x3bf60a=_['map'](db[_0x07b4('0x25')][_0x07b4('0x26')],function(_0x234a1b){return{'name':_0x234a1b[_0x07b4('0x27')],'type':_0x234a1b[_0x07b4('0x28')]['key']};});_0x142c32[_0x07b4('0x29')]=_['map'](_0x3bf60a,_0x07b4('0x24'));_0x142c32[_0x07b4('0x2a')]=_['keys'](_0x7a4dc[_0x07b4('0x2a')]);_0x142c32[_0x07b4('0x2b')]=_['intersection'](_0x142c32['model'],_0x142c32[_0x07b4('0x2a')]);_0x5a60f8[_0x07b4('0x2c')]=_['intersection'](_0x142c32[_0x07b4('0x29')],qs[_0x07b4('0x2d')](_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x5a60f8[_0x07b4('0x2c')]=_0x5a60f8[_0x07b4('0x2c')][_0x07b4('0x2e')]?_0x5a60f8[_0x07b4('0x2c')]:_0x142c32[_0x07b4('0x29')];if(!_0x7a4dc[_0x07b4('0x2a')]['hasOwnProperty']('nolimit')){_0x5a60f8[_0x07b4('0x19')]=qs[_0x07b4('0x19')](_0x7a4dc[_0x07b4('0x2a')]['limit']);_0x5a60f8['offset']=qs[_0x07b4('0x18')](_0x7a4dc['query'][_0x07b4('0x18')]);}_0x5a60f8['order']=qs[_0x07b4('0x2f')](_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x2f')]);_0x5a60f8[_0x07b4('0x30')]=qs[_0x07b4('0x2b')](_[_0x07b4('0x31')](_0x7a4dc[_0x07b4('0x2a')],_0x142c32[_0x07b4('0x2b')]),_0x3bf60a);if(_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x32')]){_0x5a60f8[_0x07b4('0x30')]=_[_0x07b4('0x33')](_0x5a60f8[_0x07b4('0x30')],{'$or':_[_0x07b4('0x34')](_0x3bf60a,function(_0x17f787){if(_0x17f787[_0x07b4('0x28')]!==_0x07b4('0x35')){var _0x366b05={};_0x366b05[_0x17f787[_0x07b4('0x24')]]={'$like':'%'+_0x7a4dc[_0x07b4('0x2a')][_0x07b4('0x32')]+'%'};return _0x366b05;}})});}_0x5a60f8=_[_0x07b4('0x33')]({},_0x5a60f8,_0x7a4dc[_0x07b4('0x36')]);var _0x34ba80={'where':_0x5a60f8[_0x07b4('0x30')]};return db[_0x07b4('0x25')][_0x07b4('0x17')](_0x34ba80)[_0x07b4('0x1f')](function(_0x434211){_0x3dc80d[_0x07b4('0x17')]=_0x434211;if(_0x7a4dc['query']['includeAll']){_0x5a60f8[_0x07b4('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x07b4('0x38')](_0x5a60f8);})[_0x07b4('0x1f')](function(_0x41326c){_0x3dc80d['rows']=_0x41326c;return _0x3dc80d;})[_0x07b4('0x1f')](respondWithFilteredResult(_0x32d1a3,_0x5a60f8))[_0x07b4('0x39')](handleError(_0x32d1a3,null));};exports['show']=function(_0x45c41b,_0x449820){var _0x552e5d={'raw':!![],'where':{'id':_0x45c41b['params']['id']}},_0xff4f59={};_0xff4f59[_0x07b4('0x29')]=_[_0x07b4('0x3a')](db[_0x07b4('0x25')][_0x07b4('0x26')]);_0xff4f59[_0x07b4('0x2a')]=_[_0x07b4('0x3a')](_0x45c41b[_0x07b4('0x2a')]);_0xff4f59[_0x07b4('0x2b')]=_['intersection'](_0xff4f59['model'],_0xff4f59[_0x07b4('0x2a')]);_0x552e5d[_0x07b4('0x2c')]=_[_0x07b4('0x3b')](_0xff4f59[_0x07b4('0x29')],qs[_0x07b4('0x2d')](_0x45c41b[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x552e5d[_0x07b4('0x2c')]=_0x552e5d['attributes'][_0x07b4('0x2e')]?_0x552e5d[_0x07b4('0x2c')]:_0xff4f59[_0x07b4('0x29')];if(_0x45c41b[_0x07b4('0x2a')][_0x07b4('0x3c')]){_0x552e5d[_0x07b4('0x37')]=[{'all':!![]}];}_0x552e5d=_[_0x07b4('0x33')]({},_0x552e5d,_0x45c41b[_0x07b4('0x36')]);return db[_0x07b4('0x25')]['find'](_0x552e5d)[_0x07b4('0x1f')](handleEntityNotFound(_0x449820,null))[_0x07b4('0x1f')](respondWithResult(_0x449820,null))['catch'](handleError(_0x449820,null));};exports[_0x07b4('0x3d')]=function(_0x2ef925,_0x22be43){return db[_0x07b4('0x25')]['create'](_0x2ef925[_0x07b4('0x3e')],{})[_0x07b4('0x1f')](respondWithResult(_0x22be43,0xc9))['catch'](handleError(_0x22be43,null));};exports[_0x07b4('0x3f')]=function(_0x4cda49,_0x5aace1){if(_0x4cda49['body']['id']){delete _0x4cda49[_0x07b4('0x3e')]['id'];}return db[_0x07b4('0x25')][_0x07b4('0x40')]({'where':{'id':_0x4cda49[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0x5aace1,null))['then'](saveUpdates(_0x4cda49[_0x07b4('0x3e')],null))[_0x07b4('0x1f')](respondWithResult(_0x5aace1,null))['catch'](handleError(_0x5aace1,null));};exports['destroy']=function(_0x200418,_0x696151){return db[_0x07b4('0x25')]['find']({'where':{'id':_0x200418[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0x696151,null))[_0x07b4('0x1f')](removeEntity(_0x696151,null))['catch'](handleError(_0x696151,null));};exports[_0x07b4('0x42')]=function(_0x257cbf,_0x28f4d8){return db[_0x07b4('0x25')][_0x07b4('0x42')]()['then'](respondWithResult(_0x28f4d8,null))[_0x07b4('0x39')](handleError(_0x28f4d8,null));};exports['getQuestions']=function(_0x560859,_0xb792a7,_0x933e10){var _0x267a8e={'raw':!![],'where':{}};var _0x4c3859={};var _0x2dd385={'count':0x0,'rows':[]};return db[_0x07b4('0x25')][_0x07b4('0x43')]({'where':{'id':_0x560859[_0x07b4('0x41')]['id']}})[_0x07b4('0x1f')](handleEntityNotFound(_0xb792a7,null))[_0x07b4('0x1f')](function(_0x5d26e5){if(_0x5d26e5){_0x4c3859['model']=_[_0x07b4('0x3a')](db['JscriptyQuestionReport']['rawAttributes']);_0x4c3859[_0x07b4('0x2a')]=_[_0x07b4('0x3a')](_0x560859[_0x07b4('0x2a')]);_0x4c3859[_0x07b4('0x2b')]=_[_0x07b4('0x3b')](_0x4c3859[_0x07b4('0x29')],_0x4c3859['query']);_0x267a8e[_0x07b4('0x2c')]=_[_0x07b4('0x3b')](_0x4c3859['model'],qs['fields'](_0x560859[_0x07b4('0x2a')][_0x07b4('0x2d')]));_0x267a8e[_0x07b4('0x2c')]=_0x267a8e['attributes'][_0x07b4('0x2e')]?_0x267a8e[_0x07b4('0x2c')]:_0x4c3859[_0x07b4('0x29')];if(!_0x560859[_0x07b4('0x2a')][_0x07b4('0x44')](_0x07b4('0x45'))){_0x267a8e['limit']=qs[_0x07b4('0x19')](_0x560859[_0x07b4('0x2a')]['limit']);_0x267a8e[_0x07b4('0x18')]=qs[_0x07b4('0x18')](_0x560859[_0x07b4('0x2a')][_0x07b4('0x18')]);}_0x267a8e[_0x07b4('0x46')]=qs['sort'](_0x560859[_0x07b4('0x2a')][_0x07b4('0x2f')]);_0x267a8e[_0x07b4('0x30')]=qs[_0x07b4('0x2b')](_[_0x07b4('0x31')](_0x560859[_0x07b4('0x2a')],_0x4c3859['filters']));_0x267a8e[_0x07b4('0x30')]['SessionId']=_0x5d26e5['id'];if(_0x560859[_0x07b4('0x2a')]['filter']){_0x267a8e[_0x07b4('0x30')]=_[_0x07b4('0x33')](_0x267a8e[_0x07b4('0x30')],{'$or':_[_0x07b4('0x34')](_0x267a8e['attributes'],function(_0x3d0408){var _0x4e22e6={};_0x4e22e6[_0x3d0408]={'$like':'%'+_0x560859[_0x07b4('0x2a')][_0x07b4('0x32')]+'%'};return _0x4e22e6;})});}_0x267a8e=_[_0x07b4('0x33')]({},_0x267a8e,_0x560859['options']);return db[_0x07b4('0x47')][_0x07b4('0x17')]({'where':_0x267a8e[_0x07b4('0x30')]})['then'](function(_0x5209e1){_0x2dd385[_0x07b4('0x17')]=_0x5209e1;if(_0x560859[_0x07b4('0x2a')][_0x07b4('0x3c')]){_0x267a8e[_0x07b4('0x37')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x267a8e);})[_0x07b4('0x1f')](function(_0x3ddd2d){_0x2dd385[_0x07b4('0x48')]=_0x3ddd2d;return _0x2dd385;});}})[_0x07b4('0x1f')](respondWithFilteredResult(_0xb792a7,_0x267a8e))[_0x07b4('0x39')](handleError(_0xb792a7,null));}; \ No newline at end of file +var _0xc58a=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','map','JscriptySessionReport','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x354fc5,_0x533fd4){var _0x2c24aa=function(_0x4b8a55){while(--_0x4b8a55){_0x354fc5['push'](_0x354fc5['shift']());}};_0x2c24aa(++_0x533fd4);}(_0xc58a,0xeb));var _0xac58=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0xc58a[_0x3358ba];return _0x296e73;};'use strict';var pdf=require(_0xac58('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xac58('0x1'));var zipdir=require(_0xac58('0x2'));var jsonpatch=require(_0xac58('0x3'));var rp=require(_0xac58('0x4'));var moment=require(_0xac58('0x5'));var BPromise=require(_0xac58('0x6'));var Mustache=require(_0xac58('0x7'));var util=require(_0xac58('0x8'));var path=require(_0xac58('0x9'));var sox=require(_0xac58('0xa'));var csv=require(_0xac58('0xb'));var ejs=require(_0xac58('0xc'));var fs=require('fs');var _=require(_0xac58('0xd'));var squel=require(_0xac58('0xe'));var crypto=require(_0xac58('0xf'));var jsforce=require(_0xac58('0x10'));var deskjs=require(_0xac58('0x11'));var toCsv=require(_0xac58('0xb'));var querystring=require(_0xac58('0x12'));var Papa=require(_0xac58('0x13'));var Redis=require('ioredis');var authService=require(_0xac58('0x14'));var qs=require(_0xac58('0x15'));var as=require(_0xac58('0x16'));var hardwareService=require(_0xac58('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xac58('0x18'));var config=require(_0xac58('0x19'));var db=require(_0xac58('0x1a'))['db'];function respondWithStatusCode(_0xb490c2,_0x15ffb5){_0x15ffb5=_0x15ffb5||0xcc;return function(_0x1e3afc){if(_0x1e3afc){return _0xb490c2[_0xac58('0x1b')](_0x15ffb5);}return _0xb490c2[_0xac58('0x1c')](_0x15ffb5)[_0xac58('0x1d')]();};}function respondWithResult(_0x2c0c7f,_0x49a90c){_0x49a90c=_0x49a90c||0xc8;return function(_0x5936aa){if(_0x5936aa){return _0x2c0c7f[_0xac58('0x1c')](_0x49a90c)[_0xac58('0x1e')](_0x5936aa);}};}function respondWithFilteredResult(_0x4d6e8f,_0x359d35){return function(_0x19b2f8){if(_0x19b2f8){var _0x3ce61f=_0x19b2f8[_0xac58('0x1f')],_0x2d8fef=_0x359d35[_0xac58('0x20')],_0x5c4147=_0x359d35[_0xac58('0x20')]+_0x359d35[_0xac58('0x21')],_0x22df05;if(_0x5c4147>=_0x3ce61f){_0x5c4147=_0x3ce61f;_0x22df05=0xc8;}else{_0x22df05=0xce;}_0x4d6e8f[_0xac58('0x1c')](_0x22df05);return _0x4d6e8f[_0xac58('0x22')]('Content-Range',_0x2d8fef+'-'+_0x5c4147+'/'+_0x3ce61f)[_0xac58('0x1e')](_0x19b2f8);}return null;};}function patchUpdates(_0x481fdf){return function(_0x42ed2c){try{jsonpatch[_0xac58('0x23')](_0x42ed2c,_0x481fdf,!![]);}catch(_0x3fffd6){return BPromise[_0xac58('0x24')](_0x3fffd6);}return _0x42ed2c[_0xac58('0x25')]();};}function saveUpdates(_0x19c1dc,_0x2761dc){return function(_0x34fc08){if(_0x34fc08){return _0x34fc08[_0xac58('0x26')](_0x19c1dc)[_0xac58('0x27')](function(_0x195b54){return _0x195b54;});}return null;};}function removeEntity(_0x46f661,_0x565c96){return function(_0x20495c){if(_0x20495c){return _0x20495c[_0xac58('0x28')]()['then'](function(){_0x46f661['status'](0xcc)[_0xac58('0x1d')]();});}};}function handleEntityNotFound(_0x11940b,_0x11ba3b){return function(_0x26375c){if(!_0x26375c){_0x11940b[_0xac58('0x1b')](0x194);}return _0x26375c;};}function handleError(_0x12305d,_0x5e5b39){_0x5e5b39=_0x5e5b39||0x1f4;return function(_0x1bb2db){logger['error'](_0x1bb2db[_0xac58('0x29')]);if(_0x1bb2db[_0xac58('0x2a')]){delete _0x1bb2db['name'];}_0x12305d['status'](_0x5e5b39)['send'](_0x1bb2db);};}exports['index']=function(_0x5b3dd9,_0x4853cb){var _0x4f810a={},_0x352545={},_0x3639a4={'count':0x0,'rows':[]};var _0x18d3fb=_[_0xac58('0x2b')](db[_0xac58('0x2c')][_0xac58('0x2d')],function(_0x7fb9af){return{'name':_0x7fb9af['fieldName'],'type':_0x7fb9af['type']['key']};});_0x352545['model']=_[_0xac58('0x2b')](_0x18d3fb,_0xac58('0x2a'));_0x352545[_0xac58('0x2e')]=_[_0xac58('0x2f')](_0x5b3dd9[_0xac58('0x2e')]);_0x352545[_0xac58('0x30')]=_[_0xac58('0x31')](_0x352545[_0xac58('0x32')],_0x352545[_0xac58('0x2e')]);_0x4f810a[_0xac58('0x33')]=_['intersection'](_0x352545[_0xac58('0x32')],qs['fields'](_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x34')]));_0x4f810a[_0xac58('0x33')]=_0x4f810a[_0xac58('0x33')][_0xac58('0x35')]?_0x4f810a[_0xac58('0x33')]:_0x352545[_0xac58('0x32')];if(!_0x5b3dd9['query'][_0xac58('0x36')](_0xac58('0x37'))){_0x4f810a[_0xac58('0x21')]=qs[_0xac58('0x21')](_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x21')]);_0x4f810a[_0xac58('0x20')]=qs[_0xac58('0x20')](_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x20')]);}_0x4f810a[_0xac58('0x38')]=qs[_0xac58('0x39')](_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x39')]);_0x4f810a['where']=qs[_0xac58('0x30')](_[_0xac58('0x3a')](_0x5b3dd9['query'],_0x352545['filters']),_0x18d3fb);if(_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x3b')]){_0x4f810a[_0xac58('0x3c')]=_[_0xac58('0x3d')](_0x4f810a[_0xac58('0x3c')],{'$or':_[_0xac58('0x2b')](_0x18d3fb,function(_0x3f4a89){if(_0x3f4a89[_0xac58('0x3e')]!==_0xac58('0x3f')){var _0x5d6926={};_0x5d6926[_0x3f4a89[_0xac58('0x2a')]]={'$like':'%'+_0x5b3dd9[_0xac58('0x2e')]['filter']+'%'};return _0x5d6926;}})});}_0x4f810a=_['merge']({},_0x4f810a,_0x5b3dd9[_0xac58('0x40')]);var _0x1980c1={'where':_0x4f810a['where']};return db[_0xac58('0x2c')][_0xac58('0x1f')](_0x1980c1)[_0xac58('0x27')](function(_0x2b317a){_0x3639a4[_0xac58('0x1f')]=_0x2b317a;if(_0x5b3dd9[_0xac58('0x2e')][_0xac58('0x41')]){_0x4f810a[_0xac58('0x42')]=[{'all':!![]}];}return db[_0xac58('0x2c')]['findAll'](_0x4f810a);})['then'](function(_0x39aa59){_0x3639a4[_0xac58('0x43')]=_0x39aa59;return _0x3639a4;})[_0xac58('0x27')](respondWithFilteredResult(_0x4853cb,_0x4f810a))[_0xac58('0x44')](handleError(_0x4853cb,null));};exports[_0xac58('0x45')]=function(_0x112a4c,_0x174584){var _0x1a45ea={'raw':!![],'where':{'id':_0x112a4c['params']['id']}},_0x18a41f={};_0x18a41f['model']=_[_0xac58('0x2f')](db['JscriptySessionReport']['rawAttributes']);_0x18a41f['query']=_[_0xac58('0x2f')](_0x112a4c[_0xac58('0x2e')]);_0x18a41f[_0xac58('0x30')]=_[_0xac58('0x31')](_0x18a41f[_0xac58('0x32')],_0x18a41f['query']);_0x1a45ea[_0xac58('0x33')]=_[_0xac58('0x31')](_0x18a41f['model'],qs[_0xac58('0x34')](_0x112a4c['query'][_0xac58('0x34')]));_0x1a45ea[_0xac58('0x33')]=_0x1a45ea['attributes'][_0xac58('0x35')]?_0x1a45ea[_0xac58('0x33')]:_0x18a41f['model'];if(_0x112a4c[_0xac58('0x2e')][_0xac58('0x41')]){_0x1a45ea[_0xac58('0x42')]=[{'all':!![]}];}_0x1a45ea=_[_0xac58('0x3d')]({},_0x1a45ea,_0x112a4c[_0xac58('0x40')]);return db[_0xac58('0x2c')]['find'](_0x1a45ea)['then'](handleEntityNotFound(_0x174584,null))[_0xac58('0x27')](respondWithResult(_0x174584,null))[_0xac58('0x44')](handleError(_0x174584,null));};exports[_0xac58('0x46')]=function(_0x3a8feb,_0x244b79){return db['JscriptySessionReport'][_0xac58('0x46')](_0x3a8feb[_0xac58('0x47')],{})[_0xac58('0x27')](respondWithResult(_0x244b79,0xc9))[_0xac58('0x44')](handleError(_0x244b79,null));};exports['update']=function(_0x29ef8e,_0x154f4d){if(_0x29ef8e['body']['id']){delete _0x29ef8e['body']['id'];}return db[_0xac58('0x2c')][_0xac58('0x48')]({'where':{'id':_0x29ef8e[_0xac58('0x49')]['id']}})['then'](handleEntityNotFound(_0x154f4d,null))[_0xac58('0x27')](saveUpdates(_0x29ef8e['body'],null))[_0xac58('0x27')](respondWithResult(_0x154f4d,null))[_0xac58('0x44')](handleError(_0x154f4d,null));};exports['destroy']=function(_0x2d5520,_0x219e00){return db[_0xac58('0x2c')][_0xac58('0x48')]({'where':{'id':_0x2d5520[_0xac58('0x49')]['id']}})[_0xac58('0x27')](handleEntityNotFound(_0x219e00,null))[_0xac58('0x27')](removeEntity(_0x219e00,null))[_0xac58('0x44')](handleError(_0x219e00,null));};exports[_0xac58('0x4a')]=function(_0x393d48,_0x1238a0){return db[_0xac58('0x2c')][_0xac58('0x4a')]()[_0xac58('0x27')](respondWithResult(_0x1238a0,null))[_0xac58('0x44')](handleError(_0x1238a0,null));};exports[_0xac58('0x4b')]=function(_0x39950f,_0x241493,_0x3904ef){var _0x501421={'raw':!![],'where':{}};var _0x3d0229={};var _0x130bc6={'count':0x0,'rows':[]};return db[_0xac58('0x2c')][_0xac58('0x4c')]({'where':{'id':_0x39950f[_0xac58('0x49')]['id']}})[_0xac58('0x27')](handleEntityNotFound(_0x241493,null))['then'](function(_0xf85640){if(_0xf85640){_0x3d0229[_0xac58('0x32')]=_[_0xac58('0x2f')](db[_0xac58('0x4d')][_0xac58('0x2d')]);_0x3d0229[_0xac58('0x2e')]=_[_0xac58('0x2f')](_0x39950f[_0xac58('0x2e')]);_0x3d0229[_0xac58('0x30')]=_[_0xac58('0x31')](_0x3d0229[_0xac58('0x32')],_0x3d0229[_0xac58('0x2e')]);_0x501421[_0xac58('0x33')]=_[_0xac58('0x31')](_0x3d0229[_0xac58('0x32')],qs[_0xac58('0x34')](_0x39950f['query'][_0xac58('0x34')]));_0x501421['attributes']=_0x501421['attributes'][_0xac58('0x35')]?_0x501421['attributes']:_0x3d0229[_0xac58('0x32')];if(!_0x39950f[_0xac58('0x2e')][_0xac58('0x36')](_0xac58('0x37'))){_0x501421[_0xac58('0x21')]=qs[_0xac58('0x21')](_0x39950f['query'][_0xac58('0x21')]);_0x501421[_0xac58('0x20')]=qs[_0xac58('0x20')](_0x39950f[_0xac58('0x2e')][_0xac58('0x20')]);}_0x501421[_0xac58('0x38')]=qs[_0xac58('0x39')](_0x39950f['query']['sort']);_0x501421[_0xac58('0x3c')]=qs[_0xac58('0x30')](_[_0xac58('0x3a')](_0x39950f[_0xac58('0x2e')],_0x3d0229[_0xac58('0x30')]));_0x501421[_0xac58('0x3c')][_0xac58('0x4e')]=_0xf85640['id'];if(_0x39950f[_0xac58('0x2e')][_0xac58('0x3b')]){_0x501421[_0xac58('0x3c')]=_[_0xac58('0x3d')](_0x501421[_0xac58('0x3c')],{'$or':_['map'](_0x501421['attributes'],function(_0x1ba6bb){var _0xbc7483={};_0xbc7483[_0x1ba6bb]={'$like':'%'+_0x39950f['query'][_0xac58('0x3b')]+'%'};return _0xbc7483;})});}_0x501421=_[_0xac58('0x3d')]({},_0x501421,_0x39950f['options']);return db[_0xac58('0x4d')][_0xac58('0x1f')]({'where':_0x501421[_0xac58('0x3c')]})[_0xac58('0x27')](function(_0xbf7a6){_0x130bc6[_0xac58('0x1f')]=_0xbf7a6;if(_0x39950f[_0xac58('0x2e')][_0xac58('0x41')]){_0x501421[_0xac58('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xac58('0x4f')](_0x501421);})[_0xac58('0x27')](function(_0x5662c9){_0x130bc6[_0xac58('0x43')]=_0x5662c9;return _0x130bc6;});}})['then'](respondWithFilteredResult(_0x241493,_0x501421))[_0xac58('0x44')](handleError(_0x241493,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8172551..0393515 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 _0xb091=['moment','request-promise','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x539cb2,_0x39ac60){var _0x376515=function(_0x5976e9){while(--_0x5976e9){_0x539cb2['push'](_0x539cb2['shift']());}};_0x376515(++_0x39ac60);}(_0xb091,0x16e));var _0x1b09=function(_0xd162f0,_0x665021){_0xd162f0=_0xd162f0-0x0;var _0x420775=_0xb091[_0xd162f0];return _0x420775;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['lodash','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions'];(function(_0x36d21c,_0x17b5bf){var _0x4794ae=function(_0x46ad3e){while(--_0x46ad3e){_0x36d21c['push'](_0x36d21c['shift']());}};_0x4794ae(++_0x17b5bf);}(_0x1623,0xab));var _0x3162=function(_0x537d83,_0x439326){_0x537d83=_0x537d83-0x0;var _0x49c97b=_0x1623[_0x537d83];return _0x49c97b;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'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 146db77..65bc3c6 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 _0x4e16=['http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x4e1c7d,_0x1366bc){var _0x191a91=function(_0x393bd2){while(--_0x393bd2){_0x4e1c7d['push'](_0x4e1c7d['shift']());}};_0x191a91(++_0x1366bc);}(_0x4e16,0x1ee));var _0x64e1=function(_0x20315a,_0x4604ee){_0x20315a=_0x20315a-0x0;var _0x1d0300=_0x4e16[_0x20315a];return _0x1d0300;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var moment=require(_0x64e1('0x2'));var BPromise=require(_0x64e1('0x3'));var rs=require(_0x64e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e1('0x5'))['db'];var utils=require(_0x64e1('0x6'));var logger=require(_0x64e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x64e1('0x8'));var client=jayson[_0x64e1('0x9')][_0x64e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116fdb,_0xc2529e,_0x4c2004){return new BPromise(function(_0x192173,_0x54aeff){return client[_0x64e1('0xb')](_0x116fdb,_0x4c2004)[_0x64e1('0xc')](function(_0x33e0fb){logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));logger[_0x64e1('0x10')](_0x64e1('0x11'),_0xc2529e,_0x64e1('0xf'),JSON[_0x64e1('0x12')](_0x33e0fb));if(_0x33e0fb[_0x64e1('0x13')]){if(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x14')]===0x1f4){logger['error'](_0x64e1('0xe'),_0xc2529e,_0x33e0fb['error'][_0x64e1('0x15')]);return _0x54aeff(_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);}logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x33e0fb[_0x64e1('0x13')][_0x64e1('0x15')]);return _0x192173(_0x33e0fb['error'][_0x64e1('0x15')]);}else{logger[_0x64e1('0xd')](_0x64e1('0xe'),_0xc2529e,_0x64e1('0xf'));_0x192173(_0x33e0fb[_0x64e1('0x16')][_0x64e1('0x15')]);}})[_0x64e1('0x17')](function(_0x3160ba){logger[_0x64e1('0x13')](_0x64e1('0xe'),_0xc2529e,_0x3160ba);_0x54aeff(_0x3160ba);});});} \ No newline at end of file +var _0x12f7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x12f7,0x155));var _0x712f=function(_0x1c977e,_0x2d5106){_0x1c977e=_0x1c977e-0x0;var _0x26c2f1=_0x12f7[_0x1c977e];return _0x26c2f1;};'use strict';var _=require(_0x712f('0x0'));var util=require(_0x712f('0x1'));var moment=require('moment');var BPromise=require(_0x712f('0x2'));var rs=require(_0x712f('0x3'));var fs=require('fs');var Redis=require(_0x712f('0x4'));var db=require(_0x712f('0x5'))['db'];var utils=require(_0x712f('0x6'));var logger=require(_0x712f('0x7'))(_0x712f('0x8'));var config=require('../../config/environment');var jayson=require(_0x712f('0x9'));var client=jayson[_0x712f('0xa')][_0x712f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1728ff,_0x43bec5,_0x24ecbd){return new BPromise(function(_0x469660,_0x3771a9){return client[_0x712f('0xc')](_0x1728ff,_0x24ecbd)['then'](function(_0x3d16ce){logger[_0x712f('0xd')](_0x712f('0xe'),_0x43bec5,_0x712f('0xf'));logger[_0x712f('0x10')](_0x712f('0x11'),_0x43bec5,'request\x20sent',JSON[_0x712f('0x12')](_0x3d16ce));if(_0x3d16ce['error']){if(_0x3d16ce[_0x712f('0x13')]['code']===0x1f4){logger['error'](_0x712f('0xe'),_0x43bec5,_0x3d16ce[_0x712f('0x13')][_0x712f('0x14')]);return _0x3771a9(_0x3d16ce[_0x712f('0x13')][_0x712f('0x14')]);}logger[_0x712f('0x13')](_0x712f('0xe'),_0x43bec5,_0x3d16ce['error'][_0x712f('0x14')]);return _0x469660(_0x3d16ce[_0x712f('0x13')]['message']);}else{logger[_0x712f('0xd')](_0x712f('0xe'),_0x43bec5,_0x712f('0xf'));_0x469660(_0x3d16ce[_0x712f('0x15')][_0x712f('0x14')]);}})[_0x712f('0x16')](function(_0x403352){logger[_0x712f('0x13')](_0x712f('0xe'),_0x43bec5,_0x403352);_0x3771a9(_0x403352);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7f7f22f..23cda17 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 _0xc57a=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','exports','multer'];(function(_0x39f089,_0x1dff44){var _0x3c1fca=function(_0xee19d3){while(--_0xee19d3){_0x39f089['push'](_0x39f089['shift']());}};_0x3c1fca(++_0x1dff44);}(_0xc57a,0x78));var _0xac57=function(_0xaf8f29,_0x5754cf){_0xaf8f29=_0xaf8f29-0x0;var _0x391fed=_0xc57a[_0xaf8f29];return _0x391fed;};'use strict';var multer=require(_0xac57('0x0'));var util=require(_0xac57('0x1'));var path=require(_0xac57('0x2'));var timeout=require('connect-timeout');var express=require(_0xac57('0x3'));var router=express[_0xac57('0x4')]();var auth=require(_0xac57('0x5'));var interaction=require(_0xac57('0x6'));var config=require(_0xac57('0x7'));var controller=require('./license.controller');router['get']('/',controller['index']);router['put'](_0xac57('0x8'),auth[_0xac57('0x9')](),controller['update']);module[_0xac57('0xa')]=router; \ No newline at end of file +var _0xda4e=['put','isAuthenticated','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x68717f,_0x26bd7f){var _0x4e9183=function(_0x57311c){while(--_0x57311c){_0x68717f['push'](_0x68717f['shift']());}};_0x4e9183(++_0x26bd7f);}(_0xda4e,0x115));var _0xeda4=function(_0x515aff,_0x767a1a){_0x515aff=_0x515aff-0x0;var _0x10a328=_0xda4e[_0x515aff];return _0x10a328;};'use strict';var multer=require(_0xeda4('0x0'));var util=require('util');var path=require(_0xeda4('0x1'));var timeout=require('connect-timeout');var express=require(_0xeda4('0x2'));var router=express[_0xeda4('0x3')]();var auth=require(_0xeda4('0x4'));var interaction=require(_0xeda4('0x5'));var config=require(_0xeda4('0x6'));var controller=require('./license.controller');router[_0xeda4('0x7')]('/',controller[_0xeda4('0x8')]);router[_0xeda4('0x9')]('/:id',auth[_0xeda4('0xa')](),controller[_0xeda4('0xb')]);module[_0xeda4('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 73d66ab..24eb496 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 _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0xbf9f76,_0x4dc83f){var _0x1e3564=function(_0x5dd6fa){while(--_0x5dd6fa){_0xbf9f76['push'](_0xbf9f76['shift']());}};_0x1e3564(++_0x4dc83f);}(_0x1261,0x144));var _0x1126=function(_0x397004,_0x7949f){_0x397004=_0x397004-0x0;var _0xa7a10=_0x1261[_0x397004];return _0xa7a10;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','INTEGER'];(function(_0x3a78de,_0x51726b){var _0x12a6f7=function(_0x236adb){while(--_0x236adb){_0x3a78de['push'](_0x3a78de['shift']());}};_0x12a6f7(++_0x51726b);}(_0x1261,0x144));var _0x1126=function(_0x1116cd,_0x41a0b7){_0x1116cd=_0x1116cd-0x0;var _0x52974a=_0x1261[_0x1116cd];return _0x52974a;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'license':{'type':Sequelize[_0x1126('0x1')]},'data1':{'type':Sequelize[_0x1126('0x2')]},'data2':{'type':Sequelize[_0x1126('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1126('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 139f577..976539d 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 _0x176b=['rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','limit','Content-Range','reject','save','then','destroy','sendStatus','stack','name','../../config/license/util','index','model','License','query','keys','filters','fields','attributes','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','key','html-pdf'];(function(_0x34fde4,_0x592f60){var _0x31c391=function(_0x3f341f){while(--_0x3f341f){_0x34fde4['push'](_0x34fde4['shift']());}};_0x31c391(++_0x592f60);}(_0x176b,0x14f));var _0xb176=function(_0x393436,_0x2100f4){_0x393436=_0x393436-0x0;var _0x1a54a4=_0x176b[_0x393436];return _0x1a54a4;};'use strict';var pdf=require(_0xb176('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb176('0x1'));var zipdir=require(_0xb176('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb176('0x3'));var BPromise=require(_0xb176('0x4'));var Mustache=require(_0xb176('0x5'));var util=require(_0xb176('0x6'));var path=require(_0xb176('0x7'));var sox=require(_0xb176('0x8'));var csv=require(_0xb176('0x9'));var ejs=require(_0xb176('0xa'));var fs=require('fs');var _=require(_0xb176('0xb'));var squel=require('squel');var crypto=require(_0xb176('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb176('0xd'));var toCsv=require(_0xb176('0x9'));var querystring=require(_0xb176('0xe'));var Papa=require(_0xb176('0xf'));var Redis=require(_0xb176('0x10'));var authService=require(_0xb176('0x11'));var qs=require(_0xb176('0x12'));var as=require(_0xb176('0x13'));var hardwareService=require(_0xb176('0x14'));var logger=require(_0xb176('0x15'))(_0xb176('0x16'));var utils=require(_0xb176('0x17'));var config=require('../../config/environment');var db=require(_0xb176('0x18'))['db'];function respondWithStatusCode(_0x387e8c,_0x4fbf9d){_0x4fbf9d=_0x4fbf9d||0xcc;return function(_0x3829fa){if(_0x3829fa){return _0x387e8c['sendStatus'](_0x4fbf9d);}return _0x387e8c[_0xb176('0x19')](_0x4fbf9d)['end']();};}function respondWithResult(_0x5155bb,_0x145ffc){_0x145ffc=_0x145ffc||0xc8;return function(_0x24ff32){if(_0x24ff32){return _0x5155bb['status'](_0x145ffc)[_0xb176('0x1a')](_0x24ff32);}};}function respondWithFilteredResult(_0x5340fd,_0x28ee3e){return function(_0x24fc19){if(_0x24fc19){var _0x4f80df=_0x24fc19['count'],_0xd5d237=_0x28ee3e['offset'],_0x57b4d2=_0x28ee3e['offset']+_0x28ee3e[_0xb176('0x1b')],_0x55320d;if(_0x57b4d2>=_0x4f80df){_0x57b4d2=_0x4f80df;_0x55320d=0xc8;}else{_0x55320d=0xce;}_0x5340fd['status'](_0x55320d);return _0x5340fd['set'](_0xb176('0x1c'),_0xd5d237+'-'+_0x57b4d2+'/'+_0x4f80df)[_0xb176('0x1a')](_0x24fc19);}return null;};}function patchUpdates(_0x2e049b){return function(_0x434889){try{jsonpatch['apply'](_0x434889,_0x2e049b,!![]);}catch(_0x46ebf4){return BPromise[_0xb176('0x1d')](_0x46ebf4);}return _0x434889[_0xb176('0x1e')]();};}function saveUpdates(_0x15a224,_0x108999){return function(_0x391003){if(_0x391003){return _0x391003['update'](_0x15a224)[_0xb176('0x1f')](function(_0x266571){return _0x266571;});}return null;};}function removeEntity(_0x49a798,_0x845987){return function(_0x4ec8b9){if(_0x4ec8b9){return _0x4ec8b9[_0xb176('0x20')]()[_0xb176('0x1f')](function(){_0x49a798[_0xb176('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23661f,_0x37dbd6){return function(_0x3ed907){if(!_0x3ed907){_0x23661f[_0xb176('0x21')](0x194);}return _0x3ed907;};}function handleError(_0x1d6da3,_0x4e4a0f){_0x4e4a0f=_0x4e4a0f||0x1f4;return function(_0x3720a6){logger['error'](_0x3720a6[_0xb176('0x22')]);if(_0x3720a6[_0xb176('0x23')]){delete _0x3720a6[_0xb176('0x23')];}_0x1d6da3[_0xb176('0x19')](_0x4e4a0f)['send'](_0x3720a6);};}var utilLicense=require(_0xb176('0x24'));exports[_0xb176('0x25')]=function(_0x263b2d,_0x2ebb2e){var _0x2eabb7={'raw':!![],'where':{'id':0x1}},_0x4c8ec5={};_0x4c8ec5[_0xb176('0x26')]=_['keys'](db[_0xb176('0x27')]['rawAttributes']);_0x4c8ec5[_0xb176('0x28')]=_[_0xb176('0x29')](_0x263b2d[_0xb176('0x28')]);_0x4c8ec5[_0xb176('0x2a')]=_['intersection'](_0x4c8ec5['model'],_0x4c8ec5['query']);_0x2eabb7['attributes']=_['intersection'](_0x4c8ec5['model'],qs[_0xb176('0x2b')](_0x263b2d[_0xb176('0x28')][_0xb176('0x2b')]));_0x2eabb7[_0xb176('0x2c')]=_0x2eabb7[_0xb176('0x2c')][_0xb176('0x2d')]?_0x2eabb7[_0xb176('0x2c')]:_0x4c8ec5[_0xb176('0x26')];_0x2eabb7=_[_0xb176('0x2e')]({},_0x2eabb7,_0x263b2d[_0xb176('0x2f')]);return utilLicense[_0xb176('0x30')](_0x2eabb7)[_0xb176('0x1f')](respondWithResult(_0x2ebb2e,null))[_0xb176('0x31')](handleError(_0x2ebb2e,null));};exports[_0xb176('0x32')]=function(_0x479370,_0x226f31){if(_0x479370[_0xb176('0x33')]['id']){delete _0x479370['body']['id'];}return db[_0xb176('0x27')][_0xb176('0x34')]({'where':{'id':_0x479370['params']['id']}})[_0xb176('0x1f')](handleEntityNotFound(_0x226f31,null))[_0xb176('0x1f')](function(_0x211bfa){var _0x56aac1=_0x211bfa[_0xb176('0x35')]({'plain':!![]});return utilLicense[_0xb176('0x36')](_0x56aac1,_0x479370[_0xb176('0x33')][_0xb176('0x37')]);})['then'](function(_0x1235c2){if(!_0x1235c2['demo']){return saveUpdates(_0x479370[_0xb176('0x33')],null);}return _0x1235c2;})[_0xb176('0x1f')](respondWithResult(_0x226f31,null))[_0xb176('0x31')](handleError(_0x226f31,null));}; \ No newline at end of file +var _0xc701=['query','keys','intersection','model','fields','length','attributes','merge','getLicense','catch','update','body','get','checkLicense','demo','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','destroy','then','error','stack','name','../../config/license/util','index','License'];(function(_0xaa6799,_0x23fae2){var _0x59b358=function(_0xda3352){while(--_0xda3352){_0xaa6799['push'](_0xaa6799['shift']());}};_0x59b358(++_0x23fae2);}(_0xc701,0x118));var _0x1c70=function(_0x5850e0,_0x2c3e9a){_0x5850e0=_0x5850e0-0x0;var _0x3d0697=_0xc701[_0x5850e0];return _0x3d0697;};'use strict';var pdf=require(_0x1c70('0x0'));var emlformat=require(_0x1c70('0x1'));var rimraf=require(_0x1c70('0x2'));var zipdir=require(_0x1c70('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c70('0x4'));var BPromise=require(_0x1c70('0x5'));var Mustache=require(_0x1c70('0x6'));var util=require(_0x1c70('0x7'));var path=require(_0x1c70('0x8'));var sox=require(_0x1c70('0x9'));var csv=require(_0x1c70('0xa'));var ejs=require(_0x1c70('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1c70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1c70('0xd'));var toCsv=require(_0x1c70('0xa'));var querystring=require('querystring');var Papa=require(_0x1c70('0xe'));var Redis=require('ioredis');var authService=require(_0x1c70('0xf'));var qs=require(_0x1c70('0x10'));var as=require(_0x1c70('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1c70('0x12'));var utils=require(_0x1c70('0x13'));var config=require(_0x1c70('0x14'));var db=require(_0x1c70('0x15'))['db'];function respondWithStatusCode(_0x2507e2,_0x2c5a6c){_0x2c5a6c=_0x2c5a6c||0xcc;return function(_0x18d01d){if(_0x18d01d){return _0x2507e2[_0x1c70('0x16')](_0x2c5a6c);}return _0x2507e2[_0x1c70('0x17')](_0x2c5a6c)[_0x1c70('0x18')]();};}function respondWithResult(_0x40400b,_0x553e31){_0x553e31=_0x553e31||0xc8;return function(_0x50d6c2){if(_0x50d6c2){return _0x40400b[_0x1c70('0x17')](_0x553e31)['json'](_0x50d6c2);}};}function respondWithFilteredResult(_0xd63569,_0x151add){return function(_0x463633){if(_0x463633){var _0x3c88a6=_0x463633['count'],_0xe3d16a=_0x151add[_0x1c70('0x19')],_0x253235=_0x151add[_0x1c70('0x19')]+_0x151add['limit'],_0x354a30;if(_0x253235>=_0x3c88a6){_0x253235=_0x3c88a6;_0x354a30=0xc8;}else{_0x354a30=0xce;}_0xd63569[_0x1c70('0x17')](_0x354a30);return _0xd63569[_0x1c70('0x1a')]('Content-Range',_0xe3d16a+'-'+_0x253235+'/'+_0x3c88a6)[_0x1c70('0x1b')](_0x463633);}return null;};}function patchUpdates(_0x2ea0f4){return function(_0x230d20){try{jsonpatch[_0x1c70('0x1c')](_0x230d20,_0x2ea0f4,!![]);}catch(_0x18a48f){return BPromise[_0x1c70('0x1d')](_0x18a48f);}return _0x230d20['save']();};}function saveUpdates(_0x413033,_0x227c91){return function(_0x336bc6){if(_0x336bc6){return _0x336bc6['update'](_0x413033)['then'](function(_0xb5a72f){return _0xb5a72f;});}return null;};}function removeEntity(_0x27e399,_0x37a9e0){return function(_0x140f01){if(_0x140f01){return _0x140f01[_0x1c70('0x1e')]()[_0x1c70('0x1f')](function(){_0x27e399[_0x1c70('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f899b,_0x1c3e02){return function(_0x222b4e){if(!_0x222b4e){_0x2f899b[_0x1c70('0x16')](0x194);}return _0x222b4e;};}function handleError(_0x3aa0b0,_0x1cd487){_0x1cd487=_0x1cd487||0x1f4;return function(_0x13d1b6){logger[_0x1c70('0x20')](_0x13d1b6[_0x1c70('0x21')]);if(_0x13d1b6[_0x1c70('0x22')]){delete _0x13d1b6[_0x1c70('0x22')];}_0x3aa0b0[_0x1c70('0x17')](_0x1cd487)['send'](_0x13d1b6);};}var utilLicense=require(_0x1c70('0x23'));exports[_0x1c70('0x24')]=function(_0x97220a,_0x22f5e0){var _0x40c789={'raw':!![],'where':{'id':0x1}},_0x5333fb={};_0x5333fb['model']=_['keys'](db[_0x1c70('0x25')]['rawAttributes']);_0x5333fb[_0x1c70('0x26')]=_[_0x1c70('0x27')](_0x97220a[_0x1c70('0x26')]);_0x5333fb['filters']=_[_0x1c70('0x28')](_0x5333fb[_0x1c70('0x29')],_0x5333fb[_0x1c70('0x26')]);_0x40c789['attributes']=_[_0x1c70('0x28')](_0x5333fb[_0x1c70('0x29')],qs[_0x1c70('0x2a')](_0x97220a[_0x1c70('0x26')][_0x1c70('0x2a')]));_0x40c789['attributes']=_0x40c789['attributes'][_0x1c70('0x2b')]?_0x40c789[_0x1c70('0x2c')]:_0x5333fb[_0x1c70('0x29')];_0x40c789=_[_0x1c70('0x2d')]({},_0x40c789,_0x97220a['options']);return utilLicense[_0x1c70('0x2e')](_0x40c789)[_0x1c70('0x1f')](respondWithResult(_0x22f5e0,null))[_0x1c70('0x2f')](handleError(_0x22f5e0,null));};exports[_0x1c70('0x30')]=function(_0x1031ec,_0x154bab){if(_0x1031ec[_0x1c70('0x31')]['id']){delete _0x1031ec[_0x1c70('0x31')]['id'];}return db[_0x1c70('0x25')]['find']({'where':{'id':_0x1031ec['params']['id']}})[_0x1c70('0x1f')](handleEntityNotFound(_0x154bab,null))['then'](function(_0x4eb558){var _0xb1eb5f=_0x4eb558[_0x1c70('0x32')]({'plain':!![]});return utilLicense[_0x1c70('0x33')](_0xb1eb5f,_0x1031ec[_0x1c70('0x31')]['key']);})['then'](function(_0x62ee56){if(!_0x62ee56[_0x1c70('0x34')]){return saveUpdates(_0x1031ec['body'],null);}return _0x62ee56;})['then'](respondWithResult(_0x154bab,null))[_0x1c70('0x2f')](handleError(_0x154bab,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b39c129..e56a9bc 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 _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4125f9,_0xf7454e){var _0x4f054c=function(_0x1bfe91){while(--_0x1bfe91){_0x4125f9['push'](_0x4125f9['shift']());}};_0x4f054c(++_0xf7454e);}(_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 logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x438434,_0x36f21f){var _0x3b97c9=function(_0x1ecb7b){while(--_0x1ecb7b){_0x438434['push'](_0x438434['shift']());}};_0x3b97c9(++_0x36f21f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0xb10b[_0x3e7bb8];return _0x160bf4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0dbd5d3..0b42a48 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 _0x7d13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','util','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7d13,0x6c));var _0x37d1=function(_0x4505cb,_0x135d7d){_0x4505cb=_0x4505cb-0x0;var _0x188f78=_0x7d13[_0x4505cb];return _0x188f78;};'use strict';var _=require('lodash');var util=require(_0x37d1('0x0'));var moment=require('moment');var BPromise=require(_0x37d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d1('0x2'));var db=require(_0x37d1('0x3'))['db'];var utils=require(_0x37d1('0x4'));var logger=require(_0x37d1('0x5'))(_0x37d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x37d1('0x7'));var client=jayson[_0x37d1('0x8')][_0x37d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ac1d,_0x5146e3,_0x9302bd){return new BPromise(function(_0x41dfaa,_0x115eca){return client[_0x37d1('0xa')](_0x27ac1d,_0x9302bd)[_0x37d1('0xb')](function(_0x636359){logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');logger[_0x37d1('0xd')](_0x37d1('0xe'),_0x5146e3,'request\x20sent',JSON[_0x37d1('0xf')](_0x636359));if(_0x636359[_0x37d1('0x10')]){if(_0x636359[_0x37d1('0x10')][_0x37d1('0x11')]===0x1f4){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x115eca(_0x636359['error'][_0x37d1('0x13')]);}logger[_0x37d1('0x10')]('License,\x20%s,\x20%s',_0x5146e3,_0x636359[_0x37d1('0x10')][_0x37d1('0x13')]);return _0x41dfaa(_0x636359['error'][_0x37d1('0x13')]);}else{logger[_0x37d1('0xc')]('License,\x20%s,\x20%s',_0x5146e3,'request\x20sent');_0x41dfaa(_0x636359[_0x37d1('0x14')][_0x37d1('0x13')]);}})[_0x37d1('0x15')](function(_0x5ded71){logger[_0x37d1('0x10')](_0x37d1('0x12'),_0x5146e3,_0x5ded71);_0x115eca(_0x5ded71);});});} \ No newline at end of file +var _0x4e65=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','License,\x20%s,\x20%s'];(function(_0x1b8d73,_0x5908c5){var _0x3becc4=function(_0x745f69){while(--_0x745f69){_0x1b8d73['push'](_0x1b8d73['shift']());}};_0x3becc4(++_0x5908c5);}(_0x4e65,0xc4));var _0x54e6=function(_0x4fa75c,_0x12e2fa){_0x4fa75c=_0x4fa75c-0x0;var _0x115d52=_0x4e65[_0x4fa75c];return _0x115d52;};'use strict';var _=require('lodash');var util=require(_0x54e6('0x0'));var moment=require(_0x54e6('0x1'));var BPromise=require(_0x54e6('0x2'));var rs=require(_0x54e6('0x3'));var fs=require('fs');var Redis=require(_0x54e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54e6('0x5'))(_0x54e6('0x6'));var config=require(_0x54e6('0x7'));var jayson=require(_0x54e6('0x8'));var client=jayson[_0x54e6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c9f97,_0x5d437f,_0x256560){return new BPromise(function(_0x1a2191,_0x2bf501){return client[_0x54e6('0xa')](_0x3c9f97,_0x256560)['then'](function(_0x2aa46c){logger[_0x54e6('0xb')](_0x54e6('0xc'),_0x5d437f,_0x54e6('0xd'));logger[_0x54e6('0xe')](_0x54e6('0xf'),_0x5d437f,'request\x20sent',JSON[_0x54e6('0x10')](_0x2aa46c));if(_0x2aa46c['error']){if(_0x2aa46c[_0x54e6('0x11')]['code']===0x1f4){logger[_0x54e6('0x11')](_0x54e6('0xc'),_0x5d437f,_0x2aa46c['error'][_0x54e6('0x12')]);return _0x2bf501(_0x2aa46c['error'][_0x54e6('0x12')]);}logger[_0x54e6('0x11')](_0x54e6('0xc'),_0x5d437f,_0x2aa46c[_0x54e6('0x11')][_0x54e6('0x12')]);return _0x1a2191(_0x2aa46c[_0x54e6('0x11')]['message']);}else{logger[_0x54e6('0xb')](_0x54e6('0xc'),_0x5d437f,_0x54e6('0xd'));_0x1a2191(_0x2aa46c['result']['message']);}})['catch'](function(_0x43e643){logger[_0x54e6('0x11')]('License,\x20%s,\x20%s',_0x5d437f,_0x43e643);_0x2bf501(_0x43e643);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6915e43..3142aa1 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 _0x0190=['addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./mailAccount.controller','index','get','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x0190,0x117));var _0x0019=function(_0x2aff36,_0x5df719){_0x2aff36=_0x2aff36-0x0;var _0x3b336d=_0x0190[_0x2aff36];return _0x3b336d;};'use strict';var multer=require('multer');var util=require(_0x0019('0x0'));var path=require(_0x0019('0x1'));var timeout=require(_0x0019('0x2'));var express=require(_0x0019('0x3'));var router=express[_0x0019('0x4')]();var auth=require(_0x0019('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0019('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0019('0x7')]);router[_0x0019('0x8')](_0x0019('0x9'),auth[_0x0019('0xa')](),controller['describe']);router[_0x0019('0x8')](_0x0019('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0019('0x8')](_0x0019('0xc'),auth['isAuthenticated'](),controller[_0x0019('0xd')]);router['get'](_0x0019('0xe'),auth['isAuthenticated'](),controller[_0x0019('0xf')]);router[_0x0019('0x8')](_0x0019('0x10'),auth[_0x0019('0xa')](),controller['getImap']);router[_0x0019('0x8')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x12')]);router[_0x0019('0x8')](_0x0019('0x13'),auth[_0x0019('0xa')](),controller['getInteractions']);router[_0x0019('0x8')](_0x0019('0x14'),auth['isAuthenticated'](),controller[_0x0019('0x15')]);router['get'](_0x0019('0x16'),auth[_0x0019('0xa')](),controller['getMessages']);router[_0x0019('0x8')](_0x0019('0x17'),auth['isAuthenticated'](),controller[_0x0019('0x18')]);router[_0x0019('0x8')](_0x0019('0x19'),auth[_0x0019('0xa')](),controller[_0x0019('0x1a')]);router[_0x0019('0x1b')](_0x0019('0xc'),auth['isAuthenticated'](),controller[_0x0019('0x1c')]);router[_0x0019('0x1b')](_0x0019('0xe'),auth[_0x0019('0xa')](),controller[_0x0019('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0019('0x1e')]);router['post'](_0x0019('0x10'),auth[_0x0019('0xa')](),controller[_0x0019('0x1f')]);router[_0x0019('0x1b')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x20')]);router[_0x0019('0x1b')](_0x0019('0x13'),auth[_0x0019('0xa')](),controller[_0x0019('0x21')]);router[_0x0019('0x1b')](_0x0019('0x14'),auth[_0x0019('0xa')](),controller[_0x0019('0x22')]);router[_0x0019('0x1b')]('/:id/send',auth[_0x0019('0xa')](),controller[_0x0019('0x23')]);router[_0x0019('0x1b')](_0x0019('0x19'),auth['isAuthenticated'](),controller[_0x0019('0x24')]);router[_0x0019('0x25')]('/:id',auth[_0x0019('0xa')](),controller['update']);router['delete'](_0x0019('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0019('0x26')](_0x0019('0xe'),auth['isAuthenticated'](),controller[_0x0019('0x27')]);router[_0x0019('0x26')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0019('0x28')]);router[_0x0019('0x26')](_0x0019('0x11'),auth[_0x0019('0xa')](),controller[_0x0019('0x29')]);router[_0x0019('0x26')]('/:id',auth[_0x0019('0xa')](),controller[_0x0019('0x2a')]);router[_0x0019('0x26')](_0x0019('0x19'),auth[_0x0019('0xa')](),controller['removeAgents']);module[_0x0019('0x2b')]=router; \ No newline at end of file +var _0x9a23=['/:id/in_servers','getImap','/:id/interactions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','put','/:id','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers'];(function(_0x5d2b93,_0xa3c0b){var _0x1ab019=function(_0x508177){while(--_0x508177){_0x5d2b93['push'](_0x5d2b93['shift']());}};_0x1ab019(++_0xa3c0b);}(_0x9a23,0x125));var _0x39a2=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x9a23[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x39a2('0x0'));var util=require('util');var path=require(_0x39a2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x39a2('0x2')]();var auth=require(_0x39a2('0x3'));var interaction=require(_0x39a2('0x4'));var config=require(_0x39a2('0x5'));var controller=require(_0x39a2('0x6'));router[_0x39a2('0x7')]('/',auth[_0x39a2('0x8')](),controller[_0x39a2('0x9')]);router[_0x39a2('0x7')]('/describe',auth[_0x39a2('0x8')](),controller[_0x39a2('0xa')]);router[_0x39a2('0x7')]('/:id',auth[_0x39a2('0x8')](),controller['show']);router[_0x39a2('0x7')](_0x39a2('0xb'),auth[_0x39a2('0x8')](),controller[_0x39a2('0xc')]);router[_0x39a2('0x7')](_0x39a2('0xd'),auth[_0x39a2('0x8')](),controller[_0x39a2('0xe')]);router['get'](_0x39a2('0xf'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x10')]);router['get']('/:id/out_servers',auth[_0x39a2('0x8')](),controller['getSmtp']);router['get'](_0x39a2('0x11'),auth[_0x39a2('0x8')](),controller['getInteractions']);router['get'](_0x39a2('0x12'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0x39a2('0x13'),auth[_0x39a2('0x8')](),controller['getMessages']);router[_0x39a2('0x7')](_0x39a2('0x14'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x15')]);router[_0x39a2('0x7')](_0x39a2('0x16'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x17')]);router[_0x39a2('0x18')](_0x39a2('0xb'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x19')]);router[_0x39a2('0x18')](_0x39a2('0xd'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x1a')]);router['post']('/',auth[_0x39a2('0x8')](),controller[_0x39a2('0x1b')]);router[_0x39a2('0x18')](_0x39a2('0xf'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x1c')]);router[_0x39a2('0x18')](_0x39a2('0x1d'),auth[_0x39a2('0x8')](),controller['addSmtp']);router['post'](_0x39a2('0x11'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x1e')]);router[_0x39a2('0x18')](_0x39a2('0x12'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x1f')]);router['post'](_0x39a2('0x20'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x21')]);router['post'](_0x39a2('0x16'),auth[_0x39a2('0x8')](),controller['addAgents']);router[_0x39a2('0x22')](_0x39a2('0x23'),auth[_0x39a2('0x8')](),controller['update']);router['delete'](_0x39a2('0xb'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x24')]);router[_0x39a2('0x25')](_0x39a2('0xd'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x26')]);router[_0x39a2('0x25')](_0x39a2('0xf'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x27')]);router[_0x39a2('0x25')](_0x39a2('0x1d'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x28')]);router['delete'](_0x39a2('0x23'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x29')]);router[_0x39a2('0x25')](_0x39a2('0x16'),auth[_0x39a2('0x8')](),controller[_0x39a2('0x2a')]);module[_0x39a2('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b4c6bb1..fe6dcb1 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 _0xb23d=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0xb23d,0x10b));var _0xdb23=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb23d[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xdb23('0x0'));module['exports']={'description':{'type':Sequelize[_0xdb23('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb23('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdb23('0x1')],'allowNull':![],'defaultValue':_0xdb23('0x3')},'fontSize':{'type':Sequelize[_0xdb23('0x4')](0x2)[_0xdb23('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdb23('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdb23('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xdb23('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xdb23('0x2')],'defaultValue':![],'comment':_0xdb23('0x8'),'set':function(_0x5d4f96){if(!_0x5d4f96)this[_0xdb23('0x9')]('mandatoryDispositionPauseId',null);this[_0xdb23('0x9')](_0xdb23('0xa'),_0x5d4f96);}}}; \ No newline at end of file +var _0x5f4b=['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','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0xe11966,_0x455d9d){var _0x2fa7e1=function(_0x5194b8){while(--_0x5194b8){_0xe11966['push'](_0xe11966['shift']());}};_0x2fa7e1(++_0x455d9d);}(_0x5f4b,0x164));var _0xb5f4=function(_0x38627c,_0x567d15){_0x38627c=_0x38627c-0x0;var _0x55ef71=_0x5f4b[_0x38627c];return _0x55ef71;};'use strict';var Sequelize=require(_0xb5f4('0x0'));module[_0xb5f4('0x1')]={'description':{'type':Sequelize[_0xb5f4('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb5f4('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb5f4('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xb5f4('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb5f4('0x2')],'allowNull':![],'defaultValue':_0xb5f4('0x5')},'fontSize':{'type':Sequelize[_0xb5f4('0x6')](0x2)[_0xb5f4('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb5f4('0x4')],'defaultValue':function(){return _0xb5f4('0x8');}},'notificationSound':{'type':Sequelize[_0xb5f4('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb5f4('0x6')],'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[_0xb5f4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb5f4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb5f4('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb5f4('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb5f4('0x3')],'defaultValue':![],'comment':_0xb5f4('0xa'),'set':function(_0x5c35d1){if(!_0x5c35d1)this[_0xb5f4('0xb')](_0xb5f4('0xc'),null);this[_0xb5f4('0xb')](_0xb5f4('0xd'),_0x5c35d1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ceddf5a..b9aafaa 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 _0xc03d=['Pause','MailAccount','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','keys','find','body','describe','addDisposition','MailAccountId','create','Disposition','order','removeDispositions','ids','addAnswer','findOne','CannedAnswer','hasOwnProperty','removeAnswers','email','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','fullname','Tags','color','tag','addApplications','MailApplication','priority','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','List\x20not\x20found','List','defaults','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','end','status','json','count','offset','set','apply','save','update','destroy','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xc03d,0x12f));var _0xdc03=function(_0x176711,_0x411ba3){_0x176711=_0x176711-0x0;var _0x197052=_0xc03d[_0x176711];return _0x197052;};'use strict';var pdf=require(_0xdc03('0x0'));var emlformat=require(_0xdc03('0x1'));var rimraf=require(_0xdc03('0x2'));var zipdir=require(_0xdc03('0x3'));var jsonpatch=require(_0xdc03('0x4'));var rp=require(_0xdc03('0x5'));var moment=require('moment');var BPromise=require(_0xdc03('0x6'));var Mustache=require(_0xdc03('0x7'));var util=require(_0xdc03('0x8'));var path=require(_0xdc03('0x9'));var sox=require(_0xdc03('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc03('0xb'));var squel=require(_0xdc03('0xc'));var crypto=require(_0xdc03('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc03('0xe'));var querystring=require('querystring');var Papa=require(_0xdc03('0xf'));var Redis=require(_0xdc03('0x10'));var authService=require(_0xdc03('0x11'));var qs=require(_0xdc03('0x12'));var as=require(_0xdc03('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdc03('0x14'));var config=require('../../config/environment');var db=require(_0xdc03('0x15'))['db'];config['redis']=_['defaults'](config[_0xdc03('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc03('0x17'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xdc03('0x18')](socket);var jayson=require(_0xdc03('0x19'));var client=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x2a8395,_0x1648cb,_0x16a848){if(_0x16a848){var _0x38daad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38daad[_0xdc03('0x1a')](_0x1648cb)){return _0x2a8395;}else{throw new db[(_0xdc03('0x1b'))]['ValidationError'](_0xdc03('0x1c'));}}else{return _0x2a8395;}}function respondWithRpcPromise(_0x10116b,_0x512c96,_0x15e9be,_0x2c00ad){return new BPromise(function(_0x35e7f8,_0x31e672){var _0xd8f4a7=_0x2c00ad||client;return _0xd8f4a7[_0xdc03('0x1d')](_0x10116b,_0x15e9be)[_0xdc03('0x1e')](function(_0xb24c36){logger['info'](_0xdc03('0x1f'),_0x512c96,_0xdc03('0x20'));logger['debug'](_0xdc03('0x21'),_0x512c96,_0xdc03('0x20'),JSON[_0xdc03('0x22')](_0xb24c36));if(_0xb24c36[_0xdc03('0x23')]){if(_0xb24c36['error']['code']===0x1f4){logger[_0xdc03('0x23')](_0xdc03('0x1f'),_0x512c96,_0xb24c36['error'][_0xdc03('0x24')]);return _0x31e672(_0xb24c36[_0xdc03('0x23')]['message']);}logger['error'](_0xdc03('0x1f'),_0x512c96,_0xb24c36[_0xdc03('0x23')]['message']);return _0x35e7f8(_0xb24c36[_0xdc03('0x23')][_0xdc03('0x24')]);}else{logger[_0xdc03('0x25')](_0xdc03('0x1f'),_0x512c96,'request\x20sent');_0x35e7f8(_0xb24c36[_0xdc03('0x26')][_0xdc03('0x24')]);}})['catch'](function(_0x26fdb3){logger[_0xdc03('0x23')](_0xdc03('0x1f'),_0x512c96,_0x26fdb3);_0x31e672(_0x26fdb3);});});}function respondWithStatusCode(_0x35f9fe,_0x5684de){_0x5684de=_0x5684de||0xcc;return function(_0x4c99c1){if(_0x4c99c1){return _0x35f9fe[_0xdc03('0x27')](_0x5684de);}return _0x35f9fe['status'](_0x5684de)[_0xdc03('0x28')]();};}function respondWithResult(_0x1fa1d2,_0x5cf3dc){_0x5cf3dc=_0x5cf3dc||0xc8;return function(_0x8eb971){if(_0x8eb971){return _0x1fa1d2[_0xdc03('0x29')](_0x5cf3dc)[_0xdc03('0x2a')](_0x8eb971);}};}function respondWithFilteredResult(_0x24416a,_0x5aac66){return function(_0x2952cb){if(_0x2952cb){var _0x1eeff3=_0x2952cb[_0xdc03('0x2b')],_0x13bac2=_0x5aac66['offset'],_0x7b0cec=_0x5aac66[_0xdc03('0x2c')]+_0x5aac66['limit'],_0x4e0366;if(_0x7b0cec>=_0x1eeff3){_0x7b0cec=_0x1eeff3;_0x4e0366=0xc8;}else{_0x4e0366=0xce;}_0x24416a[_0xdc03('0x29')](_0x4e0366);return _0x24416a[_0xdc03('0x2d')]('Content-Range',_0x13bac2+'-'+_0x7b0cec+'/'+_0x1eeff3)['json'](_0x2952cb);}return null;};}function patchUpdates(_0x5264a2){return function(_0x2f1806){try{jsonpatch[_0xdc03('0x2e')](_0x2f1806,_0x5264a2,!![]);}catch(_0x2f0506){return BPromise['reject'](_0x2f0506);}return _0x2f1806[_0xdc03('0x2f')]();};}function saveUpdates(_0x264e77,_0x1962d4){return function(_0x1a3f6d){if(_0x1a3f6d){return _0x1a3f6d[_0xdc03('0x30')](_0x264e77)[_0xdc03('0x1e')](function(_0x5a9baf){return _0x5a9baf;});}return null;};}function removeEntity(_0x55f9cb,_0x3341ab){return function(_0x3b44ef){if(_0x3b44ef){return _0x3b44ef[_0xdc03('0x31')]()['then'](function(){var _0x15b612=_0x3b44ef['get']({'plain':!![]});var _0x51fcc3='MailAccounts';return db[_0xdc03('0x32')][_0xdc03('0x31')]({'where':{'type':_0x51fcc3,'resourceId':_0x15b612['id']}})[_0xdc03('0x1e')](function(){return _0x3b44ef;});})[_0xdc03('0x1e')](function(){_0x55f9cb[_0xdc03('0x29')](0xcc)[_0xdc03('0x28')]();});}};}function handleEntityNotFound(_0x247a9a,_0x1ff441){return function(_0x5492f3){if(!_0x5492f3){_0x247a9a[_0xdc03('0x27')](0x194);}return _0x5492f3;};}function handleError(_0x2a5df9,_0x4be55a){_0x4be55a=_0x4be55a||0x1f4;return function(_0x190d58){logger[_0xdc03('0x23')](_0x190d58[_0xdc03('0x33')]);if(_0x190d58[_0xdc03('0x34')]){delete _0x190d58[_0xdc03('0x34')];}_0x2a5df9[_0xdc03('0x29')](_0x4be55a)[_0xdc03('0x35')](_0x190d58);};}exports[_0xdc03('0x36')]=function(_0x455b41,_0x373b94){var _0x29aeb9={'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x3b')],'as':'mandatoryDispositionPause'}]},_0x549719={},_0x243ce1={'count':0x0,'rows':[]};var _0x32bae8=_['map'](db[_0xdc03('0x3c')]['rawAttributes'],function(_0x32f2fa){return{'name':_0x32f2fa[_0xdc03('0x3d')],'type':_0x32f2fa['type'][_0xdc03('0x3e')]};});_0x549719[_0xdc03('0x3f')]=_[_0xdc03('0x40')](_0x32bae8,_0xdc03('0x34'));_0x549719[_0xdc03('0x41')]=_['keys'](_0x455b41[_0xdc03('0x41')]);_0x549719[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x549719['model'],_0x549719[_0xdc03('0x41')]);_0x29aeb9[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x549719['model'],qs[_0xdc03('0x45')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x45')]));_0x29aeb9[_0xdc03('0x44')]=_0x29aeb9['attributes'][_0xdc03('0x46')]?_0x29aeb9['attributes']:_0x549719[_0xdc03('0x3f')];if(!_0x455b41[_0xdc03('0x41')]['hasOwnProperty'](_0xdc03('0x47'))){_0x29aeb9[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x48')]);_0x29aeb9['offset']=qs[_0xdc03('0x2c')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x29aeb9['order']=qs[_0xdc03('0x49')](_0x455b41[_0xdc03('0x41')][_0xdc03('0x49')]);_0x29aeb9[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x455b41[_0xdc03('0x41')],_0x549719['filters']),_0x32bae8);if(_0x455b41[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x29aeb9[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x29aeb9[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x32bae8,function(_0x166bba){if(_0x166bba['type']!==_0xdc03('0x4e')){var _0x469410={};_0x469410[_0x166bba['name']]={'$like':'%'+_0x455b41[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x469410;}})});}_0x29aeb9=_[_0xdc03('0x4d')]({},_0x29aeb9,_0x455b41[_0xdc03('0x4f')]);var _0x49c798={'where':_0x29aeb9[_0xdc03('0x4a')]};return db[_0xdc03('0x3c')]['count'](_0x49c798)['then'](function(_0xdc066a){_0x243ce1[_0xdc03('0x2b')]=_0xdc066a;if(_0x455b41['query'][_0xdc03('0x50')]){_0x29aeb9[_0xdc03('0x51')]=[{'all':!![]}];}return db[_0xdc03('0x3c')][_0xdc03('0x52')](_0x29aeb9);})['then'](function(_0x6e7e7b){_0x243ce1[_0xdc03('0x53')]=_0x6e7e7b;return _0x243ce1;})[_0xdc03('0x1e')](respondWithFilteredResult(_0x373b94,_0x29aeb9))[_0xdc03('0x54')](handleError(_0x373b94,null));};exports[_0xdc03('0x55')]=function(_0x2d727e,_0x221743){var _0x57e358={'raw':![],'where':{'id':_0x2d727e[_0xdc03('0x56')]['id']},'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':'Smtp'},{'model':db['Pause'],'as':_0xdc03('0x57')}]},_0x63cba3={};_0x63cba3[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x3c')][_0xdc03('0x58')]);_0x63cba3['query']=_[_0xdc03('0x59')](_0x2d727e[_0xdc03('0x41')]);_0x63cba3[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x63cba3[_0xdc03('0x3f')],_0x63cba3[_0xdc03('0x41')]);_0x57e358[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x63cba3[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x2d727e[_0xdc03('0x41')]['fields']));_0x57e358[_0xdc03('0x44')]=_0x57e358['attributes'][_0xdc03('0x46')]?_0x57e358[_0xdc03('0x44')]:_0x63cba3[_0xdc03('0x3f')];if(_0x2d727e[_0xdc03('0x41')][_0xdc03('0x50')]){_0x57e358[_0xdc03('0x51')]=[{'all':!![]}];}_0x57e358=_[_0xdc03('0x4d')]({},_0x57e358,_0x2d727e['options']);return db['MailAccount'][_0xdc03('0x5a')](_0x57e358)['then'](handleEntityNotFound(_0x221743,null))[_0xdc03('0x1e')](respondWithResult(_0x221743,null))[_0xdc03('0x54')](handleError(_0x221743,null));};exports[_0xdc03('0x30')]=function(_0x509ae0,_0x4b9ec2){if(_0x509ae0[_0xdc03('0x5b')]['id']){delete _0x509ae0['body']['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x509ae0[_0xdc03('0x56')]['id']},'include':[{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4b9ec2,null))[_0xdc03('0x1e')](saveUpdates(_0x509ae0[_0xdc03('0x5b')],null))[_0xdc03('0x1e')](function(_0x534d27){if(_0x534d27&&_0x509ae0['body'][_0xdc03('0x38')]){return db[_0xdc03('0x37')][_0xdc03('0x30')](_0x509ae0[_0xdc03('0x5b')][_0xdc03('0x38')],{'where':{'MailAccountId':_0x534d27['id']}})[_0xdc03('0x1e')](function(){return _0x534d27;});}return _0x534d27;})['then'](function(_0x2004f0){if(_0x2004f0&&_0x509ae0[_0xdc03('0x5b')]['Smtp']){return db[_0xdc03('0x39')][_0xdc03('0x30')](_0x509ae0[_0xdc03('0x5b')][_0xdc03('0x3a')],{'where':{'MailAccountId':_0x2004f0['id']}})[_0xdc03('0x1e')](function(){return _0x2004f0;});}return _0x2004f0;})[_0xdc03('0x1e')](respondWithResult(_0x4b9ec2,null))[_0xdc03('0x54')](handleError(_0x4b9ec2,null));};exports[_0xdc03('0x5c')]=function(_0x2296ef,_0x5ab8fd){return db[_0xdc03('0x3c')][_0xdc03('0x5c')]()[_0xdc03('0x1e')](respondWithResult(_0x5ab8fd,null))[_0xdc03('0x54')](handleError(_0x5ab8fd,null));};exports[_0xdc03('0x5d')]=function(_0x35a4de,_0x2e9370,_0x13f5ad){if(_0x35a4de['body']['id']){delete _0x35a4de[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x35a4de['params']['id']}})['then'](handleEntityNotFound(_0x2e9370,null))[_0xdc03('0x1e')](function(_0x40d191){if(_0x40d191){_0x35a4de[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x40d191['id'];return db['Disposition'][_0xdc03('0x5f')](_0x35a4de[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x2e9370,null))[_0xdc03('0x54')](handleError(_0x2e9370,null));};exports['getDispositions']=function(_0x2a9677,_0x160cfe,_0x2d617c){var _0x451677={'raw':![],'where':{}};var _0x1eedd0={};var _0x1cb1b0={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2a9677[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x160cfe,null))[_0xdc03('0x1e')](function(_0x4bde3f){if(_0x4bde3f){_0x1eedd0[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db[_0xdc03('0x60')]['rawAttributes']);_0x1eedd0[_0xdc03('0x41')]=_[_0xdc03('0x59')](_0x2a9677[_0xdc03('0x41')]);_0x1eedd0['filters']=_[_0xdc03('0x43')](_0x1eedd0[_0xdc03('0x3f')],_0x1eedd0['query']);_0x451677['attributes']=_['intersection'](_0x1eedd0[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x2a9677[_0xdc03('0x41')]['fields']));_0x451677[_0xdc03('0x44')]=_0x451677[_0xdc03('0x44')][_0xdc03('0x46')]?_0x451677['attributes']:_0x1eedd0[_0xdc03('0x3f')];if(!_0x2a9677[_0xdc03('0x41')]['hasOwnProperty']('nolimit')){_0x451677[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x2a9677[_0xdc03('0x41')][_0xdc03('0x48')]);_0x451677[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x2a9677[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x451677[_0xdc03('0x61')]=qs['sort'](_0x2a9677[_0xdc03('0x41')]['sort']);_0x451677[_0xdc03('0x4a')]=qs['filters'](_[_0xdc03('0x4b')](_0x2a9677[_0xdc03('0x41')],_0x1eedd0['filters']));_0x451677['where'][_0xdc03('0x5e')]=_0x4bde3f['id'];if(_0x2a9677['query'][_0xdc03('0x4c')]){_0x451677[_0xdc03('0x4a')]=_['merge'](_0x451677[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x451677[_0xdc03('0x44')],function(_0x48297e){var _0xa9ec99={};_0xa9ec99[_0x48297e]={'$like':'%'+_0x2a9677['query'][_0xdc03('0x4c')]+'%'};return _0xa9ec99;})});}_0x451677=_[_0xdc03('0x4d')]({},_0x451677,_0x2a9677[_0xdc03('0x4f')]);return db[_0xdc03('0x60')][_0xdc03('0x2b')]({'where':_0x451677[_0xdc03('0x4a')]})[_0xdc03('0x1e')](function(_0x3edff7){_0x1cb1b0[_0xdc03('0x2b')]=_0x3edff7;if(_0x2a9677['query'][_0xdc03('0x50')]){_0x451677['include']=[{'all':!![]}];}return db['Disposition'][_0xdc03('0x52')](_0x451677);})[_0xdc03('0x1e')](function(_0x50b374){_0x1cb1b0[_0xdc03('0x53')]=_0x50b374;return _0x1cb1b0;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x160cfe,_0x451677))['catch'](handleError(_0x160cfe,null));};exports[_0xdc03('0x62')]=function(_0x3d7507,_0x6d346b,_0x33cf3e){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x3d7507[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x6d346b,null))[_0xdc03('0x1e')](function(_0x5163ed){if(_0x5163ed){return _0x5163ed['removeDispositions'](_0x3d7507[_0xdc03('0x41')][_0xdc03('0x63')]);}})['then'](respondWithStatusCode(_0x6d346b,null))[_0xdc03('0x54')](handleError(_0x6d346b,null));};exports[_0xdc03('0x64')]=function(_0x1f552f,_0x5e203f,_0x2e325f){if(_0x1f552f[_0xdc03('0x5b')]['id']){delete _0x1f552f[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x1f552f[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x5e203f,null))[_0xdc03('0x1e')](function(_0x351067){if(_0x351067){_0x1f552f[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x351067['id'];return db['CannedAnswer'][_0xdc03('0x5f')](_0x1f552f[_0xdc03('0x5b')]);}})['then'](respondWithResult(_0x5e203f,null))[_0xdc03('0x54')](handleError(_0x5e203f,null));};exports['getAnswers']=function(_0x3fa927,_0xa63ab3,_0x4da1a6){var _0x52f57c={'raw':![],'where':{}};var _0x4e255f={};var _0x46094b={'count':0x0,'rows':[]};return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x3fa927[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0xa63ab3,null))[_0xdc03('0x1e')](function(_0x3a2a0e){if(_0x3a2a0e){_0x4e255f[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x66')][_0xdc03('0x58')]);_0x4e255f['query']=_[_0xdc03('0x59')](_0x3fa927['query']);_0x4e255f['filters']=_[_0xdc03('0x43')](_0x4e255f[_0xdc03('0x3f')],_0x4e255f[_0xdc03('0x41')]);_0x52f57c[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x4e255f[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3fa927[_0xdc03('0x41')][_0xdc03('0x45')]));_0x52f57c[_0xdc03('0x44')]=_0x52f57c[_0xdc03('0x44')][_0xdc03('0x46')]?_0x52f57c[_0xdc03('0x44')]:_0x4e255f[_0xdc03('0x3f')];if(!_0x3fa927[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x52f57c[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x3fa927[_0xdc03('0x41')][_0xdc03('0x48')]);_0x52f57c['offset']=qs[_0xdc03('0x2c')](_0x3fa927['query']['offset']);}_0x52f57c[_0xdc03('0x61')]=qs['sort'](_0x3fa927[_0xdc03('0x41')]['sort']);_0x52f57c[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3fa927['query'],_0x4e255f[_0xdc03('0x42')]));_0x52f57c['where'][_0xdc03('0x5e')]=_0x3a2a0e['id'];if(_0x3fa927[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x52f57c[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x52f57c[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x52f57c[_0xdc03('0x44')],function(_0x57fd5c){var _0x498766={};_0x498766[_0x57fd5c]={'$like':'%'+_0x3fa927[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x498766;})});}_0x52f57c=_[_0xdc03('0x4d')]({},_0x52f57c,_0x3fa927[_0xdc03('0x4f')]);return db[_0xdc03('0x66')][_0xdc03('0x2b')]({'where':_0x52f57c[_0xdc03('0x4a')]})['then'](function(_0x32a31e){_0x46094b[_0xdc03('0x2b')]=_0x32a31e;if(_0x3fa927[_0xdc03('0x41')]['includeAll']){_0x52f57c[_0xdc03('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdc03('0x52')](_0x52f57c);})[_0xdc03('0x1e')](function(_0x3e3c72){_0x46094b[_0xdc03('0x53')]=_0x3e3c72;return _0x46094b;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0xa63ab3,_0x52f57c))[_0xdc03('0x54')](handleError(_0xa63ab3,null));};exports['removeAnswers']=function(_0x50502a,_0x38b7cd,_0x4791d0){return db['MailAccount'][_0xdc03('0x5a')]({'where':{'id':_0x50502a[_0xdc03('0x56')]['id']}})['then'](handleEntityNotFound(_0x38b7cd,null))['then'](function(_0x50f5f5){if(_0x50f5f5){return _0x50f5f5[_0xdc03('0x68')](_0x50502a[_0xdc03('0x41')]['ids']);}})[_0xdc03('0x1e')](respondWithStatusCode(_0x38b7cd,null))[_0xdc03('0x54')](handleError(_0x38b7cd,null));};exports[_0xdc03('0x5f')]=function(_0x252b1e,_0x389f3e){var _0x4d0af4={'name':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x34')],'key':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x3e')],'email':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x69')],'ListId':_0x252b1e[_0xdc03('0x5b')]['ListId'],'active':!_['isNil'](_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6a')])?_0x252b1e['body'][_0xdc03('0x6a')]:!![],'description':_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6b')]||null,'Imap':{},'Smtp':{}};if(_[_0xdc03('0x6c')](_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6d')])){if(_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x6e')]){_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x6f')]=_0x4d0af4[_0xdc03('0x3a')]['user']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x70')];_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x71')]=_0x4d0af4['Smtp'][_0xdc03('0x72')]=_0x252b1e[_0xdc03('0x5b')]['cpassword'];}else{_0x4d0af4[_0xdc03('0x38')]['authentication']=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x73')]=![];}_0x4d0af4['Imap'][_0xdc03('0x74')]=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x38')][_0xdc03('0x74')];_0x4d0af4['Imap'][_0xdc03('0x75')]=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x38')]['port'];_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x74')]=_0x252b1e['body'][_0xdc03('0x3a')][_0xdc03('0x74')];_0x4d0af4[_0xdc03('0x3a')]['port']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x3a')][_0xdc03('0x75')];}else{_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x76')]=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x76')]=_0x252b1e['body'][_0xdc03('0x6d')];_0x4d0af4['Imap'][_0xdc03('0x6f')]=_0x4d0af4[_0xdc03('0x3a')][_0xdc03('0x6f')]=_0x252b1e['body'][_0xdc03('0x70')];_0x4d0af4[_0xdc03('0x38')][_0xdc03('0x71')]=_0x4d0af4[_0xdc03('0x3a')]['pass']=_0x252b1e[_0xdc03('0x5b')][_0xdc03('0x77')];}return db[_0xdc03('0x3c')]['create'](_0x4d0af4,{'include':[{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a')},{'model':db[_0xdc03('0x37')],'as':_0xdc03('0x38')}]})['then'](function(_0x17a46a){var _0x3799e5=_0x252b1e[_0xdc03('0x6f')][_0xdc03('0x78')]({'plain':!![]});if(!_0x3799e5)throw new Error(_0xdc03('0x79'));if(_0x3799e5['role']===_0xdc03('0x6f')){var _0x56a98c=_0x17a46a['get']({'plain':!![]});return db[_0xdc03('0x7a')][_0xdc03('0x5a')]({'where':{'name':'MailAccounts','userProfileId':_0x3799e5[_0xdc03('0x7b')]},'raw':!![]})[_0xdc03('0x1e')](function(_0x3d8503){if(_0x3d8503&&_0x3d8503[_0xdc03('0x7c')]===0x0){return db['UserProfileResource'][_0xdc03('0x5f')]({'name':_0x56a98c[_0xdc03('0x34')],'resourceId':_0x56a98c['id'],'type':_0x3d8503[_0xdc03('0x34')],'sectionId':_0x3d8503['id']},{})['then'](function(){return _0x17a46a;});}else{return _0x17a46a;}})[_0xdc03('0x54')](function(_0x24b221){logger[_0xdc03('0x23')](_0xdc03('0x7d'),_0x24b221);throw _0x24b221;});}return _0x17a46a;})[_0xdc03('0x1e')](respondWithResult(_0x389f3e,0xc9))['catch'](handleError(_0x389f3e,null));};exports[_0xdc03('0x7e')]=function(_0x241f70,_0x33a01b,_0x4ccc43){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x241f70[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x33a01b,null))[_0xdc03('0x1e')](function(_0x473626){if(_0x473626){return _0x473626[_0xdc03('0x7e')]();}return null;})[_0xdc03('0x1e')](respondWithResult(_0x33a01b,null))[_0xdc03('0x54')](handleError(_0x33a01b,null));};exports['addImap']=function(_0x56b70d,_0x37400e,_0x2d8865){if(_0x56b70d[_0xdc03('0x5b')]['id']){delete _0x56b70d[_0xdc03('0x5b')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x56b70d['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x37400e,null))['then'](function(_0x40363e){if(_0x40363e){_0x56b70d['body'][_0xdc03('0x5e')]=_0x40363e['id'];return db['MailServerIn'][_0xdc03('0x5f')](_0x56b70d[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x37400e,null))[_0xdc03('0x54')](handleError(_0x37400e,null));};exports[_0xdc03('0x7f')]=function(_0x2fa197,_0x14630f,_0x54dccb){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x2fa197[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x14630f,null))[_0xdc03('0x1e')](function(_0x191f35){if(_0x191f35){return _0x191f35[_0xdc03('0x80')](null);}return null;})[_0xdc03('0x1e')](respondWithStatusCode(_0x14630f,null))[_0xdc03('0x54')](handleError(_0x14630f,null));};exports[_0xdc03('0x81')]=function(_0x56216d,_0x43a00a,_0x4557cc){return db['MailAccount']['findOne']({'where':{'id':_0x56216d['params']['id']}})['then'](handleEntityNotFound(_0x43a00a,null))[_0xdc03('0x1e')](function(_0x352c49){if(_0x352c49){return _0x352c49['getSmtp']();}return null;})['then'](respondWithResult(_0x43a00a,null))[_0xdc03('0x54')](handleError(_0x43a00a,null));};exports[_0xdc03('0x82')]=function(_0x45838d,_0x4643a9,_0x322cef){if(_0x45838d[_0xdc03('0x5b')]['id']){delete _0x45838d[_0xdc03('0x5b')]['id'];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x45838d[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x4643a9,null))[_0xdc03('0x1e')](function(_0x1c5229){if(_0x1c5229){_0x45838d[_0xdc03('0x5b')][_0xdc03('0x5e')]=_0x1c5229['id'];return db[_0xdc03('0x39')][_0xdc03('0x5f')](_0x45838d[_0xdc03('0x5b')]);}})[_0xdc03('0x1e')](respondWithResult(_0x4643a9,null))['catch'](handleError(_0x4643a9,null));};exports[_0xdc03('0x83')]=function(_0x359d0b,_0x46aacc,_0x13e696){return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x359d0b[_0xdc03('0x56')]['id']}})['then'](handleEntityNotFound(_0x46aacc,null))[_0xdc03('0x1e')](function(_0x2659cb){if(_0x2659cb){return _0x2659cb[_0xdc03('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x46aacc,null))[_0xdc03('0x54')](handleError(_0x46aacc,null));};exports[_0xdc03('0x85')]=function(_0x340506,_0x56ad86,_0x24fe57){return db[_0xdc03('0x86')][_0xdc03('0x5a')]({'where':{'id':_0x340506[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x56ad86,null))[_0xdc03('0x1e')](function(_0x10644a){if(_0x10644a){return _0x10644a['addInteraction'](_0x340506['body'][_0xdc03('0x63')],_[_0xdc03('0x87')](_0x340506[_0xdc03('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x56ad86,null))[_0xdc03('0x54')](handleError(_0x56ad86,null));};exports['getInteractions']=function(_0x3767e1,_0x295ca4,_0x2fd7f3){var _0x3736a0={'raw':![],'where':{}};var _0x3da0ca={};var _0x238ff3={'count':0x0,'rows':[]};return db[_0xdc03('0x3c')]['findOne']({'where':{'id':_0x3767e1['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x295ca4,null))['then'](function(_0x59c2d0){if(_0x59c2d0){_0x3da0ca[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db['MailInteraction']['rawAttributes']);_0x3da0ca['query']=_[_0xdc03('0x59')](_0x3767e1[_0xdc03('0x41')]);_0x3da0ca[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x3da0ca[_0xdc03('0x3f')],_0x3da0ca[_0xdc03('0x41')]);_0x3736a0[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x3da0ca[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x45')]));_0x3736a0[_0xdc03('0x44')]=_0x3736a0[_0xdc03('0x44')][_0xdc03('0x46')]?_0x3736a0[_0xdc03('0x44')]:_0x3da0ca[_0xdc03('0x3f')];if(!_0x3767e1[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x3736a0[_0xdc03('0x48')]=qs['limit'](_0x3767e1['query'][_0xdc03('0x48')]);_0x3736a0[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x3736a0['order']=qs[_0xdc03('0x49')](_0x3767e1[_0xdc03('0x41')][_0xdc03('0x49')]);_0x3736a0[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3767e1['query'],_0x3da0ca['filters']));_0x3736a0['where'][_0xdc03('0x5e')]=_0x59c2d0['id'];if(_0x3767e1[_0xdc03('0x41')]['filter']){_0x3736a0[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x3736a0[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x3736a0[_0xdc03('0x44')],function(_0x1f8581){var _0x52e1eb={};_0x52e1eb[_0x1f8581]={'$like':'%'+_0x3767e1[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x52e1eb;})});}_0x3736a0=_[_0xdc03('0x4d')]({},_0x3736a0,_0x3767e1[_0xdc03('0x4f')]);return db[_0xdc03('0x86')][_0xdc03('0x2b')]({'where':_0x3736a0[_0xdc03('0x4a')]})[_0xdc03('0x1e')](function(_0x44e3f9){_0x238ff3[_0xdc03('0x2b')]=_0x44e3f9;if(_0x3767e1['query'][_0xdc03('0x50')]){_0x3736a0[_0xdc03('0x51')]=[{'model':db['CmContact'],'as':_0xdc03('0x88'),'required':![]},{'model':db[_0xdc03('0x89')],'as':_0xdc03('0x8a'),'attributes':['name',_0xdc03('0x8b'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xdc03('0x8c'),'attributes':['id',_0xdc03('0x34'),_0xdc03('0x8d')],'where':_0x3767e1[_0xdc03('0x41')][_0xdc03('0x8e')]?{'id':_0x3767e1[_0xdc03('0x41')][_0xdc03('0x8e')]}:undefined,'required':_0x3767e1[_0xdc03('0x41')]['tag']?!![]:![]}];}return db[_0xdc03('0x86')][_0xdc03('0x52')](_0x3736a0);})['then'](function(_0x136ed6){_0x238ff3[_0xdc03('0x53')]=_0x136ed6;return _0x238ff3;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x295ca4,_0x3736a0))[_0xdc03('0x54')](handleError(_0x295ca4,null));};exports[_0xdc03('0x8f')]=function(_0x5964fb,_0x4722c2,_0x2e7707){return db[_0xdc03('0x3c')]['findOne']({'where':{'id':_0x5964fb[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x4722c2,null))[_0xdc03('0x1e')](function(_0x545d4b){if(_0x545d4b){return db['sequelize']['transaction'](function(_0x43c045){return db[_0xdc03('0x90')][_0xdc03('0x31')]({'where':{'MailAccountId':_0x5964fb['params']['id']},'transaction':_0x43c045})[_0xdc03('0x1e')](function(_0x2e1eb7){var _0x44ffdb=_[_0xdc03('0x40')](_0x5964fb[_0xdc03('0x5b')],function(_0x51ef27){_0x51ef27[_0xdc03('0x5e')]=_0x5964fb[_0xdc03('0x56')]['id'];return _0x51ef27;});return db[_0xdc03('0x90')]['bulkCreate'](_0x44ffdb,{'transaction':_0x43c045});});})[_0xdc03('0x1e')](function(){return db[_0xdc03('0x90')]['findAndCountAll']({'where':{'MailAccountId':_0x5964fb[_0xdc03('0x56')]['id']},'order':_0xdc03('0x91')});});}})[_0xdc03('0x1e')](respondWithResult(_0x4722c2,null))[_0xdc03('0x54')](handleError(_0x4722c2,null));};exports[_0xdc03('0x92')]=function(_0x18424b,_0x539e49,_0x49fdb0){var _0x6cc669={};var _0xc5a33d={};var _0x46d09d;var _0x34779b;return db[_0xdc03('0x3c')][_0xdc03('0x65')]({'where':{'id':_0x18424b['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x539e49,null))['then'](function(_0x34ad49){if(_0x34ad49){_0x46d09d=_0x34ad49;_0xc5a33d[_0xdc03('0x3f')]=_[_0xdc03('0x59')](db[_0xdc03('0x90')][_0xdc03('0x58')]);_0xc5a33d['query']=_[_0xdc03('0x59')](_0x18424b[_0xdc03('0x41')]);_0xc5a33d[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0xc5a33d[_0xdc03('0x3f')],_0xc5a33d[_0xdc03('0x41')]);_0x6cc669['attributes']=_[_0xdc03('0x43')](_0xc5a33d[_0xdc03('0x3f')],qs['fields'](_0x18424b[_0xdc03('0x41')]['fields']));_0x6cc669['attributes']=_0x6cc669[_0xdc03('0x44')][_0xdc03('0x46')]?_0x6cc669['attributes']:_0xc5a33d[_0xdc03('0x3f')];_0x6cc669[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x18424b[_0xdc03('0x41')][_0xdc03('0x49')]);_0x6cc669['where']=qs[_0xdc03('0x42')](_['pick'](_0x18424b[_0xdc03('0x41')],_0xc5a33d[_0xdc03('0x42')]));if(_0x18424b[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x6cc669[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x6cc669['where'],{'$or':_[_0xdc03('0x40')](_0x6cc669[_0xdc03('0x44')],function(_0x11e400){var _0x259364={};_0x259364[_0x11e400]={'$like':'%'+_0x18424b['query']['filter']+'%'};return _0x259364;})});}_0x6cc669=_[_0xdc03('0x4d')]({},_0x6cc669,_0x18424b[_0xdc03('0x4f')]);return _0x46d09d[_0xdc03('0x92')](_0x6cc669);}})[_0xdc03('0x1e')](function(_0xab0d6d){if(_0xab0d6d){_0x34779b=_0xab0d6d['length'];if(!_0x18424b['query']['hasOwnProperty']('nolimit')){_0x6cc669[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x18424b['query'][_0xdc03('0x48')]);_0x6cc669['offset']=qs[_0xdc03('0x2c')](_0x18424b['query'][_0xdc03('0x2c')]);}return _0x46d09d[_0xdc03('0x92')](_0x6cc669);}})['then'](function(_0x478c6e){if(_0x478c6e){return _0x478c6e?{'count':_0x34779b,'rows':_0x478c6e}:null;}})['then'](respondWithResult(_0x539e49,null))['catch'](handleError(_0x539e49,null));};exports[_0xdc03('0x93')]=function(_0x5bf7d5,_0x458da3,_0x1574e8){var _0x473c28={'raw':!![],'where':{}};var _0x1ffe7b={};var _0x56f0b8={'count':0x0,'rows':[]};return db['MailAccount'][_0xdc03('0x65')]({'where':{'id':_0x5bf7d5[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x458da3,null))['then'](function(_0x2d9c79){if(_0x2d9c79){_0x1ffe7b['model']=_[_0xdc03('0x59')](db['MailMessage'][_0xdc03('0x58')]);_0x1ffe7b[_0xdc03('0x41')]=_[_0xdc03('0x59')](_0x5bf7d5[_0xdc03('0x41')]);_0x1ffe7b[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x1ffe7b[_0xdc03('0x3f')],_0x1ffe7b[_0xdc03('0x41')]);_0x473c28[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x1ffe7b[_0xdc03('0x3f')],qs['fields'](_0x5bf7d5[_0xdc03('0x41')]['fields']));_0x473c28['attributes']=_0x473c28[_0xdc03('0x44')][_0xdc03('0x46')]?_0x473c28[_0xdc03('0x44')]:_0x1ffe7b['model'];if(!_0x5bf7d5['query'][_0xdc03('0x67')](_0xdc03('0x47'))){_0x473c28[_0xdc03('0x48')]=qs[_0xdc03('0x48')](_0x5bf7d5[_0xdc03('0x41')]['limit']);_0x473c28[_0xdc03('0x2c')]=qs[_0xdc03('0x2c')](_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x2c')]);}_0x473c28[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x5bf7d5['query'][_0xdc03('0x49')]);_0x473c28[_0xdc03('0x4a')]=qs['filters'](_[_0xdc03('0x4b')](_0x5bf7d5[_0xdc03('0x41')],_0x1ffe7b[_0xdc03('0x42')]));_0x473c28[_0xdc03('0x4a')][_0xdc03('0x5e')]=_0x2d9c79['id'];if(_0x5bf7d5[_0xdc03('0x41')]['filter']){_0x473c28[_0xdc03('0x4a')]=_['merge'](_0x473c28[_0xdc03('0x4a')],{'$or':_[_0xdc03('0x40')](_0x473c28['attributes'],function(_0x32e259){var _0x12e3d6={};_0x12e3d6[_0x32e259]={'$like':'%'+_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x12e3d6;})});}if(_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x94')]){var _0x99781d=_0x5bf7d5[_0xdc03('0x41')][_0xdc03('0x94')][_0xdc03('0x95')](',');var _0x3b0a3b={};_0x3b0a3b[_0x99781d[0x0]]={'$gte':moment(_0x99781d[0x1])['format'](_0xdc03('0x96'))};_0x473c28[_0xdc03('0x4a')]=_[_0xdc03('0x4d')](_0x473c28[_0xdc03('0x4a')],_0x3b0a3b);}_0x473c28=_[_0xdc03('0x4d')]({},_0x473c28,_0x5bf7d5['options']);return db[_0xdc03('0x97')]['count']({'where':_0x473c28['where']})[_0xdc03('0x1e')](function(_0x5374b4){_0x56f0b8[_0xdc03('0x2b')]=_0x5374b4;if(_0x5bf7d5[_0xdc03('0x41')]['includeAll']){_0x473c28[_0xdc03('0x51')]=[{'all':!![]}];}return db[_0xdc03('0x97')][_0xdc03('0x52')](_0x473c28);})[_0xdc03('0x1e')](function(_0x529757){_0x56f0b8[_0xdc03('0x53')]=_0x529757;return _0x56f0b8;});}})[_0xdc03('0x1e')](respondWithFilteredResult(_0x458da3,_0x473c28))[_0xdc03('0x54')](handleError(_0x458da3,null));};exports[_0xdc03('0x35')]=function(_0xe3cb4e,_0x396340,_0x3d77f1){var _0x5a8f86,_0xc4f6b3={},_0x1a2164;if(_0xe3cb4e[_0xdc03('0x5b')]['to']){_0x1a2164=_0xe3cb4e[_0xdc03('0x5b')]['to']['split'](',')[0x0];}return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0xe3cb4e[_0xdc03('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xdc03('0x98')],'as':_0xdc03('0x99'),'where':{'email':_0x1a2164},'limit':0x1,'order':[[_0xdc03('0x9a'),_0xdc03('0x9b')]]}]},{'model':db[_0xdc03('0x39')],'as':_0xdc03('0x3a'),'raw':!![]}]})[_0xdc03('0x1e')](handleEntityNotFound(_0x396340,null))['then'](function(_0x2d1fc7){if(_0x2d1fc7){_0x5a8f86=_0x2d1fc7;if(_0x2d1fc7[_0xdc03('0x3a')]){if(_[_0xdc03('0x6c')](_0xe3cb4e['body']['from'])){_0xe3cb4e['body'][_0xdc03('0x9c')]=util['format'](_0xdc03('0x9d'),_0x2d1fc7[_0xdc03('0x34')],_0x2d1fc7[_0xdc03('0x69')]||_0x2d1fc7['Smtp'][_0xdc03('0x6f')]);}if(_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')]&&_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')]['length']){for(var _0x462a76=0x0;_0x462a76<_0xe3cb4e[_0xdc03('0x5b')]['attachments']['length'];_0x462a76+=0x1){_0xe3cb4e['body'][_0xdc03('0x9e')][_0x462a76]={'filename':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')][_0x462a76]['name'],'path':path['join'](config['root'],_0xdc03('0x9f'),_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9e')][_0x462a76][_0xdc03('0xa0')])};}}var _0x36759d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x2d1fc7[_0xdc03('0x3a')]['service'])){if(_0x2d1fc7[_0xdc03('0x3a')]['authentication']){_0x36759d[_0xdc03('0xa1')]={'user':_0x2d1fc7[_0xdc03('0x3a')]['user'],'pass':_0x2d1fc7['Smtp'][_0xdc03('0x72')]};}_0x36759d[_0xdc03('0x74')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x74')];_0x36759d[_0xdc03('0x75')]=_0x2d1fc7[_0xdc03('0x3a')]['port'];_0x36759d[_0xdc03('0xa2')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0xa2')];}else{_0x36759d[_0xdc03('0x76')]=_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x76')];_0x36759d['auth']={'user':_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x6f')],'pass':_0x2d1fc7[_0xdc03('0x3a')][_0xdc03('0x72')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x36759d,'message':_0xe3cb4e['body']});}else{throw new Error(_0xdc03('0xa3'));}}})[_0xdc03('0x1e')](function(_0x55a316){if(_0x55a316){_0xc4f6b3=_0x55a316;if(_0x5a8f86[_0xdc03('0xa4')]){if(_0x5a8f86[_0xdc03('0xa4')]['Contacts'][_0xdc03('0x46')]){return _0x5a8f86['List'][_0xdc03('0x99')][0x0];}else{return db[_0xdc03('0x98')][_0xdc03('0x5f')](_[_0xdc03('0xa5')](_0xe3cb4e[_0xdc03('0x5b')],{'firstName':_0xe3cb4e[_0xdc03('0x5b')]['to'],'email':_0xe3cb4e['body']['to'],'phone':_0xe3cb4e[_0xdc03('0x5b')]['to'],'ListId':_0x5a8f86['ListId']}));}}else{throw new Error(_0xdc03('0xa3'));}}})[_0xdc03('0x1e')](function(_0x430443){if(_0x430443){var _0x3fe728={'UserId':_0xe3cb4e[_0xdc03('0x6f')]['id'],'ContactId':_0x430443['id'],'MailAccountId':_0x5a8f86['id'],'inReplyTo':_0xc4f6b3['messageId'],'to':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x9c')],'cc':_0xe3cb4e[_0xdc03('0x5b')]['cc'],'subject':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0xa6')],'attach':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0xa7')],'firstMsgDirection':_0xdc03('0xa8'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xdc03('0xa8'),'lastMsgBody':_0xe3cb4e[_0xdc03('0x5b')][_0xdc03('0x5b')],'Messages':[_[_0xdc03('0x4d')](_0xe3cb4e[_0xdc03('0x5b')],{'messageId':_0xc4f6b3['messageId'],'sentAt':moment()['format'](_0xdc03('0x96')),'read':!![],'MailAccountId':_0x5a8f86['id'],'UserId':_0xe3cb4e[_0xdc03('0x6f')]['id'],'ContactId':_0x430443['id']})]};if(_0xe3cb4e['body']['Interaction']){_0x3fe728=_['merge'](_0x3fe728,_0xe3cb4e['body'][_0xdc03('0xa9')]);}return db[_0xdc03('0x86')][_0xdc03('0x5f')](_0x3fe728,{'include':[{'model':db[_0xdc03('0x97')],'as':'Messages'}]});}})['then'](respondWithResult(_0x396340,null))[_0xdc03('0x54')](handleError(_0x396340,null));};exports[_0xdc03('0xaa')]=function(_0x148b83,_0x317c7d,_0x3adca7){return db[_0xdc03('0x3c')][_0xdc03('0x5a')]({'where':{'id':_0x148b83['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xdc03('0x1e')](handleEntityNotFound(_0x317c7d,null))[_0xdc03('0x1e')](function(_0x48e890){if(_0x48e890&&_0x48e890[_0xdc03('0x3a')]){var _0x3c72ee={'id':_0x48e890['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48e890[_0xdc03('0x3a')][_0xdc03('0x76')]){_0x3c72ee[_0xdc03('0x76')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x76')];}else{_0x3c72ee[_0xdc03('0x74')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x74')];_0x3c72ee[_0xdc03('0x75')]=_0x48e890[_0xdc03('0x3a')][_0xdc03('0x75')];_0x3c72ee[_0xdc03('0xa2')]=_0x48e890['Smtp']['secure'];}if(_0x48e890[_0xdc03('0x3a')][_0xdc03('0x73')]){_0x3c72ee[_0xdc03('0xa1')]={'user':_0x48e890[_0xdc03('0x3a')]['user'],'pass':_0x48e890[_0xdc03('0x3a')][_0xdc03('0x72')]};}return respondWithRpcPromise(_0xdc03('0xab'),_0xdc03('0xaa'),{'account':_0x3c72ee});}})[_0xdc03('0x1e')](respondWithResult(_0x317c7d,null))[_0xdc03('0x54')](handleError(_0x317c7d,null));};exports[_0xdc03('0x31')]=function(_0x18b586,_0x1d3aec){return db['MailAccount']['find']({'where':{'id':_0x18b586[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x1d3aec,null))['then'](function(_0xf8e931){if(_0xf8e931&&_0xf8e931[_0xdc03('0x76')]){throw new db[(_0xdc03('0x1b'))][(_0xdc03('0xac'))](_0xdc03('0xad'));}return _0xf8e931;})[_0xdc03('0x1e')](removeEntity(_0x1d3aec,null))[_0xdc03('0x54')](handleError(_0x1d3aec,null));};exports[_0xdc03('0xae')]=function(_0x481c7a,_0x57c2ea,_0x4ae3db){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x481c7a[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x57c2ea,null))['then'](function(_0x12c94c){if(_0x12c94c){return _0x12c94c[_0xdc03('0xae')](_0x481c7a[_0xdc03('0x5b')][_0xdc03('0x63')],_['omit'](_0x481c7a['body'],[_0xdc03('0x63'),'id'])||{})[_0xdc03('0xaf')](function(_0x1f7df9){for(var _0x10f41d=0x0;_0x10f41d<_0x481c7a[_0xdc03('0x5b')][_0xdc03('0x63')][_0xdc03('0x46')];_0x10f41d+=0x1){socket[_0xdc03('0xb0')]('userMailAccount:save',{'UserId':_0x481c7a['body'][_0xdc03('0x63')][_0x10f41d],'MailAccountId':_0x481c7a[_0xdc03('0x56')]['id']});}return _0x1f7df9;});}})[_0xdc03('0x1e')](respondWithResult(_0x57c2ea,null))[_0xdc03('0x54')](handleError(_0x57c2ea,null));};exports['removeAgents']=function(_0x4de61e,_0x343a00,_0x33bafb){return db[_0xdc03('0x3c')]['find']({'where':{'id':_0x4de61e[_0xdc03('0x56')]['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0x343a00,null))[_0xdc03('0x1e')](function(_0x394ccd){if(_0x394ccd){return _0x394ccd[_0xdc03('0xb1')](_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')])['then'](function(){if(_[_0xdc03('0xb2')](_0x4de61e['query'][_0xdc03('0x63')])){for(var _0x4f636e=0x0;_0x4f636e<_0x4de61e[_0xdc03('0x41')]['ids'][_0xdc03('0x46')];_0x4f636e+=0x1){socket[_0xdc03('0xb0')](_0xdc03('0xb3'),{'UserId':Number(_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')][_0x4f636e]),'MailAccountId':Number(_0x4de61e[_0xdc03('0x56')]['id'])});}}else{socket[_0xdc03('0xb0')]('userMailAccount:remove',{'UserId':Number(_0x4de61e[_0xdc03('0x41')][_0xdc03('0x63')]),'MailAccountId':Number(_0x4de61e['params']['id'])});}});}})[_0xdc03('0x1e')](respondWithStatusCode(_0x343a00,null))[_0xdc03('0x54')](handleError(_0x343a00,null));};exports['getAgents']=function(_0x3610ab,_0xe21373,_0x5cd161){var _0x3a2cca={};var _0x515112={};var _0x5aa30c;var _0x392df2;return db['MailAccount'][_0xdc03('0x65')]({'where':{'id':_0x3610ab['params']['id']}})[_0xdc03('0x1e')](handleEntityNotFound(_0xe21373,null))[_0xdc03('0x1e')](function(_0x582582){if(_0x582582){_0x5aa30c=_0x582582;_0x515112[_0xdc03('0x3f')]=_['keys'](db[_0xdc03('0x89')][_0xdc03('0x58')]);_0x515112['query']=_[_0xdc03('0x59')](_0x3610ab[_0xdc03('0x41')]);_0x515112[_0xdc03('0x42')]=_[_0xdc03('0x43')](_0x515112[_0xdc03('0x3f')],_0x515112[_0xdc03('0x41')]);_0x3a2cca[_0xdc03('0x44')]=_[_0xdc03('0x43')](_0x515112[_0xdc03('0x3f')],qs[_0xdc03('0x45')](_0x3610ab['query'][_0xdc03('0x45')]));_0x3a2cca[_0xdc03('0x44')]=_0x3a2cca[_0xdc03('0x44')]['length']?_0x3a2cca[_0xdc03('0x44')]:_0x515112[_0xdc03('0x3f')];_0x3a2cca[_0xdc03('0x61')]=qs[_0xdc03('0x49')](_0x3610ab[_0xdc03('0x41')][_0xdc03('0x49')]);_0x3a2cca[_0xdc03('0x4a')]=qs[_0xdc03('0x42')](_[_0xdc03('0x4b')](_0x3610ab[_0xdc03('0x41')],_0x515112[_0xdc03('0x42')]));if(_0x3610ab[_0xdc03('0x41')][_0xdc03('0x4c')]){_0x3a2cca[_0xdc03('0x4a')]=_['merge'](_0x3a2cca['where'],{'$or':_['map'](_0x3a2cca[_0xdc03('0x44')],function(_0xbc3b00){var _0x1eb6d5={};_0x1eb6d5[_0xbc3b00]={'$like':'%'+_0x3610ab[_0xdc03('0x41')][_0xdc03('0x4c')]+'%'};return _0x1eb6d5;})});}_0x3a2cca=_[_0xdc03('0x4d')]({},_0x3a2cca,_0x3610ab[_0xdc03('0x4f')]);return _0x5aa30c[_0xdc03('0xb4')](_0x3a2cca);}})[_0xdc03('0x1e')](function(_0x435b4f){if(_0x435b4f){_0x392df2=_0x435b4f['length'];if(!_0x3610ab[_0xdc03('0x41')][_0xdc03('0x67')](_0xdc03('0x47'))){_0x3a2cca['limit']=qs[_0xdc03('0x48')](_0x3610ab[_0xdc03('0x41')]['limit']);_0x3a2cca['offset']=qs[_0xdc03('0x2c')](_0x3610ab[_0xdc03('0x41')][_0xdc03('0x2c')]);}return _0x5aa30c[_0xdc03('0xb4')](_0x3a2cca);}})['then'](function(_0x3fdd41){if(_0x3fdd41){return _0x3fdd41?{'count':_0x392df2,'rows':_0x3fdd41}:null;}})[_0xdc03('0x1e')](respondWithResult(_0xe21373,null))['catch'](handleError(_0xe21373,null));}; \ No newline at end of file +var _0x5876=['getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','MailApplication','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split','CmList','List','CmContact','updatedAt','DESC','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Messages','VerifySmtp','verifySmtp','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','MailAccounts','sendStatus','stack','name','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','MailServerOut','Pause','body','find','addDisposition','MailAccountId','create','findOne','keys','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap'];(function(_0x4e8c3f,_0x39d62c){var _0x565180=function(_0x1932b8){while(--_0x1932b8){_0x4e8c3f['push'](_0x4e8c3f['shift']());}};_0x565180(++_0x39d62c);}(_0x5876,0x1af));var _0x6587=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0x5876[_0x5baf32];return _0x539cae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6587('0x0'));var rimraf=require(_0x6587('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6587('0x2'));var rp=require(_0x6587('0x3'));var moment=require('moment');var BPromise=require(_0x6587('0x4'));var Mustache=require('mustache');var util=require(_0x6587('0x5'));var path=require('path');var sox=require(_0x6587('0x6'));var csv=require(_0x6587('0x7'));var ejs=require(_0x6587('0x8'));var fs=require('fs');var _=require(_0x6587('0x9'));var squel=require(_0x6587('0xa'));var crypto=require(_0x6587('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6587('0xc'));var toCsv=require(_0x6587('0x7'));var querystring=require(_0x6587('0xd'));var Papa=require(_0x6587('0xe'));var Redis=require(_0x6587('0xf'));var authService=require(_0x6587('0x10'));var qs=require(_0x6587('0x11'));var as=require(_0x6587('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6587('0x13'))('api');var utils=require(_0x6587('0x14'));var config=require(_0x6587('0x15'));var db=require(_0x6587('0x16'))['db'];config[_0x6587('0x17')]=_[_0x6587('0x18')](config[_0x6587('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6587('0x19'))(new Redis(config[_0x6587('0x17')]));require(_0x6587('0x1a'))[_0x6587('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6587('0x1c')][_0x6587('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x2a5849,_0x5e54d0,_0x53097b){if(_0x53097b){var _0x59d415=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59d415['test'](_0x5e54d0)){return _0x2a5849;}else{throw new db[(_0x6587('0x1e'))][(_0x6587('0x1f'))](_0x6587('0x20'));}}else{return _0x2a5849;}}function respondWithRpcPromise(_0x366685,_0x3b337c,_0x5cd7c3,_0x5cc28a){return new BPromise(function(_0x33f8f1,_0x3259c8){var _0x4b80a5=_0x5cc28a||client;return _0x4b80a5[_0x6587('0x21')](_0x366685,_0x5cd7c3)[_0x6587('0x22')](function(_0xd6fcd2){logger[_0x6587('0x23')](_0x6587('0x24'),_0x3b337c,_0x6587('0x25'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x3b337c,_0x6587('0x25'),JSON[_0x6587('0x26')](_0xd6fcd2));if(_0xd6fcd2[_0x6587('0x27')]){if(_0xd6fcd2['error'][_0x6587('0x28')]===0x1f4){logger[_0x6587('0x27')](_0x6587('0x24'),_0x3b337c,_0xd6fcd2[_0x6587('0x27')]['message']);return _0x3259c8(_0xd6fcd2[_0x6587('0x27')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3b337c,_0xd6fcd2['error'][_0x6587('0x29')]);return _0x33f8f1(_0xd6fcd2[_0x6587('0x27')][_0x6587('0x29')]);}else{logger['info'](_0x6587('0x24'),_0x3b337c,_0x6587('0x25'));_0x33f8f1(_0xd6fcd2[_0x6587('0x2a')][_0x6587('0x29')]);}})[_0x6587('0x2b')](function(_0x4c7526){logger['error'](_0x6587('0x24'),_0x3b337c,_0x4c7526);_0x3259c8(_0x4c7526);});});}function respondWithStatusCode(_0x2c4beb,_0x5ec238){_0x5ec238=_0x5ec238||0xcc;return function(_0x63975b){if(_0x63975b){return _0x2c4beb['sendStatus'](_0x5ec238);}return _0x2c4beb['status'](_0x5ec238)[_0x6587('0x2c')]();};}function respondWithResult(_0x28abff,_0x3f56e9){_0x3f56e9=_0x3f56e9||0xc8;return function(_0x40f13b){if(_0x40f13b){return _0x28abff[_0x6587('0x2d')](_0x3f56e9)['json'](_0x40f13b);}};}function respondWithFilteredResult(_0x21085a,_0x11c0af){return function(_0x7a8a69){if(_0x7a8a69){var _0x187bdb=_0x7a8a69[_0x6587('0x2e')],_0x5e2332=_0x11c0af[_0x6587('0x2f')],_0x30bdc4=_0x11c0af['offset']+_0x11c0af[_0x6587('0x30')],_0x297e24;if(_0x30bdc4>=_0x187bdb){_0x30bdc4=_0x187bdb;_0x297e24=0xc8;}else{_0x297e24=0xce;}_0x21085a[_0x6587('0x2d')](_0x297e24);return _0x21085a[_0x6587('0x31')](_0x6587('0x32'),_0x5e2332+'-'+_0x30bdc4+'/'+_0x187bdb)[_0x6587('0x33')](_0x7a8a69);}return null;};}function patchUpdates(_0x562443){return function(_0x120905){try{jsonpatch[_0x6587('0x34')](_0x120905,_0x562443,!![]);}catch(_0xcd1583){return BPromise[_0x6587('0x35')](_0xcd1583);}return _0x120905[_0x6587('0x36')]();};}function saveUpdates(_0x18b933,_0x81d36){return function(_0x129c6d){if(_0x129c6d){return _0x129c6d[_0x6587('0x37')](_0x18b933)['then'](function(_0x3e0d0b){return _0x3e0d0b;});}return null;};}function removeEntity(_0x5940a8,_0x9a4d14){return function(_0x1d9b3e){if(_0x1d9b3e){return _0x1d9b3e[_0x6587('0x38')]()[_0x6587('0x22')](function(){var _0xf6ae4d=_0x1d9b3e[_0x6587('0x39')]({'plain':!![]});var _0x384cb8=_0x6587('0x3a');return db['UserProfileResource'][_0x6587('0x38')]({'where':{'type':_0x384cb8,'resourceId':_0xf6ae4d['id']}})[_0x6587('0x22')](function(){return _0x1d9b3e;});})['then'](function(){_0x5940a8[_0x6587('0x2d')](0xcc)[_0x6587('0x2c')]();});}};}function handleEntityNotFound(_0x258c8a,_0x240f98){return function(_0x644435){if(!_0x644435){_0x258c8a[_0x6587('0x3b')](0x194);}return _0x644435;};}function handleError(_0x5a9a3a,_0x3b22b2){_0x3b22b2=_0x3b22b2||0x1f4;return function(_0x3cac83){logger[_0x6587('0x27')](_0x3cac83[_0x6587('0x3c')]);if(_0x3cac83[_0x6587('0x3d')]){delete _0x3cac83[_0x6587('0x3d')];}_0x5a9a3a[_0x6587('0x2d')](_0x3b22b2)['send'](_0x3cac83);};}exports[_0x6587('0x3e')]=function(_0x1a9e15,_0x137d59){var _0x4093a3={'include':[{'model':db[_0x6587('0x3f')],'as':_0x6587('0x40')},{'model':db['MailServerOut'],'as':_0x6587('0x41')},{'model':db['Pause'],'as':_0x6587('0x42')}]},_0x5d6387={},_0x506363={'count':0x0,'rows':[]};var _0x5e916e=_[_0x6587('0x43')](db[_0x6587('0x44')][_0x6587('0x45')],function(_0x13ba74){return{'name':_0x13ba74['fieldName'],'type':_0x13ba74['type'][_0x6587('0x46')]};});_0x5d6387[_0x6587('0x47')]=_[_0x6587('0x43')](_0x5e916e,'name');_0x5d6387['query']=_['keys'](_0x1a9e15['query']);_0x5d6387[_0x6587('0x48')]=_[_0x6587('0x49')](_0x5d6387['model'],_0x5d6387['query']);_0x4093a3[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x5d6387[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x1a9e15[_0x6587('0x4c')]['fields']));_0x4093a3['attributes']=_0x4093a3[_0x6587('0x4a')][_0x6587('0x4d')]?_0x4093a3[_0x6587('0x4a')]:_0x5d6387[_0x6587('0x47')];if(!_0x1a9e15[_0x6587('0x4c')][_0x6587('0x4e')](_0x6587('0x4f'))){_0x4093a3[_0x6587('0x30')]=qs['limit'](_0x1a9e15['query'][_0x6587('0x30')]);_0x4093a3['offset']=qs[_0x6587('0x2f')](_0x1a9e15[_0x6587('0x4c')][_0x6587('0x2f')]);}_0x4093a3[_0x6587('0x50')]=qs[_0x6587('0x51')](_0x1a9e15[_0x6587('0x4c')][_0x6587('0x51')]);_0x4093a3[_0x6587('0x52')]=qs[_0x6587('0x48')](_[_0x6587('0x53')](_0x1a9e15[_0x6587('0x4c')],_0x5d6387[_0x6587('0x48')]),_0x5e916e);if(_0x1a9e15[_0x6587('0x4c')][_0x6587('0x54')]){_0x4093a3[_0x6587('0x52')]=_[_0x6587('0x55')](_0x4093a3[_0x6587('0x52')],{'$or':_[_0x6587('0x43')](_0x5e916e,function(_0x484973){if(_0x484973[_0x6587('0x56')]!==_0x6587('0x57')){var _0x3b8267={};_0x3b8267[_0x484973[_0x6587('0x3d')]]={'$like':'%'+_0x1a9e15[_0x6587('0x4c')][_0x6587('0x54')]+'%'};return _0x3b8267;}})});}_0x4093a3=_[_0x6587('0x55')]({},_0x4093a3,_0x1a9e15[_0x6587('0x58')]);var _0x201b25={'where':_0x4093a3[_0x6587('0x52')]};return db[_0x6587('0x44')][_0x6587('0x2e')](_0x201b25)[_0x6587('0x22')](function(_0x3a35ef){_0x506363[_0x6587('0x2e')]=_0x3a35ef;if(_0x1a9e15[_0x6587('0x4c')][_0x6587('0x59')]){_0x4093a3[_0x6587('0x5a')]=[{'all':!![]}];}return db[_0x6587('0x44')]['findAll'](_0x4093a3);})[_0x6587('0x22')](function(_0xe2ec7d){_0x506363[_0x6587('0x5b')]=_0xe2ec7d;return _0x506363;})[_0x6587('0x22')](respondWithFilteredResult(_0x137d59,_0x4093a3))[_0x6587('0x2b')](handleError(_0x137d59,null));};exports[_0x6587('0x5c')]=function(_0x2a51d4,_0x2fa716){var _0x50a625={'raw':![],'where':{'id':_0x2a51d4[_0x6587('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x6587('0x5e')],'as':_0x6587('0x41')},{'model':db[_0x6587('0x5f')],'as':_0x6587('0x42')}]},_0x22b59f={};_0x22b59f[_0x6587('0x47')]=_['keys'](db[_0x6587('0x44')][_0x6587('0x45')]);_0x22b59f[_0x6587('0x4c')]=_['keys'](_0x2a51d4['query']);_0x22b59f['filters']=_[_0x6587('0x49')](_0x22b59f[_0x6587('0x47')],_0x22b59f[_0x6587('0x4c')]);_0x50a625[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x22b59f['model'],qs[_0x6587('0x4b')](_0x2a51d4[_0x6587('0x4c')]['fields']));_0x50a625[_0x6587('0x4a')]=_0x50a625[_0x6587('0x4a')][_0x6587('0x4d')]?_0x50a625[_0x6587('0x4a')]:_0x22b59f[_0x6587('0x47')];if(_0x2a51d4['query'][_0x6587('0x59')]){_0x50a625['include']=[{'all':!![]}];}_0x50a625=_['merge']({},_0x50a625,_0x2a51d4['options']);return db[_0x6587('0x44')]['find'](_0x50a625)['then'](handleEntityNotFound(_0x2fa716,null))['then'](respondWithResult(_0x2fa716,null))[_0x6587('0x2b')](handleError(_0x2fa716,null));};exports[_0x6587('0x37')]=function(_0x1e1a59,_0x29b973){if(_0x1e1a59[_0x6587('0x60')]['id']){delete _0x1e1a59['body']['id'];}return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x1e1a59[_0x6587('0x5d')]['id']},'include':[{'model':db[_0x6587('0x3f')],'as':_0x6587('0x40')},{'model':db[_0x6587('0x5e')],'as':_0x6587('0x41')},{'model':db[_0x6587('0x5f')],'as':'mandatoryDispositionPause'}]})[_0x6587('0x22')](handleEntityNotFound(_0x29b973,null))[_0x6587('0x22')](saveUpdates(_0x1e1a59[_0x6587('0x60')],null))['then'](function(_0x5285db){if(_0x5285db&&_0x1e1a59[_0x6587('0x60')][_0x6587('0x40')]){return db[_0x6587('0x3f')][_0x6587('0x37')](_0x1e1a59[_0x6587('0x60')]['Imap'],{'where':{'MailAccountId':_0x5285db['id']}})[_0x6587('0x22')](function(){return _0x5285db;});}return _0x5285db;})[_0x6587('0x22')](function(_0xa55221){if(_0xa55221&&_0x1e1a59['body'][_0x6587('0x41')]){return db[_0x6587('0x5e')][_0x6587('0x37')](_0x1e1a59['body'][_0x6587('0x41')],{'where':{'MailAccountId':_0xa55221['id']}})[_0x6587('0x22')](function(){return _0xa55221;});}return _0xa55221;})[_0x6587('0x22')](respondWithResult(_0x29b973,null))['catch'](handleError(_0x29b973,null));};exports['describe']=function(_0x1baf9e,_0x7c429b){return db[_0x6587('0x44')]['describe']()[_0x6587('0x22')](respondWithResult(_0x7c429b,null))['catch'](handleError(_0x7c429b,null));};exports[_0x6587('0x62')]=function(_0xbf3919,_0x1980fb,_0x58cbcd){if(_0xbf3919[_0x6587('0x60')]['id']){delete _0xbf3919[_0x6587('0x60')]['id'];}return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0xbf3919[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x1980fb,null))[_0x6587('0x22')](function(_0x4a004c){if(_0x4a004c){_0xbf3919[_0x6587('0x60')][_0x6587('0x63')]=_0x4a004c['id'];return db['Disposition'][_0x6587('0x64')](_0xbf3919[_0x6587('0x60')]);}})[_0x6587('0x22')](respondWithResult(_0x1980fb,null))[_0x6587('0x2b')](handleError(_0x1980fb,null));};exports['getDispositions']=function(_0x3dc28e,_0x3403f2,_0x342b21){var _0xe35b4f={'raw':![],'where':{}};var _0x4036c1={};var _0x436578={'count':0x0,'rows':[]};return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x3dc28e['params']['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x3403f2,null))[_0x6587('0x22')](function(_0x99521c){if(_0x99521c){_0x4036c1[_0x6587('0x47')]=_[_0x6587('0x66')](db[_0x6587('0x67')][_0x6587('0x45')]);_0x4036c1[_0x6587('0x4c')]=_[_0x6587('0x66')](_0x3dc28e[_0x6587('0x4c')]);_0x4036c1[_0x6587('0x48')]=_[_0x6587('0x49')](_0x4036c1[_0x6587('0x47')],_0x4036c1[_0x6587('0x4c')]);_0xe35b4f[_0x6587('0x4a')]=_['intersection'](_0x4036c1[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x3dc28e[_0x6587('0x4c')][_0x6587('0x4b')]));_0xe35b4f['attributes']=_0xe35b4f[_0x6587('0x4a')]['length']?_0xe35b4f[_0x6587('0x4a')]:_0x4036c1[_0x6587('0x47')];if(!_0x3dc28e['query'][_0x6587('0x4e')](_0x6587('0x4f'))){_0xe35b4f[_0x6587('0x30')]=qs['limit'](_0x3dc28e['query'][_0x6587('0x30')]);_0xe35b4f[_0x6587('0x2f')]=qs[_0x6587('0x2f')](_0x3dc28e[_0x6587('0x4c')]['offset']);}_0xe35b4f[_0x6587('0x50')]=qs[_0x6587('0x51')](_0x3dc28e['query'][_0x6587('0x51')]);_0xe35b4f[_0x6587('0x52')]=qs[_0x6587('0x48')](_['pick'](_0x3dc28e[_0x6587('0x4c')],_0x4036c1[_0x6587('0x48')]));_0xe35b4f[_0x6587('0x52')][_0x6587('0x63')]=_0x99521c['id'];if(_0x3dc28e[_0x6587('0x4c')]['filter']){_0xe35b4f['where']=_[_0x6587('0x55')](_0xe35b4f[_0x6587('0x52')],{'$or':_['map'](_0xe35b4f[_0x6587('0x4a')],function(_0x25d8d0){var _0x4bb7b5={};_0x4bb7b5[_0x25d8d0]={'$like':'%'+_0x3dc28e[_0x6587('0x4c')][_0x6587('0x54')]+'%'};return _0x4bb7b5;})});}_0xe35b4f=_[_0x6587('0x55')]({},_0xe35b4f,_0x3dc28e[_0x6587('0x58')]);return db['Disposition'][_0x6587('0x2e')]({'where':_0xe35b4f[_0x6587('0x52')]})[_0x6587('0x22')](function(_0x52cfe5){_0x436578[_0x6587('0x2e')]=_0x52cfe5;if(_0x3dc28e[_0x6587('0x4c')][_0x6587('0x59')]){_0xe35b4f[_0x6587('0x5a')]=[{'all':!![]}];}return db[_0x6587('0x67')][_0x6587('0x68')](_0xe35b4f);})['then'](function(_0x85d6e8){_0x436578[_0x6587('0x5b')]=_0x85d6e8;return _0x436578;});}})['then'](respondWithFilteredResult(_0x3403f2,_0xe35b4f))[_0x6587('0x2b')](handleError(_0x3403f2,null));};exports[_0x6587('0x69')]=function(_0x6a539b,_0x4253c7,_0x15eeab){return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x6a539b[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x4253c7,null))[_0x6587('0x22')](function(_0x20c81a){if(_0x20c81a){return _0x20c81a[_0x6587('0x69')](_0x6a539b[_0x6587('0x4c')][_0x6587('0x6a')]);}})['then'](respondWithStatusCode(_0x4253c7,null))[_0x6587('0x2b')](handleError(_0x4253c7,null));};exports[_0x6587('0x6b')]=function(_0x1e5e7a,_0xde6239,_0x51d8b5){if(_0x1e5e7a[_0x6587('0x60')]['id']){delete _0x1e5e7a['body']['id'];}return db['MailAccount'][_0x6587('0x61')]({'where':{'id':_0x1e5e7a[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0xde6239,null))[_0x6587('0x22')](function(_0x1d3dea){if(_0x1d3dea){_0x1e5e7a[_0x6587('0x60')][_0x6587('0x63')]=_0x1d3dea['id'];return db[_0x6587('0x6c')][_0x6587('0x64')](_0x1e5e7a[_0x6587('0x60')]);}})[_0x6587('0x22')](respondWithResult(_0xde6239,null))[_0x6587('0x2b')](handleError(_0xde6239,null));};exports[_0x6587('0x6d')]=function(_0x171aa6,_0x59ae06,_0x38d6b4){var _0x2ae8dc={'raw':![],'where':{}};var _0x42cc08={};var _0x48d9a9={'count':0x0,'rows':[]};return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x171aa6['params']['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x59ae06,null))[_0x6587('0x22')](function(_0x5c416b){if(_0x5c416b){_0x42cc08['model']=_['keys'](db[_0x6587('0x6c')][_0x6587('0x45')]);_0x42cc08[_0x6587('0x4c')]=_[_0x6587('0x66')](_0x171aa6['query']);_0x42cc08['filters']=_['intersection'](_0x42cc08[_0x6587('0x47')],_0x42cc08[_0x6587('0x4c')]);_0x2ae8dc[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x42cc08[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x171aa6[_0x6587('0x4c')]['fields']));_0x2ae8dc[_0x6587('0x4a')]=_0x2ae8dc[_0x6587('0x4a')][_0x6587('0x4d')]?_0x2ae8dc[_0x6587('0x4a')]:_0x42cc08['model'];if(!_0x171aa6['query'][_0x6587('0x4e')](_0x6587('0x4f'))){_0x2ae8dc['limit']=qs[_0x6587('0x30')](_0x171aa6['query']['limit']);_0x2ae8dc[_0x6587('0x2f')]=qs[_0x6587('0x2f')](_0x171aa6[_0x6587('0x4c')]['offset']);}_0x2ae8dc['order']=qs[_0x6587('0x51')](_0x171aa6[_0x6587('0x4c')]['sort']);_0x2ae8dc[_0x6587('0x52')]=qs[_0x6587('0x48')](_[_0x6587('0x53')](_0x171aa6['query'],_0x42cc08[_0x6587('0x48')]));_0x2ae8dc[_0x6587('0x52')][_0x6587('0x63')]=_0x5c416b['id'];if(_0x171aa6['query']['filter']){_0x2ae8dc['where']=_['merge'](_0x2ae8dc['where'],{'$or':_['map'](_0x2ae8dc[_0x6587('0x4a')],function(_0x1114fb){var _0x335611={};_0x335611[_0x1114fb]={'$like':'%'+_0x171aa6['query'][_0x6587('0x54')]+'%'};return _0x335611;})});}_0x2ae8dc=_['merge']({},_0x2ae8dc,_0x171aa6[_0x6587('0x58')]);return db['CannedAnswer'][_0x6587('0x2e')]({'where':_0x2ae8dc[_0x6587('0x52')]})[_0x6587('0x22')](function(_0x1b3434){_0x48d9a9['count']=_0x1b3434;if(_0x171aa6[_0x6587('0x4c')][_0x6587('0x59')]){_0x2ae8dc[_0x6587('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6587('0x68')](_0x2ae8dc);})[_0x6587('0x22')](function(_0x26bc1b){_0x48d9a9[_0x6587('0x5b')]=_0x26bc1b;return _0x48d9a9;});}})[_0x6587('0x22')](respondWithFilteredResult(_0x59ae06,_0x2ae8dc))[_0x6587('0x2b')](handleError(_0x59ae06,null));};exports[_0x6587('0x6e')]=function(_0x347cb9,_0x42f44c,_0x26bb46){return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x347cb9[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x42f44c,null))[_0x6587('0x22')](function(_0x465af5){if(_0x465af5){return _0x465af5[_0x6587('0x6e')](_0x347cb9[_0x6587('0x4c')][_0x6587('0x6a')]);}})['then'](respondWithStatusCode(_0x42f44c,null))[_0x6587('0x2b')](handleError(_0x42f44c,null));};exports[_0x6587('0x64')]=function(_0x3bcf8e,_0x5cc6e9){var _0x491c31={'name':_0x3bcf8e[_0x6587('0x60')][_0x6587('0x3d')],'key':_0x3bcf8e[_0x6587('0x60')][_0x6587('0x46')],'email':_0x3bcf8e[_0x6587('0x60')][_0x6587('0x6f')],'ListId':_0x3bcf8e[_0x6587('0x60')][_0x6587('0x70')],'active':!_[_0x6587('0x71')](_0x3bcf8e[_0x6587('0x60')]['active'])?_0x3bcf8e['body']['active']:!![],'description':_0x3bcf8e[_0x6587('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x6587('0x71')](_0x3bcf8e[_0x6587('0x60')][_0x6587('0x72')])){if(_0x3bcf8e[_0x6587('0x60')][_0x6587('0x73')]){_0x491c31[_0x6587('0x40')][_0x6587('0x74')]=_0x491c31[_0x6587('0x41')]['user']=_0x3bcf8e[_0x6587('0x60')]['cuser'];_0x491c31['Imap'][_0x6587('0x75')]=_0x491c31[_0x6587('0x41')][_0x6587('0x76')]=_0x3bcf8e[_0x6587('0x60')][_0x6587('0x77')];}else{_0x491c31['Imap']['authentication']=_0x491c31['Smtp'][_0x6587('0x78')]=![];}_0x491c31[_0x6587('0x40')][_0x6587('0x79')]=_0x3bcf8e[_0x6587('0x60')]['Imap'][_0x6587('0x79')];_0x491c31['Imap']['port']=_0x3bcf8e[_0x6587('0x60')][_0x6587('0x40')][_0x6587('0x7a')];_0x491c31[_0x6587('0x41')][_0x6587('0x79')]=_0x3bcf8e[_0x6587('0x60')][_0x6587('0x41')][_0x6587('0x79')];_0x491c31[_0x6587('0x41')][_0x6587('0x7a')]=_0x3bcf8e['body'][_0x6587('0x41')][_0x6587('0x7a')];}else{_0x491c31[_0x6587('0x40')][_0x6587('0x7b')]=_0x491c31[_0x6587('0x41')]['service']=_0x3bcf8e[_0x6587('0x60')][_0x6587('0x72')];_0x491c31[_0x6587('0x40')][_0x6587('0x74')]=_0x491c31['Smtp']['user']=_0x3bcf8e['body'][_0x6587('0x7c')];_0x491c31['Imap'][_0x6587('0x75')]=_0x491c31[_0x6587('0x41')][_0x6587('0x76')]=_0x3bcf8e['body'][_0x6587('0x77')];}return db[_0x6587('0x44')]['create'](_0x491c31,{'include':[{'model':db[_0x6587('0x5e')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x6587('0x40')}]})['then'](function(_0x4e42db){var _0x4fecd1=_0x3bcf8e[_0x6587('0x74')][_0x6587('0x39')]({'plain':!![]});if(!_0x4fecd1)throw new Error(_0x6587('0x7d'));if(_0x4fecd1['role']===_0x6587('0x74')){var _0x1ca03e=_0x4e42db[_0x6587('0x39')]({'plain':!![]});return db[_0x6587('0x7e')]['find']({'where':{'name':_0x6587('0x3a'),'userProfileId':_0x4fecd1[_0x6587('0x7f')]},'raw':!![]})['then'](function(_0x3920ef){if(_0x3920ef&&_0x3920ef[_0x6587('0x80')]===0x0){return db['UserProfileResource'][_0x6587('0x64')]({'name':_0x1ca03e[_0x6587('0x3d')],'resourceId':_0x1ca03e['id'],'type':_0x3920ef['name'],'sectionId':_0x3920ef['id']},{})['then'](function(){return _0x4e42db;});}else{return _0x4e42db;}})[_0x6587('0x2b')](function(_0x4e1da6){logger['error'](_0x6587('0x81'),_0x4e1da6);throw _0x4e1da6;});}return _0x4e42db;})[_0x6587('0x22')](respondWithResult(_0x5cc6e9,0xc9))[_0x6587('0x2b')](handleError(_0x5cc6e9,null));};exports[_0x6587('0x82')]=function(_0xed805e,_0x5a9908,_0x4a81fa){return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0xed805e['params']['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x5a9908,null))[_0x6587('0x22')](function(_0x509c59){if(_0x509c59){return _0x509c59['getImap']();}return null;})[_0x6587('0x22')](respondWithResult(_0x5a9908,null))['catch'](handleError(_0x5a9908,null));};exports[_0x6587('0x83')]=function(_0x5697f0,_0x4cf17c,_0x2b46ce){if(_0x5697f0['body']['id']){delete _0x5697f0[_0x6587('0x60')]['id'];}return db[_0x6587('0x44')]['find']({'where':{'id':_0x5697f0[_0x6587('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4cf17c,null))['then'](function(_0x2d9f09){if(_0x2d9f09){_0x5697f0[_0x6587('0x60')][_0x6587('0x63')]=_0x2d9f09['id'];return db[_0x6587('0x3f')]['create'](_0x5697f0[_0x6587('0x60')]);}})[_0x6587('0x22')](respondWithResult(_0x4cf17c,null))[_0x6587('0x2b')](handleError(_0x4cf17c,null));};exports[_0x6587('0x84')]=function(_0x5a614e,_0x39e7ba,_0x238b6c){return db[_0x6587('0x44')]['findOne']({'where':{'id':_0x5a614e['params']['id']}})['then'](handleEntityNotFound(_0x39e7ba,null))[_0x6587('0x22')](function(_0x1c52d3){if(_0x1c52d3){return _0x1c52d3['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x39e7ba,null))['catch'](handleError(_0x39e7ba,null));};exports[_0x6587('0x85')]=function(_0x8e2f55,_0x8cf35b,_0x4058af){return db[_0x6587('0x44')]['findOne']({'where':{'id':_0x8e2f55[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x8cf35b,null))['then'](function(_0x3579a0){if(_0x3579a0){return _0x3579a0[_0x6587('0x85')]();}return null;})[_0x6587('0x22')](respondWithResult(_0x8cf35b,null))[_0x6587('0x2b')](handleError(_0x8cf35b,null));};exports[_0x6587('0x86')]=function(_0x4dff62,_0x254584,_0xbcbcce){if(_0x4dff62[_0x6587('0x60')]['id']){delete _0x4dff62[_0x6587('0x60')]['id'];}return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x4dff62[_0x6587('0x5d')]['id']}})['then'](handleEntityNotFound(_0x254584,null))[_0x6587('0x22')](function(_0xeeb8b6){if(_0xeeb8b6){_0x4dff62[_0x6587('0x60')]['MailAccountId']=_0xeeb8b6['id'];return db[_0x6587('0x5e')][_0x6587('0x64')](_0x4dff62[_0x6587('0x60')]);}})['then'](respondWithResult(_0x254584,null))[_0x6587('0x2b')](handleError(_0x254584,null));};exports[_0x6587('0x87')]=function(_0x3f391e,_0x1d1673,_0x436c3a){return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x3f391e[_0x6587('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1d1673,null))['then'](function(_0x34d91b){if(_0x34d91b){return _0x34d91b[_0x6587('0x88')](null);}return null;})[_0x6587('0x22')](respondWithStatusCode(_0x1d1673,null))[_0x6587('0x2b')](handleError(_0x1d1673,null));};exports[_0x6587('0x89')]=function(_0x521247,_0x3c539c,_0xbc9945){return db[_0x6587('0x8a')][_0x6587('0x61')]({'where':{'id':_0x521247[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x3c539c,null))[_0x6587('0x22')](function(_0x33284a){if(_0x33284a){return _0x33284a[_0x6587('0x89')](_0x521247[_0x6587('0x60')][_0x6587('0x6a')],_[_0x6587('0x8b')](_0x521247[_0x6587('0x60')],[_0x6587('0x6a'),'id'])||{});}})[_0x6587('0x22')](respondWithResult(_0x3c539c,null))['catch'](handleError(_0x3c539c,null));};exports['getInteractions']=function(_0x54ad34,_0x5985ae,_0xb05419){var _0x111f77={'raw':![],'where':{}};var _0x44c896={};var _0x4839c7={'count':0x0,'rows':[]};return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x54ad34[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x5985ae,null))[_0x6587('0x22')](function(_0x85cff0){if(_0x85cff0){_0x44c896[_0x6587('0x47')]=_['keys'](db[_0x6587('0x8a')][_0x6587('0x45')]);_0x44c896[_0x6587('0x4c')]=_['keys'](_0x54ad34['query']);_0x44c896[_0x6587('0x48')]=_[_0x6587('0x49')](_0x44c896[_0x6587('0x47')],_0x44c896[_0x6587('0x4c')]);_0x111f77[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x44c896[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x54ad34[_0x6587('0x4c')]['fields']));_0x111f77['attributes']=_0x111f77[_0x6587('0x4a')][_0x6587('0x4d')]?_0x111f77['attributes']:_0x44c896[_0x6587('0x47')];if(!_0x54ad34[_0x6587('0x4c')][_0x6587('0x4e')](_0x6587('0x4f'))){_0x111f77['limit']=qs['limit'](_0x54ad34[_0x6587('0x4c')][_0x6587('0x30')]);_0x111f77['offset']=qs[_0x6587('0x2f')](_0x54ad34['query'][_0x6587('0x2f')]);}_0x111f77['order']=qs[_0x6587('0x51')](_0x54ad34[_0x6587('0x4c')][_0x6587('0x51')]);_0x111f77[_0x6587('0x52')]=qs['filters'](_[_0x6587('0x53')](_0x54ad34[_0x6587('0x4c')],_0x44c896['filters']));_0x111f77['where'][_0x6587('0x63')]=_0x85cff0['id'];if(_0x54ad34['query']['filter']){_0x111f77[_0x6587('0x52')]=_['merge'](_0x111f77[_0x6587('0x52')],{'$or':_[_0x6587('0x43')](_0x111f77[_0x6587('0x4a')],function(_0x2ed200){var _0x55cfb0={};_0x55cfb0[_0x2ed200]={'$like':'%'+_0x54ad34[_0x6587('0x4c')][_0x6587('0x54')]+'%'};return _0x55cfb0;})});}_0x111f77=_[_0x6587('0x55')]({},_0x111f77,_0x54ad34[_0x6587('0x58')]);return db[_0x6587('0x8a')][_0x6587('0x2e')]({'where':_0x111f77[_0x6587('0x52')]})[_0x6587('0x22')](function(_0x35b871){_0x4839c7['count']=_0x35b871;if(_0x54ad34[_0x6587('0x4c')][_0x6587('0x59')]){_0x111f77['include']=[{'model':db['CmContact'],'as':_0x6587('0x8c'),'required':![]},{'model':db[_0x6587('0x8d')],'as':_0x6587('0x8e'),'attributes':['name',_0x6587('0x8f'),_0x6587('0x90')],'required':![]},{'model':db[_0x6587('0x91')],'as':'Tags','attributes':['id','name','color'],'where':_0x54ad34['query'][_0x6587('0x92')]?{'id':_0x54ad34[_0x6587('0x4c')][_0x6587('0x92')]}:undefined,'required':_0x54ad34[_0x6587('0x4c')][_0x6587('0x92')]?!![]:![]}];}return db['MailInteraction'][_0x6587('0x68')](_0x111f77);})['then'](function(_0x3ae191){_0x4839c7[_0x6587('0x5b')]=_0x3ae191;return _0x4839c7;});}})[_0x6587('0x22')](respondWithFilteredResult(_0x5985ae,_0x111f77))[_0x6587('0x2b')](handleError(_0x5985ae,null));};exports[_0x6587('0x93')]=function(_0x52f597,_0x581453,_0x271a34){return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x52f597['params']['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x581453,null))[_0x6587('0x22')](function(_0x32ffd0){if(_0x32ffd0){return db['sequelize'][_0x6587('0x94')](function(_0x5e1956){return db['MailApplication'][_0x6587('0x38')]({'where':{'MailAccountId':_0x52f597[_0x6587('0x5d')]['id']},'transaction':_0x5e1956})[_0x6587('0x22')](function(_0x47ebc5){var _0xd09ca4=_[_0x6587('0x43')](_0x52f597['body'],function(_0x2505db){_0x2505db[_0x6587('0x63')]=_0x52f597[_0x6587('0x5d')]['id'];return _0x2505db;});return db['MailApplication'][_0x6587('0x95')](_0xd09ca4,{'transaction':_0x5e1956});});})[_0x6587('0x22')](function(){return db['MailApplication'][_0x6587('0x96')]({'where':{'MailAccountId':_0x52f597[_0x6587('0x5d')]['id']},'order':'priority'});});}})[_0x6587('0x22')](respondWithResult(_0x581453,null))['catch'](handleError(_0x581453,null));};exports[_0x6587('0x97')]=function(_0x346a4d,_0x1a1173,_0x5620c8){var _0x3e5dba={};var _0x123cf7={};var _0x28e55f;var _0x38685f;return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x346a4d[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x1a1173,null))[_0x6587('0x22')](function(_0xb83e71){if(_0xb83e71){_0x28e55f=_0xb83e71;_0x123cf7[_0x6587('0x47')]=_[_0x6587('0x66')](db[_0x6587('0x98')][_0x6587('0x45')]);_0x123cf7['query']=_[_0x6587('0x66')](_0x346a4d[_0x6587('0x4c')]);_0x123cf7[_0x6587('0x48')]=_[_0x6587('0x49')](_0x123cf7['model'],_0x123cf7[_0x6587('0x4c')]);_0x3e5dba[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x123cf7[_0x6587('0x47')],qs['fields'](_0x346a4d[_0x6587('0x4c')][_0x6587('0x4b')]));_0x3e5dba[_0x6587('0x4a')]=_0x3e5dba[_0x6587('0x4a')]['length']?_0x3e5dba[_0x6587('0x4a')]:_0x123cf7[_0x6587('0x47')];_0x3e5dba[_0x6587('0x50')]=qs['sort'](_0x346a4d['query'][_0x6587('0x51')]);_0x3e5dba[_0x6587('0x52')]=qs['filters'](_[_0x6587('0x53')](_0x346a4d[_0x6587('0x4c')],_0x123cf7['filters']));if(_0x346a4d[_0x6587('0x4c')][_0x6587('0x54')]){_0x3e5dba[_0x6587('0x52')]=_[_0x6587('0x55')](_0x3e5dba[_0x6587('0x52')],{'$or':_['map'](_0x3e5dba[_0x6587('0x4a')],function(_0xc6e1f6){var _0x389759={};_0x389759[_0xc6e1f6]={'$like':'%'+_0x346a4d[_0x6587('0x4c')]['filter']+'%'};return _0x389759;})});}_0x3e5dba=_[_0x6587('0x55')]({},_0x3e5dba,_0x346a4d['options']);return _0x28e55f[_0x6587('0x97')](_0x3e5dba);}})['then'](function(_0x1e5a6f){if(_0x1e5a6f){_0x38685f=_0x1e5a6f['length'];if(!_0x346a4d[_0x6587('0x4c')][_0x6587('0x4e')](_0x6587('0x4f'))){_0x3e5dba[_0x6587('0x30')]=qs[_0x6587('0x30')](_0x346a4d[_0x6587('0x4c')][_0x6587('0x30')]);_0x3e5dba[_0x6587('0x2f')]=qs[_0x6587('0x2f')](_0x346a4d[_0x6587('0x4c')][_0x6587('0x2f')]);}return _0x28e55f['getApplications'](_0x3e5dba);}})['then'](function(_0x55e8e9){if(_0x55e8e9){return _0x55e8e9?{'count':_0x38685f,'rows':_0x55e8e9}:null;}})[_0x6587('0x22')](respondWithResult(_0x1a1173,null))[_0x6587('0x2b')](handleError(_0x1a1173,null));};exports['getMessages']=function(_0x19f6d8,_0xc6b3ba,_0x347755){var _0x450da0={'raw':!![],'where':{}};var _0x1e0a8f={};var _0x38d1de={'count':0x0,'rows':[]};return db[_0x6587('0x44')]['findOne']({'where':{'id':_0x19f6d8[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0xc6b3ba,null))['then'](function(_0x5f4543){if(_0x5f4543){_0x1e0a8f['model']=_[_0x6587('0x66')](db['MailMessage']['rawAttributes']);_0x1e0a8f[_0x6587('0x4c')]=_['keys'](_0x19f6d8[_0x6587('0x4c')]);_0x1e0a8f['filters']=_[_0x6587('0x49')](_0x1e0a8f[_0x6587('0x47')],_0x1e0a8f[_0x6587('0x4c')]);_0x450da0['attributes']=_[_0x6587('0x49')](_0x1e0a8f[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x19f6d8[_0x6587('0x4c')]['fields']));_0x450da0[_0x6587('0x4a')]=_0x450da0[_0x6587('0x4a')][_0x6587('0x4d')]?_0x450da0[_0x6587('0x4a')]:_0x1e0a8f['model'];if(!_0x19f6d8['query'][_0x6587('0x4e')](_0x6587('0x4f'))){_0x450da0[_0x6587('0x30')]=qs[_0x6587('0x30')](_0x19f6d8[_0x6587('0x4c')]['limit']);_0x450da0[_0x6587('0x2f')]=qs[_0x6587('0x2f')](_0x19f6d8[_0x6587('0x4c')][_0x6587('0x2f')]);}_0x450da0[_0x6587('0x50')]=qs['sort'](_0x19f6d8[_0x6587('0x4c')]['sort']);_0x450da0[_0x6587('0x52')]=qs[_0x6587('0x48')](_[_0x6587('0x53')](_0x19f6d8[_0x6587('0x4c')],_0x1e0a8f['filters']));_0x450da0['where'][_0x6587('0x63')]=_0x5f4543['id'];if(_0x19f6d8[_0x6587('0x4c')][_0x6587('0x54')]){_0x450da0['where']=_['merge'](_0x450da0[_0x6587('0x52')],{'$or':_[_0x6587('0x43')](_0x450da0[_0x6587('0x4a')],function(_0xaf31fe){var _0x1afc44={};_0x1afc44[_0xaf31fe]={'$like':'%'+_0x19f6d8['query'][_0x6587('0x54')]+'%'};return _0x1afc44;})});}if(_0x19f6d8[_0x6587('0x4c')][_0x6587('0x99')]){var _0x1a04b7=_0x19f6d8[_0x6587('0x4c')][_0x6587('0x99')]['split'](',');var _0x4914b5={};_0x4914b5[_0x1a04b7[0x0]]={'$gte':moment(_0x1a04b7[0x1])[_0x6587('0x9a')](_0x6587('0x9b'))};_0x450da0[_0x6587('0x52')]=_[_0x6587('0x55')](_0x450da0[_0x6587('0x52')],_0x4914b5);}_0x450da0=_[_0x6587('0x55')]({},_0x450da0,_0x19f6d8['options']);return db[_0x6587('0x9c')]['count']({'where':_0x450da0[_0x6587('0x52')]})[_0x6587('0x22')](function(_0xd97cb9){_0x38d1de[_0x6587('0x2e')]=_0xd97cb9;if(_0x19f6d8[_0x6587('0x4c')][_0x6587('0x59')]){_0x450da0[_0x6587('0x5a')]=[{'all':!![]}];}return db['MailMessage'][_0x6587('0x68')](_0x450da0);})[_0x6587('0x22')](function(_0x3c3fa3){_0x38d1de[_0x6587('0x5b')]=_0x3c3fa3;return _0x38d1de;});}})[_0x6587('0x22')](respondWithFilteredResult(_0xc6b3ba,_0x450da0))['catch'](handleError(_0xc6b3ba,null));};exports['send']=function(_0x17fcbf,_0x37b364,_0xbab695){var _0x58ed2c,_0x2efa11={},_0x56691e;if(_0x17fcbf[_0x6587('0x60')]['to']){_0x56691e=_0x17fcbf[_0x6587('0x60')]['to'][_0x6587('0x9d')](',')[0x0];}return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x17fcbf[_0x6587('0x5d')]['id']},'include':[{'model':db[_0x6587('0x9e')],'as':_0x6587('0x9f'),'include':[{'model':db[_0x6587('0xa0')],'as':'Contacts','where':{'email':_0x56691e},'limit':0x1,'order':[[_0x6587('0xa1'),_0x6587('0xa2')]]}]},{'model':db[_0x6587('0x5e')],'as':'Smtp','raw':!![]}]})[_0x6587('0x22')](handleEntityNotFound(_0x37b364,null))[_0x6587('0x22')](function(_0x2a6dd9){if(_0x2a6dd9){_0x58ed2c=_0x2a6dd9;if(_0x2a6dd9[_0x6587('0x41')]){if(_[_0x6587('0x71')](_0x17fcbf[_0x6587('0x60')][_0x6587('0xa3')])){_0x17fcbf[_0x6587('0x60')][_0x6587('0xa3')]=util[_0x6587('0x9a')]('%s\x20<%s>',_0x2a6dd9[_0x6587('0x3d')],_0x2a6dd9[_0x6587('0x6f')]||_0x2a6dd9[_0x6587('0x41')][_0x6587('0x74')]);}if(_0x17fcbf[_0x6587('0x60')][_0x6587('0xa4')]&&_0x17fcbf[_0x6587('0x60')][_0x6587('0xa4')][_0x6587('0x4d')]){for(var _0x5c7741=0x0;_0x5c7741<_0x17fcbf[_0x6587('0x60')]['attachments'][_0x6587('0x4d')];_0x5c7741+=0x1){_0x17fcbf[_0x6587('0x60')]['attachments'][_0x5c7741]={'filename':_0x17fcbf[_0x6587('0x60')]['attachments'][_0x5c7741]['name'],'path':path[_0x6587('0xa5')](config['root'],_0x6587('0xa6'),_0x17fcbf['body'][_0x6587('0xa4')][_0x5c7741][_0x6587('0xa7')])};}}var _0x1cf105={'tls':{'rejectUnauthorized':![]}};if(_[_0x6587('0x71')](_0x2a6dd9[_0x6587('0x41')][_0x6587('0x7b')])){if(_0x2a6dd9[_0x6587('0x41')][_0x6587('0x78')]){_0x1cf105[_0x6587('0xa8')]={'user':_0x2a6dd9[_0x6587('0x41')][_0x6587('0x74')],'pass':_0x2a6dd9[_0x6587('0x41')][_0x6587('0x76')]};}_0x1cf105[_0x6587('0x79')]=_0x2a6dd9['Smtp'][_0x6587('0x79')];_0x1cf105[_0x6587('0x7a')]=_0x2a6dd9[_0x6587('0x41')][_0x6587('0x7a')];_0x1cf105['secure']=_0x2a6dd9['Smtp'][_0x6587('0xa9')];}else{_0x1cf105[_0x6587('0x7b')]=_0x2a6dd9[_0x6587('0x41')][_0x6587('0x7b')];_0x1cf105[_0x6587('0xa8')]={'user':_0x2a6dd9[_0x6587('0x41')]['user'],'pass':_0x2a6dd9[_0x6587('0x41')][_0x6587('0x76')]};}return respondWithRpcPromise(_0x6587('0xaa'),_0x6587('0xab'),{'account':_0x1cf105,'message':_0x17fcbf[_0x6587('0x60')]});}else{throw new Error(_0x6587('0xac'));}}})[_0x6587('0x22')](function(_0x25098d){if(_0x25098d){_0x2efa11=_0x25098d;if(_0x58ed2c[_0x6587('0x9f')]){if(_0x58ed2c[_0x6587('0x9f')][_0x6587('0xad')][_0x6587('0x4d')]){return _0x58ed2c['List'][_0x6587('0xad')][0x0];}else{return db[_0x6587('0xa0')][_0x6587('0x64')](_[_0x6587('0x18')](_0x17fcbf[_0x6587('0x60')],{'firstName':_0x17fcbf[_0x6587('0x60')]['to'],'email':_0x17fcbf[_0x6587('0x60')]['to'],'phone':_0x17fcbf[_0x6587('0x60')]['to'],'ListId':_0x58ed2c[_0x6587('0x70')]}));}}else{throw new Error(_0x6587('0xac'));}}})[_0x6587('0x22')](function(_0x2ba037){if(_0x2ba037){var _0x44f283={'UserId':_0x17fcbf[_0x6587('0x74')]['id'],'ContactId':_0x2ba037['id'],'MailAccountId':_0x58ed2c['id'],'inReplyTo':_0x2efa11[_0x6587('0xae')],'to':_0x17fcbf[_0x6587('0x60')]['from'],'cc':_0x17fcbf['body']['cc'],'subject':_0x17fcbf[_0x6587('0x60')][_0x6587('0xaf')],'attach':_0x17fcbf['body'][_0x6587('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x6587('0x9b')),'lastMsgDirection':_0x6587('0xb1'),'lastMsgBody':_0x17fcbf[_0x6587('0x60')]['body'],'Messages':[_['merge'](_0x17fcbf[_0x6587('0x60')],{'messageId':_0x2efa11[_0x6587('0xae')],'sentAt':moment()[_0x6587('0x9a')](_0x6587('0x9b')),'read':!![],'MailAccountId':_0x58ed2c['id'],'UserId':_0x17fcbf['user']['id'],'ContactId':_0x2ba037['id']})]};if(_0x17fcbf['body']['Interaction']){_0x44f283=_[_0x6587('0x55')](_0x44f283,_0x17fcbf[_0x6587('0x60')]['Interaction']);}return db['MailInteraction'][_0x6587('0x64')](_0x44f283,{'include':[{'model':db[_0x6587('0x9c')],'as':_0x6587('0xb2')}]});}})['then'](respondWithResult(_0x37b364,null))['catch'](handleError(_0x37b364,null));};exports['verifySmtp']=function(_0x4923ca,_0x536b82,_0x426fb9){return db['MailAccount'][_0x6587('0x61')]({'where':{'id':_0x4923ca['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x6587('0x22')](handleEntityNotFound(_0x536b82,null))[_0x6587('0x22')](function(_0x14596f){if(_0x14596f&&_0x14596f[_0x6587('0x41')]){var _0x520ca2={'id':_0x14596f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x14596f[_0x6587('0x41')][_0x6587('0x7b')]){_0x520ca2['service']=_0x14596f[_0x6587('0x41')][_0x6587('0x7b')];}else{_0x520ca2['host']=_0x14596f[_0x6587('0x41')][_0x6587('0x79')];_0x520ca2[_0x6587('0x7a')]=_0x14596f['Smtp'][_0x6587('0x7a')];_0x520ca2['secure']=_0x14596f['Smtp'][_0x6587('0xa9')];}if(_0x14596f[_0x6587('0x41')][_0x6587('0x78')]){_0x520ca2[_0x6587('0xa8')]={'user':_0x14596f[_0x6587('0x41')]['user'],'pass':_0x14596f[_0x6587('0x41')][_0x6587('0x76')]};}return respondWithRpcPromise(_0x6587('0xb3'),_0x6587('0xb4'),{'account':_0x520ca2});}})[_0x6587('0x22')](respondWithResult(_0x536b82,null))['catch'](handleError(_0x536b82,null));};exports[_0x6587('0x38')]=function(_0x2a0249,_0x271d85){return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x2a0249[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x271d85,null))['then'](function(_0x396d38){if(_0x396d38&&_0x396d38[_0x6587('0x7b')]){throw new db['Sequelize'][(_0x6587('0x1f'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x396d38;})['then'](removeEntity(_0x271d85,null))[_0x6587('0x2b')](handleError(_0x271d85,null));};exports[_0x6587('0xb5')]=function(_0x4e8ce6,_0xb84673,_0x2860ef){return db[_0x6587('0x44')]['find']({'where':{'id':_0x4e8ce6['params']['id']}})['then'](handleEntityNotFound(_0xb84673,null))[_0x6587('0x22')](function(_0x500b32){if(_0x500b32){return _0x500b32[_0x6587('0xb5')](_0x4e8ce6['body']['ids'],_[_0x6587('0x8b')](_0x4e8ce6[_0x6587('0x60')],[_0x6587('0x6a'),'id'])||{})['spread'](function(_0x426cb8){for(var _0x15c15d=0x0;_0x15c15d<_0x4e8ce6['body']['ids'][_0x6587('0x4d')];_0x15c15d+=0x1){socket[_0x6587('0xb6')](_0x6587('0xb7'),{'UserId':_0x4e8ce6['body']['ids'][_0x15c15d],'MailAccountId':_0x4e8ce6[_0x6587('0x5d')]['id']});}return _0x426cb8;});}})['then'](respondWithResult(_0xb84673,null))[_0x6587('0x2b')](handleError(_0xb84673,null));};exports[_0x6587('0xb8')]=function(_0x4a90db,_0x414827,_0x944d2f){return db[_0x6587('0x44')][_0x6587('0x61')]({'where':{'id':_0x4a90db[_0x6587('0x5d')]['id']}})[_0x6587('0x22')](handleEntityNotFound(_0x414827,null))[_0x6587('0x22')](function(_0x18a9e4){if(_0x18a9e4){return _0x18a9e4[_0x6587('0xb8')](_0x4a90db[_0x6587('0x4c')][_0x6587('0x6a')])[_0x6587('0x22')](function(){if(_[_0x6587('0xb9')](_0x4a90db['query'][_0x6587('0x6a')])){for(var _0x2149a7=0x0;_0x2149a7<_0x4a90db[_0x6587('0x4c')]['ids']['length'];_0x2149a7+=0x1){socket[_0x6587('0xb6')](_0x6587('0xba'),{'UserId':Number(_0x4a90db[_0x6587('0x4c')][_0x6587('0x6a')][_0x2149a7]),'MailAccountId':Number(_0x4a90db['params']['id'])});}}else{socket[_0x6587('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x4a90db[_0x6587('0x4c')][_0x6587('0x6a')]),'MailAccountId':Number(_0x4a90db[_0x6587('0x5d')]['id'])});}});}})[_0x6587('0x22')](respondWithStatusCode(_0x414827,null))[_0x6587('0x2b')](handleError(_0x414827,null));};exports['getAgents']=function(_0x29b047,_0x800360,_0x265a9a){var _0x280e3f={};var _0x11bce8={};var _0x5c85c1;var _0x544c86;return db[_0x6587('0x44')][_0x6587('0x65')]({'where':{'id':_0x29b047[_0x6587('0x5d')]['id']}})['then'](handleEntityNotFound(_0x800360,null))[_0x6587('0x22')](function(_0x563745){if(_0x563745){_0x5c85c1=_0x563745;_0x11bce8['model']=_[_0x6587('0x66')](db[_0x6587('0x8d')]['rawAttributes']);_0x11bce8[_0x6587('0x4c')]=_[_0x6587('0x66')](_0x29b047[_0x6587('0x4c')]);_0x11bce8[_0x6587('0x48')]=_[_0x6587('0x49')](_0x11bce8[_0x6587('0x47')],_0x11bce8[_0x6587('0x4c')]);_0x280e3f[_0x6587('0x4a')]=_[_0x6587('0x49')](_0x11bce8[_0x6587('0x47')],qs[_0x6587('0x4b')](_0x29b047['query'][_0x6587('0x4b')]));_0x280e3f[_0x6587('0x4a')]=_0x280e3f[_0x6587('0x4a')]['length']?_0x280e3f[_0x6587('0x4a')]:_0x11bce8[_0x6587('0x47')];_0x280e3f[_0x6587('0x50')]=qs[_0x6587('0x51')](_0x29b047[_0x6587('0x4c')]['sort']);_0x280e3f[_0x6587('0x52')]=qs[_0x6587('0x48')](_[_0x6587('0x53')](_0x29b047[_0x6587('0x4c')],_0x11bce8[_0x6587('0x48')]));if(_0x29b047[_0x6587('0x4c')][_0x6587('0x54')]){_0x280e3f[_0x6587('0x52')]=_[_0x6587('0x55')](_0x280e3f[_0x6587('0x52')],{'$or':_[_0x6587('0x43')](_0x280e3f[_0x6587('0x4a')],function(_0x57f49d){var _0x124ad1={};_0x124ad1[_0x57f49d]={'$like':'%'+_0x29b047[_0x6587('0x4c')][_0x6587('0x54')]+'%'};return _0x124ad1;})});}_0x280e3f=_[_0x6587('0x55')]({},_0x280e3f,_0x29b047[_0x6587('0x58')]);return _0x5c85c1[_0x6587('0xbb')](_0x280e3f);}})[_0x6587('0x22')](function(_0x16e4ae){if(_0x16e4ae){_0x544c86=_0x16e4ae[_0x6587('0x4d')];if(!_0x29b047[_0x6587('0x4c')][_0x6587('0x4e')](_0x6587('0x4f'))){_0x280e3f[_0x6587('0x30')]=qs[_0x6587('0x30')](_0x29b047[_0x6587('0x4c')][_0x6587('0x30')]);_0x280e3f['offset']=qs['offset'](_0x29b047[_0x6587('0x4c')][_0x6587('0x2f')]);}return _0x5c85c1[_0x6587('0xbb')](_0x280e3f);}})[_0x6587('0x22')](function(_0x241893){if(_0x241893){return _0x241893?{'count':_0x544c86,'rows':_0x241893}:null;}})[_0x6587('0x22')](respondWithResult(_0x800360,null))[_0x6587('0x2b')](handleError(_0x800360,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a552e9e..09443e9 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 _0x0199=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x2048d4,_0x5a18f0){var _0x310cca=function(_0x4e7c7c){while(--_0x4e7c7c){_0x2048d4['push'](_0x2048d4['shift']());}};_0x310cca(++_0x5a18f0);}(_0x0199,0x1d6));var _0x9019=function(_0x45957b,_0x33b380){_0x45957b=_0x45957b-0x0;var _0x3ac698=_0x0199[_0x45957b];return _0x3ac698;};'use strict';var EventEmitter=require(_0x9019('0x0'));var MailAccount=require(_0x9019('0x1'))['db'][_0x9019('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9019('0x3')](0x0);var events={'afterCreate':_0x9019('0x4'),'afterUpdate':_0x9019('0x5'),'afterDestroy':_0x9019('0x6')};function emitEvent(_0x4181f2){return function(_0x5873b2,_0x2f9d95,_0x207f92){MailAccountEvents[_0x9019('0x7')](_0x4181f2+':'+_0x5873b2['id'],_0x5873b2);MailAccountEvents['emit'](_0x4181f2,_0x5873b2);_0x207f92(null);};}for(var e in events){if(events[_0x9019('0x8')](e)){var event=events[e];MailAccount[_0x9019('0x9')](e,emitEvent(event));}}module[_0x9019('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x85d6=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d6,0x135));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x685d('0x0'));var MailAccount=require(_0x685d('0x1'))['db'][_0x685d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x685d('0x3')](0x0);var events={'afterCreate':_0x685d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x447935){return function(_0x5074f9,_0xa4c797,_0x362db4){MailAccountEvents[_0x685d('0x5')](_0x447935+':'+_0x5074f9['id'],_0x5074f9);MailAccountEvents[_0x685d('0x5')](_0x447935,_0x5074f9);_0x362db4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x685d('0x6')](e,emitEvent(event));}}module[_0x685d('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 320611a..901c330 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 _0xfc76=['bluebird','path','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','moment'];(function(_0x16c909,_0x1cb60a){var _0x5b2160=function(_0x89b4a3){while(--_0x89b4a3){_0x16c909['push'](_0x16c909['shift']());}};_0x5b2160(++_0x1cb60a);}(_0xfc76,0x110));var _0x6fc7=function(_0x31ca28,_0x526bcb){_0x31ca28=_0x31ca28-0x0;var _0x2fb825=_0xfc76[_0x31ca28];return _0x2fb825;};'use strict';var _=require(_0x6fc7('0x0'));var util=require(_0x6fc7('0x1'));var logger=require(_0x6fc7('0x2'))('api');var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fc7('0x5'));var rimraf=require('rimraf');var config=require(_0x6fc7('0x6'));var attributes=require(_0x6fc7('0x7'));module[_0x6fc7('0x8')]=function(_0x204930,_0x1a950a){return _0x204930[_0x6fc7('0x9')](_0x6fc7('0xa'),attributes,{'tableName':_0x6fc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae8c=['define','MailAccount','mail_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xae8c,0xc6));var _0xcae8=function(_0xd01821,_0x4c6756){_0xd01821=_0xd01821-0x0;var _0xa90e33=_0xae8c[_0xd01821];return _0xa90e33;};'use strict';var _=require(_0xcae8('0x0'));var util=require(_0xcae8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcae8('0x2'));var BPromise=require(_0xcae8('0x3'));var rp=require(_0xcae8('0x4'));var fs=require('fs');var path=require(_0xcae8('0x5'));var rimraf=require(_0xcae8('0x6'));var config=require(_0xcae8('0x7'));var attributes=require(_0xcae8('0x8'));module[_0xcae8('0x9')]=function(_0x1fbff9,_0xe6bede){return _0x1fbff9[_0xcae8('0xa')](_0xcae8('0xb'),attributes,{'tableName':_0xcae8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7e8c3f9..c2d31f0 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 _0x05b0=['name','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','map','model','attributes','include','ShowMailAccount','find','NotifyMailAccount','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','Applications','get','list','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','create','originTo','originCc','bcc','UserId','unshift','agent'];(function(_0x3464c1,_0x3b1d2b){var _0x485f45=function(_0x2799a5){while(--_0x2799a5){_0x3464c1['push'](_0x3464c1['shift']());}};_0x485f45(++_0x3b1d2b);}(_0x05b0,0x188));var _0x005b=function(_0x166058,_0x321d2a){_0x166058=_0x166058-0x0;var _0x3686a7=_0x05b0[_0x166058];return _0x3686a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x005b('0x0'));var BPromise=require(_0x005b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x2'));var db=require(_0x005b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var config=require('../../config/environment');var jayson=require(_0x005b('0x6'));var client=jayson[_0x005b('0x7')][_0x005b('0x8')]({'port':0x232c});config[_0x005b('0x9')]=_[_0x005b('0xa')](config[_0x005b('0x9')],{'host':_0x005b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x005b('0x9')]));require(_0x005b('0xc'))['register'](socket);function respondWithRpcPromise(_0x53fff4,_0x451641,_0x4d41b8){return new BPromise(function(_0x56040d,_0x56a44c){return client[_0x005b('0xd')](_0x53fff4,_0x4d41b8)[_0x005b('0xe')](function(_0x5b37a9){logger[_0x005b('0xf')](_0x005b('0x10'),_0x451641,_0x005b('0x11'));logger[_0x005b('0x12')](_0x005b('0x13'),_0x451641,_0x005b('0x11'),JSON[_0x005b('0x14')](_0x5b37a9));if(_0x5b37a9['error']){if(_0x5b37a9['error']['code']===0x1f4){logger[_0x005b('0x15')]('MailAccount,\x20%s,\x20%s',_0x451641,_0x5b37a9[_0x005b('0x15')]['message']);return _0x56a44c(_0x5b37a9[_0x005b('0x15')][_0x005b('0x16')]);}logger[_0x005b('0x15')](_0x005b('0x10'),_0x451641,_0x5b37a9[_0x005b('0x15')]['message']);return _0x56040d(_0x5b37a9[_0x005b('0x15')][_0x005b('0x16')]);}else{logger[_0x005b('0xf')]('MailAccount,\x20%s,\x20%s',_0x451641,_0x005b('0x11'));_0x56040d(_0x5b37a9[_0x005b('0x17')]['message']);}})[_0x005b('0x18')](function(_0x242f96){logger[_0x005b('0x15')](_0x005b('0x10'),_0x451641,_0x242f96);_0x56a44c(_0x242f96);});});}exports[_0x005b('0x19')]=function(_0x50e966){var _0x299838=this;return new Promise(function(_0x38cc3b,_0x4ae164){return db[_0x005b('0x1a')][_0x005b('0x1b')]({'raw':_0x50e966[_0x005b('0x1c')]?_0x50e966['options'][_0x005b('0x1d')]===undefined?!![]:![]:!![],'where':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')][_0x005b('0x1e')]||null:null,'attributes':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')]['attributes']||null:null,'limit':_0x50e966[_0x005b('0x1c')]?_0x50e966[_0x005b('0x1c')][_0x005b('0x1f')]||null:null,'include':_0x50e966['options']?_0x50e966[_0x005b('0x1c')]['include']?_[_0x005b('0x20')](_0x50e966['options']['include'],function(_0x2dc341){return{'model':db[_0x2dc341[_0x005b('0x21')]],'as':_0x2dc341['as'],'attributes':_0x2dc341[_0x005b('0x22')],'include':_0x2dc341[_0x005b('0x23')]?_[_0x005b('0x20')](_0x2dc341[_0x005b('0x23')],function(_0x3d4a1c){return{'model':db[_0x3d4a1c[_0x005b('0x21')]],'as':_0x3d4a1c['as'],'attributes':_0x3d4a1c['attributes'],'include':_0x3d4a1c[_0x005b('0x23')]?_[_0x005b('0x20')](_0x3d4a1c[_0x005b('0x23')],function(_0x13e834){return{'model':db[_0x13e834[_0x005b('0x21')]],'as':_0x13e834['as'],'attributes':_0x13e834[_0x005b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x005b('0xe')](function(_0x49561a){logger[_0x005b('0xf')](_0x005b('0x19'),_0x50e966);logger[_0x005b('0x12')](_0x005b('0x19'),_0x50e966,JSON['stringify'](_0x49561a));_0x38cc3b(_0x49561a);})['catch'](function(_0x3699b6){logger[_0x005b('0x15')]('GetMailAccount',_0x3699b6['message'],_0x50e966);_0x4ae164(_0x299838[_0x005b('0x15')](0x1f4,_0x3699b6['message']));});});};exports[_0x005b('0x24')]=function(_0x1466ea){var _0x32a067=this;return new Promise(function(_0x552574,_0x5aa45d){return db[_0x005b('0x1a')][_0x005b('0x25')]({'raw':_0x1466ea[_0x005b('0x1c')]?_0x1466ea['options']['raw']===undefined?!![]:![]:!![],'where':_0x1466ea[_0x005b('0x1c')]?_0x1466ea[_0x005b('0x1c')]['where']||null:null,'attributes':_0x1466ea[_0x005b('0x1c')]?_0x1466ea['options'][_0x005b('0x22')]||null:null,'include':_0x1466ea['options']?_0x1466ea['options'][_0x005b('0x23')]?_[_0x005b('0x20')](_0x1466ea[_0x005b('0x1c')][_0x005b('0x23')],function(_0x430d10){return{'model':db[_0x430d10['model']],'as':_0x430d10['as'],'attributes':_0x430d10['attributes'],'include':_0x430d10[_0x005b('0x23')]?_[_0x005b('0x20')](_0x430d10[_0x005b('0x23')],function(_0x250262){return{'model':db[_0x250262[_0x005b('0x21')]],'as':_0x250262['as'],'attributes':_0x250262[_0x005b('0x22')],'include':_0x250262['include']?_[_0x005b('0x20')](_0x250262[_0x005b('0x23')],function(_0x2c2ced){return{'model':db[_0x2c2ced['model']],'as':_0x2c2ced['as'],'attributes':_0x2c2ced[_0x005b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x005b('0xe')](function(_0x331e5f){logger[_0x005b('0xf')](_0x005b('0x24'),_0x1466ea);logger[_0x005b('0x12')](_0x005b('0x24'),_0x1466ea,JSON[_0x005b('0x14')](_0x331e5f));_0x552574(_0x331e5f);})[_0x005b('0x18')](function(_0xe8f18){logger['error'](_0x005b('0x24'),_0xe8f18[_0x005b('0x16')],_0x1466ea);_0x5aa45d(_0x32a067['error'](0x1f4,_0xe8f18[_0x005b('0x16')]));});});};exports[_0x005b('0x26')]=function(_0x1f29de){var _0x2a8a88=this;return new Promise(function(_0x4ec11c,_0x1814ac){var _0xb9388={'body':_0x1f29de['body'],'channel':_0x005b('0x27')};var _0x1da310=_[_0x005b('0x28')](_[_0x005b('0x29')](db[_0x005b('0x2a')]['rawAttributes']),['createdAt',_0x005b('0x2b'),_0x005b('0x2c'),_0x005b('0x2d')]);var _0x42c772=![];if(_0x1f29de[_0x005b('0x2e')]['id']){delete _0x1f29de['body']['id'];}if(_[_0x005b('0x2f')](_0x1f29de[_0x005b('0x2e')][_0x005b('0x30')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x005b('0x31')));}if(_[_0x005b('0x2f')](_0x1f29de['body'][_0x005b('0x2e')])||_0x1f29de['body'][_0x005b('0x2e')]===''){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x005b('0x2f')](_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1da310));}if(!_[_0x005b('0x33')](_0x1da310,_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')])){return _0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x005b('0x34')+_0x1da310));}var _0x185764={};_0x185764[_0x1f29de[_0x005b('0x2e')][_0x005b('0x32')]]=_0x1f29de[_0x005b('0x2e')]['from'];return db[_0x005b('0x1a')][_0x005b('0x25')]({'where':{'id':_0x1f29de[_0x005b('0x35')]['id']},'include':[{'model':db[_0x005b('0x36')],'as':_0x005b('0x37'),'include':[{'model':db['CmContact'],'as':_0x005b('0x38'),'where':_0x185764,'limit':0x1,'order':[[_0x005b('0x2b'),_0x005b('0x39')]]}]},{'model':db['MailApplication'],'as':_0x005b('0x3a')},{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](function(_0x5d21e2){if(_0x5d21e2&&_0x5d21e2[_0x005b('0x37')]){var _0x434eb8=_0x5d21e2[_0x005b('0x3b')]({'plain':!![]});_0xb9388[_0x005b('0x35')]=_['omit'](_0x434eb8,[_0x005b('0x3a'),_0x005b('0x37')]);_0xb9388['applications']=_0x434eb8[_0x005b('0x3a')];_0xb9388[_0x005b('0x3c')]=_0x434eb8[_0x005b('0x37')];_0xb9388[_0x005b('0x3d')]=_[_0x005b('0x3e')](_0xb9388['applications'],[_0x005b('0x3f')],[_0x005b('0x40')]);if(_0xb9388[_0x005b('0x35')]&&_0xb9388[_0x005b('0x35')][_0x005b('0x41')]){_0xb9388[_0x005b('0x3d')]['push']({'id':0x0,'priority':_0xb9388[_0x005b('0x3d')][_0x005b('0x42')]+0x1,'app':_0x005b('0x43'),'appdata':_0x005b('0x41'),'interval':_0x005b('0x44')});}if(_0xb9388[_0x005b('0x35')]['Applications']){delete _0xb9388[_0x005b('0x35')][_0x005b('0x3a')];}if(_0xb9388['account']['List']){delete _0xb9388[_0x005b('0x35')][_0x005b('0x37')];}if(_0x434eb8[_0x005b('0x37')][_0x005b('0x38')][_0x005b('0x42')]){return _0x434eb8[_0x005b('0x37')][_0x005b('0x38')][0x0];}var _0x4ffd69=_[_0x005b('0xa')](_0x1f29de['body'],{'firstName':_0x1f29de['body'][_0x005b('0x30')],'ListId':_0x434eb8[_0x005b('0x2d')]});_0x4ffd69[_0x1f29de[_0x005b('0x2e')]['mapKey']]=_0x1f29de[_0x005b('0x2e')][_0x005b('0x30')];return db[_0x005b('0x2a')]['create'](_0x4ffd69);}else{throw new Error(_0x005b('0x45'));}})['then'](function(_0x41f077){_0xb9388[_0x005b('0x46')]=_0x41f077;if(_0x41f077){if(!_0x1f29de['body'][_0x005b('0x16')][_0x005b('0x47')]){_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x47')]=rs[_0x005b('0x48')]()+'\x20'+_0x1f29de['body'][_0x005b('0x16')][_0x005b('0x30')];}var _0x41b9f0={'ContactId':_0x41f077['id'],'MailAccountId':_0x1f29de[_0x005b('0x35')]['id'],'inReplyTo':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['messageId'],'to':_0x1f29de[_0x005b('0x2e')]['message'][_0x005b('0x30')],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x49')],'attach':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'lastMsgAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')]};return db[_0x005b('0x4d')][_0x005b('0x25')]({'where':{'closed':![],'MailAccountId':_0x1f29de['account']['id']},'include':[{'model':db[_0x005b('0x4e')],'as':_0x005b('0x4f'),'attributes':[_0x005b('0x47')],'where':{'messageId':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x50')]}}]})[_0x005b('0xe')](function(_0x4b0abf){if(_0x4b0abf){return[_0x4b0abf,![]];}return db[_0x005b('0x4d')]['create'](_0x41b9f0)[_0x005b('0xe')](function(_0x4bd368){return[_0x4bd368,!![]];});});}else{throw new Error(_0x005b('0x51'));}})[_0x005b('0x52')](function(_0x55054f,_0x30a886){if(_0x55054f){_0x42c772=_0x30a886;if(!_0x30a886){return _0x55054f[_0x005b('0x53')]({'inReplyTo':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x47')],'to':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x30')],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de['body']['message'][_0x005b('0x49')],'attach':_0x55054f[_0x005b('0x4a')]?_0x55054f[_0x005b('0x4a')]:_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'substatus':null,'substatusAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgAt':moment()[_0x005b('0x4b')](_0x005b('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')]});}else{return _0x55054f;}}})[_0x005b('0xe')](function(_0x4affb2){_0xb9388[_0x005b('0x54')]=_0x4affb2[_0x005b('0x3b')]({'plain':!![]});_0xb9388['interaction'][_0x005b('0x55')]=_0x42c772;return db[_0x005b('0x4e')][_0x005b('0x56')]({'body':_0x1f29de[_0x005b('0x2e')][_0x005b('0x2e')],'MailAccountId':_0x1f29de[_0x005b('0x35')]['id'],'MailInteractionId':_0x4affb2['id'],'direction':'in','ContactId':_0xb9388[_0x005b('0x46')]['id'],'messageId':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['messageId'],'from':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x30')],'to':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['to'],'cc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')]['cc'],'subject':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x49')],'attach':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x4a')],'Attachments':_0x1f29de['body'][_0x005b('0x16')]['attachments'],'originTo':_0x1f29de[_0x005b('0x2e')]['message'][_0x005b('0x57')],'originCc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x58')],'bcc':_0x1f29de[_0x005b('0x2e')][_0x005b('0x16')][_0x005b('0x59')]},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x005b('0xe')](function(_0x3d47e6){_0xb9388['message']=_0x3d47e6;if(_0xb9388[_0x005b('0x54')][_0x005b('0x5a')]){return db['User'][_0x005b('0x25')]({'attributes':['id','name'],'where':{'id':_0xb9388[_0x005b('0x54')]['UserId']}})[_0x005b('0xe')](function(_0x1c38a4){if(_0x1c38a4){_0xb9388['applications'][_0x005b('0x5b')]({'id':0x0,'priority':0x0,'app':_0x005b('0x5c'),'appdata':_0x1c38a4[_0x005b('0x5d')]+','+(_0xb9388[_0x005b('0x35')][_0x005b('0x5e')]||0xa),'interval':_0x005b('0x44')});}return respondWithRpcPromise(_0x005b('0x5f'),'startRouting',_0xb9388);});}return respondWithRpcPromise(_0x005b('0x5f'),_0x005b('0x60'),_0xb9388);})[_0x005b('0xe')](function(_0xd9eb57){_0x4ec11c(_0xd9eb57);})[_0x005b('0x18')](function(_0x314ac6){_0x1814ac(_0x2a8a88[_0x005b('0x15')](0x1f4,_0x314ac6[_0x005b('0x16')]));});});}; \ No newline at end of file +var _0x2750=['attachments','originCc','bcc','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailAccount','options','raw','attributes','limit','map','include','model','info','ShowMailAccount','MailAccount','where','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','push','length','close','autoclose','*,*,*,*','List\x20not\x20found','contact','generate','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','create','spread','format','interaction','created','MailMessage'];(function(_0xeb3da9,_0x289f88){var _0x11a0e6=function(_0x9ad58e){while(--_0x9ad58e){_0xeb3da9['push'](_0xeb3da9['shift']());}};_0x11a0e6(++_0x289f88);}(_0x2750,0x13b));var _0x0275=function(_0x1d0a48,_0x2c015f){_0x1d0a48=_0x1d0a48-0x0;var _0x1b3f8e=_0x2750[_0x1d0a48];return _0x1b3f8e;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232c});config[_0x0275('0xc')]=_[_0x0275('0xd')](config[_0x0275('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0275('0xe'))(new Redis(config[_0x0275('0xc')]));require(_0x0275('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ae225,_0x224e0f,_0x565377){return new BPromise(function(_0x26fa6b,_0x377087){return client[_0x0275('0x10')](_0x5ae225,_0x565377)[_0x0275('0x11')](function(_0x14bc3e){logger['info'](_0x0275('0x12'),_0x224e0f,_0x0275('0x13'));logger[_0x0275('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x224e0f,'request\x20sent',JSON[_0x0275('0x15')](_0x14bc3e));if(_0x14bc3e[_0x0275('0x16')]){if(_0x14bc3e[_0x0275('0x16')][_0x0275('0x17')]===0x1f4){logger[_0x0275('0x16')](_0x0275('0x12'),_0x224e0f,_0x14bc3e['error'][_0x0275('0x18')]);return _0x377087(_0x14bc3e[_0x0275('0x16')]['message']);}logger[_0x0275('0x16')](_0x0275('0x12'),_0x224e0f,_0x14bc3e['error'][_0x0275('0x18')]);return _0x26fa6b(_0x14bc3e[_0x0275('0x16')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x224e0f,'request\x20sent');_0x26fa6b(_0x14bc3e['result'][_0x0275('0x18')]);}})[_0x0275('0x19')](function(_0x48d3f4){logger['error'](_0x0275('0x12'),_0x224e0f,_0x48d3f4);_0x377087(_0x48d3f4);});});}exports[_0x0275('0x1a')]=function(_0x20c7fc){var _0x5c5036=this;return new Promise(function(_0x1bd201,_0x402f0d){return db['MailAccount']['findAll']({'raw':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc[_0x0275('0x1b')][_0x0275('0x1c')]===undefined?!![]:![]:!![],'where':_0x20c7fc['options']?_0x20c7fc[_0x0275('0x1b')]['where']||null:null,'attributes':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc['options'][_0x0275('0x1d')]||null:null,'limit':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc['options'][_0x0275('0x1e')]||null:null,'include':_0x20c7fc[_0x0275('0x1b')]?_0x20c7fc[_0x0275('0x1b')]['include']?_[_0x0275('0x1f')](_0x20c7fc[_0x0275('0x1b')][_0x0275('0x20')],function(_0x15813f){return{'model':db[_0x15813f[_0x0275('0x21')]],'as':_0x15813f['as'],'attributes':_0x15813f[_0x0275('0x1d')],'include':_0x15813f['include']?_[_0x0275('0x1f')](_0x15813f[_0x0275('0x20')],function(_0x1d24b2){return{'model':db[_0x1d24b2[_0x0275('0x21')]],'as':_0x1d24b2['as'],'attributes':_0x1d24b2[_0x0275('0x1d')],'include':_0x1d24b2['include']?_[_0x0275('0x1f')](_0x1d24b2[_0x0275('0x20')],function(_0x3246ea){return{'model':db[_0x3246ea[_0x0275('0x21')]],'as':_0x3246ea['as'],'attributes':_0x3246ea[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d49b4){logger[_0x0275('0x22')](_0x0275('0x1a'),_0x20c7fc);logger['debug']('GetMailAccount',_0x20c7fc,JSON[_0x0275('0x15')](_0x2d49b4));_0x1bd201(_0x2d49b4);})[_0x0275('0x19')](function(_0x5dc2bc){logger[_0x0275('0x16')](_0x0275('0x1a'),_0x5dc2bc[_0x0275('0x18')],_0x20c7fc);_0x402f0d(_0x5c5036[_0x0275('0x16')](0x1f4,_0x5dc2bc['message']));});});};exports[_0x0275('0x23')]=function(_0x86940b){var _0x3bba47=this;return new Promise(function(_0x2002c2,_0x58da2d){return db[_0x0275('0x24')]['find']({'raw':_0x86940b[_0x0275('0x1b')]?_0x86940b['options'][_0x0275('0x1c')]===undefined?!![]:![]:!![],'where':_0x86940b[_0x0275('0x1b')]?_0x86940b['options'][_0x0275('0x25')]||null:null,'attributes':_0x86940b[_0x0275('0x1b')]?_0x86940b[_0x0275('0x1b')][_0x0275('0x1d')]||null:null,'include':_0x86940b['options']?_0x86940b[_0x0275('0x1b')][_0x0275('0x20')]?_[_0x0275('0x1f')](_0x86940b[_0x0275('0x1b')][_0x0275('0x20')],function(_0x58e3f3){return{'model':db[_0x58e3f3[_0x0275('0x21')]],'as':_0x58e3f3['as'],'attributes':_0x58e3f3[_0x0275('0x1d')],'include':_0x58e3f3[_0x0275('0x20')]?_[_0x0275('0x1f')](_0x58e3f3[_0x0275('0x20')],function(_0x430307){return{'model':db[_0x430307[_0x0275('0x21')]],'as':_0x430307['as'],'attributes':_0x430307[_0x0275('0x1d')],'include':_0x430307[_0x0275('0x20')]?_[_0x0275('0x1f')](_0x430307[_0x0275('0x20')],function(_0x5b47bc){return{'model':db[_0x5b47bc[_0x0275('0x21')]],'as':_0x5b47bc['as'],'attributes':_0x5b47bc[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0x11')](function(_0x26408f){logger[_0x0275('0x22')](_0x0275('0x23'),_0x86940b);logger[_0x0275('0x14')](_0x0275('0x23'),_0x86940b,JSON[_0x0275('0x15')](_0x26408f));_0x2002c2(_0x26408f);})[_0x0275('0x19')](function(_0x124e7d){logger[_0x0275('0x16')](_0x0275('0x23'),_0x124e7d[_0x0275('0x18')],_0x86940b);_0x58da2d(_0x3bba47['error'](0x1f4,_0x124e7d[_0x0275('0x18')]));});});};exports[_0x0275('0x26')]=function(_0x4d2d59){var _0x31d0ab=this;return new Promise(function(_0x76b8fa,_0x19cded){var _0xe72991={'body':_0x4d2d59[_0x0275('0x27')],'channel':_0x0275('0x28')};var _0x279db8=_['difference'](_[_0x0275('0x29')](db[_0x0275('0x2a')][_0x0275('0x2b')]),[_0x0275('0x2c'),'updatedAt',_0x0275('0x2d'),_0x0275('0x2e')]);var _0x3f37cb=![];if(_0x4d2d59[_0x0275('0x27')]['id']){delete _0x4d2d59['body']['id'];}if(_[_0x0275('0x2f')](_0x4d2d59['body'][_0x0275('0x30')])){return _0x19cded(_0x31d0ab[_0x0275('0x16')](0x1f4,_0x0275('0x31')));}if(_[_0x0275('0x2f')](_0x4d2d59['body'][_0x0275('0x27')])||_0x4d2d59[_0x0275('0x27')]['body']===''){return _0x19cded(_0x31d0ab[_0x0275('0x16')](0x1f4,_0x0275('0x32')));}if(_[_0x0275('0x2f')](_0x4d2d59['body'][_0x0275('0x33')])){return _0x19cded(_0x31d0ab[_0x0275('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x279db8));}if(!_[_0x0275('0x34')](_0x279db8,_0x4d2d59[_0x0275('0x27')][_0x0275('0x33')])){return _0x19cded(_0x31d0ab[_0x0275('0x16')](0x1f4,_0x0275('0x35')+_0x279db8));}var _0x22ec6e={};_0x22ec6e[_0x4d2d59[_0x0275('0x27')][_0x0275('0x33')]]=_0x4d2d59[_0x0275('0x27')][_0x0275('0x30')];return db[_0x0275('0x24')]['find']({'where':{'id':_0x4d2d59[_0x0275('0x36')]['id']},'include':[{'model':db[_0x0275('0x37')],'as':_0x0275('0x38'),'include':[{'model':db[_0x0275('0x2a')],'as':_0x0275('0x39'),'where':_0x22ec6e,'limit':0x1,'order':[[_0x0275('0x3a'),_0x0275('0x3b')]]}]},{'model':db[_0x0275('0x3c')],'as':_0x0275('0x3d')},{'model':db[_0x0275('0x3e')],'as':_0x0275('0x3f')}]})['then'](function(_0x589401){if(_0x589401&&_0x589401[_0x0275('0x38')]){var _0x608660=_0x589401[_0x0275('0x40')]({'plain':!![]});_0xe72991[_0x0275('0x36')]=_[_0x0275('0x41')](_0x608660,['Applications',_0x0275('0x38')]);_0xe72991['applications']=_0x608660[_0x0275('0x3d')];_0xe72991[_0x0275('0x42')]=_0x608660[_0x0275('0x38')];_0xe72991[_0x0275('0x43')]=_['orderBy'](_0xe72991[_0x0275('0x43')],['priority'],['asc']);if(_0xe72991['account']&&_0xe72991[_0x0275('0x36')]['autoclose']){_0xe72991[_0x0275('0x43')][_0x0275('0x44')]({'id':0x0,'priority':_0xe72991[_0x0275('0x43')][_0x0275('0x45')]+0x1,'app':_0x0275('0x46'),'appdata':_0x0275('0x47'),'interval':_0x0275('0x48')});}if(_0xe72991['account'][_0x0275('0x3d')]){delete _0xe72991['account'][_0x0275('0x3d')];}if(_0xe72991[_0x0275('0x36')][_0x0275('0x38')]){delete _0xe72991[_0x0275('0x36')][_0x0275('0x38')];}if(_0x608660[_0x0275('0x38')][_0x0275('0x39')][_0x0275('0x45')]){return _0x608660[_0x0275('0x38')][_0x0275('0x39')][0x0];}var _0x545333=_['defaults'](_0x4d2d59[_0x0275('0x27')],{'firstName':_0x4d2d59['body']['from'],'ListId':_0x608660[_0x0275('0x2e')]});_0x545333[_0x4d2d59[_0x0275('0x27')][_0x0275('0x33')]]=_0x4d2d59[_0x0275('0x27')][_0x0275('0x30')];return db[_0x0275('0x2a')]['create'](_0x545333);}else{throw new Error(_0x0275('0x49'));}})[_0x0275('0x11')](function(_0x41f258){_0xe72991[_0x0275('0x4a')]=_0x41f258;if(_0x41f258){if(!_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['messageId']){_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['messageId']=rs[_0x0275('0x4b')]()+'\x20'+_0x4d2d59['body'][_0x0275('0x18')][_0x0275('0x30')];}var _0x93bc6c={'ContactId':_0x41f258['id'],'MailAccountId':_0x4d2d59[_0x0275('0x36')]['id'],'inReplyTo':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x4c')],'to':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x30')],'cc':_0x4d2d59[_0x0275('0x27')]['message']['cc'],'subject':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x4d')],'attach':_0x4d2d59['body'][_0x0275('0x18')][_0x0275('0x4e')],'lastMsgAt':moment()['format'](_0x0275('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x4d2d59['body'][_0x0275('0x27')]};return db[_0x0275('0x50')][_0x0275('0x51')]({'where':{'closed':![],'MailAccountId':_0x4d2d59[_0x0275('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0x0275('0x52'),'attributes':[_0x0275('0x4c')],'where':{'messageId':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['inReplyTo']}}]})[_0x0275('0x11')](function(_0x238167){if(_0x238167){return[_0x238167,![]];}return db['MailInteraction'][_0x0275('0x53')](_0x93bc6c)[_0x0275('0x11')](function(_0x5e0a17){return[_0x5e0a17,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0275('0x54')](function(_0x26e707,_0x4eadbe){if(_0x26e707){_0x3f37cb=_0x4eadbe;if(!_0x4eadbe){return _0x26e707['update']({'inReplyTo':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x4c')],'to':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x30')],'cc':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['cc'],'subject':_0x4d2d59['body'][_0x0275('0x18')][_0x0275('0x4d')],'attach':_0x26e707[_0x0275('0x4e')]?_0x26e707[_0x0275('0x4e')]:_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x0275('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0275('0x55')](_0x0275('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x4d2d59[_0x0275('0x27')][_0x0275('0x27')]});}else{return _0x26e707;}}})['then'](function(_0x38d006){_0xe72991[_0x0275('0x56')]=_0x38d006[_0x0275('0x40')]({'plain':!![]});_0xe72991[_0x0275('0x56')][_0x0275('0x57')]=_0x3f37cb;return db[_0x0275('0x58')][_0x0275('0x53')]({'body':_0x4d2d59[_0x0275('0x27')][_0x0275('0x27')],'MailAccountId':_0x4d2d59['account']['id'],'MailInteractionId':_0x38d006['id'],'direction':'in','ContactId':_0xe72991['contact']['id'],'messageId':_0x4d2d59['body'][_0x0275('0x18')][_0x0275('0x4c')],'from':_0x4d2d59[_0x0275('0x27')]['message'][_0x0275('0x30')],'to':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['to'],'cc':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['cc'],'subject':_0x4d2d59['body'][_0x0275('0x18')]['subject'],'attach':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x4e')],'Attachments':_0x4d2d59[_0x0275('0x27')]['message'][_0x0275('0x59')],'originTo':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')]['originTo'],'originCc':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x5a')],'bcc':_0x4d2d59[_0x0275('0x27')][_0x0275('0x18')][_0x0275('0x5b')]},{'include':[{'model':db[_0x0275('0x5c')],'as':_0x0275('0x5d')}]});})['then'](function(_0x53d41e){_0xe72991['message']=_0x53d41e;if(_0xe72991[_0x0275('0x56')][_0x0275('0x5e')]){return db[_0x0275('0x5f')][_0x0275('0x51')]({'attributes':['id',_0x0275('0x60')],'where':{'id':_0xe72991['interaction'][_0x0275('0x5e')]}})['then'](function(_0x4820b0){if(_0x4820b0){_0xe72991[_0x0275('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0275('0x61'),'appdata':_0x4820b0[_0x0275('0x60')]+','+(_0xe72991[_0x0275('0x36')][_0x0275('0x62')]||0xa),'interval':_0x0275('0x48')});}return respondWithRpcPromise(_0x0275('0x63'),_0x0275('0x64'),_0xe72991);});}return respondWithRpcPromise(_0x0275('0x63'),_0x0275('0x64'),_0xe72991);})[_0x0275('0x11')](function(_0x2b8909){_0x76b8fa(_0x2b8909);})[_0x0275('0x19')](function(_0x473d09){_0x19cded(_0x31d0ab[_0x0275('0x16')](0x1f4,_0x473d09[_0x0275('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index d12e1af..fe986bd 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 _0xe548=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x1455a7,_0x11c7d9){var _0x1c7fb3=function(_0x2333c6){while(--_0x2333c6){_0x1455a7['push'](_0x1455a7['shift']());}};_0x1c7fb3(++_0x11c7d9);}(_0xe548,0x184));var _0x8e54=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0xe548[_0x10b2d5];return _0x14b8d1;};'use strict';var MailAccountEvents=require(_0x8e54('0x0'));var events=[_0x8e54('0x1'),_0x8e54('0x2'),_0x8e54('0x3')];function createListener(_0x8824f6,_0x48a491){return function(_0x5d61b0){_0x48a491['emit'](_0x8824f6,_0x5d61b0);};}function removeListener(_0x4aa36a,_0x4b69ef){return function(){MailAccountEvents[_0x8e54('0x4')](_0x4aa36a,_0x4b69ef);};}exports['register']=function(_0x288be8){for(var _0x47a58d=0x0,_0xc6281c=events[_0x8e54('0x5')];_0x47a58d<_0xc6281c;_0x47a58d++){var _0x148c1f=events[_0x47a58d];var _0x3d6444=createListener(_0x8e54('0x6')+_0x148c1f,_0x288be8);MailAccountEvents['on'](_0x148c1f,_0x3d6444);}}; \ No newline at end of file +var _0x535f=['removeListener','register','mailAccount:','save','remove','emit'];(function(_0xc9abbe,_0x1f7c69){var _0x4246bd=function(_0xbbe775){while(--_0xbbe775){_0xc9abbe['push'](_0xc9abbe['shift']());}};_0x4246bd(++_0x1f7c69);}(_0x535f,0x111));var _0xf535=function(_0x57b748,_0x57bd48){_0x57b748=_0x57b748-0x0;var _0x180174=_0x535f[_0x57b748];return _0x180174;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xf535('0x0'),_0xf535('0x1'),'update'];function createListener(_0x3d9c4d,_0x3a8c17){return function(_0x64d0bc){_0x3a8c17[_0xf535('0x2')](_0x3d9c4d,_0x64d0bc);};}function removeListener(_0x4ff0b3,_0xd1ee93){return function(){MailAccountEvents[_0xf535('0x3')](_0x4ff0b3,_0xd1ee93);};}exports[_0xf535('0x4')]=function(_0x30936d){for(var _0x41ca74=0x0,_0xc74104=events['length'];_0x41ca74<_0xc74104;_0x41ca74++){var _0x510b86=events[_0x41ca74];var _0x17f72e=createListener(_0xf535('0x5')+_0x510b86,_0x30936d);MailAccountEvents['on'](_0x510b86,_0x17f72e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ed1e7de..2d9191c 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 _0xc788=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0xc788,0xc4));var _0x8c78=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xc788[_0x4fa0ea];return _0x51d027;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get'](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0xb')](_0x8c78('0x8'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0xd')](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);module[_0x8c78('0xf')]=router; \ No newline at end of file +var _0x6e6c=['update','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','put'];(function(_0x267d42,_0x14e056){var _0x231808=function(_0x35e449){while(--_0x35e449){_0x267d42['push'](_0x267d42['shift']());}};_0x231808(++_0x14e056);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc6e6('0x4'));var config=require('../../config/environment');var controller=require(_0xc6e6('0x5'));router['get'](_0xc6e6('0x6'),auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x8')](_0xc6e6('0x6'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/:id',auth[_0xc6e6('0x7')](),controller['destroy']);module[_0xc6e6('0xb')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 65cb845..d4a830f 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 _0xad82=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x2c1d8c,_0x28a489){var _0x3a8da2=function(_0x332a68){while(--_0x332a68){_0x2c1d8c['push'](_0x2c1d8c['shift']());}};_0x3a8da2(++_0x28a489);}(_0xad82,0x115));var _0x2ad8=function(_0x5ae8f1,_0x58098e){_0x5ae8f1=_0x5ae8f1-0x0;var _0x4ac982=_0xad82[_0x5ae8f1];return _0x4ac982;};'use strict';var Sequelize=require(_0x2ad8('0x0'));module[_0x2ad8('0x1')]={'priority':{'type':Sequelize[_0x2ad8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2ad8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2ad8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2ad8('0x3')],'defaultValue':_0x2ad8('0x5')}}; \ No newline at end of file +var _0xdac2=['noop','TEXT','exports','INTEGER','STRING'];(function(_0x113fb3,_0x46af62){var _0x15877e=function(_0x1262a0){while(--_0x1262a0){_0x113fb3['push'](_0x113fb3['shift']());}};_0x15877e(++_0x46af62);}(_0xdac2,0x10b));var _0x2dac=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0xdac2[_0x31c19c];return _0x1a87f7;};'use strict';var Sequelize=require('sequelize');module[_0x2dac('0x0')]={'priority':{'type':Sequelize[_0x2dac('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2dac('0x2')],'allowNull':![],'defaultValue':_0x2dac('0x3')},'appdata':{'type':Sequelize[_0x2dac('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2dac('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6f2f999..96322ea 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 _0xb9ba=['params','destroy','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','error','name','send','show','keys','MailApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9ba,0x158));var _0xab9b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb9ba[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xab9b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab9b('0x1'));var jsonpatch=require(_0xab9b('0x2'));var rp=require(_0xab9b('0x3'));var moment=require('moment');var BPromise=require(_0xab9b('0x4'));var Mustache=require('mustache');var util=require(_0xab9b('0x5'));var path=require(_0xab9b('0x6'));var sox=require(_0xab9b('0x7'));var csv=require(_0xab9b('0x8'));var ejs=require(_0xab9b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab9b('0xa'));var crypto=require(_0xab9b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xab9b('0xc'));var toCsv=require(_0xab9b('0x8'));var querystring=require(_0xab9b('0xd'));var Papa=require(_0xab9b('0xe'));var Redis=require(_0xab9b('0xf'));var authService=require(_0xab9b('0x10'));var qs=require(_0xab9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab9b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xab9b('0x13'));var config=require(_0xab9b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305bee,_0x27e8b5){_0x27e8b5=_0x27e8b5||0xcc;return function(_0x39cf1){if(_0x39cf1){return _0x305bee[_0xab9b('0x15')](_0x27e8b5);}return _0x305bee[_0xab9b('0x16')](_0x27e8b5)[_0xab9b('0x17')]();};}function respondWithResult(_0x2e75ca,_0x6ef3ad){_0x6ef3ad=_0x6ef3ad||0xc8;return function(_0x40672a){if(_0x40672a){return _0x2e75ca[_0xab9b('0x16')](_0x6ef3ad)['json'](_0x40672a);}};}function respondWithFilteredResult(_0x55c676,_0x1f7a4c){return function(_0x92c722){if(_0x92c722){var _0x51e146=_0x92c722[_0xab9b('0x18')],_0x7c1599=_0x1f7a4c[_0xab9b('0x19')],_0x2b7bf2=_0x1f7a4c[_0xab9b('0x19')]+_0x1f7a4c[_0xab9b('0x1a')],_0xe38787;if(_0x2b7bf2>=_0x51e146){_0x2b7bf2=_0x51e146;_0xe38787=0xc8;}else{_0xe38787=0xce;}_0x55c676[_0xab9b('0x16')](_0xe38787);return _0x55c676[_0xab9b('0x1b')](_0xab9b('0x1c'),_0x7c1599+'-'+_0x2b7bf2+'/'+_0x51e146)[_0xab9b('0x1d')](_0x92c722);}return null;};}function patchUpdates(_0xae4ef2){return function(_0x36d786){try{jsonpatch[_0xab9b('0x1e')](_0x36d786,_0xae4ef2,!![]);}catch(_0x5b08a9){return BPromise[_0xab9b('0x1f')](_0x5b08a9);}return _0x36d786['save']();};}function saveUpdates(_0x765600,_0x4ea586){return function(_0x115e47){if(_0x115e47){return _0x115e47['update'](_0x765600)[_0xab9b('0x20')](function(_0x31a381){return _0x31a381;});}return null;};}function removeEntity(_0x13d694,_0x214799){return function(_0x26a684){if(_0x26a684){return _0x26a684['destroy']()[_0xab9b('0x20')](function(){_0x13d694[_0xab9b('0x16')](0xcc)[_0xab9b('0x17')]();});}};}function handleEntityNotFound(_0x2b6716,_0x75c9e9){return function(_0x589dbf){if(!_0x589dbf){_0x2b6716[_0xab9b('0x15')](0x194);}return _0x589dbf;};}function handleError(_0x3f0b41,_0x2ec402){_0x2ec402=_0x2ec402||0x1f4;return function(_0x24e6af){logger[_0xab9b('0x21')](_0x24e6af['stack']);if(_0x24e6af[_0xab9b('0x22')]){delete _0x24e6af[_0xab9b('0x22')];}_0x3f0b41['status'](_0x2ec402)[_0xab9b('0x23')](_0x24e6af);};}exports[_0xab9b('0x24')]=function(_0x49e6ca,_0x3dccd5){var _0x493768={'raw':!![],'where':{'id':_0x49e6ca['params']['id']}},_0x2a6589={};_0x2a6589['model']=_[_0xab9b('0x25')](db[_0xab9b('0x26')][_0xab9b('0x27')]);_0x2a6589[_0xab9b('0x28')]=_['keys'](_0x49e6ca['query']);_0x2a6589[_0xab9b('0x29')]=_[_0xab9b('0x2a')](_0x2a6589[_0xab9b('0x2b')],_0x2a6589[_0xab9b('0x28')]);_0x493768[_0xab9b('0x2c')]=_['intersection'](_0x2a6589[_0xab9b('0x2b')],qs[_0xab9b('0x2d')](_0x49e6ca[_0xab9b('0x28')][_0xab9b('0x2d')]));_0x493768[_0xab9b('0x2c')]=_0x493768[_0xab9b('0x2c')][_0xab9b('0x2e')]?_0x493768[_0xab9b('0x2c')]:_0x2a6589[_0xab9b('0x2b')];if(_0x49e6ca[_0xab9b('0x28')][_0xab9b('0x2f')]){_0x493768[_0xab9b('0x30')]=[{'all':!![]}];}_0x493768=_[_0xab9b('0x31')]({},_0x493768,_0x49e6ca[_0xab9b('0x32')]);return db[_0xab9b('0x26')][_0xab9b('0x33')](_0x493768)[_0xab9b('0x20')](handleEntityNotFound(_0x3dccd5,null))['then'](respondWithResult(_0x3dccd5,null))[_0xab9b('0x34')](handleError(_0x3dccd5,null));};exports[_0xab9b('0x35')]=function(_0x1996d2,_0x442ff0){if(_0x1996d2['body']['id']){delete _0x1996d2[_0xab9b('0x36')]['id'];}return db[_0xab9b('0x26')][_0xab9b('0x33')]({'where':{'id':_0x1996d2[_0xab9b('0x37')]['id']}})[_0xab9b('0x20')](handleEntityNotFound(_0x442ff0,null))[_0xab9b('0x20')](saveUpdates(_0x1996d2['body'],null))[_0xab9b('0x20')](respondWithResult(_0x442ff0,null))['catch'](handleError(_0x442ff0,null));};exports[_0xab9b('0x38')]=function(_0x128624,_0x55a112){return db[_0xab9b('0x26')][_0xab9b('0x33')]({'where':{'id':_0x128624['params']['id']}})[_0xab9b('0x20')](handleEntityNotFound(_0x55a112,null))[_0xab9b('0x20')](removeEntity(_0x55a112,null))[_0xab9b('0x34')](handleError(_0x55a112,null));}; \ No newline at end of file +var _0x231c=['destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','json','reject','save','then','sendStatus','error','name','send','show','keys','MailApplication','query','filters','model','attributes','intersection','fields','merge','body','find','catch'];(function(_0x3b2c83,_0x13f538){var _0x4ff9cb=function(_0x424c3a){while(--_0x424c3a){_0x3b2c83['push'](_0x3b2c83['shift']());}};_0x4ff9cb(++_0x13f538);}(_0x231c,0x134));var _0xc231=function(_0x57ff9f,_0x43f627){_0x57ff9f=_0x57ff9f-0x0;var _0x14be3d=_0x231c[_0x57ff9f];return _0x14be3d;};'use strict';var pdf=require(_0xc231('0x0'));var emlformat=require(_0xc231('0x1'));var rimraf=require(_0xc231('0x2'));var zipdir=require(_0xc231('0x3'));var jsonpatch=require(_0xc231('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc231('0x5'));var Mustache=require(_0xc231('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc231('0x7'));var ejs=require(_0xc231('0x8'));var fs=require('fs');var _=require(_0xc231('0x9'));var squel=require(_0xc231('0xa'));var crypto=require(_0xc231('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc231('0xc'));var Papa=require(_0xc231('0xd'));var Redis=require(_0xc231('0xe'));var authService=require(_0xc231('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc231('0x10'));var hardwareService=require(_0xc231('0x11'));var logger=require(_0xc231('0x12'))(_0xc231('0x13'));var utils=require(_0xc231('0x14'));var config=require(_0xc231('0x15'));var db=require(_0xc231('0x16'))['db'];function respondWithStatusCode(_0x3f061a,_0x2965c5){_0x2965c5=_0x2965c5||0xcc;return function(_0xc0d2f2){if(_0xc0d2f2){return _0x3f061a['sendStatus'](_0x2965c5);}return _0x3f061a[_0xc231('0x17')](_0x2965c5)[_0xc231('0x18')]();};}function respondWithResult(_0x34312c,_0x1eafd2){_0x1eafd2=_0x1eafd2||0xc8;return function(_0x551060){if(_0x551060){return _0x34312c[_0xc231('0x17')](_0x1eafd2)['json'](_0x551060);}};}function respondWithFilteredResult(_0x4e0085,_0xe466e2){return function(_0x20a104){if(_0x20a104){var _0x2a3212=_0x20a104[_0xc231('0x19')],_0x42150b=_0xe466e2[_0xc231('0x1a')],_0x615daa=_0xe466e2['offset']+_0xe466e2['limit'],_0x23cc06;if(_0x615daa>=_0x2a3212){_0x615daa=_0x2a3212;_0x23cc06=0xc8;}else{_0x23cc06=0xce;}_0x4e0085['status'](_0x23cc06);return _0x4e0085[_0xc231('0x1b')]('Content-Range',_0x42150b+'-'+_0x615daa+'/'+_0x2a3212)[_0xc231('0x1c')](_0x20a104);}return null;};}function patchUpdates(_0x3134f8){return function(_0x32f1b2){try{jsonpatch['apply'](_0x32f1b2,_0x3134f8,!![]);}catch(_0x543949){return BPromise[_0xc231('0x1d')](_0x543949);}return _0x32f1b2[_0xc231('0x1e')]();};}function saveUpdates(_0x5b04b4,_0x40e3fe){return function(_0x69026b){if(_0x69026b){return _0x69026b['update'](_0x5b04b4)[_0xc231('0x1f')](function(_0x582149){return _0x582149;});}return null;};}function removeEntity(_0x105c74,_0x2a019f){return function(_0x24f764){if(_0x24f764){return _0x24f764['destroy']()['then'](function(){_0x105c74[_0xc231('0x17')](0xcc)[_0xc231('0x18')]();});}};}function handleEntityNotFound(_0x391b4b,_0x29b505){return function(_0x580dbc){if(!_0x580dbc){_0x391b4b[_0xc231('0x20')](0x194);}return _0x580dbc;};}function handleError(_0xb7949e,_0x5df91c){_0x5df91c=_0x5df91c||0x1f4;return function(_0x50aa28){logger[_0xc231('0x21')](_0x50aa28['stack']);if(_0x50aa28['name']){delete _0x50aa28[_0xc231('0x22')];}_0xb7949e[_0xc231('0x17')](_0x5df91c)[_0xc231('0x23')](_0x50aa28);};}exports[_0xc231('0x24')]=function(_0x26adb2,_0x2387f3){var _0x31a016={'raw':!![],'where':{'id':_0x26adb2['params']['id']}},_0x44d94c={};_0x44d94c['model']=_[_0xc231('0x25')](db[_0xc231('0x26')]['rawAttributes']);_0x44d94c[_0xc231('0x27')]=_[_0xc231('0x25')](_0x26adb2[_0xc231('0x27')]);_0x44d94c[_0xc231('0x28')]=_['intersection'](_0x44d94c[_0xc231('0x29')],_0x44d94c['query']);_0x31a016[_0xc231('0x2a')]=_[_0xc231('0x2b')](_0x44d94c['model'],qs[_0xc231('0x2c')](_0x26adb2[_0xc231('0x27')]['fields']));_0x31a016['attributes']=_0x31a016[_0xc231('0x2a')]['length']?_0x31a016[_0xc231('0x2a')]:_0x44d94c[_0xc231('0x29')];if(_0x26adb2[_0xc231('0x27')]['includeAll']){_0x31a016['include']=[{'all':!![]}];}_0x31a016=_[_0xc231('0x2d')]({},_0x31a016,_0x26adb2['options']);return db[_0xc231('0x26')]['find'](_0x31a016)['then'](handleEntityNotFound(_0x2387f3,null))[_0xc231('0x1f')](respondWithResult(_0x2387f3,null))['catch'](handleError(_0x2387f3,null));};exports['update']=function(_0x5cd54f,_0x5f457f){if(_0x5cd54f[_0xc231('0x2e')]['id']){delete _0x5cd54f[_0xc231('0x2e')]['id'];}return db[_0xc231('0x26')][_0xc231('0x2f')]({'where':{'id':_0x5cd54f['params']['id']}})['then'](handleEntityNotFound(_0x5f457f,null))[_0xc231('0x1f')](saveUpdates(_0x5cd54f[_0xc231('0x2e')],null))['then'](respondWithResult(_0x5f457f,null))[_0xc231('0x30')](handleError(_0x5f457f,null));};exports[_0xc231('0x31')]=function(_0x11572b,_0x28a5c8){return db[_0xc231('0x26')][_0xc231('0x2f')]({'where':{'id':_0x11572b[_0xc231('0x32')]['id']}})[_0xc231('0x1f')](handleEntityNotFound(_0x28a5c8,null))[_0xc231('0x1f')](removeEntity(_0x28a5c8,null))[_0xc231('0x30')](handleError(_0x28a5c8,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1241ebc..d0c4e95 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 _0x3b7c=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','MailApplication','utf8mb4'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3b7c,0x10f));var _0xc3b7=function(_0x432987,_0x5b96a2){_0x432987=_0x432987-0x0;var _0x47ce4a=_0x3b7c[_0x432987];return _0x47ce4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3b7('0x0'))(_0xc3b7('0x1'));var moment=require(_0xc3b7('0x2'));var BPromise=require(_0xc3b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3b7('0x4'));var rimraf=require(_0xc3b7('0x5'));var config=require(_0xc3b7('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x50ba41,_0x103a6d){return _0x50ba41['define'](_0xc3b7('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc3b7('0x8'),'collate':_0xc3b7('0x9')});}; \ No newline at end of file +var _0xfc37=['define','MailApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x5cec97,_0x2c3cf2){var _0x3ac954=function(_0x17f2db){while(--_0x17f2db){_0x5cec97['push'](_0x5cec97['shift']());}};_0x3ac954(++_0x2c3cf2);}(_0xfc37,0x10c));var _0x7fc3=function(_0xeb110f,_0x309f7b){_0xeb110f=_0xeb110f-0x0;var _0x551c98=_0xfc37[_0xeb110f];return _0x551c98;};'use strict';var _=require('lodash');var util=require(_0x7fc3('0x0'));var logger=require(_0x7fc3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fc3('0x2'));var rp=require(_0x7fc3('0x3'));var fs=require('fs');var path=require(_0x7fc3('0x4'));var rimraf=require(_0x7fc3('0x5'));var config=require(_0x7fc3('0x6'));var attributes=require(_0x7fc3('0x7'));module['exports']=function(_0x177fb1,_0x3a32ab){return _0x177fb1[_0x7fc3('0x8')](_0x7fc3('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7fc3('0xa'),'collate':_0x7fc3('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8639e0b..c8a703a 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 _0x0f24=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','UpdateMailApplication','update','options','raw','where','attributes','limit','then'];(function(_0x3ad73a,_0x5669a8){var _0x109bdc=function(_0x104b37){while(--_0x104b37){_0x3ad73a['push'](_0x3ad73a['shift']());}};_0x109bdc(++_0x5669a8);}(_0x0f24,0x187));var _0x40f2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0f24[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x40f2('0x0'));var util=require(_0x40f2('0x1'));var moment=require(_0x40f2('0x2'));var BPromise=require(_0x40f2('0x3'));var rs=require(_0x40f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x40f2('0x5'));var logger=require(_0x40f2('0x6'))(_0x40f2('0x7'));var config=require(_0x40f2('0x8'));var jayson=require(_0x40f2('0x9'));var client=jayson[_0x40f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e02af,_0x490a00,_0x39ab79){return new BPromise(function(_0xb9c546,_0x201b1b){return client[_0x40f2('0xb')](_0x4e02af,_0x39ab79)['then'](function(_0x2b1691){logger['info'](_0x40f2('0xc'),_0x490a00,_0x40f2('0xd'));logger[_0x40f2('0xe')](_0x40f2('0xf'),_0x490a00,_0x40f2('0xd'),JSON[_0x40f2('0x10')](_0x2b1691));if(_0x2b1691[_0x40f2('0x11')]){if(_0x2b1691[_0x40f2('0x11')]['code']===0x1f4){logger[_0x40f2('0x11')](_0x40f2('0xc'),_0x490a00,_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);return _0x201b1b(_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);}logger['error'](_0x40f2('0xc'),_0x490a00,_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);return _0xb9c546(_0x2b1691[_0x40f2('0x11')][_0x40f2('0x12')]);}else{logger[_0x40f2('0x13')](_0x40f2('0xc'),_0x490a00,_0x40f2('0xd'));_0xb9c546(_0x2b1691[_0x40f2('0x14')][_0x40f2('0x12')]);}})['catch'](function(_0x32a20){logger[_0x40f2('0x11')](_0x40f2('0xc'),_0x490a00,_0x32a20);_0x201b1b(_0x32a20);});});}exports[_0x40f2('0x15')]=function(_0x5044da){var _0x25dcf3=this;return new Promise(function(_0x22aa18,_0x3221f0){return db['MailApplication'][_0x40f2('0x16')](_0x5044da['body'],{'raw':_0x5044da['options']?_0x5044da[_0x40f2('0x17')][_0x40f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5044da['options']?_0x5044da['options'][_0x40f2('0x19')]||null:null,'attributes':_0x5044da[_0x40f2('0x17')]?_0x5044da['options'][_0x40f2('0x1a')]||null:null,'limit':_0x5044da[_0x40f2('0x17')]?_0x5044da[_0x40f2('0x17')][_0x40f2('0x1b')]||null:null})[_0x40f2('0x1c')](function(_0x5af04e){logger['info'](_0x40f2('0x15'),_0x5044da);logger[_0x40f2('0xe')](_0x40f2('0x15'),_0x5044da,JSON[_0x40f2('0x10')](_0x5af04e));_0x22aa18(_0x5af04e);})[_0x40f2('0x1d')](function(_0x4e0555){logger['error']('UpdateMailApplication',_0x4e0555[_0x40f2('0x12')],_0x5044da);_0x3221f0(_0x25dcf3[_0x40f2('0x11')](0x1f4,_0x4e0555[_0x40f2('0x12')]));});});}; \ No newline at end of file +var _0xbf7c=['then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4c5a52,_0x59ef62){var _0x5b40f5=function(_0x4eb274){while(--_0x4eb274){_0x4c5a52['push'](_0x4c5a52['shift']());}};_0x5b40f5(++_0x59ef62);}(_0xbf7c,0x7e));var _0xcbf7=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbf7c[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xcbf7('0x0'));var util=require(_0xcbf7('0x1'));var moment=require(_0xcbf7('0x2'));var BPromise=require(_0xcbf7('0x3'));var rs=require(_0xcbf7('0x4'));var fs=require('fs');var Redis=require(_0xcbf7('0x5'));var db=require(_0xcbf7('0x6'))['db'];var utils=require(_0xcbf7('0x7'));var logger=require('../../config/logger')(_0xcbf7('0x8'));var config=require(_0xcbf7('0x9'));var jayson=require(_0xcbf7('0xa'));var client=jayson[_0xcbf7('0xb')][_0xcbf7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbf20fd,_0x5b4f8c,_0x2b1da2){return new BPromise(function(_0xd4027d,_0x46a8d2){return client[_0xcbf7('0xd')](_0xbf20fd,_0x2b1da2)[_0xcbf7('0xe')](function(_0x40d2d3){logger['info'](_0xcbf7('0xf'),_0x5b4f8c,'request\x20sent');logger['debug'](_0xcbf7('0x10'),_0x5b4f8c,_0xcbf7('0x11'),JSON[_0xcbf7('0x12')](_0x40d2d3));if(_0x40d2d3[_0xcbf7('0x13')]){if(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x14')]===0x1f4){logger[_0xcbf7('0x13')]('MailApplication,\x20%s,\x20%s',_0x5b4f8c,_0x40d2d3['error']['message']);return _0x46a8d2(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);}logger['error'](_0xcbf7('0xf'),_0x5b4f8c,_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);return _0xd4027d(_0x40d2d3[_0xcbf7('0x13')][_0xcbf7('0x15')]);}else{logger['info'](_0xcbf7('0xf'),_0x5b4f8c,_0xcbf7('0x11'));_0xd4027d(_0x40d2d3[_0xcbf7('0x16')][_0xcbf7('0x15')]);}})[_0xcbf7('0x17')](function(_0x3811ac){logger[_0xcbf7('0x13')]('MailApplication,\x20%s,\x20%s',_0x5b4f8c,_0x3811ac);_0x46a8d2(_0x3811ac);});});}exports[_0xcbf7('0x18')]=function(_0x521520){var _0x4bf839=this;return new Promise(function(_0x2932f4,_0x523c57){return db['MailApplication'][_0xcbf7('0x19')](_0x521520['body'],{'raw':_0x521520[_0xcbf7('0x1a')]?_0x521520[_0xcbf7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x521520['options']?_0x521520[_0xcbf7('0x1a')][_0xcbf7('0x1b')]||null:null,'attributes':_0x521520['options']?_0x521520['options']['attributes']||null:null,'limit':_0x521520['options']?_0x521520[_0xcbf7('0x1a')]['limit']||null:null})[_0xcbf7('0xe')](function(_0x3b51bd){logger['info'](_0xcbf7('0x18'),_0x521520);logger['debug'](_0xcbf7('0x18'),_0x521520,JSON[_0xcbf7('0x12')](_0x3b51bd));_0x2932f4(_0x3b51bd);})[_0xcbf7('0x17')](function(_0x549d42){logger[_0xcbf7('0x13')]('UpdateMailApplication',_0x549d42[_0xcbf7('0x15')],_0x521520);_0x523c57(_0x4bf839[_0xcbf7('0x13')](0x1f4,_0x549d42[_0xcbf7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3751c1a..dc4b8f8 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 _0x8184=['isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x98ce5f,_0x3a7853){var _0x592435=function(_0xe6b7d4){while(--_0xe6b7d4){_0x98ce5f['push'](_0x98ce5f['shift']());}};_0x592435(++_0x3a7853);}(_0x8184,0x76));var _0x4818=function(_0xfa8c4,_0x129d61){_0xfa8c4=_0xfa8c4-0x0;var _0xbff44b=_0x8184[_0xfa8c4];return _0xbff44b;};'use strict';var multer=require(_0x4818('0x0'));var util=require(_0x4818('0x1'));var path=require(_0x4818('0x2'));var timeout=require(_0x4818('0x3'));var express=require(_0x4818('0x4'));var router=express[_0x4818('0x5')]();var auth=require(_0x4818('0x6'));var interaction=require(_0x4818('0x7'));var config=require(_0x4818('0x8'));var controller=require('./mailInteraction.controller');router[_0x4818('0x9')]('/',auth[_0x4818('0xa')](),controller['index']);router[_0x4818('0x9')](_0x4818('0xb'),auth[_0x4818('0xa')](),controller[_0x4818('0xc')]);router[_0x4818('0x9')](_0x4818('0xd'),auth[_0x4818('0xa')](),controller[_0x4818('0xe')]);router[_0x4818('0x9')](_0x4818('0xf'),auth[_0x4818('0xa')](),controller[_0x4818('0x10')]);router[_0x4818('0x9')](_0x4818('0x11'),auth[_0x4818('0xa')](),controller[_0x4818('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4818('0x13')]('/:id/messages',auth[_0x4818('0xa')](),controller[_0x4818('0x14')]);router[_0x4818('0x13')](_0x4818('0x15'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')](_0x4818('0x17'),_0x4818('0x18')),controller[_0x4818('0x19')]);router[_0x4818('0x1a')](_0x4818('0xd'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')]('mail','mailinteraction:update'),controller[_0x4818('0x1b')]);router[_0x4818('0x1c')](_0x4818('0xd'),auth[_0x4818('0xa')](),interaction[_0x4818('0x16')](_0x4818('0x17'),_0x4818('0x1d')),controller['destroy']);router[_0x4818('0x1c')](_0x4818('0x15'),auth[_0x4818('0xa')](),controller[_0x4818('0x1e')]);module[_0x4818('0x1f')]=router; \ No newline at end of file +var _0xd68d=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x5c519c,_0xea4e0e){var _0x39761a=function(_0x23ade1){while(--_0x23ade1){_0x5c519c['push'](_0x5c519c['shift']());}};_0x39761a(++_0xea4e0e);}(_0xd68d,0x7f));var _0xdd68=function(_0x1d0aa3,_0x413c03){_0x1d0aa3=_0x1d0aa3-0x0;var _0x48091c=_0xd68d[_0x1d0aa3];return _0x48091c;};'use strict';var multer=require(_0xdd68('0x0'));var util=require(_0xdd68('0x1'));var path=require('path');var timeout=require(_0xdd68('0x2'));var express=require(_0xdd68('0x3'));var router=express[_0xdd68('0x4')]();var auth=require(_0xdd68('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd68('0x6'));router[_0xdd68('0x7')]('/',auth[_0xdd68('0x8')](),controller[_0xdd68('0x9')]);router[_0xdd68('0x7')]('/describe',auth[_0xdd68('0x8')](),controller['describe']);router[_0xdd68('0x7')](_0xdd68('0xa'),auth[_0xdd68('0x8')](),controller[_0xdd68('0xb')]);router[_0xdd68('0x7')](_0xdd68('0xc'),auth[_0xdd68('0x8')](),controller[_0xdd68('0xd')]);router[_0xdd68('0x7')](_0xdd68('0xe'),auth['isAuthenticated'](),controller[_0xdd68('0xf')]);router[_0xdd68('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd68('0x10')](_0xdd68('0xc'),auth[_0xdd68('0x8')](),controller[_0xdd68('0x11')]);router[_0xdd68('0x10')](_0xdd68('0x12'),auth[_0xdd68('0x8')](),interaction[_0xdd68('0x13')]('mail',_0xdd68('0x14')),controller[_0xdd68('0x15')]);router['put']('/:id',auth[_0xdd68('0x8')](),interaction[_0xdd68('0x13')](_0xdd68('0x16'),_0xdd68('0x17')),controller['update']);router[_0xdd68('0x18')](_0xdd68('0xa'),auth[_0xdd68('0x8')](),interaction['tracked'](_0xdd68('0x16'),_0xdd68('0x19')),controller[_0xdd68('0x1a')]);router[_0xdd68('0x18')](_0xdd68('0x12'),auth[_0xdd68('0x8')](),controller['removeTags']);module[_0xdd68('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index cd79b2a..ade40b1 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 _0xa063=['out','iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa063,0x199));var _0x3a06=function(_0x220a20,_0x4e9f33){_0x220a20=_0x220a20-0x0;var _0x4a0a48=_0xa063[_0x220a20];return _0x4a0a48;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x3a06('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3a06('0x1')]},'disposition':{'type':Sequelize[_0x3a06('0x2')]},'note':{'type':Sequelize[_0x3a06('0x2')]},'inReplyTo':{'type':Sequelize[_0x3a06('0x2')](0x1fe)},'to':{'type':Sequelize[_0x3a06('0x2')]},'cc':{'type':Sequelize[_0x3a06('0x3')](_0x3a06('0x4'))},'subject':{'type':Sequelize[_0x3a06('0x3')]()},'attach':{'type':Sequelize[_0x3a06('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3a06('0x1')]},'substatus':{'type':Sequelize[_0x3a06('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x3a06('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3a06('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x3a06('0x6')]('in',_0x3a06('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3a06('0x3')]('long')},'lastMsgText':{'type':Sequelize[_0x3a06('0x3')](_0x3a06('0x4'))}}; \ No newline at end of file +var _0x5caa=['TEXT','ENUM','out','long','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x23388a,_0x56de05){var _0x1bda46=function(_0x39a1c3){while(--_0x39a1c3){_0x23388a['push'](_0x23388a['shift']());}};_0x1bda46(++_0x56de05);}(_0x5caa,0x1bd));var _0xa5ca=function(_0x5fe69a,_0x5484f5){_0x5fe69a=_0x5fe69a-0x0;var _0x3f1aee=_0x5caa[_0x5fe69a];return _0x3f1aee;};'use strict';var Sequelize=require(_0xa5ca('0x0'));var iconv=require('iconv');module[_0xa5ca('0x1')]={'closed':{'type':Sequelize[_0xa5ca('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa5ca('0x3')]},'disposition':{'type':Sequelize[_0xa5ca('0x4')]},'note':{'type':Sequelize[_0xa5ca('0x4')]},'inReplyTo':{'type':Sequelize[_0xa5ca('0x4')](0x1fe)},'to':{'type':Sequelize[_0xa5ca('0x4')]},'cc':{'type':Sequelize[_0xa5ca('0x5')]('long')},'subject':{'type':Sequelize[_0xa5ca('0x5')]()},'attach':{'type':Sequelize[_0xa5ca('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa5ca('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa5ca('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa5ca('0x6')]('in',_0xa5ca('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa5ca('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa5ca('0x6')]('in',_0xa5ca('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xa5ca('0x5')](_0xa5ca('0x8'))},'lastMsgText':{'type':Sequelize[_0xa5ca('0x5')](_0xa5ca('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 529feea..8c61d4d 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x3d1ac8,_0x10dcac){var _0x297ce2=function(_0x551520){while(--_0x551520){_0x3d1ac8['push'](_0x3d1ac8['shift']());}};_0x297ce2(++_0x10dcac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0xc9b00f,_0x28733b){var _0x37fedd=function(_0x5a3868){while(--_0x5a3868){_0xc9b00f['push'](_0xc9b00f['shift']());}};_0x37fedd(++_0x28733b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5bcc682..34ab72b 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 _0xe4ae=['setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xe4ae,0xdf));var _0xee4a=function(_0x279ebb,_0x2833a0){_0x279ebb=_0x279ebb-0x0;var _0x47fe5b=_0xe4ae[_0x279ebb];return _0x47fe5b;};'use strict';var EventEmitter=require(_0xee4a('0x0'));var MailInteraction=require(_0xee4a('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xee4a('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xee4a('0x2')](0x0);var events={'afterCreate':_0xee4a('0x3'),'afterUpdate':_0xee4a('0x4'),'afterDestroy':_0xee4a('0x5')};function emitEvent(_0x3d2ea1){return function(_0x21397e,_0x12c6bf,_0x3db01d){_0x21397e['getUsers']({'attributes':['id'],'raw':!![]})[_0xee4a('0x6')](function(_0x3a2216){_0x21397e[_0xee4a('0x7')](_0xee4a('0x8'),_0x3a2216[_0xee4a('0x9')](function(_0x44a3cf){return{'id':_0x44a3cf['id']};}));return MailMessage[_0xee4a('0xa')]({'where':{'MailInteractionId':_0x21397e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee4a('0x6')](function(_0x370dbb){_0x21397e['setDataValue'](_0xee4a('0xb'),_0x370dbb['length']);MailInteractionEvents[_0xee4a('0xc')](_0x3d2ea1+':'+_0x21397e['id'],_0x21397e);MailInteractionEvents[_0xee4a('0xc')](_0x3d2ea1,_0x21397e);_0x3db01d(null);})[_0xee4a('0xd')](_0x3db01d(null));};}for(var e in events){if(events[_0xee4a('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x120d=['getUsers','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x596057,_0x116bc4){var _0x184781=function(_0x463716){while(--_0x463716){_0x596057['push'](_0x596057['shift']());}};_0x184781(++_0x116bc4);}(_0x120d,0x136));var _0xd120=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0x120d[_0x3c2863];return _0x2c3d27;};'use strict';var EventEmitter=require(_0xd120('0x0'));var MailInteraction=require(_0xd120('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xd120('0x1'))['db'][_0xd120('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd120('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd120('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6076c8){return function(_0x42dde4,_0x733ff6,_0x10452d){_0x42dde4[_0xd120('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5ebdd3){_0x42dde4['setDataValue'](_0xd120('0x6'),_0x5ebdd3['map'](function(_0x3ee48e){return{'id':_0x3ee48e['id']};}));return MailMessage[_0xd120('0x7')]({'where':{'MailInteractionId':_0x42dde4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e75f2){_0x42dde4[_0xd120('0x8')](_0xd120('0x9'),_0x4e75f2['length']);MailInteractionEvents[_0xd120('0xa')](_0x6076c8+':'+_0x42dde4['id'],_0x42dde4);MailInteractionEvents[_0xd120('0xa')](_0x6076c8,_0x42dde4);_0x10452d(null);})[_0xd120('0xb')](_0x10452d(null));};}for(var e in events){if(events[_0xd120('0xc')](e)){var event=events[e];MailInteraction[_0xd120('0xd')](e,emitEvent(event));}}module[_0xd120('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 03faa3b..e697b6d 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x200d31,_0xf84c23){var _0x418c3c=function(_0x14d384){while(--_0x14d384){_0x200d31['push'](_0x200d31['shift']());}};_0x418c3c(++_0xf84c23);}(_0x34e8,0x12c));var _0x834e=function(_0xd4f856,_0x32dc1e){_0xd4f856=_0xd4f856-0x0;var _0x5ab0ad=_0x34e8[_0xd4f856];return _0x5ab0ad;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file +var _0xedd9=['subject','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','get','update','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','MailInteraction','fti_mail_interactions'];(function(_0x2bac92,_0x5db711){var _0x27b424=function(_0x27b7c9){while(--_0x27b7c9){_0x2bac92['push'](_0x2bac92['shift']());}};_0x27b424(++_0x5db711);}(_0xedd9,0xfc));var _0x9edd=function(_0x509e26,_0x4765c8){_0x509e26=_0x509e26-0x0;var _0xa75936=_0xedd9[_0x509e26];return _0xa75936;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9edd('0xb'),'fields':[_0x9edd('0xc'),'to'],'type':_0x9edd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3280fd,_0x49d5e3,_0x494a24){if(_0x3280fd['substatus']){_0x3280fd[_0x9edd('0xe')]=moment()[_0x9edd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3280fd[_0x9edd('0x10')]){_0x3280fd[_0x9edd('0x11')]=moment()['format'](_0x9edd('0x12'));}_0x494a24(null,_0x49d5e3);},'beforeUpdate':function(_0x1b73d1,_0x25e64c,_0xfd544a){if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x14'))){_0x1b73d1[_0x9edd('0xe')]=_0x1b73d1[_0x9edd('0x14')]?moment()['format'](_0x9edd('0x12')):null;}if(_0x1b73d1[_0x9edd('0x13')](_0x9edd('0x10'))){_0x1b73d1[_0x9edd('0x11')]=moment()[_0x9edd('0xf')](_0x9edd('0x12'));_0x1b73d1[_0x9edd('0x14')]=null;_0x1b73d1[_0x9edd('0xe')]=null;}_0xfd544a(null,_0x1b73d1);},'afterUpdate':function(_0x4ea60f,_0x5f5bf4,_0x448996){var _0x449cee=_0x268f9e['models'];var _0x1b54c0=_0x4ea60f[_0x9edd('0x15')]({'plain':!![]});if(_0x1b54c0[_0x9edd('0x10')]){return _0x449cee['MailMessage'][_0x9edd('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x1b54c0['id']}})['then'](function(){_0x448996();})[_0x9edd('0x17')](function(_0x1083e4){_0x448996(_0x1083e4);});}else{_0x448996();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ba17f7c..25f29ba 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 _0x2fe3=['catch','MailInteraction','update','options','raw','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','body','omit','ids','spread','AddTags','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2fe3,0x87));var _0x32fe=function(_0x3d2ef5,_0x7cf5ae){_0x3d2ef5=_0x3d2ef5-0x0;var _0x346c27=_0x2fe3[_0x3d2ef5];return _0x346c27;};'use strict';var _=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32fe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32fe('0x4'));var config=require(_0x32fe('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32fe('0x6')][_0x32fe('0x7')]({'port':0x232a});config[_0x32fe('0x8')]=_[_0x32fe('0x9')](config[_0x32fe('0x8')],{'host':_0x32fe('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fe('0x8')]));require(_0x32fe('0xb'))[_0x32fe('0xc')](socket);function respondWithRpcPromise(_0x2b9bb7,_0x47abd9,_0x5448d8){return new BPromise(function(_0x3b2d24,_0x37b3ae){return client[_0x32fe('0xd')](_0x2b9bb7,_0x5448d8)[_0x32fe('0xe')](function(_0x501ddd){logger[_0x32fe('0xf')]('MailInteraction,\x20%s,\x20%s',_0x47abd9,'request\x20sent');logger[_0x32fe('0x10')](_0x32fe('0x11'),_0x47abd9,_0x32fe('0x12'),JSON[_0x32fe('0x13')](_0x501ddd));if(_0x501ddd[_0x32fe('0x14')]){if(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x15')]===0x1f4){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);return _0x37b3ae(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd['error']['message']);return _0x3b2d24(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}else{logger['info'](_0x32fe('0x16'),_0x47abd9,_0x32fe('0x12'));_0x3b2d24(_0x501ddd[_0x32fe('0x18')]['message']);}})[_0x32fe('0x19')](function(_0xb7ac89){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0xb7ac89);_0x37b3ae(_0xb7ac89);});});}exports['UpdateMailInteraction']=function(_0x26a555){var _0x4881cf=this;return new Promise(function(_0xd5a771,_0x2702ad){return db[_0x32fe('0x1a')][_0x32fe('0x1b')](_0x26a555['body'],{'raw':_0x26a555['options']?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26a555[_0x32fe('0x1c')]?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1e')]||null:null,'attributes':_0x26a555[_0x32fe('0x1c')]?_0x26a555[_0x32fe('0x1c')][_0x32fe('0x1f')]||null:null,'limit':_0x26a555['options']?_0x26a555[_0x32fe('0x1c')]['limit']||null:null})[_0x32fe('0xe')](function(_0x362181){logger['info'](_0x32fe('0x20'),_0x26a555);logger[_0x32fe('0x10')](_0x32fe('0x20'),_0x26a555,JSON[_0x32fe('0x13')](_0x362181));_0xd5a771(_0x362181);})['catch'](function(_0x50e340){logger[_0x32fe('0x14')]('UpdateMailInteraction',_0x50e340['message'],_0x26a555);_0x2702ad(_0x4881cf[_0x32fe('0x14')](0x1f4,_0x50e340['message']));});});};exports[_0x32fe('0x21')]=function(_0x9c9933){return new Promise(function(_0x1f67c9,_0x382242){return db['MailInteraction'][_0x32fe('0x22')]({'where':_0x9c9933['options']?_0x9c9933[_0x32fe('0x1c')]['where']||null:null})['then'](function(_0xbee08){if(_0xbee08){return _0xbee08['addTags'](_0x9c9933[_0x32fe('0x23')]['ids'],_[_0x32fe('0x24')](_0x9c9933[_0x32fe('0x23')],[_0x32fe('0x25'),'id'])||{});}})[_0x32fe('0x26')](function(_0x41b94f){logger[_0x32fe('0xf')](_0x32fe('0x27'),_0x9c9933);logger[_0x32fe('0x10')](_0x32fe('0x27'),_0x9c9933,JSON['stringify'](_0x41b94f));_0x1f67c9(_0x41b94f);})[_0x32fe('0x19')](function(_0x287423){logger[_0x32fe('0x14')]('AddTags',_0x287423[_0x32fe('0x17')],_0x9c9933);_0x382242(_this[_0x32fe('0x14')](0x1f4,_0x287423[_0x32fe('0x17')]));});});}; \ No newline at end of file +var _0x9cff=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','options','attributes','AddTagsToMailInteraction','find','where','ids','omit','body','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xfca659,_0x3b94a5){var _0x14fc17=function(_0x45a7ec){while(--_0x45a7ec){_0xfca659['push'](_0xfca659['shift']());}};_0x14fc17(++_0x3b94a5);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x3a81ae,_0x569239){_0x3a81ae=_0x3a81ae-0x0;var _0x3bb70a=_0x9cff[_0x3a81ae];return _0x3bb70a;};'use strict';var _=require('lodash');var util=require(_0xf9cf('0x0'));var moment=require(_0xf9cf('0x1'));var BPromise=require(_0xf9cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9cf('0x3'));var db=require(_0xf9cf('0x4'))['db'];var utils=require(_0xf9cf('0x5'));var logger=require('../../config/logger')(_0xf9cf('0x6'));var config=require(_0xf9cf('0x7'));var jayson=require(_0xf9cf('0x8'));var client=jayson[_0xf9cf('0x9')][_0xf9cf('0xa')]({'port':0x232a});config[_0xf9cf('0xb')]=_[_0xf9cf('0xc')](config[_0xf9cf('0xb')],{'host':_0xf9cf('0xd'),'port':0x18eb});var socket=require(_0xf9cf('0xe'))(new Redis(config[_0xf9cf('0xb')]));require('./mailInteraction.socket')[_0xf9cf('0xf')](socket);function respondWithRpcPromise(_0x399bc9,_0x59e86c,_0x41bb03){return new BPromise(function(_0x4ecca5,_0x5bb6bf){return client[_0xf9cf('0x10')](_0x399bc9,_0x41bb03)[_0xf9cf('0x11')](function(_0x491a3a){logger[_0xf9cf('0x12')]('MailInteraction,\x20%s,\x20%s',_0x59e86c,_0xf9cf('0x13'));logger['debug'](_0xf9cf('0x14'),_0x59e86c,'request\x20sent',JSON[_0xf9cf('0x15')](_0x491a3a));if(_0x491a3a[_0xf9cf('0x16')]){if(_0x491a3a[_0xf9cf('0x16')][_0xf9cf('0x17')]===0x1f4){logger[_0xf9cf('0x16')](_0xf9cf('0x18'),_0x59e86c,_0x491a3a[_0xf9cf('0x16')]['message']);return _0x5bb6bf(_0x491a3a[_0xf9cf('0x16')][_0xf9cf('0x19')]);}logger[_0xf9cf('0x16')](_0xf9cf('0x18'),_0x59e86c,_0x491a3a[_0xf9cf('0x16')][_0xf9cf('0x19')]);return _0x4ecca5(_0x491a3a[_0xf9cf('0x16')][_0xf9cf('0x19')]);}else{logger[_0xf9cf('0x12')](_0xf9cf('0x18'),_0x59e86c,_0xf9cf('0x13'));_0x4ecca5(_0x491a3a[_0xf9cf('0x1a')][_0xf9cf('0x19')]);}})[_0xf9cf('0x1b')](function(_0x6008c4){logger[_0xf9cf('0x16')](_0xf9cf('0x18'),_0x59e86c,_0x6008c4);_0x5bb6bf(_0x6008c4);});});}exports[_0xf9cf('0x1c')]=function(_0x537df5){var _0x25f36f=this;return new Promise(function(_0x4b304b,_0x47fe4a){return db[_0xf9cf('0x1d')]['update'](_0x537df5['body'],{'raw':_0x537df5[_0xf9cf('0x1e')]?_0x537df5[_0xf9cf('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537df5[_0xf9cf('0x1e')]?_0x537df5[_0xf9cf('0x1e')]['where']||null:null,'attributes':_0x537df5[_0xf9cf('0x1e')]?_0x537df5['options'][_0xf9cf('0x1f')]||null:null,'limit':_0x537df5['options']?_0x537df5['options']['limit']||null:null})[_0xf9cf('0x11')](function(_0x4d8e9a){logger[_0xf9cf('0x12')](_0xf9cf('0x1c'),_0x537df5);logger['debug'](_0xf9cf('0x1c'),_0x537df5,JSON[_0xf9cf('0x15')](_0x4d8e9a));_0x4b304b(_0x4d8e9a);})['catch'](function(_0x22bdd1){logger['error']('UpdateMailInteraction',_0x22bdd1['message'],_0x537df5);_0x47fe4a(_0x25f36f[_0xf9cf('0x16')](0x1f4,_0x22bdd1['message']));});});};exports[_0xf9cf('0x20')]=function(_0x4a6828){return new Promise(function(_0x168869,_0x3fcb3a){return db['MailInteraction'][_0xf9cf('0x21')]({'where':_0x4a6828['options']?_0x4a6828[_0xf9cf('0x1e')][_0xf9cf('0x22')]||null:null})[_0xf9cf('0x11')](function(_0xef64ed){if(_0xef64ed){return _0xef64ed['addTags'](_0x4a6828['body'][_0xf9cf('0x23')],_[_0xf9cf('0x24')](_0x4a6828[_0xf9cf('0x25')],['ids','id'])||{});}})[_0xf9cf('0x26')](function(_0x569dc2){logger[_0xf9cf('0x12')]('AddTags',_0x4a6828);logger['debug'](_0xf9cf('0x27'),_0x4a6828,JSON[_0xf9cf('0x15')](_0x569dc2));_0x168869(_0x569dc2);})[_0xf9cf('0x1b')](function(_0x2d5f18){logger[_0xf9cf('0x16')](_0xf9cf('0x27'),_0x2d5f18['message'],_0x4a6828);_0x3fcb3a(_this[_0xf9cf('0x16')](0x1f4,_0x2d5f18['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1cffbbd..84d5271 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 _0xab46=['removeListener','register','length','save','update','emit'];(function(_0x32fe12,_0x32f64d){var _0x5346d4=function(_0x28ad08){while(--_0x28ad08){_0x32fe12['push'](_0x32fe12['shift']());}};_0x5346d4(++_0x32f64d);}(_0xab46,0xff));var _0x6ab4=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0xab46[_0xf46bd9];return _0x2763c3;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x6ab4('0x0'),'remove',_0x6ab4('0x1')];function createListener(_0x25907d,_0xce32be){return function(_0x45c9c2){_0xce32be[_0x6ab4('0x2')](_0x25907d,_0x45c9c2);};}function removeListener(_0x5678f2,_0x133bf0){return function(){MailInteractionEvents[_0x6ab4('0x3')](_0x5678f2,_0x133bf0);};}exports[_0x6ab4('0x4')]=function(_0x410a91){for(var _0x68f189=0x0,_0x4faa7f=events[_0x6ab4('0x5')];_0x68f189<_0x4faa7f;_0x68f189++){var _0x5e28e4=events[_0x68f189];var _0x57e1eb=createListener('mailInteraction:'+_0x5e28e4,_0x410a91);MailInteractionEvents['on'](_0x5e28e4,_0x57e1eb);}}; \ No newline at end of file +var _0xc577=['length','mailInteraction:','./mailInteraction.events','remove','update','removeListener','register'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xc577,0x64));var _0x7c57=function(_0x12ae97,_0x385f36){_0x12ae97=_0x12ae97-0x0;var _0xb50847=_0xc577[_0x12ae97];return _0xb50847;};'use strict';var MailInteractionEvents=require(_0x7c57('0x0'));var events=['save',_0x7c57('0x1'),_0x7c57('0x2')];function createListener(_0x37ae86,_0x463feb){return function(_0x38e7cd){_0x463feb['emit'](_0x37ae86,_0x38e7cd);};}function removeListener(_0x295415,_0x16cc36){return function(){MailInteractionEvents[_0x7c57('0x3')](_0x295415,_0x16cc36);};}exports[_0x7c57('0x4')]=function(_0x470a8e){for(var _0x2df251=0x0,_0x436b77=events[_0x7c57('0x5')];_0x2df251<_0x436b77;_0x2df251++){var _0x1bdd0=events[_0x2df251];var _0x6fce9=createListener(_0x7c57('0x6')+_0x1bdd0,_0x470a8e);MailInteractionEvents['on'](_0x1bdd0,_0x6fce9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f3fd993..f0c1c07 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 _0x7da7=['./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7da7,0x10d));var _0x77da=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x7da7[_0x29771f];return _0x279baf;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['post']('/',auth[_0x77da('0x7')](),interaction[_0x77da('0x10')](_0x77da('0x11'),_0x77da('0x12')),controller['create']);router[_0x77da('0x13')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller['update']);router['put'](_0x77da('0x14'),auth[_0x77da('0x7')](),controller['accept']);router[_0x77da('0x13')](_0x77da('0x15'),auth[_0x77da('0x7')](),controller[_0x77da('0x16')]);router['delete'](_0x77da('0xc'),auth['isAuthenticated'](),controller[_0x77da('0x17')]);module[_0x77da('0x18')]=router; \ No newline at end of file +var _0xf3cd=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0x1ba3b5,_0x46b16a){var _0x25f024=function(_0xe07935){while(--_0xe07935){_0x1ba3b5['push'](_0x1ba3b5['shift']());}};_0x25f024(++_0x46b16a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x58418a,_0x3d9f06){_0x58418a=_0x58418a-0x0;var _0x2716bf=_0xf3cd[_0x58418a];return _0x2716bf;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0x11')]('/',auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x12')](_0xdf3c('0x13'),_0xdf3c('0x14')),controller[_0xdf3c('0x15')]);router[_0xdf3c('0x16')]('/:id',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x17')]);router[_0xdf3c('0x16')](_0xdf3c('0x18'),auth['isAuthenticated'](),controller[_0xdf3c('0x19')]);router[_0xdf3c('0x16')](_0xdf3c('0x1a'),auth['isAuthenticated'](),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1c')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1d')]);module[_0xdf3c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 05f22a4..e08881d 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 _0xf03a=['medium','BOOLEAN','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x366c8d,_0x2e1eb9){var _0x146a96=function(_0x259ddd){while(--_0x259ddd){_0x366c8d['push'](_0x366c8d['shift']());}};_0x146a96(++_0x2e1eb9);}(_0xf03a,0x1a0));var _0xaf03=function(_0x5bd99,_0x2f3e48){_0x5bd99=_0x5bd99-0x0;var _0x313375=_0xf03a[_0x5bd99];return _0x313375;};'use strict';var Sequelize=require('sequelize');var _=require(_0xaf03('0x0'));module[_0xaf03('0x1')]={'body':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xaf03('0x4'))},'read':{'type':Sequelize[_0xaf03('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaf03('0x6')),'defaultValue':_0xaf03('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf03('0x7')](0x1fe)},'from':{'type':Sequelize[_0xaf03('0x7')]},'to':{'type':Sequelize['TEXT'](_0xaf03('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xaf03('0x3'))},'bcc':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))},'subject':{'type':Sequelize[_0xaf03('0x2')]},'sentAt':{'type':Sequelize[_0xaf03('0x8')]},'attach':{'type':Sequelize[_0xaf03('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf03('0x8')]},'originTo':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))},'originCc':{'type':Sequelize[_0xaf03('0x2')](_0xaf03('0x3'))}}; \ No newline at end of file +var _0xb923=['sequelize','lodash','exports','long','TEXT','out','STRING','DATE','INTEGER'];(function(_0x52c289,_0x3de86d){var _0x2fc95c=function(_0x223311){while(--_0x223311){_0x52c289['push'](_0x52c289['shift']());}};_0x2fc95c(++_0x3de86d);}(_0xb923,0xa2));var _0x3b92=function(_0x1d4bb9,_0x2f0617){_0x1d4bb9=_0x1d4bb9-0x0;var _0x16cf96=_0xb923[_0x1d4bb9];return _0x16cf96;};'use strict';var Sequelize=require(_0x3b92('0x0'));var _=require(_0x3b92('0x1'));module[_0x3b92('0x2')]={'body':{'type':Sequelize['TEXT'](_0x3b92('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3b92('0x4')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3b92('0x5')),'defaultValue':_0x3b92('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b92('0x6')](0x1fe)},'from':{'type':Sequelize[_0x3b92('0x6')]},'to':{'type':Sequelize[_0x3b92('0x4')](_0x3b92('0x3'))},'cc':{'type':Sequelize[_0x3b92('0x4')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x3b92('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x3b92('0x7')]},'attach':{'type':Sequelize[_0x3b92('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3b92('0x7')]},'originTo':{'type':Sequelize[_0x3b92('0x4')](_0x3b92('0x3'))},'originCc':{'type':Sequelize[_0x3b92('0x4')](_0x3b92('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1bd4249..5edd901 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 _0x3de2=['sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','destroy','stack','name','send','index','map','MailMessage','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','options','count','includeAll','rows','show','params','rawAttributes','include','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','List','CmContact','MailServerOut','Smtp','isNil','port','secure','authentication','pass','service','user','attachments','join','root','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','../../config/logger','mail-interactions','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','writeFileSync','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch'];(function(_0x2bda4d,_0x139e16){var _0x8fec4c=function(_0x23f91a){while(--_0x23f91a){_0x2bda4d['push'](_0x2bda4d['shift']());}};_0x8fec4c(++_0x139e16);}(_0x3de2,0x79));var _0x23de=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x3de2[_0x4f9b18];return _0x29f20c;};'use strict';var pdf=require(_0x23de('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x23de('0x1'));var zipdir=require(_0x23de('0x2'));var jsonpatch=require(_0x23de('0x3'));var rp=require(_0x23de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23de('0x5'));var util=require(_0x23de('0x6'));var path=require(_0x23de('0x7'));var sox=require(_0x23de('0x8'));var csv=require('to-csv');var ejs=require(_0x23de('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x23de('0xa'));var crypto=require(_0x23de('0xb'));var jsforce=require(_0x23de('0xc'));var deskjs=require(_0x23de('0xd'));var toCsv=require(_0x23de('0xe'));var querystring=require(_0x23de('0xf'));var Papa=require(_0x23de('0x10'));var Redis=require('ioredis');var authService=require(_0x23de('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23de('0x12'));var hardwareService=require(_0x23de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x23de('0x14'));var config=require('../../config/environment');var db=require(_0x23de('0x15'))['db'];config['redis']=_[_0x23de('0x16')](config[_0x23de('0x17')],{'host':_0x23de('0x18'),'port':0x18eb});var socket=require(_0x23de('0x19'))(new Redis(config[_0x23de('0x17')]));require(_0x23de('0x1a'))[_0x23de('0x1b')](socket);var jayson=require(_0x23de('0x1c'));var client=jayson[_0x23de('0x1d')][_0x23de('0x1e')]({'port':0x232c});var client9003=jayson[_0x23de('0x1d')][_0x23de('0x1e')]({'port':0x232b});var client9002=jayson['client'][_0x23de('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x19f1e9,_0x3c4e05,_0x2bcae4){if(_0x2bcae4){var _0x5edfab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5edfab['test'](_0x3c4e05)){return _0x19f1e9;}else{throw new db[(_0x23de('0x1f'))][(_0x23de('0x20'))](_0x23de('0x21'));}}else{return _0x19f1e9;}}function respondWithRpcPromise(_0x26cf3b,_0x20de0d,_0x25e0a7,_0x2c60f1){return new BPromise(function(_0x41739f,_0x48acea){var _0x145ae6=_0x2c60f1||client;return _0x145ae6['request'](_0x26cf3b,_0x25e0a7)[_0x23de('0x22')](function(_0x4b325a){logger['info']('MailMessage,\x20%s,\x20%s',_0x20de0d,_0x23de('0x23'));logger[_0x23de('0x24')](_0x23de('0x25'),_0x20de0d,_0x23de('0x23'),JSON[_0x23de('0x26')](_0x4b325a));if(_0x4b325a[_0x23de('0x27')]){if(_0x4b325a[_0x23de('0x27')][_0x23de('0x28')]===0x1f4){logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x4b325a[_0x23de('0x27')]['message']);return _0x48acea(_0x4b325a['error'][_0x23de('0x2a')]);}logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x4b325a[_0x23de('0x27')][_0x23de('0x2a')]);return _0x41739f(_0x4b325a[_0x23de('0x27')]['message']);}else{logger[_0x23de('0x2b')]('MailMessage,\x20%s,\x20%s',_0x20de0d,'request\x20sent');_0x41739f(_0x4b325a[_0x23de('0x2c')][_0x23de('0x2a')]);}})[_0x23de('0x2d')](function(_0x40e65e){logger[_0x23de('0x27')](_0x23de('0x29'),_0x20de0d,_0x40e65e);_0x48acea(_0x40e65e);});});}function respondWithStatusCode(_0x28f8bf,_0x93c31b){_0x93c31b=_0x93c31b||0xcc;return function(_0x347bd2){if(_0x347bd2){return _0x28f8bf[_0x23de('0x2e')](_0x93c31b);}return _0x28f8bf[_0x23de('0x2f')](_0x93c31b)[_0x23de('0x30')]();};}function respondWithResult(_0x48557b,_0x530733){_0x530733=_0x530733||0xc8;return function(_0x5cd8fd){if(_0x5cd8fd){return _0x48557b['status'](_0x530733)['json'](_0x5cd8fd);}};}function respondWithFilteredResult(_0x1d7d9f,_0x2d270a){return function(_0x40d7a7){if(_0x40d7a7){var _0xa3650d=_0x40d7a7['count'],_0x3041d8=_0x2d270a[_0x23de('0x31')],_0x5565f5=_0x2d270a[_0x23de('0x31')]+_0x2d270a[_0x23de('0x32')],_0xbd230a;if(_0x5565f5>=_0xa3650d){_0x5565f5=_0xa3650d;_0xbd230a=0xc8;}else{_0xbd230a=0xce;}_0x1d7d9f[_0x23de('0x2f')](_0xbd230a);return _0x1d7d9f['set'](_0x23de('0x33'),_0x3041d8+'-'+_0x5565f5+'/'+_0xa3650d)[_0x23de('0x34')](_0x40d7a7);}return null;};}function patchUpdates(_0x1316a6){return function(_0x6b2383){try{jsonpatch[_0x23de('0x35')](_0x6b2383,_0x1316a6,!![]);}catch(_0x48c004){return BPromise[_0x23de('0x36')](_0x48c004);}return _0x6b2383[_0x23de('0x37')]();};}function saveUpdates(_0x1cae51,_0x30a217){return function(_0x520705){if(_0x520705){return _0x520705['update'](_0x1cae51)[_0x23de('0x22')](function(_0x3966b4){return _0x3966b4;});}return null;};}function removeEntity(_0x58f09d,_0x4e79b7){return function(_0x463ee5){if(_0x463ee5){return _0x463ee5[_0x23de('0x38')]()[_0x23de('0x22')](function(){_0x58f09d[_0x23de('0x2f')](0xcc)[_0x23de('0x30')]();});}};}function handleEntityNotFound(_0x32e680,_0x3d87b8){return function(_0x1cb238){if(!_0x1cb238){_0x32e680[_0x23de('0x2e')](0x194);}return _0x1cb238;};}function handleError(_0x1dd131,_0x1607dc){_0x1607dc=_0x1607dc||0x1f4;return function(_0x3926e3){logger['error'](_0x3926e3[_0x23de('0x39')]);if(_0x3926e3[_0x23de('0x3a')]){delete _0x3926e3[_0x23de('0x3a')];}_0x1dd131[_0x23de('0x2f')](_0x1607dc)[_0x23de('0x3b')](_0x3926e3);};}exports[_0x23de('0x3c')]=function(_0x2dedf4,_0x1e347f){var _0x25a002={},_0x1a6149={},_0x2cc6da={'count':0x0,'rows':[]};var _0x517c69=_[_0x23de('0x3d')](db[_0x23de('0x3e')]['rawAttributes'],function(_0x576e02){return{'name':_0x576e02['fieldName'],'type':_0x576e02['type']['key']};});_0x1a6149[_0x23de('0x3f')]=_[_0x23de('0x3d')](_0x517c69,_0x23de('0x3a'));_0x1a6149['query']=_[_0x23de('0x40')](_0x2dedf4[_0x23de('0x41')]);_0x1a6149['filters']=_[_0x23de('0x42')](_0x1a6149[_0x23de('0x3f')],_0x1a6149[_0x23de('0x41')]);_0x25a002[_0x23de('0x43')]=_[_0x23de('0x42')](_0x1a6149[_0x23de('0x3f')],qs[_0x23de('0x44')](_0x2dedf4[_0x23de('0x41')][_0x23de('0x44')]));_0x25a002[_0x23de('0x43')]=_0x25a002[_0x23de('0x43')][_0x23de('0x45')]?_0x25a002[_0x23de('0x43')]:_0x1a6149['model'];if(!_0x2dedf4[_0x23de('0x41')]['hasOwnProperty'](_0x23de('0x46'))){_0x25a002['limit']=qs[_0x23de('0x32')](_0x2dedf4[_0x23de('0x41')]['limit']);_0x25a002['offset']=qs[_0x23de('0x31')](_0x2dedf4['query'][_0x23de('0x31')]);}_0x25a002[_0x23de('0x47')]=qs[_0x23de('0x48')](_0x2dedf4['query'][_0x23de('0x48')]);_0x25a002['where']=qs[_0x23de('0x49')](_[_0x23de('0x4a')](_0x2dedf4[_0x23de('0x41')],_0x1a6149[_0x23de('0x49')]),_0x517c69);if(_0x2dedf4[_0x23de('0x41')][_0x23de('0x4b')]){_0x25a002[_0x23de('0x4c')]=_[_0x23de('0x4d')](_0x25a002['where'],{'$or':_[_0x23de('0x3d')](_0x517c69,function(_0x35371a){if(_0x35371a[_0x23de('0x4e')]!=='VIRTUAL'){var _0x5fe57={};_0x5fe57[_0x35371a[_0x23de('0x3a')]]={'$like':'%'+_0x2dedf4['query'][_0x23de('0x4b')]+'%'};return _0x5fe57;}})});}_0x25a002=_[_0x23de('0x4d')]({},_0x25a002,_0x2dedf4[_0x23de('0x4f')]);var _0x11d027={'where':_0x25a002[_0x23de('0x4c')]};return db[_0x23de('0x3e')][_0x23de('0x50')](_0x11d027)[_0x23de('0x22')](function(_0x9ee170){_0x2cc6da['count']=_0x9ee170;if(_0x2dedf4['query'][_0x23de('0x51')]){_0x25a002['include']=[{'all':!![]}];}return db[_0x23de('0x3e')]['findAll'](_0x25a002);})['then'](function(_0x5842ae){_0x2cc6da[_0x23de('0x52')]=_0x5842ae;return _0x2cc6da;})['then'](respondWithFilteredResult(_0x1e347f,_0x25a002))[_0x23de('0x2d')](handleError(_0x1e347f,null));};exports[_0x23de('0x53')]=function(_0x3d9bde,_0x23c0bc){var _0x237637={'raw':!![],'where':{'id':_0x3d9bde[_0x23de('0x54')]['id']}},_0x1ed821={};_0x1ed821[_0x23de('0x3f')]=_[_0x23de('0x40')](db[_0x23de('0x3e')][_0x23de('0x55')]);_0x1ed821[_0x23de('0x41')]=_[_0x23de('0x40')](_0x3d9bde[_0x23de('0x41')]);_0x1ed821[_0x23de('0x49')]=_[_0x23de('0x42')](_0x1ed821[_0x23de('0x3f')],_0x1ed821[_0x23de('0x41')]);_0x237637[_0x23de('0x43')]=_[_0x23de('0x42')](_0x1ed821[_0x23de('0x3f')],qs[_0x23de('0x44')](_0x3d9bde['query'][_0x23de('0x44')]));_0x237637[_0x23de('0x43')]=_0x237637[_0x23de('0x43')]['length']?_0x237637[_0x23de('0x43')]:_0x1ed821[_0x23de('0x3f')];if(_0x3d9bde[_0x23de('0x41')][_0x23de('0x51')]){_0x237637[_0x23de('0x56')]=[{'all':!![]}];}_0x237637=_['merge']({},_0x237637,_0x3d9bde[_0x23de('0x4f')]);return db[_0x23de('0x3e')][_0x23de('0x57')](_0x237637)[_0x23de('0x22')](handleEntityNotFound(_0x23c0bc,null))['then'](respondWithResult(_0x23c0bc,null))[_0x23de('0x2d')](handleError(_0x23c0bc,null));};exports['update']=function(_0xe22f10,_0x5d4aed){if(_0xe22f10[_0x23de('0x58')]['id']){delete _0xe22f10[_0x23de('0x58')]['id'];}return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0xe22f10['params']['id']}})[_0x23de('0x22')](handleEntityNotFound(_0x5d4aed,null))[_0x23de('0x22')](saveUpdates(_0xe22f10[_0x23de('0x58')],null))[_0x23de('0x22')](respondWithResult(_0x5d4aed,null))[_0x23de('0x2d')](handleError(_0x5d4aed,null));};exports[_0x23de('0x38')]=function(_0x33d8de,_0x27cc61){return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0x33d8de[_0x23de('0x54')]['id']}})[_0x23de('0x22')](handleEntityNotFound(_0x27cc61,null))[_0x23de('0x22')](removeEntity(_0x27cc61,null))[_0x23de('0x2d')](handleError(_0x27cc61,null));};exports['describe']=function(_0xd98eb8,_0x43cb19){return db['MailMessage'][_0x23de('0x59')]()[_0x23de('0x22')](respondWithResult(_0x43cb19,null))[_0x23de('0x2d')](handleError(_0x43cb19,null));};exports[_0x23de('0x5a')]=function(_0x35e5e0,_0x4a8e0c){return db[_0x23de('0x3e')][_0x23de('0x5a')](_0x35e5e0[_0x23de('0x58')])[_0x23de('0x22')](function(_0x15e7c2){if(_0x15e7c2){if(_0x15e7c2[_0x23de('0x5b')]===_0x23de('0x5c')&&!_0x15e7c2[_0x23de('0x5d')]){var _0x57460d,_0x47f721,_0xa64e69;if(_0x35e5e0[_0x23de('0x58')]['to']){_0x47f721=_0x35e5e0[_0x23de('0x58')]['to'][_0x23de('0x5e')](',')[0x0];}return db['MailAccount'][_0x23de('0x5f')]({'where':{'id':_0x15e7c2[_0x23de('0x60')]},'include':[{'model':db['CmList'],'as':_0x23de('0x61'),'include':[{'model':db[_0x23de('0x62')],'as':'Contacts','where':{'email':_0x47f721},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x23de('0x63')],'as':_0x23de('0x64'),'raw':!![]}]})[_0x23de('0x22')](function(_0x478516){_0x57460d=_0x478516;if(_0x57460d&&_0x57460d[_0x23de('0x64')]){var _0x240f93={'tls':{'rejectUnauthorized':![]}};if(_[_0x23de('0x65')](_0x57460d[_0x23de('0x64')]['service'])){_0x240f93['host']=_0x57460d[_0x23de('0x64')]['host'];_0x240f93[_0x23de('0x66')]=_0x57460d[_0x23de('0x64')][_0x23de('0x66')];_0x240f93[_0x23de('0x67')]=_0x57460d[_0x23de('0x64')][_0x23de('0x67')];if(_0x57460d[_0x23de('0x64')][_0x23de('0x68')]){_0x240f93['auth']={'user':_0x57460d[_0x23de('0x64')]['user'],'pass':_0x57460d['Smtp'][_0x23de('0x69')]};}}else{_0x240f93[_0x23de('0x6a')]=_0x57460d[_0x23de('0x64')]['service'];_0x240f93['auth']={'user':_0x57460d[_0x23de('0x64')][_0x23de('0x6b')],'pass':_0x57460d['Smtp'][_0x23de('0x69')]};_0x240f93[_0x23de('0x67')]=_0x57460d['Smtp'][_0x23de('0x67')];}if(_0x35e5e0[_0x23de('0x58')]['attachments']&&_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x23de('0x45')]){for(var _0x5ecb50=0x0;_0x5ecb50<_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x23de('0x45')];_0x5ecb50+=0x1){_0x35e5e0['body'][_0x23de('0x6c')][_0x5ecb50]={'filename':_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x5ecb50][_0x23de('0x3a')],'path':path[_0x23de('0x6d')](config[_0x23de('0x6e')],'server/files/attachments',_0x35e5e0[_0x23de('0x58')][_0x23de('0x6c')][_0x5ecb50]['basename'])};}}_0xa64e69={'account':_0x240f93,'message':_0x35e5e0[_0x23de('0x58')]};return;}})[_0x23de('0x22')](function(){if(_0x57460d[_0x23de('0x61')]){if(_0x57460d['List'][_0x23de('0x6f')]['length']){return _0x57460d[_0x23de('0x61')][_0x23de('0x6f')][0x0];}else{return db['CmContact'][_0x23de('0x5a')](_[_0x23de('0x16')](_0x35e5e0[_0x23de('0x58')],{'firstName':_0x35e5e0['body']['to'],'email':_0x35e5e0[_0x23de('0x58')]['to'],'phone':_0x35e5e0['body']['to'],'ListId':_0x57460d[_0x23de('0x70')]}));}}else{throw new Error(_0x23de('0x71'));}})['then'](function(){if(_0xa64e69){return respondWithRpcPromise(_0x23de('0x72'),'sendMail',_0xa64e69,client9003)[_0x23de('0x22')](function(_0x44f14f){return _0x15e7c2['update']({'read':!![],'messageId':_0x44f14f[_0x23de('0x73')],'sentAt':moment()[_0x23de('0x74')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x23de('0x2d')](function(_0x448623){logger[_0x23de('0x27')]('%s',JSON['stringify'](_0x448623));return _0x15e7c2;});}return _0x15e7c2;});}return _0x15e7c2;}})['then'](respondWithResult(_0x4a8e0c,0xc9))[_0x23de('0x2d')](handleError(_0x4a8e0c,null));};var interaction_log=require(_0x23de('0x75'))(_0x23de('0x76'));exports['accept']=function(_0x215799,_0xa9de86,_0x1fa704){var _0x49433f={'channel':_0x23de('0x77')};if(_0x215799[_0x23de('0x58')]['id']){delete _0x215799['body']['id'];}_0x215799[_0x23de('0x58')][_0x23de('0x78')]=!![];_0x215799[_0x23de('0x58')][_0x23de('0x79')]=moment()[_0x23de('0x74')](_0x23de('0x7a'));_0x215799[_0x23de('0x58')][_0x23de('0x7b')]=_0x215799[_0x23de('0x58')]['UserId']||_0x215799[_0x23de('0x6b')]['id'];return db[_0x23de('0x3e')]['find']({'where':{'id':_0x215799['params']['id'],'UserId':null},'include':[{'model':db[_0x23de('0x62')],'as':'Contact'}]})[_0x23de('0x22')](handleEntityNotFound(_0xa9de86,null))[_0x23de('0x22')](saveUpdates(_0x215799[_0x23de('0x58')],null))[_0x23de('0x22')](function(_0x1a3b11){if(_0x1a3b11){_0x49433f['message']=_0x1a3b11[_0x23de('0x7c')]({'plain':!![]});return db[_0x23de('0x7d')][_0x23de('0x57')]({'where':{'id':_0x1a3b11[_0x23de('0x7e')]}});}return null;})[_0x23de('0x22')](handleEntityNotFound(_0xa9de86,null))[_0x23de('0x22')](function(_0x47f5b5){if(_0x47f5b5){return _0x47f5b5['update']({'UserId':_0x215799['body'][_0x23de('0x7b')],'read1stAt':_[_0x23de('0x65')](_0x47f5b5[_0x23de('0x7f')])?moment()[_0x23de('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x23de('0x22')](function(_0x15f157){if(_0x15f157){_0x49433f[_0x23de('0x80')]=_0x15f157[_0x23de('0x7c')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x215799[_0x23de('0x6b')]['id'],_0x215799[_0x23de('0x6b')][_0x23de('0x3a')],_0x215799[_0x23de('0x6b')][_0x23de('0x81')],_0x49433f['interaction']['id'],_0x215799[_0x23de('0x58')]?JSON['stringify'](_0x215799[_0x23de('0x58')]):_0x23de('0x82'));return respondWithRpcPromise(_0x23de('0x83'),_0x23de('0x84'),_0x49433f);}return null;})[_0x23de('0x22')](function(_0x1a971f){if(_0x1a971f){if(_0x215799['body'][_0x23de('0x85')]){_0x49433f[_0x23de('0x2a')][_0x23de('0x86')]=util[_0x23de('0x74')]('SIP/%s',_0x215799[_0x23de('0x6b')]['name']);_0x49433f[_0x23de('0x2a')][_0x23de('0x87')]=_0x49433f[_0x23de('0x87')];_0x49433f[_0x23de('0x2a')][_0x23de('0x88')]='accept';return respondWithRpcPromise(_0x23de('0x89'),_0x23de('0x89'),{'event':_0x23de('0x8a'),'message':_0x49433f[_0x23de('0x2a')]},client9002)[_0x23de('0x22')](function(){return _0x49433f;});}return _0x49433f;}return null;})['then'](respondWithResult(_0xa9de86,null))[_0x23de('0x2d')](handleError(_0xa9de86,null));};var interaction_log=require(_0x23de('0x75'))('mail-interactions');exports[_0x23de('0x36')]=function(_0x3a4a3e,_0x3ef2f5,_0x406a32){var _0x1dcda9={'agent':{},'channel':'mail'};if(_0x3a4a3e[_0x23de('0x58')]['id']){delete _0x3a4a3e[_0x23de('0x58')]['id'];}_0x3a4a3e[_0x23de('0x58')]['UserId']=_0x3a4a3e[_0x23de('0x58')][_0x23de('0x7b')]||_0x3a4a3e['user']['id'];_0x1dcda9[_0x23de('0x8b')]['id']=_0x3a4a3e['body']['UserId'];return db[_0x23de('0x3e')][_0x23de('0x57')]({'where':{'id':_0x3a4a3e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ef2f5,null))[_0x23de('0x22')](function(_0x303b41){if(_0x303b41){_0x1dcda9[_0x23de('0x2a')]=_0x303b41[_0x23de('0x7c')]({'plain':!![]});return db[_0x23de('0x7d')]['find']({'where':{'id':_0x303b41[_0x23de('0x7e')]}});}return null;})[_0x23de('0x22')](handleEntityNotFound(_0x3ef2f5,null))['then'](function(_0x58fc82){if(_0x58fc82){_0x1dcda9[_0x23de('0x80')]=_0x58fc82[_0x23de('0x7c')]({'plain':!![]});interaction_log[_0x23de('0x2b')](_0x23de('0x8c'),_0x3a4a3e[_0x23de('0x6b')]['id'],_0x3a4a3e['user'][_0x23de('0x3a')],_0x3a4a3e[_0x23de('0x6b')][_0x23de('0x81')],_0x1dcda9[_0x23de('0x80')]['id'],_0x3a4a3e[_0x23de('0x58')]?JSON[_0x23de('0x26')](_0x3a4a3e['body']):_0x23de('0x82'));return respondWithRpcPromise(_0x23de('0x8d'),_0x23de('0x8e'),_0x1dcda9);}return null;})[_0x23de('0x22')](function(_0x2122bd){if(_0x2122bd){_0x2122bd[_0x23de('0x2a')][_0x23de('0x86')]=util[_0x23de('0x74')](_0x23de('0x8f'),_0x3a4a3e[_0x23de('0x6b')][_0x23de('0x3a')]);_0x2122bd[_0x23de('0x2a')][_0x23de('0x87')]=_0x1dcda9[_0x23de('0x87')];_0x2122bd['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x23de('0x90'),'message':_0x2122bd[_0x23de('0x2a')]},client9002);return _0x1dcda9;}return null;})[_0x23de('0x22')](respondWithResult(_0x3ef2f5,null))['catch'](handleError(_0x3ef2f5,null));};exports[_0x23de('0x91')]=function(_0x1ac3fa,_0x4712ec){var _0x4ea787=moment()[_0x23de('0x92')]()['toString']();var _0x563835=path[_0x23de('0x6d')](config[_0x23de('0x6e')],_0x23de('0x93'),_0x23de('0x94'),_0x23de('0x95'));var _0x7c159e=path['join'](config[_0x23de('0x6e')],_0x23de('0x93'),_0x23de('0x94'),_0x23de('0x6c'));var _0x2e02b5=util[_0x23de('0x74')](_0x23de('0x96'),_0x4ea787);return db[_0x23de('0x3e')]['find']({'where':{'id':_0x1ac3fa[_0x23de('0x54')]['id']},'attributes':['id',_0x23de('0x58'),_0x23de('0x97'),'to','cc',_0x23de('0x98'),_0x23de('0x99'),_0x23de('0x9a')],'include':_0x1ac3fa[_0x23de('0x41')][_0x23de('0x6c')]?[{'model':db[_0x23de('0x9b')],'as':_0x23de('0x9c')}]:undefined})[_0x23de('0x22')](handleEntityNotFound(_0x4712ec,null))[_0x23de('0x22')](function(_0x5cc511){if(_0x5cc511){var _0x343bb5=_0x5cc511;var _0x1c2f59={'from':_0x343bb5['from'],'to':_0x343bb5['to'],'subject':_0x343bb5['subject'],'html':_0x343bb5['body'],'headers':{'Date':moment(_0x343bb5['createdAt'])['format'](_0x23de('0x9d'))},'attachments':[]};if(_0x5cc511['cc']){_0x1c2f59[_0x23de('0x9e')]['Cc']=_0x5cc511['cc'];}if(_0x5cc511[_0x23de('0x98')]){_0x1c2f59[_0x23de('0x9e')][_0x23de('0x9f')]=_0x5cc511[_0x23de('0x98')];}return new BPromise(function(_0x5820b8,_0x4350cd){if(_0x5cc511['Attachments']){for(var _0x5e0c0e=0x0;_0x5e0c0e<_0x5cc511[_0x23de('0x9c')][_0x23de('0x45')];_0x5e0c0e++){var _0x593fb6=_0x5cc511[_0x23de('0x9c')][_0x5e0c0e];var _0x46a3e0=path[_0x23de('0x6d')](_0x7c159e,_0x593fb6[_0x23de('0xa0')]);if(fs[_0x23de('0xa1')](_0x46a3e0)){_0x1c2f59[_0x23de('0x6c')][_0x23de('0xa2')]({'name':_0x593fb6['name'],'contentType':_0x593fb6[_0x23de('0x4e')],'data':fs[_0x23de('0xa3')](_0x46a3e0)});}}}emlformat['build'](_0x1c2f59,function(_0x213d7b,_0x47f204){if(_0x213d7b)return _0x4350cd(_0x213d7b);fs[_0x23de('0xa4')](path['join'](_0x563835,_0x2e02b5),_0x47f204);return _0x5820b8(_0x47f204);});});}})[_0x23de('0x22')](function(_0x46c59d){if(_0x46c59d){return _0x4712ec[_0x23de('0x91')](path[_0x23de('0x6d')](_0x563835,_0x2e02b5),_0x2e02b5,function(_0x3528f4){if(_0x3528f4){console[_0x23de('0xa5')]('err',_0x3528f4);}else{fs[_0x23de('0xa6')](path['join'](_0x563835,_0x2e02b5));}});}})[_0x23de('0x2d')](handleError(_0x4712ec,null));}; \ No newline at end of file +var _0x0a16=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','MailMessage','rows','show','params','keys','find','body','describe','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','server/files/attachments','basename','Contacts','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','format','UserId','Contact','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','manual','SIP/%s','event','EventManager','acceptmessage','agent','stringify','RejectMessage','rejectMessage','rejectmessage','download','toString','server','files','message-%s.eml','bcc','subject','createdAt','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','writeFileSync','log','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x28c263,_0x498dfc){var _0x2e0a6d=function(_0x37c09d){while(--_0x37c09d){_0x28c263['push'](_0x28c263['shift']());}};_0x2e0a6d(++_0x498dfc);}(_0x0a16,0x10e));var _0x60a1=function(_0x5980c5,_0x2119ce){_0x5980c5=_0x5980c5-0x0;var _0x2eac91=_0x0a16[_0x5980c5];return _0x2eac91;};'use strict';var pdf=require(_0x60a1('0x0'));var emlformat=require(_0x60a1('0x1'));var rimraf=require(_0x60a1('0x2'));var zipdir=require(_0x60a1('0x3'));var jsonpatch=require(_0x60a1('0x4'));var rp=require('request-promise');var moment=require(_0x60a1('0x5'));var BPromise=require(_0x60a1('0x6'));var Mustache=require(_0x60a1('0x7'));var util=require(_0x60a1('0x8'));var path=require(_0x60a1('0x9'));var sox=require(_0x60a1('0xa'));var csv=require(_0x60a1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x60a1('0xc'));var crypto=require(_0x60a1('0xd'));var jsforce=require(_0x60a1('0xe'));var deskjs=require(_0x60a1('0xf'));var toCsv=require(_0x60a1('0xb'));var querystring=require(_0x60a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x60a1('0x11'));var authService=require(_0x60a1('0x12'));var qs=require(_0x60a1('0x13'));var as=require(_0x60a1('0x14'));var hardwareService=require(_0x60a1('0x15'));var logger=require(_0x60a1('0x16'))(_0x60a1('0x17'));var utils=require(_0x60a1('0x18'));var config=require('../../config/environment');var db=require(_0x60a1('0x19'))['db'];config[_0x60a1('0x1a')]=_[_0x60a1('0x1b')](config[_0x60a1('0x1a')],{'host':_0x60a1('0x1c'),'port':0x18eb});var socket=require(_0x60a1('0x1d'))(new Redis(config[_0x60a1('0x1a')]));require(_0x60a1('0x1e'))[_0x60a1('0x1f')](socket);var jayson=require(_0x60a1('0x20'));var client=jayson[_0x60a1('0x21')][_0x60a1('0x22')]({'port':0x232c});var client9003=jayson[_0x60a1('0x21')][_0x60a1('0x22')]({'port':0x232b});var client9002=jayson[_0x60a1('0x21')][_0x60a1('0x22')]({'port':0x232a});function checkPasswordPattern(_0x17bc20,_0xeee5f0,_0x16026f){if(_0x16026f){var _0x111e9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x111e9d[_0x60a1('0x23')](_0xeee5f0)){return _0x17bc20;}else{throw new db['Sequelize']['ValidationError'](_0x60a1('0x24'));}}else{return _0x17bc20;}}function respondWithRpcPromise(_0x5b0b0f,_0x4d6037,_0x17e41d,_0x3f1a12){return new BPromise(function(_0x1796a5,_0x2ed61a){var _0x4fd2a8=_0x3f1a12||client;return _0x4fd2a8[_0x60a1('0x25')](_0x5b0b0f,_0x17e41d)[_0x60a1('0x26')](function(_0x3f3d42){logger[_0x60a1('0x27')]('MailMessage,\x20%s,\x20%s',_0x4d6037,_0x60a1('0x28'));logger[_0x60a1('0x29')](_0x60a1('0x2a'),_0x4d6037,_0x60a1('0x28'),JSON['stringify'](_0x3f3d42));if(_0x3f3d42[_0x60a1('0x2b')]){if(_0x3f3d42['error'][_0x60a1('0x2c')]===0x1f4){logger[_0x60a1('0x2b')](_0x60a1('0x2d'),_0x4d6037,_0x3f3d42['error']['message']);return _0x2ed61a(_0x3f3d42[_0x60a1('0x2b')][_0x60a1('0x2e')]);}logger[_0x60a1('0x2b')](_0x60a1('0x2d'),_0x4d6037,_0x3f3d42[_0x60a1('0x2b')]['message']);return _0x1796a5(_0x3f3d42[_0x60a1('0x2b')]['message']);}else{logger['info'](_0x60a1('0x2d'),_0x4d6037,_0x60a1('0x28'));_0x1796a5(_0x3f3d42['result'][_0x60a1('0x2e')]);}})[_0x60a1('0x2f')](function(_0x5623cf){logger['error']('MailMessage,\x20%s,\x20%s',_0x4d6037,_0x5623cf);_0x2ed61a(_0x5623cf);});});}function respondWithStatusCode(_0x5ca5ee,_0x468ba4){_0x468ba4=_0x468ba4||0xcc;return function(_0x580109){if(_0x580109){return _0x5ca5ee[_0x60a1('0x30')](_0x468ba4);}return _0x5ca5ee[_0x60a1('0x31')](_0x468ba4)[_0x60a1('0x32')]();};}function respondWithResult(_0x539ff5,_0xd4c357){_0xd4c357=_0xd4c357||0xc8;return function(_0x3a4477){if(_0x3a4477){return _0x539ff5[_0x60a1('0x31')](_0xd4c357)['json'](_0x3a4477);}};}function respondWithFilteredResult(_0x56af12,_0x393081){return function(_0x30280c){if(_0x30280c){var _0x3901b0=_0x30280c['count'],_0x149851=_0x393081[_0x60a1('0x33')],_0x41d332=_0x393081[_0x60a1('0x33')]+_0x393081[_0x60a1('0x34')],_0x449f20;if(_0x41d332>=_0x3901b0){_0x41d332=_0x3901b0;_0x449f20=0xc8;}else{_0x449f20=0xce;}_0x56af12['status'](_0x449f20);return _0x56af12[_0x60a1('0x35')](_0x60a1('0x36'),_0x149851+'-'+_0x41d332+'/'+_0x3901b0)['json'](_0x30280c);}return null;};}function patchUpdates(_0xeba554){return function(_0x157897){try{jsonpatch['apply'](_0x157897,_0xeba554,!![]);}catch(_0x38eef5){return BPromise[_0x60a1('0x37')](_0x38eef5);}return _0x157897[_0x60a1('0x38')]();};}function saveUpdates(_0x40dc3c,_0x5187d0){return function(_0x5a0548){if(_0x5a0548){return _0x5a0548[_0x60a1('0x39')](_0x40dc3c)[_0x60a1('0x26')](function(_0x3d6d17){return _0x3d6d17;});}return null;};}function removeEntity(_0x2191f0,_0x25a42d){return function(_0x42ae37){if(_0x42ae37){return _0x42ae37[_0x60a1('0x3a')]()[_0x60a1('0x26')](function(){_0x2191f0[_0x60a1('0x31')](0xcc)[_0x60a1('0x32')]();});}};}function handleEntityNotFound(_0xbb141d,_0x39d8f4){return function(_0x24b1ee){if(!_0x24b1ee){_0xbb141d[_0x60a1('0x30')](0x194);}return _0x24b1ee;};}function handleError(_0x4980a2,_0x1eb411){_0x1eb411=_0x1eb411||0x1f4;return function(_0x124b95){logger[_0x60a1('0x2b')](_0x124b95['stack']);if(_0x124b95[_0x60a1('0x3b')]){delete _0x124b95[_0x60a1('0x3b')];}_0x4980a2['status'](_0x1eb411)[_0x60a1('0x3c')](_0x124b95);};}exports[_0x60a1('0x3d')]=function(_0x40d6c4,_0x291ce3){var _0x7bd724={},_0x54abcc={},_0x5bebb1={'count':0x0,'rows':[]};var _0x296ec4=_[_0x60a1('0x3e')](db['MailMessage'][_0x60a1('0x3f')],function(_0x4bb08e){return{'name':_0x4bb08e[_0x60a1('0x40')],'type':_0x4bb08e[_0x60a1('0x41')][_0x60a1('0x42')]};});_0x54abcc[_0x60a1('0x43')]=_[_0x60a1('0x3e')](_0x296ec4,_0x60a1('0x3b'));_0x54abcc[_0x60a1('0x44')]=_['keys'](_0x40d6c4[_0x60a1('0x44')]);_0x54abcc[_0x60a1('0x45')]=_[_0x60a1('0x46')](_0x54abcc['model'],_0x54abcc[_0x60a1('0x44')]);_0x7bd724[_0x60a1('0x47')]=_[_0x60a1('0x46')](_0x54abcc[_0x60a1('0x43')],qs[_0x60a1('0x48')](_0x40d6c4[_0x60a1('0x44')][_0x60a1('0x48')]));_0x7bd724[_0x60a1('0x47')]=_0x7bd724['attributes'][_0x60a1('0x49')]?_0x7bd724[_0x60a1('0x47')]:_0x54abcc[_0x60a1('0x43')];if(!_0x40d6c4['query'][_0x60a1('0x4a')](_0x60a1('0x4b'))){_0x7bd724['limit']=qs[_0x60a1('0x34')](_0x40d6c4[_0x60a1('0x44')]['limit']);_0x7bd724[_0x60a1('0x33')]=qs[_0x60a1('0x33')](_0x40d6c4['query'][_0x60a1('0x33')]);}_0x7bd724[_0x60a1('0x4c')]=qs[_0x60a1('0x4d')](_0x40d6c4[_0x60a1('0x44')]['sort']);_0x7bd724['where']=qs[_0x60a1('0x45')](_[_0x60a1('0x4e')](_0x40d6c4[_0x60a1('0x44')],_0x54abcc['filters']),_0x296ec4);if(_0x40d6c4[_0x60a1('0x44')][_0x60a1('0x4f')]){_0x7bd724[_0x60a1('0x50')]=_[_0x60a1('0x51')](_0x7bd724[_0x60a1('0x50')],{'$or':_[_0x60a1('0x3e')](_0x296ec4,function(_0x39a689){if(_0x39a689[_0x60a1('0x41')]!==_0x60a1('0x52')){var _0x3d6d45={};_0x3d6d45[_0x39a689[_0x60a1('0x3b')]]={'$like':'%'+_0x40d6c4[_0x60a1('0x44')][_0x60a1('0x4f')]+'%'};return _0x3d6d45;}})});}_0x7bd724=_[_0x60a1('0x51')]({},_0x7bd724,_0x40d6c4[_0x60a1('0x53')]);var _0x369a90={'where':_0x7bd724[_0x60a1('0x50')]};return db['MailMessage'][_0x60a1('0x54')](_0x369a90)['then'](function(_0x141074){_0x5bebb1[_0x60a1('0x54')]=_0x141074;if(_0x40d6c4['query'][_0x60a1('0x55')]){_0x7bd724[_0x60a1('0x56')]=[{'all':!![]}];}return db[_0x60a1('0x57')]['findAll'](_0x7bd724);})[_0x60a1('0x26')](function(_0x55c032){_0x5bebb1[_0x60a1('0x58')]=_0x55c032;return _0x5bebb1;})['then'](respondWithFilteredResult(_0x291ce3,_0x7bd724))[_0x60a1('0x2f')](handleError(_0x291ce3,null));};exports[_0x60a1('0x59')]=function(_0x334581,_0x4a2999){var _0x3a74ee={'raw':!![],'where':{'id':_0x334581[_0x60a1('0x5a')]['id']}},_0x569328={};_0x569328[_0x60a1('0x43')]=_['keys'](db['MailMessage'][_0x60a1('0x3f')]);_0x569328[_0x60a1('0x44')]=_[_0x60a1('0x5b')](_0x334581['query']);_0x569328[_0x60a1('0x45')]=_['intersection'](_0x569328[_0x60a1('0x43')],_0x569328[_0x60a1('0x44')]);_0x3a74ee[_0x60a1('0x47')]=_['intersection'](_0x569328[_0x60a1('0x43')],qs[_0x60a1('0x48')](_0x334581[_0x60a1('0x44')]['fields']));_0x3a74ee[_0x60a1('0x47')]=_0x3a74ee[_0x60a1('0x47')][_0x60a1('0x49')]?_0x3a74ee['attributes']:_0x569328[_0x60a1('0x43')];if(_0x334581['query'][_0x60a1('0x55')]){_0x3a74ee['include']=[{'all':!![]}];}_0x3a74ee=_['merge']({},_0x3a74ee,_0x334581[_0x60a1('0x53')]);return db[_0x60a1('0x57')][_0x60a1('0x5c')](_0x3a74ee)[_0x60a1('0x26')](handleEntityNotFound(_0x4a2999,null))[_0x60a1('0x26')](respondWithResult(_0x4a2999,null))[_0x60a1('0x2f')](handleError(_0x4a2999,null));};exports['update']=function(_0x3618fa,_0x187968){if(_0x3618fa[_0x60a1('0x5d')]['id']){delete _0x3618fa[_0x60a1('0x5d')]['id'];}return db[_0x60a1('0x57')][_0x60a1('0x5c')]({'where':{'id':_0x3618fa['params']['id']}})[_0x60a1('0x26')](handleEntityNotFound(_0x187968,null))[_0x60a1('0x26')](saveUpdates(_0x3618fa[_0x60a1('0x5d')],null))[_0x60a1('0x26')](respondWithResult(_0x187968,null))[_0x60a1('0x2f')](handleError(_0x187968,null));};exports[_0x60a1('0x3a')]=function(_0x2ff676,_0x438946){return db[_0x60a1('0x57')][_0x60a1('0x5c')]({'where':{'id':_0x2ff676[_0x60a1('0x5a')]['id']}})[_0x60a1('0x26')](handleEntityNotFound(_0x438946,null))[_0x60a1('0x26')](removeEntity(_0x438946,null))[_0x60a1('0x2f')](handleError(_0x438946,null));};exports[_0x60a1('0x5e')]=function(_0x4fdda6,_0x4f62f0){return db[_0x60a1('0x57')]['describe']()[_0x60a1('0x26')](respondWithResult(_0x4f62f0,null))[_0x60a1('0x2f')](handleError(_0x4f62f0,null));};exports['create']=function(_0x1cc9fb,_0x40aba4){return db[_0x60a1('0x57')]['create'](_0x1cc9fb[_0x60a1('0x5d')])[_0x60a1('0x26')](function(_0x265cc5){if(_0x265cc5){if(_0x265cc5[_0x60a1('0x5f')]===_0x60a1('0x60')&&!_0x265cc5[_0x60a1('0x61')]){var _0x5d49c8,_0x2de6d9,_0x395680;if(_0x1cc9fb[_0x60a1('0x5d')]['to']){_0x2de6d9=_0x1cc9fb[_0x60a1('0x5d')]['to'][_0x60a1('0x62')](',')[0x0];}return db[_0x60a1('0x63')][_0x60a1('0x64')]({'where':{'id':_0x265cc5['MailAccountId']},'include':[{'model':db[_0x60a1('0x65')],'as':_0x60a1('0x66'),'include':[{'model':db[_0x60a1('0x67')],'as':'Contacts','where':{'email':_0x2de6d9},'limit':0x1,'order':[[_0x60a1('0x68'),_0x60a1('0x69')]]}]},{'model':db[_0x60a1('0x6a')],'as':_0x60a1('0x6b'),'raw':!![]}]})[_0x60a1('0x26')](function(_0x54a2fb){_0x5d49c8=_0x54a2fb;if(_0x5d49c8&&_0x5d49c8[_0x60a1('0x6b')]){var _0x1f8627={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x6c')])){_0x1f8627[_0x60a1('0x6d')]=_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x6d')];_0x1f8627[_0x60a1('0x6e')]=_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x6e')];_0x1f8627['secure']=_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x6f')];if(_0x5d49c8['Smtp'][_0x60a1('0x70')]){_0x1f8627[_0x60a1('0x71')]={'user':_0x5d49c8[_0x60a1('0x6b')]['user'],'pass':_0x5d49c8['Smtp'][_0x60a1('0x72')]};}}else{_0x1f8627[_0x60a1('0x6c')]=_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x6c')];_0x1f8627['auth']={'user':_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x73')],'pass':_0x5d49c8[_0x60a1('0x6b')][_0x60a1('0x72')]};_0x1f8627[_0x60a1('0x6f')]=_0x5d49c8['Smtp'][_0x60a1('0x6f')];}if(_0x1cc9fb[_0x60a1('0x5d')][_0x60a1('0x74')]&&_0x1cc9fb[_0x60a1('0x5d')][_0x60a1('0x74')][_0x60a1('0x49')]){for(var _0xfabf69=0x0;_0xfabf69<_0x1cc9fb['body'][_0x60a1('0x74')]['length'];_0xfabf69+=0x1){_0x1cc9fb[_0x60a1('0x5d')]['attachments'][_0xfabf69]={'filename':_0x1cc9fb[_0x60a1('0x5d')][_0x60a1('0x74')][_0xfabf69][_0x60a1('0x3b')],'path':path[_0x60a1('0x75')](config[_0x60a1('0x76')],_0x60a1('0x77'),_0x1cc9fb[_0x60a1('0x5d')]['attachments'][_0xfabf69][_0x60a1('0x78')])};}}_0x395680={'account':_0x1f8627,'message':_0x1cc9fb['body']};return;}})['then'](function(){if(_0x5d49c8[_0x60a1('0x66')]){if(_0x5d49c8[_0x60a1('0x66')][_0x60a1('0x79')]['length']){return _0x5d49c8[_0x60a1('0x66')][_0x60a1('0x79')][0x0];}else{return db[_0x60a1('0x67')][_0x60a1('0x7a')](_['defaults'](_0x1cc9fb['body'],{'firstName':_0x1cc9fb[_0x60a1('0x5d')]['to'],'email':_0x1cc9fb['body']['to'],'phone':_0x1cc9fb[_0x60a1('0x5d')]['to'],'ListId':_0x5d49c8[_0x60a1('0x7b')]}));}}else{throw new Error(_0x60a1('0x7c'));}})[_0x60a1('0x26')](function(){if(_0x395680){return respondWithRpcPromise(_0x60a1('0x7d'),_0x60a1('0x7e'),_0x395680,client9003)[_0x60a1('0x26')](function(_0x1da8e7){return _0x265cc5[_0x60a1('0x39')]({'read':!![],'messageId':_0x1da8e7[_0x60a1('0x7f')],'sentAt':moment()['format'](_0x60a1('0x80'))});})[_0x60a1('0x2f')](function(_0x2c0141){logger['error']('%s',JSON['stringify'](_0x2c0141));return _0x265cc5;});}return _0x265cc5;});}return _0x265cc5;}})['then'](respondWithResult(_0x40aba4,0xc9))['catch'](handleError(_0x40aba4,null));};var interaction_log=require(_0x60a1('0x16'))(_0x60a1('0x81'));exports[_0x60a1('0x82')]=function(_0x20d333,_0x58b90b,_0x998ff6){var _0x4a8a52={'channel':_0x60a1('0x83')};if(_0x20d333[_0x60a1('0x5d')]['id']){delete _0x20d333[_0x60a1('0x5d')]['id'];}_0x20d333[_0x60a1('0x5d')][_0x60a1('0x84')]=!![];_0x20d333[_0x60a1('0x5d')][_0x60a1('0x85')]=moment()[_0x60a1('0x86')]('YYYY-MM-DD\x20HH:mm:ss');_0x20d333['body'][_0x60a1('0x87')]=_0x20d333[_0x60a1('0x5d')]['UserId']||_0x20d333[_0x60a1('0x73')]['id'];return db[_0x60a1('0x57')][_0x60a1('0x5c')]({'where':{'id':_0x20d333[_0x60a1('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0x60a1('0x67')],'as':_0x60a1('0x88')}]})[_0x60a1('0x26')](handleEntityNotFound(_0x58b90b,null))[_0x60a1('0x26')](saveUpdates(_0x20d333[_0x60a1('0x5d')],null))[_0x60a1('0x26')](function(_0x53db44){if(_0x53db44){_0x4a8a52[_0x60a1('0x2e')]=_0x53db44[_0x60a1('0x89')]({'plain':!![]});return db[_0x60a1('0x8a')]['find']({'where':{'id':_0x53db44[_0x60a1('0x8b')]}});}return null;})[_0x60a1('0x26')](handleEntityNotFound(_0x58b90b,null))[_0x60a1('0x26')](function(_0x340ac0){if(_0x340ac0){return _0x340ac0[_0x60a1('0x39')]({'UserId':_0x20d333[_0x60a1('0x5d')][_0x60a1('0x87')],'read1stAt':_[_0x60a1('0x8c')](_0x340ac0[_0x60a1('0x8d')])?moment()[_0x60a1('0x86')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x60a1('0x26')](function(_0xeb0a4f){if(_0xeb0a4f){_0x4a8a52[_0x60a1('0x8e')]=_0xeb0a4f[_0x60a1('0x89')]({'plain':!![]});interaction_log[_0x60a1('0x27')](_0x60a1('0x8f'),_0x20d333['user']['id'],_0x20d333[_0x60a1('0x73')][_0x60a1('0x3b')],_0x20d333[_0x60a1('0x73')]['role'],_0x4a8a52[_0x60a1('0x8e')]['id'],_0x20d333[_0x60a1('0x5d')]?JSON['stringify'](_0x20d333[_0x60a1('0x5d')]):_0x60a1('0x90'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4a8a52);}return null;})['then'](function(_0x32c219){if(_0x32c219){if(_0x20d333['body'][_0x60a1('0x91')]){_0x4a8a52[_0x60a1('0x2e')]['interface']=util[_0x60a1('0x86')](_0x60a1('0x92'),_0x20d333[_0x60a1('0x73')]['name']);_0x4a8a52[_0x60a1('0x2e')]['channel']=_0x4a8a52['channel'];_0x4a8a52[_0x60a1('0x2e')][_0x60a1('0x93')]='accept';return respondWithRpcPromise(_0x60a1('0x94'),_0x60a1('0x94'),{'event':_0x60a1('0x95'),'message':_0x4a8a52['message']},client9002)['then'](function(){return _0x4a8a52;});}return _0x4a8a52;}return null;})[_0x60a1('0x26')](respondWithResult(_0x58b90b,null))['catch'](handleError(_0x58b90b,null));};var interaction_log=require(_0x60a1('0x16'))(_0x60a1('0x81'));exports[_0x60a1('0x37')]=function(_0x5978d1,_0x3599af,_0x39a2de){var _0x46b2da={'agent':{},'channel':_0x60a1('0x83')};if(_0x5978d1[_0x60a1('0x5d')]['id']){delete _0x5978d1['body']['id'];}_0x5978d1[_0x60a1('0x5d')][_0x60a1('0x87')]=_0x5978d1[_0x60a1('0x5d')][_0x60a1('0x87')]||_0x5978d1[_0x60a1('0x73')]['id'];_0x46b2da[_0x60a1('0x96')]['id']=_0x5978d1['body'][_0x60a1('0x87')];return db['MailMessage']['find']({'where':{'id':_0x5978d1[_0x60a1('0x5a')]['id'],'UserId':null}})[_0x60a1('0x26')](handleEntityNotFound(_0x3599af,null))[_0x60a1('0x26')](function(_0x190c23){if(_0x190c23){_0x46b2da[_0x60a1('0x2e')]=_0x190c23[_0x60a1('0x89')]({'plain':!![]});return db[_0x60a1('0x8a')][_0x60a1('0x5c')]({'where':{'id':_0x190c23['MailInteractionId']}});}return null;})[_0x60a1('0x26')](handleEntityNotFound(_0x3599af,null))[_0x60a1('0x26')](function(_0x2a7a4e){if(_0x2a7a4e){_0x46b2da[_0x60a1('0x8e')]=_0x2a7a4e[_0x60a1('0x89')]({'plain':!![]});interaction_log[_0x60a1('0x27')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5978d1[_0x60a1('0x73')]['id'],_0x5978d1[_0x60a1('0x73')][_0x60a1('0x3b')],_0x5978d1[_0x60a1('0x73')]['role'],_0x46b2da[_0x60a1('0x8e')]['id'],_0x5978d1[_0x60a1('0x5d')]?JSON[_0x60a1('0x97')](_0x5978d1[_0x60a1('0x5d')]):_0x60a1('0x90'));return respondWithRpcPromise(_0x60a1('0x98'),_0x60a1('0x99'),_0x46b2da);}return null;})['then'](function(_0x26420a){if(_0x26420a){_0x26420a[_0x60a1('0x2e')]['interface']=util['format'](_0x60a1('0x92'),_0x5978d1[_0x60a1('0x73')][_0x60a1('0x3b')]);_0x26420a[_0x60a1('0x2e')]['channel']=_0x46b2da['channel'];_0x26420a[_0x60a1('0x2e')][_0x60a1('0x93')]=_0x60a1('0x37');respondWithRpcPromise(_0x60a1('0x94'),'EventManager',{'event':_0x60a1('0x9a'),'message':_0x26420a[_0x60a1('0x2e')]},client9002);return _0x46b2da;}return null;})['then'](respondWithResult(_0x3599af,null))['catch'](handleError(_0x3599af,null));};exports[_0x60a1('0x9b')]=function(_0x401bcb,_0x1be101){var _0xd5ff3d=moment()['unix']()[_0x60a1('0x9c')]();var _0x2ad282=path[_0x60a1('0x75')](config[_0x60a1('0x76')],_0x60a1('0x9d'),_0x60a1('0x9e'),'tmp');var _0x2d005c=path[_0x60a1('0x75')](config[_0x60a1('0x76')],_0x60a1('0x9d'),_0x60a1('0x9e'),'attachments');var _0x26b356=util['format'](_0x60a1('0x9f'),_0xd5ff3d);return db['MailMessage'][_0x60a1('0x5c')]({'where':{'id':_0x401bcb[_0x60a1('0x5a')]['id']},'attributes':['id',_0x60a1('0x5d'),'from','to','cc',_0x60a1('0xa0'),_0x60a1('0xa1'),_0x60a1('0xa2')],'include':_0x401bcb[_0x60a1('0x44')]['attachments']?[{'model':db['Attachment'],'as':_0x60a1('0xa3')}]:undefined})[_0x60a1('0x26')](handleEntityNotFound(_0x1be101,null))[_0x60a1('0x26')](function(_0x3d59fa){if(_0x3d59fa){var _0x5d1328=_0x3d59fa;var _0x36cbae={'from':_0x5d1328[_0x60a1('0xa4')],'to':_0x5d1328['to'],'subject':_0x5d1328[_0x60a1('0xa1')],'html':_0x5d1328['body'],'headers':{'Date':moment(_0x5d1328[_0x60a1('0xa2')])['format'](_0x60a1('0xa5'))},'attachments':[]};if(_0x3d59fa['cc']){_0x36cbae['headers']['Cc']=_0x3d59fa['cc'];}if(_0x3d59fa['bcc']){_0x36cbae[_0x60a1('0xa6')][_0x60a1('0xa7')]=_0x3d59fa['bcc'];}return new BPromise(function(_0x237b6a,_0x16383c){if(_0x3d59fa[_0x60a1('0xa3')]){for(var _0x596caf=0x0;_0x596caf<_0x3d59fa[_0x60a1('0xa3')][_0x60a1('0x49')];_0x596caf++){var _0x3f84ae=_0x3d59fa[_0x60a1('0xa3')][_0x596caf];var _0x620af5=path[_0x60a1('0x75')](_0x2d005c,_0x3f84ae[_0x60a1('0x78')]);if(fs['existsSync'](_0x620af5)){_0x36cbae[_0x60a1('0x74')][_0x60a1('0xa8')]({'name':_0x3f84ae[_0x60a1('0x3b')],'contentType':_0x3f84ae['type'],'data':fs[_0x60a1('0xa9')](_0x620af5)});}}}emlformat['build'](_0x36cbae,function(_0x23a351,_0x29cb5b){if(_0x23a351)return _0x16383c(_0x23a351);fs[_0x60a1('0xaa')](path[_0x60a1('0x75')](_0x2ad282,_0x26b356),_0x29cb5b);return _0x237b6a(_0x29cb5b);});});}})[_0x60a1('0x26')](function(_0x47d6c2){if(_0x47d6c2){return _0x1be101[_0x60a1('0x9b')](path[_0x60a1('0x75')](_0x2ad282,_0x26b356),_0x26b356,function(_0xb7a6de){if(_0xb7a6de){console[_0x60a1('0xab')]('err',_0xb7a6de);}else{fs['unlinkSync'](path['join'](_0x2ad282,_0x26b356));}});}})[_0x60a1('0x2f')](handleError(_0x1be101,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8d7ee05..538fcf4 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 _0xf18f=['update','remove','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2bad51,_0x32a3cb){var _0x17a566=function(_0x884170){while(--_0x884170){_0x2bad51['push'](_0x2bad51['shift']());}};_0x17a566(++_0x32a3cb);}(_0xf18f,0xa5));var _0xff18=function(_0x3be4d7,_0x31fed5){_0x3be4d7=_0x3be4d7-0x0;var _0x4c1dc1=_0xf18f[_0x3be4d7];return _0x4c1dc1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xff18('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xff18('0x1')](0x0);var events={'afterCreate':_0xff18('0x2'),'afterUpdate':_0xff18('0x3'),'afterDestroy':_0xff18('0x4')};function emitEvent(_0x5e1008){return function(_0xd4807e,_0x53b0be,_0x56f75f){MailMessageEvents['emit'](_0x5e1008+':'+_0xd4807e['id'],_0xd4807e);MailMessageEvents['emit'](_0x5e1008,_0xd4807e);_0x56f75f(null);};}for(var e in events){if(events[_0xff18('0x5')](e)){var event=events[e];MailMessage[_0xff18('0x6')](e,emitEvent(event));}}module[_0xff18('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5322=['emit','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x38f158,_0x783f29){var _0x41d8b3=function(_0x3595ab){while(--_0x3595ab){_0x38f158['push'](_0x38f158['shift']());}};_0x41d8b3(++_0x783f29);}(_0x5322,0x1b2));var _0x2532=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0x5322[_0x32f26d];return _0x5d9ddc;};'use strict';var EventEmitter=require(_0x2532('0x0'));var MailMessage=require(_0x2532('0x1'))['db'][_0x2532('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2532('0x3')](0x0);var events={'afterCreate':_0x2532('0x4'),'afterUpdate':_0x2532('0x5'),'afterDestroy':_0x2532('0x6')};function emitEvent(_0x1356c6){return function(_0xcf5352,_0x373863,_0x5dc8b6){MailMessageEvents[_0x2532('0x7')](_0x1356c6+':'+_0xcf5352['id'],_0xcf5352);MailMessageEvents[_0x2532('0x7')](_0x1356c6,_0xcf5352);_0x5dc8b6(null);};}for(var e in events){if(events[_0x2532('0x8')](e)){var event=events[e];MailMessage['hook'](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 d1cfe7f..83b0924 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 _0x3044=['request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','MailInteractionId','then','catch','error','utf8mb4','util','../../config/logger','api'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x3044,0x1ea));var _0x4304=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x3044[_0x58547b];return _0x1d3fd2;};'use strict';var _=require('lodash');var util=require(_0x4304('0x0'));var logger=require(_0x4304('0x1'))(_0x4304('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4304('0x3'));var htmlToText=require(_0x4304('0x4'));var fs=require('fs');var path=require(_0x4304('0x5'));var rimraf=require(_0x4304('0x6'));var config=require('../../config/environment');var attributes=require(_0x4304('0x7'));module[_0x4304('0x8')]=function(_0x9f4da2,_0x3599a0){return _0x9f4da2['define']('MailMessage',attributes,{'tableName':_0x4304('0x9'),'paranoid':![],'indexes':[{'name':_0x4304('0xa'),'fields':[_0x4304('0xa')]},{'name':_0x4304('0xb'),'fields':[_0x4304('0xc'),_0x4304('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3dff12,_0x19eb71,_0x35e441){if(_0x3dff12[_0x4304('0xe')]){_0x3dff12[_0x4304('0xc')]=htmlToText[_0x4304('0xf')](_0x3dff12[_0x4304('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x35e441(null,_0x19eb71);},'afterCreate':function(_0x3c434f,_0x181c80,_0x4f22da){var _0x3d29f5=_0x9f4da2[_0x4304('0x10')];var _0x2e5b91=_0x3c434f[_0x4304('0x11')]({'plain':!![]});if(_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')]()==='in'||_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')]()===_0x4304('0x14')&&!_0x2e5b91['secret']&&!_[_0x4304('0x15')](_0x2e5b91[_0x4304('0x16')])){_0x3d29f5[_0x4304('0x17')]['findOne']({'where':{'id':_0x2e5b91[_0x4304('0x18')]}})[_0x4304('0x19')](function(_0xea13ba){if(_0xea13ba){_0xea13ba['update']({'lastMsgAt':_0x2e5b91['createdAt'],'lastMsgDirection':_0x2e5b91[_0x4304('0x12')][_0x4304('0x13')](),'lastMsgBody':_0x2e5b91[_0x4304('0xe')]});}})[_0x4304('0x1a')](function(_0x1e7cc9){console[_0x4304('0x1b')](_0x1e7cc9);});}_0x4f22da();}},'charset':_0x4304('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf607=['MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define'];(function(_0xe8994e,_0x349fc7){var _0x336409=function(_0x13cd16){while(--_0x13cd16){_0xe8994e['push'](_0xe8994e['shift']());}};_0x336409(++_0x349fc7);}(_0xf607,0x15c));var _0x7f60=function(_0xefbc1b,_0x3c3b2a){_0xefbc1b=_0xefbc1b-0x0;var _0x490b13=_0xf607[_0xefbc1b];return _0x490b13;};'use strict';var _=require(_0x7f60('0x0'));var util=require(_0x7f60('0x1'));var logger=require(_0x7f60('0x2'))(_0x7f60('0x3'));var moment=require(_0x7f60('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f60('0x5'));var htmlToText=require(_0x7f60('0x6'));var fs=require('fs');var path=require(_0x7f60('0x7'));var rimraf=require(_0x7f60('0x8'));var config=require(_0x7f60('0x9'));var attributes=require('./mailMessage.attributes');module[_0x7f60('0xa')]=function(_0x40ee95,_0x567291){return _0x40ee95[_0x7f60('0xb')](_0x7f60('0xc'),attributes,{'tableName':_0x7f60('0xd'),'paranoid':![],'indexes':[{'name':_0x7f60('0xe'),'fields':[_0x7f60('0xe')]},{'name':_0x7f60('0xf'),'fields':[_0x7f60('0x10'),_0x7f60('0x11')],'type':_0x7f60('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35b789,_0xa95248,_0x22816c){if(_0x35b789['body']){_0x35b789[_0x7f60('0x10')]=htmlToText[_0x7f60('0x13')](_0x35b789[_0x7f60('0x14')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x22816c(null,_0xa95248);},'afterCreate':function(_0x6fd8a3,_0x235a88,_0x180702){var _0x15f426=_0x40ee95['models'];var _0x53c25f=_0x6fd8a3[_0x7f60('0x15')]({'plain':!![]});if(_0x53c25f[_0x7f60('0x16')][_0x7f60('0x17')]()==='in'||_0x53c25f['direction'][_0x7f60('0x17')]()==='out'&&!_0x53c25f[_0x7f60('0x18')]&&!_[_0x7f60('0x19')](_0x53c25f[_0x7f60('0x1a')])){_0x15f426[_0x7f60('0x1b')][_0x7f60('0x1c')]({'where':{'id':_0x53c25f[_0x7f60('0x1d')]}})[_0x7f60('0x1e')](function(_0x2ba44e){if(_0x2ba44e){_0x2ba44e[_0x7f60('0x1f')]({'lastMsgAt':_0x53c25f['createdAt'],'lastMsgDirection':_0x53c25f[_0x7f60('0x16')][_0x7f60('0x17')](),'lastMsgBody':_0x53c25f[_0x7f60('0x14')]});}})[_0x7f60('0x20')](function(_0x34670c){console[_0x7f60('0x21')](_0x34670c);});}_0x180702();}},'charset':_0x7f60('0x22'),'collate':_0x7f60('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 001252a..0be2cfe 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 _0xed54=['socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x5b75c0,_0x55a3ac){var _0x518b8f=function(_0x169316){while(--_0x169316){_0x5b75c0['push'](_0x5b75c0['shift']());}};_0x518b8f(++_0x55a3ac);}(_0xed54,0xfc));var _0x4ed5=function(_0x58744f,_0x3cf890){_0x58744f=_0x58744f-0x0;var _0x3417f0=_0xed54[_0x58744f];return _0x3417f0;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var moment=require(_0x4ed5('0x1'));var BPromise=require(_0x4ed5('0x2'));var rs=require(_0x4ed5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ed5('0x4'))['db'];var utils=require(_0x4ed5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed5('0x6'));var jayson=require(_0x4ed5('0x7'));var client=jayson[_0x4ed5('0x8')][_0x4ed5('0x9')]({'port':0x232a});config[_0x4ed5('0xa')]=_[_0x4ed5('0xb')](config[_0x4ed5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ed5('0xc'))(new Redis(config[_0x4ed5('0xa')]));require(_0x4ed5('0xd'))[_0x4ed5('0xe')](socket);function respondWithRpcPromise(_0x52d8e3,_0x58cbe4,_0x23f1db){return new BPromise(function(_0x3c027e,_0x191814){return client[_0x4ed5('0xf')](_0x52d8e3,_0x23f1db)[_0x4ed5('0x10')](function(_0x51c141){logger[_0x4ed5('0x11')](_0x4ed5('0x12'),_0x58cbe4,_0x4ed5('0x13'));logger[_0x4ed5('0x14')](_0x4ed5('0x15'),_0x58cbe4,_0x4ed5('0x13'),JSON[_0x4ed5('0x16')](_0x51c141));if(_0x51c141[_0x4ed5('0x17')]){if(_0x51c141['error']['code']===0x1f4){logger[_0x4ed5('0x17')](_0x4ed5('0x12'),_0x58cbe4,_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);return _0x191814(_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);}logger[_0x4ed5('0x17')](_0x4ed5('0x12'),_0x58cbe4,_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);return _0x3c027e(_0x51c141[_0x4ed5('0x17')][_0x4ed5('0x18')]);}else{logger[_0x4ed5('0x11')](_0x4ed5('0x12'),_0x58cbe4,_0x4ed5('0x13'));_0x3c027e(_0x51c141[_0x4ed5('0x19')]['message']);}})[_0x4ed5('0x1a')](function(_0x374c13){logger[_0x4ed5('0x17')]('MailMessage,\x20%s,\x20%s',_0x58cbe4,_0x374c13);_0x191814(_0x374c13);});});}exports[_0x4ed5('0x1b')]=function(_0x3fd3ba){var _0xa2d24b=this;return new Promise(function(_0x1ffced,_0x1b4707){return db[_0x4ed5('0x1c')][_0x4ed5('0x1d')](_0x3fd3ba[_0x4ed5('0x1e')],{'raw':_0x3fd3ba['options']?_0x3fd3ba[_0x4ed5('0x1f')][_0x4ed5('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x32d181){logger['info']('CreateMailMessage',_0x3fd3ba);logger['debug'](_0x4ed5('0x1b'),_0x3fd3ba,JSON['stringify'](_0x32d181));_0x1ffced(_0x32d181);})[_0x4ed5('0x1a')](function(_0x366083){logger[_0x4ed5('0x17')](_0x4ed5('0x1b'),_0x366083[_0x4ed5('0x18')],_0x3fd3ba);_0x1b4707(_0xa2d24b[_0x4ed5('0x17')](0x1f4,_0x366083[_0x4ed5('0x18')]));});});}; \ No newline at end of file +var _0x1115=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0x1115,0x1b6));var _0x5111=function(_0x3a3ec3,_0x258047){_0x3a3ec3=_0x3a3ec3-0x0;var _0x389f96=_0x1115[_0x3a3ec3];return _0x389f96;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});config['redis']=_[_0x5111('0xb')](config[_0x5111('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5111('0xd'))(new Redis(config['redis']));require(_0x5111('0xe'))[_0x5111('0xf')](socket);function respondWithRpcPromise(_0x4ecb50,_0x5e12a7,_0x347d87){return new BPromise(function(_0x5a826a,_0x162624){return client['request'](_0x4ecb50,_0x347d87)[_0x5111('0x10')](function(_0x532984){logger[_0x5111('0x11')](_0x5111('0x12'),_0x5e12a7,_0x5111('0x13'));logger[_0x5111('0x14')](_0x5111('0x15'),_0x5e12a7,_0x5111('0x13'),JSON[_0x5111('0x16')](_0x532984));if(_0x532984[_0x5111('0x17')]){if(_0x532984[_0x5111('0x17')][_0x5111('0x18')]===0x1f4){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x532984[_0x5111('0x17')][_0x5111('0x19')]);return _0x162624(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}logger['error'](_0x5111('0x12'),_0x5e12a7,_0x532984['error']['message']);return _0x5a826a(_0x532984[_0x5111('0x17')][_0x5111('0x19')]);}else{logger[_0x5111('0x11')]('MailMessage,\x20%s,\x20%s',_0x5e12a7,_0x5111('0x13'));_0x5a826a(_0x532984[_0x5111('0x1a')]['message']);}})[_0x5111('0x1b')](function(_0x10110b){logger[_0x5111('0x17')](_0x5111('0x12'),_0x5e12a7,_0x10110b);_0x162624(_0x10110b);});});}exports['CreateMailMessage']=function(_0x52d236){var _0x2a1840=this;return new Promise(function(_0x1b0e5c,_0x1b3136){return db[_0x5111('0x1c')][_0x5111('0x1d')](_0x52d236[_0x5111('0x1e')],{'raw':_0x52d236[_0x5111('0x1f')]?_0x52d236[_0x5111('0x1f')][_0x5111('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3f462d){logger[_0x5111('0x11')](_0x5111('0x21'),_0x52d236);logger['debug'](_0x5111('0x21'),_0x52d236,JSON[_0x5111('0x16')](_0x3f462d));_0x1b0e5c(_0x3f462d);})[_0x5111('0x1b')](function(_0x268070){logger[_0x5111('0x17')](_0x5111('0x21'),_0x268070[_0x5111('0x19')],_0x52d236);_0x1b3136(_0x2a1840[_0x5111('0x17')](0x1f4,_0x268070[_0x5111('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a16dc8d..95d7083 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 _0x5bf2=['./mailMessage.events','remove','emit','removeListener','register','length','mailMessage:'];(function(_0x1ae665,_0x5f09ef){var _0x47d970=function(_0xc44812){while(--_0xc44812){_0x1ae665['push'](_0x1ae665['shift']());}};_0x47d970(++_0x5f09ef);}(_0x5bf2,0x157));var _0x25bf=function(_0x26cc9a,_0xcc20e8){_0x26cc9a=_0x26cc9a-0x0;var _0x2e2778=_0x5bf2[_0x26cc9a];return _0x2e2778;};'use strict';var MailMessageEvents=require(_0x25bf('0x0'));var events=['save',_0x25bf('0x1'),'update'];function createListener(_0xc0f22d,_0x2168ee){return function(_0x2ea1a6){_0x2168ee[_0x25bf('0x2')](_0xc0f22d,_0x2ea1a6);};}function removeListener(_0x15a9cd,_0x510efd){return function(){MailMessageEvents[_0x25bf('0x3')](_0x15a9cd,_0x510efd);};}exports[_0x25bf('0x4')]=function(_0x5e2916){for(var _0x1bf99e=0x0,_0x28fed5=events[_0x25bf('0x5')];_0x1bf99e<_0x28fed5;_0x1bf99e++){var _0x4baa47=events[_0x1bf99e];var _0x297877=createListener(_0x25bf('0x6')+_0x4baa47,_0x5e2916);MailMessageEvents['on'](_0x4baa47,_0x297877);}}; \ No newline at end of file +var _0xa3b4=['register','length','mailMessage:','save','remove','update','removeListener'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa3b4,0x130));var _0x4a3b=function(_0x3f955c,_0x37f8de){_0x3f955c=_0x3f955c-0x0;var _0x1b4912=_0xa3b4[_0x3f955c];return _0x1b4912;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4a3b('0x0'),_0x4a3b('0x1'),_0x4a3b('0x2')];function createListener(_0x2fb16b,_0x132420){return function(_0x256bbf){_0x132420['emit'](_0x2fb16b,_0x256bbf);};}function removeListener(_0x541d47,_0x209fe7){return function(){MailMessageEvents[_0x4a3b('0x3')](_0x541d47,_0x209fe7);};}exports[_0x4a3b('0x4')]=function(_0x3acfed){for(var _0x4b6b77=0x0,_0x249afb=events[_0x4a3b('0x5')];_0x4b6b77<_0x249afb;_0x4b6b77++){var _0x3599b0=events[_0x4b6b77];var _0x36e55a=createListener(_0x4a3b('0x6')+_0x3599b0,_0x3acfed);MailMessageEvents['on'](_0x3599b0,_0x36e55a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c5b7b37..98d9a03 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 _0x28c7=['delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','/:id','update','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x28c7,0x16b));var _0x728c=function(_0x15183c,_0xdf77be){_0x15183c=_0x15183c-0x0;var _0x13b5d4=_0x28c7[_0x15183c];return _0x13b5d4;};'use strict';var multer=require(_0x728c('0x0'));var util=require(_0x728c('0x1'));var path=require(_0x728c('0x2'));var timeout=require(_0x728c('0x3'));var express=require('express');var router=express[_0x728c('0x4')]();var auth=require(_0x728c('0x5'));var interaction=require(_0x728c('0x6'));var config=require(_0x728c('0x7'));var controller=require(_0x728c('0x8'));router[_0x728c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x728c('0xa')](),controller[_0x728c('0xb')]);router['get']('/:id',auth[_0x728c('0xa')](),controller[_0x728c('0xc')]);router[_0x728c('0x9')](_0x728c('0xd'),auth['isAuthenticated'](),controller[_0x728c('0xe')]);router[_0x728c('0x9')](_0x728c('0xf'),auth[_0x728c('0xa')](),controller[_0x728c('0x10')]);router['get']('/:id/users',auth[_0x728c('0xa')](),controller[_0x728c('0x11')]);router[_0x728c('0x12')]('/',auth['isAuthenticated'](),controller[_0x728c('0x13')]);router[_0x728c('0x12')]('/:id/teams',auth[_0x728c('0xa')](),controller[_0x728c('0x14')]);router[_0x728c('0x12')](_0x728c('0x15'),auth[_0x728c('0xa')](),controller[_0x728c('0x16')]);router[_0x728c('0x17')](_0x728c('0x18'),auth[_0x728c('0xa')](),controller[_0x728c('0x19')]);router['delete']('/:id',auth[_0x728c('0xa')](),controller[_0x728c('0x1a')]);router[_0x728c('0x1b')]('/:id/teams',auth[_0x728c('0xa')](),controller[_0x728c('0x1c')]);router[_0x728c('0x1b')](_0x728c('0x15'),auth['isAuthenticated'](),controller[_0x728c('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x74ac=['post','addTeams','addAgents','put','/:id','update','delete','removeTeams','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','describe','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x33f84a,_0x281f85){var _0x134be9=function(_0x3cc9ff){while(--_0x3cc9ff){_0x33f84a['push'](_0x33f84a['shift']());}};_0x134be9(++_0x281f85);}(_0x74ac,0xb0));var _0xc74a=function(_0x27d9aa,_0x5cf7d3){_0x27d9aa=_0x27d9aa-0x0;var _0x566413=_0x74ac[_0x27d9aa];return _0x566413;};'use strict';var multer=require(_0xc74a('0x0'));var util=require('util');var path=require(_0xc74a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc74a('0x2')]();var auth=require(_0xc74a('0x3'));var interaction=require(_0xc74a('0x4'));var config=require(_0xc74a('0x5'));var controller=require(_0xc74a('0x6'));router[_0xc74a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc74a('0x8')]);router[_0xc74a('0x7')]('/:id',auth[_0xc74a('0x9')](),controller[_0xc74a('0xa')]);router[_0xc74a('0x7')]('/:id/members',auth[_0xc74a('0x9')](),controller[_0xc74a('0xb')]);router[_0xc74a('0x7')](_0xc74a('0xc'),auth[_0xc74a('0x9')](),controller[_0xc74a('0xd')]);router[_0xc74a('0x7')](_0xc74a('0xe'),auth[_0xc74a('0x9')](),controller[_0xc74a('0xf')]);router['post']('/',auth[_0xc74a('0x9')](),controller['create']);router[_0xc74a('0x10')]('/:id/teams',auth[_0xc74a('0x9')](),controller[_0xc74a('0x11')]);router[_0xc74a('0x10')](_0xc74a('0xe'),auth[_0xc74a('0x9')](),controller[_0xc74a('0x12')]);router[_0xc74a('0x13')](_0xc74a('0x14'),auth[_0xc74a('0x9')](),controller[_0xc74a('0x15')]);router[_0xc74a('0x16')](_0xc74a('0x14'),auth[_0xc74a('0x9')](),controller['destroy']);router[_0xc74a('0x16')](_0xc74a('0xc'),auth[_0xc74a('0x9')](),controller[_0xc74a('0x17')]);router[_0xc74a('0x16')](_0xc74a('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4b6768c..8e11669 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 _0x38b8=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x2355c1,_0x5c9150){var _0x3d5eb2=function(_0x67e014){while(--_0x67e014){_0x2355c1['push'](_0x2355c1['shift']());}};_0x3d5eb2(++_0x5c9150);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x838b('0x0'));module['exports']={'name':{'type':Sequelize[_0x838b('0x1')],'unique':_0x838b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x838b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x838b('0x4'),_0x838b('0x5'))}}; \ No newline at end of file +var _0xed5c=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2ee822,_0x4c15ab){var _0x3df987=function(_0x29e89a){while(--_0x29e89a){_0x2ee822['push'](_0x2ee822['shift']());}};_0x3df987(++_0x4c15ab);}(_0xed5c,0x81));var _0xced5=function(_0x2fa5d9,_0x721069){_0x2fa5d9=_0x2fa5d9-0x0;var _0x24686e=_0xed5c[_0x2fa5d9];return _0x24686e;};'use strict';var Sequelize=require(_0xced5('0x0'));module[_0xced5('0x1')]={'name':{'type':Sequelize[_0xced5('0x2')],'unique':_0xced5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xced5('0x2')]},'timeout':{'type':Sequelize[_0xced5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xced5('0x5')](_0xced5('0x6'),_0xced5('0x7'),_0xced5('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7d76768..14e1037 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 _0xb277=['updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','sendStatus','json','count','offset','limit','status','Content-Range','save','update','destroy','then','MailQueues','end','stack','name','send','index','MailQueue','fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb277,0xbe));var _0x7b27=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb277[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b27('0x0'));var rimraf=require(_0x7b27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b27('0x2'));var rp=require(_0x7b27('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7b27('0x4'));var util=require(_0x7b27('0x5'));var path=require(_0x7b27('0x6'));var sox=require(_0x7b27('0x7'));var csv=require(_0x7b27('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7b27('0x9'));var crypto=require(_0x7b27('0xa'));var jsforce=require(_0x7b27('0xb'));var deskjs=require(_0x7b27('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b27('0xd'));var Papa=require(_0x7b27('0xe'));var Redis=require(_0x7b27('0xf'));var authService=require(_0x7b27('0x10'));var qs=require(_0x7b27('0x11'));var as=require(_0x7b27('0x12'));var hardwareService=require(_0x7b27('0x13'));var logger=require(_0x7b27('0x14'))(_0x7b27('0x15'));var utils=require(_0x7b27('0x16'));var config=require(_0x7b27('0x17'));var db=require(_0x7b27('0x18'))['db'];config[_0x7b27('0x19')]=_[_0x7b27('0x1a')](config[_0x7b27('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b27('0x19')]));require(_0x7b27('0x1b'))['register'](socket);function respondWithStatusCode(_0x34ecfa,_0x654ae5){_0x654ae5=_0x654ae5||0xcc;return function(_0x3686bc){if(_0x3686bc){return _0x34ecfa[_0x7b27('0x1c')](_0x654ae5);}return _0x34ecfa['status'](_0x654ae5)['end']();};}function respondWithResult(_0x55b4d2,_0x3004d1){_0x3004d1=_0x3004d1||0xc8;return function(_0xca7669){if(_0xca7669){return _0x55b4d2['status'](_0x3004d1)[_0x7b27('0x1d')](_0xca7669);}};}function respondWithFilteredResult(_0x4e59a0,_0x21827e){return function(_0x154335){if(_0x154335){var _0x17fc61=_0x154335[_0x7b27('0x1e')],_0x3f5172=_0x21827e[_0x7b27('0x1f')],_0x8a41b2=_0x21827e[_0x7b27('0x1f')]+_0x21827e[_0x7b27('0x20')],_0x2a1b03;if(_0x8a41b2>=_0x17fc61){_0x8a41b2=_0x17fc61;_0x2a1b03=0xc8;}else{_0x2a1b03=0xce;}_0x4e59a0[_0x7b27('0x21')](_0x2a1b03);return _0x4e59a0['set'](_0x7b27('0x22'),_0x3f5172+'-'+_0x8a41b2+'/'+_0x17fc61)[_0x7b27('0x1d')](_0x154335);}return null;};}function patchUpdates(_0x410511){return function(_0x2542f4){try{jsonpatch['apply'](_0x2542f4,_0x410511,!![]);}catch(_0x2b8293){return BPromise['reject'](_0x2b8293);}return _0x2542f4[_0x7b27('0x23')]();};}function saveUpdates(_0x1bb322,_0x45f656){return function(_0x55911c){if(_0x55911c){return _0x55911c[_0x7b27('0x24')](_0x1bb322)['then'](function(_0x1bce76){return _0x1bce76;});}return null;};}function removeEntity(_0x4f292b,_0x3b53ab){return function(_0x5ad8be){if(_0x5ad8be){return _0x5ad8be[_0x7b27('0x25')]()[_0x7b27('0x26')](function(){var _0x5e7975=_0x5ad8be['get']({'plain':!![]});var _0x328ca6=_0x7b27('0x27');return db['UserProfileResource'][_0x7b27('0x25')]({'where':{'type':_0x328ca6,'resourceId':_0x5e7975['id']}})[_0x7b27('0x26')](function(){return _0x5ad8be;});})[_0x7b27('0x26')](function(){_0x4f292b[_0x7b27('0x21')](0xcc)[_0x7b27('0x28')]();});}};}function handleEntityNotFound(_0x1551e8,_0x2f004b){return function(_0x2b377e){if(!_0x2b377e){_0x1551e8['sendStatus'](0x194);}return _0x2b377e;};}function handleError(_0x392806,_0x175525){_0x175525=_0x175525||0x1f4;return function(_0x2a7f1e){logger['error'](_0x2a7f1e[_0x7b27('0x29')]);if(_0x2a7f1e['name']){delete _0x2a7f1e[_0x7b27('0x2a')];}_0x392806[_0x7b27('0x21')](_0x175525)[_0x7b27('0x2b')](_0x2a7f1e);};}exports[_0x7b27('0x2c')]=function(_0x212903,_0x2246d8){var _0xd1d103={},_0x511718={},_0x1f3c3b={'count':0x0,'rows':[]};var _0x191df0=_['map'](db[_0x7b27('0x2d')]['rawAttributes'],function(_0x28837c){return{'name':_0x28837c[_0x7b27('0x2e')],'type':_0x28837c[_0x7b27('0x2f')]['key']};});_0x511718['model']=_[_0x7b27('0x30')](_0x191df0,_0x7b27('0x2a'));_0x511718['query']=_[_0x7b27('0x31')](_0x212903[_0x7b27('0x32')]);_0x511718[_0x7b27('0x33')]=_['intersection'](_0x511718[_0x7b27('0x34')],_0x511718[_0x7b27('0x32')]);_0xd1d103[_0x7b27('0x35')]=_[_0x7b27('0x36')](_0x511718[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x212903['query']['fields']));_0xd1d103[_0x7b27('0x35')]=_0xd1d103[_0x7b27('0x35')][_0x7b27('0x38')]?_0xd1d103['attributes']:_0x511718[_0x7b27('0x34')];if(!_0x212903[_0x7b27('0x32')]['hasOwnProperty']('nolimit')){_0xd1d103[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x212903[_0x7b27('0x32')][_0x7b27('0x20')]);_0xd1d103['offset']=qs[_0x7b27('0x1f')](_0x212903[_0x7b27('0x32')][_0x7b27('0x1f')]);}_0xd1d103[_0x7b27('0x39')]=qs['sort'](_0x212903[_0x7b27('0x32')][_0x7b27('0x3a')]);_0xd1d103['where']=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x212903['query'],_0x511718['filters']),_0x191df0);if(_0x212903[_0x7b27('0x32')]['filter']){_0xd1d103[_0x7b27('0x3c')]=_['merge'](_0xd1d103[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x191df0,function(_0x3cdc37){if(_0x3cdc37['type']!==_0x7b27('0x3d')){var _0x425597={};_0x425597[_0x3cdc37[_0x7b27('0x2a')]]={'$like':'%'+_0x212903[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x425597;}})});}_0xd1d103=_['merge']({},_0xd1d103,_0x212903[_0x7b27('0x3f')]);var _0x1f2bde={'where':_0xd1d103[_0x7b27('0x3c')]};return db[_0x7b27('0x2d')][_0x7b27('0x1e')](_0x1f2bde)[_0x7b27('0x26')](function(_0x43e54c){_0x1f3c3b[_0x7b27('0x1e')]=_0x43e54c;if(_0x212903[_0x7b27('0x32')][_0x7b27('0x40')]){_0xd1d103[_0x7b27('0x41')]=[{'all':!![]}];}return db[_0x7b27('0x2d')][_0x7b27('0x42')](_0xd1d103);})['then'](function(_0x5e5488){_0x1f3c3b[_0x7b27('0x43')]=_0x5e5488;return _0x1f3c3b;})[_0x7b27('0x26')](respondWithFilteredResult(_0x2246d8,_0xd1d103))[_0x7b27('0x44')](handleError(_0x2246d8,null));};exports[_0x7b27('0x45')]=function(_0x24e475,_0x59d45b){var _0x56dca8={'raw':!![],'where':{'id':_0x24e475['params']['id']}},_0x10110b={};_0x10110b[_0x7b27('0x34')]=_['keys'](db[_0x7b27('0x2d')][_0x7b27('0x46')]);_0x10110b['query']=_[_0x7b27('0x31')](_0x24e475[_0x7b27('0x32')]);_0x10110b[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x10110b[_0x7b27('0x34')],_0x10110b[_0x7b27('0x32')]);_0x56dca8['attributes']=_[_0x7b27('0x36')](_0x10110b[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x24e475[_0x7b27('0x32')][_0x7b27('0x37')]));_0x56dca8[_0x7b27('0x35')]=_0x56dca8[_0x7b27('0x35')][_0x7b27('0x38')]?_0x56dca8[_0x7b27('0x35')]:_0x10110b[_0x7b27('0x34')];if(_0x24e475[_0x7b27('0x32')][_0x7b27('0x40')]){_0x56dca8[_0x7b27('0x41')]=[{'all':!![]}];}_0x56dca8=_[_0x7b27('0x47')]({},_0x56dca8,_0x24e475[_0x7b27('0x3f')]);return db['MailQueue'][_0x7b27('0x48')](_0x56dca8)[_0x7b27('0x26')](handleEntityNotFound(_0x59d45b,null))['then'](respondWithResult(_0x59d45b,null))['catch'](handleError(_0x59d45b,null));};exports['create']=function(_0x4918d4,_0x273b5e){return db['MailQueue'][_0x7b27('0x49')](_0x4918d4[_0x7b27('0x4a')],{})['then'](function(_0x3769f7){var _0x1a6856=_0x4918d4[_0x7b27('0x4b')][_0x7b27('0x4c')]({'plain':!![]});if(!_0x1a6856)throw new Error(_0x7b27('0x4d'));if(_0x1a6856['role']==='user'){var _0x21ad2e=_0x3769f7[_0x7b27('0x4c')]({'plain':!![]});var _0xd084d0=_0x7b27('0x27');return db[_0x7b27('0x4e')][_0x7b27('0x48')]({'where':{'name':_0xd084d0,'userProfileId':_0x1a6856['userProfileId']},'raw':!![]})[_0x7b27('0x26')](function(_0x4778ef){if(_0x4778ef&&_0x4778ef[_0x7b27('0x4f')]===0x0){return db[_0x7b27('0x50')]['create']({'name':_0x21ad2e[_0x7b27('0x2a')],'resourceId':_0x21ad2e['id'],'type':_0x4778ef[_0x7b27('0x2a')],'sectionId':_0x4778ef['id']},{})[_0x7b27('0x26')](function(){return _0x3769f7;});}else{return _0x3769f7;}})[_0x7b27('0x44')](function(_0x3598c5){logger[_0x7b27('0x51')](_0x7b27('0x52'),_0x3598c5);throw _0x3598c5;});}return _0x3769f7;})[_0x7b27('0x26')](respondWithResult(_0x273b5e,0xc9))[_0x7b27('0x44')](handleError(_0x273b5e,null));};exports[_0x7b27('0x24')]=function(_0x1f1c01,_0x1ae672){if(_0x1f1c01[_0x7b27('0x4a')]['id']){delete _0x1f1c01[_0x7b27('0x4a')]['id'];}return db['MailQueue']['find']({'where':{'id':_0x1f1c01['params']['id']}})['then'](handleEntityNotFound(_0x1ae672,null))[_0x7b27('0x26')](saveUpdates(_0x1f1c01[_0x7b27('0x4a')],null))[_0x7b27('0x26')](respondWithResult(_0x1ae672,null))[_0x7b27('0x44')](handleError(_0x1ae672,null));};exports['destroy']=function(_0x4454ad,_0x5cf4c8){return db[_0x7b27('0x2d')]['find']({'where':{'id':_0x4454ad[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x5cf4c8,null))[_0x7b27('0x26')](removeEntity(_0x5cf4c8,null))[_0x7b27('0x44')](handleError(_0x5cf4c8,null));};exports['describe']=function(_0x3e7881,_0x532020){return db[_0x7b27('0x2d')][_0x7b27('0x54')]()[_0x7b27('0x26')](respondWithResult(_0x532020,null))[_0x7b27('0x44')](handleError(_0x532020,null));};exports[_0x7b27('0x55')]=function(_0x4c13ff,_0x486e7f,_0x158e90){var _0x302cdc={'raw':!![],'where':{}},_0x302ef1={},_0x3e978f;return db['MailQueue'][_0x7b27('0x56')]({'where':{'id':_0x4c13ff[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x486e7f,null))[_0x7b27('0x26')](function(_0x54dd21){if(_0x54dd21){_0x3e978f=_0x54dd21[_0x7b27('0x4c')]({'plain':!![]});_0x302ef1[_0x7b27('0x34')]=_[_0x7b27('0x31')](db[_0x7b27('0x57')][_0x7b27('0x46')]);_0x302ef1[_0x7b27('0x32')]=_[_0x7b27('0x31')](_0x4c13ff[_0x7b27('0x32')]);_0x302ef1[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x302ef1[_0x7b27('0x34')],_0x302ef1[_0x7b27('0x32')]);_0x302cdc[_0x7b27('0x35')]=_['intersection'](_0x302ef1[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x37')]));_0x302cdc[_0x7b27('0x35')]=_0x302cdc[_0x7b27('0x35')][_0x7b27('0x38')]?_0x302cdc[_0x7b27('0x35')]:_0x302ef1[_0x7b27('0x34')];if(!_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x302cdc['limit']=qs[_0x7b27('0x20')](_0x4c13ff[_0x7b27('0x32')]['limit']);_0x302cdc[_0x7b27('0x1f')]=qs[_0x7b27('0x1f')](_0x4c13ff['query'][_0x7b27('0x1f')]);}_0x302cdc['order']=qs[_0x7b27('0x3a')](_0x4c13ff[_0x7b27('0x32')]['sort']);_0x302cdc[_0x7b27('0x3c')]=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x4c13ff[_0x7b27('0x32')],_0x302ef1[_0x7b27('0x33')]));_0x302cdc['where'][_0x7b27('0x5a')]=_0x54dd21['id'];if(_0x4c13ff[_0x7b27('0x32')]['filter']){_0x302cdc['where']=_[_0x7b27('0x47')](_0x302cdc['where'],{'$or':_[_0x7b27('0x30')](_0x302cdc['attributes'],function(_0x30c48e){var _0x1a303e={};_0x1a303e[_0x30c48e]={'$like':'%'+_0x4c13ff[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x1a303e;})});}_0x302cdc=_[_0x7b27('0x47')]({},_0x302cdc,_0x4c13ff['options']);return db[_0x7b27('0x57')][_0x7b27('0x42')](_0x302cdc);}})[_0x7b27('0x26')](function(_0x30c18b){if(_0x30c18b){return db[_0x7b27('0x5b')][_0x7b27('0x5c')]({'where':{'id':_[_0x7b27('0x30')](_0x30c18b,_0x7b27('0x5d')),'role':_0x7b27('0x5e')},'attributes':['id',_0x7b27('0x2a'),_0x7b27('0x5f'),_0x7b27('0x60'),_0x7b27('0x61')]});}})['then'](function(_0x3f56be){if(_0x3f56be){return{'count':_0x3f56be[_0x7b27('0x1e')],'rows':_[_0x7b27('0x30')](_0x3f56be[_0x7b27('0x43')],function(_0x3843bf){return{'membername':_0x3843bf[_0x7b27('0x2a')],'UserId':_0x3843bf['id'],'queue_name':_0x3e978f['name'],'MailQueueId':_0x3e978f['id'],'interface':util['format'](_0x7b27('0x62'),'SIP',_0x3843bf['name']),'penalty':0x0,'paused':_0x3843bf['mailPause'],'createdAt':_0x3843bf[_0x7b27('0x61')],'updatedAt':_0x3843bf[_0x7b27('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7b27('0x26')](respondWithFilteredResult(_0x486e7f,_0x302cdc))['catch'](handleError(_0x486e7f,null));};exports[_0x7b27('0x63')]=function(_0x59242c,_0x26e029,_0x2a904e){var _0x45f8cb={};var _0x31991f={};var _0x4f184f;var _0xdfcab8;return db[_0x7b27('0x2d')][_0x7b27('0x56')]({'where':{'id':_0x59242c[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x26e029,null))[_0x7b27('0x26')](function(_0x1caa47){if(_0x1caa47){_0x4f184f=_0x1caa47;_0x31991f[_0x7b27('0x34')]=_[_0x7b27('0x31')](db[_0x7b27('0x64')][_0x7b27('0x46')]);_0x31991f[_0x7b27('0x32')]=_['keys'](_0x59242c[_0x7b27('0x32')]);_0x31991f[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x31991f[_0x7b27('0x34')],_0x31991f[_0x7b27('0x32')]);_0x45f8cb['attributes']=_['intersection'](_0x31991f['model'],qs[_0x7b27('0x37')](_0x59242c['query'][_0x7b27('0x37')]));_0x45f8cb['attributes']=_0x45f8cb[_0x7b27('0x35')][_0x7b27('0x38')]?_0x45f8cb[_0x7b27('0x35')]:_0x31991f[_0x7b27('0x34')];_0x45f8cb[_0x7b27('0x39')]=qs[_0x7b27('0x3a')](_0x59242c['query']['sort']);_0x45f8cb[_0x7b27('0x3c')]=qs['filters'](_[_0x7b27('0x3b')](_0x59242c['query'],_0x31991f[_0x7b27('0x33')]));if(_0x59242c[_0x7b27('0x32')][_0x7b27('0x3e')]){_0x45f8cb[_0x7b27('0x3c')]=_[_0x7b27('0x47')](_0x45f8cb[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x45f8cb[_0x7b27('0x35')],function(_0x6dde3f){var _0x2b3ded={};_0x2b3ded[_0x6dde3f]={'$like':'%'+_0x59242c[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0x2b3ded;})});}_0x45f8cb=_['merge']({},_0x45f8cb,_0x59242c[_0x7b27('0x3f')]);return _0x4f184f[_0x7b27('0x63')](_0x45f8cb);}})[_0x7b27('0x26')](function(_0x2ef54f){if(_0x2ef54f){_0xdfcab8=_0x2ef54f[_0x7b27('0x38')];if(!_0x59242c[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x45f8cb[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x59242c[_0x7b27('0x32')][_0x7b27('0x20')]);_0x45f8cb[_0x7b27('0x1f')]=qs['offset'](_0x59242c[_0x7b27('0x32')][_0x7b27('0x1f')]);}return _0x4f184f[_0x7b27('0x63')](_0x45f8cb);}})[_0x7b27('0x26')](function(_0x2c307f){if(_0x2c307f){return _0x2c307f?{'count':_0xdfcab8,'rows':_0x2c307f}:null;}})[_0x7b27('0x26')](respondWithResult(_0x26e029,null))[_0x7b27('0x44')](handleError(_0x26e029,null));};exports[_0x7b27('0x65')]=function(_0x4c850c,_0x194f25,_0x295906){var _0x24faaa=_0x4c850c['body'][_0x7b27('0x66')];return db['Team'][_0x7b27('0x42')]({'where':{'id':_0x24faaa},'attributes':['id'],'include':[{'model':db[_0x7b27('0x5b')],'as':_0x7b27('0x67'),'attributes':['id',_0x7b27('0x2a'),_0x7b27('0x68'),_0x7b27('0x69'),_0x7b27('0x6a')],'raw':!![]}]})['then'](function(_0x43be8a){if(_0x43be8a){var _0x4658d1=_[_0x7b27('0x6b')](_0x43be8a,function(_0x4b59a8){var _0x497ecb=_0x4b59a8[_0x7b27('0x4c')]({'plain':!![]});return _0x497ecb['Agents'];});return db['MailQueue'][_0x7b27('0x48')]({'where':{'id':_0x4c850c['params']['id']}})[_0x7b27('0x26')](function(_0x5e818f){return db[_0x7b27('0x6c')][_0x7b27('0x6d')](function(_0x2a0dd0){return _0x5e818f[_0x7b27('0x65')](_0x24faaa,{'transaction':_0x2a0dd0})[_0x7b27('0x26')](function(){return BPromise[_0x7b27('0x6e')](_0x4658d1,function(_0x4dd9bf){return db[_0x7b27('0x57')][_0x7b27('0x6f')]({'where':{'UserId':_0x4dd9bf['id'],'MailQueueId':_0x4c850c[_0x7b27('0x53')]['id']},'transaction':_0x2a0dd0});});})[_0x7b27('0x26')](function(){_0x4658d1[_0x7b27('0x70')](function(_0x4e5567){socket[_0x7b27('0x71')](_0x7b27('0x72'),{'UserId':_0x4e5567['id'],'MailQueueId':_0x5e818f['id']});});});});});}})[_0x7b27('0x26')](respondWithStatusCode(_0x194f25,null))[_0x7b27('0x44')](handleError(_0x194f25,null));};exports[_0x7b27('0x73')]=function(_0x4b4d2d,_0x1f092b,_0x2ff576){return db['Team'][_0x7b27('0x42')]({'where':{'id':_0x4b4d2d['query'][_0x7b27('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b27('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7b27('0x26')](handleEntityNotFound(_0x1f092b,null))[_0x7b27('0x26')](function(_0x54cb74){var _0x2b7046=_[_0x7b27('0x30')](_0x54cb74,'id');var _0x27ed7f=[];var _0x32784c=[];var _0xdaa88c=squel['select']();_0xdaa88c['field'](_0x7b27('0x74'))[_0x7b27('0x75')](_0x7b27('0x76'),'tq')[_0x7b27('0x77')](_0x7b27('0x78'),'ut',_0x7b27('0x79'))[_0x7b27('0x3c')](_0x7b27('0x7a'),_0x4b4d2d[_0x7b27('0x53')]['id']);for(var _0x56a9fa=0x0;_0x56a9fa<_0x54cb74[_0x7b27('0x38')];_0x56a9fa+=0x1){let _0x1be6b8=_0x54cb74[_0x56a9fa];for(var _0x5defc8=0x0;_0x5defc8<_0x1be6b8[_0x7b27('0x67')][_0x7b27('0x38')];_0x5defc8+=0x1){let _0x44f148=_0x1be6b8[_0x7b27('0x67')][_0x5defc8];var _0x156b47=_0xdaa88c[_0x7b27('0x7b')]();_0x156b47[_0x7b27('0x3c')](_0x7b27('0x7c'),_0x44f148['id']);_0x32784c[_0x7b27('0x7d')](db['sequelize'][_0x7b27('0x32')](_0x156b47[_0x7b27('0x7e')](),{'type':db[_0x7b27('0x6c')][_0x7b27('0x7f')][_0x7b27('0x80')]})[_0x7b27('0x26')](function(_0x29c911){if(_0x29c911[_0x7b27('0x38')]===0x1){return _0x44f148['id'];}else{var _0x5fa213=_['every'](_[_0x7b27('0x30')](_0x29c911,_0x7b27('0x81')),function(_0x41dcdc){return _[_0x7b27('0x82')](_0x2b7046,_0x41dcdc);});if(_0x5fa213){return _0x44f148['id'];}}}));}}return BPromise[_0x7b27('0x83')](_0x32784c)[_0x7b27('0x26')](function(_0x234153){_0x27ed7f=_(_0x27ed7f)[_0x7b27('0x84')](_0x234153)[_0x7b27('0x85')]()[_0x7b27('0x86')]();return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x4b4d2d[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](function(_0x5ac794){return db[_0x7b27('0x6c')][_0x7b27('0x6d')](function(_0x5c2112){return _0x5ac794[_0x7b27('0x73')](_0x4b4d2d['query'][_0x7b27('0x66')],{'transaction':_0x5c2112})[_0x7b27('0x26')](function(){if(!_[_0x7b27('0x87')](_0x27ed7f)){return _0x5ac794['removeAgents'](_0x27ed7f,{'transaction':_0x5c2112});}})[_0x7b27('0x26')](function(){_0x27ed7f['forEach'](function(_0x15b79c){socket[_0x7b27('0x71')](_0x7b27('0x88'),{'UserId':_0x15b79c,'MailQueueId':_0x5ac794['id']});});});});});});})[_0x7b27('0x26')](respondWithStatusCode(_0x1f092b,null))['catch'](handleError(_0x1f092b,null));};exports['addAgents']=function(_0x24bae1,_0x465739,_0x33dff6){return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x24bae1[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x465739,null))[_0x7b27('0x26')](function(_0x1363a7){if(_0x1363a7){return _0x1363a7[_0x7b27('0x89')](_0x24bae1[_0x7b27('0x4a')]['ids'],_[_0x7b27('0x8a')](_0x24bae1[_0x7b27('0x4a')],[_0x7b27('0x66'),'id'])||{})[_0x7b27('0x8b')](function(_0xd94141){for(var _0x196e73=0x0;_0x196e73<_0x24bae1[_0x7b27('0x4a')][_0x7b27('0x66')][_0x7b27('0x38')];_0x196e73+=0x1){socket[_0x7b27('0x71')](_0x7b27('0x72'),{'UserId':_0x24bae1['body'][_0x7b27('0x66')][_0x196e73],'MailQueueId':_0x24bae1[_0x7b27('0x53')]['id']});}return _0xd94141;});}})[_0x7b27('0x26')](respondWithResult(_0x465739,null))['catch'](handleError(_0x465739,null));};exports[_0x7b27('0x8c')]=function(_0x5c1806,_0x3f5e5e,_0x3d2dc0){return db[_0x7b27('0x2d')][_0x7b27('0x48')]({'where':{'id':_0x5c1806[_0x7b27('0x53')]['id']}})['then'](handleEntityNotFound(_0x3f5e5e,null))[_0x7b27('0x26')](function(_0x5df205){if(_0x5df205){return _0x5df205[_0x7b27('0x8c')](_0x5c1806['query']['ids'])[_0x7b27('0x26')](function(){if(_[_0x7b27('0x8d')](_0x5c1806[_0x7b27('0x32')]['ids'])){for(var _0xf59e83=0x0;_0xf59e83<_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')][_0x7b27('0x38')];_0xf59e83+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')][_0xf59e83]),'MailQueueId':Number(_0x5c1806['params']['id'])});}}else{socket[_0x7b27('0x71')](_0x7b27('0x88'),{'UserId':Number(_0x5c1806[_0x7b27('0x32')][_0x7b27('0x66')]),'MailQueueId':Number(_0x5c1806[_0x7b27('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f5e5e,null))[_0x7b27('0x44')](handleError(_0x3f5e5e,null));};exports['getAgents']=function(_0x74ec6,_0x30aa37,_0x108fba){var _0x349bf8={};var _0x180694={};var _0x1dbea5;var _0x3e97f1;return db[_0x7b27('0x2d')][_0x7b27('0x56')]({'where':{'id':_0x74ec6[_0x7b27('0x53')]['id']}})[_0x7b27('0x26')](handleEntityNotFound(_0x30aa37,null))[_0x7b27('0x26')](function(_0x3298c5){if(_0x3298c5){_0x1dbea5=_0x3298c5;_0x180694[_0x7b27('0x34')]=_[_0x7b27('0x31')](db['User'][_0x7b27('0x46')]);_0x180694[_0x7b27('0x32')]=_['keys'](_0x74ec6[_0x7b27('0x32')]);_0x180694[_0x7b27('0x33')]=_[_0x7b27('0x36')](_0x180694[_0x7b27('0x34')],_0x180694[_0x7b27('0x32')]);_0x349bf8[_0x7b27('0x35')]=_['intersection'](_0x180694[_0x7b27('0x34')],qs[_0x7b27('0x37')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x37')]));_0x349bf8['attributes']=_0x349bf8[_0x7b27('0x35')][_0x7b27('0x38')]?_0x349bf8[_0x7b27('0x35')]:_0x180694[_0x7b27('0x34')];_0x349bf8['order']=qs[_0x7b27('0x3a')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3a')]);_0x349bf8[_0x7b27('0x3c')]=qs[_0x7b27('0x33')](_[_0x7b27('0x3b')](_0x74ec6[_0x7b27('0x32')],_0x180694[_0x7b27('0x33')]));if(_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3e')]){_0x349bf8[_0x7b27('0x3c')]=_[_0x7b27('0x47')](_0x349bf8[_0x7b27('0x3c')],{'$or':_[_0x7b27('0x30')](_0x349bf8['attributes'],function(_0x1f67ce){var _0xd46db={};_0xd46db[_0x1f67ce]={'$like':'%'+_0x74ec6[_0x7b27('0x32')][_0x7b27('0x3e')]+'%'};return _0xd46db;})});}_0x349bf8=_['merge']({},_0x349bf8,_0x74ec6[_0x7b27('0x3f')]);return _0x1dbea5[_0x7b27('0x8e')](_0x349bf8);}})[_0x7b27('0x26')](function(_0x466865){if(_0x466865){_0x3e97f1=_0x466865[_0x7b27('0x38')];if(!_0x74ec6[_0x7b27('0x32')][_0x7b27('0x58')](_0x7b27('0x59'))){_0x349bf8[_0x7b27('0x20')]=qs[_0x7b27('0x20')](_0x74ec6['query'][_0x7b27('0x20')]);_0x349bf8[_0x7b27('0x1f')]=qs[_0x7b27('0x1f')](_0x74ec6[_0x7b27('0x32')][_0x7b27('0x1f')]);}return _0x1dbea5['getAgents'](_0x349bf8);}})[_0x7b27('0x26')](function(_0x316e5c){if(_0x316e5c){return _0x316e5c?{'count':_0x3e97f1,'rows':_0x316e5c}:null;}})[_0x7b27('0x26')](respondWithResult(_0x30aa37,null))[_0x7b27('0x44')](handleError(_0x30aa37,null));}; \ No newline at end of file +var _0xf024=['Agents','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','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','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','limit','set','reject','save','then','destroy','get','MailQueues','UserProfileResource','name','send','index','map','MailQueue','rawAttributes','type','filters','intersection','model','query','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','MailQueueId','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','mailPause','getTeams','Team','ids','User','online','voicePause','interface','flatMap'];(function(_0x8d2cab,_0x5d7c90){var _0x31aaf8=function(_0x3b3f8c){while(--_0x3b3f8c){_0x8d2cab['push'](_0x8d2cab['shift']());}};_0x31aaf8(++_0x5d7c90);}(_0xf024,0x19f));var _0x4f02=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xf024[_0x341e0f];return _0x59555a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f02('0x0'));var rimraf=require(_0x4f02('0x1'));var zipdir=require(_0x4f02('0x2'));var jsonpatch=require(_0x4f02('0x3'));var rp=require(_0x4f02('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4f02('0x5'));var path=require('path');var sox=require(_0x4f02('0x6'));var csv=require(_0x4f02('0x7'));var ejs=require(_0x4f02('0x8'));var fs=require('fs');var _=require(_0x4f02('0x9'));var squel=require('squel');var crypto=require(_0x4f02('0xa'));var jsforce=require(_0x4f02('0xb'));var deskjs=require(_0x4f02('0xc'));var toCsv=require(_0x4f02('0x7'));var querystring=require(_0x4f02('0xd'));var Papa=require(_0x4f02('0xe'));var Redis=require('ioredis');var authService=require(_0x4f02('0xf'));var qs=require(_0x4f02('0x10'));var as=require(_0x4f02('0x11'));var hardwareService=require(_0x4f02('0x12'));var logger=require('../../config/logger')(_0x4f02('0x13'));var utils=require(_0x4f02('0x14'));var config=require(_0x4f02('0x15'));var db=require('../../mysqldb')['db'];config[_0x4f02('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f02('0x17'))(new Redis(config['redis']));require(_0x4f02('0x18'))[_0x4f02('0x19')](socket);function respondWithStatusCode(_0x2e4faa,_0x338caa){_0x338caa=_0x338caa||0xcc;return function(_0x4a2abc){if(_0x4a2abc){return _0x2e4faa[_0x4f02('0x1a')](_0x338caa);}return _0x2e4faa[_0x4f02('0x1b')](_0x338caa)['end']();};}function respondWithResult(_0x122512,_0x22724b){_0x22724b=_0x22724b||0xc8;return function(_0x40de3f){if(_0x40de3f){return _0x122512[_0x4f02('0x1b')](_0x22724b)[_0x4f02('0x1c')](_0x40de3f);}};}function respondWithFilteredResult(_0x46e4fb,_0x4c6e58){return function(_0x20715c){if(_0x20715c){var _0x355759=_0x20715c['count'],_0x1f562f=_0x4c6e58[_0x4f02('0x1d')],_0x552ca2=_0x4c6e58[_0x4f02('0x1d')]+_0x4c6e58[_0x4f02('0x1e')],_0x382b01;if(_0x552ca2>=_0x355759){_0x552ca2=_0x355759;_0x382b01=0xc8;}else{_0x382b01=0xce;}_0x46e4fb[_0x4f02('0x1b')](_0x382b01);return _0x46e4fb[_0x4f02('0x1f')]('Content-Range',_0x1f562f+'-'+_0x552ca2+'/'+_0x355759)[_0x4f02('0x1c')](_0x20715c);}return null;};}function patchUpdates(_0xb7820f){return function(_0x5e6180){try{jsonpatch['apply'](_0x5e6180,_0xb7820f,!![]);}catch(_0x15d59e){return BPromise[_0x4f02('0x20')](_0x15d59e);}return _0x5e6180[_0x4f02('0x21')]();};}function saveUpdates(_0x413722,_0x194df7){return function(_0x88570d){if(_0x88570d){return _0x88570d['update'](_0x413722)[_0x4f02('0x22')](function(_0x5f4f15){return _0x5f4f15;});}return null;};}function removeEntity(_0x46320f,_0x524625){return function(_0x5e0a1d){if(_0x5e0a1d){return _0x5e0a1d[_0x4f02('0x23')]()[_0x4f02('0x22')](function(){var _0x28fbfa=_0x5e0a1d[_0x4f02('0x24')]({'plain':!![]});var _0x270976=_0x4f02('0x25');return db[_0x4f02('0x26')][_0x4f02('0x23')]({'where':{'type':_0x270976,'resourceId':_0x28fbfa['id']}})[_0x4f02('0x22')](function(){return _0x5e0a1d;});})[_0x4f02('0x22')](function(){_0x46320f[_0x4f02('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b7fc5,_0x1189c3){return function(_0x13c144){if(!_0x13c144){_0x1b7fc5[_0x4f02('0x1a')](0x194);}return _0x13c144;};}function handleError(_0x4245f3,_0x6d1f3f){_0x6d1f3f=_0x6d1f3f||0x1f4;return function(_0x1d69dc){logger['error'](_0x1d69dc['stack']);if(_0x1d69dc[_0x4f02('0x27')]){delete _0x1d69dc[_0x4f02('0x27')];}_0x4245f3[_0x4f02('0x1b')](_0x6d1f3f)[_0x4f02('0x28')](_0x1d69dc);};}exports[_0x4f02('0x29')]=function(_0x1d4eda,_0x2d8aec){var _0x36828a={},_0x55382f={},_0x1dc51d={'count':0x0,'rows':[]};var _0x44886e=_[_0x4f02('0x2a')](db[_0x4f02('0x2b')][_0x4f02('0x2c')],function(_0x69f154){return{'name':_0x69f154['fieldName'],'type':_0x69f154[_0x4f02('0x2d')]['key']};});_0x55382f['model']=_[_0x4f02('0x2a')](_0x44886e,_0x4f02('0x27'));_0x55382f['query']=_['keys'](_0x1d4eda['query']);_0x55382f[_0x4f02('0x2e')]=_[_0x4f02('0x2f')](_0x55382f[_0x4f02('0x30')],_0x55382f[_0x4f02('0x31')]);_0x36828a[_0x4f02('0x32')]=_[_0x4f02('0x2f')](_0x55382f['model'],qs[_0x4f02('0x33')](_0x1d4eda[_0x4f02('0x31')][_0x4f02('0x33')]));_0x36828a['attributes']=_0x36828a[_0x4f02('0x32')][_0x4f02('0x34')]?_0x36828a[_0x4f02('0x32')]:_0x55382f[_0x4f02('0x30')];if(!_0x1d4eda[_0x4f02('0x31')]['hasOwnProperty'](_0x4f02('0x35'))){_0x36828a[_0x4f02('0x1e')]=qs[_0x4f02('0x1e')](_0x1d4eda['query'][_0x4f02('0x1e')]);_0x36828a[_0x4f02('0x1d')]=qs[_0x4f02('0x1d')](_0x1d4eda[_0x4f02('0x31')][_0x4f02('0x1d')]);}_0x36828a['order']=qs[_0x4f02('0x36')](_0x1d4eda['query']['sort']);_0x36828a['where']=qs[_0x4f02('0x2e')](_[_0x4f02('0x37')](_0x1d4eda[_0x4f02('0x31')],_0x55382f[_0x4f02('0x2e')]),_0x44886e);if(_0x1d4eda[_0x4f02('0x31')][_0x4f02('0x38')]){_0x36828a[_0x4f02('0x39')]=_['merge'](_0x36828a[_0x4f02('0x39')],{'$or':_[_0x4f02('0x2a')](_0x44886e,function(_0x1135d4){if(_0x1135d4[_0x4f02('0x2d')]!==_0x4f02('0x3a')){var _0x4edc5e={};_0x4edc5e[_0x1135d4['name']]={'$like':'%'+_0x1d4eda[_0x4f02('0x31')][_0x4f02('0x38')]+'%'};return _0x4edc5e;}})});}_0x36828a=_[_0x4f02('0x3b')]({},_0x36828a,_0x1d4eda[_0x4f02('0x3c')]);var _0x7d633a={'where':_0x36828a[_0x4f02('0x39')]};return db[_0x4f02('0x2b')][_0x4f02('0x3d')](_0x7d633a)[_0x4f02('0x22')](function(_0x5a2ca7){_0x1dc51d['count']=_0x5a2ca7;if(_0x1d4eda[_0x4f02('0x31')][_0x4f02('0x3e')]){_0x36828a['include']=[{'all':!![]}];}return db[_0x4f02('0x2b')][_0x4f02('0x3f')](_0x36828a);})[_0x4f02('0x22')](function(_0x13d865){_0x1dc51d[_0x4f02('0x40')]=_0x13d865;return _0x1dc51d;})[_0x4f02('0x22')](respondWithFilteredResult(_0x2d8aec,_0x36828a))[_0x4f02('0x41')](handleError(_0x2d8aec,null));};exports[_0x4f02('0x42')]=function(_0x47804e,_0x5b25bf){var _0x3b735a={'raw':!![],'where':{'id':_0x47804e['params']['id']}},_0x5505dc={};_0x5505dc[_0x4f02('0x30')]=_[_0x4f02('0x43')](db[_0x4f02('0x2b')][_0x4f02('0x2c')]);_0x5505dc['query']=_[_0x4f02('0x43')](_0x47804e['query']);_0x5505dc[_0x4f02('0x2e')]=_[_0x4f02('0x2f')](_0x5505dc[_0x4f02('0x30')],_0x5505dc['query']);_0x3b735a[_0x4f02('0x32')]=_[_0x4f02('0x2f')](_0x5505dc[_0x4f02('0x30')],qs[_0x4f02('0x33')](_0x47804e['query']['fields']));_0x3b735a['attributes']=_0x3b735a['attributes'][_0x4f02('0x34')]?_0x3b735a[_0x4f02('0x32')]:_0x5505dc['model'];if(_0x47804e[_0x4f02('0x31')][_0x4f02('0x3e')]){_0x3b735a[_0x4f02('0x44')]=[{'all':!![]}];}_0x3b735a=_['merge']({},_0x3b735a,_0x47804e['options']);return db[_0x4f02('0x2b')][_0x4f02('0x45')](_0x3b735a)[_0x4f02('0x22')](handleEntityNotFound(_0x5b25bf,null))['then'](respondWithResult(_0x5b25bf,null))[_0x4f02('0x41')](handleError(_0x5b25bf,null));};exports[_0x4f02('0x46')]=function(_0x26b95c,_0x805bfd){return db[_0x4f02('0x2b')][_0x4f02('0x46')](_0x26b95c[_0x4f02('0x47')],{})['then'](function(_0x252dd2){var _0x8e6724=_0x26b95c[_0x4f02('0x48')][_0x4f02('0x24')]({'plain':!![]});if(!_0x8e6724)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8e6724[_0x4f02('0x49')]===_0x4f02('0x48')){var _0xe6bbbf=_0x252dd2['get']({'plain':!![]});var _0x3a7f5b='MailQueues';return db[_0x4f02('0x4a')][_0x4f02('0x45')]({'where':{'name':_0x3a7f5b,'userProfileId':_0x8e6724[_0x4f02('0x4b')]},'raw':!![]})[_0x4f02('0x22')](function(_0x5ac6c4){if(_0x5ac6c4&&_0x5ac6c4[_0x4f02('0x4c')]===0x0){return db[_0x4f02('0x26')]['create']({'name':_0xe6bbbf[_0x4f02('0x27')],'resourceId':_0xe6bbbf['id'],'type':_0x5ac6c4[_0x4f02('0x27')],'sectionId':_0x5ac6c4['id']},{})[_0x4f02('0x22')](function(){return _0x252dd2;});}else{return _0x252dd2;}})[_0x4f02('0x41')](function(_0x230ad4){logger[_0x4f02('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x230ad4);throw _0x230ad4;});}return _0x252dd2;})[_0x4f02('0x22')](respondWithResult(_0x805bfd,0xc9))[_0x4f02('0x41')](handleError(_0x805bfd,null));};exports['update']=function(_0x1bedd2,_0x4d8b5e){if(_0x1bedd2[_0x4f02('0x47')]['id']){delete _0x1bedd2[_0x4f02('0x47')]['id'];}return db[_0x4f02('0x2b')][_0x4f02('0x45')]({'where':{'id':_0x1bedd2['params']['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x4d8b5e,null))[_0x4f02('0x22')](saveUpdates(_0x1bedd2[_0x4f02('0x47')],null))[_0x4f02('0x22')](respondWithResult(_0x4d8b5e,null))[_0x4f02('0x41')](handleError(_0x4d8b5e,null));};exports['destroy']=function(_0x35d9b3,_0x2460f2){return db['MailQueue'][_0x4f02('0x45')]({'where':{'id':_0x35d9b3[_0x4f02('0x4e')]['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x2460f2,null))[_0x4f02('0x22')](removeEntity(_0x2460f2,null))[_0x4f02('0x41')](handleError(_0x2460f2,null));};exports[_0x4f02('0x4f')]=function(_0x5bbe2a,_0x292e2b){return db[_0x4f02('0x2b')]['describe']()[_0x4f02('0x22')](respondWithResult(_0x292e2b,null))[_0x4f02('0x41')](handleError(_0x292e2b,null));};exports[_0x4f02('0x50')]=function(_0x176783,_0x484570,_0xc99caf){var _0x545ec1={'raw':!![],'where':{}},_0xf9e559={},_0x1a06cc;return db[_0x4f02('0x2b')][_0x4f02('0x51')]({'where':{'id':_0x176783[_0x4f02('0x4e')]['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x484570,null))[_0x4f02('0x22')](function(_0x5a0254){if(_0x5a0254){_0x1a06cc=_0x5a0254['get']({'plain':!![]});_0xf9e559[_0x4f02('0x30')]=_[_0x4f02('0x43')](db[_0x4f02('0x52')][_0x4f02('0x2c')]);_0xf9e559[_0x4f02('0x31')]=_['keys'](_0x176783[_0x4f02('0x31')]);_0xf9e559['filters']=_['intersection'](_0xf9e559[_0x4f02('0x30')],_0xf9e559[_0x4f02('0x31')]);_0x545ec1[_0x4f02('0x32')]=_[_0x4f02('0x2f')](_0xf9e559[_0x4f02('0x30')],qs['fields'](_0x176783['query'][_0x4f02('0x33')]));_0x545ec1[_0x4f02('0x32')]=_0x545ec1[_0x4f02('0x32')][_0x4f02('0x34')]?_0x545ec1[_0x4f02('0x32')]:_0xf9e559['model'];if(!_0x176783[_0x4f02('0x31')][_0x4f02('0x53')]('nolimit')){_0x545ec1[_0x4f02('0x1e')]=qs[_0x4f02('0x1e')](_0x176783['query'][_0x4f02('0x1e')]);_0x545ec1[_0x4f02('0x1d')]=qs[_0x4f02('0x1d')](_0x176783[_0x4f02('0x31')]['offset']);}_0x545ec1['order']=qs[_0x4f02('0x36')](_0x176783[_0x4f02('0x31')][_0x4f02('0x36')]);_0x545ec1[_0x4f02('0x39')]=qs[_0x4f02('0x2e')](_[_0x4f02('0x37')](_0x176783[_0x4f02('0x31')],_0xf9e559[_0x4f02('0x2e')]));_0x545ec1[_0x4f02('0x39')][_0x4f02('0x54')]=_0x5a0254['id'];if(_0x176783[_0x4f02('0x31')][_0x4f02('0x38')]){_0x545ec1[_0x4f02('0x39')]=_[_0x4f02('0x3b')](_0x545ec1[_0x4f02('0x39')],{'$or':_[_0x4f02('0x2a')](_0x545ec1['attributes'],function(_0x177152){var _0x4a051a={};_0x4a051a[_0x177152]={'$like':'%'+_0x176783[_0x4f02('0x31')][_0x4f02('0x38')]+'%'};return _0x4a051a;})});}_0x545ec1=_['merge']({},_0x545ec1,_0x176783[_0x4f02('0x3c')]);return db[_0x4f02('0x52')][_0x4f02('0x3f')](_0x545ec1);}})['then'](function(_0x24df5d){if(_0x24df5d){return db['User'][_0x4f02('0x55')]({'where':{'id':_[_0x4f02('0x2a')](_0x24df5d,_0x4f02('0x56')),'role':_0x4f02('0x57')},'attributes':['id',_0x4f02('0x27'),'mailPause',_0x4f02('0x58'),_0x4f02('0x59')]});}})[_0x4f02('0x22')](function(_0x2a076c){if(_0x2a076c){return{'count':_0x2a076c[_0x4f02('0x3d')],'rows':_[_0x4f02('0x2a')](_0x2a076c[_0x4f02('0x40')],function(_0x2b5270){return{'membername':_0x2b5270['name'],'UserId':_0x2b5270['id'],'queue_name':_0x1a06cc[_0x4f02('0x27')],'MailQueueId':_0x1a06cc['id'],'interface':util[_0x4f02('0x5a')]('%s/%s',_0x4f02('0x5b'),_0x2b5270[_0x4f02('0x27')]),'penalty':0x0,'paused':_0x2b5270[_0x4f02('0x5c')],'createdAt':_0x2b5270[_0x4f02('0x59')],'updatedAt':_0x2b5270['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x484570,_0x545ec1))['catch'](handleError(_0x484570,null));};exports[_0x4f02('0x5d')]=function(_0x1c41e5,_0xbfb98,_0x28ea69){var _0x3f1417={};var _0x19fd8e={};var _0xff6aef;var _0x2ce58a;return db[_0x4f02('0x2b')][_0x4f02('0x51')]({'where':{'id':_0x1c41e5[_0x4f02('0x4e')]['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0xbfb98,null))[_0x4f02('0x22')](function(_0x2d6f14){if(_0x2d6f14){_0xff6aef=_0x2d6f14;_0x19fd8e[_0x4f02('0x30')]=_[_0x4f02('0x43')](db[_0x4f02('0x5e')][_0x4f02('0x2c')]);_0x19fd8e[_0x4f02('0x31')]=_[_0x4f02('0x43')](_0x1c41e5[_0x4f02('0x31')]);_0x19fd8e[_0x4f02('0x2e')]=_[_0x4f02('0x2f')](_0x19fd8e[_0x4f02('0x30')],_0x19fd8e[_0x4f02('0x31')]);_0x3f1417[_0x4f02('0x32')]=_[_0x4f02('0x2f')](_0x19fd8e[_0x4f02('0x30')],qs['fields'](_0x1c41e5[_0x4f02('0x31')]['fields']));_0x3f1417['attributes']=_0x3f1417[_0x4f02('0x32')][_0x4f02('0x34')]?_0x3f1417[_0x4f02('0x32')]:_0x19fd8e[_0x4f02('0x30')];_0x3f1417['order']=qs[_0x4f02('0x36')](_0x1c41e5[_0x4f02('0x31')][_0x4f02('0x36')]);_0x3f1417[_0x4f02('0x39')]=qs[_0x4f02('0x2e')](_['pick'](_0x1c41e5[_0x4f02('0x31')],_0x19fd8e[_0x4f02('0x2e')]));if(_0x1c41e5[_0x4f02('0x31')][_0x4f02('0x38')]){_0x3f1417[_0x4f02('0x39')]=_[_0x4f02('0x3b')](_0x3f1417[_0x4f02('0x39')],{'$or':_['map'](_0x3f1417[_0x4f02('0x32')],function(_0x47ed5a){var _0xe7bb3a={};_0xe7bb3a[_0x47ed5a]={'$like':'%'+_0x1c41e5[_0x4f02('0x31')][_0x4f02('0x38')]+'%'};return _0xe7bb3a;})});}_0x3f1417=_['merge']({},_0x3f1417,_0x1c41e5['options']);return _0xff6aef[_0x4f02('0x5d')](_0x3f1417);}})['then'](function(_0x3ddaf1){if(_0x3ddaf1){_0x2ce58a=_0x3ddaf1['length'];if(!_0x1c41e5[_0x4f02('0x31')]['hasOwnProperty'](_0x4f02('0x35'))){_0x3f1417[_0x4f02('0x1e')]=qs[_0x4f02('0x1e')](_0x1c41e5['query']['limit']);_0x3f1417['offset']=qs[_0x4f02('0x1d')](_0x1c41e5[_0x4f02('0x31')][_0x4f02('0x1d')]);}return _0xff6aef['getTeams'](_0x3f1417);}})[_0x4f02('0x22')](function(_0x85a71a){if(_0x85a71a){return _0x85a71a?{'count':_0x2ce58a,'rows':_0x85a71a}:null;}})[_0x4f02('0x22')](respondWithResult(_0xbfb98,null))['catch'](handleError(_0xbfb98,null));};exports['addTeams']=function(_0x124e56,_0x492d7c,_0x191a5b){var _0x303ab2=_0x124e56['body'][_0x4f02('0x5f')];return db['Team']['findAll']({'where':{'id':_0x303ab2},'attributes':['id'],'include':[{'model':db[_0x4f02('0x60')],'as':'Agents','attributes':['id',_0x4f02('0x27'),_0x4f02('0x61'),_0x4f02('0x62'),_0x4f02('0x63')],'raw':!![]}]})[_0x4f02('0x22')](function(_0xcbe08){if(_0xcbe08){var _0x1f59ec=_[_0x4f02('0x64')](_0xcbe08,function(_0x47275a){var _0x2f64b5=_0x47275a[_0x4f02('0x24')]({'plain':!![]});return _0x2f64b5[_0x4f02('0x65')];});return db['MailQueue'][_0x4f02('0x45')]({'where':{'id':_0x124e56['params']['id']}})[_0x4f02('0x22')](function(_0x17a54e){return db[_0x4f02('0x66')][_0x4f02('0x67')](function(_0x3dd576){return _0x17a54e['addTeams'](_0x303ab2,{'transaction':_0x3dd576})[_0x4f02('0x22')](function(){return BPromise['each'](_0x1f59ec,function(_0x5f04b4){return db[_0x4f02('0x52')]['findOrCreate']({'where':{'UserId':_0x5f04b4['id'],'MailQueueId':_0x124e56[_0x4f02('0x4e')]['id']},'transaction':_0x3dd576});});})[_0x4f02('0x22')](function(){_0x1f59ec[_0x4f02('0x68')](function(_0x8cad38){socket[_0x4f02('0x69')](_0x4f02('0x6a'),{'UserId':_0x8cad38['id'],'MailQueueId':_0x17a54e['id']});});});});});}})[_0x4f02('0x22')](respondWithStatusCode(_0x492d7c,null))[_0x4f02('0x41')](handleError(_0x492d7c,null));};exports[_0x4f02('0x6b')]=function(_0x48a75e,_0x12c189,_0x2064c3){return db[_0x4f02('0x5e')][_0x4f02('0x3f')]({'where':{'id':_0x48a75e[_0x4f02('0x31')][_0x4f02('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4f02('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4f02('0x22')](handleEntityNotFound(_0x12c189,null))[_0x4f02('0x22')](function(_0x5a0dd9){var _0x3b0935=_[_0x4f02('0x2a')](_0x5a0dd9,'id');var _0x2087a0=[];var _0x55cdb3=[];var _0x56acdd=squel[_0x4f02('0x6c')]();_0x56acdd[_0x4f02('0x6d')]('tq.TeamId')[_0x4f02('0x6e')](_0x4f02('0x6f'),'tq')[_0x4f02('0x70')]('user_has_teams','ut',_0x4f02('0x71'))['where']('MailQueueId\x20=\x20?',_0x48a75e[_0x4f02('0x4e')]['id']);for(var _0x3c88eb=0x0;_0x3c88eb<_0x5a0dd9[_0x4f02('0x34')];_0x3c88eb+=0x1){let _0x5400dc=_0x5a0dd9[_0x3c88eb];for(var _0x180c2f=0x0;_0x180c2f<_0x5400dc[_0x4f02('0x65')][_0x4f02('0x34')];_0x180c2f+=0x1){let _0x2bcfe3=_0x5400dc['Agents'][_0x180c2f];var _0xa24b26=_0x56acdd['clone']();_0xa24b26[_0x4f02('0x39')]('ut.UserId\x20=\x20?',_0x2bcfe3['id']);_0x55cdb3[_0x4f02('0x72')](db[_0x4f02('0x66')][_0x4f02('0x31')](_0xa24b26[_0x4f02('0x73')](),{'type':db[_0x4f02('0x66')][_0x4f02('0x74')][_0x4f02('0x75')]})[_0x4f02('0x22')](function(_0x4c415d){if(_0x4c415d[_0x4f02('0x34')]===0x1){return _0x2bcfe3['id'];}else{var _0x146b02=_['every'](_[_0x4f02('0x2a')](_0x4c415d,'TeamId'),function(_0x524a31){return _['includes'](_0x3b0935,_0x524a31);});if(_0x146b02){return _0x2bcfe3['id'];}}}));}}return BPromise[_0x4f02('0x76')](_0x55cdb3)[_0x4f02('0x22')](function(_0x1fe2c9){_0x2087a0=_(_0x2087a0)[_0x4f02('0x77')](_0x1fe2c9)[_0x4f02('0x78')]()[_0x4f02('0x79')]();return db[_0x4f02('0x2b')][_0x4f02('0x45')]({'where':{'id':_0x48a75e['params']['id']}})[_0x4f02('0x22')](function(_0x172293){return db[_0x4f02('0x66')][_0x4f02('0x67')](function(_0x726dee){return _0x172293[_0x4f02('0x6b')](_0x48a75e['query']['ids'],{'transaction':_0x726dee})[_0x4f02('0x22')](function(){if(!_[_0x4f02('0x7a')](_0x2087a0)){return _0x172293[_0x4f02('0x7b')](_0x2087a0,{'transaction':_0x726dee});}})[_0x4f02('0x22')](function(){_0x2087a0[_0x4f02('0x68')](function(_0x2b514e){socket[_0x4f02('0x69')](_0x4f02('0x7c'),{'UserId':_0x2b514e,'MailQueueId':_0x172293['id']});});});});});});})[_0x4f02('0x22')](respondWithStatusCode(_0x12c189,null))[_0x4f02('0x41')](handleError(_0x12c189,null));};exports[_0x4f02('0x7d')]=function(_0x22dfea,_0x53b700,_0x2262aa){return db[_0x4f02('0x2b')][_0x4f02('0x45')]({'where':{'id':_0x22dfea[_0x4f02('0x4e')]['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x53b700,null))[_0x4f02('0x22')](function(_0x48c7eb){if(_0x48c7eb){return _0x48c7eb[_0x4f02('0x7d')](_0x22dfea[_0x4f02('0x47')][_0x4f02('0x5f')],_['omit'](_0x22dfea['body'],[_0x4f02('0x5f'),'id'])||{})['spread'](function(_0x301e13){for(var _0x1805d6=0x0;_0x1805d6<_0x22dfea['body'][_0x4f02('0x5f')]['length'];_0x1805d6+=0x1){socket[_0x4f02('0x69')](_0x4f02('0x6a'),{'UserId':_0x22dfea['body'][_0x4f02('0x5f')][_0x1805d6],'MailQueueId':_0x22dfea[_0x4f02('0x4e')]['id']});}return _0x301e13;});}})['then'](respondWithResult(_0x53b700,null))[_0x4f02('0x41')](handleError(_0x53b700,null));};exports['removeAgents']=function(_0x30be1d,_0x565373,_0x4095cb){return db[_0x4f02('0x2b')][_0x4f02('0x45')]({'where':{'id':_0x30be1d[_0x4f02('0x4e')]['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x565373,null))[_0x4f02('0x22')](function(_0x3733c6){if(_0x3733c6){return _0x3733c6[_0x4f02('0x7b')](_0x30be1d['query']['ids'])['then'](function(){if(_[_0x4f02('0x7e')](_0x30be1d[_0x4f02('0x31')][_0x4f02('0x5f')])){for(var _0x48792f=0x0;_0x48792f<_0x30be1d['query'][_0x4f02('0x5f')]['length'];_0x48792f+=0x1){socket['emit'](_0x4f02('0x7c'),{'UserId':Number(_0x30be1d[_0x4f02('0x31')]['ids'][_0x48792f]),'MailQueueId':Number(_0x30be1d[_0x4f02('0x4e')]['id'])});}}else{socket[_0x4f02('0x69')]('userMailQueue:remove',{'UserId':Number(_0x30be1d[_0x4f02('0x31')][_0x4f02('0x5f')]),'MailQueueId':Number(_0x30be1d[_0x4f02('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x565373,null))['catch'](handleError(_0x565373,null));};exports[_0x4f02('0x7f')]=function(_0x4171d1,_0x19076c,_0x53f193){var _0x1132bb={};var _0x2f5713={};var _0x5a945d;var _0x2baf77;return db[_0x4f02('0x2b')][_0x4f02('0x51')]({'where':{'id':_0x4171d1['params']['id']}})[_0x4f02('0x22')](handleEntityNotFound(_0x19076c,null))['then'](function(_0x1afe1c){if(_0x1afe1c){_0x5a945d=_0x1afe1c;_0x2f5713[_0x4f02('0x30')]=_[_0x4f02('0x43')](db['User'][_0x4f02('0x2c')]);_0x2f5713[_0x4f02('0x31')]=_[_0x4f02('0x43')](_0x4171d1[_0x4f02('0x31')]);_0x2f5713[_0x4f02('0x2e')]=_[_0x4f02('0x2f')](_0x2f5713[_0x4f02('0x30')],_0x2f5713[_0x4f02('0x31')]);_0x1132bb['attributes']=_[_0x4f02('0x2f')](_0x2f5713[_0x4f02('0x30')],qs[_0x4f02('0x33')](_0x4171d1[_0x4f02('0x31')][_0x4f02('0x33')]));_0x1132bb[_0x4f02('0x32')]=_0x1132bb[_0x4f02('0x32')][_0x4f02('0x34')]?_0x1132bb['attributes']:_0x2f5713[_0x4f02('0x30')];_0x1132bb[_0x4f02('0x80')]=qs['sort'](_0x4171d1[_0x4f02('0x31')][_0x4f02('0x36')]);_0x1132bb[_0x4f02('0x39')]=qs[_0x4f02('0x2e')](_[_0x4f02('0x37')](_0x4171d1[_0x4f02('0x31')],_0x2f5713[_0x4f02('0x2e')]));if(_0x4171d1[_0x4f02('0x31')][_0x4f02('0x38')]){_0x1132bb[_0x4f02('0x39')]=_[_0x4f02('0x3b')](_0x1132bb[_0x4f02('0x39')],{'$or':_['map'](_0x1132bb[_0x4f02('0x32')],function(_0x5c8334){var _0xb7da07={};_0xb7da07[_0x5c8334]={'$like':'%'+_0x4171d1[_0x4f02('0x31')][_0x4f02('0x38')]+'%'};return _0xb7da07;})});}_0x1132bb=_[_0x4f02('0x3b')]({},_0x1132bb,_0x4171d1['options']);return _0x5a945d[_0x4f02('0x7f')](_0x1132bb);}})[_0x4f02('0x22')](function(_0x46cae6){if(_0x46cae6){_0x2baf77=_0x46cae6[_0x4f02('0x34')];if(!_0x4171d1['query'][_0x4f02('0x53')](_0x4f02('0x35'))){_0x1132bb['limit']=qs[_0x4f02('0x1e')](_0x4171d1[_0x4f02('0x31')][_0x4f02('0x1e')]);_0x1132bb['offset']=qs[_0x4f02('0x1d')](_0x4171d1['query'][_0x4f02('0x1d')]);}return _0x5a945d[_0x4f02('0x7f')](_0x1132bb);}})['then'](function(_0x916543){if(_0x916543){return _0x916543?{'count':_0x2baf77,'rows':_0x916543}:null;}})[_0x4f02('0x22')](respondWithResult(_0x19076c,null))['catch'](handleError(_0x19076c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e51d326..fe0ce18 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 _0x237a=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x2041a,_0x1dd54b){var _0x1d09b9=function(_0x5278cc){while(--_0x5278cc){_0x2041a['push'](_0x2041a['shift']());}};_0x1d09b9(++_0x1dd54b);}(_0x237a,0x177));var _0xa237=function(_0x1a8615,_0x16dabe){_0x1a8615=_0x1a8615-0x0;var _0x1e613c=_0x237a[_0x1a8615];return _0x1e613c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xa237('0x0'))['db'][_0xa237('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa237('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa237('0x3'),'afterDestroy':_0xa237('0x4')};function emitEvent(_0x3685f1){return function(_0x25f5f4,_0xbf16d1,_0x17aad4){MailQueueEvents[_0xa237('0x5')](_0x3685f1+':'+_0x25f5f4['id'],_0x25f5f4);MailQueueEvents[_0xa237('0x5')](_0x3685f1,_0x25f5f4);_0x17aad4(null);};}for(var e in events){if(events[_0xa237('0x6')](e)){var event=events[e];MailQueue[_0xa237('0x7')](e,emitEvent(event));}}module[_0xa237('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xeae8=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x5c622a,_0x5af186){var _0x37fb97=function(_0x17ee3d){while(--_0x17ee3d){_0x5c622a['push'](_0x5c622a['shift']());}};_0x37fb97(++_0x5af186);}(_0xeae8,0x1e9));var _0x8eae=function(_0x1acbb2,_0x16a638){_0x1acbb2=_0x1acbb2-0x0;var _0x5ecada=_0xeae8[_0x1acbb2];return _0x5ecada;};'use strict';var EventEmitter=require(_0x8eae('0x0'));var MailQueue=require(_0x8eae('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8eae('0x2')](0x0);var events={'afterCreate':_0x8eae('0x3'),'afterUpdate':_0x8eae('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d7330){return function(_0x4d95ca,_0x39bc8b,_0xbd3b35){MailQueueEvents[_0x8eae('0x5')](_0x4d7330+':'+_0x4d95ca['id'],_0x4d95ca);MailQueueEvents[_0x8eae('0x5')](_0x4d7330,_0x4d95ca);_0xbd3b35(null);};}for(var e in events){if(events[_0x8eae('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8eae('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 76d601e..58d6f28 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 _0x8bd4=['define','MailQueue','mail_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x259853,_0x32ca57){var _0xbfc349=function(_0x303436){while(--_0x303436){_0x259853['push'](_0x259853['shift']());}};_0xbfc349(++_0x32ca57);}(_0x8bd4,0x142));var _0x48bd=function(_0xf91212,_0x1ed44d){_0xf91212=_0xf91212-0x0;var _0x1afba7=_0x8bd4[_0xf91212];return _0x1afba7;};'use strict';var _=require(_0x48bd('0x0'));var util=require(_0x48bd('0x1'));var logger=require(_0x48bd('0x2'))('api');var moment=require(_0x48bd('0x3'));var BPromise=require('bluebird');var rp=require(_0x48bd('0x4'));var fs=require('fs');var path=require(_0x48bd('0x5'));var rimraf=require('rimraf');var config=require(_0x48bd('0x6'));var attributes=require('./mailQueue.attributes');module[_0x48bd('0x7')]=function(_0xe49873,_0x591ea2){return _0xe49873[_0x48bd('0x8')](_0x48bd('0x9'),attributes,{'tableName':_0x48bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd99=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xfd99,0xe1));var _0x9fd9=function(_0x225a60,_0x3a7ce4){_0x225a60=_0x225a60-0x0;var _0xc184a=_0xfd99[_0x225a60];return _0xc184a;};'use strict';var _=require(_0x9fd9('0x0'));var util=require(_0x9fd9('0x1'));var logger=require(_0x9fd9('0x2'))(_0x9fd9('0x3'));var moment=require(_0x9fd9('0x4'));var BPromise=require(_0x9fd9('0x5'));var rp=require(_0x9fd9('0x6'));var fs=require('fs');var path=require(_0x9fd9('0x7'));var rimraf=require(_0x9fd9('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x9fd9('0x9')]=function(_0x122a92,_0x245d13){return _0x122a92[_0x9fd9('0xa')](_0x9fd9('0xb'),attributes,{'tableName':_0x9fd9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index be3c9e1..7969572 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 _0xd506=['result','catch','options','raw','attributes','limit','include','map','model','GetMailQueue','debug','ShowMailQueue','MailQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x31ba0d,_0x2ce714){var _0x25f065=function(_0x23dece){while(--_0x23dece){_0x31ba0d['push'](_0x31ba0d['shift']());}};_0x25f065(++_0x2ce714);}(_0xd506,0xae));var _0x6d50=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd506[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x6d50('0x0'));var util=require(_0x6d50('0x1'));var moment=require(_0x6d50('0x2'));var BPromise=require(_0x6d50('0x3'));var rs=require(_0x6d50('0x4'));var fs=require('fs');var Redis=require(_0x6d50('0x5'));var db=require(_0x6d50('0x6'))['db'];var utils=require(_0x6d50('0x7'));var logger=require('../../config/logger')(_0x6d50('0x8'));var config=require(_0x6d50('0x9'));var jayson=require(_0x6d50('0xa'));var client=jayson[_0x6d50('0xb')][_0x6d50('0xc')]({'port':0x232a});config[_0x6d50('0xd')]=_['defaults'](config[_0x6d50('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d50('0xd')]));require(_0x6d50('0xe'))[_0x6d50('0xf')](socket);function respondWithRpcPromise(_0x2f813e,_0x478619,_0x54c071){return new BPromise(function(_0x5a6590,_0x52941c){return client[_0x6d50('0x10')](_0x2f813e,_0x54c071)[_0x6d50('0x11')](function(_0x24b50f){logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x478619,_0x6d50('0x14'));logger['debug'](_0x6d50('0x15'),_0x478619,_0x6d50('0x14'),JSON[_0x6d50('0x16')](_0x24b50f));if(_0x24b50f[_0x6d50('0x17')]){if(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x18')]===0x1f4){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x478619,_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);return _0x52941c(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);}logger[_0x6d50('0x17')]('MailQueue,\x20%s,\x20%s',_0x478619,_0x24b50f[_0x6d50('0x17')]['message']);return _0x5a6590(_0x24b50f[_0x6d50('0x17')][_0x6d50('0x19')]);}else{logger[_0x6d50('0x12')](_0x6d50('0x13'),_0x478619,_0x6d50('0x14'));_0x5a6590(_0x24b50f[_0x6d50('0x1a')][_0x6d50('0x19')]);}})[_0x6d50('0x1b')](function(_0x18b601){logger[_0x6d50('0x17')](_0x6d50('0x13'),_0x478619,_0x18b601);_0x52941c(_0x18b601);});});}exports['GetMailQueue']=function(_0x5c351f){var _0x88a175=this;return new Promise(function(_0x329c88,_0x52dfdb){return db['MailQueue']['findAll']({'raw':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f['options']['where']||null:null,'attributes':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1e')]||null:null,'limit':_0x5c351f['options']?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x1f')]||null:null,'include':_0x5c351f[_0x6d50('0x1c')]?_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x5c351f[_0x6d50('0x1c')][_0x6d50('0x20')],function(_0x2fa839){return{'model':db[_0x2fa839[_0x6d50('0x22')]],'as':_0x2fa839['as'],'attributes':_0x2fa839['attributes'],'include':_0x2fa839['include']?_[_0x6d50('0x21')](_0x2fa839['include'],function(_0x59ffc8){return{'model':db[_0x59ffc8['model']],'as':_0x59ffc8['as'],'attributes':_0x59ffc8[_0x6d50('0x1e')],'include':_0x59ffc8[_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x59ffc8[_0x6d50('0x20')],function(_0x3f0435){return{'model':db[_0x3f0435['model']],'as':_0x3f0435['as'],'attributes':_0x3f0435[_0x6d50('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6d50('0x11')](function(_0x689902){logger[_0x6d50('0x12')](_0x6d50('0x23'),_0x5c351f);logger[_0x6d50('0x24')](_0x6d50('0x23'),_0x5c351f,JSON[_0x6d50('0x16')](_0x689902));_0x329c88(_0x689902);})['catch'](function(_0x3f641a){logger['error']('GetMailQueue',_0x3f641a[_0x6d50('0x19')],_0x5c351f);_0x52dfdb(_0x88a175['error'](0x1f4,_0x3f641a['message']));});});};exports[_0x6d50('0x25')]=function(_0x1203f5){var _0x507bcb=this;return new Promise(function(_0x532f84,_0x2be344){return db[_0x6d50('0x26')]['find']({'raw':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options'][_0x6d50('0x1d')]===undefined?!![]:![]:!![],'where':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options'][_0x6d50('0x27')]||null:null,'attributes':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5[_0x6d50('0x1c')][_0x6d50('0x1e')]||null:null,'include':_0x1203f5[_0x6d50('0x1c')]?_0x1203f5['options']['include']?_['map'](_0x1203f5['options'][_0x6d50('0x20')],function(_0x185e93){return{'model':db[_0x185e93[_0x6d50('0x22')]],'as':_0x185e93['as'],'attributes':_0x185e93['attributes'],'include':_0x185e93[_0x6d50('0x20')]?_[_0x6d50('0x21')](_0x185e93[_0x6d50('0x20')],function(_0x5113f0){return{'model':db[_0x5113f0[_0x6d50('0x22')]],'as':_0x5113f0['as'],'attributes':_0x5113f0[_0x6d50('0x1e')],'include':_0x5113f0['include']?_[_0x6d50('0x21')](_0x5113f0[_0x6d50('0x20')],function(_0x366c1e){return{'model':db[_0x366c1e['model']],'as':_0x366c1e['as'],'attributes':_0x366c1e[_0x6d50('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6d50('0x11')](function(_0x372737){logger[_0x6d50('0x12')](_0x6d50('0x25'),_0x1203f5);logger[_0x6d50('0x24')]('ShowMailQueue',_0x1203f5,JSON[_0x6d50('0x16')](_0x372737));_0x532f84(_0x372737);})[_0x6d50('0x1b')](function(_0x5bc37c){logger['error'](_0x6d50('0x25'),_0x5bc37c[_0x6d50('0x19')],_0x1203f5);_0x2be344(_0x507bcb[_0x6d50('0x17')](0x1f4,_0x5bc37c['message']));});});}; \ No newline at end of file +var _0x3286=['error','MailQueue,\x20%s,\x20%s','message','info','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','GetMailQueue','ShowMailQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4cf88d,_0x5de590){var _0x1f49c0=function(_0x3aba91){while(--_0x3aba91){_0x4cf88d['push'](_0x4cf88d['shift']());}};_0x1f49c0(++_0x5de590);}(_0x3286,0x1da));var _0x6328=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3286[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6328('0x0'));var util=require('util');var moment=require(_0x6328('0x1'));var BPromise=require('bluebird');var rs=require(_0x6328('0x2'));var fs=require('fs');var Redis=require(_0x6328('0x3'));var db=require(_0x6328('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6328('0x5'))(_0x6328('0x6'));var config=require(_0x6328('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6328('0x8')][_0x6328('0x9')]({'port':0x232a});config[_0x6328('0xa')]=_['defaults'](config[_0x6328('0xa')],{'host':_0x6328('0xb'),'port':0x18eb});var socket=require(_0x6328('0xc'))(new Redis(config[_0x6328('0xa')]));require(_0x6328('0xd'))[_0x6328('0xe')](socket);function respondWithRpcPromise(_0x3e3c3f,_0x51a8fe,_0x574868){return new BPromise(function(_0x569178,_0x2ba813){return client[_0x6328('0xf')](_0x3e3c3f,_0x574868)['then'](function(_0x96fb57){logger['info']('MailQueue,\x20%s,\x20%s',_0x51a8fe,_0x6328('0x10'));logger[_0x6328('0x11')](_0x6328('0x12'),_0x51a8fe,_0x6328('0x10'),JSON[_0x6328('0x13')](_0x96fb57));if(_0x96fb57[_0x6328('0x14')]){if(_0x96fb57['error']['code']===0x1f4){logger[_0x6328('0x14')](_0x6328('0x15'),_0x51a8fe,_0x96fb57[_0x6328('0x14')]['message']);return _0x2ba813(_0x96fb57[_0x6328('0x14')][_0x6328('0x16')]);}logger[_0x6328('0x14')](_0x6328('0x15'),_0x51a8fe,_0x96fb57['error'][_0x6328('0x16')]);return _0x569178(_0x96fb57['error']['message']);}else{logger[_0x6328('0x17')](_0x6328('0x15'),_0x51a8fe,_0x6328('0x10'));_0x569178(_0x96fb57['result'][_0x6328('0x16')]);}})[_0x6328('0x18')](function(_0x23d564){logger['error'](_0x6328('0x15'),_0x51a8fe,_0x23d564);_0x2ba813(_0x23d564);});});}exports['GetMailQueue']=function(_0xe4c846){var _0xb5ada2=this;return new Promise(function(_0x456f03,_0x4401ca){return db[_0x6328('0x19')][_0x6328('0x1a')]({'raw':_0xe4c846[_0x6328('0x1b')]?_0xe4c846[_0x6328('0x1b')][_0x6328('0x1c')]===undefined?!![]:![]:!![],'where':_0xe4c846[_0x6328('0x1b')]?_0xe4c846[_0x6328('0x1b')][_0x6328('0x1d')]||null:null,'attributes':_0xe4c846[_0x6328('0x1b')]?_0xe4c846[_0x6328('0x1b')][_0x6328('0x1e')]||null:null,'limit':_0xe4c846[_0x6328('0x1b')]?_0xe4c846[_0x6328('0x1b')][_0x6328('0x1f')]||null:null,'include':_0xe4c846[_0x6328('0x1b')]?_0xe4c846[_0x6328('0x1b')]['include']?_[_0x6328('0x20')](_0xe4c846[_0x6328('0x1b')][_0x6328('0x21')],function(_0x788d51){return{'model':db[_0x788d51[_0x6328('0x22')]],'as':_0x788d51['as'],'attributes':_0x788d51[_0x6328('0x1e')],'include':_0x788d51[_0x6328('0x21')]?_['map'](_0x788d51[_0x6328('0x21')],function(_0x9bd467){return{'model':db[_0x9bd467[_0x6328('0x22')]],'as':_0x9bd467['as'],'attributes':_0x9bd467['attributes'],'include':_0x9bd467[_0x6328('0x21')]?_['map'](_0x9bd467[_0x6328('0x21')],function(_0xe9a4ba){return{'model':db[_0xe9a4ba[_0x6328('0x22')]],'as':_0xe9a4ba['as'],'attributes':_0xe9a4ba[_0x6328('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6328('0x23')](function(_0x5aa83b){logger['info'](_0x6328('0x24'),_0xe4c846);logger[_0x6328('0x11')](_0x6328('0x24'),_0xe4c846,JSON[_0x6328('0x13')](_0x5aa83b));_0x456f03(_0x5aa83b);})[_0x6328('0x18')](function(_0x2cc072){logger[_0x6328('0x14')]('GetMailQueue',_0x2cc072[_0x6328('0x16')],_0xe4c846);_0x4401ca(_0xb5ada2['error'](0x1f4,_0x2cc072[_0x6328('0x16')]));});});};exports['ShowMailQueue']=function(_0x3caa7e){var _0x509d77=this;return new Promise(function(_0x29bbb7,_0x24c25c){return db[_0x6328('0x19')]['find']({'raw':_0x3caa7e[_0x6328('0x1b')]?_0x3caa7e['options'][_0x6328('0x1c')]===undefined?!![]:![]:!![],'where':_0x3caa7e[_0x6328('0x1b')]?_0x3caa7e[_0x6328('0x1b')][_0x6328('0x1d')]||null:null,'attributes':_0x3caa7e[_0x6328('0x1b')]?_0x3caa7e[_0x6328('0x1b')][_0x6328('0x1e')]||null:null,'include':_0x3caa7e[_0x6328('0x1b')]?_0x3caa7e[_0x6328('0x1b')][_0x6328('0x21')]?_[_0x6328('0x20')](_0x3caa7e[_0x6328('0x1b')][_0x6328('0x21')],function(_0x2c7524){return{'model':db[_0x2c7524['model']],'as':_0x2c7524['as'],'attributes':_0x2c7524[_0x6328('0x1e')],'include':_0x2c7524[_0x6328('0x21')]?_[_0x6328('0x20')](_0x2c7524[_0x6328('0x21')],function(_0x38b57f){return{'model':db[_0x38b57f['model']],'as':_0x38b57f['as'],'attributes':_0x38b57f['attributes'],'include':_0x38b57f[_0x6328('0x21')]?_[_0x6328('0x20')](_0x38b57f[_0x6328('0x21')],function(_0x29ef7f){return{'model':db[_0x29ef7f[_0x6328('0x22')]],'as':_0x29ef7f['as'],'attributes':_0x29ef7f[_0x6328('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6328('0x23')](function(_0x41a905){logger[_0x6328('0x17')](_0x6328('0x25'),_0x3caa7e);logger[_0x6328('0x11')](_0x6328('0x25'),_0x3caa7e,JSON[_0x6328('0x13')](_0x41a905));_0x29bbb7(_0x41a905);})['catch'](function(_0x42482b){logger[_0x6328('0x14')](_0x6328('0x25'),_0x42482b[_0x6328('0x16')],_0x3caa7e);_0x24c25c(_0x509d77[_0x6328('0x14')](0x1f4,_0x42482b[_0x6328('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 98c5713..fea8004 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 _0x5317=['register','mailQueue:','./mailQueue.events','update','emit'];(function(_0x272acd,_0x285e44){var _0x1d710f=function(_0x1e2cbc){while(--_0x1e2cbc){_0x272acd['push'](_0x272acd['shift']());}};_0x1d710f(++_0x285e44);}(_0x5317,0x1b5));var _0x7531=function(_0x3de5c1,_0x2e4b0c){_0x3de5c1=_0x3de5c1-0x0;var _0x53c2dc=_0x5317[_0x3de5c1];return _0x53c2dc;};'use strict';var MailQueueEvents=require(_0x7531('0x0'));var events=['save','remove',_0x7531('0x1')];function createListener(_0xcc7c55,_0x10bf36){return function(_0x21decf){_0x10bf36[_0x7531('0x2')](_0xcc7c55,_0x21decf);};}function removeListener(_0x3addd4,_0x4e5d8c){return function(){MailQueueEvents['removeListener'](_0x3addd4,_0x4e5d8c);};}exports[_0x7531('0x3')]=function(_0x34c297){for(var _0x2738b4=0x0,_0x52d973=events['length'];_0x2738b4<_0x52d973;_0x2738b4++){var _0xd209cd=events[_0x2738b4];var _0x55a217=createListener(_0x7531('0x4')+_0xd209cd,_0x34c297);MailQueueEvents['on'](_0xd209cd,_0x55a217);}}; \ No newline at end of file +var _0xafea=['removeListener','length','./mailQueue.events','save','remove','update','emit'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xafea,0xf0));var _0xaafe=function(_0x142b0c,_0x4bb8e8){_0x142b0c=_0x142b0c-0x0;var _0x4dd85f=_0xafea[_0x142b0c];return _0x4dd85f;};'use strict';var MailQueueEvents=require(_0xaafe('0x0'));var events=[_0xaafe('0x1'),_0xaafe('0x2'),_0xaafe('0x3')];function createListener(_0x194e30,_0x177dd8){return function(_0x579e67){_0x177dd8[_0xaafe('0x4')](_0x194e30,_0x579e67);};}function removeListener(_0x242338,_0x4c533b){return function(){MailQueueEvents[_0xaafe('0x5')](_0x242338,_0x4c533b);};}exports['register']=function(_0xe0af51){for(var _0x3ee907=0x0,_0x25b65e=events[_0xaafe('0x6')];_0x3ee907<_0x25b65e;_0x3ee907++){var _0x331b08=events[_0x3ee907];var _0x163302=createListener('mailQueue:'+_0x331b08,_0xe0af51);MailQueueEvents['on'](_0x331b08,_0x163302);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 2469572..0e89cb0 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 _0xc7a8=['delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc7a8,0x152));var _0x8c7a=function(_0x49d200,_0x1dd8aa){_0x49d200=_0x49d200-0x0;var _0x546f41=_0xc7a8[_0x49d200];return _0x546f41;};'use strict';var multer=require('multer');var util=require(_0x8c7a('0x0'));var path=require(_0x8c7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c7a('0x2'));var router=express[_0x8c7a('0x3')]();var auth=require(_0x8c7a('0x4'));var interaction=require(_0x8c7a('0x5'));var config=require(_0x8c7a('0x6'));var controller=require(_0x8c7a('0x7'));router[_0x8c7a('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c7a('0x9')]);router[_0x8c7a('0x8')](_0x8c7a('0xa'),auth[_0x8c7a('0xb')](),controller[_0x8c7a('0xc')]);router[_0x8c7a('0x8')](_0x8c7a('0xd'),auth['isAuthenticated'](),controller[_0x8c7a('0xe')]);router[_0x8c7a('0xf')]('/',auth[_0x8c7a('0xb')](),controller[_0x8c7a('0x10')]);router[_0x8c7a('0x11')](_0x8c7a('0xd'),auth[_0x8c7a('0xb')](),controller[_0x8c7a('0x12')]);router[_0x8c7a('0x13')](_0x8c7a('0xd'),auth[_0x8c7a('0xb')](),controller['destroy']);module[_0x8c7a('0x14')]=router; \ No newline at end of file +var _0x6fe4=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6fe4,0x145));var _0x46fe=function(_0x19cc69,_0x572cb2){_0x19cc69=_0x19cc69-0x0;var _0x1d7c63=_0x6fe4[_0x19cc69];return _0x1d7c63;};'use strict';var multer=require(_0x46fe('0x0'));var util=require(_0x46fe('0x1'));var path=require(_0x46fe('0x2'));var timeout=require(_0x46fe('0x3'));var express=require(_0x46fe('0x4'));var router=express[_0x46fe('0x5')]();var auth=require(_0x46fe('0x6'));var interaction=require(_0x46fe('0x7'));var config=require(_0x46fe('0x8'));var controller=require(_0x46fe('0x9'));router[_0x46fe('0xa')]('/',auth[_0x46fe('0xb')](),controller[_0x46fe('0xc')]);router['get'](_0x46fe('0xd'),auth[_0x46fe('0xb')](),controller[_0x46fe('0xe')]);router[_0x46fe('0xa')](_0x46fe('0xf'),auth[_0x46fe('0xb')](),controller[_0x46fe('0x10')]);router[_0x46fe('0x11')]('/',auth[_0x46fe('0xb')](),controller[_0x46fe('0x12')]);router[_0x46fe('0x13')](_0x46fe('0xf'),auth[_0x46fe('0xb')](),controller[_0x46fe('0x14')]);router[_0x46fe('0x15')](_0x46fe('0xf'),auth[_0x46fe('0xb')](),controller['destroy']);module[_0x46fe('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 88f30f3..d6a1631 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 _0x244a=['DATE','moment','sequelize','exports','STRING'];(function(_0x2b73c0,_0x27a837){var _0x31c930=function(_0x2c10ed){while(--_0x2c10ed){_0x2b73c0['push'](_0x2b73c0['shift']());}};_0x31c930(++_0x27a837);}(_0x244a,0x1a5));var _0xa244=function(_0x372339,_0x2bc55d){_0x372339=_0x372339-0x0;var _0x30c0f5=_0x244a[_0x372339];return _0x30c0f5;};'use strict';var moment=require(_0xa244('0x0'));var Sequelize=require(_0xa244('0x1'));module[_0xa244('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa244('0x3')]},'joinAt':{'type':Sequelize[_0xa244('0x4')]},'leaveAt':{'type':Sequelize[_0xa244('0x4')]},'acceptAt':{'type':Sequelize[_0xa244('0x4')]},'exitAt':{'type':Sequelize[_0xa244('0x4')]},'reason':{'type':Sequelize[_0xa244('0x3')]}}; \ No newline at end of file +var _0x2a91=['exports','STRING','DATE','moment'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x2a91,0x15b));var _0x12a9=function(_0x1f7767,_0x342125){_0x1f7767=_0x1f7767-0x0;var _0x3a0a11=_0x2a91[_0x1f7767];return _0x3a0a11;};'use strict';var moment=require(_0x12a9('0x0'));var Sequelize=require('sequelize');module[_0x12a9('0x1')]={'uniqueid':{'type':Sequelize[_0x12a9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x12a9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x12a9('0x3')]},'acceptAt':{'type':Sequelize[_0x12a9('0x3')]},'exitAt':{'type':Sequelize[_0x12a9('0x3')]},'reason':{'type':Sequelize[_0x12a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 89a9f1f..f23c449 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 _0x9dd4=['destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailQueueReport','includeAll','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x2cdf07,_0x1518d2){var _0x35bed5=function(_0x52a395){while(--_0x52a395){_0x2cdf07['push'](_0x2cdf07['shift']());}};_0x35bed5(++_0x1518d2);}(_0x9dd4,0x157));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x49dd('0x0'));var emlformat=require(_0x49dd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x49dd('0x2'));var jsonpatch=require(_0x49dd('0x3'));var rp=require(_0x49dd('0x4'));var moment=require(_0x49dd('0x5'));var BPromise=require(_0x49dd('0x6'));var Mustache=require(_0x49dd('0x7'));var util=require(_0x49dd('0x8'));var path=require('path');var sox=require(_0x49dd('0x9'));var csv=require(_0x49dd('0xa'));var ejs=require(_0x49dd('0xb'));var fs=require('fs');var _=require(_0x49dd('0xc'));var squel=require('squel');var crypto=require(_0x49dd('0xd'));var jsforce=require(_0x49dd('0xe'));var deskjs=require(_0x49dd('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49dd('0x10'));var Redis=require(_0x49dd('0x11'));var authService=require(_0x49dd('0x12'));var qs=require(_0x49dd('0x13'));var as=require(_0x49dd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49dd('0x15'))(_0x49dd('0x16'));var utils=require(_0x49dd('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2926f8,_0x2def91){_0x2def91=_0x2def91||0xcc;return function(_0x162327){if(_0x162327){return _0x2926f8[_0x49dd('0x18')](_0x2def91);}return _0x2926f8[_0x49dd('0x19')](_0x2def91)[_0x49dd('0x1a')]();};}function respondWithResult(_0x57950c,_0x51bef5){_0x51bef5=_0x51bef5||0xc8;return function(_0x48c975){if(_0x48c975){return _0x57950c[_0x49dd('0x19')](_0x51bef5)[_0x49dd('0x1b')](_0x48c975);}};}function respondWithFilteredResult(_0x103294,_0x1d18a2){return function(_0x5bd771){if(_0x5bd771){var _0x52fe3c=_0x5bd771[_0x49dd('0x1c')],_0x39d5eb=_0x1d18a2[_0x49dd('0x1d')],_0x5672c0=_0x1d18a2[_0x49dd('0x1d')]+_0x1d18a2['limit'],_0x1b5e37;if(_0x5672c0>=_0x52fe3c){_0x5672c0=_0x52fe3c;_0x1b5e37=0xc8;}else{_0x1b5e37=0xce;}_0x103294['status'](_0x1b5e37);return _0x103294[_0x49dd('0x1e')](_0x49dd('0x1f'),_0x39d5eb+'-'+_0x5672c0+'/'+_0x52fe3c)[_0x49dd('0x1b')](_0x5bd771);}return null;};}function patchUpdates(_0x2329a2){return function(_0x2c9b4d){try{jsonpatch[_0x49dd('0x20')](_0x2c9b4d,_0x2329a2,!![]);}catch(_0xcc063e){return BPromise[_0x49dd('0x21')](_0xcc063e);}return _0x2c9b4d[_0x49dd('0x22')]();};}function saveUpdates(_0x954ef4,_0x5bfa8a){return function(_0x3f8706){if(_0x3f8706){return _0x3f8706[_0x49dd('0x23')](_0x954ef4)[_0x49dd('0x24')](function(_0x481018){return _0x481018;});}return null;};}function removeEntity(_0x4ec591,_0x41ae97){return function(_0x3c9dd8){if(_0x3c9dd8){return _0x3c9dd8[_0x49dd('0x25')]()['then'](function(){_0x4ec591[_0x49dd('0x19')](0xcc)[_0x49dd('0x1a')]();});}};}function handleEntityNotFound(_0x377bbb,_0xf7a8f7){return function(_0x3cae90){if(!_0x3cae90){_0x377bbb[_0x49dd('0x18')](0x194);}return _0x3cae90;};}function handleError(_0x101465,_0x3b414a){_0x3b414a=_0x3b414a||0x1f4;return function(_0x55101e){logger[_0x49dd('0x26')](_0x55101e[_0x49dd('0x27')]);if(_0x55101e[_0x49dd('0x28')]){delete _0x55101e['name'];}_0x101465['status'](_0x3b414a)['send'](_0x55101e);};}exports[_0x49dd('0x29')]=function(_0x3f11b7,_0x1691fc){var _0x1722fe={},_0x4606c8={},_0x461880={'count':0x0,'rows':[]};var _0x532e96=_[_0x49dd('0x2a')](db['MailQueueReport'][_0x49dd('0x2b')],function(_0x27c686){return{'name':_0x27c686[_0x49dd('0x2c')],'type':_0x27c686['type']['key']};});_0x4606c8[_0x49dd('0x2d')]=_[_0x49dd('0x2a')](_0x532e96,'name');_0x4606c8[_0x49dd('0x2e')]=_[_0x49dd('0x2f')](_0x3f11b7[_0x49dd('0x2e')]);_0x4606c8[_0x49dd('0x30')]=_[_0x49dd('0x31')](_0x4606c8[_0x49dd('0x2d')],_0x4606c8[_0x49dd('0x2e')]);_0x1722fe['attributes']=_[_0x49dd('0x31')](_0x4606c8['model'],qs['fields'](_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x32')]));_0x1722fe[_0x49dd('0x33')]=_0x1722fe[_0x49dd('0x33')][_0x49dd('0x34')]?_0x1722fe[_0x49dd('0x33')]:_0x4606c8[_0x49dd('0x2d')];if(!_0x3f11b7['query'][_0x49dd('0x35')](_0x49dd('0x36'))){_0x1722fe['limit']=qs[_0x49dd('0x37')](_0x3f11b7[_0x49dd('0x2e')]['limit']);_0x1722fe[_0x49dd('0x1d')]=qs[_0x49dd('0x1d')](_0x3f11b7[_0x49dd('0x2e')]['offset']);}_0x1722fe[_0x49dd('0x38')]=qs[_0x49dd('0x39')](_0x3f11b7[_0x49dd('0x2e')]['sort']);_0x1722fe[_0x49dd('0x3a')]=qs['filters'](_[_0x49dd('0x3b')](_0x3f11b7[_0x49dd('0x2e')],_0x4606c8[_0x49dd('0x30')]),_0x532e96);if(_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x3c')]){_0x1722fe[_0x49dd('0x3a')]=_[_0x49dd('0x3d')](_0x1722fe[_0x49dd('0x3a')],{'$or':_[_0x49dd('0x2a')](_0x532e96,function(_0x492f14){if(_0x492f14[_0x49dd('0x3e')]!==_0x49dd('0x3f')){var _0xe83595={};_0xe83595[_0x492f14[_0x49dd('0x28')]]={'$like':'%'+_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x3c')]+'%'};return _0xe83595;}})});}_0x1722fe=_[_0x49dd('0x3d')]({},_0x1722fe,_0x3f11b7[_0x49dd('0x40')]);var _0x58b765={'where':_0x1722fe[_0x49dd('0x3a')]};return db[_0x49dd('0x41')][_0x49dd('0x1c')](_0x58b765)[_0x49dd('0x24')](function(_0x2fba48){_0x461880['count']=_0x2fba48;if(_0x3f11b7[_0x49dd('0x2e')][_0x49dd('0x42')]){_0x1722fe['include']=[{'all':!![]}];}return db[_0x49dd('0x41')][_0x49dd('0x43')](_0x1722fe);})['then'](function(_0x54804e){_0x461880[_0x49dd('0x44')]=_0x54804e;return _0x461880;})[_0x49dd('0x24')](respondWithFilteredResult(_0x1691fc,_0x1722fe))[_0x49dd('0x45')](handleError(_0x1691fc,null));};exports[_0x49dd('0x46')]=function(_0x2bcce5,_0x302790){var _0x4c7444={'raw':!![],'where':{'id':_0x2bcce5['params']['id']}},_0x3be165={};_0x3be165['model']=_[_0x49dd('0x2f')](db[_0x49dd('0x41')][_0x49dd('0x2b')]);_0x3be165[_0x49dd('0x2e')]=_[_0x49dd('0x2f')](_0x2bcce5[_0x49dd('0x2e')]);_0x3be165[_0x49dd('0x30')]=_[_0x49dd('0x31')](_0x3be165[_0x49dd('0x2d')],_0x3be165['query']);_0x4c7444[_0x49dd('0x33')]=_[_0x49dd('0x31')](_0x3be165['model'],qs[_0x49dd('0x32')](_0x2bcce5[_0x49dd('0x2e')][_0x49dd('0x32')]));_0x4c7444[_0x49dd('0x33')]=_0x4c7444[_0x49dd('0x33')]['length']?_0x4c7444[_0x49dd('0x33')]:_0x3be165[_0x49dd('0x2d')];if(_0x2bcce5[_0x49dd('0x2e')][_0x49dd('0x42')]){_0x4c7444['include']=[{'all':!![]}];}_0x4c7444=_[_0x49dd('0x3d')]({},_0x4c7444,_0x2bcce5[_0x49dd('0x40')]);return db['MailQueueReport'][_0x49dd('0x47')](_0x4c7444)[_0x49dd('0x24')](handleEntityNotFound(_0x302790,null))[_0x49dd('0x24')](respondWithResult(_0x302790,null))[_0x49dd('0x45')](handleError(_0x302790,null));};exports[_0x49dd('0x48')]=function(_0x232179,_0x43a66e){return db[_0x49dd('0x41')][_0x49dd('0x48')](_0x232179[_0x49dd('0x49')],{})['then'](respondWithResult(_0x43a66e,0xc9))['catch'](handleError(_0x43a66e,null));};exports[_0x49dd('0x23')]=function(_0x73b904,_0x5f126b){if(_0x73b904[_0x49dd('0x49')]['id']){delete _0x73b904[_0x49dd('0x49')]['id'];}return db[_0x49dd('0x41')][_0x49dd('0x47')]({'where':{'id':_0x73b904[_0x49dd('0x4a')]['id']}})[_0x49dd('0x24')](handleEntityNotFound(_0x5f126b,null))[_0x49dd('0x24')](saveUpdates(_0x73b904[_0x49dd('0x49')],null))[_0x49dd('0x24')](respondWithResult(_0x5f126b,null))[_0x49dd('0x45')](handleError(_0x5f126b,null));};exports[_0x49dd('0x25')]=function(_0x3cfe29,_0x4ce50a){return db[_0x49dd('0x41')][_0x49dd('0x47')]({'where':{'id':_0x3cfe29[_0x49dd('0x4a')]['id']}})[_0x49dd('0x24')](handleEntityNotFound(_0x4ce50a,null))['then'](removeEntity(_0x4ce50a,null))[_0x49dd('0x45')](handleError(_0x4ce50a,null));};exports['describe']=function(_0x5b3847,_0x5c18bc){return db['MailQueueReport'][_0x49dd('0x4b')]()[_0x49dd('0x24')](respondWithResult(_0x5c18bc,null))[_0x49dd('0x45')](handleError(_0x5c18bc,null));}; \ No newline at end of file +var _0x9dc0=['merge','find','create','body','update','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','name','index','map','MailQueueReport','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include'];(function(_0x30bb02,_0x11ed9f){var _0x101b29=function(_0x2ee5b8){while(--_0x2ee5b8){_0x30bb02['push'](_0x30bb02['shift']());}};_0x101b29(++_0x11ed9f);}(_0x9dc0,0xd6));var _0x09dc=function(_0xf2726b,_0x87deb7){_0xf2726b=_0xf2726b-0x0;var _0xa61a5=_0x9dc0[_0xf2726b];return _0xa61a5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x09dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09dc('0x1'));var rp=require(_0x09dc('0x2'));var moment=require(_0x09dc('0x3'));var BPromise=require(_0x09dc('0x4'));var Mustache=require('mustache');var util=require(_0x09dc('0x5'));var path=require('path');var sox=require(_0x09dc('0x6'));var csv=require(_0x09dc('0x7'));var ejs=require(_0x09dc('0x8'));var fs=require('fs');var _=require(_0x09dc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09dc('0x7'));var querystring=require(_0x09dc('0xa'));var Papa=require('papaparse');var Redis=require(_0x09dc('0xb'));var authService=require(_0x09dc('0xc'));var qs=require(_0x09dc('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09dc('0xe'));var logger=require(_0x09dc('0xf'))(_0x09dc('0x10'));var utils=require(_0x09dc('0x11'));var config=require(_0x09dc('0x12'));var db=require(_0x09dc('0x13'))['db'];function respondWithStatusCode(_0x1b1f78,_0x3b53ff){_0x3b53ff=_0x3b53ff||0xcc;return function(_0x5f1357){if(_0x5f1357){return _0x1b1f78[_0x09dc('0x14')](_0x3b53ff);}return _0x1b1f78['status'](_0x3b53ff)[_0x09dc('0x15')]();};}function respondWithResult(_0x2a4c09,_0x4a3ed1){_0x4a3ed1=_0x4a3ed1||0xc8;return function(_0xd5e337){if(_0xd5e337){return _0x2a4c09[_0x09dc('0x16')](_0x4a3ed1)[_0x09dc('0x17')](_0xd5e337);}};}function respondWithFilteredResult(_0x5bd905,_0x5e28a6){return function(_0x5a3dd6){if(_0x5a3dd6){var _0x442b40=_0x5a3dd6[_0x09dc('0x18')],_0x14d254=_0x5e28a6[_0x09dc('0x19')],_0x1247b6=_0x5e28a6['offset']+_0x5e28a6[_0x09dc('0x1a')],_0x5bfe60;if(_0x1247b6>=_0x442b40){_0x1247b6=_0x442b40;_0x5bfe60=0xc8;}else{_0x5bfe60=0xce;}_0x5bd905[_0x09dc('0x16')](_0x5bfe60);return _0x5bd905[_0x09dc('0x1b')](_0x09dc('0x1c'),_0x14d254+'-'+_0x1247b6+'/'+_0x442b40)['json'](_0x5a3dd6);}return null;};}function patchUpdates(_0x2e3cf3){return function(_0x22c168){try{jsonpatch[_0x09dc('0x1d')](_0x22c168,_0x2e3cf3,!![]);}catch(_0x34acac){return BPromise['reject'](_0x34acac);}return _0x22c168[_0x09dc('0x1e')]();};}function saveUpdates(_0x2641be,_0x5382ad){return function(_0x39882b){if(_0x39882b){return _0x39882b['update'](_0x2641be)[_0x09dc('0x1f')](function(_0x37bc7b){return _0x37bc7b;});}return null;};}function removeEntity(_0x6e8314,_0x27c68b){return function(_0x5f3802){if(_0x5f3802){return _0x5f3802['destroy']()[_0x09dc('0x1f')](function(){_0x6e8314[_0x09dc('0x16')](0xcc)[_0x09dc('0x15')]();});}};}function handleEntityNotFound(_0x5518dc,_0x2fb4bc){return function(_0x1d9e09){if(!_0x1d9e09){_0x5518dc[_0x09dc('0x14')](0x194);}return _0x1d9e09;};}function handleError(_0x54014c,_0x584a9f){_0x584a9f=_0x584a9f||0x1f4;return function(_0x4dbf3b){logger['error'](_0x4dbf3b['stack']);if(_0x4dbf3b[_0x09dc('0x20')]){delete _0x4dbf3b[_0x09dc('0x20')];}_0x54014c['status'](_0x584a9f)['send'](_0x4dbf3b);};}exports[_0x09dc('0x21')]=function(_0x2e9bc5,_0x5ae5a1){var _0x3e4165={},_0x2bae56={},_0x43c60a={'count':0x0,'rows':[]};var _0x25d509=_[_0x09dc('0x22')](db[_0x09dc('0x23')]['rawAttributes'],function(_0x1b4a4a){return{'name':_0x1b4a4a[_0x09dc('0x24')],'type':_0x1b4a4a[_0x09dc('0x25')]['key']};});_0x2bae56['model']=_[_0x09dc('0x22')](_0x25d509,_0x09dc('0x20'));_0x2bae56['query']=_[_0x09dc('0x26')](_0x2e9bc5[_0x09dc('0x27')]);_0x2bae56['filters']=_['intersection'](_0x2bae56[_0x09dc('0x28')],_0x2bae56['query']);_0x3e4165[_0x09dc('0x29')]=_[_0x09dc('0x2a')](_0x2bae56[_0x09dc('0x28')],qs[_0x09dc('0x2b')](_0x2e9bc5['query'][_0x09dc('0x2b')]));_0x3e4165[_0x09dc('0x29')]=_0x3e4165[_0x09dc('0x29')][_0x09dc('0x2c')]?_0x3e4165[_0x09dc('0x29')]:_0x2bae56['model'];if(!_0x2e9bc5[_0x09dc('0x27')][_0x09dc('0x2d')](_0x09dc('0x2e'))){_0x3e4165['limit']=qs[_0x09dc('0x1a')](_0x2e9bc5['query'][_0x09dc('0x1a')]);_0x3e4165[_0x09dc('0x19')]=qs[_0x09dc('0x19')](_0x2e9bc5[_0x09dc('0x27')][_0x09dc('0x19')]);}_0x3e4165[_0x09dc('0x2f')]=qs[_0x09dc('0x30')](_0x2e9bc5['query'][_0x09dc('0x30')]);_0x3e4165['where']=qs[_0x09dc('0x31')](_[_0x09dc('0x32')](_0x2e9bc5[_0x09dc('0x27')],_0x2bae56[_0x09dc('0x31')]),_0x25d509);if(_0x2e9bc5['query'][_0x09dc('0x33')]){_0x3e4165['where']=_['merge'](_0x3e4165['where'],{'$or':_[_0x09dc('0x22')](_0x25d509,function(_0x300862){if(_0x300862[_0x09dc('0x25')]!==_0x09dc('0x34')){var _0x213e1c={};_0x213e1c[_0x300862['name']]={'$like':'%'+_0x2e9bc5['query']['filter']+'%'};return _0x213e1c;}})});}_0x3e4165=_['merge']({},_0x3e4165,_0x2e9bc5[_0x09dc('0x35')]);var _0x5d2de1={'where':_0x3e4165['where']};return db[_0x09dc('0x23')][_0x09dc('0x18')](_0x5d2de1)[_0x09dc('0x1f')](function(_0xc4dae6){_0x43c60a['count']=_0xc4dae6;if(_0x2e9bc5[_0x09dc('0x27')][_0x09dc('0x36')]){_0x3e4165['include']=[{'all':!![]}];}return db[_0x09dc('0x23')][_0x09dc('0x37')](_0x3e4165);})[_0x09dc('0x1f')](function(_0x1f0680){_0x43c60a[_0x09dc('0x38')]=_0x1f0680;return _0x43c60a;})[_0x09dc('0x1f')](respondWithFilteredResult(_0x5ae5a1,_0x3e4165))[_0x09dc('0x39')](handleError(_0x5ae5a1,null));};exports[_0x09dc('0x3a')]=function(_0x22fbed,_0x377662){var _0x36f25a={'raw':!![],'where':{'id':_0x22fbed[_0x09dc('0x3b')]['id']}},_0x5bddd5={};_0x5bddd5[_0x09dc('0x28')]=_[_0x09dc('0x26')](db[_0x09dc('0x23')][_0x09dc('0x3c')]);_0x5bddd5[_0x09dc('0x27')]=_[_0x09dc('0x26')](_0x22fbed[_0x09dc('0x27')]);_0x5bddd5[_0x09dc('0x31')]=_[_0x09dc('0x2a')](_0x5bddd5[_0x09dc('0x28')],_0x5bddd5['query']);_0x36f25a['attributes']=_['intersection'](_0x5bddd5[_0x09dc('0x28')],qs['fields'](_0x22fbed[_0x09dc('0x27')][_0x09dc('0x2b')]));_0x36f25a[_0x09dc('0x29')]=_0x36f25a[_0x09dc('0x29')][_0x09dc('0x2c')]?_0x36f25a['attributes']:_0x5bddd5[_0x09dc('0x28')];if(_0x22fbed['query'][_0x09dc('0x36')]){_0x36f25a[_0x09dc('0x3d')]=[{'all':!![]}];}_0x36f25a=_[_0x09dc('0x3e')]({},_0x36f25a,_0x22fbed['options']);return db['MailQueueReport'][_0x09dc('0x3f')](_0x36f25a)[_0x09dc('0x1f')](handleEntityNotFound(_0x377662,null))[_0x09dc('0x1f')](respondWithResult(_0x377662,null))['catch'](handleError(_0x377662,null));};exports['create']=function(_0x30b2d0,_0x4e4c0d){return db[_0x09dc('0x23')][_0x09dc('0x40')](_0x30b2d0[_0x09dc('0x41')],{})[_0x09dc('0x1f')](respondWithResult(_0x4e4c0d,0xc9))[_0x09dc('0x39')](handleError(_0x4e4c0d,null));};exports[_0x09dc('0x42')]=function(_0x50f53f,_0x456d97){if(_0x50f53f[_0x09dc('0x41')]['id']){delete _0x50f53f[_0x09dc('0x41')]['id'];}return db[_0x09dc('0x23')][_0x09dc('0x3f')]({'where':{'id':_0x50f53f[_0x09dc('0x3b')]['id']}})[_0x09dc('0x1f')](handleEntityNotFound(_0x456d97,null))[_0x09dc('0x1f')](saveUpdates(_0x50f53f[_0x09dc('0x41')],null))[_0x09dc('0x1f')](respondWithResult(_0x456d97,null))['catch'](handleError(_0x456d97,null));};exports[_0x09dc('0x43')]=function(_0x231fd6,_0x4c391c){return db['MailQueueReport']['find']({'where':{'id':_0x231fd6[_0x09dc('0x3b')]['id']}})[_0x09dc('0x1f')](handleEntityNotFound(_0x4c391c,null))[_0x09dc('0x1f')](removeEntity(_0x4c391c,null))[_0x09dc('0x39')](handleError(_0x4c391c,null));};exports['describe']=function(_0x112e5e,_0x492870){return db['MailQueueReport'][_0x09dc('0x44')]()[_0x09dc('0x1f')](respondWithResult(_0x492870,null))[_0x09dc('0x39')](handleError(_0x492870,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index fb5296b..d2bcddf 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 _0xae24=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4dd0a7,_0xb4399f){var _0x487e9b=function(_0x355738){while(--_0x355738){_0x4dd0a7['push'](_0x4dd0a7['shift']());}};_0x487e9b(++_0xb4399f);}(_0xae24,0x180));var _0x4ae2=function(_0x2d4126,_0x31905d){_0x2d4126=_0x2d4126-0x0;var _0x3a21b7=_0xae24[_0x2d4126];return _0x3a21b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ae2('0x0'))(_0x4ae2('0x1'));var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require(_0x4ae2('0x4'));var fs=require('fs');var path=require(_0x4ae2('0x5'));var rimraf=require(_0x4ae2('0x6'));var config=require(_0x4ae2('0x7'));var attributes=require(_0x4ae2('0x8'));module[_0x4ae2('0x9')]=function(_0x526b01,_0x497634){return _0x526b01[_0x4ae2('0xa')](_0x4ae2('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4ae2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f25=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x3d0ffa,_0x2c71a7){var _0x249d3b=function(_0x388706){while(--_0x388706){_0x3d0ffa['push'](_0x3d0ffa['shift']());}};_0x249d3b(++_0x2c71a7);}(_0x8f25,0x14b));var _0x58f2=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8f25[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var logger=require(_0x58f2('0x2'))(_0x58f2('0x3'));var moment=require(_0x58f2('0x4'));var BPromise=require(_0x58f2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x58f2('0x6'));var attributes=require(_0x58f2('0x7'));module[_0x58f2('0x8')]=function(_0x486395,_0x415a68){return _0x486395[_0x58f2('0x9')](_0x58f2('0xa'),attributes,{'tableName':_0x58f2('0xb'),'paranoid':![],'indexes':[{'name':_0x58f2('0xc'),'fields':[_0x58f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 295b064..cc9bfdc 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 _0xc1c6=['stringify','error','message','info','catch','create','options','raw','CreateMailQueueReport','UpdateMailQueueReport','MailQueueReport','update','body','where','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x3871d7,_0x3cfcc5){var _0x28ec09=function(_0x2bb918){while(--_0x2bb918){_0x3871d7['push'](_0x3871d7['shift']());}};_0x28ec09(++_0x3cfcc5);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x64d333,_0xa8f765){_0x64d333=_0x64d333-0x0;var _0x2a8723=_0xc1c6[_0x64d333];return _0x2a8723;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['CreateMailQueueReport']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['MailQueueReport'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![]})[_0x6c1c('0x9')](function(_0x1acf7f){logger[_0x6c1c('0x11')](_0x6c1c('0x16'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x16'),_0x137770,JSON[_0x6c1c('0xe')](_0x1acf7f));_0x338dc2(_0x1acf7f);})[_0x6c1c('0x12')](function(_0x450b1f){logger[_0x6c1c('0xf')](_0x6c1c('0x16'),_0x450b1f[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x450b1f[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x17')]=function(_0x3a3f13){var _0x1dba08=this;return new Promise(function(_0x96046a,_0x3f517e){return db[_0x6c1c('0x18')][_0x6c1c('0x19')](_0x3a3f13[_0x6c1c('0x1a')],{'raw':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1b')]||null:null,'attributes':_0x3a3f13['options']?_0x3a3f13[_0x6c1c('0x14')]['attributes']||null:null,'limit':_0x3a3f13[_0x6c1c('0x14')]?_0x3a3f13['options'][_0x6c1c('0x1c')]||null:null})[_0x6c1c('0x9')](function(_0x504348){logger[_0x6c1c('0x11')](_0x6c1c('0x17'),_0x3a3f13);logger['debug'](_0x6c1c('0x17'),_0x3a3f13,JSON[_0x6c1c('0xe')](_0x504348));_0x96046a(_0x504348);})[_0x6c1c('0x12')](function(_0xcb489a){logger['error']('UpdateMailQueueReport',_0xcb489a[_0x6c1c('0x10')],_0x3a3f13);_0x3f517e(_0x1dba08[_0x6c1c('0xf')](0x1f4,_0xcb489a[_0x6c1c('0x10')]));});});}; \ No newline at end of file +var _0x524e=['info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueueReport','create','options','CreateMailQueueReport','catch','UpdateMailQueueReport','update','body','raw','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x524e,0x15e));var _0xe524=function(_0x3d3440,_0x50620d){_0x3d3440=_0x3d3440-0x0;var _0x315ae3=_0x524e[_0x3d3440];return _0x315ae3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['CreateMailQueueReport']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xe524('0xc')](function(_0x309f85){logger[_0xe524('0xd')](_0xe524('0x19'),_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x19'),_0x3a4027,JSON[_0xe524('0x12')](_0x309f85));_0x11b2a1(_0x309f85);})[_0xe524('0x1a')](function(_0x7dfe97){logger['error'](_0xe524('0x19'),_0x7dfe97['message'],_0x3a4027);_0x238f8f(_0x4f1dfb['error'](0x1f4,_0x7dfe97[_0xe524('0x15')]));});});};exports[_0xe524('0x1b')]=function(_0x1ad106){var _0x85fc51=this;return new Promise(function(_0x599d5d,_0x158f07){return db['MailQueueReport'][_0xe524('0x1c')](_0x1ad106[_0xe524('0x1d')],{'raw':_0x1ad106[_0xe524('0x18')]?_0x1ad106[_0xe524('0x18')][_0xe524('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ad106[_0xe524('0x18')]?_0x1ad106[_0xe524('0x18')]['where']||null:null,'attributes':_0x1ad106['options']?_0x1ad106[_0xe524('0x18')][_0xe524('0x1f')]||null:null,'limit':_0x1ad106[_0xe524('0x18')]?_0x1ad106[_0xe524('0x18')][_0xe524('0x20')]||null:null})['then'](function(_0x52f140){logger[_0xe524('0xd')](_0xe524('0x1b'),_0x1ad106);logger[_0xe524('0x10')](_0xe524('0x1b'),_0x1ad106,JSON[_0xe524('0x12')](_0x52f140));_0x599d5d(_0x52f140);})['catch'](function(_0x365a1f){logger[_0xe524('0x13')]('UpdateMailQueueReport',_0x365a1f['message'],_0x1ad106);_0x158f07(_0x85fc51[_0xe524('0x13')](0x1f4,_0x365a1f[_0xe524('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 9e166a7..710bd67 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 _0x032f=['../../components/interaction/service','exports','util','path','connect-timeout','../../components/auth/service'];(function(_0x375b0d,_0x271196){var _0x3cc238=function(_0x5780fa){while(--_0x5780fa){_0x375b0d['push'](_0x375b0d['shift']());}};_0x3cc238(++_0x271196);}(_0x032f,0xce));var _0xf032=function(_0x5762d1,_0x4b6f51){_0x5762d1=_0x5762d1-0x0;var _0x2576c7=_0x032f[_0x5762d1];return _0x2576c7;};'use strict';var multer=require('multer');var util=require(_0xf032('0x0'));var path=require(_0xf032('0x1'));var timeout=require(_0xf032('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xf032('0x3'));var interaction=require(_0xf032('0x4'));var config=require('../../config/environment');module[_0xf032('0x5')]=router; \ No newline at end of file +var _0x9f62=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xd1f4f0,_0xf25d67){var _0xb45385=function(_0x4b2af2){while(--_0x4b2af2){_0xd1f4f0['push'](_0xd1f4f0['shift']());}};_0xb45385(++_0xf25d67);}(_0x9f62,0x12c));var _0x29f6=function(_0x243cc9,_0x3ce6e5){_0x243cc9=_0x243cc9-0x0;var _0x21b86b=_0x9f62[_0x243cc9];return _0x21b86b;};'use strict';var multer=require(_0x29f6('0x0'));var util=require(_0x29f6('0x1'));var path=require(_0x29f6('0x2'));var timeout=require(_0x29f6('0x3'));var express=require(_0x29f6('0x4'));var router=express[_0x29f6('0x5')]();var auth=require(_0x29f6('0x6'));var interaction=require(_0x29f6('0x7'));var config=require(_0x29f6('0x8'));module[_0x29f6('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 896f151..1d42faa 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 _0x1f30=['sequelize','exports','STRING','BOOLEAN','username','INTEGER','INBOX'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f30,0x1b2));var _0x01f3=function(_0xb92869,_0x4fcf90){_0xb92869=_0xb92869-0x0;var _0x2e955d=_0x1f30[_0xb92869];return _0x2e955d;};'use strict';var Sequelize=require(_0x01f3('0x0'));module[_0x01f3('0x1')]={'description':{'type':Sequelize[_0x01f3('0x2')]},'host':{'type':Sequelize[_0x01f3('0x2')]},'authentication':{'type':Sequelize[_0x01f3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x01f3('0x2')],'unique':_0x01f3('0x4')},'password':{'type':Sequelize[_0x01f3('0x2')]},'port':{'type':Sequelize[_0x01f3('0x5')]},'tls':{'type':Sequelize[_0x01f3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x01f3('0x2')],'defaultValue':_0x01f3('0x6')},'connTimeout':{'type':Sequelize[_0x01f3('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x01f3('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6907=['BOOLEAN','INBOX','sequelize','exports','STRING','INTEGER'];(function(_0x65e243,_0x1124bc){var _0x3e97f9=function(_0x14e26b){while(--_0x14e26b){_0x65e243['push'](_0x65e243['shift']());}};_0x3e97f9(++_0x1124bc);}(_0x6907,0x1a6));var _0x7690=function(_0x22133a,_0x21dfc2){_0x22133a=_0x22133a-0x0;var _0xffab4c=_0x6907[_0x22133a];return _0xffab4c;};'use strict';var Sequelize=require(_0x7690('0x0'));module[_0x7690('0x1')]={'description':{'type':Sequelize[_0x7690('0x2')]},'host':{'type':Sequelize[_0x7690('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x7690('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7690('0x3')]},'tls':{'type':Sequelize[_0x7690('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x7690('0x5')},'connTimeout':{'type':Sequelize[_0x7690('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7690('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5e9e853..6fe8b23 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 _0xc319=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define'];(function(_0x1ff8d6,_0x2a39cf){var _0x221346=function(_0x5c46e8){while(--_0x5c46e8){_0x1ff8d6['push'](_0x1ff8d6['shift']());}};_0x221346(++_0x2a39cf);}(_0xc319,0x12e));var _0x9c31=function(_0x57f5e6,_0x5e84bc){_0x57f5e6=_0x57f5e6-0x0;var _0x326ca9=_0xc319[_0x57f5e6];return _0x326ca9;};'use strict';var _=require(_0x9c31('0x0'));var util=require(_0x9c31('0x1'));var logger=require(_0x9c31('0x2'))('api');var moment=require(_0x9c31('0x3'));var BPromise=require(_0x9c31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c31('0x5'));var rimraf=require(_0x9c31('0x6'));var config=require(_0x9c31('0x7'));var attributes=require(_0x9c31('0x8'));module['exports']=function(_0x401c82,_0x109244){return _0x401c82[_0x9c31('0x9')](_0x9c31('0xa'),attributes,{'tableName':_0x9c31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6bb=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x346f2f,_0x226da8){var _0x5e67fe=function(_0x545ede){while(--_0x545ede){_0x346f2f['push'](_0x346f2f['shift']());}};_0x5e67fe(++_0x226da8);}(_0xa6bb,0x12c));var _0xba6b=function(_0x1cdc99,_0x3948af){_0x1cdc99=_0x1cdc99-0x0;var _0x34c5ca=_0xa6bb[_0x1cdc99];return _0x34c5ca;};'use strict';var _=require('lodash');var util=require(_0xba6b('0x0'));var logger=require(_0xba6b('0x1'))(_0xba6b('0x2'));var moment=require(_0xba6b('0x3'));var BPromise=require(_0xba6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba6b('0x5'));var config=require(_0xba6b('0x6'));var attributes=require(_0xba6b('0x7'));module[_0xba6b('0x8')]=function(_0x517d10,_0x4cc381){return _0x517d10[_0xba6b('0x9')](_0xba6b('0xa'),attributes,{'tableName':_0xba6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 80a709a..d6e96de 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 _0x8667=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','randomstring','ioredis','../../mysqldb'];(function(_0x42057a,_0x4c59bb){var _0x334b7e=function(_0x4b046c){while(--_0x4b046c){_0x42057a['push'](_0x42057a['shift']());}};_0x334b7e(++_0x4c59bb);}(_0x8667,0x1cd));var _0x7866=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7866('0x0'));var fs=require('fs');var Redis=require(_0x7866('0x1'));var db=require(_0x7866('0x2'))['db'];var utils=require(_0x7866('0x3'));var logger=require(_0x7866('0x4'))('rpc');var config=require(_0x7866('0x5'));var jayson=require(_0x7866('0x6'));var client=jayson['client'][_0x7866('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x703faa,_0x52960d,_0x3d5985){return new BPromise(function(_0x1fb084,_0x3f6cb1){return client['request'](_0x703faa,_0x3d5985)['then'](function(_0xf1dff7){logger[_0x7866('0x8')]('MailServerIn,\x20%s,\x20%s',_0x52960d,_0x7866('0x9'));logger[_0x7866('0xa')](_0x7866('0xb'),_0x52960d,_0x7866('0x9'),JSON[_0x7866('0xc')](_0xf1dff7));if(_0xf1dff7[_0x7866('0xd')]){if(_0xf1dff7[_0x7866('0xd')][_0x7866('0xe')]===0x1f4){logger[_0x7866('0xd')](_0x7866('0xf'),_0x52960d,_0xf1dff7[_0x7866('0xd')]['message']);return _0x3f6cb1(_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);}logger[_0x7866('0xd')]('MailServerIn,\x20%s,\x20%s',_0x52960d,_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);return _0x1fb084(_0xf1dff7[_0x7866('0xd')][_0x7866('0x10')]);}else{logger[_0x7866('0x8')](_0x7866('0xf'),_0x52960d,_0x7866('0x9'));_0x1fb084(_0xf1dff7[_0x7866('0x11')]['message']);}})[_0x7866('0x12')](function(_0x1677c5){logger['error'](_0x7866('0xf'),_0x52960d,_0x1677c5);_0x3f6cb1(_0x1677c5);});});}exports[_0x7866('0x13')]=function(_0x598710){var _0x892e11=this;return new Promise(function(_0x159fc3,_0x183f60){return db[_0x7866('0x14')]['findAll']({'raw':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x16')]===undefined?!![]:![]:!![],'where':_0x598710['options']?_0x598710['options'][_0x7866('0x17')]||null:null,'attributes':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x18')]||null:null,'limit':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x19')]||null:null,'include':_0x598710[_0x7866('0x15')]?_0x598710[_0x7866('0x15')][_0x7866('0x1a')]?_[_0x7866('0x1b')](_0x598710['options'][_0x7866('0x1a')],function(_0x522477){return{'model':db[_0x522477['model']],'as':_0x522477['as'],'attributes':_0x522477[_0x7866('0x18')],'include':_0x522477[_0x7866('0x1a')]?_['map'](_0x522477[_0x7866('0x1a')],function(_0x523ff0){return{'model':db[_0x523ff0[_0x7866('0x1c')]],'as':_0x523ff0['as'],'attributes':_0x523ff0[_0x7866('0x18')],'include':_0x523ff0[_0x7866('0x1a')]?_[_0x7866('0x1b')](_0x523ff0[_0x7866('0x1a')],function(_0x423a94){return{'model':db[_0x423a94[_0x7866('0x1c')]],'as':_0x423a94['as'],'attributes':_0x423a94[_0x7866('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21482d){logger[_0x7866('0x8')](_0x7866('0x13'),_0x598710);logger[_0x7866('0xa')](_0x7866('0x13'),_0x598710,JSON[_0x7866('0xc')](_0x21482d));_0x159fc3(_0x21482d);})[_0x7866('0x12')](function(_0x461e94){logger['error'](_0x7866('0x13'),_0x461e94[_0x7866('0x10')],_0x598710);_0x183f60(_0x892e11[_0x7866('0xd')](0x1f4,_0x461e94[_0x7866('0x10')]));});});}; \ No newline at end of file +var _0x6863=['MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','options','raw','where','include','map','model','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x8ca72f,_0x2ccb6d){var _0x501ace=function(_0x2c8a7c){while(--_0x2c8a7c){_0x8ca72f['push'](_0x8ca72f['shift']());}};_0x501ace(++_0x2ccb6d);}(_0x6863,0xe4));var _0x3686=function(_0x4746be,_0x14d1ec){_0x4746be=_0x4746be-0x0;var _0x3fb821=_0x6863[_0x4746be];return _0x3fb821;};'use strict';var _=require(_0x3686('0x0'));var util=require(_0x3686('0x1'));var moment=require('moment');var BPromise=require(_0x3686('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3686('0x3'));var db=require(_0x3686('0x4'))['db'];var utils=require(_0x3686('0x5'));var logger=require('../../config/logger')(_0x3686('0x6'));var config=require(_0x3686('0x7'));var jayson=require(_0x3686('0x8'));var client=jayson[_0x3686('0x9')][_0x3686('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23211c,_0x574787,_0x1faa30){return new BPromise(function(_0x35ada4,_0xa6e23c){return client[_0x3686('0xb')](_0x23211c,_0x1faa30)[_0x3686('0xc')](function(_0x5b81bc){logger[_0x3686('0xd')]('MailServerIn,\x20%s,\x20%s',_0x574787,_0x3686('0xe'));logger[_0x3686('0xf')](_0x3686('0x10'),_0x574787,_0x3686('0xe'),JSON[_0x3686('0x11')](_0x5b81bc));if(_0x5b81bc[_0x3686('0x12')]){if(_0x5b81bc[_0x3686('0x12')]['code']===0x1f4){logger[_0x3686('0x12')]('MailServerIn,\x20%s,\x20%s',_0x574787,_0x5b81bc['error'][_0x3686('0x13')]);return _0xa6e23c(_0x5b81bc[_0x3686('0x12')][_0x3686('0x13')]);}logger[_0x3686('0x12')](_0x3686('0x14'),_0x574787,_0x5b81bc[_0x3686('0x12')][_0x3686('0x13')]);return _0x35ada4(_0x5b81bc[_0x3686('0x12')]['message']);}else{logger[_0x3686('0xd')](_0x3686('0x14'),_0x574787,'request\x20sent');_0x35ada4(_0x5b81bc[_0x3686('0x15')]['message']);}})[_0x3686('0x16')](function(_0x13fbf3){logger['error'](_0x3686('0x14'),_0x574787,_0x13fbf3);_0xa6e23c(_0x13fbf3);});});}exports[_0x3686('0x17')]=function(_0x4ae716){var _0x1e0133=this;return new Promise(function(_0x2c8dbd,_0x5e82e9){return db['MailServerIn']['findAll']({'raw':_0x4ae716['options']?_0x4ae716[_0x3686('0x18')][_0x3686('0x19')]===undefined?!![]:![]:!![],'where':_0x4ae716[_0x3686('0x18')]?_0x4ae716[_0x3686('0x18')][_0x3686('0x1a')]||null:null,'attributes':_0x4ae716[_0x3686('0x18')]?_0x4ae716['options']['attributes']||null:null,'limit':_0x4ae716[_0x3686('0x18')]?_0x4ae716[_0x3686('0x18')]['limit']||null:null,'include':_0x4ae716[_0x3686('0x18')]?_0x4ae716[_0x3686('0x18')][_0x3686('0x1b')]?_[_0x3686('0x1c')](_0x4ae716[_0x3686('0x18')]['include'],function(_0x274e3a){return{'model':db[_0x274e3a[_0x3686('0x1d')]],'as':_0x274e3a['as'],'attributes':_0x274e3a[_0x3686('0x1e')],'include':_0x274e3a['include']?_[_0x3686('0x1c')](_0x274e3a[_0x3686('0x1b')],function(_0x55b86d){return{'model':db[_0x55b86d[_0x3686('0x1d')]],'as':_0x55b86d['as'],'attributes':_0x55b86d[_0x3686('0x1e')],'include':_0x55b86d['include']?_['map'](_0x55b86d[_0x3686('0x1b')],function(_0x132b2b){return{'model':db[_0x132b2b[_0x3686('0x1d')]],'as':_0x132b2b['as'],'attributes':_0x132b2b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3b5a){logger[_0x3686('0xd')](_0x3686('0x17'),_0x4ae716);logger[_0x3686('0xf')]('GetMailServerIn',_0x4ae716,JSON[_0x3686('0x11')](_0x5d3b5a));_0x2c8dbd(_0x5d3b5a);})[_0x3686('0x16')](function(_0x5f0f76){logger[_0x3686('0x12')](_0x3686('0x17'),_0x5f0f76[_0x3686('0x13')],_0x4ae716);_0x5e82e9(_0x1e0133[_0x3686('0x12')](0x1f4,_0x5f0f76['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e1a2b89..5c63853 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 _0xf426=['multer','util','path','connect-timeout','express','Router','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf426,0x1a4));var _0x6f42=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0xf426[_0x315aea];return _0x4a4bdb;};'use strict';var multer=require(_0x6f42('0x0'));var util=require(_0x6f42('0x1'));var path=require(_0x6f42('0x2'));var timeout=require(_0x6f42('0x3'));var express=require(_0x6f42('0x4'));var router=express[_0x6f42('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f42('0x6'));var controller=require(_0x6f42('0x7'));router[_0x6f42('0x8')]('/',auth[_0x6f42('0x9')](),controller[_0x6f42('0xa')]);router['get'](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0xc')]);router[_0x6f42('0xd')]('/',auth[_0x6f42('0x9')](),controller[_0x6f42('0xe')]);router[_0x6f42('0xf')](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0x10')]);router[_0x6f42('0x11')](_0x6f42('0xb'),auth[_0x6f42('0x9')](),controller[_0x6f42('0x12')]);module[_0x6f42('0x13')]=router; \ No newline at end of file +var _0x4712=['create','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show','post','isAuthenticated'];(function(_0x3f7e93,_0x5222ae){var _0x340873=function(_0x55cd78){while(--_0x55cd78){_0x3f7e93['push'](_0x3f7e93['shift']());}};_0x340873(++_0x5222ae);}(_0x4712,0x1c6));var _0x2471=function(_0x16be5d,_0x3582f0){_0x16be5d=_0x16be5d-0x0;var _0xa1fd7b=_0x4712[_0x16be5d];return _0xa1fd7b;};'use strict';var multer=require(_0x2471('0x0'));var util=require(_0x2471('0x1'));var path=require(_0x2471('0x2'));var timeout=require('connect-timeout');var express=require(_0x2471('0x3'));var router=express['Router']();var auth=require(_0x2471('0x4'));var interaction=require(_0x2471('0x5'));var config=require(_0x2471('0x6'));var controller=require(_0x2471('0x7'));router[_0x2471('0x8')]('/',auth['isAuthenticated'](),controller[_0x2471('0x9')]);router['get'](_0x2471('0xa'),auth['isAuthenticated'](),controller[_0x2471('0xb')]);router[_0x2471('0xc')]('/',auth[_0x2471('0xd')](),controller[_0x2471('0xe')]);router['put'](_0x2471('0xa'),auth['isAuthenticated'](),controller[_0x2471('0xf')]);router[_0x2471('0x10')](_0x2471('0xa'),auth['isAuthenticated'](),controller[_0x2471('0x11')]);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 4b05585..5a31c8d 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 _0xb4d9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5827a5,_0x4eb8c7){var _0x5c31dd=function(_0xbe6312){while(--_0xbe6312){_0x5827a5['push'](_0x5827a5['shift']());}};_0x5c31dd(++_0x4eb8c7);}(_0xb4d9,0xce));var _0x9b4d=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb4d9[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x9b4d('0x0'));module[_0x9b4d('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9b4d('0x2')]},'user':{'type':Sequelize[_0x9b4d('0x2')]},'pass':{'type':Sequelize[_0x9b4d('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x9b4d('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x9b4d('0x2')]},'authentication':{'type':Sequelize[_0x9b4d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdfa0=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x3e52be,_0x386939){var _0x54230f=function(_0x3d5840){while(--_0x3d5840){_0x3e52be['push'](_0x3e52be['shift']());}};_0x54230f(++_0x386939);}(_0xdfa0,0x69));var _0x0dfa=function(_0x40923e,_0x19c610){_0x40923e=_0x40923e-0x0;var _0x19bdb9=_0xdfa0[_0x40923e];return _0x19bdb9;};'use strict';var Sequelize=require(_0x0dfa('0x0'));module['exports']={'description':{'type':Sequelize[_0x0dfa('0x1')]},'host':{'type':Sequelize[_0x0dfa('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x0dfa('0x1')]},'port':{'type':Sequelize[_0x0dfa('0x2')]},'secure':{'type':Sequelize[_0x0dfa('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0dfa('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 2336eff..8336eeb 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 _0x21cd=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5d9ac3,_0x4820fa){var _0x2e0117=function(_0x5d09e9){while(--_0x5d09e9){_0x5d9ac3['push'](_0x5d9ac3['shift']());}};_0x2e0117(++_0x4820fa);}(_0x21cd,0x15d));var _0xd21c=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x21cd[_0x39e283];return _0x7de89f;};'use strict';var pdf=require(_0xd21c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd21c('0x1'));var zipdir=require(_0xd21c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd21c('0x3'));var moment=require(_0xd21c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd21c('0x5'));var util=require(_0xd21c('0x6'));var path=require(_0xd21c('0x7'));var sox=require(_0xd21c('0x8'));var csv=require(_0xd21c('0x9'));var ejs=require(_0xd21c('0xa'));var fs=require('fs');var _=require(_0xd21c('0xb'));var squel=require('squel');var crypto=require(_0xd21c('0xc'));var jsforce=require(_0xd21c('0xd'));var deskjs=require(_0xd21c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd21c('0xf'));var Papa=require(_0xd21c('0x10'));var Redis=require(_0xd21c('0x11'));var authService=require(_0xd21c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd21c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd21c('0x14'))(_0xd21c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd21c('0x16'))['db'];function respondWithStatusCode(_0x49ece8,_0x22d81a){_0x22d81a=_0x22d81a||0xcc;return function(_0x55b736){if(_0x55b736){return _0x49ece8[_0xd21c('0x17')](_0x22d81a);}return _0x49ece8[_0xd21c('0x18')](_0x22d81a)[_0xd21c('0x19')]();};}function respondWithResult(_0x2db4fa,_0x4436fb){_0x4436fb=_0x4436fb||0xc8;return function(_0x76cc74){if(_0x76cc74){return _0x2db4fa[_0xd21c('0x18')](_0x4436fb)[_0xd21c('0x1a')](_0x76cc74);}};}function respondWithFilteredResult(_0x49f5f9,_0x5caa05){return function(_0x287568){if(_0x287568){var _0x48cf70=_0x287568[_0xd21c('0x1b')],_0x590821=_0x5caa05[_0xd21c('0x1c')],_0x509b01=_0x5caa05[_0xd21c('0x1c')]+_0x5caa05[_0xd21c('0x1d')],_0x327462;if(_0x509b01>=_0x48cf70){_0x509b01=_0x48cf70;_0x327462=0xc8;}else{_0x327462=0xce;}_0x49f5f9['status'](_0x327462);return _0x49f5f9[_0xd21c('0x1e')](_0xd21c('0x1f'),_0x590821+'-'+_0x509b01+'/'+_0x48cf70)['json'](_0x287568);}return null;};}function patchUpdates(_0x2dbc7b){return function(_0x19b7a7){try{jsonpatch[_0xd21c('0x20')](_0x19b7a7,_0x2dbc7b,!![]);}catch(_0x56ff14){return BPromise['reject'](_0x56ff14);}return _0x19b7a7['save']();};}function saveUpdates(_0x3364a7,_0x162f3a){return function(_0x41689f){if(_0x41689f){return _0x41689f[_0xd21c('0x21')](_0x3364a7)['then'](function(_0x5aad34){return _0x5aad34;});}return null;};}function removeEntity(_0x3e6dff,_0x1350a6){return function(_0x2f4a7f){if(_0x2f4a7f){return _0x2f4a7f[_0xd21c('0x22')]()[_0xd21c('0x23')](function(){_0x3e6dff[_0xd21c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a1b7,_0x27c7c0){return function(_0x167d51){if(!_0x167d51){_0x32a1b7[_0xd21c('0x17')](0x194);}return _0x167d51;};}function handleError(_0x43fd85,_0x5a397a){_0x5a397a=_0x5a397a||0x1f4;return function(_0x5b97ef){logger[_0xd21c('0x24')](_0x5b97ef[_0xd21c('0x25')]);if(_0x5b97ef[_0xd21c('0x26')]){delete _0x5b97ef[_0xd21c('0x26')];}_0x43fd85[_0xd21c('0x18')](_0x5a397a)[_0xd21c('0x27')](_0x5b97ef);};}exports[_0xd21c('0x28')]=function(_0x4316c4,_0x800541){var _0x4c553f={},_0x4cb723={},_0x36afca={'count':0x0,'rows':[]};var _0xd2c93a=_[_0xd21c('0x29')](db[_0xd21c('0x2a')]['rawAttributes'],function(_0x3bc099){return{'name':_0x3bc099[_0xd21c('0x2b')],'type':_0x3bc099[_0xd21c('0x2c')][_0xd21c('0x2d')]};});_0x4cb723[_0xd21c('0x2e')]=_['map'](_0xd2c93a,'name');_0x4cb723[_0xd21c('0x2f')]=_[_0xd21c('0x30')](_0x4316c4['query']);_0x4cb723[_0xd21c('0x31')]=_[_0xd21c('0x32')](_0x4cb723[_0xd21c('0x2e')],_0x4cb723[_0xd21c('0x2f')]);_0x4c553f[_0xd21c('0x33')]=_['intersection'](_0x4cb723[_0xd21c('0x2e')],qs[_0xd21c('0x34')](_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x34')]));_0x4c553f[_0xd21c('0x33')]=_0x4c553f[_0xd21c('0x33')][_0xd21c('0x35')]?_0x4c553f[_0xd21c('0x33')]:_0x4cb723[_0xd21c('0x2e')];if(!_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x36')](_0xd21c('0x37'))){_0x4c553f[_0xd21c('0x1d')]=qs['limit'](_0x4316c4[_0xd21c('0x2f')]['limit']);_0x4c553f['offset']=qs['offset'](_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x1c')]);}_0x4c553f[_0xd21c('0x38')]=qs[_0xd21c('0x39')](_0x4316c4[_0xd21c('0x2f')]['sort']);_0x4c553f['where']=qs[_0xd21c('0x31')](_[_0xd21c('0x3a')](_0x4316c4[_0xd21c('0x2f')],_0x4cb723['filters']),_0xd2c93a);if(_0x4316c4[_0xd21c('0x2f')]['filter']){_0x4c553f[_0xd21c('0x3b')]=_[_0xd21c('0x3c')](_0x4c553f[_0xd21c('0x3b')],{'$or':_['map'](_0xd2c93a,function(_0x58291a){if(_0x58291a[_0xd21c('0x2c')]!==_0xd21c('0x3d')){var _0x16393e={};_0x16393e[_0x58291a[_0xd21c('0x26')]]={'$like':'%'+_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x3e')]+'%'};return _0x16393e;}})});}_0x4c553f=_[_0xd21c('0x3c')]({},_0x4c553f,_0x4316c4[_0xd21c('0x3f')]);var _0x51f34a={'where':_0x4c553f[_0xd21c('0x3b')]};return db[_0xd21c('0x2a')]['count'](_0x51f34a)[_0xd21c('0x23')](function(_0x3ba29d){_0x36afca['count']=_0x3ba29d;if(_0x4316c4[_0xd21c('0x2f')][_0xd21c('0x40')]){_0x4c553f[_0xd21c('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xd21c('0x42')](_0x4c553f);})[_0xd21c('0x23')](function(_0x46e2bc){_0x36afca['rows']=_0x46e2bc;return _0x36afca;})[_0xd21c('0x23')](respondWithFilteredResult(_0x800541,_0x4c553f))[_0xd21c('0x43')](handleError(_0x800541,null));};exports[_0xd21c('0x44')]=function(_0x3e57a8,_0x3e0b79){var _0xca6f25={'raw':!![],'where':{'id':_0x3e57a8[_0xd21c('0x45')]['id']}},_0x3eabed={};_0x3eabed[_0xd21c('0x2e')]=_[_0xd21c('0x30')](db[_0xd21c('0x2a')]['rawAttributes']);_0x3eabed[_0xd21c('0x2f')]=_[_0xd21c('0x30')](_0x3e57a8['query']);_0x3eabed[_0xd21c('0x31')]=_[_0xd21c('0x32')](_0x3eabed[_0xd21c('0x2e')],_0x3eabed[_0xd21c('0x2f')]);_0xca6f25[_0xd21c('0x33')]=_[_0xd21c('0x32')](_0x3eabed[_0xd21c('0x2e')],qs[_0xd21c('0x34')](_0x3e57a8[_0xd21c('0x2f')][_0xd21c('0x34')]));_0xca6f25[_0xd21c('0x33')]=_0xca6f25['attributes'][_0xd21c('0x35')]?_0xca6f25['attributes']:_0x3eabed['model'];if(_0x3e57a8[_0xd21c('0x2f')][_0xd21c('0x40')]){_0xca6f25[_0xd21c('0x41')]=[{'all':!![]}];}_0xca6f25=_[_0xd21c('0x3c')]({},_0xca6f25,_0x3e57a8[_0xd21c('0x3f')]);return db['MailServerOut'][_0xd21c('0x46')](_0xca6f25)[_0xd21c('0x23')](handleEntityNotFound(_0x3e0b79,null))[_0xd21c('0x23')](respondWithResult(_0x3e0b79,null))[_0xd21c('0x43')](handleError(_0x3e0b79,null));};exports['create']=function(_0x16f5dc,_0x4f9c6e){return db['MailServerOut'][_0xd21c('0x47')](_0x16f5dc[_0xd21c('0x48')],{})[_0xd21c('0x23')](respondWithResult(_0x4f9c6e,0xc9))['catch'](handleError(_0x4f9c6e,null));};exports['update']=function(_0x528c1a,_0x145356){if(_0x528c1a[_0xd21c('0x48')]['id']){delete _0x528c1a[_0xd21c('0x48')]['id'];}return db[_0xd21c('0x2a')][_0xd21c('0x46')]({'where':{'id':_0x528c1a['params']['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x145356,null))[_0xd21c('0x23')](saveUpdates(_0x528c1a[_0xd21c('0x48')],null))[_0xd21c('0x23')](respondWithResult(_0x145356,null))[_0xd21c('0x43')](handleError(_0x145356,null));};exports[_0xd21c('0x22')]=function(_0x295fc3,_0x19c451){return db['MailServerOut'][_0xd21c('0x46')]({'where':{'id':_0x295fc3[_0xd21c('0x45')]['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x19c451,null))['then'](removeEntity(_0x19c451,null))[_0xd21c('0x43')](handleError(_0x19c451,null));}; \ No newline at end of file +var _0x943f=['map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','MailServerOut','includeAll','include','rows','catch','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','apply','reject','save','then','destroy','name','send','index'];(function(_0x2e7afc,_0x46fdc5){var _0x4f0834=function(_0x3ad475){while(--_0x3ad475){_0x2e7afc['push'](_0x2e7afc['shift']());}};_0x4f0834(++_0x46fdc5);}(_0x943f,0xa7));var _0xf943=function(_0x1e9195,_0x50c32c){_0x1e9195=_0x1e9195-0x0;var _0x44a35d=_0x943f[_0x1e9195];return _0x44a35d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf943('0x0'));var rimraf=require(_0xf943('0x1'));var zipdir=require(_0xf943('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf943('0x3'));var moment=require('moment');var BPromise=require(_0xf943('0x4'));var Mustache=require('mustache');var util=require(_0xf943('0x5'));var path=require(_0xf943('0x6'));var sox=require(_0xf943('0x7'));var csv=require(_0xf943('0x8'));var ejs=require(_0xf943('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf943('0xa'));var crypto=require('crypto');var jsforce=require(_0xf943('0xb'));var deskjs=require(_0xf943('0xc'));var toCsv=require(_0xf943('0x8'));var querystring=require(_0xf943('0xd'));var Papa=require(_0xf943('0xe'));var Redis=require('ioredis');var authService=require(_0xf943('0xf'));var qs=require(_0xf943('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf943('0x11'));var logger=require('../../config/logger')(_0xf943('0x12'));var utils=require(_0xf943('0x13'));var config=require(_0xf943('0x14'));var db=require(_0xf943('0x15'))['db'];function respondWithStatusCode(_0x5b062f,_0x3352ec){_0x3352ec=_0x3352ec||0xcc;return function(_0xdd312c){if(_0xdd312c){return _0x5b062f[_0xf943('0x16')](_0x3352ec);}return _0x5b062f['status'](_0x3352ec)[_0xf943('0x17')]();};}function respondWithResult(_0x2d356a,_0x334401){_0x334401=_0x334401||0xc8;return function(_0x5f510c){if(_0x5f510c){return _0x2d356a['status'](_0x334401)[_0xf943('0x18')](_0x5f510c);}};}function respondWithFilteredResult(_0x4c99fa,_0x8c59cd){return function(_0x29b41d){if(_0x29b41d){var _0x45e88a=_0x29b41d[_0xf943('0x19')],_0x19817c=_0x8c59cd[_0xf943('0x1a')],_0x4f1f65=_0x8c59cd[_0xf943('0x1a')]+_0x8c59cd['limit'],_0x8da043;if(_0x4f1f65>=_0x45e88a){_0x4f1f65=_0x45e88a;_0x8da043=0xc8;}else{_0x8da043=0xce;}_0x4c99fa[_0xf943('0x1b')](_0x8da043);return _0x4c99fa[_0xf943('0x1c')]('Content-Range',_0x19817c+'-'+_0x4f1f65+'/'+_0x45e88a)[_0xf943('0x18')](_0x29b41d);}return null;};}function patchUpdates(_0x172c91){return function(_0x25d00a){try{jsonpatch[_0xf943('0x1d')](_0x25d00a,_0x172c91,!![]);}catch(_0x32bbef){return BPromise[_0xf943('0x1e')](_0x32bbef);}return _0x25d00a[_0xf943('0x1f')]();};}function saveUpdates(_0xd7f7f1,_0x236c57){return function(_0x4dd2df){if(_0x4dd2df){return _0x4dd2df['update'](_0xd7f7f1)[_0xf943('0x20')](function(_0x3f0d70){return _0x3f0d70;});}return null;};}function removeEntity(_0x339e09,_0x2ffcfc){return function(_0x5cbc4e){if(_0x5cbc4e){return _0x5cbc4e[_0xf943('0x21')]()['then'](function(){_0x339e09['status'](0xcc)[_0xf943('0x17')]();});}};}function handleEntityNotFound(_0x493d8d,_0x1faccc){return function(_0x1ee7af){if(!_0x1ee7af){_0x493d8d['sendStatus'](0x194);}return _0x1ee7af;};}function handleError(_0x549e6a,_0x475cbe){_0x475cbe=_0x475cbe||0x1f4;return function(_0xa63549){logger['error'](_0xa63549['stack']);if(_0xa63549[_0xf943('0x22')]){delete _0xa63549[_0xf943('0x22')];}_0x549e6a[_0xf943('0x1b')](_0x475cbe)[_0xf943('0x23')](_0xa63549);};}exports[_0xf943('0x24')]=function(_0x5522c7,_0x5afdc3){var _0x1eb9d1={},_0x5df746={},_0x179545={'count':0x0,'rows':[]};var _0x4683e0=_[_0xf943('0x25')](db['MailServerOut'][_0xf943('0x26')],function(_0x30d2e4){return{'name':_0x30d2e4[_0xf943('0x27')],'type':_0x30d2e4[_0xf943('0x28')]['key']};});_0x5df746[_0xf943('0x29')]=_['map'](_0x4683e0,'name');_0x5df746[_0xf943('0x2a')]=_[_0xf943('0x2b')](_0x5522c7[_0xf943('0x2a')]);_0x5df746['filters']=_[_0xf943('0x2c')](_0x5df746['model'],_0x5df746['query']);_0x1eb9d1[_0xf943('0x2d')]=_[_0xf943('0x2c')](_0x5df746[_0xf943('0x29')],qs[_0xf943('0x2e')](_0x5522c7[_0xf943('0x2a')][_0xf943('0x2e')]));_0x1eb9d1[_0xf943('0x2d')]=_0x1eb9d1['attributes'][_0xf943('0x2f')]?_0x1eb9d1[_0xf943('0x2d')]:_0x5df746[_0xf943('0x29')];if(!_0x5522c7[_0xf943('0x2a')][_0xf943('0x30')]('nolimit')){_0x1eb9d1[_0xf943('0x31')]=qs[_0xf943('0x31')](_0x5522c7[_0xf943('0x2a')]['limit']);_0x1eb9d1['offset']=qs['offset'](_0x5522c7[_0xf943('0x2a')][_0xf943('0x1a')]);}_0x1eb9d1[_0xf943('0x32')]=qs['sort'](_0x5522c7['query'][_0xf943('0x33')]);_0x1eb9d1['where']=qs['filters'](_[_0xf943('0x34')](_0x5522c7[_0xf943('0x2a')],_0x5df746[_0xf943('0x35')]),_0x4683e0);if(_0x5522c7[_0xf943('0x2a')][_0xf943('0x36')]){_0x1eb9d1[_0xf943('0x37')]=_[_0xf943('0x38')](_0x1eb9d1['where'],{'$or':_['map'](_0x4683e0,function(_0x7a2eaa){if(_0x7a2eaa[_0xf943('0x28')]!==_0xf943('0x39')){var _0xf243cc={};_0xf243cc[_0x7a2eaa['name']]={'$like':'%'+_0x5522c7[_0xf943('0x2a')]['filter']+'%'};return _0xf243cc;}})});}_0x1eb9d1=_['merge']({},_0x1eb9d1,_0x5522c7['options']);var _0x5bc468={'where':_0x1eb9d1[_0xf943('0x37')]};return db[_0xf943('0x3a')]['count'](_0x5bc468)[_0xf943('0x20')](function(_0x17888f){_0x179545[_0xf943('0x19')]=_0x17888f;if(_0x5522c7[_0xf943('0x2a')][_0xf943('0x3b')]){_0x1eb9d1[_0xf943('0x3c')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x1eb9d1);})['then'](function(_0x18ac34){_0x179545[_0xf943('0x3d')]=_0x18ac34;return _0x179545;})[_0xf943('0x20')](respondWithFilteredResult(_0x5afdc3,_0x1eb9d1))[_0xf943('0x3e')](handleError(_0x5afdc3,null));};exports['show']=function(_0x267dd4,_0x3ea032){var _0x3a48d6={'raw':!![],'where':{'id':_0x267dd4[_0xf943('0x3f')]['id']}},_0x2d57d1={};_0x2d57d1[_0xf943('0x29')]=_[_0xf943('0x2b')](db[_0xf943('0x3a')][_0xf943('0x26')]);_0x2d57d1[_0xf943('0x2a')]=_[_0xf943('0x2b')](_0x267dd4[_0xf943('0x2a')]);_0x2d57d1[_0xf943('0x35')]=_['intersection'](_0x2d57d1[_0xf943('0x29')],_0x2d57d1[_0xf943('0x2a')]);_0x3a48d6[_0xf943('0x2d')]=_[_0xf943('0x2c')](_0x2d57d1['model'],qs['fields'](_0x267dd4[_0xf943('0x2a')][_0xf943('0x2e')]));_0x3a48d6['attributes']=_0x3a48d6[_0xf943('0x2d')]['length']?_0x3a48d6['attributes']:_0x2d57d1[_0xf943('0x29')];if(_0x267dd4['query'][_0xf943('0x3b')]){_0x3a48d6[_0xf943('0x3c')]=[{'all':!![]}];}_0x3a48d6=_['merge']({},_0x3a48d6,_0x267dd4[_0xf943('0x40')]);return db[_0xf943('0x3a')]['find'](_0x3a48d6)[_0xf943('0x20')](handleEntityNotFound(_0x3ea032,null))[_0xf943('0x20')](respondWithResult(_0x3ea032,null))['catch'](handleError(_0x3ea032,null));};exports[_0xf943('0x41')]=function(_0x3f407b,_0x40209b){return db[_0xf943('0x3a')][_0xf943('0x41')](_0x3f407b[_0xf943('0x42')],{})['then'](respondWithResult(_0x40209b,0xc9))[_0xf943('0x3e')](handleError(_0x40209b,null));};exports['update']=function(_0x5c4bd6,_0x4788ac){if(_0x5c4bd6[_0xf943('0x42')]['id']){delete _0x5c4bd6['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x5c4bd6[_0xf943('0x3f')]['id']}})[_0xf943('0x20')](handleEntityNotFound(_0x4788ac,null))[_0xf943('0x20')](saveUpdates(_0x5c4bd6[_0xf943('0x42')],null))[_0xf943('0x20')](respondWithResult(_0x4788ac,null))[_0xf943('0x3e')](handleError(_0x4788ac,null));};exports['destroy']=function(_0x154f6a,_0x3588d8){return db[_0xf943('0x3a')][_0xf943('0x43')]({'where':{'id':_0x154f6a['params']['id']}})['then'](handleEntityNotFound(_0x3588d8,null))['then'](removeEntity(_0x3588d8,null))[_0xf943('0x3e')](handleError(_0x3588d8,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 8473fa5..d1d377b 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 _0x59f7=['../../config/environment','./mailServerOut.attributes','exports','MailServerOut','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ae5b0,_0x21b9b6){var _0x2e4495=function(_0x3d20f1){while(--_0x3d20f1){_0x1ae5b0['push'](_0x1ae5b0['shift']());}};_0x2e4495(++_0x21b9b6);}(_0x59f7,0xb4));var _0x759f=function(_0x53734d,_0x25be46){_0x53734d=_0x53734d-0x0;var _0x159a9f=_0x59f7[_0x53734d];return _0x159a9f;};'use strict';var _=require('lodash');var util=require(_0x759f('0x0'));var logger=require('../../config/logger')(_0x759f('0x1'));var moment=require(_0x759f('0x2'));var BPromise=require(_0x759f('0x3'));var rp=require(_0x759f('0x4'));var fs=require('fs');var path=require(_0x759f('0x5'));var rimraf=require(_0x759f('0x6'));var config=require(_0x759f('0x7'));var attributes=require(_0x759f('0x8'));module[_0x759f('0x9')]=function(_0x21bc13,_0x101a14){return _0x21bc13['define'](_0x759f('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e27=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash'];(function(_0x1f904a,_0x28c22f){var _0xc689ba=function(_0x777474){while(--_0x777474){_0x1f904a['push'](_0x1f904a['shift']());}};_0xc689ba(++_0x28c22f);}(_0x2e27,0xa4));var _0x72e2=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x2e27[_0x283127];return _0x43da5d;};'use strict';var _=require(_0x72e2('0x0'));var util=require(_0x72e2('0x1'));var logger=require(_0x72e2('0x2'))('api');var moment=require(_0x72e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x72e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e2('0x5'));var config=require(_0x72e2('0x6'));var attributes=require(_0x72e2('0x7'));module[_0x72e2('0x8')]=function(_0x400275,_0x1b9ae5){return _0x400275[_0x72e2('0x9')](_0x72e2('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 462f6f5..490a6ee 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 _0x6477=['rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','randomstring','ioredis','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x6477,0x80));var _0x7647=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x6477[_0x2459fd];return _0x364cd2;};'use strict';var _=require('lodash');var util=require(_0x7647('0x0'));var moment=require(_0x7647('0x1'));var BPromise=require('bluebird');var rs=require(_0x7647('0x2'));var fs=require('fs');var Redis=require(_0x7647('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7647('0x4'))(_0x7647('0x5'));var config=require('../../config/environment');var jayson=require(_0x7647('0x6'));var client=jayson[_0x7647('0x7')][_0x7647('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x509704,_0x46fcc6,_0x3f3fed){return new BPromise(function(_0x40ab29,_0x2ca783){return client[_0x7647('0x9')](_0x509704,_0x3f3fed)[_0x7647('0xa')](function(_0x53ae0f){logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));logger['debug'](_0x7647('0xe'),_0x46fcc6,_0x7647('0xd'),JSON[_0x7647('0xf')](_0x53ae0f));if(_0x53ae0f[_0x7647('0x10')]){if(_0x53ae0f['error']['code']===0x1f4){logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x2ca783(_0x53ae0f['error']['message']);}logger[_0x7647('0x10')](_0x7647('0xc'),_0x46fcc6,_0x53ae0f[_0x7647('0x10')][_0x7647('0x11')]);return _0x40ab29(_0x53ae0f['error'][_0x7647('0x11')]);}else{logger[_0x7647('0xb')](_0x7647('0xc'),_0x46fcc6,_0x7647('0xd'));_0x40ab29(_0x53ae0f['result'][_0x7647('0x11')]);}})[_0x7647('0x12')](function(_0x367995){logger['error'](_0x7647('0xc'),_0x46fcc6,_0x367995);_0x2ca783(_0x367995);});});} \ No newline at end of file +var _0xe0b9=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message'];(function(_0xbe40ad,_0x44343c){var _0x50fac9=function(_0xdaed07){while(--_0xdaed07){_0xbe40ad['push'](_0xbe40ad['shift']());}};_0x50fac9(++_0x44343c);}(_0xe0b9,0x178));var _0x9e0b=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xe0b9[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0x9e0b('0x0'));var util=require(_0x9e0b('0x1'));var moment=require('moment');var BPromise=require(_0x9e0b('0x2'));var rs=require(_0x9e0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e0b('0x4'));var logger=require('../../config/logger')(_0x9e0b('0x5'));var config=require(_0x9e0b('0x6'));var jayson=require(_0x9e0b('0x7'));var client=jayson[_0x9e0b('0x8')][_0x9e0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x264c0e,_0x2ccb0a,_0x20a7ac){return new BPromise(function(_0x1f3813,_0x536ac1){return client[_0x9e0b('0xa')](_0x264c0e,_0x20a7ac)[_0x9e0b('0xb')](function(_0x22c1ef){logger[_0x9e0b('0xc')]('MailServerOut,\x20%s,\x20%s',_0x2ccb0a,'request\x20sent');logger[_0x9e0b('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x2ccb0a,_0x9e0b('0xe'),JSON[_0x9e0b('0xf')](_0x22c1ef));if(_0x22c1ef[_0x9e0b('0x10')]){if(_0x22c1ef['error'][_0x9e0b('0x11')]===0x1f4){logger[_0x9e0b('0x10')](_0x9e0b('0x12'),_0x2ccb0a,_0x22c1ef[_0x9e0b('0x10')]['message']);return _0x536ac1(_0x22c1ef[_0x9e0b('0x10')]['message']);}logger[_0x9e0b('0x10')](_0x9e0b('0x12'),_0x2ccb0a,_0x22c1ef[_0x9e0b('0x10')]['message']);return _0x1f3813(_0x22c1ef[_0x9e0b('0x10')][_0x9e0b('0x13')]);}else{logger[_0x9e0b('0xc')](_0x9e0b('0x12'),_0x2ccb0a,'request\x20sent');_0x1f3813(_0x22c1ef[_0x9e0b('0x14')]['message']);}})[_0x9e0b('0x15')](function(_0x5a643c){logger[_0x9e0b('0x10')](_0x9e0b('0x12'),_0x2ccb0a,_0x5a643c);_0x536ac1(_0x5a643c);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b6ff032..4edaeec 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 _0x68a9=['isAuthenticated','index','/describe','describe','show','post','put','/:id','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x68a9,0x1e5));var _0x968a=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x68a9[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require('multer');var util=require(_0x968a('0x0'));var path=require(_0x968a('0x1'));var timeout=require(_0x968a('0x2'));var express=require(_0x968a('0x3'));var router=express[_0x968a('0x4')]();var auth=require(_0x968a('0x5'));var interaction=require(_0x968a('0x6'));var config=require(_0x968a('0x7'));var controller=require(_0x968a('0x8'));router['get']('/',auth[_0x968a('0x9')](),controller[_0x968a('0xa')]);router['get'](_0x968a('0xb'),auth['isAuthenticated'](),controller[_0x968a('0xc')]);router['get']('/:id',auth[_0x968a('0x9')](),controller[_0x968a('0xd')]);router[_0x968a('0xe')]('/',auth[_0x968a('0x9')](),controller['create']);router[_0x968a('0xf')](_0x968a('0x10'),auth[_0x968a('0x9')](),controller[_0x968a('0x11')]);router['delete'](_0x968a('0x10'),auth[_0x968a('0x9')](),controller[_0x968a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x779e=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','create','put','update','delete'];(function(_0x211f68,_0x47a58a){var _0x13604e=function(_0x23a402){while(--_0x23a402){_0x211f68['push'](_0x211f68['shift']());}};_0x13604e(++_0x47a58a);}(_0x779e,0x87));var _0xe779=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x779e[_0x5416db];return _0x243e35;};'use strict';var multer=require(_0xe779('0x0'));var util=require(_0xe779('0x1'));var path=require(_0xe779('0x2'));var timeout=require(_0xe779('0x3'));var express=require(_0xe779('0x4'));var router=express[_0xe779('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe779('0x6'));var config=require(_0xe779('0x7'));var controller=require('./mailSubstatus.controller');router[_0xe779('0x8')]('/',auth['isAuthenticated'](),controller[_0xe779('0x9')]);router[_0xe779('0x8')](_0xe779('0xa'),auth[_0xe779('0xb')](),controller['describe']);router[_0xe779('0x8')](_0xe779('0xc'),auth[_0xe779('0xb')](),controller['show']);router['post']('/',auth[_0xe779('0xb')](),controller[_0xe779('0xd')]);router[_0xe779('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe779('0xf')]);router[_0xe779('0x10')]('/:id',auth[_0xe779('0xb')](),controller[_0xe779('0x11')]);module[_0xe779('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 8c200bd..58ad5ed 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 _0x4ccb=['STRING','sequelize','exports'];(function(_0x58c576,_0x3df9c6){var _0x2677c3=function(_0x9a8fca){while(--_0x9a8fca){_0x58c576['push'](_0x58c576['shift']());}};_0x2677c3(++_0x3df9c6);}(_0x4ccb,0x196));var _0xb4cc=function(_0x2152ff,_0x4f6eb8){_0x2152ff=_0x2152ff-0x0;var _0x5cb275=_0x4ccb[_0x2152ff];return _0x5cb275;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module[_0xb4cc('0x1')]={'name':{'type':Sequelize[_0xb4cc('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb4cc('0x2')]}}; \ No newline at end of file +var _0xba0d=['name','sequelize','STRING'];(function(_0x267b50,_0x372ba0){var _0xe41e5=function(_0x58eac1){while(--_0x58eac1){_0x267b50['push'](_0x267b50['shift']());}};_0xe41e5(++_0x372ba0);}(_0xba0d,0x8e));var _0xdba0=function(_0x14cb29,_0x36055e){_0x14cb29=_0x14cb29-0x0;var _0x3949a5=_0xba0d[_0x14cb29];return _0x3949a5;};'use strict';var Sequelize=require(_0xdba0('0x0'));module['exports']={'name':{'type':Sequelize[_0xdba0('0x1')],'unique':_0xdba0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdba0('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 62839ef..0647473 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 _0x2b8b=['moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','intersection','fields','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x332264,_0x15ad59){var _0x214cd2=function(_0xfd3d65){while(--_0xfd3d65){_0x332264['push'](_0x332264['shift']());}};_0x214cd2(++_0x15ad59);}(_0x2b8b,0xce));var _0xb2b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2b8b[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb2b8('0x0'));var zipdir=require(_0xb2b8('0x1'));var jsonpatch=require(_0xb2b8('0x2'));var rp=require(_0xb2b8('0x3'));var moment=require(_0xb2b8('0x4'));var BPromise=require(_0xb2b8('0x5'));var Mustache=require(_0xb2b8('0x6'));var util=require(_0xb2b8('0x7'));var path=require('path');var sox=require(_0xb2b8('0x8'));var csv=require(_0xb2b8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb2b8('0xa'));var squel=require('squel');var crypto=require(_0xb2b8('0xb'));var jsforce=require(_0xb2b8('0xc'));var deskjs=require(_0xb2b8('0xd'));var toCsv=require(_0xb2b8('0x9'));var querystring=require('querystring');var Papa=require(_0xb2b8('0xe'));var Redis=require('ioredis');var authService=require(_0xb2b8('0xf'));var qs=require(_0xb2b8('0x10'));var as=require(_0xb2b8('0x11'));var hardwareService=require(_0xb2b8('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb2b8('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d226c,_0x3b08e7){_0x3b08e7=_0x3b08e7||0xcc;return function(_0x255e73){if(_0x255e73){return _0x1d226c[_0xb2b8('0x14')](_0x3b08e7);}return _0x1d226c[_0xb2b8('0x15')](_0x3b08e7)[_0xb2b8('0x16')]();};}function respondWithResult(_0x2bbfb,_0x44639f){_0x44639f=_0x44639f||0xc8;return function(_0x6e914c){if(_0x6e914c){return _0x2bbfb[_0xb2b8('0x15')](_0x44639f)[_0xb2b8('0x17')](_0x6e914c);}};}function respondWithFilteredResult(_0x3a675c,_0x34ca0a){return function(_0x467b89){if(_0x467b89){var _0x33ed53=_0x467b89['count'],_0x3fea04=_0x34ca0a[_0xb2b8('0x18')],_0x163b83=_0x34ca0a[_0xb2b8('0x18')]+_0x34ca0a[_0xb2b8('0x19')],_0x5c55af;if(_0x163b83>=_0x33ed53){_0x163b83=_0x33ed53;_0x5c55af=0xc8;}else{_0x5c55af=0xce;}_0x3a675c[_0xb2b8('0x15')](_0x5c55af);return _0x3a675c[_0xb2b8('0x1a')](_0xb2b8('0x1b'),_0x3fea04+'-'+_0x163b83+'/'+_0x33ed53)[_0xb2b8('0x17')](_0x467b89);}return null;};}function patchUpdates(_0x4e8943){return function(_0x46273c){try{jsonpatch[_0xb2b8('0x1c')](_0x46273c,_0x4e8943,!![]);}catch(_0x4ebb81){return BPromise[_0xb2b8('0x1d')](_0x4ebb81);}return _0x46273c[_0xb2b8('0x1e')]();};}function saveUpdates(_0x393725,_0x568201){return function(_0x552ff2){if(_0x552ff2){return _0x552ff2[_0xb2b8('0x1f')](_0x393725)[_0xb2b8('0x20')](function(_0x1af211){return _0x1af211;});}return null;};}function removeEntity(_0x101d50,_0x4761aa){return function(_0x37227c){if(_0x37227c){return _0x37227c['destroy']()[_0xb2b8('0x20')](function(){_0x101d50[_0xb2b8('0x15')](0xcc)[_0xb2b8('0x16')]();});}};}function handleEntityNotFound(_0x3d6771,_0x4235ed){return function(_0x3f4188){if(!_0x3f4188){_0x3d6771[_0xb2b8('0x14')](0x194);}return _0x3f4188;};}function handleError(_0x439f67,_0x441cb4){_0x441cb4=_0x441cb4||0x1f4;return function(_0x5365c5){logger['error'](_0x5365c5[_0xb2b8('0x21')]);if(_0x5365c5[_0xb2b8('0x22')]){delete _0x5365c5[_0xb2b8('0x22')];}_0x439f67[_0xb2b8('0x15')](_0x441cb4)['send'](_0x5365c5);};}exports[_0xb2b8('0x23')]=function(_0x539968,_0x265e54){var _0x1dc786={},_0x2dffe2={},_0x18c2bc={'count':0x0,'rows':[]};var _0xd6e93e=_[_0xb2b8('0x24')](db[_0xb2b8('0x25')][_0xb2b8('0x26')],function(_0x52de08){return{'name':_0x52de08[_0xb2b8('0x27')],'type':_0x52de08[_0xb2b8('0x28')][_0xb2b8('0x29')]};});_0x2dffe2[_0xb2b8('0x2a')]=_[_0xb2b8('0x24')](_0xd6e93e,_0xb2b8('0x22'));_0x2dffe2['query']=_[_0xb2b8('0x2b')](_0x539968['query']);_0x2dffe2['filters']=_['intersection'](_0x2dffe2[_0xb2b8('0x2a')],_0x2dffe2[_0xb2b8('0x2c')]);_0x1dc786[_0xb2b8('0x2d')]=_['intersection'](_0x2dffe2[_0xb2b8('0x2a')],qs['fields'](_0x539968[_0xb2b8('0x2c')]['fields']));_0x1dc786[_0xb2b8('0x2d')]=_0x1dc786[_0xb2b8('0x2d')][_0xb2b8('0x2e')]?_0x1dc786[_0xb2b8('0x2d')]:_0x2dffe2['model'];if(!_0x539968[_0xb2b8('0x2c')]['hasOwnProperty'](_0xb2b8('0x2f'))){_0x1dc786['limit']=qs[_0xb2b8('0x19')](_0x539968['query'][_0xb2b8('0x19')]);_0x1dc786[_0xb2b8('0x18')]=qs[_0xb2b8('0x18')](_0x539968[_0xb2b8('0x2c')]['offset']);}_0x1dc786[_0xb2b8('0x30')]=qs[_0xb2b8('0x31')](_0x539968[_0xb2b8('0x2c')]['sort']);_0x1dc786['where']=qs[_0xb2b8('0x32')](_[_0xb2b8('0x33')](_0x539968['query'],_0x2dffe2[_0xb2b8('0x32')]),_0xd6e93e);if(_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x34')]){_0x1dc786[_0xb2b8('0x35')]=_[_0xb2b8('0x36')](_0x1dc786[_0xb2b8('0x35')],{'$or':_[_0xb2b8('0x24')](_0xd6e93e,function(_0x3c0fcb){if(_0x3c0fcb[_0xb2b8('0x28')]!==_0xb2b8('0x37')){var _0x4a65ba={};_0x4a65ba[_0x3c0fcb[_0xb2b8('0x22')]]={'$like':'%'+_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x34')]+'%'};return _0x4a65ba;}})});}_0x1dc786=_[_0xb2b8('0x36')]({},_0x1dc786,_0x539968['options']);var _0x500e50={'where':_0x1dc786['where']};return db[_0xb2b8('0x25')][_0xb2b8('0x38')](_0x500e50)[_0xb2b8('0x20')](function(_0x174e7f){_0x18c2bc[_0xb2b8('0x38')]=_0x174e7f;if(_0x539968[_0xb2b8('0x2c')][_0xb2b8('0x39')]){_0x1dc786[_0xb2b8('0x3a')]=[{'all':!![]}];}return db[_0xb2b8('0x25')][_0xb2b8('0x3b')](_0x1dc786);})[_0xb2b8('0x20')](function(_0x45686e){_0x18c2bc['rows']=_0x45686e;return _0x18c2bc;})[_0xb2b8('0x20')](respondWithFilteredResult(_0x265e54,_0x1dc786))[_0xb2b8('0x3c')](handleError(_0x265e54,null));};exports[_0xb2b8('0x3d')]=function(_0x5368fa,_0x55936d){var _0x56e5be={'raw':!![],'where':{'id':_0x5368fa[_0xb2b8('0x3e')]['id']}},_0x521bdc={};_0x521bdc['model']=_[_0xb2b8('0x2b')](db[_0xb2b8('0x25')][_0xb2b8('0x26')]);_0x521bdc['query']=_[_0xb2b8('0x2b')](_0x5368fa[_0xb2b8('0x2c')]);_0x521bdc['filters']=_['intersection'](_0x521bdc['model'],_0x521bdc['query']);_0x56e5be[_0xb2b8('0x2d')]=_[_0xb2b8('0x3f')](_0x521bdc[_0xb2b8('0x2a')],qs[_0xb2b8('0x40')](_0x5368fa[_0xb2b8('0x2c')][_0xb2b8('0x40')]));_0x56e5be[_0xb2b8('0x2d')]=_0x56e5be['attributes'][_0xb2b8('0x2e')]?_0x56e5be[_0xb2b8('0x2d')]:_0x521bdc[_0xb2b8('0x2a')];if(_0x5368fa[_0xb2b8('0x2c')][_0xb2b8('0x39')]){_0x56e5be[_0xb2b8('0x3a')]=[{'all':!![]}];}_0x56e5be=_[_0xb2b8('0x36')]({},_0x56e5be,_0x5368fa['options']);return db[_0xb2b8('0x25')][_0xb2b8('0x41')](_0x56e5be)[_0xb2b8('0x20')](handleEntityNotFound(_0x55936d,null))[_0xb2b8('0x20')](respondWithResult(_0x55936d,null))['catch'](handleError(_0x55936d,null));};exports[_0xb2b8('0x42')]=function(_0x4cc2a6,_0x18dd23){return db['MailSubstatus']['create'](_0x4cc2a6[_0xb2b8('0x43')],{})[_0xb2b8('0x20')](respondWithResult(_0x18dd23,0xc9))[_0xb2b8('0x3c')](handleError(_0x18dd23,null));};exports[_0xb2b8('0x1f')]=function(_0x2121c1,_0x5ef464){if(_0x2121c1[_0xb2b8('0x43')]['id']){delete _0x2121c1[_0xb2b8('0x43')]['id'];}return db['MailSubstatus'][_0xb2b8('0x41')]({'where':{'id':_0x2121c1[_0xb2b8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ef464,null))[_0xb2b8('0x20')](saveUpdates(_0x2121c1['body'],null))[_0xb2b8('0x20')](respondWithResult(_0x5ef464,null))[_0xb2b8('0x3c')](handleError(_0x5ef464,null));};exports[_0xb2b8('0x44')]=function(_0x979a46,_0xcd3b77){return db[_0xb2b8('0x25')]['find']({'where':{'id':_0x979a46[_0xb2b8('0x3e')]['id']}})[_0xb2b8('0x20')](handleEntityNotFound(_0xcd3b77,null))[_0xb2b8('0x20')](removeEntity(_0xcd3b77,null))[_0xb2b8('0x3c')](handleError(_0xcd3b77,null));};exports['describe']=function(_0x253357,_0x1ea0f7){return db['MailSubstatus'][_0xb2b8('0x45')]()[_0xb2b8('0x20')](respondWithResult(_0x1ea0f7,null))[_0xb2b8('0x3c')](handleError(_0x1ea0f7,null));}; \ No newline at end of file +var _0xa30a=['count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','MailSubstatus','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','model','rawAttributes','find','create','update','body','params','describe','html-pdf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa30a,0xbf));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require('moment');var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require(_0xaa30('0xa'));var ejs=require(_0xaa30('0xb'));var fs=require('fs');var _=require(_0xaa30('0xc'));var squel=require('squel');var crypto=require(_0xaa30('0xd'));var jsforce=require(_0xaa30('0xe'));var deskjs=require(_0xaa30('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaa30('0x13'));var as=require(_0xaa30('0x14'));var hardwareService=require(_0xaa30('0x15'));var logger=require(_0xaa30('0x16'))('api');var utils=require(_0xaa30('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x164a2c,_0x373c6c){_0x373c6c=_0x373c6c||0xcc;return function(_0x5ca673){if(_0x5ca673){return _0x164a2c[_0xaa30('0x18')](_0x373c6c);}return _0x164a2c[_0xaa30('0x19')](_0x373c6c)[_0xaa30('0x1a')]();};}function respondWithResult(_0x515e33,_0x30a321){_0x30a321=_0x30a321||0xc8;return function(_0x209e5f){if(_0x209e5f){return _0x515e33[_0xaa30('0x19')](_0x30a321)[_0xaa30('0x1b')](_0x209e5f);}};}function respondWithFilteredResult(_0x1ca491,_0x225f30){return function(_0xdaf201){if(_0xdaf201){var _0x21cb17=_0xdaf201[_0xaa30('0x1c')],_0x496351=_0x225f30[_0xaa30('0x1d')],_0x20fd65=_0x225f30[_0xaa30('0x1d')]+_0x225f30['limit'],_0x4fd0d1;if(_0x20fd65>=_0x21cb17){_0x20fd65=_0x21cb17;_0x4fd0d1=0xc8;}else{_0x4fd0d1=0xce;}_0x1ca491[_0xaa30('0x19')](_0x4fd0d1);return _0x1ca491[_0xaa30('0x1e')](_0xaa30('0x1f'),_0x496351+'-'+_0x20fd65+'/'+_0x21cb17)['json'](_0xdaf201);}return null;};}function patchUpdates(_0x3e8ba5){return function(_0x3c0292){try{jsonpatch[_0xaa30('0x20')](_0x3c0292,_0x3e8ba5,!![]);}catch(_0x46d801){return BPromise['reject'](_0x46d801);}return _0x3c0292[_0xaa30('0x21')]();};}function saveUpdates(_0x3c4b10,_0xea83bd){return function(_0x2531fc){if(_0x2531fc){return _0x2531fc['update'](_0x3c4b10)[_0xaa30('0x22')](function(_0x276ce8){return _0x276ce8;});}return null;};}function removeEntity(_0x365a83,_0x1dea9a){return function(_0x5a8989){if(_0x5a8989){return _0x5a8989[_0xaa30('0x23')]()['then'](function(){_0x365a83[_0xaa30('0x19')](0xcc)[_0xaa30('0x1a')]();});}};}function handleEntityNotFound(_0x48ebf6,_0x10af57){return function(_0x1dd39f){if(!_0x1dd39f){_0x48ebf6[_0xaa30('0x18')](0x194);}return _0x1dd39f;};}function handleError(_0x144ce0,_0x526491){_0x526491=_0x526491||0x1f4;return function(_0x2f3ee5){logger['error'](_0x2f3ee5[_0xaa30('0x24')]);if(_0x2f3ee5['name']){delete _0x2f3ee5[_0xaa30('0x25')];}_0x144ce0[_0xaa30('0x19')](_0x526491)[_0xaa30('0x26')](_0x2f3ee5);};}exports[_0xaa30('0x27')]=function(_0x20d9f9,_0x2ad9f3){var _0x4d83f8={},_0x2b116b={},_0x33f489={'count':0x0,'rows':[]};var _0x9eb198=_[_0xaa30('0x28')](db[_0xaa30('0x29')]['rawAttributes'],function(_0x40dcc7){return{'name':_0x40dcc7[_0xaa30('0x2a')],'type':_0x40dcc7['type'][_0xaa30('0x2b')]};});_0x2b116b['model']=_[_0xaa30('0x28')](_0x9eb198,_0xaa30('0x25'));_0x2b116b[_0xaa30('0x2c')]=_[_0xaa30('0x2d')](_0x20d9f9[_0xaa30('0x2c')]);_0x2b116b[_0xaa30('0x2e')]=_[_0xaa30('0x2f')](_0x2b116b['model'],_0x2b116b['query']);_0x4d83f8['attributes']=_[_0xaa30('0x2f')](_0x2b116b['model'],qs[_0xaa30('0x30')](_0x20d9f9[_0xaa30('0x2c')][_0xaa30('0x30')]));_0x4d83f8[_0xaa30('0x31')]=_0x4d83f8[_0xaa30('0x31')][_0xaa30('0x32')]?_0x4d83f8[_0xaa30('0x31')]:_0x2b116b['model'];if(!_0x20d9f9['query'][_0xaa30('0x33')](_0xaa30('0x34'))){_0x4d83f8[_0xaa30('0x35')]=qs[_0xaa30('0x35')](_0x20d9f9[_0xaa30('0x2c')][_0xaa30('0x35')]);_0x4d83f8['offset']=qs[_0xaa30('0x1d')](_0x20d9f9[_0xaa30('0x2c')][_0xaa30('0x1d')]);}_0x4d83f8[_0xaa30('0x36')]=qs['sort'](_0x20d9f9['query']['sort']);_0x4d83f8[_0xaa30('0x37')]=qs['filters'](_['pick'](_0x20d9f9[_0xaa30('0x2c')],_0x2b116b['filters']),_0x9eb198);if(_0x20d9f9[_0xaa30('0x2c')][_0xaa30('0x38')]){_0x4d83f8[_0xaa30('0x37')]=_[_0xaa30('0x39')](_0x4d83f8[_0xaa30('0x37')],{'$or':_[_0xaa30('0x28')](_0x9eb198,function(_0x2fa1b1){if(_0x2fa1b1[_0xaa30('0x3a')]!==_0xaa30('0x3b')){var _0x39c74c={};_0x39c74c[_0x2fa1b1[_0xaa30('0x25')]]={'$like':'%'+_0x20d9f9['query']['filter']+'%'};return _0x39c74c;}})});}_0x4d83f8=_[_0xaa30('0x39')]({},_0x4d83f8,_0x20d9f9[_0xaa30('0x3c')]);var _0x20b088={'where':_0x4d83f8[_0xaa30('0x37')]};return db[_0xaa30('0x29')][_0xaa30('0x1c')](_0x20b088)['then'](function(_0x42d00f){_0x33f489['count']=_0x42d00f;if(_0x20d9f9[_0xaa30('0x2c')]['includeAll']){_0x4d83f8[_0xaa30('0x3d')]=[{'all':!![]}];}return db['MailSubstatus'][_0xaa30('0x3e')](_0x4d83f8);})[_0xaa30('0x22')](function(_0x43fd59){_0x33f489[_0xaa30('0x3f')]=_0x43fd59;return _0x33f489;})[_0xaa30('0x22')](respondWithFilteredResult(_0x2ad9f3,_0x4d83f8))[_0xaa30('0x40')](handleError(_0x2ad9f3,null));};exports['show']=function(_0x38ffd0,_0x1603c0){var _0x21863b={'raw':!![],'where':{'id':_0x38ffd0['params']['id']}},_0x375d05={};_0x375d05[_0xaa30('0x41')]=_[_0xaa30('0x2d')](db[_0xaa30('0x29')][_0xaa30('0x42')]);_0x375d05[_0xaa30('0x2c')]=_[_0xaa30('0x2d')](_0x38ffd0[_0xaa30('0x2c')]);_0x375d05['filters']=_['intersection'](_0x375d05['model'],_0x375d05[_0xaa30('0x2c')]);_0x21863b[_0xaa30('0x31')]=_['intersection'](_0x375d05[_0xaa30('0x41')],qs['fields'](_0x38ffd0[_0xaa30('0x2c')][_0xaa30('0x30')]));_0x21863b[_0xaa30('0x31')]=_0x21863b[_0xaa30('0x31')]['length']?_0x21863b[_0xaa30('0x31')]:_0x375d05[_0xaa30('0x41')];if(_0x38ffd0[_0xaa30('0x2c')]['includeAll']){_0x21863b[_0xaa30('0x3d')]=[{'all':!![]}];}_0x21863b=_['merge']({},_0x21863b,_0x38ffd0[_0xaa30('0x3c')]);return db[_0xaa30('0x29')][_0xaa30('0x43')](_0x21863b)['then'](handleEntityNotFound(_0x1603c0,null))[_0xaa30('0x22')](respondWithResult(_0x1603c0,null))[_0xaa30('0x40')](handleError(_0x1603c0,null));};exports['create']=function(_0xf2a20f,_0x158eb5){return db[_0xaa30('0x29')][_0xaa30('0x44')](_0xf2a20f['body'],{})['then'](respondWithResult(_0x158eb5,0xc9))[_0xaa30('0x40')](handleError(_0x158eb5,null));};exports[_0xaa30('0x45')]=function(_0x1dbcf4,_0x27fa3e){if(_0x1dbcf4[_0xaa30('0x46')]['id']){delete _0x1dbcf4[_0xaa30('0x46')]['id'];}return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x1dbcf4[_0xaa30('0x47')]['id']}})[_0xaa30('0x22')](handleEntityNotFound(_0x27fa3e,null))[_0xaa30('0x22')](saveUpdates(_0x1dbcf4['body'],null))[_0xaa30('0x22')](respondWithResult(_0x27fa3e,null))[_0xaa30('0x40')](handleError(_0x27fa3e,null));};exports[_0xaa30('0x23')]=function(_0x3e3450,_0x1c752b){return db[_0xaa30('0x29')][_0xaa30('0x43')]({'where':{'id':_0x3e3450[_0xaa30('0x47')]['id']}})[_0xaa30('0x22')](handleEntityNotFound(_0x1c752b,null))[_0xaa30('0x22')](removeEntity(_0x1c752b,null))[_0xaa30('0x40')](handleError(_0x1c752b,null));};exports[_0xaa30('0x48')]=function(_0xa12dd1,_0x5de49b){return db[_0xaa30('0x29')][_0xaa30('0x48')]()[_0xaa30('0x22')](respondWithResult(_0x5de49b,null))[_0xaa30('0x40')](handleError(_0x5de49b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 48c8a37..75c7f34 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 _0x0ca4=['exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','rimraf','./mailSubstatus.attributes'];(function(_0x5eaf1f,_0xac547c){var _0x24e765=function(_0x412b0f){while(--_0x412b0f){_0x5eaf1f['push'](_0x5eaf1f['shift']());}};_0x24e765(++_0xac547c);}(_0x0ca4,0x93));var _0x40ca=function(_0x207bd6,_0x348742){_0x207bd6=_0x207bd6-0x0;var _0x413416=_0x0ca4[_0x207bd6];return _0x413416;};'use strict';var _=require(_0x40ca('0x0'));var util=require(_0x40ca('0x1'));var logger=require(_0x40ca('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40ca('0x3'));var config=require('../../config/environment');var attributes=require(_0x40ca('0x4'));module[_0x40ca('0x5')]=function(_0xaa1132,_0x38add5){return _0xaa1132['define'](_0x40ca('0x6'),attributes,{'tableName':_0x40ca('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc449=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports'];(function(_0xb6f303,_0x2d245e){var _0x340e9a=function(_0x44b731){while(--_0x44b731){_0xb6f303['push'](_0xb6f303['shift']());}};_0x340e9a(++_0x2d245e);}(_0xc449,0x14d));var _0x9c44=function(_0x55ccd4,_0xa77cef){_0x55ccd4=_0x55ccd4-0x0;var _0x2d7e7e=_0xc449[_0x55ccd4];return _0x2d7e7e;};'use strict';var _=require(_0x9c44('0x0'));var util=require(_0x9c44('0x1'));var logger=require(_0x9c44('0x2'))(_0x9c44('0x3'));var moment=require(_0x9c44('0x4'));var BPromise=require(_0x9c44('0x5'));var rp=require(_0x9c44('0x6'));var fs=require('fs');var path=require(_0x9c44('0x7'));var rimraf=require(_0x9c44('0x8'));var config=require(_0x9c44('0x9'));var attributes=require(_0x9c44('0xa'));module[_0x9c44('0xb')]=function(_0x53798c,_0x4fee86){return _0x53798c[_0x9c44('0xc')](_0x9c44('0xd'),attributes,{'tableName':_0x9c44('0xe'),'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 eb7decf..75019f3 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 _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x546ca4,_0x2f0016){_0x546ca4=_0x546ca4-0x0;var _0x47e1bd=_0xbdb7[_0x546ca4];return _0x47e1bd;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x55e0,0xdc));var _0x055e=function(_0x2e79f5,_0x5232fe){_0x2e79f5=_0x2e79f5-0x0;var _0xd0585d=_0x55e0[_0x2e79f5];return _0xd0585d;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 49a7b7d..10f78d1 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 _0x0953=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x28dda8,_0x39ba67){var _0x57738e=function(_0x30cdd1){while(--_0x30cdd1){_0x28dda8['push'](_0x28dda8['shift']());}};_0x57738e(++_0x39ba67);}(_0x0953,0x137));var _0x3095=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x0953[_0x111e94];return _0x3de107;};'use strict';var multer=require('multer');var util=require(_0x3095('0x0'));var path=require(_0x3095('0x1'));var timeout=require(_0x3095('0x2'));var express=require(_0x3095('0x3'));var router=express[_0x3095('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3095('0x5'));var controller=require(_0x3095('0x6'));router[_0x3095('0x7')]('/',auth[_0x3095('0x8')](),controller[_0x3095('0x9')]);router[_0x3095('0x7')](_0x3095('0xa'),auth['isAuthenticated'](),controller[_0x3095('0xb')]);router[_0x3095('0x7')](_0x3095('0xc'),auth[_0x3095('0x8')](),controller[_0x3095('0xd')]);router[_0x3095('0xe')]('/',auth['isAuthenticated'](),controller[_0x3095('0xf')]);router[_0x3095('0x10')]('/:id',auth[_0x3095('0x8')](),controller[_0x3095('0x11')]);router[_0x3095('0x12')](_0x3095('0xc'),auth[_0x3095('0x8')](),controller[_0x3095('0x13')]);module['exports']=router; \ No newline at end of file +var _0xebd2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','update','delete','exports','util','path','connect-timeout'];(function(_0x263401,_0x35259d){var _0x4b5b75=function(_0x478e64){while(--_0x478e64){_0x263401['push'](_0x263401['shift']());}};_0x4b5b75(++_0x35259d);}(_0xebd2,0xce));var _0x2ebd=function(_0x52fc73,_0xabb299){_0x52fc73=_0x52fc73-0x0;var _0x1b1110=_0xebd2[_0x52fc73];return _0x1b1110;};'use strict';var multer=require('multer');var util=require(_0x2ebd('0x0'));var path=require(_0x2ebd('0x1'));var timeout=require(_0x2ebd('0x2'));var express=require('express');var router=express[_0x2ebd('0x3')]();var auth=require(_0x2ebd('0x4'));var interaction=require(_0x2ebd('0x5'));var config=require(_0x2ebd('0x6'));var controller=require(_0x2ebd('0x7'));router[_0x2ebd('0x8')]('/',auth['isAuthenticated'](),controller[_0x2ebd('0x9')]);router[_0x2ebd('0x8')](_0x2ebd('0xa'),auth[_0x2ebd('0xb')](),controller['describe']);router[_0x2ebd('0x8')](_0x2ebd('0xc'),auth[_0x2ebd('0xb')](),controller[_0x2ebd('0xd')]);router[_0x2ebd('0xe')]('/',auth[_0x2ebd('0xb')](),controller[_0x2ebd('0xf')]);router['put'](_0x2ebd('0xc'),auth['isAuthenticated'](),controller[_0x2ebd('0x10')]);router[_0x2ebd('0x11')](_0x2ebd('0xc'),auth[_0x2ebd('0xb')](),controller['destroy']);module[_0x2ebd('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 019bcf4..38c4047 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 _0xf407=['queue','DATE','moment','sequelize','exports','ENUM'];(function(_0x6029ff,_0x189ce9){var _0x36c1d2=function(_0x23eab5){while(--_0x23eab5){_0x6029ff['push'](_0x6029ff['shift']());}};_0x36c1d2(++_0x189ce9);}(_0xf407,0xd4));var _0x7f40=function(_0x30c330,_0x5da11e){_0x30c330=_0x30c330-0x0;var _0x3101ed=_0xf407[_0x30c330];return _0x3101ed;};'use strict';var moment=require(_0x7f40('0x0'));var Sequelize=require(_0x7f40('0x1'));module[_0x7f40('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7f40('0x3')]('account','agent',_0x7f40('0x4')),'allowNull':![],'defaultValue':_0x7f40('0x4')},'transferredAt':{'type':Sequelize[_0x7f40('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf694=['sequelize','STRING','account','agent','queue','NOW'];(function(_0x3a2a0b,_0x23294c){var _0x12a24f=function(_0x3ba1d3){while(--_0x3ba1d3){_0x3a2a0b['push'](_0x3a2a0b['shift']());}};_0x12a24f(++_0x23294c);}(_0xf694,0x1b6));var _0x4f69=function(_0x11803c,_0x31fc89){_0x11803c=_0x11803c-0x0;var _0x1d8a7a=_0xf694[_0x11803c];return _0x1d8a7a;};'use strict';var moment=require('moment');var Sequelize=require(_0x4f69('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4f69('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4f69('0x2'),_0x4f69('0x3'),_0x4f69('0x4')),'allowNull':![],'defaultValue':_0x4f69('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4f69('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5687763..17cde24 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 _0x3803=['to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','rows','show','params','find','catch','create','body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x115894,_0x4b1f30){var _0x45b51c=function(_0x18b628){while(--_0x18b628){_0x115894['push'](_0x115894['shift']());}};_0x45b51c(++_0x4b1f30);}(_0x3803,0x8a));var _0x3380=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3803[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0x3380('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3380('0x1'));var jsonpatch=require(_0x3380('0x2'));var rp=require(_0x3380('0x3'));var moment=require(_0x3380('0x4'));var BPromise=require(_0x3380('0x5'));var Mustache=require(_0x3380('0x6'));var util=require(_0x3380('0x7'));var path=require(_0x3380('0x8'));var sox=require(_0x3380('0x9'));var csv=require(_0x3380('0xa'));var ejs=require(_0x3380('0xb'));var fs=require('fs');var _=require(_0x3380('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3380('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3380('0xa'));var querystring=require(_0x3380('0xe'));var Papa=require(_0x3380('0xf'));var Redis=require(_0x3380('0x10'));var authService=require(_0x3380('0x11'));var qs=require(_0x3380('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3380('0x13'));var logger=require(_0x3380('0x14'))('api');var utils=require(_0x3380('0x15'));var config=require(_0x3380('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf08ec5,_0x57d0d7){_0x57d0d7=_0x57d0d7||0xcc;return function(_0x5672ec){if(_0x5672ec){return _0xf08ec5['sendStatus'](_0x57d0d7);}return _0xf08ec5[_0x3380('0x17')](_0x57d0d7)[_0x3380('0x18')]();};}function respondWithResult(_0x99c0d2,_0x5e248e){_0x5e248e=_0x5e248e||0xc8;return function(_0x20b7ee){if(_0x20b7ee){return _0x99c0d2['status'](_0x5e248e)['json'](_0x20b7ee);}};}function respondWithFilteredResult(_0x2d0ed4,_0x38ea00){return function(_0xc82218){if(_0xc82218){var _0x3ca5ac=_0xc82218['count'],_0x30ac07=_0x38ea00['offset'],_0x5d348d=_0x38ea00[_0x3380('0x19')]+_0x38ea00[_0x3380('0x1a')],_0x4104fd;if(_0x5d348d>=_0x3ca5ac){_0x5d348d=_0x3ca5ac;_0x4104fd=0xc8;}else{_0x4104fd=0xce;}_0x2d0ed4[_0x3380('0x17')](_0x4104fd);return _0x2d0ed4[_0x3380('0x1b')](_0x3380('0x1c'),_0x30ac07+'-'+_0x5d348d+'/'+_0x3ca5ac)[_0x3380('0x1d')](_0xc82218);}return null;};}function patchUpdates(_0x32940b){return function(_0x2b9f8a){try{jsonpatch[_0x3380('0x1e')](_0x2b9f8a,_0x32940b,!![]);}catch(_0x4159c3){return BPromise[_0x3380('0x1f')](_0x4159c3);}return _0x2b9f8a[_0x3380('0x20')]();};}function saveUpdates(_0x1030c7,_0x4d9d6e){return function(_0x5d6ec2){if(_0x5d6ec2){return _0x5d6ec2[_0x3380('0x21')](_0x1030c7)[_0x3380('0x22')](function(_0x4d9ccd){return _0x4d9ccd;});}return null;};}function removeEntity(_0x3f42a6,_0x1887ab){return function(_0x45a2a8){if(_0x45a2a8){return _0x45a2a8[_0x3380('0x23')]()[_0x3380('0x22')](function(){_0x3f42a6[_0x3380('0x17')](0xcc)[_0x3380('0x18')]();});}};}function handleEntityNotFound(_0x22a176,_0xd7dc1d){return function(_0x20a704){if(!_0x20a704){_0x22a176[_0x3380('0x24')](0x194);}return _0x20a704;};}function handleError(_0x4fd949,_0x2ddb06){_0x2ddb06=_0x2ddb06||0x1f4;return function(_0x3645aa){logger['error'](_0x3645aa['stack']);if(_0x3645aa[_0x3380('0x25')]){delete _0x3645aa[_0x3380('0x25')];}_0x4fd949[_0x3380('0x17')](_0x2ddb06)[_0x3380('0x26')](_0x3645aa);};}exports[_0x3380('0x27')]=function(_0x591fcf,_0x420feb){var _0x16e12d={},_0x558bdd={},_0x44993a={'count':0x0,'rows':[]};var _0x2111c0=_['map'](db['MailTransferReport'][_0x3380('0x28')],function(_0x255a0c){return{'name':_0x255a0c[_0x3380('0x29')],'type':_0x255a0c[_0x3380('0x2a')][_0x3380('0x2b')]};});_0x558bdd['model']=_[_0x3380('0x2c')](_0x2111c0,_0x3380('0x25'));_0x558bdd[_0x3380('0x2d')]=_[_0x3380('0x2e')](_0x591fcf[_0x3380('0x2d')]);_0x558bdd[_0x3380('0x2f')]=_[_0x3380('0x30')](_0x558bdd[_0x3380('0x31')],_0x558bdd['query']);_0x16e12d[_0x3380('0x32')]=_[_0x3380('0x30')](_0x558bdd['model'],qs[_0x3380('0x33')](_0x591fcf['query'][_0x3380('0x33')]));_0x16e12d[_0x3380('0x32')]=_0x16e12d['attributes'][_0x3380('0x34')]?_0x16e12d[_0x3380('0x32')]:_0x558bdd['model'];if(!_0x591fcf['query'][_0x3380('0x35')](_0x3380('0x36'))){_0x16e12d['limit']=qs[_0x3380('0x1a')](_0x591fcf[_0x3380('0x2d')][_0x3380('0x1a')]);_0x16e12d[_0x3380('0x19')]=qs[_0x3380('0x19')](_0x591fcf['query'][_0x3380('0x19')]);}_0x16e12d['order']=qs['sort'](_0x591fcf[_0x3380('0x2d')][_0x3380('0x37')]);_0x16e12d['where']=qs[_0x3380('0x2f')](_[_0x3380('0x38')](_0x591fcf[_0x3380('0x2d')],_0x558bdd[_0x3380('0x2f')]),_0x2111c0);if(_0x591fcf['query'][_0x3380('0x39')]){_0x16e12d[_0x3380('0x3a')]=_[_0x3380('0x3b')](_0x16e12d[_0x3380('0x3a')],{'$or':_[_0x3380('0x2c')](_0x2111c0,function(_0x536fad){if(_0x536fad[_0x3380('0x2a')]!==_0x3380('0x3c')){var _0x14b7c7={};_0x14b7c7[_0x536fad[_0x3380('0x25')]]={'$like':'%'+_0x591fcf[_0x3380('0x2d')][_0x3380('0x39')]+'%'};return _0x14b7c7;}})});}_0x16e12d=_[_0x3380('0x3b')]({},_0x16e12d,_0x591fcf[_0x3380('0x3d')]);var _0x187d0a={'where':_0x16e12d['where']};return db[_0x3380('0x3e')][_0x3380('0x3f')](_0x187d0a)[_0x3380('0x22')](function(_0x167a6a){_0x44993a[_0x3380('0x3f')]=_0x167a6a;if(_0x591fcf[_0x3380('0x2d')][_0x3380('0x40')]){_0x16e12d[_0x3380('0x41')]=[{'all':!![]}];}return db[_0x3380('0x3e')]['findAll'](_0x16e12d);})['then'](function(_0x4808c7){_0x44993a[_0x3380('0x42')]=_0x4808c7;return _0x44993a;})[_0x3380('0x22')](respondWithFilteredResult(_0x420feb,_0x16e12d))['catch'](handleError(_0x420feb,null));};exports[_0x3380('0x43')]=function(_0x5c9ecd,_0x560228){var _0x28c940={'raw':!![],'where':{'id':_0x5c9ecd[_0x3380('0x44')]['id']}},_0x3c75e3={};_0x3c75e3[_0x3380('0x31')]=_[_0x3380('0x2e')](db['MailTransferReport'][_0x3380('0x28')]);_0x3c75e3['query']=_[_0x3380('0x2e')](_0x5c9ecd[_0x3380('0x2d')]);_0x3c75e3[_0x3380('0x2f')]=_[_0x3380('0x30')](_0x3c75e3[_0x3380('0x31')],_0x3c75e3[_0x3380('0x2d')]);_0x28c940[_0x3380('0x32')]=_[_0x3380('0x30')](_0x3c75e3[_0x3380('0x31')],qs[_0x3380('0x33')](_0x5c9ecd['query'][_0x3380('0x33')]));_0x28c940['attributes']=_0x28c940[_0x3380('0x32')][_0x3380('0x34')]?_0x28c940[_0x3380('0x32')]:_0x3c75e3[_0x3380('0x31')];if(_0x5c9ecd['query']['includeAll']){_0x28c940[_0x3380('0x41')]=[{'all':!![]}];}_0x28c940=_[_0x3380('0x3b')]({},_0x28c940,_0x5c9ecd[_0x3380('0x3d')]);return db[_0x3380('0x3e')][_0x3380('0x45')](_0x28c940)[_0x3380('0x22')](handleEntityNotFound(_0x560228,null))[_0x3380('0x22')](respondWithResult(_0x560228,null))[_0x3380('0x46')](handleError(_0x560228,null));};exports['create']=function(_0x166ee4,_0x2095fe){return db['MailTransferReport'][_0x3380('0x47')](_0x166ee4[_0x3380('0x48')],{})[_0x3380('0x22')](respondWithResult(_0x2095fe,0xc9))[_0x3380('0x46')](handleError(_0x2095fe,null));};exports[_0x3380('0x21')]=function(_0x86c39a,_0x5c6f3d){if(_0x86c39a[_0x3380('0x48')]['id']){delete _0x86c39a[_0x3380('0x48')]['id'];}return db[_0x3380('0x3e')]['find']({'where':{'id':_0x86c39a['params']['id']}})[_0x3380('0x22')](handleEntityNotFound(_0x5c6f3d,null))[_0x3380('0x22')](saveUpdates(_0x86c39a['body'],null))[_0x3380('0x22')](respondWithResult(_0x5c6f3d,null))['catch'](handleError(_0x5c6f3d,null));};exports[_0x3380('0x23')]=function(_0x5c5629,_0x559c81){return db['MailTransferReport'][_0x3380('0x45')]({'where':{'id':_0x5c5629[_0x3380('0x44')]['id']}})['then'](handleEntityNotFound(_0x559c81,null))['then'](removeEntity(_0x559c81,null))[_0x3380('0x46')](handleError(_0x559c81,null));};exports['describe']=function(_0x5529c3,_0x305edb){return db[_0x3380('0x3e')][_0x3380('0x49')]()[_0x3380('0x22')](respondWithResult(_0x305edb,null))[_0x3380('0x46')](handleError(_0x305edb,null));}; \ No newline at end of file +var _0x8fbd=['options','MailTransferReport','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter'];(function(_0x414e73,_0x57569f){var _0x5c3cba=function(_0x1d028a){while(--_0x1d028a){_0x414e73['push'](_0x414e73['shift']());}};_0x5c3cba(++_0x57569f);}(_0x8fbd,0x9e));var _0xd8fb=function(_0x3bc554,_0x2f4309){_0x3bc554=_0x3bc554-0x0;var _0x360a3b=_0x8fbd[_0x3bc554];return _0x360a3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd8fb('0x0'));var rimraf=require(_0xd8fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8fb('0x2'));var rp=require('request-promise');var moment=require(_0xd8fb('0x3'));var BPromise=require(_0xd8fb('0x4'));var Mustache=require(_0xd8fb('0x5'));var util=require(_0xd8fb('0x6'));var path=require(_0xd8fb('0x7'));var sox=require(_0xd8fb('0x8'));var csv=require(_0xd8fb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd8fb('0xa'));var crypto=require('crypto');var jsforce=require(_0xd8fb('0xb'));var deskjs=require(_0xd8fb('0xc'));var toCsv=require(_0xd8fb('0x9'));var querystring=require(_0xd8fb('0xd'));var Papa=require(_0xd8fb('0xe'));var Redis=require(_0xd8fb('0xf'));var authService=require(_0xd8fb('0x10'));var qs=require(_0xd8fb('0x11'));var as=require(_0xd8fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8fb('0x13'))(_0xd8fb('0x14'));var utils=require(_0xd8fb('0x15'));var config=require(_0xd8fb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ee482,_0x107226){_0x107226=_0x107226||0xcc;return function(_0x15490b){if(_0x15490b){return _0x4ee482[_0xd8fb('0x17')](_0x107226);}return _0x4ee482[_0xd8fb('0x18')](_0x107226)[_0xd8fb('0x19')]();};}function respondWithResult(_0x186fcb,_0x32b10d){_0x32b10d=_0x32b10d||0xc8;return function(_0x580e94){if(_0x580e94){return _0x186fcb[_0xd8fb('0x18')](_0x32b10d)[_0xd8fb('0x1a')](_0x580e94);}};}function respondWithFilteredResult(_0xbcf7e8,_0x4f5468){return function(_0x10fd6c){if(_0x10fd6c){var _0x2b1e3f=_0x10fd6c['count'],_0x4b12da=_0x4f5468[_0xd8fb('0x1b')],_0x2c08d6=_0x4f5468[_0xd8fb('0x1b')]+_0x4f5468['limit'],_0xd78779;if(_0x2c08d6>=_0x2b1e3f){_0x2c08d6=_0x2b1e3f;_0xd78779=0xc8;}else{_0xd78779=0xce;}_0xbcf7e8[_0xd8fb('0x18')](_0xd78779);return _0xbcf7e8[_0xd8fb('0x1c')](_0xd8fb('0x1d'),_0x4b12da+'-'+_0x2c08d6+'/'+_0x2b1e3f)[_0xd8fb('0x1a')](_0x10fd6c);}return null;};}function patchUpdates(_0x18ad8d){return function(_0x7789ab){try{jsonpatch[_0xd8fb('0x1e')](_0x7789ab,_0x18ad8d,!![]);}catch(_0x8af947){return BPromise['reject'](_0x8af947);}return _0x7789ab[_0xd8fb('0x1f')]();};}function saveUpdates(_0x5747d1,_0x36fe15){return function(_0x5e0f72){if(_0x5e0f72){return _0x5e0f72[_0xd8fb('0x20')](_0x5747d1)['then'](function(_0x1fe6b1){return _0x1fe6b1;});}return null;};}function removeEntity(_0x58cd0b,_0x25dbfa){return function(_0x2e5068){if(_0x2e5068){return _0x2e5068['destroy']()[_0xd8fb('0x21')](function(){_0x58cd0b['status'](0xcc)[_0xd8fb('0x19')]();});}};}function handleEntityNotFound(_0x4dff1f,_0x5ea5d0){return function(_0x4c0b5c){if(!_0x4c0b5c){_0x4dff1f[_0xd8fb('0x17')](0x194);}return _0x4c0b5c;};}function handleError(_0x55fcc0,_0x2b103f){_0x2b103f=_0x2b103f||0x1f4;return function(_0x4285c6){logger[_0xd8fb('0x22')](_0x4285c6[_0xd8fb('0x23')]);if(_0x4285c6[_0xd8fb('0x24')]){delete _0x4285c6['name'];}_0x55fcc0[_0xd8fb('0x18')](_0x2b103f)[_0xd8fb('0x25')](_0x4285c6);};}exports[_0xd8fb('0x26')]=function(_0x3cb675,_0x550574){var _0x1ed599={},_0x291771={},_0x5ebe09={'count':0x0,'rows':[]};var _0x2135a3=_['map'](db['MailTransferReport']['rawAttributes'],function(_0xc4de58){return{'name':_0xc4de58['fieldName'],'type':_0xc4de58[_0xd8fb('0x27')][_0xd8fb('0x28')]};});_0x291771[_0xd8fb('0x29')]=_[_0xd8fb('0x2a')](_0x2135a3,_0xd8fb('0x24'));_0x291771[_0xd8fb('0x2b')]=_[_0xd8fb('0x2c')](_0x3cb675['query']);_0x291771[_0xd8fb('0x2d')]=_[_0xd8fb('0x2e')](_0x291771[_0xd8fb('0x29')],_0x291771[_0xd8fb('0x2b')]);_0x1ed599[_0xd8fb('0x2f')]=_[_0xd8fb('0x2e')](_0x291771[_0xd8fb('0x29')],qs['fields'](_0x3cb675[_0xd8fb('0x2b')][_0xd8fb('0x30')]));_0x1ed599['attributes']=_0x1ed599[_0xd8fb('0x2f')]['length']?_0x1ed599[_0xd8fb('0x2f')]:_0x291771['model'];if(!_0x3cb675['query'][_0xd8fb('0x31')](_0xd8fb('0x32'))){_0x1ed599[_0xd8fb('0x33')]=qs['limit'](_0x3cb675[_0xd8fb('0x2b')]['limit']);_0x1ed599['offset']=qs[_0xd8fb('0x1b')](_0x3cb675[_0xd8fb('0x2b')][_0xd8fb('0x1b')]);}_0x1ed599[_0xd8fb('0x34')]=qs[_0xd8fb('0x35')](_0x3cb675[_0xd8fb('0x2b')]['sort']);_0x1ed599[_0xd8fb('0x36')]=qs[_0xd8fb('0x2d')](_[_0xd8fb('0x37')](_0x3cb675[_0xd8fb('0x2b')],_0x291771[_0xd8fb('0x2d')]),_0x2135a3);if(_0x3cb675[_0xd8fb('0x2b')]['filter']){_0x1ed599[_0xd8fb('0x36')]=_[_0xd8fb('0x38')](_0x1ed599[_0xd8fb('0x36')],{'$or':_['map'](_0x2135a3,function(_0x317af0){if(_0x317af0[_0xd8fb('0x27')]!=='VIRTUAL'){var _0x15d402={};_0x15d402[_0x317af0['name']]={'$like':'%'+_0x3cb675[_0xd8fb('0x2b')][_0xd8fb('0x39')]+'%'};return _0x15d402;}})});}_0x1ed599=_[_0xd8fb('0x38')]({},_0x1ed599,_0x3cb675[_0xd8fb('0x3a')]);var _0x80270c={'where':_0x1ed599[_0xd8fb('0x36')]};return db[_0xd8fb('0x3b')][_0xd8fb('0x3c')](_0x80270c)[_0xd8fb('0x21')](function(_0x154821){_0x5ebe09[_0xd8fb('0x3c')]=_0x154821;if(_0x3cb675[_0xd8fb('0x2b')][_0xd8fb('0x3d')]){_0x1ed599[_0xd8fb('0x3e')]=[{'all':!![]}];}return db[_0xd8fb('0x3b')]['findAll'](_0x1ed599);})[_0xd8fb('0x21')](function(_0x2eb7b5){_0x5ebe09[_0xd8fb('0x3f')]=_0x2eb7b5;return _0x5ebe09;})[_0xd8fb('0x21')](respondWithFilteredResult(_0x550574,_0x1ed599))[_0xd8fb('0x40')](handleError(_0x550574,null));};exports[_0xd8fb('0x41')]=function(_0x388c0e,_0x4790cf){var _0x504582={'raw':!![],'where':{'id':_0x388c0e[_0xd8fb('0x42')]['id']}},_0x103b77={};_0x103b77[_0xd8fb('0x29')]=_[_0xd8fb('0x2c')](db[_0xd8fb('0x3b')][_0xd8fb('0x43')]);_0x103b77['query']=_['keys'](_0x388c0e[_0xd8fb('0x2b')]);_0x103b77[_0xd8fb('0x2d')]=_[_0xd8fb('0x2e')](_0x103b77[_0xd8fb('0x29')],_0x103b77[_0xd8fb('0x2b')]);_0x504582[_0xd8fb('0x2f')]=_[_0xd8fb('0x2e')](_0x103b77[_0xd8fb('0x29')],qs['fields'](_0x388c0e[_0xd8fb('0x2b')]['fields']));_0x504582[_0xd8fb('0x2f')]=_0x504582['attributes']['length']?_0x504582[_0xd8fb('0x2f')]:_0x103b77[_0xd8fb('0x29')];if(_0x388c0e[_0xd8fb('0x2b')][_0xd8fb('0x3d')]){_0x504582[_0xd8fb('0x3e')]=[{'all':!![]}];}_0x504582=_[_0xd8fb('0x38')]({},_0x504582,_0x388c0e[_0xd8fb('0x3a')]);return db['MailTransferReport'][_0xd8fb('0x44')](_0x504582)[_0xd8fb('0x21')](handleEntityNotFound(_0x4790cf,null))[_0xd8fb('0x21')](respondWithResult(_0x4790cf,null))[_0xd8fb('0x40')](handleError(_0x4790cf,null));};exports['create']=function(_0x227cb5,_0x4abe52){return db[_0xd8fb('0x3b')][_0xd8fb('0x45')](_0x227cb5[_0xd8fb('0x46')],{})[_0xd8fb('0x21')](respondWithResult(_0x4abe52,0xc9))[_0xd8fb('0x40')](handleError(_0x4abe52,null));};exports['update']=function(_0xe5b68d,_0x39876d){if(_0xe5b68d['body']['id']){delete _0xe5b68d[_0xd8fb('0x46')]['id'];}return db[_0xd8fb('0x3b')][_0xd8fb('0x44')]({'where':{'id':_0xe5b68d[_0xd8fb('0x42')]['id']}})[_0xd8fb('0x21')](handleEntityNotFound(_0x39876d,null))['then'](saveUpdates(_0xe5b68d['body'],null))['then'](respondWithResult(_0x39876d,null))[_0xd8fb('0x40')](handleError(_0x39876d,null));};exports['destroy']=function(_0x271e24,_0x2b3f23){return db['MailTransferReport'][_0xd8fb('0x44')]({'where':{'id':_0x271e24['params']['id']}})[_0xd8fb('0x21')](handleEntityNotFound(_0x2b3f23,null))['then'](removeEntity(_0x2b3f23,null))['catch'](handleError(_0x2b3f23,null));};exports[_0xd8fb('0x47')]=function(_0x10a5c4,_0x39beaa){return db[_0xd8fb('0x3b')][_0xd8fb('0x47')]()[_0xd8fb('0x21')](respondWithResult(_0x39beaa,null))['catch'](handleError(_0x39beaa,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 712fc89..6a79ab1 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 _0x1d29=['../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x4b9a46,_0x4812bb){var _0x3a7334=function(_0x3a3336){while(--_0x3a3336){_0x4b9a46['push'](_0x4b9a46['shift']());}};_0x3a7334(++_0x4812bb);}(_0x1d29,0x1c1));var _0x91d2=function(_0x3c5f40,_0xb82ced){_0x3c5f40=_0x3c5f40-0x0;var _0x5b610e=_0x1d29[_0x3c5f40];return _0x5b610e;};'use strict';var _=require(_0x91d2('0x0'));var util=require(_0x91d2('0x1'));var logger=require(_0x91d2('0x2'))(_0x91d2('0x3'));var moment=require(_0x91d2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91d2('0x5'));var rimraf=require(_0x91d2('0x6'));var config=require(_0x91d2('0x7'));var attributes=require(_0x91d2('0x8'));module['exports']=function(_0x2a01ef,_0x25b374){return _0x2a01ef['define'](_0x91d2('0x9'),attributes,{'tableName':_0x91d2('0xa'),'paranoid':![],'indexes':[{'name':_0x91d2('0xb'),'fields':[_0x91d2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9dc=['report_mail_transfer','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0xc9dc,0xc1));var _0xcc9d=function(_0x2150b4,_0x4ab259){_0x2150b4=_0x2150b4-0x0;var _0x5a7bf9=_0xc9dc[_0x2150b4];return _0x5a7bf9;};'use strict';var _=require(_0xcc9d('0x0'));var util=require(_0xcc9d('0x1'));var logger=require(_0xcc9d('0x2'))('api');var moment=require(_0xcc9d('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc9d('0x4'));var fs=require('fs');var path=require(_0xcc9d('0x5'));var rimraf=require('rimraf');var config=require(_0xcc9d('0x6'));var attributes=require(_0xcc9d('0x7'));module[_0xcc9d('0x8')]=function(_0x2b7c1e,_0x3432da){return _0x2b7c1e[_0xcc9d('0x9')](_0xcc9d('0xa'),attributes,{'tableName':_0xcc9d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index bfcc337..a7a80a5 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 _0x7544=['rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7544,0x19c));var _0x4754=function(_0x325e4c,_0x470fda){_0x325e4c=_0x325e4c-0x0;var _0x3a8d08=_0x7544[_0x325e4c];return _0x3a8d08;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4754('0x0'));var rs=require(_0x4754('0x1'));var fs=require('fs');var Redis=require(_0x4754('0x2'));var db=require(_0x4754('0x3'))['db'];var utils=require(_0x4754('0x4'));var logger=require(_0x4754('0x5'))(_0x4754('0x6'));var config=require('../../config/environment');var jayson=require(_0x4754('0x7'));var client=jayson[_0x4754('0x8')][_0x4754('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed0be,_0x390c03,_0x267abd){return new BPromise(function(_0x88cf4d,_0x2a03ce){return client[_0x4754('0xa')](_0x2ed0be,_0x267abd)['then'](function(_0x38a9e6){logger[_0x4754('0xb')](_0x4754('0xc'),_0x390c03,'request\x20sent');logger[_0x4754('0xd')](_0x4754('0xe'),_0x390c03,_0x4754('0xf'),JSON['stringify'](_0x38a9e6));if(_0x38a9e6[_0x4754('0x10')]){if(_0x38a9e6[_0x4754('0x10')][_0x4754('0x11')]===0x1f4){logger[_0x4754('0x10')](_0x4754('0xc'),_0x390c03,_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);return _0x2a03ce(_0x38a9e6[_0x4754('0x10')]['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x390c03,_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);return _0x88cf4d(_0x38a9e6[_0x4754('0x10')][_0x4754('0x12')]);}else{logger[_0x4754('0xb')](_0x4754('0xc'),_0x390c03,'request\x20sent');_0x88cf4d(_0x38a9e6['result'][_0x4754('0x12')]);}})['catch'](function(_0x2e74af){logger[_0x4754('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x390c03,_0x2e74af);_0x2a03ce(_0x2e74af);});});} \ No newline at end of file +var _0xfd88=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x491a4e,_0x1db669){var _0x2f9821=function(_0x3452fe){while(--_0x3452fe){_0x491a4e['push'](_0x491a4e['shift']());}};_0x2f9821(++_0x1db669);}(_0xfd88,0x84));var _0x8fd8=function(_0x51f4fc,_0x1fe3ef){_0x51f4fc=_0x51f4fc-0x0;var _0x4d96fc=_0xfd88[_0x51f4fc];return _0x4d96fc;};'use strict';var _=require(_0x8fd8('0x0'));var util=require(_0x8fd8('0x1'));var moment=require(_0x8fd8('0x2'));var BPromise=require('bluebird');var rs=require(_0x8fd8('0x3'));var fs=require('fs');var Redis=require(_0x8fd8('0x4'));var db=require(_0x8fd8('0x5'))['db'];var utils=require(_0x8fd8('0x6'));var logger=require(_0x8fd8('0x7'))(_0x8fd8('0x8'));var config=require(_0x8fd8('0x9'));var jayson=require(_0x8fd8('0xa'));var client=jayson['client'][_0x8fd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f048a,_0x3a6feb,_0x1209b7){return new BPromise(function(_0x342885,_0x4be66c){return client[_0x8fd8('0xc')](_0x2f048a,_0x1209b7)['then'](function(_0x3270c3){logger[_0x8fd8('0xd')](_0x8fd8('0xe'),_0x3a6feb,_0x8fd8('0xf'));logger[_0x8fd8('0x10')](_0x8fd8('0x11'),_0x3a6feb,_0x8fd8('0xf'),JSON[_0x8fd8('0x12')](_0x3270c3));if(_0x3270c3['error']){if(_0x3270c3[_0x8fd8('0x13')][_0x8fd8('0x14')]===0x1f4){logger[_0x8fd8('0x13')](_0x8fd8('0xe'),_0x3a6feb,_0x3270c3[_0x8fd8('0x13')][_0x8fd8('0x15')]);return _0x4be66c(_0x3270c3[_0x8fd8('0x13')][_0x8fd8('0x15')]);}logger[_0x8fd8('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x3a6feb,_0x3270c3[_0x8fd8('0x13')][_0x8fd8('0x15')]);return _0x342885(_0x3270c3['error']['message']);}else{logger[_0x8fd8('0xd')](_0x8fd8('0xe'),_0x3a6feb,_0x8fd8('0xf'));_0x342885(_0x3270c3[_0x8fd8('0x16')][_0x8fd8('0x15')]);}})['catch'](function(_0x10cce5){logger[_0x8fd8('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x3a6feb,_0x10cce5);_0x4be66c(_0x10cce5);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7ae9f80..efd1cd4 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 _0x55f0=['isAuthenticated','/:id','show','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./memberReport.controller','get'];(function(_0x198b03,_0x3aa053){var _0x2f3f66=function(_0x333578){while(--_0x333578){_0x198b03['push'](_0x198b03['shift']());}};_0x2f3f66(++_0x3aa053);}(_0x55f0,0x1f3));var _0x055f=function(_0x4f219b,_0x841f7e){_0x4f219b=_0x4f219b-0x0;var _0x8a7718=_0x55f0[_0x4f219b];return _0x8a7718;};'use strict';var multer=require(_0x055f('0x0'));var util=require(_0x055f('0x1'));var path=require(_0x055f('0x2'));var timeout=require(_0x055f('0x3'));var express=require(_0x055f('0x4'));var router=express['Router']();var auth=require(_0x055f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x055f('0x6'));router[_0x055f('0x7')]('/',auth[_0x055f('0x8')](),controller['index']);router[_0x055f('0x7')]('/describe',auth[_0x055f('0x8')](),controller['describe']);router[_0x055f('0x7')](_0x055f('0x9'),auth['isAuthenticated'](),controller[_0x055f('0xa')]);router['post']('/',auth[_0x055f('0x8')](),controller['create']);router['put'](_0x055f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x055f('0xb')](_0x055f('0x9'),auth[_0x055f('0x8')](),controller['destroy']);module[_0x055f('0xc')]=router; \ No newline at end of file +var _0xc1fa=['/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x165ac1,_0x3dbdf8){var _0x244f6d=function(_0x551ecd){while(--_0x551ecd){_0x165ac1['push'](_0x165ac1['shift']());}};_0x244f6d(++_0x3dbdf8);}(_0xc1fa,0xaa));var _0xac1f=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xc1fa[_0x47b15f];return _0x55bf25;};'use strict';var multer=require(_0xac1f('0x0'));var util=require('util');var path=require(_0xac1f('0x1'));var timeout=require(_0xac1f('0x2'));var express=require(_0xac1f('0x3'));var router=express[_0xac1f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xac1f('0x5'));var config=require(_0xac1f('0x6'));var controller=require('./memberReport.controller');router[_0xac1f('0x7')]('/',auth[_0xac1f('0x8')](),controller[_0xac1f('0x9')]);router[_0xac1f('0x7')](_0xac1f('0xa'),auth['isAuthenticated'](),controller[_0xac1f('0xb')]);router[_0xac1f('0x7')](_0xac1f('0xc'),auth[_0xac1f('0x8')](),controller[_0xac1f('0xd')]);router[_0xac1f('0xe')]('/',auth[_0xac1f('0x8')](),controller[_0xac1f('0xf')]);router[_0xac1f('0x10')](_0xac1f('0xc'),auth[_0xac1f('0x8')](),controller[_0xac1f('0x11')]);router[_0xac1f('0x12')](_0xac1f('0xc'),auth[_0xac1f('0x8')](),controller['destroy']);module[_0xac1f('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 6612269..cc2b004 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 _0xd4e3=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd4e3,0x147));var _0x3d4e=function(_0x4488d7,_0x18322f){_0x4488d7=_0x4488d7-0x0;var _0x399924=_0xd4e3[_0x4488d7];return _0x399924;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3d4e('0x0'));module[_0x3d4e('0x1')]={'channel':{'type':Sequelize[_0x3d4e('0x2')]},'membername':{'type':Sequelize[_0x3d4e('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x3d4e('0x3'),'comment':_0x3d4e('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3d4e('0x5')],'set':function(_0x4d9cf7){var _0x2ebac4=moment(_0x4d9cf7);var _0x51d619=moment(this[_0x3d4e('0x6')](_0x3d4e('0x7')));var _0x552358=_0x2ebac4[_0x3d4e('0x8')](_0x51d619,_0x3d4e('0x9'));this[_0x3d4e('0xa')](_0x3d4e('0xb'),_0x4d9cf7);this[_0x3d4e('0xa')](_0x3d4e('0xc'),_0x552358||null);}},'data1':{'type':Sequelize[_0x3d4e('0x2')],'comment':_0x3d4e('0xd')},'data2':{'type':Sequelize[_0x3d4e('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x3d4e('0xe')},'data4':{'type':Sequelize[_0x3d4e('0x2')],'comment':_0x3d4e('0xf')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x3d4e('0x2')]},'internal':{'type':Sequelize[_0x3d4e('0x10')]},'uniqueid':{'type':Sequelize[_0x3d4e('0x2')]}}; \ No newline at end of file +var _0x331b=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x331b,0x1e3));var _0xb331=function(_0x28b1f7,_0x113a18){_0x28b1f7=_0x28b1f7-0x0;var _0x5bcba5=_0x331b[_0x28b1f7];return _0x5bcba5;};'use strict';var Sequelize=require(_0xb331('0x0'));var moment=require(_0xb331('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb331('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb331('0x2')],'defaultValue':_0xb331('0x3'),'comment':_0xb331('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb331('0x5')],'set':function(_0x45335f){var _0x493f4d=moment(_0x45335f);var _0x253a8c=moment(this[_0xb331('0x6')](_0xb331('0x7')));var _0xab28fd=_0x493f4d[_0xb331('0x8')](_0x253a8c,_0xb331('0x9'));this[_0xb331('0xa')](_0xb331('0xb'),_0x45335f);this[_0xb331('0xa')]('duration',_0xab28fd||null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xb331('0xc')},'data2':{'type':Sequelize[_0xb331('0x2')],'comment':_0xb331('0xd')},'data3':{'type':Sequelize[_0xb331('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xb331('0x2')],'comment':_0xb331('0xe')},'data5':{'type':Sequelize[_0xb331('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb331('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 57d5495..24e5a3a 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 _0xbc1d=['save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','count','offset','limit','status','set','Content-Range','apply','reject'];(function(_0x1722f4,_0x3ce750){var _0x3a64c2=function(_0x429533){while(--_0x429533){_0x1722f4['push'](_0x1722f4['shift']());}};_0x3a64c2(++_0x3ce750);}(_0xbc1d,0xb8));var _0xdbc1=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xbc1d[_0x1de43c];return _0x296d3e;};'use strict';var pdf=require(_0xdbc1('0x0'));var emlformat=require(_0xdbc1('0x1'));var rimraf=require(_0xdbc1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbc1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbc1('0x4'));var Mustache=require(_0xdbc1('0x5'));var util=require(_0xdbc1('0x6'));var path=require(_0xdbc1('0x7'));var sox=require(_0xdbc1('0x8'));var csv=require(_0xdbc1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbc1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbc1('0xb'));var deskjs=require(_0xdbc1('0xc'));var toCsv=require(_0xdbc1('0x9'));var querystring=require('querystring');var Papa=require(_0xdbc1('0xd'));var Redis=require(_0xdbc1('0xe'));var authService=require(_0xdbc1('0xf'));var qs=require(_0xdbc1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbc1('0x11'));var logger=require(_0xdbc1('0x12'))(_0xdbc1('0x13'));var utils=require(_0xdbc1('0x14'));var config=require(_0xdbc1('0x15'));var db=require(_0xdbc1('0x16'))['db'];function respondWithStatusCode(_0x8e88c2,_0x4dfe21){_0x4dfe21=_0x4dfe21||0xcc;return function(_0x440297){if(_0x440297){return _0x8e88c2[_0xdbc1('0x17')](_0x4dfe21);}return _0x8e88c2['status'](_0x4dfe21)['end']();};}function respondWithResult(_0x534a75,_0x202976){_0x202976=_0x202976||0xc8;return function(_0x14885f){if(_0x14885f){return _0x534a75['status'](_0x202976)['json'](_0x14885f);}};}function respondWithFilteredResult(_0x47abd9,_0x3d416c){return function(_0x281c70){if(_0x281c70){var _0x4f42c5=_0x281c70[_0xdbc1('0x18')],_0x22ed37=_0x3d416c[_0xdbc1('0x19')],_0x162a33=_0x3d416c['offset']+_0x3d416c[_0xdbc1('0x1a')],_0x262f98;if(_0x162a33>=_0x4f42c5){_0x162a33=_0x4f42c5;_0x262f98=0xc8;}else{_0x262f98=0xce;}_0x47abd9[_0xdbc1('0x1b')](_0x262f98);return _0x47abd9[_0xdbc1('0x1c')](_0xdbc1('0x1d'),_0x22ed37+'-'+_0x162a33+'/'+_0x4f42c5)['json'](_0x281c70);}return null;};}function patchUpdates(_0x20c3e3){return function(_0x156feb){try{jsonpatch[_0xdbc1('0x1e')](_0x156feb,_0x20c3e3,!![]);}catch(_0x154e07){return BPromise[_0xdbc1('0x1f')](_0x154e07);}return _0x156feb[_0xdbc1('0x20')]();};}function saveUpdates(_0x51a50b,_0x4e2dcb){return function(_0x1ca1b1){if(_0x1ca1b1){return _0x1ca1b1[_0xdbc1('0x21')](_0x51a50b)[_0xdbc1('0x22')](function(_0x58e4ff){return _0x58e4ff;});}return null;};}function removeEntity(_0xfa02c,_0x54e362){return function(_0x421433){if(_0x421433){return _0x421433[_0xdbc1('0x23')]()[_0xdbc1('0x22')](function(){_0xfa02c[_0xdbc1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc69f,_0x163c7f){return function(_0x13bae7){if(!_0x13bae7){_0x5bc69f[_0xdbc1('0x17')](0x194);}return _0x13bae7;};}function handleError(_0x3f973d,_0x21d5f7){_0x21d5f7=_0x21d5f7||0x1f4;return function(_0x503940){logger[_0xdbc1('0x24')](_0x503940[_0xdbc1('0x25')]);if(_0x503940[_0xdbc1('0x26')]){delete _0x503940[_0xdbc1('0x26')];}_0x3f973d['status'](_0x21d5f7)[_0xdbc1('0x27')](_0x503940);};}exports[_0xdbc1('0x28')]=function(_0x3b96c0,_0x1f0937){var _0x23cfbc={},_0x353e3a={},_0x56b7ec={'count':0x0,'rows':[]};var _0x2297db=_[_0xdbc1('0x29')](db[_0xdbc1('0x2a')][_0xdbc1('0x2b')],function(_0x398d0e){return{'name':_0x398d0e[_0xdbc1('0x2c')],'type':_0x398d0e[_0xdbc1('0x2d')]['key']};});_0x353e3a[_0xdbc1('0x2e')]=_[_0xdbc1('0x29')](_0x2297db,'name');_0x353e3a[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x3b96c0[_0xdbc1('0x2f')]);_0x353e3a[_0xdbc1('0x31')]=_[_0xdbc1('0x32')](_0x353e3a[_0xdbc1('0x2e')],_0x353e3a[_0xdbc1('0x2f')]);_0x23cfbc[_0xdbc1('0x33')]=_[_0xdbc1('0x32')](_0x353e3a[_0xdbc1('0x2e')],qs['fields'](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x34')]));_0x23cfbc[_0xdbc1('0x33')]=_0x23cfbc[_0xdbc1('0x33')]['length']?_0x23cfbc['attributes']:_0x353e3a[_0xdbc1('0x2e')];if(!_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x35')](_0xdbc1('0x36'))){_0x23cfbc[_0xdbc1('0x1a')]=qs['limit'](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x1a')]);_0x23cfbc[_0xdbc1('0x19')]=qs['offset'](_0x3b96c0[_0xdbc1('0x2f')]['offset']);}_0x23cfbc['order']=qs[_0xdbc1('0x37')](_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x37')]);_0x23cfbc[_0xdbc1('0x38')]=qs['filters'](_[_0xdbc1('0x39')](_0x3b96c0['query'],_0x353e3a[_0xdbc1('0x31')]),_0x2297db);if(_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3a')]){_0x23cfbc[_0xdbc1('0x38')]=_[_0xdbc1('0x3b')](_0x23cfbc[_0xdbc1('0x38')],{'$or':_[_0xdbc1('0x29')](_0x2297db,function(_0x20e33a){if(_0x20e33a[_0xdbc1('0x2d')]!=='VIRTUAL'){var _0x16f488={};_0x16f488[_0x20e33a['name']]={'$like':'%'+_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3a')]+'%'};return _0x16f488;}})});}_0x23cfbc=_[_0xdbc1('0x3b')]({},_0x23cfbc,_0x3b96c0[_0xdbc1('0x3c')]);var _0x196da0={'where':_0x23cfbc['where']};return db[_0xdbc1('0x2a')]['count'](_0x196da0)[_0xdbc1('0x22')](function(_0x4b923d){_0x56b7ec['count']=_0x4b923d;if(_0x3b96c0[_0xdbc1('0x2f')][_0xdbc1('0x3d')]){_0x23cfbc['include']=[{'all':!![]}];}return db[_0xdbc1('0x2a')][_0xdbc1('0x3e')](_0x23cfbc);})[_0xdbc1('0x22')](function(_0x1ac91a){_0x56b7ec[_0xdbc1('0x3f')]=_0x1ac91a;return _0x56b7ec;})[_0xdbc1('0x22')](respondWithFilteredResult(_0x1f0937,_0x23cfbc))['catch'](handleError(_0x1f0937,null));};exports[_0xdbc1('0x40')]=function(_0x4440c7,_0x2748a9){var _0x369282={'raw':!![],'where':{'id':_0x4440c7[_0xdbc1('0x41')]['id']}},_0x35f932={};_0x35f932['model']=_[_0xdbc1('0x30')](db[_0xdbc1('0x2a')]['rawAttributes']);_0x35f932[_0xdbc1('0x2f')]=_[_0xdbc1('0x30')](_0x4440c7[_0xdbc1('0x2f')]);_0x35f932['filters']=_[_0xdbc1('0x32')](_0x35f932[_0xdbc1('0x2e')],_0x35f932[_0xdbc1('0x2f')]);_0x369282[_0xdbc1('0x33')]=_['intersection'](_0x35f932[_0xdbc1('0x2e')],qs[_0xdbc1('0x34')](_0x4440c7[_0xdbc1('0x2f')]['fields']));_0x369282['attributes']=_0x369282[_0xdbc1('0x33')][_0xdbc1('0x42')]?_0x369282[_0xdbc1('0x33')]:_0x35f932[_0xdbc1('0x2e')];if(_0x4440c7[_0xdbc1('0x2f')][_0xdbc1('0x3d')]){_0x369282['include']=[{'all':!![]}];}_0x369282=_[_0xdbc1('0x3b')]({},_0x369282,_0x4440c7[_0xdbc1('0x3c')]);return db[_0xdbc1('0x2a')][_0xdbc1('0x43')](_0x369282)[_0xdbc1('0x22')](handleEntityNotFound(_0x2748a9,null))['then'](respondWithResult(_0x2748a9,null))[_0xdbc1('0x44')](handleError(_0x2748a9,null));};exports['create']=function(_0x1637ad,_0x3eccdd){return db[_0xdbc1('0x2a')][_0xdbc1('0x45')](_0x1637ad[_0xdbc1('0x46')],{})[_0xdbc1('0x22')](respondWithResult(_0x3eccdd,0xc9))[_0xdbc1('0x44')](handleError(_0x3eccdd,null));};exports['update']=function(_0x30e348,_0x94adfa){if(_0x30e348[_0xdbc1('0x46')]['id']){delete _0x30e348[_0xdbc1('0x46')]['id'];}return db['MemberReport'][_0xdbc1('0x43')]({'where':{'id':_0x30e348[_0xdbc1('0x41')]['id']}})[_0xdbc1('0x22')](handleEntityNotFound(_0x94adfa,null))['then'](saveUpdates(_0x30e348[_0xdbc1('0x46')],null))[_0xdbc1('0x22')](respondWithResult(_0x94adfa,null))[_0xdbc1('0x44')](handleError(_0x94adfa,null));};exports[_0xdbc1('0x23')]=function(_0x470b60,_0x39e94d){return db[_0xdbc1('0x2a')][_0xdbc1('0x43')]({'where':{'id':_0x470b60[_0xdbc1('0x41')]['id']}})[_0xdbc1('0x22')](handleEntityNotFound(_0x39e94d,null))[_0xdbc1('0x22')](removeEntity(_0x39e94d,null))[_0xdbc1('0x44')](handleError(_0x39e94d,null));};exports[_0xdbc1('0x47')]=function(_0x524d41,_0x541e05){return db[_0xdbc1('0x2a')]['describe']()[_0xdbc1('0x22')](respondWithResult(_0x541e05,null))[_0xdbc1('0x44')](handleError(_0x541e05,null));}; \ No newline at end of file +var _0xcb78=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','catch','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x521bed,_0x110c24){var _0x32eb9e=function(_0x4364a3){while(--_0x4364a3){_0x521bed['push'](_0x521bed['shift']());}};_0x32eb9e(++_0x110c24);}(_0xcb78,0x145));var _0x8cb7=function(_0x34bd85,_0x25419b){_0x34bd85=_0x34bd85-0x0;var _0x4911fa=_0xcb78[_0x34bd85];return _0x4911fa;};'use strict';var pdf=require(_0x8cb7('0x0'));var emlformat=require(_0x8cb7('0x1'));var rimraf=require(_0x8cb7('0x2'));var zipdir=require(_0x8cb7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cb7('0x4'));var moment=require(_0x8cb7('0x5'));var BPromise=require(_0x8cb7('0x6'));var Mustache=require('mustache');var util=require(_0x8cb7('0x7'));var path=require(_0x8cb7('0x8'));var sox=require(_0x8cb7('0x9'));var csv=require(_0x8cb7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8cb7('0xb'));var squel=require('squel');var crypto=require(_0x8cb7('0xc'));var jsforce=require(_0x8cb7('0xd'));var deskjs=require(_0x8cb7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8cb7('0xf'));var Redis=require(_0x8cb7('0x10'));var authService=require(_0x8cb7('0x11'));var qs=require(_0x8cb7('0x12'));var as=require(_0x8cb7('0x13'));var hardwareService=require(_0x8cb7('0x14'));var logger=require(_0x8cb7('0x15'))(_0x8cb7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b12,_0x247379){_0x247379=_0x247379||0xcc;return function(_0x1daae8){if(_0x1daae8){return _0x388b12[_0x8cb7('0x17')](_0x247379);}return _0x388b12['status'](_0x247379)[_0x8cb7('0x18')]();};}function respondWithResult(_0x3fd00c,_0x4e91a0){_0x4e91a0=_0x4e91a0||0xc8;return function(_0x17db41){if(_0x17db41){return _0x3fd00c[_0x8cb7('0x19')](_0x4e91a0)[_0x8cb7('0x1a')](_0x17db41);}};}function respondWithFilteredResult(_0x20873c,_0x176651){return function(_0x398e7b){if(_0x398e7b){var _0x2a593c=_0x398e7b[_0x8cb7('0x1b')],_0x58d0f8=_0x176651[_0x8cb7('0x1c')],_0x2bc7d3=_0x176651[_0x8cb7('0x1c')]+_0x176651['limit'],_0x523728;if(_0x2bc7d3>=_0x2a593c){_0x2bc7d3=_0x2a593c;_0x523728=0xc8;}else{_0x523728=0xce;}_0x20873c[_0x8cb7('0x19')](_0x523728);return _0x20873c[_0x8cb7('0x1d')](_0x8cb7('0x1e'),_0x58d0f8+'-'+_0x2bc7d3+'/'+_0x2a593c)['json'](_0x398e7b);}return null;};}function patchUpdates(_0x245f2b){return function(_0x4f6ab8){try{jsonpatch[_0x8cb7('0x1f')](_0x4f6ab8,_0x245f2b,!![]);}catch(_0x396e67){return BPromise[_0x8cb7('0x20')](_0x396e67);}return _0x4f6ab8[_0x8cb7('0x21')]();};}function saveUpdates(_0xb6f4e1,_0x29d308){return function(_0x4fbd80){if(_0x4fbd80){return _0x4fbd80[_0x8cb7('0x22')](_0xb6f4e1)[_0x8cb7('0x23')](function(_0x5d11ff){return _0x5d11ff;});}return null;};}function removeEntity(_0x282916,_0x87fd80){return function(_0x60de56){if(_0x60de56){return _0x60de56[_0x8cb7('0x24')]()[_0x8cb7('0x23')](function(){_0x282916['status'](0xcc)[_0x8cb7('0x18')]();});}};}function handleEntityNotFound(_0x2acc0b,_0x2d9376){return function(_0x4eb02c){if(!_0x4eb02c){_0x2acc0b[_0x8cb7('0x17')](0x194);}return _0x4eb02c;};}function handleError(_0x221510,_0x36e775){_0x36e775=_0x36e775||0x1f4;return function(_0x29a257){logger[_0x8cb7('0x25')](_0x29a257[_0x8cb7('0x26')]);if(_0x29a257[_0x8cb7('0x27')]){delete _0x29a257['name'];}_0x221510['status'](_0x36e775)[_0x8cb7('0x28')](_0x29a257);};}exports[_0x8cb7('0x29')]=function(_0x21ffe6,_0x268352){var _0x5de2eb={},_0x300d6b={},_0xba8e7={'count':0x0,'rows':[]};var _0xc00004=_[_0x8cb7('0x2a')](db[_0x8cb7('0x2b')][_0x8cb7('0x2c')],function(_0x5b6a9d){return{'name':_0x5b6a9d[_0x8cb7('0x2d')],'type':_0x5b6a9d['type'][_0x8cb7('0x2e')]};});_0x300d6b[_0x8cb7('0x2f')]=_[_0x8cb7('0x2a')](_0xc00004,'name');_0x300d6b[_0x8cb7('0x30')]=_[_0x8cb7('0x31')](_0x21ffe6['query']);_0x300d6b[_0x8cb7('0x32')]=_[_0x8cb7('0x33')](_0x300d6b[_0x8cb7('0x2f')],_0x300d6b[_0x8cb7('0x30')]);_0x5de2eb[_0x8cb7('0x34')]=_['intersection'](_0x300d6b['model'],qs[_0x8cb7('0x35')](_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x35')]));_0x5de2eb[_0x8cb7('0x34')]=_0x5de2eb[_0x8cb7('0x34')]['length']?_0x5de2eb[_0x8cb7('0x34')]:_0x300d6b[_0x8cb7('0x2f')];if(!_0x21ffe6['query'][_0x8cb7('0x36')](_0x8cb7('0x37'))){_0x5de2eb[_0x8cb7('0x38')]=qs[_0x8cb7('0x38')](_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x38')]);_0x5de2eb[_0x8cb7('0x1c')]=qs[_0x8cb7('0x1c')](_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x1c')]);}_0x5de2eb[_0x8cb7('0x39')]=qs['sort'](_0x21ffe6['query'][_0x8cb7('0x3a')]);_0x5de2eb['where']=qs[_0x8cb7('0x32')](_[_0x8cb7('0x3b')](_0x21ffe6[_0x8cb7('0x30')],_0x300d6b[_0x8cb7('0x32')]),_0xc00004);if(_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x3c')]){_0x5de2eb[_0x8cb7('0x3d')]=_[_0x8cb7('0x3e')](_0x5de2eb['where'],{'$or':_[_0x8cb7('0x2a')](_0xc00004,function(_0xb984c5){if(_0xb984c5[_0x8cb7('0x3f')]!=='VIRTUAL'){var _0x5e9b0b={};_0x5e9b0b[_0xb984c5[_0x8cb7('0x27')]]={'$like':'%'+_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x3c')]+'%'};return _0x5e9b0b;}})});}_0x5de2eb=_['merge']({},_0x5de2eb,_0x21ffe6[_0x8cb7('0x40')]);var _0x55a60b={'where':_0x5de2eb[_0x8cb7('0x3d')]};return db[_0x8cb7('0x2b')]['count'](_0x55a60b)[_0x8cb7('0x23')](function(_0x5b67ef){_0xba8e7[_0x8cb7('0x1b')]=_0x5b67ef;if(_0x21ffe6[_0x8cb7('0x30')][_0x8cb7('0x41')]){_0x5de2eb[_0x8cb7('0x42')]=[{'all':!![]}];}return db[_0x8cb7('0x2b')][_0x8cb7('0x43')](_0x5de2eb);})[_0x8cb7('0x23')](function(_0x463652){_0xba8e7['rows']=_0x463652;return _0xba8e7;})[_0x8cb7('0x23')](respondWithFilteredResult(_0x268352,_0x5de2eb))[_0x8cb7('0x44')](handleError(_0x268352,null));};exports['show']=function(_0x4f6b8f,_0x33f7fc){var _0x15078e={'raw':!![],'where':{'id':_0x4f6b8f[_0x8cb7('0x45')]['id']}},_0x56f651={};_0x56f651[_0x8cb7('0x2f')]=_['keys'](db[_0x8cb7('0x2b')][_0x8cb7('0x2c')]);_0x56f651[_0x8cb7('0x30')]=_[_0x8cb7('0x31')](_0x4f6b8f['query']);_0x56f651[_0x8cb7('0x32')]=_['intersection'](_0x56f651[_0x8cb7('0x2f')],_0x56f651[_0x8cb7('0x30')]);_0x15078e['attributes']=_[_0x8cb7('0x33')](_0x56f651[_0x8cb7('0x2f')],qs[_0x8cb7('0x35')](_0x4f6b8f[_0x8cb7('0x30')]['fields']));_0x15078e[_0x8cb7('0x34')]=_0x15078e[_0x8cb7('0x34')][_0x8cb7('0x46')]?_0x15078e[_0x8cb7('0x34')]:_0x56f651['model'];if(_0x4f6b8f[_0x8cb7('0x30')][_0x8cb7('0x41')]){_0x15078e[_0x8cb7('0x42')]=[{'all':!![]}];}_0x15078e=_[_0x8cb7('0x3e')]({},_0x15078e,_0x4f6b8f[_0x8cb7('0x40')]);return db[_0x8cb7('0x2b')]['find'](_0x15078e)['then'](handleEntityNotFound(_0x33f7fc,null))['then'](respondWithResult(_0x33f7fc,null))[_0x8cb7('0x44')](handleError(_0x33f7fc,null));};exports[_0x8cb7('0x47')]=function(_0x3bb213,_0x6243df){return db[_0x8cb7('0x2b')][_0x8cb7('0x47')](_0x3bb213['body'],{})[_0x8cb7('0x23')](respondWithResult(_0x6243df,0xc9))[_0x8cb7('0x44')](handleError(_0x6243df,null));};exports[_0x8cb7('0x22')]=function(_0x48a8e4,_0x46ad92){if(_0x48a8e4[_0x8cb7('0x48')]['id']){delete _0x48a8e4[_0x8cb7('0x48')]['id'];}return db[_0x8cb7('0x2b')][_0x8cb7('0x49')]({'where':{'id':_0x48a8e4[_0x8cb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x46ad92,null))[_0x8cb7('0x23')](saveUpdates(_0x48a8e4['body'],null))[_0x8cb7('0x23')](respondWithResult(_0x46ad92,null))[_0x8cb7('0x44')](handleError(_0x46ad92,null));};exports[_0x8cb7('0x24')]=function(_0x259008,_0x3b507d){return db['MemberReport'][_0x8cb7('0x49')]({'where':{'id':_0x259008[_0x8cb7('0x45')]['id']}})[_0x8cb7('0x23')](handleEntityNotFound(_0x3b507d,null))[_0x8cb7('0x23')](removeEntity(_0x3b507d,null))[_0x8cb7('0x44')](handleError(_0x3b507d,null));};exports['describe']=function(_0x737b50,_0x2e2bed){return db['MemberReport'][_0x8cb7('0x4a')]()[_0x8cb7('0x23')](respondWithResult(_0x2e2bed,null))[_0x8cb7('0x44')](handleError(_0x2e2bed,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c84ee56..f402f2d 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 _0xed1f=['MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x4e2801,_0x4ba3e2){var _0x513ab5=function(_0x28105d){while(--_0x28105d){_0x4e2801['push'](_0x4e2801['shift']());}};_0x513ab5(++_0x4ba3e2);}(_0xed1f,0x6a));var _0xfed1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xed1f[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[{'name':_0xfed1('0xf'),'fields':['membername',_0xfed1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','../../config/logger','api','moment'];(function(_0x31a6b1,_0x7c3be1){var _0x8c77f5=function(_0x35b0d7){while(--_0x35b0d7){_0x31a6b1['push'](_0x31a6b1['shift']());}};_0x8c77f5(++_0x7c3be1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x47fd45,_0x40dd67){_0x47fd45=_0x47fd45-0x0;var _0x363313=_0x7fbe[_0x47fd45];return _0x363313;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xd'),_0xe7fb('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 1f6e21e..6d53671 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 _0x8092=['jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','options','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x8092,0x1a9));var _0x2809=function(_0x368aed,_0x302755){_0x368aed=_0x368aed-0x0;var _0x269976=_0x8092[_0x368aed];return _0x269976;};'use strict';var _=require(_0x2809('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2809('0x1'));var rs=require(_0x2809('0x2'));var fs=require('fs');var Redis=require(_0x2809('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2809('0x4'));var logger=require(_0x2809('0x5'))('rpc');var config=require(_0x2809('0x6'));var jayson=require(_0x2809('0x7'));var client=jayson['client'][_0x2809('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c1541,_0x34f503,_0x23efdb){return new BPromise(function(_0x1fef0f,_0x529754){return client[_0x2809('0x9')](_0x4c1541,_0x23efdb)['then'](function(_0x1c7bff){logger[_0x2809('0xa')](_0x2809('0xb'),_0x34f503,_0x2809('0xc'));logger[_0x2809('0xd')](_0x2809('0xe'),_0x34f503,_0x2809('0xc'),JSON[_0x2809('0xf')](_0x1c7bff));if(_0x1c7bff['error']){if(_0x1c7bff[_0x2809('0x10')][_0x2809('0x11')]===0x1f4){logger['error'](_0x2809('0xb'),_0x34f503,_0x1c7bff[_0x2809('0x10')]['message']);return _0x529754(_0x1c7bff['error'][_0x2809('0x12')]);}logger[_0x2809('0x10')](_0x2809('0xb'),_0x34f503,_0x1c7bff[_0x2809('0x10')][_0x2809('0x12')]);return _0x1fef0f(_0x1c7bff[_0x2809('0x10')]['message']);}else{logger[_0x2809('0xa')](_0x2809('0xb'),_0x34f503,_0x2809('0xc'));_0x1fef0f(_0x1c7bff[_0x2809('0x13')]['message']);}})[_0x2809('0x14')](function(_0x16dcdc){logger[_0x2809('0x10')](_0x2809('0xb'),_0x34f503,_0x16dcdc);_0x529754(_0x16dcdc);});});}exports[_0x2809('0x15')]=function(_0x216d98){var _0x315d34=this;return new Promise(function(_0x5eed20,_0x4d0d46){return db[_0x2809('0x16')]['findAll']({'raw':_0x216d98[_0x2809('0x17')]?_0x216d98[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x18')]||null:null,'attributes':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x19')]||null:null,'limit':_0x216d98['options']?_0x216d98[_0x2809('0x17')][_0x2809('0x1a')]||null:null,'include':_0x216d98[_0x2809('0x17')]?_0x216d98[_0x2809('0x17')]['include']?_[_0x2809('0x1b')](_0x216d98[_0x2809('0x17')][_0x2809('0x1c')],function(_0x25f452){return{'model':db[_0x25f452[_0x2809('0x1d')]],'as':_0x25f452['as'],'attributes':_0x25f452[_0x2809('0x19')],'include':_0x25f452['include']?_['map'](_0x25f452[_0x2809('0x1c')],function(_0x5254b0){return{'model':db[_0x5254b0[_0x2809('0x1d')]],'as':_0x5254b0['as'],'attributes':_0x5254b0[_0x2809('0x19')],'include':_0x5254b0['include']?_[_0x2809('0x1b')](_0x5254b0['include'],function(_0x488da0){return{'model':db[_0x488da0['model']],'as':_0x488da0['as'],'attributes':_0x488da0['attributes']};}):[]};}):[]};}):[]:[]})[_0x2809('0x1e')](function(_0x1a895b){logger['info'](_0x2809('0x15'),_0x216d98);logger[_0x2809('0xd')](_0x2809('0x15'),_0x216d98,JSON['stringify'](_0x1a895b));_0x5eed20(_0x1a895b);})[_0x2809('0x14')](function(_0x55b6c6){logger[_0x2809('0x10')]('GetMemberReport',_0x55b6c6[_0x2809('0x12')],_0x216d98);_0x4d0d46(_0x315d34[_0x2809('0x10')](0x1f4,_0x55b6c6[_0x2809('0x12')]));});});};exports[_0x2809('0x1f')]=function(_0x5c0f57){var _0x691a5c=this;return new Promise(function(_0x2ffe49,_0x4567d5){return db['MemberReport'][_0x2809('0x20')](_0x5c0f57[_0x2809('0x21')],{'raw':_0x5c0f57[_0x2809('0x17')]?_0x5c0f57[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2809('0x1e')](function(_0xdf2637){logger[_0x2809('0xa')](_0x2809('0x1f'),_0x5c0f57);logger[_0x2809('0xd')](_0x2809('0x1f'),_0x5c0f57,JSON[_0x2809('0xf')](_0xdf2637));_0x2ffe49(_0xdf2637);})[_0x2809('0x14')](function(_0x4948e9){logger['error']('CreateMemberReport',_0x4948e9[_0x2809('0x12')],_0x5c0f57);_0x4567d5(_0x691a5c['error'](0x1f4,_0x4948e9[_0x2809('0x12')]));});});};exports[_0x2809('0x22')]=function(_0xed3c4e){var _0x2ce6b7=this;return new Promise(function(_0x21d95d,_0x138a0e){return db[_0x2809('0x16')][_0x2809('0x23')](_0xed3c4e[_0x2809('0x21')],{'raw':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xed3c4e['options']?_0xed3c4e[_0x2809('0x17')]['where']||null:null,'attributes':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')][_0x2809('0x19')]||null:null,'limit':_0xed3c4e[_0x2809('0x17')]?_0xed3c4e[_0x2809('0x17')][_0x2809('0x1a')]||null:null})[_0x2809('0x1e')](function(_0x352363){logger[_0x2809('0xa')](_0x2809('0x22'),_0xed3c4e);logger['debug'](_0x2809('0x22'),_0xed3c4e,JSON['stringify'](_0x352363));_0x21d95d(_0x352363);})[_0x2809('0x14')](function(_0x3123af){logger['error']('UpdateMemberReport',_0x3123af[_0x2809('0x12')],_0xed3c4e);_0x138a0e(_0x2ce6b7[_0x2809('0x10')](0x1f4,_0x3123af[_0x2809('0x12')]));});});}; \ No newline at end of file +var _0xbd49=['catch','GetMemberReport','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','error','code','message','MemberReport,\x20%s,\x20%s','result'];(function(_0x2b9089,_0x45e2c3){var _0x268cc8=function(_0x2c8f35){while(--_0x2c8f35){_0x2b9089['push'](_0x2b9089['shift']());}};_0x268cc8(++_0x45e2c3);}(_0xbd49,0xef));var _0x9bd4=function(_0x53df0c,_0x35e871){_0x53df0c=_0x53df0c-0x0;var _0x43d249=_0xbd49[_0x53df0c];return _0x43d249;};'use strict';var _=require(_0x9bd4('0x0'));var util=require(_0x9bd4('0x1'));var moment=require(_0x9bd4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bd4('0x3'));var fs=require('fs');var Redis=require(_0x9bd4('0x4'));var db=require(_0x9bd4('0x5'))['db'];var utils=require(_0x9bd4('0x6'));var logger=require(_0x9bd4('0x7'))(_0x9bd4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bd4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x85a7bc,_0x490455,_0x3b855c){return new BPromise(function(_0x26ff30,_0x3a06f5){return client[_0x9bd4('0xa')](_0x85a7bc,_0x3b855c)[_0x9bd4('0xb')](function(_0x325256){logger[_0x9bd4('0xc')]('MemberReport,\x20%s,\x20%s',_0x490455,_0x9bd4('0xd'));logger[_0x9bd4('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x490455,_0x9bd4('0xd'),JSON['stringify'](_0x325256));if(_0x325256['error']){if(_0x325256[_0x9bd4('0xf')][_0x9bd4('0x10')]===0x1f4){logger[_0x9bd4('0xf')]('MemberReport,\x20%s,\x20%s',_0x490455,_0x325256[_0x9bd4('0xf')][_0x9bd4('0x11')]);return _0x3a06f5(_0x325256[_0x9bd4('0xf')][_0x9bd4('0x11')]);}logger[_0x9bd4('0xf')]('MemberReport,\x20%s,\x20%s',_0x490455,_0x325256['error'][_0x9bd4('0x11')]);return _0x26ff30(_0x325256[_0x9bd4('0xf')][_0x9bd4('0x11')]);}else{logger[_0x9bd4('0xc')](_0x9bd4('0x12'),_0x490455,_0x9bd4('0xd'));_0x26ff30(_0x325256[_0x9bd4('0x13')]['message']);}})[_0x9bd4('0x14')](function(_0x180969){logger[_0x9bd4('0xf')](_0x9bd4('0x12'),_0x490455,_0x180969);_0x3a06f5(_0x180969);});});}exports[_0x9bd4('0x15')]=function(_0x324ce7){var _0x377821=this;return new Promise(function(_0x4f97bc,_0x306013){return db['MemberReport']['findAll']({'raw':_0x324ce7['options']?_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x17')]===undefined?!![]:![]:!![],'where':_0x324ce7[_0x9bd4('0x16')]?_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x18')]||null:null,'attributes':_0x324ce7['options']?_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x19')]||null:null,'limit':_0x324ce7['options']?_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x1a')]||null:null,'include':_0x324ce7[_0x9bd4('0x16')]?_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x1b')]?_[_0x9bd4('0x1c')](_0x324ce7[_0x9bd4('0x16')][_0x9bd4('0x1b')],function(_0x315cf5){return{'model':db[_0x315cf5[_0x9bd4('0x1d')]],'as':_0x315cf5['as'],'attributes':_0x315cf5[_0x9bd4('0x19')],'include':_0x315cf5[_0x9bd4('0x1b')]?_[_0x9bd4('0x1c')](_0x315cf5[_0x9bd4('0x1b')],function(_0x24c54c){return{'model':db[_0x24c54c[_0x9bd4('0x1d')]],'as':_0x24c54c['as'],'attributes':_0x24c54c['attributes'],'include':_0x24c54c[_0x9bd4('0x1b')]?_['map'](_0x24c54c[_0x9bd4('0x1b')],function(_0x1c4850){return{'model':db[_0x1c4850[_0x9bd4('0x1d')]],'as':_0x1c4850['as'],'attributes':_0x1c4850[_0x9bd4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xba44b1){logger[_0x9bd4('0xc')](_0x9bd4('0x15'),_0x324ce7);logger[_0x9bd4('0xe')]('GetMemberReport',_0x324ce7,JSON[_0x9bd4('0x1e')](_0xba44b1));_0x4f97bc(_0xba44b1);})['catch'](function(_0x34fcae){logger[_0x9bd4('0xf')]('GetMemberReport',_0x34fcae[_0x9bd4('0x11')],_0x324ce7);_0x306013(_0x377821['error'](0x1f4,_0x34fcae['message']));});});};exports[_0x9bd4('0x1f')]=function(_0x4c89dc){var _0x389dd5=this;return new Promise(function(_0x3d51ee,_0x27fc78){return db[_0x9bd4('0x20')][_0x9bd4('0x21')](_0x4c89dc[_0x9bd4('0x22')],{'raw':_0x4c89dc[_0x9bd4('0x16')]?_0x4c89dc['options'][_0x9bd4('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5b711b){logger[_0x9bd4('0xc')](_0x9bd4('0x1f'),_0x4c89dc);logger[_0x9bd4('0xe')](_0x9bd4('0x1f'),_0x4c89dc,JSON[_0x9bd4('0x1e')](_0x5b711b));_0x3d51ee(_0x5b711b);})[_0x9bd4('0x14')](function(_0x2984cf){logger[_0x9bd4('0xf')](_0x9bd4('0x1f'),_0x2984cf[_0x9bd4('0x11')],_0x4c89dc);_0x27fc78(_0x389dd5[_0x9bd4('0xf')](0x1f4,_0x2984cf['message']));});});};exports[_0x9bd4('0x23')]=function(_0x5947a5){var _0xbb9bf=this;return new Promise(function(_0x16a2f3,_0xf21352){return db[_0x9bd4('0x20')][_0x9bd4('0x24')](_0x5947a5[_0x9bd4('0x22')],{'raw':_0x5947a5['options']?_0x5947a5[_0x9bd4('0x16')][_0x9bd4('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5947a5['options']?_0x5947a5[_0x9bd4('0x16')][_0x9bd4('0x18')]||null:null,'attributes':_0x5947a5['options']?_0x5947a5['options']['attributes']||null:null,'limit':_0x5947a5['options']?_0x5947a5[_0x9bd4('0x16')][_0x9bd4('0x1a')]||null:null})['then'](function(_0x11085e){logger[_0x9bd4('0xc')](_0x9bd4('0x23'),_0x5947a5);logger['debug'](_0x9bd4('0x23'),_0x5947a5,JSON['stringify'](_0x11085e));_0x16a2f3(_0x11085e);})[_0x9bd4('0x14')](function(_0x2c6390){logger[_0x9bd4('0xf')](_0x9bd4('0x23'),_0x2c6390[_0x9bd4('0x11')],_0x5947a5);_0xf21352(_0xbb9bf[_0x9bd4('0xf')](0x1f4,_0x2c6390[_0x9bd4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 755954e..a4af1f7 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 _0xc788=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','Router'];(function(_0x536b33,_0xab0be1){var _0x53018c=function(_0x3bcc81){while(--_0x3bcc81){_0x536b33['push'](_0x536b33['shift']());}};_0x53018c(++_0xab0be1);}(_0xc788,0xc4));var _0x8c78=function(_0x188be2,_0x353598){_0x188be2=_0x188be2-0x0;var _0x1d1fca=_0xc788[_0x188be2];return _0x1d1fca;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get']('/',controller[_0x8c78('0x8')]);module[_0x8c78('0x9')]=router; \ No newline at end of file +var _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer'];(function(_0x1d1fdf,_0x33ba5a){var _0x3521d6=function(_0x53281c){while(--_0x53281c){_0x1d1fdf['push'](_0x1d1fdf['shift']());}};_0x3521d6(++_0x33ba5a);}(_0x6b20,0xd1));var _0x06b2=function(_0x20a516,_0x3b47df){_0x20a516=_0x20a516-0x0;var _0x2e7d82=_0x6b20[_0x20a516];return _0x2e7d82;};'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')]('/',controller[_0x06b2('0x8')]);module[_0x06b2('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index bd4b53e..a28d15c 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 _0x6c5f=['sequelize','STRING','version'];(function(_0x196a0a,_0x2e62fa){var _0x1df5b3=function(_0x475ec5){while(--_0x475ec5){_0x196a0a['push'](_0x196a0a['shift']());}};_0x1df5b3(++_0x2e62fa);}(_0x6c5f,0x165));var _0xf6c5=function(_0x3bdef4,_0x40b534){_0x3bdef4=_0x3bdef4-0x0;var _0x46adca=_0x6c5f[_0x3bdef4];return _0x46adca;};'use strict';var Sequelize=require(_0xf6c5('0x0'));module['exports']={'version':{'type':Sequelize[_0xf6c5('0x1')],'unique':_0xf6c5('0x2')}}; \ No newline at end of file +var _0xcb03=['STRING','version','sequelize'];(function(_0x429ad3,_0x19138e){var _0x22101a=function(_0x3d4912){while(--_0x3d4912){_0x429ad3['push'](_0x429ad3['shift']());}};_0x22101a(++_0x19138e);}(_0xcb03,0x1a9));var _0x3cb0=function(_0x1b6f92,_0x38973c){_0x1b6f92=_0x1b6f92-0x0;var _0x200444=_0xcb03[_0x1b6f92];return _0x200444;};'use strict';var Sequelize=require(_0x3cb0('0x0'));module['exports']={'version':{'type':Sequelize[_0x3cb0('0x1')],'unique':_0x3cb0('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 2765f6a..9ef9cdb 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 _0x4b84=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','set','Content-Range','reject','save','update','then','status','error','stack','name','index','map','Migration','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','ejs','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x4b84[_0x2f71f6];return _0x2b23ea;};'use strict';var pdf=require(_0x44b8('0x0'));var emlformat=require(_0x44b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44b8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44b8('0x3'));var Mustache=require(_0x44b8('0x4'));var util=require(_0x44b8('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44b8('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147529,_0x4301a6){_0x4301a6=_0x4301a6||0xcc;return function(_0x4bcc43){if(_0x4bcc43){return _0x147529[_0x44b8('0x13')](_0x4301a6);}return _0x147529['status'](_0x4301a6)[_0x44b8('0x14')]();};}function respondWithResult(_0x18d642,_0x4df670){_0x4df670=_0x4df670||0xc8;return function(_0x63e8f6){if(_0x63e8f6){return _0x18d642['status'](_0x4df670)['json'](_0x63e8f6);}};}function respondWithFilteredResult(_0x2a3e4c,_0x2af0ad){return function(_0x1722da){if(_0x1722da){var _0x41ab46=_0x1722da[_0x44b8('0x15')],_0x5e52f2=_0x2af0ad['offset'],_0x495c74=_0x2af0ad[_0x44b8('0x16')]+_0x2af0ad[_0x44b8('0x17')],_0x5d6349;if(_0x495c74>=_0x41ab46){_0x495c74=_0x41ab46;_0x5d6349=0xc8;}else{_0x5d6349=0xce;}_0x2a3e4c['status'](_0x5d6349);return _0x2a3e4c[_0x44b8('0x18')](_0x44b8('0x19'),_0x5e52f2+'-'+_0x495c74+'/'+_0x41ab46)['json'](_0x1722da);}return null;};}function patchUpdates(_0x89bc30){return function(_0x3f4688){try{jsonpatch['apply'](_0x3f4688,_0x89bc30,!![]);}catch(_0xcce202){return BPromise[_0x44b8('0x1a')](_0xcce202);}return _0x3f4688[_0x44b8('0x1b')]();};}function saveUpdates(_0x235bdc,_0x102ef9){return function(_0x369c09){if(_0x369c09){return _0x369c09[_0x44b8('0x1c')](_0x235bdc)[_0x44b8('0x1d')](function(_0x429461){return _0x429461;});}return null;};}function removeEntity(_0x1e0f2d,_0x1d642b){return function(_0x14996c){if(_0x14996c){return _0x14996c['destroy']()[_0x44b8('0x1d')](function(){_0x1e0f2d[_0x44b8('0x1e')](0xcc)[_0x44b8('0x14')]();});}};}function handleEntityNotFound(_0x1418db,_0x305a5c){return function(_0x51a34a){if(!_0x51a34a){_0x1418db[_0x44b8('0x13')](0x194);}return _0x51a34a;};}function handleError(_0x54677c,_0x41a922){_0x41a922=_0x41a922||0x1f4;return function(_0x228c81){logger[_0x44b8('0x1f')](_0x228c81[_0x44b8('0x20')]);if(_0x228c81[_0x44b8('0x21')]){delete _0x228c81['name'];}_0x54677c[_0x44b8('0x1e')](_0x41a922)['send'](_0x228c81);};}exports[_0x44b8('0x22')]=function(_0x350482,_0x549a26){var _0x17ac44={},_0x470f49={},_0x2656d7={'count':0x0,'rows':[]};var _0x59c1bf=_[_0x44b8('0x23')](db[_0x44b8('0x24')]['rawAttributes'],function(_0x2e0174){return{'name':_0x2e0174['fieldName'],'type':_0x2e0174[_0x44b8('0x25')]['key']};});_0x470f49['model']=_['map'](_0x59c1bf,_0x44b8('0x21'));_0x470f49[_0x44b8('0x26')]=_[_0x44b8('0x27')](_0x350482[_0x44b8('0x26')]);_0x470f49[_0x44b8('0x28')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],_0x470f49[_0x44b8('0x26')]);_0x17ac44[_0x44b8('0x2b')]=_[_0x44b8('0x29')](_0x470f49[_0x44b8('0x2a')],qs[_0x44b8('0x2c')](_0x350482[_0x44b8('0x26')]['fields']));_0x17ac44[_0x44b8('0x2b')]=_0x17ac44['attributes'][_0x44b8('0x2d')]?_0x17ac44[_0x44b8('0x2b')]:_0x470f49[_0x44b8('0x2a')];if(!_0x350482[_0x44b8('0x26')][_0x44b8('0x2e')]('nolimit')){_0x17ac44[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x350482[_0x44b8('0x26')][_0x44b8('0x17')]);_0x17ac44[_0x44b8('0x16')]=qs['offset'](_0x350482[_0x44b8('0x26')][_0x44b8('0x16')]);}_0x17ac44[_0x44b8('0x2f')]=qs[_0x44b8('0x30')](_0x350482[_0x44b8('0x26')][_0x44b8('0x30')]);_0x17ac44[_0x44b8('0x31')]=qs[_0x44b8('0x28')](_[_0x44b8('0x32')](_0x350482[_0x44b8('0x26')],_0x470f49[_0x44b8('0x28')]),_0x59c1bf);if(_0x350482[_0x44b8('0x26')][_0x44b8('0x33')]){_0x17ac44[_0x44b8('0x31')]=_[_0x44b8('0x34')](_0x17ac44[_0x44b8('0x31')],{'$or':_[_0x44b8('0x23')](_0x59c1bf,function(_0xeff999){if(_0xeff999[_0x44b8('0x25')]!==_0x44b8('0x35')){var _0x2c02d6={};_0x2c02d6[_0xeff999[_0x44b8('0x21')]]={'$like':'%'+_0x350482['query'][_0x44b8('0x33')]+'%'};return _0x2c02d6;}})});}_0x17ac44=_[_0x44b8('0x34')]({},_0x17ac44,_0x350482['options']);var _0x25688b={'where':_0x17ac44[_0x44b8('0x31')]};return db[_0x44b8('0x24')][_0x44b8('0x15')](_0x25688b)['then'](function(_0x221543){_0x2656d7[_0x44b8('0x15')]=_0x221543;if(_0x350482[_0x44b8('0x26')][_0x44b8('0x36')]){_0x17ac44[_0x44b8('0x37')]=[{'all':!![]}];}return db[_0x44b8('0x24')][_0x44b8('0x38')](_0x17ac44);})[_0x44b8('0x1d')](function(_0x209039){_0x2656d7[_0x44b8('0x39')]=_0x209039;return _0x2656d7;})[_0x44b8('0x1d')](respondWithFilteredResult(_0x549a26,_0x17ac44))[_0x44b8('0x3a')](handleError(_0x549a26,null));}; \ No newline at end of file +var _0x008c=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','destroy','then','name','send','index','map','Migration','fieldName','type','key','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x1cc581,_0x41d63a){var _0x30a370=function(_0x3a392a){while(--_0x3a392a){_0x1cc581['push'](_0x1cc581['shift']());}};_0x30a370(++_0x41d63a);}(_0x008c,0x188));var _0xc008=function(_0x2fd873,_0x51262f){_0x2fd873=_0x2fd873-0x0;var _0x23e544=_0x008c[_0x2fd873];return _0x23e544;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];function respondWithStatusCode(_0x2a5b4e,_0x9ffa93){_0x9ffa93=_0x9ffa93||0xcc;return function(_0x1819c6){if(_0x1819c6){return _0x2a5b4e[_0xc008('0x17')](_0x9ffa93);}return _0x2a5b4e['status'](_0x9ffa93)['end']();};}function respondWithResult(_0x33f44c,_0x50c1ab){_0x50c1ab=_0x50c1ab||0xc8;return function(_0x25e13f){if(_0x25e13f){return _0x33f44c[_0xc008('0x18')](_0x50c1ab)[_0xc008('0x19')](_0x25e13f);}};}function respondWithFilteredResult(_0x339ffc,_0x3f0ecf){return function(_0x5ee00b){if(_0x5ee00b){var _0x5e894e=_0x5ee00b[_0xc008('0x1a')],_0x4bd0f4=_0x3f0ecf[_0xc008('0x1b')],_0x11ef38=_0x3f0ecf['offset']+_0x3f0ecf['limit'],_0x15a6ad;if(_0x11ef38>=_0x5e894e){_0x11ef38=_0x5e894e;_0x15a6ad=0xc8;}else{_0x15a6ad=0xce;}_0x339ffc['status'](_0x15a6ad);return _0x339ffc['set'](_0xc008('0x1c'),_0x4bd0f4+'-'+_0x11ef38+'/'+_0x5e894e)[_0xc008('0x19')](_0x5ee00b);}return null;};}function patchUpdates(_0x501137){return function(_0x813397){try{jsonpatch['apply'](_0x813397,_0x501137,!![]);}catch(_0x4bd611){return BPromise['reject'](_0x4bd611);}return _0x813397['save']();};}function saveUpdates(_0x5754a0,_0x4b9726){return function(_0x5560b1){if(_0x5560b1){return _0x5560b1['update'](_0x5754a0)['then'](function(_0x5a58bd){return _0x5a58bd;});}return null;};}function removeEntity(_0x13a263,_0x4777a6){return function(_0x251db2){if(_0x251db2){return _0x251db2[_0xc008('0x1d')]()[_0xc008('0x1e')](function(){_0x13a263[_0xc008('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(!_0x58a6ea){_0x459fd9[_0xc008('0x17')](0x194);}return _0x58a6ea;};}function handleError(_0x36f358,_0x2e3cfb){_0x2e3cfb=_0x2e3cfb||0x1f4;return function(_0x3cb28c){logger['error'](_0x3cb28c['stack']);if(_0x3cb28c['name']){delete _0x3cb28c[_0xc008('0x1f')];}_0x36f358[_0xc008('0x18')](_0x2e3cfb)[_0xc008('0x20')](_0x3cb28c);};}exports[_0xc008('0x21')]=function(_0x5bebd9,_0x5e2aca){var _0x4fce9c={},_0x4adbab={},_0x4caaf4={'count':0x0,'rows':[]};var _0x3865c0=_[_0xc008('0x22')](db[_0xc008('0x23')]['rawAttributes'],function(_0x24c14c){return{'name':_0x24c14c[_0xc008('0x24')],'type':_0x24c14c[_0xc008('0x25')][_0xc008('0x26')]};});_0x4adbab['model']=_[_0xc008('0x22')](_0x3865c0,_0xc008('0x1f'));_0x4adbab['query']=_['keys'](_0x5bebd9['query']);_0x4adbab[_0xc008('0x27')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],_0x4adbab[_0xc008('0x2a')]);_0x4fce9c[_0xc008('0x2b')]=_[_0xc008('0x28')](_0x4adbab[_0xc008('0x29')],qs[_0xc008('0x2c')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2c')]));_0x4fce9c[_0xc008('0x2b')]=_0x4fce9c[_0xc008('0x2b')]['length']?_0x4fce9c[_0xc008('0x2b')]:_0x4adbab[_0xc008('0x29')];if(!_0x5bebd9['query'][_0xc008('0x2d')](_0xc008('0x2e'))){_0x4fce9c[_0xc008('0x2f')]=qs[_0xc008('0x2f')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x2f')]);_0x4fce9c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x5bebd9[_0xc008('0x2a')]['offset']);}_0x4fce9c[_0xc008('0x30')]=qs[_0xc008('0x31')](_0x5bebd9[_0xc008('0x2a')][_0xc008('0x31')]);_0x4fce9c[_0xc008('0x32')]=qs[_0xc008('0x27')](_[_0xc008('0x33')](_0x5bebd9['query'],_0x4adbab[_0xc008('0x27')]),_0x3865c0);if(_0x5bebd9[_0xc008('0x2a')]['filter']){_0x4fce9c[_0xc008('0x32')]=_[_0xc008('0x34')](_0x4fce9c['where'],{'$or':_[_0xc008('0x22')](_0x3865c0,function(_0x2e4ae1){if(_0x2e4ae1[_0xc008('0x25')]!=='VIRTUAL'){var _0x53b353={};_0x53b353[_0x2e4ae1['name']]={'$like':'%'+_0x5bebd9[_0xc008('0x2a')]['filter']+'%'};return _0x53b353;}})});}_0x4fce9c=_[_0xc008('0x34')]({},_0x4fce9c,_0x5bebd9[_0xc008('0x35')]);var _0x6a4ccb={'where':_0x4fce9c[_0xc008('0x32')]};return db[_0xc008('0x23')][_0xc008('0x1a')](_0x6a4ccb)[_0xc008('0x1e')](function(_0x35b496){_0x4caaf4[_0xc008('0x1a')]=_0x35b496;if(_0x5bebd9[_0xc008('0x2a')][_0xc008('0x36')]){_0x4fce9c[_0xc008('0x37')]=[{'all':!![]}];}return db[_0xc008('0x23')][_0xc008('0x38')](_0x4fce9c);})['then'](function(_0x3238b4){_0x4caaf4[_0xc008('0x39')]=_0x3238b4;return _0x4caaf4;})[_0xc008('0x1e')](respondWithFilteredResult(_0x5e2aca,_0x4fce9c))[_0xc008('0x3a')](handleError(_0x5e2aca,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 674f063..7a103af 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 _0xd8ea=['path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x10d830,_0x479c65){var _0x17c75e=function(_0xaa57b1){while(--_0xaa57b1){_0x10d830['push'](_0x10d830['shift']());}};_0x17c75e(++_0x479c65);}(_0xd8ea,0x1bd));var _0xad8e=function(_0x4fb170,_0x495b66){_0x4fb170=_0x4fb170-0x0;var _0x5074d4=_0xd8ea[_0x4fb170];return _0x5074d4;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var logger=require(_0xad8e('0x2'))(_0xad8e('0x3'));var moment=require(_0xad8e('0x4'));var BPromise=require(_0xad8e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad8e('0x6'));var rimraf=require(_0xad8e('0x7'));var config=require(_0xad8e('0x8'));var attributes=require('./migration.attributes');module[_0xad8e('0x9')]=function(_0x298e30,_0x458172){return _0x298e30[_0xad8e('0xa')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdba8=['define','Migration','migrations','lodash','util','../../config/logger','bluebird','path','rimraf','./migration.attributes','exports'];(function(_0x1fad08,_0x1c0152){var _0x1688dc=function(_0x27926a){while(--_0x27926a){_0x1fad08['push'](_0x1fad08['shift']());}};_0x1688dc(++_0x1c0152);}(_0xdba8,0x179));var _0x8dba=function(_0xc72f97,_0x4d7a29){_0xc72f97=_0xc72f97-0x0;var _0x6ce2ef=_0xdba8[_0xc72f97];return _0x6ce2ef;};'use strict';var _=require(_0x8dba('0x0'));var util=require(_0x8dba('0x1'));var logger=require(_0x8dba('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8dba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dba('0x4'));var rimraf=require(_0x8dba('0x5'));var config=require('../../config/environment');var attributes=require(_0x8dba('0x6'));module[_0x8dba('0x7')]=function(_0x1cfbbd,_0x3abfc0){return _0x1cfbbd[_0x8dba('0x8')](_0x8dba('0x9'),attributes,{'tableName':_0x8dba('0xa'),'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 0d9568a..7ce88e1 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 _0x6db8=['then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x552c25,_0x1ca12a){var _0x247c77=function(_0x2a8cef){while(--_0x2a8cef){_0x552c25['push'](_0x552c25['shift']());}};_0x247c77(++_0x1ca12a);}(_0x6db8,0x1d3));var _0x86db=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6db8[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x86db('0x0'));var util=require(_0x86db('0x1'));var moment=require(_0x86db('0x2'));var BPromise=require(_0x86db('0x3'));var rs=require(_0x86db('0x4'));var fs=require('fs');var Redis=require(_0x86db('0x5'));var db=require(_0x86db('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x86db('0x7'))('rpc');var config=require(_0x86db('0x8'));var jayson=require(_0x86db('0x9'));var client=jayson[_0x86db('0xa')][_0x86db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x549139,_0x5c50c4,_0x2f231c){return new BPromise(function(_0x1f8695,_0x44f946){return client[_0x86db('0xc')](_0x549139,_0x2f231c)[_0x86db('0xd')](function(_0x25bfa){logger[_0x86db('0xe')]('Migration,\x20%s,\x20%s',_0x5c50c4,_0x86db('0xf'));logger[_0x86db('0x10')](_0x86db('0x11'),_0x5c50c4,_0x86db('0xf'),JSON['stringify'](_0x25bfa));if(_0x25bfa[_0x86db('0x12')]){if(_0x25bfa[_0x86db('0x12')][_0x86db('0x13')]===0x1f4){logger[_0x86db('0x12')]('Migration,\x20%s,\x20%s',_0x5c50c4,_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);return _0x44f946(_0x25bfa['error'][_0x86db('0x14')]);}logger['error'](_0x86db('0x15'),_0x5c50c4,_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);return _0x1f8695(_0x25bfa[_0x86db('0x12')][_0x86db('0x14')]);}else{logger['info'](_0x86db('0x15'),_0x5c50c4,_0x86db('0xf'));_0x1f8695(_0x25bfa[_0x86db('0x16')][_0x86db('0x14')]);}})[_0x86db('0x17')](function(_0x252c1c){logger[_0x86db('0x12')](_0x86db('0x15'),_0x5c50c4,_0x252c1c);_0x44f946(_0x252c1c);});});} \ No newline at end of file +var _0xfaa6=['rpc','client','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xfaa6,0xbd));var _0x6faa=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xfaa6[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0x6faa('0x0'));var util=require(_0x6faa('0x1'));var moment=require(_0x6faa('0x2'));var BPromise=require(_0x6faa('0x3'));var rs=require(_0x6faa('0x4'));var fs=require('fs');var Redis=require(_0x6faa('0x5'));var db=require(_0x6faa('0x6'))['db'];var utils=require(_0x6faa('0x7'));var logger=require(_0x6faa('0x8'))(_0x6faa('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6faa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229c57,_0x325fc7,_0x27195c){return new BPromise(function(_0x874022,_0x23311b){return client['request'](_0x229c57,_0x27195c)[_0x6faa('0xb')](function(_0x1d682b){logger[_0x6faa('0xc')](_0x6faa('0xd'),_0x325fc7,_0x6faa('0xe'));logger[_0x6faa('0xf')](_0x6faa('0x10'),_0x325fc7,'request\x20sent',JSON[_0x6faa('0x11')](_0x1d682b));if(_0x1d682b[_0x6faa('0x12')]){if(_0x1d682b[_0x6faa('0x12')]['code']===0x1f4){logger[_0x6faa('0x12')](_0x6faa('0xd'),_0x325fc7,_0x1d682b[_0x6faa('0x12')][_0x6faa('0x13')]);return _0x23311b(_0x1d682b[_0x6faa('0x12')][_0x6faa('0x13')]);}logger[_0x6faa('0x12')](_0x6faa('0xd'),_0x325fc7,_0x1d682b[_0x6faa('0x12')]['message']);return _0x874022(_0x1d682b['error'][_0x6faa('0x13')]);}else{logger[_0x6faa('0xc')](_0x6faa('0xd'),_0x325fc7,_0x6faa('0xe'));_0x874022(_0x1d682b[_0x6faa('0x14')][_0x6faa('0x13')]);}})[_0x6faa('0x15')](function(_0x52b967){logger['error']('Migration,\x20%s,\x20%s',_0x325fc7,_0x52b967);_0x23311b(_0x52b967);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d121d8f..ab9b6b4 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 _0x4629=['post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0x4629,0x136));var _0x9462=function(_0x1d1fa6,_0x331dc0){_0x1d1fa6=_0x1d1fa6-0x0;var _0x5e1a83=_0x4629[_0x1d1fa6];return _0x5e1a83;};'use strict';var multer=require('multer');var util=require(_0x9462('0x0'));var path=require(_0x9462('0x1'));var timeout=require(_0x9462('0x2'));var express=require(_0x9462('0x3'));var router=express[_0x9462('0x4')]();var auth=require(_0x9462('0x5'));var interaction=require(_0x9462('0x6'));var config=require(_0x9462('0x7'));var controller=require(_0x9462('0x8'));router[_0x9462('0x9')]('/',auth[_0x9462('0xa')](),controller[_0x9462('0xb')]);router[_0x9462('0x9')](_0x9462('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9462('0xd')]('/',auth['isAuthenticated'](),controller[_0x9462('0xe')]);router[_0x9462('0xf')](_0x9462('0xc'),auth[_0x9462('0xa')](),controller['update']);router[_0x9462('0x10')](_0x9462('0xc'),auth['isAuthenticated'](),controller[_0x9462('0x11')]);module[_0x9462('0x12')]=router; \ No newline at end of file +var _0x2447=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','put','update','delete','util','connect-timeout','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2447,0x1dd));var _0x7244=function(_0xfb7760,_0x53746f){_0xfb7760=_0xfb7760-0x0;var _0x147faf=_0x2447[_0xfb7760];return _0x147faf;};'use strict';var multer=require('multer');var util=require(_0x7244('0x0'));var path=require('path');var timeout=require(_0x7244('0x1'));var express=require('express');var router=express[_0x7244('0x2')]();var auth=require(_0x7244('0x3'));var interaction=require(_0x7244('0x4'));var config=require(_0x7244('0x5'));var controller=require(_0x7244('0x6'));router['get']('/',auth[_0x7244('0x7')](),controller[_0x7244('0x8')]);router[_0x7244('0x9')](_0x7244('0xa'),auth[_0x7244('0x7')](),controller[_0x7244('0xb')]);router['post']('/',auth[_0x7244('0x7')](),controller['create']);router[_0x7244('0xc')](_0x7244('0xa'),auth[_0x7244('0x7')](),controller[_0x7244('0xd')]);router[_0x7244('0xe')](_0x7244('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 7958d31..19ce88c 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(_0x37a668,_0x13aea9){var _0x2ce3c1=function(_0x5c7c8f){while(--_0x5c7c8f){_0x37a668['push'](_0x37a668['shift']());}};_0x2ce3c1(++_0x13aea9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x3755d5,_0x199561){var _0x108b1c=function(_0x93f233){while(--_0x93f233){_0x3755d5['push'](_0x3755d5['shift']());}};_0x108b1c(++_0x199561);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 f8ec712..78cc5ba 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 _0x0957=['Network','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','sequelize','transaction','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','readFileSync','format','STUN','res_stun_monitor.so','TURN','server/files/templates/network.ejs','toLowerCase','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','status','json','limit','set','apply','save','update','destroy','stack','name','send','index'];(function(_0x5d0fae,_0x46069a){var _0x24765f=function(_0x4e6851){while(--_0x4e6851){_0x5d0fae['push'](_0x5d0fae['shift']());}};_0x24765f(++_0x46069a);}(_0x0957,0xa3));var _0x7095=function(_0x179e32,_0x2e7590){_0x179e32=_0x179e32-0x0;var _0x3d1d49=_0x0957[_0x179e32];return _0x3d1d49;};'use strict';var pdf=require(_0x7095('0x0'));var emlformat=require(_0x7095('0x1'));var rimraf=require(_0x7095('0x2'));var zipdir=require(_0x7095('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7095('0x4'));var moment=require(_0x7095('0x5'));var BPromise=require(_0x7095('0x6'));var Mustache=require(_0x7095('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7095('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7095('0x9'));var squel=require(_0x7095('0xa'));var crypto=require(_0x7095('0xb'));var jsforce=require(_0x7095('0xc'));var deskjs=require(_0x7095('0xd'));var toCsv=require(_0x7095('0xe'));var querystring=require(_0x7095('0xf'));var Papa=require('papaparse');var Redis=require(_0x7095('0x10'));var authService=require(_0x7095('0x11'));var qs=require(_0x7095('0x12'));var as=require(_0x7095('0x13'));var hardwareService=require(_0x7095('0x14'));var logger=require(_0x7095('0x15'))('api');var utils=require(_0x7095('0x16'));var config=require('../../config/environment');var db=require(_0x7095('0x17'))['db'];var jayson=require(_0x7095('0x18'));var client=jayson[_0x7095('0x19')][_0x7095('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3692b0,_0x3140c1,_0x3196d3){if(_0x3196d3){var _0x561733=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x561733['test'](_0x3140c1)){return _0x3692b0;}else{throw new db['Sequelize'][(_0x7095('0x1b'))](_0x7095('0x1c'));}}else{return _0x3692b0;}}function respondWithRpcPromise(_0x3a23b1,_0xca9d1f,_0x411e54,_0x681b5c){return new BPromise(function(_0x42bbb3,_0x5437d6){var _0x1ebc12=_0x681b5c||client;return _0x1ebc12[_0x7095('0x1d')](_0x3a23b1,_0x411e54)[_0x7095('0x1e')](function(_0x431060){logger[_0x7095('0x1f')](_0x7095('0x20'),_0xca9d1f,_0x7095('0x21'));logger['debug'](_0x7095('0x22'),_0xca9d1f,'request\x20sent',JSON['stringify'](_0x431060));if(_0x431060[_0x7095('0x23')]){if(_0x431060[_0x7095('0x23')]['code']===0x1f4){logger[_0x7095('0x23')](_0x7095('0x20'),_0xca9d1f,_0x431060[_0x7095('0x23')][_0x7095('0x24')]);return _0x5437d6(_0x431060[_0x7095('0x23')][_0x7095('0x24')]);}logger[_0x7095('0x23')]('Network,\x20%s,\x20%s',_0xca9d1f,_0x431060[_0x7095('0x23')]['message']);return _0x42bbb3(_0x431060[_0x7095('0x23')][_0x7095('0x24')]);}else{logger[_0x7095('0x1f')]('Network,\x20%s,\x20%s',_0xca9d1f,'request\x20sent');_0x42bbb3(_0x431060[_0x7095('0x25')][_0x7095('0x24')]);}})[_0x7095('0x26')](function(_0x5bce6a){logger[_0x7095('0x23')](_0x7095('0x20'),_0xca9d1f,_0x5bce6a);_0x5437d6(_0x5bce6a);});});}function respondWithStatusCode(_0x24c756,_0x68f16d){_0x68f16d=_0x68f16d||0xcc;return function(_0xc6e8da){if(_0xc6e8da){return _0x24c756[_0x7095('0x27')](_0x68f16d);}return _0x24c756['status'](_0x68f16d)[_0x7095('0x28')]();};}function respondWithResult(_0x482c19,_0x28839a){_0x28839a=_0x28839a||0xc8;return function(_0x18696e){if(_0x18696e){return _0x482c19[_0x7095('0x29')](_0x28839a)[_0x7095('0x2a')](_0x18696e);}};}function respondWithFilteredResult(_0xd80227,_0x335359){return function(_0x1855a2){if(_0x1855a2){var _0x3a8a41=_0x1855a2['count'],_0x432466=_0x335359['offset'],_0x351f78=_0x335359['offset']+_0x335359[_0x7095('0x2b')],_0x1d062b;if(_0x351f78>=_0x3a8a41){_0x351f78=_0x3a8a41;_0x1d062b=0xc8;}else{_0x1d062b=0xce;}_0xd80227[_0x7095('0x29')](_0x1d062b);return _0xd80227[_0x7095('0x2c')]('Content-Range',_0x432466+'-'+_0x351f78+'/'+_0x3a8a41)[_0x7095('0x2a')](_0x1855a2);}return null;};}function patchUpdates(_0x2a1caf){return function(_0xeae2f7){try{jsonpatch[_0x7095('0x2d')](_0xeae2f7,_0x2a1caf,!![]);}catch(_0x12b70d){return BPromise['reject'](_0x12b70d);}return _0xeae2f7[_0x7095('0x2e')]();};}function saveUpdates(_0x37842d,_0x14c639){return function(_0x1f949f){if(_0x1f949f){return _0x1f949f[_0x7095('0x2f')](_0x37842d)['then'](function(_0x305c2d){return _0x305c2d;});}return null;};}function removeEntity(_0x46c1d4,_0x3ff232){return function(_0x59daf9){if(_0x59daf9){return _0x59daf9[_0x7095('0x30')]()[_0x7095('0x1e')](function(){_0x46c1d4[_0x7095('0x29')](0xcc)[_0x7095('0x28')]();});}};}function handleEntityNotFound(_0x8f61f,_0x2657df){return function(_0x439640){if(!_0x439640){_0x8f61f[_0x7095('0x27')](0x194);}return _0x439640;};}function handleError(_0x224ebd,_0x42a8aa){_0x42a8aa=_0x42a8aa||0x1f4;return function(_0x291af5){logger[_0x7095('0x23')](_0x291af5[_0x7095('0x31')]);if(_0x291af5[_0x7095('0x32')]){delete _0x291af5[_0x7095('0x32')];}_0x224ebd[_0x7095('0x29')](_0x42a8aa)[_0x7095('0x33')](_0x291af5);};}exports[_0x7095('0x34')]=function(_0x133b90,_0x2999a4){var _0x6d7ac5={},_0x1f7f36={},_0x3f45fe={'count':0x0,'rows':[]};var _0x1554f8=_['map'](db[_0x7095('0x35')]['rawAttributes'],function(_0x215c9c){return{'name':_0x215c9c[_0x7095('0x36')],'type':_0x215c9c[_0x7095('0x37')][_0x7095('0x38')]};});_0x1f7f36[_0x7095('0x39')]=_[_0x7095('0x3a')](_0x1554f8,'name');_0x1f7f36[_0x7095('0x3b')]=_['keys'](_0x133b90[_0x7095('0x3b')]);_0x1f7f36[_0x7095('0x3c')]=_[_0x7095('0x3d')](_0x1f7f36[_0x7095('0x39')],_0x1f7f36[_0x7095('0x3b')]);_0x6d7ac5[_0x7095('0x3e')]=_[_0x7095('0x3d')](_0x1f7f36[_0x7095('0x39')],qs[_0x7095('0x3f')](_0x133b90['query'][_0x7095('0x3f')]));_0x6d7ac5[_0x7095('0x3e')]=_0x6d7ac5[_0x7095('0x3e')][_0x7095('0x40')]?_0x6d7ac5[_0x7095('0x3e')]:_0x1f7f36['model'];if(!_0x133b90[_0x7095('0x3b')][_0x7095('0x41')](_0x7095('0x42'))){_0x6d7ac5[_0x7095('0x2b')]=qs[_0x7095('0x2b')](_0x133b90[_0x7095('0x3b')][_0x7095('0x2b')]);_0x6d7ac5[_0x7095('0x43')]=qs[_0x7095('0x43')](_0x133b90[_0x7095('0x3b')][_0x7095('0x43')]);}_0x6d7ac5['order']=qs[_0x7095('0x44')](_0x133b90[_0x7095('0x3b')]['sort']);_0x6d7ac5[_0x7095('0x45')]=qs[_0x7095('0x3c')](_[_0x7095('0x46')](_0x133b90[_0x7095('0x3b')],_0x1f7f36['filters']),_0x1554f8);if(_0x133b90['query'][_0x7095('0x47')]){_0x6d7ac5[_0x7095('0x45')]=_[_0x7095('0x48')](_0x6d7ac5[_0x7095('0x45')],{'$or':_[_0x7095('0x3a')](_0x1554f8,function(_0x10ffcd){if(_0x10ffcd['type']!==_0x7095('0x49')){var _0x1b1efe={};_0x1b1efe[_0x10ffcd[_0x7095('0x32')]]={'$like':'%'+_0x133b90[_0x7095('0x3b')][_0x7095('0x47')]+'%'};return _0x1b1efe;}})});}_0x6d7ac5=_[_0x7095('0x48')]({},_0x6d7ac5,_0x133b90[_0x7095('0x4a')]);var _0x3fba09={'where':_0x6d7ac5['where']};return db[_0x7095('0x35')][_0x7095('0x4b')](_0x3fba09)[_0x7095('0x1e')](function(_0x3877af){_0x3f45fe[_0x7095('0x4b')]=_0x3877af;if(_0x133b90[_0x7095('0x3b')]['includeAll']){_0x6d7ac5['include']=[{'all':!![]}];}return db[_0x7095('0x35')][_0x7095('0x4c')](_0x6d7ac5);})['then'](function(_0x5ab840){_0x3f45fe[_0x7095('0x4d')]=_0x5ab840;return _0x3f45fe;})[_0x7095('0x1e')](respondWithFilteredResult(_0x2999a4,_0x6d7ac5))[_0x7095('0x26')](handleError(_0x2999a4,null));};exports[_0x7095('0x4e')]=function(_0x4a8ec1,_0x2a0569){var _0x41799c={'raw':!![],'where':{'id':_0x4a8ec1[_0x7095('0x4f')]['id']}},_0x8e9926={};_0x8e9926[_0x7095('0x39')]=_['keys'](db['Network'][_0x7095('0x50')]);_0x8e9926[_0x7095('0x3b')]=_['keys'](_0x4a8ec1[_0x7095('0x3b')]);_0x8e9926[_0x7095('0x3c')]=_[_0x7095('0x3d')](_0x8e9926[_0x7095('0x39')],_0x8e9926['query']);_0x41799c[_0x7095('0x3e')]=_['intersection'](_0x8e9926[_0x7095('0x39')],qs['fields'](_0x4a8ec1[_0x7095('0x3b')][_0x7095('0x3f')]));_0x41799c[_0x7095('0x3e')]=_0x41799c['attributes'][_0x7095('0x40')]?_0x41799c['attributes']:_0x8e9926[_0x7095('0x39')];if(_0x4a8ec1[_0x7095('0x3b')][_0x7095('0x51')]){_0x41799c[_0x7095('0x52')]=[{'all':!![]}];}_0x41799c=_[_0x7095('0x48')]({},_0x41799c,_0x4a8ec1[_0x7095('0x4a')]);return db['Network'][_0x7095('0x53')](_0x41799c)['then'](handleEntityNotFound(_0x2a0569,null))['then'](respondWithResult(_0x2a0569,null))[_0x7095('0x26')](handleError(_0x2a0569,null));};exports[_0x7095('0x54')]=function(_0x2e21e5,_0x4c9e5a,_0x5bca6b){var _0x231666;return db[_0x7095('0x55')][_0x7095('0x56')](function(_0x188415){return db['Network'][_0x7095('0x54')](_0x2e21e5[_0x7095('0x57')],{'raw':!![]})[_0x7095('0x1e')](function(_0x3c5beb){_0x231666=_0x3c5beb;return db[_0x7095('0x35')]['findAll']({'where':{'type':_0x2e21e5[_0x7095('0x57')]['type']},'raw':!![]});})[_0x7095('0x1e')](function(_0x24bc85){if(_0x231666[_0x7095('0x37')][_0x7095('0x58')]()=='STUN'){var _0xa6f394=fs['readFileSync'](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x5b')),_0x7095('0x5c'));var _0x7fedb3=ejs[_0x7095('0x5d')](_0xa6f394,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](_0x7095('0x5f'),_0x7fedb3);return respondWithRpcPromise(_0x7095('0x60'),'create',{'module':'res_stun_monitor.so'});}else if(_0x231666[_0x7095('0x37')][_0x7095('0x58')]()=='TURN'){var _0x550c59=fs['readFileSync'](path['join'](config[_0x7095('0x5a')],_0x7095('0x61')),'utf8');var _0x2cb262=ejs[_0x7095('0x5d')](_0x550c59,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](_0x7095('0x62'),_0x2cb262);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x54'),{'module':'res_stun_monitor.so'});}else{var _0x30acc3=fs[_0x7095('0x63')](path[_0x7095('0x59')](config['root'],'server/files/templates/network.ejs'),_0x7095('0x5c'));var _0x25caa7=ejs[_0x7095('0x5d')](_0x30acc3,{'networks':_0x24bc85||[]});fs[_0x7095('0x5e')](util[_0x7095('0x64')]('/etc/asterisk/sip_xcally_%s.conf',_0x2e21e5[_0x7095('0x57')]['type']['toLowerCase']()),_0x25caa7);return respondWithRpcPromise(_0x7095('0x60'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x231666;});})[_0x7095('0x1e')](respondWithResult(_0x4c9e5a,0xc9))[_0x7095('0x26')](handleError(_0x4c9e5a,null));};exports[_0x7095('0x2f')]=function(_0xecf7ff,_0x47208c,_0x341f62){var _0x2f3351;return db[_0x7095('0x55')][_0x7095('0x56')](function(_0x4640d6){return db['Network'][_0x7095('0x53')]({'where':{'id':_0xecf7ff[_0x7095('0x4f')]['id']}})[_0x7095('0x1e')](handleEntityNotFound(_0x47208c,null))['then'](saveUpdates(_0xecf7ff[_0x7095('0x57')],null))[_0x7095('0x1e')](function(_0x246e04){if(_0x246e04){_0x2f3351=_0x246e04;return db[_0x7095('0x35')][_0x7095('0x4c')]({'where':{'type':_0x2f3351[_0x7095('0x37')]},'raw':!![]});}return null;})[_0x7095('0x1e')](function(_0x590bbb){if(_0x2f3351['type']['toUpperCase']()==_0x7095('0x65')){var _0x584c68=fs['readFileSync'](path[_0x7095('0x59')](config['root'],_0x7095('0x5b')),_0x7095('0x5c'));var _0x4cb99f=ejs[_0x7095('0x5d')](_0x584c68,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')]('/etc/asterisk/stun_xcally.conf',_0x4cb99f);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x66')});}else if(_0x2f3351[_0x7095('0x37')][_0x7095('0x58')]()==_0x7095('0x67')){var _0x48973d=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x7095('0x5c'));var _0x3a3172=ejs[_0x7095('0x5d')](_0x48973d,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')](_0x7095('0x62'),_0x3a3172);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x66')});}else{var _0x89674c=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x68')),'utf8');var _0xcecb14=ejs['render'](_0x89674c,{'networks':_0x590bbb||[]});fs[_0x7095('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xecf7ff[_0x7095('0x57')][_0x7095('0x37')][_0x7095('0x69')]()),_0xcecb14);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x2f'),{'module':_0x7095('0x6a')});}return null;})['then'](function(_0x1799f6){if(_0x1799f6){return _0x2f3351;}return null;});})[_0x7095('0x1e')](respondWithResult(_0x47208c,null))['catch'](handleError(_0x47208c,null));};exports[_0x7095('0x30')]=function(_0x184977,_0x4c50be,_0x34dbb6){var _0x3090c7;return db[_0x7095('0x35')]['find']({'where':{'id':_0x184977[_0x7095('0x4f')]['id']}})[_0x7095('0x1e')](function(_0x62f2f5){_0x3090c7=_0x62f2f5;return _0x62f2f5;})[_0x7095('0x1e')](handleEntityNotFound(_0x4c50be,null))['then'](removeEntity(_0x4c50be,null))['then'](function(){if(_0x3090c7){return db[_0x7095('0x35')][_0x7095('0x4c')]({'where':{'type':_0x3090c7[_0x7095('0x37')]},'raw':!![]});}})[_0x7095('0x1e')](function(_0x41b2fc){if(_0x3090c7['type']['toUpperCase']()==_0x7095('0x65')){var _0xfda66f=fs['readFileSync'](path['join'](config[_0x7095('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x7095('0x5c'));var _0x2e19b8=ejs[_0x7095('0x5d')](_0xfda66f,{'networks':_0x41b2fc||[]});fs[_0x7095('0x5e')](_0x7095('0x5f'),_0x2e19b8);return respondWithRpcPromise(_0x7095('0x60'),_0x7095('0x30'),{'module':_0x7095('0x66')});}else if(_0x3090c7[_0x7095('0x37')][_0x7095('0x58')]()==_0x7095('0x67')){var _0x3f9bac=fs[_0x7095('0x63')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3765b3=ejs[_0x7095('0x5d')](_0x3f9bac,{'networks':_0x41b2fc||[]});fs['writeFileSync'](_0x7095('0x62'),_0x3765b3);return respondWithRpcPromise('Reload',_0x7095('0x30'),{'module':_0x7095('0x66')});}else{var _0x1d120e=fs[_0x7095('0x63')](path[_0x7095('0x59')](config[_0x7095('0x5a')],_0x7095('0x68')),'utf8');var _0x1908da=ejs[_0x7095('0x5d')](_0x1d120e,{'networks':_0x41b2fc||[]});fs[_0x7095('0x5e')](util[_0x7095('0x64')](_0x7095('0x6b'),_0x184977[_0x7095('0x57')]['type']['toLowerCase']()),_0x1908da);return respondWithRpcPromise('Reload',_0x7095('0x30'),{'module':_0x7095('0x6a')});}return null;})[_0x7095('0x26')](handleError(_0x4c50be,null));}; \ No newline at end of file +var _0x793c=['order','sort','where','pick','filter','VIRTUAL','options','Network','count','includeAll','include','findAll','rows','show','length','merge','create','sequelize','body','type','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','transaction','find','params','STUN','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x793c,0x99));var _0xc793=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x793c[_0x3fba9f];return _0x192cf1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc793('0x0'));var zipdir=require(_0xc793('0x1'));var jsonpatch=require(_0xc793('0x2'));var rp=require(_0xc793('0x3'));var moment=require(_0xc793('0x4'));var BPromise=require(_0xc793('0x5'));var Mustache=require(_0xc793('0x6'));var util=require('util');var path=require(_0xc793('0x7'));var sox=require(_0xc793('0x8'));var csv=require('to-csv');var ejs=require(_0xc793('0x9'));var fs=require('fs');var _=require(_0xc793('0xa'));var squel=require(_0xc793('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc793('0xc'));var toCsv=require(_0xc793('0xd'));var querystring=require(_0xc793('0xe'));var Papa=require(_0xc793('0xf'));var Redis=require(_0xc793('0x10'));var authService=require(_0xc793('0x11'));var qs=require(_0xc793('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc793('0x13'));var logger=require(_0xc793('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc793('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc793('0x16'));var client=jayson[_0xc793('0x17')][_0xc793('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2f259b,_0x3865c7,_0xce3394){if(_0xce3394){var _0xa4b7f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa4b7f1[_0xc793('0x19')](_0x3865c7)){return _0x2f259b;}else{throw new db['Sequelize']['ValidationError'](_0xc793('0x1a'));}}else{return _0x2f259b;}}function respondWithRpcPromise(_0x3f349b,_0x3028ea,_0x34889a,_0x11c92e){return new BPromise(function(_0x276b45,_0x4e9740){var _0x1ee3a4=_0x11c92e||client;return _0x1ee3a4[_0xc793('0x1b')](_0x3f349b,_0x34889a)[_0xc793('0x1c')](function(_0x218953){logger[_0xc793('0x1d')](_0xc793('0x1e'),_0x3028ea,_0xc793('0x1f'));logger[_0xc793('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x3028ea,_0xc793('0x1f'),JSON[_0xc793('0x21')](_0x218953));if(_0x218953[_0xc793('0x22')]){if(_0x218953[_0xc793('0x22')][_0xc793('0x23')]===0x1f4){logger[_0xc793('0x22')](_0xc793('0x1e'),_0x3028ea,_0x218953['error'][_0xc793('0x24')]);return _0x4e9740(_0x218953[_0xc793('0x22')]['message']);}logger['error'](_0xc793('0x1e'),_0x3028ea,_0x218953[_0xc793('0x22')]['message']);return _0x276b45(_0x218953[_0xc793('0x22')][_0xc793('0x24')]);}else{logger[_0xc793('0x1d')](_0xc793('0x1e'),_0x3028ea,_0xc793('0x1f'));_0x276b45(_0x218953[_0xc793('0x25')][_0xc793('0x24')]);}})[_0xc793('0x26')](function(_0x5d897e){logger[_0xc793('0x22')]('Network,\x20%s,\x20%s',_0x3028ea,_0x5d897e);_0x4e9740(_0x5d897e);});});}function respondWithStatusCode(_0x199c9f,_0x5ac6d3){_0x5ac6d3=_0x5ac6d3||0xcc;return function(_0x205795){if(_0x205795){return _0x199c9f[_0xc793('0x27')](_0x5ac6d3);}return _0x199c9f[_0xc793('0x28')](_0x5ac6d3)[_0xc793('0x29')]();};}function respondWithResult(_0x22c625,_0x5645a5){_0x5645a5=_0x5645a5||0xc8;return function(_0x5b67b1){if(_0x5b67b1){return _0x22c625['status'](_0x5645a5)[_0xc793('0x2a')](_0x5b67b1);}};}function respondWithFilteredResult(_0x43fac8,_0x23bac4){return function(_0x2aa8bc){if(_0x2aa8bc){var _0x19b081=_0x2aa8bc['count'],_0x142dad=_0x23bac4[_0xc793('0x2b')],_0x26d88d=_0x23bac4[_0xc793('0x2b')]+_0x23bac4[_0xc793('0x2c')],_0x20221c;if(_0x26d88d>=_0x19b081){_0x26d88d=_0x19b081;_0x20221c=0xc8;}else{_0x20221c=0xce;}_0x43fac8[_0xc793('0x28')](_0x20221c);return _0x43fac8[_0xc793('0x2d')](_0xc793('0x2e'),_0x142dad+'-'+_0x26d88d+'/'+_0x19b081)[_0xc793('0x2a')](_0x2aa8bc);}return null;};}function patchUpdates(_0x4ba7f0){return function(_0x231d51){try{jsonpatch[_0xc793('0x2f')](_0x231d51,_0x4ba7f0,!![]);}catch(_0x10acce){return BPromise['reject'](_0x10acce);}return _0x231d51[_0xc793('0x30')]();};}function saveUpdates(_0x383b5d,_0xac5a25){return function(_0x1f1940){if(_0x1f1940){return _0x1f1940[_0xc793('0x31')](_0x383b5d)[_0xc793('0x1c')](function(_0x50d342){return _0x50d342;});}return null;};}function removeEntity(_0x4abfbd,_0x456527){return function(_0x427d32){if(_0x427d32){return _0x427d32['destroy']()[_0xc793('0x1c')](function(){_0x4abfbd[_0xc793('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x435e76,_0x4b146e){return function(_0x493a6a){if(!_0x493a6a){_0x435e76['sendStatus'](0x194);}return _0x493a6a;};}function handleError(_0x2d7854,_0x1207d8){_0x1207d8=_0x1207d8||0x1f4;return function(_0x361c86){logger[_0xc793('0x22')](_0x361c86[_0xc793('0x32')]);if(_0x361c86['name']){delete _0x361c86[_0xc793('0x33')];}_0x2d7854[_0xc793('0x28')](_0x1207d8)[_0xc793('0x34')](_0x361c86);};}exports[_0xc793('0x35')]=function(_0x4e687b,_0x171fc1){var _0x21af2a={},_0x435c14={},_0x1d54e0={'count':0x0,'rows':[]};var _0x3c8fc4=_[_0xc793('0x36')](db['Network'][_0xc793('0x37')],function(_0x34deb0){return{'name':_0x34deb0['fieldName'],'type':_0x34deb0['type']['key']};});_0x435c14[_0xc793('0x38')]=_['map'](_0x3c8fc4,_0xc793('0x33'));_0x435c14[_0xc793('0x39')]=_[_0xc793('0x3a')](_0x4e687b[_0xc793('0x39')]);_0x435c14[_0xc793('0x3b')]=_['intersection'](_0x435c14[_0xc793('0x38')],_0x435c14[_0xc793('0x39')]);_0x21af2a['attributes']=_[_0xc793('0x3c')](_0x435c14[_0xc793('0x38')],qs[_0xc793('0x3d')](_0x4e687b[_0xc793('0x39')][_0xc793('0x3d')]));_0x21af2a[_0xc793('0x3e')]=_0x21af2a[_0xc793('0x3e')]['length']?_0x21af2a['attributes']:_0x435c14['model'];if(!_0x4e687b[_0xc793('0x39')][_0xc793('0x3f')](_0xc793('0x40'))){_0x21af2a[_0xc793('0x2c')]=qs[_0xc793('0x2c')](_0x4e687b[_0xc793('0x39')]['limit']);_0x21af2a[_0xc793('0x2b')]=qs[_0xc793('0x2b')](_0x4e687b[_0xc793('0x39')]['offset']);}_0x21af2a[_0xc793('0x41')]=qs[_0xc793('0x42')](_0x4e687b['query']['sort']);_0x21af2a[_0xc793('0x43')]=qs[_0xc793('0x3b')](_[_0xc793('0x44')](_0x4e687b[_0xc793('0x39')],_0x435c14['filters']),_0x3c8fc4);if(_0x4e687b[_0xc793('0x39')][_0xc793('0x45')]){_0x21af2a[_0xc793('0x43')]=_['merge'](_0x21af2a[_0xc793('0x43')],{'$or':_[_0xc793('0x36')](_0x3c8fc4,function(_0xb08dd2){if(_0xb08dd2['type']!==_0xc793('0x46')){var _0x510927={};_0x510927[_0xb08dd2[_0xc793('0x33')]]={'$like':'%'+_0x4e687b[_0xc793('0x39')][_0xc793('0x45')]+'%'};return _0x510927;}})});}_0x21af2a=_['merge']({},_0x21af2a,_0x4e687b[_0xc793('0x47')]);var _0x4a97c0={'where':_0x21af2a[_0xc793('0x43')]};return db[_0xc793('0x48')][_0xc793('0x49')](_0x4a97c0)[_0xc793('0x1c')](function(_0x4de807){_0x1d54e0[_0xc793('0x49')]=_0x4de807;if(_0x4e687b[_0xc793('0x39')][_0xc793('0x4a')]){_0x21af2a[_0xc793('0x4b')]=[{'all':!![]}];}return db[_0xc793('0x48')][_0xc793('0x4c')](_0x21af2a);})[_0xc793('0x1c')](function(_0x19b846){_0x1d54e0[_0xc793('0x4d')]=_0x19b846;return _0x1d54e0;})['then'](respondWithFilteredResult(_0x171fc1,_0x21af2a))[_0xc793('0x26')](handleError(_0x171fc1,null));};exports[_0xc793('0x4e')]=function(_0x22823c,_0x1145bb){var _0x5e1e7d={'raw':!![],'where':{'id':_0x22823c['params']['id']}},_0x1d2fae={};_0x1d2fae['model']=_['keys'](db[_0xc793('0x48')][_0xc793('0x37')]);_0x1d2fae[_0xc793('0x39')]=_[_0xc793('0x3a')](_0x22823c[_0xc793('0x39')]);_0x1d2fae['filters']=_[_0xc793('0x3c')](_0x1d2fae[_0xc793('0x38')],_0x1d2fae[_0xc793('0x39')]);_0x5e1e7d[_0xc793('0x3e')]=_[_0xc793('0x3c')](_0x1d2fae['model'],qs['fields'](_0x22823c['query'][_0xc793('0x3d')]));_0x5e1e7d['attributes']=_0x5e1e7d['attributes'][_0xc793('0x4f')]?_0x5e1e7d[_0xc793('0x3e')]:_0x1d2fae[_0xc793('0x38')];if(_0x22823c[_0xc793('0x39')]['includeAll']){_0x5e1e7d['include']=[{'all':!![]}];}_0x5e1e7d=_[_0xc793('0x50')]({},_0x5e1e7d,_0x22823c[_0xc793('0x47')]);return db[_0xc793('0x48')]['find'](_0x5e1e7d)[_0xc793('0x1c')](handleEntityNotFound(_0x1145bb,null))[_0xc793('0x1c')](respondWithResult(_0x1145bb,null))[_0xc793('0x26')](handleError(_0x1145bb,null));};exports[_0xc793('0x51')]=function(_0x509003,_0x2d088d,_0x50b92a){var _0x30dd11;return db[_0xc793('0x52')]['transaction'](function(_0x420dc2){return db[_0xc793('0x48')]['create'](_0x509003[_0xc793('0x53')],{'raw':!![]})[_0xc793('0x1c')](function(_0x4425e2){_0x30dd11=_0x4425e2;return db[_0xc793('0x48')][_0xc793('0x4c')]({'where':{'type':_0x509003[_0xc793('0x53')][_0xc793('0x54')]},'raw':!![]});})[_0xc793('0x1c')](function(_0x31bb75){if(_0x30dd11[_0xc793('0x54')]['toUpperCase']()=='STUN'){var _0x597851=fs[_0xc793('0x55')](path['join'](config[_0xc793('0x56')],_0xc793('0x57')),_0xc793('0x58'));var _0x38e6f8=ejs[_0xc793('0x59')](_0x597851,{'networks':_0x31bb75||[]});fs[_0xc793('0x5a')](_0xc793('0x5b'),_0x38e6f8);return respondWithRpcPromise(_0xc793('0x5c'),'create',{'module':_0xc793('0x5d')});}else if(_0x30dd11[_0xc793('0x54')][_0xc793('0x5e')]()==_0xc793('0x5f')){var _0x1a6481=fs[_0xc793('0x55')](path[_0xc793('0x60')](config[_0xc793('0x56')],_0xc793('0x61')),'utf8');var _0x12765b=ejs[_0xc793('0x59')](_0x1a6481,{'networks':_0x31bb75||[]});fs[_0xc793('0x5a')](_0xc793('0x62'),_0x12765b);return respondWithRpcPromise(_0xc793('0x5c'),_0xc793('0x51'),{'module':'res_stun_monitor.so'});}else{var _0x4c2ef0=fs[_0xc793('0x55')](path[_0xc793('0x60')](config['root'],'server/files/templates/network.ejs'),_0xc793('0x58'));var _0x32e19a=ejs['render'](_0x4c2ef0,{'networks':_0x31bb75||[]});fs['writeFileSync'](util[_0xc793('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x509003[_0xc793('0x53')][_0xc793('0x54')]['toLowerCase']()),_0x32e19a);return respondWithRpcPromise(_0xc793('0x5c'),_0xc793('0x51'),{'module':'chan_sip.so'});}return null;})[_0xc793('0x1c')](function(){return _0x30dd11;});})[_0xc793('0x1c')](respondWithResult(_0x2d088d,0xc9))['catch'](handleError(_0x2d088d,null));};exports['update']=function(_0x2d75db,_0x9c5909,_0x4bbaa3){var _0x166c94;return db[_0xc793('0x52')][_0xc793('0x64')](function(_0x2afb9c){return db[_0xc793('0x48')][_0xc793('0x65')]({'where':{'id':_0x2d75db[_0xc793('0x66')]['id']}})[_0xc793('0x1c')](handleEntityNotFound(_0x9c5909,null))[_0xc793('0x1c')](saveUpdates(_0x2d75db[_0xc793('0x53')],null))[_0xc793('0x1c')](function(_0x145c44){if(_0x145c44){_0x166c94=_0x145c44;return db[_0xc793('0x48')][_0xc793('0x4c')]({'where':{'type':_0x166c94[_0xc793('0x54')]},'raw':!![]});}return null;})[_0xc793('0x1c')](function(_0x4b8014){if(_0x166c94[_0xc793('0x54')]['toUpperCase']()==_0xc793('0x67')){var _0x12656b=fs[_0xc793('0x55')](path['join'](config['root'],_0xc793('0x57')),_0xc793('0x58'));var _0xcdb9f=ejs['render'](_0x12656b,{'networks':_0x4b8014||[]});fs[_0xc793('0x5a')](_0xc793('0x5b'),_0xcdb9f);return respondWithRpcPromise(_0xc793('0x5c'),'update',{'module':_0xc793('0x5d')});}else if(_0x166c94['type'][_0xc793('0x5e')]()=='TURN'){var _0x510dad=fs[_0xc793('0x55')](path[_0xc793('0x60')](config[_0xc793('0x56')],_0xc793('0x61')),'utf8');var _0x31d37d=ejs[_0xc793('0x59')](_0x510dad,{'networks':_0x4b8014||[]});fs['writeFileSync'](_0xc793('0x62'),_0x31d37d);return respondWithRpcPromise(_0xc793('0x5c'),'update',{'module':_0xc793('0x5d')});}else{var _0x5a9087=fs['readFileSync'](path[_0xc793('0x60')](config[_0xc793('0x56')],_0xc793('0x68')),'utf8');var _0x3909c5=ejs['render'](_0x5a9087,{'networks':_0x4b8014||[]});fs[_0xc793('0x5a')](util['format'](_0xc793('0x69'),_0x2d75db[_0xc793('0x53')][_0xc793('0x54')][_0xc793('0x6a')]()),_0x3909c5);return respondWithRpcPromise(_0xc793('0x5c'),_0xc793('0x31'),{'module':_0xc793('0x6b')});}return null;})['then'](function(_0x42643b){if(_0x42643b){return _0x166c94;}return null;});})['then'](respondWithResult(_0x9c5909,null))[_0xc793('0x26')](handleError(_0x9c5909,null));};exports[_0xc793('0x6c')]=function(_0x320032,_0x59c2a7,_0x35112c){var _0x4b9b6d;return db[_0xc793('0x48')][_0xc793('0x65')]({'where':{'id':_0x320032[_0xc793('0x66')]['id']}})['then'](function(_0x3f7a52){_0x4b9b6d=_0x3f7a52;return _0x3f7a52;})[_0xc793('0x1c')](handleEntityNotFound(_0x59c2a7,null))[_0xc793('0x1c')](removeEntity(_0x59c2a7,null))[_0xc793('0x1c')](function(){if(_0x4b9b6d){return db['Network'][_0xc793('0x4c')]({'where':{'type':_0x4b9b6d[_0xc793('0x54')]},'raw':!![]});}})[_0xc793('0x1c')](function(_0x24fe49){if(_0x4b9b6d[_0xc793('0x54')][_0xc793('0x5e')]()==_0xc793('0x67')){var _0x1e5071=fs[_0xc793('0x55')](path[_0xc793('0x60')](config[_0xc793('0x56')],_0xc793('0x57')),_0xc793('0x58'));var _0x501e69=ejs[_0xc793('0x59')](_0x1e5071,{'networks':_0x24fe49||[]});fs['writeFileSync'](_0xc793('0x5b'),_0x501e69);return respondWithRpcPromise(_0xc793('0x5c'),'destroy',{'module':_0xc793('0x5d')});}else if(_0x4b9b6d[_0xc793('0x54')][_0xc793('0x5e')]()=='TURN'){var _0x43c0ce=fs['readFileSync'](path[_0xc793('0x60')](config[_0xc793('0x56')],_0xc793('0x61')),_0xc793('0x58'));var _0x294f88=ejs[_0xc793('0x59')](_0x43c0ce,{'networks':_0x24fe49||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x294f88);return respondWithRpcPromise(_0xc793('0x5c'),_0xc793('0x6c'),{'module':_0xc793('0x5d')});}else{var _0x2b3f57=fs[_0xc793('0x55')](path['join'](config[_0xc793('0x56')],_0xc793('0x68')),_0xc793('0x58'));var _0x4d197d=ejs[_0xc793('0x59')](_0x2b3f57,{'networks':_0x24fe49||[]});fs[_0xc793('0x5a')](util[_0xc793('0x63')](_0xc793('0x69'),_0x320032[_0xc793('0x53')][_0xc793('0x54')]['toLowerCase']()),_0x4d197d);return respondWithRpcPromise('Reload',_0xc793('0x6c'),{'module':_0xc793('0x6b')});}return null;})['catch'](handleError(_0x59c2a7,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fc59296..15b3070 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 _0xadb8=['Network','network','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define'];(function(_0x432432,_0x394b12){var _0x46cec6=function(_0x40d4e4){while(--_0x40d4e4){_0x432432['push'](_0x432432['shift']());}};_0x46cec6(++_0x394b12);}(_0xadb8,0x1d0));var _0x8adb=function(_0x27ccb6,_0x103913){_0x27ccb6=_0x27ccb6-0x0;var _0x412043=_0xadb8[_0x27ccb6];return _0x412043;};'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':!![]});}; \ No newline at end of file +var _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util'];(function(_0x3f63c1,_0x378093){var _0x141860=function(_0x206a21){while(--_0x206a21){_0x3f63c1['push'](_0x3f63c1['shift']());}};_0x141860(++_0x378093);}(_0xa8a8,0xec));var _0x8a8a=function(_0x51b571,_0x2ea702){_0x51b571=_0x51b571-0x0;var _0xdfcf79=_0xa8a8[_0x51b571];return _0xdfcf79;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('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 94b827b..229a752 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 _0x6f1a=['lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xb34fc1,_0x2a76f9){var _0x1e2ac6=function(_0x3fad88){while(--_0x3fad88){_0xb34fc1['push'](_0xb34fc1['shift']());}};_0x1e2ac6(++_0x2a76f9);}(_0x6f1a,0xc6));var _0xa6f1=function(_0x2766cc,_0x246297){_0x2766cc=_0x2766cc-0x0;var _0x3dd08f=_0x6f1a[_0x2766cc];return _0x3dd08f;};'use strict';var _=require(_0xa6f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa6f1('0x1'));var rs=require(_0xa6f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f1('0x4'))(_0xa6f1('0x5'));var config=require(_0xa6f1('0x6'));var jayson=require(_0xa6f1('0x7'));var client=jayson[_0xa6f1('0x8')][_0xa6f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e41aa,_0x4c8d03,_0x3324e){return new BPromise(function(_0x18335d,_0x3c991b){return client['request'](_0x4e41aa,_0x3324e)[_0xa6f1('0xa')](function(_0x1e3c71){logger['info'](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));logger[_0xa6f1('0xd')](_0xa6f1('0xe'),_0x4c8d03,'request\x20sent',JSON[_0xa6f1('0xf')](_0x1e3c71));if(_0x1e3c71[_0xa6f1('0x10')]){if(_0x1e3c71['error'][_0xa6f1('0x11')]===0x1f4){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x3c991b(_0x1e3c71[_0xa6f1('0x10')]['message']);}logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x1e3c71['error'][_0xa6f1('0x12')]);return _0x18335d(_0x1e3c71[_0xa6f1('0x10')][_0xa6f1('0x12')]);}else{logger[_0xa6f1('0x13')](_0xa6f1('0xb'),_0x4c8d03,_0xa6f1('0xc'));_0x18335d(_0x1e3c71[_0xa6f1('0x14')][_0xa6f1('0x12')]);}})[_0xa6f1('0x15')](function(_0x3ce417){logger[_0xa6f1('0x10')](_0xa6f1('0xb'),_0x4c8d03,_0x3ce417);_0x3c991b(_0x3ce417);});});} \ No newline at end of file +var _0x86d5=['request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug'];(function(_0x4ef402,_0x58c632){var _0x44b661=function(_0x70dfe3){while(--_0x70dfe3){_0x4ef402['push'](_0x4ef402['shift']());}};_0x44b661(++_0x58c632);}(_0x86d5,0x1a7));var _0x586d=function(_0x4548eb,_0x1107ed){_0x4548eb=_0x4548eb-0x0;var _0x55ea79=_0x86d5[_0x4548eb];return _0x55ea79;};'use strict';var _=require(_0x586d('0x0'));var util=require(_0x586d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x586d('0x2'));var fs=require('fs');var Redis=require(_0x586d('0x3'));var db=require(_0x586d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x586d('0x5'))('rpc');var config=require(_0x586d('0x6'));var jayson=require(_0x586d('0x7'));var client=jayson[_0x586d('0x8')][_0x586d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf97312,_0x6cfd30,_0x4c8168){return new BPromise(function(_0x168acf,_0x10cd7d){return client[_0x586d('0xa')](_0xf97312,_0x4c8168)['then'](function(_0x2f31b7){logger[_0x586d('0xb')](_0x586d('0xc'),_0x6cfd30,'request\x20sent');logger[_0x586d('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x6cfd30,_0x586d('0xe'),JSON['stringify'](_0x2f31b7));if(_0x2f31b7[_0x586d('0xf')]){if(_0x2f31b7[_0x586d('0xf')][_0x586d('0x10')]===0x1f4){logger[_0x586d('0xf')](_0x586d('0xc'),_0x6cfd30,_0x2f31b7['error'][_0x586d('0x11')]);return _0x10cd7d(_0x2f31b7[_0x586d('0xf')]['message']);}logger[_0x586d('0xf')](_0x586d('0xc'),_0x6cfd30,_0x2f31b7[_0x586d('0xf')][_0x586d('0x11')]);return _0x168acf(_0x2f31b7[_0x586d('0xf')][_0x586d('0x11')]);}else{logger[_0x586d('0xb')](_0x586d('0xc'),_0x6cfd30,'request\x20sent');_0x168acf(_0x2f31b7[_0x586d('0x12')][_0x586d('0x11')]);}})['catch'](function(_0x1dc59d){logger[_0x586d('0xf')](_0x586d('0xc'),_0x6cfd30,_0x1dc59d);_0x10cd7d(_0x1dc59d);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index cc3a4d7..aa08acc 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 _0x90db=['sendNotification','exports','path','connect-timeout','express','Router','./notification.controller','isAuthenticated'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x90db,0x132));var _0xb90d=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x90db[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb90d('0x0'));var timeout=require(_0xb90d('0x1'));var express=require(_0xb90d('0x2'));var router=express[_0xb90d('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb90d('0x4'));router['post']('/',auth[_0xb90d('0x5')](),controller[_0xb90d('0x6')]);module[_0xb90d('0x7')]=router; \ No newline at end of file +var _0x925a=['isAuthenticated','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./notification.controller'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x925a,0x181));var _0xa925=function(_0x1fee8f,_0x4691fc){_0x1fee8f=_0x1fee8f-0x0;var _0x59787f=_0x925a[_0x1fee8f];return _0x59787f;};'use strict';var multer=require('multer');var util=require(_0xa925('0x0'));var path=require(_0xa925('0x1'));var timeout=require(_0xa925('0x2'));var express=require('express');var router=express[_0xa925('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa925('0x4'));var config=require(_0xa925('0x5'));var controller=require(_0xa925('0x6'));router['post']('/',auth[_0xa925('0x7')](),controller['sendNotification']);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 157c309..8dae0e6 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 _0x90d9=['BOOLEAN','sequelize','exports','STRING','TEXT'];(function(_0x4ac373,_0xe08d9d){var _0x5e5152=function(_0x505d55){while(--_0x505d55){_0x4ac373['push'](_0x4ac373['shift']());}};_0x5e5152(++_0xe08d9d);}(_0x90d9,0x74));var _0x990d=function(_0x4dd412,_0x28bc36){_0x4dd412=_0x4dd412-0x0;var _0x451f36=_0x90d9[_0x4dd412];return _0x451f36;};'use strict';var Sequelize=require(_0x990d('0x0'));module[_0x990d('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x990d('0x2')]},'recipientsId':{'type':Sequelize[_0x990d('0x3')]},'recipientsDescription':{'type':Sequelize[_0x990d('0x2')]},'beep':{'type':Sequelize[_0x990d('0x4')]}}; \ No newline at end of file +var _0xf126=['TEXT','STRING','sequelize'];(function(_0x592ab7,_0x49076a){var _0x1504a7=function(_0x3f03b2){while(--_0x3f03b2){_0x592ab7['push'](_0x592ab7['shift']());}};_0x1504a7(++_0x49076a);}(_0xf126,0x16a));var _0x6f12=function(_0x4291dd,_0x95d82){_0x4291dd=_0x4291dd-0x0;var _0x152462=_0xf126[_0x4291dd];return _0x152462;};'use strict';var Sequelize=require(_0x6f12('0x0'));module['exports']={'body':{'type':Sequelize[_0x6f12('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x6f12('0x1')]},'recipientsDescription':{'type':Sequelize[_0x6f12('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 9bb7920..7b814ca 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 _0xde6a=['queue','replace','Queue','push','all','flatten','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit','notification:send','catch','Template','findOne','html','render','startCase','User','union','ids'];(function(_0xbd980f,_0x305292){var _0x17e7c9=function(_0x38e7d1){while(--_0x38e7d1){_0xbd980f['push'](_0xbd980f['shift']());}};_0x17e7c9(++_0x305292);}(_0xde6a,0x127));var _0xade6=function(_0x48770d,_0x2234a3){_0x48770d=_0x48770d-0x0;var _0xc6b269=_0xde6a[_0x48770d];return _0xc6b269;};'use strict';var pdf=require(_0xade6('0x0'));var emlformat=require(_0xade6('0x1'));var rimraf=require(_0xade6('0x2'));var zipdir=require(_0xade6('0x3'));var jsonpatch=require(_0xade6('0x4'));var rp=require(_0xade6('0x5'));var moment=require(_0xade6('0x6'));var BPromise=require(_0xade6('0x7'));var Mustache=require(_0xade6('0x8'));var util=require('util');var path=require(_0xade6('0x9'));var sox=require(_0xade6('0xa'));var csv=require(_0xade6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xade6('0xc'));var squel=require('squel');var crypto=require(_0xade6('0xd'));var jsforce=require(_0xade6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xade6('0xb'));var querystring=require(_0xade6('0xf'));var Papa=require(_0xade6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xade6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xade6('0x12'));var logger=require(_0xade6('0x13'))(_0xade6('0x14'));var utils=require(_0xade6('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xade6('0x16')]=_[_0xade6('0x17')](config[_0xade6('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xade6('0x18'))(new Redis(config['redis']));require(_0xade6('0x19'))[_0xade6('0x1a')](socket);function respondWithStatusCode(_0x1308e3,_0x435678){_0x435678=_0x435678||0xcc;return function(_0x37128b){if(_0x37128b){return _0x1308e3[_0xade6('0x1b')](_0x435678);}return _0x1308e3[_0xade6('0x1c')](_0x435678)[_0xade6('0x1d')]();};}function respondWithResult(_0x32e1a7,_0x6af212){_0x6af212=_0x6af212||0xc8;return function(_0x5dc6e8){if(_0x5dc6e8){return _0x32e1a7[_0xade6('0x1c')](_0x6af212)[_0xade6('0x1e')](_0x5dc6e8);}};}function respondWithFilteredResult(_0x308e7d,_0x56de95){return function(_0x36b570){if(_0x36b570){var _0x51a4f9=_0x36b570['count'],_0x265c6c=_0x56de95[_0xade6('0x1f')],_0x36e9b5=_0x56de95[_0xade6('0x1f')]+_0x56de95['limit'],_0x679e30;if(_0x36e9b5>=_0x51a4f9){_0x36e9b5=_0x51a4f9;_0x679e30=0xc8;}else{_0x679e30=0xce;}_0x308e7d[_0xade6('0x1c')](_0x679e30);return _0x308e7d[_0xade6('0x20')](_0xade6('0x21'),_0x265c6c+'-'+_0x36e9b5+'/'+_0x51a4f9)[_0xade6('0x1e')](_0x36b570);}return null;};}function patchUpdates(_0x38ede0){return function(_0x417e23){try{jsonpatch[_0xade6('0x22')](_0x417e23,_0x38ede0,!![]);}catch(_0x1d62ad){return BPromise['reject'](_0x1d62ad);}return _0x417e23[_0xade6('0x23')]();};}function saveUpdates(_0x1991e8,_0x480cf2){return function(_0x691f41){if(_0x691f41){return _0x691f41['update'](_0x1991e8)[_0xade6('0x24')](function(_0x35f7bd){return _0x35f7bd;});}return null;};}function removeEntity(_0x1e8885,_0x46b8aa){return function(_0x97fd78){if(_0x97fd78){return _0x97fd78[_0xade6('0x25')]()[_0xade6('0x24')](function(){_0x1e8885['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x365ae7,_0x2f2562){return function(_0x3a8ca5){if(!_0x3a8ca5){_0x365ae7[_0xade6('0x1b')](0x194);}return _0x3a8ca5;};}function handleError(_0x542060,_0x448783){_0x448783=_0x448783||0x1f4;return function(_0x4fd5a9){logger[_0xade6('0x26')](_0x4fd5a9[_0xade6('0x27')]);if(_0x4fd5a9[_0xade6('0x28')]){delete _0x4fd5a9['name'];}_0x542060[_0xade6('0x1c')](_0x448783)[_0xade6('0x29')](_0x4fd5a9);};}exports[_0xade6('0x2a')]=function(_0x20523c,_0x4bcd08,_0x5d0553){if(!_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x2c'))&&!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')](_0xade6('0x2e'))){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x2e'))&&!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')](_0xade6('0x31'))){throw new db[(_0xade6('0x2f'))]['ValidationError'](_0xade6('0x32'));}if(!_0x20523c[_0xade6('0x2d')][_0xade6('0x2b')]('recipients')){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x17f7aa=JSON[_0xade6('0x33')](_0x20523c['body'][_0xade6('0x34')]);}catch(_0x2000f8){logger['error'](_0x2000f8);throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))](_0xade6('0x35'));}var _0x4bd336=[_0xade6('0x36'),_0xade6('0x37'),_0xade6('0x38'),_0xade6('0x39'),_0xade6('0x3a'),_0xade6('0x3b'),_0xade6('0x3c'),'team',_0xade6('0x3d')];if(_['some'](_0x17f7aa,function(_0x5f4532){return!_[_0xade6('0x3e')](_0x4bd336,_0x5f4532[_0xade6('0x3f')][_0xade6('0x40')]());})){throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))](_0xade6('0x41'));}}}var _0x5b5a21={};_0x5b5a21[_0xade6('0x42')]=_0x20523c['body'][_0xade6('0x2b')](_0xade6('0x42'))?_0x20523c[_0xade6('0x2d')]['senderName']:_0x20523c[_0xade6('0x3d')][_0xade6('0x43')];_0x5b5a21[_0xade6('0x44')]=_['isEmpty'](_0x20523c[_0xade6('0x2d')]['recipientsDescription'])?null:_0x20523c[_0xade6('0x2d')]['recipientsDescription'];_0x5b5a21[_0xade6('0x45')]=_0x20523c[_0xade6('0x2d')][_0xade6('0x45')]||![];_0x5b5a21[_0xade6('0x46')]=_0x20523c['user']['id'];return getContent(_0x20523c[_0xade6('0x2d')])['then'](function(_0x52a56b){_0x5b5a21[_0xade6('0x2d')]=_0x52a56b;return getRecipients(_0x17f7aa);})['then'](function(_0x4a84fe){_0x5b5a21[_0xade6('0x47')]=_[_0xade6('0x48')](_0x4a84fe)[_0xade6('0x49')](',');return db[_0xade6('0x4a')]['transaction'](function(_0x41e2bb){return db['Notification'][_0xade6('0x4b')](_0x5b5a21,{'raw':!![],'transaction':_0x41e2bb})[_0xade6('0x24')](function(_0x1998f0){var _0xbeb846={'sender':_0x5b5a21[_0xade6('0x42')],'description':_0x5b5a21[_0xade6('0x44')],'content':_0x5b5a21[_0xade6('0x2d')],'beep':_0x5b5a21['beep']};_0x4a84fe[_0xade6('0x4c')](function(_0xe26ecc){_0xbeb846[_0xade6('0x4d')]=_0xe26ecc;socket[_0xade6('0x4e')](_0xade6('0x4f'),_0xbeb846);});return _0x1998f0;});});})[_0xade6('0x24')](respondWithResult(_0x4bcd08,0xc9))[_0xade6('0x50')](handleError(_0x4bcd08,null));};function getContent(_0x1e6463){return new BPromise(function(_0x4aa959,_0x414482){if(_0x1e6463[_0xade6('0x2c')]){_0x4aa959(_0x1e6463[_0xade6('0x2c')]);return;}return db[_0xade6('0x51')][_0xade6('0x52')]({'attributes':[_0xade6('0x53')],'where':{'id':_0x1e6463[_0xade6('0x2e')]},'raw':!![]})[_0xade6('0x24')](function(_0x2f2c29){if(!_0x2f2c29)throw new db[(_0xade6('0x2f'))][(_0xade6('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x350b27=Mustache[_0xade6('0x54')](_0x2f2c29['html'],_0x1e6463['view']);_0x4aa959(_0x350b27);})['catch'](function(_0x369389){_0x414482(_0x369389);});});}function getRecipients(_0x5f21a0){return new BPromise(function(_0x332253,_0x5ce1da){var _0x1c2669=[];var _0x397db2=[];_0x5f21a0['forEach'](function(_0x3100ac){var _0x25f66c=_[_0xade6('0x55')](_0x3100ac[_0xade6('0x3f')][_0xade6('0x40')]());if(_0x25f66c===_0xade6('0x56')){_0x1c2669=_[_0xade6('0x57')](_0x1c2669,_0x3100ac[_0xade6('0x58')]);}else{if(_['includes'](_0x25f66c,_0xade6('0x59')))_0x25f66c=_0x25f66c[_0xade6('0x5a')](_0xade6('0x59'),_0xade6('0x5b'));_0x3100ac['ids']['forEach'](function(_0x756eab){_0x397db2[_0xade6('0x5c')](getAgents(_0x25f66c,_0x756eab));});}});return BPromise[_0xade6('0x5d')](_0x397db2)['then'](function(_0x40a2c){_0x1c2669=_['union'](_0x1c2669,_[_0xade6('0x5e')](_0x40a2c));_0x332253(_0x1c2669);})[_0xade6('0x50')](function(_0x111003){_0x5ce1da(_0x111003);});});}function getAgents(_0x5e6cd8,_0x2b975a){return new BPromise(function(_0x4dc76f,_0x88e5ae){return db[_0x5e6cd8]['findOne']({'where':{'id':_0x2b975a}})[_0xade6('0x24')](function(_0x29fd11){return _0x29fd11[_0xade6('0x5f')]({'attributes':['id'],'raw':!![]})[_0xade6('0x24')](function(_0x750855){var _0x44b1e0=_['map'](_0x750855,'id');_0x4dc76f(_0x44b1e0);});})[_0xade6('0x50')](function(_0x5c38c4){_0x88e5ae(_0x5c38c4);});});} \ No newline at end of file +var _0x2169=['getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','./notification.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','sendStatus','error','name','send','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','transaction','Notification','create','forEach','emit','notification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten'];(function(_0x35aafd,_0x23627f){var _0x429c9c=function(_0x20a4f5){while(--_0x20a4f5){_0x35aafd['push'](_0x35aafd['shift']());}};_0x429c9c(++_0x23627f);}(_0x2169,0x12d));var _0x9216=function(_0x35156b,_0x4f47e1){_0x35156b=_0x35156b-0x0;var _0x5e9bee=_0x2169[_0x35156b];return _0x5e9bee;};'use strict';var pdf=require(_0x9216('0x0'));var emlformat=require(_0x9216('0x1'));var rimraf=require(_0x9216('0x2'));var zipdir=require(_0x9216('0x3'));var jsonpatch=require(_0x9216('0x4'));var rp=require('request-promise');var moment=require(_0x9216('0x5'));var BPromise=require(_0x9216('0x6'));var Mustache=require(_0x9216('0x7'));var util=require(_0x9216('0x8'));var path=require(_0x9216('0x9'));var sox=require(_0x9216('0xa'));var csv=require(_0x9216('0xb'));var ejs=require(_0x9216('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9216('0xd'));var crypto=require(_0x9216('0xe'));var jsforce=require(_0x9216('0xf'));var deskjs=require(_0x9216('0x10'));var toCsv=require(_0x9216('0xb'));var querystring=require(_0x9216('0x11'));var Papa=require(_0x9216('0x12'));var Redis=require(_0x9216('0x13'));var authService=require(_0x9216('0x14'));var qs=require(_0x9216('0x15'));var as=require(_0x9216('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9216('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x9216('0x18'));var db=require('../../mysqldb')['db'];config[_0x9216('0x19')]=_[_0x9216('0x1a')](config['redis'],{'host':_0x9216('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9216('0x19')]));require(_0x9216('0x1c'))[_0x9216('0x1d')](socket);function respondWithStatusCode(_0x4d3231,_0x118236){_0x118236=_0x118236||0xcc;return function(_0x41463d){if(_0x41463d){return _0x4d3231['sendStatus'](_0x118236);}return _0x4d3231[_0x9216('0x1e')](_0x118236)['end']();};}function respondWithResult(_0x9327d1,_0x20f4b9){_0x20f4b9=_0x20f4b9||0xc8;return function(_0x1a8505){if(_0x1a8505){return _0x9327d1[_0x9216('0x1e')](_0x20f4b9)[_0x9216('0x1f')](_0x1a8505);}};}function respondWithFilteredResult(_0x33474c,_0x54d1c4){return function(_0x19e8fe){if(_0x19e8fe){var _0x1cf2cf=_0x19e8fe[_0x9216('0x20')],_0x1d2a06=_0x54d1c4[_0x9216('0x21')],_0x56c1ba=_0x54d1c4[_0x9216('0x21')]+_0x54d1c4[_0x9216('0x22')],_0x23675d;if(_0x56c1ba>=_0x1cf2cf){_0x56c1ba=_0x1cf2cf;_0x23675d=0xc8;}else{_0x23675d=0xce;}_0x33474c['status'](_0x23675d);return _0x33474c[_0x9216('0x23')](_0x9216('0x24'),_0x1d2a06+'-'+_0x56c1ba+'/'+_0x1cf2cf)[_0x9216('0x1f')](_0x19e8fe);}return null;};}function patchUpdates(_0x1cd27f){return function(_0x1d7fbf){try{jsonpatch[_0x9216('0x25')](_0x1d7fbf,_0x1cd27f,!![]);}catch(_0x308c26){return BPromise[_0x9216('0x26')](_0x308c26);}return _0x1d7fbf['save']();};}function saveUpdates(_0x115ab5,_0x4a2344){return function(_0x10b70d){if(_0x10b70d){return _0x10b70d['update'](_0x115ab5)[_0x9216('0x27')](function(_0x128fa2){return _0x128fa2;});}return null;};}function removeEntity(_0x302f5a,_0x208bec){return function(_0x3cc687){if(_0x3cc687){return _0x3cc687[_0x9216('0x28')]()[_0x9216('0x27')](function(){_0x302f5a[_0x9216('0x1e')](0xcc)[_0x9216('0x29')]();});}};}function handleEntityNotFound(_0x3c5f5a,_0x2b8ed7){return function(_0x2cc49d){if(!_0x2cc49d){_0x3c5f5a[_0x9216('0x2a')](0x194);}return _0x2cc49d;};}function handleError(_0x2ffe34,_0x5dc5b5){_0x5dc5b5=_0x5dc5b5||0x1f4;return function(_0x3a10c8){logger[_0x9216('0x2b')](_0x3a10c8['stack']);if(_0x3a10c8[_0x9216('0x2c')]){delete _0x3a10c8[_0x9216('0x2c')];}_0x2ffe34[_0x9216('0x1e')](_0x5dc5b5)[_0x9216('0x2d')](_0x3a10c8);};}exports['sendNotification']=function(_0x2b51be,_0x12e5d4,_0x271510){if(!_0x2b51be['body'][_0x9216('0x2e')](_0x9216('0x2f'))&&!_0x2b51be[_0x9216('0x30')][_0x9216('0x2e')](_0x9216('0x31'))){throw new db[(_0x9216('0x32'))][(_0x9216('0x33'))](_0x9216('0x34'));}else{if(_0x2b51be['body'][_0x9216('0x2e')](_0x9216('0x31'))&&!_0x2b51be[_0x9216('0x30')]['hasOwnProperty'](_0x9216('0x35'))){throw new db[(_0x9216('0x32'))]['ValidationError'](_0x9216('0x36'));}if(!_0x2b51be[_0x9216('0x30')][_0x9216('0x2e')](_0x9216('0x37'))){throw new db['Sequelize']['ValidationError'](_0x9216('0x38'));}else{try{var _0x6f7ca0=JSON[_0x9216('0x39')](_0x2b51be[_0x9216('0x30')][_0x9216('0x37')]);}catch(_0x2262d7){logger[_0x9216('0x2b')](_0x2262d7);throw new db[(_0x9216('0x32'))][(_0x9216('0x33'))](_0x9216('0x3a'));}var _0x59c7fc=[_0x9216('0x3b'),'faxqueue',_0x9216('0x3c'),_0x9216('0x3d'),_0x9216('0x3e'),'voicequeue',_0x9216('0x3f'),'team',_0x9216('0x40')];if(_[_0x9216('0x41')](_0x6f7ca0,function(_0x270471){return!_[_0x9216('0x42')](_0x59c7fc,_0x270471[_0x9216('0x43')]['toLowerCase']());})){throw new db[(_0x9216('0x32'))][(_0x9216('0x33'))](_0x9216('0x44'));}}}var _0x134cfd={};_0x134cfd[_0x9216('0x45')]=_0x2b51be[_0x9216('0x30')][_0x9216('0x2e')](_0x9216('0x45'))?_0x2b51be['body'][_0x9216('0x45')]:_0x2b51be[_0x9216('0x40')][_0x9216('0x46')];_0x134cfd[_0x9216('0x47')]=_[_0x9216('0x48')](_0x2b51be['body'][_0x9216('0x47')])?null:_0x2b51be[_0x9216('0x30')][_0x9216('0x47')];_0x134cfd[_0x9216('0x49')]=_0x2b51be[_0x9216('0x30')][_0x9216('0x49')]||![];_0x134cfd[_0x9216('0x4a')]=_0x2b51be[_0x9216('0x40')]['id'];return getContent(_0x2b51be[_0x9216('0x30')])[_0x9216('0x27')](function(_0x4374a0){_0x134cfd[_0x9216('0x30')]=_0x4374a0;return getRecipients(_0x6f7ca0);})[_0x9216('0x27')](function(_0x2fdbb3){_0x134cfd['recipientsId']=_[_0x9216('0x4b')](_0x2fdbb3)[_0x9216('0x4c')](',');return db['sequelize'][_0x9216('0x4d')](function(_0x48b3bc){return db[_0x9216('0x4e')][_0x9216('0x4f')](_0x134cfd,{'raw':!![],'transaction':_0x48b3bc})[_0x9216('0x27')](function(_0x1379db){var _0x41e105={'sender':_0x134cfd[_0x9216('0x45')],'description':_0x134cfd['recipientsDescription'],'content':_0x134cfd[_0x9216('0x30')],'beep':_0x134cfd['beep']};_0x2fdbb3[_0x9216('0x50')](function(_0x50e82e){_0x41e105['recipient']=_0x50e82e;socket[_0x9216('0x51')](_0x9216('0x52'),_0x41e105);});return _0x1379db;});});})[_0x9216('0x27')](respondWithResult(_0x12e5d4,0xc9))[_0x9216('0x53')](handleError(_0x12e5d4,null));};function getContent(_0x1db5ec){return new BPromise(function(_0x5cc3a8,_0x282060){if(_0x1db5ec[_0x9216('0x2f')]){_0x5cc3a8(_0x1db5ec[_0x9216('0x2f')]);return;}return db['Template'][_0x9216('0x54')]({'attributes':[_0x9216('0x55')],'where':{'id':_0x1db5ec[_0x9216('0x31')]},'raw':!![]})[_0x9216('0x27')](function(_0x8c9746){if(!_0x8c9746)throw new db[(_0x9216('0x32'))][(_0x9216('0x33'))](_0x9216('0x56'));var _0x11c44f=Mustache[_0x9216('0x57')](_0x8c9746[_0x9216('0x55')],_0x1db5ec[_0x9216('0x35')]);_0x5cc3a8(_0x11c44f);})['catch'](function(_0xf7af4b){_0x282060(_0xf7af4b);});});}function getRecipients(_0x31fbc6){return new BPromise(function(_0x153b74,_0x1c3a76){var _0x2e85d4=[];var _0x46c527=[];_0x31fbc6[_0x9216('0x50')](function(_0x485dad){var _0x38d2d7=_[_0x9216('0x58')](_0x485dad[_0x9216('0x43')][_0x9216('0x59')]());if(_0x38d2d7===_0x9216('0x5a')){_0x2e85d4=_[_0x9216('0x5b')](_0x2e85d4,_0x485dad[_0x9216('0x5c')]);}else{if(_['includes'](_0x38d2d7,_0x9216('0x5d')))_0x38d2d7=_0x38d2d7[_0x9216('0x5e')]('queue',_0x9216('0x5f'));_0x485dad[_0x9216('0x5c')][_0x9216('0x50')](function(_0x3518ba){_0x46c527[_0x9216('0x60')](getAgents(_0x38d2d7,_0x3518ba));});}});return BPromise[_0x9216('0x61')](_0x46c527)['then'](function(_0x116f7d){_0x2e85d4=_['union'](_0x2e85d4,_[_0x9216('0x62')](_0x116f7d));_0x153b74(_0x2e85d4);})[_0x9216('0x53')](function(_0x382f91){_0x1c3a76(_0x382f91);});});}function getAgents(_0x9fdec3,_0x311a18){return new BPromise(function(_0x4a81cc,_0x3516ba){return db[_0x9fdec3][_0x9216('0x54')]({'where':{'id':_0x311a18}})[_0x9216('0x27')](function(_0x3878f8){return _0x3878f8[_0x9216('0x63')]({'attributes':['id'],'raw':!![]})['then'](function(_0x46bec5){var _0x31c21d=_['map'](_0x46bec5,'id');_0x4a81cc(_0x31c21d);});})['catch'](function(_0x63c469){_0x3516ba(_0x63c469);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 11c02c7..c03443d 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(_0x22fd93,_0x584fe2){var _0x4c311b=function(_0x5b27bd){while(--_0x5b27bd){_0x22fd93['push'](_0x22fd93['shift']());}};_0x4c311b(++_0x584fe2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2978e9,_0x2401ea){_0x2978e9=_0x2978e9-0x0;var _0xfe679f=_0x5f2f[_0x2978e9];return _0xfe679f;};'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 _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x2032,0xd9));var _0x2203=function(_0x1fc9db,_0x516372){_0x1fc9db=_0x1fc9db-0x0;var _0x5af8f7=_0x2032[_0x1fc9db];return _0x5af8f7;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 890b36e..8d4097f 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 _0xd8b0=['define','notifications','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25d394,_0x3a7f03){var _0x1b9579=function(_0x8eea66){while(--_0x8eea66){_0x25d394['push'](_0x25d394['shift']());}};_0x1b9579(++_0x3a7f03);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./notification.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('Notification',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xefda=['../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf'];(function(_0xf1bdc6,_0x1abe47){var _0x53d884=function(_0x26f815){while(--_0x26f815){_0xf1bdc6['push'](_0xf1bdc6['shift']());}};_0x53d884(++_0x1abe47);}(_0xefda,0x96));var _0xaefd=function(_0x3c8a4b,_0x23fc4f){_0x3c8a4b=_0x3c8a4b-0x0;var _0x143e30=_0xefda[_0x3c8a4b];return _0x143e30;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaefd('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 0c99739..b402c46 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 _0x90c2=['code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./notification.socket','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcb42ca,_0x124bc3){var _0x4b6086=function(_0x40d3fe){while(--_0x40d3fe){_0xcb42ca['push'](_0xcb42ca['shift']());}};_0x4b6086(++_0x124bc3);}(_0x90c2,0x8d));var _0x290c=function(_0x155071,_0x36fd05){_0x155071=_0x155071-0x0;var _0x56832c=_0x90c2[_0x155071];return _0x56832c;};'use strict';var _=require(_0x290c('0x0'));var util=require(_0x290c('0x1'));var moment=require('moment');var BPromise=require(_0x290c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290c('0x3'))['db'];var utils=require(_0x290c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x290c('0x5'));var jayson=require(_0x290c('0x6'));var client=jayson[_0x290c('0x7')][_0x290c('0x8')]({'port':0x232a});config['redis']=_[_0x290c('0x9')](config[_0x290c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x290c('0xb'))(new Redis(config[_0x290c('0xa')]));require(_0x290c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1a148c,_0x3a9aa4,_0x51284d){return new BPromise(function(_0x2cc193,_0x24acc6){return client['request'](_0x1a148c,_0x51284d)[_0x290c('0xd')](function(_0x15f5d3){logger[_0x290c('0xe')](_0x290c('0xf'),_0x3a9aa4,_0x290c('0x10'));logger['debug'](_0x290c('0x11'),_0x3a9aa4,_0x290c('0x10'),JSON[_0x290c('0x12')](_0x15f5d3));if(_0x15f5d3[_0x290c('0x13')]){if(_0x15f5d3[_0x290c('0x13')][_0x290c('0x14')]===0x1f4){logger[_0x290c('0x13')]('Notification,\x20%s,\x20%s',_0x3a9aa4,_0x15f5d3[_0x290c('0x13')][_0x290c('0x15')]);return _0x24acc6(_0x15f5d3[_0x290c('0x13')][_0x290c('0x15')]);}logger[_0x290c('0x13')](_0x290c('0xf'),_0x3a9aa4,_0x15f5d3[_0x290c('0x13')]['message']);return _0x2cc193(_0x15f5d3['error'][_0x290c('0x15')]);}else{logger[_0x290c('0xe')](_0x290c('0xf'),_0x3a9aa4,_0x290c('0x10'));_0x2cc193(_0x15f5d3[_0x290c('0x16')][_0x290c('0x15')]);}})['catch'](function(_0x96425d){logger[_0x290c('0x13')](_0x290c('0xf'),_0x3a9aa4,_0x96425d);_0x24acc6(_0x96425d);});});} \ No newline at end of file +var _0xb4e2=['then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./notification.socket','register','request'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0xb4e2,0x1f0));var _0x2b4e=function(_0x21de48,_0x541c28){_0x21de48=_0x21de48-0x0;var _0x4a6bfa=_0xb4e2[_0x21de48];return _0x4a6bfa;};'use strict';var _=require('lodash');var util=require(_0x2b4e('0x0'));var moment=require(_0x2b4e('0x1'));var BPromise=require(_0x2b4e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b4e('0x3'));var db=require(_0x2b4e('0x4'))['db'];var utils=require(_0x2b4e('0x5'));var logger=require(_0x2b4e('0x6'))(_0x2b4e('0x7'));var config=require(_0x2b4e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2b4e('0x9')][_0x2b4e('0xa')]({'port':0x232a});config[_0x2b4e('0xb')]=_[_0x2b4e('0xc')](config[_0x2b4e('0xb')],{'host':_0x2b4e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b4e('0xb')]));require(_0x2b4e('0xe'))[_0x2b4e('0xf')](socket);function respondWithRpcPromise(_0x438511,_0x4f2b7a,_0x11ca40){return new BPromise(function(_0x360265,_0x340ab2){return client[_0x2b4e('0x10')](_0x438511,_0x11ca40)[_0x2b4e('0x11')](function(_0x2b0711){logger[_0x2b4e('0x12')](_0x2b4e('0x13'),_0x4f2b7a,_0x2b4e('0x14'));logger[_0x2b4e('0x15')](_0x2b4e('0x16'),_0x4f2b7a,'request\x20sent',JSON['stringify'](_0x2b0711));if(_0x2b0711[_0x2b4e('0x17')]){if(_0x2b0711[_0x2b4e('0x17')][_0x2b4e('0x18')]===0x1f4){logger[_0x2b4e('0x17')]('Notification,\x20%s,\x20%s',_0x4f2b7a,_0x2b0711[_0x2b4e('0x17')][_0x2b4e('0x19')]);return _0x340ab2(_0x2b0711[_0x2b4e('0x17')][_0x2b4e('0x19')]);}logger[_0x2b4e('0x17')](_0x2b4e('0x13'),_0x4f2b7a,_0x2b0711[_0x2b4e('0x17')]['message']);return _0x360265(_0x2b0711[_0x2b4e('0x17')][_0x2b4e('0x19')]);}else{logger[_0x2b4e('0x12')](_0x2b4e('0x13'),_0x4f2b7a,_0x2b4e('0x14'));_0x360265(_0x2b0711[_0x2b4e('0x1a')][_0x2b4e('0x19')]);}})['catch'](function(_0x135a3a){logger[_0x2b4e('0x17')](_0x2b4e('0x13'),_0x4f2b7a,_0x135a3a);_0x340ab2(_0x135a3a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 6bc242a..00cd417 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 _0x241a=['notification:','save','remove','update','emit','register'];(function(_0x56f52e,_0xdd6786){var _0x2b67ac=function(_0x44c7f4){while(--_0x44c7f4){_0x56f52e['push'](_0x56f52e['shift']());}};_0x2b67ac(++_0xdd6786);}(_0x241a,0x133));var _0xa241=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x241a[_0x1c8c28];return _0x1f59b4;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xa241('0x0'),_0xa241('0x1'),_0xa241('0x2')];function createListener(_0x54f459,_0x2242c1){return function(_0x484f9a){_0x2242c1[_0xa241('0x3')](_0x54f459,_0x484f9a);};}function removeListener(_0xeeefb,_0x117c55){return function(){NotificationEvents['removeListener'](_0xeeefb,_0x117c55);};}exports[_0xa241('0x4')]=function(_0xdfd916){for(var _0x43f182=0x0,_0x24d40a=events['length'];_0x43f182<_0x24d40a;_0x43f182++){var _0x2caea2=events[_0x43f182];var _0x202978=createListener(_0xa241('0x5')+_0x2caea2,_0xdfd916);NotificationEvents['on'](_0x2caea2,_0x202978);}}; \ No newline at end of file +var _0xb9fb=['update','emit','removeListener','register','length','./notification.events','save','remove'];(function(_0x2a2d1c,_0x440c2b){var _0x5832cf=function(_0x222975){while(--_0x222975){_0x2a2d1c['push'](_0x2a2d1c['shift']());}};_0x5832cf(++_0x440c2b);}(_0xb9fb,0x115));var _0xbb9f=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb9fb[_0xf50820];return _0x2a9b10;};'use strict';var NotificationEvents=require(_0xbb9f('0x0'));var events=[_0xbb9f('0x1'),_0xbb9f('0x2'),_0xbb9f('0x3')];function createListener(_0x55c6c6,_0x1f2daa){return function(_0x3c060b){_0x1f2daa[_0xbb9f('0x4')](_0x55c6c6,_0x3c060b);};}function removeListener(_0x390463,_0x36f810){return function(){NotificationEvents[_0xbb9f('0x5')](_0x390463,_0x36f810);};}exports[_0xbb9f('0x6')]=function(_0x45c1db){for(var _0x51d451=0x0,_0x48535d=events[_0xbb9f('0x7')];_0x51d451<_0x48535d;_0x51d451++){var _0x9066f9=events[_0x51d451];var _0x1096b0=createListener('notification:'+_0x9066f9,_0x45c1db);NotificationEvents['on'](_0x9066f9,_0x1096b0);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index db09f4f..daa7e35 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 _0x45f4=['exports','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents'];(function(_0x285db,_0x4f4926){var _0x2ebec6=function(_0x3a08c3){while(--_0x3a08c3){_0x285db['push'](_0x285db['shift']());}};_0x2ebec6(++_0x4f4926);}(_0x45f4,0x109));var _0x445f=function(_0x5cde61,_0x5aab83){_0x5cde61=_0x5cde61-0x0;var _0x626d0=_0x45f4[_0x5cde61];return _0x626d0;};'use strict';var multer=require('multer');var util=require(_0x445f('0x0'));var path=require(_0x445f('0x1'));var timeout=require(_0x445f('0x2'));var express=require(_0x445f('0x3'));var router=express[_0x445f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x445f('0x5'));var controller=require('./openchannelAccount.controller');router[_0x445f('0x6')]('/',auth[_0x445f('0x7')](),controller[_0x445f('0x8')]);router[_0x445f('0x6')](_0x445f('0x9'),auth[_0x445f('0x7')](),controller[_0x445f('0xa')]);router[_0x445f('0x6')](_0x445f('0xb'),auth[_0x445f('0x7')](),controller[_0x445f('0xc')]);router['get'](_0x445f('0xd'),auth[_0x445f('0x7')](),controller[_0x445f('0xe')]);router[_0x445f('0x6')]('/:id/canned_answers',auth[_0x445f('0x7')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x445f('0x7')](),controller['getApplications']);router[_0x445f('0x6')](_0x445f('0xf'),auth[_0x445f('0x7')](),controller['getInteractions']);router[_0x445f('0x6')]('/:id/users',auth[_0x445f('0x7')](),controller[_0x445f('0x10')]);router[_0x445f('0x11')]('/',auth[_0x445f('0x7')](),controller[_0x445f('0x12')]);router[_0x445f('0x11')]('/:id/dispositions',auth[_0x445f('0x7')](),controller[_0x445f('0x13')]);router['post'](_0x445f('0x14'),auth[_0x445f('0x7')](),controller[_0x445f('0x15')]);router['post'](_0x445f('0x16'),controller['notify']);router[_0x445f('0x11')]('/:id/applications',auth[_0x445f('0x7')](),controller['addApplications']);router['post'](_0x445f('0x17'),auth['isAuthenticated'](),controller[_0x445f('0x18')]);router[_0x445f('0x11')]('/:id/send',auth[_0x445f('0x7')](),controller[_0x445f('0x19')]);router[_0x445f('0x1a')]('/:id',auth[_0x445f('0x7')](),controller['update']);router[_0x445f('0x1b')](_0x445f('0xb'),auth[_0x445f('0x7')](),controller[_0x445f('0x1c')]);router['delete'](_0x445f('0xd'),auth[_0x445f('0x7')](),controller[_0x445f('0x1d')]);router[_0x445f('0x1b')](_0x445f('0x14'),auth[_0x445f('0x7')](),controller[_0x445f('0x1e')]);router['delete']('/:id/users',auth[_0x445f('0x7')](),controller[_0x445f('0x1f')]);module[_0x445f('0x20')]=router; \ No newline at end of file +var _0x438f=['/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents'];(function(_0x240475,_0x341066){var _0x19cf3f=function(_0xce86e9){while(--_0xce86e9){_0x240475['push'](_0x240475['shift']());}};_0x19cf3f(++_0x341066);}(_0x438f,0x15e));var _0xf438=function(_0x5a79d8,_0x504a38){_0x5a79d8=_0x5a79d8-0x0;var _0x3edab8=_0x438f[_0x5a79d8];return _0x3edab8;};'use strict';var multer=require(_0xf438('0x0'));var util=require(_0xf438('0x1'));var path=require(_0xf438('0x2'));var timeout=require(_0xf438('0x3'));var express=require(_0xf438('0x4'));var router=express[_0xf438('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf438('0x6'));var config=require(_0xf438('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf438('0x8')]);router[_0xf438('0x9')](_0xf438('0xa'),auth[_0xf438('0xb')](),controller['describe']);router['get'](_0xf438('0xc'),auth[_0xf438('0xb')](),controller[_0xf438('0xd')]);router['get'](_0xf438('0xe'),auth[_0xf438('0xb')](),controller[_0xf438('0xf')]);router[_0xf438('0x9')](_0xf438('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xf438('0x11'),auth[_0xf438('0xb')](),controller[_0xf438('0x12')]);router['get'](_0xf438('0x13'),auth[_0xf438('0xb')](),controller[_0xf438('0x14')]);router[_0xf438('0x9')]('/:id/users',auth[_0xf438('0xb')](),controller[_0xf438('0x15')]);router[_0xf438('0x16')]('/',auth[_0xf438('0xb')](),controller['create']);router[_0xf438('0x16')](_0xf438('0xe'),auth[_0xf438('0xb')](),controller[_0xf438('0x17')]);router[_0xf438('0x16')]('/:id/canned_answers',auth[_0xf438('0xb')](),controller[_0xf438('0x18')]);router[_0xf438('0x16')](_0xf438('0x19'),controller[_0xf438('0x1a')]);router[_0xf438('0x16')](_0xf438('0x11'),auth[_0xf438('0xb')](),controller[_0xf438('0x1b')]);router[_0xf438('0x16')](_0xf438('0x1c'),auth[_0xf438('0xb')](),controller[_0xf438('0x1d')]);router['post'](_0xf438('0x1e'),auth[_0xf438('0xb')](),controller['send']);router[_0xf438('0x1f')]('/:id',auth[_0xf438('0xb')](),controller[_0xf438('0x20')]);router[_0xf438('0x21')](_0xf438('0xc'),auth[_0xf438('0xb')](),controller[_0xf438('0x22')]);router[_0xf438('0x21')](_0xf438('0xe'),auth[_0xf438('0xb')](),controller['removeDispositions']);router[_0xf438('0x21')](_0xf438('0x10'),auth[_0xf438('0xb')](),controller[_0xf438('0x23')]);router[_0xf438('0x21')](_0xf438('0x1c'),auth[_0xf438('0xb')](),controller[_0xf438('0x24')]);module[_0xf438('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 0465aff..1cb2aeb 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 _0x6481=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x5e2e5f,_0x28890b){var _0x5a7c4b=function(_0x21dad5){while(--_0x21dad5){_0x5e2e5f['push'](_0x5e2e5f['shift']());}};_0x5a7c4b(++_0x28890b);}(_0x6481,0xd3));var _0x1648=function(_0x92cc4d,_0x45cbb4){_0x92cc4d=_0x92cc4d-0x0;var _0x7557b0=_0x6481[_0x92cc4d];return _0x7557b0;};'use strict';var Sequelize=require(_0x1648('0x0'));var rs=require(_0x1648('0x1'));module[_0x1648('0x2')]={'name':{'type':Sequelize[_0x1648('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1648('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1648('0x4')]();}},'replyUri':{'type':Sequelize[_0x1648('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1648('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1648('0x5')],'defaultValue':function(){return _0x1648('0x6');}},'notificationSound':{'type':Sequelize[_0x1648('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1648('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1648('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1648('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1648('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43a6e8){if(!_0x43a6e8)this[_0x1648('0x9')](_0x1648('0xa'),null);this[_0x1648('0x9')](_0x1648('0xb'),_0x43a6e8);}}}; \ No newline at end of file +var _0x740e=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','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'];(function(_0x2b950c,_0x57cc37){var _0x592648=function(_0x20b1f6){while(--_0x20b1f6){_0x2b950c['push'](_0x2b950c['shift']());}};_0x592648(++_0x57cc37);}(_0x740e,0x1e3));var _0xe740=function(_0x83484b,_0x328cac){_0x83484b=_0x83484b-0x0;var _0x467e08=_0x740e[_0x83484b];return _0x467e08;};'use strict';var Sequelize=require(_0xe740('0x0'));var rs=require('randomstring');module[_0xe740('0x1')]={'name':{'type':Sequelize[_0xe740('0x2')],'unique':_0xe740('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe740('0x2')],'defaultValue':function(){return rs[_0xe740('0x4')]();}},'replyUri':{'type':Sequelize[_0xe740('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe740('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe740('0x5')],'defaultValue':function(){return _0xe740('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe740('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe740('0x2')]},'queueTransfer':{'type':Sequelize[_0xe740('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe740('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe740('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe740('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe740('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe740('0x7')],'defaultValue':![],'comment':_0xe740('0x9'),'set':function(_0x5d8bb2){if(!_0x5d8bb2)this[_0xe740('0xa')](_0xe740('0xb'),null);this[_0xe740('0xa')](_0xe740('0xc'),_0x5d8bb2);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 70a4fdf..2542ec2 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 _0x5d03=['omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','ValidationError','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','json','count','offset','limit','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','CmContact','Contacts','OpenchannelApplication','applications','Applications','list','asc','account','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','unmanaged','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents'];(function(_0x5a836f,_0x148be9){var _0x15effb=function(_0x265385){while(--_0x265385){_0x5a836f['push'](_0x5a836f['shift']());}};_0x15effb(++_0x148be9);}(_0x5d03,0x186));var _0x35d0=function(_0x348747,_0x399582){_0x348747=_0x348747-0x0;var _0xd5dd81=_0x5d03[_0x348747];return _0xd5dd81;};'use strict';var pdf=require(_0x35d0('0x0'));var emlformat=require(_0x35d0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35d0('0x3'));var moment=require(_0x35d0('0x4'));var BPromise=require(_0x35d0('0x5'));var Mustache=require(_0x35d0('0x6'));var util=require(_0x35d0('0x7'));var path=require(_0x35d0('0x8'));var sox=require(_0x35d0('0x9'));var csv=require(_0x35d0('0xa'));var ejs=require(_0x35d0('0xb'));var fs=require('fs');var _=require(_0x35d0('0xc'));var squel=require(_0x35d0('0xd'));var crypto=require(_0x35d0('0xe'));var jsforce=require(_0x35d0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x35d0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35d0('0x10'));var qs=require(_0x35d0('0x11'));var as=require(_0x35d0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35d0('0x13'))(_0x35d0('0x14'));var utils=require(_0x35d0('0x15'));var config=require('../../config/environment');var db=require(_0x35d0('0x16'))['db'];config[_0x35d0('0x17')]=_[_0x35d0('0x18')](config[_0x35d0('0x17')],{'host':_0x35d0('0x19'),'port':0x18eb});var socket=require(_0x35d0('0x1a'))(new Redis(config[_0x35d0('0x17')]));require(_0x35d0('0x1b'))[_0x35d0('0x1c')](socket);var jayson=require(_0x35d0('0x1d'));var client=jayson['client'][_0x35d0('0x1e')]({'port':0x232c});var client9002=jayson[_0x35d0('0x1f')][_0x35d0('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x40006a,_0x38a896,_0x1aa04a){if(_0x1aa04a){var _0x39d5e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39d5e1['test'](_0x38a896)){return _0x40006a;}else{throw new db['Sequelize'][(_0x35d0('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x40006a;}}function respondWithRpcPromise(_0x179f3f,_0x395c68,_0x5d0335,_0x56a339){return new BPromise(function(_0x5db3eb,_0x77ce3){var _0xde345=_0x56a339||client;return _0xde345[_0x35d0('0x21')](_0x179f3f,_0x5d0335)[_0x35d0('0x22')](function(_0x4180d0){logger['info'](_0x35d0('0x23'),_0x395c68,_0x35d0('0x24'));logger['debug'](_0x35d0('0x25'),_0x395c68,_0x35d0('0x24'),JSON[_0x35d0('0x26')](_0x4180d0));if(_0x4180d0[_0x35d0('0x27')]){if(_0x4180d0[_0x35d0('0x27')][_0x35d0('0x28')]===0x1f4){logger[_0x35d0('0x27')](_0x35d0('0x23'),_0x395c68,_0x4180d0['error']['message']);return _0x77ce3(_0x4180d0[_0x35d0('0x27')]['message']);}logger[_0x35d0('0x27')](_0x35d0('0x23'),_0x395c68,_0x4180d0['error'][_0x35d0('0x29')]);return _0x5db3eb(_0x4180d0[_0x35d0('0x27')][_0x35d0('0x29')]);}else{logger[_0x35d0('0x2a')](_0x35d0('0x23'),_0x395c68,_0x35d0('0x24'));_0x5db3eb(_0x4180d0[_0x35d0('0x2b')][_0x35d0('0x29')]);}})[_0x35d0('0x2c')](function(_0x91210b){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x395c68,_0x91210b);_0x77ce3(_0x91210b);});});}function respondWithStatusCode(_0x1e3fef,_0xdc6713){_0xdc6713=_0xdc6713||0xcc;return function(_0x4867c4){if(_0x4867c4){return _0x1e3fef['sendStatus'](_0xdc6713);}return _0x1e3fef[_0x35d0('0x2d')](_0xdc6713)['end']();};}function respondWithResult(_0x31ea7a,_0x32d5cb){_0x32d5cb=_0x32d5cb||0xc8;return function(_0x3afa14){if(_0x3afa14){return _0x31ea7a['status'](_0x32d5cb)[_0x35d0('0x2e')](_0x3afa14);}};}function respondWithFilteredResult(_0x4bf80a,_0x16620e){return function(_0x24c1d8){if(_0x24c1d8){var _0x5c8376=_0x24c1d8[_0x35d0('0x2f')],_0x1e534a=_0x16620e[_0x35d0('0x30')],_0x1322fb=_0x16620e[_0x35d0('0x30')]+_0x16620e[_0x35d0('0x31')],_0x44263b;if(_0x1322fb>=_0x5c8376){_0x1322fb=_0x5c8376;_0x44263b=0xc8;}else{_0x44263b=0xce;}_0x4bf80a[_0x35d0('0x2d')](_0x44263b);return _0x4bf80a[_0x35d0('0x32')]('Content-Range',_0x1e534a+'-'+_0x1322fb+'/'+_0x5c8376)[_0x35d0('0x2e')](_0x24c1d8);}return null;};}function patchUpdates(_0x472435){return function(_0xa488d4){try{jsonpatch[_0x35d0('0x33')](_0xa488d4,_0x472435,!![]);}catch(_0x522f24){return BPromise[_0x35d0('0x34')](_0x522f24);}return _0xa488d4[_0x35d0('0x35')]();};}function saveUpdates(_0x4d051b,_0x29741b){return function(_0x3ce5bf){if(_0x3ce5bf){return _0x3ce5bf[_0x35d0('0x36')](_0x4d051b)['then'](function(_0x1da007){return _0x1da007;});}return null;};}function removeEntity(_0x558824,_0x56c05c){return function(_0x441d78){if(_0x441d78){return _0x441d78[_0x35d0('0x37')]()[_0x35d0('0x22')](function(){var _0x4b8661=_0x441d78[_0x35d0('0x38')]({'plain':!![]});var _0x581f34=_0x35d0('0x39');return db[_0x35d0('0x3a')]['destroy']({'where':{'type':_0x581f34,'resourceId':_0x4b8661['id']}})[_0x35d0('0x22')](function(){return _0x441d78;});})[_0x35d0('0x22')](function(){_0x558824[_0x35d0('0x2d')](0xcc)[_0x35d0('0x3b')]();});}};}function handleEntityNotFound(_0x8b2ff1,_0x355a2a){return function(_0x49ba37){if(!_0x49ba37){_0x8b2ff1[_0x35d0('0x3c')](0x194);}return _0x49ba37;};}function handleError(_0x22bf59,_0x512c9b){_0x512c9b=_0x512c9b||0x1f4;return function(_0x2be70f){logger['error'](_0x2be70f[_0x35d0('0x3d')]);if(_0x2be70f[_0x35d0('0x3e')]){delete _0x2be70f[_0x35d0('0x3e')];}_0x22bf59[_0x35d0('0x2d')](_0x512c9b)['send'](_0x2be70f);};}exports[_0x35d0('0x3f')]=function(_0x336639,_0x2a261c){var _0x28397e={'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]},_0x51e5c2={},_0x5f13e9={'count':0x0,'rows':[]};var _0x530930=_[_0x35d0('0x42')](db[_0x35d0('0x43')][_0x35d0('0x44')],function(_0x38bb7b){return{'name':_0x38bb7b['fieldName'],'type':_0x38bb7b[_0x35d0('0x45')][_0x35d0('0x46')]};});_0x51e5c2[_0x35d0('0x47')]=_[_0x35d0('0x42')](_0x530930,_0x35d0('0x3e'));_0x51e5c2['query']=_[_0x35d0('0x48')](_0x336639[_0x35d0('0x49')]);_0x51e5c2[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x51e5c2[_0x35d0('0x47')],_0x51e5c2[_0x35d0('0x49')]);_0x28397e[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x51e5c2[_0x35d0('0x47')],qs['fields'](_0x336639[_0x35d0('0x49')]['fields']));_0x28397e['attributes']=_0x28397e['attributes'][_0x35d0('0x4d')]?_0x28397e[_0x35d0('0x4c')]:_0x51e5c2[_0x35d0('0x47')];if(!_0x336639[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x28397e[_0x35d0('0x31')]=qs['limit'](_0x336639['query'][_0x35d0('0x31')]);_0x28397e[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x336639[_0x35d0('0x49')][_0x35d0('0x30')]);}_0x28397e[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x336639[_0x35d0('0x49')][_0x35d0('0x51')]);_0x28397e[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x336639['query'],_0x51e5c2[_0x35d0('0x4a')]),_0x530930);if(_0x336639[_0x35d0('0x49')][_0x35d0('0x54')]){_0x28397e['where']=_['merge'](_0x28397e['where'],{'$or':_[_0x35d0('0x42')](_0x530930,function(_0x279652){if(_0x279652[_0x35d0('0x45')]!==_0x35d0('0x55')){var _0x1ff12d={};_0x1ff12d[_0x279652[_0x35d0('0x3e')]]={'$like':'%'+_0x336639[_0x35d0('0x49')]['filter']+'%'};return _0x1ff12d;}})});}_0x28397e=_[_0x35d0('0x56')]({},_0x28397e,_0x336639[_0x35d0('0x57')]);var _0x3db62e={'where':_0x28397e['where']};return db[_0x35d0('0x43')][_0x35d0('0x2f')](_0x3db62e)[_0x35d0('0x22')](function(_0x4beb58){_0x5f13e9[_0x35d0('0x2f')]=_0x4beb58;if(_0x336639[_0x35d0('0x49')][_0x35d0('0x58')]){_0x28397e[_0x35d0('0x59')]=[{'all':!![]}];}return db[_0x35d0('0x43')][_0x35d0('0x5a')](_0x28397e);})[_0x35d0('0x22')](function(_0x5ac4a4){_0x5f13e9[_0x35d0('0x5b')]=_0x5ac4a4;return _0x5f13e9;})[_0x35d0('0x22')](respondWithFilteredResult(_0x2a261c,_0x28397e))['catch'](handleError(_0x2a261c,null));};exports['show']=function(_0x5a95bd,_0x46afb8){var _0x43e4d2={'raw':![],'where':{'id':_0x5a95bd[_0x35d0('0x5c')]['id']},'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]},_0x3d11bd={};_0x3d11bd[_0x35d0('0x47')]=_['keys'](db[_0x35d0('0x43')][_0x35d0('0x44')]);_0x3d11bd[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x5a95bd[_0x35d0('0x49')]);_0x3d11bd['filters']=_[_0x35d0('0x4b')](_0x3d11bd[_0x35d0('0x47')],_0x3d11bd[_0x35d0('0x49')]);_0x43e4d2[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x3d11bd[_0x35d0('0x47')],qs['fields'](_0x5a95bd[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x43e4d2['attributes']=_0x43e4d2[_0x35d0('0x4c')]['length']?_0x43e4d2[_0x35d0('0x4c')]:_0x3d11bd[_0x35d0('0x47')];if(_0x5a95bd['query'][_0x35d0('0x58')]){_0x43e4d2[_0x35d0('0x59')]=[{'all':!![]}];}_0x43e4d2=_['merge']({},_0x43e4d2,_0x5a95bd['options']);return db[_0x35d0('0x43')]['find'](_0x43e4d2)[_0x35d0('0x22')](handleEntityNotFound(_0x46afb8,null))[_0x35d0('0x22')](respondWithResult(_0x46afb8,null))['catch'](handleError(_0x46afb8,null));};exports[_0x35d0('0x5e')]=function(_0x483850,_0x540be6){return db[_0x35d0('0x43')][_0x35d0('0x5e')](_0x483850[_0x35d0('0x5f')],{})['then'](function(_0x21d9d0){var _0x369ae6=_0x483850[_0x35d0('0x60')]['get']({'plain':!![]});if(!_0x369ae6)throw new Error(_0x35d0('0x61'));if(_0x369ae6[_0x35d0('0x62')]===_0x35d0('0x60')){var _0x4026d2=_0x21d9d0[_0x35d0('0x38')]({'plain':!![]});var _0x487eb9='OpenchannelAccounts';return db[_0x35d0('0x63')]['find']({'where':{'name':_0x487eb9,'userProfileId':_0x369ae6['userProfileId']},'raw':!![]})[_0x35d0('0x22')](function(_0x7c51f7){if(_0x7c51f7&&_0x7c51f7[_0x35d0('0x64')]===0x0){return db['UserProfileResource'][_0x35d0('0x5e')]({'name':_0x4026d2[_0x35d0('0x3e')],'resourceId':_0x4026d2['id'],'type':_0x7c51f7['name'],'sectionId':_0x7c51f7['id']},{})[_0x35d0('0x22')](function(){return _0x21d9d0;});}else{return _0x21d9d0;}})[_0x35d0('0x2c')](function(_0x27e34f){logger[_0x35d0('0x27')](_0x35d0('0x65'),_0x27e34f);throw _0x27e34f;});}return _0x21d9d0;})[_0x35d0('0x22')](respondWithResult(_0x540be6,0xc9))[_0x35d0('0x2c')](handleError(_0x540be6,null));};exports[_0x35d0('0x36')]=function(_0x268e17,_0x27b9be){if(_0x268e17['body']['id']){delete _0x268e17[_0x35d0('0x5f')]['id'];}return db[_0x35d0('0x43')]['find']({'where':{'id':_0x268e17['params']['id']},'include':[{'model':db[_0x35d0('0x40')],'as':_0x35d0('0x41')}]})['then'](handleEntityNotFound(_0x27b9be,null))[_0x35d0('0x22')](saveUpdates(_0x268e17[_0x35d0('0x5f')],null))[_0x35d0('0x22')](respondWithResult(_0x27b9be,null))[_0x35d0('0x2c')](handleError(_0x27b9be,null));};exports[_0x35d0('0x37')]=function(_0x362f93,_0x2a89d0){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x362f93[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x2a89d0,null))[_0x35d0('0x22')](removeEntity(_0x2a89d0,null))[_0x35d0('0x2c')](handleError(_0x2a89d0,null));};exports['describe']=function(_0x5736f7,_0x40a045){return db[_0x35d0('0x43')][_0x35d0('0x67')]()[_0x35d0('0x22')](respondWithResult(_0x40a045,null))['catch'](handleError(_0x40a045,null));};exports[_0x35d0('0x68')]=function(_0x38a82e,_0xa1cd5a,_0x386731){if(_0x38a82e['body']['id']){delete _0x38a82e[_0x35d0('0x5f')]['id'];}return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x38a82e[_0x35d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0xa1cd5a,null))[_0x35d0('0x22')](function(_0x41b611){if(_0x41b611){_0x38a82e['body'][_0x35d0('0x69')]=_0x41b611['id'];return db[_0x35d0('0x6a')][_0x35d0('0x5e')](_0x38a82e['body']);}})[_0x35d0('0x22')](respondWithResult(_0xa1cd5a,null))[_0x35d0('0x2c')](handleError(_0xa1cd5a,null));};exports['getDispositions']=function(_0x14f329,_0x38e2de,_0x4f101c){var _0x75647a={'raw':![],'where':{}};var _0x417794={};var _0x3bf0c3={'count':0x0,'rows':[]};return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x14f329['params']['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x38e2de,null))[_0x35d0('0x22')](function(_0x432586){if(_0x432586){_0x417794[_0x35d0('0x47')]=_[_0x35d0('0x48')](db[_0x35d0('0x6a')][_0x35d0('0x44')]);_0x417794[_0x35d0('0x49')]=_['keys'](_0x14f329['query']);_0x417794[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x417794[_0x35d0('0x47')],_0x417794['query']);_0x75647a[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x417794[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x14f329[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x75647a[_0x35d0('0x4c')]=_0x75647a[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x75647a[_0x35d0('0x4c')]:_0x417794[_0x35d0('0x47')];if(!_0x14f329[_0x35d0('0x49')]['hasOwnProperty'](_0x35d0('0x4f'))){_0x75647a[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x14f329[_0x35d0('0x49')]['limit']);_0x75647a[_0x35d0('0x30')]=qs['offset'](_0x14f329[_0x35d0('0x49')][_0x35d0('0x30')]);}_0x75647a['order']=qs['sort'](_0x14f329['query'][_0x35d0('0x51')]);_0x75647a['where']=qs['filters'](_[_0x35d0('0x53')](_0x14f329[_0x35d0('0x49')],_0x417794[_0x35d0('0x4a')]));_0x75647a[_0x35d0('0x52')][_0x35d0('0x6c')]=_0x432586['id'];if(_0x14f329[_0x35d0('0x49')][_0x35d0('0x54')]){_0x75647a[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x75647a[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x75647a[_0x35d0('0x4c')],function(_0x49c68e){var _0x34c128={};_0x34c128[_0x49c68e]={'$like':'%'+_0x14f329[_0x35d0('0x49')]['filter']+'%'};return _0x34c128;})});}_0x75647a=_['merge']({},_0x75647a,_0x14f329['options']);return db[_0x35d0('0x6a')][_0x35d0('0x2f')]({'where':_0x75647a[_0x35d0('0x52')]})[_0x35d0('0x22')](function(_0xe4ad6a){_0x3bf0c3[_0x35d0('0x2f')]=_0xe4ad6a;if(_0x14f329[_0x35d0('0x49')][_0x35d0('0x58')]){_0x75647a[_0x35d0('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x75647a);})[_0x35d0('0x22')](function(_0x344bcc){_0x3bf0c3[_0x35d0('0x5b')]=_0x344bcc;return _0x3bf0c3;});}})[_0x35d0('0x22')](respondWithFilteredResult(_0x38e2de,_0x75647a))['catch'](handleError(_0x38e2de,null));};exports[_0x35d0('0x6d')]=function(_0x36f103,_0x3bc9ee,_0x1ce800){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x36f103[_0x35d0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3bc9ee,null))[_0x35d0('0x22')](function(_0x3e6c74){if(_0x3e6c74){return _0x3e6c74['removeDispositions'](_0x36f103[_0x35d0('0x49')][_0x35d0('0x6e')]);}})['then'](respondWithStatusCode(_0x3bc9ee,null))[_0x35d0('0x2c')](handleError(_0x3bc9ee,null));};exports[_0x35d0('0x6f')]=function(_0x2213f4,_0x39bf3a,_0x64e903){if(_0x2213f4[_0x35d0('0x5f')]['id']){delete _0x2213f4[_0x35d0('0x5f')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2213f4[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x39bf3a,null))[_0x35d0('0x22')](function(_0x12950){if(_0x12950){_0x2213f4[_0x35d0('0x5f')]['OpenchannelAccountId']=_0x12950['id'];return db[_0x35d0('0x70')][_0x35d0('0x5e')](_0x2213f4[_0x35d0('0x5f')]);}})['then'](respondWithResult(_0x39bf3a,null))[_0x35d0('0x2c')](handleError(_0x39bf3a,null));};exports[_0x35d0('0x71')]=function(_0x90067f,_0x7a17dd,_0x206b53){var _0x1f306b={'raw':![],'where':{}};var _0x2f5066={};var _0x2ccc25={'count':0x0,'rows':[]};return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x90067f['params']['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x7a17dd,null))[_0x35d0('0x22')](function(_0x3056e2){if(_0x3056e2){_0x2f5066['model']=_['keys'](db[_0x35d0('0x70')]['rawAttributes']);_0x2f5066['query']=_[_0x35d0('0x48')](_0x90067f['query']);_0x2f5066[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x2f5066[_0x35d0('0x47')],_0x2f5066[_0x35d0('0x49')]);_0x1f306b[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x2f5066[_0x35d0('0x47')],qs['fields'](_0x90067f[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x1f306b[_0x35d0('0x4c')]=_0x1f306b[_0x35d0('0x4c')]['length']?_0x1f306b[_0x35d0('0x4c')]:_0x2f5066[_0x35d0('0x47')];if(!_0x90067f[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x1f306b['limit']=qs[_0x35d0('0x31')](_0x90067f[_0x35d0('0x49')][_0x35d0('0x31')]);_0x1f306b[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x90067f[_0x35d0('0x49')]['offset']);}_0x1f306b[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x90067f[_0x35d0('0x49')][_0x35d0('0x51')]);_0x1f306b['where']=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x90067f[_0x35d0('0x49')],_0x2f5066[_0x35d0('0x4a')]));_0x1f306b[_0x35d0('0x52')][_0x35d0('0x6c')]=_0x3056e2['id'];if(_0x90067f[_0x35d0('0x49')][_0x35d0('0x54')]){_0x1f306b[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x1f306b[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x1f306b[_0x35d0('0x4c')],function(_0x521ff5){var _0x401775={};_0x401775[_0x521ff5]={'$like':'%'+_0x90067f[_0x35d0('0x49')]['filter']+'%'};return _0x401775;})});}_0x1f306b=_[_0x35d0('0x56')]({},_0x1f306b,_0x90067f['options']);return db['CannedAnswer']['count']({'where':_0x1f306b['where']})[_0x35d0('0x22')](function(_0x5225d6){_0x2ccc25[_0x35d0('0x2f')]=_0x5225d6;if(_0x90067f[_0x35d0('0x49')][_0x35d0('0x58')]){_0x1f306b[_0x35d0('0x59')]=[{'all':!![]}];}return db[_0x35d0('0x70')][_0x35d0('0x5a')](_0x1f306b);})[_0x35d0('0x22')](function(_0x2b737a){_0x2ccc25['rows']=_0x2b737a;return _0x2ccc25;});}})['then'](respondWithFilteredResult(_0x7a17dd,_0x1f306b))[_0x35d0('0x2c')](handleError(_0x7a17dd,null));};exports['removeAnswers']=function(_0x4a9d30,_0x2e0d32,_0x485a2e){return db['OpenchannelAccount'][_0x35d0('0x66')]({'where':{'id':_0x4a9d30[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x2e0d32,null))[_0x35d0('0x22')](function(_0x595d71){if(_0x595d71){return _0x595d71[_0x35d0('0x72')](_0x4a9d30[_0x35d0('0x49')][_0x35d0('0x6e')]);}})[_0x35d0('0x22')](respondWithStatusCode(_0x2e0d32,null))[_0x35d0('0x2c')](handleError(_0x2e0d32,null));};exports[_0x35d0('0x73')]=function(_0x8965f9,_0x347274,_0x5b6d86){var _0xe3ce6b={'body':_0x8965f9[_0x35d0('0x5f')],'channel':_0x35d0('0x74')};var _0x1db246=[];var _0x32ff1f=[];var _0x38e6a7={};var _0x1bdab5=![];return db['CmContact']['describe']()[_0x35d0('0x22')](function(_0x16914d){if(!_0x16914d){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x76'));}_0x1db246=_[_0x35d0('0x77')](_[_0x35d0('0x48')](_0x16914d),[_0x35d0('0x78'),_0x35d0('0x79')]);_0x32ff1f=_['difference'](_[_0x35d0('0x48')](_0x16914d),['createdAt',_0x35d0('0x79'),_0x35d0('0x7a'),_0x35d0('0x7b')]);if(_0x8965f9[_0x35d0('0x5f')]['id']){delete _0x8965f9[_0x35d0('0x5f')]['id'];}if(_[_0x35d0('0x7c')](_0x8965f9['body']['from'])){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x7d'));}if(_['isNil'](_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x5f')])||_0x8965f9[_0x35d0('0x5f')]['body']===''){throw new db[(_0x35d0('0x75'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x35d0('0x7c')](_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')])){throw new db[(_0x35d0('0x75'))]['ValidationError'](_0x35d0('0x7f')+_0x32ff1f);}if(!_['includes'](_0x32ff1f,_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')])){throw new db[(_0x35d0('0x75'))][(_0x35d0('0x20'))](_0x35d0('0x80')+_0x32ff1f);}_0x38e6a7[_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')]]=_0x8965f9['body'][_0x35d0('0x81')];})['then'](function(){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x8965f9[_0x35d0('0x5c')]['id']},'include':[{'model':db[_0x35d0('0x82')],'as':_0x35d0('0x83'),'include':[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0x85'),'where':_0x38e6a7,'limit':0x1,'order':[[_0x35d0('0x79'),'DESC']]}]},{'model':db[_0x35d0('0x86')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x347274,null))['then'](function(_0x41c235){if(_0x41c235&&_0x41c235[_0x35d0('0x83')]){_0xe3ce6b['account']=_0x41c235;_0xe3ce6b[_0x35d0('0x87')]=_0x41c235[_0x35d0('0x88')];_0xe3ce6b[_0x35d0('0x89')]=_0x41c235[_0x35d0('0x83')];_0xe3ce6b[_0x35d0('0x87')]=_['orderBy'](_0xe3ce6b[_0x35d0('0x87')],['priority'],[_0x35d0('0x8a')]);if(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x88')]){delete _0xe3ce6b['account']['Applications'];}if(_0xe3ce6b[_0x35d0('0x8b')]['List']&&_0xe3ce6b['account'][_0x35d0('0x83')][_0x35d0('0x85')][_0x35d0('0x4d')]){return _0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x83')][_0x35d0('0x85')][0x0];}var _0x2699b0=_[_0x35d0('0x18')](_0x8965f9[_0x35d0('0x5f')],{'firstName':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x81')],'ListId':_0x41c235['ListId']});_0x2699b0[_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x7e')]]=_0x8965f9[_0x35d0('0x5f')]['from'];return db['CmContact'][_0x35d0('0x5e')](_0x2699b0,{'fields':_0x1db246,'raw':!![]});}})[_0x35d0('0x22')](handleEntityNotFound(_0x347274,null))['then'](function(_0x48f67b){_0xe3ce6b[_0x35d0('0x8c')]=_0x48f67b;if(_0x48f67b){var _0x158ed={'ContactId':_0x48f67b['id'],'OpenchannelAccountId':_0x8965f9[_0x35d0('0x5c')]['id'],'from':(_0x48f67b[_0x35d0('0x8d')]||'')+'\x20'+(_0x48f67b[_0x35d0('0x8e')]||'')};var _0x17114a={'OpenchannelAccountId':_0x8965f9['params']['id'],'closed':![]};if(_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')]){_0x17114a['threadId']=_0x8965f9[_0x35d0('0x5f')]['threadId'];return db['OpenchannelInteraction'][_0x35d0('0x66')]({'where':_0x17114a})[_0x35d0('0x22')](function(_0x4506b5){if(_0x4506b5){return[_0x4506b5,![]];}_0x158ed[_0x35d0('0x8f')]=_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')];_0x158ed[_0x35d0('0x90')]=_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x90')];return db['OpenchannelInteraction']['create'](_0x158ed)[_0x35d0('0x22')](function(_0x5833fc){return[_0x5833fc,!![]];});});}else{_0x17114a[_0x35d0('0x8f')]=null;}_0x17114a[_0x35d0('0x91')]=_0x48f67b['id'];return db['OpenchannelInteraction'][_0x35d0('0x66')]({'where':_0x17114a})['then'](function(_0x4022c2){if(_0x4022c2){return[_0x4022c2,![]];}return db[_0x35d0('0x92')][_0x35d0('0x5e')](_0x158ed)['then'](function(_0xf0ca0e){return[_0xf0ca0e,!![]];});});}})[_0x35d0('0x93')](function(_0x226ff9,_0x20f5c1){if(_0x226ff9){_0x1bdab5=_0x20f5c1;if(!_0x20f5c1){var _0x3d520b={'from':(_0xe3ce6b[_0x35d0('0x8c')][_0x35d0('0x8d')]||'')+'\x20'+(_0xe3ce6b[_0x35d0('0x8c')][_0x35d0('0x8e')]||'')};if(_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x8f')]&&_0x8965f9['body'][_0x35d0('0x94')]&&_0x8965f9[_0x35d0('0x5f')]['threadId']!=_0x8965f9[_0x35d0('0x5f')]['messageId']){_0x3d520b[_0x35d0('0x8f')]=_0x8965f9['body']['messageId'];}return _0x226ff9[_0x35d0('0x36')](_0x3d520b);}else{return _0x226ff9;}}})['then'](function(_0x4eaf8d){_0xe3ce6b[_0x35d0('0x95')]=_0x4eaf8d[_0x35d0('0x38')]({'plain':!![]});_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x96')]=_0x1bdab5;if(_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x96')]){if(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x97')]){_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x98')]({'id':0x0,'priority':_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x4d')]+0x1,'app':'close','appdata':_0x35d0('0x99'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x5f')],'OpenchannelAccountId':_0x8965f9[_0x35d0('0x5c')]['id'],'OpenchannelInteractionId':_0x4eaf8d['id'],'direction':'in','ContactId':_0xe3ce6b[_0x35d0('0x8c')]['id'],'AttachmentId':_0x8965f9[_0x35d0('0x5f')][_0x35d0('0x9a')]});})[_0x35d0('0x22')](function(_0x342819){_0xe3ce6b[_0x35d0('0x29')]=_0x342819;if(_0xe3ce6b[_0x35d0('0x95')]['UserId']){return db[_0x35d0('0x9b')][_0x35d0('0x66')]({'attributes':['id',_0x35d0('0x3e')],'where':{'id':_0xe3ce6b[_0x35d0('0x95')][_0x35d0('0x9c')]}})[_0x35d0('0x22')](function(_0x1f625e){if(_0x1f625e){_0xe3ce6b[_0x35d0('0x87')][_0x35d0('0x9d')]({'id':0x0,'priority':0x0,'app':_0x35d0('0x9e'),'appdata':_0x1f625e[_0x35d0('0x3e')]+','+(_0xe3ce6b[_0x35d0('0x8b')][_0x35d0('0x9f')]||0xa),'interval':_0x35d0('0xa0')});_0xe3ce6b[_0x35d0('0xa1')]=![];}return respondWithRpcPromise('Start','startRouting',_0xe3ce6b);});}return respondWithRpcPromise(_0x35d0('0xa2'),'startRouting',_0xe3ce6b);})[_0x35d0('0x22')](function(_0x1f8084){respondWithRpcPromise(_0x35d0('0xa3'),_0x35d0('0xa3'),{'event':_0x35d0('0x73'),'message':_0x1f8084},client9002);return _0x1f8084;})[_0x35d0('0x22')](respondWithResult(_0x347274,null))[_0x35d0('0x2c')](handleError(_0x347274,null));};exports[_0x35d0('0xa4')]=function(_0x363f40,_0x383cf7,_0x41999e){return db[_0x35d0('0x43')]['findOne']({'where':{'id':_0x363f40[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x383cf7,null))[_0x35d0('0x22')](function(_0x4c402d){if(_0x4c402d){return db[_0x35d0('0xa5')][_0x35d0('0xa6')](function(_0xe76188){return db[_0x35d0('0x86')]['destroy']({'where':{'OpenchannelAccountId':_0x363f40[_0x35d0('0x5c')]['id']},'transaction':_0xe76188})['then'](function(_0x2dd7bd){var _0x7bc622=_['map'](_0x363f40[_0x35d0('0x5f')],function(_0x3cf54e){_0x3cf54e[_0x35d0('0x6c')]=_0x363f40[_0x35d0('0x5c')]['id'];return _0x3cf54e;});return db[_0x35d0('0x86')]['bulkCreate'](_0x7bc622,{'transaction':_0xe76188});});})['then'](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x363f40['params']['id']},'order':'priority'});});}})[_0x35d0('0x22')](respondWithResult(_0x383cf7,null))[_0x35d0('0x2c')](handleError(_0x383cf7,null));};exports['getApplications']=function(_0x6dbbe,_0x313c09,_0x58bafb){var _0x38aab9={};var _0x547723={};var _0x25a6fe;var _0x2ef8ec;return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x6dbbe[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x313c09,null))[_0x35d0('0x22')](function(_0x5f18cb){if(_0x5f18cb){_0x25a6fe=_0x5f18cb;_0x547723['model']=_[_0x35d0('0x48')](db[_0x35d0('0x86')][_0x35d0('0x44')]);_0x547723[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x6dbbe[_0x35d0('0x49')]);_0x547723[_0x35d0('0x4a')]=_['intersection'](_0x547723[_0x35d0('0x47')],_0x547723[_0x35d0('0x49')]);_0x38aab9[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x547723['model'],qs[_0x35d0('0x5d')](_0x6dbbe[_0x35d0('0x49')]['fields']));_0x38aab9[_0x35d0('0x4c')]=_0x38aab9[_0x35d0('0x4c')]['length']?_0x38aab9['attributes']:_0x547723[_0x35d0('0x47')];_0x38aab9['order']=qs['sort'](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x51')]);_0x38aab9[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_['pick'](_0x6dbbe[_0x35d0('0x49')],_0x547723[_0x35d0('0x4a')]));if(_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x54')]){_0x38aab9[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x38aab9[_0x35d0('0x52')],{'$or':_['map'](_0x38aab9[_0x35d0('0x4c')],function(_0x31187e){var _0x33beb7={};_0x33beb7[_0x31187e]={'$like':'%'+_0x6dbbe[_0x35d0('0x49')]['filter']+'%'};return _0x33beb7;})});}_0x38aab9=_[_0x35d0('0x56')]({},_0x38aab9,_0x6dbbe[_0x35d0('0x57')]);return _0x25a6fe[_0x35d0('0xa7')](_0x38aab9);}})['then'](function(_0x657d1f){if(_0x657d1f){_0x2ef8ec=_0x657d1f[_0x35d0('0x4d')];if(!_0x6dbbe['query'][_0x35d0('0x4e')]('nolimit')){_0x38aab9[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x31')]);_0x38aab9[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x6dbbe[_0x35d0('0x49')][_0x35d0('0x30')]);}return _0x25a6fe[_0x35d0('0xa7')](_0x38aab9);}})[_0x35d0('0x22')](function(_0xb67127){if(_0xb67127){return _0xb67127?{'count':_0x2ef8ec,'rows':_0xb67127}:null;}})['then'](respondWithResult(_0x313c09,null))[_0x35d0('0x2c')](handleError(_0x313c09,null));};exports[_0x35d0('0xa8')]=function(_0x515e0e,_0x35d3da,_0x32337d){var _0x39b498={'raw':![],'where':{}};var _0x236f28={};var _0x48c331={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x515e0e[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x35d3da,null))[_0x35d0('0x22')](function(_0x496a24){if(_0x496a24){_0x236f28[_0x35d0('0x47')]=_[_0x35d0('0x48')](db[_0x35d0('0x92')][_0x35d0('0x44')]);_0x236f28[_0x35d0('0x49')]=_['keys'](_0x515e0e[_0x35d0('0x49')]);_0x236f28[_0x35d0('0x4a')]=_['intersection'](_0x236f28[_0x35d0('0x47')],_0x236f28['query']);_0x39b498[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x236f28[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x515e0e[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x39b498['attributes']=_0x39b498[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x39b498['attributes']:_0x236f28[_0x35d0('0x47')];if(!_0x515e0e[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x39b498[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x515e0e['query'][_0x35d0('0x31')]);_0x39b498[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x515e0e[_0x35d0('0x49')]['offset']);}_0x39b498[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x515e0e[_0x35d0('0x49')][_0x35d0('0x51')]);_0x39b498[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_['pick'](_0x515e0e['query'],_0x236f28[_0x35d0('0x4a')]));_0x39b498['where'][_0x35d0('0x6c')]=_0x496a24['id'];if(_0x515e0e[_0x35d0('0x49')][_0x35d0('0x54')]){_0x39b498[_0x35d0('0x52')]=_['merge'](_0x39b498[_0x35d0('0x52')],{'$or':_[_0x35d0('0x42')](_0x39b498['attributes'],function(_0x29d12f){var _0x22d774={};_0x22d774[_0x29d12f]={'$like':'%'+_0x515e0e[_0x35d0('0x49')]['filter']+'%'};return _0x22d774;})});}_0x39b498=_[_0x35d0('0x56')]({},_0x39b498,_0x515e0e[_0x35d0('0x57')]);return db['OpenchannelInteraction'][_0x35d0('0x2f')]({'where':_0x39b498['where']})['then'](function(_0x2cefca){_0x48c331['count']=_0x2cefca;if(_0x515e0e['query']['includeAll']){_0x39b498[_0x35d0('0x59')]=[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0xa9'),'required':![]},{'model':db[_0x35d0('0x9b')],'as':_0x35d0('0xaa'),'attributes':['name',_0x35d0('0xab'),_0x35d0('0xac')],'required':![]},{'model':db[_0x35d0('0xad')],'as':_0x35d0('0xae'),'attributes':['id',_0x35d0('0x3e'),'color'],'where':_0x515e0e[_0x35d0('0x49')]['tag']?{'id':_0x515e0e['query'][_0x35d0('0xaf')]}:undefined,'required':_0x515e0e[_0x35d0('0x49')][_0x35d0('0xaf')]?!![]:![]}];}return db[_0x35d0('0x92')][_0x35d0('0x5a')](_0x39b498);})[_0x35d0('0x22')](function(_0x14bd23){_0x48c331[_0x35d0('0x5b')]=_0x14bd23;return _0x48c331;});}})[_0x35d0('0x22')](respondWithFilteredResult(_0x35d3da,_0x39b498))[_0x35d0('0x2c')](handleError(_0x35d3da,null));};exports[_0x35d0('0xb0')]=function(_0x3ea158,_0x3c40f1,_0x2f44f1){return db[_0x35d0('0x43')][_0x35d0('0x66')]({'where':{'id':_0x3ea158[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x3c40f1,null))['then'](function(_0x2e3f78){if(_0x2e3f78){return _0x2e3f78[_0x35d0('0xb0')](_0x3ea158[_0x35d0('0x5f')]['ids'],_[_0x35d0('0xb1')](_0x3ea158['body'],[_0x35d0('0x6e'),'id'])||{})[_0x35d0('0x93')](function(_0x323df8){for(var _0x1bb98d=0x0;_0x1bb98d<_0x3ea158[_0x35d0('0x5f')][_0x35d0('0x6e')][_0x35d0('0x4d')];_0x1bb98d+=0x1){socket[_0x35d0('0xb2')](_0x35d0('0xb3'),{'UserId':_0x3ea158[_0x35d0('0x5f')][_0x35d0('0x6e')][_0x1bb98d],'OpenchannelAccountId':_0x3ea158[_0x35d0('0x5c')]['id']});}return _0x323df8;});}})[_0x35d0('0x22')](respondWithResult(_0x3c40f1,null))[_0x35d0('0x2c')](handleError(_0x3c40f1,null));};exports[_0x35d0('0xb4')]=function(_0x20ddf9,_0x242631,_0x32a86e){return db['OpenchannelAccount']['find']({'where':{'id':_0x20ddf9[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x242631,null))[_0x35d0('0x22')](function(_0x5908c2){if(_0x5908c2){return _0x5908c2[_0x35d0('0xb4')](_0x20ddf9[_0x35d0('0x49')]['ids'])['then'](function(){if(_[_0x35d0('0xb5')](_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')])){for(var _0x1397d9=0x0;_0x1397d9<_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')][_0x35d0('0x4d')];_0x1397d9+=0x1){socket['emit'](_0x35d0('0xb6'),{'UserId':Number(_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')][_0x1397d9]),'OpenchannelAccountId':Number(_0x20ddf9[_0x35d0('0x5c')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x20ddf9[_0x35d0('0x49')][_0x35d0('0x6e')]),'OpenchannelAccountId':Number(_0x20ddf9[_0x35d0('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x242631,null))[_0x35d0('0x2c')](handleError(_0x242631,null));};exports['getAgents']=function(_0x3694cd,_0x22784d,_0x3be4ba){var _0x410472={};var _0x244ab3={};var _0x422ddb;var _0x2be6c7;return db[_0x35d0('0x43')][_0x35d0('0x6b')]({'where':{'id':_0x3694cd[_0x35d0('0x5c')]['id']}})[_0x35d0('0x22')](handleEntityNotFound(_0x22784d,null))[_0x35d0('0x22')](function(_0x307c64){if(_0x307c64){_0x422ddb=_0x307c64;_0x244ab3[_0x35d0('0x47')]=_['keys'](db[_0x35d0('0x9b')][_0x35d0('0x44')]);_0x244ab3[_0x35d0('0x49')]=_[_0x35d0('0x48')](_0x3694cd[_0x35d0('0x49')]);_0x244ab3[_0x35d0('0x4a')]=_[_0x35d0('0x4b')](_0x244ab3[_0x35d0('0x47')],_0x244ab3[_0x35d0('0x49')]);_0x410472[_0x35d0('0x4c')]=_[_0x35d0('0x4b')](_0x244ab3[_0x35d0('0x47')],qs[_0x35d0('0x5d')](_0x3694cd[_0x35d0('0x49')][_0x35d0('0x5d')]));_0x410472[_0x35d0('0x4c')]=_0x410472[_0x35d0('0x4c')][_0x35d0('0x4d')]?_0x410472[_0x35d0('0x4c')]:_0x244ab3[_0x35d0('0x47')];_0x410472[_0x35d0('0x50')]=qs[_0x35d0('0x51')](_0x3694cd['query']['sort']);_0x410472[_0x35d0('0x52')]=qs[_0x35d0('0x4a')](_[_0x35d0('0x53')](_0x3694cd[_0x35d0('0x49')],_0x244ab3[_0x35d0('0x4a')]));if(_0x3694cd[_0x35d0('0x49')][_0x35d0('0x54')]){_0x410472[_0x35d0('0x52')]=_[_0x35d0('0x56')](_0x410472[_0x35d0('0x52')],{'$or':_['map'](_0x410472[_0x35d0('0x4c')],function(_0x5ba286){var _0x327078={};_0x327078[_0x5ba286]={'$like':'%'+_0x3694cd[_0x35d0('0x49')][_0x35d0('0x54')]+'%'};return _0x327078;})});}_0x410472=_[_0x35d0('0x56')]({},_0x410472,_0x3694cd[_0x35d0('0x57')]);return _0x422ddb[_0x35d0('0xb7')](_0x410472);}})['then'](function(_0x430cd5){if(_0x430cd5){_0x2be6c7=_0x430cd5['length'];if(!_0x3694cd[_0x35d0('0x49')][_0x35d0('0x4e')](_0x35d0('0x4f'))){_0x410472[_0x35d0('0x31')]=qs[_0x35d0('0x31')](_0x3694cd[_0x35d0('0x49')]['limit']);_0x410472[_0x35d0('0x30')]=qs[_0x35d0('0x30')](_0x3694cd['query'][_0x35d0('0x30')]);}return _0x422ddb[_0x35d0('0xb7')](_0x410472);}})[_0x35d0('0x22')](function(_0x3ee0c1){if(_0x3ee0c1){return _0x3ee0c1?{'count':_0x2be6c7,'rows':_0x3ee0c1}:null;}})[_0x35d0('0x22')](respondWithResult(_0x22784d,null))[_0x35d0('0x2c')](handleError(_0x22784d,null));};exports['send']=function(_0x47a440,_0xd875f8,_0x565f17){var _0x2fc6e7,_0x2fd5e0,_0x644e24;if(_[_0x35d0('0x7c')](_0x47a440[_0x35d0('0x5f')]['body'])||_0x47a440[_0x35d0('0x5f')][_0x35d0('0x5f')]===''){throw new db['Sequelize'][(_0x35d0('0x20'))](_0x35d0('0xb8'));}if(_[_0x35d0('0x7c')](_0x47a440['body']['to'])){}_0x2fc6e7=_0x47a440[_0x35d0('0x5f')]['to'];return db['OpenchannelAccount'][_0x35d0('0x6b')]({'where':{'id':_0x47a440['params']['id']}})['then'](handleEntityNotFound(_0xd875f8,null))['then'](function(_0x49aa0f){if(_0x49aa0f){return db['OpenchannelAccount'][_0x35d0('0x66')]({'where':{'id':_0x49aa0f['id']},'include':[{'model':db[_0x35d0('0x82')],'as':_0x35d0('0x83'),'include':[{'model':db[_0x35d0('0x84')],'as':_0x35d0('0x85'),'where':{[_0x49aa0f['mapKey']]:_0x2fc6e7},'limit':0x1,'order':[[_0x35d0('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xd875f8,null))[_0x35d0('0x22')](function(_0x47501b){if(_0x47501b&&_0x47501b['List']){_0x2fd5e0=_0x47501b['get']({'plain':!![]});if(_0x2fd5e0['List']&&_0x2fd5e0[_0x35d0('0x83')]['Contacts'][_0x35d0('0x4d')]){return _0x2fd5e0[_0x35d0('0x83')]['Contacts'][0x0];}return db[_0x35d0('0x84')][_0x35d0('0x5e')](_[_0x35d0('0x18')](_0x47a440[_0x35d0('0x5f')],{'firstName':_0x2fc6e7,[_0x47501b[_0x35d0('0x7e')]]:_0x2fc6e7,'phone':_0x2fc6e7,'ListId':_0x2fd5e0['ListId']}));}})[_0x35d0('0x22')](handleEntityNotFound(_0xd875f8,null))[_0x35d0('0x22')](function(_0x5da0d7){if(_0x5da0d7){_0x644e24=_0x5da0d7;return db[_0x35d0('0x92')][_0x35d0('0x66')]({'where':{'ContactId':_0x644e24['id'],'closed':![],'OpenchannelAccountId':_0x2fd5e0['id']}})[_0x35d0('0x22')](function(_0x3f5f34){if(_0x3f5f34){return[_0x3f5f34,![]];}return db[_0x35d0('0x92')][_0x35d0('0x5e')]({'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id'],'OpenchannelAccountId':_0x2fd5e0['id'],'lastMsgDirection':_0x35d0('0xb9'),'Messages':[_[_0x35d0('0x56')](_0x47a440[_0x35d0('0x5f')],{'read':![],'body':_0x47a440[_0x35d0('0x5f')][_0x35d0('0x5f')],'OpenchannelAccountId':_0x2fd5e0['id'],'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id']})]},{'include':[{'model':db[_0x35d0('0xba')],'as':_0x35d0('0xbb')}]})[_0x35d0('0x22')](function(_0x5ba468){return[_0x5ba468,!![]];});});}})[_0x35d0('0x93')](function(_0x30b216,_0x56f965){if(_0x56f965){return _0x30b216;}return db['OpenchannelMessage']['create'](_[_0x35d0('0x56')](_0x47a440[_0x35d0('0x5f')],{'read':![],'body':_0x47a440['body'][_0x35d0('0x5f')],'OpenchannelAccountId':_0x2fd5e0['id'],'OpenchannelInteractionId':_0x30b216['id'],'UserId':_0x47a440[_0x35d0('0x60')]['id'],'ContactId':_0x644e24['id']}))[_0x35d0('0x22')](function(_0x18215f){_0x30b216[_0x35d0('0xbc')][_0x35d0('0xbb')]=[];_0x30b216['dataValues'][_0x35d0('0xbb')][_0x35d0('0x98')](_0x18215f[_0x35d0('0xbc')]);return _0x30b216;});});}})['then'](respondWithResult(_0xd875f8,null))[_0x35d0('0x2c')](handleError(_0xd875f8,null));}; \ No newline at end of file +var _0xf31c=['DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','out','dataValues','Messages','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','json','count','offset','Content-Range','save','update','destroy','UserProfileResource','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','body','describe','addDisposition','OpnechannelAccountId','Disposition','findOne','order','pick','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts'];(function(_0x4b7f28,_0x27d23a){var _0xf5b553=function(_0x1cb9c1){while(--_0x1cb9c1){_0x4b7f28['push'](_0x4b7f28['shift']());}};_0xf5b553(++_0x27d23a);}(_0xf31c,0x1b3));var _0xcf31=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xf31c[_0x1992f1];return _0x413dfe;};'use strict';var pdf=require(_0xcf31('0x0'));var emlformat=require(_0xcf31('0x1'));var rimraf=require(_0xcf31('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf31('0x3'));var moment=require(_0xcf31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf31('0x5'));var util=require(_0xcf31('0x6'));var path=require(_0xcf31('0x7'));var sox=require(_0xcf31('0x8'));var csv=require(_0xcf31('0x9'));var ejs=require(_0xcf31('0xa'));var fs=require('fs');var _=require(_0xcf31('0xb'));var squel=require(_0xcf31('0xc'));var crypto=require(_0xcf31('0xd'));var jsforce=require(_0xcf31('0xe'));var deskjs=require(_0xcf31('0xf'));var toCsv=require(_0xcf31('0x9'));var querystring=require('querystring');var Papa=require(_0xcf31('0x10'));var Redis=require(_0xcf31('0x11'));var authService=require(_0xcf31('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcf31('0x13'));var hardwareService=require(_0xcf31('0x14'));var logger=require(_0xcf31('0x15'))('api');var utils=require(_0xcf31('0x16'));var config=require(_0xcf31('0x17'));var db=require(_0xcf31('0x18'))['db'];config[_0xcf31('0x19')]=_[_0xcf31('0x1a')](config[_0xcf31('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf31('0x1b'))(new Redis(config[_0xcf31('0x19')]));require(_0xcf31('0x1c'))[_0xcf31('0x1d')](socket);var jayson=require(_0xcf31('0x1e'));var client=jayson[_0xcf31('0x1f')][_0xcf31('0x20')]({'port':0x232c});var client9002=jayson[_0xcf31('0x1f')][_0xcf31('0x20')]({'port':0x232a});function checkPasswordPattern(_0x11b97f,_0x220650,_0x43abb5){if(_0x43abb5){var _0x568056=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x568056[_0xcf31('0x21')](_0x220650)){return _0x11b97f;}else{throw new db['Sequelize']['ValidationError'](_0xcf31('0x22'));}}else{return _0x11b97f;}}function respondWithRpcPromise(_0x5cdd27,_0x4a3436,_0x359113,_0x1ec8a7){return new BPromise(function(_0x5a58e0,_0x10d456){var _0x1039b5=_0x1ec8a7||client;return _0x1039b5[_0xcf31('0x23')](_0x5cdd27,_0x359113)[_0xcf31('0x24')](function(_0x46a111){logger[_0xcf31('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4a3436,_0xcf31('0x26'));logger[_0xcf31('0x27')](_0xcf31('0x28'),_0x4a3436,'request\x20sent',JSON[_0xcf31('0x29')](_0x46a111));if(_0x46a111[_0xcf31('0x2a')]){if(_0x46a111[_0xcf31('0x2a')][_0xcf31('0x2b')]===0x1f4){logger[_0xcf31('0x2a')](_0xcf31('0x2c'),_0x4a3436,_0x46a111[_0xcf31('0x2a')][_0xcf31('0x2d')]);return _0x10d456(_0x46a111[_0xcf31('0x2a')][_0xcf31('0x2d')]);}logger[_0xcf31('0x2a')](_0xcf31('0x2c'),_0x4a3436,_0x46a111[_0xcf31('0x2a')][_0xcf31('0x2d')]);return _0x5a58e0(_0x46a111[_0xcf31('0x2a')]['message']);}else{logger[_0xcf31('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4a3436,'request\x20sent');_0x5a58e0(_0x46a111[_0xcf31('0x2e')][_0xcf31('0x2d')]);}})[_0xcf31('0x2f')](function(_0x54cb92){logger['error'](_0xcf31('0x2c'),_0x4a3436,_0x54cb92);_0x10d456(_0x54cb92);});});}function respondWithStatusCode(_0x54b469,_0xed5a90){_0xed5a90=_0xed5a90||0xcc;return function(_0x10305a){if(_0x10305a){return _0x54b469['sendStatus'](_0xed5a90);}return _0x54b469[_0xcf31('0x30')](_0xed5a90)['end']();};}function respondWithResult(_0x2b204d,_0x14b7fc){_0x14b7fc=_0x14b7fc||0xc8;return function(_0xb2c94c){if(_0xb2c94c){return _0x2b204d[_0xcf31('0x30')](_0x14b7fc)[_0xcf31('0x31')](_0xb2c94c);}};}function respondWithFilteredResult(_0x486c0a,_0x4f775d){return function(_0x519263){if(_0x519263){var _0x5b88d6=_0x519263[_0xcf31('0x32')],_0x22ccc8=_0x4f775d[_0xcf31('0x33')],_0x5cedbe=_0x4f775d[_0xcf31('0x33')]+_0x4f775d['limit'],_0x1a386e;if(_0x5cedbe>=_0x5b88d6){_0x5cedbe=_0x5b88d6;_0x1a386e=0xc8;}else{_0x1a386e=0xce;}_0x486c0a['status'](_0x1a386e);return _0x486c0a['set'](_0xcf31('0x34'),_0x22ccc8+'-'+_0x5cedbe+'/'+_0x5b88d6)[_0xcf31('0x31')](_0x519263);}return null;};}function patchUpdates(_0x55a139){return function(_0x284d81){try{jsonpatch['apply'](_0x284d81,_0x55a139,!![]);}catch(_0x47368d){return BPromise['reject'](_0x47368d);}return _0x284d81[_0xcf31('0x35')]();};}function saveUpdates(_0x592654,_0x133ef0){return function(_0x219d2d){if(_0x219d2d){return _0x219d2d[_0xcf31('0x36')](_0x592654)['then'](function(_0x16848a){return _0x16848a;});}return null;};}function removeEntity(_0x123581,_0x450930){return function(_0x135b1a){if(_0x135b1a){return _0x135b1a[_0xcf31('0x37')]()[_0xcf31('0x24')](function(){var _0x40eb99=_0x135b1a['get']({'plain':!![]});var _0x13e903='OpenchannelAccounts';return db[_0xcf31('0x38')]['destroy']({'where':{'type':_0x13e903,'resourceId':_0x40eb99['id']}})['then'](function(){return _0x135b1a;});})[_0xcf31('0x24')](function(){_0x123581['status'](0xcc)[_0xcf31('0x39')]();});}};}function handleEntityNotFound(_0x33770b,_0x7417eb){return function(_0x525a1c){if(!_0x525a1c){_0x33770b[_0xcf31('0x3a')](0x194);}return _0x525a1c;};}function handleError(_0xe4f8b2,_0x1bad78){_0x1bad78=_0x1bad78||0x1f4;return function(_0x49cfa8){logger['error'](_0x49cfa8[_0xcf31('0x3b')]);if(_0x49cfa8[_0xcf31('0x3c')]){delete _0x49cfa8[_0xcf31('0x3c')];}_0xe4f8b2['status'](_0x1bad78)['send'](_0x49cfa8);};}exports[_0xcf31('0x3d')]=function(_0x43d7a8,_0x2f7e6b){var _0x1b2d96={'include':[{'model':db[_0xcf31('0x3e')],'as':_0xcf31('0x3f')}]},_0xe486d1={},_0x4f5a3a={'count':0x0,'rows':[]};var _0x41de4d=_[_0xcf31('0x40')](db[_0xcf31('0x41')][_0xcf31('0x42')],function(_0x56175c){return{'name':_0x56175c[_0xcf31('0x43')],'type':_0x56175c['type'][_0xcf31('0x44')]};});_0xe486d1[_0xcf31('0x45')]=_['map'](_0x41de4d,_0xcf31('0x3c'));_0xe486d1[_0xcf31('0x46')]=_['keys'](_0x43d7a8['query']);_0xe486d1['filters']=_['intersection'](_0xe486d1[_0xcf31('0x45')],_0xe486d1[_0xcf31('0x46')]);_0x1b2d96['attributes']=_[_0xcf31('0x47')](_0xe486d1[_0xcf31('0x45')],qs[_0xcf31('0x48')](_0x43d7a8[_0xcf31('0x46')][_0xcf31('0x48')]));_0x1b2d96[_0xcf31('0x49')]=_0x1b2d96['attributes'][_0xcf31('0x4a')]?_0x1b2d96[_0xcf31('0x49')]:_0xe486d1[_0xcf31('0x45')];if(!_0x43d7a8[_0xcf31('0x46')][_0xcf31('0x4b')](_0xcf31('0x4c'))){_0x1b2d96[_0xcf31('0x4d')]=qs[_0xcf31('0x4d')](_0x43d7a8[_0xcf31('0x46')]['limit']);_0x1b2d96[_0xcf31('0x33')]=qs['offset'](_0x43d7a8[_0xcf31('0x46')][_0xcf31('0x33')]);}_0x1b2d96['order']=qs[_0xcf31('0x4e')](_0x43d7a8[_0xcf31('0x46')][_0xcf31('0x4e')]);_0x1b2d96['where']=qs['filters'](_['pick'](_0x43d7a8[_0xcf31('0x46')],_0xe486d1[_0xcf31('0x4f')]),_0x41de4d);if(_0x43d7a8[_0xcf31('0x46')]['filter']){_0x1b2d96[_0xcf31('0x50')]=_[_0xcf31('0x51')](_0x1b2d96[_0xcf31('0x50')],{'$or':_[_0xcf31('0x40')](_0x41de4d,function(_0x29c1b3){if(_0x29c1b3[_0xcf31('0x52')]!==_0xcf31('0x53')){var _0x38448d={};_0x38448d[_0x29c1b3[_0xcf31('0x3c')]]={'$like':'%'+_0x43d7a8['query'][_0xcf31('0x54')]+'%'};return _0x38448d;}})});}_0x1b2d96=_[_0xcf31('0x51')]({},_0x1b2d96,_0x43d7a8['options']);var _0x577868={'where':_0x1b2d96[_0xcf31('0x50')]};return db[_0xcf31('0x41')][_0xcf31('0x32')](_0x577868)[_0xcf31('0x24')](function(_0x1033ec){_0x4f5a3a[_0xcf31('0x32')]=_0x1033ec;if(_0x43d7a8[_0xcf31('0x46')][_0xcf31('0x55')]){_0x1b2d96[_0xcf31('0x56')]=[{'all':!![]}];}return db[_0xcf31('0x41')][_0xcf31('0x57')](_0x1b2d96);})['then'](function(_0x58b41d){_0x4f5a3a[_0xcf31('0x58')]=_0x58b41d;return _0x4f5a3a;})['then'](respondWithFilteredResult(_0x2f7e6b,_0x1b2d96))[_0xcf31('0x2f')](handleError(_0x2f7e6b,null));};exports[_0xcf31('0x59')]=function(_0x4b2492,_0x4a5940){var _0x10be4d={'raw':![],'where':{'id':_0x4b2492[_0xcf31('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5d969e={};_0x5d969e[_0xcf31('0x45')]=_['keys'](db[_0xcf31('0x41')][_0xcf31('0x42')]);_0x5d969e[_0xcf31('0x46')]=_[_0xcf31('0x5b')](_0x4b2492[_0xcf31('0x46')]);_0x5d969e['filters']=_['intersection'](_0x5d969e['model'],_0x5d969e[_0xcf31('0x46')]);_0x10be4d['attributes']=_[_0xcf31('0x47')](_0x5d969e['model'],qs[_0xcf31('0x48')](_0x4b2492['query'][_0xcf31('0x48')]));_0x10be4d[_0xcf31('0x49')]=_0x10be4d['attributes'][_0xcf31('0x4a')]?_0x10be4d[_0xcf31('0x49')]:_0x5d969e[_0xcf31('0x45')];if(_0x4b2492[_0xcf31('0x46')][_0xcf31('0x55')]){_0x10be4d[_0xcf31('0x56')]=[{'all':!![]}];}_0x10be4d=_[_0xcf31('0x51')]({},_0x10be4d,_0x4b2492[_0xcf31('0x5c')]);return db[_0xcf31('0x41')][_0xcf31('0x5d')](_0x10be4d)[_0xcf31('0x24')](handleEntityNotFound(_0x4a5940,null))['then'](respondWithResult(_0x4a5940,null))['catch'](handleError(_0x4a5940,null));};exports['create']=function(_0x104110,_0x3318ea){return db[_0xcf31('0x41')][_0xcf31('0x5e')](_0x104110['body'],{})[_0xcf31('0x24')](function(_0x24166e){var _0x4b3073=_0x104110[_0xcf31('0x5f')][_0xcf31('0x60')]({'plain':!![]});if(!_0x4b3073)throw new Error(_0xcf31('0x61'));if(_0x4b3073[_0xcf31('0x62')]===_0xcf31('0x5f')){var _0x46bf20=_0x24166e[_0xcf31('0x60')]({'plain':!![]});var _0x52497a=_0xcf31('0x63');return db[_0xcf31('0x64')][_0xcf31('0x5d')]({'where':{'name':_0x52497a,'userProfileId':_0x4b3073['userProfileId']},'raw':!![]})[_0xcf31('0x24')](function(_0x55d9d0){if(_0x55d9d0&&_0x55d9d0['autoAssociation']===0x0){return db[_0xcf31('0x38')]['create']({'name':_0x46bf20['name'],'resourceId':_0x46bf20['id'],'type':_0x55d9d0[_0xcf31('0x3c')],'sectionId':_0x55d9d0['id']},{})[_0xcf31('0x24')](function(){return _0x24166e;});}else{return _0x24166e;}})[_0xcf31('0x2f')](function(_0x15ac1e){logger[_0xcf31('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15ac1e);throw _0x15ac1e;});}return _0x24166e;})['then'](respondWithResult(_0x3318ea,0xc9))[_0xcf31('0x2f')](handleError(_0x3318ea,null));};exports[_0xcf31('0x36')]=function(_0xd9ba83,_0x4de143){if(_0xd9ba83[_0xcf31('0x65')]['id']){delete _0xd9ba83[_0xcf31('0x65')]['id'];}return db[_0xcf31('0x41')][_0xcf31('0x5d')]({'where':{'id':_0xd9ba83[_0xcf31('0x5a')]['id']},'include':[{'model':db[_0xcf31('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xcf31('0x24')](handleEntityNotFound(_0x4de143,null))[_0xcf31('0x24')](saveUpdates(_0xd9ba83['body'],null))['then'](respondWithResult(_0x4de143,null))[_0xcf31('0x2f')](handleError(_0x4de143,null));};exports[_0xcf31('0x37')]=function(_0x47b0ec,_0x2b226d){return db[_0xcf31('0x41')]['find']({'where':{'id':_0x47b0ec[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x2b226d,null))[_0xcf31('0x24')](removeEntity(_0x2b226d,null))[_0xcf31('0x2f')](handleError(_0x2b226d,null));};exports[_0xcf31('0x66')]=function(_0x1d8c4a,_0x3b27b3){return db['OpenchannelAccount'][_0xcf31('0x66')]()[_0xcf31('0x24')](respondWithResult(_0x3b27b3,null))[_0xcf31('0x2f')](handleError(_0x3b27b3,null));};exports[_0xcf31('0x67')]=function(_0x4d733f,_0x3ba47b,_0xe8db7a){if(_0x4d733f[_0xcf31('0x65')]['id']){delete _0x4d733f['body']['id'];}return db[_0xcf31('0x41')][_0xcf31('0x5d')]({'where':{'id':_0x4d733f[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x3ba47b,null))[_0xcf31('0x24')](function(_0x2b3098){if(_0x2b3098){_0x4d733f[_0xcf31('0x65')][_0xcf31('0x68')]=_0x2b3098['id'];return db[_0xcf31('0x69')][_0xcf31('0x5e')](_0x4d733f[_0xcf31('0x65')]);}})['then'](respondWithResult(_0x3ba47b,null))['catch'](handleError(_0x3ba47b,null));};exports['getDispositions']=function(_0x4e8ee3,_0x88d40f,_0x32fd89){var _0x5a5b9a={'raw':![],'where':{}};var _0x5071a6={};var _0x238c78={'count':0x0,'rows':[]};return db[_0xcf31('0x41')][_0xcf31('0x6a')]({'where':{'id':_0x4e8ee3[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x88d40f,null))[_0xcf31('0x24')](function(_0x294c8b){if(_0x294c8b){_0x5071a6['model']=_[_0xcf31('0x5b')](db[_0xcf31('0x69')]['rawAttributes']);_0x5071a6['query']=_[_0xcf31('0x5b')](_0x4e8ee3[_0xcf31('0x46')]);_0x5071a6['filters']=_[_0xcf31('0x47')](_0x5071a6['model'],_0x5071a6[_0xcf31('0x46')]);_0x5a5b9a[_0xcf31('0x49')]=_[_0xcf31('0x47')](_0x5071a6[_0xcf31('0x45')],qs[_0xcf31('0x48')](_0x4e8ee3[_0xcf31('0x46')][_0xcf31('0x48')]));_0x5a5b9a[_0xcf31('0x49')]=_0x5a5b9a[_0xcf31('0x49')][_0xcf31('0x4a')]?_0x5a5b9a[_0xcf31('0x49')]:_0x5071a6[_0xcf31('0x45')];if(!_0x4e8ee3[_0xcf31('0x46')][_0xcf31('0x4b')]('nolimit')){_0x5a5b9a[_0xcf31('0x4d')]=qs['limit'](_0x4e8ee3[_0xcf31('0x46')]['limit']);_0x5a5b9a[_0xcf31('0x33')]=qs[_0xcf31('0x33')](_0x4e8ee3[_0xcf31('0x46')][_0xcf31('0x33')]);}_0x5a5b9a[_0xcf31('0x6b')]=qs['sort'](_0x4e8ee3['query'][_0xcf31('0x4e')]);_0x5a5b9a[_0xcf31('0x50')]=qs['filters'](_[_0xcf31('0x6c')](_0x4e8ee3[_0xcf31('0x46')],_0x5071a6[_0xcf31('0x4f')]));_0x5a5b9a['where']['OpenchannelAccountId']=_0x294c8b['id'];if(_0x4e8ee3[_0xcf31('0x46')][_0xcf31('0x54')]){_0x5a5b9a[_0xcf31('0x50')]=_[_0xcf31('0x51')](_0x5a5b9a[_0xcf31('0x50')],{'$or':_[_0xcf31('0x40')](_0x5a5b9a[_0xcf31('0x49')],function(_0x682ae8){var _0x260544={};_0x260544[_0x682ae8]={'$like':'%'+_0x4e8ee3[_0xcf31('0x46')][_0xcf31('0x54')]+'%'};return _0x260544;})});}_0x5a5b9a=_[_0xcf31('0x51')]({},_0x5a5b9a,_0x4e8ee3[_0xcf31('0x5c')]);return db[_0xcf31('0x69')][_0xcf31('0x32')]({'where':_0x5a5b9a[_0xcf31('0x50')]})['then'](function(_0x37455b){_0x238c78[_0xcf31('0x32')]=_0x37455b;if(_0x4e8ee3['query']['includeAll']){_0x5a5b9a[_0xcf31('0x56')]=[{'all':!![]}];}return db[_0xcf31('0x69')]['findAll'](_0x5a5b9a);})[_0xcf31('0x24')](function(_0x39eec2){_0x238c78[_0xcf31('0x58')]=_0x39eec2;return _0x238c78;});}})[_0xcf31('0x24')](respondWithFilteredResult(_0x88d40f,_0x5a5b9a))[_0xcf31('0x2f')](handleError(_0x88d40f,null));};exports[_0xcf31('0x6d')]=function(_0x3dd0e2,_0xdb38e0,_0x1bad4d){return db['OpenchannelAccount'][_0xcf31('0x5d')]({'where':{'id':_0x3dd0e2[_0xcf31('0x5a')]['id']}})['then'](handleEntityNotFound(_0xdb38e0,null))['then'](function(_0x52a22c){if(_0x52a22c){return _0x52a22c[_0xcf31('0x6d')](_0x3dd0e2[_0xcf31('0x46')][_0xcf31('0x6e')]);}})[_0xcf31('0x24')](respondWithStatusCode(_0xdb38e0,null))[_0xcf31('0x2f')](handleError(_0xdb38e0,null));};exports[_0xcf31('0x6f')]=function(_0x29438d,_0x471ed6,_0x4869d0){if(_0x29438d['body']['id']){delete _0x29438d['body']['id'];}return db[_0xcf31('0x41')]['find']({'where':{'id':_0x29438d[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x471ed6,null))[_0xcf31('0x24')](function(_0x53b497){if(_0x53b497){_0x29438d[_0xcf31('0x65')][_0xcf31('0x70')]=_0x53b497['id'];return db['CannedAnswer']['create'](_0x29438d[_0xcf31('0x65')]);}})[_0xcf31('0x24')](respondWithResult(_0x471ed6,null))[_0xcf31('0x2f')](handleError(_0x471ed6,null));};exports['getAnswers']=function(_0x34686d,_0x21520b,_0x3868ae){var _0xf4a945={'raw':![],'where':{}};var _0x2c923f={};var _0x45f2b8={'count':0x0,'rows':[]};return db[_0xcf31('0x41')][_0xcf31('0x6a')]({'where':{'id':_0x34686d[_0xcf31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x21520b,null))[_0xcf31('0x24')](function(_0x4e2060){if(_0x4e2060){_0x2c923f[_0xcf31('0x45')]=_[_0xcf31('0x5b')](db['CannedAnswer'][_0xcf31('0x42')]);_0x2c923f[_0xcf31('0x46')]=_[_0xcf31('0x5b')](_0x34686d[_0xcf31('0x46')]);_0x2c923f[_0xcf31('0x4f')]=_[_0xcf31('0x47')](_0x2c923f['model'],_0x2c923f[_0xcf31('0x46')]);_0xf4a945[_0xcf31('0x49')]=_[_0xcf31('0x47')](_0x2c923f['model'],qs['fields'](_0x34686d['query']['fields']));_0xf4a945[_0xcf31('0x49')]=_0xf4a945[_0xcf31('0x49')][_0xcf31('0x4a')]?_0xf4a945[_0xcf31('0x49')]:_0x2c923f[_0xcf31('0x45')];if(!_0x34686d[_0xcf31('0x46')]['hasOwnProperty'](_0xcf31('0x4c'))){_0xf4a945[_0xcf31('0x4d')]=qs[_0xcf31('0x4d')](_0x34686d[_0xcf31('0x46')]['limit']);_0xf4a945[_0xcf31('0x33')]=qs[_0xcf31('0x33')](_0x34686d['query'][_0xcf31('0x33')]);}_0xf4a945[_0xcf31('0x6b')]=qs[_0xcf31('0x4e')](_0x34686d[_0xcf31('0x46')][_0xcf31('0x4e')]);_0xf4a945[_0xcf31('0x50')]=qs[_0xcf31('0x4f')](_[_0xcf31('0x6c')](_0x34686d[_0xcf31('0x46')],_0x2c923f[_0xcf31('0x4f')]));_0xf4a945[_0xcf31('0x50')][_0xcf31('0x70')]=_0x4e2060['id'];if(_0x34686d[_0xcf31('0x46')][_0xcf31('0x54')]){_0xf4a945['where']=_['merge'](_0xf4a945['where'],{'$or':_[_0xcf31('0x40')](_0xf4a945[_0xcf31('0x49')],function(_0x26a457){var _0x6a6340={};_0x6a6340[_0x26a457]={'$like':'%'+_0x34686d[_0xcf31('0x46')]['filter']+'%'};return _0x6a6340;})});}_0xf4a945=_['merge']({},_0xf4a945,_0x34686d[_0xcf31('0x5c')]);return db[_0xcf31('0x71')][_0xcf31('0x32')]({'where':_0xf4a945[_0xcf31('0x50')]})[_0xcf31('0x24')](function(_0x5633a9){_0x45f2b8['count']=_0x5633a9;if(_0x34686d[_0xcf31('0x46')][_0xcf31('0x55')]){_0xf4a945[_0xcf31('0x56')]=[{'all':!![]}];}return db[_0xcf31('0x71')][_0xcf31('0x57')](_0xf4a945);})[_0xcf31('0x24')](function(_0x4cb90f){_0x45f2b8[_0xcf31('0x58')]=_0x4cb90f;return _0x45f2b8;});}})[_0xcf31('0x24')](respondWithFilteredResult(_0x21520b,_0xf4a945))[_0xcf31('0x2f')](handleError(_0x21520b,null));};exports['removeAnswers']=function(_0x12411a,_0x1aaede,_0x5cfc2f){return db['OpenchannelAccount'][_0xcf31('0x5d')]({'where':{'id':_0x12411a[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x1aaede,null))[_0xcf31('0x24')](function(_0x28b0c){if(_0x28b0c){return _0x28b0c['removeAnswers'](_0x12411a[_0xcf31('0x46')][_0xcf31('0x6e')]);}})['then'](respondWithStatusCode(_0x1aaede,null))['catch'](handleError(_0x1aaede,null));};exports[_0xcf31('0x72')]=function(_0x1c0e2e,_0x1a59b4,_0x877b38){var _0x5ea208={'body':_0x1c0e2e['body'],'channel':'openchannel'};var _0x42816c=[];var _0xb9ea62=[];var _0x3a0887={};var _0x19c216=![];return db[_0xcf31('0x73')][_0xcf31('0x66')]()[_0xcf31('0x24')](function(_0x360ea0){if(!_0x360ea0){throw new db[(_0xcf31('0x74'))]['ValidationError'](_0xcf31('0x75'));}_0x42816c=_[_0xcf31('0x76')](_[_0xcf31('0x5b')](_0x360ea0),[_0xcf31('0x77'),_0xcf31('0x78')]);_0xb9ea62=_[_0xcf31('0x76')](_[_0xcf31('0x5b')](_0x360ea0),[_0xcf31('0x77'),_0xcf31('0x78'),'CompanyId',_0xcf31('0x79')]);if(_0x1c0e2e[_0xcf31('0x65')]['id']){delete _0x1c0e2e[_0xcf31('0x65')]['id'];}if(_[_0xcf31('0x7a')](_0x1c0e2e[_0xcf31('0x65')]['from'])){throw new db[(_0xcf31('0x74'))][(_0xcf31('0x7b'))]('from\x20is\x20mandatory');}if(_[_0xcf31('0x7a')](_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x65')])||_0x1c0e2e['body'][_0xcf31('0x65')]===''){throw new db['Sequelize']['ValidationError'](_0xcf31('0x7c'));}if(_[_0xcf31('0x7a')](_0x1c0e2e['body'][_0xcf31('0x7d')])){throw new db['Sequelize'][(_0xcf31('0x7b'))](_0xcf31('0x7e')+_0xb9ea62);}if(!_[_0xcf31('0x7f')](_0xb9ea62,_0x1c0e2e['body'][_0xcf31('0x7d')])){throw new db['Sequelize'][(_0xcf31('0x7b'))](_0xcf31('0x80')+_0xb9ea62);}_0x3a0887[_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x7d')]]=_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x81')];})['then'](function(){return db['OpenchannelAccount'][_0xcf31('0x5d')]({'where':{'id':_0x1c0e2e[_0xcf31('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xcf31('0x82'),'include':[{'model':db[_0xcf31('0x73')],'as':_0xcf31('0x83'),'where':_0x3a0887,'limit':0x1,'order':[['updatedAt',_0xcf31('0x84')]]}]},{'model':db[_0xcf31('0x85')],'as':_0xcf31('0x86')}]});})[_0xcf31('0x24')](handleEntityNotFound(_0x1a59b4,null))[_0xcf31('0x24')](function(_0x1012e3){if(_0x1012e3&&_0x1012e3['List']){_0x5ea208[_0xcf31('0x87')]=_0x1012e3;_0x5ea208[_0xcf31('0x88')]=_0x1012e3['Applications'];_0x5ea208['list']=_0x1012e3[_0xcf31('0x82')];_0x5ea208[_0xcf31('0x88')]=_[_0xcf31('0x89')](_0x5ea208[_0xcf31('0x88')],[_0xcf31('0x8a')],[_0xcf31('0x8b')]);if(_0x5ea208['account']['Applications']){delete _0x5ea208[_0xcf31('0x87')][_0xcf31('0x86')];}if(_0x5ea208[_0xcf31('0x87')][_0xcf31('0x82')]&&_0x5ea208[_0xcf31('0x87')][_0xcf31('0x82')]['Contacts'][_0xcf31('0x4a')]){return _0x5ea208[_0xcf31('0x87')][_0xcf31('0x82')][_0xcf31('0x83')][0x0];}var _0x466c96=_['defaults'](_0x1c0e2e[_0xcf31('0x65')],{'firstName':_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x81')],'ListId':_0x1012e3[_0xcf31('0x79')]});_0x466c96[_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x7d')]]=_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x81')];return db[_0xcf31('0x73')][_0xcf31('0x5e')](_0x466c96,{'fields':_0x42816c,'raw':!![]});}})['then'](handleEntityNotFound(_0x1a59b4,null))[_0xcf31('0x24')](function(_0x37d29e){_0x5ea208[_0xcf31('0x8c')]=_0x37d29e;if(_0x37d29e){var _0x4adb7d={'ContactId':_0x37d29e['id'],'OpenchannelAccountId':_0x1c0e2e[_0xcf31('0x5a')]['id'],'from':(_0x37d29e[_0xcf31('0x8d')]||'')+'\x20'+(_0x37d29e[_0xcf31('0x8e')]||'')};var _0x171163={'OpenchannelAccountId':_0x1c0e2e[_0xcf31('0x5a')]['id'],'closed':![]};if(_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x8f')]){_0x171163[_0xcf31('0x8f')]=_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x8f')];return db['OpenchannelInteraction'][_0xcf31('0x5d')]({'where':_0x171163})['then'](function(_0x338b1f){if(_0x338b1f){return[_0x338b1f,![]];}_0x4adb7d[_0xcf31('0x8f')]=_0x1c0e2e[_0xcf31('0x65')]['threadId'];_0x4adb7d[_0xcf31('0x90')]=_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x90')];return db[_0xcf31('0x91')][_0xcf31('0x5e')](_0x4adb7d)[_0xcf31('0x24')](function(_0x25ca63){return[_0x25ca63,!![]];});});}else{_0x171163['threadId']=null;}_0x171163[_0xcf31('0x92')]=_0x37d29e['id'];return db[_0xcf31('0x91')][_0xcf31('0x5d')]({'where':_0x171163})[_0xcf31('0x24')](function(_0x2d2ede){if(_0x2d2ede){return[_0x2d2ede,![]];}return db['OpenchannelInteraction'][_0xcf31('0x5e')](_0x4adb7d)[_0xcf31('0x24')](function(_0x41c6e8){return[_0x41c6e8,!![]];});});}})[_0xcf31('0x93')](function(_0x5f36a1,_0x204a3a){if(_0x5f36a1){_0x19c216=_0x204a3a;if(!_0x204a3a){var _0x4883dc={'from':(_0x5ea208[_0xcf31('0x8c')]['firstName']||'')+'\x20'+(_0x5ea208['contact'][_0xcf31('0x8e')]||'')};if(_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x8f')]&&_0x1c0e2e[_0xcf31('0x65')]['messageId']&&_0x1c0e2e['body'][_0xcf31('0x8f')]!=_0x1c0e2e['body']['messageId']){_0x4883dc['threadId']=_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x94')];}return _0x5f36a1['update'](_0x4883dc);}else{return _0x5f36a1;}}})[_0xcf31('0x24')](function(_0x41b20c){_0x5ea208[_0xcf31('0x95')]=_0x41b20c[_0xcf31('0x60')]({'plain':!![]});_0x5ea208['interaction'][_0xcf31('0x96')]=_0x19c216;if(_0x5ea208[_0xcf31('0x95')][_0xcf31('0x96')]){if(_0x5ea208[_0xcf31('0x87')][_0xcf31('0x97')]){_0x5ea208[_0xcf31('0x88')][_0xcf31('0x98')]({'id':0x0,'priority':_0x5ea208['applications'][_0xcf31('0x4a')]+0x1,'app':_0xcf31('0x99'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xcf31('0x9a')][_0xcf31('0x5e')]({'body':_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x65')],'OpenchannelAccountId':_0x1c0e2e[_0xcf31('0x5a')]['id'],'OpenchannelInteractionId':_0x41b20c['id'],'direction':'in','ContactId':_0x5ea208[_0xcf31('0x8c')]['id'],'AttachmentId':_0x1c0e2e[_0xcf31('0x65')][_0xcf31('0x9b')]});})[_0xcf31('0x24')](function(_0x486324){_0x5ea208['message']=_0x486324;if(_0x5ea208[_0xcf31('0x95')][_0xcf31('0x9c')]){return db['User'][_0xcf31('0x5d')]({'attributes':['id','name'],'where':{'id':_0x5ea208[_0xcf31('0x95')][_0xcf31('0x9c')]}})['then'](function(_0x496430){if(_0x496430){_0x5ea208[_0xcf31('0x88')][_0xcf31('0x9d')]({'id':0x0,'priority':0x0,'app':_0xcf31('0x9e'),'appdata':_0x496430['name']+','+(_0x5ea208[_0xcf31('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0xcf31('0x9f')});_0x5ea208[_0xcf31('0xa0')]=![];}return respondWithRpcPromise(_0xcf31('0xa1'),'startRouting',_0x5ea208);});}return respondWithRpcPromise(_0xcf31('0xa1'),_0xcf31('0xa2'),_0x5ea208);})[_0xcf31('0x24')](function(_0x9728d4){respondWithRpcPromise('EventManager',_0xcf31('0xa3'),{'event':_0xcf31('0x72'),'message':_0x9728d4},client9002);return _0x9728d4;})[_0xcf31('0x24')](respondWithResult(_0x1a59b4,null))[_0xcf31('0x2f')](handleError(_0x1a59b4,null));};exports[_0xcf31('0xa4')]=function(_0x1e2859,_0x3591f5,_0x465074){return db[_0xcf31('0x41')][_0xcf31('0x6a')]({'where':{'id':_0x1e2859[_0xcf31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3591f5,null))['then'](function(_0x50ea5d){if(_0x50ea5d){return db['sequelize'][_0xcf31('0xa5')](function(_0x2a8485){return db['OpenchannelApplication'][_0xcf31('0x37')]({'where':{'OpenchannelAccountId':_0x1e2859[_0xcf31('0x5a')]['id']},'transaction':_0x2a8485})['then'](function(_0x1374bb){var _0x2661e8=_[_0xcf31('0x40')](_0x1e2859[_0xcf31('0x65')],function(_0x5de166){_0x5de166[_0xcf31('0x70')]=_0x1e2859[_0xcf31('0x5a')]['id'];return _0x5de166;});return db[_0xcf31('0x85')][_0xcf31('0xa6')](_0x2661e8,{'transaction':_0x2a8485});});})[_0xcf31('0x24')](function(){return db[_0xcf31('0x85')][_0xcf31('0xa7')]({'where':{'OpenchannelAccountId':_0x1e2859['params']['id']},'order':_0xcf31('0x8a')});});}})[_0xcf31('0x24')](respondWithResult(_0x3591f5,null))[_0xcf31('0x2f')](handleError(_0x3591f5,null));};exports[_0xcf31('0xa8')]=function(_0x393666,_0x4b5d57,_0x4656a0){var _0x569696={};var _0x3a939b={};var _0x1f2e38;var _0x304c1b;return db[_0xcf31('0x41')][_0xcf31('0x6a')]({'where':{'id':_0x393666[_0xcf31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4b5d57,null))['then'](function(_0x3ff3fe){if(_0x3ff3fe){_0x1f2e38=_0x3ff3fe;_0x3a939b[_0xcf31('0x45')]=_[_0xcf31('0x5b')](db[_0xcf31('0x85')][_0xcf31('0x42')]);_0x3a939b[_0xcf31('0x46')]=_[_0xcf31('0x5b')](_0x393666[_0xcf31('0x46')]);_0x3a939b[_0xcf31('0x4f')]=_['intersection'](_0x3a939b[_0xcf31('0x45')],_0x3a939b['query']);_0x569696[_0xcf31('0x49')]=_[_0xcf31('0x47')](_0x3a939b['model'],qs[_0xcf31('0x48')](_0x393666['query']['fields']));_0x569696[_0xcf31('0x49')]=_0x569696['attributes'][_0xcf31('0x4a')]?_0x569696[_0xcf31('0x49')]:_0x3a939b[_0xcf31('0x45')];_0x569696[_0xcf31('0x6b')]=qs[_0xcf31('0x4e')](_0x393666[_0xcf31('0x46')][_0xcf31('0x4e')]);_0x569696[_0xcf31('0x50')]=qs[_0xcf31('0x4f')](_['pick'](_0x393666[_0xcf31('0x46')],_0x3a939b[_0xcf31('0x4f')]));if(_0x393666[_0xcf31('0x46')][_0xcf31('0x54')]){_0x569696['where']=_[_0xcf31('0x51')](_0x569696[_0xcf31('0x50')],{'$or':_['map'](_0x569696[_0xcf31('0x49')],function(_0x565709){var _0x1f273d={};_0x1f273d[_0x565709]={'$like':'%'+_0x393666[_0xcf31('0x46')][_0xcf31('0x54')]+'%'};return _0x1f273d;})});}_0x569696=_[_0xcf31('0x51')]({},_0x569696,_0x393666[_0xcf31('0x5c')]);return _0x1f2e38[_0xcf31('0xa8')](_0x569696);}})[_0xcf31('0x24')](function(_0x3a8a46){if(_0x3a8a46){_0x304c1b=_0x3a8a46[_0xcf31('0x4a')];if(!_0x393666[_0xcf31('0x46')][_0xcf31('0x4b')](_0xcf31('0x4c'))){_0x569696[_0xcf31('0x4d')]=qs[_0xcf31('0x4d')](_0x393666[_0xcf31('0x46')][_0xcf31('0x4d')]);_0x569696[_0xcf31('0x33')]=qs['offset'](_0x393666[_0xcf31('0x46')]['offset']);}return _0x1f2e38[_0xcf31('0xa8')](_0x569696);}})[_0xcf31('0x24')](function(_0x30b780){if(_0x30b780){return _0x30b780?{'count':_0x304c1b,'rows':_0x30b780}:null;}})['then'](respondWithResult(_0x4b5d57,null))[_0xcf31('0x2f')](handleError(_0x4b5d57,null));};exports[_0xcf31('0xa9')]=function(_0x1ffe59,_0x561210,_0xec77ce){var _0x799a50={'raw':![],'where':{}};var _0x41b94b={};var _0x52164f={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1ffe59[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x561210,null))[_0xcf31('0x24')](function(_0x1e5e56){if(_0x1e5e56){_0x41b94b['model']=_['keys'](db[_0xcf31('0x91')][_0xcf31('0x42')]);_0x41b94b[_0xcf31('0x46')]=_[_0xcf31('0x5b')](_0x1ffe59[_0xcf31('0x46')]);_0x41b94b['filters']=_[_0xcf31('0x47')](_0x41b94b[_0xcf31('0x45')],_0x41b94b[_0xcf31('0x46')]);_0x799a50['attributes']=_[_0xcf31('0x47')](_0x41b94b[_0xcf31('0x45')],qs[_0xcf31('0x48')](_0x1ffe59[_0xcf31('0x46')][_0xcf31('0x48')]));_0x799a50[_0xcf31('0x49')]=_0x799a50[_0xcf31('0x49')][_0xcf31('0x4a')]?_0x799a50[_0xcf31('0x49')]:_0x41b94b['model'];if(!_0x1ffe59['query'][_0xcf31('0x4b')](_0xcf31('0x4c'))){_0x799a50[_0xcf31('0x4d')]=qs[_0xcf31('0x4d')](_0x1ffe59[_0xcf31('0x46')][_0xcf31('0x4d')]);_0x799a50[_0xcf31('0x33')]=qs['offset'](_0x1ffe59[_0xcf31('0x46')][_0xcf31('0x33')]);}_0x799a50[_0xcf31('0x6b')]=qs[_0xcf31('0x4e')](_0x1ffe59[_0xcf31('0x46')][_0xcf31('0x4e')]);_0x799a50[_0xcf31('0x50')]=qs['filters'](_[_0xcf31('0x6c')](_0x1ffe59[_0xcf31('0x46')],_0x41b94b[_0xcf31('0x4f')]));_0x799a50['where'][_0xcf31('0x70')]=_0x1e5e56['id'];if(_0x1ffe59[_0xcf31('0x46')]['filter']){_0x799a50['where']=_[_0xcf31('0x51')](_0x799a50[_0xcf31('0x50')],{'$or':_[_0xcf31('0x40')](_0x799a50[_0xcf31('0x49')],function(_0x42c65c){var _0x402a44={};_0x402a44[_0x42c65c]={'$like':'%'+_0x1ffe59[_0xcf31('0x46')]['filter']+'%'};return _0x402a44;})});}_0x799a50=_['merge']({},_0x799a50,_0x1ffe59[_0xcf31('0x5c')]);return db['OpenchannelInteraction']['count']({'where':_0x799a50[_0xcf31('0x50')]})[_0xcf31('0x24')](function(_0x3a8a2e){_0x52164f[_0xcf31('0x32')]=_0x3a8a2e;if(_0x1ffe59[_0xcf31('0x46')][_0xcf31('0x55')]){_0x799a50[_0xcf31('0x56')]=[{'model':db[_0xcf31('0x73')],'as':_0xcf31('0xaa'),'required':![]},{'model':db[_0xcf31('0xab')],'as':_0xcf31('0xac'),'attributes':[_0xcf31('0x3c'),_0xcf31('0xad'),_0xcf31('0xae')],'required':![]},{'model':db[_0xcf31('0xaf')],'as':_0xcf31('0xb0'),'attributes':['id',_0xcf31('0x3c'),_0xcf31('0xb1')],'where':_0x1ffe59[_0xcf31('0x46')][_0xcf31('0xb2')]?{'id':_0x1ffe59[_0xcf31('0x46')][_0xcf31('0xb2')]}:undefined,'required':_0x1ffe59[_0xcf31('0x46')]['tag']?!![]:![]}];}return db[_0xcf31('0x91')][_0xcf31('0x57')](_0x799a50);})['then'](function(_0x1e821b){_0x52164f[_0xcf31('0x58')]=_0x1e821b;return _0x52164f;});}})['then'](respondWithFilteredResult(_0x561210,_0x799a50))['catch'](handleError(_0x561210,null));};exports[_0xcf31('0xb3')]=function(_0x46c912,_0x10127f,_0x3224c0){return db[_0xcf31('0x41')][_0xcf31('0x5d')]({'where':{'id':_0x46c912[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x10127f,null))[_0xcf31('0x24')](function(_0x39fc80){if(_0x39fc80){return _0x39fc80[_0xcf31('0xb3')](_0x46c912[_0xcf31('0x65')][_0xcf31('0x6e')],_['omit'](_0x46c912[_0xcf31('0x65')],[_0xcf31('0x6e'),'id'])||{})[_0xcf31('0x93')](function(_0x5a1ab9){for(var _0x4c6d46=0x0;_0x4c6d46<_0x46c912[_0xcf31('0x65')][_0xcf31('0x6e')][_0xcf31('0x4a')];_0x4c6d46+=0x1){socket[_0xcf31('0xb4')](_0xcf31('0xb5'),{'UserId':_0x46c912[_0xcf31('0x65')]['ids'][_0x4c6d46],'OpenchannelAccountId':_0x46c912['params']['id']});}return _0x5a1ab9;});}})['then'](respondWithResult(_0x10127f,null))[_0xcf31('0x2f')](handleError(_0x10127f,null));};exports['removeAgents']=function(_0x1b11e8,_0x37d1f3,_0x5e323c){return db[_0xcf31('0x41')][_0xcf31('0x5d')]({'where':{'id':_0x1b11e8[_0xcf31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x37d1f3,null))['then'](function(_0x342884){if(_0x342884){return _0x342884[_0xcf31('0xb6')](_0x1b11e8[_0xcf31('0x46')][_0xcf31('0x6e')])[_0xcf31('0x24')](function(){if(_['isArray'](_0x1b11e8['query'][_0xcf31('0x6e')])){for(var _0x4c9b94=0x0;_0x4c9b94<_0x1b11e8[_0xcf31('0x46')]['ids'][_0xcf31('0x4a')];_0x4c9b94+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1b11e8[_0xcf31('0x46')]['ids'][_0x4c9b94]),'OpenchannelAccountId':Number(_0x1b11e8[_0xcf31('0x5a')]['id'])});}}else{socket[_0xcf31('0xb4')](_0xcf31('0xb7'),{'UserId':Number(_0x1b11e8[_0xcf31('0x46')][_0xcf31('0x6e')]),'OpenchannelAccountId':Number(_0x1b11e8[_0xcf31('0x5a')]['id'])});}});}})[_0xcf31('0x24')](respondWithStatusCode(_0x37d1f3,null))[_0xcf31('0x2f')](handleError(_0x37d1f3,null));};exports['getAgents']=function(_0x47d4d1,_0x282c5d,_0x3ca1e0){var _0x360213={};var _0x4eafd1={};var _0x146c3b;var _0x183a39;return db['OpenchannelAccount'][_0xcf31('0x6a')]({'where':{'id':_0x47d4d1[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x282c5d,null))[_0xcf31('0x24')](function(_0xe3d91a){if(_0xe3d91a){_0x146c3b=_0xe3d91a;_0x4eafd1[_0xcf31('0x45')]=_[_0xcf31('0x5b')](db[_0xcf31('0xab')][_0xcf31('0x42')]);_0x4eafd1['query']=_[_0xcf31('0x5b')](_0x47d4d1[_0xcf31('0x46')]);_0x4eafd1['filters']=_[_0xcf31('0x47')](_0x4eafd1[_0xcf31('0x45')],_0x4eafd1[_0xcf31('0x46')]);_0x360213['attributes']=_[_0xcf31('0x47')](_0x4eafd1['model'],qs[_0xcf31('0x48')](_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x48')]));_0x360213[_0xcf31('0x49')]=_0x360213[_0xcf31('0x49')]['length']?_0x360213['attributes']:_0x4eafd1[_0xcf31('0x45')];_0x360213['order']=qs[_0xcf31('0x4e')](_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x4e')]);_0x360213[_0xcf31('0x50')]=qs[_0xcf31('0x4f')](_['pick'](_0x47d4d1[_0xcf31('0x46')],_0x4eafd1['filters']));if(_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x54')]){_0x360213[_0xcf31('0x50')]=_['merge'](_0x360213[_0xcf31('0x50')],{'$or':_[_0xcf31('0x40')](_0x360213[_0xcf31('0x49')],function(_0x55a1e0){var _0x431d6f={};_0x431d6f[_0x55a1e0]={'$like':'%'+_0x47d4d1[_0xcf31('0x46')]['filter']+'%'};return _0x431d6f;})});}_0x360213=_[_0xcf31('0x51')]({},_0x360213,_0x47d4d1[_0xcf31('0x5c')]);return _0x146c3b[_0xcf31('0xb8')](_0x360213);}})[_0xcf31('0x24')](function(_0x4ee0cf){if(_0x4ee0cf){_0x183a39=_0x4ee0cf[_0xcf31('0x4a')];if(!_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x4b')](_0xcf31('0x4c'))){_0x360213[_0xcf31('0x4d')]=qs[_0xcf31('0x4d')](_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x4d')]);_0x360213[_0xcf31('0x33')]=qs[_0xcf31('0x33')](_0x47d4d1[_0xcf31('0x46')][_0xcf31('0x33')]);}return _0x146c3b[_0xcf31('0xb8')](_0x360213);}})[_0xcf31('0x24')](function(_0x2b16e1){if(_0x2b16e1){return _0x2b16e1?{'count':_0x183a39,'rows':_0x2b16e1}:null;}})[_0xcf31('0x24')](respondWithResult(_0x282c5d,null))[_0xcf31('0x2f')](handleError(_0x282c5d,null));};exports[_0xcf31('0xb9')]=function(_0x19ff38,_0x21adb7,_0x476b54){var _0x50d5d1,_0x5e279d,_0x3656c4;if(_[_0xcf31('0x7a')](_0x19ff38['body']['body'])||_0x19ff38[_0xcf31('0x65')]['body']===''){throw new db[(_0xcf31('0x74'))][(_0xcf31('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcf31('0x7a')](_0x19ff38[_0xcf31('0x65')]['to'])){}_0x50d5d1=_0x19ff38[_0xcf31('0x65')]['to'];return db['OpenchannelAccount'][_0xcf31('0x6a')]({'where':{'id':_0x19ff38[_0xcf31('0x5a')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x21adb7,null))[_0xcf31('0x24')](function(_0xf708d9){if(_0xf708d9){return db[_0xcf31('0x41')][_0xcf31('0x5d')]({'where':{'id':_0xf708d9['id']},'include':[{'model':db['CmList'],'as':_0xcf31('0x82'),'include':[{'model':db[_0xcf31('0x73')],'as':'Contacts','where':{[_0xf708d9['mapKey']]:_0x50d5d1},'limit':0x1,'order':[[_0xcf31('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x21adb7,null))[_0xcf31('0x24')](function(_0xa77c35){if(_0xa77c35&&_0xa77c35['List']){_0x5e279d=_0xa77c35['get']({'plain':!![]});if(_0x5e279d[_0xcf31('0x82')]&&_0x5e279d[_0xcf31('0x82')][_0xcf31('0x83')][_0xcf31('0x4a')]){return _0x5e279d[_0xcf31('0x82')][_0xcf31('0x83')][0x0];}return db[_0xcf31('0x73')][_0xcf31('0x5e')](_[_0xcf31('0x1a')](_0x19ff38[_0xcf31('0x65')],{'firstName':_0x50d5d1,[_0xa77c35[_0xcf31('0x7d')]]:_0x50d5d1,'phone':_0x50d5d1,'ListId':_0x5e279d[_0xcf31('0x79')]}));}})[_0xcf31('0x24')](handleEntityNotFound(_0x21adb7,null))['then'](function(_0x8565aa){if(_0x8565aa){_0x3656c4=_0x8565aa;return db[_0xcf31('0x91')][_0xcf31('0x5d')]({'where':{'ContactId':_0x3656c4['id'],'closed':![],'OpenchannelAccountId':_0x5e279d['id']}})[_0xcf31('0x24')](function(_0x5c30d9){if(_0x5c30d9){return[_0x5c30d9,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x19ff38[_0xcf31('0x5f')]['id'],'ContactId':_0x3656c4['id'],'OpenchannelAccountId':_0x5e279d['id'],'lastMsgDirection':_0xcf31('0xba'),'Messages':[_['merge'](_0x19ff38[_0xcf31('0x65')],{'read':![],'body':_0x19ff38[_0xcf31('0x65')][_0xcf31('0x65')],'OpenchannelAccountId':_0x5e279d['id'],'UserId':_0x19ff38[_0xcf31('0x5f')]['id'],'ContactId':_0x3656c4['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})['then'](function(_0x23daf9){return[_0x23daf9,!![]];});});}})['spread'](function(_0x489379,_0x295463){if(_0x295463){return _0x489379;}return db[_0xcf31('0x9a')][_0xcf31('0x5e')](_[_0xcf31('0x51')](_0x19ff38[_0xcf31('0x65')],{'read':![],'body':_0x19ff38[_0xcf31('0x65')][_0xcf31('0x65')],'OpenchannelAccountId':_0x5e279d['id'],'OpenchannelInteractionId':_0x489379['id'],'UserId':_0x19ff38[_0xcf31('0x5f')]['id'],'ContactId':_0x3656c4['id']}))[_0xcf31('0x24')](function(_0x426494){_0x489379[_0xcf31('0xbb')][_0xcf31('0xbc')]=[];_0x489379[_0xcf31('0xbb')][_0xcf31('0xbc')][_0xcf31('0x98')](_0x426494[_0xcf31('0xbb')]);return _0x489379;});});}})[_0xcf31('0x24')](respondWithResult(_0x21adb7,null))[_0xcf31('0x2f')](handleError(_0x21adb7,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0a632ea..7767d72 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 _0x73e5=['save','remove','emit','events','OpenchannelAccount','setMaxListeners'];(function(_0x2b0ccf,_0x4fabf4){var _0x298350=function(_0xee99dd){while(--_0xee99dd){_0x2b0ccf['push'](_0x2b0ccf['shift']());}};_0x298350(++_0x4fabf4);}(_0x73e5,0xff));var _0x573e=function(_0x218e99,_0x4a364f){_0x218e99=_0x218e99-0x0;var _0x47da41=_0x73e5[_0x218e99];return _0x47da41;};'use strict';var EventEmitter=require(_0x573e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x573e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x573e('0x2')](0x0);var events={'afterCreate':_0x573e('0x3'),'afterUpdate':'update','afterDestroy':_0x573e('0x4')};function emitEvent(_0x195d96){return function(_0x44df59,_0x378e06,_0x2ec914){OpenchannelAccountEvents[_0x573e('0x5')](_0x195d96+':'+_0x44df59['id'],_0x44df59);OpenchannelAccountEvents['emit'](_0x195d96,_0x44df59);_0x2ec914(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xfc3d=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelAccount','save','remove'];(function(_0x2abcb2,_0x33f465){var _0x26fc4f=function(_0x5ba18a){while(--_0x5ba18a){_0x2abcb2['push'](_0x2abcb2['shift']());}};_0x26fc4f(++_0x33f465);}(_0xfc3d,0x6b));var _0xdfc3=function(_0x390fde,_0x289d10){_0x390fde=_0x390fde-0x0;var _0x2d01cd=_0xfc3d[_0x390fde];return _0x2d01cd;};'use strict';var EventEmitter=require(_0xdfc3('0x0'));var OpenchannelAccount=require(_0xdfc3('0x1'))['db'][_0xdfc3('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdfc3('0x3'),'afterUpdate':'update','afterDestroy':_0xdfc3('0x4')};function emitEvent(_0x292434){return function(_0x1ab140,_0x44f76d,_0x33ef08){OpenchannelAccountEvents[_0xdfc3('0x5')](_0x292434+':'+_0x1ab140['id'],_0x1ab140);OpenchannelAccountEvents[_0xdfc3('0x5')](_0x292434,_0x1ab140);_0x33ef08(null);};}for(var e in events){if(events[_0xdfc3('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xdfc3('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3f53b83..e6b59da 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 _0x888a=['request-promise','path','../../config/environment','exports','define','OpenchannelAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x888a,0xcc));var _0xa888=function(_0x2cd3d3,_0x33e9ad){_0x2cd3d3=_0x2cd3d3-0x0;var _0x14a15a=_0x888a[_0x2cd3d3];return _0x14a15a;};'use strict';var _=require(_0xa888('0x0'));var util=require(_0xa888('0x1'));var logger=require(_0xa888('0x2'))(_0xa888('0x3'));var moment=require('moment');var BPromise=require(_0xa888('0x4'));var rp=require(_0xa888('0x5'));var fs=require('fs');var path=require(_0xa888('0x6'));var rimraf=require('rimraf');var config=require(_0xa888('0x7'));var attributes=require('./openchannelAccount.attributes');module[_0xa888('0x8')]=function(_0x4c5b23,_0x30b683){return _0x4c5b23[_0xa888('0x9')](_0xa888('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42fe=['define','openchannel_accounts','util','moment','bluebird','request-promise','path','../../config/environment','./openchannelAccount.attributes','exports'];(function(_0x5e8da,_0x3b8359){var _0x353a55=function(_0x140e21){while(--_0x140e21){_0x5e8da['push'](_0x5e8da['shift']());}};_0x353a55(++_0x3b8359);}(_0x42fe,0x12e));var _0xe42f=function(_0x291e0e,_0x792683){_0x291e0e=_0x291e0e-0x0;var _0x3f85f3=_0x42fe[_0x291e0e];return _0x3f85f3;};'use strict';var _=require('lodash');var util=require(_0xe42f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe42f('0x1'));var BPromise=require(_0xe42f('0x2'));var rp=require(_0xe42f('0x3'));var fs=require('fs');var path=require(_0xe42f('0x4'));var rimraf=require('rimraf');var config=require(_0xe42f('0x5'));var attributes=require(_0xe42f('0x6'));module[_0xe42f('0x7')]=function(_0x382442,_0x1f08c3){return _0x382442[_0xe42f('0x8')]('OpenchannelAccount',attributes,{'tableName':_0xe42f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 12b42c2..0128bb2 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 _0xccc5=['info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x174601,_0x23909d){var _0x3dfff5=function(_0x5a24bf){while(--_0x5a24bf){_0x174601['push'](_0x174601['shift']());}};_0x3dfff5(++_0x23909d);}(_0xccc5,0x116));var _0x5ccc=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xccc5[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x5ccc('0x0'));var moment=require(_0x5ccc('0x1'));var BPromise=require(_0x5ccc('0x2'));var rs=require(_0x5ccc('0x3'));var fs=require('fs');var Redis=require(_0x5ccc('0x4'));var db=require(_0x5ccc('0x5'))['db'];var utils=require(_0x5ccc('0x6'));var logger=require(_0x5ccc('0x7'))(_0x5ccc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5ccc('0x9')]({'port':0x232a});config[_0x5ccc('0xa')]=_[_0x5ccc('0xb')](config[_0x5ccc('0xa')],{'host':_0x5ccc('0xc'),'port':0x18eb});var socket=require(_0x5ccc('0xd'))(new Redis(config['redis']));require(_0x5ccc('0xe'))['register'](socket);function respondWithRpcPromise(_0x328f74,_0x45b852,_0x554d3d){return new BPromise(function(_0x19fecc,_0xceef2d){return client[_0x5ccc('0xf')](_0x328f74,_0x554d3d)['then'](function(_0x4baa06){logger['info'](_0x5ccc('0x10'),_0x45b852,_0x5ccc('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45b852,'request\x20sent',JSON[_0x5ccc('0x12')](_0x4baa06));if(_0x4baa06[_0x5ccc('0x13')]){if(_0x4baa06[_0x5ccc('0x13')]['code']===0x1f4){logger[_0x5ccc('0x13')](_0x5ccc('0x10'),_0x45b852,_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);return _0xceef2d(_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);}logger[_0x5ccc('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x45b852,_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);return _0x19fecc(_0x4baa06[_0x5ccc('0x13')][_0x5ccc('0x14')]);}else{logger[_0x5ccc('0x15')](_0x5ccc('0x10'),_0x45b852,_0x5ccc('0x11'));_0x19fecc(_0x4baa06['result'][_0x5ccc('0x14')]);}})[_0x5ccc('0x16')](function(_0x483e50){logger[_0x5ccc('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x45b852,_0x483e50);_0xceef2d(_0x483e50);});});} \ No newline at end of file +var _0xc784=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc784,0x156));var _0x4c78=function(_0x2851ce,_0x16ba11){_0x2851ce=_0x2851ce-0x0;var _0x4160d9=_0xc784[_0x2851ce];return _0x4160d9;};'use strict';var _=require(_0x4c78('0x0'));var util=require(_0x4c78('0x1'));var moment=require(_0x4c78('0x2'));var BPromise=require(_0x4c78('0x3'));var rs=require(_0x4c78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c78('0x6'))(_0x4c78('0x7'));var config=require(_0x4c78('0x8'));var jayson=require(_0x4c78('0x9'));var client=jayson['client'][_0x4c78('0xa')]({'port':0x232a});config[_0x4c78('0xb')]=_['defaults'](config[_0x4c78('0xb')],{'host':_0x4c78('0xc'),'port':0x18eb});var socket=require(_0x4c78('0xd'))(new Redis(config[_0x4c78('0xb')]));require(_0x4c78('0xe'))[_0x4c78('0xf')](socket);function respondWithRpcPromise(_0x45b8ea,_0x44e155,_0x237e6e){return new BPromise(function(_0x4aba28,_0x5e3866){return client[_0x4c78('0x10')](_0x45b8ea,_0x237e6e)[_0x4c78('0x11')](function(_0x14d3bf){logger[_0x4c78('0x12')](_0x4c78('0x13'),_0x44e155,'request\x20sent');logger[_0x4c78('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x44e155,_0x4c78('0x15'),JSON[_0x4c78('0x16')](_0x14d3bf));if(_0x14d3bf[_0x4c78('0x17')]){if(_0x14d3bf[_0x4c78('0x17')]['code']===0x1f4){logger[_0x4c78('0x17')](_0x4c78('0x13'),_0x44e155,_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);return _0x5e3866(_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);}logger['error'](_0x4c78('0x13'),_0x44e155,_0x14d3bf[_0x4c78('0x17')]['message']);return _0x4aba28(_0x14d3bf[_0x4c78('0x17')][_0x4c78('0x18')]);}else{logger[_0x4c78('0x12')](_0x4c78('0x13'),_0x44e155,'request\x20sent');_0x4aba28(_0x14d3bf[_0x4c78('0x19')][_0x4c78('0x18')]);}})['catch'](function(_0x309d7e){logger[_0x4c78('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x44e155,_0x309d7e);_0x5e3866(_0x309d7e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 646f20e..6295ded 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 _0xe3c3=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x515f1c,_0x4eb731){var _0x324982=function(_0x3c9911){while(--_0x3c9911){_0x515f1c['push'](_0x515f1c['shift']());}};_0x324982(++_0x4eb731);}(_0xe3c3,0x10a));var _0x3e3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe3c3[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x3e3c('0x0'));var events=[_0x3e3c('0x1'),_0x3e3c('0x2'),_0x3e3c('0x3')];function createListener(_0x22fa24,_0x43bfb0){return function(_0x449aab){_0x43bfb0['emit'](_0x22fa24,_0x449aab);};}function removeListener(_0x44b759,_0x1dda7a){return function(){OpenchannelAccountEvents['removeListener'](_0x44b759,_0x1dda7a);};}exports['register']=function(_0x2fae35){for(var _0x34ddd6=0x0,_0x58de82=events[_0x3e3c('0x4')];_0x34ddd6<_0x58de82;_0x34ddd6++){var _0x11d16e=events[_0x34ddd6];var _0x2cf958=createListener(_0x3e3c('0x5')+_0x11d16e,_0x2fae35);OpenchannelAccountEvents['on'](_0x11d16e,_0x2cf958);}}; \ No newline at end of file +var _0xdda6=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xdda6,0x16c));var _0x6dda=function(_0x54c977,_0x382295){_0x54c977=_0x54c977-0x0;var _0x53a048=_0xdda6[_0x54c977];return _0x53a048;};'use strict';var OpenchannelAccountEvents=require(_0x6dda('0x0'));var events=[_0x6dda('0x1'),_0x6dda('0x2'),_0x6dda('0x3')];function createListener(_0x4d96db,_0x3c1a64){return function(_0xe9cd07){_0x3c1a64[_0x6dda('0x4')](_0x4d96db,_0xe9cd07);};}function removeListener(_0x12f7f4,_0x52dae6){return function(){OpenchannelAccountEvents[_0x6dda('0x5')](_0x12f7f4,_0x52dae6);};}exports[_0x6dda('0x6')]=function(_0x4ba4ba){for(var _0x4a379f=0x0,_0x459c89=events[_0x6dda('0x7')];_0x4a379f<_0x459c89;_0x4a379f++){var _0x1dd3da=events[_0x4a379f];var _0x182b22=createListener(_0x6dda('0x8')+_0x1dd3da,_0x4ba4ba);OpenchannelAccountEvents['on'](_0x1dd3da,_0x182b22);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3be041f..057039e 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 _0x2534=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2534,0x11f));var _0x4253=function(_0xec109b,_0x30f69d){_0xec109b=_0xec109b-0x0;var _0x56bf40=_0x2534[_0xec109b];return _0x56bf40;};'use strict';var multer=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var path=require(_0x4253('0x2'));var timeout=require(_0x4253('0x3'));var express=require(_0x4253('0x4'));var router=express[_0x4253('0x5')]();var auth=require(_0x4253('0x6'));var interaction=require(_0x4253('0x7'));var config=require(_0x4253('0x8'));var controller=require(_0x4253('0x9'));router[_0x4253('0xa')]('/',auth[_0x4253('0xb')](),controller[_0x4253('0xc')]);router[_0x4253('0xa')](_0x4253('0xd'),auth[_0x4253('0xb')](),controller[_0x4253('0xe')]);router[_0x4253('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4253('0x10')]('/:id',auth[_0x4253('0xb')](),controller[_0x4253('0x11')]);router[_0x4253('0x12')]('/:id',auth[_0x4253('0xb')](),controller[_0x4253('0x13')]);module[_0x4253('0x14')]=router; \ No newline at end of file +var _0xb2f4=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb2f4,0x157));var _0x4b2f=function(_0x5aabcb,_0x219fbd){_0x5aabcb=_0x5aabcb-0x0;var _0x4b6e71=_0xb2f4[_0x5aabcb];return _0x4b6e71;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b2f('0x0'));var timeout=require(_0x4b2f('0x1'));var express=require('express');var router=express[_0x4b2f('0x2')]();var auth=require(_0x4b2f('0x3'));var interaction=require(_0x4b2f('0x4'));var config=require(_0x4b2f('0x5'));var controller=require('./openchannelApplication.controller');router[_0x4b2f('0x6')]('/',auth['isAuthenticated'](),controller[_0x4b2f('0x7')]);router[_0x4b2f('0x6')](_0x4b2f('0x8'),auth[_0x4b2f('0x9')](),controller[_0x4b2f('0xa')]);router[_0x4b2f('0xb')]('/',auth[_0x4b2f('0x9')](),controller[_0x4b2f('0xc')]);router[_0x4b2f('0xd')]('/:id',auth[_0x4b2f('0x9')](),controller[_0x4b2f('0xe')]);router[_0x4b2f('0xf')](_0x4b2f('0x8'),auth[_0x4b2f('0x9')](),controller[_0x4b2f('0x10')]);module[_0x4b2f('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 01fec57..5e39e9b 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 _0x39d2=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0xa201ee,_0x37da32){var _0x3e104d=function(_0x4cd637){while(--_0x4cd637){_0xa201ee['push'](_0xa201ee['shift']());}};_0x3e104d(++_0x37da32);}(_0x39d2,0x194));var _0x239d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x39d2[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x239d('0x0'));module[_0x239d('0x1')]={'priority':{'type':Sequelize[_0x239d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x239d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x239d('0x4')],'defaultValue':_0x239d('0x5')}}; \ No newline at end of file +var _0x30db=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x31f8a0,_0x1e3391){var _0x319328=function(_0x578f38){while(--_0x578f38){_0x31f8a0['push'](_0x31f8a0['shift']());}};_0x319328(++_0x1e3391);}(_0x30db,0x7c));var _0xb30d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x30db[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xb30d('0x0'));module[_0xb30d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb30d('0x2')],'allowNull':![],'defaultValue':_0xb30d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb30d('0x2')]},'interval':{'type':Sequelize[_0xb30d('0x2')],'defaultValue':_0xb30d('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a01e271..f644626 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 _0x2b16=['sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x2a3367,_0x25913a){var _0x230264=function(_0xffa54a){while(--_0xffa54a){_0x2a3367['push'](_0x2a3367['shift']());}};_0x230264(++_0x25913a);}(_0x2b16,0x127));var _0x62b1=function(_0xc9bab3,_0x4f2359){_0xc9bab3=_0xc9bab3-0x0;var _0x27ff0a=_0x2b16[_0xc9bab3];return _0x27ff0a;};'use strict';var pdf=require(_0x62b1('0x0'));var emlformat=require(_0x62b1('0x1'));var rimraf=require(_0x62b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62b1('0x3'));var rp=require('request-promise');var moment=require(_0x62b1('0x4'));var BPromise=require(_0x62b1('0x5'));var Mustache=require(_0x62b1('0x6'));var util=require(_0x62b1('0x7'));var path=require(_0x62b1('0x8'));var sox=require(_0x62b1('0x9'));var csv=require(_0x62b1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62b1('0xb'));var squel=require(_0x62b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x62b1('0xd'));var deskjs=require(_0x62b1('0xe'));var toCsv=require(_0x62b1('0xa'));var querystring=require(_0x62b1('0xf'));var Papa=require(_0x62b1('0x10'));var Redis=require(_0x62b1('0x11'));var authService=require(_0x62b1('0x12'));var qs=require(_0x62b1('0x13'));var as=require(_0x62b1('0x14'));var hardwareService=require(_0x62b1('0x15'));var logger=require('../../config/logger')(_0x62b1('0x16'));var utils=require(_0x62b1('0x17'));var config=require(_0x62b1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10829e,_0x401a85){_0x401a85=_0x401a85||0xcc;return function(_0xe43bf9){if(_0xe43bf9){return _0x10829e[_0x62b1('0x19')](_0x401a85);}return _0x10829e[_0x62b1('0x1a')](_0x401a85)['end']();};}function respondWithResult(_0x278571,_0x11a280){_0x11a280=_0x11a280||0xc8;return function(_0x5a0f34){if(_0x5a0f34){return _0x278571[_0x62b1('0x1a')](_0x11a280)[_0x62b1('0x1b')](_0x5a0f34);}};}function respondWithFilteredResult(_0xeadf3b,_0x52fe8c){return function(_0xda139a){if(_0xda139a){var _0x583844=_0xda139a['count'],_0x36f076=_0x52fe8c[_0x62b1('0x1c')],_0x5d2438=_0x52fe8c[_0x62b1('0x1c')]+_0x52fe8c[_0x62b1('0x1d')],_0x3e2e95;if(_0x5d2438>=_0x583844){_0x5d2438=_0x583844;_0x3e2e95=0xc8;}else{_0x3e2e95=0xce;}_0xeadf3b[_0x62b1('0x1a')](_0x3e2e95);return _0xeadf3b[_0x62b1('0x1e')](_0x62b1('0x1f'),_0x36f076+'-'+_0x5d2438+'/'+_0x583844)['json'](_0xda139a);}return null;};}function patchUpdates(_0x23d763){return function(_0x1802b8){try{jsonpatch[_0x62b1('0x20')](_0x1802b8,_0x23d763,!![]);}catch(_0x488deb){return BPromise['reject'](_0x488deb);}return _0x1802b8[_0x62b1('0x21')]();};}function saveUpdates(_0x434546,_0x11739a){return function(_0x1e1595){if(_0x1e1595){return _0x1e1595[_0x62b1('0x22')](_0x434546)[_0x62b1('0x23')](function(_0x149e53){return _0x149e53;});}return null;};}function removeEntity(_0x429234,_0x84f8af){return function(_0x355752){if(_0x355752){return _0x355752['destroy']()[_0x62b1('0x23')](function(){_0x429234[_0x62b1('0x1a')](0xcc)[_0x62b1('0x24')]();});}};}function handleEntityNotFound(_0x3d46fa,_0x1cc987){return function(_0x2ec0d1){if(!_0x2ec0d1){_0x3d46fa[_0x62b1('0x19')](0x194);}return _0x2ec0d1;};}function handleError(_0x37f56c,_0x3d1f6c){_0x3d1f6c=_0x3d1f6c||0x1f4;return function(_0xad4a26){logger[_0x62b1('0x25')](_0xad4a26[_0x62b1('0x26')]);if(_0xad4a26[_0x62b1('0x27')]){delete _0xad4a26['name'];}_0x37f56c[_0x62b1('0x1a')](_0x3d1f6c)[_0x62b1('0x28')](_0xad4a26);};}exports[_0x62b1('0x29')]=function(_0x1eb5b5,_0x58ea7a){var _0x44bd2a={},_0x3c849a={},_0x52bb1c={'count':0x0,'rows':[]};var _0x5e70b5=_[_0x62b1('0x2a')](db[_0x62b1('0x2b')][_0x62b1('0x2c')],function(_0x21e7d3){return{'name':_0x21e7d3[_0x62b1('0x2d')],'type':_0x21e7d3[_0x62b1('0x2e')][_0x62b1('0x2f')]};});_0x3c849a[_0x62b1('0x30')]=_[_0x62b1('0x2a')](_0x5e70b5,_0x62b1('0x27'));_0x3c849a[_0x62b1('0x31')]=_['keys'](_0x1eb5b5[_0x62b1('0x31')]);_0x3c849a[_0x62b1('0x32')]=_[_0x62b1('0x33')](_0x3c849a[_0x62b1('0x30')],_0x3c849a['query']);_0x44bd2a[_0x62b1('0x34')]=_[_0x62b1('0x33')](_0x3c849a['model'],qs[_0x62b1('0x35')](_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x35')]));_0x44bd2a[_0x62b1('0x34')]=_0x44bd2a[_0x62b1('0x34')][_0x62b1('0x36')]?_0x44bd2a[_0x62b1('0x34')]:_0x3c849a[_0x62b1('0x30')];if(!_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x37')]('nolimit')){_0x44bd2a[_0x62b1('0x1d')]=qs['limit'](_0x1eb5b5[_0x62b1('0x31')]['limit']);_0x44bd2a[_0x62b1('0x1c')]=qs[_0x62b1('0x1c')](_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x1c')]);}_0x44bd2a[_0x62b1('0x38')]=qs[_0x62b1('0x39')](_0x1eb5b5[_0x62b1('0x31')]['sort']);_0x44bd2a[_0x62b1('0x3a')]=qs[_0x62b1('0x32')](_[_0x62b1('0x3b')](_0x1eb5b5[_0x62b1('0x31')],_0x3c849a[_0x62b1('0x32')]),_0x5e70b5);if(_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x3c')]){_0x44bd2a['where']=_[_0x62b1('0x3d')](_0x44bd2a['where'],{'$or':_[_0x62b1('0x2a')](_0x5e70b5,function(_0x587e84){if(_0x587e84[_0x62b1('0x2e')]!==_0x62b1('0x3e')){var _0x469fa5={};_0x469fa5[_0x587e84[_0x62b1('0x27')]]={'$like':'%'+_0x1eb5b5['query']['filter']+'%'};return _0x469fa5;}})});}_0x44bd2a=_['merge']({},_0x44bd2a,_0x1eb5b5[_0x62b1('0x3f')]);var _0x3c3d4a={'where':_0x44bd2a[_0x62b1('0x3a')]};return db[_0x62b1('0x2b')]['count'](_0x3c3d4a)[_0x62b1('0x23')](function(_0x4e5cf4){_0x52bb1c[_0x62b1('0x40')]=_0x4e5cf4;if(_0x1eb5b5[_0x62b1('0x31')][_0x62b1('0x41')]){_0x44bd2a[_0x62b1('0x42')]=[{'all':!![]}];}return db[_0x62b1('0x2b')]['findAll'](_0x44bd2a);})[_0x62b1('0x23')](function(_0x10a475){_0x52bb1c[_0x62b1('0x43')]=_0x10a475;return _0x52bb1c;})[_0x62b1('0x23')](respondWithFilteredResult(_0x58ea7a,_0x44bd2a))[_0x62b1('0x44')](handleError(_0x58ea7a,null));};exports[_0x62b1('0x45')]=function(_0xe2d384,_0x3ac7d7){var _0x2932d7={'raw':!![],'where':{'id':_0xe2d384[_0x62b1('0x46')]['id']}},_0x50e72f={};_0x50e72f['model']=_[_0x62b1('0x47')](db[_0x62b1('0x2b')]['rawAttributes']);_0x50e72f[_0x62b1('0x31')]=_['keys'](_0xe2d384[_0x62b1('0x31')]);_0x50e72f[_0x62b1('0x32')]=_[_0x62b1('0x33')](_0x50e72f[_0x62b1('0x30')],_0x50e72f[_0x62b1('0x31')]);_0x2932d7[_0x62b1('0x34')]=_['intersection'](_0x50e72f[_0x62b1('0x30')],qs['fields'](_0xe2d384[_0x62b1('0x31')]['fields']));_0x2932d7['attributes']=_0x2932d7[_0x62b1('0x34')][_0x62b1('0x36')]?_0x2932d7['attributes']:_0x50e72f[_0x62b1('0x30')];if(_0xe2d384['query'][_0x62b1('0x41')]){_0x2932d7[_0x62b1('0x42')]=[{'all':!![]}];}_0x2932d7=_[_0x62b1('0x3d')]({},_0x2932d7,_0xe2d384[_0x62b1('0x3f')]);return db[_0x62b1('0x2b')]['find'](_0x2932d7)['then'](handleEntityNotFound(_0x3ac7d7,null))[_0x62b1('0x23')](respondWithResult(_0x3ac7d7,null))[_0x62b1('0x44')](handleError(_0x3ac7d7,null));};exports[_0x62b1('0x48')]=function(_0x43d2fd,_0x423dfc){return db[_0x62b1('0x2b')][_0x62b1('0x48')](_0x43d2fd['body'],{})['then'](respondWithResult(_0x423dfc,0xc9))[_0x62b1('0x44')](handleError(_0x423dfc,null));};exports[_0x62b1('0x22')]=function(_0x9a4b3c,_0x32bcea){if(_0x9a4b3c[_0x62b1('0x49')]['id']){delete _0x9a4b3c['body']['id'];}return db[_0x62b1('0x2b')][_0x62b1('0x4a')]({'where':{'id':_0x9a4b3c[_0x62b1('0x46')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x32bcea,null))['then'](saveUpdates(_0x9a4b3c['body'],null))[_0x62b1('0x23')](respondWithResult(_0x32bcea,null))['catch'](handleError(_0x32bcea,null));};exports[_0x62b1('0x4b')]=function(_0x13f181,_0x405e59){return db[_0x62b1('0x2b')]['find']({'where':{'id':_0x13f181[_0x62b1('0x46')]['id']}})[_0x62b1('0x23')](handleEntityNotFound(_0x405e59,null))[_0x62b1('0x23')](removeEntity(_0x405e59,null))[_0x62b1('0x44')](handleError(_0x405e59,null));}; \ No newline at end of file +var _0x8a28=['index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x1553ef,_0x25ba3d){var _0x4ea271=function(_0x2c4d4a){while(--_0x2c4d4a){_0x1553ef['push'](_0x1553ef['shift']());}};_0x4ea271(++_0x25ba3d);}(_0x8a28,0x14a));var _0x88a2=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x8a28[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x88a2('0x0'));var emlformat=require(_0x88a2('0x1'));var rimraf=require(_0x88a2('0x2'));var zipdir=require(_0x88a2('0x3'));var jsonpatch=require(_0x88a2('0x4'));var rp=require(_0x88a2('0x5'));var moment=require(_0x88a2('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88a2('0x7'));var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require('to-csv');var ejs=require(_0x88a2('0xa'));var fs=require('fs');var _=require(_0x88a2('0xb'));var squel=require(_0x88a2('0xc'));var crypto=require(_0x88a2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x88a2('0xe'));var toCsv=require(_0x88a2('0xf'));var querystring=require(_0x88a2('0x10'));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('../../config/license/hardware');var logger=require(_0x88a2('0x11'))(_0x88a2('0x12'));var utils=require(_0x88a2('0x13'));var config=require(_0x88a2('0x14'));var db=require(_0x88a2('0x15'))['db'];function respondWithStatusCode(_0x5089ca,_0x2c0cbb){_0x2c0cbb=_0x2c0cbb||0xcc;return function(_0x3e4582){if(_0x3e4582){return _0x5089ca[_0x88a2('0x16')](_0x2c0cbb);}return _0x5089ca[_0x88a2('0x17')](_0x2c0cbb)['end']();};}function respondWithResult(_0x7b9282,_0x1191e2){_0x1191e2=_0x1191e2||0xc8;return function(_0x232d2f){if(_0x232d2f){return _0x7b9282[_0x88a2('0x17')](_0x1191e2)[_0x88a2('0x18')](_0x232d2f);}};}function respondWithFilteredResult(_0x17a488,_0x37d4fb){return function(_0x34692c){if(_0x34692c){var _0x27ecd1=_0x34692c[_0x88a2('0x19')],_0x32fb65=_0x37d4fb[_0x88a2('0x1a')],_0x13fa9e=_0x37d4fb[_0x88a2('0x1a')]+_0x37d4fb[_0x88a2('0x1b')],_0x57660d;if(_0x13fa9e>=_0x27ecd1){_0x13fa9e=_0x27ecd1;_0x57660d=0xc8;}else{_0x57660d=0xce;}_0x17a488[_0x88a2('0x17')](_0x57660d);return _0x17a488[_0x88a2('0x1c')](_0x88a2('0x1d'),_0x32fb65+'-'+_0x13fa9e+'/'+_0x27ecd1)[_0x88a2('0x18')](_0x34692c);}return null;};}function patchUpdates(_0x3d51c3){return function(_0x42e102){try{jsonpatch[_0x88a2('0x1e')](_0x42e102,_0x3d51c3,!![]);}catch(_0x5b8c14){return BPromise[_0x88a2('0x1f')](_0x5b8c14);}return _0x42e102[_0x88a2('0x20')]();};}function saveUpdates(_0x568cc4,_0x5b4b79){return function(_0x499a69){if(_0x499a69){return _0x499a69[_0x88a2('0x21')](_0x568cc4)[_0x88a2('0x22')](function(_0x541bf5){return _0x541bf5;});}return null;};}function removeEntity(_0x3ae538,_0xdf6e19){return function(_0x3720f2){if(_0x3720f2){return _0x3720f2[_0x88a2('0x23')]()[_0x88a2('0x22')](function(){_0x3ae538['status'](0xcc)[_0x88a2('0x24')]();});}};}function handleEntityNotFound(_0x28dda2,_0x53d11b){return function(_0x1ecd94){if(!_0x1ecd94){_0x28dda2[_0x88a2('0x16')](0x194);}return _0x1ecd94;};}function handleError(_0x4a21ad,_0x1f1f8e){_0x1f1f8e=_0x1f1f8e||0x1f4;return function(_0x4b38fd){logger[_0x88a2('0x25')](_0x4b38fd[_0x88a2('0x26')]);if(_0x4b38fd[_0x88a2('0x27')]){delete _0x4b38fd[_0x88a2('0x27')];}_0x4a21ad[_0x88a2('0x17')](_0x1f1f8e)['send'](_0x4b38fd);};}exports[_0x88a2('0x28')]=function(_0xb06c5f,_0x47d82d){var _0x708eb9={},_0x4320b1={},_0x3a50a8={'count':0x0,'rows':[]};var _0x5eed0c=_[_0x88a2('0x29')](db[_0x88a2('0x2a')][_0x88a2('0x2b')],function(_0x293424){return{'name':_0x293424[_0x88a2('0x2c')],'type':_0x293424['type'][_0x88a2('0x2d')]};});_0x4320b1[_0x88a2('0x2e')]=_[_0x88a2('0x29')](_0x5eed0c,_0x88a2('0x27'));_0x4320b1[_0x88a2('0x2f')]=_[_0x88a2('0x30')](_0xb06c5f[_0x88a2('0x2f')]);_0x4320b1['filters']=_[_0x88a2('0x31')](_0x4320b1[_0x88a2('0x2e')],_0x4320b1[_0x88a2('0x2f')]);_0x708eb9[_0x88a2('0x32')]=_[_0x88a2('0x31')](_0x4320b1[_0x88a2('0x2e')],qs[_0x88a2('0x33')](_0xb06c5f[_0x88a2('0x2f')][_0x88a2('0x33')]));_0x708eb9[_0x88a2('0x32')]=_0x708eb9[_0x88a2('0x32')][_0x88a2('0x34')]?_0x708eb9[_0x88a2('0x32')]:_0x4320b1['model'];if(!_0xb06c5f[_0x88a2('0x2f')][_0x88a2('0x35')](_0x88a2('0x36'))){_0x708eb9[_0x88a2('0x1b')]=qs[_0x88a2('0x1b')](_0xb06c5f['query'][_0x88a2('0x1b')]);_0x708eb9[_0x88a2('0x1a')]=qs['offset'](_0xb06c5f[_0x88a2('0x2f')]['offset']);}_0x708eb9[_0x88a2('0x37')]=qs[_0x88a2('0x38')](_0xb06c5f['query']['sort']);_0x708eb9[_0x88a2('0x39')]=qs[_0x88a2('0x3a')](_['pick'](_0xb06c5f[_0x88a2('0x2f')],_0x4320b1[_0x88a2('0x3a')]),_0x5eed0c);if(_0xb06c5f[_0x88a2('0x2f')][_0x88a2('0x3b')]){_0x708eb9[_0x88a2('0x39')]=_[_0x88a2('0x3c')](_0x708eb9['where'],{'$or':_[_0x88a2('0x29')](_0x5eed0c,function(_0x84217f){if(_0x84217f[_0x88a2('0x3d')]!==_0x88a2('0x3e')){var _0xb83671={};_0xb83671[_0x84217f[_0x88a2('0x27')]]={'$like':'%'+_0xb06c5f[_0x88a2('0x2f')][_0x88a2('0x3b')]+'%'};return _0xb83671;}})});}_0x708eb9=_['merge']({},_0x708eb9,_0xb06c5f['options']);var _0x79ca31={'where':_0x708eb9[_0x88a2('0x39')]};return db[_0x88a2('0x2a')][_0x88a2('0x19')](_0x79ca31)[_0x88a2('0x22')](function(_0x4d354b){_0x3a50a8['count']=_0x4d354b;if(_0xb06c5f[_0x88a2('0x2f')][_0x88a2('0x3f')]){_0x708eb9['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x88a2('0x40')](_0x708eb9);})['then'](function(_0x61ea15){_0x3a50a8[_0x88a2('0x41')]=_0x61ea15;return _0x3a50a8;})['then'](respondWithFilteredResult(_0x47d82d,_0x708eb9))[_0x88a2('0x42')](handleError(_0x47d82d,null));};exports[_0x88a2('0x43')]=function(_0x36ad8a,_0x5ea5d0){var _0x42f6f6={'raw':!![],'where':{'id':_0x36ad8a[_0x88a2('0x44')]['id']}},_0x456ca3={};_0x456ca3['model']=_[_0x88a2('0x30')](db[_0x88a2('0x2a')][_0x88a2('0x2b')]);_0x456ca3[_0x88a2('0x2f')]=_[_0x88a2('0x30')](_0x36ad8a[_0x88a2('0x2f')]);_0x456ca3[_0x88a2('0x3a')]=_[_0x88a2('0x31')](_0x456ca3[_0x88a2('0x2e')],_0x456ca3[_0x88a2('0x2f')]);_0x42f6f6[_0x88a2('0x32')]=_['intersection'](_0x456ca3[_0x88a2('0x2e')],qs['fields'](_0x36ad8a[_0x88a2('0x2f')]['fields']));_0x42f6f6[_0x88a2('0x32')]=_0x42f6f6[_0x88a2('0x32')][_0x88a2('0x34')]?_0x42f6f6[_0x88a2('0x32')]:_0x456ca3['model'];if(_0x36ad8a[_0x88a2('0x2f')][_0x88a2('0x3f')]){_0x42f6f6[_0x88a2('0x45')]=[{'all':!![]}];}_0x42f6f6=_[_0x88a2('0x3c')]({},_0x42f6f6,_0x36ad8a[_0x88a2('0x46')]);return db['OpenchannelApplication'][_0x88a2('0x47')](_0x42f6f6)[_0x88a2('0x22')](handleEntityNotFound(_0x5ea5d0,null))[_0x88a2('0x22')](respondWithResult(_0x5ea5d0,null))[_0x88a2('0x42')](handleError(_0x5ea5d0,null));};exports[_0x88a2('0x48')]=function(_0x5cf681,_0x345d93){return db[_0x88a2('0x2a')][_0x88a2('0x48')](_0x5cf681[_0x88a2('0x49')],{})[_0x88a2('0x22')](respondWithResult(_0x345d93,0xc9))[_0x88a2('0x42')](handleError(_0x345d93,null));};exports[_0x88a2('0x21')]=function(_0x3b90e9,_0x37e98d){if(_0x3b90e9['body']['id']){delete _0x3b90e9[_0x88a2('0x49')]['id'];}return db[_0x88a2('0x2a')]['find']({'where':{'id':_0x3b90e9[_0x88a2('0x44')]['id']}})[_0x88a2('0x22')](handleEntityNotFound(_0x37e98d,null))[_0x88a2('0x22')](saveUpdates(_0x3b90e9['body'],null))[_0x88a2('0x22')](respondWithResult(_0x37e98d,null))['catch'](handleError(_0x37e98d,null));};exports[_0x88a2('0x23')]=function(_0x116093,_0xd23912){return db[_0x88a2('0x2a')][_0x88a2('0x47')]({'where':{'id':_0x116093['params']['id']}})[_0x88a2('0x22')](handleEntityNotFound(_0xd23912,null))[_0x88a2('0x22')](removeEntity(_0xd23912,null))[_0x88a2('0x42')](handleError(_0xd23912,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index eb791d8..067aec3 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 _0xc55c=['moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0xf32a17,_0x230e17){var _0x3131a6=function(_0x3eb6b6){while(--_0x3eb6b6){_0xf32a17['push'](_0xf32a17['shift']());}};_0x3131a6(++_0x230e17);}(_0xc55c,0x1d1));var _0xcc55=function(_0x372d1d,_0x4a1989){_0x372d1d=_0x372d1d-0x0;var _0x39d9bb=_0xc55c[_0x372d1d];return _0x39d9bb;};'use strict';var _=require(_0xcc55('0x0'));var util=require(_0xcc55('0x1'));var logger=require(_0xcc55('0x2'))('api');var moment=require(_0xcc55('0x3'));var BPromise=require(_0xcc55('0x4'));var rp=require(_0xcc55('0x5'));var fs=require('fs');var path=require(_0xcc55('0x6'));var rimraf=require(_0xcc55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc55('0x8'));module[_0xcc55('0x9')]=function(_0x33f398,_0x10e6e0){return _0x33f398[_0xcc55('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xcc55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc55('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x464f=['exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x5c92f0,_0x2ef672){var _0x128494=function(_0x21e55f){while(--_0x21e55f){_0x5c92f0['push'](_0x5c92f0['shift']());}};_0x128494(++_0x2ef672);}(_0x464f,0xc8));var _0xf464=function(_0x11086d,_0x5207a1){_0x11086d=_0x11086d-0x0;var _0x23a14c=_0x464f[_0x11086d];return _0x23a14c;};'use strict';var _=require(_0xf464('0x0'));var util=require(_0xf464('0x1'));var logger=require(_0xf464('0x2'))(_0xf464('0x3'));var moment=require('moment');var BPromise=require(_0xf464('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf464('0x5'));var config=require(_0xf464('0x6'));var attributes=require(_0xf464('0x7'));module[_0xf464('0x8')]=function(_0x106e77,_0x4431c0){return _0x106e77[_0xf464('0x9')](_0xf464('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf464('0xb'),'collate':_0xf464('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index c671111..232c193 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5c7d4b,_0x305110){var _0x422e90=function(_0x23153f){while(--_0x23153f){_0x5c7d4b['push'](_0x5c7d4b['shift']());}};_0x422e90(++_0x305110);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xb10b[_0x4b6778];return _0x22dbb9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x450606,_0x4248fb){var _0x433264=function(_0x5e1b04){while(--_0x5e1b04){_0x450606['push'](_0x450606['shift']());}};_0x433264(++_0x4248fb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x59be27,_0x37836f){_0x59be27=_0x59be27-0x0;var _0x26a004=_0x5f2f[_0x59be27];return _0x26a004;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ec6bf2b..90957d2 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 _0xd1e9=['show','/:id/messages','/:id/download','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','tracked','openchannelinteraction:update','update','/:id','openchannelinteraction:destroy','destroy','delete','removeTags','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x317018,_0x149405){var _0x415d3e=function(_0xfa52f5){while(--_0xfa52f5){_0x317018['push'](_0x317018['shift']());}};_0x415d3e(++_0x149405);}(_0xd1e9,0xf1));var _0x9d1e=function(_0x478754,_0x1ceb87){_0x478754=_0x478754-0x0;var _0x30b765=_0xd1e9[_0x478754];return _0x30b765;};'use strict';var multer=require(_0x9d1e('0x0'));var util=require('util');var path=require(_0x9d1e('0x1'));var timeout=require(_0x9d1e('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9d1e('0x3'));var config=require(_0x9d1e('0x4'));var controller=require(_0x9d1e('0x5'));router[_0x9d1e('0x6')]('/',auth['isAuthenticated'](),controller[_0x9d1e('0x7')]);router[_0x9d1e('0x6')](_0x9d1e('0x8'),auth[_0x9d1e('0x9')](),controller[_0x9d1e('0xa')]);router[_0x9d1e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9d1e('0xb')]);router[_0x9d1e('0x6')](_0x9d1e('0xc'),auth[_0x9d1e('0x9')](),controller['getMessages']);router['get'](_0x9d1e('0xd'),auth[_0x9d1e('0x9')](),controller[_0x9d1e('0xe')]);router[_0x9d1e('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d1e('0x10')]);router[_0x9d1e('0xf')](_0x9d1e('0xc'),auth[_0x9d1e('0x9')](),controller['addMessage']);router['post'](_0x9d1e('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x9d1e('0x12'),_0x9d1e('0x13')),controller['addTags']);router['put']('/:id',auth[_0x9d1e('0x9')](),interaction[_0x9d1e('0x14')](_0x9d1e('0x12'),_0x9d1e('0x15')),controller[_0x9d1e('0x16')]);router['delete'](_0x9d1e('0x17'),auth[_0x9d1e('0x9')](),interaction[_0x9d1e('0x14')](_0x9d1e('0x12'),_0x9d1e('0x18')),controller[_0x9d1e('0x19')]);router[_0x9d1e('0x1a')]('/:id/tags',auth[_0x9d1e('0x9')](),controller[_0x9d1e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xb872=['openchannelinteraction:destroy','destroy','removeTags','exports','path','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete'];(function(_0x16a6bc,_0x52c641){var _0x38aa93=function(_0x488736){while(--_0x488736){_0x16a6bc['push'](_0x16a6bc['shift']());}};_0x38aa93(++_0x52c641);}(_0xb872,0x1e4));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2b87('0x0'));var timeout=require('connect-timeout');var express=require(_0x2b87('0x1'));var router=express[_0x2b87('0x2')]();var auth=require(_0x2b87('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2b87('0x4'));var controller=require(_0x2b87('0x5'));router[_0x2b87('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b87('0x6')]('/describe',auth[_0x2b87('0x7')](),controller[_0x2b87('0x8')]);router[_0x2b87('0x6')](_0x2b87('0x9'),auth[_0x2b87('0x7')](),controller[_0x2b87('0xa')]);router[_0x2b87('0x6')](_0x2b87('0xb'),auth[_0x2b87('0x7')](),controller[_0x2b87('0xc')]);router['get'](_0x2b87('0xd'),auth[_0x2b87('0x7')](),controller[_0x2b87('0xe')]);router[_0x2b87('0xf')]('/',auth[_0x2b87('0x7')](),controller[_0x2b87('0x10')]);router['post'](_0x2b87('0xb'),auth[_0x2b87('0x7')](),controller[_0x2b87('0x11')]);router[_0x2b87('0xf')](_0x2b87('0x12'),auth[_0x2b87('0x7')](),interaction[_0x2b87('0x13')]('openchannel',_0x2b87('0x14')),controller[_0x2b87('0x15')]);router[_0x2b87('0x16')](_0x2b87('0x9'),auth['isAuthenticated'](),interaction[_0x2b87('0x13')](_0x2b87('0x17'),'openchannelinteraction:update'),controller[_0x2b87('0x18')]);router[_0x2b87('0x19')](_0x2b87('0x9'),auth[_0x2b87('0x7')](),interaction[_0x2b87('0x13')](_0x2b87('0x17'),_0x2b87('0x1a')),controller[_0x2b87('0x1b')]);router[_0x2b87('0x19')](_0x2b87('0x12'),auth[_0x2b87('0x7')](),controller[_0x2b87('0x1c')]);module[_0x2b87('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9134190..d0d82dd 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 _0xfc53=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x69145b,_0x315f1f){var _0x4e4fe8=function(_0x2cc1c5){while(--_0x2cc1c5){_0x69145b['push'](_0x69145b['shift']());}};_0x4e4fe8(++_0x315f1f);}(_0xfc53,0x177));var _0x3fc5=function(_0x3af74d,_0x277d86){_0x3af74d=_0x3af74d-0x0;var _0x3d6853=_0xfc53[_0x3af74d];return _0x3d6853;};'use strict';var Sequelize=require('sequelize');module[_0x3fc5('0x0')]={'closed':{'type':Sequelize[_0x3fc5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3fc5('0x2')]},'disposition':{'type':Sequelize[_0x3fc5('0x3')]},'note':{'type':Sequelize[_0x3fc5('0x3')]},'read1stAt':{'type':Sequelize[_0x3fc5('0x2')]},'threadId':{'type':Sequelize[_0x3fc5('0x3')]},'externalUrl':{'type':Sequelize[_0x3fc5('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3fc5('0x4')]('in',_0x3fc5('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3fc5('0x3')]}}; \ No newline at end of file +var _0xf9fb=['DATE','STRING','ENUM','sequelize','BOOLEAN'];(function(_0x59d249,_0x404d19){var _0x2a44b0=function(_0x30e735){while(--_0x30e735){_0x59d249['push'](_0x59d249['shift']());}};_0x2a44b0(++_0x404d19);}(_0xf9fb,0x1b1));var _0xbf9f=function(_0x4492d4,_0xe34929){_0x4492d4=_0x4492d4-0x0;var _0x43ba4e=_0xf9fb[_0x4492d4];return _0x43ba4e;};'use strict';var Sequelize=require(_0xbf9f('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbf9f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbf9f('0x2')]},'disposition':{'type':Sequelize[_0xbf9f('0x3')]},'note':{'type':Sequelize[_0xbf9f('0x3')]},'read1stAt':{'type':Sequelize[_0xbf9f('0x2')]},'threadId':{'type':Sequelize[_0xbf9f('0x3')]},'externalUrl':{'type':Sequelize[_0xbf9f('0x3')]},'lastMsgAt':{'type':Sequelize[_0xbf9f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xbf9f('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbf9f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 86d07a8..3f0f69a 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 _0xb2b4=['Content-Range','apply','reject','update','then','destroy','end','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`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)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','includeAll','include','merge','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','emit','removeTags','unix','root','server','tmp','join','attachments','transcript-%d-%s.zip','User','push','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','pipe','createWriteStream','basename','out','System','secret','renderFile','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set'];(function(_0xf0e370,_0x1e6c42){var _0x174ca5=function(_0x47745c){while(--_0x47745c){_0xf0e370['push'](_0xf0e370['shift']());}};_0x174ca5(++_0x1e6c42);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x4be3ec,_0x218441){_0x4be3ec=_0x4be3ec-0x0;var _0x44b79f=_0xb2b4[_0x4be3ec];return _0x44b79f;};'use strict';var pdf=require(_0x4b2b('0x0'));var emlformat=require(_0x4b2b('0x1'));var rimraf=require(_0x4b2b('0x2'));var zipdir=require(_0x4b2b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b2b('0x4'));var moment=require(_0x4b2b('0x5'));var BPromise=require(_0x4b2b('0x6'));var Mustache=require(_0x4b2b('0x7'));var util=require('util');var path=require(_0x4b2b('0x8'));var sox=require(_0x4b2b('0x9'));var csv=require(_0x4b2b('0xa'));var ejs=require(_0x4b2b('0xb'));var fs=require('fs');var _=require(_0x4b2b('0xc'));var squel=require(_0x4b2b('0xd'));var crypto=require(_0x4b2b('0xe'));var jsforce=require(_0x4b2b('0xf'));var deskjs=require(_0x4b2b('0x10'));var toCsv=require(_0x4b2b('0xa'));var querystring=require(_0x4b2b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4b2b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4b2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b2b('0x14'))(_0x4b2b('0x15'));var utils=require(_0x4b2b('0x16'));var config=require('../../config/environment');var db=require(_0x4b2b('0x17'))['db'];config[_0x4b2b('0x18')]=_[_0x4b2b('0x19')](config[_0x4b2b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b2b('0x1a'))(new Redis(config[_0x4b2b('0x18')]));require(_0x4b2b('0x1b'))[_0x4b2b('0x1c')](socket);function respondWithStatusCode(_0x5c840a,_0x1b9bfa){_0x1b9bfa=_0x1b9bfa||0xcc;return function(_0x19c134){if(_0x19c134){return _0x5c840a[_0x4b2b('0x1d')](_0x1b9bfa);}return _0x5c840a[_0x4b2b('0x1e')](_0x1b9bfa)['end']();};}function respondWithResult(_0xa6af9c,_0x16dfde){_0x16dfde=_0x16dfde||0xc8;return function(_0x4369a3){if(_0x4369a3){return _0xa6af9c[_0x4b2b('0x1e')](_0x16dfde)[_0x4b2b('0x1f')](_0x4369a3);}};}function respondWithFilteredResult(_0x3b13db,_0x5bd56b){return function(_0x3813f2){if(_0x3813f2){var _0x37aa6b=_0x3813f2[_0x4b2b('0x20')],_0x22d5f5=_0x5bd56b[_0x4b2b('0x21')],_0x43befb=_0x5bd56b[_0x4b2b('0x21')]+_0x5bd56b[_0x4b2b('0x22')],_0x23c3ea;if(_0x43befb>=_0x37aa6b){_0x43befb=_0x37aa6b;_0x23c3ea=0xc8;}else{_0x23c3ea=0xce;}_0x3b13db['status'](_0x23c3ea);return _0x3b13db[_0x4b2b('0x23')](_0x4b2b('0x24'),_0x22d5f5+'-'+_0x43befb+'/'+_0x37aa6b)[_0x4b2b('0x1f')](_0x3813f2);}return null;};}function patchUpdates(_0x1bfb64){return function(_0xb22af){try{jsonpatch[_0x4b2b('0x25')](_0xb22af,_0x1bfb64,!![]);}catch(_0x12097d){return BPromise[_0x4b2b('0x26')](_0x12097d);}return _0xb22af['save']();};}function saveUpdates(_0x31e753,_0x142dfa){return function(_0x5c247a){if(_0x5c247a){return _0x5c247a[_0x4b2b('0x27')](_0x31e753)[_0x4b2b('0x28')](function(_0xa3f05f){return _0xa3f05f;});}return null;};}function removeEntity(_0x52479e,_0x805be9){return function(_0x439e50){if(_0x439e50){return _0x439e50[_0x4b2b('0x29')]()[_0x4b2b('0x28')](function(){_0x52479e[_0x4b2b('0x1e')](0xcc)[_0x4b2b('0x2a')]();});}};}function handleEntityNotFound(_0x534b14,_0x48c93b){return function(_0x14ac5c){if(!_0x14ac5c){_0x534b14['sendStatus'](0x194);}return _0x14ac5c;};}function handleError(_0x12fc89,_0x2481d7){_0x2481d7=_0x2481d7||0x1f4;return function(_0x27c677){logger[_0x4b2b('0x2b')](_0x27c677[_0x4b2b('0x2c')]);if(_0x27c677[_0x4b2b('0x2d')]){delete _0x27c677['name'];}_0x12fc89[_0x4b2b('0x1e')](_0x2481d7)['send'](_0x27c677);};}function getInteractionUsers(_0x2d8fca,_0x5573ba){return new BPromise(function(_0x134d6a,_0x87517e){try{if(_0x5573ba[_0x2d8fca['id']]){_0x2d8fca[_0x4b2b('0x2e')]=_[_0x4b2b('0x2f')](_0x5573ba[_0x2d8fca['id']],function(_0x317ae0){return{'id':_0x317ae0['id'],'fullname':_0x317ae0[_0x4b2b('0x30')]};});}}catch(_0x20fe18){_0x87517e(_0x20fe18);}_0x134d6a(_0x2d8fca);});}function getInteractionTags(_0x410884,_0xf88ac3){return new BPromise(function(_0x8b973e,_0x16fdad){try{if(_0x410884[_0x4b2b('0x31')]){_0x410884[_0x4b2b('0x32')]=[];_0x410884[_0x4b2b('0x31')]['split'](',')[_0x4b2b('0x33')](function(_0x58a8e1){_0x410884['Tags']['push'](_0xf88ac3[_0x58a8e1]);});}delete _0x410884[_0x4b2b('0x31')];}catch(_0x55604c){_0x16fdad(_0x55604c);}_0x8b973e(_0x410884);});}function updateOpenchannelInteraction(_0x3b91f8,_0x4ec51c,_0x3381f4){return new BPromise(function(_0x5a44fb,_0x284745){return getInteractionUsers(_0x3b91f8,_0x3381f4)['then'](function(_0x461c63){return getInteractionTags(_0x461c63,_0x4ec51c);})[_0x4b2b('0x28')](function(_0x4ca888){_0x5a44fb(_0x4ca888);})[_0x4b2b('0x34')](function(_0x90ed63){_0x284745(_0x90ed63);});});}exports[_0x4b2b('0x35')]=function(_0x214bdd,_0x420e5b){var _0x719bde={},_0x419f8f={},_0xba03d2={'count':0x0,'rows':[]};var _0x25e5d0=_['map'](db[_0x4b2b('0x36')][_0x4b2b('0x37')],function(_0x261760){return{'name':_0x261760[_0x4b2b('0x38')],'type':_0x261760['type'][_0x4b2b('0x39')]};});_0x419f8f[_0x4b2b('0x3a')]=_[_0x4b2b('0x2f')](_0x25e5d0,_0x4b2b('0x2d'));_0x419f8f[_0x4b2b('0x3b')]=_[_0x4b2b('0x3c')](_0x214bdd['query']);_0x419f8f[_0x4b2b('0x3d')]=_[_0x4b2b('0x3e')](_0x419f8f['model'],_0x419f8f['query']);_0x719bde[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x419f8f[_0x4b2b('0x3a')],qs['fields'](_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x719bde['attributes']=_0x719bde['attributes'][_0x4b2b('0x41')]?_0x719bde[_0x4b2b('0x3f')]:_0x419f8f[_0x4b2b('0x3a')];if(!_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x42')](_0x4b2b('0x43'))){_0x719bde[_0x4b2b('0x22')]=qs[_0x4b2b('0x22')](_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x22')]);_0x719bde[_0x4b2b('0x21')]=qs[_0x4b2b('0x21')](_0x214bdd['query'][_0x4b2b('0x21')]);}_0x719bde[_0x4b2b('0x44')]=qs[_0x4b2b('0x45')](_0x214bdd[_0x4b2b('0x3b')]['sort']);_0x719bde[_0x4b2b('0x46')]=qs[_0x4b2b('0x3d')](_[_0x4b2b('0x47')](_0x214bdd[_0x4b2b('0x3b')],_0x419f8f[_0x4b2b('0x3d')]),_0x25e5d0);var _0x2e16ae=[];var _0x3523b9=squel[_0x4b2b('0x48')]()[_0x4b2b('0x49')]('id')[_0x4b2b('0x49')](_0x4b2b('0x2d'))[_0x4b2b('0x49')](_0x4b2b('0x4a'))[_0x4b2b('0x4b')]('tools_tags');var _0x2c28a1=squel[_0x4b2b('0x48')]()[_0x4b2b('0x49')]('u.id')[_0x4b2b('0x49')](_0x4b2b('0x4c'))[_0x4b2b('0x49')](_0x4b2b('0x4d'))[_0x4b2b('0x4b')]('user_has_openchannel_interactions','ui')[_0x4b2b('0x4e')](_0x4b2b('0x4f'),'u',_0x4b2b('0x50'));var _0x50a4e9=squel['select']()[_0x4b2b('0x4b')](_0x4b2b('0x51'),'i')[_0x4b2b('0x4e')](_0x4b2b('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x4b2b('0x4f'),'o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x4b2b('0x53'))['left_join']('openchannel_messages','me',_0x4b2b('0x54'))[_0x4b2b('0x4e')]('openchannel_interaction_has_tags','it',_0x4b2b('0x55'))[_0x4b2b('0x4e')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x70c87f=squel['expr']();var _0x308ef6=[];var _0x582856=squel[_0x4b2b('0x56')]();var _0x146970;if(_0x214bdd['query'][_0x4b2b('0x57')]){_0x146970=as[_0x4b2b('0x58')](_0x214bdd['query'][_0x4b2b('0x57')]);var _0x26751a=_0x146970[_0x4b2b('0x59')];for(var _0x250525=0x0;_0x250525<_0x146970[_0x4b2b('0x5a')][_0x4b2b('0x41')];_0x250525++){var _0xbaca6e=_0x146970['conditions'][_0x250525];var _0x11dd58='i';var _0x4f53a9=_[_0x4b2b('0x5b')](_0x25e5d0,[_0x4b2b('0x2d'),_0xbaca6e[_0x4b2b('0x49')]]);if(!_0x4f53a9){switch(_0xbaca6e[_0x4b2b('0x49')]){case _0x4b2b('0x5c'):if(_0xbaca6e[_0x4b2b('0x5d')]==0x1){_0x50a4e9['having']('`'+_0xbaca6e[_0x4b2b('0x49')]+'`\x20=\x200');}else{_0x50a4e9['having']('`'+_0xbaca6e[_0x4b2b('0x49')]+'`\x20>\x200');}break;case _0x4b2b('0x5e'):if(_0xbaca6e[_0x4b2b('0x5f')]===_0x4b2b('0x60')){if(_0xbaca6e[_0x4b2b('0x5d')]['split']('\x20')[_0x4b2b('0x41')]>0x1){_0x70c87f[_0x26751a](_0x4b2b('0x61'),qs['getFullTextValue'](_0xbaca6e[_0x4b2b('0x5d')]),null);}else{var _0x16d9da='%'+_0xbaca6e[_0x4b2b('0x5d')]+'%';_0x70c87f[_0x26751a](_0x4b2b('0x62'),_0x16d9da,_0x16d9da,_0x16d9da);}}else{_0x4f53a9=_['find'](_0x25e5d0,[_0x4b2b('0x2d'),_0x4b2b('0x63')]);_0xbaca6e[_0x4b2b('0x49')]=_0x4b2b('0x63');_0x23a8c1=as[_0x4b2b('0x64')](_0x11dd58,_0x4f53a9[_0x4b2b('0x65')],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);}break;case _0x4b2b('0x68'):var _0x528dc4=_0xbaca6e['value'][_0x4b2b('0x69')](',')[_0x4b2b('0x2f')](function(_0x2cc912){return Number(_0x2cc912);});_0x528dc4['forEach'](function(_0x29bcc7){_0x582856['or'](_0x4b2b('0x6a'),'%,'+_0x29bcc7+',%');});_0x308ef6=_[_0x4b2b('0x6b')](_0x308ef6,_0x528dc4);break;case'User':if(_0xbaca6e['operator']===_0x4b2b('0x60')){_0x70c87f[_0x26751a](_0x4b2b('0x6c'),'%'+_0xbaca6e['value']+'%',null);}else{_0x4f53a9=_[_0x4b2b('0x5b')](_0x25e5d0,['name',_0x4b2b('0x6d')]);_0xbaca6e[_0x4b2b('0x49')]='UserId';_0x23a8c1=as['buildExpression'](_0x11dd58,_0x4f53a9[_0x4b2b('0x65')],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')]['end']);}break;case _0x4b2b('0x6e'):_0x23a8c1=as['buildExpression']('me',null,_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1[_0x4b2b('0x66')],_0x23a8c1['value'][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);break;}}else{var _0x23a8c1=as[_0x4b2b('0x64')](_0x11dd58,_0x4f53a9['type'],_0xbaca6e);_0x70c87f[_0x26751a](_0x23a8c1['text'],_0x23a8c1['value'][_0x4b2b('0x67')],_0x23a8c1[_0x4b2b('0x5d')][_0x4b2b('0x2a')]);}}}else{var _0x4602ec=_(_0x214bdd[_0x4b2b('0x3b')])['keys']()[_0x4b2b('0x2f')](function(_0xfc9915){return _[_0x4b2b('0x6f')](_0x25e5d0,[_0x4b2b('0x2d'),_0xfc9915])?_0xfc9915:undefined;})[_0x4b2b('0x70')]()['value']();if(!_[_0x4b2b('0x71')](_0x4602ec)){_0x4602ec[_0x4b2b('0x33')](function(_0x3bf2ca){if(_0x3bf2ca==='OpenchannelAccountId'){_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x72'),[][_0x4b2b('0x73')](_0x214bdd['query'][_0x3bf2ca]));}else if(_0x3bf2ca===_0x4b2b('0x74')){var _0x2e5460=JSON[_0x4b2b('0x75')](_0x214bdd['query'][_0x3bf2ca])[_0x4b2b('0x76')];var _0x366078=JSON[_0x4b2b('0x75')](_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca])[_0x4b2b('0x77')];_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x78'),_0x2e5460,_0x366078);}else{if(_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca]==='null'){_0x50a4e9[_0x4b2b('0x46')]('i.'+_0x3bf2ca+_0x4b2b('0x79'));}else{_0x50a4e9[_0x4b2b('0x46')]('i.'+_0x3bf2ca+_0x4b2b('0x7a'),_0x214bdd[_0x4b2b('0x3b')][_0x3bf2ca]);}}});}if(_0x214bdd['query']['read']){if(_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x7b')]==0x1){_0x50a4e9[_0x4b2b('0x7c')](_0x4b2b('0x7d'));}else{_0x50a4e9[_0x4b2b('0x7c')](_0x4b2b('0x7e'));}}if(_0x214bdd[_0x4b2b('0x3b')][_0x4b2b('0x7f')]){_0x308ef6=_[_0x4b2b('0x80')](_0x214bdd[_0x4b2b('0x3b')]['tag'])?_0x214bdd['query'][_0x4b2b('0x7f')]:new Array(_0x214bdd[_0x4b2b('0x3b')]['tag']);_0x308ef6[_0x4b2b('0x33')](function(_0x48e224){_0x582856['or'](_0x4b2b('0x6a'),'%,'+_0x48e224+',%');});}if(_0x214bdd[_0x4b2b('0x3b')]['filter']){var _0x3591a3=_0x214bdd['query']['filter'][_0x4b2b('0x81')]('\x5c','\x5c\x5c')[_0x4b2b('0x81')]('\x27\x27',_0x4b2b('0x82'));if(qs[_0x4b2b('0x83')](_0x3591a3)){_0x70c87f['or'](_0x4b2b('0x84'),_0x3591a3+'%');}else{_0x70c87f['or'](_0x4b2b('0x85'),qs['getFullTextValue'](_0x3591a3))['or'](_0x4b2b('0x86'),_0x3591a3+'%')['or'](_0x4b2b('0x87'),_0x3591a3+'%');}}}_0x50a4e9['where'](_0x70c87f);_0x50a4e9[_0x4b2b('0x88')](_0x4b2b('0x89'));var _0x149b15={'type':db[_0x4b2b('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1e6c33=_0x50a4e9[_0x4b2b('0x8b')]();_0x1e6c33['field'](_0x4b2b('0x89'));_0x1e6c33[_0x4b2b('0x49')](_0x4b2b('0x8c'),_0x4b2b('0x5c'));if(_0x719bde[_0x4b2b('0x44')]){_0x719bde[_0x4b2b('0x44')][_0x4b2b('0x33')](function(_0x751c91){_0x50a4e9['order']('i.'+_0x751c91[0x0],_0x751c91[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4b2b('0x71')](_0x308ef6)){_0x50a4e9['having'](_0x582856);_0x1e6c33[_0x4b2b('0x46')]('t.id\x20IN\x20?',_0x308ef6);}BPromise[_0x4b2b('0x8d')]()[_0x4b2b('0x28')](function(){if(!_0x146970){if(_0x214bdd['query']['OpenchannelAccountId']||_0x214bdd['query'][_0x4b2b('0x8e')])return;_0x1e6c33[_0x4b2b('0x46')](_0x4b2b('0x8f'));_0x50a4e9[_0x4b2b('0x46')](_0x4b2b('0x8f'));return;}return _0x214bdd[_0x4b2b('0x90')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x4b2b('0x28')](function(_0x1efa87){if(_[_0x4b2b('0x71')](_0x1efa87)){_0x1e6c33[_0x4b2b('0x46')](_0x4b2b('0x91'));_0x50a4e9['where'](_0x4b2b('0x91'));}else{_0x1e6c33['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x4b2b('0x2f')](_0x1efa87,'id'));_0x50a4e9['where'](_0x4b2b('0x72'),_['map'](_0x1efa87,'id'));}});})[_0x4b2b('0x28')](function(){db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x1e6c33[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0xb47c07){_0xba03d2['count']=_0xb47c07['length'];if(_0xba03d2[_0x4b2b('0x20')]===0x0)return[];return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x3523b9[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0x454678){_0x2e16ae=_['keyBy'](_0x454678,'id');_0x149b15=_['merge'](_0x149b15,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x214bdd['query']['fields']){_0x719bde[_0x4b2b('0x3f')][_0x4b2b('0x33')](function(_0x3781cb){_0x50a4e9['field']('i.'+_0x3781cb);});}else{_0x50a4e9[_0x4b2b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4b2b('0x5c'));_0x50a4e9['field']('a.key',_0x4b2b('0x94'));_0x50a4e9[_0x4b2b('0x49')]('a.mandatoryDisposition',_0x4b2b('0x95'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x96'));_0x50a4e9[_0x4b2b('0x49')]('c.firstName',_0x4b2b('0x97'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x98'),_0x4b2b('0x99'));_0x50a4e9['field'](_0x4b2b('0x9a'),_0x4b2b('0x9b'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0x9c'),_0x4b2b('0x9d'));_0x50a4e9['field'](_0x4b2b('0x9e'),'Contact.mobile');_0x50a4e9[_0x4b2b('0x49')]('c.fax',_0x4b2b('0x9f'));_0x50a4e9[_0x4b2b('0x49')]('o.fullname',_0x4b2b('0xa0'));_0x50a4e9[_0x4b2b('0x49')](_0x4b2b('0xa1'),_0x4b2b('0xa2'));_0x50a4e9['field'](_0x4b2b('0xa3'),_0x4b2b('0x31'));}if(_0x719bde[_0x4b2b('0x22')])_0x50a4e9['limit'](_0x719bde[_0x4b2b('0x22')]);if(_0x719bde[_0x4b2b('0x21')])_0x50a4e9[_0x4b2b('0x21')](_0x719bde[_0x4b2b('0x21')]);return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x50a4e9[_0x4b2b('0x93')](),_0x149b15);})['then'](function(_0x5809b7){_0x2c28a1[_0x4b2b('0x46')](_0x4b2b('0xa4'),_[_0x4b2b('0x2f')](_0x5809b7,'id'));return db[_0x4b2b('0x92')][_0x4b2b('0x3b')](_0x2c28a1[_0x4b2b('0x93')](),_0x149b15)[_0x4b2b('0x28')](function(_0x971e64){var _0x2b85ac=_[_0x4b2b('0xa5')](_0x971e64,'OpenchannelInteractionId');var _0x9cbb00=[];_0x5809b7['forEach'](function(_0x22feed){_0x9cbb00['push'](updateOpenchannelInteraction(_0x22feed,_0x2e16ae,_0x2b85ac));});return BPromise[_0x4b2b('0xa6')](_0x9cbb00);});});})['then'](function(_0xaf63bf){_0xba03d2['rows']=_0xaf63bf;return _0xba03d2;})[_0x4b2b('0x28')](respondWithFilteredResult(_0x420e5b,_0x719bde));})[_0x4b2b('0x34')](handleError(_0x420e5b,null));};exports[_0x4b2b('0xa7')]=function(_0x41ddfd,_0x1ef2ea){var _0x5603a2={'raw':![],'where':{'id':_0x41ddfd[_0x4b2b('0xa8')]['id']}},_0x496384={};_0x496384['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x496384['query']=_[_0x4b2b('0x3c')](_0x41ddfd[_0x4b2b('0x3b')]);_0x496384[_0x4b2b('0x3d')]=_[_0x4b2b('0x3e')](_0x496384[_0x4b2b('0x3a')],_0x496384[_0x4b2b('0x3b')]);_0x5603a2[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x496384[_0x4b2b('0x3a')],qs[_0x4b2b('0x40')](_0x41ddfd[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x5603a2[_0x4b2b('0x3f')]=_0x5603a2[_0x4b2b('0x3f')][_0x4b2b('0x41')]?_0x5603a2[_0x4b2b('0x3f')]:_0x496384[_0x4b2b('0x3a')];if(_0x41ddfd[_0x4b2b('0x3b')][_0x4b2b('0xa9')]){_0x5603a2[_0x4b2b('0xaa')]=[{'all':!![]}];}_0x5603a2=_[_0x4b2b('0xab')]({},_0x5603a2,_0x41ddfd['options']);return db['OpenchannelInteraction'][_0x4b2b('0x5b')](_0x5603a2)[_0x4b2b('0x28')](handleEntityNotFound(_0x1ef2ea,null))[_0x4b2b('0x28')](respondWithResult(_0x1ef2ea,null))[_0x4b2b('0x34')](handleError(_0x1ef2ea,null));};exports[_0x4b2b('0xac')]=function(_0x33019f,_0xfa2145){return db[_0x4b2b('0x36')]['create'](_0x33019f[_0x4b2b('0x6e')],{})[_0x4b2b('0x28')](respondWithResult(_0xfa2145,0xc9))[_0x4b2b('0x34')](handleError(_0xfa2145,null));};exports[_0x4b2b('0x27')]=function(_0x497483,_0x38995d){if(_0x497483[_0x4b2b('0x6e')]['id']){delete _0x497483[_0x4b2b('0x6e')]['id'];}return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0x497483[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x38995d,null))[_0x4b2b('0x28')](saveUpdates(_0x497483[_0x4b2b('0x6e')],null))[_0x4b2b('0x28')](respondWithResult(_0x38995d,null))['catch'](handleError(_0x38995d,null));};exports[_0x4b2b('0x29')]=function(_0x50cd8d,_0x26fd23){return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0x50cd8d['params']['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x26fd23,null))[_0x4b2b('0x28')](removeEntity(_0x26fd23,null))['catch'](handleError(_0x26fd23,null));};exports['describe']=function(_0x4d37c9,_0x3b7891){return db[_0x4b2b('0x36')][_0x4b2b('0xad')]()[_0x4b2b('0x28')](respondWithResult(_0x3b7891,null))[_0x4b2b('0x34')](handleError(_0x3b7891,null));};exports[_0x4b2b('0xae')]=function(_0x45944f,_0x2a842f,_0x5998ce){return db[_0x4b2b('0xaf')]['find']({'where':{'id':_0x45944f[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x2a842f,null))[_0x4b2b('0x28')](function(_0x2d1d76){if(_0x2d1d76){return _0x2d1d76[_0x4b2b('0xae')](_0x45944f['body'][_0x4b2b('0xb0')],_[_0x4b2b('0xb1')](_0x45944f[_0x4b2b('0x6e')],[_0x4b2b('0xb0'),'id'])||{});}})[_0x4b2b('0x28')](respondWithResult(_0x2a842f,null))['catch'](handleError(_0x2a842f,null));};exports['getMessages']=function(_0x6eda16,_0x3adb1e,_0x5a8c71){var _0x771927={'raw':![],'where':{}};var _0x4712c0={};var _0x487f02={'count':0x0,'rows':[]};return db[_0x4b2b('0x36')][_0x4b2b('0xb2')]({'where':{'id':_0x6eda16[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x3adb1e,null))[_0x4b2b('0x28')](function(_0x4d1909){if(_0x4d1909){_0x4712c0['model']=_['keys'](db[_0x4b2b('0xaf')][_0x4b2b('0x37')]);_0x4712c0[_0x4b2b('0x3b')]=_[_0x4b2b('0x3c')](_0x6eda16[_0x4b2b('0x3b')]);_0x4712c0['filters']=_[_0x4b2b('0x3e')](_0x4712c0[_0x4b2b('0x3a')],_0x4712c0[_0x4b2b('0x3b')]);_0x771927[_0x4b2b('0x3f')]=_[_0x4b2b('0x3e')](_0x4712c0['model'],qs[_0x4b2b('0x40')](_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x40')]));_0x771927[_0x4b2b('0x3f')]=_0x771927[_0x4b2b('0x3f')][_0x4b2b('0x41')]?_0x771927[_0x4b2b('0x3f')]:_0x4712c0[_0x4b2b('0x3a')];if(!_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x42')](_0x4b2b('0x43'))){_0x771927[_0x4b2b('0x22')]=qs[_0x4b2b('0x22')](_0x6eda16['query']['limit']);_0x771927['offset']=qs[_0x4b2b('0x21')](_0x6eda16['query']['offset']);}_0x771927[_0x4b2b('0x44')]=qs['sort'](_0x6eda16['query'][_0x4b2b('0x45')]);_0x771927[_0x4b2b('0x46')]=qs[_0x4b2b('0x3d')](_[_0x4b2b('0x47')](_0x6eda16['query'],_0x4712c0[_0x4b2b('0x3d')]));_0x771927[_0x4b2b('0x46')][_0x4b2b('0xb3')]=_0x4d1909['id'];if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0xb4')]){_0x771927[_0x4b2b('0x46')]=_[_0x4b2b('0xab')](_0x771927['where'],{'$or':_[_0x4b2b('0x2f')](_0x771927[_0x4b2b('0x3f')],function(_0x394ac0){var _0xe83cf0={};_0xe83cf0[_0x394ac0]={'$like':'%'+_0x6eda16['query']['filter']+'%'};return _0xe83cf0;})});}if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x76')]){var _0x6c5912=_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0x76')][_0x4b2b('0x69')](',');var _0x49574c={};_0x49574c[_0x6c5912[0x0]]={'$gte':moment(_0x6c5912[0x1])[_0x4b2b('0xb5')](_0x4b2b('0xb6'))};_0x771927[_0x4b2b('0x46')]=_['merge'](_0x771927['where'],_0x49574c);}_0x771927=_['merge']({},_0x771927,_0x6eda16[_0x4b2b('0xb7')]);return db[_0x4b2b('0xaf')][_0x4b2b('0x20')]({'where':_0x771927[_0x4b2b('0x46')]})['then'](function(_0x3cb315){_0x487f02[_0x4b2b('0x20')]=_0x3cb315;if(_0x6eda16[_0x4b2b('0x3b')][_0x4b2b('0xa9')]){_0x771927[_0x4b2b('0xaa')]=[{'all':!![]}];}return db[_0x4b2b('0xaf')][_0x4b2b('0xb8')](_0x771927);})[_0x4b2b('0x28')](function(_0x45e73e){_0x487f02[_0x4b2b('0xb9')]=_0x45e73e;return _0x487f02;});}})[_0x4b2b('0x28')](respondWithFilteredResult(_0x3adb1e,_0x771927))[_0x4b2b('0x34')](handleError(_0x3adb1e,null));};exports[_0x4b2b('0xba')]=function(_0xe52e4b,_0x5893ba,_0x52ee7b){return db[_0x4b2b('0x36')][_0x4b2b('0x5b')]({'where':{'id':_0xe52e4b[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x5893ba,null))[_0x4b2b('0x28')](function(_0x473352){if(_0x473352){return _0x473352[_0x4b2b('0xbb')](_0xe52e4b[_0x4b2b('0x6e')][_0x4b2b('0xb0')],_[_0x4b2b('0xb1')](_0xe52e4b[_0x4b2b('0x6e')],[_0x4b2b('0xb0'),'id'])||{})[_0x4b2b('0xbc')](function(){return db[_0x4b2b('0x68')]['findAll']({'attributes':['id',_0x4b2b('0x2d'),_0x4b2b('0x4a')],'where':{'id':_0xe52e4b[_0x4b2b('0x6e')][_0x4b2b('0xb0')]}});})['then'](function(_0x14a5ff){socket[_0x4b2b('0xbd')]('openchannelInteractionTags:save',{'id':Number(_0xe52e4b[_0x4b2b('0xa8')]['id']),'tags':_0x14a5ff||[]});return{'id':Number(_0xe52e4b[_0x4b2b('0xa8')]['id']),'tags':_0x14a5ff||[]};});}})[_0x4b2b('0x28')](respondWithResult(_0x5893ba,null))[_0x4b2b('0x34')](handleError(_0x5893ba,null));};exports[_0x4b2b('0xbe')]=function(_0x27e170,_0x11fdbd,_0x5f0b2c){return db['OpenchannelInteraction'][_0x4b2b('0x5b')]({'where':{'id':_0x27e170[_0x4b2b('0xa8')]['id']}})[_0x4b2b('0x28')](handleEntityNotFound(_0x11fdbd,null))['then'](function(_0x305b1a){if(_0x305b1a){return _0x305b1a[_0x4b2b('0xbe')](_0x27e170['query'][_0x4b2b('0xb0')]);}})[_0x4b2b('0x28')](respondWithStatusCode(_0x11fdbd,null))['catch'](handleError(_0x11fdbd,null));};exports['download']=function(_0x1bcf96,_0x5d64d6){var _0x3166d1=moment()[_0x4b2b('0xbf')]()[_0x4b2b('0x93')]();var _0x214e34=path['join'](config[_0x4b2b('0xc0')],_0x4b2b('0xc1'),'files',_0x4b2b('0xc2'));var _0x1bcaa8=path[_0x4b2b('0xc3')](config[_0x4b2b('0xc0')],'server','files',_0x4b2b('0xc4'));var _0x24aa75=path[_0x4b2b('0xc3')](_0x214e34,_0x3166d1);var _0x36fa38=util[_0x4b2b('0xb5')](_0x4b2b('0xc5'),_0x1bcf96[_0x4b2b('0xa8')]['id'],_0x3166d1);var _0x2847d8=path[_0x4b2b('0xc3')](_0x214e34,_0x36fa38);var _0x2ae596=[];_0x2ae596['push']({'model':db[_0x4b2b('0xc6')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2ae596[_0x4b2b('0xc7')]({'model':db[_0x4b2b('0xc8')],'as':_0x4b2b('0x5e'),'attributes':['id',_0x4b2b('0xc9'),_0x4b2b('0xca')],'raw':!![]});if(_0x1bcf96[_0x4b2b('0x3b')][_0x4b2b('0xc4')]){_0x2ae596['push']({'model':db['Attachment'],'as':_0x4b2b('0xcb'),'raw':!![]});}var _0x2f027c=[{'model':db['OpenchannelMessage'],'as':_0x4b2b('0xcc'),'attributes':['id',_0x4b2b('0x6e'),_0x4b2b('0x74'),_0x4b2b('0xcd'),'secret','read'],'include':_0x2ae596}];_0x2f027c[_0x4b2b('0xc7')]({'model':db[_0x4b2b('0xce')],'as':_0x4b2b('0xcf'),'attributes':['id',_0x4b2b('0x2d')]});_0x2f027c['push']({'model':db['User'],'as':_0x4b2b('0xd0'),'attributes':['id',_0x4b2b('0x30')]});return db[_0x4b2b('0x36')]['find']({'where':{'id':_0x1bcf96[_0x4b2b('0xa8')]['id']},'include':_0x2f027c})['then'](handleEntityNotFound(_0x5d64d6,null))[_0x4b2b('0x28')](function(_0x4c8f77){if(_0x4c8f77){var _0x27d326=_0x4c8f77[_0x4b2b('0xd1')]({'plain':!![]});fs[_0x4b2b('0xd2')](_0x24aa75);var _0x316904={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x4b2b('0xd3')}},'footer':{'height':'30px','contents':{'default':util[_0x4b2b('0xb5')]('\x0a\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[_0x4b2b('0xb5')](_0x4b2b('0xd4'),_0x4b2b('0xd5'),_0x27d326['id']),moment()['format']('YYYY-MM-DD')[_0x4b2b('0x93')]())}}};var _0x47151b={'channel':_0x4b2b('0xd5'),'account':_0x27d326[_0x4b2b('0xcf')][_0x4b2b('0x2d')],'agent':_0x27d326[_0x4b2b('0xd0')]?_0x27d326[_0x4b2b('0xd0')][_0x4b2b('0x30')]:_0x4b2b('0xd6'),'createdAt':moment(_0x27d326[_0x4b2b('0x74')])[_0x4b2b('0xb5')](_0x4b2b('0xb6'))['toString'](),'closedAt':_0x27d326[_0x4b2b('0xd7')]?moment(_0x27d326[_0x4b2b('0xd8')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4b2b('0x93')]():'','disposition':_0x27d326[_0x4b2b('0xd9')],'visibility':_0x27d326[_0x4b2b('0xda')]?'Public':_0x4b2b('0xdb'),'messages':_(_0x27d326['Messages'])[_0x4b2b('0xb4')]({'secret':![]})['map'](function(_0xea8885){if(_0xea8885['Attachment']){var _0x37ef10=path[_0x4b2b('0xc3')](_0x1bcaa8,_0xea8885['Attachment']['basename']);if(fs[_0x4b2b('0xdc')](_0x37ef10)){fs['createReadStream'](_0x37ef10)[_0x4b2b('0xdd')](fs[_0x4b2b('0xde')](path[_0x4b2b('0xc3')](_0x24aa75,_0xea8885['Attachment'][_0x4b2b('0xdf')])));}}return{'date':moment(_0xea8885[_0x4b2b('0x74')])['format'](_0x4b2b('0xb6'))[_0x4b2b('0x93')](),'sender':_0xea8885[_0x4b2b('0xcd')]===_0x4b2b('0xe0')?_0xea8885[_0x4b2b('0xc6')]?_0xea8885['User'][_0x4b2b('0x30')]:_0x4b2b('0xe1'):_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xc9')]+(_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xca')]?'\x20'+_0xea8885[_0x4b2b('0x5e')][_0x4b2b('0xca')]:''),'body':_0xea8885['Attachment']?_0xea8885['Attachment'][_0x4b2b('0xdf')]:_0xea8885[_0x4b2b('0x6e')],'direction':_0xea8885[_0x4b2b('0xcd')]===_0x4b2b('0xe0')?'A':'C','secret':_0xea8885[_0x4b2b('0xe2')],'read':_0xea8885[_0x4b2b('0x7b')],'attachment':_0xea8885[_0x4b2b('0xcb')]};})[_0x4b2b('0x5d')]()};return ejs[_0x4b2b('0xe3')](path['join'](config['root'],_0x4b2b('0xc1'),_0x4b2b('0xe4'),'downloadInteraction.html'),{'interaction':_0x47151b})[_0x4b2b('0x28')](function(_0x52a720){return new BPromise(function(_0x2ca5c0,_0x1e68e7){pdf[_0x4b2b('0xac')](_0x52a720,_0x316904)[_0x4b2b('0xe5')](path[_0x4b2b('0xc3')](_0x24aa75,_0x4b2b('0xe6')+_0x27d326['id']+'-'+_0x3166d1+_0x4b2b('0xe7')),function(_0x55cb25,_0x463eae){if(_0x55cb25)return _0x1e68e7(_0x55cb25);_0x2ca5c0(_0x463eae);});});})[_0x4b2b('0x28')](function(){return new BPromise(function(_0x593292,_0x3d45b0){zipdir(_0x24aa75,{'saveTo':_0x2847d8},function(_0x533a98,_0x38a225){if(_0x533a98)return _0x3d45b0(_0x533a98);return _0x593292(_0x38a225);});})[_0x4b2b('0x28')](function(){return new BPromise(function(_0x3bb095,_0x568586){rimraf(_0x24aa75,function(_0x4ecc79){if(_0x4ecc79)_0x568586(_0x4ecc79);return _0x3bb095();});});})['then'](function(){return _0x5d64d6[_0x4b2b('0xe8')](_0x2847d8,_0x36fa38,function(_0x4bc0b3){if(_0x4bc0b3){console[_0x4b2b('0xe9')](_0x4b2b('0xea'),_0x4bc0b3);}else{fs[_0x4b2b('0xeb')](_0x2847d8);}});});});}else{return _0x5d64d6[_0x4b2b('0x1d')](0xc8);}})[_0x4b2b('0x34')](handleError(_0x5d64d6,null));}; \ No newline at end of file +var _0x8853=['split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','find','having','`\x20>\x200','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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)','ui.OpenchannelInteractionId\x20IN\x20?','sequelize','groupBy','all','rows','show','include','options','create','params','describe','addMessage','ids','omit','findOne','OpenchannelMessage','nolimit','OpenchannelInteractionId','findAll','setTags','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','format','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','Contact','lastName','out','views','downloadInteraction.html','toFile','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x8853,0x1a8));var _0x3885=function(_0x266ca4,_0x152c86){_0x266ca4=_0x266ca4-0x0;var _0x21a03a=_0x8853[_0x266ca4];return _0x21a03a;};'use strict';var pdf=require(_0x3885('0x0'));var emlformat=require(_0x3885('0x1'));var rimraf=require(_0x3885('0x2'));var zipdir=require(_0x3885('0x3'));var jsonpatch=require(_0x3885('0x4'));var rp=require(_0x3885('0x5'));var moment=require('moment');var BPromise=require(_0x3885('0x6'));var Mustache=require(_0x3885('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3885('0x8'));var csv=require('to-csv');var ejs=require(_0x3885('0x9'));var fs=require('fs');var _=require(_0x3885('0xa'));var squel=require(_0x3885('0xb'));var crypto=require(_0x3885('0xc'));var jsforce=require(_0x3885('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3885('0xe'));var querystring=require(_0x3885('0xf'));var Papa=require(_0x3885('0x10'));var Redis=require('ioredis');var authService=require(_0x3885('0x11'));var qs=require(_0x3885('0x12'));var as=require(_0x3885('0x13'));var hardwareService=require(_0x3885('0x14'));var logger=require('../../config/logger')(_0x3885('0x15'));var utils=require(_0x3885('0x16'));var config=require(_0x3885('0x17'));var db=require(_0x3885('0x18'))['db'];config[_0x3885('0x19')]=_[_0x3885('0x1a')](config['redis'],{'host':_0x3885('0x1b'),'port':0x18eb});var socket=require(_0x3885('0x1c'))(new Redis(config['redis']));require(_0x3885('0x1d'))[_0x3885('0x1e')](socket);function respondWithStatusCode(_0x3ba056,_0x4e03cc){_0x4e03cc=_0x4e03cc||0xcc;return function(_0x1781ae){if(_0x1781ae){return _0x3ba056[_0x3885('0x1f')](_0x4e03cc);}return _0x3ba056[_0x3885('0x20')](_0x4e03cc)[_0x3885('0x21')]();};}function respondWithResult(_0x2c832f,_0x1995ca){_0x1995ca=_0x1995ca||0xc8;return function(_0x2972cf){if(_0x2972cf){return _0x2c832f[_0x3885('0x20')](_0x1995ca)[_0x3885('0x22')](_0x2972cf);}};}function respondWithFilteredResult(_0x14f3c4,_0x37ceee){return function(_0x26c51c){if(_0x26c51c){var _0x57fa36=_0x26c51c[_0x3885('0x23')],_0x5ff0f9=_0x37ceee[_0x3885('0x24')],_0x1d0721=_0x37ceee[_0x3885('0x24')]+_0x37ceee[_0x3885('0x25')],_0x3207fd;if(_0x1d0721>=_0x57fa36){_0x1d0721=_0x57fa36;_0x3207fd=0xc8;}else{_0x3207fd=0xce;}_0x14f3c4['status'](_0x3207fd);return _0x14f3c4[_0x3885('0x26')]('Content-Range',_0x5ff0f9+'-'+_0x1d0721+'/'+_0x57fa36)['json'](_0x26c51c);}return null;};}function patchUpdates(_0x513093){return function(_0x22359b){try{jsonpatch[_0x3885('0x27')](_0x22359b,_0x513093,!![]);}catch(_0x2cd969){return BPromise['reject'](_0x2cd969);}return _0x22359b['save']();};}function saveUpdates(_0x2be94a,_0x18ee55){return function(_0x93040){if(_0x93040){return _0x93040[_0x3885('0x28')](_0x2be94a)[_0x3885('0x29')](function(_0x1d4e6c){return _0x1d4e6c;});}return null;};}function removeEntity(_0x5aaf64,_0x4300e5){return function(_0x206a74){if(_0x206a74){return _0x206a74[_0x3885('0x2a')]()[_0x3885('0x29')](function(){_0x5aaf64[_0x3885('0x20')](0xcc)[_0x3885('0x21')]();});}};}function handleEntityNotFound(_0x909e95,_0x3a0a67){return function(_0x16a51f){if(!_0x16a51f){_0x909e95[_0x3885('0x1f')](0x194);}return _0x16a51f;};}function handleError(_0x582ce8,_0x3acd3e){_0x3acd3e=_0x3acd3e||0x1f4;return function(_0x259dc5){logger['error'](_0x259dc5[_0x3885('0x2b')]);if(_0x259dc5[_0x3885('0x2c')]){delete _0x259dc5[_0x3885('0x2c')];}_0x582ce8[_0x3885('0x20')](_0x3acd3e)['send'](_0x259dc5);};}function getInteractionUsers(_0x171074,_0x2e8d16){return new BPromise(function(_0xb1ea55,_0x2c93d8){try{if(_0x2e8d16[_0x171074['id']]){_0x171074[_0x3885('0x2d')]=_[_0x3885('0x2e')](_0x2e8d16[_0x171074['id']],function(_0xb3a204){return{'id':_0xb3a204['id'],'fullname':_0xb3a204[_0x3885('0x2f')]};});}}catch(_0xeb3846){_0x2c93d8(_0xeb3846);}_0xb1ea55(_0x171074);});}function getInteractionTags(_0x2bc2d9,_0x4f149b){return new BPromise(function(_0x54c1c4,_0x5a8e47){try{if(_0x2bc2d9[_0x3885('0x30')]){_0x2bc2d9[_0x3885('0x31')]=[];_0x2bc2d9[_0x3885('0x30')][_0x3885('0x32')](',')[_0x3885('0x33')](function(_0x32d47b){_0x2bc2d9[_0x3885('0x31')][_0x3885('0x34')](_0x4f149b[_0x32d47b]);});}delete _0x2bc2d9[_0x3885('0x30')];}catch(_0x267ca5){_0x5a8e47(_0x267ca5);}_0x54c1c4(_0x2bc2d9);});}function updateOpenchannelInteraction(_0x3fc12f,_0xb9aa7,_0x3090cb){return new BPromise(function(_0x54acb7,_0x4f1618){return getInteractionUsers(_0x3fc12f,_0x3090cb)[_0x3885('0x29')](function(_0x32ee97){return getInteractionTags(_0x32ee97,_0xb9aa7);})[_0x3885('0x29')](function(_0x354c8f){_0x54acb7(_0x354c8f);})[_0x3885('0x35')](function(_0x1e1adb){_0x4f1618(_0x1e1adb);});});}exports[_0x3885('0x36')]=function(_0x34a69a,_0x31eb52){var _0xd117a4={},_0x553090={},_0x562b0e={'count':0x0,'rows':[]};var _0x387b5f=_[_0x3885('0x2e')](db[_0x3885('0x37')][_0x3885('0x38')],function(_0x2ab5a9){return{'name':_0x2ab5a9['fieldName'],'type':_0x2ab5a9[_0x3885('0x39')][_0x3885('0x3a')]};});_0x553090['model']=_[_0x3885('0x2e')](_0x387b5f,_0x3885('0x2c'));_0x553090[_0x3885('0x3b')]=_[_0x3885('0x3c')](_0x34a69a[_0x3885('0x3b')]);_0x553090[_0x3885('0x3d')]=_[_0x3885('0x3e')](_0x553090[_0x3885('0x3f')],_0x553090[_0x3885('0x3b')]);_0xd117a4['attributes']=_['intersection'](_0x553090[_0x3885('0x3f')],qs['fields'](_0x34a69a[_0x3885('0x3b')][_0x3885('0x40')]));_0xd117a4[_0x3885('0x41')]=_0xd117a4[_0x3885('0x41')][_0x3885('0x42')]?_0xd117a4[_0x3885('0x41')]:_0x553090[_0x3885('0x3f')];if(!_0x34a69a['query'][_0x3885('0x43')]('nolimit')){_0xd117a4[_0x3885('0x25')]=qs[_0x3885('0x25')](_0x34a69a[_0x3885('0x3b')][_0x3885('0x25')]);_0xd117a4['offset']=qs[_0x3885('0x24')](_0x34a69a[_0x3885('0x3b')][_0x3885('0x24')]);}_0xd117a4[_0x3885('0x44')]=qs[_0x3885('0x45')](_0x34a69a[_0x3885('0x3b')][_0x3885('0x45')]);_0xd117a4[_0x3885('0x46')]=qs[_0x3885('0x3d')](_['pick'](_0x34a69a[_0x3885('0x3b')],_0x553090['filters']),_0x387b5f);var _0x47c23b=[];var _0x3be8b6=squel[_0x3885('0x47')]()[_0x3885('0x48')]('id')[_0x3885('0x48')](_0x3885('0x2c'))['field'](_0x3885('0x49'))[_0x3885('0x4a')](_0x3885('0x4b'));var _0x401ab0=squel['select']()[_0x3885('0x48')](_0x3885('0x4c'))[_0x3885('0x48')](_0x3885('0x4d'))['field'](_0x3885('0x4e'))[_0x3885('0x4a')](_0x3885('0x4f'),'ui')[_0x3885('0x50')]('users','u',_0x3885('0x51'));var _0x47c84a=squel[_0x3885('0x47')]()[_0x3885('0x4a')](_0x3885('0x52'),'i')[_0x3885('0x50')](_0x3885('0x53'),'c',_0x3885('0x54'))[_0x3885('0x50')](_0x3885('0x55'),'o',_0x3885('0x56'))[_0x3885('0x50')]('openchannel_accounts','a',_0x3885('0x57'))[_0x3885('0x50')](_0x3885('0x58'),'me',_0x3885('0x59'))[_0x3885('0x50')](_0x3885('0x5a'),'it',_0x3885('0x5b'))[_0x3885('0x50')](_0x3885('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x6c25a0=squel[_0x3885('0x5c')]();var _0x1f68a0=[];var _0x2d4b58=squel[_0x3885('0x5c')]();var _0xf48643;if(_0x34a69a[_0x3885('0x3b')]['search']){_0xf48643=as['parseSearch'](_0x34a69a[_0x3885('0x3b')]['search']);var _0x152d53=_0xf48643[_0x3885('0x5d')];for(var _0x567d2c=0x0;_0x567d2c<_0xf48643[_0x3885('0x5e')]['length'];_0x567d2c++){var _0x2080e0=_0xf48643[_0x3885('0x5e')][_0x567d2c];var _0x27f2f2='i';var _0xb29af9=_[_0x3885('0x5f')](_0x387b5f,['name',_0x2080e0['field']]);if(!_0xb29af9){switch(_0x2080e0[_0x3885('0x48')]){case'unreadMessages':if(_0x2080e0['value']==0x1){_0x47c84a['having']('`'+_0x2080e0[_0x3885('0x48')]+'`\x20=\x200');}else{_0x47c84a[_0x3885('0x60')]('`'+_0x2080e0[_0x3885('0x48')]+_0x3885('0x61'));}break;case'Contact':if(_0x2080e0[_0x3885('0x62')]==='$substring'){if(_0x2080e0[_0x3885('0x63')]['split']('\x20')[_0x3885('0x42')]>0x1){_0x6c25a0[_0x152d53](_0x3885('0x64'),qs[_0x3885('0x65')](_0x2080e0[_0x3885('0x63')]),null);}else{var _0x58f2a6='%'+_0x2080e0[_0x3885('0x63')]+'%';_0x6c25a0[_0x152d53](_0x3885('0x66'),_0x58f2a6,_0x58f2a6,_0x58f2a6);}}else{_0xb29af9=_[_0x3885('0x5f')](_0x387b5f,[_0x3885('0x2c'),_0x3885('0x67')]);_0x2080e0['field']='ContactId';_0x59a29a=as[_0x3885('0x68')](_0x27f2f2,_0xb29af9[_0x3885('0x39')],_0x2080e0);_0x6c25a0[_0x152d53](_0x59a29a[_0x3885('0x69')],_0x59a29a['value'][_0x3885('0x6a')],_0x59a29a[_0x3885('0x63')]['end']);}break;case _0x3885('0x6b'):var _0x1d201b=_0x2080e0['value']['split'](',')[_0x3885('0x2e')](function(_0x536f77){return Number(_0x536f77);});_0x1d201b[_0x3885('0x33')](function(_0x476475){_0x2d4b58['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x476475+',%');});_0x1f68a0=_[_0x3885('0x6c')](_0x1f68a0,_0x1d201b);break;case _0x3885('0x6d'):if(_0x2080e0[_0x3885('0x62')]===_0x3885('0x6e')){_0x6c25a0[_0x152d53](_0x3885('0x6f'),'%'+_0x2080e0[_0x3885('0x63')]+'%',null);}else{_0xb29af9=_[_0x3885('0x5f')](_0x387b5f,[_0x3885('0x2c'),_0x3885('0x70')]);_0x2080e0[_0x3885('0x48')]=_0x3885('0x70');_0x59a29a=as[_0x3885('0x68')](_0x27f2f2,_0xb29af9[_0x3885('0x39')],_0x2080e0);_0x6c25a0[_0x152d53](_0x59a29a[_0x3885('0x69')],_0x59a29a[_0x3885('0x63')]['start'],_0x59a29a['value'][_0x3885('0x21')]);}break;case _0x3885('0x71'):_0x59a29a=as[_0x3885('0x68')]('me',null,_0x2080e0);_0x6c25a0[_0x152d53](_0x59a29a['text'],_0x59a29a['value'][_0x3885('0x6a')],_0x59a29a['value'][_0x3885('0x21')]);break;}}else{var _0x59a29a=as[_0x3885('0x68')](_0x27f2f2,_0xb29af9[_0x3885('0x39')],_0x2080e0);_0x6c25a0[_0x152d53](_0x59a29a['text'],_0x59a29a[_0x3885('0x63')][_0x3885('0x6a')],_0x59a29a[_0x3885('0x63')][_0x3885('0x21')]);}}}else{var _0x38d265=_(_0x34a69a[_0x3885('0x3b')])['keys']()[_0x3885('0x2e')](function(_0x723961){return _['some'](_0x387b5f,[_0x3885('0x2c'),_0x723961])?_0x723961:undefined;})[_0x3885('0x72')]()[_0x3885('0x63')]();if(!_[_0x3885('0x73')](_0x38d265)){_0x38d265[_0x3885('0x33')](function(_0x14f313){if(_0x14f313==='OpenchannelAccountId'){_0x47c84a[_0x3885('0x46')](_0x3885('0x74'),[][_0x3885('0x75')](_0x34a69a['query'][_0x14f313]));}else if(_0x14f313===_0x3885('0x76')){var _0x152bf2=JSON[_0x3885('0x77')](_0x34a69a[_0x3885('0x3b')][_0x14f313])[_0x3885('0x78')];var _0x5b1210=JSON[_0x3885('0x77')](_0x34a69a[_0x3885('0x3b')][_0x14f313])[_0x3885('0x79')];_0x47c84a[_0x3885('0x46')](_0x3885('0x7a'),_0x152bf2,_0x5b1210);}else{if(_0x34a69a[_0x3885('0x3b')][_0x14f313]===_0x3885('0x7b')){_0x47c84a['where']('i.'+_0x14f313+'\x20IS\x20NULL');}else{_0x47c84a['where']('i.'+_0x14f313+_0x3885('0x7c'),_0x34a69a[_0x3885('0x3b')][_0x14f313]);}}});}if(_0x34a69a[_0x3885('0x3b')]['read']){if(_0x34a69a[_0x3885('0x3b')][_0x3885('0x7d')]==0x1){_0x47c84a[_0x3885('0x60')](_0x3885('0x7e'));}else{_0x47c84a['having']('`unreadMessages`\x20>\x200');}}if(_0x34a69a['query'][_0x3885('0x7f')]){_0x1f68a0=_['isArray'](_0x34a69a[_0x3885('0x3b')][_0x3885('0x7f')])?_0x34a69a[_0x3885('0x3b')][_0x3885('0x7f')]:new Array(_0x34a69a[_0x3885('0x3b')][_0x3885('0x7f')]);_0x1f68a0['forEach'](function(_0x423f97){_0x2d4b58['or'](_0x3885('0x80'),'%,'+_0x423f97+',%');});}if(_0x34a69a[_0x3885('0x3b')][_0x3885('0x81')]){var _0x3ff003=_0x34a69a[_0x3885('0x3b')][_0x3885('0x81')]['replace']('\x5c','\x5c\x5c')[_0x3885('0x82')]('\x27\x27',_0x3885('0x83'));if(qs[_0x3885('0x84')](_0x3ff003)){_0x6c25a0['or']('i.id\x20LIKE\x20?',_0x3ff003+'%');}else{_0x6c25a0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3885('0x65')](_0x3ff003))['or']('i.from\x20LIKE\x20?',_0x3ff003+'%')['or'](_0x3885('0x85'),_0x3ff003+'%');}}}_0x47c84a['where'](_0x6c25a0);_0x47c84a[_0x3885('0x86')](_0x3885('0x87'));var _0x370d54={'type':db['Sequelize']['QueryTypes'][_0x3885('0x88')],'raw':!![]};var _0x9b33ff=_0x47c84a[_0x3885('0x89')]();_0x9b33ff[_0x3885('0x48')]('i.id');_0x9b33ff[_0x3885('0x48')](_0x3885('0x8a'),_0x3885('0x8b'));if(_0xd117a4[_0x3885('0x44')]){_0xd117a4[_0x3885('0x44')][_0x3885('0x33')](function(_0x139f3c){_0x47c84a[_0x3885('0x44')]('i.'+_0x139f3c[0x0],_0x139f3c[0x1]===_0x3885('0x8c')?![]:!![]);});}if(!_[_0x3885('0x73')](_0x1f68a0)){_0x47c84a[_0x3885('0x60')](_0x2d4b58);_0x9b33ff['where'](_0x3885('0x8d'),_0x1f68a0);}BPromise[_0x3885('0x8e')]()[_0x3885('0x29')](function(){if(!_0xf48643){if(_0x34a69a[_0x3885('0x3b')][_0x3885('0x8f')]||_0x34a69a['query'][_0x3885('0x90')])return;_0x9b33ff[_0x3885('0x46')](_0x3885('0x91'));_0x47c84a[_0x3885('0x46')](_0x3885('0x91'));return;}return _0x34a69a[_0x3885('0x92')][_0x3885('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x599156){if(_[_0x3885('0x73')](_0x599156)){_0x9b33ff[_0x3885('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x47c84a[_0x3885('0x46')](_0x3885('0x94'));}else{_0x9b33ff['where']('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x599156,'id'));_0x47c84a[_0x3885('0x46')](_0x3885('0x74'),_[_0x3885('0x2e')](_0x599156,'id'));}});})['then'](function(){db['sequelize'][_0x3885('0x3b')](_0x9b33ff[_0x3885('0x95')](),_0x370d54)['then'](function(_0xcea21b){_0x562b0e[_0x3885('0x23')]=_0xcea21b[_0x3885('0x42')];if(_0x562b0e[_0x3885('0x23')]===0x0)return[];return db['sequelize'][_0x3885('0x3b')](_0x3be8b6[_0x3885('0x95')](),_0x370d54)[_0x3885('0x29')](function(_0x2c8c47){_0x47c23b=_[_0x3885('0x96')](_0x2c8c47,'id');_0x370d54=_[_0x3885('0x97')](_0x370d54,{'model':db[_0x3885('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34a69a[_0x3885('0x3b')]['fields']){_0xd117a4[_0x3885('0x41')][_0x3885('0x33')](function(_0x16b278){_0x47c84a[_0x3885('0x48')]('i.'+_0x16b278);});}else{_0x47c84a[_0x3885('0x48')](_0x3885('0x8a'),_0x3885('0x8b'));_0x47c84a[_0x3885('0x48')](_0x3885('0x98'),_0x3885('0x99'));_0x47c84a[_0x3885('0x48')](_0x3885('0x9a'),_0x3885('0x9b'));_0x47c84a[_0x3885('0x48')]('i.*');_0x47c84a[_0x3885('0x48')](_0x3885('0x9c'),'Contact.firstName');_0x47c84a['field'](_0x3885('0x9d'),_0x3885('0x9e'));_0x47c84a[_0x3885('0x48')](_0x3885('0x9f'),'Contact.email');_0x47c84a[_0x3885('0x48')](_0x3885('0xa0'),_0x3885('0xa1'));_0x47c84a[_0x3885('0x48')](_0x3885('0xa2'),'Contact.mobile');_0x47c84a[_0x3885('0x48')]('c.fax',_0x3885('0xa3'));_0x47c84a[_0x3885('0x48')](_0x3885('0xa4'),_0x3885('0xa5'));_0x47c84a['field'](_0x3885('0xa6'),_0x3885('0xa7'));_0x47c84a[_0x3885('0x48')](_0x3885('0xa8'),_0x3885('0x30'));}if(_0xd117a4[_0x3885('0x25')])_0x47c84a[_0x3885('0x25')](_0xd117a4[_0x3885('0x25')]);if(_0xd117a4['offset'])_0x47c84a[_0x3885('0x24')](_0xd117a4[_0x3885('0x24')]);return db['sequelize'][_0x3885('0x3b')](_0x47c84a[_0x3885('0x95')](),_0x370d54);})[_0x3885('0x29')](function(_0x498f5c){_0x401ab0[_0x3885('0x46')](_0x3885('0xa9'),_[_0x3885('0x2e')](_0x498f5c,'id'));return db[_0x3885('0xaa')][_0x3885('0x3b')](_0x401ab0[_0x3885('0x95')](),_0x370d54)[_0x3885('0x29')](function(_0xe0bf4a){var _0x428a02=_[_0x3885('0xab')](_0xe0bf4a,'OpenchannelInteractionId');var _0x1aa734=[];_0x498f5c[_0x3885('0x33')](function(_0x417d5d){_0x1aa734[_0x3885('0x34')](updateOpenchannelInteraction(_0x417d5d,_0x47c23b,_0x428a02));});return BPromise[_0x3885('0xac')](_0x1aa734);});});})[_0x3885('0x29')](function(_0x551e7a){_0x562b0e[_0x3885('0xad')]=_0x551e7a;return _0x562b0e;})['then'](respondWithFilteredResult(_0x31eb52,_0xd117a4));})['catch'](handleError(_0x31eb52,null));};exports[_0x3885('0xae')]=function(_0x1d75b5,_0x4f24d8){var _0xa2f1a={'raw':![],'where':{'id':_0x1d75b5['params']['id']}},_0x18283b={};_0x18283b[_0x3885('0x3f')]=_[_0x3885('0x3c')](db['OpenchannelInteraction'][_0x3885('0x38')]);_0x18283b[_0x3885('0x3b')]=_['keys'](_0x1d75b5[_0x3885('0x3b')]);_0x18283b[_0x3885('0x3d')]=_[_0x3885('0x3e')](_0x18283b[_0x3885('0x3f')],_0x18283b[_0x3885('0x3b')]);_0xa2f1a['attributes']=_[_0x3885('0x3e')](_0x18283b['model'],qs[_0x3885('0x40')](_0x1d75b5['query'][_0x3885('0x40')]));_0xa2f1a[_0x3885('0x41')]=_0xa2f1a[_0x3885('0x41')][_0x3885('0x42')]?_0xa2f1a['attributes']:_0x18283b[_0x3885('0x3f')];if(_0x1d75b5[_0x3885('0x3b')]['includeAll']){_0xa2f1a[_0x3885('0xaf')]=[{'all':!![]}];}_0xa2f1a=_[_0x3885('0x97')]({},_0xa2f1a,_0x1d75b5[_0x3885('0xb0')]);return db[_0x3885('0x37')][_0x3885('0x5f')](_0xa2f1a)['then'](handleEntityNotFound(_0x4f24d8,null))[_0x3885('0x29')](respondWithResult(_0x4f24d8,null))[_0x3885('0x35')](handleError(_0x4f24d8,null));};exports[_0x3885('0xb1')]=function(_0x174c34,_0x5f54b8){return db[_0x3885('0x37')][_0x3885('0xb1')](_0x174c34['body'],{})[_0x3885('0x29')](respondWithResult(_0x5f54b8,0xc9))[_0x3885('0x35')](handleError(_0x5f54b8,null));};exports[_0x3885('0x28')]=function(_0xc6c8cc,_0xd67adf){if(_0xc6c8cc[_0x3885('0x71')]['id']){delete _0xc6c8cc[_0x3885('0x71')]['id'];}return db[_0x3885('0x37')][_0x3885('0x5f')]({'where':{'id':_0xc6c8cc[_0x3885('0xb2')]['id']}})['then'](handleEntityNotFound(_0xd67adf,null))['then'](saveUpdates(_0xc6c8cc[_0x3885('0x71')],null))[_0x3885('0x29')](respondWithResult(_0xd67adf,null))['catch'](handleError(_0xd67adf,null));};exports['destroy']=function(_0x40c28a,_0x2072b3){return db[_0x3885('0x37')]['find']({'where':{'id':_0x40c28a[_0x3885('0xb2')]['id']}})[_0x3885('0x29')](handleEntityNotFound(_0x2072b3,null))[_0x3885('0x29')](removeEntity(_0x2072b3,null))['catch'](handleError(_0x2072b3,null));};exports[_0x3885('0xb3')]=function(_0x53415a,_0x45511e){return db[_0x3885('0x37')][_0x3885('0xb3')]()['then'](respondWithResult(_0x45511e,null))['catch'](handleError(_0x45511e,null));};exports['addMessage']=function(_0x38b658,_0x18de97,_0x3ced2c){return db['OpenchannelMessage'][_0x3885('0x5f')]({'where':{'id':_0x38b658[_0x3885('0xb2')]['id']}})['then'](handleEntityNotFound(_0x18de97,null))[_0x3885('0x29')](function(_0xc1ff35){if(_0xc1ff35){return _0xc1ff35[_0x3885('0xb4')](_0x38b658['body'][_0x3885('0xb5')],_[_0x3885('0xb6')](_0x38b658['body'],[_0x3885('0xb5'),'id'])||{});}})[_0x3885('0x29')](respondWithResult(_0x18de97,null))[_0x3885('0x35')](handleError(_0x18de97,null));};exports['getMessages']=function(_0x351cc9,_0x5109fe,_0x382fb6){var _0x5c965a={'raw':![],'where':{}};var _0x2514ed={};var _0x12b240={'count':0x0,'rows':[]};return db[_0x3885('0x37')][_0x3885('0xb7')]({'where':{'id':_0x351cc9['params']['id']}})['then'](handleEntityNotFound(_0x5109fe,null))[_0x3885('0x29')](function(_0x4d2fe3){if(_0x4d2fe3){_0x2514ed['model']=_[_0x3885('0x3c')](db[_0x3885('0xb8')][_0x3885('0x38')]);_0x2514ed[_0x3885('0x3b')]=_['keys'](_0x351cc9[_0x3885('0x3b')]);_0x2514ed['filters']=_[_0x3885('0x3e')](_0x2514ed[_0x3885('0x3f')],_0x2514ed[_0x3885('0x3b')]);_0x5c965a[_0x3885('0x41')]=_[_0x3885('0x3e')](_0x2514ed[_0x3885('0x3f')],qs[_0x3885('0x40')](_0x351cc9[_0x3885('0x3b')][_0x3885('0x40')]));_0x5c965a[_0x3885('0x41')]=_0x5c965a[_0x3885('0x41')]['length']?_0x5c965a['attributes']:_0x2514ed[_0x3885('0x3f')];if(!_0x351cc9['query'][_0x3885('0x43')](_0x3885('0xb9'))){_0x5c965a[_0x3885('0x25')]=qs['limit'](_0x351cc9[_0x3885('0x3b')][_0x3885('0x25')]);_0x5c965a[_0x3885('0x24')]=qs[_0x3885('0x24')](_0x351cc9['query'][_0x3885('0x24')]);}_0x5c965a[_0x3885('0x44')]=qs['sort'](_0x351cc9[_0x3885('0x3b')][_0x3885('0x45')]);_0x5c965a[_0x3885('0x46')]=qs[_0x3885('0x3d')](_['pick'](_0x351cc9[_0x3885('0x3b')],_0x2514ed['filters']));_0x5c965a[_0x3885('0x46')][_0x3885('0xba')]=_0x4d2fe3['id'];if(_0x351cc9[_0x3885('0x3b')][_0x3885('0x81')]){_0x5c965a['where']=_[_0x3885('0x97')](_0x5c965a[_0x3885('0x46')],{'$or':_[_0x3885('0x2e')](_0x5c965a[_0x3885('0x41')],function(_0x1e554f){var _0x18ebac={};_0x18ebac[_0x1e554f]={'$like':'%'+_0x351cc9['query']['filter']+'%'};return _0x18ebac;})});}if(_0x351cc9['query']['$gte']){var _0x3ba0f7=_0x351cc9['query']['$gte'][_0x3885('0x32')](',');var _0x21e80f={};_0x21e80f[_0x3ba0f7[0x0]]={'$gte':moment(_0x3ba0f7[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x5c965a[_0x3885('0x46')]=_[_0x3885('0x97')](_0x5c965a[_0x3885('0x46')],_0x21e80f);}_0x5c965a=_['merge']({},_0x5c965a,_0x351cc9[_0x3885('0xb0')]);return db['OpenchannelMessage'][_0x3885('0x23')]({'where':_0x5c965a[_0x3885('0x46')]})[_0x3885('0x29')](function(_0x1a0f27){_0x12b240['count']=_0x1a0f27;if(_0x351cc9[_0x3885('0x3b')]['includeAll']){_0x5c965a[_0x3885('0xaf')]=[{'all':!![]}];}return db[_0x3885('0xb8')][_0x3885('0xbb')](_0x5c965a);})[_0x3885('0x29')](function(_0x24c7fd){_0x12b240[_0x3885('0xad')]=_0x24c7fd;return _0x12b240;});}})[_0x3885('0x29')](respondWithFilteredResult(_0x5109fe,_0x5c965a))['catch'](handleError(_0x5109fe,null));};exports['addTags']=function(_0x1fada4,_0x3a7418,_0x475fb9){return db[_0x3885('0x37')]['find']({'where':{'id':_0x1fada4[_0x3885('0xb2')]['id']}})[_0x3885('0x29')](handleEntityNotFound(_0x3a7418,null))[_0x3885('0x29')](function(_0x1d68b7){if(_0x1d68b7){return _0x1d68b7[_0x3885('0xbc')](_0x1fada4[_0x3885('0x71')][_0x3885('0xb5')],_[_0x3885('0xb6')](_0x1fada4['body'],[_0x3885('0xb5'),'id'])||{})['spread'](function(){return db[_0x3885('0x6b')][_0x3885('0xbb')]({'attributes':['id',_0x3885('0x2c'),_0x3885('0x49')],'where':{'id':_0x1fada4['body'][_0x3885('0xb5')]}});})['then'](function(_0x5f507f){socket[_0x3885('0xbd')](_0x3885('0xbe'),{'id':Number(_0x1fada4[_0x3885('0xb2')]['id']),'tags':_0x5f507f||[]});return{'id':Number(_0x1fada4[_0x3885('0xb2')]['id']),'tags':_0x5f507f||[]};});}})[_0x3885('0x29')](respondWithResult(_0x3a7418,null))[_0x3885('0x35')](handleError(_0x3a7418,null));};exports[_0x3885('0xbf')]=function(_0x10e8cb,_0x15ea27,_0x2950b1){return db[_0x3885('0x37')][_0x3885('0x5f')]({'where':{'id':_0x10e8cb[_0x3885('0xb2')]['id']}})[_0x3885('0x29')](handleEntityNotFound(_0x15ea27,null))[_0x3885('0x29')](function(_0x42c8cd){if(_0x42c8cd){return _0x42c8cd[_0x3885('0xbf')](_0x10e8cb['query'][_0x3885('0xb5')]);}})[_0x3885('0x29')](respondWithStatusCode(_0x15ea27,null))[_0x3885('0x35')](handleError(_0x15ea27,null));};exports[_0x3885('0xc0')]=function(_0x1d8ac1,_0x46f7d1){var _0x38b61a=moment()['unix']()[_0x3885('0x95')]();var _0x185b4e=path[_0x3885('0xc1')](config[_0x3885('0xc2')],_0x3885('0xc3'),_0x3885('0xc4'),_0x3885('0xc5'));var _0x33011a=path[_0x3885('0xc1')](config[_0x3885('0xc2')],_0x3885('0xc3'),_0x3885('0xc4'),_0x3885('0xc6'));var _0xd672c0=path[_0x3885('0xc1')](_0x185b4e,_0x38b61a);var _0x261f1d=util[_0x3885('0xc7')]('transcript-%d-%s.zip',_0x1d8ac1[_0x3885('0xb2')]['id'],_0x38b61a);var _0x4cee58=path['join'](_0x185b4e,_0x261f1d);var _0x3d94dd=[];_0x3d94dd['push']({'model':db[_0x3885('0x6d')],'as':_0x3885('0x6d'),'attributes':['id',_0x3885('0x2f')],'raw':!![]});_0x3d94dd[_0x3885('0x34')]({'model':db[_0x3885('0xc8')],'as':'Contact','attributes':['id',_0x3885('0xc9'),'lastName'],'raw':!![]});if(_0x1d8ac1[_0x3885('0x3b')]['attachments']){_0x3d94dd[_0x3885('0x34')]({'model':db[_0x3885('0xca')],'as':'Attachment','raw':!![]});}var _0x5c3c29=[{'model':db[_0x3885('0xb8')],'as':_0x3885('0xcb'),'attributes':['id',_0x3885('0x71'),_0x3885('0x76'),_0x3885('0xcc'),_0x3885('0xcd'),_0x3885('0x7d')],'include':_0x3d94dd}];_0x5c3c29[_0x3885('0x34')]({'model':db[_0x3885('0xce')],'as':_0x3885('0xcf'),'attributes':['id','name']});_0x5c3c29['push']({'model':db[_0x3885('0x6d')],'as':_0x3885('0xd0'),'attributes':['id',_0x3885('0x2f')]});return db[_0x3885('0x37')]['find']({'where':{'id':_0x1d8ac1[_0x3885('0xb2')]['id']},'include':_0x5c3c29})[_0x3885('0x29')](handleEntityNotFound(_0x46f7d1,null))[_0x3885('0x29')](function(_0xcb0101){if(_0xcb0101){var _0x2c50bc=_0xcb0101['get']({'plain':!![]});fs['mkdirSync'](_0xd672c0);var _0x1c2d70={'format':'A4','border':_0x3885('0xd1'),'header':{'height':_0x3885('0xd2'),'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':_0x3885('0xd3'),'contents':{'default':util[_0x3885('0xc7')](_0x3885('0xd4'),util[_0x3885('0xc7')](_0x3885('0xd5'),_0x3885('0xd6'),_0x2c50bc['id']),moment()[_0x3885('0xc7')](_0x3885('0xd7'))[_0x3885('0x95')]())}}};var _0x1387b9={'channel':_0x3885('0xd6'),'account':_0x2c50bc[_0x3885('0xcf')][_0x3885('0x2c')],'agent':_0x2c50bc['Owner']?_0x2c50bc[_0x3885('0xd0')]['fullname']:_0x3885('0xd8'),'createdAt':moment(_0x2c50bc['createdAt'])[_0x3885('0xc7')](_0x3885('0xd9'))[_0x3885('0x95')](),'closedAt':_0x2c50bc[_0x3885('0xda')]?moment(_0x2c50bc[_0x3885('0xdb')])[_0x3885('0xc7')](_0x3885('0xd9'))[_0x3885('0x95')]():'','disposition':_0x2c50bc['disposition'],'visibility':_0x2c50bc[_0x3885('0xdc')]?_0x3885('0xdd'):_0x3885('0xde'),'messages':_(_0x2c50bc['Messages'])['filter']({'secret':![]})['map'](function(_0x51bf41){if(_0x51bf41[_0x3885('0xca')]){var _0xfd60ac=path['join'](_0x33011a,_0x51bf41['Attachment'][_0x3885('0xdf')]);if(fs['existsSync'](_0xfd60ac)){fs[_0x3885('0xe0')](_0xfd60ac)[_0x3885('0xe1')](fs[_0x3885('0xe2')](path[_0x3885('0xc1')](_0xd672c0,_0x51bf41['Attachment']['basename'])));}}return{'date':moment(_0x51bf41[_0x3885('0x76')])[_0x3885('0xc7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3885('0x95')](),'sender':_0x51bf41['direction']==='out'?_0x51bf41[_0x3885('0x6d')]?_0x51bf41[_0x3885('0x6d')][_0x3885('0x2f')]:_0x3885('0xe3'):_0x51bf41[_0x3885('0xe4')][_0x3885('0xc9')]+(_0x51bf41['Contact'][_0x3885('0xe5')]?'\x20'+_0x51bf41['Contact'][_0x3885('0xe5')]:''),'body':_0x51bf41['Attachment']?_0x51bf41[_0x3885('0xca')]['basename']:_0x51bf41[_0x3885('0x71')],'direction':_0x51bf41[_0x3885('0xcc')]===_0x3885('0xe6')?'A':'C','secret':_0x51bf41['secret'],'read':_0x51bf41[_0x3885('0x7d')],'attachment':_0x51bf41[_0x3885('0xca')]};})['value']()};return ejs['renderFile'](path[_0x3885('0xc1')](config[_0x3885('0xc2')],_0x3885('0xc3'),_0x3885('0xe7'),_0x3885('0xe8')),{'interaction':_0x1387b9})[_0x3885('0x29')](function(_0x58a9ef){return new BPromise(function(_0x43ec26,_0x28210d){pdf[_0x3885('0xb1')](_0x58a9ef,_0x1c2d70)[_0x3885('0xe9')](path[_0x3885('0xc1')](_0xd672c0,'transcript-'+_0x2c50bc['id']+'-'+_0x38b61a+_0x3885('0xea')),function(_0x39907f,_0x140540){if(_0x39907f)return _0x28210d(_0x39907f);_0x43ec26(_0x140540);});});})['then'](function(){return new BPromise(function(_0x57a4ee,_0x5e146c){zipdir(_0xd672c0,{'saveTo':_0x4cee58},function(_0x3cbaef,_0xc21b17){if(_0x3cbaef)return _0x5e146c(_0x3cbaef);return _0x57a4ee(_0xc21b17);});})[_0x3885('0x29')](function(){return new BPromise(function(_0x2589c4,_0x454cd1){rimraf(_0xd672c0,function(_0x6aabcf){if(_0x6aabcf)_0x454cd1(_0x6aabcf);return _0x2589c4();});});})[_0x3885('0x29')](function(){return _0x46f7d1[_0x3885('0xc0')](_0x4cee58,_0x261f1d,function(_0x1a5e16){if(_0x1a5e16){console['log'](_0x3885('0xeb'),_0x1a5e16);}else{fs[_0x3885('0xec')](_0x4cee58);}});});});}else{return _0x46f7d1[_0x3885('0x1f')](0xc8);}})[_0x3885('0x35')](handleError(_0x46f7d1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9d54438..778bf44 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 _0xe19a=['emit','catch','hook','exports','events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x328621,_0xef7008){var _0x141b03=function(_0x4209c1){while(--_0x4209c1){_0x328621['push'](_0x328621['shift']());}};_0x141b03(++_0xef7008);}(_0xe19a,0xd4));var _0xae19=function(_0x1dc73e,_0x792805){_0x1dc73e=_0x1dc73e-0x0;var _0x35274b=_0xe19a[_0x1dc73e];return _0x35274b;};'use strict';var EventEmitter=require(_0xae19('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xae19('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xae19('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xae19('0x3')](0x0);var events={'afterCreate':_0xae19('0x4'),'afterUpdate':'update','afterDestroy':_0xae19('0x5')};function emitEvent(_0x497c77){return function(_0x3861c6,_0x3d361d,_0x2f6bda){_0x3861c6[_0xae19('0x6')]({'attributes':['id'],'raw':!![]})[_0xae19('0x7')](function(_0x967d55){_0x3861c6[_0xae19('0x8')](_0xae19('0x9'),_0x967d55[_0xae19('0xa')](function(_0x5a9758){return{'id':_0x5a9758['id']};}));return OpenchannelMessage[_0xae19('0xb')]({'where':{'OpenchannelInteractionId':_0x3861c6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae19('0x7')](function(_0x2d69e0){_0x3861c6[_0xae19('0x8')]('unreadMessages',_0x2d69e0['length']);OpenchannelInteractionEvents[_0xae19('0xc')](_0x497c77+':'+_0x3861c6['id'],_0x3861c6);OpenchannelInteractionEvents[_0xae19('0xc')](_0x497c77,_0x3861c6);_0x2f6bda(null);})[_0xae19('0xd')](_0x2f6bda(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xae19('0xe')](e,emitEvent(event));}}module[_0xae19('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6c63=['Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','then','setDataValue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6c63,0xda));var _0x36c6=function(_0x572a5b,_0x4eba65){_0x572a5b=_0x572a5b-0x0;var _0x138393=_0x6c63[_0x572a5b];return _0x138393;};'use strict';var EventEmitter=require(_0x36c6('0x0'));var OpenchannelInteraction=require(_0x36c6('0x1'))['db'][_0x36c6('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x36c6('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x36c6('0x4')](0x0);var events={'afterCreate':_0x36c6('0x5'),'afterUpdate':'update','afterDestroy':_0x36c6('0x6')};function emitEvent(_0x473b74){return function(_0xfce7ae,_0x171e08,_0x182c75){_0xfce7ae[_0x36c6('0x7')]({'attributes':['id'],'raw':!![]})[_0x36c6('0x8')](function(_0x1c1c77){_0xfce7ae[_0x36c6('0x9')](_0x36c6('0xa'),_0x1c1c77[_0x36c6('0xb')](function(_0x251717){return{'id':_0x251717['id']};}));return OpenchannelMessage[_0x36c6('0xc')]({'where':{'OpenchannelInteractionId':_0xfce7ae['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x598de0){_0xfce7ae[_0x36c6('0x9')](_0x36c6('0xd'),_0x598de0[_0x36c6('0xe')]);OpenchannelInteractionEvents[_0x36c6('0xf')](_0x473b74+':'+_0xfce7ae['id'],_0xfce7ae);OpenchannelInteractionEvents[_0x36c6('0xf')](_0x473b74,_0xfce7ae);_0x182c75(null);})['catch'](_0x182c75(null));};}for(var e in events){if(events[_0x36c6('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x36c6('0x11')](e,emitEvent(event));}}module[_0x36c6('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6d43128..1b29727 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 _0x7d19=['path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise'];(function(_0x1046cb,_0x137f83){var _0x59c46a=function(_0x3b2e08){while(--_0x3b2e08){_0x1046cb['push'](_0x1046cb['shift']());}};_0x59c46a(++_0x137f83);}(_0x7d19,0x175));var _0x97d1=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x7d19[_0x33f7e1];return _0x23bab4;};'use strict';var _=require(_0x97d1('0x0'));var util=require(_0x97d1('0x1'));var logger=require('../../config/logger')(_0x97d1('0x2'));var moment=require('moment');var BPromise=require(_0x97d1('0x3'));var rp=require(_0x97d1('0x4'));var fs=require('fs');var path=require(_0x97d1('0x5'));var rimraf=require(_0x97d1('0x6'));var config=require(_0x97d1('0x7'));var attributes=require(_0x97d1('0x8'));module[_0x97d1('0x9')]=function(_0xf4aeae,_0x144888){return _0xf4aeae[_0x97d1('0xa')](_0x97d1('0xb'),attributes,{'tableName':_0x97d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x511c91,_0x4b1823,_0x4f73f6){if(_0x511c91[_0x97d1('0xd')](_0x97d1('0xe'))){_0x511c91[_0x97d1('0xf')]=moment()[_0x97d1('0x10')](_0x97d1('0x11'));}_0x4f73f6(null,_0x511c91);}}});}; \ No newline at end of file +var _0x710e=['bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment'];(function(_0x591f98,_0x2a143){var _0xa3dae0=function(_0x1b3469){while(--_0x1b3469){_0x591f98['push'](_0x591f98['shift']());}};_0xa3dae0(++_0x2a143);}(_0x710e,0xde));var _0xe710=function(_0x40e108,_0x4d1673){_0x40e108=_0x40e108-0x0;var _0x5b4862=_0x710e[_0x40e108];return _0x5b4862;};'use strict';var _=require('lodash');var util=require(_0xe710('0x0'));var logger=require('../../config/logger')(_0xe710('0x1'));var moment=require(_0xe710('0x2'));var BPromise=require(_0xe710('0x3'));var rp=require(_0xe710('0x4'));var fs=require('fs');var path=require(_0xe710('0x5'));var rimraf=require(_0xe710('0x6'));var config=require('../../config/environment');var attributes=require(_0xe710('0x7'));module[_0xe710('0x8')]=function(_0x14de65,_0x34db92){return _0x14de65[_0xe710('0x9')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5252aa,_0x4695c0,_0x41030a){if(_0x5252aa[_0xe710('0xa')](_0xe710('0xb'))){_0x5252aa[_0xe710('0xc')]=moment()[_0xe710('0xd')](_0xe710('0xe'));}_0x41030a(null,_0x5252aa);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7f40091..a7d9ff4 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 _0xd140=['addTags','ids','omit','spread','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','then','AddTagsToOpenchannelInteraction','where'];(function(_0x2376c7,_0x18e876){var _0x31ecbc=function(_0x1c289a){while(--_0x1c289a){_0x2376c7['push'](_0x2376c7['shift']());}};_0x31ecbc(++_0x18e876);}(_0xd140,0x1d4));var _0x0d14=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd140[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d14('0x0'));var util=require('util');var moment=require(_0x0d14('0x1'));var BPromise=require(_0x0d14('0x2'));var rs=require(_0x0d14('0x3'));var fs=require('fs');var Redis=require(_0x0d14('0x4'));var db=require(_0x0d14('0x5'))['db'];var utils=require(_0x0d14('0x6'));var logger=require('../../config/logger')(_0x0d14('0x7'));var config=require(_0x0d14('0x8'));var jayson=require(_0x0d14('0x9'));var client=jayson['client'][_0x0d14('0xa')]({'port':0x232a});config[_0x0d14('0xb')]=_[_0x0d14('0xc')](config[_0x0d14('0xb')],{'host':_0x0d14('0xd'),'port':0x18eb});var socket=require(_0x0d14('0xe'))(new Redis(config[_0x0d14('0xb')]));require(_0x0d14('0xf'))['register'](socket);function respondWithRpcPromise(_0x1b6874,_0x158eff,_0x597e0f){return new BPromise(function(_0x3ad203,_0x18ba15){return client[_0x0d14('0x10')](_0x1b6874,_0x597e0f)['then'](function(_0x33e545){logger[_0x0d14('0x11')](_0x0d14('0x12'),_0x158eff,_0x0d14('0x13'));logger['debug'](_0x0d14('0x14'),_0x158eff,'request\x20sent',JSON[_0x0d14('0x15')](_0x33e545));if(_0x33e545[_0x0d14('0x16')]){if(_0x33e545['error']['code']===0x1f4){logger[_0x0d14('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x158eff,_0x33e545['error'][_0x0d14('0x17')]);return _0x18ba15(_0x33e545[_0x0d14('0x16')][_0x0d14('0x17')]);}logger[_0x0d14('0x16')](_0x0d14('0x12'),_0x158eff,_0x33e545[_0x0d14('0x16')][_0x0d14('0x17')]);return _0x3ad203(_0x33e545[_0x0d14('0x16')]['message']);}else{logger[_0x0d14('0x11')](_0x0d14('0x12'),_0x158eff,_0x0d14('0x13'));_0x3ad203(_0x33e545[_0x0d14('0x18')]['message']);}})[_0x0d14('0x19')](function(_0x2d9da9){logger[_0x0d14('0x16')](_0x0d14('0x12'),_0x158eff,_0x2d9da9);_0x18ba15(_0x2d9da9);});});}exports[_0x0d14('0x1a')]=function(_0x48c1cb){var _0x306e44=this;return new Promise(function(_0x34f275,_0x2a3e45){return db[_0x0d14('0x1b')][_0x0d14('0x1c')](_0x48c1cb[_0x0d14('0x1d')],{'raw':_0x48c1cb['options']?_0x48c1cb[_0x0d14('0x1e')][_0x0d14('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48c1cb['options']?_0x48c1cb['options']['where']||null:null,'attributes':_0x48c1cb[_0x0d14('0x1e')]?_0x48c1cb[_0x0d14('0x1e')][_0x0d14('0x20')]||null:null,'limit':_0x48c1cb[_0x0d14('0x1e')]?_0x48c1cb['options']['limit']||null:null})[_0x0d14('0x21')](function(_0x14c7a8){logger[_0x0d14('0x11')](_0x0d14('0x1a'),_0x48c1cb);logger['debug'](_0x0d14('0x1a'),_0x48c1cb,JSON[_0x0d14('0x15')](_0x14c7a8));_0x34f275(_0x14c7a8);})[_0x0d14('0x19')](function(_0x53e788){logger[_0x0d14('0x16')](_0x0d14('0x1a'),_0x53e788['message'],_0x48c1cb);_0x2a3e45(_0x306e44[_0x0d14('0x16')](0x1f4,_0x53e788[_0x0d14('0x17')]));});});};exports[_0x0d14('0x22')]=function(_0x1be49d){return new Promise(function(_0x4d557e,_0x2d5059){return db[_0x0d14('0x1b')]['find']({'where':_0x1be49d['options']?_0x1be49d[_0x0d14('0x1e')][_0x0d14('0x23')]||null:null})[_0x0d14('0x21')](function(_0x50c333){if(_0x50c333){return _0x50c333[_0x0d14('0x24')](_0x1be49d[_0x0d14('0x1d')][_0x0d14('0x25')],_[_0x0d14('0x26')](_0x1be49d[_0x0d14('0x1d')],[_0x0d14('0x25'),'id'])||{});}})[_0x0d14('0x27')](function(_0x415033){logger['info'](_0x0d14('0x28'),_0x1be49d);logger[_0x0d14('0x29')]('AddTags',_0x1be49d,JSON['stringify'](_0x415033));_0x4d557e(_0x415033);})[_0x0d14('0x19')](function(_0x3de4e5){logger['error'](_0x0d14('0x28'),_0x3de4e5['message'],_0x1be49d);_0x2d5059(_this[_0x0d14('0x16')](0x1f4,_0x3de4e5[_0x0d14('0x17')]));});});}; \ No newline at end of file +var _0x2989=['client','http','redis','defaults','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','catch','AddTagsToOpenchannelInteraction','find','addTags','omit','ids','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x2989,0x74));var _0x9298=function(_0x3373d1,_0x45f072){_0x3373d1=_0x3373d1-0x0;var _0xe4375f=_0x2989[_0x3373d1];return _0xe4375f;};'use strict';var _=require(_0x9298('0x0'));var util=require('util');var moment=require(_0x9298('0x1'));var BPromise=require(_0x9298('0x2'));var rs=require(_0x9298('0x3'));var fs=require('fs');var Redis=require(_0x9298('0x4'));var db=require(_0x9298('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9298('0x6'))(_0x9298('0x7'));var config=require(_0x9298('0x8'));var jayson=require(_0x9298('0x9'));var client=jayson[_0x9298('0xa')][_0x9298('0xb')]({'port':0x232a});config[_0x9298('0xc')]=_[_0x9298('0xd')](config[_0x9298('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9298('0xe'))(new Redis(config[_0x9298('0xc')]));require('./openchannelInteraction.socket')[_0x9298('0xf')](socket);function respondWithRpcPromise(_0x2e900f,_0x52fe3d,_0x2ad63c){return new BPromise(function(_0x539fb0,_0xb32490){return client[_0x9298('0x10')](_0x2e900f,_0x2ad63c)['then'](function(_0x2081bf){logger[_0x9298('0x11')](_0x9298('0x12'),_0x52fe3d,_0x9298('0x13'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x52fe3d,_0x9298('0x13'),JSON[_0x9298('0x14')](_0x2081bf));if(_0x2081bf[_0x9298('0x15')]){if(_0x2081bf[_0x9298('0x15')][_0x9298('0x16')]===0x1f4){logger[_0x9298('0x15')](_0x9298('0x12'),_0x52fe3d,_0x2081bf[_0x9298('0x15')][_0x9298('0x17')]);return _0xb32490(_0x2081bf[_0x9298('0x15')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x52fe3d,_0x2081bf[_0x9298('0x15')][_0x9298('0x17')]);return _0x539fb0(_0x2081bf[_0x9298('0x15')][_0x9298('0x17')]);}else{logger[_0x9298('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x52fe3d,_0x9298('0x13'));_0x539fb0(_0x2081bf['result'][_0x9298('0x17')]);}})['catch'](function(_0x602b7e){logger['error'](_0x9298('0x12'),_0x52fe3d,_0x602b7e);_0xb32490(_0x602b7e);});});}exports[_0x9298('0x18')]=function(_0x245194){var _0x36bded=this;return new Promise(function(_0x33c56d,_0x22efa5){return db[_0x9298('0x19')][_0x9298('0x1a')](_0x245194[_0x9298('0x1b')],{'raw':_0x245194[_0x9298('0x1c')]?_0x245194['options'][_0x9298('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x245194['options']?_0x245194['options'][_0x9298('0x1e')]||null:null,'attributes':_0x245194[_0x9298('0x1c')]?_0x245194[_0x9298('0x1c')][_0x9298('0x1f')]||null:null,'limit':_0x245194[_0x9298('0x1c')]?_0x245194['options'][_0x9298('0x20')]||null:null})[_0x9298('0x21')](function(_0xbc7d07){logger[_0x9298('0x11')](_0x9298('0x18'),_0x245194);logger['debug']('UpdateOpenchannelInteraction',_0x245194,JSON['stringify'](_0xbc7d07));_0x33c56d(_0xbc7d07);})[_0x9298('0x22')](function(_0x4a53a0){logger[_0x9298('0x15')](_0x9298('0x18'),_0x4a53a0['message'],_0x245194);_0x22efa5(_0x36bded[_0x9298('0x15')](0x1f4,_0x4a53a0[_0x9298('0x17')]));});});};exports[_0x9298('0x23')]=function(_0xc1ec2f){return new Promise(function(_0x2d5248,_0x402a74){return db[_0x9298('0x19')][_0x9298('0x24')]({'where':_0xc1ec2f[_0x9298('0x1c')]?_0xc1ec2f['options'][_0x9298('0x1e')]||null:null})[_0x9298('0x21')](function(_0x46b13f){if(_0x46b13f){return _0x46b13f[_0x9298('0x25')](_0xc1ec2f[_0x9298('0x1b')]['ids'],_[_0x9298('0x26')](_0xc1ec2f[_0x9298('0x1b')],[_0x9298('0x27'),'id'])||{});}})['spread'](function(_0xa2b982){logger[_0x9298('0x11')](_0x9298('0x28'),_0xc1ec2f);logger[_0x9298('0x29')](_0x9298('0x28'),_0xc1ec2f,JSON[_0x9298('0x14')](_0xa2b982));_0x2d5248(_0xa2b982);})[_0x9298('0x22')](function(_0x3dd02b){logger[_0x9298('0x15')]('AddTags',_0x3dd02b['message'],_0xc1ec2f);_0x402a74(_this['error'](0x1f4,_0x3dd02b[_0x9298('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8c4deb3..4b7a45f 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 _0xf86b=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xf86b,0xb8));var _0xbf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86b[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xbf86('0x0'),_0xbf86('0x1'),_0xbf86('0x2')];function createListener(_0x23daa3,_0x240a30){return function(_0x2eb317){_0x240a30[_0xbf86('0x3')](_0x23daa3,_0x2eb317);};}function removeListener(_0x15d5f6,_0x18b82a){return function(){OpenchannelInteractionEvents[_0xbf86('0x4')](_0x15d5f6,_0x18b82a);};}exports[_0xbf86('0x5')]=function(_0x212f54){for(var _0x5d92d7=0x0,_0x5d93f7=events[_0xbf86('0x6')];_0x5d92d7<_0x5d93f7;_0x5d92d7++){var _0xf9c5a1=events[_0x5d92d7];var _0x1b996f=createListener(_0xbf86('0x7')+_0xf9c5a1,_0x212f54);OpenchannelInteractionEvents['on'](_0xf9c5a1,_0x1b996f);}}; \ No newline at end of file +var _0x47b5=['removeListener','length','openchannelInteraction:','save','emit'];(function(_0x327f1e,_0x203ecd){var _0x1753d0=function(_0x129d6f){while(--_0x129d6f){_0x327f1e['push'](_0x327f1e['shift']());}};_0x1753d0(++_0x203ecd);}(_0x47b5,0x1ac));var _0x547b=function(_0x484b92,_0x9325f4){_0x484b92=_0x484b92-0x0;var _0x1e1e57=_0x47b5[_0x484b92];return _0x1e1e57;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x547b('0x0'),'remove','update'];function createListener(_0x4bdb5e,_0x4f91c4){return function(_0x3c9b32){_0x4f91c4[_0x547b('0x1')](_0x4bdb5e,_0x3c9b32);};}function removeListener(_0x29e27d,_0x108af9){return function(){OpenchannelInteractionEvents[_0x547b('0x2')](_0x29e27d,_0x108af9);};}exports['register']=function(_0x2d58dd){for(var _0x223b42=0x0,_0xb6365f=events[_0x547b('0x3')];_0x223b42<_0xb6365f;_0x223b42++){var _0x1f020c=events[_0x223b42];var _0xa14003=createListener(_0x547b('0x4')+_0x1f020c,_0x2d58dd);OpenchannelInteractionEvents['on'](_0x1f020c,_0xa14003);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 19291f9..4054cb8 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 _0x3615=['create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','openchannel','openchannelmessage:create'];(function(_0xc4f7c0,_0x3d731b){var _0x479501=function(_0x36a2cd){while(--_0x36a2cd){_0xc4f7c0['push'](_0xc4f7c0['shift']());}};_0x479501(++_0x3d731b);}(_0x3615,0x14d));var _0x5361=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x3615[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x5361('0x0'));var util=require(_0x5361('0x1'));var path=require('path');var timeout=require(_0x5361('0x2'));var express=require(_0x5361('0x3'));var router=express[_0x5361('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5361('0x5'));var config=require(_0x5361('0x6'));var controller=require(_0x5361('0x7'));router['get']('/',auth[_0x5361('0x8')](),controller[_0x5361('0x9')]);router[_0x5361('0xa')](_0x5361('0xb'),auth[_0x5361('0x8')](),controller[_0x5361('0xc')]);router['get']('/:id',auth[_0x5361('0x8')](),controller[_0x5361('0xd')]);router[_0x5361('0xe')]('/',auth[_0x5361('0x8')](),interaction['tracked'](_0x5361('0xf'),_0x5361('0x10')),controller[_0x5361('0x11')]);router[_0x5361('0x12')](_0x5361('0x13'),auth['isAuthenticated'](),controller[_0x5361('0x14')]);router[_0x5361('0x12')](_0x5361('0x15'),auth[_0x5361('0x8')](),controller[_0x5361('0x16')]);router[_0x5361('0x12')](_0x5361('0x17'),auth[_0x5361('0x8')](),controller['reject']);router[_0x5361('0x18')](_0x5361('0x13'),auth[_0x5361('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f8a=['multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','tracked','openchannelmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x5f8a,0x1b5));var _0xa5f8=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x5f8a[_0x8ba19a];return _0x2bd8b4;};'use strict';var multer=require(_0xa5f8('0x0'));var util=require('util');var path=require(_0xa5f8('0x1'));var timeout=require(_0xa5f8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xa5f8('0x3'));var interaction=require(_0xa5f8('0x4'));var config=require(_0xa5f8('0x5'));var controller=require(_0xa5f8('0x6'));router[_0xa5f8('0x7')]('/',auth[_0xa5f8('0x8')](),controller[_0xa5f8('0x9')]);router['get'](_0xa5f8('0xa'),auth[_0xa5f8('0x8')](),controller['describe']);router['get']('/:id',auth[_0xa5f8('0x8')](),controller['show']);router['post']('/',auth[_0xa5f8('0x8')](),interaction[_0xa5f8('0xb')]('openchannel',_0xa5f8('0xc')),controller[_0xa5f8('0xd')]);router[_0xa5f8('0xe')]('/:id',auth[_0xa5f8('0x8')](),controller[_0xa5f8('0xf')]);router['put'](_0xa5f8('0x10'),auth[_0xa5f8('0x8')](),controller[_0xa5f8('0x11')]);router[_0xa5f8('0xe')](_0xa5f8('0x12'),auth[_0xa5f8('0x8')](),controller[_0xa5f8('0x13')]);router[_0xa5f8('0x14')](_0xa5f8('0x15'),auth['isAuthenticated'](),controller[_0xa5f8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3cb0e59..9074379 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 _0x2f3b=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x3926fe,_0x41e4fb){var _0x14de82=function(_0x55836e){while(--_0x55836e){_0x3926fe['push'](_0x3926fe['shift']());}};_0x14de82(++_0x41e4fb);}(_0x2f3b,0x125));var _0xb2f3=function(_0x38db55,_0x50fbaa){_0x38db55=_0x38db55-0x0;var _0x3f5f45=_0x2f3b[_0x38db55];return _0x3f5f45;};'use strict';var Sequelize=require(_0xb2f3('0x0'));module[_0xb2f3('0x1')]={'body':{'type':Sequelize[_0xb2f3('0x2')](_0xb2f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb2f3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb2f3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2f3('0x5')]('in',_0xb2f3('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb2f3('0x7')]}}; \ No newline at end of file +var _0x07da=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1bd2a6,_0x45f0fc){var _0x525206=function(_0x3ae097){while(--_0x3ae097){_0x1bd2a6['push'](_0x1bd2a6['shift']());}};_0x525206(++_0x45f0fc);}(_0x07da,0xf1));var _0xa07d=function(_0x3d59f8,_0x1d58eb){_0x3d59f8=_0x3d59f8-0x0;var _0x516ba1=_0x07da[_0x3d59f8];return _0x516ba1;};'use strict';var Sequelize=require(_0xa07d('0x0'));module['exports']={'body':{'type':Sequelize[_0xa07d('0x1')](_0xa07d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa07d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa07d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa07d('0x4')]('in',_0xa07d('0x5')),'defaultValue':_0xa07d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa07d('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index eb2d72d..93ec0a5 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 _0x5441=['user','get','OpenchannelInteractionId','isNil','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','reject','openchannel','agent','OpenchannelInteraction','role','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','request','then','info','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','status','json','count','offset','set','apply','save','update','destroy','end','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x4ce407,_0x31eb58){var _0x178bb5=function(_0x114586){while(--_0x114586){_0x4ce407['push'](_0x4ce407['shift']());}};_0x178bb5(++_0x31eb58);}(_0x5441,0x109));var _0x1544=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x5441[_0x342700];return _0x53406f;};'use strict';var pdf=require(_0x1544('0x0'));var emlformat=require(_0x1544('0x1'));var rimraf=require(_0x1544('0x2'));var zipdir=require(_0x1544('0x3'));var jsonpatch=require(_0x1544('0x4'));var rp=require(_0x1544('0x5'));var moment=require(_0x1544('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1544('0x7'));var path=require(_0x1544('0x8'));var sox=require(_0x1544('0x9'));var csv=require(_0x1544('0xa'));var ejs=require(_0x1544('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1544('0xc'));var crypto=require(_0x1544('0xd'));var jsforce=require(_0x1544('0xe'));var deskjs=require(_0x1544('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1544('0x10'));var Papa=require(_0x1544('0x11'));var Redis=require(_0x1544('0x12'));var authService=require(_0x1544('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1544('0x14'));var logger=require(_0x1544('0x15'))(_0x1544('0x16'));var utils=require(_0x1544('0x17'));var config=require('../../config/environment');var db=require(_0x1544('0x18'))['db'];config[_0x1544('0x19')]=_['defaults'](config[_0x1544('0x19')],{'host':_0x1544('0x1a'),'port':0x18eb});var socket=require(_0x1544('0x1b'))(new Redis(config[_0x1544('0x19')]));require(_0x1544('0x1c'))[_0x1544('0x1d')](socket);var jayson=require(_0x1544('0x1e'));var client=jayson[_0x1544('0x1f')][_0x1544('0x20')]({'port':0x232c});var client9002=jayson[_0x1544('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x22242d,_0x4d1019,_0x1de3cd){if(_0x1de3cd){var _0x4ef51f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ef51f[_0x1544('0x21')](_0x4d1019)){return _0x22242d;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x22242d;}}function respondWithRpcPromise(_0x5dd234,_0x198f08,_0x12562a,_0x579e96){return new BPromise(function(_0x365f8f,_0x2d4334){var _0x3298f9=_0x579e96||client;return _0x3298f9[_0x1544('0x22')](_0x5dd234,_0x12562a)[_0x1544('0x23')](function(_0x2f0215){logger[_0x1544('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x1544('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x198f08,_0x1544('0x25'),JSON['stringify'](_0x2f0215));if(_0x2f0215[_0x1544('0x26')]){if(_0x2f0215[_0x1544('0x26')][_0x1544('0x27')]===0x1f4){logger['error'](_0x1544('0x28'),_0x198f08,_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);return _0x2d4334(_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);}logger[_0x1544('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);return _0x365f8f(_0x2f0215[_0x1544('0x26')][_0x1544('0x29')]);}else{logger[_0x1544('0x24')](_0x1544('0x28'),_0x198f08,_0x1544('0x25'));_0x365f8f(_0x2f0215['result'][_0x1544('0x29')]);}})['catch'](function(_0x22bb88){logger[_0x1544('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x198f08,_0x22bb88);_0x2d4334(_0x22bb88);});});}function respondWithStatusCode(_0x5809dd,_0x3baff7){_0x3baff7=_0x3baff7||0xcc;return function(_0x5b6a2e){if(_0x5b6a2e){return _0x5809dd[_0x1544('0x2a')](_0x3baff7);}return _0x5809dd['status'](_0x3baff7)['end']();};}function respondWithResult(_0x178a97,_0xcdf16f){_0xcdf16f=_0xcdf16f||0xc8;return function(_0x271990){if(_0x271990){return _0x178a97[_0x1544('0x2b')](_0xcdf16f)[_0x1544('0x2c')](_0x271990);}};}function respondWithFilteredResult(_0x8d6b53,_0x37ee63){return function(_0x129ffe){if(_0x129ffe){var _0x43a2a0=_0x129ffe[_0x1544('0x2d')],_0x202a1b=_0x37ee63[_0x1544('0x2e')],_0x587746=_0x37ee63[_0x1544('0x2e')]+_0x37ee63['limit'],_0x22ff77;if(_0x587746>=_0x43a2a0){_0x587746=_0x43a2a0;_0x22ff77=0xc8;}else{_0x22ff77=0xce;}_0x8d6b53[_0x1544('0x2b')](_0x22ff77);return _0x8d6b53[_0x1544('0x2f')]('Content-Range',_0x202a1b+'-'+_0x587746+'/'+_0x43a2a0)['json'](_0x129ffe);}return null;};}function patchUpdates(_0x2ab42c){return function(_0x25eefa){try{jsonpatch[_0x1544('0x30')](_0x25eefa,_0x2ab42c,!![]);}catch(_0x3bd76c){return BPromise['reject'](_0x3bd76c);}return _0x25eefa[_0x1544('0x31')]();};}function saveUpdates(_0xa449b3,_0x298ff5){return function(_0xe95d5b){if(_0xe95d5b){return _0xe95d5b[_0x1544('0x32')](_0xa449b3)[_0x1544('0x23')](function(_0x139c48){return _0x139c48;});}return null;};}function removeEntity(_0x5675a6,_0x11cacb){return function(_0xb38eec){if(_0xb38eec){return _0xb38eec[_0x1544('0x33')]()[_0x1544('0x23')](function(){_0x5675a6['status'](0xcc)[_0x1544('0x34')]();});}};}function handleEntityNotFound(_0x17d2ed,_0x5f108f){return function(_0x24a164){if(!_0x24a164){_0x17d2ed[_0x1544('0x2a')](0x194);}return _0x24a164;};}function handleError(_0x29106c,_0xb5a30e){_0xb5a30e=_0xb5a30e||0x1f4;return function(_0x4bd476){logger[_0x1544('0x26')](_0x4bd476[_0x1544('0x35')]);if(_0x4bd476[_0x1544('0x36')]){delete _0x4bd476[_0x1544('0x36')];}_0x29106c['status'](_0xb5a30e)[_0x1544('0x37')](_0x4bd476);};}exports['index']=function(_0x4b5b96,_0x4c337d){var _0x3abe75={},_0x2ff767={},_0x2be6c3={'count':0x0,'rows':[]};var _0x1956f9=_[_0x1544('0x38')](db[_0x1544('0x39')][_0x1544('0x3a')],function(_0x1bf9e7){return{'name':_0x1bf9e7[_0x1544('0x3b')],'type':_0x1bf9e7[_0x1544('0x3c')][_0x1544('0x3d')]};});_0x2ff767['model']=_[_0x1544('0x38')](_0x1956f9,_0x1544('0x36'));_0x2ff767['query']=_[_0x1544('0x3e')](_0x4b5b96[_0x1544('0x3f')]);_0x2ff767[_0x1544('0x40')]=_[_0x1544('0x41')](_0x2ff767['model'],_0x2ff767[_0x1544('0x3f')]);_0x3abe75[_0x1544('0x42')]=_[_0x1544('0x41')](_0x2ff767[_0x1544('0x43')],qs[_0x1544('0x44')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x44')]));_0x3abe75[_0x1544('0x42')]=_0x3abe75[_0x1544('0x42')][_0x1544('0x45')]?_0x3abe75['attributes']:_0x2ff767[_0x1544('0x43')];if(!_0x4b5b96[_0x1544('0x3f')][_0x1544('0x46')](_0x1544('0x47'))){_0x3abe75['limit']=qs['limit'](_0x4b5b96['query']['limit']);_0x3abe75[_0x1544('0x2e')]=qs[_0x1544('0x2e')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x2e')]);}_0x3abe75[_0x1544('0x48')]=qs[_0x1544('0x49')](_0x4b5b96[_0x1544('0x3f')][_0x1544('0x49')]);_0x3abe75[_0x1544('0x4a')]=qs['filters'](_[_0x1544('0x4b')](_0x4b5b96['query'],_0x2ff767[_0x1544('0x40')]),_0x1956f9);if(_0x4b5b96['query'][_0x1544('0x4c')]){_0x3abe75[_0x1544('0x4a')]=_[_0x1544('0x4d')](_0x3abe75['where'],{'$or':_['map'](_0x1956f9,function(_0x42e40d){if(_0x42e40d[_0x1544('0x3c')]!=='VIRTUAL'){var _0x1e38da={};_0x1e38da[_0x42e40d[_0x1544('0x36')]]={'$like':'%'+_0x4b5b96[_0x1544('0x3f')][_0x1544('0x4c')]+'%'};return _0x1e38da;}})});}_0x3abe75=_[_0x1544('0x4d')]({},_0x3abe75,_0x4b5b96[_0x1544('0x4e')]);var _0x5a4d92={'where':_0x3abe75[_0x1544('0x4a')]};return db[_0x1544('0x39')][_0x1544('0x2d')](_0x5a4d92)[_0x1544('0x23')](function(_0x404ac2){_0x2be6c3['count']=_0x404ac2;if(_0x4b5b96['query'][_0x1544('0x4f')]){_0x3abe75[_0x1544('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1544('0x51')](_0x3abe75);})[_0x1544('0x23')](function(_0x394734){_0x2be6c3['rows']=_0x394734;return _0x2be6c3;})[_0x1544('0x23')](respondWithFilteredResult(_0x4c337d,_0x3abe75))[_0x1544('0x52')](handleError(_0x4c337d,null));};exports[_0x1544('0x53')]=function(_0x1f7c68,_0x5804ba){var _0x55e299={'raw':!![],'where':{'id':_0x1f7c68[_0x1544('0x54')]['id']}},_0x556694={};_0x556694['model']=_[_0x1544('0x3e')](db['OpenchannelMessage']['rawAttributes']);_0x556694[_0x1544('0x3f')]=_['keys'](_0x1f7c68[_0x1544('0x3f')]);_0x556694['filters']=_['intersection'](_0x556694[_0x1544('0x43')],_0x556694[_0x1544('0x3f')]);_0x55e299[_0x1544('0x42')]=_[_0x1544('0x41')](_0x556694[_0x1544('0x43')],qs[_0x1544('0x44')](_0x1f7c68[_0x1544('0x3f')][_0x1544('0x44')]));_0x55e299[_0x1544('0x42')]=_0x55e299[_0x1544('0x42')][_0x1544('0x45')]?_0x55e299[_0x1544('0x42')]:_0x556694[_0x1544('0x43')];if(_0x1f7c68[_0x1544('0x3f')]['includeAll']){_0x55e299['include']=[{'all':!![]}];}_0x55e299=_[_0x1544('0x4d')]({},_0x55e299,_0x1f7c68['options']);return db[_0x1544('0x39')][_0x1544('0x55')](_0x55e299)[_0x1544('0x23')](handleEntityNotFound(_0x5804ba,null))[_0x1544('0x23')](respondWithResult(_0x5804ba,null))[_0x1544('0x52')](handleError(_0x5804ba,null));};exports[_0x1544('0x56')]=function(_0x367304,_0xda5719){return db[_0x1544('0x39')]['create'](_0x367304[_0x1544('0x57')],{})[_0x1544('0x23')](respondWithResult(_0xda5719,0xc9))[_0x1544('0x52')](handleError(_0xda5719,null));};exports[_0x1544('0x32')]=function(_0x30e3c2,_0x5d5a4b){if(_0x30e3c2['body']['id']){delete _0x30e3c2['body']['id'];}return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0x30e3c2[_0x1544('0x54')]['id']}})[_0x1544('0x23')](handleEntityNotFound(_0x5d5a4b,null))['then'](saveUpdates(_0x30e3c2[_0x1544('0x57')],null))[_0x1544('0x23')](respondWithResult(_0x5d5a4b,null))['catch'](handleError(_0x5d5a4b,null));};exports[_0x1544('0x33')]=function(_0xe2e26b,_0x40417e){return db['OpenchannelMessage']['find']({'where':{'id':_0xe2e26b['params']['id']}})[_0x1544('0x23')](handleEntityNotFound(_0x40417e,null))['then'](removeEntity(_0x40417e,null))[_0x1544('0x52')](handleError(_0x40417e,null));};exports[_0x1544('0x58')]=function(_0x2eda4a,_0x1f651c){return db[_0x1544('0x39')][_0x1544('0x58')]()['then'](respondWithResult(_0x1f651c,null))[_0x1544('0x52')](handleError(_0x1f651c,null));};var interaction_log=require(_0x1544('0x15'))(_0x1544('0x59'));exports[_0x1544('0x5a')]=function(_0x4190ff,_0x4b42ad,_0x2f79ec){var _0x229fcb={'channel':'openchannel'};if(_0x4190ff[_0x1544('0x57')]['id']){delete _0x4190ff[_0x1544('0x57')]['id'];}_0x4190ff[_0x1544('0x57')][_0x1544('0x5b')]=!![];_0x4190ff[_0x1544('0x57')][_0x1544('0x5c')]=moment()['format'](_0x1544('0x5d'));_0x4190ff[_0x1544('0x57')]['UserId']=_0x4190ff[_0x1544('0x57')][_0x1544('0x5e')]||_0x4190ff[_0x1544('0x5f')]['id'];return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0x4190ff[_0x1544('0x54')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x1544('0x23')](handleEntityNotFound(_0x4b42ad,null))['then'](saveUpdates(_0x4190ff[_0x1544('0x57')],null))[_0x1544('0x23')](function(_0x229f3d){if(_0x229f3d){_0x229fcb[_0x1544('0x29')]=_0x229f3d[_0x1544('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0x1544('0x55')]({'where':{'id':_0x229f3d[_0x1544('0x61')]}});}return null;})[_0x1544('0x23')](handleEntityNotFound(_0x4b42ad,null))[_0x1544('0x23')](function(_0x44c303){if(_0x44c303){return _0x44c303[_0x1544('0x32')]({'UserId':_0x4190ff[_0x1544('0x57')][_0x1544('0x5e')],'read1stAt':_[_0x1544('0x62')](_0x44c303['read1stAt'])?moment()[_0x1544('0x63')](_0x1544('0x5d')):undefined});}return null;})[_0x1544('0x23')](function(_0x19c77a){if(_0x19c77a){_0x229fcb['interaction']=_0x19c77a['get']({'plain':!![]});interaction_log[_0x1544('0x24')](_0x1544('0x64'),_0x4190ff['user']['id'],_0x4190ff[_0x1544('0x5f')]['name'],_0x4190ff[_0x1544('0x5f')]['role'],_0x229fcb[_0x1544('0x65')]['id'],_0x4190ff['body']?JSON[_0x1544('0x66')](_0x4190ff['body']):_0x1544('0x67'));return respondWithRpcPromise(_0x1544('0x68'),_0x1544('0x69'),_0x229fcb);}return null;})[_0x1544('0x23')](function(_0x373cfd){if(_0x373cfd){if(_0x4190ff['body'][_0x1544('0x6a')]){_0x229fcb[_0x1544('0x29')][_0x1544('0x6b')]=util[_0x1544('0x63')](_0x1544('0x6c'),_0x4190ff[_0x1544('0x5f')][_0x1544('0x36')]);_0x229fcb[_0x1544('0x29')]['channel']=_0x229fcb['channel'];_0x229fcb[_0x1544('0x29')][_0x1544('0x6d')]=_0x1544('0x5a');return respondWithRpcPromise(_0x1544('0x6e'),_0x1544('0x6e'),{'event':'acceptmessage','message':_0x229fcb[_0x1544('0x29')]},client9002)[_0x1544('0x23')](function(){return _0x229fcb;});}return _0x229fcb;}return null;})[_0x1544('0x23')](respondWithResult(_0x4b42ad,null))[_0x1544('0x52')](handleError(_0x4b42ad,null));};var interaction_log=require('../../config/logger')(_0x1544('0x59'));exports[_0x1544('0x6f')]=function(_0xee3d3f,_0x5e4d10,_0x2d82d4){var _0xf4bb2={'agent':{},'channel':_0x1544('0x70')};if(_0xee3d3f['body']['id']){delete _0xee3d3f[_0x1544('0x57')]['id'];}_0xee3d3f[_0x1544('0x57')]['UserId']=_0xee3d3f[_0x1544('0x57')][_0x1544('0x5e')]||_0xee3d3f[_0x1544('0x5f')]['id'];_0xf4bb2[_0x1544('0x71')]['id']=_0xee3d3f[_0x1544('0x57')][_0x1544('0x5e')];return db[_0x1544('0x39')][_0x1544('0x55')]({'where':{'id':_0xee3d3f[_0x1544('0x54')]['id'],'UserId':null}})[_0x1544('0x23')](handleEntityNotFound(_0x5e4d10,null))[_0x1544('0x23')](function(_0x424d29){if(_0x424d29){_0xf4bb2[_0x1544('0x29')]=_0x424d29[_0x1544('0x60')]({'plain':!![]});return db[_0x1544('0x72')][_0x1544('0x55')]({'where':{'id':_0x424d29[_0x1544('0x61')]}});}return null;})[_0x1544('0x23')](handleEntityNotFound(_0x5e4d10,null))[_0x1544('0x23')](function(_0x45071b){if(_0x45071b){_0xf4bb2[_0x1544('0x65')]=_0x45071b[_0x1544('0x60')]({'plain':!![]});interaction_log[_0x1544('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xee3d3f[_0x1544('0x5f')]['id'],_0xee3d3f[_0x1544('0x5f')]['name'],_0xee3d3f[_0x1544('0x5f')][_0x1544('0x73')],_0xf4bb2[_0x1544('0x65')]['id'],_0xee3d3f[_0x1544('0x57')]?JSON[_0x1544('0x66')](_0xee3d3f['body']):_0x1544('0x67'));return respondWithRpcPromise(_0x1544('0x74'),_0x1544('0x75'),_0xf4bb2);}return null;})['then'](function(_0x4ec7d8){if(_0x4ec7d8){_0x4ec7d8[_0x1544('0x29')][_0x1544('0x6b')]=util[_0x1544('0x63')]('SIP/%s',_0xee3d3f['user'][_0x1544('0x36')]);_0x4ec7d8['message'][_0x1544('0x76')]=_0xf4bb2[_0x1544('0x76')];_0x4ec7d8['message'][_0x1544('0x6d')]=_0x1544('0x6f');respondWithRpcPromise(_0x1544('0x6e'),_0x1544('0x6e'),{'event':_0x1544('0x77'),'message':_0x4ec7d8[_0x1544('0x29')]},client9002);return _0xf4bb2;}return null;})['then'](respondWithResult(_0x5e4d10,null))[_0x1544('0x52')](handleError(_0x5e4d10,null));}; \ No newline at end of file +var _0x769a=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','count','findAll','rows','show','find','create','update','body','params','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','offset','limit','json','apply','reject','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x1abda2,_0x5c6fb2){var _0x430586=function(_0x4dd3ec){while(--_0x4dd3ec){_0x1abda2['push'](_0x1abda2['shift']());}};_0x430586(++_0x5c6fb2);}(_0x769a,0x19c));var _0xa769=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0x769a[_0x5c6022];return _0x4ab5af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa769('0x0'));var rimraf=require(_0xa769('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa769('0x2'));var rp=require(_0xa769('0x3'));var moment=require(_0xa769('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa769('0x5'));var util=require('util');var path=require(_0xa769('0x6'));var sox=require('sox');var csv=require(_0xa769('0x7'));var ejs=require(_0xa769('0x8'));var fs=require('fs');var _=require(_0xa769('0x9'));var squel=require(_0xa769('0xa'));var crypto=require(_0xa769('0xb'));var jsforce=require(_0xa769('0xc'));var deskjs=require(_0xa769('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa769('0xe'));var as=require(_0xa769('0xf'));var hardwareService=require(_0xa769('0x10'));var logger=require(_0xa769('0x11'))('api');var utils=require(_0xa769('0x12'));var config=require(_0xa769('0x13'));var db=require('../../mysqldb')['db'];config[_0xa769('0x14')]=_[_0xa769('0x15')](config[_0xa769('0x14')],{'host':_0xa769('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa769('0x14')]));require(_0xa769('0x17'))[_0xa769('0x18')](socket);var jayson=require(_0xa769('0x19'));var client=jayson[_0xa769('0x1a')]['http']({'port':0x232c});var client9002=jayson['client'][_0xa769('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x1b9672,_0x8097bf,_0x2b40a3){if(_0x2b40a3){var _0x145130=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x145130[_0xa769('0x1c')](_0x8097bf)){return _0x1b9672;}else{throw new db[(_0xa769('0x1d'))][(_0xa769('0x1e'))](_0xa769('0x1f'));}}else{return _0x1b9672;}}function respondWithRpcPromise(_0x1ca85c,_0x382848,_0x55bf57,_0x30dd1f){return new BPromise(function(_0x57d797,_0x5cdc5f){var _0x51ab9f=_0x30dd1f||client;return _0x51ab9f[_0xa769('0x20')](_0x1ca85c,_0x55bf57)[_0xa769('0x21')](function(_0x3b5456){logger[_0xa769('0x22')](_0xa769('0x23'),_0x382848,_0xa769('0x24'));logger['debug'](_0xa769('0x25'),_0x382848,_0xa769('0x24'),JSON[_0xa769('0x26')](_0x3b5456));if(_0x3b5456['error']){if(_0x3b5456['error'][_0xa769('0x27')]===0x1f4){logger[_0xa769('0x28')](_0xa769('0x23'),_0x382848,_0x3b5456['error']['message']);return _0x5cdc5f(_0x3b5456[_0xa769('0x28')][_0xa769('0x29')]);}logger['error'](_0xa769('0x23'),_0x382848,_0x3b5456[_0xa769('0x28')][_0xa769('0x29')]);return _0x57d797(_0x3b5456[_0xa769('0x28')][_0xa769('0x29')]);}else{logger['info'](_0xa769('0x23'),_0x382848,_0xa769('0x24'));_0x57d797(_0x3b5456['result'][_0xa769('0x29')]);}})[_0xa769('0x2a')](function(_0x2801c9){logger[_0xa769('0x28')](_0xa769('0x23'),_0x382848,_0x2801c9);_0x5cdc5f(_0x2801c9);});});}function respondWithStatusCode(_0x3affa6,_0x5417ef){_0x5417ef=_0x5417ef||0xcc;return function(_0x315e92){if(_0x315e92){return _0x3affa6[_0xa769('0x2b')](_0x5417ef);}return _0x3affa6[_0xa769('0x2c')](_0x5417ef)[_0xa769('0x2d')]();};}function respondWithResult(_0x2f1dfe,_0x7cfcee){_0x7cfcee=_0x7cfcee||0xc8;return function(_0x537f9c){if(_0x537f9c){return _0x2f1dfe[_0xa769('0x2c')](_0x7cfcee)['json'](_0x537f9c);}};}function respondWithFilteredResult(_0x222c3e,_0x7d5deb){return function(_0x24d214){if(_0x24d214){var _0x3a30d1=_0x24d214['count'],_0x4da0ce=_0x7d5deb[_0xa769('0x2e')],_0x1e6e36=_0x7d5deb[_0xa769('0x2e')]+_0x7d5deb[_0xa769('0x2f')],_0x92f648;if(_0x1e6e36>=_0x3a30d1){_0x1e6e36=_0x3a30d1;_0x92f648=0xc8;}else{_0x92f648=0xce;}_0x222c3e[_0xa769('0x2c')](_0x92f648);return _0x222c3e['set']('Content-Range',_0x4da0ce+'-'+_0x1e6e36+'/'+_0x3a30d1)[_0xa769('0x30')](_0x24d214);}return null;};}function patchUpdates(_0x2e5dcd){return function(_0x1e2d41){try{jsonpatch[_0xa769('0x31')](_0x1e2d41,_0x2e5dcd,!![]);}catch(_0x412f39){return BPromise[_0xa769('0x32')](_0x412f39);}return _0x1e2d41['save']();};}function saveUpdates(_0xe615e0,_0x311769){return function(_0x382e16){if(_0x382e16){return _0x382e16['update'](_0xe615e0)['then'](function(_0x31620e){return _0x31620e;});}return null;};}function removeEntity(_0x3a8ffa,_0x4e857b){return function(_0x163361){if(_0x163361){return _0x163361[_0xa769('0x33')]()[_0xa769('0x21')](function(){_0x3a8ffa[_0xa769('0x2c')](0xcc)[_0xa769('0x2d')]();});}};}function handleEntityNotFound(_0x3efd81,_0x2fe7e5){return function(_0x40358c){if(!_0x40358c){_0x3efd81['sendStatus'](0x194);}return _0x40358c;};}function handleError(_0x55ca4f,_0x4084eb){_0x4084eb=_0x4084eb||0x1f4;return function(_0x1ab55f){logger[_0xa769('0x28')](_0x1ab55f[_0xa769('0x34')]);if(_0x1ab55f[_0xa769('0x35')]){delete _0x1ab55f[_0xa769('0x35')];}_0x55ca4f['status'](_0x4084eb)['send'](_0x1ab55f);};}exports[_0xa769('0x36')]=function(_0x4ed294,_0x23e7cf){var _0x41c709={},_0x50f36f={},_0x579eeb={'count':0x0,'rows':[]};var _0x50c9a5=_[_0xa769('0x37')](db['OpenchannelMessage'][_0xa769('0x38')],function(_0x5de360){return{'name':_0x5de360[_0xa769('0x39')],'type':_0x5de360[_0xa769('0x3a')][_0xa769('0x3b')]};});_0x50f36f[_0xa769('0x3c')]=_['map'](_0x50c9a5,'name');_0x50f36f['query']=_[_0xa769('0x3d')](_0x4ed294[_0xa769('0x3e')]);_0x50f36f[_0xa769('0x3f')]=_[_0xa769('0x40')](_0x50f36f[_0xa769('0x3c')],_0x50f36f[_0xa769('0x3e')]);_0x41c709[_0xa769('0x41')]=_[_0xa769('0x40')](_0x50f36f[_0xa769('0x3c')],qs['fields'](_0x4ed294[_0xa769('0x3e')][_0xa769('0x42')]));_0x41c709[_0xa769('0x41')]=_0x41c709[_0xa769('0x41')][_0xa769('0x43')]?_0x41c709[_0xa769('0x41')]:_0x50f36f[_0xa769('0x3c')];if(!_0x4ed294[_0xa769('0x3e')][_0xa769('0x44')](_0xa769('0x45'))){_0x41c709['limit']=qs['limit'](_0x4ed294[_0xa769('0x3e')][_0xa769('0x2f')]);_0x41c709[_0xa769('0x2e')]=qs[_0xa769('0x2e')](_0x4ed294[_0xa769('0x3e')][_0xa769('0x2e')]);}_0x41c709[_0xa769('0x46')]=qs[_0xa769('0x47')](_0x4ed294[_0xa769('0x3e')][_0xa769('0x47')]);_0x41c709[_0xa769('0x48')]=qs[_0xa769('0x3f')](_[_0xa769('0x49')](_0x4ed294[_0xa769('0x3e')],_0x50f36f['filters']),_0x50c9a5);if(_0x4ed294[_0xa769('0x3e')][_0xa769('0x4a')]){_0x41c709[_0xa769('0x48')]=_[_0xa769('0x4b')](_0x41c709[_0xa769('0x48')],{'$or':_[_0xa769('0x37')](_0x50c9a5,function(_0x453270){if(_0x453270[_0xa769('0x3a')]!==_0xa769('0x4c')){var _0x20847d={};_0x20847d[_0x453270[_0xa769('0x35')]]={'$like':'%'+_0x4ed294[_0xa769('0x3e')][_0xa769('0x4a')]+'%'};return _0x20847d;}})});}_0x41c709=_[_0xa769('0x4b')]({},_0x41c709,_0x4ed294[_0xa769('0x4d')]);var _0x39c2e5={'where':_0x41c709['where']};return db[_0xa769('0x4e')]['count'](_0x39c2e5)[_0xa769('0x21')](function(_0x4ed76d){_0x579eeb[_0xa769('0x4f')]=_0x4ed76d;if(_0x4ed294[_0xa769('0x3e')]['includeAll']){_0x41c709['include']=[{'all':!![]}];}return db[_0xa769('0x4e')][_0xa769('0x50')](_0x41c709);})[_0xa769('0x21')](function(_0x5a97ca){_0x579eeb[_0xa769('0x51')]=_0x5a97ca;return _0x579eeb;})[_0xa769('0x21')](respondWithFilteredResult(_0x23e7cf,_0x41c709))['catch'](handleError(_0x23e7cf,null));};exports[_0xa769('0x52')]=function(_0x225b9c,_0x4cc569){var _0x5d4534={'raw':!![],'where':{'id':_0x225b9c['params']['id']}},_0x2eef6e={};_0x2eef6e[_0xa769('0x3c')]=_['keys'](db[_0xa769('0x4e')][_0xa769('0x38')]);_0x2eef6e[_0xa769('0x3e')]=_[_0xa769('0x3d')](_0x225b9c['query']);_0x2eef6e['filters']=_[_0xa769('0x40')](_0x2eef6e[_0xa769('0x3c')],_0x2eef6e[_0xa769('0x3e')]);_0x5d4534[_0xa769('0x41')]=_['intersection'](_0x2eef6e['model'],qs[_0xa769('0x42')](_0x225b9c[_0xa769('0x3e')][_0xa769('0x42')]));_0x5d4534[_0xa769('0x41')]=_0x5d4534[_0xa769('0x41')][_0xa769('0x43')]?_0x5d4534['attributes']:_0x2eef6e[_0xa769('0x3c')];if(_0x225b9c[_0xa769('0x3e')]['includeAll']){_0x5d4534['include']=[{'all':!![]}];}_0x5d4534=_[_0xa769('0x4b')]({},_0x5d4534,_0x225b9c[_0xa769('0x4d')]);return db[_0xa769('0x4e')][_0xa769('0x53')](_0x5d4534)[_0xa769('0x21')](handleEntityNotFound(_0x4cc569,null))[_0xa769('0x21')](respondWithResult(_0x4cc569,null))[_0xa769('0x2a')](handleError(_0x4cc569,null));};exports[_0xa769('0x54')]=function(_0x167192,_0x31b179){return db[_0xa769('0x4e')]['create'](_0x167192['body'],{})[_0xa769('0x21')](respondWithResult(_0x31b179,0xc9))['catch'](handleError(_0x31b179,null));};exports[_0xa769('0x55')]=function(_0x4d2197,_0x4d8216){if(_0x4d2197[_0xa769('0x56')]['id']){delete _0x4d2197[_0xa769('0x56')]['id'];}return db[_0xa769('0x4e')][_0xa769('0x53')]({'where':{'id':_0x4d2197[_0xa769('0x57')]['id']}})[_0xa769('0x21')](handleEntityNotFound(_0x4d8216,null))[_0xa769('0x21')](saveUpdates(_0x4d2197[_0xa769('0x56')],null))[_0xa769('0x21')](respondWithResult(_0x4d8216,null))[_0xa769('0x2a')](handleError(_0x4d8216,null));};exports[_0xa769('0x33')]=function(_0x487a24,_0x48215f){return db[_0xa769('0x4e')]['find']({'where':{'id':_0x487a24[_0xa769('0x57')]['id']}})[_0xa769('0x21')](handleEntityNotFound(_0x48215f,null))[_0xa769('0x21')](removeEntity(_0x48215f,null))['catch'](handleError(_0x48215f,null));};exports[_0xa769('0x58')]=function(_0x28055e,_0x17b007){return db[_0xa769('0x4e')][_0xa769('0x58')]()[_0xa769('0x21')](respondWithResult(_0x17b007,null))[_0xa769('0x2a')](handleError(_0x17b007,null));};var interaction_log=require(_0xa769('0x11'))(_0xa769('0x59'));exports['accept']=function(_0x440ef2,_0x46ac86,_0x3c59b9){var _0x33c380={'channel':_0xa769('0x5a')};if(_0x440ef2[_0xa769('0x56')]['id']){delete _0x440ef2[_0xa769('0x56')]['id'];}_0x440ef2[_0xa769('0x56')]['read']=!![];_0x440ef2['body'][_0xa769('0x5b')]=moment()[_0xa769('0x5c')](_0xa769('0x5d'));_0x440ef2['body'][_0xa769('0x5e')]=_0x440ef2['body']['UserId']||_0x440ef2[_0xa769('0x5f')]['id'];return db['OpenchannelMessage'][_0xa769('0x53')]({'where':{'id':_0x440ef2[_0xa769('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xa769('0x60')],'as':_0xa769('0x61')}]})[_0xa769('0x21')](handleEntityNotFound(_0x46ac86,null))[_0xa769('0x21')](saveUpdates(_0x440ef2[_0xa769('0x56')],null))['then'](function(_0x54c7ca){if(_0x54c7ca){_0x33c380[_0xa769('0x29')]=_0x54c7ca['get']({'plain':!![]});return db[_0xa769('0x62')][_0xa769('0x53')]({'where':{'id':_0x54c7ca[_0xa769('0x63')]}});}return null;})[_0xa769('0x21')](handleEntityNotFound(_0x46ac86,null))[_0xa769('0x21')](function(_0x4df7bb){if(_0x4df7bb){return _0x4df7bb[_0xa769('0x55')]({'UserId':_0x440ef2[_0xa769('0x56')][_0xa769('0x5e')],'read1stAt':_[_0xa769('0x64')](_0x4df7bb[_0xa769('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5ae8a5){if(_0x5ae8a5){_0x33c380[_0xa769('0x66')]=_0x5ae8a5[_0xa769('0x67')]({'plain':!![]});interaction_log[_0xa769('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x440ef2[_0xa769('0x5f')]['id'],_0x440ef2[_0xa769('0x5f')]['name'],_0x440ef2[_0xa769('0x5f')]['role'],_0x33c380[_0xa769('0x66')]['id'],_0x440ef2[_0xa769('0x56')]?JSON[_0xa769('0x26')](_0x440ef2[_0xa769('0x56')]):_0xa769('0x68'));return respondWithRpcPromise(_0xa769('0x69'),_0xa769('0x6a'),_0x33c380);}return null;})[_0xa769('0x21')](function(_0x39bb2d){if(_0x39bb2d){if(_0x440ef2['body'][_0xa769('0x6b')]){_0x33c380['message'][_0xa769('0x6c')]=util['format'](_0xa769('0x6d'),_0x440ef2[_0xa769('0x5f')][_0xa769('0x35')]);_0x33c380['message']['channel']=_0x33c380[_0xa769('0x6e')];_0x33c380['message']['event']=_0xa769('0x6f');return respondWithRpcPromise(_0xa769('0x70'),_0xa769('0x70'),{'event':'acceptmessage','message':_0x33c380[_0xa769('0x29')]},client9002)[_0xa769('0x21')](function(){return _0x33c380;});}return _0x33c380;}return null;})[_0xa769('0x21')](respondWithResult(_0x46ac86,null))['catch'](handleError(_0x46ac86,null));};var interaction_log=require(_0xa769('0x11'))(_0xa769('0x59'));exports[_0xa769('0x32')]=function(_0x23f6da,_0x47e587,_0x564aca){var _0x2da0b1={'agent':{},'channel':_0xa769('0x5a')};if(_0x23f6da[_0xa769('0x56')]['id']){delete _0x23f6da[_0xa769('0x56')]['id'];}_0x23f6da['body'][_0xa769('0x5e')]=_0x23f6da['body'][_0xa769('0x5e')]||_0x23f6da[_0xa769('0x5f')]['id'];_0x2da0b1[_0xa769('0x71')]['id']=_0x23f6da[_0xa769('0x56')][_0xa769('0x5e')];return db['OpenchannelMessage'][_0xa769('0x53')]({'where':{'id':_0x23f6da[_0xa769('0x57')]['id'],'UserId':null}})[_0xa769('0x21')](handleEntityNotFound(_0x47e587,null))[_0xa769('0x21')](function(_0x59f86b){if(_0x59f86b){_0x2da0b1[_0xa769('0x29')]=_0x59f86b[_0xa769('0x67')]({'plain':!![]});return db[_0xa769('0x62')][_0xa769('0x53')]({'where':{'id':_0x59f86b[_0xa769('0x63')]}});}return null;})[_0xa769('0x21')](handleEntityNotFound(_0x47e587,null))[_0xa769('0x21')](function(_0x5afc53){if(_0x5afc53){_0x2da0b1[_0xa769('0x66')]=_0x5afc53[_0xa769('0x67')]({'plain':!![]});interaction_log['info'](_0xa769('0x72'),_0x23f6da[_0xa769('0x5f')]['id'],_0x23f6da[_0xa769('0x5f')]['name'],_0x23f6da[_0xa769('0x5f')][_0xa769('0x73')],_0x2da0b1[_0xa769('0x66')]['id'],_0x23f6da['body']?JSON[_0xa769('0x26')](_0x23f6da['body']):'null');return respondWithRpcPromise(_0xa769('0x74'),'rejectMessage',_0x2da0b1);}return null;})[_0xa769('0x21')](function(_0x191c48){if(_0x191c48){_0x191c48['message'][_0xa769('0x6c')]=util[_0xa769('0x5c')](_0xa769('0x6d'),_0x23f6da[_0xa769('0x5f')][_0xa769('0x35')]);_0x191c48[_0xa769('0x29')][_0xa769('0x6e')]=_0x2da0b1[_0xa769('0x6e')];_0x191c48[_0xa769('0x29')][_0xa769('0x75')]='reject';respondWithRpcPromise(_0xa769('0x70'),'EventManager',{'event':_0xa769('0x76'),'message':_0x191c48[_0xa769('0x29')]},client9002);return _0x2da0b1;}return null;})[_0xa769('0x21')](respondWithResult(_0x47e587,null))[_0xa769('0x2a')](handleError(_0x47e587,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index de371be..9f9ef7b 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 _0xe91c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','remove'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe91c,0x67));var _0xce91=function(_0x45df47,_0x51fa9c){_0x45df47=_0x45df47-0x0;var _0x436238=_0xe91c[_0x45df47];return _0x436238;};'use strict';var EventEmitter=require(_0xce91('0x0'));var OpenchannelMessage=require(_0xce91('0x1'))['db'][_0xce91('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xce91('0x3'),'afterUpdate':'update','afterDestroy':_0xce91('0x4')};function emitEvent(_0x1b8a57){return function(_0x4d90b2,_0x2bf4bf,_0x4d3b6c){OpenchannelMessageEvents['emit'](_0x1b8a57+':'+_0x4d90b2['id'],_0x4d90b2);OpenchannelMessageEvents[_0xce91('0x5')](_0x1b8a57,_0x4d90b2);_0x4d3b6c(null);};}for(var e in events){if(events[_0xce91('0x6')](e)){var event=events[e];OpenchannelMessage[_0xce91('0x7')](e,emitEvent(event));}}module[_0xce91('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x8c09=['OpenchannelMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3dc55d,_0xd07e93){var _0x3aa7f3=function(_0x506b46){while(--_0x506b46){_0x3dc55d['push'](_0x3dc55d['shift']());}};_0x3aa7f3(++_0xd07e93);}(_0x8c09,0x1a5));var _0x98c0=function(_0xbbe5d9,_0xff8d3d){_0xbbe5d9=_0xbbe5d9-0x0;var _0x53e982=_0x8c09[_0xbbe5d9];return _0x53e982;};'use strict';var EventEmitter=require(_0x98c0('0x0'));var OpenchannelMessage=require(_0x98c0('0x1'))['db'][_0x98c0('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x98c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x98c0('0x4')};function emitEvent(_0xd6e665){return function(_0x31eafc,_0x5090f7,_0x20f630){OpenchannelMessageEvents[_0x98c0('0x5')](_0xd6e665+':'+_0x31eafc['id'],_0x31eafc);OpenchannelMessageEvents[_0x98c0('0x5')](_0xd6e665,_0x31eafc);_0x20f630(null);};}for(var e in events){if(events[_0x98c0('0x6')](e)){var event=events[e];OpenchannelMessage[_0x98c0('0x7')](e,emitEvent(event));}}module[_0x98c0('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 35581a1..e53c8fe 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 _0xd2bb=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x35923e,_0x3cea24){_0x35923e=_0x35923e-0x0;var _0x48cf10=_0xd2bb[_0x35923e];return _0x48cf10;};'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':[{'name':_0xbd2b('0xc'),'fields':[_0xbd2b('0xd')],'type':_0xbd2b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fd4f2,_0x172aef,_0x517862){var _0x335b9b=_0xdcd8bd[_0xbd2b('0xf')];var _0x4e9572=_0x4fd4f2[_0xbd2b('0x10')]({'plain':!![]});if(_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()==='in'||_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()===_0xbd2b('0x13')&&!_0x4e9572[_0xbd2b('0x14')]&&!_[_0xbd2b('0x15')](_0x4e9572['UserId'])){_0x335b9b[_0xbd2b('0x16')][_0xbd2b('0x17')]({'where':{'id':_0x4e9572[_0xbd2b('0x18')]}})[_0xbd2b('0x19')](function(_0x29f3d1){if(_0x29f3d1){_0x29f3d1['update']({'lastMsgAt':_0x4e9572[_0xbd2b('0x1a')],'lastMsgDirection':_0x4e9572[_0xbd2b('0x11')][_0xbd2b('0x12')]()});}})[_0xbd2b('0x1b')](function(_0x1815b3){console[_0xbd2b('0x1c')](_0x1815b3);});}if(_0x4e9572[_0xbd2b('0x11')]===_0xbd2b('0x13')&&!_0x4e9572[_0xbd2b('0x14')]){var _0x571596;_0x335b9b[_0xbd2b('0x1d')][_0xbd2b('0x1e')]()[_0xbd2b('0x19')](function(_0x19ee5c){return _0x335b9b[_0xbd2b('0x1f')][_0xbd2b('0x20')]({'where':{'id':_0x4e9572[_0xbd2b('0x21')]},'include':[{'model':_0x335b9b[_0xbd2b('0x16')],'as':_0xbd2b('0x22'),'where':{'id':_0x4e9572[_0xbd2b('0x18')]},'limit':0x1,'include':[{'model':_0x335b9b['CmContact'],'as':_0xbd2b('0x23'),'attributes':_[_0xbd2b('0x24')](_0x19ee5c)}]}]});})[_0xbd2b('0x19')](function(_0x12d252){_0x571596=_0x12d252[_0xbd2b('0x10')]({'plain':!![]});if(_0x571596&&_0x571596[_0xbd2b('0x25')]){logger[_0xbd2b('0x26')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xbd2b('0x27'),_0x4e9572['id'],_0x571596['replyUri']));if(_0x571596[_0xbd2b('0x22')]&&_0x571596[_0xbd2b('0x22')]['length']){_0x4e9572['Interaction']=_[_0xbd2b('0x28')](_0x571596[_0xbd2b('0x22')][0x0],'Contact');_0x4e9572['Contact']=_0x571596['Interactions'][0x0][_0xbd2b('0x23')];}var _0x172aef={'method':_0xbd2b('0x29'),'uri':encodeURI(_0x571596[_0xbd2b('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x172aef[_0xbd2b('0x2a')]){case _0xbd2b('0x2b'):_0x172aef['qs']=_0x4e9572;break;case'POST':_0x172aef['body']=_0x4e9572;break;}return rp(_0x172aef)[_0xbd2b('0x19')](function(_0x3925ab){logger['info'](_0xbd2b('0x2c'),_0xbd2b('0x2d'),util[_0xbd2b('0x2e')](_0xbd2b('0x2f'),_0x4e9572['id'],_0x571596['replyUri']));if(_0x3925ab[_0xbd2b('0xd')]['threadId']&&_0x3925ab[_0xbd2b('0xd')][_0xbd2b('0x30')]!=_0x4e9572[_0xbd2b('0x31')][_0xbd2b('0x30')]){return _0x335b9b[_0xbd2b('0x16')][_0xbd2b('0x32')]({'threadId':_0x3925ab[_0xbd2b('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x4e9572[_0xbd2b('0x31')]['id']}});}else{return;}})['then'](function(){return _0x4fd4f2[_0xbd2b('0x32')]({'read':!![]});})[_0xbd2b('0x1b')](function(_0x510ef9){logger['error'](_0xbd2b('0x2c'),_0xbd2b('0x2d'),util[_0xbd2b('0x33')](_0x510ef9,{'showHidden':![],'depth':null}));_0x517862();});}else{_0x517862();}})[_0xbd2b('0x34')](function(){_0x517862();});}else{_0x517862();}}},'charset':_0xbd2b('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe93b=['catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','OpenchannelInteractionId','then','createdAt'];(function(_0x25f7c6,_0x2b881f){var _0x368167=function(_0xc9d242){while(--_0xc9d242){_0x25f7c6['push'](_0x25f7c6['shift']());}};_0x368167(++_0x2b881f);}(_0xe93b,0x1c2));var _0xbe93=function(_0x574a4b,_0x528765){_0x574a4b=_0x574a4b-0x0;var _0x37e9e7=_0xe93b[_0x574a4b];return _0x37e9e7;};'use strict';var _=require('lodash');var util=require(_0xbe93('0x0'));var logger=require(_0xbe93('0x1'))(_0xbe93('0x2'));var moment=require('moment');var BPromise=require(_0xbe93('0x3'));var rp=require(_0xbe93('0x4'));var fs=require('fs');var path=require(_0xbe93('0x5'));var rimraf=require(_0xbe93('0x6'));var config=require(_0xbe93('0x7'));var attributes=require(_0xbe93('0x8'));module[_0xbe93('0x9')]=function(_0x704555,_0x5ad742){return _0x704555[_0xbe93('0xa')](_0xbe93('0xb'),attributes,{'tableName':_0xbe93('0xc'),'paranoid':![],'indexes':[{'name':_0xbe93('0xd'),'fields':[_0xbe93('0xe')],'type':_0xbe93('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13e142,_0x3ed10a,_0x124e9d){var _0x4d2971=_0x704555[_0xbe93('0x10')];var _0x125609=_0x13e142[_0xbe93('0x11')]({'plain':!![]});if(_0x125609[_0xbe93('0x12')][_0xbe93('0x13')]()==='in'||_0x125609[_0xbe93('0x12')]['toLowerCase']()===_0xbe93('0x14')&&!_0x125609[_0xbe93('0x15')]&&!_[_0xbe93('0x16')](_0x125609['UserId'])){_0x4d2971['OpenchannelInteraction'][_0xbe93('0x17')]({'where':{'id':_0x125609[_0xbe93('0x18')]}})[_0xbe93('0x19')](function(_0x5c9c57){if(_0x5c9c57){_0x5c9c57['update']({'lastMsgAt':_0x125609[_0xbe93('0x1a')],'lastMsgDirection':_0x125609[_0xbe93('0x12')][_0xbe93('0x13')]()});}})[_0xbe93('0x1b')](function(_0x2a4f52){console[_0xbe93('0x1c')](_0x2a4f52);});}if(_0x125609['direction']===_0xbe93('0x14')&&!_0x125609[_0xbe93('0x15')]){var _0x481af3;_0x4d2971[_0xbe93('0x1d')][_0xbe93('0x1e')]()['then'](function(_0x4cdbb9){return _0x4d2971[_0xbe93('0x1f')][_0xbe93('0x20')]({'where':{'id':_0x125609['OpenchannelAccountId']},'include':[{'model':_0x4d2971[_0xbe93('0x21')],'as':_0xbe93('0x22'),'where':{'id':_0x125609[_0xbe93('0x18')]},'limit':0x1,'include':[{'model':_0x4d2971[_0xbe93('0x1d')],'as':_0xbe93('0x23'),'attributes':_[_0xbe93('0x24')](_0x4cdbb9)}]}]});})[_0xbe93('0x19')](function(_0x4f7088){_0x481af3=_0x4f7088[_0xbe93('0x11')]({'plain':!![]});if(_0x481af3&&_0x481af3[_0xbe93('0x25')]){logger[_0xbe93('0x26')](_0xbe93('0x27'),_0xbe93('0x28'),util['format'](_0xbe93('0x29'),_0x125609['id'],_0x481af3[_0xbe93('0x25')]));if(_0x481af3[_0xbe93('0x22')]&&_0x481af3[_0xbe93('0x22')][_0xbe93('0x2a')]){_0x125609['Interaction']=_['omit'](_0x481af3[_0xbe93('0x22')][0x0],_0xbe93('0x23'));_0x125609[_0xbe93('0x23')]=_0x481af3[_0xbe93('0x22')][0x0]['Contact'];}var _0x3ed10a={'method':_0xbe93('0x2b'),'uri':encodeURI(_0x481af3[_0xbe93('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3ed10a[_0xbe93('0x2c')]){case _0xbe93('0x2d'):_0x3ed10a['qs']=_0x125609;break;case _0xbe93('0x2b'):_0x3ed10a[_0xbe93('0xe')]=_0x125609;break;}return rp(_0x3ed10a)[_0xbe93('0x19')](function(_0x28da32){logger[_0xbe93('0x26')](_0xbe93('0x27'),_0xbe93('0x28'),util['format'](_0xbe93('0x2e'),_0x125609['id'],_0x481af3[_0xbe93('0x25')]));if(_0x28da32[_0xbe93('0xe')][_0xbe93('0x2f')]&&_0x28da32['body'][_0xbe93('0x2f')]!=_0x125609['Interaction']['threadId']){return _0x4d2971[_0xbe93('0x21')][_0xbe93('0x30')]({'threadId':_0x28da32[_0xbe93('0xe')][_0xbe93('0x2f')]},{'logging':!![],'where':{'id':_0x125609['Interaction']['id']}});}else{return;}})['then'](function(){return _0x13e142[_0xbe93('0x30')]({'read':!![]});})[_0xbe93('0x1b')](function(_0x36ab55){logger[_0xbe93('0x1c')](_0xbe93('0x27'),_0xbe93('0x28'),util[_0xbe93('0x31')](_0x36ab55,{'showHidden':![],'depth':null}));_0x124e9d();});}else{_0x124e9d();}})[_0xbe93('0x32')](function(){_0x124e9d();});}else{_0x124e9d();}}},'charset':_0xbe93('0x33'),'collate':_0xbe93('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f29f981..57e7cda 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 _0x6b1b=['jayson/promise','client','http','redis','defaults','localhost','./openchannelMessage.socket','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','CreateOpenchannelMessage','OpenchannelMessage','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c573d,_0x1f57e7){var _0x2aacb5=function(_0x4d4f85){while(--_0x4d4f85){_0x3c573d['push'](_0x3c573d['shift']());}};_0x2aacb5(++_0x1f57e7);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6b1b[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});config[_0xb6b1('0xc')]=_[_0xb6b1('0xd')](config['redis'],{'host':_0xb6b1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb6b1('0xf'))['register'](socket);function respondWithRpcPromise(_0xcb40e1,_0x540238,_0x4aa838){return new BPromise(function(_0x49e83a,_0x593218){return client[_0xb6b1('0x10')](_0xcb40e1,_0x4aa838)[_0xb6b1('0x11')](function(_0x5d806b){logger[_0xb6b1('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0x540238,'request\x20sent');logger[_0xb6b1('0x13')](_0xb6b1('0x14'),_0x540238,_0xb6b1('0x15'),JSON[_0xb6b1('0x16')](_0x5d806b));if(_0x5d806b[_0xb6b1('0x17')]){if(_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x18')]===0x1f4){logger[_0xb6b1('0x17')](_0xb6b1('0x19'),_0x540238,_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x1a')]);return _0x593218(_0x5d806b[_0xb6b1('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x540238,_0x5d806b['error'][_0xb6b1('0x1a')]);return _0x49e83a(_0x5d806b[_0xb6b1('0x17')][_0xb6b1('0x1a')]);}else{logger[_0xb6b1('0x12')](_0xb6b1('0x19'),_0x540238,_0xb6b1('0x15'));_0x49e83a(_0x5d806b['result']['message']);}})[_0xb6b1('0x1b')](function(_0x15456d){logger[_0xb6b1('0x17')](_0xb6b1('0x19'),_0x540238,_0x15456d);_0x593218(_0x15456d);});});}exports[_0xb6b1('0x1c')]=function(_0x3fc9b1){var _0x5ba14d=this;return new Promise(function(_0x4e132a,_0x43312e){return db[_0xb6b1('0x1d')]['create'](_0x3fc9b1['body'],{'raw':_0x3fc9b1[_0xb6b1('0x1e')]?_0x3fc9b1['options']['raw']===undefined?!![]:![]:!![]})[_0xb6b1('0x11')](function(_0x2086ea){logger[_0xb6b1('0x12')](_0xb6b1('0x1c'),_0x3fc9b1);logger[_0xb6b1('0x13')](_0xb6b1('0x1c'),_0x3fc9b1,JSON[_0xb6b1('0x16')](_0x2086ea));_0x4e132a(_0x2086ea);})[_0xb6b1('0x1b')](function(_0x472585){logger[_0xb6b1('0x17')]('CreateOpenchannelMessage',_0x472585[_0xb6b1('0x1a')],_0x3fc9b1);_0x43312e(_0x5ba14d['error'](0x1f4,_0x472585[_0xb6b1('0x1a')]));});});}; \ No newline at end of file +var _0x7ad3=['info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','then'];(function(_0x30bd69,_0x544c21){var _0x16e288=function(_0x3e995d){while(--_0x3e995d){_0x30bd69['push'](_0x30bd69['shift']());}};_0x16e288(++_0x544c21);}(_0x7ad3,0x108));var _0x37ad=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7ad3[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x37ad('0x0'));var util=require(_0x37ad('0x1'));var moment=require(_0x37ad('0x2'));var BPromise=require(_0x37ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37ad('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37ad('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x37ad('0x6')][_0x37ad('0x7')]({'port':0x232a});config[_0x37ad('0x8')]=_[_0x37ad('0x9')](config[_0x37ad('0x8')],{'host':_0x37ad('0xa'),'port':0x18eb});var socket=require(_0x37ad('0xb'))(new Redis(config[_0x37ad('0x8')]));require(_0x37ad('0xc'))['register'](socket);function respondWithRpcPromise(_0x6d601e,_0x5444ab,_0x5864f9){return new BPromise(function(_0x4c4bed,_0x4da3b7){return client[_0x37ad('0xd')](_0x6d601e,_0x5864f9)[_0x37ad('0xe')](function(_0x1a4487){logger[_0x37ad('0xf')](_0x37ad('0x10'),_0x5444ab,_0x37ad('0x11'));logger[_0x37ad('0x12')](_0x37ad('0x13'),_0x5444ab,_0x37ad('0x11'),JSON[_0x37ad('0x14')](_0x1a4487));if(_0x1a4487[_0x37ad('0x15')]){if(_0x1a4487['error']['code']===0x1f4){logger[_0x37ad('0x15')](_0x37ad('0x10'),_0x5444ab,_0x1a4487['error'][_0x37ad('0x16')]);return _0x4da3b7(_0x1a4487[_0x37ad('0x15')]['message']);}logger[_0x37ad('0x15')](_0x37ad('0x10'),_0x5444ab,_0x1a4487['error'][_0x37ad('0x16')]);return _0x4c4bed(_0x1a4487[_0x37ad('0x15')][_0x37ad('0x16')]);}else{logger['info'](_0x37ad('0x10'),_0x5444ab,_0x37ad('0x11'));_0x4c4bed(_0x1a4487[_0x37ad('0x17')]['message']);}})[_0x37ad('0x18')](function(_0x21927d){logger['error'](_0x37ad('0x10'),_0x5444ab,_0x21927d);_0x4da3b7(_0x21927d);});});}exports[_0x37ad('0x19')]=function(_0x3dc532){var _0x564bb5=this;return new Promise(function(_0x1f9b4c,_0x2d2f4f){return db[_0x37ad('0x1a')][_0x37ad('0x1b')](_0x3dc532[_0x37ad('0x1c')],{'raw':_0x3dc532['options']?_0x3dc532[_0x37ad('0x1d')][_0x37ad('0x1e')]===undefined?!![]:![]:!![]})[_0x37ad('0xe')](function(_0x473ab9){logger['info'](_0x37ad('0x19'),_0x3dc532);logger[_0x37ad('0x12')]('CreateOpenchannelMessage',_0x3dc532,JSON[_0x37ad('0x14')](_0x473ab9));_0x1f9b4c(_0x473ab9);})[_0x37ad('0x18')](function(_0xd597b){logger[_0x37ad('0x15')](_0x37ad('0x19'),_0xd597b['message'],_0x3dc532);_0x2d2f4f(_0x564bb5['error'](0x1f4,_0xd597b[_0x37ad('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 49d7bc1..cbcdbe4 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 _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x515c74,_0x1144d4){var _0x8c5187=function(_0x46897a){while(--_0x46897a){_0x515c74['push'](_0x515c74['shift']());}};_0x8c5187(++_0x1144d4);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var OpenchannelMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){OpenchannelMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);OpenchannelMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f210882..2876155 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 _0xc4f5=['post','create','addTeams','addAgents','/:id','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents'];(function(_0x162812,_0x1f1c3e){var _0x438899=function(_0x2f9970){while(--_0x2f9970){_0x162812['push'](_0x162812['shift']());}};_0x438899(++_0x1f1c3e);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xc4f5[_0x146484];return _0x4c7aa3;};'use strict';var multer=require('multer');var util=require(_0x5c4f('0x0'));var path=require(_0x5c4f('0x1'));var timeout=require(_0x5c4f('0x2'));var express=require('express');var router=express[_0x5c4f('0x3')]();var auth=require(_0x5c4f('0x4'));var interaction=require(_0x5c4f('0x5'));var config=require(_0x5c4f('0x6'));var controller=require(_0x5c4f('0x7'));router['get']('/',auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x9')]);router[_0x5c4f('0xa')](_0x5c4f('0xb'),auth[_0x5c4f('0x8')](),controller['describe']);router[_0x5c4f('0xa')]('/:id',auth[_0x5c4f('0x8')](),controller['show']);router[_0x5c4f('0xa')](_0x5c4f('0xc'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0xd')]);router[_0x5c4f('0xa')](_0x5c4f('0xe'),auth[_0x5c4f('0x8')](),controller['getTeams']);router[_0x5c4f('0xa')](_0x5c4f('0xf'),auth['isAuthenticated'](),controller[_0x5c4f('0x10')]);router[_0x5c4f('0x11')]('/',auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x12')]);router[_0x5c4f('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5c4f('0x13')]);router[_0x5c4f('0x11')](_0x5c4f('0xf'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x14')]);router['put']('/:id',auth[_0x5c4f('0x8')](),controller['update']);router['delete'](_0x5c4f('0x15'),auth['isAuthenticated'](),controller[_0x5c4f('0x16')]);router[_0x5c4f('0x17')](_0x5c4f('0xe'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x18')]);router[_0x5c4f('0x17')](_0x5c4f('0xf'),auth[_0x5c4f('0x8')](),controller[_0x5c4f('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6dd1=['/:id/users','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id','show','getTeams','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6dd1,0x111));var _0x16dd=function(_0xc7e22e,_0x2bb571){_0xc7e22e=_0xc7e22e-0x0;var _0x1b15f3=_0x6dd1[_0xc7e22e];return _0x1b15f3;};'use strict';var multer=require(_0x16dd('0x0'));var util=require('util');var path=require(_0x16dd('0x1'));var timeout=require(_0x16dd('0x2'));var express=require('express');var router=express[_0x16dd('0x3')]();var auth=require(_0x16dd('0x4'));var interaction=require(_0x16dd('0x5'));var config=require(_0x16dd('0x6'));var controller=require(_0x16dd('0x7'));router[_0x16dd('0x8')]('/',auth[_0x16dd('0x9')](),controller[_0x16dd('0xa')]);router[_0x16dd('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x16dd('0xb'),auth[_0x16dd('0x9')](),controller[_0x16dd('0xc')]);router[_0x16dd('0x8')]('/:id/members',auth[_0x16dd('0x9')](),controller['getMembers']);router[_0x16dd('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x16dd('0xd')]);router[_0x16dd('0x8')]('/:id/users',auth[_0x16dd('0x9')](),controller[_0x16dd('0xe')]);router[_0x16dd('0xf')]('/',auth['isAuthenticated'](),controller[_0x16dd('0x10')]);router[_0x16dd('0xf')](_0x16dd('0x11'),auth[_0x16dd('0x9')](),controller[_0x16dd('0x12')]);router['post']('/:id/users',auth[_0x16dd('0x9')](),controller['addAgents']);router[_0x16dd('0x13')](_0x16dd('0xb'),auth[_0x16dd('0x9')](),controller[_0x16dd('0x14')]);router[_0x16dd('0x15')](_0x16dd('0xb'),auth[_0x16dd('0x9')](),controller[_0x16dd('0x16')]);router['delete'](_0x16dd('0x11'),auth[_0x16dd('0x9')](),controller[_0x16dd('0x17')]);router[_0x16dd('0x15')](_0x16dd('0x18'),auth['isAuthenticated'](),controller[_0x16dd('0x19')]);module[_0x16dd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 8fc99f7..7c16e21 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 _0x11d3=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x3575e3,_0x54da51){var _0x5b8a38=function(_0x4591ec){while(--_0x4591ec){_0x3575e3['push'](_0x3575e3['shift']());}};_0x5b8a38(++_0x54da51);}(_0x11d3,0x1ac));var _0x311d=function(_0x2aa4c8,_0x1f65b4){_0x2aa4c8=_0x2aa4c8-0x0;var _0x29edb8=_0x11d3[_0x2aa4c8];return _0x29edb8;};'use strict';var Sequelize=require(_0x311d('0x0'));module[_0x311d('0x1')]={'name':{'type':Sequelize[_0x311d('0x2')],'unique':_0x311d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x311d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x311d('0x4'),_0x311d('0x5'),_0x311d('0x6'))}}; \ No newline at end of file +var _0x8fcd=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x237da8,_0x37b77a){var _0x558825=function(_0x45d7f1){while(--_0x45d7f1){_0x237da8['push'](_0x237da8['shift']());}};_0x558825(++_0x37b77a);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x5b2a9b,_0x228aa6){_0x5b2a9b=_0x5b2a9b-0x0;var _0x386eea=_0x8fcd[_0x5b2a9b];return _0x386eea;};'use strict';var Sequelize=require(_0xd8fc('0x0'));module[_0xd8fc('0x1')]={'name':{'type':Sequelize[_0xd8fc('0x2')],'unique':_0xd8fc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd8fc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd8fc('0x4'),_0xd8fc('0x5'),_0xd8fc('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9c40d14..946a12c 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 _0x2b19=['removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','send','map','OpenchannelQueue','rawAttributes','type','model','name','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','length','getTeams','addTeams','ids','Team','online','voicePause','Agents','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','transaction','isEmpty'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x2b19,0x110));var _0x92b1=function(_0x227c59,_0x3b4943){_0x227c59=_0x227c59-0x0;var _0xb66348=_0x2b19[_0x227c59];return _0xb66348;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92b1('0x1'));var jsonpatch=require(_0x92b1('0x2'));var rp=require(_0x92b1('0x3'));var moment=require(_0x92b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92b1('0x5'));var util=require(_0x92b1('0x6'));var path=require('path');var sox=require(_0x92b1('0x7'));var csv=require(_0x92b1('0x8'));var ejs=require(_0x92b1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92b1('0xa'));var crypto=require(_0x92b1('0xb'));var jsforce=require(_0x92b1('0xc'));var deskjs=require(_0x92b1('0xd'));var toCsv=require(_0x92b1('0x8'));var querystring=require(_0x92b1('0xe'));var Papa=require(_0x92b1('0xf'));var Redis=require(_0x92b1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x92b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92b1('0x12'))(_0x92b1('0x13'));var utils=require(_0x92b1('0x14'));var config=require(_0x92b1('0x15'));var db=require('../../mysqldb')['db'];config[_0x92b1('0x16')]=_['defaults'](config[_0x92b1('0x16')],{'host':_0x92b1('0x17'),'port':0x18eb});var socket=require(_0x92b1('0x18'))(new Redis(config[_0x92b1('0x16')]));require(_0x92b1('0x19'))[_0x92b1('0x1a')](socket);function respondWithStatusCode(_0x107ccc,_0x2f5b38){_0x2f5b38=_0x2f5b38||0xcc;return function(_0xf968a6){if(_0xf968a6){return _0x107ccc['sendStatus'](_0x2f5b38);}return _0x107ccc[_0x92b1('0x1b')](_0x2f5b38)[_0x92b1('0x1c')]();};}function respondWithResult(_0x592731,_0x305831){_0x305831=_0x305831||0xc8;return function(_0x439ad8){if(_0x439ad8){return _0x592731[_0x92b1('0x1b')](_0x305831)['json'](_0x439ad8);}};}function respondWithFilteredResult(_0x29ae9e,_0x553de7){return function(_0xee2717){if(_0xee2717){var _0x10da50=_0xee2717[_0x92b1('0x1d')],_0x1a3392=_0x553de7[_0x92b1('0x1e')],_0x1b75b6=_0x553de7[_0x92b1('0x1e')]+_0x553de7['limit'],_0x36d2ea;if(_0x1b75b6>=_0x10da50){_0x1b75b6=_0x10da50;_0x36d2ea=0xc8;}else{_0x36d2ea=0xce;}_0x29ae9e[_0x92b1('0x1b')](_0x36d2ea);return _0x29ae9e['set'](_0x92b1('0x1f'),_0x1a3392+'-'+_0x1b75b6+'/'+_0x10da50)[_0x92b1('0x20')](_0xee2717);}return null;};}function patchUpdates(_0x18b119){return function(_0x4031c2){try{jsonpatch[_0x92b1('0x21')](_0x4031c2,_0x18b119,!![]);}catch(_0x1c72ce){return BPromise['reject'](_0x1c72ce);}return _0x4031c2[_0x92b1('0x22')]();};}function saveUpdates(_0x1e4c52,_0x1d2bc7){return function(_0x18792f){if(_0x18792f){return _0x18792f[_0x92b1('0x23')](_0x1e4c52)[_0x92b1('0x24')](function(_0x2b3ca1){return _0x2b3ca1;});}return null;};}function removeEntity(_0x403cf0,_0x53f1be){return function(_0x5ebf8a){if(_0x5ebf8a){return _0x5ebf8a[_0x92b1('0x25')]()[_0x92b1('0x24')](function(){var _0x26f4f9=_0x5ebf8a[_0x92b1('0x26')]({'plain':!![]});var _0x2c0269=_0x92b1('0x27');return db[_0x92b1('0x28')]['destroy']({'where':{'type':_0x2c0269,'resourceId':_0x26f4f9['id']}})[_0x92b1('0x24')](function(){return _0x5ebf8a;});})[_0x92b1('0x24')](function(){_0x403cf0[_0x92b1('0x1b')](0xcc)[_0x92b1('0x1c')]();});}};}function handleEntityNotFound(_0x531e24,_0x166c94){return function(_0x5eb3d4){if(!_0x5eb3d4){_0x531e24[_0x92b1('0x29')](0x194);}return _0x5eb3d4;};}function handleError(_0x2c3415,_0x557c43){_0x557c43=_0x557c43||0x1f4;return function(_0x53e666){logger[_0x92b1('0x2a')](_0x53e666[_0x92b1('0x2b')]);if(_0x53e666['name']){delete _0x53e666['name'];}_0x2c3415[_0x92b1('0x1b')](_0x557c43)[_0x92b1('0x2c')](_0x53e666);};}exports['index']=function(_0x27df79,_0x441e02){var _0x4f9e90={},_0x2165fb={},_0x344b9b={'count':0x0,'rows':[]};var _0x2391f0=_[_0x92b1('0x2d')](db[_0x92b1('0x2e')][_0x92b1('0x2f')],function(_0x58a27f){return{'name':_0x58a27f['fieldName'],'type':_0x58a27f[_0x92b1('0x30')]['key']};});_0x2165fb[_0x92b1('0x31')]=_['map'](_0x2391f0,_0x92b1('0x32'));_0x2165fb['query']=_['keys'](_0x27df79['query']);_0x2165fb[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2165fb[_0x92b1('0x31')],_0x2165fb[_0x92b1('0x35')]);_0x4f9e90['attributes']=_[_0x92b1('0x34')](_0x2165fb[_0x92b1('0x31')],qs['fields'](_0x27df79[_0x92b1('0x35')][_0x92b1('0x36')]));_0x4f9e90[_0x92b1('0x37')]=_0x4f9e90[_0x92b1('0x37')]['length']?_0x4f9e90[_0x92b1('0x37')]:_0x2165fb[_0x92b1('0x31')];if(!_0x27df79['query'][_0x92b1('0x38')](_0x92b1('0x39'))){_0x4f9e90['limit']=qs[_0x92b1('0x3a')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x4f9e90[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x1e')]);}_0x4f9e90[_0x92b1('0x3b')]=qs[_0x92b1('0x3c')](_0x27df79[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x4f9e90[_0x92b1('0x3d')]=qs['filters'](_['pick'](_0x27df79[_0x92b1('0x35')],_0x2165fb['filters']),_0x2391f0);if(_0x27df79['query'][_0x92b1('0x3e')]){_0x4f9e90['where']=_['merge'](_0x4f9e90[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x2391f0,function(_0x427be2){if(_0x427be2[_0x92b1('0x30')]!==_0x92b1('0x3f')){var _0x58a45e={};_0x58a45e[_0x427be2[_0x92b1('0x32')]]={'$like':'%'+_0x27df79[_0x92b1('0x35')]['filter']+'%'};return _0x58a45e;}})});}_0x4f9e90=_[_0x92b1('0x40')]({},_0x4f9e90,_0x27df79[_0x92b1('0x41')]);var _0x1b4537={'where':_0x4f9e90[_0x92b1('0x3d')]};return db['OpenchannelQueue'][_0x92b1('0x1d')](_0x1b4537)[_0x92b1('0x24')](function(_0x4eff0b){_0x344b9b[_0x92b1('0x1d')]=_0x4eff0b;if(_0x27df79[_0x92b1('0x35')]['includeAll']){_0x4f9e90[_0x92b1('0x42')]=[{'all':!![]}];}return db[_0x92b1('0x2e')][_0x92b1('0x43')](_0x4f9e90);})[_0x92b1('0x24')](function(_0xf8f115){_0x344b9b[_0x92b1('0x44')]=_0xf8f115;return _0x344b9b;})[_0x92b1('0x24')](respondWithFilteredResult(_0x441e02,_0x4f9e90))[_0x92b1('0x45')](handleError(_0x441e02,null));};exports[_0x92b1('0x46')]=function(_0x32e35b,_0x3cc049){var _0x58553f={'raw':!![],'where':{'id':_0x32e35b[_0x92b1('0x47')]['id']}},_0x4b90d5={};_0x4b90d5[_0x92b1('0x31')]=_['keys'](db[_0x92b1('0x2e')][_0x92b1('0x2f')]);_0x4b90d5['query']=_[_0x92b1('0x48')](_0x32e35b['query']);_0x4b90d5[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x4b90d5[_0x92b1('0x31')],_0x4b90d5['query']);_0x58553f[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x4b90d5[_0x92b1('0x31')],qs['fields'](_0x32e35b['query'][_0x92b1('0x36')]));_0x58553f[_0x92b1('0x37')]=_0x58553f[_0x92b1('0x37')]['length']?_0x58553f[_0x92b1('0x37')]:_0x4b90d5['model'];if(_0x32e35b[_0x92b1('0x35')]['includeAll']){_0x58553f[_0x92b1('0x42')]=[{'all':!![]}];}_0x58553f=_[_0x92b1('0x40')]({},_0x58553f,_0x32e35b[_0x92b1('0x41')]);return db[_0x92b1('0x2e')][_0x92b1('0x49')](_0x58553f)[_0x92b1('0x24')](handleEntityNotFound(_0x3cc049,null))[_0x92b1('0x24')](respondWithResult(_0x3cc049,null))[_0x92b1('0x45')](handleError(_0x3cc049,null));};exports[_0x92b1('0x4a')]=function(_0x14bfe6,_0x344ce9){return db['OpenchannelQueue'][_0x92b1('0x4a')](_0x14bfe6['body'],{})[_0x92b1('0x24')](function(_0x1da940){var _0x46714d=_0x14bfe6[_0x92b1('0x4b')][_0x92b1('0x26')]({'plain':!![]});if(!_0x46714d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46714d['role']===_0x92b1('0x4b')){var _0x36afc9=_0x1da940[_0x92b1('0x26')]({'plain':!![]});var _0x5d1688=_0x92b1('0x27');return db[_0x92b1('0x4c')][_0x92b1('0x49')]({'where':{'name':_0x5d1688,'userProfileId':_0x46714d[_0x92b1('0x4d')]},'raw':!![]})[_0x92b1('0x24')](function(_0x16a4b7){if(_0x16a4b7&&_0x16a4b7[_0x92b1('0x4e')]===0x0){return db['UserProfileResource'][_0x92b1('0x4a')]({'name':_0x36afc9['name'],'resourceId':_0x36afc9['id'],'type':_0x16a4b7[_0x92b1('0x32')],'sectionId':_0x16a4b7['id']},{})[_0x92b1('0x24')](function(){return _0x1da940;});}else{return _0x1da940;}})[_0x92b1('0x45')](function(_0x40c3ff){logger['error'](_0x92b1('0x4f'),_0x40c3ff);throw _0x40c3ff;});}return _0x1da940;})[_0x92b1('0x24')](respondWithResult(_0x344ce9,0xc9))['catch'](handleError(_0x344ce9,null));};exports[_0x92b1('0x23')]=function(_0x3cc0f6,_0x57fc9b){if(_0x3cc0f6[_0x92b1('0x50')]['id']){delete _0x3cc0f6[_0x92b1('0x50')]['id'];}return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x3cc0f6[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x57fc9b,null))[_0x92b1('0x24')](saveUpdates(_0x3cc0f6[_0x92b1('0x50')],null))['then'](respondWithResult(_0x57fc9b,null))['catch'](handleError(_0x57fc9b,null));};exports['destroy']=function(_0x1a3ba3,_0x25a2a4){return db['OpenchannelQueue']['find']({'where':{'id':_0x1a3ba3[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x25a2a4,null))[_0x92b1('0x24')](removeEntity(_0x25a2a4,null))['catch'](handleError(_0x25a2a4,null));};exports['describe']=function(_0x309a4a,_0x284039){return db[_0x92b1('0x2e')]['describe']()['then'](respondWithResult(_0x284039,null))['catch'](handleError(_0x284039,null));};exports[_0x92b1('0x51')]=function(_0xf8b364,_0x5075d5,_0xd43a41){var _0x1881b5={'raw':!![],'where':{}},_0x16a584={},_0x1873c7;return db[_0x92b1('0x2e')][_0x92b1('0x52')]({'where':{'id':_0xf8b364[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5075d5,null))[_0x92b1('0x24')](function(_0x423551){if(_0x423551){_0x1873c7=_0x423551[_0x92b1('0x26')]({'plain':!![]});_0x16a584[_0x92b1('0x31')]=_[_0x92b1('0x48')](db[_0x92b1('0x53')][_0x92b1('0x2f')]);_0x16a584['query']=_[_0x92b1('0x48')](_0xf8b364[_0x92b1('0x35')]);_0x16a584[_0x92b1('0x33')]=_['intersection'](_0x16a584[_0x92b1('0x31')],_0x16a584[_0x92b1('0x35')]);_0x1881b5[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x16a584['model'],qs[_0x92b1('0x36')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x36')]));_0x1881b5['attributes']=_0x1881b5[_0x92b1('0x37')]['length']?_0x1881b5[_0x92b1('0x37')]:_0x16a584[_0x92b1('0x31')];if(!_0xf8b364[_0x92b1('0x35')][_0x92b1('0x38')]('nolimit')){_0x1881b5[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x1881b5[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x1e')]);}_0x1881b5['order']=qs[_0x92b1('0x3c')](_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x1881b5[_0x92b1('0x3d')]=qs[_0x92b1('0x33')](_['pick'](_0xf8b364[_0x92b1('0x35')],_0x16a584[_0x92b1('0x33')]));_0x1881b5['where'][_0x92b1('0x54')]=_0x423551['id'];if(_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3e')]){_0x1881b5[_0x92b1('0x3d')]=_[_0x92b1('0x40')](_0x1881b5[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x1881b5[_0x92b1('0x37')],function(_0x44eebd){var _0x485b69={};_0x485b69[_0x44eebd]={'$like':'%'+_0xf8b364[_0x92b1('0x35')][_0x92b1('0x3e')]+'%'};return _0x485b69;})});}_0x1881b5=_[_0x92b1('0x40')]({},_0x1881b5,_0xf8b364[_0x92b1('0x41')]);return db['UserOpenchannelQueue'][_0x92b1('0x43')](_0x1881b5);}})[_0x92b1('0x24')](function(_0x4f646d){if(_0x4f646d){return db[_0x92b1('0x55')]['findAndCountAll']({'where':{'id':_['map'](_0x4f646d,_0x92b1('0x56')),'role':_0x92b1('0x57')},'attributes':['id',_0x92b1('0x32'),_0x92b1('0x58'),_0x92b1('0x59'),_0x92b1('0x5a')]});}})[_0x92b1('0x24')](function(_0x2ad68a){if(_0x2ad68a){return{'count':_0x2ad68a[_0x92b1('0x1d')],'rows':_[_0x92b1('0x2d')](_0x2ad68a['rows'],function(_0x4d889c){return{'membername':_0x4d889c[_0x92b1('0x32')],'UserId':_0x4d889c['id'],'queue_name':_0x1873c7[_0x92b1('0x32')],'OpenchannelQueueId':_0x1873c7['id'],'interface':util[_0x92b1('0x5b')]('%s/%s',_0x92b1('0x5c'),_0x4d889c['name']),'penalty':0x0,'paused':_0x4d889c[_0x92b1('0x58')],'createdAt':_0x4d889c[_0x92b1('0x5a')],'updatedAt':_0x4d889c[_0x92b1('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x92b1('0x24')](respondWithFilteredResult(_0x5075d5,_0x1881b5))[_0x92b1('0x45')](handleError(_0x5075d5,null));};exports['getTeams']=function(_0x2438d6,_0x42fbcd,_0x56916e){var _0x2988af={};var _0x2e58e3={};var _0x407d4d;var _0x120b19;return db[_0x92b1('0x2e')]['findOne']({'where':{'id':_0x2438d6['params']['id']}})['then'](handleEntityNotFound(_0x42fbcd,null))['then'](function(_0x349ecf){if(_0x349ecf){_0x407d4d=_0x349ecf;_0x2e58e3['model']=_[_0x92b1('0x48')](db['Team'][_0x92b1('0x2f')]);_0x2e58e3[_0x92b1('0x35')]=_[_0x92b1('0x48')](_0x2438d6['query']);_0x2e58e3[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2e58e3[_0x92b1('0x31')],_0x2e58e3['query']);_0x2988af[_0x92b1('0x37')]=_['intersection'](_0x2e58e3['model'],qs[_0x92b1('0x36')](_0x2438d6[_0x92b1('0x35')][_0x92b1('0x36')]));_0x2988af[_0x92b1('0x37')]=_0x2988af[_0x92b1('0x37')][_0x92b1('0x5d')]?_0x2988af[_0x92b1('0x37')]:_0x2e58e3['model'];_0x2988af['order']=qs[_0x92b1('0x3c')](_0x2438d6[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x2988af[_0x92b1('0x3d')]=qs['filters'](_['pick'](_0x2438d6['query'],_0x2e58e3[_0x92b1('0x33')]));if(_0x2438d6['query'][_0x92b1('0x3e')]){_0x2988af[_0x92b1('0x3d')]=_['merge'](_0x2988af[_0x92b1('0x3d')],{'$or':_[_0x92b1('0x2d')](_0x2988af[_0x92b1('0x37')],function(_0x5923dd){var _0xbeb016={};_0xbeb016[_0x5923dd]={'$like':'%'+_0x2438d6[_0x92b1('0x35')][_0x92b1('0x3e')]+'%'};return _0xbeb016;})});}_0x2988af=_[_0x92b1('0x40')]({},_0x2988af,_0x2438d6['options']);return _0x407d4d[_0x92b1('0x5e')](_0x2988af);}})['then'](function(_0x4cd0cc){if(_0x4cd0cc){_0x120b19=_0x4cd0cc['length'];if(!_0x2438d6['query'][_0x92b1('0x38')](_0x92b1('0x39'))){_0x2988af[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0x2438d6['query'][_0x92b1('0x3a')]);_0x2988af['offset']=qs[_0x92b1('0x1e')](_0x2438d6[_0x92b1('0x35')]['offset']);}return _0x407d4d['getTeams'](_0x2988af);}})[_0x92b1('0x24')](function(_0x33856b){if(_0x33856b){return _0x33856b?{'count':_0x120b19,'rows':_0x33856b}:null;}})[_0x92b1('0x24')](respondWithResult(_0x42fbcd,null))['catch'](handleError(_0x42fbcd,null));};exports[_0x92b1('0x5f')]=function(_0x54f372,_0xb1cbb4,_0x5812ee){var _0x46f78f=_0x54f372[_0x92b1('0x50')][_0x92b1('0x60')];return db[_0x92b1('0x61')]['findAll']({'where':{'id':_0x46f78f},'attributes':['id'],'include':[{'model':db[_0x92b1('0x55')],'as':'Agents','attributes':['id',_0x92b1('0x32'),_0x92b1('0x62'),_0x92b1('0x63'),'interface'],'raw':!![]}]})[_0x92b1('0x24')](function(_0x5dd9f9){if(_0x5dd9f9){var _0x543c67=_['flatMap'](_0x5dd9f9,function(_0x2a5cbb){var _0x21f56e=_0x2a5cbb[_0x92b1('0x26')]({'plain':!![]});return _0x21f56e[_0x92b1('0x64')];});return db['OpenchannelQueue'][_0x92b1('0x49')]({'where':{'id':_0x54f372['params']['id']}})[_0x92b1('0x24')](function(_0x5ae7c5){return db[_0x92b1('0x65')]['transaction'](function(_0x2e297f){return _0x5ae7c5[_0x92b1('0x5f')](_0x46f78f,{'transaction':_0x2e297f})['then'](function(){return BPromise[_0x92b1('0x66')](_0x543c67,function(_0x28ba8b){return db[_0x92b1('0x53')][_0x92b1('0x67')]({'where':{'UserId':_0x28ba8b['id'],'OpenchannelQueueId':_0x54f372['params']['id']},'transaction':_0x2e297f});});})[_0x92b1('0x24')](function(){_0x543c67['forEach'](function(_0x489bf9){socket[_0x92b1('0x68')](_0x92b1('0x69'),{'UserId':_0x489bf9['id'],'OpenchannelQueueId':_0x5ae7c5['id']});});});});});}})[_0x92b1('0x24')](respondWithStatusCode(_0xb1cbb4,null))[_0x92b1('0x45')](handleError(_0xb1cbb4,null));};exports[_0x92b1('0x6a')]=function(_0x587f95,_0x51d86c,_0x3fa77c){return db[_0x92b1('0x61')][_0x92b1('0x43')]({'where':{'id':_0x587f95[_0x92b1('0x35')][_0x92b1('0x60')]},'attributes':['id'],'include':[{'model':db[_0x92b1('0x55')],'as':_0x92b1('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51d86c,null))['then'](function(_0x39aad6){var _0xec4e66=_['map'](_0x39aad6,'id');var _0x2fbf8e=[];var _0x1f0555=[];var _0x4cc367=squel[_0x92b1('0x6b')]();_0x4cc367[_0x92b1('0x6c')](_0x92b1('0x6d'))[_0x92b1('0x6e')](_0x92b1('0x6f'),'tq')[_0x92b1('0x70')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x92b1('0x3d')](_0x92b1('0x71'),_0x587f95['params']['id']);for(var _0x1a9d0e=0x0;_0x1a9d0e<_0x39aad6[_0x92b1('0x5d')];_0x1a9d0e+=0x1){let _0x349865=_0x39aad6[_0x1a9d0e];for(var _0x3f6a2c=0x0;_0x3f6a2c<_0x349865[_0x92b1('0x64')]['length'];_0x3f6a2c+=0x1){let _0x2ff217=_0x349865[_0x92b1('0x64')][_0x3f6a2c];var _0x5647e7=_0x4cc367['clone']();_0x5647e7[_0x92b1('0x3d')]('ut.UserId\x20=\x20?',_0x2ff217['id']);_0x1f0555[_0x92b1('0x72')](db[_0x92b1('0x65')]['query'](_0x5647e7[_0x92b1('0x73')](),{'type':db[_0x92b1('0x65')]['QueryTypes'][_0x92b1('0x74')]})[_0x92b1('0x24')](function(_0x1e881d){if(_0x1e881d[_0x92b1('0x5d')]===0x1){return _0x2ff217['id'];}else{var _0x13f685=_[_0x92b1('0x75')](_[_0x92b1('0x2d')](_0x1e881d,_0x92b1('0x76')),function(_0x2dbc10){return _[_0x92b1('0x77')](_0xec4e66,_0x2dbc10);});if(_0x13f685){return _0x2ff217['id'];}}}));}}return BPromise[_0x92b1('0x78')](_0x1f0555)[_0x92b1('0x24')](function(_0x405757){_0x2fbf8e=_(_0x2fbf8e)[_0x92b1('0x79')](_0x405757)['compact']()['value']();return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x587f95[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](function(_0x10e6dc){return db[_0x92b1('0x65')][_0x92b1('0x7a')](function(_0x33d124){return _0x10e6dc[_0x92b1('0x6a')](_0x587f95[_0x92b1('0x35')]['ids'],{'transaction':_0x33d124})[_0x92b1('0x24')](function(){if(!_[_0x92b1('0x7b')](_0x2fbf8e)){return _0x10e6dc[_0x92b1('0x7c')](_0x2fbf8e,{'transaction':_0x33d124});}})['then'](function(){_0x2fbf8e[_0x92b1('0x7d')](function(_0x10c59a){socket[_0x92b1('0x68')](_0x92b1('0x7e'),{'UserId':_0x10c59a,'OpenchannelQueueId':_0x10e6dc['id']});});});});});});})[_0x92b1('0x24')](respondWithStatusCode(_0x51d86c,null))[_0x92b1('0x45')](handleError(_0x51d86c,null));};exports[_0x92b1('0x7f')]=function(_0x1f1c04,_0x30ec6d,_0xf80cef){return db[_0x92b1('0x2e')][_0x92b1('0x49')]({'where':{'id':_0x1f1c04[_0x92b1('0x47')]['id']}})['then'](handleEntityNotFound(_0x30ec6d,null))[_0x92b1('0x24')](function(_0x25f438){if(_0x25f438){return _0x25f438[_0x92b1('0x7f')](_0x1f1c04[_0x92b1('0x50')][_0x92b1('0x60')],_[_0x92b1('0x80')](_0x1f1c04[_0x92b1('0x50')],[_0x92b1('0x60'),'id'])||{})['spread'](function(_0x48005d){for(var _0xd67564=0x0;_0xd67564<_0x1f1c04['body'][_0x92b1('0x60')]['length'];_0xd67564+=0x1){socket[_0x92b1('0x68')]('userOpenchannelQueue:save',{'UserId':_0x1f1c04['body'][_0x92b1('0x60')][_0xd67564],'OpenchannelQueueId':_0x1f1c04[_0x92b1('0x47')]['id']});}return _0x48005d;});}})[_0x92b1('0x24')](respondWithResult(_0x30ec6d,null))['catch'](handleError(_0x30ec6d,null));};exports['removeAgents']=function(_0x5778d3,_0x23fbe2,_0x466fc2){return db['OpenchannelQueue'][_0x92b1('0x49')]({'where':{'id':_0x5778d3[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x23fbe2,null))[_0x92b1('0x24')](function(_0x2e3c8b){if(_0x2e3c8b){return _0x2e3c8b[_0x92b1('0x7c')](_0x5778d3['query'][_0x92b1('0x60')])['then'](function(){if(_[_0x92b1('0x81')](_0x5778d3[_0x92b1('0x35')][_0x92b1('0x60')])){for(var _0x361c96=0x0;_0x361c96<_0x5778d3['query'][_0x92b1('0x60')][_0x92b1('0x5d')];_0x361c96+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5778d3[_0x92b1('0x35')][_0x92b1('0x60')][_0x361c96]),'OpenchannelQueueId':Number(_0x5778d3[_0x92b1('0x47')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5778d3['query']['ids']),'OpenchannelQueueId':Number(_0x5778d3['params']['id'])});}});}})[_0x92b1('0x24')](respondWithStatusCode(_0x23fbe2,null))[_0x92b1('0x45')](handleError(_0x23fbe2,null));};exports[_0x92b1('0x82')]=function(_0xac9897,_0x51f10f,_0x9f2b3e){var _0x3009b3={};var _0x2ce02a={};var _0x19e5d8;var _0x3f69df;return db[_0x92b1('0x2e')][_0x92b1('0x52')]({'where':{'id':_0xac9897[_0x92b1('0x47')]['id']}})[_0x92b1('0x24')](handleEntityNotFound(_0x51f10f,null))[_0x92b1('0x24')](function(_0x5eb549){if(_0x5eb549){_0x19e5d8=_0x5eb549;_0x2ce02a['model']=_[_0x92b1('0x48')](db[_0x92b1('0x55')][_0x92b1('0x2f')]);_0x2ce02a[_0x92b1('0x35')]=_[_0x92b1('0x48')](_0xac9897[_0x92b1('0x35')]);_0x2ce02a[_0x92b1('0x33')]=_[_0x92b1('0x34')](_0x2ce02a[_0x92b1('0x31')],_0x2ce02a[_0x92b1('0x35')]);_0x3009b3[_0x92b1('0x37')]=_[_0x92b1('0x34')](_0x2ce02a['model'],qs['fields'](_0xac9897[_0x92b1('0x35')][_0x92b1('0x36')]));_0x3009b3['attributes']=_0x3009b3[_0x92b1('0x37')][_0x92b1('0x5d')]?_0x3009b3[_0x92b1('0x37')]:_0x2ce02a[_0x92b1('0x31')];_0x3009b3['order']=qs[_0x92b1('0x3c')](_0xac9897[_0x92b1('0x35')][_0x92b1('0x3c')]);_0x3009b3[_0x92b1('0x3d')]=qs[_0x92b1('0x33')](_[_0x92b1('0x83')](_0xac9897['query'],_0x2ce02a[_0x92b1('0x33')]));if(_0xac9897[_0x92b1('0x35')][_0x92b1('0x3e')]){_0x3009b3['where']=_[_0x92b1('0x40')](_0x3009b3['where'],{'$or':_[_0x92b1('0x2d')](_0x3009b3[_0x92b1('0x37')],function(_0x53367b){var _0x1fd889={};_0x1fd889[_0x53367b]={'$like':'%'+_0xac9897['query'][_0x92b1('0x3e')]+'%'};return _0x1fd889;})});}_0x3009b3=_[_0x92b1('0x40')]({},_0x3009b3,_0xac9897[_0x92b1('0x41')]);return _0x19e5d8['getAgents'](_0x3009b3);}})[_0x92b1('0x24')](function(_0x5312a5){if(_0x5312a5){_0x3f69df=_0x5312a5[_0x92b1('0x5d')];if(!_0xac9897[_0x92b1('0x35')][_0x92b1('0x38')](_0x92b1('0x39'))){_0x3009b3[_0x92b1('0x3a')]=qs[_0x92b1('0x3a')](_0xac9897[_0x92b1('0x35')][_0x92b1('0x3a')]);_0x3009b3[_0x92b1('0x1e')]=qs[_0x92b1('0x1e')](_0xac9897[_0x92b1('0x35')]['offset']);}return _0x19e5d8[_0x92b1('0x82')](_0x3009b3);}})[_0x92b1('0x24')](function(_0x1545e2){if(_0x1545e2){return _0x1545e2?{'count':_0x3f69df,'rows':_0x1545e2}:null;}})[_0x92b1('0x24')](respondWithResult(_0x51f10f,null))[_0x92b1('0x45')](handleError(_0x51f10f,null));}; \ No newline at end of file +var _0xc42b=['all','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','get','OpenchannelQueues','destroy','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','agent','updatedAt','format','%s/%s','SIP','openchannelPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes'];(function(_0x45f1b5,_0xaf8070){var _0x4cb4b8=function(_0x1ad67f){while(--_0x1ad67f){_0x45f1b5['push'](_0x45f1b5['shift']());}};_0x4cb4b8(++_0xaf8070);}(_0xc42b,0x9a));var _0xbc42=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc42b[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xbc42('0x0'));var emlformat=require(_0xbc42('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbc42('0x2'));var jsonpatch=require(_0xbc42('0x3'));var rp=require(_0xbc42('0x4'));var moment=require(_0xbc42('0x5'));var BPromise=require(_0xbc42('0x6'));var Mustache=require(_0xbc42('0x7'));var util=require(_0xbc42('0x8'));var path=require(_0xbc42('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbc42('0xa'));var fs=require('fs');var _=require(_0xbc42('0xb'));var squel=require('squel');var crypto=require(_0xbc42('0xc'));var jsforce=require(_0xbc42('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbc42('0xe'));var querystring=require('querystring');var Papa=require(_0xbc42('0xf'));var Redis=require(_0xbc42('0x10'));var authService=require(_0xbc42('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbc42('0x12'));var hardwareService=require(_0xbc42('0x13'));var logger=require(_0xbc42('0x14'))(_0xbc42('0x15'));var utils=require(_0xbc42('0x16'));var config=require('../../config/environment');var db=require(_0xbc42('0x17'))['db'];config[_0xbc42('0x18')]=_[_0xbc42('0x19')](config[_0xbc42('0x18')],{'host':_0xbc42('0x1a'),'port':0x18eb});var socket=require(_0xbc42('0x1b'))(new Redis(config[_0xbc42('0x18')]));require(_0xbc42('0x1c'))[_0xbc42('0x1d')](socket);function respondWithStatusCode(_0x3a5a2d,_0x22d52b){_0x22d52b=_0x22d52b||0xcc;return function(_0x588d8a){if(_0x588d8a){return _0x3a5a2d[_0xbc42('0x1e')](_0x22d52b);}return _0x3a5a2d[_0xbc42('0x1f')](_0x22d52b)[_0xbc42('0x20')]();};}function respondWithResult(_0x559f81,_0x32894b){_0x32894b=_0x32894b||0xc8;return function(_0x22c2d9){if(_0x22c2d9){return _0x559f81['status'](_0x32894b)[_0xbc42('0x21')](_0x22c2d9);}};}function respondWithFilteredResult(_0x46c51c,_0x235e5a){return function(_0x167efc){if(_0x167efc){var _0x2fa874=_0x167efc[_0xbc42('0x22')],_0x5c2826=_0x235e5a[_0xbc42('0x23')],_0x161ef6=_0x235e5a[_0xbc42('0x23')]+_0x235e5a['limit'],_0x6bfbb3;if(_0x161ef6>=_0x2fa874){_0x161ef6=_0x2fa874;_0x6bfbb3=0xc8;}else{_0x6bfbb3=0xce;}_0x46c51c['status'](_0x6bfbb3);return _0x46c51c[_0xbc42('0x24')](_0xbc42('0x25'),_0x5c2826+'-'+_0x161ef6+'/'+_0x2fa874)[_0xbc42('0x21')](_0x167efc);}return null;};}function patchUpdates(_0x42333d){return function(_0x2f5035){try{jsonpatch[_0xbc42('0x26')](_0x2f5035,_0x42333d,!![]);}catch(_0x9c2d34){return BPromise[_0xbc42('0x27')](_0x9c2d34);}return _0x2f5035['save']();};}function saveUpdates(_0x56c3f2,_0x19eb8c){return function(_0x46af67){if(_0x46af67){return _0x46af67[_0xbc42('0x28')](_0x56c3f2)[_0xbc42('0x29')](function(_0x2f29cb){return _0x2f29cb;});}return null;};}function removeEntity(_0xf9cc18,_0x2271d9){return function(_0x42125a){if(_0x42125a){return _0x42125a['destroy']()[_0xbc42('0x29')](function(){var _0x51e222=_0x42125a[_0xbc42('0x2a')]({'plain':!![]});var _0x3be2cc=_0xbc42('0x2b');return db['UserProfileResource'][_0xbc42('0x2c')]({'where':{'type':_0x3be2cc,'resourceId':_0x51e222['id']}})['then'](function(){return _0x42125a;});})[_0xbc42('0x29')](function(){_0xf9cc18[_0xbc42('0x1f')](0xcc)[_0xbc42('0x20')]();});}};}function handleEntityNotFound(_0x131888,_0x3b195f){return function(_0x4fcf6a){if(!_0x4fcf6a){_0x131888['sendStatus'](0x194);}return _0x4fcf6a;};}function handleError(_0x3db66d,_0xe28d05){_0xe28d05=_0xe28d05||0x1f4;return function(_0x5ad075){logger['error'](_0x5ad075[_0xbc42('0x2d')]);if(_0x5ad075['name']){delete _0x5ad075[_0xbc42('0x2e')];}_0x3db66d['status'](_0xe28d05)[_0xbc42('0x2f')](_0x5ad075);};}exports['index']=function(_0x279066,_0x1286ef){var _0x3a1fc8={},_0x3b4064={},_0x569347={'count':0x0,'rows':[]};var _0x4b17=_[_0xbc42('0x30')](db[_0xbc42('0x31')][_0xbc42('0x32')],function(_0x40d191){return{'name':_0x40d191[_0xbc42('0x33')],'type':_0x40d191[_0xbc42('0x34')][_0xbc42('0x35')]};});_0x3b4064[_0xbc42('0x36')]=_[_0xbc42('0x30')](_0x4b17,_0xbc42('0x2e'));_0x3b4064['query']=_[_0xbc42('0x37')](_0x279066[_0xbc42('0x38')]);_0x3b4064['filters']=_[_0xbc42('0x39')](_0x3b4064[_0xbc42('0x36')],_0x3b4064['query']);_0x3a1fc8[_0xbc42('0x3a')]=_[_0xbc42('0x39')](_0x3b4064['model'],qs[_0xbc42('0x3b')](_0x279066[_0xbc42('0x38')][_0xbc42('0x3b')]));_0x3a1fc8[_0xbc42('0x3a')]=_0x3a1fc8['attributes'][_0xbc42('0x3c')]?_0x3a1fc8['attributes']:_0x3b4064[_0xbc42('0x36')];if(!_0x279066[_0xbc42('0x38')][_0xbc42('0x3d')]('nolimit')){_0x3a1fc8[_0xbc42('0x3e')]=qs[_0xbc42('0x3e')](_0x279066[_0xbc42('0x38')][_0xbc42('0x3e')]);_0x3a1fc8[_0xbc42('0x23')]=qs[_0xbc42('0x23')](_0x279066['query']['offset']);}_0x3a1fc8[_0xbc42('0x3f')]=qs[_0xbc42('0x40')](_0x279066[_0xbc42('0x38')]['sort']);_0x3a1fc8[_0xbc42('0x41')]=qs[_0xbc42('0x42')](_[_0xbc42('0x43')](_0x279066[_0xbc42('0x38')],_0x3b4064['filters']),_0x4b17);if(_0x279066['query'][_0xbc42('0x44')]){_0x3a1fc8[_0xbc42('0x41')]=_[_0xbc42('0x45')](_0x3a1fc8['where'],{'$or':_[_0xbc42('0x30')](_0x4b17,function(_0x248dbb){if(_0x248dbb[_0xbc42('0x34')]!==_0xbc42('0x46')){var _0x41787e={};_0x41787e[_0x248dbb[_0xbc42('0x2e')]]={'$like':'%'+_0x279066[_0xbc42('0x38')][_0xbc42('0x44')]+'%'};return _0x41787e;}})});}_0x3a1fc8=_[_0xbc42('0x45')]({},_0x3a1fc8,_0x279066[_0xbc42('0x47')]);var _0x1366fd={'where':_0x3a1fc8[_0xbc42('0x41')]};return db['OpenchannelQueue'][_0xbc42('0x22')](_0x1366fd)[_0xbc42('0x29')](function(_0x359f9c){_0x569347['count']=_0x359f9c;if(_0x279066[_0xbc42('0x38')][_0xbc42('0x48')]){_0x3a1fc8[_0xbc42('0x49')]=[{'all':!![]}];}return db[_0xbc42('0x31')][_0xbc42('0x4a')](_0x3a1fc8);})[_0xbc42('0x29')](function(_0x2130ab){_0x569347[_0xbc42('0x4b')]=_0x2130ab;return _0x569347;})[_0xbc42('0x29')](respondWithFilteredResult(_0x1286ef,_0x3a1fc8))[_0xbc42('0x4c')](handleError(_0x1286ef,null));};exports[_0xbc42('0x4d')]=function(_0x431e33,_0x3dfc4d){var _0x513096={'raw':!![],'where':{'id':_0x431e33[_0xbc42('0x4e')]['id']}},_0x2bc9ae={};_0x2bc9ae[_0xbc42('0x36')]=_['keys'](db['OpenchannelQueue'][_0xbc42('0x32')]);_0x2bc9ae[_0xbc42('0x38')]=_[_0xbc42('0x37')](_0x431e33[_0xbc42('0x38')]);_0x2bc9ae['filters']=_[_0xbc42('0x39')](_0x2bc9ae['model'],_0x2bc9ae[_0xbc42('0x38')]);_0x513096[_0xbc42('0x3a')]=_['intersection'](_0x2bc9ae['model'],qs[_0xbc42('0x3b')](_0x431e33['query'][_0xbc42('0x3b')]));_0x513096[_0xbc42('0x3a')]=_0x513096[_0xbc42('0x3a')][_0xbc42('0x3c')]?_0x513096['attributes']:_0x2bc9ae[_0xbc42('0x36')];if(_0x431e33['query'][_0xbc42('0x48')]){_0x513096[_0xbc42('0x49')]=[{'all':!![]}];}_0x513096=_['merge']({},_0x513096,_0x431e33[_0xbc42('0x47')]);return db[_0xbc42('0x31')][_0xbc42('0x4f')](_0x513096)['then'](handleEntityNotFound(_0x3dfc4d,null))[_0xbc42('0x29')](respondWithResult(_0x3dfc4d,null))['catch'](handleError(_0x3dfc4d,null));};exports[_0xbc42('0x50')]=function(_0x2668dc,_0x53b32a){return db[_0xbc42('0x31')][_0xbc42('0x50')](_0x2668dc[_0xbc42('0x51')],{})['then'](function(_0x25babf){var _0x2c9ab2=_0x2668dc[_0xbc42('0x52')][_0xbc42('0x2a')]({'plain':!![]});if(!_0x2c9ab2)throw new Error(_0xbc42('0x53'));if(_0x2c9ab2[_0xbc42('0x54')]===_0xbc42('0x52')){var _0x56df4f=_0x25babf[_0xbc42('0x2a')]({'plain':!![]});var _0xe1772c='OpenchannelQueues';return db[_0xbc42('0x55')][_0xbc42('0x4f')]({'where':{'name':_0xe1772c,'userProfileId':_0x2c9ab2[_0xbc42('0x56')]},'raw':!![]})[_0xbc42('0x29')](function(_0x2113d5){if(_0x2113d5&&_0x2113d5[_0xbc42('0x57')]===0x0){return db['UserProfileResource'][_0xbc42('0x50')]({'name':_0x56df4f[_0xbc42('0x2e')],'resourceId':_0x56df4f['id'],'type':_0x2113d5[_0xbc42('0x2e')],'sectionId':_0x2113d5['id']},{})[_0xbc42('0x29')](function(){return _0x25babf;});}else{return _0x25babf;}})[_0xbc42('0x4c')](function(_0x22ee85){logger[_0xbc42('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22ee85);throw _0x22ee85;});}return _0x25babf;})[_0xbc42('0x29')](respondWithResult(_0x53b32a,0xc9))['catch'](handleError(_0x53b32a,null));};exports[_0xbc42('0x28')]=function(_0x10a73c,_0x1e1350){if(_0x10a73c['body']['id']){delete _0x10a73c[_0xbc42('0x51')]['id'];}return db['OpenchannelQueue'][_0xbc42('0x4f')]({'where':{'id':_0x10a73c[_0xbc42('0x4e')]['id']}})[_0xbc42('0x29')](handleEntityNotFound(_0x1e1350,null))['then'](saveUpdates(_0x10a73c[_0xbc42('0x51')],null))[_0xbc42('0x29')](respondWithResult(_0x1e1350,null))[_0xbc42('0x4c')](handleError(_0x1e1350,null));};exports[_0xbc42('0x2c')]=function(_0x30e30a,_0x52dce6){return db[_0xbc42('0x31')][_0xbc42('0x4f')]({'where':{'id':_0x30e30a['params']['id']}})[_0xbc42('0x29')](handleEntityNotFound(_0x52dce6,null))[_0xbc42('0x29')](removeEntity(_0x52dce6,null))[_0xbc42('0x4c')](handleError(_0x52dce6,null));};exports[_0xbc42('0x59')]=function(_0x5d3741,_0x124e3f){return db[_0xbc42('0x31')][_0xbc42('0x59')]()[_0xbc42('0x29')](respondWithResult(_0x124e3f,null))['catch'](handleError(_0x124e3f,null));};exports['getMembers']=function(_0x58568e,_0x4b3a82,_0x4c72de){var _0x2e9120={'raw':!![],'where':{}},_0x2382d1={},_0x2b3d10;return db[_0xbc42('0x31')][_0xbc42('0x5a')]({'where':{'id':_0x58568e[_0xbc42('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4b3a82,null))['then'](function(_0x58e95b){if(_0x58e95b){_0x2b3d10=_0x58e95b[_0xbc42('0x2a')]({'plain':!![]});_0x2382d1[_0xbc42('0x36')]=_[_0xbc42('0x37')](db[_0xbc42('0x5b')][_0xbc42('0x32')]);_0x2382d1[_0xbc42('0x38')]=_[_0xbc42('0x37')](_0x58568e['query']);_0x2382d1[_0xbc42('0x42')]=_[_0xbc42('0x39')](_0x2382d1[_0xbc42('0x36')],_0x2382d1[_0xbc42('0x38')]);_0x2e9120[_0xbc42('0x3a')]=_[_0xbc42('0x39')](_0x2382d1[_0xbc42('0x36')],qs['fields'](_0x58568e[_0xbc42('0x38')]['fields']));_0x2e9120['attributes']=_0x2e9120[_0xbc42('0x3a')]['length']?_0x2e9120[_0xbc42('0x3a')]:_0x2382d1['model'];if(!_0x58568e[_0xbc42('0x38')]['hasOwnProperty']('nolimit')){_0x2e9120[_0xbc42('0x3e')]=qs[_0xbc42('0x3e')](_0x58568e[_0xbc42('0x38')][_0xbc42('0x3e')]);_0x2e9120[_0xbc42('0x23')]=qs[_0xbc42('0x23')](_0x58568e[_0xbc42('0x38')][_0xbc42('0x23')]);}_0x2e9120[_0xbc42('0x3f')]=qs[_0xbc42('0x40')](_0x58568e['query'][_0xbc42('0x40')]);_0x2e9120[_0xbc42('0x41')]=qs[_0xbc42('0x42')](_[_0xbc42('0x43')](_0x58568e[_0xbc42('0x38')],_0x2382d1[_0xbc42('0x42')]));_0x2e9120[_0xbc42('0x41')][_0xbc42('0x5c')]=_0x58e95b['id'];if(_0x58568e[_0xbc42('0x38')][_0xbc42('0x44')]){_0x2e9120[_0xbc42('0x41')]=_[_0xbc42('0x45')](_0x2e9120['where'],{'$or':_['map'](_0x2e9120['attributes'],function(_0x1806db){var _0x22f6ee={};_0x22f6ee[_0x1806db]={'$like':'%'+_0x58568e[_0xbc42('0x38')][_0xbc42('0x44')]+'%'};return _0x22f6ee;})});}_0x2e9120=_[_0xbc42('0x45')]({},_0x2e9120,_0x58568e[_0xbc42('0x47')]);return db[_0xbc42('0x5b')][_0xbc42('0x4a')](_0x2e9120);}})[_0xbc42('0x29')](function(_0x3c7b02){if(_0x3c7b02){return db[_0xbc42('0x5d')][_0xbc42('0x5e')]({'where':{'id':_[_0xbc42('0x30')](_0x3c7b02,'UserId'),'role':_0xbc42('0x5f')},'attributes':['id',_0xbc42('0x2e'),'openchannelPause',_0xbc42('0x60'),'createdAt']});}})[_0xbc42('0x29')](function(_0x2cf1bd){if(_0x2cf1bd){return{'count':_0x2cf1bd[_0xbc42('0x22')],'rows':_[_0xbc42('0x30')](_0x2cf1bd[_0xbc42('0x4b')],function(_0x2d2f1d){return{'membername':_0x2d2f1d[_0xbc42('0x2e')],'UserId':_0x2d2f1d['id'],'queue_name':_0x2b3d10[_0xbc42('0x2e')],'OpenchannelQueueId':_0x2b3d10['id'],'interface':util[_0xbc42('0x61')](_0xbc42('0x62'),_0xbc42('0x63'),_0x2d2f1d[_0xbc42('0x2e')]),'penalty':0x0,'paused':_0x2d2f1d[_0xbc42('0x64')],'createdAt':_0x2d2f1d[_0xbc42('0x65')],'updatedAt':_0x2d2f1d[_0xbc42('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbc42('0x29')](respondWithFilteredResult(_0x4b3a82,_0x2e9120))['catch'](handleError(_0x4b3a82,null));};exports[_0xbc42('0x66')]=function(_0x517936,_0x39df2c,_0x30e4de){var _0x46e04f={};var _0x27a8d8={};var _0x28103f;var _0xda8468;return db[_0xbc42('0x31')][_0xbc42('0x5a')]({'where':{'id':_0x517936[_0xbc42('0x4e')]['id']}})[_0xbc42('0x29')](handleEntityNotFound(_0x39df2c,null))[_0xbc42('0x29')](function(_0x153d66){if(_0x153d66){_0x28103f=_0x153d66;_0x27a8d8[_0xbc42('0x36')]=_[_0xbc42('0x37')](db[_0xbc42('0x67')][_0xbc42('0x32')]);_0x27a8d8['query']=_['keys'](_0x517936[_0xbc42('0x38')]);_0x27a8d8[_0xbc42('0x42')]=_['intersection'](_0x27a8d8[_0xbc42('0x36')],_0x27a8d8[_0xbc42('0x38')]);_0x46e04f['attributes']=_[_0xbc42('0x39')](_0x27a8d8[_0xbc42('0x36')],qs[_0xbc42('0x3b')](_0x517936[_0xbc42('0x38')][_0xbc42('0x3b')]));_0x46e04f[_0xbc42('0x3a')]=_0x46e04f['attributes']['length']?_0x46e04f[_0xbc42('0x3a')]:_0x27a8d8[_0xbc42('0x36')];_0x46e04f[_0xbc42('0x3f')]=qs[_0xbc42('0x40')](_0x517936[_0xbc42('0x38')][_0xbc42('0x40')]);_0x46e04f[_0xbc42('0x41')]=qs['filters'](_[_0xbc42('0x43')](_0x517936[_0xbc42('0x38')],_0x27a8d8[_0xbc42('0x42')]));if(_0x517936[_0xbc42('0x38')]['filter']){_0x46e04f[_0xbc42('0x41')]=_[_0xbc42('0x45')](_0x46e04f[_0xbc42('0x41')],{'$or':_[_0xbc42('0x30')](_0x46e04f[_0xbc42('0x3a')],function(_0x3cfc82){var _0x26e1d2={};_0x26e1d2[_0x3cfc82]={'$like':'%'+_0x517936[_0xbc42('0x38')]['filter']+'%'};return _0x26e1d2;})});}_0x46e04f=_[_0xbc42('0x45')]({},_0x46e04f,_0x517936[_0xbc42('0x47')]);return _0x28103f[_0xbc42('0x66')](_0x46e04f);}})[_0xbc42('0x29')](function(_0x1ba97a){if(_0x1ba97a){_0xda8468=_0x1ba97a[_0xbc42('0x3c')];if(!_0x517936['query'][_0xbc42('0x3d')]('nolimit')){_0x46e04f[_0xbc42('0x3e')]=qs[_0xbc42('0x3e')](_0x517936[_0xbc42('0x38')]['limit']);_0x46e04f['offset']=qs['offset'](_0x517936[_0xbc42('0x38')]['offset']);}return _0x28103f['getTeams'](_0x46e04f);}})[_0xbc42('0x29')](function(_0x2ac10d){if(_0x2ac10d){return _0x2ac10d?{'count':_0xda8468,'rows':_0x2ac10d}:null;}})[_0xbc42('0x29')](respondWithResult(_0x39df2c,null))[_0xbc42('0x4c')](handleError(_0x39df2c,null));};exports[_0xbc42('0x68')]=function(_0x250f82,_0x1a4f6f,_0xe1f38e){var _0x56734d=_0x250f82['body'][_0xbc42('0x69')];return db['Team'][_0xbc42('0x4a')]({'where':{'id':_0x56734d},'attributes':['id'],'include':[{'model':db[_0xbc42('0x5d')],'as':'Agents','attributes':['id',_0xbc42('0x2e'),_0xbc42('0x6a'),_0xbc42('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x511adc){if(_0x511adc){var _0x161d34=_[_0xbc42('0x6c')](_0x511adc,function(_0x1b5c3b){var _0x35d359=_0x1b5c3b[_0xbc42('0x2a')]({'plain':!![]});return _0x35d359[_0xbc42('0x6d')];});return db[_0xbc42('0x31')][_0xbc42('0x4f')]({'where':{'id':_0x250f82[_0xbc42('0x4e')]['id']}})['then'](function(_0x3f1172){return db[_0xbc42('0x6e')][_0xbc42('0x6f')](function(_0x507edd){return _0x3f1172[_0xbc42('0x68')](_0x56734d,{'transaction':_0x507edd})[_0xbc42('0x29')](function(){return BPromise[_0xbc42('0x70')](_0x161d34,function(_0x4d0200){return db['UserOpenchannelQueue'][_0xbc42('0x71')]({'where':{'UserId':_0x4d0200['id'],'OpenchannelQueueId':_0x250f82[_0xbc42('0x4e')]['id']},'transaction':_0x507edd});});})['then'](function(){_0x161d34[_0xbc42('0x72')](function(_0x3a26a1){socket[_0xbc42('0x73')](_0xbc42('0x74'),{'UserId':_0x3a26a1['id'],'OpenchannelQueueId':_0x3f1172['id']});});});});});}})[_0xbc42('0x29')](respondWithStatusCode(_0x1a4f6f,null))[_0xbc42('0x4c')](handleError(_0x1a4f6f,null));};exports[_0xbc42('0x75')]=function(_0x32f483,_0x188124,_0x518c10){return db['Team'][_0xbc42('0x4a')]({'where':{'id':_0x32f483[_0xbc42('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xbc42('0x5d')],'as':_0xbc42('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xbc42('0x29')](handleEntityNotFound(_0x188124,null))[_0xbc42('0x29')](function(_0x43efb9){var _0x3edd1c=_[_0xbc42('0x30')](_0x43efb9,'id');var _0x3df087=[];var _0x2d9545=[];var _0x3c4e75=squel[_0xbc42('0x76')]();_0x3c4e75[_0xbc42('0x77')](_0xbc42('0x78'))[_0xbc42('0x79')](_0xbc42('0x7a'),'tq')[_0xbc42('0x7b')]('user_has_teams','ut',_0xbc42('0x7c'))[_0xbc42('0x41')](_0xbc42('0x7d'),_0x32f483[_0xbc42('0x4e')]['id']);for(var _0x4b1df1=0x0;_0x4b1df1<_0x43efb9[_0xbc42('0x3c')];_0x4b1df1+=0x1){let _0x21a772=_0x43efb9[_0x4b1df1];for(var _0x5ea65d=0x0;_0x5ea65d<_0x21a772[_0xbc42('0x6d')][_0xbc42('0x3c')];_0x5ea65d+=0x1){let _0xfd0c9d=_0x21a772[_0xbc42('0x6d')][_0x5ea65d];var _0x3c4514=_0x3c4e75[_0xbc42('0x7e')]();_0x3c4514[_0xbc42('0x41')](_0xbc42('0x7f'),_0xfd0c9d['id']);_0x2d9545[_0xbc42('0x80')](db[_0xbc42('0x6e')]['query'](_0x3c4514[_0xbc42('0x81')](),{'type':db['sequelize'][_0xbc42('0x82')]['SELECT']})[_0xbc42('0x29')](function(_0x4819d6){if(_0x4819d6['length']===0x1){return _0xfd0c9d['id'];}else{var _0x5adece=_[_0xbc42('0x83')](_[_0xbc42('0x30')](_0x4819d6,_0xbc42('0x84')),function(_0x1a71e9){return _[_0xbc42('0x85')](_0x3edd1c,_0x1a71e9);});if(_0x5adece){return _0xfd0c9d['id'];}}}));}}return BPromise[_0xbc42('0x86')](_0x2d9545)[_0xbc42('0x29')](function(_0x5c6b45){_0x3df087=_(_0x3df087)['union'](_0x5c6b45)[_0xbc42('0x87')]()['value']();return db[_0xbc42('0x31')][_0xbc42('0x4f')]({'where':{'id':_0x32f483[_0xbc42('0x4e')]['id']}})[_0xbc42('0x29')](function(_0x30a1ce){return db['sequelize'][_0xbc42('0x6f')](function(_0x2f096c){return _0x30a1ce[_0xbc42('0x75')](_0x32f483['query'][_0xbc42('0x69')],{'transaction':_0x2f096c})[_0xbc42('0x29')](function(){if(!_[_0xbc42('0x88')](_0x3df087)){return _0x30a1ce[_0xbc42('0x89')](_0x3df087,{'transaction':_0x2f096c});}})[_0xbc42('0x29')](function(){_0x3df087[_0xbc42('0x72')](function(_0x4dd0c7){socket[_0xbc42('0x73')]('userOpenchannelQueue:remove',{'UserId':_0x4dd0c7,'OpenchannelQueueId':_0x30a1ce['id']});});});});});});})[_0xbc42('0x29')](respondWithStatusCode(_0x188124,null))[_0xbc42('0x4c')](handleError(_0x188124,null));};exports['addAgents']=function(_0x851cf0,_0x202f6e,_0x2a41ba){return db['OpenchannelQueue']['find']({'where':{'id':_0x851cf0[_0xbc42('0x4e')]['id']}})[_0xbc42('0x29')](handleEntityNotFound(_0x202f6e,null))[_0xbc42('0x29')](function(_0x281677){if(_0x281677){return _0x281677[_0xbc42('0x8a')](_0x851cf0['body'][_0xbc42('0x69')],_[_0xbc42('0x8b')](_0x851cf0[_0xbc42('0x51')],['ids','id'])||{})[_0xbc42('0x8c')](function(_0x3e4dd3){for(var _0x54eb3a=0x0;_0x54eb3a<_0x851cf0['body'][_0xbc42('0x69')]['length'];_0x54eb3a+=0x1){socket[_0xbc42('0x73')](_0xbc42('0x74'),{'UserId':_0x851cf0[_0xbc42('0x51')][_0xbc42('0x69')][_0x54eb3a],'OpenchannelQueueId':_0x851cf0['params']['id']});}return _0x3e4dd3;});}})[_0xbc42('0x29')](respondWithResult(_0x202f6e,null))[_0xbc42('0x4c')](handleError(_0x202f6e,null));};exports[_0xbc42('0x89')]=function(_0x1167b9,_0x2f3134,_0x4e9893){return db[_0xbc42('0x31')][_0xbc42('0x4f')]({'where':{'id':_0x1167b9[_0xbc42('0x4e')]['id']}})[_0xbc42('0x29')](handleEntityNotFound(_0x2f3134,null))['then'](function(_0x2f3601){if(_0x2f3601){return _0x2f3601[_0xbc42('0x89')](_0x1167b9[_0xbc42('0x38')]['ids'])[_0xbc42('0x29')](function(){if(_[_0xbc42('0x8d')](_0x1167b9['query'][_0xbc42('0x69')])){for(var _0x4e5b04=0x0;_0x4e5b04<_0x1167b9['query'][_0xbc42('0x69')][_0xbc42('0x3c')];_0x4e5b04+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x1167b9['query'][_0xbc42('0x69')][_0x4e5b04]),'OpenchannelQueueId':Number(_0x1167b9['params']['id'])});}}else{socket[_0xbc42('0x73')](_0xbc42('0x8e'),{'UserId':Number(_0x1167b9['query'][_0xbc42('0x69')]),'OpenchannelQueueId':Number(_0x1167b9[_0xbc42('0x4e')]['id'])});}});}})[_0xbc42('0x29')](respondWithStatusCode(_0x2f3134,null))[_0xbc42('0x4c')](handleError(_0x2f3134,null));};exports['getAgents']=function(_0x56b685,_0x1e6222,_0x40eca9){var _0x57d7d0={};var _0x55eee1={};var _0x1cb8c9;var _0x31d60b;return db[_0xbc42('0x31')][_0xbc42('0x5a')]({'where':{'id':_0x56b685[_0xbc42('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e6222,null))[_0xbc42('0x29')](function(_0xba4d89){if(_0xba4d89){_0x1cb8c9=_0xba4d89;_0x55eee1['model']=_[_0xbc42('0x37')](db['User'][_0xbc42('0x32')]);_0x55eee1[_0xbc42('0x38')]=_[_0xbc42('0x37')](_0x56b685['query']);_0x55eee1[_0xbc42('0x42')]=_[_0xbc42('0x39')](_0x55eee1[_0xbc42('0x36')],_0x55eee1['query']);_0x57d7d0[_0xbc42('0x3a')]=_[_0xbc42('0x39')](_0x55eee1['model'],qs[_0xbc42('0x3b')](_0x56b685[_0xbc42('0x38')]['fields']));_0x57d7d0[_0xbc42('0x3a')]=_0x57d7d0['attributes'][_0xbc42('0x3c')]?_0x57d7d0[_0xbc42('0x3a')]:_0x55eee1[_0xbc42('0x36')];_0x57d7d0[_0xbc42('0x3f')]=qs[_0xbc42('0x40')](_0x56b685[_0xbc42('0x38')][_0xbc42('0x40')]);_0x57d7d0['where']=qs[_0xbc42('0x42')](_['pick'](_0x56b685['query'],_0x55eee1[_0xbc42('0x42')]));if(_0x56b685['query'][_0xbc42('0x44')]){_0x57d7d0[_0xbc42('0x41')]=_['merge'](_0x57d7d0[_0xbc42('0x41')],{'$or':_[_0xbc42('0x30')](_0x57d7d0['attributes'],function(_0x5ceeb9){var _0x4bb76c={};_0x4bb76c[_0x5ceeb9]={'$like':'%'+_0x56b685[_0xbc42('0x38')]['filter']+'%'};return _0x4bb76c;})});}_0x57d7d0=_[_0xbc42('0x45')]({},_0x57d7d0,_0x56b685[_0xbc42('0x47')]);return _0x1cb8c9[_0xbc42('0x8f')](_0x57d7d0);}})['then'](function(_0x663415){if(_0x663415){_0x31d60b=_0x663415[_0xbc42('0x3c')];if(!_0x56b685[_0xbc42('0x38')]['hasOwnProperty']('nolimit')){_0x57d7d0[_0xbc42('0x3e')]=qs[_0xbc42('0x3e')](_0x56b685[_0xbc42('0x38')][_0xbc42('0x3e')]);_0x57d7d0[_0xbc42('0x23')]=qs['offset'](_0x56b685['query'][_0xbc42('0x23')]);}return _0x1cb8c9[_0xbc42('0x8f')](_0x57d7d0);}})[_0xbc42('0x29')](function(_0x5e8301){if(_0x5e8301){return _0x5e8301?{'count':_0x31d60b,'rows':_0x5e8301}:null;}})[_0xbc42('0x29')](respondWithResult(_0x1e6222,null))[_0xbc42('0x4c')](handleError(_0x1e6222,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b6b4e53..50e61ba 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 _0x3001=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x3001,0x109));var _0x1300=function(_0x30e6fe,_0x262639){_0x30e6fe=_0x30e6fe-0x0;var _0x4c5073=_0x3001[_0x30e6fe];return _0x4c5073;};'use strict';var EventEmitter=require(_0x1300('0x0'));var OpenchannelQueue=require(_0x1300('0x1'))['db'][_0x1300('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1300('0x3'),'afterUpdate':_0x1300('0x4'),'afterDestroy':_0x1300('0x5')};function emitEvent(_0x54a424){return function(_0x3e6e0f,_0x531c48,_0x1ba590){OpenchannelQueueEvents[_0x1300('0x6')](_0x54a424+':'+_0x3e6e0f['id'],_0x3e6e0f);OpenchannelQueueEvents[_0x1300('0x6')](_0x54a424,_0x3e6e0f);_0x1ba590(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x1300('0x7')](e,emitEvent(event));}}module[_0x1300('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x56ad=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x522660,_0xde54e3){var _0x591298=function(_0x32d7c3){while(--_0x32d7c3){_0x522660['push'](_0x522660['shift']());}};_0x591298(++_0xde54e3);}(_0x56ad,0x1bf));var _0xd56a=function(_0x3b0366,_0x43eb03){_0x3b0366=_0x3b0366-0x0;var _0x1ffb37=_0x56ad[_0x3b0366];return _0x1ffb37;};'use strict';var EventEmitter=require(_0xd56a('0x0'));var OpenchannelQueue=require(_0xd56a('0x1'))['db'][_0xd56a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd56a('0x3')](0x0);var events={'afterCreate':_0xd56a('0x4'),'afterUpdate':_0xd56a('0x5'),'afterDestroy':_0xd56a('0x6')};function emitEvent(_0x53efa8){return function(_0x2269a4,_0xc772c2,_0x111042){OpenchannelQueueEvents['emit'](_0x53efa8+':'+_0x2269a4['id'],_0x2269a4);OpenchannelQueueEvents[_0xd56a('0x7')](_0x53efa8,_0x2269a4);_0x111042(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd56a('0x8')](e,emitEvent(event));}}module[_0xd56a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index fe4b79c..b9d3a7e 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 _0x29e0=['rimraf','../../config/environment','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2d8eb1,_0x2250c6){var _0xb42a8e=function(_0x2dd0ec){while(--_0x2dd0ec){_0x2d8eb1['push'](_0x2d8eb1['shift']());}};_0xb42a8e(++_0x2250c6);}(_0x29e0,0x1bd));var _0x029e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x029e('0x0'));var logger=require(_0x029e('0x1'))(_0x029e('0x2'));var moment=require(_0x029e('0x3'));var BPromise=require(_0x029e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x029e('0x5'));var rimraf=require(_0x029e('0x6'));var config=require(_0x029e('0x7'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x3865ee,_0x387757){return _0x3865ee[_0x029e('0x8')](_0x029e('0x9'),attributes,{'tableName':_0x029e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe2e=['request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird'];(function(_0x1af6b9,_0xb293ec){var _0x53aec1=function(_0x3a06eb){while(--_0x3a06eb){_0x1af6b9['push'](_0x1af6b9['shift']());}};_0x53aec1(++_0xb293ec);}(_0xbe2e,0xaf));var _0xebe2=function(_0x181c5f,_0x15de8b){_0x181c5f=_0x181c5f-0x0;var _0x1214b9=_0xbe2e[_0x181c5f];return _0x1214b9;};'use strict';var _=require(_0xebe2('0x0'));var util=require(_0xebe2('0x1'));var logger=require('../../config/logger')(_0xebe2('0x2'));var moment=require(_0xebe2('0x3'));var BPromise=require(_0xebe2('0x4'));var rp=require(_0xebe2('0x5'));var fs=require('fs');var path=require(_0xebe2('0x6'));var rimraf=require(_0xebe2('0x7'));var config=require(_0xebe2('0x8'));var attributes=require(_0xebe2('0x9'));module['exports']=function(_0x2a3ace,_0x2e037e){return _0x2a3ace['define'](_0xebe2('0xa'),attributes,{'tableName':_0xebe2('0xb'),'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 d58dfdf..4bd39d2 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 _0xab13=['rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowOpenchannelQueue','find','lodash','util','moment','../../mysqldb','../../config/utils'];(function(_0x1919de,_0x4ed1ba){var _0x16ecd9=function(_0x48a062){while(--_0x48a062){_0x1919de['push'](_0x1919de['shift']());}};_0x16ecd9(++_0x4ed1ba);}(_0xab13,0x1e9));var _0x3ab1=function(_0x202962,_0x4baf03){_0x202962=_0x202962-0x0;var _0x4896a0=_0xab13[_0x202962];return _0x4896a0;};'use strict';var _=require(_0x3ab1('0x0'));var util=require(_0x3ab1('0x1'));var moment=require(_0x3ab1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ab1('0x3'))['db'];var utils=require(_0x3ab1('0x4'));var logger=require('../../config/logger')(_0x3ab1('0x5'));var config=require(_0x3ab1('0x6'));var jayson=require(_0x3ab1('0x7'));var client=jayson['client'][_0x3ab1('0x8')]({'port':0x232a});config[_0x3ab1('0x9')]=_[_0x3ab1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ab1('0xb'))(new Redis(config[_0x3ab1('0x9')]));require('./openchannelQueue.socket')[_0x3ab1('0xc')](socket);function respondWithRpcPromise(_0x2e1612,_0x1bd029,_0x2bf4cd){return new BPromise(function(_0x19c9ec,_0x1b488b){return client['request'](_0x2e1612,_0x2bf4cd)[_0x3ab1('0xd')](function(_0x4205c2){logger['info'](_0x3ab1('0xe'),_0x1bd029,_0x3ab1('0xf'));logger[_0x3ab1('0x10')](_0x3ab1('0x11'),_0x1bd029,_0x3ab1('0xf'),JSON[_0x3ab1('0x12')](_0x4205c2));if(_0x4205c2[_0x3ab1('0x13')]){if(_0x4205c2[_0x3ab1('0x13')][_0x3ab1('0x14')]===0x1f4){logger[_0x3ab1('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x1bd029,_0x4205c2['error']['message']);return _0x1b488b(_0x4205c2['error'][_0x3ab1('0x15')]);}logger[_0x3ab1('0x13')](_0x3ab1('0xe'),_0x1bd029,_0x4205c2[_0x3ab1('0x13')][_0x3ab1('0x15')]);return _0x19c9ec(_0x4205c2['error'][_0x3ab1('0x15')]);}else{logger[_0x3ab1('0x16')](_0x3ab1('0xe'),_0x1bd029,'request\x20sent');_0x19c9ec(_0x4205c2[_0x3ab1('0x17')][_0x3ab1('0x15')]);}})[_0x3ab1('0x18')](function(_0x34321d){logger[_0x3ab1('0x13')](_0x3ab1('0xe'),_0x1bd029,_0x34321d);_0x1b488b(_0x34321d);});});}exports[_0x3ab1('0x19')]=function(_0x276d9e){var _0x1c3be8=this;return new Promise(function(_0xabdfcc,_0x529ba1){return db[_0x3ab1('0x1a')][_0x3ab1('0x1b')]({'raw':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1d')]===undefined?!![]:![]:!![],'where':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1e')]||null:null,'attributes':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x1f')]||null:null,'limit':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e['options'][_0x3ab1('0x20')]||null:null,'include':_0x276d9e[_0x3ab1('0x1c')]?_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x21')]?_['map'](_0x276d9e[_0x3ab1('0x1c')][_0x3ab1('0x21')],function(_0x22ee22){return{'model':db[_0x22ee22[_0x3ab1('0x22')]],'as':_0x22ee22['as'],'attributes':_0x22ee22[_0x3ab1('0x1f')],'include':_0x22ee22[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x22ee22[_0x3ab1('0x21')],function(_0x486545){return{'model':db[_0x486545['model']],'as':_0x486545['as'],'attributes':_0x486545[_0x3ab1('0x1f')],'include':_0x486545[_0x3ab1('0x21')]?_['map'](_0x486545[_0x3ab1('0x21')],function(_0x1646b0){return{'model':db[_0x1646b0[_0x3ab1('0x22')]],'as':_0x1646b0['as'],'attributes':_0x1646b0[_0x3ab1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112db5){logger['info'](_0x3ab1('0x19'),_0x276d9e);logger[_0x3ab1('0x10')](_0x3ab1('0x19'),_0x276d9e,JSON[_0x3ab1('0x12')](_0x112db5));_0xabdfcc(_0x112db5);})[_0x3ab1('0x18')](function(_0xd41321){logger[_0x3ab1('0x13')](_0x3ab1('0x19'),_0xd41321['message'],_0x276d9e);_0x529ba1(_0x1c3be8['error'](0x1f4,_0xd41321[_0x3ab1('0x15')]));});});};exports[_0x3ab1('0x24')]=function(_0x245bb3){var _0x38235b=this;return new Promise(function(_0xf78b9c,_0x543736){return db['OpenchannelQueue'][_0x3ab1('0x25')]({'raw':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x1d')]===undefined?!![]:![]:!![],'where':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')]['where']||null:null,'attributes':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3['options'][_0x3ab1('0x1f')]||null:null,'include':_0x245bb3[_0x3ab1('0x1c')]?_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x245bb3[_0x3ab1('0x1c')][_0x3ab1('0x21')],function(_0x208cf2){return{'model':db[_0x208cf2[_0x3ab1('0x22')]],'as':_0x208cf2['as'],'attributes':_0x208cf2[_0x3ab1('0x1f')],'include':_0x208cf2[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x208cf2[_0x3ab1('0x21')],function(_0x50d300){return{'model':db[_0x50d300['model']],'as':_0x50d300['as'],'attributes':_0x50d300[_0x3ab1('0x1f')],'include':_0x50d300[_0x3ab1('0x21')]?_[_0x3ab1('0x23')](_0x50d300['include'],function(_0x14ca4f){return{'model':db[_0x14ca4f[_0x3ab1('0x22')]],'as':_0x14ca4f['as'],'attributes':_0x14ca4f[_0x3ab1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x483938){logger['info'](_0x3ab1('0x24'),_0x245bb3);logger[_0x3ab1('0x10')](_0x3ab1('0x24'),_0x245bb3,JSON[_0x3ab1('0x12')](_0x483938));_0xf78b9c(_0x483938);})[_0x3ab1('0x18')](function(_0x276b77){logger[_0x3ab1('0x13')](_0x3ab1('0x24'),_0x276b77['message'],_0x245bb3);_0x543736(_0x38235b['error'](0x1f4,_0x276b77[_0x3ab1('0x15')]));});});}; \ No newline at end of file +var _0x8add=['GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','ShowOpenchannelQueue','where','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5b4148,_0x21517){var _0x2e72bf=function(_0x50f5aa){while(--_0x50f5aa){_0x5b4148['push'](_0x5b4148['shift']());}};_0x2e72bf(++_0x21517);}(_0x8add,0x174));var _0xd8ad=function(_0x4fd10d,_0x39822c){_0x4fd10d=_0x4fd10d-0x0;var _0x41f935=_0x8add[_0x4fd10d];return _0x41f935;};'use strict';var _=require('lodash');var util=require(_0xd8ad('0x0'));var moment=require(_0xd8ad('0x1'));var BPromise=require(_0xd8ad('0x2'));var rs=require(_0xd8ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd8ad('0x4'));var logger=require(_0xd8ad('0x5'))('rpc');var config=require(_0xd8ad('0x6'));var jayson=require(_0xd8ad('0x7'));var client=jayson[_0xd8ad('0x8')][_0xd8ad('0x9')]({'port':0x232a});config['redis']=_[_0xd8ad('0xa')](config[_0xd8ad('0xb')],{'host':_0xd8ad('0xc'),'port':0x18eb});var socket=require(_0xd8ad('0xd'))(new Redis(config['redis']));require(_0xd8ad('0xe'))[_0xd8ad('0xf')](socket);function respondWithRpcPromise(_0x38f115,_0x2b82c1,_0x951f18){return new BPromise(function(_0xc1bed0,_0x15df5c){return client[_0xd8ad('0x10')](_0x38f115,_0x951f18)[_0xd8ad('0x11')](function(_0x5b5483){logger[_0xd8ad('0x12')](_0xd8ad('0x13'),_0x2b82c1,_0xd8ad('0x14'));logger[_0xd8ad('0x15')](_0xd8ad('0x16'),_0x2b82c1,'request\x20sent',JSON[_0xd8ad('0x17')](_0x5b5483));if(_0x5b5483[_0xd8ad('0x18')]){if(_0x5b5483[_0xd8ad('0x18')][_0xd8ad('0x19')]===0x1f4){logger[_0xd8ad('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b82c1,_0x5b5483[_0xd8ad('0x18')]['message']);return _0x15df5c(_0x5b5483[_0xd8ad('0x18')]['message']);}logger[_0xd8ad('0x18')](_0xd8ad('0x13'),_0x2b82c1,_0x5b5483[_0xd8ad('0x18')][_0xd8ad('0x1a')]);return _0xc1bed0(_0x5b5483[_0xd8ad('0x18')][_0xd8ad('0x1a')]);}else{logger[_0xd8ad('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x2b82c1,_0xd8ad('0x14'));_0xc1bed0(_0x5b5483['result']['message']);}})[_0xd8ad('0x1b')](function(_0xa70c3f){logger[_0xd8ad('0x18')](_0xd8ad('0x13'),_0x2b82c1,_0xa70c3f);_0x15df5c(_0xa70c3f);});});}exports[_0xd8ad('0x1c')]=function(_0x477394){var _0xea29e4=this;return new Promise(function(_0x5b2905,_0x46bc72){return db[_0xd8ad('0x1d')][_0xd8ad('0x1e')]({'raw':_0x477394[_0xd8ad('0x1f')]?_0x477394[_0xd8ad('0x1f')][_0xd8ad('0x20')]===undefined?!![]:![]:!![],'where':_0x477394[_0xd8ad('0x1f')]?_0x477394[_0xd8ad('0x1f')]['where']||null:null,'attributes':_0x477394['options']?_0x477394[_0xd8ad('0x1f')][_0xd8ad('0x21')]||null:null,'limit':_0x477394[_0xd8ad('0x1f')]?_0x477394[_0xd8ad('0x1f')][_0xd8ad('0x22')]||null:null,'include':_0x477394[_0xd8ad('0x1f')]?_0x477394['options'][_0xd8ad('0x23')]?_[_0xd8ad('0x24')](_0x477394['options'][_0xd8ad('0x23')],function(_0xd64253){return{'model':db[_0xd64253[_0xd8ad('0x25')]],'as':_0xd64253['as'],'attributes':_0xd64253['attributes'],'include':_0xd64253[_0xd8ad('0x23')]?_[_0xd8ad('0x24')](_0xd64253[_0xd8ad('0x23')],function(_0x9410ac){return{'model':db[_0x9410ac['model']],'as':_0x9410ac['as'],'attributes':_0x9410ac[_0xd8ad('0x21')],'include':_0x9410ac[_0xd8ad('0x23')]?_['map'](_0x9410ac['include'],function(_0x149875){return{'model':db[_0x149875[_0xd8ad('0x25')]],'as':_0x149875['as'],'attributes':_0x149875[_0xd8ad('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd8ad('0x11')](function(_0x270f96){logger[_0xd8ad('0x12')]('GetOpenchannelQueue',_0x477394);logger[_0xd8ad('0x15')](_0xd8ad('0x1c'),_0x477394,JSON[_0xd8ad('0x17')](_0x270f96));_0x5b2905(_0x270f96);})[_0xd8ad('0x1b')](function(_0xa16260){logger['error'](_0xd8ad('0x1c'),_0xa16260['message'],_0x477394);_0x46bc72(_0xea29e4['error'](0x1f4,_0xa16260[_0xd8ad('0x1a')]));});});};exports[_0xd8ad('0x26')]=function(_0x30db4f){var _0x27e0fc=this;return new Promise(function(_0x3ae797,_0x27b306){return db[_0xd8ad('0x1d')]['find']({'raw':_0x30db4f[_0xd8ad('0x1f')]?_0x30db4f[_0xd8ad('0x1f')][_0xd8ad('0x20')]===undefined?!![]:![]:!![],'where':_0x30db4f[_0xd8ad('0x1f')]?_0x30db4f[_0xd8ad('0x1f')][_0xd8ad('0x27')]||null:null,'attributes':_0x30db4f['options']?_0x30db4f[_0xd8ad('0x1f')]['attributes']||null:null,'include':_0x30db4f[_0xd8ad('0x1f')]?_0x30db4f['options'][_0xd8ad('0x23')]?_[_0xd8ad('0x24')](_0x30db4f['options'][_0xd8ad('0x23')],function(_0xd583cc){return{'model':db[_0xd583cc[_0xd8ad('0x25')]],'as':_0xd583cc['as'],'attributes':_0xd583cc[_0xd8ad('0x21')],'include':_0xd583cc['include']?_[_0xd8ad('0x24')](_0xd583cc['include'],function(_0xfac48){return{'model':db[_0xfac48['model']],'as':_0xfac48['as'],'attributes':_0xfac48[_0xd8ad('0x21')],'include':_0xfac48[_0xd8ad('0x23')]?_[_0xd8ad('0x24')](_0xfac48[_0xd8ad('0x23')],function(_0x1e22a9){return{'model':db[_0x1e22a9[_0xd8ad('0x25')]],'as':_0x1e22a9['as'],'attributes':_0x1e22a9[_0xd8ad('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd8ad('0x11')](function(_0x32a541){logger[_0xd8ad('0x12')](_0xd8ad('0x26'),_0x30db4f);logger[_0xd8ad('0x15')](_0xd8ad('0x26'),_0x30db4f,JSON[_0xd8ad('0x17')](_0x32a541));_0x3ae797(_0x32a541);})['catch'](function(_0x168e74){logger['error'](_0xd8ad('0x26'),_0x168e74[_0xd8ad('0x1a')],_0x30db4f);_0x27b306(_0x27e0fc[_0xd8ad('0x18')](0x1f4,_0x168e74['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0cb4b6d..c7d55a8 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 _0x00b2=['remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x210a37,_0x28235c){var _0x3d29e1=function(_0x8e0ab){while(--_0x8e0ab){_0x210a37['push'](_0x210a37['shift']());}};_0x3d29e1(++_0x28235c);}(_0x00b2,0x102));var _0x200b=function(_0x193280,_0x54ec6d){_0x193280=_0x193280-0x0;var _0xc5ed9c=_0x00b2[_0x193280];return _0xc5ed9c;};'use strict';var OpenchannelQueueEvents=require(_0x200b('0x0'));var events=['save',_0x200b('0x1'),_0x200b('0x2')];function createListener(_0x4858e0,_0x2c7632){return function(_0x41892b){_0x2c7632[_0x200b('0x3')](_0x4858e0,_0x41892b);};}function removeListener(_0x166c61,_0xe7056e){return function(){OpenchannelQueueEvents[_0x200b('0x4')](_0x166c61,_0xe7056e);};}exports['register']=function(_0x39a34b){for(var _0x5121f2=0x0,_0x414bba=events[_0x200b('0x5')];_0x5121f2<_0x414bba;_0x5121f2++){var _0x3301c9=events[_0x5121f2];var _0x48f5dc=createListener(_0x200b('0x6')+_0x3301c9,_0x39a34b);OpenchannelQueueEvents['on'](_0x3301c9,_0x48f5dc);}}; \ No newline at end of file +var _0x7060=['save','remove','removeListener','register','length','./openchannelQueue.events'];(function(_0x5c9b9e,_0x51b7d3){var _0x53fdd9=function(_0x4fe611){while(--_0x4fe611){_0x5c9b9e['push'](_0x5c9b9e['shift']());}};_0x53fdd9(++_0x51b7d3);}(_0x7060,0x1e5));var _0x0706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7060[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x0706('0x0'));var events=[_0x0706('0x1'),_0x0706('0x2'),'update'];function createListener(_0x2e3f77,_0x2e8c30){return function(_0x42481b){_0x2e8c30['emit'](_0x2e3f77,_0x42481b);};}function removeListener(_0x236a27,_0x3ba04e){return function(){OpenchannelQueueEvents[_0x0706('0x3')](_0x236a27,_0x3ba04e);};}exports[_0x0706('0x4')]=function(_0x2d7ed5){for(var _0x6afe3c=0x0,_0x326a6a=events[_0x0706('0x5')];_0x6afe3c<_0x326a6a;_0x6afe3c++){var _0x2bc1e1=events[_0x6afe3c];var _0x244169=createListener('openchannelQueue:'+_0x2bc1e1,_0x2d7ed5);OpenchannelQueueEvents['on'](_0x2bc1e1,_0x244169);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f4e40cb..bcc2098 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 _0x3dc8=['update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0x3dc8,0x17a));var _0x83dc=function(_0x22f2de,_0x2d7b40){_0x22f2de=_0x22f2de-0x0;var _0x163ecd=_0x3dc8[_0x22f2de];return _0x163ecd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x83dc('0x0'));var express=require('express');var router=express[_0x83dc('0x1')]();var auth=require(_0x83dc('0x2'));var interaction=require(_0x83dc('0x3'));var config=require(_0x83dc('0x4'));var controller=require('./openchannelQueueReport.controller');router[_0x83dc('0x5')]('/',auth[_0x83dc('0x6')](),controller['index']);router[_0x83dc('0x5')]('/describe',auth[_0x83dc('0x6')](),controller[_0x83dc('0x7')]);router[_0x83dc('0x5')]('/:id',auth[_0x83dc('0x6')](),controller[_0x83dc('0x8')]);router[_0x83dc('0x9')]('/',auth[_0x83dc('0x6')](),controller[_0x83dc('0xa')]);router[_0x83dc('0xb')](_0x83dc('0xc'),auth['isAuthenticated'](),controller[_0x83dc('0xd')]);router[_0x83dc('0xe')](_0x83dc('0xc'),auth[_0x83dc('0x6')](),controller[_0x83dc('0xf')]);module[_0x83dc('0x10')]=router; \ No newline at end of file +var _0xacaf=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','show','post','put','/:id','destroy','multer','util','path'];(function(_0x35c557,_0x42c856){var _0x3f6021=function(_0x5e7528){while(--_0x5e7528){_0x35c557['push'](_0x35c557['shift']());}};_0x3f6021(++_0x42c856);}(_0xacaf,0xfc));var _0xfaca=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xacaf[_0x3b5ad9];return _0x611ae9;};'use strict';var multer=require(_0xfaca('0x0'));var util=require(_0xfaca('0x1'));var path=require(_0xfaca('0x2'));var timeout=require(_0xfaca('0x3'));var express=require('express');var router=express[_0xfaca('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfaca('0x5'));var config=require(_0xfaca('0x6'));var controller=require(_0xfaca('0x7'));router[_0xfaca('0x8')]('/',auth['isAuthenticated'](),controller[_0xfaca('0x9')]);router[_0xfaca('0x8')](_0xfaca('0xa'),auth[_0xfaca('0xb')](),controller['describe']);router['get']('/:id',auth[_0xfaca('0xb')](),controller[_0xfaca('0xc')]);router[_0xfaca('0xd')]('/',auth[_0xfaca('0xb')](),controller['create']);router[_0xfaca('0xe')](_0xfaca('0xf'),auth[_0xfaca('0xb')](),controller['update']);router['delete'](_0xfaca('0xf'),auth[_0xfaca('0xb')](),controller[_0xfaca('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5502762..17222cb 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 _0x023f=['sequelize','exports','STRING','DATE'];(function(_0x504527,_0x1b9d01){var _0x4a1670=function(_0x1ce434){while(--_0x1ce434){_0x504527['push'](_0x504527['shift']());}};_0x4a1670(++_0x1b9d01);}(_0x023f,0x1a8));var _0xf023=function(_0x3ecf80,_0x453257){_0x3ecf80=_0x3ecf80-0x0;var _0x2794b2=_0x023f[_0x3ecf80];return _0x2794b2;};'use strict';var moment=require('moment');var Sequelize=require(_0xf023('0x0'));module[_0xf023('0x1')]={'uniqueid':{'type':Sequelize[_0xf023('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf023('0x2')]},'joinAt':{'type':Sequelize[_0xf023('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf023('0x3')]},'exitAt':{'type':Sequelize[_0xf023('0x3')]},'reason':{'type':Sequelize[_0xf023('0x2')]}}; \ No newline at end of file +var _0x611a=['exports','STRING','DATE','moment','sequelize'];(function(_0x567331,_0x51bd1e){var _0x4a6565=function(_0x5c79f4){while(--_0x5c79f4){_0x567331['push'](_0x567331['shift']());}};_0x4a6565(++_0x51bd1e);}(_0x611a,0x6c));var _0xa611=function(_0x2480f9,_0xa7bec7){_0x2480f9=_0x2480f9-0x0;var _0x1f240a=_0x611a[_0x2480f9];return _0x1f240a;};'use strict';var moment=require(_0xa611('0x0'));var Sequelize=require(_0xa611('0x1'));module[_0xa611('0x2')]={'uniqueid':{'type':Sequelize[_0xa611('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa611('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa611('0x4')]},'acceptAt':{'type':Sequelize[_0xa611('0x4')]},'exitAt':{'type':Sequelize[_0xa611('0x4')]},'reason':{'type':Sequelize[_0xa611('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 577a6d2..9b146cf 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 _0x3e65=['nolimit','offset','order','sort','where','pick','merge','VIRTUAL','name','filter','count','include','findAll','catch','show','options','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','set','apply','update','then','destroy','sendStatus','error','stack','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x2b0d88,_0x5b5ef2){var _0x1c9256=function(_0x1ea041){while(--_0x1ea041){_0x2b0d88['push'](_0x2b0d88['shift']());}};_0x1c9256(++_0x5b5ef2);}(_0x3e65,0xde));var _0x53e6=function(_0x38ce0f,_0x4ea115){_0x38ce0f=_0x38ce0f-0x0;var _0x33859b=_0x3e65[_0x38ce0f];return _0x33859b;};'use strict';var pdf=require(_0x53e6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53e6('0x1'));var zipdir=require(_0x53e6('0x2'));var jsonpatch=require(_0x53e6('0x3'));var rp=require('request-promise');var moment=require(_0x53e6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53e6('0x5'));var util=require('util');var path=require(_0x53e6('0x6'));var sox=require(_0x53e6('0x7'));var csv=require(_0x53e6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x53e6('0x9'));var crypto=require(_0x53e6('0xa'));var jsforce=require(_0x53e6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53e6('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x53e6('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53e6('0xe'))(_0x53e6('0xf'));var utils=require(_0x53e6('0x10'));var config=require(_0x53e6('0x11'));var db=require(_0x53e6('0x12'))['db'];function respondWithStatusCode(_0x8b76ef,_0x274a66){_0x274a66=_0x274a66||0xcc;return function(_0x44487a){if(_0x44487a){return _0x8b76ef['sendStatus'](_0x274a66);}return _0x8b76ef[_0x53e6('0x13')](_0x274a66)['end']();};}function respondWithResult(_0x29e996,_0xf248aa){_0xf248aa=_0xf248aa||0xc8;return function(_0x2a3dcd){if(_0x2a3dcd){return _0x29e996[_0x53e6('0x13')](_0xf248aa)[_0x53e6('0x14')](_0x2a3dcd);}};}function respondWithFilteredResult(_0x2542e4,_0x357858){return function(_0x1a8622){if(_0x1a8622){var _0x2597a3=_0x1a8622['count'],_0xc94505=_0x357858['offset'],_0x2bc97c=_0x357858['offset']+_0x357858[_0x53e6('0x15')],_0x1c6c05;if(_0x2bc97c>=_0x2597a3){_0x2bc97c=_0x2597a3;_0x1c6c05=0xc8;}else{_0x1c6c05=0xce;}_0x2542e4['status'](_0x1c6c05);return _0x2542e4[_0x53e6('0x16')]('Content-Range',_0xc94505+'-'+_0x2bc97c+'/'+_0x2597a3)[_0x53e6('0x14')](_0x1a8622);}return null;};}function patchUpdates(_0x573ba7){return function(_0xcc92aa){try{jsonpatch[_0x53e6('0x17')](_0xcc92aa,_0x573ba7,!![]);}catch(_0x468d9a){return BPromise['reject'](_0x468d9a);}return _0xcc92aa['save']();};}function saveUpdates(_0x265d7f,_0x231544){return function(_0xf41c8e){if(_0xf41c8e){return _0xf41c8e[_0x53e6('0x18')](_0x265d7f)[_0x53e6('0x19')](function(_0x4df04c){return _0x4df04c;});}return null;};}function removeEntity(_0x3d7158,_0x6d2c71){return function(_0x348b87){if(_0x348b87){return _0x348b87[_0x53e6('0x1a')]()[_0x53e6('0x19')](function(){_0x3d7158[_0x53e6('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57611e,_0x3bb713){return function(_0x2bcd7f){if(!_0x2bcd7f){_0x57611e[_0x53e6('0x1b')](0x194);}return _0x2bcd7f;};}function handleError(_0x4fdf7c,_0x102232){_0x102232=_0x102232||0x1f4;return function(_0x4b777a){logger[_0x53e6('0x1c')](_0x4b777a[_0x53e6('0x1d')]);if(_0x4b777a['name']){delete _0x4b777a['name'];}_0x4fdf7c['status'](_0x102232)[_0x53e6('0x1e')](_0x4b777a);};}exports[_0x53e6('0x1f')]=function(_0x428e27,_0x2817df){var _0x12339d={},_0x3a8f17={},_0x68e42c={'count':0x0,'rows':[]};var _0x5b77b7=_[_0x53e6('0x20')](db[_0x53e6('0x21')][_0x53e6('0x22')],function(_0x4cc941){return{'name':_0x4cc941['fieldName'],'type':_0x4cc941[_0x53e6('0x23')][_0x53e6('0x24')]};});_0x3a8f17[_0x53e6('0x25')]=_['map'](_0x5b77b7,'name');_0x3a8f17['query']=_[_0x53e6('0x26')](_0x428e27['query']);_0x3a8f17[_0x53e6('0x27')]=_[_0x53e6('0x28')](_0x3a8f17[_0x53e6('0x25')],_0x3a8f17[_0x53e6('0x29')]);_0x12339d[_0x53e6('0x2a')]=_['intersection'](_0x3a8f17[_0x53e6('0x25')],qs[_0x53e6('0x2b')](_0x428e27['query'][_0x53e6('0x2b')]));_0x12339d['attributes']=_0x12339d[_0x53e6('0x2a')][_0x53e6('0x2c')]?_0x12339d['attributes']:_0x3a8f17[_0x53e6('0x25')];if(!_0x428e27[_0x53e6('0x29')][_0x53e6('0x2d')](_0x53e6('0x2e'))){_0x12339d[_0x53e6('0x15')]=qs[_0x53e6('0x15')](_0x428e27[_0x53e6('0x29')][_0x53e6('0x15')]);_0x12339d[_0x53e6('0x2f')]=qs[_0x53e6('0x2f')](_0x428e27['query']['offset']);}_0x12339d[_0x53e6('0x30')]=qs[_0x53e6('0x31')](_0x428e27[_0x53e6('0x29')]['sort']);_0x12339d[_0x53e6('0x32')]=qs[_0x53e6('0x27')](_[_0x53e6('0x33')](_0x428e27['query'],_0x3a8f17[_0x53e6('0x27')]),_0x5b77b7);if(_0x428e27[_0x53e6('0x29')]['filter']){_0x12339d['where']=_[_0x53e6('0x34')](_0x12339d[_0x53e6('0x32')],{'$or':_[_0x53e6('0x20')](_0x5b77b7,function(_0x15bb63){if(_0x15bb63[_0x53e6('0x23')]!==_0x53e6('0x35')){var _0x1f62c2={};_0x1f62c2[_0x15bb63[_0x53e6('0x36')]]={'$like':'%'+_0x428e27[_0x53e6('0x29')][_0x53e6('0x37')]+'%'};return _0x1f62c2;}})});}_0x12339d=_[_0x53e6('0x34')]({},_0x12339d,_0x428e27['options']);var _0x5b0d3b={'where':_0x12339d[_0x53e6('0x32')]};return db[_0x53e6('0x21')][_0x53e6('0x38')](_0x5b0d3b)['then'](function(_0x7b093c){_0x68e42c[_0x53e6('0x38')]=_0x7b093c;if(_0x428e27[_0x53e6('0x29')]['includeAll']){_0x12339d[_0x53e6('0x39')]=[{'all':!![]}];}return db[_0x53e6('0x21')][_0x53e6('0x3a')](_0x12339d);})[_0x53e6('0x19')](function(_0x2d6e56){_0x68e42c['rows']=_0x2d6e56;return _0x68e42c;})[_0x53e6('0x19')](respondWithFilteredResult(_0x2817df,_0x12339d))[_0x53e6('0x3b')](handleError(_0x2817df,null));};exports[_0x53e6('0x3c')]=function(_0x20a128,_0x21cc04){var _0x275450={'raw':!![],'where':{'id':_0x20a128['params']['id']}},_0xe1192b={};_0xe1192b[_0x53e6('0x25')]=_[_0x53e6('0x26')](db[_0x53e6('0x21')]['rawAttributes']);_0xe1192b[_0x53e6('0x29')]=_[_0x53e6('0x26')](_0x20a128[_0x53e6('0x29')]);_0xe1192b[_0x53e6('0x27')]=_[_0x53e6('0x28')](_0xe1192b[_0x53e6('0x25')],_0xe1192b[_0x53e6('0x29')]);_0x275450[_0x53e6('0x2a')]=_[_0x53e6('0x28')](_0xe1192b['model'],qs[_0x53e6('0x2b')](_0x20a128[_0x53e6('0x29')]['fields']));_0x275450[_0x53e6('0x2a')]=_0x275450[_0x53e6('0x2a')]['length']?_0x275450[_0x53e6('0x2a')]:_0xe1192b[_0x53e6('0x25')];if(_0x20a128['query']['includeAll']){_0x275450[_0x53e6('0x39')]=[{'all':!![]}];}_0x275450=_[_0x53e6('0x34')]({},_0x275450,_0x20a128[_0x53e6('0x3d')]);return db[_0x53e6('0x21')][_0x53e6('0x3e')](_0x275450)[_0x53e6('0x19')](handleEntityNotFound(_0x21cc04,null))[_0x53e6('0x19')](respondWithResult(_0x21cc04,null))[_0x53e6('0x3b')](handleError(_0x21cc04,null));};exports[_0x53e6('0x3f')]=function(_0x50d54e,_0x21f83d){return db['OpenchannelQueueReport']['create'](_0x50d54e[_0x53e6('0x40')],{})[_0x53e6('0x19')](respondWithResult(_0x21f83d,0xc9))[_0x53e6('0x3b')](handleError(_0x21f83d,null));};exports[_0x53e6('0x18')]=function(_0x27d76c,_0x247cb5){if(_0x27d76c[_0x53e6('0x40')]['id']){delete _0x27d76c[_0x53e6('0x40')]['id'];}return db[_0x53e6('0x21')][_0x53e6('0x3e')]({'where':{'id':_0x27d76c[_0x53e6('0x41')]['id']}})[_0x53e6('0x19')](handleEntityNotFound(_0x247cb5,null))[_0x53e6('0x19')](saveUpdates(_0x27d76c[_0x53e6('0x40')],null))[_0x53e6('0x19')](respondWithResult(_0x247cb5,null))[_0x53e6('0x3b')](handleError(_0x247cb5,null));};exports[_0x53e6('0x1a')]=function(_0x313ddc,_0x3f9864){return db[_0x53e6('0x21')]['find']({'where':{'id':_0x313ddc[_0x53e6('0x41')]['id']}})[_0x53e6('0x19')](handleEntityNotFound(_0x3f9864,null))['then'](removeEntity(_0x3f9864,null))[_0x53e6('0x3b')](handleError(_0x3f9864,null));};exports[_0x53e6('0x42')]=function(_0x49e279,_0x431df5){return db[_0x53e6('0x21')][_0x53e6('0x42')]()[_0x53e6('0x19')](respondWithResult(_0x431df5,null))[_0x53e6('0x3b')](handleError(_0x431df5,null));}; \ No newline at end of file +var _0x4c71=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','OpenchannelQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','html-pdf'];(function(_0x3be881,_0x3e5edf){var _0x4a0a0e=function(_0x5903fd){while(--_0x5903fd){_0x3be881['push'](_0x3be881['shift']());}};_0x4a0a0e(++_0x3e5edf);}(_0x4c71,0x185));var _0x14c7=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4c71[_0x5f1391];return _0x50ebe3;};'use strict';var pdf=require(_0x14c7('0x0'));var emlformat=require(_0x14c7('0x1'));var rimraf=require(_0x14c7('0x2'));var zipdir=require(_0x14c7('0x3'));var jsonpatch=require(_0x14c7('0x4'));var rp=require('request-promise');var moment=require(_0x14c7('0x5'));var BPromise=require(_0x14c7('0x6'));var Mustache=require(_0x14c7('0x7'));var util=require(_0x14c7('0x8'));var path=require(_0x14c7('0x9'));var sox=require(_0x14c7('0xa'));var csv=require(_0x14c7('0xb'));var ejs=require(_0x14c7('0xc'));var fs=require('fs');var _=require(_0x14c7('0xd'));var squel=require(_0x14c7('0xe'));var crypto=require(_0x14c7('0xf'));var jsforce=require(_0x14c7('0x10'));var deskjs=require(_0x14c7('0x11'));var toCsv=require(_0x14c7('0xb'));var querystring=require('querystring');var Papa=require(_0x14c7('0x12'));var Redis=require(_0x14c7('0x13'));var authService=require(_0x14c7('0x14'));var qs=require(_0x14c7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x14c7('0x16'))(_0x14c7('0x17'));var utils=require(_0x14c7('0x18'));var config=require(_0x14c7('0x19'));var db=require(_0x14c7('0x1a'))['db'];function respondWithStatusCode(_0x37c4e6,_0x4d4aaa){_0x4d4aaa=_0x4d4aaa||0xcc;return function(_0x4c23d5){if(_0x4c23d5){return _0x37c4e6[_0x14c7('0x1b')](_0x4d4aaa);}return _0x37c4e6['status'](_0x4d4aaa)[_0x14c7('0x1c')]();};}function respondWithResult(_0x64a5d1,_0x412910){_0x412910=_0x412910||0xc8;return function(_0x18761a){if(_0x18761a){return _0x64a5d1[_0x14c7('0x1d')](_0x412910)['json'](_0x18761a);}};}function respondWithFilteredResult(_0x1f36ea,_0x4c5700){return function(_0x24d4bb){if(_0x24d4bb){var _0x20373f=_0x24d4bb[_0x14c7('0x1e')],_0x5e7807=_0x4c5700['offset'],_0x2873c3=_0x4c5700[_0x14c7('0x1f')]+_0x4c5700['limit'],_0x46223f;if(_0x2873c3>=_0x20373f){_0x2873c3=_0x20373f;_0x46223f=0xc8;}else{_0x46223f=0xce;}_0x1f36ea[_0x14c7('0x1d')](_0x46223f);return _0x1f36ea[_0x14c7('0x20')](_0x14c7('0x21'),_0x5e7807+'-'+_0x2873c3+'/'+_0x20373f)[_0x14c7('0x22')](_0x24d4bb);}return null;};}function patchUpdates(_0x41b62a){return function(_0x179f19){try{jsonpatch[_0x14c7('0x23')](_0x179f19,_0x41b62a,!![]);}catch(_0x13c4c4){return BPromise[_0x14c7('0x24')](_0x13c4c4);}return _0x179f19[_0x14c7('0x25')]();};}function saveUpdates(_0x822b6,_0x27cd9){return function(_0x4e1af7){if(_0x4e1af7){return _0x4e1af7[_0x14c7('0x26')](_0x822b6)['then'](function(_0x26a579){return _0x26a579;});}return null;};}function removeEntity(_0x99f90d,_0x47d513){return function(_0x266fab){if(_0x266fab){return _0x266fab[_0x14c7('0x27')]()[_0x14c7('0x28')](function(){_0x99f90d['status'](0xcc)[_0x14c7('0x1c')]();});}};}function handleEntityNotFound(_0x3f8d14,_0x55371c){return function(_0x2ad6a2){if(!_0x2ad6a2){_0x3f8d14['sendStatus'](0x194);}return _0x2ad6a2;};}function handleError(_0x4870f8,_0x3a9d40){_0x3a9d40=_0x3a9d40||0x1f4;return function(_0x153a0a){logger[_0x14c7('0x29')](_0x153a0a[_0x14c7('0x2a')]);if(_0x153a0a[_0x14c7('0x2b')]){delete _0x153a0a[_0x14c7('0x2b')];}_0x4870f8[_0x14c7('0x1d')](_0x3a9d40)[_0x14c7('0x2c')](_0x153a0a);};}exports['index']=function(_0x77c028,_0x6186d2){var _0x1465e0={},_0x298819={},_0x24553e={'count':0x0,'rows':[]};var _0x1a423b=_['map'](db[_0x14c7('0x2d')]['rawAttributes'],function(_0x383519){return{'name':_0x383519[_0x14c7('0x2e')],'type':_0x383519['type'][_0x14c7('0x2f')]};});_0x298819['model']=_[_0x14c7('0x30')](_0x1a423b,'name');_0x298819[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x77c028[_0x14c7('0x31')]);_0x298819[_0x14c7('0x33')]=_[_0x14c7('0x34')](_0x298819[_0x14c7('0x35')],_0x298819[_0x14c7('0x31')]);_0x1465e0[_0x14c7('0x36')]=_[_0x14c7('0x34')](_0x298819[_0x14c7('0x35')],qs[_0x14c7('0x37')](_0x77c028[_0x14c7('0x31')][_0x14c7('0x37')]));_0x1465e0[_0x14c7('0x36')]=_0x1465e0[_0x14c7('0x36')][_0x14c7('0x38')]?_0x1465e0['attributes']:_0x298819[_0x14c7('0x35')];if(!_0x77c028['query'][_0x14c7('0x39')]('nolimit')){_0x1465e0[_0x14c7('0x3a')]=qs[_0x14c7('0x3a')](_0x77c028['query'][_0x14c7('0x3a')]);_0x1465e0[_0x14c7('0x1f')]=qs[_0x14c7('0x1f')](_0x77c028[_0x14c7('0x31')]['offset']);}_0x1465e0['order']=qs['sort'](_0x77c028[_0x14c7('0x31')]['sort']);_0x1465e0[_0x14c7('0x3b')]=qs['filters'](_[_0x14c7('0x3c')](_0x77c028[_0x14c7('0x31')],_0x298819[_0x14c7('0x33')]),_0x1a423b);if(_0x77c028['query'][_0x14c7('0x3d')]){_0x1465e0[_0x14c7('0x3b')]=_[_0x14c7('0x3e')](_0x1465e0[_0x14c7('0x3b')],{'$or':_[_0x14c7('0x30')](_0x1a423b,function(_0x50f256){if(_0x50f256[_0x14c7('0x3f')]!==_0x14c7('0x40')){var _0x62dcd1={};_0x62dcd1[_0x50f256[_0x14c7('0x2b')]]={'$like':'%'+_0x77c028[_0x14c7('0x31')][_0x14c7('0x3d')]+'%'};return _0x62dcd1;}})});}_0x1465e0=_[_0x14c7('0x3e')]({},_0x1465e0,_0x77c028[_0x14c7('0x41')]);var _0x4964bd={'where':_0x1465e0[_0x14c7('0x3b')]};return db['OpenchannelQueueReport'][_0x14c7('0x1e')](_0x4964bd)[_0x14c7('0x28')](function(_0x23f529){_0x24553e[_0x14c7('0x1e')]=_0x23f529;if(_0x77c028['query'][_0x14c7('0x42')]){_0x1465e0[_0x14c7('0x43')]=[{'all':!![]}];}return db[_0x14c7('0x2d')][_0x14c7('0x44')](_0x1465e0);})[_0x14c7('0x28')](function(_0xb2d82e){_0x24553e[_0x14c7('0x45')]=_0xb2d82e;return _0x24553e;})[_0x14c7('0x28')](respondWithFilteredResult(_0x6186d2,_0x1465e0))['catch'](handleError(_0x6186d2,null));};exports[_0x14c7('0x46')]=function(_0x3e147d,_0x2711f2){var _0x51ae7e={'raw':!![],'where':{'id':_0x3e147d[_0x14c7('0x47')]['id']}},_0x1f0b1d={};_0x1f0b1d[_0x14c7('0x35')]=_[_0x14c7('0x32')](db[_0x14c7('0x2d')][_0x14c7('0x48')]);_0x1f0b1d[_0x14c7('0x31')]=_[_0x14c7('0x32')](_0x3e147d[_0x14c7('0x31')]);_0x1f0b1d[_0x14c7('0x33')]=_[_0x14c7('0x34')](_0x1f0b1d[_0x14c7('0x35')],_0x1f0b1d[_0x14c7('0x31')]);_0x51ae7e['attributes']=_[_0x14c7('0x34')](_0x1f0b1d['model'],qs['fields'](_0x3e147d['query'][_0x14c7('0x37')]));_0x51ae7e[_0x14c7('0x36')]=_0x51ae7e['attributes'][_0x14c7('0x38')]?_0x51ae7e[_0x14c7('0x36')]:_0x1f0b1d[_0x14c7('0x35')];if(_0x3e147d[_0x14c7('0x31')][_0x14c7('0x42')]){_0x51ae7e[_0x14c7('0x43')]=[{'all':!![]}];}_0x51ae7e=_[_0x14c7('0x3e')]({},_0x51ae7e,_0x3e147d[_0x14c7('0x41')]);return db[_0x14c7('0x2d')][_0x14c7('0x49')](_0x51ae7e)[_0x14c7('0x28')](handleEntityNotFound(_0x2711f2,null))[_0x14c7('0x28')](respondWithResult(_0x2711f2,null))[_0x14c7('0x4a')](handleError(_0x2711f2,null));};exports[_0x14c7('0x4b')]=function(_0x437e05,_0x2f827d){return db[_0x14c7('0x2d')][_0x14c7('0x4b')](_0x437e05[_0x14c7('0x4c')],{})[_0x14c7('0x28')](respondWithResult(_0x2f827d,0xc9))[_0x14c7('0x4a')](handleError(_0x2f827d,null));};exports[_0x14c7('0x26')]=function(_0xa97250,_0x31bf66){if(_0xa97250[_0x14c7('0x4c')]['id']){delete _0xa97250[_0x14c7('0x4c')]['id'];}return db['OpenchannelQueueReport'][_0x14c7('0x49')]({'where':{'id':_0xa97250[_0x14c7('0x47')]['id']}})[_0x14c7('0x28')](handleEntityNotFound(_0x31bf66,null))[_0x14c7('0x28')](saveUpdates(_0xa97250[_0x14c7('0x4c')],null))[_0x14c7('0x28')](respondWithResult(_0x31bf66,null))[_0x14c7('0x4a')](handleError(_0x31bf66,null));};exports['destroy']=function(_0x331749,_0x4344ff){return db['OpenchannelQueueReport'][_0x14c7('0x49')]({'where':{'id':_0x331749['params']['id']}})[_0x14c7('0x28')](handleEntityNotFound(_0x4344ff,null))[_0x14c7('0x28')](removeEntity(_0x4344ff,null))[_0x14c7('0x4a')](handleError(_0x4344ff,null));};exports[_0x14c7('0x4d')]=function(_0x119d41,_0x555c74){return db[_0x14c7('0x2d')][_0x14c7('0x4d')]()[_0x14c7('0x28')](respondWithResult(_0x555c74,null))[_0x14c7('0x4a')](handleError(_0x555c74,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 0f00ad5..0b465da 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 _0x753b=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x753b,0x190));var _0xb753=function(_0x362046,_0x5cf93f){_0x362046=_0x362046-0x0;var _0x419ffe=_0x753b[_0x362046];return _0x419ffe;};'use strict';var _=require(_0xb753('0x0'));var util=require(_0xb753('0x1'));var logger=require(_0xb753('0x2'))('api');var moment=require(_0xb753('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb753('0x4'));var rimraf=require(_0xb753('0x5'));var config=require(_0xb753('0x6'));var attributes=require(_0xb753('0x7'));module['exports']=function(_0x216fe9,_0x4ef1c1){return _0x216fe9[_0xb753('0x8')](_0xb753('0x9'),attributes,{'tableName':_0xb753('0xa'),'paranoid':![],'indexes':[{'name':_0xb753('0xb'),'fields':[_0xb753('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3253=['./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x3253,0xc9));var _0x3325=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x3253[_0x273dc5];return _0x46dae7;};'use strict';var _=require('lodash');var util=require(_0x3325('0x0'));var logger=require(_0x3325('0x1'))(_0x3325('0x2'));var moment=require(_0x3325('0x3'));var BPromise=require(_0x3325('0x4'));var rp=require(_0x3325('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3325('0x6'));var config=require('../../config/environment');var attributes=require(_0x3325('0x7'));module[_0x3325('0x8')]=function(_0x3dac15,_0x1d84b4){return _0x3dac15[_0x3325('0x9')](_0x3325('0xa'),attributes,{'tableName':_0x3325('0xb'),'paranoid':![],'indexes':[{'name':_0x3325('0xc'),'fields':[_0x3325('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6e8e62f..bccf069 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 _0xe3da=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','then','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['CreateOpenchannelQueueReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xae3d('0x1c')](function(_0x48f00e){logger[_0xae3d('0xe')](_0xae3d('0x1d'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x1d'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x48f00e));_0x558e42(_0x48f00e);})[_0xae3d('0x1e')](function(_0x26c419){logger[_0xae3d('0x14')](_0xae3d('0x1d'),_0x26c419[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x26c419[_0xae3d('0x16')]));});});};exports[_0xae3d('0x1f')]=function(_0x1b2acb){var _0x44a4e0=this;return new Promise(function(_0x1fe90f,_0xfb54f6){return db[_0xae3d('0x18')][_0xae3d('0x20')](_0x1b2acb[_0xae3d('0x1a')],{'raw':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x22')]||null:null,'attributes':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')]['attributes']||null:null,'limit':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x23')]||null:null})[_0xae3d('0x1c')](function(_0x3114f9){logger[_0xae3d('0xe')]('UpdateOpenchannelQueueReport',_0x1b2acb);logger[_0xae3d('0x11')](_0xae3d('0x1f'),_0x1b2acb,JSON['stringify'](_0x3114f9));_0x1fe90f(_0x3114f9);})[_0xae3d('0x1e')](function(_0x323715){logger[_0xae3d('0x14')](_0xae3d('0x1f'),_0x323715[_0xae3d('0x16')],_0x1b2acb);_0xfb54f6(_0x44a4e0[_0xae3d('0x14')](0x1f4,_0x323715['message']));});});}; \ No newline at end of file +var _0x7da6=['message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','limit','then','stringify','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5b302c,_0x31f499){var _0x1277af=function(_0x31cdb6){while(--_0x31cdb6){_0x5b302c['push'](_0x5b302c['shift']());}};_0x1277af(++_0x31f499);}(_0x7da6,0x124));var _0x67da=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7da6[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x67da('0x0'));var BPromise=require(_0x67da('0x1'));var rs=require(_0x67da('0x2'));var fs=require('fs');var Redis=require(_0x67da('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x67da('0x4'));var logger=require(_0x67da('0x5'))(_0x67da('0x6'));var config=require(_0x67da('0x7'));var jayson=require(_0x67da('0x8'));var client=jayson[_0x67da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb7f52,_0x49025f,_0x4cfe49){return new BPromise(function(_0x3d971d,_0x5ac004){return client[_0x67da('0xa')](_0xb7f52,_0x4cfe49)['then'](function(_0x1e8a4c){logger[_0x67da('0xb')](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));logger[_0x67da('0xe')](_0x67da('0xf'),_0x49025f,_0x67da('0xd'),JSON['stringify'](_0x1e8a4c));if(_0x1e8a4c[_0x67da('0x10')]){if(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x11')]===0x1f4){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x5ac004(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0x1e8a4c[_0x67da('0x10')]['message']);return _0x3d971d(_0x1e8a4c[_0x67da('0x10')][_0x67da('0x12')]);}else{logger['info'](_0x67da('0xc'),_0x49025f,_0x67da('0xd'));_0x3d971d(_0x1e8a4c[_0x67da('0x13')][_0x67da('0x12')]);}})[_0x67da('0x14')](function(_0xb3a67){logger[_0x67da('0x10')](_0x67da('0xc'),_0x49025f,_0xb3a67);_0x5ac004(_0xb3a67);});});}exports['CreateOpenchannelQueueReport']=function(_0xaefe69){var _0x524819=this;return new Promise(function(_0x31454f,_0x5765d5){return db[_0x67da('0x15')][_0x67da('0x16')](_0xaefe69[_0x67da('0x17')],{'raw':_0xaefe69[_0x67da('0x18')]?_0xaefe69['options'][_0x67da('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48b1e1){logger[_0x67da('0xb')](_0x67da('0x1a'),_0xaefe69);logger[_0x67da('0xe')](_0x67da('0x1a'),_0xaefe69,JSON['stringify'](_0x48b1e1));_0x31454f(_0x48b1e1);})['catch'](function(_0x56aa6a){logger[_0x67da('0x10')](_0x67da('0x1a'),_0x56aa6a[_0x67da('0x12')],_0xaefe69);_0x5765d5(_0x524819[_0x67da('0x10')](0x1f4,_0x56aa6a[_0x67da('0x12')]));});});};exports[_0x67da('0x1b')]=function(_0x5f1a47){var _0xc2667e=this;return new Promise(function(_0x1e3d8b,_0x535b83){return db[_0x67da('0x15')]['update'](_0x5f1a47[_0x67da('0x17')],{'raw':_0x5f1a47[_0x67da('0x18')]?_0x5f1a47[_0x67da('0x18')][_0x67da('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f1a47[_0x67da('0x18')]?_0x5f1a47[_0x67da('0x18')]['where']||null:null,'attributes':_0x5f1a47[_0x67da('0x18')]?_0x5f1a47[_0x67da('0x18')]['attributes']||null:null,'limit':_0x5f1a47['options']?_0x5f1a47[_0x67da('0x18')][_0x67da('0x1c')]||null:null})[_0x67da('0x1d')](function(_0x42c511){logger['info'](_0x67da('0x1b'),_0x5f1a47);logger[_0x67da('0xe')](_0x67da('0x1b'),_0x5f1a47,JSON[_0x67da('0x1e')](_0x42c511));_0x1e3d8b(_0x42c511);})[_0x67da('0x14')](function(_0x4518d5){logger[_0x67da('0x10')](_0x67da('0x1b'),_0x4518d5[_0x67da('0x12')],_0x5f1a47);_0x535b83(_0xc2667e[_0x67da('0x10')](0x1f4,_0x4518d5[_0x67da('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index ecd97e0..34e0faf 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(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x533110,_0x20937f){var _0xc3c866=function(_0x2d4a68){while(--_0x2d4a68){_0x533110['push'](_0x533110['shift']());}};_0xc3c866(++_0x20937f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 5054f2f..74905c5 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 _0x1389=['account','queue','DATE','NOW','moment','sequelize','exports','ENUM'];(function(_0x5087e5,_0x32fdb4){var _0x3b11f0=function(_0x352cbb){while(--_0x352cbb){_0x5087e5['push'](_0x5087e5['shift']());}};_0x3b11f0(++_0x32fdb4);}(_0x1389,0x7c));var _0x9138=function(_0x51411d,_0x465f95){_0x51411d=_0x51411d-0x0;var _0x68f222=_0x1389[_0x51411d];return _0x68f222;};'use strict';var moment=require(_0x9138('0x0'));var Sequelize=require(_0x9138('0x1'));module[_0x9138('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9138('0x3')](_0x9138('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x9138('0x5')},'transferredAt':{'type':Sequelize[_0x9138('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x9138('0x7')]}}; \ No newline at end of file +var _0x2eb5=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x561049,_0x330926){var _0x52f109=function(_0x1a5d24){while(--_0x1a5d24){_0x561049['push'](_0x561049['shift']());}};_0x52f109(++_0x330926);}(_0x2eb5,0xa3));var _0x52eb=function(_0x37b347,_0x236f29){_0x37b347=_0x37b347-0x0;var _0x4f38d4=_0x2eb5[_0x37b347];return _0x4f38d4;};'use strict';var moment=require(_0x52eb('0x0'));var Sequelize=require(_0x52eb('0x1'));module[_0x52eb('0x2')]={'uniqueid':{'type':Sequelize[_0x52eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x52eb('0x4')](_0x52eb('0x5'),_0x52eb('0x6'),_0x52eb('0x7')),'allowNull':![],'defaultValue':_0x52eb('0x7')},'transferredAt':{'type':Sequelize[_0x52eb('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x52eb('0x9')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 632057b..4e6f87f 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 _0x61db=['status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','stack','name','send','index','OpenchannelTransferReport','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x61db,0xcb));var _0xb61d=function(_0x200ca2,_0x117050){_0x200ca2=_0x200ca2-0x0;var _0x43910b=_0x61db[_0x200ca2];return _0x43910b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb61d('0x0'));var rimraf=require(_0xb61d('0x1'));var zipdir=require(_0xb61d('0x2'));var jsonpatch=require(_0xb61d('0x3'));var rp=require(_0xb61d('0x4'));var moment=require(_0xb61d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb61d('0x6'));var util=require(_0xb61d('0x7'));var path=require(_0xb61d('0x8'));var sox=require(_0xb61d('0x9'));var csv=require(_0xb61d('0xa'));var ejs=require(_0xb61d('0xb'));var fs=require('fs');var _=require(_0xb61d('0xc'));var squel=require(_0xb61d('0xd'));var crypto=require(_0xb61d('0xe'));var jsforce=require(_0xb61d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb61d('0xa'));var querystring=require(_0xb61d('0x10'));var Papa=require(_0xb61d('0x11'));var Redis=require(_0xb61d('0x12'));var authService=require(_0xb61d('0x13'));var qs=require(_0xb61d('0x14'));var as=require(_0xb61d('0x15'));var hardwareService=require(_0xb61d('0x16'));var logger=require(_0xb61d('0x17'))(_0xb61d('0x18'));var utils=require(_0xb61d('0x19'));var config=require(_0xb61d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294bad,_0x5d5d37){_0x5d5d37=_0x5d5d37||0xcc;return function(_0x57b71a){if(_0x57b71a){return _0x294bad[_0xb61d('0x1b')](_0x5d5d37);}return _0x294bad[_0xb61d('0x1c')](_0x5d5d37)[_0xb61d('0x1d')]();};}function respondWithResult(_0x25afbb,_0x48bfec){_0x48bfec=_0x48bfec||0xc8;return function(_0x43bca7){if(_0x43bca7){return _0x25afbb[_0xb61d('0x1c')](_0x48bfec)[_0xb61d('0x1e')](_0x43bca7);}};}function respondWithFilteredResult(_0x17ab1a,_0x3d171a){return function(_0x274b41){if(_0x274b41){var _0x3d669a=_0x274b41[_0xb61d('0x1f')],_0xf0cedf=_0x3d171a[_0xb61d('0x20')],_0x37cd1f=_0x3d171a['offset']+_0x3d171a[_0xb61d('0x21')],_0x41837e;if(_0x37cd1f>=_0x3d669a){_0x37cd1f=_0x3d669a;_0x41837e=0xc8;}else{_0x41837e=0xce;}_0x17ab1a[_0xb61d('0x1c')](_0x41837e);return _0x17ab1a[_0xb61d('0x22')](_0xb61d('0x23'),_0xf0cedf+'-'+_0x37cd1f+'/'+_0x3d669a)[_0xb61d('0x1e')](_0x274b41);}return null;};}function patchUpdates(_0x484bd4){return function(_0x1ca044){try{jsonpatch['apply'](_0x1ca044,_0x484bd4,!![]);}catch(_0x4f73f9){return BPromise['reject'](_0x4f73f9);}return _0x1ca044[_0xb61d('0x24')]();};}function saveUpdates(_0x537f0e,_0x3c2ea0){return function(_0x5f196b){if(_0x5f196b){return _0x5f196b[_0xb61d('0x25')](_0x537f0e)['then'](function(_0x589d72){return _0x589d72;});}return null;};}function removeEntity(_0x3fcedb,_0x396a5c){return function(_0x2939a2){if(_0x2939a2){return _0x2939a2[_0xb61d('0x26')]()[_0xb61d('0x27')](function(){_0x3fcedb[_0xb61d('0x1c')](0xcc)[_0xb61d('0x1d')]();});}};}function handleEntityNotFound(_0x1d2577,_0x8cb930){return function(_0x3cb1d2){if(!_0x3cb1d2){_0x1d2577[_0xb61d('0x1b')](0x194);}return _0x3cb1d2;};}function handleError(_0xb335a6,_0x1fb41c){_0x1fb41c=_0x1fb41c||0x1f4;return function(_0xede039){logger['error'](_0xede039[_0xb61d('0x28')]);if(_0xede039['name']){delete _0xede039[_0xb61d('0x29')];}_0xb335a6[_0xb61d('0x1c')](_0x1fb41c)[_0xb61d('0x2a')](_0xede039);};}exports[_0xb61d('0x2b')]=function(_0x5953de,_0x16f913){var _0x1d389a={},_0x204c7e={},_0x233c2b={'count':0x0,'rows':[]};var _0x2df2ea=_['map'](db[_0xb61d('0x2c')]['rawAttributes'],function(_0x2eccd6){return{'name':_0x2eccd6[_0xb61d('0x2d')],'type':_0x2eccd6[_0xb61d('0x2e')][_0xb61d('0x2f')]};});_0x204c7e[_0xb61d('0x30')]=_['map'](_0x2df2ea,'name');_0x204c7e['query']=_[_0xb61d('0x31')](_0x5953de['query']);_0x204c7e[_0xb61d('0x32')]=_[_0xb61d('0x33')](_0x204c7e[_0xb61d('0x30')],_0x204c7e['query']);_0x1d389a[_0xb61d('0x34')]=_[_0xb61d('0x33')](_0x204c7e[_0xb61d('0x30')],qs[_0xb61d('0x35')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x35')]));_0x1d389a['attributes']=_0x1d389a['attributes'][_0xb61d('0x37')]?_0x1d389a[_0xb61d('0x34')]:_0x204c7e['model'];if(!_0x5953de[_0xb61d('0x36')][_0xb61d('0x38')](_0xb61d('0x39'))){_0x1d389a[_0xb61d('0x21')]=qs[_0xb61d('0x21')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x21')]);_0x1d389a[_0xb61d('0x20')]=qs[_0xb61d('0x20')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x20')]);}_0x1d389a[_0xb61d('0x3a')]=qs[_0xb61d('0x3b')](_0x5953de[_0xb61d('0x36')][_0xb61d('0x3b')]);_0x1d389a[_0xb61d('0x3c')]=qs['filters'](_[_0xb61d('0x3d')](_0x5953de[_0xb61d('0x36')],_0x204c7e['filters']),_0x2df2ea);if(_0x5953de['query']['filter']){_0x1d389a[_0xb61d('0x3c')]=_[_0xb61d('0x3e')](_0x1d389a[_0xb61d('0x3c')],{'$or':_[_0xb61d('0x3f')](_0x2df2ea,function(_0x591806){if(_0x591806[_0xb61d('0x2e')]!=='VIRTUAL'){var _0x3b9a35={};_0x3b9a35[_0x591806[_0xb61d('0x29')]]={'$like':'%'+_0x5953de[_0xb61d('0x36')]['filter']+'%'};return _0x3b9a35;}})});}_0x1d389a=_[_0xb61d('0x3e')]({},_0x1d389a,_0x5953de['options']);var _0x1a1b98={'where':_0x1d389a[_0xb61d('0x3c')]};return db[_0xb61d('0x2c')][_0xb61d('0x1f')](_0x1a1b98)[_0xb61d('0x27')](function(_0x32cf65){_0x233c2b[_0xb61d('0x1f')]=_0x32cf65;if(_0x5953de[_0xb61d('0x36')][_0xb61d('0x40')]){_0x1d389a['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xb61d('0x41')](_0x1d389a);})[_0xb61d('0x27')](function(_0x267d5d){_0x233c2b[_0xb61d('0x42')]=_0x267d5d;return _0x233c2b;})[_0xb61d('0x27')](respondWithFilteredResult(_0x16f913,_0x1d389a))[_0xb61d('0x43')](handleError(_0x16f913,null));};exports[_0xb61d('0x44')]=function(_0x520478,_0x3aa9bb){var _0x204129={'raw':!![],'where':{'id':_0x520478[_0xb61d('0x45')]['id']}},_0x45313c={};_0x45313c[_0xb61d('0x30')]=_['keys'](db[_0xb61d('0x2c')][_0xb61d('0x46')]);_0x45313c[_0xb61d('0x36')]=_[_0xb61d('0x31')](_0x520478['query']);_0x45313c[_0xb61d('0x32')]=_['intersection'](_0x45313c['model'],_0x45313c[_0xb61d('0x36')]);_0x204129[_0xb61d('0x34')]=_['intersection'](_0x45313c['model'],qs[_0xb61d('0x35')](_0x520478[_0xb61d('0x36')][_0xb61d('0x35')]));_0x204129[_0xb61d('0x34')]=_0x204129['attributes'][_0xb61d('0x37')]?_0x204129['attributes']:_0x45313c[_0xb61d('0x30')];if(_0x520478[_0xb61d('0x36')]['includeAll']){_0x204129[_0xb61d('0x47')]=[{'all':!![]}];}_0x204129=_[_0xb61d('0x3e')]({},_0x204129,_0x520478[_0xb61d('0x48')]);return db[_0xb61d('0x2c')][_0xb61d('0x49')](_0x204129)[_0xb61d('0x27')](handleEntityNotFound(_0x3aa9bb,null))['then'](respondWithResult(_0x3aa9bb,null))[_0xb61d('0x43')](handleError(_0x3aa9bb,null));};exports[_0xb61d('0x4a')]=function(_0x47d65d,_0x301366){return db[_0xb61d('0x2c')][_0xb61d('0x4a')](_0x47d65d[_0xb61d('0x4b')],{})[_0xb61d('0x27')](respondWithResult(_0x301366,0xc9))[_0xb61d('0x43')](handleError(_0x301366,null));};exports['update']=function(_0xa4f5cf,_0x141f5e){if(_0xa4f5cf[_0xb61d('0x4b')]['id']){delete _0xa4f5cf[_0xb61d('0x4b')]['id'];}return db[_0xb61d('0x2c')][_0xb61d('0x49')]({'where':{'id':_0xa4f5cf[_0xb61d('0x45')]['id']}})[_0xb61d('0x27')](handleEntityNotFound(_0x141f5e,null))[_0xb61d('0x27')](saveUpdates(_0xa4f5cf[_0xb61d('0x4b')],null))[_0xb61d('0x27')](respondWithResult(_0x141f5e,null))['catch'](handleError(_0x141f5e,null));};exports['destroy']=function(_0x2b45af,_0x32ed58){return db[_0xb61d('0x2c')][_0xb61d('0x49')]({'where':{'id':_0x2b45af['params']['id']}})['then'](handleEntityNotFound(_0x32ed58,null))[_0xb61d('0x27')](removeEntity(_0x32ed58,null))[_0xb61d('0x43')](handleError(_0x32ed58,null));};exports[_0xb61d('0x4c')]=function(_0x388a57,_0x376239){return db[_0xb61d('0x2c')]['describe']()[_0xb61d('0x27')](respondWithResult(_0x376239,null))[_0xb61d('0x43')](handleError(_0x376239,null));}; \ No newline at end of file +var _0xda67=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','OpenchannelTransferReport','find','catch','create','body','update','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','path','sox','ejs','lodash'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xda67,0x15f));var _0x7da6=function(_0x2eb794,_0x27550f){_0x2eb794=_0x2eb794-0x0;var _0x64e283=_0xda67[_0x2eb794];return _0x64e283;};'use strict';var pdf=require(_0x7da6('0x0'));var emlformat=require(_0x7da6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7da6('0x2'));var rp=require(_0x7da6('0x3'));var moment=require(_0x7da6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7da6('0x5'));var sox=require(_0x7da6('0x6'));var csv=require('to-csv');var ejs=require(_0x7da6('0x7'));var fs=require('fs');var _=require(_0x7da6('0x8'));var squel=require(_0x7da6('0x9'));var crypto=require(_0x7da6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7da6('0xb'));var toCsv=require(_0x7da6('0xc'));var querystring=require(_0x7da6('0xd'));var Papa=require('papaparse');var Redis=require(_0x7da6('0xe'));var authService=require(_0x7da6('0xf'));var qs=require(_0x7da6('0x10'));var as=require(_0x7da6('0x11'));var hardwareService=require(_0x7da6('0x12'));var logger=require(_0x7da6('0x13'))(_0x7da6('0x14'));var utils=require('../../config/utils');var config=require(_0x7da6('0x15'));var db=require(_0x7da6('0x16'))['db'];function respondWithStatusCode(_0x2e2623,_0x3ed91d){_0x3ed91d=_0x3ed91d||0xcc;return function(_0x314102){if(_0x314102){return _0x2e2623[_0x7da6('0x17')](_0x3ed91d);}return _0x2e2623['status'](_0x3ed91d)[_0x7da6('0x18')]();};}function respondWithResult(_0x2d9db5,_0x40f86e){_0x40f86e=_0x40f86e||0xc8;return function(_0x41d8e6){if(_0x41d8e6){return _0x2d9db5['status'](_0x40f86e)[_0x7da6('0x19')](_0x41d8e6);}};}function respondWithFilteredResult(_0xfee4d6,_0x150b14){return function(_0x18c0cc){if(_0x18c0cc){var _0x543b09=_0x18c0cc[_0x7da6('0x1a')],_0x3425f3=_0x150b14['offset'],_0x40ff9f=_0x150b14[_0x7da6('0x1b')]+_0x150b14[_0x7da6('0x1c')],_0x5d9fa2;if(_0x40ff9f>=_0x543b09){_0x40ff9f=_0x543b09;_0x5d9fa2=0xc8;}else{_0x5d9fa2=0xce;}_0xfee4d6[_0x7da6('0x1d')](_0x5d9fa2);return _0xfee4d6[_0x7da6('0x1e')]('Content-Range',_0x3425f3+'-'+_0x40ff9f+'/'+_0x543b09)[_0x7da6('0x19')](_0x18c0cc);}return null;};}function patchUpdates(_0x64656d){return function(_0xf2d040){try{jsonpatch[_0x7da6('0x1f')](_0xf2d040,_0x64656d,!![]);}catch(_0x59337b){return BPromise[_0x7da6('0x20')](_0x59337b);}return _0xf2d040['save']();};}function saveUpdates(_0x4ca6c0,_0x56f7f5){return function(_0x4efa92){if(_0x4efa92){return _0x4efa92['update'](_0x4ca6c0)['then'](function(_0x27d9c4){return _0x27d9c4;});}return null;};}function removeEntity(_0x46e5e9,_0x5629e4){return function(_0x3257dd){if(_0x3257dd){return _0x3257dd['destroy']()[_0x7da6('0x21')](function(){_0x46e5e9[_0x7da6('0x1d')](0xcc)[_0x7da6('0x18')]();});}};}function handleEntityNotFound(_0x45a0f3,_0x53e34e){return function(_0x2d620b){if(!_0x2d620b){_0x45a0f3['sendStatus'](0x194);}return _0x2d620b;};}function handleError(_0x45c2ba,_0x33d828){_0x33d828=_0x33d828||0x1f4;return function(_0x538740){logger['error'](_0x538740['stack']);if(_0x538740[_0x7da6('0x22')]){delete _0x538740[_0x7da6('0x22')];}_0x45c2ba[_0x7da6('0x1d')](_0x33d828)[_0x7da6('0x23')](_0x538740);};}exports[_0x7da6('0x24')]=function(_0x6682d1,_0x45c156){var _0x550b6d={},_0x1a6eed={},_0x29da2f={'count':0x0,'rows':[]};var _0x3b329f=_[_0x7da6('0x25')](db['OpenchannelTransferReport'][_0x7da6('0x26')],function(_0x46c6c6){return{'name':_0x46c6c6[_0x7da6('0x27')],'type':_0x46c6c6[_0x7da6('0x28')][_0x7da6('0x29')]};});_0x1a6eed[_0x7da6('0x2a')]=_[_0x7da6('0x25')](_0x3b329f,_0x7da6('0x22'));_0x1a6eed[_0x7da6('0x2b')]=_[_0x7da6('0x2c')](_0x6682d1[_0x7da6('0x2b')]);_0x1a6eed[_0x7da6('0x2d')]=_[_0x7da6('0x2e')](_0x1a6eed[_0x7da6('0x2a')],_0x1a6eed[_0x7da6('0x2b')]);_0x550b6d[_0x7da6('0x2f')]=_[_0x7da6('0x2e')](_0x1a6eed[_0x7da6('0x2a')],qs[_0x7da6('0x30')](_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x30')]));_0x550b6d[_0x7da6('0x2f')]=_0x550b6d[_0x7da6('0x2f')]['length']?_0x550b6d[_0x7da6('0x2f')]:_0x1a6eed[_0x7da6('0x2a')];if(!_0x6682d1['query']['hasOwnProperty']('nolimit')){_0x550b6d[_0x7da6('0x1c')]=qs[_0x7da6('0x1c')](_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x1c')]);_0x550b6d[_0x7da6('0x1b')]=qs[_0x7da6('0x1b')](_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x1b')]);}_0x550b6d[_0x7da6('0x31')]=qs[_0x7da6('0x32')](_0x6682d1['query']['sort']);_0x550b6d['where']=qs[_0x7da6('0x2d')](_[_0x7da6('0x33')](_0x6682d1['query'],_0x1a6eed[_0x7da6('0x2d')]),_0x3b329f);if(_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x34')]){_0x550b6d[_0x7da6('0x35')]=_[_0x7da6('0x36')](_0x550b6d[_0x7da6('0x35')],{'$or':_[_0x7da6('0x25')](_0x3b329f,function(_0x260a40){if(_0x260a40[_0x7da6('0x28')]!==_0x7da6('0x37')){var _0x4657ce={};_0x4657ce[_0x260a40[_0x7da6('0x22')]]={'$like':'%'+_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x34')]+'%'};return _0x4657ce;}})});}_0x550b6d=_['merge']({},_0x550b6d,_0x6682d1['options']);var _0x266667={'where':_0x550b6d[_0x7da6('0x35')]};return db['OpenchannelTransferReport']['count'](_0x266667)[_0x7da6('0x21')](function(_0x9d1f9e){_0x29da2f[_0x7da6('0x1a')]=_0x9d1f9e;if(_0x6682d1[_0x7da6('0x2b')][_0x7da6('0x38')]){_0x550b6d['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x7da6('0x39')](_0x550b6d);})[_0x7da6('0x21')](function(_0x5eef37){_0x29da2f[_0x7da6('0x3a')]=_0x5eef37;return _0x29da2f;})[_0x7da6('0x21')](respondWithFilteredResult(_0x45c156,_0x550b6d))['catch'](handleError(_0x45c156,null));};exports[_0x7da6('0x3b')]=function(_0x43fb94,_0x523b5a){var _0x5140a4={'raw':!![],'where':{'id':_0x43fb94[_0x7da6('0x3c')]['id']}},_0x324f00={};_0x324f00[_0x7da6('0x2a')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0x324f00['query']=_['keys'](_0x43fb94[_0x7da6('0x2b')]);_0x324f00[_0x7da6('0x2d')]=_[_0x7da6('0x2e')](_0x324f00[_0x7da6('0x2a')],_0x324f00[_0x7da6('0x2b')]);_0x5140a4[_0x7da6('0x2f')]=_['intersection'](_0x324f00[_0x7da6('0x2a')],qs[_0x7da6('0x30')](_0x43fb94[_0x7da6('0x2b')][_0x7da6('0x30')]));_0x5140a4[_0x7da6('0x2f')]=_0x5140a4[_0x7da6('0x2f')][_0x7da6('0x3d')]?_0x5140a4[_0x7da6('0x2f')]:_0x324f00[_0x7da6('0x2a')];if(_0x43fb94[_0x7da6('0x2b')][_0x7da6('0x38')]){_0x5140a4[_0x7da6('0x3e')]=[{'all':!![]}];}_0x5140a4=_['merge']({},_0x5140a4,_0x43fb94[_0x7da6('0x3f')]);return db[_0x7da6('0x40')][_0x7da6('0x41')](_0x5140a4)[_0x7da6('0x21')](handleEntityNotFound(_0x523b5a,null))[_0x7da6('0x21')](respondWithResult(_0x523b5a,null))[_0x7da6('0x42')](handleError(_0x523b5a,null));};exports['create']=function(_0x44a65e,_0x366694){return db[_0x7da6('0x40')][_0x7da6('0x43')](_0x44a65e[_0x7da6('0x44')],{})[_0x7da6('0x21')](respondWithResult(_0x366694,0xc9))[_0x7da6('0x42')](handleError(_0x366694,null));};exports[_0x7da6('0x45')]=function(_0x5b6965,_0x1977ce){if(_0x5b6965[_0x7da6('0x44')]['id']){delete _0x5b6965[_0x7da6('0x44')]['id'];}return db[_0x7da6('0x40')][_0x7da6('0x41')]({'where':{'id':_0x5b6965['params']['id']}})[_0x7da6('0x21')](handleEntityNotFound(_0x1977ce,null))[_0x7da6('0x21')](saveUpdates(_0x5b6965['body'],null))[_0x7da6('0x21')](respondWithResult(_0x1977ce,null))[_0x7da6('0x42')](handleError(_0x1977ce,null));};exports[_0x7da6('0x46')]=function(_0x1ae2fd,_0x5706ac){return db[_0x7da6('0x40')][_0x7da6('0x41')]({'where':{'id':_0x1ae2fd[_0x7da6('0x3c')]['id']}})[_0x7da6('0x21')](handleEntityNotFound(_0x5706ac,null))[_0x7da6('0x21')](removeEntity(_0x5706ac,null))[_0x7da6('0x42')](handleError(_0x5706ac,null));};exports[_0x7da6('0x47')]=function(_0x202166,_0x2ef341){return db[_0x7da6('0x40')][_0x7da6('0x47')]()['then'](respondWithResult(_0x2ef341,null))[_0x7da6('0x42')](handleError(_0x2ef341,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d00fd2e..8084280 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 _0x1bce=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x23845c,_0x1457b4){var _0x40bcb9=function(_0x332570){while(--_0x332570){_0x23845c['push'](_0x23845c['shift']());}};_0x40bcb9(++_0x1457b4);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var logger=require('../../config/logger')(_0xe1bc('0x2'));var moment=require(_0xe1bc('0x3'));var BPromise=require(_0xe1bc('0x4'));var rp=require(_0xe1bc('0x5'));var fs=require('fs');var path=require(_0xe1bc('0x6'));var rimraf=require(_0xe1bc('0x7'));var config=require(_0xe1bc('0x8'));var attributes=require(_0xe1bc('0x9'));module[_0xe1bc('0xa')]=function(_0x57ebd4,_0x51566c){return _0x57ebd4[_0xe1bc('0xb')](_0xe1bc('0xc'),attributes,{'tableName':_0xe1bc('0xd'),'paranoid':![],'indexes':[{'name':_0xe1bc('0xe'),'fields':[_0xe1bc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaac4=['exports','define','OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x3aedc3,_0x5aa449){var _0x48400e=function(_0x184f0d){while(--_0x184f0d){_0x3aedc3['push'](_0x3aedc3['shift']());}};_0x48400e(++_0x5aa449);}(_0xaac4,0x6c));var _0x4aac=function(_0xdb0316,_0x1699ee){_0xdb0316=_0xdb0316-0x0;var _0xe43c0d=_0xaac4[_0xdb0316];return _0xe43c0d;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var logger=require('../../config/logger')(_0x4aac('0x2'));var moment=require(_0x4aac('0x3'));var BPromise=require(_0x4aac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4aac('0x5'));var rimraf=require(_0x4aac('0x6'));var config=require(_0x4aac('0x7'));var attributes=require(_0x4aac('0x8'));module[_0x4aac('0x9')]=function(_0x4c94f2,_0x2d795c){return _0x4c94f2[_0x4aac('0xa')](_0x4aac('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4aac('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0af10db..1bc687d 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 _0x37cc=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d074c,_0x42725f){var _0x250a80=function(_0x4bc742){while(--_0x4bc742){_0x3d074c['push'](_0x3d074c['shift']());}};_0x250a80(++_0x42725f);}(_0x37cc,0x185));var _0xc37c=function(_0x133e3b,_0x443cd6){_0x133e3b=_0x133e3b-0x0;var _0x199e72=_0x37cc[_0x133e3b];return _0x199e72;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});} \ No newline at end of file +var _0xedcb=['then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0xedcb,0x1eb));var _0xbedc=function(_0x6a0e6f,_0x58b00b){_0x6a0e6f=_0x6a0e6f-0x0;var _0x26bb3a=_0xedcb[_0x6a0e6f];return _0x26bb3a;};'use strict';var _=require('lodash');var util=require(_0xbedc('0x0'));var moment=require(_0xbedc('0x1'));var BPromise=require(_0xbedc('0x2'));var rs=require(_0xbedc('0x3'));var fs=require('fs');var Redis=require(_0xbedc('0x4'));var db=require(_0xbedc('0x5'))['db'];var utils=require(_0xbedc('0x6'));var logger=require('../../config/logger')(_0xbedc('0x7'));var config=require(_0xbedc('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3aa7c5,_0x5b4199,_0x45dca9){return new BPromise(function(_0x19bf71,_0x50e099){return client['request'](_0x3aa7c5,_0x45dca9)[_0xbedc('0x9')](function(_0x38e847){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x5b4199,_0xbedc('0xa'));logger[_0xbedc('0xb')](_0xbedc('0xc'),_0x5b4199,_0xbedc('0xa'),JSON[_0xbedc('0xd')](_0x38e847));if(_0x38e847[_0xbedc('0xe')]){if(_0x38e847[_0xbedc('0xe')][_0xbedc('0xf')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x5b4199,_0x38e847[_0xbedc('0xe')][_0xbedc('0x10')]);return _0x50e099(_0x38e847[_0xbedc('0xe')][_0xbedc('0x10')]);}logger[_0xbedc('0xe')](_0xbedc('0x11'),_0x5b4199,_0x38e847[_0xbedc('0xe')][_0xbedc('0x10')]);return _0x19bf71(_0x38e847[_0xbedc('0xe')][_0xbedc('0x10')]);}else{logger['info'](_0xbedc('0x11'),_0x5b4199,'request\x20sent');_0x19bf71(_0x38e847[_0xbedc('0x12')][_0xbedc('0x10')]);}})[_0xbedc('0x13')](function(_0x48e9bc){logger[_0xbedc('0xe')](_0xbedc('0x11'),_0x5b4199,_0x48e9bc);_0x50e099(_0x48e9bc);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 9466ffc..014a06c 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 _0x610f=['get','index','/:id','post','create','put','isAuthenticated','update','delete','destroy','util','path','connect-timeout','Router','../../config/environment','./pause.controller'];(function(_0x407370,_0x173263){var _0x3aa8f3=function(_0x1cae61){while(--_0x1cae61){_0x407370['push'](_0x407370['shift']());}};_0x3aa8f3(++_0x173263);}(_0x610f,0x19a));var _0xf610=function(_0x58053e,_0x5c5ba3){_0x58053e=_0x58053e-0x0;var _0x50f82c=_0x610f[_0x58053e];return _0x50f82c;};'use strict';var multer=require('multer');var util=require(_0xf610('0x0'));var path=require(_0xf610('0x1'));var timeout=require(_0xf610('0x2'));var express=require('express');var router=express[_0xf610('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf610('0x4'));var controller=require(_0xf610('0x5'));router[_0xf610('0x6')]('/',auth['isAuthenticated'](),controller[_0xf610('0x7')]);router[_0xf610('0x6')](_0xf610('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xf610('0x9')]('/',auth['isAuthenticated'](),controller[_0xf610('0xa')]);router[_0xf610('0xb')]('/:id',auth[_0xf610('0xc')](),controller[_0xf610('0xd')]);router[_0xf610('0xe')]('/:id',auth[_0xf610('0xc')](),controller[_0xf610('0xf')]);module['exports']=router; \ No newline at end of file +var _0xb1d4=['../../config/environment','./pause.controller','get','index','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xf48299,_0x2c211b){var _0x3e2a57=function(_0x7e9c7){while(--_0x7e9c7){_0xf48299['push'](_0xf48299['shift']());}};_0x3e2a57(++_0x2c211b);}(_0xb1d4,0xfa));var _0x4b1d=function(_0x4d6f6f,_0xef3141){_0x4d6f6f=_0x4d6f6f-0x0;var _0x4b7e32=_0xb1d4[_0x4d6f6f];return _0x4b7e32;};'use strict';var multer=require(_0x4b1d('0x0'));var util=require('util');var path=require(_0x4b1d('0x1'));var timeout=require(_0x4b1d('0x2'));var express=require(_0x4b1d('0x3'));var router=express[_0x4b1d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b1d('0x5'));var controller=require(_0x4b1d('0x6'));router[_0x4b1d('0x7')]('/',auth['isAuthenticated'](),controller[_0x4b1d('0x8')]);router[_0x4b1d('0x7')](_0x4b1d('0x9'),auth['isAuthenticated'](),controller[_0x4b1d('0xa')]);router['post']('/',auth[_0x4b1d('0xb')](),controller[_0x4b1d('0xc')]);router[_0x4b1d('0xd')](_0x4b1d('0x9'),auth[_0x4b1d('0xb')](),controller[_0x4b1d('0xe')]);router['delete'](_0x4b1d('0x9'),auth[_0x4b1d('0xb')](),controller[_0x4b1d('0xf')]);module[_0x4b1d('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 c99aa2f..96659e6 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 _0xc2e8=['sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2e8,0xb4));var _0x8c2e=function(_0x620d02,_0x3767ec){_0x620d02=_0x620d02-0x0;var _0x5c5206=_0xc2e8[_0x620d02];return _0x5c5206;};'use strict';var Sequelize=require(_0x8c2e('0x0'));module[_0x8c2e('0x1')]={'name':{'type':Sequelize[_0x8c2e('0x2')],'unique':_0x8c2e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8c2e('0x2')]}}; \ No newline at end of file +var _0x35e9=['STRING','name'];(function(_0x623d96,_0x34176f){var _0x6a2eb4=function(_0x4f7307){while(--_0x4f7307){_0x623d96['push'](_0x623d96['shift']());}};_0x6a2eb4(++_0x34176f);}(_0x35e9,0x1ee));var _0x935e=function(_0x14d28a,_0x5256af){_0x14d28a=_0x14d28a-0x0;var _0x5eefb6=_0x35e9[_0x14d28a];return _0x5eefb6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x935e('0x0')],'unique':_0x935e('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x935e('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 91825f0..f152897 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 _0x5f1a=['UserProfileResource','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','merge','filter','options','Pause','includeAll','findAll','catch','show','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','rimraf','zip-dir','bluebird','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','save','then','destroy','Pauses'];(function(_0x526a46,_0x119cc9){var _0x299cab=function(_0x49722b){while(--_0x49722b){_0x526a46['push'](_0x526a46['shift']());}};_0x299cab(++_0x119cc9);}(_0x5f1a,0xbf));var _0xa5f1=function(_0xfac096,_0x4e6ad7){_0xfac096=_0xfac096-0x0;var _0x72e68e=_0x5f1a[_0xfac096];return _0x72e68e;};'use strict';var pdf=require(_0xa5f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa5f1('0x1'));var zipdir=require(_0xa5f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa5f1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa5f1('0x4'));var csv=require(_0xa5f1('0x5'));var ejs=require(_0xa5f1('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa5f1('0x7'));var deskjs=require(_0xa5f1('0x8'));var toCsv=require(_0xa5f1('0x5'));var querystring=require(_0xa5f1('0x9'));var Papa=require(_0xa5f1('0xa'));var Redis=require(_0xa5f1('0xb'));var authService=require(_0xa5f1('0xc'));var qs=require(_0xa5f1('0xd'));var as=require(_0xa5f1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5f1('0xf'))('api');var utils=require(_0xa5f1('0x10'));var config=require(_0xa5f1('0x11'));var db=require(_0xa5f1('0x12'))['db'];function respondWithStatusCode(_0x35f6db,_0x6c0c25){_0x6c0c25=_0x6c0c25||0xcc;return function(_0x1e6862){if(_0x1e6862){return _0x35f6db[_0xa5f1('0x13')](_0x6c0c25);}return _0x35f6db[_0xa5f1('0x14')](_0x6c0c25)[_0xa5f1('0x15')]();};}function respondWithResult(_0x2e8c66,_0x3d7a9c){_0x3d7a9c=_0x3d7a9c||0xc8;return function(_0x3fb7a4){if(_0x3fb7a4){return _0x2e8c66[_0xa5f1('0x14')](_0x3d7a9c)[_0xa5f1('0x16')](_0x3fb7a4);}};}function respondWithFilteredResult(_0x160adf,_0x22b4a9){return function(_0xc735fa){if(_0xc735fa){var _0x6162a=_0xc735fa[_0xa5f1('0x17')],_0x129fbc=_0x22b4a9['offset'],_0x59e3c4=_0x22b4a9['offset']+_0x22b4a9[_0xa5f1('0x18')],_0x428843;if(_0x59e3c4>=_0x6162a){_0x59e3c4=_0x6162a;_0x428843=0xc8;}else{_0x428843=0xce;}_0x160adf['status'](_0x428843);return _0x160adf[_0xa5f1('0x19')]('Content-Range',_0x129fbc+'-'+_0x59e3c4+'/'+_0x6162a)[_0xa5f1('0x16')](_0xc735fa);}return null;};}function patchUpdates(_0x3f09c9){return function(_0x65c0b4){try{jsonpatch[_0xa5f1('0x1a')](_0x65c0b4,_0x3f09c9,!![]);}catch(_0x3da5af){return BPromise['reject'](_0x3da5af);}return _0x65c0b4[_0xa5f1('0x1b')]();};}function saveUpdates(_0x596e45,_0x3759d9){return function(_0x3f9102){if(_0x3f9102){return _0x3f9102['update'](_0x596e45)[_0xa5f1('0x1c')](function(_0x4671a8){return _0x4671a8;});}return null;};}function removeEntity(_0x20bc9d,_0x8a6aa9){return function(_0xe0fe5c){if(_0xe0fe5c){return _0xe0fe5c[_0xa5f1('0x1d')]()[_0xa5f1('0x1c')](function(){var _0x3f5cb9=_0xe0fe5c['get']({'plain':!![]});var _0x1359bb=_0xa5f1('0x1e');return db[_0xa5f1('0x1f')][_0xa5f1('0x1d')]({'where':{'type':_0x1359bb,'resourceId':_0x3f5cb9['id']}})[_0xa5f1('0x1c')](function(){return _0xe0fe5c;});})['then'](function(){_0x20bc9d['status'](0xcc)[_0xa5f1('0x15')]();});}};}function handleEntityNotFound(_0x4e71ce,_0x5608f9){return function(_0x3e5c0e){if(!_0x3e5c0e){_0x4e71ce['sendStatus'](0x194);}return _0x3e5c0e;};}function handleError(_0x4b564a,_0x289273){_0x289273=_0x289273||0x1f4;return function(_0x453c66){logger['error'](_0x453c66['stack']);if(_0x453c66['name']){delete _0x453c66[_0xa5f1('0x20')];}_0x4b564a[_0xa5f1('0x14')](_0x289273)[_0xa5f1('0x21')](_0x453c66);};}exports[_0xa5f1('0x22')]=function(_0x506a64,_0x400588){var _0xaff4c6={},_0x184051={},_0x4b1a26={'count':0x0,'rows':[]};var _0x2da981=_[_0xa5f1('0x23')](db['Pause'][_0xa5f1('0x24')],function(_0xd88ffe){return{'name':_0xd88ffe['fieldName'],'type':_0xd88ffe[_0xa5f1('0x25')][_0xa5f1('0x26')]};});_0x184051['model']=_[_0xa5f1('0x23')](_0x2da981,_0xa5f1('0x20'));_0x184051[_0xa5f1('0x27')]=_['keys'](_0x506a64['query']);_0x184051[_0xa5f1('0x28')]=_[_0xa5f1('0x29')](_0x184051[_0xa5f1('0x2a')],_0x184051['query']);_0xaff4c6[_0xa5f1('0x2b')]=_[_0xa5f1('0x29')](_0x184051[_0xa5f1('0x2a')],qs[_0xa5f1('0x2c')](_0x506a64['query'][_0xa5f1('0x2c')]));_0xaff4c6[_0xa5f1('0x2b')]=_0xaff4c6[_0xa5f1('0x2b')][_0xa5f1('0x2d')]?_0xaff4c6['attributes']:_0x184051[_0xa5f1('0x2a')];if(!_0x506a64[_0xa5f1('0x27')]['hasOwnProperty'](_0xa5f1('0x2e'))){_0xaff4c6[_0xa5f1('0x18')]=qs[_0xa5f1('0x18')](_0x506a64['query'][_0xa5f1('0x18')]);_0xaff4c6[_0xa5f1('0x2f')]=qs['offset'](_0x506a64['query'][_0xa5f1('0x2f')]);}_0xaff4c6[_0xa5f1('0x30')]=qs[_0xa5f1('0x31')](_0x506a64[_0xa5f1('0x27')][_0xa5f1('0x31')]);_0xaff4c6['where']=qs[_0xa5f1('0x28')](_['pick'](_0x506a64[_0xa5f1('0x27')],_0x184051[_0xa5f1('0x28')]),_0x2da981);if(_0x506a64['query']['filter']){_0xaff4c6[_0xa5f1('0x32')]=_[_0xa5f1('0x33')](_0xaff4c6[_0xa5f1('0x32')],{'$or':_[_0xa5f1('0x23')](_0x2da981,function(_0x851c9e){if(_0x851c9e[_0xa5f1('0x25')]!=='VIRTUAL'){var _0x243557={};_0x243557[_0x851c9e['name']]={'$like':'%'+_0x506a64['query'][_0xa5f1('0x34')]+'%'};return _0x243557;}})});}_0xaff4c6=_[_0xa5f1('0x33')]({},_0xaff4c6,_0x506a64[_0xa5f1('0x35')]);var _0x34a2ad={'where':_0xaff4c6[_0xa5f1('0x32')]};return db[_0xa5f1('0x36')][_0xa5f1('0x17')](_0x34a2ad)[_0xa5f1('0x1c')](function(_0xa15f08){_0x4b1a26[_0xa5f1('0x17')]=_0xa15f08;if(_0x506a64[_0xa5f1('0x27')][_0xa5f1('0x37')]){_0xaff4c6['include']=[{'all':!![]}];}return db['Pause'][_0xa5f1('0x38')](_0xaff4c6);})['then'](function(_0x398c17){_0x4b1a26['rows']=_0x398c17;return _0x4b1a26;})['then'](respondWithFilteredResult(_0x400588,_0xaff4c6))[_0xa5f1('0x39')](handleError(_0x400588,null));};exports[_0xa5f1('0x3a')]=function(_0x590f2b,_0x501944){var _0x4432be={'raw':!![],'where':{'id':_0x590f2b['params']['id']}},_0x5ba153={};_0x5ba153['model']=_[_0xa5f1('0x3b')](db[_0xa5f1('0x36')][_0xa5f1('0x24')]);_0x5ba153['query']=_[_0xa5f1('0x3b')](_0x590f2b[_0xa5f1('0x27')]);_0x5ba153['filters']=_[_0xa5f1('0x29')](_0x5ba153[_0xa5f1('0x2a')],_0x5ba153['query']);_0x4432be['attributes']=_[_0xa5f1('0x29')](_0x5ba153[_0xa5f1('0x2a')],qs[_0xa5f1('0x2c')](_0x590f2b['query'][_0xa5f1('0x2c')]));_0x4432be[_0xa5f1('0x2b')]=_0x4432be[_0xa5f1('0x2b')][_0xa5f1('0x2d')]?_0x4432be['attributes']:_0x5ba153[_0xa5f1('0x2a')];if(_0x590f2b[_0xa5f1('0x27')][_0xa5f1('0x37')]){_0x4432be[_0xa5f1('0x3c')]=[{'all':!![]}];}_0x4432be=_[_0xa5f1('0x33')]({},_0x4432be,_0x590f2b[_0xa5f1('0x35')]);return db[_0xa5f1('0x36')][_0xa5f1('0x3d')](_0x4432be)['then'](handleEntityNotFound(_0x501944,null))[_0xa5f1('0x1c')](respondWithResult(_0x501944,null))[_0xa5f1('0x39')](handleError(_0x501944,null));};exports[_0xa5f1('0x3e')]=function(_0x227a7c,_0x5caceb){return db[_0xa5f1('0x36')][_0xa5f1('0x3e')](_0x227a7c['body'],{})[_0xa5f1('0x1c')](function(_0x41d35e){var _0x2ffe2d=_0x227a7c[_0xa5f1('0x3f')][_0xa5f1('0x40')]({'plain':!![]});if(!_0x2ffe2d)throw new Error(_0xa5f1('0x41'));if(_0x2ffe2d[_0xa5f1('0x42')]===_0xa5f1('0x3f')){var _0x4e636d=_0x41d35e[_0xa5f1('0x40')]({'plain':!![]});var _0xdfb4da=_0xa5f1('0x1e');return db['UserProfileSection'][_0xa5f1('0x3d')]({'where':{'name':_0xdfb4da,'userProfileId':_0x2ffe2d[_0xa5f1('0x43')]},'raw':!![]})[_0xa5f1('0x1c')](function(_0x4281a2){if(_0x4281a2&&_0x4281a2[_0xa5f1('0x44')]===0x0){return db[_0xa5f1('0x1f')][_0xa5f1('0x3e')]({'name':_0x4e636d[_0xa5f1('0x20')],'resourceId':_0x4e636d['id'],'type':_0x4281a2['name'],'sectionId':_0x4281a2['id']},{})[_0xa5f1('0x1c')](function(){return _0x41d35e;});}else{return _0x41d35e;}})[_0xa5f1('0x39')](function(_0x219b23){logger[_0xa5f1('0x45')](_0xa5f1('0x46'),_0x219b23);throw _0x219b23;});}return _0x41d35e;})[_0xa5f1('0x1c')](respondWithResult(_0x5caceb,0xc9))['catch'](handleError(_0x5caceb,null));};exports[_0xa5f1('0x47')]=function(_0x3b7e3f,_0x384489){if(_0x3b7e3f['body']['id']){delete _0x3b7e3f[_0xa5f1('0x48')]['id'];}return db['Pause']['find']({'where':{'id':_0x3b7e3f[_0xa5f1('0x49')]['id']}})[_0xa5f1('0x1c')](handleEntityNotFound(_0x384489,null))[_0xa5f1('0x1c')](saveUpdates(_0x3b7e3f[_0xa5f1('0x48')],null))[_0xa5f1('0x1c')](respondWithResult(_0x384489,null))[_0xa5f1('0x39')](handleError(_0x384489,null));};exports[_0xa5f1('0x1d')]=function(_0x3b0746,_0x261139){return db[_0xa5f1('0x36')]['find']({'where':{'id':_0x3b0746['params']['id']}})[_0xa5f1('0x1c')](handleEntityNotFound(_0x261139,null))[_0xa5f1('0x1c')](removeEntity(_0x261139,null))[_0xa5f1('0x39')](handleError(_0x261139,null));}; \ No newline at end of file +var _0x4946=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','error','stack','name','send','Pause','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','keys','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1ee037,_0x31bf6a){var _0x1cf1c4=function(_0x104689){while(--_0x104689){_0x1ee037['push'](_0x1ee037['shift']());}};_0x1cf1c4(++_0x31bf6a);}(_0x4946,0x91));var _0x6494=function(_0x1ae9fd,_0x5eaff0){_0x1ae9fd=_0x1ae9fd-0x0;var _0xc0bf5b=_0x4946[_0x1ae9fd];return _0xc0bf5b;};'use strict';var pdf=require(_0x6494('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6494('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6494('0x2'));var rp=require(_0x6494('0x3'));var moment=require(_0x6494('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6494('0x5'));var path=require(_0x6494('0x6'));var sox=require(_0x6494('0x7'));var csv=require('to-csv');var ejs=require(_0x6494('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6494('0x9'));var crypto=require(_0x6494('0xa'));var jsforce=require(_0x6494('0xb'));var deskjs=require(_0x6494('0xc'));var toCsv=require(_0x6494('0xd'));var querystring=require(_0x6494('0xe'));var Papa=require(_0x6494('0xf'));var Redis=require(_0x6494('0x10'));var authService=require(_0x6494('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6494('0x12'));var hardwareService=require(_0x6494('0x13'));var logger=require(_0x6494('0x14'))(_0x6494('0x15'));var utils=require(_0x6494('0x16'));var config=require(_0x6494('0x17'));var db=require(_0x6494('0x18'))['db'];function respondWithStatusCode(_0x1e9899,_0x852784){_0x852784=_0x852784||0xcc;return function(_0x4bf4e6){if(_0x4bf4e6){return _0x1e9899['sendStatus'](_0x852784);}return _0x1e9899[_0x6494('0x19')](_0x852784)[_0x6494('0x1a')]();};}function respondWithResult(_0x4d70b0,_0x37cec9){_0x37cec9=_0x37cec9||0xc8;return function(_0x3d8631){if(_0x3d8631){return _0x4d70b0[_0x6494('0x19')](_0x37cec9)[_0x6494('0x1b')](_0x3d8631);}};}function respondWithFilteredResult(_0xa023ba,_0x12032b){return function(_0x5481a0){if(_0x5481a0){var _0x1301e7=_0x5481a0['count'],_0x9ca9de=_0x12032b[_0x6494('0x1c')],_0x28b5e3=_0x12032b[_0x6494('0x1c')]+_0x12032b[_0x6494('0x1d')],_0x641666;if(_0x28b5e3>=_0x1301e7){_0x28b5e3=_0x1301e7;_0x641666=0xc8;}else{_0x641666=0xce;}_0xa023ba[_0x6494('0x19')](_0x641666);return _0xa023ba[_0x6494('0x1e')](_0x6494('0x1f'),_0x9ca9de+'-'+_0x28b5e3+'/'+_0x1301e7)[_0x6494('0x1b')](_0x5481a0);}return null;};}function patchUpdates(_0x51407c){return function(_0x5b651e){try{jsonpatch[_0x6494('0x20')](_0x5b651e,_0x51407c,!![]);}catch(_0x33d938){return BPromise[_0x6494('0x21')](_0x33d938);}return _0x5b651e[_0x6494('0x22')]();};}function saveUpdates(_0x4aab32,_0x5a130f){return function(_0x13f84c){if(_0x13f84c){return _0x13f84c['update'](_0x4aab32)[_0x6494('0x23')](function(_0xcf8d8e){return _0xcf8d8e;});}return null;};}function removeEntity(_0x30d2d3,_0x44538d){return function(_0x4f3b64){if(_0x4f3b64){return _0x4f3b64[_0x6494('0x24')]()[_0x6494('0x23')](function(){var _0x56a269=_0x4f3b64[_0x6494('0x25')]({'plain':!![]});var _0x46a28a=_0x6494('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x46a28a,'resourceId':_0x56a269['id']}})[_0x6494('0x23')](function(){return _0x4f3b64;});})[_0x6494('0x23')](function(){_0x30d2d3[_0x6494('0x19')](0xcc)[_0x6494('0x1a')]();});}};}function handleEntityNotFound(_0x38ab8a,_0x4f562f){return function(_0x5a42fd){if(!_0x5a42fd){_0x38ab8a['sendStatus'](0x194);}return _0x5a42fd;};}function handleError(_0x17a674,_0x32eef5){_0x32eef5=_0x32eef5||0x1f4;return function(_0x1a44c3){logger[_0x6494('0x27')](_0x1a44c3[_0x6494('0x28')]);if(_0x1a44c3[_0x6494('0x29')]){delete _0x1a44c3[_0x6494('0x29')];}_0x17a674[_0x6494('0x19')](_0x32eef5)[_0x6494('0x2a')](_0x1a44c3);};}exports['index']=function(_0x5b659a,_0x59f929){var _0x252aca={},_0x2dc9e5={},_0xabfd93={'count':0x0,'rows':[]};var _0x45fba6=_['map'](db[_0x6494('0x2b')][_0x6494('0x2c')],function(_0x4a0406){return{'name':_0x4a0406['fieldName'],'type':_0x4a0406[_0x6494('0x2d')][_0x6494('0x2e')]};});_0x2dc9e5[_0x6494('0x2f')]=_[_0x6494('0x30')](_0x45fba6,'name');_0x2dc9e5[_0x6494('0x31')]=_['keys'](_0x5b659a[_0x6494('0x31')]);_0x2dc9e5[_0x6494('0x32')]=_[_0x6494('0x33')](_0x2dc9e5[_0x6494('0x2f')],_0x2dc9e5[_0x6494('0x31')]);_0x252aca[_0x6494('0x34')]=_[_0x6494('0x33')](_0x2dc9e5[_0x6494('0x2f')],qs[_0x6494('0x35')](_0x5b659a['query'][_0x6494('0x35')]));_0x252aca[_0x6494('0x34')]=_0x252aca[_0x6494('0x34')]['length']?_0x252aca[_0x6494('0x34')]:_0x2dc9e5[_0x6494('0x2f')];if(!_0x5b659a[_0x6494('0x31')][_0x6494('0x36')]('nolimit')){_0x252aca[_0x6494('0x1d')]=qs[_0x6494('0x1d')](_0x5b659a[_0x6494('0x31')][_0x6494('0x1d')]);_0x252aca[_0x6494('0x1c')]=qs[_0x6494('0x1c')](_0x5b659a[_0x6494('0x31')][_0x6494('0x1c')]);}_0x252aca[_0x6494('0x37')]=qs[_0x6494('0x38')](_0x5b659a[_0x6494('0x31')][_0x6494('0x38')]);_0x252aca[_0x6494('0x39')]=qs[_0x6494('0x32')](_[_0x6494('0x3a')](_0x5b659a[_0x6494('0x31')],_0x2dc9e5[_0x6494('0x32')]),_0x45fba6);if(_0x5b659a[_0x6494('0x31')]['filter']){_0x252aca[_0x6494('0x39')]=_[_0x6494('0x3b')](_0x252aca['where'],{'$or':_['map'](_0x45fba6,function(_0x5dd1eb){if(_0x5dd1eb['type']!=='VIRTUAL'){var _0x1e5d0e={};_0x1e5d0e[_0x5dd1eb['name']]={'$like':'%'+_0x5b659a[_0x6494('0x31')][_0x6494('0x3c')]+'%'};return _0x1e5d0e;}})});}_0x252aca=_[_0x6494('0x3b')]({},_0x252aca,_0x5b659a[_0x6494('0x3d')]);var _0x5c79e5={'where':_0x252aca[_0x6494('0x39')]};return db[_0x6494('0x2b')][_0x6494('0x3e')](_0x5c79e5)[_0x6494('0x23')](function(_0x23f395){_0xabfd93[_0x6494('0x3e')]=_0x23f395;if(_0x5b659a[_0x6494('0x31')][_0x6494('0x3f')]){_0x252aca[_0x6494('0x40')]=[{'all':!![]}];}return db['Pause'][_0x6494('0x41')](_0x252aca);})[_0x6494('0x23')](function(_0x151e7c){_0xabfd93[_0x6494('0x42')]=_0x151e7c;return _0xabfd93;})[_0x6494('0x23')](respondWithFilteredResult(_0x59f929,_0x252aca))[_0x6494('0x43')](handleError(_0x59f929,null));};exports['show']=function(_0x227d32,_0x52599f){var _0x1ddef0={'raw':!![],'where':{'id':_0x227d32[_0x6494('0x44')]['id']}},_0x2ca91e={};_0x2ca91e[_0x6494('0x2f')]=_[_0x6494('0x45')](db['Pause']['rawAttributes']);_0x2ca91e[_0x6494('0x31')]=_[_0x6494('0x45')](_0x227d32[_0x6494('0x31')]);_0x2ca91e[_0x6494('0x32')]=_[_0x6494('0x33')](_0x2ca91e[_0x6494('0x2f')],_0x2ca91e[_0x6494('0x31')]);_0x1ddef0[_0x6494('0x34')]=_['intersection'](_0x2ca91e[_0x6494('0x2f')],qs[_0x6494('0x35')](_0x227d32['query']['fields']));_0x1ddef0[_0x6494('0x34')]=_0x1ddef0[_0x6494('0x34')][_0x6494('0x46')]?_0x1ddef0[_0x6494('0x34')]:_0x2ca91e[_0x6494('0x2f')];if(_0x227d32[_0x6494('0x31')][_0x6494('0x3f')]){_0x1ddef0[_0x6494('0x40')]=[{'all':!![]}];}_0x1ddef0=_[_0x6494('0x3b')]({},_0x1ddef0,_0x227d32[_0x6494('0x3d')]);return db[_0x6494('0x2b')][_0x6494('0x47')](_0x1ddef0)['then'](handleEntityNotFound(_0x52599f,null))[_0x6494('0x23')](respondWithResult(_0x52599f,null))[_0x6494('0x43')](handleError(_0x52599f,null));};exports[_0x6494('0x48')]=function(_0x21a06d,_0x32857d){return db[_0x6494('0x2b')][_0x6494('0x48')](_0x21a06d['body'],{})['then'](function(_0x1a0ec9){var _0x5f1d21=_0x21a06d['user']['get']({'plain':!![]});if(!_0x5f1d21)throw new Error(_0x6494('0x49'));if(_0x5f1d21[_0x6494('0x4a')]==='user'){var _0x37ea54=_0x1a0ec9['get']({'plain':!![]});var _0x4950f2=_0x6494('0x26');return db[_0x6494('0x4b')]['find']({'where':{'name':_0x4950f2,'userProfileId':_0x5f1d21[_0x6494('0x4c')]},'raw':!![]})[_0x6494('0x23')](function(_0x481f1d){if(_0x481f1d&&_0x481f1d[_0x6494('0x4d')]===0x0){return db[_0x6494('0x4e')]['create']({'name':_0x37ea54['name'],'resourceId':_0x37ea54['id'],'type':_0x481f1d[_0x6494('0x29')],'sectionId':_0x481f1d['id']},{})[_0x6494('0x23')](function(){return _0x1a0ec9;});}else{return _0x1a0ec9;}})[_0x6494('0x43')](function(_0x858adb){logger['error'](_0x6494('0x4f'),_0x858adb);throw _0x858adb;});}return _0x1a0ec9;})['then'](respondWithResult(_0x32857d,0xc9))[_0x6494('0x43')](handleError(_0x32857d,null));};exports[_0x6494('0x50')]=function(_0x122995,_0x40baaf){if(_0x122995[_0x6494('0x51')]['id']){delete _0x122995['body']['id'];}return db[_0x6494('0x2b')][_0x6494('0x47')]({'where':{'id':_0x122995[_0x6494('0x44')]['id']}})[_0x6494('0x23')](handleEntityNotFound(_0x40baaf,null))[_0x6494('0x23')](saveUpdates(_0x122995['body'],null))[_0x6494('0x23')](respondWithResult(_0x40baaf,null))[_0x6494('0x43')](handleError(_0x40baaf,null));};exports[_0x6494('0x24')]=function(_0x9ccbaf,_0x57e38f){return db[_0x6494('0x2b')][_0x6494('0x47')]({'where':{'id':_0x9ccbaf[_0x6494('0x44')]['id']}})[_0x6494('0x23')](handleEntityNotFound(_0x57e38f,null))[_0x6494('0x23')](removeEntity(_0x57e38f,null))['catch'](handleError(_0x57e38f,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5891eca..180e004 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 _0x253c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util'];(function(_0x40a823,_0x3d3b66){var _0x2a12a2=function(_0x599254){while(--_0x599254){_0x40a823['push'](_0x40a823['shift']());}};_0x2a12a2(++_0x3d3b66);}(_0x253c,0x129));var _0xc253=function(_0x40a0a4,_0x5d30d0){_0x40a0a4=_0x40a0a4-0x0;var _0x50cc17=_0x253c[_0x40a0a4];return _0x50cc17;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var logger=require('../../config/logger')(_0xc253('0x2'));var moment=require(_0xc253('0x3'));var BPromise=require(_0xc253('0x4'));var rp=require(_0xc253('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc253('0x6'));var config=require(_0xc253('0x7'));var attributes=require(_0xc253('0x8'));module[_0xc253('0x9')]=function(_0x6bd56e,_0x12cd0d){return _0x6bd56e[_0xc253('0xa')](_0xc253('0xb'),attributes,{'tableName':_0xc253('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x113b=['lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define','Pause','tools_pauses'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x113b,0x1e0));var _0xb113=function(_0x411c26,_0xc2e2e7){_0x411c26=_0x411c26-0x0;var _0xea8278=_0x113b[_0x411c26];return _0xea8278;};'use strict';var _=require(_0xb113('0x0'));var util=require(_0xb113('0x1'));var logger=require(_0xb113('0x2'))('api');var moment=require(_0xb113('0x3'));var BPromise=require('bluebird');var rp=require(_0xb113('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb113('0x5'));var config=require(_0xb113('0x6'));var attributes=require('./pause.attributes');module['exports']=function(_0x33844d,_0x4c376c){return _0x33844d[_0xb113('0x7')](_0xb113('0x8'),attributes,{'tableName':_0xb113('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 107f056..2f7d43b 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 _0x36f4=['../../config/environment','jayson/promise','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x198643,_0x499312){var _0x1a6aa6=function(_0x486858){while(--_0x486858){_0x198643['push'](_0x198643['shift']());}};_0x1a6aa6(++_0x499312);}(_0x36f4,0xb3));var _0x436f=function(_0x41b8b2,_0x3c819e){_0x41b8b2=_0x41b8b2-0x0;var _0x16a168=_0x36f4[_0x41b8b2];return _0x16a168;};'use strict';var _=require('lodash');var util=require(_0x436f('0x0'));var moment=require(_0x436f('0x1'));var BPromise=require(_0x436f('0x2'));var rs=require(_0x436f('0x3'));var fs=require('fs');var Redis=require(_0x436f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x436f('0x5'))(_0x436f('0x6'));var config=require(_0x436f('0x7'));var jayson=require(_0x436f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d27a2,_0x58fae8,_0x374425){return new BPromise(function(_0x5cd749,_0xd56d48){return client[_0x436f('0x9')](_0x1d27a2,_0x374425)[_0x436f('0xa')](function(_0x3dab1c){logger[_0x436f('0xb')](_0x436f('0xc'),_0x58fae8,_0x436f('0xd'));logger[_0x436f('0xe')](_0x436f('0xf'),_0x58fae8,_0x436f('0xd'),JSON['stringify'](_0x3dab1c));if(_0x3dab1c[_0x436f('0x10')]){if(_0x3dab1c[_0x436f('0x10')][_0x436f('0x11')]===0x1f4){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);return _0xd56d48(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}logger[_0x436f('0x10')]('Pause,\x20%s,\x20%s',_0x58fae8,_0x3dab1c['error'][_0x436f('0x12')]);return _0x5cd749(_0x3dab1c[_0x436f('0x10')][_0x436f('0x12')]);}else{logger[_0x436f('0xb')]('Pause,\x20%s,\x20%s',_0x58fae8,'request\x20sent');_0x5cd749(_0x3dab1c[_0x436f('0x13')]['message']);}})[_0x436f('0x14')](function(_0x5b55b5){logger[_0x436f('0x10')](_0x436f('0xc'),_0x58fae8,_0x5b55b5);_0xd56d48(_0x5b55b5);});});}exports[_0x436f('0x15')]=function(_0x3185a7){var _0xe426bd=this;return new Promise(function(_0x29399c,_0x1f7460){return db[_0x436f('0x16')]['find']({'raw':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x18')]===undefined?!![]:![]:!![],'where':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x19')]||null:null,'attributes':_0x3185a7[_0x436f('0x17')]?_0x3185a7['options'][_0x436f('0x1a')]||null:null,'include':_0x3185a7[_0x436f('0x17')]?_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x3185a7[_0x436f('0x17')][_0x436f('0x1b')],function(_0x14fa91){return{'model':db[_0x14fa91['model']],'as':_0x14fa91['as'],'attributes':_0x14fa91[_0x436f('0x1a')],'include':_0x14fa91['include']?_[_0x436f('0x1c')](_0x14fa91[_0x436f('0x1b')],function(_0x1ccaba){return{'model':db[_0x1ccaba[_0x436f('0x1d')]],'as':_0x1ccaba['as'],'attributes':_0x1ccaba[_0x436f('0x1a')],'include':_0x1ccaba[_0x436f('0x1b')]?_[_0x436f('0x1c')](_0x1ccaba[_0x436f('0x1b')],function(_0x118d3a){return{'model':db[_0x118d3a[_0x436f('0x1d')]],'as':_0x118d3a['as'],'attributes':_0x118d3a[_0x436f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14710a){logger['info'](_0x436f('0x15'),_0x3185a7);logger[_0x436f('0xe')](_0x436f('0x15'),_0x3185a7,JSON[_0x436f('0x1e')](_0x14710a));_0x29399c(_0x14710a);})[_0x436f('0x14')](function(_0x11cc89){logger[_0x436f('0x10')]('ShowPause',_0x11cc89['message'],_0x3185a7);_0x1f7460(_0xe426bd[_0x436f('0x10')](0x1f4,_0x11cc89[_0x436f('0x12')]));});});}; \ No newline at end of file +var _0xc1c4=['message','result','catch','ShowPause','Pause','find','options','raw','map','model','attributes','include','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b64f6,_0x194bb4){var _0x1fac4c=function(_0x619c74){while(--_0x619c74){_0x5b64f6['push'](_0x5b64f6['shift']());}};_0x1fac4c(++_0x194bb4);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x2ac6de,_0x1d95bc){_0x2ac6de=_0x2ac6de-0x0;var _0x5bd04a=_0xc1c4[_0x2ac6de];return _0x5bd04a;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var moment=require(_0x4c1c('0x2'));var BPromise=require(_0x4c1c('0x3'));var rs=require(_0x4c1c('0x4'));var fs=require('fs');var Redis=require(_0x4c1c('0x5'));var db=require(_0x4c1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c1c('0x7'))(_0x4c1c('0x8'));var config=require(_0x4c1c('0x9'));var jayson=require(_0x4c1c('0xa'));var client=jayson['client'][_0x4c1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5a4f,_0x5863d0,_0x20e276){return new BPromise(function(_0x3337e4,_0x486065){return client[_0x4c1c('0xc')](_0x4f5a4f,_0x20e276)[_0x4c1c('0xd')](function(_0x445441){logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,'request\x20sent');logger['debug'](_0x4c1c('0x10'),_0x5863d0,_0x4c1c('0x11'),JSON[_0x4c1c('0x12')](_0x445441));if(_0x445441[_0x4c1c('0x13')]){if(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x14')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x486065(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);}logger[_0x4c1c('0x13')]('Pause,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x3337e4(_0x445441['error'][_0x4c1c('0x15')]);}else{logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,_0x4c1c('0x11'));_0x3337e4(_0x445441[_0x4c1c('0x16')][_0x4c1c('0x15')]);}})[_0x4c1c('0x17')](function(_0x33641d){logger[_0x4c1c('0x13')](_0x4c1c('0xf'),_0x5863d0,_0x33641d);_0x486065(_0x33641d);});});}exports[_0x4c1c('0x18')]=function(_0x5a9217){var _0x1fad89=this;return new Promise(function(_0x213019,_0x64fe4b){return db[_0x4c1c('0x19')][_0x4c1c('0x1a')]({'raw':_0x5a9217[_0x4c1c('0x1b')]?_0x5a9217[_0x4c1c('0x1b')][_0x4c1c('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a9217[_0x4c1c('0x1b')]?_0x5a9217[_0x4c1c('0x1b')]['where']||null:null,'attributes':_0x5a9217['options']?_0x5a9217[_0x4c1c('0x1b')]['attributes']||null:null,'include':_0x5a9217[_0x4c1c('0x1b')]?_0x5a9217[_0x4c1c('0x1b')]['include']?_[_0x4c1c('0x1d')](_0x5a9217['options']['include'],function(_0x366bb3){return{'model':db[_0x366bb3[_0x4c1c('0x1e')]],'as':_0x366bb3['as'],'attributes':_0x366bb3[_0x4c1c('0x1f')],'include':_0x366bb3[_0x4c1c('0x20')]?_[_0x4c1c('0x1d')](_0x366bb3['include'],function(_0x1b533b){return{'model':db[_0x1b533b[_0x4c1c('0x1e')]],'as':_0x1b533b['as'],'attributes':_0x1b533b[_0x4c1c('0x1f')],'include':_0x1b533b[_0x4c1c('0x20')]?_[_0x4c1c('0x1d')](_0x1b533b['include'],function(_0x577e68){return{'model':db[_0x577e68[_0x4c1c('0x1e')]],'as':_0x577e68['as'],'attributes':_0x577e68['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c1c('0xd')](function(_0x4e96b7){logger[_0x4c1c('0xe')](_0x4c1c('0x18'),_0x5a9217);logger[_0x4c1c('0x21')]('ShowPause',_0x5a9217,JSON[_0x4c1c('0x12')](_0x4e96b7));_0x213019(_0x4e96b7);})[_0x4c1c('0x17')](function(_0x3d6786){logger[_0x4c1c('0x13')](_0x4c1c('0x18'),_0x3d6786[_0x4c1c('0x15')],_0x5a9217);_0x64fe4b(_0x1fad89[_0x4c1c('0x13')](0x1f4,_0x3d6786[_0x4c1c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index df1452d..b4ca4bd 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 _0xc82c=['/:id','show','/:id/download','download','diskStorage','join','originalname','replace','%s-%s%s','extname','post','single','file','upload','put','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/webhook','webhookGet'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0xc82c,0x11e));var _0xcc82=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc82c[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xcc82('0x0'));var path=require(_0xcc82('0x1'));var timeout=require(_0xcc82('0x2'));var express=require(_0xcc82('0x3'));var router=express['Router']();var auth=require(_0xcc82('0x4'));var interaction=require(_0xcc82('0x5'));var config=require(_0xcc82('0x6'));var controller=require('./plugin.controller');router['get']('/',auth[_0xcc82('0x7')](),controller['index']);router[_0xcc82('0x8')](_0xcc82('0x9'),controller[_0xcc82('0xa')]);router['get'](_0xcc82('0xb'),auth[_0xcc82('0x7')](),controller[_0xcc82('0xc')]);router[_0xcc82('0x8')](_0xcc82('0xd'),auth[_0xcc82('0x7')](),controller[_0xcc82('0xe')]);var upload=multer({'storage':multer[_0xcc82('0xf')]({'destination':function(_0x3d30b8,_0x1ba5f6,_0x26be6c){_0x26be6c(null,path[_0xcc82('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0x44c349,_0x161938,_0x4d892d){_0x161938['originalname']=_0x161938[_0xcc82('0x11')][_0xcc82('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d892d(null,util['format'](_0xcc82('0x13'),path['basename'](_0x161938['originalname'],path[_0xcc82('0x14')](_0x161938[_0xcc82('0x11')])),Date['now'](),path['extname'](_0x161938['originalname'])));}})});router[_0xcc82('0x15')]('/',upload[_0xcc82('0x16')](_0xcc82('0x17')),controller[_0xcc82('0x18')]);router['post']('/webhook',controller['webhookPost']);router[_0xcc82('0x19')]('/:id',auth[_0xcc82('0x7')](),controller['update']);router[_0xcc82('0x1a')]('/:id',auth[_0xcc82('0x7')](),controller[_0xcc82('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbf67=['upload','put','update','delete','/:id','multer','path','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0xbf67,0x161));var _0x7bf6=function(_0x192154,_0x4dc894){_0x192154=_0x192154-0x0;var _0x1a343f=_0xbf67[_0x192154];return _0x1a343f;};'use strict';var multer=require(_0x7bf6('0x0'));var util=require('util');var path=require(_0x7bf6('0x1'));var timeout=require('connect-timeout');var express=require(_0x7bf6('0x2'));var router=express[_0x7bf6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7bf6('0x4'));var config=require(_0x7bf6('0x5'));var controller=require(_0x7bf6('0x6'));router[_0x7bf6('0x7')]('/',auth[_0x7bf6('0x8')](),controller[_0x7bf6('0x9')]);router[_0x7bf6('0x7')](_0x7bf6('0xa'),controller[_0x7bf6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7bf6('0xc')]);router[_0x7bf6('0x7')](_0x7bf6('0xd'),auth[_0x7bf6('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x7bf6('0xe')]({'destination':function(_0x1da27a,_0x2378fe,_0x417840){_0x417840(null,path[_0x7bf6('0xf')](config[_0x7bf6('0x10')],_0x7bf6('0x11')));},'filename':function(_0x43a06f,_0x1e05d6,_0x31ebc3){_0x1e05d6[_0x7bf6('0x12')]=_0x1e05d6['originalname'][_0x7bf6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x31ebc3(null,util[_0x7bf6('0x14')](_0x7bf6('0x15'),path['basename'](_0x1e05d6[_0x7bf6('0x12')],path['extname'](_0x1e05d6[_0x7bf6('0x12')])),Date['now'](),path[_0x7bf6('0x16')](_0x1e05d6[_0x7bf6('0x12')])));}})});router[_0x7bf6('0x17')]('/',upload['single']('file'),controller[_0x7bf6('0x18')]);router[_0x7bf6('0x17')](_0x7bf6('0xa'),controller['webhookPost']);router[_0x7bf6('0x19')]('/:id',auth[_0x7bf6('0x8')](),controller[_0x7bf6('0x1a')]);router[_0x7bf6('0x1b')](_0x7bf6('0x1c'),auth[_0x7bf6('0x8')](),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 e7c43ba..49a5fef 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 _0x0a6d=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING'];(function(_0x28cac9,_0x221757){var _0x26035a=function(_0x5d111e){while(--_0x5d111e){_0x28cac9['push'](_0x28cac9['shift']());}};_0x26035a(++_0x221757);}(_0x0a6d,0xd1));var _0xd0a6=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0a6d[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0xd0a6('0x0'));module[_0xd0a6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd0a6('0x2')](_0xd0a6('0x3'),_0xd0a6('0x4'))},'description':{'type':Sequelize[_0xd0a6('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd0a6('0x6')],'comment':_0xd0a6('0x7')},'active':{'type':Sequelize[_0xd0a6('0x8')],'defaultValue':0x0,'comment':_0xd0a6('0x9')},'sidebar':{'type':Sequelize[_0xd0a6('0x2')]('adminOnly','agentOnly','always',_0xd0a6('0xa')),'defaultValue':'always','comment':_0xd0a6('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xd0a6('0x6')]},'agentUrl':{'type':Sequelize[_0xd0a6('0x6')]},'scriptName':{'type':Sequelize[_0xd0a6('0x6')]},'scriptPath':{'type':Sequelize[_0xd0a6('0x6')]}}; \ No newline at end of file +var _0xe3b2=['sequelize','ENUM','script','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','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x22faff,_0x1de256){var _0x46cc2a=function(_0xb18230){while(--_0xb18230){_0x22faff['push'](_0x22faff['shift']());}};_0x46cc2a(++_0x1de256);}(_0xe3b2,0x1ee));var _0x2e3b=function(_0x463f44,_0xc071ff){_0x463f44=_0x463f44-0x0;var _0x304163=_0xe3b2[_0x463f44];return _0x304163;};'use strict';var Sequelize=require(_0x2e3b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2e3b('0x1')]('html',_0x2e3b('0x2'))},'description':{'type':Sequelize[_0x2e3b('0x3')]},'version':{'type':Sequelize[_0x2e3b('0x3')]},'path':{'type':Sequelize[_0x2e3b('0x4')],'comment':_0x2e3b('0x5')},'active':{'type':Sequelize[_0x2e3b('0x6')],'defaultValue':0x0,'comment':_0x2e3b('0x7')},'sidebar':{'type':Sequelize[_0x2e3b('0x1')](_0x2e3b('0x8'),_0x2e3b('0x9'),_0x2e3b('0xa'),_0x2e3b('0xb')),'defaultValue':_0x2e3b('0xa'),'comment':_0x2e3b('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x2e3b('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x2e3b('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 3ba9744..e4d7d1a 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 _0x6849=['query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','catch','show','params','rawAttributes','include','options','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','admin','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','test','body','role','UserProfileSection','Plugins','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','html-pdf','eml-format','zip-dir','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','Plugin','type','key','model','keys','filters','intersection'];(function(_0x196574,_0x3d72d5){var _0x5698e2=function(_0x205eb8){while(--_0x205eb8){_0x196574['push'](_0x196574['shift']());}};_0x5698e2(++_0x3d72d5);}(_0x6849,0x72));var _0x9684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6849[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x9684('0x0'));var emlformat=require(_0x9684('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9684('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9684('0x3'));var util=require(_0x9684('0x4'));var path=require(_0x9684('0x5'));var sox=require(_0x9684('0x6'));var csv=require(_0x9684('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9684('0x8'));var squel=require(_0x9684('0x9'));var crypto=require('crypto');var jsforce=require(_0x9684('0xa'));var deskjs=require(_0x9684('0xb'));var toCsv=require(_0x9684('0x7'));var querystring=require('querystring');var Papa=require(_0x9684('0xc'));var extract=require(_0x9684('0xd'));var rimraf=require(_0x9684('0xe'));var archiver=require(_0x9684('0xf'));var Redis=require(_0x9684('0x10'));var authService=require(_0x9684('0x11'));var qs=require(_0x9684('0x12'));var as=require(_0x9684('0x13'));var hardwareService=require(_0x9684('0x14'));var logger=require(_0x9684('0x15'))(_0x9684('0x16'));var utils=require(_0x9684('0x17'));var config=require(_0x9684('0x18'));var db=require(_0x9684('0x19'))['db'];config['redis']=_['defaults'](config[_0x9684('0x1a')],{'host':_0x9684('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9684('0x1a')]));require(_0x9684('0x1c'))['register'](socket);function respondWithStatusCode(_0x1535ad,_0x4eff00){_0x4eff00=_0x4eff00||0xcc;return function(_0x237a54){if(_0x237a54){return _0x1535ad[_0x9684('0x1d')](_0x4eff00);}return _0x1535ad['status'](_0x4eff00)[_0x9684('0x1e')]();};}function respondWithResult(_0x1bc60b,_0x5cbf4d){_0x5cbf4d=_0x5cbf4d||0xc8;return function(_0x15d1ad){if(_0x15d1ad){return _0x1bc60b[_0x9684('0x1f')](_0x5cbf4d)[_0x9684('0x20')](_0x15d1ad);}};}function respondWithFilteredResult(_0x851974,_0x321a3e){return function(_0x225b0b){if(_0x225b0b){var _0x412049=_0x225b0b[_0x9684('0x21')],_0x5a1df0=_0x321a3e[_0x9684('0x22')],_0x40b1e9=_0x321a3e[_0x9684('0x22')]+_0x321a3e[_0x9684('0x23')],_0x41fd7d;if(_0x40b1e9>=_0x412049){_0x40b1e9=_0x412049;_0x41fd7d=0xc8;}else{_0x41fd7d=0xce;}_0x851974['status'](_0x41fd7d);return _0x851974[_0x9684('0x24')](_0x9684('0x25'),_0x5a1df0+'-'+_0x40b1e9+'/'+_0x412049)[_0x9684('0x20')](_0x225b0b);}return null;};}function patchUpdates(_0x3e8814){return function(_0xf80410){try{jsonpatch['apply'](_0xf80410,_0x3e8814,!![]);}catch(_0x2638da){return BPromise[_0x9684('0x26')](_0x2638da);}return _0xf80410[_0x9684('0x27')]();};}function saveUpdates(_0x37926f,_0x3a938e){return function(_0x2ee3ab){if(_0x2ee3ab){return _0x2ee3ab['update'](_0x37926f)[_0x9684('0x28')](function(_0x19cdfa){return _0x19cdfa;});}return null;};}function removeEntity(_0x1b8d8e,_0x432882){return function(_0x4eaad2){if(_0x4eaad2){return _0x4eaad2['destroy']()[_0x9684('0x28')](function(){var _0x1275fb=_0x4eaad2[_0x9684('0x29')]({'plain':!![]});var _0x35acd5='Plugins';return db[_0x9684('0x2a')][_0x9684('0x2b')]({'where':{'type':_0x35acd5,'resourceId':_0x1275fb['id']}})[_0x9684('0x28')](function(){return _0x4eaad2;});})[_0x9684('0x28')](function(){_0x1b8d8e[_0x9684('0x1f')](0xcc)[_0x9684('0x1e')]();});}};}function handleEntityNotFound(_0x2930c2,_0x3c0b99){return function(_0x350f5b){if(!_0x350f5b){_0x2930c2[_0x9684('0x1d')](0x194);}return _0x350f5b;};}function handleError(_0x2431e0,_0x3c605b){_0x3c605b=_0x3c605b||0x1f4;return function(_0x4ffe87){logger[_0x9684('0x2c')](_0x4ffe87[_0x9684('0x2d')]);if(_0x4ffe87['name']){delete _0x4ffe87[_0x9684('0x2e')];}_0x2431e0[_0x9684('0x1f')](_0x3c605b)[_0x9684('0x2f')](_0x4ffe87);};}exports['index']=function(_0x368eeb,_0x21a884){var _0x3714ce={},_0x4bb5a0={},_0x4cb8bf={'count':0x0,'rows':[]};var _0x23d205=_[_0x9684('0x30')](db[_0x9684('0x31')]['rawAttributes'],function(_0x2ff90b){return{'name':_0x2ff90b['fieldName'],'type':_0x2ff90b[_0x9684('0x32')][_0x9684('0x33')]};});_0x4bb5a0[_0x9684('0x34')]=_[_0x9684('0x30')](_0x23d205,_0x9684('0x2e'));_0x4bb5a0['query']=_[_0x9684('0x35')](_0x368eeb['query']);_0x4bb5a0[_0x9684('0x36')]=_[_0x9684('0x37')](_0x4bb5a0[_0x9684('0x34')],_0x4bb5a0[_0x9684('0x38')]);_0x3714ce[_0x9684('0x39')]=_[_0x9684('0x37')](_0x4bb5a0[_0x9684('0x34')],qs[_0x9684('0x3a')](_0x368eeb[_0x9684('0x38')][_0x9684('0x3a')]));_0x3714ce[_0x9684('0x39')]=_0x3714ce['attributes'][_0x9684('0x3b')]?_0x3714ce['attributes']:_0x4bb5a0['model'];if(!_0x368eeb[_0x9684('0x38')][_0x9684('0x3c')](_0x9684('0x3d'))){_0x3714ce[_0x9684('0x23')]=qs[_0x9684('0x23')](_0x368eeb[_0x9684('0x38')][_0x9684('0x23')]);_0x3714ce[_0x9684('0x22')]=qs[_0x9684('0x22')](_0x368eeb[_0x9684('0x38')]['offset']);}_0x3714ce['order']=qs['sort'](_0x368eeb[_0x9684('0x38')][_0x9684('0x3e')]);_0x3714ce['where']=qs[_0x9684('0x36')](_[_0x9684('0x3f')](_0x368eeb['query'],_0x4bb5a0[_0x9684('0x36')]),_0x23d205);if(_0x368eeb[_0x9684('0x38')]['filter']){_0x3714ce[_0x9684('0x40')]=_[_0x9684('0x41')](_0x3714ce[_0x9684('0x40')],{'$or':_[_0x9684('0x30')](_0x23d205,function(_0x5a80f4){if(_0x5a80f4[_0x9684('0x32')]!==_0x9684('0x42')){var _0x4a8b45={};_0x4a8b45[_0x5a80f4[_0x9684('0x2e')]]={'$like':'%'+_0x368eeb[_0x9684('0x38')][_0x9684('0x43')]+'%'};return _0x4a8b45;}})});}_0x3714ce=_[_0x9684('0x41')]({},_0x3714ce,_0x368eeb['options']);var _0x26a4b2={'where':_0x3714ce[_0x9684('0x40')]};return db[_0x9684('0x31')]['count'](_0x26a4b2)[_0x9684('0x28')](function(_0x4b8852){_0x4cb8bf[_0x9684('0x21')]=_0x4b8852;if(_0x368eeb['query'][_0x9684('0x44')]){_0x3714ce['include']=[{'all':!![]}];}return db[_0x9684('0x31')][_0x9684('0x45')](_0x3714ce);})[_0x9684('0x28')](function(_0x324a27){_0x4cb8bf['rows']=_0x324a27;return _0x4cb8bf;})[_0x9684('0x28')](respondWithFilteredResult(_0x21a884,_0x3714ce))[_0x9684('0x46')](handleError(_0x21a884,null));};exports[_0x9684('0x47')]=function(_0x30f1be,_0x163709){var _0x1f3ec1={'raw':!![],'where':{'id':_0x30f1be[_0x9684('0x48')]['id']}},_0x43c9d2={};_0x43c9d2[_0x9684('0x34')]=_['keys'](db[_0x9684('0x31')][_0x9684('0x49')]);_0x43c9d2[_0x9684('0x38')]=_[_0x9684('0x35')](_0x30f1be[_0x9684('0x38')]);_0x43c9d2['filters']=_[_0x9684('0x37')](_0x43c9d2[_0x9684('0x34')],_0x43c9d2['query']);_0x1f3ec1[_0x9684('0x39')]=_[_0x9684('0x37')](_0x43c9d2[_0x9684('0x34')],qs['fields'](_0x30f1be['query'][_0x9684('0x3a')]));_0x1f3ec1['attributes']=_0x1f3ec1[_0x9684('0x39')][_0x9684('0x3b')]?_0x1f3ec1[_0x9684('0x39')]:_0x43c9d2[_0x9684('0x34')];if(_0x30f1be[_0x9684('0x38')]['includeAll']){_0x1f3ec1[_0x9684('0x4a')]=[{'all':!![]}];}_0x1f3ec1=_[_0x9684('0x41')]({},_0x1f3ec1,_0x30f1be[_0x9684('0x4b')]);return db[_0x9684('0x31')]['find'](_0x1f3ec1)['then'](handleEntityNotFound(_0x163709,null))[_0x9684('0x28')](respondWithResult(_0x163709,null))[_0x9684('0x46')](handleError(_0x163709,null));};exports[_0x9684('0x4c')]=function(_0x1751df,_0x5d4de2,_0x1eb56d){return db[_0x9684('0x31')][_0x9684('0x4d')]({'where':{'id':_0x1751df[_0x9684('0x48')]['id']},'attributes':[_0x9684('0x2e'),'path'],'raw':!![]})[_0x9684('0x28')](handleEntityNotFound(_0x5d4de2,null))[_0x9684('0x28')](function(_0x26c500){if(_0x26c500){var _0x3f0b85=path[_0x9684('0x4e')](config[_0x9684('0x4f')],_0x9684('0x50'),util[_0x9684('0x51')](_0x9684('0x52'),path[_0x9684('0x53')](_0x26c500['path'])));var _0x1edc5a=fs[_0x9684('0x54')](_0x3f0b85);var _0x20ac41=archiver(_0x9684('0x55'),{'zlib':{'level':0x9}});_0x20ac41['on'](_0x9684('0x56'),function(_0xe7b846){if(_0xe7b846[_0x9684('0x57')]===_0x9684('0x58')){logger[_0x9684('0x2c')](_0xe7b846);}else{throw new db[(_0x9684('0x59'))]['Error'](_0x9684('0x5a'));}});_0x20ac41['on'](_0x9684('0x2c'),function(_0xd9d6c1){throw new db['Sequelize'][(_0x9684('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x20ac41[_0x9684('0x5c')](_0x1edc5a);_0x20ac41[_0x9684('0x5d')](_0x9684('0x5e'),{'cwd':path['join'](config[_0x9684('0x4f')],_0x9684('0x50'),path['dirname'](_0x26c500['path'])),'ignore':[path[_0x9684('0x4e')](path[_0x9684('0x53')](_0x26c500[_0x9684('0x5')]),_0x9684('0x5f')),path[_0x9684('0x4e')](path[_0x9684('0x53')](_0x26c500['path']),_0x9684('0x60'))],'nodir':!![]})[_0x9684('0x61')]();_0x1edc5a['on']('close',function(){if(!fs[_0x9684('0x62')](_0x3f0b85)){throw new db[(_0x9684('0x59'))][(_0x9684('0x5b'))](_0x9684('0x63'));}return _0x5d4de2[_0x9684('0x4c')](_0x3f0b85,util['format'](_0x9684('0x52'),path[_0x9684('0x53')](_0x26c500[_0x9684('0x5')])),function(_0x142d6a){if(_0x142d6a){throw new db['Sequelize'][(_0x9684('0x5b'))](_0x9684('0x64'));}fs['unlinkSync'](_0x3f0b85);logger[_0x9684('0x65')](_0x9684('0x66'));logger[_0x9684('0x65')](_0x9684('0x67'));});});}return null;})['catch'](handleError(_0x5d4de2,null));};exports[_0x9684('0x68')]=function(_0x14c634,_0x51c10c,_0x5f2d67){var _0x45ccea=path[_0x9684('0x53')](_0x14c634[_0x9684('0x69')]['filename'],path[_0x9684('0x6a')](_0x14c634[_0x9684('0x69')][_0x9684('0x6b')]));var _0x4e80db=path['join'](config[_0x9684('0x4f')],'server/files/plugins',_0x14c634['file'][_0x9684('0x6b')]);var _0x3b4e77=path['join'](config[_0x9684('0x4f')],_0x9684('0x50'),_0x45ccea);logger[_0x9684('0x65')](_0x9684('0x6c'),_0x4e80db);logger[_0x9684('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x3b4e77);try{fs[_0x9684('0x6d')](_0x4e80db,parseInt(_0x9684('0x6e'),0x8));extract(_0x4e80db,{'dir':_0x3b4e77},function(_0x4515e2){if(_0x4515e2){logger[_0x9684('0x2c')](_0x4515e2);handleError(_0x4515e2,!![]);};var _0x2551f4=fs[_0x9684('0x6f')](_0x3b4e77);if(_0x2551f4[_0x9684('0x3b')]>0x1){removeReferences(_0x4e80db,_0x3b4e77);logger[_0x9684('0x2c')]('Invalid\x20plugin\x20structure');return _0x5f2d67(new Error(_0x9684('0x70')));}var _0x14148d=fs[_0x9684('0x71')](path['join'](_0x3b4e77,_0x2551f4[0x0]));if(_0x14148d[_0x9684('0x72')]()){removeReferences(_0x4e80db,_0x3b4e77);logger[_0x9684('0x2c')](_0x9684('0x70'));return _0x5f2d67(new Error('Invalid\x20plugin\x20structure'));}if(_0x14148d[_0x9684('0x73')]()){var _0x41bf6d=fs[_0x9684('0x6f')](path['join'](_0x3b4e77,_0x2551f4[0x0]));if(_0x41bf6d['length']===0x0){removeReferences(_0x4e80db,_0x3b4e77);logger['error']('Invalid\x20plugin\x20structure');return _0x5f2d67(new Error(_0x9684('0x70')));}var _0x5b9ad5=_0x41bf6d['some'](function(_0x46bd70){return _0x46bd70===_0x9684('0x74');});if(!_0x5b9ad5){return _0x5f2d67(new Error(_0x9684('0x75')));}var _0x3f9c1d=fs[_0x9684('0x76')](path[_0x9684('0x4e')](_0x3b4e77,_0x2551f4[0x0],_0x9684('0x74')));var _0x5c046d=JSON[_0x9684('0x77')](_0x3f9c1d);if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x2e')]){return _0x5f2d67(new Error(_0x9684('0x79')));}if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x32')]){return _0x5f2d67(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x5c046d[_0x9684('0x7a')]){return _0x5f2d67(new Error(_0x9684('0x7b')));}if(_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x7c')]){return _0x5f2d67(new Error(_0x9684('0x7d')));}if(_0x5c046d[_0x9684('0x32')]===_0x9684('0x7e')){if('undefined'==typeof _0x5c046d['parameters']['views']){return _0x5f2d67(new Error(_0x9684('0x7f')));}if('undefined'==typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')]['admin']&&_0x9684('0x78')==typeof _0x5c046d[_0x9684('0x7c')]['views'][_0x9684('0x81')]){return _0x5f2d67(new Error(_0x9684('0x82')));}}else if(_0x5c046d['type']==='script'){if(_0x9684('0x78')==typeof _0x5c046d['parameters'][_0x9684('0x83')]){return _0x5f2d67(new Error(_0x9684('0x84')));}if(_0x9684('0x78')==typeof _0x5c046d['parameters'][_0x9684('0x85')]){return _0x5f2d67(new Error(_0x9684('0x86')));}}else{return _0x5f2d67(new Error(_0x9684('0x87')));}var _0x13f2e4=_0x5c046d[_0x9684('0x2e')];var _0x241ba2=_0x5c046d['description'];var _0x4136aa=_0x5c046d[_0x9684('0x32')];var _0x1a65ce=_0x5c046d[_0x9684('0x88')]?_0x5c046d['sidebar']:_0x9684('0x89');var _0x4aef2c=_0x5c046d[_0x9684('0x8a')]?_0x5c046d[_0x9684('0x8a')]:_0x9684('0x8b');var _0xde4ae0='';var _0x26d1a6='';var _0x490375='';var _0x2e711c='';var _0x4dad75=_0x5c046d['version'];if(_0x4136aa===_0x9684('0x7e')){if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')]){var _0x598a45=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x598a45)){_0xde4ae0=path['join'](_0x9684('0x8d'),_0x45ccea,_0x2551f4[0x0],_0x598a45);}else{_0xde4ae0=_0x598a45;}}else{logger[_0x9684('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x81')]){var _0x3d0e39=_0x5c046d['parameters']['views'][_0x9684('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d0e39)){_0x26d1a6=path['join']('plugins',_0x45ccea,_0x2551f4[0x0],_0x3d0e39);}else{_0x26d1a6=_0x3d0e39;}}else{logger['info'](_0x9684('0x8e'));}}else if(_0x4136aa===_0x9684('0x8f')){_0x490375=_0x5c046d['parameters']['scriptName'];_0x2e711c=_0x5c046d[_0x9684('0x7c')][_0x9684('0x85')];if('undefined'!=typeof _0x5c046d[_0x9684('0x7c')]['views']){if(_0x9684('0x78')!=typeof _0x5c046d['parameters'][_0x9684('0x80')]['admin']){var _0x598a45=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x9684('0x90')](_0x598a45)){_0xde4ae0=path['join']('plugins',_0x45ccea,_0x2551f4[0x0],_0x598a45);}else{_0xde4ae0=_0x598a45;}}if(_0x9684('0x78')!=typeof _0x5c046d[_0x9684('0x7c')][_0x9684('0x80')]['agent']){var _0x3d0e39=_0x5c046d[_0x9684('0x7c')][_0x9684('0x80')][_0x9684('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x9684('0x90')](_0x3d0e39)){_0x26d1a6=path[_0x9684('0x4e')](_0x9684('0x8d'),_0x45ccea,_0x2551f4[0x0],_0x3d0e39);}else{_0x26d1a6=_0x3d0e39;}}}}var _0x1c11d8={'name':_0x13f2e4,'description':_0x241ba2,'path':path[_0x9684('0x4e')](_0x45ccea,_0x2551f4[0x0]),'type':_0x4136aa,'sidebar':_0x1a65ce,'icon':_0x4aef2c,'adminUrl':_0xde4ae0,'agentUrl':_0x26d1a6,'scriptName':_0x490375,'scriptPath':_0x2e711c,'version':_0x4dad75};removeReferences(_0x4e80db,null);return db[_0x9684('0x31')]['create'](_0x1c11d8)[_0x9684('0x28')](function(_0x984249){var _0x4e4c1e={'role':_0x14c634[_0x9684('0x91')][_0x9684('0x92')],'userProfileId':_0x14c634[_0x9684('0x91')]['userProfileId']};if(!_0x4e4c1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e4c1e[_0x9684('0x92')]==='user'){var _0xf74495=_0x984249[_0x9684('0x29')]({'plain':!![]});return db[_0x9684('0x93')][_0x9684('0x4d')]({'where':{'name':_0x9684('0x94'),'userProfileId':_0x4e4c1e[_0x9684('0x95')]},'raw':!![]})[_0x9684('0x28')](function(_0x3fecf7){if(_0x3fecf7&&_0x3fecf7[_0x9684('0x96')]===0x0){return db[_0x9684('0x2a')][_0x9684('0x97')]({'name':_0xf74495[_0x9684('0x2e')],'resourceId':_0xf74495['id'],'type':_0x3fecf7[_0x9684('0x2e')],'sectionId':_0x3fecf7['id']},{})[_0x9684('0x28')](function(){return _0x984249;});}else{return _0x984249;}})[_0x9684('0x46')](function(_0x41f58f){logger[_0x9684('0x2c')](_0x9684('0x98'),_0x41f58f);throw _0x41f58f;});}return _0x984249;})['then'](respondWithResult(_0x51c10c,null))[_0x9684('0x46')](handleError(_0x51c10c,null));}});}catch(_0x20e20b){_0x51c10c[_0x9684('0x1f')](0x1f4)[_0x9684('0x2f')](_0x20e20b);}};function removeReferences(_0x570a7b,_0x46f9ea){try{if(_0x570a7b){fs['unlinkSync'](_0x570a7b);logger[_0x9684('0x65')]('Zip\x20archive\x20removed');}if(_0x46f9ea){rimraf(_0x46f9ea,function(){});logger[_0x9684('0x65')](_0x9684('0x99'));}}catch(_0x166c4b){logger[_0x9684('0x2c')](_0x166c4b);}}exports[_0x9684('0x9a')]=function(_0x1f4766,_0x440080,_0xdb0934){return db['Plugin']['find']({'where':{'id':_0x1f4766[_0x9684('0x48')]['id']}})[_0x9684('0x28')](handleEntityNotFound(_0x440080,null))['then'](saveUpdates(_0x1f4766[_0x9684('0x91')],null))[_0x9684('0x28')](respondWithResult(_0x440080,null))['catch'](handleError(_0x440080,null));};exports['delete']=function(_0x1d6671,_0x1eef26,_0xe11ded){return db[_0x9684('0x31')][_0x9684('0x4d')]({'where':{'id':_0x1d6671[_0x9684('0x48')]['id']}})[_0x9684('0x28')](function(_0xfddabb){if(_0xfddabb){return _0xfddabb[_0x9684('0x2b')]();}})[_0x9684('0x28')](function(_0xd9ac1d){rimraf(path[_0x9684('0x4e')](config['root'],_0x9684('0x50'),path[_0x9684('0x9b')](_0xd9ac1d[_0x9684('0x5')])),function(){});return _0xd9ac1d;})['then'](handleEntityNotFound(_0x1eef26,null))[_0x9684('0x28')](respondWithStatusCode(_0x1eef26,null))['catch'](handleError(_0x1eef26,null));};exports[_0x9684('0x9c')]=function(_0x2e2b5a,_0x28cd4e,_0x468c71){return BPromise['resolve']()['then'](function(){if(!_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')]){throw new Error(_0x9684('0x9d'));}if(!_0x2e2b5a[_0x9684('0x38')]['port']){throw new Error(_0x9684('0x9e'));}var _0xc0c15e=_0x2e2b5a[_0x9684('0x38')]['hostname']?_0x2e2b5a[_0x9684('0x38')][_0x9684('0x9f')]+':'+_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa0')]:'http://localhost:'+_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa0')];var _0x2e4a46=_0x2e2b5a[_0x9684('0x38')]['json']?_0x2e2b5a[_0x9684('0x38')]['json']:!![];var _0x1015f3=_0x2e2b5a[_0x9684('0x38')][_0x9684('0xa1')]?_0x2e2b5a[_0x9684('0x38')]['encoding']:null;var _0x1acf86={'method':_0x2e2b5a[_0x9684('0xa2')],'uri':util[_0x9684('0x51')]('%s%s',_0xc0c15e,_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')]),'json':_0x2e4a46,'resolveWithFullResponse':!![],'encoding':_0x1015f3,'qs':_0x2e2b5a[_0x9684('0x38')]};if(_0x2e2b5a['headers']){_0x1acf86['headers']=_0x2e2b5a[_0x9684('0xa3')];if(_0x1acf86[_0x9684('0xa3')][_0x9684('0xa4')]){delete _0x1acf86[_0x9684('0xa3')][_0x9684('0xa4')];}}if(_0x1acf86[_0x9684('0xa3')]['content-type']){delete _0x1acf86[_0x9684('0xa3')][_0x9684('0xa5')];}return rp(_0x1acf86);})['then'](function(_0x743aca){if(_0x743aca){_0x28cd4e['set'](_0x743aca[_0x9684('0xa3')]);logger[_0x9684('0x65')](_0x743aca[_0x9684('0x91')]);if(_[_0x9684('0xa6')](_0x2e2b5a[_0x9684('0x38')][_0x9684('0x5')],_0x9684('0x4c'))&&_0x743aca[_0x9684('0xa7')]==0x1f4){return _0x28cd4e[_0x9684('0x1d')](_0x743aca[_0x9684('0xa7')]);}else{return _0x28cd4e[_0x9684('0x1f')](_0x743aca[_0x9684('0xa7')])[_0x9684('0x2f')](_0x743aca[_0x9684('0x91')]);}}else{return _0x28cd4e['sendStatus'](0xc8);}})[_0x9684('0x46')](handleError(_0x28cd4e,null));};exports[_0x9684('0xa8')]=function(_0x2d6384,_0x29c34a,_0x500ac8){return BPromise['resolve']()[_0x9684('0x28')](function(){if(!_0x2d6384['query'][_0x9684('0x5')]){throw new Error(_0x9684('0x9d'));}if(!_0x2d6384[_0x9684('0x38')][_0x9684('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x47c37=_0x2d6384['query'][_0x9684('0x9f')]?_0x2d6384[_0x9684('0x38')][_0x9684('0x9f')]+':'+_0x2d6384[_0x9684('0x38')][_0x9684('0xa0')]:'http://localhost:'+_0x2d6384[_0x9684('0x38')]['port'];var _0x5df0f6=_0x2d6384[_0x9684('0x38')][_0x9684('0x20')]?_0x2d6384[_0x9684('0x38')][_0x9684('0x20')]:!![];var _0x1fec79=_0x2d6384[_0x9684('0x38')][_0x9684('0xa1')]?_0x2d6384[_0x9684('0x38')]['encoding']:null;var _0x1796fe={'method':_0x2d6384[_0x9684('0xa2')],'uri':util[_0x9684('0x51')](_0x9684('0xa9'),_0x47c37,_0x2d6384[_0x9684('0x38')][_0x9684('0x5')]),'json':_0x5df0f6,'resolveWithFullResponse':!![],'encoding':_0x1fec79,'body':_0x2d6384[_0x9684('0x91')]};if(_0x2d6384[_0x9684('0xa3')]){_0x1796fe[_0x9684('0xa3')]=_0x2d6384['headers'];if(_0x1796fe[_0x9684('0xa3')][_0x9684('0xa4')]){delete _0x1796fe['headers'][_0x9684('0xa4')];}}if(_0x1796fe[_0x9684('0xa3')][_0x9684('0xa5')]){delete _0x1796fe[_0x9684('0xa3')][_0x9684('0xa5')];}return rp(_0x1796fe);})[_0x9684('0x28')](function(_0x5ba116){if(_0x5ba116){_0x29c34a['set'](_0x5ba116['headers']);logger[_0x9684('0x65')](_0x5ba116[_0x9684('0x91')]);return _0x29c34a['status'](_0x5ba116['statusCode'])[_0x9684('0x2f')](_0x5ba116[_0x9684('0x91')]);}else{return _0x29c34a[_0x9684('0x1d')](0xc8);}})[_0x9684('0x46')](handleError(_0x29c34a,null));}; \ No newline at end of file +var _0xf2da=['rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','filter','where','merge','options','includeAll','include','findAll','catch','show','params','find','download','root','basename','zip','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','extname','filename','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','then','get','Plugins','destroy','stack','send','index','map','Plugin'];(function(_0x368acc,_0x133420){var _0x502e88=function(_0x3a5dfe){while(--_0x3a5dfe){_0x368acc['push'](_0x368acc['shift']());}};_0x502e88(++_0x133420);}(_0xf2da,0x11a));var _0xaf2d=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xf2da[_0x1757f2];return _0x5e7212;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaf2d('0x0'));var zipdir=require(_0xaf2d('0x1'));var jsonpatch=require(_0xaf2d('0x2'));var rp=require(_0xaf2d('0x3'));var moment=require('moment');var BPromise=require(_0xaf2d('0x4'));var Mustache=require('mustache');var util=require(_0xaf2d('0x5'));var path=require(_0xaf2d('0x6'));var sox=require(_0xaf2d('0x7'));var csv=require(_0xaf2d('0x8'));var ejs=require(_0xaf2d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf2d('0xa'));var crypto=require(_0xaf2d('0xb'));var jsforce=require(_0xaf2d('0xc'));var deskjs=require(_0xaf2d('0xd'));var toCsv=require(_0xaf2d('0x8'));var querystring=require(_0xaf2d('0xe'));var Papa=require('papaparse');var extract=require(_0xaf2d('0xf'));var rimraf=require(_0xaf2d('0x0'));var archiver=require(_0xaf2d('0x10'));var Redis=require(_0xaf2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaf2d('0x12'));var as=require(_0xaf2d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf2d('0x14'))(_0xaf2d('0x15'));var utils=require(_0xaf2d('0x16'));var config=require('../../config/environment');var db=require(_0xaf2d('0x17'))['db'];config['redis']=_[_0xaf2d('0x18')](config[_0xaf2d('0x19')],{'host':_0xaf2d('0x1a'),'port':0x18eb});var socket=require(_0xaf2d('0x1b'))(new Redis(config[_0xaf2d('0x19')]));require(_0xaf2d('0x1c'))[_0xaf2d('0x1d')](socket);function respondWithStatusCode(_0x536e96,_0x2a6b10){_0x2a6b10=_0x2a6b10||0xcc;return function(_0x25d589){if(_0x25d589){return _0x536e96[_0xaf2d('0x1e')](_0x2a6b10);}return _0x536e96[_0xaf2d('0x1f')](_0x2a6b10)[_0xaf2d('0x20')]();};}function respondWithResult(_0x3333f7,_0x205aeb){_0x205aeb=_0x205aeb||0xc8;return function(_0x911274){if(_0x911274){return _0x3333f7['status'](_0x205aeb)['json'](_0x911274);}};}function respondWithFilteredResult(_0x42d214,_0x30dfb1){return function(_0x3f61e8){if(_0x3f61e8){var _0x41f633=_0x3f61e8[_0xaf2d('0x21')],_0x38b21c=_0x30dfb1[_0xaf2d('0x22')],_0x5acd5f=_0x30dfb1[_0xaf2d('0x22')]+_0x30dfb1[_0xaf2d('0x23')],_0x1fccec;if(_0x5acd5f>=_0x41f633){_0x5acd5f=_0x41f633;_0x1fccec=0xc8;}else{_0x1fccec=0xce;}_0x42d214[_0xaf2d('0x1f')](_0x1fccec);return _0x42d214[_0xaf2d('0x24')]('Content-Range',_0x38b21c+'-'+_0x5acd5f+'/'+_0x41f633)[_0xaf2d('0x25')](_0x3f61e8);}return null;};}function patchUpdates(_0x4c85b7){return function(_0x42ecdd){try{jsonpatch[_0xaf2d('0x26')](_0x42ecdd,_0x4c85b7,!![]);}catch(_0x5f529f){return BPromise['reject'](_0x5f529f);}return _0x42ecdd['save']();};}function saveUpdates(_0x21eb9c,_0x3b1c24){return function(_0x3b926a){if(_0x3b926a){return _0x3b926a['update'](_0x21eb9c)[_0xaf2d('0x27')](function(_0x22334f){return _0x22334f;});}return null;};}function removeEntity(_0xb460c5,_0xe687b2){return function(_0x3d5957){if(_0x3d5957){return _0x3d5957['destroy']()[_0xaf2d('0x27')](function(){var _0x1c98df=_0x3d5957[_0xaf2d('0x28')]({'plain':!![]});var _0xa926=_0xaf2d('0x29');return db['UserProfileResource'][_0xaf2d('0x2a')]({'where':{'type':_0xa926,'resourceId':_0x1c98df['id']}})[_0xaf2d('0x27')](function(){return _0x3d5957;});})[_0xaf2d('0x27')](function(){_0xb460c5[_0xaf2d('0x1f')](0xcc)[_0xaf2d('0x20')]();});}};}function handleEntityNotFound(_0x576d1e,_0x1d0f2f){return function(_0x896d57){if(!_0x896d57){_0x576d1e[_0xaf2d('0x1e')](0x194);}return _0x896d57;};}function handleError(_0x12c58a,_0x1e8333){_0x1e8333=_0x1e8333||0x1f4;return function(_0x1b69b3){logger['error'](_0x1b69b3[_0xaf2d('0x2b')]);if(_0x1b69b3['name']){delete _0x1b69b3['name'];}_0x12c58a['status'](_0x1e8333)[_0xaf2d('0x2c')](_0x1b69b3);};}exports[_0xaf2d('0x2d')]=function(_0x23bc60,_0x398286){var _0x109407={},_0x5d4101={},_0x2adb8b={'count':0x0,'rows':[]};var _0x56cc1b=_[_0xaf2d('0x2e')](db[_0xaf2d('0x2f')][_0xaf2d('0x30')],function(_0x12f7dc){return{'name':_0x12f7dc[_0xaf2d('0x31')],'type':_0x12f7dc[_0xaf2d('0x32')][_0xaf2d('0x33')]};});_0x5d4101[_0xaf2d('0x34')]=_[_0xaf2d('0x2e')](_0x56cc1b,_0xaf2d('0x35'));_0x5d4101[_0xaf2d('0x36')]=_[_0xaf2d('0x37')](_0x23bc60[_0xaf2d('0x36')]);_0x5d4101['filters']=_[_0xaf2d('0x38')](_0x5d4101[_0xaf2d('0x34')],_0x5d4101[_0xaf2d('0x36')]);_0x109407[_0xaf2d('0x39')]=_[_0xaf2d('0x38')](_0x5d4101['model'],qs[_0xaf2d('0x3a')](_0x23bc60['query'][_0xaf2d('0x3a')]));_0x109407[_0xaf2d('0x39')]=_0x109407[_0xaf2d('0x39')][_0xaf2d('0x3b')]?_0x109407[_0xaf2d('0x39')]:_0x5d4101[_0xaf2d('0x34')];if(!_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x3c')]('nolimit')){_0x109407['limit']=qs['limit'](_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x23')]);_0x109407[_0xaf2d('0x22')]=qs[_0xaf2d('0x22')](_0x23bc60[_0xaf2d('0x36')]['offset']);}_0x109407['order']=qs[_0xaf2d('0x3d')](_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x3d')]);_0x109407['where']=qs[_0xaf2d('0x3e')](_['pick'](_0x23bc60[_0xaf2d('0x36')],_0x5d4101['filters']),_0x56cc1b);if(_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x3f')]){_0x109407[_0xaf2d('0x40')]=_[_0xaf2d('0x41')](_0x109407[_0xaf2d('0x40')],{'$or':_[_0xaf2d('0x2e')](_0x56cc1b,function(_0x4641e8){if(_0x4641e8[_0xaf2d('0x32')]!=='VIRTUAL'){var _0x2b0db1={};_0x2b0db1[_0x4641e8[_0xaf2d('0x35')]]={'$like':'%'+_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x3f')]+'%'};return _0x2b0db1;}})});}_0x109407=_[_0xaf2d('0x41')]({},_0x109407,_0x23bc60[_0xaf2d('0x42')]);var _0x347085={'where':_0x109407[_0xaf2d('0x40')]};return db[_0xaf2d('0x2f')][_0xaf2d('0x21')](_0x347085)[_0xaf2d('0x27')](function(_0x49b417){_0x2adb8b[_0xaf2d('0x21')]=_0x49b417;if(_0x23bc60[_0xaf2d('0x36')][_0xaf2d('0x43')]){_0x109407[_0xaf2d('0x44')]=[{'all':!![]}];}return db[_0xaf2d('0x2f')][_0xaf2d('0x45')](_0x109407);})['then'](function(_0x5f3d58){_0x2adb8b['rows']=_0x5f3d58;return _0x2adb8b;})[_0xaf2d('0x27')](respondWithFilteredResult(_0x398286,_0x109407))[_0xaf2d('0x46')](handleError(_0x398286,null));};exports[_0xaf2d('0x47')]=function(_0x15fb76,_0x2787b7){var _0x5d6bff={'raw':!![],'where':{'id':_0x15fb76[_0xaf2d('0x48')]['id']}},_0x2c3efa={};_0x2c3efa[_0xaf2d('0x34')]=_['keys'](db[_0xaf2d('0x2f')][_0xaf2d('0x30')]);_0x2c3efa[_0xaf2d('0x36')]=_[_0xaf2d('0x37')](_0x15fb76[_0xaf2d('0x36')]);_0x2c3efa[_0xaf2d('0x3e')]=_['intersection'](_0x2c3efa['model'],_0x2c3efa['query']);_0x5d6bff[_0xaf2d('0x39')]=_[_0xaf2d('0x38')](_0x2c3efa[_0xaf2d('0x34')],qs[_0xaf2d('0x3a')](_0x15fb76[_0xaf2d('0x36')][_0xaf2d('0x3a')]));_0x5d6bff[_0xaf2d('0x39')]=_0x5d6bff['attributes'][_0xaf2d('0x3b')]?_0x5d6bff[_0xaf2d('0x39')]:_0x2c3efa[_0xaf2d('0x34')];if(_0x15fb76[_0xaf2d('0x36')][_0xaf2d('0x43')]){_0x5d6bff['include']=[{'all':!![]}];}_0x5d6bff=_[_0xaf2d('0x41')]({},_0x5d6bff,_0x15fb76[_0xaf2d('0x42')]);return db[_0xaf2d('0x2f')][_0xaf2d('0x49')](_0x5d6bff)[_0xaf2d('0x27')](handleEntityNotFound(_0x2787b7,null))[_0xaf2d('0x27')](respondWithResult(_0x2787b7,null))[_0xaf2d('0x46')](handleError(_0x2787b7,null));};exports[_0xaf2d('0x4a')]=function(_0x33e9bc,_0x46c552,_0x56fbbe){return db[_0xaf2d('0x2f')][_0xaf2d('0x49')]({'where':{'id':_0x33e9bc[_0xaf2d('0x48')]['id']},'attributes':[_0xaf2d('0x35'),_0xaf2d('0x6')],'raw':!![]})[_0xaf2d('0x27')](handleEntityNotFound(_0x46c552,null))['then'](function(_0x2590ee){if(_0x2590ee){var _0x40c3c6=path['join'](config[_0xaf2d('0x4b')],'server/files/plugins',util['format']('%s.zip',path[_0xaf2d('0x4c')](_0x2590ee[_0xaf2d('0x6')])));var _0x650df5=fs['createWriteStream'](_0x40c3c6);var _0x98c54a=archiver(_0xaf2d('0x4d'),{'zlib':{'level':0x9}});_0x98c54a['on']('warning',function(_0x50edd3){if(_0x50edd3['code']===_0xaf2d('0x4e')){logger[_0xaf2d('0x4f')](_0x50edd3);}else{throw new db[(_0xaf2d('0x50'))][(_0xaf2d('0x51'))](_0xaf2d('0x52'));}});_0x98c54a['on']('error',function(_0xd887f5){throw new db['Sequelize'][(_0xaf2d('0x51'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x98c54a[_0xaf2d('0x53')](_0x650df5);_0x98c54a[_0xaf2d('0x54')](_0xaf2d('0x55'),{'cwd':path[_0xaf2d('0x56')](config[_0xaf2d('0x4b')],_0xaf2d('0x57'),path[_0xaf2d('0x58')](_0x2590ee[_0xaf2d('0x6')])),'ignore':[path['join'](path['basename'](_0x2590ee[_0xaf2d('0x6')]),_0xaf2d('0x59')),path[_0xaf2d('0x56')](path[_0xaf2d('0x4c')](_0x2590ee[_0xaf2d('0x6')]),_0xaf2d('0x5a'))],'nodir':!![]})[_0xaf2d('0x5b')]();_0x650df5['on']('close',function(){if(!fs[_0xaf2d('0x5c')](_0x40c3c6)){throw new db[(_0xaf2d('0x50'))][(_0xaf2d('0x51'))](_0xaf2d('0x5d'));}return _0x46c552['download'](_0x40c3c6,util[_0xaf2d('0x5e')]('%s.zip',path[_0xaf2d('0x4c')](_0x2590ee[_0xaf2d('0x6')])),function(_0x4dec4b){if(_0x4dec4b){throw new db[(_0xaf2d('0x50'))][(_0xaf2d('0x51'))](_0xaf2d('0x5f'));}fs['unlinkSync'](_0x40c3c6);logger[_0xaf2d('0x60')]('Download\x20completed');logger[_0xaf2d('0x60')](_0xaf2d('0x61'));});});}return null;})[_0xaf2d('0x46')](handleError(_0x46c552,null));};exports[_0xaf2d('0x62')]=function(_0x40ab1a,_0x31310d,_0x50bf0e){var _0x143bf7=path['basename'](_0x40ab1a[_0xaf2d('0x63')]['filename'],path[_0xaf2d('0x64')](_0x40ab1a[_0xaf2d('0x63')]['filename']));var _0x5c5c21=path[_0xaf2d('0x56')](config[_0xaf2d('0x4b')],_0xaf2d('0x57'),_0x40ab1a['file'][_0xaf2d('0x65')]);var _0x2934c3=path[_0xaf2d('0x56')](config[_0xaf2d('0x4b')],_0xaf2d('0x57'),_0x143bf7);logger[_0xaf2d('0x60')]('Plugin\x20upload\x20filepath:\x20%s',_0x5c5c21);logger[_0xaf2d('0x60')]('Plugin\x20upload\x20destination:\x20%s',_0x2934c3);try{fs[_0xaf2d('0x66')](_0x5c5c21,parseInt(_0xaf2d('0x67'),0x8));extract(_0x5c5c21,{'dir':_0x2934c3},function(_0x808a65){if(_0x808a65){logger['error'](_0x808a65);handleError(_0x808a65,!![]);};var _0x2cef57=fs[_0xaf2d('0x68')](_0x2934c3);if(_0x2cef57['length']>0x1){removeReferences(_0x5c5c21,_0x2934c3);logger[_0xaf2d('0x4f')](_0xaf2d('0x69'));return _0x50bf0e(new Error(_0xaf2d('0x69')));}var _0x5a6e18=fs[_0xaf2d('0x6a')](path[_0xaf2d('0x56')](_0x2934c3,_0x2cef57[0x0]));if(_0x5a6e18[_0xaf2d('0x6b')]()){removeReferences(_0x5c5c21,_0x2934c3);logger['error'](_0xaf2d('0x69'));return _0x50bf0e(new Error(_0xaf2d('0x69')));}if(_0x5a6e18[_0xaf2d('0x6c')]()){var _0x4b8ad6=fs[_0xaf2d('0x68')](path[_0xaf2d('0x56')](_0x2934c3,_0x2cef57[0x0]));if(_0x4b8ad6['length']===0x0){removeReferences(_0x5c5c21,_0x2934c3);logger[_0xaf2d('0x4f')](_0xaf2d('0x69'));return _0x50bf0e(new Error('Invalid\x20plugin\x20structure'));}var _0x1fd0d7=_0x4b8ad6[_0xaf2d('0x6d')](function(_0x186384){return _0x186384==='manifest.json';});if(!_0x1fd0d7){return _0x50bf0e(new Error(_0xaf2d('0x6e')));}var _0x3ab6a2=fs[_0xaf2d('0x6f')](path['join'](_0x2934c3,_0x2cef57[0x0],_0xaf2d('0x70')));var _0x5afcd2=JSON[_0xaf2d('0x71')](_0x3ab6a2);if(_0xaf2d('0x72')==typeof _0x5afcd2[_0xaf2d('0x35')]){return _0x50bf0e(new Error(_0xaf2d('0x73')));}if(_0xaf2d('0x72')==typeof _0x5afcd2[_0xaf2d('0x32')]){return _0x50bf0e(new Error(_0xaf2d('0x74')));}if(_0xaf2d('0x72')==typeof _0x5afcd2['version']){return _0x50bf0e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xaf2d('0x72')==typeof _0x5afcd2[_0xaf2d('0x75')]){return _0x50bf0e(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5afcd2[_0xaf2d('0x32')]===_0xaf2d('0x76')){if(_0xaf2d('0x72')==typeof _0x5afcd2['parameters'][_0xaf2d('0x77')]){return _0x50bf0e(new Error(_0xaf2d('0x78')));}if('undefined'==typeof _0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x77')][_0xaf2d('0x79')]&&'undefined'==typeof _0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x77')][_0xaf2d('0x7a')]){return _0x50bf0e(new Error(_0xaf2d('0x7b')));}}else if(_0x5afcd2[_0xaf2d('0x32')]===_0xaf2d('0x7c')){if(_0xaf2d('0x72')==typeof _0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x7d')]){return _0x50bf0e(new Error(_0xaf2d('0x7e')));}if(_0xaf2d('0x72')==typeof _0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x7f')]){return _0x50bf0e(new Error(_0xaf2d('0x80')));}}else{return _0x50bf0e(new Error(_0xaf2d('0x81')));}var _0xc667d5=_0x5afcd2['name'];var _0x58e5cd=_0x5afcd2[_0xaf2d('0x82')];var _0xb6240=_0x5afcd2['type'];var _0x55d349=_0x5afcd2[_0xaf2d('0x83')]?_0x5afcd2[_0xaf2d('0x83')]:'always';var _0x44d1c7=_0x5afcd2[_0xaf2d('0x84')]?_0x5afcd2[_0xaf2d('0x84')]:_0xaf2d('0x85');var _0x279b64='';var _0x4122be='';var _0x28a534='';var _0x358ffd='';var _0x2ca635=_0x5afcd2['version'];if(_0xb6240===_0xaf2d('0x76')){if(_0xaf2d('0x72')!=typeof _0x5afcd2[_0xaf2d('0x75')]['views'][_0xaf2d('0x79')]){var _0xf6b008=_0x5afcd2['parameters'][_0xaf2d('0x77')][_0xaf2d('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0xf6b008)){_0x279b64=path[_0xaf2d('0x56')](_0xaf2d('0x86'),_0x143bf7,_0x2cef57[0x0],_0xf6b008);}else{_0x279b64=_0xf6b008;}}else{logger[_0xaf2d('0x60')](_0xaf2d('0x87'));}if('undefined'!=typeof _0x5afcd2['parameters'][_0xaf2d('0x77')][_0xaf2d('0x7a')]){var _0x13030e=_0x5afcd2[_0xaf2d('0x75')]['views'][_0xaf2d('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x13030e)){_0x4122be=path[_0xaf2d('0x56')](_0xaf2d('0x86'),_0x143bf7,_0x2cef57[0x0],_0x13030e);}else{_0x4122be=_0x13030e;}}else{logger['info'](_0xaf2d('0x88'));}}else if(_0xb6240===_0xaf2d('0x7c')){_0x28a534=_0x5afcd2[_0xaf2d('0x75')]['scriptName'];_0x358ffd=_0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x7f')];if(_0xaf2d('0x72')!=typeof _0x5afcd2['parameters']['views']){if(_0xaf2d('0x72')!=typeof _0x5afcd2[_0xaf2d('0x75')]['views'][_0xaf2d('0x79')]){var _0xf6b008=_0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xaf2d('0x89')](_0xf6b008)){_0x279b64=path['join'](_0xaf2d('0x86'),_0x143bf7,_0x2cef57[0x0],_0xf6b008);}else{_0x279b64=_0xf6b008;}}if(_0xaf2d('0x72')!=typeof _0x5afcd2['parameters'][_0xaf2d('0x77')]['agent']){var _0x13030e=_0x5afcd2[_0xaf2d('0x75')][_0xaf2d('0x77')][_0xaf2d('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0xaf2d('0x89')](_0x13030e)){_0x4122be=path[_0xaf2d('0x56')](_0xaf2d('0x86'),_0x143bf7,_0x2cef57[0x0],_0x13030e);}else{_0x4122be=_0x13030e;}}}}var _0x276288={'name':_0xc667d5,'description':_0x58e5cd,'path':path[_0xaf2d('0x56')](_0x143bf7,_0x2cef57[0x0]),'type':_0xb6240,'sidebar':_0x55d349,'icon':_0x44d1c7,'adminUrl':_0x279b64,'agentUrl':_0x4122be,'scriptName':_0x28a534,'scriptPath':_0x358ffd,'version':_0x2ca635};removeReferences(_0x5c5c21,null);return db['Plugin'][_0xaf2d('0x8a')](_0x276288)[_0xaf2d('0x27')](function(_0x572450){var _0x145bf9={'role':_0x40ab1a[_0xaf2d('0x8b')][_0xaf2d('0x8c')],'userProfileId':_0x40ab1a['body'][_0xaf2d('0x8d')]};if(!_0x145bf9)throw new Error(_0xaf2d('0x8e'));if(_0x145bf9[_0xaf2d('0x8c')]==='user'){var _0x2512fc=_0x572450[_0xaf2d('0x28')]({'plain':!![]});return db[_0xaf2d('0x8f')][_0xaf2d('0x49')]({'where':{'name':'Plugins','userProfileId':_0x145bf9['userProfileId']},'raw':!![]})[_0xaf2d('0x27')](function(_0x56afd6){if(_0x56afd6&&_0x56afd6[_0xaf2d('0x90')]===0x0){return db[_0xaf2d('0x91')][_0xaf2d('0x8a')]({'name':_0x2512fc[_0xaf2d('0x35')],'resourceId':_0x2512fc['id'],'type':_0x56afd6['name'],'sectionId':_0x56afd6['id']},{})[_0xaf2d('0x27')](function(){return _0x572450;});}else{return _0x572450;}})[_0xaf2d('0x46')](function(_0x8c06e8){logger[_0xaf2d('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8c06e8);throw _0x8c06e8;});}return _0x572450;})[_0xaf2d('0x27')](respondWithResult(_0x31310d,null))['catch'](handleError(_0x31310d,null));}});}catch(_0x36db55){_0x31310d['status'](0x1f4)[_0xaf2d('0x2c')](_0x36db55);}};function removeReferences(_0x6176ce,_0x24c232){try{if(_0x6176ce){fs[_0xaf2d('0x92')](_0x6176ce);logger[_0xaf2d('0x60')](_0xaf2d('0x93'));}if(_0x24c232){rimraf(_0x24c232,function(){});logger[_0xaf2d('0x60')](_0xaf2d('0x94'));}}catch(_0xbe67a5){logger[_0xaf2d('0x4f')](_0xbe67a5);}}exports['update']=function(_0x356e2a,_0x51101e,_0x4421df){return db[_0xaf2d('0x2f')]['find']({'where':{'id':_0x356e2a[_0xaf2d('0x48')]['id']}})[_0xaf2d('0x27')](handleEntityNotFound(_0x51101e,null))[_0xaf2d('0x27')](saveUpdates(_0x356e2a['body'],null))[_0xaf2d('0x27')](respondWithResult(_0x51101e,null))['catch'](handleError(_0x51101e,null));};exports[_0xaf2d('0x95')]=function(_0x3b9ce9,_0xa78dd,_0x126c42){return db['Plugin'][_0xaf2d('0x49')]({'where':{'id':_0x3b9ce9[_0xaf2d('0x48')]['id']}})['then'](function(_0x9dbbde){if(_0x9dbbde){return _0x9dbbde[_0xaf2d('0x2a')]();}})[_0xaf2d('0x27')](function(_0xc43942){rimraf(path[_0xaf2d('0x56')](config[_0xaf2d('0x4b')],_0xaf2d('0x57'),path[_0xaf2d('0x58')](_0xc43942['path'])),function(){});return _0xc43942;})[_0xaf2d('0x27')](handleEntityNotFound(_0xa78dd,null))['then'](respondWithStatusCode(_0xa78dd,null))['catch'](handleError(_0xa78dd,null));};exports['webhookGet']=function(_0x177e69,_0x587353,_0x4c618b){return BPromise[_0xaf2d('0x96')]()[_0xaf2d('0x27')](function(){if(!_0x177e69[_0xaf2d('0x36')][_0xaf2d('0x6')]){throw new Error(_0xaf2d('0x97'));}if(!_0x177e69[_0xaf2d('0x36')][_0xaf2d('0x98')]){throw new Error(_0xaf2d('0x99'));}var _0x72e194=_0x177e69['query'][_0xaf2d('0x9a')]?_0x177e69['query'][_0xaf2d('0x9a')]+':'+_0x177e69[_0xaf2d('0x36')][_0xaf2d('0x98')]:_0xaf2d('0x9b')+_0x177e69[_0xaf2d('0x36')]['port'];var _0x520455=_0x177e69[_0xaf2d('0x36')][_0xaf2d('0x25')]?_0x177e69['query'][_0xaf2d('0x25')]:!![];var _0x4d4256=_0x177e69[_0xaf2d('0x36')][_0xaf2d('0x9c')]?_0x177e69['query'][_0xaf2d('0x9c')]:null;var _0x428688={'method':_0x177e69[_0xaf2d('0x9d')],'uri':util[_0xaf2d('0x5e')]('%s%s',_0x72e194,_0x177e69[_0xaf2d('0x36')]['path']),'json':_0x520455,'resolveWithFullResponse':!![],'encoding':_0x4d4256,'qs':_0x177e69[_0xaf2d('0x36')]};if(_0x177e69[_0xaf2d('0x9e')]){_0x428688[_0xaf2d('0x9e')]=_0x177e69[_0xaf2d('0x9e')];if(_0x428688['headers']['content-length']){delete _0x428688['headers'][_0xaf2d('0x9f')];}}if(_0x428688['headers']['content-type']){delete _0x428688[_0xaf2d('0x9e')][_0xaf2d('0xa0')];}return rp(_0x428688);})[_0xaf2d('0x27')](function(_0xf01cc6){if(_0xf01cc6){_0x587353[_0xaf2d('0x24')](_0xf01cc6['headers']);logger[_0xaf2d('0x60')](_0xf01cc6[_0xaf2d('0x8b')]);if(_[_0xaf2d('0xa1')](_0x177e69[_0xaf2d('0x36')]['path'],_0xaf2d('0x4a'))&&_0xf01cc6[_0xaf2d('0xa2')]==0x1f4){return _0x587353[_0xaf2d('0x1e')](_0xf01cc6['statusCode']);}else{return _0x587353[_0xaf2d('0x1f')](_0xf01cc6[_0xaf2d('0xa2')])[_0xaf2d('0x2c')](_0xf01cc6['body']);}}else{return _0x587353[_0xaf2d('0x1e')](0xc8);}})['catch'](handleError(_0x587353,null));};exports[_0xaf2d('0xa3')]=function(_0x2b235f,_0x25a44a,_0x3f298a){return BPromise[_0xaf2d('0x96')]()[_0xaf2d('0x27')](function(){if(!_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x6')]){throw new Error(_0xaf2d('0x97'));}if(!_0x2b235f[_0xaf2d('0x36')]['port']){throw new Error(_0xaf2d('0x99'));}var _0x5ccc3e=_0x2b235f[_0xaf2d('0x36')]['hostname']?_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x9a')]+':'+_0x2b235f['query'][_0xaf2d('0x98')]:_0xaf2d('0x9b')+_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x98')];var _0x1633d5=_0x2b235f[_0xaf2d('0x36')]['json']?_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x25')]:!![];var _0x117bd3=_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x9c')]?_0x2b235f[_0xaf2d('0x36')]['encoding']:null;var _0xc8cf98={'method':_0x2b235f['method'],'uri':util[_0xaf2d('0x5e')](_0xaf2d('0xa4'),_0x5ccc3e,_0x2b235f[_0xaf2d('0x36')][_0xaf2d('0x6')]),'json':_0x1633d5,'resolveWithFullResponse':!![],'encoding':_0x117bd3,'body':_0x2b235f[_0xaf2d('0x8b')]};if(_0x2b235f[_0xaf2d('0x9e')]){_0xc8cf98[_0xaf2d('0x9e')]=_0x2b235f[_0xaf2d('0x9e')];if(_0xc8cf98[_0xaf2d('0x9e')][_0xaf2d('0x9f')]){delete _0xc8cf98[_0xaf2d('0x9e')][_0xaf2d('0x9f')];}}if(_0xc8cf98[_0xaf2d('0x9e')][_0xaf2d('0xa0')]){delete _0xc8cf98[_0xaf2d('0x9e')][_0xaf2d('0xa0')];}return rp(_0xc8cf98);})[_0xaf2d('0x27')](function(_0x359960){if(_0x359960){_0x25a44a[_0xaf2d('0x24')](_0x359960[_0xaf2d('0x9e')]);logger[_0xaf2d('0x60')](_0x359960['body']);return _0x25a44a[_0xaf2d('0x1f')](_0x359960[_0xaf2d('0xa2')])[_0xaf2d('0x2c')](_0x359960[_0xaf2d('0x8b')]);}else{return _0x25a44a[_0xaf2d('0x1e')](0xc8);}})['catch'](handleError(_0x25a44a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ff6a800..788746f 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 _0xaebd=['emit','hook','exports','events','Plugin','setMaxListeners','save','update','remove'];(function(_0x97369a,_0x2b3021){var _0x434c9f=function(_0xbc5a97){while(--_0xbc5a97){_0x97369a['push'](_0x97369a['shift']());}};_0x434c9f(++_0x2b3021);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5118ed,_0x5815e6){_0x5118ed=_0x5118ed-0x0;var _0x4855da=_0xaebd[_0x5118ed];return _0x4855da;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var Plugin=require('../../mysqldb')['db'][_0xdaeb('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xdaeb('0x2')](0x0);var events={'afterCreate':_0xdaeb('0x3'),'afterUpdate':_0xdaeb('0x4'),'afterDestroy':_0xdaeb('0x5')};function emitEvent(_0x4acd42){return function(_0x44e982,_0x1c617a,_0x1a99be){PluginEvents[_0xdaeb('0x6')](_0x4acd42+':'+_0x44e982['id'],_0x44e982);PluginEvents[_0xdaeb('0x6')](_0x4acd42,_0x44e982);_0x1a99be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xdaeb('0x7')](e,emitEvent(event));}}module[_0xdaeb('0x8')]=PluginEvents; \ No newline at end of file +var _0xe5af=['emit','exports','../../mysqldb','Plugin','save','update','remove'];(function(_0x250a51,_0x424b47){var _0x16aa19=function(_0x410442){while(--_0x410442){_0x250a51['push'](_0x250a51['shift']());}};_0x16aa19(++_0x424b47);}(_0xe5af,0x9c));var _0xfe5a=function(_0x358049,_0x56e00a){_0x358049=_0x358049-0x0;var _0x2426d1=_0xe5af[_0x358049];return _0x2426d1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){PluginEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);PluginEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b2c62f1..30e873b 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 _0x5690=['request-promise','path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x16b4ac,_0x32d517){var _0xb34cc4=function(_0x5982bb){while(--_0x5982bb){_0x16b4ac['push'](_0x16b4ac['shift']());}};_0xb34cc4(++_0x32d517);}(_0x5690,0x104));var _0x0569=function(_0x26bfb0,_0x5b0ffc){_0x26bfb0=_0x26bfb0-0x0;var _0x4454b3=_0x5690[_0x26bfb0];return _0x4454b3;};'use strict';var _=require(_0x0569('0x0'));var util=require(_0x0569('0x1'));var logger=require(_0x0569('0x2'))(_0x0569('0x3'));var moment=require(_0x0569('0x4'));var BPromise=require(_0x0569('0x5'));var rp=require(_0x0569('0x6'));var fs=require('fs');var path=require(_0x0569('0x7'));var rimraf=require(_0x0569('0x8'));var config=require(_0x0569('0x9'));var attributes=require('./plugin.attributes');module[_0x0569('0xa')]=function(_0x20de66,_0x43ec1b){return _0x20de66[_0x0569('0xb')](_0x0569('0xc'),attributes,{'tableName':_0x0569('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a2=['path','rimraf','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird'];(function(_0xbb0d7c,_0x1bd6ff){var _0x3cd86d=function(_0x2b6182){while(--_0x2b6182){_0xbb0d7c['push'](_0xbb0d7c['shift']());}};_0x3cd86d(++_0x1bd6ff);}(_0x91a2,0x1c9));var _0x291a=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x91a2[_0x5c72ee];return _0x231876;};'use strict';var _=require(_0x291a('0x0'));var util=require('util');var logger=require(_0x291a('0x1'))(_0x291a('0x2'));var moment=require(_0x291a('0x3'));var BPromise=require(_0x291a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x291a('0x5'));var rimraf=require(_0x291a('0x6'));var config=require('../../config/environment');var attributes=require(_0x291a('0x7'));module['exports']=function(_0x3bb1d1,_0x443fac){return _0x3bb1d1[_0x291a('0x8')](_0x291a('0x9'),attributes,{'tableName':_0x291a('0xa'),'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 05ef4a5..5c45dbb 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 _0xddb9=['socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','CreatePlugin','Plugin','create','options','raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x2f899b,_0x39018c){var _0x18adca=function(_0x3c208e){while(--_0x3c208e){_0x2f899b['push'](_0x2f899b['shift']());}};_0x18adca(++_0x39018c);}(_0xddb9,0x169));var _0x9ddb=function(_0x4e2ca6,_0x4a29ca){_0x4e2ca6=_0x4e2ca6-0x0;var _0xd809ee=_0xddb9[_0x4e2ca6];return _0xd809ee;};'use strict';var _=require(_0x9ddb('0x0'));var util=require(_0x9ddb('0x1'));var moment=require('moment');var BPromise=require(_0x9ddb('0x2'));var rs=require('randomstring');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')(_0x9ddb('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ddb('0x7'));var client=jayson[_0x9ddb('0x8')][_0x9ddb('0x9')]({'port':0x232a});config[_0x9ddb('0xa')]=_['defaults'](config[_0x9ddb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ddb('0xb'))(new Redis(config[_0x9ddb('0xa')]));require(_0x9ddb('0xc'))[_0x9ddb('0xd')](socket);function respondWithRpcPromise(_0x3293b3,_0x15e353,_0x565f3f){return new BPromise(function(_0x2888fb,_0x2f773e){return client[_0x9ddb('0xe')](_0x3293b3,_0x565f3f)[_0x9ddb('0xf')](function(_0x40e355){logger['info'](_0x9ddb('0x10'),_0x15e353,_0x9ddb('0x11'));logger[_0x9ddb('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x15e353,_0x9ddb('0x11'),JSON[_0x9ddb('0x13')](_0x40e355));if(_0x40e355['error']){if(_0x40e355['error'][_0x9ddb('0x14')]===0x1f4){logger[_0x9ddb('0x15')](_0x9ddb('0x10'),_0x15e353,_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);return _0x2f773e(_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);}logger['error'](_0x9ddb('0x10'),_0x15e353,_0x40e355['error'][_0x9ddb('0x16')]);return _0x2888fb(_0x40e355[_0x9ddb('0x15')][_0x9ddb('0x16')]);}else{logger[_0x9ddb('0x17')](_0x9ddb('0x10'),_0x15e353,'request\x20sent');_0x2888fb(_0x40e355[_0x9ddb('0x18')][_0x9ddb('0x16')]);}})['catch'](function(_0x592a88){logger[_0x9ddb('0x15')](_0x9ddb('0x10'),_0x15e353,_0x592a88);_0x2f773e(_0x592a88);});});}exports[_0x9ddb('0x19')]=function(_0xdade2b){var _0x4ca70f=this;return new Promise(function(_0x203e18,_0x47a556){return db[_0x9ddb('0x1a')][_0x9ddb('0x1b')](_0xdade2b['body'],{'raw':_0xdade2b[_0x9ddb('0x1c')]?_0xdade2b[_0x9ddb('0x1c')][_0x9ddb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2087c1){logger['info'](_0x9ddb('0x19'),_0xdade2b);logger[_0x9ddb('0x12')](_0x9ddb('0x19'),_0xdade2b,JSON['stringify'](_0x2087c1));_0x203e18(_0x2087c1);})[_0x9ddb('0x1e')](function(_0x3c9db0){logger[_0x9ddb('0x15')](_0x9ddb('0x19'),_0x3c9db0[_0x9ddb('0x16')],_0xdade2b);_0x47a556(_0x4ca70f[_0x9ddb('0x15')](0x1f4,_0x3c9db0['message']));});});}; \ No newline at end of file +var _0xc3d7=['localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults'];(function(_0xe17942,_0x5ac233){var _0x59d431=function(_0x35171e){while(--_0x35171e){_0xe17942['push'](_0xe17942['shift']());}};_0x59d431(++_0x5ac233);}(_0xc3d7,0x153));var _0x7c3d=function(_0xa9c3d0,_0x50222d){_0xa9c3d0=_0xa9c3d0-0x0;var _0x4c5da7=_0xc3d7[_0xa9c3d0];return _0x4c5da7;};'use strict';var _=require(_0x7c3d('0x0'));var util=require(_0x7c3d('0x1'));var moment=require(_0x7c3d('0x2'));var BPromise=require(_0x7c3d('0x3'));var rs=require(_0x7c3d('0x4'));var fs=require('fs');var Redis=require(_0x7c3d('0x5'));var db=require(_0x7c3d('0x6'))['db'];var utils=require(_0x7c3d('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7c3d('0x8'));var client=jayson[_0x7c3d('0x9')][_0x7c3d('0xa')]({'port':0x232a});config[_0x7c3d('0xb')]=_[_0x7c3d('0xc')](config[_0x7c3d('0xb')],{'host':_0x7c3d('0xd'),'port':0x18eb});var socket=require(_0x7c3d('0xe'))(new Redis(config[_0x7c3d('0xb')]));require(_0x7c3d('0xf'))[_0x7c3d('0x10')](socket);function respondWithRpcPromise(_0x57d2fb,_0x145703,_0x53ff05){return new BPromise(function(_0x54df9c,_0x10e02f){return client['request'](_0x57d2fb,_0x53ff05)[_0x7c3d('0x11')](function(_0x4c68c8){logger[_0x7c3d('0x12')](_0x7c3d('0x13'),_0x145703,_0x7c3d('0x14'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x145703,_0x7c3d('0x14'),JSON['stringify'](_0x4c68c8));if(_0x4c68c8[_0x7c3d('0x15')]){if(_0x4c68c8[_0x7c3d('0x15')][_0x7c3d('0x16')]===0x1f4){logger[_0x7c3d('0x15')]('Plugin,\x20%s,\x20%s',_0x145703,_0x4c68c8['error']['message']);return _0x10e02f(_0x4c68c8[_0x7c3d('0x15')]['message']);}logger[_0x7c3d('0x15')](_0x7c3d('0x13'),_0x145703,_0x4c68c8[_0x7c3d('0x15')]['message']);return _0x54df9c(_0x4c68c8['error'][_0x7c3d('0x17')]);}else{logger[_0x7c3d('0x12')](_0x7c3d('0x13'),_0x145703,'request\x20sent');_0x54df9c(_0x4c68c8[_0x7c3d('0x18')][_0x7c3d('0x17')]);}})['catch'](function(_0x344eab){logger[_0x7c3d('0x15')](_0x7c3d('0x13'),_0x145703,_0x344eab);_0x10e02f(_0x344eab);});});}exports[_0x7c3d('0x19')]=function(_0x7ed9c7){var _0x5d74fe=this;return new Promise(function(_0x1fb724,_0x565973){return db[_0x7c3d('0x1a')][_0x7c3d('0x1b')](_0x7ed9c7[_0x7c3d('0x1c')],{'raw':_0x7ed9c7[_0x7c3d('0x1d')]?_0x7ed9c7['options'][_0x7c3d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x30902e){logger['info'](_0x7c3d('0x19'),_0x7ed9c7);logger[_0x7c3d('0x1f')]('CreatePlugin',_0x7ed9c7,JSON['stringify'](_0x30902e));_0x1fb724(_0x30902e);})['catch'](function(_0x30abfd){logger['error'](_0x7c3d('0x19'),_0x30abfd[_0x7c3d('0x17')],_0x7ed9c7);_0x565973(_0x5d74fe['error'](0x1f4,_0x30abfd['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 50e4821..f67e10c 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 _0xcbe8=['update','removeListener','register','plugin:','save','remove'];(function(_0x327199,_0x1283db){var _0x5a7cf0=function(_0x350f66){while(--_0x350f66){_0x327199['push'](_0x327199['shift']());}};_0x5a7cf0(++_0x1283db);}(_0xcbe8,0x1e4));var _0x8cbe=function(_0x5105b7,_0x454e66){_0x5105b7=_0x5105b7-0x0;var _0xb5088f=_0xcbe8[_0x5105b7];return _0xb5088f;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8cbe('0x0'),_0x8cbe('0x1'),_0x8cbe('0x2')];function createListener(_0x1a6492,_0x2397f8){return function(_0x48285f){_0x2397f8['emit'](_0x1a6492,_0x48285f);};}function removeListener(_0x17dfff,_0x3629b3){return function(){PluginEvents[_0x8cbe('0x3')](_0x17dfff,_0x3629b3);};}exports[_0x8cbe('0x4')]=function(_0x1e173d){for(var _0xa663f=0x0,_0x290850=events['length'];_0xa663f<_0x290850;_0xa663f++){var _0x1d7784=events[_0xa663f];var _0x1735f0=createListener(_0x8cbe('0x5')+_0x1d7784,_0x1e173d);PluginEvents['on'](_0x1d7784,_0x1735f0);}}; \ No newline at end of file +var _0x69c5=['update','emit','removeListener','register','plugin:','./plugin.events','save','remove'];(function(_0x695578,_0x56c425){var _0x45536d=function(_0x3848a4){while(--_0x3848a4){_0x695578['push'](_0x695578['shift']());}};_0x45536d(++_0x56c425);}(_0x69c5,0xad));var _0x569c=function(_0x15e3e6,_0x115d40){_0x15e3e6=_0x15e3e6-0x0;var _0x573145=_0x69c5[_0x15e3e6];return _0x573145;};'use strict';var PluginEvents=require(_0x569c('0x0'));var events=[_0x569c('0x1'),_0x569c('0x2'),_0x569c('0x3')];function createListener(_0x598e26,_0x518064){return function(_0x34fe1d){_0x518064[_0x569c('0x4')](_0x598e26,_0x34fe1d);};}function removeListener(_0x41faea,_0x163e49){return function(){PluginEvents[_0x569c('0x5')](_0x41faea,_0x163e49);};}exports[_0x569c('0x6')]=function(_0x1477d9){for(var _0x2363e1=0x0,_0x670c06=events['length'];_0x2363e1<_0x670c06;_0x2363e1++){var _0x691cd0=events[_0x2363e1];var _0x22d8cf=createListener(_0x569c('0x7')+_0x691cd0,_0x1477d9);PluginEvents['on'](_0x691cd0,_0x22d8cf);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 155934b..60f3e4d 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 _0xf955=['./pm2.controller','get','isAuthenticated','show','post','create','/:id','update','delete','exports','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf955,0xfa));var _0x5f95=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xf955[_0x34bf97];return _0x292719;};'use strict';var express=require(_0x5f95('0x0'));var router=express[_0x5f95('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5f95('0x2'));router[_0x5f95('0x3')]('/',auth[_0x5f95('0x4')](),controller['index']);router[_0x5f95('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x5f95('0x5')]);router[_0x5f95('0x6')]('/',auth[_0x5f95('0x4')](),controller[_0x5f95('0x7')]);router['put'](_0x5f95('0x8'),auth['isAuthenticated'](),controller[_0x5f95('0x9')]);router[_0x5f95('0xa')](_0x5f95('0x8'),auth[_0x5f95('0x4')](),controller['destroy']);module[_0x5f95('0xb')]=router; \ No newline at end of file +var _0x1ae6=['show','post','create','put','delete','destroy','exports','express','isAuthenticated','/:id'];(function(_0x24d7b9,_0x1e6738){var _0xa42ce4=function(_0x22469e){while(--_0x22469e){_0x24d7b9['push'](_0x24d7b9['shift']());}};_0xa42ce4(++_0x1e6738);}(_0x1ae6,0xa7));var _0x61ae=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x1ae6[_0x2b10c6];return _0x3789d2;};'use strict';var express=require(_0x61ae('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router['get']('/',auth[_0x61ae('0x1')](),controller['index']);router['get'](_0x61ae('0x2'),auth['isAuthenticated'](),controller[_0x61ae('0x3')]);router[_0x61ae('0x4')]('/',auth[_0x61ae('0x1')](),controller[_0x61ae('0x5')]);router[_0x61ae('0x6')](_0x61ae('0x2'),auth['isAuthenticated'](),controller['update']);router[_0x61ae('0x7')](_0x61ae('0x2'),auth[_0x61ae('0x1')](),controller[_0x61ae('0x8')]);module[_0x61ae('0x9')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 8a4f097..4f1cec1 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 _0xe10f=['../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','reject','express','motion2','catch','show','describe','params','then','body','script'];(function(_0x6be6cf,_0x1f1ed1){var _0x28600f=function(_0x362f20){while(--_0x362f20){_0x6be6cf['push'](_0x6be6cf['shift']());}};_0x28600f(++_0x1f1ed1);}(_0xe10f,0xff));var _0xfe10=function(_0x18e34c,_0x1f87c5){_0x18e34c=_0x18e34c-0x0;var _0x5ad33e=_0xe10f[_0x18e34c];return _0x5ad33e;};'use strict';var _=require(_0xfe10('0x0'));var pm2=require(_0xfe10('0x1'));var logger=require(_0xfe10('0x2'))(_0xfe10('0x3'));var path=require('path');var exec=require(_0xfe10('0x4'))['exec'];var BPromise=require(_0xfe10('0x5'));function handleEntityNotFound(_0x147d53,_0xc02f7c){return function(_0x15b79a){if(!_0x15b79a){_0x147d53[_0xfe10('0x6')](0x194);;}return _0x15b79a;};}function respondWithResult(_0x2614d8,_0x44b41f){_0x44b41f=_0x44b41f||0xc8;return function(_0x2c789d){if(_0x2c789d){return _0x2614d8[_0xfe10('0x7')](_0x44b41f)['json'](_0x2c789d);}return null;};}function handleError(_0x62bb74,_0x330c23){_0x330c23=_0x330c23||0x1f4;return function(_0x469e73){logger[_0xfe10('0x8')](_0x469e73[_0xfe10('0x9')]);if(_0x469e73[_0xfe10('0xa')]){delete _0x469e73['name'];}_0x62bb74[_0xfe10('0x7')](_0x330c23)[_0xfe10('0xb')](_0x469e73);};}function execChildProcess(){return new BPromise(function(_0x17240a,_0x358845){exec(_0xfe10('0xc'),function(_0x45c448,_0x580cd0,_0xa08fe0){logger['info'](_0x580cd0);logger[_0xfe10('0xd')](_0xa08fe0);if(_0x45c448){logger[_0xfe10('0x8')](_0x45c448);return _0x358845(_0x45c448);}return _0x17240a(_0x580cd0);});});}exports[_0xfe10('0xe')]=function(_0x36828c,_0x4c841c){return pm2['list']()['then'](function(_0x16fde0){if(_0x16fde0){var _0x3e6c9f=_[_0xfe10('0xf')](_0x16fde0,function(_0x30b01b){return _0x30b01b[_0xfe10('0xa')]===_0xfe10('0x10')||_0x30b01b[_0xfe10('0xa')]===_0xfe10('0x11');});return{'rows':_0x3e6c9f,'count':_0x3e6c9f['length']};}return null;})['then'](respondWithResult(_0x4c841c,null))[_0xfe10('0x12')](handleError(_0x4c841c,null));};exports[_0xfe10('0x13')]=function(_0x43fd8b,_0x15c52f){return pm2[_0xfe10('0x14')](_0x43fd8b[_0xfe10('0x15')]['id'])['then'](respondWithResult(_0x15c52f,null))[_0xfe10('0x16')](handleEntityNotFound(_0x15c52f,null))[_0xfe10('0x12')](handleError(_0x15c52f,null));};exports['create']=function(_0x413d57,_0x44c09e){if(_0x413d57[_0xfe10('0x17')]['name']&&_0x413d57[_0xfe10('0x17')][_0xfe10('0x18')]){var _0x408754=path['join'](__dirname,_0xfe10('0x19'),_0x413d57['body'][_0xfe10('0x18')]);var _0x409e9b=process[_0xfe10('0x1a')]();process[_0xfe10('0x1b')](path[_0xfe10('0x1c')](_0x408754));return execChildProcess()[_0xfe10('0x16')](function(_0x49c1d6){process[_0xfe10('0x1b')](_0x409e9b);return pm2['start']({'name':_0x413d57[_0xfe10('0x17')][_0xfe10('0xa')],'script':_0x408754});})[_0xfe10('0x16')](function(_0x116b5d){pm2[_0xfe10('0x1d')]();return _0x116b5d[0x0];})[_0xfe10('0x16')](respondWithResult(_0x44c09e,0xc9))[_0xfe10('0x12')](handleError(_0x44c09e,null));}else{return _0x44c09e[_0xfe10('0x7')](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x1e')});}};exports['update']=function(_0x34aa36,_0x1e6d9f){if(_0x34aa36[_0xfe10('0x17')]['id']){delete _0x34aa36[_0xfe10('0x17')]['id'];}var _0x380b05={'online':_0xfe10('0x1f'),'stopped':'stop'};if(_0x380b05[_0xfe10('0x20')](_0x34aa36[_0xfe10('0x17')]['status'])){return pm2[_0x380b05[_0x34aa36[_0xfe10('0x17')][_0xfe10('0x7')]]](_0x34aa36['params']['id'])['then'](respondWithResult(_0x1e6d9f,0xc8))[_0xfe10('0x12')](handleError(_0x1e6d9f,null));}else{return _0x1e6d9f['status'](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x21')});}};exports['destroy']=function(_0x2a4bd8,_0x1fac33){if(_0x2a4bd8[_0xfe10('0x17')]['id']){delete _0x2a4bd8[_0xfe10('0x17')]['id'];}if(_0x2a4bd8['params']['id']){return pm2['delete'](_0x2a4bd8[_0xfe10('0x15')]['id'])['then'](function(_0x3da9ac){pm2[_0xfe10('0x1d')]();return _0x3da9ac[0x0];})['then'](respondWithResult(_0x1fac33,null))[_0xfe10('0x12')](handleError(_0x1fac33,null));}else{return _0x1fac33['status'](0x1f4)[_0xfe10('0xb')]({'message':_0xfe10('0x22')});}}; \ No newline at end of file +var _0x35d9=['child_process','exec','bluebird','sendStatus','status','json','error','stack','name','info','index','list','then','express','motion2','catch','show','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','send','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path'];(function(_0x90f4ca,_0xab3c45){var _0x585692=function(_0x37c9e5){while(--_0x37c9e5){_0x90f4ca['push'](_0x90f4ca['shift']());}};_0x585692(++_0xab3c45);}(_0x35d9,0xb4));var _0x935d=function(_0x5d1108,_0xc5b68d){_0x5d1108=_0x5d1108-0x0;var _0x257ece=_0x35d9[_0x5d1108];return _0x257ece;};'use strict';var _=require(_0x935d('0x0'));var pm2=require(_0x935d('0x1'));var logger=require(_0x935d('0x2'))(_0x935d('0x3'));var path=require(_0x935d('0x4'));var exec=require(_0x935d('0x5'))[_0x935d('0x6')];var BPromise=require(_0x935d('0x7'));function handleEntityNotFound(_0x2a3003,_0x4422ab){return function(_0x70c465){if(!_0x70c465){_0x2a3003[_0x935d('0x8')](0x194);;}return _0x70c465;};}function respondWithResult(_0x2772c8,_0x53f60c){_0x53f60c=_0x53f60c||0xc8;return function(_0x5a24ba){if(_0x5a24ba){return _0x2772c8[_0x935d('0x9')](_0x53f60c)[_0x935d('0xa')](_0x5a24ba);}return null;};}function handleError(_0x13371e,_0x845ac0){_0x845ac0=_0x845ac0||0x1f4;return function(_0x36b111){logger[_0x935d('0xb')](_0x36b111[_0x935d('0xc')]);if(_0x36b111[_0x935d('0xd')]){delete _0x36b111['name'];}_0x13371e['status'](_0x845ac0)['send'](_0x36b111);};}function execChildProcess(){return new BPromise(function(_0x39c9b8,_0x267b63){exec('npm\x20install',function(_0x2604ad,_0x5169aa,_0x393e6d){logger['info'](_0x5169aa);logger[_0x935d('0xe')](_0x393e6d);if(_0x2604ad){logger['error'](_0x2604ad);return _0x267b63(_0x2604ad);}return _0x39c9b8(_0x5169aa);});});}exports[_0x935d('0xf')]=function(_0x31101c,_0x2281c1){return pm2[_0x935d('0x10')]()[_0x935d('0x11')](function(_0x408e98){if(_0x408e98){var _0x3c1dc4=_['reject'](_0x408e98,function(_0x2823d1){return _0x2823d1[_0x935d('0xd')]===_0x935d('0x12')||_0x2823d1[_0x935d('0xd')]===_0x935d('0x13');});return{'rows':_0x3c1dc4,'count':_0x3c1dc4['length']};}return null;})['then'](respondWithResult(_0x2281c1,null))[_0x935d('0x14')](handleError(_0x2281c1,null));};exports[_0x935d('0x15')]=function(_0x3ef431,_0x36614d){return pm2['describe'](_0x3ef431[_0x935d('0x16')]['id'])['then'](respondWithResult(_0x36614d,null))[_0x935d('0x11')](handleEntityNotFound(_0x36614d,null))[_0x935d('0x14')](handleError(_0x36614d,null));};exports[_0x935d('0x17')]=function(_0x562489,_0x1f3dc8){if(_0x562489[_0x935d('0x18')][_0x935d('0xd')]&&_0x562489['body'][_0x935d('0x19')]){var _0x4f3e54=path['join'](__dirname,_0x935d('0x1a'),_0x562489[_0x935d('0x18')]['script']);var _0x2bf324=process[_0x935d('0x1b')]();process[_0x935d('0x1c')](path[_0x935d('0x1d')](_0x4f3e54));return execChildProcess()[_0x935d('0x11')](function(_0x5e4df2){process[_0x935d('0x1c')](_0x2bf324);return pm2['start']({'name':_0x562489['body'][_0x935d('0xd')],'script':_0x4f3e54});})['then'](function(_0x169024){pm2[_0x935d('0x1e')]();return _0x169024[0x0];})[_0x935d('0x11')](respondWithResult(_0x1f3dc8,0xc9))[_0x935d('0x14')](handleError(_0x1f3dc8,null));}else{return _0x1f3dc8[_0x935d('0x9')](0x1f4)['send']({'message':_0x935d('0x1f')});}};exports[_0x935d('0x20')]=function(_0x5eed31,_0x2b2458){if(_0x5eed31[_0x935d('0x18')]['id']){delete _0x5eed31['body']['id'];}var _0x92dcdc={'online':'restart','stopped':'stop'};if(_0x92dcdc[_0x935d('0x21')](_0x5eed31[_0x935d('0x18')]['status'])){return pm2[_0x92dcdc[_0x5eed31['body']['status']]](_0x5eed31['params']['id'])[_0x935d('0x11')](respondWithResult(_0x2b2458,0xc8))['catch'](handleError(_0x2b2458,null));}else{return _0x2b2458[_0x935d('0x9')](0x1f4)[_0x935d('0x22')]({'message':'Unknown\x20status'});}};exports[_0x935d('0x23')]=function(_0x597c01,_0x40c768){if(_0x597c01[_0x935d('0x18')]['id']){delete _0x597c01[_0x935d('0x18')]['id'];}if(_0x597c01['params']['id']){return pm2['delete'](_0x597c01[_0x935d('0x16')]['id'])[_0x935d('0x11')](function(_0x2af796){pm2[_0x935d('0x1e')]();return _0x2af796[0x0];})['then'](respondWithResult(_0x40c768,null))['catch'](handleError(_0x40c768,null));}else{return _0x40c768[_0x935d('0x9')](0x1f4)[_0x935d('0x22')]({'message':_0x935d('0x24')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f0184c8..4e808a5 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 _0xf94c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xf94c,0x1a4));var _0xcf94=function(_0x20e106,_0x244c4c){_0x20e106=_0x20e106-0x0;var _0x58757b=_0xf94c[_0x20e106];return _0x58757b;};'use strict';var multer=require('multer');var util=require(_0xcf94('0x0'));var path=require('path');var timeout=require(_0xcf94('0x1'));var express=require(_0xcf94('0x2'));var router=express[_0xcf94('0x3')]();var auth=require(_0xcf94('0x4'));var interaction=require(_0xcf94('0x5'));var config=require('../../config/environment');module[_0xcf94('0x6')]=router; \ No newline at end of file +var _0xd848=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0xd848,0x1d8));var _0x8d84=function(_0x4f75b5,_0x4db76d){_0x4f75b5=_0x4f75b5-0x0;var _0x5c263b=_0xd848[_0x4f75b5];return _0x5c263b;};'use strict';var multer=require('multer');var util=require(_0x8d84('0x0'));var path=require(_0x8d84('0x1'));var timeout=require(_0x8d84('0x2'));var express=require(_0x8d84('0x3'));var router=express[_0x8d84('0x4')]();var auth=require(_0x8d84('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d84('0x6'));module[_0x8d84('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index bd1c666..7be41be 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 _0xe1c9=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1c9,0xc9));var _0x9e1c=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0xe1c9[_0x2493f7];return _0x594ab2;};'use strict';var Sequelize=require(_0x9e1c('0x0'));module[_0x9e1c('0x1')]={'state':{'type':Sequelize[_0x9e1c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9e1c('0x3')]},'scheduledat':{'type':Sequelize[_0x9e1c('0x4')]},'uniqueid':{'type':Sequelize[_0x9e1c('0x3')]},'starttime':{'type':Sequelize[_0x9e1c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9e1c('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9e1c('0x3')]},'campaigntype':{'type':Sequelize[_0x9e1c('0x3')]},'membername':{'type':Sequelize[_0x9e1c('0x3')]}}; \ No newline at end of file +var _0x8117=['sequelize','exports','INTEGER','DATE','STRING'];(function(_0x181bad,_0x59e08d){var _0x1dad0b=function(_0x36b42a){while(--_0x36b42a){_0x181bad['push'](_0x181bad['shift']());}};_0x1dad0b(++_0x59e08d);}(_0x8117,0x1b3));var _0x7811=function(_0xb62d6a,_0x4d4195){_0xb62d6a=_0xb62d6a-0x0;var _0x20d04e=_0x8117[_0xb62d6a];return _0x20d04e;};'use strict';var Sequelize=require(_0x7811('0x0'));module[_0x7811('0x1')]={'state':{'type':Sequelize[_0x7811('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7811('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7811('0x3')]},'ringtime':{'type':Sequelize[_0x7811('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7811('0x4')]},'campaigntype':{'type':Sequelize[_0x7811('0x4')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f4b29c5..3d02f87 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 _0xafef=['util','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x1256f1,_0x116f74){var _0x175590=function(_0x76765c){while(--_0x76765c){_0x1256f1['push'](_0x1256f1['shift']());}};_0x175590(++_0x116f74);}(_0xafef,0x113));var _0xfafe=function(_0x448899,_0x201063){_0x448899=_0x448899-0x0;var _0x4a518e=_0xafef[_0x448899];return _0x4a518e;};'use strict';var _=require(_0xfafe('0x0'));var util=require(_0xfafe('0x1'));var logger=require('../../config/logger')(_0xfafe('0x2'));var moment=require(_0xfafe('0x3'));var BPromise=require(_0xfafe('0x4'));var rp=require(_0xfafe('0x5'));var fs=require('fs');var path=require(_0xfafe('0x6'));var rimraf=require('rimraf');var config=require(_0xfafe('0x7'));var attributes=require(_0xfafe('0x8'));module[_0xfafe('0x9')]=function(_0x18bed7,_0x36d561){return _0x18bed7['define'](_0xfafe('0xa'),attributes,{'tableName':_0xfafe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2880=['util','../../config/logger','api','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x2880,0x1b7));var _0x0288=function(_0x16a333,_0x3c9421){_0x16a333=_0x16a333-0x0;var _0xa5e463=_0x2880[_0x16a333];return _0xa5e463;};'use strict';var _=require(_0x0288('0x0'));var util=require(_0x0288('0x1'));var logger=require(_0x0288('0x2'))(_0x0288('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0288('0x4'));var config=require(_0x0288('0x5'));var attributes=require(_0x0288('0x6'));module[_0x0288('0x7')]=function(_0x1ad4c,_0x3d654f){return _0x1ad4c[_0x0288('0x8')](_0x0288('0x9'),attributes,{'tableName':_0x0288('0xa'),'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 7ca4682..ec77d6e 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 _0xe833=['stringify','error','code','message','info','result','catch','ReportAgentPreview','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x413bed,_0x163653){var _0x4ae578=function(_0xeb836d){while(--_0xeb836d){_0x413bed['push'](_0x413bed['shift']());}};_0x4ae578(++_0x163653);}(_0xe833,0x1c6));var _0x3e83=function(_0x10ec04,_0x2f60e1){_0x10ec04=_0x10ec04-0x0;var _0x3c0678=_0xe833[_0x10ec04];return _0x3c0678;};'use strict';var _=require(_0x3e83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e83('0x1'));var rs=require(_0x3e83('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e83('0x4'))(_0x3e83('0x5'));var config=require(_0x3e83('0x6'));var jayson=require(_0x3e83('0x7'));var client=jayson['client'][_0x3e83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xce29b6,_0x41e4d6,_0x2fe4dc){return new BPromise(function(_0x4f8089,_0x35fd1e){return client[_0x3e83('0x9')](_0xce29b6,_0x2fe4dc)[_0x3e83('0xa')](function(_0x10ec41){logger['info'](_0x3e83('0xb'),_0x41e4d6,_0x3e83('0xc'));logger['debug'](_0x3e83('0xd'),_0x41e4d6,_0x3e83('0xc'),JSON[_0x3e83('0xe')](_0x10ec41));if(_0x10ec41[_0x3e83('0xf')]){if(_0x10ec41[_0x3e83('0xf')][_0x3e83('0x10')]===0x1f4){logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x10ec41[_0x3e83('0xf')]['message']);return _0x35fd1e(_0x10ec41['error'][_0x3e83('0x11')]);}logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x10ec41[_0x3e83('0xf')]['message']);return _0x4f8089(_0x10ec41[_0x3e83('0xf')][_0x3e83('0x11')]);}else{logger[_0x3e83('0x12')](_0x3e83('0xb'),_0x41e4d6,_0x3e83('0xc'));_0x4f8089(_0x10ec41[_0x3e83('0x13')][_0x3e83('0x11')]);}})[_0x3e83('0x14')](function(_0x1a9135){logger[_0x3e83('0xf')](_0x3e83('0xb'),_0x41e4d6,_0x1a9135);_0x35fd1e(_0x1a9135);});});}exports['CreateReportAgentPreview']=function(_0x5c9fda){var _0x17217f=this;return new Promise(function(_0x5c5426,_0x17954a){return db[_0x3e83('0x15')][_0x3e83('0x16')](_0x5c9fda[_0x3e83('0x17')],{'raw':_0x5c9fda[_0x3e83('0x18')]?_0x5c9fda['options'][_0x3e83('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4d4102){logger[_0x3e83('0x12')]('CreateReportAgentPreview',_0x5c9fda);logger['debug']('CreateReportAgentPreview',_0x5c9fda,JSON[_0x3e83('0xe')](_0x4d4102));_0x5c5426(_0x4d4102);})[_0x3e83('0x14')](function(_0x4fd0ff){logger[_0x3e83('0xf')]('CreateReportAgentPreview',_0x4fd0ff[_0x3e83('0x11')],_0x5c9fda);_0x17954a(_0x17217f['error'](0x1f4,_0x4fd0ff[_0x3e83('0x11')]));});});}; \ No newline at end of file +var _0xe1d1=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x522521,_0x4119be){var _0x5a0651=function(_0x176373){while(--_0x176373){_0x522521['push'](_0x522521['shift']());}};_0x5a0651(++_0x4119be);}(_0xe1d1,0x1e6));var _0x1e1d=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xe1d1[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x1e1d('0x0'));var util=require(_0x1e1d('0x1'));var moment=require(_0x1e1d('0x2'));var BPromise=require(_0x1e1d('0x3'));var rs=require(_0x1e1d('0x4'));var fs=require('fs');var Redis=require(_0x1e1d('0x5'));var db=require(_0x1e1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e1d('0x7'))(_0x1e1d('0x8'));var config=require(_0x1e1d('0x9'));var jayson=require(_0x1e1d('0xa'));var client=jayson['client'][_0x1e1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa63343,_0xc67f20,_0x4698a4){return new BPromise(function(_0x3a0a63,_0x266d26){return client[_0x1e1d('0xc')](_0xa63343,_0x4698a4)['then'](function(_0x27e413){logger[_0x1e1d('0xd')](_0x1e1d('0xe'),_0xc67f20,'request\x20sent');logger[_0x1e1d('0xf')](_0x1e1d('0x10'),_0xc67f20,_0x1e1d('0x11'),JSON['stringify'](_0x27e413));if(_0x27e413['error']){if(_0x27e413[_0x1e1d('0x12')]['code']===0x1f4){logger[_0x1e1d('0x12')](_0x1e1d('0xe'),_0xc67f20,_0x27e413[_0x1e1d('0x12')][_0x1e1d('0x13')]);return _0x266d26(_0x27e413[_0x1e1d('0x12')][_0x1e1d('0x13')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xc67f20,_0x27e413[_0x1e1d('0x12')]['message']);return _0x3a0a63(_0x27e413['error']['message']);}else{logger['info'](_0x1e1d('0xe'),_0xc67f20,'request\x20sent');_0x3a0a63(_0x27e413[_0x1e1d('0x14')][_0x1e1d('0x13')]);}})['catch'](function(_0x1d7047){logger[_0x1e1d('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0xc67f20,_0x1d7047);_0x266d26(_0x1d7047);});});}exports[_0x1e1d('0x15')]=function(_0x11f10d){var _0x2d29a4=this;return new Promise(function(_0x533650,_0x3cf6be){return db[_0x1e1d('0x16')][_0x1e1d('0x17')](_0x11f10d['body'],{'raw':_0x11f10d[_0x1e1d('0x18')]?_0x11f10d[_0x1e1d('0x18')][_0x1e1d('0x19')]===undefined?!![]:![]:!![]})[_0x1e1d('0x1a')](function(_0x439a11){logger[_0x1e1d('0xd')](_0x1e1d('0x15'),_0x11f10d);logger[_0x1e1d('0xf')](_0x1e1d('0x15'),_0x11f10d,JSON[_0x1e1d('0x1b')](_0x439a11));_0x533650(_0x439a11);})[_0x1e1d('0x1c')](function(_0x4958c4){logger['error']('CreateReportAgentPreview',_0x4958c4[_0x1e1d('0x13')],_0x11f10d);_0x3cf6be(_0x2d29a4[_0x1e1d('0x12')](0x1f4,_0x4958c4['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f80839c..7f0b171 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 _0x884e=['/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/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','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','./rpc.controller','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x884e,0x91));var _0xe884=function(_0x4a537b,_0x10055f){_0x4a537b=_0x4a537b-0x0;var _0x249efb=_0x884e[_0x4a537b];return _0x249efb;};'use strict';var multer=require(_0xe884('0x0'));var util=require(_0xe884('0x1'));var path=require('path');var express=require(_0xe884('0x2'));var router=express[_0xe884('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0xe884('0x4'));router['get'](_0xe884('0x5'),auth['isAuthenticated'](),controller[_0xe884('0x6')]);router['get'](_0xe884('0x7'),auth[_0xe884('0x8')](),controller[_0xe884('0x9')]);router[_0xe884('0xa')](_0xe884('0xb'),auth[_0xe884('0x8')](),controller[_0xe884('0xc')]);router[_0xe884('0xa')](_0xe884('0xd'),auth[_0xe884('0x8')](),controller[_0xe884('0xe')]);router[_0xe884('0xa')](_0xe884('0xf'),auth['isAuthenticated'](),controller[_0xe884('0x10')]);router[_0xe884('0xa')](_0xe884('0x11'),auth[_0xe884('0x8')](),controller[_0xe884('0x12')]);router['get']('/mail/accounts',auth[_0xe884('0x8')](),controller[_0xe884('0x13')]);router[_0xe884('0xa')](_0xe884('0x14'),auth[_0xe884('0x8')](),controller['openchannelQueues']);router['get'](_0xe884('0x15'),auth[_0xe884('0x8')](),controller[_0xe884('0x16')]);router[_0xe884('0xa')](_0xe884('0x17'),auth['isAuthenticated'](),controller[_0xe884('0x18')]);router['get'](_0xe884('0x19'),auth['isAuthenticated'](),controller[_0xe884('0x1a')]);router[_0xe884('0xa')](_0xe884('0x1b'),auth[_0xe884('0x8')](),controller[_0xe884('0x1c')]);router[_0xe884('0xa')](_0xe884('0x1d'),auth['isAuthenticated'](),controller[_0xe884('0x1e')]);router[_0xe884('0xa')](_0xe884('0x1f'),auth[_0xe884('0x8')](),controller[_0xe884('0x20')]);router[_0xe884('0xa')](_0xe884('0x21'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xe884('0xa')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0xe884('0x22')]);router[_0xe884('0xa')](_0xe884('0x23'),auth['isAuthenticated'](),controller[_0xe884('0x24')]);router[_0xe884('0xa')](_0xe884('0x25'),auth[_0xe884('0x8')](),controller[_0xe884('0x26')]);router[_0xe884('0xa')](_0xe884('0x27'),auth[_0xe884('0x8')](),controller['outboundChannels']);router[_0xe884('0xa')](_0xe884('0x28'),auth[_0xe884('0x8')](),controller[_0xe884('0x29')]);router[_0xe884('0x2a')](_0xe884('0x2b'),auth[_0xe884('0x8')](),controller[_0xe884('0x2c')]);router['get'](_0xe884('0x2d'),auth['isAuthenticated'](),controller[_0xe884('0x2e')]);router[_0xe884('0xa')](_0xe884('0x2f'),auth[_0xe884('0x8')](),controller[_0xe884('0x30')]);router[_0xe884('0xa')](_0xe884('0x31'),auth['isAuthenticated'](),controller['campaigns']);router[_0xe884('0xa')](_0xe884('0x32'),auth[_0xe884('0x8')](),controller[_0xe884('0x33')]);router['get'](_0xe884('0x34'),auth[_0xe884('0x8')](),controller[_0xe884('0x35')]);router['get'](_0xe884('0x36'),auth[_0xe884('0x8')](),controller[_0xe884('0x37')]);router[_0xe884('0xa')](_0xe884('0x38'),auth[_0xe884('0x8')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/sms/queues/waitinginteractions',auth[_0xe884('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xe884('0xa')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe884('0x39')]);router[_0xe884('0xa')](_0xe884('0x3a'),auth[_0xe884('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xe884('0x3b')](_0xe884('0x3c'),auth['isAuthenticated'](),controller[_0xe884('0x3d')]('mail'));router['get']('/mail/queues/:id',auth[_0xe884('0x8')](),controller['showMailQueues']);router[_0xe884('0x3b')](_0xe884('0x3e'),auth[_0xe884('0x8')](),controller[_0xe884('0x3d')](_0xe884('0x3f')));router[_0xe884('0xa')](_0xe884('0x40'),auth[_0xe884('0x8')](),controller[_0xe884('0x41')]);router[_0xe884('0x3b')]('/fax/queues/:id/notify',auth[_0xe884('0x8')](),controller['queueNotify']('fax'));router[_0xe884('0xa')](_0xe884('0x42'),auth[_0xe884('0x8')](),controller[_0xe884('0x43')]);router[_0xe884('0x3b')](_0xe884('0x44'),auth[_0xe884('0x8')](),controller['queueNotify'](_0xe884('0x45')));router[_0xe884('0xa')](_0xe884('0x46'),auth[_0xe884('0x8')](),controller[_0xe884('0x47')]);router[_0xe884('0x3b')](_0xe884('0x48'),auth[_0xe884('0x8')](),controller['queueNotify']('sms'));router[_0xe884('0x3b')](_0xe884('0x49'),auth[_0xe884('0x8')](),controller[_0xe884('0x3d')](_0xe884('0x4a')));router[_0xe884('0xa')](_0xe884('0x4b'),auth[_0xe884('0x8')](),controller[_0xe884('0x4c')]);router['get']('/whatsapp/queues/:id',auth[_0xe884('0x8')](),controller['showWhatsappQueues']);router[_0xe884('0x3b')](_0xe884('0x4d'),auth[_0xe884('0x8')](),controller[_0xe884('0x4e')]);module[_0xe884('0x4f')]=router; \ No newline at end of file +var _0x9bcb=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions'];(function(_0x5a2791,_0x3295d3){var _0x1e886d=function(_0x198060){while(--_0x198060){_0x5a2791['push'](_0x5a2791['shift']());}};_0x1e886d(++_0x3295d3);}(_0x9bcb,0x10d));var _0xb9bc=function(_0x4dc82a,_0x38363b){_0x4dc82a=_0x4dc82a-0x0;var _0x5d6547=_0x9bcb[_0x4dc82a];return _0x5d6547;};'use strict';var multer=require(_0xb9bc('0x0'));var util=require(_0xb9bc('0x1'));var path=require('path');var express=require(_0xb9bc('0x2'));var router=express[_0xb9bc('0x3')]();var auth=require(_0xb9bc('0x4'));var controller=require(_0xb9bc('0x5'));router[_0xb9bc('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0xb9bc('0x7')]);router[_0xb9bc('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x9')]);router[_0xb9bc('0x6')](_0xb9bc('0xa'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0xb')]);router[_0xb9bc('0x6')](_0xb9bc('0xc'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0xd')]);router['get']('/chat/queues',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0xe')]);router['get'](_0xb9bc('0xf'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x10')]);router[_0xb9bc('0x6')]('/mail/accounts',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x11')]);router[_0xb9bc('0x6')](_0xb9bc('0x12'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x13')]);router[_0xb9bc('0x6')](_0xb9bc('0x14'),auth['isAuthenticated'](),controller[_0xb9bc('0x15')]);router['get']('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xb9bc('0x16')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0xb9bc('0x17')]);router[_0xb9bc('0x6')](_0xb9bc('0x18'),auth['isAuthenticated'](),controller[_0xb9bc('0x19')]);router['get'](_0xb9bc('0x1a'),auth[_0xb9bc('0x8')](),controller['voiceQueuesChannels']);router[_0xb9bc('0x6')](_0xb9bc('0x1b'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x1c')]);router[_0xb9bc('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x1d')]);router[_0xb9bc('0x6')](_0xb9bc('0x1e'),auth['isAuthenticated'](),controller[_0xb9bc('0x1f')]);router[_0xb9bc('0x6')](_0xb9bc('0x20'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x21')]);router[_0xb9bc('0x6')](_0xb9bc('0x22'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x23')]);router[_0xb9bc('0x6')](_0xb9bc('0x24'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x25')]);router[_0xb9bc('0x6')](_0xb9bc('0x26'),auth[_0xb9bc('0x8')](),controller['agents']);router[_0xb9bc('0x27')](_0xb9bc('0x28'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x29')]);router[_0xb9bc('0x6')](_0xb9bc('0x2a'),auth[_0xb9bc('0x8')](),controller['telephones']);router[_0xb9bc('0x6')](_0xb9bc('0x2b'),auth['isAuthenticated'](),controller[_0xb9bc('0x2c')]);router[_0xb9bc('0x6')](_0xb9bc('0x2d'),auth[_0xb9bc('0x8')](),controller['campaigns']);router['get'](_0xb9bc('0x2e'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x2f')]);router[_0xb9bc('0x6')](_0xb9bc('0x30'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x31')]);router[_0xb9bc('0x6')](_0xb9bc('0x32'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x33')]);router['get'](_0xb9bc('0x34'),auth[_0xb9bc('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xb9bc('0x6')](_0xb9bc('0x35'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x36')]);router[_0xb9bc('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x37')]);router['get'](_0xb9bc('0x38'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x39')]);router[_0xb9bc('0x3a')]('/mail/queues/:id/notify',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3b')]('mail'));router['get']('/mail/queues/:id',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3c')]);router[_0xb9bc('0x3a')](_0xb9bc('0x3d'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3b')](_0xb9bc('0x3e')));router['get'](_0xb9bc('0x3f'),auth['isAuthenticated'](),controller[_0xb9bc('0x40')]);router[_0xb9bc('0x3a')](_0xb9bc('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0xb9bc('0x42')));router['get'](_0xb9bc('0x43'),auth['isAuthenticated'](),controller[_0xb9bc('0x44')]);router[_0xb9bc('0x3a')](_0xb9bc('0x45'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3b')](_0xb9bc('0x46')));router[_0xb9bc('0x6')](_0xb9bc('0x47'),auth['isAuthenticated'](),controller[_0xb9bc('0x48')]);router[_0xb9bc('0x3a')](_0xb9bc('0x49'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3b')](_0xb9bc('0x4a')));router[_0xb9bc('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x3b')](_0xb9bc('0x4b')));router[_0xb9bc('0x6')]('/sms/queues/:id',auth[_0xb9bc('0x8')](),controller['showSmsQueues']);router[_0xb9bc('0x6')]('/whatsapp/queues/:id',auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x4c')]);router[_0xb9bc('0x3a')](_0xb9bc('0x4d'),auth[_0xb9bc('0x8')](),controller[_0xb9bc('0x4e')]);module[_0xb9bc('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b09b928..0f22352 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 _0xdcbe=['sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','params','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','Message','TransferReport','agentTransferTimeout','moment','lodash','util','../../config/logger','http','client','request','then','error','code','message','status','json'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdcbe,0x164));var _0xedcb=function(_0x285387,_0x4a226d){_0x285387=_0x285387-0x0;var _0x3a18b6=_0xdcbe[_0x285387];return _0x3a18b6;};'use strict';var BPromise=require('bluebird');var moment=require(_0xedcb('0x0'));var _=require(_0xedcb('0x1'));var util=require(_0xedcb('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xedcb('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xedcb('0x4')]({'port':0x232a});var mailClient=jayson[_0xedcb('0x5')][_0xedcb('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0xedcb('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x154aa6,_0x914aa5,_0x233eff){return new BPromise(function(_0x423136,_0x90cf51){var _0x40cc37=_0x233eff?_0x233eff:amiClient;return _0x40cc37[_0xedcb('0x6')](_0x154aa6,_0x914aa5)[_0xedcb('0x7')](function(_0x21fa5c){if(_0x21fa5c[_0xedcb('0x8')]){if(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0x9')]===0x1f4){return _0x90cf51(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0xa')]);}return _0x423136(_0x21fa5c[_0xedcb('0x8')][_0xedcb('0xa')]);}else{_0x423136(_0x21fa5c['result']);}})['catch'](function(_0x5ef797){_0x90cf51(_0x5ef797);});});}function respondWithResult(_0x5e8553,_0x1eb0b2){_0x1eb0b2=_0x1eb0b2||0xc8;return function(_0x3e72af){if(_0x3e72af){return _0x5e8553[_0xedcb('0xb')](_0x1eb0b2)[_0xedcb('0xc')](_0x3e72af);}return _0x5e8553[_0xedcb('0xd')](0x194);};}function handleError(_0x48f941,_0x252a24){_0x252a24=_0x252a24||0x1f4;return function(_0x5895c0){logger['error'](_0x5895c0['stack']);if(_0x5895c0['name']){delete _0x5895c0[_0xedcb('0xe')];}_0x48f941[_0xedcb('0xb')](_0x252a24)[_0xedcb('0xf')](_0x5895c0);};}function findById(_0x1ecde0){return function(_0x5c4f50){if(!_['isNil'](_0x1ecde0)&&!_[_0xedcb('0x10')](_0x5c4f50)&&!_['isNil'](_0x5c4f50[_0xedcb('0x11')])){return _[_0xedcb('0x12')](_0x5c4f50[_0xedcb('0x11')],function(_0x5419a9){return _0x5419a9['id']==_0x1ecde0;});}return null;};}exports[_0xedcb('0x13')]=function(_0x59f3bf,_0x6b9bb9){return respondWithRpcPromise(_0xedcb('0x14'),_0x59f3bf[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x6b9bb9,null))[_0xedcb('0x16')](handleError(_0x6b9bb9,null));};exports[_0xedcb('0x17')]=function(_0x3c2513,_0x4581db){return respondWithRpcPromise(_0xedcb('0x18'),_[_0xedcb('0x19')](_0x3c2513[_0xedcb('0x15')],_0x3c2513['params']))['then'](respondWithResult(_0x4581db,null))[_0xedcb('0x16')](handleError(_0x4581db,null));};exports[_0xedcb('0x1a')]=function(_0x41616f,_0x10ef44){return respondWithRpcPromise(_0xedcb('0x1b'),_[_0xedcb('0x19')](_0x41616f['query'],_0x41616f['params']))[_0xedcb('0x7')](respondWithResult(_0x10ef44,null))[_0xedcb('0x16')](handleError(_0x10ef44,null));};exports['voiceQueues']=function(_0x352f75,_0x4bd339){return respondWithRpcPromise('VoiceQueues',_0x352f75['query'])['then'](respondWithResult(_0x4bd339,null))[_0xedcb('0x16')](handleError(_0x4bd339,null));};exports['showVoiceQueues']=function(_0xc80eff,_0x1671b5){return respondWithRpcPromise(_0xedcb('0x1c'),_0xc80eff[_0xedcb('0x15')])['then'](findById(_0xc80eff[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x1671b5,null))[_0xedcb('0x16')](handleError(_0x1671b5,null));};exports['voiceQueuesPreview']=function(_0x258133,_0x154f0a){return respondWithRpcPromise(_0xedcb('0x1e'),_[_0xedcb('0x19')](_0x258133['query'],_0x258133[_0xedcb('0x1d')]))['then'](respondWithResult(_0x154f0a,null))[_0xedcb('0x16')](handleError(_0x154f0a,null));};exports[_0xedcb('0x1f')]=function(_0x3cf3a8,_0x238560){return respondWithRpcPromise(_0xedcb('0x20'),_0x3cf3a8[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x238560,null))[_0xedcb('0x16')](handleError(_0x238560,null));};exports[_0xedcb('0x21')]=function(_0x227d8c,_0x38ab87){return respondWithRpcPromise(_0xedcb('0x22'),_[_0xedcb('0x19')](_0x227d8c[_0xedcb('0x15')],_0x227d8c[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x38ab87,null))['catch'](handleError(_0x38ab87,null));};exports[_0xedcb('0x23')]=function(_0x2dd67d,_0x59837a){return respondWithRpcPromise(_0xedcb('0x24'),_[_0xedcb('0x19')](_0x2dd67d[_0xedcb('0x15')],_0x2dd67d[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x59837a,null))[_0xedcb('0x16')](handleError(_0x59837a,null));};exports['voiceQueuesChannelRedirect']=function(_0x4f1b98,_0x286e56){return respondWithRpcPromise(_0xedcb('0x25'),_[_0xedcb('0x19')](_0x4f1b98[_0xedcb('0x15')],_0x4f1b98[_0xedcb('0x1d')]))[_0xedcb('0x7')](respondWithResult(_0x286e56,null))['catch'](handleError(_0x286e56,null));};exports[_0xedcb('0x26')]=function(_0x32eb9e,_0x466bbe){return respondWithRpcPromise('Outbound',_0x32eb9e[_0xedcb('0x15')])['then'](respondWithResult(_0x466bbe,null))[_0xedcb('0x16')](handleError(_0x466bbe,null));};exports[_0xedcb('0x27')]=function(_0x215c8c,_0x418d81){return respondWithRpcPromise(_0xedcb('0x28'),_0x215c8c[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x418d81,null))[_0xedcb('0x16')](handleError(_0x418d81,null));};exports[_0xedcb('0x29')]=function(_0x4b42a0,_0x6f88aa){var _0x1f3951;return respondWithRpcPromise(_0xedcb('0x2a'),_0x4b42a0[_0xedcb('0x15')])['then'](function(_0x528808){_0x1f3951=_0x528808;return respondWithRpcPromise(_0xedcb('0x2a'),_0x4b42a0[_0xedcb('0x15')],routingClient);})[_0xedcb('0x7')](function(_0x519b01){return _[_0xedcb('0x19')]({},_0x519b01,_0x1f3951);})[_0xedcb('0x7')](respondWithResult(_0x6f88aa,null))[_0xedcb('0x16')](handleError(_0x6f88aa,null));};exports[_0xedcb('0x2b')]=function(_0x202fe2,_0x2cc4ea){if(_0x202fe2[_0xedcb('0x2c')]&&_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')]&&_0x202fe2[_0xedcb('0x2e')]&&_0x202fe2[_0xedcb('0x2e')][_0xedcb('0xe')]){for(var _0x21f139 in _0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')]){if(_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0xedcb('0x2f')](_0x21f139)){db[_0xedcb('0x30')][_0xedcb('0x31')]({'where':{'channel':_0x21f139,'membername':_0x202fe2['user']['name'],'type':_0xedcb('0x32'),'exitAt':null,'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139]&&_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139]['length']?{'$notIn':_0x202fe2['body'][_0xedcb('0x2d')][_0x21f139]}:{'$ne':null}}})[_0xedcb('0x7')](function(_0x2ee8c2){var _0x2c0f2b=moment()[_0xedcb('0x33')](_0xedcb('0x34'));for(var _0xd8dd25=0x0,_0x1216c7=_0x2ee8c2[_0xedcb('0x35')];_0xd8dd25<_0x1216c7;_0xd8dd25+=0x1){_0x2ee8c2[_0xd8dd25][_0xedcb('0x36')]({'exitAt':_0x2c0f2b});}});for(var _0x5c8785=0x0;_0x5c8785<_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0xedcb('0x35')];_0x5c8785+=0x1){db[_0xedcb('0x30')][_0xedcb('0x37')]({'where':{'channel':_0x21f139,'membername':_0x202fe2[_0xedcb('0x2e')]['name'],'type':_0xedcb('0x32'),'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0x5c8785],'exitAt':null},'defaults':{'channel':_0x21f139,'membername':_0x202fe2[_0xedcb('0x2e')]['name'],'interface':_[_0xedcb('0x10')](_0x202fe2['user'][_0xedcb('0x38')])?util[_0xedcb('0x33')](_0xedcb('0x39'),_0x202fe2[_0xedcb('0x2e')][_0xedcb('0xe')]):_0x202fe2[_0xedcb('0x2e')][_0xedcb('0x38')],'type':_0xedcb('0x32'),'enterAt':moment()[_0xedcb('0x33')](_0xedcb('0x34')),'role':_0xedcb('0x3a'),'internal':_0x202fe2[_0xedcb('0x2e')][_0xedcb('0x3b')],'uniqueid':_0x202fe2[_0xedcb('0x2c')][_0xedcb('0x2d')][_0x21f139][_0x5c8785]}});}}}}return respondWithRpcPromise(_0xedcb('0x3c'),{'id':_0x202fe2[_0xedcb('0x1d')]['id'],'capacity':_0x202fe2['body'][_0xedcb('0x3d')]},routingClient)[_0xedcb('0x7')](respondWithResult(_0x2cc4ea,null))[_0xedcb('0x16')](handleError(_0x2cc4ea,null));};exports[_0xedcb('0x3e')]=function(_0x420c7b,_0x40a42a){return respondWithRpcPromise(_0xedcb('0x3f'),_0x420c7b[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x40a42a,null))['catch'](handleError(_0x40a42a,null));};exports[_0xedcb('0x40')]=function(_0x5107da,_0x1d2908){return respondWithRpcPromise('Trunks',_0x5107da[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x1d2908,null))['catch'](handleError(_0x1d2908,null));};exports[_0xedcb('0x41')]=function(_0x32a1c9,_0x33338b){return respondWithRpcPromise(_0xedcb('0x42'),_0x32a1c9[_0xedcb('0x15')])['then'](respondWithResult(_0x33338b,null))[_0xedcb('0x16')](handleError(_0x33338b,null));};exports[_0xedcb('0x43')]=function(_0x1d3516,_0x3b18e4){return respondWithRpcPromise(_0xedcb('0x44'),_0x1d3516[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x3b18e4,null))['catch'](handleError(_0x3b18e4,null));};exports[_0xedcb('0x45')]=function(_0x81f22,_0x2c8b0c){return respondWithRpcPromise(_0xedcb('0x44'),_0x81f22['query'],routingClient)[_0xedcb('0x7')](findById(_0x81f22[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x2c8b0c,null))[_0xedcb('0x16')](handleError(_0x2c8b0c,null));};exports[_0xedcb('0x46')]=function(_0x1dcb0a,_0x1da4ae){return respondWithRpcPromise('MailQueues',_0x1dcb0a[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x1da4ae,null))['catch'](handleError(_0x1da4ae,null));};exports[_0xedcb('0x47')]=function(_0x9d3d18,_0xf9b9ab){return respondWithRpcPromise(_0xedcb('0x48'),_0x9d3d18[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](findById(_0x9d3d18['params']['id']))[_0xedcb('0x7')](respondWithResult(_0xf9b9ab,null))[_0xedcb('0x16')](handleError(_0xf9b9ab,null));};exports[_0xedcb('0x49')]=function(_0x2b4850,_0x2b15b0){return respondWithRpcPromise(_0xedcb('0x4a'),_0x2b4850['query'],mailClient)[_0xedcb('0x7')](respondWithResult(_0x2b15b0,null))[_0xedcb('0x16')](handleError(_0x2b15b0,null));};exports[_0xedcb('0x4b')]=function(_0x11fe50,_0x54a527){return respondWithRpcPromise('OpenchannelQueues',_0x11fe50['query'],routingClient)['then'](respondWithResult(_0x54a527,null))[_0xedcb('0x16')](handleError(_0x54a527,null));};exports[_0xedcb('0x4c')]=function(_0xd5e8d0,_0x317b1d){return respondWithRpcPromise(_0xedcb('0x4d'),_0xd5e8d0['query'],routingClient)[_0xedcb('0x7')](findById(_0xd5e8d0['params']['id']))[_0xedcb('0x7')](respondWithResult(_0x317b1d,null))['catch'](handleError(_0x317b1d,null));};exports[_0xedcb('0x4e')]=function(_0x42ea66,_0x2c5798){return respondWithRpcPromise(_0xedcb('0x4f'),_0x42ea66[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2c5798,null))[_0xedcb('0x16')](handleError(_0x2c5798,null));};exports[_0xedcb('0x50')]=function(_0x22da49,_0x2ca4f9){return respondWithRpcPromise('SmsQueues',_0x22da49['query'],routingClient)['then'](findById(_0x22da49[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x2ca4f9,null))[_0xedcb('0x16')](handleError(_0x2ca4f9,null));};exports['whatsappQueues']=function(_0xebfec8,_0x436ba6){return respondWithRpcPromise(_0xedcb('0x51'),_0xebfec8[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0x436ba6,null))[_0xedcb('0x16')](handleError(_0x436ba6,null));};exports[_0xedcb('0x52')]=function(_0x25744f,_0x3849fb){return respondWithRpcPromise(_0xedcb('0x51'),_0x25744f['query'],routingClient)[_0xedcb('0x7')](findById(_0x25744f[_0xedcb('0x1d')]['id']))[_0xedcb('0x7')](respondWithResult(_0x3849fb,null))['catch'](handleError(_0x3849fb,null));};exports[_0xedcb('0x53')]=function(_0x3e1827,_0x5eaff2){return respondWithRpcPromise(_0xedcb('0x54'),_0x3e1827[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x5eaff2,null))[_0xedcb('0x16')](handleError(_0x5eaff2,null));};exports[_0xedcb('0x55')]=function(_0x27cbf0,_0x5c012d){return respondWithRpcPromise(_0xedcb('0x54'),_0x27cbf0['query'],routingClient)[_0xedcb('0x7')](findById(_0x27cbf0[_0xedcb('0x1d')]['id']))['then'](respondWithResult(_0x5c012d,null))[_0xedcb('0x16')](handleError(_0x5c012d,null));};exports['faxAccounts']=function(_0x55c40f,_0x269fa0){return respondWithRpcPromise(_0xedcb('0x56'),_0x55c40f[_0xedcb('0x15')])[_0xedcb('0x7')](respondWithResult(_0x269fa0,null))[_0xedcb('0x16')](handleError(_0x269fa0,null));};exports[_0xedcb('0x57')]=function(_0x2dd481,_0xc03269){return respondWithRpcPromise(_0xedcb('0x58'),_0x2dd481[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0xc03269,null))[_0xedcb('0x16')](handleError(_0xc03269,null));};exports[_0xedcb('0x59')]=function(_0x5366d0,_0x5678d5){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5366d0[_0xedcb('0x15')],routingClient)['then'](respondWithResult(_0x5678d5,null))[_0xedcb('0x16')](handleError(_0x5678d5,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4453ca,_0x112acb){return respondWithRpcPromise(_0xedcb('0x5a'),_0x4453ca[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x112acb,null))['catch'](handleError(_0x112acb,null));};exports[_0xedcb('0x5b')]=function(_0x4c102d,_0x2915ea){return respondWithRpcPromise(_0xedcb('0x5c'),_0x4c102d['query'],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2915ea,null))['catch'](handleError(_0x2915ea,null));};exports[_0xedcb('0x5d')]=function(_0x2d13c7,_0x1b40e7){return respondWithRpcPromise(_0xedcb('0x5e'),_0x2d13c7['query'],routingClient)[_0xedcb('0x7')](respondWithResult(_0x1b40e7,null))[_0xedcb('0x16')](handleError(_0x1b40e7,null));};exports[_0xedcb('0x5f')]=function(_0x3a4215,_0x2d98ab){return respondWithRpcPromise(_0xedcb('0x60'),_0x3a4215[_0xedcb('0x15')],routingClient)[_0xedcb('0x7')](respondWithResult(_0x2d98ab,null))[_0xedcb('0x16')](handleError(_0x2d98ab,null));};exports[_0xedcb('0x61')]=function(_0x31d6a5){return function(_0x1da9f2,_0x1cc8a4){var _0x4262f3,_0x57454f;var _0x2e23a7=_[_0xedcb('0x62')](_0x31d6a5);var _0x1b7e91=_0x31d6a5==='chat'?_0xedcb('0x63'):'Account';return db[_0x2e23a7+'Queue'][_0xedcb('0x64')]({'raw':!![],'where':{'id':_0x1da9f2[_0xedcb('0x1d')]['id']}})[_0xedcb('0x7')](function(_0xd22d0a){if(_['isNil'](_0xd22d0a)){throw new Error(_0x2e23a7+_0xedcb('0x65'));}_0x4262f3=_0xd22d0a;return db[_0x2e23a7+'Message'][_0xedcb('0x64')]({'where':{'id':_0x1da9f2[_0xedcb('0x2c')][_0xedcb('0x66')]},'include':[{'model':db[_0x2e23a7+_0xedcb('0x67')],'as':_0xedcb('0x67')},{'model':db[_0x2e23a7+_0x1b7e91],'as':'Account'}]});})[_0xedcb('0x7')](function(_0x4db277){if(_['isNil'](_0x4db277)){throw new Error(_0x2e23a7+_0xedcb('0x68'));}_0x57454f=_0x4db277;return _0x4db277[_0xedcb('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0xedcb('0x7')](function(){var _0xa8a184={'uniqueid':_0x31d6a5+'.'+_0x57454f['id']+'.'+_0x57454f[_0xedcb('0x67')]['id'],'FromUserId':_0x1da9f2['user']['id'],'type':_0xedcb('0x6a')};_0xa8a184[_0x2e23a7+'MessageId']=_0x57454f['id'];_0xa8a184[_0x2e23a7+_0xedcb('0x6b')]=_0x57454f[_0xedcb('0x67')]['id'];_0xa8a184[_0xedcb('0x6c')+_0x2e23a7+_0x1b7e91+'Id']=_0x57454f[_0xedcb('0x6d')]['id'];_0xa8a184['To'+_0x2e23a7+_0xedcb('0x6e')]=_0x4262f3['id'];return db[_0x2e23a7+'TransferReport'][_0xedcb('0x6f')](_0xa8a184);})[_0xedcb('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x31d6a5,'interaction':_0x57454f[_0xedcb('0x67')],'message':_0x57454f,'account':_0x57454f[_0xedcb('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xedcb('0x6a'),'appdata':_0x4262f3['name']+','+(_0x57454f[_0xedcb('0x6d')][_0xedcb('0x70')]||0x12c),'interval':_0xedcb('0x71')}]},routingClient);})['then'](respondWithResult(_0x1cc8a4,null))[_0xedcb('0x16')](handleError(_0x1cc8a4,null));};};exports[_0xedcb('0x72')]=function(_0x5607c2,_0x1b25df){var _0x567105,_0x4843d4;if(_[_0xedcb('0x10')](_0x5607c2[_0xedcb('0x2c')][_0xedcb('0x73')])){throw new Error(_0xedcb('0x74'));}var _0x57c616=_0x5607c2[_0xedcb('0x2c')][_0xedcb('0x73')];var _0x175366=_[_0xedcb('0x62')](_0x57c616);var _0x1f6ffd=_0x57c616===_0xedcb('0x75')?_0xedcb('0x63'):_0xedcb('0x6d');return db[_0xedcb('0x76')][_0xedcb('0x64')]({'raw':!![],'where':{'id':_0x5607c2[_0xedcb('0x1d')]['id'],'role':_0xedcb('0x3a')}})[_0xedcb('0x7')](function(_0xeaec58){if(_[_0xedcb('0x10')](_0xeaec58)){throw new Error(_0xedcb('0x77'));}_0x567105=_0xeaec58;return db[_0x175366+_0xedcb('0x78')]['findOne']({'where':{'id':_0x5607c2[_0xedcb('0x2c')]['messageId']},'include':[{'model':db[_0x175366+_0xedcb('0x67')],'as':'Interaction'},{'model':db[_0x175366+_0x1f6ffd],'as':'Account'}]});})[_0xedcb('0x7')](function(_0x57bdde){if(_['isNil'](_0x57bdde)){throw new Error(_0x175366+_0xedcb('0x68'));}_0x4843d4=_0x57bdde;return _0x57bdde[_0xedcb('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x246115={'uniqueid':_0x57c616+'.'+_0x4843d4['id']+'.'+_0x4843d4[_0xedcb('0x67')]['id'],'FromUserId':_0x5607c2[_0xedcb('0x2e')]['id'],'type':_0xedcb('0x6a'),'ToUserId':_0x567105['id']};_0x246115[_0x175366+'MessageId']=_0x4843d4['id'];_0x246115[_0x175366+_0xedcb('0x6b')]=_0x4843d4[_0xedcb('0x67')]['id'];_0x246115['From'+_0x175366+_0x1f6ffd+'Id']=_0x4843d4['Account']['id'];return db[_0x175366+_0xedcb('0x79')][_0xedcb('0x6f')](_0x246115);})[_0xedcb('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x57c616,'interaction':_0x4843d4['Interaction'],'message':_0x4843d4,'account':_0x4843d4[_0xedcb('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xedcb('0x3a'),'appdata':_0x567105[_0xedcb('0xe')]+','+(_0x4843d4[_0xedcb('0x6d')][_0xedcb('0x7a')]||0x12c),'interval':_0xedcb('0x71')}]},routingClient);})['then'](respondWithResult(_0x1b25df,null))['catch'](handleError(_0x1b25df,null));}; \ No newline at end of file +var _0x1186=['InteractionId','From','QueueId','Start','*,*,*,*','channel','Agent\x20not\x20found','\x20Message\x20not\x20found','TransferReport','create','bluebird','moment','lodash','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','ChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','update','queue','MessageId'];(function(_0x5b4369,_0x5f044e){var _0x39abf2=function(_0xcbc451){while(--_0xcbc451){_0x5b4369['push'](_0x5b4369['shift']());}};_0x39abf2(++_0x5f044e);}(_0x1186,0x1e6));var _0x6118=function(_0x3a50d3,_0x4adeb5){_0x3a50d3=_0x3a50d3-0x0;var _0x3ad913=_0x1186[_0x3a50d3];return _0x3ad913;};'use strict';var BPromise=require(_0x6118('0x0'));var moment=require(_0x6118('0x1'));var _=require(_0x6118('0x2'));var util=require('util');var db=require(_0x6118('0x3'))['db'];var logger=require(_0x6118('0x4'))('api');var jayson=require(_0x6118('0x5'));var amiClient=jayson[_0x6118('0x6')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x6118('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x6118('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4bcb0d,_0x18b5f2,_0x59d7c4){return new BPromise(function(_0x1e27e4,_0x52c933){var _0x442790=_0x59d7c4?_0x59d7c4:amiClient;return _0x442790[_0x6118('0x8')](_0x4bcb0d,_0x18b5f2)[_0x6118('0x9')](function(_0x3f7af0){if(_0x3f7af0[_0x6118('0xa')]){if(_0x3f7af0[_0x6118('0xa')][_0x6118('0xb')]===0x1f4){return _0x52c933(_0x3f7af0['error'][_0x6118('0xc')]);}return _0x1e27e4(_0x3f7af0[_0x6118('0xa')][_0x6118('0xc')]);}else{_0x1e27e4(_0x3f7af0[_0x6118('0xd')]);}})[_0x6118('0xe')](function(_0x41ff6d){_0x52c933(_0x41ff6d);});});}function respondWithResult(_0xd6790c,_0x5839d2){_0x5839d2=_0x5839d2||0xc8;return function(_0x5aaa5d){if(_0x5aaa5d){return _0xd6790c['status'](_0x5839d2)[_0x6118('0xf')](_0x5aaa5d);}return _0xd6790c[_0x6118('0x10')](0x194);};}function handleError(_0x2617d6,_0xf7ceec){_0xf7ceec=_0xf7ceec||0x1f4;return function(_0x59761d){logger[_0x6118('0xa')](_0x59761d[_0x6118('0x11')]);if(_0x59761d[_0x6118('0x12')]){delete _0x59761d[_0x6118('0x12')];}_0x2617d6[_0x6118('0x13')](_0xf7ceec)[_0x6118('0x14')](_0x59761d);};}function findById(_0x15176c){return function(_0x2928be){if(!_[_0x6118('0x15')](_0x15176c)&&!_[_0x6118('0x15')](_0x2928be)&&!_[_0x6118('0x15')](_0x2928be['rows'])){return _[_0x6118('0x16')](_0x2928be['rows'],function(_0x30695d){return _0x30695d['id']==_0x15176c;});}return null;};}exports[_0x6118('0x17')]=function(_0x57cd40,_0x511a73){return respondWithRpcPromise(_0x6118('0x18'),_0x57cd40['query'])['then'](respondWithResult(_0x511a73,null))[_0x6118('0xe')](handleError(_0x511a73,null));};exports[_0x6118('0x19')]=function(_0x68405,_0x25ab30){return respondWithRpcPromise(_0x6118('0x1a'),_[_0x6118('0x1b')](_0x68405[_0x6118('0x1c')],_0x68405[_0x6118('0x1d')]))[_0x6118('0x9')](respondWithResult(_0x25ab30,null))[_0x6118('0xe')](handleError(_0x25ab30,null));};exports[_0x6118('0x1e')]=function(_0xa20242,_0xbf7a70){return respondWithRpcPromise(_0x6118('0x1f'),_['merge'](_0xa20242[_0x6118('0x1c')],_0xa20242[_0x6118('0x1d')]))[_0x6118('0x9')](respondWithResult(_0xbf7a70,null))[_0x6118('0xe')](handleError(_0xbf7a70,null));};exports[_0x6118('0x20')]=function(_0x1ad071,_0x2f3fdb){return respondWithRpcPromise(_0x6118('0x21'),_0x1ad071['query'])[_0x6118('0x9')](respondWithResult(_0x2f3fdb,null))[_0x6118('0xe')](handleError(_0x2f3fdb,null));};exports['showVoiceQueues']=function(_0x1ec8a3,_0x1e6b35){return respondWithRpcPromise(_0x6118('0x21'),_0x1ec8a3['query'])['then'](findById(_0x1ec8a3['params']['id']))[_0x6118('0x9')](respondWithResult(_0x1e6b35,null))[_0x6118('0xe')](handleError(_0x1e6b35,null));};exports[_0x6118('0x22')]=function(_0x238776,_0x24fb73){return respondWithRpcPromise(_0x6118('0x23'),_[_0x6118('0x1b')](_0x238776[_0x6118('0x1c')],_0x238776['params']))[_0x6118('0x9')](respondWithResult(_0x24fb73,null))[_0x6118('0xe')](handleError(_0x24fb73,null));};exports[_0x6118('0x24')]=function(_0x12a3f0,_0xbb28ce){return respondWithRpcPromise(_0x6118('0x25'),_0x12a3f0[_0x6118('0x1c')])[_0x6118('0x9')](respondWithResult(_0xbb28ce,null))[_0x6118('0xe')](handleError(_0xbb28ce,null));};exports['voiceQueuesChannel']=function(_0x51d7ab,_0x4a0f0d){return respondWithRpcPromise(_0x6118('0x26'),_[_0x6118('0x1b')](_0x51d7ab[_0x6118('0x1c')],_0x51d7ab[_0x6118('0x1d')]))[_0x6118('0x9')](respondWithResult(_0x4a0f0d,null))[_0x6118('0xe')](handleError(_0x4a0f0d,null));};exports['voiceQueuesChannelHangup']=function(_0x35d178,_0x405175){return respondWithRpcPromise(_0x6118('0x27'),_[_0x6118('0x1b')](_0x35d178[_0x6118('0x1c')],_0x35d178['params']))[_0x6118('0x9')](respondWithResult(_0x405175,null))[_0x6118('0xe')](handleError(_0x405175,null));};exports[_0x6118('0x28')]=function(_0x1d8557,_0x4a0700){return respondWithRpcPromise(_0x6118('0x29'),_[_0x6118('0x1b')](_0x1d8557[_0x6118('0x1c')],_0x1d8557[_0x6118('0x1d')]))[_0x6118('0x9')](respondWithResult(_0x4a0700,null))[_0x6118('0xe')](handleError(_0x4a0700,null));};exports[_0x6118('0x2a')]=function(_0x4dd27e,_0x3c0341){return respondWithRpcPromise(_0x6118('0x2b'),_0x4dd27e[_0x6118('0x1c')])[_0x6118('0x9')](respondWithResult(_0x3c0341,null))['catch'](handleError(_0x3c0341,null));};exports['outboundChannels']=function(_0x40ac04,_0x185579){return respondWithRpcPromise(_0x6118('0x2c'),_0x40ac04['query'])[_0x6118('0x9')](respondWithResult(_0x185579,null))['catch'](handleError(_0x185579,null));};exports[_0x6118('0x2d')]=function(_0x3fad1c,_0x41e4e7){var _0x44638b;return respondWithRpcPromise(_0x6118('0x2e'),_0x3fad1c[_0x6118('0x1c')])[_0x6118('0x9')](function(_0x3666db){_0x44638b=_0x3666db;return respondWithRpcPromise(_0x6118('0x2e'),_0x3fad1c['query'],routingClient);})['then'](function(_0x326f6f){return _[_0x6118('0x1b')]({},_0x326f6f,_0x44638b);})[_0x6118('0x9')](respondWithResult(_0x41e4e7,null))[_0x6118('0xe')](handleError(_0x41e4e7,null));};exports[_0x6118('0x2f')]=function(_0x93b5cc,_0x1a2171){if(_0x93b5cc['body']&&_0x93b5cc[_0x6118('0x30')][_0x6118('0x31')]&&_0x93b5cc[_0x6118('0x32')]&&_0x93b5cc[_0x6118('0x32')]['name']){for(var _0x37d1b7 in _0x93b5cc[_0x6118('0x30')][_0x6118('0x31')]){if(_0x93b5cc[_0x6118('0x30')][_0x6118('0x31')][_0x6118('0x33')](_0x37d1b7)){db[_0x6118('0x34')]['findAll']({'where':{'channel':_0x37d1b7,'membername':_0x93b5cc['user']['name'],'type':_0x6118('0x35'),'exitAt':null,'uniqueid':_0x93b5cc[_0x6118('0x30')][_0x6118('0x31')][_0x37d1b7]&&_0x93b5cc['body'][_0x6118('0x31')][_0x37d1b7]['length']?{'$notIn':_0x93b5cc[_0x6118('0x30')][_0x6118('0x31')][_0x37d1b7]}:{'$ne':null}}})['then'](function(_0x573a20){var _0x3cb0aa=moment()[_0x6118('0x36')](_0x6118('0x37'));for(var _0xbfe683=0x0,_0x2d5cc6=_0x573a20['length'];_0xbfe683<_0x2d5cc6;_0xbfe683+=0x1){_0x573a20[_0xbfe683][_0x6118('0x38')]({'exitAt':_0x3cb0aa});}});for(var _0x3288eb=0x0;_0x3288eb<_0x93b5cc[_0x6118('0x30')][_0x6118('0x31')][_0x37d1b7][_0x6118('0x39')];_0x3288eb+=0x1){db[_0x6118('0x34')][_0x6118('0x3a')]({'where':{'channel':_0x37d1b7,'membername':_0x93b5cc['user'][_0x6118('0x12')],'type':_0x6118('0x35'),'uniqueid':_0x93b5cc['body'][_0x6118('0x31')][_0x37d1b7][_0x3288eb],'exitAt':null},'defaults':{'channel':_0x37d1b7,'membername':_0x93b5cc[_0x6118('0x32')][_0x6118('0x12')],'interface':_[_0x6118('0x15')](_0x93b5cc[_0x6118('0x32')][_0x6118('0x3b')])?util[_0x6118('0x36')](_0x6118('0x3c'),_0x93b5cc[_0x6118('0x32')]['name']):_0x93b5cc[_0x6118('0x32')]['interface'],'type':_0x6118('0x35'),'enterAt':moment()[_0x6118('0x36')](_0x6118('0x37')),'role':_0x6118('0x3d'),'internal':_0x93b5cc[_0x6118('0x32')][_0x6118('0x3e')],'uniqueid':_0x93b5cc['body'][_0x6118('0x31')][_0x37d1b7][_0x3288eb]}});}}}}return respondWithRpcPromise(_0x6118('0x3f'),{'id':_0x93b5cc[_0x6118('0x1d')]['id'],'capacity':_0x93b5cc[_0x6118('0x30')][_0x6118('0x40')]},routingClient)[_0x6118('0x9')](respondWithResult(_0x1a2171,null))['catch'](handleError(_0x1a2171,null));};exports['telephones']=function(_0x58d46d,_0x46be56){return respondWithRpcPromise(_0x6118('0x41'),_0x58d46d[_0x6118('0x1c')])['then'](respondWithResult(_0x46be56,null))[_0x6118('0xe')](handleError(_0x46be56,null));};exports[_0x6118('0x42')]=function(_0x2988be,_0x2d8add){return respondWithRpcPromise(_0x6118('0x43'),_0x2988be[_0x6118('0x1c')])[_0x6118('0x9')](respondWithResult(_0x2d8add,null))[_0x6118('0xe')](handleError(_0x2d8add,null));};exports[_0x6118('0x44')]=function(_0x3b057c,_0x116ee4){return respondWithRpcPromise('Campaigns',_0x3b057c[_0x6118('0x1c')])[_0x6118('0x9')](respondWithResult(_0x116ee4,null))[_0x6118('0xe')](handleError(_0x116ee4,null));};exports['chatQueues']=function(_0x5a3294,_0xff46fe){return respondWithRpcPromise('ChatQueues',_0x5a3294[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0xff46fe,null))[_0x6118('0xe')](handleError(_0xff46fe,null));};exports['showChatQueues']=function(_0x3baa27,_0x50ad73){return respondWithRpcPromise(_0x6118('0x45'),_0x3baa27[_0x6118('0x1c')],routingClient)['then'](findById(_0x3baa27[_0x6118('0x1d')]['id']))[_0x6118('0x9')](respondWithResult(_0x50ad73,null))[_0x6118('0xe')](handleError(_0x50ad73,null));};exports['mailQueues']=function(_0x13bec6,_0x8e1134){return respondWithRpcPromise('MailQueues',_0x13bec6[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x8e1134,null))[_0x6118('0xe')](handleError(_0x8e1134,null));};exports[_0x6118('0x46')]=function(_0x58192c,_0x52537f){return respondWithRpcPromise(_0x6118('0x47'),_0x58192c[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](findById(_0x58192c['params']['id']))['then'](respondWithResult(_0x52537f,null))[_0x6118('0xe')](handleError(_0x52537f,null));};exports[_0x6118('0x48')]=function(_0x4d760d,_0xf4e22c){return respondWithRpcPromise(_0x6118('0x49'),_0x4d760d[_0x6118('0x1c')],mailClient)['then'](respondWithResult(_0xf4e22c,null))[_0x6118('0xe')](handleError(_0xf4e22c,null));};exports[_0x6118('0x4a')]=function(_0xaf17d5,_0x169667){return respondWithRpcPromise(_0x6118('0x4b'),_0xaf17d5[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x169667,null))[_0x6118('0xe')](handleError(_0x169667,null));};exports[_0x6118('0x4c')]=function(_0x1414ec,_0x395b5a){return respondWithRpcPromise(_0x6118('0x4b'),_0x1414ec[_0x6118('0x1c')],routingClient)['then'](findById(_0x1414ec['params']['id']))['then'](respondWithResult(_0x395b5a,null))[_0x6118('0xe')](handleError(_0x395b5a,null));};exports[_0x6118('0x4d')]=function(_0x332b98,_0x3b65d5){return respondWithRpcPromise(_0x6118('0x4e'),_0x332b98['query'],routingClient)[_0x6118('0x9')](respondWithResult(_0x3b65d5,null))[_0x6118('0xe')](handleError(_0x3b65d5,null));};exports[_0x6118('0x4f')]=function(_0x12b9f1,_0x537702){return respondWithRpcPromise('SmsQueues',_0x12b9f1[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](findById(_0x12b9f1[_0x6118('0x1d')]['id']))[_0x6118('0x9')](respondWithResult(_0x537702,null))[_0x6118('0xe')](handleError(_0x537702,null));};exports[_0x6118('0x50')]=function(_0x4195bc,_0x585ffa){return respondWithRpcPromise(_0x6118('0x51'),_0x4195bc[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x585ffa,null))[_0x6118('0xe')](handleError(_0x585ffa,null));};exports[_0x6118('0x52')]=function(_0x1ef0a8,_0x278a34){return respondWithRpcPromise('WhatsappQueues',_0x1ef0a8[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](findById(_0x1ef0a8[_0x6118('0x1d')]['id']))[_0x6118('0x9')](respondWithResult(_0x278a34,null))['catch'](handleError(_0x278a34,null));};exports['faxQueues']=function(_0x2d3a82,_0x22d301){return respondWithRpcPromise(_0x6118('0x53'),_0x2d3a82[_0x6118('0x1c')],routingClient)['then'](respondWithResult(_0x22d301,null))[_0x6118('0xe')](handleError(_0x22d301,null));};exports[_0x6118('0x54')]=function(_0x506dfe,_0x127acb){return respondWithRpcPromise(_0x6118('0x53'),_0x506dfe[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](findById(_0x506dfe['params']['id']))[_0x6118('0x9')](respondWithResult(_0x127acb,null))[_0x6118('0xe')](handleError(_0x127acb,null));};exports['faxAccounts']=function(_0x170517,_0x216166){return respondWithRpcPromise(_0x6118('0x55'),_0x170517[_0x6118('0x1c')])[_0x6118('0x9')](respondWithResult(_0x216166,null))[_0x6118('0xe')](handleError(_0x216166,null));};exports[_0x6118('0x56')]=function(_0x1ee0e5,_0x1e691d){return respondWithRpcPromise(_0x6118('0x57'),_0x1ee0e5[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x1e691d,null))[_0x6118('0xe')](handleError(_0x1e691d,null));};exports['mailQueuesWaitingInteractions']=function(_0x34471f,_0x12f784){return respondWithRpcPromise(_0x6118('0x58'),_0x34471f[_0x6118('0x1c')],routingClient)['then'](respondWithResult(_0x12f784,null))[_0x6118('0xe')](handleError(_0x12f784,null));};exports[_0x6118('0x59')]=function(_0x2fa8a0,_0x5ea60b){return respondWithRpcPromise(_0x6118('0x5a'),_0x2fa8a0[_0x6118('0x1c')],routingClient)['then'](respondWithResult(_0x5ea60b,null))['catch'](handleError(_0x5ea60b,null));};exports[_0x6118('0x5b')]=function(_0x538612,_0x2c152c){return respondWithRpcPromise(_0x6118('0x5c'),_0x538612[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x2c152c,null))[_0x6118('0xe')](handleError(_0x2c152c,null));};exports[_0x6118('0x5d')]=function(_0x24ef02,_0x207362){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x24ef02[_0x6118('0x1c')],routingClient)['then'](respondWithResult(_0x207362,null))[_0x6118('0xe')](handleError(_0x207362,null));};exports[_0x6118('0x5e')]=function(_0x4793f4,_0x13268d){return respondWithRpcPromise(_0x6118('0x5f'),_0x4793f4[_0x6118('0x1c')],routingClient)[_0x6118('0x9')](respondWithResult(_0x13268d,null))['catch'](handleError(_0x13268d,null));};exports['queueNotify']=function(_0x565190){return function(_0x4e0f80,_0x81c2e7){var _0x413c36,_0x4316c1;var _0x1679ed=_[_0x6118('0x60')](_0x565190);var _0x3917a7=_0x565190===_0x6118('0x61')?_0x6118('0x62'):'Account';return db[_0x1679ed+_0x6118('0x63')][_0x6118('0x64')]({'raw':!![],'where':{'id':_0x4e0f80[_0x6118('0x1d')]['id']}})[_0x6118('0x9')](function(_0x5e8c3b){if(_[_0x6118('0x15')](_0x5e8c3b)){throw new Error(_0x1679ed+_0x6118('0x65'));}_0x413c36=_0x5e8c3b;return db[_0x1679ed+_0x6118('0x66')]['findOne']({'where':{'id':_0x4e0f80[_0x6118('0x30')][_0x6118('0x67')]},'include':[{'model':db[_0x1679ed+'Interaction'],'as':_0x6118('0x68')},{'model':db[_0x1679ed+_0x3917a7],'as':_0x6118('0x69')}]});})[_0x6118('0x9')](function(_0x390d95){if(_[_0x6118('0x15')](_0x390d95)){throw new Error(_0x1679ed+'\x20Message\x20not\x20found');}_0x4316c1=_0x390d95;return _0x390d95[_0x6118('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x36267f={'uniqueid':_0x565190+'.'+_0x4316c1['id']+'.'+_0x4316c1['Interaction']['id'],'FromUserId':_0x4e0f80[_0x6118('0x32')]['id'],'type':_0x6118('0x6b')};_0x36267f[_0x1679ed+_0x6118('0x6c')]=_0x4316c1['id'];_0x36267f[_0x1679ed+_0x6118('0x6d')]=_0x4316c1['Interaction']['id'];_0x36267f[_0x6118('0x6e')+_0x1679ed+_0x3917a7+'Id']=_0x4316c1['Account']['id'];_0x36267f['To'+_0x1679ed+_0x6118('0x6f')]=_0x413c36['id'];return db[_0x1679ed+'TransferReport']['create'](_0x36267f);})['then'](function(){return respondWithRpcPromise(_0x6118('0x70'),{'channel':_0x565190,'interaction':_0x4316c1[_0x6118('0x68')],'message':_0x4316c1,'account':_0x4316c1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x413c36['name']+','+(_0x4316c1[_0x6118('0x69')]['queueTransferTimeout']||0x12c),'interval':_0x6118('0x71')}]},routingClient);})[_0x6118('0x9')](respondWithResult(_0x81c2e7,null))[_0x6118('0xe')](handleError(_0x81c2e7,null));};};exports['agentNotify']=function(_0x1d917c,_0x3e7a45){var _0x4d6dea,_0x5509fe;if(_[_0x6118('0x15')](_0x1d917c[_0x6118('0x30')][_0x6118('0x72')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x22185b=_0x1d917c[_0x6118('0x30')][_0x6118('0x72')];var _0x3aab9e=_['capitalize'](_0x22185b);var _0x2790b4=_0x22185b==='chat'?'Website':'Account';return db['User'][_0x6118('0x64')]({'raw':!![],'where':{'id':_0x1d917c[_0x6118('0x1d')]['id'],'role':_0x6118('0x3d')}})[_0x6118('0x9')](function(_0x51a56d){if(_[_0x6118('0x15')](_0x51a56d)){throw new Error(_0x6118('0x73'));}_0x4d6dea=_0x51a56d;return db[_0x3aab9e+_0x6118('0x66')][_0x6118('0x64')]({'where':{'id':_0x1d917c[_0x6118('0x30')][_0x6118('0x67')]},'include':[{'model':db[_0x3aab9e+'Interaction'],'as':_0x6118('0x68')},{'model':db[_0x3aab9e+_0x2790b4],'as':_0x6118('0x69')}]});})['then'](function(_0x3f996f){if(_[_0x6118('0x15')](_0x3f996f)){throw new Error(_0x3aab9e+_0x6118('0x74'));}_0x5509fe=_0x3f996f;return _0x3f996f[_0x6118('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x56969f={'uniqueid':_0x22185b+'.'+_0x5509fe['id']+'.'+_0x5509fe['Interaction']['id'],'FromUserId':_0x1d917c['user']['id'],'type':_0x6118('0x6b'),'ToUserId':_0x4d6dea['id']};_0x56969f[_0x3aab9e+_0x6118('0x6c')]=_0x5509fe['id'];_0x56969f[_0x3aab9e+_0x6118('0x6d')]=_0x5509fe[_0x6118('0x68')]['id'];_0x56969f[_0x6118('0x6e')+_0x3aab9e+_0x2790b4+'Id']=_0x5509fe[_0x6118('0x69')]['id'];return db[_0x3aab9e+_0x6118('0x75')][_0x6118('0x76')](_0x56969f);})[_0x6118('0x9')](function(){return respondWithRpcPromise(_0x6118('0x70'),{'channel':_0x22185b,'interaction':_0x5509fe[_0x6118('0x68')],'message':_0x5509fe,'account':_0x5509fe[_0x6118('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x4d6dea[_0x6118('0x12')]+','+(_0x5509fe[_0x6118('0x69')]['agentTransferTimeout']||0x12c),'interval':_0x6118('0x71')}]},routingClient);})[_0x6118('0x9')](respondWithResult(_0x3e7a45,null))[_0x6118('0xe')](handleError(_0x3e7a45,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 326d7cf..b8cd1e8 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 _0x7278=['put','destroy','util','connect-timeout','Router','../../components/interaction/service','./schedule.controller','index','get','/:id','isAuthenticated','show','run','post','create'];(function(_0x1e3c58,_0x4baead){var _0x2cd780=function(_0x2e4fe1){while(--_0x2e4fe1){_0x1e3c58['push'](_0x1e3c58['shift']());}};_0x2cd780(++_0x4baead);}(_0x7278,0x15b));var _0x8727=function(_0xcc25cb,_0x286ad5){_0xcc25cb=_0xcc25cb-0x0;var _0x16fc94=_0x7278[_0xcc25cb];return _0x16fc94;};'use strict';var multer=require('multer');var util=require(_0x8727('0x0'));var path=require('path');var timeout=require(_0x8727('0x1'));var express=require('express');var router=express[_0x8727('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8727('0x3'));var config=require('../../config/environment');var controller=require(_0x8727('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x8727('0x5')]);router[_0x8727('0x6')](_0x8727('0x7'),auth[_0x8727('0x8')](),controller[_0x8727('0x9')]);router[_0x8727('0x6')]('/:id/run',auth[_0x8727('0x8')](),controller[_0x8727('0xa')]);router[_0x8727('0xb')]('/',auth['isAuthenticated'](),controller[_0x8727('0xc')]);router[_0x8727('0xd')](_0x8727('0x7'),auth[_0x8727('0x8')](),controller['update']);router['delete'](_0x8727('0x7'),auth[_0x8727('0x8')](),controller[_0x8727('0xe')]);module['exports']=router; \ No newline at end of file +var _0x36cc=['get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./schedule.controller'];(function(_0x3f6591,_0xee2393){var _0x3e03d5=function(_0x3306d1){while(--_0x3306d1){_0x3f6591['push'](_0x3f6591['shift']());}};_0x3e03d5(++_0xee2393);}(_0x36cc,0xcb));var _0xc36c=function(_0x5211bd,_0x2278dd){_0x5211bd=_0x5211bd-0x0;var _0x86d502=_0x36cc[_0x5211bd];return _0x86d502;};'use strict';var multer=require(_0xc36c('0x0'));var util=require('util');var path=require(_0xc36c('0x1'));var timeout=require(_0xc36c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xc36c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc36c('0x4'));var controller=require(_0xc36c('0x5'));router[_0xc36c('0x6')]('/',auth[_0xc36c('0x7')](),controller[_0xc36c('0x8')]);router[_0xc36c('0x6')]('/:id',auth[_0xc36c('0x7')](),controller[_0xc36c('0x9')]);router[_0xc36c('0x6')](_0xc36c('0xa'),auth[_0xc36c('0x7')](),controller[_0xc36c('0xb')]);router[_0xc36c('0xc')]('/',auth[_0xc36c('0x7')](),controller[_0xc36c('0xd')]);router[_0xc36c('0xe')](_0xc36c('0xf'),auth['isAuthenticated'](),controller[_0xc36c('0x10')]);router[_0xc36c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc36c('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 879754a..cd960b7 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 _0xb0df=['csv','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','days','hours','ENUM'];(function(_0x426445,_0x3d6c0f){var _0x2d56ce=function(_0x176d2e){while(--_0x176d2e){_0x426445['push'](_0x426445['shift']());}};_0x2d56ce(++_0x3d6c0f);}(_0xb0df,0x85));var _0xfb0d=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0xb0df[_0x2bcd1f];return _0x2381ca;};'use strict';var Sequelize=require('sequelize');module[_0xfb0d('0x0')]={'name':{'type':Sequelize[_0xfb0d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfb0d('0x1')]},'active':{'type':Sequelize[_0xfb0d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfb0d('0x1')],'allowNull':![],'defaultValue':_0xfb0d('0x3')},'startAt':{'type':Sequelize[_0xfb0d('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfb0d('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfb0d('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xfb0d('0x6'),_0xfb0d('0x7'),'months','weeks',_0xfb0d('0x8'),_0xfb0d('0x9'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xfb0d('0xa')](_0xfb0d('0xb'),'pdf',_0xfb0d('0xc')),'allowNull':![],'defaultValue':_0xfb0d('0xb')},'type':{'type':Sequelize[_0xfb0d('0xa')](_0xfb0d('0xd'),_0xfb0d('0xe')),'allowNull':![],'defaultValue':_0xfb0d('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xfb0d('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xfb0d('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xfb0d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9505=['months','hours','minutes','days','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters'];(function(_0x1d822a,_0x3dd0eb){var _0x56e700=function(_0x2548ac){while(--_0x2548ac){_0x1d822a['push'](_0x1d822a['shift']());}};_0x56e700(++_0x3dd0eb);}(_0x9505,0x1e5));var _0x5950=function(_0x253fa3,_0xaaac26){_0x253fa3=_0x253fa3-0x0;var _0x1b3d55=_0x9505[_0x253fa3];return _0x1b3d55;};'use strict';var Sequelize=require(_0x5950('0x0'));module[_0x5950('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5950('0x2')]},'active':{'type':Sequelize[_0x5950('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5950('0x2')],'allowNull':![],'defaultValue':_0x5950('0x4')},'startAt':{'type':Sequelize[_0x5950('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5950('0x6')](_0x5950('0x7'),_0x5950('0x8'),_0x5950('0x9'),'weeks','days',_0x5950('0xa'),_0x5950('0xb')),'allowNull':![],'defaultValue':_0x5950('0xc')},'output':{'type':Sequelize[_0x5950('0x6')](_0x5950('0xd'),_0x5950('0xe'),_0x5950('0xf')),'allowNull':![],'defaultValue':_0x5950('0xd')},'type':{'type':Sequelize[_0x5950('0x6')]('custom',_0x5950('0x10')),'allowNull':![],'defaultValue':_0x5950('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5950('0x12')]},'bcc':{'type':Sequelize[_0x5950('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x5950('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0847bdf..386b77e 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 _0xdc3a=['Scheduler','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','html-pdf','eml-format','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/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy'];(function(_0x1defca,_0x371404){var _0x553cff=function(_0x336898){while(--_0x336898){_0x1defca['push'](_0x1defca['shift']());}};_0x553cff(++_0x371404);}(_0xdc3a,0x135));var _0xadc3=function(_0x2b5893,_0x5d3a09){_0x2b5893=_0x2b5893-0x0;var _0x2d235d=_0xdc3a[_0x2b5893];return _0x2d235d;};'use strict';var pdf=require(_0xadc3('0x0'));var emlformat=require(_0xadc3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadc3('0x2'));var moment=require(_0xadc3('0x3'));var BPromise=require(_0xadc3('0x4'));var Mustache=require(_0xadc3('0x5'));var util=require(_0xadc3('0x6'));var path=require(_0xadc3('0x7'));var sox=require(_0xadc3('0x8'));var csv=require(_0xadc3('0x9'));var ejs=require(_0xadc3('0xa'));var fs=require('fs');var _=require(_0xadc3('0xb'));var squel=require(_0xadc3('0xc'));var crypto=require(_0xadc3('0xd'));var jsforce=require(_0xadc3('0xe'));var deskjs=require(_0xadc3('0xf'));var toCsv=require(_0xadc3('0x9'));var querystring=require(_0xadc3('0x10'));var Papa=require(_0xadc3('0x11'));var Redis=require(_0xadc3('0x12'));var authService=require(_0xadc3('0x13'));var qs=require(_0xadc3('0x14'));var as=require(_0xadc3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadc3('0x16'))(_0xadc3('0x17'));var utils=require(_0xadc3('0x18'));var config=require(_0xadc3('0x19'));var db=require(_0xadc3('0x1a'))['db'];function respondWithStatusCode(_0x5d279b,_0x58a5ec){_0x58a5ec=_0x58a5ec||0xcc;return function(_0x5b5cd4){if(_0x5b5cd4){return _0x5d279b['sendStatus'](_0x58a5ec);}return _0x5d279b['status'](_0x58a5ec)[_0xadc3('0x1b')]();};}function respondWithResult(_0x33b9b6,_0xf8a88a){_0xf8a88a=_0xf8a88a||0xc8;return function(_0x1a273d){if(_0x1a273d){return _0x33b9b6[_0xadc3('0x1c')](_0xf8a88a)[_0xadc3('0x1d')](_0x1a273d);}};}function respondWithFilteredResult(_0x32680e,_0x29f399){return function(_0xa8d026){if(_0xa8d026){var _0x437e50=_0xa8d026[_0xadc3('0x1e')],_0x2a1a00=_0x29f399[_0xadc3('0x1f')],_0x5153b2=_0x29f399[_0xadc3('0x1f')]+_0x29f399[_0xadc3('0x20')],_0x5a6152;if(_0x5153b2>=_0x437e50){_0x5153b2=_0x437e50;_0x5a6152=0xc8;}else{_0x5a6152=0xce;}_0x32680e['status'](_0x5a6152);return _0x32680e['set'](_0xadc3('0x21'),_0x2a1a00+'-'+_0x5153b2+'/'+_0x437e50)[_0xadc3('0x1d')](_0xa8d026);}return null;};}function patchUpdates(_0x123d80){return function(_0x1ea392){try{jsonpatch[_0xadc3('0x22')](_0x1ea392,_0x123d80,!![]);}catch(_0xfa154a){return BPromise[_0xadc3('0x23')](_0xfa154a);}return _0x1ea392['save']();};}function saveUpdates(_0x5df1be,_0x276f2b){return function(_0x2719a3){if(_0x2719a3){return _0x2719a3[_0xadc3('0x24')](_0x5df1be)[_0xadc3('0x25')](function(_0x7de1dd){return _0x7de1dd;});}return null;};}function removeEntity(_0x52c5c9,_0xb63960){return function(_0x56f504){if(_0x56f504){return _0x56f504[_0xadc3('0x26')]()[_0xadc3('0x25')](function(){var _0x370bc7=_0x56f504['get']({'plain':!![]});var _0x45dab4=_0xadc3('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x45dab4,'resourceId':_0x370bc7['id']}})[_0xadc3('0x25')](function(){return _0x56f504;});})[_0xadc3('0x25')](function(){_0x52c5c9[_0xadc3('0x1c')](0xcc)[_0xadc3('0x1b')]();});}};}function handleEntityNotFound(_0x12f715,_0x4d275b){return function(_0x1469c2){if(!_0x1469c2){_0x12f715['sendStatus'](0x194);}return _0x1469c2;};}function handleError(_0x464006,_0x3d3fce){_0x3d3fce=_0x3d3fce||0x1f4;return function(_0x32fc3b){logger['error'](_0x32fc3b[_0xadc3('0x28')]);if(_0x32fc3b[_0xadc3('0x29')]){delete _0x32fc3b['name'];}_0x464006[_0xadc3('0x1c')](_0x3d3fce)[_0xadc3('0x2a')](_0x32fc3b);};}exports['index']=function(_0x5c2f48,_0x435195){var _0x1d4994={},_0x205520={},_0x1a7499={'count':0x0,'rows':[]};var _0x162ceb=_[_0xadc3('0x2b')](db[_0xadc3('0x2c')][_0xadc3('0x2d')],function(_0x16b78e){return{'name':_0x16b78e[_0xadc3('0x2e')],'type':_0x16b78e[_0xadc3('0x2f')][_0xadc3('0x30')]};});_0x205520[_0xadc3('0x31')]=_[_0xadc3('0x2b')](_0x162ceb,_0xadc3('0x29'));_0x205520[_0xadc3('0x32')]=_[_0xadc3('0x33')](_0x5c2f48[_0xadc3('0x32')]);_0x205520[_0xadc3('0x34')]=_[_0xadc3('0x35')](_0x205520[_0xadc3('0x31')],_0x205520['query']);_0x1d4994[_0xadc3('0x36')]=_['intersection'](_0x205520['model'],qs[_0xadc3('0x37')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x37')]));_0x1d4994[_0xadc3('0x36')]=_0x1d4994[_0xadc3('0x36')]['length']?_0x1d4994[_0xadc3('0x36')]:_0x205520[_0xadc3('0x31')];if(!_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x38')](_0xadc3('0x39'))){_0x1d4994['limit']=qs[_0xadc3('0x20')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x20')]);_0x1d4994[_0xadc3('0x1f')]=qs[_0xadc3('0x1f')](_0x5c2f48['query']['offset']);}_0x1d4994[_0xadc3('0x3a')]=qs[_0xadc3('0x3b')](_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3b')]);_0x1d4994['where']=qs['filters'](_[_0xadc3('0x3c')](_0x5c2f48['query'],_0x205520[_0xadc3('0x34')]),_0x162ceb);if(_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3d')]){_0x1d4994[_0xadc3('0x3e')]=_[_0xadc3('0x3f')](_0x1d4994[_0xadc3('0x3e')],{'$or':_[_0xadc3('0x2b')](_0x162ceb,function(_0xbf58f5){if(_0xbf58f5[_0xadc3('0x2f')]!==_0xadc3('0x40')){var _0x255dc4={};_0x255dc4[_0xbf58f5['name']]={'$like':'%'+_0x5c2f48[_0xadc3('0x32')][_0xadc3('0x3d')]+'%'};return _0x255dc4;}})});}_0x1d4994=_[_0xadc3('0x3f')]({},_0x1d4994,_0x5c2f48[_0xadc3('0x41')]);var _0x26d46e={'where':_0x1d4994[_0xadc3('0x3e')]};return db[_0xadc3('0x2c')][_0xadc3('0x1e')](_0x26d46e)[_0xadc3('0x25')](function(_0x169596){_0x1a7499['count']=_0x169596;if(_0x5c2f48['query'][_0xadc3('0x42')]){_0x1d4994[_0xadc3('0x43')]=[{'all':!![]}];}return db[_0xadc3('0x2c')][_0xadc3('0x44')](_0x1d4994);})['then'](function(_0x403adf){_0x1a7499[_0xadc3('0x45')]=_0x403adf;return _0x1a7499;})[_0xadc3('0x25')](respondWithFilteredResult(_0x435195,_0x1d4994))[_0xadc3('0x46')](handleError(_0x435195,null));};exports[_0xadc3('0x47')]=function(_0x522887,_0x160712){var _0x149b23={'raw':![],'where':{'id':_0x522887[_0xadc3('0x48')]['id']}},_0x212375={};_0x212375[_0xadc3('0x31')]=_[_0xadc3('0x33')](db[_0xadc3('0x2c')]['rawAttributes']);_0x212375['query']=_['keys'](_0x522887['query']);_0x212375[_0xadc3('0x34')]=_[_0xadc3('0x35')](_0x212375[_0xadc3('0x31')],_0x212375[_0xadc3('0x32')]);_0x149b23['attributes']=_[_0xadc3('0x35')](_0x212375[_0xadc3('0x31')],qs['fields'](_0x522887[_0xadc3('0x32')][_0xadc3('0x37')]));_0x149b23[_0xadc3('0x36')]=_0x149b23[_0xadc3('0x36')][_0xadc3('0x49')]?_0x149b23[_0xadc3('0x36')]:_0x212375['model'];if(_0x522887['query']['includeAll']){_0x149b23['include']=[{'all':!![]}];}_0x149b23=_['merge']({},_0x149b23,_0x522887[_0xadc3('0x41')]);return db[_0xadc3('0x2c')][_0xadc3('0x4a')](_0x149b23)[_0xadc3('0x25')](handleEntityNotFound(_0x160712,null))['then'](respondWithResult(_0x160712,null))[_0xadc3('0x46')](handleError(_0x160712,null));};exports[_0xadc3('0x4b')]=function(_0x1da0d3,_0x3867a7){return db[_0xadc3('0x2c')][_0xadc3('0x4b')](_0x1da0d3[_0xadc3('0x4c')],{})[_0xadc3('0x25')](function(_0x4ab135){var _0x128f80=_0x1da0d3[_0xadc3('0x4d')][_0xadc3('0x4e')]({'plain':!![]});if(!_0x128f80)throw new Error(_0xadc3('0x4f'));if(_0x128f80[_0xadc3('0x50')]===_0xadc3('0x4d')){var _0x5570cc=_0x4ab135['get']({'plain':!![]});var _0x16fe28=_0xadc3('0x27');return db[_0xadc3('0x51')]['find']({'where':{'name':_0x16fe28,'userProfileId':_0x128f80['userProfileId']},'raw':!![]})[_0xadc3('0x25')](function(_0x558f67){if(_0x558f67&&_0x558f67['autoAssociation']===0x0){return db[_0xadc3('0x52')]['create']({'name':_0x5570cc['name'],'resourceId':_0x5570cc['id'],'type':_0x558f67[_0xadc3('0x29')],'sectionId':_0x558f67['id']},{})['then'](function(){return _0x4ab135;});}else{return _0x4ab135;}})[_0xadc3('0x46')](function(_0x31f3fa){logger[_0xadc3('0x53')](_0xadc3('0x54'),_0x31f3fa);throw _0x31f3fa;});}return _0x4ab135;})['then'](respondWithResult(_0x3867a7,0xc9))[_0xadc3('0x46')](handleError(_0x3867a7,null));};exports[_0xadc3('0x24')]=function(_0x5bee86,_0x5464d0){if(_0x5bee86['body']['id']){delete _0x5bee86['body']['id'];}return db[_0xadc3('0x2c')][_0xadc3('0x4a')]({'where':{'id':_0x5bee86[_0xadc3('0x48')]['id']}})[_0xadc3('0x25')](handleEntityNotFound(_0x5464d0,null))[_0xadc3('0x25')](saveUpdates(_0x5bee86['body'],null))[_0xadc3('0x25')](respondWithResult(_0x5464d0,null))['catch'](handleError(_0x5464d0,null));};exports['destroy']=function(_0x80d500,_0x8098dc){return db['Schedule'][_0xadc3('0x4a')]({'where':{'id':_0x80d500[_0xadc3('0x48')]['id']}})[_0xadc3('0x25')](handleEntityNotFound(_0x8098dc,null))[_0xadc3('0x25')](removeEntity(_0x8098dc,null))[_0xadc3('0x46')](handleError(_0x8098dc,null));};exports['run']=function(_0x402663,_0x183b5f,_0x3b24f7){var _0x5461ab=require(_0xadc3('0x55'));return db[_0xadc3('0x2c')][_0xadc3('0x4a')]({'where':{'id':_0x402663[_0xadc3('0x48')]['id']},'raw':!![]})[_0xadc3('0x25')](handleEntityNotFound(_0x183b5f,null))[_0xadc3('0x25')](function(){_0x5461ab[_0xadc3('0x56')](_0x402663['params']['id']);})[_0xadc3('0x25')](respondWithStatusCode(_0x183b5f,null))[_0xadc3('0x46')](handleError(_0x183b5f,null));}; \ No newline at end of file +var _0xf17e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','Scheduler','UserProfileResource','destroy','name','send','map','Schedule','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','run','html-pdf','eml-format'];(function(_0x305515,_0x52f6d7){var _0x1db3c4=function(_0x39dbd0){while(--_0x39dbd0){_0x305515['push'](_0x305515['shift']());}};_0x1db3c4(++_0x52f6d7);}(_0xf17e,0x1a2));var _0xef17=function(_0x50b311,_0x10733a){_0x50b311=_0x50b311-0x0;var _0x1054d8=_0xf17e[_0x50b311];return _0x1054d8;};'use strict';var pdf=require(_0xef17('0x0'));var emlformat=require(_0xef17('0x1'));var rimraf=require(_0xef17('0x2'));var zipdir=require(_0xef17('0x3'));var jsonpatch=require(_0xef17('0x4'));var rp=require(_0xef17('0x5'));var moment=require(_0xef17('0x6'));var BPromise=require(_0xef17('0x7'));var Mustache=require(_0xef17('0x8'));var util=require(_0xef17('0x9'));var path=require(_0xef17('0xa'));var sox=require(_0xef17('0xb'));var csv=require(_0xef17('0xc'));var ejs=require(_0xef17('0xd'));var fs=require('fs');var _=require(_0xef17('0xe'));var squel=require(_0xef17('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xef17('0x10'));var toCsv=require(_0xef17('0xc'));var querystring=require('querystring');var Papa=require(_0xef17('0x11'));var Redis=require(_0xef17('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef17('0x13'));var hardwareService=require(_0xef17('0x14'));var logger=require(_0xef17('0x15'))('api');var utils=require(_0xef17('0x16'));var config=require(_0xef17('0x17'));var db=require(_0xef17('0x18'))['db'];function respondWithStatusCode(_0x24eb0e,_0x1c932e){_0x1c932e=_0x1c932e||0xcc;return function(_0x26ecea){if(_0x26ecea){return _0x24eb0e['sendStatus'](_0x1c932e);}return _0x24eb0e['status'](_0x1c932e)[_0xef17('0x19')]();};}function respondWithResult(_0x34f99f,_0x3e6d21){_0x3e6d21=_0x3e6d21||0xc8;return function(_0x155fb2){if(_0x155fb2){return _0x34f99f['status'](_0x3e6d21)[_0xef17('0x1a')](_0x155fb2);}};}function respondWithFilteredResult(_0x34ec4b,_0x5b28b5){return function(_0x368eeb){if(_0x368eeb){var _0x192d75=_0x368eeb[_0xef17('0x1b')],_0xbab3a2=_0x5b28b5[_0xef17('0x1c')],_0x54e4ed=_0x5b28b5[_0xef17('0x1c')]+_0x5b28b5[_0xef17('0x1d')],_0x523709;if(_0x54e4ed>=_0x192d75){_0x54e4ed=_0x192d75;_0x523709=0xc8;}else{_0x523709=0xce;}_0x34ec4b[_0xef17('0x1e')](_0x523709);return _0x34ec4b[_0xef17('0x1f')](_0xef17('0x20'),_0xbab3a2+'-'+_0x54e4ed+'/'+_0x192d75)[_0xef17('0x1a')](_0x368eeb);}return null;};}function patchUpdates(_0x22fd7e){return function(_0x3d53b6){try{jsonpatch[_0xef17('0x21')](_0x3d53b6,_0x22fd7e,!![]);}catch(_0x5a8f11){return BPromise[_0xef17('0x22')](_0x5a8f11);}return _0x3d53b6[_0xef17('0x23')]();};}function saveUpdates(_0x3aeaa7,_0x48ecec){return function(_0x58f169){if(_0x58f169){return _0x58f169['update'](_0x3aeaa7)[_0xef17('0x24')](function(_0x573797){return _0x573797;});}return null;};}function removeEntity(_0x25f787,_0x21750f){return function(_0x416bbf){if(_0x416bbf){return _0x416bbf['destroy']()[_0xef17('0x24')](function(){var _0x256470=_0x416bbf['get']({'plain':!![]});var _0x516ad1=_0xef17('0x25');return db[_0xef17('0x26')][_0xef17('0x27')]({'where':{'type':_0x516ad1,'resourceId':_0x256470['id']}})[_0xef17('0x24')](function(){return _0x416bbf;});})[_0xef17('0x24')](function(){_0x25f787['status'](0xcc)[_0xef17('0x19')]();});}};}function handleEntityNotFound(_0xe50fb4,_0x3820e7){return function(_0x1cac6d){if(!_0x1cac6d){_0xe50fb4['sendStatus'](0x194);}return _0x1cac6d;};}function handleError(_0x1a17fe,_0x41818d){_0x41818d=_0x41818d||0x1f4;return function(_0x48d0ec){logger['error'](_0x48d0ec['stack']);if(_0x48d0ec[_0xef17('0x28')]){delete _0x48d0ec[_0xef17('0x28')];}_0x1a17fe[_0xef17('0x1e')](_0x41818d)[_0xef17('0x29')](_0x48d0ec);};}exports['index']=function(_0x3b2a72,_0x3a79c2){var _0x57d884={},_0x577c65={},_0x236645={'count':0x0,'rows':[]};var _0x347bdc=_[_0xef17('0x2a')](db[_0xef17('0x2b')][_0xef17('0x2c')],function(_0x28fe81){return{'name':_0x28fe81['fieldName'],'type':_0x28fe81[_0xef17('0x2d')][_0xef17('0x2e')]};});_0x577c65[_0xef17('0x2f')]=_[_0xef17('0x2a')](_0x347bdc,_0xef17('0x28'));_0x577c65[_0xef17('0x30')]=_[_0xef17('0x31')](_0x3b2a72[_0xef17('0x30')]);_0x577c65[_0xef17('0x32')]=_['intersection'](_0x577c65[_0xef17('0x2f')],_0x577c65[_0xef17('0x30')]);_0x57d884[_0xef17('0x33')]=_[_0xef17('0x34')](_0x577c65[_0xef17('0x2f')],qs[_0xef17('0x35')](_0x3b2a72[_0xef17('0x30')]['fields']));_0x57d884[_0xef17('0x33')]=_0x57d884[_0xef17('0x33')]['length']?_0x57d884[_0xef17('0x33')]:_0x577c65[_0xef17('0x2f')];if(!_0x3b2a72[_0xef17('0x30')]['hasOwnProperty'](_0xef17('0x36'))){_0x57d884[_0xef17('0x1d')]=qs[_0xef17('0x1d')](_0x3b2a72[_0xef17('0x30')][_0xef17('0x1d')]);_0x57d884[_0xef17('0x1c')]=qs['offset'](_0x3b2a72[_0xef17('0x30')][_0xef17('0x1c')]);}_0x57d884[_0xef17('0x37')]=qs[_0xef17('0x38')](_0x3b2a72[_0xef17('0x30')][_0xef17('0x38')]);_0x57d884['where']=qs[_0xef17('0x32')](_[_0xef17('0x39')](_0x3b2a72[_0xef17('0x30')],_0x577c65['filters']),_0x347bdc);if(_0x3b2a72['query']['filter']){_0x57d884[_0xef17('0x3a')]=_['merge'](_0x57d884[_0xef17('0x3a')],{'$or':_[_0xef17('0x2a')](_0x347bdc,function(_0x1558a4){if(_0x1558a4[_0xef17('0x2d')]!==_0xef17('0x3b')){var _0x4b265d={};_0x4b265d[_0x1558a4[_0xef17('0x28')]]={'$like':'%'+_0x3b2a72[_0xef17('0x30')][_0xef17('0x3c')]+'%'};return _0x4b265d;}})});}_0x57d884=_['merge']({},_0x57d884,_0x3b2a72[_0xef17('0x3d')]);var _0x257c87={'where':_0x57d884['where']};return db[_0xef17('0x2b')][_0xef17('0x1b')](_0x257c87)[_0xef17('0x24')](function(_0x184cff){_0x236645[_0xef17('0x1b')]=_0x184cff;if(_0x3b2a72[_0xef17('0x30')][_0xef17('0x3e')]){_0x57d884[_0xef17('0x3f')]=[{'all':!![]}];}return db['Schedule'][_0xef17('0x40')](_0x57d884);})['then'](function(_0x51844a){_0x236645[_0xef17('0x41')]=_0x51844a;return _0x236645;})[_0xef17('0x24')](respondWithFilteredResult(_0x3a79c2,_0x57d884))[_0xef17('0x42')](handleError(_0x3a79c2,null));};exports[_0xef17('0x43')]=function(_0x104a0f,_0x5decbc){var _0x4128ae={'raw':![],'where':{'id':_0x104a0f[_0xef17('0x44')]['id']}},_0x2e2e5c={};_0x2e2e5c['model']=_['keys'](db['Schedule'][_0xef17('0x2c')]);_0x2e2e5c['query']=_[_0xef17('0x31')](_0x104a0f['query']);_0x2e2e5c[_0xef17('0x32')]=_[_0xef17('0x34')](_0x2e2e5c[_0xef17('0x2f')],_0x2e2e5c['query']);_0x4128ae[_0xef17('0x33')]=_[_0xef17('0x34')](_0x2e2e5c[_0xef17('0x2f')],qs[_0xef17('0x35')](_0x104a0f[_0xef17('0x30')][_0xef17('0x35')]));_0x4128ae[_0xef17('0x33')]=_0x4128ae['attributes'][_0xef17('0x45')]?_0x4128ae[_0xef17('0x33')]:_0x2e2e5c['model'];if(_0x104a0f[_0xef17('0x30')][_0xef17('0x3e')]){_0x4128ae[_0xef17('0x3f')]=[{'all':!![]}];}_0x4128ae=_['merge']({},_0x4128ae,_0x104a0f['options']);return db[_0xef17('0x2b')][_0xef17('0x46')](_0x4128ae)[_0xef17('0x24')](handleEntityNotFound(_0x5decbc,null))[_0xef17('0x24')](respondWithResult(_0x5decbc,null))['catch'](handleError(_0x5decbc,null));};exports['create']=function(_0x3623ab,_0x450eb5){return db[_0xef17('0x2b')]['create'](_0x3623ab[_0xef17('0x47')],{})[_0xef17('0x24')](function(_0x10ea09){var _0x23d7c3=_0x3623ab[_0xef17('0x48')][_0xef17('0x49')]({'plain':!![]});if(!_0x23d7c3)throw new Error(_0xef17('0x4a'));if(_0x23d7c3[_0xef17('0x4b')]===_0xef17('0x48')){var _0x3c44e6=_0x10ea09[_0xef17('0x49')]({'plain':!![]});var _0x496039=_0xef17('0x25');return db[_0xef17('0x4c')][_0xef17('0x46')]({'where':{'name':_0x496039,'userProfileId':_0x23d7c3[_0xef17('0x4d')]},'raw':!![]})[_0xef17('0x24')](function(_0x3ba324){if(_0x3ba324&&_0x3ba324[_0xef17('0x4e')]===0x0){return db[_0xef17('0x26')]['create']({'name':_0x3c44e6['name'],'resourceId':_0x3c44e6['id'],'type':_0x3ba324[_0xef17('0x28')],'sectionId':_0x3ba324['id']},{})['then'](function(){return _0x10ea09;});}else{return _0x10ea09;}})[_0xef17('0x42')](function(_0x256fe1){logger[_0xef17('0x4f')](_0xef17('0x50'),_0x256fe1);throw _0x256fe1;});}return _0x10ea09;})[_0xef17('0x24')](respondWithResult(_0x450eb5,0xc9))[_0xef17('0x42')](handleError(_0x450eb5,null));};exports[_0xef17('0x51')]=function(_0x3d4bd6,_0x5421f5){if(_0x3d4bd6['body']['id']){delete _0x3d4bd6[_0xef17('0x47')]['id'];}return db['Schedule'][_0xef17('0x46')]({'where':{'id':_0x3d4bd6[_0xef17('0x44')]['id']}})['then'](handleEntityNotFound(_0x5421f5,null))[_0xef17('0x24')](saveUpdates(_0x3d4bd6[_0xef17('0x47')],null))[_0xef17('0x24')](respondWithResult(_0x5421f5,null))[_0xef17('0x42')](handleError(_0x5421f5,null));};exports['destroy']=function(_0x50602f,_0x7ff2ce){return db['Schedule'][_0xef17('0x46')]({'where':{'id':_0x50602f[_0xef17('0x44')]['id']}})[_0xef17('0x24')](handleEntityNotFound(_0x7ff2ce,null))[_0xef17('0x24')](removeEntity(_0x7ff2ce,null))[_0xef17('0x42')](handleError(_0x7ff2ce,null));};exports['run']=function(_0x10dddc,_0x39d24b,_0x1819db){var _0x1b9869=require(_0xef17('0x52'));return db['Schedule'][_0xef17('0x46')]({'where':{'id':_0x10dddc[_0xef17('0x44')]['id']},'raw':!![]})[_0xef17('0x24')](handleEntityNotFound(_0x39d24b,null))['then'](function(){_0x1b9869[_0xef17('0x53')](_0x10dddc['params']['id']);})['then'](respondWithStatusCode(_0x39d24b,null))[_0xef17('0x42')](handleError(_0x39d24b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3ffeae6..66da752 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 _0xa222=['./schedule.attributes','define','Schedule','tools_schedules','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16716e,_0x3b8362){var _0x4d5a77=function(_0x18d99e){while(--_0x18d99e){_0x16716e['push'](_0x16716e['shift']());}};_0x4d5a77(++_0x3b8362);}(_0xa222,0x17a));var _0x2a22=function(_0x44606e,_0x2bf244){_0x44606e=_0x44606e-0x0;var _0xe68388=_0xa222[_0x44606e];return _0xe68388;};'use strict';var _=require('lodash');var util=require(_0x2a22('0x0'));var logger=require(_0x2a22('0x1'))('api');var moment=require(_0x2a22('0x2'));var BPromise=require('bluebird');var rp=require(_0x2a22('0x3'));var fs=require('fs');var path=require(_0x2a22('0x4'));var rimraf=require(_0x2a22('0x5'));var config=require(_0x2a22('0x6'));var attributes=require(_0x2a22('0x7'));module['exports']=function(_0x25429a,_0x4a8001){return _0x25429a[_0x2a22('0x8')](_0x2a22('0x9'),attributes,{'tableName':_0x2a22('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60b5=['moment','bluebird','request-promise','path','../../config/environment','exports','define','lodash','../../config/logger'];(function(_0xedde59,_0x50d9b1){var _0x4db279=function(_0xa24719){while(--_0xa24719){_0xedde59['push'](_0xedde59['shift']());}};_0x4db279(++_0x50d9b1);}(_0x60b5,0x142));var _0x560b=function(_0x102c0a,_0x4602e6){_0x102c0a=_0x102c0a-0x0;var _0x1814cc=_0x60b5[_0x102c0a];return _0x1814cc;};'use strict';var _=require(_0x560b('0x0'));var util=require('util');var logger=require(_0x560b('0x1'))('api');var moment=require(_0x560b('0x2'));var BPromise=require(_0x560b('0x3'));var rp=require(_0x560b('0x4'));var fs=require('fs');var path=require(_0x560b('0x5'));var rimraf=require('rimraf');var config=require(_0x560b('0x6'));var attributes=require('./schedule.attributes');module[_0x560b('0x7')]=function(_0x323a61,_0x430b47){return _0x323a61[_0x560b('0x8')]('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 f83d6b6..ca7b470 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 _0x0589=['request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x0589,0x11d));var _0x9058=function(_0x34136e,_0x1d2fdb){_0x34136e=_0x34136e-0x0;var _0x597419=_0x0589[_0x34136e];return _0x597419;};'use strict';var _=require('lodash');var util=require(_0x9058('0x0'));var moment=require(_0x9058('0x1'));var BPromise=require('bluebird');var rs=require(_0x9058('0x2'));var fs=require('fs');var Redis=require(_0x9058('0x3'));var db=require(_0x9058('0x4'))['db'];var utils=require(_0x9058('0x5'));var logger=require(_0x9058('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9058('0x7'));var client=jayson['client'][_0x9058('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e4c24,_0x52ee53,_0x31f34e){return new BPromise(function(_0x3d133b,_0x45d907){return client[_0x9058('0x9')](_0x1e4c24,_0x31f34e)[_0x9058('0xa')](function(_0x155a66){logger['info'](_0x9058('0xb'),_0x52ee53,_0x9058('0xc'));logger[_0x9058('0xd')](_0x9058('0xe'),_0x52ee53,_0x9058('0xc'),JSON['stringify'](_0x155a66));if(_0x155a66[_0x9058('0xf')]){if(_0x155a66[_0x9058('0xf')][_0x9058('0x10')]===0x1f4){logger[_0x9058('0xf')](_0x9058('0xb'),_0x52ee53,_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);return _0x45d907(_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);}logger[_0x9058('0xf')]('Schedule,\x20%s,\x20%s',_0x52ee53,_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);return _0x3d133b(_0x155a66[_0x9058('0xf')][_0x9058('0x11')]);}else{logger[_0x9058('0x12')](_0x9058('0xb'),_0x52ee53,_0x9058('0xc'));_0x3d133b(_0x155a66[_0x9058('0x13')]['message']);}})[_0x9058('0x14')](function(_0x1b3dd3){logger['error'](_0x9058('0xb'),_0x52ee53,_0x1b3dd3);_0x45d907(_0x1b3dd3);});});} \ No newline at end of file +var _0xe72c=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a18f0,_0x137aea){var _0x3698a1=function(_0x5d3b01){while(--_0x5d3b01){_0x4a18f0['push'](_0x4a18f0['shift']());}};_0x3698a1(++_0x137aea);}(_0xe72c,0xd6));var _0xce72=function(_0x13a860,_0x3a7505){_0x13a860=_0x13a860-0x0;var _0x4eee00=_0xe72c[_0x13a860];return _0x4eee00;};'use strict';var _=require(_0xce72('0x0'));var util=require(_0xce72('0x1'));var moment=require(_0xce72('0x2'));var BPromise=require('bluebird');var rs=require(_0xce72('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce72('0x4'))['db'];var utils=require(_0xce72('0x5'));var logger=require(_0xce72('0x6'))('rpc');var config=require(_0xce72('0x7'));var jayson=require(_0xce72('0x8'));var client=jayson[_0xce72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ce4cf,_0x4594b9,_0x2b1835){return new BPromise(function(_0x2653f7,_0x31e54e){return client[_0xce72('0xa')](_0x5ce4cf,_0x2b1835)[_0xce72('0xb')](function(_0x1770f3){logger[_0xce72('0xc')](_0xce72('0xd'),_0x4594b9,_0xce72('0xe'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x4594b9,_0xce72('0xe'),JSON['stringify'](_0x1770f3));if(_0x1770f3['error']){if(_0x1770f3[_0xce72('0xf')][_0xce72('0x10')]===0x1f4){logger['error'](_0xce72('0xd'),_0x4594b9,_0x1770f3[_0xce72('0xf')][_0xce72('0x11')]);return _0x31e54e(_0x1770f3[_0xce72('0xf')]['message']);}logger[_0xce72('0xf')]('Schedule,\x20%s,\x20%s',_0x4594b9,_0x1770f3[_0xce72('0xf')]['message']);return _0x2653f7(_0x1770f3[_0xce72('0xf')][_0xce72('0x11')]);}else{logger[_0xce72('0xc')]('Schedule,\x20%s,\x20%s',_0x4594b9,_0xce72('0xe'));_0x2653f7(_0x1770f3[_0xce72('0x12')][_0xce72('0x11')]);}})[_0xce72('0x13')](function(_0x15afd5){logger['error'](_0xce72('0xd'),_0x4594b9,_0x15afd5);_0x31e54e(_0x15afd5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index af9d075..9dfd25c 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 _0x9f69=['./screenRecording.controller','isAuthenticated','index','get','describe','/:id','/:id/download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x9f69,0x1d9));var _0x99f6=function(_0x36a236,_0x3cc5fc){_0x36a236=_0x36a236-0x0;var _0xa4ab27=_0x9f69[_0x36a236];return _0xa4ab27;};'use strict';var multer=require('multer');var util=require(_0x99f6('0x0'));var path=require(_0x99f6('0x1'));var timeout=require(_0x99f6('0x2'));var express=require(_0x99f6('0x3'));var router=express[_0x99f6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x99f6('0x5'));var config=require(_0x99f6('0x6'));var controller=require(_0x99f6('0x7'));router['get']('/',auth[_0x99f6('0x8')](),controller[_0x99f6('0x9')]);router[_0x99f6('0xa')]('/describe',auth[_0x99f6('0x8')](),controller[_0x99f6('0xb')]);router[_0x99f6('0xa')](_0x99f6('0xc'),auth[_0x99f6('0x8')](),controller['show']);router[_0x99f6('0xa')](_0x99f6('0xd'),auth[_0x99f6('0x8')](),controller['download']);router[_0x99f6('0xe')]('/',auth[_0x99f6('0x8')](),controller['create']);router[_0x99f6('0xf')](_0x99f6('0xc'),auth['isAuthenticated'](),controller[_0x99f6('0x10')]);router[_0x99f6('0x11')](_0x99f6('0xc'),auth[_0x99f6('0x8')](),controller[_0x99f6('0x12')]);module[_0x99f6('0x13')]=router; \ No newline at end of file +var _0xc19a=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','download','post','create'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xc19a,0x10e));var _0xac19=function(_0x4cf836,_0x29a025){_0x4cf836=_0x4cf836-0x0;var _0x1d8461=_0xc19a[_0x4cf836];return _0x1d8461;};'use strict';var multer=require(_0xac19('0x0'));var util=require('util');var path=require(_0xac19('0x1'));var timeout=require(_0xac19('0x2'));var express=require(_0xac19('0x3'));var router=express[_0xac19('0x4')]();var auth=require(_0xac19('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac19('0x6'));router[_0xac19('0x7')]('/',auth[_0xac19('0x8')](),controller[_0xac19('0x9')]);router[_0xac19('0x7')](_0xac19('0xa'),auth['isAuthenticated'](),controller[_0xac19('0xb')]);router['get']('/:id',auth[_0xac19('0x8')](),controller[_0xac19('0xc')]);router[_0xac19('0x7')]('/:id/download',auth[_0xac19('0x8')](),controller[_0xac19('0xd')]);router[_0xac19('0xe')]('/',auth[_0xac19('0x8')](),controller[_0xac19('0xf')]);router[_0xac19('0x10')](_0xac19('0x11'),auth[_0xac19('0x8')](),controller[_0xac19('0x12')]);router[_0xac19('0x13')](_0xac19('0x11'),auth[_0xac19('0x8')](),controller[_0xac19('0x14')]);module[_0xac19('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0d4c2f4..b5dbba4 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 _0x33c5=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x33c5,0xe6));var _0x533c=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x33c5[_0x5c1345];return _0x1c070d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var config=require('../../config/environment');module[_0x533c('0x2')]={'format':{'type':Sequelize[_0x533c('0x3')],'get':function(){return this[_0x533c('0x4')](_0x533c('0x5'))?path[_0x533c('0x6')](this['getDataValue'](_0x533c('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x533c('0x7')]},'channel':{'type':Sequelize[_0x533c('0x7')]},'value':{'type':Sequelize[_0x533c('0x7')],'set':function(_0x34ca89){var _0x1699d5=_0x34ca89[_0x533c('0x8')](/\\/g,'/');this[_0x533c('0x9')](_0x533c('0x5'),_0x1699d5);}},'rating':{'type':Sequelize[_0x533c('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x533c('0xa')],'set':function(_0x46536d){this[_0x533c('0x9')](_0x533c('0xb'),moment()[_0x533c('0xc')](_0x46536d,'ms'));this[_0x533c('0x9')]('closedAt',moment());this[_0x533c('0x9')](_0x533c('0xd'),_0x46536d);}},'startedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0xb')))[_0x533c('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x533c('0x10')]();}},'closedAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x11')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'createdAt':{'type':Sequelize[_0x533c('0xe')],'get':function(){return moment(this['getDataValue'](_0x533c('0x13')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x533c('0x4')](_0x533c('0x14')))[_0x533c('0xf')](_0x533c('0x12'))[_0x533c('0x10')]();}}}; \ No newline at end of file +var _0x207c=['createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE'];(function(_0x85246a,_0x3407f1){var _0x337a3d=function(_0x4a80d3){while(--_0x4a80d3){_0x85246a['push'](_0x85246a['shift']());}};_0x337a3d(++_0x3407f1);}(_0x207c,0x1e8));var _0xc207=function(_0xdbfe11,_0x5cfa1e){_0xdbfe11=_0xdbfe11-0x0;var _0x28438d=_0x207c[_0xdbfe11];return _0x28438d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var config=require(_0xc207('0x2'));module[_0xc207('0x3')]={'format':{'type':Sequelize[_0xc207('0x4')],'get':function(){return this[_0xc207('0x5')](_0xc207('0x6'))?path['extname'](this[_0xc207('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc207('0x7')],'set':function(_0x314561){var _0x3395e4=_0x314561['replace'](/\\/g,'/');this[_0xc207('0x8')](_0xc207('0x6'),_0x3395e4);}},'rating':{'type':Sequelize[_0xc207('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xffae6c){this[_0xc207('0x8')](_0xc207('0xa'),moment()[_0xc207('0xb')](_0xffae6c,'ms'));this[_0xc207('0x8')](_0xc207('0xc'),moment());this['setDataValue']('duration',_0xffae6c);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc207('0x5')]('startedAt'))[_0xc207('0xd')](_0xc207('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0xc207('0xf')],'get':function(){return moment(this[_0xc207('0x5')](_0xc207('0xc')))[_0xc207('0xd')](_0xc207('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xc207('0xf')],'get':function(){return moment(this[_0xc207('0x5')](_0xc207('0x10')))[_0xc207('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc207('0x5')](_0xc207('0x11')))[_0xc207('0xd')](_0xc207('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 c6b6e4e..f0fca46 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 _0xabf1=['type','key','model','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','createdAt','closedAt','params','describe','download','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','then','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName'];(function(_0x52e18f,_0x294cc9){var _0x1c381b=function(_0x4bc1ef){while(--_0x4bc1ef){_0x52e18f['push'](_0x52e18f['shift']());}};_0x1c381b(++_0x294cc9);}(_0xabf1,0xa0));var _0x1abf=function(_0x58f992,_0x142571){_0x58f992=_0x58f992-0x0;var _0x17518b=_0xabf1[_0x58f992];return _0x17518b;};'use strict';var pdf=require(_0x1abf('0x0'));var emlformat=require(_0x1abf('0x1'));var rimraf=require(_0x1abf('0x2'));var zipdir=require(_0x1abf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1abf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1abf('0x5'));var util=require(_0x1abf('0x6'));var path=require(_0x1abf('0x7'));var sox=require(_0x1abf('0x8'));var csv=require('to-csv');var ejs=require(_0x1abf('0x9'));var fs=require('fs');var _=require(_0x1abf('0xa'));var squel=require(_0x1abf('0xb'));var crypto=require('crypto');var jsforce=require(_0x1abf('0xc'));var deskjs=require(_0x1abf('0xd'));var toCsv=require(_0x1abf('0xe'));var querystring=require(_0x1abf('0xf'));var Papa=require(_0x1abf('0x10'));var Redis=require('ioredis');var authService=require(_0x1abf('0x11'));var qs=require(_0x1abf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1abf('0x13'));var logger=require(_0x1abf('0x14'))(_0x1abf('0x15'));var utils=require(_0x1abf('0x16'));var config=require(_0x1abf('0x17'));var db=require(_0x1abf('0x18'))['db'];function respondWithStatusCode(_0x393f05,_0xbe7492){_0xbe7492=_0xbe7492||0xcc;return function(_0x10392f){if(_0x10392f){return _0x393f05[_0x1abf('0x19')](_0xbe7492);}return _0x393f05[_0x1abf('0x1a')](_0xbe7492)[_0x1abf('0x1b')]();};}function respondWithResult(_0x7978a9,_0x153938){_0x153938=_0x153938||0xc8;return function(_0x526e2e){if(_0x526e2e){return _0x7978a9[_0x1abf('0x1a')](_0x153938)['json'](_0x526e2e);}};}function respondWithFilteredResult(_0x1efef5,_0x24ceb5){return function(_0x11fb2d){if(_0x11fb2d){var _0x401eb7=_0x11fb2d[_0x1abf('0x1c')],_0xb1c766=_0x24ceb5[_0x1abf('0x1d')],_0x3b09b4=_0x24ceb5[_0x1abf('0x1d')]+_0x24ceb5[_0x1abf('0x1e')],_0x13ed29;if(_0x3b09b4>=_0x401eb7){_0x3b09b4=_0x401eb7;_0x13ed29=0xc8;}else{_0x13ed29=0xce;}_0x1efef5[_0x1abf('0x1a')](_0x13ed29);return _0x1efef5[_0x1abf('0x1f')](_0x1abf('0x20'),_0xb1c766+'-'+_0x3b09b4+'/'+_0x401eb7)['json'](_0x11fb2d);}return null;};}function patchUpdates(_0x2dc048){return function(_0x1eba68){try{jsonpatch[_0x1abf('0x21')](_0x1eba68,_0x2dc048,!![]);}catch(_0x4b1eb1){return BPromise['reject'](_0x4b1eb1);}return _0x1eba68['save']();};}function saveUpdates(_0x125509,_0x65a719){return function(_0x16a677){if(_0x16a677){return _0x16a677['update'](_0x125509)['then'](function(_0x2bb995){return _0x2bb995;});}return null;};}function removeEntity(_0x3dc17a,_0x8b621f){return function(_0x3344c9){if(_0x3344c9){return _0x3344c9['destroy']()[_0x1abf('0x22')](function(){_0x3dc17a[_0x1abf('0x1a')](0xcc)[_0x1abf('0x1b')]();});}};}function handleEntityNotFound(_0x15e43b,_0x529083){return function(_0x397346){if(!_0x397346){_0x15e43b[_0x1abf('0x19')](0x194);}return _0x397346;};}function handleError(_0x31a752,_0x1cacc6){_0x1cacc6=_0x1cacc6||0x1f4;return function(_0x15202a){logger[_0x1abf('0x23')](_0x15202a[_0x1abf('0x24')]);if(_0x15202a[_0x1abf('0x25')]){delete _0x15202a[_0x1abf('0x25')];}_0x31a752[_0x1abf('0x1a')](_0x1cacc6)[_0x1abf('0x26')](_0x15202a);};}exports[_0x1abf('0x27')]=function(_0x2db535,_0xfa91c8){var _0x25a19e={},_0x265ba5={},_0x4d2a6f={'count':0x0,'rows':[]};var _0x3aa7af=_[_0x1abf('0x28')](db[_0x1abf('0x29')][_0x1abf('0x2a')],function(_0x26f7b3){return{'name':_0x26f7b3[_0x1abf('0x2b')],'type':_0x26f7b3[_0x1abf('0x2c')][_0x1abf('0x2d')]};});_0x265ba5[_0x1abf('0x2e')]=_['differenceBy'](_[_0x1abf('0x28')](_0x3aa7af,_0x1abf('0x25')),[_0x1abf('0x2f')]);_0x265ba5[_0x1abf('0x30')]=_[_0x1abf('0x31')](_0x2db535[_0x1abf('0x30')]);_0x265ba5[_0x1abf('0x32')]=_[_0x1abf('0x33')](_0x265ba5[_0x1abf('0x2e')],_0x265ba5[_0x1abf('0x30')]);_0x25a19e[_0x1abf('0x34')]=_[_0x1abf('0x33')](_0x265ba5[_0x1abf('0x2e')],qs[_0x1abf('0x35')](_0x2db535[_0x1abf('0x30')]['fields']));_0x25a19e[_0x1abf('0x34')]=_0x25a19e[_0x1abf('0x34')][_0x1abf('0x36')]?_0x25a19e[_0x1abf('0x34')]:_0x265ba5[_0x1abf('0x2e')];if(!_0x2db535[_0x1abf('0x30')]['hasOwnProperty'](_0x1abf('0x37'))){_0x25a19e[_0x1abf('0x1e')]=qs[_0x1abf('0x1e')](_0x2db535['query'][_0x1abf('0x1e')]);_0x25a19e[_0x1abf('0x1d')]=qs['offset'](_0x2db535['query'][_0x1abf('0x1d')]);}_0x25a19e[_0x1abf('0x38')]=qs[_0x1abf('0x39')](_0x2db535[_0x1abf('0x30')][_0x1abf('0x39')]);_0x25a19e['where']=qs[_0x1abf('0x32')](_[_0x1abf('0x3a')](_0x2db535[_0x1abf('0x30')],_0x265ba5['filters']),_0x3aa7af);if(_0x2db535[_0x1abf('0x30')][_0x1abf('0x3b')]){_0x25a19e[_0x1abf('0x3c')]=_[_0x1abf('0x3d')](_0x25a19e[_0x1abf('0x3c')],{'$or':_[_0x1abf('0x28')](_0x3aa7af,function(_0x4a8626){if(_0x4a8626[_0x1abf('0x2c')]!=='VIRTUAL'){var _0x57a66b={};_0x57a66b[_0x4a8626[_0x1abf('0x25')]]={'$like':'%'+_0x2db535[_0x1abf('0x30')]['filter']+'%'};return _0x57a66b;}})});}_0x25a19e=_[_0x1abf('0x3d')]({},_0x25a19e,_0x2db535[_0x1abf('0x3e')]);var _0x20f41f={'where':_0x25a19e['where']};return db['ScreenRecording'][_0x1abf('0x1c')](_0x20f41f)[_0x1abf('0x22')](function(_0x119955){_0x4d2a6f[_0x1abf('0x1c')]=_0x119955;if(_0x2db535['query'][_0x1abf('0x3f')]){_0x25a19e[_0x1abf('0x40')]=[{'all':!![]}];}return db[_0x1abf('0x29')][_0x1abf('0x41')](_0x25a19e);})[_0x1abf('0x22')](function(_0x3d4e89){_0x4d2a6f[_0x1abf('0x42')]=_0x3d4e89;return _0x4d2a6f;})[_0x1abf('0x22')](respondWithFilteredResult(_0xfa91c8,_0x25a19e))[_0x1abf('0x43')](handleError(_0xfa91c8,null));};exports[_0x1abf('0x44')]=function(_0xaaae1e,_0x35d86f){var _0x4f623b={'raw':![],'where':{'id':_0xaaae1e['params']['id']}},_0x28d7d6={};_0x28d7d6[_0x1abf('0x2e')]=_[_0x1abf('0x31')](db[_0x1abf('0x29')][_0x1abf('0x2a')]);_0x28d7d6['query']=_[_0x1abf('0x31')](_0xaaae1e[_0x1abf('0x30')]);_0x28d7d6[_0x1abf('0x32')]=_[_0x1abf('0x33')](_0x28d7d6[_0x1abf('0x2e')],_0x28d7d6[_0x1abf('0x30')]);_0x4f623b[_0x1abf('0x34')]=_[_0x1abf('0x33')](_0x28d7d6['model'],qs[_0x1abf('0x35')](_0xaaae1e[_0x1abf('0x30')][_0x1abf('0x35')]));_0x4f623b[_0x1abf('0x34')]=_0x4f623b[_0x1abf('0x34')]['length']?_0x4f623b[_0x1abf('0x34')]:_0x28d7d6[_0x1abf('0x2e')];if(_0xaaae1e[_0x1abf('0x30')][_0x1abf('0x3f')]){_0x4f623b[_0x1abf('0x40')]=[{'all':!![]}];}_0x4f623b=_[_0x1abf('0x3d')]({},_0x4f623b,_0xaaae1e[_0x1abf('0x3e')]);return db[_0x1abf('0x29')][_0x1abf('0x45')](_0x4f623b)[_0x1abf('0x22')](handleEntityNotFound(_0x35d86f,null))[_0x1abf('0x22')](respondWithResult(_0x35d86f,null))[_0x1abf('0x43')](handleError(_0x35d86f,null));};exports[_0x1abf('0x46')]=function(_0xed6821,_0x14856a){return db['ScreenRecording']['create'](_0xed6821[_0x1abf('0x47')],{})[_0x1abf('0x22')](respondWithResult(_0x14856a,0xc9))[_0x1abf('0x43')](handleError(_0x14856a,null));};exports[_0x1abf('0x48')]=function(_0x1f4646,_0x539f9b){if(_0x1f4646[_0x1abf('0x47')]['id']){delete _0x1f4646[_0x1abf('0x47')]['id'];}delete _0x1f4646[_0x1abf('0x47')]['duration'];delete _0x1f4646['body'][_0x1abf('0x49')];delete _0x1f4646['body'][_0x1abf('0x4a')];delete _0x1f4646[_0x1abf('0x47')]['value'];return db['ScreenRecording'][_0x1abf('0x45')]({'where':{'id':_0x1f4646[_0x1abf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x539f9b,null))[_0x1abf('0x22')](saveUpdates(_0x1f4646[_0x1abf('0x47')],null))['then'](respondWithResult(_0x539f9b,null))[_0x1abf('0x43')](handleError(_0x539f9b,null));};exports[_0x1abf('0x4c')]=function(_0x3e3523,_0x4c76fe){return db[_0x1abf('0x29')]['describe']()['then'](respondWithResult(_0x4c76fe,null))['catch'](handleError(_0x4c76fe,null));};exports[_0x1abf('0x4d')]=function(_0x353733,_0x5730e5,_0x453182){var _0x5b66e5=require('../../components/encryptor');var _0x554e19=![];var _0x2a258c={};if(_0x353733[_0x1abf('0x30')]['type']&&_0x353733[_0x1abf('0x30')]['type']===_0x1abf('0x4e')){_0x2a258c[_0x1abf('0x4e')]=_0x353733[_0x1abf('0x4b')]['id'];}else{_0x2a258c['id']=_0x353733[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x29')][_0x1abf('0x45')]({'where':_0x2a258c,'attributes':['id',_0x1abf('0x4f')],'raw':!![]})[_0x1abf('0x22')](handleEntityNotFound(_0x5730e5,null))[_0x1abf('0x22')](function(_0xd8f826){if(_0xd8f826){var _0x309aa9=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0xd8f826[_0x1abf('0x4f')]);var _0x3ffd6d=util[_0x1abf('0x2f')]('%s.cypher',_0x309aa9);if(fs['existsSync'](_0x3ffd6d)){_0x554e19=!![];return _0x5b66e5[_0x1abf('0x53')](_0x3ffd6d,_0x309aa9,config[_0x1abf('0x54')][_0x1abf('0x55')])[_0x1abf('0x22')](function(){return _0xd8f826;});}return _0xd8f826;}})[_0x1abf('0x22')](function(_0x2eea51){if(_0x2eea51){var _0x523966=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0x2eea51[_0x1abf('0x4f')]);if(!fs[_0x1abf('0x56')](_0x523966)){throw new db[(_0x1abf('0x57'))][(_0x1abf('0x58'))](_0x1abf('0x59'));}if(_0x2eea51[_0x1abf('0x5a')]){return _0x5730e5[_0x1abf('0x4d')](_0x523966,_0x2eea51['filename']+path[_0x1abf('0x5b')](_0x523966),function(){if(_0x554e19){fs[_0x1abf('0x5c')](_0x523966);}});}else{return _0x5730e5[_0x1abf('0x4d')](_0x523966,function(_0x273aca){if(_0x554e19){fs[_0x1abf('0x5c')](_0x523966);}});}}})[_0x1abf('0x43')](function(_0x5b57b2){if(_0x5b57b2[_0x1abf('0x5d')]===_0x1abf('0x59')){_0x5730e5[_0x1abf('0x1a')](0x194)[_0x1abf('0x26')]('Not\x20found');}else{return handleError(_0x5730e5,null);}});};exports['destroy']=function(_0x3e5366,_0x4f054d){return db[_0x1abf('0x29')][_0x1abf('0x45')]({'where':{'id':_0x3e5366[_0x1abf('0x4b')]['id']}})[_0x1abf('0x22')](function(_0x36eacb){if(!_0x36eacb)throw new ReferenceError(_0x1abf('0x5e'));return _0x36eacb;})['then'](function(_0x337be8){var _0xca1d23=path[_0x1abf('0x50')](config[_0x1abf('0x51')],_0x1abf('0x52'),_0x337be8[_0x1abf('0x4f')]);logger[_0x1abf('0x5f')](_0x1abf('0x60'),_0xca1d23);if(!_[_0x1abf('0x61')](_0x337be8[_0x1abf('0x4f')])&&fs['existsSync'](_0xca1d23)){logger[_0x1abf('0x5f')]('File:\x20\x22'+_0xca1d23+_0x1abf('0x62'));fs[_0x1abf('0x63')](_0xca1d23);}_0xca1d23=_0xca1d23+'.cypher';if(!_[_0x1abf('0x61')](_0x337be8[_0x1abf('0x4f')])&&fs[_0x1abf('0x56')](_0xca1d23)){logger[_0x1abf('0x5f')](_0x1abf('0x64')+_0xca1d23+_0x1abf('0x62'));fs[_0x1abf('0x63')](_0xca1d23);}return _0x337be8;})[_0x1abf('0x22')](function(_0xb3b579){if(!_0xb3b579)throw new InternalError();return _0xb3b579[_0x1abf('0x65')]();})[_0x1abf('0x22')](function(){_0x4f054d[_0x1abf('0x1a')](0xcc)[_0x1abf('0x1b')]();})['catch'](handleError(_0x4f054d,null));}; \ No newline at end of file +var _0x89b8=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','index','map','ScreenRecording','fieldName','type','differenceBy','name','format','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','rawAttributes','intersection','options','find','create','body','duration','createdAt','closedAt','value','describe','uniqueid','join','root','%s.cypher','existsSync','secrets','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf'];(function(_0x507bbe,_0x4c4dbc){var _0x1b0ec8=function(_0x26dbee){while(--_0x26dbee){_0x507bbe['push'](_0x507bbe['shift']());}};_0x1b0ec8(++_0x4c4dbc);}(_0x89b8,0x19f));var _0x889b=function(_0x1946ab,_0x89e6fb){_0x1946ab=_0x1946ab-0x0;var _0x4db468=_0x89b8[_0x1946ab];return _0x4db468;};'use strict';var pdf=require(_0x889b('0x0'));var emlformat=require(_0x889b('0x1'));var rimraf=require(_0x889b('0x2'));var zipdir=require(_0x889b('0x3'));var jsonpatch=require(_0x889b('0x4'));var rp=require(_0x889b('0x5'));var moment=require('moment');var BPromise=require(_0x889b('0x6'));var Mustache=require(_0x889b('0x7'));var util=require(_0x889b('0x8'));var path=require('path');var sox=require(_0x889b('0x9'));var csv=require(_0x889b('0xa'));var ejs=require(_0x889b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x889b('0xc'));var crypto=require(_0x889b('0xd'));var jsforce=require(_0x889b('0xe'));var deskjs=require(_0x889b('0xf'));var toCsv=require(_0x889b('0xa'));var querystring=require(_0x889b('0x10'));var Papa=require(_0x889b('0x11'));var Redis=require(_0x889b('0x12'));var authService=require(_0x889b('0x13'));var qs=require(_0x889b('0x14'));var as=require(_0x889b('0x15'));var hardwareService=require(_0x889b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x889b('0x17'));var config=require(_0x889b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x67a321,_0x38ef17){_0x38ef17=_0x38ef17||0xcc;return function(_0x59d037){if(_0x59d037){return _0x67a321[_0x889b('0x19')](_0x38ef17);}return _0x67a321['status'](_0x38ef17)[_0x889b('0x1a')]();};}function respondWithResult(_0x379078,_0x52be1e){_0x52be1e=_0x52be1e||0xc8;return function(_0x5769eb){if(_0x5769eb){return _0x379078[_0x889b('0x1b')](_0x52be1e)['json'](_0x5769eb);}};}function respondWithFilteredResult(_0x534fbd,_0x4b2a7c){return function(_0x2bf9f3){if(_0x2bf9f3){var _0xedb905=_0x2bf9f3[_0x889b('0x1c')],_0x3eda0b=_0x4b2a7c['offset'],_0x20e313=_0x4b2a7c[_0x889b('0x1d')]+_0x4b2a7c['limit'],_0x41e548;if(_0x20e313>=_0xedb905){_0x20e313=_0xedb905;_0x41e548=0xc8;}else{_0x41e548=0xce;}_0x534fbd[_0x889b('0x1b')](_0x41e548);return _0x534fbd[_0x889b('0x1e')](_0x889b('0x1f'),_0x3eda0b+'-'+_0x20e313+'/'+_0xedb905)[_0x889b('0x20')](_0x2bf9f3);}return null;};}function patchUpdates(_0x1e6bd7){return function(_0x49aed0){try{jsonpatch[_0x889b('0x21')](_0x49aed0,_0x1e6bd7,!![]);}catch(_0x85b9f){return BPromise[_0x889b('0x22')](_0x85b9f);}return _0x49aed0[_0x889b('0x23')]();};}function saveUpdates(_0x7148d5,_0x13e7b7){return function(_0x16c439){if(_0x16c439){return _0x16c439[_0x889b('0x24')](_0x7148d5)[_0x889b('0x25')](function(_0xe84841){return _0xe84841;});}return null;};}function removeEntity(_0x46534d,_0x5bf7e2){return function(_0x4cb5a3){if(_0x4cb5a3){return _0x4cb5a3['destroy']()[_0x889b('0x25')](function(){_0x46534d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e541,_0x3ebaad){return function(_0x4904c9){if(!_0x4904c9){_0x23e541[_0x889b('0x19')](0x194);}return _0x4904c9;};}function handleError(_0x4b5471,_0xf4907){_0xf4907=_0xf4907||0x1f4;return function(_0x279152){logger[_0x889b('0x26')](_0x279152[_0x889b('0x27')]);if(_0x279152['name']){delete _0x279152['name'];}_0x4b5471[_0x889b('0x1b')](_0xf4907)['send'](_0x279152);};}exports[_0x889b('0x28')]=function(_0x53ccc5,_0x7badfe){var _0x4a98ff={},_0x3c7c92={},_0x2dc53e={'count':0x0,'rows':[]};var _0x1892ab=_[_0x889b('0x29')](db[_0x889b('0x2a')]['rawAttributes'],function(_0x498a00){return{'name':_0x498a00[_0x889b('0x2b')],'type':_0x498a00[_0x889b('0x2c')]['key']};});_0x3c7c92['model']=_[_0x889b('0x2d')](_[_0x889b('0x29')](_0x1892ab,_0x889b('0x2e')),[_0x889b('0x2f')]);_0x3c7c92[_0x889b('0x30')]=_[_0x889b('0x31')](_0x53ccc5[_0x889b('0x30')]);_0x3c7c92[_0x889b('0x32')]=_['intersection'](_0x3c7c92['model'],_0x3c7c92['query']);_0x4a98ff[_0x889b('0x33')]=_['intersection'](_0x3c7c92[_0x889b('0x34')],qs['fields'](_0x53ccc5[_0x889b('0x30')][_0x889b('0x35')]));_0x4a98ff[_0x889b('0x33')]=_0x4a98ff[_0x889b('0x33')][_0x889b('0x36')]?_0x4a98ff['attributes']:_0x3c7c92[_0x889b('0x34')];if(!_0x53ccc5['query'][_0x889b('0x37')](_0x889b('0x38'))){_0x4a98ff[_0x889b('0x39')]=qs['limit'](_0x53ccc5[_0x889b('0x30')][_0x889b('0x39')]);_0x4a98ff[_0x889b('0x1d')]=qs[_0x889b('0x1d')](_0x53ccc5['query']['offset']);}_0x4a98ff['order']=qs[_0x889b('0x3a')](_0x53ccc5['query'][_0x889b('0x3a')]);_0x4a98ff[_0x889b('0x3b')]=qs[_0x889b('0x32')](_['pick'](_0x53ccc5[_0x889b('0x30')],_0x3c7c92[_0x889b('0x32')]),_0x1892ab);if(_0x53ccc5[_0x889b('0x30')]['filter']){_0x4a98ff[_0x889b('0x3b')]=_[_0x889b('0x3c')](_0x4a98ff[_0x889b('0x3b')],{'$or':_[_0x889b('0x29')](_0x1892ab,function(_0x14d27c){if(_0x14d27c[_0x889b('0x2c')]!==_0x889b('0x3d')){var _0x42b888={};_0x42b888[_0x14d27c[_0x889b('0x2e')]]={'$like':'%'+_0x53ccc5[_0x889b('0x30')][_0x889b('0x3e')]+'%'};return _0x42b888;}})});}_0x4a98ff=_[_0x889b('0x3c')]({},_0x4a98ff,_0x53ccc5['options']);var _0x5caf48={'where':_0x4a98ff[_0x889b('0x3b')]};return db[_0x889b('0x2a')]['count'](_0x5caf48)[_0x889b('0x25')](function(_0xb73432){_0x2dc53e['count']=_0xb73432;if(_0x53ccc5['query'][_0x889b('0x3f')]){_0x4a98ff[_0x889b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0x889b('0x41')](_0x4a98ff);})[_0x889b('0x25')](function(_0x2644c1){_0x2dc53e['rows']=_0x2644c1;return _0x2dc53e;})[_0x889b('0x25')](respondWithFilteredResult(_0x7badfe,_0x4a98ff))[_0x889b('0x42')](handleError(_0x7badfe,null));};exports['show']=function(_0x3cd6e0,_0x368b2f){var _0x6498ef={'raw':![],'where':{'id':_0x3cd6e0[_0x889b('0x43')]['id']}},_0x5b7e66={};_0x5b7e66[_0x889b('0x34')]=_[_0x889b('0x31')](db[_0x889b('0x2a')][_0x889b('0x44')]);_0x5b7e66[_0x889b('0x30')]=_[_0x889b('0x31')](_0x3cd6e0['query']);_0x5b7e66[_0x889b('0x32')]=_[_0x889b('0x45')](_0x5b7e66[_0x889b('0x34')],_0x5b7e66[_0x889b('0x30')]);_0x6498ef[_0x889b('0x33')]=_[_0x889b('0x45')](_0x5b7e66['model'],qs['fields'](_0x3cd6e0[_0x889b('0x30')][_0x889b('0x35')]));_0x6498ef[_0x889b('0x33')]=_0x6498ef[_0x889b('0x33')][_0x889b('0x36')]?_0x6498ef[_0x889b('0x33')]:_0x5b7e66[_0x889b('0x34')];if(_0x3cd6e0[_0x889b('0x30')][_0x889b('0x3f')]){_0x6498ef[_0x889b('0x40')]=[{'all':!![]}];}_0x6498ef=_['merge']({},_0x6498ef,_0x3cd6e0[_0x889b('0x46')]);return db['ScreenRecording'][_0x889b('0x47')](_0x6498ef)[_0x889b('0x25')](handleEntityNotFound(_0x368b2f,null))['then'](respondWithResult(_0x368b2f,null))[_0x889b('0x42')](handleError(_0x368b2f,null));};exports[_0x889b('0x48')]=function(_0x2db672,_0x217cd7){return db[_0x889b('0x2a')]['create'](_0x2db672[_0x889b('0x49')],{})[_0x889b('0x25')](respondWithResult(_0x217cd7,0xc9))[_0x889b('0x42')](handleError(_0x217cd7,null));};exports['update']=function(_0x70d13e,_0x3febaa){if(_0x70d13e[_0x889b('0x49')]['id']){delete _0x70d13e[_0x889b('0x49')]['id'];}delete _0x70d13e[_0x889b('0x49')][_0x889b('0x4a')];delete _0x70d13e[_0x889b('0x49')][_0x889b('0x4b')];delete _0x70d13e['body'][_0x889b('0x4c')];delete _0x70d13e[_0x889b('0x49')][_0x889b('0x4d')];return db[_0x889b('0x2a')]['find']({'where':{'id':_0x70d13e[_0x889b('0x43')]['id']}})[_0x889b('0x25')](handleEntityNotFound(_0x3febaa,null))['then'](saveUpdates(_0x70d13e['body'],null))[_0x889b('0x25')](respondWithResult(_0x3febaa,null))[_0x889b('0x42')](handleError(_0x3febaa,null));};exports['describe']=function(_0x360c46,_0x500576){return db['ScreenRecording'][_0x889b('0x4e')]()[_0x889b('0x25')](respondWithResult(_0x500576,null))[_0x889b('0x42')](handleError(_0x500576,null));};exports['download']=function(_0x37e044,_0x42977d,_0x5c2997){var _0x1ac1cd=require('../../components/encryptor');var _0x2f3c02=![];var _0x991a74={};if(_0x37e044[_0x889b('0x30')]['type']&&_0x37e044['query'][_0x889b('0x2c')]===_0x889b('0x4f')){_0x991a74[_0x889b('0x4f')]=_0x37e044[_0x889b('0x43')]['id'];}else{_0x991a74['id']=_0x37e044[_0x889b('0x43')]['id'];}return db[_0x889b('0x2a')][_0x889b('0x47')]({'where':_0x991a74,'attributes':['id','value'],'raw':!![]})[_0x889b('0x25')](handleEntityNotFound(_0x42977d,null))['then'](function(_0x129c60){if(_0x129c60){var _0x5d92a9=path[_0x889b('0x50')](config[_0x889b('0x51')],'server/files/screen_recordings',_0x129c60[_0x889b('0x4d')]);var _0x14ce34=util[_0x889b('0x2f')](_0x889b('0x52'),_0x5d92a9);if(fs[_0x889b('0x53')](_0x14ce34)){_0x2f3c02=!![];return _0x1ac1cd['decryptFile'](_0x14ce34,_0x5d92a9,config[_0x889b('0x54')]['recording'])[_0x889b('0x25')](function(){return _0x129c60;});}return _0x129c60;}})[_0x889b('0x25')](function(_0x474b79){if(_0x474b79){var _0x53e599=path[_0x889b('0x50')](config[_0x889b('0x51')],_0x889b('0x55'),_0x474b79[_0x889b('0x4d')]);if(!fs[_0x889b('0x53')](_0x53e599)){throw new db[(_0x889b('0x56'))][(_0x889b('0x57'))](_0x889b('0x58'));}if(_0x474b79['filename']){return _0x42977d[_0x889b('0x59')](_0x53e599,_0x474b79[_0x889b('0x5a')]+path[_0x889b('0x5b')](_0x53e599),function(){if(_0x2f3c02){fs[_0x889b('0x5c')](_0x53e599);}});}else{return _0x42977d[_0x889b('0x59')](_0x53e599,function(_0x2f433c){if(_0x2f3c02){fs[_0x889b('0x5c')](_0x53e599);}});}}})[_0x889b('0x42')](function(_0x5e7800){if(_0x5e7800[_0x889b('0x5d')]===_0x889b('0x58')){_0x42977d[_0x889b('0x1b')](0x194)['send'](_0x889b('0x5e'));}else{return handleError(_0x42977d,null);}});};exports[_0x889b('0x5f')]=function(_0xb802b5,_0x3d7db5){return db[_0x889b('0x2a')][_0x889b('0x47')]({'where':{'id':_0xb802b5[_0x889b('0x43')]['id']}})['then'](function(_0x2e3e9c){if(!_0x2e3e9c)throw new ReferenceError(_0x889b('0x60'));return _0x2e3e9c;})[_0x889b('0x25')](function(_0x58b147){var _0x2649c=path[_0x889b('0x50')](config[_0x889b('0x51')],_0x889b('0x55'),_0x58b147[_0x889b('0x4d')]);logger[_0x889b('0x61')](_0x889b('0x62'),_0x2649c);if(!_[_0x889b('0x63')](_0x58b147[_0x889b('0x4d')])&&fs[_0x889b('0x53')](_0x2649c)){logger[_0x889b('0x61')](_0x889b('0x64')+_0x2649c+_0x889b('0x65'));fs[_0x889b('0x66')](_0x2649c);}_0x2649c=_0x2649c+_0x889b('0x67');if(!_[_0x889b('0x63')](_0x58b147['value'])&&fs[_0x889b('0x53')](_0x2649c)){logger['info'](_0x889b('0x64')+_0x2649c+_0x889b('0x65'));fs[_0x889b('0x66')](_0x2649c);}return _0x58b147;})[_0x889b('0x25')](function(_0x4f47e6){if(!_0x4f47e6)throw new InternalError();return _0x4f47e6[_0x889b('0x5f')]();})[_0x889b('0x25')](function(){_0x3d7db5[_0x889b('0x1b')](0xcc)[_0x889b('0x1a')]();})[_0x889b('0x42')](handleError(_0x3d7db5,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b3a13c7..8b04feb 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 _0xc288=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4fde86,_0x5f4fd3){var _0x47e1aa=function(_0x3125d7){while(--_0x3125d7){_0x4fde86['push'](_0x4fde86['shift']());}};_0x47e1aa(++_0x5f4fd3);}(_0xc288,0x197));var _0x8c28=function(_0x5c1243,_0x17bd31){_0x5c1243=_0x5c1243-0x0;var _0x438ef8=_0xc288[_0x5c1243];return _0x438ef8;};'use strict';var _=require(_0x8c28('0x0'));var util=require(_0x8c28('0x1'));var logger=require(_0x8c28('0x2'))(_0x8c28('0x3'));var moment=require(_0x8c28('0x4'));var BPromise=require(_0x8c28('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x55bdaa,_0x4ac558){return _0x55bdaa[_0x8c28('0xb')](_0x8c28('0xc'),attributes,{'tableName':_0x8c28('0xd'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x8c28('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee49=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','ScreenRecording','screen_recordings','interactionid'];(function(_0x5c5b9d,_0x8e0901){var _0x420d3d=function(_0x53be93){while(--_0x53be93){_0x5c5b9d['push'](_0x5c5b9d['shift']());}};_0x420d3d(++_0x8e0901);}(_0xee49,0x1a4));var _0x9ee4=function(_0x557404,_0x1f162){_0x557404=_0x557404-0x0;var _0x2fdec8=_0xee49[_0x557404];return _0x2fdec8;};'use strict';var _=require(_0x9ee4('0x0'));var util=require(_0x9ee4('0x1'));var logger=require(_0x9ee4('0x2'))('api');var moment=require(_0x9ee4('0x3'));var BPromise=require(_0x9ee4('0x4'));var rp=require(_0x9ee4('0x5'));var fs=require('fs');var path=require(_0x9ee4('0x6'));var rimraf=require(_0x9ee4('0x7'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x9ee4('0x8')]=function(_0x3ee580,_0x1a26b5){return _0x3ee580['define'](_0x9ee4('0x9'),attributes,{'tableName':_0x9ee4('0xa'),'paranoid':![],'indexes':[{'name':_0x9ee4('0xb'),'fields':[_0x9ee4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 93b657b..0f2cc14 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(_0x448b24,_0x10a85e){var _0x4ff572=function(_0x36ac98){while(--_0x36ac98){_0x448b24['push'](_0x448b24['shift']());}};_0x4ff572(++_0x10a85e);}(_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','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(_0x235d7b,_0x3d7df3){var _0x397832=function(_0x5a1aba){while(--_0x5a1aba){_0x235d7b['push'](_0x235d7b['shift']());}};_0x397832(++_0x3d7df3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 6165b48..0fe01a0 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 _0xcc73=['addLogoLogin','join','preferred','addPreferred','post','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id/logo','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','%s%s','logo','extname','originalname','single','file','addLogo','diskStorage','server/files/images/logos/','format','logologin','/:id/logo_login'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xcc73,0x12f));var _0x3cc7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcc73[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x3cc7('0x0'));var util=require(_0x3cc7('0x1'));var path=require(_0x3cc7('0x2'));var timeout=require(_0x3cc7('0x3'));var express=require(_0x3cc7('0x4'));var router=express[_0x3cc7('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cc7('0x6'));var config=require(_0x3cc7('0x7'));var controller=require(_0x3cc7('0x8'));router[_0x3cc7('0x9')]('/',auth[_0x3cc7('0xa')](),controller[_0x3cc7('0xb')]);router[_0x3cc7('0x9')]('/:id',controller['show']);router[_0x3cc7('0x9')](_0x3cc7('0xc'),controller[_0x3cc7('0xd')]);router[_0x3cc7('0x9')]('/:id/logo_login',controller['getLogoLogin']);router[_0x3cc7('0x9')](_0x3cc7('0xe'),controller[_0x3cc7('0xf')]);router[_0x3cc7('0x9')](_0x3cc7('0x10'),controller[_0x3cc7('0x11')]);router[_0x3cc7('0x9')](_0x3cc7('0x12'),controller[_0x3cc7('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a7de,_0x17f0ba,_0x273196){_0x273196(null,path['join'](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x55ce4c,_0x444b7d,_0x23c272){_0x23c272(null,util['format'](_0x3cc7('0x15'),_0x3cc7('0x16'),path[_0x3cc7('0x17')](_0x444b7d[_0x3cc7('0x18')])));}})});router['post'](_0x3cc7('0xc'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x1b')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x5f51cb,_0x50566c,_0xee939e){_0xee939e(null,path['join'](config['root'],_0x3cc7('0x1d')));},'filename':function(_0x55523c,_0x5a8ae4,_0x19e80e){_0x19e80e(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),_0x3cc7('0x1f'),path[_0x3cc7('0x17')](_0x5a8ae4[_0x3cc7('0x18')])));}})});router['post'](_0x3cc7('0x20'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x21')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x547783,_0x405f60,_0x55b8a1){_0x55b8a1(null,path[_0x3cc7('0x22')](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x4ef203,_0x580a55,_0x4cae24){_0x4cae24(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),_0x3cc7('0x23'),path['extname'](_0x580a55['originalname'])));}})});router['post'](_0x3cc7('0x10'),upload['single'](_0x3cc7('0x1a')),controller[_0x3cc7('0x24')]);var upload=multer({'storage':multer[_0x3cc7('0x1c')]({'destination':function(_0x2b8a92,_0x3c905c,_0x5ac05a){_0x5ac05a(null,path[_0x3cc7('0x22')](config[_0x3cc7('0x14')],'server/files/images/logos/'));},'filename':function(_0x34c988,_0x252272,_0x5e4aae){_0x5e4aae(null,util[_0x3cc7('0x1e')](_0x3cc7('0x15'),'favicon',path['extname'](_0x252272[_0x3cc7('0x18')])));}})});router[_0x3cc7('0x25')](_0x3cc7('0x12'),upload[_0x3cc7('0x19')](_0x3cc7('0x1a')),controller[_0x3cc7('0x26')]);router['put'](_0x3cc7('0x27'),auth[_0x3cc7('0xa')](),controller[_0x3cc7('0x28')]);module[_0x3cc7('0x29')]=router; \ No newline at end of file +var _0xad58=['%s%s','extname','originalname','post','single','file','addLogo','addLogoLogin','preferred','favicon','addFavicon','put','/:id','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0xad58,0x1bd));var _0x8ad5=function(_0x290fd1,_0x5df6f1){_0x290fd1=_0x290fd1-0x0;var _0x5bdf49=_0xad58[_0x290fd1];return _0x5bdf49;};'use strict';var multer=require(_0x8ad5('0x0'));var util=require('util');var path=require(_0x8ad5('0x1'));var timeout=require(_0x8ad5('0x2'));var express=require(_0x8ad5('0x3'));var router=express[_0x8ad5('0x4')]();var auth=require(_0x8ad5('0x5'));var interaction=require(_0x8ad5('0x6'));var config=require(_0x8ad5('0x7'));var controller=require(_0x8ad5('0x8'));router[_0x8ad5('0x9')]('/',auth[_0x8ad5('0xa')](),controller[_0x8ad5('0xb')]);router[_0x8ad5('0x9')]('/:id',controller[_0x8ad5('0xc')]);router[_0x8ad5('0x9')](_0x8ad5('0xd'),controller[_0x8ad5('0xe')]);router[_0x8ad5('0x9')](_0x8ad5('0xf'),controller[_0x8ad5('0x10')]);router[_0x8ad5('0x9')](_0x8ad5('0x11'),controller[_0x8ad5('0x12')]);router[_0x8ad5('0x9')](_0x8ad5('0x13'),controller[_0x8ad5('0x14')]);router[_0x8ad5('0x9')](_0x8ad5('0x15'),controller[_0x8ad5('0x16')]);var upload=multer({'storage':multer[_0x8ad5('0x17')]({'destination':function(_0x37fbbe,_0x572d1f,_0x23a28e){_0x23a28e(null,path[_0x8ad5('0x18')](config[_0x8ad5('0x19')],_0x8ad5('0x1a')));},'filename':function(_0x39b19b,_0x4505e4,_0x58dfc7){_0x58dfc7(null,util[_0x8ad5('0x1b')](_0x8ad5('0x1c'),'logo',path[_0x8ad5('0x1d')](_0x4505e4[_0x8ad5('0x1e')])));}})});router[_0x8ad5('0x1f')](_0x8ad5('0xd'),upload[_0x8ad5('0x20')](_0x8ad5('0x21')),controller[_0x8ad5('0x22')]);var upload=multer({'storage':multer[_0x8ad5('0x17')]({'destination':function(_0xd47ccb,_0x4ea08c,_0x211459){_0x211459(null,path[_0x8ad5('0x18')](config[_0x8ad5('0x19')],_0x8ad5('0x1a')));},'filename':function(_0x31d649,_0xda6578,_0x2c7040){_0x2c7040(null,util['format'](_0x8ad5('0x1c'),'logologin',path['extname'](_0xda6578[_0x8ad5('0x1e')])));}})});router[_0x8ad5('0x1f')](_0x8ad5('0xf'),upload['single'](_0x8ad5('0x21')),controller[_0x8ad5('0x23')]);var upload=multer({'storage':multer[_0x8ad5('0x17')]({'destination':function(_0xc3279a,_0x4c6331,_0x2345c6){_0x2345c6(null,path[_0x8ad5('0x18')](config[_0x8ad5('0x19')],'server/files/images/logos/'));},'filename':function(_0x54645c,_0x4a55b6,_0x3acfcf){_0x3acfcf(null,util[_0x8ad5('0x1b')]('%s%s',_0x8ad5('0x24'),path[_0x8ad5('0x1d')](_0x4a55b6[_0x8ad5('0x1e')])));}})});router[_0x8ad5('0x1f')](_0x8ad5('0x13'),upload[_0x8ad5('0x20')](_0x8ad5('0x21')),controller['addPreferred']);var upload=multer({'storage':multer[_0x8ad5('0x17')]({'destination':function(_0xea765e,_0x258c88,_0x37a9ad){_0x37a9ad(null,path[_0x8ad5('0x18')](config['root'],_0x8ad5('0x1a')));},'filename':function(_0x46b442,_0x16e438,_0x4acb73){_0x4acb73(null,util['format'](_0x8ad5('0x1c'),_0x8ad5('0x25'),path['extname'](_0x16e438[_0x8ad5('0x1e')])));}})});router[_0x8ad5('0x1f')](_0x8ad5('0x15'),upload[_0x8ad5('0x20')](_0x8ad5('0x21')),controller[_0x8ad5('0x26')]);router[_0x8ad5('0x27')](_0x8ad5('0x28'),auth['isAuthenticated'](),controller[_0x8ad5('0x29')]);module[_0x8ad5('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c2bede6..67e310d 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 _0x61b5=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_mailbox'];(function(_0x205fb2,_0x49ea96){var _0x1350f4=function(_0x47f15c){while(--_0x47f15c){_0x205fb2['push'](_0x205fb2['shift']());}};_0x1350f4(++_0x49ea96);}(_0x61b5,0x1bc));var _0x561b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61b5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x561b('0x0'));module[_0x561b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x561b('0x2')](0xb),'unique':_0x561b('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x561b('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x561b('0x4')],'defaultValue':_0x561b('0x5')},'logo':{'type':Sequelize[_0x561b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x561b('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x561b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x561b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x561b('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x561b('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x561b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x561b('0x4')],'defaultValue':_0x561b('0x7')},'enableEmailPreview':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x561b('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x561b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x561b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x561b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x561b('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x561b('0x4')]},'language':{'type':Sequelize[_0x561b('0x4')]},'bucket':{'type':Sequelize[_0x561b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x561b('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xc1b5=['min_internal','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER'];(function(_0x55bd05,_0x3a846b){var _0x391051=function(_0x77de59){while(--_0x77de59){_0x55bd05['push'](_0x55bd05['shift']());}};_0x391051(++_0x3a846b);}(_0xc1b5,0x175));var _0x5c1b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xc1b5[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0x5c1b('0x0'));module[_0x5c1b('0x1')]={'min_internal':{'type':Sequelize[_0x5c1b('0x2')](0xb),'unique':_0x5c1b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x5c1b('0x4')]},'defaultLogo':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5c1b('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5c1b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5c1b('0x4')]},'turnaddr':{'type':Sequelize[_0x5c1b('0x4')]},'turnusername':{'type':Sequelize[_0x5c1b('0x4')]},'turnpassword':{'type':Sequelize[_0x5c1b('0x4')]},'pageTitle':{'type':Sequelize[_0x5c1b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5c1b('0x4')],'defaultValue':_0x5c1b('0x6')},'enableEmailPreview':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5c1b('0x4')],'defaultValue':_0x5c1b('0x7')},'chatTimeout':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5c1b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5c1b('0x4')]},'defaultFavicon':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5c1b('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x5c1b('0x4')]},'sentiment':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5c1b('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5c1b('0x4')]},'language':{'type':Sequelize[_0x5c1b('0x4')]},'bucket':{'type':Sequelize[_0x5c1b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x5c1b('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0f7478e..5e9758e 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 _0x7b01=['default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','Setting,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','params','includeAll','body','addLogo','file','filename','logo','addLogoLogin','../../config/license/util','server/files/images/logos','getLicense','find','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','root','join','toLower','default','upperFirst','custom','default_logo.svg','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','gdpr','addPreferred','getPreferred'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_0x7b01,0x7f));var _0x17b0=function(_0x34cda0,_0x1af6e1){_0x34cda0=_0x34cda0-0x0;var _0x2df6ba=_0x7b01[_0x34cda0];return _0x2df6ba;};'use strict';var pdf=require(_0x17b0('0x0'));var emlformat=require(_0x17b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x17b0('0x2'));var rp=require(_0x17b0('0x3'));var moment=require('moment');var BPromise=require(_0x17b0('0x4'));var Mustache=require(_0x17b0('0x5'));var util=require(_0x17b0('0x6'));var path=require(_0x17b0('0x7'));var sox=require(_0x17b0('0x8'));var csv=require('to-csv');var ejs=require(_0x17b0('0x9'));var fs=require('fs');var _=require(_0x17b0('0xa'));var squel=require(_0x17b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x17b0('0xc'));var deskjs=require(_0x17b0('0xd'));var toCsv=require(_0x17b0('0xe'));var querystring=require(_0x17b0('0xf'));var Papa=require(_0x17b0('0x10'));var Redis=require(_0x17b0('0x11'));var authService=require(_0x17b0('0x12'));var qs=require(_0x17b0('0x13'));var as=require(_0x17b0('0x14'));var hardwareService=require(_0x17b0('0x15'));var logger=require(_0x17b0('0x16'))(_0x17b0('0x17'));var utils=require(_0x17b0('0x18'));var config=require(_0x17b0('0x19'));var db=require(_0x17b0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x17b0('0x1b')][_0x17b0('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x190ad2,_0x1dc704,_0x5c8b3c){if(_0x5c8b3c){var _0x14ab51=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14ab51[_0x17b0('0x1d')](_0x1dc704)){return _0x190ad2;}else{throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190ad2;}}function respondWithRpcPromise(_0x2afae5,_0x1bd9b9,_0x97dff1,_0x30b48){return new BPromise(function(_0x215318,_0x48965b){var _0x3ccca9=_0x30b48||client;return _0x3ccca9[_0x17b0('0x20')](_0x2afae5,_0x97dff1)[_0x17b0('0x21')](function(_0xbf0be5){logger['info'](_0x17b0('0x22'),_0x1bd9b9,'request\x20sent');logger[_0x17b0('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x1bd9b9,'request\x20sent',JSON['stringify'](_0xbf0be5));if(_0xbf0be5['error']){if(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x25')]===0x1f4){logger[_0x17b0('0x24')](_0x17b0('0x22'),_0x1bd9b9,_0xbf0be5['error']['message']);return _0x48965b(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x26')]);}logger[_0x17b0('0x24')](_0x17b0('0x22'),_0x1bd9b9,_0xbf0be5[_0x17b0('0x24')]['message']);return _0x215318(_0xbf0be5[_0x17b0('0x24')][_0x17b0('0x26')]);}else{logger[_0x17b0('0x27')](_0x17b0('0x22'),_0x1bd9b9,_0x17b0('0x28'));_0x215318(_0xbf0be5[_0x17b0('0x29')][_0x17b0('0x26')]);}})[_0x17b0('0x2a')](function(_0x2ce6dd){logger[_0x17b0('0x24')]('Setting,\x20%s,\x20%s',_0x1bd9b9,_0x2ce6dd);_0x48965b(_0x2ce6dd);});});}function respondWithStatusCode(_0x57dfe8,_0xb945f){_0xb945f=_0xb945f||0xcc;return function(_0x92adc){if(_0x92adc){return _0x57dfe8[_0x17b0('0x2b')](_0xb945f);}return _0x57dfe8[_0x17b0('0x2c')](_0xb945f)['end']();};}function respondWithResult(_0x1ee367,_0x200696){_0x200696=_0x200696||0xc8;return function(_0x26d6a0){if(_0x26d6a0){return _0x1ee367['status'](_0x200696)[_0x17b0('0x2d')](_0x26d6a0);}};}function respondWithFilteredResult(_0x238f41,_0x43db2c){return function(_0x8c9d5){if(_0x8c9d5){var _0x3e87c8=_0x8c9d5[_0x17b0('0x2e')],_0x46eea0=_0x43db2c[_0x17b0('0x2f')],_0x187e7b=_0x43db2c['offset']+_0x43db2c[_0x17b0('0x30')],_0x4068d3;if(_0x187e7b>=_0x3e87c8){_0x187e7b=_0x3e87c8;_0x4068d3=0xc8;}else{_0x4068d3=0xce;}_0x238f41[_0x17b0('0x2c')](_0x4068d3);return _0x238f41[_0x17b0('0x31')](_0x17b0('0x32'),_0x46eea0+'-'+_0x187e7b+'/'+_0x3e87c8)[_0x17b0('0x2d')](_0x8c9d5);}return null;};}function patchUpdates(_0x1b2003){return function(_0x1bc4c2){try{jsonpatch[_0x17b0('0x33')](_0x1bc4c2,_0x1b2003,!![]);}catch(_0x48007c){return BPromise[_0x17b0('0x34')](_0x48007c);}return _0x1bc4c2[_0x17b0('0x35')]();};}function saveUpdates(_0x4457a,_0x45266c){return function(_0x30b6f6){if(_0x30b6f6){return _0x30b6f6[_0x17b0('0x36')](_0x4457a)[_0x17b0('0x21')](function(_0x5cd35f){return _0x5cd35f;});}return null;};}function removeEntity(_0x554ac7,_0x3e0a2c){return function(_0x31c800){if(_0x31c800){return _0x31c800['destroy']()[_0x17b0('0x21')](function(){_0x554ac7[_0x17b0('0x2c')](0xcc)[_0x17b0('0x37')]();});}};}function handleEntityNotFound(_0x26bbd0,_0x4e661d){return function(_0x18ed2e){if(!_0x18ed2e){_0x26bbd0[_0x17b0('0x2b')](0x194);}return _0x18ed2e;};}function handleError(_0x23f759,_0x43c7ff){_0x43c7ff=_0x43c7ff||0x1f4;return function(_0x59729c){logger[_0x17b0('0x24')](_0x59729c[_0x17b0('0x38')]);if(_0x59729c[_0x17b0('0x39')]){delete _0x59729c['name'];}_0x23f759[_0x17b0('0x2c')](_0x43c7ff)[_0x17b0('0x3a')](_0x59729c);};}exports[_0x17b0('0x3b')]=function(_0x497b83,_0x13c5bc){var _0x53e098={},_0x653352={},_0x43e11d={'count':0x0,'rows':[]};var _0x2e5ec5=_[_0x17b0('0x3c')](db[_0x17b0('0x3d')][_0x17b0('0x3e')],function(_0x5eaf28){return{'name':_0x5eaf28[_0x17b0('0x3f')],'type':_0x5eaf28[_0x17b0('0x40')][_0x17b0('0x41')]};});_0x653352[_0x17b0('0x42')]=_['map'](_0x2e5ec5,_0x17b0('0x39'));_0x653352['query']=_[_0x17b0('0x43')](_0x497b83[_0x17b0('0x44')]);_0x653352[_0x17b0('0x45')]=_[_0x17b0('0x46')](_0x653352[_0x17b0('0x42')],_0x653352[_0x17b0('0x44')]);_0x53e098['attributes']=_[_0x17b0('0x46')](_0x653352['model'],qs[_0x17b0('0x47')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x47')]));_0x53e098[_0x17b0('0x48')]=_0x53e098['attributes'][_0x17b0('0x49')]?_0x53e098[_0x17b0('0x48')]:_0x653352[_0x17b0('0x42')];if(!_0x497b83[_0x17b0('0x44')]['hasOwnProperty']('nolimit')){_0x53e098[_0x17b0('0x30')]=qs[_0x17b0('0x30')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x30')]);_0x53e098[_0x17b0('0x2f')]=qs[_0x17b0('0x2f')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x2f')]);}_0x53e098[_0x17b0('0x4a')]=qs[_0x17b0('0x4b')](_0x497b83[_0x17b0('0x44')][_0x17b0('0x4b')]);_0x53e098['where']=qs[_0x17b0('0x45')](_[_0x17b0('0x4c')](_0x497b83[_0x17b0('0x44')],_0x653352[_0x17b0('0x45')]),_0x2e5ec5);if(_0x497b83[_0x17b0('0x44')][_0x17b0('0x4d')]){_0x53e098['where']=_['merge'](_0x53e098[_0x17b0('0x4e')],{'$or':_['map'](_0x2e5ec5,function(_0x2eae91){if(_0x2eae91['type']!==_0x17b0('0x4f')){var _0x35ed68={};_0x35ed68[_0x2eae91['name']]={'$like':'%'+_0x497b83[_0x17b0('0x44')][_0x17b0('0x4d')]+'%'};return _0x35ed68;}})});}_0x53e098=_[_0x17b0('0x50')]({},_0x53e098,_0x497b83['options']);var _0x1d8ddb={'where':_0x53e098[_0x17b0('0x4e')]};return db['Setting'][_0x17b0('0x2e')](_0x1d8ddb)[_0x17b0('0x21')](function(_0x5d7408){_0x43e11d[_0x17b0('0x2e')]=_0x5d7408;if(_0x497b83['query']['includeAll']){_0x53e098[_0x17b0('0x51')]=[{'all':!![]}];}return db[_0x17b0('0x3d')][_0x17b0('0x52')](_0x53e098);})[_0x17b0('0x21')](function(_0x51b796){_0x43e11d[_0x17b0('0x53')]=_0x51b796;return _0x43e11d;})['then'](respondWithFilteredResult(_0x13c5bc,_0x53e098))['catch'](handleError(_0x13c5bc,null));};exports['show']=function(_0x2d6c5c,_0x493458){var _0x4d569f={'raw':![],'where':{'id':_0x2d6c5c[_0x17b0('0x54')]['id']}},_0x4714cc={};_0x4714cc[_0x17b0('0x42')]=_[_0x17b0('0x43')](db[_0x17b0('0x3d')]['rawAttributes']);_0x4714cc[_0x17b0('0x44')]=_['keys'](_0x2d6c5c[_0x17b0('0x44')]);_0x4714cc[_0x17b0('0x45')]=_['intersection'](_0x4714cc[_0x17b0('0x42')],_0x4714cc[_0x17b0('0x44')]);_0x4d569f[_0x17b0('0x48')]=_['intersection'](_0x4714cc[_0x17b0('0x42')],qs['fields'](_0x2d6c5c[_0x17b0('0x44')][_0x17b0('0x47')]));_0x4d569f[_0x17b0('0x48')]=_0x4d569f[_0x17b0('0x48')][_0x17b0('0x49')]?_0x4d569f[_0x17b0('0x48')]:_0x4714cc[_0x17b0('0x42')];if(_0x2d6c5c['query'][_0x17b0('0x55')]){_0x4d569f[_0x17b0('0x51')]=[{'all':!![]}];}_0x4d569f=_[_0x17b0('0x50')]({},_0x4d569f,_0x2d6c5c['options']);return db['Setting']['find'](_0x4d569f)[_0x17b0('0x21')](handleEntityNotFound(_0x493458,null))[_0x17b0('0x21')](respondWithResult(_0x493458,null))[_0x17b0('0x2a')](handleError(_0x493458,null));};exports[_0x17b0('0x36')]=function(_0x198187,_0x3e9303){if(_0x198187[_0x17b0('0x56')]['id']){delete _0x198187[_0x17b0('0x56')]['id'];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x198187['params']['id']}})[_0x17b0('0x21')](handleEntityNotFound(_0x3e9303,null))[_0x17b0('0x21')](saveUpdates(_0x198187['body'],null))[_0x17b0('0x21')](respondWithResult(_0x3e9303,null))[_0x17b0('0x2a')](handleError(_0x3e9303,null));};exports[_0x17b0('0x57')]=function(_0x5ab42b,_0x30bfa8,_0x106ca5){if(_0x5ab42b[_0x17b0('0x58')]&&_0x5ab42b[_0x17b0('0x58')][_0x17b0('0x59')]){_0x5ab42b[_0x17b0('0x56')][_0x17b0('0x5a')]=_0x5ab42b[_0x17b0('0x58')][_0x17b0('0x59')];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x5ab42b[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x30bfa8,null))[_0x17b0('0x21')](saveUpdates(_0x5ab42b[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x30bfa8,null))[_0x17b0('0x2a')](handleError(_0x30bfa8,null));};exports[_0x17b0('0x5b')]=function(_0x526dff,_0x5f4d74,_0x122110){if(_0x526dff[_0x17b0('0x58')]&&_0x526dff[_0x17b0('0x58')][_0x17b0('0x59')]){_0x526dff[_0x17b0('0x56')]['loginLogo']=_0x526dff[_0x17b0('0x58')][_0x17b0('0x59')];}return db[_0x17b0('0x3d')]['find']({'where':{'id':_0x526dff[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x5f4d74,null))['then'](saveUpdates(_0x526dff[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x5f4d74,null))[_0x17b0('0x2a')](handleError(_0x5f4d74,null));};var utilLicense=require(_0x17b0('0x5c'));exports['getLogo']=function(_0x8ef2a9,_0x2c2120,_0x1d1fb4){var _0x45b25c=_0x17b0('0x5d');var _0x4f8691={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x49ed6b){if(_0x49ed6b){_0x4f8691=_0x49ed6b;}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x8ef2a9['params']['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),_0x17b0('0x64'),_0x17b0('0x65'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2c2120,null))['then'](function(_0x175ca2){if(_0x175ca2){var _0xad52a0=_0x175ca2[_0x17b0('0x5a')]&&fs[_0x17b0('0x66')](path['join'](config[_0x17b0('0x67')],_0x45b25c,_['toLower'](_0x175ca2[_0x17b0('0x5a')])))?path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')](_0x175ca2[_0x17b0('0x5a')])):path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')]('default_logo.svg'));var _0xd046a1=_0x17b0('0x6a')+_[_0x17b0('0x6b')](_0x17b0('0x5a'));if(_0x175ca2[_0xd046a1]||!_0x4f8691[_0x17b0('0x6c')]){_0xad52a0=path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x45b25c,_[_0x17b0('0x69')](_0x17b0('0x6d')));}if(!fs[_0x17b0('0x66')](_0xad52a0)){throw new db['Sequelize'][(_0x17b0('0x1f'))](_['upperFirst'](_0x17b0('0x5a'))+'\x20not\x20found');}return _0x2c2120[_0x17b0('0x6e')](_0xad52a0);}})[_0x17b0('0x2a')](handleError(_0x2c2120,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x6f')]=function(_0x14ea2a,_0x5c930e,_0x59bdb4){var _0x20dc99=_0x17b0('0x5d');var _0x13ae34={'custom':![]};return utilLicense[_0x17b0('0x5e')]()['then'](function(_0x2edac8){if(_0x2edac8){_0x13ae34=_0x2edac8;}return db['Setting']['find']({'where':{'id':_0x14ea2a[_0x17b0('0x54')]['id']},'attributes':[_0x17b0('0x5a'),'loginLogo',_0x17b0('0x61'),'favicon',_0x17b0('0x63'),_0x17b0('0x64'),_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})[_0x17b0('0x21')](handleEntityNotFound(_0x5c930e,null))[_0x17b0('0x21')](function(_0x10d2cd){if(_0x10d2cd){var _0xe3a853=_0x10d2cd['loginLogo']&&fs[_0x17b0('0x66')](path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x20dc99,_['toLower'](_0x10d2cd[_0x17b0('0x60')])))?path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x20dc99,_['toLower'](_0x10d2cd[_0x17b0('0x60')])):path[_0x17b0('0x68')](config['root'],_0x20dc99,_['toLower'](_0x17b0('0x71')));var _0x25b0a6='default'+_[_0x17b0('0x6b')]('loginLogo');if(_0x10d2cd[_0x25b0a6]||!_0x13ae34[_0x17b0('0x6c')]){_0xe3a853=path['join'](config[_0x17b0('0x67')],_0x20dc99,_[_0x17b0('0x69')](_0x17b0('0x71')));}if(!fs[_0x17b0('0x66')](_0xe3a853)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_['upperFirst'](_0x17b0('0x60'))+'\x20not\x20found');}return _0x5c930e[_0x17b0('0x6e')](_0xe3a853);}})[_0x17b0('0x2a')](handleError(_0x5c930e,null));};exports[_0x17b0('0x72')]=function(_0x148539,_0x54ea78){return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x148539[_0x17b0('0x54')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x54ea78,null))[_0x17b0('0x2a')](handleError(_0x54ea78,null));};exports[_0x17b0('0x73')]=function(_0x291474,_0x5c1729,_0x1fece5){if(_0x291474[_0x17b0('0x58')]&&_0x291474[_0x17b0('0x58')][_0x17b0('0x59')]){_0x291474[_0x17b0('0x56')][_0x17b0('0x61')]=_0x291474[_0x17b0('0x58')][_0x17b0('0x59')];}return db['Setting']['find']({'where':{'id':_0x291474[_0x17b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c1729,null))[_0x17b0('0x21')](saveUpdates(_0x291474[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x5c1729,null))[_0x17b0('0x2a')](handleError(_0x5c1729,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x74')]=function(_0x126ffa,_0x2e1b3d,_0x5bcda0){var _0x19f77b=_0x17b0('0x5d');var _0x364f9f={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x152f2f){if(_0x152f2f){_0x364f9f=_0x152f2f;}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0x126ffa['params']['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),'defaultLoginLogo',_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})['then'](handleEntityNotFound(_0x2e1b3d,null))[_0x17b0('0x21')](function(_0x1b1a26){if(_0x1b1a26){var _0x4a1a08=_0x1b1a26[_0x17b0('0x61')]&&fs[_0x17b0('0x66')](path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x19f77b,_[_0x17b0('0x69')](_0x1b1a26[_0x17b0('0x61')])))?path['join'](config[_0x17b0('0x67')],_0x19f77b,_[_0x17b0('0x69')](_0x1b1a26[_0x17b0('0x61')])):path[_0x17b0('0x68')](config['root'],_0x19f77b,_['toLower'](_0x17b0('0x75')));var _0xd5baf1='default'+_[_0x17b0('0x6b')]('preferred');if(_0x1b1a26[_0xd5baf1]||!_0x364f9f['custom']||!_0x364f9f[_0x17b0('0x61')]){_0x4a1a08=path['join'](config[_0x17b0('0x67')],_0x19f77b,_['toLower'](_0x17b0('0x75')));}if(!fs[_0x17b0('0x66')](_0x4a1a08)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_['upperFirst']('preferred')+_0x17b0('0x76'));}return _0x2e1b3d['download'](_0x4a1a08);}})[_0x17b0('0x2a')](handleError(_0x2e1b3d,null));};exports[_0x17b0('0x77')]=function(_0xeb7a46,_0x1ba4f5,_0x7a732e){if(_0xeb7a46[_0x17b0('0x58')]&&_0xeb7a46[_0x17b0('0x58')][_0x17b0('0x59')]){_0xeb7a46[_0x17b0('0x56')][_0x17b0('0x62')]=_0xeb7a46['file'][_0x17b0('0x59')];}return db[_0x17b0('0x3d')][_0x17b0('0x5f')]({'where':{'id':_0xeb7a46['params']['id']}})[_0x17b0('0x21')](handleEntityNotFound(_0x1ba4f5,null))['then'](saveUpdates(_0xeb7a46[_0x17b0('0x56')],null))[_0x17b0('0x21')](respondWithResult(_0x1ba4f5,null))[_0x17b0('0x2a')](handleError(_0x1ba4f5,null));};var utilLicense=require(_0x17b0('0x5c'));exports[_0x17b0('0x78')]=function(_0x40e48a,_0x3b4f47,_0x5d4e09){var _0x1675be=_0x17b0('0x5d');var _0x149c40={'custom':![]};return utilLicense[_0x17b0('0x5e')]()[_0x17b0('0x21')](function(_0x32c3c7){if(_0x32c3c7){_0x149c40=_0x32c3c7;}return db['Setting']['find']({'where':{'id':_0x40e48a[_0x17b0('0x54')]['id']},'attributes':[_0x17b0('0x5a'),_0x17b0('0x60'),_0x17b0('0x61'),_0x17b0('0x62'),_0x17b0('0x63'),'defaultLoginLogo',_0x17b0('0x65'),_0x17b0('0x70')],'raw':!![]});})[_0x17b0('0x21')](handleEntityNotFound(_0x3b4f47,null))[_0x17b0('0x21')](function(_0x231361){if(_0x231361){var _0x3f2c66=_0x231361['favicon']&&fs[_0x17b0('0x66')](path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')](_0x231361[_0x17b0('0x62')])))?path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')](_0x231361[_0x17b0('0x62')])):path[_0x17b0('0x68')](config[_0x17b0('0x67')],_0x1675be,_[_0x17b0('0x69')](_0x17b0('0x79')));var _0x442006=_0x17b0('0x6a')+_[_0x17b0('0x6b')](_0x17b0('0x62'));if(_0x231361[_0x442006]||!_0x149c40[_0x17b0('0x6c')]){_0x3f2c66=path['join'](config['root'],_0x1675be,_[_0x17b0('0x69')]('default_favicon.ico'));}if(!fs[_0x17b0('0x66')](_0x3f2c66)){throw new db[(_0x17b0('0x1e'))][(_0x17b0('0x1f'))](_[_0x17b0('0x6b')](_0x17b0('0x62'))+_0x17b0('0x76'));}return _0x3b4f47[_0x17b0('0x6e')](_0x3f2c66);}})[_0x17b0('0x2a')](handleError(_0x3b4f47,null));}; \ No newline at end of file +var _0x170c=['download','getLogoLogin','preferred','default_loginLogo.svg','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','Setting','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','pick','where','type','VIRTUAL','filter','merge','options','includeAll','rows','show','params','keys','include','find','body','addLogo','filename','logo','file','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','ValidationError'];(function(_0x87a927,_0x257259){var _0x1e3b20=function(_0x376aa1){while(--_0x376aa1){_0x87a927['push'](_0x87a927['shift']());}};_0x1e3b20(++_0x257259);}(_0x170c,0x85));var _0xc170=function(_0x3fbf2f,_0x185ca9){_0x3fbf2f=_0x3fbf2f-0x0;var _0x4bb7a0=_0x170c[_0x3fbf2f];return _0x4bb7a0;};'use strict';var pdf=require(_0xc170('0x0'));var emlformat=require(_0xc170('0x1'));var rimraf=require(_0xc170('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc170('0x3'));var rp=require('request-promise');var moment=require(_0xc170('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc170('0x5'));var util=require(_0xc170('0x6'));var path=require('path');var sox=require(_0xc170('0x7'));var csv=require(_0xc170('0x8'));var ejs=require(_0xc170('0x9'));var fs=require('fs');var _=require(_0xc170('0xa'));var squel=require(_0xc170('0xb'));var crypto=require('crypto');var jsforce=require(_0xc170('0xc'));var deskjs=require(_0xc170('0xd'));var toCsv=require(_0xc170('0x8'));var querystring=require('querystring');var Papa=require(_0xc170('0xe'));var Redis=require(_0xc170('0xf'));var authService=require(_0xc170('0x10'));var qs=require(_0xc170('0x11'));var as=require(_0xc170('0x12'));var hardwareService=require(_0xc170('0x13'));var logger=require(_0xc170('0x14'))(_0xc170('0x15'));var utils=require(_0xc170('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xc170('0x17'));var client=jayson[_0xc170('0x18')][_0xc170('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4fdc50,_0xfdfad4,_0x49fc8d){if(_0x49fc8d){var _0x54edb7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54edb7[_0xc170('0x1a')](_0xfdfad4)){return _0x4fdc50;}else{throw new db['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~!@#$%^&-_=+[{]}.');}}else{return _0x4fdc50;}}function respondWithRpcPromise(_0xe80f1,_0x5cca4d,_0x99c449,_0x30a981){return new BPromise(function(_0x5d8615,_0x1608bc){var _0x410312=_0x30a981||client;return _0x410312[_0xc170('0x1b')](_0xe80f1,_0x99c449)[_0xc170('0x1c')](function(_0x54fe9c){logger[_0xc170('0x1d')](_0xc170('0x1e'),_0x5cca4d,_0xc170('0x1f'));logger['debug'](_0xc170('0x20'),_0x5cca4d,_0xc170('0x1f'),JSON[_0xc170('0x21')](_0x54fe9c));if(_0x54fe9c['error']){if(_0x54fe9c[_0xc170('0x22')][_0xc170('0x23')]===0x1f4){logger[_0xc170('0x22')](_0xc170('0x1e'),_0x5cca4d,_0x54fe9c['error'][_0xc170('0x24')]);return _0x1608bc(_0x54fe9c['error'][_0xc170('0x24')]);}logger[_0xc170('0x22')](_0xc170('0x1e'),_0x5cca4d,_0x54fe9c[_0xc170('0x22')][_0xc170('0x24')]);return _0x5d8615(_0x54fe9c[_0xc170('0x22')][_0xc170('0x24')]);}else{logger['info'](_0xc170('0x1e'),_0x5cca4d,_0xc170('0x1f'));_0x5d8615(_0x54fe9c[_0xc170('0x25')][_0xc170('0x24')]);}})[_0xc170('0x26')](function(_0x33b081){logger[_0xc170('0x22')](_0xc170('0x1e'),_0x5cca4d,_0x33b081);_0x1608bc(_0x33b081);});});}function respondWithStatusCode(_0x2824f7,_0x1db869){_0x1db869=_0x1db869||0xcc;return function(_0x4cbf45){if(_0x4cbf45){return _0x2824f7['sendStatus'](_0x1db869);}return _0x2824f7['status'](_0x1db869)['end']();};}function respondWithResult(_0x21f51c,_0x216101){_0x216101=_0x216101||0xc8;return function(_0x2874d6){if(_0x2874d6){return _0x21f51c[_0xc170('0x27')](_0x216101)[_0xc170('0x28')](_0x2874d6);}};}function respondWithFilteredResult(_0x40ecb0,_0x1a1885){return function(_0x18ead2){if(_0x18ead2){var _0x333198=_0x18ead2[_0xc170('0x29')],_0x2569da=_0x1a1885[_0xc170('0x2a')],_0x4013ac=_0x1a1885['offset']+_0x1a1885[_0xc170('0x2b')],_0x2aa696;if(_0x4013ac>=_0x333198){_0x4013ac=_0x333198;_0x2aa696=0xc8;}else{_0x2aa696=0xce;}_0x40ecb0['status'](_0x2aa696);return _0x40ecb0[_0xc170('0x2c')](_0xc170('0x2d'),_0x2569da+'-'+_0x4013ac+'/'+_0x333198)[_0xc170('0x28')](_0x18ead2);}return null;};}function patchUpdates(_0x3e4e6c){return function(_0x83e295){try{jsonpatch[_0xc170('0x2e')](_0x83e295,_0x3e4e6c,!![]);}catch(_0x2d766c){return BPromise[_0xc170('0x2f')](_0x2d766c);}return _0x83e295[_0xc170('0x30')]();};}function saveUpdates(_0x279cda,_0x2191bd){return function(_0x499435){if(_0x499435){return _0x499435[_0xc170('0x31')](_0x279cda)['then'](function(_0x3d9655){return _0x3d9655;});}return null;};}function removeEntity(_0x4e4ba7,_0x1a6f68){return function(_0x392dd8){if(_0x392dd8){return _0x392dd8[_0xc170('0x32')]()[_0xc170('0x1c')](function(){_0x4e4ba7[_0xc170('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc6dd7,_0x1f05f1){return function(_0x4d8131){if(!_0x4d8131){_0xcc6dd7[_0xc170('0x33')](0x194);}return _0x4d8131;};}function handleError(_0x42e5aa,_0x299aea){_0x299aea=_0x299aea||0x1f4;return function(_0x107586){logger[_0xc170('0x22')](_0x107586[_0xc170('0x34')]);if(_0x107586[_0xc170('0x35')]){delete _0x107586['name'];}_0x42e5aa[_0xc170('0x27')](_0x299aea)[_0xc170('0x36')](_0x107586);};}exports['index']=function(_0x348fec,_0x3b9ea8){var _0x5c9e8b={},_0x123e36={},_0x48efc5={'count':0x0,'rows':[]};var _0x3aab2b=_['map'](db[_0xc170('0x37')][_0xc170('0x38')],function(_0x572610){return{'name':_0x572610[_0xc170('0x39')],'type':_0x572610['type'][_0xc170('0x3a')]};});_0x123e36[_0xc170('0x3b')]=_[_0xc170('0x3c')](_0x3aab2b,_0xc170('0x35'));_0x123e36['query']=_['keys'](_0x348fec[_0xc170('0x3d')]);_0x123e36[_0xc170('0x3e')]=_[_0xc170('0x3f')](_0x123e36['model'],_0x123e36['query']);_0x5c9e8b[_0xc170('0x40')]=_[_0xc170('0x3f')](_0x123e36[_0xc170('0x3b')],qs[_0xc170('0x41')](_0x348fec[_0xc170('0x3d')][_0xc170('0x41')]));_0x5c9e8b[_0xc170('0x40')]=_0x5c9e8b[_0xc170('0x40')][_0xc170('0x42')]?_0x5c9e8b[_0xc170('0x40')]:_0x123e36[_0xc170('0x3b')];if(!_0x348fec[_0xc170('0x3d')]['hasOwnProperty'](_0xc170('0x43'))){_0x5c9e8b[_0xc170('0x2b')]=qs[_0xc170('0x2b')](_0x348fec[_0xc170('0x3d')][_0xc170('0x2b')]);_0x5c9e8b[_0xc170('0x2a')]=qs[_0xc170('0x2a')](_0x348fec[_0xc170('0x3d')][_0xc170('0x2a')]);}_0x5c9e8b['order']=qs['sort'](_0x348fec[_0xc170('0x3d')]['sort']);_0x5c9e8b['where']=qs['filters'](_[_0xc170('0x44')](_0x348fec['query'],_0x123e36['filters']),_0x3aab2b);if(_0x348fec[_0xc170('0x3d')]['filter']){_0x5c9e8b[_0xc170('0x45')]=_['merge'](_0x5c9e8b[_0xc170('0x45')],{'$or':_[_0xc170('0x3c')](_0x3aab2b,function(_0x31690f){if(_0x31690f[_0xc170('0x46')]!==_0xc170('0x47')){var _0x5d4c70={};_0x5d4c70[_0x31690f['name']]={'$like':'%'+_0x348fec[_0xc170('0x3d')][_0xc170('0x48')]+'%'};return _0x5d4c70;}})});}_0x5c9e8b=_[_0xc170('0x49')]({},_0x5c9e8b,_0x348fec[_0xc170('0x4a')]);var _0xcef5f2={'where':_0x5c9e8b['where']};return db[_0xc170('0x37')]['count'](_0xcef5f2)[_0xc170('0x1c')](function(_0x2b614c){_0x48efc5[_0xc170('0x29')]=_0x2b614c;if(_0x348fec[_0xc170('0x3d')][_0xc170('0x4b')]){_0x5c9e8b['include']=[{'all':!![]}];}return db[_0xc170('0x37')]['findAll'](_0x5c9e8b);})[_0xc170('0x1c')](function(_0xf4ce89){_0x48efc5[_0xc170('0x4c')]=_0xf4ce89;return _0x48efc5;})[_0xc170('0x1c')](respondWithFilteredResult(_0x3b9ea8,_0x5c9e8b))['catch'](handleError(_0x3b9ea8,null));};exports[_0xc170('0x4d')]=function(_0x30ffe0,_0xade96e){var _0x342618={'raw':![],'where':{'id':_0x30ffe0[_0xc170('0x4e')]['id']}},_0x16cc58={};_0x16cc58[_0xc170('0x3b')]=_[_0xc170('0x4f')](db[_0xc170('0x37')]['rawAttributes']);_0x16cc58[_0xc170('0x3d')]=_['keys'](_0x30ffe0[_0xc170('0x3d')]);_0x16cc58[_0xc170('0x3e')]=_['intersection'](_0x16cc58[_0xc170('0x3b')],_0x16cc58[_0xc170('0x3d')]);_0x342618[_0xc170('0x40')]=_[_0xc170('0x3f')](_0x16cc58['model'],qs[_0xc170('0x41')](_0x30ffe0[_0xc170('0x3d')][_0xc170('0x41')]));_0x342618[_0xc170('0x40')]=_0x342618[_0xc170('0x40')][_0xc170('0x42')]?_0x342618[_0xc170('0x40')]:_0x16cc58[_0xc170('0x3b')];if(_0x30ffe0[_0xc170('0x3d')][_0xc170('0x4b')]){_0x342618[_0xc170('0x50')]=[{'all':!![]}];}_0x342618=_[_0xc170('0x49')]({},_0x342618,_0x30ffe0[_0xc170('0x4a')]);return db['Setting'][_0xc170('0x51')](_0x342618)[_0xc170('0x1c')](handleEntityNotFound(_0xade96e,null))['then'](respondWithResult(_0xade96e,null))[_0xc170('0x26')](handleError(_0xade96e,null));};exports[_0xc170('0x31')]=function(_0x3747b8,_0x266a81){if(_0x3747b8[_0xc170('0x52')]['id']){delete _0x3747b8[_0xc170('0x52')]['id'];}return db[_0xc170('0x37')]['find']({'where':{'id':_0x3747b8[_0xc170('0x4e')]['id']}})[_0xc170('0x1c')](handleEntityNotFound(_0x266a81,null))['then'](saveUpdates(_0x3747b8['body'],null))['then'](respondWithResult(_0x266a81,null))[_0xc170('0x26')](handleError(_0x266a81,null));};exports[_0xc170('0x53')]=function(_0x58530d,_0x11aac2,_0x34788f){if(_0x58530d['file']&&_0x58530d['file'][_0xc170('0x54')]){_0x58530d['body'][_0xc170('0x55')]=_0x58530d[_0xc170('0x56')][_0xc170('0x54')];}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x58530d['params']['id']}})[_0xc170('0x1c')](handleEntityNotFound(_0x11aac2,null))[_0xc170('0x1c')](saveUpdates(_0x58530d[_0xc170('0x52')],null))[_0xc170('0x1c')](respondWithResult(_0x11aac2,null))['catch'](handleError(_0x11aac2,null));};exports[_0xc170('0x57')]=function(_0x236096,_0x959de2,_0x5c7d20){if(_0x236096[_0xc170('0x56')]&&_0x236096[_0xc170('0x56')]['filename']){_0x236096[_0xc170('0x52')][_0xc170('0x58')]=_0x236096[_0xc170('0x56')]['filename'];}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x236096[_0xc170('0x4e')]['id']}})['then'](handleEntityNotFound(_0x959de2,null))[_0xc170('0x1c')](saveUpdates(_0x236096[_0xc170('0x52')],null))[_0xc170('0x1c')](respondWithResult(_0x959de2,null))['catch'](handleError(_0x959de2,null));};var utilLicense=require(_0xc170('0x59'));exports[_0xc170('0x5a')]=function(_0x1573af,_0x210442,_0x260c34){var _0x4a5513=_0xc170('0x5b');var _0x2518b0={'custom':![]};return utilLicense[_0xc170('0x5c')]()[_0xc170('0x1c')](function(_0x2ee321){if(_0x2ee321){_0x2518b0=_0x2ee321;}return db['Setting']['find']({'where':{'id':_0x1573af[_0xc170('0x4e')]['id']},'attributes':[_0xc170('0x55'),_0xc170('0x58'),'preferred',_0xc170('0x5d'),_0xc170('0x5e'),_0xc170('0x5f'),_0xc170('0x60'),_0xc170('0x61')],'raw':!![]});})[_0xc170('0x1c')](handleEntityNotFound(_0x210442,null))[_0xc170('0x1c')](function(_0x148fb5){if(_0x148fb5){var _0x5af028=_0x148fb5[_0xc170('0x55')]&&fs[_0xc170('0x62')](path[_0xc170('0x63')](config[_0xc170('0x64')],_0x4a5513,_['toLower'](_0x148fb5[_0xc170('0x55')])))?path[_0xc170('0x63')](config[_0xc170('0x64')],_0x4a5513,_[_0xc170('0x65')](_0x148fb5[_0xc170('0x55')])):path['join'](config[_0xc170('0x64')],_0x4a5513,_[_0xc170('0x65')]('default_logo.svg'));var _0x5b4b37=_0xc170('0x66')+_[_0xc170('0x67')]('logo');if(_0x148fb5[_0x5b4b37]||!_0x2518b0[_0xc170('0x68')]){_0x5af028=path[_0xc170('0x63')](config[_0xc170('0x64')],_0x4a5513,_[_0xc170('0x65')](_0xc170('0x69')));}if(!fs[_0xc170('0x62')](_0x5af028)){throw new db['Sequelize'][(_0xc170('0x6a'))](_[_0xc170('0x67')]('logo')+'\x20not\x20found');}return _0x210442[_0xc170('0x6b')](_0x5af028);}})[_0xc170('0x26')](handleError(_0x210442,null));};var utilLicense=require(_0xc170('0x59'));exports[_0xc170('0x6c')]=function(_0x1d4221,_0x326f21,_0xab86d7){var _0x297ad7=_0xc170('0x5b');var _0x518fec={'custom':![]};return utilLicense[_0xc170('0x5c')]()[_0xc170('0x1c')](function(_0x5ce2a7){if(_0x5ce2a7){_0x518fec=_0x5ce2a7;}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x1d4221[_0xc170('0x4e')]['id']},'attributes':[_0xc170('0x55'),_0xc170('0x58'),_0xc170('0x6d'),_0xc170('0x5d'),_0xc170('0x5e'),_0xc170('0x5f'),_0xc170('0x60'),_0xc170('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x326f21,null))['then'](function(_0x29428b){if(_0x29428b){var _0x557cae=_0x29428b[_0xc170('0x58')]&&fs[_0xc170('0x62')](path[_0xc170('0x63')](config[_0xc170('0x64')],_0x297ad7,_['toLower'](_0x29428b[_0xc170('0x58')])))?path[_0xc170('0x63')](config['root'],_0x297ad7,_[_0xc170('0x65')](_0x29428b[_0xc170('0x58')])):path[_0xc170('0x63')](config[_0xc170('0x64')],_0x297ad7,_[_0xc170('0x65')](_0xc170('0x6e')));var _0x524989=_0xc170('0x66')+_['upperFirst'](_0xc170('0x58'));if(_0x29428b[_0x524989]||!_0x518fec[_0xc170('0x68')]){_0x557cae=path[_0xc170('0x63')](config[_0xc170('0x64')],_0x297ad7,_[_0xc170('0x65')](_0xc170('0x6e')));}if(!fs['existsSync'](_0x557cae)){throw new db[(_0xc170('0x6f'))][(_0xc170('0x6a'))](_[_0xc170('0x67')](_0xc170('0x58'))+_0xc170('0x70'));}return _0x326f21[_0xc170('0x6b')](_0x557cae);}})[_0xc170('0x26')](handleError(_0x326f21,null));};exports[_0xc170('0x71')]=function(_0x38be9b,_0xe63a2e){return db['Setting'][_0xc170('0x51')]({'where':{'id':_0x38be9b[_0xc170('0x4e')]['id']},'attributes':[_0xc170('0x72')]})['then'](respondWithResult(_0xe63a2e,null))[_0xc170('0x26')](handleError(_0xe63a2e,null));};exports[_0xc170('0x73')]=function(_0x502837,_0x1b95d4,_0x42cd3d){if(_0x502837['file']&&_0x502837['file'][_0xc170('0x54')]){_0x502837[_0xc170('0x52')][_0xc170('0x6d')]=_0x502837[_0xc170('0x56')][_0xc170('0x54')];}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x502837[_0xc170('0x4e')]['id']}})[_0xc170('0x1c')](handleEntityNotFound(_0x1b95d4,null))[_0xc170('0x1c')](saveUpdates(_0x502837[_0xc170('0x52')],null))[_0xc170('0x1c')](respondWithResult(_0x1b95d4,null))[_0xc170('0x26')](handleError(_0x1b95d4,null));};var utilLicense=require(_0xc170('0x59'));exports[_0xc170('0x74')]=function(_0x595c6e,_0x34d2de,_0x7756ba){var _0x408bdc='server/files/images/logos';var _0x332124={'custom':![]};return utilLicense[_0xc170('0x5c')]()['then'](function(_0x10f77a){if(_0x10f77a){_0x332124=_0x10f77a;}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x595c6e[_0xc170('0x4e')]['id']},'attributes':[_0xc170('0x55'),_0xc170('0x58'),'preferred',_0xc170('0x5d'),_0xc170('0x5e'),'defaultLoginLogo','defaultPreferred',_0xc170('0x61')],'raw':!![]});})[_0xc170('0x1c')](handleEntityNotFound(_0x34d2de,null))[_0xc170('0x1c')](function(_0xfb3553){if(_0xfb3553){var _0x28b775=_0xfb3553[_0xc170('0x6d')]&&fs[_0xc170('0x62')](path[_0xc170('0x63')](config[_0xc170('0x64')],_0x408bdc,_[_0xc170('0x65')](_0xfb3553[_0xc170('0x6d')])))?path[_0xc170('0x63')](config[_0xc170('0x64')],_0x408bdc,_[_0xc170('0x65')](_0xfb3553['preferred'])):path[_0xc170('0x63')](config[_0xc170('0x64')],_0x408bdc,_[_0xc170('0x65')](_0xc170('0x75')));var _0x5b9ad8='default'+_[_0xc170('0x67')](_0xc170('0x6d'));if(_0xfb3553[_0x5b9ad8]||!_0x332124[_0xc170('0x68')]||!_0x332124[_0xc170('0x6d')]){_0x28b775=path[_0xc170('0x63')](config[_0xc170('0x64')],_0x408bdc,_[_0xc170('0x65')](_0xc170('0x75')));}if(!fs['existsSync'](_0x28b775)){throw new db[(_0xc170('0x6f'))][(_0xc170('0x6a'))](_[_0xc170('0x67')]('preferred')+_0xc170('0x70'));}return _0x34d2de[_0xc170('0x6b')](_0x28b775);}})[_0xc170('0x26')](handleError(_0x34d2de,null));};exports['addFavicon']=function(_0x47650e,_0x143d06,_0x14f6b8){if(_0x47650e['file']&&_0x47650e['file'][_0xc170('0x54')]){_0x47650e[_0xc170('0x52')][_0xc170('0x5d')]=_0x47650e[_0xc170('0x56')][_0xc170('0x54')];}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x47650e[_0xc170('0x4e')]['id']}})[_0xc170('0x1c')](handleEntityNotFound(_0x143d06,null))[_0xc170('0x1c')](saveUpdates(_0x47650e['body'],null))[_0xc170('0x1c')](respondWithResult(_0x143d06,null))[_0xc170('0x26')](handleError(_0x143d06,null));};var utilLicense=require(_0xc170('0x59'));exports[_0xc170('0x76')]=function(_0x43fb5a,_0x137811,_0xc6b318){var _0x288b6d=_0xc170('0x5b');var _0x12d558={'custom':![]};return utilLicense[_0xc170('0x5c')]()[_0xc170('0x1c')](function(_0x2d8172){if(_0x2d8172){_0x12d558=_0x2d8172;}return db[_0xc170('0x37')][_0xc170('0x51')]({'where':{'id':_0x43fb5a['params']['id']},'attributes':[_0xc170('0x55'),_0xc170('0x58'),_0xc170('0x6d'),'favicon',_0xc170('0x5e'),_0xc170('0x5f'),_0xc170('0x60'),_0xc170('0x61')],'raw':!![]});})[_0xc170('0x1c')](handleEntityNotFound(_0x137811,null))[_0xc170('0x1c')](function(_0x1baeeb){if(_0x1baeeb){var _0x3cbac8=_0x1baeeb['favicon']&&fs[_0xc170('0x62')](path[_0xc170('0x63')](config[_0xc170('0x64')],_0x288b6d,_['toLower'](_0x1baeeb[_0xc170('0x5d')])))?path[_0xc170('0x63')](config['root'],_0x288b6d,_['toLower'](_0x1baeeb['favicon'])):path[_0xc170('0x63')](config[_0xc170('0x64')],_0x288b6d,_[_0xc170('0x65')](_0xc170('0x77')));var _0x36ebbd=_0xc170('0x66')+_[_0xc170('0x67')](_0xc170('0x5d'));if(_0x1baeeb[_0x36ebbd]||!_0x12d558[_0xc170('0x68')]){_0x3cbac8=path[_0xc170('0x63')](config['root'],_0x288b6d,_[_0xc170('0x65')]('default_favicon.ico'));}if(!fs['existsSync'](_0x3cbac8)){throw new db[(_0xc170('0x6f'))][(_0xc170('0x6a'))](_[_0xc170('0x67')](_0xc170('0x5d'))+'\x20not\x20found');}return _0x137811['download'](_0x3cbac8);}})[_0xc170('0x26')](handleError(_0x137811,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9ad3c95..10d0236 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 _0x883f=['exports','settings','lodash','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x883f,0x112));var _0xf883=function(_0x5d84cb,_0x1bd87b){_0x5d84cb=_0x5d84cb-0x0;var _0x4542cb=_0x883f[_0x5d84cb];return _0x4542cb;};'use strict';var _=require(_0xf883('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf883('0x1'));var moment=require('moment');var BPromise=require(_0xf883('0x2'));var rp=require(_0xf883('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf883('0x4'));var config=require(_0xf883('0x5'));var attributes=require('./setting.attributes');module[_0xf883('0x6')]=function(_0x29ad82,_0x15abf8){return _0x29ad82['define']('Setting',attributes,{'tableName':_0xf883('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x892d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','lodash'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x892d,0xfc));var _0xd892=function(_0x2abc57,_0x3df197){_0x2abc57=_0x2abc57-0x0;var _0xc585b4=_0x892d[_0x2abc57];return _0xc585b4;};'use strict';var _=require(_0xd892('0x0'));var util=require(_0xd892('0x1'));var logger=require(_0xd892('0x2'))(_0xd892('0x3'));var moment=require(_0xd892('0x4'));var BPromise=require('bluebird');var rp=require(_0xd892('0x5'));var fs=require('fs');var path=require(_0xd892('0x6'));var rimraf=require(_0xd892('0x7'));var config=require(_0xd892('0x8'));var attributes=require(_0xd892('0x9'));module[_0xd892('0xa')]=function(_0x60e4f7,_0x2c2831){return _0x60e4f7['define']('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index b93a9f4..0315dad 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 _0x2d62=['debug','stringify','error','Setting,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','request\x20sent'];(function(_0xd82389,_0x8d144d){var _0x428df3=function(_0x39eec4){while(--_0x39eec4){_0xd82389['push'](_0xd82389['shift']());}};_0x428df3(++_0x8d144d);}(_0x2d62,0x1da));var _0x22d6=function(_0x3f32ff,_0x5a3baa){_0x3f32ff=_0x3f32ff-0x0;var _0x2f438c=_0x2d62[_0x3f32ff];return _0x2f438c;};'use strict';var _=require(_0x22d6('0x0'));var util=require(_0x22d6('0x1'));var moment=require(_0x22d6('0x2'));var BPromise=require(_0x22d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d6('0x4'));var db=require(_0x22d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22d6('0x6'));var config=require('../../config/environment');var jayson=require(_0x22d6('0x7'));var client=jayson[_0x22d6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51e3f6,_0x1791ba,_0x2fdfff){return new BPromise(function(_0x3038ff,_0xdcc8d7){return client[_0x22d6('0x9')](_0x51e3f6,_0x2fdfff)['then'](function(_0x5ee529){logger[_0x22d6('0xa')]('Setting,\x20%s,\x20%s',_0x1791ba,_0x22d6('0xb'));logger[_0x22d6('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x1791ba,'request\x20sent',JSON[_0x22d6('0xd')](_0x5ee529));if(_0x5ee529[_0x22d6('0xe')]){if(_0x5ee529[_0x22d6('0xe')]['code']===0x1f4){logger[_0x22d6('0xe')](_0x22d6('0xf'),_0x1791ba,_0x5ee529[_0x22d6('0xe')][_0x22d6('0x10')]);return _0xdcc8d7(_0x5ee529[_0x22d6('0xe')]['message']);}logger[_0x22d6('0xe')](_0x22d6('0xf'),_0x1791ba,_0x5ee529['error'][_0x22d6('0x10')]);return _0x3038ff(_0x5ee529['error'][_0x22d6('0x10')]);}else{logger[_0x22d6('0xa')](_0x22d6('0xf'),_0x1791ba,_0x22d6('0xb'));_0x3038ff(_0x5ee529['result'][_0x22d6('0x10')]);}})[_0x22d6('0x11')](function(_0x3813e1){logger['error']('Setting,\x20%s,\x20%s',_0x1791ba,_0x3813e1);_0xdcc8d7(_0x3813e1);});});} \ No newline at end of file +var _0x5dc6=['debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s'];(function(_0x103cff,_0xc265f0){var _0x25e340=function(_0x2cc7ae){while(--_0x2cc7ae){_0x103cff['push'](_0x103cff['shift']());}};_0x25e340(++_0xc265f0);}(_0x5dc6,0x184));var _0x65dc=function(_0x687780,_0x50d13a){_0x687780=_0x687780-0x0;var _0x88d4ce=_0x5dc6[_0x687780];return _0x88d4ce;};'use strict';var _=require('lodash');var util=require(_0x65dc('0x0'));var moment=require(_0x65dc('0x1'));var BPromise=require(_0x65dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x65dc('0x4'));var logger=require('../../config/logger')(_0x65dc('0x5'));var config=require('../../config/environment');var jayson=require(_0x65dc('0x6'));var client=jayson[_0x65dc('0x7')][_0x65dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x255b1a,_0x4f32ea,_0x4cf978){return new BPromise(function(_0x59a213,_0x230f96){return client[_0x65dc('0x9')](_0x255b1a,_0x4cf978)['then'](function(_0x23f5ad){logger[_0x65dc('0xa')](_0x65dc('0xb'),_0x4f32ea,'request\x20sent');logger[_0x65dc('0xc')](_0x65dc('0xd'),_0x4f32ea,'request\x20sent',JSON[_0x65dc('0xe')](_0x23f5ad));if(_0x23f5ad[_0x65dc('0xf')]){if(_0x23f5ad[_0x65dc('0xf')][_0x65dc('0x10')]===0x1f4){logger[_0x65dc('0xf')](_0x65dc('0xb'),_0x4f32ea,_0x23f5ad[_0x65dc('0xf')][_0x65dc('0x11')]);return _0x230f96(_0x23f5ad[_0x65dc('0xf')][_0x65dc('0x11')]);}logger['error'](_0x65dc('0xb'),_0x4f32ea,_0x23f5ad[_0x65dc('0xf')]['message']);return _0x59a213(_0x23f5ad[_0x65dc('0xf')][_0x65dc('0x11')]);}else{logger[_0x65dc('0xa')]('Setting,\x20%s,\x20%s',_0x4f32ea,_0x65dc('0x12'));_0x59a213(_0x23f5ad['result'][_0x65dc('0x11')]);}})[_0x65dc('0x13')](function(_0x4791df){logger['error']('Setting,\x20%s,\x20%s',_0x4f32ea,_0x4791df);_0x230f96(_0x4791df);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 00d3b9a..588c1fb 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 _0x13f1=['describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','statusGet','/:id/users','getAgents','addAnswer','/:id/notify','notify','post','/:id/send','send','/:id/status','status','addAgents','put','/:id','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index'];(function(_0x21ee11,_0x172225){var _0xb4c64e=function(_0x157c8f){while(--_0x157c8f){_0x21ee11['push'](_0x21ee11['shift']());}};_0xb4c64e(++_0x172225);}(_0x13f1,0x126));var _0x113f=function(_0x159ca0,_0x214d56){_0x159ca0=_0x159ca0-0x0;var _0x525d28=_0x13f1[_0x159ca0];return _0x525d28;};'use strict';var multer=require(_0x113f('0x0'));var util=require(_0x113f('0x1'));var path=require(_0x113f('0x2'));var timeout=require(_0x113f('0x3'));var express=require(_0x113f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x113f('0x5'));var config=require('../../config/environment');var controller=require(_0x113f('0x6'));router[_0x113f('0x7')]('/',auth[_0x113f('0x8')](),controller[_0x113f('0x9')]);router['get']('/describe',auth[_0x113f('0x8')](),controller[_0x113f('0xa')]);router[_0x113f('0x7')]('/:id',auth[_0x113f('0x8')](),controller[_0x113f('0xb')]);router['get'](_0x113f('0xc'),auth['isAuthenticated'](),controller[_0x113f('0xd')]);router[_0x113f('0x7')](_0x113f('0xe'),auth[_0x113f('0x8')](),controller[_0x113f('0xf')]);router[_0x113f('0x7')](_0x113f('0x10'),auth[_0x113f('0x8')](),controller[_0x113f('0x11')]);router['get'](_0x113f('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x113f('0x7')]('/:id/status',controller[_0x113f('0x13')]);router[_0x113f('0x7')](_0x113f('0x14'),auth[_0x113f('0x8')](),controller[_0x113f('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x113f('0xc'),auth[_0x113f('0x8')](),controller['addDisposition']);router['post'](_0x113f('0xe'),auth[_0x113f('0x8')](),controller[_0x113f('0x16')]);router['post'](_0x113f('0x17'),controller[_0x113f('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x113f('0x19')](_0x113f('0x1a'),auth[_0x113f('0x8')](),controller[_0x113f('0x1b')]);router[_0x113f('0x19')](_0x113f('0x1c'),controller[_0x113f('0x1d')]);router['post']('/:id/users',auth[_0x113f('0x8')](),controller[_0x113f('0x1e')]);router[_0x113f('0x1f')](_0x113f('0x20'),auth[_0x113f('0x8')](),controller[_0x113f('0x21')]);router[_0x113f('0x22')](_0x113f('0x20'),auth[_0x113f('0x8')](),controller[_0x113f('0x23')]);router[_0x113f('0x22')](_0x113f('0xc'),auth[_0x113f('0x8')](),controller[_0x113f('0x24')]);router[_0x113f('0x22')](_0x113f('0xe'),auth[_0x113f('0x8')](),controller['removeAnswers']);router[_0x113f('0x22')]('/:id/users',auth[_0x113f('0x8')](),controller['removeAgents']);module[_0x113f('0x25')]=router; \ No newline at end of file +var _0xb9ad=['removeAgents','util','path','connect-timeout','express','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','update','destroy','removeDispositions','removeAnswers'];(function(_0x5d9ecc,_0x55d21a){var _0x30baea=function(_0x4c4e7f){while(--_0x4c4e7f){_0x5d9ecc['push'](_0x5d9ecc['shift']());}};_0x30baea(++_0x55d21a);}(_0xb9ad,0xe5));var _0xdb9a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb9ad[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0xdb9a('0x0'));var path=require(_0xdb9a('0x1'));var timeout=require(_0xdb9a('0x2'));var express=require(_0xdb9a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdb9a('0x4'));var config=require('../../config/environment');var controller=require(_0xdb9a('0x5'));router[_0xdb9a('0x6')]('/',auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x8')]);router[_0xdb9a('0x6')](_0xdb9a('0x9'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0xa')]);router['get'](_0xdb9a('0xb'),auth['isAuthenticated'](),controller[_0xdb9a('0xc')]);router[_0xdb9a('0x6')](_0xdb9a('0xd'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0xe')]);router[_0xdb9a('0x6')](_0xdb9a('0xf'),auth['isAuthenticated'](),controller[_0xdb9a('0x10')]);router[_0xdb9a('0x6')](_0xdb9a('0x11'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x12')]);router['get'](_0xdb9a('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0xdb9a('0x14'),controller['statusGet']);router[_0xdb9a('0x6')](_0xdb9a('0x15'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x16')]);router[_0xdb9a('0x17')]('/',auth[_0xdb9a('0x7')](),controller['create']);router['post'](_0xdb9a('0xd'),auth['isAuthenticated'](),controller[_0xdb9a('0x18')]);router[_0xdb9a('0x17')](_0xdb9a('0xf'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x19')]);router[_0xdb9a('0x17')](_0xdb9a('0x1a'),controller[_0xdb9a('0x1b')]);router[_0xdb9a('0x17')](_0xdb9a('0x11'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x1c')]);router[_0xdb9a('0x17')](_0xdb9a('0x1d'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x1e')]);router[_0xdb9a('0x17')](_0xdb9a('0x14'),controller[_0xdb9a('0x1f')]);router[_0xdb9a('0x17')](_0xdb9a('0x15'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x20')]);router['put'](_0xdb9a('0xb'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x21')]);router['delete'](_0xdb9a('0xb'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x22')]);router['delete'](_0xdb9a('0xd'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x23')]);router['delete'](_0xdb9a('0xf'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x24')]);router['delete'](_0xdb9a('0x15'),auth[_0xdb9a('0x7')](),controller[_0xdb9a('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index b052019..a68ec7e 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 _0xc1bd=['infobip','intelepeer','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','csc'];(function(_0x1e9a0e,_0x4a00a1){var _0x8a3063=function(_0x509209){while(--_0x509209){_0x1e9a0e['push'](_0x1e9a0e['shift']());}};_0x8a3063(++_0x4a00a1);}(_0xc1bd,0xbb));var _0xdc1b=function(_0x17d095,_0x281068){_0x17d095=_0x17d095-0x0;var _0x3a51e2=_0xc1bd[_0x17d095];return _0x3a51e2;};'use strict';var Sequelize=require(_0xdc1b('0x0'));var rs=require(_0xdc1b('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdc1b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdc1b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc1b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdc1b('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xdc1b('0x3')]},'type':{'type':Sequelize[_0xdc1b('0x4')](_0xdc1b('0x5'),_0xdc1b('0x6'),_0xdc1b('0x7'),_0xdc1b('0x8'),_0xdc1b('0x9'),'clickatell',_0xdc1b('0xa'),_0xdc1b('0xb'),_0xdc1b('0xc'))},'accountSid':{'type':Sequelize[_0xdc1b('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdc1b('0x3')]},'smsMethod':{'type':Sequelize[_0xdc1b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xdc1b('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xdc1b('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xdc1b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdc1b('0xe')],'defaultValue':function(){return _0xdc1b('0xf');}},'notificationSound':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc1b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc1b('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc1b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xdc1b('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc1b('0x10')],'comment':_0xdc1b('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdc1b('0x12'),'set':function(_0x397623){if(!_0x397623)this[_0xdc1b('0x13')](_0xdc1b('0x14'),null);this[_0xdc1b('0x13')](_0xdc1b('0x15'),_0x397623);}}}; \ No newline at end of file +var _0xf7d6=['connectel','clickatell','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','twilio','skebby'];(function(_0x405861,_0x1e6c27){var _0x1b5b2c=function(_0x548e51){while(--_0x548e51){_0x405861['push'](_0x405861['shift']());}};_0x1b5b2c(++_0x1e6c27);}(_0xf7d6,0x93));var _0x6f7d=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xf7d6[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x6f7d('0x0'));var rs=require(_0x6f7d('0x1'));module[_0x6f7d('0x2')]={'name':{'type':Sequelize[_0x6f7d('0x3')],'unique':_0x6f7d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x6f7d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6f7d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6f7d('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6f7d('0x3')]},'type':{'type':Sequelize['ENUM'](_0x6f7d('0x5'),_0x6f7d('0x6'),_0x6f7d('0x7'),'clicksend','plivo',_0x6f7d('0x8'),_0x6f7d('0x9'),_0x6f7d('0xa'),_0x6f7d('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x6f7d('0x3')]},'authToken':{'type':Sequelize[_0x6f7d('0x3')]},'smsMethod':{'type':Sequelize[_0x6f7d('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0x6f7d('0x3')]},'password':{'type':Sequelize[_0x6f7d('0x3')]},'apiKey':{'type':Sequelize[_0x6f7d('0x3')]},'senderString':{'type':Sequelize[_0x6f7d('0x3')]},'deliveryReport':{'type':Sequelize[_0x6f7d('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x6f7d('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6f7d('0xe')],'defaultValue':function(){return _0x6f7d('0xf');}},'notificationSound':{'type':Sequelize[_0x6f7d('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6f7d('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6f7d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6f7d('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6f7d('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6f7d('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6f7d('0x10')],'comment':_0x6f7d('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x6f7d('0xd')],'defaultValue':![],'comment':_0x6f7d('0x12'),'set':function(_0x4c9d0e){if(!_0x4c9d0e)this[_0x6f7d('0x13')](_0x6f7d('0x14'),null);this[_0x6f7d('0x13')](_0x6f7d('0x15'),_0x4c9d0e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 39af70a..5d99743 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x336d7b,_0x14d327){var _0x686e7=function(_0x3f8b2d){while(--_0x3f8b2d){_0x336d7b['push'](_0x336d7b['shift']());}};_0x686e7(++_0x14d327);}(_0x7a54,0x106));var _0x47a5=function(_0x1912da,_0x251b37){_0x1912da=_0x1912da-0x0;var _0x11a519=_0x7a54[_0x1912da];return _0x11a519;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x2da04a,_0x48cfe1){var _0x4ca7d2=function(_0x2b83a8){while(--_0x2b83a8){_0x2da04a['push'](_0x2da04a['shift']());}};_0x4ca7d2(++_0x48cfe1);}(_0x7a54,0x106));var _0x47a5=function(_0x4ff785,_0x444569){_0x4ff785=_0x4ff785-0x0;var _0x32670f=_0x7a54[_0x4ff785];return _0x32670f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ebb0153..ccf2009 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 _0xc277=['update','remove','hasOwnProperty','hook','exports','events','save'];(function(_0x4b8567,_0x5c32f3){var _0x4e168e=function(_0x46a709){while(--_0x46a709){_0x4b8567['push'](_0x4b8567['shift']());}};_0x4e168e(++_0x5c32f3);}(_0xc277,0xd7));var _0x7c27=function(_0x95eeaa,_0x315257){_0x95eeaa=_0x95eeaa-0x0;var _0x529108=_0xc277[_0x95eeaa];return _0x529108;};'use strict';var EventEmitter=require(_0x7c27('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7c27('0x1'),'afterUpdate':_0x7c27('0x2'),'afterDestroy':_0x7c27('0x3')};function emitEvent(_0x4f76a9){return function(_0x12a149,_0x4bd32d,_0x370d83){SmsAccountEvents['emit'](_0x4f76a9+':'+_0x12a149['id'],_0x12a149);SmsAccountEvents['emit'](_0x4f76a9,_0x12a149);_0x370d83(null);};}for(var e in events){if(events[_0x7c27('0x4')](e)){var event=events[e];SmsAccount[_0x7c27('0x5')](e,emitEvent(event));}}module[_0x7c27('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x84d7=['remove','emit','hasOwnProperty','hook','SmsAccount','setMaxListeners','save','update'];(function(_0x16988a,_0x5c5d96){var _0x2e5f23=function(_0x34fd35){while(--_0x34fd35){_0x16988a['push'](_0x16988a['shift']());}};_0x2e5f23(++_0x5c5d96);}(_0x84d7,0x184));var _0x784d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x84d7[_0x1beef3];return _0x5af964;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x784d('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x784d('0x1')](0x0);var events={'afterCreate':_0x784d('0x2'),'afterUpdate':_0x784d('0x3'),'afterDestroy':_0x784d('0x4')};function emitEvent(_0x1d864b){return function(_0x55217d,_0x5df9e2,_0x216140){SmsAccountEvents[_0x784d('0x5')](_0x1d864b+':'+_0x55217d['id'],_0x55217d);SmsAccountEvents[_0x784d('0x5')](_0x1d864b,_0x55217d);_0x216140(null);};}for(var e in events){if(events[_0x784d('0x6')](e)){var event=events[e];SmsAccount[_0x784d('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 7a3cde8..ea8ae08 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x38493e,_0x3f4a61){var _0x4fcdbb=function(_0x2a9808){while(--_0x2a9808){_0x38493e['push'](_0x38493e['shift']());}};_0x4fcdbb(++_0x3f4a61);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x12606a,_0x49b490){var _0x2f524b=function(_0x3cef6f){while(--_0x3cef6f){_0x12606a['push'](_0x12606a['shift']());}};_0x2f524b(++_0x49b490);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 1c204d7..4b1cfb4 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 _0xa249=['http','redis','./smsAccount.socket','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','find','options','raw','where','attributes','include','map','model','then','ShowSmsAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xa249,0x130));var _0x9a24=function(_0xabc97,_0x47be61){_0xabc97=_0xabc97-0x0;var _0x3c0b97=_0xa249[_0xabc97];return _0x3c0b97;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var moment=require(_0x9a24('0x2'));var BPromise=require(_0x9a24('0x3'));var rs=require(_0x9a24('0x4'));var fs=require('fs');var Redis=require(_0x9a24('0x5'));var db=require(_0x9a24('0x6'))['db'];var utils=require(_0x9a24('0x7'));var logger=require(_0x9a24('0x8'))(_0x9a24('0x9'));var config=require(_0x9a24('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a24('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9a24('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a24('0xd'))['register'](socket);function respondWithRpcPromise(_0xa76744,_0x11fa0b,_0x2da87f){return new BPromise(function(_0xdfbb33,_0x2656c7){return client[_0x9a24('0xe')](_0xa76744,_0x2da87f)['then'](function(_0x41ec72){logger['info'](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));logger[_0x9a24('0x11')](_0x9a24('0x12'),_0x11fa0b,_0x9a24('0x10'),JSON['stringify'](_0x41ec72));if(_0x41ec72[_0x9a24('0x13')]){if(_0x41ec72['error'][_0x9a24('0x14')]===0x1f4){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72['error']['message']);return _0x2656c7(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);return _0xdfbb33(_0x41ec72[_0x9a24('0x13')][_0x9a24('0x15')]);}else{logger[_0x9a24('0x16')](_0x9a24('0xf'),_0x11fa0b,_0x9a24('0x10'));_0xdfbb33(_0x41ec72['result'][_0x9a24('0x15')]);}})[_0x9a24('0x17')](function(_0x33ef3a){logger[_0x9a24('0x13')](_0x9a24('0xf'),_0x11fa0b,_0x33ef3a);_0x2656c7(_0x33ef3a);});});}exports['ShowSmsAccount']=function(_0x333c75){var _0x5e6f03=this;return new Promise(function(_0x890979,_0x30e490){return db['SmsAccount'][_0x9a24('0x18')]({'raw':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1a')]===undefined?!![]:![]:!![],'where':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1b')]||null:null,'attributes':_0x333c75[_0x9a24('0x19')]?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1c')]||null:null,'include':_0x333c75['options']?_0x333c75[_0x9a24('0x19')][_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x333c75['options'][_0x9a24('0x1d')],function(_0x3d4ed1){return{'model':db[_0x3d4ed1[_0x9a24('0x1f')]],'as':_0x3d4ed1['as'],'attributes':_0x3d4ed1[_0x9a24('0x1c')],'include':_0x3d4ed1[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x3d4ed1[_0x9a24('0x1d')],function(_0x356b4b){return{'model':db[_0x356b4b[_0x9a24('0x1f')]],'as':_0x356b4b['as'],'attributes':_0x356b4b[_0x9a24('0x1c')],'include':_0x356b4b[_0x9a24('0x1d')]?_[_0x9a24('0x1e')](_0x356b4b['include'],function(_0x1d0013){return{'model':db[_0x1d0013[_0x9a24('0x1f')]],'as':_0x1d0013['as'],'attributes':_0x1d0013[_0x9a24('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9a24('0x20')](function(_0x325c15){logger[_0x9a24('0x16')]('ShowSmsAccount',_0x333c75);logger[_0x9a24('0x11')](_0x9a24('0x21'),_0x333c75,JSON[_0x9a24('0x22')](_0x325c15));_0x890979(_0x325c15);})[_0x9a24('0x17')](function(_0x545844){logger['error'](_0x9a24('0x21'),_0x545844[_0x9a24('0x15')],_0x333c75);_0x30e490(_0x5e6f03[_0x9a24('0x13')](0x1f4,_0x545844[_0x9a24('0x15')]));});});}; \ No newline at end of file +var _0x05d5=['../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','map','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x05d5,0x1e8));var _0x505d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x05d5[_0x47e7cb];return _0x2a8874;};'use strict';var _=require('lodash');var util=require(_0x505d('0x0'));var moment=require(_0x505d('0x1'));var BPromise=require(_0x505d('0x2'));var rs=require(_0x505d('0x3'));var fs=require('fs');var Redis=require(_0x505d('0x4'));var db=require(_0x505d('0x5'))['db'];var utils=require(_0x505d('0x6'));var logger=require(_0x505d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x505d('0x8'));var client=jayson[_0x505d('0x9')][_0x505d('0xa')]({'port':0x232a});config[_0x505d('0xb')]=_[_0x505d('0xc')](config['redis'],{'host':_0x505d('0xd'),'port':0x18eb});var socket=require(_0x505d('0xe'))(new Redis(config[_0x505d('0xb')]));require(_0x505d('0xf'))[_0x505d('0x10')](socket);function respondWithRpcPromise(_0x5421da,_0xaf275c,_0x3f69d8){return new BPromise(function(_0x35f203,_0x5d2454){return client[_0x505d('0x11')](_0x5421da,_0x3f69d8)[_0x505d('0x12')](function(_0x11fcc7){logger[_0x505d('0x13')](_0x505d('0x14'),_0xaf275c,_0x505d('0x15'));logger[_0x505d('0x16')](_0x505d('0x17'),_0xaf275c,_0x505d('0x15'),JSON['stringify'](_0x11fcc7));if(_0x11fcc7[_0x505d('0x18')]){if(_0x11fcc7[_0x505d('0x18')][_0x505d('0x19')]===0x1f4){logger['error'](_0x505d('0x14'),_0xaf275c,_0x11fcc7[_0x505d('0x18')][_0x505d('0x1a')]);return _0x5d2454(_0x11fcc7['error']['message']);}logger[_0x505d('0x18')](_0x505d('0x14'),_0xaf275c,_0x11fcc7[_0x505d('0x18')][_0x505d('0x1a')]);return _0x35f203(_0x11fcc7[_0x505d('0x18')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0xaf275c,_0x505d('0x15'));_0x35f203(_0x11fcc7['result'][_0x505d('0x1a')]);}})[_0x505d('0x1b')](function(_0x32461f){logger[_0x505d('0x18')](_0x505d('0x14'),_0xaf275c,_0x32461f);_0x5d2454(_0x32461f);});});}exports[_0x505d('0x1c')]=function(_0x27fe01){var _0x34ebd9=this;return new Promise(function(_0x1d8cd7,_0x161db6){return db[_0x505d('0x1d')][_0x505d('0x1e')]({'raw':_0x27fe01[_0x505d('0x1f')]?_0x27fe01[_0x505d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x27fe01[_0x505d('0x1f')]?_0x27fe01[_0x505d('0x1f')][_0x505d('0x20')]||null:null,'attributes':_0x27fe01['options']?_0x27fe01['options']['attributes']||null:null,'include':_0x27fe01['options']?_0x27fe01[_0x505d('0x1f')][_0x505d('0x21')]?_['map'](_0x27fe01[_0x505d('0x1f')]['include'],function(_0x4b2e03){return{'model':db[_0x4b2e03[_0x505d('0x22')]],'as':_0x4b2e03['as'],'attributes':_0x4b2e03[_0x505d('0x23')],'include':_0x4b2e03['include']?_[_0x505d('0x24')](_0x4b2e03[_0x505d('0x21')],function(_0x41d30d){return{'model':db[_0x41d30d['model']],'as':_0x41d30d['as'],'attributes':_0x41d30d[_0x505d('0x23')],'include':_0x41d30d[_0x505d('0x21')]?_['map'](_0x41d30d['include'],function(_0x14d238){return{'model':db[_0x14d238[_0x505d('0x22')]],'as':_0x14d238['as'],'attributes':_0x14d238[_0x505d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x505d('0x12')](function(_0x1c443f){logger[_0x505d('0x13')]('ShowSmsAccount',_0x27fe01);logger[_0x505d('0x16')](_0x505d('0x1c'),_0x27fe01,JSON[_0x505d('0x25')](_0x1c443f));_0x1d8cd7(_0x1c443f);})[_0x505d('0x1b')](function(_0x2114b3){logger[_0x505d('0x18')](_0x505d('0x1c'),_0x2114b3[_0x505d('0x1a')],_0x27fe01);_0x161db6(_0x34ebd9[_0x505d('0x18')](0x1f4,_0x2114b3[_0x505d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c401e56..f348186 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 _0x5f00=['./smsAccount.events','remove','emit','register'];(function(_0x500f80,_0x422d7e){var _0x731b33=function(_0x4b821a){while(--_0x4b821a){_0x500f80['push'](_0x500f80['shift']());}};_0x731b33(++_0x422d7e);}(_0x5f00,0x170));var _0x05f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f00[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x05f0('0x0'));var events=['save',_0x05f0('0x1'),'update'];function createListener(_0x294efa,_0x5872eb){return function(_0x43ab86){_0x5872eb[_0x05f0('0x2')](_0x294efa,_0x43ab86);};}function removeListener(_0x3afbeb,_0x26965b){return function(){SmsAccountEvents['removeListener'](_0x3afbeb,_0x26965b);};}exports[_0x05f0('0x3')]=function(_0x4b1e9e){for(var _0x4330b9=0x0,_0xaf4fb4=events['length'];_0x4330b9<_0xaf4fb4;_0x4330b9++){var _0x599056=events[_0x4330b9];var _0x237db9=createListener('smsAccount:'+_0x599056,_0x4b1e9e);SmsAccountEvents['on'](_0x599056,_0x237db9);}}; \ No newline at end of file +var _0x0d64=['save','remove','update','emit','register','length','smsAccount:','./smsAccount.events'];(function(_0x35c063,_0x3a0c79){var _0x469cec=function(_0x15565c){while(--_0x15565c){_0x35c063['push'](_0x35c063['shift']());}};_0x469cec(++_0x3a0c79);}(_0x0d64,0x17f));var _0x40d6=function(_0xe540c0,_0x2d98e5){_0xe540c0=_0xe540c0-0x0;var _0x130549=_0x0d64[_0xe540c0];return _0x130549;};'use strict';var SmsAccountEvents=require(_0x40d6('0x0'));var events=[_0x40d6('0x1'),_0x40d6('0x2'),_0x40d6('0x3')];function createListener(_0xb2183b,_0x19c2a0){return function(_0x3345fe){_0x19c2a0[_0x40d6('0x4')](_0xb2183b,_0x3345fe);};}function removeListener(_0x138b1e,_0x41a587){return function(){SmsAccountEvents['removeListener'](_0x138b1e,_0x41a587);};}exports[_0x40d6('0x5')]=function(_0x39b825){for(var _0x14c0ee=0x0,_0x281dff=events[_0x40d6('0x6')];_0x14c0ee<_0x281dff;_0x14c0ee++){var _0x1b8cec=events[_0x14c0ee];var _0x41fac5=createListener(_0x40d6('0x7')+_0x1b8cec,_0x39b825);SmsAccountEvents['on'](_0x1b8cec,_0x41fac5);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 48d439a..969fba4 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 _0x0e1a=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','update','delete','exports'];(function(_0x5adee8,_0x2dea9d){var _0x4a90f1=function(_0x567afd){while(--_0x567afd){_0x5adee8['push'](_0x5adee8['shift']());}};_0x4a90f1(++_0x2dea9d);}(_0x0e1a,0x121));var _0xa0e1=function(_0x3eabb9,_0x59f0fd){_0x3eabb9=_0x3eabb9-0x0;var _0x1cce0b=_0x0e1a[_0x3eabb9];return _0x1cce0b;};'use strict';var multer=require(_0xa0e1('0x0'));var util=require('util');var path=require(_0xa0e1('0x1'));var timeout=require(_0xa0e1('0x2'));var express=require(_0xa0e1('0x3'));var router=express[_0xa0e1('0x4')]();var auth=require(_0xa0e1('0x5'));var interaction=require(_0xa0e1('0x6'));var config=require(_0xa0e1('0x7'));var controller=require('./smsApplication.controller');router[_0xa0e1('0x8')]('/',auth[_0xa0e1('0x9')](),controller['index']);router[_0xa0e1('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa0e1('0xa')]('/',auth[_0xa0e1('0x9')](),controller[_0xa0e1('0xb')]);router[_0xa0e1('0xc')](_0xa0e1('0xd'),auth[_0xa0e1('0x9')](),controller[_0xa0e1('0xe')]);router[_0xa0e1('0xf')]('/:id',auth[_0xa0e1('0x9')](),controller['destroy']);module[_0xa0e1('0x10')]=router; \ No newline at end of file +var _0xb3a1=['./smsApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xb3a1,0x1bb));var _0x1b3a=function(_0x3744c4,_0x4bdca9){_0x3744c4=_0x3744c4-0x0;var _0x167b7f=_0xb3a1[_0x3744c4];return _0x167b7f;};'use strict';var multer=require('multer');var util=require(_0x1b3a('0x0'));var path=require(_0x1b3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x1b3a('0x2'));var router=express[_0x1b3a('0x3')]();var auth=require(_0x1b3a('0x4'));var interaction=require(_0x1b3a('0x5'));var config=require(_0x1b3a('0x6'));var controller=require(_0x1b3a('0x7'));router[_0x1b3a('0x8')]('/',auth[_0x1b3a('0x9')](),controller[_0x1b3a('0xa')]);router[_0x1b3a('0x8')](_0x1b3a('0xb'),auth['isAuthenticated'](),controller[_0x1b3a('0xc')]);router['post']('/',auth[_0x1b3a('0x9')](),controller['create']);router[_0x1b3a('0xd')](_0x1b3a('0xb'),auth[_0x1b3a('0x9')](),controller[_0x1b3a('0xe')]);router[_0x1b3a('0xf')](_0x1b3a('0xb'),auth[_0x1b3a('0x9')](),controller[_0x1b3a('0x10')]);module[_0x1b3a('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1fc2f87..9570d5d 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 _0x268c=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x25f33c,_0x657c75){var _0x5cc13f=function(_0x2b4a1a){while(--_0x2b4a1a){_0x25f33c['push'](_0x25f33c['shift']());}};_0x5cc13f(++_0x657c75);}(_0x268c,0x103));var _0xc268=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x268c[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0xc268('0x0'));module[_0xc268('0x1')]={'priority':{'type':Sequelize[_0xc268('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc268('0x3')],'allowNull':![],'defaultValue':_0xc268('0x4')},'appdata':{'type':Sequelize[_0xc268('0x5')]()},'description':{'type':Sequelize[_0xc268('0x3')]},'interval':{'type':Sequelize[_0xc268('0x3')],'defaultValue':_0xc268('0x6')}}; \ No newline at end of file +var _0x7918=['exports','STRING','TEXT','*,*,*,*'];(function(_0x3a3d43,_0x59e181){var _0x11b8d7=function(_0x28f9f6){while(--_0x28f9f6){_0x3a3d43['push'](_0x3a3d43['shift']());}};_0x11b8d7(++_0x59e181);}(_0x7918,0x108));var _0x8791=function(_0x32c404,_0x41095d){_0x32c404=_0x32c404-0x0;var _0x82035f=_0x7918[_0x32c404];return _0x82035f;};'use strict';var Sequelize=require('sequelize');module[_0x8791('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8791('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8791('0x2')]()},'description':{'type':Sequelize[_0x8791('0x1')]},'interval':{'type':Sequelize[_0x8791('0x1')],'defaultValue':_0x8791('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 74391e4..86da4a8 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 _0x80ed=['moment','bluebird','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','../../mysqldb','status','json','count','offset','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','rows','params','find','catch','body','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x166ee4,_0x20efa7){var _0x334b5c=function(_0x269d99){while(--_0x269d99){_0x166ee4['push'](_0x166ee4['shift']());}};_0x334b5c(++_0x20efa7);}(_0x80ed,0x11c));var _0xd80e=function(_0x239720,_0x41a165){_0x239720=_0x239720-0x0;var _0xa1a3be=_0x80ed[_0x239720];return _0xa1a3be;};'use strict';var pdf=require(_0xd80e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd80e('0x1'));var zipdir=require(_0xd80e('0x2'));var jsonpatch=require(_0xd80e('0x3'));var rp=require('request-promise');var moment=require(_0xd80e('0x4'));var BPromise=require(_0xd80e('0x5'));var Mustache=require(_0xd80e('0x6'));var util=require(_0xd80e('0x7'));var path=require('path');var sox=require(_0xd80e('0x8'));var csv=require(_0xd80e('0x9'));var ejs=require(_0xd80e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x9'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var db=require(_0xd80e('0x19'))['db'];function respondWithStatusCode(_0x1a9024,_0x118f53){_0x118f53=_0x118f53||0xcc;return function(_0x1d3fcf){if(_0x1d3fcf){return _0x1a9024['sendStatus'](_0x118f53);}return _0x1a9024['status'](_0x118f53)['end']();};}function respondWithResult(_0x57fefb,_0x145766){_0x145766=_0x145766||0xc8;return function(_0x3d233b){if(_0x3d233b){return _0x57fefb[_0xd80e('0x1a')](_0x145766)[_0xd80e('0x1b')](_0x3d233b);}};}function respondWithFilteredResult(_0x449c60,_0x58a17e){return function(_0x595683){if(_0x595683){var _0x2c8c61=_0x595683[_0xd80e('0x1c')],_0x3124e8=_0x58a17e[_0xd80e('0x1d')],_0x3b48ae=_0x58a17e[_0xd80e('0x1d')]+_0x58a17e['limit'],_0x40a4d5;if(_0x3b48ae>=_0x2c8c61){_0x3b48ae=_0x2c8c61;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x449c60[_0xd80e('0x1a')](_0x40a4d5);return _0x449c60[_0xd80e('0x1e')](_0xd80e('0x1f'),_0x3124e8+'-'+_0x3b48ae+'/'+_0x2c8c61)[_0xd80e('0x1b')](_0x595683);}return null;};}function patchUpdates(_0x593af6){return function(_0x39397a){try{jsonpatch[_0xd80e('0x20')](_0x39397a,_0x593af6,!![]);}catch(_0xecfe74){return BPromise['reject'](_0xecfe74);}return _0x39397a[_0xd80e('0x21')]();};}function saveUpdates(_0x2ef8a1,_0x2765ea){return function(_0x147134){if(_0x147134){return _0x147134[_0xd80e('0x22')](_0x2ef8a1)['then'](function(_0x4b6b8a){return _0x4b6b8a;});}return null;};}function removeEntity(_0x35a1bc,_0x3fa159){return function(_0x3b39bf){if(_0x3b39bf){return _0x3b39bf[_0xd80e('0x23')]()[_0xd80e('0x24')](function(){_0x35a1bc[_0xd80e('0x1a')](0xcc)[_0xd80e('0x25')]();});}};}function handleEntityNotFound(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(!_0x57d70){_0x5430b6[_0xd80e('0x26')](0x194);}return _0x57d70;};}function handleError(_0x5b0d6d,_0x635ce0){_0x635ce0=_0x635ce0||0x1f4;return function(_0x19c89c){logger[_0xd80e('0x27')](_0x19c89c['stack']);if(_0x19c89c['name']){delete _0x19c89c['name'];}_0x5b0d6d[_0xd80e('0x1a')](_0x635ce0)['send'](_0x19c89c);};}exports[_0xd80e('0x28')]=function(_0x1044cc,_0x4e8ed9){var _0x24bafb={},_0xe1c04a={},_0x30d6fc={'count':0x0,'rows':[]};var _0x46c05d=_['map'](db[_0xd80e('0x29')][_0xd80e('0x2a')],function(_0x845451){return{'name':_0x845451[_0xd80e('0x2b')],'type':_0x845451[_0xd80e('0x2c')][_0xd80e('0x2d')]};});_0xe1c04a[_0xd80e('0x2e')]=_[_0xd80e('0x2f')](_0x46c05d,'name');_0xe1c04a['query']=_[_0xd80e('0x30')](_0x1044cc[_0xd80e('0x31')]);_0xe1c04a[_0xd80e('0x32')]=_[_0xd80e('0x33')](_0xe1c04a[_0xd80e('0x2e')],_0xe1c04a[_0xd80e('0x31')]);_0x24bafb['attributes']=_['intersection'](_0xe1c04a[_0xd80e('0x2e')],qs[_0xd80e('0x34')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x34')]));_0x24bafb[_0xd80e('0x35')]=_0x24bafb[_0xd80e('0x35')][_0xd80e('0x36')]?_0x24bafb[_0xd80e('0x35')]:_0xe1c04a['model'];if(!_0x1044cc['query'][_0xd80e('0x37')](_0xd80e('0x38'))){_0x24bafb[_0xd80e('0x39')]=qs[_0xd80e('0x39')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x39')]);_0x24bafb[_0xd80e('0x1d')]=qs[_0xd80e('0x1d')](_0x1044cc[_0xd80e('0x31')][_0xd80e('0x1d')]);}_0x24bafb['order']=qs[_0xd80e('0x3a')](_0x1044cc['query'][_0xd80e('0x3a')]);_0x24bafb[_0xd80e('0x3b')]=qs[_0xd80e('0x32')](_[_0xd80e('0x3c')](_0x1044cc['query'],_0xe1c04a[_0xd80e('0x32')]),_0x46c05d);if(_0x1044cc['query'][_0xd80e('0x3d')]){_0x24bafb['where']=_[_0xd80e('0x3e')](_0x24bafb[_0xd80e('0x3b')],{'$or':_['map'](_0x46c05d,function(_0x2d78b2){if(_0x2d78b2[_0xd80e('0x2c')]!==_0xd80e('0x3f')){var _0x490768={};_0x490768[_0x2d78b2[_0xd80e('0x40')]]={'$like':'%'+_0x1044cc[_0xd80e('0x31')][_0xd80e('0x3d')]+'%'};return _0x490768;}})});}_0x24bafb=_[_0xd80e('0x3e')]({},_0x24bafb,_0x1044cc[_0xd80e('0x41')]);var _0x34b8e9={'where':_0x24bafb[_0xd80e('0x3b')]};return db[_0xd80e('0x29')][_0xd80e('0x1c')](_0x34b8e9)['then'](function(_0x51932d){_0x30d6fc['count']=_0x51932d;if(_0x1044cc[_0xd80e('0x31')][_0xd80e('0x42')]){_0x24bafb['include']=[{'all':!![]}];}return db[_0xd80e('0x29')]['findAll'](_0x24bafb);})[_0xd80e('0x24')](function(_0x5ade19){_0x30d6fc[_0xd80e('0x43')]=_0x5ade19;return _0x30d6fc;})[_0xd80e('0x24')](respondWithFilteredResult(_0x4e8ed9,_0x24bafb))['catch'](handleError(_0x4e8ed9,null));};exports['show']=function(_0x44a736,_0x5b8ec8){var _0x439673={'raw':!![],'where':{'id':_0x44a736[_0xd80e('0x44')]['id']}},_0x3e65a7={};_0x3e65a7[_0xd80e('0x2e')]=_[_0xd80e('0x30')](db[_0xd80e('0x29')][_0xd80e('0x2a')]);_0x3e65a7[_0xd80e('0x31')]=_[_0xd80e('0x30')](_0x44a736[_0xd80e('0x31')]);_0x3e65a7[_0xd80e('0x32')]=_[_0xd80e('0x33')](_0x3e65a7[_0xd80e('0x2e')],_0x3e65a7[_0xd80e('0x31')]);_0x439673['attributes']=_['intersection'](_0x3e65a7['model'],qs[_0xd80e('0x34')](_0x44a736['query'][_0xd80e('0x34')]));_0x439673[_0xd80e('0x35')]=_0x439673[_0xd80e('0x35')][_0xd80e('0x36')]?_0x439673[_0xd80e('0x35')]:_0x3e65a7[_0xd80e('0x2e')];if(_0x44a736['query']['includeAll']){_0x439673['include']=[{'all':!![]}];}_0x439673=_[_0xd80e('0x3e')]({},_0x439673,_0x44a736['options']);return db[_0xd80e('0x29')][_0xd80e('0x45')](_0x439673)[_0xd80e('0x24')](handleEntityNotFound(_0x5b8ec8,null))[_0xd80e('0x24')](respondWithResult(_0x5b8ec8,null))[_0xd80e('0x46')](handleError(_0x5b8ec8,null));};exports['create']=function(_0x98628c,_0x4353f2){return db[_0xd80e('0x29')]['create'](_0x98628c[_0xd80e('0x47')],{})[_0xd80e('0x24')](respondWithResult(_0x4353f2,0xc9))[_0xd80e('0x46')](handleError(_0x4353f2,null));};exports['update']=function(_0x8d5cb8,_0x29aaa0){if(_0x8d5cb8[_0xd80e('0x47')]['id']){delete _0x8d5cb8[_0xd80e('0x47')]['id'];}return db[_0xd80e('0x29')][_0xd80e('0x45')]({'where':{'id':_0x8d5cb8['params']['id']}})['then'](handleEntityNotFound(_0x29aaa0,null))[_0xd80e('0x24')](saveUpdates(_0x8d5cb8[_0xd80e('0x47')],null))[_0xd80e('0x24')](respondWithResult(_0x29aaa0,null))['catch'](handleError(_0x29aaa0,null));};exports['destroy']=function(_0x1762a8,_0xff0980){return db[_0xd80e('0x29')][_0xd80e('0x45')]({'where':{'id':_0x1762a8[_0xd80e('0x44')]['id']}})['then'](handleEntityNotFound(_0xff0980,null))[_0xd80e('0x24')](removeEntity(_0xff0980,null))['catch'](handleError(_0xff0980,null));}; \ No newline at end of file +var _0x7916=['merge','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','update','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','name','send','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x7916,0x128));var _0x6791=function(_0xd6784b,_0x48d437){_0xd6784b=_0xd6784b-0x0;var _0x5a33bd=_0x7916[_0xd6784b];return _0x5a33bd;};'use strict';var pdf=require(_0x6791('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6791('0x1'));var zipdir=require(_0x6791('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6791('0x3'));var moment=require(_0x6791('0x4'));var BPromise=require(_0x6791('0x5'));var Mustache=require(_0x6791('0x6'));var util=require('util');var path=require(_0x6791('0x7'));var sox=require('sox');var csv=require(_0x6791('0x8'));var ejs=require(_0x6791('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var db=require(_0x6791('0x15'))['db'];function respondWithStatusCode(_0x1eddd3,_0x61ac73){_0x61ac73=_0x61ac73||0xcc;return function(_0x16c62b){if(_0x16c62b){return _0x1eddd3[_0x6791('0x16')](_0x61ac73);}return _0x1eddd3[_0x6791('0x17')](_0x61ac73)[_0x6791('0x18')]();};}function respondWithResult(_0x5c51f8,_0x4b1719){_0x4b1719=_0x4b1719||0xc8;return function(_0x34b28d){if(_0x34b28d){return _0x5c51f8['status'](_0x4b1719)[_0x6791('0x19')](_0x34b28d);}};}function respondWithFilteredResult(_0x4c32a1,_0x3be9f0){return function(_0x163898){if(_0x163898){var _0x517910=_0x163898[_0x6791('0x1a')],_0x3e4792=_0x3be9f0['offset'],_0x4b80ed=_0x3be9f0[_0x6791('0x1b')]+_0x3be9f0[_0x6791('0x1c')],_0x3856ac;if(_0x4b80ed>=_0x517910){_0x4b80ed=_0x517910;_0x3856ac=0xc8;}else{_0x3856ac=0xce;}_0x4c32a1['status'](_0x3856ac);return _0x4c32a1[_0x6791('0x1d')]('Content-Range',_0x3e4792+'-'+_0x4b80ed+'/'+_0x517910)[_0x6791('0x19')](_0x163898);}return null;};}function patchUpdates(_0x126451){return function(_0x669270){try{jsonpatch[_0x6791('0x1e')](_0x669270,_0x126451,!![]);}catch(_0x25adbc){return BPromise[_0x6791('0x1f')](_0x25adbc);}return _0x669270[_0x6791('0x20')]();};}function saveUpdates(_0x581d51,_0x4a2922){return function(_0x306acb){if(_0x306acb){return _0x306acb['update'](_0x581d51)[_0x6791('0x21')](function(_0x3b57f0){return _0x3b57f0;});}return null;};}function removeEntity(_0x595cf2,_0x17f200){return function(_0x309610){if(_0x309610){return _0x309610[_0x6791('0x22')]()[_0x6791('0x21')](function(){_0x595cf2['status'](0xcc)[_0x6791('0x18')]();});}};}function handleEntityNotFound(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(!_0x53bb44){_0x1b516d['sendStatus'](0x194);}return _0x53bb44;};}function handleError(_0x372dae,_0x502043){_0x502043=_0x502043||0x1f4;return function(_0x1d27c0){logger['error'](_0x1d27c0['stack']);if(_0x1d27c0['name']){delete _0x1d27c0[_0x6791('0x23')];}_0x372dae[_0x6791('0x17')](_0x502043)[_0x6791('0x24')](_0x1d27c0);};}exports['index']=function(_0x3def2e,_0x30cc17){var _0x493a59={},_0x342107={},_0x5cbb79={'count':0x0,'rows':[]};var _0x424b0e=_['map'](db['SmsApplication'][_0x6791('0x25')],function(_0x551718){return{'name':_0x551718[_0x6791('0x26')],'type':_0x551718[_0x6791('0x27')]['key']};});_0x342107[_0x6791('0x28')]=_[_0x6791('0x29')](_0x424b0e,_0x6791('0x23'));_0x342107[_0x6791('0x2a')]=_['keys'](_0x3def2e['query']);_0x342107[_0x6791('0x2b')]=_['intersection'](_0x342107[_0x6791('0x28')],_0x342107[_0x6791('0x2a')]);_0x493a59[_0x6791('0x2c')]=_[_0x6791('0x2d')](_0x342107[_0x6791('0x28')],qs[_0x6791('0x2e')](_0x3def2e[_0x6791('0x2a')][_0x6791('0x2e')]));_0x493a59[_0x6791('0x2c')]=_0x493a59[_0x6791('0x2c')]['length']?_0x493a59[_0x6791('0x2c')]:_0x342107[_0x6791('0x28')];if(!_0x3def2e[_0x6791('0x2a')][_0x6791('0x2f')](_0x6791('0x30'))){_0x493a59[_0x6791('0x1c')]=qs['limit'](_0x3def2e['query']['limit']);_0x493a59[_0x6791('0x1b')]=qs[_0x6791('0x1b')](_0x3def2e[_0x6791('0x2a')]['offset']);}_0x493a59['order']=qs[_0x6791('0x31')](_0x3def2e[_0x6791('0x2a')][_0x6791('0x31')]);_0x493a59[_0x6791('0x32')]=qs['filters'](_[_0x6791('0x33')](_0x3def2e[_0x6791('0x2a')],_0x342107[_0x6791('0x2b')]),_0x424b0e);if(_0x3def2e['query'][_0x6791('0x34')]){_0x493a59['where']=_['merge'](_0x493a59[_0x6791('0x32')],{'$or':_[_0x6791('0x29')](_0x424b0e,function(_0x530b13){if(_0x530b13[_0x6791('0x27')]!==_0x6791('0x35')){var _0x407882={};_0x407882[_0x530b13[_0x6791('0x23')]]={'$like':'%'+_0x3def2e[_0x6791('0x2a')]['filter']+'%'};return _0x407882;}})});}_0x493a59=_[_0x6791('0x36')]({},_0x493a59,_0x3def2e[_0x6791('0x37')]);var _0x2d0dd8={'where':_0x493a59['where']};return db[_0x6791('0x38')][_0x6791('0x1a')](_0x2d0dd8)[_0x6791('0x21')](function(_0x577006){_0x5cbb79[_0x6791('0x1a')]=_0x577006;if(_0x3def2e[_0x6791('0x2a')][_0x6791('0x39')]){_0x493a59[_0x6791('0x3a')]=[{'all':!![]}];}return db['SmsApplication'][_0x6791('0x3b')](_0x493a59);})[_0x6791('0x21')](function(_0x3e95b6){_0x5cbb79[_0x6791('0x3c')]=_0x3e95b6;return _0x5cbb79;})[_0x6791('0x21')](respondWithFilteredResult(_0x30cc17,_0x493a59))[_0x6791('0x3d')](handleError(_0x30cc17,null));};exports[_0x6791('0x3e')]=function(_0xae0e07,_0x46c244){var _0x4e4004={'raw':!![],'where':{'id':_0xae0e07[_0x6791('0x3f')]['id']}},_0x52c03a={};_0x52c03a[_0x6791('0x28')]=_['keys'](db[_0x6791('0x38')][_0x6791('0x25')]);_0x52c03a[_0x6791('0x2a')]=_[_0x6791('0x40')](_0xae0e07[_0x6791('0x2a')]);_0x52c03a[_0x6791('0x2b')]=_[_0x6791('0x2d')](_0x52c03a['model'],_0x52c03a[_0x6791('0x2a')]);_0x4e4004['attributes']=_[_0x6791('0x2d')](_0x52c03a[_0x6791('0x28')],qs[_0x6791('0x2e')](_0xae0e07[_0x6791('0x2a')]['fields']));_0x4e4004[_0x6791('0x2c')]=_0x4e4004[_0x6791('0x2c')][_0x6791('0x41')]?_0x4e4004[_0x6791('0x2c')]:_0x52c03a[_0x6791('0x28')];if(_0xae0e07[_0x6791('0x2a')][_0x6791('0x39')]){_0x4e4004[_0x6791('0x3a')]=[{'all':!![]}];}_0x4e4004=_['merge']({},_0x4e4004,_0xae0e07[_0x6791('0x37')]);return db[_0x6791('0x38')][_0x6791('0x42')](_0x4e4004)[_0x6791('0x21')](handleEntityNotFound(_0x46c244,null))['then'](respondWithResult(_0x46c244,null))[_0x6791('0x3d')](handleError(_0x46c244,null));};exports[_0x6791('0x43')]=function(_0x540ebe,_0x1ac964){return db['SmsApplication'][_0x6791('0x43')](_0x540ebe[_0x6791('0x44')],{})[_0x6791('0x21')](respondWithResult(_0x1ac964,0xc9))[_0x6791('0x3d')](handleError(_0x1ac964,null));};exports[_0x6791('0x45')]=function(_0xb2a2,_0x4163f5){if(_0xb2a2[_0x6791('0x44')]['id']){delete _0xb2a2[_0x6791('0x44')]['id'];}return db['SmsApplication'][_0x6791('0x42')]({'where':{'id':_0xb2a2['params']['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x4163f5,null))[_0x6791('0x21')](saveUpdates(_0xb2a2[_0x6791('0x44')],null))[_0x6791('0x21')](respondWithResult(_0x4163f5,null))[_0x6791('0x3d')](handleError(_0x4163f5,null));};exports['destroy']=function(_0x2bc08d,_0x35e087){return db[_0x6791('0x38')][_0x6791('0x42')]({'where':{'id':_0x2bc08d[_0x6791('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35e087,null))[_0x6791('0x21')](removeEntity(_0x35e087,null))[_0x6791('0x3d')](handleError(_0x35e087,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 91d5850..499707c 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 _0xfe1f=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports'];(function(_0x41bee3,_0x2315fb){var _0x2596ac=function(_0x82ba4c){while(--_0x82ba4c){_0x41bee3['push'](_0x41bee3['shift']());}};_0x2596ac(++_0x2315fb);}(_0xfe1f,0xc8));var _0xffe1=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0xfe1f[_0x10acb2];return _0x186379;};'use strict';var _=require(_0xffe1('0x0'));var util=require(_0xffe1('0x1'));var logger=require(_0xffe1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xffe1('0x3'));var rp=require(_0xffe1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xffe1('0x5'));var attributes=require('./smsApplication.attributes');module[_0xffe1('0x6')]=function(_0x996adf,_0x5058a9){return _0x996adf['define']('SmsApplication',attributes,{'tableName':_0xffe1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffe1('0x8')});}; \ No newline at end of file +var _0xf1b6=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4_unicode_ci'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0xf1b6,0x150));var _0x6f1b=function(_0x57b5cd,_0x450727){_0x57b5cd=_0x57b5cd-0x0;var _0x752dd6=_0xf1b6[_0x57b5cd];return _0x752dd6;};'use strict';var _=require(_0x6f1b('0x0'));var util=require('util');var logger=require(_0x6f1b('0x1'))('api');var moment=require(_0x6f1b('0x2'));var BPromise=require(_0x6f1b('0x3'));var rp=require(_0x6f1b('0x4'));var fs=require('fs');var path=require(_0x6f1b('0x5'));var rimraf=require('rimraf');var config=require(_0x6f1b('0x6'));var attributes=require(_0x6f1b('0x7'));module[_0x6f1b('0x8')]=function(_0x28186e,_0x11fdb9){return _0x28186e[_0x6f1b('0x9')](_0x6f1b('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6f1b('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 29427d4..d7f8c68 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 _0x1c9a=['code','SmsApplication,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0xc80b23,_0x125dce){var _0x437d2d=function(_0x4a7c56){while(--_0x4a7c56){_0xc80b23['push'](_0xc80b23['shift']());}};_0x437d2d(++_0x125dce);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x548b50,_0x9d1112){_0x548b50=_0x548b50-0x0;var _0x47ffd0=_0x1c9a[_0x548b50];return _0x47ffd0;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var moment=require('moment');var BPromise=require(_0xa1c9('0x2'));var rs=require(_0xa1c9('0x3'));var fs=require('fs');var Redis=require(_0xa1c9('0x4'));var db=require(_0xa1c9('0x5'))['db'];var utils=require(_0xa1c9('0x6'));var logger=require('../../config/logger')(_0xa1c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x8'));var client=jayson[_0xa1c9('0x9')][_0xa1c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0c89,_0x1a0364,_0x46b19a){return new BPromise(function(_0x3b1a2c,_0xc8bc5a){return client[_0xa1c9('0xb')](_0x2b0c89,_0x46b19a)[_0xa1c9('0xc')](function(_0x2fcbcd){logger[_0xa1c9('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1a0364,'request\x20sent');logger[_0xa1c9('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1a0364,_0xa1c9('0xf'),JSON[_0xa1c9('0x10')](_0x2fcbcd));if(_0x2fcbcd[_0xa1c9('0x11')]){if(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0xc8bc5a(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0x3b1a2c(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xd')](_0xa1c9('0x13'),_0x1a0364,_0xa1c9('0xf'));_0x3b1a2c(_0x2fcbcd['result'][_0xa1c9('0x14')]);}})['catch'](function(_0x12d989){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x12d989);_0xc8bc5a(_0x12d989);});});} \ No newline at end of file +var _0x9305=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','SmsApplication,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x9305,0x1e2));var _0x5930=function(_0xcf95b4,_0x24baf1){_0xcf95b4=_0xcf95b4-0x0;var _0x20d28b=_0x9305[_0xcf95b4];return _0x20d28b;};'use strict';var _=require(_0x5930('0x0'));var util=require(_0x5930('0x1'));var moment=require(_0x5930('0x2'));var BPromise=require(_0x5930('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5930('0x4'));var db=require(_0x5930('0x5'))['db'];var utils=require(_0x5930('0x6'));var logger=require(_0x5930('0x7'))('rpc');var config=require(_0x5930('0x8'));var jayson=require(_0x5930('0x9'));var client=jayson[_0x5930('0xa')][_0x5930('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b9cdf,_0x513187,_0x2a3d8c){return new BPromise(function(_0x80c566,_0x7acada){return client['request'](_0x4b9cdf,_0x2a3d8c)[_0x5930('0xc')](function(_0x56f24d){logger[_0x5930('0xd')]('SmsApplication,\x20%s,\x20%s',_0x513187,_0x5930('0xe'));logger[_0x5930('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x513187,_0x5930('0xe'),JSON[_0x5930('0x10')](_0x56f24d));if(_0x56f24d['error']){if(_0x56f24d['error']['code']===0x1f4){logger['error'](_0x5930('0x11'),_0x513187,_0x56f24d[_0x5930('0x12')]['message']);return _0x7acada(_0x56f24d[_0x5930('0x12')][_0x5930('0x13')]);}logger['error'](_0x5930('0x11'),_0x513187,_0x56f24d[_0x5930('0x12')][_0x5930('0x13')]);return _0x80c566(_0x56f24d[_0x5930('0x12')]['message']);}else{logger['info'](_0x5930('0x11'),_0x513187,_0x5930('0xe'));_0x80c566(_0x56f24d[_0x5930('0x14')]['message']);}})[_0x5930('0x15')](function(_0x1d3f69){logger['error'](_0x5930('0x11'),_0x513187,_0x1d3f69);_0x7acada(_0x1d3f69);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 40d9736..726a8fc 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 _0x6197=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','removeTags','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x347844,_0x4377d4){var _0x201da2=function(_0x52da25){while(--_0x52da25){_0x347844['push'](_0x347844['shift']());}};_0x201da2(++_0x4377d4);}(_0x6197,0x142));var _0x7619=function(_0x3a60e9,_0x138ad2){_0x3a60e9=_0x3a60e9-0x0;var _0x1bde14=_0x6197[_0x3a60e9];return _0x1bde14;};'use strict';var multer=require(_0x7619('0x0'));var util=require('util');var path=require(_0x7619('0x1'));var timeout=require('connect-timeout');var express=require(_0x7619('0x2'));var router=express[_0x7619('0x3')]();var auth=require(_0x7619('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7619('0x5'));var controller=require(_0x7619('0x6'));router[_0x7619('0x7')]('/',auth[_0x7619('0x8')](),controller[_0x7619('0x9')]);router[_0x7619('0x7')](_0x7619('0xa'),auth[_0x7619('0x8')](),controller[_0x7619('0xb')]);router[_0x7619('0x7')](_0x7619('0xc'),auth[_0x7619('0x8')](),controller[_0x7619('0xd')]);router[_0x7619('0x7')](_0x7619('0xe'),auth['isAuthenticated'](),controller[_0x7619('0xf')]);router[_0x7619('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x7619('0x10')]);router[_0x7619('0x11')]('/',auth['isAuthenticated'](),controller[_0x7619('0x12')]);router[_0x7619('0x11')](_0x7619('0xe'),auth[_0x7619('0x8')](),controller[_0x7619('0x13')]);router['post'](_0x7619('0x14'),auth[_0x7619('0x8')](),interaction['tracked'](_0x7619('0x15'),_0x7619('0x16')),controller['addTags']);router['put'](_0x7619('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x7619('0x15'),_0x7619('0x17')),controller[_0x7619('0x18')]);router[_0x7619('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x7619('0x1a')](_0x7619('0x15'),_0x7619('0x1b')),controller['destroy']);router['delete'](_0x7619('0x14'),auth[_0x7619('0x8')](),controller[_0x7619('0x1c')]);module[_0x7619('0x1d')]=router; \ No newline at end of file +var _0xf0f4=['removeTags','exports','util','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','/:id','smsinteraction:destroy','destroy','delete'];(function(_0xbcea1,_0x469f9f){var _0x17fb47=function(_0x48f5e7){while(--_0x48f5e7){_0xbcea1['push'](_0xbcea1['shift']());}};_0x17fb47(++_0x469f9f);}(_0xf0f4,0x182));var _0x4f0f=function(_0x2b2c3f,_0x31bda9){_0x2b2c3f=_0x2b2c3f-0x0;var _0x1a75cd=_0xf0f4[_0x2b2c3f];return _0x1a75cd;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f0f('0x3'));var config=require(_0x4f0f('0x4'));var controller=require(_0x4f0f('0x5'));router[_0x4f0f('0x6')]('/',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x8')]);router[_0x4f0f('0x6')]('/describe',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x9')]);router[_0x4f0f('0x6')]('/:id',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xa')]);router[_0x4f0f('0x6')](_0x4f0f('0xb'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xc')]);router[_0x4f0f('0x6')](_0x4f0f('0xd'),auth['isAuthenticated'](),controller[_0x4f0f('0xe')]);router[_0x4f0f('0xf')]('/',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x10')]);router[_0x4f0f('0xf')](_0x4f0f('0xb'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x11')]);router[_0x4f0f('0xf')](_0x4f0f('0x12'),auth[_0x4f0f('0x7')](),interaction['tracked'](_0x4f0f('0x13'),_0x4f0f('0x14')),controller[_0x4f0f('0x15')]);router[_0x4f0f('0x16')]('/:id',auth[_0x4f0f('0x7')](),interaction[_0x4f0f('0x17')](_0x4f0f('0x13'),_0x4f0f('0x18')),controller[_0x4f0f('0x19')]);router['delete'](_0x4f0f('0x1a'),auth[_0x4f0f('0x7')](),interaction[_0x4f0f('0x17')]('sms',_0x4f0f('0x1b')),controller[_0x4f0f('0x1c')]);router[_0x4f0f('0x1d')]('/:id/tags',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x1e')]);module[_0x4f0f('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 cfc30b1..21c6c00 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 _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x41045b,_0x9e7a6e){var _0x3224c1=function(_0x5b1fd1){while(--_0x5b1fd1){_0x41045b['push'](_0x41045b['shift']());}};_0x3224c1(++_0x9e7a6e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d5e54,_0x5115e6){_0x1d5e54=_0x1d5e54-0x0;var _0x420d64=_0xb10b[_0x1d5e54];return _0x420d64;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1b7be7e..a7394a4 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 _0xb903=['expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','count','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','params','rawAttributes','include','options','create','destroy','describe','SmsMessage','addMessage','ids','omit','findOne','$gte','format','includeAll','findAll','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','Messages','secret','SmsAccount','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','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','direction','out','System','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.SmsInteractionId','from','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','tools_tags','t.id\x20=\x20it.TagId'];(function(_0x22f6a7,_0xbadff8){var _0x4b5c2b=function(_0x90611e){while(--_0x90611e){_0x22f6a7['push'](_0x22f6a7['shift']());}};_0x4b5c2b(++_0xbadff8);}(_0xb903,0x185));var _0x3b90=function(_0x428d12,_0x130872){_0x428d12=_0x428d12-0x0;var _0x42f516=_0xb903[_0x428d12];return _0x42f516;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0x10'));var logger=require(_0x3b90('0x11'))('api');var utils=require(_0x3b90('0x12'));var config=require(_0x3b90('0x13'));var db=require('../../mysqldb')['db'];config[_0x3b90('0x14')]=_[_0x3b90('0x15')](config[_0x3b90('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3b90('0x14')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3a0a55,_0x2c72fb){_0x2c72fb=_0x2c72fb||0xcc;return function(_0x4824f9){if(_0x4824f9){return _0x3a0a55['sendStatus'](_0x2c72fb);}return _0x3a0a55[_0x3b90('0x16')](_0x2c72fb)[_0x3b90('0x17')]();};}function respondWithResult(_0x381a9e,_0x1af265){_0x1af265=_0x1af265||0xc8;return function(_0x1efe01){if(_0x1efe01){return _0x381a9e['status'](_0x1af265)['json'](_0x1efe01);}};}function respondWithFilteredResult(_0xd83280,_0x5420dc){return function(_0x4e9120){if(_0x4e9120){var _0x269488=_0x4e9120['count'],_0x3cf281=_0x5420dc[_0x3b90('0x18')],_0x11ad7d=_0x5420dc['offset']+_0x5420dc[_0x3b90('0x19')],_0x131f3f;if(_0x11ad7d>=_0x269488){_0x11ad7d=_0x269488;_0x131f3f=0xc8;}else{_0x131f3f=0xce;}_0xd83280[_0x3b90('0x16')](_0x131f3f);return _0xd83280['set'](_0x3b90('0x1a'),_0x3cf281+'-'+_0x11ad7d+'/'+_0x269488)[_0x3b90('0x1b')](_0x4e9120);}return null;};}function patchUpdates(_0x3642c0){return function(_0x3ce411){try{jsonpatch[_0x3b90('0x1c')](_0x3ce411,_0x3642c0,!![]);}catch(_0x43deca){return BPromise[_0x3b90('0x1d')](_0x43deca);}return _0x3ce411[_0x3b90('0x1e')]();};}function saveUpdates(_0xa98414,_0x3e5bb8){return function(_0x4e2175){if(_0x4e2175){return _0x4e2175[_0x3b90('0x1f')](_0xa98414)[_0x3b90('0x20')](function(_0x175b42){return _0x175b42;});}return null;};}function removeEntity(_0x7faee,_0x1227ed){return function(_0x93b8e7){if(_0x93b8e7){return _0x93b8e7['destroy']()['then'](function(){_0x7faee[_0x3b90('0x16')](0xcc)[_0x3b90('0x17')]();});}};}function handleEntityNotFound(_0x103324,_0x2ffa1a){return function(_0x583523){if(!_0x583523){_0x103324[_0x3b90('0x21')](0x194);}return _0x583523;};}function handleError(_0x2936d7,_0x1787d1){_0x1787d1=_0x1787d1||0x1f4;return function(_0x4caead){logger[_0x3b90('0x22')](_0x4caead[_0x3b90('0x23')]);if(_0x4caead[_0x3b90('0x24')]){delete _0x4caead[_0x3b90('0x24')];}_0x2936d7[_0x3b90('0x16')](_0x1787d1)[_0x3b90('0x25')](_0x4caead);};}function getInteractionUsers(_0x4b4d33,_0x1a839d){return new BPromise(function(_0x595ac1,_0xaf453c){try{if(_0x1a839d[_0x4b4d33['id']]){_0x4b4d33[_0x3b90('0x26')]=_[_0x3b90('0x27')](_0x1a839d[_0x4b4d33['id']],function(_0x38eed0){return{'id':_0x38eed0['id'],'fullname':_0x38eed0[_0x3b90('0x28')]};});}}catch(_0x6704f){_0xaf453c(_0x6704f);}_0x595ac1(_0x4b4d33);});}function getInteractionTags(_0x290283,_0x2430ec){return new BPromise(function(_0x500ceb,_0x4d1f31){try{if(_0x290283[_0x3b90('0x29')]){_0x290283[_0x3b90('0x2a')]=[];_0x290283[_0x3b90('0x29')][_0x3b90('0x2b')](',')['forEach'](function(_0x543458){_0x290283[_0x3b90('0x2a')][_0x3b90('0x2c')](_0x2430ec[_0x543458]);});}delete _0x290283[_0x3b90('0x29')];}catch(_0x4f3ab5){_0x4d1f31(_0x4f3ab5);}_0x500ceb(_0x290283);});}function updateSmsInteraction(_0x41bd39,_0x4ca40e,_0x49b4d2){return new BPromise(function(_0x208f3e,_0x3fbc03){return getInteractionUsers(_0x41bd39,_0x49b4d2)['then'](function(_0x3e7c71){return getInteractionTags(_0x3e7c71,_0x4ca40e);})[_0x3b90('0x20')](function(_0x3e30b8){_0x208f3e(_0x3e30b8);})['catch'](function(_0x47cd8f){_0x3fbc03(_0x47cd8f);});});}exports[_0x3b90('0x2d')]=function(_0x143698,_0x64a5e){var _0x401dc5={},_0x5dacea={},_0x5a97fe={'count':0x0,'rows':[]};var _0x25ff34=_[_0x3b90('0x27')](db['SmsInteraction']['rawAttributes'],function(_0x201712){return{'name':_0x201712[_0x3b90('0x2e')],'type':_0x201712[_0x3b90('0x2f')][_0x3b90('0x30')]};});_0x5dacea['model']=_[_0x3b90('0x27')](_0x25ff34,'name');_0x5dacea[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x143698[_0x3b90('0x31')]);_0x5dacea[_0x3b90('0x33')]=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],_0x5dacea[_0x3b90('0x31')]);_0x401dc5['attributes']=_[_0x3b90('0x34')](_0x5dacea[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]));_0x401dc5[_0x3b90('0x37')]=_0x401dc5[_0x3b90('0x37')][_0x3b90('0x38')]?_0x401dc5[_0x3b90('0x37')]:_0x5dacea['model'];if(!_0x143698[_0x3b90('0x31')][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x401dc5[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x143698[_0x3b90('0x31')][_0x3b90('0x19')]);_0x401dc5[_0x3b90('0x18')]=qs[_0x3b90('0x18')](_0x143698[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x401dc5[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x143698[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x401dc5[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x143698[_0x3b90('0x31')],_0x5dacea[_0x3b90('0x33')]),_0x25ff34);var _0x11698a=[];var _0x4d1157=squel[_0x3b90('0x3f')]()[_0x3b90('0x40')]('id')[_0x3b90('0x40')](_0x3b90('0x24'))['field'](_0x3b90('0x41'))['from']('tools_tags');var _0x283419=squel[_0x3b90('0x3f')]()['field'](_0x3b90('0x42'))[_0x3b90('0x40')](_0x3b90('0x43'))[_0x3b90('0x40')](_0x3b90('0x44'))[_0x3b90('0x45')](_0x3b90('0x46'),'ui')[_0x3b90('0x47')](_0x3b90('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x3f71b0=squel[_0x3b90('0x3f')]()['from'](_0x3b90('0x49'),'i')[_0x3b90('0x47')](_0x3b90('0x4a'),'c',_0x3b90('0x4b'))[_0x3b90('0x47')]('users','o','o.id\x20=\x20i.UserId')[_0x3b90('0x47')]('sms_accounts','a',_0x3b90('0x4c'))[_0x3b90('0x47')](_0x3b90('0x4d'),'me',_0x3b90('0x4e'))[_0x3b90('0x47')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x3b90('0x47')](_0x3b90('0x4f'),'t',_0x3b90('0x50'));var _0x5d7333=squel[_0x3b90('0x51')]();var _0x291279=[];var _0x18d59b=squel[_0x3b90('0x51')]();var _0x41e951;if(_0x143698[_0x3b90('0x31')][_0x3b90('0x52')]){_0x41e951=as[_0x3b90('0x53')](_0x143698[_0x3b90('0x31')]['search']);var _0xcc2f56=_0x41e951[_0x3b90('0x54')];for(var _0x2b5b6f=0x0;_0x2b5b6f<_0x41e951['conditions'][_0x3b90('0x38')];_0x2b5b6f++){var _0x4e9e75=_0x41e951[_0x3b90('0x55')][_0x2b5b6f];var _0x3fc270='i';var _0x98aeaf=_['find'](_0x25ff34,[_0x3b90('0x24'),_0x4e9e75[_0x3b90('0x40')]]);if(!_0x98aeaf){switch(_0x4e9e75['field']){case'unreadMessages':if(_0x4e9e75[_0x3b90('0x56')]==0x1){_0x3f71b0[_0x3b90('0x57')]('`'+_0x4e9e75[_0x3b90('0x40')]+_0x3b90('0x58'));}else{_0x3f71b0['having']('`'+_0x4e9e75['field']+_0x3b90('0x59'));}break;case _0x3b90('0x5a'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){if(_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')]('\x20')[_0x3b90('0x38')]>0x1){_0x5d7333[_0xcc2f56](_0x3b90('0x5d'),qs[_0x3b90('0x5e')](_0x4e9e75['value']),null);}else{var _0x415a5d='%'+_0x4e9e75[_0x3b90('0x56')]+'%';_0x5d7333[_0xcc2f56]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x415a5d,_0x415a5d,_0x415a5d);}}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,[_0x3b90('0x24'),'ContactId']);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x60');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7['value'][_0x3b90('0x17')]);}break;case _0x3b90('0x64'):var _0x32a179=_0x4e9e75[_0x3b90('0x56')][_0x3b90('0x2b')](',')[_0x3b90('0x27')](function(_0x3ada12){return Number(_0x3ada12);});_0x32a179[_0x3b90('0x65')](function(_0x28ec05){_0x18d59b['or'](_0x3b90('0x66'),'%,'+_0x28ec05+',%');});_0x291279=_[_0x3b90('0x67')](_0x291279,_0x32a179);break;case _0x3b90('0x68'):if(_0x4e9e75[_0x3b90('0x5b')]===_0x3b90('0x5c')){_0x5d7333[_0xcc2f56](_0x3b90('0x69'),'%'+_0x4e9e75['value']+'%',null);}else{_0x98aeaf=_[_0x3b90('0x5f')](_0x25ff34,['name',_0x3b90('0x6a')]);_0x4e9e75[_0x3b90('0x40')]=_0x3b90('0x6a');_0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}break;case _0x3b90('0x6b'):_0x536da7=as[_0x3b90('0x61')]('me',null,_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7['value'][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);break;}}else{var _0x536da7=as[_0x3b90('0x61')](_0x3fc270,_0x98aeaf[_0x3b90('0x2f')],_0x4e9e75);_0x5d7333[_0xcc2f56](_0x536da7[_0x3b90('0x62')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x63')],_0x536da7[_0x3b90('0x56')][_0x3b90('0x17')]);}}}else{var _0x3e5bf7=_(_0x143698[_0x3b90('0x31')])['keys']()[_0x3b90('0x27')](function(_0x4a60f3){return _['some'](_0x25ff34,[_0x3b90('0x24'),_0x4a60f3])?_0x4a60f3:undefined;})[_0x3b90('0x6c')]()['value']();if(!_[_0x3b90('0x6d')](_0x3e5bf7)){_0x3e5bf7[_0x3b90('0x65')](function(_0x287be4){if(_0x287be4===_0x3b90('0x6e')){_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x6f'),[][_0x3b90('0x70')](_0x143698['query'][_0x287be4]));}else if(_0x287be4==='createdAt'){var _0x3e5532=JSON['parse'](_0x143698[_0x3b90('0x31')][_0x287be4])['$gte'];var _0x1a6d33=JSON['parse'](_0x143698['query'][_0x287be4])['$lte'];_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x71'),_0x3e5532,_0x1a6d33);}else{if(_0x143698[_0x3b90('0x31')][_0x287be4]===_0x3b90('0x72')){_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+_0x3b90('0x73'));}else{_0x3f71b0[_0x3b90('0x3d')]('i.'+_0x287be4+'\x20=\x20?',_0x143698['query'][_0x287be4]);}}});}if(_0x143698['query'][_0x3b90('0x74')]){if(_0x143698[_0x3b90('0x31')]['read']==0x1){_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x75'));}else{_0x3f71b0[_0x3b90('0x57')](_0x3b90('0x76'));}}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x77')]){_0x291279=_[_0x3b90('0x78')](_0x143698[_0x3b90('0x31')][_0x3b90('0x77')])?_0x143698['query'][_0x3b90('0x77')]:new Array(_0x143698['query'][_0x3b90('0x77')]);_0x291279[_0x3b90('0x65')](function(_0x4b2c0f){_0x18d59b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b2c0f+',%');});}if(_0x143698[_0x3b90('0x31')][_0x3b90('0x79')]){var _0x3f0f85=_0x143698[_0x3b90('0x31')][_0x3b90('0x79')][_0x3b90('0x7a')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x3b90('0x7b'));if(qs[_0x3b90('0x7c')](_0x3f0f85)){_0x5d7333['or'](_0x3b90('0x7d'),_0x3f0f85+'%')['or']('i.phone\x20LIKE\x20?',_0x3f0f85+'%');}else{_0x5d7333['or'](_0x3b90('0x7e'),qs['getFullTextValue'](_0x3f0f85))['or'](_0x3b90('0x7f'),_0x3f0f85+'%');}}}_0x3f71b0[_0x3b90('0x3d')](_0x5d7333);_0x3f71b0[_0x3b90('0x80')](_0x3b90('0x81'));var _0x15fc75={'type':db[_0x3b90('0x82')]['QueryTypes'][_0x3b90('0x83')],'raw':!![]};var _0x230567=_0x3f71b0[_0x3b90('0x84')]();_0x230567[_0x3b90('0x40')](_0x3b90('0x81'));_0x230567[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));if(_0x401dc5['order']){_0x401dc5[_0x3b90('0x3b')][_0x3b90('0x65')](function(_0xb0160f){_0x3f71b0[_0x3b90('0x3b')]('i.'+_0xb0160f[0x0],_0xb0160f[0x1]===_0x3b90('0x87')?![]:!![]);});}if(!_[_0x3b90('0x6d')](_0x291279)){_0x3f71b0[_0x3b90('0x57')](_0x18d59b);_0x230567[_0x3b90('0x3d')]('t.id\x20IN\x20?',_0x291279);}BPromise['resolve']()[_0x3b90('0x20')](function(){if(!_0x41e951){if(_0x143698[_0x3b90('0x31')][_0x3b90('0x6e')]||_0x143698['query'][_0x3b90('0x88')])return;_0x230567['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x89'));return;}return _0x143698[_0x3b90('0x8a')][_0x3b90('0x8b')]({'attributes':['id'],'raw':!![]})[_0x3b90('0x20')](function(_0x133c91){if(_[_0x3b90('0x6d')](_0x133c91)){_0x230567[_0x3b90('0x3d')](_0x3b90('0x8c'));_0x3f71b0[_0x3b90('0x3d')](_0x3b90('0x8c'));}else{_0x230567[_0x3b90('0x3d')](_0x3b90('0x6f'),_[_0x3b90('0x27')](_0x133c91,'id'));_0x3f71b0[_0x3b90('0x3d')]('i.SmsAccountId\x20IN\x20?',_[_0x3b90('0x27')](_0x133c91,'id'));}});})[_0x3b90('0x20')](function(){db['sequelize'][_0x3b90('0x31')](_0x230567['toString'](),_0x15fc75)[_0x3b90('0x20')](function(_0x38fab0){_0x5a97fe[_0x3b90('0x8d')]=_0x38fab0['length'];if(_0x5a97fe[_0x3b90('0x8d')]===0x0)return[];return db[_0x3b90('0x8e')][_0x3b90('0x31')](_0x4d1157[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x15befb){_0x11698a=_[_0x3b90('0x90')](_0x15befb,'id');_0x15fc75=_[_0x3b90('0x91')](_0x15fc75,{'model':db[_0x3b90('0x92')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x143698[_0x3b90('0x31')][_0x3b90('0x36')]){_0x401dc5[_0x3b90('0x37')]['forEach'](function(_0x5546af){_0x3f71b0['field']('i.'+_0x5546af);});}else{_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x85'),_0x3b90('0x86'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x93'),_0x3b90('0x94'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x95'),_0x3b90('0x96'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x97'));_0x3f71b0['field']('c.firstName',_0x3b90('0x98'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x99'),_0x3b90('0x9a'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9b'),_0x3b90('0x9c'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9d'),_0x3b90('0x9e'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0x9f'),_0x3b90('0xa0'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa1'),_0x3b90('0xa2'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa3'),'Owner.fullname');_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa4'),_0x3b90('0xa5'));_0x3f71b0[_0x3b90('0x40')](_0x3b90('0xa6'),'TagIds');}if(_0x401dc5[_0x3b90('0x19')])_0x3f71b0[_0x3b90('0x19')](_0x401dc5[_0x3b90('0x19')]);if(_0x401dc5[_0x3b90('0x18')])_0x3f71b0[_0x3b90('0x18')](_0x401dc5[_0x3b90('0x18')]);return db['sequelize'][_0x3b90('0x31')](_0x3f71b0['toString'](),_0x15fc75);})['then'](function(_0x25b369){_0x283419[_0x3b90('0x3d')](_0x3b90('0xa7'),_[_0x3b90('0x27')](_0x25b369,'id'));return db[_0x3b90('0x8e')]['query'](_0x283419[_0x3b90('0x8f')](),_0x15fc75)[_0x3b90('0x20')](function(_0x429cd0){var _0x14d21d=_[_0x3b90('0xa8')](_0x429cd0,_0x3b90('0xa9'));var _0x19b070=[];_0x25b369[_0x3b90('0x65')](function(_0x2c2e24){_0x19b070[_0x3b90('0x2c')](updateSmsInteraction(_0x2c2e24,_0x11698a,_0x14d21d));});return BPromise[_0x3b90('0xaa')](_0x19b070);});});})[_0x3b90('0x20')](function(_0x468342){_0x5a97fe[_0x3b90('0xab')]=_0x468342;return _0x5a97fe;})[_0x3b90('0x20')](respondWithFilteredResult(_0x64a5e,_0x401dc5));})[_0x3b90('0xac')](handleError(_0x64a5e,null));};exports['show']=function(_0x13e661,_0x9fcc2){var _0x27100a={'raw':![],'where':{'id':_0x13e661[_0x3b90('0xad')]['id']}},_0x3c1958={};_0x3c1958[_0x3b90('0x35')]=_['keys'](db[_0x3b90('0x92')][_0x3b90('0xae')]);_0x3c1958[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x13e661[_0x3b90('0x31')]);_0x3c1958['filters']=_[_0x3b90('0x34')](_0x3c1958[_0x3b90('0x35')],_0x3c1958[_0x3b90('0x31')]);_0x27100a[_0x3b90('0x37')]=_['intersection'](_0x3c1958['model'],qs[_0x3b90('0x36')](_0x13e661['query'][_0x3b90('0x36')]));_0x27100a[_0x3b90('0x37')]=_0x27100a[_0x3b90('0x37')][_0x3b90('0x38')]?_0x27100a[_0x3b90('0x37')]:_0x3c1958['model'];if(_0x13e661[_0x3b90('0x31')]['includeAll']){_0x27100a[_0x3b90('0xaf')]=[{'all':!![]}];}_0x27100a=_[_0x3b90('0x91')]({},_0x27100a,_0x13e661[_0x3b90('0xb0')]);return db['SmsInteraction'][_0x3b90('0x5f')](_0x27100a)[_0x3b90('0x20')](handleEntityNotFound(_0x9fcc2,null))[_0x3b90('0x20')](respondWithResult(_0x9fcc2,null))['catch'](handleError(_0x9fcc2,null));};exports[_0x3b90('0xb1')]=function(_0x1dbc3d,_0x290a14){return db['SmsInteraction'][_0x3b90('0xb1')](_0x1dbc3d[_0x3b90('0x6b')],{})[_0x3b90('0x20')](respondWithResult(_0x290a14,0xc9))[_0x3b90('0xac')](handleError(_0x290a14,null));};exports[_0x3b90('0x1f')]=function(_0x456452,_0x50396d){if(_0x456452['body']['id']){delete _0x456452['body']['id'];}return db[_0x3b90('0x92')]['find']({'where':{'id':_0x456452[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x50396d,null))[_0x3b90('0x20')](saveUpdates(_0x456452[_0x3b90('0x6b')],null))[_0x3b90('0x20')](respondWithResult(_0x50396d,null))['catch'](handleError(_0x50396d,null));};exports[_0x3b90('0xb2')]=function(_0x4b23be,_0x74241a){return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0x4b23be['params']['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x74241a,null))[_0x3b90('0x20')](removeEntity(_0x74241a,null))[_0x3b90('0xac')](handleError(_0x74241a,null));};exports[_0x3b90('0xb3')]=function(_0x1be56f,_0x39eb5e){return db[_0x3b90('0x92')][_0x3b90('0xb3')]()['then'](respondWithResult(_0x39eb5e,null))[_0x3b90('0xac')](handleError(_0x39eb5e,null));};exports['addMessage']=function(_0x152170,_0x171ac6,_0x337da6){return db[_0x3b90('0xb4')][_0x3b90('0x5f')]({'where':{'id':_0x152170[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x171ac6,null))['then'](function(_0x50ab1f){if(_0x50ab1f){return _0x50ab1f[_0x3b90('0xb5')](_0x152170[_0x3b90('0x6b')][_0x3b90('0xb6')],_[_0x3b90('0xb7')](_0x152170['body'],['ids','id'])||{});}})[_0x3b90('0x20')](respondWithResult(_0x171ac6,null))[_0x3b90('0xac')](handleError(_0x171ac6,null));};exports['getMessages']=function(_0x2c22e9,_0x3346d9,_0xabc9f9){var _0x1d3d2e={'raw':![],'where':{}};var _0x2cef2f={};var _0x4490da={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x3b90('0xb8')]({'where':{'id':_0x2c22e9[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x3346d9,null))[_0x3b90('0x20')](function(_0x13f288){if(_0x13f288){_0x2cef2f[_0x3b90('0x35')]=_[_0x3b90('0x32')](db[_0x3b90('0xb4')][_0x3b90('0xae')]);_0x2cef2f[_0x3b90('0x31')]=_[_0x3b90('0x32')](_0x2c22e9['query']);_0x2cef2f['filters']=_['intersection'](_0x2cef2f['model'],_0x2cef2f[_0x3b90('0x31')]);_0x1d3d2e[_0x3b90('0x37')]=_[_0x3b90('0x34')](_0x2cef2f[_0x3b90('0x35')],qs[_0x3b90('0x36')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x36')]));_0x1d3d2e[_0x3b90('0x37')]=_0x1d3d2e[_0x3b90('0x37')]['length']?_0x1d3d2e[_0x3b90('0x37')]:_0x2cef2f['model'];if(!_0x2c22e9['query'][_0x3b90('0x39')](_0x3b90('0x3a'))){_0x1d3d2e[_0x3b90('0x19')]=qs[_0x3b90('0x19')](_0x2c22e9[_0x3b90('0x31')]['limit']);_0x1d3d2e[_0x3b90('0x18')]=qs['offset'](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x18')]);}_0x1d3d2e[_0x3b90('0x3b')]=qs[_0x3b90('0x3c')](_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x3c')]);_0x1d3d2e[_0x3b90('0x3d')]=qs[_0x3b90('0x33')](_[_0x3b90('0x3e')](_0x2c22e9[_0x3b90('0x31')],_0x2cef2f['filters']));_0x1d3d2e[_0x3b90('0x3d')][_0x3b90('0xa9')]=_0x13f288['id'];if(_0x2c22e9[_0x3b90('0x31')][_0x3b90('0x79')]){_0x1d3d2e[_0x3b90('0x3d')]=_[_0x3b90('0x91')](_0x1d3d2e[_0x3b90('0x3d')],{'$or':_[_0x3b90('0x27')](_0x1d3d2e[_0x3b90('0x37')],function(_0x383979){var _0xc4bb54={};_0xc4bb54[_0x383979]={'$like':'%'+_0x2c22e9['query'][_0x3b90('0x79')]+'%'};return _0xc4bb54;})});}if(_0x2c22e9[_0x3b90('0x31')]['$gte']){var _0x3c042e=_0x2c22e9[_0x3b90('0x31')][_0x3b90('0xb9')][_0x3b90('0x2b')](',');var _0x57b104={};_0x57b104[_0x3c042e[0x0]]={'$gte':moment(_0x3c042e[0x1])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d3d2e['where']=_['merge'](_0x1d3d2e['where'],_0x57b104);}_0x1d3d2e=_[_0x3b90('0x91')]({},_0x1d3d2e,_0x2c22e9[_0x3b90('0xb0')]);return db[_0x3b90('0xb4')][_0x3b90('0x8d')]({'where':_0x1d3d2e[_0x3b90('0x3d')]})[_0x3b90('0x20')](function(_0x22ead2){_0x4490da[_0x3b90('0x8d')]=_0x22ead2;if(_0x2c22e9['query'][_0x3b90('0xbb')]){_0x1d3d2e[_0x3b90('0xaf')]=[{'all':!![]}];}return db['SmsMessage'][_0x3b90('0xbc')](_0x1d3d2e);})[_0x3b90('0x20')](function(_0x54bbba){_0x4490da[_0x3b90('0xab')]=_0x54bbba;return _0x4490da;});}})['then'](respondWithFilteredResult(_0x3346d9,_0x1d3d2e))[_0x3b90('0xac')](handleError(_0x3346d9,null));};exports['addTags']=function(_0x293642,_0x293197,_0x5b9fd1){return db['SmsInteraction'][_0x3b90('0x5f')]({'where':{'id':_0x293642[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x293197,null))['then'](function(_0x27f114){if(_0x27f114){return _0x27f114['setTags'](_0x293642[_0x3b90('0x6b')]['ids'],_[_0x3b90('0xb7')](_0x293642[_0x3b90('0x6b')],[_0x3b90('0xb6'),'id'])||{})[_0x3b90('0xbd')](function(){return db[_0x3b90('0x64')][_0x3b90('0xbc')]({'attributes':['id','name',_0x3b90('0x41')],'where':{'id':_0x293642[_0x3b90('0x6b')]['ids']}});})[_0x3b90('0x20')](function(_0x379031){socket[_0x3b90('0xbe')](_0x3b90('0xbf'),{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]});return{'id':Number(_0x293642['params']['id']),'tags':_0x379031||[]};});}})[_0x3b90('0x20')](respondWithResult(_0x293197,null))[_0x3b90('0xac')](handleError(_0x293197,null));};exports['removeTags']=function(_0x4fe659,_0x352adc,_0x105b8e){return db[_0x3b90('0x92')]['find']({'where':{'id':_0x4fe659[_0x3b90('0xad')]['id']}})[_0x3b90('0x20')](handleEntityNotFound(_0x352adc,null))[_0x3b90('0x20')](function(_0x1b6c29){if(_0x1b6c29){return _0x1b6c29[_0x3b90('0xc0')](_0x4fe659[_0x3b90('0x31')][_0x3b90('0xb6')]);}})['then'](respondWithStatusCode(_0x352adc,null))[_0x3b90('0xac')](handleError(_0x352adc,null));};exports[_0x3b90('0xc1')]=function(_0xd84ba2,_0x364f0e){var _0x450a46=moment()[_0x3b90('0xc2')]()['toString']();var _0x4f154f=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],_0x3b90('0xc5'),_0x3b90('0xc6'),_0x3b90('0xc7'));var _0x5ce783=path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xc6'),_0x3b90('0xc8'));var _0x4e1dac=path[_0x3b90('0xc3')](_0x4f154f,_0x450a46);var _0xbc60a4=util['format']('transcript-%d-%s.zip',_0xd84ba2['params']['id'],_0x450a46);var _0x5a4736=path[_0x3b90('0xc3')](_0x4f154f,_0xbc60a4);var _0x368a65=[];_0x368a65[_0x3b90('0x2c')]({'model':db['User'],'as':_0x3b90('0x68'),'attributes':['id',_0x3b90('0x28')],'raw':!![]});_0x368a65[_0x3b90('0x2c')]({'model':db[_0x3b90('0xc9')],'as':_0x3b90('0x5a'),'attributes':['id',_0x3b90('0xca'),'lastName'],'raw':!![]});var _0x428fc7=[{'model':db['SmsMessage'],'as':_0x3b90('0xcb'),'attributes':['id',_0x3b90('0x6b'),'createdAt','direction',_0x3b90('0xcc'),_0x3b90('0x74')],'include':_0x368a65}];_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0xcd')],'as':_0x3b90('0xce'),'attributes':['id',_0x3b90('0x24')]});_0x428fc7[_0x3b90('0x2c')]({'model':db[_0x3b90('0x68')],'as':_0x3b90('0xcf'),'attributes':['id',_0x3b90('0x28')]});return db[_0x3b90('0x92')][_0x3b90('0x5f')]({'where':{'id':_0xd84ba2['params']['id']},'include':_0x428fc7})[_0x3b90('0x20')](handleEntityNotFound(_0x364f0e,null))[_0x3b90('0x20')](function(_0x318679){if(_0x318679){var _0x462a16=_0x318679[_0x3b90('0xd0')]({'plain':!![]});fs[_0x3b90('0xd1')](_0x4e1dac);var _0x53df48={'format':'A4','border':_0x3b90('0xd2'),'header':{'height':_0x3b90('0xd3'),'contents':{'first':_0x3b90('0xd4')}},'footer':{'height':'30px','contents':{'default':util[_0x3b90('0xba')](_0x3b90('0xd5'),util['format'](_0x3b90('0xd6'),_0x3b90('0xd7'),_0x462a16['id']),moment()[_0x3b90('0xba')](_0x3b90('0xd8'))['toString']())}}};var _0x222229={'channel':_0x3b90('0xd7'),'account':_0x462a16[_0x3b90('0xce')][_0x3b90('0x24')],'agent':_0x462a16['Owner']?_0x462a16[_0x3b90('0xcf')][_0x3b90('0x28')]:_0x3b90('0xd9'),'createdAt':moment(_0x462a16[_0x3b90('0xda')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')](),'closedAt':_0x462a16[_0x3b90('0xdc')]?moment(_0x462a16[_0x3b90('0xdd')])[_0x3b90('0xba')](_0x3b90('0xdb'))[_0x3b90('0x8f')]():'','disposition':_0x462a16[_0x3b90('0xde')],'messages':_(_0x462a16[_0x3b90('0xcb')])[_0x3b90('0x79')]({'secret':![]})[_0x3b90('0x27')](function(_0x427ce8){return{'date':moment(_0x427ce8['createdAt'])[_0x3b90('0xba')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3b90('0x8f')](),'sender':_0x427ce8[_0x3b90('0xdf')]===_0x3b90('0xe0')?_0x427ce8[_0x3b90('0x68')]?_0x427ce8[_0x3b90('0x68')][_0x3b90('0x28')]:_0x3b90('0xe1'):_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xca')]+(_0x427ce8[_0x3b90('0x5a')][_0x3b90('0xe2')]?'\x20'+_0x427ce8[_0x3b90('0x5a')]['lastName']:''),'body':_0x427ce8['body'],'direction':_0x427ce8[_0x3b90('0xdf')]==='out'?'A':'C','secret':_0x427ce8[_0x3b90('0xcc')],'read':_0x427ce8[_0x3b90('0x74')]};})[_0x3b90('0x56')]()};return ejs[_0x3b90('0xe3')](path[_0x3b90('0xc3')](config[_0x3b90('0xc4')],'server',_0x3b90('0xe4'),_0x3b90('0xe5')),{'interaction':_0x222229})[_0x3b90('0x20')](function(_0x25a7b7){return new BPromise(function(_0x217be5,_0x46da40){pdf[_0x3b90('0xb1')](_0x25a7b7,_0x53df48)['toFile'](path['join'](_0x4e1dac,_0x3b90('0xe6')+_0x462a16['id']+'-'+_0x450a46+_0x3b90('0xe7')),function(_0x476605,_0x580cc3){if(_0x476605)return _0x46da40(_0x476605);_0x217be5(_0x580cc3);});});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1d5fe8,_0x115518){zipdir(_0x4e1dac,{'saveTo':_0x5a4736},function(_0x466166,_0x2e1a1e){if(_0x466166)return _0x115518(_0x466166);return _0x1d5fe8(_0x2e1a1e);});})[_0x3b90('0x20')](function(){return new BPromise(function(_0x1afa92,_0x49e993){rimraf(_0x4e1dac,function(_0x49c2cf){if(_0x49c2cf)_0x49e993(_0x49c2cf);return _0x1afa92();});});})[_0x3b90('0x20')](function(){return _0x364f0e[_0x3b90('0xc1')](_0x5a4736,_0xbc60a4,function(_0x175fe0){if(_0x175fe0){console[_0x3b90('0xe8')](_0x3b90('0xe9'),_0x175fe0);}else{fs[_0x3b90('0xea')](_0x5a4736);}});});});}else{return _0x364f0e[_0x3b90('0x21')](0xc8);}})['catch'](handleError(_0x364f0e,null));}; \ No newline at end of file +var _0x9bde=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','conditions','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','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','keys','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','rows','show','intersection','includeAll','options','create','body','params','describe','SmsMessage','addMessage','ids','omit','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','spread','findAll','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','secret','read','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Messages','out','direction','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x14bc11,_0x37fd94){var _0x2a9521=function(_0x31fe07){while(--_0x31fe07){_0x14bc11['push'](_0x14bc11['shift']());}};_0x2a9521(++_0x37fd94);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b02d7,_0x1bfd05){_0x5b02d7=_0x5b02d7-0x0;var _0x59ccc6=_0x9bde[_0x5b02d7];return _0x59ccc6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];config[_0xe9bd('0x19')]=_['defaults'](config[_0xe9bd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9bd('0x1a'))(new Redis(config[_0xe9bd('0x19')]));require(_0xe9bd('0x1b'))['register'](socket);function respondWithStatusCode(_0x47ba5e,_0x46a95e){_0x46a95e=_0x46a95e||0xcc;return function(_0x248818){if(_0x248818){return _0x47ba5e[_0xe9bd('0x1c')](_0x46a95e);}return _0x47ba5e[_0xe9bd('0x1d')](_0x46a95e)[_0xe9bd('0x1e')]();};}function respondWithResult(_0x389e7b,_0x45a9f2){_0x45a9f2=_0x45a9f2||0xc8;return function(_0x573350){if(_0x573350){return _0x389e7b[_0xe9bd('0x1d')](_0x45a9f2)[_0xe9bd('0x1f')](_0x573350);}};}function respondWithFilteredResult(_0x160281,_0x494b27){return function(_0x36f03d){if(_0x36f03d){var _0x3bae08=_0x36f03d[_0xe9bd('0x20')],_0x34ba2b=_0x494b27['offset'],_0x330733=_0x494b27[_0xe9bd('0x21')]+_0x494b27['limit'],_0x5cf674;if(_0x330733>=_0x3bae08){_0x330733=_0x3bae08;_0x5cf674=0xc8;}else{_0x5cf674=0xce;}_0x160281[_0xe9bd('0x1d')](_0x5cf674);return _0x160281[_0xe9bd('0x22')](_0xe9bd('0x23'),_0x34ba2b+'-'+_0x330733+'/'+_0x3bae08)[_0xe9bd('0x1f')](_0x36f03d);}return null;};}function patchUpdates(_0x1acb82){return function(_0x34ffed){try{jsonpatch[_0xe9bd('0x24')](_0x34ffed,_0x1acb82,!![]);}catch(_0x49165b){return BPromise[_0xe9bd('0x25')](_0x49165b);}return _0x34ffed[_0xe9bd('0x26')]();};}function saveUpdates(_0x4ecaf5,_0x37aec1){return function(_0x505c23){if(_0x505c23){return _0x505c23[_0xe9bd('0x27')](_0x4ecaf5)[_0xe9bd('0x28')](function(_0x36f8c0){return _0x36f8c0;});}return null;};}function removeEntity(_0xf02209,_0x5bc4bf){return function(_0x24cf25){if(_0x24cf25){return _0x24cf25[_0xe9bd('0x29')]()[_0xe9bd('0x28')](function(){_0xf02209[_0xe9bd('0x1d')](0xcc)[_0xe9bd('0x1e')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x1c')](0x194);}return _0x43ea90;};}function handleError(_0x5987af,_0x3c211a){_0x3c211a=_0x3c211a||0x1f4;return function(_0x38fdfa){logger['error'](_0x38fdfa[_0xe9bd('0x2a')]);if(_0x38fdfa[_0xe9bd('0x2b')]){delete _0x38fdfa[_0xe9bd('0x2b')];}_0x5987af[_0xe9bd('0x1d')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}function getInteractionUsers(_0x183601,_0x519f48){return new BPromise(function(_0x5b7f1d,_0x1de54c){try{if(_0x519f48[_0x183601['id']]){_0x183601['Users']=_[_0xe9bd('0x2d')](_0x519f48[_0x183601['id']],function(_0x1f2c0e){return{'id':_0x1f2c0e['id'],'fullname':_0x1f2c0e[_0xe9bd('0x2e')]};});}}catch(_0x36aa80){_0x1de54c(_0x36aa80);}_0x5b7f1d(_0x183601);});}function getInteractionTags(_0x4057df,_0x509e36){return new BPromise(function(_0x4b7bc2,_0x7f2c5){try{if(_0x4057df[_0xe9bd('0x2f')]){_0x4057df[_0xe9bd('0x30')]=[];_0x4057df[_0xe9bd('0x2f')][_0xe9bd('0x31')](',')[_0xe9bd('0x32')](function(_0x3c31ee){_0x4057df[_0xe9bd('0x30')][_0xe9bd('0x33')](_0x509e36[_0x3c31ee]);});}delete _0x4057df['TagIds'];}catch(_0x426004){_0x7f2c5(_0x426004);}_0x4b7bc2(_0x4057df);});}function updateSmsInteraction(_0x81a31f,_0x390a43,_0x5117bc){return new BPromise(function(_0x524e08,_0x25eeab){return getInteractionUsers(_0x81a31f,_0x5117bc)[_0xe9bd('0x28')](function(_0x601649){return getInteractionTags(_0x601649,_0x390a43);})[_0xe9bd('0x28')](function(_0x1dda43){_0x524e08(_0x1dda43);})[_0xe9bd('0x34')](function(_0x1e50ac){_0x25eeab(_0x1e50ac);});});}exports[_0xe9bd('0x35')]=function(_0x1a1a29,_0x32b3e3){var _0x46576b={},_0x549dd1={},_0x2ad46e={'count':0x0,'rows':[]};var _0x199477=_[_0xe9bd('0x2d')](db[_0xe9bd('0x36')][_0xe9bd('0x37')],function(_0x147da5){return{'name':_0x147da5['fieldName'],'type':_0x147da5[_0xe9bd('0x38')][_0xe9bd('0x39')]};});_0x549dd1['model']=_[_0xe9bd('0x2d')](_0x199477,_0xe9bd('0x2b'));_0x549dd1['query']=_['keys'](_0x1a1a29[_0xe9bd('0x3a')]);_0x549dd1[_0xe9bd('0x3b')]=_['intersection'](_0x549dd1[_0xe9bd('0x3c')],_0x549dd1[_0xe9bd('0x3a')]);_0x46576b[_0xe9bd('0x3d')]=_['intersection'](_0x549dd1[_0xe9bd('0x3c')],qs['fields'](_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x3e')]));_0x46576b[_0xe9bd('0x3d')]=_0x46576b[_0xe9bd('0x3d')]['length']?_0x46576b[_0xe9bd('0x3d')]:_0x549dd1[_0xe9bd('0x3c')];if(!_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x3f')](_0xe9bd('0x40'))){_0x46576b[_0xe9bd('0x41')]=qs[_0xe9bd('0x41')](_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x41')]);_0x46576b[_0xe9bd('0x21')]=qs['offset'](_0x1a1a29['query'][_0xe9bd('0x21')]);}_0x46576b['order']=qs[_0xe9bd('0x42')](_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x42')]);_0x46576b['where']=qs[_0xe9bd('0x3b')](_[_0xe9bd('0x43')](_0x1a1a29[_0xe9bd('0x3a')],_0x549dd1['filters']),_0x199477);var _0x2ef01b=[];var _0x3a5703=squel[_0xe9bd('0x44')]()[_0xe9bd('0x45')]('id')[_0xe9bd('0x45')](_0xe9bd('0x2b'))[_0xe9bd('0x45')](_0xe9bd('0x46'))[_0xe9bd('0x47')](_0xe9bd('0x48'));var _0x3817ab=squel[_0xe9bd('0x44')]()[_0xe9bd('0x45')](_0xe9bd('0x49'))[_0xe9bd('0x45')]('u.fullname')['field'](_0xe9bd('0x4a'))[_0xe9bd('0x47')](_0xe9bd('0x4b'),'ui')['left_join']('users','u',_0xe9bd('0x4c'));var _0x3f6f22=squel[_0xe9bd('0x44')]()[_0xe9bd('0x47')](_0xe9bd('0x4d'),'i')[_0xe9bd('0x4e')](_0xe9bd('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe9bd('0x4e')]('users','o',_0xe9bd('0x50'))[_0xe9bd('0x4e')](_0xe9bd('0x51'),'a',_0xe9bd('0x52'))[_0xe9bd('0x4e')]('sms_messages','me',_0xe9bd('0x53'))[_0xe9bd('0x4e')](_0xe9bd('0x54'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xe9bd('0x4e')](_0xe9bd('0x48'),'t',_0xe9bd('0x55'));var _0x5a466b=squel[_0xe9bd('0x56')]();var _0x27e7b0=[];var _0x2e634d=squel[_0xe9bd('0x56')]();var _0x1ee09c;if(_0x1a1a29['query'][_0xe9bd('0x57')]){_0x1ee09c=as['parseSearch'](_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x57')]);var _0xa8d80c=_0x1ee09c[_0xe9bd('0x58')];for(var _0x194b7d=0x0;_0x194b7d<_0x1ee09c['conditions'][_0xe9bd('0x59')];_0x194b7d++){var _0x485e95=_0x1ee09c[_0xe9bd('0x5a')][_0x194b7d];var _0x222427='i';var _0x5e08ae=_['find'](_0x199477,[_0xe9bd('0x2b'),_0x485e95['field']]);if(!_0x5e08ae){switch(_0x485e95[_0xe9bd('0x45')]){case'unreadMessages':if(_0x485e95[_0xe9bd('0x5b')]==0x1){_0x3f6f22[_0xe9bd('0x5c')]('`'+_0x485e95['field']+_0xe9bd('0x5d'));}else{_0x3f6f22['having']('`'+_0x485e95[_0xe9bd('0x45')]+_0xe9bd('0x5e'));}break;case _0xe9bd('0x5f'):if(_0x485e95['operator']===_0xe9bd('0x60')){if(_0x485e95[_0xe9bd('0x5b')][_0xe9bd('0x31')]('\x20')[_0xe9bd('0x59')]>0x1){_0x5a466b[_0xa8d80c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x485e95[_0xe9bd('0x5b')]),null);}else{var _0x493aae='%'+_0x485e95[_0xe9bd('0x5b')]+'%';_0x5a466b[_0xa8d80c](_0xe9bd('0x61'),_0x493aae,_0x493aae,_0x493aae);}}else{_0x5e08ae=_[_0xe9bd('0x62')](_0x199477,[_0xe9bd('0x2b'),_0xe9bd('0x63')]);_0x485e95[_0xe9bd('0x45')]=_0xe9bd('0x63');_0x305efa=as[_0xe9bd('0x64')](_0x222427,_0x5e08ae[_0xe9bd('0x38')],_0x485e95);_0x5a466b[_0xa8d80c](_0x305efa[_0xe9bd('0x65')],_0x305efa[_0xe9bd('0x5b')][_0xe9bd('0x66')],_0x305efa['value']['end']);}break;case'Tag':var _0x10e685=_0x485e95['value'][_0xe9bd('0x31')](',')[_0xe9bd('0x2d')](function(_0x90db01){return Number(_0x90db01);});_0x10e685[_0xe9bd('0x32')](function(_0x1c9328){_0x2e634d['or'](_0xe9bd('0x67'),'%,'+_0x1c9328+',%');});_0x27e7b0=_[_0xe9bd('0x68')](_0x27e7b0,_0x10e685);break;case _0xe9bd('0x69'):if(_0x485e95[_0xe9bd('0x6a')]==='$substring'){_0x5a466b[_0xa8d80c](_0xe9bd('0x6b'),'%'+_0x485e95[_0xe9bd('0x5b')]+'%',null);}else{_0x5e08ae=_[_0xe9bd('0x62')](_0x199477,[_0xe9bd('0x2b'),'UserId']);_0x485e95[_0xe9bd('0x45')]=_0xe9bd('0x6c');_0x305efa=as[_0xe9bd('0x64')](_0x222427,_0x5e08ae['type'],_0x485e95);_0x5a466b[_0xa8d80c](_0x305efa[_0xe9bd('0x65')],_0x305efa[_0xe9bd('0x5b')][_0xe9bd('0x66')],_0x305efa[_0xe9bd('0x5b')]['end']);}break;case'body':_0x305efa=as[_0xe9bd('0x64')]('me',null,_0x485e95);_0x5a466b[_0xa8d80c](_0x305efa[_0xe9bd('0x65')],_0x305efa[_0xe9bd('0x5b')][_0xe9bd('0x66')],_0x305efa['value']['end']);break;}}else{var _0x305efa=as[_0xe9bd('0x64')](_0x222427,_0x5e08ae[_0xe9bd('0x38')],_0x485e95);_0x5a466b[_0xa8d80c](_0x305efa[_0xe9bd('0x65')],_0x305efa[_0xe9bd('0x5b')][_0xe9bd('0x66')],_0x305efa['value'][_0xe9bd('0x1e')]);}}}else{var _0x5681ab=_(_0x1a1a29[_0xe9bd('0x3a')])[_0xe9bd('0x6d')]()[_0xe9bd('0x2d')](function(_0x436983){return _['some'](_0x199477,[_0xe9bd('0x2b'),_0x436983])?_0x436983:undefined;})[_0xe9bd('0x6e')]()[_0xe9bd('0x5b')]();if(!_['isEmpty'](_0x5681ab)){_0x5681ab[_0xe9bd('0x32')](function(_0x1a9d0c){if(_0x1a9d0c===_0xe9bd('0x6f')){_0x3f6f22[_0xe9bd('0x70')](_0xe9bd('0x71'),[][_0xe9bd('0x72')](_0x1a1a29[_0xe9bd('0x3a')][_0x1a9d0c]));}else if(_0x1a9d0c===_0xe9bd('0x73')){var _0x38e2bf=JSON[_0xe9bd('0x74')](_0x1a1a29[_0xe9bd('0x3a')][_0x1a9d0c])[_0xe9bd('0x75')];var _0x5d1e4b=JSON[_0xe9bd('0x74')](_0x1a1a29[_0xe9bd('0x3a')][_0x1a9d0c])['$lte'];_0x3f6f22[_0xe9bd('0x70')](_0xe9bd('0x76'),_0x38e2bf,_0x5d1e4b);}else{if(_0x1a1a29['query'][_0x1a9d0c]==='null'){_0x3f6f22[_0xe9bd('0x70')]('i.'+_0x1a9d0c+_0xe9bd('0x77'));}else{_0x3f6f22['where']('i.'+_0x1a9d0c+'\x20=\x20?',_0x1a1a29['query'][_0x1a9d0c]);}}});}if(_0x1a1a29[_0xe9bd('0x3a')]['read']){if(_0x1a1a29['query']['read']==0x1){_0x3f6f22['having'](_0xe9bd('0x78'));}else{_0x3f6f22[_0xe9bd('0x5c')](_0xe9bd('0x79'));}}if(_0x1a1a29['query'][_0xe9bd('0x7a')]){_0x27e7b0=_[_0xe9bd('0x7b')](_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x7a')])?_0x1a1a29['query'][_0xe9bd('0x7a')]:new Array(_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x7a')]);_0x27e7b0['forEach'](function(_0x5248fd){_0x2e634d['or'](_0xe9bd('0x67'),'%,'+_0x5248fd+',%');});}if(_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x7c')]){var _0x40d9e0=_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x7c')][_0xe9bd('0x7d')]('\x5c','\x5c\x5c')[_0xe9bd('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xe9bd('0x7e')](_0x40d9e0)){_0x5a466b['or'](_0xe9bd('0x7f'),_0x40d9e0+'%')['or'](_0xe9bd('0x80'),_0x40d9e0+'%');}else{_0x5a466b['or'](_0xe9bd('0x81'),qs[_0xe9bd('0x82')](_0x40d9e0))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x40d9e0+'%');}}}_0x3f6f22[_0xe9bd('0x70')](_0x5a466b);_0x3f6f22['group']('i.id');var _0x12aef8={'type':db[_0xe9bd('0x83')]['QueryTypes'][_0xe9bd('0x84')],'raw':!![]};var _0x2d1e63=_0x3f6f22[_0xe9bd('0x85')]();_0x2d1e63[_0xe9bd('0x45')]('i.id');_0x2d1e63[_0xe9bd('0x45')](_0xe9bd('0x86'),'unreadMessages');if(_0x46576b[_0xe9bd('0x87')]){_0x46576b[_0xe9bd('0x87')][_0xe9bd('0x32')](function(_0x22fd20){_0x3f6f22[_0xe9bd('0x87')]('i.'+_0x22fd20[0x0],_0x22fd20[0x1]===_0xe9bd('0x88')?![]:!![]);});}if(!_[_0xe9bd('0x89')](_0x27e7b0)){_0x3f6f22['having'](_0x2e634d);_0x2d1e63[_0xe9bd('0x70')](_0xe9bd('0x8a'),_0x27e7b0);}BPromise[_0xe9bd('0x8b')]()[_0xe9bd('0x28')](function(){if(!_0x1ee09c){if(_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x6f')]||_0x1a1a29[_0xe9bd('0x3a')][_0xe9bd('0x8c')])return;_0x2d1e63[_0xe9bd('0x70')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3f6f22[_0xe9bd('0x70')](_0xe9bd('0x8d'));return;}return _0x1a1a29[_0xe9bd('0x8e')][_0xe9bd('0x8f')]({'attributes':['id'],'raw':!![]})[_0xe9bd('0x28')](function(_0x7354df){if(_[_0xe9bd('0x89')](_0x7354df)){_0x2d1e63['where'](_0xe9bd('0x90'));_0x3f6f22[_0xe9bd('0x70')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x2d1e63[_0xe9bd('0x70')](_0xe9bd('0x71'),_[_0xe9bd('0x2d')](_0x7354df,'id'));_0x3f6f22[_0xe9bd('0x70')](_0xe9bd('0x71'),_[_0xe9bd('0x2d')](_0x7354df,'id'));}});})[_0xe9bd('0x28')](function(){db['sequelize']['query'](_0x2d1e63[_0xe9bd('0x91')](),_0x12aef8)[_0xe9bd('0x28')](function(_0x3d0163){_0x2ad46e[_0xe9bd('0x20')]=_0x3d0163[_0xe9bd('0x59')];if(_0x2ad46e[_0xe9bd('0x20')]===0x0)return[];return db[_0xe9bd('0x92')]['query'](_0x3a5703[_0xe9bd('0x91')](),_0x12aef8)[_0xe9bd('0x28')](function(_0x29833b){_0x2ef01b=_[_0xe9bd('0x93')](_0x29833b,'id');_0x12aef8=_[_0xe9bd('0x94')](_0x12aef8,{'model':db[_0xe9bd('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a1a29[_0xe9bd('0x3a')]['fields']){_0x46576b['attributes']['forEach'](function(_0x274e83){_0x3f6f22['field']('i.'+_0x274e83);});}else{_0x3f6f22['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe9bd('0x95'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0x96'),_0xe9bd('0x97'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0x98'),_0xe9bd('0x99'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0x9a'));_0x3f6f22['field'](_0xe9bd('0x9b'),'Contact.firstName');_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0x9c'),_0xe9bd('0x9d'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0x9e'),'Contact.email');_0x3f6f22['field']('c.phone',_0xe9bd('0x9f'));_0x3f6f22[_0xe9bd('0x45')]('c.mobile',_0xe9bd('0xa0'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0xa1'),_0xe9bd('0xa2'));_0x3f6f22[_0xe9bd('0x45')]('o.fullname',_0xe9bd('0xa3'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0xa4'),_0xe9bd('0xa5'));_0x3f6f22[_0xe9bd('0x45')](_0xe9bd('0xa6'),_0xe9bd('0x2f'));}if(_0x46576b[_0xe9bd('0x41')])_0x3f6f22[_0xe9bd('0x41')](_0x46576b[_0xe9bd('0x41')]);if(_0x46576b['offset'])_0x3f6f22['offset'](_0x46576b['offset']);return db['sequelize'][_0xe9bd('0x3a')](_0x3f6f22[_0xe9bd('0x91')](),_0x12aef8);})[_0xe9bd('0x28')](function(_0x4d2083){_0x3817ab[_0xe9bd('0x70')](_0xe9bd('0xa7'),_['map'](_0x4d2083,'id'));return db['sequelize'][_0xe9bd('0x3a')](_0x3817ab[_0xe9bd('0x91')](),_0x12aef8)[_0xe9bd('0x28')](function(_0x938121){var _0x23a145=_['groupBy'](_0x938121,'SmsInteractionId');var _0x499771=[];_0x4d2083[_0xe9bd('0x32')](function(_0x2c7a14){_0x499771[_0xe9bd('0x33')](updateSmsInteraction(_0x2c7a14,_0x2ef01b,_0x23a145));});return BPromise[_0xe9bd('0xa8')](_0x499771);});});})[_0xe9bd('0x28')](function(_0x351226){_0x2ad46e[_0xe9bd('0xa9')]=_0x351226;return _0x2ad46e;})[_0xe9bd('0x28')](respondWithFilteredResult(_0x32b3e3,_0x46576b));})[_0xe9bd('0x34')](handleError(_0x32b3e3,null));};exports[_0xe9bd('0xaa')]=function(_0x59a31e,_0xb1203d){var _0x5b8938={'raw':![],'where':{'id':_0x59a31e['params']['id']}},_0x116815={};_0x116815['model']=_[_0xe9bd('0x6d')](db['SmsInteraction'][_0xe9bd('0x37')]);_0x116815['query']=_[_0xe9bd('0x6d')](_0x59a31e[_0xe9bd('0x3a')]);_0x116815[_0xe9bd('0x3b')]=_[_0xe9bd('0xab')](_0x116815[_0xe9bd('0x3c')],_0x116815[_0xe9bd('0x3a')]);_0x5b8938['attributes']=_[_0xe9bd('0xab')](_0x116815[_0xe9bd('0x3c')],qs['fields'](_0x59a31e[_0xe9bd('0x3a')][_0xe9bd('0x3e')]));_0x5b8938[_0xe9bd('0x3d')]=_0x5b8938['attributes'][_0xe9bd('0x59')]?_0x5b8938[_0xe9bd('0x3d')]:_0x116815[_0xe9bd('0x3c')];if(_0x59a31e[_0xe9bd('0x3a')][_0xe9bd('0xac')]){_0x5b8938['include']=[{'all':!![]}];}_0x5b8938=_[_0xe9bd('0x94')]({},_0x5b8938,_0x59a31e[_0xe9bd('0xad')]);return db['SmsInteraction'][_0xe9bd('0x62')](_0x5b8938)[_0xe9bd('0x28')](handleEntityNotFound(_0xb1203d,null))[_0xe9bd('0x28')](respondWithResult(_0xb1203d,null))[_0xe9bd('0x34')](handleError(_0xb1203d,null));};exports['create']=function(_0x3e35ab,_0x2115d8){return db[_0xe9bd('0x36')][_0xe9bd('0xae')](_0x3e35ab[_0xe9bd('0xaf')],{})[_0xe9bd('0x28')](respondWithResult(_0x2115d8,0xc9))[_0xe9bd('0x34')](handleError(_0x2115d8,null));};exports['update']=function(_0x7c3e0a,_0x59719e){if(_0x7c3e0a[_0xe9bd('0xaf')]['id']){delete _0x7c3e0a[_0xe9bd('0xaf')]['id'];}return db[_0xe9bd('0x36')]['find']({'where':{'id':_0x7c3e0a[_0xe9bd('0xb0')]['id']}})['then'](handleEntityNotFound(_0x59719e,null))[_0xe9bd('0x28')](saveUpdates(_0x7c3e0a[_0xe9bd('0xaf')],null))[_0xe9bd('0x28')](respondWithResult(_0x59719e,null))[_0xe9bd('0x34')](handleError(_0x59719e,null));};exports[_0xe9bd('0x29')]=function(_0x2e2f30,_0x4f6a50){return db[_0xe9bd('0x36')][_0xe9bd('0x62')]({'where':{'id':_0x2e2f30[_0xe9bd('0xb0')]['id']}})[_0xe9bd('0x28')](handleEntityNotFound(_0x4f6a50,null))['then'](removeEntity(_0x4f6a50,null))[_0xe9bd('0x34')](handleError(_0x4f6a50,null));};exports[_0xe9bd('0xb1')]=function(_0x261af6,_0x5dad5e){return db[_0xe9bd('0x36')][_0xe9bd('0xb1')]()['then'](respondWithResult(_0x5dad5e,null))['catch'](handleError(_0x5dad5e,null));};exports['addMessage']=function(_0x52df8f,_0x458bff,_0x3b32a9){return db[_0xe9bd('0xb2')]['find']({'where':{'id':_0x52df8f[_0xe9bd('0xb0')]['id']}})[_0xe9bd('0x28')](handleEntityNotFound(_0x458bff,null))['then'](function(_0x8b7a95){if(_0x8b7a95){return _0x8b7a95[_0xe9bd('0xb3')](_0x52df8f[_0xe9bd('0xaf')][_0xe9bd('0xb4')],_[_0xe9bd('0xb5')](_0x52df8f['body'],[_0xe9bd('0xb4'),'id'])||{});}})[_0xe9bd('0x28')](respondWithResult(_0x458bff,null))['catch'](handleError(_0x458bff,null));};exports['getMessages']=function(_0x54ffbd,_0x4fbbd6,_0x411ae0){var _0x26b67a={'raw':![],'where':{}};var _0x365b7f={};var _0xae352d={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x54ffbd[_0xe9bd('0xb0')]['id']}})[_0xe9bd('0x28')](handleEntityNotFound(_0x4fbbd6,null))[_0xe9bd('0x28')](function(_0x4ee46c){if(_0x4ee46c){_0x365b7f[_0xe9bd('0x3c')]=_[_0xe9bd('0x6d')](db['SmsMessage']['rawAttributes']);_0x365b7f[_0xe9bd('0x3a')]=_[_0xe9bd('0x6d')](_0x54ffbd[_0xe9bd('0x3a')]);_0x365b7f[_0xe9bd('0x3b')]=_[_0xe9bd('0xab')](_0x365b7f[_0xe9bd('0x3c')],_0x365b7f[_0xe9bd('0x3a')]);_0x26b67a[_0xe9bd('0x3d')]=_[_0xe9bd('0xab')](_0x365b7f['model'],qs[_0xe9bd('0x3e')](_0x54ffbd[_0xe9bd('0x3a')][_0xe9bd('0x3e')]));_0x26b67a[_0xe9bd('0x3d')]=_0x26b67a[_0xe9bd('0x3d')][_0xe9bd('0x59')]?_0x26b67a['attributes']:_0x365b7f[_0xe9bd('0x3c')];if(!_0x54ffbd['query'][_0xe9bd('0x3f')]('nolimit')){_0x26b67a[_0xe9bd('0x41')]=qs[_0xe9bd('0x41')](_0x54ffbd['query'][_0xe9bd('0x41')]);_0x26b67a[_0xe9bd('0x21')]=qs['offset'](_0x54ffbd[_0xe9bd('0x3a')][_0xe9bd('0x21')]);}_0x26b67a[_0xe9bd('0x87')]=qs[_0xe9bd('0x42')](_0x54ffbd['query'][_0xe9bd('0x42')]);_0x26b67a[_0xe9bd('0x70')]=qs['filters'](_[_0xe9bd('0x43')](_0x54ffbd[_0xe9bd('0x3a')],_0x365b7f[_0xe9bd('0x3b')]));_0x26b67a['where'][_0xe9bd('0xb6')]=_0x4ee46c['id'];if(_0x54ffbd[_0xe9bd('0x3a')][_0xe9bd('0x7c')]){_0x26b67a[_0xe9bd('0x70')]=_[_0xe9bd('0x94')](_0x26b67a[_0xe9bd('0x70')],{'$or':_[_0xe9bd('0x2d')](_0x26b67a['attributes'],function(_0x121498){var _0x2e1c0f={};_0x2e1c0f[_0x121498]={'$like':'%'+_0x54ffbd[_0xe9bd('0x3a')]['filter']+'%'};return _0x2e1c0f;})});}if(_0x54ffbd[_0xe9bd('0x3a')]['$gte']){var _0x5ba105=_0x54ffbd['query'][_0xe9bd('0x75')]['split'](',');var _0x516080={};_0x516080[_0x5ba105[0x0]]={'$gte':moment(_0x5ba105[0x1])[_0xe9bd('0xb7')](_0xe9bd('0xb8'))};_0x26b67a['where']=_[_0xe9bd('0x94')](_0x26b67a[_0xe9bd('0x70')],_0x516080);}_0x26b67a=_['merge']({},_0x26b67a,_0x54ffbd['options']);return db[_0xe9bd('0xb2')]['count']({'where':_0x26b67a['where']})[_0xe9bd('0x28')](function(_0x1771b1){_0xae352d[_0xe9bd('0x20')]=_0x1771b1;if(_0x54ffbd[_0xe9bd('0x3a')][_0xe9bd('0xac')]){_0x26b67a[_0xe9bd('0xb9')]=[{'all':!![]}];}return db[_0xe9bd('0xb2')]['findAll'](_0x26b67a);})[_0xe9bd('0x28')](function(_0x521dec){_0xae352d['rows']=_0x521dec;return _0xae352d;});}})[_0xe9bd('0x28')](respondWithFilteredResult(_0x4fbbd6,_0x26b67a))[_0xe9bd('0x34')](handleError(_0x4fbbd6,null));};exports[_0xe9bd('0xba')]=function(_0x3d168b,_0x3e5f25,_0x55dc1d){return db[_0xe9bd('0x36')][_0xe9bd('0x62')]({'where':{'id':_0x3d168b[_0xe9bd('0xb0')]['id']}})[_0xe9bd('0x28')](handleEntityNotFound(_0x3e5f25,null))[_0xe9bd('0x28')](function(_0x1279a9){if(_0x1279a9){return _0x1279a9['setTags'](_0x3d168b[_0xe9bd('0xaf')][_0xe9bd('0xb4')],_[_0xe9bd('0xb5')](_0x3d168b[_0xe9bd('0xaf')],[_0xe9bd('0xb4'),'id'])||{})[_0xe9bd('0xbb')](function(){return db['Tag'][_0xe9bd('0xbc')]({'attributes':['id',_0xe9bd('0x2b'),'color'],'where':{'id':_0x3d168b[_0xe9bd('0xaf')][_0xe9bd('0xb4')]}});})[_0xe9bd('0x28')](function(_0x1e63d3){socket['emit'](_0xe9bd('0xbd'),{'id':Number(_0x3d168b[_0xe9bd('0xb0')]['id']),'tags':_0x1e63d3||[]});return{'id':Number(_0x3d168b[_0xe9bd('0xb0')]['id']),'tags':_0x1e63d3||[]};});}})[_0xe9bd('0x28')](respondWithResult(_0x3e5f25,null))[_0xe9bd('0x34')](handleError(_0x3e5f25,null));};exports[_0xe9bd('0xbe')]=function(_0x43557b,_0x1940e7,_0x41506b){return db['SmsInteraction'][_0xe9bd('0x62')]({'where':{'id':_0x43557b[_0xe9bd('0xb0')]['id']}})[_0xe9bd('0x28')](handleEntityNotFound(_0x1940e7,null))[_0xe9bd('0x28')](function(_0x1e25e8){if(_0x1e25e8){return _0x1e25e8[_0xe9bd('0xbe')](_0x43557b[_0xe9bd('0x3a')]['ids']);}})[_0xe9bd('0x28')](respondWithStatusCode(_0x1940e7,null))['catch'](handleError(_0x1940e7,null));};exports[_0xe9bd('0xbf')]=function(_0xbc686e,_0x2db271){var _0x1c2d6d=moment()[_0xe9bd('0xc0')]()[_0xe9bd('0x91')]();var _0x5bf65b=path[_0xe9bd('0xc1')](config[_0xe9bd('0xc2')],_0xe9bd('0xc3'),'files',_0xe9bd('0xc4'));var _0x2c3474=path[_0xe9bd('0xc1')](config[_0xe9bd('0xc2')],_0xe9bd('0xc3'),_0xe9bd('0xc5'),_0xe9bd('0xc6'));var _0x1c3af9=path[_0xe9bd('0xc1')](_0x5bf65b,_0x1c2d6d);var _0x3b0874=util['format'](_0xe9bd('0xc7'),_0xbc686e[_0xe9bd('0xb0')]['id'],_0x1c2d6d);var _0x31aae8=path['join'](_0x5bf65b,_0x3b0874);var _0x28a6b6=[];_0x28a6b6[_0xe9bd('0x33')]({'model':db[_0xe9bd('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x28a6b6[_0xe9bd('0x33')]({'model':db[_0xe9bd('0xc8')],'as':_0xe9bd('0x5f'),'attributes':['id',_0xe9bd('0xc9'),_0xe9bd('0xca')],'raw':!![]});var _0x464102=[{'model':db[_0xe9bd('0xb2')],'as':'Messages','attributes':['id',_0xe9bd('0xaf'),_0xe9bd('0x73'),'direction',_0xe9bd('0xcb'),_0xe9bd('0xcc')],'include':_0x28a6b6}];_0x464102[_0xe9bd('0x33')]({'model':db[_0xe9bd('0xcd')],'as':_0xe9bd('0xce'),'attributes':['id',_0xe9bd('0x2b')]});_0x464102[_0xe9bd('0x33')]({'model':db[_0xe9bd('0x69')],'as':_0xe9bd('0xcf'),'attributes':['id',_0xe9bd('0x2e')]});return db[_0xe9bd('0x36')][_0xe9bd('0x62')]({'where':{'id':_0xbc686e[_0xe9bd('0xb0')]['id']},'include':_0x464102})[_0xe9bd('0x28')](handleEntityNotFound(_0x2db271,null))[_0xe9bd('0x28')](function(_0x58f68a){if(_0x58f68a){var _0x17c8e8=_0x58f68a[_0xe9bd('0xd0')]({'plain':!![]});fs[_0xe9bd('0xd1')](_0x1c3af9);var _0x1b159a={'format':'A4','border':_0xe9bd('0xd2'),'header':{'height':'40px','contents':{'first':_0xe9bd('0xd3')}},'footer':{'height':_0xe9bd('0xd4'),'contents':{'default':util[_0xe9bd('0xb7')](_0xe9bd('0xd5'),util[_0xe9bd('0xb7')](_0xe9bd('0xd6'),_0xe9bd('0xd7'),_0x17c8e8['id']),moment()[_0xe9bd('0xb7')](_0xe9bd('0xd8'))[_0xe9bd('0x91')]())}}};var _0x2a8861={'channel':_0xe9bd('0xd7'),'account':_0x17c8e8[_0xe9bd('0xce')]['name'],'agent':_0x17c8e8[_0xe9bd('0xcf')]?_0x17c8e8[_0xe9bd('0xcf')][_0xe9bd('0x2e')]:_0xe9bd('0xd9'),'createdAt':moment(_0x17c8e8[_0xe9bd('0x73')])[_0xe9bd('0xb7')](_0xe9bd('0xb8'))[_0xe9bd('0x91')](),'closedAt':_0x17c8e8[_0xe9bd('0xda')]?moment(_0x17c8e8[_0xe9bd('0xdb')])[_0xe9bd('0xb7')](_0xe9bd('0xb8'))['toString']():'','disposition':_0x17c8e8[_0xe9bd('0xdc')],'messages':_(_0x17c8e8[_0xe9bd('0xdd')])[_0xe9bd('0x7c')]({'secret':![]})[_0xe9bd('0x2d')](function(_0x1958fa){return{'date':moment(_0x1958fa['createdAt'])[_0xe9bd('0xb7')](_0xe9bd('0xb8'))[_0xe9bd('0x91')](),'sender':_0x1958fa['direction']===_0xe9bd('0xde')?_0x1958fa[_0xe9bd('0x69')]?_0x1958fa['User']['fullname']:'System':_0x1958fa[_0xe9bd('0x5f')][_0xe9bd('0xc9')]+(_0x1958fa['Contact'][_0xe9bd('0xca')]?'\x20'+_0x1958fa[_0xe9bd('0x5f')][_0xe9bd('0xca')]:''),'body':_0x1958fa['body'],'direction':_0x1958fa[_0xe9bd('0xdf')]===_0xe9bd('0xde')?'A':'C','secret':_0x1958fa[_0xe9bd('0xcb')],'read':_0x1958fa[_0xe9bd('0xcc')]};})['value']()};return ejs[_0xe9bd('0xe0')](path[_0xe9bd('0xc1')](config['root'],_0xe9bd('0xc3'),_0xe9bd('0xe1'),_0xe9bd('0xe2')),{'interaction':_0x2a8861})[_0xe9bd('0x28')](function(_0x5103d0){return new BPromise(function(_0x4b381e,_0x5bad39){pdf[_0xe9bd('0xae')](_0x5103d0,_0x1b159a)['toFile'](path[_0xe9bd('0xc1')](_0x1c3af9,_0xe9bd('0xe3')+_0x17c8e8['id']+'-'+_0x1c2d6d+_0xe9bd('0xe4')),function(_0x41b16f,_0x1d5b7e){if(_0x41b16f)return _0x5bad39(_0x41b16f);_0x4b381e(_0x1d5b7e);});});})[_0xe9bd('0x28')](function(){return new BPromise(function(_0x53b73c,_0x117c16){zipdir(_0x1c3af9,{'saveTo':_0x31aae8},function(_0x389b87,_0x39cf76){if(_0x389b87)return _0x117c16(_0x389b87);return _0x53b73c(_0x39cf76);});})[_0xe9bd('0x28')](function(){return new BPromise(function(_0x30f512,_0x27740c){rimraf(_0x1c3af9,function(_0x25def7){if(_0x25def7)_0x27740c(_0x25def7);return _0x30f512();});});})['then'](function(){return _0x2db271[_0xe9bd('0xbf')](_0x31aae8,_0x3b0874,function(_0x40abfd){if(_0x40abfd){console[_0xe9bd('0xe5')](_0xe9bd('0xe6'),_0x40abfd);}else{fs['unlinkSync'](_0x31aae8);}});});});}else{return _0x2db271[_0xe9bd('0x1c')](0xc8);}})[_0xe9bd('0x34')](handleError(_0x2db271,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7ddbdc9..88c4122 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 _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x28e7a1,_0x56612e){var _0x50b1eb=function(_0x3a8ded){while(--_0x3a8ded){_0x28e7a1['push'](_0x28e7a1['shift']());}};_0x50b1eb(++_0x56612e);}(_0xb647,0xdb));var _0x7b64=function(_0x1a7543,_0x3936f8){_0x1a7543=_0x1a7543-0x0;var _0x232352=_0xb647[_0x1a7543];return _0x232352;};'use strict';var EventEmitter=require(_0x7b64('0x0'));var SmsInteraction=require(_0x7b64('0x1'))['db'][_0x7b64('0x2')];var SmsMessage=require(_0x7b64('0x1'))['db'][_0x7b64('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x7b64('0x4')](0x0);var events={'afterCreate':_0x7b64('0x5'),'afterUpdate':_0x7b64('0x6'),'afterDestroy':'remove'};function emitEvent(_0x36ff12){return function(_0x4aaa21,_0x1daa28,_0x38ebf7){_0x4aaa21[_0x7b64('0x7')]({'attributes':['id'],'raw':!![]})[_0x7b64('0x8')](function(_0xcdec41){_0x4aaa21[_0x7b64('0x9')](_0x7b64('0xa'),_0xcdec41[_0x7b64('0xb')](function(_0x432ced){return{'id':_0x432ced['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4aaa21['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7b64('0x8')](function(_0x49718f){_0x4aaa21[_0x7b64('0x9')]('unreadMessages',_0x49718f['length']);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12+':'+_0x4aaa21['id'],_0x4aaa21);SmsInteractionEvents[_0x7b64('0xc')](_0x36ff12,_0x4aaa21);_0x38ebf7(null);})['catch'](_0x38ebf7(null));};}for(var e in events){if(events[_0x7b64('0xd')](e)){var event=events[e];SmsInteraction[_0x7b64('0xe')](e,emitEvent(event));}}module[_0x7b64('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x4006=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','update','then','setDataValue','Users'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x4006,0x1c7));var _0x6400=function(_0x360d26,_0x700e92){_0x360d26=_0x360d26-0x0;var _0x180eef=_0x4006[_0x360d26];return _0x180eef;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x6400('0x0'))['db'][_0x6400('0x1')];var SmsMessage=require(_0x6400('0x0'))['db'][_0x6400('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6400('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd858df){return function(_0x59fba5,_0x4a0d3f,_0x2dbd03){_0x59fba5['getUsers']({'attributes':['id'],'raw':!![]})[_0x6400('0x4')](function(_0x2d365b){_0x59fba5[_0x6400('0x5')](_0x6400('0x6'),_0x2d365b['map'](function(_0x31cc99){return{'id':_0x31cc99['id']};}));return SmsMessage[_0x6400('0x7')]({'where':{'SmsInteractionId':_0x59fba5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6400('0x4')](function(_0x356982){_0x59fba5[_0x6400('0x5')](_0x6400('0x8'),_0x356982[_0x6400('0x9')]);SmsInteractionEvents[_0x6400('0xa')](_0xd858df+':'+_0x59fba5['id'],_0x59fba5);SmsInteractionEvents[_0x6400('0xa')](_0xd858df,_0x59fba5);_0x2dbd03(null);})[_0x6400('0xb')](_0x2dbd03(null));};}for(var e in events){if(events[_0x6400('0xc')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x6400('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 08cd5d7..b1fc941 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 _0x8b00=['exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x35e452,_0x3ea3f3){var _0x45de6e=function(_0x3ae2e1){while(--_0x3ae2e1){_0x35e452['push'](_0x35e452['shift']());}};_0x45de6e(++_0x3ea3f3);}(_0x8b00,0x1d2));var _0x08b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b00[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x08b0('0x0'));var util=require(_0x08b0('0x1'));var logger=require('../../config/logger')(_0x08b0('0x2'));var moment=require(_0x08b0('0x3'));var BPromise=require(_0x08b0('0x4'));var rp=require(_0x08b0('0x5'));var fs=require('fs');var path=require(_0x08b0('0x6'));var rimraf=require(_0x08b0('0x7'));var config=require(_0x08b0('0x8'));var attributes=require(_0x08b0('0x9'));module[_0x08b0('0xa')]=function(_0x2254fd,_0x545205){return _0x2254fd[_0x08b0('0xb')](_0x08b0('0xc'),attributes,{'tableName':_0x08b0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x56b123,_0x305297,_0x31eed1){if(_0x56b123['changed'](_0x08b0('0xe'))){_0x56b123[_0x08b0('0xf')]=moment()[_0x08b0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31eed1(null,_0x56b123);}}});}; \ No newline at end of file +var _0x3211=['./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3211,0x75));var _0x1321=function(_0x4764cd,_0x36f5f0){_0x4764cd=_0x4764cd-0x0;var _0x141daf=_0x3211[_0x4764cd];return _0x141daf;};'use strict';var _=require(_0x1321('0x0'));var util=require(_0x1321('0x1'));var logger=require(_0x1321('0x2'))(_0x1321('0x3'));var moment=require(_0x1321('0x4'));var BPromise=require(_0x1321('0x5'));var rp=require(_0x1321('0x6'));var fs=require('fs');var path=require(_0x1321('0x7'));var rimraf=require(_0x1321('0x8'));var config=require('../../config/environment');var attributes=require(_0x1321('0x9'));module[_0x1321('0xa')]=function(_0x4dfa4d,_0x264e1a){return _0x4dfa4d[_0x1321('0xb')](_0x1321('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fcbb4,_0x12d161,_0x55c344){if(_0x3fcbb4[_0x1321('0xd')](_0x1321('0xe'))){_0x3fcbb4[_0x1321('0xf')]=moment()[_0x1321('0x10')](_0x1321('0x11'));}_0x55c344(null,_0x3fcbb4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index b50e269..cf706a1 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 _0x39fb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x39fb,0x1f2));var _0xb39f=function(_0x1444dd,_0x4494de){_0x1444dd=_0x1444dd-0x0;var _0x37035d=_0x39fb[_0x1444dd];return _0x37035d;};'use strict';var _=require(_0xb39f('0x0'));var util=require(_0xb39f('0x1'));var moment=require(_0xb39f('0x2'));var BPromise=require(_0xb39f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb39f('0x4'));var db=require(_0xb39f('0x5'))['db'];var utils=require(_0xb39f('0x6'));var logger=require(_0xb39f('0x7'))('rpc');var config=require(_0xb39f('0x8'));var jayson=require(_0xb39f('0x9'));var client=jayson[_0xb39f('0xa')]['http']({'port':0x232a});config[_0xb39f('0xb')]=_[_0xb39f('0xc')](config[_0xb39f('0xb')],{'host':_0xb39f('0xd'),'port':0x18eb});var socket=require(_0xb39f('0xe'))(new Redis(config[_0xb39f('0xb')]));require('./smsInteraction.socket')[_0xb39f('0xf')](socket);function respondWithRpcPromise(_0x507f35,_0x333e46,_0x2d88ff){return new BPromise(function(_0x3d8631,_0x3fdbc5){return client[_0xb39f('0x10')](_0x507f35,_0x2d88ff)[_0xb39f('0x11')](function(_0x3df41d){logger[_0xb39f('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x333e46,_0xb39f('0x13'));logger[_0xb39f('0x14')](_0xb39f('0x15'),_0x333e46,_0xb39f('0x13'),JSON[_0xb39f('0x16')](_0x3df41d));if(_0x3df41d[_0xb39f('0x17')]){if(_0x3df41d[_0xb39f('0x17')][_0xb39f('0x18')]===0x1f4){logger[_0xb39f('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x333e46,_0x3df41d['error'][_0xb39f('0x19')]);return _0x3fdbc5(_0x3df41d['error'][_0xb39f('0x19')]);}logger[_0xb39f('0x17')](_0xb39f('0x1a'),_0x333e46,_0x3df41d[_0xb39f('0x17')][_0xb39f('0x19')]);return _0x3d8631(_0x3df41d[_0xb39f('0x17')]['message']);}else{logger[_0xb39f('0x12')](_0xb39f('0x1a'),_0x333e46,'request\x20sent');_0x3d8631(_0x3df41d['result'][_0xb39f('0x19')]);}})[_0xb39f('0x1b')](function(_0xb1d06e){logger[_0xb39f('0x17')](_0xb39f('0x1a'),_0x333e46,_0xb1d06e);_0x3fdbc5(_0xb1d06e);});});}exports[_0xb39f('0x1c')]=function(_0x58cd74){var _0x166f18=this;return new Promise(function(_0x2b3d15,_0xe92742){return db['SmsInteraction']['update'](_0x58cd74[_0xb39f('0x1d')],{'raw':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x20')]||null:null,'attributes':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x21')]||null:null,'limit':_0x58cd74[_0xb39f('0x1e')]?_0x58cd74[_0xb39f('0x1e')][_0xb39f('0x22')]||null:null})[_0xb39f('0x11')](function(_0x59df2f){logger[_0xb39f('0x12')](_0xb39f('0x1c'),_0x58cd74);logger[_0xb39f('0x14')]('UpdateSmsInteraction',_0x58cd74,JSON[_0xb39f('0x16')](_0x59df2f));_0x2b3d15(_0x59df2f);})[_0xb39f('0x1b')](function(_0x15975f){logger[_0xb39f('0x17')](_0xb39f('0x1c'),_0x15975f[_0xb39f('0x19')],_0x58cd74);_0xe92742(_0x166f18[_0xb39f('0x17')](0x1f4,_0x15975f['message']));});});};exports[_0xb39f('0x23')]=function(_0xb6fe7f){return new Promise(function(_0x20367c,_0x1fbc31){return db[_0xb39f('0x24')][_0xb39f('0x25')]({'where':_0xb6fe7f[_0xb39f('0x1e')]?_0xb6fe7f[_0xb39f('0x1e')][_0xb39f('0x20')]||null:null})[_0xb39f('0x11')](function(_0x591e7c){if(_0x591e7c){return _0x591e7c['addTags'](_0xb6fe7f[_0xb39f('0x1d')][_0xb39f('0x26')],_[_0xb39f('0x27')](_0xb6fe7f[_0xb39f('0x1d')],[_0xb39f('0x26'),'id'])||{});}})[_0xb39f('0x28')](function(_0x483883){logger[_0xb39f('0x12')]('AddTags',_0xb6fe7f);logger[_0xb39f('0x14')](_0xb39f('0x29'),_0xb6fe7f,JSON[_0xb39f('0x16')](_0x483883));_0x20367c(_0x483883);})[_0xb39f('0x1b')](function(_0x353b9e){logger[_0xb39f('0x17')](_0xb39f('0x29'),_0x353b9e[_0xb39f('0x19')],_0xb6fe7f);_0x1fbc31(_this['error'](0x1f4,_0x353b9e[_0xb39f('0x19')]));});});}; \ No newline at end of file +var _0x528a=['../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','then','catch','AddTagsToSmsInteraction','omit','ids','spread','stringify','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x528a,0xc2));var _0xa528=function(_0x439114,_0x510de1){_0x439114=_0x439114-0x0;var _0x174ef0=_0x528a[_0x439114];return _0x174ef0;};'use strict';var _=require(_0xa528('0x0'));var util=require('util');var moment=require(_0xa528('0x1'));var BPromise=require(_0xa528('0x2'));var rs=require(_0xa528('0x3'));var fs=require('fs');var Redis=require(_0xa528('0x4'));var db=require(_0xa528('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa528('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa528('0x7'));var client=jayson[_0xa528('0x8')]['http']({'port':0x232a});config[_0xa528('0x9')]=_[_0xa528('0xa')](config['redis'],{'host':_0xa528('0xb'),'port':0x18eb});var socket=require(_0xa528('0xc'))(new Redis(config[_0xa528('0x9')]));require('./smsInteraction.socket')[_0xa528('0xd')](socket);function respondWithRpcPromise(_0xe6c13e,_0x769f8c,_0x30c6cd){return new BPromise(function(_0x42aaee,_0x5db2a8){return client[_0xa528('0xe')](_0xe6c13e,_0x30c6cd)['then'](function(_0x56feea){logger[_0xa528('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x769f8c,_0xa528('0x10'));logger[_0xa528('0x11')](_0xa528('0x12'),_0x769f8c,_0xa528('0x10'),JSON['stringify'](_0x56feea));if(_0x56feea[_0xa528('0x13')]){if(_0x56feea[_0xa528('0x13')][_0xa528('0x14')]===0x1f4){logger[_0xa528('0x13')](_0xa528('0x15'),_0x769f8c,_0x56feea[_0xa528('0x13')][_0xa528('0x16')]);return _0x5db2a8(_0x56feea[_0xa528('0x13')]['message']);}logger[_0xa528('0x13')](_0xa528('0x15'),_0x769f8c,_0x56feea[_0xa528('0x13')][_0xa528('0x16')]);return _0x42aaee(_0x56feea[_0xa528('0x13')][_0xa528('0x16')]);}else{logger[_0xa528('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x769f8c,_0xa528('0x10'));_0x42aaee(_0x56feea[_0xa528('0x17')][_0xa528('0x16')]);}})['catch'](function(_0x10662c){logger[_0xa528('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x769f8c,_0x10662c);_0x5db2a8(_0x10662c);});});}exports[_0xa528('0x18')]=function(_0x27dc3b){var _0x3afa50=this;return new Promise(function(_0x27ac98,_0x520c8b){return db[_0xa528('0x19')][_0xa528('0x1a')](_0x27dc3b[_0xa528('0x1b')],{'raw':_0x27dc3b[_0xa528('0x1c')]?_0x27dc3b[_0xa528('0x1c')][_0xa528('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27dc3b[_0xa528('0x1c')]?_0x27dc3b[_0xa528('0x1c')][_0xa528('0x1e')]||null:null,'attributes':_0x27dc3b[_0xa528('0x1c')]?_0x27dc3b[_0xa528('0x1c')][_0xa528('0x1f')]||null:null,'limit':_0x27dc3b['options']?_0x27dc3b[_0xa528('0x1c')]['limit']||null:null})[_0xa528('0x20')](function(_0x47dd73){logger[_0xa528('0xf')]('UpdateSmsInteraction',_0x27dc3b);logger[_0xa528('0x11')](_0xa528('0x18'),_0x27dc3b,JSON['stringify'](_0x47dd73));_0x27ac98(_0x47dd73);})[_0xa528('0x21')](function(_0x30f153){logger['error']('UpdateSmsInteraction',_0x30f153[_0xa528('0x16')],_0x27dc3b);_0x520c8b(_0x3afa50[_0xa528('0x13')](0x1f4,_0x30f153[_0xa528('0x16')]));});});};exports[_0xa528('0x22')]=function(_0x1d33cd){return new Promise(function(_0x5cbfca,_0x2bdf7a){return db[_0xa528('0x19')]['find']({'where':_0x1d33cd[_0xa528('0x1c')]?_0x1d33cd['options'][_0xa528('0x1e')]||null:null})[_0xa528('0x20')](function(_0x56b4da){if(_0x56b4da){return _0x56b4da['addTags'](_0x1d33cd[_0xa528('0x1b')]['ids'],_[_0xa528('0x23')](_0x1d33cd['body'],[_0xa528('0x24'),'id'])||{});}})[_0xa528('0x25')](function(_0x64463e){logger[_0xa528('0xf')]('AddTags',_0x1d33cd);logger[_0xa528('0x11')]('AddTags',_0x1d33cd,JSON[_0xa528('0x26')](_0x64463e));_0x5cbfca(_0x64463e);})[_0xa528('0x21')](function(_0x2d7cc6){logger['error'](_0xa528('0x27'),_0x2d7cc6[_0xa528('0x16')],_0x1d33cd);_0x2bdf7a(_this[_0xa528('0x13')](0x1f4,_0x2d7cc6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 52d854e..6412b1d 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 _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x258d6e,_0x54387b){var _0x1654f2=function(_0x1d58a7){while(--_0x1d58a7){_0x258d6e['push'](_0x258d6e['shift']());}};_0x1654f2(++_0x54387b);}(_0xb10b,0x12a));var _0xbb10=function(_0xa3d957,_0x5cefc3){_0xa3d957=_0xa3d957-0x0;var _0x1f2f67=_0xb10b[_0xa3d957];return _0x1f2f67;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x3d130e,_0x2129db){var _0x307c65=function(_0x4991b5){while(--_0x4991b5){_0x3d130e['push'](_0x3d130e['shift']());}};_0x307c65(++_0x2129db);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4346276..9787b9e 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 _0x9a50=['create','post','status','put','update','reject','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','smsmessage:create'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9a50,0x1eb));var _0x09a5=function(_0xa711b,_0x81a280){_0xa711b=_0xa711b-0x0;var _0x1f061d=_0x9a50[_0xa711b];return _0x1f061d;};'use strict';var multer=require('multer');var util=require(_0x09a5('0x0'));var path=require(_0x09a5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09a5('0x2')]();var auth=require(_0x09a5('0x3'));var interaction=require(_0x09a5('0x4'));var config=require(_0x09a5('0x5'));var controller=require(_0x09a5('0x6'));router[_0x09a5('0x7')]('/',auth[_0x09a5('0x8')](),controller[_0x09a5('0x9')]);router[_0x09a5('0x7')](_0x09a5('0xa'),auth[_0x09a5('0x8')](),controller[_0x09a5('0xb')]);router[_0x09a5('0x7')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0xd')]);router['post']('/',auth[_0x09a5('0x8')](),interaction['tracked']('sms',_0x09a5('0xe')),controller[_0x09a5('0xf')]);router[_0x09a5('0x10')]('/:id/status',controller[_0x09a5('0x11')]);router[_0x09a5('0x12')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0x13')]);router[_0x09a5('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x09a5('0x12')]('/:id/reject',auth[_0x09a5('0x8')](),controller[_0x09a5('0x14')]);router[_0x09a5('0x15')](_0x09a5('0xc'),auth[_0x09a5('0x8')](),controller[_0x09a5('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4dca=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x366635,_0x17f294){var _0x58b9af=function(_0x2f9e29){while(--_0x2f9e29){_0x366635['push'](_0x366635['shift']());}};_0x58b9af(++_0x17f294);}(_0x4dca,0x1a0));var _0xa4dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4dca[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa4dc('0x0'));var util=require(_0xa4dc('0x1'));var path=require(_0xa4dc('0x2'));var timeout=require(_0xa4dc('0x3'));var express=require(_0xa4dc('0x4'));var router=express[_0xa4dc('0x5')]();var auth=require(_0xa4dc('0x6'));var interaction=require(_0xa4dc('0x7'));var config=require(_0xa4dc('0x8'));var controller=require(_0xa4dc('0x9'));router[_0xa4dc('0xa')]('/',auth[_0xa4dc('0xb')](),controller[_0xa4dc('0xc')]);router[_0xa4dc('0xa')](_0xa4dc('0xd'),auth[_0xa4dc('0xb')](),controller[_0xa4dc('0xe')]);router['get'](_0xa4dc('0xf'),auth[_0xa4dc('0xb')](),controller[_0xa4dc('0x10')]);router[_0xa4dc('0x11')]('/',auth['isAuthenticated'](),interaction[_0xa4dc('0x12')](_0xa4dc('0x13'),_0xa4dc('0x14')),controller[_0xa4dc('0x15')]);router['post']('/:id/status',controller[_0xa4dc('0x16')]);router['put'](_0xa4dc('0xf'),auth['isAuthenticated'](),controller[_0xa4dc('0x17')]);router[_0xa4dc('0x18')](_0xa4dc('0x19'),auth[_0xa4dc('0xb')](),controller[_0xa4dc('0x1a')]);router[_0xa4dc('0x18')](_0xa4dc('0x1b'),auth[_0xa4dc('0xb')](),controller[_0xa4dc('0x1c')]);router[_0xa4dc('0x1d')](_0xa4dc('0xf'),auth['isAuthenticated'](),controller[_0xa4dc('0x1e')]);module[_0xa4dc('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4573728..e4ab6a8 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 _0xc4f5=['out','STRING','DATE','TEXT','BOOLEAN','ENUM'];(function(_0x1f6ba3,_0x5b7a1d){var _0x218b24=function(_0x1fc7d7){while(--_0x1fc7d7){_0x1f6ba3['push'](_0x1f6ba3['shift']());}};_0x218b24(++_0x5b7a1d);}(_0xc4f5,0x75));var _0x5c4f=function(_0x273bb2,_0x319264){_0x273bb2=_0x273bb2-0x0;var _0x22f932=_0xc4f5[_0x273bb2];return _0x22f932;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5c4f('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5c4f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5c4f('0x2')]('in',_0x5c4f('0x3')),'defaultValue':_0x5c4f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5c4f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x5c4f('0x4')]},'readAt':{'type':Sequelize[_0x5c4f('0x5')]},'secret':{'type':Sequelize[_0x5c4f('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x8e01=['out','STRING','DATE','BOOLEAN','sequelize','exports','medium','ENUM'];(function(_0x285bba,_0xf09516){var _0x4c8060=function(_0x513a6d){while(--_0x513a6d){_0x285bba['push'](_0x285bba['shift']());}};_0x4c8060(++_0xf09516);}(_0x8e01,0x1f4));var _0x18e0=function(_0x37c742,_0x291860){_0x37c742=_0x37c742-0x0;var _0x34f281=_0x8e01[_0x37c742];return _0x34f281;};'use strict';var Sequelize=require(_0x18e0('0x0'));module[_0x18e0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x18e0('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x18e0('0x3')]('in',_0x18e0('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x18e0('0x5')]},'readAt':{'type':Sequelize[_0x18e0('0x6')]},'secret':{'type':Sequelize[_0x18e0('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3bbb75b..f06598c 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 _0xae60=['rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','name','index','map','SmsMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','rawAttributes','find','create','body','params','destroy','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage'];(function(_0x332a78,_0x4d38b3){var _0x537ac5=function(_0x1a7526){while(--_0x1a7526){_0x332a78['push'](_0x332a78['shift']());}};_0x537ac5(++_0x4d38b3);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xae60[_0x4a3898];return _0x25ceb0;};'use strict';var pdf=require(_0x0ae6('0x0'));var emlformat=require(_0x0ae6('0x1'));var rimraf=require(_0x0ae6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ae6('0x3'));var rp=require(_0x0ae6('0x4'));var moment=require(_0x0ae6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ae6('0x6'));var util=require(_0x0ae6('0x7'));var path=require('path');var sox=require(_0x0ae6('0x8'));var csv=require(_0x0ae6('0x9'));var ejs=require(_0x0ae6('0xa'));var fs=require('fs');var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var db=require(_0x0ae6('0x1a'))['db'];config[_0x0ae6('0x1b')]=_[_0x0ae6('0x1c')](config[_0x0ae6('0x1b')],{'host':_0x0ae6('0x1d'),'port':0x18eb});var socket=require(_0x0ae6('0x1e'))(new Redis(config[_0x0ae6('0x1b')]));require(_0x0ae6('0x1f'))['register'](socket);var jayson=require(_0x0ae6('0x20'));var client=jayson[_0x0ae6('0x21')][_0x0ae6('0x22')]({'port':0x232c});var client9002=jayson[_0x0ae6('0x21')][_0x0ae6('0x22')]({'port':0x232a});function checkPasswordPattern(_0x3a1e26,_0x151144,_0x3b64ac){if(_0x3b64ac){var _0xa797bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa797bb[_0x0ae6('0x23')](_0x151144)){return _0x3a1e26;}else{throw new db[(_0x0ae6('0x24'))][(_0x0ae6('0x25'))](_0x0ae6('0x26'));}}else{return _0x3a1e26;}}function respondWithRpcPromise(_0xd0362c,_0xda4f01,_0x3f5c41,_0x2fdf25){return new BPromise(function(_0x1735ba,_0x2ca2a3){var _0x9e2c46=_0x2fdf25||client;return _0x9e2c46[_0x0ae6('0x27')](_0xd0362c,_0x3f5c41)[_0x0ae6('0x28')](function(_0x491a74){logger[_0x0ae6('0x29')](_0x0ae6('0x2a'),_0xda4f01,_0x0ae6('0x2b'));logger[_0x0ae6('0x2c')](_0x0ae6('0x2d'),_0xda4f01,_0x0ae6('0x2b'),JSON[_0x0ae6('0x2e')](_0x491a74));if(_0x491a74[_0x0ae6('0x2f')]){if(_0x491a74['error'][_0x0ae6('0x30')]===0x1f4){logger[_0x0ae6('0x2f')](_0x0ae6('0x2a'),_0xda4f01,_0x491a74[_0x0ae6('0x2f')][_0x0ae6('0x31')]);return _0x2ca2a3(_0x491a74['error'][_0x0ae6('0x31')]);}logger[_0x0ae6('0x2f')](_0x0ae6('0x2a'),_0xda4f01,_0x491a74[_0x0ae6('0x2f')][_0x0ae6('0x31')]);return _0x1735ba(_0x491a74[_0x0ae6('0x2f')]['message']);}else{logger[_0x0ae6('0x29')](_0x0ae6('0x2a'),_0xda4f01,'request\x20sent');_0x1735ba(_0x491a74['result'][_0x0ae6('0x31')]);}})[_0x0ae6('0x32')](function(_0x17360e){logger['error'](_0x0ae6('0x2a'),_0xda4f01,_0x17360e);_0x2ca2a3(_0x17360e);});});}function respondWithStatusCode(_0xb68cbe,_0x2533c2){_0x2533c2=_0x2533c2||0xcc;return function(_0x4df796){if(_0x4df796){return _0xb68cbe[_0x0ae6('0x33')](_0x2533c2);}return _0xb68cbe[_0x0ae6('0x34')](_0x2533c2)[_0x0ae6('0x35')]();};}function respondWithResult(_0x232fbd,_0x14eed5){_0x14eed5=_0x14eed5||0xc8;return function(_0x257af5){if(_0x257af5){return _0x232fbd['status'](_0x14eed5)['json'](_0x257af5);}};}function respondWithFilteredResult(_0x2d9f4e,_0x419384){return function(_0x4e6df8){if(_0x4e6df8){var _0x4a06f1=_0x4e6df8[_0x0ae6('0x36')],_0x1ca059=_0x419384['offset'],_0x278577=_0x419384[_0x0ae6('0x37')]+_0x419384[_0x0ae6('0x38')],_0x714c6d;if(_0x278577>=_0x4a06f1){_0x278577=_0x4a06f1;_0x714c6d=0xc8;}else{_0x714c6d=0xce;}_0x2d9f4e[_0x0ae6('0x34')](_0x714c6d);return _0x2d9f4e['set'](_0x0ae6('0x39'),_0x1ca059+'-'+_0x278577+'/'+_0x4a06f1)[_0x0ae6('0x3a')](_0x4e6df8);}return null;};}function patchUpdates(_0x2af8c0){return function(_0xe2fbf5){try{jsonpatch[_0x0ae6('0x3b')](_0xe2fbf5,_0x2af8c0,!![]);}catch(_0x2ba41f){return BPromise[_0x0ae6('0x3c')](_0x2ba41f);}return _0xe2fbf5[_0x0ae6('0x3d')]();};}function saveUpdates(_0x106bc3,_0x3a8b9c){return function(_0x4cb7d4){if(_0x4cb7d4){return _0x4cb7d4[_0x0ae6('0x3e')](_0x106bc3)[_0x0ae6('0x28')](function(_0x4a2cd1){return _0x4a2cd1;});}return null;};}function removeEntity(_0x3264d5,_0x3667d2){return function(_0x231fc4){if(_0x231fc4){return _0x231fc4['destroy']()[_0x0ae6('0x28')](function(){_0x3264d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d1af,_0x404f2e){return function(_0x18fc19){if(!_0x18fc19){_0x46d1af[_0x0ae6('0x33')](0x194);}return _0x18fc19;};}function handleError(_0xed1128,_0x5bf771){_0x5bf771=_0x5bf771||0x1f4;return function(_0x584dc8){logger[_0x0ae6('0x2f')](_0x584dc8['stack']);if(_0x584dc8[_0x0ae6('0x3f')]){delete _0x584dc8['name'];}_0xed1128[_0x0ae6('0x34')](_0x5bf771)['send'](_0x584dc8);};}exports[_0x0ae6('0x40')]=function(_0x1640e4,_0x6b8cf5){var _0x2204e5={},_0x5be17f={},_0x4a9c75={'count':0x0,'rows':[]};var _0x43414c=_[_0x0ae6('0x41')](db[_0x0ae6('0x42')]['rawAttributes'],function(_0xaeb354){return{'name':_0xaeb354['fieldName'],'type':_0xaeb354[_0x0ae6('0x43')][_0x0ae6('0x44')]};});_0x5be17f[_0x0ae6('0x45')]=_[_0x0ae6('0x41')](_0x43414c,_0x0ae6('0x3f'));_0x5be17f[_0x0ae6('0x46')]=_['keys'](_0x1640e4[_0x0ae6('0x46')]);_0x5be17f[_0x0ae6('0x47')]=_[_0x0ae6('0x48')](_0x5be17f[_0x0ae6('0x45')],_0x5be17f[_0x0ae6('0x46')]);_0x2204e5[_0x0ae6('0x49')]=_[_0x0ae6('0x48')](_0x5be17f[_0x0ae6('0x45')],qs['fields'](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4a')]));_0x2204e5[_0x0ae6('0x49')]=_0x2204e5[_0x0ae6('0x49')][_0x0ae6('0x4b')]?_0x2204e5[_0x0ae6('0x49')]:_0x5be17f[_0x0ae6('0x45')];if(!_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4c')](_0x0ae6('0x4d'))){_0x2204e5[_0x0ae6('0x38')]=qs[_0x0ae6('0x38')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x38')]);_0x2204e5[_0x0ae6('0x37')]=qs[_0x0ae6('0x37')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x37')]);}_0x2204e5['order']=qs[_0x0ae6('0x4e')](_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x4e')]);_0x2204e5[_0x0ae6('0x4f')]=qs[_0x0ae6('0x47')](_[_0x0ae6('0x50')](_0x1640e4['query'],_0x5be17f[_0x0ae6('0x47')]),_0x43414c);if(_0x1640e4[_0x0ae6('0x46')][_0x0ae6('0x51')]){_0x2204e5[_0x0ae6('0x4f')]=_['merge'](_0x2204e5['where'],{'$or':_['map'](_0x43414c,function(_0x295d06){if(_0x295d06[_0x0ae6('0x43')]!==_0x0ae6('0x52')){var _0x4ff1de={};_0x4ff1de[_0x295d06[_0x0ae6('0x3f')]]={'$like':'%'+_0x1640e4[_0x0ae6('0x46')]['filter']+'%'};return _0x4ff1de;}})});}_0x2204e5=_[_0x0ae6('0x53')]({},_0x2204e5,_0x1640e4[_0x0ae6('0x54')]);var _0x4f26e0={'where':_0x2204e5[_0x0ae6('0x4f')]};return db[_0x0ae6('0x42')]['count'](_0x4f26e0)[_0x0ae6('0x28')](function(_0x1ad272){_0x4a9c75[_0x0ae6('0x36')]=_0x1ad272;if(_0x1640e4['query'][_0x0ae6('0x55')]){_0x2204e5[_0x0ae6('0x56')]=[{'all':!![]}];}return db[_0x0ae6('0x42')][_0x0ae6('0x57')](_0x2204e5);})[_0x0ae6('0x28')](function(_0x7feb56){_0x4a9c75[_0x0ae6('0x58')]=_0x7feb56;return _0x4a9c75;})['then'](respondWithFilteredResult(_0x6b8cf5,_0x2204e5))['catch'](handleError(_0x6b8cf5,null));};exports[_0x0ae6('0x59')]=function(_0x18762a,_0x1f164f){var _0x54504b={'raw':!![],'where':{'id':_0x18762a['params']['id']}},_0x3b1ce5={};_0x3b1ce5['model']=_[_0x0ae6('0x5a')](db[_0x0ae6('0x42')][_0x0ae6('0x5b')]);_0x3b1ce5['query']=_[_0x0ae6('0x5a')](_0x18762a[_0x0ae6('0x46')]);_0x3b1ce5[_0x0ae6('0x47')]=_[_0x0ae6('0x48')](_0x3b1ce5[_0x0ae6('0x45')],_0x3b1ce5[_0x0ae6('0x46')]);_0x54504b[_0x0ae6('0x49')]=_[_0x0ae6('0x48')](_0x3b1ce5[_0x0ae6('0x45')],qs[_0x0ae6('0x4a')](_0x18762a[_0x0ae6('0x46')][_0x0ae6('0x4a')]));_0x54504b[_0x0ae6('0x49')]=_0x54504b[_0x0ae6('0x49')][_0x0ae6('0x4b')]?_0x54504b['attributes']:_0x3b1ce5['model'];if(_0x18762a[_0x0ae6('0x46')][_0x0ae6('0x55')]){_0x54504b[_0x0ae6('0x56')]=[{'all':!![]}];}_0x54504b=_[_0x0ae6('0x53')]({},_0x54504b,_0x18762a[_0x0ae6('0x54')]);return db[_0x0ae6('0x42')][_0x0ae6('0x5c')](_0x54504b)[_0x0ae6('0x28')](handleEntityNotFound(_0x1f164f,null))[_0x0ae6('0x28')](respondWithResult(_0x1f164f,null))[_0x0ae6('0x32')](handleError(_0x1f164f,null));};exports[_0x0ae6('0x5d')]=function(_0x463547,_0x16a311){return db[_0x0ae6('0x42')][_0x0ae6('0x5d')](_0x463547[_0x0ae6('0x5e')],{})[_0x0ae6('0x28')](respondWithResult(_0x16a311,0xc9))[_0x0ae6('0x32')](handleError(_0x16a311,null));};exports['update']=function(_0x26d313,_0x1d04ac){if(_0x26d313[_0x0ae6('0x5e')]['id']){delete _0x26d313[_0x0ae6('0x5e')]['id'];}return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x26d313[_0x0ae6('0x5f')]['id']}})[_0x0ae6('0x28')](handleEntityNotFound(_0x1d04ac,null))[_0x0ae6('0x28')](saveUpdates(_0x26d313[_0x0ae6('0x5e')],null))['then'](respondWithResult(_0x1d04ac,null))[_0x0ae6('0x32')](handleError(_0x1d04ac,null));};exports[_0x0ae6('0x60')]=function(_0x1c53bf,_0xd2cec5){return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x1c53bf[_0x0ae6('0x5f')]['id']}})[_0x0ae6('0x28')](handleEntityNotFound(_0xd2cec5,null))[_0x0ae6('0x28')](removeEntity(_0xd2cec5,null))['catch'](handleError(_0xd2cec5,null));};exports['describe']=function(_0xe05970,_0x33e87d){return db['SmsMessage']['describe']()[_0x0ae6('0x28')](respondWithResult(_0x33e87d,null))[_0x0ae6('0x32')](handleError(_0x33e87d,null));};var interaction_log=require(_0x0ae6('0x16'))(_0x0ae6('0x61'));exports[_0x0ae6('0x62')]=function(_0x198c87,_0x84e9fa,_0x4bcf41){var _0x227814={'channel':'sms'};if(_0x198c87[_0x0ae6('0x5e')]['id']){delete _0x198c87[_0x0ae6('0x5e')]['id'];}_0x198c87['body'][_0x0ae6('0x63')]=!![];_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x64')]=moment()['format'](_0x0ae6('0x65'));_0x198c87['body'][_0x0ae6('0x66')]=_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x66')]||_0x198c87[_0x0ae6('0x67')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x198c87[_0x0ae6('0x5f')]['id'],'UserId':null},'include':[{'model':db[_0x0ae6('0x68')],'as':_0x0ae6('0x69')}]})[_0x0ae6('0x28')](handleEntityNotFound(_0x84e9fa,null))[_0x0ae6('0x28')](saveUpdates(_0x198c87[_0x0ae6('0x5e')],null))['then'](function(_0x5e941e){if(_0x5e941e){_0x227814[_0x0ae6('0x31')]=_0x5e941e[_0x0ae6('0x6a')]({'plain':!![]});return db[_0x0ae6('0x6b')][_0x0ae6('0x5c')]({'where':{'id':_0x5e941e[_0x0ae6('0x6c')]}});}return null;})[_0x0ae6('0x28')](handleEntityNotFound(_0x84e9fa,null))[_0x0ae6('0x28')](function(_0x2e6311){if(_0x2e6311){return _0x2e6311['update']({'UserId':_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x66')],'read1stAt':_[_0x0ae6('0x6d')](_0x2e6311[_0x0ae6('0x6e')])?moment()[_0x0ae6('0x6f')](_0x0ae6('0x65')):undefined});}return null;})['then'](function(_0x50510d){if(_0x50510d){_0x227814[_0x0ae6('0x70')]=_0x50510d[_0x0ae6('0x6a')]({'plain':!![]});interaction_log['info'](_0x0ae6('0x71'),_0x198c87[_0x0ae6('0x67')]['id'],_0x198c87[_0x0ae6('0x67')][_0x0ae6('0x3f')],_0x198c87['user'][_0x0ae6('0x72')],_0x227814[_0x0ae6('0x70')]['id'],_0x198c87[_0x0ae6('0x5e')]?JSON[_0x0ae6('0x2e')](_0x198c87[_0x0ae6('0x5e')]):_0x0ae6('0x73'));return respondWithRpcPromise(_0x0ae6('0x74'),_0x0ae6('0x75'),_0x227814);}return null;})['then'](function(_0x3f4c5e){if(_0x3f4c5e){if(_0x198c87[_0x0ae6('0x5e')][_0x0ae6('0x76')]){_0x227814[_0x0ae6('0x31')][_0x0ae6('0x77')]=util[_0x0ae6('0x6f')](_0x0ae6('0x78'),_0x198c87[_0x0ae6('0x67')][_0x0ae6('0x3f')]);_0x227814[_0x0ae6('0x31')][_0x0ae6('0x79')]=_0x227814[_0x0ae6('0x79')];_0x227814[_0x0ae6('0x31')][_0x0ae6('0x7a')]=_0x0ae6('0x62');return respondWithRpcPromise(_0x0ae6('0x7b'),_0x0ae6('0x7b'),{'event':_0x0ae6('0x7c'),'message':_0x227814[_0x0ae6('0x31')]},client9002)[_0x0ae6('0x28')](function(){return _0x227814;});}return _0x227814;}return null;})[_0x0ae6('0x28')](respondWithResult(_0x84e9fa,null))['catch'](handleError(_0x84e9fa,null));};var interaction_log=require(_0x0ae6('0x16'))(_0x0ae6('0x61'));exports[_0x0ae6('0x3c')]=function(_0x41e64a,_0x4da9ac,_0xe8fabd){var _0x319682={'agent':{},'channel':_0x0ae6('0x7d')};if(_0x41e64a[_0x0ae6('0x5e')]['id']){delete _0x41e64a[_0x0ae6('0x5e')]['id'];}_0x41e64a[_0x0ae6('0x5e')]['UserId']=_0x41e64a[_0x0ae6('0x5e')]['UserId']||_0x41e64a[_0x0ae6('0x67')]['id'];_0x319682[_0x0ae6('0x7e')]['id']=_0x41e64a[_0x0ae6('0x5e')][_0x0ae6('0x66')];return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x41e64a[_0x0ae6('0x5f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4da9ac,null))['then'](function(_0x1f1149){if(_0x1f1149){_0x319682[_0x0ae6('0x31')]=_0x1f1149[_0x0ae6('0x6a')]({'plain':!![]});return db[_0x0ae6('0x6b')]['find']({'where':{'id':_0x1f1149[_0x0ae6('0x6c')]}});}return null;})[_0x0ae6('0x28')](handleEntityNotFound(_0x4da9ac,null))['then'](function(_0x2dfd4a){if(_0x2dfd4a){_0x319682[_0x0ae6('0x70')]=_0x2dfd4a[_0x0ae6('0x6a')]({'plain':!![]});interaction_log[_0x0ae6('0x29')](_0x0ae6('0x7f'),_0x41e64a[_0x0ae6('0x67')]['id'],_0x41e64a['user']['name'],_0x41e64a['user'][_0x0ae6('0x72')],_0x319682['interaction']['id'],_0x41e64a['body']?JSON['stringify'](_0x41e64a['body']):_0x0ae6('0x73'));return respondWithRpcPromise('RejectMessage',_0x0ae6('0x80'),_0x319682);}return null;})['then'](function(_0x1bf94d){if(_0x1bf94d){_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x77')]=util[_0x0ae6('0x6f')](_0x0ae6('0x78'),_0x41e64a['user'][_0x0ae6('0x3f')]);_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x79')]=_0x319682[_0x0ae6('0x79')];_0x1bf94d[_0x0ae6('0x31')][_0x0ae6('0x7a')]=_0x0ae6('0x3c');respondWithRpcPromise('EventManager',_0x0ae6('0x7b'),{'event':_0x0ae6('0x81'),'message':_0x1bf94d[_0x0ae6('0x31')]},client9002);return _0x319682;}return null;})[_0x0ae6('0x28')](respondWithResult(_0x4da9ac,null))[_0x0ae6('0x32')](handleError(_0x4da9ac,null));};exports[_0x0ae6('0x34')]=function(_0x4c056d,_0x5b8435,_0x4831b4){if(_0x4c056d[_0x0ae6('0x5e')]['id']){delete _0x4c056d[_0x0ae6('0x5e')]['id'];}var _0x4f8409;return db[_0x0ae6('0x42')][_0x0ae6('0x5c')]({'where':{'id':_0x4c056d[_0x0ae6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5b8435,null))['then'](function(_0x2c9aab){if(_0x2c9aab){_0x4f8409=_0x2c9aab;return db[_0x0ae6('0x82')]['find']({'where':{'id':_0x2c9aab['SmsAccountId']}});}})[_0x0ae6('0x28')](handleEntityNotFound(_0x5b8435,null))['then'](function(_0x519179){if(_0x519179){logger[_0x0ae6('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x0ae6('0x83'),_0x519179[_0x0ae6('0x43')],util['inspect'](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));switch(_0x519179[_0x0ae6('0x43')]){case'twilio':if(_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x84')]&&_0x4c056d['body'][_0x0ae6('0x84')]===_0x4f8409['messageId']){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger['error'](_0x0ae6('0x85'),_0x0ae6('0x34'),'twilio',util[_0x0ae6('0x86')](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x87')]&&_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x87')]===_0x4f8409[_0x0ae6('0x88')]&&_[_0x0ae6('0x89')]([_0x0ae6('0x8a'),_0x0ae6('0x8b')],_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x8c')])>=0x0){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger[_0x0ae6('0x2f')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0ae6('0x8d'),util[_0x0ae6('0x86')](_0x4c056d[_0x0ae6('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0ae6('0x8e'):var _0x49aed6=_0x4c056d[_0x0ae6('0x5e')][_0x0ae6('0x8f')][0x0];if(_0x49aed6['status'][_0x0ae6('0x90')]===_0x0ae6('0x91')){return _0x4f8409[_0x0ae6('0x3e')]({'read':!![]});}else{logger[_0x0ae6('0x2f')](_0x0ae6('0x85'),_0x0ae6('0x34'),_0x0ae6('0x8e'),util['inspect'](_0x4c056d['body'],{'showHidden':![],'depth':null}));}break;}return _0x4f8409;}})[_0x0ae6('0x28')](respondWithResult(_0x5b8435,null))[_0x0ae6('0x32')](handleError(_0x5b8435,null));}; \ No newline at end of file +var _0x4ded=['sent','delivered','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','SmsMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','../../config/logger','accept','sms','body','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','format','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','interaction','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID'];(function(_0x4dec07,_0x5d12c8){var _0x17c8d4=function(_0x46d775){while(--_0x46d775){_0x4dec07['push'](_0x4dec07['shift']());}};_0x17c8d4(++_0x5d12c8);}(_0x4ded,0x116));var _0xd4de=function(_0x84f36a,_0x315701){_0x84f36a=_0x84f36a-0x0;var _0x113df8=_0x4ded[_0x84f36a];return _0x113df8;};'use strict';var pdf=require(_0xd4de('0x0'));var emlformat=require(_0xd4de('0x1'));var rimraf=require(_0xd4de('0x2'));var zipdir=require(_0xd4de('0x3'));var jsonpatch=require(_0xd4de('0x4'));var rp=require(_0xd4de('0x5'));var moment=require(_0xd4de('0x6'));var BPromise=require(_0xd4de('0x7'));var Mustache=require(_0xd4de('0x8'));var util=require(_0xd4de('0x9'));var path=require(_0xd4de('0xa'));var sox=require(_0xd4de('0xb'));var csv=require('to-csv');var ejs=require(_0xd4de('0xc'));var fs=require('fs');var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var db=require(_0xd4de('0x16'))['db'];config[_0xd4de('0x17')]=_[_0xd4de('0x18')](config[_0xd4de('0x17')],{'host':_0xd4de('0x19'),'port':0x18eb});var socket=require(_0xd4de('0x1a'))(new Redis(config[_0xd4de('0x17')]));require(_0xd4de('0x1b'))[_0xd4de('0x1c')](socket);var jayson=require(_0xd4de('0x1d'));var client=jayson[_0xd4de('0x1e')][_0xd4de('0x1f')]({'port':0x232c});var client9002=jayson[_0xd4de('0x1e')][_0xd4de('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x102e5b,_0xa7c18b,_0x325fba){if(_0x325fba){var _0x4b0a95=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b0a95['test'](_0xa7c18b)){return _0x102e5b;}else{throw new db[(_0xd4de('0x20'))][(_0xd4de('0x21'))](_0xd4de('0x22'));}}else{return _0x102e5b;}}function respondWithRpcPromise(_0x428aa2,_0x5b1d1c,_0x4d0df6,_0x1e91d5){return new BPromise(function(_0x54b757,_0xeaaefa){var _0x29c028=_0x1e91d5||client;return _0x29c028['request'](_0x428aa2,_0x4d0df6)[_0xd4de('0x23')](function(_0x57c078){logger[_0xd4de('0x24')](_0xd4de('0x25'),_0x5b1d1c,_0xd4de('0x26'));logger[_0xd4de('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5b1d1c,_0xd4de('0x26'),JSON[_0xd4de('0x28')](_0x57c078));if(_0x57c078[_0xd4de('0x29')]){if(_0x57c078[_0xd4de('0x29')][_0xd4de('0x2a')]===0x1f4){logger[_0xd4de('0x29')](_0xd4de('0x25'),_0x5b1d1c,_0x57c078[_0xd4de('0x29')][_0xd4de('0x2b')]);return _0xeaaefa(_0x57c078[_0xd4de('0x29')]['message']);}logger[_0xd4de('0x29')](_0xd4de('0x25'),_0x5b1d1c,_0x57c078[_0xd4de('0x29')][_0xd4de('0x2b')]);return _0x54b757(_0x57c078[_0xd4de('0x29')][_0xd4de('0x2b')]);}else{logger[_0xd4de('0x24')](_0xd4de('0x25'),_0x5b1d1c,_0xd4de('0x26'));_0x54b757(_0x57c078[_0xd4de('0x2c')][_0xd4de('0x2b')]);}})[_0xd4de('0x2d')](function(_0x586126){logger[_0xd4de('0x29')](_0xd4de('0x25'),_0x5b1d1c,_0x586126);_0xeaaefa(_0x586126);});});}function respondWithStatusCode(_0x5005b0,_0x1d7d37){_0x1d7d37=_0x1d7d37||0xcc;return function(_0x59b3c5){if(_0x59b3c5){return _0x5005b0[_0xd4de('0x2e')](_0x1d7d37);}return _0x5005b0[_0xd4de('0x2f')](_0x1d7d37)[_0xd4de('0x30')]();};}function respondWithResult(_0x4fa53a,_0xd4de93){_0xd4de93=_0xd4de93||0xc8;return function(_0x36f2f1){if(_0x36f2f1){return _0x4fa53a[_0xd4de('0x2f')](_0xd4de93)['json'](_0x36f2f1);}};}function respondWithFilteredResult(_0x3615b8,_0x1804c7){return function(_0x55f9f9){if(_0x55f9f9){var _0x5103b5=_0x55f9f9[_0xd4de('0x31')],_0x5706fe=_0x1804c7[_0xd4de('0x32')],_0x3f6491=_0x1804c7[_0xd4de('0x32')]+_0x1804c7[_0xd4de('0x33')],_0x496795;if(_0x3f6491>=_0x5103b5){_0x3f6491=_0x5103b5;_0x496795=0xc8;}else{_0x496795=0xce;}_0x3615b8['status'](_0x496795);return _0x3615b8[_0xd4de('0x34')](_0xd4de('0x35'),_0x5706fe+'-'+_0x3f6491+'/'+_0x5103b5)['json'](_0x55f9f9);}return null;};}function patchUpdates(_0x133a43){return function(_0x1d86fc){try{jsonpatch['apply'](_0x1d86fc,_0x133a43,!![]);}catch(_0x5d669e){return BPromise[_0xd4de('0x36')](_0x5d669e);}return _0x1d86fc[_0xd4de('0x37')]();};}function saveUpdates(_0x4020cc,_0x1a2fd0){return function(_0x4f565b){if(_0x4f565b){return _0x4f565b[_0xd4de('0x38')](_0x4020cc)[_0xd4de('0x23')](function(_0x4def30){return _0x4def30;});}return null;};}function removeEntity(_0x329d49,_0x204dc8){return function(_0x1e744e){if(_0x1e744e){return _0x1e744e[_0xd4de('0x39')]()[_0xd4de('0x23')](function(){_0x329d49[_0xd4de('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493b17,_0x7ef08d){return function(_0x2d2fda){if(!_0x2d2fda){_0x493b17[_0xd4de('0x2e')](0x194);}return _0x2d2fda;};}function handleError(_0x4d6259,_0x3c5249){_0x3c5249=_0x3c5249||0x1f4;return function(_0x44b96c){logger['error'](_0x44b96c[_0xd4de('0x3a')]);if(_0x44b96c[_0xd4de('0x3b')]){delete _0x44b96c[_0xd4de('0x3b')];}_0x4d6259[_0xd4de('0x2f')](_0x3c5249)['send'](_0x44b96c);};}exports['index']=function(_0x421efb,_0x541777){var _0x3e5e34={},_0x4de12c={},_0x97c0ab={'count':0x0,'rows':[]};var _0xcc1d7=_[_0xd4de('0x3c')](db[_0xd4de('0x3d')]['rawAttributes'],function(_0x21209d){return{'name':_0x21209d['fieldName'],'type':_0x21209d[_0xd4de('0x3e')][_0xd4de('0x3f')]};});_0x4de12c[_0xd4de('0x40')]=_[_0xd4de('0x3c')](_0xcc1d7,_0xd4de('0x3b'));_0x4de12c[_0xd4de('0x41')]=_[_0xd4de('0x42')](_0x421efb['query']);_0x4de12c[_0xd4de('0x43')]=_[_0xd4de('0x44')](_0x4de12c[_0xd4de('0x40')],_0x4de12c[_0xd4de('0x41')]);_0x3e5e34[_0xd4de('0x45')]=_['intersection'](_0x4de12c[_0xd4de('0x40')],qs[_0xd4de('0x46')](_0x421efb[_0xd4de('0x41')]['fields']));_0x3e5e34[_0xd4de('0x45')]=_0x3e5e34[_0xd4de('0x45')][_0xd4de('0x47')]?_0x3e5e34['attributes']:_0x4de12c[_0xd4de('0x40')];if(!_0x421efb[_0xd4de('0x41')][_0xd4de('0x48')](_0xd4de('0x49'))){_0x3e5e34[_0xd4de('0x33')]=qs[_0xd4de('0x33')](_0x421efb[_0xd4de('0x41')]['limit']);_0x3e5e34[_0xd4de('0x32')]=qs[_0xd4de('0x32')](_0x421efb[_0xd4de('0x41')]['offset']);}_0x3e5e34[_0xd4de('0x4a')]=qs[_0xd4de('0x4b')](_0x421efb[_0xd4de('0x41')]['sort']);_0x3e5e34['where']=qs[_0xd4de('0x43')](_[_0xd4de('0x4c')](_0x421efb['query'],_0x4de12c[_0xd4de('0x43')]),_0xcc1d7);if(_0x421efb[_0xd4de('0x41')][_0xd4de('0x4d')]){_0x3e5e34[_0xd4de('0x4e')]=_['merge'](_0x3e5e34[_0xd4de('0x4e')],{'$or':_[_0xd4de('0x3c')](_0xcc1d7,function(_0x579700){if(_0x579700[_0xd4de('0x3e')]!==_0xd4de('0x4f')){var _0x1cbca6={};_0x1cbca6[_0x579700['name']]={'$like':'%'+_0x421efb[_0xd4de('0x41')][_0xd4de('0x4d')]+'%'};return _0x1cbca6;}})});}_0x3e5e34=_[_0xd4de('0x50')]({},_0x3e5e34,_0x421efb[_0xd4de('0x51')]);var _0x2b4744={'where':_0x3e5e34[_0xd4de('0x4e')]};return db[_0xd4de('0x3d')][_0xd4de('0x31')](_0x2b4744)[_0xd4de('0x23')](function(_0x2e46b3){_0x97c0ab['count']=_0x2e46b3;if(_0x421efb[_0xd4de('0x41')][_0xd4de('0x52')]){_0x3e5e34[_0xd4de('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0xd4de('0x54')](_0x3e5e34);})[_0xd4de('0x23')](function(_0x299bf3){_0x97c0ab[_0xd4de('0x55')]=_0x299bf3;return _0x97c0ab;})[_0xd4de('0x23')](respondWithFilteredResult(_0x541777,_0x3e5e34))[_0xd4de('0x2d')](handleError(_0x541777,null));};exports[_0xd4de('0x56')]=function(_0x29cb16,_0x182b35){var _0x138b04={'raw':!![],'where':{'id':_0x29cb16[_0xd4de('0x57')]['id']}},_0x55f5bc={};_0x55f5bc[_0xd4de('0x40')]=_[_0xd4de('0x42')](db[_0xd4de('0x3d')][_0xd4de('0x58')]);_0x55f5bc['query']=_['keys'](_0x29cb16[_0xd4de('0x41')]);_0x55f5bc[_0xd4de('0x43')]=_['intersection'](_0x55f5bc['model'],_0x55f5bc[_0xd4de('0x41')]);_0x138b04[_0xd4de('0x45')]=_[_0xd4de('0x44')](_0x55f5bc[_0xd4de('0x40')],qs[_0xd4de('0x46')](_0x29cb16[_0xd4de('0x41')][_0xd4de('0x46')]));_0x138b04[_0xd4de('0x45')]=_0x138b04[_0xd4de('0x45')][_0xd4de('0x47')]?_0x138b04[_0xd4de('0x45')]:_0x55f5bc[_0xd4de('0x40')];if(_0x29cb16['query'][_0xd4de('0x52')]){_0x138b04[_0xd4de('0x53')]=[{'all':!![]}];}_0x138b04=_[_0xd4de('0x50')]({},_0x138b04,_0x29cb16[_0xd4de('0x51')]);return db[_0xd4de('0x3d')][_0xd4de('0x59')](_0x138b04)['then'](handleEntityNotFound(_0x182b35,null))[_0xd4de('0x23')](respondWithResult(_0x182b35,null))['catch'](handleError(_0x182b35,null));};exports['create']=function(_0xa0242e,_0xd79781){return db[_0xd4de('0x3d')][_0xd4de('0x5a')](_0xa0242e['body'],{})[_0xd4de('0x23')](respondWithResult(_0xd79781,0xc9))[_0xd4de('0x2d')](handleError(_0xd79781,null));};exports[_0xd4de('0x38')]=function(_0x117052,_0x23e438){if(_0x117052['body']['id']){delete _0x117052['body']['id'];}return db['SmsMessage'][_0xd4de('0x59')]({'where':{'id':_0x117052[_0xd4de('0x57')]['id']}})[_0xd4de('0x23')](handleEntityNotFound(_0x23e438,null))[_0xd4de('0x23')](saveUpdates(_0x117052['body'],null))[_0xd4de('0x23')](respondWithResult(_0x23e438,null))[_0xd4de('0x2d')](handleError(_0x23e438,null));};exports[_0xd4de('0x39')]=function(_0x17047a,_0x51e239){return db[_0xd4de('0x3d')][_0xd4de('0x59')]({'where':{'id':_0x17047a[_0xd4de('0x57')]['id']}})[_0xd4de('0x23')](handleEntityNotFound(_0x51e239,null))['then'](removeEntity(_0x51e239,null))['catch'](handleError(_0x51e239,null));};exports['describe']=function(_0x42e40b,_0x3f69af){return db[_0xd4de('0x3d')]['describe']()[_0xd4de('0x23')](respondWithResult(_0x3f69af,null))[_0xd4de('0x2d')](handleError(_0x3f69af,null));};var interaction_log=require(_0xd4de('0x5b'))('sms-interactions');exports[_0xd4de('0x5c')]=function(_0x511b21,_0x2ee7c1,_0x9b4fc){var _0x3e15ce={'channel':_0xd4de('0x5d')};if(_0x511b21[_0xd4de('0x5e')]['id']){delete _0x511b21[_0xd4de('0x5e')]['id'];}_0x511b21[_0xd4de('0x5e')][_0xd4de('0x5f')]=!![];_0x511b21['body'][_0xd4de('0x60')]=moment()['format'](_0xd4de('0x61'));_0x511b21[_0xd4de('0x5e')]['UserId']=_0x511b21[_0xd4de('0x5e')][_0xd4de('0x62')]||_0x511b21[_0xd4de('0x63')]['id'];return db[_0xd4de('0x3d')][_0xd4de('0x59')]({'where':{'id':_0x511b21[_0xd4de('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xd4de('0x64')],'as':_0xd4de('0x65')}]})[_0xd4de('0x23')](handleEntityNotFound(_0x2ee7c1,null))[_0xd4de('0x23')](saveUpdates(_0x511b21[_0xd4de('0x5e')],null))[_0xd4de('0x23')](function(_0x2a63c2){if(_0x2a63c2){_0x3e15ce['message']=_0x2a63c2[_0xd4de('0x66')]({'plain':!![]});return db[_0xd4de('0x67')][_0xd4de('0x59')]({'where':{'id':_0x2a63c2[_0xd4de('0x68')]}});}return null;})[_0xd4de('0x23')](handleEntityNotFound(_0x2ee7c1,null))[_0xd4de('0x23')](function(_0x26bf55){if(_0x26bf55){return _0x26bf55[_0xd4de('0x38')]({'UserId':_0x511b21['body'][_0xd4de('0x62')],'read1stAt':_['isNil'](_0x26bf55['read1stAt'])?moment()['format'](_0xd4de('0x61')):undefined});}return null;})[_0xd4de('0x23')](function(_0x4a602d){if(_0x4a602d){_0x3e15ce['interaction']=_0x4a602d['get']({'plain':!![]});interaction_log['info'](_0xd4de('0x69'),_0x511b21['user']['id'],_0x511b21[_0xd4de('0x63')]['name'],_0x511b21[_0xd4de('0x63')][_0xd4de('0x6a')],_0x3e15ce['interaction']['id'],_0x511b21['body']?JSON['stringify'](_0x511b21['body']):_0xd4de('0x6b'));return respondWithRpcPromise(_0xd4de('0x6c'),_0xd4de('0x6d'),_0x3e15ce);}return null;})[_0xd4de('0x23')](function(_0x277c6f){if(_0x277c6f){if(_0x511b21[_0xd4de('0x5e')]['manual']){_0x3e15ce['message']['interface']=util[_0xd4de('0x6e')](_0xd4de('0x6f'),_0x511b21['user'][_0xd4de('0x3b')]);_0x3e15ce['message'][_0xd4de('0x70')]=_0x3e15ce['channel'];_0x3e15ce[_0xd4de('0x2b')][_0xd4de('0x71')]='accept';return respondWithRpcPromise(_0xd4de('0x72'),'EventManager',{'event':_0xd4de('0x73'),'message':_0x3e15ce[_0xd4de('0x2b')]},client9002)[_0xd4de('0x23')](function(){return _0x3e15ce;});}return _0x3e15ce;}return null;})[_0xd4de('0x23')](respondWithResult(_0x2ee7c1,null))['catch'](handleError(_0x2ee7c1,null));};var interaction_log=require(_0xd4de('0x5b'))(_0xd4de('0x74'));exports[_0xd4de('0x36')]=function(_0x44c260,_0x3108b5,_0x21c8d2){var _0xb10dbb={'agent':{},'channel':_0xd4de('0x5d')};if(_0x44c260[_0xd4de('0x5e')]['id']){delete _0x44c260[_0xd4de('0x5e')]['id'];}_0x44c260[_0xd4de('0x5e')][_0xd4de('0x62')]=_0x44c260[_0xd4de('0x5e')]['UserId']||_0x44c260[_0xd4de('0x63')]['id'];_0xb10dbb['agent']['id']=_0x44c260['body'][_0xd4de('0x62')];return db[_0xd4de('0x3d')]['find']({'where':{'id':_0x44c260[_0xd4de('0x57')]['id'],'UserId':null}})[_0xd4de('0x23')](handleEntityNotFound(_0x3108b5,null))[_0xd4de('0x23')](function(_0x286126){if(_0x286126){_0xb10dbb['message']=_0x286126[_0xd4de('0x66')]({'plain':!![]});return db[_0xd4de('0x67')][_0xd4de('0x59')]({'where':{'id':_0x286126[_0xd4de('0x68')]}});}return null;})[_0xd4de('0x23')](handleEntityNotFound(_0x3108b5,null))['then'](function(_0x559a87){if(_0x559a87){_0xb10dbb['interaction']=_0x559a87['get']({'plain':!![]});interaction_log[_0xd4de('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44c260[_0xd4de('0x63')]['id'],_0x44c260['user'][_0xd4de('0x3b')],_0x44c260[_0xd4de('0x63')][_0xd4de('0x6a')],_0xb10dbb[_0xd4de('0x75')]['id'],_0x44c260[_0xd4de('0x5e')]?JSON[_0xd4de('0x28')](_0x44c260[_0xd4de('0x5e')]):_0xd4de('0x6b'));return respondWithRpcPromise('RejectMessage',_0xd4de('0x76'),_0xb10dbb);}return null;})[_0xd4de('0x23')](function(_0x2025ba){if(_0x2025ba){_0x2025ba[_0xd4de('0x2b')]['interface']=util[_0xd4de('0x6e')](_0xd4de('0x6f'),_0x44c260['user'][_0xd4de('0x3b')]);_0x2025ba[_0xd4de('0x2b')][_0xd4de('0x70')]=_0xb10dbb[_0xd4de('0x70')];_0x2025ba[_0xd4de('0x2b')][_0xd4de('0x71')]=_0xd4de('0x36');respondWithRpcPromise(_0xd4de('0x72'),_0xd4de('0x72'),{'event':_0xd4de('0x77'),'message':_0x2025ba[_0xd4de('0x2b')]},client9002);return _0xb10dbb;}return null;})['then'](respondWithResult(_0x3108b5,null))[_0xd4de('0x2d')](handleError(_0x3108b5,null));};exports['status']=function(_0x117308,_0x266d35,_0x19541b){if(_0x117308['body']['id']){delete _0x117308[_0xd4de('0x5e')]['id'];}var _0x1cab80;return db['SmsMessage'][_0xd4de('0x59')]({'where':{'id':_0x117308[_0xd4de('0x57')]['id']}})[_0xd4de('0x23')](handleEntityNotFound(_0x266d35,null))[_0xd4de('0x23')](function(_0x2fd3d5){if(_0x2fd3d5){_0x1cab80=_0x2fd3d5;return db[_0xd4de('0x78')]['find']({'where':{'id':_0x2fd3d5[_0xd4de('0x79')]}});}})[_0xd4de('0x23')](handleEntityNotFound(_0x266d35,null))['then'](function(_0x2f4183){if(_0x2f4183){logger[_0xd4de('0x27')](_0xd4de('0x7a'),_0xd4de('0x2f'),'received\x20delivery\x20report\x20from',_0x2f4183['type'],util[_0xd4de('0x7b')](_0x117308[_0xd4de('0x5e')],{'showHidden':![],'depth':null}));switch(_0x2f4183[_0xd4de('0x3e')]){case _0xd4de('0x7c'):if(_0x117308['body'][_0xd4de('0x7d')]&&_0x117308[_0xd4de('0x5e')][_0xd4de('0x7d')]===_0x1cab80[_0xd4de('0x7e')]){return _0x1cab80['update']({'read':!![]});}else{logger['error'](_0xd4de('0x7f'),'status',_0xd4de('0x7c'),util[_0xd4de('0x7b')](_0x117308[_0xd4de('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xd4de('0x80'):if(_0x117308['body']['MessageUUID']&&_0x117308[_0xd4de('0x5e')][_0xd4de('0x81')]===_0x1cab80['messageId']&&_['indexOf']([_0xd4de('0x82'),_0xd4de('0x83')],_0x117308[_0xd4de('0x5e')]['Status'])>=0x0){return _0x1cab80[_0xd4de('0x38')]({'read':!![]});}else{logger[_0xd4de('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd4de('0x2f'),'plivio',util[_0xd4de('0x7b')](_0x117308[_0xd4de('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4d83ba=_0x117308[_0xd4de('0x5e')][_0xd4de('0x84')][0x0];if(_0x4d83ba[_0xd4de('0x2f')][_0xd4de('0x85')]===_0xd4de('0x86')){return _0x1cab80['update']({'read':!![]});}else{logger[_0xd4de('0x29')](_0xd4de('0x7f'),_0xd4de('0x2f'),_0xd4de('0x87'),util[_0xd4de('0x7b')](_0x117308[_0xd4de('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1cab80;}})['then'](respondWithResult(_0x266d35,null))[_0xd4de('0x2d')](handleError(_0x266d35,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9759945..0a62f73 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 _0x6c55=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5958fe,_0x38c4ef){var _0x20a218=function(_0x9f0d7d){while(--_0x9f0d7d){_0x5958fe['push'](_0x5958fe['shift']());}};_0x20a218(++_0x38c4ef);}(_0x6c55,0x191));var _0x56c5=function(_0x150bff,_0x1fb61a){_0x150bff=_0x150bff-0x0;var _0x296f9a=_0x6c55[_0x150bff];return _0x296f9a;};'use strict';var EventEmitter=require(_0x56c5('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x56c5('0x1')](0x0);var events={'afterCreate':_0x56c5('0x2'),'afterUpdate':_0x56c5('0x3'),'afterDestroy':_0x56c5('0x4')};function emitEvent(_0x4fe3d0){return function(_0x9e6cc1,_0xb1a539,_0x3f6fc3){SmsMessageEvents[_0x56c5('0x5')](_0x4fe3d0+':'+_0x9e6cc1['id'],_0x9e6cc1);SmsMessageEvents['emit'](_0x4fe3d0,_0x9e6cc1);_0x3f6fc3(null);};}for(var e in events){if(events[_0x56c5('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x56c5('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x5577=['save','update','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x5a72ad,_0x159ddb){var _0x25006f=function(_0x22d42e){while(--_0x22d42e){_0x5a72ad['push'](_0x5a72ad['shift']());}};_0x25006f(++_0x159ddb);}(_0x5577,0xad));var _0x7557=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x5577[_0x39d544];return _0x5a5ff2;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7557('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7557('0x1')](0x0);var events={'afterCreate':_0x7557('0x2'),'afterUpdate':_0x7557('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1b9c83){return function(_0x22ba13,_0x54bcc8,_0x4b0184){SmsMessageEvents[_0x7557('0x4')](_0x1b9c83+':'+_0x22ba13['id'],_0x22ba13);SmsMessageEvents[_0x7557('0x4')](_0x1b9c83,_0x22ba13);_0x4b0184(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7557('0x5')](e,emitEvent(event));}}module[_0x7557('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 81a9c67..8751cab 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 _0x1733=['user_key','session_key','total_sent','internal_order_id','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','csc','login','apiKey','createHash','md5','digest','hex','signature=','GET','keys','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','createdAt','out','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms'];(function(_0x480c91,_0x2730b7){var _0x4afa8e=function(_0x54fbc9){while(--_0x54fbc9){_0x480c91['push'](_0x480c91['shift']());}};_0x4afa8e(++_0x2730b7);}(_0x1733,0x1a3));var _0x3173=function(_0x3e04c7,_0x28dea4){_0x3e04c7=_0x3e04c7-0x0;var _0xa49b59=_0x1733[_0x3e04c7];return _0xa49b59;};'use strict';var _=require(_0x3173('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3173('0x1'));var BPromise=require('bluebird');var rp=require(_0x3173('0x2'));var fs=require('fs');var path=require(_0x3173('0x3'));var rimraf=require('rimraf');var config=require(_0x3173('0x4'));var attributes=require(_0x3173('0x5'));module[_0x3173('0x6')]=function(_0x123008,_0x4bf6e){return _0x123008[_0x3173('0x7')](_0x3173('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x3173('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x3173('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x531c05,_0x45089e,_0xdd32ba){var _0x2e347c=_0x123008[_0x3173('0xb')];var _0x4e89ef=_0x531c05[_0x3173('0xc')]({'plain':!![]});if(_0x4e89ef[_0x3173('0xd')][_0x3173('0xe')]()==='in'||_0x4e89ef[_0x3173('0xd')]['toLowerCase']()==='out'&&!_0x4e89ef[_0x3173('0xf')]&&!_[_0x3173('0x10')](_0x4e89ef['UserId'])){_0x2e347c[_0x3173('0x11')][_0x3173('0x12')]({'where':{'id':_0x4e89ef[_0x3173('0x13')]}})[_0x3173('0x14')](function(_0x35b65e){if(_0x35b65e){_0x35b65e['update']({'lastMsgAt':_0x4e89ef[_0x3173('0x15')],'lastMsgDirection':_0x4e89ef[_0x3173('0xd')][_0x3173('0xe')]()});}})['catch'](function(_0x298f60){console['error'](_0x298f60);});}if(_0x4e89ef[_0x3173('0xd')]===_0x3173('0x16')&&!_0x4e89ef[_0x3173('0xf')]){var _0x26fdd3;_0x2e347c[_0x3173('0x17')][_0x3173('0x18')]({'where':{'id':_0x4e89ef['SmsAccountId']},'raw':!![]})[_0x3173('0x14')](function(_0x11723b){_0x26fdd3=_0x11723b;if(_0x26fdd3&&_0x26fdd3[_0x3173('0x19')]){switch(_0x26fdd3[_0x3173('0x19')]){case _0x3173('0x1a'):var _0x5bd8d1=require(_0x3173('0x1a'));if(_0x26fdd3[_0x3173('0x1b')]&&_0x26fdd3[_0x3173('0x1c')]&&_0x26fdd3[_0x3173('0x1d')]){var _0x585e02=new _0x5bd8d1(_0x26fdd3[_0x3173('0x1b')],_0x26fdd3['authToken']);_0x585e02[_0x3173('0x1e')][_0x3173('0x1f')]({'body':_0x4e89ef[_0x3173('0x20')],'to':_0x4e89ef[_0x3173('0x1d')],'from':_0x26fdd3[_0x3173('0x1d')],'statusCallback':_0x26fdd3[_0x3173('0x21')]+_0x3173('0x22')+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3[_0x3173('0x24')]})[_0x3173('0x14')](function(_0x220e6b){if(_0x220e6b['sid']){return _0x531c05['update']({'messageId':_0x220e6b[_0x3173('0x25')]});}})[_0x3173('0x26')](function(_0x457cb6){logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x1a'),util[_0x3173('0x2a')](_0x457cb6,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x1a'),_0x3173('0x2b'));}break;case _0x3173('0x2c'):var _0x3a296d=_0x3173('0x2d');if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3[_0x3173('0x2f')]){var _0x1700f0={'recipient':[_0x4e89ef[_0x3173('0x1d')]],'message':_0x4e89ef[_0x3173('0x20')],'message_type':_0x26fdd3[_0x3173('0x30')]};if(_0x26fdd3['smsMethod']&&_0x26fdd3[_0x3173('0x30')]!=='SI'){_0x1700f0[_0x3173('0x31')]=_0x26fdd3[_0x3173('0x1d')];}var _0xfb44cb={'url':_0x3a296d+_0x3173('0x32')+_0x26fdd3[_0x3173('0x2e')]+'&password='+_0x26fdd3[_0x3173('0x2f')],'method':'GET'};rp(_0xfb44cb)['then'](function(_0x470e5f){var _0x53f86b=_0x470e5f[_0x3173('0x33')](';');var _0x2b1e1d={'user_key':_0x53f86b[0x0],'session_key':_0x53f86b[0x1]};_0xfb44cb={'url':_0x3a296d+_0x3173('0x34'),'method':'POST','headers':{'user_key':_0x2b1e1d[_0x3173('0x35')],'Session_key':_0x2b1e1d[_0x3173('0x36')]},'json':!![],'body':_0x1700f0};return rp(_0xfb44cb);})[_0x3173('0x14')](function(_0x5526d8){if(_0x5526d8[_0x3173('0x37')]>=0x1){var _0x505f1a={'messageId':_0x5526d8[_0x3173('0x38')]};if(_0x26fdd3[_0x3173('0x30')]!=='GP'||!_0x26fdd3[_0x3173('0x39')]){_0x505f1a[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x505f1a);}else{return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x3173('0x2a')](_0x5526d8,{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x551842){return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x2c'),util[_0x3173('0x2a')](_0x551842,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate',_0x3173('0x2c'),_0x3173('0x3c'));}break;case _0x3173('0x3d'):if(_0x26fdd3['authToken']){var _0x1da7fe={'recipient':_0x4e89ef[_0x3173('0x1d')],'message':_0x4e89ef['body'],'sender':_0x26fdd3[_0x3173('0x3e')]||_0x26fdd3[_0x3173('0x1d')],'authorization':_0x26fdd3[_0x3173('0x1c')]};var _0x45089e={'method':_0x3173('0x3f'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x1da7fe,'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x3d0b07){var _0x3421d4={'messageId':_0x3d0b07[_0x3173('0x40')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x3421d4[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x3421d4);})[_0x3173('0x26')](function(_0x9639f8){logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x3d'),util['inspect'](_0x9639f8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x3d'),_0x3173('0x41'));}break;case _0x3173('0x42'):if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3['password']){var _0x1da7fe={'messages':[{'source':_0x3173('0x43'),'to':_0x4e89ef['phone'],'body':_0x4e89ef[_0x3173('0x20')],'from':_0x26fdd3[_0x3173('0x3e')]||_0x26fdd3[_0x3173('0x1d')]}]};var _0x106b6b=util[_0x3173('0x44')](_0x3173('0x45'),_0x26fdd3[_0x3173('0x2e')],_0x26fdd3['password']);var _0x45089e={'method':_0x3173('0x3f'),'uri':_0x3173('0x46'),'body':_0x1da7fe,'headers':{'Authorization':util['format'](_0x3173('0x47'),new Buffer(_0x106b6b)[_0x3173('0x48')](_0x3173('0x49')))},'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x586195){if(_0x586195['http_code']>=0xc8&&_0x586195[_0x3173('0x4a')]<=0xce){if(_0x586195[_0x3173('0x4b')]&&_0x586195[_0x3173('0x4b')][_0x3173('0x4c')]>0x0){var _0x4dc828=_[_0x3173('0x4d')](_0x586195[_0x3173('0x4b')]['messages']);var _0x5675a4={'messageId':_0x4dc828[_0x3173('0x4e')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x5675a4[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x5675a4);}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x4f'),util['inspect'](_0x586195,{'showHidden':![],'depth':null}));}}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x4f'),util[_0x3173('0x2a')](_0x586195,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3e3d3b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3173('0x4f'),util[_0x3173('0x2a')](_0x3e3d3b,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x26fdd3[_0x3173('0x50')]&&_0x26fdd3[_0x3173('0x1c')]){var _0x1da7fe={'dst':_0x4e89ef[_0x3173('0x1d')],'text':_0x4e89ef[_0x3173('0x20')],'src':_0x26fdd3['senderString']||_0x26fdd3[_0x3173('0x1d')],'url':_0x26fdd3[_0x3173('0x21')]+_0x3173('0x22')+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3['token']};var _0x106b6b=util[_0x3173('0x44')](_0x3173('0x45'),_0x26fdd3['authId'],_0x26fdd3[_0x3173('0x1c')]);var _0x45089e={'method':_0x3173('0x3f'),'uri':util[_0x3173('0x44')](_0x3173('0x51'),_0x26fdd3[_0x3173('0x50')]),'body':_0x1da7fe,'headers':{'Authorization':util[_0x3173('0x44')]('Basic\x20%s',new Buffer(_0x106b6b)[_0x3173('0x48')]('base64'))},'json':!![]};rp(_0x45089e)[_0x3173('0x14')](function(_0x52817d){var _0x63f1c4={'messageId':_0x52817d[_0x3173('0x52')][0x0]};return _0x531c05[_0x3173('0x3b')](_0x63f1c4);})[_0x3173('0x26')](function(_0x78a35d){logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate','plivo',util[_0x3173('0x2a')](_0x78a35d,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x53'),_0x3173('0x54'));}break;case _0x3173('0x55'):if(_0x26fdd3[_0x3173('0x2e')]&&_0x26fdd3[_0x3173('0x2f')]){if(_0x26fdd3[_0x3173('0x56')]){var _0x116b26={'method':_0x3173('0x3f'),'uri':_0x26fdd3[_0x3173('0x56')]+'/auth/1/session','body':{'username':_0x26fdd3[_0x3173('0x2e')],'password':_0x26fdd3[_0x3173('0x2f')]},'json':!![]};return rp(_0x116b26)[_0x3173('0x14')](function(_0x17cf8f){var _0x2e6c60={'method':'POST','uri':_0x26fdd3[_0x3173('0x56')]+_0x3173('0x57'),'body':{'messages':[{'from':_0x26fdd3[_0x3173('0x1d')],'destinations':[{'to':_0x4e89ef[_0x3173('0x1d')]}],'text':_0x4e89ef[_0x3173('0x20')],'notifyUrl':_0x26fdd3['remote']+'/api/sms/messages/'+_0x4e89ef['id']+_0x3173('0x23')+_0x26fdd3[_0x3173('0x24')],'notifyContentType':'application/json','callbackData':_0x26fdd3[_0x3173('0x1d')]+';'+_0x4e89ef[_0x3173('0x20')]}]},'headers':{'Authorization':_0x3173('0x58')+_0x17cf8f[_0x3173('0x24')]},'json':!![]};return rp(_0x2e6c60)[_0x3173('0x14')](function(_0x38976c){if(_0x38976c[_0x3173('0x1e')]){var _0x532265={'messageId':_0x38976c['messages'][0x0][_0x3173('0x9')]};if(!_0x26fdd3[_0x3173('0x39')]){_0x532265[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x532265);}else{return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x55'),util[_0x3173('0x2a')](_0x38976c,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4bd7ed){return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x55'),util['inspect'](_0x4bd7ed,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),'infobip',_0x3173('0x3c'));}break;case _0x3173('0x59'):var _0x1fa20b=require('crypto');if(_0x26fdd3['apiKey']){var _0x4b4e22={};_0x4b4e22[_0x3173('0x5a')]=_0x26fdd3[_0x3173('0x2e')];_0x4b4e22[_0x3173('0x1d')]=_0x4e89ef[_0x3173('0x1d')];_0x4b4e22['sender']=_0x26fdd3[_0x3173('0x1d')];_0x4b4e22['text']=_0x4e89ef['body'];_0x4b4e22['timestamp']=+new Date();var _0x407db3='';var _0x2bb0ac='';var _0x2a02c1=Object['keys'](_0x4b4e22);_0x2a02c1['sort']();for(var _0x9844eb=0x0;_0x9844eb<_0x2a02c1['length'];_0x9844eb++){if(_0x407db3!=''){_0x407db3+='&';}_0x407db3+=_0x2a02c1[_0x9844eb]+'='+encodeURIComponent(_0x4b4e22[_0x2a02c1[_0x9844eb]]);_0x2bb0ac+=_0x4b4e22[_0x2a02c1[_0x9844eb]];}_0x2bb0ac+=_0x26fdd3[_0x3173('0x5b')];_0x2bb0ac=_0x1fa20b[_0x3173('0x5c')](_0x3173('0x5d'))['update'](_0x2bb0ac)[_0x3173('0x5e')](_0x3173('0x5f'));if(_0x407db3!==''){_0x407db3+='&';}_0x407db3+=_0x3173('0x60')+_0x2bb0ac;var _0xfb44cb={'method':_0x3173('0x61'),'uri':_0x26fdd3[_0x3173('0x56')]+'/external/get/send.php?'+_0x407db3,'json':!![]};return rp(_0xfb44cb)[_0x3173('0x14')](function(_0xfd4899){var _0xe298ca=Object[_0x3173('0x62')](_0xfd4899);if(_0xfd4899[_0xe298ca[0x0]][_0x3173('0x27')]&&parseInt(_0xfd4899[_0xe298ca[0x0]][_0x3173('0x27')])===0x0){var _0x38bbea={'messageId':_0xfd4899[_0xe298ca[0x0]]['id_sms']};if(!_0x26fdd3['deliveryReport']){_0x38bbea[_0x3173('0x3a')]=!![];}return _0x531c05[_0x3173('0x3b')](_0x38bbea);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x59'),util[_0x3173('0x2a')](_0xfd4899['error'],{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x57a543){return logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x59'),util[_0x3173('0x2a')](_0x57a543,{'showHidden':![],'depth':null}));});}else{logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x3173('0x63'):if(_0x26fdd3[_0x3173('0x5b')]){var _0x483791={'method':_0x3173('0x3f'),'uri':_0x3173('0x64'),'headers':{'Authorization':_0x26fdd3[_0x3173('0x5b')]},'body':{'content':_0x4e89ef[_0x3173('0x20')],'to':[_0x4e89ef['phone']],'from':_0x26fdd3['phone'],'binary':![],'clientMessageId':_0x3173('0x65'),'charset':_0x3173('0x66')},'json':!![]};rp(_0x483791)[_0x3173('0x14')](function(_0x5f0975){if(!_0x5f0975[_0x3173('0x27')]){var _0x7a2526={'messageId':_0x5f0975[_0x3173('0x1e')][0x0][_0x3173('0x67')]};if(!_0x26fdd3['deliveryReport']){_0x7a2526['read']=!![];}return _0x531c05[_0x3173('0x3b')](_0x7a2526);}else{return logger[_0x3173('0x27')](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x63'),util[_0x3173('0x2a')](_0x5f0975[_0x3173('0x27')],{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x5a5f43){return logger[_0x3173('0x27')](_0x3173('0x28'),'afterCreate','clickatell',util[_0x3173('0x2a')](_0x5a5f43,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x63'),_0x3173('0x68'));}break;case'intelepeer':if(_0x26fdd3[_0x3173('0x5b')]){var _0x1ba8f3={};var _0xfb44cb={'method':_0x3173('0x3f'),'uri':_0x3173('0x69'),'headers':{'Authorization':'Bearer\x20'+_0x26fdd3['apiKey'],'Content-Type':_0x3173('0x6a')},'body':{'from':_0x26fdd3['phone'],'to':_0x4e89ef[_0x3173('0x1d')],'text':_0x4e89ef[_0x3173('0x20')]},'json':!![]};return rp(_0xfb44cb)['then'](function(_0x3d6774){if(_0x3d6774[_0x3173('0x6b')]==0xca){_0x1ba8f3[_0x3173('0x6c')]=_0x3d6774;var _0x500807={'method':'POST','uri':_0x3173('0x6d'),'headers':{'Authorization':_0x3173('0x6e')+_0x26fdd3[_0x3173('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x1ba8f3['message'][_0x3173('0x6f')]},'json':!![]};return rp(_0x500807)[_0x3173('0x14')](function(_0x4675b3){_0x1ba8f3[_0x3173('0x70')]=_0x4675b3;var _0x318734={'messageId':_0x1ba8f3[_0x3173('0x6c')][_0x3173('0x6f')],'read':!![]};return _0x531c05['update'](_0x318734);});}else{return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),'intelepeer',util[_0x3173('0x2a')](_0x3d6774,{'showHidden':![],'depth':null}));}})[_0x3173('0x26')](function(_0x16ba5c){return logger[_0x3173('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3173('0x29'),_0x3173('0x71'),util['inspect'](_0x16ba5c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x3173('0x28'),_0x3173('0x29'),_0x3173('0x71'),_0x3173('0x72'));}break;}}})[_0x3173('0x73')](function(){_0xdd32ba();});}else{_0xdd32ba();}}},'charset':_0x3173('0x74'),'collate':_0x3173('0x75')});}; \ No newline at end of file +var _0x41d1=['type','twilio','accountSid','messages','phone','remote','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','password','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','authToken','https://smsapi.connectel.se/api/send/','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','md5','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','models','get','direction','toLowerCase','out','UserId','SmsInteractionId','update','createdAt','catch','error','secret','SmsAccount','find','then'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x41d1,0xc7));var _0x141d=function(_0x4a232c,_0x4db76b){_0x4a232c=_0x4a232c-0x0;var _0xb5807f=_0x41d1[_0x4a232c];return _0xb5807f;};'use strict';var _=require('lodash');var util=require(_0x141d('0x0'));var logger=require(_0x141d('0x1'))(_0x141d('0x2'));var moment=require('moment');var BPromise=require(_0x141d('0x3'));var rp=require(_0x141d('0x4'));var fs=require('fs');var path=require(_0x141d('0x5'));var rimraf=require(_0x141d('0x6'));var config=require(_0x141d('0x7'));var attributes=require(_0x141d('0x8'));module[_0x141d('0x9')]=function(_0x57c059,_0x2db9eb){return _0x57c059[_0x141d('0xa')](_0x141d('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x141d('0xc'),'fields':[_0x141d('0xc')]},{'name':'fti_sms_messages','fields':[_0x141d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28db36,_0x49ea4e,_0x145062){var _0x34a70e=_0x57c059[_0x141d('0xe')];var _0x131b45=_0x28db36[_0x141d('0xf')]({'plain':!![]});if(_0x131b45[_0x141d('0x10')][_0x141d('0x11')]()==='in'||_0x131b45[_0x141d('0x10')][_0x141d('0x11')]()===_0x141d('0x12')&&!_0x131b45['secret']&&!_['isNil'](_0x131b45[_0x141d('0x13')])){_0x34a70e['SmsInteraction']['findOne']({'where':{'id':_0x131b45[_0x141d('0x14')]}})['then'](function(_0x4e133a){if(_0x4e133a){_0x4e133a[_0x141d('0x15')]({'lastMsgAt':_0x131b45[_0x141d('0x16')],'lastMsgDirection':_0x131b45[_0x141d('0x10')]['toLowerCase']()});}})[_0x141d('0x17')](function(_0x2f28a9){console[_0x141d('0x18')](_0x2f28a9);});}if(_0x131b45['direction']===_0x141d('0x12')&&!_0x131b45[_0x141d('0x19')]){var _0x5e309a;_0x34a70e[_0x141d('0x1a')][_0x141d('0x1b')]({'where':{'id':_0x131b45['SmsAccountId']},'raw':!![]})[_0x141d('0x1c')](function(_0x5b0b3a){_0x5e309a=_0x5b0b3a;if(_0x5e309a&&_0x5e309a['type']){switch(_0x5e309a[_0x141d('0x1d')]){case _0x141d('0x1e'):var _0x280e8d=require(_0x141d('0x1e'));if(_0x5e309a[_0x141d('0x1f')]&&_0x5e309a['authToken']&&_0x5e309a['phone']){var _0x7bf407=new _0x280e8d(_0x5e309a[_0x141d('0x1f')],_0x5e309a['authToken']);_0x7bf407[_0x141d('0x20')]['create']({'body':_0x131b45['body'],'to':_0x131b45[_0x141d('0x21')],'from':_0x5e309a['phone'],'statusCallback':_0x5e309a[_0x141d('0x22')]+_0x141d('0x23')+_0x131b45['id']+_0x141d('0x24')+_0x5e309a[_0x141d('0x25')]})[_0x141d('0x1c')](function(_0x3789b6){if(_0x3789b6['sid']){return _0x28db36[_0x141d('0x15')]({'messageId':_0x3789b6['sid']});}})[_0x141d('0x17')](function(_0x3c20d9){logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x1e'),util[_0x141d('0x28')](_0x3c20d9,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x141d('0x1e'),_0x141d('0x29'));}break;case _0x141d('0x2a'):var _0xa52509=_0x141d('0x2b');if(_0x5e309a[_0x141d('0x2c')]&&_0x5e309a['password']){var _0x3d4d82={'recipient':[_0x131b45[_0x141d('0x21')]],'message':_0x131b45[_0x141d('0xd')],'message_type':_0x5e309a[_0x141d('0x2d')]};if(_0x5e309a[_0x141d('0x2d')]&&_0x5e309a[_0x141d('0x2d')]!=='SI'){_0x3d4d82['sender']=_0x5e309a[_0x141d('0x21')];}var _0x2861c2={'url':_0xa52509+_0x141d('0x2e')+_0x5e309a[_0x141d('0x2c')]+'&password='+_0x5e309a[_0x141d('0x2f')],'method':_0x141d('0x30')};rp(_0x2861c2)[_0x141d('0x1c')](function(_0x3959cd){var _0x455718=_0x3959cd[_0x141d('0x31')](';');var _0x180873={'user_key':_0x455718[0x0],'session_key':_0x455718[0x1]};_0x2861c2={'url':_0xa52509+_0x141d('0x32'),'method':_0x141d('0x33'),'headers':{'user_key':_0x180873['user_key'],'Session_key':_0x180873[_0x141d('0x34')]},'json':!![],'body':_0x3d4d82};return rp(_0x2861c2);})['then'](function(_0x3a8470){if(_0x3a8470[_0x141d('0x35')]>=0x1){var _0x46d8d1={'messageId':_0x3a8470[_0x141d('0x36')]};if(_0x5e309a[_0x141d('0x2d')]!=='GP'||!_0x5e309a[_0x141d('0x37')]){_0x46d8d1[_0x141d('0x38')]=!![];}return _0x28db36[_0x141d('0x15')](_0x46d8d1);}else{return logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x2a'),util[_0x141d('0x28')](_0x3a8470,{'showHidden':![],'depth':null}));}})[_0x141d('0x17')](function(_0x525146){return logger['error'](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x2a'),util[_0x141d('0x28')](_0x525146,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x141d('0x27'),_0x141d('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x5e309a[_0x141d('0x39')]){var _0x6ca04e={'recipient':_0x131b45[_0x141d('0x21')],'message':_0x131b45[_0x141d('0xd')],'sender':_0x5e309a['senderString']||_0x5e309a[_0x141d('0x21')],'authorization':_0x5e309a['authToken']};var _0x49ea4e={'method':_0x141d('0x33'),'uri':_0x141d('0x3a'),'body':_0x6ca04e,'json':!![]};rp(_0x49ea4e)[_0x141d('0x1c')](function(_0x5176ce){var _0x341657={'messageId':_0x5176ce['requestid']};if(!_0x5e309a['deliveryReport']){_0x341657['read']=!![];}return _0x28db36[_0x141d('0x15')](_0x341657);})[_0x141d('0x17')](function(_0x11dde5){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x141d('0x27'),_0x141d('0x3b'),util[_0x141d('0x28')](_0x11dde5,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x141d('0x3c'):if(_0x5e309a[_0x141d('0x2c')]&&_0x5e309a[_0x141d('0x2f')]){var _0x6ca04e={'messages':[{'source':_0x141d('0x3d'),'to':_0x131b45[_0x141d('0x21')],'body':_0x131b45['body'],'from':_0x5e309a['senderString']||_0x5e309a[_0x141d('0x21')]}]};var _0x2ab6fe=util[_0x141d('0x3e')](_0x141d('0x3f'),_0x5e309a[_0x141d('0x2c')],_0x5e309a[_0x141d('0x2f')]);var _0x49ea4e={'method':_0x141d('0x33'),'uri':_0x141d('0x40'),'body':_0x6ca04e,'headers':{'Authorization':util[_0x141d('0x3e')](_0x141d('0x41'),new Buffer(_0x2ab6fe)[_0x141d('0x42')](_0x141d('0x43')))},'json':!![]};rp(_0x49ea4e)[_0x141d('0x1c')](function(_0x1dae23){if(_0x1dae23['http_code']>=0xc8&&_0x1dae23[_0x141d('0x44')]<=0xce){if(_0x1dae23[_0x141d('0x45')]&&_0x1dae23[_0x141d('0x45')][_0x141d('0x46')]>0x0){var _0xd6aeaa=_['head'](_0x1dae23[_0x141d('0x45')][_0x141d('0x20')]);var _0x187247={'messageId':_0xd6aeaa[_0x141d('0x47')]};if(!_0x5e309a[_0x141d('0x37')]){_0x187247[_0x141d('0x38')]=!![];}return _0x28db36[_0x141d('0x15')](_0x187247);}else{logger[_0x141d('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x141d('0x48'),util['inspect'](_0x1dae23,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x141d('0x26'),'afterCreate',_0x141d('0x48'),util[_0x141d('0x28')](_0x1dae23,{'showHidden':![],'depth':null}));}})[_0x141d('0x17')](function(_0x535393){logger[_0x141d('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x141d('0x27'),'clickSend',util[_0x141d('0x28')](_0x535393,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),'clickSend',_0x141d('0x49'));}break;case _0x141d('0x4a'):if(_0x5e309a[_0x141d('0x4b')]&&_0x5e309a[_0x141d('0x39')]){var _0x6ca04e={'dst':_0x131b45[_0x141d('0x21')],'text':_0x131b45[_0x141d('0xd')],'src':_0x5e309a[_0x141d('0x4c')]||_0x5e309a[_0x141d('0x21')],'url':_0x5e309a[_0x141d('0x22')]+_0x141d('0x23')+_0x131b45['id']+'/status?token='+_0x5e309a[_0x141d('0x25')]};var _0x2ab6fe=util[_0x141d('0x3e')](_0x141d('0x3f'),_0x5e309a[_0x141d('0x4b')],_0x5e309a['authToken']);var _0x49ea4e={'method':'POST','uri':util['format'](_0x141d('0x4d'),_0x5e309a[_0x141d('0x4b')]),'body':_0x6ca04e,'headers':{'Authorization':util[_0x141d('0x3e')](_0x141d('0x41'),new Buffer(_0x2ab6fe)['toString']('base64'))},'json':!![]};rp(_0x49ea4e)[_0x141d('0x1c')](function(_0x3e450a){var _0x50e7a7={'messageId':_0x3e450a['message_uuid'][0x0]};return _0x28db36[_0x141d('0x15')](_0x50e7a7);})[_0x141d('0x17')](function(_0x4ea801){logger['error'](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x4a'),util[_0x141d('0x28')](_0x4ea801,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')](_0x141d('0x26'),'afterCreate',_0x141d('0x4a'),_0x141d('0x4e'));}break;case'infobip':if(_0x5e309a[_0x141d('0x2c')]&&_0x5e309a['password']){if(_0x5e309a[_0x141d('0x4f')]){var _0x6ee206={'method':_0x141d('0x33'),'uri':_0x5e309a[_0x141d('0x4f')]+_0x141d('0x50'),'body':{'username':_0x5e309a['username'],'password':_0x5e309a[_0x141d('0x2f')]},'json':!![]};return rp(_0x6ee206)[_0x141d('0x1c')](function(_0x34bc4d){var _0x5b8133={'method':_0x141d('0x33'),'uri':_0x5e309a[_0x141d('0x4f')]+_0x141d('0x51'),'body':{'messages':[{'from':_0x5e309a[_0x141d('0x21')],'destinations':[{'to':_0x131b45[_0x141d('0x21')]}],'text':_0x131b45['body'],'notifyUrl':_0x5e309a['remote']+_0x141d('0x23')+_0x131b45['id']+_0x141d('0x24')+_0x5e309a[_0x141d('0x25')],'notifyContentType':_0x141d('0x52'),'callbackData':_0x5e309a[_0x141d('0x21')]+';'+_0x131b45[_0x141d('0xd')]}]},'headers':{'Authorization':_0x141d('0x53')+_0x34bc4d[_0x141d('0x25')]},'json':!![]};return rp(_0x5b8133)[_0x141d('0x1c')](function(_0x1c8acb){if(_0x1c8acb['messages']){var _0x40be32={'messageId':_0x1c8acb['messages'][0x0][_0x141d('0xc')]};if(!_0x5e309a[_0x141d('0x37')]){_0x40be32[_0x141d('0x38')]=!![];}return _0x28db36[_0x141d('0x15')](_0x40be32);}else{return logger[_0x141d('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x141d('0x54'),util[_0x141d('0x28')](_0x1c8acb,{'showHidden':![],'depth':null}));}});})[_0x141d('0x17')](function(_0x337c1d){return logger['error'](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x54'),util[_0x141d('0x28')](_0x337c1d,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),'infobip',_0x141d('0x55'));}}else{logger[_0x141d('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x141d('0x27'),'infobip',_0x141d('0x49'));}break;case _0x141d('0x56'):var _0x5d3222=require(_0x141d('0x57'));if(_0x5e309a['apiKey']){var _0x5c8e6a={};_0x5c8e6a[_0x141d('0x58')]=_0x5e309a[_0x141d('0x2c')];_0x5c8e6a[_0x141d('0x21')]=_0x131b45[_0x141d('0x21')];_0x5c8e6a['sender']=_0x5e309a[_0x141d('0x21')];_0x5c8e6a[_0x141d('0x59')]=_0x131b45[_0x141d('0xd')];_0x5c8e6a[_0x141d('0x5a')]=+new Date();var _0x5b2aa1='';var _0x205482='';var _0x59586e=Object[_0x141d('0x5b')](_0x5c8e6a);_0x59586e[_0x141d('0x5c')]();for(var _0x3949e2=0x0;_0x3949e2<_0x59586e[_0x141d('0x5d')];_0x3949e2++){if(_0x5b2aa1!=''){_0x5b2aa1+='&';}_0x5b2aa1+=_0x59586e[_0x3949e2]+'='+encodeURIComponent(_0x5c8e6a[_0x59586e[_0x3949e2]]);_0x205482+=_0x5c8e6a[_0x59586e[_0x3949e2]];}_0x205482+=_0x5e309a[_0x141d('0x5e')];_0x205482=_0x5d3222['createHash'](_0x141d('0x5f'))[_0x141d('0x15')](_0x205482)[_0x141d('0x60')]('hex');if(_0x5b2aa1!==''){_0x5b2aa1+='&';}_0x5b2aa1+=_0x141d('0x61')+_0x205482;var _0x2861c2={'method':_0x141d('0x30'),'uri':_0x5e309a['baseUrl']+'/external/get/send.php?'+_0x5b2aa1,'json':!![]};return rp(_0x2861c2)[_0x141d('0x1c')](function(_0x394917){var _0x128629=Object['keys'](_0x394917);if(_0x394917[_0x128629[0x0]]['error']&&parseInt(_0x394917[_0x128629[0x0]]['error'])===0x0){var _0x540aed={'messageId':_0x394917[_0x128629[0x0]][_0x141d('0x62')]};if(!_0x5e309a['deliveryReport']){_0x540aed[_0x141d('0x38')]=!![];}return _0x28db36[_0x141d('0x15')](_0x540aed);}else{return logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),'csc',util[_0x141d('0x28')](_0x394917[_0x141d('0x18')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x574516){return logger[_0x141d('0x18')](_0x141d('0x26'),'afterCreate','csc',util[_0x141d('0x28')](_0x574516,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x141d('0x26'),'afterCreate',_0x141d('0x56'),_0x141d('0x63'));}break;case'clickatell':if(_0x5e309a['apiKey']){var _0x5a1e16={'method':_0x141d('0x33'),'uri':_0x141d('0x64'),'headers':{'Authorization':_0x5e309a[_0x141d('0x5e')]},'body':{'content':_0x131b45[_0x141d('0xd')],'to':[_0x131b45['phone']],'from':_0x5e309a['phone'],'binary':![],'clientMessageId':_0x141d('0x65'),'charset':'UTF-8'},'json':!![]};rp(_0x5a1e16)['then'](function(_0x32cedc){if(!_0x32cedc[_0x141d('0x18')]){var _0x3b5311={'messageId':_0x32cedc[_0x141d('0x20')][0x0][_0x141d('0x66')]};if(!_0x5e309a[_0x141d('0x37')]){_0x3b5311['read']=!![];}return _0x28db36[_0x141d('0x15')](_0x3b5311);}else{return logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x67'),util[_0x141d('0x28')](_0x32cedc[_0x141d('0x18')],{'showHidden':![],'depth':null}));}})[_0x141d('0x17')](function(_0x57e677){return logger['error'](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x67'),util['inspect'](_0x57e677,{'showHidden':![],'depth':null}));});}else{logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x67'),_0x141d('0x63'));}break;case _0x141d('0x68'):if(_0x5e309a[_0x141d('0x5e')]){var _0xe37887={};var _0x2861c2={'method':_0x141d('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x141d('0x69')+_0x5e309a[_0x141d('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x5e309a[_0x141d('0x21')],'to':_0x131b45[_0x141d('0x21')],'text':_0x131b45[_0x141d('0xd')]},'json':!![]};return rp(_0x2861c2)[_0x141d('0x1c')](function(_0x4394fa){if(_0x4394fa[_0x141d('0x6a')]==0xca){_0xe37887['message']=_0x4394fa;var _0x4c687f={'method':_0x141d('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x141d('0x69')+_0x5e309a[_0x141d('0x5e')],'Content-Type':_0x141d('0x52')},'body':{'refid':_0xe37887[_0x141d('0x6b')][_0x141d('0x6c')]},'json':!![]};return rp(_0x4c687f)[_0x141d('0x1c')](function(_0xf7654a){_0xe37887[_0x141d('0x6d')]=_0xf7654a;var _0x3ee95f={'messageId':_0xe37887[_0x141d('0x6b')]['refid'],'read':!![]};return _0x28db36['update'](_0x3ee95f);});}else{return logger['error'](_0x141d('0x26'),'afterCreate','intelepeer',util[_0x141d('0x28')](_0x4394fa,{'showHidden':![],'depth':null}));}})[_0x141d('0x17')](function(_0x320fb9){return logger[_0x141d('0x18')](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x68'),util[_0x141d('0x28')](_0x320fb9,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x141d('0x26'),_0x141d('0x27'),_0x141d('0x68'),_0x141d('0x6e'));}break;}}})[_0x141d('0x6f')](function(){_0x145062();});}else{_0x145062();}}},'charset':_0x141d('0x70'),'collate':_0x141d('0x71')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 383e5f7..fbed71f 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body'];(function(_0xb9c0ae,_0x43d1ad){var _0x579954=function(_0x1ca994){while(--_0x1ca994){_0xb9c0ae['push'](_0xb9c0ae['shift']());}};_0x579954(++_0x43d1ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x272587,_0x4e5fb1){_0x272587=_0x272587-0x0;var _0x3c2ff6=_0xb10b[_0x272587];return _0x3c2ff6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x259f41,_0x56781c){var _0x14ff35=function(_0x29f6ce){while(--_0x29f6ce){_0x259f41['push'](_0x259f41['shift']());}};_0x14ff35(++_0x56781c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x32bc16,_0x542550){_0x32bc16=_0x32bc16-0x0;var _0xd8beb1=_0x5f2f[_0x32bc16];return _0xd8beb1;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 2a48b4d..fcf546e 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 _0xce72=['smsMessage:','./smsMessage.events','update','emit','removeListener','register','length'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0xce72,0x13c));var _0x2ce7=function(_0x311121,_0x5ea9ce){_0x311121=_0x311121-0x0;var _0x1f3d47=_0xce72[_0x311121];return _0x1f3d47;};'use strict';var SmsMessageEvents=require(_0x2ce7('0x0'));var events=['save','remove',_0x2ce7('0x1')];function createListener(_0x3453d5,_0x277ceb){return function(_0x31c55e){_0x277ceb[_0x2ce7('0x2')](_0x3453d5,_0x31c55e);};}function removeListener(_0x5a777c,_0x59b86c){return function(){SmsMessageEvents[_0x2ce7('0x3')](_0x5a777c,_0x59b86c);};}exports[_0x2ce7('0x4')]=function(_0x475f7f){for(var _0x259618=0x0,_0xf9c423=events[_0x2ce7('0x5')];_0x259618<_0xf9c423;_0x259618++){var _0x40bd3d=events[_0x259618];var _0x26023b=createListener(_0x2ce7('0x6')+_0x40bd3d,_0x475f7f);SmsMessageEvents['on'](_0x40bd3d,_0x26023b);}}; \ No newline at end of file +var _0xad89=['removeListener','register','length','smsMessage:','./smsMessage.events','save','update','emit'];(function(_0x497083,_0x42efe1){var _0xffab47=function(_0x308b0d){while(--_0x308b0d){_0x497083['push'](_0x497083['shift']());}};_0xffab47(++_0x42efe1);}(_0xad89,0xb4));var _0x9ad8=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xad89[_0x5da0d9];return _0x4b6d2f;};'use strict';var SmsMessageEvents=require(_0x9ad8('0x0'));var events=[_0x9ad8('0x1'),'remove',_0x9ad8('0x2')];function createListener(_0x561c76,_0x60daca){return function(_0x409881){_0x60daca[_0x9ad8('0x3')](_0x561c76,_0x409881);};}function removeListener(_0x1eadfa,_0x201379){return function(){SmsMessageEvents[_0x9ad8('0x4')](_0x1eadfa,_0x201379);};}exports[_0x9ad8('0x5')]=function(_0x450576){for(var _0x71d0e6=0x0,_0x1e891c=events[_0x9ad8('0x6')];_0x71d0e6<_0x1e891c;_0x71d0e6++){var _0x954f3=events[_0x71d0e6];var _0x1f7779=createListener(_0x9ad8('0x7')+_0x954f3,_0x450576);SmsMessageEvents['on'](_0x954f3,_0x1f7779);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e322a02..40a3ea9 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 _0xe635=['path','connect-timeout','express','Router','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util'];(function(_0x308f01,_0x559dd9){var _0x3496a2=function(_0xce556){while(--_0xce556){_0x308f01['push'](_0x308f01['shift']());}};_0x3496a2(++_0x559dd9);}(_0xe635,0x1be));var _0x5e63=function(_0x70fa60,_0x1460c0){_0x70fa60=_0x70fa60-0x0;var _0xa48a63=_0xe635[_0x70fa60];return _0xa48a63;};'use strict';var multer=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var path=require(_0x5e63('0x2'));var timeout=require(_0x5e63('0x3'));var express=require(_0x5e63('0x4'));var router=express[_0x5e63('0x5')]();var auth=require(_0x5e63('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e63('0x7'));router[_0x5e63('0x8')]('/',auth[_0x5e63('0x9')](),controller[_0x5e63('0xa')]);router[_0x5e63('0x8')](_0x5e63('0xb'),auth[_0x5e63('0x9')](),controller[_0x5e63('0xc')]);router[_0x5e63('0x8')](_0x5e63('0xd'),auth['isAuthenticated'](),controller[_0x5e63('0xe')]);router[_0x5e63('0x8')](_0x5e63('0xf'),auth[_0x5e63('0x9')](),controller['getMembers']);router[_0x5e63('0x8')](_0x5e63('0x10'),auth['isAuthenticated'](),controller[_0x5e63('0x11')]);router[_0x5e63('0x8')]('/:id/users',auth[_0x5e63('0x9')](),controller['getAgents']);router[_0x5e63('0x12')]('/',auth[_0x5e63('0x9')](),controller[_0x5e63('0x13')]);router[_0x5e63('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5e63('0x12')](_0x5e63('0x14'),auth['isAuthenticated'](),controller[_0x5e63('0x15')]);router[_0x5e63('0x16')](_0x5e63('0xd'),auth['isAuthenticated'](),controller[_0x5e63('0x17')]);router[_0x5e63('0x18')](_0x5e63('0xd'),auth[_0x5e63('0x9')](),controller[_0x5e63('0x19')]);router['delete'](_0x5e63('0x10'),auth[_0x5e63('0x9')](),controller[_0x5e63('0x1a')]);router[_0x5e63('0x18')](_0x5e63('0x14'),auth['isAuthenticated'](),controller[_0x5e63('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xcb41=['getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x35d7c9,_0x1c6c03){var _0x3c80e8=function(_0x3c71a4){while(--_0x3c71a4){_0x35d7c9['push'](_0x35d7c9['shift']());}};_0x3c80e8(++_0x1c6c03);}(_0xcb41,0x1df));var _0x1cb4=function(_0x2fd2a7,_0x5b797e){_0x2fd2a7=_0x2fd2a7-0x0;var _0x42fe5b=_0xcb41[_0x2fd2a7];return _0x42fe5b;};'use strict';var multer=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var path=require(_0x1cb4('0x2'));var timeout=require(_0x1cb4('0x3'));var express=require('express');var router=express[_0x1cb4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb4('0x5'));var config=require(_0x1cb4('0x6'));var controller=require(_0x1cb4('0x7'));router[_0x1cb4('0x8')]('/',auth[_0x1cb4('0x9')](),controller[_0x1cb4('0xa')]);router[_0x1cb4('0x8')](_0x1cb4('0xb'),auth['isAuthenticated'](),controller[_0x1cb4('0xc')]);router[_0x1cb4('0x8')]('/:id',auth[_0x1cb4('0x9')](),controller[_0x1cb4('0xd')]);router[_0x1cb4('0x8')]('/:id/members',auth[_0x1cb4('0x9')](),controller[_0x1cb4('0xe')]);router[_0x1cb4('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1cb4('0xf')]);router['get'](_0x1cb4('0x10'),auth[_0x1cb4('0x9')](),controller[_0x1cb4('0x11')]);router[_0x1cb4('0x12')]('/',auth[_0x1cb4('0x9')](),controller['create']);router[_0x1cb4('0x12')]('/:id/teams',auth[_0x1cb4('0x9')](),controller[_0x1cb4('0x13')]);router[_0x1cb4('0x12')](_0x1cb4('0x10'),auth[_0x1cb4('0x9')](),controller[_0x1cb4('0x14')]);router[_0x1cb4('0x15')](_0x1cb4('0x16'),auth[_0x1cb4('0x9')](),controller[_0x1cb4('0x17')]);router['delete'](_0x1cb4('0x16'),auth['isAuthenticated'](),controller[_0x1cb4('0x18')]);router[_0x1cb4('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1cb4('0x1a')]);router[_0x1cb4('0x19')](_0x1cb4('0x10'),auth[_0x1cb4('0x9')](),controller[_0x1cb4('0x1b')]);module[_0x1cb4('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7d8284e..09e733d 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 _0x94f7=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x44fa97,_0x1575c7){var _0x15a029=function(_0xc5dc83){while(--_0xc5dc83){_0x44fa97['push'](_0x44fa97['shift']());}};_0x15a029(++_0x1575c7);}(_0x94f7,0x13c));var _0x794f=function(_0x4515a9,_0x523d5c){_0x4515a9=_0x4515a9-0x0;var _0xeb88f5=_0x94f7[_0x4515a9];return _0xeb88f5;};'use strict';var Sequelize=require(_0x794f('0x0'));module[_0x794f('0x1')]={'name':{'type':Sequelize[_0x794f('0x2')],'unique':_0x794f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x794f('0x2')]},'timeout':{'type':Sequelize[_0x794f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x794f('0x5')](_0x794f('0x6'),_0x794f('0x7'),_0x794f('0x8'))}}; \ No newline at end of file +var _0x25a9=['STRING','INTEGER','ENUM','beepall','sequelize','exports','name'];(function(_0x271778,_0x7f6ab2){var _0x1471f6=function(_0x441726){while(--_0x441726){_0x271778['push'](_0x271778['shift']());}};_0x1471f6(++_0x7f6ab2);}(_0x25a9,0xc1));var _0x925a=function(_0x1a9f8b,_0x53ac1b){_0x1a9f8b=_0x1a9f8b-0x0;var _0x12a2c1=_0x25a9[_0x1a9f8b];return _0x12a2c1;};'use strict';var Sequelize=require(_0x925a('0x0'));module[_0x925a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x925a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x925a('0x3')]},'timeout':{'type':Sequelize[_0x925a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x925a('0x5')]('rrmemory',_0x925a('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 35aab20..3d52c10 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 _0x06e3=['all','union','value','isEmpty','userSmsQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','SmsQueues','end','error','stack','name','index','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','map','VIRTUAL','filter','merge','include','SmsQueue','findAll','show','params','keys','length','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','sort','SmsQueueId','User','UserId','agent','createdAt','rows','format','SIP','smsPause','updatedAt','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','ids','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','every','TeamId','includes'];(function(_0x200f67,_0x31e104){var _0x481652=function(_0x243673){while(--_0x243673){_0x200f67['push'](_0x200f67['shift']());}};_0x481652(++_0x31e104);}(_0x06e3,0x8a));var _0x306e=function(_0x2a3091,_0x1157bd){_0x2a3091=_0x2a3091-0x0;var _0x4be3e5=_0x06e3[_0x2a3091];return _0x4be3e5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x306e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x306e('0x1'));var rp=require(_0x306e('0x2'));var moment=require(_0x306e('0x3'));var BPromise=require(_0x306e('0x4'));var Mustache=require(_0x306e('0x5'));var util=require(_0x306e('0x6'));var path=require(_0x306e('0x7'));var sox=require(_0x306e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x306e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x306e('0xa'));var deskjs=require(_0x306e('0xb'));var toCsv=require(_0x306e('0xc'));var querystring=require(_0x306e('0xd'));var Papa=require(_0x306e('0xe'));var Redis=require(_0x306e('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(_0x306e('0x10'))(_0x306e('0x11'));var utils=require(_0x306e('0x12'));var config=require(_0x306e('0x13'));var db=require(_0x306e('0x14'))['db'];config[_0x306e('0x15')]=_[_0x306e('0x16')](config[_0x306e('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x306e('0x17'))(new Redis(config['redis']));require(_0x306e('0x18'))['register'](socket);function respondWithStatusCode(_0x55c0f3,_0x30558e){_0x30558e=_0x30558e||0xcc;return function(_0x2cf66f){if(_0x2cf66f){return _0x55c0f3[_0x306e('0x19')](_0x30558e);}return _0x55c0f3[_0x306e('0x1a')](_0x30558e)['end']();};}function respondWithResult(_0x3af1a6,_0x48ec20){_0x48ec20=_0x48ec20||0xc8;return function(_0x7a1dc4){if(_0x7a1dc4){return _0x3af1a6[_0x306e('0x1a')](_0x48ec20)[_0x306e('0x1b')](_0x7a1dc4);}};}function respondWithFilteredResult(_0x33d147,_0x54b1e5){return function(_0x22e7b9){if(_0x22e7b9){var _0x51e8bf=_0x22e7b9[_0x306e('0x1c')],_0x1a52d8=_0x54b1e5[_0x306e('0x1d')],_0x1e03cb=_0x54b1e5[_0x306e('0x1d')]+_0x54b1e5[_0x306e('0x1e')],_0x256993;if(_0x1e03cb>=_0x51e8bf){_0x1e03cb=_0x51e8bf;_0x256993=0xc8;}else{_0x256993=0xce;}_0x33d147['status'](_0x256993);return _0x33d147[_0x306e('0x1f')]('Content-Range',_0x1a52d8+'-'+_0x1e03cb+'/'+_0x51e8bf)[_0x306e('0x1b')](_0x22e7b9);}return null;};}function patchUpdates(_0x509074){return function(_0x23a120){try{jsonpatch[_0x306e('0x20')](_0x23a120,_0x509074,!![]);}catch(_0x2b2048){return BPromise[_0x306e('0x21')](_0x2b2048);}return _0x23a120[_0x306e('0x22')]();};}function saveUpdates(_0x1f5ba7,_0xabaea0){return function(_0x9cb39c){if(_0x9cb39c){return _0x9cb39c[_0x306e('0x23')](_0x1f5ba7)[_0x306e('0x24')](function(_0x543eab){return _0x543eab;});}return null;};}function removeEntity(_0x54045e,_0x32d842){return function(_0x3d6eae){if(_0x3d6eae){return _0x3d6eae[_0x306e('0x25')]()[_0x306e('0x24')](function(){var _0x455072=_0x3d6eae['get']({'plain':!![]});var _0x6ea923=_0x306e('0x26');return db['UserProfileResource'][_0x306e('0x25')]({'where':{'type':_0x6ea923,'resourceId':_0x455072['id']}})[_0x306e('0x24')](function(){return _0x3d6eae;});})[_0x306e('0x24')](function(){_0x54045e[_0x306e('0x1a')](0xcc)[_0x306e('0x27')]();});}};}function handleEntityNotFound(_0x2e1e4e,_0x4f12c7){return function(_0x2d1a21){if(!_0x2d1a21){_0x2e1e4e[_0x306e('0x19')](0x194);}return _0x2d1a21;};}function handleError(_0x1f2ccb,_0x186341){_0x186341=_0x186341||0x1f4;return function(_0x57cc60){logger[_0x306e('0x28')](_0x57cc60[_0x306e('0x29')]);if(_0x57cc60[_0x306e('0x2a')]){delete _0x57cc60[_0x306e('0x2a')];}_0x1f2ccb[_0x306e('0x1a')](_0x186341)['send'](_0x57cc60);};}exports[_0x306e('0x2b')]=function(_0x4daa39,_0x5eab55){var _0x23ffdf={},_0x1bd969={},_0x5c0bae={'count':0x0,'rows':[]};var _0x2fdcfb=_['map'](db['SmsQueue'][_0x306e('0x2c')],function(_0x1e333b){return{'name':_0x1e333b[_0x306e('0x2d')],'type':_0x1e333b[_0x306e('0x2e')][_0x306e('0x2f')]};});_0x1bd969['model']=_['map'](_0x2fdcfb,_0x306e('0x2a'));_0x1bd969[_0x306e('0x30')]=_['keys'](_0x4daa39['query']);_0x1bd969[_0x306e('0x31')]=_['intersection'](_0x1bd969[_0x306e('0x32')],_0x1bd969['query']);_0x23ffdf['attributes']=_[_0x306e('0x33')](_0x1bd969[_0x306e('0x32')],qs[_0x306e('0x34')](_0x4daa39[_0x306e('0x30')][_0x306e('0x34')]));_0x23ffdf[_0x306e('0x35')]=_0x23ffdf[_0x306e('0x35')]['length']?_0x23ffdf[_0x306e('0x35')]:_0x1bd969[_0x306e('0x32')];if(!_0x4daa39[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x23ffdf[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x4daa39[_0x306e('0x30')][_0x306e('0x1e')]);_0x23ffdf[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x4daa39[_0x306e('0x30')]['offset']);}_0x23ffdf[_0x306e('0x38')]=qs['sort'](_0x4daa39['query']['sort']);_0x23ffdf[_0x306e('0x39')]=qs[_0x306e('0x31')](_[_0x306e('0x3a')](_0x4daa39[_0x306e('0x30')],_0x1bd969[_0x306e('0x31')]),_0x2fdcfb);if(_0x4daa39[_0x306e('0x30')]['filter']){_0x23ffdf[_0x306e('0x39')]=_['merge'](_0x23ffdf[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x2fdcfb,function(_0x2fa023){if(_0x2fa023[_0x306e('0x2e')]!==_0x306e('0x3c')){var _0x4abb5f={};_0x4abb5f[_0x2fa023[_0x306e('0x2a')]]={'$like':'%'+_0x4daa39[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x4abb5f;}})});}_0x23ffdf=_[_0x306e('0x3e')]({},_0x23ffdf,_0x4daa39['options']);var _0x541691={'where':_0x23ffdf['where']};return db['SmsQueue']['count'](_0x541691)['then'](function(_0x5db27f){_0x5c0bae[_0x306e('0x1c')]=_0x5db27f;if(_0x4daa39['query']['includeAll']){_0x23ffdf[_0x306e('0x3f')]=[{'all':!![]}];}return db[_0x306e('0x40')][_0x306e('0x41')](_0x23ffdf);})[_0x306e('0x24')](function(_0x3c0d16){_0x5c0bae['rows']=_0x3c0d16;return _0x5c0bae;})[_0x306e('0x24')](respondWithFilteredResult(_0x5eab55,_0x23ffdf))['catch'](handleError(_0x5eab55,null));};exports[_0x306e('0x42')]=function(_0x1b30f0,_0xd4d650){var _0x4dc6be={'raw':!![],'where':{'id':_0x1b30f0[_0x306e('0x43')]['id']}},_0x51de18={};_0x51de18[_0x306e('0x32')]=_[_0x306e('0x44')](db['SmsQueue'][_0x306e('0x2c')]);_0x51de18[_0x306e('0x30')]=_[_0x306e('0x44')](_0x1b30f0['query']);_0x51de18['filters']=_[_0x306e('0x33')](_0x51de18[_0x306e('0x32')],_0x51de18['query']);_0x4dc6be[_0x306e('0x35')]=_[_0x306e('0x33')](_0x51de18[_0x306e('0x32')],qs[_0x306e('0x34')](_0x1b30f0['query'][_0x306e('0x34')]));_0x4dc6be[_0x306e('0x35')]=_0x4dc6be[_0x306e('0x35')][_0x306e('0x45')]?_0x4dc6be[_0x306e('0x35')]:_0x51de18[_0x306e('0x32')];if(_0x1b30f0[_0x306e('0x30')]['includeAll']){_0x4dc6be['include']=[{'all':!![]}];}_0x4dc6be=_[_0x306e('0x3e')]({},_0x4dc6be,_0x1b30f0[_0x306e('0x46')]);return db[_0x306e('0x40')][_0x306e('0x47')](_0x4dc6be)[_0x306e('0x24')](handleEntityNotFound(_0xd4d650,null))['then'](respondWithResult(_0xd4d650,null))[_0x306e('0x48')](handleError(_0xd4d650,null));};exports[_0x306e('0x49')]=function(_0x5d25c0,_0x4a2d97){return db[_0x306e('0x40')]['create'](_0x5d25c0[_0x306e('0x4a')],{})[_0x306e('0x24')](function(_0x5c2f65){var _0x150842=_0x5d25c0['user'][_0x306e('0x4b')]({'plain':!![]});if(!_0x150842)throw new Error(_0x306e('0x4c'));if(_0x150842[_0x306e('0x4d')]===_0x306e('0x4e')){var _0x14ca23=_0x5c2f65[_0x306e('0x4b')]({'plain':!![]});var _0xcc2654=_0x306e('0x26');return db[_0x306e('0x4f')]['find']({'where':{'name':_0xcc2654,'userProfileId':_0x150842[_0x306e('0x50')]},'raw':!![]})[_0x306e('0x24')](function(_0x50262f){if(_0x50262f&&_0x50262f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x14ca23['name'],'resourceId':_0x14ca23['id'],'type':_0x50262f[_0x306e('0x2a')],'sectionId':_0x50262f['id']},{})[_0x306e('0x24')](function(){return _0x5c2f65;});}else{return _0x5c2f65;}})[_0x306e('0x48')](function(_0x4411a0){logger[_0x306e('0x28')](_0x306e('0x51'),_0x4411a0);throw _0x4411a0;});}return _0x5c2f65;})[_0x306e('0x24')](respondWithResult(_0x4a2d97,0xc9))['catch'](handleError(_0x4a2d97,null));};exports[_0x306e('0x23')]=function(_0x262894,_0x18e381){if(_0x262894[_0x306e('0x4a')]['id']){delete _0x262894[_0x306e('0x4a')]['id'];}return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x262894[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x18e381,null))[_0x306e('0x24')](saveUpdates(_0x262894['body'],null))[_0x306e('0x24')](respondWithResult(_0x18e381,null))[_0x306e('0x48')](handleError(_0x18e381,null));};exports[_0x306e('0x25')]=function(_0x43c077,_0x500e88){return db['SmsQueue'][_0x306e('0x47')]({'where':{'id':_0x43c077[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x500e88,null))['then'](removeEntity(_0x500e88,null))[_0x306e('0x48')](handleError(_0x500e88,null));};exports['describe']=function(_0x50e121,_0x5b2a6e){return db[_0x306e('0x40')][_0x306e('0x52')]()['then'](respondWithResult(_0x5b2a6e,null))[_0x306e('0x48')](handleError(_0x5b2a6e,null));};exports['getMembers']=function(_0x57895b,_0x1b0355,_0x4d02d2){var _0x220be0={'raw':!![],'where':{}},_0x14ba1f={},_0x224e85;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x57895b[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x1b0355,null))['then'](function(_0x443d76){if(_0x443d76){_0x224e85=_0x443d76[_0x306e('0x4b')]({'plain':!![]});_0x14ba1f[_0x306e('0x32')]=_['keys'](db[_0x306e('0x54')]['rawAttributes']);_0x14ba1f['query']=_[_0x306e('0x44')](_0x57895b[_0x306e('0x30')]);_0x14ba1f[_0x306e('0x31')]=_['intersection'](_0x14ba1f['model'],_0x14ba1f[_0x306e('0x30')]);_0x220be0[_0x306e('0x35')]=_[_0x306e('0x33')](_0x14ba1f['model'],qs[_0x306e('0x34')](_0x57895b[_0x306e('0x30')][_0x306e('0x34')]));_0x220be0[_0x306e('0x35')]=_0x220be0[_0x306e('0x35')][_0x306e('0x45')]?_0x220be0[_0x306e('0x35')]:_0x14ba1f[_0x306e('0x32')];if(!_0x57895b[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x220be0[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x57895b['query'][_0x306e('0x1e')]);_0x220be0[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x57895b['query'][_0x306e('0x1d')]);}_0x220be0[_0x306e('0x38')]=qs['sort'](_0x57895b[_0x306e('0x30')][_0x306e('0x55')]);_0x220be0['where']=qs[_0x306e('0x31')](_[_0x306e('0x3a')](_0x57895b[_0x306e('0x30')],_0x14ba1f[_0x306e('0x31')]));_0x220be0[_0x306e('0x39')][_0x306e('0x56')]=_0x443d76['id'];if(_0x57895b[_0x306e('0x30')][_0x306e('0x3d')]){_0x220be0[_0x306e('0x39')]=_[_0x306e('0x3e')](_0x220be0[_0x306e('0x39')],{'$or':_['map'](_0x220be0[_0x306e('0x35')],function(_0x391155){var _0x4885b4={};_0x4885b4[_0x391155]={'$like':'%'+_0x57895b[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x4885b4;})});}_0x220be0=_[_0x306e('0x3e')]({},_0x220be0,_0x57895b[_0x306e('0x46')]);return db['UserSmsQueue'][_0x306e('0x41')](_0x220be0);}})[_0x306e('0x24')](function(_0x3624d7){if(_0x3624d7){return db[_0x306e('0x57')]['findAndCountAll']({'where':{'id':_['map'](_0x3624d7,_0x306e('0x58')),'role':_0x306e('0x59')},'attributes':['id','name','smsPause','updatedAt',_0x306e('0x5a')]});}})['then'](function(_0xb12b67){if(_0xb12b67){return{'count':_0xb12b67[_0x306e('0x1c')],'rows':_[_0x306e('0x3b')](_0xb12b67[_0x306e('0x5b')],function(_0x16e2f7){return{'membername':_0x16e2f7[_0x306e('0x2a')],'UserId':_0x16e2f7['id'],'queue_name':_0x224e85[_0x306e('0x2a')],'SmsQueueId':_0x224e85['id'],'interface':util[_0x306e('0x5c')]('%s/%s',_0x306e('0x5d'),_0x16e2f7['name']),'penalty':0x0,'paused':_0x16e2f7[_0x306e('0x5e')],'createdAt':_0x16e2f7[_0x306e('0x5a')],'updatedAt':_0x16e2f7[_0x306e('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x306e('0x24')](respondWithFilteredResult(_0x1b0355,_0x220be0))[_0x306e('0x48')](handleError(_0x1b0355,null));};exports['getTeams']=function(_0x10dc77,_0xce75d6,_0x432c67){var _0x9162c7={};var _0x26fd25={};var _0x5beac8;var _0x452142;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x10dc77[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0xce75d6,null))[_0x306e('0x24')](function(_0x3eda68){if(_0x3eda68){_0x5beac8=_0x3eda68;_0x26fd25['model']=_[_0x306e('0x44')](db['Team'][_0x306e('0x2c')]);_0x26fd25[_0x306e('0x30')]=_[_0x306e('0x44')](_0x10dc77[_0x306e('0x30')]);_0x26fd25[_0x306e('0x31')]=_[_0x306e('0x33')](_0x26fd25[_0x306e('0x32')],_0x26fd25['query']);_0x9162c7[_0x306e('0x35')]=_['intersection'](_0x26fd25['model'],qs[_0x306e('0x34')](_0x10dc77[_0x306e('0x30')][_0x306e('0x34')]));_0x9162c7['attributes']=_0x9162c7[_0x306e('0x35')][_0x306e('0x45')]?_0x9162c7[_0x306e('0x35')]:_0x26fd25[_0x306e('0x32')];_0x9162c7[_0x306e('0x38')]=qs[_0x306e('0x55')](_0x10dc77[_0x306e('0x30')][_0x306e('0x55')]);_0x9162c7[_0x306e('0x39')]=qs['filters'](_[_0x306e('0x3a')](_0x10dc77[_0x306e('0x30')],_0x26fd25[_0x306e('0x31')]));if(_0x10dc77[_0x306e('0x30')][_0x306e('0x3d')]){_0x9162c7[_0x306e('0x39')]=_[_0x306e('0x3e')](_0x9162c7[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x9162c7['attributes'],function(_0x1812e6){var _0x364aee={};_0x364aee[_0x1812e6]={'$like':'%'+_0x10dc77[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x364aee;})});}_0x9162c7=_[_0x306e('0x3e')]({},_0x9162c7,_0x10dc77[_0x306e('0x46')]);return _0x5beac8[_0x306e('0x60')](_0x9162c7);}})[_0x306e('0x24')](function(_0x22ad0e){if(_0x22ad0e){_0x452142=_0x22ad0e[_0x306e('0x45')];if(!_0x10dc77[_0x306e('0x30')][_0x306e('0x36')](_0x306e('0x37'))){_0x9162c7[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x10dc77[_0x306e('0x30')][_0x306e('0x1e')]);_0x9162c7['offset']=qs[_0x306e('0x1d')](_0x10dc77[_0x306e('0x30')][_0x306e('0x1d')]);}return _0x5beac8[_0x306e('0x60')](_0x9162c7);}})[_0x306e('0x24')](function(_0x303479){if(_0x303479){return _0x303479?{'count':_0x452142,'rows':_0x303479}:null;}})[_0x306e('0x24')](respondWithResult(_0xce75d6,null))[_0x306e('0x48')](handleError(_0xce75d6,null));};exports['addTeams']=function(_0x2452d0,_0x207271,_0x4e9995){var _0x14f21f=_0x2452d0['body']['ids'];return db[_0x306e('0x61')]['findAll']({'where':{'id':_0x14f21f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x306e('0x62'),'attributes':['id',_0x306e('0x2a'),_0x306e('0x63'),_0x306e('0x64'),_0x306e('0x65')],'raw':!![]}]})[_0x306e('0x24')](function(_0x4b3519){if(_0x4b3519){var _0x41e040=_[_0x306e('0x66')](_0x4b3519,function(_0x4366d7){var _0xcd80ee=_0x4366d7[_0x306e('0x4b')]({'plain':!![]});return _0xcd80ee[_0x306e('0x62')];});return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x2452d0['params']['id']}})[_0x306e('0x24')](function(_0x1ae347){return db[_0x306e('0x67')][_0x306e('0x68')](function(_0xa04b45){return _0x1ae347['addTeams'](_0x14f21f,{'transaction':_0xa04b45})['then'](function(){return BPromise['each'](_0x41e040,function(_0x5b2e8e){return db[_0x306e('0x54')][_0x306e('0x69')]({'where':{'UserId':_0x5b2e8e['id'],'SmsQueueId':_0x2452d0[_0x306e('0x43')]['id']},'transaction':_0xa04b45});});})['then'](function(){_0x41e040['forEach'](function(_0x14a8bf){socket[_0x306e('0x6a')](_0x306e('0x6b'),{'UserId':_0x14a8bf['id'],'SmsQueueId':_0x1ae347['id']});});});});});}})[_0x306e('0x24')](respondWithStatusCode(_0x207271,null))[_0x306e('0x48')](handleError(_0x207271,null));};exports['removeTeams']=function(_0x162eca,_0x379fd3,_0x7da7e0){return db[_0x306e('0x61')][_0x306e('0x41')]({'where':{'id':_0x162eca[_0x306e('0x30')][_0x306e('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x306e('0x62'),'attributes':['id'],'raw':!![]}]})[_0x306e('0x24')](handleEntityNotFound(_0x379fd3,null))[_0x306e('0x24')](function(_0x22671a){var _0xc3fa3e=_[_0x306e('0x3b')](_0x22671a,'id');var _0x222763=[];var _0x297c7b=[];var _0x33ad17=squel[_0x306e('0x6d')]();_0x33ad17['field'](_0x306e('0x6e'))[_0x306e('0x6f')](_0x306e('0x70'),'tq')[_0x306e('0x71')]('user_has_teams','ut',_0x306e('0x72'))[_0x306e('0x39')](_0x306e('0x73'),_0x162eca[_0x306e('0x43')]['id']);for(var _0x4bb074=0x0;_0x4bb074<_0x22671a['length'];_0x4bb074+=0x1){let _0x4e6fd3=_0x22671a[_0x4bb074];for(var _0x80a172=0x0;_0x80a172<_0x4e6fd3[_0x306e('0x62')][_0x306e('0x45')];_0x80a172+=0x1){let _0x1d5ade=_0x4e6fd3[_0x306e('0x62')][_0x80a172];var _0x4e0e98=_0x33ad17['clone']();_0x4e0e98['where']('ut.UserId\x20=\x20?',_0x1d5ade['id']);_0x297c7b[_0x306e('0x74')](db[_0x306e('0x67')][_0x306e('0x30')](_0x4e0e98['toString'](),{'type':db[_0x306e('0x67')]['QueryTypes']['SELECT']})[_0x306e('0x24')](function(_0x2ffedb){if(_0x2ffedb['length']===0x1){return _0x1d5ade['id'];}else{var _0x53eff1=_[_0x306e('0x75')](_['map'](_0x2ffedb,_0x306e('0x76')),function(_0x16f58a){return _[_0x306e('0x77')](_0xc3fa3e,_0x16f58a);});if(_0x53eff1){return _0x1d5ade['id'];}}}));}}return BPromise[_0x306e('0x78')](_0x297c7b)['then'](function(_0x3834ec){_0x222763=_(_0x222763)[_0x306e('0x79')](_0x3834ec)['compact']()[_0x306e('0x7a')]();return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x162eca[_0x306e('0x43')]['id']}})[_0x306e('0x24')](function(_0x350e70){return db['sequelize'][_0x306e('0x68')](function(_0x4befc0){return _0x350e70['removeTeams'](_0x162eca[_0x306e('0x30')][_0x306e('0x6c')],{'transaction':_0x4befc0})[_0x306e('0x24')](function(){if(!_[_0x306e('0x7b')](_0x222763)){return _0x350e70['removeAgents'](_0x222763,{'transaction':_0x4befc0});}})[_0x306e('0x24')](function(){_0x222763['forEach'](function(_0x1821b1){socket[_0x306e('0x6a')](_0x306e('0x7c'),{'UserId':_0x1821b1,'SmsQueueId':_0x350e70['id']});});});});});});})[_0x306e('0x24')](respondWithStatusCode(_0x379fd3,null))[_0x306e('0x48')](handleError(_0x379fd3,null));};exports[_0x306e('0x7d')]=function(_0x7b7fd5,_0xe9bc7b,_0x41597c){return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x7b7fd5[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0xe9bc7b,null))[_0x306e('0x24')](function(_0x887f26){if(_0x887f26){return _0x887f26[_0x306e('0x7d')](_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')],_[_0x306e('0x7e')](_0x7b7fd5['body'],[_0x306e('0x6c'),'id'])||{})['spread'](function(_0x5c9971){for(var _0x474312=0x0;_0x474312<_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')][_0x306e('0x45')];_0x474312+=0x1){socket[_0x306e('0x6a')](_0x306e('0x6b'),{'UserId':_0x7b7fd5[_0x306e('0x4a')][_0x306e('0x6c')][_0x474312],'SmsQueueId':_0x7b7fd5['params']['id']});}return _0x5c9971;});}})[_0x306e('0x24')](respondWithResult(_0xe9bc7b,null))[_0x306e('0x48')](handleError(_0xe9bc7b,null));};exports['removeAgents']=function(_0x22af44,_0x15f5dd,_0x40fd18){return db[_0x306e('0x40')][_0x306e('0x47')]({'where':{'id':_0x22af44[_0x306e('0x43')]['id']}})['then'](handleEntityNotFound(_0x15f5dd,null))[_0x306e('0x24')](function(_0x31e318){if(_0x31e318){return _0x31e318['removeAgents'](_0x22af44['query'][_0x306e('0x6c')])['then'](function(){if(_[_0x306e('0x7f')](_0x22af44[_0x306e('0x30')][_0x306e('0x6c')])){for(var _0x298c1e=0x0;_0x298c1e<_0x22af44[_0x306e('0x30')][_0x306e('0x6c')][_0x306e('0x45')];_0x298c1e+=0x1){socket[_0x306e('0x6a')](_0x306e('0x7c'),{'UserId':Number(_0x22af44[_0x306e('0x30')]['ids'][_0x298c1e]),'SmsQueueId':Number(_0x22af44[_0x306e('0x43')]['id'])});}}else{socket[_0x306e('0x6a')]('userSmsQueue:remove',{'UserId':Number(_0x22af44[_0x306e('0x30')][_0x306e('0x6c')]),'SmsQueueId':Number(_0x22af44['params']['id'])});}});}})['then'](respondWithStatusCode(_0x15f5dd,null))[_0x306e('0x48')](handleError(_0x15f5dd,null));};exports[_0x306e('0x80')]=function(_0x14d8cf,_0x166b9e,_0x51fc6b){var _0x7b788a={};var _0x283d39={};var _0x5954bc;var _0xc81276;return db[_0x306e('0x40')][_0x306e('0x53')]({'where':{'id':_0x14d8cf[_0x306e('0x43')]['id']}})[_0x306e('0x24')](handleEntityNotFound(_0x166b9e,null))[_0x306e('0x24')](function(_0x28e42f){if(_0x28e42f){_0x5954bc=_0x28e42f;_0x283d39['model']=_[_0x306e('0x44')](db['User'][_0x306e('0x2c')]);_0x283d39['query']=_[_0x306e('0x44')](_0x14d8cf[_0x306e('0x30')]);_0x283d39[_0x306e('0x31')]=_['intersection'](_0x283d39[_0x306e('0x32')],_0x283d39[_0x306e('0x30')]);_0x7b788a[_0x306e('0x35')]=_['intersection'](_0x283d39['model'],qs[_0x306e('0x34')](_0x14d8cf[_0x306e('0x30')]['fields']));_0x7b788a['attributes']=_0x7b788a[_0x306e('0x35')][_0x306e('0x45')]?_0x7b788a[_0x306e('0x35')]:_0x283d39[_0x306e('0x32')];_0x7b788a[_0x306e('0x38')]=qs[_0x306e('0x55')](_0x14d8cf[_0x306e('0x30')][_0x306e('0x55')]);_0x7b788a['where']=qs['filters'](_[_0x306e('0x3a')](_0x14d8cf[_0x306e('0x30')],_0x283d39[_0x306e('0x31')]));if(_0x14d8cf[_0x306e('0x30')][_0x306e('0x3d')]){_0x7b788a[_0x306e('0x39')]=_['merge'](_0x7b788a[_0x306e('0x39')],{'$or':_[_0x306e('0x3b')](_0x7b788a[_0x306e('0x35')],function(_0x7f1f29){var _0x348642={};_0x348642[_0x7f1f29]={'$like':'%'+_0x14d8cf[_0x306e('0x30')][_0x306e('0x3d')]+'%'};return _0x348642;})});}_0x7b788a=_[_0x306e('0x3e')]({},_0x7b788a,_0x14d8cf[_0x306e('0x46')]);return _0x5954bc[_0x306e('0x80')](_0x7b788a);}})[_0x306e('0x24')](function(_0x1d9c21){if(_0x1d9c21){_0xc81276=_0x1d9c21[_0x306e('0x45')];if(!_0x14d8cf[_0x306e('0x30')]['hasOwnProperty'](_0x306e('0x37'))){_0x7b788a[_0x306e('0x1e')]=qs[_0x306e('0x1e')](_0x14d8cf[_0x306e('0x30')][_0x306e('0x1e')]);_0x7b788a[_0x306e('0x1d')]=qs[_0x306e('0x1d')](_0x14d8cf['query'][_0x306e('0x1d')]);}return _0x5954bc[_0x306e('0x80')](_0x7b788a);}})[_0x306e('0x24')](function(_0x1f455c){if(_0x1f455c){return _0x1f455c?{'count':_0xc81276,'rows':_0x1f455c}:null;}})[_0x306e('0x24')](respondWithResult(_0x166b9e,null))['catch'](handleError(_0x166b9e,null));}; \ No newline at end of file +var _0xd86a=['rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','autoAssociation','getMembers','findOne','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','format','%s/%s','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','UserSmsQueue','emit','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd86a,0x14f));var _0xad86=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xd86a[_0x7a3247];return _0x1bfde5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad86('0x0'));var rimraf=require(_0xad86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad86('0x2'));var rp=require(_0xad86('0x3'));var moment=require(_0xad86('0x4'));var BPromise=require(_0xad86('0x5'));var Mustache=require('mustache');var util=require(_0xad86('0x6'));var path=require(_0xad86('0x7'));var sox=require(_0xad86('0x8'));var csv=require(_0xad86('0x9'));var ejs=require(_0xad86('0xa'));var fs=require('fs');var _=require(_0xad86('0xb'));var squel=require(_0xad86('0xc'));var crypto=require('crypto');var jsforce=require(_0xad86('0xd'));var deskjs=require(_0xad86('0xe'));var toCsv=require(_0xad86('0x9'));var querystring=require(_0xad86('0xf'));var Papa=require(_0xad86('0x10'));var Redis=require(_0xad86('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xad86('0x12'));var as=require(_0xad86('0x13'));var hardwareService=require(_0xad86('0x14'));var logger=require(_0xad86('0x15'))(_0xad86('0x16'));var utils=require(_0xad86('0x17'));var config=require(_0xad86('0x18'));var db=require(_0xad86('0x19'))['db'];config[_0xad86('0x1a')]=_[_0xad86('0x1b')](config[_0xad86('0x1a')],{'host':_0xad86('0x1c'),'port':0x18eb});var socket=require(_0xad86('0x1d'))(new Redis(config[_0xad86('0x1a')]));require(_0xad86('0x1e'))[_0xad86('0x1f')](socket);function respondWithStatusCode(_0x209a49,_0xd17e0b){_0xd17e0b=_0xd17e0b||0xcc;return function(_0x4c46f6){if(_0x4c46f6){return _0x209a49[_0xad86('0x20')](_0xd17e0b);}return _0x209a49[_0xad86('0x21')](_0xd17e0b)[_0xad86('0x22')]();};}function respondWithResult(_0x268c2b,_0x191964){_0x191964=_0x191964||0xc8;return function(_0x131c03){if(_0x131c03){return _0x268c2b['status'](_0x191964)[_0xad86('0x23')](_0x131c03);}};}function respondWithFilteredResult(_0x2fdd35,_0x3b6d89){return function(_0x10dd92){if(_0x10dd92){var _0x30237d=_0x10dd92['count'],_0x3944b5=_0x3b6d89[_0xad86('0x24')],_0x40263b=_0x3b6d89['offset']+_0x3b6d89[_0xad86('0x25')],_0x531e8a;if(_0x40263b>=_0x30237d){_0x40263b=_0x30237d;_0x531e8a=0xc8;}else{_0x531e8a=0xce;}_0x2fdd35[_0xad86('0x21')](_0x531e8a);return _0x2fdd35[_0xad86('0x26')](_0xad86('0x27'),_0x3944b5+'-'+_0x40263b+'/'+_0x30237d)[_0xad86('0x23')](_0x10dd92);}return null;};}function patchUpdates(_0x4168d2){return function(_0x4d11e5){try{jsonpatch['apply'](_0x4d11e5,_0x4168d2,!![]);}catch(_0xe030e1){return BPromise[_0xad86('0x28')](_0xe030e1);}return _0x4d11e5[_0xad86('0x29')]();};}function saveUpdates(_0x2fd390,_0x3b95cc){return function(_0x4967af){if(_0x4967af){return _0x4967af[_0xad86('0x2a')](_0x2fd390)[_0xad86('0x2b')](function(_0x1ee5c8){return _0x1ee5c8;});}return null;};}function removeEntity(_0x9cc25a,_0x1ab46a){return function(_0x2f6aa4){if(_0x2f6aa4){return _0x2f6aa4[_0xad86('0x2c')]()[_0xad86('0x2b')](function(){var _0x21a234=_0x2f6aa4[_0xad86('0x2d')]({'plain':!![]});var _0x282a63=_0xad86('0x2e');return db[_0xad86('0x2f')]['destroy']({'where':{'type':_0x282a63,'resourceId':_0x21a234['id']}})[_0xad86('0x2b')](function(){return _0x2f6aa4;});})['then'](function(){_0x9cc25a[_0xad86('0x21')](0xcc)[_0xad86('0x22')]();});}};}function handleEntityNotFound(_0x5f4275,_0x32422c){return function(_0x48051b){if(!_0x48051b){_0x5f4275[_0xad86('0x20')](0x194);}return _0x48051b;};}function handleError(_0x2d6e78,_0x13334){_0x13334=_0x13334||0x1f4;return function(_0x9af0d6){logger[_0xad86('0x30')](_0x9af0d6['stack']);if(_0x9af0d6[_0xad86('0x31')]){delete _0x9af0d6[_0xad86('0x31')];}_0x2d6e78[_0xad86('0x21')](_0x13334)['send'](_0x9af0d6);};}exports[_0xad86('0x32')]=function(_0x39c223,_0x4f4ea9){var _0x1bc9c6={},_0x4260d2={},_0x110c04={'count':0x0,'rows':[]};var _0x5f4175=_[_0xad86('0x33')](db[_0xad86('0x34')][_0xad86('0x35')],function(_0xd87f6c){return{'name':_0xd87f6c[_0xad86('0x36')],'type':_0xd87f6c[_0xad86('0x37')]['key']};});_0x4260d2[_0xad86('0x38')]=_[_0xad86('0x33')](_0x5f4175,'name');_0x4260d2[_0xad86('0x39')]=_[_0xad86('0x3a')](_0x39c223[_0xad86('0x39')]);_0x4260d2[_0xad86('0x3b')]=_['intersection'](_0x4260d2[_0xad86('0x38')],_0x4260d2['query']);_0x1bc9c6[_0xad86('0x3c')]=_[_0xad86('0x3d')](_0x4260d2[_0xad86('0x38')],qs[_0xad86('0x3e')](_0x39c223['query'][_0xad86('0x3e')]));_0x1bc9c6[_0xad86('0x3c')]=_0x1bc9c6[_0xad86('0x3c')]['length']?_0x1bc9c6[_0xad86('0x3c')]:_0x4260d2[_0xad86('0x38')];if(!_0x39c223[_0xad86('0x39')][_0xad86('0x3f')](_0xad86('0x40'))){_0x1bc9c6[_0xad86('0x25')]=qs[_0xad86('0x25')](_0x39c223[_0xad86('0x39')]['limit']);_0x1bc9c6[_0xad86('0x24')]=qs[_0xad86('0x24')](_0x39c223[_0xad86('0x39')]['offset']);}_0x1bc9c6[_0xad86('0x41')]=qs[_0xad86('0x42')](_0x39c223[_0xad86('0x39')][_0xad86('0x42')]);_0x1bc9c6[_0xad86('0x43')]=qs['filters'](_[_0xad86('0x44')](_0x39c223['query'],_0x4260d2[_0xad86('0x3b')]),_0x5f4175);if(_0x39c223[_0xad86('0x39')][_0xad86('0x45')]){_0x1bc9c6[_0xad86('0x43')]=_['merge'](_0x1bc9c6[_0xad86('0x43')],{'$or':_[_0xad86('0x33')](_0x5f4175,function(_0x559fb7){if(_0x559fb7[_0xad86('0x37')]!==_0xad86('0x46')){var _0x3afaf1={};_0x3afaf1[_0x559fb7[_0xad86('0x31')]]={'$like':'%'+_0x39c223['query'][_0xad86('0x45')]+'%'};return _0x3afaf1;}})});}_0x1bc9c6=_[_0xad86('0x47')]({},_0x1bc9c6,_0x39c223[_0xad86('0x48')]);var _0x12079d={'where':_0x1bc9c6['where']};return db[_0xad86('0x34')]['count'](_0x12079d)[_0xad86('0x2b')](function(_0x16ad1f){_0x110c04[_0xad86('0x49')]=_0x16ad1f;if(_0x39c223[_0xad86('0x39')][_0xad86('0x4a')]){_0x1bc9c6[_0xad86('0x4b')]=[{'all':!![]}];}return db[_0xad86('0x34')]['findAll'](_0x1bc9c6);})[_0xad86('0x2b')](function(_0x47489f){_0x110c04[_0xad86('0x4c')]=_0x47489f;return _0x110c04;})[_0xad86('0x2b')](respondWithFilteredResult(_0x4f4ea9,_0x1bc9c6))[_0xad86('0x4d')](handleError(_0x4f4ea9,null));};exports[_0xad86('0x4e')]=function(_0x49351b,_0xb8730f){var _0x46b14b={'raw':!![],'where':{'id':_0x49351b[_0xad86('0x4f')]['id']}},_0xd83c9e={};_0xd83c9e['model']=_['keys'](db[_0xad86('0x34')]['rawAttributes']);_0xd83c9e[_0xad86('0x39')]=_[_0xad86('0x3a')](_0x49351b['query']);_0xd83c9e['filters']=_[_0xad86('0x3d')](_0xd83c9e[_0xad86('0x38')],_0xd83c9e[_0xad86('0x39')]);_0x46b14b['attributes']=_[_0xad86('0x3d')](_0xd83c9e[_0xad86('0x38')],qs['fields'](_0x49351b[_0xad86('0x39')][_0xad86('0x3e')]));_0x46b14b[_0xad86('0x3c')]=_0x46b14b['attributes'][_0xad86('0x50')]?_0x46b14b[_0xad86('0x3c')]:_0xd83c9e[_0xad86('0x38')];if(_0x49351b['query'][_0xad86('0x4a')]){_0x46b14b[_0xad86('0x4b')]=[{'all':!![]}];}_0x46b14b=_[_0xad86('0x47')]({},_0x46b14b,_0x49351b[_0xad86('0x48')]);return db[_0xad86('0x34')]['find'](_0x46b14b)['then'](handleEntityNotFound(_0xb8730f,null))[_0xad86('0x2b')](respondWithResult(_0xb8730f,null))[_0xad86('0x4d')](handleError(_0xb8730f,null));};exports[_0xad86('0x51')]=function(_0x37af7b,_0x3e220b){return db[_0xad86('0x34')][_0xad86('0x51')](_0x37af7b[_0xad86('0x52')],{})[_0xad86('0x2b')](function(_0x23622b){var _0x2f95a5=_0x37af7b[_0xad86('0x53')][_0xad86('0x2d')]({'plain':!![]});if(!_0x2f95a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f95a5[_0xad86('0x54')]===_0xad86('0x53')){var _0x41e163=_0x23622b[_0xad86('0x2d')]({'plain':!![]});var _0x2d98c5=_0xad86('0x2e');return db[_0xad86('0x55')][_0xad86('0x56')]({'where':{'name':_0x2d98c5,'userProfileId':_0x2f95a5['userProfileId']},'raw':!![]})[_0xad86('0x2b')](function(_0x318dd8){if(_0x318dd8&&_0x318dd8[_0xad86('0x57')]===0x0){return db[_0xad86('0x2f')][_0xad86('0x51')]({'name':_0x41e163[_0xad86('0x31')],'resourceId':_0x41e163['id'],'type':_0x318dd8[_0xad86('0x31')],'sectionId':_0x318dd8['id']},{})[_0xad86('0x2b')](function(){return _0x23622b;});}else{return _0x23622b;}})[_0xad86('0x4d')](function(_0xaed114){logger[_0xad86('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaed114);throw _0xaed114;});}return _0x23622b;})[_0xad86('0x2b')](respondWithResult(_0x3e220b,0xc9))['catch'](handleError(_0x3e220b,null));};exports[_0xad86('0x2a')]=function(_0x2cc85c,_0xcfb25b){if(_0x2cc85c[_0xad86('0x52')]['id']){delete _0x2cc85c['body']['id'];}return db[_0xad86('0x34')][_0xad86('0x56')]({'where':{'id':_0x2cc85c[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0xcfb25b,null))[_0xad86('0x2b')](saveUpdates(_0x2cc85c['body'],null))[_0xad86('0x2b')](respondWithResult(_0xcfb25b,null))[_0xad86('0x4d')](handleError(_0xcfb25b,null));};exports[_0xad86('0x2c')]=function(_0x103d06,_0x6c778){return db[_0xad86('0x34')][_0xad86('0x56')]({'where':{'id':_0x103d06[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0x6c778,null))[_0xad86('0x2b')](removeEntity(_0x6c778,null))[_0xad86('0x4d')](handleError(_0x6c778,null));};exports['describe']=function(_0x47e3c3,_0x45067b){return db[_0xad86('0x34')]['describe']()[_0xad86('0x2b')](respondWithResult(_0x45067b,null))[_0xad86('0x4d')](handleError(_0x45067b,null));};exports[_0xad86('0x58')]=function(_0x2af576,_0x69688b,_0x3c0e6e){var _0x5680a2={'raw':!![],'where':{}},_0x589389={},_0x328f4d;return db[_0xad86('0x34')][_0xad86('0x59')]({'where':{'id':_0x2af576['params']['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0x69688b,null))[_0xad86('0x2b')](function(_0x13153e){if(_0x13153e){_0x328f4d=_0x13153e[_0xad86('0x2d')]({'plain':!![]});_0x589389[_0xad86('0x38')]=_[_0xad86('0x3a')](db['UserSmsQueue'][_0xad86('0x35')]);_0x589389[_0xad86('0x39')]=_['keys'](_0x2af576[_0xad86('0x39')]);_0x589389['filters']=_[_0xad86('0x3d')](_0x589389[_0xad86('0x38')],_0x589389[_0xad86('0x39')]);_0x5680a2[_0xad86('0x3c')]=_[_0xad86('0x3d')](_0x589389[_0xad86('0x38')],qs[_0xad86('0x3e')](_0x2af576['query'][_0xad86('0x3e')]));_0x5680a2[_0xad86('0x3c')]=_0x5680a2[_0xad86('0x3c')][_0xad86('0x50')]?_0x5680a2['attributes']:_0x589389[_0xad86('0x38')];if(!_0x2af576['query'][_0xad86('0x3f')](_0xad86('0x40'))){_0x5680a2[_0xad86('0x25')]=qs[_0xad86('0x25')](_0x2af576[_0xad86('0x39')]['limit']);_0x5680a2['offset']=qs[_0xad86('0x24')](_0x2af576[_0xad86('0x39')][_0xad86('0x24')]);}_0x5680a2[_0xad86('0x41')]=qs['sort'](_0x2af576['query'][_0xad86('0x42')]);_0x5680a2[_0xad86('0x43')]=qs[_0xad86('0x3b')](_[_0xad86('0x44')](_0x2af576[_0xad86('0x39')],_0x589389['filters']));_0x5680a2[_0xad86('0x43')][_0xad86('0x5a')]=_0x13153e['id'];if(_0x2af576[_0xad86('0x39')][_0xad86('0x45')]){_0x5680a2[_0xad86('0x43')]=_[_0xad86('0x47')](_0x5680a2[_0xad86('0x43')],{'$or':_[_0xad86('0x33')](_0x5680a2['attributes'],function(_0x3a0a82){var _0xf88b0={};_0xf88b0[_0x3a0a82]={'$like':'%'+_0x2af576[_0xad86('0x39')]['filter']+'%'};return _0xf88b0;})});}_0x5680a2=_['merge']({},_0x5680a2,_0x2af576[_0xad86('0x48')]);return db['UserSmsQueue'][_0xad86('0x5b')](_0x5680a2);}})['then'](function(_0x422979){if(_0x422979){return db[_0xad86('0x5c')][_0xad86('0x5d')]({'where':{'id':_['map'](_0x422979,_0xad86('0x5e')),'role':_0xad86('0x5f')},'attributes':['id','name',_0xad86('0x60'),'updatedAt','createdAt']});}})['then'](function(_0x25e0b3){if(_0x25e0b3){return{'count':_0x25e0b3[_0xad86('0x49')],'rows':_[_0xad86('0x33')](_0x25e0b3[_0xad86('0x4c')],function(_0x2227c1){return{'membername':_0x2227c1[_0xad86('0x31')],'UserId':_0x2227c1['id'],'queue_name':_0x328f4d[_0xad86('0x31')],'SmsQueueId':_0x328f4d['id'],'interface':util[_0xad86('0x61')](_0xad86('0x62'),'SIP',_0x2227c1[_0xad86('0x31')]),'penalty':0x0,'paused':_0x2227c1[_0xad86('0x60')],'createdAt':_0x2227c1[_0xad86('0x63')],'updatedAt':_0x2227c1[_0xad86('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad86('0x2b')](respondWithFilteredResult(_0x69688b,_0x5680a2))[_0xad86('0x4d')](handleError(_0x69688b,null));};exports[_0xad86('0x65')]=function(_0x46edfc,_0x2bde00,_0x5d3673){var _0x5a47bc={};var _0xc0875e={};var _0x14b7da;var _0xf2892c;return db[_0xad86('0x34')][_0xad86('0x59')]({'where':{'id':_0x46edfc[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0x2bde00,null))[_0xad86('0x2b')](function(_0xb36d34){if(_0xb36d34){_0x14b7da=_0xb36d34;_0xc0875e['model']=_['keys'](db[_0xad86('0x66')][_0xad86('0x35')]);_0xc0875e['query']=_[_0xad86('0x3a')](_0x46edfc[_0xad86('0x39')]);_0xc0875e[_0xad86('0x3b')]=_[_0xad86('0x3d')](_0xc0875e[_0xad86('0x38')],_0xc0875e[_0xad86('0x39')]);_0x5a47bc[_0xad86('0x3c')]=_['intersection'](_0xc0875e[_0xad86('0x38')],qs['fields'](_0x46edfc[_0xad86('0x39')][_0xad86('0x3e')]));_0x5a47bc['attributes']=_0x5a47bc[_0xad86('0x3c')][_0xad86('0x50')]?_0x5a47bc[_0xad86('0x3c')]:_0xc0875e['model'];_0x5a47bc[_0xad86('0x41')]=qs[_0xad86('0x42')](_0x46edfc[_0xad86('0x39')][_0xad86('0x42')]);_0x5a47bc[_0xad86('0x43')]=qs[_0xad86('0x3b')](_[_0xad86('0x44')](_0x46edfc[_0xad86('0x39')],_0xc0875e['filters']));if(_0x46edfc['query'][_0xad86('0x45')]){_0x5a47bc['where']=_['merge'](_0x5a47bc[_0xad86('0x43')],{'$or':_['map'](_0x5a47bc[_0xad86('0x3c')],function(_0x39dcb5){var _0xe5d35a={};_0xe5d35a[_0x39dcb5]={'$like':'%'+_0x46edfc[_0xad86('0x39')][_0xad86('0x45')]+'%'};return _0xe5d35a;})});}_0x5a47bc=_[_0xad86('0x47')]({},_0x5a47bc,_0x46edfc[_0xad86('0x48')]);return _0x14b7da[_0xad86('0x65')](_0x5a47bc);}})[_0xad86('0x2b')](function(_0xe274c5){if(_0xe274c5){_0xf2892c=_0xe274c5['length'];if(!_0x46edfc[_0xad86('0x39')]['hasOwnProperty'](_0xad86('0x40'))){_0x5a47bc[_0xad86('0x25')]=qs[_0xad86('0x25')](_0x46edfc[_0xad86('0x39')]['limit']);_0x5a47bc[_0xad86('0x24')]=qs[_0xad86('0x24')](_0x46edfc['query'][_0xad86('0x24')]);}return _0x14b7da[_0xad86('0x65')](_0x5a47bc);}})[_0xad86('0x2b')](function(_0x15c1c4){if(_0x15c1c4){return _0x15c1c4?{'count':_0xf2892c,'rows':_0x15c1c4}:null;}})[_0xad86('0x2b')](respondWithResult(_0x2bde00,null))[_0xad86('0x4d')](handleError(_0x2bde00,null));};exports[_0xad86('0x67')]=function(_0x1a553f,_0x1cae5b,_0x2acd0d){var _0x4e0347=_0x1a553f[_0xad86('0x52')][_0xad86('0x68')];return db[_0xad86('0x66')][_0xad86('0x5b')]({'where':{'id':_0x4e0347},'attributes':['id'],'include':[{'model':db['User'],'as':_0xad86('0x69'),'attributes':['id',_0xad86('0x31'),_0xad86('0x6a'),_0xad86('0x6b'),_0xad86('0x6c')],'raw':!![]}]})[_0xad86('0x2b')](function(_0x476e84){if(_0x476e84){var _0x3cbc33=_[_0xad86('0x6d')](_0x476e84,function(_0x3d1bad){var _0x4d281c=_0x3d1bad['get']({'plain':!![]});return _0x4d281c[_0xad86('0x69')];});return db['SmsQueue'][_0xad86('0x56')]({'where':{'id':_0x1a553f[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](function(_0x1bdcfb){return db[_0xad86('0x6e')][_0xad86('0x6f')](function(_0x48652d){return _0x1bdcfb[_0xad86('0x67')](_0x4e0347,{'transaction':_0x48652d})['then'](function(){return BPromise[_0xad86('0x70')](_0x3cbc33,function(_0x1cc72b){return db[_0xad86('0x71')]['findOrCreate']({'where':{'UserId':_0x1cc72b['id'],'SmsQueueId':_0x1a553f['params']['id']},'transaction':_0x48652d});});})['then'](function(){_0x3cbc33['forEach'](function(_0x30d8a1){socket[_0xad86('0x72')](_0xad86('0x73'),{'UserId':_0x30d8a1['id'],'SmsQueueId':_0x1bdcfb['id']});});});});});}})['then'](respondWithStatusCode(_0x1cae5b,null))[_0xad86('0x4d')](handleError(_0x1cae5b,null));};exports[_0xad86('0x74')]=function(_0x146b05,_0x3335dd,_0x5bc9bd){return db[_0xad86('0x66')][_0xad86('0x5b')]({'where':{'id':_0x146b05[_0xad86('0x39')][_0xad86('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xad86('0x2b')](handleEntityNotFound(_0x3335dd,null))[_0xad86('0x2b')](function(_0x1f8b86){var _0x13ea8e=_[_0xad86('0x33')](_0x1f8b86,'id');var _0x1c9630=[];var _0x59a709=[];var _0x9906ef=squel['select']();_0x9906ef[_0xad86('0x75')](_0xad86('0x76'))[_0xad86('0x77')](_0xad86('0x78'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xad86('0x79'),_0x146b05[_0xad86('0x4f')]['id']);for(var _0x17c7c7=0x0;_0x17c7c7<_0x1f8b86[_0xad86('0x50')];_0x17c7c7+=0x1){let _0x443d1f=_0x1f8b86[_0x17c7c7];for(var _0x529a22=0x0;_0x529a22<_0x443d1f[_0xad86('0x69')][_0xad86('0x50')];_0x529a22+=0x1){let _0x2ddf9a=_0x443d1f['Agents'][_0x529a22];var _0x512ed3=_0x9906ef['clone']();_0x512ed3[_0xad86('0x43')](_0xad86('0x7a'),_0x2ddf9a['id']);_0x59a709[_0xad86('0x7b')](db[_0xad86('0x6e')][_0xad86('0x39')](_0x512ed3[_0xad86('0x7c')](),{'type':db[_0xad86('0x6e')][_0xad86('0x7d')]['SELECT']})[_0xad86('0x2b')](function(_0x44c08e){if(_0x44c08e[_0xad86('0x50')]===0x1){return _0x2ddf9a['id'];}else{var _0x3c0ad6=_['every'](_[_0xad86('0x33')](_0x44c08e,_0xad86('0x7e')),function(_0x5aa917){return _['includes'](_0x13ea8e,_0x5aa917);});if(_0x3c0ad6){return _0x2ddf9a['id'];}}}));}}return BPromise[_0xad86('0x7f')](_0x59a709)['then'](function(_0x5559ee){_0x1c9630=_(_0x1c9630)[_0xad86('0x80')](_0x5559ee)['compact']()[_0xad86('0x81')]();return db[_0xad86('0x34')][_0xad86('0x56')]({'where':{'id':_0x146b05[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](function(_0x1325ff){return db[_0xad86('0x6e')][_0xad86('0x6f')](function(_0xf96bdb){return _0x1325ff[_0xad86('0x74')](_0x146b05['query'][_0xad86('0x68')],{'transaction':_0xf96bdb})[_0xad86('0x2b')](function(){if(!_[_0xad86('0x82')](_0x1c9630)){return _0x1325ff[_0xad86('0x83')](_0x1c9630,{'transaction':_0xf96bdb});}})['then'](function(){_0x1c9630['forEach'](function(_0x32d2fc){socket['emit'](_0xad86('0x84'),{'UserId':_0x32d2fc,'SmsQueueId':_0x1325ff['id']});});});});});});})[_0xad86('0x2b')](respondWithStatusCode(_0x3335dd,null))[_0xad86('0x4d')](handleError(_0x3335dd,null));};exports[_0xad86('0x85')]=function(_0x13a74f,_0x10d5a6,_0x1a3671){return db[_0xad86('0x34')][_0xad86('0x56')]({'where':{'id':_0x13a74f[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0x10d5a6,null))[_0xad86('0x2b')](function(_0x5a2b51){if(_0x5a2b51){return _0x5a2b51[_0xad86('0x85')](_0x13a74f[_0xad86('0x52')][_0xad86('0x68')],_[_0xad86('0x86')](_0x13a74f[_0xad86('0x52')],[_0xad86('0x68'),'id'])||{})[_0xad86('0x87')](function(_0x5ad1e9){for(var _0x580a62=0x0;_0x580a62<_0x13a74f[_0xad86('0x52')][_0xad86('0x68')]['length'];_0x580a62+=0x1){socket[_0xad86('0x72')]('userSmsQueue:save',{'UserId':_0x13a74f[_0xad86('0x52')][_0xad86('0x68')][_0x580a62],'SmsQueueId':_0x13a74f[_0xad86('0x4f')]['id']});}return _0x5ad1e9;});}})[_0xad86('0x2b')](respondWithResult(_0x10d5a6,null))[_0xad86('0x4d')](handleError(_0x10d5a6,null));};exports[_0xad86('0x83')]=function(_0x5b9e7f,_0x4204a4,_0x2d4c75){return db[_0xad86('0x34')][_0xad86('0x56')]({'where':{'id':_0x5b9e7f[_0xad86('0x4f')]['id']}})[_0xad86('0x2b')](handleEntityNotFound(_0x4204a4,null))[_0xad86('0x2b')](function(_0x52fe37){if(_0x52fe37){return _0x52fe37['removeAgents'](_0x5b9e7f[_0xad86('0x39')][_0xad86('0x68')])['then'](function(){if(_['isArray'](_0x5b9e7f[_0xad86('0x39')][_0xad86('0x68')])){for(var _0x3142d2=0x0;_0x3142d2<_0x5b9e7f[_0xad86('0x39')][_0xad86('0x68')][_0xad86('0x50')];_0x3142d2+=0x1){socket[_0xad86('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x5b9e7f['query'][_0xad86('0x68')][_0x3142d2]),'SmsQueueId':Number(_0x5b9e7f[_0xad86('0x4f')]['id'])});}}else{socket['emit'](_0xad86('0x84'),{'UserId':Number(_0x5b9e7f['query'][_0xad86('0x68')]),'SmsQueueId':Number(_0x5b9e7f[_0xad86('0x4f')]['id'])});}});}})[_0xad86('0x2b')](respondWithStatusCode(_0x4204a4,null))[_0xad86('0x4d')](handleError(_0x4204a4,null));};exports[_0xad86('0x88')]=function(_0x9b518c,_0xe1141b,_0x17a0fb){var _0x2fbdb2={};var _0x122a61={};var _0x45de7e;var _0x5c269d;return db['SmsQueue'][_0xad86('0x59')]({'where':{'id':_0x9b518c[_0xad86('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe1141b,null))[_0xad86('0x2b')](function(_0x2e91c5){if(_0x2e91c5){_0x45de7e=_0x2e91c5;_0x122a61['model']=_[_0xad86('0x3a')](db[_0xad86('0x5c')][_0xad86('0x35')]);_0x122a61['query']=_[_0xad86('0x3a')](_0x9b518c['query']);_0x122a61['filters']=_[_0xad86('0x3d')](_0x122a61[_0xad86('0x38')],_0x122a61['query']);_0x2fbdb2['attributes']=_['intersection'](_0x122a61[_0xad86('0x38')],qs[_0xad86('0x3e')](_0x9b518c[_0xad86('0x39')][_0xad86('0x3e')]));_0x2fbdb2[_0xad86('0x3c')]=_0x2fbdb2[_0xad86('0x3c')]['length']?_0x2fbdb2[_0xad86('0x3c')]:_0x122a61[_0xad86('0x38')];_0x2fbdb2['order']=qs[_0xad86('0x42')](_0x9b518c[_0xad86('0x39')]['sort']);_0x2fbdb2[_0xad86('0x43')]=qs[_0xad86('0x3b')](_[_0xad86('0x44')](_0x9b518c['query'],_0x122a61[_0xad86('0x3b')]));if(_0x9b518c[_0xad86('0x39')]['filter']){_0x2fbdb2[_0xad86('0x43')]=_[_0xad86('0x47')](_0x2fbdb2['where'],{'$or':_['map'](_0x2fbdb2['attributes'],function(_0x674d15){var _0x520b07={};_0x520b07[_0x674d15]={'$like':'%'+_0x9b518c[_0xad86('0x39')][_0xad86('0x45')]+'%'};return _0x520b07;})});}_0x2fbdb2=_[_0xad86('0x47')]({},_0x2fbdb2,_0x9b518c[_0xad86('0x48')]);return _0x45de7e['getAgents'](_0x2fbdb2);}})[_0xad86('0x2b')](function(_0x264e5a){if(_0x264e5a){_0x5c269d=_0x264e5a[_0xad86('0x50')];if(!_0x9b518c[_0xad86('0x39')][_0xad86('0x3f')](_0xad86('0x40'))){_0x2fbdb2[_0xad86('0x25')]=qs[_0xad86('0x25')](_0x9b518c[_0xad86('0x39')]['limit']);_0x2fbdb2[_0xad86('0x24')]=qs['offset'](_0x9b518c[_0xad86('0x39')][_0xad86('0x24')]);}return _0x45de7e[_0xad86('0x88')](_0x2fbdb2);}})[_0xad86('0x2b')](function(_0x4ccb2f){if(_0x4ccb2f){return _0x4ccb2f?{'count':_0x5c269d,'rows':_0x4ccb2f}:null;}})[_0xad86('0x2b')](respondWithResult(_0xe1141b,null))[_0xad86('0x4d')](handleError(_0xe1141b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 02419df..aa2696e 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 _0xe152=['emit','hasOwnProperty','hook','exports','events','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x56e3f5,_0x36e807){var _0x1007ee=function(_0x4859d7){while(--_0x4859d7){_0x56e3f5['push'](_0x56e3f5['shift']());}};_0x1007ee(++_0x36e807);}(_0xe152,0x158));var _0x2e15=function(_0x39aa77,_0xa138e7){_0x39aa77=_0x39aa77-0x0;var _0x220bf4=_0xe152[_0x39aa77];return _0x220bf4;};'use strict';var EventEmitter=require(_0x2e15('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x2e15('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2e15('0x2')](0x0);var events={'afterCreate':_0x2e15('0x3'),'afterUpdate':_0x2e15('0x4'),'afterDestroy':_0x2e15('0x5')};function emitEvent(_0x31b601){return function(_0x1901cc,_0xeefdd3,_0x29b3ce){SmsQueueEvents[_0x2e15('0x6')](_0x31b601+':'+_0x1901cc['id'],_0x1901cc);SmsQueueEvents[_0x2e15('0x6')](_0x31b601,_0x1901cc);_0x29b3ce(null);};}for(var e in events){if(events[_0x2e15('0x7')](e)){var event=events[e];SmsQueue[_0x2e15('0x8')](e,emitEvent(event));}}module[_0x2e15('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xfa07=['../../mysqldb','SmsQueue','save','update','emit','hasOwnProperty','hook','events'];(function(_0x5a3340,_0x5b7a94){var _0x101985=function(_0x124f9c){while(--_0x124f9c){_0x5a3340['push'](_0x5a3340['shift']());}};_0x101985(++_0x5b7a94);}(_0xfa07,0x177));var _0x7fa0=function(_0x595e22,_0x5f2c86){_0x595e22=_0x595e22-0x0;var _0x5b98ca=_0xfa07[_0x595e22];return _0x5b98ca;};'use strict';var EventEmitter=require(_0x7fa0('0x0'));var SmsQueue=require(_0x7fa0('0x1'))['db'][_0x7fa0('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7fa0('0x3'),'afterUpdate':_0x7fa0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49c4fa){return function(_0x1ad4b0,_0x172ecb,_0x51fb31){SmsQueueEvents[_0x7fa0('0x5')](_0x49c4fa+':'+_0x1ad4b0['id'],_0x1ad4b0);SmsQueueEvents[_0x7fa0('0x5')](_0x49c4fa,_0x1ad4b0);_0x51fb31(null);};}for(var e in events){if(events[_0x7fa0('0x6')](e)){var event=events[e];SmsQueue[_0x7fa0('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 71f9069..893b87e 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 _0x41f2=['rimraf','../../config/environment','exports','define','SmsQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5bf5b5,_0x47b760){var _0x496789=function(_0x208f7f){while(--_0x208f7f){_0x5bf5b5['push'](_0x5bf5b5['shift']());}};_0x496789(++_0x47b760);}(_0x41f2,0x14f));var _0x241f=function(_0x1f6872,_0x176335){_0x1f6872=_0x1f6872-0x0;var _0x2a9f2b=_0x41f2[_0x1f6872];return _0x2a9f2b;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var logger=require('../../config/logger')(_0x241f('0x2'));var moment=require(_0x241f('0x3'));var BPromise=require(_0x241f('0x4'));var rp=require(_0x241f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x241f('0x6'));var config=require(_0x241f('0x7'));var attributes=require('./smsQueue.attributes');module[_0x241f('0x8')]=function(_0x2e8e9f,_0x253edb){return _0x2e8e9f[_0x241f('0x9')](_0x241f('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68fc=['bluebird','path','./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger'];(function(_0x516e1e,_0x399b97){var _0x52b2d6=function(_0x125835){while(--_0x125835){_0x516e1e['push'](_0x516e1e['shift']());}};_0x52b2d6(++_0x399b97);}(_0x68fc,0xa5));var _0xc68f=function(_0x5a62b4,_0x4379c0){_0x5a62b4=_0x5a62b4-0x0;var _0x4ab982=_0x68fc[_0x5a62b4];return _0x4ab982;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('SmsQueue',attributes,{'tableName':_0xc68f('0x7'),'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 b24ed34..618e5c5 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 _0x45bf=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','findAll','options','raw','where','attributes','include','map','model','catch','ShowSmsQueue','SmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x57fa7e,_0xd0b5ce){var _0x320671=function(_0x3392cc){while(--_0x3392cc){_0x57fa7e['push'](_0x57fa7e['shift']());}};_0x320671(++_0xd0b5ce);}(_0x45bf,0xde));var _0xf45b=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x45bf[_0x46361e];return _0x14e302;};'use strict';var _=require(_0xf45b('0x0'));var util=require(_0xf45b('0x1'));var moment=require(_0xf45b('0x2'));var BPromise=require(_0xf45b('0x3'));var rs=require(_0xf45b('0x4'));var fs=require('fs');var Redis=require(_0xf45b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf45b('0x6'));var logger=require(_0xf45b('0x7'))(_0xf45b('0x8'));var config=require(_0xf45b('0x9'));var jayson=require(_0xf45b('0xa'));var client=jayson[_0xf45b('0xb')][_0xf45b('0xc')]({'port':0x232a});config['redis']=_[_0xf45b('0xd')](config['redis'],{'host':_0xf45b('0xe'),'port':0x18eb});var socket=require(_0xf45b('0xf'))(new Redis(config['redis']));require(_0xf45b('0x10'))[_0xf45b('0x11')](socket);function respondWithRpcPromise(_0x4779ff,_0xbebf4b,_0x1ff9ab){return new BPromise(function(_0x18fe91,_0x406c14){return client['request'](_0x4779ff,_0x1ff9ab)[_0xf45b('0x12')](function(_0x52de2a){logger[_0xf45b('0x13')](_0xf45b('0x14'),_0xbebf4b,_0xf45b('0x15'));logger[_0xf45b('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0xbebf4b,_0xf45b('0x15'),JSON[_0xf45b('0x17')](_0x52de2a));if(_0x52de2a[_0xf45b('0x18')]){if(_0x52de2a['error'][_0xf45b('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0xbebf4b,_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);return _0x406c14(_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);}logger[_0xf45b('0x18')](_0xf45b('0x14'),_0xbebf4b,_0x52de2a['error'][_0xf45b('0x1a')]);return _0x18fe91(_0x52de2a[_0xf45b('0x18')][_0xf45b('0x1a')]);}else{logger[_0xf45b('0x13')](_0xf45b('0x14'),_0xbebf4b,_0xf45b('0x15'));_0x18fe91(_0x52de2a['result'][_0xf45b('0x1a')]);}})['catch'](function(_0x4f0ff8){logger['error'](_0xf45b('0x14'),_0xbebf4b,_0x4f0ff8);_0x406c14(_0x4f0ff8);});});}exports[_0xf45b('0x1b')]=function(_0x5d589){var _0x46bd7a=this;return new Promise(function(_0x4f396c,_0x4bbef7){return db['SmsQueue'][_0xf45b('0x1c')]({'raw':_0x5d589[_0xf45b('0x1d')]?_0x5d589['options'][_0xf45b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x1f')]||null:null,'attributes':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x20')]||null:null,'limit':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')]['limit']||null:null,'include':_0x5d589[_0xf45b('0x1d')]?_0x5d589[_0xf45b('0x1d')][_0xf45b('0x21')]?_[_0xf45b('0x22')](_0x5d589[_0xf45b('0x1d')][_0xf45b('0x21')],function(_0x138754){return{'model':db[_0x138754[_0xf45b('0x23')]],'as':_0x138754['as'],'attributes':_0x138754[_0xf45b('0x20')],'include':_0x138754['include']?_[_0xf45b('0x22')](_0x138754[_0xf45b('0x21')],function(_0x2ebe57){return{'model':db[_0x2ebe57[_0xf45b('0x23')]],'as':_0x2ebe57['as'],'attributes':_0x2ebe57[_0xf45b('0x20')],'include':_0x2ebe57['include']?_[_0xf45b('0x22')](_0x2ebe57[_0xf45b('0x21')],function(_0x5116a7){return{'model':db[_0x5116a7['model']],'as':_0x5116a7['as'],'attributes':_0x5116a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf45b('0x12')](function(_0x1bb5a8){logger[_0xf45b('0x13')]('GetSmsQueue',_0x5d589);logger[_0xf45b('0x16')](_0xf45b('0x1b'),_0x5d589,JSON[_0xf45b('0x17')](_0x1bb5a8));_0x4f396c(_0x1bb5a8);})[_0xf45b('0x24')](function(_0x3ec12a){logger[_0xf45b('0x18')]('GetSmsQueue',_0x3ec12a['message'],_0x5d589);_0x4bbef7(_0x46bd7a[_0xf45b('0x18')](0x1f4,_0x3ec12a[_0xf45b('0x1a')]));});});};exports[_0xf45b('0x25')]=function(_0x2ea6d1){var _0x232d33=this;return new Promise(function(_0x4c8197,_0x19a601){return db[_0xf45b('0x26')][_0xf45b('0x27')]({'raw':_0x2ea6d1['options']?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ea6d1[_0xf45b('0x1d')]?_0x2ea6d1[_0xf45b('0x1d')]['where']||null:null,'attributes':_0x2ea6d1[_0xf45b('0x1d')]?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x20')]||null:null,'include':_0x2ea6d1['options']?_0x2ea6d1[_0xf45b('0x1d')][_0xf45b('0x21')]?_['map'](_0x2ea6d1['options'][_0xf45b('0x21')],function(_0x4b9476){return{'model':db[_0x4b9476[_0xf45b('0x23')]],'as':_0x4b9476['as'],'attributes':_0x4b9476[_0xf45b('0x20')],'include':_0x4b9476[_0xf45b('0x21')]?_[_0xf45b('0x22')](_0x4b9476[_0xf45b('0x21')],function(_0x3205b3){return{'model':db[_0x3205b3[_0xf45b('0x23')]],'as':_0x3205b3['as'],'attributes':_0x3205b3['attributes'],'include':_0x3205b3['include']?_[_0xf45b('0x22')](_0x3205b3[_0xf45b('0x21')],function(_0x2ceb02){return{'model':db[_0x2ceb02[_0xf45b('0x23')]],'as':_0x2ceb02['as'],'attributes':_0x2ceb02['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x332d3e){logger[_0xf45b('0x13')]('ShowSmsQueue',_0x2ea6d1);logger[_0xf45b('0x16')]('ShowSmsQueue',_0x2ea6d1,JSON['stringify'](_0x332d3e));_0x4c8197(_0x332d3e);})[_0xf45b('0x24')](function(_0x2f78df){logger[_0xf45b('0x18')](_0xf45b('0x25'),_0x2f78df['message'],_0x2ea6d1);_0x19a601(_0x232d33['error'](0x1f4,_0x2f78df['message']));});});}; \ No newline at end of file +var _0x2796=['lodash','util','bluebird','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','include','map','model','ShowSmsQueue','find'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x2796,0x66));var _0x6279=function(_0x58a2cc,_0x14ae9f){_0x58a2cc=_0x58a2cc-0x0;var _0x3dcdba=_0x2796[_0x58a2cc];return _0x3dcdba;};'use strict';var _=require(_0x6279('0x0'));var util=require(_0x6279('0x1'));var moment=require('moment');var BPromise=require(_0x6279('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6279('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6279('0x4'));var config=require('../../config/environment');var jayson=require(_0x6279('0x5'));var client=jayson[_0x6279('0x6')][_0x6279('0x7')]({'port':0x232a});config[_0x6279('0x8')]=_[_0x6279('0x9')](config[_0x6279('0x8')],{'host':_0x6279('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6279('0x8')]));require('./smsQueue.socket')[_0x6279('0xb')](socket);function respondWithRpcPromise(_0xdafb8c,_0x705498,_0x5bd0b0){return new BPromise(function(_0x185c92,_0x4c9c2a){return client[_0x6279('0xc')](_0xdafb8c,_0x5bd0b0)[_0x6279('0xd')](function(_0x4ad4db){logger[_0x6279('0xe')]('SmsQueue,\x20%s,\x20%s',_0x705498,_0x6279('0xf'));logger[_0x6279('0x10')](_0x6279('0x11'),_0x705498,'request\x20sent',JSON[_0x6279('0x12')](_0x4ad4db));if(_0x4ad4db[_0x6279('0x13')]){if(_0x4ad4db[_0x6279('0x13')]['code']===0x1f4){logger['error'](_0x6279('0x14'),_0x705498,_0x4ad4db['error']['message']);return _0x4c9c2a(_0x4ad4db[_0x6279('0x13')][_0x6279('0x15')]);}logger[_0x6279('0x13')](_0x6279('0x14'),_0x705498,_0x4ad4db[_0x6279('0x13')]['message']);return _0x185c92(_0x4ad4db[_0x6279('0x13')][_0x6279('0x15')]);}else{logger['info'](_0x6279('0x14'),_0x705498,_0x6279('0xf'));_0x185c92(_0x4ad4db['result']['message']);}})[_0x6279('0x16')](function(_0x5913fe){logger[_0x6279('0x13')](_0x6279('0x14'),_0x705498,_0x5913fe);_0x4c9c2a(_0x5913fe);});});}exports[_0x6279('0x17')]=function(_0x267919){var _0x2923f5=this;return new Promise(function(_0xeb2514,_0x4c8987){return db[_0x6279('0x18')]['findAll']({'raw':_0x267919[_0x6279('0x19')]?_0x267919['options'][_0x6279('0x1a')]===undefined?!![]:![]:!![],'where':_0x267919['options']?_0x267919[_0x6279('0x19')][_0x6279('0x1b')]||null:null,'attributes':_0x267919[_0x6279('0x19')]?_0x267919[_0x6279('0x19')][_0x6279('0x1c')]||null:null,'limit':_0x267919['options']?_0x267919[_0x6279('0x19')]['limit']||null:null,'include':_0x267919[_0x6279('0x19')]?_0x267919[_0x6279('0x19')][_0x6279('0x1d')]?_[_0x6279('0x1e')](_0x267919[_0x6279('0x19')][_0x6279('0x1d')],function(_0x53f784){return{'model':db[_0x53f784[_0x6279('0x1f')]],'as':_0x53f784['as'],'attributes':_0x53f784[_0x6279('0x1c')],'include':_0x53f784['include']?_['map'](_0x53f784[_0x6279('0x1d')],function(_0x162bf6){return{'model':db[_0x162bf6[_0x6279('0x1f')]],'as':_0x162bf6['as'],'attributes':_0x162bf6[_0x6279('0x1c')],'include':_0x162bf6[_0x6279('0x1d')]?_['map'](_0x162bf6[_0x6279('0x1d')],function(_0xf14a37){return{'model':db[_0xf14a37['model']],'as':_0xf14a37['as'],'attributes':_0xf14a37[_0x6279('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6279('0xd')](function(_0x2f7448){logger[_0x6279('0xe')](_0x6279('0x17'),_0x267919);logger['debug']('GetSmsQueue',_0x267919,JSON['stringify'](_0x2f7448));_0xeb2514(_0x2f7448);})[_0x6279('0x16')](function(_0x16c9b0){logger[_0x6279('0x13')](_0x6279('0x17'),_0x16c9b0[_0x6279('0x15')],_0x267919);_0x4c8987(_0x2923f5['error'](0x1f4,_0x16c9b0[_0x6279('0x15')]));});});};exports[_0x6279('0x20')]=function(_0x12f81f){var _0x818115=this;return new Promise(function(_0x19b971,_0x3fd44a){return db['SmsQueue'][_0x6279('0x21')]({'raw':_0x12f81f[_0x6279('0x19')]?_0x12f81f[_0x6279('0x19')][_0x6279('0x1a')]===undefined?!![]:![]:!![],'where':_0x12f81f['options']?_0x12f81f['options']['where']||null:null,'attributes':_0x12f81f[_0x6279('0x19')]?_0x12f81f[_0x6279('0x19')][_0x6279('0x1c')]||null:null,'include':_0x12f81f[_0x6279('0x19')]?_0x12f81f[_0x6279('0x19')]['include']?_[_0x6279('0x1e')](_0x12f81f[_0x6279('0x19')][_0x6279('0x1d')],function(_0x3ca4e9){return{'model':db[_0x3ca4e9['model']],'as':_0x3ca4e9['as'],'attributes':_0x3ca4e9[_0x6279('0x1c')],'include':_0x3ca4e9[_0x6279('0x1d')]?_['map'](_0x3ca4e9[_0x6279('0x1d')],function(_0x3be459){return{'model':db[_0x3be459[_0x6279('0x1f')]],'as':_0x3be459['as'],'attributes':_0x3be459['attributes'],'include':_0x3be459[_0x6279('0x1d')]?_[_0x6279('0x1e')](_0x3be459[_0x6279('0x1d')],function(_0x3ebdfa){return{'model':db[_0x3ebdfa[_0x6279('0x1f')]],'as':_0x3ebdfa['as'],'attributes':_0x3ebdfa[_0x6279('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6279('0xd')](function(_0x246d6b){logger[_0x6279('0xe')]('ShowSmsQueue',_0x12f81f);logger[_0x6279('0x10')]('ShowSmsQueue',_0x12f81f,JSON['stringify'](_0x246d6b));_0x19b971(_0x246d6b);})[_0x6279('0x16')](function(_0xa8eaf9){logger[_0x6279('0x13')](_0x6279('0x20'),_0xa8eaf9[_0x6279('0x15')],_0x12f81f);_0x3fd44a(_0x818115[_0x6279('0x13')](0x1f4,_0xa8eaf9[_0x6279('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7b7048a..1472e1d 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 _0xc275=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc275,0x1b4));var _0x5c27=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc275[_0x19950b];return _0x3c6b41;};'use strict';var SmsQueueEvents=require(_0x5c27('0x0'));var events=[_0x5c27('0x1'),_0x5c27('0x2'),_0x5c27('0x3')];function createListener(_0x457c50,_0x5ec62d){return function(_0x4a3ff4){_0x5ec62d['emit'](_0x457c50,_0x4a3ff4);};}function removeListener(_0x13bf56,_0x1a6056){return function(){SmsQueueEvents[_0x5c27('0x4')](_0x13bf56,_0x1a6056);};}exports[_0x5c27('0x5')]=function(_0x43c1e3){for(var _0x1cbde2=0x0,_0x299300=events[_0x5c27('0x6')];_0x1cbde2<_0x299300;_0x1cbde2++){var _0x53b2ac=events[_0x1cbde2];var _0x1733f0=createListener(_0x5c27('0x7')+_0x53b2ac,_0x43c1e3);SmsQueueEvents['on'](_0x53b2ac,_0x1733f0);}}; \ No newline at end of file +var _0xdfca=['register','length','./smsQueue.events','remove','emit','removeListener'];(function(_0x2f0117,_0x1f952e){var _0x524fc5=function(_0x1429c2){while(--_0x1429c2){_0x2f0117['push'](_0x2f0117['shift']());}};_0x524fc5(++_0x1f952e);}(_0xdfca,0x1e2));var _0xadfc=function(_0x23f67c,_0x57448e){_0x23f67c=_0x23f67c-0x0;var _0x1de507=_0xdfca[_0x23f67c];return _0x1de507;};'use strict';var SmsQueueEvents=require(_0xadfc('0x0'));var events=['save',_0xadfc('0x1'),'update'];function createListener(_0x9bf71c,_0x3887d1){return function(_0x528836){_0x3887d1[_0xadfc('0x2')](_0x9bf71c,_0x528836);};}function removeListener(_0x92cfe6,_0x592808){return function(){SmsQueueEvents[_0xadfc('0x3')](_0x92cfe6,_0x592808);};}exports[_0xadfc('0x4')]=function(_0x31c37f){for(var _0x1a9749=0x0,_0x5ed72c=events[_0xadfc('0x5')];_0x1a9749<_0x5ed72c;_0x1a9749++){var _0x52e1b3=events[_0x1a9749];var _0x5d3464=createListener('smsQueue:'+_0x52e1b3,_0x31c37f);SmsQueueEvents['on'](_0x52e1b3,_0x5d3464);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c1c4b36..44088a4 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 _0x0597=['Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x40ff81,_0x489c83){var _0x35eb70=function(_0x57dc84){while(--_0x57dc84){_0x40ff81['push'](_0x40ff81['shift']());}};_0x35eb70(++_0x489c83);}(_0x0597,0x7b));var _0x7059=function(_0x498c67,_0xc0ac6b){_0x498c67=_0x498c67-0x0;var _0x4f62cf=_0x0597[_0x498c67];return _0x4f62cf;};'use strict';var multer=require('multer');var util=require(_0x7059('0x0'));var path=require(_0x7059('0x1'));var timeout=require(_0x7059('0x2'));var express=require('express');var router=express[_0x7059('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7059('0x4'));var config=require(_0x7059('0x5'));var controller=require(_0x7059('0x6'));router[_0x7059('0x7')]('/',auth[_0x7059('0x8')](),controller[_0x7059('0x9')]);router[_0x7059('0x7')](_0x7059('0xa'),auth[_0x7059('0x8')](),controller['describe']);router['get'](_0x7059('0xb'),auth[_0x7059('0x8')](),controller[_0x7059('0xc')]);router['post']('/',auth[_0x7059('0x8')](),controller[_0x7059('0xd')]);router[_0x7059('0xe')](_0x7059('0xb'),auth[_0x7059('0x8')](),controller[_0x7059('0xf')]);router[_0x7059('0x10')](_0x7059('0xb'),auth['isAuthenticated'](),controller[_0x7059('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf555=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x153166,_0x5f4ef3){var _0x78ac2a=function(_0x4d81e4){while(--_0x4d81e4){_0x153166['push'](_0x153166['shift']());}};_0x78ac2a(++_0x5f4ef3);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var path=require('path');var timeout=require(_0x5f55('0x2'));var express=require('express');var router=express[_0x5f55('0x3')]();var auth=require(_0x5f55('0x4'));var interaction=require(_0x5f55('0x5'));var config=require('../../config/environment');var controller=require(_0x5f55('0x6'));router[_0x5f55('0x7')]('/',auth['isAuthenticated'](),controller[_0x5f55('0x8')]);router[_0x5f55('0x7')](_0x5f55('0x9'),auth[_0x5f55('0xa')](),controller[_0x5f55('0xb')]);router[_0x5f55('0x7')](_0x5f55('0xc'),auth[_0x5f55('0xa')](),controller[_0x5f55('0xd')]);router['post']('/',auth[_0x5f55('0xa')](),controller[_0x5f55('0xe')]);router[_0x5f55('0xf')](_0x5f55('0xc'),auth['isAuthenticated'](),controller[_0x5f55('0x10')]);router[_0x5f55('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5f55('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 9bf6082..2590687 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 _0x7616=['DATE','sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7616,0xa0));var _0x6761=function(_0x4a0424,_0x4f2075){_0x4a0424=_0x4a0424-0x0;var _0x39c95f=_0x7616[_0x4a0424];return _0x39c95f;};'use strict';var moment=require('moment');var Sequelize=require(_0x6761('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6761('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x6761('0x1')]},'joinAt':{'type':Sequelize[_0x6761('0x2')]},'leaveAt':{'type':Sequelize[_0x6761('0x2')]},'acceptAt':{'type':Sequelize[_0x6761('0x2')]},'exitAt':{'type':Sequelize[_0x6761('0x2')]},'reason':{'type':Sequelize[_0x6761('0x1')]}}; \ No newline at end of file +var _0x2ff3=['moment','STRING','DATE'];(function(_0x2ee669,_0xc6a943){var _0xb2e603=function(_0x2614e2){while(--_0x2614e2){_0x2ee669['push'](_0x2ee669['shift']());}};_0xb2e603(++_0xc6a943);}(_0x2ff3,0x12f));var _0x32ff=function(_0x348b46,_0xbece28){_0x348b46=_0x348b46-0x0;var _0x45d980=_0x2ff3[_0x348b46];return _0x45d980;};'use strict';var moment=require(_0x32ff('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x32ff('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x32ff('0x1')]},'joinAt':{'type':Sequelize[_0x32ff('0x2')]},'leaveAt':{'type':Sequelize[_0x32ff('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 00d7ff1..063cd39 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 _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x88f3be,_0x34a5b6){var _0x22e9d6=function(_0x223293){while(--_0x223293){_0x88f3be['push'](_0x88f3be['shift']());}};_0x22e9d6(++_0x34a5b6);}(_0xe14b,0x93));var _0xbe14=function(_0x397b4b,_0x4c6e71){_0x397b4b=_0x397b4b-0x0;var _0x5c5308=_0xe14b[_0x397b4b];return _0x5c5308;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['SmsQueueReport'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x439649,_0x366523){var _0x2726da=function(_0x51a536){while(--_0x51a536){_0x439649['push'](_0x439649['shift']());}};_0x2726da(++_0x366523);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index fa6eab9..9ffa6cc 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 _0x5eb3=['define','SmsQueueReport','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d9534,_0x2c5d5a){var _0x316ef4=function(_0x1fb45e){while(--_0x1fb45e){_0x5d9534['push'](_0x5d9534['shift']());}};_0x316ef4(++_0x2c5d5a);}(_0x5eb3,0x1f2));var _0x35eb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5eb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x35eb('0x0'))(_0x35eb('0x1'));var moment=require(_0x35eb('0x2'));var BPromise=require('bluebird');var rp=require(_0x35eb('0x3'));var fs=require('fs');var path=require(_0x35eb('0x4'));var rimraf=require(_0x35eb('0x5'));var config=require(_0x35eb('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0x35eb('0x7')]=function(_0x3879bd,_0x1ed8b8){return _0x3879bd[_0x35eb('0x8')](_0x35eb('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x35eb('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6450=['SmsQueueReport','report_sms_queue','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x53fb5b,_0x126c2f){var _0x302d63=function(_0x409f4a){while(--_0x409f4a){_0x53fb5b['push'](_0x53fb5b['shift']());}};_0x302d63(++_0x126c2f);}(_0x6450,0xc3));var _0x0645=function(_0x1dc4e4,_0x4b4ea1){_0x1dc4e4=_0x1dc4e4-0x0;var _0x57440c=_0x6450[_0x1dc4e4];return _0x57440c;};'use strict';var _=require('lodash');var util=require(_0x0645('0x0'));var logger=require('../../config/logger')(_0x0645('0x1'));var moment=require(_0x0645('0x2'));var BPromise=require(_0x0645('0x3'));var rp=require(_0x0645('0x4'));var fs=require('fs');var path=require(_0x0645('0x5'));var rimraf=require(_0x0645('0x6'));var config=require(_0x0645('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x0645('0x8')]=function(_0x10b412,_0x14338a){return _0x10b412['define'](_0x0645('0x9'),attributes,{'tableName':_0x0645('0xa'),'paranoid':![],'indexes':[{'name':_0x0645('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 7d81b75..e42d363 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 _0x9f69=['attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','create','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where'];(function(_0x38bbbe,_0x1c65f1){var _0x4d2355=function(_0x3296dd){while(--_0x3296dd){_0x38bbbe['push'](_0x38bbbe['shift']());}};_0x4d2355(++_0x1c65f1);}(_0x9f69,0xd9));var _0x99f6=function(_0x3ac0fd,_0x2dfb0c){_0x3ac0fd=_0x3ac0fd-0x0;var _0x2670a9=_0x9f69[_0x3ac0fd];return _0x2670a9;};'use strict';var _=require(_0x99f6('0x0'));var util=require(_0x99f6('0x1'));var moment=require(_0x99f6('0x2'));var BPromise=require(_0x99f6('0x3'));var rs=require(_0x99f6('0x4'));var fs=require('fs');var Redis=require(_0x99f6('0x5'));var db=require(_0x99f6('0x6'))['db'];var utils=require(_0x99f6('0x7'));var logger=require(_0x99f6('0x8'))(_0x99f6('0x9'));var config=require(_0x99f6('0xa'));var jayson=require(_0x99f6('0xb'));var client=jayson[_0x99f6('0xc')][_0x99f6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x49a89f,_0x52dee6,_0x27a011){return new BPromise(function(_0x23e87f,_0x3f3b25){return client[_0x99f6('0xe')](_0x49a89f,_0x27a011)[_0x99f6('0xf')](function(_0x41dc0b){logger['info'](_0x99f6('0x10'),_0x52dee6,'request\x20sent');logger[_0x99f6('0x11')](_0x99f6('0x12'),_0x52dee6,_0x99f6('0x13'),JSON['stringify'](_0x41dc0b));if(_0x41dc0b[_0x99f6('0x14')]){if(_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x15')]===0x1f4){logger[_0x99f6('0x14')](_0x99f6('0x10'),_0x52dee6,_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);return _0x3f3b25(_0x41dc0b[_0x99f6('0x14')]['message']);}logger[_0x99f6('0x14')](_0x99f6('0x10'),_0x52dee6,_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);return _0x23e87f(_0x41dc0b[_0x99f6('0x14')][_0x99f6('0x16')]);}else{logger[_0x99f6('0x17')](_0x99f6('0x10'),_0x52dee6,_0x99f6('0x13'));_0x23e87f(_0x41dc0b['result'][_0x99f6('0x16')]);}})[_0x99f6('0x18')](function(_0x21fdff){logger['error'](_0x99f6('0x10'),_0x52dee6,_0x21fdff);_0x3f3b25(_0x21fdff);});});}exports['CreateSmsQueueReport']=function(_0x440634){var _0x1e49be=this;return new Promise(function(_0x269687,_0x2a935a){return db['SmsQueueReport'][_0x99f6('0x19')](_0x440634[_0x99f6('0x1a')],{'raw':_0x440634[_0x99f6('0x1b')]?_0x440634['options'][_0x99f6('0x1c')]===undefined?!![]:![]:!![]})[_0x99f6('0xf')](function(_0x4ab8d5){logger[_0x99f6('0x17')](_0x99f6('0x1d'),_0x440634);logger['debug'](_0x99f6('0x1d'),_0x440634,JSON[_0x99f6('0x1e')](_0x4ab8d5));_0x269687(_0x4ab8d5);})['catch'](function(_0x58294a){logger[_0x99f6('0x14')]('CreateSmsQueueReport',_0x58294a[_0x99f6('0x16')],_0x440634);_0x2a935a(_0x1e49be[_0x99f6('0x14')](0x1f4,_0x58294a[_0x99f6('0x16')]));});});};exports[_0x99f6('0x1f')]=function(_0xf956f){var _0x4bfe29=this;return new Promise(function(_0x4a0d98,_0x3ea7ca){return db[_0x99f6('0x20')][_0x99f6('0x21')](_0xf956f[_0x99f6('0x1a')],{'raw':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')][_0x99f6('0x22')]||null:null,'attributes':_0xf956f[_0x99f6('0x1b')]?_0xf956f[_0x99f6('0x1b')][_0x99f6('0x23')]||null:null,'limit':_0xf956f['options']?_0xf956f[_0x99f6('0x1b')]['limit']||null:null})['then'](function(_0x56a586){logger[_0x99f6('0x17')](_0x99f6('0x1f'),_0xf956f);logger[_0x99f6('0x11')](_0x99f6('0x1f'),_0xf956f,JSON[_0x99f6('0x1e')](_0x56a586));_0x4a0d98(_0x56a586);})[_0x99f6('0x18')](function(_0x1e9b1e){logger[_0x99f6('0x14')](_0x99f6('0x1f'),_0x1e9b1e[_0x99f6('0x16')],_0xf956f);_0x3ea7ca(_0x4bfe29[_0x99f6('0x14')](0x1f4,_0x1e9b1e[_0x99f6('0x16')]));});});}; \ No newline at end of file +var _0x7885=['rpc','client','request','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','debug','UpdateSmsQueueReport','where','attributes','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5a88d2,_0x42aa7e){var _0x153a44=function(_0x48a5cc){while(--_0x48a5cc){_0x5a88d2['push'](_0x5a88d2['shift']());}};_0x153a44(++_0x42aa7e);}(_0x7885,0x112));var _0x5788=function(_0x5a188e,_0x2a45a2){_0x5a188e=_0x5a188e-0x0;var _0x32561f=_0x7885[_0x5a188e];return _0x32561f;};'use strict';var _=require(_0x5788('0x0'));var util=require(_0x5788('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5788('0x2'));var fs=require('fs');var Redis=require(_0x5788('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5788('0x4'));var logger=require(_0x5788('0x5'))(_0x5788('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5788('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34fce6,_0x3824b7,_0x127771){return new BPromise(function(_0x2068d7,_0x2b0e8a){return client[_0x5788('0x8')](_0x34fce6,_0x127771)['then'](function(_0x199c1c){logger[_0x5788('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x3824b7,_0x5788('0xa'));logger['debug'](_0x5788('0xb'),_0x3824b7,_0x5788('0xa'),JSON[_0x5788('0xc')](_0x199c1c));if(_0x199c1c[_0x5788('0xd')]){if(_0x199c1c[_0x5788('0xd')][_0x5788('0xe')]===0x1f4){logger[_0x5788('0xd')](_0x5788('0xf'),_0x3824b7,_0x199c1c[_0x5788('0xd')][_0x5788('0x10')]);return _0x2b0e8a(_0x199c1c['error'][_0x5788('0x10')]);}logger[_0x5788('0xd')](_0x5788('0xf'),_0x3824b7,_0x199c1c[_0x5788('0xd')][_0x5788('0x10')]);return _0x2068d7(_0x199c1c[_0x5788('0xd')][_0x5788('0x10')]);}else{logger['info'](_0x5788('0xf'),_0x3824b7,_0x5788('0xa'));_0x2068d7(_0x199c1c['result'][_0x5788('0x10')]);}})[_0x5788('0x11')](function(_0x12c7d3){logger[_0x5788('0xd')](_0x5788('0xf'),_0x3824b7,_0x12c7d3);_0x2b0e8a(_0x12c7d3);});});}exports[_0x5788('0x12')]=function(_0x52d8f2){var _0x50e05e=this;return new Promise(function(_0x5ae7f4,_0x3e4c87){return db[_0x5788('0x13')][_0x5788('0x14')](_0x52d8f2[_0x5788('0x15')],{'raw':_0x52d8f2['options']?_0x52d8f2[_0x5788('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5788('0x17')](function(_0x42ff22){logger[_0x5788('0x9')]('CreateSmsQueueReport',_0x52d8f2);logger[_0x5788('0x18')](_0x5788('0x12'),_0x52d8f2,JSON[_0x5788('0xc')](_0x42ff22));_0x5ae7f4(_0x42ff22);})['catch'](function(_0x493635){logger['error'](_0x5788('0x12'),_0x493635['message'],_0x52d8f2);_0x3e4c87(_0x50e05e[_0x5788('0xd')](0x1f4,_0x493635['message']));});});};exports[_0x5788('0x19')]=function(_0x2c9e32){var _0x4c49a8=this;return new Promise(function(_0x24091d,_0x19a4b5){return db['SmsQueueReport']['update'](_0x2c9e32[_0x5788('0x15')],{'raw':_0x2c9e32[_0x5788('0x16')]?_0x2c9e32['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9e32[_0x5788('0x16')]?_0x2c9e32[_0x5788('0x16')][_0x5788('0x1a')]||null:null,'attributes':_0x2c9e32[_0x5788('0x16')]?_0x2c9e32[_0x5788('0x16')][_0x5788('0x1b')]||null:null,'limit':_0x2c9e32[_0x5788('0x16')]?_0x2c9e32['options']['limit']||null:null})['then'](function(_0x2ff600){logger[_0x5788('0x9')]('UpdateSmsQueueReport',_0x2c9e32);logger[_0x5788('0x18')](_0x5788('0x19'),_0x2c9e32,JSON[_0x5788('0xc')](_0x2ff600));_0x24091d(_0x2ff600);})['catch'](function(_0x3287b3){logger[_0x5788('0xd')]('UpdateSmsQueueReport',_0x3287b3[_0x5788('0x10')],_0x2c9e32);_0x19a4b5(_0x4c49a8['error'](0x1f4,_0x3287b3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f876d50..cbe99ae 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 _0xb03e=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3b78e4,_0x1e9224){var _0xf0fb87=function(_0x2ef623){while(--_0x2ef623){_0x3b78e4['push'](_0x3b78e4['shift']());}};_0xf0fb87(++_0x1e9224);}(_0xb03e,0x1eb));var _0xeb03=function(_0xd3af7f,_0x248501){_0xd3af7f=_0xd3af7f-0x0;var _0x19eceb=_0xb03e[_0xd3af7f];return _0x19eceb;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0x9')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller['show']);router[_0xeb03('0xf')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['put'](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router[_0xeb03('0x12')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x13')]);module[_0xeb03('0x14')]=router; \ No newline at end of file +var _0x4cf8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x4920a1,_0x5bc215){var _0x25ae52=function(_0x1bedd8){while(--_0x1bedd8){_0x4920a1['push'](_0x4920a1['shift']());}};_0x25ae52(++_0x5bc215);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x4cf8[_0x419b6a];return _0x229232;};'use strict';var multer=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var path=require(_0x84cf('0x2'));var timeout=require(_0x84cf('0x3'));var express=require(_0x84cf('0x4'));var router=express[_0x84cf('0x5')]();var auth=require(_0x84cf('0x6'));var interaction=require(_0x84cf('0x7'));var config=require(_0x84cf('0x8'));var controller=require(_0x84cf('0x9'));router[_0x84cf('0xa')]('/',auth[_0x84cf('0xb')](),controller['index']);router['get'](_0x84cf('0xc'),auth['isAuthenticated'](),controller[_0x84cf('0xd')]);router[_0x84cf('0xa')]('/:id',auth[_0x84cf('0xb')](),controller[_0x84cf('0xe')]);router['post']('/',auth[_0x84cf('0xb')](),controller[_0x84cf('0xf')]);router[_0x84cf('0x10')](_0x84cf('0x11'),auth['isAuthenticated'](),controller[_0x84cf('0x12')]);router[_0x84cf('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x84cf('0x14')]);module[_0x84cf('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 614fb52..7b3519c 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 _0x9035=['ENUM','account','agent','queue','NOW','sequelize','exports','STRING'];(function(_0x18e0d1,_0xbca4cb){var _0x58db41=function(_0x5ccffd){while(--_0x5ccffd){_0x18e0d1['push'](_0x18e0d1['shift']());}};_0x58db41(++_0xbca4cb);}(_0x9035,0x1b5));var _0x5903=function(_0x224fbb,_0x2be346){_0x224fbb=_0x224fbb-0x0;var _0x4d5268=_0x9035[_0x224fbb];return _0x4d5268;};'use strict';var moment=require('moment');var Sequelize=require(_0x5903('0x0'));module[_0x5903('0x1')]={'uniqueid':{'type':Sequelize[_0x5903('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5903('0x3')](_0x5903('0x4'),_0x5903('0x5'),'queue'),'allowNull':![],'defaultValue':_0x5903('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5903('0x7')]}}; \ No newline at end of file +var _0xa41f=['sequelize','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x40e136,_0x3e2207){var _0x3fad4b=function(_0x4306dc){while(--_0x4306dc){_0x40e136['push'](_0x40e136['shift']());}};_0x3fad4b(++_0x3e2207);}(_0xa41f,0x8f));var _0xfa41=function(_0x5ccc4d,_0x412e7c){_0x5ccc4d=_0x5ccc4d-0x0;var _0x170814=_0xa41f[_0x5ccc4d];return _0x170814;};'use strict';var moment=require(_0xfa41('0x0'));var Sequelize=require(_0xfa41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfa41('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfa41('0x3')](_0xfa41('0x4'),_0xfa41('0x5'),'queue'),'allowNull':![],'defaultValue':_0xfa41('0x6')},'transferredAt':{'type':Sequelize[_0xfa41('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xfa41('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1b20034..4c21738 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x3d248b,_0x46cd57){var _0x384988=function(_0x5413fe){while(--_0x5413fe){_0x3d248b['push'](_0x3d248b['shift']());}};_0x384988(++_0x46cd57);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xcb91[_0x1abeb2];return _0x48da20;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['SmsTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['SmsTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['SmsTransferReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x9ffd8e,_0x3cdcb1){var _0x2b764f=function(_0x293faa){while(--_0x293faa){_0x9ffd8e['push'](_0x9ffd8e['shift']());}};_0x2b764f(++_0x3cdcb1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 92bc43b..65556b8 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 _0x649f=['./smsTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x4ad873,_0x34f51a){var _0x55491a=function(_0x3855d6){while(--_0x3855d6){_0x4ad873['push'](_0x4ad873['shift']());}};_0x55491a(++_0x34f51a);}(_0x649f,0x93));var _0xf649=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x649f[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var logger=require(_0xf649('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf649('0x4'));var rimraf=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var attributes=require(_0xf649('0x7'));module[_0xf649('0x8')]=function(_0x3e2e46,_0x580748){return _0x3e2e46[_0xf649('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xf649('0xa'),'fields':[_0xf649('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x323e=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer'];(function(_0x322ee0,_0x2e2f29){var _0x4f519a=function(_0x64d2d2){while(--_0x64d2d2){_0x322ee0['push'](_0x322ee0['shift']());}};_0x4f519a(++_0x2e2f29);}(_0x323e,0xa9));var _0xe323=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x323e[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require('lodash');var util=require(_0xe323('0x0'));var logger=require(_0xe323('0x1'))('api');var moment=require(_0xe323('0x2'));var BPromise=require(_0xe323('0x3'));var rp=require(_0xe323('0x4'));var fs=require('fs');var path=require(_0xe323('0x5'));var rimraf=require('rimraf');var config=require(_0xe323('0x6'));var attributes=require(_0xe323('0x7'));module['exports']=function(_0x255159,_0x98e5fd){return _0x255159[_0xe323('0x8')](_0xe323('0x9'),attributes,{'tableName':_0xe323('0xa'),'paranoid':![],'indexes':[{'name':_0xe323('0xb'),'fields':[_0xe323('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index acfe22e..b51dc8f 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 _0xa65b=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x33a8b5,_0x1f5f3c){var _0x30bb3d=function(_0x507adf){while(--_0x507adf){_0x33a8b5['push'](_0x33a8b5['shift']());}};_0x30bb3d(++_0x1f5f3c);}(_0xa65b,0x19b));var _0xba65=function(_0x2e1ae1,_0x100544){_0x2e1ae1=_0x2e1ae1-0x0;var _0x203ccf=_0xa65b[_0x2e1ae1];return _0x203ccf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba65('0x0'));var BPromise=require('bluebird');var rs=require(_0xba65('0x1'));var fs=require('fs');var Redis=require(_0xba65('0x2'));var db=require(_0xba65('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xba65('0x4'));var config=require(_0xba65('0x5'));var jayson=require(_0xba65('0x6'));var client=jayson['client'][_0xba65('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35cbd2,_0x6db476,_0x4139d7){return new BPromise(function(_0x4a83ee,_0x2b8a1d){return client[_0xba65('0x8')](_0x35cbd2,_0x4139d7)['then'](function(_0x563055){logger[_0xba65('0x9')](_0xba65('0xa'),_0x6db476,_0xba65('0xb'));logger[_0xba65('0xc')](_0xba65('0xd'),_0x6db476,'request\x20sent',JSON[_0xba65('0xe')](_0x563055));if(_0x563055[_0xba65('0xf')]){if(_0x563055['error'][_0xba65('0x10')]===0x1f4){logger[_0xba65('0xf')](_0xba65('0xa'),_0x6db476,_0x563055[_0xba65('0xf')][_0xba65('0x11')]);return _0x2b8a1d(_0x563055['error']['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x6db476,_0x563055[_0xba65('0xf')][_0xba65('0x11')]);return _0x4a83ee(_0x563055[_0xba65('0xf')][_0xba65('0x11')]);}else{logger[_0xba65('0x9')](_0xba65('0xa'),_0x6db476,_0xba65('0xb'));_0x4a83ee(_0x563055[_0xba65('0x12')][_0xba65('0x11')]);}})[_0xba65('0x13')](function(_0x98eec1){logger['error'](_0xba65('0xa'),_0x6db476,_0x98eec1);_0x2b8a1d(_0x98eec1);});});} \ No newline at end of file +var _0x8479=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x8479,0xc9));var _0x9847=function(_0x1be222,_0x5bac41){_0x1be222=_0x1be222-0x0;var _0x18daa2=_0x8479[_0x1be222];return _0x18daa2;};'use strict';var _=require(_0x9847('0x0'));var util=require(_0x9847('0x1'));var moment=require('moment');var BPromise=require(_0x9847('0x2'));var rs=require(_0x9847('0x3'));var fs=require('fs');var Redis=require(_0x9847('0x4'));var db=require(_0x9847('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9847('0x6'))(_0x9847('0x7'));var config=require('../../config/environment');var jayson=require(_0x9847('0x8'));var client=jayson[_0x9847('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf3f5b,_0x34f61d,_0xe74a30){return new BPromise(function(_0x3a2c57,_0x252949){return client[_0x9847('0xa')](_0xf3f5b,_0xe74a30)[_0x9847('0xb')](function(_0x5675f0){logger[_0x9847('0xc')](_0x9847('0xd'),_0x34f61d,_0x9847('0xe'));logger['debug'](_0x9847('0xf'),_0x34f61d,_0x9847('0xe'),JSON[_0x9847('0x10')](_0x5675f0));if(_0x5675f0['error']){if(_0x5675f0[_0x9847('0x11')][_0x9847('0x12')]===0x1f4){logger[_0x9847('0x11')](_0x9847('0xd'),_0x34f61d,_0x5675f0['error']['message']);return _0x252949(_0x5675f0[_0x9847('0x11')][_0x9847('0x13')]);}logger[_0x9847('0x11')](_0x9847('0xd'),_0x34f61d,_0x5675f0[_0x9847('0x11')][_0x9847('0x13')]);return _0x3a2c57(_0x5675f0['error']['message']);}else{logger['info'](_0x9847('0xd'),_0x34f61d,_0x9847('0xe'));_0x3a2c57(_0x5675f0['result']['message']);}})['catch'](function(_0x18a753){logger[_0x9847('0x11')](_0x9847('0xd'),_0x34f61d,_0x18a753);_0x252949(_0x18a753);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9ffe6c6..b13b21b 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 _0x750b=['format','%s-%s%s','basename','extname','post','single','file','put','update','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0xa0bbb0,_0x357b78){var _0xaacc43=function(_0x549b76){while(--_0x549b76){_0xa0bbb0['push'](_0xa0bbb0['shift']());}};_0xaacc43(++_0x357b78);}(_0x750b,0x169));var _0xb750=function(_0x41c243,_0x521583){_0x41c243=_0x41c243-0x0;var _0x44dece=_0x750b[_0x41c243];return _0x44dece;};'use strict';var multer=require(_0xb750('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb750('0x1'));var express=require(_0xb750('0x2'));var router=express[_0xb750('0x3')]();var auth=require(_0xb750('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb750('0x5'));var controller=require(_0xb750('0x6'));router[_0xb750('0x7')]('/',auth[_0xb750('0x8')](),controller['index']);router[_0xb750('0x7')](_0xb750('0x9'),auth[_0xb750('0x8')](),controller['show']);router[_0xb750('0x7')](_0xb750('0xa'),auth[_0xb750('0x8')](),controller[_0xb750('0xb')]);var upload=multer({'storage':multer[_0xb750('0xc')]({'destination':function(_0x20b849,_0x87dd37,_0x58c62b){_0x58c62b(null,path['join'](config[_0xb750('0xd')],_0xb750('0xe')));},'filename':function(_0x119296,_0x128341,_0x531643){_0x128341[_0xb750('0xf')]=_0x128341[_0xb750('0xf')][_0xb750('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x531643(null,util[_0xb750('0x11')](_0xb750('0x12'),path[_0xb750('0x13')](_0x128341[_0xb750('0xf')],path[_0xb750('0x14')](_0x128341[_0xb750('0xf')])),Date['now'](),path[_0xb750('0x14')](_0x128341[_0xb750('0xf')])));}})});router[_0xb750('0x15')]('/',upload[_0xb750('0x16')](_0xb750('0x17')),controller['create']);router[_0xb750('0x18')](_0xb750('0x9'),auth[_0xb750('0x8')](),controller[_0xb750('0x19')]);router['delete'](_0xb750('0x9'),auth[_0xb750('0x8')](),controller[_0xb750('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x561d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','basename','extname','now','post','single','file','create','put','update','delete'];(function(_0x1fea1f,_0x397c41){var _0x21cc19=function(_0x158219){while(--_0x158219){_0x1fea1f['push'](_0x1fea1f['shift']());}};_0x21cc19(++_0x397c41);}(_0x561d,0x105));var _0xd561=function(_0x158cfb,_0x2e87b6){_0x158cfb=_0x158cfb-0x0;var _0x4e8dcf=_0x561d[_0x158cfb];return _0x4e8dcf;};'use strict';var multer=require('multer');var util=require(_0xd561('0x0'));var path=require(_0xd561('0x1'));var timeout=require(_0xd561('0x2'));var express=require(_0xd561('0x3'));var router=express[_0xd561('0x4')]();var auth=require(_0xd561('0x5'));var interaction=require(_0xd561('0x6'));var config=require('../../config/environment');var controller=require(_0xd561('0x7'));router[_0xd561('0x8')]('/',auth[_0xd561('0x9')](),controller['index']);router[_0xd561('0x8')](_0xd561('0xa'),auth[_0xd561('0x9')](),controller[_0xd561('0xb')]);router[_0xd561('0x8')](_0xd561('0xc'),auth[_0xd561('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xd561('0xd')]({'destination':function(_0x592a77,_0x5088d2,_0xdebc2d){_0xdebc2d(null,path[_0xd561('0xe')](config[_0xd561('0xf')],_0xd561('0x10')));},'filename':function(_0x3b47bc,_0x3f4f35,_0x51ac82){_0x3f4f35['originalname']=_0x3f4f35[_0xd561('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x51ac82(null,util[_0xd561('0x12')]('%s-%s%s',path[_0xd561('0x13')](_0x3f4f35['originalname'],path[_0xd561('0x14')](_0x3f4f35[_0xd561('0x11')])),Date[_0xd561('0x15')](),path[_0xd561('0x14')](_0x3f4f35[_0xd561('0x11')])));}})});router[_0xd561('0x16')]('/',upload[_0xd561('0x17')](_0xd561('0x18')),controller[_0xd561('0x19')]);router[_0xd561('0x1a')](_0xd561('0xa'),auth['isAuthenticated'](),controller[_0xd561('0x1b')]);router[_0xd561('0x1c')]('/:id',auth[_0xd561('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dc98ec0..a8caf2a 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 _0x10a6=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x3ebb69,_0x3e612e){var _0x421e59=function(_0x5a8c66){while(--_0x5a8c66){_0x3ebb69['push'](_0x3ebb69['shift']());}};_0x421e59(++_0x3e612e);}(_0x10a6,0xd3));var _0x610a=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x10a6[_0x4b174a];return _0x3cd7bf;};'use strict';var Sequelize=require(_0x610a('0x0'));module[_0x610a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x610a('0x2')]},'original_duration':{'type':Sequelize[_0x610a('0x3')]},'original_sampleCount':{'type':Sequelize[_0x610a('0x4')]},'original_channelCount':{'type':Sequelize[_0x610a('0x5')]},'original_bitRate':{'type':Sequelize[_0x610a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x610a('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x610a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x610a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x610a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x610a('0x5')]}}; \ No newline at end of file +var _0x1b4a=['BIGINT','INTEGER','FLOAT','sequelize','exports','STRING','name'];(function(_0x3f4bef,_0x359a87){var _0x1989b7=function(_0xe0ffca){while(--_0xe0ffca){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0x1989b7(++_0x359a87);}(_0x1b4a,0x184));var _0xa1b4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1b4a[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xa1b4('0x0'));module[_0xa1b4('0x1')]={'name':{'type':Sequelize[_0xa1b4('0x2')],'unique':_0xa1b4('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa1b4('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xa1b4('0x2')]},'original_format':{'type':Sequelize[_0xa1b4('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xa1b4('0x4')]},'original_channelCount':{'type':Sequelize[_0xa1b4('0x5')]},'original_bitRate':{'type':Sequelize[_0xa1b4('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa1b4('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xa1b4('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xa1b4('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa1b4('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c4f115e..76d2083 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 _0x9afa=['merge','options','Sound','includeAll','include','findAll','rows','catch','params','fields','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sound\x20not\x20found','join','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','info','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Sounds','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','server/files/sounds/original','original_format','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','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','Content-Range','reject','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter'];(function(_0x63c085,_0x2abe7f){var _0x365687=function(_0x83a541){while(--_0x83a541){_0x63c085['push'](_0x63c085['shift']());}};_0x365687(++_0x2abe7f);}(_0x9afa,0x1af));var _0xa9af=function(_0x2f1355,_0xe7271e){_0x2f1355=_0x2f1355-0x0;var _0x19926f=_0x9afa[_0x2f1355];return _0x19926f;};'use strict';var pdf=require(_0xa9af('0x0'));var emlformat=require(_0xa9af('0x1'));var rimraf=require(_0xa9af('0x2'));var zipdir=require(_0xa9af('0x3'));var jsonpatch=require(_0xa9af('0x4'));var rp=require(_0xa9af('0x5'));var moment=require(_0xa9af('0x6'));var BPromise=require(_0xa9af('0x7'));var Mustache=require(_0xa9af('0x8'));var util=require(_0xa9af('0x9'));var path=require(_0xa9af('0xa'));var sox=require(_0xa9af('0xb'));var csv=require(_0xa9af('0xc'));var ejs=require(_0xa9af('0xd'));var fs=require('fs');var _=require(_0xa9af('0xe'));var squel=require(_0xa9af('0xf'));var crypto=require(_0xa9af('0x10'));var jsforce=require(_0xa9af('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xa9af('0xc'));var querystring=require(_0xa9af('0x12'));var Papa=require(_0xa9af('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa9af('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9af('0x15'))(_0xa9af('0x16'));var utils=require(_0xa9af('0x17'));var config=require('../../config/environment');var db=require(_0xa9af('0x18'))['db'];function respondWithStatusCode(_0x5e5504,_0x91633e){_0x91633e=_0x91633e||0xcc;return function(_0x3214a0){if(_0x3214a0){return _0x5e5504[_0xa9af('0x19')](_0x91633e);}return _0x5e5504['status'](_0x91633e)['end']();};}function respondWithResult(_0x3f15e0,_0x2135bf){_0x2135bf=_0x2135bf||0xc8;return function(_0x699919){if(_0x699919){return _0x3f15e0[_0xa9af('0x1a')](_0x2135bf)[_0xa9af('0x1b')](_0x699919);}};}function respondWithFilteredResult(_0x43d5c4,_0x5725d6){return function(_0x257c1a){if(_0x257c1a){var _0x28849d=_0x257c1a[_0xa9af('0x1c')],_0xa976ff=_0x5725d6['offset'],_0x107e07=_0x5725d6['offset']+_0x5725d6['limit'],_0x10d21d;if(_0x107e07>=_0x28849d){_0x107e07=_0x28849d;_0x10d21d=0xc8;}else{_0x10d21d=0xce;}_0x43d5c4[_0xa9af('0x1a')](_0x10d21d);return _0x43d5c4['set'](_0xa9af('0x1d'),_0xa976ff+'-'+_0x107e07+'/'+_0x28849d)['json'](_0x257c1a);}return null;};}function patchUpdates(_0x315234){return function(_0x463adb){try{jsonpatch['apply'](_0x463adb,_0x315234,!![]);}catch(_0x18d328){return BPromise[_0xa9af('0x1e')](_0x18d328);}return _0x463adb['save']();};}function saveUpdates(_0x5ab680,_0x32ce59){return function(_0x17bb4b){if(_0x17bb4b){return _0x17bb4b[_0xa9af('0x1f')](_0x5ab680)[_0xa9af('0x20')](function(_0x38be78){return _0x38be78;});}return null;};}function removeEntity(_0xf5a4a3,_0x14b679){return function(_0x510bf4){if(_0x510bf4){return _0x510bf4[_0xa9af('0x21')]()[_0xa9af('0x20')](function(){var _0x3863d8=_0x510bf4['get']({'plain':!![]});var _0x3b03d2='Sounds';return db['UserProfileResource'][_0xa9af('0x21')]({'where':{'type':_0x3b03d2,'resourceId':_0x3863d8['id']}})[_0xa9af('0x20')](function(){return _0x510bf4;});})[_0xa9af('0x20')](function(){_0xf5a4a3['status'](0xcc)[_0xa9af('0x22')]();});}};}function handleEntityNotFound(_0x94c9d5,_0x4060bf){return function(_0xa6cd14){if(!_0xa6cd14){_0x94c9d5[_0xa9af('0x19')](0x194);}return _0xa6cd14;};}function handleError(_0x5660b1,_0x5955e2){_0x5955e2=_0x5955e2||0x1f4;return function(_0x4033b0){logger['error'](_0x4033b0[_0xa9af('0x23')]);if(_0x4033b0[_0xa9af('0x24')]){delete _0x4033b0[_0xa9af('0x24')];}_0x5660b1[_0xa9af('0x1a')](_0x5955e2)['send'](_0x4033b0);};}exports['index']=function(_0x466294,_0x8ff53){var _0x3ab062={},_0x31d39d={},_0x4a8840={'count':0x0,'rows':[]};var _0x175cc2=_[_0xa9af('0x25')](db['Sound'][_0xa9af('0x26')],function(_0x396dfa){return{'name':_0x396dfa[_0xa9af('0x27')],'type':_0x396dfa[_0xa9af('0x28')][_0xa9af('0x29')]};});_0x31d39d[_0xa9af('0x2a')]=_[_0xa9af('0x25')](_0x175cc2,'name');_0x31d39d[_0xa9af('0x2b')]=_[_0xa9af('0x2c')](_0x466294['query']);_0x31d39d[_0xa9af('0x2d')]=_['intersection'](_0x31d39d['model'],_0x31d39d[_0xa9af('0x2b')]);_0x3ab062[_0xa9af('0x2e')]=_[_0xa9af('0x2f')](_0x31d39d[_0xa9af('0x2a')],qs['fields'](_0x466294[_0xa9af('0x2b')]['fields']));_0x3ab062[_0xa9af('0x2e')]=_0x3ab062[_0xa9af('0x2e')][_0xa9af('0x30')]?_0x3ab062['attributes']:_0x31d39d[_0xa9af('0x2a')];if(!_0x466294[_0xa9af('0x2b')][_0xa9af('0x31')](_0xa9af('0x32'))){_0x3ab062[_0xa9af('0x33')]=qs[_0xa9af('0x33')](_0x466294[_0xa9af('0x2b')][_0xa9af('0x33')]);_0x3ab062[_0xa9af('0x34')]=qs[_0xa9af('0x34')](_0x466294[_0xa9af('0x2b')][_0xa9af('0x34')]);}_0x3ab062[_0xa9af('0x35')]=qs[_0xa9af('0x36')](_0x466294['query'][_0xa9af('0x36')]);_0x3ab062[_0xa9af('0x37')]=qs['filters'](_['pick'](_0x466294[_0xa9af('0x2b')],_0x31d39d[_0xa9af('0x2d')]),_0x175cc2);if(_0x466294['query'][_0xa9af('0x38')]){_0x3ab062[_0xa9af('0x37')]=_['merge'](_0x3ab062['where'],{'$or':_[_0xa9af('0x25')](_0x175cc2,function(_0x1e5d2f){if(_0x1e5d2f['type']!=='VIRTUAL'){var _0x36e0ed={};_0x36e0ed[_0x1e5d2f[_0xa9af('0x24')]]={'$like':'%'+_0x466294[_0xa9af('0x2b')][_0xa9af('0x38')]+'%'};return _0x36e0ed;}})});}_0x3ab062=_[_0xa9af('0x39')]({},_0x3ab062,_0x466294[_0xa9af('0x3a')]);var _0x25611d={'where':_0x3ab062[_0xa9af('0x37')]};return db[_0xa9af('0x3b')][_0xa9af('0x1c')](_0x25611d)[_0xa9af('0x20')](function(_0xacf9d){_0x4a8840['count']=_0xacf9d;if(_0x466294[_0xa9af('0x2b')][_0xa9af('0x3c')]){_0x3ab062[_0xa9af('0x3d')]=[{'all':!![]}];}return db[_0xa9af('0x3b')][_0xa9af('0x3e')](_0x3ab062);})[_0xa9af('0x20')](function(_0x2b637f){_0x4a8840[_0xa9af('0x3f')]=_0x2b637f;return _0x4a8840;})[_0xa9af('0x20')](respondWithFilteredResult(_0x8ff53,_0x3ab062))[_0xa9af('0x40')](handleError(_0x8ff53,null));};exports['show']=function(_0x133118,_0x2db7cb){var _0x26b8a2={'raw':!![],'where':{'id':_0x133118[_0xa9af('0x41')]['id']}},_0x11b2ed={};_0x11b2ed['model']=_[_0xa9af('0x2c')](db[_0xa9af('0x3b')]['rawAttributes']);_0x11b2ed[_0xa9af('0x2b')]=_[_0xa9af('0x2c')](_0x133118[_0xa9af('0x2b')]);_0x11b2ed[_0xa9af('0x2d')]=_['intersection'](_0x11b2ed[_0xa9af('0x2a')],_0x11b2ed[_0xa9af('0x2b')]);_0x26b8a2[_0xa9af('0x2e')]=_['intersection'](_0x11b2ed[_0xa9af('0x2a')],qs[_0xa9af('0x42')](_0x133118[_0xa9af('0x2b')][_0xa9af('0x42')]));_0x26b8a2[_0xa9af('0x2e')]=_0x26b8a2['attributes'][_0xa9af('0x30')]?_0x26b8a2[_0xa9af('0x2e')]:_0x11b2ed[_0xa9af('0x2a')];if(_0x133118['query']['includeAll']){_0x26b8a2[_0xa9af('0x3d')]=[{'all':!![]}];}_0x26b8a2=_['merge']({},_0x26b8a2,_0x133118[_0xa9af('0x3a')]);return db[_0xa9af('0x3b')][_0xa9af('0x43')](_0x26b8a2)[_0xa9af('0x20')](handleEntityNotFound(_0x2db7cb,null))[_0xa9af('0x20')](respondWithResult(_0x2db7cb,null))[_0xa9af('0x40')](handleError(_0x2db7cb,null));};exports[_0xa9af('0x44')]=function(_0xedd5de,_0x48b610,_0x26e776){return db[_0xa9af('0x3b')]['find']({'where':{'id':_0xedd5de[_0xa9af('0x41')]['id']},'attributes':[_0xa9af('0x24'),_0xa9af('0x45'),_0xa9af('0x46')],'raw':!![]})[_0xa9af('0x20')](handleEntityNotFound(_0x48b610,null))[_0xa9af('0x20')](function(_0x1529a0){if(_0x1529a0){if(!fs[_0xa9af('0x47')](path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),_0x1529a0[_0xa9af('0x45')]+'.'+_0x1529a0[_0xa9af('0x46')]))){throw new db['Sequelize']['ValidationError'](_0xa9af('0x4a'));}return _0x48b610['download'](path[_0xa9af('0x4b')](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x1529a0[_0xa9af('0x45')],_0x1529a0[_0xa9af('0x46')])),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x1529a0[_0xa9af('0x24')],_0x1529a0['converted_format']));}return null;})['catch'](handleError(_0x48b610,null));};exports[_0xa9af('0x4e')]=function(_0x29bb65,_0x457fb5,_0x7b436b){var _0x28c548={'name':path['basename'](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x50')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x50')])),'save_name':path[_0xa9af('0x52')](_0x29bb65['file'][_0xa9af('0x53')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')])),'original_format':path['extname'](_0x29bb65[_0xa9af('0x4f')]['originalname'])[_0xa9af('0x54')](0x1),'converted_format':_0xa9af('0x55')};var _0x1288c1=path[_0xa9af('0x4b')](config[_0xa9af('0x48')],'server/files/sounds/original',_0x29bb65[_0xa9af('0x4f')]['filename']);var _0x1977a5=path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),path[_0xa9af('0x52')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')],path[_0xa9af('0x51')](_0x29bb65[_0xa9af('0x4f')][_0xa9af('0x53')])),_0x28c548[_0xa9af('0x46')]));logger[_0xa9af('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x1288c1);logger[_0xa9af('0x56')]('Sound\x20upload\x20destination:\x20%s',_0x1977a5);try{fs[_0xa9af('0x57')](_0x1288c1,parseInt(_0xa9af('0x58'),0x8));var _0x392a3f=sox[_0xa9af('0x59')](_0x1288c1,_0x1977a5,{'sampleRate':0x1f40,'format':_0xa9af('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x392a3f['on']('error',function(_0x2077a5){fs[_0xa9af('0x5a')](_0x1288c1);_0x457fb5[_0xa9af('0x1a')](0x1f4)[_0xa9af('0x5b')](_0x2077a5);});_0x392a3f['on'](_0xa9af('0x5c'),function(_0x515ff1){_0x28c548[_0xa9af('0x5d')]=isNaN(_0x515ff1[_0xa9af('0x5e')])?null:_0x515ff1['duration']*0x3e8;_0x28c548[_0xa9af('0x5f')]=isNaN(_0x515ff1[_0xa9af('0x60')])?null:_0x515ff1[_0xa9af('0x60')];_0x28c548['original_channelCount']=isNaN(_0x515ff1[_0xa9af('0x61')])?null:_0x515ff1[_0xa9af('0x61')];_0x28c548[_0xa9af('0x62')]=isNaN(_0x515ff1[_0xa9af('0x63')])?null:_0x515ff1['bitRate'];_0x28c548[_0xa9af('0x64')]=isNaN(_0x515ff1[_0xa9af('0x65')])?null:_0x515ff1[_0xa9af('0x65')];});_0x392a3f['on'](_0xa9af('0x66'),function(_0x1ff607){_0x28c548[_0xa9af('0x67')]=isNaN(_0x1ff607['duration'])?null:_0x1ff607[_0xa9af('0x5e')]*0x3e8;_0x28c548[_0xa9af('0x68')]=isNaN(_0x1ff607[_0xa9af('0x60')])?null:_0x1ff607[_0xa9af('0x60')];_0x28c548['converted_channelCount']=isNaN(_0x1ff607[_0xa9af('0x61')])?null:_0x1ff607['channelCount'];_0x28c548[_0xa9af('0x69')]=isNaN(_0x1ff607[_0xa9af('0x63')])?null:_0x1ff607[_0xa9af('0x63')];_0x28c548['converted_sampleRate']=isNaN(_0x1ff607[_0xa9af('0x65')])?null:_0x1ff607['sampleRate'];});_0x392a3f['on'](_0xa9af('0x22'),function(){fs['chmodSync'](_0x1977a5,parseInt('0777',0x8));return db[_0xa9af('0x3b')][_0xa9af('0x4e')](_0x28c548)[_0xa9af('0x20')](function(_0x3418c3){var _0x41ac1e={'role':_0x29bb65[_0xa9af('0x6a')][_0xa9af('0x6b')],'userProfileId':_0x29bb65['body']['userProfileId']};if(!_0x41ac1e)throw new Error(_0xa9af('0x6c'));if(_0x41ac1e[_0xa9af('0x6b')]===_0xa9af('0x6d')){var _0x6a38ea=_0x3418c3[_0xa9af('0x6e')]({'plain':!![]});return db['UserProfileSection'][_0xa9af('0x43')]({'where':{'name':_0xa9af('0x6f'),'userProfileId':_0x41ac1e[_0xa9af('0x70')]},'raw':!![]})[_0xa9af('0x20')](function(_0xf772dc){if(_0xf772dc&&_0xf772dc[_0xa9af('0x71')]===0x0){return db[_0xa9af('0x72')][_0xa9af('0x4e')]({'name':_0x6a38ea['name'],'resourceId':_0x6a38ea['id'],'type':_0xf772dc[_0xa9af('0x24')],'sectionId':_0xf772dc['id']},{})[_0xa9af('0x20')](function(){return _0x3418c3;});}else{return _0x3418c3;}})['catch'](function(_0x391101){logger['error'](_0xa9af('0x73'),_0x391101);throw _0x391101;});}return _0x3418c3;})['then'](respondWithResult(_0x457fb5,null))[_0xa9af('0x40')](handleError(_0x457fb5,null));});_0x392a3f[_0xa9af('0x74')]();}catch(_0x162873){_0x457fb5[_0xa9af('0x1a')](0x1f4)[_0xa9af('0x5b')](_0x162873);}};exports[_0xa9af('0x1f')]=function(_0x51929c,_0x5d01a7,_0x2b6a99){return db[_0xa9af('0x3b')]['find']({'where':{'id':_0x51929c[_0xa9af('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d01a7,null))[_0xa9af('0x20')](saveUpdates(_[_0xa9af('0x75')](_0x51929c[_0xa9af('0x6a')],[_0xa9af('0x24'),_0xa9af('0x76')]),null))['then'](respondWithResult(_0x5d01a7,null))[_0xa9af('0x40')](handleError(_0x5d01a7,null));};exports[_0xa9af('0x77')]=function(_0x1dfc9f,_0x49ec43,_0x137beb){return db['Sound'][_0xa9af('0x43')]({'where':{'id':_0x1dfc9f[_0xa9af('0x41')]['id']}})[_0xa9af('0x20')](function(_0x1ece6a){if(_0x1ece6a){return _0x1ece6a[_0xa9af('0x21')]();}})[_0xa9af('0x20')](function(_0x2f0864){var _0x20d4d8=path[_0xa9af('0x4b')](config[_0xa9af('0x48')],_0xa9af('0x78'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x2f0864[_0xa9af('0x45')],_0x2f0864[_0xa9af('0x79')]));var _0x46a85f=path['join'](config[_0xa9af('0x48')],_0xa9af('0x49'),util[_0xa9af('0x4c')](_0xa9af('0x4d'),_0x2f0864['save_name'],_0x2f0864['converted_format']));fs[_0xa9af('0x5a')](_0x20d4d8);fs[_0xa9af('0x5a')](_0x46a85f);return _0x2f0864;})[_0xa9af('0x20')](function(_0x210be1){if(_0x210be1){return _0x49ec43[_0xa9af('0x1a')](0xcc)[_0xa9af('0x22')]();}})['then'](handleEntityNotFound(_0x49ec43,null))[_0xa9af('0x40')](handleError(_0x49ec43,null));}; \ No newline at end of file +var _0x701e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','stack','name','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','error','send','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','user','UserProfileSection','find','userProfileId'];(function(_0x1ae995,_0x23e197){var _0x4fafce=function(_0x15b2ba){while(--_0x15b2ba){_0x1ae995['push'](_0x1ae995['shift']());}};_0x4fafce(++_0x23e197);}(_0x701e,0x1c9));var _0xe701=function(_0x42e071,_0x22d6fd){_0x42e071=_0x42e071-0x0;var _0x19aef9=_0x701e[_0x42e071];return _0x19aef9;};'use strict';var pdf=require(_0xe701('0x0'));var emlformat=require(_0xe701('0x1'));var rimraf=require(_0xe701('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe701('0x3'));var rp=require(_0xe701('0x4'));var moment=require(_0xe701('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe701('0x6'));var util=require(_0xe701('0x7'));var path=require(_0xe701('0x8'));var sox=require(_0xe701('0x9'));var csv=require(_0xe701('0xa'));var ejs=require(_0xe701('0xb'));var fs=require('fs');var _=require(_0xe701('0xc'));var squel=require(_0xe701('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe701('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe701('0xe'));var authService=require(_0xe701('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe701('0x10'));var logger=require(_0xe701('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe701('0x12'))['db'];function respondWithStatusCode(_0x23d194,_0x2ba794){_0x2ba794=_0x2ba794||0xcc;return function(_0xc70140){if(_0xc70140){return _0x23d194[_0xe701('0x13')](_0x2ba794);}return _0x23d194['status'](_0x2ba794)[_0xe701('0x14')]();};}function respondWithResult(_0x1c7cea,_0x5cd95b){_0x5cd95b=_0x5cd95b||0xc8;return function(_0x2e2626){if(_0x2e2626){return _0x1c7cea[_0xe701('0x15')](_0x5cd95b)[_0xe701('0x16')](_0x2e2626);}};}function respondWithFilteredResult(_0x2d8047,_0x1b2f09){return function(_0x9fba82){if(_0x9fba82){var _0x3581a1=_0x9fba82[_0xe701('0x17')],_0x2452ef=_0x1b2f09[_0xe701('0x18')],_0x475299=_0x1b2f09['offset']+_0x1b2f09[_0xe701('0x19')],_0x4ea08f;if(_0x475299>=_0x3581a1){_0x475299=_0x3581a1;_0x4ea08f=0xc8;}else{_0x4ea08f=0xce;}_0x2d8047[_0xe701('0x15')](_0x4ea08f);return _0x2d8047['set'](_0xe701('0x1a'),_0x2452ef+'-'+_0x475299+'/'+_0x3581a1)[_0xe701('0x16')](_0x9fba82);}return null;};}function patchUpdates(_0x597b75){return function(_0x397155){try{jsonpatch[_0xe701('0x1b')](_0x397155,_0x597b75,!![]);}catch(_0x3261ba){return BPromise[_0xe701('0x1c')](_0x3261ba);}return _0x397155[_0xe701('0x1d')]();};}function saveUpdates(_0x49ab78,_0x58f2dc){return function(_0x57458d){if(_0x57458d){return _0x57458d[_0xe701('0x1e')](_0x49ab78)[_0xe701('0x1f')](function(_0x3a506c){return _0x3a506c;});}return null;};}function removeEntity(_0x5f2ba9,_0x4a7cd5){return function(_0x41d7af){if(_0x41d7af){return _0x41d7af[_0xe701('0x20')]()[_0xe701('0x1f')](function(){var _0x32f3b9=_0x41d7af[_0xe701('0x21')]({'plain':!![]});var _0x4e2073=_0xe701('0x22');return db['UserProfileResource'][_0xe701('0x20')]({'where':{'type':_0x4e2073,'resourceId':_0x32f3b9['id']}})[_0xe701('0x1f')](function(){return _0x41d7af;});})[_0xe701('0x1f')](function(){_0x5f2ba9[_0xe701('0x15')](0xcc)[_0xe701('0x14')]();});}};}function handleEntityNotFound(_0x42b10d,_0x3102f2){return function(_0x484674){if(!_0x484674){_0x42b10d[_0xe701('0x13')](0x194);}return _0x484674;};}function handleError(_0x47c4bd,_0x34ae82){_0x34ae82=_0x34ae82||0x1f4;return function(_0x45bda9){logger['error'](_0x45bda9[_0xe701('0x23')]);if(_0x45bda9[_0xe701('0x24')]){delete _0x45bda9['name'];}_0x47c4bd[_0xe701('0x15')](_0x34ae82)['send'](_0x45bda9);};}exports['index']=function(_0x3d4d74,_0x4d19af){var _0x306cbe={},_0x2aa289={},_0x2f5fae={'count':0x0,'rows':[]};var _0x4b2566=_[_0xe701('0x25')](db[_0xe701('0x26')][_0xe701('0x27')],function(_0xe507e1){return{'name':_0xe507e1[_0xe701('0x28')],'type':_0xe507e1[_0xe701('0x29')][_0xe701('0x2a')]};});_0x2aa289[_0xe701('0x2b')]=_[_0xe701('0x25')](_0x4b2566,_0xe701('0x24'));_0x2aa289[_0xe701('0x2c')]=_['keys'](_0x3d4d74['query']);_0x2aa289[_0xe701('0x2d')]=_[_0xe701('0x2e')](_0x2aa289[_0xe701('0x2b')],_0x2aa289[_0xe701('0x2c')]);_0x306cbe[_0xe701('0x2f')]=_[_0xe701('0x2e')](_0x2aa289[_0xe701('0x2b')],qs[_0xe701('0x30')](_0x3d4d74['query'][_0xe701('0x30')]));_0x306cbe[_0xe701('0x2f')]=_0x306cbe['attributes'][_0xe701('0x31')]?_0x306cbe[_0xe701('0x2f')]:_0x2aa289[_0xe701('0x2b')];if(!_0x3d4d74[_0xe701('0x2c')][_0xe701('0x32')](_0xe701('0x33'))){_0x306cbe[_0xe701('0x19')]=qs[_0xe701('0x19')](_0x3d4d74[_0xe701('0x2c')][_0xe701('0x19')]);_0x306cbe[_0xe701('0x18')]=qs[_0xe701('0x18')](_0x3d4d74[_0xe701('0x2c')]['offset']);}_0x306cbe[_0xe701('0x34')]=qs['sort'](_0x3d4d74[_0xe701('0x2c')][_0xe701('0x35')]);_0x306cbe[_0xe701('0x36')]=qs[_0xe701('0x2d')](_[_0xe701('0x37')](_0x3d4d74[_0xe701('0x2c')],_0x2aa289[_0xe701('0x2d')]),_0x4b2566);if(_0x3d4d74[_0xe701('0x2c')][_0xe701('0x38')]){_0x306cbe[_0xe701('0x36')]=_[_0xe701('0x39')](_0x306cbe[_0xe701('0x36')],{'$or':_[_0xe701('0x25')](_0x4b2566,function(_0x3f9a40){if(_0x3f9a40[_0xe701('0x29')]!=='VIRTUAL'){var _0x3b3dac={};_0x3b3dac[_0x3f9a40[_0xe701('0x24')]]={'$like':'%'+_0x3d4d74['query'][_0xe701('0x38')]+'%'};return _0x3b3dac;}})});}_0x306cbe=_['merge']({},_0x306cbe,_0x3d4d74[_0xe701('0x3a')]);var _0x3ed3d7={'where':_0x306cbe[_0xe701('0x36')]};return db[_0xe701('0x26')][_0xe701('0x17')](_0x3ed3d7)['then'](function(_0xa3943b){_0x2f5fae['count']=_0xa3943b;if(_0x3d4d74[_0xe701('0x2c')][_0xe701('0x3b')]){_0x306cbe[_0xe701('0x3c')]=[{'all':!![]}];}return db[_0xe701('0x26')]['findAll'](_0x306cbe);})['then'](function(_0x5b0a8e){_0x2f5fae[_0xe701('0x3d')]=_0x5b0a8e;return _0x2f5fae;})[_0xe701('0x1f')](respondWithFilteredResult(_0x4d19af,_0x306cbe))[_0xe701('0x3e')](handleError(_0x4d19af,null));};exports[_0xe701('0x3f')]=function(_0x3e7dbc,_0x12fe64){var _0x348bc2={'raw':!![],'where':{'id':_0x3e7dbc[_0xe701('0x40')]['id']}},_0x1d4d57={};_0x1d4d57['model']=_[_0xe701('0x41')](db['Sound'][_0xe701('0x27')]);_0x1d4d57['query']=_['keys'](_0x3e7dbc[_0xe701('0x2c')]);_0x1d4d57[_0xe701('0x2d')]=_[_0xe701('0x2e')](_0x1d4d57['model'],_0x1d4d57[_0xe701('0x2c')]);_0x348bc2[_0xe701('0x2f')]=_[_0xe701('0x2e')](_0x1d4d57[_0xe701('0x2b')],qs[_0xe701('0x30')](_0x3e7dbc[_0xe701('0x2c')][_0xe701('0x30')]));_0x348bc2['attributes']=_0x348bc2[_0xe701('0x2f')][_0xe701('0x31')]?_0x348bc2['attributes']:_0x1d4d57[_0xe701('0x2b')];if(_0x3e7dbc[_0xe701('0x2c')][_0xe701('0x3b')]){_0x348bc2[_0xe701('0x3c')]=[{'all':!![]}];}_0x348bc2=_[_0xe701('0x39')]({},_0x348bc2,_0x3e7dbc[_0xe701('0x3a')]);return db[_0xe701('0x26')]['find'](_0x348bc2)[_0xe701('0x1f')](handleEntityNotFound(_0x12fe64,null))['then'](respondWithResult(_0x12fe64,null))['catch'](handleError(_0x12fe64,null));};exports[_0xe701('0x42')]=function(_0x4007fe,_0x1fb6bd,_0x118ad2){return db[_0xe701('0x26')]['find']({'where':{'id':_0x4007fe['params']['id']},'attributes':[_0xe701('0x24'),_0xe701('0x43'),_0xe701('0x44')],'raw':!![]})[_0xe701('0x1f')](handleEntityNotFound(_0x1fb6bd,null))[_0xe701('0x1f')](function(_0x1adbac){if(_0x1adbac){if(!fs[_0xe701('0x45')](path[_0xe701('0x46')](config[_0xe701('0x47')],_0xe701('0x48'),_0x1adbac[_0xe701('0x43')]+'.'+_0x1adbac['converted_format']))){throw new db['Sequelize']['ValidationError'](_0xe701('0x49'));}return _0x1fb6bd[_0xe701('0x42')](path[_0xe701('0x46')](config['root'],_0xe701('0x48'),util[_0xe701('0x4a')](_0xe701('0x4b'),_0x1adbac[_0xe701('0x43')],_0x1adbac[_0xe701('0x44')])),util[_0xe701('0x4a')](_0xe701('0x4b'),_0x1adbac['name'],_0x1adbac['converted_format']));}return null;})[_0xe701('0x3e')](handleError(_0x1fb6bd,null));};exports[_0xe701('0x4c')]=function(_0x4f560d,_0x487a0b,_0x33cc67){var _0x558627={'name':path[_0xe701('0x4d')](_0x4f560d[_0xe701('0x4e')][_0xe701('0x4f')],path[_0xe701('0x50')](_0x4f560d[_0xe701('0x4e')][_0xe701('0x4f')])),'save_name':path['basename'](_0x4f560d['file']['filename'],path[_0xe701('0x50')](_0x4f560d[_0xe701('0x4e')][_0xe701('0x51')])),'original_format':path[_0xe701('0x50')](_0x4f560d['file'][_0xe701('0x4f')])['substring'](0x1),'converted_format':_0xe701('0x52')};var _0x32b32b=path[_0xe701('0x46')](config[_0xe701('0x47')],_0xe701('0x53'),_0x4f560d[_0xe701('0x4e')][_0xe701('0x51')]);var _0x2f5164=path[_0xe701('0x46')](config[_0xe701('0x47')],'server/files/sounds/converted',util[_0xe701('0x4a')](_0xe701('0x4b'),path[_0xe701('0x4d')](_0x4f560d[_0xe701('0x4e')][_0xe701('0x51')],path[_0xe701('0x50')](_0x4f560d[_0xe701('0x4e')][_0xe701('0x51')])),_0x558627[_0xe701('0x44')]));logger[_0xe701('0x54')](_0xe701('0x55'),_0x32b32b);logger[_0xe701('0x54')]('Sound\x20upload\x20destination:\x20%s',_0x2f5164);try{fs['chmodSync'](_0x32b32b,parseInt(_0xe701('0x56'),0x8));var _0x104bb4=sox[_0xe701('0x57')](_0x32b32b,_0x2f5164,{'sampleRate':0x1f40,'format':_0xe701('0x52'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x104bb4['on'](_0xe701('0x58'),function(_0x40bed1){fs['unlinkSync'](_0x32b32b);_0x487a0b['status'](0x1f4)[_0xe701('0x59')](_0x40bed1);});_0x104bb4['on']('src',function(_0x46afac){_0x558627['original_duration']=isNaN(_0x46afac[_0xe701('0x5a')])?null:_0x46afac[_0xe701('0x5a')]*0x3e8;_0x558627['original_sampleCount']=isNaN(_0x46afac[_0xe701('0x5b')])?null:_0x46afac[_0xe701('0x5b')];_0x558627[_0xe701('0x5c')]=isNaN(_0x46afac['channelCount'])?null:_0x46afac[_0xe701('0x5d')];_0x558627[_0xe701('0x5e')]=isNaN(_0x46afac[_0xe701('0x5f')])?null:_0x46afac['bitRate'];_0x558627[_0xe701('0x60')]=isNaN(_0x46afac[_0xe701('0x61')])?null:_0x46afac[_0xe701('0x61')];});_0x104bb4['on']('dest',function(_0x1a4c55){_0x558627[_0xe701('0x62')]=isNaN(_0x1a4c55[_0xe701('0x5a')])?null:_0x1a4c55[_0xe701('0x5a')]*0x3e8;_0x558627[_0xe701('0x63')]=isNaN(_0x1a4c55[_0xe701('0x5b')])?null:_0x1a4c55['sampleCount'];_0x558627['converted_channelCount']=isNaN(_0x1a4c55[_0xe701('0x5d')])?null:_0x1a4c55[_0xe701('0x5d')];_0x558627[_0xe701('0x64')]=isNaN(_0x1a4c55[_0xe701('0x5f')])?null:_0x1a4c55[_0xe701('0x5f')];_0x558627[_0xe701('0x65')]=isNaN(_0x1a4c55[_0xe701('0x61')])?null:_0x1a4c55[_0xe701('0x61')];});_0x104bb4['on'](_0xe701('0x14'),function(){fs['chmodSync'](_0x2f5164,parseInt(_0xe701('0x56'),0x8));return db[_0xe701('0x26')][_0xe701('0x4c')](_0x558627)[_0xe701('0x1f')](function(_0x99cf95){var _0x2fef08={'role':_0x4f560d[_0xe701('0x66')][_0xe701('0x67')],'userProfileId':_0x4f560d[_0xe701('0x66')]['userProfileId']};if(!_0x2fef08)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fef08['role']===_0xe701('0x68')){var _0x1b3b36=_0x99cf95[_0xe701('0x21')]({'plain':!![]});return db[_0xe701('0x69')][_0xe701('0x6a')]({'where':{'name':_0xe701('0x22'),'userProfileId':_0x2fef08[_0xe701('0x6b')]},'raw':!![]})[_0xe701('0x1f')](function(_0x2f29da){if(_0x2f29da&&_0x2f29da['autoAssociation']===0x0){return db['UserProfileResource'][_0xe701('0x4c')]({'name':_0x1b3b36[_0xe701('0x24')],'resourceId':_0x1b3b36['id'],'type':_0x2f29da['name'],'sectionId':_0x2f29da['id']},{})[_0xe701('0x1f')](function(){return _0x99cf95;});}else{return _0x99cf95;}})[_0xe701('0x3e')](function(_0x534f1c){logger[_0xe701('0x58')](_0xe701('0x6c'),_0x534f1c);throw _0x534f1c;});}return _0x99cf95;})[_0xe701('0x1f')](respondWithResult(_0x487a0b,null))[_0xe701('0x3e')](handleError(_0x487a0b,null));});_0x104bb4['start']();}catch(_0x1dea83){_0x487a0b[_0xe701('0x15')](0x1f4)[_0xe701('0x59')](_0x1dea83);}};exports['update']=function(_0x15eb67,_0x43974c,_0xcd68be){return db[_0xe701('0x26')]['find']({'where':{'id':_0x15eb67['params']['id']}})[_0xe701('0x1f')](handleEntityNotFound(_0x43974c,null))['then'](saveUpdates(_[_0xe701('0x37')](_0x15eb67[_0xe701('0x66')],[_0xe701('0x24'),_0xe701('0x6d')]),null))[_0xe701('0x1f')](respondWithResult(_0x43974c,null))['catch'](handleError(_0x43974c,null));};exports[_0xe701('0x6e')]=function(_0x2a154f,_0xeda0f1,_0x29f3d6){return db[_0xe701('0x26')][_0xe701('0x6a')]({'where':{'id':_0x2a154f['params']['id']}})['then'](function(_0x39bfea){if(_0x39bfea){return _0x39bfea[_0xe701('0x20')]();}})[_0xe701('0x1f')](function(_0x58b6f8){var _0x24761d=path[_0xe701('0x46')](config['root'],_0xe701('0x53'),util[_0xe701('0x4a')](_0xe701('0x4b'),_0x58b6f8[_0xe701('0x43')],_0x58b6f8[_0xe701('0x6f')]));var _0x633b50=path[_0xe701('0x46')](config['root'],_0xe701('0x48'),util[_0xe701('0x4a')](_0xe701('0x4b'),_0x58b6f8[_0xe701('0x43')],_0x58b6f8[_0xe701('0x44')]));fs['unlinkSync'](_0x24761d);fs[_0xe701('0x70')](_0x633b50);return _0x58b6f8;})[_0xe701('0x1f')](function(_0x49fa04){if(_0x49fa04){return _0xeda0f1[_0xe701('0x15')](0xcc)['end']();}})[_0xe701('0x1f')](handleEntityNotFound(_0xeda0f1,null))[_0xe701('0x3e')](handleError(_0xeda0f1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 52a113b..68b5c89 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 _0x91ef=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0x91ef,0xad));var _0xf91e=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x91ef[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xf91e('0x0'));var util=require(_0xf91e('0x1'));var logger=require(_0xf91e('0x2'))(_0xf91e('0x3'));var moment=require(_0xf91e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf91e('0x5'));var fs=require('fs');var path=require(_0xf91e('0x6'));var rimraf=require(_0xf91e('0x7'));var config=require(_0xf91e('0x8'));var attributes=require(_0xf91e('0x9'));module[_0xf91e('0xa')]=function(_0x45a588,_0x234e3d){return _0x45a588['define'](_0xf91e('0xb'),attributes,{'tableName':_0xf91e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e66=['request-promise','path','rimraf','../../config/environment','define','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0xc02e00,_0x224bbe){var _0x542230=function(_0x39a0b8){while(--_0x39a0b8){_0xc02e00['push'](_0xc02e00['shift']());}};_0x542230(++_0x224bbe);}(_0x7e66,0x1df));var _0x67e6=function(_0x166fd7,_0x39b244){_0x166fd7=_0x166fd7-0x0;var _0x7a5914=_0x7e66[_0x166fd7];return _0x7a5914;};'use strict';var _=require(_0x67e6('0x0'));var util=require(_0x67e6('0x1'));var logger=require(_0x67e6('0x2'))(_0x67e6('0x3'));var moment=require(_0x67e6('0x4'));var BPromise=require('bluebird');var rp=require(_0x67e6('0x5'));var fs=require('fs');var path=require(_0x67e6('0x6'));var rimraf=require(_0x67e6('0x7'));var config=require(_0x67e6('0x8'));var attributes=require('./sound.attributes');module['exports']=function(_0x239076,_0x1189af){return _0x239076[_0x67e6('0x9')]('Sound',attributes,{'tableName':_0x67e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index c3e74e9..9b33671 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 _0x85aa=['Sound,\x20%s,\x20%s,\x20%s','error','code','Sound,\x20%s,\x20%s','message','result','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x379339,_0x1d10d9){var _0x3c59f7=function(_0x50298b){while(--_0x50298b){_0x379339['push'](_0x379339['shift']());}};_0x3c59f7(++_0x1d10d9);}(_0x85aa,0x1a4));var _0xa85a=function(_0x58a110,_0x3ded47){_0x58a110=_0x58a110-0x0;var _0x17e6a3=_0x85aa[_0x58a110];return _0x17e6a3;};'use strict';var _=require('lodash');var util=require(_0xa85a('0x0'));var moment=require(_0xa85a('0x1'));var BPromise=require(_0xa85a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa85a('0x3'))['db'];var utils=require(_0xa85a('0x4'));var logger=require(_0xa85a('0x5'))(_0xa85a('0x6'));var config=require(_0xa85a('0x7'));var jayson=require(_0xa85a('0x8'));var client=jayson[_0xa85a('0x9')][_0xa85a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9fb2,_0x246eb5,_0x404a48){return new BPromise(function(_0x3582f4,_0x1fac53){return client['request'](_0x2c9fb2,_0x404a48)[_0xa85a('0xb')](function(_0x149e79){logger['info']('Sound,\x20%s,\x20%s',_0x246eb5,_0xa85a('0xc'));logger[_0xa85a('0xd')](_0xa85a('0xe'),_0x246eb5,_0xa85a('0xc'),JSON['stringify'](_0x149e79));if(_0x149e79[_0xa85a('0xf')]){if(_0x149e79[_0xa85a('0xf')][_0xa85a('0x10')]===0x1f4){logger[_0xa85a('0xf')](_0xa85a('0x11'),_0x246eb5,_0x149e79[_0xa85a('0xf')]['message']);return _0x1fac53(_0x149e79[_0xa85a('0xf')][_0xa85a('0x12')]);}logger['error']('Sound,\x20%s,\x20%s',_0x246eb5,_0x149e79[_0xa85a('0xf')]['message']);return _0x3582f4(_0x149e79[_0xa85a('0xf')][_0xa85a('0x12')]);}else{logger['info'](_0xa85a('0x11'),_0x246eb5,_0xa85a('0xc'));_0x3582f4(_0x149e79[_0xa85a('0x13')][_0xa85a('0x12')]);}})['catch'](function(_0x13d1ec){logger['error'](_0xa85a('0x11'),_0x246eb5,_0x13d1ec);_0x1fac53(_0x13d1ec);});});}exports['ShowSound']=function(_0x7a3f13){var _0x2385d4=this;return new Promise(function(_0x27a311,_0x223414){return db[_0xa85a('0x14')][_0xa85a('0x15')]({'raw':_0x7a3f13['options']?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x17')]===undefined?!![]:![]:!![],'where':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x18')]||null:null,'attributes':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x19')]||null:null,'include':_0x7a3f13[_0xa85a('0x16')]?_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x7a3f13[_0xa85a('0x16')][_0xa85a('0x1a')],function(_0x5a97c6){return{'model':db[_0x5a97c6[_0xa85a('0x1c')]],'as':_0x5a97c6['as'],'attributes':_0x5a97c6[_0xa85a('0x19')],'include':_0x5a97c6[_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x5a97c6[_0xa85a('0x1a')],function(_0x5d28e2){return{'model':db[_0x5d28e2[_0xa85a('0x1c')]],'as':_0x5d28e2['as'],'attributes':_0x5d28e2[_0xa85a('0x19')],'include':_0x5d28e2[_0xa85a('0x1a')]?_[_0xa85a('0x1b')](_0x5d28e2[_0xa85a('0x1a')],function(_0x26d40b){return{'model':db[_0x26d40b['model']],'as':_0x26d40b['as'],'attributes':_0x26d40b[_0xa85a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa85a('0xb')](function(_0x443ad2){logger['info'](_0xa85a('0x1d'),_0x7a3f13);logger['debug'](_0xa85a('0x1d'),_0x7a3f13,JSON['stringify'](_0x443ad2));_0x27a311(_0x443ad2);})[_0xa85a('0x1e')](function(_0x1566ed){logger[_0xa85a('0xf')]('ShowSound',_0x1566ed[_0xa85a('0x12')],_0x7a3f13);_0x223414(_0x2385d4[_0xa85a('0xf')](0x1f4,_0x1566ed[_0xa85a('0x12')]));});});}; \ No newline at end of file +var _0xb484=['map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Sound','find','options','raw','where','attributes','include'];(function(_0x46da7c,_0x5f20f5){var _0x4b9d9c=function(_0x41c921){while(--_0x41c921){_0x46da7c['push'](_0x46da7c['shift']());}};_0x4b9d9c(++_0x5f20f5);}(_0xb484,0x1bd));var _0x4b48=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xb484[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x4b48('0x0'));var util=require(_0x4b48('0x1'));var moment=require(_0x4b48('0x2'));var BPromise=require(_0x4b48('0x3'));var rs=require(_0x4b48('0x4'));var fs=require('fs');var Redis=require(_0x4b48('0x5'));var db=require(_0x4b48('0x6'))['db'];var utils=require(_0x4b48('0x7'));var logger=require('../../config/logger')(_0x4b48('0x8'));var config=require(_0x4b48('0x9'));var jayson=require(_0x4b48('0xa'));var client=jayson['client'][_0x4b48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2e84,_0x551424,_0x2bf515){return new BPromise(function(_0x48f9c0,_0x181e6c){return client['request'](_0x5d2e84,_0x2bf515)[_0x4b48('0xc')](function(_0x2018dd){logger['info'](_0x4b48('0xd'),_0x551424,_0x4b48('0xe'));logger[_0x4b48('0xf')](_0x4b48('0x10'),_0x551424,_0x4b48('0xe'),JSON[_0x4b48('0x11')](_0x2018dd));if(_0x2018dd[_0x4b48('0x12')]){if(_0x2018dd[_0x4b48('0x12')][_0x4b48('0x13')]===0x1f4){logger[_0x4b48('0x12')](_0x4b48('0xd'),_0x551424,_0x2018dd[_0x4b48('0x12')][_0x4b48('0x14')]);return _0x181e6c(_0x2018dd['error'][_0x4b48('0x14')]);}logger[_0x4b48('0x12')](_0x4b48('0xd'),_0x551424,_0x2018dd['error'][_0x4b48('0x14')]);return _0x48f9c0(_0x2018dd[_0x4b48('0x12')][_0x4b48('0x14')]);}else{logger[_0x4b48('0x15')](_0x4b48('0xd'),_0x551424,_0x4b48('0xe'));_0x48f9c0(_0x2018dd[_0x4b48('0x16')]['message']);}})[_0x4b48('0x17')](function(_0x2746d0){logger[_0x4b48('0x12')](_0x4b48('0xd'),_0x551424,_0x2746d0);_0x181e6c(_0x2746d0);});});}exports['ShowSound']=function(_0x44e46f){var _0x59a10d=this;return new Promise(function(_0x326a34,_0x383509){return db[_0x4b48('0x18')][_0x4b48('0x19')]({'raw':_0x44e46f[_0x4b48('0x1a')]?_0x44e46f[_0x4b48('0x1a')][_0x4b48('0x1b')]===undefined?!![]:![]:!![],'where':_0x44e46f[_0x4b48('0x1a')]?_0x44e46f[_0x4b48('0x1a')][_0x4b48('0x1c')]||null:null,'attributes':_0x44e46f[_0x4b48('0x1a')]?_0x44e46f[_0x4b48('0x1a')][_0x4b48('0x1d')]||null:null,'include':_0x44e46f['options']?_0x44e46f[_0x4b48('0x1a')][_0x4b48('0x1e')]?_[_0x4b48('0x1f')](_0x44e46f[_0x4b48('0x1a')][_0x4b48('0x1e')],function(_0x51dbb2){return{'model':db[_0x51dbb2[_0x4b48('0x20')]],'as':_0x51dbb2['as'],'attributes':_0x51dbb2[_0x4b48('0x1d')],'include':_0x51dbb2[_0x4b48('0x1e')]?_[_0x4b48('0x1f')](_0x51dbb2['include'],function(_0x2b5409){return{'model':db[_0x2b5409['model']],'as':_0x2b5409['as'],'attributes':_0x2b5409[_0x4b48('0x1d')],'include':_0x2b5409[_0x4b48('0x1e')]?_['map'](_0x2b5409['include'],function(_0x377147){return{'model':db[_0x377147[_0x4b48('0x20')]],'as':_0x377147['as'],'attributes':_0x377147[_0x4b48('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26509a){logger[_0x4b48('0x15')](_0x4b48('0x21'),_0x44e46f);logger[_0x4b48('0xf')](_0x4b48('0x21'),_0x44e46f,JSON[_0x4b48('0x11')](_0x26509a));_0x326a34(_0x26509a);})[_0x4b48('0x17')](function(_0x3ef9b7){logger[_0x4b48('0x12')]('ShowSound',_0x3ef9b7[_0x4b48('0x14')],_0x44e46f);_0x383509(_0x59a10d['error'](0x1f4,_0x3ef9b7[_0x4b48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 74dc5db..829c4bc 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 _0x3e7c=['/:id','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./squareMessage.controller','get'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x3e7c,0xd7));var _0xc3e7=function(_0x38b3fa,_0x5cd964){_0x38b3fa=_0x38b3fa-0x0;var _0x3a3e6c=_0x3e7c[_0x38b3fa];return _0x3a3e6c;};'use strict';var multer=require(_0xc3e7('0x0'));var util=require(_0xc3e7('0x1'));var path=require(_0xc3e7('0x2'));var timeout=require(_0xc3e7('0x3'));var express=require(_0xc3e7('0x4'));var router=express['Router']();var auth=require(_0xc3e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3e7('0x6'));var controller=require(_0xc3e7('0x7'));router[_0xc3e7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc3e7('0x8')](_0xc3e7('0x9'),auth[_0xc3e7('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc3e7('0xb')]);router[_0xc3e7('0xc')](_0xc3e7('0x9'),auth[_0xc3e7('0xa')](),controller[_0xc3e7('0xd')]);router[_0xc3e7('0xe')]('/:id',auth[_0xc3e7('0xa')](),controller[_0xc3e7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd570=['util','express','Router','../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','show','post','create','put','update','/:id','destroy','exports'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xd570,0x195));var _0x0d57=function(_0x1c5a5b,_0x2a1a22){_0x1c5a5b=_0x1c5a5b-0x0;var _0x342669=_0xd570[_0x1c5a5b];return _0x342669;};'use strict';var multer=require('multer');var util=require(_0x0d57('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d57('0x1'));var router=express[_0x0d57('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d57('0x3'));var config=require('../../config/environment');var controller=require(_0x0d57('0x4'));router[_0x0d57('0x5')]('/',auth[_0x0d57('0x6')](),controller['index']);router[_0x0d57('0x5')]('/:id',auth[_0x0d57('0x6')](),controller[_0x0d57('0x7')]);router[_0x0d57('0x8')]('/',auth[_0x0d57('0x6')](),controller[_0x0d57('0x9')]);router[_0x0d57('0xa')]('/:id',auth[_0x0d57('0x6')](),controller[_0x0d57('0xb')]);router['delete'](_0x0d57('0xc'),auth[_0x0d57('0x6')](),controller[_0x0d57('0xd')]);module[_0x0d57('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e64cb87..32e169c 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 _0xe25a=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x19f9c2,_0x21e3b7){var _0x18d844=function(_0x188c18){while(--_0x188c18){_0x19f9c2['push'](_0x19f9c2['shift']());}};_0x18d844(++_0x21e3b7);}(_0xe25a,0xe3));var _0xae25=function(_0x530eaf,_0x1c4804){_0x530eaf=_0x530eaf-0x0;var _0x265278=_0xe25a[_0x530eaf];return _0x265278;};'use strict';var Sequelize=require(_0xae25('0x0'));module[_0xae25('0x1')]={'uniqueid':{'type':Sequelize[_0xae25('0x2')]},'body':{'type':Sequelize[_0xae25('0x3')](_0xae25('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xae25('0x5')]('in',_0xae25('0x6')),'defaultValue':_0xae25('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x14f5=['STRING','medium','ENUM','out','sequelize','exports'];(function(_0x30a863,_0x11ada2){var _0x5e9fed=function(_0x4002b4){while(--_0x4002b4){_0x30a863['push'](_0x30a863['shift']());}};_0x5e9fed(++_0x11ada2);}(_0x14f5,0xbe));var _0x514f=function(_0xf230c7,_0x50fb7c){_0xf230c7=_0xf230c7-0x0;var _0x5a47f6=_0x14f5[_0xf230c7];return _0x5a47f6;};'use strict';var Sequelize=require(_0x514f('0x0'));module[_0x514f('0x1')]={'uniqueid':{'type':Sequelize[_0x514f('0x2')]},'body':{'type':Sequelize['TEXT'](_0x514f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x514f('0x4')]('in',_0x514f('0x5')),'defaultValue':_0x514f('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2e4e0cd..2b85781 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 _0x48a2=['options','includeAll','findAll','rows','params','include','find','create','body','catch','update','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x4e699b,_0xe01ae){var _0x142235=function(_0x5abe5e){while(--_0x5abe5e){_0x4e699b['push'](_0x4e699b['shift']());}};_0x142235(++_0xe01ae);}(_0x48a2,0x9d));var _0x248a=function(_0x3a0633,_0x120c59){_0x3a0633=_0x3a0633-0x0;var _0x58341e=_0x48a2[_0x3a0633];return _0x58341e;};'use strict';var pdf=require(_0x248a('0x0'));var emlformat=require(_0x248a('0x1'));var rimraf=require(_0x248a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x248a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x248a('0x4'));var Mustache=require(_0x248a('0x5'));var util=require('util');var path=require(_0x248a('0x6'));var sox=require('sox');var csv=require(_0x248a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x248a('0x8'));var squel=require(_0x248a('0x9'));var crypto=require('crypto');var jsforce=require(_0x248a('0xa'));var deskjs=require(_0x248a('0xb'));var toCsv=require(_0x248a('0x7'));var querystring=require(_0x248a('0xc'));var Papa=require(_0x248a('0xd'));var Redis=require(_0x248a('0xe'));var authService=require(_0x248a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x248a('0x10'));var hardwareService=require(_0x248a('0x11'));var logger=require(_0x248a('0x12'))(_0x248a('0x13'));var utils=require('../../config/utils');var config=require(_0x248a('0x14'));var db=require(_0x248a('0x15'))['db'];function respondWithStatusCode(_0xdffb2f,_0x21e482){_0x21e482=_0x21e482||0xcc;return function(_0x229694){if(_0x229694){return _0xdffb2f[_0x248a('0x16')](_0x21e482);}return _0xdffb2f[_0x248a('0x17')](_0x21e482)['end']();};}function respondWithResult(_0x2ce936,_0x17b1e6){_0x17b1e6=_0x17b1e6||0xc8;return function(_0x564e36){if(_0x564e36){return _0x2ce936['status'](_0x17b1e6)[_0x248a('0x18')](_0x564e36);}};}function respondWithFilteredResult(_0x4cdef9,_0x5c69bb){return function(_0xf88b43){if(_0xf88b43){var _0x26b391=_0xf88b43[_0x248a('0x19')],_0x1e9046=_0x5c69bb[_0x248a('0x1a')],_0x143d0f=_0x5c69bb[_0x248a('0x1a')]+_0x5c69bb['limit'],_0x16b038;if(_0x143d0f>=_0x26b391){_0x143d0f=_0x26b391;_0x16b038=0xc8;}else{_0x16b038=0xce;}_0x4cdef9[_0x248a('0x17')](_0x16b038);return _0x4cdef9['set'](_0x248a('0x1b'),_0x1e9046+'-'+_0x143d0f+'/'+_0x26b391)['json'](_0xf88b43);}return null;};}function patchUpdates(_0x26e4a6){return function(_0x180b6f){try{jsonpatch[_0x248a('0x1c')](_0x180b6f,_0x26e4a6,!![]);}catch(_0xc3d73d){return BPromise[_0x248a('0x1d')](_0xc3d73d);}return _0x180b6f[_0x248a('0x1e')]();};}function saveUpdates(_0x213eeb,_0x587622){return function(_0x62729c){if(_0x62729c){return _0x62729c['update'](_0x213eeb)[_0x248a('0x1f')](function(_0x1c135a){return _0x1c135a;});}return null;};}function removeEntity(_0x3f5038,_0x3eb56f){return function(_0x2a8b8a){if(_0x2a8b8a){return _0x2a8b8a[_0x248a('0x20')]()['then'](function(){_0x3f5038['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49749e,_0x24062e){return function(_0x4904e9){if(!_0x4904e9){_0x49749e[_0x248a('0x16')](0x194);}return _0x4904e9;};}function handleError(_0x4de000,_0x42ff3f){_0x42ff3f=_0x42ff3f||0x1f4;return function(_0x3080f0){logger[_0x248a('0x21')](_0x3080f0[_0x248a('0x22')]);if(_0x3080f0[_0x248a('0x23')]){delete _0x3080f0[_0x248a('0x23')];}_0x4de000['status'](_0x42ff3f)[_0x248a('0x24')](_0x3080f0);};}exports[_0x248a('0x25')]=function(_0x1627d3,_0x2c6e7e){var _0x1ee10b={},_0xc7d940={},_0x3f3f13={'count':0x0,'rows':[]};var _0x439136=_[_0x248a('0x26')](db[_0x248a('0x27')][_0x248a('0x28')],function(_0x25097d){return{'name':_0x25097d[_0x248a('0x29')],'type':_0x25097d[_0x248a('0x2a')][_0x248a('0x2b')]};});_0xc7d940[_0x248a('0x2c')]=_[_0x248a('0x26')](_0x439136,_0x248a('0x23'));_0xc7d940['query']=_[_0x248a('0x2d')](_0x1627d3[_0x248a('0x2e')]);_0xc7d940[_0x248a('0x2f')]=_[_0x248a('0x30')](_0xc7d940[_0x248a('0x2c')],_0xc7d940[_0x248a('0x2e')]);_0x1ee10b['attributes']=_[_0x248a('0x30')](_0xc7d940[_0x248a('0x2c')],qs[_0x248a('0x31')](_0x1627d3[_0x248a('0x2e')][_0x248a('0x31')]));_0x1ee10b[_0x248a('0x32')]=_0x1ee10b[_0x248a('0x32')][_0x248a('0x33')]?_0x1ee10b['attributes']:_0xc7d940[_0x248a('0x2c')];if(!_0x1627d3['query'][_0x248a('0x34')](_0x248a('0x35'))){_0x1ee10b[_0x248a('0x36')]=qs[_0x248a('0x36')](_0x1627d3[_0x248a('0x2e')][_0x248a('0x36')]);_0x1ee10b[_0x248a('0x1a')]=qs[_0x248a('0x1a')](_0x1627d3[_0x248a('0x2e')]['offset']);}_0x1ee10b[_0x248a('0x37')]=qs[_0x248a('0x38')](_0x1627d3[_0x248a('0x2e')]['sort']);_0x1ee10b[_0x248a('0x39')]=qs[_0x248a('0x2f')](_[_0x248a('0x3a')](_0x1627d3[_0x248a('0x2e')],_0xc7d940[_0x248a('0x2f')]),_0x439136);if(_0x1627d3[_0x248a('0x2e')]['filter']){_0x1ee10b[_0x248a('0x39')]=_['merge'](_0x1ee10b[_0x248a('0x39')],{'$or':_[_0x248a('0x26')](_0x439136,function(_0x58d405){if(_0x58d405[_0x248a('0x2a')]!==_0x248a('0x3b')){var _0x30218f={};_0x30218f[_0x58d405['name']]={'$like':'%'+_0x1627d3[_0x248a('0x2e')][_0x248a('0x3c')]+'%'};return _0x30218f;}})});}_0x1ee10b=_[_0x248a('0x3d')]({},_0x1ee10b,_0x1627d3[_0x248a('0x3e')]);var _0x3400d3={'where':_0x1ee10b[_0x248a('0x39')]};return db[_0x248a('0x27')][_0x248a('0x19')](_0x3400d3)[_0x248a('0x1f')](function(_0x22bfda){_0x3f3f13['count']=_0x22bfda;if(_0x1627d3[_0x248a('0x2e')][_0x248a('0x3f')]){_0x1ee10b['include']=[{'all':!![]}];}return db[_0x248a('0x27')][_0x248a('0x40')](_0x1ee10b);})[_0x248a('0x1f')](function(_0x51cc55){_0x3f3f13[_0x248a('0x41')]=_0x51cc55;return _0x3f3f13;})['then'](respondWithFilteredResult(_0x2c6e7e,_0x1ee10b))['catch'](handleError(_0x2c6e7e,null));};exports['show']=function(_0x2297da,_0x542751){var _0x2d788a={'raw':!![],'where':{'id':_0x2297da[_0x248a('0x42')]['id']}},_0x19700d={};_0x19700d['model']=_[_0x248a('0x2d')](db[_0x248a('0x27')]['rawAttributes']);_0x19700d[_0x248a('0x2e')]=_[_0x248a('0x2d')](_0x2297da[_0x248a('0x2e')]);_0x19700d[_0x248a('0x2f')]=_['intersection'](_0x19700d[_0x248a('0x2c')],_0x19700d[_0x248a('0x2e')]);_0x2d788a[_0x248a('0x32')]=_[_0x248a('0x30')](_0x19700d['model'],qs[_0x248a('0x31')](_0x2297da['query'][_0x248a('0x31')]));_0x2d788a[_0x248a('0x32')]=_0x2d788a[_0x248a('0x32')][_0x248a('0x33')]?_0x2d788a[_0x248a('0x32')]:_0x19700d['model'];if(_0x2297da['query'][_0x248a('0x3f')]){_0x2d788a[_0x248a('0x43')]=[{'all':!![]}];}_0x2d788a=_['merge']({},_0x2d788a,_0x2297da[_0x248a('0x3e')]);return db['SquareMessage'][_0x248a('0x44')](_0x2d788a)[_0x248a('0x1f')](handleEntityNotFound(_0x542751,null))['then'](respondWithResult(_0x542751,null))['catch'](handleError(_0x542751,null));};exports['create']=function(_0x3ba545,_0x234b42){return db['SquareMessage'][_0x248a('0x45')](_0x3ba545[_0x248a('0x46')],{})[_0x248a('0x1f')](respondWithResult(_0x234b42,0xc9))[_0x248a('0x47')](handleError(_0x234b42,null));};exports[_0x248a('0x48')]=function(_0x18aa6b,_0x7aa53b){if(_0x18aa6b[_0x248a('0x46')]['id']){delete _0x18aa6b[_0x248a('0x46')]['id'];}return db[_0x248a('0x27')][_0x248a('0x44')]({'where':{'id':_0x18aa6b[_0x248a('0x42')]['id']}})['then'](handleEntityNotFound(_0x7aa53b,null))[_0x248a('0x1f')](saveUpdates(_0x18aa6b['body'],null))['then'](respondWithResult(_0x7aa53b,null))[_0x248a('0x47')](handleError(_0x7aa53b,null));};exports['destroy']=function(_0x4fac99,_0x2b2ea7){return db[_0x248a('0x27')][_0x248a('0x44')]({'where':{'id':_0x4fac99[_0x248a('0x42')]['id']}})[_0x248a('0x1f')](handleEntityNotFound(_0x2b2ea7,null))[_0x248a('0x1f')](removeEntity(_0x2b2ea7,null))[_0x248a('0x47')](handleError(_0x2b2ea7,null));}; \ No newline at end of file +var _0xc684=['sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','html-pdf','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','SquareMessage','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xc684,0xf2));var _0x4c68=function(_0x181ffb,_0x4d45ba){_0x181ffb=_0x181ffb-0x0;var _0x435045=_0xc684[_0x181ffb];return _0x435045;};'use strict';var pdf=require(_0x4c68('0x0'));var emlformat=require(_0x4c68('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c68('0x3'));var moment=require(_0x4c68('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4c68('0x5'));var sox=require(_0x4c68('0x6'));var csv=require(_0x4c68('0x7'));var ejs=require(_0x4c68('0x8'));var fs=require('fs');var _=require(_0x4c68('0x9'));var squel=require(_0x4c68('0xa'));var crypto=require(_0x4c68('0xb'));var jsforce=require(_0x4c68('0xc'));var deskjs=require(_0x4c68('0xd'));var toCsv=require(_0x4c68('0x7'));var querystring=require(_0x4c68('0xe'));var Papa=require('papaparse');var Redis=require(_0x4c68('0xf'));var authService=require(_0x4c68('0x10'));var qs=require(_0x4c68('0x11'));var as=require(_0x4c68('0x12'));var hardwareService=require(_0x4c68('0x13'));var logger=require('../../config/logger')(_0x4c68('0x14'));var utils=require(_0x4c68('0x15'));var config=require(_0x4c68('0x16'));var db=require(_0x4c68('0x17'))['db'];function respondWithStatusCode(_0x42f464,_0x329d8a){_0x329d8a=_0x329d8a||0xcc;return function(_0x369b58){if(_0x369b58){return _0x42f464[_0x4c68('0x18')](_0x329d8a);}return _0x42f464[_0x4c68('0x19')](_0x329d8a)[_0x4c68('0x1a')]();};}function respondWithResult(_0x29aeff,_0x2d781c){_0x2d781c=_0x2d781c||0xc8;return function(_0x28a59b){if(_0x28a59b){return _0x29aeff[_0x4c68('0x19')](_0x2d781c)['json'](_0x28a59b);}};}function respondWithFilteredResult(_0x148f47,_0x4c2bb7){return function(_0xbe2518){if(_0xbe2518){var _0x3bdcdb=_0xbe2518[_0x4c68('0x1b')],_0x2c04ee=_0x4c2bb7['offset'],_0x3d2c21=_0x4c2bb7['offset']+_0x4c2bb7[_0x4c68('0x1c')],_0x1d875e;if(_0x3d2c21>=_0x3bdcdb){_0x3d2c21=_0x3bdcdb;_0x1d875e=0xc8;}else{_0x1d875e=0xce;}_0x148f47[_0x4c68('0x19')](_0x1d875e);return _0x148f47[_0x4c68('0x1d')]('Content-Range',_0x2c04ee+'-'+_0x3d2c21+'/'+_0x3bdcdb)['json'](_0xbe2518);}return null;};}function patchUpdates(_0x47bee1){return function(_0x5b919e){try{jsonpatch[_0x4c68('0x1e')](_0x5b919e,_0x47bee1,!![]);}catch(_0x4f279a){return BPromise[_0x4c68('0x1f')](_0x4f279a);}return _0x5b919e[_0x4c68('0x20')]();};}function saveUpdates(_0x46de09,_0x298a1f){return function(_0x5b3a3e){if(_0x5b3a3e){return _0x5b3a3e[_0x4c68('0x21')](_0x46de09)[_0x4c68('0x22')](function(_0x11ee15){return _0x11ee15;});}return null;};}function removeEntity(_0xc56299,_0x2bd14e){return function(_0x24f14b){if(_0x24f14b){return _0x24f14b[_0x4c68('0x23')]()[_0x4c68('0x22')](function(){_0xc56299['status'](0xcc)[_0x4c68('0x1a')]();});}};}function handleEntityNotFound(_0x3c272c,_0x4f73ea){return function(_0x3c1ac3){if(!_0x3c1ac3){_0x3c272c[_0x4c68('0x18')](0x194);}return _0x3c1ac3;};}function handleError(_0x36b1d9,_0x64c3a4){_0x64c3a4=_0x64c3a4||0x1f4;return function(_0x5ac426){logger[_0x4c68('0x24')](_0x5ac426[_0x4c68('0x25')]);if(_0x5ac426[_0x4c68('0x26')]){delete _0x5ac426['name'];}_0x36b1d9['status'](_0x64c3a4)['send'](_0x5ac426);};}exports[_0x4c68('0x27')]=function(_0x1adecb,_0x5d863c){var _0x378dd9={},_0x4f1c73={},_0x4ac0c9={'count':0x0,'rows':[]};var _0x11c587=_['map'](db[_0x4c68('0x28')][_0x4c68('0x29')],function(_0x4781e0){return{'name':_0x4781e0[_0x4c68('0x2a')],'type':_0x4781e0['type'][_0x4c68('0x2b')]};});_0x4f1c73[_0x4c68('0x2c')]=_['map'](_0x11c587,'name');_0x4f1c73['query']=_['keys'](_0x1adecb[_0x4c68('0x2d')]);_0x4f1c73[_0x4c68('0x2e')]=_[_0x4c68('0x2f')](_0x4f1c73[_0x4c68('0x2c')],_0x4f1c73[_0x4c68('0x2d')]);_0x378dd9[_0x4c68('0x30')]=_[_0x4c68('0x2f')](_0x4f1c73[_0x4c68('0x2c')],qs[_0x4c68('0x31')](_0x1adecb[_0x4c68('0x2d')][_0x4c68('0x31')]));_0x378dd9['attributes']=_0x378dd9['attributes'][_0x4c68('0x32')]?_0x378dd9[_0x4c68('0x30')]:_0x4f1c73[_0x4c68('0x2c')];if(!_0x1adecb[_0x4c68('0x2d')][_0x4c68('0x33')](_0x4c68('0x34'))){_0x378dd9[_0x4c68('0x1c')]=qs[_0x4c68('0x1c')](_0x1adecb[_0x4c68('0x2d')]['limit']);_0x378dd9[_0x4c68('0x35')]=qs[_0x4c68('0x35')](_0x1adecb[_0x4c68('0x2d')]['offset']);}_0x378dd9['order']=qs['sort'](_0x1adecb['query'][_0x4c68('0x36')]);_0x378dd9[_0x4c68('0x37')]=qs[_0x4c68('0x2e')](_[_0x4c68('0x38')](_0x1adecb[_0x4c68('0x2d')],_0x4f1c73[_0x4c68('0x2e')]),_0x11c587);if(_0x1adecb[_0x4c68('0x2d')]['filter']){_0x378dd9[_0x4c68('0x37')]=_[_0x4c68('0x39')](_0x378dd9[_0x4c68('0x37')],{'$or':_[_0x4c68('0x3a')](_0x11c587,function(_0x1a9d3d){if(_0x1a9d3d[_0x4c68('0x3b')]!==_0x4c68('0x3c')){var _0x132243={};_0x132243[_0x1a9d3d[_0x4c68('0x26')]]={'$like':'%'+_0x1adecb[_0x4c68('0x2d')][_0x4c68('0x3d')]+'%'};return _0x132243;}})});}_0x378dd9=_[_0x4c68('0x39')]({},_0x378dd9,_0x1adecb[_0x4c68('0x3e')]);var _0x382d28={'where':_0x378dd9[_0x4c68('0x37')]};return db['SquareMessage'][_0x4c68('0x1b')](_0x382d28)[_0x4c68('0x22')](function(_0x504058){_0x4ac0c9[_0x4c68('0x1b')]=_0x504058;if(_0x1adecb['query'][_0x4c68('0x3f')]){_0x378dd9[_0x4c68('0x40')]=[{'all':!![]}];}return db[_0x4c68('0x28')][_0x4c68('0x41')](_0x378dd9);})[_0x4c68('0x22')](function(_0x197b98){_0x4ac0c9[_0x4c68('0x42')]=_0x197b98;return _0x4ac0c9;})[_0x4c68('0x22')](respondWithFilteredResult(_0x5d863c,_0x378dd9))[_0x4c68('0x43')](handleError(_0x5d863c,null));};exports[_0x4c68('0x44')]=function(_0x407cf9,_0x228364){var _0x4dd63d={'raw':!![],'where':{'id':_0x407cf9['params']['id']}},_0x152b6a={};_0x152b6a[_0x4c68('0x2c')]=_[_0x4c68('0x45')](db[_0x4c68('0x28')][_0x4c68('0x29')]);_0x152b6a[_0x4c68('0x2d')]=_['keys'](_0x407cf9['query']);_0x152b6a['filters']=_[_0x4c68('0x2f')](_0x152b6a[_0x4c68('0x2c')],_0x152b6a[_0x4c68('0x2d')]);_0x4dd63d[_0x4c68('0x30')]=_[_0x4c68('0x2f')](_0x152b6a[_0x4c68('0x2c')],qs[_0x4c68('0x31')](_0x407cf9[_0x4c68('0x2d')][_0x4c68('0x31')]));_0x4dd63d[_0x4c68('0x30')]=_0x4dd63d[_0x4c68('0x30')][_0x4c68('0x32')]?_0x4dd63d[_0x4c68('0x30')]:_0x152b6a[_0x4c68('0x2c')];if(_0x407cf9[_0x4c68('0x2d')][_0x4c68('0x3f')]){_0x4dd63d['include']=[{'all':!![]}];}_0x4dd63d=_['merge']({},_0x4dd63d,_0x407cf9[_0x4c68('0x3e')]);return db['SquareMessage'][_0x4c68('0x46')](_0x4dd63d)[_0x4c68('0x22')](handleEntityNotFound(_0x228364,null))['then'](respondWithResult(_0x228364,null))[_0x4c68('0x43')](handleError(_0x228364,null));};exports[_0x4c68('0x47')]=function(_0x26309e,_0x6fc5e9){return db[_0x4c68('0x28')][_0x4c68('0x47')](_0x26309e['body'],{})[_0x4c68('0x22')](respondWithResult(_0x6fc5e9,0xc9))[_0x4c68('0x43')](handleError(_0x6fc5e9,null));};exports['update']=function(_0x332a5c,_0x469e03){if(_0x332a5c[_0x4c68('0x48')]['id']){delete _0x332a5c[_0x4c68('0x48')]['id'];}return db[_0x4c68('0x28')][_0x4c68('0x46')]({'where':{'id':_0x332a5c[_0x4c68('0x49')]['id']}})[_0x4c68('0x22')](handleEntityNotFound(_0x469e03,null))[_0x4c68('0x22')](saveUpdates(_0x332a5c[_0x4c68('0x48')],null))[_0x4c68('0x22')](respondWithResult(_0x469e03,null))[_0x4c68('0x43')](handleError(_0x469e03,null));};exports[_0x4c68('0x23')]=function(_0x252339,_0x1d225d){return db[_0x4c68('0x28')][_0x4c68('0x46')]({'where':{'id':_0x252339['params']['id']}})[_0x4c68('0x22')](handleEntityNotFound(_0x1d225d,null))['then'](removeEntity(_0x1d225d,null))[_0x4c68('0x43')](handleError(_0x1d225d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 4f1c5f1..aadf972 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util'];(function(_0x2326d8,_0x75fba0){var _0x2cd15d=function(_0x26b2c1){while(--_0x26b2c1){_0x2326d8['push'](_0x2326d8['shift']());}};_0x2cd15d(++_0x75fba0);}(_0x7a54,0x106));var _0x47a5=function(_0x56df43,_0x5bd103){_0x56df43=_0x56df43-0x0;var _0x1b4b74=_0x7a54[_0x56df43];return _0x1b4b74;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2156a5,_0x58c233){var _0x5daaf4=function(_0x2cf82d){while(--_0x2cf82d){_0x2156a5['push'](_0x2156a5['shift']());}};_0x5daaf4(++_0x58c233);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x37e185,_0x3d15ad){_0x37e185=_0x37e185-0x0;var _0xb38709=_0x9c5a[_0x37e185];return _0xb38709;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./squareMessage.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','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 b3edc06..91d3de0 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 _0x8c46=['options','raw','debug','stringify','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateSquareMessage','SquareMessage','create','body'];(function(_0x58de16,_0x520cab){var _0x4813c7=function(_0x5273f1){while(--_0x5273f1){_0x58de16['push'](_0x58de16['shift']());}};_0x4813c7(++_0x520cab);}(_0x8c46,0x171));var _0x68c4=function(_0x2f2dba,_0x451d2e){_0x2f2dba=_0x2f2dba-0x0;var _0x27e85e=_0x8c46[_0x2f2dba];return _0x27e85e;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68c4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68c4('0x2'))['db'];var utils=require(_0x68c4('0x3'));var logger=require(_0x68c4('0x4'))(_0x68c4('0x5'));var config=require(_0x68c4('0x6'));var jayson=require(_0x68c4('0x7'));var client=jayson[_0x68c4('0x8')][_0x68c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da9c3,_0x458a2b,_0x5e57ce){return new BPromise(function(_0x1754d7,_0x1d40a3){return client[_0x68c4('0xa')](_0x3da9c3,_0x5e57ce)['then'](function(_0x356698){logger[_0x68c4('0xb')](_0x68c4('0xc'),_0x458a2b,'request\x20sent');logger['debug'](_0x68c4('0xd'),_0x458a2b,_0x68c4('0xe'),JSON['stringify'](_0x356698));if(_0x356698['error']){if(_0x356698[_0x68c4('0xf')][_0x68c4('0x10')]===0x1f4){logger[_0x68c4('0xf')]('SquareMessage,\x20%s,\x20%s',_0x458a2b,_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);return _0x1d40a3(_0x356698[_0x68c4('0xf')]['message']);}logger[_0x68c4('0xf')](_0x68c4('0xc'),_0x458a2b,_0x356698[_0x68c4('0xf')]['message']);return _0x1754d7(_0x356698[_0x68c4('0xf')][_0x68c4('0x11')]);}else{logger['info'](_0x68c4('0xc'),_0x458a2b,'request\x20sent');_0x1754d7(_0x356698[_0x68c4('0x12')]['message']);}})['catch'](function(_0xc2ea2f){logger[_0x68c4('0xf')]('SquareMessage,\x20%s,\x20%s',_0x458a2b,_0xc2ea2f);_0x1d40a3(_0xc2ea2f);});});}exports[_0x68c4('0x13')]=function(_0x1d757c){var _0x38ac38=this;return new Promise(function(_0x33c5c5,_0x3a6300){return db[_0x68c4('0x14')][_0x68c4('0x15')](_0x1d757c[_0x68c4('0x16')],{'raw':_0x1d757c[_0x68c4('0x17')]?_0x1d757c[_0x68c4('0x17')][_0x68c4('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x398a71){logger['info']('CreateSquareMessage',_0x1d757c);logger[_0x68c4('0x19')](_0x68c4('0x13'),_0x1d757c,JSON[_0x68c4('0x1a')](_0x398a71));_0x33c5c5(_0x398a71);})[_0x68c4('0x1b')](function(_0x5b8135){logger[_0x68c4('0xf')](_0x68c4('0x13'),_0x5b8135['message'],_0x1d757c);_0x3a6300(_0x38ac38[_0x68c4('0xf')](0x1f4,_0x5b8135[_0x68c4('0x11')]));});});}; \ No newline at end of file +var _0x5fc3=['catch','CreateSquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result'];(function(_0x2ee59a,_0x162eff){var _0x4235dd=function(_0x5f1235){while(--_0x5f1235){_0x2ee59a['push'](_0x2ee59a['shift']());}};_0x4235dd(++_0x162eff);}(_0x5fc3,0xa8));var _0x35fc=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x5fc3[_0x130d82];return _0x112070;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareMessage,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareMessage'][_0x35fc('0x17')](_0x553677[_0x35fc('0x18')],{'raw':_0x553677[_0x35fc('0x19')]?_0x553677['options'][_0x35fc('0x1a')]===undefined?!![]:![]:!![]})[_0x35fc('0xb')](function(_0x3229d1){logger[_0x35fc('0xc')](_0x35fc('0x16'),_0x553677);logger[_0x35fc('0xe')](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x3229d1));_0x363e47(_0x3229d1);})[_0x35fc('0x15')](function(_0x427eae){logger['error'](_0x35fc('0x16'),_0x427eae[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x427eae[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0a96c9b..135ef4c 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 _0xec09=['isAuthenticated','show','/:id/test','15s','post','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xec09,0x172));var _0x9ec0=function(_0x4fa9c4,_0x1b73e){_0x4fa9c4=_0x4fa9c4-0x0;var _0x2a9a56=_0xec09[_0x4fa9c4];return _0x2a9a56;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ec0('0x0'));var timeout=require(_0x9ec0('0x1'));var express=require(_0x9ec0('0x2'));var router=express[_0x9ec0('0x3')]();var auth=require(_0x9ec0('0x4'));var interaction=require(_0x9ec0('0x5'));var config=require(_0x9ec0('0x6'));var controller=require(_0x9ec0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ec0('0x8')]);router[_0x9ec0('0x9')]('/:id',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0xb')]);router[_0x9ec0('0x9')](_0x9ec0('0xc'),auth[_0x9ec0('0xa')](),timeout(_0x9ec0('0xd')),controller['test']);router[_0x9ec0('0xe')]('/',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0xf')]);router['put']('/:id',auth[_0x9ec0('0xa')](),controller['update']);router[_0x9ec0('0x10')]('/:id',auth[_0x9ec0('0xa')](),controller[_0x9ec0('0x11')]);module[_0x9ec0('0x12')]=router; \ No newline at end of file +var _0xad36=['index','get','/:id','15s','test','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated'];(function(_0x3c6b20,_0x315702){var _0x5d6849=function(_0x1ebcf7){while(--_0x1ebcf7){_0x3c6b20['push'](_0x3c6b20['shift']());}};_0x5d6849(++_0x315702);}(_0xad36,0x11c));var _0x6ad3=function(_0x52fe25,_0xab5587){_0x52fe25=_0x52fe25-0x0;var _0x1cfb5a=_0xad36[_0x52fe25];return _0x1cfb5a;};'use strict';var multer=require('multer');var util=require(_0x6ad3('0x0'));var path=require(_0x6ad3('0x1'));var timeout=require(_0x6ad3('0x2'));var express=require(_0x6ad3('0x3'));var router=express[_0x6ad3('0x4')]();var auth=require(_0x6ad3('0x5'));var interaction=require(_0x6ad3('0x6'));var config=require(_0x6ad3('0x7'));var controller=require(_0x6ad3('0x8'));router['get']('/',auth[_0x6ad3('0x9')](),controller[_0x6ad3('0xa')]);router[_0x6ad3('0xb')](_0x6ad3('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/test',auth[_0x6ad3('0x9')](),timeout(_0x6ad3('0xd')),controller[_0x6ad3('0xe')]);router[_0x6ad3('0xf')]('/',auth[_0x6ad3('0x9')](),controller[_0x6ad3('0x10')]);router[_0x6ad3('0x11')](_0x6ad3('0xc'),auth[_0x6ad3('0x9')](),controller['update']);router[_0x6ad3('0x12')](_0x6ad3('0xc'),auth[_0x6ad3('0x9')](),controller[_0x6ad3('0x13')]);module[_0x6ad3('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b4e0228..d788f87 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 _0xdf9a=['STRING','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdf9a,0x10d));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xadf9('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0xadf9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf25=['exports','STRING','name','sequelize'];(function(_0xf89c5d,_0x325ebc){var _0x503aa7=function(_0x4a9627){while(--_0x4a9627){_0xf89c5d['push'](_0xf89c5d['shift']());}};_0x503aa7(++_0x325ebc);}(_0xdf25,0x1db));var _0x5df2=function(_0x3c1d5b,_0xecd477){_0x3c1d5b=_0x3c1d5b-0x0;var _0x249fff=_0xdf25[_0x3c1d5b];return _0x249fff;};'use strict';var Sequelize=require(_0x5df2('0x0'));module[_0x5df2('0x1')]={'name':{'type':Sequelize[_0x5df2('0x2')],'unique':_0x5df2('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5df2('0x2')]},'description':{'type':Sequelize[_0x5df2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 86d5f4b..268f18c 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 _0xeb27=['order','sort','where','filters','pick','filter','VIRTUAL','options','SquareOdbc','count','includeAll','include','findAll','rows','show','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','dsn','odbc','openSync','closeSync','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xeb27,0x1e3));var _0x7eb2=function(_0x36212f,_0x170734){_0x36212f=_0x36212f-0x0;var _0x103882=_0xeb27[_0x36212f];return _0x103882;};'use strict';var pdf=require(_0x7eb2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7eb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eb2('0x2'));var rp=require(_0x7eb2('0x3'));var moment=require(_0x7eb2('0x4'));var BPromise=require(_0x7eb2('0x5'));var Mustache=require(_0x7eb2('0x6'));var util=require(_0x7eb2('0x7'));var path=require(_0x7eb2('0x8'));var sox=require('sox');var csv=require(_0x7eb2('0x9'));var ejs=require(_0x7eb2('0xa'));var fs=require('fs');var _=require(_0x7eb2('0xb'));var squel=require(_0x7eb2('0xc'));var crypto=require(_0x7eb2('0xd'));var jsforce=require(_0x7eb2('0xe'));var deskjs=require(_0x7eb2('0xf'));var toCsv=require(_0x7eb2('0x9'));var querystring=require(_0x7eb2('0x10'));var Papa=require(_0x7eb2('0x11'));var Redis=require(_0x7eb2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7eb2('0x13'));var hardwareService=require(_0x7eb2('0x14'));var logger=require(_0x7eb2('0x15'))('api');var utils=require(_0x7eb2('0x16'));var config=require(_0x7eb2('0x17'));var db=require(_0x7eb2('0x18'))['db'];function respondWithStatusCode(_0x5c9464,_0x224cb6){_0x224cb6=_0x224cb6||0xcc;return function(_0x4adc7e){if(_0x4adc7e){return _0x5c9464[_0x7eb2('0x19')](_0x224cb6);}return _0x5c9464[_0x7eb2('0x1a')](_0x224cb6)[_0x7eb2('0x1b')]();};}function respondWithResult(_0x3c0808,_0x2e9137){_0x2e9137=_0x2e9137||0xc8;return function(_0x56c9cb){if(_0x56c9cb){return _0x3c0808[_0x7eb2('0x1a')](_0x2e9137)['json'](_0x56c9cb);}};}function respondWithFilteredResult(_0x523ca8,_0x12f19d){return function(_0x4d6250){if(_0x4d6250){var _0x494b17=_0x4d6250['count'],_0x56a72f=_0x12f19d[_0x7eb2('0x1c')],_0x59a640=_0x12f19d['offset']+_0x12f19d[_0x7eb2('0x1d')],_0x1d3acf;if(_0x59a640>=_0x494b17){_0x59a640=_0x494b17;_0x1d3acf=0xc8;}else{_0x1d3acf=0xce;}_0x523ca8[_0x7eb2('0x1a')](_0x1d3acf);return _0x523ca8[_0x7eb2('0x1e')](_0x7eb2('0x1f'),_0x56a72f+'-'+_0x59a640+'/'+_0x494b17)['json'](_0x4d6250);}return null;};}function patchUpdates(_0x2cd8e3){return function(_0x13785a){try{jsonpatch[_0x7eb2('0x20')](_0x13785a,_0x2cd8e3,!![]);}catch(_0x496ed5){return BPromise[_0x7eb2('0x21')](_0x496ed5);}return _0x13785a[_0x7eb2('0x22')]();};}function saveUpdates(_0x325d3a,_0x837e46){return function(_0xe1d533){if(_0xe1d533){return _0xe1d533[_0x7eb2('0x23')](_0x325d3a)[_0x7eb2('0x24')](function(_0x30824a){return _0x30824a;});}return null;};}function removeEntity(_0x519552,_0x9719ad){return function(_0x3660cc){if(_0x3660cc){return _0x3660cc[_0x7eb2('0x25')]()[_0x7eb2('0x24')](function(){var _0x138aec=_0x3660cc[_0x7eb2('0x26')]({'plain':!![]});var _0x41dec5=_0x7eb2('0x27');return db['UserProfileResource'][_0x7eb2('0x25')]({'where':{'type':_0x41dec5,'resourceId':_0x138aec['id']}})[_0x7eb2('0x24')](function(){return _0x3660cc;});})[_0x7eb2('0x24')](function(){_0x519552[_0x7eb2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2353c3,_0x23b11c){return function(_0x103238){if(!_0x103238){_0x2353c3[_0x7eb2('0x19')](0x194);}return _0x103238;};}function handleError(_0x29f61c,_0x2b3f7c){_0x2b3f7c=_0x2b3f7c||0x1f4;return function(_0x3fd58b){logger[_0x7eb2('0x28')](_0x3fd58b[_0x7eb2('0x29')]);if(_0x3fd58b[_0x7eb2('0x2a')]){delete _0x3fd58b[_0x7eb2('0x2a')];}_0x29f61c[_0x7eb2('0x1a')](_0x2b3f7c)[_0x7eb2('0x2b')](_0x3fd58b);};}exports[_0x7eb2('0x2c')]=function(_0x2c9f86,_0x3624a2){var _0x4a5400={},_0x2848c6={},_0x3bee99={'count':0x0,'rows':[]};var _0x3f8bce=_[_0x7eb2('0x2d')](db['SquareOdbc'][_0x7eb2('0x2e')],function(_0x446857){return{'name':_0x446857[_0x7eb2('0x2f')],'type':_0x446857[_0x7eb2('0x30')]['key']};});_0x2848c6[_0x7eb2('0x31')]=_[_0x7eb2('0x2d')](_0x3f8bce,_0x7eb2('0x2a'));_0x2848c6[_0x7eb2('0x32')]=_[_0x7eb2('0x33')](_0x2c9f86[_0x7eb2('0x32')]);_0x2848c6['filters']=_[_0x7eb2('0x34')](_0x2848c6[_0x7eb2('0x31')],_0x2848c6[_0x7eb2('0x32')]);_0x4a5400['attributes']=_['intersection'](_0x2848c6[_0x7eb2('0x31')],qs[_0x7eb2('0x35')](_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x35')]));_0x4a5400['attributes']=_0x4a5400[_0x7eb2('0x36')][_0x7eb2('0x37')]?_0x4a5400[_0x7eb2('0x36')]:_0x2848c6[_0x7eb2('0x31')];if(!_0x2c9f86[_0x7eb2('0x32')]['hasOwnProperty'](_0x7eb2('0x38'))){_0x4a5400[_0x7eb2('0x1d')]=qs[_0x7eb2('0x1d')](_0x2c9f86[_0x7eb2('0x32')]['limit']);_0x4a5400['offset']=qs[_0x7eb2('0x1c')](_0x2c9f86['query'][_0x7eb2('0x1c')]);}_0x4a5400[_0x7eb2('0x39')]=qs[_0x7eb2('0x3a')](_0x2c9f86['query'][_0x7eb2('0x3a')]);_0x4a5400[_0x7eb2('0x3b')]=qs[_0x7eb2('0x3c')](_[_0x7eb2('0x3d')](_0x2c9f86[_0x7eb2('0x32')],_0x2848c6[_0x7eb2('0x3c')]),_0x3f8bce);if(_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x3e')]){_0x4a5400[_0x7eb2('0x3b')]=_['merge'](_0x4a5400[_0x7eb2('0x3b')],{'$or':_['map'](_0x3f8bce,function(_0x4cff8f){if(_0x4cff8f[_0x7eb2('0x30')]!==_0x7eb2('0x3f')){var _0x145ea2={};_0x145ea2[_0x4cff8f[_0x7eb2('0x2a')]]={'$like':'%'+_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x3e')]+'%'};return _0x145ea2;}})});}_0x4a5400=_['merge']({},_0x4a5400,_0x2c9f86[_0x7eb2('0x40')]);var _0x2b8349={'where':_0x4a5400[_0x7eb2('0x3b')]};return db[_0x7eb2('0x41')][_0x7eb2('0x42')](_0x2b8349)[_0x7eb2('0x24')](function(_0x590fa8){_0x3bee99['count']=_0x590fa8;if(_0x2c9f86[_0x7eb2('0x32')][_0x7eb2('0x43')]){_0x4a5400[_0x7eb2('0x44')]=[{'all':!![]}];}return db[_0x7eb2('0x41')][_0x7eb2('0x45')](_0x4a5400);})[_0x7eb2('0x24')](function(_0x2cc246){_0x3bee99[_0x7eb2('0x46')]=_0x2cc246;return _0x3bee99;})['then'](respondWithFilteredResult(_0x3624a2,_0x4a5400))['catch'](handleError(_0x3624a2,null));};exports[_0x7eb2('0x47')]=function(_0x38922b,_0x296a69){var _0x511295={'raw':!![],'where':{'id':_0x38922b['params']['id']}},_0x5cd4a0={};_0x5cd4a0[_0x7eb2('0x31')]=_[_0x7eb2('0x33')](db[_0x7eb2('0x41')]['rawAttributes']);_0x5cd4a0[_0x7eb2('0x32')]=_[_0x7eb2('0x33')](_0x38922b[_0x7eb2('0x32')]);_0x5cd4a0[_0x7eb2('0x3c')]=_[_0x7eb2('0x34')](_0x5cd4a0['model'],_0x5cd4a0[_0x7eb2('0x32')]);_0x511295['attributes']=_[_0x7eb2('0x34')](_0x5cd4a0[_0x7eb2('0x31')],qs[_0x7eb2('0x35')](_0x38922b[_0x7eb2('0x32')]['fields']));_0x511295[_0x7eb2('0x36')]=_0x511295[_0x7eb2('0x36')][_0x7eb2('0x37')]?_0x511295[_0x7eb2('0x36')]:_0x5cd4a0[_0x7eb2('0x31')];if(_0x38922b[_0x7eb2('0x32')][_0x7eb2('0x43')]){_0x511295[_0x7eb2('0x44')]=[{'all':!![]}];}_0x511295=_[_0x7eb2('0x48')]({},_0x511295,_0x38922b[_0x7eb2('0x40')]);return db[_0x7eb2('0x41')]['find'](_0x511295)[_0x7eb2('0x24')](handleEntityNotFound(_0x296a69,null))[_0x7eb2('0x24')](respondWithResult(_0x296a69,null))['catch'](handleError(_0x296a69,null));};exports[_0x7eb2('0x49')]=function(_0x2835c4,_0xdbdb8e){return db[_0x7eb2('0x41')][_0x7eb2('0x49')](_0x2835c4[_0x7eb2('0x4a')],{})[_0x7eb2('0x24')](function(_0x964c0e){var _0x7995b2=_0x2835c4[_0x7eb2('0x4b')][_0x7eb2('0x26')]({'plain':!![]});if(!_0x7995b2)throw new Error(_0x7eb2('0x4c'));if(_0x7995b2[_0x7eb2('0x4d')]===_0x7eb2('0x4b')){var _0x1bb62f=_0x964c0e[_0x7eb2('0x26')]({'plain':!![]});var _0x534aed=_0x7eb2('0x27');return db[_0x7eb2('0x4e')]['find']({'where':{'name':_0x534aed,'userProfileId':_0x7995b2[_0x7eb2('0x4f')]},'raw':!![]})[_0x7eb2('0x24')](function(_0x38e278){if(_0x38e278&&_0x38e278[_0x7eb2('0x50')]===0x0){return db[_0x7eb2('0x51')]['create']({'name':_0x1bb62f[_0x7eb2('0x2a')],'resourceId':_0x1bb62f['id'],'type':_0x38e278[_0x7eb2('0x2a')],'sectionId':_0x38e278['id']},{})[_0x7eb2('0x24')](function(){return _0x964c0e;});}else{return _0x964c0e;}})[_0x7eb2('0x52')](function(_0x51e38f){logger['error'](_0x7eb2('0x53'),_0x51e38f);throw _0x51e38f;});}return _0x964c0e;})['then'](respondWithResult(_0xdbdb8e,0xc9))[_0x7eb2('0x52')](handleError(_0xdbdb8e,null));};exports[_0x7eb2('0x23')]=function(_0x3b59c2,_0x477db3){if(_0x3b59c2['body']['id']){delete _0x3b59c2[_0x7eb2('0x4a')]['id'];}return db[_0x7eb2('0x41')][_0x7eb2('0x54')]({'where':{'id':_0x3b59c2[_0x7eb2('0x55')]['id']}})[_0x7eb2('0x24')](handleEntityNotFound(_0x477db3,null))[_0x7eb2('0x24')](saveUpdates(_0x3b59c2[_0x7eb2('0x4a')],null))['then'](respondWithResult(_0x477db3,null))[_0x7eb2('0x52')](handleError(_0x477db3,null));};exports[_0x7eb2('0x25')]=function(_0x4e0e5f,_0x5ccc8c){return db['SquareOdbc'][_0x7eb2('0x54')]({'where':{'id':_0x4e0e5f['params']['id']}})[_0x7eb2('0x24')](handleEntityNotFound(_0x5ccc8c,null))[_0x7eb2('0x24')](removeEntity(_0x5ccc8c,null))[_0x7eb2('0x52')](handleError(_0x5ccc8c,null));};exports['test']=function(_0x127ef7,_0x4502ad,_0x2e6ded){var _0x3129ad;return db[_0x7eb2('0x41')][_0x7eb2('0x54')]({'where':{'id':_0x127ef7['params']['id']},'attributes':['id',_0x7eb2('0x56')]})['then'](handleEntityNotFound(_0x4502ad,null))[_0x7eb2('0x24')](function(_0x450d02){if(_0x450d02){var _0x444671=require(_0x7eb2('0x57'))();_0x444671[_0x7eb2('0x58')](_0x450d02[_0x7eb2('0x56')]);_0x444671[_0x7eb2('0x59')]();return _0x450d02;}})[_0x7eb2('0x24')](respondWithResult(_0x4502ad,null))[_0x7eb2('0x52')](handleError(_0x4502ad,null));}; \ No newline at end of file +var _0x4696=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','openSync','closeSync','html-pdf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key'];(function(_0x5788fa,_0x3fc23c){var _0x368824=function(_0x5edde2){while(--_0x5edde2){_0x5788fa['push'](_0x5788fa['shift']());}};_0x368824(++_0x3fc23c);}(_0x4696,0x7c));var _0x6469=function(_0x53a3a2,_0x4df293){_0x53a3a2=_0x53a3a2-0x0;var _0x4496a8=_0x4696[_0x53a3a2];return _0x4496a8;};'use strict';var pdf=require(_0x6469('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6469('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6469('0x2'));var moment=require(_0x6469('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6469('0x4'));var path=require(_0x6469('0x5'));var sox=require(_0x6469('0x6'));var csv=require(_0x6469('0x7'));var ejs=require(_0x6469('0x8'));var fs=require('fs');var _=require(_0x6469('0x9'));var squel=require(_0x6469('0xa'));var crypto=require(_0x6469('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6469('0x7'));var querystring=require(_0x6469('0xc'));var Papa=require(_0x6469('0xd'));var Redis=require(_0x6469('0xe'));var authService=require(_0x6469('0xf'));var qs=require(_0x6469('0x10'));var as=require(_0x6469('0x11'));var hardwareService=require(_0x6469('0x12'));var logger=require('../../config/logger')(_0x6469('0x13'));var utils=require(_0x6469('0x14'));var config=require(_0x6469('0x15'));var db=require(_0x6469('0x16'))['db'];function respondWithStatusCode(_0x29e8d8,_0x53dfba){_0x53dfba=_0x53dfba||0xcc;return function(_0x3e8d39){if(_0x3e8d39){return _0x29e8d8['sendStatus'](_0x53dfba);}return _0x29e8d8[_0x6469('0x17')](_0x53dfba)['end']();};}function respondWithResult(_0x1fc4f7,_0x3dc656){_0x3dc656=_0x3dc656||0xc8;return function(_0xe0914){if(_0xe0914){return _0x1fc4f7[_0x6469('0x17')](_0x3dc656)[_0x6469('0x18')](_0xe0914);}};}function respondWithFilteredResult(_0x1709f9,_0x16e726){return function(_0x15d0fe){if(_0x15d0fe){var _0x37917e=_0x15d0fe[_0x6469('0x19')],_0x5afc9e=_0x16e726['offset'],_0x4a8986=_0x16e726['offset']+_0x16e726[_0x6469('0x1a')],_0x5549a4;if(_0x4a8986>=_0x37917e){_0x4a8986=_0x37917e;_0x5549a4=0xc8;}else{_0x5549a4=0xce;}_0x1709f9[_0x6469('0x17')](_0x5549a4);return _0x1709f9[_0x6469('0x1b')](_0x6469('0x1c'),_0x5afc9e+'-'+_0x4a8986+'/'+_0x37917e)[_0x6469('0x18')](_0x15d0fe);}return null;};}function patchUpdates(_0x8dd13c){return function(_0x347587){try{jsonpatch[_0x6469('0x1d')](_0x347587,_0x8dd13c,!![]);}catch(_0x3d8d80){return BPromise[_0x6469('0x1e')](_0x3d8d80);}return _0x347587[_0x6469('0x1f')]();};}function saveUpdates(_0x55ea27,_0x15dff3){return function(_0x70d011){if(_0x70d011){return _0x70d011[_0x6469('0x20')](_0x55ea27)['then'](function(_0x52fc89){return _0x52fc89;});}return null;};}function removeEntity(_0x2920f5,_0x5af44e){return function(_0x557b88){if(_0x557b88){return _0x557b88[_0x6469('0x21')]()['then'](function(){var _0x3f0b4c=_0x557b88[_0x6469('0x22')]({'plain':!![]});var _0x519d8f='ODBC';return db[_0x6469('0x23')][_0x6469('0x21')]({'where':{'type':_0x519d8f,'resourceId':_0x3f0b4c['id']}})[_0x6469('0x24')](function(){return _0x557b88;});})[_0x6469('0x24')](function(){_0x2920f5[_0x6469('0x17')](0xcc)[_0x6469('0x25')]();});}};}function handleEntityNotFound(_0x4570fb,_0x45dac8){return function(_0x79764d){if(!_0x79764d){_0x4570fb[_0x6469('0x26')](0x194);}return _0x79764d;};}function handleError(_0x1ecb07,_0xe72068){_0xe72068=_0xe72068||0x1f4;return function(_0x28fd7a){logger[_0x6469('0x27')](_0x28fd7a[_0x6469('0x28')]);if(_0x28fd7a['name']){delete _0x28fd7a[_0x6469('0x29')];}_0x1ecb07['status'](_0xe72068)[_0x6469('0x2a')](_0x28fd7a);};}exports[_0x6469('0x2b')]=function(_0x4259d0,_0xd5ca96){var _0x889cdd={},_0xebc2b7={},_0x1e425a={'count':0x0,'rows':[]};var _0x45136b=_[_0x6469('0x2c')](db[_0x6469('0x2d')][_0x6469('0x2e')],function(_0x83968b){return{'name':_0x83968b[_0x6469('0x2f')],'type':_0x83968b[_0x6469('0x30')][_0x6469('0x31')]};});_0xebc2b7[_0x6469('0x32')]=_[_0x6469('0x2c')](_0x45136b,_0x6469('0x29'));_0xebc2b7['query']=_['keys'](_0x4259d0[_0x6469('0x33')]);_0xebc2b7[_0x6469('0x34')]=_[_0x6469('0x35')](_0xebc2b7[_0x6469('0x32')],_0xebc2b7['query']);_0x889cdd['attributes']=_[_0x6469('0x35')](_0xebc2b7[_0x6469('0x32')],qs[_0x6469('0x36')](_0x4259d0[_0x6469('0x33')][_0x6469('0x36')]));_0x889cdd[_0x6469('0x37')]=_0x889cdd[_0x6469('0x37')][_0x6469('0x38')]?_0x889cdd[_0x6469('0x37')]:_0xebc2b7[_0x6469('0x32')];if(!_0x4259d0[_0x6469('0x33')][_0x6469('0x39')](_0x6469('0x3a'))){_0x889cdd[_0x6469('0x1a')]=qs['limit'](_0x4259d0['query'][_0x6469('0x1a')]);_0x889cdd[_0x6469('0x3b')]=qs['offset'](_0x4259d0['query'][_0x6469('0x3b')]);}_0x889cdd[_0x6469('0x3c')]=qs[_0x6469('0x3d')](_0x4259d0[_0x6469('0x33')]['sort']);_0x889cdd['where']=qs[_0x6469('0x34')](_[_0x6469('0x3e')](_0x4259d0[_0x6469('0x33')],_0xebc2b7[_0x6469('0x34')]),_0x45136b);if(_0x4259d0['query'][_0x6469('0x3f')]){_0x889cdd[_0x6469('0x40')]=_[_0x6469('0x41')](_0x889cdd[_0x6469('0x40')],{'$or':_[_0x6469('0x2c')](_0x45136b,function(_0x1b57b1){if(_0x1b57b1[_0x6469('0x30')]!=='VIRTUAL'){var _0x169415={};_0x169415[_0x1b57b1[_0x6469('0x29')]]={'$like':'%'+_0x4259d0[_0x6469('0x33')][_0x6469('0x3f')]+'%'};return _0x169415;}})});}_0x889cdd=_[_0x6469('0x41')]({},_0x889cdd,_0x4259d0[_0x6469('0x42')]);var _0x444572={'where':_0x889cdd['where']};return db[_0x6469('0x2d')][_0x6469('0x19')](_0x444572)[_0x6469('0x24')](function(_0x3f2b10){_0x1e425a[_0x6469('0x19')]=_0x3f2b10;if(_0x4259d0[_0x6469('0x33')][_0x6469('0x43')]){_0x889cdd[_0x6469('0x44')]=[{'all':!![]}];}return db[_0x6469('0x2d')][_0x6469('0x45')](_0x889cdd);})[_0x6469('0x24')](function(_0x47406b){_0x1e425a[_0x6469('0x46')]=_0x47406b;return _0x1e425a;})[_0x6469('0x24')](respondWithFilteredResult(_0xd5ca96,_0x889cdd))[_0x6469('0x47')](handleError(_0xd5ca96,null));};exports['show']=function(_0x51b8bc,_0x26ece1){var _0x5df43b={'raw':!![],'where':{'id':_0x51b8bc[_0x6469('0x48')]['id']}},_0x276a27={};_0x276a27[_0x6469('0x32')]=_[_0x6469('0x49')](db['SquareOdbc'][_0x6469('0x2e')]);_0x276a27[_0x6469('0x33')]=_[_0x6469('0x49')](_0x51b8bc['query']);_0x276a27[_0x6469('0x34')]=_[_0x6469('0x35')](_0x276a27[_0x6469('0x32')],_0x276a27[_0x6469('0x33')]);_0x5df43b['attributes']=_[_0x6469('0x35')](_0x276a27['model'],qs[_0x6469('0x36')](_0x51b8bc['query']['fields']));_0x5df43b['attributes']=_0x5df43b['attributes'][_0x6469('0x38')]?_0x5df43b['attributes']:_0x276a27[_0x6469('0x32')];if(_0x51b8bc[_0x6469('0x33')][_0x6469('0x43')]){_0x5df43b[_0x6469('0x44')]=[{'all':!![]}];}_0x5df43b=_[_0x6469('0x41')]({},_0x5df43b,_0x51b8bc['options']);return db['SquareOdbc']['find'](_0x5df43b)[_0x6469('0x24')](handleEntityNotFound(_0x26ece1,null))[_0x6469('0x24')](respondWithResult(_0x26ece1,null))[_0x6469('0x47')](handleError(_0x26ece1,null));};exports[_0x6469('0x4a')]=function(_0x1e1190,_0x260021){return db[_0x6469('0x2d')][_0x6469('0x4a')](_0x1e1190[_0x6469('0x4b')],{})[_0x6469('0x24')](function(_0x215887){var _0x59600f=_0x1e1190[_0x6469('0x4c')][_0x6469('0x22')]({'plain':!![]});if(!_0x59600f)throw new Error(_0x6469('0x4d'));if(_0x59600f[_0x6469('0x4e')]===_0x6469('0x4c')){var _0x5f429a=_0x215887[_0x6469('0x22')]({'plain':!![]});var _0x2ab64c='ODBC';return db[_0x6469('0x4f')][_0x6469('0x50')]({'where':{'name':_0x2ab64c,'userProfileId':_0x59600f[_0x6469('0x51')]},'raw':!![]})[_0x6469('0x24')](function(_0x3c2fe4){if(_0x3c2fe4&&_0x3c2fe4[_0x6469('0x52')]===0x0){return db[_0x6469('0x23')][_0x6469('0x4a')]({'name':_0x5f429a[_0x6469('0x29')],'resourceId':_0x5f429a['id'],'type':_0x3c2fe4[_0x6469('0x29')],'sectionId':_0x3c2fe4['id']},{})[_0x6469('0x24')](function(){return _0x215887;});}else{return _0x215887;}})[_0x6469('0x47')](function(_0x232d29){logger[_0x6469('0x27')](_0x6469('0x53'),_0x232d29);throw _0x232d29;});}return _0x215887;})[_0x6469('0x24')](respondWithResult(_0x260021,0xc9))[_0x6469('0x47')](handleError(_0x260021,null));};exports[_0x6469('0x20')]=function(_0xf52703,_0x2ba321){if(_0xf52703[_0x6469('0x4b')]['id']){delete _0xf52703[_0x6469('0x4b')]['id'];}return db[_0x6469('0x2d')][_0x6469('0x50')]({'where':{'id':_0xf52703['params']['id']}})[_0x6469('0x24')](handleEntityNotFound(_0x2ba321,null))[_0x6469('0x24')](saveUpdates(_0xf52703['body'],null))[_0x6469('0x24')](respondWithResult(_0x2ba321,null))[_0x6469('0x47')](handleError(_0x2ba321,null));};exports['destroy']=function(_0x550424,_0x30df28){return db[_0x6469('0x2d')]['find']({'where':{'id':_0x550424[_0x6469('0x48')]['id']}})['then'](handleEntityNotFound(_0x30df28,null))['then'](removeEntity(_0x30df28,null))['catch'](handleError(_0x30df28,null));};exports['test']=function(_0x5ca2b8,_0x1cc7e7,_0x6b542){var _0x3e07f7;return db[_0x6469('0x2d')][_0x6469('0x50')]({'where':{'id':_0x5ca2b8[_0x6469('0x48')]['id']},'attributes':['id',_0x6469('0x54')]})[_0x6469('0x24')](handleEntityNotFound(_0x1cc7e7,null))[_0x6469('0x24')](function(_0x51156b){if(_0x51156b){var _0x44023f=require('odbc')();_0x44023f[_0x6469('0x55')](_0x51156b[_0x6469('0x54')]);_0x44023f[_0x6469('0x56')]();return _0x51156b;}})[_0x6469('0x24')](respondWithResult(_0x1cc7e7,null))[_0x6469('0x47')](handleError(_0x1cc7e7,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 13639ac..1b63d3c 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 _0xa3f2=['path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2df259,_0x397739){var _0x5ef715=function(_0x310624){while(--_0x310624){_0x2df259['push'](_0x2df259['shift']());}};_0x5ef715(++_0x397739);}(_0xa3f2,0x6f));var _0x2a3f=function(_0x4dae16,_0x4f6398){_0x4dae16=_0x4dae16-0x0;var _0x5bfa4d=_0xa3f2[_0x4dae16];return _0x5bfa4d;};'use strict';var _=require('lodash');var util=require(_0x2a3f('0x0'));var logger=require(_0x2a3f('0x1'))(_0x2a3f('0x2'));var moment=require(_0x2a3f('0x3'));var BPromise=require(_0x2a3f('0x4'));var rp=require(_0x2a3f('0x5'));var fs=require('fs');var path=require(_0x2a3f('0x6'));var rimraf=require('rimraf');var config=require(_0x2a3f('0x7'));var attributes=require(_0x2a3f('0x8'));module[_0x2a3f('0x9')]=function(_0x5227a3,_0x4d80d0){return _0x5227a3[_0x2a3f('0xa')](_0x2a3f('0xb'),attributes,{'tableName':_0x2a3f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe80c=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','define','square_odbc','util'];(function(_0x1a87d7,_0x304786){var _0x4ac901=function(_0x4e41e7){while(--_0x4e41e7){_0x1a87d7['push'](_0x1a87d7['shift']());}};_0x4ac901(++_0x304786);}(_0xe80c,0x1c2));var _0xce80=function(_0x75288f,_0x5ca885){_0x75288f=_0x75288f-0x0;var _0x4ed8cf=_0xe80c[_0x75288f];return _0x4ed8cf;};'use strict';var _=require('lodash');var util=require(_0xce80('0x0'));var logger=require(_0xce80('0x1'))(_0xce80('0x2'));var moment=require(_0xce80('0x3'));var BPromise=require(_0xce80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce80('0x5'));var rimraf=require(_0xce80('0x6'));var config=require(_0xce80('0x7'));var attributes=require(_0xce80('0x8'));module['exports']=function(_0xb10325,_0x150f6a){return _0xb10325[_0xce80('0x9')]('SquareOdbc',attributes,{'tableName':_0xce80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 0d3cf9c..e841a65 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 _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(_0x2d086e,_0x5516c7){var _0x39bd87=function(_0x4c9997){while(--_0x4c9997){_0x2d086e['push'](_0x2d086e['shift']());}};_0x39bd87(++_0x5516c7);}(_0x008c,0x188));var _0xc008=function(_0x1f31fa,_0x5e96a){_0x1f31fa=_0x1f31fa-0x0;var _0x1b50ba=_0x008c[_0x1f31fa];return _0x1b50ba;};'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 +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0xef839a,_0x55c179){var _0x237559=function(_0x13c62d){while(--_0x13c62d){_0xef839a['push'](_0xef839a['shift']());}};_0x237559(++_0x55c179);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 82a2e8f..b55018f 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 _0xcf2f=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','create','post','addUsers','put','delete','destroy','multer'];(function(_0x4b8f07,_0x1fd70e){var _0x133d9a=function(_0x4e15fe){while(--_0x4e15fe){_0x4b8f07['push'](_0x4b8f07['shift']());}};_0x133d9a(++_0x1fd70e);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5c80ff,_0x7d9b26){_0x5c80ff=_0x5c80ff-0x0;var _0x5a3766=_0xcf2f[_0x5c80ff];return _0x5a3766;};'use strict';var multer=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var path=require(_0xfcf2('0x2'));var timeout=require(_0xfcf2('0x3'));var express=require(_0xfcf2('0x4'));var router=express['Router']();var auth=require(_0xfcf2('0x5'));var interaction=require(_0xfcf2('0x6'));var config=require(_0xfcf2('0x7'));var controller=require(_0xfcf2('0x8'));router[_0xfcf2('0x9')]('/',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xb')]);router[_0xfcf2('0x9')](_0xfcf2('0xc'),auth[_0xfcf2('0xa')](),controller[_0xfcf2('0xd')]);router[_0xfcf2('0x9')](_0xfcf2('0xe'),auth[_0xfcf2('0xa')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0xfcf2('0xf')]);router[_0xfcf2('0x10')]('/:id/users',auth[_0xfcf2('0xa')](),controller[_0xfcf2('0x11')]);router[_0xfcf2('0x12')](_0xfcf2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfcf2('0x13')](_0xfcf2('0xc'),auth[_0xfcf2('0xa')](),controller[_0xfcf2('0x14')]);router['delete'](_0xfcf2('0xe'),auth['isAuthenticated'](),controller['removeUsers']);module['exports']=router; \ No newline at end of file +var _0x13f6=['express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','/:id/users','isAuthenticated','getUsers','post','create','addUsers','put','/:id','update','delete','removeUsers','exports','multer','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x13f6,0x124));var _0x613f=function(_0x199e9a,_0x3ba70d){_0x199e9a=_0x199e9a-0x0;var _0x1fc0e4=_0x13f6[_0x199e9a];return _0x1fc0e4;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var auth=require(_0x613f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x613f('0x5'));var controller=require(_0x613f('0x6'));router[_0x613f('0x7')]('/',auth['isAuthenticated'](),controller[_0x613f('0x8')]);router[_0x613f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/',auth['isAuthenticated'](),controller[_0x613f('0xd')]);router[_0x613f('0xc')](_0x613f('0x9'),auth['isAuthenticated'](),controller[_0x613f('0xe')]);router[_0x613f('0xf')](_0x613f('0x10'),auth['isAuthenticated'](),controller[_0x613f('0x11')]);router[_0x613f('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x613f('0x12')](_0x613f('0x9'),auth[_0x613f('0xa')](),controller[_0x613f('0x13')]);module[_0x613f('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 04a47f2..4914247 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 _0x48b0=['sequelize','exports','STRING','name','long','getDataValue','toString','utf8'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x48b0,0x1a8));var _0x048b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x48b0[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x048b('0x0'));module[_0x048b('0x1')]={'name':{'type':Sequelize[_0x048b('0x2')],'unique':_0x048b('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x048b('0x4')),'get':function(){if(this[_0x048b('0x5')]('preproduction')){return this[_0x048b('0x5')]('preproduction')[_0x048b('0x6')](_0x048b('0x7'));}}},'production':{'type':Sequelize['BLOB'](_0x048b('0x4')),'get':function(){if(this[_0x048b('0x5')]('production')){return this[_0x048b('0x5')]('production')['toString'](_0x048b('0x7'));}}}}; \ No newline at end of file +var _0xc7fd=['getDataValue','sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','utf8'];(function(_0x37587f,_0x1aa9b2){var _0x40e8e9=function(_0x3bc100){while(--_0x3bc100){_0x37587f['push'](_0x37587f['shift']());}};_0x40e8e9(++_0x1aa9b2);}(_0xc7fd,0x182));var _0xdc7f=function(_0xa33204,_0x33df58){_0xa33204=_0xa33204-0x0;var _0x3f067a=_0xc7fd[_0xa33204];return _0x3f067a;};'use strict';var Sequelize=require(_0xdc7f('0x0'));module[_0xdc7f('0x1')]={'name':{'type':Sequelize[_0xdc7f('0x2')],'unique':_0xdc7f('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xdc7f('0x4')]},'preproduction':{'type':Sequelize[_0xdc7f('0x5')](_0xdc7f('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0xdc7f('0x7'))[_0xdc7f('0x8')](_0xdc7f('0x9'));}}},'production':{'type':Sequelize[_0xdc7f('0x5')](_0xdc7f('0x6')),'get':function(){if(this[_0xdc7f('0xa')]('production')){return this[_0xdc7f('0xa')]('production')[_0xdc7f('0x8')](_0xdc7f('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ad6c09e..7820ff1 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 _0x59cb=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','SquareProject','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','userSquareProject:remove','emit','getUsers','User','hasOwnProperty','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring'];(function(_0x156f1e,_0x71ad75){var _0x3951cc=function(_0x9fc871){while(--_0x9fc871){_0x156f1e['push'](_0x156f1e['shift']());}};_0x3951cc(++_0x71ad75);}(_0x59cb,0xab));var _0xb59c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x59cb[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xb59c('0x0'));var emlformat=require(_0xb59c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb59c('0x2'));var jsonpatch=require(_0xb59c('0x3'));var rp=require('request-promise');var moment=require(_0xb59c('0x4'));var BPromise=require(_0xb59c('0x5'));var Mustache=require('mustache');var util=require(_0xb59c('0x6'));var path=require(_0xb59c('0x7'));var sox=require(_0xb59c('0x8'));var csv=require(_0xb59c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb59c('0xa'));var crypto=require(_0xb59c('0xb'));var jsforce=require(_0xb59c('0xc'));var deskjs=require(_0xb59c('0xd'));var toCsv=require(_0xb59c('0x9'));var querystring=require(_0xb59c('0xe'));var Papa=require(_0xb59c('0xf'));var Redis=require(_0xb59c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb59c('0x11'));var as=require(_0xb59c('0x12'));var hardwareService=require(_0xb59c('0x13'));var logger=require(_0xb59c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb59c('0x15')]=_['defaults'](config[_0xb59c('0x15')],{'host':_0xb59c('0x16'),'port':0x18eb});var socket=require(_0xb59c('0x17'))(new Redis(config[_0xb59c('0x15')]));require(_0xb59c('0x18'))['register'](socket);function respondWithStatusCode(_0x45d75f,_0x22d23c){_0x22d23c=_0x22d23c||0xcc;return function(_0x1b295d){if(_0x1b295d){return _0x45d75f[_0xb59c('0x19')](_0x22d23c);}return _0x45d75f[_0xb59c('0x1a')](_0x22d23c)['end']();};}function respondWithResult(_0x39a78b,_0x4e4e06){_0x4e4e06=_0x4e4e06||0xc8;return function(_0x3865ce){if(_0x3865ce){return _0x39a78b['status'](_0x4e4e06)[_0xb59c('0x1b')](_0x3865ce);}};}function respondWithFilteredResult(_0x53d7eb,_0x40e2cb){return function(_0x229c89){if(_0x229c89){var _0x26e5bd=_0x229c89[_0xb59c('0x1c')],_0x217538=_0x40e2cb[_0xb59c('0x1d')],_0x12f9b0=_0x40e2cb[_0xb59c('0x1d')]+_0x40e2cb['limit'],_0xe6c4c7;if(_0x12f9b0>=_0x26e5bd){_0x12f9b0=_0x26e5bd;_0xe6c4c7=0xc8;}else{_0xe6c4c7=0xce;}_0x53d7eb['status'](_0xe6c4c7);return _0x53d7eb[_0xb59c('0x1e')]('Content-Range',_0x217538+'-'+_0x12f9b0+'/'+_0x26e5bd)[_0xb59c('0x1b')](_0x229c89);}return null;};}function patchUpdates(_0x4024fe){return function(_0x3c042b){try{jsonpatch[_0xb59c('0x1f')](_0x3c042b,_0x4024fe,!![]);}catch(_0x17ea3b){return BPromise[_0xb59c('0x20')](_0x17ea3b);}return _0x3c042b[_0xb59c('0x21')]();};}function saveUpdates(_0x3088f0,_0x38ed18){return function(_0x4ef326){if(_0x4ef326){return _0x4ef326[_0xb59c('0x22')](_0x3088f0)[_0xb59c('0x23')](function(_0x109dea){return _0x109dea;});}return null;};}function removeEntity(_0x261757,_0x5d8b06){return function(_0x3cb63d){if(_0x3cb63d){return _0x3cb63d[_0xb59c('0x24')]()[_0xb59c('0x23')](function(){var _0x535ccf=_0x3cb63d[_0xb59c('0x25')]({'plain':!![]});var _0x46a25c='SquareProjects';return db[_0xb59c('0x26')][_0xb59c('0x24')]({'where':{'type':_0x46a25c,'resourceId':_0x535ccf['id']}})[_0xb59c('0x23')](function(){return _0x3cb63d;});})[_0xb59c('0x23')](function(){_0x261757[_0xb59c('0x1a')](0xcc)[_0xb59c('0x27')]();});}};}function handleEntityNotFound(_0x4f36e4,_0x27b218){return function(_0x6c31a){if(!_0x6c31a){_0x4f36e4[_0xb59c('0x19')](0x194);}return _0x6c31a;};}function handleError(_0x46ff71,_0x3acc44){_0x3acc44=_0x3acc44||0x1f4;return function(_0x6274c0){logger[_0xb59c('0x28')](_0x6274c0['stack']);if(_0x6274c0[_0xb59c('0x29')]){delete _0x6274c0[_0xb59c('0x29')];}_0x46ff71[_0xb59c('0x1a')](_0x3acc44)[_0xb59c('0x2a')](_0x6274c0);};}exports[_0xb59c('0x2b')]=function(_0x244358,_0x15c147){var _0x407234={},_0x5d1f7f={},_0x22f854={'count':0x0,'rows':[]};var _0x2debaf=_[_0xb59c('0x2c')](db[_0xb59c('0x2d')][_0xb59c('0x2e')],function(_0x596b28){return{'name':_0x596b28['fieldName'],'type':_0x596b28['type'][_0xb59c('0x2f')]};});_0x5d1f7f[_0xb59c('0x30')]=_[_0xb59c('0x2c')](_0x2debaf,_0xb59c('0x29'));_0x5d1f7f['query']=_[_0xb59c('0x31')](_0x244358['query']);_0x5d1f7f[_0xb59c('0x32')]=_[_0xb59c('0x33')](_0x5d1f7f[_0xb59c('0x30')],_0x5d1f7f[_0xb59c('0x34')]);_0x407234[_0xb59c('0x35')]=_['intersection'](_0x5d1f7f[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x244358[_0xb59c('0x34')]['fields']));_0x407234[_0xb59c('0x35')]=_0x407234[_0xb59c('0x35')][_0xb59c('0x37')]?_0x407234[_0xb59c('0x35')]:_0x5d1f7f[_0xb59c('0x30')];if(!_0x244358[_0xb59c('0x34')]['hasOwnProperty'](_0xb59c('0x38'))){_0x407234[_0xb59c('0x39')]=qs[_0xb59c('0x39')](_0x244358['query'][_0xb59c('0x39')]);_0x407234[_0xb59c('0x1d')]=qs[_0xb59c('0x1d')](_0x244358[_0xb59c('0x34')][_0xb59c('0x1d')]);}_0x407234[_0xb59c('0x3a')]=qs[_0xb59c('0x3b')](_0x244358[_0xb59c('0x34')][_0xb59c('0x3b')]);_0x407234[_0xb59c('0x3c')]=qs[_0xb59c('0x32')](_[_0xb59c('0x3d')](_0x244358[_0xb59c('0x34')],_0x5d1f7f[_0xb59c('0x32')]),_0x2debaf);if(_0x244358['query'][_0xb59c('0x3e')]){_0x407234[_0xb59c('0x3c')]=_[_0xb59c('0x3f')](_0x407234[_0xb59c('0x3c')],{'$or':_[_0xb59c('0x2c')](_0x2debaf,function(_0x2c7080){if(_0x2c7080[_0xb59c('0x40')]!==_0xb59c('0x41')){var _0x59b8fb={};_0x59b8fb[_0x2c7080['name']]={'$like':'%'+_0x244358[_0xb59c('0x34')][_0xb59c('0x3e')]+'%'};return _0x59b8fb;}})});}_0x407234=_['merge']({},_0x407234,_0x244358[_0xb59c('0x42')]);var _0x58b746={'where':_0x407234[_0xb59c('0x3c')]};return db[_0xb59c('0x2d')][_0xb59c('0x1c')](_0x58b746)['then'](function(_0x34668e){_0x22f854[_0xb59c('0x1c')]=_0x34668e;if(_0x244358['query'][_0xb59c('0x43')]){_0x407234[_0xb59c('0x44')]=[{'all':!![]}];}return db[_0xb59c('0x2d')][_0xb59c('0x45')](_0x407234);})[_0xb59c('0x23')](function(_0x10cc83){_0x22f854[_0xb59c('0x46')]=_0x10cc83;return _0x22f854;})[_0xb59c('0x23')](respondWithFilteredResult(_0x15c147,_0x407234))[_0xb59c('0x47')](handleError(_0x15c147,null));};exports[_0xb59c('0x48')]=function(_0x34e065,_0x2f89ab){var _0x5edf4a={'raw':![],'where':{'id':_0x34e065[_0xb59c('0x49')]['id']}},_0x19a533={};_0x19a533['model']=_[_0xb59c('0x31')](db[_0xb59c('0x2d')]['rawAttributes']);_0x19a533['query']=_['keys'](_0x34e065[_0xb59c('0x34')]);_0x19a533[_0xb59c('0x32')]=_[_0xb59c('0x33')](_0x19a533[_0xb59c('0x30')],_0x19a533[_0xb59c('0x34')]);_0x5edf4a[_0xb59c('0x35')]=_[_0xb59c('0x33')](_0x19a533[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x34e065['query'][_0xb59c('0x36')]));_0x5edf4a['attributes']=_0x5edf4a[_0xb59c('0x35')][_0xb59c('0x37')]?_0x5edf4a['attributes']:_0x19a533[_0xb59c('0x30')];if(_0x34e065[_0xb59c('0x34')][_0xb59c('0x43')]){_0x5edf4a[_0xb59c('0x44')]=[{'all':!![]}];}_0x5edf4a=_['merge']({},_0x5edf4a,_0x34e065[_0xb59c('0x42')]);return db[_0xb59c('0x2d')][_0xb59c('0x4a')](_0x5edf4a)[_0xb59c('0x23')](handleEntityNotFound(_0x2f89ab,null))[_0xb59c('0x23')](respondWithResult(_0x2f89ab,null))[_0xb59c('0x47')](handleError(_0x2f89ab,null));};exports['create']=function(_0x8f10c9,_0xcd44b5){return db['SquareProject'][_0xb59c('0x4b')](_0x8f10c9[_0xb59c('0x4c')],{})[_0xb59c('0x23')](function(_0x220305){var _0x1810e0=_0x8f10c9[_0xb59c('0x4d')][_0xb59c('0x25')]({'plain':!![]});if(!_0x1810e0)throw new Error(_0xb59c('0x4e'));if(_0x1810e0['role']===_0xb59c('0x4d')){var _0x255280=_0x220305['get']({'plain':!![]});var _0x354467=_0xb59c('0x4f');return db[_0xb59c('0x50')]['find']({'where':{'name':_0x354467,'userProfileId':_0x1810e0[_0xb59c('0x51')]},'raw':!![]})[_0xb59c('0x23')](function(_0x3c9438){if(_0x3c9438&&_0x3c9438[_0xb59c('0x52')]===0x0){return db[_0xb59c('0x26')][_0xb59c('0x4b')]({'name':_0x255280['name'],'resourceId':_0x255280['id'],'type':_0x3c9438[_0xb59c('0x29')],'sectionId':_0x3c9438['id']},{})[_0xb59c('0x23')](function(){return _0x220305;});}else{return _0x220305;}})[_0xb59c('0x47')](function(_0xe2dd9){logger[_0xb59c('0x28')](_0xb59c('0x53'),_0xe2dd9);throw _0xe2dd9;});}return _0x220305;})[_0xb59c('0x23')](respondWithResult(_0xcd44b5,0xc9))[_0xb59c('0x47')](handleError(_0xcd44b5,null));};exports[_0xb59c('0x22')]=function(_0xecff82,_0xe95beb){if(_0xecff82[_0xb59c('0x4c')]['id']){delete _0xecff82[_0xb59c('0x4c')]['id'];}return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0xecff82[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0xe95beb,null))[_0xb59c('0x23')](saveUpdates(_0xecff82[_0xb59c('0x4c')],null))[_0xb59c('0x23')](respondWithResult(_0xe95beb,null))[_0xb59c('0x47')](handleError(_0xe95beb,null));};exports[_0xb59c('0x24')]=function(_0x144581,_0x232cb0){return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0x144581[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x232cb0,null))[_0xb59c('0x23')](removeEntity(_0x232cb0,null))['catch'](handleError(_0x232cb0,null));};exports[_0xb59c('0x54')]=function(_0x4d15ab,_0x916a37,_0x51d385){return db[_0xb59c('0x2d')][_0xb59c('0x4a')]({'where':{'id':_0x4d15ab['params']['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x916a37,null))[_0xb59c('0x23')](function(_0x52cc95){if(_0x52cc95){return _0x52cc95[_0xb59c('0x54')](_0x4d15ab[_0xb59c('0x4c')]['ids'],_[_0xb59c('0x55')](_0x4d15ab[_0xb59c('0x4c')],[_0xb59c('0x56'),'id'])||{});}})[_0xb59c('0x23')](respondWithResult(_0x916a37,null))[_0xb59c('0x47')](handleError(_0x916a37,null));};exports['removeUsers']=function(_0x355acc,_0x354e60,_0x1f6383){return db['SquareProject'][_0xb59c('0x4a')]({'where':{'id':_0x355acc[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x354e60,null))[_0xb59c('0x23')](function(_0x1e0f0d){if(_0x1e0f0d){return _0x1e0f0d[_0xb59c('0x57')](_0x355acc['query'][_0xb59c('0x56')])[_0xb59c('0x23')](function(){if(_['isArray'](_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')])){for(var _0x16149f=0x0;_0x16149f<_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')][_0xb59c('0x37')];_0x16149f+=0x1){socket['emit'](_0xb59c('0x58'),{'UserId':Number(_0x355acc[_0xb59c('0x34')][_0xb59c('0x56')][_0x16149f]),'SquareProjectId':Number(_0x355acc[_0xb59c('0x49')]['id'])});}}else{socket[_0xb59c('0x59')](_0xb59c('0x58'),{'UserId':Number(_0x355acc[_0xb59c('0x34')]['ids']),'SquareProjectId':Number(_0x355acc['params']['id'])});}});}})[_0xb59c('0x23')](respondWithStatusCode(_0x354e60,null))[_0xb59c('0x47')](handleError(_0x354e60,null));};exports[_0xb59c('0x5a')]=function(_0x5004d5,_0x36b5ed,_0x19d293){var _0x27fe87={};var _0x411625={};var _0x5ab7aa;var _0x50e0f5;return db[_0xb59c('0x2d')]['findOne']({'where':{'id':_0x5004d5[_0xb59c('0x49')]['id']}})[_0xb59c('0x23')](handleEntityNotFound(_0x36b5ed,null))[_0xb59c('0x23')](function(_0x2356bf){if(_0x2356bf){_0x5ab7aa=_0x2356bf;_0x411625['model']=_[_0xb59c('0x31')](db[_0xb59c('0x5b')][_0xb59c('0x2e')]);_0x411625[_0xb59c('0x34')]=_[_0xb59c('0x31')](_0x5004d5[_0xb59c('0x34')]);_0x411625['filters']=_[_0xb59c('0x33')](_0x411625[_0xb59c('0x30')],_0x411625[_0xb59c('0x34')]);_0x27fe87['attributes']=_[_0xb59c('0x33')](_0x411625[_0xb59c('0x30')],qs[_0xb59c('0x36')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x36')]));_0x27fe87[_0xb59c('0x35')]=_0x27fe87[_0xb59c('0x35')][_0xb59c('0x37')]?_0x27fe87['attributes']:_0x411625[_0xb59c('0x30')];_0x27fe87[_0xb59c('0x3a')]=qs[_0xb59c('0x3b')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x3b')]);_0x27fe87[_0xb59c('0x3c')]=qs[_0xb59c('0x32')](_['pick'](_0x5004d5[_0xb59c('0x34')],_0x411625[_0xb59c('0x32')]));if(_0x5004d5['query'][_0xb59c('0x3e')]){_0x27fe87[_0xb59c('0x3c')]=_[_0xb59c('0x3f')](_0x27fe87[_0xb59c('0x3c')],{'$or':_[_0xb59c('0x2c')](_0x27fe87['attributes'],function(_0xe29441){var _0x29966f={};_0x29966f[_0xe29441]={'$like':'%'+_0x5004d5[_0xb59c('0x34')][_0xb59c('0x3e')]+'%'};return _0x29966f;})});}_0x27fe87=_['merge']({},_0x27fe87,_0x5004d5['options']);return _0x5ab7aa[_0xb59c('0x5a')](_0x27fe87);}})['then'](function(_0x2d9016){if(_0x2d9016){_0x50e0f5=_0x2d9016[_0xb59c('0x37')];if(!_0x5004d5[_0xb59c('0x34')][_0xb59c('0x5c')](_0xb59c('0x38'))){_0x27fe87[_0xb59c('0x39')]=qs[_0xb59c('0x39')](_0x5004d5['query'][_0xb59c('0x39')]);_0x27fe87[_0xb59c('0x1d')]=qs[_0xb59c('0x1d')](_0x5004d5[_0xb59c('0x34')][_0xb59c('0x1d')]);}return _0x5ab7aa[_0xb59c('0x5a')](_0x27fe87);}})[_0xb59c('0x23')](function(_0x46a154){if(_0x46a154){return _0x46a154?{'count':_0x50e0f5,'rows':_0x46a154}:null;}})['then'](respondWithResult(_0x36b5ed,null))[_0xb59c('0x47')](handleError(_0x36b5ed,null));}; \ No newline at end of file +var _0x16dd=['rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','order','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x16dd,0x77));var _0xd16d=function(_0x17ea24,_0x2148ea){_0x17ea24=_0x17ea24-0x0;var _0x4d4b52=_0x16dd[_0x17ea24];return _0x4d4b52;};'use strict';var pdf=require(_0xd16d('0x0'));var emlformat=require(_0xd16d('0x1'));var rimraf=require(_0xd16d('0x2'));var zipdir=require(_0xd16d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd16d('0x4'));var BPromise=require(_0xd16d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd16d('0x6'));var sox=require('sox');var csv=require(_0xd16d('0x7'));var ejs=require(_0xd16d('0x8'));var fs=require('fs');var _=require(_0xd16d('0x9'));var squel=require(_0xd16d('0xa'));var crypto=require(_0xd16d('0xb'));var jsforce=require(_0xd16d('0xc'));var deskjs=require(_0xd16d('0xd'));var toCsv=require(_0xd16d('0x7'));var querystring=require('querystring');var Papa=require(_0xd16d('0xe'));var Redis=require(_0xd16d('0xf'));var authService=require(_0xd16d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd16d('0x11'));var hardwareService=require(_0xd16d('0x12'));var logger=require('../../config/logger')(_0xd16d('0x13'));var utils=require('../../config/utils');var config=require(_0xd16d('0x14'));var db=require(_0xd16d('0x15'))['db'];config['redis']=_[_0xd16d('0x16')](config[_0xd16d('0x17')],{'host':_0xd16d('0x18'),'port':0x18eb});var socket=require(_0xd16d('0x19'))(new Redis(config[_0xd16d('0x17')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x695a36,_0x4cdad0){_0x4cdad0=_0x4cdad0||0xcc;return function(_0x409fd3){if(_0x409fd3){return _0x695a36[_0xd16d('0x1a')](_0x4cdad0);}return _0x695a36[_0xd16d('0x1b')](_0x4cdad0)[_0xd16d('0x1c')]();};}function respondWithResult(_0xf23956,_0x1dffd7){_0x1dffd7=_0x1dffd7||0xc8;return function(_0x53cf17){if(_0x53cf17){return _0xf23956[_0xd16d('0x1b')](_0x1dffd7)['json'](_0x53cf17);}};}function respondWithFilteredResult(_0x3b50d3,_0x428cbc){return function(_0x5e9b8d){if(_0x5e9b8d){var _0x3444a3=_0x5e9b8d[_0xd16d('0x1d')],_0x44b5df=_0x428cbc['offset'],_0x4d75d7=_0x428cbc[_0xd16d('0x1e')]+_0x428cbc[_0xd16d('0x1f')],_0x115aa2;if(_0x4d75d7>=_0x3444a3){_0x4d75d7=_0x3444a3;_0x115aa2=0xc8;}else{_0x115aa2=0xce;}_0x3b50d3[_0xd16d('0x1b')](_0x115aa2);return _0x3b50d3['set'](_0xd16d('0x20'),_0x44b5df+'-'+_0x4d75d7+'/'+_0x3444a3)[_0xd16d('0x21')](_0x5e9b8d);}return null;};}function patchUpdates(_0x436b42){return function(_0x560fb4){try{jsonpatch[_0xd16d('0x22')](_0x560fb4,_0x436b42,!![]);}catch(_0x10de8c){return BPromise[_0xd16d('0x23')](_0x10de8c);}return _0x560fb4[_0xd16d('0x24')]();};}function saveUpdates(_0x392846,_0x43a6fe){return function(_0x404c1d){if(_0x404c1d){return _0x404c1d['update'](_0x392846)[_0xd16d('0x25')](function(_0x13c99f){return _0x13c99f;});}return null;};}function removeEntity(_0x543bcf,_0x4c0d3c){return function(_0x302d86){if(_0x302d86){return _0x302d86[_0xd16d('0x26')]()[_0xd16d('0x25')](function(){var _0x3758aa=_0x302d86[_0xd16d('0x27')]({'plain':!![]});var _0x36b791='SquareProjects';return db['UserProfileResource'][_0xd16d('0x26')]({'where':{'type':_0x36b791,'resourceId':_0x3758aa['id']}})[_0xd16d('0x25')](function(){return _0x302d86;});})[_0xd16d('0x25')](function(){_0x543bcf[_0xd16d('0x1b')](0xcc)[_0xd16d('0x1c')]();});}};}function handleEntityNotFound(_0x34151e,_0x58f872){return function(_0x5a1c06){if(!_0x5a1c06){_0x34151e['sendStatus'](0x194);}return _0x5a1c06;};}function handleError(_0x3d4f1d,_0xda616a){_0xda616a=_0xda616a||0x1f4;return function(_0x4bdfb7){logger['error'](_0x4bdfb7[_0xd16d('0x28')]);if(_0x4bdfb7[_0xd16d('0x29')]){delete _0x4bdfb7['name'];}_0x3d4f1d[_0xd16d('0x1b')](_0xda616a)[_0xd16d('0x2a')](_0x4bdfb7);};}exports[_0xd16d('0x2b')]=function(_0x460f11,_0x168f59){var _0xde5bf6={},_0x567166={},_0x310954={'count':0x0,'rows':[]};var _0x332c51=_[_0xd16d('0x2c')](db[_0xd16d('0x2d')][_0xd16d('0x2e')],function(_0x5cf00b){return{'name':_0x5cf00b[_0xd16d('0x2f')],'type':_0x5cf00b['type']['key']};});_0x567166[_0xd16d('0x30')]=_[_0xd16d('0x2c')](_0x332c51,_0xd16d('0x29'));_0x567166['query']=_[_0xd16d('0x31')](_0x460f11[_0xd16d('0x32')]);_0x567166[_0xd16d('0x33')]=_[_0xd16d('0x34')](_0x567166[_0xd16d('0x30')],_0x567166[_0xd16d('0x32')]);_0xde5bf6[_0xd16d('0x35')]=_['intersection'](_0x567166[_0xd16d('0x30')],qs[_0xd16d('0x36')](_0x460f11['query']['fields']));_0xde5bf6[_0xd16d('0x35')]=_0xde5bf6[_0xd16d('0x35')][_0xd16d('0x37')]?_0xde5bf6[_0xd16d('0x35')]:_0x567166['model'];if(!_0x460f11['query'][_0xd16d('0x38')](_0xd16d('0x39'))){_0xde5bf6[_0xd16d('0x1f')]=qs[_0xd16d('0x1f')](_0x460f11[_0xd16d('0x32')][_0xd16d('0x1f')]);_0xde5bf6['offset']=qs[_0xd16d('0x1e')](_0x460f11['query'][_0xd16d('0x1e')]);}_0xde5bf6['order']=qs[_0xd16d('0x3a')](_0x460f11['query'][_0xd16d('0x3a')]);_0xde5bf6[_0xd16d('0x3b')]=qs[_0xd16d('0x33')](_[_0xd16d('0x3c')](_0x460f11[_0xd16d('0x32')],_0x567166[_0xd16d('0x33')]),_0x332c51);if(_0x460f11[_0xd16d('0x32')]['filter']){_0xde5bf6[_0xd16d('0x3b')]=_[_0xd16d('0x3d')](_0xde5bf6[_0xd16d('0x3b')],{'$or':_['map'](_0x332c51,function(_0xf48930){if(_0xf48930['type']!=='VIRTUAL'){var _0x24894b={};_0x24894b[_0xf48930[_0xd16d('0x29')]]={'$like':'%'+_0x460f11[_0xd16d('0x32')][_0xd16d('0x3e')]+'%'};return _0x24894b;}})});}_0xde5bf6=_['merge']({},_0xde5bf6,_0x460f11[_0xd16d('0x3f')]);var _0x202e02={'where':_0xde5bf6[_0xd16d('0x3b')]};return db['SquareProject'][_0xd16d('0x1d')](_0x202e02)[_0xd16d('0x25')](function(_0x194e77){_0x310954[_0xd16d('0x1d')]=_0x194e77;if(_0x460f11[_0xd16d('0x32')][_0xd16d('0x40')]){_0xde5bf6[_0xd16d('0x41')]=[{'all':!![]}];}return db[_0xd16d('0x2d')][_0xd16d('0x42')](_0xde5bf6);})[_0xd16d('0x25')](function(_0x4f810b){_0x310954[_0xd16d('0x43')]=_0x4f810b;return _0x310954;})[_0xd16d('0x25')](respondWithFilteredResult(_0x168f59,_0xde5bf6))[_0xd16d('0x44')](handleError(_0x168f59,null));};exports[_0xd16d('0x45')]=function(_0x1ad71b,_0x5c7b89){var _0x33b909={'raw':![],'where':{'id':_0x1ad71b[_0xd16d('0x46')]['id']}},_0x223dda={};_0x223dda['model']=_[_0xd16d('0x31')](db['SquareProject'][_0xd16d('0x2e')]);_0x223dda[_0xd16d('0x32')]=_[_0xd16d('0x31')](_0x1ad71b['query']);_0x223dda[_0xd16d('0x33')]=_[_0xd16d('0x34')](_0x223dda[_0xd16d('0x30')],_0x223dda[_0xd16d('0x32')]);_0x33b909[_0xd16d('0x35')]=_['intersection'](_0x223dda[_0xd16d('0x30')],qs['fields'](_0x1ad71b[_0xd16d('0x32')][_0xd16d('0x36')]));_0x33b909[_0xd16d('0x35')]=_0x33b909['attributes'][_0xd16d('0x37')]?_0x33b909[_0xd16d('0x35')]:_0x223dda[_0xd16d('0x30')];if(_0x1ad71b['query'][_0xd16d('0x40')]){_0x33b909[_0xd16d('0x41')]=[{'all':!![]}];}_0x33b909=_[_0xd16d('0x3d')]({},_0x33b909,_0x1ad71b[_0xd16d('0x3f')]);return db[_0xd16d('0x2d')][_0xd16d('0x47')](_0x33b909)['then'](handleEntityNotFound(_0x5c7b89,null))['then'](respondWithResult(_0x5c7b89,null))[_0xd16d('0x44')](handleError(_0x5c7b89,null));};exports[_0xd16d('0x48')]=function(_0x440b5c,_0x1b89db){return db[_0xd16d('0x2d')][_0xd16d('0x48')](_0x440b5c[_0xd16d('0x49')],{})[_0xd16d('0x25')](function(_0x3ebe6f){var _0x37f2a0=_0x440b5c[_0xd16d('0x4a')]['get']({'plain':!![]});if(!_0x37f2a0)throw new Error(_0xd16d('0x4b'));if(_0x37f2a0[_0xd16d('0x4c')]===_0xd16d('0x4a')){var _0x2c5b4f=_0x3ebe6f[_0xd16d('0x27')]({'plain':!![]});var _0x1bb134='SquareProjects';return db[_0xd16d('0x4d')][_0xd16d('0x47')]({'where':{'name':_0x1bb134,'userProfileId':_0x37f2a0['userProfileId']},'raw':!![]})[_0xd16d('0x25')](function(_0x14ffb4){if(_0x14ffb4&&_0x14ffb4[_0xd16d('0x4e')]===0x0){return db['UserProfileResource'][_0xd16d('0x48')]({'name':_0x2c5b4f['name'],'resourceId':_0x2c5b4f['id'],'type':_0x14ffb4[_0xd16d('0x29')],'sectionId':_0x14ffb4['id']},{})[_0xd16d('0x25')](function(){return _0x3ebe6f;});}else{return _0x3ebe6f;}})['catch'](function(_0x25c4a5){logger[_0xd16d('0x4f')](_0xd16d('0x50'),_0x25c4a5);throw _0x25c4a5;});}return _0x3ebe6f;})[_0xd16d('0x25')](respondWithResult(_0x1b89db,0xc9))[_0xd16d('0x44')](handleError(_0x1b89db,null));};exports[_0xd16d('0x51')]=function(_0x5cd811,_0x1d9cf2){if(_0x5cd811[_0xd16d('0x49')]['id']){delete _0x5cd811['body']['id'];}return db[_0xd16d('0x2d')]['find']({'where':{'id':_0x5cd811[_0xd16d('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d9cf2,null))[_0xd16d('0x25')](saveUpdates(_0x5cd811[_0xd16d('0x49')],null))['then'](respondWithResult(_0x1d9cf2,null))[_0xd16d('0x44')](handleError(_0x1d9cf2,null));};exports['destroy']=function(_0x52fff9,_0x3059a8){return db['SquareProject'][_0xd16d('0x47')]({'where':{'id':_0x52fff9[_0xd16d('0x46')]['id']}})[_0xd16d('0x25')](handleEntityNotFound(_0x3059a8,null))[_0xd16d('0x25')](removeEntity(_0x3059a8,null))['catch'](handleError(_0x3059a8,null));};exports[_0xd16d('0x52')]=function(_0x23e7a5,_0x4385cc,_0x31df26){return db[_0xd16d('0x2d')][_0xd16d('0x47')]({'where':{'id':_0x23e7a5['params']['id']}})[_0xd16d('0x25')](handleEntityNotFound(_0x4385cc,null))['then'](function(_0x3ca03d){if(_0x3ca03d){return _0x3ca03d[_0xd16d('0x52')](_0x23e7a5[_0xd16d('0x49')]['ids'],_[_0xd16d('0x53')](_0x23e7a5[_0xd16d('0x49')],[_0xd16d('0x54'),'id'])||{});}})[_0xd16d('0x25')](respondWithResult(_0x4385cc,null))[_0xd16d('0x44')](handleError(_0x4385cc,null));};exports['removeUsers']=function(_0x3e248e,_0x128028,_0x569954){return db[_0xd16d('0x2d')][_0xd16d('0x47')]({'where':{'id':_0x3e248e[_0xd16d('0x46')]['id']}})[_0xd16d('0x25')](handleEntityNotFound(_0x128028,null))['then'](function(_0x239e67){if(_0x239e67){return _0x239e67[_0xd16d('0x55')](_0x3e248e['query'][_0xd16d('0x54')])[_0xd16d('0x25')](function(){if(_[_0xd16d('0x56')](_0x3e248e[_0xd16d('0x32')][_0xd16d('0x54')])){for(var _0x5199b1=0x0;_0x5199b1<_0x3e248e[_0xd16d('0x32')][_0xd16d('0x54')][_0xd16d('0x37')];_0x5199b1+=0x1){socket['emit'](_0xd16d('0x57'),{'UserId':Number(_0x3e248e[_0xd16d('0x32')]['ids'][_0x5199b1]),'SquareProjectId':Number(_0x3e248e[_0xd16d('0x46')]['id'])});}}else{socket[_0xd16d('0x58')]('userSquareProject:remove',{'UserId':Number(_0x3e248e[_0xd16d('0x32')][_0xd16d('0x54')]),'SquareProjectId':Number(_0x3e248e[_0xd16d('0x46')]['id'])});}});}})[_0xd16d('0x25')](respondWithStatusCode(_0x128028,null))[_0xd16d('0x44')](handleError(_0x128028,null));};exports[_0xd16d('0x59')]=function(_0x1b8cdc,_0x309535,_0x1901fa){var _0x293b01={};var _0x1026b4={};var _0x10cd99;var _0x5d7daf;return db[_0xd16d('0x2d')][_0xd16d('0x5a')]({'where':{'id':_0x1b8cdc['params']['id']}})[_0xd16d('0x25')](handleEntityNotFound(_0x309535,null))[_0xd16d('0x25')](function(_0x2bed46){if(_0x2bed46){_0x10cd99=_0x2bed46;_0x1026b4['model']=_[_0xd16d('0x31')](db[_0xd16d('0x5b')][_0xd16d('0x2e')]);_0x1026b4[_0xd16d('0x32')]=_[_0xd16d('0x31')](_0x1b8cdc[_0xd16d('0x32')]);_0x1026b4[_0xd16d('0x33')]=_[_0xd16d('0x34')](_0x1026b4[_0xd16d('0x30')],_0x1026b4['query']);_0x293b01[_0xd16d('0x35')]=_[_0xd16d('0x34')](_0x1026b4[_0xd16d('0x30')],qs[_0xd16d('0x36')](_0x1b8cdc['query'][_0xd16d('0x36')]));_0x293b01[_0xd16d('0x35')]=_0x293b01[_0xd16d('0x35')][_0xd16d('0x37')]?_0x293b01[_0xd16d('0x35')]:_0x1026b4[_0xd16d('0x30')];_0x293b01[_0xd16d('0x5c')]=qs['sort'](_0x1b8cdc[_0xd16d('0x32')][_0xd16d('0x3a')]);_0x293b01['where']=qs['filters'](_[_0xd16d('0x3c')](_0x1b8cdc[_0xd16d('0x32')],_0x1026b4[_0xd16d('0x33')]));if(_0x1b8cdc['query'][_0xd16d('0x3e')]){_0x293b01['where']=_[_0xd16d('0x3d')](_0x293b01['where'],{'$or':_['map'](_0x293b01[_0xd16d('0x35')],function(_0x74b035){var _0xc872e6={};_0xc872e6[_0x74b035]={'$like':'%'+_0x1b8cdc[_0xd16d('0x32')][_0xd16d('0x3e')]+'%'};return _0xc872e6;})});}_0x293b01=_[_0xd16d('0x3d')]({},_0x293b01,_0x1b8cdc[_0xd16d('0x3f')]);return _0x10cd99[_0xd16d('0x59')](_0x293b01);}})[_0xd16d('0x25')](function(_0x32f931){if(_0x32f931){_0x5d7daf=_0x32f931[_0xd16d('0x37')];if(!_0x1b8cdc[_0xd16d('0x32')][_0xd16d('0x38')](_0xd16d('0x39'))){_0x293b01[_0xd16d('0x1f')]=qs[_0xd16d('0x1f')](_0x1b8cdc[_0xd16d('0x32')]['limit']);_0x293b01[_0xd16d('0x1e')]=qs[_0xd16d('0x1e')](_0x1b8cdc[_0xd16d('0x32')][_0xd16d('0x1e')]);}return _0x10cd99[_0xd16d('0x59')](_0x293b01);}})[_0xd16d('0x25')](function(_0x3b28fa){if(_0x3b28fa){return _0x3b28fa?{'count':_0x5d7daf,'rows':_0x3b28fa}:null;}})[_0xd16d('0x25')](respondWithResult(_0x309535,null))[_0xd16d('0x44')](handleError(_0x309535,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fd1ff92..9fce8ce 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 _0x906c=['hook','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xe01983,_0x508a21){var _0x3d5594=function(_0x493198){while(--_0x493198){_0xe01983['push'](_0xe01983['shift']());}};_0x3d5594(++_0x508a21);}(_0x906c,0x17d));var _0xc906=function(_0xd474a,_0x24491f){_0xd474a=_0xd474a-0x0;var _0xab3af2=_0x906c[_0xd474a];return _0xab3af2;};'use strict';var EventEmitter=require(_0xc906('0x0'));var SquareProject=require(_0xc906('0x1'))['db'][_0xc906('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc906('0x3')](0x0);var events={'afterCreate':_0xc906('0x4'),'afterUpdate':_0xc906('0x5'),'afterDestroy':_0xc906('0x6')};function emitEvent(_0x11b7f2){return function(_0xf58a83,_0x1d9c1e,_0x3421e6){SquareProjectEvents[_0xc906('0x7')](_0x11b7f2+':'+_0xf58a83['id'],_0xf58a83);SquareProjectEvents[_0xc906('0x7')](_0x11b7f2,_0xf58a83);_0x3421e6(null);};}for(var e in events){if(events[_0xc906('0x8')](e)){var event=events[e];SquareProject[_0xc906('0x9')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x573a=['remove','emit','hasOwnProperty','hook','events','SquareProject','setMaxListeners','save','update'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x573a,0x82));var _0xa573=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x573a[_0x258fb0];return _0x4d1afe;};'use strict';var EventEmitter=require(_0xa573('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa573('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa573('0x2')](0x0);var events={'afterCreate':_0xa573('0x3'),'afterUpdate':_0xa573('0x4'),'afterDestroy':_0xa573('0x5')};function emitEvent(_0x853b64){return function(_0x97d2b3,_0x48f7eb,_0xe22194){SquareProjectEvents[_0xa573('0x6')](_0x853b64+':'+_0x97d2b3['id'],_0x97d2b3);SquareProjectEvents[_0xa573('0x6')](_0x853b64,_0x97d2b3);_0xe22194(null);};}for(var e in events){if(events[_0xa573('0x7')](e)){var event=events[e];SquareProject[_0xa573('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 725a13a..efa1308 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x4aa7c6,_0x27bf43){var _0x1fdf9e=function(_0x159879){while(--_0x159879){_0x4aa7c6['push'](_0x4aa7c6['shift']());}};_0x1fdf9e(++_0x27bf43);}(_0xdb28,0x106));var _0x8db2=function(_0x50030f,_0x3de5a1){_0x50030f=_0x50030f-0x0;var _0x2b59df=_0xdb28[_0x50030f];return _0x2b59df;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','SquareProject','square_projects','util','api','moment','bluebird'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./squareProject.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3b84f32..95408fc 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 _0xa4e0=['map','model','attributes','catch','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','where','include'];(function(_0x46453e,_0x53de5a){var _0x1e155c=function(_0x118edf){while(--_0x118edf){_0x46453e['push'](_0x46453e['shift']());}};_0x1e155c(++_0x53de5a);}(_0xa4e0,0xeb));var _0x0a4e=function(_0x5edc32,_0x3ac808){_0x5edc32=_0x5edc32-0x0;var _0x4505a7=_0xa4e0[_0x5edc32];return _0x4505a7;};'use strict';var _=require(_0x0a4e('0x0'));var util=require('util');var moment=require(_0x0a4e('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a4e('0x3'))(_0x0a4e('0x4'));var config=require(_0x0a4e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0a4e('0x6')][_0x0a4e('0x7')]({'port':0x232a});config[_0x0a4e('0x8')]=_[_0x0a4e('0x9')](config[_0x0a4e('0x8')],{'host':_0x0a4e('0xa'),'port':0x18eb});var socket=require(_0x0a4e('0xb'))(new Redis(config[_0x0a4e('0x8')]));require('./squareProject.socket')[_0x0a4e('0xc')](socket);function respondWithRpcPromise(_0x1e01a9,_0x223dba,_0x43f2f1){return new BPromise(function(_0x1c1c35,_0x46950f){return client['request'](_0x1e01a9,_0x43f2f1)['then'](function(_0x46e9fe){logger[_0x0a4e('0xd')](_0x0a4e('0xe'),_0x223dba,_0x0a4e('0xf'));logger[_0x0a4e('0x10')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x223dba,'request\x20sent',JSON[_0x0a4e('0x11')](_0x46e9fe));if(_0x46e9fe[_0x0a4e('0x12')]){if(_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x13')]===0x1f4){logger['error']('SquareProject,\x20%s,\x20%s',_0x223dba,_0x46e9fe['error'][_0x0a4e('0x14')]);return _0x46950f(_0x46e9fe[_0x0a4e('0x12')]['message']);}logger[_0x0a4e('0x12')](_0x0a4e('0xe'),_0x223dba,_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x14')]);return _0x1c1c35(_0x46e9fe[_0x0a4e('0x12')][_0x0a4e('0x14')]);}else{logger[_0x0a4e('0xd')]('SquareProject,\x20%s,\x20%s',_0x223dba,_0x0a4e('0xf'));_0x1c1c35(_0x46e9fe[_0x0a4e('0x15')][_0x0a4e('0x14')]);}})['catch'](function(_0x14179a){logger['error'](_0x0a4e('0xe'),_0x223dba,_0x14179a);_0x46950f(_0x14179a);});});}exports[_0x0a4e('0x16')]=function(_0x40e685){var _0x4a9608=this;return new Promise(function(_0x1477cb,_0x2bb067){return db[_0x0a4e('0x17')][_0x0a4e('0x18')]({'raw':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1a')]===undefined?!![]:![]:!![],'where':_0x40e685[_0x0a4e('0x19')]?_0x40e685['options'][_0x0a4e('0x1b')]||null:null,'attributes':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')]['attributes']||null:null,'include':_0x40e685[_0x0a4e('0x19')]?_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0x40e685[_0x0a4e('0x19')][_0x0a4e('0x1c')],function(_0x310ca1){return{'model':db[_0x310ca1[_0x0a4e('0x1e')]],'as':_0x310ca1['as'],'attributes':_0x310ca1[_0x0a4e('0x1f')],'include':_0x310ca1[_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0x310ca1[_0x0a4e('0x1c')],function(_0xd21f7d){return{'model':db[_0xd21f7d[_0x0a4e('0x1e')]],'as':_0xd21f7d['as'],'attributes':_0xd21f7d[_0x0a4e('0x1f')],'include':_0xd21f7d[_0x0a4e('0x1c')]?_[_0x0a4e('0x1d')](_0xd21f7d[_0x0a4e('0x1c')],function(_0x3a94e4){return{'model':db[_0x3a94e4[_0x0a4e('0x1e')]],'as':_0x3a94e4['as'],'attributes':_0x3a94e4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ec197){logger[_0x0a4e('0xd')](_0x0a4e('0x16'),_0x40e685);logger[_0x0a4e('0x10')]('ShowSquareProject',_0x40e685,JSON[_0x0a4e('0x11')](_0x5ec197));_0x1477cb(_0x5ec197);})[_0x0a4e('0x20')](function(_0x5b61e6){logger[_0x0a4e('0x12')]('ShowSquareProject',_0x5b61e6[_0x0a4e('0x14')],_0x40e685);_0x2bb067(_0x4a9608['error'](0x1f4,_0x5b61e6[_0x0a4e('0x14')]));});});}; \ No newline at end of file +var _0xe72c=['SquareProject','find','options','where','map','include','model','attributes','stringify','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','ShowSquareProject'];(function(_0x36f228,_0x370354){var _0x2a150c=function(_0x270516){while(--_0x270516){_0x36f228['push'](_0x36f228['shift']());}};_0x2a150c(++_0x370354);}(_0xe72c,0xb8));var _0xce72=function(_0x461826,_0x5812ad){_0x461826=_0x461826-0x0;var _0x42cbd3=_0xe72c[_0x461826];return _0x42cbd3;};'use strict';var _=require(_0xce72('0x0'));var util=require(_0xce72('0x1'));var moment=require('moment');var BPromise=require(_0xce72('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce72('0x4'));var logger=require(_0xce72('0x5'))(_0xce72('0x6'));var config=require('../../config/environment');var jayson=require(_0xce72('0x7'));var client=jayson[_0xce72('0x8')][_0xce72('0x9')]({'port':0x232a});config['redis']=_[_0xce72('0xa')](config['redis'],{'host':_0xce72('0xb'),'port':0x18eb});var socket=require(_0xce72('0xc'))(new Redis(config[_0xce72('0xd')]));require(_0xce72('0xe'))[_0xce72('0xf')](socket);function respondWithRpcPromise(_0x3acdb7,_0x5f0802,_0x54da14){return new BPromise(function(_0x71cfb9,_0x5be6dd){return client['request'](_0x3acdb7,_0x54da14)[_0xce72('0x10')](function(_0xdb9045){logger[_0xce72('0x11')](_0xce72('0x12'),_0x5f0802,_0xce72('0x13'));logger[_0xce72('0x14')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x5f0802,'request\x20sent',JSON['stringify'](_0xdb9045));if(_0xdb9045[_0xce72('0x15')]){if(_0xdb9045[_0xce72('0x15')][_0xce72('0x16')]===0x1f4){logger[_0xce72('0x15')](_0xce72('0x12'),_0x5f0802,_0xdb9045[_0xce72('0x15')][_0xce72('0x17')]);return _0x5be6dd(_0xdb9045['error'][_0xce72('0x17')]);}logger[_0xce72('0x15')](_0xce72('0x12'),_0x5f0802,_0xdb9045[_0xce72('0x15')]['message']);return _0x71cfb9(_0xdb9045[_0xce72('0x15')][_0xce72('0x17')]);}else{logger[_0xce72('0x11')](_0xce72('0x12'),_0x5f0802,_0xce72('0x13'));_0x71cfb9(_0xdb9045['result']['message']);}})[_0xce72('0x18')](function(_0x72f561){logger[_0xce72('0x15')](_0xce72('0x12'),_0x5f0802,_0x72f561);_0x5be6dd(_0x72f561);});});}exports[_0xce72('0x19')]=function(_0x9854ef){var _0x33a7ea=this;return new Promise(function(_0x4d99aa,_0x364ab7){return db[_0xce72('0x1a')][_0xce72('0x1b')]({'raw':_0x9854ef['options']?_0x9854ef['options']['raw']===undefined?!![]:![]:!![],'where':_0x9854ef[_0xce72('0x1c')]?_0x9854ef[_0xce72('0x1c')][_0xce72('0x1d')]||null:null,'attributes':_0x9854ef[_0xce72('0x1c')]?_0x9854ef['options']['attributes']||null:null,'include':_0x9854ef['options']?_0x9854ef[_0xce72('0x1c')]['include']?_[_0xce72('0x1e')](_0x9854ef[_0xce72('0x1c')][_0xce72('0x1f')],function(_0x16d56e){return{'model':db[_0x16d56e[_0xce72('0x20')]],'as':_0x16d56e['as'],'attributes':_0x16d56e['attributes'],'include':_0x16d56e[_0xce72('0x1f')]?_[_0xce72('0x1e')](_0x16d56e['include'],function(_0x524df4){return{'model':db[_0x524df4[_0xce72('0x20')]],'as':_0x524df4['as'],'attributes':_0x524df4[_0xce72('0x21')],'include':_0x524df4[_0xce72('0x1f')]?_['map'](_0x524df4[_0xce72('0x1f')],function(_0x85195e){return{'model':db[_0x85195e[_0xce72('0x20')]],'as':_0x85195e['as'],'attributes':_0x85195e[_0xce72('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce72('0x10')](function(_0x59f440){logger['info'](_0xce72('0x19'),_0x9854ef);logger['debug'](_0xce72('0x19'),_0x9854ef,JSON[_0xce72('0x22')](_0x59f440));_0x4d99aa(_0x59f440);})[_0xce72('0x18')](function(_0x3367d0){logger[_0xce72('0x15')](_0xce72('0x19'),_0x3367d0[_0xce72('0x17')],_0x9854ef);_0x364ab7(_0x33a7ea['error'](0x1f4,_0x3367d0[_0xce72('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index b8c22e6..d9976fb 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 _0x187d=['./squareProject.events','remove','update','emit','removeListener','length','squareProject:'];(function(_0x38eaaf,_0x4093df){var _0x12dfef=function(_0x1e867a){while(--_0x1e867a){_0x38eaaf['push'](_0x38eaaf['shift']());}};_0x12dfef(++_0x4093df);}(_0x187d,0x93));var _0xd187=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x187d[_0x24237f];return _0x48298e;};'use strict';var SquareProjectEvents=require(_0xd187('0x0'));var events=['save',_0xd187('0x1'),_0xd187('0x2')];function createListener(_0x44d5f6,_0x1cb41f){return function(_0x18498b){_0x1cb41f[_0xd187('0x3')](_0x44d5f6,_0x18498b);};}function removeListener(_0x58622a,_0x28fa0b){return function(){SquareProjectEvents[_0xd187('0x4')](_0x58622a,_0x28fa0b);};}exports['register']=function(_0x1d2533){for(var _0x58ee7=0x0,_0x444a60=events[_0xd187('0x5')];_0x58ee7<_0x444a60;_0x58ee7++){var _0x28ce2f=events[_0x58ee7];var _0x2d6992=createListener(_0xd187('0x6')+_0x28ce2f,_0x1d2533);SquareProjectEvents['on'](_0x28ce2f,_0x2d6992);}}; \ No newline at end of file +var _0x2eb2=['squareProject:','save','remove','update','register','length'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x2eb2[_0x4e1d03];return _0x362d4b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2')];function createListener(_0x1a002b,_0x1dd079){return function(_0xaf32cf){_0x1dd079['emit'](_0x1a002b,_0xaf32cf);};}function removeListener(_0x27732f,_0x4efe67){return function(){SquareProjectEvents['removeListener'](_0x27732f,_0x4efe67);};}exports[_0x22eb('0x3')]=function(_0x10e116){for(var _0x35dd5b=0x0,_0x2a9850=events[_0x22eb('0x4')];_0x35dd5b<_0x2a9850;_0x35dd5b++){var _0x396806=events[_0x35dd5b];var _0x33ddef=createListener(_0x22eb('0x5')+_0x396806,_0x10e116);SquareProjectEvents['on'](_0x396806,_0x33ddef);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f69a8e9..aadd95f 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 _0x5240=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','/:id/delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5f1498,_0x1295b2){var _0x3db54e=function(_0x3416c8){while(--_0x3416c8){_0x5f1498['push'](_0x5f1498['shift']());}};_0x3db54e(++_0x1295b2);}(_0x5240,0x197));var _0x0524=function(_0x495c53,_0x5dd58b){_0x495c53=_0x495c53-0x0;var _0x20abe0=_0x5240[_0x495c53];return _0x20abe0;};'use strict';var multer=require(_0x0524('0x0'));var util=require(_0x0524('0x1'));var path=require(_0x0524('0x2'));var timeout=require(_0x0524('0x3'));var express=require(_0x0524('0x4'));var router=express[_0x0524('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0524('0x6'));var config=require(_0x0524('0x7'));var controller=require(_0x0524('0x8'));router[_0x0524('0x9')]('/',auth[_0x0524('0xa')](),controller[_0x0524('0xb')]);router[_0x0524('0x9')](_0x0524('0xc'),auth['isAuthenticated'](),controller[_0x0524('0xd')]);router[_0x0524('0x9')](_0x0524('0xe'),auth[_0x0524('0xa')](),controller[_0x0524('0xf')]);router[_0x0524('0x10')]('/',auth['isAuthenticated'](),controller[_0x0524('0x11')]);router['put'](_0x0524('0xc'),auth[_0x0524('0xa')](),controller[_0x0524('0x12')]);router[_0x0524('0x13')](_0x0524('0x14'),auth[_0x0524('0xa')](),controller[_0x0524('0x15')]);module[_0x0524('0x16')]=router; \ No newline at end of file +var _0x2e5c=['/:id/delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put'];(function(_0x1bf713,_0x2a079b){var _0x4b2b7b=function(_0x25f828){while(--_0x25f828){_0x1bf713['push'](_0x1bf713['shift']());}};_0x4b2b7b(++_0x2a079b);}(_0x2e5c,0x1de));var _0xc2e5=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x2e5c[_0x36884e];return _0x1cc367;};'use strict';var multer=require('multer');var util=require(_0xc2e5('0x0'));var path=require(_0xc2e5('0x1'));var timeout=require(_0xc2e5('0x2'));var express=require(_0xc2e5('0x3'));var router=express['Router']();var auth=require(_0xc2e5('0x4'));var interaction=require(_0xc2e5('0x5'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xc2e5('0x6')]('/',auth[_0xc2e5('0x7')](),controller['index']);router[_0xc2e5('0x6')](_0xc2e5('0x8'),auth[_0xc2e5('0x7')](),controller[_0xc2e5('0x9')]);router[_0xc2e5('0x6')](_0xc2e5('0xa'),auth[_0xc2e5('0x7')](),controller[_0xc2e5('0xb')]);router[_0xc2e5('0xc')]('/',auth[_0xc2e5('0x7')](),controller[_0xc2e5('0xd')]);router[_0xc2e5('0xe')](_0xc2e5('0x8'),auth[_0xc2e5('0x7')](),controller['update']);router['delete'](_0xc2e5('0xf'),auth[_0xc2e5('0x7')](),controller['destroy']);module[_0xc2e5('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 b3536c6..c550869 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 _0x5b7b=['lastIndexOf','sequelize','STRING','VIRTUAL','savePath','substring'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5b7b,0xd9));var _0xb5b7=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0x5b7b[_0x415f7e];return _0x311ff4;};'use strict';var Sequelize=require(_0xb5b7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb5b7('0x1')]},'callerid':{'type':Sequelize[_0xb5b7('0x1')]},'calleridname':{'type':Sequelize[_0xb5b7('0x1')]},'context':{'type':Sequelize[_0xb5b7('0x1')]},'extension':{'type':Sequelize[_0xb5b7('0x1')]},'priority':{'type':Sequelize[_0xb5b7('0x1')]},'accountcode':{'type':Sequelize[_0xb5b7('0x1')]},'dnid':{'type':Sequelize[_0xb5b7('0x1')]},'projectName':{'type':Sequelize[_0xb5b7('0x1')]},'saveName':{'type':Sequelize[_0xb5b7('0x1')]},'filename':{'type':Sequelize[_0xb5b7('0x1')]},'savePath':{'type':Sequelize[_0xb5b7('0x1')]},'format':{'type':Sequelize[_0xb5b7('0x2')],'get':function(){var _0x3c512e='';var _0x2e9001=this['getDataValue'](_0xb5b7('0x3'));if(_0x2e9001){_0x3c512e=_0x2e9001[_0xb5b7('0x4')](_0x2e9001[_0xb5b7('0x5')]('.'));}return _0x3c512e;}}}; \ No newline at end of file +var _0x939a=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x43c920,_0x187315){var _0x16e4c0=function(_0xa1ae11){while(--_0xa1ae11){_0x43c920['push'](_0x43c920['shift']());}};_0x16e4c0(++_0x187315);}(_0x939a,0x1d7));var _0xa939=function(_0x405fb7,_0x2131fd){_0x405fb7=_0x405fb7-0x0;var _0xbcca42=_0x939a[_0x405fb7];return _0xbcca42;};'use strict';var Sequelize=require(_0xa939('0x0'));module[_0xa939('0x1')]={'uniqueid':{'type':Sequelize[_0xa939('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa939('0x2')]},'context':{'type':Sequelize[_0xa939('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa939('0x2')]},'accountcode':{'type':Sequelize[_0xa939('0x2')]},'dnid':{'type':Sequelize[_0xa939('0x2')]},'projectName':{'type':Sequelize[_0xa939('0x2')]},'saveName':{'type':Sequelize[_0xa939('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xa939('0x3')],'get':function(){var _0x2c14c0='';var _0xf6ecc=this[_0xa939('0x4')](_0xa939('0x5'));if(_0xf6ecc){_0x2c14c0=_0xf6ecc[_0xa939('0x6')](_0xf6ecc[_0xa939('0x7')]('.'));}return _0x2c14c0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e85289b..ba8d4f9 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 _0xf689=['api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','options','find','create','catch','update','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x282cbf,_0x4da8b9){var _0x2e3596=function(_0x59156d){while(--_0x59156d){_0x282cbf['push'](_0x282cbf['shift']());}};_0x2e3596(++_0x4da8b9);}(_0xf689,0x1e1));var _0x9f68=function(_0x5ccf08,_0x1898a0){_0x5ccf08=_0x5ccf08-0x0;var _0x2143de=_0xf689[_0x5ccf08];return _0x2143de;};'use strict';var pdf=require(_0x9f68('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9f68('0x1'));var zipdir=require(_0x9f68('0x2'));var jsonpatch=require(_0x9f68('0x3'));var rp=require(_0x9f68('0x4'));var moment=require(_0x9f68('0x5'));var BPromise=require(_0x9f68('0x6'));var Mustache=require(_0x9f68('0x7'));var util=require(_0x9f68('0x8'));var path=require(_0x9f68('0x9'));var sox=require(_0x9f68('0xa'));var csv=require(_0x9f68('0xb'));var ejs=require(_0x9f68('0xc'));var fs=require('fs');var _=require(_0x9f68('0xd'));var squel=require(_0x9f68('0xe'));var crypto=require(_0x9f68('0xf'));var jsforce=require(_0x9f68('0x10'));var deskjs=require(_0x9f68('0x11'));var toCsv=require(_0x9f68('0xb'));var querystring=require(_0x9f68('0x12'));var Papa=require('papaparse');var Redis=require(_0x9f68('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9f68('0x14'));var as=require(_0x9f68('0x15'));var hardwareService=require(_0x9f68('0x16'));var logger=require(_0x9f68('0x17'))(_0x9f68('0x18'));var utils=require(_0x9f68('0x19'));var config=require(_0x9f68('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29feb9,_0x161455){_0x161455=_0x161455||0xcc;return function(_0x4739c8){if(_0x4739c8){return _0x29feb9[_0x9f68('0x1b')](_0x161455);}return _0x29feb9[_0x9f68('0x1c')](_0x161455)['end']();};}function respondWithResult(_0x23ba8b,_0x420c1e){_0x420c1e=_0x420c1e||0xc8;return function(_0x2dea12){if(_0x2dea12){return _0x23ba8b[_0x9f68('0x1c')](_0x420c1e)['json'](_0x2dea12);}};}function respondWithFilteredResult(_0x580d19,_0x923d8d){return function(_0x4a2027){if(_0x4a2027){var _0x5df916=_0x4a2027[_0x9f68('0x1d')],_0x3d0495=_0x923d8d['offset'],_0x761bab=_0x923d8d[_0x9f68('0x1e')]+_0x923d8d[_0x9f68('0x1f')],_0x3c0af0;if(_0x761bab>=_0x5df916){_0x761bab=_0x5df916;_0x3c0af0=0xc8;}else{_0x3c0af0=0xce;}_0x580d19[_0x9f68('0x1c')](_0x3c0af0);return _0x580d19[_0x9f68('0x20')](_0x9f68('0x21'),_0x3d0495+'-'+_0x761bab+'/'+_0x5df916)[_0x9f68('0x22')](_0x4a2027);}return null;};}function patchUpdates(_0x32ffd3){return function(_0x2c7334){try{jsonpatch[_0x9f68('0x23')](_0x2c7334,_0x32ffd3,!![]);}catch(_0x2f07d8){return BPromise[_0x9f68('0x24')](_0x2f07d8);}return _0x2c7334[_0x9f68('0x25')]();};}function saveUpdates(_0x11c3b0,_0x5bab67){return function(_0x408719){if(_0x408719){return _0x408719['update'](_0x11c3b0)[_0x9f68('0x26')](function(_0x10a0dc){return _0x10a0dc;});}return null;};}function removeEntity(_0x23bce9,_0x5d0920){return function(_0x3fb512){if(_0x3fb512){return _0x3fb512['destroy']()[_0x9f68('0x26')](function(){_0x23bce9[_0x9f68('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2432b9,_0x274a14){return function(_0x3090fa){if(!_0x3090fa){_0x2432b9[_0x9f68('0x1b')](0x194);}return _0x3090fa;};}function handleError(_0x30a5c9,_0x4f79ec){_0x4f79ec=_0x4f79ec||0x1f4;return function(_0x49cecc){logger[_0x9f68('0x27')](_0x49cecc[_0x9f68('0x28')]);if(_0x49cecc['name']){delete _0x49cecc[_0x9f68('0x29')];}_0x30a5c9[_0x9f68('0x1c')](_0x4f79ec)[_0x9f68('0x2a')](_0x49cecc);};}exports[_0x9f68('0x2b')]=function(_0x1bf4b1,_0x561b7c){var _0x3de17b={},_0x41b21b={},_0x43140e={'count':0x0,'rows':[]};var _0x358c15=_[_0x9f68('0x2c')](db[_0x9f68('0x2d')][_0x9f68('0x2e')],function(_0x1a1bb9){return{'name':_0x1a1bb9[_0x9f68('0x2f')],'type':_0x1a1bb9[_0x9f68('0x30')]['key']};});_0x41b21b['model']=_['map'](_0x358c15,'name');_0x41b21b['query']=_[_0x9f68('0x31')](_0x1bf4b1[_0x9f68('0x32')]);_0x41b21b[_0x9f68('0x33')]=_[_0x9f68('0x34')](_0x41b21b[_0x9f68('0x35')],_0x41b21b['query']);_0x3de17b['attributes']=_['intersection'](_0x41b21b[_0x9f68('0x35')],qs['fields'](_0x1bf4b1['query'][_0x9f68('0x36')]));_0x3de17b['attributes']=_0x3de17b[_0x9f68('0x37')][_0x9f68('0x38')]?_0x3de17b[_0x9f68('0x37')]:_0x41b21b['model'];if(!_0x1bf4b1[_0x9f68('0x32')]['hasOwnProperty'](_0x9f68('0x39'))){_0x3de17b[_0x9f68('0x1f')]=qs[_0x9f68('0x1f')](_0x1bf4b1['query']['limit']);_0x3de17b[_0x9f68('0x1e')]=qs[_0x9f68('0x1e')](_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x1e')]);}_0x3de17b[_0x9f68('0x3a')]=qs[_0x9f68('0x3b')](_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x3b')]);_0x3de17b[_0x9f68('0x3c')]=qs[_0x9f68('0x33')](_[_0x9f68('0x3d')](_0x1bf4b1[_0x9f68('0x32')],_0x41b21b[_0x9f68('0x33')]),_0x358c15);if(_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x3e')]){_0x3de17b[_0x9f68('0x3c')]=_['merge'](_0x3de17b[_0x9f68('0x3c')],{'$or':_[_0x9f68('0x2c')](_0x358c15,function(_0x3c7d44){if(_0x3c7d44['type']!==_0x9f68('0x3f')){var _0x25f624={};_0x25f624[_0x3c7d44[_0x9f68('0x29')]]={'$like':'%'+_0x1bf4b1['query'][_0x9f68('0x3e')]+'%'};return _0x25f624;}})});}_0x3de17b=_[_0x9f68('0x40')]({},_0x3de17b,_0x1bf4b1['options']);var _0x11b3a5={'where':_0x3de17b[_0x9f68('0x3c')]};return db[_0x9f68('0x2d')][_0x9f68('0x1d')](_0x11b3a5)[_0x9f68('0x26')](function(_0x16a638){_0x43140e[_0x9f68('0x1d')]=_0x16a638;if(_0x1bf4b1[_0x9f68('0x32')][_0x9f68('0x41')]){_0x3de17b[_0x9f68('0x42')]=[{'all':!![]}];}return db[_0x9f68('0x2d')][_0x9f68('0x43')](_0x3de17b);})[_0x9f68('0x26')](function(_0xd75a0d){_0x43140e[_0x9f68('0x44')]=_0xd75a0d;return _0x43140e;})[_0x9f68('0x26')](respondWithFilteredResult(_0x561b7c,_0x3de17b))['catch'](handleError(_0x561b7c,null));};exports[_0x9f68('0x45')]=function(_0x297879,_0x50a01f){var _0x10bcdb={'raw':!![],'where':{'id':_0x297879[_0x9f68('0x46')]['id']}},_0x4250a8={};_0x4250a8['model']=_[_0x9f68('0x31')](db['SquareRecording'][_0x9f68('0x2e')]);_0x4250a8[_0x9f68('0x32')]=_[_0x9f68('0x31')](_0x297879[_0x9f68('0x32')]);_0x4250a8[_0x9f68('0x33')]=_[_0x9f68('0x34')](_0x4250a8[_0x9f68('0x35')],_0x4250a8[_0x9f68('0x32')]);_0x10bcdb[_0x9f68('0x37')]=_[_0x9f68('0x34')](_0x4250a8[_0x9f68('0x35')],qs[_0x9f68('0x36')](_0x297879[_0x9f68('0x32')]['fields']));_0x10bcdb['attributes']=_0x10bcdb[_0x9f68('0x37')][_0x9f68('0x38')]?_0x10bcdb[_0x9f68('0x37')]:_0x4250a8[_0x9f68('0x35')];if(_0x297879['query']['includeAll']){_0x10bcdb[_0x9f68('0x42')]=[{'all':!![]}];}_0x10bcdb=_[_0x9f68('0x40')]({},_0x10bcdb,_0x297879[_0x9f68('0x47')]);return db['SquareRecording'][_0x9f68('0x48')](_0x10bcdb)[_0x9f68('0x26')](handleEntityNotFound(_0x50a01f,null))[_0x9f68('0x26')](respondWithResult(_0x50a01f,null))['catch'](handleError(_0x50a01f,null));};exports[_0x9f68('0x49')]=function(_0x2c4236,_0x492c19){return db[_0x9f68('0x2d')][_0x9f68('0x49')](_0x2c4236['body'],{})[_0x9f68('0x26')](respondWithResult(_0x492c19,0xc9))[_0x9f68('0x4a')](handleError(_0x492c19,null));};exports[_0x9f68('0x4b')]=function(_0x3a4f03,_0x62510){if(_0x3a4f03[_0x9f68('0x4c')]['id']){delete _0x3a4f03[_0x9f68('0x4c')]['id'];}return db[_0x9f68('0x2d')]['find']({'where':{'id':_0x3a4f03[_0x9f68('0x46')]['id']}})[_0x9f68('0x26')](handleEntityNotFound(_0x62510,null))['then'](saveUpdates(_0x3a4f03[_0x9f68('0x4c')],null))['then'](respondWithResult(_0x62510,null))[_0x9f68('0x4a')](handleError(_0x62510,null));};exports[_0x9f68('0x4d')]=function(_0x15d554,_0x31cd5e,_0x242cd6){var _0x305735=require(_0x9f68('0x4e'));var _0x1f7e96=![];var _0x12808b={};if(_0x15d554[_0x9f68('0x32')][_0x9f68('0x30')]&&_0x15d554['query']['type']===_0x9f68('0x4f')){_0x12808b['uniqueid']=_0x15d554[_0x9f68('0x46')]['id'];}else{_0x12808b['id']=_0x15d554['params']['id'];}return db['SquareRecording']['find']({'where':_0x12808b,'attributes':['id','savePath',_0x9f68('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x31cd5e,null))['then'](function(_0x18dd33){if(_0x18dd33){var _0xf19ea0=_0x18dd33[_0x9f68('0x51')];var _0x38fa88=util['format'](_0x9f68('0x52'),_0xf19ea0);if(fs['existsSync'](_0x38fa88)){_0x1f7e96=!![];return _0x305735[_0x9f68('0x53')](_0x38fa88,_0xf19ea0,config[_0x9f68('0x54')][_0x9f68('0x55')])['then'](function(){return _0x18dd33;});}return _0x18dd33;}})[_0x9f68('0x26')](function(_0x41e8ad){if(_0x41e8ad){var _0x2766f3=_0x41e8ad[_0x9f68('0x51')];if(!fs['existsSync'](_0x2766f3)){throw new db[(_0x9f68('0x56'))][(_0x9f68('0x57'))](_0x9f68('0x58'));}if(_0x41e8ad['filename']){return _0x31cd5e[_0x9f68('0x4d')](_0x2766f3,_0x41e8ad[_0x9f68('0x50')]+path['extname'](_0x2766f3),function(){if(_0x1f7e96){fs[_0x9f68('0x59')](_0x2766f3);}});}else{return _0x31cd5e['download'](_0x2766f3,function(_0x27a311){if(_0x1f7e96){fs[_0x9f68('0x59')](_0x2766f3);}});}}})[_0x9f68('0x4a')](function(_0x4f26a1){if(_0x4f26a1['message']===_0x9f68('0x58')){_0x31cd5e[_0x9f68('0x1c')](0x194)[_0x9f68('0x2a')](_0x9f68('0x5a'));}else{return handleError(_0x31cd5e,null);}});};exports['destroy']=function(_0x29aebe,_0x262a5b){return db['SquareRecording'][_0x9f68('0x48')]({'where':{'id':_0x29aebe['params']['id']}})[_0x9f68('0x26')](function(_0x4fbb19){if(!_0x4fbb19)throw new ReferenceError(_0x9f68('0x5b'));return _0x4fbb19;})[_0x9f68('0x26')](function(_0x79d182){var _0x497b58=_0x79d182[_0x9f68('0x51')];logger['info'](_0x9f68('0x5c'),_0x497b58);if(!_[_0x9f68('0x5d')](_0x79d182[_0x9f68('0x51')])&&fs[_0x9f68('0x5e')](_0x497b58)){logger[_0x9f68('0x5f')](_0x9f68('0x60')+_0x497b58+_0x9f68('0x61'));fs['unlinkSync'](_0x497b58);}_0x497b58=_0x497b58+_0x9f68('0x62');if(!_[_0x9f68('0x5d')](_0x79d182[_0x9f68('0x51')])&&fs[_0x9f68('0x5e')](_0x497b58)){logger[_0x9f68('0x5f')](_0x9f68('0x60')+_0x497b58+_0x9f68('0x61'));fs[_0x9f68('0x63')](_0x497b58);}return _0x79d182;})[_0x9f68('0x26')](function(_0x4a1b7c){if(!_0x4a1b7c)throw new InternalError();return _0x4a1b7c['destroy']();})[_0x9f68('0x26')](function(){_0x262a5b[_0x9f68('0x1c')](0xcc)[_0x9f68('0x64')]();})[_0x9f68('0x4a')](handleError(_0x262a5b,null));}; \ No newline at end of file +var _0xbce6=['File:\x20\x22','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','Not\x20found','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil'];(function(_0x5639e1,_0x421603){var _0x197e82=function(_0x150da4){while(--_0x150da4){_0x5639e1['push'](_0x5639e1['shift']());}};_0x197e82(++_0x421603);}(_0xbce6,0xc7));var _0x6bce=function(_0x2272c3,_0x4e81bc){_0x2272c3=_0x2272c3-0x0;var _0x43645f=_0xbce6[_0x2272c3];return _0x43645f;};'use strict';var pdf=require(_0x6bce('0x0'));var emlformat=require(_0x6bce('0x1'));var rimraf=require(_0x6bce('0x2'));var zipdir=require(_0x6bce('0x3'));var jsonpatch=require(_0x6bce('0x4'));var rp=require('request-promise');var moment=require(_0x6bce('0x5'));var BPromise=require(_0x6bce('0x6'));var Mustache=require(_0x6bce('0x7'));var util=require('util');var path=require(_0x6bce('0x8'));var sox=require(_0x6bce('0x9'));var csv=require(_0x6bce('0xa'));var ejs=require(_0x6bce('0xb'));var fs=require('fs');var _=require(_0x6bce('0xc'));var squel=require('squel');var crypto=require(_0x6bce('0xd'));var jsforce=require(_0x6bce('0xe'));var deskjs=require(_0x6bce('0xf'));var toCsv=require(_0x6bce('0xa'));var querystring=require(_0x6bce('0x10'));var Papa=require(_0x6bce('0x11'));var Redis=require(_0x6bce('0x12'));var authService=require(_0x6bce('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6bce('0x14'));var hardwareService=require(_0x6bce('0x15'));var logger=require(_0x6bce('0x16'))(_0x6bce('0x17'));var utils=require(_0x6bce('0x18'));var config=require('../../config/environment');var db=require(_0x6bce('0x19'))['db'];function respondWithStatusCode(_0x3c3580,_0x595854){_0x595854=_0x595854||0xcc;return function(_0x4a29bf){if(_0x4a29bf){return _0x3c3580['sendStatus'](_0x595854);}return _0x3c3580[_0x6bce('0x1a')](_0x595854)[_0x6bce('0x1b')]();};}function respondWithResult(_0xdc4eb3,_0x5b72db){_0x5b72db=_0x5b72db||0xc8;return function(_0x5784f2){if(_0x5784f2){return _0xdc4eb3[_0x6bce('0x1a')](_0x5b72db)[_0x6bce('0x1c')](_0x5784f2);}};}function respondWithFilteredResult(_0x2ad97e,_0xa1d70){return function(_0x3c9474){if(_0x3c9474){var _0x42c7ec=_0x3c9474[_0x6bce('0x1d')],_0x1b71bd=_0xa1d70[_0x6bce('0x1e')],_0x4e7b13=_0xa1d70[_0x6bce('0x1e')]+_0xa1d70[_0x6bce('0x1f')],_0x5276c4;if(_0x4e7b13>=_0x42c7ec){_0x4e7b13=_0x42c7ec;_0x5276c4=0xc8;}else{_0x5276c4=0xce;}_0x2ad97e['status'](_0x5276c4);return _0x2ad97e['set']('Content-Range',_0x1b71bd+'-'+_0x4e7b13+'/'+_0x42c7ec)[_0x6bce('0x1c')](_0x3c9474);}return null;};}function patchUpdates(_0x5209bc){return function(_0x4ae844){try{jsonpatch[_0x6bce('0x20')](_0x4ae844,_0x5209bc,!![]);}catch(_0x381639){return BPromise[_0x6bce('0x21')](_0x381639);}return _0x4ae844[_0x6bce('0x22')]();};}function saveUpdates(_0x215414,_0x471b6c){return function(_0x46c484){if(_0x46c484){return _0x46c484[_0x6bce('0x23')](_0x215414)[_0x6bce('0x24')](function(_0x3567c4){return _0x3567c4;});}return null;};}function removeEntity(_0x4401ea,_0x2217fd){return function(_0xda90e7){if(_0xda90e7){return _0xda90e7['destroy']()[_0x6bce('0x24')](function(){_0x4401ea[_0x6bce('0x1a')](0xcc)[_0x6bce('0x1b')]();});}};}function handleEntityNotFound(_0x15ea44,_0x4d860c){return function(_0x3cd929){if(!_0x3cd929){_0x15ea44[_0x6bce('0x25')](0x194);}return _0x3cd929;};}function handleError(_0x3b1889,_0x5b6a02){_0x5b6a02=_0x5b6a02||0x1f4;return function(_0x315061){logger[_0x6bce('0x26')](_0x315061[_0x6bce('0x27')]);if(_0x315061[_0x6bce('0x28')]){delete _0x315061[_0x6bce('0x28')];}_0x3b1889[_0x6bce('0x1a')](_0x5b6a02)[_0x6bce('0x29')](_0x315061);};}exports[_0x6bce('0x2a')]=function(_0x57dd47,_0x46f885){var _0x578a6e={},_0x24726f={},_0x46d0ba={'count':0x0,'rows':[]};var _0x1c7410=_[_0x6bce('0x2b')](db[_0x6bce('0x2c')]['rawAttributes'],function(_0x11fa82){return{'name':_0x11fa82[_0x6bce('0x2d')],'type':_0x11fa82['type'][_0x6bce('0x2e')]};});_0x24726f[_0x6bce('0x2f')]=_['map'](_0x1c7410,'name');_0x24726f[_0x6bce('0x30')]=_[_0x6bce('0x31')](_0x57dd47[_0x6bce('0x30')]);_0x24726f[_0x6bce('0x32')]=_[_0x6bce('0x33')](_0x24726f[_0x6bce('0x2f')],_0x24726f[_0x6bce('0x30')]);_0x578a6e[_0x6bce('0x34')]=_[_0x6bce('0x33')](_0x24726f[_0x6bce('0x2f')],qs[_0x6bce('0x35')](_0x57dd47[_0x6bce('0x30')][_0x6bce('0x35')]));_0x578a6e[_0x6bce('0x34')]=_0x578a6e[_0x6bce('0x34')][_0x6bce('0x36')]?_0x578a6e['attributes']:_0x24726f[_0x6bce('0x2f')];if(!_0x57dd47['query'][_0x6bce('0x37')](_0x6bce('0x38'))){_0x578a6e[_0x6bce('0x1f')]=qs[_0x6bce('0x1f')](_0x57dd47[_0x6bce('0x30')]['limit']);_0x578a6e[_0x6bce('0x1e')]=qs[_0x6bce('0x1e')](_0x57dd47['query'][_0x6bce('0x1e')]);}_0x578a6e[_0x6bce('0x39')]=qs[_0x6bce('0x3a')](_0x57dd47[_0x6bce('0x30')]['sort']);_0x578a6e['where']=qs['filters'](_[_0x6bce('0x3b')](_0x57dd47[_0x6bce('0x30')],_0x24726f[_0x6bce('0x32')]),_0x1c7410);if(_0x57dd47[_0x6bce('0x30')][_0x6bce('0x3c')]){_0x578a6e[_0x6bce('0x3d')]=_[_0x6bce('0x3e')](_0x578a6e['where'],{'$or':_[_0x6bce('0x2b')](_0x1c7410,function(_0x2bc68d){if(_0x2bc68d[_0x6bce('0x3f')]!==_0x6bce('0x40')){var _0x3b4da4={};_0x3b4da4[_0x2bc68d[_0x6bce('0x28')]]={'$like':'%'+_0x57dd47[_0x6bce('0x30')][_0x6bce('0x3c')]+'%'};return _0x3b4da4;}})});}_0x578a6e=_['merge']({},_0x578a6e,_0x57dd47['options']);var _0x26c0d3={'where':_0x578a6e[_0x6bce('0x3d')]};return db['SquareRecording'][_0x6bce('0x1d')](_0x26c0d3)[_0x6bce('0x24')](function(_0x1a7bb6){_0x46d0ba['count']=_0x1a7bb6;if(_0x57dd47[_0x6bce('0x30')][_0x6bce('0x41')]){_0x578a6e[_0x6bce('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0x6bce('0x43')](_0x578a6e);})[_0x6bce('0x24')](function(_0x27dc90){_0x46d0ba['rows']=_0x27dc90;return _0x46d0ba;})[_0x6bce('0x24')](respondWithFilteredResult(_0x46f885,_0x578a6e))[_0x6bce('0x44')](handleError(_0x46f885,null));};exports['show']=function(_0x3f4061,_0x4e9bec){var _0x3ec78f={'raw':!![],'where':{'id':_0x3f4061['params']['id']}},_0x4d158c={};_0x4d158c['model']=_[_0x6bce('0x31')](db[_0x6bce('0x2c')][_0x6bce('0x45')]);_0x4d158c[_0x6bce('0x30')]=_[_0x6bce('0x31')](_0x3f4061[_0x6bce('0x30')]);_0x4d158c[_0x6bce('0x32')]=_[_0x6bce('0x33')](_0x4d158c['model'],_0x4d158c[_0x6bce('0x30')]);_0x3ec78f['attributes']=_[_0x6bce('0x33')](_0x4d158c['model'],qs[_0x6bce('0x35')](_0x3f4061['query'][_0x6bce('0x35')]));_0x3ec78f[_0x6bce('0x34')]=_0x3ec78f[_0x6bce('0x34')]['length']?_0x3ec78f[_0x6bce('0x34')]:_0x4d158c[_0x6bce('0x2f')];if(_0x3f4061[_0x6bce('0x30')]['includeAll']){_0x3ec78f[_0x6bce('0x42')]=[{'all':!![]}];}_0x3ec78f=_[_0x6bce('0x3e')]({},_0x3ec78f,_0x3f4061['options']);return db[_0x6bce('0x2c')][_0x6bce('0x46')](_0x3ec78f)[_0x6bce('0x24')](handleEntityNotFound(_0x4e9bec,null))[_0x6bce('0x24')](respondWithResult(_0x4e9bec,null))[_0x6bce('0x44')](handleError(_0x4e9bec,null));};exports['create']=function(_0x2212ba,_0x3afeea){return db[_0x6bce('0x2c')][_0x6bce('0x47')](_0x2212ba[_0x6bce('0x48')],{})['then'](respondWithResult(_0x3afeea,0xc9))['catch'](handleError(_0x3afeea,null));};exports['update']=function(_0x3a2b16,_0x136a14){if(_0x3a2b16[_0x6bce('0x48')]['id']){delete _0x3a2b16[_0x6bce('0x48')]['id'];}return db[_0x6bce('0x2c')][_0x6bce('0x46')]({'where':{'id':_0x3a2b16[_0x6bce('0x49')]['id']}})[_0x6bce('0x24')](handleEntityNotFound(_0x136a14,null))[_0x6bce('0x24')](saveUpdates(_0x3a2b16[_0x6bce('0x48')],null))[_0x6bce('0x24')](respondWithResult(_0x136a14,null))[_0x6bce('0x44')](handleError(_0x136a14,null));};exports['download']=function(_0x38f82e,_0x35f0fb,_0x2ad389){var _0x2d73a5=require('../../components/encryptor');var _0xdeaf9c=![];var _0x346886={};if(_0x38f82e[_0x6bce('0x30')][_0x6bce('0x3f')]&&_0x38f82e[_0x6bce('0x30')][_0x6bce('0x3f')]===_0x6bce('0x4a')){_0x346886[_0x6bce('0x4a')]=_0x38f82e[_0x6bce('0x49')]['id'];}else{_0x346886['id']=_0x38f82e[_0x6bce('0x49')]['id'];}return db[_0x6bce('0x2c')][_0x6bce('0x46')]({'where':_0x346886,'attributes':['id',_0x6bce('0x4b'),_0x6bce('0x4c')],'raw':!![]})[_0x6bce('0x24')](handleEntityNotFound(_0x35f0fb,null))['then'](function(_0x286f27){if(_0x286f27){var _0x1303eb=_0x286f27[_0x6bce('0x4b')];var _0xa6a866=util[_0x6bce('0x4d')](_0x6bce('0x4e'),_0x1303eb);if(fs[_0x6bce('0x4f')](_0xa6a866)){_0xdeaf9c=!![];return _0x2d73a5[_0x6bce('0x50')](_0xa6a866,_0x1303eb,config['secrets'][_0x6bce('0x51')])['then'](function(){return _0x286f27;});}return _0x286f27;}})[_0x6bce('0x24')](function(_0x693ba8){if(_0x693ba8){var _0x4d3d12=_0x693ba8['savePath'];if(!fs[_0x6bce('0x4f')](_0x4d3d12)){throw new db[(_0x6bce('0x52'))][(_0x6bce('0x53'))](_0x6bce('0x54'));}if(_0x693ba8[_0x6bce('0x4c')]){return _0x35f0fb[_0x6bce('0x55')](_0x4d3d12,_0x693ba8[_0x6bce('0x4c')]+path[_0x6bce('0x56')](_0x4d3d12),function(){if(_0xdeaf9c){fs['unlink'](_0x4d3d12);}});}else{return _0x35f0fb[_0x6bce('0x55')](_0x4d3d12,function(_0x75a37b){if(_0xdeaf9c){fs['unlink'](_0x4d3d12);}});}}})[_0x6bce('0x44')](function(_0x4fc7bb){if(_0x4fc7bb['message']===_0x6bce('0x54')){_0x35f0fb['status'](0x194)['send'](_0x6bce('0x57'));}else{return handleError(_0x35f0fb,null);}});};exports[_0x6bce('0x58')]=function(_0x521ba6,_0x5d9864){return db[_0x6bce('0x2c')][_0x6bce('0x46')]({'where':{'id':_0x521ba6[_0x6bce('0x49')]['id']}})[_0x6bce('0x24')](function(_0x423d21){if(!_0x423d21)throw new ReferenceError(_0x6bce('0x59'));return _0x423d21;})[_0x6bce('0x24')](function(_0x30e51e){var _0x1ece8e=_0x30e51e['savePath'];logger['info'](_0x6bce('0x5a'),_0x1ece8e);if(!_[_0x6bce('0x5b')](_0x30e51e[_0x6bce('0x4b')])&&fs[_0x6bce('0x4f')](_0x1ece8e)){logger['info'](_0x6bce('0x5c')+_0x1ece8e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6bce('0x5d')](_0x1ece8e);}_0x1ece8e=_0x1ece8e+_0x6bce('0x5e');if(!_['isNil'](_0x30e51e[_0x6bce('0x4b')])&&fs[_0x6bce('0x4f')](_0x1ece8e)){logger[_0x6bce('0x5f')](_0x6bce('0x5c')+_0x1ece8e+_0x6bce('0x60'));fs[_0x6bce('0x5d')](_0x1ece8e);}return _0x30e51e;})[_0x6bce('0x24')](function(_0x29b0fb){if(!_0x29b0fb)throw new InternalError();return _0x29b0fb[_0x6bce('0x58')]();})[_0x6bce('0x24')](function(){_0x5d9864['status'](0xcc)['end']();})[_0x6bce('0x44')](handleError(_0x5d9864,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 75a6d2b..f0fd5a1 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 _0x72e1=['define','square_recordings','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x1e31e8,_0x2ab5e7){var _0x106b73=function(_0x7ffa34){while(--_0x7ffa34){_0x1e31e8['push'](_0x1e31e8['shift']());}};_0x106b73(++_0x2ab5e7);}(_0x72e1,0x178));var _0x172e=function(_0x5bab8e,_0x50d259){_0x5bab8e=_0x5bab8e-0x0;var _0x11c418=_0x72e1[_0x5bab8e];return _0x11c418;};'use strict';var _=require('lodash');var util=require(_0x172e('0x0'));var logger=require(_0x172e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x172e('0x2'));var rp=require(_0x172e('0x3'));var fs=require('fs');var path=require(_0x172e('0x4'));var rimraf=require(_0x172e('0x5'));var config=require(_0x172e('0x6'));var attributes=require(_0x172e('0x7'));module[_0x172e('0x8')]=function(_0x36b211,_0x419f84){return _0x36b211[_0x172e('0x9')]('SquareRecording',attributes,{'tableName':_0x172e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed56=['api','moment','request-promise','path','rimraf','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger'];(function(_0x552213,_0xda321c){var _0x418cf7=function(_0x488e62){while(--_0x488e62){_0x552213['push'](_0x552213['shift']());}};_0x418cf7(++_0xda321c);}(_0xed56,0x171));var _0x6ed5=function(_0x5e8bcd,_0x36c611){_0x5e8bcd=_0x5e8bcd-0x0;var _0x285369=_0xed56[_0x5e8bcd];return _0x285369;};'use strict';var _=require(_0x6ed5('0x0'));var util=require(_0x6ed5('0x1'));var logger=require(_0x6ed5('0x2'))(_0x6ed5('0x3'));var moment=require(_0x6ed5('0x4'));var BPromise=require('bluebird');var rp=require(_0x6ed5('0x5'));var fs=require('fs');var path=require(_0x6ed5('0x6'));var rimraf=require(_0x6ed5('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ed5('0x8'));module[_0x6ed5('0x9')]=function(_0xe825c5,_0x361dbf){return _0xe825c5[_0x6ed5('0xa')]('SquareRecording',attributes,{'tableName':_0x6ed5('0xb'),'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 8cb44f5..ea37f38 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 _0x3d87=['message','info','result','CreateSquareRecording','SquareRecording','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4be53d,_0x1f1c6e){var _0x1ae3dd=function(_0x5e634e){while(--_0x5e634e){_0x4be53d['push'](_0x4be53d['shift']());}};_0x1ae3dd(++_0x1f1c6e);}(_0x3d87,0x117));var _0x73d8=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3d87[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x73d8('0x0'));var util=require('util');var moment=require(_0x73d8('0x1'));var BPromise=require(_0x73d8('0x2'));var rs=require(_0x73d8('0x3'));var fs=require('fs');var Redis=require(_0x73d8('0x4'));var db=require(_0x73d8('0x5'))['db'];var utils=require(_0x73d8('0x6'));var logger=require(_0x73d8('0x7'))(_0x73d8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x73d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4603f9,_0x2dcb68,_0x434de9){return new BPromise(function(_0xb9d2cf,_0x31871a){return client[_0x73d8('0xa')](_0x4603f9,_0x434de9)[_0x73d8('0xb')](function(_0x5f1786){logger['info'](_0x73d8('0xc'),_0x2dcb68,_0x73d8('0xd'));logger[_0x73d8('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2dcb68,_0x73d8('0xd'),JSON[_0x73d8('0xf')](_0x5f1786));if(_0x5f1786[_0x73d8('0x10')]){if(_0x5f1786['error'][_0x73d8('0x11')]===0x1f4){logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x5f1786[_0x73d8('0x10')]['message']);return _0x31871a(_0x5f1786[_0x73d8('0x10')][_0x73d8('0x12')]);}logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x5f1786['error'][_0x73d8('0x12')]);return _0xb9d2cf(_0x5f1786[_0x73d8('0x10')]['message']);}else{logger[_0x73d8('0x13')]('SquareRecording,\x20%s,\x20%s',_0x2dcb68,_0x73d8('0xd'));_0xb9d2cf(_0x5f1786[_0x73d8('0x14')][_0x73d8('0x12')]);}})['catch'](function(_0x59c0be){logger[_0x73d8('0x10')](_0x73d8('0xc'),_0x2dcb68,_0x59c0be);_0x31871a(_0x59c0be);});});}exports[_0x73d8('0x15')]=function(_0x14308b){var _0x5c51e6=this;return new Promise(function(_0x4e3d06,_0x1778e2){return db[_0x73d8('0x16')]['create'](_0x14308b[_0x73d8('0x17')],{'raw':_0x14308b[_0x73d8('0x18')]?_0x14308b['options'][_0x73d8('0x19')]===undefined?!![]:![]:!![]})[_0x73d8('0xb')](function(_0x4db86c){logger[_0x73d8('0x13')](_0x73d8('0x15'),_0x14308b);logger['debug']('CreateSquareRecording',_0x14308b,JSON[_0x73d8('0xf')](_0x4db86c));_0x4e3d06(_0x4db86c);})[_0x73d8('0x1a')](function(_0x1b7104){logger[_0x73d8('0x10')](_0x73d8('0x15'),_0x1b7104[_0x73d8('0x12')],_0x14308b);_0x1778e2(_0x5c51e6[_0x73d8('0x10')](0x1f4,_0x1b7104[_0x73d8('0x12')]));});});}; \ No newline at end of file +var _0x7a41=['then','debug','stringify','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a41,0x16f));var _0x17a4=function(_0x35e74f,_0x2a38d7){_0x35e74f=_0x35e74f-0x0;var _0x17d28b=_0x7a41[_0x35e74f];return _0x17d28b;};'use strict';var _=require('lodash');var util=require(_0x17a4('0x0'));var moment=require(_0x17a4('0x1'));var BPromise=require('bluebird');var rs=require(_0x17a4('0x2'));var fs=require('fs');var Redis=require(_0x17a4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x17a4('0x4'));var config=require(_0x17a4('0x5'));var jayson=require(_0x17a4('0x6'));var client=jayson[_0x17a4('0x7')][_0x17a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x554844,_0x6b9522,_0x231a8d){return new BPromise(function(_0x59e938,_0x175c48){return client[_0x17a4('0x9')](_0x554844,_0x231a8d)['then'](function(_0x1ed9ae){logger[_0x17a4('0xa')](_0x17a4('0xb'),_0x6b9522,_0x17a4('0xc'));logger['debug'](_0x17a4('0xd'),_0x6b9522,_0x17a4('0xc'),JSON['stringify'](_0x1ed9ae));if(_0x1ed9ae['error']){if(_0x1ed9ae[_0x17a4('0xe')][_0x17a4('0xf')]===0x1f4){logger[_0x17a4('0xe')](_0x17a4('0xb'),_0x6b9522,_0x1ed9ae[_0x17a4('0xe')][_0x17a4('0x10')]);return _0x175c48(_0x1ed9ae[_0x17a4('0xe')][_0x17a4('0x10')]);}logger[_0x17a4('0xe')](_0x17a4('0xb'),_0x6b9522,_0x1ed9ae[_0x17a4('0xe')]['message']);return _0x59e938(_0x1ed9ae['error'][_0x17a4('0x10')]);}else{logger[_0x17a4('0xa')](_0x17a4('0xb'),_0x6b9522,_0x17a4('0xc'));_0x59e938(_0x1ed9ae[_0x17a4('0x11')]['message']);}})[_0x17a4('0x12')](function(_0x3f868c){logger[_0x17a4('0xe')]('SquareRecording,\x20%s,\x20%s',_0x6b9522,_0x3f868c);_0x175c48(_0x3f868c);});});}exports[_0x17a4('0x13')]=function(_0x3c39f6){var _0x1c820d=this;return new Promise(function(_0x88cce7,_0x248936){return db[_0x17a4('0x14')][_0x17a4('0x15')](_0x3c39f6[_0x17a4('0x16')],{'raw':_0x3c39f6[_0x17a4('0x17')]?_0x3c39f6[_0x17a4('0x17')][_0x17a4('0x18')]===undefined?!![]:![]:!![]})[_0x17a4('0x19')](function(_0x1a581f){logger[_0x17a4('0xa')](_0x17a4('0x13'),_0x3c39f6);logger[_0x17a4('0x1a')](_0x17a4('0x13'),_0x3c39f6,JSON[_0x17a4('0x1b')](_0x1a581f));_0x88cce7(_0x1a581f);})['catch'](function(_0x2acd3d){logger[_0x17a4('0xe')](_0x17a4('0x13'),_0x2acd3d[_0x17a4('0x10')],_0x3c39f6);_0x248936(_0x1c820d['error'](0x1f4,_0x2acd3d[_0x17a4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7b0eae1..87ad1f1 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 _0x7cb2=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7cb2,0x18d));var _0x27cb=function(_0x2d2f18,_0x22540c){_0x2d2f18=_0x2d2f18-0x0;var _0x4dca56=_0x7cb2[_0x2d2f18];return _0x4dca56;};'use strict';var multer=require(_0x27cb('0x0'));var util=require(_0x27cb('0x1'));var path=require(_0x27cb('0x2'));var timeout=require(_0x27cb('0x3'));var express=require(_0x27cb('0x4'));var router=express[_0x27cb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x27cb('0x6'));var config=require(_0x27cb('0x7'));var controller=require(_0x27cb('0x8'));router['get']('/',auth[_0x27cb('0x9')](),controller[_0x27cb('0xa')]);router['get'](_0x27cb('0xb'),auth[_0x27cb('0x9')](),controller[_0x27cb('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x27cb('0xd')]);router[_0x27cb('0xe')]('/',auth['isAuthenticated'](),controller[_0x27cb('0xf')]);router[_0x27cb('0x10')](_0x27cb('0x11'),auth[_0x27cb('0x9')](),controller[_0x27cb('0x12')]);router['delete'](_0x27cb('0x11'),auth['isAuthenticated'](),controller[_0x27cb('0x13')]);module[_0x27cb('0x14')]=router; \ No newline at end of file +var _0x22f4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','util','path','Router'];(function(_0x2715bc,_0x1c385e){var _0x5f2e79=function(_0x4761c8){while(--_0x4761c8){_0x2715bc['push'](_0x2715bc['shift']());}};_0x5f2e79(++_0x1c385e);}(_0x22f4,0x82));var _0x422f=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x22f4[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require('multer');var util=require(_0x422f('0x0'));var path=require(_0x422f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x422f('0x2')]();var auth=require(_0x422f('0x3'));var interaction=require(_0x422f('0x4'));var config=require(_0x422f('0x5'));var controller=require(_0x422f('0x6'));router['get']('/',auth[_0x422f('0x7')](),controller[_0x422f('0x8')]);router[_0x422f('0x9')](_0x422f('0xa'),auth['isAuthenticated'](),controller[_0x422f('0xb')]);router[_0x422f('0x9')](_0x422f('0xc'),auth[_0x422f('0x7')](),controller[_0x422f('0xd')]);router[_0x422f('0xe')]('/',auth[_0x422f('0x7')](),controller[_0x422f('0xf')]);router[_0x422f('0x10')]('/:id',auth[_0x422f('0x7')](),controller['update']);router[_0x422f('0x11')]('/:id',auth[_0x422f('0x7')](),controller[_0x422f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a82b5d3..6260e8e 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 _0x6a21=['STRING','DATE','exports'];(function(_0x6f565c,_0x936419){var _0x148f7a=function(_0x51662f){while(--_0x51662f){_0x6f565c['push'](_0x6f565c['shift']());}};_0x148f7a(++_0x936419);}(_0x6a21,0x11c));var _0x16a2=function(_0x30b783,_0x5d86ac){_0x30b783=_0x30b783-0x0;var _0xf0a0=_0x6a21[_0x30b783];return _0xf0a0;};'use strict';var Sequelize=require('sequelize');module[_0x16a2('0x0')]={'network':{'type':Sequelize[_0x16a2('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x16a2('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x16a2('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x16a2('0x1')]},'calleridname':{'type':Sequelize[_0x16a2('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x16a2('0x1')]},'callingtns':{'type':Sequelize[_0x16a2('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x16a2('0x1')]},'context':{'type':Sequelize[_0x16a2('0x1')]},'extension':{'type':Sequelize[_0x16a2('0x1')]},'priority':{'type':Sequelize[_0x16a2('0x1')]},'enhanced':{'type':Sequelize[_0x16a2('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x16a2('0x1')]},'project_name':{'type':Sequelize[_0x16a2('0x1')]},'joinAt':{'type':Sequelize[_0x16a2('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4cc0=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2f271a,_0x2c6fb8){var _0xe2d2d1=function(_0x1090e4){while(--_0x1090e4){_0x2f271a['push'](_0x2f271a['shift']());}};_0xe2d2d1(++_0x2c6fb8);}(_0x4cc0,0x181));var _0x04cc=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4cc0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x04cc('0x0'));module[_0x04cc('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x04cc('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x04cc('0x2')]},'uniqueid':{'type':Sequelize[_0x04cc('0x2')]},'version':{'type':Sequelize[_0x04cc('0x2')]},'callerid':{'type':Sequelize[_0x04cc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x04cc('0x2')]},'callingani2':{'type':Sequelize[_0x04cc('0x2')]},'callington':{'type':Sequelize[_0x04cc('0x2')]},'callingtns':{'type':Sequelize[_0x04cc('0x2')]},'dnid':{'type':Sequelize[_0x04cc('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x04cc('0x2')]},'extension':{'type':Sequelize[_0x04cc('0x2')]},'priority':{'type':Sequelize[_0x04cc('0x2')]},'enhanced':{'type':Sequelize[_0x04cc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x04cc('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x04cc('0x3')]},'leaveAt':{'type':Sequelize[_0x04cc('0x3')]},'bot':{'type':Sequelize[_0x04cc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 5cbfef4..b7070b1 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 _0x4ff6=['end','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','index','SquareReport','fieldName','key','model','map','query','keys','intersection','attributes','length','nolimit','order','sort','where','pick','filters','filter','type','merge','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status'];(function(_0x7731e4,_0x4157f1){var _0x342df9=function(_0x36bb71){while(--_0x36bb71){_0x7731e4['push'](_0x7731e4['shift']());}};_0x342df9(++_0x4157f1);}(_0x4ff6,0xff));var _0x64ff=function(_0x4771f0,_0x5368c5){_0x4771f0=_0x4771f0-0x0;var _0xd95ada=_0x4ff6[_0x4771f0];return _0xd95ada;};'use strict';var pdf=require(_0x64ff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64ff('0x1'));var zipdir=require(_0x64ff('0x2'));var jsonpatch=require(_0x64ff('0x3'));var rp=require(_0x64ff('0x4'));var moment=require(_0x64ff('0x5'));var BPromise=require(_0x64ff('0x6'));var Mustache=require('mustache');var util=require(_0x64ff('0x7'));var path=require(_0x64ff('0x8'));var sox=require(_0x64ff('0x9'));var csv=require('to-csv');var ejs=require(_0x64ff('0xa'));var fs=require('fs');var _=require(_0x64ff('0xb'));var squel=require(_0x64ff('0xc'));var crypto=require(_0x64ff('0xd'));var jsforce=require(_0x64ff('0xe'));var deskjs=require(_0x64ff('0xf'));var toCsv=require(_0x64ff('0x10'));var querystring=require(_0x64ff('0x11'));var Papa=require(_0x64ff('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64ff('0x13'));var as=require(_0x64ff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64ff('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x64ff('0x16'))['db'];function respondWithStatusCode(_0x314f23,_0xd43a1e){_0xd43a1e=_0xd43a1e||0xcc;return function(_0xbadcdf){if(_0xbadcdf){return _0x314f23[_0x64ff('0x17')](_0xd43a1e);}return _0x314f23[_0x64ff('0x18')](_0xd43a1e)[_0x64ff('0x19')]();};}function respondWithResult(_0x1415b7,_0x55d202){_0x55d202=_0x55d202||0xc8;return function(_0x594d90){if(_0x594d90){return _0x1415b7[_0x64ff('0x18')](_0x55d202)[_0x64ff('0x1a')](_0x594d90);}};}function respondWithFilteredResult(_0x2e2797,_0x5cdb4a){return function(_0x289963){if(_0x289963){var _0x55669c=_0x289963[_0x64ff('0x1b')],_0x172fea=_0x5cdb4a[_0x64ff('0x1c')],_0x1e3803=_0x5cdb4a[_0x64ff('0x1c')]+_0x5cdb4a[_0x64ff('0x1d')],_0x525d28;if(_0x1e3803>=_0x55669c){_0x1e3803=_0x55669c;_0x525d28=0xc8;}else{_0x525d28=0xce;}_0x2e2797['status'](_0x525d28);return _0x2e2797['set'](_0x64ff('0x1e'),_0x172fea+'-'+_0x1e3803+'/'+_0x55669c)[_0x64ff('0x1a')](_0x289963);}return null;};}function patchUpdates(_0x1b4af1){return function(_0x2037fa){try{jsonpatch[_0x64ff('0x1f')](_0x2037fa,_0x1b4af1,!![]);}catch(_0x19d53c){return BPromise['reject'](_0x19d53c);}return _0x2037fa[_0x64ff('0x20')]();};}function saveUpdates(_0x59de45,_0x3c619b){return function(_0xe54f51){if(_0xe54f51){return _0xe54f51['update'](_0x59de45)[_0x64ff('0x21')](function(_0x37a21c){return _0x37a21c;});}return null;};}function removeEntity(_0x508492,_0x1ca936){return function(_0x4aa689){if(_0x4aa689){return _0x4aa689[_0x64ff('0x22')]()[_0x64ff('0x21')](function(){_0x508492[_0x64ff('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b5d1c,_0x52f4bf){return function(_0x15bbf5){if(!_0x15bbf5){_0x2b5d1c[_0x64ff('0x17')](0x194);}return _0x15bbf5;};}function handleError(_0x299624,_0x565a46){_0x565a46=_0x565a46||0x1f4;return function(_0x8708e){logger[_0x64ff('0x23')](_0x8708e['stack']);if(_0x8708e[_0x64ff('0x24')]){delete _0x8708e[_0x64ff('0x24')];}_0x299624[_0x64ff('0x18')](_0x565a46)['send'](_0x8708e);};}exports[_0x64ff('0x25')]=function(_0x170550,_0x4e0739){var _0x1304d1={},_0x5255f9={},_0x1ccc3a={'count':0x0,'rows':[]};var _0x3b9a22=_['map'](db[_0x64ff('0x26')]['rawAttributes'],function(_0x35cd89){return{'name':_0x35cd89[_0x64ff('0x27')],'type':_0x35cd89['type'][_0x64ff('0x28')]};});_0x5255f9[_0x64ff('0x29')]=_[_0x64ff('0x2a')](_0x3b9a22,'name');_0x5255f9[_0x64ff('0x2b')]=_[_0x64ff('0x2c')](_0x170550[_0x64ff('0x2b')]);_0x5255f9['filters']=_[_0x64ff('0x2d')](_0x5255f9[_0x64ff('0x29')],_0x5255f9[_0x64ff('0x2b')]);_0x1304d1[_0x64ff('0x2e')]=_['intersection'](_0x5255f9[_0x64ff('0x29')],qs['fields'](_0x170550['query']['fields']));_0x1304d1[_0x64ff('0x2e')]=_0x1304d1['attributes'][_0x64ff('0x2f')]?_0x1304d1[_0x64ff('0x2e')]:_0x5255f9['model'];if(!_0x170550[_0x64ff('0x2b')]['hasOwnProperty'](_0x64ff('0x30'))){_0x1304d1[_0x64ff('0x1d')]=qs[_0x64ff('0x1d')](_0x170550[_0x64ff('0x2b')][_0x64ff('0x1d')]);_0x1304d1[_0x64ff('0x1c')]=qs['offset'](_0x170550[_0x64ff('0x2b')][_0x64ff('0x1c')]);}_0x1304d1[_0x64ff('0x31')]=qs[_0x64ff('0x32')](_0x170550[_0x64ff('0x2b')][_0x64ff('0x32')]);_0x1304d1[_0x64ff('0x33')]=qs['filters'](_[_0x64ff('0x34')](_0x170550[_0x64ff('0x2b')],_0x5255f9[_0x64ff('0x35')]),_0x3b9a22);if(_0x170550[_0x64ff('0x2b')][_0x64ff('0x36')]){_0x1304d1[_0x64ff('0x33')]=_['merge'](_0x1304d1[_0x64ff('0x33')],{'$or':_['map'](_0x3b9a22,function(_0x4b073c){if(_0x4b073c[_0x64ff('0x37')]!=='VIRTUAL'){var _0x48c250={};_0x48c250[_0x4b073c[_0x64ff('0x24')]]={'$like':'%'+_0x170550[_0x64ff('0x2b')]['filter']+'%'};return _0x48c250;}})});}_0x1304d1=_[_0x64ff('0x38')]({},_0x1304d1,_0x170550['options']);var _0x21d07b={'where':_0x1304d1[_0x64ff('0x33')]};return db['SquareReport']['count'](_0x21d07b)[_0x64ff('0x21')](function(_0x58ec6d){_0x1ccc3a[_0x64ff('0x1b')]=_0x58ec6d;if(_0x170550[_0x64ff('0x2b')][_0x64ff('0x39')]){_0x1304d1[_0x64ff('0x3a')]=[{'all':!![]}];}return db[_0x64ff('0x26')][_0x64ff('0x3b')](_0x1304d1);})[_0x64ff('0x21')](function(_0x3cf4ea){_0x1ccc3a[_0x64ff('0x3c')]=_0x3cf4ea;return _0x1ccc3a;})['then'](respondWithFilteredResult(_0x4e0739,_0x1304d1))['catch'](handleError(_0x4e0739,null));};exports[_0x64ff('0x3d')]=function(_0x18a521,_0x37e225){var _0x2ffcb3={'raw':!![],'where':{'id':_0x18a521[_0x64ff('0x3e')]['id']}},_0x1bc45d={};_0x1bc45d['model']=_['keys'](db[_0x64ff('0x26')]['rawAttributes']);_0x1bc45d[_0x64ff('0x2b')]=_[_0x64ff('0x2c')](_0x18a521[_0x64ff('0x2b')]);_0x1bc45d[_0x64ff('0x35')]=_[_0x64ff('0x2d')](_0x1bc45d[_0x64ff('0x29')],_0x1bc45d[_0x64ff('0x2b')]);_0x2ffcb3[_0x64ff('0x2e')]=_[_0x64ff('0x2d')](_0x1bc45d[_0x64ff('0x29')],qs[_0x64ff('0x3f')](_0x18a521[_0x64ff('0x2b')][_0x64ff('0x3f')]));_0x2ffcb3[_0x64ff('0x2e')]=_0x2ffcb3['attributes']['length']?_0x2ffcb3['attributes']:_0x1bc45d[_0x64ff('0x29')];if(_0x18a521[_0x64ff('0x2b')][_0x64ff('0x39')]){_0x2ffcb3['include']=[{'all':!![]}];}_0x2ffcb3=_[_0x64ff('0x38')]({},_0x2ffcb3,_0x18a521['options']);return db[_0x64ff('0x26')][_0x64ff('0x40')](_0x2ffcb3)[_0x64ff('0x21')](handleEntityNotFound(_0x37e225,null))[_0x64ff('0x21')](respondWithResult(_0x37e225,null))[_0x64ff('0x41')](handleError(_0x37e225,null));};exports[_0x64ff('0x42')]=function(_0x5c966c,_0x1e2a26){return db[_0x64ff('0x26')][_0x64ff('0x42')](_0x5c966c[_0x64ff('0x43')],{})[_0x64ff('0x21')](respondWithResult(_0x1e2a26,0xc9))[_0x64ff('0x41')](handleError(_0x1e2a26,null));};exports[_0x64ff('0x44')]=function(_0x48dfbd,_0x1f1d5e){if(_0x48dfbd[_0x64ff('0x43')]['id']){delete _0x48dfbd['body']['id'];}return db[_0x64ff('0x26')][_0x64ff('0x40')]({'where':{'id':_0x48dfbd[_0x64ff('0x3e')]['id']}})[_0x64ff('0x21')](handleEntityNotFound(_0x1f1d5e,null))[_0x64ff('0x21')](saveUpdates(_0x48dfbd[_0x64ff('0x43')],null))['then'](respondWithResult(_0x1f1d5e,null))[_0x64ff('0x41')](handleError(_0x1f1d5e,null));};exports[_0x64ff('0x22')]=function(_0x39894d,_0x79c641){return db[_0x64ff('0x26')][_0x64ff('0x40')]({'where':{'id':_0x39894d[_0x64ff('0x3e')]['id']}})[_0x64ff('0x21')](handleEntityNotFound(_0x79c641,null))[_0x64ff('0x21')](removeEntity(_0x79c641,null))[_0x64ff('0x41')](handleError(_0x79c641,null));};exports[_0x64ff('0x45')]=function(_0x3c4408,_0xe2f7e6){return db[_0x64ff('0x26')][_0x64ff('0x45')]()[_0x64ff('0x21')](respondWithResult(_0xe2f7e6,null))[_0x64ff('0x41')](handleError(_0xe2f7e6,null));}; \ No newline at end of file +var _0x14e8=['json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x14e8,0x156));var _0x814e=function(_0x4119b7,_0x39c66b){_0x4119b7=_0x4119b7-0x0;var _0x11f38e=_0x14e8[_0x4119b7];return _0x11f38e;};'use strict';var pdf=require(_0x814e('0x0'));var emlformat=require(_0x814e('0x1'));var rimraf=require(_0x814e('0x2'));var zipdir=require(_0x814e('0x3'));var jsonpatch=require(_0x814e('0x4'));var rp=require('request-promise');var moment=require(_0x814e('0x5'));var BPromise=require(_0x814e('0x6'));var Mustache=require(_0x814e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x814e('0x8'));var csv=require(_0x814e('0x9'));var ejs=require(_0x814e('0xa'));var fs=require('fs');var _=require(_0x814e('0xb'));var squel=require(_0x814e('0xc'));var crypto=require(_0x814e('0xd'));var jsforce=require(_0x814e('0xe'));var deskjs=require(_0x814e('0xf'));var toCsv=require(_0x814e('0x9'));var querystring=require('querystring');var Papa=require(_0x814e('0x10'));var Redis=require(_0x814e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x814e('0x12'));var as=require(_0x814e('0x13'));var hardwareService=require(_0x814e('0x14'));var logger=require(_0x814e('0x15'))(_0x814e('0x16'));var utils=require(_0x814e('0x17'));var config=require(_0x814e('0x18'));var db=require(_0x814e('0x19'))['db'];function respondWithStatusCode(_0x215627,_0x293474){_0x293474=_0x293474||0xcc;return function(_0x4a861e){if(_0x4a861e){return _0x215627[_0x814e('0x1a')](_0x293474);}return _0x215627[_0x814e('0x1b')](_0x293474)[_0x814e('0x1c')]();};}function respondWithResult(_0x3bc122,_0x647069){_0x647069=_0x647069||0xc8;return function(_0xbee900){if(_0xbee900){return _0x3bc122[_0x814e('0x1b')](_0x647069)['json'](_0xbee900);}};}function respondWithFilteredResult(_0x4a407d,_0x3190e3){return function(_0x92b5c0){if(_0x92b5c0){var _0x409fab=_0x92b5c0[_0x814e('0x1d')],_0x218b2c=_0x3190e3['offset'],_0x3770e2=_0x3190e3[_0x814e('0x1e')]+_0x3190e3['limit'],_0x4ef72e;if(_0x3770e2>=_0x409fab){_0x3770e2=_0x409fab;_0x4ef72e=0xc8;}else{_0x4ef72e=0xce;}_0x4a407d[_0x814e('0x1b')](_0x4ef72e);return _0x4a407d[_0x814e('0x1f')](_0x814e('0x20'),_0x218b2c+'-'+_0x3770e2+'/'+_0x409fab)[_0x814e('0x21')](_0x92b5c0);}return null;};}function patchUpdates(_0x4fca8b){return function(_0x3b4f3b){try{jsonpatch[_0x814e('0x22')](_0x3b4f3b,_0x4fca8b,!![]);}catch(_0x1d955b){return BPromise[_0x814e('0x23')](_0x1d955b);}return _0x3b4f3b[_0x814e('0x24')]();};}function saveUpdates(_0x4cdb48,_0x46bdf6){return function(_0x2e8f99){if(_0x2e8f99){return _0x2e8f99[_0x814e('0x25')](_0x4cdb48)[_0x814e('0x26')](function(_0x40fe2e){return _0x40fe2e;});}return null;};}function removeEntity(_0x1b763d,_0x4984f0){return function(_0x13da87){if(_0x13da87){return _0x13da87[_0x814e('0x27')]()[_0x814e('0x26')](function(){_0x1b763d[_0x814e('0x1b')](0xcc)[_0x814e('0x1c')]();});}};}function handleEntityNotFound(_0x509b0d,_0x42b899){return function(_0x178c19){if(!_0x178c19){_0x509b0d[_0x814e('0x1a')](0x194);}return _0x178c19;};}function handleError(_0x4864fc,_0x2ead7b){_0x2ead7b=_0x2ead7b||0x1f4;return function(_0xb25e14){logger[_0x814e('0x28')](_0xb25e14[_0x814e('0x29')]);if(_0xb25e14[_0x814e('0x2a')]){delete _0xb25e14['name'];}_0x4864fc[_0x814e('0x1b')](_0x2ead7b)['send'](_0xb25e14);};}exports[_0x814e('0x2b')]=function(_0x3daed9,_0x467fc3){var _0x10e2ad={},_0x21881c={},_0x4bc37c={'count':0x0,'rows':[]};var _0x2f19b1=_[_0x814e('0x2c')](db[_0x814e('0x2d')]['rawAttributes'],function(_0x30e4a5){return{'name':_0x30e4a5[_0x814e('0x2e')],'type':_0x30e4a5[_0x814e('0x2f')]['key']};});_0x21881c['model']=_[_0x814e('0x2c')](_0x2f19b1,_0x814e('0x2a'));_0x21881c[_0x814e('0x30')]=_[_0x814e('0x31')](_0x3daed9[_0x814e('0x30')]);_0x21881c[_0x814e('0x32')]=_[_0x814e('0x33')](_0x21881c[_0x814e('0x34')],_0x21881c[_0x814e('0x30')]);_0x10e2ad[_0x814e('0x35')]=_[_0x814e('0x33')](_0x21881c[_0x814e('0x34')],qs['fields'](_0x3daed9[_0x814e('0x30')][_0x814e('0x36')]));_0x10e2ad[_0x814e('0x35')]=_0x10e2ad[_0x814e('0x35')][_0x814e('0x37')]?_0x10e2ad[_0x814e('0x35')]:_0x21881c['model'];if(!_0x3daed9['query']['hasOwnProperty'](_0x814e('0x38'))){_0x10e2ad[_0x814e('0x39')]=qs[_0x814e('0x39')](_0x3daed9['query'][_0x814e('0x39')]);_0x10e2ad[_0x814e('0x1e')]=qs[_0x814e('0x1e')](_0x3daed9[_0x814e('0x30')][_0x814e('0x1e')]);}_0x10e2ad[_0x814e('0x3a')]=qs['sort'](_0x3daed9[_0x814e('0x30')][_0x814e('0x3b')]);_0x10e2ad['where']=qs['filters'](_[_0x814e('0x3c')](_0x3daed9[_0x814e('0x30')],_0x21881c[_0x814e('0x32')]),_0x2f19b1);if(_0x3daed9[_0x814e('0x30')][_0x814e('0x3d')]){_0x10e2ad['where']=_[_0x814e('0x3e')](_0x10e2ad[_0x814e('0x3f')],{'$or':_[_0x814e('0x2c')](_0x2f19b1,function(_0x57e845){if(_0x57e845['type']!==_0x814e('0x40')){var _0x358775={};_0x358775[_0x57e845[_0x814e('0x2a')]]={'$like':'%'+_0x3daed9['query'][_0x814e('0x3d')]+'%'};return _0x358775;}})});}_0x10e2ad=_[_0x814e('0x3e')]({},_0x10e2ad,_0x3daed9[_0x814e('0x41')]);var _0x23660a={'where':_0x10e2ad[_0x814e('0x3f')]};return db[_0x814e('0x2d')][_0x814e('0x1d')](_0x23660a)[_0x814e('0x26')](function(_0x17c2f4){_0x4bc37c['count']=_0x17c2f4;if(_0x3daed9[_0x814e('0x30')][_0x814e('0x42')]){_0x10e2ad[_0x814e('0x43')]=[{'all':!![]}];}return db[_0x814e('0x2d')]['findAll'](_0x10e2ad);})[_0x814e('0x26')](function(_0x577834){_0x4bc37c[_0x814e('0x44')]=_0x577834;return _0x4bc37c;})['then'](respondWithFilteredResult(_0x467fc3,_0x10e2ad))[_0x814e('0x45')](handleError(_0x467fc3,null));};exports['show']=function(_0x55abf5,_0x5141c7){var _0x1696cc={'raw':!![],'where':{'id':_0x55abf5[_0x814e('0x46')]['id']}},_0x5cd73c={};_0x5cd73c[_0x814e('0x34')]=_['keys'](db['SquareReport'][_0x814e('0x47')]);_0x5cd73c['query']=_['keys'](_0x55abf5[_0x814e('0x30')]);_0x5cd73c['filters']=_['intersection'](_0x5cd73c[_0x814e('0x34')],_0x5cd73c[_0x814e('0x30')]);_0x1696cc['attributes']=_[_0x814e('0x33')](_0x5cd73c['model'],qs[_0x814e('0x36')](_0x55abf5[_0x814e('0x30')][_0x814e('0x36')]));_0x1696cc[_0x814e('0x35')]=_0x1696cc[_0x814e('0x35')][_0x814e('0x37')]?_0x1696cc[_0x814e('0x35')]:_0x5cd73c[_0x814e('0x34')];if(_0x55abf5[_0x814e('0x30')][_0x814e('0x42')]){_0x1696cc[_0x814e('0x43')]=[{'all':!![]}];}_0x1696cc=_[_0x814e('0x3e')]({},_0x1696cc,_0x55abf5['options']);return db[_0x814e('0x2d')][_0x814e('0x48')](_0x1696cc)[_0x814e('0x26')](handleEntityNotFound(_0x5141c7,null))[_0x814e('0x26')](respondWithResult(_0x5141c7,null))[_0x814e('0x45')](handleError(_0x5141c7,null));};exports[_0x814e('0x49')]=function(_0xb28101,_0x42c23f){return db[_0x814e('0x2d')][_0x814e('0x49')](_0xb28101[_0x814e('0x4a')],{})[_0x814e('0x26')](respondWithResult(_0x42c23f,0xc9))[_0x814e('0x45')](handleError(_0x42c23f,null));};exports[_0x814e('0x25')]=function(_0x2a56a0,_0x534e8a){if(_0x2a56a0[_0x814e('0x4a')]['id']){delete _0x2a56a0['body']['id'];}return db[_0x814e('0x2d')]['find']({'where':{'id':_0x2a56a0[_0x814e('0x46')]['id']}})[_0x814e('0x26')](handleEntityNotFound(_0x534e8a,null))[_0x814e('0x26')](saveUpdates(_0x2a56a0[_0x814e('0x4a')],null))[_0x814e('0x26')](respondWithResult(_0x534e8a,null))[_0x814e('0x45')](handleError(_0x534e8a,null));};exports[_0x814e('0x27')]=function(_0x190c1b,_0x100008){return db['SquareReport']['find']({'where':{'id':_0x190c1b[_0x814e('0x46')]['id']}})[_0x814e('0x26')](handleEntityNotFound(_0x100008,null))['then'](removeEntity(_0x100008,null))[_0x814e('0x45')](handleError(_0x100008,null));};exports['describe']=function(_0x49866,_0x38aadc){return db['SquareReport']['describe']()[_0x814e('0x26')](respondWithResult(_0x38aadc,null))[_0x814e('0x45')](handleError(_0x38aadc,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index ced14a6..f53cee4 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 _0x2d46=['request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2d46,0x1be));var _0x62d4=function(_0x5235af,_0x428a33){_0x5235af=_0x5235af-0x0;var _0x3469c6=_0x2d46[_0x5235af];return _0x3469c6;};'use strict';var _=require(_0x62d4('0x0'));var util=require(_0x62d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62d4('0x2'));var BPromise=require(_0x62d4('0x3'));var rp=require(_0x62d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62d4('0x5'));var config=require(_0x62d4('0x6'));var attributes=require(_0x62d4('0x7'));module['exports']=function(_0x3f49e2,_0x51585c){return _0x3f49e2[_0x62d4('0x8')](_0x62d4('0x9'),attributes,{'tableName':_0x62d4('0xa'),'paranoid':![],'indexes':[{'name':_0x62d4('0xb'),'fields':[_0x62d4('0xc'),_0x62d4('0xd')]},{'name':_0x62d4('0xe'),'fields':[_0x62d4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2673=['../../config/logger','api','moment','request-promise','path','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','project_name','leaveAt','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2673,0x1ac));var _0x3267=function(_0x22658d,_0x328f29){_0x22658d=_0x22658d-0x0;var _0x49a56b=_0x2673[_0x22658d];return _0x49a56b;};'use strict';var _=require('lodash');var util=require(_0x3267('0x0'));var logger=require(_0x3267('0x1'))(_0x3267('0x2'));var moment=require(_0x3267('0x3'));var BPromise=require('bluebird');var rp=require(_0x3267('0x4'));var fs=require('fs');var path=require(_0x3267('0x5'));var rimraf=require('rimraf');var config=require(_0x3267('0x6'));var attributes=require(_0x3267('0x7'));module[_0x3267('0x8')]=function(_0x260f32,_0x3f6bee){return _0x260f32['define'](_0x3267('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x3267('0xa'),'fields':['uniqueid',_0x3267('0xb')]},{'name':_0x3267('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 92c4f33..b866e91 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 _0x971f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','raw','then','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit','lodash'];(function(_0xd172cf,_0x7df1f9){var _0x4a020e=function(_0x548d6a){while(--_0x548d6a){_0xd172cf['push'](_0xd172cf['shift']());}};_0x4a020e(++_0x7df1f9);}(_0x971f,0x196));var _0xf971=function(_0x38b443,_0x48f827){_0x38b443=_0x38b443-0x0;var _0x375d7a=_0x971f[_0x38b443];return _0x375d7a;};'use strict';var _=require(_0xf971('0x0'));var util=require('util');var moment=require(_0xf971('0x1'));var BPromise=require(_0xf971('0x2'));var rs=require(_0xf971('0x3'));var fs=require('fs');var Redis=require(_0xf971('0x4'));var db=require(_0xf971('0x5'))['db'];var utils=require(_0xf971('0x6'));var logger=require(_0xf971('0x7'))(_0xf971('0x8'));var config=require(_0xf971('0x9'));var jayson=require(_0xf971('0xa'));var client=jayson[_0xf971('0xb')][_0xf971('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37e85f,_0x22ee1d,_0x247c42){return new BPromise(function(_0x3a9a20,_0x4f56d8){return client[_0xf971('0xd')](_0x37e85f,_0x247c42)['then'](function(_0x261733){logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));logger[_0xf971('0x11')](_0xf971('0x12'),_0x22ee1d,_0xf971('0x10'),JSON[_0xf971('0x13')](_0x261733));if(_0x261733[_0xf971('0x14')]){if(_0x261733['error'][_0xf971('0x15')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x22ee1d,_0x261733['error'][_0xf971('0x16')]);return _0x4f56d8(_0x261733[_0xf971('0x14')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x22ee1d,_0x261733[_0xf971('0x14')]['message']);return _0x3a9a20(_0x261733[_0xf971('0x14')]['message']);}else{logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));_0x3a9a20(_0x261733[_0xf971('0x17')]['message']);}})[_0xf971('0x18')](function(_0x5ec192){logger[_0xf971('0x14')](_0xf971('0xf'),_0x22ee1d,_0x5ec192);_0x4f56d8(_0x5ec192);});});}exports['CreateSquareReport']=function(_0x273a13){var _0x4b35e5=this;return new Promise(function(_0x5b9991,_0x1fe462){return db[_0xf971('0x19')][_0xf971('0x1a')](_0x273a13[_0xf971('0x1b')],{'raw':_0x273a13[_0xf971('0x1c')]?_0x273a13['options'][_0xf971('0x1d')]===undefined?!![]:![]:!![]})[_0xf971('0x1e')](function(_0x2dd5e5){logger[_0xf971('0xe')](_0xf971('0x1f'),_0x273a13);logger['debug'](_0xf971('0x1f'),_0x273a13,JSON[_0xf971('0x13')](_0x2dd5e5));_0x5b9991(_0x2dd5e5);})['catch'](function(_0x292a1c){logger['error'](_0xf971('0x1f'),_0x292a1c[_0xf971('0x16')],_0x273a13);_0x1fe462(_0x4b35e5[_0xf971('0x14')](0x1f4,_0x292a1c[_0xf971('0x16')]));});});};exports[_0xf971('0x20')]=function(_0x230e9b){var _0x510908=this;return new Promise(function(_0x575ce8,_0x33b33b){return db['SquareReport'][_0xf971('0x21')](_0x230e9b['body'],{'raw':_0x230e9b[_0xf971('0x1c')]?_0x230e9b[_0xf971('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x230e9b[_0xf971('0x1c')]?_0x230e9b['options'][_0xf971('0x22')]||null:null,'attributes':_0x230e9b[_0xf971('0x1c')]?_0x230e9b[_0xf971('0x1c')][_0xf971('0x23')]||null:null,'limit':_0x230e9b['options']?_0x230e9b[_0xf971('0x1c')][_0xf971('0x24')]||null:null})[_0xf971('0x1e')](function(_0x5b8a76){logger[_0xf971('0xe')]('UpdateSquareReport',_0x230e9b);logger[_0xf971('0x11')]('UpdateSquareReport',_0x230e9b,JSON[_0xf971('0x13')](_0x5b8a76));_0x575ce8(_0x5b8a76);})[_0xf971('0x18')](function(_0x40ea75){logger[_0xf971('0x14')](_0xf971('0x20'),_0x40ea75[_0xf971('0x16')],_0x230e9b);_0x33b33b(_0x510908[_0xf971('0x14')](0x1f4,_0x40ea75[_0xf971('0x16')]));});});}; \ No newline at end of file +var _0xfa83=['attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSquareReport','SquareReport','body','options','raw','catch','update','where'];(function(_0x1c685f,_0x8411eb){var _0x42285f=function(_0x437112){while(--_0x437112){_0x1c685f['push'](_0x1c685f['shift']());}};_0x42285f(++_0x8411eb);}(_0xfa83,0x1a3));var _0x3fa8=function(_0x3daef9,_0x1c796f){_0x3daef9=_0x3daef9-0x0;var _0x49698=_0xfa83[_0x3daef9];return _0x49698;};'use strict';var _=require(_0x3fa8('0x0'));var util=require(_0x3fa8('0x1'));var moment=require(_0x3fa8('0x2'));var BPromise=require(_0x3fa8('0x3'));var rs=require(_0x3fa8('0x4'));var fs=require('fs');var Redis=require(_0x3fa8('0x5'));var db=require(_0x3fa8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3fa8('0x7'));var config=require('../../config/environment');var jayson=require(_0x3fa8('0x8'));var client=jayson['client'][_0x3fa8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31c2c3,_0x144ea7,_0x5b6a4c){return new BPromise(function(_0x3ff949,_0x5cbe7c){return client[_0x3fa8('0xa')](_0x31c2c3,_0x5b6a4c)[_0x3fa8('0xb')](function(_0x26d4f1){logger['info'](_0x3fa8('0xc'),_0x144ea7,_0x3fa8('0xd'));logger[_0x3fa8('0xe')](_0x3fa8('0xf'),_0x144ea7,_0x3fa8('0xd'),JSON[_0x3fa8('0x10')](_0x26d4f1));if(_0x26d4f1['error']){if(_0x26d4f1[_0x3fa8('0x11')]['code']===0x1f4){logger[_0x3fa8('0x11')]('SquareReport,\x20%s,\x20%s',_0x144ea7,_0x26d4f1['error']['message']);return _0x5cbe7c(_0x26d4f1[_0x3fa8('0x11')][_0x3fa8('0x12')]);}logger['error'](_0x3fa8('0xc'),_0x144ea7,_0x26d4f1[_0x3fa8('0x11')][_0x3fa8('0x12')]);return _0x3ff949(_0x26d4f1[_0x3fa8('0x11')][_0x3fa8('0x12')]);}else{logger[_0x3fa8('0x13')](_0x3fa8('0xc'),_0x144ea7,_0x3fa8('0xd'));_0x3ff949(_0x26d4f1[_0x3fa8('0x14')][_0x3fa8('0x12')]);}})['catch'](function(_0x582777){logger['error']('SquareReport,\x20%s,\x20%s',_0x144ea7,_0x582777);_0x5cbe7c(_0x582777);});});}exports[_0x3fa8('0x15')]=function(_0x1be0c2){var _0x564e35=this;return new Promise(function(_0x33ba3a,_0x3fbbcf){return db[_0x3fa8('0x16')]['create'](_0x1be0c2[_0x3fa8('0x17')],{'raw':_0x1be0c2[_0x3fa8('0x18')]?_0x1be0c2[_0x3fa8('0x18')][_0x3fa8('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3ce4c0){logger[_0x3fa8('0x13')]('CreateSquareReport',_0x1be0c2);logger['debug'](_0x3fa8('0x15'),_0x1be0c2,JSON[_0x3fa8('0x10')](_0x3ce4c0));_0x33ba3a(_0x3ce4c0);})[_0x3fa8('0x1a')](function(_0x4706ea){logger[_0x3fa8('0x11')](_0x3fa8('0x15'),_0x4706ea['message'],_0x1be0c2);_0x3fbbcf(_0x564e35[_0x3fa8('0x11')](0x1f4,_0x4706ea[_0x3fa8('0x12')]));});});};exports['UpdateSquareReport']=function(_0x7e04d0){var _0xd733cc=this;return new Promise(function(_0x792066,_0x2b9757){return db['SquareReport'][_0x3fa8('0x1b')](_0x7e04d0[_0x3fa8('0x17')],{'raw':_0x7e04d0[_0x3fa8('0x18')]?_0x7e04d0[_0x3fa8('0x18')][_0x3fa8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7e04d0[_0x3fa8('0x18')]?_0x7e04d0['options'][_0x3fa8('0x1c')]||null:null,'attributes':_0x7e04d0[_0x3fa8('0x18')]?_0x7e04d0[_0x3fa8('0x18')][_0x3fa8('0x1d')]||null:null,'limit':_0x7e04d0['options']?_0x7e04d0[_0x3fa8('0x18')][_0x3fa8('0x1e')]||null:null})[_0x3fa8('0xb')](function(_0x19e19f){logger[_0x3fa8('0x13')](_0x3fa8('0x1f'),_0x7e04d0);logger[_0x3fa8('0xe')](_0x3fa8('0x1f'),_0x7e04d0,JSON['stringify'](_0x19e19f));_0x792066(_0x19e19f);})[_0x3fa8('0x1a')](function(_0x45e53b){logger[_0x3fa8('0x11')](_0x3fa8('0x1f'),_0x45e53b['message'],_0x7e04d0);_0x2b9757(_0xd733cc[_0x3fa8('0x11')](0x1f4,_0x45e53b[_0x3fa8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 7678635..bd60ecc 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(_0x2ea8f3,_0x3a1d7e){var _0x3e52b0=function(_0x361469){while(--_0x361469){_0x2ea8f3['push'](_0x2ea8f3['shift']());}};_0x3e52b0(++_0x3a1d7e);}(_0x7a54,0x106));var _0x47a5=function(_0x33a64d,_0x66e197){_0x33a64d=_0x33a64d-0x0;var _0x5d72c5=_0x7a54[_0x33a64d];return _0x5d72c5;};'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 _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(_0x413d52,_0x1a327b){var _0x414336=function(_0x52e22a){while(--_0x52e22a){_0x413d52['push'](_0x413d52['shift']());}};_0x414336(++_0x1a327b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44de47,_0x31bb85){_0x44de47=_0x44de47-0x0;var _0x4571d4=_0x5f2f[_0x44de47];return _0x4571d4;};'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('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 1dae283..3a40d54 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 _0xcd10=['exports','STRING','TEXT','sequelize'];(function(_0x42f270,_0x452dec){var _0x57bc5b=function(_0x258159){while(--_0x258159){_0x42f270['push'](_0x42f270['shift']());}};_0x57bc5b(++_0x452dec);}(_0xcd10,0x10b));var _0x0cd1=function(_0xca52fe,_0x4f073e){_0xca52fe=_0xca52fe-0x0;var _0x45d265=_0xcd10[_0xca52fe];return _0x45d265;};'use strict';var Sequelize=require(_0x0cd1('0x0'));module[_0x0cd1('0x1')]={'uniqueid':{'type':Sequelize[_0x0cd1('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0cd1('0x2')]},'data':{'type':Sequelize[_0x0cd1('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3ddd=['STRING','TEXT','exports'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x3ddd,0x134));var _0xd3dd=function(_0x480ca0,_0x4d488a){_0x480ca0=_0x480ca0-0x0;var _0x533ba5=_0x3ddd[_0x480ca0];return _0x533ba5;};'use strict';var Sequelize=require('sequelize');module[_0xd3dd('0x0')]={'uniqueid':{'type':Sequelize[_0xd3dd('0x1')]},'node':{'type':Sequelize[_0xd3dd('0x1')]},'application':{'type':Sequelize[_0xd3dd('0x1')]},'data':{'type':Sequelize[_0xd3dd('0x2')]},'project_name':{'type':Sequelize[_0xd3dd('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f3a20d6..c6a0264 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 _0xba69=['show','params','create','body','update','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','destroy','then','error','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch'];(function(_0x4fff86,_0x3d4c4d){var _0x3ea3bd=function(_0x593c48){while(--_0x593c48){_0x4fff86['push'](_0x4fff86['shift']());}};_0x3ea3bd(++_0x3d4c4d);}(_0xba69,0x11b));var _0x9ba6=function(_0x3efa8c,_0x453777){_0x3efa8c=_0x3efa8c-0x0;var _0x22fd4a=_0xba69[_0x3efa8c];return _0x22fd4a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9ba6('0x0'));var zipdir=require(_0x9ba6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ba6('0x2'));var moment=require(_0x9ba6('0x3'));var BPromise=require(_0x9ba6('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ba6('0x5'));var sox=require('sox');var csv=require(_0x9ba6('0x6'));var ejs=require(_0x9ba6('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9ba6('0x8'));var crypto=require(_0x9ba6('0x9'));var jsforce=require(_0x9ba6('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ba6('0xb'));var Papa=require(_0x9ba6('0xc'));var Redis=require(_0x9ba6('0xd'));var authService=require(_0x9ba6('0xe'));var qs=require(_0x9ba6('0xf'));var as=require(_0x9ba6('0x10'));var hardwareService=require(_0x9ba6('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x9ba6('0x12'));var config=require(_0x9ba6('0x13'));var db=require(_0x9ba6('0x14'))['db'];function respondWithStatusCode(_0x19cd8d,_0x53495c){_0x53495c=_0x53495c||0xcc;return function(_0x19b467){if(_0x19b467){return _0x19cd8d[_0x9ba6('0x15')](_0x53495c);}return _0x19cd8d[_0x9ba6('0x16')](_0x53495c)[_0x9ba6('0x17')]();};}function respondWithResult(_0x194a96,_0x1ccb75){_0x1ccb75=_0x1ccb75||0xc8;return function(_0x113008){if(_0x113008){return _0x194a96[_0x9ba6('0x16')](_0x1ccb75)[_0x9ba6('0x18')](_0x113008);}};}function respondWithFilteredResult(_0x3c612c,_0x3b5fcb){return function(_0x32f85e){if(_0x32f85e){var _0x2d5656=_0x32f85e['count'],_0x1058ed=_0x3b5fcb[_0x9ba6('0x19')],_0xac6fef=_0x3b5fcb[_0x9ba6('0x19')]+_0x3b5fcb['limit'],_0x460903;if(_0xac6fef>=_0x2d5656){_0xac6fef=_0x2d5656;_0x460903=0xc8;}else{_0x460903=0xce;}_0x3c612c[_0x9ba6('0x16')](_0x460903);return _0x3c612c[_0x9ba6('0x1a')](_0x9ba6('0x1b'),_0x1058ed+'-'+_0xac6fef+'/'+_0x2d5656)[_0x9ba6('0x18')](_0x32f85e);}return null;};}function patchUpdates(_0x2f0c77){return function(_0x4c629d){try{jsonpatch['apply'](_0x4c629d,_0x2f0c77,!![]);}catch(_0x4f2bc1){return BPromise[_0x9ba6('0x1c')](_0x4f2bc1);}return _0x4c629d['save']();};}function saveUpdates(_0x6a315f,_0x53a7d6){return function(_0x5a01e4){if(_0x5a01e4){return _0x5a01e4['update'](_0x6a315f)['then'](function(_0x4124d7){return _0x4124d7;});}return null;};}function removeEntity(_0x311038,_0x180dc5){return function(_0x3eb281){if(_0x3eb281){return _0x3eb281[_0x9ba6('0x1d')]()[_0x9ba6('0x1e')](function(){_0x311038[_0x9ba6('0x16')](0xcc)[_0x9ba6('0x17')]();});}};}function handleEntityNotFound(_0x36ee0c,_0x4d01db){return function(_0x4dd2c2){if(!_0x4dd2c2){_0x36ee0c['sendStatus'](0x194);}return _0x4dd2c2;};}function handleError(_0x759ade,_0x68e9e5){_0x68e9e5=_0x68e9e5||0x1f4;return function(_0x4d04f7){logger[_0x9ba6('0x1f')](_0x4d04f7['stack']);if(_0x4d04f7[_0x9ba6('0x20')]){delete _0x4d04f7[_0x9ba6('0x20')];}_0x759ade[_0x9ba6('0x16')](_0x68e9e5)['send'](_0x4d04f7);};}exports[_0x9ba6('0x21')]=function(_0x36cdc8,_0x23cbae){var _0x3d162e={},_0x545011={},_0x59cfa5={'count':0x0,'rows':[]};var _0x5366a6=_[_0x9ba6('0x22')](db[_0x9ba6('0x23')][_0x9ba6('0x24')],function(_0x12bc60){return{'name':_0x12bc60['fieldName'],'type':_0x12bc60[_0x9ba6('0x25')][_0x9ba6('0x26')]};});_0x545011[_0x9ba6('0x27')]=_[_0x9ba6('0x22')](_0x5366a6,_0x9ba6('0x20'));_0x545011[_0x9ba6('0x28')]=_[_0x9ba6('0x29')](_0x36cdc8[_0x9ba6('0x28')]);_0x545011[_0x9ba6('0x2a')]=_[_0x9ba6('0x2b')](_0x545011[_0x9ba6('0x27')],_0x545011[_0x9ba6('0x28')]);_0x3d162e[_0x9ba6('0x2c')]=_[_0x9ba6('0x2b')](_0x545011[_0x9ba6('0x27')],qs[_0x9ba6('0x2d')](_0x36cdc8['query']['fields']));_0x3d162e[_0x9ba6('0x2c')]=_0x3d162e[_0x9ba6('0x2c')][_0x9ba6('0x2e')]?_0x3d162e['attributes']:_0x545011[_0x9ba6('0x27')];if(!_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x2f')](_0x9ba6('0x30'))){_0x3d162e[_0x9ba6('0x31')]=qs[_0x9ba6('0x31')](_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x31')]);_0x3d162e[_0x9ba6('0x19')]=qs[_0x9ba6('0x19')](_0x36cdc8[_0x9ba6('0x28')]['offset']);}_0x3d162e['order']=qs['sort'](_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x32')]);_0x3d162e[_0x9ba6('0x33')]=qs[_0x9ba6('0x2a')](_['pick'](_0x36cdc8['query'],_0x545011[_0x9ba6('0x2a')]),_0x5366a6);if(_0x36cdc8[_0x9ba6('0x28')]['filter']){_0x3d162e['where']=_[_0x9ba6('0x34')](_0x3d162e['where'],{'$or':_[_0x9ba6('0x22')](_0x5366a6,function(_0x44bd27){if(_0x44bd27[_0x9ba6('0x25')]!==_0x9ba6('0x35')){var _0x36299a={};_0x36299a[_0x44bd27[_0x9ba6('0x20')]]={'$like':'%'+_0x36cdc8['query'][_0x9ba6('0x36')]+'%'};return _0x36299a;}})});}_0x3d162e=_['merge']({},_0x3d162e,_0x36cdc8[_0x9ba6('0x37')]);var _0x400424={'where':_0x3d162e[_0x9ba6('0x33')]};return db[_0x9ba6('0x23')][_0x9ba6('0x38')](_0x400424)[_0x9ba6('0x1e')](function(_0x3566e4){_0x59cfa5['count']=_0x3566e4;if(_0x36cdc8[_0x9ba6('0x28')][_0x9ba6('0x39')]){_0x3d162e[_0x9ba6('0x3a')]=[{'all':!![]}];}return db[_0x9ba6('0x23')][_0x9ba6('0x3b')](_0x3d162e);})[_0x9ba6('0x1e')](function(_0x21d0a3){_0x59cfa5[_0x9ba6('0x3c')]=_0x21d0a3;return _0x59cfa5;})[_0x9ba6('0x1e')](respondWithFilteredResult(_0x23cbae,_0x3d162e))[_0x9ba6('0x3d')](handleError(_0x23cbae,null));};exports[_0x9ba6('0x3e')]=function(_0x34d09f,_0x54deca){var _0x3e05c8={'raw':!![],'where':{'id':_0x34d09f[_0x9ba6('0x3f')]['id']}},_0x57c52d={};_0x57c52d[_0x9ba6('0x27')]=_[_0x9ba6('0x29')](db[_0x9ba6('0x23')]['rawAttributes']);_0x57c52d[_0x9ba6('0x28')]=_['keys'](_0x34d09f['query']);_0x57c52d[_0x9ba6('0x2a')]=_[_0x9ba6('0x2b')](_0x57c52d[_0x9ba6('0x27')],_0x57c52d['query']);_0x3e05c8['attributes']=_['intersection'](_0x57c52d[_0x9ba6('0x27')],qs['fields'](_0x34d09f[_0x9ba6('0x28')][_0x9ba6('0x2d')]));_0x3e05c8[_0x9ba6('0x2c')]=_0x3e05c8[_0x9ba6('0x2c')][_0x9ba6('0x2e')]?_0x3e05c8[_0x9ba6('0x2c')]:_0x57c52d['model'];if(_0x34d09f['query']['includeAll']){_0x3e05c8['include']=[{'all':!![]}];}_0x3e05c8=_[_0x9ba6('0x34')]({},_0x3e05c8,_0x34d09f[_0x9ba6('0x37')]);return db['SquareDetailsReport']['find'](_0x3e05c8)[_0x9ba6('0x1e')](handleEntityNotFound(_0x54deca,null))[_0x9ba6('0x1e')](respondWithResult(_0x54deca,null))[_0x9ba6('0x3d')](handleError(_0x54deca,null));};exports[_0x9ba6('0x40')]=function(_0x448c13,_0x2673f4){return db[_0x9ba6('0x23')][_0x9ba6('0x40')](_0x448c13[_0x9ba6('0x41')],{})[_0x9ba6('0x1e')](respondWithResult(_0x2673f4,0xc9))[_0x9ba6('0x3d')](handleError(_0x2673f4,null));};exports[_0x9ba6('0x42')]=function(_0x5cf3fe,_0x25a5b9){if(_0x5cf3fe[_0x9ba6('0x41')]['id']){delete _0x5cf3fe[_0x9ba6('0x41')]['id'];}return db['SquareDetailsReport'][_0x9ba6('0x43')]({'where':{'id':_0x5cf3fe[_0x9ba6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x25a5b9,null))[_0x9ba6('0x1e')](saveUpdates(_0x5cf3fe[_0x9ba6('0x41')],null))[_0x9ba6('0x1e')](respondWithResult(_0x25a5b9,null))[_0x9ba6('0x3d')](handleError(_0x25a5b9,null));};exports[_0x9ba6('0x1d')]=function(_0x3731aa,_0x44ee40){return db['SquareDetailsReport'][_0x9ba6('0x43')]({'where':{'id':_0x3731aa[_0x9ba6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x44ee40,null))[_0x9ba6('0x1e')](removeEntity(_0x44ee40,null))[_0x9ba6('0x3d')](handleError(_0x44ee40,null));};exports[_0x9ba6('0x44')]=function(_0x5e6b98,_0x508042){return db[_0x9ba6('0x23')]['describe']()[_0x9ba6('0x1e')](respondWithResult(_0x508042,null))[_0x9ba6('0x3d')](handleError(_0x508042,null));}; \ No newline at end of file +var _0x5a40=['includeAll','include','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params'];(function(_0x143098,_0xb73c2a){var _0x6c5bac=function(_0x3cbb51){while(--_0x3cbb51){_0x143098['push'](_0x143098['shift']());}};_0x6c5bac(++_0xb73c2a);}(_0x5a40,0x1a1));var _0x05a4=function(_0x43a2af,_0x46b4be){_0x43a2af=_0x43a2af-0x0;var _0x1950aa=_0x5a40[_0x43a2af];return _0x1950aa;};'use strict';var pdf=require(_0x05a4('0x0'));var emlformat=require(_0x05a4('0x1'));var rimraf=require(_0x05a4('0x2'));var zipdir=require(_0x05a4('0x3'));var jsonpatch=require(_0x05a4('0x4'));var rp=require('request-promise');var moment=require(_0x05a4('0x5'));var BPromise=require(_0x05a4('0x6'));var Mustache=require(_0x05a4('0x7'));var util=require(_0x05a4('0x8'));var path=require(_0x05a4('0x9'));var sox=require(_0x05a4('0xa'));var csv=require(_0x05a4('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x05a4('0xc'));var squel=require(_0x05a4('0xd'));var crypto=require(_0x05a4('0xe'));var jsforce=require(_0x05a4('0xf'));var deskjs=require(_0x05a4('0x10'));var toCsv=require(_0x05a4('0xb'));var querystring=require(_0x05a4('0x11'));var Papa=require(_0x05a4('0x12'));var Redis=require(_0x05a4('0x13'));var authService=require(_0x05a4('0x14'));var qs=require(_0x05a4('0x15'));var as=require(_0x05a4('0x16'));var hardwareService=require(_0x05a4('0x17'));var logger=require(_0x05a4('0x18'))(_0x05a4('0x19'));var utils=require(_0x05a4('0x1a'));var config=require(_0x05a4('0x1b'));var db=require(_0x05a4('0x1c'))['db'];function respondWithStatusCode(_0x388514,_0x29425a){_0x29425a=_0x29425a||0xcc;return function(_0x46870d){if(_0x46870d){return _0x388514['sendStatus'](_0x29425a);}return _0x388514[_0x05a4('0x1d')](_0x29425a)['end']();};}function respondWithResult(_0x55027b,_0x5bdbce){_0x5bdbce=_0x5bdbce||0xc8;return function(_0x1d0fee){if(_0x1d0fee){return _0x55027b[_0x05a4('0x1d')](_0x5bdbce)[_0x05a4('0x1e')](_0x1d0fee);}};}function respondWithFilteredResult(_0xe5a502,_0x400366){return function(_0xfb7969){if(_0xfb7969){var _0x19f662=_0xfb7969[_0x05a4('0x1f')],_0x3d1dcc=_0x400366[_0x05a4('0x20')],_0x51851b=_0x400366['offset']+_0x400366[_0x05a4('0x21')],_0x38ad06;if(_0x51851b>=_0x19f662){_0x51851b=_0x19f662;_0x38ad06=0xc8;}else{_0x38ad06=0xce;}_0xe5a502['status'](_0x38ad06);return _0xe5a502[_0x05a4('0x22')](_0x05a4('0x23'),_0x3d1dcc+'-'+_0x51851b+'/'+_0x19f662)[_0x05a4('0x1e')](_0xfb7969);}return null;};}function patchUpdates(_0x4f1ad1){return function(_0x158eeb){try{jsonpatch[_0x05a4('0x24')](_0x158eeb,_0x4f1ad1,!![]);}catch(_0x58ce8c){return BPromise[_0x05a4('0x25')](_0x58ce8c);}return _0x158eeb[_0x05a4('0x26')]();};}function saveUpdates(_0x1d8a8f,_0x4d97e5){return function(_0x2ccec3){if(_0x2ccec3){return _0x2ccec3['update'](_0x1d8a8f)['then'](function(_0x3feffb){return _0x3feffb;});}return null;};}function removeEntity(_0x4a2829,_0x5b8b64){return function(_0x4f3f7f){if(_0x4f3f7f){return _0x4f3f7f[_0x05a4('0x27')]()[_0x05a4('0x28')](function(){_0x4a2829[_0x05a4('0x1d')](0xcc)[_0x05a4('0x29')]();});}};}function handleEntityNotFound(_0x5a0842,_0x49c606){return function(_0x311f40){if(!_0x311f40){_0x5a0842[_0x05a4('0x2a')](0x194);}return _0x311f40;};}function handleError(_0x295492,_0x16668c){_0x16668c=_0x16668c||0x1f4;return function(_0x5ccf65){logger[_0x05a4('0x2b')](_0x5ccf65['stack']);if(_0x5ccf65['name']){delete _0x5ccf65[_0x05a4('0x2c')];}_0x295492[_0x05a4('0x1d')](_0x16668c)[_0x05a4('0x2d')](_0x5ccf65);};}exports[_0x05a4('0x2e')]=function(_0x40f9d7,_0x71c05){var _0x2cc60c={},_0x58fb4c={},_0x1e6c4b={'count':0x0,'rows':[]};var _0xbe2969=_[_0x05a4('0x2f')](db[_0x05a4('0x30')][_0x05a4('0x31')],function(_0x1fbeac){return{'name':_0x1fbeac[_0x05a4('0x32')],'type':_0x1fbeac[_0x05a4('0x33')][_0x05a4('0x34')]};});_0x58fb4c[_0x05a4('0x35')]=_[_0x05a4('0x2f')](_0xbe2969,_0x05a4('0x2c'));_0x58fb4c[_0x05a4('0x36')]=_[_0x05a4('0x37')](_0x40f9d7[_0x05a4('0x36')]);_0x58fb4c[_0x05a4('0x38')]=_[_0x05a4('0x39')](_0x58fb4c[_0x05a4('0x35')],_0x58fb4c[_0x05a4('0x36')]);_0x2cc60c[_0x05a4('0x3a')]=_[_0x05a4('0x39')](_0x58fb4c[_0x05a4('0x35')],qs[_0x05a4('0x3b')](_0x40f9d7[_0x05a4('0x36')]['fields']));_0x2cc60c[_0x05a4('0x3a')]=_0x2cc60c[_0x05a4('0x3a')][_0x05a4('0x3c')]?_0x2cc60c['attributes']:_0x58fb4c['model'];if(!_0x40f9d7[_0x05a4('0x36')][_0x05a4('0x3d')](_0x05a4('0x3e'))){_0x2cc60c[_0x05a4('0x21')]=qs[_0x05a4('0x21')](_0x40f9d7[_0x05a4('0x36')][_0x05a4('0x21')]);_0x2cc60c[_0x05a4('0x20')]=qs[_0x05a4('0x20')](_0x40f9d7[_0x05a4('0x36')][_0x05a4('0x20')]);}_0x2cc60c[_0x05a4('0x3f')]=qs['sort'](_0x40f9d7[_0x05a4('0x36')][_0x05a4('0x40')]);_0x2cc60c[_0x05a4('0x41')]=qs[_0x05a4('0x38')](_['pick'](_0x40f9d7['query'],_0x58fb4c[_0x05a4('0x38')]),_0xbe2969);if(_0x40f9d7[_0x05a4('0x36')][_0x05a4('0x42')]){_0x2cc60c['where']=_['merge'](_0x2cc60c[_0x05a4('0x41')],{'$or':_[_0x05a4('0x2f')](_0xbe2969,function(_0x46d5dc){if(_0x46d5dc['type']!==_0x05a4('0x43')){var _0x10902c={};_0x10902c[_0x46d5dc[_0x05a4('0x2c')]]={'$like':'%'+_0x40f9d7['query']['filter']+'%'};return _0x10902c;}})});}_0x2cc60c=_[_0x05a4('0x44')]({},_0x2cc60c,_0x40f9d7[_0x05a4('0x45')]);var _0x3c5928={'where':_0x2cc60c[_0x05a4('0x41')]};return db[_0x05a4('0x30')][_0x05a4('0x1f')](_0x3c5928)[_0x05a4('0x28')](function(_0xb2f1e2){_0x1e6c4b[_0x05a4('0x1f')]=_0xb2f1e2;if(_0x40f9d7[_0x05a4('0x36')]['includeAll']){_0x2cc60c['include']=[{'all':!![]}];}return db[_0x05a4('0x30')][_0x05a4('0x46')](_0x2cc60c);})[_0x05a4('0x28')](function(_0x37146c){_0x1e6c4b[_0x05a4('0x47')]=_0x37146c;return _0x1e6c4b;})['then'](respondWithFilteredResult(_0x71c05,_0x2cc60c))[_0x05a4('0x48')](handleError(_0x71c05,null));};exports[_0x05a4('0x49')]=function(_0x188c9e,_0x13af85){var _0x40eb9b={'raw':!![],'where':{'id':_0x188c9e[_0x05a4('0x4a')]['id']}},_0x50356a={};_0x50356a[_0x05a4('0x35')]=_['keys'](db[_0x05a4('0x30')]['rawAttributes']);_0x50356a[_0x05a4('0x36')]=_['keys'](_0x188c9e['query']);_0x50356a[_0x05a4('0x38')]=_[_0x05a4('0x39')](_0x50356a[_0x05a4('0x35')],_0x50356a[_0x05a4('0x36')]);_0x40eb9b[_0x05a4('0x3a')]=_[_0x05a4('0x39')](_0x50356a['model'],qs[_0x05a4('0x3b')](_0x188c9e[_0x05a4('0x36')][_0x05a4('0x3b')]));_0x40eb9b[_0x05a4('0x3a')]=_0x40eb9b[_0x05a4('0x3a')][_0x05a4('0x3c')]?_0x40eb9b[_0x05a4('0x3a')]:_0x50356a[_0x05a4('0x35')];if(_0x188c9e[_0x05a4('0x36')][_0x05a4('0x4b')]){_0x40eb9b[_0x05a4('0x4c')]=[{'all':!![]}];}_0x40eb9b=_['merge']({},_0x40eb9b,_0x188c9e[_0x05a4('0x45')]);return db['SquareDetailsReport'][_0x05a4('0x4d')](_0x40eb9b)['then'](handleEntityNotFound(_0x13af85,null))[_0x05a4('0x28')](respondWithResult(_0x13af85,null))[_0x05a4('0x48')](handleError(_0x13af85,null));};exports['create']=function(_0x1b9a47,_0x5e3130){return db[_0x05a4('0x30')][_0x05a4('0x4e')](_0x1b9a47['body'],{})[_0x05a4('0x28')](respondWithResult(_0x5e3130,0xc9))['catch'](handleError(_0x5e3130,null));};exports[_0x05a4('0x4f')]=function(_0x14fd22,_0x24731c){if(_0x14fd22['body']['id']){delete _0x14fd22[_0x05a4('0x50')]['id'];}return db[_0x05a4('0x30')][_0x05a4('0x4d')]({'where':{'id':_0x14fd22[_0x05a4('0x4a')]['id']}})[_0x05a4('0x28')](handleEntityNotFound(_0x24731c,null))['then'](saveUpdates(_0x14fd22[_0x05a4('0x50')],null))['then'](respondWithResult(_0x24731c,null))['catch'](handleError(_0x24731c,null));};exports[_0x05a4('0x27')]=function(_0x450234,_0x5428f0){return db['SquareDetailsReport'][_0x05a4('0x4d')]({'where':{'id':_0x450234[_0x05a4('0x4a')]['id']}})[_0x05a4('0x28')](handleEntityNotFound(_0x5428f0,null))['then'](removeEntity(_0x5428f0,null))['catch'](handleError(_0x5428f0,null));};exports['describe']=function(_0x5eabec,_0x4e5f20){return db[_0x05a4('0x30')][_0x05a4('0x51')]()[_0x05a4('0x28')](respondWithResult(_0x4e5f20,null))[_0x05a4('0x48')](handleError(_0x4e5f20,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4011755..8f476fb 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 _0x3e40=['define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x2e5d46,_0x1df4b5){var _0x4b585e=function(_0x530680){while(--_0x530680){_0x2e5d46['push'](_0x2e5d46['shift']());}};_0x4b585e(++_0x1df4b5);}(_0x3e40,0x147));var _0x03e4=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x3e40[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x03e4('0x0'));var util=require(_0x03e4('0x1'));var logger=require(_0x03e4('0x2'))(_0x03e4('0x3'));var moment=require(_0x03e4('0x4'));var BPromise=require(_0x03e4('0x5'));var rp=require(_0x03e4('0x6'));var fs=require('fs');var path=require(_0x03e4('0x7'));var rimraf=require(_0x03e4('0x8'));var config=require(_0x03e4('0x9'));var attributes=require(_0x03e4('0xa'));module['exports']=function(_0x51a4df,_0x29c458){return _0x51a4df[_0x03e4('0xb')]('SquareDetailsReport',attributes,{'tableName':_0x03e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90f2=['define','SquareDetailsReport','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x90f2,0xde));var _0x290f=function(_0x59d8f5,_0x555984){_0x59d8f5=_0x59d8f5-0x0;var _0x10977b=_0x90f2[_0x59d8f5];return _0x10977b;};'use strict';var _=require('lodash');var util=require(_0x290f('0x0'));var logger=require(_0x290f('0x1'))(_0x290f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x290f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x290f('0x4'));var config=require(_0x290f('0x5'));var attributes=require(_0x290f('0x6'));module[_0x290f('0x7')]=function(_0x194bb0,_0x27e4e7){return _0x194bb0[_0x290f('0x8')](_0x290f('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 9b18858..a454576 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 _0x60f4=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','moment'];(function(_0x26f8de,_0xea5e13){var _0x192c08=function(_0x13467d){while(--_0x13467d){_0x26f8de['push'](_0x26f8de['shift']());}};_0x192c08(++_0xea5e13);}(_0x60f4,0xc1));var _0x460f=function(_0x67f517,_0x372e84){_0x67f517=_0x67f517-0x0;var _0x4b85ea=_0x60f4[_0x67f517];return _0x4b85ea;};'use strict';var _=require(_0x460f('0x0'));var util=require(_0x460f('0x1'));var moment=require(_0x460f('0x2'));var BPromise=require(_0x460f('0x3'));var rs=require(_0x460f('0x4'));var fs=require('fs');var Redis=require(_0x460f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x460f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x460f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x460f('0x8')][_0x460f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107784,_0x24dc56,_0x3985d3){return new BPromise(function(_0x561cee,_0x402e87){return client['request'](_0x107784,_0x3985d3)[_0x460f('0xa')](function(_0x2813b1){logger[_0x460f('0xb')](_0x460f('0xc'),_0x24dc56,_0x460f('0xd'));logger[_0x460f('0xe')](_0x460f('0xf'),_0x24dc56,_0x460f('0xd'),JSON[_0x460f('0x10')](_0x2813b1));if(_0x2813b1[_0x460f('0x11')]){if(_0x2813b1[_0x460f('0x11')][_0x460f('0x12')]===0x1f4){logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);return _0x402e87(_0x2813b1[_0x460f('0x11')]['message']);}logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);return _0x561cee(_0x2813b1[_0x460f('0x11')][_0x460f('0x13')]);}else{logger[_0x460f('0xb')](_0x460f('0xc'),_0x24dc56,_0x460f('0xd'));_0x561cee(_0x2813b1[_0x460f('0x14')][_0x460f('0x13')]);}})['catch'](function(_0x580a7d){logger[_0x460f('0x11')](_0x460f('0xc'),_0x24dc56,_0x580a7d);_0x402e87(_0x580a7d);});});}exports[_0x460f('0x15')]=function(_0x5cc008){var _0xeb8e63=this;return new Promise(function(_0x3a82cb,_0x21899e){return db[_0x460f('0x16')][_0x460f('0x17')](_0x5cc008[_0x460f('0x18')],{'raw':_0x5cc008[_0x460f('0x19')]?_0x5cc008[_0x460f('0x19')][_0x460f('0x1a')]===undefined?!![]:![]:!![]})[_0x460f('0xa')](function(_0x3e526f){logger[_0x460f('0xb')](_0x460f('0x15'),_0x5cc008);logger[_0x460f('0xe')](_0x460f('0x15'),_0x5cc008,JSON[_0x460f('0x10')](_0x3e526f));_0x3a82cb(_0x3e526f);})[_0x460f('0x1b')](function(_0x13893b){logger[_0x460f('0x11')](_0x460f('0x15'),_0x13893b[_0x460f('0x13')],_0x5cc008);_0x21899e(_0xeb8e63[_0x460f('0x11')](0x1f4,_0x13893b['message']));});});}; \ No newline at end of file +var _0xebbe=['../../config/logger','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x493164,_0x21be54){var _0x168dfb=function(_0x456dee){while(--_0x456dee){_0x493164['push'](_0x493164['shift']());}};_0x168dfb(++_0x21be54);}(_0xebbe,0xea));var _0xeebb=function(_0x4f9fae,_0x46f2ef){_0x4f9fae=_0x4f9fae-0x0;var _0x1bde28=_0xebbe[_0x4f9fae];return _0x1bde28;};'use strict';var _=require(_0xeebb('0x0'));var util=require('util');var moment=require(_0xeebb('0x1'));var BPromise=require(_0xeebb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeebb('0x3'));var db=require(_0xeebb('0x4'))['db'];var utils=require(_0xeebb('0x5'));var logger=require(_0xeebb('0x6'))('rpc');var config=require(_0xeebb('0x7'));var jayson=require(_0xeebb('0x8'));var client=jayson['client'][_0xeebb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bb3f6,_0x12a203,_0x1ccb4e){return new BPromise(function(_0x38c849,_0x2750e6){return client['request'](_0x5bb3f6,_0x1ccb4e)[_0xeebb('0xa')](function(_0x4eef52){logger[_0xeebb('0xb')](_0xeebb('0xc'),_0x12a203,_0xeebb('0xd'));logger[_0xeebb('0xe')](_0xeebb('0xf'),_0x12a203,'request\x20sent',JSON[_0xeebb('0x10')](_0x4eef52));if(_0x4eef52[_0xeebb('0x11')]){if(_0x4eef52[_0xeebb('0x11')]['code']===0x1f4){logger[_0xeebb('0x11')](_0xeebb('0xc'),_0x12a203,_0x4eef52[_0xeebb('0x11')][_0xeebb('0x12')]);return _0x2750e6(_0x4eef52[_0xeebb('0x11')][_0xeebb('0x12')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x12a203,_0x4eef52[_0xeebb('0x11')][_0xeebb('0x12')]);return _0x38c849(_0x4eef52[_0xeebb('0x11')][_0xeebb('0x12')]);}else{logger['info'](_0xeebb('0xc'),_0x12a203,_0xeebb('0xd'));_0x38c849(_0x4eef52['result']['message']);}})['catch'](function(_0x1bdf9f){logger['error'](_0xeebb('0xc'),_0x12a203,_0x1bdf9f);_0x2750e6(_0x1bdf9f);});});}exports[_0xeebb('0x13')]=function(_0x5708fa){var _0x478c34=this;return new Promise(function(_0x3c4891,_0x3951a8){return db[_0xeebb('0x14')][_0xeebb('0x15')](_0x5708fa['body'],{'raw':_0x5708fa[_0xeebb('0x16')]?_0x5708fa['options'][_0xeebb('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5b44f1){logger[_0xeebb('0xb')]('CreateSquareDetailsReport',_0x5708fa);logger[_0xeebb('0xe')](_0xeebb('0x13'),_0x5708fa,JSON[_0xeebb('0x10')](_0x5b44f1));_0x3c4891(_0x5b44f1);})['catch'](function(_0x176928){logger[_0xeebb('0x11')](_0xeebb('0x13'),_0x176928[_0xeebb('0x12')],_0x5708fa);_0x3951a8(_0x478c34[_0xeebb('0x11')](0x1f4,_0x176928['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9e239a8..45e0b1f 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 _0x0c11=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service'];(function(_0x3f7dea,_0x410d69){var _0xf629ab=function(_0xe675c){while(--_0xe675c){_0x3f7dea['push'](_0x3f7dea['shift']());}};_0xf629ab(++_0x410d69);}(_0x0c11,0x179));var _0x10c1=function(_0x1e3c02,_0x5c07a2){_0x1e3c02=_0x1e3c02-0x0;var _0x4d26d7=_0x0c11[_0x1e3c02];return _0x4d26d7;};'use strict';var express=require(_0x10c1('0x0'));var router=express[_0x10c1('0x1')]();var auth=require(_0x10c1('0x2'));var controller=require(_0x10c1('0x3'));router[_0x10c1('0x4')]('/',auth[_0x10c1('0x5')](),controller[_0x10c1('0x6')]);router[_0x10c1('0x4')](_0x10c1('0x7'),auth[_0x10c1('0x5')](),controller[_0x10c1('0x8')]);module[_0x10c1('0x9')]=router; \ No newline at end of file +var _0x06f2=['exports','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess'];(function(_0x3d266b,_0x313ab4){var _0x10a2a8=function(_0x12c9c0){while(--_0x12c9c0){_0x3d266b['push'](_0x3d266b['shift']());}};_0x10a2a8(++_0x313ab4);}(_0x06f2,0x190));var _0x206f=function(_0x5164a2,_0x506ac7){_0x5164a2=_0x5164a2-0x0;var _0x2053a=_0x06f2[_0x5164a2];return _0x2053a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x206f('0x0'));router[_0x206f('0x1')]('/',auth['isAuthenticated'](),controller[_0x206f('0x2')]);router['get'](_0x206f('0x3'),auth[_0x206f('0x4')](),controller[_0x206f('0x5')]);module[_0x206f('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4a3c0c5..b42c127 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 _0x1f33=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x656d84,_0xa4df1c){var _0x1772c4=function(_0x2ef4ea){while(--_0x2ef4ea){_0x656d84['push'](_0x656d84['shift']());}};_0x1772c4(++_0xa4df1c);}(_0x1f33,0xd2));var _0x31f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1f33[_0x20a584];return _0x4b41a8;};'use strict';var info=require(_0x31f3('0x0'));var exec=require(_0x31f3('0x1'))['exec'];var logger=require(_0x31f3('0x2'))(_0x31f3('0x3'));var util=require(_0x31f3('0x4'));var BPromise=require(_0x31f3('0x5'));var _=require(_0x31f3('0x6'));function handleError(_0x46654f,_0x4235c7,_0x5b4c8f){_0x4235c7=_0x4235c7||0x1f4;return function(_0x4787db){logger[_0x31f3('0x7')](_0x31f3('0x8'),_0x5b4c8f,_0x4235c7,util['inspect'](_0x4787db,{'showHidden':![],'depth':null}));delete _0x4787db['name'];_0x46654f[_0x31f3('0x9')](_0x4235c7)['send'](_0x4787db);};}exports['index']=function(_0x5ceb6f,_0xd87090){return info[_0x31f3('0xa')]()[_0x31f3('0xb')](function(_0x35ac05){return _0xd87090[_0x31f3('0x9')](0xc8)[_0x31f3('0xc')](_0x35ac05);})[_0x31f3('0xd')](function(_0x1f8967){return _0xd87090[_0x31f3('0x9')](0x1f4)[_0x31f3('0xc')](_0x1f8967);});};exports[_0x31f3('0xe')]=function(_0x57160e,_0x5a2847){var _0x2f29c5=[_0x31f3('0xf')];return new BPromise(function(_0xa8adc3,_0x20c553){return exec(util[_0x31f3('0x10')](_0x31f3('0x11'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]),function(_0x1a5132,_0x4542c5,_0x573362){if(_0x1a5132){return _0x20c553(_0x1a5132);}return _0xa8adc3(_0x4542c5);});})[_0x31f3('0xb')](function(_0x5c61cc){var _0x5cfdd9=![];var _0x4df0bd=_0x5c61cc[_0x31f3('0x14')](/\n/);for(var _0x3d3d71=0x0,_0x23d6aa=_0x2f29c5[_0x31f3('0x15')];_0x3d3d71<_0x23d6aa,_0x5cfdd9===![];_0x3d3d71+=0x1){if(_0x5c61cc[_0x31f3('0x16')](_0x2f29c5[_0x3d3d71])>=0x0){_0x5cfdd9=!![];}}if(!_0x5cfdd9){throw new Error(util[_0x31f3('0x10')](_0x31f3('0x17'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')]));}process[_0x31f3('0x18')](_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')],'SIGINT');return _0x5a2847['status'](0xc8)[_0x31f3('0xc')]({'message':util[_0x31f3('0x10')](_0x31f3('0x19'),_0x57160e[_0x31f3('0x12')][_0x31f3('0x13')])});})[_0x31f3('0xd')](handleError(_0x5a2847,null,_0x31f3('0xe')));}; \ No newline at end of file +var _0xc82c=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','name','send','index','getAllData','then','status','json','catch','killProcess','format','params'];(function(_0x197f54,_0x118a3f){var _0x19448a=function(_0x9ba89d){while(--_0x9ba89d){_0x197f54['push'](_0x197f54['shift']());}};_0x19448a(++_0x118a3f);}(_0xc82c,0x125));var _0xcc82=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xc82c[_0x263a74];return _0x2aa86c;};'use strict';var info=require(_0xcc82('0x0'));var exec=require(_0xcc82('0x1'))['exec'];var logger=require(_0xcc82('0x2'))(_0xcc82('0x3'));var util=require(_0xcc82('0x4'));var BPromise=require(_0xcc82('0x5'));var _=require(_0xcc82('0x6'));function handleError(_0x574cc9,_0x51717f,_0x5be0a2){_0x51717f=_0x51717f||0x1f4;return function(_0x2999d3){logger[_0xcc82('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5be0a2,_0x51717f,util['inspect'](_0x2999d3,{'showHidden':![],'depth':null}));delete _0x2999d3[_0xcc82('0x8')];_0x574cc9['status'](_0x51717f)[_0xcc82('0x9')](_0x2999d3);};}exports[_0xcc82('0xa')]=function(_0x43a467,_0x5bb576){return info[_0xcc82('0xb')]()[_0xcc82('0xc')](function(_0xa5465d){return _0x5bb576[_0xcc82('0xd')](0xc8)[_0xcc82('0xe')](_0xa5465d);})[_0xcc82('0xf')](function(_0x55ef70){return _0x5bb576['status'](0x1f4)[_0xcc82('0xe')](_0x55ef70);});};exports[_0xcc82('0x10')]=function(_0x2ccece,_0x5da539){var _0x5834f8=['components/import/cm'];return new BPromise(function(_0x3d1f62,_0x56372a){return exec(util[_0xcc82('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x2ccece[_0xcc82('0x12')][_0xcc82('0x13')]),function(_0x5ef1a1,_0x2eae84,_0x4b09a6){if(_0x5ef1a1){return _0x56372a(_0x5ef1a1);}return _0x3d1f62(_0x2eae84);});})['then'](function(_0x37172f){var _0x3d113e=![];var _0x216336=_0x37172f[_0xcc82('0x14')](/\n/);for(var _0x45f132=0x0,_0x55b23a=_0x5834f8[_0xcc82('0x15')];_0x45f132<_0x55b23a,_0x3d113e===![];_0x45f132+=0x1){if(_0x37172f[_0xcc82('0x16')](_0x5834f8[_0x45f132])>=0x0){_0x3d113e=!![];}}if(!_0x3d113e){throw new Error(util[_0xcc82('0x11')](_0xcc82('0x17'),_0x2ccece[_0xcc82('0x12')][_0xcc82('0x13')]));}process[_0xcc82('0x18')](_0x2ccece['params'][_0xcc82('0x13')],'SIGINT');return _0x5da539[_0xcc82('0xd')](0xc8)[_0xcc82('0xe')]({'message':util[_0xcc82('0x11')](_0xcc82('0x19'),_0x2ccece[_0xcc82('0x12')][_0xcc82('0x13')])});})[_0xcc82('0xf')](handleError(_0x5da539,null,_0xcc82('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 9fd91a5..80e21e6 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 _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xedd9,0xfc));var _0x9edd=function(_0x595835,_0x445592){_0x595835=_0x595835-0x0;var _0x35115a=_0xedd9[_0x595835];return _0x35115a;};'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('./tag.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file +var _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x236a82,_0x45c3bd){var _0x5024e9=function(_0x455ac1){while(--_0x455ac1){_0x236a82['push'](_0x236a82['shift']());}};_0x5024e9(++_0x45c3bd);}(_0x5c12,0x188));var _0x25c1=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x5c12[_0x37d3f3];return _0x185c9c;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c1('0xb')]('/',auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')](_0x25c1('0xa'),auth['isAuthenticated'](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xa'),auth[_0x25c1('0xc')](),controller[_0x25c1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3939300..916a1d0 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 _0x4024=['STRING','sequelize','exports','name'];(function(_0x253c49,_0x28bd60){var _0x32a636=function(_0x1ec5cd){while(--_0x1ec5cd){_0x253c49['push'](_0x253c49['shift']());}};_0x32a636(++_0x28bd60);}(_0x4024,0x89));var _0x4402=function(_0x1a6066,_0x3a5912){_0x1a6066=_0x1a6066-0x0;var _0x911dc0=_0x4024[_0x1a6066];return _0x911dc0;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4402('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4402('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x4402('0x3')]}}; \ No newline at end of file +var _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x432e04,_0x5e6757){var _0x24e061=function(_0xa9b929){while(--_0xa9b929){_0x432e04['push'](_0x432e04['shift']());}};_0x24e061(++_0x5e6757);}(_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 diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 725b320..7fe9171 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 _0xb810=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','limit','set','apply','reject','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','map','Tag','rawAttributes','fieldName','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','create','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xb810,0x84));var _0x0b81=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xb810[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x0b81('0x0'));var emlformat=require(_0x0b81('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0b81('0x2'));var jsonpatch=require(_0x0b81('0x3'));var rp=require(_0x0b81('0x4'));var moment=require('moment');var BPromise=require(_0x0b81('0x5'));var Mustache=require(_0x0b81('0x6'));var util=require(_0x0b81('0x7'));var path=require(_0x0b81('0x8'));var sox=require('sox');var csv=require(_0x0b81('0x9'));var ejs=require(_0x0b81('0xa'));var fs=require('fs');var _=require(_0x0b81('0xb'));var squel=require('squel');var crypto=require(_0x0b81('0xc'));var jsforce=require(_0x0b81('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0b81('0x9'));var querystring=require('querystring');var Papa=require(_0x0b81('0xe'));var Redis=require(_0x0b81('0xf'));var authService=require(_0x0b81('0x10'));var qs=require(_0x0b81('0x11'));var as=require(_0x0b81('0x12'));var hardwareService=require(_0x0b81('0x13'));var logger=require(_0x0b81('0x14'))(_0x0b81('0x15'));var utils=require(_0x0b81('0x16'));var config=require('../../config/environment');var db=require(_0x0b81('0x17'))['db'];function respondWithStatusCode(_0x28ed85,_0x47c853){_0x47c853=_0x47c853||0xcc;return function(_0x36ac96){if(_0x36ac96){return _0x28ed85['sendStatus'](_0x47c853);}return _0x28ed85[_0x0b81('0x18')](_0x47c853)[_0x0b81('0x19')]();};}function respondWithResult(_0x3c6175,_0x1f36c1){_0x1f36c1=_0x1f36c1||0xc8;return function(_0x1af185){if(_0x1af185){return _0x3c6175['status'](_0x1f36c1)[_0x0b81('0x1a')](_0x1af185);}};}function respondWithFilteredResult(_0x183017,_0x318483){return function(_0x234c2e){if(_0x234c2e){var _0x581626=_0x234c2e[_0x0b81('0x1b')],_0x41c82c=_0x318483['offset'],_0x4aa914=_0x318483['offset']+_0x318483[_0x0b81('0x1c')],_0x43f753;if(_0x4aa914>=_0x581626){_0x4aa914=_0x581626;_0x43f753=0xc8;}else{_0x43f753=0xce;}_0x183017[_0x0b81('0x18')](_0x43f753);return _0x183017[_0x0b81('0x1d')]('Content-Range',_0x41c82c+'-'+_0x4aa914+'/'+_0x581626)[_0x0b81('0x1a')](_0x234c2e);}return null;};}function patchUpdates(_0x4f2274){return function(_0x32719e){try{jsonpatch[_0x0b81('0x1e')](_0x32719e,_0x4f2274,!![]);}catch(_0x38b8cd){return BPromise[_0x0b81('0x1f')](_0x38b8cd);}return _0x32719e['save']();};}function saveUpdates(_0x3d912e,_0x4fb187){return function(_0x10ee49){if(_0x10ee49){return _0x10ee49[_0x0b81('0x20')](_0x3d912e)[_0x0b81('0x21')](function(_0x3c44d2){return _0x3c44d2;});}return null;};}function removeEntity(_0x9ce632,_0xf3eeba){return function(_0x4b6617){if(_0x4b6617){return _0x4b6617[_0x0b81('0x22')]()[_0x0b81('0x21')](function(){var _0x424523=_0x4b6617[_0x0b81('0x23')]({'plain':!![]});var _0x1ba4ef=_0x0b81('0x24');return db[_0x0b81('0x25')]['destroy']({'where':{'type':_0x1ba4ef,'resourceId':_0x424523['id']}})[_0x0b81('0x21')](function(){return _0x4b6617;});})[_0x0b81('0x21')](function(){_0x9ce632[_0x0b81('0x18')](0xcc)[_0x0b81('0x19')]();});}};}function handleEntityNotFound(_0x472b6b,_0x3c909d){return function(_0x56680d){if(!_0x56680d){_0x472b6b[_0x0b81('0x26')](0x194);}return _0x56680d;};}function handleError(_0x100db2,_0x2ac13b){_0x2ac13b=_0x2ac13b||0x1f4;return function(_0x5777f1){logger[_0x0b81('0x27')](_0x5777f1['stack']);if(_0x5777f1[_0x0b81('0x28')]){delete _0x5777f1[_0x0b81('0x28')];}_0x100db2['status'](_0x2ac13b)[_0x0b81('0x29')](_0x5777f1);};}exports['index']=function(_0x1f5498,_0x333417){var _0x11033f={},_0x20c72d={},_0x430280={'count':0x0,'rows':[]};var _0x473a6d=_[_0x0b81('0x2a')](db[_0x0b81('0x2b')][_0x0b81('0x2c')],function(_0x27fc08){return{'name':_0x27fc08[_0x0b81('0x2d')],'type':_0x27fc08['type']['key']};});_0x20c72d[_0x0b81('0x2e')]=_[_0x0b81('0x2a')](_0x473a6d,_0x0b81('0x28'));_0x20c72d['query']=_['keys'](_0x1f5498['query']);_0x20c72d[_0x0b81('0x2f')]=_[_0x0b81('0x30')](_0x20c72d['model'],_0x20c72d[_0x0b81('0x31')]);_0x11033f[_0x0b81('0x32')]=_[_0x0b81('0x30')](_0x20c72d[_0x0b81('0x2e')],qs[_0x0b81('0x33')](_0x1f5498[_0x0b81('0x31')][_0x0b81('0x33')]));_0x11033f[_0x0b81('0x32')]=_0x11033f['attributes'][_0x0b81('0x34')]?_0x11033f[_0x0b81('0x32')]:_0x20c72d[_0x0b81('0x2e')];if(!_0x1f5498['query'][_0x0b81('0x35')]('nolimit')){_0x11033f[_0x0b81('0x1c')]=qs[_0x0b81('0x1c')](_0x1f5498[_0x0b81('0x31')]['limit']);_0x11033f['offset']=qs['offset'](_0x1f5498[_0x0b81('0x31')]['offset']);}_0x11033f[_0x0b81('0x36')]=qs[_0x0b81('0x37')](_0x1f5498['query'][_0x0b81('0x37')]);_0x11033f[_0x0b81('0x38')]=qs['filters'](_[_0x0b81('0x39')](_0x1f5498[_0x0b81('0x31')],_0x20c72d[_0x0b81('0x2f')]),_0x473a6d);if(_0x1f5498[_0x0b81('0x31')]['filter']){_0x11033f[_0x0b81('0x38')]=_['merge'](_0x11033f[_0x0b81('0x38')],{'$or':_['map'](_0x473a6d,function(_0x29573b){if(_0x29573b[_0x0b81('0x3a')]!==_0x0b81('0x3b')){var _0x16666e={};_0x16666e[_0x29573b['name']]={'$like':'%'+_0x1f5498[_0x0b81('0x31')][_0x0b81('0x3c')]+'%'};return _0x16666e;}})});}_0x11033f=_[_0x0b81('0x3d')]({},_0x11033f,_0x1f5498[_0x0b81('0x3e')]);var _0x5ee548={'where':_0x11033f[_0x0b81('0x38')]};return db['Tag'][_0x0b81('0x1b')](_0x5ee548)[_0x0b81('0x21')](function(_0x5b4879){_0x430280['count']=_0x5b4879;if(_0x1f5498[_0x0b81('0x31')]['includeAll']){_0x11033f[_0x0b81('0x3f')]=[{'all':!![]}];}return db[_0x0b81('0x2b')][_0x0b81('0x40')](_0x11033f);})[_0x0b81('0x21')](function(_0x4b8825){_0x430280['rows']=_0x4b8825;return _0x430280;})[_0x0b81('0x21')](respondWithFilteredResult(_0x333417,_0x11033f))[_0x0b81('0x41')](handleError(_0x333417,null));};exports[_0x0b81('0x42')]=function(_0x1c6d4a,_0x563770){var _0x57b137={'raw':!![],'where':{'id':_0x1c6d4a[_0x0b81('0x43')]['id']}},_0x5ba81b={};_0x5ba81b[_0x0b81('0x2e')]=_['keys'](db[_0x0b81('0x2b')][_0x0b81('0x2c')]);_0x5ba81b[_0x0b81('0x31')]=_['keys'](_0x1c6d4a[_0x0b81('0x31')]);_0x5ba81b[_0x0b81('0x2f')]=_['intersection'](_0x5ba81b[_0x0b81('0x2e')],_0x5ba81b[_0x0b81('0x31')]);_0x57b137[_0x0b81('0x32')]=_[_0x0b81('0x30')](_0x5ba81b['model'],qs[_0x0b81('0x33')](_0x1c6d4a[_0x0b81('0x31')]['fields']));_0x57b137[_0x0b81('0x32')]=_0x57b137[_0x0b81('0x32')][_0x0b81('0x34')]?_0x57b137[_0x0b81('0x32')]:_0x5ba81b[_0x0b81('0x2e')];if(_0x1c6d4a['query']['includeAll']){_0x57b137[_0x0b81('0x3f')]=[{'all':!![]}];}_0x57b137=_[_0x0b81('0x3d')]({},_0x57b137,_0x1c6d4a[_0x0b81('0x3e')]);return db[_0x0b81('0x2b')]['find'](_0x57b137)[_0x0b81('0x21')](handleEntityNotFound(_0x563770,null))[_0x0b81('0x21')](respondWithResult(_0x563770,null))[_0x0b81('0x41')](handleError(_0x563770,null));};exports[_0x0b81('0x44')]=function(_0x2879d1,_0xc5ad42){return db['Tag'][_0x0b81('0x44')](_0x2879d1['body'],{})[_0x0b81('0x21')](function(_0x2dc896){var _0x3b9939=_0x2879d1['user'][_0x0b81('0x23')]({'plain':!![]});if(!_0x3b9939)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b9939[_0x0b81('0x45')]===_0x0b81('0x46')){var _0x87938a=_0x2dc896[_0x0b81('0x23')]({'plain':!![]});var _0x37f440='Tags';return db[_0x0b81('0x47')][_0x0b81('0x48')]({'where':{'name':_0x37f440,'userProfileId':_0x3b9939['userProfileId']},'raw':!![]})['then'](function(_0x269c86){if(_0x269c86&&_0x269c86['autoAssociation']===0x0){return db[_0x0b81('0x25')]['create']({'name':_0x87938a[_0x0b81('0x28')],'resourceId':_0x87938a['id'],'type':_0x269c86[_0x0b81('0x28')],'sectionId':_0x269c86['id']},{})[_0x0b81('0x21')](function(){return _0x2dc896;});}else{return _0x2dc896;}})[_0x0b81('0x41')](function(_0x3e01ed){logger[_0x0b81('0x27')](_0x0b81('0x49'),_0x3e01ed);throw _0x3e01ed;});}return _0x2dc896;})[_0x0b81('0x21')](respondWithResult(_0xc5ad42,0xc9))['catch'](handleError(_0xc5ad42,null));};exports[_0x0b81('0x20')]=function(_0x2cd6fb,_0x308b19){if(_0x2cd6fb[_0x0b81('0x4a')]['id']){delete _0x2cd6fb[_0x0b81('0x4a')]['id'];}return db[_0x0b81('0x2b')]['find']({'where':{'id':_0x2cd6fb[_0x0b81('0x43')]['id']}})[_0x0b81('0x21')](handleEntityNotFound(_0x308b19,null))[_0x0b81('0x21')](saveUpdates(_0x2cd6fb[_0x0b81('0x4a')],null))['then'](respondWithResult(_0x308b19,null))[_0x0b81('0x41')](handleError(_0x308b19,null));};exports['destroy']=function(_0x5d759a,_0x6a6bf0){return db[_0x0b81('0x2b')][_0x0b81('0x48')]({'where':{'id':_0x5d759a[_0x0b81('0x43')]['id']}})[_0x0b81('0x21')](handleEntityNotFound(_0x6a6bf0,null))[_0x0b81('0x21')](removeEntity(_0x6a6bf0,null))[_0x0b81('0x41')](handleError(_0x6a6bf0,null));}; \ No newline at end of file +var _0x6d3a=['merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Tags','error','name','send','index','map','Tag','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where'];(function(_0x5cface,_0x23d2bb){var _0x30c155=function(_0x50c483){while(--_0x50c483){_0x5cface['push'](_0x5cface['shift']());}};_0x30c155(++_0x23d2bb);}(_0x6d3a,0x108));var _0xa6d3=function(_0x3828d2,_0x2bab59){_0x3828d2=_0x3828d2-0x0;var _0x469d22=_0x6d3a[_0x3828d2];return _0x469d22;};'use strict';var pdf=require(_0xa6d3('0x0'));var emlformat=require(_0xa6d3('0x1'));var rimraf=require(_0xa6d3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6d3('0x3'));var rp=require(_0xa6d3('0x4'));var moment=require('moment');var BPromise=require(_0xa6d3('0x5'));var Mustache=require(_0xa6d3('0x6'));var util=require(_0xa6d3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa6d3('0x8'));var ejs=require(_0xa6d3('0x9'));var fs=require('fs');var _=require(_0xa6d3('0xa'));var squel=require('squel');var crypto=require(_0xa6d3('0xb'));var jsforce=require(_0xa6d3('0xc'));var deskjs=require(_0xa6d3('0xd'));var toCsv=require(_0xa6d3('0x8'));var querystring=require(_0xa6d3('0xe'));var Papa=require(_0xa6d3('0xf'));var Redis=require(_0xa6d3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa6d3('0x11'));var as=require(_0xa6d3('0x12'));var hardwareService=require(_0xa6d3('0x13'));var logger=require(_0xa6d3('0x14'))(_0xa6d3('0x15'));var utils=require(_0xa6d3('0x16'));var config=require('../../config/environment');var db=require(_0xa6d3('0x17'))['db'];function respondWithStatusCode(_0x16188c,_0xea118a){_0xea118a=_0xea118a||0xcc;return function(_0x373e5d){if(_0x373e5d){return _0x16188c['sendStatus'](_0xea118a);}return _0x16188c[_0xa6d3('0x18')](_0xea118a)[_0xa6d3('0x19')]();};}function respondWithResult(_0x40741c,_0x5747e9){_0x5747e9=_0x5747e9||0xc8;return function(_0x40da5c){if(_0x40da5c){return _0x40741c['status'](_0x5747e9)[_0xa6d3('0x1a')](_0x40da5c);}};}function respondWithFilteredResult(_0x37d87a,_0x496571){return function(_0x2898c8){if(_0x2898c8){var _0x43f646=_0x2898c8[_0xa6d3('0x1b')],_0x148eb7=_0x496571[_0xa6d3('0x1c')],_0x50a69f=_0x496571['offset']+_0x496571[_0xa6d3('0x1d')],_0x596cdf;if(_0x50a69f>=_0x43f646){_0x50a69f=_0x43f646;_0x596cdf=0xc8;}else{_0x596cdf=0xce;}_0x37d87a[_0xa6d3('0x18')](_0x596cdf);return _0x37d87a[_0xa6d3('0x1e')](_0xa6d3('0x1f'),_0x148eb7+'-'+_0x50a69f+'/'+_0x43f646)[_0xa6d3('0x1a')](_0x2898c8);}return null;};}function patchUpdates(_0x51e159){return function(_0x23e734){try{jsonpatch[_0xa6d3('0x20')](_0x23e734,_0x51e159,!![]);}catch(_0x6dc733){return BPromise[_0xa6d3('0x21')](_0x6dc733);}return _0x23e734[_0xa6d3('0x22')]();};}function saveUpdates(_0x3bd8e8,_0x1c9649){return function(_0xd61923){if(_0xd61923){return _0xd61923['update'](_0x3bd8e8)[_0xa6d3('0x23')](function(_0x3f6138){return _0x3f6138;});}return null;};}function removeEntity(_0x5a8c84,_0x557409){return function(_0x5d4b9c){if(_0x5d4b9c){return _0x5d4b9c[_0xa6d3('0x24')]()[_0xa6d3('0x23')](function(){var _0x1cd9ce=_0x5d4b9c[_0xa6d3('0x25')]({'plain':!![]});var _0x13e846=_0xa6d3('0x26');return db['UserProfileResource'][_0xa6d3('0x24')]({'where':{'type':_0x13e846,'resourceId':_0x1cd9ce['id']}})[_0xa6d3('0x23')](function(){return _0x5d4b9c;});})[_0xa6d3('0x23')](function(){_0x5a8c84[_0xa6d3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d85a7,_0x17570b){return function(_0x314ee5){if(!_0x314ee5){_0x5d85a7['sendStatus'](0x194);}return _0x314ee5;};}function handleError(_0x6c1edc,_0x1ad897){_0x1ad897=_0x1ad897||0x1f4;return function(_0x5c7863){logger[_0xa6d3('0x27')](_0x5c7863['stack']);if(_0x5c7863[_0xa6d3('0x28')]){delete _0x5c7863['name'];}_0x6c1edc[_0xa6d3('0x18')](_0x1ad897)[_0xa6d3('0x29')](_0x5c7863);};}exports[_0xa6d3('0x2a')]=function(_0x489236,_0x121230){var _0x49512e={},_0x266823={},_0x18bdc0={'count':0x0,'rows':[]};var _0x33211a=_[_0xa6d3('0x2b')](db[_0xa6d3('0x2c')][_0xa6d3('0x2d')],function(_0x37c9ec){return{'name':_0x37c9ec[_0xa6d3('0x2e')],'type':_0x37c9ec[_0xa6d3('0x2f')]['key']};});_0x266823[_0xa6d3('0x30')]=_['map'](_0x33211a,'name');_0x266823['query']=_[_0xa6d3('0x31')](_0x489236[_0xa6d3('0x32')]);_0x266823[_0xa6d3('0x33')]=_['intersection'](_0x266823[_0xa6d3('0x30')],_0x266823[_0xa6d3('0x32')]);_0x49512e[_0xa6d3('0x34')]=_[_0xa6d3('0x35')](_0x266823[_0xa6d3('0x30')],qs[_0xa6d3('0x36')](_0x489236[_0xa6d3('0x32')][_0xa6d3('0x36')]));_0x49512e['attributes']=_0x49512e[_0xa6d3('0x34')]['length']?_0x49512e[_0xa6d3('0x34')]:_0x266823[_0xa6d3('0x30')];if(!_0x489236[_0xa6d3('0x32')][_0xa6d3('0x37')]('nolimit')){_0x49512e[_0xa6d3('0x1d')]=qs[_0xa6d3('0x1d')](_0x489236['query'][_0xa6d3('0x1d')]);_0x49512e[_0xa6d3('0x1c')]=qs[_0xa6d3('0x1c')](_0x489236[_0xa6d3('0x32')][_0xa6d3('0x1c')]);}_0x49512e[_0xa6d3('0x38')]=qs[_0xa6d3('0x39')](_0x489236[_0xa6d3('0x32')][_0xa6d3('0x39')]);_0x49512e['where']=qs[_0xa6d3('0x33')](_['pick'](_0x489236[_0xa6d3('0x32')],_0x266823[_0xa6d3('0x33')]),_0x33211a);if(_0x489236[_0xa6d3('0x32')][_0xa6d3('0x3a')]){_0x49512e[_0xa6d3('0x3b')]=_[_0xa6d3('0x3c')](_0x49512e[_0xa6d3('0x3b')],{'$or':_[_0xa6d3('0x2b')](_0x33211a,function(_0x59984d){if(_0x59984d[_0xa6d3('0x2f')]!==_0xa6d3('0x3d')){var _0x5f3f85={};_0x5f3f85[_0x59984d[_0xa6d3('0x28')]]={'$like':'%'+_0x489236[_0xa6d3('0x32')][_0xa6d3('0x3a')]+'%'};return _0x5f3f85;}})});}_0x49512e=_[_0xa6d3('0x3c')]({},_0x49512e,_0x489236[_0xa6d3('0x3e')]);var _0x14f49d={'where':_0x49512e[_0xa6d3('0x3b')]};return db['Tag'][_0xa6d3('0x1b')](_0x14f49d)[_0xa6d3('0x23')](function(_0x4a0096){_0x18bdc0[_0xa6d3('0x1b')]=_0x4a0096;if(_0x489236[_0xa6d3('0x32')][_0xa6d3('0x3f')]){_0x49512e['include']=[{'all':!![]}];}return db[_0xa6d3('0x2c')][_0xa6d3('0x40')](_0x49512e);})[_0xa6d3('0x23')](function(_0x38e8fb){_0x18bdc0[_0xa6d3('0x41')]=_0x38e8fb;return _0x18bdc0;})[_0xa6d3('0x23')](respondWithFilteredResult(_0x121230,_0x49512e))[_0xa6d3('0x42')](handleError(_0x121230,null));};exports[_0xa6d3('0x43')]=function(_0x2aaa05,_0x1ada19){var _0x331486={'raw':!![],'where':{'id':_0x2aaa05['params']['id']}},_0x299692={};_0x299692[_0xa6d3('0x30')]=_[_0xa6d3('0x31')](db['Tag'][_0xa6d3('0x2d')]);_0x299692[_0xa6d3('0x32')]=_[_0xa6d3('0x31')](_0x2aaa05[_0xa6d3('0x32')]);_0x299692[_0xa6d3('0x33')]=_[_0xa6d3('0x35')](_0x299692['model'],_0x299692[_0xa6d3('0x32')]);_0x331486[_0xa6d3('0x34')]=_['intersection'](_0x299692['model'],qs['fields'](_0x2aaa05[_0xa6d3('0x32')][_0xa6d3('0x36')]));_0x331486['attributes']=_0x331486[_0xa6d3('0x34')][_0xa6d3('0x44')]?_0x331486['attributes']:_0x299692['model'];if(_0x2aaa05[_0xa6d3('0x32')][_0xa6d3('0x3f')]){_0x331486[_0xa6d3('0x45')]=[{'all':!![]}];}_0x331486=_['merge']({},_0x331486,_0x2aaa05[_0xa6d3('0x3e')]);return db['Tag'][_0xa6d3('0x46')](_0x331486)[_0xa6d3('0x23')](handleEntityNotFound(_0x1ada19,null))[_0xa6d3('0x23')](respondWithResult(_0x1ada19,null))[_0xa6d3('0x42')](handleError(_0x1ada19,null));};exports['create']=function(_0x3ee4b9,_0x21e6c5){return db[_0xa6d3('0x2c')]['create'](_0x3ee4b9[_0xa6d3('0x47')],{})[_0xa6d3('0x23')](function(_0x5470be){var _0x3e0f72=_0x3ee4b9[_0xa6d3('0x48')][_0xa6d3('0x25')]({'plain':!![]});if(!_0x3e0f72)throw new Error(_0xa6d3('0x49'));if(_0x3e0f72[_0xa6d3('0x4a')]===_0xa6d3('0x48')){var _0x59a745=_0x5470be['get']({'plain':!![]});var _0x243cbc=_0xa6d3('0x26');return db[_0xa6d3('0x4b')][_0xa6d3('0x46')]({'where':{'name':_0x243cbc,'userProfileId':_0x3e0f72[_0xa6d3('0x4c')]},'raw':!![]})[_0xa6d3('0x23')](function(_0xee59e7){if(_0xee59e7&&_0xee59e7[_0xa6d3('0x4d')]===0x0){return db[_0xa6d3('0x4e')]['create']({'name':_0x59a745['name'],'resourceId':_0x59a745['id'],'type':_0xee59e7['name'],'sectionId':_0xee59e7['id']},{})['then'](function(){return _0x5470be;});}else{return _0x5470be;}})[_0xa6d3('0x42')](function(_0x57082e){logger[_0xa6d3('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57082e);throw _0x57082e;});}return _0x5470be;})[_0xa6d3('0x23')](respondWithResult(_0x21e6c5,0xc9))[_0xa6d3('0x42')](handleError(_0x21e6c5,null));};exports[_0xa6d3('0x4f')]=function(_0x1cf8ef,_0x3680cb){if(_0x1cf8ef['body']['id']){delete _0x1cf8ef['body']['id'];}return db[_0xa6d3('0x2c')][_0xa6d3('0x46')]({'where':{'id':_0x1cf8ef[_0xa6d3('0x50')]['id']}})[_0xa6d3('0x23')](handleEntityNotFound(_0x3680cb,null))[_0xa6d3('0x23')](saveUpdates(_0x1cf8ef[_0xa6d3('0x47')],null))[_0xa6d3('0x23')](respondWithResult(_0x3680cb,null))[_0xa6d3('0x42')](handleError(_0x3680cb,null));};exports[_0xa6d3('0x24')]=function(_0x1d75c,_0x4de78f){return db[_0xa6d3('0x2c')][_0xa6d3('0x46')]({'where':{'id':_0x1d75c['params']['id']}})['then'](handleEntityNotFound(_0x4de78f,null))['then'](removeEntity(_0x4de78f,null))[_0xa6d3('0x42')](handleError(_0x4de78f,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 9471113..39b58d8 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 _0x74eb=['./tag.attributes','define','Tag','tools_tags','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xdc4e5e,_0x31d26d){var _0x466a3a=function(_0x3bd421){while(--_0x3bd421){_0xdc4e5e['push'](_0xdc4e5e['shift']());}};_0x466a3a(++_0x31d26d);}(_0x74eb,0x67));var _0xb74e=function(_0x2899ec,_0x583f27){_0x2899ec=_0x2899ec-0x0;var _0x2b2e7e=_0x74eb[_0x2899ec];return _0x2b2e7e;};'use strict';var _=require('lodash');var util=require(_0xb74e('0x0'));var logger=require(_0xb74e('0x1'))(_0xb74e('0x2'));var moment=require(_0xb74e('0x3'));var BPromise=require(_0xb74e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb74e('0x5'));var rimraf=require(_0xb74e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb74e('0x7'));module['exports']=function(_0x14e9e4,_0x36a87d){return _0x14e9e4[_0xb74e('0x8')](_0xb74e('0x9'),attributes,{'tableName':_0xb74e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a7=['exports','define','Tag','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2736c9,_0x56ccdc){var _0x2a4e15=function(_0x209986){while(--_0x209986){_0x2736c9['push'](_0x2736c9['shift']());}};_0x2a4e15(++_0x56ccdc);}(_0xe4a7,0x101));var _0x7e4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe4a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7e4a('0x0'));var util=require(_0x7e4a('0x1'));var logger=require(_0x7e4a('0x2'))('api');var moment=require(_0x7e4a('0x3'));var BPromise=require(_0x7e4a('0x4'));var rp=require(_0x7e4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e4a('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x7e4a('0x7')]=function(_0x3e9ab7,_0xda260){return _0x3e9ab7[_0x7e4a('0x8')](_0x7e4a('0x9'),attributes,{'tableName':_0x7e4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index c4f3c96..c53a37b 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 _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3428fa,_0x46919d){var _0x32acfa=function(_0x224235){while(--_0x224235){_0x3428fa['push'](_0x3428fa['shift']());}};_0x32acfa(++_0x46919d);}(_0xca66,0x8b));var _0x6ca6=function(_0x4293af,_0x2608a6){_0x4293af=_0x4293af-0x0;var _0x305d08=_0xca66[_0x4293af];return _0x305d08;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file +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(_0x1efd8f,_0x1e5c1a){var _0x5ee2cc=function(_0x1ad0f0){while(--_0x1ad0f0){_0x1efd8f['push'](_0x1efd8f['shift']());}};_0x5ee2cc(++_0x1e5c1a);}(_0x4e81,0x1bc));var _0x14e8=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x4e81[_0x237546];return _0x233e29;};'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 diff --git a/server/api/team/index.js b/server/api/team/index.js index 7d8cd7c..2f491e3 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 _0x8779=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','removeAgents','exports','multer'];(function(_0x1fc3aa,_0x1b92fd){var _0x11dd40=function(_0x4b8205){while(--_0x4b8205){_0x1fc3aa['push'](_0x1fc3aa['shift']());}};_0x11dd40(++_0x1b92fd);}(_0x8779,0x194));var _0x9877=function(_0x2d8182,_0x3484a9){_0x2d8182=_0x2d8182-0x0;var _0x3740a5=_0x8779[_0x2d8182];return _0x3740a5;};'use strict';var multer=require(_0x9877('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9877('0x1'));var express=require('express');var router=express[_0x9877('0x2')]();var auth=require(_0x9877('0x3'));var interaction=require(_0x9877('0x4'));var config=require(_0x9877('0x5'));var controller=require(_0x9877('0x6'));router[_0x9877('0x7')]('/',auth[_0x9877('0x8')](),controller[_0x9877('0x9')]);router[_0x9877('0x7')](_0x9877('0xa'),auth[_0x9877('0x8')](),controller[_0x9877('0xb')]);router[_0x9877('0x7')](_0x9877('0xc'),auth['isAuthenticated'](),controller[_0x9877('0xd')]);router['get'](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0xf')]);router[_0x9877('0x10')]('/',auth[_0x9877('0x8')](),controller[_0x9877('0x11')]);router['post']('/:id/queues',auth[_0x9877('0x8')](),controller[_0x9877('0x12')]);router[_0x9877('0x10')](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0x13')]);router[_0x9877('0x14')](_0x9877('0xa'),auth['isAuthenticated'](),controller[_0x9877('0x15')]);router[_0x9877('0x16')](_0x9877('0xa'),auth['isAuthenticated'](),controller[_0x9877('0x17')]);router[_0x9877('0x16')](_0x9877('0xc'),auth['isAuthenticated'](),controller[_0x9877('0x18')]);router[_0x9877('0x16')](_0x9877('0xe'),auth[_0x9877('0x8')](),controller[_0x9877('0x19')]);module[_0x9877('0x1a')]=router; \ No newline at end of file +var _0x0c8d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','/:id/queues','getQueues','/:id/users','post','create','addQueues','addAgents','delete','destroy','removeQueues','removeAgents','exports','util'];(function(_0x397e69,_0x5d9128){var _0x596b85=function(_0x2899cd){while(--_0x2899cd){_0x397e69['push'](_0x397e69['shift']());}};_0x596b85(++_0x5d9128);}(_0x0c8d,0xf9));var _0xd0c8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x0c8d[_0x25e7cb];return _0x375d92;};'use strict';var multer=require('multer');var util=require(_0xd0c8('0x0'));var path=require(_0xd0c8('0x1'));var timeout=require(_0xd0c8('0x2'));var express=require(_0xd0c8('0x3'));var router=express[_0xd0c8('0x4')]();var auth=require(_0xd0c8('0x5'));var interaction=require(_0xd0c8('0x6'));var config=require(_0xd0c8('0x7'));var controller=require(_0xd0c8('0x8'));router[_0xd0c8('0x9')]('/',auth[_0xd0c8('0xa')](),controller[_0xd0c8('0xb')]);router[_0xd0c8('0x9')](_0xd0c8('0xc'),auth[_0xd0c8('0xa')](),controller['show']);router[_0xd0c8('0x9')](_0xd0c8('0xd'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0xe')]);router['get'](_0xd0c8('0xf'),auth[_0xd0c8('0xa')](),controller['getAgents']);router[_0xd0c8('0x10')]('/',auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x11')]);router[_0xd0c8('0x10')](_0xd0c8('0xd'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x12')]);router['post'](_0xd0c8('0xf'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x13')]);router['put']('/:id',auth[_0xd0c8('0xa')](),controller['update']);router[_0xd0c8('0x14')](_0xd0c8('0xc'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x15')]);router[_0xd0c8('0x14')](_0xd0c8('0xd'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x16')]);router['delete'](_0xd0c8('0xf'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0x17')]);module[_0xd0c8('0x18')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 5a15657..b629a84 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 _0xf00d=['exports','name','STRING','sequelize'];(function(_0x55655d,_0x2ac9cd){var _0x4d342f=function(_0x481230){while(--_0x481230){_0x55655d['push'](_0x55655d['shift']());}};_0x4d342f(++_0x2ac9cd);}(_0xf00d,0xf3));var _0xdf00=function(_0x3b81d4,_0x4ef011){_0x3b81d4=_0x3b81d4-0x0;var _0x5a5a59=_0xf00d[_0x3b81d4];return _0x5a5a59;};'use strict';var Sequelize=require(_0xdf00('0x0'));module[_0xdf00('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdf00('0x2')},'description':{'type':Sequelize[_0xdf00('0x3')]}}; \ No newline at end of file +var _0xa6bb=['exports','STRING','name'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xa6bb,0x168));var _0xba6b=function(_0x3a30cf,_0x21d805){_0x3a30cf=_0x3a30cf-0x0;var _0x597e79=_0xa6bb[_0x3a30cf];return _0x597e79;};'use strict';var Sequelize=require('sequelize');module[_0xba6b('0x0')]={'name':{'type':Sequelize[_0xba6b('0x1')],'allowNull':![],'unique':_0xba6b('0x2')},'description':{'type':Sequelize[_0xba6b('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2bf66c3..e7a46fc 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 _0x3657=['map','Team','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','count','include','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Unknown\x20channel','add','ids','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','interface','isNil','SIP/%s','omit','spread','emit','userTeam:save','voice','mail','sms','fax','whatsapp','removeAgents','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','sort','options','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','offset','limit','set','Content-Range','apply','save','update','then','get','Teams','UserProfileResource','destroy','end','error','stack','name','send','index'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x3657,0xcd));var _0x7365=function(_0x2cac50,_0x320bb5){_0x2cac50=_0x2cac50-0x0;var _0x1b7d73=_0x3657[_0x2cac50];return _0x1b7d73;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7365('0x2'));var rp=require(_0x7365('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7365('0x4'));var path=require(_0x7365('0x5'));var sox=require(_0x7365('0x6'));var csv=require(_0x7365('0x7'));var ejs=require(_0x7365('0x8'));var fs=require('fs');var _=require(_0x7365('0x9'));var squel=require(_0x7365('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7365('0xb'));var toCsv=require(_0x7365('0x7'));var querystring=require(_0x7365('0xc'));var Papa=require(_0x7365('0xd'));var Redis=require(_0x7365('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x10'));var logger=require(_0x7365('0x11'))(_0x7365('0x12'));var utils=require(_0x7365('0x13'));var config=require(_0x7365('0x14'));var db=require(_0x7365('0x15'))['db'];config[_0x7365('0x16')]=_[_0x7365('0x17')](config[_0x7365('0x16')],{'host':_0x7365('0x18'),'port':0x18eb});var socket=require(_0x7365('0x19'))(new Redis(config['redis']));require(_0x7365('0x1a'))['register'](socket);function respondWithStatusCode(_0x223d8d,_0xf578c7){_0xf578c7=_0xf578c7||0xcc;return function(_0x516c6c){if(_0x516c6c){return _0x223d8d[_0x7365('0x1b')](_0xf578c7);}return _0x223d8d[_0x7365('0x1c')](_0xf578c7)['end']();};}function respondWithResult(_0x1481a0,_0x2d0251){_0x2d0251=_0x2d0251||0xc8;return function(_0x1c3b45){if(_0x1c3b45){return _0x1481a0[_0x7365('0x1c')](_0x2d0251)['json'](_0x1c3b45);}};}function respondWithFilteredResult(_0x4af180,_0x42d5ef){return function(_0x4e4471){if(_0x4e4471){var _0x2200c3=_0x4e4471['count'],_0x39ec6b=_0x42d5ef[_0x7365('0x1d')],_0x26bd84=_0x42d5ef[_0x7365('0x1d')]+_0x42d5ef[_0x7365('0x1e')],_0x251a97;if(_0x26bd84>=_0x2200c3){_0x26bd84=_0x2200c3;_0x251a97=0xc8;}else{_0x251a97=0xce;}_0x4af180[_0x7365('0x1c')](_0x251a97);return _0x4af180[_0x7365('0x1f')](_0x7365('0x20'),_0x39ec6b+'-'+_0x26bd84+'/'+_0x2200c3)['json'](_0x4e4471);}return null;};}function patchUpdates(_0x1322cf){return function(_0x4ec5b2){try{jsonpatch[_0x7365('0x21')](_0x4ec5b2,_0x1322cf,!![]);}catch(_0xc9655e){return BPromise['reject'](_0xc9655e);}return _0x4ec5b2[_0x7365('0x22')]();};}function saveUpdates(_0x50da27,_0x11c48c){return function(_0x5a6314){if(_0x5a6314){return _0x5a6314[_0x7365('0x23')](_0x50da27)[_0x7365('0x24')](function(_0x372095){return _0x372095;});}return null;};}function removeEntity(_0x18c067,_0x104925){return function(_0x28204e){if(_0x28204e){return _0x28204e['destroy']()[_0x7365('0x24')](function(){var _0x1145a5=_0x28204e[_0x7365('0x25')]({'plain':!![]});var _0x43086e=_0x7365('0x26');return db[_0x7365('0x27')][_0x7365('0x28')]({'where':{'type':_0x43086e,'resourceId':_0x1145a5['id']}})[_0x7365('0x24')](function(){return _0x28204e;});})['then'](function(){_0x18c067['status'](0xcc)[_0x7365('0x29')]();});}};}function handleEntityNotFound(_0x342dd8,_0xc35e4d){return function(_0x1aa364){if(!_0x1aa364){_0x342dd8[_0x7365('0x1b')](0x194);}return _0x1aa364;};}function handleError(_0x4b1cc1,_0x5eda72){_0x5eda72=_0x5eda72||0x1f4;return function(_0x50e8a0){logger[_0x7365('0x2a')](_0x50e8a0[_0x7365('0x2b')]);if(_0x50e8a0[_0x7365('0x2c')]){delete _0x50e8a0['name'];}_0x4b1cc1[_0x7365('0x1c')](_0x5eda72)[_0x7365('0x2d')](_0x50e8a0);};}exports[_0x7365('0x2e')]=function(_0x182387,_0x23ecba){var _0x5899b3={},_0x2faef5={},_0x330690={'count':0x0,'rows':[]};var _0x4a4f64=_[_0x7365('0x2f')](db[_0x7365('0x30')][_0x7365('0x31')],function(_0x1e04ef){return{'name':_0x1e04ef[_0x7365('0x32')],'type':_0x1e04ef[_0x7365('0x33')][_0x7365('0x34')]};});_0x2faef5['model']=_['map'](_0x4a4f64,_0x7365('0x2c'));_0x2faef5[_0x7365('0x35')]=_[_0x7365('0x36')](_0x182387[_0x7365('0x35')]);_0x2faef5['filters']=_[_0x7365('0x37')](_0x2faef5[_0x7365('0x38')],_0x2faef5['query']);_0x5899b3[_0x7365('0x39')]=_['intersection'](_0x2faef5['model'],qs[_0x7365('0x3a')](_0x182387[_0x7365('0x35')][_0x7365('0x3a')]));_0x5899b3[_0x7365('0x39')]=_0x5899b3['attributes'][_0x7365('0x3b')]?_0x5899b3[_0x7365('0x39')]:_0x2faef5[_0x7365('0x38')];if(!_0x182387['query'][_0x7365('0x3c')]('nolimit')){_0x5899b3['limit']=qs['limit'](_0x182387['query'][_0x7365('0x1e')]);_0x5899b3[_0x7365('0x1d')]=qs['offset'](_0x182387[_0x7365('0x35')][_0x7365('0x1d')]);}_0x5899b3[_0x7365('0x3d')]=qs['sort'](_0x182387[_0x7365('0x35')]['sort']);_0x5899b3[_0x7365('0x3e')]=qs[_0x7365('0x3f')](_[_0x7365('0x40')](_0x182387[_0x7365('0x35')],_0x2faef5[_0x7365('0x3f')]),_0x4a4f64);if(_0x182387[_0x7365('0x35')][_0x7365('0x41')]){_0x5899b3[_0x7365('0x3e')]=_[_0x7365('0x42')](_0x5899b3[_0x7365('0x3e')],{'$or':_[_0x7365('0x2f')](_0x4a4f64,function(_0x5d4371){if(_0x5d4371[_0x7365('0x33')]!==_0x7365('0x43')){var _0xe3a6d5={};_0xe3a6d5[_0x5d4371[_0x7365('0x2c')]]={'$like':'%'+_0x182387[_0x7365('0x35')][_0x7365('0x41')]+'%'};return _0xe3a6d5;}})});}_0x5899b3=_[_0x7365('0x42')]({},_0x5899b3,_0x182387['options']);var _0x3d1787={'where':_0x5899b3['where']};return db[_0x7365('0x30')][_0x7365('0x44')](_0x3d1787)[_0x7365('0x24')](function(_0x4d5c4c){_0x330690[_0x7365('0x44')]=_0x4d5c4c;if(_0x182387[_0x7365('0x35')]['includeAll']){_0x5899b3[_0x7365('0x45')]=[{'all':!![]}];}return db[_0x7365('0x30')]['findAll'](_0x5899b3);})[_0x7365('0x24')](function(_0x315459){_0x330690['rows']=_0x315459;return _0x330690;})[_0x7365('0x24')](respondWithFilteredResult(_0x23ecba,_0x5899b3))['catch'](handleError(_0x23ecba,null));};exports['show']=function(_0x291295,_0x227444){var _0x314c63={'raw':![],'where':{'id':_0x291295[_0x7365('0x46')]['id']}},_0xf9c9ca={};_0xf9c9ca[_0x7365('0x38')]=_[_0x7365('0x36')](db[_0x7365('0x30')][_0x7365('0x31')]);_0xf9c9ca[_0x7365('0x35')]=_['keys'](_0x291295[_0x7365('0x35')]);_0xf9c9ca['filters']=_[_0x7365('0x37')](_0xf9c9ca[_0x7365('0x38')],_0xf9c9ca['query']);_0x314c63[_0x7365('0x39')]=_[_0x7365('0x37')](_0xf9c9ca['model'],qs[_0x7365('0x3a')](_0x291295[_0x7365('0x35')][_0x7365('0x3a')]));_0x314c63[_0x7365('0x39')]=_0x314c63['attributes'][_0x7365('0x3b')]?_0x314c63[_0x7365('0x39')]:_0xf9c9ca[_0x7365('0x38')];if(_0x291295[_0x7365('0x35')][_0x7365('0x47')]){_0x314c63[_0x7365('0x45')]=[{'all':!![]}];}_0x314c63=_[_0x7365('0x42')]({},_0x314c63,_0x291295['options']);return db[_0x7365('0x30')][_0x7365('0x48')](_0x314c63)['then'](handleEntityNotFound(_0x227444,null))[_0x7365('0x24')](respondWithResult(_0x227444,null))[_0x7365('0x49')](handleError(_0x227444,null));};exports[_0x7365('0x4a')]=function(_0x1cabdc,_0xb15349){return db[_0x7365('0x30')][_0x7365('0x4a')](_0x1cabdc[_0x7365('0x4b')],{})[_0x7365('0x24')](function(_0x234c98){var _0x1f2e4a=_0x1cabdc['user'][_0x7365('0x25')]({'plain':!![]});if(!_0x1f2e4a)throw new Error(_0x7365('0x4c'));if(_0x1f2e4a[_0x7365('0x4d')]===_0x7365('0x4e')){var _0x213306=_0x234c98[_0x7365('0x25')]({'plain':!![]});var _0x2f0b7c=_0x7365('0x26');return db['UserProfileSection'][_0x7365('0x48')]({'where':{'name':_0x2f0b7c,'userProfileId':_0x1f2e4a[_0x7365('0x4f')]},'raw':!![]})[_0x7365('0x24')](function(_0x3ed655){if(_0x3ed655&&_0x3ed655['autoAssociation']===0x0){return db[_0x7365('0x27')][_0x7365('0x4a')]({'name':_0x213306['name'],'resourceId':_0x213306['id'],'type':_0x3ed655[_0x7365('0x2c')],'sectionId':_0x3ed655['id']},{})[_0x7365('0x24')](function(){return _0x234c98;});}else{return _0x234c98;}})[_0x7365('0x49')](function(_0x37f24c){logger['error'](_0x7365('0x50'),_0x37f24c);throw _0x37f24c;});}return _0x234c98;})[_0x7365('0x24')](respondWithResult(_0xb15349,0xc9))[_0x7365('0x49')](handleError(_0xb15349,null));};exports[_0x7365('0x23')]=function(_0x472910,_0x13b70a){if(_0x472910[_0x7365('0x4b')]['id']){delete _0x472910[_0x7365('0x4b')]['id'];}return db['Team'][_0x7365('0x48')]({'where':{'id':_0x472910[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x13b70a,null))['then'](saveUpdates(_0x472910[_0x7365('0x4b')],null))['then'](respondWithResult(_0x13b70a,null))[_0x7365('0x49')](handleError(_0x13b70a,null));};exports['destroy']=function(_0x15298a,_0x47f166){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x15298a['params']['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x47f166,null))[_0x7365('0x24')](removeEntity(_0x47f166,null))[_0x7365('0x49')](handleError(_0x47f166,null));};exports[_0x7365('0x51')]=function(_0x16375e,_0x3b738b,_0x558be5){return db[_0x7365('0x30')][_0x7365('0x52')]({'where':{'id':_0x16375e[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x3b738b,null))[_0x7365('0x24')](function(_0x30b838){if(!_0x16375e['query'][_0x7365('0x53')]||!utils[_0x7365('0x54')](_0x16375e['query'][_0x7365('0x53')])){throw new db[(_0x7365('0x55'))][(_0x7365('0x56'))]('Unknown\x20channel');}var _0x479815={};var _0x1a0c84={};_0x1a0c84[_0x7365('0x38')]=_['keys'](db[_[_0x7365('0x57')](_0x16375e[_0x7365('0x35')]['channel'][_0x7365('0x58')]())+_0x7365('0x59')][_0x7365('0x31')]);_0x1a0c84[_0x7365('0x35')]=_[_0x7365('0x36')](_0x16375e[_0x7365('0x35')]);_0x1a0c84['filters']=_['intersection'](_0x1a0c84[_0x7365('0x38')],_0x1a0c84[_0x7365('0x35')]);_0x479815['attributes']=_[_0x7365('0x37')](_0x1a0c84[_0x7365('0x38')],qs[_0x7365('0x3a')](_0x16375e['query'][_0x7365('0x3a')]));_0x479815[_0x7365('0x39')]=_0x479815[_0x7365('0x39')][_0x7365('0x3b')]?_0x479815['attributes']:_0x1a0c84[_0x7365('0x38')];_0x479815[_0x7365('0x1e')]=qs['limit'](_0x16375e[_0x7365('0x35')][_0x7365('0x1e')]);_0x479815[_0x7365('0x1d')]=qs[_0x7365('0x1d')](_0x16375e[_0x7365('0x35')]['offset']);_0x479815['order']=qs['sort'](_0x16375e[_0x7365('0x35')]['sort']);_0x479815[_0x7365('0x3e')]=qs[_0x7365('0x3f')](_[_0x7365('0x40')](_0x16375e[_0x7365('0x35')],_0x1a0c84['filters']));_0x479815=_['merge']({},_0x479815,_0x16375e['options']);return _0x30b838[_0x7365('0x25')+_[_0x7365('0x57')](_0x16375e[_0x7365('0x35')][_0x7365('0x53')][_0x7365('0x58')]())+_0x7365('0x5a')](_0x479815);})[_0x7365('0x24')](respondWithResult(_0x3b738b,null))[_0x7365('0x49')](handleError(_0x3b738b,null));};exports[_0x7365('0x5b')]=function(_0x3dbf7b,_0x42e5cf,_0x24de41){return db['Team'][_0x7365('0x52')]({'where':{'id':_0x3dbf7b[_0x7365('0x46')]['id']}})['then'](function(_0x1a0991){if(_0x1a0991){if(!_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')]||!utils['isValidChannel'](_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')])){throw new db[(_0x7365('0x55'))][(_0x7365('0x56'))](_0x7365('0x5c'));}return _0x1a0991[_0x7365('0x5d')+_[_0x7365('0x57')](_0x3dbf7b[_0x7365('0x4b')][_0x7365('0x53')][_0x7365('0x58')]())+_0x7365('0x5a')](_0x3dbf7b['body'][_0x7365('0x5e')]);}return null;})[_0x7365('0x24')](handleEntityNotFound(_0x42e5cf,null))['then'](respondWithStatusCode(_0x42e5cf,null))[_0x7365('0x49')](handleError(_0x42e5cf,null));};exports['removeQueues']=function(_0x58ad14,_0x1bfeb9,_0x13e483){return db['Team'][_0x7365('0x52')]({'where':{'id':_0x58ad14[_0x7365('0x46')]['id']}})[_0x7365('0x24')](function(_0x178692){if(_0x178692){if(!_0x58ad14[_0x7365('0x35')]['channel']||!utils[_0x7365('0x54')](_0x58ad14['query'][_0x7365('0x53')])){throw new db['Sequelize']['ValidationError'](_0x7365('0x5c'));}return _0x178692[_0x7365('0x5f')+_[_0x7365('0x57')](_0x58ad14['query']['channel'][_0x7365('0x58')]())+'Queues'](_0x58ad14[_0x7365('0x35')][_0x7365('0x5e')]);}return null;})[_0x7365('0x24')](handleEntityNotFound(_0x1bfeb9,null))[_0x7365('0x24')](respondWithStatusCode(_0x1bfeb9,null))['catch'](handleError(_0x1bfeb9,null));};exports[_0x7365('0x60')]=function(_0x3900db,_0x115945,_0x26b68b){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x3900db[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x115945,null))['then'](function(_0x44df7e){if(_0x44df7e){var _0x5ea2f3=[_0x7365('0x61'),_0x7365('0x62'),_0x7365('0x63'),_0x7365('0x64'),_0x7365('0x65'),_0x7365('0x66'),_0x7365('0x67')];return BPromise[_0x7365('0x68')](_0x5ea2f3,function(_0x10c114){return _0x44df7e[_0x7365('0x25')+_0x10c114+_0x7365('0x5a')]({'attributes':['id',_0x7365('0x2c')]})[_0x7365('0x24')](function(_0x47467f){return BPromise[_0x7365('0x68')](_0x47467f,function(_0x8cbae6){return _0x8cbae6[_0x7365('0x60')](_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')])['then'](function(){if(_0x10c114===_0x7365('0x61')){return db[_0x7365('0x69')]['findAll']({'where':{'id':_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')]},'attributes':['id',_0x7365('0x2c'),'online','voicePause',_0x7365('0x6a')],'raw':!![]})[_0x7365('0x24')](function(_0x10dd1e){return BPromise[_0x7365('0x68')](_['filter'](_0x10dd1e,{'online':0x1}),function(_0x423737){return db['UserVoiceQueueRt']['upsert']({'membername':_0x423737[_0x7365('0x2c')],'UserId':_0x423737['id'],'queue_name':_0x8cbae6[_0x7365('0x2c')],'VoiceQueueId':_0x8cbae6['id'],'interface':_[_0x7365('0x6b')](_0x423737[_0x7365('0x6a')])?util['format'](_0x7365('0x6c'),_0x423737[_0x7365('0x2c')]):_0x423737[_0x7365('0x6a')],'paused':_0x423737['voicePause']||![],'penalty':0x0});});});}});});})[_0x7365('0x24')](function(){return _0x44df7e;});})['then'](function(){return _0x44df7e;});}})['then'](function(_0x5acbdf){if(_0x5acbdf){return _0x5acbdf['addAgents'](_0x3900db['body'][_0x7365('0x5e')],_[_0x7365('0x6d')](_0x3900db[_0x7365('0x4b')],[_0x7365('0x5e'),'id'])||{})[_0x7365('0x6e')](function(_0x26e841){for(var _0x43ff32=0x0;_0x43ff32<_0x3900db['body'][_0x7365('0x5e')]['length'];_0x43ff32+=0x1){socket[_0x7365('0x6f')](_0x7365('0x70'),{'UserId':_0x3900db[_0x7365('0x4b')][_0x7365('0x5e')][_0x43ff32],'TeamId':_0x3900db[_0x7365('0x46')]['id']});}return _0x26e841;});}})['then'](respondWithResult(_0x115945,null))[_0x7365('0x49')](handleError(_0x115945,null));};exports['removeAgents']=function(_0x203def,_0x330a22,_0x38c71f){return db[_0x7365('0x30')][_0x7365('0x48')]({'where':{'id':_0x203def[_0x7365('0x46')]['id']}})['then'](handleEntityNotFound(_0x330a22,null))[_0x7365('0x24')](function(_0x42e119){if(_0x42e119){return BPromise[_0x7365('0x68')]([_0x7365('0x71'),'chat',_0x7365('0x72'),_0x7365('0x73'),_0x7365('0x74'),'openchannel',_0x7365('0x75')],function(_0x5b5487){return _0x42e119['get'+_[_0x7365('0x57')](_0x5b5487)+_0x7365('0x5a')]({'attributes':['id',_0x7365('0x2c')]})['then'](function(_0x4f9ff0){return BPromise[_0x7365('0x68')](_0x4f9ff0,function(_0x1bb8b8){return _0x1bb8b8[_0x7365('0x76')](_0x203def[_0x7365('0x35')][_0x7365('0x5e')])[_0x7365('0x24')](function(){if(_0x5b5487===_0x7365('0x71')){return db[_0x7365('0x77')][_0x7365('0x28')]({'where':{'VoiceQueueId':_0x1bb8b8['id'],'UserId':_0x203def[_0x7365('0x35')][_0x7365('0x5e')]}});}});});})[_0x7365('0x24')](function(){return _0x42e119;});})[_0x7365('0x24')](function(){return _0x42e119;});}})[_0x7365('0x24')](function(_0x16b479){if(_0x16b479){return _0x16b479[_0x7365('0x76')](_0x203def[_0x7365('0x35')]['ids'])[_0x7365('0x24')](function(){if(_[_0x7365('0x78')](_0x203def[_0x7365('0x35')][_0x7365('0x5e')])){for(var _0x2cbfb8=0x0;_0x2cbfb8<_0x203def[_0x7365('0x35')][_0x7365('0x5e')]['length'];_0x2cbfb8+=0x1){socket[_0x7365('0x6f')]('userTeam:remove',{'UserId':Number(_0x203def[_0x7365('0x35')][_0x7365('0x5e')][_0x2cbfb8]),'TeamId':Number(_0x203def[_0x7365('0x46')]['id'])});}}else{socket['emit'](_0x7365('0x79'),{'UserId':Number(_0x203def[_0x7365('0x35')][_0x7365('0x5e')]),'TeamId':Number(_0x203def['params']['id'])});}});}})[_0x7365('0x24')](respondWithStatusCode(_0x330a22,null))[_0x7365('0x49')](handleError(_0x330a22,null));};exports[_0x7365('0x7a')]=function(_0xc3f601,_0xa0e27e,_0x55c6fe){var _0x37fc79={};var _0x3216fe={};var _0x14cf6d;var _0x1826d2;return db[_0x7365('0x30')][_0x7365('0x52')]({'where':{'id':_0xc3f601[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0xa0e27e,null))[_0x7365('0x24')](function(_0x4aee5d){if(_0x4aee5d){_0x14cf6d=_0x4aee5d;_0x3216fe[_0x7365('0x38')]=_[_0x7365('0x36')](db[_0x7365('0x69')][_0x7365('0x31')]);_0x3216fe[_0x7365('0x35')]=_['keys'](_0xc3f601[_0x7365('0x35')]);_0x3216fe[_0x7365('0x3f')]=_[_0x7365('0x37')](_0x3216fe['model'],_0x3216fe[_0x7365('0x35')]);_0x37fc79[_0x7365('0x39')]=_[_0x7365('0x37')](_0x3216fe['model'],qs[_0x7365('0x3a')](_0xc3f601[_0x7365('0x35')][_0x7365('0x3a')]));_0x37fc79[_0x7365('0x39')]=_0x37fc79[_0x7365('0x39')][_0x7365('0x3b')]?_0x37fc79[_0x7365('0x39')]:_0x3216fe[_0x7365('0x38')];_0x37fc79['order']=qs[_0x7365('0x7b')](_0xc3f601['query'][_0x7365('0x7b')]);_0x37fc79[_0x7365('0x3e')]=qs['filters'](_['pick'](_0xc3f601[_0x7365('0x35')],_0x3216fe['filters']));if(_0xc3f601[_0x7365('0x35')]['filter']){_0x37fc79[_0x7365('0x3e')]=_[_0x7365('0x42')](_0x37fc79[_0x7365('0x3e')],{'$or':_[_0x7365('0x2f')](_0x37fc79['attributes'],function(_0x2acab0){var _0x2751e3={};_0x2751e3[_0x2acab0]={'$like':'%'+_0xc3f601[_0x7365('0x35')][_0x7365('0x41')]+'%'};return _0x2751e3;})});}_0x37fc79=_[_0x7365('0x42')]({},_0x37fc79,_0xc3f601[_0x7365('0x7c')]);return _0x14cf6d[_0x7365('0x7a')](_0x37fc79);}})[_0x7365('0x24')](function(_0x4c1979){if(_0x4c1979){_0x1826d2=_0x4c1979[_0x7365('0x3b')];if(!_0xc3f601[_0x7365('0x35')][_0x7365('0x3c')](_0x7365('0x7d'))){_0x37fc79[_0x7365('0x1e')]=qs[_0x7365('0x1e')](_0xc3f601[_0x7365('0x35')][_0x7365('0x1e')]);_0x37fc79[_0x7365('0x1d')]=qs[_0x7365('0x1d')](_0xc3f601[_0x7365('0x35')]['offset']);}return _0x14cf6d['getAgents'](_0x37fc79);}})[_0x7365('0x24')](function(_0x17b1ec){if(_0x17b1ec){return _0x17b1ec?{'count':_0x1826d2,'rows':_0x17b1ec}:null;}})[_0x7365('0x24')](respondWithResult(_0xa0e27e,null))['catch'](handleError(_0xa0e27e,null));}; \ No newline at end of file +var _0x3714=['spread','emit','userTeam:save','chat','mail','sms','fax','openchannel','voice','removeAgents','isArray','userTeam:remove','getAgents','hasOwnProperty','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit'];(function(_0x8ee714,_0x41ccdf){var _0x2e6ae9=function(_0x544d59){while(--_0x544d59){_0x8ee714['push'](_0x8ee714['shift']());}};_0x2e6ae9(++_0x41ccdf);}(_0x3714,0x95));var _0x4371=function(_0x1c2f13,_0x354d16){_0x1c2f13=_0x1c2f13-0x0;var _0x12fda4=_0x3714[_0x1c2f13];return _0x12fda4;};'use strict';var pdf=require(_0x4371('0x0'));var emlformat=require(_0x4371('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4371('0x2'));var jsonpatch=require(_0x4371('0x3'));var rp=require(_0x4371('0x4'));var moment=require('moment');var BPromise=require(_0x4371('0x5'));var Mustache=require(_0x4371('0x6'));var util=require(_0x4371('0x7'));var path=require('path');var sox=require(_0x4371('0x8'));var csv=require('to-csv');var ejs=require(_0x4371('0x9'));var fs=require('fs');var _=require(_0x4371('0xa'));var squel=require('squel');var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0xe'));var querystring=require('querystring');var Papa=require(_0x4371('0xf'));var Redis=require('ioredis');var authService=require(_0x4371('0x10'));var qs=require(_0x4371('0x11'));var as=require(_0x4371('0x12'));var hardwareService=require(_0x4371('0x13'));var logger=require('../../config/logger')(_0x4371('0x14'));var utils=require(_0x4371('0x15'));var config=require('../../config/environment');var db=require(_0x4371('0x16'))['db'];config[_0x4371('0x17')]=_[_0x4371('0x18')](config[_0x4371('0x17')],{'host':_0x4371('0x19'),'port':0x18eb});var socket=require(_0x4371('0x1a'))(new Redis(config[_0x4371('0x17')]));require(_0x4371('0x1b'))[_0x4371('0x1c')](socket);function respondWithStatusCode(_0x1d19ea,_0xf2c4e0){_0xf2c4e0=_0xf2c4e0||0xcc;return function(_0x4a1a9e){if(_0x4a1a9e){return _0x1d19ea[_0x4371('0x1d')](_0xf2c4e0);}return _0x1d19ea[_0x4371('0x1e')](_0xf2c4e0)[_0x4371('0x1f')]();};}function respondWithResult(_0x482082,_0x1adca6){_0x1adca6=_0x1adca6||0xc8;return function(_0xe404d9){if(_0xe404d9){return _0x482082[_0x4371('0x1e')](_0x1adca6)[_0x4371('0x20')](_0xe404d9);}};}function respondWithFilteredResult(_0xa5b63f,_0x41a55f){return function(_0x2c152d){if(_0x2c152d){var _0x12dc62=_0x2c152d[_0x4371('0x21')],_0x305242=_0x41a55f[_0x4371('0x22')],_0x278bb3=_0x41a55f['offset']+_0x41a55f[_0x4371('0x23')],_0x28680a;if(_0x278bb3>=_0x12dc62){_0x278bb3=_0x12dc62;_0x28680a=0xc8;}else{_0x28680a=0xce;}_0xa5b63f[_0x4371('0x1e')](_0x28680a);return _0xa5b63f[_0x4371('0x24')](_0x4371('0x25'),_0x305242+'-'+_0x278bb3+'/'+_0x12dc62)[_0x4371('0x20')](_0x2c152d);}return null;};}function patchUpdates(_0x4c40fe){return function(_0x592700){try{jsonpatch['apply'](_0x592700,_0x4c40fe,!![]);}catch(_0x2f62cf){return BPromise['reject'](_0x2f62cf);}return _0x592700[_0x4371('0x26')]();};}function saveUpdates(_0x17dde7,_0x3b89a8){return function(_0x2ddff4){if(_0x2ddff4){return _0x2ddff4[_0x4371('0x27')](_0x17dde7)[_0x4371('0x28')](function(_0x1b245d){return _0x1b245d;});}return null;};}function removeEntity(_0x345d87,_0x3eaddc){return function(_0xf4e370){if(_0xf4e370){return _0xf4e370[_0x4371('0x29')]()[_0x4371('0x28')](function(){var _0x1ed114=_0xf4e370[_0x4371('0x2a')]({'plain':!![]});var _0x124e2e='Teams';return db[_0x4371('0x2b')]['destroy']({'where':{'type':_0x124e2e,'resourceId':_0x1ed114['id']}})[_0x4371('0x28')](function(){return _0xf4e370;});})[_0x4371('0x28')](function(){_0x345d87[_0x4371('0x1e')](0xcc)[_0x4371('0x1f')]();});}};}function handleEntityNotFound(_0x303fb6,_0x342133){return function(_0x479e2c){if(!_0x479e2c){_0x303fb6['sendStatus'](0x194);}return _0x479e2c;};}function handleError(_0x137d76,_0x2414ba){_0x2414ba=_0x2414ba||0x1f4;return function(_0x4b946d){logger[_0x4371('0x2c')](_0x4b946d[_0x4371('0x2d')]);if(_0x4b946d[_0x4371('0x2e')]){delete _0x4b946d[_0x4371('0x2e')];}_0x137d76[_0x4371('0x1e')](_0x2414ba)[_0x4371('0x2f')](_0x4b946d);};}exports[_0x4371('0x30')]=function(_0x3d6d59,_0x33700b){var _0x1e2563={},_0x41d6b7={},_0x85e9c7={'count':0x0,'rows':[]};var _0x537339=_[_0x4371('0x31')](db[_0x4371('0x32')][_0x4371('0x33')],function(_0x5bd57f){return{'name':_0x5bd57f['fieldName'],'type':_0x5bd57f[_0x4371('0x34')]['key']};});_0x41d6b7[_0x4371('0x35')]=_[_0x4371('0x31')](_0x537339,_0x4371('0x2e'));_0x41d6b7[_0x4371('0x36')]=_[_0x4371('0x37')](_0x3d6d59[_0x4371('0x36')]);_0x41d6b7[_0x4371('0x38')]=_[_0x4371('0x39')](_0x41d6b7['model'],_0x41d6b7[_0x4371('0x36')]);_0x1e2563[_0x4371('0x3a')]=_[_0x4371('0x39')](_0x41d6b7[_0x4371('0x35')],qs['fields'](_0x3d6d59[_0x4371('0x36')]['fields']));_0x1e2563[_0x4371('0x3a')]=_0x1e2563[_0x4371('0x3a')][_0x4371('0x3b')]?_0x1e2563['attributes']:_0x41d6b7[_0x4371('0x35')];if(!_0x3d6d59['query']['hasOwnProperty']('nolimit')){_0x1e2563[_0x4371('0x23')]=qs[_0x4371('0x23')](_0x3d6d59['query'][_0x4371('0x23')]);_0x1e2563[_0x4371('0x22')]=qs['offset'](_0x3d6d59[_0x4371('0x36')]['offset']);}_0x1e2563[_0x4371('0x3c')]=qs[_0x4371('0x3d')](_0x3d6d59['query'][_0x4371('0x3d')]);_0x1e2563[_0x4371('0x3e')]=qs[_0x4371('0x38')](_[_0x4371('0x3f')](_0x3d6d59[_0x4371('0x36')],_0x41d6b7[_0x4371('0x38')]),_0x537339);if(_0x3d6d59['query'][_0x4371('0x40')]){_0x1e2563[_0x4371('0x3e')]=_[_0x4371('0x41')](_0x1e2563[_0x4371('0x3e')],{'$or':_[_0x4371('0x31')](_0x537339,function(_0x171aac){if(_0x171aac['type']!==_0x4371('0x42')){var _0x805313={};_0x805313[_0x171aac[_0x4371('0x2e')]]={'$like':'%'+_0x3d6d59[_0x4371('0x36')][_0x4371('0x40')]+'%'};return _0x805313;}})});}_0x1e2563=_[_0x4371('0x41')]({},_0x1e2563,_0x3d6d59[_0x4371('0x43')]);var _0x9015aa={'where':_0x1e2563[_0x4371('0x3e')]};return db[_0x4371('0x32')][_0x4371('0x21')](_0x9015aa)[_0x4371('0x28')](function(_0x59d157){_0x85e9c7[_0x4371('0x21')]=_0x59d157;if(_0x3d6d59[_0x4371('0x36')][_0x4371('0x44')]){_0x1e2563[_0x4371('0x45')]=[{'all':!![]}];}return db['Team'][_0x4371('0x46')](_0x1e2563);})[_0x4371('0x28')](function(_0x629b81){_0x85e9c7[_0x4371('0x47')]=_0x629b81;return _0x85e9c7;})[_0x4371('0x28')](respondWithFilteredResult(_0x33700b,_0x1e2563))[_0x4371('0x48')](handleError(_0x33700b,null));};exports[_0x4371('0x49')]=function(_0x5e22f3,_0x33c45d){var _0xa0399e={'raw':![],'where':{'id':_0x5e22f3[_0x4371('0x4a')]['id']}},_0x177fbb={};_0x177fbb[_0x4371('0x35')]=_['keys'](db[_0x4371('0x32')][_0x4371('0x33')]);_0x177fbb[_0x4371('0x36')]=_[_0x4371('0x37')](_0x5e22f3[_0x4371('0x36')]);_0x177fbb[_0x4371('0x38')]=_['intersection'](_0x177fbb[_0x4371('0x35')],_0x177fbb[_0x4371('0x36')]);_0xa0399e['attributes']=_[_0x4371('0x39')](_0x177fbb[_0x4371('0x35')],qs[_0x4371('0x4b')](_0x5e22f3[_0x4371('0x36')][_0x4371('0x4b')]));_0xa0399e['attributes']=_0xa0399e[_0x4371('0x3a')][_0x4371('0x3b')]?_0xa0399e[_0x4371('0x3a')]:_0x177fbb[_0x4371('0x35')];if(_0x5e22f3[_0x4371('0x36')]['includeAll']){_0xa0399e[_0x4371('0x45')]=[{'all':!![]}];}_0xa0399e=_[_0x4371('0x41')]({},_0xa0399e,_0x5e22f3['options']);return db[_0x4371('0x32')][_0x4371('0x4c')](_0xa0399e)['then'](handleEntityNotFound(_0x33c45d,null))[_0x4371('0x28')](respondWithResult(_0x33c45d,null))[_0x4371('0x48')](handleError(_0x33c45d,null));};exports[_0x4371('0x4d')]=function(_0x10f8eb,_0x3a3819){return db[_0x4371('0x32')][_0x4371('0x4d')](_0x10f8eb[_0x4371('0x4e')],{})['then'](function(_0x13d8d9){var _0x500903=_0x10f8eb[_0x4371('0x4f')]['get']({'plain':!![]});if(!_0x500903)throw new Error(_0x4371('0x50'));if(_0x500903[_0x4371('0x51')]==='user'){var _0x17564e=_0x13d8d9[_0x4371('0x2a')]({'plain':!![]});var _0x1a7d2a=_0x4371('0x52');return db[_0x4371('0x53')][_0x4371('0x4c')]({'where':{'name':_0x1a7d2a,'userProfileId':_0x500903['userProfileId']},'raw':!![]})[_0x4371('0x28')](function(_0x5371a0){if(_0x5371a0&&_0x5371a0[_0x4371('0x54')]===0x0){return db[_0x4371('0x2b')][_0x4371('0x4d')]({'name':_0x17564e['name'],'resourceId':_0x17564e['id'],'type':_0x5371a0['name'],'sectionId':_0x5371a0['id']},{})[_0x4371('0x28')](function(){return _0x13d8d9;});}else{return _0x13d8d9;}})[_0x4371('0x48')](function(_0x575cc5){logger[_0x4371('0x2c')](_0x4371('0x55'),_0x575cc5);throw _0x575cc5;});}return _0x13d8d9;})[_0x4371('0x28')](respondWithResult(_0x3a3819,0xc9))[_0x4371('0x48')](handleError(_0x3a3819,null));};exports['update']=function(_0x193409,_0xc2cb25){if(_0x193409[_0x4371('0x4e')]['id']){delete _0x193409[_0x4371('0x4e')]['id'];}return db[_0x4371('0x32')][_0x4371('0x4c')]({'where':{'id':_0x193409['params']['id']}})['then'](handleEntityNotFound(_0xc2cb25,null))[_0x4371('0x28')](saveUpdates(_0x193409['body'],null))['then'](respondWithResult(_0xc2cb25,null))[_0x4371('0x48')](handleError(_0xc2cb25,null));};exports[_0x4371('0x29')]=function(_0x454b17,_0x4f2c5a){return db[_0x4371('0x32')]['find']({'where':{'id':_0x454b17[_0x4371('0x4a')]['id']}})[_0x4371('0x28')](handleEntityNotFound(_0x4f2c5a,null))[_0x4371('0x28')](removeEntity(_0x4f2c5a,null))[_0x4371('0x48')](handleError(_0x4f2c5a,null));};exports[_0x4371('0x56')]=function(_0x5ee10c,_0x5a810d,_0x483751){return db[_0x4371('0x32')][_0x4371('0x57')]({'where':{'id':_0x5ee10c[_0x4371('0x4a')]['id']}})[_0x4371('0x28')](handleEntityNotFound(_0x5a810d,null))[_0x4371('0x28')](function(_0x4e15b3){if(!_0x5ee10c['query'][_0x4371('0x58')]||!utils[_0x4371('0x59')](_0x5ee10c[_0x4371('0x36')][_0x4371('0x58')])){throw new db['Sequelize'][(_0x4371('0x5a'))](_0x4371('0x5b'));}var _0x5abae9={};var _0x249b61={};_0x249b61['model']=_['keys'](db[_[_0x4371('0x5c')](_0x5ee10c[_0x4371('0x36')]['channel'][_0x4371('0x5d')]())+_0x4371('0x5e')]['rawAttributes']);_0x249b61['query']=_['keys'](_0x5ee10c[_0x4371('0x36')]);_0x249b61[_0x4371('0x38')]=_[_0x4371('0x39')](_0x249b61[_0x4371('0x35')],_0x249b61[_0x4371('0x36')]);_0x5abae9[_0x4371('0x3a')]=_[_0x4371('0x39')](_0x249b61[_0x4371('0x35')],qs[_0x4371('0x4b')](_0x5ee10c[_0x4371('0x36')][_0x4371('0x4b')]));_0x5abae9['attributes']=_0x5abae9[_0x4371('0x3a')][_0x4371('0x3b')]?_0x5abae9[_0x4371('0x3a')]:_0x249b61[_0x4371('0x35')];_0x5abae9[_0x4371('0x23')]=qs[_0x4371('0x23')](_0x5ee10c[_0x4371('0x36')]['limit']);_0x5abae9[_0x4371('0x22')]=qs[_0x4371('0x22')](_0x5ee10c[_0x4371('0x36')]['offset']);_0x5abae9[_0x4371('0x3c')]=qs['sort'](_0x5ee10c[_0x4371('0x36')]['sort']);_0x5abae9['where']=qs[_0x4371('0x38')](_[_0x4371('0x3f')](_0x5ee10c[_0x4371('0x36')],_0x249b61[_0x4371('0x38')]));_0x5abae9=_[_0x4371('0x41')]({},_0x5abae9,_0x5ee10c[_0x4371('0x43')]);return _0x4e15b3['get'+_['capitalize'](_0x5ee10c[_0x4371('0x36')][_0x4371('0x58')]['toLowerCase']())+_0x4371('0x5f')](_0x5abae9);})[_0x4371('0x28')](respondWithResult(_0x5a810d,null))[_0x4371('0x48')](handleError(_0x5a810d,null));};exports[_0x4371('0x60')]=function(_0x5a9e91,_0x5ecef2,_0x2b2cfc){return db[_0x4371('0x32')]['findOne']({'where':{'id':_0x5a9e91['params']['id']}})[_0x4371('0x28')](function(_0x165e87){if(_0x165e87){if(!_0x5a9e91['body']['channel']||!utils[_0x4371('0x59')](_0x5a9e91[_0x4371('0x4e')][_0x4371('0x58')])){throw new db['Sequelize']['ValidationError'](_0x4371('0x5b'));}return _0x165e87[_0x4371('0x61')+_[_0x4371('0x5c')](_0x5a9e91[_0x4371('0x4e')][_0x4371('0x58')]['toLowerCase']())+_0x4371('0x5f')](_0x5a9e91[_0x4371('0x4e')][_0x4371('0x62')]);}return null;})[_0x4371('0x28')](handleEntityNotFound(_0x5ecef2,null))['then'](respondWithStatusCode(_0x5ecef2,null))[_0x4371('0x48')](handleError(_0x5ecef2,null));};exports[_0x4371('0x63')]=function(_0x5ac81e,_0x186188,_0xf6c45b){return db[_0x4371('0x32')][_0x4371('0x57')]({'where':{'id':_0x5ac81e[_0x4371('0x4a')]['id']}})['then'](function(_0x18671f){if(_0x18671f){if(!_0x5ac81e['query']['channel']||!utils[_0x4371('0x59')](_0x5ac81e[_0x4371('0x36')][_0x4371('0x58')])){throw new db['Sequelize'][(_0x4371('0x5a'))]('Unknown\x20channel');}return _0x18671f[_0x4371('0x64')+_['capitalize'](_0x5ac81e['query'][_0x4371('0x58')][_0x4371('0x5d')]())+'Queues'](_0x5ac81e[_0x4371('0x36')][_0x4371('0x62')]);}return null;})[_0x4371('0x28')](handleEntityNotFound(_0x186188,null))[_0x4371('0x28')](respondWithStatusCode(_0x186188,null))[_0x4371('0x48')](handleError(_0x186188,null));};exports[_0x4371('0x65')]=function(_0x2209a6,_0x346236,_0x46f444){return db['Team'][_0x4371('0x4c')]({'where':{'id':_0x2209a6[_0x4371('0x4a')]['id']}})[_0x4371('0x28')](handleEntityNotFound(_0x346236,null))[_0x4371('0x28')](function(_0x101010){if(_0x101010){var _0x49fc1b=[_0x4371('0x66'),_0x4371('0x67'),_0x4371('0x68'),_0x4371('0x69'),_0x4371('0x6a'),_0x4371('0x6b'),_0x4371('0x6c')];return BPromise[_0x4371('0x6d')](_0x49fc1b,function(_0x1fa214){return _0x101010[_0x4371('0x2a')+_0x1fa214+_0x4371('0x5f')]({'attributes':['id',_0x4371('0x2e')]})['then'](function(_0x548337){return BPromise[_0x4371('0x6d')](_0x548337,function(_0x3c3fcf){return _0x3c3fcf[_0x4371('0x65')](_0x2209a6['body'][_0x4371('0x62')])[_0x4371('0x28')](function(){if(_0x1fa214===_0x4371('0x66')){return db[_0x4371('0x6e')][_0x4371('0x46')]({'where':{'id':_0x2209a6[_0x4371('0x4e')][_0x4371('0x62')]},'attributes':['id',_0x4371('0x2e'),'online',_0x4371('0x6f'),_0x4371('0x70')],'raw':!![]})[_0x4371('0x28')](function(_0x336ef4){return BPromise[_0x4371('0x6d')](_[_0x4371('0x40')](_0x336ef4,{'online':0x1}),function(_0x1f5a24){return db[_0x4371('0x71')][_0x4371('0x72')]({'membername':_0x1f5a24[_0x4371('0x2e')],'UserId':_0x1f5a24['id'],'queue_name':_0x3c3fcf['name'],'VoiceQueueId':_0x3c3fcf['id'],'interface':_[_0x4371('0x73')](_0x1f5a24[_0x4371('0x70')])?util[_0x4371('0x74')](_0x4371('0x75'),_0x1f5a24[_0x4371('0x2e')]):_0x1f5a24[_0x4371('0x70')],'paused':_0x1f5a24[_0x4371('0x6f')]||![],'penalty':0x0});});});}});});})[_0x4371('0x28')](function(){return _0x101010;});})[_0x4371('0x28')](function(){return _0x101010;});}})[_0x4371('0x28')](function(_0x4608cd){if(_0x4608cd){return _0x4608cd[_0x4371('0x65')](_0x2209a6['body'][_0x4371('0x62')],_[_0x4371('0x76')](_0x2209a6[_0x4371('0x4e')],['ids','id'])||{})[_0x4371('0x77')](function(_0x251b04){for(var _0x2b7c9d=0x0;_0x2b7c9d<_0x2209a6[_0x4371('0x4e')][_0x4371('0x62')]['length'];_0x2b7c9d+=0x1){socket[_0x4371('0x78')](_0x4371('0x79'),{'UserId':_0x2209a6[_0x4371('0x4e')]['ids'][_0x2b7c9d],'TeamId':_0x2209a6[_0x4371('0x4a')]['id']});}return _0x251b04;});}})[_0x4371('0x28')](respondWithResult(_0x346236,null))[_0x4371('0x48')](handleError(_0x346236,null));};exports['removeAgents']=function(_0x2b2ebf,_0x19f0e5,_0x3fbaaa){return db[_0x4371('0x32')][_0x4371('0x4c')]({'where':{'id':_0x2b2ebf[_0x4371('0x4a')]['id']}})[_0x4371('0x28')](handleEntityNotFound(_0x19f0e5,null))[_0x4371('0x28')](function(_0x35ef04){if(_0x35ef04){return BPromise[_0x4371('0x6d')](['voice',_0x4371('0x7a'),_0x4371('0x7b'),_0x4371('0x7c'),_0x4371('0x7d'),_0x4371('0x7e'),'whatsapp'],function(_0x159643){return _0x35ef04['get'+_['capitalize'](_0x159643)+_0x4371('0x5f')]({'attributes':['id',_0x4371('0x2e')]})[_0x4371('0x28')](function(_0x2710d4){return BPromise[_0x4371('0x6d')](_0x2710d4,function(_0x1b2005){return _0x1b2005['removeAgents'](_0x2b2ebf['query'][_0x4371('0x62')])[_0x4371('0x28')](function(){if(_0x159643===_0x4371('0x7f')){return db['UserVoiceQueueRt'][_0x4371('0x29')]({'where':{'VoiceQueueId':_0x1b2005['id'],'UserId':_0x2b2ebf['query'][_0x4371('0x62')]}});}});});})[_0x4371('0x28')](function(){return _0x35ef04;});})[_0x4371('0x28')](function(){return _0x35ef04;});}})['then'](function(_0x2f2bc2){if(_0x2f2bc2){return _0x2f2bc2[_0x4371('0x80')](_0x2b2ebf['query'][_0x4371('0x62')])['then'](function(){if(_[_0x4371('0x81')](_0x2b2ebf[_0x4371('0x36')][_0x4371('0x62')])){for(var _0x1666b9=0x0;_0x1666b9<_0x2b2ebf['query'][_0x4371('0x62')][_0x4371('0x3b')];_0x1666b9+=0x1){socket[_0x4371('0x78')](_0x4371('0x82'),{'UserId':Number(_0x2b2ebf[_0x4371('0x36')]['ids'][_0x1666b9]),'TeamId':Number(_0x2b2ebf[_0x4371('0x4a')]['id'])});}}else{socket[_0x4371('0x78')]('userTeam:remove',{'UserId':Number(_0x2b2ebf['query']['ids']),'TeamId':Number(_0x2b2ebf[_0x4371('0x4a')]['id'])});}});}})[_0x4371('0x28')](respondWithStatusCode(_0x19f0e5,null))[_0x4371('0x48')](handleError(_0x19f0e5,null));};exports[_0x4371('0x83')]=function(_0x3f6f08,_0xc10698,_0x38f75d){var _0x47bd25={};var _0x1c0e0a={};var _0x272859;var _0x294971;return db[_0x4371('0x32')]['findOne']({'where':{'id':_0x3f6f08['params']['id']}})['then'](handleEntityNotFound(_0xc10698,null))['then'](function(_0x1ea4fe){if(_0x1ea4fe){_0x272859=_0x1ea4fe;_0x1c0e0a[_0x4371('0x35')]=_[_0x4371('0x37')](db[_0x4371('0x6e')][_0x4371('0x33')]);_0x1c0e0a[_0x4371('0x36')]=_[_0x4371('0x37')](_0x3f6f08[_0x4371('0x36')]);_0x1c0e0a['filters']=_['intersection'](_0x1c0e0a[_0x4371('0x35')],_0x1c0e0a[_0x4371('0x36')]);_0x47bd25['attributes']=_[_0x4371('0x39')](_0x1c0e0a[_0x4371('0x35')],qs[_0x4371('0x4b')](_0x3f6f08[_0x4371('0x36')][_0x4371('0x4b')]));_0x47bd25[_0x4371('0x3a')]=_0x47bd25[_0x4371('0x3a')][_0x4371('0x3b')]?_0x47bd25[_0x4371('0x3a')]:_0x1c0e0a['model'];_0x47bd25[_0x4371('0x3c')]=qs['sort'](_0x3f6f08[_0x4371('0x36')][_0x4371('0x3d')]);_0x47bd25[_0x4371('0x3e')]=qs[_0x4371('0x38')](_['pick'](_0x3f6f08[_0x4371('0x36')],_0x1c0e0a[_0x4371('0x38')]));if(_0x3f6f08['query'][_0x4371('0x40')]){_0x47bd25[_0x4371('0x3e')]=_[_0x4371('0x41')](_0x47bd25[_0x4371('0x3e')],{'$or':_[_0x4371('0x31')](_0x47bd25[_0x4371('0x3a')],function(_0x5a8373){var _0x17e2ba={};_0x17e2ba[_0x5a8373]={'$like':'%'+_0x3f6f08[_0x4371('0x36')][_0x4371('0x40')]+'%'};return _0x17e2ba;})});}_0x47bd25=_['merge']({},_0x47bd25,_0x3f6f08['options']);return _0x272859['getAgents'](_0x47bd25);}})['then'](function(_0x50aaa3){if(_0x50aaa3){_0x294971=_0x50aaa3[_0x4371('0x3b')];if(!_0x3f6f08[_0x4371('0x36')][_0x4371('0x84')](_0x4371('0x85'))){_0x47bd25[_0x4371('0x23')]=qs['limit'](_0x3f6f08[_0x4371('0x36')][_0x4371('0x23')]);_0x47bd25[_0x4371('0x22')]=qs[_0x4371('0x22')](_0x3f6f08[_0x4371('0x36')][_0x4371('0x22')]);}return _0x272859[_0x4371('0x83')](_0x47bd25);}})['then'](function(_0x225e30){if(_0x225e30){return _0x225e30?{'count':_0x294971,'rows':_0x225e30}:null;}})[_0x4371('0x28')](respondWithResult(_0xc10698,null))[_0x4371('0x48')](handleError(_0xc10698,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a5b4a71..7feb658 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 _0x58cf=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xb7524c,_0x38cced){var _0x4ce284=function(_0x47ff67){while(--_0x47ff67){_0xb7524c['push'](_0xb7524c['shift']());}};_0x4ce284(++_0x38cced);}(_0x58cf,0x196));var _0xf58c=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x58cf[_0x4defd6];return _0x4c9276;};'use strict';var EventEmitter=require(_0xf58c('0x0'));var Team=require(_0xf58c('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf58c('0x2')](0x0);var events={'afterCreate':_0xf58c('0x3'),'afterUpdate':_0xf58c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e5b0f){return function(_0x59845d,_0x47f7b6,_0x453fab){TeamEvents[_0xf58c('0x5')](_0x2e5b0f+':'+_0x59845d['id'],_0x59845d);TeamEvents[_0xf58c('0x5')](_0x2e5b0f,_0x59845d);_0x453fab(null);};}for(var e in events){if(events[_0xf58c('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xf58c('0x7')]=TeamEvents; \ No newline at end of file +var _0x800c=['update','remove','emit','hook','exports','events','setMaxListeners','save'];(function(_0x947101,_0x596d0d){var _0x55516c=function(_0xc2effd){while(--_0xc2effd){_0x947101['push'](_0x947101['shift']());}};_0x55516c(++_0x596d0d);}(_0x800c,0x185));var _0xc800=function(_0x352f65,_0x1a1b1a){_0x352f65=_0x352f65-0x0;var _0x2fb7f9=_0x800c[_0x352f65];return _0x2fb7f9;};'use strict';var EventEmitter=require(_0xc800('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc800('0x1')](0x0);var events={'afterCreate':_0xc800('0x2'),'afterUpdate':_0xc800('0x3'),'afterDestroy':_0xc800('0x4')};function emitEvent(_0xb59c7b){return function(_0xc6e1f1,_0x4f8ee9,_0x50854a){TeamEvents[_0xc800('0x5')](_0xb59c7b+':'+_0xc6e1f1['id'],_0xc6e1f1);TeamEvents[_0xc800('0x5')](_0xb59c7b,_0xc6e1f1);_0x50854a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xc800('0x6')](e,emitEvent(event));}}module[_0xc800('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index f19b72e..349cbf2 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 _0x79ca=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams'];(function(_0x41849c,_0x6db388){var _0x43589c=function(_0x24ed08){while(--_0x24ed08){_0x41849c['push'](_0x41849c['shift']());}};_0x43589c(++_0x6db388);}(_0x79ca,0x114));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa79c('0x0'));var util=require(_0xa79c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa79c('0x2'));var BPromise=require(_0xa79c('0x3'));var rp=require(_0xa79c('0x4'));var fs=require('fs');var path=require(_0xa79c('0x5'));var rimraf=require(_0xa79c('0x6'));var config=require(_0xa79c('0x7'));var attributes=require('./team.attributes');module[_0xa79c('0x8')]=function(_0x3e2daa,_0x4c6cae){return _0x3e2daa[_0xa79c('0x9')](_0xa79c('0xa'),attributes,{'tableName':_0xa79c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde87=['Team','teams','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define'];(function(_0x1f6135,_0x406c38){var _0x56502a=function(_0xd0f6f0){while(--_0xd0f6f0){_0x1f6135['push'](_0x1f6135['shift']());}};_0x56502a(++_0x406c38);}(_0xde87,0xf4));var _0x7de8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xde87[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7de8('0x0'));var util=require(_0x7de8('0x1'));var logger=require(_0x7de8('0x2'))(_0x7de8('0x3'));var moment=require('moment');var BPromise=require(_0x7de8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7de8('0x5'));var rimraf=require(_0x7de8('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x7de8('0x7')]=function(_0x44fc92,_0x494978){return _0x44fc92[_0x7de8('0x8')](_0x7de8('0x9'),attributes,{'tableName':_0x7de8('0xa'),'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 5d35705..a268cf6 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 _0x074d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis'];(function(_0x47858c,_0x1c1880){var _0x2af9e=function(_0x430e38){while(--_0x430e38){_0x47858c['push'](_0x47858c['shift']());}};_0x2af9e(++_0x1c1880);}(_0x074d,0x1f3));var _0xd074=function(_0x8dc10f,_0x5627c0){_0x8dc10f=_0x8dc10f-0x0;var _0x57db45=_0x074d[_0x8dc10f];return _0x57db45;};'use strict';var _=require(_0xd074('0x0'));var util=require(_0xd074('0x1'));var moment=require(_0xd074('0x2'));var BPromise=require('bluebird');var rs=require(_0xd074('0x3'));var fs=require('fs');var Redis=require(_0xd074('0x4'));var db=require(_0xd074('0x5'))['db'];var utils=require(_0xd074('0x6'));var logger=require(_0xd074('0x7'))(_0xd074('0x8'));var config=require(_0xd074('0x9'));var jayson=require(_0xd074('0xa'));var client=jayson[_0xd074('0xb')][_0xd074('0xc')]({'port':0x232a});config[_0xd074('0xd')]=_[_0xd074('0xe')](config[_0xd074('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd074('0xf'))(new Redis(config[_0xd074('0xd')]));require(_0xd074('0x10'))[_0xd074('0x11')](socket);function respondWithRpcPromise(_0x504166,_0x365faf,_0x5f2888){return new BPromise(function(_0x3b9972,_0x262cef){return client[_0xd074('0x12')](_0x504166,_0x5f2888)[_0xd074('0x13')](function(_0x52c977){logger['info'](_0xd074('0x14'),_0x365faf,_0xd074('0x15'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x365faf,'request\x20sent',JSON[_0xd074('0x16')](_0x52c977));if(_0x52c977[_0xd074('0x17')]){if(_0x52c977[_0xd074('0x17')][_0xd074('0x18')]===0x1f4){logger[_0xd074('0x17')](_0xd074('0x14'),_0x365faf,_0x52c977['error'][_0xd074('0x19')]);return _0x262cef(_0x52c977[_0xd074('0x17')]['message']);}logger[_0xd074('0x17')]('Team,\x20%s,\x20%s',_0x365faf,_0x52c977[_0xd074('0x17')][_0xd074('0x19')]);return _0x3b9972(_0x52c977[_0xd074('0x17')][_0xd074('0x19')]);}else{logger[_0xd074('0x1a')](_0xd074('0x14'),_0x365faf,_0xd074('0x15'));_0x3b9972(_0x52c977[_0xd074('0x1b')]['message']);}})['catch'](function(_0x47d20){logger[_0xd074('0x17')](_0xd074('0x14'),_0x365faf,_0x47d20);_0x262cef(_0x47d20);});});} \ No newline at end of file +var _0x379c=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2af49e,_0x545a08){var _0x4550a9=function(_0x48e517){while(--_0x48e517){_0x2af49e['push'](_0x2af49e['shift']());}};_0x4550a9(++_0x545a08);}(_0x379c,0xac));var _0xc379=function(_0xc35cb0,_0x57aed4){_0xc35cb0=_0xc35cb0-0x0;var _0x1dddb4=_0x379c[_0xc35cb0];return _0x1dddb4;};'use strict';var _=require(_0xc379('0x0'));var util=require(_0xc379('0x1'));var moment=require(_0xc379('0x2'));var BPromise=require(_0xc379('0x3'));var rs=require(_0xc379('0x4'));var fs=require('fs');var Redis=require(_0xc379('0x5'));var db=require(_0xc379('0x6'))['db'];var utils=require(_0xc379('0x7'));var logger=require(_0xc379('0x8'))(_0xc379('0x9'));var config=require(_0xc379('0xa'));var jayson=require(_0xc379('0xb'));var client=jayson['client'][_0xc379('0xc')]({'port':0x232a});config[_0xc379('0xd')]=_['defaults'](config[_0xc379('0xd')],{'host':_0xc379('0xe'),'port':0x18eb});var socket=require(_0xc379('0xf'))(new Redis(config['redis']));require(_0xc379('0x10'))[_0xc379('0x11')](socket);function respondWithRpcPromise(_0x1b7e4f,_0x509e61,_0x3da284){return new BPromise(function(_0x320baa,_0x2d08c7){return client[_0xc379('0x12')](_0x1b7e4f,_0x3da284)[_0xc379('0x13')](function(_0x4ed34d){logger['info'](_0xc379('0x14'),_0x509e61,_0xc379('0x15'));logger[_0xc379('0x16')](_0xc379('0x17'),_0x509e61,'request\x20sent',JSON[_0xc379('0x18')](_0x4ed34d));if(_0x4ed34d['error']){if(_0x4ed34d[_0xc379('0x19')][_0xc379('0x1a')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x509e61,_0x4ed34d[_0xc379('0x19')][_0xc379('0x1b')]);return _0x2d08c7(_0x4ed34d[_0xc379('0x19')][_0xc379('0x1b')]);}logger['error'](_0xc379('0x14'),_0x509e61,_0x4ed34d['error'][_0xc379('0x1b')]);return _0x320baa(_0x4ed34d[_0xc379('0x19')][_0xc379('0x1b')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x509e61,_0xc379('0x15'));_0x320baa(_0x4ed34d[_0xc379('0x1c')][_0xc379('0x1b')]);}})[_0xc379('0x1d')](function(_0x5e3b01){logger[_0xc379('0x19')](_0xc379('0x14'),_0x509e61,_0x5e3b01);_0x2d08c7(_0x5e3b01);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ed4af28..a5119f0 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 _0x1488=['./team.events','remove','update','emit','removeListener','register','length','team:'];(function(_0xa3c800,_0x48a4fd){var _0x2286ba=function(_0x4a52f7){while(--_0x4a52f7){_0xa3c800['push'](_0xa3c800['shift']());}};_0x2286ba(++_0x48a4fd);}(_0x1488,0x88));var _0x8148=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x1488[_0x10df18];return _0x1f9a1d;};'use strict';var TeamEvents=require(_0x8148('0x0'));var events=['save',_0x8148('0x1'),_0x8148('0x2')];function createListener(_0x22606a,_0x5cc7ef){return function(_0x508e80){_0x5cc7ef[_0x8148('0x3')](_0x22606a,_0x508e80);};}function removeListener(_0x5b1a48,_0x32d78){return function(){TeamEvents[_0x8148('0x4')](_0x5b1a48,_0x32d78);};}exports[_0x8148('0x5')]=function(_0x153009){for(var _0x173d87=0x0,_0x2ac35d=events[_0x8148('0x6')];_0x173d87<_0x2ac35d;_0x173d87++){var _0x1254e9=events[_0x173d87];var _0x4fb6b4=createListener(_0x8148('0x7')+_0x1254e9,_0x153009);TeamEvents['on'](_0x1254e9,_0x4fb6b4);}}; \ No newline at end of file +var _0x9300=['update','emit','removeListener','length','./team.events'];(function(_0x10c0f7,_0x32fcf0){var _0x4e15ad=function(_0x45b687){while(--_0x45b687){_0x10c0f7['push'](_0x10c0f7['shift']());}};_0x4e15ad(++_0x32fcf0);}(_0x9300,0x153));var _0x0930=function(_0x279fc8,_0x1ba427){_0x279fc8=_0x279fc8-0x0;var _0x4521a5=_0x9300[_0x279fc8];return _0x4521a5;};'use strict';var TeamEvents=require(_0x0930('0x0'));var events=['save','remove',_0x0930('0x1')];function createListener(_0x2034e2,_0x70a4ea){return function(_0x44657f){_0x70a4ea[_0x0930('0x2')](_0x2034e2,_0x44657f);};}function removeListener(_0x49d993,_0x298c01){return function(){TeamEvents[_0x0930('0x3')](_0x49d993,_0x298c01);};}exports['register']=function(_0x34c542){for(var _0x1c8175=0x0,_0x45705a=events[_0x0930('0x4')];_0x1c8175<_0x45705a;_0x1c8175++){var _0x2c0f94=events[_0x1c8175];var _0x1ec24f=createListener('team:'+_0x2c0f94,_0x34c542);TeamEvents['on'](_0x2c0f94,_0x1ec24f);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fe1ab91..c72a958 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 _0x6383=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','/:id','post','isAuthenticated','create','update','delete'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6383,0x189));var _0x3638=function(_0x39f3a9,_0x4c0b34){_0x39f3a9=_0x39f3a9-0x0;var _0x36ac2b=_0x6383[_0x39f3a9];return _0x36ac2b;};'use strict';var multer=require(_0x3638('0x0'));var util=require(_0x3638('0x1'));var path=require(_0x3638('0x2'));var timeout=require(_0x3638('0x3'));var express=require(_0x3638('0x4'));var router=express[_0x3638('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3638('0x6'));var config=require(_0x3638('0x7'));var controller=require(_0x3638('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3638('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x3638('0xa')]('/',auth[_0x3638('0xb')](),controller[_0x3638('0xc')]);router['put'](_0x3638('0x9'),auth[_0x3638('0xb')](),controller[_0x3638('0xd')]);router[_0x3638('0xe')](_0x3638('0x9'),auth['isAuthenticated'](),controller[_0x3638('0xf')]);module[_0x3638('0x10')]=router; \ No newline at end of file +var _0x08cf=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','/:id','post','isAuthenticated','create','put','update','delete'];(function(_0x33bb6f,_0x8516dd){var _0x29f99a=function(_0x1412f6){while(--_0x1412f6){_0x33bb6f['push'](_0x33bb6f['shift']());}};_0x29f99a(++_0x8516dd);}(_0x08cf,0x1d1));var _0xf08c=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x08cf[_0x57fa7e];return _0x320671;};'use strict';var multer=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var path=require(_0xf08c('0x2'));var timeout=require(_0xf08c('0x3'));var express=require(_0xf08c('0x4'));var router=express[_0xf08c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf08c('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf08c('0x7')](_0xf08c('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xf08c('0x9')]('/',auth[_0xf08c('0xa')](),controller[_0xf08c('0xb')]);router[_0xf08c('0xc')](_0xf08c('0x8'),auth[_0xf08c('0xa')](),controller[_0xf08c('0xd')]);router[_0xf08c('0xe')](_0xf08c('0x8'),auth[_0xf08c('0xa')](),controller['destroy']);module[_0xf08c('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9001293..3249827 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 _0x0b53=['sequelize','exports','STRING','TEXT'];(function(_0x5af10f,_0x291592){var _0x112af5=function(_0x50487a){while(--_0x50487a){_0x5af10f['push'](_0x5af10f['shift']());}};_0x112af5(++_0x291592);}(_0x0b53,0x150));var _0x30b5=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x0b53[_0x5c4f6b];return _0x104c4e;};'use strict';var Sequelize=require(_0x30b5('0x0'));module[_0x30b5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x30b5('0x2')]},'html':{'type':Sequelize[_0x30b5('0x3')]}}; \ No newline at end of file +var _0x4b1b=['TEXT','sequelize','STRING'];(function(_0x86f56,_0x33f845){var _0x1679f7=function(_0x58c064){while(--_0x58c064){_0x86f56['push'](_0x86f56['shift']());}};_0x1679f7(++_0x33f845);}(_0x4b1b,0xdf));var _0xb4b1=function(_0x5f6a41,_0x59efa5){_0x5f6a41=_0x5f6a41-0x0;var _0x41f36d=_0x4b1b[_0x5f6a41];return _0x41f36d;};'use strict';var Sequelize=require(_0xb4b1('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4b1('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb4b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 4e2b018..6f2ca6f 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 _0x74b5=['limit','set','Content-Range','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','Template','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','end','status','count','offset'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x74b5,0xcd));var _0x574b=function(_0x45b769,_0xcd107e){_0x45b769=_0x45b769-0x0;var _0x20022d=_0x74b5[_0x45b769];return _0x20022d;};'use strict';var pdf=require(_0x574b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x574b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x574b('0x2'));var moment=require(_0x574b('0x3'));var BPromise=require(_0x574b('0x4'));var Mustache=require(_0x574b('0x5'));var util=require('util');var path=require(_0x574b('0x6'));var sox=require(_0x574b('0x7'));var csv=require('to-csv');var ejs=require(_0x574b('0x8'));var fs=require('fs');var _=require(_0x574b('0x9'));var squel=require('squel');var crypto=require(_0x574b('0xa'));var jsforce=require(_0x574b('0xb'));var deskjs=require(_0x574b('0xc'));var toCsv=require(_0x574b('0xd'));var querystring=require('querystring');var Papa=require(_0x574b('0xe'));var Redis=require(_0x574b('0xf'));var authService=require(_0x574b('0x10'));var qs=require(_0x574b('0x11'));var as=require(_0x574b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x574b('0x13'));var utils=require('../../config/utils');var config=require(_0x574b('0x14'));var db=require(_0x574b('0x15'))['db'];function respondWithStatusCode(_0x37e155,_0x3849a1){_0x3849a1=_0x3849a1||0xcc;return function(_0x49aa59){if(_0x49aa59){return _0x37e155['sendStatus'](_0x3849a1);}return _0x37e155['status'](_0x3849a1)[_0x574b('0x16')]();};}function respondWithResult(_0x11eca9,_0x4dec0f){_0x4dec0f=_0x4dec0f||0xc8;return function(_0xaa3021){if(_0xaa3021){return _0x11eca9[_0x574b('0x17')](_0x4dec0f)['json'](_0xaa3021);}};}function respondWithFilteredResult(_0x19ea50,_0x5d460e){return function(_0x38d45e){if(_0x38d45e){var _0x28c05a=_0x38d45e[_0x574b('0x18')],_0xf0e46d=_0x5d460e['offset'],_0x540061=_0x5d460e[_0x574b('0x19')]+_0x5d460e[_0x574b('0x1a')],_0x5218fa;if(_0x540061>=_0x28c05a){_0x540061=_0x28c05a;_0x5218fa=0xc8;}else{_0x5218fa=0xce;}_0x19ea50[_0x574b('0x17')](_0x5218fa);return _0x19ea50[_0x574b('0x1b')](_0x574b('0x1c'),_0xf0e46d+'-'+_0x540061+'/'+_0x28c05a)[_0x574b('0x1d')](_0x38d45e);}return null;};}function patchUpdates(_0x24b190){return function(_0x37b4fd){try{jsonpatch[_0x574b('0x1e')](_0x37b4fd,_0x24b190,!![]);}catch(_0x23d704){return BPromise[_0x574b('0x1f')](_0x23d704);}return _0x37b4fd[_0x574b('0x20')]();};}function saveUpdates(_0x494b2b,_0x390c12){return function(_0x4d9941){if(_0x4d9941){return _0x4d9941[_0x574b('0x21')](_0x494b2b)['then'](function(_0x61cd47){return _0x61cd47;});}return null;};}function removeEntity(_0x353bc7,_0x53227c){return function(_0xc9c692){if(_0xc9c692){return _0xc9c692['destroy']()[_0x574b('0x22')](function(){var _0x382b81=_0xc9c692[_0x574b('0x23')]({'plain':!![]});var _0x47299e=_0x574b('0x24');return db[_0x574b('0x25')][_0x574b('0x26')]({'where':{'type':_0x47299e,'resourceId':_0x382b81['id']}})[_0x574b('0x22')](function(){return _0xc9c692;});})['then'](function(){_0x353bc7[_0x574b('0x17')](0xcc)[_0x574b('0x16')]();});}};}function handleEntityNotFound(_0x10ca76,_0x302c49){return function(_0x2cbf2e){if(!_0x2cbf2e){_0x10ca76[_0x574b('0x27')](0x194);}return _0x2cbf2e;};}function handleError(_0x3646a4,_0x552a21){_0x552a21=_0x552a21||0x1f4;return function(_0xa6f1d4){logger[_0x574b('0x28')](_0xa6f1d4[_0x574b('0x29')]);if(_0xa6f1d4[_0x574b('0x2a')]){delete _0xa6f1d4['name'];}_0x3646a4['status'](_0x552a21)['send'](_0xa6f1d4);};}exports['index']=function(_0x686118,_0x11c78d){var _0x37d6ef={},_0x3d99b7={},_0x5d02dd={'count':0x0,'rows':[]};var _0x56494e=_[_0x574b('0x2b')](db['Template']['rawAttributes'],function(_0x322512){return{'name':_0x322512[_0x574b('0x2c')],'type':_0x322512[_0x574b('0x2d')][_0x574b('0x2e')]};});_0x3d99b7[_0x574b('0x2f')]=_[_0x574b('0x2b')](_0x56494e,'name');_0x3d99b7[_0x574b('0x30')]=_[_0x574b('0x31')](_0x686118[_0x574b('0x30')]);_0x3d99b7[_0x574b('0x32')]=_[_0x574b('0x33')](_0x3d99b7['model'],_0x3d99b7['query']);_0x37d6ef[_0x574b('0x34')]=_[_0x574b('0x33')](_0x3d99b7[_0x574b('0x2f')],qs[_0x574b('0x35')](_0x686118[_0x574b('0x30')][_0x574b('0x35')]));_0x37d6ef['attributes']=_0x37d6ef[_0x574b('0x34')]['length']?_0x37d6ef['attributes']:_0x3d99b7[_0x574b('0x2f')];if(!_0x686118['query']['hasOwnProperty']('nolimit')){_0x37d6ef[_0x574b('0x1a')]=qs[_0x574b('0x1a')](_0x686118[_0x574b('0x30')][_0x574b('0x1a')]);_0x37d6ef[_0x574b('0x19')]=qs['offset'](_0x686118[_0x574b('0x30')][_0x574b('0x19')]);}_0x37d6ef['order']=qs[_0x574b('0x36')](_0x686118['query'][_0x574b('0x36')]);_0x37d6ef[_0x574b('0x37')]=qs['filters'](_[_0x574b('0x38')](_0x686118['query'],_0x3d99b7[_0x574b('0x32')]),_0x56494e);if(_0x686118['query'][_0x574b('0x39')]){_0x37d6ef['where']=_[_0x574b('0x3a')](_0x37d6ef[_0x574b('0x37')],{'$or':_[_0x574b('0x2b')](_0x56494e,function(_0x3835f4){if(_0x3835f4[_0x574b('0x2d')]!==_0x574b('0x3b')){var _0x5d49b0={};_0x5d49b0[_0x3835f4[_0x574b('0x2a')]]={'$like':'%'+_0x686118[_0x574b('0x30')][_0x574b('0x39')]+'%'};return _0x5d49b0;}})});}_0x37d6ef=_[_0x574b('0x3a')]({},_0x37d6ef,_0x686118[_0x574b('0x3c')]);var _0x2ae2c1={'where':_0x37d6ef['where']};return db[_0x574b('0x3d')][_0x574b('0x18')](_0x2ae2c1)[_0x574b('0x22')](function(_0x195b22){_0x5d02dd[_0x574b('0x18')]=_0x195b22;if(_0x686118[_0x574b('0x30')]['includeAll']){_0x37d6ef['include']=[{'all':!![]}];}return db[_0x574b('0x3d')][_0x574b('0x3e')](_0x37d6ef);})[_0x574b('0x22')](function(_0x95bd2b){_0x5d02dd[_0x574b('0x3f')]=_0x95bd2b;return _0x5d02dd;})[_0x574b('0x22')](respondWithFilteredResult(_0x11c78d,_0x37d6ef))[_0x574b('0x40')](handleError(_0x11c78d,null));};exports['show']=function(_0x35b170,_0x35f81a){var _0x21a523={'raw':!![],'where':{'id':_0x35b170[_0x574b('0x41')]['id']}},_0x7e8bd3={};_0x7e8bd3[_0x574b('0x2f')]=_[_0x574b('0x31')](db[_0x574b('0x3d')][_0x574b('0x42')]);_0x7e8bd3[_0x574b('0x30')]=_['keys'](_0x35b170['query']);_0x7e8bd3[_0x574b('0x32')]=_[_0x574b('0x33')](_0x7e8bd3[_0x574b('0x2f')],_0x7e8bd3['query']);_0x21a523[_0x574b('0x34')]=_[_0x574b('0x33')](_0x7e8bd3['model'],qs[_0x574b('0x35')](_0x35b170[_0x574b('0x30')][_0x574b('0x35')]));_0x21a523[_0x574b('0x34')]=_0x21a523[_0x574b('0x34')]['length']?_0x21a523['attributes']:_0x7e8bd3[_0x574b('0x2f')];if(_0x35b170[_0x574b('0x30')]['includeAll']){_0x21a523[_0x574b('0x43')]=[{'all':!![]}];}_0x21a523=_['merge']({},_0x21a523,_0x35b170['options']);return db[_0x574b('0x3d')][_0x574b('0x44')](_0x21a523)[_0x574b('0x22')](handleEntityNotFound(_0x35f81a,null))[_0x574b('0x22')](respondWithResult(_0x35f81a,null))[_0x574b('0x40')](handleError(_0x35f81a,null));};exports['create']=function(_0x495e36,_0x49633c){return db[_0x574b('0x3d')][_0x574b('0x45')](_0x495e36[_0x574b('0x46')],{})[_0x574b('0x22')](function(_0x462f12){var _0xcdf74c=_0x495e36['user'][_0x574b('0x23')]({'plain':!![]});if(!_0xcdf74c)throw new Error(_0x574b('0x47'));if(_0xcdf74c[_0x574b('0x48')]==='user'){var _0x1ccf0b=_0x462f12[_0x574b('0x23')]({'plain':!![]});var _0x400d00=_0x574b('0x24');return db[_0x574b('0x49')][_0x574b('0x44')]({'where':{'name':_0x400d00,'userProfileId':_0xcdf74c[_0x574b('0x4a')]},'raw':!![]})['then'](function(_0x2bddd1){if(_0x2bddd1&&_0x2bddd1[_0x574b('0x4b')]===0x0){return db[_0x574b('0x25')][_0x574b('0x45')]({'name':_0x1ccf0b[_0x574b('0x2a')],'resourceId':_0x1ccf0b['id'],'type':_0x2bddd1[_0x574b('0x2a')],'sectionId':_0x2bddd1['id']},{})[_0x574b('0x22')](function(){return _0x462f12;});}else{return _0x462f12;}})['catch'](function(_0x391be4){logger[_0x574b('0x28')](_0x574b('0x4c'),_0x391be4);throw _0x391be4;});}return _0x462f12;})[_0x574b('0x22')](respondWithResult(_0x49633c,0xc9))[_0x574b('0x40')](handleError(_0x49633c,null));};exports['update']=function(_0x512e45,_0x1aa261){if(_0x512e45[_0x574b('0x46')]['id']){delete _0x512e45['body']['id'];}return db[_0x574b('0x3d')][_0x574b('0x44')]({'where':{'id':_0x512e45[_0x574b('0x41')]['id']}})['then'](handleEntityNotFound(_0x1aa261,null))[_0x574b('0x22')](saveUpdates(_0x512e45[_0x574b('0x46')],null))[_0x574b('0x22')](respondWithResult(_0x1aa261,null))[_0x574b('0x40')](handleError(_0x1aa261,null));};exports[_0x574b('0x26')]=function(_0xdd7b89,_0x20c30e){return db[_0x574b('0x3d')][_0x574b('0x44')]({'where':{'id':_0xdd7b89[_0x574b('0x41')]['id']}})['then'](handleEntityNotFound(_0x20c30e,null))[_0x574b('0x22')](removeEntity(_0x20c30e,null))[_0x574b('0x40')](handleError(_0x20c30e,null));}; \ No newline at end of file +var _0x60aa=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','count','findAll','rows','params','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','get','Templates','destroy','stack','name','send','index','map','Template','rawAttributes','type','key','model','query'];(function(_0x37d21e,_0x4b50a6){var _0x349a12=function(_0x16eb91){while(--_0x16eb91){_0x37d21e['push'](_0x37d21e['shift']());}};_0x349a12(++_0x4b50a6);}(_0x60aa,0xb7));var _0xa60a=function(_0x2001f5,_0xf957a1){_0x2001f5=_0x2001f5-0x0;var _0x3d94d6=_0x60aa[_0x2001f5];return _0x3d94d6;};'use strict';var pdf=require(_0xa60a('0x0'));var emlformat=require(_0xa60a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa60a('0x2'));var jsonpatch=require(_0xa60a('0x3'));var rp=require('request-promise');var moment=require(_0xa60a('0x4'));var BPromise=require(_0xa60a('0x5'));var Mustache=require(_0xa60a('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa60a('0x7'));var csv=require(_0xa60a('0x8'));var ejs=require(_0xa60a('0x9'));var fs=require('fs');var _=require(_0xa60a('0xa'));var squel=require(_0xa60a('0xb'));var crypto=require(_0xa60a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa60a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa60a('0xe'));var Redis=require(_0xa60a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa60a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa60a('0x11'))(_0xa60a('0x12'));var utils=require(_0xa60a('0x13'));var config=require(_0xa60a('0x14'));var db=require(_0xa60a('0x15'))['db'];function respondWithStatusCode(_0x3acdfb,_0x4755a6){_0x4755a6=_0x4755a6||0xcc;return function(_0x5c3620){if(_0x5c3620){return _0x3acdfb[_0xa60a('0x16')](_0x4755a6);}return _0x3acdfb[_0xa60a('0x17')](_0x4755a6)[_0xa60a('0x18')]();};}function respondWithResult(_0x5d3a02,_0xdf4b7c){_0xdf4b7c=_0xdf4b7c||0xc8;return function(_0x148bf5){if(_0x148bf5){return _0x5d3a02[_0xa60a('0x17')](_0xdf4b7c)['json'](_0x148bf5);}};}function respondWithFilteredResult(_0x490bff,_0x43bc5c){return function(_0xe145ef){if(_0xe145ef){var _0x2f488b=_0xe145ef['count'],_0x576431=_0x43bc5c['offset'],_0x22cd61=_0x43bc5c[_0xa60a('0x19')]+_0x43bc5c[_0xa60a('0x1a')],_0x3d9003;if(_0x22cd61>=_0x2f488b){_0x22cd61=_0x2f488b;_0x3d9003=0xc8;}else{_0x3d9003=0xce;}_0x490bff[_0xa60a('0x17')](_0x3d9003);return _0x490bff['set'](_0xa60a('0x1b'),_0x576431+'-'+_0x22cd61+'/'+_0x2f488b)[_0xa60a('0x1c')](_0xe145ef);}return null;};}function patchUpdates(_0x4584dd){return function(_0x50f2c2){try{jsonpatch[_0xa60a('0x1d')](_0x50f2c2,_0x4584dd,!![]);}catch(_0x19fb40){return BPromise[_0xa60a('0x1e')](_0x19fb40);}return _0x50f2c2[_0xa60a('0x1f')]();};}function saveUpdates(_0x407447,_0x4e416c){return function(_0x3bf951){if(_0x3bf951){return _0x3bf951[_0xa60a('0x20')](_0x407447)['then'](function(_0x49d69e){return _0x49d69e;});}return null;};}function removeEntity(_0x3e2d21,_0x5babe2){return function(_0x153d52){if(_0x153d52){return _0x153d52['destroy']()[_0xa60a('0x21')](function(){var _0xaf689b=_0x153d52[_0xa60a('0x22')]({'plain':!![]});var _0x204835=_0xa60a('0x23');return db['UserProfileResource'][_0xa60a('0x24')]({'where':{'type':_0x204835,'resourceId':_0xaf689b['id']}})['then'](function(){return _0x153d52;});})[_0xa60a('0x21')](function(){_0x3e2d21[_0xa60a('0x17')](0xcc)[_0xa60a('0x18')]();});}};}function handleEntityNotFound(_0x120a80,_0x161e80){return function(_0x5dedbe){if(!_0x5dedbe){_0x120a80[_0xa60a('0x16')](0x194);}return _0x5dedbe;};}function handleError(_0x4c2e40,_0x2f96ea){_0x2f96ea=_0x2f96ea||0x1f4;return function(_0x570235){logger['error'](_0x570235[_0xa60a('0x25')]);if(_0x570235[_0xa60a('0x26')]){delete _0x570235[_0xa60a('0x26')];}_0x4c2e40['status'](_0x2f96ea)[_0xa60a('0x27')](_0x570235);};}exports[_0xa60a('0x28')]=function(_0x1991da,_0x4c0840){var _0x4a0613={},_0x51a104={},_0x498721={'count':0x0,'rows':[]};var _0x22631e=_[_0xa60a('0x29')](db[_0xa60a('0x2a')][_0xa60a('0x2b')],function(_0x4259a3){return{'name':_0x4259a3['fieldName'],'type':_0x4259a3[_0xa60a('0x2c')][_0xa60a('0x2d')]};});_0x51a104[_0xa60a('0x2e')]=_[_0xa60a('0x29')](_0x22631e,_0xa60a('0x26'));_0x51a104[_0xa60a('0x2f')]=_[_0xa60a('0x30')](_0x1991da[_0xa60a('0x2f')]);_0x51a104[_0xa60a('0x31')]=_['intersection'](_0x51a104[_0xa60a('0x2e')],_0x51a104['query']);_0x4a0613[_0xa60a('0x32')]=_[_0xa60a('0x33')](_0x51a104[_0xa60a('0x2e')],qs['fields'](_0x1991da[_0xa60a('0x2f')][_0xa60a('0x34')]));_0x4a0613[_0xa60a('0x32')]=_0x4a0613['attributes'][_0xa60a('0x35')]?_0x4a0613[_0xa60a('0x32')]:_0x51a104[_0xa60a('0x2e')];if(!_0x1991da['query'][_0xa60a('0x36')](_0xa60a('0x37'))){_0x4a0613[_0xa60a('0x1a')]=qs[_0xa60a('0x1a')](_0x1991da[_0xa60a('0x2f')][_0xa60a('0x1a')]);_0x4a0613[_0xa60a('0x19')]=qs[_0xa60a('0x19')](_0x1991da[_0xa60a('0x2f')][_0xa60a('0x19')]);}_0x4a0613['order']=qs['sort'](_0x1991da[_0xa60a('0x2f')][_0xa60a('0x38')]);_0x4a0613[_0xa60a('0x39')]=qs[_0xa60a('0x31')](_[_0xa60a('0x3a')](_0x1991da['query'],_0x51a104[_0xa60a('0x31')]),_0x22631e);if(_0x1991da[_0xa60a('0x2f')]['filter']){_0x4a0613['where']=_['merge'](_0x4a0613[_0xa60a('0x39')],{'$or':_['map'](_0x22631e,function(_0x53cbfa){if(_0x53cbfa[_0xa60a('0x2c')]!==_0xa60a('0x3b')){var _0x39de90={};_0x39de90[_0x53cbfa['name']]={'$like':'%'+_0x1991da[_0xa60a('0x2f')][_0xa60a('0x3c')]+'%'};return _0x39de90;}})});}_0x4a0613=_[_0xa60a('0x3d')]({},_0x4a0613,_0x1991da[_0xa60a('0x3e')]);var _0x410761={'where':_0x4a0613['where']};return db[_0xa60a('0x2a')][_0xa60a('0x3f')](_0x410761)['then'](function(_0x5a8530){_0x498721[_0xa60a('0x3f')]=_0x5a8530;if(_0x1991da['query']['includeAll']){_0x4a0613['include']=[{'all':!![]}];}return db['Template'][_0xa60a('0x40')](_0x4a0613);})[_0xa60a('0x21')](function(_0x3e8186){_0x498721[_0xa60a('0x41')]=_0x3e8186;return _0x498721;})['then'](respondWithFilteredResult(_0x4c0840,_0x4a0613))['catch'](handleError(_0x4c0840,null));};exports['show']=function(_0x1636c7,_0x172a3f){var _0x206866={'raw':!![],'where':{'id':_0x1636c7[_0xa60a('0x42')]['id']}},_0xda7a43={};_0xda7a43[_0xa60a('0x2e')]=_[_0xa60a('0x30')](db['Template'][_0xa60a('0x2b')]);_0xda7a43['query']=_[_0xa60a('0x30')](_0x1636c7[_0xa60a('0x2f')]);_0xda7a43[_0xa60a('0x31')]=_['intersection'](_0xda7a43['model'],_0xda7a43['query']);_0x206866[_0xa60a('0x32')]=_[_0xa60a('0x33')](_0xda7a43[_0xa60a('0x2e')],qs[_0xa60a('0x34')](_0x1636c7['query']['fields']));_0x206866[_0xa60a('0x32')]=_0x206866[_0xa60a('0x32')][_0xa60a('0x35')]?_0x206866[_0xa60a('0x32')]:_0xda7a43['model'];if(_0x1636c7[_0xa60a('0x2f')][_0xa60a('0x43')]){_0x206866[_0xa60a('0x44')]=[{'all':!![]}];}_0x206866=_[_0xa60a('0x3d')]({},_0x206866,_0x1636c7[_0xa60a('0x3e')]);return db[_0xa60a('0x2a')][_0xa60a('0x45')](_0x206866)[_0xa60a('0x21')](handleEntityNotFound(_0x172a3f,null))['then'](respondWithResult(_0x172a3f,null))[_0xa60a('0x46')](handleError(_0x172a3f,null));};exports[_0xa60a('0x47')]=function(_0xb625f9,_0x1f5fb1){return db['Template'][_0xa60a('0x47')](_0xb625f9[_0xa60a('0x48')],{})[_0xa60a('0x21')](function(_0x45910e){var _0x4530bb=_0xb625f9[_0xa60a('0x49')][_0xa60a('0x22')]({'plain':!![]});if(!_0x4530bb)throw new Error(_0xa60a('0x4a'));if(_0x4530bb['role']===_0xa60a('0x49')){var _0x17cebd=_0x45910e[_0xa60a('0x22')]({'plain':!![]});var _0x4db6c1=_0xa60a('0x23');return db['UserProfileSection'][_0xa60a('0x45')]({'where':{'name':_0x4db6c1,'userProfileId':_0x4530bb[_0xa60a('0x4b')]},'raw':!![]})[_0xa60a('0x21')](function(_0x5865f3){if(_0x5865f3&&_0x5865f3[_0xa60a('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x17cebd['name'],'resourceId':_0x17cebd['id'],'type':_0x5865f3[_0xa60a('0x26')],'sectionId':_0x5865f3['id']},{})[_0xa60a('0x21')](function(){return _0x45910e;});}else{return _0x45910e;}})['catch'](function(_0x2e4af9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e4af9);throw _0x2e4af9;});}return _0x45910e;})[_0xa60a('0x21')](respondWithResult(_0x1f5fb1,0xc9))[_0xa60a('0x46')](handleError(_0x1f5fb1,null));};exports['update']=function(_0x322e4f,_0x36103b){if(_0x322e4f[_0xa60a('0x48')]['id']){delete _0x322e4f[_0xa60a('0x48')]['id'];}return db['Template'][_0xa60a('0x45')]({'where':{'id':_0x322e4f[_0xa60a('0x42')]['id']}})['then'](handleEntityNotFound(_0x36103b,null))[_0xa60a('0x21')](saveUpdates(_0x322e4f[_0xa60a('0x48')],null))['then'](respondWithResult(_0x36103b,null))[_0xa60a('0x46')](handleError(_0x36103b,null));};exports[_0xa60a('0x24')]=function(_0x78e823,_0x561436){return db['Template'][_0xa60a('0x45')]({'where':{'id':_0x78e823['params']['id']}})['then'](handleEntityNotFound(_0x561436,null))['then'](removeEntity(_0x561436,null))[_0xa60a('0x46')](handleError(_0x561436,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 13e8ba9..9120920 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 _0x3e59=['Template','tools_templates','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x1f71fb,_0x4cdd2d){var _0x4f0dc1=function(_0x186890){while(--_0x186890){_0x1f71fb['push'](_0x1f71fb['shift']());}};_0x4f0dc1(++_0x4cdd2d);}(_0x3e59,0xb6));var _0x93e5=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x3e59[_0x4207a6];return _0x42b37a;};'use strict';var _=require(_0x93e5('0x0'));var util=require('util');var logger=require(_0x93e5('0x1'))(_0x93e5('0x2'));var moment=require('moment');var BPromise=require(_0x93e5('0x3'));var rp=require(_0x93e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93e5('0x5'));var config=require(_0x93e5('0x6'));var attributes=require(_0x93e5('0x7'));module[_0x93e5('0x8')]=function(_0x45a3e5,_0xa83fb3){return _0x45a3e5[_0x93e5('0x9')](_0x93e5('0xa'),attributes,{'tableName':_0x93e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a9=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2a9d39,_0x266a4c){var _0x29d067=function(_0x3c7e57){while(--_0x3c7e57){_0x2a9d39['push'](_0x2a9d39['shift']());}};_0x29d067(++_0x266a4c);}(_0xf2a9,0x19d));var _0x9f2a=function(_0x30deac,_0x54d29d){_0x30deac=_0x30deac-0x0;var _0x5d9113=_0xf2a9[_0x30deac];return _0x5d9113;};'use strict';var _=require(_0x9f2a('0x0'));var util=require(_0x9f2a('0x1'));var logger=require(_0x9f2a('0x2'))(_0x9f2a('0x3'));var moment=require(_0x9f2a('0x4'));var BPromise=require(_0x9f2a('0x5'));var rp=require(_0x9f2a('0x6'));var fs=require('fs');var path=require(_0x9f2a('0x7'));var rimraf=require(_0x9f2a('0x8'));var config=require(_0x9f2a('0x9'));var attributes=require(_0x9f2a('0xa'));module[_0x9f2a('0xb')]=function(_0x11e75f,_0x176d28){return _0x11e75f[_0x9f2a('0xc')](_0x9f2a('0xd'),attributes,{'tableName':_0x9f2a('0xe'),'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 63ee249..8cf9ca0 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 _0x9074=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Template,\x20%s,\x20%s','message','info','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','bluebird'];(function(_0x23b15e,_0x14baa2){var _0x3af46e=function(_0xef8605){while(--_0xef8605){_0x23b15e['push'](_0x23b15e['shift']());}};_0x3af46e(++_0x14baa2);}(_0x9074,0x1dd));var _0x4907=function(_0x3b8577,_0x3ac411){_0x3b8577=_0x3b8577-0x0;var _0x42688c=_0x9074[_0x3b8577];return _0x42688c;};'use strict';var _=require(_0x4907('0x0'));var util=require(_0x4907('0x1'));var moment=require('moment');var BPromise=require(_0x4907('0x2'));var rs=require(_0x4907('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4907('0x4'))['db'];var utils=require(_0x4907('0x5'));var logger=require(_0x4907('0x6'))(_0x4907('0x7'));var config=require(_0x4907('0x8'));var jayson=require(_0x4907('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e37ad,_0x576aea,_0x39c59a){return new BPromise(function(_0x339d1,_0xb9dd9f){return client[_0x4907('0xa')](_0x2e37ad,_0x39c59a)['then'](function(_0x16c8b6){logger['info']('Template,\x20%s,\x20%s',_0x576aea,'request\x20sent');logger[_0x4907('0xb')](_0x4907('0xc'),_0x576aea,_0x4907('0xd'),JSON[_0x4907('0xe')](_0x16c8b6));if(_0x16c8b6[_0x4907('0xf')]){if(_0x16c8b6[_0x4907('0xf')]['code']===0x1f4){logger[_0x4907('0xf')](_0x4907('0x10'),_0x576aea,_0x16c8b6['error'][_0x4907('0x11')]);return _0xb9dd9f(_0x16c8b6[_0x4907('0xf')][_0x4907('0x11')]);}logger[_0x4907('0xf')](_0x4907('0x10'),_0x576aea,_0x16c8b6[_0x4907('0xf')][_0x4907('0x11')]);return _0x339d1(_0x16c8b6[_0x4907('0xf')]['message']);}else{logger[_0x4907('0x12')](_0x4907('0x10'),_0x576aea,_0x4907('0xd'));_0x339d1(_0x16c8b6['result'][_0x4907('0x11')]);}})['catch'](function(_0x317a6a){logger['error'](_0x4907('0x10'),_0x576aea,_0x317a6a);_0xb9dd9f(_0x317a6a);});});}exports[_0x4907('0x13')]=function(_0x3ff307){var _0x5ef4fd=this;return new Promise(function(_0xf575dd,_0x5336ba){return db[_0x4907('0x14')]['findAll']({'raw':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x16')]===undefined?!![]:![]:!![],'where':_0x3ff307[_0x4907('0x15')]?_0x3ff307[_0x4907('0x15')][_0x4907('0x17')]||null:null,'attributes':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x18')]||null:null,'limit':_0x3ff307[_0x4907('0x15')]?_0x3ff307[_0x4907('0x15')][_0x4907('0x19')]||null:null,'include':_0x3ff307[_0x4907('0x15')]?_0x3ff307['options'][_0x4907('0x1a')]?_[_0x4907('0x1b')](_0x3ff307[_0x4907('0x15')][_0x4907('0x1a')],function(_0x6b0dfe){return{'model':db[_0x6b0dfe[_0x4907('0x1c')]],'as':_0x6b0dfe['as'],'attributes':_0x6b0dfe['attributes'],'include':_0x6b0dfe[_0x4907('0x1a')]?_[_0x4907('0x1b')](_0x6b0dfe[_0x4907('0x1a')],function(_0x2515bd){return{'model':db[_0x2515bd[_0x4907('0x1c')]],'as':_0x2515bd['as'],'attributes':_0x2515bd[_0x4907('0x18')],'include':_0x2515bd[_0x4907('0x1a')]?_['map'](_0x2515bd[_0x4907('0x1a')],function(_0x1b06f5){return{'model':db[_0x1b06f5[_0x4907('0x1c')]],'as':_0x1b06f5['as'],'attributes':_0x1b06f5[_0x4907('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7685){logger['info'](_0x4907('0x13'),_0x3ff307);logger[_0x4907('0xb')]('GetTemplate',_0x3ff307,JSON[_0x4907('0xe')](_0x3d7685));_0xf575dd(_0x3d7685);})[_0x4907('0x1d')](function(_0x4bd1cc){logger['error']('GetTemplate',_0x4bd1cc['message'],_0x3ff307);_0x5336ba(_0x5ef4fd['error'](0x1f4,_0x4bd1cc[_0x4907('0x11')]));});});}; \ No newline at end of file +var _0xb070=['error','code','message','Template,\x20%s,\x20%s','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb070,0xaa));var _0x0b07=function(_0x166593,_0x402c94){_0x166593=_0x166593-0x0;var _0x49e59e=_0xb070[_0x166593];return _0x49e59e;};'use strict';var _=require(_0x0b07('0x0'));var util=require(_0x0b07('0x1'));var moment=require(_0x0b07('0x2'));var BPromise=require(_0x0b07('0x3'));var rs=require(_0x0b07('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b07('0x5'))['db'];var utils=require(_0x0b07('0x6'));var logger=require(_0x0b07('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b07('0x8'));var client=jayson[_0x0b07('0x9')][_0x0b07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d52b8,_0x1e1872,_0x179e93){return new BPromise(function(_0x3d6c34,_0x33b379){return client[_0x0b07('0xb')](_0x4d52b8,_0x179e93)[_0x0b07('0xc')](function(_0x13d852){logger[_0x0b07('0xd')]('Template,\x20%s,\x20%s',_0x1e1872,'request\x20sent');logger[_0x0b07('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x1e1872,'request\x20sent',JSON[_0x0b07('0xf')](_0x13d852));if(_0x13d852[_0x0b07('0x10')]){if(_0x13d852[_0x0b07('0x10')][_0x0b07('0x11')]===0x1f4){logger[_0x0b07('0x10')]('Template,\x20%s,\x20%s',_0x1e1872,_0x13d852[_0x0b07('0x10')][_0x0b07('0x12')]);return _0x33b379(_0x13d852[_0x0b07('0x10')][_0x0b07('0x12')]);}logger[_0x0b07('0x10')](_0x0b07('0x13'),_0x1e1872,_0x13d852[_0x0b07('0x10')]['message']);return _0x3d6c34(_0x13d852[_0x0b07('0x10')][_0x0b07('0x12')]);}else{logger[_0x0b07('0xd')](_0x0b07('0x13'),_0x1e1872,'request\x20sent');_0x3d6c34(_0x13d852['result'][_0x0b07('0x12')]);}})[_0x0b07('0x14')](function(_0x2c44a7){logger[_0x0b07('0x10')]('Template,\x20%s,\x20%s',_0x1e1872,_0x2c44a7);_0x33b379(_0x2c44a7);});});}exports[_0x0b07('0x15')]=function(_0x3b6543){var _0x3fcc10=this;return new Promise(function(_0x7ef6d1,_0x391df9){return db[_0x0b07('0x16')][_0x0b07('0x17')]({'raw':_0x3b6543[_0x0b07('0x18')]?_0x3b6543[_0x0b07('0x18')][_0x0b07('0x19')]===undefined?!![]:![]:!![],'where':_0x3b6543[_0x0b07('0x18')]?_0x3b6543['options'][_0x0b07('0x1a')]||null:null,'attributes':_0x3b6543[_0x0b07('0x18')]?_0x3b6543[_0x0b07('0x18')][_0x0b07('0x1b')]||null:null,'limit':_0x3b6543[_0x0b07('0x18')]?_0x3b6543['options']['limit']||null:null,'include':_0x3b6543[_0x0b07('0x18')]?_0x3b6543[_0x0b07('0x18')][_0x0b07('0x1c')]?_[_0x0b07('0x1d')](_0x3b6543[_0x0b07('0x18')][_0x0b07('0x1c')],function(_0x593e01){return{'model':db[_0x593e01[_0x0b07('0x1e')]],'as':_0x593e01['as'],'attributes':_0x593e01[_0x0b07('0x1b')],'include':_0x593e01['include']?_[_0x0b07('0x1d')](_0x593e01['include'],function(_0x2ba6ac){return{'model':db[_0x2ba6ac[_0x0b07('0x1e')]],'as':_0x2ba6ac['as'],'attributes':_0x2ba6ac[_0x0b07('0x1b')],'include':_0x2ba6ac['include']?_[_0x0b07('0x1d')](_0x2ba6ac[_0x0b07('0x1c')],function(_0x35b780){return{'model':db[_0x35b780[_0x0b07('0x1e')]],'as':_0x35b780['as'],'attributes':_0x35b780['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b07('0xc')](function(_0x1e3c6d){logger[_0x0b07('0xd')]('GetTemplate',_0x3b6543);logger[_0x0b07('0xe')](_0x0b07('0x15'),_0x3b6543,JSON[_0x0b07('0xf')](_0x1e3c6d));_0x7ef6d1(_0x1e3c6d);})['catch'](function(_0x106d7b){logger[_0x0b07('0x10')](_0x0b07('0x15'),_0x106d7b['message'],_0x3b6543);_0x391df9(_0x3fcc10['error'](0x1f4,_0x106d7b[_0x0b07('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3e78be0..4f75d03 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 _0xad2f=['create','addAnyCondition','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x1b0cb0,_0x53a76b){var _0x813dc0=function(_0xce7788){while(--_0xce7788){_0x1b0cb0['push'](_0x1b0cb0['shift']());}};_0x813dc0(++_0x53a76b);}(_0xad2f,0x1e3));var _0xfad2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xad2f[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0xfad2('0x0'));var util=require('util');var path=require(_0xfad2('0x1'));var timeout=require('connect-timeout');var express=require(_0xfad2('0x2'));var router=express[_0xfad2('0x3')]();var auth=require(_0xfad2('0x4'));var interaction=require(_0xfad2('0x5'));var config=require(_0xfad2('0x6'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfad2('0x7')]);router[_0xfad2('0x8')]('/:id',auth[_0xfad2('0x9')](),controller['show']);router[_0xfad2('0x8')](_0xfad2('0xa'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xb')]);router['get'](_0xfad2('0xc'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xd')]);router['get'](_0xfad2('0xe'),auth[_0xfad2('0x9')](),controller[_0xfad2('0xf')]);router[_0xfad2('0x10')]('/',auth[_0xfad2('0x9')](),controller[_0xfad2('0x11')]);router[_0xfad2('0x10')](_0xfad2('0xa'),auth[_0xfad2('0x9')](),controller['addAllCondition']);router[_0xfad2('0x10')]('/:id/any_conditions',auth[_0xfad2('0x9')](),controller[_0xfad2('0x12')]);router[_0xfad2('0x10')](_0xfad2('0xe'),auth[_0xfad2('0x9')](),controller['addAction']);router[_0xfad2('0x13')](_0xfad2('0x14'),auth[_0xfad2('0x9')](),controller[_0xfad2('0x15')]);router[_0xfad2('0x16')](_0xfad2('0x14'),auth['isAuthenticated'](),controller[_0xfad2('0x17')]);module[_0xfad2('0x18')]=router; \ No newline at end of file +var _0x81c6=['path','connect-timeout','Router','../../config/environment','./trigger.controller','get','/:id','show','isAuthenticated','getAnyConditions','getActions','post','create','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util'];(function(_0x18486c,_0x2d14d2){var _0x28e891=function(_0x52ec1b){while(--_0x52ec1b){_0x18486c['push'](_0x18486c['shift']());}};_0x28e891(++_0x2d14d2);}(_0x81c6,0xee));var _0x681c=function(_0x259c7e,_0x96223a){_0x259c7e=_0x259c7e-0x0;var _0x15d791=_0x81c6[_0x259c7e];return _0x15d791;};'use strict';var multer=require(_0x681c('0x0'));var util=require(_0x681c('0x1'));var path=require(_0x681c('0x2'));var timeout=require(_0x681c('0x3'));var express=require('express');var router=express[_0x681c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x5'));var controller=require(_0x681c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x681c('0x7')](_0x681c('0x8'),auth['isAuthenticated'](),controller[_0x681c('0x9')]);router[_0x681c('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router[_0x681c('0x7')]('/:id/any_conditions',auth[_0x681c('0xa')](),controller[_0x681c('0xb')]);router[_0x681c('0x7')]('/:id/actions',auth[_0x681c('0xa')](),controller[_0x681c('0xc')]);router[_0x681c('0xd')]('/',auth['isAuthenticated'](),controller[_0x681c('0xe')]);router[_0x681c('0xd')]('/:id/all_conditions',auth[_0x681c('0xa')](),controller['addAllCondition']);router['post'](_0x681c('0xf'),auth[_0x681c('0xa')](),controller[_0x681c('0x10')]);router[_0x681c('0xd')](_0x681c('0x11'),auth['isAuthenticated'](),controller[_0x681c('0x12')]);router[_0x681c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x681c('0x14')]);router[_0x681c('0x15')](_0x681c('0x8'),auth[_0x681c('0xa')](),controller[_0x681c('0x16')]);module[_0x681c('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 958f4e3..92ab0b2 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 _0x60f8=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1d7122,_0x50ed55){var _0x324150=function(_0x2a27ac){while(--_0x2a27ac){_0x1d7122['push'](_0x1d7122['shift']());}};_0x324150(++_0x50ed55);}(_0x60f8,0x169));var _0x860f=function(_0xda582b,_0x27008d){_0xda582b=_0xda582b-0x0;var _0x57abfb=_0x60f8[_0xda582b];return _0x57abfb;};'use strict';var Sequelize=require(_0x860f('0x0'));module[_0x860f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x860f('0x2')]},'description':{'type':Sequelize[_0x860f('0x2')]},'status':{'type':Sequelize[_0x860f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x895a=['STRING','sequelize','exports'];(function(_0x48ae8c,_0x3ad32f){var _0x2615b7=function(_0x263e0c){while(--_0x263e0c){_0x48ae8c['push'](_0x48ae8c['shift']());}};_0x2615b7(++_0x3ad32f);}(_0x895a,0xb2));var _0xa895=function(_0x327c2b,_0x2d66ee){_0x327c2b=_0x327c2b-0x0;var _0x5f1b8a=_0x895a[_0x327c2b];return _0x5f1b8a;};'use strict';var Sequelize=require(_0xa895('0x0'));module[_0xa895('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa895('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 8d36628..bf535b3 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 _0x576e=['includeAll','include','rows','catch','show','rawAttributes','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','name','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','options','getAllConditions','getAnyConditions','hasOwnProperty','addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','update','then','destroy','get','UserProfileResource','end','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Trigger'];(function(_0x295f2e,_0xf6f834){var _0x1d926e=function(_0x333946){while(--_0x333946){_0x295f2e['push'](_0x295f2e['shift']());}};_0x1d926e(++_0xf6f834);}(_0x576e,0x190));var _0xe576=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x576e[_0x100e36];return _0x1df0c9;};'use strict';var pdf=require(_0xe576('0x0'));var emlformat=require(_0xe576('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe576('0x2'));var jsonpatch=require(_0xe576('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe576('0x4'));var Mustache=require(_0xe576('0x5'));var util=require(_0xe576('0x6'));var path=require(_0xe576('0x7'));var sox=require(_0xe576('0x8'));var csv=require(_0xe576('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe576('0xa'));var squel=require(_0xe576('0xb'));var crypto=require(_0xe576('0xc'));var jsforce=require(_0xe576('0xd'));var deskjs=require(_0xe576('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe576('0xf'));var Papa=require(_0xe576('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe576('0x11'));var hardwareService=require(_0xe576('0x12'));var logger=require(_0xe576('0x13'))(_0xe576('0x14'));var utils=require('../../config/utils');var config=require(_0xe576('0x15'));var db=require(_0xe576('0x16'))['db'];function respondWithStatusCode(_0x2ebca0,_0x50acf1){_0x50acf1=_0x50acf1||0xcc;return function(_0x5d3102){if(_0x5d3102){return _0x2ebca0[_0xe576('0x17')](_0x50acf1);}return _0x2ebca0[_0xe576('0x18')](_0x50acf1)['end']();};}function respondWithResult(_0x207330,_0xea8ecb){_0xea8ecb=_0xea8ecb||0xc8;return function(_0x7332d5){if(_0x7332d5){return _0x207330['status'](_0xea8ecb)['json'](_0x7332d5);}};}function respondWithFilteredResult(_0x5682b7,_0x325d69){return function(_0x144297){if(_0x144297){var _0xfaede5=_0x144297[_0xe576('0x19')],_0x10c312=_0x325d69['offset'],_0x34851b=_0x325d69[_0xe576('0x1a')]+_0x325d69[_0xe576('0x1b')],_0x37fe69;if(_0x34851b>=_0xfaede5){_0x34851b=_0xfaede5;_0x37fe69=0xc8;}else{_0x37fe69=0xce;}_0x5682b7['status'](_0x37fe69);return _0x5682b7[_0xe576('0x1c')]('Content-Range',_0x10c312+'-'+_0x34851b+'/'+_0xfaede5)[_0xe576('0x1d')](_0x144297);}return null;};}function patchUpdates(_0x5d328b){return function(_0x4c6bbd){try{jsonpatch[_0xe576('0x1e')](_0x4c6bbd,_0x5d328b,!![]);}catch(_0x6aa923){return BPromise[_0xe576('0x1f')](_0x6aa923);}return _0x4c6bbd['save']();};}function saveUpdates(_0xb4ea0d,_0x418a39){return function(_0xfb4a3e){if(_0xfb4a3e){return _0xfb4a3e[_0xe576('0x20')](_0xb4ea0d)[_0xe576('0x21')](function(_0x4578b0){return _0x4578b0;});}return null;};}function removeEntity(_0x3342a6,_0x4e386d){return function(_0x49df50){if(_0x49df50){return _0x49df50[_0xe576('0x22')]()[_0xe576('0x21')](function(){var _0x392adb=_0x49df50[_0xe576('0x23')]({'plain':!![]});var _0xe5a2fe='Triggers';return db[_0xe576('0x24')][_0xe576('0x22')]({'where':{'type':_0xe5a2fe,'resourceId':_0x392adb['id']}})[_0xe576('0x21')](function(){return _0x49df50;});})[_0xe576('0x21')](function(){_0x3342a6[_0xe576('0x18')](0xcc)[_0xe576('0x25')]();});}};}function handleEntityNotFound(_0x251bed,_0x2d895a){return function(_0x42be0d){if(!_0x42be0d){_0x251bed[_0xe576('0x17')](0x194);}return _0x42be0d;};}function handleError(_0x1b2f77,_0x309849){_0x309849=_0x309849||0x1f4;return function(_0x309546){logger['error'](_0x309546['stack']);if(_0x309546['name']){delete _0x309546['name'];}_0x1b2f77[_0xe576('0x18')](_0x309849)[_0xe576('0x26')](_0x309546);};}exports[_0xe576('0x27')]=function(_0x475e9e,_0x57f085){var _0x55ac40={},_0x18533a={},_0x19dddb={'count':0x0,'rows':[]};var _0x4ffe61=_[_0xe576('0x28')](db['Trigger']['rawAttributes'],function(_0xaba9fa){return{'name':_0xaba9fa[_0xe576('0x29')],'type':_0xaba9fa[_0xe576('0x2a')][_0xe576('0x2b')]};});_0x18533a[_0xe576('0x2c')]=_['map'](_0x4ffe61,'name');_0x18533a[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x475e9e[_0xe576('0x2d')]);_0x18533a[_0xe576('0x2f')]=_['intersection'](_0x18533a['model'],_0x18533a[_0xe576('0x2d')]);_0x55ac40[_0xe576('0x30')]=_[_0xe576('0x31')](_0x18533a[_0xe576('0x2c')],qs['fields'](_0x475e9e[_0xe576('0x2d')]['fields']));_0x55ac40[_0xe576('0x30')]=_0x55ac40['attributes'][_0xe576('0x32')]?_0x55ac40[_0xe576('0x30')]:_0x18533a[_0xe576('0x2c')];if(!_0x475e9e[_0xe576('0x2d')]['hasOwnProperty'](_0xe576('0x33'))){_0x55ac40['limit']=qs[_0xe576('0x1b')](_0x475e9e[_0xe576('0x2d')][_0xe576('0x1b')]);_0x55ac40[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x475e9e['query'][_0xe576('0x1a')]);}_0x55ac40[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x475e9e[_0xe576('0x2d')][_0xe576('0x35')]);_0x55ac40[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x475e9e['query'],_0x18533a[_0xe576('0x2f')]),_0x4ffe61);if(_0x475e9e[_0xe576('0x2d')][_0xe576('0x38')]){_0x55ac40[_0xe576('0x36')]=_[_0xe576('0x39')](_0x55ac40[_0xe576('0x36')],{'$or':_['map'](_0x4ffe61,function(_0x3067ee){if(_0x3067ee[_0xe576('0x2a')]!==_0xe576('0x3a')){var _0x119acd={};_0x119acd[_0x3067ee['name']]={'$like':'%'+_0x475e9e[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x119acd;}})});}_0x55ac40=_[_0xe576('0x39')]({},_0x55ac40,_0x475e9e['options']);var _0x585455={'where':_0x55ac40[_0xe576('0x36')]};return db[_0xe576('0x3b')]['count'](_0x585455)[_0xe576('0x21')](function(_0x2816ff){_0x19dddb['count']=_0x2816ff;if(_0x475e9e['query'][_0xe576('0x3c')]){_0x55ac40[_0xe576('0x3d')]=[{'all':!![]}];}return db[_0xe576('0x3b')]['findAll'](_0x55ac40);})[_0xe576('0x21')](function(_0xb0549e){_0x19dddb[_0xe576('0x3e')]=_0xb0549e;return _0x19dddb;})[_0xe576('0x21')](respondWithFilteredResult(_0x57f085,_0x55ac40))[_0xe576('0x3f')](handleError(_0x57f085,null));};exports[_0xe576('0x40')]=function(_0x66ee65,_0x544c4e){var _0x43000a={'raw':![],'where':{'id':_0x66ee65['params']['id']}},_0x52c9f6={};_0x52c9f6[_0xe576('0x2c')]=_[_0xe576('0x2e')](db[_0xe576('0x3b')][_0xe576('0x41')]);_0x52c9f6[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x66ee65[_0xe576('0x2d')]);_0x52c9f6[_0xe576('0x2f')]=_[_0xe576('0x31')](_0x52c9f6[_0xe576('0x2c')],_0x52c9f6[_0xe576('0x2d')]);_0x43000a['attributes']=_[_0xe576('0x31')](_0x52c9f6[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x66ee65[_0xe576('0x2d')][_0xe576('0x42')]));_0x43000a[_0xe576('0x30')]=_0x43000a[_0xe576('0x30')]['length']?_0x43000a[_0xe576('0x30')]:_0x52c9f6['model'];if(_0x66ee65['query']['includeAll']){_0x43000a[_0xe576('0x3d')]=[{'all':!![]}];}_0x43000a=_[_0xe576('0x39')]({},_0x43000a,_0x66ee65['options']);return db['Trigger']['find'](_0x43000a)[_0xe576('0x21')](handleEntityNotFound(_0x544c4e,null))['then'](respondWithResult(_0x544c4e,null))['catch'](handleError(_0x544c4e,null));};exports[_0xe576('0x43')]=function(_0x218653,_0x4d8662){return db['Trigger'][_0xe576('0x43')](_0x218653[_0xe576('0x44')],{})[_0xe576('0x21')](function(_0x1cf329){var _0x137ec1=_0x218653[_0xe576('0x45')][_0xe576('0x23')]({'plain':!![]});if(!_0x137ec1)throw new Error(_0xe576('0x46'));if(_0x137ec1[_0xe576('0x47')]==='user'){var _0x52171c=_0x1cf329[_0xe576('0x23')]({'plain':!![]});var _0x5ebb2d=_0xe576('0x48');return db[_0xe576('0x49')][_0xe576('0x4a')]({'where':{'name':_0x5ebb2d,'userProfileId':_0x137ec1[_0xe576('0x4b')]},'raw':!![]})[_0xe576('0x21')](function(_0x5125cf){if(_0x5125cf&&_0x5125cf[_0xe576('0x4c')]===0x0){return db['UserProfileResource'][_0xe576('0x43')]({'name':_0x52171c[_0xe576('0x4d')],'resourceId':_0x52171c['id'],'type':_0x5125cf[_0xe576('0x4d')],'sectionId':_0x5125cf['id']},{})[_0xe576('0x21')](function(){return _0x1cf329;});}else{return _0x1cf329;}})['catch'](function(_0x1a01e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a01e1);throw _0x1a01e1;});}return _0x1cf329;})['then'](respondWithResult(_0x4d8662,0xc9))[_0xe576('0x3f')](handleError(_0x4d8662,null));};exports[_0xe576('0x20')]=function(_0x396285,_0x26e14a){if(_0x396285['body']['id']){delete _0x396285[_0xe576('0x44')]['id'];}return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x396285[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x26e14a,null))[_0xe576('0x21')](saveUpdates(_0x396285[_0xe576('0x44')],null))[_0xe576('0x21')](respondWithResult(_0x26e14a,null))[_0xe576('0x3f')](handleError(_0x26e14a,null));};exports[_0xe576('0x22')]=function(_0x2c722c,_0x1ac532){return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x2c722c['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x1ac532,null))[_0xe576('0x21')](removeEntity(_0x1ac532,null))[_0xe576('0x3f')](handleError(_0x1ac532,null));};exports[_0xe576('0x4f')]=function(_0x8526cc,_0x2115a8,_0x1f3c7a){if(_0x8526cc[_0xe576('0x44')]['id']){delete _0x8526cc[_0xe576('0x44')]['id'];}return db[_0xe576('0x3b')]['find']({'where':{'id':_0x8526cc['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x2115a8,null))[_0xe576('0x21')](function(_0x254f9b){if(_0x254f9b){_0x8526cc[_0xe576('0x44')]['TriggerAllId']=_0x254f9b['id'];return db[_0xe576('0x50')][_0xe576('0x43')](_0x8526cc[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x2115a8,null))[_0xe576('0x3f')](handleError(_0x2115a8,null));};exports[_0xe576('0x51')]=function(_0x2d9a0a,_0x49c063,_0x402121){if(_0x2d9a0a[_0xe576('0x44')]['id']){delete _0x2d9a0a['body']['id'];}return db[_0xe576('0x3b')][_0xe576('0x4a')]({'where':{'id':_0x2d9a0a[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x49c063,null))[_0xe576('0x21')](function(_0x38ec3d){if(_0x38ec3d){_0x2d9a0a[_0xe576('0x44')][_0xe576('0x52')]=_0x38ec3d['id'];return db[_0xe576('0x50')][_0xe576('0x43')](_0x2d9a0a[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x49c063,null))['catch'](handleError(_0x49c063,null));};exports['getAllConditions']=function(_0x4ee1e4,_0x524fbf,_0x54dfb0){var _0x497eb0={};var _0xf6ff87={};var _0x5089ad;var _0x499b32;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x4ee1e4['params']['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x524fbf,null))[_0xe576('0x21')](function(_0x142e28){if(_0x142e28){_0x5089ad=_0x142e28;_0xf6ff87[_0xe576('0x2c')]=_['keys'](db['Condition'][_0xe576('0x41')]);_0xf6ff87[_0xe576('0x2d')]=_['keys'](_0x4ee1e4[_0xe576('0x2d')]);_0xf6ff87[_0xe576('0x2f')]=_[_0xe576('0x31')](_0xf6ff87[_0xe576('0x2c')],_0xf6ff87[_0xe576('0x2d')]);_0x497eb0['attributes']=_[_0xe576('0x31')](_0xf6ff87[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x4ee1e4['query'][_0xe576('0x42')]));_0x497eb0[_0xe576('0x30')]=_0x497eb0[_0xe576('0x30')][_0xe576('0x32')]?_0x497eb0[_0xe576('0x30')]:_0xf6ff87['model'];_0x497eb0[_0xe576('0x34')]=qs['sort'](_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x35')]);_0x497eb0[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x4ee1e4['query'],_0xf6ff87[_0xe576('0x2f')]));if(_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x38')]){_0x497eb0[_0xe576('0x36')]=_[_0xe576('0x39')](_0x497eb0['where'],{'$or':_['map'](_0x497eb0[_0xe576('0x30')],function(_0x5d1e0f){var _0x5e23f1={};_0x5e23f1[_0x5d1e0f]={'$like':'%'+_0x4ee1e4[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x5e23f1;})});}_0x497eb0=_[_0xe576('0x39')]({},_0x497eb0,_0x4ee1e4[_0xe576('0x54')]);return _0x5089ad[_0xe576('0x55')](_0x497eb0);}})[_0xe576('0x21')](function(_0xd1ffd9){if(_0xd1ffd9){_0x499b32=_0xd1ffd9[_0xe576('0x32')];if(!_0x4ee1e4[_0xe576('0x2d')]['hasOwnProperty'](_0xe576('0x33'))){_0x497eb0[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x4ee1e4[_0xe576('0x2d')]['limit']);_0x497eb0[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x4ee1e4['query'][_0xe576('0x1a')]);}return _0x5089ad['getAllConditions'](_0x497eb0);}})[_0xe576('0x21')](function(_0x23617e){if(_0x23617e){return _0x23617e?{'count':_0x499b32,'rows':_0x23617e}:null;}})[_0xe576('0x21')](respondWithResult(_0x524fbf,null))[_0xe576('0x3f')](handleError(_0x524fbf,null));};exports[_0xe576('0x56')]=function(_0x5409bd,_0x518901,_0x2064ce){var _0x370523={};var _0x372b8d={};var _0x33a0f6;var _0x5eed8d;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x5409bd[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0x518901,null))['then'](function(_0x4cfff7){if(_0x4cfff7){_0x33a0f6=_0x4cfff7;_0x372b8d[_0xe576('0x2c')]=_[_0xe576('0x2e')](db['Condition'][_0xe576('0x41')]);_0x372b8d['query']=_[_0xe576('0x2e')](_0x5409bd[_0xe576('0x2d')]);_0x372b8d['filters']=_[_0xe576('0x31')](_0x372b8d[_0xe576('0x2c')],_0x372b8d[_0xe576('0x2d')]);_0x370523[_0xe576('0x30')]=_[_0xe576('0x31')](_0x372b8d[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x5409bd['query']['fields']));_0x370523[_0xe576('0x30')]=_0x370523[_0xe576('0x30')][_0xe576('0x32')]?_0x370523['attributes']:_0x372b8d['model'];_0x370523[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x5409bd[_0xe576('0x2d')][_0xe576('0x35')]);_0x370523['where']=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x5409bd['query'],_0x372b8d[_0xe576('0x2f')]));if(_0x5409bd[_0xe576('0x2d')][_0xe576('0x38')]){_0x370523[_0xe576('0x36')]=_[_0xe576('0x39')](_0x370523['where'],{'$or':_[_0xe576('0x28')](_0x370523['attributes'],function(_0x19f142){var _0x1dbc61={};_0x1dbc61[_0x19f142]={'$like':'%'+_0x5409bd[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x1dbc61;})});}_0x370523=_['merge']({},_0x370523,_0x5409bd[_0xe576('0x54')]);return _0x33a0f6[_0xe576('0x56')](_0x370523);}})['then'](function(_0x79c5d6){if(_0x79c5d6){_0x5eed8d=_0x79c5d6['length'];if(!_0x5409bd[_0xe576('0x2d')][_0xe576('0x57')](_0xe576('0x33'))){_0x370523[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x5409bd[_0xe576('0x2d')]['limit']);_0x370523['offset']=qs[_0xe576('0x1a')](_0x5409bd[_0xe576('0x2d')]['offset']);}return _0x33a0f6['getAnyConditions'](_0x370523);}})['then'](function(_0x237cf2){if(_0x237cf2){return _0x237cf2?{'count':_0x5eed8d,'rows':_0x237cf2}:null;}})[_0xe576('0x21')](respondWithResult(_0x518901,null))[_0xe576('0x3f')](handleError(_0x518901,null));};exports[_0xe576('0x58')]=function(_0x576b4f,_0x495987,_0x30bc51){if(_0x576b4f[_0xe576('0x44')]['id']){delete _0x576b4f[_0xe576('0x44')]['id'];}return db['Trigger'][_0xe576('0x4a')]({'where':{'id':_0x576b4f['params']['id']}})['then'](handleEntityNotFound(_0x495987,null))[_0xe576('0x21')](function(_0x1c0ed4){if(_0x1c0ed4){_0x576b4f[_0xe576('0x44')][_0xe576('0x59')]=_0x1c0ed4['id'];return db[_0xe576('0x5a')]['create'](_0x576b4f[_0xe576('0x44')]);}})[_0xe576('0x21')](respondWithResult(_0x495987,null))[_0xe576('0x3f')](handleError(_0x495987,null));};exports[_0xe576('0x5b')]=function(_0x14f7d0,_0xd013ea,_0x5a0015){var _0x193946={};var _0x5c9074={};var _0x258e06;var _0x4eb6c7;return db[_0xe576('0x3b')][_0xe576('0x53')]({'where':{'id':_0x14f7d0[_0xe576('0x4e')]['id']}})[_0xe576('0x21')](handleEntityNotFound(_0xd013ea,null))[_0xe576('0x21')](function(_0xaa85c7){if(_0xaa85c7){_0x258e06=_0xaa85c7;_0x5c9074[_0xe576('0x2c')]=_[_0xe576('0x2e')](db[_0xe576('0x5a')][_0xe576('0x41')]);_0x5c9074[_0xe576('0x2d')]=_[_0xe576('0x2e')](_0x14f7d0[_0xe576('0x2d')]);_0x5c9074['filters']=_[_0xe576('0x31')](_0x5c9074['model'],_0x5c9074['query']);_0x193946[_0xe576('0x30')]=_[_0xe576('0x31')](_0x5c9074[_0xe576('0x2c')],qs[_0xe576('0x42')](_0x14f7d0[_0xe576('0x2d')]['fields']));_0x193946[_0xe576('0x30')]=_0x193946[_0xe576('0x30')]['length']?_0x193946[_0xe576('0x30')]:_0x5c9074[_0xe576('0x2c')];_0x193946[_0xe576('0x34')]=qs[_0xe576('0x35')](_0x14f7d0[_0xe576('0x2d')]['sort']);_0x193946[_0xe576('0x36')]=qs[_0xe576('0x2f')](_[_0xe576('0x37')](_0x14f7d0[_0xe576('0x2d')],_0x5c9074['filters']));if(_0x14f7d0[_0xe576('0x2d')]['filter']){_0x193946[_0xe576('0x36')]=_['merge'](_0x193946['where'],{'$or':_[_0xe576('0x28')](_0x193946[_0xe576('0x30')],function(_0x1795d8){var _0x2d3b79={};_0x2d3b79[_0x1795d8]={'$like':'%'+_0x14f7d0[_0xe576('0x2d')][_0xe576('0x38')]+'%'};return _0x2d3b79;})});}_0x193946=_['merge']({},_0x193946,_0x14f7d0[_0xe576('0x54')]);return _0x258e06['getActions'](_0x193946);}})[_0xe576('0x21')](function(_0x1c1f09){if(_0x1c1f09){_0x4eb6c7=_0x1c1f09[_0xe576('0x32')];if(!_0x14f7d0[_0xe576('0x2d')][_0xe576('0x57')](_0xe576('0x33'))){_0x193946[_0xe576('0x1b')]=qs[_0xe576('0x1b')](_0x14f7d0[_0xe576('0x2d')][_0xe576('0x1b')]);_0x193946[_0xe576('0x1a')]=qs[_0xe576('0x1a')](_0x14f7d0[_0xe576('0x2d')][_0xe576('0x1a')]);}return _0x258e06[_0xe576('0x5b')](_0x193946);}})[_0xe576('0x21')](function(_0x16d025){if(_0x16d025){return _0x16d025?{'count':_0x4eb6c7,'rows':_0x16d025}:null;}})[_0xe576('0x21')](respondWithResult(_0xd013ea,null))[_0xe576('0x3f')](handleError(_0xd013ea,null));}; \ No newline at end of file +var _0x444b=['hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','fields','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','nolimit','getAnyConditions','order','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','map','Trigger','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length'];(function(_0x5b954b,_0x46a10d){var _0x1f9bbf=function(_0x2c4a95){while(--_0x2c4a95){_0x5b954b['push'](_0x5b954b['shift']());}};_0x1f9bbf(++_0x46a10d);}(_0x444b,0x84));var _0xb444=function(_0x3cf1e8,_0xb6402b){_0x3cf1e8=_0x3cf1e8-0x0;var _0x180e25=_0x444b[_0x3cf1e8];return _0x180e25;};'use strict';var pdf=require(_0xb444('0x0'));var emlformat=require(_0xb444('0x1'));var rimraf=require(_0xb444('0x2'));var zipdir=require(_0xb444('0x3'));var jsonpatch=require(_0xb444('0x4'));var rp=require('request-promise');var moment=require(_0xb444('0x5'));var BPromise=require(_0xb444('0x6'));var Mustache=require(_0xb444('0x7'));var util=require(_0xb444('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xb444('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb444('0xa'));var squel=require(_0xb444('0xb'));var crypto=require('crypto');var jsforce=require(_0xb444('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb444('0xd'));var Redis=require('ioredis');var authService=require(_0xb444('0xe'));var qs=require(_0xb444('0xf'));var as=require(_0xb444('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb444('0x11'))(_0xb444('0x12'));var utils=require(_0xb444('0x13'));var config=require(_0xb444('0x14'));var db=require(_0xb444('0x15'))['db'];function respondWithStatusCode(_0x5cc2f1,_0x1d3b18){_0x1d3b18=_0x1d3b18||0xcc;return function(_0x3c4902){if(_0x3c4902){return _0x5cc2f1[_0xb444('0x16')](_0x1d3b18);}return _0x5cc2f1[_0xb444('0x17')](_0x1d3b18)[_0xb444('0x18')]();};}function respondWithResult(_0x4945f3,_0x28217a){_0x28217a=_0x28217a||0xc8;return function(_0x7d4d5b){if(_0x7d4d5b){return _0x4945f3[_0xb444('0x17')](_0x28217a)['json'](_0x7d4d5b);}};}function respondWithFilteredResult(_0xe361bf,_0x3900a3){return function(_0x218a24){if(_0x218a24){var _0x2e97c3=_0x218a24[_0xb444('0x19')],_0x195874=_0x3900a3[_0xb444('0x1a')],_0x431357=_0x3900a3[_0xb444('0x1a')]+_0x3900a3[_0xb444('0x1b')],_0x16675e;if(_0x431357>=_0x2e97c3){_0x431357=_0x2e97c3;_0x16675e=0xc8;}else{_0x16675e=0xce;}_0xe361bf[_0xb444('0x17')](_0x16675e);return _0xe361bf[_0xb444('0x1c')](_0xb444('0x1d'),_0x195874+'-'+_0x431357+'/'+_0x2e97c3)[_0xb444('0x1e')](_0x218a24);}return null;};}function patchUpdates(_0x14858a){return function(_0x58785e){try{jsonpatch[_0xb444('0x1f')](_0x58785e,_0x14858a,!![]);}catch(_0x4c77af){return BPromise['reject'](_0x4c77af);}return _0x58785e[_0xb444('0x20')]();};}function saveUpdates(_0x522e21,_0x56d2ab){return function(_0x1831ab){if(_0x1831ab){return _0x1831ab[_0xb444('0x21')](_0x522e21)[_0xb444('0x22')](function(_0x4ffe21){return _0x4ffe21;});}return null;};}function removeEntity(_0x4fcd8e,_0x4ba413){return function(_0x1df48e){if(_0x1df48e){return _0x1df48e[_0xb444('0x23')]()[_0xb444('0x22')](function(){var _0xd88dbe=_0x1df48e[_0xb444('0x24')]({'plain':!![]});var _0x260ec2=_0xb444('0x25');return db[_0xb444('0x26')]['destroy']({'where':{'type':_0x260ec2,'resourceId':_0xd88dbe['id']}})[_0xb444('0x22')](function(){return _0x1df48e;});})[_0xb444('0x22')](function(){_0x4fcd8e[_0xb444('0x17')](0xcc)[_0xb444('0x18')]();});}};}function handleEntityNotFound(_0x46b1fa,_0x3f26ac){return function(_0x1a1166){if(!_0x1a1166){_0x46b1fa[_0xb444('0x16')](0x194);}return _0x1a1166;};}function handleError(_0xadecae,_0x5dec64){_0x5dec64=_0x5dec64||0x1f4;return function(_0x17b8ea){logger[_0xb444('0x27')](_0x17b8ea[_0xb444('0x28')]);if(_0x17b8ea[_0xb444('0x29')]){delete _0x17b8ea[_0xb444('0x29')];}_0xadecae[_0xb444('0x17')](_0x5dec64)['send'](_0x17b8ea);};}exports['index']=function(_0x3ee37c,_0x3bc671){var _0x244b4f={},_0x126eb3={},_0x2dc5d8={'count':0x0,'rows':[]};var _0x40c900=_[_0xb444('0x2a')](db[_0xb444('0x2b')][_0xb444('0x2c')],function(_0x5bbb50){return{'name':_0x5bbb50[_0xb444('0x2d')],'type':_0x5bbb50[_0xb444('0x2e')]['key']};});_0x126eb3[_0xb444('0x2f')]=_[_0xb444('0x2a')](_0x40c900,_0xb444('0x29'));_0x126eb3['query']=_[_0xb444('0x30')](_0x3ee37c[_0xb444('0x31')]);_0x126eb3[_0xb444('0x32')]=_[_0xb444('0x33')](_0x126eb3['model'],_0x126eb3[_0xb444('0x31')]);_0x244b4f[_0xb444('0x34')]=_[_0xb444('0x33')](_0x126eb3[_0xb444('0x2f')],qs['fields'](_0x3ee37c[_0xb444('0x31')]['fields']));_0x244b4f['attributes']=_0x244b4f['attributes'][_0xb444('0x35')]?_0x244b4f[_0xb444('0x34')]:_0x126eb3['model'];if(!_0x3ee37c['query'][_0xb444('0x36')]('nolimit')){_0x244b4f['limit']=qs['limit'](_0x3ee37c[_0xb444('0x31')][_0xb444('0x1b')]);_0x244b4f[_0xb444('0x1a')]=qs[_0xb444('0x1a')](_0x3ee37c[_0xb444('0x31')][_0xb444('0x1a')]);}_0x244b4f['order']=qs[_0xb444('0x37')](_0x3ee37c['query'][_0xb444('0x37')]);_0x244b4f[_0xb444('0x38')]=qs['filters'](_['pick'](_0x3ee37c[_0xb444('0x31')],_0x126eb3[_0xb444('0x32')]),_0x40c900);if(_0x3ee37c['query']['filter']){_0x244b4f['where']=_[_0xb444('0x39')](_0x244b4f[_0xb444('0x38')],{'$or':_[_0xb444('0x2a')](_0x40c900,function(_0x163611){if(_0x163611[_0xb444('0x2e')]!==_0xb444('0x3a')){var _0x46154e={};_0x46154e[_0x163611[_0xb444('0x29')]]={'$like':'%'+_0x3ee37c[_0xb444('0x31')][_0xb444('0x3b')]+'%'};return _0x46154e;}})});}_0x244b4f=_[_0xb444('0x39')]({},_0x244b4f,_0x3ee37c[_0xb444('0x3c')]);var _0x32b7e2={'where':_0x244b4f[_0xb444('0x38')]};return db['Trigger'][_0xb444('0x19')](_0x32b7e2)[_0xb444('0x22')](function(_0x4fa160){_0x2dc5d8[_0xb444('0x19')]=_0x4fa160;if(_0x3ee37c[_0xb444('0x31')][_0xb444('0x3d')]){_0x244b4f['include']=[{'all':!![]}];}return db[_0xb444('0x2b')][_0xb444('0x3e')](_0x244b4f);})[_0xb444('0x22')](function(_0x132ab4){_0x2dc5d8[_0xb444('0x3f')]=_0x132ab4;return _0x2dc5d8;})[_0xb444('0x22')](respondWithFilteredResult(_0x3bc671,_0x244b4f))[_0xb444('0x40')](handleError(_0x3bc671,null));};exports[_0xb444('0x41')]=function(_0x15926c,_0x2e98a7){var _0x59ab96={'raw':![],'where':{'id':_0x15926c[_0xb444('0x42')]['id']}},_0x5b3e97={};_0x5b3e97[_0xb444('0x2f')]=_[_0xb444('0x30')](db[_0xb444('0x2b')][_0xb444('0x2c')]);_0x5b3e97[_0xb444('0x31')]=_['keys'](_0x15926c[_0xb444('0x31')]);_0x5b3e97['filters']=_[_0xb444('0x33')](_0x5b3e97[_0xb444('0x2f')],_0x5b3e97['query']);_0x59ab96[_0xb444('0x34')]=_['intersection'](_0x5b3e97[_0xb444('0x2f')],qs[_0xb444('0x43')](_0x15926c['query']['fields']));_0x59ab96[_0xb444('0x34')]=_0x59ab96[_0xb444('0x34')][_0xb444('0x35')]?_0x59ab96[_0xb444('0x34')]:_0x5b3e97[_0xb444('0x2f')];if(_0x15926c['query'][_0xb444('0x3d')]){_0x59ab96[_0xb444('0x44')]=[{'all':!![]}];}_0x59ab96=_['merge']({},_0x59ab96,_0x15926c[_0xb444('0x3c')]);return db[_0xb444('0x2b')]['find'](_0x59ab96)[_0xb444('0x22')](handleEntityNotFound(_0x2e98a7,null))[_0xb444('0x22')](respondWithResult(_0x2e98a7,null))[_0xb444('0x40')](handleError(_0x2e98a7,null));};exports[_0xb444('0x45')]=function(_0x14c1ac,_0x28574a){return db[_0xb444('0x2b')][_0xb444('0x45')](_0x14c1ac[_0xb444('0x46')],{})[_0xb444('0x22')](function(_0x212ec4){var _0x36580f=_0x14c1ac[_0xb444('0x47')]['get']({'plain':!![]});if(!_0x36580f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36580f[_0xb444('0x48')]===_0xb444('0x47')){var _0x52de62=_0x212ec4[_0xb444('0x24')]({'plain':!![]});var _0x37472d=_0xb444('0x25');return db[_0xb444('0x49')][_0xb444('0x4a')]({'where':{'name':_0x37472d,'userProfileId':_0x36580f[_0xb444('0x4b')]},'raw':!![]})[_0xb444('0x22')](function(_0x1b9948){if(_0x1b9948&&_0x1b9948[_0xb444('0x4c')]===0x0){return db[_0xb444('0x26')][_0xb444('0x45')]({'name':_0x52de62[_0xb444('0x29')],'resourceId':_0x52de62['id'],'type':_0x1b9948[_0xb444('0x29')],'sectionId':_0x1b9948['id']},{})[_0xb444('0x22')](function(){return _0x212ec4;});}else{return _0x212ec4;}})['catch'](function(_0x385522){logger[_0xb444('0x27')](_0xb444('0x4d'),_0x385522);throw _0x385522;});}return _0x212ec4;})[_0xb444('0x22')](respondWithResult(_0x28574a,0xc9))[_0xb444('0x40')](handleError(_0x28574a,null));};exports[_0xb444('0x21')]=function(_0x10afae,_0x2a69ab){if(_0x10afae[_0xb444('0x46')]['id']){delete _0x10afae[_0xb444('0x46')]['id'];}return db[_0xb444('0x2b')]['find']({'where':{'id':_0x10afae[_0xb444('0x42')]['id']}})['then'](handleEntityNotFound(_0x2a69ab,null))[_0xb444('0x22')](saveUpdates(_0x10afae['body'],null))[_0xb444('0x22')](respondWithResult(_0x2a69ab,null))[_0xb444('0x40')](handleError(_0x2a69ab,null));};exports[_0xb444('0x23')]=function(_0x51c1b4,_0x4e2fe2){return db['Trigger'][_0xb444('0x4a')]({'where':{'id':_0x51c1b4[_0xb444('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e2fe2,null))[_0xb444('0x22')](removeEntity(_0x4e2fe2,null))[_0xb444('0x40')](handleError(_0x4e2fe2,null));};exports[_0xb444('0x4e')]=function(_0x2f4462,_0x33fbc5,_0x59f519){if(_0x2f4462[_0xb444('0x46')]['id']){delete _0x2f4462['body']['id'];}return db['Trigger'][_0xb444('0x4a')]({'where':{'id':_0x2f4462[_0xb444('0x42')]['id']}})[_0xb444('0x22')](handleEntityNotFound(_0x33fbc5,null))[_0xb444('0x22')](function(_0xca6a22){if(_0xca6a22){_0x2f4462[_0xb444('0x46')][_0xb444('0x4f')]=_0xca6a22['id'];return db[_0xb444('0x50')][_0xb444('0x45')](_0x2f4462['body']);}})[_0xb444('0x22')](respondWithResult(_0x33fbc5,null))[_0xb444('0x40')](handleError(_0x33fbc5,null));};exports[_0xb444('0x51')]=function(_0x346db5,_0xf0ea65,_0x13f12a){if(_0x346db5[_0xb444('0x46')]['id']){delete _0x346db5['body']['id'];}return db[_0xb444('0x2b')][_0xb444('0x4a')]({'where':{'id':_0x346db5[_0xb444('0x42')]['id']}})[_0xb444('0x22')](handleEntityNotFound(_0xf0ea65,null))[_0xb444('0x22')](function(_0x47b854){if(_0x47b854){_0x346db5[_0xb444('0x46')][_0xb444('0x52')]=_0x47b854['id'];return db[_0xb444('0x50')][_0xb444('0x45')](_0x346db5[_0xb444('0x46')]);}})[_0xb444('0x22')](respondWithResult(_0xf0ea65,null))[_0xb444('0x40')](handleError(_0xf0ea65,null));};exports[_0xb444('0x53')]=function(_0x2b7fd3,_0x12e494,_0x4c93c9){var _0x3a2855={};var _0x107a20={};var _0x3954aa;var _0x3ac05e;return db[_0xb444('0x2b')][_0xb444('0x54')]({'where':{'id':_0x2b7fd3[_0xb444('0x42')]['id']}})['then'](handleEntityNotFound(_0x12e494,null))['then'](function(_0xca376b){if(_0xca376b){_0x3954aa=_0xca376b;_0x107a20['model']=_[_0xb444('0x30')](db[_0xb444('0x50')][_0xb444('0x2c')]);_0x107a20['query']=_['keys'](_0x2b7fd3[_0xb444('0x31')]);_0x107a20['filters']=_['intersection'](_0x107a20[_0xb444('0x2f')],_0x107a20[_0xb444('0x31')]);_0x3a2855['attributes']=_[_0xb444('0x33')](_0x107a20[_0xb444('0x2f')],qs[_0xb444('0x43')](_0x2b7fd3['query'][_0xb444('0x43')]));_0x3a2855[_0xb444('0x34')]=_0x3a2855[_0xb444('0x34')][_0xb444('0x35')]?_0x3a2855[_0xb444('0x34')]:_0x107a20[_0xb444('0x2f')];_0x3a2855['order']=qs[_0xb444('0x37')](_0x2b7fd3[_0xb444('0x31')][_0xb444('0x37')]);_0x3a2855['where']=qs[_0xb444('0x32')](_[_0xb444('0x55')](_0x2b7fd3[_0xb444('0x31')],_0x107a20[_0xb444('0x32')]));if(_0x2b7fd3[_0xb444('0x31')][_0xb444('0x3b')]){_0x3a2855[_0xb444('0x38')]=_['merge'](_0x3a2855[_0xb444('0x38')],{'$or':_[_0xb444('0x2a')](_0x3a2855[_0xb444('0x34')],function(_0x5399e2){var _0x500129={};_0x500129[_0x5399e2]={'$like':'%'+_0x2b7fd3[_0xb444('0x31')][_0xb444('0x3b')]+'%'};return _0x500129;})});}_0x3a2855=_[_0xb444('0x39')]({},_0x3a2855,_0x2b7fd3[_0xb444('0x3c')]);return _0x3954aa['getAllConditions'](_0x3a2855);}})[_0xb444('0x22')](function(_0x4caf24){if(_0x4caf24){_0x3ac05e=_0x4caf24[_0xb444('0x35')];if(!_0x2b7fd3[_0xb444('0x31')][_0xb444('0x36')](_0xb444('0x56'))){_0x3a2855[_0xb444('0x1b')]=qs[_0xb444('0x1b')](_0x2b7fd3['query'][_0xb444('0x1b')]);_0x3a2855[_0xb444('0x1a')]=qs[_0xb444('0x1a')](_0x2b7fd3[_0xb444('0x31')]['offset']);}return _0x3954aa[_0xb444('0x53')](_0x3a2855);}})[_0xb444('0x22')](function(_0x1a88db){if(_0x1a88db){return _0x1a88db?{'count':_0x3ac05e,'rows':_0x1a88db}:null;}})[_0xb444('0x22')](respondWithResult(_0x12e494,null))[_0xb444('0x40')](handleError(_0x12e494,null));};exports[_0xb444('0x57')]=function(_0xcc2fde,_0x562b73,_0x37a3f6){var _0x185c84={};var _0x5eae6d={};var _0x492430;var _0x2cad3e;return db[_0xb444('0x2b')][_0xb444('0x54')]({'where':{'id':_0xcc2fde['params']['id']}})[_0xb444('0x22')](handleEntityNotFound(_0x562b73,null))[_0xb444('0x22')](function(_0xf671cc){if(_0xf671cc){_0x492430=_0xf671cc;_0x5eae6d[_0xb444('0x2f')]=_[_0xb444('0x30')](db[_0xb444('0x50')][_0xb444('0x2c')]);_0x5eae6d['query']=_['keys'](_0xcc2fde[_0xb444('0x31')]);_0x5eae6d[_0xb444('0x32')]=_[_0xb444('0x33')](_0x5eae6d['model'],_0x5eae6d[_0xb444('0x31')]);_0x185c84[_0xb444('0x34')]=_[_0xb444('0x33')](_0x5eae6d[_0xb444('0x2f')],qs[_0xb444('0x43')](_0xcc2fde[_0xb444('0x31')]['fields']));_0x185c84['attributes']=_0x185c84['attributes'][_0xb444('0x35')]?_0x185c84[_0xb444('0x34')]:_0x5eae6d['model'];_0x185c84[_0xb444('0x58')]=qs['sort'](_0xcc2fde['query'][_0xb444('0x37')]);_0x185c84['where']=qs[_0xb444('0x32')](_[_0xb444('0x55')](_0xcc2fde['query'],_0x5eae6d[_0xb444('0x32')]));if(_0xcc2fde[_0xb444('0x31')][_0xb444('0x3b')]){_0x185c84[_0xb444('0x38')]=_['merge'](_0x185c84[_0xb444('0x38')],{'$or':_[_0xb444('0x2a')](_0x185c84[_0xb444('0x34')],function(_0x544d90){var _0x1afce1={};_0x1afce1[_0x544d90]={'$like':'%'+_0xcc2fde[_0xb444('0x31')]['filter']+'%'};return _0x1afce1;})});}_0x185c84=_[_0xb444('0x39')]({},_0x185c84,_0xcc2fde[_0xb444('0x3c')]);return _0x492430[_0xb444('0x57')](_0x185c84);}})['then'](function(_0x1ee98e){if(_0x1ee98e){_0x2cad3e=_0x1ee98e['length'];if(!_0xcc2fde['query'][_0xb444('0x36')](_0xb444('0x56'))){_0x185c84[_0xb444('0x1b')]=qs[_0xb444('0x1b')](_0xcc2fde['query'][_0xb444('0x1b')]);_0x185c84['offset']=qs[_0xb444('0x1a')](_0xcc2fde['query']['offset']);}return _0x492430[_0xb444('0x57')](_0x185c84);}})['then'](function(_0x5c438b){if(_0x5c438b){return _0x5c438b?{'count':_0x2cad3e,'rows':_0x5c438b}:null;}})[_0xb444('0x22')](respondWithResult(_0x562b73,null))[_0xb444('0x40')](handleError(_0x562b73,null));};exports[_0xb444('0x59')]=function(_0x2d1a0e,_0x46b9a9,_0x17dae9){if(_0x2d1a0e[_0xb444('0x46')]['id']){delete _0x2d1a0e['body']['id'];}return db[_0xb444('0x2b')][_0xb444('0x4a')]({'where':{'id':_0x2d1a0e[_0xb444('0x42')]['id']}})[_0xb444('0x22')](handleEntityNotFound(_0x46b9a9,null))[_0xb444('0x22')](function(_0x6aae7a){if(_0x6aae7a){_0x2d1a0e[_0xb444('0x46')][_0xb444('0x5a')]=_0x6aae7a['id'];return db[_0xb444('0x5b')][_0xb444('0x45')](_0x2d1a0e[_0xb444('0x46')]);}})['then'](respondWithResult(_0x46b9a9,null))['catch'](handleError(_0x46b9a9,null));};exports[_0xb444('0x5c')]=function(_0x22dc8d,_0x5df258,_0x5465eb){var _0x42093b={};var _0x2bef32={};var _0x14c25a;var _0x4e081a;return db[_0xb444('0x2b')]['findOne']({'where':{'id':_0x22dc8d[_0xb444('0x42')]['id']}})['then'](handleEntityNotFound(_0x5df258,null))['then'](function(_0x5d672d){if(_0x5d672d){_0x14c25a=_0x5d672d;_0x2bef32['model']=_[_0xb444('0x30')](db[_0xb444('0x5b')][_0xb444('0x2c')]);_0x2bef32['query']=_['keys'](_0x22dc8d['query']);_0x2bef32['filters']=_[_0xb444('0x33')](_0x2bef32['model'],_0x2bef32[_0xb444('0x31')]);_0x42093b[_0xb444('0x34')]=_['intersection'](_0x2bef32[_0xb444('0x2f')],qs['fields'](_0x22dc8d['query'][_0xb444('0x43')]));_0x42093b[_0xb444('0x34')]=_0x42093b[_0xb444('0x34')]['length']?_0x42093b[_0xb444('0x34')]:_0x2bef32[_0xb444('0x2f')];_0x42093b[_0xb444('0x58')]=qs[_0xb444('0x37')](_0x22dc8d[_0xb444('0x31')]['sort']);_0x42093b[_0xb444('0x38')]=qs[_0xb444('0x32')](_[_0xb444('0x55')](_0x22dc8d['query'],_0x2bef32[_0xb444('0x32')]));if(_0x22dc8d[_0xb444('0x31')]['filter']){_0x42093b[_0xb444('0x38')]=_['merge'](_0x42093b[_0xb444('0x38')],{'$or':_[_0xb444('0x2a')](_0x42093b['attributes'],function(_0x3b1d9e){var _0x466198={};_0x466198[_0x3b1d9e]={'$like':'%'+_0x22dc8d[_0xb444('0x31')][_0xb444('0x3b')]+'%'};return _0x466198;})});}_0x42093b=_[_0xb444('0x39')]({},_0x42093b,_0x22dc8d[_0xb444('0x3c')]);return _0x14c25a[_0xb444('0x5c')](_0x42093b);}})['then'](function(_0x9fa7d){if(_0x9fa7d){_0x4e081a=_0x9fa7d[_0xb444('0x35')];if(!_0x22dc8d[_0xb444('0x31')][_0xb444('0x36')](_0xb444('0x56'))){_0x42093b[_0xb444('0x1b')]=qs[_0xb444('0x1b')](_0x22dc8d[_0xb444('0x31')]['limit']);_0x42093b[_0xb444('0x1a')]=qs['offset'](_0x22dc8d[_0xb444('0x31')][_0xb444('0x1a')]);}return _0x14c25a[_0xb444('0x5c')](_0x42093b);}})[_0xb444('0x22')](function(_0x41dd59){if(_0x41dd59){return _0x41dd59?{'count':_0x4e081a,'rows':_0x41dd59}:null;}})[_0xb444('0x22')](respondWithResult(_0x5df258,null))[_0xb444('0x40')](handleError(_0x5df258,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 33e96c9..f9ee9df 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 _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x58250d,_0x1b29eb){var _0x5676bb=function(_0xce2b42){while(--_0xce2b42){_0x58250d['push'](_0x58250d['shift']());}};_0x5676bb(++_0x1b29eb);}(_0x2ef3,0xba));var _0x32ef=function(_0x251f70,_0x3fb788){_0x251f70=_0x251f70-0x0;var _0x9a7a=_0x2ef3[_0x251f70];return _0x9a7a;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','tools_triggers'];(function(_0x46ef7f,_0x198faf){var _0x38ce3e=function(_0x323c3e){while(--_0x323c3e){_0x46ef7f['push'](_0x46ef7f['shift']());}};_0x38ce3e(++_0x198faf);}(_0x1261,0x144));var _0x1126=function(_0x253b13,_0x247a2f){_0x253b13=_0x253b13-0x0;var _0x396bcc=_0x1261[_0x253b13];return _0x396bcc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('Trigger',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 4208cbb..69a28ea 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 _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrigger','find','lodash','util','randomstring','ioredis'];(function(_0x6aeb0b,_0x4c5f87){var _0x25576b=function(_0x292d55){while(--_0x292d55){_0x6aeb0b['push'](_0x6aeb0b['shift']());}};_0x25576b(++_0x4c5f87);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('Trigger,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')]({'raw':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x17')]||null:null,'attributes':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x18')]||null:null,'limit':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x19')]||null:null,'include':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x15f5d1){return{'model':db[_0x15f5d1[_0x4d82('0x1c')]],'as':_0x15f5d1['as'],'attributes':_0x15f5d1[_0x4d82('0x18')],'include':_0x15f5d1[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x15f5d1[_0x4d82('0x1a')],function(_0x395efc){return{'model':db[_0x395efc[_0x4d82('0x1c')]],'as':_0x395efc['as'],'attributes':_0x395efc[_0x4d82('0x18')],'include':_0x395efc[_0x4d82('0x1a')]?_['map'](_0x395efc['include'],function(_0x3dcb0f){return{'model':db[_0x3dcb0f[_0x4d82('0x1c')]],'as':_0x3dcb0f['as'],'attributes':_0x3dcb0f[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5cbd7e){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1e')](_0x4d82('0x12'),_0x258c59,JSON['stringify'](_0x5cbd7e));_0x2f2127(_0x5cbd7e);})[_0x4d82('0x11')](function(_0x4a7444){logger['error']('GetTrigger',_0x4a7444['message'],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x4a7444[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1f')]=function(_0x52e320){var _0x713c56=this;return new Promise(function(_0x37cdc4,_0x5cf3e6){return db['Trigger'][_0x4d82('0x20')]({'raw':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x52e320['options']?_0x52e320[_0x4d82('0x15')]['where']||null:null,'attributes':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')]['attributes']||null:null,'include':_0x52e320['options']?_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x420b28){return{'model':db[_0x420b28[_0x4d82('0x1c')]],'as':_0x420b28['as'],'attributes':_0x420b28[_0x4d82('0x18')],'include':_0x420b28[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x420b28['include'],function(_0x382f43){return{'model':db[_0x382f43[_0x4d82('0x1c')]],'as':_0x382f43['as'],'attributes':_0x382f43[_0x4d82('0x18')],'include':_0x382f43['include']?_[_0x4d82('0x1b')](_0x382f43[_0x4d82('0x1a')],function(_0x57826a){return{'model':db[_0x57826a[_0x4d82('0x1c')]],'as':_0x57826a['as'],'attributes':_0x57826a[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5d0296){logger[_0x4d82('0xa')](_0x4d82('0x1f'),_0x52e320);logger['debug'](_0x4d82('0x1f'),_0x52e320,JSON['stringify'](_0x5d0296));_0x37cdc4(_0x5d0296);})[_0x4d82('0x11')](function(_0x2c21c9){logger['error'](_0x4d82('0x1f'),_0x2c21c9['message'],_0x52e320);_0x5cf3e6(_0x713c56[_0x4d82('0xf')](0x1f4,_0x2c21c9['message']));});});}; \ No newline at end of file +var _0x1339=['stringify','error','code','message','result','catch','Trigger','findAll','options','attributes','map','include','model','GetTrigger','debug','raw','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x1314d6,_0x214f2f){var _0x28b527=function(_0x1c6f76){while(--_0x1c6f76){_0x1314d6['push'](_0x1314d6['shift']());}};_0x28b527(++_0x214f2f);}(_0x1339,0x1ed));var _0x9133=function(_0x5d3bf0,_0x4b7af4){_0x5d3bf0=_0x5d3bf0-0x0;var _0x19bcb4=_0x1339[_0x5d3bf0];return _0x19bcb4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('Trigger,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['GetTrigger']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')]({'raw':_0x1f3484['options']?_0x1f3484[_0x9133('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options']['where']||null:null,'attributes':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]||null:null,'limit':_0x1f3484['options']?_0x1f3484['options']['limit']||null:null,'include':_0x1f3484[_0x9133('0x19')]?_0x1f3484[_0x9133('0x19')]['include']?_[_0x9133('0x1b')](_0x1f3484[_0x9133('0x19')][_0x9133('0x1c')],function(_0x26190c){return{'model':db[_0x26190c['model']],'as':_0x26190c['as'],'attributes':_0x26190c[_0x9133('0x1a')],'include':_0x26190c['include']?_[_0x9133('0x1b')](_0x26190c[_0x9133('0x1c')],function(_0x3f278d){return{'model':db[_0x3f278d[_0x9133('0x1d')]],'as':_0x3f278d['as'],'attributes':_0x3f278d[_0x9133('0x1a')],'include':_0x3f278d[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x3f278d[_0x9133('0x1c')],function(_0x1b6b3e){return{'model':db[_0x1b6b3e[_0x9133('0x1d')]],'as':_0x1b6b3e['as'],'attributes':_0x1b6b3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x477bf1){logger[_0x9133('0xd')](_0x9133('0x1e'),_0x1f3484);logger[_0x9133('0x1f')]('GetTrigger',_0x1f3484,JSON['stringify'](_0x477bf1));_0x3c48ef(_0x477bf1);})[_0x9133('0x16')](function(_0x45966d){logger[_0x9133('0x12')](_0x9133('0x1e'),_0x45966d[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x45966d['message']));});});};exports['ShowTrigger']=function(_0x5a27c1){var _0x1ad222=this;return new Promise(function(_0x4a4a8e,_0x43b5f3){return db[_0x9133('0x17')]['find']({'raw':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1['options'][_0x9133('0x20')]===undefined?!![]:![]:!![],'where':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')]['where']||null:null,'attributes':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1a')]||null:null,'include':_0x5a27c1['options']?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x5a27c1['options'][_0x9133('0x1c')],function(_0x20da68){return{'model':db[_0x20da68[_0x9133('0x1d')]],'as':_0x20da68['as'],'attributes':_0x20da68[_0x9133('0x1a')],'include':_0x20da68['include']?_[_0x9133('0x1b')](_0x20da68[_0x9133('0x1c')],function(_0x56719e){return{'model':db[_0x56719e[_0x9133('0x1d')]],'as':_0x56719e['as'],'attributes':_0x56719e[_0x9133('0x1a')],'include':_0x56719e[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x56719e[_0x9133('0x1c')],function(_0x2db377){return{'model':db[_0x2db377[_0x9133('0x1d')]],'as':_0x2db377['as'],'attributes':_0x2db377[_0x9133('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9133('0xc')](function(_0x335217){logger[_0x9133('0xd')]('ShowTrigger',_0x5a27c1);logger[_0x9133('0x1f')](_0x9133('0x21'),_0x5a27c1,JSON['stringify'](_0x335217));_0x4a4a8e(_0x335217);})[_0x9133('0x16')](function(_0x3a2d1f){logger[_0x9133('0x12')](_0x9133('0x21'),_0x3a2d1f[_0x9133('0x14')],_0x5a27c1);_0x43b5f3(_0x1ad222[_0x9133('0x12')](0x1f4,_0x3a2d1f['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 649ea75..002b4e4 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 _0x81bd=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','post','isAuthenticated','clone','create'];(function(_0x22b1ce,_0x42511b){var _0x2cca27=function(_0x240eba){while(--_0x240eba){_0x22b1ce['push'](_0x22b1ce['shift']());}};_0x2cca27(++_0x42511b);}(_0x81bd,0x7c));var _0xd81b=function(_0x56b034,_0xb96f9b){_0x56b034=_0x56b034-0x0;var _0x25f338=_0x81bd[_0x56b034];return _0x25f338;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd81b('0xc')]('/:id/clone',auth[_0xd81b('0xd')](),controller[_0xd81b('0xe')]);router[_0xd81b('0xc')]('/',auth[_0xd81b('0xd')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')](_0xd81b('0xb'),auth[_0xd81b('0xd')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xb'),auth[_0xd81b('0xd')](),controller[_0xd81b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['show','clone','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x7148b6,_0xa61534){var _0x111019=function(_0x452d96){while(--_0x452d96){_0x7148b6['push'](_0x7148b6['shift']());}};_0x111019(++_0xa61534);}(_0xbd50,0x196));var _0x0bd5=function(_0x347dc0,_0x3aed2b){_0x347dc0=_0x347dc0-0x0;var _0x5416e3=_0xbd50[_0x347dc0];return _0x5416e3;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['post']('/:id/clone',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bd5('0xf')]);router[_0x0bd5('0x10')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['delete'](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 138c280..e17ffb8 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 _0xa8f0=['nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','insecure','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','sequelize','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia'];(function(_0x26fd21,_0x2c3b26){var _0x67e91d=function(_0x1b2fc3){while(--_0x1b2fc3){_0x26fd21['push'](_0x26fd21['shift']());}};_0x67e91d(++_0x2c3b26);}(_0xa8f0,0x72));var _0x0a8f=function(_0x3a10b6,_0x3181f0){_0x3a10b6=_0x3a10b6-0x0;var _0x463dc3=_0xa8f0[_0x3a10b6];return _0x463dc3;};'use strict';var Sequelize=require(_0x0a8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'unique':_0x0a8f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a8f('0x3'),'user',_0x0a8f('0x4')),'allowNull':![],'defaultValue':_0x0a8f('0x3')},'context':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'defaultValue':_0x0a8f('0x5')},'callingpres':{'type':Sequelize[_0x0a8f('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x0a8f('0x7'),'ALLOWED',_0x0a8f('0x8'),_0x0a8f('0x9'),_0x0a8f('0xa'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x0a8f('0x1')]},'secret':{'type':Sequelize[_0x0a8f('0x1')]},'md5secret':{'type':Sequelize[_0x0a8f('0x1')]},'remotesecret':{'type':Sequelize[_0x0a8f('0x1')]},'transport':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0xb'),'set':function(_0x4f4dab){this[_0x0a8f('0xc')](_0x0a8f('0xd'),_0x4f4dab?_0x4f4dab[_0x0a8f('0xe')](','):null);},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0xd'))?this['getDataValue'](_0x0a8f('0xd'))[_0x0a8f('0x10')](','):null;},'comment':_0x0a8f('0x11')},'dtmfmode':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x12'),'info',_0x0a8f('0x13'),_0x0a8f('0x14'),_0x0a8f('0x15')),'defaultValue':_0x0a8f('0x12')},'directmedia':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x16'),_0x0a8f('0x17'),_0x0a8f('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0x1a'),'set':function(_0x1f16b6){this['setDataValue'](_0x0a8f('0x1b'),_0x1f16b6?_0x1f16b6['join'](','):null);},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0x1b'))?this[_0x0a8f('0xf')](_0x0a8f('0x1b'))[_0x0a8f('0x10')](','):null;},'comment':_0x0a8f('0x1c')},'callgroup':{'type':Sequelize[_0x0a8f('0x1')]},'namedcallgroup':{'type':Sequelize[_0x0a8f('0x1')]},'pickupgroup':{'type':Sequelize[_0x0a8f('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x0a8f('0x1')]},'language':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x0a8f('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x27d2c2){this[_0x0a8f('0xc')](_0x0a8f('0x1d'),_0x27d2c2?_0x27d2c2[_0x0a8f('0xe')](';'):_0x0a8f('0x1e'));},'get':function(){return this[_0x0a8f('0xf')](_0x0a8f('0x1d'))?this[_0x0a8f('0xf')]('allow')[_0x0a8f('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x2f22d5){this['setDataValue'](_0x0a8f('0x1f'),_0x2f22d5?_0x2f22d5[_0x0a8f('0xe')](','):null);},'get':function(){return this[_0x0a8f('0xf')]('insecure')?this[_0x0a8f('0xf')]('insecure')[_0x0a8f('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x20'))},'promiscredir':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'accountcode':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x0a8f('0x1')]},'callcounter':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':_0x0a8f('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0a8f('0x1')]},'videosupport':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'mailbox':{'type':Sequelize[_0x0a8f('0x1')]},'session_timers':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x23'),_0x0a8f('0x24'),_0x0a8f('0x25'))},'session_expires':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x26'),_0x0a8f('0x27')),'defaultValue':_0x0a8f('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x0a8f('0x1')]},'regexten':{'type':Sequelize[_0x0a8f('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x0a8f('0x1')]},'port':{'type':Sequelize[_0x0a8f('0x21')](0x5)},'qualify':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no'),'defaultValue':_0x0a8f('0x19')},'keepalive':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a8f('0x1')]},'callbackextension':{'type':Sequelize[_0x0a8f('0x1')]},'timert1':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x0a8f('0x1')]},'contactdeny':{'type':Sequelize[_0x0a8f('0x1')]},'contactacl':{'type':Sequelize[_0x0a8f('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x0a8f('0x1')]},'maxforwards':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no')},'icesupport':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x0a8f('0x6')]('yes','no',_0x0a8f('0x29'),_0x0a8f('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x0a8f('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0a8f('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x0a8f('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x0a8f('0x1')]},'dtlscapath':{'type':Sequelize[_0x0a8f('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x0a8f('0x2b'),'passive',_0x0a8f('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a8f('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0a8f('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x0a8f('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0a8f('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0a8f('0x19'),'no')},'vmexten':{'type':Sequelize[_0x0a8f('0x1')]},'mohinterpret':{'type':Sequelize[_0x0a8f('0x1')]},'mohsuggest':{'type':Sequelize[_0x0a8f('0x1')]},'parkinglot':{'type':Sequelize[_0x0a8f('0x1')]},'description':{'type':Sequelize[_0x0a8f('0x1')]},'host':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':_0x0a8f('0x2d')},'canreinvite':{'type':Sequelize[_0x0a8f('0x6')](_0x0a8f('0x19'),'no',_0x0a8f('0x16'),_0x0a8f('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0a8f('0x1')]},'otherFields':{'type':Sequelize[_0x0a8f('0x1')]},'active':{'type':Sequelize[_0x0a8f('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0a8f('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1c5d=['PROHIB_PASSED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','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]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','exports','user','peer','friend','STRING','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x30f8b6,_0x556904){var _0x272f96=function(_0x518a13){while(--_0x518a13){_0x30f8b6['push'](_0x30f8b6['shift']());}};_0x272f96(++_0x556904);}(_0x1c5d,0x85));var _0xd1c5=function(_0x16aa3a,_0x55134b){_0x16aa3a=_0x16aa3a-0x0;var _0x2f5ac0=_0x1c5d[_0x16aa3a];return _0x2f5ac0;};'use strict';var Sequelize=require('sequelize');module[_0xd1c5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xd1c5('0x1'),_0xd1c5('0x2')),'allowNull':![],'defaultValue':_0xd1c5('0x3')},'context':{'type':Sequelize[_0xd1c5('0x4')],'allowNull':![],'defaultValue':_0xd1c5('0x5')},'callingpres':{'type':Sequelize[_0xd1c5('0x6')]('ALLOWED_NOT_SCREENED',_0xd1c5('0x7'),_0xd1c5('0x8'),_0xd1c5('0x9'),_0xd1c5('0xa'),_0xd1c5('0xb'),'PROHIB_FAILED_SCREEN',_0xd1c5('0xc'))},'deny':{'type':Sequelize[_0xd1c5('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xd1c5('0x4')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd1c5('0x4')]},'transport':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':'udp','set':function(_0x911e0e){this[_0xd1c5('0xd')]('transport',_0x911e0e?_0x911e0e[_0xd1c5('0xe')](','):null);},'get':function(){return this[_0xd1c5('0xf')](_0xd1c5('0x10'))?this[_0xd1c5('0xf')](_0xd1c5('0x10'))[_0xd1c5('0x11')](','):null;},'comment':_0xd1c5('0x12')},'dtmfmode':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x13'),_0xd1c5('0x14'),'shortinfo',_0xd1c5('0x15'),_0xd1c5('0x16')),'defaultValue':_0xd1c5('0x13')},'directmedia':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no',_0xd1c5('0x18'),_0xd1c5('0x19'),_0xd1c5('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd1c5('0x4')]},'nat':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':_0xd1c5('0x1b'),'set':function(_0x397139){this[_0xd1c5('0xd')](_0xd1c5('0x1c'),_0x397139?_0x397139[_0xd1c5('0xe')](','):null);},'get':function(){return this[_0xd1c5('0xf')](_0xd1c5('0x1c'))?this[_0xd1c5('0xf')](_0xd1c5('0x1c'))[_0xd1c5('0x11')](','):null;},'comment':_0xd1c5('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xd1c5('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xd1c5('0x4')]},'language':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd1c5('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':_0xd1c5('0x1e')},'allow':{'type':Sequelize[_0xd1c5('0x4')],'allowNull':![],'defaultValue':_0xd1c5('0x1f'),'set':function(_0x135ff6){this[_0xd1c5('0xd')](_0xd1c5('0x20'),_0x135ff6?_0x135ff6['join'](';'):_0xd1c5('0x1f'));},'get':function(){return this[_0xd1c5('0xf')](_0xd1c5('0x20'))?this[_0xd1c5('0xf')]('allow')[_0xd1c5('0x11')](';'):null;},'comment':_0xd1c5('0x21')},'autoframing':{'type':Sequelize[_0xd1c5('0x6')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xd1c5('0x22'),'set':function(_0x328ca3){this[_0xd1c5('0xd')](_0xd1c5('0x23'),_0x328ca3?_0x328ca3[_0xd1c5('0xe')](','):null);},'get':function(){return this[_0xd1c5('0xf')](_0xd1c5('0x23'))?this['getDataValue'](_0xd1c5('0x23'))[_0xd1c5('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no',_0xd1c5('0x24'))},'promiscredir':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'accountcode':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'setvar':{'type':Sequelize[_0xd1c5('0x4')]},'callerid':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':_0xd1c5('0x26')},'amaflags':{'type':Sequelize[_0xd1c5('0x4')]},'callcounter':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xd1c5('0x4')]},'template':{'type':Sequelize[_0xd1c5('0x4')]},'videosupport':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xd1c5('0x6')]('accept',_0xd1c5('0x27'),'originate')},'session_expires':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd1c5('0x28'),_0xd1c5('0x29')),'defaultValue':_0xd1c5('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xd1c5('0x4')]},'regexten':{'type':Sequelize[_0xd1c5('0x4')]},'fromdomain':{'type':Sequelize[_0xd1c5('0x4')]},'fromuser':{'type':Sequelize[_0xd1c5('0x4')]},'port':{'type':Sequelize[_0xd1c5('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xd1c5('0x4')]},'rtptimeout':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd1c5('0x4')]},'callbackextension':{'type':Sequelize[_0xd1c5('0x4')]},'timert1':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'timerb':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xd1c5('0x4')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xd1c5('0x4')]},'use_q850_reason':{'type':Sequelize[_0xd1c5('0x4')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no')},'force_avp':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'icesupport':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no',_0xd1c5('0x2a'),_0xd1c5('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xd1c5('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd1c5('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0xd1c5('0x4')]},'dtlscipher':{'type':Sequelize[_0xd1c5('0x4')]},'dtlscafile':{'type':Sequelize[_0xd1c5('0x4')]},'dtlscapath':{'type':Sequelize[_0xd1c5('0x4')]},'dtlssetup':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x2c'),_0xd1c5('0x2d'),_0xd1c5('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd1c5('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd1c5('0x4')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xd1c5('0x6')](_0xd1c5('0x17'),'no')},'vmexten':{'type':Sequelize[_0xd1c5('0x4')]},'mohinterpret':{'type':Sequelize[_0xd1c5('0x4')]},'mohsuggest':{'type':Sequelize[_0xd1c5('0x4')]},'parkinglot':{'type':Sequelize[_0xd1c5('0x4')]},'description':{'type':Sequelize[_0xd1c5('0x4')]},'host':{'type':Sequelize[_0xd1c5('0x4')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0xd1c5('0x17'),'no',_0xd1c5('0x18'),_0xd1c5('0x19'),_0xd1c5('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd1c5('0x4')]},'otherFields':{'type':Sequelize[_0xd1c5('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd1c5('0x4')],'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 9766085..ff36ce8 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 _0x915a=['rows','catch','show','params','clone','find','get','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x915a,0x1d2));var _0xa915=function(_0x262911,_0x1aa085){_0x262911=_0x262911-0x0;var _0x1879b3=_0x915a[_0x262911];return _0x1879b3;};'use strict';var pdf=require(_0xa915('0x0'));var emlformat=require(_0xa915('0x1'));var rimraf=require(_0xa915('0x2'));var zipdir=require(_0xa915('0x3'));var jsonpatch=require(_0xa915('0x4'));var rp=require('request-promise');var moment=require(_0xa915('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa915('0x6'));var path=require(_0xa915('0x7'));var sox=require(_0xa915('0x8'));var csv=require(_0xa915('0x9'));var ejs=require(_0xa915('0xa'));var fs=require('fs');var _=require(_0xa915('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa915('0xc'));var deskjs=require(_0xa915('0xd'));var toCsv=require(_0xa915('0x9'));var querystring=require(_0xa915('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa915('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa915('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa915('0x11'))(_0xa915('0x12'));var utils=require(_0xa915('0x13'));var config=require(_0xa915('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa915('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x274f4d,_0x563972,_0xb897e2){if(_0xb897e2){var _0x3aae6f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3aae6f[_0xa915('0x16')](_0x563972)){return _0x274f4d;}else{throw new db[(_0xa915('0x17'))][(_0xa915('0x18'))](_0xa915('0x19'));}}else{return _0x274f4d;}}function respondWithRpcPromise(_0x4c3f35,_0x23ecd8,_0x19889d,_0xf9f02c){return new BPromise(function(_0x590be6,_0x3284b8){var _0xf8046b=_0xf9f02c||client;return _0xf8046b[_0xa915('0x1a')](_0x4c3f35,_0x19889d)[_0xa915('0x1b')](function(_0x3f5aff){logger[_0xa915('0x1c')](_0xa915('0x1d'),_0x23ecd8,_0xa915('0x1e'));logger[_0xa915('0x1f')](_0xa915('0x20'),_0x23ecd8,_0xa915('0x1e'),JSON['stringify'](_0x3f5aff));if(_0x3f5aff[_0xa915('0x21')]){if(_0x3f5aff['error'][_0xa915('0x22')]===0x1f4){logger[_0xa915('0x21')](_0xa915('0x1d'),_0x23ecd8,_0x3f5aff[_0xa915('0x21')][_0xa915('0x23')]);return _0x3284b8(_0x3f5aff['error'][_0xa915('0x23')]);}logger[_0xa915('0x21')](_0xa915('0x1d'),_0x23ecd8,_0x3f5aff[_0xa915('0x21')][_0xa915('0x23')]);return _0x590be6(_0x3f5aff[_0xa915('0x21')]['message']);}else{logger[_0xa915('0x1c')](_0xa915('0x1d'),_0x23ecd8,_0xa915('0x1e'));_0x590be6(_0x3f5aff[_0xa915('0x24')]['message']);}})['catch'](function(_0x34a8c6){logger['error'](_0xa915('0x1d'),_0x23ecd8,_0x34a8c6);_0x3284b8(_0x34a8c6);});});}function respondWithStatusCode(_0x3b8cbb,_0x3898cc){_0x3898cc=_0x3898cc||0xcc;return function(_0x462b94){if(_0x462b94){return _0x3b8cbb[_0xa915('0x25')](_0x3898cc);}return _0x3b8cbb[_0xa915('0x26')](_0x3898cc)[_0xa915('0x27')]();};}function respondWithResult(_0x525f55,_0x152d6e){_0x152d6e=_0x152d6e||0xc8;return function(_0x1bb9e4){if(_0x1bb9e4){return _0x525f55['status'](_0x152d6e)[_0xa915('0x28')](_0x1bb9e4);}};}function respondWithFilteredResult(_0x1645d5,_0x3d7251){return function(_0x30bfe2){if(_0x30bfe2){var _0x5a62c0=_0x30bfe2[_0xa915('0x29')],_0x3cca8e=_0x3d7251[_0xa915('0x2a')],_0x427742=_0x3d7251[_0xa915('0x2a')]+_0x3d7251[_0xa915('0x2b')],_0x486ca1;if(_0x427742>=_0x5a62c0){_0x427742=_0x5a62c0;_0x486ca1=0xc8;}else{_0x486ca1=0xce;}_0x1645d5[_0xa915('0x26')](_0x486ca1);return _0x1645d5[_0xa915('0x2c')]('Content-Range',_0x3cca8e+'-'+_0x427742+'/'+_0x5a62c0)[_0xa915('0x28')](_0x30bfe2);}return null;};}function patchUpdates(_0x319238){return function(_0x119d36){try{jsonpatch['apply'](_0x119d36,_0x319238,!![]);}catch(_0x29de2a){return BPromise[_0xa915('0x2d')](_0x29de2a);}return _0x119d36[_0xa915('0x2e')]();};}function saveUpdates(_0x4a367d,_0x3e20c8){return function(_0x39482f){if(_0x39482f){return _0x39482f[_0xa915('0x2f')](_0x4a367d)[_0xa915('0x1b')](function(_0x4e8968){return _0x4e8968;});}return null;};}function removeEntity(_0x4de4c9,_0x2cf0f0){return function(_0x3dc789){if(_0x3dc789){return _0x3dc789[_0xa915('0x30')]()['then'](function(){var _0xe82283=_0x3dc789['get']({'plain':!![]});var _0x680b13=_0xa915('0x31');return db[_0xa915('0x32')][_0xa915('0x30')]({'where':{'type':_0x680b13,'resourceId':_0xe82283['id']}})[_0xa915('0x1b')](function(){return _0x3dc789;});})[_0xa915('0x1b')](function(){_0x4de4c9[_0xa915('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252643,_0x3ab97d){return function(_0x42a0f7){if(!_0x42a0f7){_0x252643[_0xa915('0x25')](0x194);}return _0x42a0f7;};}function handleError(_0x67cec1,_0x3bc4d0){_0x3bc4d0=_0x3bc4d0||0x1f4;return function(_0x489945){logger[_0xa915('0x21')](_0x489945[_0xa915('0x33')]);if(_0x489945[_0xa915('0x34')]){delete _0x489945[_0xa915('0x34')];}_0x67cec1[_0xa915('0x26')](_0x3bc4d0)[_0xa915('0x35')](_0x489945);};}exports[_0xa915('0x36')]=function(_0x57f120,_0x5d9d18){var _0x50ff83={},_0x4a74c3={},_0x277686={'count':0x0,'rows':[]};var _0x23d976=_[_0xa915('0x37')](db[_0xa915('0x38')][_0xa915('0x39')],function(_0x3985e7){return{'name':_0x3985e7[_0xa915('0x3a')],'type':_0x3985e7[_0xa915('0x3b')][_0xa915('0x3c')]};});_0x4a74c3[_0xa915('0x3d')]=_[_0xa915('0x37')](_0x23d976,_0xa915('0x34'));_0x4a74c3[_0xa915('0x3e')]=_[_0xa915('0x3f')](_0x57f120['query']);_0x4a74c3[_0xa915('0x40')]=_[_0xa915('0x41')](_0x4a74c3[_0xa915('0x3d')],_0x4a74c3[_0xa915('0x3e')]);_0x50ff83[_0xa915('0x42')]=_['intersection'](_0x4a74c3[_0xa915('0x3d')],qs[_0xa915('0x43')](_0x57f120[_0xa915('0x3e')][_0xa915('0x43')]));_0x50ff83['attributes']=_0x50ff83[_0xa915('0x42')][_0xa915('0x44')]?_0x50ff83[_0xa915('0x42')]:_0x4a74c3[_0xa915('0x3d')];if(!_0x57f120[_0xa915('0x3e')][_0xa915('0x45')](_0xa915('0x46'))){_0x50ff83[_0xa915('0x2b')]=qs['limit'](_0x57f120[_0xa915('0x3e')][_0xa915('0x2b')]);_0x50ff83[_0xa915('0x2a')]=qs[_0xa915('0x2a')](_0x57f120['query'][_0xa915('0x2a')]);}_0x50ff83['order']=qs[_0xa915('0x47')](_0x57f120[_0xa915('0x3e')]['sort']);_0x50ff83[_0xa915('0x48')]=qs['filters'](_['pick'](_0x57f120[_0xa915('0x3e')],_0x4a74c3[_0xa915('0x40')]),_0x23d976);if(_0x57f120[_0xa915('0x3e')][_0xa915('0x49')]){_0x50ff83[_0xa915('0x48')]=_[_0xa915('0x4a')](_0x50ff83['where'],{'$or':_[_0xa915('0x37')](_0x23d976,function(_0x6cc2c5){if(_0x6cc2c5[_0xa915('0x3b')]!==_0xa915('0x4b')){var _0x3739c7={};_0x3739c7[_0x6cc2c5[_0xa915('0x34')]]={'$like':'%'+_0x57f120[_0xa915('0x3e')][_0xa915('0x49')]+'%'};return _0x3739c7;}})});}_0x50ff83=_['merge']({},_0x50ff83,_0x57f120['options']);var _0x1a0545={'where':_0x50ff83[_0xa915('0x48')]};return db[_0xa915('0x38')][_0xa915('0x29')](_0x1a0545)[_0xa915('0x1b')](function(_0x22b82d){_0x277686['count']=_0x22b82d;if(_0x57f120[_0xa915('0x3e')][_0xa915('0x4c')]){_0x50ff83[_0xa915('0x4d')]=[{'all':!![]}];}return db[_0xa915('0x38')][_0xa915('0x4e')](_0x50ff83);})[_0xa915('0x1b')](function(_0x40a57e){_0x277686[_0xa915('0x4f')]=_0x40a57e;return _0x277686;})['then'](respondWithFilteredResult(_0x5d9d18,_0x50ff83))[_0xa915('0x50')](handleError(_0x5d9d18,null));};exports[_0xa915('0x51')]=function(_0x4744ef,_0x1c2230){var _0x2ac04b={'raw':![],'where':{'id':_0x4744ef[_0xa915('0x52')]['id']}},_0x3f485={};_0x3f485[_0xa915('0x3d')]=_[_0xa915('0x3f')](db[_0xa915('0x38')]['rawAttributes']);_0x3f485['query']=_['keys'](_0x4744ef[_0xa915('0x3e')]);_0x3f485[_0xa915('0x40')]=_[_0xa915('0x41')](_0x3f485[_0xa915('0x3d')],_0x3f485['query']);_0x2ac04b[_0xa915('0x42')]=_[_0xa915('0x41')](_0x3f485[_0xa915('0x3d')],qs[_0xa915('0x43')](_0x4744ef[_0xa915('0x3e')][_0xa915('0x43')]));_0x2ac04b[_0xa915('0x42')]=_0x2ac04b['attributes'][_0xa915('0x44')]?_0x2ac04b[_0xa915('0x42')]:_0x3f485[_0xa915('0x3d')];if(_0x4744ef[_0xa915('0x3e')][_0xa915('0x4c')]){_0x2ac04b['include']=[{'all':!![]}];}_0x2ac04b=_[_0xa915('0x4a')]({},_0x2ac04b,_0x4744ef['options']);return db['Trunk']['find'](_0x2ac04b)[_0xa915('0x1b')](handleEntityNotFound(_0x1c2230,null))[_0xa915('0x1b')](respondWithResult(_0x1c2230,null))[_0xa915('0x50')](handleError(_0x1c2230,null));};exports[_0xa915('0x53')]=function(_0x5b83c5,_0x9fff41){var _0x107af9={'where':{'id':_0x5b83c5[_0xa915('0x52')]['id']}},_0x19259b={};_0x19259b[_0xa915('0x3d')]=_[_0xa915('0x3f')](db[_0xa915('0x38')][_0xa915('0x39')]);_0x107af9[_0xa915('0x42')]=_[_0xa915('0x41')](_0x19259b[_0xa915('0x3d')],qs['fields'](_0x5b83c5[_0xa915('0x3e')][_0xa915('0x43')]));_0x107af9[_0xa915('0x42')]=_0x107af9[_0xa915('0x42')][_0xa915('0x44')]?_0x107af9[_0xa915('0x42')]:_0x19259b[_0xa915('0x3d')];if(_0x5b83c5['query']['includeAll']){_0x107af9[_0xa915('0x4d')]=[{'all':!![]}];}_0x107af9=_[_0xa915('0x4a')]({},_0x107af9,_0x5b83c5['options']);return db[_0xa915('0x38')][_0xa915('0x54')](_0x107af9)['then'](handleEntityNotFound(_0x9fff41,null))[_0xa915('0x1b')](function(_0x228ff8){if(_0x228ff8){var _0x4a3e14=_0x228ff8[_0xa915('0x55')]({'plain':!![]});_0x4a3e14=qs[_0xa915('0x56')](_0x4a3e14,['id','createdAt',_0xa915('0x57')]);_0x5b83c5[_0xa915('0x58')]=_[_0xa915('0x56')](_0x5b83c5[_0xa915('0x58')],['id','createdAt','updatedAt']);return db[_0xa915('0x38')][_0xa915('0x59')](_[_0xa915('0x4a')](_0x4a3e14,_0x5b83c5[_0xa915('0x58')]),{'include':_0x5b83c5[_0xa915('0x3e')][_0xa915('0x4c')]?[{'all':!![]}]:undefined})[_0xa915('0x1b')](function(_0x361cb2){var _0x5c290e=_0x5b83c5[_0xa915('0x5a')][_0xa915('0x55')]({'plain':!![]});if(!_0x5c290e)throw new Error(_0xa915('0x5b'));if(_0x5c290e[_0xa915('0x5c')]===_0xa915('0x5a')){var _0x3f2b09=_0x361cb2[_0xa915('0x55')]({'plain':!![]});var _0x3c21a2=_0xa915('0x31');return db['UserProfileSection'][_0xa915('0x54')]({'where':{'name':_0x3c21a2,'userProfileId':_0x5c290e[_0xa915('0x5d')]},'raw':!![]})[_0xa915('0x1b')](function(_0x3cf7d6){if(_0x3cf7d6&&_0x3cf7d6['autoAssociation']===0x0){return db[_0xa915('0x32')][_0xa915('0x59')]({'name':_0x3f2b09[_0xa915('0x34')],'resourceId':_0x3f2b09['id'],'type':_0x3cf7d6[_0xa915('0x34')],'sectionId':_0x3cf7d6['id']},{})[_0xa915('0x1b')](function(){return _0x361cb2;});}else{return _0x361cb2;}})[_0xa915('0x50')](function(_0x4b1d34){logger[_0xa915('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1d34);throw _0x4b1d34;});}return _0x361cb2;});}})[_0xa915('0x1b')](respondWithResult(_0x9fff41,0xc9))[_0xa915('0x50')](handleError(_0x9fff41,null));};exports[_0xa915('0x59')]=function(_0x3ddcfd,_0x525217,_0x2c50ec){var _0x601ecb;return db[_0xa915('0x38')]['create'](_0x3ddcfd[_0xa915('0x58')],{'raw':!![]})[_0xa915('0x1b')](function(_0x4b1102){_0x601ecb=_0x4b1102;return db[_0xa915('0x38')][_0xa915('0x4e')]({'raw':!![]});})[_0xa915('0x1b')](function(_0x1f8eb3){var _0x1e5eca=fs[_0xa915('0x5e')](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x61')),'utf8');var _0x4fa2e6=fs[_0xa915('0x5e')](path['join'](config['root'],_0xa915('0x62')),_0xa915('0x63'));var _0x12de88=ejs[_0xa915('0x64')](_0x1e5eca,{'trunks':_0x1f8eb3||[]});fs[_0xa915('0x65')](_0xa915('0x66'),_0x12de88);if(_0x601ecb[_0xa915('0x67')]){var _0xbd2935=ejs[_0xa915('0x64')](_0x4fa2e6,{'trunks':_0x1f8eb3||[]});fs[_0xa915('0x65')](_0xa915('0x68'),_0xbd2935);}})['then'](function(){return respondWithRpcPromise(_0xa915('0x69'),_0xa915('0x59'),{'module':_0xa915('0x6a')});})['then'](function(){var _0x2d3ae8=_0x3ddcfd[_0xa915('0x5a')][_0xa915('0x55')]({'plain':!![]});if(!_0x2d3ae8)throw new Error(_0xa915('0x5b'));if(_0x2d3ae8[_0xa915('0x5c')]==='user'){var _0x342db9=_0x601ecb[_0xa915('0x55')]({'plain':!![]});return db['UserProfileSection'][_0xa915('0x54')]({'where':{'name':'Trunks','userProfileId':_0x2d3ae8[_0xa915('0x5d')]},'raw':!![]})[_0xa915('0x1b')](function(_0x461634){if(_0x461634&&_0x461634[_0xa915('0x6b')]===0x0){return db[_0xa915('0x32')][_0xa915('0x59')]({'name':_0x342db9[_0xa915('0x34')],'resourceId':_0x342db9['id'],'type':_0x461634[_0xa915('0x34')],'sectionId':_0x461634['id']},{})[_0xa915('0x1b')](function(){return _0x601ecb;});}else{return _0x601ecb;}})['catch'](function(_0x5dd438){logger[_0xa915('0x21')](_0xa915('0x6c'),_0x5dd438);throw _0x5dd438;});}return _0x601ecb;})[_0xa915('0x1b')](respondWithResult(_0x525217,0xc9))['catch'](handleError(_0x525217,null));};exports[_0xa915('0x2f')]=function(_0x2df02a,_0x376365,_0x369033){var _0x5d8d44;return db[_0xa915('0x38')]['find']({'where':{'id':_0x2df02a[_0xa915('0x52')]['id']}})[_0xa915('0x1b')](handleEntityNotFound(_0x376365,null))['then'](saveUpdates(_0x2df02a[_0xa915('0x58')],null))[_0xa915('0x1b')](function(_0x589b62){if(_0x589b62){_0x5d8d44=_0x589b62;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa915('0x1b')](function(_0x24e04e){if(_0x24e04e){var _0x58e488=fs['readFileSync'](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x61')),_0xa915('0x63'));var _0x5e2ebe=fs['readFileSync'](path[_0xa915('0x5f')](config[_0xa915('0x60')],_0xa915('0x62')),_0xa915('0x63'));var _0x530ecb=ejs['render'](_0x58e488,{'trunks':_0x24e04e||[]});fs[_0xa915('0x65')](_0xa915('0x66'),_0x530ecb);var _0x463151=ejs[_0xa915('0x64')](_0x5e2ebe,{'trunks':_0x24e04e||[]});fs[_0xa915('0x65')](_0xa915('0x68'),_0x463151);return respondWithRpcPromise(_0xa915('0x69'),'update',{'module':_0xa915('0x6a')});}return null;})['then'](function(_0x31099f){if(_0x31099f){return _0x5d8d44;}})[_0xa915('0x1b')](respondWithResult(_0x376365,null))[_0xa915('0x50')](handleError(_0x376365,null));};exports['destroy']=function(_0x296206,_0x320be8,_0x5c850e){var _0x113717;return db[_0xa915('0x38')][_0xa915('0x54')]({'where':{'id':_0x296206[_0xa915('0x52')]['id']}})[_0xa915('0x1b')](handleEntityNotFound(_0x320be8,null))[_0xa915('0x1b')](removeEntity(_0x320be8,null))['then'](function(){return db[_0xa915('0x38')][_0xa915('0x4e')]({'raw':!![]});})[_0xa915('0x1b')](function(_0x4db568){var _0x2e2b31=fs[_0xa915('0x5e')](path['join'](config[_0xa915('0x60')],'server/files/templates/trunk.ejs'),'utf8');var _0x41dd4c=fs[_0xa915('0x5e')](path[_0xa915('0x5f')](config['root'],_0xa915('0x62')),_0xa915('0x63'));var _0x2edd05=ejs['render'](_0x2e2b31,{'trunks':_0x4db568});var _0x35d712=ejs[_0xa915('0x64')](_0x41dd4c,{'trunks':_0x4db568});fs[_0xa915('0x65')](_0xa915('0x66'),_0x2edd05);fs[_0xa915('0x65')](_0xa915('0x68'),_0x35d712);return respondWithRpcPromise(_0xa915('0x69'),_0xa915('0x30'),{'module':_0xa915('0x6a')});})[_0xa915('0x50')](handleError(_0x320be8,null));}; \ No newline at end of file +var _0x4058=['json','count','offset','limit','set','Content-Range','reject','destroy','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','params','omit','body','createdAt','updatedAt','create','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','readFileSync','Reload','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x4058,0x129));var _0x8405=function(_0x41ac5e,_0x2683d4){_0x41ac5e=_0x41ac5e-0x0;var _0x1d5be8=_0x4058[_0x41ac5e];return _0x1d5be8;};'use strict';var pdf=require(_0x8405('0x0'));var emlformat=require(_0x8405('0x1'));var rimraf=require(_0x8405('0x2'));var zipdir=require(_0x8405('0x3'));var jsonpatch=require(_0x8405('0x4'));var rp=require(_0x8405('0x5'));var moment=require(_0x8405('0x6'));var BPromise=require(_0x8405('0x7'));var Mustache=require(_0x8405('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8405('0x9'));var ejs=require(_0x8405('0xa'));var fs=require('fs');var _=require(_0x8405('0xb'));var squel=require(_0x8405('0xc'));var crypto=require(_0x8405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8405('0xe'));var toCsv=require(_0x8405('0x9'));var querystring=require(_0x8405('0xf'));var Papa=require('papaparse');var Redis=require(_0x8405('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x11'));var as=require(_0x8405('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x13'))(_0x8405('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x8405('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x495190,_0x4e6477,_0x5388de){if(_0x5388de){var _0x548c94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x548c94[_0x8405('0x16')](_0x4e6477)){return _0x495190;}else{throw new db[(_0x8405('0x17'))]['ValidationError'](_0x8405('0x18'));}}else{return _0x495190;}}function respondWithRpcPromise(_0xa60bb4,_0x221cf8,_0x422822,_0x58eb66){return new BPromise(function(_0x218fe7,_0x2d7601){var _0x8ef1fb=_0x58eb66||client;return _0x8ef1fb[_0x8405('0x19')](_0xa60bb4,_0x422822)[_0x8405('0x1a')](function(_0x15a189){logger[_0x8405('0x1b')](_0x8405('0x1c'),_0x221cf8,_0x8405('0x1d'));logger[_0x8405('0x1e')](_0x8405('0x1f'),_0x221cf8,_0x8405('0x1d'),JSON[_0x8405('0x20')](_0x15a189));if(_0x15a189[_0x8405('0x21')]){if(_0x15a189[_0x8405('0x21')][_0x8405('0x22')]===0x1f4){logger[_0x8405('0x21')](_0x8405('0x1c'),_0x221cf8,_0x15a189[_0x8405('0x21')][_0x8405('0x23')]);return _0x2d7601(_0x15a189[_0x8405('0x21')][_0x8405('0x23')]);}logger[_0x8405('0x21')](_0x8405('0x1c'),_0x221cf8,_0x15a189[_0x8405('0x21')][_0x8405('0x23')]);return _0x218fe7(_0x15a189['error']['message']);}else{logger[_0x8405('0x1b')](_0x8405('0x1c'),_0x221cf8,_0x8405('0x1d'));_0x218fe7(_0x15a189['result'][_0x8405('0x23')]);}})['catch'](function(_0x48c5ea){logger['error'](_0x8405('0x1c'),_0x221cf8,_0x48c5ea);_0x2d7601(_0x48c5ea);});});}function respondWithStatusCode(_0x162c03,_0x2a6c7b){_0x2a6c7b=_0x2a6c7b||0xcc;return function(_0x4450eb){if(_0x4450eb){return _0x162c03[_0x8405('0x24')](_0x2a6c7b);}return _0x162c03[_0x8405('0x25')](_0x2a6c7b)[_0x8405('0x26')]();};}function respondWithResult(_0x178ef6,_0x44b495){_0x44b495=_0x44b495||0xc8;return function(_0x24b88d){if(_0x24b88d){return _0x178ef6[_0x8405('0x25')](_0x44b495)[_0x8405('0x27')](_0x24b88d);}};}function respondWithFilteredResult(_0x53bb61,_0x132c0f){return function(_0x51396d){if(_0x51396d){var _0x48a425=_0x51396d[_0x8405('0x28')],_0xc7df7=_0x132c0f[_0x8405('0x29')],_0x41f06a=_0x132c0f[_0x8405('0x29')]+_0x132c0f[_0x8405('0x2a')],_0x3022cc;if(_0x41f06a>=_0x48a425){_0x41f06a=_0x48a425;_0x3022cc=0xc8;}else{_0x3022cc=0xce;}_0x53bb61[_0x8405('0x25')](_0x3022cc);return _0x53bb61[_0x8405('0x2b')](_0x8405('0x2c'),_0xc7df7+'-'+_0x41f06a+'/'+_0x48a425)[_0x8405('0x27')](_0x51396d);}return null;};}function patchUpdates(_0x3b14e5){return function(_0xcbee2b){try{jsonpatch['apply'](_0xcbee2b,_0x3b14e5,!![]);}catch(_0x4015c0){return BPromise[_0x8405('0x2d')](_0x4015c0);}return _0xcbee2b['save']();};}function saveUpdates(_0x3c12e3,_0x17c589){return function(_0x1bcfa5){if(_0x1bcfa5){return _0x1bcfa5['update'](_0x3c12e3)[_0x8405('0x1a')](function(_0x42c28f){return _0x42c28f;});}return null;};}function removeEntity(_0x33a9fd,_0x518f27){return function(_0x66139d){if(_0x66139d){return _0x66139d[_0x8405('0x2e')]()['then'](function(){var _0x1ebf6f=_0x66139d['get']({'plain':!![]});var _0x3f210c=_0x8405('0x2f');return db[_0x8405('0x30')][_0x8405('0x2e')]({'where':{'type':_0x3f210c,'resourceId':_0x1ebf6f['id']}})[_0x8405('0x1a')](function(){return _0x66139d;});})[_0x8405('0x1a')](function(){_0x33a9fd[_0x8405('0x25')](0xcc)[_0x8405('0x26')]();});}};}function handleEntityNotFound(_0x1ae1c4,_0x298b3f){return function(_0x2ddb8d){if(!_0x2ddb8d){_0x1ae1c4[_0x8405('0x24')](0x194);}return _0x2ddb8d;};}function handleError(_0x4cd2bf,_0x23ef27){_0x23ef27=_0x23ef27||0x1f4;return function(_0x4c174c){logger['error'](_0x4c174c[_0x8405('0x31')]);if(_0x4c174c[_0x8405('0x32')]){delete _0x4c174c['name'];}_0x4cd2bf[_0x8405('0x25')](_0x23ef27)[_0x8405('0x33')](_0x4c174c);};}exports[_0x8405('0x34')]=function(_0x26b418,_0x1abb9a){var _0x565324={},_0x40b6e0={},_0x968b59={'count':0x0,'rows':[]};var _0x177600=_[_0x8405('0x35')](db[_0x8405('0x36')]['rawAttributes'],function(_0x349143){return{'name':_0x349143[_0x8405('0x37')],'type':_0x349143[_0x8405('0x38')][_0x8405('0x39')]};});_0x40b6e0[_0x8405('0x3a')]=_[_0x8405('0x35')](_0x177600,'name');_0x40b6e0[_0x8405('0x3b')]=_[_0x8405('0x3c')](_0x26b418[_0x8405('0x3b')]);_0x40b6e0[_0x8405('0x3d')]=_[_0x8405('0x3e')](_0x40b6e0[_0x8405('0x3a')],_0x40b6e0[_0x8405('0x3b')]);_0x565324['attributes']=_[_0x8405('0x3e')](_0x40b6e0['model'],qs[_0x8405('0x3f')](_0x26b418[_0x8405('0x3b')]['fields']));_0x565324[_0x8405('0x40')]=_0x565324[_0x8405('0x40')][_0x8405('0x41')]?_0x565324[_0x8405('0x40')]:_0x40b6e0[_0x8405('0x3a')];if(!_0x26b418[_0x8405('0x3b')][_0x8405('0x42')](_0x8405('0x43'))){_0x565324[_0x8405('0x2a')]=qs[_0x8405('0x2a')](_0x26b418['query']['limit']);_0x565324[_0x8405('0x29')]=qs['offset'](_0x26b418[_0x8405('0x3b')][_0x8405('0x29')]);}_0x565324[_0x8405('0x44')]=qs['sort'](_0x26b418[_0x8405('0x3b')][_0x8405('0x45')]);_0x565324['where']=qs[_0x8405('0x3d')](_[_0x8405('0x46')](_0x26b418[_0x8405('0x3b')],_0x40b6e0[_0x8405('0x3d')]),_0x177600);if(_0x26b418[_0x8405('0x3b')][_0x8405('0x47')]){_0x565324[_0x8405('0x48')]=_['merge'](_0x565324['where'],{'$or':_['map'](_0x177600,function(_0x84020b){if(_0x84020b[_0x8405('0x38')]!==_0x8405('0x49')){var _0x3788a4={};_0x3788a4[_0x84020b['name']]={'$like':'%'+_0x26b418['query'][_0x8405('0x47')]+'%'};return _0x3788a4;}})});}_0x565324=_[_0x8405('0x4a')]({},_0x565324,_0x26b418[_0x8405('0x4b')]);var _0x1cd888={'where':_0x565324[_0x8405('0x48')]};return db[_0x8405('0x36')][_0x8405('0x28')](_0x1cd888)[_0x8405('0x1a')](function(_0x5a57be){_0x968b59[_0x8405('0x28')]=_0x5a57be;if(_0x26b418['query'][_0x8405('0x4c')]){_0x565324[_0x8405('0x4d')]=[{'all':!![]}];}return db[_0x8405('0x36')][_0x8405('0x4e')](_0x565324);})[_0x8405('0x1a')](function(_0x664cc9){_0x968b59[_0x8405('0x4f')]=_0x664cc9;return _0x968b59;})[_0x8405('0x1a')](respondWithFilteredResult(_0x1abb9a,_0x565324))['catch'](handleError(_0x1abb9a,null));};exports[_0x8405('0x50')]=function(_0x1cc41f,_0x39b5b3){var _0x3e4473={'raw':![],'where':{'id':_0x1cc41f['params']['id']}},_0x5d733d={};_0x5d733d[_0x8405('0x3a')]=_[_0x8405('0x3c')](db[_0x8405('0x36')][_0x8405('0x51')]);_0x5d733d[_0x8405('0x3b')]=_[_0x8405('0x3c')](_0x1cc41f[_0x8405('0x3b')]);_0x5d733d['filters']=_['intersection'](_0x5d733d[_0x8405('0x3a')],_0x5d733d['query']);_0x3e4473[_0x8405('0x40')]=_[_0x8405('0x3e')](_0x5d733d[_0x8405('0x3a')],qs['fields'](_0x1cc41f['query'][_0x8405('0x3f')]));_0x3e4473['attributes']=_0x3e4473[_0x8405('0x40')][_0x8405('0x41')]?_0x3e4473[_0x8405('0x40')]:_0x5d733d[_0x8405('0x3a')];if(_0x1cc41f[_0x8405('0x3b')][_0x8405('0x4c')]){_0x3e4473[_0x8405('0x4d')]=[{'all':!![]}];}_0x3e4473=_[_0x8405('0x4a')]({},_0x3e4473,_0x1cc41f[_0x8405('0x4b')]);return db['Trunk'][_0x8405('0x52')](_0x3e4473)[_0x8405('0x1a')](handleEntityNotFound(_0x39b5b3,null))[_0x8405('0x1a')](respondWithResult(_0x39b5b3,null))[_0x8405('0x53')](handleError(_0x39b5b3,null));};exports['clone']=function(_0x4719ea,_0x4025c6){var _0x47760c={'where':{'id':_0x4719ea[_0x8405('0x54')]['id']}},_0x22d378={};_0x22d378[_0x8405('0x3a')]=_['keys'](db[_0x8405('0x36')][_0x8405('0x51')]);_0x47760c[_0x8405('0x40')]=_['intersection'](_0x22d378[_0x8405('0x3a')],qs[_0x8405('0x3f')](_0x4719ea[_0x8405('0x3b')][_0x8405('0x3f')]));_0x47760c[_0x8405('0x40')]=_0x47760c[_0x8405('0x40')][_0x8405('0x41')]?_0x47760c[_0x8405('0x40')]:_0x22d378[_0x8405('0x3a')];if(_0x4719ea[_0x8405('0x3b')]['includeAll']){_0x47760c[_0x8405('0x4d')]=[{'all':!![]}];}_0x47760c=_['merge']({},_0x47760c,_0x4719ea[_0x8405('0x4b')]);return db['Trunk'][_0x8405('0x52')](_0x47760c)[_0x8405('0x1a')](handleEntityNotFound(_0x4025c6,null))[_0x8405('0x1a')](function(_0xdf957f){if(_0xdf957f){var _0x29d2cf=_0xdf957f['get']({'plain':!![]});_0x29d2cf=qs[_0x8405('0x55')](_0x29d2cf,['id','createdAt','updatedAt']);_0x4719ea[_0x8405('0x56')]=_['omit'](_0x4719ea[_0x8405('0x56')],['id',_0x8405('0x57'),_0x8405('0x58')]);return db['Trunk'][_0x8405('0x59')](_[_0x8405('0x4a')](_0x29d2cf,_0x4719ea[_0x8405('0x56')]),{'include':_0x4719ea[_0x8405('0x3b')][_0x8405('0x4c')]?[{'all':!![]}]:undefined})[_0x8405('0x1a')](function(_0x485af5){var _0xd153b7=_0x4719ea[_0x8405('0x5a')][_0x8405('0x5b')]({'plain':!![]});if(!_0xd153b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd153b7['role']===_0x8405('0x5a')){var _0x408e39=_0x485af5[_0x8405('0x5b')]({'plain':!![]});var _0x450dad=_0x8405('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x450dad,'userProfileId':_0xd153b7['userProfileId']},'raw':!![]})[_0x8405('0x1a')](function(_0x14a39b){if(_0x14a39b&&_0x14a39b[_0x8405('0x5c')]===0x0){return db[_0x8405('0x30')][_0x8405('0x59')]({'name':_0x408e39[_0x8405('0x32')],'resourceId':_0x408e39['id'],'type':_0x14a39b[_0x8405('0x32')],'sectionId':_0x14a39b['id']},{})[_0x8405('0x1a')](function(){return _0x485af5;});}else{return _0x485af5;}})[_0x8405('0x53')](function(_0x23d94e){logger[_0x8405('0x21')](_0x8405('0x5d'),_0x23d94e);throw _0x23d94e;});}return _0x485af5;});}})['then'](respondWithResult(_0x4025c6,0xc9))[_0x8405('0x53')](handleError(_0x4025c6,null));};exports[_0x8405('0x59')]=function(_0x50c8e2,_0x2b87ba,_0x2a54bb){var _0x2c0413;return db[_0x8405('0x36')][_0x8405('0x59')](_0x50c8e2[_0x8405('0x56')],{'raw':!![]})[_0x8405('0x1a')](function(_0x27085d){_0x2c0413=_0x27085d;return db[_0x8405('0x36')]['findAll']({'raw':!![]});})[_0x8405('0x1a')](function(_0x4732dc){var _0x17e983=fs['readFileSync'](path[_0x8405('0x5e')](config[_0x8405('0x5f')],_0x8405('0x60')),_0x8405('0x61'));var _0x27f1ef=fs['readFileSync'](path[_0x8405('0x5e')](config[_0x8405('0x5f')],_0x8405('0x62')),_0x8405('0x61'));var _0x18c784=ejs[_0x8405('0x63')](_0x17e983,{'trunks':_0x4732dc||[]});fs[_0x8405('0x64')](_0x8405('0x65'),_0x18c784);if(_0x2c0413[_0x8405('0x66')]){var _0x55d770=ejs[_0x8405('0x63')](_0x27f1ef,{'trunks':_0x4732dc||[]});fs['writeFileSync'](_0x8405('0x67'),_0x55d770);}})[_0x8405('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})['then'](function(){var _0xafeefb=_0x50c8e2['user'][_0x8405('0x5b')]({'plain':!![]});if(!_0xafeefb)throw new Error(_0x8405('0x68'));if(_0xafeefb[_0x8405('0x69')]===_0x8405('0x5a')){var _0x372ca9=_0x2c0413[_0x8405('0x5b')]({'plain':!![]});return db[_0x8405('0x6a')]['find']({'where':{'name':_0x8405('0x2f'),'userProfileId':_0xafeefb[_0x8405('0x6b')]},'raw':!![]})['then'](function(_0x55f959){if(_0x55f959&&_0x55f959['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x372ca9['name'],'resourceId':_0x372ca9['id'],'type':_0x55f959[_0x8405('0x32')],'sectionId':_0x55f959['id']},{})[_0x8405('0x1a')](function(){return _0x2c0413;});}else{return _0x2c0413;}})[_0x8405('0x53')](function(_0x2e48de){logger[_0x8405('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e48de);throw _0x2e48de;});}return _0x2c0413;})[_0x8405('0x1a')](respondWithResult(_0x2b87ba,0xc9))[_0x8405('0x53')](handleError(_0x2b87ba,null));};exports[_0x8405('0x6c')]=function(_0x3fb03b,_0x4c9044,_0x5c1bdb){var _0x2e648d;return db[_0x8405('0x36')][_0x8405('0x52')]({'where':{'id':_0x3fb03b[_0x8405('0x54')]['id']}})[_0x8405('0x1a')](handleEntityNotFound(_0x4c9044,null))[_0x8405('0x1a')](saveUpdates(_0x3fb03b[_0x8405('0x56')],null))[_0x8405('0x1a')](function(_0x575115){if(_0x575115){_0x2e648d=_0x575115;return db[_0x8405('0x36')][_0x8405('0x4e')]({'raw':!![]});}})[_0x8405('0x1a')](function(_0x356995){if(_0x356995){var _0x2a10ac=fs[_0x8405('0x6d')](path[_0x8405('0x5e')](config[_0x8405('0x5f')],_0x8405('0x60')),_0x8405('0x61'));var _0x36eb16=fs[_0x8405('0x6d')](path[_0x8405('0x5e')](config[_0x8405('0x5f')],_0x8405('0x62')),_0x8405('0x61'));var _0x5a623c=ejs[_0x8405('0x63')](_0x2a10ac,{'trunks':_0x356995||[]});fs[_0x8405('0x64')](_0x8405('0x65'),_0x5a623c);var _0x5b2b2b=ejs[_0x8405('0x63')](_0x36eb16,{'trunks':_0x356995||[]});fs[_0x8405('0x64')](_0x8405('0x67'),_0x5b2b2b);return respondWithRpcPromise(_0x8405('0x6e'),_0x8405('0x6c'),{'module':_0x8405('0x6f')});}return null;})[_0x8405('0x1a')](function(_0x2ba1fc){if(_0x2ba1fc){return _0x2e648d;}})[_0x8405('0x1a')](respondWithResult(_0x4c9044,null))[_0x8405('0x53')](handleError(_0x4c9044,null));};exports['destroy']=function(_0x48ab26,_0x467dcb,_0x468604){var _0x5e6b24;return db[_0x8405('0x36')][_0x8405('0x52')]({'where':{'id':_0x48ab26[_0x8405('0x54')]['id']}})['then'](handleEntityNotFound(_0x467dcb,null))['then'](removeEntity(_0x467dcb,null))['then'](function(){return db['Trunk'][_0x8405('0x4e')]({'raw':!![]});})[_0x8405('0x1a')](function(_0x37a642){var _0x5d6680=fs[_0x8405('0x6d')](path[_0x8405('0x5e')](config[_0x8405('0x5f')],_0x8405('0x60')),'utf8');var _0x4bc83b=fs[_0x8405('0x6d')](path[_0x8405('0x5e')](config['root'],_0x8405('0x62')),_0x8405('0x61'));var _0xc1f4ec=ejs['render'](_0x5d6680,{'trunks':_0x37a642});var _0x197225=ejs[_0x8405('0x63')](_0x4bc83b,{'trunks':_0x37a642});fs[_0x8405('0x64')](_0x8405('0x65'),_0xc1f4ec);fs[_0x8405('0x64')](_0x8405('0x67'),_0x197225);return respondWithRpcPromise(_0x8405('0x6e'),_0x8405('0x2e'),{'module':_0x8405('0x6f')});})[_0x8405('0x53')](handleError(_0x467dcb,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b29473e..09a1456 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 _0x6b33=['tools_trunks','util','api','moment','bluebird','path','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x3c576b,_0x26166d){var _0x33073b=function(_0x294b12){while(--_0x294b12){_0x3c576b['push'](_0x3c576b['shift']());}};_0x33073b(++_0x26166d);}(_0x6b33,0x161));var _0x36b3=function(_0x560ba7,_0x514250){_0x560ba7=_0x560ba7-0x0;var _0x2905ea=_0x6b33[_0x560ba7];return _0x2905ea;};'use strict';var _=require('lodash');var util=require(_0x36b3('0x0'));var logger=require('../../config/logger')(_0x36b3('0x1'));var moment=require(_0x36b3('0x2'));var BPromise=require(_0x36b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36b3('0x4'));var rimraf=require('rimraf');var config=require(_0x36b3('0x5'));var attributes=require(_0x36b3('0x6'));module[_0x36b3('0x7')]=function(_0x124002,_0x560551){return _0x124002[_0x36b3('0x8')](_0x36b3('0x9'),attributes,{'tableName':_0x36b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78f5=['api','moment','bluebird','request-promise','rimraf','./trunk.attributes','exports','tools_trunks','lodash','util'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x78f5,0xbc));var _0x578f=function(_0x192cc3,_0x5edef6){_0x192cc3=_0x192cc3-0x0;var _0x4f1774=_0x78f5[_0x192cc3];return _0x4f1774;};'use strict';var _=require(_0x578f('0x0'));var util=require(_0x578f('0x1'));var logger=require('../../config/logger')(_0x578f('0x2'));var moment=require(_0x578f('0x3'));var BPromise=require(_0x578f('0x4'));var rp=require(_0x578f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x578f('0x6'));var config=require('../../config/environment');var attributes=require(_0x578f('0x7'));module[_0x578f('0x8')]=function(_0x123e3a,_0x52ba93){return _0x123e3a['define']('Trunk',attributes,{'tableName':_0x578f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8fa3d9f..5ea2044 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 _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x236c89,_0xd76ba9){var _0x3b2a15=function(_0x89e4f9){while(--_0x89e4f9){_0x236c89['push'](_0x236c89['shift']());}};_0x3b2a15(++_0xd76ba9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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')]('Trunk,\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')]('GetTrunk',_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')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ 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(_0x31445f,_0x44dc75){var _0x547cb1=function(_0x5afdc2){while(--_0x5afdc2){_0x31445f['push'](_0x31445f['shift']());}};_0x547cb1(++_0x44dc75);}(_0x757a,0xde));var _0xa757=function(_0x3b0d89,_0x531392){_0x3b0d89=_0x3b0d89-0x0;var _0x1ee567=_0x757a[_0x3b0d89];return _0x1ee567;};'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 7d97552..fd86440 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 _0x5725=['getSmsAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts'];(function(_0x33b0f3,_0x478245){var _0x46e31b=function(_0x4f7cc7){while(--_0x4f7cc7){_0x33b0f3['push'](_0x33b0f3['shift']());}};_0x46e31b(++_0x478245);}(_0x5725,0x198));var _0x5572=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5725[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x5572('0x0'));var util=require(_0x5572('0x1'));var path=require(_0x5572('0x2'));var timeout=require(_0x5572('0x3'));var express=require(_0x5572('0x4'));var router=express['Router']();var auth=require(_0x5572('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5572('0x6'));var controller=require('./user.controller');router[_0x5572('0x7')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x9')]);router['get'](_0x5572('0xa'),auth[_0x5572('0x8')](),controller[_0x5572('0xb')]);router[_0x5572('0x7')](_0x5572('0xc'),auth[_0x5572('0x8')](),controller[_0x5572('0xd')]);router['get'](_0x5572('0xe'),auth['isAuthenticated'](),controller[_0x5572('0xf')]);router[_0x5572('0x7')](_0x5572('0x10'),controller['getAvatar']);router[_0x5572('0x7')](_0x5572('0x11'),auth[_0x5572('0x8')](),controller['getContacts']);router[_0x5572('0x7')](_0x5572('0x12'),auth['isAuthenticated'](),controller[_0x5572('0x13')]);router[_0x5572('0x7')](_0x5572('0x14'),auth[_0x5572('0x8')](),controller[_0x5572('0x15')]);router['get'](_0x5572('0x16'),auth[_0x5572('0x8')](),controller[_0x5572('0x17')]);router[_0x5572('0x7')]('/:id/recordings',auth[_0x5572('0x8')](),controller[_0x5572('0x18')]);router['get'](_0x5572('0x19'),auth['isAuthenticated'](),controller[_0x5572('0x1a')]);router[_0x5572('0x7')]('/:id/chat/interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x1b')]);router[_0x5572('0x7')](_0x5572('0x1c'),auth[_0x5572('0x8')](),controller[_0x5572('0x1d')]);router[_0x5572('0x7')](_0x5572('0x1e'),auth[_0x5572('0x8')](),controller['getMailInteractions']);router[_0x5572('0x7')](_0x5572('0x1f'),auth[_0x5572('0x8')](),controller['getSmsInteractions']);router[_0x5572('0x7')](_0x5572('0x20'),auth[_0x5572('0x8')](),controller[_0x5572('0x21')]);router[_0x5572('0x7')]('/:id/whatsapp/interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x22')]);router[_0x5572('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5572('0x23')]);router['get'](_0x5572('0x24'),auth[_0x5572('0x8')](),controller[_0x5572('0x25')]);router[_0x5572('0x7')](_0x5572('0x26'),auth[_0x5572('0x8')](),controller[_0x5572('0x27')]);router['get'](_0x5572('0x28'),auth[_0x5572('0x8')](),controller[_0x5572('0x29')]);router[_0x5572('0x7')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x2b')]);router[_0x5572('0x7')](_0x5572('0x2c'),auth[_0x5572('0x8')](),controller[_0x5572('0x2d')]);router[_0x5572('0x7')](_0x5572('0x2e'),auth[_0x5572('0x8')](),controller['getOpenchannelAccounts']);router[_0x5572('0x7')](_0x5572('0x2f'),auth[_0x5572('0x8')](),controller[_0x5572('0x30')]);router[_0x5572('0x7')](_0x5572('0x31'),auth[_0x5572('0x8')](),controller['getChatWebsites']);router[_0x5572('0x7')]('/:id/whatsapp_accounts',auth[_0x5572('0x8')](),controller[_0x5572('0x32')]);router[_0x5572('0x7')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller[_0x5572('0x34')]);router[_0x5572('0x7')](_0x5572('0x35'),auth[_0x5572('0x8')](),controller[_0x5572('0x36')]);router[_0x5572('0x7')](_0x5572('0x37'),auth[_0x5572('0x8')](),controller['getApiKey']);router[_0x5572('0x38')](_0x5572('0x39'),auth[_0x5572('0x8')](),controller[_0x5572('0x3a')]);router[_0x5572('0x38')](_0x5572('0x11'),auth[_0x5572('0x8')](),controller[_0x5572('0x3b')]);router[_0x5572('0x38')]('/',auth[_0x5572('0x8')](),controller[_0x5572('0x3c')]);router[_0x5572('0x38')](_0x5572('0x12'),auth[_0x5572('0x8')](),controller[_0x5572('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e5b35,_0x2a5040,_0x2dfee4){_0x2dfee4(null,path[_0x5572('0x3e')](config[_0x5572('0x3f')],_0x5572('0x40')));},'filename':function(_0x1d86f1,_0xe4bc49,_0x31032c){_0x31032c(null,util['format'](_0x5572('0x41'),Date[_0x5572('0x42')](),_0xe4bc49[_0x5572('0x43')]));}})});router[_0x5572('0x38')](_0x5572('0x10'),upload[_0x5572('0x44')](_0x5572('0x45')),controller[_0x5572('0x46')]);router[_0x5572('0x38')]('/:id/login',auth[_0x5572('0x8')](),controller[_0x5572('0x47')]);router['post'](_0x5572('0x48'),auth['isAuthenticated'](),controller['logout']);router[_0x5572('0x38')](_0x5572('0x49'),auth[_0x5572('0x8')](),controller[_0x5572('0x4a')]);router[_0x5572('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x5572('0x4b')]);router[_0x5572('0x38')](_0x5572('0x4c'),auth[_0x5572('0x8')](),controller[_0x5572('0x4d')]);router[_0x5572('0x38')](_0x5572('0x4e'),auth[_0x5572('0x8')](),controller[_0x5572('0x4f')]);router[_0x5572('0x38')](_0x5572('0x50'),auth[_0x5572('0x8')](),controller[_0x5572('0x51')]);router['post'](_0x5572('0x52'),auth['isAuthenticated'](),controller[_0x5572('0x53')]);router[_0x5572('0x38')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x5572('0x54')]);router[_0x5572('0x38')]('/:id/openchannel_interactions',auth[_0x5572('0x8')](),controller[_0x5572('0x55')]);router['post'](_0x5572('0x56'),auth['isAuthenticated'](),controller[_0x5572('0x57')]);router[_0x5572('0x38')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x58')]);router['post'](_0x5572('0x2c'),auth[_0x5572('0x8')](),controller[_0x5572('0x59')]);router[_0x5572('0x38')](_0x5572('0x2e'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0x5572('0x8')](),controller['addSmsAccounts']);router[_0x5572('0x38')](_0x5572('0x31'),auth[_0x5572('0x8')](),controller[_0x5572('0x5a')]);router['post'](_0x5572('0x5b'),auth[_0x5572('0x8')](),controller[_0x5572('0x5c')]);router[_0x5572('0x38')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller[_0x5572('0x5d')]);router[_0x5572('0x38')](_0x5572('0x37'),auth[_0x5572('0x8')](),controller[_0x5572('0x5e')]);router['put']('/:id',auth[_0x5572('0x8')](),controller['update']);router[_0x5572('0x5f')](_0x5572('0x60'),auth[_0x5572('0x8')](),controller['changePassword']);router['delete'](_0x5572('0x12'),auth[_0x5572('0x8')](),controller[_0x5572('0x61')]);router[_0x5572('0x62')](_0x5572('0x4c'),auth[_0x5572('0x8')](),controller[_0x5572('0x63')]);router[_0x5572('0x62')](_0x5572('0xe'),auth[_0x5572('0x8')](),controller['destroy']);router[_0x5572('0x62')](_0x5572('0x4e'),auth['isAuthenticated'](),controller[_0x5572('0x64')]);router[_0x5572('0x62')](_0x5572('0x50'),auth[_0x5572('0x8')](),controller[_0x5572('0x65')]);router[_0x5572('0x62')](_0x5572('0x52'),auth['isAuthenticated'](),controller[_0x5572('0x66')]);router[_0x5572('0x62')](_0x5572('0x67'),auth[_0x5572('0x8')](),controller['removeSmsInteractions']);router[_0x5572('0x62')](_0x5572('0x68'),auth[_0x5572('0x8')](),controller[_0x5572('0x69')]);router[_0x5572('0x62')]('/:id/whatsapp_interactions',auth[_0x5572('0x8')](),controller['removeWhatsappInteractions']);router[_0x5572('0x62')](_0x5572('0x2a'),auth[_0x5572('0x8')](),controller[_0x5572('0x6a')]);router['delete'](_0x5572('0x2c'),auth['isAuthenticated'](),controller[_0x5572('0x6b')]);router[_0x5572('0x62')](_0x5572('0x2e'),auth['isAuthenticated'](),controller[_0x5572('0x6c')]);router[_0x5572('0x62')](_0x5572('0x2f'),auth[_0x5572('0x8')](),controller[_0x5572('0x6d')]);router[_0x5572('0x62')]('/:id/chat_websites',auth[_0x5572('0x8')](),controller[_0x5572('0x6e')]);router[_0x5572('0x62')](_0x5572('0x5b'),auth[_0x5572('0x8')](),controller[_0x5572('0x6f')]);router[_0x5572('0x62')](_0x5572('0x33'),auth[_0x5572('0x8')](),controller['removeSquareProjects']);router['delete'](_0x5572('0x37'),auth[_0x5572('0x8')](),controller[_0x5572('0x70')]);module[_0x5572('0x71')]=router; \ No newline at end of file +var _0x2b17=['removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','/:id/contacts','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x2b17,0x16f));var _0x72b1=function(_0x577afc,_0x2b74b1){_0x577afc=_0x577afc-0x0;var _0x1f0d1e=_0x2b17[_0x577afc];return _0x1f0d1e;};'use strict';var multer=require(_0x72b1('0x0'));var util=require('util');var path=require(_0x72b1('0x1'));var timeout=require(_0x72b1('0x2'));var express=require(_0x72b1('0x3'));var router=express[_0x72b1('0x4')]();var auth=require(_0x72b1('0x5'));var interaction=require(_0x72b1('0x6'));var config=require(_0x72b1('0x7'));var controller=require(_0x72b1('0x8'));router[_0x72b1('0x9')]('/',auth['isAuthenticated'](),controller[_0x72b1('0xa')]);router[_0x72b1('0x9')](_0x72b1('0xb'),auth[_0x72b1('0xc')](),controller[_0x72b1('0xd')]);router['get'](_0x72b1('0xe'),auth[_0x72b1('0xc')](),controller[_0x72b1('0xf')]);router[_0x72b1('0x9')]('/:id',auth[_0x72b1('0xc')](),controller[_0x72b1('0x10')]);router[_0x72b1('0x9')](_0x72b1('0x11'),controller[_0x72b1('0x12')]);router['get']('/:id/contacts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x13')]);router[_0x72b1('0x9')](_0x72b1('0x14'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x15')]);router['get'](_0x72b1('0x16'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x17')]);router['get']('/:id/groups',auth[_0x72b1('0xc')](),controller[_0x72b1('0x18')]);router[_0x72b1('0x9')]('/:id/recordings',auth[_0x72b1('0xc')](),controller['getRecordings']);router[_0x72b1('0x9')]('/:id/screen_recordings',auth[_0x72b1('0xc')](),controller['getScreenRecordings']);router[_0x72b1('0x9')](_0x72b1('0x19'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x1a')]);router[_0x72b1('0x9')](_0x72b1('0x1b'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x1c')]);router['get'](_0x72b1('0x1d'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x1e')]);router[_0x72b1('0x9')](_0x72b1('0x1f'),auth['isAuthenticated'](),controller[_0x72b1('0x20')]);router[_0x72b1('0x9')](_0x72b1('0x21'),auth['isAuthenticated'](),controller[_0x72b1('0x22')]);router[_0x72b1('0x9')](_0x72b1('0x23'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x24')]);router[_0x72b1('0x9')](_0x72b1('0x25'),auth['isAuthenticated'](),controller[_0x72b1('0x26')]);router[_0x72b1('0x9')](_0x72b1('0x27'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x28')]);router[_0x72b1('0x9')](_0x72b1('0x29'),auth['isAuthenticated'](),controller[_0x72b1('0x2a')]);router['get']('/:id/prefixes',auth[_0x72b1('0xc')](),controller[_0x72b1('0x2b')]);router[_0x72b1('0x9')](_0x72b1('0x2c'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get'](_0x72b1('0x2d'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x2e')]);router[_0x72b1('0x9')](_0x72b1('0x2f'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x30')]);router[_0x72b1('0x9')]('/:id/sms_accounts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x31')]);router[_0x72b1('0x9')](_0x72b1('0x32'),auth['isAuthenticated'](),controller[_0x72b1('0x33')]);router[_0x72b1('0x9')](_0x72b1('0x34'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x35')]);router[_0x72b1('0x9')](_0x72b1('0x36'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0x72b1('0x9')](_0x72b1('0x37'),auth[_0x72b1('0xc')](),controller['getScheduledCalls']);router[_0x72b1('0x9')](_0x72b1('0x38'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x39')]);router[_0x72b1('0x3a')](_0x72b1('0x3b'),auth['isAuthenticated'](),controller[_0x72b1('0x3c')]);router[_0x72b1('0x3a')](_0x72b1('0x3d'),auth['isAuthenticated'](),controller[_0x72b1('0x3e')]);router[_0x72b1('0x3a')]('/',auth['isAuthenticated'](),controller[_0x72b1('0x3f')]);router[_0x72b1('0x3a')]('/:id/queues',auth[_0x72b1('0xc')](),controller[_0x72b1('0x40')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e49f2,_0xd3751c,_0x1f1728){_0x1f1728(null,path[_0x72b1('0x41')](config[_0x72b1('0x42')],_0x72b1('0x43')));},'filename':function(_0x34cbdd,_0x52df96,_0x52194d){_0x52194d(null,util[_0x72b1('0x44')](_0x72b1('0x45'),Date[_0x72b1('0x46')](),_0x52df96[_0x72b1('0x47')]));}})});router['post'](_0x72b1('0x11'),upload[_0x72b1('0x48')](_0x72b1('0x49')),controller[_0x72b1('0x4a')]);router[_0x72b1('0x3a')](_0x72b1('0x4b'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x4c')]);router[_0x72b1('0x3a')](_0x72b1('0x4d'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x4e')]);router[_0x72b1('0x3a')](_0x72b1('0x4f'),auth[_0x72b1('0xc')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x72b1('0x50')]);router['post'](_0x72b1('0x25'),auth['isAuthenticated'](),controller[_0x72b1('0x51')]);router[_0x72b1('0x3a')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x72b1('0x52')]);router[_0x72b1('0x3a')]('/:id/mail_interactions',auth[_0x72b1('0xc')](),controller[_0x72b1('0x53')]);router['post'](_0x72b1('0x54'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x55')]);router[_0x72b1('0x3a')]('/:id/sms_interactions',auth[_0x72b1('0xc')](),controller[_0x72b1('0x56')]);router[_0x72b1('0x3a')](_0x72b1('0x57'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x58')]);router['post']('/:id/whatsapp_interactions',auth[_0x72b1('0xc')](),controller[_0x72b1('0x59')]);router[_0x72b1('0x3a')]('/:id/fax_accounts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x5a')]);router[_0x72b1('0x3a')](_0x72b1('0x2d'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x5b')]);router['post'](_0x72b1('0x2f'),auth[_0x72b1('0xc')](),controller['addOpenchannelAccounts']);router[_0x72b1('0x3a')](_0x72b1('0x5c'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x5d')]);router[_0x72b1('0x3a')](_0x72b1('0x32'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x5e')]);router['post']('/:id/whatsapp_accounts',auth[_0x72b1('0xc')](),controller['addWhatsappAccounts']);router[_0x72b1('0x3a')](_0x72b1('0x36'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x5f')]);router['post'](_0x72b1('0x38'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x60')]);router[_0x72b1('0x61')](_0x72b1('0x62'),auth[_0x72b1('0xc')](),controller['update']);router['put'](_0x72b1('0x63'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x64')]);router[_0x72b1('0x65')](_0x72b1('0x14'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x66')]);router[_0x72b1('0x65')](_0x72b1('0x25'),auth[_0x72b1('0xc')](),controller['removeTeams']);router[_0x72b1('0x65')](_0x72b1('0x62'),auth['isAuthenticated'](),controller[_0x72b1('0x67')]);router[_0x72b1('0x65')](_0x72b1('0x68'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x69')]);router[_0x72b1('0x65')](_0x72b1('0x6a'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x6b')]);router[_0x72b1('0x65')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x72b1('0x65')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x72b1('0x6c')]);router[_0x72b1('0x65')](_0x72b1('0x57'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x6d')]);router[_0x72b1('0x65')](_0x72b1('0x6e'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x6f')]);router['delete'](_0x72b1('0x2c'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x70')]);router[_0x72b1('0x65')](_0x72b1('0x2d'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x71')]);router[_0x72b1('0x65')]('/:id/openchannel_accounts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x72')]);router['delete']('/:id/sms_accounts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x73')]);router[_0x72b1('0x65')](_0x72b1('0x32'),auth[_0x72b1('0xc')](),controller[_0x72b1('0x74')]);router['delete']('/:id/whatsapp_accounts',auth[_0x72b1('0xc')](),controller[_0x72b1('0x75')]);router[_0x72b1('0x65')](_0x72b1('0x36'),auth[_0x72b1('0xc')](),controller['removeSquareProjects']);router[_0x72b1('0x65')](_0x72b1('0x38'),auth['isAuthenticated'](),controller[_0x72b1('0x76')]);module[_0x72b1('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d9d16e8..17aecfb 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 _0xc9c2=['format','\x22%s\x22\x20<%s>','getDataValue','internal','ENUM','user','telephone','local','INTEGER','callerid','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','info','inband','auto','rfc2833','yes','nonat','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','originate','uas','fingerprint','certificate','passive','update,nonat','showWebBar','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xc9c2,0x19e));var _0x2c9c=function(_0x3666dc,_0x18701a){_0x3666dc=_0x3666dc-0x0;var _0x31c942=_0xc9c2[_0x3666dc];return _0x31c942;};'use strict';var Sequelize=require(_0x2c9c('0x0'));var moment=require(_0x2c9c('0x1'));var util=require(_0x2c9c('0x2'));var _=require(_0x2c9c('0x3'));module[_0x2c9c('0x4')]={'name':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'unique':_0x2c9c('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1eaa81){this[_0x2c9c('0x7')](_0x2c9c('0x6'),_0x1eaa81);this[_0x2c9c('0x7')](_0x2c9c('0x8'),_0x1eaa81);},'comment':_0x2c9c('0x9')},'fullname':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'set':function(_0x5935f7){this['setDataValue'](_0x2c9c('0xa'),_0x5935f7);this[_0x2c9c('0x7')]('callerid',util[_0x2c9c('0xb')](_0x2c9c('0xc'),_0x5935f7,this[_0x2c9c('0xd')](_0x2c9c('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x43431b){if(_0x43431b){this[_0x2c9c('0x7')]('email',_0x43431b['toLowerCase']());}}},'role':{'type':Sequelize[_0x2c9c('0xf')]('admin',_0x2c9c('0x10'),'agent',_0x2c9c('0x11')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':_0x2c9c('0x12')},'internal':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':![],'unique':_0x2c9c('0xe'),'set':function(_0x323073){this[_0x2c9c('0x7')]('internal',_0x323073);this[_0x2c9c('0x7')]('accountcode',_0x323073);this['setDataValue'](_0x2c9c('0x14'),util[_0x2c9c('0xb')]('\x22%s\x22\x20<%s>',this[_0x2c9c('0xd')](_0x2c9c('0xa')),_0x323073));}},'salt':{'type':Sequelize[_0x2c9c('0x5')]},'phone':{'type':Sequelize[_0x2c9c('0x5')]},'mobile':{'type':Sequelize[_0x2c9c('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2c9c('0x5')]},'city':{'type':Sequelize[_0x2c9c('0x5')]},'country':{'type':Sequelize[_0x2c9c('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x2c9c('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2c9c('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x17')},'ipaddr':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x2c9c('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x2c9c('0x18'),_0x2c9c('0x10'),'peer'),'allowNull':!![],'defaultValue':_0x2c9c('0x18')},'context':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x19')},'callingpres':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x1a'),_0x2c9c('0x1b'),_0x2c9c('0x1c'),_0x2c9c('0x1d'),_0x2c9c('0x1e'),_0x2c9c('0x1f'),_0x2c9c('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x21'),'set':function(_0x909aad){this['setDataValue'](_0x2c9c('0x22'),_0x909aad?_0x909aad[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x22'))?this[_0x2c9c('0xd')](_0x2c9c('0x22'))[_0x2c9c('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x2c9c('0x25'),'shortinfo',_0x2c9c('0x26'),_0x2c9c('0x27')),'allowNull':!![],'defaultValue':_0x2c9c('0x28')},'directmedia':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x2a'),'update',_0x2c9c('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2c9c('0x2c'),'set':function(_0x3ab603){this[_0x2c9c('0x7')](_0x2c9c('0x2d'),_0x3ab603?_0x3ab603[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x2d'))?this[_0x2c9c('0xd')](_0x2c9c('0x2d'))[_0x2c9c('0x24')](','):null;},'comment':_0x2c9c('0x2e')},'callgroup':{'type':Sequelize[_0x2c9c('0x5')]},'namedcallgroup':{'type':Sequelize[_0x2c9c('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2c9c('0x5')]},'language':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2c9c('0x5')]},'disallow':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':![],'defaultValue':_0x2c9c('0x2f'),'set':function(_0x1a2557){this[_0x2c9c('0x7')](_0x2c9c('0x30'),_0x1a2557?_0x1a2557['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2c9c('0x30'))?this[_0x2c9c('0xd')](_0x2c9c('0x30'))['split'](';'):null;},'comment':_0x2c9c('0x31')},'autoframing':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'set':function(_0x52ce07){this['setDataValue'](_0x2c9c('0x32'),_0x52ce07?_0x52ce07[_0x2c9c('0x23')](','):null);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x32'))?this[_0x2c9c('0xd')](_0x2c9c('0x32'))['split'](','):null;},'comment':_0x2c9c('0x33')},'trustrpid':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![],'defaultValue':_0x2c9c('0x35')},'amaflags':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':_0x2c9c('0x29')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no',_0x2c9c('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x37'),'refuse',_0x2c9c('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2c9c('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x2c9c('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x2c9c('0x29')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2c9c('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no',_0x2c9c('0x3a'),_0x2c9c('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2c9c('0xf')]('active',_0x2c9c('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2c9c('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x2c9c('0x29'),'no','nonat','update',_0x2c9c('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x2c9c('0x16')]},'showWebBar':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0,'set':function(_0x20d5d0){this[_0x2c9c('0x7')](_0x2c9c('0x3e'),_0x20d5d0);var _0x18ad56=this['get']({'plain':!![]});switch(_0x20d5d0){case 0x0:case 0x1:var _0x34b724=_0x18ad56['transport']?_[_0x2c9c('0x3f')](_0x18ad56[_0x2c9c('0x22')])?_0x18ad56['transport']['join']():_0x18ad56[_0x2c9c('0x22')]:_0x2c9c('0x21');if(_0x34b724==='wss'){_0x34b724='udp';}this['setDataValue'](_0x2c9c('0x22'),_0x34b724);this[_0x2c9c('0x7')](_0x2c9c('0x40'),'no');this[_0x2c9c('0x7')](_0x2c9c('0x41'),null);this[_0x2c9c('0x7')](_0x2c9c('0x42'),null);this[_0x2c9c('0x7')](_0x2c9c('0x43'),null);this[_0x2c9c('0x7')](_0x2c9c('0x44'),null);this[_0x2c9c('0x7')](_0x2c9c('0x45'),null);this['setDataValue']('dtlssetup',null);this[_0x2c9c('0x7')](_0x2c9c('0x46'),null);this[_0x2c9c('0x7')](_0x2c9c('0x47'),null);this[_0x2c9c('0x7')](_0x2c9c('0x48'),'no');break;case 0x2:this['setDataValue'](_0x2c9c('0x22'),'wss');this[_0x2c9c('0x7')](_0x2c9c('0x40'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x41'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x42'),_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x43'),_0x2c9c('0x29'));this[_0x2c9c('0x7')]('dtlsenable',_0x2c9c('0x29'));this[_0x2c9c('0x7')](_0x2c9c('0x45'),'no');this[_0x2c9c('0x7')](_0x2c9c('0x49'),'actpass');this[_0x2c9c('0x7')](_0x2c9c('0x46'),_0x18ad56[_0x2c9c('0x46')]||_0x2c9c('0x4a'));this['setDataValue']('dtlsprivatekey',_0x18ad56[_0x2c9c('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1eedbf){this[_0x2c9c('0x7')]('permissions',_0x1eedbf?_0x1eedbf[_0x2c9c('0x23')](','):[]);},'get':function(){return this[_0x2c9c('0xd')](_0x2c9c('0x4b'))?_['map'](this[_0x2c9c('0xd')](_0x2c9c('0x4b'))[_0x2c9c('0x24')](','),function(_0x331953){return parseInt(_0x331953,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2c9c('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x2c9c('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2c9c('0xf')](_0x2c9c('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2c9c('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2c9c('0x4c')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x2c9c('0xd')](_0x2c9c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x2c9c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2c9c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![],'set':function(_0x3f3aa2){if(typeof _0x3f3aa2===_0x2c9c('0x4e')){var _0x3f056a=_0x3f3aa2==='1'?!![]:_0x3f3aa2==='0'?![]:_0x3f3aa2===_0x2c9c('0x4f')?!![]:_0x3f3aa2===_0x2c9c('0x50')?![]:![];this[_0x2c9c('0x7')](_0x2c9c('0x51'),_0x3f056a);}else{this[_0x2c9c('0x7')]('screenrecording',_0x3f3aa2);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1a4bfd){this['setDataValue'](_0x2c9c('0x52'),_0x1a4bfd);if(_0x1a4bfd===!![]){this[_0x2c9c('0x7')](_0x2c9c('0x53'),moment());this[_0x2c9c('0x7')](_0x2c9c('0x54'),0x0);}else{this['setDataValue'](_0x2c9c('0x53'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2c9c('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2c9c('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x43cb=['ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','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','always','refuse','originate','uas','passive','actpass','update,nonat','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','user','telephone','local','INTEGER','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','ALLOWED_PASSED_SCREEN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43cb,0x189));var _0xb43c=function(_0x157366,_0x1ccb2d){_0x157366=_0x157366-0x0;var _0x17ae3f=_0x43cb[_0x157366];return _0x17ae3f;};'use strict';var Sequelize=require(_0xb43c('0x0'));var moment=require(_0xb43c('0x1'));var util=require(_0xb43c('0x2'));var _=require(_0xb43c('0x3'));module[_0xb43c('0x4')]={'name':{'type':Sequelize[_0xb43c('0x5')],'allowNull':![],'unique':_0xb43c('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x462862){this[_0xb43c('0x7')](_0xb43c('0x6'),_0x462862);this['setDataValue']('defaultuser',_0x462862);},'comment':_0xb43c('0x8')},'fullname':{'type':Sequelize[_0xb43c('0x5')],'allowNull':![],'set':function(_0x119b63){this['setDataValue']('fullname',_0x119b63);this[_0xb43c('0x7')](_0xb43c('0x9'),util[_0xb43c('0xa')](_0xb43c('0xb'),_0x119b63,this[_0xb43c('0xc')](_0xb43c('0xd'))));}},'alias':{'type':Sequelize[_0xb43c('0x5')]},'email':{'type':Sequelize[_0xb43c('0x5')],'allowNull':![],'unique':_0xb43c('0xe'),'validate':{'isEmail':!![]},'set':function(_0x47a416){if(_0x47a416){this['setDataValue'](_0xb43c('0xe'),_0x47a416['toLowerCase']());}}},'role':{'type':Sequelize[_0xb43c('0xf')]('admin',_0xb43c('0x10'),'agent',_0xb43c('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xb43c('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xb43c('0x12')},'internal':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0xe56fda){this[_0xb43c('0x7')](_0xb43c('0xd'),_0xe56fda);this[_0xb43c('0x7')]('accountcode',_0xe56fda);this['setDataValue']('callerid',util['format'](_0xb43c('0xb'),this['getDataValue'](_0xb43c('0x14')),_0xe56fda));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb43c('0x5')]},'mobile':{'type':Sequelize[_0xb43c('0x5')]},'address':{'type':Sequelize[_0xb43c('0x5')]},'zipcode':{'type':Sequelize[_0xb43c('0x5')]},'userpic':{'type':Sequelize[_0xb43c('0x5')]},'city':{'type':Sequelize[_0xb43c('0x5')]},'country':{'type':Sequelize[_0xb43c('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb43c('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb43c('0x5')],'defaultValue':_0xb43c('0x17')},'lastPauseAt':{'type':Sequelize[_0xb43c('0x15')]},'chatCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb43c('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb43c('0x18')},'ipaddr':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xb43c('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x19'),_0xb43c('0x10'),'peer'),'allowNull':!![],'defaultValue':_0xb43c('0x19')},'context':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xb43c('0xf')]('ALLOWED_NOT_SCREENED',_0xb43c('0x1a'),_0xb43c('0x1b'),'ALLOWED',_0xb43c('0x1c'),_0xb43c('0x1d'),'PROHIB_FAILED_SCREEN',_0xb43c('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x579640){this['setDataValue'](_0xb43c('0x1f'),_0x579640?_0x579640[_0xb43c('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xb43c('0x1f'))?this['getDataValue'](_0xb43c('0x1f'))[_0xb43c('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x22'),_0xb43c('0x23'),_0xb43c('0x24'),_0xb43c('0x25'),_0xb43c('0x26')),'allowNull':!![],'defaultValue':_0xb43c('0x22')},'directmedia':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no',_0xb43c('0x28'),_0xb43c('0x29'),_0xb43c('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x501143){this[_0xb43c('0x7')](_0xb43c('0x2b'),_0x501143?_0x501143[_0xb43c('0x20')](','):null);},'get':function(){return this[_0xb43c('0xc')]('nat')?this[_0xb43c('0xc')](_0xb43c('0x2b'))[_0xb43c('0x21')](','):null;},'comment':_0xb43c('0x2c')},'callgroup':{'type':Sequelize[_0xb43c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xb43c('0x5')]},'pickupgroup':{'type':Sequelize[_0xb43c('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb43c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb43c('0x5')]},'disallow':{'type':Sequelize[_0xb43c('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb43c('0x2d'),'set':function(_0x1554c4){this[_0xb43c('0x7')]('allow',_0x1554c4?_0x1554c4[_0xb43c('0x20')](';'):_0xb43c('0x2d'));},'get':function(){return this[_0xb43c('0xc')](_0xb43c('0x2e'))?this[_0xb43c('0xc')](_0xb43c('0x2e'))[_0xb43c('0x21')](';'):null;},'comment':_0xb43c('0x2f')},'autoframing':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![],'set':function(_0x4fb3c6){this[_0xb43c('0x7')](_0xb43c('0x30'),_0x4fb3c6?_0x4fb3c6[_0xb43c('0x20')](','):null);},'get':function(){return this[_0xb43c('0xc')]('insecure')?this[_0xb43c('0xc')](_0xb43c('0x30'))[_0xb43c('0x21')](','):null;},'comment':_0xb43c('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0xb43c('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no',_0xb43c('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0xb43c('0x27')},'busylevel':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xb43c('0x27'),'no',_0xb43c('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xb43c('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb43c('0xf')]('accept',_0xb43c('0x34'),_0xb43c('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb43c('0xf')]('uac',_0xb43c('0x36')),'allowNull':!![],'defaultValue':_0xb43c('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xb43c('0x27'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb43c('0xf')]('active',_0xb43c('0x37'),_0xb43c('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb43c('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb43c('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xb43c('0x27'),'no',_0xb43c('0x28'),_0xb43c('0x29'),_0xb43c('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb43c('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xb43c('0x15')]},'showWebBar':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0,'set':function(_0x19fa6b){this[_0xb43c('0x7')](_0xb43c('0x3a'),_0x19fa6b);var _0x34adda=this[_0xb43c('0x3b')]({'plain':!![]});switch(_0x19fa6b){case 0x0:case 0x1:var _0x52e718=_0x34adda[_0xb43c('0x1f')]?_[_0xb43c('0x3c')](_0x34adda[_0xb43c('0x1f')])?_0x34adda[_0xb43c('0x1f')]['join']():_0x34adda['transport']:_0xb43c('0x3d');if(_0x52e718===_0xb43c('0x3e')){_0x52e718=_0xb43c('0x3d');}this['setDataValue'](_0xb43c('0x1f'),_0x52e718);this[_0xb43c('0x7')](_0xb43c('0x3f'),'no');this[_0xb43c('0x7')](_0xb43c('0x40'),null);this[_0xb43c('0x7')](_0xb43c('0x41'),null);this[_0xb43c('0x7')](_0xb43c('0x42'),null);this[_0xb43c('0x7')](_0xb43c('0x43'),null);this[_0xb43c('0x7')](_0xb43c('0x44'),null);this[_0xb43c('0x7')](_0xb43c('0x45'),null);this['setDataValue'](_0xb43c('0x46'),null);this[_0xb43c('0x7')](_0xb43c('0x47'),null);this['setDataValue'](_0xb43c('0x48'),'no');break;case 0x2:this[_0xb43c('0x7')](_0xb43c('0x1f'),'wss');this[_0xb43c('0x7')](_0xb43c('0x3f'),_0xb43c('0x27'));this[_0xb43c('0x7')](_0xb43c('0x40'),_0xb43c('0x27'));this['setDataValue']('force_avp',_0xb43c('0x27'));this['setDataValue'](_0xb43c('0x42'),_0xb43c('0x27'));this[_0xb43c('0x7')](_0xb43c('0x43'),_0xb43c('0x27'));this['setDataValue'](_0xb43c('0x44'),'no');this[_0xb43c('0x7')](_0xb43c('0x45'),'actpass');this[_0xb43c('0x7')](_0xb43c('0x46'),_0x34adda[_0xb43c('0x46')]||_0xb43c('0x49'));this['setDataValue'](_0xb43c('0x47'),_0x34adda['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xb43c('0x7')](_0xb43c('0x48'),_0xb43c('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0xb43c('0x4a')],'set':function(_0xfa4a0){this[_0xb43c('0x7')](_0xb43c('0x4b'),_0xfa4a0?_0xfa4a0[_0xb43c('0x20')](','):[]);},'get':function(){return this[_0xb43c('0xc')](_0xb43c('0x4b'))?_[_0xb43c('0x4c')](this[_0xb43c('0xc')](_0xb43c('0x4b'))[_0xb43c('0x21')](','),function(_0x2cee39){return parseInt(_0x2cee39,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb43c('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xb43c('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xb43c('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xb43c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb43c('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb43c('0xf')](_0xb43c('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb43c('0x5')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xb43c('0x4d'))?this['getDataValue'](_0xb43c('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb43c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb43c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3fd053){if(typeof _0x3fd053===_0xb43c('0x4e')){var _0x38f453=_0x3fd053==='1'?!![]:_0x3fd053==='0'?![]:_0x3fd053===_0xb43c('0x4f')?!![]:_0x3fd053==='false'?![]:![];this[_0xb43c('0x7')](_0xb43c('0x50'),_0x38f453);}else{this[_0xb43c('0x7')](_0xb43c('0x50'),_0x3fd053);}}},'blocked':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![],'set':function(_0x25287c){this['setDataValue'](_0xb43c('0x51'),_0x25287c);if(_0x25287c===!![]){this[_0xb43c('0x7')](_0xb43c('0x52'),moment());this['setDataValue'](_0xb43c('0x53'),0x0);}else{this[_0xb43c('0x7')](_0xb43c('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xb43c('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb43c('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index dd69d36..0666b32 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 _0xc434=['$eq','$not','$between','$like','$notLike','$iLike','$overlap','$contains','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','Users','Agents','agent','telephone','filter','ignore','map','includes','role','find','value','name','UserProfileResource','index','User','rawAttributes','fieldName','type','key','password','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','sequelize','lower','includeAll','include','findAll','rows','catch','show','params','differenceBy','salt','options','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','admin','user','getLicense','telephones','users','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','isNil','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','113','110','104','105','106','108','109','100','111','114','Telephones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','newPassword','Sequelize','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','push','SIP/%s','each','UserVoiceQueueRt','upsert','remove','Queues','Queue:remove','addAvatar','userpic','file','root','download','existsSync','join','server/files/images/','getContacts','findOne','CmContact','order','Tags','color','tag','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','PAUSE','LOGININPAUSE','resolve','logout','pause','update','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','mail','chat','fax','whatsapp','openchannel','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','Chat','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','Mail','CmList','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','isArray','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','concat','$and','$gt','$gte','$lte','$ne'];(function(_0xb09541,_0x4ea45f){var _0x5dd3c3=function(_0x48fe66){while(--_0x48fe66){_0xb09541['push'](_0xb09541['shift']());}};_0x5dd3c3(++_0x4ea45f);}(_0xc434,0x17b));var _0x4c43=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc434[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x4c43('0x0'));var emlformat=require(_0x4c43('0x1'));var rimraf=require(_0x4c43('0x2'));var zipdir=require(_0x4c43('0x3'));var jsonpatch=require(_0x4c43('0x4'));var rp=require(_0x4c43('0x5'));var moment=require(_0x4c43('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4c43('0x7'));var util=require(_0x4c43('0x8'));var path=require(_0x4c43('0x9'));var sox=require(_0x4c43('0xa'));var csv=require(_0x4c43('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c43('0xc'));var squel=require(_0x4c43('0xd'));var crypto=require('crypto');var jsforce=require(_0x4c43('0xe'));var deskjs=require(_0x4c43('0xf'));var toCsv=require(_0x4c43('0xb'));var querystring=require(_0x4c43('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4c43('0x11'));var qs=require(_0x4c43('0x12'));var as=require(_0x4c43('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c43('0x14'))('api');var utils=require(_0x4c43('0x15'));var config=require(_0x4c43('0x16'));var db=require(_0x4c43('0x17'))['db'];config[_0x4c43('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c43('0x19'))(new Redis(config[_0x4c43('0x18')]));require('./user.socket')[_0x4c43('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c43('0x1b')][_0x4c43('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x57b86b,_0x581bd1,_0xc2715){if(_0xc2715){var _0xaa8703=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaa8703[_0x4c43('0x1d')](_0x581bd1)){return _0x57b86b;}else{throw new db['Sequelize'][(_0x4c43('0x1e'))](_0x4c43('0x1f'));}}else{return _0x57b86b;}}function respondWithRpcPromise(_0x40f1a2,_0x4f1fb4,_0x15c9ee,_0x356d6b){return new BPromise(function(_0x3791ad,_0x3dae07){var _0x4526ea=_0x356d6b||client;return _0x4526ea['request'](_0x40f1a2,_0x15c9ee)[_0x4c43('0x20')](function(_0x39c9dd){logger[_0x4c43('0x21')](_0x4c43('0x22'),_0x4f1fb4,_0x4c43('0x23'));logger[_0x4c43('0x24')](_0x4c43('0x25'),_0x4f1fb4,_0x4c43('0x23'),JSON[_0x4c43('0x26')](_0x39c9dd));if(_0x39c9dd[_0x4c43('0x27')]){if(_0x39c9dd[_0x4c43('0x27')][_0x4c43('0x28')]===0x1f4){logger[_0x4c43('0x27')](_0x4c43('0x22'),_0x4f1fb4,_0x39c9dd[_0x4c43('0x27')][_0x4c43('0x29')]);return _0x3dae07(_0x39c9dd[_0x4c43('0x27')][_0x4c43('0x29')]);}logger['error'](_0x4c43('0x22'),_0x4f1fb4,_0x39c9dd[_0x4c43('0x27')][_0x4c43('0x29')]);return _0x3791ad(_0x39c9dd[_0x4c43('0x27')][_0x4c43('0x29')]);}else{logger[_0x4c43('0x21')](_0x4c43('0x22'),_0x4f1fb4,_0x4c43('0x23'));_0x3791ad(_0x39c9dd[_0x4c43('0x2a')][_0x4c43('0x29')]);}})['catch'](function(_0x21dfdb){logger['error']('User,\x20%s,\x20%s',_0x4f1fb4,_0x21dfdb);_0x3dae07(_0x21dfdb);});});}function respondWithStatusCode(_0xc7c2ef,_0x1278bd){_0x1278bd=_0x1278bd||0xcc;return function(_0x189439){if(_0x189439){return _0xc7c2ef[_0x4c43('0x2b')](_0x1278bd);}return _0xc7c2ef['status'](_0x1278bd)['end']();};}function respondWithResult(_0x2dcef3,_0x48ea8e){_0x48ea8e=_0x48ea8e||0xc8;return function(_0x55f85c){if(_0x55f85c){return _0x2dcef3[_0x4c43('0x2c')](_0x48ea8e)['json'](_0x55f85c);}};}function respondWithFilteredResult(_0x40c79a,_0x54066d){return function(_0x42c7ef){if(_0x42c7ef){var _0x4a7560=_0x42c7ef[_0x4c43('0x2d')],_0x447ab5=_0x54066d[_0x4c43('0x2e')],_0x34a916=_0x54066d['offset']+_0x54066d[_0x4c43('0x2f')],_0x4a2edc;if(_0x34a916>=_0x4a7560){_0x34a916=_0x4a7560;_0x4a2edc=0xc8;}else{_0x4a2edc=0xce;}_0x40c79a[_0x4c43('0x2c')](_0x4a2edc);return _0x40c79a[_0x4c43('0x30')](_0x4c43('0x31'),_0x447ab5+'-'+_0x34a916+'/'+_0x4a7560)[_0x4c43('0x32')](_0x42c7ef);}return null;};}function patchUpdates(_0x1af122){return function(_0xaaa16b){try{jsonpatch[_0x4c43('0x33')](_0xaaa16b,_0x1af122,!![]);}catch(_0x14383e){return BPromise[_0x4c43('0x34')](_0x14383e);}return _0xaaa16b[_0x4c43('0x35')]();};}function saveUpdates(_0x5001d0,_0x26ffb1){return function(_0x4787e6){if(_0x4787e6){return _0x4787e6['update'](_0x5001d0)[_0x4c43('0x20')](function(_0x5ab151){return _0x5ab151;});}return null;};}function removeEntity(_0xc8c668,_0x1958cd){return function(_0x5ad4b7){if(_0x5ad4b7){return _0x5ad4b7[_0x4c43('0x36')]()['then'](function(){var _0x111fd2=_0x5ad4b7[_0x4c43('0x37')]({'plain':!![]});var _0x572814=[{'name':_0x4c43('0x38'),'value':'user','ignore':!![]},{'name':_0x4c43('0x39'),'value':_0x4c43('0x3a'),'ignore':![]},{'name':'Telephones','value':_0x4c43('0x3b'),'ignore':![]}];var _0x853488=_(_0x572814)[_0x4c43('0x3c')](_0x4c43('0x3d'))[_0x4c43('0x3e')]('value')['value']();if(_[_0x4c43('0x3f')](_0x853488,_0x111fd2[_0x4c43('0x40')])){return;}var _0x5a064c=_[_0x4c43('0x41')](_0x572814,[_0x4c43('0x42'),_0x111fd2[_0x4c43('0x40')]])[_0x4c43('0x43')];return db[_0x4c43('0x44')][_0x4c43('0x36')]({'where':{'type':_0x5a064c,'resourceId':_0x111fd2['id']}})[_0x4c43('0x20')](function(){return _0x5ad4b7;});})[_0x4c43('0x20')](function(){_0xc8c668[_0x4c43('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d94a,_0x4067de){return function(_0x3d601a){if(!_0x3d601a){_0x11d94a[_0x4c43('0x2b')](0x194);}return _0x3d601a;};}function handleError(_0x500c29,_0x507556){_0x507556=_0x507556||0x1f4;return function(_0x25e75b){logger['error'](_0x25e75b['stack']);if(_0x25e75b[_0x4c43('0x43')]){delete _0x25e75b[_0x4c43('0x43')];}_0x500c29[_0x4c43('0x2c')](_0x507556)['send'](_0x25e75b);};}exports[_0x4c43('0x45')]=function(_0x517d1c,_0x2a9406){var _0x5c9bea={},_0x412ab5={},_0x4494a6={'count':0x0,'rows':[]};var _0x1cf095=_['map'](db[_0x4c43('0x46')][_0x4c43('0x47')],function(_0x32927a){return{'name':_0x32927a[_0x4c43('0x48')],'type':_0x32927a[_0x4c43('0x49')][_0x4c43('0x4a')]};});_0x412ab5['model']=_['differenceBy'](_[_0x4c43('0x3e')](_0x1cf095,_0x4c43('0x43')),[_0x4c43('0x4b'),'salt']);_0x412ab5[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x517d1c['query']);_0x412ab5[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x412ab5['model'],_0x412ab5['query']);_0x5c9bea[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x412ab5[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x517d1c['query'][_0x4c43('0x52')]));_0x5c9bea[_0x4c43('0x50')]=_0x5c9bea['attributes'][_0x4c43('0x53')]?_0x5c9bea[_0x4c43('0x50')]:_0x412ab5[_0x4c43('0x51')];if(!_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x5c9bea['limit']=qs[_0x4c43('0x2f')](_0x517d1c[_0x4c43('0x4c')]['limit']);_0x5c9bea[_0x4c43('0x2e')]=qs['offset'](_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x5c9bea['order']=qs[_0x4c43('0x56')](_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x5c9bea[_0x4c43('0x57')]=qs['filters'](_[_0x4c43('0x58')](_0x517d1c['query'],_0x412ab5['filters']),_0x1cf095);if(_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x5c9bea[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x5c9bea[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x1cf095,function(_0x29e8a5){if(_0x29e8a5['type']!=='VIRTUAL'){return db['sequelize'][_0x4c43('0x57')](db[_0x4c43('0x5a')]['fn']('lower',db[_0x4c43('0x5a')]['col'](_0x29e8a5[_0x4c43('0x43')])),{'$like':db[_0x4c43('0x5a')]['fn'](_0x4c43('0x5b'),'%'+_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%')});}})});}_0x5c9bea=_[_0x4c43('0x59')]({},_0x5c9bea,_0x517d1c['options']);var _0x38d934={'where':_0x5c9bea[_0x4c43('0x57')]};return db['User'][_0x4c43('0x2d')](_0x38d934)[_0x4c43('0x20')](function(_0x2cf036){_0x4494a6[_0x4c43('0x2d')]=_0x2cf036;if(_0x517d1c[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x5c9bea[_0x4c43('0x5d')]=[{'all':!![]}];}return db['User'][_0x4c43('0x5e')](_0x5c9bea);})[_0x4c43('0x20')](function(_0x3e8a53){_0x4494a6[_0x4c43('0x5f')]=_0x3e8a53;return _0x4494a6;})[_0x4c43('0x20')](respondWithFilteredResult(_0x2a9406,_0x5c9bea))[_0x4c43('0x60')](handleError(_0x2a9406,null));};exports[_0x4c43('0x61')]=function(_0x353afd,_0xc72c6b){var _0x40d4a5={'raw':![],'where':{'id':_0x353afd[_0x4c43('0x62')]['id']}},_0xdf4463={};_0xdf4463[_0x4c43('0x51')]=_[_0x4c43('0x63')](_['keys'](db['User'][_0x4c43('0x47')]),[_0x4c43('0x4b'),_0x4c43('0x64')]);_0xdf4463['query']=_['keys'](_0x353afd[_0x4c43('0x4c')]);_0xdf4463[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0xdf4463[_0x4c43('0x51')],_0xdf4463[_0x4c43('0x4c')]);_0x40d4a5[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0xdf4463['model'],qs[_0x4c43('0x52')](_0x353afd[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x40d4a5[_0x4c43('0x50')]=_0x40d4a5['attributes'][_0x4c43('0x53')]?_0x40d4a5[_0x4c43('0x50')]:_0xdf4463[_0x4c43('0x51')];if(_0x353afd[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x40d4a5['include']=[{'all':!![]}];}_0x40d4a5=_['merge']({},_0x40d4a5,_0x353afd[_0x4c43('0x65')]);return db['User'][_0x4c43('0x41')](_0x40d4a5)[_0x4c43('0x20')](handleEntityNotFound(_0xc72c6b,null))[_0x4c43('0x20')](respondWithResult(_0xc72c6b,null))[_0x4c43('0x60')](handleError(_0xc72c6b,null));};exports[_0x4c43('0x66')]=function(_0x3fff95,_0x51a79f){return db[_0x4c43('0x46')]['bulkCreate'](_0x3fff95[_0x4c43('0x67')],{'raw':![],'individualHooks':!![]})[_0x4c43('0x20')](respondWithResult(_0x51a79f,0xc9))['catch'](handleError(_0x51a79f,null));};exports['update']=function(_0x5ddd8c,_0x497f24){if(_0x5ddd8c['body']['id']){delete _0x5ddd8c['body']['id'];}delete _0x5ddd8c[_0x4c43('0x67')]['role'];return db['User'][_0x4c43('0x41')]({'where':{'id':_0x5ddd8c['params']['id']}})['then'](handleEntityNotFound(_0x497f24,null))[_0x4c43('0x20')](saveUpdates(_0x5ddd8c[_0x4c43('0x67')],null))['then'](respondWithResult(_0x497f24,null))[_0x4c43('0x60')](handleError(_0x497f24,null));};exports[_0x4c43('0x68')]=function(_0x58b87e,_0x417482){return db['User']['describe']()[_0x4c43('0x20')](respondWithResult(_0x417482,null))[_0x4c43('0x60')](handleError(_0x417482,null));};exports[_0x4c43('0x69')]=function(_0x2ebb8d,_0x279ffc,_0x10ff9d){return db['User'][_0x4c43('0x41')]({'where':{'id':_0x2ebb8d[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x279ffc,null))[_0x4c43('0x20')](function(_0x2e0577){if(_0x2e0577){return _0x2e0577['addContacts'](_0x2ebb8d[_0x4c43('0x67')][_0x4c43('0x6a')],_[_0x4c43('0x6b')](_0x2ebb8d[_0x4c43('0x67')],['ids','id'])||{});}})[_0x4c43('0x20')](respondWithResult(_0x279ffc,null))[_0x4c43('0x60')](handleError(_0x279ffc,null));};var getLicense=function(_0x42afe1){return new BPromise(function(_0x3e346e,_0x137e6f){var _0x116c2e=0x0;_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3a')&&_0x3e346e(_0x4c43('0x6c'));return db[_0x4c43('0x46')][_0x4c43('0x2d')]({'where':{'$or':[{'role':_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3b')?_0x4c43('0x3b'):[_0x4c43('0x6d'),_0x4c43('0x6e')]}]}})['then'](function(_0x1e31bc){_0x116c2e=_0x1e31bc;return require('../../config/license/util')[_0x4c43('0x6f')]();})[_0x4c43('0x20')](function(_0xcd44d0){var _0x24007d=_0x42afe1[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3b')?_0x4c43('0x70'):_0x4c43('0x71');if(!_['isNil'](_0xcd44d0[_0x24007d])&&_0x116c2e>=_0xcd44d0[_0x24007d]){return _0x137e6f({'message':_0x4c43('0x72')});}return _0x3e346e(util[_0x4c43('0x73')](_0x4c43('0x74'),_0x24007d,_0x116c2e));})['catch'](function(_0x4b65bc){return _0x137e6f(_0x4b65bc);});});};exports[_0x4c43('0x75')]=function(_0x2177cb,_0x4001b5){return getLicense(_0x2177cb)[_0x4c43('0x20')](function(_0x534686){if(!_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]){var _0x334271;return db[_0x4c43('0x77')][_0x4c43('0x78')](0x1)['then'](function(_0x37980b){return checkPasswordPattern(_0x37980b,_0x2177cb[_0x4c43('0x67')][_0x4c43('0x4b')],_0x37980b[_0x4c43('0x79')]);})[_0x4c43('0x20')](function(_0x477820){_0x334271=_0x477820['min_internal'];return db[_0x4c43('0x46')]['max']('internal');})[_0x4c43('0x20')](function(_0xc8a86b){if(_['isNil'](_0xc8a86b)){if(_0x334271){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=_0x334271;}else{_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=0x1;}}else{if(_[_0x4c43('0x7a')](_0x334271)||_0x334271==_0xc8a86b){_0x2177cb['body'][_0x4c43('0x76')]=_0xc8a86b+0x1;}else if(_0x334271>_0xc8a86b){_0x2177cb[_0x4c43('0x67')]['internal']=_0x334271;}else{return db[_0x4c43('0x5a')][_0x4c43('0x4c')]('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[_0x4c43('0x5a')][_0x4c43('0x7b')][_0x4c43('0x7c')]})[_0x4c43('0x20')](function(_0x8fce57){if(_0x8fce57&&_0x8fce57[_0x4c43('0x53')]){for(var _0x57ea49=0x0,_0x292714=_0x8fce57[_0x4c43('0x53')];_0x57ea49<_0x292714&&_[_0x4c43('0x7a')](_0x2177cb[_0x4c43('0x67')]['internal']);_0x57ea49++){if(_0x334271<=_0x8fce57[_0x57ea49][_0x4c43('0x7d')]){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')]=_0x8fce57[_0x57ea49][_0x4c43('0x7d')];}else if(_0x334271>_0x8fce57[_0x57ea49][_0x4c43('0x7d')]&&_0x334271<=_0x8fce57[_0x57ea49]['to']){_0x2177cb['body'][_0x4c43('0x76')]=_0x334271;}}}if(_[_0x4c43('0x7a')](_0x2177cb['body'][_0x4c43('0x76')])){_0x2177cb[_0x4c43('0x67')]['internal']=_0xc8a86b+0x1;}});}}});}})['then'](function(){if(_0x2177cb[_0x4c43('0x67')][_0x4c43('0x7e')]){_0x2177cb[_0x4c43('0x67')][_0x4c43('0x7f')]=_0x2177cb[_0x4c43('0x67')]['internal'];_0x2177cb['body'][_0x4c43('0x80')]={'mailbox':_0x2177cb[_0x4c43('0x67')][_0x4c43('0x76')],'password':_0x2177cb['body'][_0x4c43('0x4b')],'fullname':_0x2177cb[_0x4c43('0x67')][_0x4c43('0x81')],'email':_0x2177cb[_0x4c43('0x67')]['email']};}if(_0x2177cb[_0x4c43('0x67')]&&_0x2177cb[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x3a')){if(!_0x2177cb['body'][_0x4c43('0x82')]){_0x2177cb['body']['permissions']=[_0x4c43('0x83'),_0x4c43('0x84'),'103',_0x4c43('0x85'),_0x4c43('0x86'),_0x4c43('0x87'),_0x4c43('0x88'),_0x4c43('0x89'),'107',_0x4c43('0x8a'),_0x4c43('0x8b'),_0x4c43('0x8c'),_0x4c43('0x8d'),_0x4c43('0x8e')];}}return db['User']['create'](_0x2177cb[_0x4c43('0x67')],{'include':[{'model':db[_0x4c43('0x80')],'as':_0x4c43('0x80')}]});})[_0x4c43('0x20')](function(_0x5204c7){if(_0x2177cb[_0x4c43('0x67')][_0x4c43('0x40')]===_0x4c43('0x6e'))return _0x5204c7;var _0x29d2f2=_0x2177cb[_0x4c43('0x6e')]['get']({'plain':!![]});if(!_0x29d2f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29d2f2[_0x4c43('0x40')]===_0x4c43('0x6e')){var _0x30a69a=_0x5204c7[_0x4c43('0x37')]({'plain':!![]});var _0x1030d5=[{'name':_0x4c43('0x39'),'value':_0x4c43('0x3a')},{'name':_0x4c43('0x8f'),'value':_0x4c43('0x3b')}];var _0x23b7df=_['find'](_0x1030d5,['value',_0x30a69a[_0x4c43('0x40')]])[_0x4c43('0x43')];return db[_0x4c43('0x90')][_0x4c43('0x41')]({'where':{'name':_0x23b7df,'userProfileId':_0x29d2f2[_0x4c43('0x91')]},'raw':!![]})[_0x4c43('0x20')](function(_0xeeadfc){if(_0xeeadfc&&_0xeeadfc[_0x4c43('0x92')]===0x0){return db[_0x4c43('0x44')][_0x4c43('0x75')]({'name':_0x30a69a[_0x4c43('0x43')],'resourceId':_0x30a69a['id'],'type':_0xeeadfc['name'],'sectionId':_0xeeadfc['id']},{})[_0x4c43('0x20')](function(){return _0x5204c7;});}else{return _0x5204c7;}})['catch'](function(_0x510a1b){logger['error'](_0x4c43('0x93'),_0x510a1b);throw _0x510a1b;});}return _0x5204c7;})[_0x4c43('0x20')](respondWithResult(_0x4001b5,0xc9))[_0x4c43('0x60')](handleError(_0x4001b5,null));};exports[_0x4c43('0x94')]=function(_0x9e968f,_0x4a1d42,_0x498fb8){var _0x5a2ea9=![];if(_0x9e968f[_0x4c43('0x67')]['id']){delete _0x9e968f[_0x4c43('0x67')]['id'];}return db[_0x4c43('0x77')]['findOne']({'attributes':['id',_0x4c43('0x79')]})[_0x4c43('0x20')](function(_0x485004){_0x5a2ea9=_0x485004[_0x4c43('0x79')];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x9e968f[_0x4c43('0x62')]['id']}});})[_0x4c43('0x20')](function(_0x1dc578){if(_0x1dc578){if(_0x1dc578['id']==_0x9e968f[_0x4c43('0x6e')]['id']){if(!_0x9e968f[_0x4c43('0x67')]['oldPassword']||!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x1dc578[_0x4c43('0x97')](_0x9e968f['body'][_0x4c43('0x98')])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Wrong\x20credentials');}if(_0x9e968f[_0x4c43('0x67')]['oldPassword']==_0x9e968f[_0x4c43('0x67')]['newPassword']){throw new db['Sequelize'][(_0x4c43('0x1e'))](_0x4c43('0x99'));}return _0x1dc578;}else if(_0x9e968f[_0x4c43('0x6e')]['role']==_0x4c43('0x6d')){if(!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db['Sequelize']['ValidationError'](_0x4c43('0x9a'));}return _0x1dc578;}else if(_0x9e968f[_0x4c43('0x6e')]['role']==_0x4c43('0x6e')){if(!_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')]){throw new db['Sequelize'][(_0x4c43('0x1e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1dc578[_0x4c43('0x40')]!=_0x4c43('0x3a')){throw new db['Sequelize']['ValidationError'](_0x4c43('0x9b'));}return _0x1dc578;}else{throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0x9b'));}}return null;})['then'](handleEntityNotFound(_0x4a1d42,null))['then'](function(_0x3a87ae){return checkPasswordPattern(_0x3a87ae,_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')],_0x5a2ea9);})[_0x4c43('0x20')](saveUpdates({'password':_0x9e968f[_0x4c43('0x67')][_0x4c43('0x95')],'passwordResetAt':_0x9e968f[_0x4c43('0x6e')]['id']==_0x9e968f[_0x4c43('0x62')]['id']?moment():null},null))[_0x4c43('0x20')](respondWithResult(_0x4a1d42,null))[_0x4c43('0x60')](handleError(_0x4a1d42,null));};exports[_0x4c43('0x9c')]=function(_0x2d6519,_0x421abe,_0x529755){var _0xe73e5c=_0x2d6519[_0x4c43('0x67')][_0x4c43('0x9d')];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x2d6519['params']['id']},'attributes':['id',_0x4c43('0x43'),'role',_0x4c43('0x9e'),_0x4c43('0x9f'),_0x4c43('0xa0'),_0x4c43('0xa1')]})[_0x4c43('0x20')](handleEntityNotFound(_0x421abe,null))['then'](function(_0x520805){if(_0x520805){if(!utils[_0x4c43('0xa2')](_0xe73e5c)){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xa3'));}return _0x520805[_0x4c43('0xa4')+_[_0x4c43('0xa5')](_0xe73e5c[_0x4c43('0xa6')]())+'Queues'](_0x2d6519[_0x4c43('0x67')][_0x4c43('0x6a')],{'penalty':_0x2d6519[_0x4c43('0x67')][_0x4c43('0xa7')]||0x0})[_0x4c43('0xa8')](function(_0x152a20){for(var _0x4814ee=0x0;_0x4814ee<_0x2d6519[_0x4c43('0x67')]['ids'][_0x4c43('0x53')];_0x4814ee+=0x1){var _0x3c0f35={'UserId':_0x2d6519[_0x4c43('0x62')]['id']};_0x3c0f35[_[_0x4c43('0xa5')](_0xe73e5c['toLowerCase']())+_0x4c43('0xa9')]=_0x2d6519[_0x4c43('0x67')][_0x4c43('0x6a')][_0x4814ee];socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_['capitalize'](_0xe73e5c[_0x4c43('0xa6')]())+_0x4c43('0xab'),_0x3c0f35);}return _0x152a20;})[_0x4c43('0x20')](function(){if(_0xe73e5c===_0x4c43('0xac')){return db[_0x4c43('0xad')][_0x4c43('0x5e')]({'where':{'id':_0x2d6519['body'][_0x4c43('0x6a')]||[]},'raw':!![],'attributes':['id',_0x4c43('0x43')]});}})[_0x4c43('0x20')](function(_0x36ef74){var _0x8fa8b=_0x520805[_0x4c43('0x37')]({'plain':!![]});var _0x7d633e=[];if(_0xe73e5c===_0x4c43('0xac')&&_0x8fa8b[_0x4c43('0x40')]===_0x4c43('0x3a')&&_0x8fa8b['online']){for(var _0x53efd7=0x0;_0x53efd7<_0x36ef74[_0x4c43('0x53')];_0x53efd7+=0x1){_0x7d633e[_0x4c43('0xae')]({'membername':_0x8fa8b[_0x4c43('0x43')],'UserId':_0x8fa8b['id'],'queue_name':_0x36ef74[_0x53efd7][_0x4c43('0x43')],'VoiceQueueId':_0x36ef74[_0x53efd7]['id'],'interface':_[_0x4c43('0x7a')](_0x8fa8b[_0x4c43('0xa1')])?util[_0x4c43('0x73')](_0x4c43('0xaf'),_0x8fa8b[_0x4c43('0x43')]):_0x8fa8b['interface'],'paused':_0x8fa8b[_0x4c43('0xa0')]||![],'penalty':_0x2d6519[_0x4c43('0x67')][_0x4c43('0xa7')]||0x0});}return BPromise[_0x4c43('0xb0')](_0x7d633e,function(_0x92344b){return db[_0x4c43('0xb1')][_0x4c43('0xb2')](_0x92344b);});}return _0x520805;});}})['then'](respondWithStatusCode(_0x421abe,null))[_0x4c43('0x60')](handleError(_0x421abe,null));};exports['removeQueues']=function(_0x113dcf,_0x155ff5,_0x11bb6f){var _0x37f4ad;return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x113dcf['params']['id']},'attributes':['id',_0x4c43('0x43'),_0x4c43('0x40')]})[_0x4c43('0x20')](handleEntityNotFound(_0x155ff5,null))[_0x4c43('0x20')](function(_0x32a578){if(_0x32a578){_0x37f4ad=_0x32a578;if(!_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')]||!utils['isValidChannel'](_0x113dcf[_0x4c43('0x4c')]['channel'])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Unknown\x20channel');}return _0x32a578[_0x4c43('0xb3')+_[_0x4c43('0xa5')](_0x113dcf['query']['channel'][_0x4c43('0xa6')]())+_0x4c43('0xb4')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x6a')]);}})[_0x4c43('0x20')](function(_0x13e96a){for(var _0x137819=0x0;_0x137819<_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x6a')][_0x4c43('0x53')];_0x137819+=0x1){var _0x178602={'UserId':_0x113dcf[_0x4c43('0x62')]['id']};_0x178602[_[_0x4c43('0xa5')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')][_0x4c43('0xa6')]())+_0x4c43('0xa9')]=_0x113dcf['query'][_0x4c43('0x6a')][_0x137819];socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_[_0x4c43('0xa5')](_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')][_0x4c43('0xa6')]())+_0x4c43('0xb5'),_0x178602);}return _0x13e96a;})['then'](function(){if(_0x113dcf[_0x4c43('0x4c')][_0x4c43('0x9d')]===_0x4c43('0xac')){return db['UserVoiceQueueRt'][_0x4c43('0x36')]({'where':{'UserId':_0x113dcf['params']['id'],'VoiceQueueId':_0x113dcf[_0x4c43('0x4c')]['ids']},'individualHooks':!![]})[_0x4c43('0x20')](function(){return _0x37f4ad;});}return _0x37f4ad;})[_0x4c43('0x20')](respondWithStatusCode(_0x155ff5,null))[_0x4c43('0x60')](handleError(_0x155ff5,null));};exports[_0x4c43('0xb6')]=function(_0x29ece9,_0x21cb7f,_0x364f3a){_0x29ece9[_0x4c43('0x67')][_0x4c43('0xb7')]=_0x29ece9[_0x4c43('0xb8')]['filename'];return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x29ece9['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x21cb7f,null))['then'](saveUpdates(_0x29ece9['body'],null))[_0x4c43('0x20')](respondWithResult(_0x21cb7f,null))['catch'](handleError(_0x21cb7f,null));};exports['getAvatar']=function(_0x1f0b6c,_0x329c3d,_0xd29140){var _0x381e91=path['join'](config[_0x4c43('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x1f0b6c[_0x4c43('0x62')]['id']},'attributes':['id',_0x4c43('0xb7')],'raw':!![]})[_0x4c43('0x20')](handleEntityNotFound(_0x329c3d,null))[_0x4c43('0x20')](function(_0x2b7934){if(_0x2b7934){if(_['isNil'](_0x2b7934[_0x4c43('0xb7')])){return _0x329c3d[_0x4c43('0xba')](_0x381e91);}else{if(!fs[_0x4c43('0xbb')](path[_0x4c43('0xbc')](config['root'],'server/files/images/',_0x2b7934[_0x4c43('0xb7')]))){return _0x329c3d['download'](_0x381e91);}return _0x329c3d[_0x4c43('0xba')](path['join'](config[_0x4c43('0xb9')],_0x4c43('0xbd'),_0x2b7934[_0x4c43('0xb7')]));}}})[_0x4c43('0x60')](handleError(_0x329c3d,null));};exports[_0x4c43('0xbe')]=function(_0x1ec400,_0x265849,_0xc1e7ac){var _0x159254={};var _0x5425bb={};var _0x1adbc9;var _0x28285c;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x1ec400['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x265849,null))[_0x4c43('0x20')](function(_0x19f28f){if(_0x19f28f){_0x1adbc9=_0x19f28f;_0x5425bb[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xc0')][_0x4c43('0x47')]);_0x5425bb[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x1ec400[_0x4c43('0x4c')]);_0x5425bb[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5425bb[_0x4c43('0x51')],_0x5425bb[_0x4c43('0x4c')]);_0x159254[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5425bb['model'],qs[_0x4c43('0x52')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x159254['attributes']=_0x159254['attributes'][_0x4c43('0x53')]?_0x159254[_0x4c43('0x50')]:_0x5425bb[_0x4c43('0x51')];_0x159254[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x1ec400['query'][_0x4c43('0x56')]);_0x159254[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x1ec400['query'],_0x5425bb[_0x4c43('0x4e')]));if(_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x159254['where']=_[_0x4c43('0x59')](_0x159254['where'],{'$or':_[_0x4c43('0x3e')](_0x159254[_0x4c43('0x50')],function(_0x49fda8){var _0x27e28f={};_0x27e28f[_0x49fda8]={'$like':'%'+_0x1ec400[_0x4c43('0x4c')]['filter']+'%'};return _0x27e28f;})});}_0x159254=_[_0x4c43('0x59')]({},_0x159254,_0x1ec400[_0x4c43('0x65')]);return _0x1adbc9[_0x4c43('0xbe')](_0x159254);}})['then'](function(_0x18c3b6){if(_0x18c3b6){_0x28285c=_0x18c3b6['length'];if(_0x1ec400['query'][_0x4c43('0x54')](_0x4c43('0x5c'))){_0x159254[_0x4c43('0x5d')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0x4c43('0xc2'),'attributes':['id',_0x4c43('0x43'),_0x4c43('0xc3')],'where':_0x1ec400[_0x4c43('0x4c')][_0x4c43('0xc4')]?{'id':_0x1ec400[_0x4c43('0x4c')][_0x4c43('0xc4')]}:undefined,'required':_0x1ec400[_0x4c43('0x4c')]['tag']?!![]:![]}];}if(!_0x1ec400['query'][_0x4c43('0x54')](_0x4c43('0x55'))){_0x159254[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x159254[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x1ec400[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x1adbc9['getContacts'](_0x159254);}})[_0x4c43('0x20')](function(_0x3978da){if(_0x3978da){return _0x3978da?{'count':_0x28285c,'rows':_0x3978da}:null;}})[_0x4c43('0x20')](respondWithResult(_0x265849,null))[_0x4c43('0x60')](handleError(_0x265849,null));};exports[_0x4c43('0xc5')]=function(_0x4086b5,_0x10473f,_0x5c4d55){var _0x187522;var _0x254bc3;var _0x6c35b8={};var _0x532b3a;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x4086b5[_0x4c43('0x62')]['id']},'attributes':['id','name',_0x4c43('0x40')]})[_0x4c43('0x20')](handleEntityNotFound(_0x10473f,null))[_0x4c43('0x20')](function(_0x52dd06){if(!utils[_0x4c43('0xa2')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])){throw new db['Sequelize'][(_0x4c43('0x1e'))]('Unknown\x20channel');}_0x187522=_0x52dd06;var _0x314855={};_0x314855[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_['capitalize'](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])+'Queue'][_0x4c43('0x47')]);_0x314855['query']=_['keys'](_0x4086b5[_0x4c43('0x4c')]);_0x314855[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x314855[_0x4c43('0x51')],_0x314855[_0x4c43('0x4c')]);_0x6c35b8[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x314855[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4086b5[_0x4c43('0x4c')]['fields']));_0x6c35b8[_0x4c43('0x50')]=_0x6c35b8[_0x4c43('0x50')][_0x4c43('0x53')]?_0x6c35b8['attributes']:_0x314855[_0x4c43('0x51')];_0x6c35b8[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x6c35b8['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4086b5['query'],_0x314855[_0x4c43('0x4e')]));if(_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x6c35b8[_0x4c43('0x57')]=_['merge'](_0x6c35b8[_0x4c43('0x57')],{'$or':_['map'](_0x6c35b8[_0x4c43('0x50')],function(_0x4bbce9){var _0x6cf936={};_0x6cf936[_0x4bbce9]={'$like':'%'+_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x6cf936;})});}_0x6c35b8=_[_0x4c43('0x59')]({},_0x6c35b8,_0x4086b5[_0x4c43('0x65')]);switch(_0x187522['role']){case _0x4c43('0x6d'):return db[_[_0x4c43('0xa5')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x9d')])+_0x4c43('0xc6')][_0x4c43('0x5e')](_0x6c35b8);case _0x4c43('0x6e'):case'agent':return _0x187522[_0x4c43('0x37')+_[_0x4c43('0xa5')](_0x4086b5[_0x4c43('0x4c')]['channel'])+_0x4c43('0xb4')](_0x6c35b8);default:throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))]('Unknown\x20role');}})['then'](function(_0x57da71){_0x532b3a=_0x57da71['length'];if(!_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x6c35b8[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x6c35b8['offset']=qs[_0x4c43('0x2e')](_0x4086b5[_0x4c43('0x4c')][_0x4c43('0x2e')]);}switch(_0x187522['role']){case'admin':return db[_[_0x4c43('0xa5')](_0x4086b5['query'][_0x4c43('0x9d')])+_0x4c43('0xc6')][_0x4c43('0x5e')](_0x6c35b8);case'user':case'agent':return _0x187522[_0x4c43('0x37')+_[_0x4c43('0xa5')](_0x4086b5['query']['channel'])+'Queues'](_0x6c35b8);}})[_0x4c43('0x20')](function(_0x5f2264){return{'count':_0x532b3a,'rows':_0x5f2264};})[_0x4c43('0x20')](respondWithResult(_0x10473f,null))['catch'](handleError(_0x10473f,null));};exports[_0x4c43('0xc7')]=function(_0x101b3a,_0x2bf8f9,_0x383c47){var _0x1f1dab={};var _0x56fccf={};var _0x5a5343;var _0x28546c;return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x101b3a['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x2bf8f9,null))['then'](function(_0x25025c){if(_0x25025c){_0x5a5343=_0x25025c;_0x56fccf[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xb1')]['rawAttributes']);_0x56fccf[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x101b3a[_0x4c43('0x4c')]);_0x56fccf[_0x4c43('0x4e')]=_['intersection'](_0x56fccf['model'],_0x56fccf[_0x4c43('0x4c')]);_0x1f1dab[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x56fccf[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x101b3a['query']['fields']));_0x1f1dab[_0x4c43('0x50')]=_0x1f1dab['attributes'][_0x4c43('0x53')]?_0x1f1dab[_0x4c43('0x50')]:_0x56fccf[_0x4c43('0x51')];_0x1f1dab[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x101b3a[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x1f1dab[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x101b3a[_0x4c43('0x4c')],_0x56fccf[_0x4c43('0x4e')]));if(_0x101b3a[_0x4c43('0x4c')]['filter']){_0x1f1dab[_0x4c43('0x57')]=_['merge'](_0x1f1dab['where'],{'$or':_['map'](_0x1f1dab['attributes'],function(_0x4dc9e8){var _0x9f46c8={};_0x9f46c8[_0x4dc9e8]={'$like':'%'+_0x101b3a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x9f46c8;})});}_0x1f1dab=_[_0x4c43('0x59')]({},_0x1f1dab,_0x101b3a['options']);return _0x5a5343[_0x4c43('0xc7')](_0x1f1dab);}})[_0x4c43('0x20')](function(_0x2bc3d0){if(_0x2bc3d0){_0x28546c=_0x2bc3d0['length'];if(!_0x101b3a[_0x4c43('0x4c')]['hasOwnProperty']('nolimit')){_0x1f1dab[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x101b3a[_0x4c43('0x4c')]['limit']);_0x1f1dab[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x101b3a['query'][_0x4c43('0x2e')]);}return _0x5a5343[_0x4c43('0xc7')](_0x1f1dab);}})[_0x4c43('0x20')](function(_0x2a3a79){if(_0x2a3a79){return _0x2a3a79?{'count':_0x28546c,'rows':_0x2a3a79}:null;}})['then'](respondWithResult(_0x2bf8f9,null))['catch'](handleError(_0x2bf8f9,null));};exports[_0x4c43('0xc8')]=function(_0x1d329d,_0xb78992,_0x28d7ce){var _0x3caa4f={};var _0x3dd20d={};var _0x5cefa2;var _0x325f3e;return db['User']['findOne']({'where':{'id':_0x1d329d[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0xb78992,null))['then'](function(_0x258255){if(_0x258255){_0x5cefa2=_0x258255;_0x3dd20d[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xc9')][_0x4c43('0x47')]);_0x3dd20d[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x1d329d[_0x4c43('0x4c')]);_0x3dd20d['filters']=_[_0x4c43('0x4f')](_0x3dd20d[_0x4c43('0x51')],_0x3dd20d['query']);_0x3caa4f[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x3dd20d['model'],qs[_0x4c43('0x52')](_0x1d329d[_0x4c43('0x4c')]['fields']));_0x3caa4f[_0x4c43('0x50')]=_0x3caa4f['attributes']['length']?_0x3caa4f[_0x4c43('0x50')]:_0x3dd20d[_0x4c43('0x51')];_0x3caa4f[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x3caa4f[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x1d329d['query'],_0x3dd20d[_0x4c43('0x4e')]));if(_0x1d329d[_0x4c43('0x4c')]['filter']){_0x3caa4f[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x3caa4f[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x3caa4f['attributes'],function(_0x53aa4c){var _0x16f8a9={};_0x16f8a9[_0x53aa4c]={'$like':'%'+_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x16f8a9;})});}_0x3caa4f=_['merge']({},_0x3caa4f,_0x1d329d[_0x4c43('0x65')]);return _0x5cefa2[_0x4c43('0xc8')](_0x3caa4f);}})[_0x4c43('0x20')](function(_0x4f858f){if(_0x4f858f){_0x325f3e=_0x4f858f[_0x4c43('0x53')];if(!_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x3caa4f[_0x4c43('0x2f')]=qs['limit'](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x3caa4f['offset']=qs[_0x4c43('0x2e')](_0x1d329d[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x5cefa2[_0x4c43('0xc8')](_0x3caa4f);}})[_0x4c43('0x20')](function(_0x2aab71){if(_0x2aab71){return _0x2aab71?{'count':_0x325f3e,'rows':_0x2aab71}:null;}})['then'](respondWithResult(_0xb78992,null))['catch'](handleError(_0xb78992,null));};exports[_0x4c43('0xca')]=function(_0x24af1b,_0x3f615e,_0x4f636b){var _0x459fb3={'raw':!![],'where':{}};var _0xe27075={};var _0x48cb8d={'count':0x0,'rows':[]};return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x24af1b['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x3f615e,null))[_0x4c43('0x20')](function(_0x6b265c){if(_0x6b265c){_0xe27075[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db['VoiceRecording'][_0x4c43('0x47')]);_0xe27075[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x24af1b['query']);_0xe27075[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0xe27075['model'],_0xe27075[_0x4c43('0x4c')]);_0x459fb3['attributes']=_['intersection'](_0xe27075[_0x4c43('0x51')],qs['fields'](_0x24af1b['query'][_0x4c43('0x52')]));_0x459fb3[_0x4c43('0x50')]=_0x459fb3[_0x4c43('0x50')][_0x4c43('0x53')]?_0x459fb3['attributes']:_0xe27075['model'];if(!_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x459fb3['limit']=qs['limit'](_0x24af1b[_0x4c43('0x4c')]['limit']);_0x459fb3[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x459fb3['order']=qs[_0x4c43('0x56')](_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x459fb3['where']=qs['filters'](_[_0x4c43('0x58')](_0x24af1b[_0x4c43('0x4c')],_0xe27075[_0x4c43('0x4e')]));_0x459fb3[_0x4c43('0x57')][_0x4c43('0xcb')]=_0x6b265c['id'];if(_0x24af1b['query'][_0x4c43('0x3c')]){_0x459fb3['where']=_[_0x4c43('0x59')](_0x459fb3[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x459fb3[_0x4c43('0x50')],function(_0x2b0345){var _0x2d4fed={};_0x2d4fed[_0x2b0345]={'$like':'%'+_0x24af1b[_0x4c43('0x4c')]['filter']+'%'};return _0x2d4fed;})});}_0x459fb3=_[_0x4c43('0x59')]({},_0x459fb3,_0x24af1b['options']);return db[_0x4c43('0xcc')]['count']({'where':_0x459fb3[_0x4c43('0x57')]})[_0x4c43('0x20')](function(_0x22f3b5){_0x48cb8d['count']=_0x22f3b5;if(_0x24af1b[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x459fb3[_0x4c43('0x5d')]=[{'all':!![]}];}return db[_0x4c43('0xcc')][_0x4c43('0x5e')](_0x459fb3);})['then'](function(_0x1dd03b){_0x48cb8d['rows']=_0x1dd03b;return _0x48cb8d;});}})[_0x4c43('0x20')](respondWithFilteredResult(_0x3f615e,_0x459fb3))[_0x4c43('0x60')](handleError(_0x3f615e,null));};exports[_0x4c43('0xcd')]=function(_0x481cf3,_0x33ba1c,_0x383614){var _0x37482f={'raw':!![],'where':{}};var _0x380061={};var _0x4dfbcb={'count':0x0,'rows':[]};return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x481cf3['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x33ba1c,null))['then'](function(_0x395c30){if(_0x395c30){_0x380061[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xce')][_0x4c43('0x47')]);_0x380061[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x481cf3['query']);_0x380061[_0x4c43('0x4e')]=_['intersection'](_0x380061['model'],_0x380061['query']);_0x37482f[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x380061[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x37482f['attributes']=_0x37482f['attributes'][_0x4c43('0x53')]?_0x37482f[_0x4c43('0x50')]:_0x380061[_0x4c43('0x51')];if(!_0x481cf3['query']['hasOwnProperty'](_0x4c43('0x55'))){_0x37482f[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x37482f[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x2e')]);}_0x37482f[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x37482f['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x481cf3['query'],_0x380061[_0x4c43('0x4e')]));_0x37482f['where'][_0x4c43('0xcb')]=_0x395c30['id'];if(_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x37482f[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x37482f[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x37482f[_0x4c43('0x50')],function(_0x4f9022){var _0x103ded={};_0x103ded[_0x4f9022]={'$like':'%'+_0x481cf3['query']['filter']+'%'};return _0x103ded;})});}_0x37482f=_['merge']({},_0x37482f,_0x481cf3[_0x4c43('0x65')]);return db[_0x4c43('0xce')]['count']({'where':_0x37482f['where']})[_0x4c43('0x20')](function(_0x642bf3){_0x4dfbcb[_0x4c43('0x2d')]=_0x642bf3;if(_0x481cf3[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0x37482f[_0x4c43('0x5d')]=[{'all':!![]}];}return db[_0x4c43('0xce')][_0x4c43('0x5e')](_0x37482f);})['then'](function(_0x1e98a9){_0x4dfbcb[_0x4c43('0x5f')]=_0x1e98a9;return _0x4dfbcb;});}})[_0x4c43('0x20')](respondWithFilteredResult(_0x33ba1c,_0x37482f))[_0x4c43('0x60')](handleError(_0x33ba1c,null));};exports['getChatInteractions']=function(_0x3443e2,_0x8e735e,_0x5ee0a7){var _0x681d20={};var _0x32ea8a={};var _0x34e49e;var _0x4a8d57;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x3443e2['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x8e735e,null))[_0x4c43('0x20')](function(_0x5e9bd5){if(_0x5e9bd5){_0x34e49e=_0x5e9bd5;_0x32ea8a['model']=_[_0x4c43('0x4d')](db['ChatInteraction']['rawAttributes']);_0x32ea8a[_0x4c43('0x4c')]=_['keys'](_0x3443e2[_0x4c43('0x4c')]);_0x32ea8a[_0x4c43('0x4e')]=_['intersection'](_0x32ea8a['model'],_0x32ea8a[_0x4c43('0x4c')]);_0x681d20[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x32ea8a[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x681d20[_0x4c43('0x50')]=_0x681d20[_0x4c43('0x50')][_0x4c43('0x53')]?_0x681d20[_0x4c43('0x50')]:_0x32ea8a['model'];_0x681d20[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x681d20[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x3443e2[_0x4c43('0x4c')],_0x32ea8a[_0x4c43('0x4e')]));if(_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x681d20[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x681d20['where'],{'$or':_[_0x4c43('0x3e')](_0x681d20[_0x4c43('0x50')],function(_0x2e4389){var _0x31756c={};_0x31756c[_0x2e4389]={'$like':'%'+_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x31756c;})});}_0x681d20=_['merge']({},_0x681d20,_0x3443e2[_0x4c43('0x65')]);return _0x34e49e[_0x4c43('0xcf')](_0x681d20);}})[_0x4c43('0x20')](function(_0x3d19ba){if(_0x3d19ba){_0x4a8d57=_0x3d19ba[_0x4c43('0x53')];if(!_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x681d20['limit']=qs[_0x4c43('0x2f')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x681d20[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x3443e2[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x34e49e[_0x4c43('0xcf')](_0x681d20);}})[_0x4c43('0x20')](function(_0x4755d0){if(_0x4755d0){return _0x4755d0?{'count':_0x4a8d57,'rows':_0x4755d0}:null;}})[_0x4c43('0x20')](respondWithResult(_0x8e735e,null))['catch'](handleError(_0x8e735e,null));};exports[_0x4c43('0xd0')]=function(_0x750e3,_0x4b7330,_0x468e79){var _0x3b90d1={};var _0x3c136c={};var _0x3def48;var _0x538e61;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x750e3[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x4b7330,null))['then'](function(_0x4a867e){if(_0x4a867e){_0x3def48=_0x4a867e;_0x3c136c[_0x4c43('0x51')]=_['keys'](db[_0x4c43('0xd1')][_0x4c43('0x47')]);_0x3c136c[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x750e3[_0x4c43('0x4c')]);_0x3c136c[_0x4c43('0x4e')]=_['intersection'](_0x3c136c['model'],_0x3c136c[_0x4c43('0x4c')]);_0x3b90d1['attributes']=_[_0x4c43('0x4f')](_0x3c136c[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x750e3['query'][_0x4c43('0x52')]));_0x3b90d1['attributes']=_0x3b90d1[_0x4c43('0x50')][_0x4c43('0x53')]?_0x3b90d1[_0x4c43('0x50')]:_0x3c136c[_0x4c43('0x51')];_0x3b90d1[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x750e3[_0x4c43('0x4c')]['sort']);_0x3b90d1[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x750e3[_0x4c43('0x4c')],_0x3c136c[_0x4c43('0x4e')]));if(_0x750e3[_0x4c43('0x4c')]['filter']){_0x3b90d1[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x3b90d1['where'],{'$or':_[_0x4c43('0x3e')](_0x3b90d1[_0x4c43('0x50')],function(_0x40f039){var _0x21c2ef={};_0x21c2ef[_0x40f039]={'$like':'%'+_0x750e3[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x21c2ef;})});}_0x3b90d1=_[_0x4c43('0x59')]({},_0x3b90d1,_0x750e3[_0x4c43('0x65')]);return _0x3def48[_0x4c43('0xd0')](_0x3b90d1);}})['then'](function(_0x4aa07e){if(_0x4aa07e){_0x538e61=_0x4aa07e['length'];if(!_0x750e3['query'][_0x4c43('0x54')]('nolimit')){_0x3b90d1[_0x4c43('0x2f')]=qs['limit'](_0x750e3['query'][_0x4c43('0x2f')]);_0x3b90d1[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x750e3[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x3def48[_0x4c43('0xd0')](_0x3b90d1);}})['then'](function(_0x219537){if(_0x219537){return _0x219537?{'count':_0x538e61,'rows':_0x219537}:null;}})[_0x4c43('0x20')](respondWithResult(_0x4b7330,null))[_0x4c43('0x60')](handleError(_0x4b7330,null));};exports[_0x4c43('0xd2')]=function(_0x2d0b0a,_0x2eb8a9,_0x4957bb){var _0xf25462={'raw':!![],'where':{}};var _0x3df12b={};var _0x365a4b={'count':0x0,'rows':[]};return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x2d0b0a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x2eb8a9,null))[_0x4c43('0x20')](function(_0x3f6119){if(_0x3f6119){_0x3df12b[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd3')][_0x4c43('0x47')]);_0x3df12b[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x2d0b0a[_0x4c43('0x4c')]);_0x3df12b[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x3df12b['model'],_0x3df12b[_0x4c43('0x4c')]);_0xf25462[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x3df12b[_0x4c43('0x51')],qs['fields'](_0x2d0b0a[_0x4c43('0x4c')]['fields']));_0xf25462['attributes']=_0xf25462['attributes'][_0x4c43('0x53')]?_0xf25462[_0x4c43('0x50')]:_0x3df12b[_0x4c43('0x51')];if(!_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x54')]('nolimit')){_0xf25462[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x2d0b0a[_0x4c43('0x4c')]['limit']);_0xf25462[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x2d0b0a[_0x4c43('0x4c')]['offset']);}_0xf25462[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x2d0b0a[_0x4c43('0x4c')]['sort']);_0xf25462[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x2d0b0a[_0x4c43('0x4c')],_0x3df12b[_0x4c43('0x4e')]));_0xf25462[_0x4c43('0x57')]['UserId']=_0x3f6119['id'];if(_0x2d0b0a[_0x4c43('0x4c')]['filter']){_0xf25462[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0xf25462[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0xf25462[_0x4c43('0x50')],function(_0x303b44){var _0x3bbaf0={};_0x3bbaf0[_0x303b44]={'$like':'%'+_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x3bbaf0;})});}_0xf25462=_['merge']({},_0xf25462,_0x2d0b0a[_0x4c43('0x65')]);return db[_0x4c43('0xd3')]['count']({'where':_0xf25462[_0x4c43('0x57')]})[_0x4c43('0x20')](function(_0x81e28){_0x365a4b[_0x4c43('0x2d')]=_0x81e28;if(_0x2d0b0a[_0x4c43('0x4c')][_0x4c43('0x5c')]){_0xf25462['include']=[{'all':!![]}];}return db[_0x4c43('0xd3')][_0x4c43('0x5e')](_0xf25462);})['then'](function(_0x537375){_0x365a4b[_0x4c43('0x5f')]=_0x537375;return _0x365a4b;});}})['then'](respondWithFilteredResult(_0x2eb8a9,_0xf25462))[_0x4c43('0x60')](handleError(_0x2eb8a9,null));};exports[_0x4c43('0xd4')]=function(_0x90f466,_0x349c4f,_0x5665e6){var _0x26ed32={};var _0x396774={};var _0xb71c13;var _0x2b6a1b;return db[_0x4c43('0x46')]['findOne']({'where':{'id':_0x90f466[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x349c4f,null))[_0x4c43('0x20')](function(_0x221554){if(_0x221554){_0xb71c13=_0x221554;_0x396774[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd5')]['rawAttributes']);_0x396774['query']=_[_0x4c43('0x4d')](_0x90f466[_0x4c43('0x4c')]);_0x396774[_0x4c43('0x4e')]=_['intersection'](_0x396774['model'],_0x396774[_0x4c43('0x4c')]);_0x26ed32[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x396774['model'],qs[_0x4c43('0x52')](_0x90f466['query'][_0x4c43('0x52')]));_0x26ed32['attributes']=_0x26ed32[_0x4c43('0x50')][_0x4c43('0x53')]?_0x26ed32[_0x4c43('0x50')]:_0x396774[_0x4c43('0x51')];_0x26ed32[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x90f466[_0x4c43('0x4c')]['sort']);_0x26ed32[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x90f466[_0x4c43('0x4c')],_0x396774[_0x4c43('0x4e')]));if(_0x90f466[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x26ed32[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x26ed32[_0x4c43('0x57')],{'$or':_[_0x4c43('0x3e')](_0x26ed32[_0x4c43('0x50')],function(_0x3c4cfd){var _0x1ae2cf={};_0x1ae2cf[_0x3c4cfd]={'$like':'%'+_0x90f466[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x1ae2cf;})});}_0x26ed32=_[_0x4c43('0x59')]({},_0x26ed32,_0x90f466[_0x4c43('0x65')]);return _0xb71c13['getSmsInteractions'](_0x26ed32);}})[_0x4c43('0x20')](function(_0x513675){if(_0x513675){_0x2b6a1b=_0x513675['length'];if(!_0x90f466[_0x4c43('0x4c')][_0x4c43('0x54')](_0x4c43('0x55'))){_0x26ed32[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x90f466[_0x4c43('0x4c')]['limit']);_0x26ed32['offset']=qs['offset'](_0x90f466['query'][_0x4c43('0x2e')]);}return _0xb71c13[_0x4c43('0xd4')](_0x26ed32);}})[_0x4c43('0x20')](function(_0x22156d){if(_0x22156d){return _0x22156d?{'count':_0x2b6a1b,'rows':_0x22156d}:null;}})['then'](respondWithResult(_0x349c4f,null))[_0x4c43('0x60')](handleError(_0x349c4f,null));};exports['getFaxInteractions']=function(_0x4fbefb,_0x5a7906,_0x17277b){var _0x11a182={};var _0x5de065={};var _0x404b73;var _0x278833;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x4fbefb[_0x4c43('0x62')]['id']}})['then'](handleEntityNotFound(_0x5a7906,null))[_0x4c43('0x20')](function(_0x348bca){if(_0x348bca){_0x404b73=_0x348bca;_0x5de065[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0xd6')][_0x4c43('0x47')]);_0x5de065[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x4fbefb[_0x4c43('0x4c')]);_0x5de065[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5de065[_0x4c43('0x51')],_0x5de065[_0x4c43('0x4c')]);_0x11a182[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5de065[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4fbefb['query'][_0x4c43('0x52')]));_0x11a182[_0x4c43('0x50')]=_0x11a182[_0x4c43('0x50')][_0x4c43('0x53')]?_0x11a182[_0x4c43('0x50')]:_0x5de065[_0x4c43('0x51')];_0x11a182['order']=qs['sort'](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x56')]);_0x11a182[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4fbefb[_0x4c43('0x4c')],_0x5de065[_0x4c43('0x4e')]));if(_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x11a182['where']=_[_0x4c43('0x59')](_0x11a182['where'],{'$or':_['map'](_0x11a182['attributes'],function(_0x229b73){var _0x3e5317={};_0x3e5317[_0x229b73]={'$like':'%'+_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x3e5317;})});}_0x11a182=_[_0x4c43('0x59')]({},_0x11a182,_0x4fbefb[_0x4c43('0x65')]);return _0x404b73[_0x4c43('0xd7')](_0x11a182);}})[_0x4c43('0x20')](function(_0x23eaaa){if(_0x23eaaa){_0x278833=_0x23eaaa[_0x4c43('0x53')];if(!_0x4fbefb[_0x4c43('0x4c')]['hasOwnProperty']('nolimit')){_0x11a182[_0x4c43('0x2f')]=qs['limit'](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x11a182[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x4fbefb[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x404b73[_0x4c43('0xd7')](_0x11a182);}})[_0x4c43('0x20')](function(_0x3581f3){if(_0x3581f3){return _0x3581f3?{'count':_0x278833,'rows':_0x3581f3}:null;}})[_0x4c43('0x20')](respondWithResult(_0x5a7906,null))['catch'](handleError(_0x5a7906,null));};exports[_0x4c43('0xd8')]=function(_0x5c4b33,_0x470b0f,_0x23d7b9){var _0x2e4cd1={};var _0x5ee103={};var _0x215c37;var _0x572322;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x5c4b33[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x470b0f,null))[_0x4c43('0x20')](function(_0x39efb0){if(_0x39efb0){_0x215c37=_0x39efb0;_0x5ee103['model']=_[_0x4c43('0x4d')](db[_0x4c43('0xd9')]['rawAttributes']);_0x5ee103[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x5c4b33[_0x4c43('0x4c')]);_0x5ee103[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x5ee103[_0x4c43('0x51')],_0x5ee103[_0x4c43('0x4c')]);_0x2e4cd1[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x5ee103['model'],qs[_0x4c43('0x52')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x2e4cd1['attributes']=_0x2e4cd1[_0x4c43('0x50')][_0x4c43('0x53')]?_0x2e4cd1[_0x4c43('0x50')]:_0x5ee103[_0x4c43('0x51')];_0x2e4cd1[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x5c4b33['query'][_0x4c43('0x56')]);_0x2e4cd1[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_['pick'](_0x5c4b33[_0x4c43('0x4c')],_0x5ee103[_0x4c43('0x4e')]));if(_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x2e4cd1[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x2e4cd1['where'],{'$or':_[_0x4c43('0x3e')](_0x2e4cd1['attributes'],function(_0x25faff){var _0x31d456={};_0x31d456[_0x25faff]={'$like':'%'+_0x5c4b33['query'][_0x4c43('0x3c')]+'%'};return _0x31d456;})});}_0x2e4cd1=_[_0x4c43('0x59')]({},_0x2e4cd1,_0x5c4b33['options']);return _0x215c37[_0x4c43('0xd8')](_0x2e4cd1);}})[_0x4c43('0x20')](function(_0x3daf2c){if(_0x3daf2c){_0x572322=_0x3daf2c[_0x4c43('0x53')];if(!_0x5c4b33[_0x4c43('0x4c')]['hasOwnProperty'](_0x4c43('0x55'))){_0x2e4cd1[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0x2e4cd1['offset']=qs[_0x4c43('0x2e')](_0x5c4b33[_0x4c43('0x4c')][_0x4c43('0x2e')]);}return _0x215c37['getWhatsappInteractions'](_0x2e4cd1);}})[_0x4c43('0x20')](function(_0x35deb7){if(_0x35deb7){return _0x35deb7?{'count':_0x572322,'rows':_0x35deb7}:null;}})[_0x4c43('0x20')](respondWithResult(_0x470b0f,null))[_0x4c43('0x60')](handleError(_0x470b0f,null));};exports['login']=function(_0x56d858,_0x381677,_0x58666b){var _0xc01d9d;var _0x4fa470;var _0x2f93e7;var _0x492798=!_[_0x4c43('0x7a')](_0x56d858[_0x4c43('0x62')]['id'])?_0x56d858[_0x4c43('0x62')]['id']:!_[_0x4c43('0x7a')](_0x56d858['user']['id'])?_0x56d858[_0x4c43('0x6e')]['id']:null;return db['User'][_0x4c43('0x41')]({'where':{'id':_0x492798,'role':{'$or':[_0x4c43('0x6d'),_0x4c43('0x6e'),_0x4c43('0x3a')]}},'attributes':['id',_0x4c43('0x43'),_0x4c43('0xda'),'mobile',_0x4c43('0x40'),_0x4c43('0x76'),_0x4c43('0x9f')]})[_0x4c43('0x20')](function(_0x97e8cf){if(_0x97e8cf){if(_0x97e8cf[_0x4c43('0x40')]===_0x4c43('0x3a')){_0xc01d9d=_0x97e8cf;if(_0x56d858[_0x4c43('0x67')][_0x4c43('0xa1')]){_0x2f93e7=util[_0x4c43('0x73')](_0x4c43('0xdb'),_0xc01d9d[_0x56d858['body']['interface']]);}else if(_0x56d858[_0x4c43('0x67')][_0x4c43('0xdc')]){_0x2f93e7=util['format'](_0x4c43('0xaf'),_0x56d858[_0x4c43('0x67')]['intrf']);}else{_0x2f93e7=util['format']('SIP/%s',_0xc01d9d['name']);}socket['to'](util['format'](_0x4c43('0xdd'),_0xc01d9d[_0x4c43('0x43')]))[_0x4c43('0xaa')](_0x4c43('0xde'),{'ip':_0x56d858[_0x4c43('0xdf')][_0x4c43('0xe0')]||_0x56d858[_0x4c43('0xe1')][_0x4c43('0xe2')]||_0x56d858['socket'][_0x4c43('0xe2')]||_0x56d858[_0x4c43('0xe1')][_0x4c43('0xe3')]['remoteAddress']});return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'membername':_0xc01d9d[_0x4c43('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xe4'));}})[_0x4c43('0x20')](function(){if(_0xc01d9d){return _0xc01d9d[_0x4c43('0xe5')]({'raw':!![]});}})[_0x4c43('0x20')](function(_0x5e9ef5){if(_0xc01d9d){var _0x5df32d=[];if(_0x5e9ef5){_0x4fa470=_0x5e9ef5;if(_0x4fa470[_0x4c43('0x53')]){for(var _0x47a235=0x0;_0x47a235<_0x4fa470[_0x4c43('0x53')];_0x47a235++){_0x5df32d[_0x4c43('0xae')]({'membername':_0xc01d9d[_0x4c43('0x43')],'UserId':_0xc01d9d['id'],'queue_name':_0x4fa470[_0x47a235][_0x4c43('0x43')],'VoiceQueueId':_0x4fa470[_0x47a235]['id'],'interface':_0x2f93e7,'paused':_0xc01d9d[_0x4c43('0x9f')]||![],'penalty':_0x4fa470[_0x47a235][_0x4c43('0xe6')]||0x0});}return BPromise[_0x4c43('0xb0')](_0x5df32d,function(_0x2d711e){return db[_0x4c43('0xb1')][_0x4c43('0xb2')](_0x2d711e);});}}}})[_0x4c43('0x20')](function(){if(_0xc01d9d){return db[_0x4c43('0xe7')]['findAll']({'where':{'membername':_0xc01d9d[_0x4c43('0x43')],'exitAt':null}});}})[_0x4c43('0x20')](function(_0x1276fe){if(_0xc01d9d){var _0x1b676f=[];_0x1276fe[_0x4c43('0xe8')](function(_0x50374b){_0x1b676f[_0x4c43('0xae')](_0x50374b['update']({'exitAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4c43('0xe9')](_0x1b676f);}})[_0x4c43('0x20')](function(){if(_0xc01d9d){var _0x481994=[];var _0x146874=[];var _0x25d0eb=utils[_0x4c43('0xea')]();var _0x5211c0={'membername':_0xc01d9d[_0x4c43('0x43')],'interface':_0x2f93e7,'enterAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'role':_0xc01d9d[_0x4c43('0x40')],'internal':_0xc01d9d[_0x4c43('0x76')]};_0x25d0eb[_0x4c43('0xe8')](function(_0xfc0f99){_0x481994[_0x4c43('0xae')](_[_0x4c43('0x59')]({'channel':_0xfc0f99,'type':_0x4c43('0xec'),'data1':_0x56d858[_0x4c43('0x67')]['device'],'data2':_0x2f93e7},_0x5211c0));if(_0xc01d9d[_0x4c43('0x9f')]){_0x146874[_0x4c43('0xae')](_[_0x4c43('0x59')]({'channel':_0xfc0f99,'type':_0x4c43('0xed'),'data1':_0x4c43('0xee')},_0x5211c0));}});return db[_0x4c43('0xe7')][_0x4c43('0x66')](_0x481994['concat'](_0x146874),{'individualHooks':!![]});}})['then'](function(){if(_0xc01d9d){return _0xc01d9d['update']({'online':!![],'lastLoginAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'voicePause':_0xc01d9d[_0x4c43('0x9f')]||![],'mailPause':_0xc01d9d['loginInPause']||![],'chatPause':_0xc01d9d[_0x4c43('0x9f')]||![],'faxPause':_0xc01d9d[_0x4c43('0x9f')]||![],'smsPause':_0xc01d9d[_0x4c43('0x9f')]||![],'openchannelPause':_0xc01d9d[_0x4c43('0x9f')]||![],'whatsappPause':_0xc01d9d['loginInPause']||![],'pauseType':_0xc01d9d[_0x4c43('0x9f')]?'LOGININPAUSE':null,'interface':_0x2f93e7,'lastPauseAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb'))});}})['then'](function(_0x31b562){if(_0x56d858['isMiddleware']){return _0x58666b();}else{return BPromise[_0x4c43('0xef')](_0x31b562)[_0x4c43('0x20')](respondWithResult(_0x381677,null));}})['catch'](handleError(_0x381677,null));};exports[_0x4c43('0xf0')]=function(_0xdda240,_0x1c39f7,_0x41a405){var _0x36a62e;return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0xdda240[_0x4c43('0x62')]['id'],'role':_0x4c43('0x3a')},'attributes':['id',_0x4c43('0x43'),'role']})[_0x4c43('0x20')](handleEntityNotFound(_0x1c39f7,null))['then'](function(_0x10eb37){if(_0x10eb37){_0x36a62e=_0x10eb37;return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'membername':_0x36a62e[_0x4c43('0x43')]},'individualHooks':!![]});}})[_0x4c43('0x20')](function(){return db[_0x4c43('0xe7')][_0x4c43('0x5e')]({'where':{'membername':_0x36a62e[_0x4c43('0x43')],'exitAt':null}});})['then'](function(_0x1229d4){var _0x569166=[];_0x1229d4['forEach'](function(_0x1d26d9){_0x569166[_0x4c43('0xae')](_0x1d26d9['update']({'exitAt':moment()['format'](_0x4c43('0xeb'))}));});return BPromise[_0x4c43('0xe9')](_0x569166);})['then'](function(){return _0x36a62e['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1c39f7,null))[_0x4c43('0x60')](handleError(_0x1c39f7,null));};exports[_0x4c43('0xf1')]=function(_0x4051b6,_0x1b84b2,_0x4e16f1){var _0x381fe0;return db['UserVoiceQueueRt'][_0x4c43('0xf2')]({'paused':0x1},{'where':{'UserId':_0x4051b6[_0x4c43('0x62')]['id']},'individualHooks':!![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0x46')][_0x4c43('0x41')]({'where':{'id':_0x4051b6[_0x4c43('0x62')]['id'],'role':_0x4c43('0x3a')},'attributes':['id','name','role',_0x4c43('0x76'),_0x4c43('0xa1')]});})[_0x4c43('0x20')](handleEntityNotFound(_0x1b84b2,null))['then'](function(_0x3fd32e){if(_0x3fd32e){_0x381fe0=_0x3fd32e;return respondWithRpcPromise(_0x4c43('0xf3'),'pause',{'id':_0x381fe0['id'],'name':_0x381fe0[_0x4c43('0x43')],'pause':!![]});}})[_0x4c43('0x20')](function(){if(_0x381fe0){return db['MemberReport'][_0x4c43('0x5e')]({'where':{'membername':_0x381fe0['name'],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x1c0d4d){if(_0x1c0d4d[_0x4c43('0x53')]){var _0x1c454d=moment()[_0x4c43('0x73')](_0x4c43('0xeb'));for(var _0x415d32=0x0,_0x2e90ef=_0x1c0d4d[_0x4c43('0x53')];_0x415d32<_0x2e90ef;_0x415d32++){_0x1c0d4d[_0x415d32][_0x4c43('0xf4')]({'exitAt':_0x1c454d});}}})[_0x4c43('0x20')](function(){var _0x193a57=[];var _0x24f8f7=utils[_0x4c43('0xea')]();_0x24f8f7[_0x4c43('0xe8')](function(_0x56de79){_0x193a57['push']({'channel':_0x56de79,'membername':_0x381fe0[_0x4c43('0x43')],'interface':_[_0x4c43('0x7a')](_0x381fe0[_0x4c43('0xa1')])?util['format']('SIP/%s',_0x381fe0[_0x4c43('0x43')]):_0x381fe0[_0x4c43('0xa1')],'type':_0x4c43('0xed'),'enterAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4051b6['body'][_0x4c43('0x49')]||_0x4c43('0xf5'),'role':_0x381fe0['role'],'internal':_0x381fe0['internal']});});return db[_0x4c43('0xe7')][_0x4c43('0x66')](_0x193a57,{'individualHooks':!![]});})['then'](function(){return _0x381fe0[_0x4c43('0xf2')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4051b6['body']['type']||_0x4c43('0xf5'),'lastPauseAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb'))});})[_0x4c43('0x20')](respondWithResult(_0x1b84b2,null))['catch'](handleError(_0x1b84b2,null));};exports[_0x4c43('0xf6')]=function(_0x5c2eec,_0x230f49,_0x5079f0){var _0x281a18;return db['User'][_0x4c43('0x41')]({'where':{'id':_0x5c2eec[_0x4c43('0x62')]['id']},'attributes':['id','name',_0x4c43('0x40'),_0x4c43('0xa0'),_0x4c43('0xf7'),_0x4c43('0xf8'),_0x4c43('0xf9'),_0x4c43('0xfa'),'smsPause',_0x4c43('0xfb'),_0x4c43('0xfc'),_0x4c43('0xfd')]})[_0x4c43('0x20')](handleEntityNotFound(_0x230f49,null))[_0x4c43('0x20')](function(_0x165e12){if(_0x165e12){_0x281a18=_0x165e12;if(_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')]&&!utils['isValidChannel'](_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')])){throw new db[(_0x4c43('0x96'))][(_0x4c43('0x1e'))](_0x4c43('0xa3'));}switch(_0x5c2eec['body']['channel']){case _0x4c43('0xac'):return respondWithRpcPromise(_0x4c43('0xf3'),_0x4c43('0xf6'),{'id':_0x281a18['id'],'name':_0x281a18[_0x4c43('0x43')],'pause':![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0xb1')][_0x4c43('0xf2')]({'paused':0x0},{'where':{'UserId':_0x281a18['id']},'individualHooks':!![]});})[_0x4c43('0x20')](function(){return db[_0x4c43('0xe7')][_0x4c43('0x41')]({'where':{'channel':_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')],'membername':_0x281a18[_0x4c43('0x43')],'type':_0x4c43('0xed'),'exitAt':null}});})[_0x4c43('0x20')](function(_0x225bb5){if(_0x225bb5){return _0x225bb5['update']({'exitAt':moment()[_0x4c43('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4c43('0x20')](function(){return _0x281a18[_0x4c43('0xf2')]({'voicePause':![]});});case _0x4c43('0xfe'):case _0x4c43('0xff'):case _0x4c43('0x100'):case'sms':case _0x4c43('0x101'):case _0x4c43('0x102'):return db[_0x4c43('0xe7')][_0x4c43('0x41')]({'where':{'channel':_0x5c2eec[_0x4c43('0x67')][_0x4c43('0x9d')],'membername':_0x281a18[_0x4c43('0x43')],'type':_0x4c43('0xed'),'exitAt':null}})['then'](function(_0x28ef93){if(_0x28ef93){return _0x28ef93[_0x4c43('0xf2')]({'exitAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'data2':_0x4c43('0x103')},{'individualHooks':!![]});}return null;})[_0x4c43('0x20')](function(){var _0x535223={};_['set'](_0x535223,util['format'](_0x4c43('0x104'),_0x5c2eec[_0x4c43('0x67')]['channel'],_0x4c43('0x105')),![]);return _0x281a18[_0x4c43('0xf2')](_0x535223);});default:return respondWithRpcPromise(_0x4c43('0xf3'),_0x4c43('0xf6'),{'id':_0x281a18['id'],'name':_0x281a18[_0x4c43('0x43')],'pause':![]})[_0x4c43('0x20')](function(){return db[_0x4c43('0xb1')]['update']({'paused':0x0},{'where':{'UserId':_0x281a18['id']}});})['then'](function(){return db['MemberReport'][_0x4c43('0x5e')]({'where':{'membername':_0x281a18['name'],'type':_0x4c43('0xed'),'exitAt':null}});})['then'](function(_0x3a5899){var _0x3f6d88=[];_0x3a5899[_0x4c43('0xe8')](function(_0x4ca319){_0x3f6d88[_0x4c43('0xae')](_0x4ca319[_0x4c43('0xf2')]({'exitAt':moment()[_0x4c43('0x73')](_0x4c43('0xeb')),'data2':'manual'}));});return BPromise[_0x4c43('0xe9')](_0x3f6d88);})['then'](function(){return _0x281a18[_0x4c43('0xf2')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x230f49,null))[_0x4c43('0x60')](handleError(_0x230f49,null));};exports[_0x4c43('0x106')]=function(_0x4fbb2a,_0x334d4e,_0x3d058a){var _0xf1960c={};var _0x4d50bb={};var _0x10c7cf;var _0x5eb457;return db['User'][_0x4c43('0xbf')]({'where':{'id':_0x4fbb2a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x334d4e,null))[_0x4c43('0x20')](function(_0x574801){if(_0x574801){_0x10c7cf=_0x574801;_0x4d50bb['model']=_[_0x4c43('0x4d')](db['Team'][_0x4c43('0x47')]);_0x4d50bb[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x4fbb2a[_0x4c43('0x4c')]);_0x4d50bb[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x4d50bb[_0x4c43('0x51')],_0x4d50bb[_0x4c43('0x4c')]);_0xf1960c[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x4d50bb[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x4fbb2a['query']['fields']));_0xf1960c[_0x4c43('0x50')]=_0xf1960c[_0x4c43('0x50')][_0x4c43('0x53')]?_0xf1960c[_0x4c43('0x50')]:_0x4d50bb[_0x4c43('0x51')];_0xf1960c[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x56')]);_0xf1960c['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x4fbb2a[_0x4c43('0x4c')],_0x4d50bb['filters']));if(_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0xf1960c[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0xf1960c['where'],{'$or':_[_0x4c43('0x3e')](_0xf1960c[_0x4c43('0x50')],function(_0x42bd0e){var _0x2dd20b={};_0x2dd20b[_0x42bd0e]={'$like':'%'+_0x4fbb2a[_0x4c43('0x4c')]['filter']+'%'};return _0x2dd20b;})});}_0xf1960c=_['merge']({},_0xf1960c,_0x4fbb2a[_0x4c43('0x65')]);return _0x10c7cf[_0x4c43('0x106')](_0xf1960c);}})[_0x4c43('0x20')](function(_0xf852c4){if(_0xf852c4){_0x5eb457=_0xf852c4[_0x4c43('0x53')];if(!_0x4fbb2a['query'][_0x4c43('0x54')]('nolimit')){_0xf1960c[_0x4c43('0x2f')]=qs[_0x4c43('0x2f')](_0x4fbb2a[_0x4c43('0x4c')][_0x4c43('0x2f')]);_0xf1960c[_0x4c43('0x2e')]=qs['offset'](_0x4fbb2a[_0x4c43('0x4c')]['offset']);}return _0x10c7cf[_0x4c43('0x106')](_0xf1960c);}})['then'](function(_0x1b6d0c){if(_0x1b6d0c){return _0x1b6d0c?{'count':_0x5eb457,'rows':_0x1b6d0c}:null;}})[_0x4c43('0x20')](respondWithResult(_0x334d4e,null))[_0x4c43('0x60')](handleError(_0x334d4e,null));};exports[_0x4c43('0x107')]=function(_0x57968f,_0x25f26c){return db[_0x4c43('0x46')]['find']({'where':{'id':_0x57968f['params']['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x25f26c,null))[_0x4c43('0x20')](function(_0x2d8704){if(_0x2d8704){var _0x194eb6=_0x2d8704['get']({'plain':!![]});return _0x2d8704[_0x4c43('0x107')](_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')],_['omit'](_0x57968f[_0x4c43('0x67')],[_0x4c43('0x6a'),'id'])||{})[_0x4c43('0x20')](function(){for(var _0x44894d=0x0;_0x44894d<_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')][_0x4c43('0x53')];_0x44894d++){var _0x247838=[];db[_0x4c43('0x108')]['findOne']({'where':{'id':_0x57968f[_0x4c43('0x67')][_0x4c43('0x6a')][_0x44894d]}})[_0x4c43('0x20')](function(_0x5869b8){_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0xe5')]()['then'](function(_0x2a26b9){for(var _0x132b65=0x0;_0x132b65<_0x2a26b9[_0x4c43('0x53')];_0x132b65++){_0x2a26b9[_0x132b65][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10a'));}return _0x2a26b9;}));_0x247838['push'](_0x5869b8['getChatQueues']()[_0x4c43('0x20')](function(_0xbfcf1b){for(var _0x305938=0x0;_0x305938<_0xbfcf1b[_0x4c43('0x53')];_0x305938++){_0xbfcf1b[_0x305938][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10b'));}return _0xbfcf1b;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10c')]()[_0x4c43('0x20')](function(_0x46293b){for(var _0x345fb7=0x0;_0x345fb7<_0x46293b['length'];_0x345fb7++){_0x46293b[_0x345fb7][_0x4c43('0x109')]('channel','Mail');}return _0x46293b;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10d')]()[_0x4c43('0x20')](function(_0x42821f){for(var _0x34e407=0x0;_0x34e407<_0x42821f[_0x4c43('0x53')];_0x34e407++){_0x42821f[_0x34e407][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10e'));}return _0x42821f;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x10f')]()[_0x4c43('0x20')](function(_0x31c354){for(var _0x4d8774=0x0;_0x4d8774<_0x31c354[_0x4c43('0x53')];_0x4d8774++){_0x31c354[_0x4d8774]['setDataValue']('channel',_0x4c43('0x110'));}return _0x31c354;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x111')]()[_0x4c43('0x20')](function(_0x4c91d9){for(var _0x237cb1=0x0;_0x237cb1<_0x4c91d9[_0x4c43('0x53')];_0x237cb1++){_0x4c91d9[_0x237cb1][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x112'));}return _0x4c91d9;}));_0x247838[_0x4c43('0xae')](_0x5869b8[_0x4c43('0x113')]()['then'](function(_0x5251df){for(var _0x26805b=0x0;_0x26805b<_0x5251df[_0x4c43('0x53')];_0x26805b++){_0x5251df[_0x26805b][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x114'));}return _0x5251df;}));return BPromise[_0x4c43('0xe9')](_0x247838);})[_0x4c43('0x20')](function(_0x4bd47a){var _0x15c860=_[_0x4c43('0x115')](_0x4bd47a);_0x247838=[];return db[_0x4c43('0x5a')][_0x4c43('0x116')](function(_0x37dea4){for(var _0x3a4280=0x0;_0x3a4280<_0x15c860[_0x4c43('0x53')];_0x3a4280++){_0x247838[_0x4c43('0xae')](_0x15c860[_0x3a4280][_0x4c43('0x117')](_0x194eb6['id']),{'transaction':_0x37dea4});}return BPromise[_0x4c43('0xe9')](_0x247838)['then'](function(){if(_0x194eb6[_0x4c43('0x9e')]){return BPromise[_0x4c43('0xb0')](_[_0x4c43('0x3c')](_0x15c860,function(_0x1972e6){return _0x1972e6[_0x4c43('0x118')]('channel')===_0x4c43('0x10a');}),function(_0x3adc42){return db['UserVoiceQueueRt'][_0x4c43('0xb2')]({'membername':_0x194eb6[_0x4c43('0x43')],'UserId':_0x194eb6['id'],'queue_name':_0x3adc42[_0x4c43('0x43')],'VoiceQueueId':_0x3adc42['id'],'interface':_[_0x4c43('0x7a')](_0x194eb6[_0x4c43('0xa1')])?util['format'](_0x4c43('0xaf'),_0x194eb6['name']):_0x194eb6['interface'],'paused':_0x194eb6[_0x4c43('0xa0')]||![],'penalty':_0x194eb6[_0x4c43('0xa7')]},{'transaction':_0x37dea4});});}else{return;}})[_0x4c43('0x20')](function(){for(var _0x41681d=0x0;_0x41681d<_0x15c860[_0x4c43('0x53')];_0x41681d++){var _0x1381d2=_0x15c860[_0x41681d][_0x4c43('0x118')]('channel');var _0x13e91d=_0x1381d2+_0x4c43('0xa9');socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_0x1381d2+_0x4c43('0xab'),{'UserId':_0x194eb6['id'],['queueField']:_0x15c860[_0x41681d]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x25f26c,null))['catch'](handleError(_0x25f26c,null));};exports[_0x4c43('0x119')]=function(_0x178291,_0x242b3b){return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x178291[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x242b3b,null))[_0x4c43('0x20')](function(_0x21bcd3){if(_0x21bcd3){var _0x30d8b7=_0x21bcd3[_0x4c43('0x37')]({'plain':!![]});var _0x517a97=_0x178291[_0x4c43('0x4c')][_0x4c43('0x6a')];return _0x21bcd3[_0x4c43('0x119')](_0x517a97)[_0x4c43('0x20')](function(){for(var _0xa4c6e6=0x0;_0xa4c6e6<_0x517a97['length'];_0xa4c6e6++){var _0x28ee92=[];db[_0x4c43('0x108')]['findOne']({'where':{'id':_0x517a97[_0xa4c6e6]}})[_0x4c43('0x20')](function(_0x286808){_0x28ee92['push'](_0x286808[_0x4c43('0xe5')]()[_0x4c43('0x20')](function(_0x2b3b87){for(var _0x271a7a=0x0;_0x271a7a<_0x2b3b87[_0x4c43('0x53')];_0x271a7a++){_0x2b3b87[_0x271a7a][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x10a'));}return _0x2b3b87;}));_0x28ee92['push'](_0x286808['getChatQueues']()['then'](function(_0x5abace){for(var _0xea9a6e=0x0;_0xea9a6e<_0x5abace[_0x4c43('0x53')];_0xea9a6e++){_0x5abace[_0xea9a6e][_0x4c43('0x109')]('channel',_0x4c43('0x10b'));}return _0x5abace;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x10c')]()[_0x4c43('0x20')](function(_0x1d56cb){for(var _0x155b52=0x0;_0x155b52<_0x1d56cb['length'];_0x155b52++){_0x1d56cb[_0x155b52]['setDataValue'](_0x4c43('0x9d'),_0x4c43('0x11a'));}return _0x1d56cb;}));_0x28ee92['push'](_0x286808[_0x4c43('0x10d')]()[_0x4c43('0x20')](function(_0x439baf){for(var _0x209429=0x0;_0x209429<_0x439baf[_0x4c43('0x53')];_0x209429++){_0x439baf[_0x209429][_0x4c43('0x109')]('channel',_0x4c43('0x10e'));}return _0x439baf;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x10f')]()[_0x4c43('0x20')](function(_0x1e4604){for(var _0x579b30=0x0;_0x579b30<_0x1e4604['length'];_0x579b30++){_0x1e4604[_0x579b30][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x110'));}return _0x1e4604;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x111')]()[_0x4c43('0x20')](function(_0x3dd9ca){for(var _0x23c80c=0x0;_0x23c80c<_0x3dd9ca['length'];_0x23c80c++){_0x3dd9ca[_0x23c80c][_0x4c43('0x109')](_0x4c43('0x9d'),_0x4c43('0x112'));}return _0x3dd9ca;}));_0x28ee92[_0x4c43('0xae')](_0x286808[_0x4c43('0x113')]()[_0x4c43('0x20')](function(_0x56db5a){for(var _0x327ace=0x0;_0x327ace<_0x56db5a['length'];_0x327ace++){_0x56db5a[_0x327ace]['setDataValue']('channel',_0x4c43('0x114'));}return _0x56db5a;}));return BPromise[_0x4c43('0xe9')](_0x28ee92);})['then'](function(_0x2bc6a8){var _0x2271ff=_[_0x4c43('0x115')](_0x2bc6a8);_0x28ee92=[];return db[_0x4c43('0x5a')][_0x4c43('0x116')](function(_0x2e5a3f){for(var _0x5d4618=0x0;_0x5d4618<_0x2271ff[_0x4c43('0x53')];_0x5d4618++){_0x28ee92[_0x4c43('0xae')](_0x2271ff[_0x5d4618]['removeAgent'](_0x30d8b7['id']),{'transaction':_0x2e5a3f});}return BPromise['all'](_0x28ee92)['then'](function(){if(_0x30d8b7[_0x4c43('0x9e')]){return BPromise[_0x4c43('0xb0')](_[_0x4c43('0x3c')](_0x2271ff,function(_0x47b321){return _0x47b321[_0x4c43('0x118')]('channel')===_0x4c43('0x10a');}),function(_0x234aaa){return db[_0x4c43('0xb1')][_0x4c43('0x36')]({'where':{'VoiceQueueId':_0x234aaa['id'],'UserId':_0x30d8b7['id']},'transaction':_0x2e5a3f});});}else{return;}})[_0x4c43('0x20')](function(){for(var _0x5de4f8=0x0;_0x5de4f8<_0x2271ff[_0x4c43('0x53')];_0x5de4f8++){var _0x10a406=_0x2271ff[_0x5de4f8][_0x4c43('0x118')](_0x4c43('0x9d'));var _0x33bd64=_0x10a406+_0x4c43('0xa9');socket[_0x4c43('0xaa')](_0x4c43('0x6e')+_0x10a406+'Queue:remove',{'UserId':_0x30d8b7['id'],['queueField']:_0x2271ff[_0x5de4f8]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x242b3b,null))[_0x4c43('0x60')](handleError(_0x242b3b,null));};exports['getLists']=function(_0x33ed7a,_0x417ae7,_0x108bc7){var _0x53d25a={};var _0x2e8dc6={};var _0x1938fd;var _0x4b3461;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x33ed7a[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x417ae7,null))[_0x4c43('0x20')](function(_0xa46d7c){if(_0xa46d7c){_0x1938fd=_0xa46d7c;_0x2e8dc6['model']=_[_0x4c43('0x4d')](db[_0x4c43('0x11b')][_0x4c43('0x47')]);_0x2e8dc6[_0x4c43('0x4c')]=_[_0x4c43('0x4d')](_0x33ed7a[_0x4c43('0x4c')]);_0x2e8dc6[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x2e8dc6[_0x4c43('0x51')],_0x2e8dc6['query']);_0x53d25a[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x2e8dc6[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x53d25a[_0x4c43('0x50')]=_0x53d25a[_0x4c43('0x50')][_0x4c43('0x53')]?_0x53d25a['attributes']:_0x2e8dc6[_0x4c43('0x51')];_0x53d25a[_0x4c43('0xc1')]=qs[_0x4c43('0x56')](_0x33ed7a['query']['sort']);_0x53d25a['where']=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x33ed7a['query'],_0x2e8dc6[_0x4c43('0x4e')]));if(_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x53d25a[_0x4c43('0x57')]=_[_0x4c43('0x59')](_0x53d25a[_0x4c43('0x57')],{'$or':_['map'](_0x53d25a['attributes'],function(_0x201649){var _0x5e29df={};_0x5e29df[_0x201649]={'$like':'%'+_0x33ed7a[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x5e29df;})});}_0x53d25a=_[_0x4c43('0x59')]({},_0x53d25a,_0x33ed7a['options']);return _0x1938fd['getLists'](_0x53d25a);}})[_0x4c43('0x20')](function(_0x46d901){if(_0x46d901){_0x4b3461=_0x46d901[_0x4c43('0x53')];if(!_0x33ed7a[_0x4c43('0x4c')]['hasOwnProperty'](_0x4c43('0x55'))){_0x53d25a[_0x4c43('0x2f')]=qs['limit'](_0x33ed7a[_0x4c43('0x4c')]['limit']);_0x53d25a[_0x4c43('0x2e')]=qs[_0x4c43('0x2e')](_0x33ed7a[_0x4c43('0x4c')]['offset']);}return _0x1938fd['getLists'](_0x53d25a);}})['then'](function(_0x81fd6a){if(_0x81fd6a){return _0x81fd6a?{'count':_0x4b3461,'rows':_0x81fd6a}:null;}})['then'](respondWithResult(_0x417ae7,null))[_0x4c43('0x60')](handleError(_0x417ae7,null));};exports['getAgents']=function(_0x56ddad,_0x1126f1,_0x45fc46){var _0x34f888={};var _0x342bf1={};var _0x4c2f8d;var _0x2d64af;return db[_0x4c43('0x46')][_0x4c43('0xbf')]({'where':{'id':_0x56ddad[_0x4c43('0x62')]['id']}})[_0x4c43('0x20')](handleEntityNotFound(_0x1126f1,null))[_0x4c43('0x20')](function(_0x5fb4e6){if(_0x5fb4e6){_0x4c2f8d=_0x5fb4e6;_0x342bf1[_0x4c43('0x51')]=_[_0x4c43('0x4d')](db[_0x4c43('0x46')][_0x4c43('0x47')]);_0x342bf1['query']=_[_0x4c43('0x4d')](_0x56ddad[_0x4c43('0x4c')]);_0x342bf1[_0x4c43('0x4e')]=_[_0x4c43('0x4f')](_0x342bf1[_0x4c43('0x51')],_0x342bf1['query']);_0x34f888[_0x4c43('0x50')]=_[_0x4c43('0x4f')](_0x342bf1[_0x4c43('0x51')],qs[_0x4c43('0x52')](_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x52')]));_0x34f888[_0x4c43('0x50')]=_0x34f888[_0x4c43('0x50')]['length']?_0x34f888['attributes']:_0x342bf1[_0x4c43('0x51')];_0x34f888['order']=qs[_0x4c43('0x56')](_0x56ddad[_0x4c43('0x4c')]['sort']);_0x34f888[_0x4c43('0x57')]=qs[_0x4c43('0x4e')](_[_0x4c43('0x58')](_0x56ddad[_0x4c43('0x4c')],_0x342bf1[_0x4c43('0x4e')]));if(_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x3c')]){_0x34f888['where']=_[_0x4c43('0x59')](_0x34f888['where'],{'$or':_['map'](_0x34f888['attributes'],function(_0x36cca1){var _0x497a5a={};_0x497a5a[_0x36cca1]={'$like':'%'+_0x56ddad[_0x4c43('0x4c')][_0x4c43('0x3c')]+'%'};return _0x497a5a;})});}_0x34f888['model']=db['User'];_0x34f888['as']=_0x4c43('0x39');_0x34f888=_[_0x4c43('0x59')]({},_0x34f888,_0x56ddad['options']);return _0x4c2f8d[_0x4c43('0xe5')]({'include':[_0x34f888]});}})[_0x4c43('0x20')](function(_0x7741a6){if(_0x7741a6){var _0x921d09={},_0x1d1deb=[],_0x337975=0x0;for(var _0x1188a0=0x0;_0x1188a0<_0x7741a6[_0x4c43('0x53')];_0x1188a0+=0x1){for(var _0x5b0a02=0x0,_0x1ea43e;_0x5b0a02<_0x7741a6[_0x1188a0]['Agents'][_0x4c43('0x53')];_0x5b0a02+=0x1){_0x1ea43e=_0x7741a6[_0x1188a0][_0x4c43('0x39')][_0x5b0a02][_0x4c43('0x37')]({'plain':!![]});_0x921d09[_0x1ea43e['id']]=_0x1ea43e;}}_0x921d09=_[_0x4c43('0x11c')](_0x921d09);for(var _0x5ceacc=qs['offset'](_0x56ddad['query'][_0x4c43('0x2e')]);_0x5ceacc<_0x921d09[_0x4c43('0x53')]&&_0x1d1deb[_0x4c43('0x53')]=_0x17607a){_0x3eb340=_0x17607a;_0x4dff9c=0xc8;}else{_0x4dff9c=0xce;}_0x2a533e[_0xbab6('0x2e')](_0x4dff9c);return _0x2a533e[_0xbab6('0x33')](_0xbab6('0x34'),_0x1a146b+'-'+_0x3eb340+'/'+_0x17607a)[_0xbab6('0x30')](_0x52db63);}return null;};}function patchUpdates(_0xd79f9a){return function(_0xa2312){try{jsonpatch['apply'](_0xa2312,_0xd79f9a,!![]);}catch(_0x180600){return BPromise['reject'](_0x180600);}return _0xa2312[_0xbab6('0x35')]();};}function saveUpdates(_0xa94054,_0x1d4edc){return function(_0x2fcdfd){if(_0x2fcdfd){return _0x2fcdfd[_0xbab6('0x36')](_0xa94054)['then'](function(_0x4f84a7){return _0x4f84a7;});}return null;};}function removeEntity(_0x1f928c,_0x3f4c69){return function(_0x1faef2){if(_0x1faef2){return _0x1faef2[_0xbab6('0x37')]()[_0xbab6('0x24')](function(){var _0x5f03a9=_0x1faef2[_0xbab6('0x38')]({'plain':!![]});var _0x917211=[{'name':_0xbab6('0x39'),'value':_0xbab6('0x3a'),'ignore':!![]},{'name':_0xbab6('0x3b'),'value':'agent','ignore':![]},{'name':_0xbab6('0x3c'),'value':_0xbab6('0x3d'),'ignore':![]}];var _0x1f6f73=_(_0x917211)[_0xbab6('0x3e')](_0xbab6('0x3f'))['map'](_0xbab6('0x40'))[_0xbab6('0x40')]();if(_[_0xbab6('0x41')](_0x1f6f73,_0x5f03a9['role'])){return;}var _0x2014d5=_[_0xbab6('0x42')](_0x917211,[_0xbab6('0x40'),_0x5f03a9[_0xbab6('0x43')]])[_0xbab6('0x44')];return db[_0xbab6('0x45')]['destroy']({'where':{'type':_0x2014d5,'resourceId':_0x5f03a9['id']}})[_0xbab6('0x24')](function(){return _0x1faef2;});})['then'](function(){_0x1f928c[_0xbab6('0x2e')](0xcc)[_0xbab6('0x2f')]();});}};}function handleEntityNotFound(_0x347a87,_0x391329){return function(_0x4672dd){if(!_0x4672dd){_0x347a87[_0xbab6('0x2d')](0x194);}return _0x4672dd;};}function handleError(_0x2d1418,_0x32ec33){_0x32ec33=_0x32ec33||0x1f4;return function(_0x1ff432){logger[_0xbab6('0x29')](_0x1ff432[_0xbab6('0x46')]);if(_0x1ff432[_0xbab6('0x44')]){delete _0x1ff432[_0xbab6('0x44')];}_0x2d1418[_0xbab6('0x2e')](_0x32ec33)[_0xbab6('0x47')](_0x1ff432);};}exports[_0xbab6('0x48')]=function(_0x151865,_0x41e634){var _0x16fd3e={},_0x405b90={},_0xc3ab7a={'count':0x0,'rows':[]};var _0x3cf96a=_['map'](db[_0xbab6('0x49')]['rawAttributes'],function(_0x3537dd){return{'name':_0x3537dd[_0xbab6('0x4a')],'type':_0x3537dd['type'][_0xbab6('0x4b')]};});_0x405b90[_0xbab6('0x4c')]=_['differenceBy'](_['map'](_0x3cf96a,_0xbab6('0x44')),[_0xbab6('0x4d'),_0xbab6('0x4e')]);_0x405b90['query']=_[_0xbab6('0x4f')](_0x151865['query']);_0x405b90[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x405b90[_0xbab6('0x4c')],_0x405b90[_0xbab6('0x52')]);_0x16fd3e[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x405b90['model'],qs['fields'](_0x151865['query']['fields']));_0x16fd3e[_0xbab6('0x53')]=_0x16fd3e[_0xbab6('0x53')][_0xbab6('0x54')]?_0x16fd3e[_0xbab6('0x53')]:_0x405b90[_0xbab6('0x4c')];if(!_0x151865['query'][_0xbab6('0x55')](_0xbab6('0x56'))){_0x16fd3e[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x151865[_0xbab6('0x52')]['limit']);_0x16fd3e['offset']=qs[_0xbab6('0x32')](_0x151865['query'][_0xbab6('0x32')]);}_0x16fd3e[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x151865[_0xbab6('0x52')][_0xbab6('0x59')]);_0x16fd3e[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x151865[_0xbab6('0x52')],_0x405b90[_0xbab6('0x50')]),_0x3cf96a);if(_0x151865['query'][_0xbab6('0x3e')]){_0x16fd3e[_0xbab6('0x5a')]=_['merge'](_0x16fd3e['where'],{'$or':_['map'](_0x3cf96a,function(_0x4ddbd5){if(_0x4ddbd5[_0xbab6('0x5c')]!==_0xbab6('0x5d')){return db[_0xbab6('0x5e')][_0xbab6('0x5a')](db[_0xbab6('0x5e')]['fn']('lower',db[_0xbab6('0x5e')]['col'](_0x4ddbd5[_0xbab6('0x44')])),{'$like':db[_0xbab6('0x5e')]['fn']('lower','%'+_0x151865['query']['filter']+'%')});}})});}_0x16fd3e=_[_0xbab6('0x5f')]({},_0x16fd3e,_0x151865[_0xbab6('0x60')]);var _0x14b28e={'where':_0x16fd3e[_0xbab6('0x5a')]};return db[_0xbab6('0x49')][_0xbab6('0x31')](_0x14b28e)[_0xbab6('0x24')](function(_0x2faa64){_0xc3ab7a[_0xbab6('0x31')]=_0x2faa64;if(_0x151865[_0xbab6('0x52')]['includeAll']){_0x16fd3e[_0xbab6('0x61')]=[{'all':!![]}];}return db['User'][_0xbab6('0x62')](_0x16fd3e);})['then'](function(_0x21593e){_0xc3ab7a['rows']=_0x21593e;return _0xc3ab7a;})[_0xbab6('0x24')](respondWithFilteredResult(_0x41e634,_0x16fd3e))[_0xbab6('0x2c')](handleError(_0x41e634,null));};exports[_0xbab6('0x63')]=function(_0x2876e0,_0x40bc7b){var _0x366ff7={'raw':![],'where':{'id':_0x2876e0[_0xbab6('0x64')]['id']}},_0x4cd3e5={};_0x4cd3e5[_0xbab6('0x4c')]=_[_0xbab6('0x65')](_[_0xbab6('0x4f')](db[_0xbab6('0x49')]['rawAttributes']),[_0xbab6('0x4d'),'salt']);_0x4cd3e5[_0xbab6('0x52')]=_['keys'](_0x2876e0[_0xbab6('0x52')]);_0x4cd3e5[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x4cd3e5[_0xbab6('0x4c')],_0x4cd3e5[_0xbab6('0x52')]);_0x366ff7[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x4cd3e5[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x2876e0[_0xbab6('0x52')][_0xbab6('0x66')]));_0x366ff7[_0xbab6('0x53')]=_0x366ff7[_0xbab6('0x53')][_0xbab6('0x54')]?_0x366ff7[_0xbab6('0x53')]:_0x4cd3e5[_0xbab6('0x4c')];if(_0x2876e0[_0xbab6('0x52')][_0xbab6('0x67')]){_0x366ff7[_0xbab6('0x61')]=[{'all':!![]}];}_0x366ff7=_[_0xbab6('0x5f')]({},_0x366ff7,_0x2876e0[_0xbab6('0x60')]);return db[_0xbab6('0x49')][_0xbab6('0x42')](_0x366ff7)[_0xbab6('0x24')](handleEntityNotFound(_0x40bc7b,null))[_0xbab6('0x24')](respondWithResult(_0x40bc7b,null))['catch'](handleError(_0x40bc7b,null));};exports[_0xbab6('0x68')]=function(_0x40d0cb,_0x45d162){return db[_0xbab6('0x49')][_0xbab6('0x68')](_0x40d0cb[_0xbab6('0x69')],{'raw':![],'individualHooks':!![]})[_0xbab6('0x24')](respondWithResult(_0x45d162,0xc9))[_0xbab6('0x2c')](handleError(_0x45d162,null));};exports[_0xbab6('0x36')]=function(_0x17d687,_0xe51d39){if(_0x17d687['body']['id']){delete _0x17d687['body']['id'];}delete _0x17d687['body'][_0xbab6('0x43')];return db[_0xbab6('0x49')][_0xbab6('0x42')]({'where':{'id':_0x17d687[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0xe51d39,null))[_0xbab6('0x24')](saveUpdates(_0x17d687[_0xbab6('0x69')],null))['then'](respondWithResult(_0xe51d39,null))[_0xbab6('0x2c')](handleError(_0xe51d39,null));};exports[_0xbab6('0x6a')]=function(_0x109ad1,_0x4fd6db){return db[_0xbab6('0x49')][_0xbab6('0x6a')]()[_0xbab6('0x24')](respondWithResult(_0x4fd6db,null))['catch'](handleError(_0x4fd6db,null));};exports[_0xbab6('0x6b')]=function(_0xc5d38e,_0x51a82f,_0x36724){return db[_0xbab6('0x49')]['find']({'where':{'id':_0xc5d38e['params']['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x51a82f,null))[_0xbab6('0x24')](function(_0x3a1bde){if(_0x3a1bde){return _0x3a1bde[_0xbab6('0x6b')](_0xc5d38e[_0xbab6('0x69')][_0xbab6('0x6c')],_['omit'](_0xc5d38e[_0xbab6('0x69')],[_0xbab6('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x51a82f,null))[_0xbab6('0x2c')](handleError(_0x51a82f,null));};var getLicense=function(_0x17a47d){return new BPromise(function(_0x3a7eeb,_0x96851d){var _0x79341c=0x0;_0x17a47d[_0xbab6('0x69')][_0xbab6('0x43')]===_0xbab6('0x6d')&&_0x3a7eeb('agent\x20role');return db[_0xbab6('0x49')]['count']({'where':{'$or':[{'role':_0x17a47d['body']['role']===_0xbab6('0x3d')?_0xbab6('0x3d'):[_0xbab6('0x6e'),'user']}]}})[_0xbab6('0x24')](function(_0xb4dda5){_0x79341c=_0xb4dda5;return require(_0xbab6('0x6f'))[_0xbab6('0x70')]();})[_0xbab6('0x24')](function(_0x28e977){var _0x3d8da8=_0x17a47d[_0xbab6('0x69')][_0xbab6('0x43')]===_0xbab6('0x3d')?_0xbab6('0x71'):'users';if(!_[_0xbab6('0x72')](_0x28e977[_0x3d8da8])&&_0x79341c>=_0x28e977[_0x3d8da8]){return _0x96851d({'message':_0xbab6('0x73')});}return _0x3a7eeb(util[_0xbab6('0x74')]('count\x20%s:\x20%s',_0x3d8da8,_0x79341c));})[_0xbab6('0x2c')](function(_0x575228){return _0x96851d(_0x575228);});});};exports['create']=function(_0x1ccdf7,_0x4fadab){return getLicense(_0x1ccdf7)[_0xbab6('0x24')](function(_0x58af4b){if(!_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]){var _0x303c6d;return db[_0xbab6('0x76')][_0xbab6('0x77')](0x1)[_0xbab6('0x24')](function(_0x30b6a9){return checkPasswordPattern(_0x30b6a9,_0x1ccdf7[_0xbab6('0x69')]['password'],_0x30b6a9[_0xbab6('0x78')]);})[_0xbab6('0x24')](function(_0x186d79){_0x303c6d=_0x186d79['min_internal'];return db[_0xbab6('0x49')][_0xbab6('0x79')](_0xbab6('0x75'));})['then'](function(_0x1f575d){if(_['isNil'](_0x1f575d)){if(_0x303c6d){_0x1ccdf7['body'][_0xbab6('0x75')]=_0x303c6d;}else{_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]=0x1;}}else{if(_[_0xbab6('0x72')](_0x303c6d)||_0x303c6d==_0x1f575d){_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]=_0x1f575d+0x1;}else if(_0x303c6d>_0x1f575d){_0x1ccdf7[_0xbab6('0x69')]['internal']=_0x303c6d;}else{return db[_0xbab6('0x5e')]['query'](_0xbab6('0x7a'),{'type':db['sequelize'][_0xbab6('0x7b')][_0xbab6('0x7c')]})['then'](function(_0x6ad16c){if(_0x6ad16c&&_0x6ad16c[_0xbab6('0x54')]){for(var _0x24a2c8=0x0,_0x210883=_0x6ad16c['length'];_0x24a2c8<_0x210883&&_['isNil'](_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]);_0x24a2c8++){if(_0x303c6d<=_0x6ad16c[_0x24a2c8][_0xbab6('0x7d')]){_0x1ccdf7['body']['internal']=_0x6ad16c[_0x24a2c8][_0xbab6('0x7d')];}else if(_0x303c6d>_0x6ad16c[_0x24a2c8][_0xbab6('0x7d')]&&_0x303c6d<=_0x6ad16c[_0x24a2c8]['to']){_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]=_0x303c6d;}}}if(_['isNil'](_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')])){_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')]=_0x1f575d+0x1;}});}}});}})[_0xbab6('0x24')](function(){if(_0x1ccdf7['body'][_0xbab6('0x7e')]){_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x7f')]=_0x1ccdf7[_0xbab6('0x69')]['internal'];_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x80')]={'mailbox':_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x75')],'password':_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x4d')],'fullname':_0x1ccdf7[_0xbab6('0x69')]['fullname'],'email':_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x81')]};}if(_0x1ccdf7[_0xbab6('0x69')]&&_0x1ccdf7['body'][_0xbab6('0x43')]===_0xbab6('0x6d')){if(!_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x82')]){_0x1ccdf7[_0xbab6('0x69')]['permissions']=[_0xbab6('0x83'),_0xbab6('0x84'),'103','113','110',_0xbab6('0x85'),_0xbab6('0x86'),_0xbab6('0x87'),_0xbab6('0x88'),'108',_0xbab6('0x89'),_0xbab6('0x8a'),_0xbab6('0x8b'),_0xbab6('0x8c')];}}return db[_0xbab6('0x49')][_0xbab6('0x8d')](_0x1ccdf7['body'],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xbab6('0x24')](function(_0x192a5e){if(_0x1ccdf7[_0xbab6('0x69')][_0xbab6('0x43')]===_0xbab6('0x3a'))return _0x192a5e;var _0x1eec85=_0x1ccdf7['user']['get']({'plain':!![]});if(!_0x1eec85)throw new Error(_0xbab6('0x8e'));if(_0x1eec85['role']===_0xbab6('0x3a')){var _0x45e84c=_0x192a5e['get']({'plain':!![]});var _0x3dd83d=[{'name':_0xbab6('0x3b'),'value':_0xbab6('0x6d')},{'name':'Telephones','value':_0xbab6('0x3d')}];var _0x14dce0=_[_0xbab6('0x42')](_0x3dd83d,[_0xbab6('0x40'),_0x45e84c[_0xbab6('0x43')]])[_0xbab6('0x44')];return db[_0xbab6('0x8f')][_0xbab6('0x42')]({'where':{'name':_0x14dce0,'userProfileId':_0x1eec85[_0xbab6('0x90')]},'raw':!![]})[_0xbab6('0x24')](function(_0xb66c1d){if(_0xb66c1d&&_0xb66c1d[_0xbab6('0x91')]===0x0){return db['UserProfileResource'][_0xbab6('0x8d')]({'name':_0x45e84c[_0xbab6('0x44')],'resourceId':_0x45e84c['id'],'type':_0xb66c1d[_0xbab6('0x44')],'sectionId':_0xb66c1d['id']},{})[_0xbab6('0x24')](function(){return _0x192a5e;});}else{return _0x192a5e;}})[_0xbab6('0x2c')](function(_0x1cb737){logger[_0xbab6('0x29')](_0xbab6('0x92'),_0x1cb737);throw _0x1cb737;});}return _0x192a5e;})['then'](respondWithResult(_0x4fadab,0xc9))['catch'](handleError(_0x4fadab,null));};exports[_0xbab6('0x93')]=function(_0x1df9a1,_0x20c244,_0x5697fc){var _0x5e8909=![];if(_0x1df9a1[_0xbab6('0x69')]['id']){delete _0x1df9a1[_0xbab6('0x69')]['id'];}return db[_0xbab6('0x76')][_0xbab6('0x94')]({'attributes':['id','securePassword']})[_0xbab6('0x24')](function(_0x305d5c){_0x5e8909=_0x305d5c[_0xbab6('0x78')];return db[_0xbab6('0x49')][_0xbab6('0x42')]({'where':{'id':_0x1df9a1[_0xbab6('0x64')]['id']}});})['then'](function(_0x3c6950){if(_0x3c6950){if(_0x3c6950['id']==_0x1df9a1[_0xbab6('0x3a')]['id']){if(!_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x95')]||!_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x96')]){throw new db['Sequelize'][(_0xbab6('0x21'))](_0xbab6('0x97'));}if(!_0x3c6950[_0xbab6('0x98')](_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x95')])){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0x99'));}if(_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x95')]==_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x96')]){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0x9a'));}return _0x3c6950;}else if(_0x1df9a1[_0xbab6('0x3a')][_0xbab6('0x43')]==_0xbab6('0x6e')){if(!_0x1df9a1[_0xbab6('0x69')]['newPassword']){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0x9b'));}return _0x3c6950;}else if(_0x1df9a1[_0xbab6('0x3a')][_0xbab6('0x43')]==_0xbab6('0x3a')){if(!_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x96')]){throw new db[(_0xbab6('0x20'))]['ValidationError'](_0xbab6('0x9b'));}if(_0x3c6950[_0xbab6('0x43')]!=_0xbab6('0x6d')){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0x9c'));}return _0x3c6950;}else{throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))]('Unauthorized');}}return null;})['then'](handleEntityNotFound(_0x20c244,null))[_0xbab6('0x24')](function(_0xfaeaa1){return checkPasswordPattern(_0xfaeaa1,_0x1df9a1[_0xbab6('0x69')][_0xbab6('0x96')],_0x5e8909);})[_0xbab6('0x24')](saveUpdates({'password':_0x1df9a1[_0xbab6('0x69')]['newPassword'],'passwordResetAt':_0x1df9a1[_0xbab6('0x3a')]['id']==_0x1df9a1['params']['id']?moment():null},null))[_0xbab6('0x24')](respondWithResult(_0x20c244,null))[_0xbab6('0x2c')](handleError(_0x20c244,null));};exports['addQueues']=function(_0x2d4aec,_0xb42555,_0x1c4946){var _0x160a9e=_0x2d4aec[_0xbab6('0x69')]['channel'];return db['User'][_0xbab6('0x42')]({'where':{'id':_0x2d4aec[_0xbab6('0x64')]['id']},'attributes':['id',_0xbab6('0x44'),'role',_0xbab6('0x9d'),'loginInPause',_0xbab6('0x9e'),_0xbab6('0x9f')]})[_0xbab6('0x24')](handleEntityNotFound(_0xb42555,null))[_0xbab6('0x24')](function(_0x4f11b9){if(_0x4f11b9){if(!utils['isValidChannel'](_0x160a9e)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x4f11b9['add'+_[_0xbab6('0xa0')](_0x160a9e[_0xbab6('0xa1')]())+_0xbab6('0xa2')](_0x2d4aec[_0xbab6('0x69')]['ids'],{'penalty':_0x2d4aec[_0xbab6('0x69')][_0xbab6('0xa3')]||0x0})[_0xbab6('0xa4')](function(_0x50f9e3){for(var _0x3fae5c=0x0;_0x3fae5c<_0x2d4aec[_0xbab6('0x69')]['ids'][_0xbab6('0x54')];_0x3fae5c+=0x1){var _0x1909d5={'UserId':_0x2d4aec[_0xbab6('0x64')]['id']};_0x1909d5[_[_0xbab6('0xa0')](_0x160a9e[_0xbab6('0xa1')]())+_0xbab6('0xa5')]=_0x2d4aec[_0xbab6('0x69')][_0xbab6('0x6c')][_0x3fae5c];socket[_0xbab6('0xa6')](_0xbab6('0x3a')+_[_0xbab6('0xa0')](_0x160a9e[_0xbab6('0xa1')]())+_0xbab6('0xa7'),_0x1909d5);}return _0x50f9e3;})[_0xbab6('0x24')](function(){if(_0x160a9e==='voice'){return db[_0xbab6('0xa8')]['findAll']({'where':{'id':_0x2d4aec[_0xbab6('0x69')]['ids']||[]},'raw':!![],'attributes':['id',_0xbab6('0x44')]});}})[_0xbab6('0x24')](function(_0x44b79d){var _0x938135=_0x4f11b9[_0xbab6('0x38')]({'plain':!![]});var _0x250d9d=[];if(_0x160a9e===_0xbab6('0xa9')&&_0x938135[_0xbab6('0x43')]==='agent'&&_0x938135[_0xbab6('0x9d')]){for(var _0x272e84=0x0;_0x272e84<_0x44b79d[_0xbab6('0x54')];_0x272e84+=0x1){_0x250d9d['push']({'membername':_0x938135[_0xbab6('0x44')],'UserId':_0x938135['id'],'queue_name':_0x44b79d[_0x272e84]['name'],'VoiceQueueId':_0x44b79d[_0x272e84]['id'],'interface':_['isNil'](_0x938135[_0xbab6('0x9f')])?util[_0xbab6('0x74')](_0xbab6('0xaa'),_0x938135['name']):_0x938135[_0xbab6('0x9f')],'paused':_0x938135[_0xbab6('0x9e')]||![],'penalty':_0x2d4aec[_0xbab6('0x69')][_0xbab6('0xa3')]||0x0});}return BPromise[_0xbab6('0xab')](_0x250d9d,function(_0x5b6d74){return db[_0xbab6('0xac')]['upsert'](_0x5b6d74);});}return _0x4f11b9;});}})[_0xbab6('0x24')](respondWithStatusCode(_0xb42555,null))[_0xbab6('0x2c')](handleError(_0xb42555,null));};exports['removeQueues']=function(_0x4d24fa,_0x19ed1b,_0x3b7e24){var _0x3189bb;return db[_0xbab6('0x49')]['find']({'where':{'id':_0x4d24fa[_0xbab6('0x64')]['id']},'attributes':['id','name',_0xbab6('0x43')]})['then'](handleEntityNotFound(_0x19ed1b,null))[_0xbab6('0x24')](function(_0x46eb83){if(_0x46eb83){_0x3189bb=_0x46eb83;if(!_0x4d24fa[_0xbab6('0x52')][_0xbab6('0xad')]||!utils[_0xbab6('0xae')](_0x4d24fa['query']['channel'])){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0xaf'));}return _0x46eb83[_0xbab6('0xb0')+_[_0xbab6('0xa0')](_0x4d24fa[_0xbab6('0x52')][_0xbab6('0xad')][_0xbab6('0xa1')]())+_0xbab6('0xa2')](_0x4d24fa['query'][_0xbab6('0x6c')]);}})['then'](function(_0x32de49){for(var _0x1ef37c=0x0;_0x1ef37c<_0x4d24fa[_0xbab6('0x52')][_0xbab6('0x6c')][_0xbab6('0x54')];_0x1ef37c+=0x1){var _0x4c4359={'UserId':_0x4d24fa['params']['id']};_0x4c4359[_[_0xbab6('0xa0')](_0x4d24fa['query'][_0xbab6('0xad')]['toLowerCase']())+_0xbab6('0xa5')]=_0x4d24fa[_0xbab6('0x52')]['ids'][_0x1ef37c];socket[_0xbab6('0xa6')](_0xbab6('0x3a')+_[_0xbab6('0xa0')](_0x4d24fa[_0xbab6('0x52')]['channel']['toLowerCase']())+_0xbab6('0xb1'),_0x4c4359);}return _0x32de49;})[_0xbab6('0x24')](function(){if(_0x4d24fa['query'][_0xbab6('0xad')]===_0xbab6('0xa9')){return db[_0xbab6('0xac')][_0xbab6('0x37')]({'where':{'UserId':_0x4d24fa[_0xbab6('0x64')]['id'],'VoiceQueueId':_0x4d24fa['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x3189bb;});}return _0x3189bb;})[_0xbab6('0x24')](respondWithStatusCode(_0x19ed1b,null))[_0xbab6('0x2c')](handleError(_0x19ed1b,null));};exports[_0xbab6('0xb2')]=function(_0x15a636,_0x252108,_0x4c600c){_0x15a636[_0xbab6('0x69')][_0xbab6('0xb3')]=_0x15a636[_0xbab6('0xb4')]['filename'];return db[_0xbab6('0x49')][_0xbab6('0x42')]({'where':{'id':_0x15a636[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x252108,null))[_0xbab6('0x24')](saveUpdates(_0x15a636[_0xbab6('0x69')],null))[_0xbab6('0x24')](respondWithResult(_0x252108,null))['catch'](handleError(_0x252108,null));};exports['getAvatar']=function(_0xa21bea,_0xeacb02,_0x1682ae){var _0x205c8f=path[_0xbab6('0xb5')](config[_0xbab6('0xb6')],_0xbab6('0xb7'));return db['User'][_0xbab6('0x42')]({'where':{'id':_0xa21bea[_0xbab6('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xbab6('0x24')](handleEntityNotFound(_0xeacb02,null))[_0xbab6('0x24')](function(_0x5e8e24){if(_0x5e8e24){if(_[_0xbab6('0x72')](_0x5e8e24[_0xbab6('0xb3')])){return _0xeacb02[_0xbab6('0xb8')](_0x205c8f);}else{if(!fs[_0xbab6('0xb9')](path[_0xbab6('0xb5')](config[_0xbab6('0xb6')],'server/files/images/',_0x5e8e24[_0xbab6('0xb3')]))){return _0xeacb02[_0xbab6('0xb8')](_0x205c8f);}return _0xeacb02[_0xbab6('0xb8')](path[_0xbab6('0xb5')](config[_0xbab6('0xb6')],_0xbab6('0xba'),_0x5e8e24[_0xbab6('0xb3')]));}}})[_0xbab6('0x2c')](handleError(_0xeacb02,null));};exports['getContacts']=function(_0x1035db,_0x32eff5,_0x1ca738){var _0x36a700={};var _0x24741f={};var _0x3e68ba;var _0x12a16f;return db['User'][_0xbab6('0x94')]({'where':{'id':_0x1035db[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x32eff5,null))[_0xbab6('0x24')](function(_0x503b08){if(_0x503b08){_0x3e68ba=_0x503b08;_0x24741f[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db[_0xbab6('0xbb')]['rawAttributes']);_0x24741f[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x1035db['query']);_0x24741f[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x24741f[_0xbab6('0x4c')],_0x24741f['query']);_0x36a700[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x24741f[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x1035db[_0xbab6('0x52')][_0xbab6('0x66')]));_0x36a700[_0xbab6('0x53')]=_0x36a700[_0xbab6('0x53')][_0xbab6('0x54')]?_0x36a700[_0xbab6('0x53')]:_0x24741f['model'];_0x36a700[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x1035db['query'][_0xbab6('0x59')]);_0x36a700[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x1035db[_0xbab6('0x52')],_0x24741f[_0xbab6('0x50')]));if(_0x1035db[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x36a700[_0xbab6('0x5a')]=_['merge'](_0x36a700[_0xbab6('0x5a')],{'$or':_['map'](_0x36a700[_0xbab6('0x53')],function(_0x4cedae){var _0x4bff7a={};_0x4bff7a[_0x4cedae]={'$like':'%'+_0x1035db[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x4bff7a;})});}_0x36a700=_['merge']({},_0x36a700,_0x1035db[_0xbab6('0x60')]);return _0x3e68ba['getContacts'](_0x36a700);}})[_0xbab6('0x24')](function(_0x5a836a){if(_0x5a836a){_0x12a16f=_0x5a836a[_0xbab6('0x54')];if(_0x1035db['query']['hasOwnProperty'](_0xbab6('0x67'))){_0x36a700[_0xbab6('0x61')]=[{'model':db[_0xbab6('0xbc')],'as':_0xbab6('0xbd'),'required':![]},{'model':db[_0xbab6('0xbe')],'as':_0xbab6('0xbf'),'attributes':['id','name',_0xbab6('0xc0')],'where':_0x1035db[_0xbab6('0x52')][_0xbab6('0xc1')]?{'id':_0x1035db[_0xbab6('0x52')][_0xbab6('0xc1')]}:undefined,'required':_0x1035db['query'][_0xbab6('0xc1')]?!![]:![]}];}if(!_0x1035db[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x36a700['limit']=qs[_0xbab6('0x57')](_0x1035db['query'][_0xbab6('0x57')]);_0x36a700[_0xbab6('0x32')]=qs['offset'](_0x1035db[_0xbab6('0x52')][_0xbab6('0x32')]);}return _0x3e68ba[_0xbab6('0xc2')](_0x36a700);}})[_0xbab6('0x24')](function(_0x3b5d2a){if(_0x3b5d2a){return _0x3b5d2a?{'count':_0x12a16f,'rows':_0x3b5d2a}:null;}})['then'](respondWithResult(_0x32eff5,null))[_0xbab6('0x2c')](handleError(_0x32eff5,null));};exports[_0xbab6('0xc3')]=function(_0x113b7e,_0x204643,_0x2668b5){var _0x18b7fe;var _0xefd8ad;var _0x2b39ec={};var _0xd336c1;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x113b7e[_0xbab6('0x64')]['id']},'attributes':['id','name',_0xbab6('0x43')]})[_0xbab6('0x24')](handleEntityNotFound(_0x204643,null))[_0xbab6('0x24')](function(_0x19ec5f){if(!utils['isValidChannel'](_0x113b7e[_0xbab6('0x52')]['channel'])){throw new db[(_0xbab6('0x20'))]['ValidationError'](_0xbab6('0xaf'));}_0x18b7fe=_0x19ec5f;var _0x2ece25={};_0x2ece25['model']=_[_0xbab6('0x4f')](db[_[_0xbab6('0xa0')](_0x113b7e[_0xbab6('0x52')][_0xbab6('0xad')])+_0xbab6('0xc4')][_0xbab6('0xc5')]);_0x2ece25[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x113b7e[_0xbab6('0x52')]);_0x2ece25[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x2ece25['model'],_0x2ece25[_0xbab6('0x52')]);_0x2b39ec[_0xbab6('0x53')]=_['intersection'](_0x2ece25[_0xbab6('0x4c')],qs['fields'](_0x113b7e[_0xbab6('0x52')]['fields']));_0x2b39ec[_0xbab6('0x53')]=_0x2b39ec[_0xbab6('0x53')][_0xbab6('0x54')]?_0x2b39ec[_0xbab6('0x53')]:_0x2ece25[_0xbab6('0x4c')];_0x2b39ec['order']=qs['sort'](_0x113b7e[_0xbab6('0x52')][_0xbab6('0x59')]);_0x2b39ec[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x113b7e[_0xbab6('0x52')],_0x2ece25[_0xbab6('0x50')]));if(_0x113b7e[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x2b39ec[_0xbab6('0x5a')]=_['merge'](_0x2b39ec[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x2b39ec[_0xbab6('0x53')],function(_0x83bc3b){var _0x2458af={};_0x2458af[_0x83bc3b]={'$like':'%'+_0x113b7e[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x2458af;})});}_0x2b39ec=_[_0xbab6('0x5f')]({},_0x2b39ec,_0x113b7e[_0xbab6('0x60')]);switch(_0x18b7fe['role']){case'admin':return db[_[_0xbab6('0xa0')](_0x113b7e[_0xbab6('0x52')]['channel'])+_0xbab6('0xc4')][_0xbab6('0x62')](_0x2b39ec);case'user':case'agent':return _0x18b7fe['get'+_['capitalize'](_0x113b7e['query']['channel'])+_0xbab6('0xa2')](_0x2b39ec);default:throw new db['Sequelize'][(_0xbab6('0x21'))](_0xbab6('0xc7'));}})[_0xbab6('0x24')](function(_0x1ce05f){_0xd336c1=_0x1ce05f['length'];if(!_0x113b7e['query'][_0xbab6('0x55')](_0xbab6('0x56'))){_0x2b39ec[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x113b7e['query'][_0xbab6('0x57')]);_0x2b39ec[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x113b7e['query'][_0xbab6('0x32')]);}switch(_0x18b7fe['role']){case'admin':return db[_[_0xbab6('0xa0')](_0x113b7e[_0xbab6('0x52')][_0xbab6('0xad')])+_0xbab6('0xc4')][_0xbab6('0x62')](_0x2b39ec);case _0xbab6('0x3a'):case _0xbab6('0x6d'):return _0x18b7fe[_0xbab6('0x38')+_['capitalize'](_0x113b7e['query']['channel'])+_0xbab6('0xa2')](_0x2b39ec);}})[_0xbab6('0x24')](function(_0x4e9365){return{'count':_0xd336c1,'rows':_0x4e9365};})[_0xbab6('0x24')](respondWithResult(_0x204643,null))[_0xbab6('0x2c')](handleError(_0x204643,null));};exports[_0xbab6('0xc8')]=function(_0x594165,_0x277065,_0x54d2aa){var _0x1c4831={};var _0x17612a={};var _0x7c1efe;var _0x1628eb;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x594165[_0xbab6('0x64')]['id']}})['then'](handleEntityNotFound(_0x277065,null))[_0xbab6('0x24')](function(_0x1910f0){if(_0x1910f0){_0x7c1efe=_0x1910f0;_0x17612a[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db[_0xbab6('0xac')][_0xbab6('0xc5')]);_0x17612a[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x594165[_0xbab6('0x52')]);_0x17612a[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x17612a[_0xbab6('0x4c')],_0x17612a[_0xbab6('0x52')]);_0x1c4831[_0xbab6('0x53')]=_['intersection'](_0x17612a[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x594165[_0xbab6('0x52')][_0xbab6('0x66')]));_0x1c4831[_0xbab6('0x53')]=_0x1c4831['attributes']['length']?_0x1c4831[_0xbab6('0x53')]:_0x17612a[_0xbab6('0x4c')];_0x1c4831[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x594165[_0xbab6('0x52')][_0xbab6('0x59')]);_0x1c4831['where']=qs['filters'](_[_0xbab6('0x5b')](_0x594165[_0xbab6('0x52')],_0x17612a[_0xbab6('0x50')]));if(_0x594165[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x1c4831['where']=_[_0xbab6('0x5f')](_0x1c4831[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x1c4831['attributes'],function(_0x5f388a){var _0x434e78={};_0x434e78[_0x5f388a]={'$like':'%'+_0x594165[_0xbab6('0x52')]['filter']+'%'};return _0x434e78;})});}_0x1c4831=_['merge']({},_0x1c4831,_0x594165[_0xbab6('0x60')]);return _0x7c1efe[_0xbab6('0xc8')](_0x1c4831);}})['then'](function(_0x32b404){if(_0x32b404){_0x1628eb=_0x32b404[_0xbab6('0x54')];if(!_0x594165[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x1c4831[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x594165[_0xbab6('0x52')][_0xbab6('0x57')]);_0x1c4831['offset']=qs[_0xbab6('0x32')](_0x594165[_0xbab6('0x52')][_0xbab6('0x32')]);}return _0x7c1efe[_0xbab6('0xc8')](_0x1c4831);}})[_0xbab6('0x24')](function(_0x4791eb){if(_0x4791eb){return _0x4791eb?{'count':_0x1628eb,'rows':_0x4791eb}:null;}})[_0xbab6('0x24')](respondWithResult(_0x277065,null))[_0xbab6('0x2c')](handleError(_0x277065,null));};exports['getGroups']=function(_0x3f276d,_0x794eb6,_0x304459){var _0x48fe95={};var _0x55cbbe={};var _0x583eff;var _0xb5a342;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x3f276d[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x794eb6,null))[_0xbab6('0x24')](function(_0xedd3cd){if(_0xedd3cd){_0x583eff=_0xedd3cd;_0x55cbbe[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db[_0xbab6('0xc9')]['rawAttributes']);_0x55cbbe[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x3f276d[_0xbab6('0x52')]);_0x55cbbe['filters']=_[_0xbab6('0x51')](_0x55cbbe[_0xbab6('0x4c')],_0x55cbbe[_0xbab6('0x52')]);_0x48fe95[_0xbab6('0x53')]=_['intersection'](_0x55cbbe[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x3f276d['query'][_0xbab6('0x66')]));_0x48fe95['attributes']=_0x48fe95[_0xbab6('0x53')][_0xbab6('0x54')]?_0x48fe95[_0xbab6('0x53')]:_0x55cbbe[_0xbab6('0x4c')];_0x48fe95['order']=qs[_0xbab6('0x59')](_0x3f276d[_0xbab6('0x52')][_0xbab6('0x59')]);_0x48fe95[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x3f276d['query'],_0x55cbbe['filters']));if(_0x3f276d[_0xbab6('0x52')]['filter']){_0x48fe95[_0xbab6('0x5a')]=_['merge'](_0x48fe95[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x48fe95['attributes'],function(_0x10adcb){var _0x4e30f0={};_0x4e30f0[_0x10adcb]={'$like':'%'+_0x3f276d[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x4e30f0;})});}_0x48fe95=_[_0xbab6('0x5f')]({},_0x48fe95,_0x3f276d[_0xbab6('0x60')]);return _0x583eff[_0xbab6('0xca')](_0x48fe95);}})[_0xbab6('0x24')](function(_0x2ea9a2){if(_0x2ea9a2){_0xb5a342=_0x2ea9a2[_0xbab6('0x54')];if(!_0x3f276d[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x48fe95['limit']=qs[_0xbab6('0x57')](_0x3f276d[_0xbab6('0x52')][_0xbab6('0x57')]);_0x48fe95[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x3f276d[_0xbab6('0x52')]['offset']);}return _0x583eff[_0xbab6('0xca')](_0x48fe95);}})[_0xbab6('0x24')](function(_0x572ac0){if(_0x572ac0){return _0x572ac0?{'count':_0xb5a342,'rows':_0x572ac0}:null;}})['then'](respondWithResult(_0x794eb6,null))[_0xbab6('0x2c')](handleError(_0x794eb6,null));};exports[_0xbab6('0xcb')]=function(_0x32703d,_0xbce780,_0xc9402d){var _0xc99d8a={'raw':!![],'where':{}};var _0x2b5a8e={};var _0x50bccd={'count':0x0,'rows':[]};return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x32703d['params']['id']}})['then'](handleEntityNotFound(_0xbce780,null))[_0xbab6('0x24')](function(_0x577911){if(_0x577911){_0x2b5a8e[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db[_0xbab6('0xcc')][_0xbab6('0xc5')]);_0x2b5a8e[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x32703d[_0xbab6('0x52')]);_0x2b5a8e['filters']=_[_0xbab6('0x51')](_0x2b5a8e[_0xbab6('0x4c')],_0x2b5a8e[_0xbab6('0x52')]);_0xc99d8a[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x2b5a8e[_0xbab6('0x4c')],qs['fields'](_0x32703d['query'][_0xbab6('0x66')]));_0xc99d8a[_0xbab6('0x53')]=_0xc99d8a[_0xbab6('0x53')][_0xbab6('0x54')]?_0xc99d8a[_0xbab6('0x53')]:_0x2b5a8e[_0xbab6('0x4c')];if(!_0x32703d[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0xc99d8a[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x32703d[_0xbab6('0x52')][_0xbab6('0x57')]);_0xc99d8a[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x32703d[_0xbab6('0x52')][_0xbab6('0x32')]);}_0xc99d8a[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x32703d[_0xbab6('0x52')][_0xbab6('0x59')]);_0xc99d8a[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x32703d[_0xbab6('0x52')],_0x2b5a8e[_0xbab6('0x50')]));_0xc99d8a['where'][_0xbab6('0xcd')]=_0x577911['id'];if(_0x32703d[_0xbab6('0x52')]['filter']){_0xc99d8a[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0xc99d8a[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0xc99d8a[_0xbab6('0x53')],function(_0x130b71){var _0x41b941={};_0x41b941[_0x130b71]={'$like':'%'+_0x32703d[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x41b941;})});}_0xc99d8a=_[_0xbab6('0x5f')]({},_0xc99d8a,_0x32703d[_0xbab6('0x60')]);return db[_0xbab6('0xcc')][_0xbab6('0x31')]({'where':_0xc99d8a['where']})[_0xbab6('0x24')](function(_0x5f5788){_0x50bccd[_0xbab6('0x31')]=_0x5f5788;if(_0x32703d[_0xbab6('0x52')][_0xbab6('0x67')]){_0xc99d8a[_0xbab6('0x61')]=[{'all':!![]}];}return db[_0xbab6('0xcc')][_0xbab6('0x62')](_0xc99d8a);})[_0xbab6('0x24')](function(_0x52ab1d){_0x50bccd[_0xbab6('0xce')]=_0x52ab1d;return _0x50bccd;});}})[_0xbab6('0x24')](respondWithFilteredResult(_0xbce780,_0xc99d8a))[_0xbab6('0x2c')](handleError(_0xbce780,null));};exports[_0xbab6('0xcf')]=function(_0x20559c,_0x312f47,_0x27173f){var _0x417904={'raw':!![],'where':{}};var _0x5e25eb={};var _0x21447a={'count':0x0,'rows':[]};return db[_0xbab6('0x49')]['findOne']({'where':{'id':_0x20559c[_0xbab6('0x64')]['id']}})['then'](handleEntityNotFound(_0x312f47,null))['then'](function(_0x1176f0){if(_0x1176f0){_0x5e25eb['model']=_[_0xbab6('0x4f')](db[_0xbab6('0xd0')]['rawAttributes']);_0x5e25eb[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x20559c['query']);_0x5e25eb[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x5e25eb[_0xbab6('0x4c')],_0x5e25eb['query']);_0x417904[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x5e25eb[_0xbab6('0x4c')],qs['fields'](_0x20559c[_0xbab6('0x52')][_0xbab6('0x66')]));_0x417904[_0xbab6('0x53')]=_0x417904[_0xbab6('0x53')]['length']?_0x417904[_0xbab6('0x53')]:_0x5e25eb[_0xbab6('0x4c')];if(!_0x20559c['query'][_0xbab6('0x55')](_0xbab6('0x56'))){_0x417904['limit']=qs[_0xbab6('0x57')](_0x20559c['query'][_0xbab6('0x57')]);_0x417904[_0xbab6('0x32')]=qs['offset'](_0x20559c[_0xbab6('0x52')][_0xbab6('0x32')]);}_0x417904[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x20559c[_0xbab6('0x52')][_0xbab6('0x59')]);_0x417904['where']=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x20559c[_0xbab6('0x52')],_0x5e25eb[_0xbab6('0x50')]));_0x417904['where']['UserId']=_0x1176f0['id'];if(_0x20559c[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x417904['where']=_['merge'](_0x417904[_0xbab6('0x5a')],{'$or':_['map'](_0x417904[_0xbab6('0x53')],function(_0x17bd81){var _0x13aa09={};_0x13aa09[_0x17bd81]={'$like':'%'+_0x20559c['query'][_0xbab6('0x3e')]+'%'};return _0x13aa09;})});}_0x417904=_[_0xbab6('0x5f')]({},_0x417904,_0x20559c[_0xbab6('0x60')]);return db[_0xbab6('0xd0')]['count']({'where':_0x417904[_0xbab6('0x5a')]})[_0xbab6('0x24')](function(_0x2c83ca){_0x21447a[_0xbab6('0x31')]=_0x2c83ca;if(_0x20559c['query'][_0xbab6('0x67')]){_0x417904[_0xbab6('0x61')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbab6('0x62')](_0x417904);})[_0xbab6('0x24')](function(_0x688190){_0x21447a[_0xbab6('0xce')]=_0x688190;return _0x21447a;});}})[_0xbab6('0x24')](respondWithFilteredResult(_0x312f47,_0x417904))[_0xbab6('0x2c')](handleError(_0x312f47,null));};exports[_0xbab6('0xd1')]=function(_0x144f55,_0xf547de,_0x21d0f1){var _0x3bf94c={};var _0x179abb={};var _0x4f2c8d;var _0x411eed;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x144f55[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0xf547de,null))[_0xbab6('0x24')](function(_0x289c6b){if(_0x289c6b){_0x4f2c8d=_0x289c6b;_0x179abb['model']=_[_0xbab6('0x4f')](db['ChatInteraction'][_0xbab6('0xc5')]);_0x179abb[_0xbab6('0x52')]=_['keys'](_0x144f55[_0xbab6('0x52')]);_0x179abb['filters']=_[_0xbab6('0x51')](_0x179abb['model'],_0x179abb['query']);_0x3bf94c[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x179abb[_0xbab6('0x4c')],qs['fields'](_0x144f55['query'][_0xbab6('0x66')]));_0x3bf94c[_0xbab6('0x53')]=_0x3bf94c['attributes'][_0xbab6('0x54')]?_0x3bf94c[_0xbab6('0x53')]:_0x179abb[_0xbab6('0x4c')];_0x3bf94c['order']=qs['sort'](_0x144f55[_0xbab6('0x52')]['sort']);_0x3bf94c['where']=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x144f55[_0xbab6('0x52')],_0x179abb[_0xbab6('0x50')]));if(_0x144f55[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x3bf94c[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0x3bf94c['where'],{'$or':_['map'](_0x3bf94c[_0xbab6('0x53')],function(_0x45ebed){var _0x1a62bb={};_0x1a62bb[_0x45ebed]={'$like':'%'+_0x144f55[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x1a62bb;})});}_0x3bf94c=_[_0xbab6('0x5f')]({},_0x3bf94c,_0x144f55[_0xbab6('0x60')]);return _0x4f2c8d[_0xbab6('0xd1')](_0x3bf94c);}})['then'](function(_0x4c95e6){if(_0x4c95e6){_0x411eed=_0x4c95e6[_0xbab6('0x54')];if(!_0x144f55[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x3bf94c['limit']=qs[_0xbab6('0x57')](_0x144f55[_0xbab6('0x52')][_0xbab6('0x57')]);_0x3bf94c['offset']=qs[_0xbab6('0x32')](_0x144f55[_0xbab6('0x52')][_0xbab6('0x32')]);}return _0x4f2c8d[_0xbab6('0xd1')](_0x3bf94c);}})[_0xbab6('0x24')](function(_0x54e2fb){if(_0x54e2fb){return _0x54e2fb?{'count':_0x411eed,'rows':_0x54e2fb}:null;}})[_0xbab6('0x24')](respondWithResult(_0xf547de,null))[_0xbab6('0x2c')](handleError(_0xf547de,null));};exports[_0xbab6('0xd2')]=function(_0x54089b,_0x1fa5a8,_0x137468){var _0x47d2b8={};var _0x1e5f2f={};var _0x4ec3e5;var _0x5ac184;return db[_0xbab6('0x49')]['findOne']({'where':{'id':_0x54089b[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x1fa5a8,null))[_0xbab6('0x24')](function(_0x190184){if(_0x190184){_0x4ec3e5=_0x190184;_0x1e5f2f['model']=_[_0xbab6('0x4f')](db[_0xbab6('0xd3')][_0xbab6('0xc5')]);_0x1e5f2f[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x54089b[_0xbab6('0x52')]);_0x1e5f2f[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x1e5f2f[_0xbab6('0x4c')],_0x1e5f2f['query']);_0x47d2b8['attributes']=_[_0xbab6('0x51')](_0x1e5f2f['model'],qs[_0xbab6('0x66')](_0x54089b['query'][_0xbab6('0x66')]));_0x47d2b8['attributes']=_0x47d2b8['attributes'][_0xbab6('0x54')]?_0x47d2b8['attributes']:_0x1e5f2f['model'];_0x47d2b8[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x54089b['query'][_0xbab6('0x59')]);_0x47d2b8[_0xbab6('0x5a')]=qs['filters'](_[_0xbab6('0x5b')](_0x54089b[_0xbab6('0x52')],_0x1e5f2f['filters']));if(_0x54089b[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x47d2b8['where']=_[_0xbab6('0x5f')](_0x47d2b8['where'],{'$or':_[_0xbab6('0xc6')](_0x47d2b8[_0xbab6('0x53')],function(_0x47f45e){var _0x35e446={};_0x35e446[_0x47f45e]={'$like':'%'+_0x54089b['query']['filter']+'%'};return _0x35e446;})});}_0x47d2b8=_[_0xbab6('0x5f')]({},_0x47d2b8,_0x54089b[_0xbab6('0x60')]);return _0x4ec3e5[_0xbab6('0xd2')](_0x47d2b8);}})[_0xbab6('0x24')](function(_0x3840be){if(_0x3840be){_0x5ac184=_0x3840be['length'];if(!_0x54089b['query'][_0xbab6('0x55')]('nolimit')){_0x47d2b8[_0xbab6('0x57')]=qs['limit'](_0x54089b[_0xbab6('0x52')]['limit']);_0x47d2b8[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x54089b[_0xbab6('0x52')]['offset']);}return _0x4ec3e5[_0xbab6('0xd2')](_0x47d2b8);}})[_0xbab6('0x24')](function(_0x4714e5){if(_0x4714e5){return _0x4714e5?{'count':_0x5ac184,'rows':_0x4714e5}:null;}})[_0xbab6('0x24')](respondWithResult(_0x1fa5a8,null))[_0xbab6('0x2c')](handleError(_0x1fa5a8,null));};exports['getMailInteractions']=function(_0x18ae46,_0x4ad225,_0x3188b1){var _0x303af1={'raw':!![],'where':{}};var _0x556e64={};var _0x4bc4e4={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x18ae46['params']['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x4ad225,null))[_0xbab6('0x24')](function(_0xb5d6a8){if(_0xb5d6a8){_0x556e64[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db['MailInteraction'][_0xbab6('0xc5')]);_0x556e64[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x18ae46[_0xbab6('0x52')]);_0x556e64['filters']=_[_0xbab6('0x51')](_0x556e64[_0xbab6('0x4c')],_0x556e64[_0xbab6('0x52')]);_0x303af1['attributes']=_[_0xbab6('0x51')](_0x556e64[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x18ae46['query'][_0xbab6('0x66')]));_0x303af1[_0xbab6('0x53')]=_0x303af1[_0xbab6('0x53')][_0xbab6('0x54')]?_0x303af1['attributes']:_0x556e64[_0xbab6('0x4c')];if(!_0x18ae46[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x303af1[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x18ae46['query'][_0xbab6('0x57')]);_0x303af1[_0xbab6('0x32')]=qs['offset'](_0x18ae46[_0xbab6('0x52')][_0xbab6('0x32')]);}_0x303af1['order']=qs[_0xbab6('0x59')](_0x18ae46['query'][_0xbab6('0x59')]);_0x303af1[_0xbab6('0x5a')]=qs['filters'](_['pick'](_0x18ae46['query'],_0x556e64['filters']));_0x303af1[_0xbab6('0x5a')][_0xbab6('0xcd')]=_0xb5d6a8['id'];if(_0x18ae46['query'][_0xbab6('0x3e')]){_0x303af1[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0x303af1[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x303af1[_0xbab6('0x53')],function(_0x86f5){var _0x6a734c={};_0x6a734c[_0x86f5]={'$like':'%'+_0x18ae46[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x6a734c;})});}_0x303af1=_[_0xbab6('0x5f')]({},_0x303af1,_0x18ae46['options']);return db[_0xbab6('0xd4')][_0xbab6('0x31')]({'where':_0x303af1[_0xbab6('0x5a')]})[_0xbab6('0x24')](function(_0x48e2d4){_0x4bc4e4[_0xbab6('0x31')]=_0x48e2d4;if(_0x18ae46[_0xbab6('0x52')][_0xbab6('0x67')]){_0x303af1[_0xbab6('0x61')]=[{'all':!![]}];}return db[_0xbab6('0xd4')][_0xbab6('0x62')](_0x303af1);})[_0xbab6('0x24')](function(_0x55277c){_0x4bc4e4[_0xbab6('0xce')]=_0x55277c;return _0x4bc4e4;});}})[_0xbab6('0x24')](respondWithFilteredResult(_0x4ad225,_0x303af1))[_0xbab6('0x2c')](handleError(_0x4ad225,null));};exports['getSmsInteractions']=function(_0x2a1af2,_0xe4221,_0x2cbc0f){var _0x59df1f={};var _0x209346={};var _0x2f605e;var _0xfe8bed;return db['User'][_0xbab6('0x94')]({'where':{'id':_0x2a1af2[_0xbab6('0x64')]['id']}})['then'](handleEntityNotFound(_0xe4221,null))[_0xbab6('0x24')](function(_0x31dcb3){if(_0x31dcb3){_0x2f605e=_0x31dcb3;_0x209346[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db['SmsInteraction'][_0xbab6('0xc5')]);_0x209346[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x2a1af2[_0xbab6('0x52')]);_0x209346['filters']=_['intersection'](_0x209346[_0xbab6('0x4c')],_0x209346[_0xbab6('0x52')]);_0x59df1f[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x209346[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x2a1af2[_0xbab6('0x52')][_0xbab6('0x66')]));_0x59df1f['attributes']=_0x59df1f['attributes'][_0xbab6('0x54')]?_0x59df1f[_0xbab6('0x53')]:_0x209346[_0xbab6('0x4c')];_0x59df1f[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x2a1af2[_0xbab6('0x52')][_0xbab6('0x59')]);_0x59df1f[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x2a1af2[_0xbab6('0x52')],_0x209346['filters']));if(_0x2a1af2['query'][_0xbab6('0x3e')]){_0x59df1f[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0x59df1f['where'],{'$or':_['map'](_0x59df1f[_0xbab6('0x53')],function(_0x4412f6){var _0x4fc722={};_0x4fc722[_0x4412f6]={'$like':'%'+_0x2a1af2[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x4fc722;})});}_0x59df1f=_['merge']({},_0x59df1f,_0x2a1af2[_0xbab6('0x60')]);return _0x2f605e[_0xbab6('0xd5')](_0x59df1f);}})[_0xbab6('0x24')](function(_0x4456cf){if(_0x4456cf){_0xfe8bed=_0x4456cf[_0xbab6('0x54')];if(!_0x2a1af2['query']['hasOwnProperty'](_0xbab6('0x56'))){_0x59df1f['limit']=qs[_0xbab6('0x57')](_0x2a1af2[_0xbab6('0x52')]['limit']);_0x59df1f[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x2a1af2['query']['offset']);}return _0x2f605e[_0xbab6('0xd5')](_0x59df1f);}})[_0xbab6('0x24')](function(_0x327fa6){if(_0x327fa6){return _0x327fa6?{'count':_0xfe8bed,'rows':_0x327fa6}:null;}})[_0xbab6('0x24')](respondWithResult(_0xe4221,null))['catch'](handleError(_0xe4221,null));};exports[_0xbab6('0xd6')]=function(_0x6d2261,_0xd2c52d,_0x5107a4){var _0x4912ea={};var _0x313dbb={};var _0x25abef;var _0x33e24e;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x6d2261[_0xbab6('0x64')]['id']}})['then'](handleEntityNotFound(_0xd2c52d,null))['then'](function(_0x37ca69){if(_0x37ca69){_0x25abef=_0x37ca69;_0x313dbb['model']=_[_0xbab6('0x4f')](db['FaxInteraction'][_0xbab6('0xc5')]);_0x313dbb['query']=_[_0xbab6('0x4f')](_0x6d2261[_0xbab6('0x52')]);_0x313dbb[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x313dbb[_0xbab6('0x4c')],_0x313dbb['query']);_0x4912ea[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x313dbb[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x6d2261['query'][_0xbab6('0x66')]));_0x4912ea[_0xbab6('0x53')]=_0x4912ea[_0xbab6('0x53')][_0xbab6('0x54')]?_0x4912ea[_0xbab6('0x53')]:_0x313dbb[_0xbab6('0x4c')];_0x4912ea[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x6d2261['query'][_0xbab6('0x59')]);_0x4912ea[_0xbab6('0x5a')]=qs['filters'](_[_0xbab6('0x5b')](_0x6d2261['query'],_0x313dbb['filters']));if(_0x6d2261[_0xbab6('0x52')]['filter']){_0x4912ea[_0xbab6('0x5a')]=_['merge'](_0x4912ea[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x4912ea[_0xbab6('0x53')],function(_0x59c7c0){var _0x5bede5={};_0x5bede5[_0x59c7c0]={'$like':'%'+_0x6d2261[_0xbab6('0x52')]['filter']+'%'};return _0x5bede5;})});}_0x4912ea=_[_0xbab6('0x5f')]({},_0x4912ea,_0x6d2261[_0xbab6('0x60')]);return _0x25abef[_0xbab6('0xd6')](_0x4912ea);}})['then'](function(_0x1ec160){if(_0x1ec160){_0x33e24e=_0x1ec160[_0xbab6('0x54')];if(!_0x6d2261[_0xbab6('0x52')][_0xbab6('0x55')](_0xbab6('0x56'))){_0x4912ea[_0xbab6('0x57')]=qs['limit'](_0x6d2261[_0xbab6('0x52')][_0xbab6('0x57')]);_0x4912ea[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x6d2261[_0xbab6('0x52')]['offset']);}return _0x25abef[_0xbab6('0xd6')](_0x4912ea);}})['then'](function(_0x41135d){if(_0x41135d){return _0x41135d?{'count':_0x33e24e,'rows':_0x41135d}:null;}})['then'](respondWithResult(_0xd2c52d,null))['catch'](handleError(_0xd2c52d,null));};exports[_0xbab6('0xd7')]=function(_0x3589b5,_0x949b40,_0x30c53f){var _0x16fbc1={};var _0x34af97={};var _0x5256a7;var _0x3a8a87;return db['User'][_0xbab6('0x94')]({'where':{'id':_0x3589b5[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x949b40,null))[_0xbab6('0x24')](function(_0x2b4126){if(_0x2b4126){_0x5256a7=_0x2b4126;_0x34af97[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db[_0xbab6('0xd8')][_0xbab6('0xc5')]);_0x34af97['query']=_[_0xbab6('0x4f')](_0x3589b5[_0xbab6('0x52')]);_0x34af97[_0xbab6('0x50')]=_['intersection'](_0x34af97[_0xbab6('0x4c')],_0x34af97[_0xbab6('0x52')]);_0x16fbc1[_0xbab6('0x53')]=_['intersection'](_0x34af97['model'],qs['fields'](_0x3589b5[_0xbab6('0x52')]['fields']));_0x16fbc1['attributes']=_0x16fbc1[_0xbab6('0x53')][_0xbab6('0x54')]?_0x16fbc1[_0xbab6('0x53')]:_0x34af97['model'];_0x16fbc1[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x3589b5[_0xbab6('0x52')][_0xbab6('0x59')]);_0x16fbc1[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x3589b5[_0xbab6('0x52')],_0x34af97[_0xbab6('0x50')]));if(_0x3589b5[_0xbab6('0x52')]['filter']){_0x16fbc1['where']=_[_0xbab6('0x5f')](_0x16fbc1[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x16fbc1[_0xbab6('0x53')],function(_0x14dfe1){var _0x452adb={};_0x452adb[_0x14dfe1]={'$like':'%'+_0x3589b5[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x452adb;})});}_0x16fbc1=_[_0xbab6('0x5f')]({},_0x16fbc1,_0x3589b5['options']);return _0x5256a7[_0xbab6('0xd7')](_0x16fbc1);}})[_0xbab6('0x24')](function(_0x5e4a4b){if(_0x5e4a4b){_0x3a8a87=_0x5e4a4b[_0xbab6('0x54')];if(!_0x3589b5[_0xbab6('0x52')]['hasOwnProperty'](_0xbab6('0x56'))){_0x16fbc1['limit']=qs[_0xbab6('0x57')](_0x3589b5[_0xbab6('0x52')][_0xbab6('0x57')]);_0x16fbc1['offset']=qs[_0xbab6('0x32')](_0x3589b5[_0xbab6('0x52')][_0xbab6('0x32')]);}return _0x5256a7[_0xbab6('0xd7')](_0x16fbc1);}})[_0xbab6('0x24')](function(_0x376699){if(_0x376699){return _0x376699?{'count':_0x3a8a87,'rows':_0x376699}:null;}})[_0xbab6('0x24')](respondWithResult(_0x949b40,null))['catch'](handleError(_0x949b40,null));};exports[_0xbab6('0xd9')]=function(_0x4f06ba,_0xd7ae00,_0x46edff){var _0x49cc8a;var _0xb2a8a7;var _0x705e73;var _0x4147f3=!_[_0xbab6('0x72')](_0x4f06ba['params']['id'])?_0x4f06ba[_0xbab6('0x64')]['id']:!_[_0xbab6('0x72')](_0x4f06ba[_0xbab6('0x3a')]['id'])?_0x4f06ba[_0xbab6('0x3a')]['id']:null;return db[_0xbab6('0x49')][_0xbab6('0x42')]({'where':{'id':_0x4147f3,'role':{'$or':[_0xbab6('0x6e'),_0xbab6('0x3a'),_0xbab6('0x6d')]}},'attributes':['id',_0xbab6('0x44'),_0xbab6('0xda'),_0xbab6('0xdb'),_0xbab6('0x43'),_0xbab6('0x75'),_0xbab6('0xdc')]})[_0xbab6('0x24')](function(_0x3f52ef){if(_0x3f52ef){if(_0x3f52ef[_0xbab6('0x43')]==='agent'){_0x49cc8a=_0x3f52ef;if(_0x4f06ba['body'][_0xbab6('0x9f')]){_0x705e73=util['format'](_0xbab6('0xdd'),_0x49cc8a[_0x4f06ba[_0xbab6('0x69')]['interface']]);}else if(_0x4f06ba['body']['intrf']){_0x705e73=util['format'](_0xbab6('0xaa'),_0x4f06ba[_0xbab6('0x69')][_0xbab6('0xde')]);}else{_0x705e73=util[_0xbab6('0x74')]('SIP/%s',_0x49cc8a[_0xbab6('0x44')]);}socket['to'](util[_0xbab6('0x74')](_0xbab6('0xdf'),_0x49cc8a[_0xbab6('0x44')]))['emit']('user:forcelogout',{'ip':_0x4f06ba['headers'][_0xbab6('0xe0')]||_0x4f06ba['connection'][_0xbab6('0xe1')]||_0x4f06ba['socket'][_0xbab6('0xe1')]||_0x4f06ba[_0xbab6('0xe2')]['socket'][_0xbab6('0xe1')]});return db[_0xbab6('0xac')][_0xbab6('0x37')]({'where':{'membername':_0x49cc8a['name']},'individualHooks':!![]});}}else{throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0xe3'));}})[_0xbab6('0x24')](function(){if(_0x49cc8a){return _0x49cc8a[_0xbab6('0xe4')]({'raw':!![]});}})['then'](function(_0x4e69ee){if(_0x49cc8a){var _0x139e9e=[];if(_0x4e69ee){_0xb2a8a7=_0x4e69ee;if(_0xb2a8a7[_0xbab6('0x54')]){for(var _0x48aa74=0x0;_0x48aa74<_0xb2a8a7[_0xbab6('0x54')];_0x48aa74++){_0x139e9e['push']({'membername':_0x49cc8a[_0xbab6('0x44')],'UserId':_0x49cc8a['id'],'queue_name':_0xb2a8a7[_0x48aa74][_0xbab6('0x44')],'VoiceQueueId':_0xb2a8a7[_0x48aa74]['id'],'interface':_0x705e73,'paused':_0x49cc8a[_0xbab6('0xdc')]||![],'penalty':_0xb2a8a7[_0x48aa74][_0xbab6('0xe5')]||0x0});}return BPromise['each'](_0x139e9e,function(_0x1b35a0){return db[_0xbab6('0xac')][_0xbab6('0xe6')](_0x1b35a0);});}}}})['then'](function(){if(_0x49cc8a){return db['MemberReport'][_0xbab6('0x62')]({'where':{'membername':_0x49cc8a[_0xbab6('0x44')],'exitAt':null}});}})[_0xbab6('0x24')](function(_0x5d0353){if(_0x49cc8a){var _0x1b81c8=[];_0x5d0353[_0xbab6('0xe7')](function(_0x57575a){_0x1b81c8[_0xbab6('0xe8')](_0x57575a[_0xbab6('0x36')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbab6('0xe9')](_0x1b81c8);}})[_0xbab6('0x24')](function(){if(_0x49cc8a){var _0x4f9a12=[];var _0x185cc9=[];var _0x1c8343=utils[_0xbab6('0xea')]();var _0x2ddef5={'membername':_0x49cc8a[_0xbab6('0x44')],'interface':_0x705e73,'enterAt':moment()[_0xbab6('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x49cc8a[_0xbab6('0x43')],'internal':_0x49cc8a[_0xbab6('0x75')]};_0x1c8343[_0xbab6('0xe7')](function(_0x1592ec){_0x4f9a12[_0xbab6('0xe8')](_[_0xbab6('0x5f')]({'channel':_0x1592ec,'type':_0xbab6('0xeb'),'data1':_0x4f06ba[_0xbab6('0x69')]['device'],'data2':_0x705e73},_0x2ddef5));if(_0x49cc8a['loginInPause']){_0x185cc9[_0xbab6('0xe8')](_[_0xbab6('0x5f')]({'channel':_0x1592ec,'type':_0xbab6('0xec'),'data1':_0xbab6('0xed')},_0x2ddef5));}});return db['MemberReport'][_0xbab6('0x68')](_0x4f9a12[_0xbab6('0xee')](_0x185cc9),{'individualHooks':!![]});}})[_0xbab6('0x24')](function(){if(_0x49cc8a){return _0x49cc8a[_0xbab6('0x36')]({'online':!![],'lastLoginAt':moment()[_0xbab6('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x49cc8a[_0xbab6('0xdc')]||![],'mailPause':_0x49cc8a[_0xbab6('0xdc')]||![],'chatPause':_0x49cc8a['loginInPause']||![],'faxPause':_0x49cc8a[_0xbab6('0xdc')]||![],'smsPause':_0x49cc8a[_0xbab6('0xdc')]||![],'openchannelPause':_0x49cc8a['loginInPause']||![],'whatsappPause':_0x49cc8a['loginInPause']||![],'pauseType':_0x49cc8a['loginInPause']?'LOGININPAUSE':null,'interface':_0x705e73,'lastPauseAt':moment()['format'](_0xbab6('0xef'))});}})[_0xbab6('0x24')](function(_0x5b4e87){if(_0x4f06ba[_0xbab6('0xf0')]){return _0x46edff();}else{return BPromise[_0xbab6('0xf1')](_0x5b4e87)['then'](respondWithResult(_0xd7ae00,null));}})[_0xbab6('0x2c')](handleError(_0xd7ae00,null));};exports['logout']=function(_0x23b58f,_0x390943,_0x19a9d7){var _0x3d6bb4;return db['User'][_0xbab6('0x42')]({'where':{'id':_0x23b58f[_0xbab6('0x64')]['id'],'role':'agent'},'attributes':['id',_0xbab6('0x44'),_0xbab6('0x43')]})['then'](handleEntityNotFound(_0x390943,null))[_0xbab6('0x24')](function(_0x21bee7){if(_0x21bee7){_0x3d6bb4=_0x21bee7;return db['UserVoiceQueueRt'][_0xbab6('0x37')]({'where':{'membername':_0x3d6bb4[_0xbab6('0x44')]},'individualHooks':!![]});}})[_0xbab6('0x24')](function(){return db[_0xbab6('0xf2')][_0xbab6('0x62')]({'where':{'membername':_0x3d6bb4[_0xbab6('0x44')],'exitAt':null}});})['then'](function(_0x7e89d2){var _0x550686=[];_0x7e89d2[_0xbab6('0xe7')](function(_0x14ad81){_0x550686[_0xbab6('0xe8')](_0x14ad81[_0xbab6('0x36')]({'exitAt':moment()[_0xbab6('0x74')](_0xbab6('0xef'))}));});return BPromise[_0xbab6('0xe9')](_0x550686);})['then'](function(){return _0x3d6bb4[_0xbab6('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbab6('0x24')](respondWithResult(_0x390943,null))[_0xbab6('0x2c')](handleError(_0x390943,null));};exports[_0xbab6('0xf3')]=function(_0x37388f,_0x50f80f,_0x33d5c6){var _0x2f4d6a;return db[_0xbab6('0xac')][_0xbab6('0x36')]({'paused':0x1},{'where':{'UserId':_0x37388f[_0xbab6('0x64')]['id']},'individualHooks':!![]})[_0xbab6('0x24')](function(){return db['User'][_0xbab6('0x42')]({'where':{'id':_0x37388f[_0xbab6('0x64')]['id'],'role':_0xbab6('0x6d')},'attributes':['id',_0xbab6('0x44'),_0xbab6('0x43'),_0xbab6('0x75'),_0xbab6('0x9f')]});})[_0xbab6('0x24')](handleEntityNotFound(_0x50f80f,null))['then'](function(_0x1085da){if(_0x1085da){_0x2f4d6a=_0x1085da;return respondWithRpcPromise(_0xbab6('0xf4'),'pause',{'id':_0x2f4d6a['id'],'name':_0x2f4d6a['name'],'pause':!![]});}})[_0xbab6('0x24')](function(){if(_0x2f4d6a){return db[_0xbab6('0xf2')][_0xbab6('0x62')]({'where':{'membername':_0x2f4d6a[_0xbab6('0x44')],'type':_0xbab6('0xec'),'exitAt':null}});}})[_0xbab6('0x24')](function(_0x38d1e8){if(_0x38d1e8['length']){var _0x1ec6a7=moment()[_0xbab6('0x74')](_0xbab6('0xef'));for(var _0xe6f264=0x0,_0x4f6a19=_0x38d1e8[_0xbab6('0x54')];_0xe6f264<_0x4f6a19;_0xe6f264++){_0x38d1e8[_0xe6f264][_0xbab6('0xf5')]({'exitAt':_0x1ec6a7});}}})[_0xbab6('0x24')](function(){var _0x5ac515=[];var _0xc673cf=utils[_0xbab6('0xea')]();_0xc673cf[_0xbab6('0xe7')](function(_0x243e7e){_0x5ac515[_0xbab6('0xe8')]({'channel':_0x243e7e,'membername':_0x2f4d6a[_0xbab6('0x44')],'interface':_[_0xbab6('0x72')](_0x2f4d6a['interface'])?util['format'](_0xbab6('0xaa'),_0x2f4d6a[_0xbab6('0x44')]):_0x2f4d6a['interface'],'type':_0xbab6('0xec'),'enterAt':moment()[_0xbab6('0x74')](_0xbab6('0xef')),'data1':_0x37388f['body'][_0xbab6('0x5c')]||_0xbab6('0xf6'),'role':_0x2f4d6a[_0xbab6('0x43')],'internal':_0x2f4d6a[_0xbab6('0x75')]});});return db[_0xbab6('0xf2')]['bulkCreate'](_0x5ac515,{'individualHooks':!![]});})[_0xbab6('0x24')](function(){return _0x2f4d6a[_0xbab6('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x37388f[_0xbab6('0x69')]['type']||_0xbab6('0xf6'),'lastPauseAt':moment()[_0xbab6('0x74')](_0xbab6('0xef'))});})[_0xbab6('0x24')](respondWithResult(_0x50f80f,null))[_0xbab6('0x2c')](handleError(_0x50f80f,null));};exports[_0xbab6('0xf7')]=function(_0x3c685a,_0x3b4934,_0x351f14){var _0x588d18;return db[_0xbab6('0x49')]['find']({'where':{'id':_0x3c685a[_0xbab6('0x64')]['id']},'attributes':['id',_0xbab6('0x44'),_0xbab6('0x43'),_0xbab6('0x9e'),_0xbab6('0xf8'),_0xbab6('0xf9'),_0xbab6('0xfa'),_0xbab6('0xfb'),_0xbab6('0xfc'),_0xbab6('0xfd'),'pauseType',_0xbab6('0xfe')]})[_0xbab6('0x24')](handleEntityNotFound(_0x3b4934,null))[_0xbab6('0x24')](function(_0x3c919f){if(_0x3c919f){_0x588d18=_0x3c919f;if(_0x3c685a[_0xbab6('0x69')][_0xbab6('0xad')]&&!utils[_0xbab6('0xae')](_0x3c685a[_0xbab6('0x69')][_0xbab6('0xad')])){throw new db[(_0xbab6('0x20'))][(_0xbab6('0x21'))](_0xbab6('0xaf'));}switch(_0x3c685a[_0xbab6('0x69')]['channel']){case _0xbab6('0xa9'):return respondWithRpcPromise(_0xbab6('0xf4'),_0xbab6('0xf7'),{'id':_0x588d18['id'],'name':_0x588d18[_0xbab6('0x44')],'pause':![]})[_0xbab6('0x24')](function(){return db['UserVoiceQueueRt'][_0xbab6('0x36')]({'paused':0x0},{'where':{'UserId':_0x588d18['id']},'individualHooks':!![]});})[_0xbab6('0x24')](function(){return db['MemberReport'][_0xbab6('0x42')]({'where':{'channel':_0x3c685a[_0xbab6('0x69')][_0xbab6('0xad')],'membername':_0x588d18[_0xbab6('0x44')],'type':_0xbab6('0xec'),'exitAt':null}});})[_0xbab6('0x24')](function(_0x1bd2b9){if(_0x1bd2b9){return _0x1bd2b9[_0xbab6('0x36')]({'exitAt':moment()[_0xbab6('0x74')](_0xbab6('0xef')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xbab6('0x24')](function(){return _0x588d18[_0xbab6('0x36')]({'voicePause':![]});});case'mail':case _0xbab6('0xff'):case _0xbab6('0x100'):case _0xbab6('0x101'):case _0xbab6('0x102'):case _0xbab6('0x103'):return db[_0xbab6('0xf2')]['find']({'where':{'channel':_0x3c685a[_0xbab6('0x69')][_0xbab6('0xad')],'membername':_0x588d18[_0xbab6('0x44')],'type':'PAUSE','exitAt':null}})[_0xbab6('0x24')](function(_0x14e0c4){if(_0x14e0c4){return _0x14e0c4[_0xbab6('0x36')]({'exitAt':moment()['format'](_0xbab6('0xef')),'data2':_0xbab6('0x104')},{'individualHooks':!![]});}return null;})[_0xbab6('0x24')](function(){var _0x2531ef={};_[_0xbab6('0x33')](_0x2531ef,util[_0xbab6('0x74')]('%s%s',_0x3c685a[_0xbab6('0x69')][_0xbab6('0xad')],'Pause'),![]);return _0x588d18['update'](_0x2531ef);});default:return respondWithRpcPromise('QueuePause',_0xbab6('0xf7'),{'id':_0x588d18['id'],'name':_0x588d18[_0xbab6('0x44')],'pause':![]})[_0xbab6('0x24')](function(){return db[_0xbab6('0xac')][_0xbab6('0x36')]({'paused':0x0},{'where':{'UserId':_0x588d18['id']}});})['then'](function(){return db[_0xbab6('0xf2')][_0xbab6('0x62')]({'where':{'membername':_0x588d18[_0xbab6('0x44')],'type':'PAUSE','exitAt':null}});})[_0xbab6('0x24')](function(_0x237aeb){var _0x5be804=[];_0x237aeb[_0xbab6('0xe7')](function(_0x3b6354){_0x5be804['push'](_0x3b6354['update']({'exitAt':moment()[_0xbab6('0x74')](_0xbab6('0xef')),'data2':_0xbab6('0x104')}));});return BPromise[_0xbab6('0xe9')](_0x5be804);})[_0xbab6('0x24')](function(){return _0x588d18[_0xbab6('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xbab6('0x24')](respondWithResult(_0x3b4934,null))[_0xbab6('0x2c')](handleError(_0x3b4934,null));};exports[_0xbab6('0x105')]=function(_0xa7ba1f,_0x311697,_0x3803ff){var _0x5cbdbb={};var _0x159c9c={};var _0x5cb353;var _0x211e5a;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0xa7ba1f[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x311697,null))[_0xbab6('0x24')](function(_0x5890ef){if(_0x5890ef){_0x5cb353=_0x5890ef;_0x159c9c[_0xbab6('0x4c')]=_[_0xbab6('0x4f')](db['Team'][_0xbab6('0xc5')]);_0x159c9c[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0xa7ba1f['query']);_0x159c9c[_0xbab6('0x50')]=_['intersection'](_0x159c9c[_0xbab6('0x4c')],_0x159c9c[_0xbab6('0x52')]);_0x5cbdbb[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x159c9c[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0xa7ba1f[_0xbab6('0x52')][_0xbab6('0x66')]));_0x5cbdbb[_0xbab6('0x53')]=_0x5cbdbb['attributes']['length']?_0x5cbdbb[_0xbab6('0x53')]:_0x159c9c['model'];_0x5cbdbb[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0xa7ba1f['query']['sort']);_0x5cbdbb[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0xa7ba1f[_0xbab6('0x52')],_0x159c9c[_0xbab6('0x50')]));if(_0xa7ba1f[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x5cbdbb[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0x5cbdbb[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x5cbdbb[_0xbab6('0x53')],function(_0x5588a6){var _0x5c8c28={};_0x5c8c28[_0x5588a6]={'$like':'%'+_0xa7ba1f['query'][_0xbab6('0x3e')]+'%'};return _0x5c8c28;})});}_0x5cbdbb=_['merge']({},_0x5cbdbb,_0xa7ba1f[_0xbab6('0x60')]);return _0x5cb353['getTeams'](_0x5cbdbb);}})[_0xbab6('0x24')](function(_0x1e0d39){if(_0x1e0d39){_0x211e5a=_0x1e0d39[_0xbab6('0x54')];if(!_0xa7ba1f['query'][_0xbab6('0x55')]('nolimit')){_0x5cbdbb['limit']=qs['limit'](_0xa7ba1f[_0xbab6('0x52')][_0xbab6('0x57')]);_0x5cbdbb[_0xbab6('0x32')]=qs['offset'](_0xa7ba1f[_0xbab6('0x52')][_0xbab6('0x32')]);}return _0x5cb353['getTeams'](_0x5cbdbb);}})['then'](function(_0x51dfc3){if(_0x51dfc3){return _0x51dfc3?{'count':_0x211e5a,'rows':_0x51dfc3}:null;}})[_0xbab6('0x24')](respondWithResult(_0x311697,null))[_0xbab6('0x2c')](handleError(_0x311697,null));};exports[_0xbab6('0x106')]=function(_0x1660d1,_0x239512){return db['User'][_0xbab6('0x42')]({'where':{'id':_0x1660d1[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x239512,null))[_0xbab6('0x24')](function(_0xcf13ea){if(_0xcf13ea){var _0x1f3a01=_0xcf13ea[_0xbab6('0x38')]({'plain':!![]});return _0xcf13ea[_0xbab6('0x106')](_0x1660d1[_0xbab6('0x69')][_0xbab6('0x6c')],_[_0xbab6('0x107')](_0x1660d1[_0xbab6('0x69')],[_0xbab6('0x6c'),'id'])||{})[_0xbab6('0x24')](function(){for(var _0x5a671b=0x0;_0x5a671b<_0x1660d1[_0xbab6('0x69')][_0xbab6('0x6c')]['length'];_0x5a671b++){var _0x203c29=[];db[_0xbab6('0x108')][_0xbab6('0x94')]({'where':{'id':_0x1660d1[_0xbab6('0x69')]['ids'][_0x5a671b]}})[_0xbab6('0x24')](function(_0x1de37c){_0x203c29[_0xbab6('0xe8')](_0x1de37c[_0xbab6('0xe4')]()[_0xbab6('0x24')](function(_0x2e6801){for(var _0x39996c=0x0;_0x39996c<_0x2e6801[_0xbab6('0x54')];_0x39996c++){_0x2e6801[_0x39996c][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10a'));}return _0x2e6801;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c['getChatQueues']()[_0xbab6('0x24')](function(_0x3c7bc5){for(var _0x10df92=0x0;_0x10df92<_0x3c7bc5[_0xbab6('0x54')];_0x10df92++){_0x3c7bc5[_0x10df92][_0xbab6('0x109')](_0xbab6('0xad'),'Chat');}return _0x3c7bc5;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c['getMailQueues']()[_0xbab6('0x24')](function(_0x20c7ef){for(var _0x4def1c=0x0;_0x4def1c<_0x20c7ef[_0xbab6('0x54')];_0x4def1c++){_0x20c7ef[_0x4def1c][_0xbab6('0x109')](_0xbab6('0xad'),'Mail');}return _0x20c7ef;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c[_0xbab6('0x10b')]()['then'](function(_0x2c1983){for(var _0x5070d6=0x0;_0x5070d6<_0x2c1983['length'];_0x5070d6++){_0x2c1983[_0x5070d6][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10c'));}return _0x2c1983;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c[_0xbab6('0x10d')]()['then'](function(_0x54fd99){for(var _0x1271e4=0x0;_0x1271e4<_0x54fd99[_0xbab6('0x54')];_0x1271e4++){_0x54fd99[_0x1271e4]['setDataValue']('channel',_0xbab6('0x10e'));}return _0x54fd99;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c['getFaxQueues']()[_0xbab6('0x24')](function(_0x2800f9){for(var _0x266a06=0x0;_0x266a06<_0x2800f9['length'];_0x266a06++){_0x2800f9[_0x266a06][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10f'));}return _0x2800f9;}));_0x203c29[_0xbab6('0xe8')](_0x1de37c[_0xbab6('0x110')]()[_0xbab6('0x24')](function(_0x49b272){for(var _0xe9fe9=0x0;_0xe9fe9<_0x49b272[_0xbab6('0x54')];_0xe9fe9++){_0x49b272[_0xe9fe9][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x111'));}return _0x49b272;}));return BPromise[_0xbab6('0xe9')](_0x203c29);})[_0xbab6('0x24')](function(_0x4aac6c){var _0x22ada5=_[_0xbab6('0x112')](_0x4aac6c);_0x203c29=[];return db['sequelize']['transaction'](function(_0x102981){for(var _0x33c1e2=0x0;_0x33c1e2<_0x22ada5['length'];_0x33c1e2++){_0x203c29[_0xbab6('0xe8')](_0x22ada5[_0x33c1e2][_0xbab6('0x113')](_0x1f3a01['id']),{'transaction':_0x102981});}return BPromise[_0xbab6('0xe9')](_0x203c29)[_0xbab6('0x24')](function(){if(_0x1f3a01[_0xbab6('0x9d')]){return BPromise[_0xbab6('0xab')](_[_0xbab6('0x3e')](_0x22ada5,function(_0x507a3e){return _0x507a3e[_0xbab6('0x114')](_0xbab6('0xad'))===_0xbab6('0x10a');}),function(_0x3a1690){return db['UserVoiceQueueRt'][_0xbab6('0xe6')]({'membername':_0x1f3a01[_0xbab6('0x44')],'UserId':_0x1f3a01['id'],'queue_name':_0x3a1690[_0xbab6('0x44')],'VoiceQueueId':_0x3a1690['id'],'interface':_['isNil'](_0x1f3a01[_0xbab6('0x9f')])?util[_0xbab6('0x74')]('SIP/%s',_0x1f3a01[_0xbab6('0x44')]):_0x1f3a01[_0xbab6('0x9f')],'paused':_0x1f3a01[_0xbab6('0x9e')]||![],'penalty':_0x1f3a01['penalty']},{'transaction':_0x102981});});}else{return;}})[_0xbab6('0x24')](function(){for(var _0x330002=0x0;_0x330002<_0x22ada5[_0xbab6('0x54')];_0x330002++){var _0x3a278c=_0x22ada5[_0x330002][_0xbab6('0x114')](_0xbab6('0xad'));var _0x151aa4=_0x3a278c+_0xbab6('0xa5');socket[_0xbab6('0xa6')]('user'+_0x3a278c+_0xbab6('0xa7'),{'UserId':_0x1f3a01['id'],['queueField']:_0x22ada5[_0x330002]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x239512,null))[_0xbab6('0x2c')](handleError(_0x239512,null));};exports[_0xbab6('0x115')]=function(_0x3b53b4,_0x111fdb){return db['User']['findOne']({'where':{'id':_0x3b53b4['params']['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x111fdb,null))['then'](function(_0x1d6815){if(_0x1d6815){var _0x5a46fd=_0x1d6815[_0xbab6('0x38')]({'plain':!![]});var _0x4fe12a=_0x3b53b4[_0xbab6('0x52')]['ids'];return _0x1d6815[_0xbab6('0x115')](_0x4fe12a)[_0xbab6('0x24')](function(){for(var _0x15e3b6=0x0;_0x15e3b6<_0x4fe12a[_0xbab6('0x54')];_0x15e3b6++){var _0x46ae63=[];db[_0xbab6('0x108')][_0xbab6('0x94')]({'where':{'id':_0x4fe12a[_0x15e3b6]}})[_0xbab6('0x24')](function(_0x31da15){_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0xe4')]()[_0xbab6('0x24')](function(_0x41ddfe){for(var _0x5227d2=0x0;_0x5227d2<_0x41ddfe[_0xbab6('0x54')];_0x5227d2++){_0x41ddfe[_0x5227d2][_0xbab6('0x109')]('channel',_0xbab6('0x10a'));}return _0x41ddfe;}));_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0x116')]()['then'](function(_0x26f1f3){for(var _0x40ef3e=0x0;_0x40ef3e<_0x26f1f3[_0xbab6('0x54')];_0x40ef3e++){_0x26f1f3[_0x40ef3e]['setDataValue'](_0xbab6('0xad'),'Chat');}return _0x26f1f3;}));_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0x117')]()[_0xbab6('0x24')](function(_0x21b688){for(var _0x1e73c8=0x0;_0x1e73c8<_0x21b688[_0xbab6('0x54')];_0x1e73c8++){_0x21b688[_0x1e73c8]['setDataValue']('channel',_0xbab6('0x118'));}return _0x21b688;}));_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0x10b')]()[_0xbab6('0x24')](function(_0xcef36){for(var _0x14972c=0x0;_0x14972c<_0xcef36[_0xbab6('0x54')];_0x14972c++){_0xcef36[_0x14972c][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10c'));}return _0xcef36;}));_0x46ae63['push'](_0x31da15[_0xbab6('0x10d')]()[_0xbab6('0x24')](function(_0x35f05a){for(var _0x38d12d=0x0;_0x38d12d<_0x35f05a[_0xbab6('0x54')];_0x38d12d++){_0x35f05a[_0x38d12d][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10e'));}return _0x35f05a;}));_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0x119')]()['then'](function(_0x58d96f){for(var _0x5e1081=0x0;_0x5e1081<_0x58d96f[_0xbab6('0x54')];_0x5e1081++){_0x58d96f[_0x5e1081][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x10f'));}return _0x58d96f;}));_0x46ae63[_0xbab6('0xe8')](_0x31da15[_0xbab6('0x110')]()[_0xbab6('0x24')](function(_0x1ddbde){for(var _0x3ed49a=0x0;_0x3ed49a<_0x1ddbde[_0xbab6('0x54')];_0x3ed49a++){_0x1ddbde[_0x3ed49a][_0xbab6('0x109')](_0xbab6('0xad'),_0xbab6('0x111'));}return _0x1ddbde;}));return BPromise[_0xbab6('0xe9')](_0x46ae63);})[_0xbab6('0x24')](function(_0x4bc534){var _0x32f78b=_[_0xbab6('0x112')](_0x4bc534);_0x46ae63=[];return db[_0xbab6('0x5e')][_0xbab6('0x11a')](function(_0x272e87){for(var _0x480b20=0x0;_0x480b20<_0x32f78b['length'];_0x480b20++){_0x46ae63[_0xbab6('0xe8')](_0x32f78b[_0x480b20][_0xbab6('0x11b')](_0x5a46fd['id']),{'transaction':_0x272e87});}return BPromise['all'](_0x46ae63)[_0xbab6('0x24')](function(){if(_0x5a46fd['online']){return BPromise[_0xbab6('0xab')](_[_0xbab6('0x3e')](_0x32f78b,function(_0x1c04b1){return _0x1c04b1[_0xbab6('0x114')]('channel')===_0xbab6('0x10a');}),function(_0x2e89be){return db[_0xbab6('0xac')][_0xbab6('0x37')]({'where':{'VoiceQueueId':_0x2e89be['id'],'UserId':_0x5a46fd['id']},'transaction':_0x272e87});});}else{return;}})['then'](function(){for(var _0x316eec=0x0;_0x316eec<_0x32f78b['length'];_0x316eec++){var _0x134c36=_0x32f78b[_0x316eec][_0xbab6('0x114')](_0xbab6('0xad'));var _0x85e9a1=_0x134c36+_0xbab6('0xa5');socket[_0xbab6('0xa6')](_0xbab6('0x3a')+_0x134c36+_0xbab6('0xb1'),{'UserId':_0x5a46fd['id'],['queueField']:_0x32f78b[_0x316eec]['id']});}});});});}});}})[_0xbab6('0x24')](respondWithStatusCode(_0x111fdb,null))[_0xbab6('0x2c')](handleError(_0x111fdb,null));};exports['getLists']=function(_0x167119,_0x52c650,_0x43a08b){var _0x5d2995={};var _0x3fc8fd={};var _0x1d0ea5;var _0x19c8e6;return db[_0xbab6('0x49')][_0xbab6('0x94')]({'where':{'id':_0x167119['params']['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x52c650,null))['then'](function(_0x52646c){if(_0x52646c){_0x1d0ea5=_0x52646c;_0x3fc8fd['model']=_['keys'](db[_0xbab6('0xbc')]['rawAttributes']);_0x3fc8fd['query']=_[_0xbab6('0x4f')](_0x167119['query']);_0x3fc8fd[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x3fc8fd[_0xbab6('0x4c')],_0x3fc8fd[_0xbab6('0x52')]);_0x5d2995['attributes']=_[_0xbab6('0x51')](_0x3fc8fd[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x167119[_0xbab6('0x52')][_0xbab6('0x66')]));_0x5d2995['attributes']=_0x5d2995[_0xbab6('0x53')]['length']?_0x5d2995[_0xbab6('0x53')]:_0x3fc8fd[_0xbab6('0x4c')];_0x5d2995[_0xbab6('0x58')]=qs[_0xbab6('0x59')](_0x167119[_0xbab6('0x52')]['sort']);_0x5d2995[_0xbab6('0x5a')]=qs[_0xbab6('0x50')](_[_0xbab6('0x5b')](_0x167119[_0xbab6('0x52')],_0x3fc8fd[_0xbab6('0x50')]));if(_0x167119[_0xbab6('0x52')][_0xbab6('0x3e')]){_0x5d2995[_0xbab6('0x5a')]=_['merge'](_0x5d2995[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x5d2995['attributes'],function(_0x3670d4){var _0x306702={};_0x306702[_0x3670d4]={'$like':'%'+_0x167119[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x306702;})});}_0x5d2995=_[_0xbab6('0x5f')]({},_0x5d2995,_0x167119[_0xbab6('0x60')]);return _0x1d0ea5[_0xbab6('0x11c')](_0x5d2995);}})[_0xbab6('0x24')](function(_0xc9c0f7){if(_0xc9c0f7){_0x19c8e6=_0xc9c0f7['length'];if(!_0x167119[_0xbab6('0x52')]['hasOwnProperty'](_0xbab6('0x56'))){_0x5d2995[_0xbab6('0x57')]=qs[_0xbab6('0x57')](_0x167119['query'][_0xbab6('0x57')]);_0x5d2995[_0xbab6('0x32')]=qs[_0xbab6('0x32')](_0x167119[_0xbab6('0x52')]['offset']);}return _0x1d0ea5[_0xbab6('0x11c')](_0x5d2995);}})[_0xbab6('0x24')](function(_0x4bc908){if(_0x4bc908){return _0x4bc908?{'count':_0x19c8e6,'rows':_0x4bc908}:null;}})['then'](respondWithResult(_0x52c650,null))['catch'](handleError(_0x52c650,null));};exports[_0xbab6('0x11d')]=function(_0x2c3aa6,_0x461a62,_0x58587a){var _0x19f5e3={};var _0x27889a={};var _0x4c8dc1;var _0x2b6a25;return db[_0xbab6('0x49')]['findOne']({'where':{'id':_0x2c3aa6[_0xbab6('0x64')]['id']}})[_0xbab6('0x24')](handleEntityNotFound(_0x461a62,null))[_0xbab6('0x24')](function(_0x4c3185){if(_0x4c3185){_0x4c8dc1=_0x4c3185;_0x27889a[_0xbab6('0x4c')]=_['keys'](db[_0xbab6('0x49')][_0xbab6('0xc5')]);_0x27889a[_0xbab6('0x52')]=_[_0xbab6('0x4f')](_0x2c3aa6['query']);_0x27889a[_0xbab6('0x50')]=_[_0xbab6('0x51')](_0x27889a['model'],_0x27889a[_0xbab6('0x52')]);_0x19f5e3[_0xbab6('0x53')]=_[_0xbab6('0x51')](_0x27889a[_0xbab6('0x4c')],qs[_0xbab6('0x66')](_0x2c3aa6[_0xbab6('0x52')]['fields']));_0x19f5e3[_0xbab6('0x53')]=_0x19f5e3['attributes'][_0xbab6('0x54')]?_0x19f5e3[_0xbab6('0x53')]:_0x27889a[_0xbab6('0x4c')];_0x19f5e3['order']=qs[_0xbab6('0x59')](_0x2c3aa6[_0xbab6('0x52')][_0xbab6('0x59')]);_0x19f5e3[_0xbab6('0x5a')]=qs['filters'](_[_0xbab6('0x5b')](_0x2c3aa6[_0xbab6('0x52')],_0x27889a[_0xbab6('0x50')]));if(_0x2c3aa6['query']['filter']){_0x19f5e3[_0xbab6('0x5a')]=_[_0xbab6('0x5f')](_0x19f5e3[_0xbab6('0x5a')],{'$or':_[_0xbab6('0xc6')](_0x19f5e3['attributes'],function(_0x18d5cf){var _0x1fae82={};_0x1fae82[_0x18d5cf]={'$like':'%'+_0x2c3aa6[_0xbab6('0x52')][_0xbab6('0x3e')]+'%'};return _0x1fae82;})});}_0x19f5e3[_0xbab6('0x4c')]=db[_0xbab6('0x49')];_0x19f5e3['as']=_0xbab6('0x3b');_0x19f5e3=_[_0xbab6('0x5f')]({},_0x19f5e3,_0x2c3aa6[_0xbab6('0x60')]);return _0x4c8dc1[_0xbab6('0xe4')]({'include':[_0x19f5e3]});}})['then'](function(_0x91741){if(_0x91741){var _0x979993={},_0x42c792=[],_0x4df4fa=0x0;for(var _0x2575c5=0x0;_0x2575c5<_0x91741[_0xbab6('0x54')];_0x2575c5+=0x1){for(var _0x223308=0x0,_0x32cb8f;_0x223308<_0x91741[_0x2575c5][_0xbab6('0x3b')][_0xbab6('0x54')];_0x223308+=0x1){_0x32cb8f=_0x91741[_0x2575c5][_0xbab6('0x3b')][_0x223308][_0xbab6('0x38')]({'plain':!![]});_0x979993[_0x32cb8f['id']]=_0x32cb8f;}}_0x979993=_[_0xbab6('0x11e')](_0x979993);for(var _0x5148f3=qs['offset'](_0x2c3aa6[_0xbab6('0x52')][_0xbab6('0x32')]);_0x5148f3<_0x979993[_0xbab6('0x54')]&&_0x42c792[_0xbab6('0x54')]=_0x4b5506[_0x4979('0x51')]){throw new Error(_0x4979('0x52'));}})[_0x4979('0x22')](function(){if(_0x21eba5){return db[_0x4979('0x2d')][_0x4979('0x48')]({'where':{'membername':_0x21eba5['name']},'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x21eba5){return _0x21eba5[_0x4979('0x53')]({'raw':!![]});}})[_0x4979('0x22')](function(_0x3a1b58){if(_0x21eba5){if(_0x3a1b58){var _0x51b20d=[];_0x5d4045=_0x3a1b58;if(_0x5d4045[_0x4979('0x31')]){for(var _0x5d03ab=0x0;_0x5d03ab<_0x5d4045[_0x4979('0x31')];_0x5d03ab++){_0x51b20d[_0x4979('0x36')](db[_0x4979('0x2d')][_0x4979('0x54')]({'membername':_0x21eba5['name'],'UserId':_0x21eba5['id'],'queue_name':_0x5d4045[_0x5d03ab]['name'],'VoiceQueueId':_0x5d4045[_0x5d03ab]['id'],'interface':_0x424fc3,'paused':_0x21eba5['loginInPause']||![],'penalty':_0x5d4045[_0x5d03ab][_0x4979('0x55')]||0x0}));}return BPromise[_0x4979('0x49')](_0x51b20d);}}}})[_0x4979('0x22')](function(){if(_0x21eba5){return db[_0x4979('0x2f')][_0x4979('0x1a')]({'where':{'membername':_0x21eba5[_0x4979('0x29')],'exitAt':null}});}})[_0x4979('0x22')](function(_0x408921){if(_0x21eba5){if(_0x408921&&_0x408921[_0x4979('0x31')]){var _0x504823=[];_0x408921[_0x4979('0x45')](function(_0x51321a){_0x504823['push'](_0x51321a[_0x4979('0x2e')]({'exitAt':moment()[_0x4979('0x32')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4979('0x49')](_0x504823);}}})[_0x4979('0x22')](function(_0x17f84d){if(_0x21eba5){var _0xf7e65b=[];var _0x1f1903=[];var _0x37a441=utils['getChannels']();var _0x3635ff={'membername':_0x21eba5[_0x4979('0x29')],'interface':_0x424fc3,'enterAt':moment()[_0x4979('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x21eba5['role'],'internal':_0x21eba5[_0x4979('0x2b')]};_0x37a441['forEach'](function(_0x1c2c50){_0xf7e65b[_0x4979('0x36')](_[_0x4979('0x56')]({'channel':_0x1c2c50,'type':_0x4979('0x57'),'data1':'callysquare','data2':_0x424fc3},_0x3635ff));if(_0x21eba5[_0x4979('0x58')]){_0x1f1903[_0x4979('0x36')](_['merge']({'channel':_0x1c2c50,'type':_0x4979('0x30'),'data1':_0x4979('0x59')},_0x3635ff));}});return db[_0x4979('0x2f')][_0x4979('0x5a')](_0xf7e65b[_0x4979('0x5b')](_0x1f1903),{'individualHooks':!![]});}})[_0x4979('0x22')](function(){if(_0x21eba5){return _0x21eba5[_0x4979('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4979('0x32')](_0x4979('0x33')),'voicePause':_0x21eba5[_0x4979('0x58')]||![],'mailPause':_0x21eba5[_0x4979('0x58')]||![],'chatPause':_0x21eba5[_0x4979('0x58')]||![],'faxPause':_0x21eba5['loginInPause']||![],'smsPause':_0x21eba5[_0x4979('0x58')]||![],'openchannelPause':_0x21eba5[_0x4979('0x58')]||![],'pauseType':_0x21eba5['loginInPause']?_0x4979('0x59'):null,'lastPauseAt':moment()[_0x4979('0x32')](_0x4979('0x33')),'interface':_0x424fc3});}})[_0x4979('0x22')](function(_0x292c05){_0x40cd06(_0x292c05);})[_0x4979('0x18')](function(_0x256f6f){_0x165b99(_0x30d31a[_0x4979('0x15')](0x1f4,_0x256f6f[_0x4979('0x16')]));});});}; \ No newline at end of file +var _0x892b=['findOne','channel','isValidChannel','voice','UserVoiceQueueRt','system','chat','fax','sms','openchannel','set','%s%s','Pause','forEach','all','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','concat','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','code','error','message','GetUser','User','findAll','options','attributes','limit','map','include','model','then','stringify','ShowUser','find','raw','where','catch','PauseUser','name','role','internal','update','MemberReport','PAUSE','length','updateAttributes','getChannels','push','isNil','format','SIP/%s','interface','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x892b,0x81));var _0xb892=function(_0x29a8ba,_0x2a8862){_0x29a8ba=_0x29a8ba-0x0;var _0x484858=_0x892b[_0x29a8ba];return _0x484858;};'use strict';var _=require('lodash');var util=require(_0xb892('0x0'));var moment=require(_0xb892('0x1'));var BPromise=require(_0xb892('0x2'));var rs=require(_0xb892('0x3'));var fs=require('fs');var Redis=require(_0xb892('0x4'));var db=require(_0xb892('0x5'))['db'];var utils=require(_0xb892('0x6'));var logger=require(_0xb892('0x7'))('rpc');var config=require(_0xb892('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb892('0x9')][_0xb892('0xa')]({'port':0x232a});config['redis']=_[_0xb892('0xb')](config[_0xb892('0xc')],{'host':_0xb892('0xd'),'port':0x18eb});var socket=require(_0xb892('0xe'))(new Redis(config['redis']));require('./user.socket')[_0xb892('0xf')](socket);function respondWithRpcPromise(_0x1fd2cb,_0x48aacf,_0x4c07a6){return new BPromise(function(_0x35e904,_0x359904){return client[_0xb892('0x10')](_0x1fd2cb,_0x4c07a6)['then'](function(_0x235230){logger[_0xb892('0x11')](_0xb892('0x12'),_0x48aacf,_0xb892('0x13'));logger[_0xb892('0x14')](_0xb892('0x15'),_0x48aacf,_0xb892('0x13'),JSON['stringify'](_0x235230));if(_0x235230['error']){if(_0x235230['error'][_0xb892('0x16')]===0x1f4){logger[_0xb892('0x17')]('User,\x20%s,\x20%s',_0x48aacf,_0x235230[_0xb892('0x17')][_0xb892('0x18')]);return _0x359904(_0x235230[_0xb892('0x17')]['message']);}logger['error']('User,\x20%s,\x20%s',_0x48aacf,_0x235230[_0xb892('0x17')][_0xb892('0x18')]);return _0x35e904(_0x235230[_0xb892('0x17')]['message']);}else{logger[_0xb892('0x11')]('User,\x20%s,\x20%s',_0x48aacf,_0xb892('0x13'));_0x35e904(_0x235230['result'][_0xb892('0x18')]);}})['catch'](function(_0x1b2dd5){logger[_0xb892('0x17')](_0xb892('0x12'),_0x48aacf,_0x1b2dd5);_0x359904(_0x1b2dd5);});});}exports[_0xb892('0x19')]=function(_0x4d5320){var _0x2a1106=this;return new Promise(function(_0x17adf5,_0x366328){return db[_0xb892('0x1a')][_0xb892('0x1b')]({'raw':_0x4d5320[_0xb892('0x1c')]?_0x4d5320['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d5320['options']?_0x4d5320[_0xb892('0x1c')]['where']||null:null,'attributes':_0x4d5320['options']?_0x4d5320['options'][_0xb892('0x1d')]||null:null,'limit':_0x4d5320[_0xb892('0x1c')]?_0x4d5320[_0xb892('0x1c')][_0xb892('0x1e')]||null:null,'include':_0x4d5320['options']?_0x4d5320[_0xb892('0x1c')]['include']?_[_0xb892('0x1f')](_0x4d5320[_0xb892('0x1c')]['include'],function(_0x1f226a){return{'model':db[_0x1f226a['model']],'as':_0x1f226a['as'],'attributes':_0x1f226a[_0xb892('0x1d')],'include':_0x1f226a[_0xb892('0x20')]?_[_0xb892('0x1f')](_0x1f226a[_0xb892('0x20')],function(_0x1b9e0d){return{'model':db[_0x1b9e0d[_0xb892('0x21')]],'as':_0x1b9e0d['as'],'attributes':_0x1b9e0d['attributes'],'include':_0x1b9e0d[_0xb892('0x20')]?_[_0xb892('0x1f')](_0x1b9e0d[_0xb892('0x20')],function(_0x3dd4eb){return{'model':db[_0x3dd4eb[_0xb892('0x21')]],'as':_0x3dd4eb['as'],'attributes':_0x3dd4eb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb892('0x22')](function(_0x2ab49b){logger[_0xb892('0x11')]('GetUser',_0x4d5320);logger[_0xb892('0x14')]('GetUser',_0x4d5320,JSON[_0xb892('0x23')](_0x2ab49b));_0x17adf5(_0x2ab49b);})['catch'](function(_0x119a8d){logger[_0xb892('0x17')]('GetUser',_0x119a8d[_0xb892('0x18')],_0x4d5320);_0x366328(_0x2a1106['error'](0x1f4,_0x119a8d[_0xb892('0x18')]));});});};exports[_0xb892('0x24')]=function(_0x85d34a){var _0x4e6ebd=this;return new Promise(function(_0xac6780,_0x4f9041){return db[_0xb892('0x1a')][_0xb892('0x25')]({'raw':_0x85d34a[_0xb892('0x1c')]?_0x85d34a[_0xb892('0x1c')][_0xb892('0x26')]===undefined?!![]:![]:!![],'where':_0x85d34a[_0xb892('0x1c')]?_0x85d34a[_0xb892('0x1c')][_0xb892('0x27')]||null:null,'attributes':_0x85d34a[_0xb892('0x1c')]?_0x85d34a[_0xb892('0x1c')][_0xb892('0x1d')]||null:null,'include':_0x85d34a[_0xb892('0x1c')]?_0x85d34a[_0xb892('0x1c')]['include']?_['map'](_0x85d34a[_0xb892('0x1c')][_0xb892('0x20')],function(_0x761ac9){return{'model':db[_0x761ac9[_0xb892('0x21')]],'as':_0x761ac9['as'],'attributes':_0x761ac9[_0xb892('0x1d')],'include':_0x761ac9[_0xb892('0x20')]?_[_0xb892('0x1f')](_0x761ac9[_0xb892('0x20')],function(_0x1de56a){return{'model':db[_0x1de56a[_0xb892('0x21')]],'as':_0x1de56a['as'],'attributes':_0x1de56a['attributes'],'include':_0x1de56a[_0xb892('0x20')]?_[_0xb892('0x1f')](_0x1de56a['include'],function(_0x2b9c60){return{'model':db[_0x2b9c60['model']],'as':_0x2b9c60['as'],'attributes':_0x2b9c60[_0xb892('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8c85){logger[_0xb892('0x11')]('ShowUser',_0x85d34a);logger['debug'](_0xb892('0x24'),_0x85d34a,JSON[_0xb892('0x23')](_0x2f8c85));_0xac6780(_0x2f8c85);})[_0xb892('0x28')](function(_0x508085){logger[_0xb892('0x17')](_0xb892('0x24'),_0x508085[_0xb892('0x18')],_0x85d34a);_0x4f9041(_0x4e6ebd['error'](0x1f4,_0x508085[_0xb892('0x18')]));});});};exports[_0xb892('0x29')]=function(_0x31e8f9){var _0xd1874c=this;return new Promise(function(_0x33bc09,_0x9a66e2){var _0x127bd4;return db['User'][_0xb892('0x25')]({'where':_0x31e8f9[_0xb892('0x1c')][_0xb892('0x27')]||{},'attributes':['id',_0xb892('0x2a'),_0xb892('0x2b'),_0xb892('0x2c'),'interface']})[_0xb892('0x22')](function(_0x4f2311){if(_0x4f2311){_0x127bd4=_0x4f2311;return db['UserVoiceQueueRt'][_0xb892('0x2d')]({'paused':0x1},{'where':{'UserId':_0x127bd4['id']},'individualHooks':!![]});}})['then'](function(){if(_0x127bd4){return db[_0xb892('0x2e')][_0xb892('0x1b')]({'where':{'membername':_0x127bd4[_0xb892('0x2a')],'type':_0xb892('0x2f'),'exitAt':null}});}})['then'](function(_0x27c229){if(_0x127bd4){if(_0x27c229&&_0x27c229[_0xb892('0x30')]){var _0x3ad2c0=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5b2e17=0x0,_0x3418fb=_0x27c229[_0xb892('0x30')];_0x5b2e17<_0x3418fb;_0x5b2e17++){_0x27c229[_0x5b2e17][_0xb892('0x31')]({'exitAt':_0x3ad2c0});}}}})[_0xb892('0x22')](function(){if(_0x127bd4){var _0x3a2db8=[];var _0x4abd57=utils[_0xb892('0x32')]();_0x4abd57['forEach'](function(_0x5813e4){_0x3a2db8[_0xb892('0x33')]({'channel':_0x5813e4,'membername':_0x127bd4[_0xb892('0x2a')],'interface':_[_0xb892('0x34')](_0x127bd4['interface'])?util[_0xb892('0x35')](_0xb892('0x36'),_0x127bd4[_0xb892('0x2a')]):_0x127bd4[_0xb892('0x37')],'type':_0xb892('0x2f'),'enterAt':moment()[_0xb892('0x35')](_0xb892('0x38')),'data1':_0x31e8f9[_0xb892('0x39')][_0xb892('0x3a')]||_0xb892('0x3b'),'role':_0x127bd4[_0xb892('0x2b')],'internal':_0x127bd4[_0xb892('0x2c')],'uniqueid':_0x31e8f9[_0xb892('0x39')][_0xb892('0x3c')]||null});});return db['MemberReport'][_0xb892('0x3d')](_0x3a2db8,{'individualHooks':!![]});}})['then'](function(){if(_0x127bd4){return _0x127bd4[_0xb892('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x31e8f9[_0xb892('0x39')]['type']||_0xb892('0x3b'),'lastPauseAt':moment()[_0xb892('0x35')](_0xb892('0x38'))});}})['then'](function(_0x422bdf){_0x33bc09(_0x422bdf);})['catch'](function(_0x19acab){_0x9a66e2(_0xd1874c[_0xb892('0x17')](0x1f4,_0x19acab[_0xb892('0x18')]));});});};exports[_0xb892('0x3e')]=function(_0x31ec8b){var _0x3b5446=this;return new Promise(function(_0x1a32c0,_0x487d9e){var _0x3c3bf3;return db[_0xb892('0x1a')][_0xb892('0x3f')]({'where':_0x31ec8b[_0xb892('0x1c')]['where']||{},'attributes':['id',_0xb892('0x2a')]})[_0xb892('0x22')](function(_0x39990e){if(_0x39990e){_0x3c3bf3=_0x39990e;if(_0x31ec8b[_0xb892('0x39')][_0xb892('0x40')]&&!utils[_0xb892('0x41')](_0x31ec8b[_0xb892('0x39')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x31ec8b[_0xb892('0x39')]['channel']){case _0xb892('0x42'):return db[_0xb892('0x43')][_0xb892('0x2d')]({'paused':0x0},{'where':{'UserId':_0x3c3bf3['id']}})['then'](function(){return db[_0xb892('0x2e')][_0xb892('0x25')]({'where':{'channel':_0x31ec8b[_0xb892('0x39')][_0xb892('0x40')],'membername':_0x3c3bf3[_0xb892('0x2a')],'type':_0xb892('0x2f'),'exitAt':null}});})[_0xb892('0x22')](function(_0x404449){if(_0x404449){return _0x404449[_0xb892('0x2d')]({'exitAt':moment()[_0xb892('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb892('0x44')},{'individualHooks':!![]});}return null;})[_0xb892('0x22')](function(){return _0x3c3bf3[_0xb892('0x2d')]({'voicePause':![]});});case'mail':case _0xb892('0x45'):case _0xb892('0x46'):case _0xb892('0x47'):case _0xb892('0x48'):return db[_0xb892('0x2e')]['find']({'where':{'channel':_0x31ec8b[_0xb892('0x39')]['channel'],'membername':_0x3c3bf3['name'],'type':_0xb892('0x2f'),'exitAt':null}})[_0xb892('0x22')](function(_0x403e79){return _0x403e79[_0xb892('0x2d')]({'exitAt':moment()[_0xb892('0x35')](_0xb892('0x38')),'data2':_0xb892('0x44')},{'individualHooks':!![]});})[_0xb892('0x22')](function(){var _0x239e51={};_[_0xb892('0x49')](_0x239e51,util['format'](_0xb892('0x4a'),_0x31ec8b['body'][_0xb892('0x40')],_0xb892('0x4b')),![]);return _0x3c3bf3[_0xb892('0x2d')](_0x239e51);});default:return db[_0xb892('0x43')][_0xb892('0x2d')]({'paused':0x0},{'where':{'UserId':_0x3c3bf3['id']}})['then'](function(){return db['MemberReport'][_0xb892('0x1b')]({'where':{'membername':_0x3c3bf3['name'],'type':_0xb892('0x2f'),'exitAt':null}});})[_0xb892('0x22')](function(_0x41fbc2){var _0x215564=[];_0x41fbc2[_0xb892('0x4c')](function(_0x3a2abb){_0x215564[_0xb892('0x33')](_0x3a2abb[_0xb892('0x2d')]({'exitAt':moment()[_0xb892('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb892('0x44')}));});return BPromise[_0xb892('0x4d')](_0x215564);})[_0xb892('0x22')](function(){return _0x3c3bf3[_0xb892('0x2d')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xb892('0x22')](function(_0x5358d6){_0x1a32c0(_0x5358d6);})[_0xb892('0x28')](function(_0x2c210b){_0x487d9e(_0x3b5446[_0xb892('0x17')](0x1f4,_0x2c210b[_0xb892('0x18')]));});});};exports[_0xb892('0x4e')]=function(_0x4842ce){var _0x2d7b90=this;return new Promise(function(_0x52e75d,_0x26e43f){var _0x224d71;return db[_0xb892('0x1a')][_0xb892('0x3f')]({'where':_0x4842ce[_0xb892('0x1c')][_0xb892('0x27')]||{},'attributes':['id',_0xb892('0x2a')]})[_0xb892('0x22')](function(_0x30087e){if(_0x30087e){_0x224d71=_0x30087e;return db[_0xb892('0x43')][_0xb892('0x4f')]({'where':{'membername':_0x224d71[_0xb892('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x224d71){return db[_0xb892('0x2e')]['findAll']({'where':{'membername':_0x224d71['name'],'exitAt':null}});}})[_0xb892('0x22')](function(_0x198fc5){if(_0x224d71){if(_0x198fc5&&_0x198fc5['length']){var _0x5976bc=[];_0x198fc5[_0xb892('0x4c')](function(_0x499e95){_0x5976bc[_0xb892('0x33')](_0x499e95[_0xb892('0x2d')]({'exitAt':moment()[_0xb892('0x35')](_0xb892('0x38'))}));});return BPromise[_0xb892('0x4d')](_0x5976bc);}}})[_0xb892('0x22')](function(){if(_0x224d71){return _0x224d71[_0xb892('0x2d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x30a878){_0x52e75d(_0x30a878);})[_0xb892('0x28')](function(_0x267812){_0x26e43f(_0x2d7b90[_0xb892('0x17')](0x1f4,_0x267812['message']));});});};exports[_0xb892('0x50')]=function(_0x55ab1e){var _0x19ffeb=this;return new Promise(function(_0x54a2c5,_0x4b08de){var _0x19a0e0;var _0x887065;var _0x3be121;var _0x1cee77;return db[_0xb892('0x1a')]['findOne']({'where':_0x55ab1e['options']['where']||{},'attributes':['id','name',_0xb892('0x2b'),_0xb892('0x51'),_0xb892('0x52'),'internal',_0xb892('0x53'),'interface']})['then'](function(_0x4c8ddc){if(_0x4c8ddc){_0x19a0e0=_0x4c8ddc;_0x1cee77=_0x55ab1e['body'][_0xb892('0x37')]?_0x55ab1e['body'][_0xb892('0x37')]:util['format'](_0xb892('0x36'),_0x19a0e0[_0xb892('0x2a')]);return db[_0xb892('0x1a')][_0xb892('0x54')]({'where':{'role':_0xb892('0x55'),'online':!![],'id':{'$ne':_0x19a0e0['id']}}});}})[_0xb892('0x22')](function(_0x44ad22){if(_0x44ad22){_0x3be121=_0x44ad22;return require(_0xb892('0x56'))['getLicense']();}})[_0xb892('0x22')](function(_0x8d0483){if(_0x8d0483&&_0x8d0483[_0xb892('0x57')]&&_0x3be121>=_0x8d0483[_0xb892('0x57')]){throw new Error(_0xb892('0x58'));}})[_0xb892('0x22')](function(){if(_0x19a0e0){return db[_0xb892('0x43')][_0xb892('0x4f')]({'where':{'membername':_0x19a0e0[_0xb892('0x2a')]},'individualHooks':!![]});}})[_0xb892('0x22')](function(){if(_0x19a0e0){return _0x19a0e0['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5c2782){if(_0x19a0e0){if(_0x5c2782){var _0x181504=[];_0x887065=_0x5c2782;if(_0x887065['length']){for(var _0x1b15ca=0x0;_0x1b15ca<_0x887065[_0xb892('0x30')];_0x1b15ca++){_0x181504['push'](db[_0xb892('0x43')][_0xb892('0x59')]({'membername':_0x19a0e0[_0xb892('0x2a')],'UserId':_0x19a0e0['id'],'queue_name':_0x887065[_0x1b15ca][_0xb892('0x2a')],'VoiceQueueId':_0x887065[_0x1b15ca]['id'],'interface':_0x1cee77,'paused':_0x19a0e0['loginInPause']||![],'penalty':_0x887065[_0x1b15ca][_0xb892('0x5a')]||0x0}));}return BPromise[_0xb892('0x4d')](_0x181504);}}}})[_0xb892('0x22')](function(){if(_0x19a0e0){return db[_0xb892('0x2e')][_0xb892('0x1b')]({'where':{'membername':_0x19a0e0['name'],'exitAt':null}});}})[_0xb892('0x22')](function(_0x113cfc){if(_0x19a0e0){if(_0x113cfc&&_0x113cfc[_0xb892('0x30')]){var _0x56a939=[];_0x113cfc[_0xb892('0x4c')](function(_0x1f1b6c){_0x56a939['push'](_0x1f1b6c['update']({'exitAt':moment()[_0xb892('0x35')](_0xb892('0x38'))}));});return BPromise['all'](_0x56a939);}}})[_0xb892('0x22')](function(_0x5b6aca){if(_0x19a0e0){var _0x45f1a7=[];var _0x5ea500=[];var _0x753421=utils[_0xb892('0x32')]();var _0x18fd5e={'membername':_0x19a0e0[_0xb892('0x2a')],'interface':_0x1cee77,'enterAt':moment()[_0xb892('0x35')](_0xb892('0x38')),'role':_0x19a0e0[_0xb892('0x2b')],'internal':_0x19a0e0[_0xb892('0x2c')]};_0x753421[_0xb892('0x4c')](function(_0xf91c6d){_0x45f1a7[_0xb892('0x33')](_['merge']({'channel':_0xf91c6d,'type':_0xb892('0x5b'),'data1':_0xb892('0x5c'),'data2':_0x1cee77},_0x18fd5e));if(_0x19a0e0[_0xb892('0x53')]){_0x5ea500[_0xb892('0x33')](_[_0xb892('0x5d')]({'channel':_0xf91c6d,'type':_0xb892('0x2f'),'data1':_0xb892('0x5e')},_0x18fd5e));}});return db[_0xb892('0x2e')][_0xb892('0x3d')](_0x45f1a7[_0xb892('0x5f')](_0x5ea500),{'individualHooks':!![]});}})['then'](function(){if(_0x19a0e0){return _0x19a0e0['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb892('0x38')),'voicePause':_0x19a0e0[_0xb892('0x53')]||![],'mailPause':_0x19a0e0[_0xb892('0x53')]||![],'chatPause':_0x19a0e0['loginInPause']||![],'faxPause':_0x19a0e0[_0xb892('0x53')]||![],'smsPause':_0x19a0e0[_0xb892('0x53')]||![],'openchannelPause':_0x19a0e0['loginInPause']||![],'pauseType':_0x19a0e0[_0xb892('0x53')]?_0xb892('0x5e'):null,'lastPauseAt':moment()[_0xb892('0x35')](_0xb892('0x38')),'interface':_0x1cee77});}})['then'](function(_0x155338){_0x54a2c5(_0x155338);})[_0xb892('0x28')](function(_0x391314){_0x4b08de(_0x19ffeb[_0xb892('0x17')](0x1f4,_0x391314['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fc4dae7..f67000c 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 _0xb06d=['remove','update','register','length','user:','./user.events'];(function(_0x51edca,_0x18ad70){var _0x2b77ec=function(_0x55a549){while(--_0x55a549){_0x51edca['push'](_0x51edca['shift']());}};_0x2b77ec(++_0x18ad70);}(_0xb06d,0x1d3));var _0xdb06=function(_0x331a21,_0x41835e){_0x331a21=_0x331a21-0x0;var _0x56d334=_0xb06d[_0x331a21];return _0x56d334;};'use strict';var UserEvents=require(_0xdb06('0x0'));var events=['save',_0xdb06('0x1'),_0xdb06('0x2')];function createListener(_0x3c099f,_0x536a9e){return function(_0x3786e1){_0x536a9e['emit'](_0x3c099f,_0x3786e1);};}function removeListener(_0x1828ad,_0x1ca75b){return function(){UserEvents['removeListener'](_0x1828ad,_0x1ca75b);};}exports[_0xdb06('0x3')]=function(_0xb67c4d){for(var _0x4663b2=0x0,_0x381bdd=events[_0xdb06('0x4')];_0x4663b2<_0x381bdd;_0x4663b2++){var _0x3a30e7=events[_0x4663b2];var _0x576885=createListener(_0xdb06('0x5')+_0x3a30e7,_0xb67c4d);UserEvents['on'](_0x3a30e7,_0x576885);}}; \ No newline at end of file +var _0x2fcc=['save','remove','removeListener','user:','./user.events'];(function(_0x1ec264,_0x56fe28){var _0x326714=function(_0x391755){while(--_0x391755){_0x1ec264['push'](_0x1ec264['shift']());}};_0x326714(++_0x56fe28);}(_0x2fcc,0x81));var _0xc2fc=function(_0x15e7db,_0x1f31d5){_0x15e7db=_0x15e7db-0x0;var _0xdda87f=_0x2fcc[_0x15e7db];return _0xdda87f;};'use strict';var UserEvents=require(_0xc2fc('0x0'));var events=[_0xc2fc('0x1'),_0xc2fc('0x2'),'update'];function createListener(_0x15c0c6,_0x3285d5){return function(_0x5e51a5){_0x3285d5['emit'](_0x15c0c6,_0x5e51a5);};}function removeListener(_0x4d6237,_0x2da3a1){return function(){UserEvents[_0xc2fc('0x3')](_0x4d6237,_0x2da3a1);};}exports['register']=function(_0x2a6252){for(var _0x343258=0x0,_0x1458ce=events['length'];_0x343258<_0x1458ce;_0x343258++){var _0x2cbc76=events[_0x343258];var _0x31aab2=createListener(_0xc2fc('0x4')+_0x2cbc76,_0x2a6252);UserEvents['on'](_0x2cbc76,_0x31aab2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 84a8f50..67a3e02 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 _0x07a6=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0x1fee1e,_0xd0cf34){var _0x2128ae=function(_0x2a1a9f){while(--_0x2a1a9f){_0x1fee1e['push'](_0x1fee1e['shift']());}};_0x2128ae(++_0xd0cf34);}(_0x07a6,0x9c));var _0x607a=function(_0x23d96f,_0x1153b7){_0x23d96f=_0x23d96f-0x0;var _0x2db681=_0x07a6[_0x23d96f];return _0x2db681;};'use strict';var multer=require('multer');var util=require(_0x607a('0x0'));var path=require('path');var timeout=require(_0x607a('0x1'));var express=require(_0x607a('0x2'));var router=express[_0x607a('0x3')]();var auth=require(_0x607a('0x4'));var interaction=require(_0x607a('0x5'));var config=require(_0x607a('0x6'));module[_0x607a('0x7')]=router; \ No newline at end of file +var _0xc839=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0xc839,0xbd));var _0x9c83=function(_0x4ae6de,_0x31652f){_0x4ae6de=_0x4ae6de-0x0;var _0x267c26=_0xc839[_0x4ae6de];return _0x267c26;};'use strict';var multer=require(_0x9c83('0x0'));var util=require(_0x9c83('0x1'));var path=require(_0x9c83('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c83('0x3'));var router=express[_0x9c83('0x4')]();var auth=require(_0x9c83('0x5'));var interaction=require(_0x9c83('0x6'));var config=require(_0x9c83('0x7'));module[_0x9c83('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 45c35b3..14e8830 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 _0xbaf0=['exports','INTEGER'];(function(_0x2cff4f,_0x21e344){var _0x3df848=function(_0x49474b){while(--_0x49474b){_0x2cff4f['push'](_0x2cff4f['shift']());}};_0x3df848(++_0x21e344);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4b9dba,_0x42e19b){var _0x1676d7=function(_0x146112){while(--_0x146112){_0x4b9dba['push'](_0x4b9dba['shift']());}};_0x1676d7(++_0x42e19b);}(_0xe706,0xa3));var _0x6e70=function(_0x25e995,_0x143cdc){_0x25e995=_0x25e995-0x0;var _0x446a58=_0xe706[_0x25e995];return _0x446a58;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 7122931..8388edc 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 _0xc329=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0xc329,0x90));var _0x9c32=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0xc329[_0x4433b];return _0xffc1da;};'use strict';var _=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var logger=require(_0x9c32('0x2'))(_0x9c32('0x3'));var moment=require('moment');var BPromise=require(_0x9c32('0x4'));var rp=require(_0x9c32('0x5'));var fs=require('fs');var path=require(_0x9c32('0x6'));var rimraf=require(_0x9c32('0x7'));var config=require(_0x9c32('0x8'));var attributes=require(_0x9c32('0x9'));module[_0x9c32('0xa')]=function(_0x14d8ac,_0x5ec7d9){return _0x14d8ac['define'](_0x9c32('0xb'),attributes,{'tableName':_0x9c32('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf03d=['./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1ea6eb,_0x33d3d4){var _0x127200=function(_0x5ef9b8){while(--_0x5ef9b8){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x127200(++_0x33d3d4);}(_0xf03d,0xe8));var _0xdf03=function(_0xdfdca4,_0x4ff5c6){_0xdfdca4=_0xdfdca4-0x0;var _0x4453b9=_0xf03d[_0xdfdca4];return _0x4453b9;};'use strict';var _=require(_0xdf03('0x0'));var util=require(_0xdf03('0x1'));var logger=require('../../config/logger')(_0xdf03('0x2'));var moment=require(_0xdf03('0x3'));var BPromise=require(_0xdf03('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf03('0x5'));var rimraf=require(_0xdf03('0x6'));var config=require(_0xdf03('0x7'));var attributes=require(_0xdf03('0x8'));module[_0xdf03('0x9')]=function(_0x2b328d,_0x144622){return _0x2b328d[_0xdf03('0xa')](_0xdf03('0xb'),attributes,{'tableName':'user_has_chat_queues','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 304fcb9..4e746bc 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 _0xe32d=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4b1bbc,_0x1035f3){var _0x55d8db=function(_0x1e22c0){while(--_0x1e22c0){_0x4b1bbc['push'](_0x4b1bbc['shift']());}};_0x55d8db(++_0x1035f3);}(_0xe32d,0x1ba));var _0xde32=function(_0x56b78d,_0x5680a3){_0x56b78d=_0x56b78d-0x0;var _0x2763b7=_0xe32d[_0x56b78d];return _0x2763b7;};'use strict';var _=require(_0xde32('0x0'));var util=require(_0xde32('0x1'));var moment=require(_0xde32('0x2'));var BPromise=require('bluebird');var rs=require(_0xde32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde32('0x4'))['db'];var utils=require(_0xde32('0x5'));var logger=require(_0xde32('0x6'))(_0xde32('0x7'));var config=require(_0xde32('0x8'));var jayson=require(_0xde32('0x9'));var client=jayson[_0xde32('0xa')][_0xde32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3180f2,_0xabd0c0,_0xe61edb){return new BPromise(function(_0x2a481e,_0x33e1cd){return client[_0xde32('0xc')](_0x3180f2,_0xe61edb)[_0xde32('0xd')](function(_0x4cb00e){logger[_0xde32('0xe')](_0xde32('0xf'),_0xabd0c0,_0xde32('0x10'));logger[_0xde32('0x11')](_0xde32('0x12'),_0xabd0c0,_0xde32('0x10'),JSON[_0xde32('0x13')](_0x4cb00e));if(_0x4cb00e[_0xde32('0x14')]){if(_0x4cb00e[_0xde32('0x14')][_0xde32('0x15')]===0x1f4){logger['error'](_0xde32('0xf'),_0xabd0c0,_0x4cb00e['error']['message']);return _0x33e1cd(_0x4cb00e[_0xde32('0x14')][_0xde32('0x16')]);}logger[_0xde32('0x14')](_0xde32('0xf'),_0xabd0c0,_0x4cb00e[_0xde32('0x14')][_0xde32('0x16')]);return _0x2a481e(_0x4cb00e[_0xde32('0x14')]['message']);}else{logger[_0xde32('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xabd0c0,_0xde32('0x10'));_0x2a481e(_0x4cb00e[_0xde32('0x17')][_0xde32('0x16')]);}})['catch'](function(_0x1c455e){logger[_0xde32('0x14')](_0xde32('0xf'),_0xabd0c0,_0x1c455e);_0x33e1cd(_0x1c455e);});});} \ No newline at end of file +var _0x3f22=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x278bc4,_0x25b08c){var _0x27ac89=function(_0x1a284e){while(--_0x1a284e){_0x278bc4['push'](_0x278bc4['shift']());}};_0x27ac89(++_0x25b08c);}(_0x3f22,0x174));var _0x23f2=function(_0x49c643,_0x517b11){_0x49c643=_0x49c643-0x0;var _0x53600c=_0x3f22[_0x49c643];return _0x53600c;};'use strict';var _=require(_0x23f2('0x0'));var util=require(_0x23f2('0x1'));var moment=require('moment');var BPromise=require(_0x23f2('0x2'));var rs=require(_0x23f2('0x3'));var fs=require('fs');var Redis=require(_0x23f2('0x4'));var db=require(_0x23f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23f2('0x6'))('rpc');var config=require(_0x23f2('0x7'));var jayson=require(_0x23f2('0x8'));var client=jayson[_0x23f2('0x9')][_0x23f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x518675,_0x53399e,_0x2fd585){return new BPromise(function(_0x3e5df9,_0x2db2d5){return client[_0x23f2('0xb')](_0x518675,_0x2fd585)[_0x23f2('0xc')](function(_0x2b93f7){logger[_0x23f2('0xd')](_0x23f2('0xe'),_0x53399e,_0x23f2('0xf'));logger[_0x23f2('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x53399e,_0x23f2('0xf'),JSON[_0x23f2('0x11')](_0x2b93f7));if(_0x2b93f7[_0x23f2('0x12')]){if(_0x2b93f7['error'][_0x23f2('0x13')]===0x1f4){logger[_0x23f2('0x12')](_0x23f2('0xe'),_0x53399e,_0x2b93f7[_0x23f2('0x12')]['message']);return _0x2db2d5(_0x2b93f7['error']['message']);}logger[_0x23f2('0x12')](_0x23f2('0xe'),_0x53399e,_0x2b93f7[_0x23f2('0x12')][_0x23f2('0x14')]);return _0x3e5df9(_0x2b93f7[_0x23f2('0x12')][_0x23f2('0x14')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x53399e,_0x23f2('0xf'));_0x3e5df9(_0x2b93f7['result'][_0x23f2('0x14')]);}})[_0x23f2('0x15')](function(_0x3f3dec){logger[_0x23f2('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53399e,_0x3f3dec);_0x2db2d5(_0x3f3dec);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d81f3ab..cfeaa19 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 _0xe4fa=['multer','path','Router','../../config/environment','exports'];(function(_0xfbc791,_0x5c513f){var _0x319b54=function(_0x3f8f64){while(--_0x3f8f64){_0xfbc791['push'](_0xfbc791['shift']());}};_0x319b54(++_0x5c513f);}(_0xe4fa,0xff));var _0xae4f=function(_0x2cfd71,_0x37f649){_0x2cfd71=_0x2cfd71-0x0;var _0x591a7b=_0xe4fa[_0x2cfd71];return _0x591a7b;};'use strict';var multer=require(_0xae4f('0x0'));var util=require('util');var path=require(_0xae4f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae4f('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae4f('0x3'));module[_0xae4f('0x4')]=router; \ No newline at end of file +var _0xffeb=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0xe22db5,_0x52829d){var _0x1f56cc=function(_0x38bc80){while(--_0x38bc80){_0xe22db5['push'](_0xe22db5['shift']());}};_0x1f56cc(++_0x52829d);}(_0xffeb,0x183));var _0xbffe=function(_0x1ea79d,_0x36253b){_0x1ea79d=_0x1ea79d-0x0;var _0x33072b=_0xffeb[_0x1ea79d];return _0x33072b;};'use strict';var multer=require('multer');var util=require(_0xbffe('0x0'));var path=require(_0xbffe('0x1'));var timeout=require(_0xbffe('0x2'));var express=require(_0xbffe('0x3'));var router=express[_0xbffe('0x4')]();var auth=require(_0xbffe('0x5'));var interaction=require(_0xbffe('0x6'));var config=require(_0xbffe('0x7'));module[_0xbffe('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a5e7b77..a3e6fe8 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 _0xda3f=['exports','INTEGER'];(function(_0x35c585,_0x5f3824){var _0x5ddb1a=function(_0x3b1a3b){while(--_0x3b1a3b){_0x35c585['push'](_0x35c585['shift']());}};_0x5ddb1a(++_0x5f3824);}(_0xda3f,0xec));var _0xfda3=function(_0x206de8,_0x46dde7){_0x206de8=_0x206de8-0x0;var _0x12ec32=_0xda3f[_0x206de8];return _0x12ec32;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'penalty':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3266=['INTEGER','STRING','sequelize','exports'];(function(_0x4b9157,_0x35865d){var _0x160156=function(_0xc4ce67){while(--_0xc4ce67){_0x4b9157['push'](_0x4b9157['shift']());}};_0x160156(++_0x35865d);}(_0x3266,0x6a));var _0x6326=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x3266[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'penalty':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6326('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x6326('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7b07927..abed1b9 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x294cf1,_0x5d6a40){_0x294cf1=_0x294cf1-0x0;var _0x334402=_0xb10b[_0x294cf1];return _0x334402;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_fax_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22e9fe,_0x432f69){var _0x133e8d=function(_0x30c92d){while(--_0x30c92d){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x133e8d(++_0x432f69);}(_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('./userFaxQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserFaxQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 37afca2..4d8b502 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 _0x6659=['request\x20sent','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x6659,0xbd));var _0x9665=function(_0x40a376,_0x54dd0a){_0x40a376=_0x40a376-0x0;var _0x2bdbb5=_0x6659[_0x40a376];return _0x2bdbb5;};'use strict';var _=require('lodash');var util=require(_0x9665('0x0'));var moment=require('moment');var BPromise=require(_0x9665('0x1'));var rs=require(_0x9665('0x2'));var fs=require('fs');var Redis=require(_0x9665('0x3'));var db=require(_0x9665('0x4'))['db'];var utils=require(_0x9665('0x5'));var logger=require(_0x9665('0x6'))(_0x9665('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3798b7,_0x279158,_0x4d5720){return new BPromise(function(_0x20d669,_0x39f0e4){return client['request'](_0x3798b7,_0x4d5720)['then'](function(_0x5d8ae8){logger['info'](_0x9665('0x8'),_0x279158,'request\x20sent');logger[_0x9665('0x9')](_0x9665('0xa'),_0x279158,'request\x20sent',JSON[_0x9665('0xb')](_0x5d8ae8));if(_0x5d8ae8[_0x9665('0xc')]){if(_0x5d8ae8['error']['code']===0x1f4){logger['error'](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x39f0e4(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x20d669(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}else{logger[_0x9665('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x279158,_0x9665('0xf'));_0x20d669(_0x5d8ae8[_0x9665('0x10')][_0x9665('0xd')]);}})['catch'](function(_0xfd2b1d){logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0xfd2b1d);_0x39f0e4(_0xfd2b1d);});});} \ No newline at end of file +var _0xe0a8=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x312f73,_0x4e49e7){var _0x43d00d=function(_0x3f3d45){while(--_0x3f3d45){_0x312f73['push'](_0x312f73['shift']());}};_0x43d00d(++_0x4e49e7);}(_0xe0a8,0x161));var _0x8e0a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe0a8[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x8e0a('0x0'));var moment=require(_0x8e0a('0x1'));var BPromise=require(_0x8e0a('0x2'));var rs=require(_0x8e0a('0x3'));var fs=require('fs');var Redis=require(_0x8e0a('0x4'));var db=require(_0x8e0a('0x5'))['db'];var utils=require(_0x8e0a('0x6'));var logger=require(_0x8e0a('0x7'))(_0x8e0a('0x8'));var config=require(_0x8e0a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e0a('0xa')][_0x8e0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21c28e,_0x5a43b2,_0x476742){return new BPromise(function(_0x5b5fc4,_0x16c16a){return client[_0x8e0a('0xc')](_0x21c28e,_0x476742)[_0x8e0a('0xd')](function(_0x46cb3b){logger[_0x8e0a('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x5a43b2,_0x8e0a('0xf'));logger[_0x8e0a('0x10')](_0x8e0a('0x11'),_0x5a43b2,_0x8e0a('0xf'),JSON['stringify'](_0x46cb3b));if(_0x46cb3b['error']){if(_0x46cb3b[_0x8e0a('0x12')][_0x8e0a('0x13')]===0x1f4){logger[_0x8e0a('0x12')](_0x8e0a('0x14'),_0x5a43b2,_0x46cb3b[_0x8e0a('0x12')]['message']);return _0x16c16a(_0x46cb3b[_0x8e0a('0x12')]['message']);}logger['error'](_0x8e0a('0x14'),_0x5a43b2,_0x46cb3b[_0x8e0a('0x12')]['message']);return _0x5b5fc4(_0x46cb3b['error']['message']);}else{logger[_0x8e0a('0xe')](_0x8e0a('0x14'),_0x5a43b2,'request\x20sent');_0x5b5fc4(_0x46cb3b['result'][_0x8e0a('0x15')]);}})[_0x8e0a('0x16')](function(_0x88a22b){logger[_0x8e0a('0x12')](_0x8e0a('0x14'),_0x5a43b2,_0x88a22b);_0x16c16a(_0x88a22b);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ddebe7b..be7b57a 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 _0xab52=['../../components/interaction/service','exports','multer','util','path','Router'];(function(_0x53db6a,_0x1ce1eb){var _0xa193b6=function(_0x4e9990){while(--_0x4e9990){_0x53db6a['push'](_0x53db6a['shift']());}};_0xa193b6(++_0x1ce1eb);}(_0xab52,0x1a6));var _0x2ab5=function(_0x2a9393,_0xae8865){_0x2a9393=_0x2a9393-0x0;var _0x462f0d=_0xab52[_0x2a9393];return _0x462f0d;};'use strict';var multer=require(_0x2ab5('0x0'));var util=require(_0x2ab5('0x1'));var path=require(_0x2ab5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ab5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ab5('0x4'));var config=require('../../config/environment');module[_0x2ab5('0x5')]=router; \ No newline at end of file +var _0x4936=['connect-timeout','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4936,0xeb));var _0x6493=function(_0x664821,_0x1ab687){_0x664821=_0x664821-0x0;var _0x40e076=_0x4936[_0x664821];return _0x40e076;};'use strict';var multer=require(_0x6493('0x0'));var util=require(_0x6493('0x1'));var path=require(_0x6493('0x2'));var timeout=require(_0x6493('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6493('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6493('0x5'));module[_0x6493('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 707e8ce..1da689b 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(_0x240454,_0x1896cd){var _0x4059dc=function(_0x5f01dc){while(--_0x5f01dc){_0x240454['push'](_0x240454['shift']());}};_0x4059dc(++_0x1896cd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xd25b59,_0x217f8a){var _0x4cab47=function(_0x26362d){while(--_0x26362d){_0xd25b59['push'](_0xd25b59['shift']());}};_0x4cab47(++_0x217f8a);}(_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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 86d7e77..e98c428 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1819ef,_0x3d9ea3){var _0x12ca22=function(_0x292179){while(--_0x292179){_0x1819ef['push'](_0x1819ef['shift']());}};_0x12ca22(++_0x3d9ea3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x31f3d9,_0x123c4a){var _0x51423c=function(_0x2f316e){while(--_0x2f316e){_0x31f3d9['push'](_0x31f3d9['shift']());}};_0x51423c(++_0x123c4a);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 61a384c..97bd618 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 _0x3435=['request','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1cf1c7,_0x1e0f72){var _0x362b0a=function(_0xfec7cd){while(--_0xfec7cd){_0x1cf1c7['push'](_0x1cf1c7['shift']());}};_0x362b0a(++_0x1e0f72);}(_0x3435,0xfa));var _0x5343=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x3435[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var rs=require(_0x5343('0x4'));var fs=require('fs');var Redis=require(_0x5343('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5343('0x6'));var logger=require(_0x5343('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x544b29,_0x13641f,_0x1e1911){return new BPromise(function(_0x9ea9b6,_0x245034){return client[_0x5343('0xa')](_0x544b29,_0x1e1911)['then'](function(_0x44421c){logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));logger[_0x5343('0xd')](_0x5343('0xe'),_0x13641f,_0x5343('0xc'),JSON['stringify'](_0x44421c));if(_0x44421c[_0x5343('0xf')]){if(_0x44421c[_0x5343('0xf')][_0x5343('0x10')]===0x1f4){logger['error'](_0x5343('0xb'),_0x13641f,_0x44421c['error'][_0x5343('0x11')]);return _0x245034(_0x44421c[_0x5343('0xf')]['message']);}logger[_0x5343('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x13641f,_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);return _0x9ea9b6(_0x44421c[_0x5343('0xf')][_0x5343('0x11')]);}else{logger['info'](_0x5343('0xb'),_0x13641f,_0x5343('0xc'));_0x9ea9b6(_0x44421c[_0x5343('0x12')][_0x5343('0x11')]);}})[_0x5343('0x13')](function(_0x2913e8){logger[_0x5343('0xf')](_0x5343('0xb'),_0x13641f,_0x2913e8);_0x245034(_0x2913e8);});});} \ No newline at end of file +var _0x46ed=['UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'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')]('UserMailQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 95f0551..40c1aea 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 _0x9648=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x105b14,_0x246c43){var _0x2ba487=function(_0xd16399){while(--_0xd16399){_0x105b14['push'](_0x105b14['shift']());}};_0x2ba487(++_0x246c43);}(_0x9648,0xfa));var _0x8964=function(_0x15dd81,_0x4563eb){_0x15dd81=_0x15dd81-0x0;var _0x40d4b5=_0x9648[_0x15dd81];return _0x40d4b5;};'use strict';var multer=require(_0x8964('0x0'));var util=require(_0x8964('0x1'));var path=require(_0x8964('0x2'));var timeout=require(_0x8964('0x3'));var express=require(_0x8964('0x4'));var router=express[_0x8964('0x5')]();var auth=require(_0x8964('0x6'));var interaction=require(_0x8964('0x7'));var config=require(_0x8964('0x8'));module[_0x8964('0x9')]=router; \ No newline at end of file +var _0xa3ff=['../../config/environment','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6ef396,_0x3b78e4){var _0x1c9001=function(_0x3194f6){while(--_0x3194f6){_0x6ef396['push'](_0x6ef396['shift']());}};_0x1c9001(++_0x3b78e4);}(_0xa3ff,0x1e8));var _0xfa3f=function(_0x59c2cb,_0x671ebb){_0x59c2cb=_0x59c2cb-0x0;var _0x4d2910=_0xa3ff[_0x59c2cb];return _0x4d2910;};'use strict';var multer=require(_0xfa3f('0x0'));var util=require('util');var path=require(_0xfa3f('0x1'));var timeout=require(_0xfa3f('0x2'));var express=require(_0xfa3f('0x3'));var router=express[_0xfa3f('0x4')]();var auth=require(_0xfa3f('0x5'));var interaction=require(_0xfa3f('0x6'));var config=require(_0xfa3f('0x7'));module[_0xfa3f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index e296118..6e96ab1 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x4be3ec,_0x218441){var _0x44b79f=function(_0x56d3c1){while(--_0x56d3c1){_0x4be3ec['push'](_0x4be3ec['shift']());}};_0x44b79f(++_0x218441);}(_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}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x5e271a,_0x589205){var _0x5dae62=function(_0x2bb7d1){while(--_0x2bb7d1){_0x5e271a['push'](_0x5e271a['shift']());}};_0x5dae62(++_0x589205);}(_0xe706,0xa3));var _0x6e70=function(_0x1efa5c,_0x4deafb){_0x1efa5c=_0x1efa5c-0x0;var _0x4f8376=_0xe706[_0x1efa5c];return _0x4f8376;};'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/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3cd1fad..b1c7f80 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 _0x9f7c=['rimraf','../../config/environment','exports','define','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x58df3e,_0x38ff8d){var _0x3cebd4=function(_0x3197e){while(--_0x3197e){_0x58df3e['push'](_0x58df3e['shift']());}};_0x3cebd4(++_0x38ff8d);}(_0x9f7c,0xcb));var _0xc9f7=function(_0x586baa,_0x3962b7){_0x586baa=_0x586baa-0x0;var _0x3ac81d=_0x9f7c[_0x586baa];return _0x3ac81d;};'use strict';var _=require('lodash');var util=require(_0xc9f7('0x0'));var logger=require(_0xc9f7('0x1'))('api');var moment=require(_0xc9f7('0x2'));var BPromise=require(_0xc9f7('0x3'));var rp=require(_0xc9f7('0x4'));var fs=require('fs');var path=require(_0xc9f7('0x5'));var rimraf=require(_0xc9f7('0x6'));var config=require(_0xc9f7('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc9f7('0x8')]=function(_0x50b2a0,_0xc7c9ae){return _0x50b2a0[_0xc9f7('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xc9f7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x331b=['rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5866fa,_0x448e72){var _0x5b7c5b=function(_0x176640){while(--_0x176640){_0x5866fa['push'](_0x5866fa['shift']());}};_0x5b7c5b(++_0x448e72);}(_0x331b,0x103));var _0xb331=function(_0x1ee52c,_0x120304){_0x1ee52c=_0x1ee52c-0x0;var _0x1e2261=_0x331b[_0x1ee52c];return _0x1e2261;};'use strict';var _=require(_0xb331('0x0'));var util=require(_0xb331('0x1'));var logger=require(_0xb331('0x2'))(_0xb331('0x3'));var moment=require(_0xb331('0x4'));var BPromise=require(_0xb331('0x5'));var rp=require(_0xb331('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb331('0x7'));var config=require(_0xb331('0x8'));var attributes=require(_0xb331('0x9'));module[_0xb331('0xa')]=function(_0x1e3c72,_0x188f8c){return _0x1e3c72[_0xb331('0xb')](_0xb331('0xc'),attributes,{'tableName':_0xb331('0xd'),'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 14ecf18..deebf1d 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 _0x86e4=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then'];(function(_0x47a95a,_0x564d06){var _0x348e90=function(_0x146c10){while(--_0x146c10){_0x47a95a['push'](_0x47a95a['shift']());}};_0x348e90(++_0x564d06);}(_0x86e4,0x1ae));var _0x486e=function(_0x4b095c,_0x266c55){_0x4b095c=_0x4b095c-0x0;var _0x4495e2=_0x86e4[_0x4b095c];return _0x4495e2;};'use strict';var _=require(_0x486e('0x0'));var util=require(_0x486e('0x1'));var moment=require(_0x486e('0x2'));var BPromise=require('bluebird');var rs=require(_0x486e('0x3'));var fs=require('fs');var Redis=require(_0x486e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x486e('0x5'));var logger=require(_0x486e('0x6'))(_0x486e('0x7'));var config=require('../../config/environment');var jayson=require(_0x486e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e71c5,_0x4fec6e,_0x36e39e){return new BPromise(function(_0x4a9477,_0x2f3580){return client[_0x486e('0x9')](_0x2e71c5,_0x36e39e)[_0x486e('0xa')](function(_0x4addec){logger[_0x486e('0xb')](_0x486e('0xc'),_0x4fec6e,_0x486e('0xd'));logger[_0x486e('0xe')](_0x486e('0xf'),_0x4fec6e,_0x486e('0xd'),JSON[_0x486e('0x10')](_0x4addec));if(_0x4addec[_0x486e('0x11')]){if(_0x4addec[_0x486e('0x11')]['code']===0x1f4){logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x4addec[_0x486e('0x11')][_0x486e('0x12')]);return _0x2f3580(_0x4addec['error']['message']);}logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x4addec['error'][_0x486e('0x12')]);return _0x4a9477(_0x4addec[_0x486e('0x11')][_0x486e('0x12')]);}else{logger['info'](_0x486e('0xc'),_0x4fec6e,_0x486e('0xd'));_0x4a9477(_0x4addec[_0x486e('0x13')]['message']);}})[_0x486e('0x14')](function(_0x3ecaef){logger[_0x486e('0x11')](_0x486e('0xc'),_0x4fec6e,_0x3ecaef);_0x2f3580(_0x3ecaef);});});} \ No newline at end of file +var _0x0c39=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21090f,_0x5b73cc){var _0x5cbfe7=function(_0x49e2b9){while(--_0x49e2b9){_0x21090f['push'](_0x21090f['shift']());}};_0x5cbfe7(++_0x5b73cc);}(_0x0c39,0x1de));var _0x90c3=function(_0x3f5bec,_0x193f48){_0x3f5bec=_0x3f5bec-0x0;var _0x2b7428=_0x0c39[_0x3f5bec];return _0x2b7428;};'use strict';var _=require(_0x90c3('0x0'));var util=require(_0x90c3('0x1'));var moment=require(_0x90c3('0x2'));var BPromise=require(_0x90c3('0x3'));var rs=require(_0x90c3('0x4'));var fs=require('fs');var Redis=require(_0x90c3('0x5'));var db=require(_0x90c3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x90c3('0x7'))(_0x90c3('0x8'));var config=require(_0x90c3('0x9'));var jayson=require(_0x90c3('0xa'));var client=jayson[_0x90c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58a50e,_0x38389e,_0x33b9c1){return new BPromise(function(_0x5c5518,_0x2bd4a7){return client['request'](_0x58a50e,_0x33b9c1)[_0x90c3('0xc')](function(_0x4ab206){logger['info'](_0x90c3('0xd'),_0x38389e,_0x90c3('0xe'));logger['debug'](_0x90c3('0xf'),_0x38389e,_0x90c3('0xe'),JSON[_0x90c3('0x10')](_0x4ab206));if(_0x4ab206[_0x90c3('0x11')]){if(_0x4ab206[_0x90c3('0x11')][_0x90c3('0x12')]===0x1f4){logger[_0x90c3('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38389e,_0x4ab206[_0x90c3('0x11')][_0x90c3('0x13')]);return _0x2bd4a7(_0x4ab206[_0x90c3('0x11')][_0x90c3('0x13')]);}logger[_0x90c3('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38389e,_0x4ab206[_0x90c3('0x11')][_0x90c3('0x13')]);return _0x5c5518(_0x4ab206[_0x90c3('0x11')][_0x90c3('0x13')]);}else{logger[_0x90c3('0x14')](_0x90c3('0xd'),_0x38389e,_0x90c3('0xe'));_0x5c5518(_0x4ab206[_0x90c3('0x15')]['message']);}})['catch'](function(_0x141c8f){logger[_0x90c3('0x11')](_0x90c3('0xd'),_0x38389e,_0x141c8f);_0x2bd4a7(_0x141c8f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 67dd23b..9b70851 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 _0x6358=['../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/sections','getSections','create','clone','addSections','post','/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x133968,_0x5ca58b){var _0x14a75a=function(_0x52080d){while(--_0x52080d){_0x133968['push'](_0x133968['shift']());}};_0x14a75a(++_0x5ca58b);}(_0x6358,0x13e));var _0x8635=function(_0x4dc10c,_0x2bfbd4){_0x4dc10c=_0x4dc10c-0x0;var _0x2142d1=_0x6358[_0x4dc10c];return _0x2142d1;};'use strict';var multer=require(_0x8635('0x0'));var util=require(_0x8635('0x1'));var path=require(_0x8635('0x2'));var timeout=require(_0x8635('0x3'));var express=require(_0x8635('0x4'));var router=express['Router']();var auth=require(_0x8635('0x5'));var interaction=require(_0x8635('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x8635('0x7')]('/',auth[_0x8635('0x8')](),controller['index']);router['get'](_0x8635('0x9'),auth[_0x8635('0x8')](),controller[_0x8635('0xa')]);router['get'](_0x8635('0xb'),auth[_0x8635('0x8')](),controller['show']);router['get'](_0x8635('0xc'),auth[_0x8635('0x8')](),controller[_0x8635('0xd')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0x8635('0x8')](),controller[_0x8635('0xe')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x8635('0xf')]);router['post'](_0x8635('0xc'),auth[_0x8635('0x8')](),controller[_0x8635('0x10')]);router[_0x8635('0x11')](_0x8635('0x12'),auth[_0x8635('0x8')](),controller[_0x8635('0x13')]);router[_0x8635('0x14')](_0x8635('0xb'),auth[_0x8635('0x8')](),controller[_0x8635('0x15')]);router[_0x8635('0x16')](_0x8635('0xb'),auth[_0x8635('0x8')](),controller[_0x8635('0x17')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x8635('0x18')]);router['delete'](_0x8635('0x12'),auth[_0x8635('0x8')](),controller[_0x8635('0x19')]);module[_0x8635('0x1a')]=router; \ No newline at end of file +var _0xe65a=['getSections','create','post','/:id/clone','addSections','/:id/resources','addResources','delete','destroy','removeResources','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections'];(function(_0x100f19,_0x1b0507){var _0x264b6c=function(_0x46e135){while(--_0x46e135){_0x100f19['push'](_0x100f19['shift']());}};_0x264b6c(++_0x1b0507);}(_0xe65a,0x73));var _0xae65=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xe65a[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0xae65('0x0'));var util=require(_0xae65('0x1'));var path=require(_0xae65('0x2'));var timeout=require(_0xae65('0x3'));var express=require('express');var router=express[_0xae65('0x4')]();var auth=require(_0xae65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae65('0x6'));var controller=require('./userProfile.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xae65('0x7')]);router[_0xae65('0x8')](_0xae65('0x9'),auth[_0xae65('0xa')](),controller[_0xae65('0xb')]);router[_0xae65('0x8')](_0xae65('0xc'),auth[_0xae65('0xa')](),controller[_0xae65('0xd')]);router[_0xae65('0x8')](_0xae65('0xe'),auth[_0xae65('0xa')](),controller[_0xae65('0xf')]);router[_0xae65('0x8')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router['post']('/',auth[_0xae65('0xa')](),controller[_0xae65('0x10')]);router[_0xae65('0x11')](_0xae65('0x12'),auth[_0xae65('0xa')](),controller['clone']);router[_0xae65('0x11')]('/:id/sections',auth[_0xae65('0xa')](),controller[_0xae65('0x13')]);router['post'](_0xae65('0x14'),auth[_0xae65('0xa')](),controller[_0xae65('0x15')]);router['put'](_0xae65('0xc'),auth[_0xae65('0xa')](),controller['update']);router[_0xae65('0x16')](_0xae65('0xc'),auth[_0xae65('0xa')](),controller[_0xae65('0x17')]);router[_0xae65('0x16')](_0xae65('0xe'),auth[_0xae65('0xa')](),controller['removeSections']);router['delete'](_0xae65('0x14'),auth['isAuthenticated'](),controller[_0xae65('0x18')]);module[_0xae65('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index defb3a7..1928d17 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 _0x7e6a=['join','getDataValue','crudPermissions','split','sequelize','exports','STRING','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e6a,0xac));var _0xa7e6=function(_0x349bfb,_0x4aaa4a){_0x349bfb=_0x349bfb-0x0;var _0x34a7cc=_0x7e6a[_0x349bfb];return _0x34a7cc;};'use strict';var Sequelize=require(_0xa7e6('0x0'));module[_0xa7e6('0x1')]={'name':{'type':Sequelize[_0xa7e6('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xa7e6('0x2')],'set':function(_0x158a99){this[_0xa7e6('0x3')]('crudPermissions',_0x158a99?_0x158a99[_0xa7e6('0x4')](''):[]);},'get':function(){return this[_0xa7e6('0x5')](_0xa7e6('0x6'))?this[_0xa7e6('0x5')](_0xa7e6('0x6'))[_0xa7e6('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x95e6=['join','STRING','setDataValue','crudPermissions'];(function(_0x38acbc,_0x4ee75e){var _0x892de1=function(_0xc639ff){while(--_0xc639ff){_0x38acbc['push'](_0x38acbc['shift']());}};_0x892de1(++_0x4ee75e);}(_0x95e6,0x6d));var _0x695e=function(_0x48c857,_0x1864d0){_0x48c857=_0x48c857-0x0;var _0x4cdfe5=_0x95e6[_0x48c857];return _0x4cdfe5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x695e('0x0')],'set':function(_0x2aa3e3){this[_0x695e('0x1')](_0x695e('0x2'),_0x2aa3e3?_0x2aa3e3[_0x695e('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x695e('0x2'))?this['getDataValue'](_0x695e('0x2'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x695e('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 91b596e..d22cd93 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 _0xf780=['error','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','keys','options','find','catch','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','userProfileId','Resources','destroy','describe','transaction','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','childModel','Invalid\x20section\x20\x27','parentSections','all','union','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','custom','reportId','color','Tag','tag','value','toLowerCase','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','ListId','lists','companies','globalcustomfields','CmCustomField','chatwebsites','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','Telephones','User','role','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','scheduler','Schedule','sounds','Sound','templates','Trigger','trunks','Variable','plugins','extractedreports','metrics','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','localhost','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x21d88d,_0x4ff19c){var _0x30a579=function(_0x24cf7a){while(--_0x24cf7a){_0x21d88d['push'](_0x21d88d['shift']());}};_0x30a579(++_0x4ff19c);}(_0xf780,0xb0));var _0x0f78=function(_0x2acf18,_0x469d00){_0x2acf18=_0x2acf18-0x0;var _0x170f5c=_0xf780[_0x2acf18];return _0x170f5c;};'use strict';var pdf=require(_0x0f78('0x0'));var emlformat=require(_0x0f78('0x1'));var rimraf=require(_0x0f78('0x2'));var zipdir=require(_0x0f78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f78('0x4'));var moment=require(_0x0f78('0x5'));var BPromise=require(_0x0f78('0x6'));var Mustache=require('mustache');var util=require(_0x0f78('0x7'));var path=require(_0x0f78('0x8'));var sox=require(_0x0f78('0x9'));var csv=require(_0x0f78('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f78('0xb'));var squel=require(_0x0f78('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f78('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f78('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f78('0xf'));var authService=require(_0x0f78('0x10'));var qs=require(_0x0f78('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f78('0x12'));var logger=require('../../config/logger')(_0x0f78('0x13'));var utils=require(_0x0f78('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0f78('0x15')]=_['defaults'](config['redis'],{'host':_0x0f78('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f78('0x17'))[_0x0f78('0x18')](socket);function respondWithStatusCode(_0x48ffb2,_0x50802a){_0x50802a=_0x50802a||0xcc;return function(_0x2bbd25){if(_0x2bbd25){return _0x48ffb2[_0x0f78('0x19')](_0x50802a);}return _0x48ffb2[_0x0f78('0x1a')](_0x50802a)[_0x0f78('0x1b')]();};}function respondWithResult(_0xa347fe,_0x294dfe){_0x294dfe=_0x294dfe||0xc8;return function(_0x47581a){if(_0x47581a){return _0xa347fe['status'](_0x294dfe)[_0x0f78('0x1c')](_0x47581a);}};}function respondWithFilteredResult(_0xbad747,_0xaabfd7){return function(_0x22bb9f){if(_0x22bb9f){var _0x332daf=_0x22bb9f[_0x0f78('0x1d')],_0x29f9a4=_0xaabfd7[_0x0f78('0x1e')],_0xec9586=_0xaabfd7[_0x0f78('0x1e')]+_0xaabfd7[_0x0f78('0x1f')],_0x132d35;if(_0xec9586>=_0x332daf){_0xec9586=_0x332daf;_0x132d35=0xc8;}else{_0x132d35=0xce;}_0xbad747[_0x0f78('0x1a')](_0x132d35);return _0xbad747[_0x0f78('0x20')](_0x0f78('0x21'),_0x29f9a4+'-'+_0xec9586+'/'+_0x332daf)['json'](_0x22bb9f);}return null;};}function patchUpdates(_0x17cbfd){return function(_0x538fa0){try{jsonpatch[_0x0f78('0x22')](_0x538fa0,_0x17cbfd,!![]);}catch(_0x52d9a2){return BPromise[_0x0f78('0x23')](_0x52d9a2);}return _0x538fa0[_0x0f78('0x24')]();};}function saveUpdates(_0x5ec69f,_0x4fd819){return function(_0x8badcf){if(_0x8badcf){return _0x8badcf[_0x0f78('0x25')](_0x5ec69f)[_0x0f78('0x26')](function(_0xc3f3b7){return _0xc3f3b7;});}return null;};}function removeEntity(_0xb276ab,_0x2eb584){return function(_0x5d155e){if(_0x5d155e){return _0x5d155e['destroy']()[_0x0f78('0x26')](function(){_0xb276ab[_0x0f78('0x1a')](0xcc)[_0x0f78('0x1b')]();});}};}function handleEntityNotFound(_0xbf75a,_0x236b38){return function(_0x7009d9){if(!_0x7009d9){_0xbf75a[_0x0f78('0x19')](0x194);}return _0x7009d9;};}function handleError(_0x287e6a,_0x7b2bbb){_0x7b2bbb=_0x7b2bbb||0x1f4;return function(_0x35d463){logger[_0x0f78('0x27')](_0x35d463[_0x0f78('0x28')]);if(_0x35d463[_0x0f78('0x29')]){delete _0x35d463[_0x0f78('0x29')];}_0x287e6a[_0x0f78('0x1a')](_0x7b2bbb)[_0x0f78('0x2a')](_0x35d463);};}exports[_0x0f78('0x2b')]=function(_0x1d54f5,_0xbf09d5){var _0x182c0b={},_0x345476={},_0x7fa311={'count':0x0,'rows':[]};var _0x4f355b=_['map'](db[_0x0f78('0x2c')][_0x0f78('0x2d')],function(_0x4f202b){return{'name':_0x4f202b[_0x0f78('0x2e')],'type':_0x4f202b[_0x0f78('0x2f')][_0x0f78('0x30')]};});_0x345476[_0x0f78('0x31')]=_[_0x0f78('0x32')](_0x4f355b,_0x0f78('0x29'));_0x345476[_0x0f78('0x33')]=_['keys'](_0x1d54f5[_0x0f78('0x33')]);_0x345476[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0x345476[_0x0f78('0x31')],_0x345476['query']);_0x182c0b[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0x345476[_0x0f78('0x31')],qs[_0x0f78('0x37')](_0x1d54f5['query'][_0x0f78('0x37')]));_0x182c0b[_0x0f78('0x36')]=_0x182c0b[_0x0f78('0x36')][_0x0f78('0x38')]?_0x182c0b['attributes']:_0x345476[_0x0f78('0x31')];if(!_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x39')](_0x0f78('0x3a'))){_0x182c0b['limit']=qs[_0x0f78('0x1f')](_0x1d54f5['query']['limit']);_0x182c0b[_0x0f78('0x1e')]=qs[_0x0f78('0x1e')](_0x1d54f5[_0x0f78('0x33')]['offset']);}_0x182c0b['order']=qs[_0x0f78('0x3b')](_0x1d54f5['query'][_0x0f78('0x3b')]);_0x182c0b['where']=qs['filters'](_[_0x0f78('0x3c')](_0x1d54f5['query'],_0x345476['filters']),_0x4f355b);if(_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x3d')]){_0x182c0b[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x182c0b['where'],{'$or':_[_0x0f78('0x32')](_0x4f355b,function(_0x17876a){if(_0x17876a[_0x0f78('0x2f')]!==_0x0f78('0x40')){var _0x475246={};_0x475246[_0x17876a['name']]={'$like':'%'+_0x1d54f5['query'][_0x0f78('0x3d')]+'%'};return _0x475246;}})});}_0x182c0b=_[_0x0f78('0x3f')]({},_0x182c0b,_0x1d54f5['options']);var _0x20a352={'where':_0x182c0b['where']};return db[_0x0f78('0x2c')][_0x0f78('0x1d')](_0x20a352)[_0x0f78('0x26')](function(_0x18de6c){_0x7fa311[_0x0f78('0x1d')]=_0x18de6c;if(_0x1d54f5[_0x0f78('0x33')][_0x0f78('0x41')]){_0x182c0b[_0x0f78('0x42')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x182c0b);})[_0x0f78('0x26')](function(_0x5ad795){_0x7fa311[_0x0f78('0x43')]=_0x5ad795;return _0x7fa311;})[_0x0f78('0x26')](respondWithFilteredResult(_0xbf09d5,_0x182c0b))['catch'](handleError(_0xbf09d5,null));};exports[_0x0f78('0x44')]=function(_0x432c28,_0x1b9ea4){var _0x16a4db={'raw':![],'where':{'id':_0x432c28['params']['id']}},_0x46d466={};_0x46d466[_0x0f78('0x31')]=_[_0x0f78('0x45')](db[_0x0f78('0x2c')][_0x0f78('0x2d')]);_0x46d466[_0x0f78('0x33')]=_[_0x0f78('0x45')](_0x432c28[_0x0f78('0x33')]);_0x46d466[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0x46d466['model'],_0x46d466[_0x0f78('0x33')]);_0x16a4db['attributes']=_[_0x0f78('0x35')](_0x46d466[_0x0f78('0x31')],qs[_0x0f78('0x37')](_0x432c28[_0x0f78('0x33')]['fields']));_0x16a4db[_0x0f78('0x36')]=_0x16a4db[_0x0f78('0x36')][_0x0f78('0x38')]?_0x16a4db[_0x0f78('0x36')]:_0x46d466[_0x0f78('0x31')];if(_0x432c28['query'][_0x0f78('0x41')]){_0x16a4db[_0x0f78('0x42')]=[{'all':!![]}];}_0x16a4db=_[_0x0f78('0x3f')]({},_0x16a4db,_0x432c28[_0x0f78('0x46')]);return db[_0x0f78('0x2c')][_0x0f78('0x47')](_0x16a4db)[_0x0f78('0x26')](handleEntityNotFound(_0x1b9ea4,null))[_0x0f78('0x26')](respondWithResult(_0x1b9ea4,null))[_0x0f78('0x48')](handleError(_0x1b9ea4,null));};exports['create']=function(_0x1cff53,_0x1d341){return db[_0x0f78('0x2c')][_0x0f78('0x49')](_0x1cff53[_0x0f78('0x4a')],{})[_0x0f78('0x26')](respondWithResult(_0x1d341,0xc9))['catch'](handleError(_0x1d341,null));};exports[_0x0f78('0x4b')]=function(_0x5ed952,_0x2760e8){var _0x48add1={'where':{'id':_0x5ed952[_0x0f78('0x4c')]['id']}},_0x564d5c={};_0x564d5c[_0x0f78('0x31')]=_[_0x0f78('0x45')](db[_0x0f78('0x2c')][_0x0f78('0x2d')]);_0x48add1[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0x564d5c['model'],qs['fields'](_0x5ed952[_0x0f78('0x33')]['fields']));_0x48add1[_0x0f78('0x36')]=_0x48add1[_0x0f78('0x36')]['length']?_0x48add1[_0x0f78('0x36')]:_0x564d5c['model'];if(_0x5ed952[_0x0f78('0x33')][_0x0f78('0x41')]){_0x48add1['include']=[{'all':!![]}];}_0x48add1=_[_0x0f78('0x3f')]({},_0x48add1,_0x5ed952[_0x0f78('0x46')]);return db['UserProfile'][_0x0f78('0x47')](_0x48add1)[_0x0f78('0x26')](handleEntityNotFound(_0x2760e8,null))[_0x0f78('0x26')](function(_0x4e922b){if(_0x4e922b){var _0x39e436=_0x4e922b[_0x0f78('0x4d')]({'plain':!![]});_0x39e436=qs[_0x0f78('0x4e')](_0x39e436,['id',_0x0f78('0x4f'),_0x0f78('0x50'),_0x0f78('0x51')]);_0x5ed952['body']=_[_0x0f78('0x4e')](_0x5ed952[_0x0f78('0x4a')],['id','createdAt','updatedAt']);return db[_0x0f78('0x52')]['transaction'](function(_0x329d63){return db[_0x0f78('0x2c')][_0x0f78('0x49')](_[_0x0f78('0x3f')](_0x39e436,_0x5ed952[_0x0f78('0x4a')]),{'include':_0x5ed952[_0x0f78('0x33')][_0x0f78('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x329d63})[_0x0f78('0x26')](function(_0x92e46e){var _0x3fd410=_0x92e46e[_0x0f78('0x4d')]({'plain':!![]});return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x5ed952['params']['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x12a51f){if(_0x12a51f){return BPromise[_0x0f78('0x55')](_0x12a51f,function(_0x581cfc){return new BPromise(function(_0x1d6fe2,_0x48ef37){if(_0x581cfc[_0x0f78('0x56')]===null||_0x581cfc[_0x0f78('0x56')]===0x1)_0x1d6fe2(null);return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x581cfc['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x2bbc7b){var _0x250aa7=_[_0x0f78('0x32')](_0x2bbc7b,function(_0x433082){return qs[_0x0f78('0x4e')](_0x433082,['id',_0x0f78('0x4f'),'updatedAt','sectionId']);});_0x1d6fe2(_0x250aa7);})[_0x0f78('0x48')](function(_0x53dfdf){_0x48ef37(_0x53dfdf);});})[_0x0f78('0x26')](function(_0x331a4d){var _0x95f73c=qs['omit'](_0x581cfc,['id',_0x0f78('0x4f'),_0x0f78('0x50')]);_0x95f73c[_0x0f78('0x58')]=_0x3fd410['id'];if(_0x331a4d)_0x95f73c[_0x0f78('0x59')]=_0x331a4d;return _0x95f73c;})['then'](function(_0x1e597c){return db[_0x0f78('0x53')]['create'](_0x1e597c,{'include':[{'model':db[_0x0f78('0x57')],'as':_0x0f78('0x59')}],'raw':!![],'transaction':_0x329d63});});})['then'](function(){return _0x3fd410;});}});});});}})[_0x0f78('0x26')](respondWithResult(_0x2760e8,0xc9))[_0x0f78('0x48')](handleError(_0x2760e8,null));};exports[_0x0f78('0x25')]=function(_0x4f7b30,_0x2f3ba5){if(_0x4f7b30[_0x0f78('0x4a')]['id']){delete _0x4f7b30[_0x0f78('0x4a')]['id'];}return db[_0x0f78('0x2c')]['find']({'where':{'id':_0x4f7b30[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x2f3ba5,null))[_0x0f78('0x26')](saveUpdates(_0x4f7b30[_0x0f78('0x4a')],null))[_0x0f78('0x26')](respondWithResult(_0x2f3ba5,null))[_0x0f78('0x48')](handleError(_0x2f3ba5,null));};exports[_0x0f78('0x5a')]=function(_0x405a5e,_0x3f9f9f){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x405a5e['params']['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x3f9f9f,null))[_0x0f78('0x26')](removeEntity(_0x3f9f9f,null))[_0x0f78('0x48')](handleError(_0x3f9f9f,null));};exports[_0x0f78('0x5b')]=function(_0x253a9e,_0x3ac14b){return db['UserProfile'][_0x0f78('0x5b')]()['then'](respondWithResult(_0x3ac14b,null))[_0x0f78('0x48')](handleError(_0x3ac14b,null));};exports['addSections']=function(_0x309565,_0x1a2513){var _0x27a1a7=_0x309565[_0x0f78('0x4a')];return db['UserProfile'][_0x0f78('0x47')]({'where':{'id':_0x309565['params']['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x1a2513,null))['then'](function(_0x59fb82){if(_0x59fb82){return db[_0x0f78('0x52')][_0x0f78('0x5c')](function(_0x3ee1cb){return db[_0x0f78('0x53')]['destroy']({'where':{'userProfileId':_0x309565[_0x0f78('0x4c')]['id'],'sectionId':_[_0x0f78('0x32')](_0x27a1a7,function(_0x27038e){return _0x27038e[_0x0f78('0x5d')];})},'transaction':_0x3ee1cb})[_0x0f78('0x26')](function(){var _0x3d454a=_[_0x0f78('0x32')](_0x27a1a7,function(_0x1ec5fa){_0x1ec5fa[_0x0f78('0x58')]=_0x309565[_0x0f78('0x4c')]['id'];return _0x1ec5fa;});var _0x2b31da=[];return BPromise[_0x0f78('0x55')](_0x3d454a,function(_0x15f71b){return db[_0x0f78('0x53')][_0x0f78('0x49')](_0x15f71b,{'include':[{'model':db[_0x0f78('0x57')],'as':_0x0f78('0x59')}],'raw':!![],'transaction':_0x3ee1cb})[_0x0f78('0x26')](function(_0x16dbeb){_0x2b31da[_0x0f78('0x5e')](_0x16dbeb[_0x0f78('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x2b31da;});});});}})['then'](function(_0x17897e){return _0x17897e;})[_0x0f78('0x26')](respondWithResult(_0x1a2513,null))[_0x0f78('0x48')](handleError(_0x1a2513,null));};exports[_0x0f78('0x5f')]=function(_0x28d414,_0x58680f){var _0x515e2d;return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x28d414[_0x0f78('0x4c')]['id']},'attributes':['id','name']})[_0x0f78('0x26')](handleEntityNotFound(_0x58680f,null))['then'](function(_0x423dd2){if(_0x423dd2){_0x515e2d=_0x423dd2;return db['UserProfileSection'][_0x0f78('0x5a')]({'where':{'userProfileId':_0x28d414['params']['id'],'sectionId':_0x28d414[_0x0f78('0x33')][_0x0f78('0x60')]}});}})[_0x0f78('0x26')](function(){return _0x515e2d;})[_0x0f78('0x26')](respondWithStatusCode(_0x58680f,null))['catch'](handleError(_0x58680f,null));};exports[_0x0f78('0x61')]=function(_0x1fb96b,_0xb499b1){var _0x1f82da=[];var _0x22ac58=[];return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x1fb96b[_0x0f78('0x4c')]['id']},'raw':!![]})['then'](function(_0x3617a7){_0x1f82da=_[_0x0f78('0x3d')](_0x3617a7,function(_0x5cf06f){return _0x5cf06f[_0x0f78('0x62')]===0x1||_[_0x0f78('0x63')]([0x3eb,0x709],_0x5cf06f[_0x0f78('0x5d')]);});if(!_[_0x0f78('0x64')](_0x1f82da)){return _['map'](_0x1f82da,function(_0x26dee7){return _0x26dee7['sectionId'];});}else{return;}})['then'](function(_0x34a8c3){if(_0x34a8c3)_0x22ac58=_0x34a8c3;if(_[_0x0f78('0x63')](_0x22ac58,0x64)){var _0x4fa745=_[_0x0f78('0x47')](_0x1f82da,{'sectionId':0x64});return hasDefaultDashboard(_0x4fa745)[_0x0f78('0x26')](function(_0xbe1137){return _[_0x0f78('0x32')](_0x1f82da,function(_0x5e1619){if(_0x5e1619[_0x0f78('0x5d')]===0x64){_0x5e1619[_0x0f78('0x65')]=_0xbe1137;}return _0x5e1619;});});}else{return;}})['then'](function(_0x495db8){if(_0x495db8)_0x1f82da=_0x495db8;if(_[_0x0f78('0x63')](_0x22ac58,0x3eb)){var _0x4219a1=_['find'](_0x1f82da,{'sectionId':0x3eb});return getCustomDashboards(_0x4219a1)['then'](function(_0xcac9af){return _['map'](_0x1f82da,function(_0xa9e277){if(_0x4219a1[_0x0f78('0x62')]){if(_0xa9e277[_0x0f78('0x5d')]===0x3eb){_0xa9e277[_0x0f78('0x65')]=_0xcac9af;}}else{if(_0xa9e277[_0x0f78('0x5d')]===0x64){_0xa9e277[_0x0f78('0x65')]=_0xcac9af;}}return _0xa9e277;});});}else{return;}})[_0x0f78('0x26')](function(_0x4cdba5){if(_0x4cdba5)_0x1f82da=_0x4cdba5;if(_[_0x0f78('0x63')](_0x22ac58,0x709)){var _0x535ece=_[_0x0f78('0x47')](_0x1f82da,{'sectionId':0x709});return getPlugins(_0x535ece)[_0x0f78('0x26')](function(_0x22149d){if(_0x535ece[_0x0f78('0x62')]){return _[_0x0f78('0x32')](_0x1f82da,function(_0x498b8f){if(_0x498b8f[_0x0f78('0x5d')]===0x709){_0x498b8f[_0x0f78('0x65')]=_0x22149d;}return _0x498b8f;});}else{var _0x48da2d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x22149d};var _0x18fe55=_[_0x0f78('0x32')](_0x1f82da);_0x18fe55['push'](_0x48da2d);return _0x18fe55;}});}else{return;}})[_0x0f78('0x26')](function(_0xedfb79){if(_0xedfb79)_0x1f82da=_0xedfb79;return _[_0x0f78('0x3d')](_0x1f82da,[_0x0f78('0x62'),0x1]);})[_0x0f78('0x26')](respondWithResult(_0xb499b1,null))[_0x0f78('0x48')](handleError(_0xb499b1,null));};function hasDefaultDashboard(_0x374983){var _0x21603a=[0x65];return new BPromise(function(_0x5d8c00,_0x1210d4){try{if(_0x374983[_0x0f78('0x56')]){_0x5d8c00(_0x21603a);}else{return db[_0x0f78('0x57')][_0x0f78('0x66')]({'where':{'sectionId':_0x374983['id']},'raw':!![]})['then'](function(_0x1d405e){_0x1d405e?_0x5d8c00(_0x21603a):_0x5d8c00();});}}catch(_0x3c519a){_0x1210d4(_0x3c519a);}});}function getCustomDashboards(_0x3604d3){var _0x5165c4=[];return new BPromise(function(_0x5b8281,_0x5d1178){try{if(_0x3604d3[_0x0f78('0x56')]){return db[_0x0f78('0x67')]['findAll']({'raw':!![]})[_0x0f78('0x26')](function(_0x1f1581){_0x1f1581['forEach'](function(_0x5da3d8){_0x5165c4['push'](_0x5da3d8['id']+0x1869f);});_0x5b8281(_0x5165c4);});}else{return db[_0x0f78('0x57')]['findAll']({'where':{'sectionId':_0x3604d3['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x62853a){_0x62853a[_0x0f78('0x68')](function(_0x2d93c6){_0x5165c4[_0x0f78('0x5e')](_0x2d93c6[_0x0f78('0x69')]+0x1869f);});_0x5b8281(_0x5165c4);});}}catch(_0x24e4b9){_0x5d1178(_0x24e4b9);}});}function getPlugins(_0x2f57e6){var _0x15bfec=[];return new BPromise(function(_0x11ec70,_0x2c658c){try{if(_0x2f57e6['autoAssociation']){return db[_0x0f78('0x6a')][_0x0f78('0x54')]({'raw':!![]})[_0x0f78('0x26')](function(_0x5041e8){_0x5041e8[_0x0f78('0x68')](function(_0x226c26){_0x15bfec[_0x0f78('0x5e')](_0x226c26['id']+0x15b38);});_0x11ec70(_0x15bfec);});}else{return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x2f57e6['id']},'raw':!![]})[_0x0f78('0x26')](function(_0x2c7634){_0x2c7634[_0x0f78('0x68')](function(_0x58f97b){_0x15bfec[_0x0f78('0x5e')](_0x58f97b[_0x0f78('0x69')]+0x15b38);});_0x11ec70(_0x15bfec);});}}catch(_0x4d443c){_0x2c658c(_0x4d443c);}});}exports[_0x0f78('0x6b')]=function(_0x65f21e,_0x2b5c22){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x65f21e[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x2b5c22,null))['then'](function(_0x4b950a){if(_0x4b950a){return db[_0x0f78('0x52')][_0x0f78('0x5c')](function(_0xca9248){return db[_0x0f78('0x53')][_0x0f78('0x54')]({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x0f78('0x26')](function(_0x5d8a2c){if(_0x5d8a2c){return db[_0x0f78('0x53')][_0x0f78('0x5a')]({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id'],'id':_[_0x0f78('0x32')](_0x5d8a2c,function(_0x5e04b0){return _0x5e04b0['id'];})},'transaction':_0xca9248});}})['then'](function(_0x1a1c71){var _0x320721=_[_0x0f78('0x32')](_0x65f21e[_0x0f78('0x4a')],function(_0x2c0120){_0x2c0120[_0x0f78('0x58')]=_0x65f21e[_0x0f78('0x4c')]['id'];return _0x2c0120;});return db['UserProfileSection'][_0x0f78('0x6c')](_0x320721,{'raw':!![],'transaction':_0xca9248});})['then'](function(_0x2a1314){var _0xe5bd6a=_[_0x0f78('0x3d')](_[_0x0f78('0x32')](_0x2a1314,function(_0x292178){return _0x292178[_0x0f78('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0xe5bd6a){return db[_0x0f78('0x53')]['findAll']({'where':{'userProfileId':_0x65f21e[_0x0f78('0x4c')]['id'],'sectionId':_[_0x0f78('0x32')](_0xe5bd6a,function(_0xf16bf7){return _0xf16bf7[_0x0f78('0x5d')];})},'attributes':['id',_0x0f78('0x5d')],'raw':!![]})['then'](function(_0x321b2d){var _0x4ae048=_[_0x0f78('0x32')](_0x65f21e[_0x0f78('0x4a')],function(_0x34bd76){_0x34bd76[_0x0f78('0x58')]=_0x65f21e[_0x0f78('0x4c')]['id'];return _0x34bd76;});return db['UserProfileResource'][_0x0f78('0x6c')](_0x4ae048,{'raw':!![],'transaction':_0xca9248});});}})[_0x0f78('0x48')](handleError(_0x2b5c22,null));});}})[_0x0f78('0x26')](function(_0xe33289){var _0x4788d8=_[_0x0f78('0x32')](_0xe33289,function(_0x2279cd){return _0x2279cd['get']({'plain':!![]});});})['then'](respondWithResult(_0x2b5c22,null))[_0x0f78('0x48')](handleError(_0x2b5c22,null));};exports['removeResources']=function(_0x193418,_0x23a064,_0x4f2333){return db[_0x0f78('0x2c')][_0x0f78('0x47')]({'where':{'id':_0x193418[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x23a064,null))[_0x0f78('0x26')](function(_0x588bd3){if(_0x588bd3){return _0x588bd3[_0x0f78('0x6d')](_0x193418[_0x0f78('0x33')][_0x0f78('0x60')]);}})[_0x0f78('0x26')](respondWithStatusCode(_0x23a064,null))[_0x0f78('0x48')](handleError(_0x23a064,null));};exports['getResources']=function(_0x4d32de,_0x200df2){var _0x51b7c1={'raw':![],'where':{}};var _0xa5234b={};var _0x1b7ee3={'count':0x0,'rows':[]};var _0x45151c=_0x4d32de[_0x0f78('0x33')][_0x0f78('0x6e')];if(typeof _0x45151c===_0x0f78('0x6f')){throw new db[(_0x0f78('0x70'))][(_0x0f78('0x71'))]('Unknown\x20section');}var _0x147b63=_0x4d32de[_0x0f78('0x33')]['mergeResources']||![];var _0x25f1cd=getQueryModels(_0x45151c,_0x147b63);if(typeof _0x25f1cd[_0x0f78('0x72')]===_0x0f78('0x6f')){throw new db[(_0x0f78('0x70'))][(_0x0f78('0x71'))](_0x0f78('0x73')+_0x45151c+'\x27');}var _0x1e4579=[];if(!_[_0x0f78('0x64')](_0x25f1cd[_0x0f78('0x74')])){_0x1e4579=_0x25f1cd['parentSections'];}else{_0x1e4579=[{'name':_0x45151c}];}return db[_0x0f78('0x2c')]['findOne']({'where':{'id':_0x4d32de[_0x0f78('0x4c')]['id']}})[_0x0f78('0x26')](handleEntityNotFound(_0x200df2,null))['then'](function(_0xb75faa){if(_0xb75faa){var _0x1faea1=[];for(var _0x4b05b8=0x0;_0x4b05b8<_0x1e4579[_0x0f78('0x38')];_0x4b05b8++){_0x1faea1['push'](db[_0x0f78('0x53')][_0x0f78('0x66')]({'where':{'userProfileId':_0xb75faa['id'],'name':_0x1e4579[_0x4b05b8][_0x0f78('0x29')]},'raw':!![]}));}return BPromise[_0x0f78('0x75')](_0x1faea1);}})['then'](function(_0x4c79e8){var _0x507e7a=_[_0x0f78('0x3d')](_0x4c79e8,function(_0x5e51a9){return _0x5e51a9?_0x5e51a9:undefined;});var _0x4e0cf5=_['filter'](_0x1e4579,['ignore',!![]]);var _0x26c85b=_[_0x0f78('0x64')](_0x507e7a)&&_[_0x0f78('0x64')](_0x4e0cf5)?null:_[_0x0f78('0x76')](_0x4e0cf5,_0x507e7a);if(_0x26c85b){var _0x58005b=[];for(var _0x15c311=0x0;_0x15c311<_0x26c85b[_0x0f78('0x38')];_0x15c311++){var _0x394466=_[_0x0f78('0x47')](_0x1e4579,function(_0x1e6962){return _0x26c85b[_0x15c311]?_0x1e6962['name']===_0x26c85b[_0x15c311][_0x0f78('0x29')]:null;});if(_0x394466){if(_0x26c85b[_0x15c311]['ignore']){_0x58005b[_0x0f78('0x5e')](getAllResources(_0x25f1cd[_0x0f78('0x72')],_0x26c85b[_0x15c311]));}else{if(!_0x26c85b[_0x15c311][_0x0f78('0x56')]){_0x58005b[_0x0f78('0x5e')](getAllowedResources(_0x394466,_0x26c85b[_0x15c311],_0x25f1cd['childModel']));}else{if(_0x394466[_0x0f78('0x31')]){_0x58005b[_0x0f78('0x5e')](getAllFilteredResources(_0x394466,_0x26c85b[_0x15c311]));}}}}}return BPromise[_0x0f78('0x75')](_0x58005b);}else{return null;}})[_0x0f78('0x26')](function(_0x3b9d00){var _0x4f4fb9=_0x3b9d00;var _0x22419a=null;if(_0x4f4fb9){_0x22419a=_0x4f4fb9[_0x0f78('0x38')]===0x1?_0x4f4fb9[0x0]:null;}if(_0x22419a||_0x4f4fb9){var _0x203293=db[_0x25f1cd[_0x0f78('0x72')]]['rawAttributes'];_0xa5234b[_0x0f78('0x31')]=_[_0x0f78('0x45')](_0x203293);_0xa5234b[_0x0f78('0x33')]=_[_0x0f78('0x45')](_0x4d32de['query']);_0xa5234b[_0x0f78('0x34')]=_[_0x0f78('0x35')](_0xa5234b[_0x0f78('0x31')],_0xa5234b['query']);_0x51b7c1[_0x0f78('0x36')]=_[_0x0f78('0x35')](_0xa5234b[_0x0f78('0x31')],qs['fields'](_0x4d32de[_0x0f78('0x33')][_0x0f78('0x37')]));_0x51b7c1[_0x0f78('0x36')]=_0x51b7c1[_0x0f78('0x36')][_0x0f78('0x38')]?_0x51b7c1['attributes']:_0xa5234b[_0x0f78('0x31')];if(!_0x4d32de['query'][_0x0f78('0x39')]('nolimit')){_0x51b7c1[_0x0f78('0x1f')]=qs['limit'](_0x4d32de['query']['limit']);_0x51b7c1['offset']=qs[_0x0f78('0x1e')](_0x4d32de['query'][_0x0f78('0x1e')]);}_0x51b7c1['order']=qs['sort'](_0x4d32de[_0x0f78('0x33')][_0x0f78('0x3b')]);_0x51b7c1[_0x0f78('0x3e')]=qs['filters'](_[_0x0f78('0x3c')](_0x4d32de[_0x0f78('0x33')],_0xa5234b[_0x0f78('0x34')]));if(_0x4d32de[_0x0f78('0x33')]['filter']){_0x51b7c1[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x51b7c1['where'],{'$or':_[_0x0f78('0x32')](_0x203293,function(_0x5b3604){if(_0x5b3604[_0x0f78('0x2f')][_0x0f78('0x30')]!==_0x0f78('0x40')){var _0x3aed7f={};_0x3aed7f[_0x5b3604[_0x0f78('0x77')]]={'$like':'%'+_0x4d32de[_0x0f78('0x33')][_0x0f78('0x3d')]+'%'};return _0x3aed7f;}})});}var _0x25f5d2=[];if(_0x22419a){var _0x291f51=_[_0x0f78('0x47')](_0x1e4579,['name',_0x22419a['name']]);if(_0x291f51[_0x0f78('0x77')]){var _0x509afa={};if(_0x25f1cd['childModel']===_0x0f78('0x78')){_0x509afa[_0x291f51[_0x0f78('0x79')]]=_['map'](_0x22419a[_0x0f78('0x7a')],'id');}else{_0x509afa[_0x291f51['foreignKey']]=_0x22419a[_0x0f78('0x7a')];}_0x25f5d2[_0x0f78('0x5e')](_0x509afa);}else{_0x51b7c1[_0x0f78('0x3e')]['id']=_0x22419a['associatedResources'];}}else{for(var _0x4bc60e=0x0;_0x4bc60e<_0x4f4fb9[_0x0f78('0x38')];_0x4bc60e++){var _0x291f51=_[_0x0f78('0x47')](_0x1e4579,[_0x0f78('0x29'),_0x4f4fb9[_0x4bc60e]['name']]);if(_0x291f51[_0x0f78('0x77')]){var _0x509afa={};_0x509afa[_0x291f51['foreignKey']]=_0x4f4fb9[_0x4bc60e]['associatedResources'];_0x25f5d2[_0x0f78('0x5e')](_0x509afa);}else{if(!_0x51b7c1['where']['id'])_0x51b7c1[_0x0f78('0x3e')]['id']=[];_0x4f4fb9[_0x4bc60e][_0x0f78('0x7a')][_0x0f78('0x68')](function(_0x1f2ce7){_0x51b7c1[_0x0f78('0x3e')]['id']['push'](_0x1f2ce7);});}}}if(!_[_0x0f78('0x64')](_0x25f5d2)){_0x51b7c1[_0x0f78('0x3e')]=_[_0x0f78('0x3f')](_0x51b7c1['where'],{'$and':{'$or':_0x25f5d2}});}_0x51b7c1=_[_0x0f78('0x3f')]({},_0x51b7c1,_0x4d32de[_0x0f78('0x46')]);if(_0x22419a&&!_0x22419a[_0x0f78('0x56')]&&_0x25f1cd[_0x0f78('0x72')]===_0x0f78('0x78')){if(_0x4d32de['query'][_0x0f78('0x41')]){_0x51b7c1[_0x0f78('0x42')]=[{'all':!![]}];}return db[_0x25f1cd['childModel']]['findAll'](_0x51b7c1)[_0x0f78('0x26')](function(_0x84613f){var _0x5a21f3=[];_0x84613f[_0x0f78('0x68')](function(_0x5334d5){var _0x9fcd3f;switch(_0x5334d5[_0x0f78('0x7b')]){case _0x0f78('0x7c'):_0x9fcd3f=_[_0x0f78('0x47')](_0x22419a['associatedResources'],function(_0x3072cd){return _0x3072cd['id']===_0x5334d5['reportId']&&_0x3072cd['type']===_0x0f78('0x7d');});break;case _0x0f78('0x7e'):_0x9fcd3f=_[_0x0f78('0x47')](_0x22419a['associatedResources'],function(_0x3cd35c){return _0x3cd35c['id']===_0x5334d5[_0x0f78('0x7f')]&&_0x3cd35c[_0x0f78('0x2f')]==='CustomReports';});break;}if(_0x9fcd3f)_0x5a21f3['push'](_0x5334d5);});_0x1b7ee3['count']=_0x5a21f3[_0x0f78('0x38')];_0x1b7ee3[_0x0f78('0x43')]=_0x5a21f3;return _0x1b7ee3;});}else{return db[_0x25f1cd[_0x0f78('0x72')]][_0x0f78('0x1d')]({'where':_0x51b7c1[_0x0f78('0x3e')]})[_0x0f78('0x26')](function(_0x190f0b){_0x1b7ee3['count']=_0x190f0b;if(_0x4d32de[_0x0f78('0x33')][_0x0f78('0x41')]){if(_0x25f1cd[_0x0f78('0x72')]==='CmContact'){_0x51b7c1[_0x0f78('0x42')]=[{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0f78('0x29'),_0x0f78('0x80')],'required':_0x4d32de['query']['tag']?!![]:![]},{'model':db[_0x0f78('0x81')],'as':'ThroughTags','attributes':['id',_0x0f78('0x29'),_0x0f78('0x80')],'through':_0x4d32de[_0x0f78('0x33')][_0x0f78('0x82')]?{'attributes':[],'where':{'TagId':_0x4d32de[_0x0f78('0x33')]['tag']||undefined}}:{},'required':_0x4d32de[_0x0f78('0x33')][_0x0f78('0x82')]?!![]:![]}];}else{_0x51b7c1['include']=[{'all':!![]}];}}return db[_0x25f1cd[_0x0f78('0x72')]]['findAll'](_0x51b7c1);})[_0x0f78('0x26')](function(_0x126bf2){_0x1b7ee3[_0x0f78('0x43')]=_0x126bf2;return _0x1b7ee3;});}}else{return _0x1b7ee3;}})[_0x0f78('0x26')](respondWithFilteredResult(_0x200df2,_0x51b7c1))['catch'](handleError(_0x200df2,null));};function getAllResources(_0x6db650,_0xe4278c){return new BPromise(function(_0x162713,_0x5ce343){if(_0xe4278c){var _0xcf7ba7=_0xe4278c[_0x0f78('0x3d')]?{[_0xe4278c['filter'][_0x0f78('0x77')]]:_0xe4278c[_0x0f78('0x3d')][_0x0f78('0x83')]}:undefined;return db[_0x6db650][_0x0f78('0x54')]({'where':_0xcf7ba7,'raw':!![]})['then'](function(_0xd7cb1a){_0xe4278c[_0x0f78('0x7a')]=_['map'](_0xd7cb1a,'id');_0x162713(_0xe4278c);})[_0x0f78('0x48')](function(_0x11b2e3){_0x5ce343(_0x11b2e3);});}else{_0x162713(null);}});}function getAllFilteredResources(_0x43c3ea,_0x5a8e96){return new BPromise(function(_0x5f4bf8,_0x4453a8){var _0x15c80a=_0x43c3ea[_0x0f78('0x3d')]?{[_0x43c3ea[_0x0f78('0x3d')][_0x0f78('0x77')]]:_0x43c3ea[_0x0f78('0x3d')][_0x0f78('0x83')]}:undefined;return db[_0x43c3ea[_0x0f78('0x31')]][_0x0f78('0x54')]({'where':_0x15c80a,'raw':!![]})['then'](function(_0x49fac0){_0x5a8e96['associatedResources']=_[_0x0f78('0x32')](_0x49fac0,function(_0x3cf9db){return _0x3cf9db[_0x0f78('0x29')];});_0x5f4bf8(_0x5a8e96);})['catch'](function(_0xcf7ff7){_0x4453a8(_0xcf7ff7);});});}function getAllowedResources(_0xc8b38f,_0x4e7750,_0x100f23){return new BPromise(function(_0x5930d1,_0x5a1459){if(_0x4e7750){return db[_0x0f78('0x57')][_0x0f78('0x54')]({'where':{'sectionId':_0x4e7750['id']},'raw':!![]})['then'](function(_0x27cdcd){if(_0xc8b38f['field']&&_0xc8b38f[_0x0f78('0x77')]!=='id'){_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x2a69c0){return _0x2a69c0[_0xc8b38f['field']];});}else{if(_0x100f23==='AnalyticExtractedReport'){_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x570e41){return{'id':_0x570e41[_0x0f78('0x69')],'type':_0x570e41[_0x0f78('0x2f')]};});}else{_0x4e7750[_0x0f78('0x7a')]=_[_0x0f78('0x32')](_0x27cdcd,function(_0x3e0a02){return _0x3e0a02[_0x0f78('0x69')];});}}_0x5930d1(_0x4e7750);})[_0x0f78('0x48')](function(_0x2886d6){_0x5a1459(_0x2886d6);});}else{_0x5930d1(null);}});}function getQueryModels(_0xe6ca23,_0x21d590){var _0xb907d4=_0xe6ca23[_0x0f78('0x84')]();var _0x589835={'childModel':undefined,'parentSections':[]};switch(_0xb907d4){case'squareprojects':_0x589835['childModel']='SquareProject';break;case _0x0f78('0x85'):_0x589835[_0x0f78('0x72')]='SquareOdbc';break;case _0x0f78('0x86'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x87');_0x589835[_0x0f78('0x74')]=[{'name':_0x0f78('0x88'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0x89')}];break;case _0x0f78('0x8a'):_0x589835[_0x0f78('0x72')]='JscriptyProject';break;case _0x0f78('0x8b'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x8c');_0x589835['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x0f78('0x8d')}];break;case _0x0f78('0x8e'):_0x589835['childModel']='CmList';break;case _0x0f78('0x8f'):_0x589835[_0x0f78('0x72')]='CmCompany';break;case _0x0f78('0x90'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x91');break;case'chatqueues':_0x589835['childModel']='ChatQueue';break;case _0x0f78('0x92'):_0x589835[_0x0f78('0x72')]='ChatWebsite';break;case'faxqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0x93');break;case'faxaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0x94');break;case _0x0f78('0x95'):case _0x0f78('0x96'):case'outboundroutes':_0x589835[_0x0f78('0x72')]=_0x0f78('0x97');break;case _0x0f78('0x98'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x99');break;case _0x0f78('0x9a'):_0x589835[_0x0f78('0x72')]='VoiceMail';break;case'voicerecordings':_0x589835[_0x0f78('0x72')]=_0x0f78('0x9b');_0x589835[_0x0f78('0x74')]=[{'name':_0x0f78('0x9c'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0x9d'),'model':'User','filter':{'field':'role','value':['agent']}},{'name':_0x0f78('0x9e'),'field':_0x0f78('0x29'),'foreignKey':'membername','model':_0x0f78('0x9f'),'filter':{'field':_0x0f78('0xa0'),'value':['telephone']}},{'name':_0x0f78('0xa1'),'field':'name','foreignKey':'queue','model':_0x0f78('0xa2'),'filter':{'field':'type','value':[_0x0f78('0xa3')]}},{'name':_0x0f78('0xa4'),'field':_0x0f78('0x29'),'foreignKey':_0x0f78('0xa5'),'model':_0x0f78('0xa2'),'filter':{'field':_0x0f78('0x2f'),'value':['outbound']}}];break;case _0x0f78('0xa6'):_0x589835[_0x0f78('0x72')]='VoiceMusicOnHold';break;case'chanspies':_0x589835['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x589835['childModel']=_0x0f78('0xa7');break;case _0x0f78('0xa8'):_0x589835['childModel']=_0x0f78('0xa9');break;case _0x0f78('0xaa'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xab');break;case _0x0f78('0xac'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xad');break;case'mailsubstatuses':_0x589835[_0x0f78('0x72')]=_0x0f78('0xae');break;case _0x0f78('0xaf'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xb0');break;case'openchannelaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb1');break;case'smsqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb2');break;case _0x0f78('0xb3'):_0x589835[_0x0f78('0x72')]='SmsAccount';break;case'whatsappqueues':_0x589835[_0x0f78('0x72')]=_0x0f78('0xb4');break;case _0x0f78('0xb5'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xb6');break;case _0x0f78('0xb7'):_0x589835[_0x0f78('0x72')]='Team';break;case _0x0f78('0xb8'):case'queuecampaigns':_0x589835[_0x0f78('0x72')]=_0x0f78('0xa2');if(_0x21d590){_0x589835[_0x0f78('0x74')]=[{'name':'VoiceQueues'},{'name':_0x0f78('0xa4')}];}break;case _0x0f78('0xb9'):case _0x0f78('0xba'):case _0x0f78('0xbb'):_0x589835['childModel']=_0x0f78('0x9f');if(_0x21d590){_0x589835['parentSections']=[{'name':_0x0f78('0xbc'),'filter':{'field':'role','value':[_0x0f78('0xbd'),_0x0f78('0xbe')]},'ignore':!![]},{'name':_0x0f78('0x9c')},{'name':_0x0f78('0x9e')}];}break;case'zendeskaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xbf');break;case _0x0f78('0xc0'):_0x589835['childModel']=_0x0f78('0xc1');break;case'freshdeskaccounts':_0x589835[_0x0f78('0x72')]='FreshdeskAccount';break;case _0x0f78('0xc2'):_0x589835[_0x0f78('0x72')]='SugarcrmAccount';break;case'deskaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xc3');break;case'zohoaccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0xc4');break;case'vtigeraccounts':_0x589835[_0x0f78('0x72')]=_0x0f78('0x9f');break;case _0x0f78('0xc5'):_0x589835['childModel']=_0x0f78('0xc6');break;case _0x0f78('0xc7'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xc8');break;case _0x0f78('0xc9'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x67');break;case'intervals':_0x589835[_0x0f78('0x72')]=_0x0f78('0xca');break;case _0x0f78('0xcb'):_0x589835[_0x0f78('0x72')]='Pause';break;case _0x0f78('0xcc'):_0x589835['childModel']=_0x0f78('0xcd');break;case _0x0f78('0xce'):_0x589835[_0x0f78('0x72')]=_0x0f78('0xcf');break;case'tags':_0x589835[_0x0f78('0x72')]=_0x0f78('0x81');break;case _0x0f78('0xd0'):_0x589835[_0x0f78('0x72')]='Template';break;case'triggers':_0x589835['childModel']=_0x0f78('0xd1');break;case _0x0f78('0xd2'):_0x589835[_0x0f78('0x72')]='Trunk';break;case'variables':_0x589835[_0x0f78('0x72')]=_0x0f78('0xd3');break;case _0x0f78('0xd4'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x6a');break;case _0x0f78('0xd5'):_0x589835[_0x0f78('0x72')]=_0x0f78('0x78');_0x589835['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x0f78('0xd6'):_0x589835[_0x0f78('0x72')]='AnalyticMetric';break;case _0x0f78('0xb5'):_0x589835[_0x0f78('0x72')]='WhatsappAccount';break;default:return _0x589835;}return _0x589835;} \ No newline at end of file +var _0xb512=['reportType','default','reportId','DefaultReports','custom','Tag','Tags','color','tag','ThroughTags','value','squareprojects','odbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','UserProfile','count','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','rawAttributes','get','omit','createdAt','updatedAt','sequelize','transaction','each','autoAssociation','userProfileId','UserProfileSection','UserProfileResource','describe','addSections','sectionId','Resources','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','resourceId','Plugin','forEach','bulkCreate','removeResources','ids','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','pick','field','AnalyticExtractedReport','foreignKey','associatedResources'];(function(_0x4a4700,_0x52ae42){var _0x23fba7=function(_0x3dc8ad){while(--_0x3dc8ad){_0x4a4700['push'](_0x4a4700['shift']());}};_0x23fba7(++_0x52ae42);}(_0xb512,0x162));var _0x2b51=function(_0x3693a4,_0x518d2f){_0x3693a4=_0x3693a4-0x0;var _0x3f2bad=_0xb512[_0x3693a4];return _0x3f2bad;};'use strict';var pdf=require(_0x2b51('0x0'));var emlformat=require(_0x2b51('0x1'));var rimraf=require(_0x2b51('0x2'));var zipdir=require(_0x2b51('0x3'));var jsonpatch=require(_0x2b51('0x4'));var rp=require(_0x2b51('0x5'));var moment=require(_0x2b51('0x6'));var BPromise=require(_0x2b51('0x7'));var Mustache=require(_0x2b51('0x8'));var util=require(_0x2b51('0x9'));var path=require(_0x2b51('0xa'));var sox=require(_0x2b51('0xb'));var csv=require(_0x2b51('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2b51('0xd'));var crypto=require(_0x2b51('0xe'));var jsforce=require(_0x2b51('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2b51('0xc'));var querystring=require('querystring');var Papa=require(_0x2b51('0x10'));var Redis=require(_0x2b51('0x11'));var authService=require(_0x2b51('0x12'));var qs=require(_0x2b51('0x13'));var as=require(_0x2b51('0x14'));var hardwareService=require(_0x2b51('0x15'));var logger=require(_0x2b51('0x16'))(_0x2b51('0x17'));var utils=require('../../config/utils');var config=require(_0x2b51('0x18'));var db=require(_0x2b51('0x19'))['db'];config[_0x2b51('0x1a')]=_[_0x2b51('0x1b')](config[_0x2b51('0x1a')],{'host':_0x2b51('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b51('0x1a')]));require(_0x2b51('0x1d'))['register'](socket);function respondWithStatusCode(_0x4f5325,_0x5e1f7b){_0x5e1f7b=_0x5e1f7b||0xcc;return function(_0x158205){if(_0x158205){return _0x4f5325[_0x2b51('0x1e')](_0x5e1f7b);}return _0x4f5325[_0x2b51('0x1f')](_0x5e1f7b)[_0x2b51('0x20')]();};}function respondWithResult(_0x3bc591,_0xa2b9b9){_0xa2b9b9=_0xa2b9b9||0xc8;return function(_0x904299){if(_0x904299){return _0x3bc591[_0x2b51('0x1f')](_0xa2b9b9)[_0x2b51('0x21')](_0x904299);}};}function respondWithFilteredResult(_0x4ed9cc,_0x1c3644){return function(_0x1302be){if(_0x1302be){var _0x100b57=_0x1302be['count'],_0x362a38=_0x1c3644['offset'],_0x40e076=_0x1c3644[_0x2b51('0x22')]+_0x1c3644[_0x2b51('0x23')],_0x40527f;if(_0x40e076>=_0x100b57){_0x40e076=_0x100b57;_0x40527f=0xc8;}else{_0x40527f=0xce;}_0x4ed9cc[_0x2b51('0x1f')](_0x40527f);return _0x4ed9cc[_0x2b51('0x24')](_0x2b51('0x25'),_0x362a38+'-'+_0x40e076+'/'+_0x100b57)[_0x2b51('0x21')](_0x1302be);}return null;};}function patchUpdates(_0x4a3503){return function(_0x33b1ea){try{jsonpatch[_0x2b51('0x26')](_0x33b1ea,_0x4a3503,!![]);}catch(_0x3b305b){return BPromise[_0x2b51('0x27')](_0x3b305b);}return _0x33b1ea[_0x2b51('0x28')]();};}function saveUpdates(_0x5b1842,_0x1cf2ca){return function(_0x3234ca){if(_0x3234ca){return _0x3234ca[_0x2b51('0x29')](_0x5b1842)[_0x2b51('0x2a')](function(_0xe8cc63){return _0xe8cc63;});}return null;};}function removeEntity(_0x341600,_0xc5e1b1){return function(_0x8757fc){if(_0x8757fc){return _0x8757fc[_0x2b51('0x2b')]()[_0x2b51('0x2a')](function(){_0x341600['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9e305f,_0x4738f4){return function(_0x34376e){if(!_0x34376e){_0x9e305f[_0x2b51('0x1e')](0x194);}return _0x34376e;};}function handleError(_0x27b34f,_0x2ac6b7){_0x2ac6b7=_0x2ac6b7||0x1f4;return function(_0x189a47){logger[_0x2b51('0x2c')](_0x189a47[_0x2b51('0x2d')]);if(_0x189a47[_0x2b51('0x2e')]){delete _0x189a47[_0x2b51('0x2e')];}_0x27b34f[_0x2b51('0x1f')](_0x2ac6b7)[_0x2b51('0x2f')](_0x189a47);};}exports['index']=function(_0x121b33,_0x3c7ac8){var _0x163b85={},_0x5524cc={},_0x18be6b={'count':0x0,'rows':[]};var _0x279fa2=_[_0x2b51('0x30')](db['UserProfile']['rawAttributes'],function(_0x50deb5){return{'name':_0x50deb5['fieldName'],'type':_0x50deb5[_0x2b51('0x31')][_0x2b51('0x32')]};});_0x5524cc[_0x2b51('0x33')]=_[_0x2b51('0x30')](_0x279fa2,'name');_0x5524cc[_0x2b51('0x34')]=_['keys'](_0x121b33['query']);_0x5524cc[_0x2b51('0x35')]=_['intersection'](_0x5524cc[_0x2b51('0x33')],_0x5524cc[_0x2b51('0x34')]);_0x163b85['attributes']=_['intersection'](_0x5524cc['model'],qs[_0x2b51('0x36')](_0x121b33[_0x2b51('0x34')]['fields']));_0x163b85[_0x2b51('0x37')]=_0x163b85[_0x2b51('0x37')][_0x2b51('0x38')]?_0x163b85[_0x2b51('0x37')]:_0x5524cc['model'];if(!_0x121b33[_0x2b51('0x34')][_0x2b51('0x39')](_0x2b51('0x3a'))){_0x163b85[_0x2b51('0x23')]=qs[_0x2b51('0x23')](_0x121b33[_0x2b51('0x34')][_0x2b51('0x23')]);_0x163b85[_0x2b51('0x22')]=qs[_0x2b51('0x22')](_0x121b33['query'][_0x2b51('0x22')]);}_0x163b85[_0x2b51('0x3b')]=qs[_0x2b51('0x3c')](_0x121b33['query'][_0x2b51('0x3c')]);_0x163b85[_0x2b51('0x3d')]=qs['filters'](_['pick'](_0x121b33[_0x2b51('0x34')],_0x5524cc[_0x2b51('0x35')]),_0x279fa2);if(_0x121b33[_0x2b51('0x34')][_0x2b51('0x3e')]){_0x163b85[_0x2b51('0x3d')]=_[_0x2b51('0x3f')](_0x163b85[_0x2b51('0x3d')],{'$or':_[_0x2b51('0x30')](_0x279fa2,function(_0x175eda){if(_0x175eda['type']!==_0x2b51('0x40')){var _0x52364a={};_0x52364a[_0x175eda['name']]={'$like':'%'+_0x121b33[_0x2b51('0x34')]['filter']+'%'};return _0x52364a;}})});}_0x163b85=_['merge']({},_0x163b85,_0x121b33[_0x2b51('0x41')]);var _0x5a98ec={'where':_0x163b85[_0x2b51('0x3d')]};return db[_0x2b51('0x42')]['count'](_0x5a98ec)[_0x2b51('0x2a')](function(_0x5d499a){_0x18be6b[_0x2b51('0x43')]=_0x5d499a;if(_0x121b33[_0x2b51('0x34')][_0x2b51('0x44')]){_0x163b85[_0x2b51('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x2b51('0x46')](_0x163b85);})[_0x2b51('0x2a')](function(_0x3860ab){_0x18be6b[_0x2b51('0x47')]=_0x3860ab;return _0x18be6b;})[_0x2b51('0x2a')](respondWithFilteredResult(_0x3c7ac8,_0x163b85))[_0x2b51('0x48')](handleError(_0x3c7ac8,null));};exports[_0x2b51('0x49')]=function(_0x109ae9,_0x4cd48a){var _0xf475bf={'raw':![],'where':{'id':_0x109ae9[_0x2b51('0x4a')]['id']}},_0x468633={};_0x468633[_0x2b51('0x33')]=_[_0x2b51('0x4b')](db[_0x2b51('0x42')]['rawAttributes']);_0x468633['query']=_[_0x2b51('0x4b')](_0x109ae9[_0x2b51('0x34')]);_0x468633[_0x2b51('0x35')]=_[_0x2b51('0x4c')](_0x468633[_0x2b51('0x33')],_0x468633[_0x2b51('0x34')]);_0xf475bf['attributes']=_['intersection'](_0x468633['model'],qs[_0x2b51('0x36')](_0x109ae9[_0x2b51('0x34')][_0x2b51('0x36')]));_0xf475bf[_0x2b51('0x37')]=_0xf475bf[_0x2b51('0x37')]['length']?_0xf475bf[_0x2b51('0x37')]:_0x468633[_0x2b51('0x33')];if(_0x109ae9['query'][_0x2b51('0x44')]){_0xf475bf[_0x2b51('0x45')]=[{'all':!![]}];}_0xf475bf=_[_0x2b51('0x3f')]({},_0xf475bf,_0x109ae9[_0x2b51('0x41')]);return db[_0x2b51('0x42')][_0x2b51('0x4d')](_0xf475bf)['then'](handleEntityNotFound(_0x4cd48a,null))[_0x2b51('0x2a')](respondWithResult(_0x4cd48a,null))['catch'](handleError(_0x4cd48a,null));};exports['create']=function(_0x374bd7,_0xb3970){return db[_0x2b51('0x42')][_0x2b51('0x4e')](_0x374bd7[_0x2b51('0x4f')],{})['then'](respondWithResult(_0xb3970,0xc9))[_0x2b51('0x48')](handleError(_0xb3970,null));};exports['clone']=function(_0x5b2b0d,_0x3b96f7){var _0x4baeb5={'where':{'id':_0x5b2b0d[_0x2b51('0x4a')]['id']}},_0x1a30d0={};_0x1a30d0['model']=_[_0x2b51('0x4b')](db[_0x2b51('0x42')][_0x2b51('0x50')]);_0x4baeb5['attributes']=_[_0x2b51('0x4c')](_0x1a30d0['model'],qs[_0x2b51('0x36')](_0x5b2b0d['query'][_0x2b51('0x36')]));_0x4baeb5['attributes']=_0x4baeb5['attributes'][_0x2b51('0x38')]?_0x4baeb5['attributes']:_0x1a30d0[_0x2b51('0x33')];if(_0x5b2b0d['query'][_0x2b51('0x44')]){_0x4baeb5['include']=[{'all':!![]}];}_0x4baeb5=_[_0x2b51('0x3f')]({},_0x4baeb5,_0x5b2b0d[_0x2b51('0x41')]);return db[_0x2b51('0x42')][_0x2b51('0x4d')](_0x4baeb5)[_0x2b51('0x2a')](handleEntityNotFound(_0x3b96f7,null))[_0x2b51('0x2a')](function(_0x1132ed){if(_0x1132ed){var _0x329dbd=_0x1132ed[_0x2b51('0x51')]({'plain':!![]});_0x329dbd=qs[_0x2b51('0x52')](_0x329dbd,['id',_0x2b51('0x53'),'updatedAt','crudPermissions']);_0x5b2b0d['body']=_[_0x2b51('0x52')](_0x5b2b0d[_0x2b51('0x4f')],['id',_0x2b51('0x53'),_0x2b51('0x54')]);return db[_0x2b51('0x55')][_0x2b51('0x56')](function(_0x490b5e){return db[_0x2b51('0x42')]['create'](_[_0x2b51('0x3f')](_0x329dbd,_0x5b2b0d[_0x2b51('0x4f')]),{'include':_0x5b2b0d[_0x2b51('0x34')][_0x2b51('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x490b5e})['then'](function(_0x460a9b){var _0x403518=_0x460a9b[_0x2b51('0x51')]({'plain':!![]});return db['UserProfileSection'][_0x2b51('0x46')]({'where':{'userProfileId':_0x5b2b0d['params']['id']},'raw':!![]})['then'](function(_0xdd640c){if(_0xdd640c){return BPromise[_0x2b51('0x57')](_0xdd640c,function(_0x3cab72){return new BPromise(function(_0x55821b,_0x2e7853){if(_0x3cab72[_0x2b51('0x58')]===null||_0x3cab72[_0x2b51('0x58')]===0x1)_0x55821b(null);return db['UserProfileResource'][_0x2b51('0x46')]({'where':{'sectionId':_0x3cab72['id']},'raw':!![]})['then'](function(_0xf84a09){var _0x2475fc=_[_0x2b51('0x30')](_0xf84a09,function(_0x2d0d75){return qs[_0x2b51('0x52')](_0x2d0d75,['id',_0x2b51('0x53'),'updatedAt','sectionId']);});_0x55821b(_0x2475fc);})['catch'](function(_0xb293c4){_0x2e7853(_0xb293c4);});})[_0x2b51('0x2a')](function(_0x3991c6){var _0x1252df=qs[_0x2b51('0x52')](_0x3cab72,['id','createdAt',_0x2b51('0x54')]);_0x1252df[_0x2b51('0x59')]=_0x403518['id'];if(_0x3991c6)_0x1252df['Resources']=_0x3991c6;return _0x1252df;})[_0x2b51('0x2a')](function(_0x4707fa){return db[_0x2b51('0x5a')]['create'](_0x4707fa,{'include':[{'model':db[_0x2b51('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x490b5e});});})[_0x2b51('0x2a')](function(){return _0x403518;});}});});});}})[_0x2b51('0x2a')](respondWithResult(_0x3b96f7,0xc9))[_0x2b51('0x48')](handleError(_0x3b96f7,null));};exports[_0x2b51('0x29')]=function(_0x448708,_0x41e68c){if(_0x448708[_0x2b51('0x4f')]['id']){delete _0x448708[_0x2b51('0x4f')]['id'];}return db[_0x2b51('0x42')][_0x2b51('0x4d')]({'where':{'id':_0x448708[_0x2b51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x41e68c,null))['then'](saveUpdates(_0x448708['body'],null))[_0x2b51('0x2a')](respondWithResult(_0x41e68c,null))[_0x2b51('0x48')](handleError(_0x41e68c,null));};exports['destroy']=function(_0x18788a,_0x16dadd){return db[_0x2b51('0x42')][_0x2b51('0x4d')]({'where':{'id':_0x18788a[_0x2b51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x16dadd,null))[_0x2b51('0x2a')](removeEntity(_0x16dadd,null))['catch'](handleError(_0x16dadd,null));};exports[_0x2b51('0x5c')]=function(_0x2c67cc,_0x23b0a9){return db[_0x2b51('0x42')][_0x2b51('0x5c')]()[_0x2b51('0x2a')](respondWithResult(_0x23b0a9,null))['catch'](handleError(_0x23b0a9,null));};exports[_0x2b51('0x5d')]=function(_0x11ad6a,_0x105d3d){var _0x4ce1ba=_0x11ad6a[_0x2b51('0x4f')];return db[_0x2b51('0x42')]['find']({'where':{'id':_0x11ad6a[_0x2b51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x105d3d,null))[_0x2b51('0x2a')](function(_0x2134be){if(_0x2134be){return db['sequelize'][_0x2b51('0x56')](function(_0x5b2dd4){return db['UserProfileSection'][_0x2b51('0x2b')]({'where':{'userProfileId':_0x11ad6a[_0x2b51('0x4a')]['id'],'sectionId':_[_0x2b51('0x30')](_0x4ce1ba,function(_0x1599e8){return _0x1599e8[_0x2b51('0x5e')];})},'transaction':_0x5b2dd4})['then'](function(){var _0x5dda9a=_['map'](_0x4ce1ba,function(_0xbb33bb){_0xbb33bb['userProfileId']=_0x11ad6a[_0x2b51('0x4a')]['id'];return _0xbb33bb;});var _0x47b6ae=[];return BPromise[_0x2b51('0x57')](_0x5dda9a,function(_0x46fa84){return db[_0x2b51('0x5a')][_0x2b51('0x4e')](_0x46fa84,{'include':[{'model':db['UserProfileResource'],'as':_0x2b51('0x5f')}],'raw':!![],'transaction':_0x5b2dd4})[_0x2b51('0x2a')](function(_0x2d46c3){_0x47b6ae[_0x2b51('0x60')](_0x2d46c3['get']({'plain':!![]}));});})[_0x2b51('0x2a')](function(){return _0x47b6ae;});});});}})[_0x2b51('0x2a')](function(_0x6ea7da){return _0x6ea7da;})[_0x2b51('0x2a')](respondWithResult(_0x105d3d,null))[_0x2b51('0x48')](handleError(_0x105d3d,null));};exports[_0x2b51('0x61')]=function(_0xa5aa09,_0x41aa16){var _0x85aceb;return db['UserProfile'][_0x2b51('0x4d')]({'where':{'id':_0xa5aa09['params']['id']},'attributes':['id',_0x2b51('0x2e')]})[_0x2b51('0x2a')](handleEntityNotFound(_0x41aa16,null))['then'](function(_0x26fcc3){if(_0x26fcc3){_0x85aceb=_0x26fcc3;return db[_0x2b51('0x5a')][_0x2b51('0x2b')]({'where':{'userProfileId':_0xa5aa09['params']['id'],'sectionId':_0xa5aa09[_0x2b51('0x34')]['ids']}});}})[_0x2b51('0x2a')](function(){return _0x85aceb;})[_0x2b51('0x2a')](respondWithStatusCode(_0x41aa16,null))[_0x2b51('0x48')](handleError(_0x41aa16,null));};exports[_0x2b51('0x62')]=function(_0xf26f00,_0x24310c){var _0x599ef4=[];var _0x898bd=[];return db['UserProfileSection'][_0x2b51('0x46')]({'where':{'userProfileId':_0xf26f00[_0x2b51('0x4a')]['id']},'raw':!![]})['then'](function(_0x37c97f){_0x599ef4=_[_0x2b51('0x3e')](_0x37c97f,function(_0x1b766a){return _0x1b766a[_0x2b51('0x63')]===0x1||_[_0x2b51('0x64')]([0x3eb,0x709],_0x1b766a[_0x2b51('0x5e')]);});if(!_[_0x2b51('0x65')](_0x599ef4)){return _['map'](_0x599ef4,function(_0x41788d){return _0x41788d[_0x2b51('0x5e')];});}else{return;}})[_0x2b51('0x2a')](function(_0x139950){if(_0x139950)_0x898bd=_0x139950;if(_['includes'](_0x898bd,0x64)){var _0x28163e=_[_0x2b51('0x4d')](_0x599ef4,{'sectionId':0x64});return hasDefaultDashboard(_0x28163e)[_0x2b51('0x2a')](function(_0x167226){return _[_0x2b51('0x30')](_0x599ef4,function(_0x1b616f){if(_0x1b616f[_0x2b51('0x5e')]===0x64){_0x1b616f['subsections']=_0x167226;}return _0x1b616f;});});}else{return;}})[_0x2b51('0x2a')](function(_0x4b6730){if(_0x4b6730)_0x599ef4=_0x4b6730;if(_[_0x2b51('0x64')](_0x898bd,0x3eb)){var _0x171268=_[_0x2b51('0x4d')](_0x599ef4,{'sectionId':0x3eb});return getCustomDashboards(_0x171268)[_0x2b51('0x2a')](function(_0x58b56f){return _[_0x2b51('0x30')](_0x599ef4,function(_0x338ba7){if(_0x171268['enabled']){if(_0x338ba7[_0x2b51('0x5e')]===0x3eb){_0x338ba7[_0x2b51('0x66')]=_0x58b56f;}}else{if(_0x338ba7[_0x2b51('0x5e')]===0x64){_0x338ba7[_0x2b51('0x66')]=_0x58b56f;}}return _0x338ba7;});});}else{return;}})['then'](function(_0x1fec12){if(_0x1fec12)_0x599ef4=_0x1fec12;if(_['includes'](_0x898bd,0x709)){var _0x18e138=_['find'](_0x599ef4,{'sectionId':0x709});return getPlugins(_0x18e138)[_0x2b51('0x2a')](function(_0x28afe6){if(_0x18e138['enabled']){return _[_0x2b51('0x30')](_0x599ef4,function(_0x30f9dc){if(_0x30f9dc[_0x2b51('0x5e')]===0x709){_0x30f9dc[_0x2b51('0x66')]=_0x28afe6;}return _0x30f9dc;});}else{var _0x1bb44e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x28afe6};var _0x593bae=_[_0x2b51('0x30')](_0x599ef4);_0x593bae[_0x2b51('0x60')](_0x1bb44e);return _0x593bae;}});}else{return;}})[_0x2b51('0x2a')](function(_0x3e1969){if(_0x3e1969)_0x599ef4=_0x3e1969;return _[_0x2b51('0x3e')](_0x599ef4,[_0x2b51('0x63'),0x1]);})['then'](respondWithResult(_0x24310c,null))[_0x2b51('0x48')](handleError(_0x24310c,null));};function hasDefaultDashboard(_0x4a1def){var _0x454c6e=[0x65];return new BPromise(function(_0x395e02,_0x33ba31){try{if(_0x4a1def[_0x2b51('0x58')]){_0x395e02(_0x454c6e);}else{return db[_0x2b51('0x5b')][_0x2b51('0x67')]({'where':{'sectionId':_0x4a1def['id']},'raw':!![]})[_0x2b51('0x2a')](function(_0x558e49){_0x558e49?_0x395e02(_0x454c6e):_0x395e02();});}}catch(_0x5d081c){_0x33ba31(_0x5d081c);}});}function getCustomDashboards(_0x310758){var _0x2a1613=[];return new BPromise(function(_0x538703,_0x4f5bb8){try{if(_0x310758[_0x2b51('0x58')]){return db[_0x2b51('0x68')][_0x2b51('0x46')]({'raw':!![]})[_0x2b51('0x2a')](function(_0x3eef59){_0x3eef59['forEach'](function(_0x18c9e8){_0x2a1613[_0x2b51('0x60')](_0x18c9e8['id']+0x1869f);});_0x538703(_0x2a1613);});}else{return db[_0x2b51('0x5b')]['findAll']({'where':{'sectionId':_0x310758['id']},'raw':!![]})[_0x2b51('0x2a')](function(_0x5db699){_0x5db699['forEach'](function(_0x1148a4){_0x2a1613[_0x2b51('0x60')](_0x1148a4[_0x2b51('0x69')]+0x1869f);});_0x538703(_0x2a1613);});}}catch(_0x1569c2){_0x4f5bb8(_0x1569c2);}});}function getPlugins(_0x36188e){var _0x506492=[];return new BPromise(function(_0x22ba9f,_0x38b64e){try{if(_0x36188e['autoAssociation']){return db[_0x2b51('0x6a')][_0x2b51('0x46')]({'raw':!![]})[_0x2b51('0x2a')](function(_0x5b8f7b){_0x5b8f7b['forEach'](function(_0x3d22c3){_0x506492['push'](_0x3d22c3['id']+0x15b38);});_0x22ba9f(_0x506492);});}else{return db[_0x2b51('0x5b')][_0x2b51('0x46')]({'where':{'sectionId':_0x36188e['id']},'raw':!![]})[_0x2b51('0x2a')](function(_0x34a336){_0x34a336[_0x2b51('0x6b')](function(_0x46a78e){_0x506492[_0x2b51('0x60')](_0x46a78e[_0x2b51('0x69')]+0x15b38);});_0x22ba9f(_0x506492);});}}catch(_0x1d54dc){_0x38b64e(_0x1d54dc);}});}exports['addResources']=function(_0x2351fa,_0x4fcbe9){return db[_0x2b51('0x42')]['find']({'where':{'id':_0x2351fa['params']['id']}})[_0x2b51('0x2a')](handleEntityNotFound(_0x4fcbe9,null))[_0x2b51('0x2a')](function(_0x2251c8){if(_0x2251c8){return db[_0x2b51('0x55')]['transaction'](function(_0x904682){return db[_0x2b51('0x5a')][_0x2b51('0x46')]({'where':{'userProfileId':_0x2351fa[_0x2b51('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x2b51('0x2a')](function(_0x3344cf){if(_0x3344cf){return db[_0x2b51('0x5a')][_0x2b51('0x2b')]({'where':{'userProfileId':_0x2351fa[_0x2b51('0x4a')]['id'],'id':_['map'](_0x3344cf,function(_0x24aa54){return _0x24aa54['id'];})},'transaction':_0x904682});}})[_0x2b51('0x2a')](function(_0x12f50f){var _0x3f4452=_['map'](_0x2351fa[_0x2b51('0x4f')],function(_0x2e176d){_0x2e176d['userProfileId']=_0x2351fa['params']['id'];return _0x2e176d;});return db['UserProfileSection'][_0x2b51('0x6c')](_0x3f4452,{'raw':!![],'transaction':_0x904682});})[_0x2b51('0x2a')](function(_0x3fd9fa){var _0x50175a=_[_0x2b51('0x3e')](_[_0x2b51('0x30')](_0x3fd9fa,function(_0x3808f9){return _0x3808f9[_0x2b51('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x50175a){return db[_0x2b51('0x5a')]['findAll']({'where':{'userProfileId':_0x2351fa[_0x2b51('0x4a')]['id'],'sectionId':_[_0x2b51('0x30')](_0x50175a,function(_0x53ab9c){return _0x53ab9c[_0x2b51('0x5e')];})},'attributes':['id',_0x2b51('0x5e')],'raw':!![]})['then'](function(_0x5ca3c4){var _0xbfaca9=_['map'](_0x2351fa[_0x2b51('0x4f')],function(_0x46213f){_0x46213f[_0x2b51('0x59')]=_0x2351fa[_0x2b51('0x4a')]['id'];return _0x46213f;});return db[_0x2b51('0x5b')][_0x2b51('0x6c')](_0xbfaca9,{'raw':!![],'transaction':_0x904682});});}})[_0x2b51('0x48')](handleError(_0x4fcbe9,null));});}})[_0x2b51('0x2a')](function(_0x30f6b2){var _0x5656d6=_['map'](_0x30f6b2,function(_0x369284){return _0x369284[_0x2b51('0x51')]({'plain':!![]});});})[_0x2b51('0x2a')](respondWithResult(_0x4fcbe9,null))[_0x2b51('0x48')](handleError(_0x4fcbe9,null));};exports[_0x2b51('0x6d')]=function(_0x207802,_0x78ada7,_0x2dca97){return db['UserProfile']['find']({'where':{'id':_0x207802[_0x2b51('0x4a')]['id']}})[_0x2b51('0x2a')](handleEntityNotFound(_0x78ada7,null))['then'](function(_0x16cccb){if(_0x16cccb){return _0x16cccb[_0x2b51('0x6d')](_0x207802[_0x2b51('0x34')][_0x2b51('0x6e')]);}})[_0x2b51('0x2a')](respondWithStatusCode(_0x78ada7,null))[_0x2b51('0x48')](handleError(_0x78ada7,null));};exports[_0x2b51('0x6f')]=function(_0x24fcb5,_0x507b8b){var _0x3889bd={'raw':![],'where':{}};var _0x425790={};var _0x1f3942={'count':0x0,'rows':[]};var _0x1d2e7d=_0x24fcb5[_0x2b51('0x34')]['section'];if(typeof _0x1d2e7d===_0x2b51('0x70')){throw new db[(_0x2b51('0x71'))][(_0x2b51('0x72'))](_0x2b51('0x73'));}var _0x614e22=_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x74')]||![];var _0x53bc29=getQueryModels(_0x1d2e7d,_0x614e22);if(typeof _0x53bc29[_0x2b51('0x75')]===_0x2b51('0x70')){throw new db[(_0x2b51('0x71'))]['ValidationError'](_0x2b51('0x76')+_0x1d2e7d+'\x27');}var _0x38a726=[];if(!_['isEmpty'](_0x53bc29[_0x2b51('0x77')])){_0x38a726=_0x53bc29['parentSections'];}else{_0x38a726=[{'name':_0x1d2e7d}];}return db[_0x2b51('0x42')][_0x2b51('0x67')]({'where':{'id':_0x24fcb5[_0x2b51('0x4a')]['id']}})[_0x2b51('0x2a')](handleEntityNotFound(_0x507b8b,null))[_0x2b51('0x2a')](function(_0x26c9a2){if(_0x26c9a2){var _0x34832c=[];for(var _0x4af940=0x0;_0x4af940<_0x38a726[_0x2b51('0x38')];_0x4af940++){_0x34832c[_0x2b51('0x60')](db['UserProfileSection'][_0x2b51('0x67')]({'where':{'userProfileId':_0x26c9a2['id'],'name':_0x38a726[_0x4af940][_0x2b51('0x2e')]},'raw':!![]}));}return BPromise[_0x2b51('0x78')](_0x34832c);}})['then'](function(_0x2535bc){var _0x57498e=_[_0x2b51('0x3e')](_0x2535bc,function(_0x7732ff){return _0x7732ff?_0x7732ff:undefined;});var _0x251e1a=_['filter'](_0x38a726,[_0x2b51('0x79'),!![]]);var _0x3f3969=_[_0x2b51('0x65')](_0x57498e)&&_['isEmpty'](_0x251e1a)?null:_[_0x2b51('0x7a')](_0x251e1a,_0x57498e);if(_0x3f3969){var _0x1cb69c=[];for(var _0x34b80a=0x0;_0x34b80a<_0x3f3969[_0x2b51('0x38')];_0x34b80a++){var _0x193bcd=_[_0x2b51('0x4d')](_0x38a726,function(_0x5043b1){return _0x3f3969[_0x34b80a]?_0x5043b1[_0x2b51('0x2e')]===_0x3f3969[_0x34b80a]['name']:null;});if(_0x193bcd){if(_0x3f3969[_0x34b80a][_0x2b51('0x79')]){_0x1cb69c[_0x2b51('0x60')](getAllResources(_0x53bc29[_0x2b51('0x75')],_0x3f3969[_0x34b80a]));}else{if(!_0x3f3969[_0x34b80a]['autoAssociation']){_0x1cb69c[_0x2b51('0x60')](getAllowedResources(_0x193bcd,_0x3f3969[_0x34b80a],_0x53bc29[_0x2b51('0x75')]));}else{if(_0x193bcd['model']){_0x1cb69c[_0x2b51('0x60')](getAllFilteredResources(_0x193bcd,_0x3f3969[_0x34b80a]));}}}}}return BPromise['all'](_0x1cb69c);}else{return null;}})[_0x2b51('0x2a')](function(_0x12ddab){var _0x394943=_0x12ddab;var _0x27857d=null;if(_0x394943){_0x27857d=_0x394943[_0x2b51('0x38')]===0x1?_0x394943[0x0]:null;}if(_0x27857d||_0x394943){var _0x8e8516=db[_0x53bc29[_0x2b51('0x75')]][_0x2b51('0x50')];_0x425790[_0x2b51('0x33')]=_[_0x2b51('0x4b')](_0x8e8516);_0x425790['query']=_[_0x2b51('0x4b')](_0x24fcb5[_0x2b51('0x34')]);_0x425790[_0x2b51('0x35')]=_[_0x2b51('0x4c')](_0x425790[_0x2b51('0x33')],_0x425790[_0x2b51('0x34')]);_0x3889bd[_0x2b51('0x37')]=_[_0x2b51('0x4c')](_0x425790[_0x2b51('0x33')],qs['fields'](_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x36')]));_0x3889bd[_0x2b51('0x37')]=_0x3889bd['attributes'][_0x2b51('0x38')]?_0x3889bd[_0x2b51('0x37')]:_0x425790['model'];if(!_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x39')](_0x2b51('0x3a'))){_0x3889bd[_0x2b51('0x23')]=qs[_0x2b51('0x23')](_0x24fcb5['query'][_0x2b51('0x23')]);_0x3889bd[_0x2b51('0x22')]=qs[_0x2b51('0x22')](_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x22')]);}_0x3889bd[_0x2b51('0x3b')]=qs[_0x2b51('0x3c')](_0x24fcb5['query'][_0x2b51('0x3c')]);_0x3889bd[_0x2b51('0x3d')]=qs[_0x2b51('0x35')](_[_0x2b51('0x7b')](_0x24fcb5[_0x2b51('0x34')],_0x425790[_0x2b51('0x35')]));if(_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x3e')]){_0x3889bd['where']=_['merge'](_0x3889bd[_0x2b51('0x3d')],{'$or':_[_0x2b51('0x30')](_0x8e8516,function(_0x195bcf){if(_0x195bcf[_0x2b51('0x31')][_0x2b51('0x32')]!==_0x2b51('0x40')){var _0xa3fc63={};_0xa3fc63[_0x195bcf['field']]={'$like':'%'+_0x24fcb5['query'][_0x2b51('0x3e')]+'%'};return _0xa3fc63;}})});}var _0x57d2fa=[];if(_0x27857d){var _0x541780=_[_0x2b51('0x4d')](_0x38a726,[_0x2b51('0x2e'),_0x27857d[_0x2b51('0x2e')]]);if(_0x541780[_0x2b51('0x7c')]){var _0x1301b3={};if(_0x53bc29[_0x2b51('0x75')]===_0x2b51('0x7d')){_0x1301b3[_0x541780[_0x2b51('0x7e')]]=_[_0x2b51('0x30')](_0x27857d[_0x2b51('0x7f')],'id');}else{_0x1301b3[_0x541780[_0x2b51('0x7e')]]=_0x27857d[_0x2b51('0x7f')];}_0x57d2fa['push'](_0x1301b3);}else{_0x3889bd[_0x2b51('0x3d')]['id']=_0x27857d['associatedResources'];}}else{for(var _0x5e0e97=0x0;_0x5e0e97<_0x394943[_0x2b51('0x38')];_0x5e0e97++){var _0x541780=_[_0x2b51('0x4d')](_0x38a726,[_0x2b51('0x2e'),_0x394943[_0x5e0e97][_0x2b51('0x2e')]]);if(_0x541780['field']){var _0x1301b3={};_0x1301b3[_0x541780['foreignKey']]=_0x394943[_0x5e0e97][_0x2b51('0x7f')];_0x57d2fa['push'](_0x1301b3);}else{if(!_0x3889bd[_0x2b51('0x3d')]['id'])_0x3889bd[_0x2b51('0x3d')]['id']=[];_0x394943[_0x5e0e97]['associatedResources'][_0x2b51('0x6b')](function(_0x453b01){_0x3889bd[_0x2b51('0x3d')]['id'][_0x2b51('0x60')](_0x453b01);});}}}if(!_[_0x2b51('0x65')](_0x57d2fa)){_0x3889bd['where']=_['merge'](_0x3889bd[_0x2b51('0x3d')],{'$and':{'$or':_0x57d2fa}});}_0x3889bd=_[_0x2b51('0x3f')]({},_0x3889bd,_0x24fcb5[_0x2b51('0x41')]);if(_0x27857d&&!_0x27857d[_0x2b51('0x58')]&&_0x53bc29['childModel']===_0x2b51('0x7d')){if(_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x44')]){_0x3889bd[_0x2b51('0x45')]=[{'all':!![]}];}return db[_0x53bc29[_0x2b51('0x75')]][_0x2b51('0x46')](_0x3889bd)[_0x2b51('0x2a')](function(_0x288191){var _0x430b9b=[];_0x288191[_0x2b51('0x6b')](function(_0x1825b6){var _0x307167;switch(_0x1825b6[_0x2b51('0x80')]){case _0x2b51('0x81'):_0x307167=_['find'](_0x27857d[_0x2b51('0x7f')],function(_0x591bbd){return _0x591bbd['id']===_0x1825b6[_0x2b51('0x82')]&&_0x591bbd['type']===_0x2b51('0x83');});break;case _0x2b51('0x84'):_0x307167=_[_0x2b51('0x4d')](_0x27857d[_0x2b51('0x7f')],function(_0x483450){return _0x483450['id']===_0x1825b6['reportId']&&_0x483450[_0x2b51('0x31')]==='CustomReports';});break;}if(_0x307167)_0x430b9b[_0x2b51('0x60')](_0x1825b6);});_0x1f3942[_0x2b51('0x43')]=_0x430b9b[_0x2b51('0x38')];_0x1f3942[_0x2b51('0x47')]=_0x430b9b;return _0x1f3942;});}else{return db[_0x53bc29[_0x2b51('0x75')]][_0x2b51('0x43')]({'where':_0x3889bd['where']})['then'](function(_0x43c8f7){_0x1f3942[_0x2b51('0x43')]=_0x43c8f7;if(_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x44')]){if(_0x53bc29[_0x2b51('0x75')]==='CmContact'){_0x3889bd[_0x2b51('0x45')]=[{'model':db[_0x2b51('0x85')],'as':_0x2b51('0x86'),'attributes':['id',_0x2b51('0x2e'),_0x2b51('0x87')],'required':_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x88')]?!![]:![]},{'model':db[_0x2b51('0x85')],'as':_0x2b51('0x89'),'attributes':['id',_0x2b51('0x2e'),_0x2b51('0x87')],'through':_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x88')]?{'attributes':[],'where':{'TagId':_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x88')]||undefined}}:{},'required':_0x24fcb5[_0x2b51('0x34')][_0x2b51('0x88')]?!![]:![]}];}else{_0x3889bd['include']=[{'all':!![]}];}}return db[_0x53bc29[_0x2b51('0x75')]]['findAll'](_0x3889bd);})['then'](function(_0x5cf77d){_0x1f3942[_0x2b51('0x47')]=_0x5cf77d;return _0x1f3942;});}}else{return _0x1f3942;}})['then'](respondWithFilteredResult(_0x507b8b,_0x3889bd))[_0x2b51('0x48')](handleError(_0x507b8b,null));};function getAllResources(_0x1dbc97,_0x5a6230){return new BPromise(function(_0x5f291c,_0x4e1767){if(_0x5a6230){var _0x4b50a8=_0x5a6230[_0x2b51('0x3e')]?{[_0x5a6230[_0x2b51('0x3e')][_0x2b51('0x7c')]]:_0x5a6230[_0x2b51('0x3e')][_0x2b51('0x8a')]}:undefined;return db[_0x1dbc97][_0x2b51('0x46')]({'where':_0x4b50a8,'raw':!![]})[_0x2b51('0x2a')](function(_0x16b87e){_0x5a6230[_0x2b51('0x7f')]=_[_0x2b51('0x30')](_0x16b87e,'id');_0x5f291c(_0x5a6230);})[_0x2b51('0x48')](function(_0x21f23a){_0x4e1767(_0x21f23a);});}else{_0x5f291c(null);}});}function getAllFilteredResources(_0xc91b9b,_0x167029){return new BPromise(function(_0x1c55ab,_0x20d111){var _0xae1037=_0xc91b9b[_0x2b51('0x3e')]?{[_0xc91b9b['filter'][_0x2b51('0x7c')]]:_0xc91b9b[_0x2b51('0x3e')][_0x2b51('0x8a')]}:undefined;return db[_0xc91b9b[_0x2b51('0x33')]][_0x2b51('0x46')]({'where':_0xae1037,'raw':!![]})[_0x2b51('0x2a')](function(_0x546f09){_0x167029['associatedResources']=_[_0x2b51('0x30')](_0x546f09,function(_0x4de8fc){return _0x4de8fc[_0x2b51('0x2e')];});_0x1c55ab(_0x167029);})[_0x2b51('0x48')](function(_0x58687c){_0x20d111(_0x58687c);});});}function getAllowedResources(_0x1dce24,_0x3cc37c,_0x5e30cd){return new BPromise(function(_0x8791f3,_0x1b27f1){if(_0x3cc37c){return db[_0x2b51('0x5b')][_0x2b51('0x46')]({'where':{'sectionId':_0x3cc37c['id']},'raw':!![]})['then'](function(_0x2fecab){if(_0x1dce24['field']&&_0x1dce24[_0x2b51('0x7c')]!=='id'){_0x3cc37c[_0x2b51('0x7f')]=_['map'](_0x2fecab,function(_0x381931){return _0x381931[_0x1dce24[_0x2b51('0x7c')]];});}else{if(_0x5e30cd===_0x2b51('0x7d')){_0x3cc37c['associatedResources']=_[_0x2b51('0x30')](_0x2fecab,function(_0x226011){return{'id':_0x226011['resourceId'],'type':_0x226011[_0x2b51('0x31')]};});}else{_0x3cc37c[_0x2b51('0x7f')]=_[_0x2b51('0x30')](_0x2fecab,function(_0x56dff4){return _0x56dff4[_0x2b51('0x69')];});}}_0x8791f3(_0x3cc37c);})[_0x2b51('0x48')](function(_0x6d17ee){_0x1b27f1(_0x6d17ee);});}else{_0x8791f3(null);}});}function getQueryModels(_0x1ad829,_0x18055c){var _0x4b28cd=_0x1ad829['toLowerCase']();var _0x460b66={'childModel':undefined,'parentSections':[]};switch(_0x4b28cd){case _0x2b51('0x8b'):_0x460b66['childModel']='SquareProject';break;case _0x2b51('0x8c'):_0x460b66[_0x2b51('0x75')]='SquareOdbc';break;case _0x2b51('0x8d'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x8e');_0x460b66[_0x2b51('0x77')]=[{'name':_0x2b51('0x8f'),'field':_0x2b51('0x2e'),'foreignKey':'projectName'}];break;case _0x2b51('0x90'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x91');break;case _0x2b51('0x92'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x93');_0x460b66[_0x2b51('0x77')]=[{'name':_0x2b51('0x94'),'field':'id','foreignKey':_0x2b51('0x95')}];break;case _0x2b51('0x96'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x97');break;case _0x2b51('0x98'):_0x460b66['childModel']='CmCompany';break;case _0x2b51('0x99'):_0x460b66['childModel']='CmCustomField';break;case _0x2b51('0x9a'):_0x460b66[_0x2b51('0x75')]='ChatQueue';break;case _0x2b51('0x9b'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x9c');break;case _0x2b51('0x9d'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x9e');break;case'faxaccounts':_0x460b66['childModel']=_0x2b51('0x9f');break;case _0x2b51('0xa0'):case _0x2b51('0xa1'):case _0x2b51('0xa2'):_0x460b66[_0x2b51('0x75')]='VoiceExtension';break;case'contexts':_0x460b66[_0x2b51('0x75')]=_0x2b51('0xa3');break;case _0x2b51('0xa4'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xa5');break;case'voicerecordings':_0x460b66[_0x2b51('0x75')]=_0x2b51('0xa6');_0x460b66[_0x2b51('0x77')]=[{'name':_0x2b51('0xa7'),'field':_0x2b51('0x2e'),'foreignKey':_0x2b51('0xa8'),'model':_0x2b51('0xa9'),'filter':{'field':_0x2b51('0xaa'),'value':[_0x2b51('0xab')]}},{'name':_0x2b51('0xac'),'field':_0x2b51('0x2e'),'foreignKey':_0x2b51('0xa8'),'model':_0x2b51('0xa9'),'filter':{'field':_0x2b51('0xaa'),'value':[_0x2b51('0xad')]}},{'name':_0x2b51('0xae'),'field':_0x2b51('0x2e'),'foreignKey':_0x2b51('0xaf'),'model':_0x2b51('0xb0'),'filter':{'field':_0x2b51('0x31'),'value':[_0x2b51('0xb1')]}},{'name':_0x2b51('0xb2'),'field':_0x2b51('0x2e'),'foreignKey':_0x2b51('0xaf'),'model':'VoiceQueue','filter':{'field':_0x2b51('0x31'),'value':[_0x2b51('0xb3')]}}];break;case _0x2b51('0xb4'):_0x460b66[_0x2b51('0x75')]='VoiceMusicOnHold';break;case _0x2b51('0xb5'):_0x460b66['childModel']='VoiceChanSpy';break;case _0x2b51('0xb6'):_0x460b66['childModel']=_0x2b51('0xb7');break;case _0x2b51('0xb8'):_0x460b66[_0x2b51('0x75')]='Campaign';break;case _0x2b51('0xb9'):_0x460b66['childModel']=_0x2b51('0xba');break;case _0x2b51('0xbb'):_0x460b66['childModel']=_0x2b51('0xbc');break;case _0x2b51('0xbd'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xbe');break;case _0x2b51('0xbf'):_0x460b66[_0x2b51('0x75')]='OpenchannelQueue';break;case _0x2b51('0xc0'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xc1');break;case'smsqueues':_0x460b66[_0x2b51('0x75')]=_0x2b51('0xc2');break;case'smsaccounts':_0x460b66['childModel']=_0x2b51('0xc3');break;case _0x2b51('0xc4'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xc5');break;case _0x2b51('0xc6'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xc7');break;case _0x2b51('0xc8'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xc9');break;case _0x2b51('0xca'):case _0x2b51('0xcb'):_0x460b66[_0x2b51('0x75')]='VoiceQueue';if(_0x18055c){_0x460b66['parentSections']=[{'name':_0x2b51('0xae')},{'name':_0x2b51('0xb2')}];}break;case'users':case _0x2b51('0xcc'):case _0x2b51('0xcd'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xa9');if(_0x18055c){_0x460b66[_0x2b51('0x77')]=[{'name':_0x2b51('0xce'),'filter':{'field':'role','value':[_0x2b51('0xcf'),_0x2b51('0xd0')]},'ignore':!![]},{'name':_0x2b51('0xa7')},{'name':'Telephones'}];}break;case _0x2b51('0xd1'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xd2');break;case _0x2b51('0xd3'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xd4');break;case _0x2b51('0xd5'):_0x460b66['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x460b66[_0x2b51('0x75')]='SugarcrmAccount';break;case _0x2b51('0xd6'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xd7');break;case _0x2b51('0xd8'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xd9');break;case _0x2b51('0xda'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xa9');break;case _0x2b51('0xdb'):_0x460b66[_0x2b51('0x75')]='CannedAnswer';break;case _0x2b51('0xdc'):_0x460b66[_0x2b51('0x75')]='Disposition';break;case'customdashboards':_0x460b66[_0x2b51('0x75')]=_0x2b51('0x68');break;case _0x2b51('0xdd'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xde');break;case _0x2b51('0xdf'):_0x460b66['childModel']=_0x2b51('0xe0');break;case _0x2b51('0xe1'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xe2');break;case _0x2b51('0xe3'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xe4');break;case _0x2b51('0xe5'):_0x460b66['childModel']=_0x2b51('0x85');break;case'templates':_0x460b66[_0x2b51('0x75')]=_0x2b51('0xe6');break;case _0x2b51('0xe7'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xe8');break;case _0x2b51('0xe9'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xea');break;case _0x2b51('0xeb'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xec');break;case _0x2b51('0xed'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0x6a');break;case _0x2b51('0xee'):_0x460b66['childModel']=_0x2b51('0x7d');_0x460b66['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x2b51('0x82')}];break;case _0x2b51('0xef'):_0x460b66[_0x2b51('0x75')]=_0x2b51('0xf0');break;case _0x2b51('0xc6'):_0x460b66[_0x2b51('0x75')]='WhatsappAccount';break;default:return _0x460b66;}return _0x460b66;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 33e425f..4835e4e 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 _0xa683=['update','remove','emit','hasOwnProperty','exports','events','UserProfile','setMaxListeners','save'];(function(_0x375923,_0x3bf77f){var _0x3f15ab=function(_0x4f4037){while(--_0x4f4037){_0x375923['push'](_0x375923['shift']());}};_0x3f15ab(++_0x3bf77f);}(_0xa683,0xa7));var _0x3a68=function(_0x533c20,_0x2073c2){_0x533c20=_0x533c20-0x0;var _0x34d588=_0xa683[_0x533c20];return _0x34d588;};'use strict';var EventEmitter=require(_0x3a68('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x3a68('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a68('0x2')](0x0);var events={'afterCreate':_0x3a68('0x3'),'afterUpdate':_0x3a68('0x4'),'afterDestroy':_0x3a68('0x5')};function emitEvent(_0xa07011){return function(_0x3f1ea1,_0x39a4bd,_0x12c59e){UserProfileEvents[_0x3a68('0x6')](_0xa07011+':'+_0x3f1ea1['id'],_0x3f1ea1);UserProfileEvents['emit'](_0xa07011,_0x3f1ea1);_0x12c59e(null);};}for(var e in events){if(events[_0x3a68('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3a68('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x12d5=['UserProfile','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4ff9f,_0x1cf968){var _0x58bf13=function(_0x3c6e71){while(--_0x3c6e71){_0x4ff9f['push'](_0x4ff9f['shift']());}};_0x58bf13(++_0x1cf968);}(_0x12d5,0xbb));var _0x512d=function(_0x3bc958,_0x45d34a){_0x3bc958=_0x3bc958-0x0;var _0x3d136e=_0x12d5[_0x3bc958];return _0x3d136e;};'use strict';var EventEmitter=require(_0x512d('0x0'));var UserProfile=require(_0x512d('0x1'))['db'][_0x512d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x512d('0x3'),'afterUpdate':_0x512d('0x4'),'afterDestroy':_0x512d('0x5')};function emitEvent(_0x35b986){return function(_0x517b8f,_0x438abb,_0x435138){UserProfileEvents['emit'](_0x35b986+':'+_0x517b8f['id'],_0x517b8f);UserProfileEvents[_0x512d('0x6')](_0x35b986,_0x517b8f);_0x435138(null);};}for(var e in events){if(events[_0x512d('0x7')](e)){var event=events[e];UserProfile[_0x512d('0x8')](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 1fe5bfa..3199db8 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 _0xd265=['./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x96443,_0x211ad4){var _0x4e91b1=function(_0xab625d){while(--_0xab625d){_0x96443['push'](_0x96443['shift']());}};_0x4e91b1(++_0x211ad4);}(_0xd265,0x131));var _0x5d26=function(_0xc5a932,_0x11ff7a){_0xc5a932=_0xc5a932-0x0;var _0x4da333=_0xd265[_0xc5a932];return _0x4da333;};'use strict';var _=require(_0x5d26('0x0'));var util=require(_0x5d26('0x1'));var logger=require(_0x5d26('0x2'))(_0x5d26('0x3'));var moment=require(_0x5d26('0x4'));var BPromise=require(_0x5d26('0x5'));var rp=require(_0x5d26('0x6'));var fs=require('fs');var path=require(_0x5d26('0x7'));var rimraf=require(_0x5d26('0x8'));var config=require(_0x5d26('0x9'));var attributes=require(_0x5d26('0xa'));module[_0x5d26('0xb')]=function(_0x22f30a,_0x3145ec){return _0x22f30a[_0x5d26('0xc')](_0x5d26('0xd'),attributes,{'tableName':_0x5d26('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8de9=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util'];(function(_0x43f251,_0x485c88){var _0x5196b4=function(_0x42e438){while(--_0x42e438){_0x43f251['push'](_0x43f251['shift']());}};_0x5196b4(++_0x485c88);}(_0x8de9,0x1c5));var _0x98de=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0x8de9[_0x5880d8];return _0x88264a;};'use strict';var _=require(_0x98de('0x0'));var util=require(_0x98de('0x1'));var logger=require(_0x98de('0x2'))(_0x98de('0x3'));var moment=require(_0x98de('0x4'));var BPromise=require('bluebird');var rp=require(_0x98de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98de('0x6'));var config=require(_0x98de('0x7'));var attributes=require(_0x98de('0x8'));module[_0x98de('0x9')]=function(_0x2f5e28,_0x5116c7){return _0x2f5e28[_0x98de('0xa')](_0x98de('0xb'),attributes,{'tableName':_0x98de('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 5842c5d..90cf36b 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 _0xeda8=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xeda8,0x104));var _0x8eda=function(_0x41f33d,_0x3679ca){_0x41f33d=_0x41f33d-0x0;var _0x536f16=_0xeda8[_0x41f33d];return _0x536f16;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});config[_0x8eda('0xd')]=_['defaults'](config[_0x8eda('0xd')],{'host':_0x8eda('0xe'),'port':0x18eb});var socket=require(_0x8eda('0xf'))(new Redis(config[_0x8eda('0xd')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x488849,_0x4fbf0a,_0xe69181){return new BPromise(function(_0x2d3739,_0x41442d){return client['request'](_0x488849,_0xe69181)[_0x8eda('0x10')](function(_0x5a80ca){logger[_0x8eda('0x11')](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));logger[_0x8eda('0x14')](_0x8eda('0x15'),_0x4fbf0a,_0x8eda('0x13'),JSON[_0x8eda('0x16')](_0x5a80ca));if(_0x5a80ca[_0x8eda('0x17')]){if(_0x5a80ca['error']['code']===0x1f4){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x41442d(_0x5a80ca[_0x8eda('0x17')][_0x8eda('0x18')]);}logger['error'](_0x8eda('0x12'),_0x4fbf0a,_0x5a80ca['error'][_0x8eda('0x18')]);return _0x2d3739(_0x5a80ca['error'][_0x8eda('0x18')]);}else{logger['info'](_0x8eda('0x12'),_0x4fbf0a,_0x8eda('0x13'));_0x2d3739(_0x5a80ca['result']['message']);}})[_0x8eda('0x19')](function(_0x1b7e94){logger[_0x8eda('0x17')](_0x8eda('0x12'),_0x4fbf0a,_0x1b7e94);_0x41442d(_0x1b7e94);});});} \ No newline at end of file +var _0x7da7=['error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x90dcce,_0x1de4a3){var _0x3a9b82=function(_0x21aae1){while(--_0x21aae1){_0x90dcce['push'](_0x90dcce['shift']());}};_0x3a9b82(++_0x1de4a3);}(_0x7da7,0x10d));var _0x77da=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x7da7[_0x1034ee];return _0x2922af;};'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});config[_0x77da('0x9')]=_['defaults'](config[_0x77da('0x9')],{'host':_0x77da('0xa'),'port':0x18eb});var socket=require(_0x77da('0xb'))(new Redis(config[_0x77da('0x9')]));require(_0x77da('0xc'))['register'](socket);function respondWithRpcPromise(_0x40c86e,_0xb55827,_0x172d7f){return new BPromise(function(_0x5ea12f,_0x35d06e){return client[_0x77da('0xd')](_0x40c86e,_0x172d7f)[_0x77da('0xe')](function(_0x2a675a){logger['info'](_0x77da('0xf'),_0xb55827,_0x77da('0x10'));logger[_0x77da('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xb55827,'request\x20sent',JSON[_0x77da('0x12')](_0x2a675a));if(_0x2a675a[_0x77da('0x13')]){if(_0x2a675a['error'][_0x77da('0x14')]===0x1f4){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')]['message']);return _0x35d06e(_0x2a675a[_0x77da('0x13')]['message']);}logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x2a675a[_0x77da('0x13')][_0x77da('0x15')]);return _0x5ea12f(_0x2a675a['error']['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0xb55827,_0x77da('0x10'));_0x5ea12f(_0x2a675a[_0x77da('0x16')][_0x77da('0x15')]);}})[_0x77da('0x17')](function(_0x19a00c){logger[_0x77da('0x13')](_0x77da('0xf'),_0xb55827,_0x19a00c);_0x35d06e(_0x19a00c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a20772c..ce2f781 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 _0xc6e7=['removeListener','register','./userProfile.events','save','remove','update','emit'];(function(_0x4faf34,_0x217679){var _0x4e431f=function(_0x3da540){while(--_0x3da540){_0x4faf34['push'](_0x4faf34['shift']());}};_0x4e431f(++_0x217679);}(_0xc6e7,0x1de));var _0x7c6e=function(_0x4d246d,_0x18a8df){_0x4d246d=_0x4d246d-0x0;var _0x41096a=_0xc6e7[_0x4d246d];return _0x41096a;};'use strict';var UserProfileEvents=require(_0x7c6e('0x0'));var events=[_0x7c6e('0x1'),_0x7c6e('0x2'),_0x7c6e('0x3')];function createListener(_0x281cdc,_0x4595f4){return function(_0x487871){_0x4595f4[_0x7c6e('0x4')](_0x281cdc,_0x487871);};}function removeListener(_0xa91a88,_0x4aa4e5){return function(){UserProfileEvents[_0x7c6e('0x5')](_0xa91a88,_0x4aa4e5);};}exports[_0x7c6e('0x6')]=function(_0x2cd361){for(var _0x10cc10=0x0,_0x3435d9=events['length'];_0x10cc10<_0x3435d9;_0x10cc10++){var _0x4c6fb5=events[_0x10cc10];var _0x1f713f=createListener('userProfile:'+_0x4c6fb5,_0x2cd361);UserProfileEvents['on'](_0x4c6fb5,_0x1f713f);}}; \ No newline at end of file +var _0x072c=['register','length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener'];(function(_0x366419,_0x256478){var _0x1eb691=function(_0x2051ec){while(--_0x2051ec){_0x366419['push'](_0x366419['shift']());}};_0x1eb691(++_0x256478);}(_0x072c,0x6f));var _0xc072=function(_0x3612c6,_0x40c134){_0x3612c6=_0x3612c6-0x0;var _0x2f1465=_0x072c[_0x3612c6];return _0x2f1465;};'use strict';var UserProfileEvents=require(_0xc072('0x0'));var events=[_0xc072('0x1'),_0xc072('0x2'),_0xc072('0x3')];function createListener(_0x1bfddf,_0x3768d5){return function(_0x45624c){_0x3768d5[_0xc072('0x4')](_0x1bfddf,_0x45624c);};}function removeListener(_0x4702b2,_0x4301b2){return function(){UserProfileEvents[_0xc072('0x5')](_0x4702b2,_0x4301b2);};}exports[_0xc072('0x6')]=function(_0x1b483c){for(var _0x2ebe39=0x0,_0x5ceca2=events[_0xc072('0x7')];_0x2ebe39<_0x5ceca2;_0x2ebe39++){var _0x5900b8=events[_0x2ebe39];var _0x166805=createListener(_0xc072('0x8')+_0x5900b8,_0x1b483c);UserProfileEvents['on'](_0x5900b8,_0x166805);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c8e59cf..5fdb3d7 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 _0xb24d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb24d,0x1b4));var _0xdb24=function(_0x12b2c2,_0x21bb82){_0x12b2c2=_0x12b2c2-0x0;var _0x4380a4=_0xb24d[_0x12b2c2];return _0x4380a4;};'use strict';var multer=require('multer');var util=require(_0xdb24('0x0'));var path=require(_0xdb24('0x1'));var timeout=require(_0xdb24('0x2'));var express=require(_0xdb24('0x3'));var router=express['Router']();var auth=require(_0xdb24('0x4'));var interaction=require(_0xdb24('0x5'));var config=require(_0xdb24('0x6'));var controller=require(_0xdb24('0x7'));router[_0xdb24('0x8')]('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0xa')]);router[_0xdb24('0x8')](_0xdb24('0xb'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xc')]);router['get'](_0xdb24('0xd'),auth[_0xdb24('0x9')](),controller[_0xdb24('0xe')]);router['post']('/',auth[_0xdb24('0x9')](),controller[_0xdb24('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdb24('0x10')]);router['delete'](_0xdb24('0xd'),auth['isAuthenticated'](),controller[_0xdb24('0x11')]);module[_0xdb24('0x12')]=router; \ No newline at end of file +var _0x9820=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x3784ce,_0x148f8d){var _0x5c2c5c=function(_0x171bd5){while(--_0x171bd5){_0x3784ce['push'](_0x3784ce['shift']());}};_0x5c2c5c(++_0x148f8d);}(_0x9820,0xb6));var _0x0982=function(_0x3edaa9,_0x4aa1e3){_0x3edaa9=_0x3edaa9-0x0;var _0x2321e0=_0x9820[_0x3edaa9];return _0x2321e0;};'use strict';var multer=require(_0x0982('0x0'));var util=require('util');var path=require(_0x0982('0x1'));var timeout=require(_0x0982('0x2'));var express=require(_0x0982('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0982('0x4'));var config=require(_0x0982('0x5'));var controller=require(_0x0982('0x6'));router[_0x0982('0x7')]('/',auth[_0x0982('0x8')](),controller[_0x0982('0x9')]);router[_0x0982('0x7')](_0x0982('0xa'),auth[_0x0982('0x8')](),controller[_0x0982('0xb')]);router[_0x0982('0x7')](_0x0982('0xc'),auth[_0x0982('0x8')](),controller['show']);router[_0x0982('0xd')]('/',auth[_0x0982('0x8')](),controller[_0x0982('0xe')]);router[_0x0982('0xf')](_0x0982('0xc'),auth[_0x0982('0x8')](),controller[_0x0982('0x10')]);router['delete'](_0x0982('0xc'),auth['isAuthenticated'](),controller[_0x0982('0x11')]);module[_0x0982('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1b08125..b391456 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 _0x98ad=['INTEGER','exports','STRING'];(function(_0x5169bc,_0x2f6a79){var _0xd437b0=function(_0x5b42fd){while(--_0x5b42fd){_0x5169bc['push'](_0x5169bc['shift']());}};_0xd437b0(++_0x2f6a79);}(_0x98ad,0x1f0));var _0xd98a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x98ad[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xd98a('0x0')]={'name':{'type':Sequelize[_0xd98a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd98a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd98a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4678=['INTEGER','sequelize','exports','STRING'];(function(_0x3f1bd3,_0x5af0d9){var _0x5e313e=function(_0x2023b4){while(--_0x2023b4){_0x3f1bd3['push'](_0x3f1bd3['shift']());}};_0x5e313e(++_0x5af0d9);}(_0x4678,0x1bd));var _0x8467=function(_0x59920b,_0x41455e){_0x59920b=_0x59920b-0x0;var _0x77d561=_0x4678[_0x59920b];return _0x77d561;};'use strict';var Sequelize=require(_0x8467('0x0'));module[_0x8467('0x1')]={'name':{'type':Sequelize[_0x8467('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x8467('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8467('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1c3fc27..2290bb7 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 _0xcb99=['describe','html-pdf','rimraf','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','save','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','body'];(function(_0x592d66,_0x2d10a1){var _0x3ca426=function(_0x17aed7){while(--_0x17aed7){_0x592d66['push'](_0x592d66['shift']());}};_0x3ca426(++_0x2d10a1);}(_0xcb99,0x8b));var _0x9cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb99[_0x35e75a];return _0xb23c7f;};'use strict';var pdf=require(_0x9cb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9cb9('0x2'));var moment=require(_0x9cb9('0x3'));var BPromise=require(_0x9cb9('0x4'));var Mustache=require('mustache');var util=require(_0x9cb9('0x5'));var path=require(_0x9cb9('0x6'));var sox=require('sox');var csv=require(_0x9cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9cb9('0x8'));var squel=require(_0x9cb9('0x9'));var crypto=require(_0x9cb9('0xa'));var jsforce=require(_0x9cb9('0xb'));var deskjs=require(_0x9cb9('0xc'));var toCsv=require(_0x9cb9('0x7'));var querystring=require(_0x9cb9('0xd'));var Papa=require(_0x9cb9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9cb9('0xf'));var as=require(_0x9cb9('0x10'));var hardwareService=require(_0x9cb9('0x11'));var logger=require('../../config/logger')(_0x9cb9('0x12'));var utils=require(_0x9cb9('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227d49,_0x2e687e){_0x2e687e=_0x2e687e||0xcc;return function(_0x3382c8){if(_0x3382c8){return _0x227d49[_0x9cb9('0x14')](_0x2e687e);}return _0x227d49['status'](_0x2e687e)[_0x9cb9('0x15')]();};}function respondWithResult(_0x37dc98,_0x3ec500){_0x3ec500=_0x3ec500||0xc8;return function(_0x32352d){if(_0x32352d){return _0x37dc98[_0x9cb9('0x16')](_0x3ec500)[_0x9cb9('0x17')](_0x32352d);}};}function respondWithFilteredResult(_0xc0bf6,_0x2132be){return function(_0x3975a5){if(_0x3975a5){var _0x2275ca=_0x3975a5[_0x9cb9('0x18')],_0x107057=_0x2132be[_0x9cb9('0x19')],_0x191199=_0x2132be[_0x9cb9('0x19')]+_0x2132be[_0x9cb9('0x1a')],_0x220ee8;if(_0x191199>=_0x2275ca){_0x191199=_0x2275ca;_0x220ee8=0xc8;}else{_0x220ee8=0xce;}_0xc0bf6[_0x9cb9('0x16')](_0x220ee8);return _0xc0bf6['set']('Content-Range',_0x107057+'-'+_0x191199+'/'+_0x2275ca)[_0x9cb9('0x17')](_0x3975a5);}return null;};}function patchUpdates(_0x50169f){return function(_0x5ddf77){try{jsonpatch['apply'](_0x5ddf77,_0x50169f,!![]);}catch(_0x97ecd2){return BPromise['reject'](_0x97ecd2);}return _0x5ddf77[_0x9cb9('0x1b')]();};}function saveUpdates(_0x3b1244,_0xe2bd56){return function(_0xab3d4f){if(_0xab3d4f){return _0xab3d4f[_0x9cb9('0x1c')](_0x3b1244)[_0x9cb9('0x1d')](function(_0x345a21){return _0x345a21;});}return null;};}function removeEntity(_0x1375e3,_0x20d210){return function(_0x169948){if(_0x169948){return _0x169948[_0x9cb9('0x1e')]()[_0x9cb9('0x1d')](function(){_0x1375e3[_0x9cb9('0x16')](0xcc)[_0x9cb9('0x15')]();});}};}function handleEntityNotFound(_0x4cc235,_0x57fc41){return function(_0x3f2e58){if(!_0x3f2e58){_0x4cc235[_0x9cb9('0x14')](0x194);}return _0x3f2e58;};}function handleError(_0x274ab3,_0x377e6f){_0x377e6f=_0x377e6f||0x1f4;return function(_0x1a8d88){logger[_0x9cb9('0x1f')](_0x1a8d88[_0x9cb9('0x20')]);if(_0x1a8d88[_0x9cb9('0x21')]){delete _0x1a8d88[_0x9cb9('0x21')];}_0x274ab3['status'](_0x377e6f)[_0x9cb9('0x22')](_0x1a8d88);};}exports[_0x9cb9('0x23')]=function(_0x32f8e6,_0x40649c){var _0x4db8a4={},_0xa1a575={},_0x567e9b={'count':0x0,'rows':[]};var _0x263299=_[_0x9cb9('0x24')](db[_0x9cb9('0x25')][_0x9cb9('0x26')],function(_0x555ce5){return{'name':_0x555ce5[_0x9cb9('0x27')],'type':_0x555ce5[_0x9cb9('0x28')][_0x9cb9('0x29')]};});_0xa1a575['model']=_[_0x9cb9('0x24')](_0x263299,'name');_0xa1a575[_0x9cb9('0x2a')]=_[_0x9cb9('0x2b')](_0x32f8e6[_0x9cb9('0x2a')]);_0xa1a575[_0x9cb9('0x2c')]=_[_0x9cb9('0x2d')](_0xa1a575[_0x9cb9('0x2e')],_0xa1a575['query']);_0x4db8a4[_0x9cb9('0x2f')]=_[_0x9cb9('0x2d')](_0xa1a575[_0x9cb9('0x2e')],qs['fields'](_0x32f8e6['query'][_0x9cb9('0x30')]));_0x4db8a4[_0x9cb9('0x2f')]=_0x4db8a4[_0x9cb9('0x2f')]['length']?_0x4db8a4['attributes']:_0xa1a575[_0x9cb9('0x2e')];if(!_0x32f8e6[_0x9cb9('0x2a')]['hasOwnProperty'](_0x9cb9('0x31'))){_0x4db8a4[_0x9cb9('0x1a')]=qs[_0x9cb9('0x1a')](_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x1a')]);_0x4db8a4['offset']=qs[_0x9cb9('0x19')](_0x32f8e6[_0x9cb9('0x2a')]['offset']);}_0x4db8a4[_0x9cb9('0x32')]=qs['sort'](_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x33')]);_0x4db8a4['where']=qs['filters'](_[_0x9cb9('0x34')](_0x32f8e6[_0x9cb9('0x2a')],_0xa1a575[_0x9cb9('0x2c')]),_0x263299);if(_0x32f8e6[_0x9cb9('0x2a')][_0x9cb9('0x35')]){_0x4db8a4[_0x9cb9('0x36')]=_[_0x9cb9('0x37')](_0x4db8a4['where'],{'$or':_[_0x9cb9('0x24')](_0x263299,function(_0x95e15b){if(_0x95e15b[_0x9cb9('0x28')]!==_0x9cb9('0x38')){var _0x1ffd5a={};_0x1ffd5a[_0x95e15b[_0x9cb9('0x21')]]={'$like':'%'+_0x32f8e6['query'][_0x9cb9('0x35')]+'%'};return _0x1ffd5a;}})});}_0x4db8a4=_[_0x9cb9('0x37')]({},_0x4db8a4,_0x32f8e6[_0x9cb9('0x39')]);var _0x31f8d7={'where':_0x4db8a4[_0x9cb9('0x36')]};return db[_0x9cb9('0x25')][_0x9cb9('0x18')](_0x31f8d7)[_0x9cb9('0x1d')](function(_0x481377){_0x567e9b['count']=_0x481377;if(_0x32f8e6[_0x9cb9('0x2a')]['includeAll']){_0x4db8a4[_0x9cb9('0x3a')]=[{'all':!![]}];}return db['UserProfileResource'][_0x9cb9('0x3b')](_0x4db8a4);})[_0x9cb9('0x1d')](function(_0x250244){_0x567e9b[_0x9cb9('0x3c')]=_0x250244;return _0x567e9b;})['then'](respondWithFilteredResult(_0x40649c,_0x4db8a4))[_0x9cb9('0x3d')](handleError(_0x40649c,null));};exports['show']=function(_0x9a4f8,_0x3e8aad){var _0x5ac1d7={'raw':![],'where':{'id':_0x9a4f8[_0x9cb9('0x3e')]['id']}},_0x11435f={};_0x11435f['model']=_[_0x9cb9('0x2b')](db[_0x9cb9('0x25')][_0x9cb9('0x26')]);_0x11435f[_0x9cb9('0x2a')]=_[_0x9cb9('0x2b')](_0x9a4f8[_0x9cb9('0x2a')]);_0x11435f[_0x9cb9('0x2c')]=_[_0x9cb9('0x2d')](_0x11435f[_0x9cb9('0x2e')],_0x11435f['query']);_0x5ac1d7[_0x9cb9('0x2f')]=_[_0x9cb9('0x2d')](_0x11435f[_0x9cb9('0x2e')],qs[_0x9cb9('0x30')](_0x9a4f8[_0x9cb9('0x2a')]['fields']));_0x5ac1d7[_0x9cb9('0x2f')]=_0x5ac1d7[_0x9cb9('0x2f')][_0x9cb9('0x3f')]?_0x5ac1d7['attributes']:_0x11435f[_0x9cb9('0x2e')];if(_0x9a4f8[_0x9cb9('0x2a')][_0x9cb9('0x40')]){_0x5ac1d7['include']=[{'all':!![]}];}_0x5ac1d7=_[_0x9cb9('0x37')]({},_0x5ac1d7,_0x9a4f8[_0x9cb9('0x39')]);return db[_0x9cb9('0x25')][_0x9cb9('0x41')](_0x5ac1d7)[_0x9cb9('0x1d')](handleEntityNotFound(_0x3e8aad,null))[_0x9cb9('0x1d')](respondWithResult(_0x3e8aad,null))['catch'](handleError(_0x3e8aad,null));};exports[_0x9cb9('0x42')]=function(_0xcc8fb2,_0xf1326d){return db[_0x9cb9('0x25')][_0x9cb9('0x42')](_0xcc8fb2[_0x9cb9('0x43')],{})[_0x9cb9('0x1d')](respondWithResult(_0xf1326d,0xc9))[_0x9cb9('0x3d')](handleError(_0xf1326d,null));};exports[_0x9cb9('0x1c')]=function(_0x28efec,_0x11e990){if(_0x28efec[_0x9cb9('0x43')]['id']){delete _0x28efec[_0x9cb9('0x43')]['id'];}return db['UserProfileResource'][_0x9cb9('0x41')]({'where':{'id':_0x28efec['params']['id']}})[_0x9cb9('0x1d')](handleEntityNotFound(_0x11e990,null))[_0x9cb9('0x1d')](saveUpdates(_0x28efec[_0x9cb9('0x43')],null))['then'](respondWithResult(_0x11e990,null))[_0x9cb9('0x3d')](handleError(_0x11e990,null));};exports[_0x9cb9('0x1e')]=function(_0x32d39f,_0x9da13e){return db['UserProfileResource']['find']({'where':{'id':_0x32d39f['params']['id']}})['then'](handleEntityNotFound(_0x9da13e,null))['then'](removeEntity(_0x9da13e,null))['catch'](handleError(_0x9da13e,null));};exports[_0x9cb9('0x44')]=function(_0x4490ec,_0x5ffd1e){return db['UserProfileResource'][_0x9cb9('0x44')]()[_0x9cb9('0x1d')](respondWithResult(_0x5ffd1e,null))[_0x9cb9('0x3d')](handleError(_0x5ffd1e,null));}; \ No newline at end of file +var _0x5178=['pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3174a1,_0x3b864a){var _0x1e06c8=function(_0x1959f7){while(--_0x1959f7){_0x3174a1['push'](_0x3174a1['shift']());}};_0x1e06c8(++_0x3b864a);}(_0x5178,0x171));var _0x8517=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5178[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8517('0x0'));var rimraf=require(_0x8517('0x1'));var zipdir=require(_0x8517('0x2'));var jsonpatch=require(_0x8517('0x3'));var rp=require(_0x8517('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8517('0x5'));var util=require(_0x8517('0x6'));var path=require('path');var sox=require(_0x8517('0x7'));var csv=require('to-csv');var ejs=require(_0x8517('0x8'));var fs=require('fs');var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xe'));var authService=require(_0x8517('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8517('0x10'));var hardwareService=require(_0x8517('0x11'));var logger=require(_0x8517('0x12'))(_0x8517('0x13'));var utils=require(_0x8517('0x14'));var config=require(_0x8517('0x15'));var db=require(_0x8517('0x16'))['db'];function respondWithStatusCode(_0x12388f,_0x4b9768){_0x4b9768=_0x4b9768||0xcc;return function(_0x9c57de){if(_0x9c57de){return _0x12388f[_0x8517('0x17')](_0x4b9768);}return _0x12388f[_0x8517('0x18')](_0x4b9768)[_0x8517('0x19')]();};}function respondWithResult(_0x284a05,_0x49eba7){_0x49eba7=_0x49eba7||0xc8;return function(_0x385219){if(_0x385219){return _0x284a05[_0x8517('0x18')](_0x49eba7)[_0x8517('0x1a')](_0x385219);}};}function respondWithFilteredResult(_0x100280,_0x411d29){return function(_0x18a984){if(_0x18a984){var _0x260a15=_0x18a984[_0x8517('0x1b')],_0x30cea1=_0x411d29[_0x8517('0x1c')],_0x504a92=_0x411d29['offset']+_0x411d29[_0x8517('0x1d')],_0x2953dd;if(_0x504a92>=_0x260a15){_0x504a92=_0x260a15;_0x2953dd=0xc8;}else{_0x2953dd=0xce;}_0x100280[_0x8517('0x18')](_0x2953dd);return _0x100280[_0x8517('0x1e')](_0x8517('0x1f'),_0x30cea1+'-'+_0x504a92+'/'+_0x260a15)[_0x8517('0x1a')](_0x18a984);}return null;};}function patchUpdates(_0x24ca7e){return function(_0x1bfbc1){try{jsonpatch['apply'](_0x1bfbc1,_0x24ca7e,!![]);}catch(_0xd37bf1){return BPromise['reject'](_0xd37bf1);}return _0x1bfbc1['save']();};}function saveUpdates(_0x23f7d2,_0x157bea){return function(_0xf35d95){if(_0xf35d95){return _0xf35d95[_0x8517('0x20')](_0x23f7d2)[_0x8517('0x21')](function(_0xdfde16){return _0xdfde16;});}return null;};}function removeEntity(_0x512458,_0x4b145f){return function(_0x2dd1df){if(_0x2dd1df){return _0x2dd1df[_0x8517('0x22')]()[_0x8517('0x21')](function(){_0x512458[_0x8517('0x18')](0xcc)[_0x8517('0x19')]();});}};}function handleEntityNotFound(_0x2e6e47,_0x5f02ee){return function(_0x181500){if(!_0x181500){_0x2e6e47[_0x8517('0x17')](0x194);}return _0x181500;};}function handleError(_0x5578f0,_0x7f4cf8){_0x7f4cf8=_0x7f4cf8||0x1f4;return function(_0x2febd5){logger[_0x8517('0x23')](_0x2febd5['stack']);if(_0x2febd5[_0x8517('0x24')]){delete _0x2febd5['name'];}_0x5578f0[_0x8517('0x18')](_0x7f4cf8)[_0x8517('0x25')](_0x2febd5);};}exports[_0x8517('0x26')]=function(_0x2b0c19,_0x238f2c){var _0x300e3f={},_0x481ceb={},_0x39764e={'count':0x0,'rows':[]};var _0x51d516=_[_0x8517('0x27')](db[_0x8517('0x28')][_0x8517('0x29')],function(_0x355aa6){return{'name':_0x355aa6[_0x8517('0x2a')],'type':_0x355aa6[_0x8517('0x2b')]['key']};});_0x481ceb[_0x8517('0x2c')]=_['map'](_0x51d516,_0x8517('0x24'));_0x481ceb[_0x8517('0x2d')]=_[_0x8517('0x2e')](_0x2b0c19[_0x8517('0x2d')]);_0x481ceb[_0x8517('0x2f')]=_[_0x8517('0x30')](_0x481ceb[_0x8517('0x2c')],_0x481ceb[_0x8517('0x2d')]);_0x300e3f[_0x8517('0x31')]=_['intersection'](_0x481ceb[_0x8517('0x2c')],qs[_0x8517('0x32')](_0x2b0c19[_0x8517('0x2d')]['fields']));_0x300e3f['attributes']=_0x300e3f['attributes'][_0x8517('0x33')]?_0x300e3f[_0x8517('0x31')]:_0x481ceb[_0x8517('0x2c')];if(!_0x2b0c19[_0x8517('0x2d')][_0x8517('0x34')](_0x8517('0x35'))){_0x300e3f['limit']=qs[_0x8517('0x1d')](_0x2b0c19[_0x8517('0x2d')][_0x8517('0x1d')]);_0x300e3f['offset']=qs[_0x8517('0x1c')](_0x2b0c19['query'][_0x8517('0x1c')]);}_0x300e3f[_0x8517('0x36')]=qs['sort'](_0x2b0c19['query'][_0x8517('0x37')]);_0x300e3f[_0x8517('0x38')]=qs[_0x8517('0x2f')](_[_0x8517('0x39')](_0x2b0c19['query'],_0x481ceb['filters']),_0x51d516);if(_0x2b0c19[_0x8517('0x2d')][_0x8517('0x3a')]){_0x300e3f[_0x8517('0x38')]=_['merge'](_0x300e3f[_0x8517('0x38')],{'$or':_[_0x8517('0x27')](_0x51d516,function(_0x4afa5b){if(_0x4afa5b[_0x8517('0x2b')]!==_0x8517('0x3b')){var _0x15e5f0={};_0x15e5f0[_0x4afa5b[_0x8517('0x24')]]={'$like':'%'+_0x2b0c19['query'][_0x8517('0x3a')]+'%'};return _0x15e5f0;}})});}_0x300e3f=_[_0x8517('0x3c')]({},_0x300e3f,_0x2b0c19[_0x8517('0x3d')]);var _0x36ff78={'where':_0x300e3f[_0x8517('0x38')]};return db[_0x8517('0x28')][_0x8517('0x1b')](_0x36ff78)[_0x8517('0x21')](function(_0x3f338a){_0x39764e[_0x8517('0x1b')]=_0x3f338a;if(_0x2b0c19[_0x8517('0x2d')][_0x8517('0x3e')]){_0x300e3f[_0x8517('0x3f')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x300e3f);})[_0x8517('0x21')](function(_0x24a74b){_0x39764e[_0x8517('0x40')]=_0x24a74b;return _0x39764e;})[_0x8517('0x21')](respondWithFilteredResult(_0x238f2c,_0x300e3f))[_0x8517('0x41')](handleError(_0x238f2c,null));};exports['show']=function(_0x2456c9,_0x5a35cd){var _0x531ca7={'raw':![],'where':{'id':_0x2456c9[_0x8517('0x42')]['id']}},_0x1472f3={};_0x1472f3[_0x8517('0x2c')]=_[_0x8517('0x2e')](db['UserProfileResource'][_0x8517('0x29')]);_0x1472f3[_0x8517('0x2d')]=_['keys'](_0x2456c9[_0x8517('0x2d')]);_0x1472f3[_0x8517('0x2f')]=_[_0x8517('0x30')](_0x1472f3['model'],_0x1472f3[_0x8517('0x2d')]);_0x531ca7[_0x8517('0x31')]=_[_0x8517('0x30')](_0x1472f3[_0x8517('0x2c')],qs[_0x8517('0x32')](_0x2456c9[_0x8517('0x2d')][_0x8517('0x32')]));_0x531ca7['attributes']=_0x531ca7[_0x8517('0x31')][_0x8517('0x33')]?_0x531ca7['attributes']:_0x1472f3[_0x8517('0x2c')];if(_0x2456c9[_0x8517('0x2d')][_0x8517('0x3e')]){_0x531ca7[_0x8517('0x3f')]=[{'all':!![]}];}_0x531ca7=_[_0x8517('0x3c')]({},_0x531ca7,_0x2456c9[_0x8517('0x3d')]);return db['UserProfileResource'][_0x8517('0x43')](_0x531ca7)[_0x8517('0x21')](handleEntityNotFound(_0x5a35cd,null))[_0x8517('0x21')](respondWithResult(_0x5a35cd,null))['catch'](handleError(_0x5a35cd,null));};exports[_0x8517('0x44')]=function(_0x197480,_0x56d08b){return db[_0x8517('0x28')][_0x8517('0x44')](_0x197480['body'],{})['then'](respondWithResult(_0x56d08b,0xc9))['catch'](handleError(_0x56d08b,null));};exports[_0x8517('0x20')]=function(_0x250a14,_0x4ec257){if(_0x250a14[_0x8517('0x45')]['id']){delete _0x250a14['body']['id'];}return db['UserProfileResource'][_0x8517('0x43')]({'where':{'id':_0x250a14[_0x8517('0x42')]['id']}})[_0x8517('0x21')](handleEntityNotFound(_0x4ec257,null))[_0x8517('0x21')](saveUpdates(_0x250a14['body'],null))[_0x8517('0x21')](respondWithResult(_0x4ec257,null))[_0x8517('0x41')](handleError(_0x4ec257,null));};exports[_0x8517('0x22')]=function(_0x5a6812,_0x15102f){return db[_0x8517('0x28')][_0x8517('0x43')]({'where':{'id':_0x5a6812[_0x8517('0x42')]['id']}})[_0x8517('0x21')](handleEntityNotFound(_0x15102f,null))[_0x8517('0x21')](removeEntity(_0x15102f,null))[_0x8517('0x41')](handleError(_0x15102f,null));};exports['describe']=function(_0x3a5adb,_0x5a8724){return db['UserProfileResource'][_0x8517('0x46')]()[_0x8517('0x21')](respondWithResult(_0x5a8724,null))[_0x8517('0x41')](handleError(_0x5a8724,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index b99dcd9..088e82a 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 _0xe706=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x463f89,_0xf317cf){var _0x1e0849=function(_0x1cd10b){while(--_0x1cd10b){_0x463f89['push'](_0x463f89['shift']());}};_0x1e0849(++_0xf317cf);}(_0xe706,0xa3));var _0x6e70=function(_0x58fac8,_0x5ec989){_0x58fac8=_0x58fac8-0x0;var _0x4a560e=_0xe706[_0x58fac8];return _0x4a560e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xf'),_0x6e70('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['compositeIndex','resourceId','sectionId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserProfileResource','user_profile_has_resources'];(function(_0x1a5848,_0x2ecdd9){var _0x1c289f=function(_0x134fed){while(--_0x134fed){_0x1a5848['push'](_0x1a5848['shift']());}};_0x1c289f(++_0x2ecdd9);}(_0x1339,0x1ed));var _0x9133=function(_0x1c881b,_0x4fe23a){_0x1c881b=_0x1c881b-0x0;var _0x3408e7=_0x1339[_0x1c881b];return _0x3408e7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[{'name':_0x9133('0xb'),'fields':[_0x9133('0xc'),_0x9133('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 510a5d1..d3dfc78 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 _0x9c91=['info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x9c91,0x153));var _0x19c9=function(_0x51e351,_0x3540d8){_0x51e351=_0x51e351-0x0;var _0x30acd5=_0x9c91[_0x51e351];return _0x30acd5;};'use strict';var _=require(_0x19c9('0x0'));var util=require(_0x19c9('0x1'));var moment=require(_0x19c9('0x2'));var BPromise=require(_0x19c9('0x3'));var rs=require(_0x19c9('0x4'));var fs=require('fs');var Redis=require(_0x19c9('0x5'));var db=require(_0x19c9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x19c9('0x7'));var config=require(_0x19c9('0x8'));var jayson=require(_0x19c9('0x9'));var client=jayson[_0x19c9('0xa')][_0x19c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x360055,_0x25bb76,_0x2ed2ac){return new BPromise(function(_0x3a5fde,_0x5e9701){return client[_0x19c9('0xc')](_0x360055,_0x2ed2ac)['then'](function(_0x38adfa){logger[_0x19c9('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x25bb76,_0x19c9('0xe'));logger[_0x19c9('0xf')](_0x19c9('0x10'),_0x25bb76,_0x19c9('0xe'),JSON['stringify'](_0x38adfa));if(_0x38adfa[_0x19c9('0x11')]){if(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x12')]===0x1f4){logger[_0x19c9('0x11')](_0x19c9('0x13'),_0x25bb76,_0x38adfa['error']['message']);return _0x5e9701(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);}logger['error'](_0x19c9('0x13'),_0x25bb76,_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);return _0x3a5fde(_0x38adfa[_0x19c9('0x11')][_0x19c9('0x14')]);}else{logger[_0x19c9('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x25bb76,_0x19c9('0xe'));_0x3a5fde(_0x38adfa[_0x19c9('0x15')]['message']);}})['catch'](function(_0x30d332){logger['error'](_0x19c9('0x13'),_0x25bb76,_0x30d332);_0x5e9701(_0x30d332);});});} \ No newline at end of file +var _0x8f64=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x41e590,_0x1b06a3){var _0x5266d7=function(_0x2ac434){while(--_0x2ac434){_0x41e590['push'](_0x41e590['shift']());}};_0x5266d7(++_0x1b06a3);}(_0x8f64,0x69));var _0x48f6=function(_0x562a24,_0x4a8a60){_0x562a24=_0x562a24-0x0;var _0x31977e=_0x8f64[_0x562a24];return _0x31977e;};'use strict';var _=require(_0x48f6('0x0'));var util=require(_0x48f6('0x1'));var moment=require(_0x48f6('0x2'));var BPromise=require(_0x48f6('0x3'));var rs=require(_0x48f6('0x4'));var fs=require('fs');var Redis=require(_0x48f6('0x5'));var db=require(_0x48f6('0x6'))['db'];var utils=require(_0x48f6('0x7'));var logger=require('../../config/logger')(_0x48f6('0x8'));var config=require('../../config/environment');var jayson=require(_0x48f6('0x9'));var client=jayson[_0x48f6('0xa')][_0x48f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d71b2,_0x3f1a6e,_0x25e062){return new BPromise(function(_0x23d4bb,_0x5357d1){return client['request'](_0x5d71b2,_0x25e062)['then'](function(_0x536d6d){logger[_0x48f6('0xc')](_0x48f6('0xd'),_0x3f1a6e,_0x48f6('0xe'));logger[_0x48f6('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3f1a6e,_0x48f6('0xe'),JSON[_0x48f6('0x10')](_0x536d6d));if(_0x536d6d[_0x48f6('0x11')]){if(_0x536d6d['error'][_0x48f6('0x12')]===0x1f4){logger[_0x48f6('0x11')](_0x48f6('0xd'),_0x3f1a6e,_0x536d6d['error']['message']);return _0x5357d1(_0x536d6d['error'][_0x48f6('0x13')]);}logger[_0x48f6('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3f1a6e,_0x536d6d['error'][_0x48f6('0x13')]);return _0x23d4bb(_0x536d6d['error'][_0x48f6('0x13')]);}else{logger[_0x48f6('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x3f1a6e,'request\x20sent');_0x23d4bb(_0x536d6d[_0x48f6('0x14')]['message']);}})[_0x48f6('0x15')](function(_0x4f071d){logger[_0x48f6('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3f1a6e,_0x4f071d);_0x5357d1(_0x4f071d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e211f69..eede873 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 _0xd4f2=['delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show','post','create','/:id'];(function(_0x10b2c4,_0x4b10ed){var _0xb10a8e=function(_0x58ff68){while(--_0x58ff68){_0x10b2c4['push'](_0x10b2c4['shift']());}};_0xb10a8e(++_0x4b10ed);}(_0xd4f2,0x132));var _0x2d4f=function(_0x4c96d1,_0x49be5e){_0x4c96d1=_0x4c96d1-0x0;var _0x562880=_0xd4f2[_0x4c96d1];return _0x562880;};'use strict';var multer=require(_0x2d4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4f('0x1'));var express=require('express');var router=express[_0x2d4f('0x2')]();var auth=require(_0x2d4f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4f('0x4'));var controller=require(_0x2d4f('0x5'));router[_0x2d4f('0x6')]('/',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0x8')]);router[_0x2d4f('0x6')]('/describe',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0x9')]);router[_0x2d4f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2d4f('0xa')]);router[_0x2d4f('0xb')]('/',auth[_0x2d4f('0x7')](),controller[_0x2d4f('0xc')]);router['put'](_0x2d4f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x2d4f('0xe')](_0x2d4f('0xd'),auth[_0x2d4f('0x7')](),controller[_0x2d4f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6981=['connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6981,0x14d));var _0x1698=function(_0x4c4982,_0x42b743){_0x4c4982=_0x4c4982-0x0;var _0x5ec514=_0x6981[_0x4c4982];return _0x5ec514;};'use strict';var multer=require(_0x1698('0x0'));var util=require(_0x1698('0x1'));var path=require(_0x1698('0x2'));var timeout=require(_0x1698('0x3'));var express=require('express');var router=express[_0x1698('0x4')]();var auth=require(_0x1698('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1698('0x6'));var controller=require(_0x1698('0x7'));router[_0x1698('0x8')]('/',auth[_0x1698('0x9')](),controller[_0x1698('0xa')]);router[_0x1698('0x8')](_0x1698('0xb'),auth['isAuthenticated'](),controller[_0x1698('0xc')]);router[_0x1698('0x8')](_0x1698('0xd'),auth[_0x1698('0x9')](),controller[_0x1698('0xe')]);router[_0x1698('0xf')]('/',auth[_0x1698('0x9')](),controller[_0x1698('0x10')]);router[_0x1698('0x11')](_0x1698('0xd'),auth[_0x1698('0x9')](),controller['update']);router[_0x1698('0x12')](_0x1698('0xd'),auth['isAuthenticated'](),controller[_0x1698('0x13')]);module[_0x1698('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 33a3e09..735c5ce 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 _0x55d2=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','STRING'];(function(_0x590da5,_0x298084){var _0x54d4c4=function(_0xf67551){while(--_0xf67551){_0x590da5['push'](_0x590da5['shift']());}};_0x54d4c4(++_0x298084);}(_0x55d2,0x9f));var _0x255d=function(_0x1999ca,_0x2951ea){_0x1999ca=_0x1999ca-0x0;var _0xfcfdf6=_0x55d2[_0x1999ca];return _0xfcfdf6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x255d('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x255d('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x255d('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x255d('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x255d('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x255d('0x0')],'set':function(_0x57cbc1){this[_0x255d('0x3')](_0x255d('0x4'),_0x57cbc1?_0x57cbc1[_0x255d('0x5')](''):[]);},'get':function(){return this[_0x255d('0x6')]('crudPermissions')?this['getDataValue'](_0x255d('0x4'))[_0x255d('0x7')](''):[];}}}; \ No newline at end of file +var _0x3fc6=['getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x3a2269,_0x3ef598){var _0x34b10b=function(_0x5a397f){while(--_0x5a397f){_0x3a2269['push'](_0x3a2269['shift']());}};_0x34b10b(++_0x3ef598);}(_0x3fc6,0x159));var _0x63fc=function(_0x56d12e,_0x596a8d){_0x56d12e=_0x56d12e-0x0;var _0x3d6d34=_0x3fc6[_0x56d12e];return _0x3d6d34;};'use strict';var Sequelize=require(_0x63fc('0x0'));module[_0x63fc('0x1')]={'name':{'type':Sequelize[_0x63fc('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x63fc('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x63fc('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x63fc('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x63fc('0x2')],'set':function(_0x155db7){this[_0x63fc('0x5')]('crudPermissions',_0x155db7?_0x155db7['join'](''):[]);},'get':function(){return this[_0x63fc('0x6')](_0x63fc('0x7'))?this[_0x63fc('0x6')]('crudPermissions')[_0x63fc('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ce2971b..ee07e00 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 _0x2258=['end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','UserProfileSection','count','include','findAll','show','params','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x9854b7,_0x28dfa8){var _0x2786a1=function(_0x34de09){while(--_0x34de09){_0x9854b7['push'](_0x9854b7['shift']());}};_0x2786a1(++_0x28dfa8);}(_0x2258,0x108));var _0x8225=function(_0x2f4e0d,_0x2a4519){_0x2f4e0d=_0x2f4e0d-0x0;var _0x2d7c24=_0x2258[_0x2f4e0d];return _0x2d7c24;};'use strict';var pdf=require(_0x8225('0x0'));var emlformat=require(_0x8225('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8225('0x2'));var jsonpatch=require(_0x8225('0x3'));var rp=require(_0x8225('0x4'));var moment=require(_0x8225('0x5'));var BPromise=require(_0x8225('0x6'));var Mustache=require('mustache');var util=require(_0x8225('0x7'));var path=require(_0x8225('0x8'));var sox=require(_0x8225('0x9'));var csv=require(_0x8225('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8225('0xb'));var squel=require('squel');var crypto=require(_0x8225('0xc'));var jsforce=require(_0x8225('0xd'));var deskjs=require(_0x8225('0xe'));var toCsv=require(_0x8225('0xa'));var querystring=require(_0x8225('0xf'));var Papa=require('papaparse');var Redis=require(_0x8225('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8225('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8225('0x12'))(_0x8225('0x13'));var utils=require(_0x8225('0x14'));var config=require('../../config/environment');var db=require(_0x8225('0x15'))['db'];function respondWithStatusCode(_0x2fcfdf,_0x30c0aa){_0x30c0aa=_0x30c0aa||0xcc;return function(_0x12a304){if(_0x12a304){return _0x2fcfdf[_0x8225('0x16')](_0x30c0aa);}return _0x2fcfdf[_0x8225('0x17')](_0x30c0aa)[_0x8225('0x18')]();};}function respondWithResult(_0x42e4b1,_0x10838d){_0x10838d=_0x10838d||0xc8;return function(_0x5e6ccc){if(_0x5e6ccc){return _0x42e4b1[_0x8225('0x17')](_0x10838d)[_0x8225('0x19')](_0x5e6ccc);}};}function respondWithFilteredResult(_0x2415b8,_0x29b9ee){return function(_0x24e6ce){if(_0x24e6ce){var _0x20037a=_0x24e6ce['count'],_0x34133b=_0x29b9ee[_0x8225('0x1a')],_0x557cbb=_0x29b9ee['offset']+_0x29b9ee[_0x8225('0x1b')],_0x78f223;if(_0x557cbb>=_0x20037a){_0x557cbb=_0x20037a;_0x78f223=0xc8;}else{_0x78f223=0xce;}_0x2415b8['status'](_0x78f223);return _0x2415b8[_0x8225('0x1c')](_0x8225('0x1d'),_0x34133b+'-'+_0x557cbb+'/'+_0x20037a)['json'](_0x24e6ce);}return null;};}function patchUpdates(_0x59f858){return function(_0x49fdf8){try{jsonpatch[_0x8225('0x1e')](_0x49fdf8,_0x59f858,!![]);}catch(_0x4bc7c8){return BPromise[_0x8225('0x1f')](_0x4bc7c8);}return _0x49fdf8[_0x8225('0x20')]();};}function saveUpdates(_0x47c561,_0x121e3e){return function(_0x1c29cf){if(_0x1c29cf){return _0x1c29cf[_0x8225('0x21')](_0x47c561)[_0x8225('0x22')](function(_0x10f5b6){return _0x10f5b6;});}return null;};}function removeEntity(_0x15fd5,_0x5786e5){return function(_0x33a89a){if(_0x33a89a){return _0x33a89a[_0x8225('0x23')]()[_0x8225('0x22')](function(){_0x15fd5[_0x8225('0x17')](0xcc)[_0x8225('0x18')]();});}};}function handleEntityNotFound(_0xcc1385,_0x27e200){return function(_0x2f78d3){if(!_0x2f78d3){_0xcc1385[_0x8225('0x16')](0x194);}return _0x2f78d3;};}function handleError(_0x12fa3b,_0x9555a0){_0x9555a0=_0x9555a0||0x1f4;return function(_0x1a5a17){logger['error'](_0x1a5a17['stack']);if(_0x1a5a17[_0x8225('0x24')]){delete _0x1a5a17[_0x8225('0x24')];}_0x12fa3b[_0x8225('0x17')](_0x9555a0)[_0x8225('0x25')](_0x1a5a17);};}exports[_0x8225('0x26')]=function(_0x2f76f0,_0x453fa2){var _0x5493af={},_0x22e736={},_0x33cb12={'count':0x0,'rows':[]};var _0x506248=_[_0x8225('0x27')](db['UserProfileSection'][_0x8225('0x28')],function(_0x2715b0){return{'name':_0x2715b0[_0x8225('0x29')],'type':_0x2715b0[_0x8225('0x2a')][_0x8225('0x2b')]};});_0x22e736[_0x8225('0x2c')]=_[_0x8225('0x27')](_0x506248,_0x8225('0x24'));_0x22e736['query']=_[_0x8225('0x2d')](_0x2f76f0['query']);_0x22e736[_0x8225('0x2e')]=_[_0x8225('0x2f')](_0x22e736[_0x8225('0x2c')],_0x22e736[_0x8225('0x30')]);_0x5493af[_0x8225('0x31')]=_[_0x8225('0x2f')](_0x22e736[_0x8225('0x2c')],qs[_0x8225('0x32')](_0x2f76f0[_0x8225('0x30')]['fields']));_0x5493af[_0x8225('0x31')]=_0x5493af[_0x8225('0x31')][_0x8225('0x33')]?_0x5493af[_0x8225('0x31')]:_0x22e736[_0x8225('0x2c')];if(!_0x2f76f0['query'][_0x8225('0x34')](_0x8225('0x35'))){_0x5493af[_0x8225('0x1b')]=qs[_0x8225('0x1b')](_0x2f76f0[_0x8225('0x30')]['limit']);_0x5493af['offset']=qs[_0x8225('0x1a')](_0x2f76f0[_0x8225('0x30')][_0x8225('0x1a')]);}_0x5493af['order']=qs[_0x8225('0x36')](_0x2f76f0[_0x8225('0x30')][_0x8225('0x36')]);_0x5493af['where']=qs['filters'](_[_0x8225('0x37')](_0x2f76f0[_0x8225('0x30')],_0x22e736[_0x8225('0x2e')]),_0x506248);if(_0x2f76f0[_0x8225('0x30')][_0x8225('0x38')]){_0x5493af['where']=_[_0x8225('0x39')](_0x5493af['where'],{'$or':_[_0x8225('0x27')](_0x506248,function(_0x3c3814){if(_0x3c3814[_0x8225('0x2a')]!==_0x8225('0x3a')){var _0x3e5c44={};_0x3e5c44[_0x3c3814['name']]={'$like':'%'+_0x2f76f0[_0x8225('0x30')][_0x8225('0x38')]+'%'};return _0x3e5c44;}})});}_0x5493af=_[_0x8225('0x39')]({},_0x5493af,_0x2f76f0[_0x8225('0x3b')]);var _0x478856={'where':_0x5493af[_0x8225('0x3c')]};return db[_0x8225('0x3d')][_0x8225('0x3e')](_0x478856)[_0x8225('0x22')](function(_0x22dd7f){_0x33cb12[_0x8225('0x3e')]=_0x22dd7f;if(_0x2f76f0[_0x8225('0x30')]['includeAll']){_0x5493af[_0x8225('0x3f')]=[{'all':!![]}];}return db[_0x8225('0x3d')][_0x8225('0x40')](_0x5493af);})['then'](function(_0x4ccaa5){_0x33cb12['rows']=_0x4ccaa5;return _0x33cb12;})[_0x8225('0x22')](respondWithFilteredResult(_0x453fa2,_0x5493af))['catch'](handleError(_0x453fa2,null));};exports[_0x8225('0x41')]=function(_0x260815,_0x232e34){var _0xb9de27={'raw':![],'where':{'id':_0x260815[_0x8225('0x42')]['id']}},_0x29dfd7={};_0x29dfd7[_0x8225('0x2c')]=_[_0x8225('0x2d')](db[_0x8225('0x3d')][_0x8225('0x28')]);_0x29dfd7['query']=_[_0x8225('0x2d')](_0x260815[_0x8225('0x30')]);_0x29dfd7[_0x8225('0x2e')]=_[_0x8225('0x2f')](_0x29dfd7[_0x8225('0x2c')],_0x29dfd7[_0x8225('0x30')]);_0xb9de27['attributes']=_[_0x8225('0x2f')](_0x29dfd7[_0x8225('0x2c')],qs[_0x8225('0x32')](_0x260815[_0x8225('0x30')][_0x8225('0x32')]));_0xb9de27[_0x8225('0x31')]=_0xb9de27[_0x8225('0x31')]['length']?_0xb9de27[_0x8225('0x31')]:_0x29dfd7[_0x8225('0x2c')];if(_0x260815[_0x8225('0x30')]['includeAll']){_0xb9de27['include']=[{'all':!![]}];}_0xb9de27=_['merge']({},_0xb9de27,_0x260815[_0x8225('0x3b')]);return db['UserProfileSection'][_0x8225('0x43')](_0xb9de27)[_0x8225('0x22')](handleEntityNotFound(_0x232e34,null))[_0x8225('0x22')](respondWithResult(_0x232e34,null))[_0x8225('0x44')](handleError(_0x232e34,null));};exports[_0x8225('0x45')]=function(_0x18a908,_0xe5943c){return db[_0x8225('0x3d')][_0x8225('0x45')](_0x18a908['body'],{})[_0x8225('0x22')](respondWithResult(_0xe5943c,0xc9))['catch'](handleError(_0xe5943c,null));};exports['update']=function(_0x2b216b,_0x1c4d8d){if(_0x2b216b['body']['id']){delete _0x2b216b['body']['id'];}return db[_0x8225('0x3d')][_0x8225('0x43')]({'where':{'id':_0x2b216b[_0x8225('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c4d8d,null))[_0x8225('0x22')](saveUpdates(_0x2b216b[_0x8225('0x46')],null))[_0x8225('0x22')](respondWithResult(_0x1c4d8d,null))[_0x8225('0x44')](handleError(_0x1c4d8d,null));};exports[_0x8225('0x23')]=function(_0x197b48,_0x40c678){return db[_0x8225('0x3d')]['find']({'where':{'id':_0x197b48[_0x8225('0x42')]['id']}})[_0x8225('0x22')](handleEntityNotFound(_0x40c678,null))[_0x8225('0x22')](removeEntity(_0x40c678,null))[_0x8225('0x44')](handleError(_0x40c678,null));};exports[_0x8225('0x47')]=function(_0x2bc01a,_0x3dfb37){return db['UserProfileSection'][_0x8225('0x47')]()[_0x8225('0x22')](respondWithResult(_0x3dfb37,null))[_0x8225('0x44')](handleError(_0x3dfb37,null));}; \ No newline at end of file +var _0xadec=['zip-dir','fast-json-patch','mustache','util','path','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','include','catch','params','keys','find','create','body','update','describe','html-pdf','eml-format','rimraf'];(function(_0x4adfe8,_0x3640ff){var _0x38c507=function(_0x4a73a9){while(--_0x4a73a9){_0x4adfe8['push'](_0x4adfe8['shift']());}};_0x38c507(++_0x3640ff);}(_0xadec,0x156));var _0xcade=function(_0x2a5f9a,_0x2ff1ab){_0x2a5f9a=_0x2a5f9a-0x0;var _0x2c77fc=_0xadec[_0x2a5f9a];return _0x2c77fc;};'use strict';var pdf=require(_0xcade('0x0'));var emlformat=require(_0xcade('0x1'));var rimraf=require(_0xcade('0x2'));var zipdir=require(_0xcade('0x3'));var jsonpatch=require(_0xcade('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcade('0x5'));var util=require(_0xcade('0x6'));var path=require(_0xcade('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcade('0x8'));var crypto=require('crypto');var jsforce=require(_0xcade('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcade('0xa'));var Papa=require(_0xcade('0xb'));var Redis=require(_0xcade('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcade('0xd'));var as=require(_0xcade('0xe'));var hardwareService=require(_0xcade('0xf'));var logger=require(_0xcade('0x10'))(_0xcade('0x11'));var utils=require(_0xcade('0x12'));var config=require(_0xcade('0x13'));var db=require(_0xcade('0x14'))['db'];function respondWithStatusCode(_0x101d47,_0x17623d){_0x17623d=_0x17623d||0xcc;return function(_0x136d02){if(_0x136d02){return _0x101d47[_0xcade('0x15')](_0x17623d);}return _0x101d47[_0xcade('0x16')](_0x17623d)[_0xcade('0x17')]();};}function respondWithResult(_0x5a1af6,_0x31f018){_0x31f018=_0x31f018||0xc8;return function(_0x33d794){if(_0x33d794){return _0x5a1af6[_0xcade('0x16')](_0x31f018)['json'](_0x33d794);}};}function respondWithFilteredResult(_0x81ddea,_0x245621){return function(_0x4be206){if(_0x4be206){var _0x135fb7=_0x4be206[_0xcade('0x18')],_0xa74f99=_0x245621[_0xcade('0x19')],_0x2ce4e2=_0x245621[_0xcade('0x19')]+_0x245621['limit'],_0x4da027;if(_0x2ce4e2>=_0x135fb7){_0x2ce4e2=_0x135fb7;_0x4da027=0xc8;}else{_0x4da027=0xce;}_0x81ddea[_0xcade('0x16')](_0x4da027);return _0x81ddea[_0xcade('0x1a')](_0xcade('0x1b'),_0xa74f99+'-'+_0x2ce4e2+'/'+_0x135fb7)[_0xcade('0x1c')](_0x4be206);}return null;};}function patchUpdates(_0x42bb52){return function(_0x137534){try{jsonpatch[_0xcade('0x1d')](_0x137534,_0x42bb52,!![]);}catch(_0x4ea11d){return BPromise[_0xcade('0x1e')](_0x4ea11d);}return _0x137534[_0xcade('0x1f')]();};}function saveUpdates(_0x21f6f4,_0x3e9cc6){return function(_0x13c11f){if(_0x13c11f){return _0x13c11f['update'](_0x21f6f4)['then'](function(_0x3c63c0){return _0x3c63c0;});}return null;};}function removeEntity(_0x5b18f6,_0x1d1319){return function(_0x3d09c7){if(_0x3d09c7){return _0x3d09c7[_0xcade('0x20')]()[_0xcade('0x21')](function(){_0x5b18f6[_0xcade('0x16')](0xcc)[_0xcade('0x17')]();});}};}function handleEntityNotFound(_0x102e12,_0x264df7){return function(_0x356c91){if(!_0x356c91){_0x102e12[_0xcade('0x15')](0x194);}return _0x356c91;};}function handleError(_0x28b55c,_0x2c9f13){_0x2c9f13=_0x2c9f13||0x1f4;return function(_0x598a20){logger[_0xcade('0x22')](_0x598a20[_0xcade('0x23')]);if(_0x598a20['name']){delete _0x598a20[_0xcade('0x24')];}_0x28b55c[_0xcade('0x16')](_0x2c9f13)[_0xcade('0x25')](_0x598a20);};}exports[_0xcade('0x26')]=function(_0xca2941,_0x1c77f1){var _0xf8e810={},_0x4bbe2a={},_0x39dcf0={'count':0x0,'rows':[]};var _0x17c156=_[_0xcade('0x27')](db[_0xcade('0x28')][_0xcade('0x29')],function(_0x25cbdc){return{'name':_0x25cbdc[_0xcade('0x2a')],'type':_0x25cbdc[_0xcade('0x2b')]['key']};});_0x4bbe2a[_0xcade('0x2c')]=_[_0xcade('0x27')](_0x17c156,_0xcade('0x24'));_0x4bbe2a[_0xcade('0x2d')]=_['keys'](_0xca2941[_0xcade('0x2d')]);_0x4bbe2a[_0xcade('0x2e')]=_[_0xcade('0x2f')](_0x4bbe2a[_0xcade('0x2c')],_0x4bbe2a[_0xcade('0x2d')]);_0xf8e810[_0xcade('0x30')]=_['intersection'](_0x4bbe2a[_0xcade('0x2c')],qs[_0xcade('0x31')](_0xca2941[_0xcade('0x2d')][_0xcade('0x31')]));_0xf8e810['attributes']=_0xf8e810[_0xcade('0x30')][_0xcade('0x32')]?_0xf8e810[_0xcade('0x30')]:_0x4bbe2a[_0xcade('0x2c')];if(!_0xca2941[_0xcade('0x2d')][_0xcade('0x33')]('nolimit')){_0xf8e810['limit']=qs[_0xcade('0x34')](_0xca2941['query'][_0xcade('0x34')]);_0xf8e810[_0xcade('0x19')]=qs[_0xcade('0x19')](_0xca2941[_0xcade('0x2d')][_0xcade('0x19')]);}_0xf8e810[_0xcade('0x35')]=qs[_0xcade('0x36')](_0xca2941[_0xcade('0x2d')][_0xcade('0x36')]);_0xf8e810[_0xcade('0x37')]=qs[_0xcade('0x2e')](_[_0xcade('0x38')](_0xca2941['query'],_0x4bbe2a['filters']),_0x17c156);if(_0xca2941['query'][_0xcade('0x39')]){_0xf8e810['where']=_[_0xcade('0x3a')](_0xf8e810['where'],{'$or':_['map'](_0x17c156,function(_0x4c29d4){if(_0x4c29d4['type']!=='VIRTUAL'){var _0x3539b0={};_0x3539b0[_0x4c29d4['name']]={'$like':'%'+_0xca2941[_0xcade('0x2d')]['filter']+'%'};return _0x3539b0;}})});}_0xf8e810=_[_0xcade('0x3a')]({},_0xf8e810,_0xca2941[_0xcade('0x3b')]);var _0x459dfd={'where':_0xf8e810[_0xcade('0x37')]};return db[_0xcade('0x28')][_0xcade('0x18')](_0x459dfd)['then'](function(_0x46187a){_0x39dcf0[_0xcade('0x18')]=_0x46187a;if(_0xca2941[_0xcade('0x2d')]['includeAll']){_0xf8e810[_0xcade('0x3c')]=[{'all':!![]}];}return db[_0xcade('0x28')]['findAll'](_0xf8e810);})[_0xcade('0x21')](function(_0x303043){_0x39dcf0['rows']=_0x303043;return _0x39dcf0;})[_0xcade('0x21')](respondWithFilteredResult(_0x1c77f1,_0xf8e810))[_0xcade('0x3d')](handleError(_0x1c77f1,null));};exports['show']=function(_0x2d2e87,_0x1e6121){var _0x483e14={'raw':![],'where':{'id':_0x2d2e87[_0xcade('0x3e')]['id']}},_0xcfd42={};_0xcfd42[_0xcade('0x2c')]=_[_0xcade('0x3f')](db[_0xcade('0x28')][_0xcade('0x29')]);_0xcfd42[_0xcade('0x2d')]=_[_0xcade('0x3f')](_0x2d2e87[_0xcade('0x2d')]);_0xcfd42[_0xcade('0x2e')]=_[_0xcade('0x2f')](_0xcfd42['model'],_0xcfd42[_0xcade('0x2d')]);_0x483e14['attributes']=_[_0xcade('0x2f')](_0xcfd42[_0xcade('0x2c')],qs[_0xcade('0x31')](_0x2d2e87['query'][_0xcade('0x31')]));_0x483e14[_0xcade('0x30')]=_0x483e14[_0xcade('0x30')][_0xcade('0x32')]?_0x483e14[_0xcade('0x30')]:_0xcfd42[_0xcade('0x2c')];if(_0x2d2e87['query']['includeAll']){_0x483e14['include']=[{'all':!![]}];}_0x483e14=_[_0xcade('0x3a')]({},_0x483e14,_0x2d2e87[_0xcade('0x3b')]);return db[_0xcade('0x28')][_0xcade('0x40')](_0x483e14)['then'](handleEntityNotFound(_0x1e6121,null))[_0xcade('0x21')](respondWithResult(_0x1e6121,null))[_0xcade('0x3d')](handleError(_0x1e6121,null));};exports[_0xcade('0x41')]=function(_0x4c3bc3,_0x500303){return db[_0xcade('0x28')][_0xcade('0x41')](_0x4c3bc3[_0xcade('0x42')],{})[_0xcade('0x21')](respondWithResult(_0x500303,0xc9))['catch'](handleError(_0x500303,null));};exports[_0xcade('0x43')]=function(_0x18bb5a,_0x350b01){if(_0x18bb5a[_0xcade('0x42')]['id']){delete _0x18bb5a[_0xcade('0x42')]['id'];}return db[_0xcade('0x28')][_0xcade('0x40')]({'where':{'id':_0x18bb5a['params']['id']}})[_0xcade('0x21')](handleEntityNotFound(_0x350b01,null))[_0xcade('0x21')](saveUpdates(_0x18bb5a[_0xcade('0x42')],null))[_0xcade('0x21')](respondWithResult(_0x350b01,null))['catch'](handleError(_0x350b01,null));};exports[_0xcade('0x20')]=function(_0x2d349d,_0x25dd04){return db[_0xcade('0x28')][_0xcade('0x40')]({'where':{'id':_0x2d349d[_0xcade('0x3e')]['id']}})[_0xcade('0x21')](handleEntityNotFound(_0x25dd04,null))[_0xcade('0x21')](removeEntity(_0x25dd04,null))[_0xcade('0x3d')](handleError(_0x25dd04,null));};exports[_0xcade('0x44')]=function(_0x22046e,_0x5e61c3){return db[_0xcade('0x28')][_0xcade('0x44')]()['then'](respondWithResult(_0x5e61c3,null))[_0xcade('0x3d')](handleError(_0x5e61c3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index e897c97..6ee32bc 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 _0x6003=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbfc853,_0x349992){var _0x48733a=function(_0x429b06){while(--_0x429b06){_0xbfc853['push'](_0xbfc853['shift']());}};_0x48733a(++_0x349992);}(_0x6003,0xa0));var _0x3600=function(_0x290143,_0x230cb1){_0x290143=_0x290143-0x0;var _0x298b3f=_0x6003[_0x290143];return _0x298b3f;};'use strict';var _=require('lodash');var util=require(_0x3600('0x0'));var logger=require(_0x3600('0x1'))('api');var moment=require(_0x3600('0x2'));var BPromise=require(_0x3600('0x3'));var rp=require(_0x3600('0x4'));var fs=require('fs');var path=require(_0x3600('0x5'));var rimraf=require(_0x3600('0x6'));var config=require(_0x3600('0x7'));var attributes=require(_0x3600('0x8'));module[_0x3600('0x9')]=function(_0xd297ea,_0x4ba2e1){return _0xd297ea['define'](_0x3600('0xa'),attributes,{'tableName':_0x3600('0xb'),'paranoid':![],'indexes':[{'name':_0x3600('0xc'),'fields':['sectionId',_0x3600('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b5=['userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x437e08,_0x1cab6c){var _0xcf57f2=function(_0x2ef02e){while(--_0x2ef02e){_0x437e08['push'](_0x437e08['shift']());}};_0xcf57f2(++_0x1cab6c);}(_0xe4b5,0x1aa));var _0x5e4b=function(_0x543edb,_0x2008f5){_0x543edb=_0x543edb-0x0;var _0x34d084=_0xe4b5[_0x543edb];return _0x34d084;};'use strict';var _=require(_0x5e4b('0x0'));var util=require(_0x5e4b('0x1'));var logger=require(_0x5e4b('0x2'))(_0x5e4b('0x3'));var moment=require(_0x5e4b('0x4'));var BPromise=require(_0x5e4b('0x5'));var rp=require(_0x5e4b('0x6'));var fs=require('fs');var path=require(_0x5e4b('0x7'));var rimraf=require(_0x5e4b('0x8'));var config=require(_0x5e4b('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x5e4b('0xa')]=function(_0x1bb9d4,_0x27e0f7){return _0x1bb9d4[_0x5e4b('0xb')](_0x5e4b('0xc'),attributes,{'tableName':_0x5e4b('0xd'),'paranoid':![],'indexes':[{'name':_0x5e4b('0xe'),'fields':[_0x5e4b('0xf'),_0x5e4b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 433badd..970bfd8 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 _0xc0b9=['UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51147e,_0x4290d6){var _0x3458d2=function(_0x16544e){while(--_0x16544e){_0x51147e['push'](_0x51147e['shift']());}};_0x3458d2(++_0x4290d6);}(_0xc0b9,0x12d));var _0x9c0b=function(_0x1f544e,_0x1edbbd){_0x1f544e=_0x1f544e-0x0;var _0x394caa=_0xc0b9[_0x1f544e];return _0x394caa;};'use strict';var _=require(_0x9c0b('0x0'));var util=require(_0x9c0b('0x1'));var moment=require(_0x9c0b('0x2'));var BPromise=require(_0x9c0b('0x3'));var rs=require(_0x9c0b('0x4'));var fs=require('fs');var Redis=require(_0x9c0b('0x5'));var db=require(_0x9c0b('0x6'))['db'];var utils=require(_0x9c0b('0x7'));var logger=require(_0x9c0b('0x8'))(_0x9c0b('0x9'));var config=require(_0x9c0b('0xa'));var jayson=require(_0x9c0b('0xb'));var client=jayson[_0x9c0b('0xc')][_0x9c0b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x163ee9,_0x4bbebd,_0x413f48){return new BPromise(function(_0x1fcb78,_0x530575){return client[_0x9c0b('0xe')](_0x163ee9,_0x413f48)[_0x9c0b('0xf')](function(_0x5458a8){logger[_0x9c0b('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x4bbebd,_0x9c0b('0x11'));logger[_0x9c0b('0x12')](_0x9c0b('0x13'),_0x4bbebd,_0x9c0b('0x11'),JSON[_0x9c0b('0x14')](_0x5458a8));if(_0x5458a8['error']){if(_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x16')]===0x1f4){logger[_0x9c0b('0x15')](_0x9c0b('0x17'),_0x4bbebd,_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x18')]);return _0x530575(_0x5458a8['error'][_0x9c0b('0x18')]);}logger['error'](_0x9c0b('0x17'),_0x4bbebd,_0x5458a8['error'][_0x9c0b('0x18')]);return _0x1fcb78(_0x5458a8[_0x9c0b('0x15')][_0x9c0b('0x18')]);}else{logger['info'](_0x9c0b('0x17'),_0x4bbebd,_0x9c0b('0x11'));_0x1fcb78(_0x5458a8[_0x9c0b('0x19')][_0x9c0b('0x18')]);}})[_0x9c0b('0x1a')](function(_0x1405e2){logger[_0x9c0b('0x15')](_0x9c0b('0x17'),_0x4bbebd,_0x1405e2);_0x530575(_0x1405e2);});});} \ No newline at end of file +var _0x3ea4=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2e2ced,_0xa0a3a7){var _0x5d5161=function(_0x412def){while(--_0x412def){_0x2e2ced['push'](_0x2e2ced['shift']());}};_0x5d5161(++_0xa0a3a7);}(_0x3ea4,0xd6));var _0x43ea=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x3ea4[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0x43ea('0x0'));var util=require(_0x43ea('0x1'));var moment=require(_0x43ea('0x2'));var BPromise=require(_0x43ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ea('0x4'));var db=require(_0x43ea('0x5'))['db'];var utils=require(_0x43ea('0x6'));var logger=require(_0x43ea('0x7'))(_0x43ea('0x8'));var config=require(_0x43ea('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x43ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x335dc7,_0x5dc5b3,_0x57a322){return new BPromise(function(_0x12bafd,_0x13f35b){return client[_0x43ea('0xb')](_0x335dc7,_0x57a322)['then'](function(_0x23e4b1){logger[_0x43ea('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x5dc5b3,'request\x20sent');logger[_0x43ea('0xd')](_0x43ea('0xe'),_0x5dc5b3,_0x43ea('0xf'),JSON[_0x43ea('0x10')](_0x23e4b1));if(_0x23e4b1[_0x43ea('0x11')]){if(_0x23e4b1[_0x43ea('0x11')][_0x43ea('0x12')]===0x1f4){logger[_0x43ea('0x11')](_0x43ea('0x13'),_0x5dc5b3,_0x23e4b1[_0x43ea('0x11')]['message']);return _0x13f35b(_0x23e4b1[_0x43ea('0x11')][_0x43ea('0x14')]);}logger['error'](_0x43ea('0x13'),_0x5dc5b3,_0x23e4b1[_0x43ea('0x11')][_0x43ea('0x14')]);return _0x12bafd(_0x23e4b1[_0x43ea('0x11')]['message']);}else{logger[_0x43ea('0xc')](_0x43ea('0x13'),_0x5dc5b3,_0x43ea('0xf'));_0x12bafd(_0x23e4b1[_0x43ea('0x15')][_0x43ea('0x14')]);}})[_0x43ea('0x16')](function(_0x308d93){logger[_0x43ea('0x11')](_0x43ea('0x13'),_0x5dc5b3,_0x308d93);_0x13f35b(_0x308d93);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6823988..dd370a5 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 _0xe3e7=['../../components/interaction/service','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0xa392b4,_0x130755){var _0x4e62e5=function(_0x4df3a9){while(--_0x4df3a9){_0xa392b4['push'](_0xa392b4['shift']());}};_0x4e62e5(++_0x130755);}(_0xe3e7,0xc8));var _0x7e3e=function(_0x214a3c,_0x405788){_0x214a3c=_0x214a3c-0x0;var _0x5a51c7=_0xe3e7[_0x214a3c];return _0x5a51c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e3e('0x0'));var timeout=require(_0x7e3e('0x1'));var express=require('express');var router=express[_0x7e3e('0x2')]();var auth=require(_0x7e3e('0x3'));var interaction=require(_0x7e3e('0x4'));var config=require('../../config/environment');module[_0x7e3e('0x5')]=router; \ No newline at end of file +var _0x86cc=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3d1aa8,_0x2e15c0){var _0x5a21e1=function(_0x134220){while(--_0x134220){_0x3d1aa8['push'](_0x3d1aa8['shift']());}};_0x5a21e1(++_0x2e15c0);}(_0x86cc,0x1e3));var _0xc86c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x86cc[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc86c('0x0'));var util=require(_0xc86c('0x1'));var path=require(_0xc86c('0x2'));var timeout=require(_0xc86c('0x3'));var express=require(_0xc86c('0x4'));var router=express[_0xc86c('0x5')]();var auth=require(_0xc86c('0x6'));var interaction=require(_0xc86c('0x7'));var config=require(_0xc86c('0x8'));module[_0xc86c('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 8e79996..cc0c884 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 _0xd8b0=['exports','sequelize'];(function(_0x331e28,_0x163e3c){var _0x42abb8=function(_0x2bdc7f){while(--_0x2bdc7f){_0x331e28['push'](_0x331e28['shift']());}};_0x42abb8(++_0x163e3c);}(_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(_0x4da462,_0x2aac46){var _0x2a001a=function(_0x5db008){while(--_0x5db008){_0x4da462['push'](_0x4da462['shift']());}};_0x2a001a(++_0x2aac46);}(_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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3a3a2db..4112e27 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 _0xeffd=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xeffd,0x6b));var _0xdeff=function(_0x2f002e,_0x2f231a){_0x2f002e=_0x2f002e-0x0;var _0x110680=_0xeffd[_0x2f002e];return _0x110680;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d86=['user_has_sms_queues','lodash','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0xe0f704,_0x37d323){var _0x5eec72=function(_0x2f4b90){while(--_0x2f4b90){_0xe0f704['push'](_0xe0f704['shift']());}};_0x5eec72(++_0x37d323);}(_0x5d86,0x76));var _0x65d8=function(_0x4f51f9,_0x5d5613){_0x4f51f9=_0x4f51f9-0x0;var _0x533984=_0x5d86[_0x4f51f9];return _0x533984;};'use strict';var _=require(_0x65d8('0x0'));var util=require(_0x65d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x65d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x65d8('0x3'));var fs=require('fs');var path=require(_0x65d8('0x4'));var rimraf=require('rimraf');var config=require(_0x65d8('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x65d8('0x6')]=function(_0x50c922,_0x1581a6){return _0x50c922[_0x65d8('0x7')]('UserSmsQueue',attributes,{'tableName':_0x65d8('0x8'),'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 580c2b6..ba2e1fd 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 _0x0afa=['jayson/promise','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x0afa,0x188));var _0xa0af=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0afa[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xa0af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0af('0x1'));var fs=require('fs');var Redis=require(_0xa0af('0x2'));var db=require(_0xa0af('0x3'))['db'];var utils=require(_0xa0af('0x4'));var logger=require('../../config/logger')(_0xa0af('0x5'));var config=require(_0xa0af('0x6'));var jayson=require(_0xa0af('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44d40c,_0x5bb865,_0x2b7ae9){return new BPromise(function(_0x1ac67a,_0x2591c0){return client[_0xa0af('0x8')](_0x44d40c,_0x2b7ae9)['then'](function(_0x1a4f4a){logger[_0xa0af('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0xa0af('0xa'));logger[_0xa0af('0xb')](_0xa0af('0xc'),_0x5bb865,_0xa0af('0xa'),JSON[_0xa0af('0xd')](_0x1a4f4a));if(_0x1a4f4a['error']){if(_0x1a4f4a['error']['code']===0x1f4){logger[_0xa0af('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0x1a4f4a['error']['message']);return _0x2591c0(_0x1a4f4a[_0xa0af('0xe')][_0xa0af('0xf')]);}logger['error'](_0xa0af('0x10'),_0x5bb865,_0x1a4f4a[_0xa0af('0xe')]['message']);return _0x1ac67a(_0x1a4f4a['error']['message']);}else{logger[_0xa0af('0x9')](_0xa0af('0x10'),_0x5bb865,_0xa0af('0xa'));_0x1ac67a(_0x1a4f4a[_0xa0af('0x11')][_0xa0af('0xf')]);}})[_0xa0af('0x12')](function(_0x275ca0){logger[_0xa0af('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x5bb865,_0x275ca0);_0x2591c0(_0x275ca0);});});} \ No newline at end of file +var _0xdd31=['stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1c4de4,_0x5a9c2e){var _0x84fa29=function(_0x2506aa){while(--_0x2506aa){_0x1c4de4['push'](_0x1c4de4['shift']());}};_0x84fa29(++_0x5a9c2e);}(_0xdd31,0x7b));var _0x1dd3=function(_0x5b4150,_0x421ad6){_0x5b4150=_0x5b4150-0x0;var _0x4ca2ca=_0xdd31[_0x5b4150];return _0x4ca2ca;};'use strict';var _=require(_0x1dd3('0x0'));var util=require(_0x1dd3('0x1'));var moment=require(_0x1dd3('0x2'));var BPromise=require(_0x1dd3('0x3'));var rs=require(_0x1dd3('0x4'));var fs=require('fs');var Redis=require(_0x1dd3('0x5'));var db=require(_0x1dd3('0x6'))['db'];var utils=require(_0x1dd3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1dd3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x132b59,_0x25373f,_0x3838a5){return new BPromise(function(_0x3399ce,_0x15f17e){return client[_0x1dd3('0xa')](_0x132b59,_0x3838a5)[_0x1dd3('0xb')](function(_0x3d4488){logger[_0x1dd3('0xc')](_0x1dd3('0xd'),_0x25373f,_0x1dd3('0xe'));logger[_0x1dd3('0xf')](_0x1dd3('0x10'),_0x25373f,'request\x20sent',JSON[_0x1dd3('0x11')](_0x3d4488));if(_0x3d4488[_0x1dd3('0x12')]){if(_0x3d4488[_0x1dd3('0x12')]['code']===0x1f4){logger[_0x1dd3('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x25373f,_0x3d4488[_0x1dd3('0x12')]['message']);return _0x15f17e(_0x3d4488[_0x1dd3('0x12')][_0x1dd3('0x13')]);}logger[_0x1dd3('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x25373f,_0x3d4488['error'][_0x1dd3('0x13')]);return _0x3399ce(_0x3d4488[_0x1dd3('0x12')][_0x1dd3('0x13')]);}else{logger[_0x1dd3('0xc')](_0x1dd3('0xd'),_0x25373f,'request\x20sent');_0x3399ce(_0x3d4488['result'][_0x1dd3('0x13')]);}})['catch'](function(_0x41e48b){logger[_0x1dd3('0x12')](_0x1dd3('0xd'),_0x25373f,_0x41e48b);_0x15f17e(_0x41e48b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 8ca15b7..d71fea9 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 _0x7e7e=['../../config/environment','exports','multer','path','connect-timeout','../../components/auth/service'];(function(_0x4fe4d0,_0xc7a321){var _0x3d4fd2=function(_0x29e75a){while(--_0x29e75a){_0x4fe4d0['push'](_0x4fe4d0['shift']());}};_0x3d4fd2(++_0xc7a321);}(_0x7e7e,0x146));var _0xe7e7=function(_0x20d96f,_0x557146){_0x20d96f=_0x20d96f-0x0;var _0x32284d=_0x7e7e[_0x20d96f];return _0x32284d;};'use strict';var multer=require(_0xe7e7('0x0'));var util=require('util');var path=require(_0xe7e7('0x1'));var timeout=require(_0xe7e7('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe7e7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe7e7('0x4'));module[_0xe7e7('0x5')]=router; \ No newline at end of file +var _0x299d=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express','Router'];(function(_0xe2a1aa,_0x525d7b){var _0x5a8362=function(_0x39aece){while(--_0x39aece){_0xe2a1aa['push'](_0xe2a1aa['shift']());}};_0x5a8362(++_0x525d7b);}(_0x299d,0x82));var _0xd299=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x299d[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xd299('0x0'));var util=require(_0xd299('0x1'));var path=require('path');var timeout=require(_0xd299('0x2'));var express=require(_0xd299('0x3'));var router=express[_0xd299('0x4')]();var auth=require(_0xd299('0x5'));var interaction=require(_0xd299('0x6'));var config=require(_0xd299('0x7'));module[_0xd299('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c011557..fe411be 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(_0x4c7d93,_0x346501){var _0x5298c7=function(_0x592460){while(--_0x592460){_0x4c7d93['push'](_0x4c7d93['shift']());}};_0x5298c7(++_0x346501);}(_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 _0xbaf0=['exports','INTEGER'];(function(_0x5807d4,_0x29306b){var _0x5ddf9b=function(_0x56476c){while(--_0x56476c){_0x5807d4['push'](_0x5807d4['shift']());}};_0x5ddf9b(++_0x29306b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8f14ce5..cb2eae0 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 _0xcf4c=['api','moment','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0xd80954,_0x1ce8c2){var _0x8085dd=function(_0x57fd80){while(--_0x57fd80){_0xd80954['push'](_0xd80954['shift']());}};_0x8085dd(++_0x1ce8c2);}(_0xcf4c,0x166));var _0xccf4=function(_0xbc8751,_0x3e64c0){_0xbc8751=_0xbc8751-0x0;var _0x10923a=_0xcf4c[_0xbc8751];return _0x10923a;};'use strict';var _=require('lodash');var util=require(_0xccf4('0x0'));var logger=require(_0xccf4('0x1'))(_0xccf4('0x2'));var moment=require(_0xccf4('0x3'));var BPromise=require('bluebird');var rp=require(_0xccf4('0x4'));var fs=require('fs');var path=require(_0xccf4('0x5'));var rimraf=require(_0xccf4('0x6'));var config=require('../../config/environment');var attributes=require(_0xccf4('0x7'));module[_0xccf4('0x8')]=function(_0x403452,_0x1cfb78){return _0x403452[_0xccf4('0x9')](_0xccf4('0xa'),attributes,{'tableName':_0xccf4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1afc=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','../../config/logger','api','bluebird','request-promise'];(function(_0x6546f,_0x5a9183){var _0x309ee9=function(_0x43c5c9){while(--_0x43c5c9){_0x6546f['push'](_0x6546f['shift']());}};_0x309ee9(++_0x5a9183);}(_0x1afc,0x167));var _0xc1af=function(_0x2d4a90,_0x547be1){_0x2d4a90=_0x2d4a90-0x0;var _0x1c698b=_0x1afc[_0x2d4a90];return _0x1c698b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc1af('0x0'))(_0xc1af('0x1'));var moment=require('moment');var BPromise=require(_0xc1af('0x2'));var rp=require(_0xc1af('0x3'));var fs=require('fs');var path=require(_0xc1af('0x4'));var rimraf=require(_0xc1af('0x5'));var config=require(_0xc1af('0x6'));var attributes=require(_0xc1af('0x7'));module[_0xc1af('0x8')]=function(_0xd20ac9,_0x314392){return _0xd20ac9[_0xc1af('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xc1af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9dbbd6f..da13a28 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 _0x8c03=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x311dd4,_0x92fbb2){var _0x2e1f9d=function(_0x441c0a){while(--_0x441c0a){_0x311dd4['push'](_0x311dd4['shift']());}};_0x2e1f9d(++_0x92fbb2);}(_0x8c03,0x15a));var _0x38c0=function(_0x9bbde5,_0x3506b5){_0x9bbde5=_0x9bbde5-0x0;var _0x46f02a=_0x8c03[_0x9bbde5];return _0x46f02a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c0('0x0'));var BPromise=require(_0x38c0('0x1'));var rs=require(_0x38c0('0x2'));var fs=require('fs');var Redis=require(_0x38c0('0x3'));var db=require(_0x38c0('0x4'))['db'];var utils=require(_0x38c0('0x5'));var logger=require('../../config/logger')(_0x38c0('0x6'));var config=require(_0x38c0('0x7'));var jayson=require(_0x38c0('0x8'));var client=jayson['client'][_0x38c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445d71,_0x594782,_0x4292d2){return new BPromise(function(_0x2ba497,_0x33ba3b){return client[_0x38c0('0xa')](_0x445d71,_0x4292d2)[_0x38c0('0xb')](function(_0x95b6eb){logger[_0x38c0('0xc')](_0x38c0('0xd'),_0x594782,'request\x20sent');logger[_0x38c0('0xe')](_0x38c0('0xf'),_0x594782,_0x38c0('0x10'),JSON['stringify'](_0x95b6eb));if(_0x95b6eb[_0x38c0('0x11')]){if(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x12')]===0x1f4){logger[_0x38c0('0x11')](_0x38c0('0xd'),_0x594782,_0x95b6eb['error']['message']);return _0x33ba3b(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x13')]);}logger[_0x38c0('0x11')](_0x38c0('0xd'),_0x594782,_0x95b6eb[_0x38c0('0x11')]['message']);return _0x2ba497(_0x95b6eb[_0x38c0('0x11')][_0x38c0('0x13')]);}else{logger[_0x38c0('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x594782,_0x38c0('0x10'));_0x2ba497(_0x95b6eb[_0x38c0('0x14')][_0x38c0('0x13')]);}})[_0x38c0('0x15')](function(_0x224b45){logger['error'](_0x38c0('0xd'),_0x594782,_0x224b45);_0x33ba3b(_0x224b45);});});} \ No newline at end of file +var _0x18f5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x2edcdb,_0x3d7328){var _0x166d52=function(_0x410fb9){while(--_0x410fb9){_0x2edcdb['push'](_0x2edcdb['shift']());}};_0x166d52(++_0x3d7328);}(_0x18f5,0x1be));var _0x518f=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x18f5[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var moment=require(_0x518f('0x2'));var BPromise=require(_0x518f('0x3'));var rs=require(_0x518f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518f('0x5'))['db'];var utils=require(_0x518f('0x6'));var logger=require(_0x518f('0x7'))(_0x518f('0x8'));var config=require(_0x518f('0x9'));var jayson=require(_0x518f('0xa'));var client=jayson[_0x518f('0xb')][_0x518f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f6762,_0x13e24b,_0x285387){return new BPromise(function(_0x45817a,_0x5a6e57){return client[_0x518f('0xd')](_0x4f6762,_0x285387)[_0x518f('0xe')](function(_0x24d7a6){logger[_0x518f('0xf')](_0x518f('0x10'),_0x13e24b,_0x518f('0x11'));logger[_0x518f('0x12')](_0x518f('0x13'),_0x13e24b,'request\x20sent',JSON[_0x518f('0x14')](_0x24d7a6));if(_0x24d7a6[_0x518f('0x15')]){if(_0x24d7a6[_0x518f('0x15')][_0x518f('0x16')]===0x1f4){logger[_0x518f('0x15')](_0x518f('0x10'),_0x13e24b,_0x24d7a6[_0x518f('0x15')][_0x518f('0x17')]);return _0x5a6e57(_0x24d7a6[_0x518f('0x15')][_0x518f('0x17')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x13e24b,_0x24d7a6['error'][_0x518f('0x17')]);return _0x45817a(_0x24d7a6['error']['message']);}else{logger[_0x518f('0xf')](_0x518f('0x10'),_0x13e24b,_0x518f('0x11'));_0x45817a(_0x24d7a6[_0x518f('0x18')][_0x518f('0x17')]);}})['catch'](function(_0x4d5536){logger[_0x518f('0x15')](_0x518f('0x10'),_0x13e24b,_0x4d5536);_0x5a6e57(_0x4d5536);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index eb7ab53..5264860 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 _0x1881=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','connect-timeout','express'];(function(_0x8e4c15,_0x44483e){var _0x82228c=function(_0x23e046){while(--_0x23e046){_0x8e4c15['push'](_0x8e4c15['shift']());}};_0x82228c(++_0x44483e);}(_0x1881,0xcc));var _0x1188=function(_0x20b9d5,_0xa6a6cd){_0x20b9d5=_0x20b9d5-0x0;var _0x4d7464=_0x1881[_0x20b9d5];return _0x4d7464;};'use strict';var multer=require(_0x1188('0x0'));var util=require(_0x1188('0x1'));var path=require('path');var timeout=require(_0x1188('0x2'));var express=require(_0x1188('0x3'));var router=express[_0x1188('0x4')]();var auth=require(_0x1188('0x5'));var interaction=require(_0x1188('0x6'));var config=require('../../config/environment');module[_0x1188('0x7')]=router; \ No newline at end of file +var _0xf0dc=['express','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x164a35,_0x3d7ca8){var _0x14faa3=function(_0x4dcdf7){while(--_0x4dcdf7){_0x164a35['push'](_0x164a35['shift']());}};_0x14faa3(++_0x3d7ca8);}(_0xf0dc,0x1ae));var _0xcf0d=function(_0x332bd0,_0x1dc710){_0x332bd0=_0x332bd0-0x0;var _0x212883=_0xf0dc[_0x332bd0];return _0x212883;};'use strict';var multer=require(_0xcf0d('0x0'));var util=require(_0xcf0d('0x1'));var path=require(_0xcf0d('0x2'));var timeout=require(_0xcf0d('0x3'));var express=require(_0xcf0d('0x4'));var router=express['Router']();var auth=require(_0xcf0d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xcf0d('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c78ca4c..9b17d15 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 _0xc382=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0x3edd61,_0x41dbd8){var _0x31a846=function(_0x224a4d){while(--_0x224a4d){_0x3edd61['push'](_0x3edd61['shift']());}};_0x31a846(++_0x41dbd8);}(_0xc382,0x13b));var _0x2c38=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0xc382[_0x34412f];return _0x4b4b5a;};'use strict';var Sequelize=require(_0x2c38('0x0'));module[_0x2c38('0x1')]={'uniqueid':{'type':Sequelize[_0x2c38('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'comment':_0x2c38('0x4')},'UserId':{'type':Sequelize[_0x2c38('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'unique':_0x2c38('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x2c38('0x3')],'allowNull':![],'unique':_0x2c38('0x5'),'comment':_0x2c38('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x2c38('0x2')](0xb),'defaultValue':0x0,'comment':_0x2c38('0x4')}}; \ No newline at end of file +var _0x94c4=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x94c4,0x1b5));var _0x494c=function(_0x1aac3c,_0x11af5c){_0x1aac3c=_0x1aac3c-0x0;var _0x5274a7=_0x94c4[_0x1aac3c];return _0x5274a7;};'use strict';var Sequelize=require(_0x494c('0x0'));module[_0x494c('0x1')]={'uniqueid':{'type':Sequelize[_0x494c('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x494c('0x3')},'membername':{'type':Sequelize[_0x494c('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x494c('0x4')],'allowNull':![],'unique':_0x494c('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x494c('0x4')],'allowNull':![],'unique':_0x494c('0x5'),'comment':_0x494c('0x3')},'penalty':{'type':Sequelize[_0x494c('0x2')](0xb),'defaultValue':0x0,'comment':_0x494c('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x494c('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7a11895..e179508 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 _0x6519=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x149ea6,_0x4e5a50){var _0x1cb8af=function(_0x4d1221){while(--_0x4d1221){_0x149ea6['push'](_0x149ea6['shift']());}};_0x1cb8af(++_0x4e5a50);}(_0x6519,0xe7));var _0x9651=function(_0x11b3f4,_0x371c17){_0x11b3f4=_0x11b3f4-0x0;var _0x47af1d=_0x6519[_0x11b3f4];return _0x47af1d;};'use strict';var EventEmitter=require(_0x9651('0x0'));var UserVoiceQueueRt=require(_0x9651('0x1'))['db'][_0x9651('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9651('0x3')](0x0);var events={'afterCreate':_0x9651('0x4'),'afterUpdate':_0x9651('0x5'),'afterDestroy':_0x9651('0x6')};function emitEvent(_0x278d27){return function(_0x4194b3,_0x4297f3,_0x3a239f){UserVoiceQueueRtEvents[_0x9651('0x7')](_0x278d27+':'+_0x4194b3['id'],_0x4194b3);UserVoiceQueueRtEvents[_0x9651('0x7')](_0x278d27,_0x4194b3);_0x3a239f(null);};}for(var e in events){if(events[_0x9651('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x9651('0x9')](e,emitEvent(event));}}module[_0x9651('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2ded=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3d0b63,_0x3d6efc){var _0x2b1f1b=function(_0x109f99){while(--_0x109f99){_0x3d0b63['push'](_0x3d0b63['shift']());}};_0x2b1f1b(++_0x3d6efc);}(_0x2ded,0xe5));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd2de('0x0'));var UserVoiceQueueRt=require(_0xd2de('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd2de('0x2')](0x0);var events={'afterCreate':_0xd2de('0x3'),'afterUpdate':'update','afterDestroy':_0xd2de('0x4')};function emitEvent(_0x1f396d){return function(_0x16ff7e,_0x3ddab5,_0x3df87b){UserVoiceQueueRtEvents[_0xd2de('0x5')](_0x1f396d+':'+_0x16ff7e['id'],_0x16ff7e);UserVoiceQueueRtEvents[_0xd2de('0x5')](_0x1f396d,_0x16ff7e);_0x3df87b(null);};}for(var e in events){if(events[_0xd2de('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xd2de('0x7')](e,emitEvent(event));}}module[_0xd2de('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index b201cfe..98dc24b 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 _0x1777=['request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','bluebird'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x1777,0x164));var _0x7177=function(_0x4c8b19,_0x29fae4){_0x4c8b19=_0x4c8b19-0x0;var _0x27fef1=_0x1777[_0x4c8b19];return _0x27fef1;};'use strict';var _=require(_0x7177('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7177('0x1'));var moment=require(_0x7177('0x2'));var BPromise=require(_0x7177('0x3'));var rp=require(_0x7177('0x4'));var fs=require('fs');var path=require(_0x7177('0x5'));var rimraf=require('rimraf');var config=require(_0x7177('0x6'));var attributes=require(_0x7177('0x7'));module[_0x7177('0x8')]=function(_0x278e85,_0x252936){return _0x278e85[_0x7177('0x9')](_0x7177('0xa'),attributes,{'tableName':_0x7177('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce42=['exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x2e015d,_0x4282c6){var _0x21c191=function(_0x7374b1){while(--_0x7374b1){_0x2e015d['push'](_0x2e015d['shift']());}};_0x21c191(++_0x4282c6);}(_0xce42,0x179));var _0x2ce4=function(_0x18e815,_0x171312){_0x18e815=_0x18e815-0x0;var _0x3ae01b=_0xce42[_0x18e815];return _0x3ae01b;};'use strict';var _=require(_0x2ce4('0x0'));var util=require('util');var logger=require(_0x2ce4('0x1'))(_0x2ce4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ce4('0x3'));var fs=require('fs');var path=require(_0x2ce4('0x4'));var rimraf=require(_0x2ce4('0x5'));var config=require(_0x2ce4('0x6'));var attributes=require(_0x2ce4('0x7'));module[_0x2ce4('0x8')]=function(_0x17e4e8,_0x2abf13){return _0x17e4e8['define'](_0x2ce4('0x9'),attributes,{'tableName':_0x2ce4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 0290a42..6053d5b 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 _0x6ad1=['options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x48607a,_0xdd5c99){var _0x116bf0=function(_0x569d45){while(--_0x569d45){_0x48607a['push'](_0x48607a['shift']());}};_0x116bf0(++_0xdd5c99);}(_0x6ad1,0xdf));var _0x16ad=function(_0x5c2670,_0x20b71a){_0x5c2670=_0x5c2670-0x0;var _0x1b14d7=_0x6ad1[_0x5c2670];return _0x1b14d7;};'use strict';var _=require(_0x16ad('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16ad('0x1'));var rs=require(_0x16ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16ad('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x16ad('0x4'))(_0x16ad('0x5'));var config=require(_0x16ad('0x6'));var jayson=require(_0x16ad('0x7'));var client=jayson['client'][_0x16ad('0x8')]({'port':0x232a});config[_0x16ad('0x9')]=_[_0x16ad('0xa')](config[_0x16ad('0x9')],{'host':_0x16ad('0xb'),'port':0x18eb});var socket=require(_0x16ad('0xc'))(new Redis(config[_0x16ad('0x9')]));require(_0x16ad('0xd'))[_0x16ad('0xe')](socket);function respondWithRpcPromise(_0x1f6487,_0xb43d36,_0x460ee2){return new BPromise(function(_0x5d8473,_0x21f308){return client['request'](_0x1f6487,_0x460ee2)[_0x16ad('0xf')](function(_0x4a1a5a){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb43d36,_0x16ad('0x10'));logger['debug'](_0x16ad('0x11'),_0xb43d36,_0x16ad('0x10'),JSON[_0x16ad('0x12')](_0x4a1a5a));if(_0x4a1a5a[_0x16ad('0x13')]){if(_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x14')]===0x1f4){logger[_0x16ad('0x13')](_0x16ad('0x15'),_0xb43d36,_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);return _0x21f308(_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);}logger['error'](_0x16ad('0x15'),_0xb43d36,_0x4a1a5a[_0x16ad('0x13')][_0x16ad('0x16')]);return _0x5d8473(_0x4a1a5a[_0x16ad('0x13')]['message']);}else{logger[_0x16ad('0x17')](_0x16ad('0x15'),_0xb43d36,_0x16ad('0x10'));_0x5d8473(_0x4a1a5a[_0x16ad('0x18')][_0x16ad('0x16')]);}})[_0x16ad('0x19')](function(_0xc87bad){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0xb43d36,_0xc87bad);_0x21f308(_0xc87bad);});});}exports[_0x16ad('0x1a')]=function(_0xc3cd16){var _0x238679=this;return new Promise(function(_0x22d459,_0x36f76d){return db[_0x16ad('0x1b')][_0x16ad('0x1c')]({'raw':_0xc3cd16[_0x16ad('0x1d')]?_0xc3cd16[_0x16ad('0x1d')][_0x16ad('0x1e')]===undefined?!![]:![]:!![],'where':_0xc3cd16[_0x16ad('0x1d')]?_0xc3cd16['options']['where']||null:null,'attributes':[[db[_0x16ad('0x1f')]['fn'](_0x16ad('0x20'),db['sequelize']['fn']('IF',db[_0x16ad('0x1f')][_0x16ad('0x21')](_0x16ad('0x22')))),_0x16ad('0x23')]]})[_0x16ad('0xf')](function(_0x326076){logger[_0x16ad('0x17')](_0x16ad('0x1a'),_0xc3cd16);logger['debug'](_0x16ad('0x1a'),_0xc3cd16,JSON['stringify'](_0x326076));_0x22d459(_0x326076);})[_0x16ad('0x19')](function(_0x2cfed4){logger[_0x16ad('0x13')](_0x16ad('0x1a'),_0x2cfed4[_0x16ad('0x16')],_0xc3cd16);_0x36f76d(_0x238679['error'](0x1f4,_0x2cfed4['message']));});});}; \ No newline at end of file +var _0x956c=['http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','`paused`\x20=\x201,\x201,\x20null','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xc01bb,_0x579e8f){var _0x3b43ed=function(_0x44ff81){while(--_0x44ff81){_0xc01bb['push'](_0xc01bb['shift']());}};_0x3b43ed(++_0x579e8f);}(_0x956c,0xe4));var _0xc956=function(_0x37c0ff,_0x15bd53){_0x37c0ff=_0x37c0ff-0x0;var _0x11060c=_0x956c[_0x37c0ff];return _0x11060c;};'use strict';var _=require(_0xc956('0x0'));var util=require('util');var moment=require(_0xc956('0x1'));var BPromise=require(_0xc956('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc956('0x3'));var db=require(_0xc956('0x4'))['db'];var utils=require(_0xc956('0x5'));var logger=require(_0xc956('0x6'))('rpc');var config=require(_0xc956('0x7'));var jayson=require(_0xc956('0x8'));var client=jayson[_0xc956('0x9')][_0xc956('0xa')]({'port':0x232a});config[_0xc956('0xb')]=_[_0xc956('0xc')](config[_0xc956('0xb')],{'host':_0xc956('0xd'),'port':0x18eb});var socket=require(_0xc956('0xe'))(new Redis(config[_0xc956('0xb')]));require(_0xc956('0xf'))[_0xc956('0x10')](socket);function respondWithRpcPromise(_0x5138fa,_0x4ec9f1,_0xfb5558){return new BPromise(function(_0x3c93e3,_0x13762c){return client[_0xc956('0x11')](_0x5138fa,_0xfb5558)['then'](function(_0x52b2a9){logger[_0xc956('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ec9f1,_0xc956('0x13'));logger[_0xc956('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x4ec9f1,_0xc956('0x13'),JSON[_0xc956('0x15')](_0x52b2a9));if(_0x52b2a9['error']){if(_0x52b2a9[_0xc956('0x16')][_0xc956('0x17')]===0x1f4){logger[_0xc956('0x16')](_0xc956('0x18'),_0x4ec9f1,_0x52b2a9['error'][_0xc956('0x19')]);return _0x13762c(_0x52b2a9[_0xc956('0x16')]['message']);}logger['error'](_0xc956('0x18'),_0x4ec9f1,_0x52b2a9['error'][_0xc956('0x19')]);return _0x3c93e3(_0x52b2a9[_0xc956('0x16')][_0xc956('0x19')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ec9f1,_0xc956('0x13'));_0x3c93e3(_0x52b2a9[_0xc956('0x1a')][_0xc956('0x19')]);}})[_0xc956('0x1b')](function(_0x4eb6d0){logger[_0xc956('0x16')](_0xc956('0x18'),_0x4ec9f1,_0x4eb6d0);_0x13762c(_0x4eb6d0);});});}exports[_0xc956('0x1c')]=function(_0xd70643){var _0x20a42d=this;return new Promise(function(_0x5dd916,_0x5e8091){return db[_0xc956('0x1d')][_0xc956('0x1e')]({'raw':_0xd70643[_0xc956('0x1f')]?_0xd70643[_0xc956('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xd70643[_0xc956('0x1f')]?_0xd70643[_0xc956('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc956('0x20')]['fn']('IF',db[_0xc956('0x20')]['literal'](_0xc956('0x21')))),'outboundQueuePauses']]})['then'](function(_0x2841a1){logger['info']('GetVoiceQueueRtPauses',_0xd70643);logger[_0xc956('0x14')](_0xc956('0x1c'),_0xd70643,JSON[_0xc956('0x15')](_0x2841a1));_0x5dd916(_0x2841a1);})[_0xc956('0x1b')](function(_0x529d0b){logger[_0xc956('0x16')](_0xc956('0x1c'),_0x529d0b['message'],_0xd70643);_0x5e8091(_0x20a42d[_0xc956('0x16')](0x1f4,_0x529d0b[_0xc956('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c1b8ac7..c85e551 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 _0x75cf=['remove','emit','removeListener','register','length','./userVoiceQueueRt.events','save'];(function(_0x59568c,_0x5176e5){var _0x143e8c=function(_0x5d710a){while(--_0x5d710a){_0x59568c['push'](_0x59568c['shift']());}};_0x143e8c(++_0x5176e5);}(_0x75cf,0x186));var _0xf75c=function(_0x36fc5d,_0x3380a1){_0x36fc5d=_0x36fc5d-0x0;var _0x386a98=_0x75cf[_0x36fc5d];return _0x386a98;};'use strict';var UserVoiceQueueRtEvents=require(_0xf75c('0x0'));var events=[_0xf75c('0x1'),_0xf75c('0x2'),'update'];function createListener(_0x50130d,_0x152b11){return function(_0x242ef6){_0x152b11[_0xf75c('0x3')](_0x50130d,_0x242ef6);};}function removeListener(_0xefccb4,_0x2a7ea3){return function(){UserVoiceQueueRtEvents[_0xf75c('0x4')](_0xefccb4,_0x2a7ea3);};}exports[_0xf75c('0x5')]=function(_0x58f038){for(var _0x4f7b98=0x0,_0x200709=events[_0xf75c('0x6')];_0x4f7b98<_0x200709;_0x4f7b98++){var _0x1b4868=events[_0x4f7b98];var _0x2e3533=createListener('userVoiceQueueRt:'+_0x1b4868,_0x58f038);UserVoiceQueueRtEvents['on'](_0x1b4868,_0x2e3533);}}; \ No newline at end of file +var _0x5ee9=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x172015,_0x538522){var _0x545dc4=function(_0x4e010e){while(--_0x4e010e){_0x172015['push'](_0x172015['shift']());}};_0x545dc4(++_0x538522);}(_0x5ee9,0xfc));var _0x95ee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5ee9[_0x13d07a];return _0x5ee0ee;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x95ee('0x0'),_0x95ee('0x1')];function createListener(_0x58c9a4,_0x47ada7){return function(_0x1993f4){_0x47ada7[_0x95ee('0x2')](_0x58c9a4,_0x1993f4);};}function removeListener(_0x3b22b7,_0x374342){return function(){UserVoiceQueueRtEvents[_0x95ee('0x3')](_0x3b22b7,_0x374342);};}exports[_0x95ee('0x4')]=function(_0x2dbfb2){for(var _0x55ccb2=0x0,_0x2a69fc=events[_0x95ee('0x5')];_0x55ccb2<_0x2a69fc;_0x55ccb2++){var _0x16f70e=events[_0x55ccb2];var _0x42a89a=createListener(_0x95ee('0x6')+_0x16f70e,_0x2dbfb2);UserVoiceQueueRtEvents['on'](_0x16f70e,_0x42a89a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 250b71b..c5d1901 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 _0xa11d=['exports','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa11d,0x173));var _0xda11=function(_0x2dcf8b,_0x477184){_0x2dcf8b=_0x2dcf8b-0x0;var _0x287c68=_0xa11d[_0x2dcf8b];return _0x287c68;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xda11('0x0'));var express=require(_0xda11('0x1'));var router=express[_0xda11('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xda11('0x3'));var config=require('../../config/environment');module[_0xda11('0x4')]=router; \ No newline at end of file +var _0x1854=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x51082b,_0x2073fa){var _0x6f3400=function(_0x364381){while(--_0x364381){_0x51082b['push'](_0x51082b['shift']());}};_0x6f3400(++_0x2073fa);}(_0x1854,0x113));var _0x4185=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0x1854[_0x2ee974];return _0x20c5fb;};'use strict';var multer=require(_0x4185('0x0'));var util=require(_0x4185('0x1'));var path=require(_0x4185('0x2'));var timeout=require(_0x4185('0x3'));var express=require(_0x4185('0x4'));var router=express['Router']();var auth=require(_0x4185('0x5'));var interaction=require(_0x4185('0x6'));var config=require(_0x4185('0x7'));module[_0x4185('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 552a455..ae90492 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 _0xbaf0=['exports','INTEGER'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2665a3,_0x3bac99){var _0x586de6=function(_0x1034d7){while(--_0x1034d7){_0x2665a3['push'](_0x2665a3['shift']());}};_0x586de6(++_0x3bac99);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 17cb606..e0c093d 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 _0x9c94=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x9c94,0x152));var _0x49c9=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9c94[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var logger=require('../../config/logger')(_0x49c9('0x2'));var moment=require(_0x49c9('0x3'));var BPromise=require(_0x49c9('0x4'));var rp=require(_0x49c9('0x5'));var fs=require('fs');var path=require(_0x49c9('0x6'));var rimraf=require('rimraf');var config=require(_0x49c9('0x7'));var attributes=require(_0x49c9('0x8'));module[_0x49c9('0x9')]=function(_0x586888,_0x2b9863){return _0x586888[_0x49c9('0xa')](_0x49c9('0xb'),attributes,{'tableName':_0x49c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e01=['exports','define','user_has_whatsapp_queues','util','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x396b43,_0x24d48a){var _0x34ff94=function(_0x457d34){while(--_0x457d34){_0x396b43['push'](_0x396b43['shift']());}};_0x34ff94(++_0x24d48a);}(_0x1e01,0x189));var _0x11e0=function(_0x26d43e,_0x2798f6){_0x26d43e=_0x26d43e-0x0;var _0x550f6f=_0x1e01[_0x26d43e];return _0x550f6f;};'use strict';var _=require('lodash');var util=require(_0x11e0('0x0'));var logger=require('../../config/logger')(_0x11e0('0x1'));var moment=require(_0x11e0('0x2'));var BPromise=require('bluebird');var rp=require(_0x11e0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11e0('0x4'));var config=require(_0x11e0('0x5'));var attributes=require(_0x11e0('0x6'));module[_0x11e0('0x7')]=function(_0x234b16,_0x11359e){return _0x234b16[_0x11e0('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x11e0('0x9'),'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 dc34541..96bbbd8 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(_0x32c647,_0x33b974){var _0x1c7185=function(_0x496654){while(--_0x496654){_0x32c647['push'](_0x32c647['shift']());}};_0x1c7185(++_0x33b974);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var 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(_0x1eab2c,_0x2a797e){var _0x1eb3ca=function(_0x137688){while(--_0x137688){_0x1eab2c['push'](_0x1eab2c['shift']());}};_0x1eb3ca(++_0x2a797e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 54cd964..b4fa390 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 _0x38a4=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','util'];(function(_0xe6f7f4,_0x4a0d73){var _0x2bfaef=function(_0x30e586){while(--_0x30e586){_0xe6f7f4['push'](_0xe6f7f4['shift']());}};_0x2bfaef(++_0x4a0d73);}(_0x38a4,0x6f));var _0x438a=function(_0x3f6bfc,_0x3c3ae4){_0x3f6bfc=_0x3f6bfc-0x0;var _0x1f0b7d=_0x38a4[_0x3f6bfc];return _0x1f0b7d;};'use strict';var multer=require('multer');var util=require(_0x438a('0x0'));var path=require('path');var timeout=require(_0x438a('0x1'));var express=require('express');var router=express[_0x438a('0x2')]();var auth=require(_0x438a('0x3'));var interaction=require(_0x438a('0x4'));var config=require(_0x438a('0x5'));var controller=require(_0x438a('0x6'));router[_0x438a('0x7')]('/',auth['isAuthenticated'](),controller[_0x438a('0x8')]);router['get'](_0x438a('0x9'),auth[_0x438a('0xa')](),controller['show']);router[_0x438a('0xb')]('/',auth['isAuthenticated'](),controller[_0x438a('0xc')]);router[_0x438a('0xd')](_0x438a('0x9'),auth[_0x438a('0xa')](),controller['update']);router[_0x438a('0xe')](_0x438a('0x9'),auth[_0x438a('0xa')](),controller[_0x438a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x20a0=['post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show'];(function(_0x21c0cc,_0x493d85){var _0x169470=function(_0x1b847d){while(--_0x1b847d){_0x21c0cc['push'](_0x21c0cc['shift']());}};_0x169470(++_0x493d85);}(_0x20a0,0xa8));var _0x020a=function(_0x4e53fe,_0x54d61d){_0x4e53fe=_0x4e53fe-0x0;var _0xe6a152=_0x20a0[_0x4e53fe];return _0xe6a152;};'use strict';var multer=require(_0x020a('0x0'));var util=require(_0x020a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x020a('0x2'));var router=express[_0x020a('0x3')]();var auth=require(_0x020a('0x4'));var interaction=require(_0x020a('0x5'));var config=require(_0x020a('0x6'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x020a('0x7')]);router[_0x020a('0x8')](_0x020a('0x9'),auth[_0x020a('0xa')](),controller[_0x020a('0xb')]);router[_0x020a('0xc')]('/',auth[_0x020a('0xa')](),controller[_0x020a('0xd')]);router['put']('/:id',auth[_0x020a('0xa')](),controller[_0x020a('0xe')]);router[_0x020a('0xf')](_0x020a('0x9'),auth['isAuthenticated'](),controller[_0x020a('0x10')]);module[_0x020a('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 40b41fb..04f6ddc 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 _0x7c25=['STRING','exports','name'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x7c25,0x1d5));var _0x57c2=function(_0x123477,_0x1ebce6){_0x123477=_0x123477-0x0;var _0x5c532c=_0x7c25[_0x123477];return _0x5c532c;};'use strict';var Sequelize=require('sequelize');module[_0x57c2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x57c2('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x57c2('0x2')]}}; \ No newline at end of file +var _0x46c4=['exports','STRING','name','sequelize'];(function(_0x41710b,_0x5d0b7c){var _0x207b4e=function(_0x1c139d){while(--_0x1c139d){_0x41710b['push'](_0x41710b['shift']());}};_0x207b4e(++_0x5d0b7c);}(_0x46c4,0xd7));var _0x446c=function(_0x445921,_0x148a98){_0x445921=_0x445921-0x0;var _0x123c65=_0x46c4[_0x445921];return _0x123c65;};'use strict';var Sequelize=require(_0x446c('0x0'));module[_0x446c('0x1')]={'name':{'type':Sequelize[_0x446c('0x2')],'unique':_0x446c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x446c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0130755..c3997f3 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 _0x7385=['request-promise','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch'];(function(_0x23e12d,_0x280202){var _0x21419e=function(_0x1212d9){while(--_0x1212d9){_0x23e12d['push'](_0x23e12d['shift']());}};_0x21419e(++_0x280202);}(_0x7385,0x197));var _0x5738=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7385[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5738('0x0'));var zipdir=require(_0x5738('0x1'));var jsonpatch=require(_0x5738('0x2'));var rp=require(_0x5738('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5738('0x4'));var path=require(_0x5738('0x5'));var sox=require(_0x5738('0x6'));var csv=require('to-csv');var ejs=require(_0x5738('0x7'));var fs=require('fs');var _=require(_0x5738('0x8'));var squel=require(_0x5738('0x9'));var crypto=require('crypto');var jsforce=require(_0x5738('0xa'));var deskjs=require(_0x5738('0xb'));var toCsv=require(_0x5738('0xc'));var querystring=require(_0x5738('0xd'));var Papa=require(_0x5738('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5738('0xf'));var as=require(_0x5738('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5738('0x11'))(_0x5738('0x12'));var utils=require(_0x5738('0x13'));var config=require(_0x5738('0x14'));var db=require(_0x5738('0x15'))['db'];function respondWithStatusCode(_0x63bcfd,_0x19a0b){_0x19a0b=_0x19a0b||0xcc;return function(_0x52a461){if(_0x52a461){return _0x63bcfd[_0x5738('0x16')](_0x19a0b);}return _0x63bcfd['status'](_0x19a0b)[_0x5738('0x17')]();};}function respondWithResult(_0x50deb6,_0xc3f2ca){_0xc3f2ca=_0xc3f2ca||0xc8;return function(_0x236e6f){if(_0x236e6f){return _0x50deb6[_0x5738('0x18')](_0xc3f2ca)[_0x5738('0x19')](_0x236e6f);}};}function respondWithFilteredResult(_0x53c5bb,_0x2b586d){return function(_0x46150e){if(_0x46150e){var _0x313077=_0x46150e[_0x5738('0x1a')],_0x22ca5e=_0x2b586d[_0x5738('0x1b')],_0x6a7cee=_0x2b586d['offset']+_0x2b586d['limit'],_0x92aca2;if(_0x6a7cee>=_0x313077){_0x6a7cee=_0x313077;_0x92aca2=0xc8;}else{_0x92aca2=0xce;}_0x53c5bb[_0x5738('0x18')](_0x92aca2);return _0x53c5bb[_0x5738('0x1c')]('Content-Range',_0x22ca5e+'-'+_0x6a7cee+'/'+_0x313077)[_0x5738('0x19')](_0x46150e);}return null;};}function patchUpdates(_0x445750){return function(_0x2e0bc7){try{jsonpatch[_0x5738('0x1d')](_0x2e0bc7,_0x445750,!![]);}catch(_0x82faf9){return BPromise[_0x5738('0x1e')](_0x82faf9);}return _0x2e0bc7[_0x5738('0x1f')]();};}function saveUpdates(_0x513fe9,_0x5eb596){return function(_0x78d427){if(_0x78d427){return _0x78d427['update'](_0x513fe9)[_0x5738('0x20')](function(_0x2077a9){return _0x2077a9;});}return null;};}function removeEntity(_0x4c218a,_0x2c8b24){return function(_0x4542e4){if(_0x4542e4){return _0x4542e4[_0x5738('0x21')]()[_0x5738('0x20')](function(){var _0x200cc3=_0x4542e4[_0x5738('0x22')]({'plain':!![]});var _0x4fc5a2=_0x5738('0x23');return db[_0x5738('0x24')]['destroy']({'where':{'type':_0x4fc5a2,'resourceId':_0x200cc3['id']}})['then'](function(){return _0x4542e4;});})[_0x5738('0x20')](function(){_0x4c218a[_0x5738('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a3c1f,_0x348719){return function(_0x259e6b){if(!_0x259e6b){_0x3a3c1f[_0x5738('0x16')](0x194);}return _0x259e6b;};}function handleError(_0x365c50,_0x2c75d8){_0x2c75d8=_0x2c75d8||0x1f4;return function(_0x15c252){logger[_0x5738('0x25')](_0x15c252[_0x5738('0x26')]);if(_0x15c252['name']){delete _0x15c252[_0x5738('0x27')];}_0x365c50[_0x5738('0x18')](_0x2c75d8)[_0x5738('0x28')](_0x15c252);};}exports[_0x5738('0x29')]=function(_0x17e3eb,_0x2ede66){var _0x44cc8d={},_0x1c1e53={},_0x15755b={'count':0x0,'rows':[]};var _0x28eff7=_[_0x5738('0x2a')](db[_0x5738('0x2b')][_0x5738('0x2c')],function(_0x9a372f){return{'name':_0x9a372f[_0x5738('0x2d')],'type':_0x9a372f[_0x5738('0x2e')]['key']};});_0x1c1e53['model']=_['map'](_0x28eff7,_0x5738('0x27'));_0x1c1e53[_0x5738('0x2f')]=_[_0x5738('0x30')](_0x17e3eb[_0x5738('0x2f')]);_0x1c1e53[_0x5738('0x31')]=_[_0x5738('0x32')](_0x1c1e53['model'],_0x1c1e53[_0x5738('0x2f')]);_0x44cc8d[_0x5738('0x33')]=_[_0x5738('0x32')](_0x1c1e53['model'],qs['fields'](_0x17e3eb[_0x5738('0x2f')]['fields']));_0x44cc8d['attributes']=_0x44cc8d['attributes'][_0x5738('0x34')]?_0x44cc8d['attributes']:_0x1c1e53[_0x5738('0x35')];if(!_0x17e3eb['query'][_0x5738('0x36')](_0x5738('0x37'))){_0x44cc8d[_0x5738('0x38')]=qs[_0x5738('0x38')](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x38')]);_0x44cc8d[_0x5738('0x1b')]=qs[_0x5738('0x1b')](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x1b')]);}_0x44cc8d[_0x5738('0x39')]=qs['sort'](_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3a')]);_0x44cc8d[_0x5738('0x3b')]=qs['filters'](_[_0x5738('0x3c')](_0x17e3eb['query'],_0x1c1e53[_0x5738('0x31')]),_0x28eff7);if(_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3d')]){_0x44cc8d[_0x5738('0x3b')]=_[_0x5738('0x3e')](_0x44cc8d[_0x5738('0x3b')],{'$or':_['map'](_0x28eff7,function(_0x38f2f9){if(_0x38f2f9[_0x5738('0x2e')]!==_0x5738('0x3f')){var _0x284c12={};_0x284c12[_0x38f2f9[_0x5738('0x27')]]={'$like':'%'+_0x17e3eb[_0x5738('0x2f')][_0x5738('0x3d')]+'%'};return _0x284c12;}})});}_0x44cc8d=_['merge']({},_0x44cc8d,_0x17e3eb[_0x5738('0x40')]);var _0x438cff={'where':_0x44cc8d['where']};return db[_0x5738('0x2b')]['count'](_0x438cff)['then'](function(_0x1cd10d){_0x15755b[_0x5738('0x1a')]=_0x1cd10d;if(_0x17e3eb[_0x5738('0x2f')][_0x5738('0x41')]){_0x44cc8d[_0x5738('0x42')]=[{'all':!![]}];}return db['Variable'][_0x5738('0x43')](_0x44cc8d);})['then'](function(_0x19a086){_0x15755b['rows']=_0x19a086;return _0x15755b;})[_0x5738('0x20')](respondWithFilteredResult(_0x2ede66,_0x44cc8d))[_0x5738('0x44')](handleError(_0x2ede66,null));};exports[_0x5738('0x45')]=function(_0x3de96a,_0x9fe1f0){var _0x1eaaa3={'raw':!![],'where':{'id':_0x3de96a['params']['id']}},_0x3615b8={};_0x3615b8[_0x5738('0x35')]=_[_0x5738('0x30')](db['Variable'][_0x5738('0x2c')]);_0x3615b8[_0x5738('0x2f')]=_[_0x5738('0x30')](_0x3de96a[_0x5738('0x2f')]);_0x3615b8[_0x5738('0x31')]=_[_0x5738('0x32')](_0x3615b8['model'],_0x3615b8[_0x5738('0x2f')]);_0x1eaaa3['attributes']=_[_0x5738('0x32')](_0x3615b8[_0x5738('0x35')],qs[_0x5738('0x46')](_0x3de96a[_0x5738('0x2f')][_0x5738('0x46')]));_0x1eaaa3[_0x5738('0x33')]=_0x1eaaa3[_0x5738('0x33')][_0x5738('0x34')]?_0x1eaaa3[_0x5738('0x33')]:_0x3615b8['model'];if(_0x3de96a[_0x5738('0x2f')]['includeAll']){_0x1eaaa3[_0x5738('0x42')]=[{'all':!![]}];}_0x1eaaa3=_[_0x5738('0x3e')]({},_0x1eaaa3,_0x3de96a[_0x5738('0x40')]);return db[_0x5738('0x2b')]['find'](_0x1eaaa3)[_0x5738('0x20')](handleEntityNotFound(_0x9fe1f0,null))[_0x5738('0x20')](respondWithResult(_0x9fe1f0,null))[_0x5738('0x44')](handleError(_0x9fe1f0,null));};exports[_0x5738('0x47')]=function(_0x5a5777,_0x41b21a){return db[_0x5738('0x2b')]['create'](_0x5a5777[_0x5738('0x48')],{})[_0x5738('0x20')](function(_0x2ce9d1){var _0x20d666=_0x5a5777[_0x5738('0x49')][_0x5738('0x22')]({'plain':!![]});if(!_0x20d666)throw new Error(_0x5738('0x4a'));if(_0x20d666[_0x5738('0x4b')]==='user'){var _0x3be9e4=_0x2ce9d1[_0x5738('0x22')]({'plain':!![]});var _0x13b6c4='Variables';return db[_0x5738('0x4c')][_0x5738('0x4d')]({'where':{'name':_0x13b6c4,'userProfileId':_0x20d666[_0x5738('0x4e')]},'raw':!![]})[_0x5738('0x20')](function(_0x587048){if(_0x587048&&_0x587048['autoAssociation']===0x0){return db[_0x5738('0x24')]['create']({'name':_0x3be9e4[_0x5738('0x27')],'resourceId':_0x3be9e4['id'],'type':_0x587048[_0x5738('0x27')],'sectionId':_0x587048['id']},{})[_0x5738('0x20')](function(){return _0x2ce9d1;});}else{return _0x2ce9d1;}})['catch'](function(_0x37e484){logger[_0x5738('0x25')](_0x5738('0x4f'),_0x37e484);throw _0x37e484;});}return _0x2ce9d1;})[_0x5738('0x20')](respondWithResult(_0x41b21a,0xc9))[_0x5738('0x44')](handleError(_0x41b21a,null));};exports[_0x5738('0x50')]=function(_0x23f8d5,_0x297885){if(_0x23f8d5['body']['id']){delete _0x23f8d5['body']['id'];}return db[_0x5738('0x2b')][_0x5738('0x4d')]({'where':{'id':_0x23f8d5[_0x5738('0x51')]['id']}})[_0x5738('0x20')](handleEntityNotFound(_0x297885,null))[_0x5738('0x20')](saveUpdates(_0x23f8d5[_0x5738('0x48')],null))['then'](respondWithResult(_0x297885,null))['catch'](handleError(_0x297885,null));};exports[_0x5738('0x21')]=function(_0x448831,_0x3454dc){return db[_0x5738('0x2b')][_0x5738('0x4d')]({'where':{'id':_0x448831[_0x5738('0x51')]['id']}})['then'](handleEntityNotFound(_0x3454dc,null))[_0x5738('0x20')](removeEntity(_0x3454dc,null))['catch'](handleError(_0x3454dc,null));}; \ No newline at end of file +var _0xb560=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','Content-Range','json','apply','save','update','destroy','then','Variables','UserProfileResource','sendStatus','stack','name','send','map','Variable','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb560,0x12d));var _0x0b56=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb560[_0x1035c1];return _0x308d67;};'use strict';var pdf=require(_0x0b56('0x0'));var emlformat=require(_0x0b56('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0b56('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b56('0x3'));var moment=require(_0x0b56('0x4'));var BPromise=require(_0x0b56('0x5'));var Mustache=require(_0x0b56('0x6'));var util=require('util');var path=require(_0x0b56('0x7'));var sox=require(_0x0b56('0x8'));var csv=require('to-csv');var ejs=require(_0x0b56('0x9'));var fs=require('fs');var _=require(_0x0b56('0xa'));var squel=require('squel');var crypto=require(_0x0b56('0xb'));var jsforce=require(_0x0b56('0xc'));var deskjs=require(_0x0b56('0xd'));var toCsv=require(_0x0b56('0xe'));var querystring=require(_0x0b56('0xf'));var Papa=require(_0x0b56('0x10'));var Redis=require(_0x0b56('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0b56('0x12'));var as=require(_0x0b56('0x13'));var hardwareService=require(_0x0b56('0x14'));var logger=require(_0x0b56('0x15'))(_0x0b56('0x16'));var utils=require(_0x0b56('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ccafe,_0x26cfdd){_0x26cfdd=_0x26cfdd||0xcc;return function(_0x41bd52){if(_0x41bd52){return _0x3ccafe['sendStatus'](_0x26cfdd);}return _0x3ccafe[_0x0b56('0x18')](_0x26cfdd)[_0x0b56('0x19')]();};}function respondWithResult(_0xb304ff,_0x433162){_0x433162=_0x433162||0xc8;return function(_0xf8eeb5){if(_0xf8eeb5){return _0xb304ff[_0x0b56('0x18')](_0x433162)['json'](_0xf8eeb5);}};}function respondWithFilteredResult(_0x42fa41,_0x5a452a){return function(_0x37b0e5){if(_0x37b0e5){var _0x260521=_0x37b0e5[_0x0b56('0x1a')],_0x2de8c1=_0x5a452a[_0x0b56('0x1b')],_0x4c8e70=_0x5a452a[_0x0b56('0x1b')]+_0x5a452a['limit'],_0xb354d9;if(_0x4c8e70>=_0x260521){_0x4c8e70=_0x260521;_0xb354d9=0xc8;}else{_0xb354d9=0xce;}_0x42fa41[_0x0b56('0x18')](_0xb354d9);return _0x42fa41['set'](_0x0b56('0x1c'),_0x2de8c1+'-'+_0x4c8e70+'/'+_0x260521)[_0x0b56('0x1d')](_0x37b0e5);}return null;};}function patchUpdates(_0x5e9858){return function(_0x632c4f){try{jsonpatch[_0x0b56('0x1e')](_0x632c4f,_0x5e9858,!![]);}catch(_0x584e23){return BPromise['reject'](_0x584e23);}return _0x632c4f[_0x0b56('0x1f')]();};}function saveUpdates(_0x353929,_0x27bef2){return function(_0x5dbd02){if(_0x5dbd02){return _0x5dbd02[_0x0b56('0x20')](_0x353929)['then'](function(_0x16c1f8){return _0x16c1f8;});}return null;};}function removeEntity(_0xf12418,_0x4d6f3b){return function(_0xa4819a){if(_0xa4819a){return _0xa4819a[_0x0b56('0x21')]()[_0x0b56('0x22')](function(){var _0x7ed4f9=_0xa4819a['get']({'plain':!![]});var _0x17a44d=_0x0b56('0x23');return db[_0x0b56('0x24')][_0x0b56('0x21')]({'where':{'type':_0x17a44d,'resourceId':_0x7ed4f9['id']}})['then'](function(){return _0xa4819a;});})[_0x0b56('0x22')](function(){_0xf12418['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29cb4d,_0x2da938){return function(_0x492499){if(!_0x492499){_0x29cb4d[_0x0b56('0x25')](0x194);}return _0x492499;};}function handleError(_0x5742af,_0x5a0611){_0x5a0611=_0x5a0611||0x1f4;return function(_0x41e8c0){logger['error'](_0x41e8c0[_0x0b56('0x26')]);if(_0x41e8c0[_0x0b56('0x27')]){delete _0x41e8c0['name'];}_0x5742af[_0x0b56('0x18')](_0x5a0611)[_0x0b56('0x28')](_0x41e8c0);};}exports['index']=function(_0x3b8824,_0x3d4f3e){var _0x39e0ad={},_0x540b35={},_0x5bfb1f={'count':0x0,'rows':[]};var _0x53a7a9=_[_0x0b56('0x29')](db[_0x0b56('0x2a')][_0x0b56('0x2b')],function(_0x231777){return{'name':_0x231777['fieldName'],'type':_0x231777[_0x0b56('0x2c')]['key']};});_0x540b35[_0x0b56('0x2d')]=_[_0x0b56('0x29')](_0x53a7a9,'name');_0x540b35[_0x0b56('0x2e')]=_[_0x0b56('0x2f')](_0x3b8824[_0x0b56('0x2e')]);_0x540b35[_0x0b56('0x30')]=_[_0x0b56('0x31')](_0x540b35['model'],_0x540b35['query']);_0x39e0ad[_0x0b56('0x32')]=_[_0x0b56('0x31')](_0x540b35['model'],qs[_0x0b56('0x33')](_0x3b8824['query']['fields']));_0x39e0ad['attributes']=_0x39e0ad[_0x0b56('0x32')][_0x0b56('0x34')]?_0x39e0ad[_0x0b56('0x32')]:_0x540b35[_0x0b56('0x2d')];if(!_0x3b8824['query'][_0x0b56('0x35')](_0x0b56('0x36'))){_0x39e0ad['limit']=qs[_0x0b56('0x37')](_0x3b8824['query']['limit']);_0x39e0ad[_0x0b56('0x1b')]=qs[_0x0b56('0x1b')](_0x3b8824[_0x0b56('0x2e')][_0x0b56('0x1b')]);}_0x39e0ad['order']=qs[_0x0b56('0x38')](_0x3b8824[_0x0b56('0x2e')][_0x0b56('0x38')]);_0x39e0ad['where']=qs[_0x0b56('0x30')](_[_0x0b56('0x39')](_0x3b8824['query'],_0x540b35[_0x0b56('0x30')]),_0x53a7a9);if(_0x3b8824['query']['filter']){_0x39e0ad[_0x0b56('0x3a')]=_[_0x0b56('0x3b')](_0x39e0ad['where'],{'$or':_[_0x0b56('0x29')](_0x53a7a9,function(_0x13e315){if(_0x13e315['type']!==_0x0b56('0x3c')){var _0xaab6d0={};_0xaab6d0[_0x13e315[_0x0b56('0x27')]]={'$like':'%'+_0x3b8824[_0x0b56('0x2e')][_0x0b56('0x3d')]+'%'};return _0xaab6d0;}})});}_0x39e0ad=_['merge']({},_0x39e0ad,_0x3b8824[_0x0b56('0x3e')]);var _0x106281={'where':_0x39e0ad['where']};return db['Variable'][_0x0b56('0x1a')](_0x106281)[_0x0b56('0x22')](function(_0x33f96e){_0x5bfb1f[_0x0b56('0x1a')]=_0x33f96e;if(_0x3b8824[_0x0b56('0x2e')][_0x0b56('0x3f')]){_0x39e0ad[_0x0b56('0x40')]=[{'all':!![]}];}return db[_0x0b56('0x2a')]['findAll'](_0x39e0ad);})['then'](function(_0x260ff7){_0x5bfb1f[_0x0b56('0x41')]=_0x260ff7;return _0x5bfb1f;})[_0x0b56('0x22')](respondWithFilteredResult(_0x3d4f3e,_0x39e0ad))[_0x0b56('0x42')](handleError(_0x3d4f3e,null));};exports[_0x0b56('0x43')]=function(_0x434a92,_0x43a8fe){var _0xedf2da={'raw':!![],'where':{'id':_0x434a92[_0x0b56('0x44')]['id']}},_0x753165={};_0x753165['model']=_['keys'](db[_0x0b56('0x2a')][_0x0b56('0x2b')]);_0x753165[_0x0b56('0x2e')]=_[_0x0b56('0x2f')](_0x434a92[_0x0b56('0x2e')]);_0x753165[_0x0b56('0x30')]=_['intersection'](_0x753165[_0x0b56('0x2d')],_0x753165[_0x0b56('0x2e')]);_0xedf2da[_0x0b56('0x32')]=_[_0x0b56('0x31')](_0x753165[_0x0b56('0x2d')],qs['fields'](_0x434a92[_0x0b56('0x2e')][_0x0b56('0x33')]));_0xedf2da[_0x0b56('0x32')]=_0xedf2da[_0x0b56('0x32')][_0x0b56('0x34')]?_0xedf2da[_0x0b56('0x32')]:_0x753165[_0x0b56('0x2d')];if(_0x434a92[_0x0b56('0x2e')][_0x0b56('0x3f')]){_0xedf2da[_0x0b56('0x40')]=[{'all':!![]}];}_0xedf2da=_[_0x0b56('0x3b')]({},_0xedf2da,_0x434a92[_0x0b56('0x3e')]);return db[_0x0b56('0x2a')][_0x0b56('0x45')](_0xedf2da)[_0x0b56('0x22')](handleEntityNotFound(_0x43a8fe,null))[_0x0b56('0x22')](respondWithResult(_0x43a8fe,null))[_0x0b56('0x42')](handleError(_0x43a8fe,null));};exports['create']=function(_0x2769b2,_0x17b75a){return db[_0x0b56('0x2a')][_0x0b56('0x46')](_0x2769b2[_0x0b56('0x47')],{})['then'](function(_0x17bd48){var _0x167b1a=_0x2769b2[_0x0b56('0x48')][_0x0b56('0x49')]({'plain':!![]});if(!_0x167b1a)throw new Error(_0x0b56('0x4a'));if(_0x167b1a[_0x0b56('0x4b')]==='user'){var _0x502746=_0x17bd48['get']({'plain':!![]});var _0x2d00a5='Variables';return db[_0x0b56('0x4c')][_0x0b56('0x45')]({'where':{'name':_0x2d00a5,'userProfileId':_0x167b1a[_0x0b56('0x4d')]},'raw':!![]})[_0x0b56('0x22')](function(_0x57fc52){if(_0x57fc52&&_0x57fc52['autoAssociation']===0x0){return db[_0x0b56('0x24')][_0x0b56('0x46')]({'name':_0x502746[_0x0b56('0x27')],'resourceId':_0x502746['id'],'type':_0x57fc52[_0x0b56('0x27')],'sectionId':_0x57fc52['id']},{})['then'](function(){return _0x17bd48;});}else{return _0x17bd48;}})[_0x0b56('0x42')](function(_0x4ec0d4){logger[_0x0b56('0x4e')](_0x0b56('0x4f'),_0x4ec0d4);throw _0x4ec0d4;});}return _0x17bd48;})[_0x0b56('0x22')](respondWithResult(_0x17b75a,0xc9))['catch'](handleError(_0x17b75a,null));};exports[_0x0b56('0x20')]=function(_0x2a3422,_0x5128cf){if(_0x2a3422[_0x0b56('0x47')]['id']){delete _0x2a3422[_0x0b56('0x47')]['id'];}return db['Variable'][_0x0b56('0x45')]({'where':{'id':_0x2a3422[_0x0b56('0x44')]['id']}})[_0x0b56('0x22')](handleEntityNotFound(_0x5128cf,null))[_0x0b56('0x22')](saveUpdates(_0x2a3422[_0x0b56('0x47')],null))['then'](respondWithResult(_0x5128cf,null))[_0x0b56('0x42')](handleError(_0x5128cf,null));};exports['destroy']=function(_0x23969c,_0x4a04b3){return db[_0x0b56('0x2a')][_0x0b56('0x45')]({'where':{'id':_0x23969c[_0x0b56('0x44')]['id']}})[_0x0b56('0x22')](handleEntityNotFound(_0x4a04b3,null))['then'](removeEntity(_0x4a04b3,null))[_0x0b56('0x42')](handleError(_0x4a04b3,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 78b3054..2a79bfc 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 _0x262a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash'];(function(_0xdbd251,_0x5a10f5){var _0x47ff35=function(_0x4321c3){while(--_0x4321c3){_0xdbd251['push'](_0xdbd251['shift']());}};_0x47ff35(++_0x5a10f5);}(_0x262a,0x178));var _0xa262=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x262a[_0x34c553];return _0x1357d2;};'use strict';var _=require(_0xa262('0x0'));var util=require(_0xa262('0x1'));var logger=require(_0xa262('0x2'))(_0xa262('0x3'));var moment=require(_0xa262('0x4'));var BPromise=require(_0xa262('0x5'));var rp=require(_0xa262('0x6'));var fs=require('fs');var path=require(_0xa262('0x7'));var rimraf=require(_0xa262('0x8'));var config=require(_0xa262('0x9'));var attributes=require(_0xa262('0xa'));module[_0xa262('0xb')]=function(_0x35c7ba,_0x5a2a98){return _0x35c7ba['define']('Variable',attributes,{'tableName':_0xa262('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5557=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes','exports','tools_variables'];(function(_0xf921bd,_0x254170){var _0x371c99=function(_0x460fac){while(--_0x460fac){_0xf921bd['push'](_0xf921bd['shift']());}};_0x371c99(++_0x254170);}(_0x5557,0xa0));var _0x7555=function(_0x543412,_0x4d2bea){_0x543412=_0x543412-0x0;var _0x4cab53=_0x5557[_0x543412];return _0x4cab53;};'use strict';var _=require('lodash');var util=require(_0x7555('0x0'));var logger=require(_0x7555('0x1'))(_0x7555('0x2'));var moment=require(_0x7555('0x3'));var BPromise=require(_0x7555('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7555('0x5'));var rimraf=require('rimraf');var config=require(_0x7555('0x6'));var attributes=require(_0x7555('0x7'));module[_0x7555('0x8')]=function(_0x4225b2,_0x4a98dc){return _0x4225b2['define']('Variable',attributes,{'tableName':_0x7555('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index bf0b0e3..4057f6f 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 _0x48b2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','ioredis'];(function(_0x4f8063,_0x2336c6){var _0x3c7529=function(_0xfe0913){while(--_0xfe0913){_0x4f8063['push'](_0x4f8063['shift']());}};_0x3c7529(++_0x2336c6);}(_0x48b2,0x1bc));var _0x248b=function(_0x42cd5e,_0x553077){_0x42cd5e=_0x42cd5e-0x0;var _0x3c4097=_0x48b2[_0x42cd5e];return _0x3c4097;};'use strict';var _=require('lodash');var util=require(_0x248b('0x0'));var moment=require('moment');var BPromise=require(_0x248b('0x1'));var rs=require(_0x248b('0x2'));var fs=require('fs');var Redis=require(_0x248b('0x3'));var db=require(_0x248b('0x4'))['db'];var utils=require(_0x248b('0x5'));var logger=require(_0x248b('0x6'))(_0x248b('0x7'));var config=require(_0x248b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x248b('0x9')][_0x248b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427e69,_0x367455,_0x18ad73){return new BPromise(function(_0x5e0def,_0x54222e){return client[_0x248b('0xb')](_0x427e69,_0x18ad73)[_0x248b('0xc')](function(_0x3197d1){logger[_0x248b('0xd')](_0x248b('0xe'),_0x367455,'request\x20sent');logger[_0x248b('0xf')](_0x248b('0x10'),_0x367455,_0x248b('0x11'),JSON['stringify'](_0x3197d1));if(_0x3197d1['error']){if(_0x3197d1[_0x248b('0x12')][_0x248b('0x13')]===0x1f4){logger[_0x248b('0x12')]('Variable,\x20%s,\x20%s',_0x367455,_0x3197d1[_0x248b('0x12')][_0x248b('0x14')]);return _0x54222e(_0x3197d1[_0x248b('0x12')]['message']);}logger[_0x248b('0x12')](_0x248b('0xe'),_0x367455,_0x3197d1[_0x248b('0x12')][_0x248b('0x14')]);return _0x5e0def(_0x3197d1['error'][_0x248b('0x14')]);}else{logger['info'](_0x248b('0xe'),_0x367455,_0x248b('0x11'));_0x5e0def(_0x3197d1[_0x248b('0x15')][_0x248b('0x14')]);}})[_0x248b('0x16')](function(_0x2609fc){logger[_0x248b('0x12')]('Variable,\x20%s,\x20%s',_0x367455,_0x2609fc);_0x54222e(_0x2609fc);});});}exports[_0x248b('0x17')]=function(_0x2e884e){var _0x36b824=this;return new Promise(function(_0x227aad,_0x9893fe){return db['Variable'][_0x248b('0x18')]({'raw':_0x2e884e['options']?_0x2e884e[_0x248b('0x19')][_0x248b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e884e['options']?_0x2e884e[_0x248b('0x19')][_0x248b('0x1b')]||null:null,'attributes':_0x2e884e[_0x248b('0x19')]?_0x2e884e[_0x248b('0x19')][_0x248b('0x1c')]||null:null,'include':_0x2e884e[_0x248b('0x19')]?_0x2e884e[_0x248b('0x19')][_0x248b('0x1d')]?_[_0x248b('0x1e')](_0x2e884e[_0x248b('0x19')][_0x248b('0x1d')],function(_0x1234d7){return{'model':db[_0x1234d7[_0x248b('0x1f')]],'as':_0x1234d7['as'],'attributes':_0x1234d7[_0x248b('0x1c')],'include':_0x1234d7[_0x248b('0x1d')]?_['map'](_0x1234d7[_0x248b('0x1d')],function(_0x1a3a0a){return{'model':db[_0x1a3a0a['model']],'as':_0x1a3a0a['as'],'attributes':_0x1a3a0a[_0x248b('0x1c')],'include':_0x1a3a0a[_0x248b('0x1d')]?_[_0x248b('0x1e')](_0x1a3a0a['include'],function(_0x13670e){return{'model':db[_0x13670e[_0x248b('0x1f')]],'as':_0x13670e['as'],'attributes':_0x13670e[_0x248b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x248b('0xc')](function(_0x15b32a){logger['info'](_0x248b('0x17'),_0x2e884e);logger[_0x248b('0xf')](_0x248b('0x17'),_0x2e884e,JSON['stringify'](_0x15b32a));_0x227aad(_0x15b32a);})[_0x248b('0x16')](function(_0x1f5624){logger[_0x248b('0x12')]('ShowVariable',_0x1f5624['message'],_0x2e884e);_0x9893fe(_0x36b824[_0x248b('0x12')](0x1f4,_0x1f5624[_0x248b('0x14')]));});});}; \ No newline at end of file +var _0xb109=['error','code','message','result','ShowVariable','Variable','find','options','raw','where','include','map','attributes','model','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x280600,_0x4ddd94){var _0x5116eb=function(_0x5c36a3){while(--_0x5c36a3){_0x280600['push'](_0x280600['shift']());}};_0x5116eb(++_0x4ddd94);}(_0xb109,0x1ca));var _0x9b10=function(_0x2de699,_0x29ccd8){_0x2de699=_0x2de699-0x0;var _0x1754b7=_0xb109[_0x2de699];return _0x1754b7;};'use strict';var _=require(_0x9b10('0x0'));var util=require(_0x9b10('0x1'));var moment=require(_0x9b10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9b10('0x3'));var fs=require('fs');var Redis=require(_0x9b10('0x4'));var db=require(_0x9b10('0x5'))['db'];var utils=require(_0x9b10('0x6'));var logger=require('../../config/logger')(_0x9b10('0x7'));var config=require(_0x9b10('0x8'));var jayson=require(_0x9b10('0x9'));var client=jayson['client'][_0x9b10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ff369,_0xf0e0f7,_0x526dc2){return new BPromise(function(_0x24a3bf,_0x2ca4cc){return client[_0x9b10('0xb')](_0x2ff369,_0x526dc2)[_0x9b10('0xc')](function(_0x5965d7){logger[_0x9b10('0xd')](_0x9b10('0xe'),_0xf0e0f7,_0x9b10('0xf'));logger['debug'](_0x9b10('0x10'),_0xf0e0f7,_0x9b10('0xf'),JSON[_0x9b10('0x11')](_0x5965d7));if(_0x5965d7['error']){if(_0x5965d7[_0x9b10('0x12')][_0x9b10('0x13')]===0x1f4){logger[_0x9b10('0x12')]('Variable,\x20%s,\x20%s',_0xf0e0f7,_0x5965d7[_0x9b10('0x12')][_0x9b10('0x14')]);return _0x2ca4cc(_0x5965d7['error'][_0x9b10('0x14')]);}logger[_0x9b10('0x12')](_0x9b10('0xe'),_0xf0e0f7,_0x5965d7[_0x9b10('0x12')][_0x9b10('0x14')]);return _0x24a3bf(_0x5965d7[_0x9b10('0x12')][_0x9b10('0x14')]);}else{logger['info'](_0x9b10('0xe'),_0xf0e0f7,_0x9b10('0xf'));_0x24a3bf(_0x5965d7[_0x9b10('0x15')][_0x9b10('0x14')]);}})['catch'](function(_0x2805ce){logger[_0x9b10('0x12')](_0x9b10('0xe'),_0xf0e0f7,_0x2805ce);_0x2ca4cc(_0x2805ce);});});}exports[_0x9b10('0x16')]=function(_0x10e9c5){var _0x567bdf=this;return new Promise(function(_0x2b2e08,_0x20b89b){return db[_0x9b10('0x17')][_0x9b10('0x18')]({'raw':_0x10e9c5[_0x9b10('0x19')]?_0x10e9c5[_0x9b10('0x19')][_0x9b10('0x1a')]===undefined?!![]:![]:!![],'where':_0x10e9c5[_0x9b10('0x19')]?_0x10e9c5[_0x9b10('0x19')][_0x9b10('0x1b')]||null:null,'attributes':_0x10e9c5['options']?_0x10e9c5[_0x9b10('0x19')]['attributes']||null:null,'include':_0x10e9c5[_0x9b10('0x19')]?_0x10e9c5[_0x9b10('0x19')][_0x9b10('0x1c')]?_[_0x9b10('0x1d')](_0x10e9c5[_0x9b10('0x19')]['include'],function(_0x39b24d){return{'model':db[_0x39b24d['model']],'as':_0x39b24d['as'],'attributes':_0x39b24d[_0x9b10('0x1e')],'include':_0x39b24d[_0x9b10('0x1c')]?_[_0x9b10('0x1d')](_0x39b24d[_0x9b10('0x1c')],function(_0x49667b){return{'model':db[_0x49667b[_0x9b10('0x1f')]],'as':_0x49667b['as'],'attributes':_0x49667b[_0x9b10('0x1e')],'include':_0x49667b['include']?_[_0x9b10('0x1d')](_0x49667b[_0x9b10('0x1c')],function(_0x24afc0){return{'model':db[_0x24afc0[_0x9b10('0x1f')]],'as':_0x24afc0['as'],'attributes':_0x24afc0[_0x9b10('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9b10('0xc')](function(_0x16e086){logger['info'](_0x9b10('0x16'),_0x10e9c5);logger[_0x9b10('0x20')](_0x9b10('0x16'),_0x10e9c5,JSON[_0x9b10('0x11')](_0x16e086));_0x2b2e08(_0x16e086);})[_0x9b10('0x21')](function(_0x1adcd7){logger[_0x9b10('0x12')](_0x9b10('0x16'),_0x1adcd7[_0x9b10('0x14')],_0x10e9c5);_0x20b89b(_0x567bdf[_0x9b10('0x12')](0x1f4,_0x1adcd7[_0x9b10('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 77d0a52..a13c111 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 _0xd7a3=['/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','/restart','migrations','exports','Router','../../components/auth/service','./version.controller','get','index'];(function(_0x282a38,_0x2acad1){var _0x2f5113=function(_0x17a4c7){while(--_0x17a4c7){_0x282a38['push'](_0x282a38['shift']());}};_0x2f5113(++_0x2acad1);}(_0xd7a3,0x1d7));var _0x3d7a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd7a3[_0xbca1b1];return _0x4e1686;};'use strict';var express=require('express');var router=express[_0x3d7a('0x0')]();var auth=require(_0x3d7a('0x1'));var controller=require(_0x3d7a('0x2'));router[_0x3d7a('0x3')]('/',controller[_0x3d7a('0x4')]);router[_0x3d7a('0x3')](_0x3d7a('0x5'),auth[_0x3d7a('0x6')](),auth[_0x3d7a('0x7')](),controller[_0x3d7a('0x8')]);router[_0x3d7a('0x3')](_0x3d7a('0x9'),auth[_0x3d7a('0x6')](),auth[_0x3d7a('0x7')](),controller['reset']);router[_0x3d7a('0x3')](_0x3d7a('0xa'),auth['isAuthenticated'](),auth[_0x3d7a('0x7')](),controller['pull']);router[_0x3d7a('0x3')](_0x3d7a('0xb'),auth[_0x3d7a('0x6')](),controller['restart']);router[_0x3d7a('0x3')]('/migrations',controller[_0x3d7a('0xc')]);module[_0x3d7a('0xd')]=router; \ No newline at end of file +var _0x00b7=['get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service'];(function(_0x23165a,_0x19d021){var _0x40c6c4=function(_0x57e397){while(--_0x57e397){_0x23165a['push'](_0x23165a['shift']());}};_0x40c6c4(++_0x19d021);}(_0x00b7,0x8d));var _0x700b=function(_0x4db581,_0x4e492f){_0x4db581=_0x4db581-0x0;var _0xa7f427=_0x00b7[_0x4db581];return _0xa7f427;};'use strict';var express=require(_0x700b('0x0'));var router=express[_0x700b('0x1')]();var auth=require(_0x700b('0x2'));var controller=require('./version.controller');router[_0x700b('0x3')]('/',controller['index']);router[_0x700b('0x3')](_0x700b('0x4'),auth[_0x700b('0x5')](),auth[_0x700b('0x6')](),controller[_0x700b('0x7')]);router['get'](_0x700b('0x8'),auth[_0x700b('0x5')](),auth[_0x700b('0x6')](),controller[_0x700b('0x9')]);router[_0x700b('0x3')]('/pull',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x700b('0xa')]);router['get'](_0x700b('0xb'),auth[_0x700b('0x5')](),controller[_0x700b('0xc')]);router[_0x700b('0x3')](_0x700b('0xd'),controller[_0x700b('0xe')]);module[_0x700b('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 33c4a71..da76896 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 _0xcf3d=['json','status','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','join','server','migrations','length','replace','.js','version','sort','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','query','latest','fetch','tags','exports','2.0.0'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x512a92,_0x194e79){_0x512a92=_0x512a92-0x0;var _0x1cc619=_0xcf3d[_0x512a92];return _0x1cc619;};'use strict';var Umzug=require(_0xdcf3('0x0'));var path=require(_0xdcf3('0x1'));var fs=require('fs');var _=require(_0xdcf3('0x2'));var pkginfo=require(_0xdcf3('0x3'))(module,'version');var compareVersions=require(_0xdcf3('0x4'));var exec=require('child_process')[_0xdcf3('0x5')];var db=require(_0xdcf3('0x6'))['db'];var config=require(_0xdcf3('0x7'));var pm2=require(_0xdcf3('0x8'));var logger=require(_0xdcf3('0x9'))(_0xdcf3('0xa'));var git=require('simple-git')(config[_0xdcf3('0xb')]);exports['index']=function(_0x2cd0af,_0x45c5bd){var _0x55fe3a={'current':module['exports']['version'],'phonebar':0x2};if(_0x2cd0af[_0xdcf3('0xc')]&&_0x2cd0af[_0xdcf3('0xc')][_0xdcf3('0xd')]){return git[_0xdcf3('0xe')]()[_0xdcf3('0xf')](function(_0x6f7c77,_0x474801){_0x55fe3a[_0xdcf3('0xd')]=(_0x6f7c77?module[_0xdcf3('0x10')]['version']:_0x474801[_0xdcf3('0xd')])||_0xdcf3('0x11');return _0x45c5bd['status'](0xc8)[_0xdcf3('0x12')](_0x55fe3a);});}else{return _0x45c5bd[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')](_0x55fe3a);}};exports[_0xdcf3('0xe')]=function(_0x5c2da7,_0x2d0bc2){return git[_0xdcf3('0xe')](['origin',_0xdcf3('0x14')],function(_0x4b622c){if(_0x4b622c){logger[_0xdcf3('0x15')](_0x4b622c);return _0x2d0bc2[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x4b622c);}logger[_0xdcf3('0x16')]('git\x20fetch');return _0x2d0bc2[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xdcf3('0x17')]=function(_0x399579,_0x441142){return git[_0xdcf3('0x17')]([_0xdcf3('0x18'),_0xdcf3('0x19')],function(_0x28844a){if(_0x28844a){logger[_0xdcf3('0x15')](_0x28844a);return _0x441142[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x28844a);}logger[_0xdcf3('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x441142['status'](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x1a')});});};exports['pull']=function(_0x4e3e41,_0x43e082){exec('npm\x20install\x20--production',function(_0x5622de,_0x71009c,_0x273591){logger[_0xdcf3('0x16')](_0x71009c);logger['info'](_0x273591);if(_0x5622de){logger[_0xdcf3('0x15')](_0x5622de);return _0x43e082['status'](0x1f4)[_0xdcf3('0x12')](_0x5622de);}return _0x43e082['status'](0xc8)[_0xdcf3('0x12')]({'output':_0x71009c});});};exports[_0xdcf3('0x1b')]=function(_0x1b600a,_0x39567f){return pm2['restart'](_0xdcf3('0x1c'))['then'](function(_0x968801){logger[_0xdcf3('0x16')](_0xdcf3('0x1d'),_0x968801);return _0x39567f[_0xdcf3('0x13')](0xc8)['json']({'output':_0xdcf3('0x1e')});})['catch'](function(_0x5c3ad7){logger['error'](_0x5c3ad7);return _0x39567f['status'](0x1f4)[_0xdcf3('0x12')](_0x5c3ad7);});};exports['migrations']=function(_0x3165a5,_0x56964c){var _0x3b34a5=fs['readdirSync'](path[_0xdcf3('0x1f')](config[_0xdcf3('0xb')],_0xdcf3('0x20'),_0xdcf3('0x21')));var _0x18a560=[];for(var _0x377083=0x0;_0x377083<_0x3b34a5[_0xdcf3('0x22')];_0x377083++){var _0xd846f9=_0x3b34a5[_0x377083][_0xdcf3('0x23')](_0xdcf3('0x24'),'');if(compareVersions(module[_0xdcf3('0x10')][_0xdcf3('0x25')],_0xd846f9)===-0x1){_0x18a560['push'](_0xd846f9);}}if(_0x18a560[_0xdcf3('0x22')]){var _0x42d0f9=_0x18a560[_0xdcf3('0x26')](compareVersions);var _0x3b8301=new Umzug({'storage':_0xdcf3('0x27'),'storageOptions':{'model':db[_0xdcf3('0x28')],'modelName':_0xdcf3('0x28'),'columnName':_0xdcf3('0x25')},'migrations':{'params':[db[_0xdcf3('0x27')]['getQueryInterface'](),db[_0xdcf3('0x27')]['constructor'],function(){throw new Error(_0xdcf3('0x29'));}],'path':path[_0xdcf3('0x1f')](config[_0xdcf3('0xb')],_0xdcf3('0x20'),_0xdcf3('0x21')),'pattern':/\.js$/}});_0x3b8301['up']({'migrations':_[_0xdcf3('0x2a')](_0x42d0f9,function(_0x4911ff){return _0x4911ff+_0xdcf3('0x24');})})[_0xdcf3('0x2b')](function(){return _0x56964c['status'](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x2c')+module['exports'][_0xdcf3('0x25')]+_0xdcf3('0x2d')+_[_0xdcf3('0x2e')](_0x42d0f9),'migrations':_[_0xdcf3('0x1f')](_0x42d0f9)});})['catch'](function(_0x13d769){if(_0x13d769 instanceof db[_0xdcf3('0x27')]['UniqueConstraintError']){return _0x56964c['status'](0xc8)['json']({'output':_0xdcf3('0x2f')});}else{return _0x56964c[_0xdcf3('0x13')](0x1f4)[_0xdcf3('0x12')](_0x13d769);}});}else{return _0x56964c[_0xdcf3('0x13')](0xc8)[_0xdcf3('0x12')]({'output':_0xdcf3('0x2f')});}}; \ No newline at end of file +var _0xf9ac=['Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','umzug','pkginfo','version','child_process','../../mysqldb','../../config/logger','update','simple-git','root','query','fetch','latest','2.0.0','status','json','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','server','migrations','length','replace','exports','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','.js'];(function(_0x204a09,_0xf4f03c){var _0x2d627d=function(_0x50c721){while(--_0x50c721){_0x204a09['push'](_0x204a09['shift']());}};_0x2d627d(++_0xf4f03c);}(_0xf9ac,0x87));var _0xcf9a=function(_0xde6b0,_0x47ff01){_0xde6b0=_0xde6b0-0x0;var _0x49da46=_0xf9ac[_0xde6b0];return _0x49da46;};'use strict';var Umzug=require(_0xcf9a('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xcf9a('0x1'))(module,_0xcf9a('0x2'));var compareVersions=require('compare-versions');var exec=require(_0xcf9a('0x3'))['exec'];var db=require(_0xcf9a('0x4'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xcf9a('0x5'))(_0xcf9a('0x6'));var git=require(_0xcf9a('0x7'))(config[_0xcf9a('0x8')]);exports['index']=function(_0x33a1a6,_0x3d2f54){var _0x4c0665={'current':module['exports'][_0xcf9a('0x2')],'phonebar':0x2};if(_0x33a1a6['query']&&_0x33a1a6[_0xcf9a('0x9')]['latest']){return git[_0xcf9a('0xa')]()['tags'](function(_0x3d93ad,_0x683ab8){_0x4c0665[_0xcf9a('0xb')]=(_0x3d93ad?module['exports']['version']:_0x683ab8['latest'])||_0xcf9a('0xc');return _0x3d2f54[_0xcf9a('0xd')](0xc8)['json'](_0x4c0665);});}else{return _0x3d2f54[_0xcf9a('0xd')](0xc8)[_0xcf9a('0xe')](_0x4c0665);}};exports[_0xcf9a('0xa')]=function(_0x583cdf,_0x1998a4){return git['fetch'](['origin','master'],function(_0x55c27a){if(_0x55c27a){logger[_0xcf9a('0xf')](_0x55c27a);return _0x1998a4[_0xcf9a('0xd')](0x1f4)[_0xcf9a('0xe')](_0x55c27a);}logger[_0xcf9a('0x10')](_0xcf9a('0x11'));return _0x1998a4[_0xcf9a('0xd')](0xc8)[_0xcf9a('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xcf9a('0x12')]=function(_0x2a5f92,_0x503390){return git[_0xcf9a('0x12')](['--hard',_0xcf9a('0x13')],function(_0x4f1714){if(_0x4f1714){logger[_0xcf9a('0xf')](_0x4f1714);return _0x503390[_0xcf9a('0xd')](0x1f4)[_0xcf9a('0xe')](_0x4f1714);}logger[_0xcf9a('0x10')](_0xcf9a('0x14'));return _0x503390['status'](0xc8)['json']({'output':_0xcf9a('0x15')});});};exports['pull']=function(_0x46d8b0,_0x2e308a){exec(_0xcf9a('0x16'),function(_0x5e8019,_0x366682,_0x2388d1){logger[_0xcf9a('0x10')](_0x366682);logger['info'](_0x2388d1);if(_0x5e8019){logger[_0xcf9a('0xf')](_0x5e8019);return _0x2e308a[_0xcf9a('0xd')](0x1f4)[_0xcf9a('0xe')](_0x5e8019);}return _0x2e308a['status'](0xc8)['json']({'output':_0x366682});});};exports[_0xcf9a('0x17')]=function(_0x41fa37,_0x11f372){return pm2[_0xcf9a('0x17')](_0xcf9a('0x18'))[_0xcf9a('0x19')](function(_0x4f9b8c){logger[_0xcf9a('0x10')]('pm2\x20restart\x20motion\x20%s',_0x4f9b8c);return _0x11f372['status'](0xc8)[_0xcf9a('0xe')]({'output':_0xcf9a('0x1a')});})[_0xcf9a('0x1b')](function(_0x465ed0){logger[_0xcf9a('0xf')](_0x465ed0);return _0x11f372[_0xcf9a('0xd')](0x1f4)[_0xcf9a('0xe')](_0x465ed0);});};exports['migrations']=function(_0x5cb115,_0xe79752){var _0x409207=fs['readdirSync'](path['join'](config['root'],_0xcf9a('0x1c'),_0xcf9a('0x1d')));var _0x40d7d7=[];for(var _0x5664bd=0x0;_0x5664bd<_0x409207[_0xcf9a('0x1e')];_0x5664bd++){var _0xce0179=_0x409207[_0x5664bd][_0xcf9a('0x1f')]('.js','');if(compareVersions(module[_0xcf9a('0x20')][_0xcf9a('0x2')],_0xce0179)===-0x1){_0x40d7d7[_0xcf9a('0x21')](_0xce0179);}}if(_0x40d7d7[_0xcf9a('0x1e')]){var _0x12a4c8=_0x40d7d7[_0xcf9a('0x22')](compareVersions);var _0x6a5e8b=new Umzug({'storage':_0xcf9a('0x23'),'storageOptions':{'model':db[_0xcf9a('0x24')],'modelName':_0xcf9a('0x24'),'columnName':_0xcf9a('0x2')},'migrations':{'params':[db['sequelize'][_0xcf9a('0x25')](),db['sequelize']['constructor'],function(){throw new Error(_0xcf9a('0x26'));}],'path':path[_0xcf9a('0x27')](config[_0xcf9a('0x8')],_0xcf9a('0x1c'),_0xcf9a('0x1d')),'pattern':/\.js$/}});_0x6a5e8b['up']({'migrations':_['map'](_0x12a4c8,function(_0x51294a){return _0x51294a+_0xcf9a('0x28');})})[_0xcf9a('0x19')](function(){return _0xe79752[_0xcf9a('0xd')](0xc8)['json']({'output':_0xcf9a('0x29')+module[_0xcf9a('0x20')]['version']+'\x20to\x20'+_[_0xcf9a('0x2a')](_0x12a4c8),'migrations':_[_0xcf9a('0x27')](_0x12a4c8)});})[_0xcf9a('0x1b')](function(_0x1bd386){if(_0x1bd386 instanceof db[_0xcf9a('0x23')]['UniqueConstraintError']){return _0xe79752[_0xcf9a('0xd')](0xc8)[_0xcf9a('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xe79752[_0xcf9a('0xd')](0x1f4)['json'](_0x1bd386);}});}else{return _0xe79752[_0xcf9a('0xd')](0xc8)[_0xcf9a('0xe')]({'output':_0xcf9a('0x2b')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2033413..1a08ace 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 _0x152c=['isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x152c,0x161));var _0xc152=function(_0x5e6925,_0x2098d2){_0x5e6925=_0x5e6925-0x0;var _0x171596=_0x152c[_0x5e6925];return _0x171596;};'use strict';var multer=require(_0xc152('0x0'));var util=require(_0xc152('0x1'));var path=require(_0xc152('0x2'));var timeout=require(_0xc152('0x3'));var express=require(_0xc152('0x4'));var router=express[_0xc152('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc152('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xc152('0x7')]('/',auth[_0xc152('0x8')](),controller['index']);router[_0xc152('0x7')](_0xc152('0x9'),auth[_0xc152('0x8')](),controller[_0xc152('0xa')]);router[_0xc152('0x7')](_0xc152('0xb'),auth[_0xc152('0x8')](),controller[_0xc152('0xc')]);router['post']('/',auth[_0xc152('0x8')](),controller[_0xc152('0xd')]);router[_0xc152('0xe')](_0xc152('0xb'),auth[_0xc152('0x8')](),controller[_0xc152('0xf')]);router[_0xc152('0x10')]('/:id',auth[_0xc152('0x8')](),controller[_0xc152('0x11')]);module[_0xc152('0x12')]=router; \ No newline at end of file +var _0x0442=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','index','isAuthenticated','show','put','/:id','update','delete','exports'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x0442,0x1e6));var _0x2044=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x0442[_0x41cfd4];return _0x190f48;};'use strict';var multer=require(_0x2044('0x0'));var util=require(_0x2044('0x1'));var path=require(_0x2044('0x2'));var timeout=require(_0x2044('0x3'));var express=require(_0x2044('0x4'));var router=express[_0x2044('0x5')]();var auth=require(_0x2044('0x6'));var interaction=require(_0x2044('0x7'));var config=require('../../config/environment');var controller=require(_0x2044('0x8'));router[_0x2044('0x9')]('/',auth['isAuthenticated'](),controller[_0x2044('0xa')]);router[_0x2044('0x9')]('/describe',auth[_0x2044('0xb')](),controller['describe']);router['get']('/:id',auth[_0x2044('0xb')](),controller[_0x2044('0xc')]);router['post']('/',auth[_0x2044('0xb')](),controller['create']);router[_0x2044('0xd')](_0x2044('0xe'),auth[_0x2044('0xb')](),controller[_0x2044('0xf')]);router[_0x2044('0x10')](_0x2044('0xe'),auth[_0x2044('0xb')](),controller['destroy']);module[_0x2044('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8c58b7e..6717252 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 _0x326f=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x92ecc8,_0x2bcc34){var _0x59db4f=function(_0x16440d){while(--_0x16440d){_0x92ecc8['push'](_0x92ecc8['shift']());}};_0x59db4f(++_0x2bcc34);}(_0x326f,0xd1));var _0xf326=function(_0x55347b,_0x5e97ca){_0x55347b=_0x55347b-0x0;var _0x54fb1c=_0x326f[_0x55347b];return _0x54fb1c;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf326('0x1')]},'calleridnum':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'queue':{'type':Sequelize[_0xf326('0x1')]},'interface':{'type':Sequelize[_0xf326('0x1')]},'membername':{'type':Sequelize[_0xf326('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf326('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf326('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xf326('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xf326('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf326('0x3')]},'agentcomplete':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf326('0x1')]},'lastevent':{'type':Sequelize[_0xf326('0x1')]},'channel':{'type':Sequelize[_0xf326('0x1')]},'channelstate':{'type':Sequelize[_0xf326('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf326('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf326('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf326('0x1')]},'destchannelstate':{'type':Sequelize[_0xf326('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf326('0x1')]},'destcalleridname':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf326('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf326('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xf326('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf326('0x1')]},'destuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf326('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xf326('0x1')]},'transfer':{'type':Sequelize[_0xf326('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf326('0x1')],'comment':_0xf326('0x5')},'transferexten':{'type':Sequelize[_0xf326('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xf326('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf494=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3cdb4b,_0x13bebe){var _0x2b4fde=function(_0x52a772){while(--_0x52a772){_0x3cdb4b['push'](_0x3cdb4b['shift']());}};_0x2b4fde(++_0x13bebe);}(_0xf494,0x1c6));var _0x4f49=function(_0x59dacf,_0x4f3291){_0x59dacf=_0x59dacf-0x0;var _0x46e0e3=_0xf494[_0x59dacf];return _0x46e0e3;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'type':{'type':Sequelize[_0x4f49('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4f49('0x2')]},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'queue':{'type':Sequelize[_0x4f49('0x2')]},'interface':{'type':Sequelize[_0x4f49('0x2')]},'membername':{'type':Sequelize[_0x4f49('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4f49('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4f49('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4f49('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4f49('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4f49('0x3')]},'holdtime':{'type':Sequelize[_0x4f49('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4f49('0x4')]},'agentacw':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4f49('0x4')]},'reason':{'type':Sequelize[_0x4f49('0x2')]},'lastevent':{'type':Sequelize[_0x4f49('0x2')]},'channel':{'type':Sequelize[_0x4f49('0x2')]},'channelstate':{'type':Sequelize[_0x4f49('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4f49('0x2')]},'destchannel':{'type':Sequelize[_0x4f49('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4f49('0x2')]},'destcalleridname':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4f49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4f49('0x2')]},'destlanguage':{'type':Sequelize[_0x4f49('0x2')]},'destaccountcode':{'type':Sequelize[_0x4f49('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4f49('0x2')]},'destpriority':{'type':Sequelize[_0x4f49('0x2')]},'destuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4f49('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4f49('0x2')],'comment':_0x4f49('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4f49('0x2')]},'agententerreason':{'type':Sequelize[_0x4f49('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 45b271f..ae5ec54 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 _0x4036=['describe','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/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','destroy','end','error','name','send','index','map','VoiceAgentReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','count','then','include','findAll','catch','show','includeAll','options','find','create','body','update','params'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4036,0x182));var _0x6403=function(_0x6c0237,_0x4d210a){_0x6c0237=_0x6c0237-0x0;var _0x4889e3=_0x4036[_0x6c0237];return _0x4889e3;};'use strict';var pdf=require(_0x6403('0x0'));var emlformat=require(_0x6403('0x1'));var rimraf=require(_0x6403('0x2'));var zipdir=require(_0x6403('0x3'));var jsonpatch=require(_0x6403('0x4'));var rp=require('request-promise');var moment=require(_0x6403('0x5'));var BPromise=require(_0x6403('0x6'));var Mustache=require(_0x6403('0x7'));var util=require(_0x6403('0x8'));var path=require(_0x6403('0x9'));var sox=require(_0x6403('0xa'));var csv=require(_0x6403('0xb'));var ejs=require(_0x6403('0xc'));var fs=require('fs');var _=require(_0x6403('0xd'));var squel=require('squel');var crypto=require(_0x6403('0xe'));var jsforce=require(_0x6403('0xf'));var deskjs=require(_0x6403('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6403('0x11'));var Papa=require(_0x6403('0x12'));var Redis=require(_0x6403('0x13'));var authService=require(_0x6403('0x14'));var qs=require(_0x6403('0x15'));var as=require(_0x6403('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6403('0x17'))(_0x6403('0x18'));var utils=require(_0x6403('0x19'));var config=require(_0x6403('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x919cbd,_0x194231){_0x194231=_0x194231||0xcc;return function(_0x2d4ebd){if(_0x2d4ebd){return _0x919cbd[_0x6403('0x1b')](_0x194231);}return _0x919cbd[_0x6403('0x1c')](_0x194231)['end']();};}function respondWithResult(_0x42c13e,_0x1564bb){_0x1564bb=_0x1564bb||0xc8;return function(_0x43841b){if(_0x43841b){return _0x42c13e['status'](_0x1564bb)[_0x6403('0x1d')](_0x43841b);}};}function respondWithFilteredResult(_0x4c1bce,_0x2041e7){return function(_0xa0b66d){if(_0xa0b66d){var _0x2e0aca=_0xa0b66d['count'],_0x68ae2=_0x2041e7[_0x6403('0x1e')],_0x1828b4=_0x2041e7[_0x6403('0x1e')]+_0x2041e7[_0x6403('0x1f')],_0x26bf92;if(_0x1828b4>=_0x2e0aca){_0x1828b4=_0x2e0aca;_0x26bf92=0xc8;}else{_0x26bf92=0xce;}_0x4c1bce['status'](_0x26bf92);return _0x4c1bce[_0x6403('0x20')](_0x6403('0x21'),_0x68ae2+'-'+_0x1828b4+'/'+_0x2e0aca)[_0x6403('0x1d')](_0xa0b66d);}return null;};}function patchUpdates(_0x558cbd){return function(_0x541a69){try{jsonpatch['apply'](_0x541a69,_0x558cbd,!![]);}catch(_0x4cfacc){return BPromise[_0x6403('0x22')](_0x4cfacc);}return _0x541a69[_0x6403('0x23')]();};}function saveUpdates(_0x22fcb9,_0x285b32){return function(_0x923481){if(_0x923481){return _0x923481['update'](_0x22fcb9)['then'](function(_0x502d17){return _0x502d17;});}return null;};}function removeEntity(_0x41c986,_0x14c8bc){return function(_0x29b585){if(_0x29b585){return _0x29b585[_0x6403('0x24')]()['then'](function(){_0x41c986['status'](0xcc)[_0x6403('0x25')]();});}};}function handleEntityNotFound(_0xcad240,_0x393e47){return function(_0x25caf7){if(!_0x25caf7){_0xcad240[_0x6403('0x1b')](0x194);}return _0x25caf7;};}function handleError(_0x294e6d,_0x45426e){_0x45426e=_0x45426e||0x1f4;return function(_0x45deb6){logger[_0x6403('0x26')](_0x45deb6['stack']);if(_0x45deb6[_0x6403('0x27')]){delete _0x45deb6[_0x6403('0x27')];}_0x294e6d[_0x6403('0x1c')](_0x45426e)[_0x6403('0x28')](_0x45deb6);};}exports[_0x6403('0x29')]=function(_0x35fe40,_0x165897){var _0x598aa9={},_0x4b29b4={},_0x1b77e9={'count':0x0,'rows':[]};var _0x2e6b7d=_[_0x6403('0x2a')](db[_0x6403('0x2b')][_0x6403('0x2c')],function(_0x3253b2){return{'name':_0x3253b2['fieldName'],'type':_0x3253b2['type'][_0x6403('0x2d')]};});_0x4b29b4['model']=_[_0x6403('0x2a')](_0x2e6b7d,'name');_0x4b29b4[_0x6403('0x2e')]=_[_0x6403('0x2f')](_0x35fe40[_0x6403('0x2e')]);_0x4b29b4[_0x6403('0x30')]=_[_0x6403('0x31')](_0x4b29b4['model'],_0x4b29b4[_0x6403('0x2e')]);_0x598aa9['attributes']=_[_0x6403('0x31')](_0x4b29b4[_0x6403('0x32')],qs[_0x6403('0x33')](_0x35fe40[_0x6403('0x2e')]['fields']));_0x598aa9['attributes']=_0x598aa9[_0x6403('0x34')][_0x6403('0x35')]?_0x598aa9[_0x6403('0x34')]:_0x4b29b4[_0x6403('0x32')];if(!_0x35fe40['query'][_0x6403('0x36')]('nolimit')){_0x598aa9['limit']=qs[_0x6403('0x1f')](_0x35fe40['query']['limit']);_0x598aa9[_0x6403('0x1e')]=qs[_0x6403('0x1e')](_0x35fe40[_0x6403('0x2e')]['offset']);}_0x598aa9[_0x6403('0x37')]=qs[_0x6403('0x38')](_0x35fe40[_0x6403('0x2e')][_0x6403('0x38')]);_0x598aa9[_0x6403('0x39')]=qs[_0x6403('0x30')](_[_0x6403('0x3a')](_0x35fe40[_0x6403('0x2e')],_0x4b29b4['filters']),_0x2e6b7d);if(_0x35fe40[_0x6403('0x2e')]['filter']){_0x598aa9[_0x6403('0x39')]=_[_0x6403('0x3b')](_0x598aa9[_0x6403('0x39')],{'$or':_[_0x6403('0x2a')](_0x2e6b7d,function(_0x487811){if(_0x487811[_0x6403('0x3c')]!==_0x6403('0x3d')){var _0x5418b0={};_0x5418b0[_0x487811[_0x6403('0x27')]]={'$like':'%'+_0x35fe40['query'][_0x6403('0x3e')]+'%'};return _0x5418b0;}})});}_0x598aa9=_[_0x6403('0x3b')]({},_0x598aa9,_0x35fe40['options']);var _0x596640={'where':_0x598aa9['where']};return db['VoiceAgentReport'][_0x6403('0x3f')](_0x596640)[_0x6403('0x40')](function(_0x1c1211){_0x1b77e9['count']=_0x1c1211;if(_0x35fe40[_0x6403('0x2e')]['includeAll']){_0x598aa9[_0x6403('0x41')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x6403('0x42')](_0x598aa9);})[_0x6403('0x40')](function(_0xf1a2ef){_0x1b77e9['rows']=_0xf1a2ef;return _0x1b77e9;})[_0x6403('0x40')](respondWithFilteredResult(_0x165897,_0x598aa9))[_0x6403('0x43')](handleError(_0x165897,null));};exports[_0x6403('0x44')]=function(_0x39c6db,_0x17030a){var _0x3210b0={'raw':![],'where':{'id':_0x39c6db['params']['id']}},_0x1489e2={};_0x1489e2['model']=_[_0x6403('0x2f')](db[_0x6403('0x2b')]['rawAttributes']);_0x1489e2[_0x6403('0x2e')]=_[_0x6403('0x2f')](_0x39c6db['query']);_0x1489e2[_0x6403('0x30')]=_[_0x6403('0x31')](_0x1489e2[_0x6403('0x32')],_0x1489e2['query']);_0x3210b0[_0x6403('0x34')]=_[_0x6403('0x31')](_0x1489e2[_0x6403('0x32')],qs['fields'](_0x39c6db['query'][_0x6403('0x33')]));_0x3210b0[_0x6403('0x34')]=_0x3210b0[_0x6403('0x34')][_0x6403('0x35')]?_0x3210b0[_0x6403('0x34')]:_0x1489e2[_0x6403('0x32')];if(_0x39c6db[_0x6403('0x2e')][_0x6403('0x45')]){_0x3210b0[_0x6403('0x41')]=[{'all':!![]}];}_0x3210b0=_[_0x6403('0x3b')]({},_0x3210b0,_0x39c6db[_0x6403('0x46')]);return db[_0x6403('0x2b')][_0x6403('0x47')](_0x3210b0)[_0x6403('0x40')](handleEntityNotFound(_0x17030a,null))[_0x6403('0x40')](respondWithResult(_0x17030a,null))[_0x6403('0x43')](handleError(_0x17030a,null));};exports[_0x6403('0x48')]=function(_0x3c8fc3,_0x350708){return db[_0x6403('0x2b')][_0x6403('0x48')](_0x3c8fc3[_0x6403('0x49')],{})[_0x6403('0x40')](respondWithResult(_0x350708,0xc9))[_0x6403('0x43')](handleError(_0x350708,null));};exports[_0x6403('0x4a')]=function(_0x376846,_0x42a979){if(_0x376846['body']['id']){delete _0x376846[_0x6403('0x49')]['id'];}return db[_0x6403('0x2b')][_0x6403('0x47')]({'where':{'id':_0x376846[_0x6403('0x4b')]['id']}})[_0x6403('0x40')](handleEntityNotFound(_0x42a979,null))[_0x6403('0x40')](saveUpdates(_0x376846[_0x6403('0x49')],null))[_0x6403('0x40')](respondWithResult(_0x42a979,null))['catch'](handleError(_0x42a979,null));};exports[_0x6403('0x24')]=function(_0x3bf21d,_0x214532){return db[_0x6403('0x2b')][_0x6403('0x47')]({'where':{'id':_0x3bf21d[_0x6403('0x4b')]['id']}})[_0x6403('0x40')](handleEntityNotFound(_0x214532,null))[_0x6403('0x40')](removeEntity(_0x214532,null))[_0x6403('0x43')](handleError(_0x214532,null));};exports['describe']=function(_0x1c16ea,_0x63e9f6){return db[_0x6403('0x2b')][_0x6403('0x4c')]()[_0x6403('0x40')](respondWithResult(_0x63e9f6,null))[_0x6403('0x43')](handleError(_0x63e9f6,null));}; \ No newline at end of file +var _0xc742=['hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','count','include','catch','show','params','filters','options','find','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','json','offset','status','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x2265b0,_0x279abe){var _0xc4900b=function(_0x549d54){while(--_0x549d54){_0x2265b0['push'](_0x2265b0['shift']());}};_0xc4900b(++_0x279abe);}(_0xc742,0x12f));var _0x2c74=function(_0x4f589d,_0x5168c7){_0x4f589d=_0x4f589d-0x0;var _0x51c112=_0xc742[_0x4f589d];return _0x51c112;};'use strict';var pdf=require(_0x2c74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2c74('0x1'));var zipdir=require(_0x2c74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c74('0x3'));var moment=require(_0x2c74('0x4'));var BPromise=require(_0x2c74('0x5'));var Mustache=require('mustache');var util=require(_0x2c74('0x6'));var path=require(_0x2c74('0x7'));var sox=require(_0x2c74('0x8'));var csv=require(_0x2c74('0x9'));var ejs=require(_0x2c74('0xa'));var fs=require('fs');var _=require(_0x2c74('0xb'));var squel=require(_0x2c74('0xc'));var crypto=require(_0x2c74('0xd'));var jsforce=require(_0x2c74('0xe'));var deskjs=require(_0x2c74('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c74('0x10'));var Papa=require(_0x2c74('0x11'));var Redis=require('ioredis');var authService=require(_0x2c74('0x12'));var qs=require(_0x2c74('0x13'));var as=require(_0x2c74('0x14'));var hardwareService=require(_0x2c74('0x15'));var logger=require('../../config/logger')(_0x2c74('0x16'));var utils=require(_0x2c74('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d6f3,_0x237803){_0x237803=_0x237803||0xcc;return function(_0x2a1f85){if(_0x2a1f85){return _0x44d6f3[_0x2c74('0x18')](_0x237803);}return _0x44d6f3['status'](_0x237803)['end']();};}function respondWithResult(_0x3d3700,_0x53169a){_0x53169a=_0x53169a||0xc8;return function(_0x22a0fe){if(_0x22a0fe){return _0x3d3700['status'](_0x53169a)[_0x2c74('0x19')](_0x22a0fe);}};}function respondWithFilteredResult(_0x1ccf5c,_0x5c2d9c){return function(_0x4ee9f2){if(_0x4ee9f2){var _0x5e8818=_0x4ee9f2['count'],_0x3e9010=_0x5c2d9c[_0x2c74('0x1a')],_0x48be1b=_0x5c2d9c[_0x2c74('0x1a')]+_0x5c2d9c['limit'],_0x133a01;if(_0x48be1b>=_0x5e8818){_0x48be1b=_0x5e8818;_0x133a01=0xc8;}else{_0x133a01=0xce;}_0x1ccf5c[_0x2c74('0x1b')](_0x133a01);return _0x1ccf5c['set'](_0x2c74('0x1c'),_0x3e9010+'-'+_0x48be1b+'/'+_0x5e8818)[_0x2c74('0x19')](_0x4ee9f2);}return null;};}function patchUpdates(_0x28d1f0){return function(_0x2dc075){try{jsonpatch[_0x2c74('0x1d')](_0x2dc075,_0x28d1f0,!![]);}catch(_0x2b62a9){return BPromise['reject'](_0x2b62a9);}return _0x2dc075[_0x2c74('0x1e')]();};}function saveUpdates(_0x16bbfb,_0x259ad9){return function(_0x13b5f8){if(_0x13b5f8){return _0x13b5f8[_0x2c74('0x1f')](_0x16bbfb)['then'](function(_0x472c83){return _0x472c83;});}return null;};}function removeEntity(_0x4be2b2,_0x3f192f){return function(_0x1b59e4){if(_0x1b59e4){return _0x1b59e4[_0x2c74('0x20')]()[_0x2c74('0x21')](function(){_0x4be2b2[_0x2c74('0x1b')](0xcc)[_0x2c74('0x22')]();});}};}function handleEntityNotFound(_0x581d67,_0x4e468e){return function(_0x1112e5){if(!_0x1112e5){_0x581d67[_0x2c74('0x18')](0x194);}return _0x1112e5;};}function handleError(_0x3d5192,_0x15eb8e){_0x15eb8e=_0x15eb8e||0x1f4;return function(_0x1a0b51){logger[_0x2c74('0x23')](_0x1a0b51[_0x2c74('0x24')]);if(_0x1a0b51['name']){delete _0x1a0b51[_0x2c74('0x25')];}_0x3d5192['status'](_0x15eb8e)[_0x2c74('0x26')](_0x1a0b51);};}exports['index']=function(_0x1d08f5,_0x49e506){var _0x285aa8={},_0x57253f={},_0x14680e={'count':0x0,'rows':[]};var _0x5e9db1=_['map'](db[_0x2c74('0x27')][_0x2c74('0x28')],function(_0x36902c){return{'name':_0x36902c[_0x2c74('0x29')],'type':_0x36902c[_0x2c74('0x2a')][_0x2c74('0x2b')]};});_0x57253f[_0x2c74('0x2c')]=_[_0x2c74('0x2d')](_0x5e9db1,'name');_0x57253f[_0x2c74('0x2e')]=_[_0x2c74('0x2f')](_0x1d08f5[_0x2c74('0x2e')]);_0x57253f['filters']=_[_0x2c74('0x30')](_0x57253f[_0x2c74('0x2c')],_0x57253f[_0x2c74('0x2e')]);_0x285aa8[_0x2c74('0x31')]=_[_0x2c74('0x30')](_0x57253f[_0x2c74('0x2c')],qs[_0x2c74('0x32')](_0x1d08f5['query'][_0x2c74('0x32')]));_0x285aa8[_0x2c74('0x31')]=_0x285aa8['attributes'][_0x2c74('0x33')]?_0x285aa8[_0x2c74('0x31')]:_0x57253f['model'];if(!_0x1d08f5[_0x2c74('0x2e')][_0x2c74('0x34')](_0x2c74('0x35'))){_0x285aa8['limit']=qs[_0x2c74('0x36')](_0x1d08f5[_0x2c74('0x2e')]['limit']);_0x285aa8['offset']=qs[_0x2c74('0x1a')](_0x1d08f5[_0x2c74('0x2e')][_0x2c74('0x1a')]);}_0x285aa8[_0x2c74('0x37')]=qs[_0x2c74('0x38')](_0x1d08f5[_0x2c74('0x2e')][_0x2c74('0x38')]);_0x285aa8[_0x2c74('0x39')]=qs['filters'](_[_0x2c74('0x3a')](_0x1d08f5[_0x2c74('0x2e')],_0x57253f['filters']),_0x5e9db1);if(_0x1d08f5[_0x2c74('0x2e')]['filter']){_0x285aa8[_0x2c74('0x39')]=_[_0x2c74('0x3b')](_0x285aa8['where'],{'$or':_['map'](_0x5e9db1,function(_0x57990d){if(_0x57990d[_0x2c74('0x2a')]!=='VIRTUAL'){var _0x1f8792={};_0x1f8792[_0x57990d[_0x2c74('0x25')]]={'$like':'%'+_0x1d08f5['query'][_0x2c74('0x3c')]+'%'};return _0x1f8792;}})});}_0x285aa8=_[_0x2c74('0x3b')]({},_0x285aa8,_0x1d08f5['options']);var _0x315f34={'where':_0x285aa8[_0x2c74('0x39')]};return db[_0x2c74('0x27')][_0x2c74('0x3d')](_0x315f34)[_0x2c74('0x21')](function(_0x1a9e06){_0x14680e[_0x2c74('0x3d')]=_0x1a9e06;if(_0x1d08f5[_0x2c74('0x2e')]['includeAll']){_0x285aa8[_0x2c74('0x3e')]=[{'all':!![]}];}return db[_0x2c74('0x27')]['findAll'](_0x285aa8);})[_0x2c74('0x21')](function(_0x1d699f){_0x14680e['rows']=_0x1d699f;return _0x14680e;})[_0x2c74('0x21')](respondWithFilteredResult(_0x49e506,_0x285aa8))[_0x2c74('0x3f')](handleError(_0x49e506,null));};exports[_0x2c74('0x40')]=function(_0x7becf4,_0x5690ee){var _0x3fedac={'raw':![],'where':{'id':_0x7becf4[_0x2c74('0x41')]['id']}},_0x4f8177={};_0x4f8177[_0x2c74('0x2c')]=_['keys'](db['VoiceAgentReport'][_0x2c74('0x28')]);_0x4f8177[_0x2c74('0x2e')]=_[_0x2c74('0x2f')](_0x7becf4[_0x2c74('0x2e')]);_0x4f8177[_0x2c74('0x42')]=_['intersection'](_0x4f8177[_0x2c74('0x2c')],_0x4f8177[_0x2c74('0x2e')]);_0x3fedac['attributes']=_[_0x2c74('0x30')](_0x4f8177['model'],qs[_0x2c74('0x32')](_0x7becf4['query'][_0x2c74('0x32')]));_0x3fedac[_0x2c74('0x31')]=_0x3fedac['attributes'][_0x2c74('0x33')]?_0x3fedac['attributes']:_0x4f8177[_0x2c74('0x2c')];if(_0x7becf4[_0x2c74('0x2e')]['includeAll']){_0x3fedac[_0x2c74('0x3e')]=[{'all':!![]}];}_0x3fedac=_[_0x2c74('0x3b')]({},_0x3fedac,_0x7becf4[_0x2c74('0x43')]);return db[_0x2c74('0x27')][_0x2c74('0x44')](_0x3fedac)['then'](handleEntityNotFound(_0x5690ee,null))[_0x2c74('0x21')](respondWithResult(_0x5690ee,null))[_0x2c74('0x3f')](handleError(_0x5690ee,null));};exports['create']=function(_0x4cae45,_0x469616){return db[_0x2c74('0x27')]['create'](_0x4cae45[_0x2c74('0x45')],{})[_0x2c74('0x21')](respondWithResult(_0x469616,0xc9))[_0x2c74('0x3f')](handleError(_0x469616,null));};exports[_0x2c74('0x1f')]=function(_0x51b9de,_0x14cf13){if(_0x51b9de[_0x2c74('0x45')]['id']){delete _0x51b9de[_0x2c74('0x45')]['id'];}return db[_0x2c74('0x27')][_0x2c74('0x44')]({'where':{'id':_0x51b9de['params']['id']}})[_0x2c74('0x21')](handleEntityNotFound(_0x14cf13,null))[_0x2c74('0x21')](saveUpdates(_0x51b9de[_0x2c74('0x45')],null))['then'](respondWithResult(_0x14cf13,null))[_0x2c74('0x3f')](handleError(_0x14cf13,null));};exports[_0x2c74('0x20')]=function(_0x30124b,_0x51a283){return db[_0x2c74('0x27')][_0x2c74('0x44')]({'where':{'id':_0x30124b[_0x2c74('0x41')]['id']}})[_0x2c74('0x21')](handleEntityNotFound(_0x51a283,null))[_0x2c74('0x21')](removeEntity(_0x51a283,null))[_0x2c74('0x3f')](handleError(_0x51a283,null));};exports[_0x2c74('0x46')]=function(_0x2a3a60,_0x48a99a){return db['VoiceAgentReport'][_0x2c74('0x46')]()[_0x2c74('0x21')](respondWithResult(_0x48a99a,null))['catch'](handleError(_0x48a99a,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index c7032ad..3d6a944 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 _0xedd9=['./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4372f4,_0x1527c4){var _0x5d1d6a=function(_0x4ad586){while(--_0x4ad586){_0x4372f4['push'](_0x4372f4['shift']());}};_0x5d1d6a(++_0x1527c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a37d2,_0x54b39d){_0x3a37d2=_0x3a37d2-0x0;var _0x4ad477=_0xedd9[_0x3a37d2];return _0x4ad477;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x9edd('0xb'),_0x9edd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x59176c,_0x1b5ffe){var _0x2ef0c1=function(_0x1e3936){while(--_0x1e3936){_0x59176c['push'](_0x59176c['shift']());}};_0x2ef0c1(++_0x1b5ffe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xcb91[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e92eb34..3c414b2 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 _0x6fcb=['CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','body','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x2fdebb,_0x1b5a57){var _0x2eb150=function(_0x3750e2){while(--_0x3750e2){_0x2fdebb['push'](_0x2fdebb['shift']());}};_0x2eb150(++_0x1b5a57);}(_0x6fcb,0x1db));var _0xb6fc=function(_0x2098cc,_0x5e108e){_0x2098cc=_0x2098cc-0x0;var _0x278d7c=_0x6fcb[_0x2098cc];return _0x278d7c;};'use strict';var _=require(_0xb6fc('0x0'));var util=require(_0xb6fc('0x1'));var moment=require(_0xb6fc('0x2'));var BPromise=require(_0xb6fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6fc('0x4'));var db=require(_0xb6fc('0x5'))['db'];var utils=require(_0xb6fc('0x6'));var logger=require(_0xb6fc('0x7'))(_0xb6fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x483bb1,_0x5f05c9,_0x49cfb9){return new BPromise(function(_0x39decf,_0x35e9c7){return client[_0xb6fc('0xa')](_0x483bb1,_0x49cfb9)[_0xb6fc('0xb')](function(_0x44b77e){logger[_0xb6fc('0xc')](_0xb6fc('0xd'),_0x5f05c9,'request\x20sent');logger[_0xb6fc('0xe')](_0xb6fc('0xf'),_0x5f05c9,_0xb6fc('0x10'),JSON['stringify'](_0x44b77e));if(_0x44b77e['error']){if(_0x44b77e['error']['code']===0x1f4){logger[_0xb6fc('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x5f05c9,_0x44b77e[_0xb6fc('0x11')]['message']);return _0x35e9c7(_0x44b77e['error'][_0xb6fc('0x12')]);}logger[_0xb6fc('0x11')](_0xb6fc('0xd'),_0x5f05c9,_0x44b77e['error'][_0xb6fc('0x12')]);return _0x39decf(_0x44b77e[_0xb6fc('0x11')][_0xb6fc('0x12')]);}else{logger['info'](_0xb6fc('0xd'),_0x5f05c9,_0xb6fc('0x10'));_0x39decf(_0x44b77e[_0xb6fc('0x13')][_0xb6fc('0x12')]);}})[_0xb6fc('0x14')](function(_0x3e3b7f){logger['error'](_0xb6fc('0xd'),_0x5f05c9,_0x3e3b7f);_0x35e9c7(_0x3e3b7f);});});}exports[_0xb6fc('0x15')]=function(_0x4cd295){var _0x488df8=this;return new Promise(function(_0x38dfa5,_0xc7e260){return db[_0xb6fc('0x16')][_0xb6fc('0x17')](_0x4cd295['body'],{'raw':_0x4cd295['options']?_0x4cd295[_0xb6fc('0x18')][_0xb6fc('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32aaee){logger[_0xb6fc('0xc')](_0xb6fc('0x15'),_0x4cd295);logger[_0xb6fc('0xe')](_0xb6fc('0x15'),_0x4cd295,JSON[_0xb6fc('0x1a')](_0x32aaee));_0x38dfa5(_0x32aaee);})[_0xb6fc('0x14')](function(_0x46b020){logger[_0xb6fc('0x11')](_0xb6fc('0x15'),_0x46b020[_0xb6fc('0x12')],_0x4cd295);_0xc7e260(_0x488df8['error'](0x1f4,_0x46b020[_0xb6fc('0x12')]));});});};exports[_0xb6fc('0x1b')]=function(_0x106680){var _0x1df4ea=this;return new Promise(function(_0x38d3d0,_0x57ad40){return db['VoiceAgentReport']['update'](_0x106680[_0xb6fc('0x1c')],{'raw':_0x106680[_0xb6fc('0x18')]?_0x106680[_0xb6fc('0x18')][_0xb6fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x106680[_0xb6fc('0x18')]?_0x106680[_0xb6fc('0x18')]['where']||null:null,'attributes':_0x106680[_0xb6fc('0x18')]?_0x106680['options'][_0xb6fc('0x1d')]||null:null,'limit':_0x106680[_0xb6fc('0x18')]?_0x106680['options'][_0xb6fc('0x1e')]||null:null})[_0xb6fc('0xb')](function(_0x395747){logger[_0xb6fc('0xc')](_0xb6fc('0x1b'),_0x106680);logger[_0xb6fc('0xe')](_0xb6fc('0x1b'),_0x106680,JSON['stringify'](_0x395747));_0x38d3d0(_0x395747);})[_0xb6fc('0x14')](function(_0x1972cf){logger[_0xb6fc('0x11')](_0xb6fc('0x1b'),_0x1972cf['message'],_0x106680);_0x57ad40(_0x1df4ea[_0xb6fc('0x11')](0x1f4,_0x1972cf[_0xb6fc('0x12')]));});});}; \ No newline at end of file +var _0x50c4=['CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x18c191,_0x360a7c){var _0x170a62=function(_0x498bdf){while(--_0x498bdf){_0x18c191['push'](_0x18c191['shift']());}};_0x170a62(++_0x360a7c);}(_0x50c4,0x1db));var _0x450c=function(_0x5dbb84,_0x1bbce9){_0x5dbb84=_0x5dbb84-0x0;var _0x1d6eae=_0x50c4[_0x5dbb84];return _0x1d6eae;};'use strict';var _=require(_0x450c('0x0'));var util=require('util');var moment=require(_0x450c('0x1'));var BPromise=require(_0x450c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x450c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x450c('0x4'));var logger=require('../../config/logger')(_0x450c('0x5'));var config=require(_0x450c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x450c('0x7')][_0x450c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39fae1,_0x31f36d,_0x2565a2){return new BPromise(function(_0x1457bf,_0x292682){return client[_0x450c('0x9')](_0x39fae1,_0x2565a2)[_0x450c('0xa')](function(_0x4b6dfa){logger[_0x450c('0xb')](_0x450c('0xc'),_0x31f36d,_0x450c('0xd'));logger[_0x450c('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x31f36d,'request\x20sent',JSON[_0x450c('0xf')](_0x4b6dfa));if(_0x4b6dfa[_0x450c('0x10')]){if(_0x4b6dfa[_0x450c('0x10')][_0x450c('0x11')]===0x1f4){logger[_0x450c('0x10')](_0x450c('0xc'),_0x31f36d,_0x4b6dfa[_0x450c('0x10')][_0x450c('0x12')]);return _0x292682(_0x4b6dfa[_0x450c('0x10')][_0x450c('0x12')]);}logger[_0x450c('0x10')](_0x450c('0xc'),_0x31f36d,_0x4b6dfa[_0x450c('0x10')][_0x450c('0x12')]);return _0x1457bf(_0x4b6dfa[_0x450c('0x10')][_0x450c('0x12')]);}else{logger[_0x450c('0xb')](_0x450c('0xc'),_0x31f36d,_0x450c('0xd'));_0x1457bf(_0x4b6dfa[_0x450c('0x13')][_0x450c('0x12')]);}})[_0x450c('0x14')](function(_0x375e0e){logger[_0x450c('0x10')](_0x450c('0xc'),_0x31f36d,_0x375e0e);_0x292682(_0x375e0e);});});}exports[_0x450c('0x15')]=function(_0x274c53){var _0x5a08c9=this;return new Promise(function(_0x12315a,_0x520c44){return db['VoiceAgentReport'][_0x450c('0x16')](_0x274c53[_0x450c('0x17')],{'raw':_0x274c53[_0x450c('0x18')]?_0x274c53[_0x450c('0x18')][_0x450c('0x19')]===undefined?!![]:![]:!![]})[_0x450c('0xa')](function(_0x449750){logger[_0x450c('0xb')](_0x450c('0x15'),_0x274c53);logger['debug'](_0x450c('0x15'),_0x274c53,JSON[_0x450c('0xf')](_0x449750));_0x12315a(_0x449750);})['catch'](function(_0x276fb8){logger[_0x450c('0x10')](_0x450c('0x15'),_0x276fb8['message'],_0x274c53);_0x520c44(_0x5a08c9[_0x450c('0x10')](0x1f4,_0x276fb8[_0x450c('0x12')]));});});};exports[_0x450c('0x1a')]=function(_0x327ebd){var _0x3798b4=this;return new Promise(function(_0x49ffa4,_0x35c9c8){return db[_0x450c('0x1b')][_0x450c('0x1c')](_0x327ebd[_0x450c('0x17')],{'raw':_0x327ebd[_0x450c('0x18')]?_0x327ebd[_0x450c('0x18')][_0x450c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x327ebd[_0x450c('0x18')]?_0x327ebd['options']['where']||null:null,'attributes':_0x327ebd[_0x450c('0x18')]?_0x327ebd[_0x450c('0x18')][_0x450c('0x1d')]||null:null,'limit':_0x327ebd[_0x450c('0x18')]?_0x327ebd[_0x450c('0x18')][_0x450c('0x1e')]||null:null})['then'](function(_0xbf58cd){logger[_0x450c('0xb')](_0x450c('0x1a'),_0x327ebd);logger['debug'](_0x450c('0x1a'),_0x327ebd,JSON[_0x450c('0xf')](_0xbf58cd));_0x49ffa4(_0xbf58cd);})[_0x450c('0x14')](function(_0x3216df){logger[_0x450c('0x10')](_0x450c('0x1a'),_0x3216df[_0x450c('0x12')],_0x327ebd);_0x35c9c8(_0x3798b4['error'](0x1f4,_0x3216df[_0x450c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a08a98e..5c9185b 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 _0x5ddc=['describe','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2435f6,_0x901e14){var _0xa8674d=function(_0x4d2ba6){while(--_0x4d2ba6){_0x2435f6['push'](_0x2435f6['shift']());}};_0xa8674d(++_0x901e14);}(_0x5ddc,0x13d));var _0xc5dd=function(_0x54dca1,_0x58f006){_0x54dca1=_0x54dca1-0x0;var _0x22346d=_0x5ddc[_0x54dca1];return _0x22346d;};'use strict';var multer=require('multer');var util=require(_0xc5dd('0x0'));var path=require(_0xc5dd('0x1'));var timeout=require(_0xc5dd('0x2'));var express=require(_0xc5dd('0x3'));var router=express[_0xc5dd('0x4')]();var auth=require(_0xc5dd('0x5'));var interaction=require(_0xc5dd('0x6'));var config=require(_0xc5dd('0x7'));var controller=require(_0xc5dd('0x8'));router[_0xc5dd('0x9')]('/',auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xb')]);router[_0xc5dd('0x9')](_0xc5dd('0xc'),auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xd')]);router[_0xc5dd('0x9')](_0xc5dd('0xe'),auth[_0xc5dd('0xa')](),controller[_0xc5dd('0xf')]);router[_0xc5dd('0x10')]('/',auth['isAuthenticated'](),controller[_0xc5dd('0x11')]);router['put'](_0xc5dd('0xe'),auth['isAuthenticated'](),controller[_0xc5dd('0x12')]);router[_0xc5dd('0x13')](_0xc5dd('0xe'),auth['isAuthenticated'](),controller[_0xc5dd('0x14')]);module[_0xc5dd('0x15')]=router; \ No newline at end of file +var _0xd49e=['index','/describe','describe','/:id','show','create','update','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xd49e,0x1b1));var _0xed49=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xd49e[_0x466bc5];return _0x138952;};'use strict';var multer=require(_0xed49('0x0'));var util=require(_0xed49('0x1'));var path=require(_0xed49('0x2'));var timeout=require('connect-timeout');var express=require(_0xed49('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xed49('0x4'));var config=require(_0xed49('0x5'));var controller=require(_0xed49('0x6'));router[_0xed49('0x7')]('/',auth[_0xed49('0x8')](),controller[_0xed49('0x9')]);router[_0xed49('0x7')](_0xed49('0xa'),auth[_0xed49('0x8')](),controller[_0xed49('0xb')]);router['get'](_0xed49('0xc'),auth['isAuthenticated'](),controller[_0xed49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed49('0xe')]);router['put'](_0xed49('0xc'),auth['isAuthenticated'](),controller[_0xed49('0xf')]);router['delete']('/:id',auth[_0xed49('0x8')](),controller['destroy']);module[_0xed49('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8833b6b..9ddce09 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2980c8,_0x1b7601){var _0x37dee9=function(_0x2602b0){while(--_0x2602b0){_0x2980c8['push'](_0x2980c8['shift']());}};_0x37dee9(++_0x1b7601);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 81fac29..3d80e73 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 _0x54cb=['findAll','show','params','intersection','length','find','catch','create','body','describe','update','uniqueid','user','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','VoiceCallReport','rawAttributes','key','model','map','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','alias','User'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x54cb,0x189));var _0xb54c=function(_0x189b3b,_0x484de8){_0x189b3b=_0x189b3b-0x0;var _0x7c4721=_0x54cb[_0x189b3b];return _0x7c4721;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb54c('0x0'));var rp=require(_0xb54c('0x1'));var moment=require(_0xb54c('0x2'));var BPromise=require(_0xb54c('0x3'));var Mustache=require(_0xb54c('0x4'));var util=require('util');var path=require(_0xb54c('0x5'));var sox=require('sox');var csv=require(_0xb54c('0x6'));var ejs=require(_0xb54c('0x7'));var fs=require('fs');var _=require(_0xb54c('0x8'));var squel=require(_0xb54c('0x9'));var crypto=require('crypto');var jsforce=require(_0xb54c('0xa'));var deskjs=require(_0xb54c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb54c('0xc'));var Papa=require(_0xb54c('0xd'));var Redis=require(_0xb54c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb54c('0xf'));var as=require(_0xb54c('0x10'));var hardwareService=require(_0xb54c('0x11'));var logger=require('../../config/logger')(_0xb54c('0x12'));var utils=require(_0xb54c('0x13'));var config=require(_0xb54c('0x14'));var db=require(_0xb54c('0x15'))['db'];function respondWithStatusCode(_0x59ac06,_0x553b62){_0x553b62=_0x553b62||0xcc;return function(_0xcb76d4){if(_0xcb76d4){return _0x59ac06[_0xb54c('0x16')](_0x553b62);}return _0x59ac06[_0xb54c('0x17')](_0x553b62)[_0xb54c('0x18')]();};}function respondWithResult(_0x2b7253,_0xec4b83){_0xec4b83=_0xec4b83||0xc8;return function(_0x5471ad){if(_0x5471ad){return _0x2b7253['status'](_0xec4b83)['json'](_0x5471ad);}};}function respondWithFilteredResult(_0x2d167d,_0x196edc){return function(_0x5465d7){if(_0x5465d7){var _0x1304a3=_0x5465d7[_0xb54c('0x19')],_0x37ab7c=_0x196edc['offset'],_0x1fce94=_0x196edc[_0xb54c('0x1a')]+_0x196edc[_0xb54c('0x1b')],_0x19efc2;if(_0x1fce94>=_0x1304a3){_0x1fce94=_0x1304a3;_0x19efc2=0xc8;}else{_0x19efc2=0xce;}_0x2d167d[_0xb54c('0x17')](_0x19efc2);return _0x2d167d[_0xb54c('0x1c')](_0xb54c('0x1d'),_0x37ab7c+'-'+_0x1fce94+'/'+_0x1304a3)[_0xb54c('0x1e')](_0x5465d7);}return null;};}function patchUpdates(_0x3bc159){return function(_0x1c272b){try{jsonpatch[_0xb54c('0x1f')](_0x1c272b,_0x3bc159,!![]);}catch(_0x30a6ce){return BPromise['reject'](_0x30a6ce);}return _0x1c272b['save']();};}function saveUpdates(_0x124808,_0x4b8bf7){return function(_0x4da4b9){if(_0x4da4b9){return _0x4da4b9['update'](_0x124808)[_0xb54c('0x20')](function(_0x1da6f3){return _0x1da6f3;});}return null;};}function removeEntity(_0x3d0b9d,_0x53b9cf){return function(_0x81b150){if(_0x81b150){return _0x81b150[_0xb54c('0x21')]()[_0xb54c('0x20')](function(){_0x3d0b9d['status'](0xcc)[_0xb54c('0x18')]();});}};}function handleEntityNotFound(_0x3d8ae0,_0x38fd96){return function(_0x3e057a){if(!_0x3e057a){_0x3d8ae0[_0xb54c('0x16')](0x194);}return _0x3e057a;};}function handleError(_0xcb3c2c,_0x9aeb0b){_0x9aeb0b=_0x9aeb0b||0x1f4;return function(_0x162e63){logger[_0xb54c('0x22')](_0x162e63[_0xb54c('0x23')]);if(_0x162e63[_0xb54c('0x24')]){delete _0x162e63[_0xb54c('0x24')];}_0xcb3c2c['status'](_0x9aeb0b)[_0xb54c('0x25')](_0x162e63);};}exports[_0xb54c('0x26')]=function(_0x429007,_0x1535eb){var _0x4c453e={},_0x3863ed={},_0x57f4bf={'count':0x0,'rows':[]};var _0x5cb5f4=_['map'](db[_0xb54c('0x27')][_0xb54c('0x28')],function(_0x14506d){return{'name':_0x14506d['fieldName'],'type':_0x14506d['type'][_0xb54c('0x29')]};});_0x3863ed[_0xb54c('0x2a')]=_[_0xb54c('0x2b')](_0x5cb5f4,'name');_0x3863ed[_0xb54c('0x2c')]=_[_0xb54c('0x2d')](_0x429007[_0xb54c('0x2c')]);_0x3863ed[_0xb54c('0x2e')]=_['intersection'](_0x3863ed[_0xb54c('0x2a')],_0x3863ed[_0xb54c('0x2c')]);_0x4c453e[_0xb54c('0x2f')]=_['intersection'](_0x3863ed[_0xb54c('0x2a')],qs[_0xb54c('0x30')](_0x429007[_0xb54c('0x2c')][_0xb54c('0x30')]));_0x4c453e[_0xb54c('0x2f')]=_0x4c453e[_0xb54c('0x2f')]['length']?_0x4c453e[_0xb54c('0x2f')]:_0x3863ed['model'];if(!_0x429007['query']['hasOwnProperty'](_0xb54c('0x31'))){_0x4c453e['limit']=qs['limit'](_0x429007[_0xb54c('0x2c')][_0xb54c('0x1b')]);_0x4c453e[_0xb54c('0x1a')]=qs[_0xb54c('0x1a')](_0x429007[_0xb54c('0x2c')]['offset']);}_0x4c453e[_0xb54c('0x32')]=qs[_0xb54c('0x33')](_0x429007[_0xb54c('0x2c')][_0xb54c('0x33')]);_0x4c453e[_0xb54c('0x34')]=qs[_0xb54c('0x2e')](_[_0xb54c('0x35')](_0x429007['query'],_0x3863ed[_0xb54c('0x2e')]),_0x5cb5f4);if(_0x429007[_0xb54c('0x2c')][_0xb54c('0x36')]){_0x4c453e[_0xb54c('0x34')]=_['merge'](_0x4c453e[_0xb54c('0x34')],{'$or':_[_0xb54c('0x2b')](_0x5cb5f4,function(_0x344bc4){if(_0x344bc4[_0xb54c('0x37')]!==_0xb54c('0x38')){var _0x4f914e={};_0x4f914e[_0x344bc4[_0xb54c('0x24')]]={'$like':'%'+_0x429007['query']['filter']+'%'};return _0x4f914e;}})});}_0x4c453e=_[_0xb54c('0x39')]({},_0x4c453e,_0x429007[_0xb54c('0x3a')]);var _0x2fd764={'where':_0x4c453e['where']};return db[_0xb54c('0x27')][_0xb54c('0x19')](_0x2fd764)['then'](function(_0x26a5ea){_0x57f4bf[_0xb54c('0x19')]=_0x26a5ea;if(_0x429007[_0xb54c('0x2c')][_0xb54c('0x3b')]){_0x4c453e[_0xb54c('0x3c')]=[{'attributes':['id',_0xb54c('0x24'),'fullname',_0xb54c('0x3d')],'model':db[_0xb54c('0x3e')],'as':_0xb54c('0x3e')}];}return db[_0xb54c('0x27')][_0xb54c('0x3f')](_0x4c453e);})[_0xb54c('0x20')](function(_0x58990d){_0x57f4bf['rows']=_0x58990d;return _0x57f4bf;})[_0xb54c('0x20')](respondWithFilteredResult(_0x1535eb,_0x4c453e))['catch'](handleError(_0x1535eb,null));};exports[_0xb54c('0x40')]=function(_0x3c12e7,_0x36985f){var _0x2f17c2={'raw':!![],'where':{'id':_0x3c12e7[_0xb54c('0x41')]['id']}},_0x165d6b={};_0x165d6b[_0xb54c('0x2a')]=_['keys'](db[_0xb54c('0x27')]['rawAttributes']);_0x165d6b[_0xb54c('0x2c')]=_[_0xb54c('0x2d')](_0x3c12e7[_0xb54c('0x2c')]);_0x165d6b['filters']=_[_0xb54c('0x42')](_0x165d6b[_0xb54c('0x2a')],_0x165d6b[_0xb54c('0x2c')]);_0x2f17c2['attributes']=_[_0xb54c('0x42')](_0x165d6b[_0xb54c('0x2a')],qs['fields'](_0x3c12e7[_0xb54c('0x2c')][_0xb54c('0x30')]));_0x2f17c2['attributes']=_0x2f17c2['attributes'][_0xb54c('0x43')]?_0x2f17c2[_0xb54c('0x2f')]:_0x165d6b[_0xb54c('0x2a')];if(_0x3c12e7[_0xb54c('0x2c')]['includeAll']){_0x2f17c2[_0xb54c('0x3c')]=[{'all':!![]}];}_0x2f17c2=_[_0xb54c('0x39')]({},_0x2f17c2,_0x3c12e7[_0xb54c('0x3a')]);return db['VoiceCallReport'][_0xb54c('0x44')](_0x2f17c2)[_0xb54c('0x20')](handleEntityNotFound(_0x36985f,null))[_0xb54c('0x20')](respondWithResult(_0x36985f,null))[_0xb54c('0x45')](handleError(_0x36985f,null));};exports['create']=function(_0x18db50,_0x14efa3){return db['VoiceCallReport'][_0xb54c('0x46')](_0x18db50[_0xb54c('0x47')],{})[_0xb54c('0x20')](respondWithResult(_0x14efa3,0xc9))[_0xb54c('0x45')](handleError(_0x14efa3,null));};exports[_0xb54c('0x21')]=function(_0x17f288,_0x449148){return db[_0xb54c('0x27')]['find']({'where':{'id':_0x17f288[_0xb54c('0x41')]['id']}})['then'](handleEntityNotFound(_0x449148,null))[_0xb54c('0x20')](removeEntity(_0x449148,null))[_0xb54c('0x45')](handleError(_0x449148,null));};exports['describe']=function(_0x22bf36,_0x491d78){return db[_0xb54c('0x27')][_0xb54c('0x48')]()[_0xb54c('0x20')](respondWithResult(_0x491d78,null))[_0xb54c('0x45')](handleError(_0x491d78,null));};exports[_0xb54c('0x49')]=function(_0x3ec360,_0x2f5c9f){if(_0x3ec360[_0xb54c('0x47')][_0xb54c('0x4a')]){delete _0x3ec360[_0xb54c('0x47')][_0xb54c('0x4a')];}return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x3ec360['params']['id'],'UserId':{'$or':[null,_0x3ec360[_0xb54c('0x4b')]['id']]}}})[_0xb54c('0x20')](handleEntityNotFound(_0x2f5c9f,null))['then'](saveUpdates(_0x3ec360[_0xb54c('0x47')],null))[_0xb54c('0x20')](respondWithResult(_0x2f5c9f,null))[_0xb54c('0x45')](handleError(_0x2f5c9f,null));}; \ No newline at end of file +var _0xc3b3=['findAll','catch','show','params','create','body','find','describe','uniqueid','html-pdf','eml-format','rimraf','request-promise','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','merge','type','options','VoiceCallReport','includeAll','include','fullname','alias','User'];(function(_0x139ce7,_0x4d60c3){var _0x1e7474=function(_0x319b0e){while(--_0x319b0e){_0x139ce7['push'](_0x139ce7['shift']());}};_0x1e7474(++_0x4d60c3);}(_0xc3b3,0x129));var _0x3c3b=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xc3b3[_0x1762b4];return _0x29beda;};'use strict';var pdf=require(_0x3c3b('0x0'));var emlformat=require(_0x3c3b('0x1'));var rimraf=require(_0x3c3b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c3b('0x3'));var moment=require('moment');var BPromise=require(_0x3c3b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3c3b('0x5'));var csv=require(_0x3c3b('0x6'));var ejs=require(_0x3c3b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c3b('0x8'));var crypto=require(_0x3c3b('0x9'));var jsforce=require(_0x3c3b('0xa'));var deskjs=require(_0x3c3b('0xb'));var toCsv=require(_0x3c3b('0x6'));var querystring=require(_0x3c3b('0xc'));var Papa=require('papaparse');var Redis=require(_0x3c3b('0xd'));var authService=require(_0x3c3b('0xe'));var qs=require(_0x3c3b('0xf'));var as=require(_0x3c3b('0x10'));var hardwareService=require(_0x3c3b('0x11'));var logger=require(_0x3c3b('0x12'))(_0x3c3b('0x13'));var utils=require(_0x3c3b('0x14'));var config=require(_0x3c3b('0x15'));var db=require(_0x3c3b('0x16'))['db'];function respondWithStatusCode(_0x2abe45,_0x43c567){_0x43c567=_0x43c567||0xcc;return function(_0x5a8d00){if(_0x5a8d00){return _0x2abe45[_0x3c3b('0x17')](_0x43c567);}return _0x2abe45[_0x3c3b('0x18')](_0x43c567)['end']();};}function respondWithResult(_0x55582b,_0x1d9f07){_0x1d9f07=_0x1d9f07||0xc8;return function(_0x189420){if(_0x189420){return _0x55582b[_0x3c3b('0x18')](_0x1d9f07)[_0x3c3b('0x19')](_0x189420);}};}function respondWithFilteredResult(_0x194b5c,_0x543c42){return function(_0x5b114b){if(_0x5b114b){var _0x270648=_0x5b114b[_0x3c3b('0x1a')],_0x5b05fa=_0x543c42[_0x3c3b('0x1b')],_0x12b324=_0x543c42[_0x3c3b('0x1b')]+_0x543c42['limit'],_0x35fde9;if(_0x12b324>=_0x270648){_0x12b324=_0x270648;_0x35fde9=0xc8;}else{_0x35fde9=0xce;}_0x194b5c['status'](_0x35fde9);return _0x194b5c['set'](_0x3c3b('0x1c'),_0x5b05fa+'-'+_0x12b324+'/'+_0x270648)[_0x3c3b('0x19')](_0x5b114b);}return null;};}function patchUpdates(_0x1457dd){return function(_0x1ee3d3){try{jsonpatch[_0x3c3b('0x1d')](_0x1ee3d3,_0x1457dd,!![]);}catch(_0x6c0ba7){return BPromise['reject'](_0x6c0ba7);}return _0x1ee3d3[_0x3c3b('0x1e')]();};}function saveUpdates(_0x3ac2b3,_0x5d1560){return function(_0x25c276){if(_0x25c276){return _0x25c276[_0x3c3b('0x1f')](_0x3ac2b3)[_0x3c3b('0x20')](function(_0x547989){return _0x547989;});}return null;};}function removeEntity(_0x552303,_0xe623e4){return function(_0x1ebfe9){if(_0x1ebfe9){return _0x1ebfe9[_0x3c3b('0x21')]()['then'](function(){_0x552303['status'](0xcc)[_0x3c3b('0x22')]();});}};}function handleEntityNotFound(_0x54f49e,_0x24dfb7){return function(_0x35bea7){if(!_0x35bea7){_0x54f49e[_0x3c3b('0x17')](0x194);}return _0x35bea7;};}function handleError(_0x393d8d,_0x352d46){_0x352d46=_0x352d46||0x1f4;return function(_0x40a4be){logger['error'](_0x40a4be['stack']);if(_0x40a4be[_0x3c3b('0x23')]){delete _0x40a4be['name'];}_0x393d8d[_0x3c3b('0x18')](_0x352d46)[_0x3c3b('0x24')](_0x40a4be);};}exports[_0x3c3b('0x25')]=function(_0x4131c2,_0x8b4974){var _0x268a79={},_0x4fe7af={},_0x439c79={'count':0x0,'rows':[]};var _0x56669a=_[_0x3c3b('0x26')](db['VoiceCallReport'][_0x3c3b('0x27')],function(_0x237949){return{'name':_0x237949[_0x3c3b('0x28')],'type':_0x237949['type'][_0x3c3b('0x29')]};});_0x4fe7af[_0x3c3b('0x2a')]=_[_0x3c3b('0x26')](_0x56669a,_0x3c3b('0x23'));_0x4fe7af['query']=_[_0x3c3b('0x2b')](_0x4131c2[_0x3c3b('0x2c')]);_0x4fe7af[_0x3c3b('0x2d')]=_[_0x3c3b('0x2e')](_0x4fe7af[_0x3c3b('0x2a')],_0x4fe7af[_0x3c3b('0x2c')]);_0x268a79[_0x3c3b('0x2f')]=_[_0x3c3b('0x2e')](_0x4fe7af[_0x3c3b('0x2a')],qs['fields'](_0x4131c2['query'][_0x3c3b('0x30')]));_0x268a79[_0x3c3b('0x2f')]=_0x268a79[_0x3c3b('0x2f')][_0x3c3b('0x31')]?_0x268a79[_0x3c3b('0x2f')]:_0x4fe7af[_0x3c3b('0x2a')];if(!_0x4131c2[_0x3c3b('0x2c')][_0x3c3b('0x32')]('nolimit')){_0x268a79[_0x3c3b('0x33')]=qs['limit'](_0x4131c2[_0x3c3b('0x2c')]['limit']);_0x268a79[_0x3c3b('0x1b')]=qs[_0x3c3b('0x1b')](_0x4131c2[_0x3c3b('0x2c')][_0x3c3b('0x1b')]);}_0x268a79['order']=qs[_0x3c3b('0x34')](_0x4131c2[_0x3c3b('0x2c')][_0x3c3b('0x34')]);_0x268a79[_0x3c3b('0x35')]=qs[_0x3c3b('0x2d')](_['pick'](_0x4131c2[_0x3c3b('0x2c')],_0x4fe7af[_0x3c3b('0x2d')]),_0x56669a);if(_0x4131c2[_0x3c3b('0x2c')]['filter']){_0x268a79[_0x3c3b('0x35')]=_[_0x3c3b('0x36')](_0x268a79['where'],{'$or':_[_0x3c3b('0x26')](_0x56669a,function(_0x320e96){if(_0x320e96[_0x3c3b('0x37')]!=='VIRTUAL'){var _0x349952={};_0x349952[_0x320e96[_0x3c3b('0x23')]]={'$like':'%'+_0x4131c2[_0x3c3b('0x2c')]['filter']+'%'};return _0x349952;}})});}_0x268a79=_[_0x3c3b('0x36')]({},_0x268a79,_0x4131c2[_0x3c3b('0x38')]);var _0x3a913b={'where':_0x268a79[_0x3c3b('0x35')]};return db[_0x3c3b('0x39')][_0x3c3b('0x1a')](_0x3a913b)[_0x3c3b('0x20')](function(_0x4d7356){_0x439c79[_0x3c3b('0x1a')]=_0x4d7356;if(_0x4131c2['query'][_0x3c3b('0x3a')]){_0x268a79[_0x3c3b('0x3b')]=[{'attributes':['id',_0x3c3b('0x23'),_0x3c3b('0x3c'),_0x3c3b('0x3d')],'model':db[_0x3c3b('0x3e')],'as':'User'}];}return db[_0x3c3b('0x39')][_0x3c3b('0x3f')](_0x268a79);})[_0x3c3b('0x20')](function(_0x5b7954){_0x439c79['rows']=_0x5b7954;return _0x439c79;})['then'](respondWithFilteredResult(_0x8b4974,_0x268a79))[_0x3c3b('0x40')](handleError(_0x8b4974,null));};exports[_0x3c3b('0x41')]=function(_0x234710,_0x1ce4f5){var _0x1d1b2e={'raw':!![],'where':{'id':_0x234710[_0x3c3b('0x42')]['id']}},_0x1aabd4={};_0x1aabd4[_0x3c3b('0x2a')]=_['keys'](db[_0x3c3b('0x39')][_0x3c3b('0x27')]);_0x1aabd4['query']=_[_0x3c3b('0x2b')](_0x234710[_0x3c3b('0x2c')]);_0x1aabd4[_0x3c3b('0x2d')]=_[_0x3c3b('0x2e')](_0x1aabd4[_0x3c3b('0x2a')],_0x1aabd4[_0x3c3b('0x2c')]);_0x1d1b2e[_0x3c3b('0x2f')]=_['intersection'](_0x1aabd4[_0x3c3b('0x2a')],qs['fields'](_0x234710[_0x3c3b('0x2c')][_0x3c3b('0x30')]));_0x1d1b2e[_0x3c3b('0x2f')]=_0x1d1b2e[_0x3c3b('0x2f')][_0x3c3b('0x31')]?_0x1d1b2e[_0x3c3b('0x2f')]:_0x1aabd4[_0x3c3b('0x2a')];if(_0x234710[_0x3c3b('0x2c')][_0x3c3b('0x3a')]){_0x1d1b2e[_0x3c3b('0x3b')]=[{'all':!![]}];}_0x1d1b2e=_[_0x3c3b('0x36')]({},_0x1d1b2e,_0x234710[_0x3c3b('0x38')]);return db[_0x3c3b('0x39')]['find'](_0x1d1b2e)[_0x3c3b('0x20')](handleEntityNotFound(_0x1ce4f5,null))[_0x3c3b('0x20')](respondWithResult(_0x1ce4f5,null))[_0x3c3b('0x40')](handleError(_0x1ce4f5,null));};exports['create']=function(_0x45877b,_0x273487){return db['VoiceCallReport'][_0x3c3b('0x43')](_0x45877b[_0x3c3b('0x44')],{})[_0x3c3b('0x20')](respondWithResult(_0x273487,0xc9))[_0x3c3b('0x40')](handleError(_0x273487,null));};exports[_0x3c3b('0x21')]=function(_0x68e904,_0x487e2e){return db[_0x3c3b('0x39')][_0x3c3b('0x45')]({'where':{'id':_0x68e904['params']['id']}})['then'](handleEntityNotFound(_0x487e2e,null))[_0x3c3b('0x20')](removeEntity(_0x487e2e,null))[_0x3c3b('0x40')](handleError(_0x487e2e,null));};exports[_0x3c3b('0x46')]=function(_0x1182cc,_0x1c3736){return db[_0x3c3b('0x39')][_0x3c3b('0x46')]()[_0x3c3b('0x20')](respondWithResult(_0x1c3736,null))[_0x3c3b('0x40')](handleError(_0x1c3736,null));};exports[_0x3c3b('0x1f')]=function(_0x4f4658,_0x4a90ea){if(_0x4f4658[_0x3c3b('0x44')]['uniqueid']){delete _0x4f4658[_0x3c3b('0x44')][_0x3c3b('0x47')];}return db['VoiceCallReport'][_0x3c3b('0x45')]({'where':{'uniqueid':_0x4f4658[_0x3c3b('0x42')]['id'],'UserId':{'$or':[null,_0x4f4658['user']['id']]}}})[_0x3c3b('0x20')](handleEntityNotFound(_0x4a90ea,null))[_0x3c3b('0x20')](saveUpdates(_0x4f4658[_0x3c3b('0x44')],null))[_0x3c3b('0x20')](respondWithResult(_0x4a90ea,null))[_0x3c3b('0x40')](handleError(_0x4a90ea,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index a8b8c9e..6ab3a6f 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 _0xbfa8=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbfa8,0xa8));var _0x8bfa=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbfa8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x8bfa('0x0'));var util=require(_0x8bfa('0x1'));var logger=require(_0x8bfa('0x2'))(_0x8bfa('0x3'));var moment=require('moment');var BPromise=require(_0x8bfa('0x4'));var rp=require(_0x8bfa('0x5'));var fs=require('fs');var path=require(_0x8bfa('0x6'));var rimraf=require('rimraf');var config=require(_0x8bfa('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x8bfa('0x8')]=function(_0x9a2837,_0x15bcba){return _0x9a2837[_0x8bfa('0x9')](_0x8bfa('0xa'),attributes,{'tableName':_0x8bfa('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8bfa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a29=['define','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x301265,_0x214a11){var _0x23fa16=function(_0x557750){while(--_0x557750){_0x301265['push'](_0x301265['shift']());}};_0x23fa16(++_0x214a11);}(_0x7a29,0x16a));var _0x97a2=function(_0x354a82,_0x4dffe7){_0x354a82=_0x354a82-0x0;var _0x4ff32f=_0x7a29[_0x354a82];return _0x4ff32f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x97a2('0x0'))(_0x97a2('0x1'));var moment=require(_0x97a2('0x2'));var BPromise=require(_0x97a2('0x3'));var rp=require(_0x97a2('0x4'));var fs=require('fs');var path=require(_0x97a2('0x5'));var rimraf=require('rimraf');var config=require(_0x97a2('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x97a2('0x7')]=function(_0x1a2270,_0x4db7d6){return _0x1a2270[_0x97a2('0x8')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x97a2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f1de5cd..f4dbe8f 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 _0xdd20=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','map','model','include','info','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','limit','lodash','util','bluebird'];(function(_0x1a908a,_0x1eac3b){var _0x6a017d=function(_0x2f6018){while(--_0x2f6018){_0x1a908a['push'](_0x1a908a['shift']());}};_0x6a017d(++_0x1eac3b);}(_0xdd20,0x1eb));var _0x0dd2=function(_0x1c98cc,_0x326389){_0x1c98cc=_0x1c98cc-0x0;var _0x15dcd0=_0xdd20[_0x1c98cc];return _0x15dcd0;};'use strict';var _=require(_0x0dd2('0x0'));var util=require(_0x0dd2('0x1'));var moment=require('moment');var BPromise=require(_0x0dd2('0x2'));var rs=require(_0x0dd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0dd2('0x4'));var logger=require(_0x0dd2('0x5'))(_0x0dd2('0x6'));var config=require(_0x0dd2('0x7'));var jayson=require(_0x0dd2('0x8'));var client=jayson[_0x0dd2('0x9')][_0x0dd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd9f1c,_0x322268,_0x3bcaaa){return new BPromise(function(_0x773448,_0x88fdcd){return client[_0x0dd2('0xb')](_0xfd9f1c,_0x3bcaaa)[_0x0dd2('0xc')](function(_0x4a3848){logger['info'](_0x0dd2('0xd'),_0x322268,_0x0dd2('0xe'));logger[_0x0dd2('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x322268,_0x0dd2('0xe'),JSON['stringify'](_0x4a3848));if(_0x4a3848[_0x0dd2('0x10')]){if(_0x4a3848['error'][_0x0dd2('0x11')]===0x1f4){logger[_0x0dd2('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x322268,_0x4a3848[_0x0dd2('0x10')]['message']);return _0x88fdcd(_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);}logger[_0x0dd2('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x322268,_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);return _0x773448(_0x4a3848[_0x0dd2('0x10')][_0x0dd2('0x12')]);}else{logger['info'](_0x0dd2('0xd'),_0x322268,_0x0dd2('0xe'));_0x773448(_0x4a3848['result'][_0x0dd2('0x12')]);}})[_0x0dd2('0x13')](function(_0x420793){logger[_0x0dd2('0x10')](_0x0dd2('0xd'),_0x322268,_0x420793);_0x88fdcd(_0x420793);});});}exports[_0x0dd2('0x14')]=function(_0x1d2710){var _0x488759=this;return new Promise(function(_0x4c5e9d,_0x55ca0e){return db[_0x0dd2('0x15')][_0x0dd2('0x16')]({'raw':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![],'where':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['where']||null:null,'attributes':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710['options'][_0x0dd2('0x19')]||null:null,'limit':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['limit']||null:null,'include':_0x1d2710[_0x0dd2('0x17')]?_0x1d2710[_0x0dd2('0x17')]['include']?_[_0x0dd2('0x1a')](_0x1d2710[_0x0dd2('0x17')]['include'],function(_0x216838){return{'model':db[_0x216838[_0x0dd2('0x1b')]],'as':_0x216838['as'],'attributes':_0x216838['attributes'],'include':_0x216838['include']?_[_0x0dd2('0x1a')](_0x216838[_0x0dd2('0x1c')],function(_0x31709d){return{'model':db[_0x31709d[_0x0dd2('0x1b')]],'as':_0x31709d['as'],'attributes':_0x31709d[_0x0dd2('0x19')],'include':_0x31709d[_0x0dd2('0x1c')]?_[_0x0dd2('0x1a')](_0x31709d['include'],function(_0x2e99f3){return{'model':db[_0x2e99f3['model']],'as':_0x2e99f3['as'],'attributes':_0x2e99f3[_0x0dd2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0dd2('0xc')](function(_0x81785d){logger[_0x0dd2('0x1d')](_0x0dd2('0x14'),_0x1d2710);logger['debug'](_0x0dd2('0x14'),_0x1d2710,JSON[_0x0dd2('0x1e')](_0x81785d));_0x4c5e9d(_0x81785d);})[_0x0dd2('0x13')](function(_0x562a87){logger['error']('GetVoiceCallReport',_0x562a87[_0x0dd2('0x12')],_0x1d2710);_0x55ca0e(_0x488759[_0x0dd2('0x10')](0x1f4,_0x562a87[_0x0dd2('0x12')]));});});};exports[_0x0dd2('0x1f')]=function(_0x187fd2){var _0x6f9d00=this;return new Promise(function(_0x396d1a,_0x4d5dbb){return db['VoiceCallReport'][_0x0dd2('0x20')](_0x187fd2[_0x0dd2('0x21')],{'raw':_0x187fd2[_0x0dd2('0x17')]?_0x187fd2[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x6fb026){logger[_0x0dd2('0x1d')]('CreateVoiceCallReport',_0x187fd2);logger[_0x0dd2('0xf')]('CreateVoiceCallReport',_0x187fd2,JSON[_0x0dd2('0x1e')](_0x6fb026));_0x396d1a(_0x6fb026);})[_0x0dd2('0x13')](function(_0x2d66e6){logger[_0x0dd2('0x10')](_0x0dd2('0x1f'),_0x2d66e6[_0x0dd2('0x12')],_0x187fd2);_0x4d5dbb(_0x6f9d00[_0x0dd2('0x10')](0x1f4,_0x2d66e6[_0x0dd2('0x12')]));});});};exports[_0x0dd2('0x22')]=function(_0x30f65a){var _0x2bbafa=this;return new Promise(function(_0x5a6f4f,_0x55657c){return db['VoiceCallReport'][_0x0dd2('0x23')](_0x30f65a[_0x0dd2('0x21')],{'raw':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x24')]||null:null,'attributes':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x19')]||null:null,'limit':_0x30f65a[_0x0dd2('0x17')]?_0x30f65a[_0x0dd2('0x17')][_0x0dd2('0x25')]||null:null})[_0x0dd2('0xc')](function(_0x4fe68d){logger[_0x0dd2('0x1d')]('UpdateVoiceCallReport',_0x30f65a);logger['debug']('UpdateVoiceCallReport',_0x30f65a,JSON['stringify'](_0x4fe68d));_0x5a6f4f(_0x4fe68d);})['catch'](function(_0x5d17d0){logger['error'](_0x0dd2('0x22'),_0x5d17d0[_0x0dd2('0x12')],_0x30f65a);_0x55657c(_0x2bbafa[_0x0dd2('0x10')](0x1f4,_0x5d17d0['message']));});});}; \ No newline at end of file +var _0x3c71=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x3c71,0xff));var _0x13c7=function(_0x30a3c5,_0x431434){_0x30a3c5=_0x30a3c5-0x0;var _0x93fc6b=_0x3c71[_0x30a3c5];return _0x93fc6b;};'use strict';var _=require(_0x13c7('0x0'));var util=require(_0x13c7('0x1'));var moment=require(_0x13c7('0x2'));var BPromise=require(_0x13c7('0x3'));var rs=require(_0x13c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13c7('0x5'))['db'];var utils=require(_0x13c7('0x6'));var logger=require('../../config/logger')(_0x13c7('0x7'));var config=require(_0x13c7('0x8'));var jayson=require(_0x13c7('0x9'));var client=jayson[_0x13c7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e9267,_0x490f74,_0x5e5a25){return new BPromise(function(_0x2b6a87,_0x3caede){return client[_0x13c7('0xb')](_0x3e9267,_0x5e5a25)[_0x13c7('0xc')](function(_0x18eb5b){logger['info'](_0x13c7('0xd'),_0x490f74,_0x13c7('0xe'));logger[_0x13c7('0xf')](_0x13c7('0x10'),_0x490f74,'request\x20sent',JSON[_0x13c7('0x11')](_0x18eb5b));if(_0x18eb5b[_0x13c7('0x12')]){if(_0x18eb5b[_0x13c7('0x12')][_0x13c7('0x13')]===0x1f4){logger[_0x13c7('0x12')](_0x13c7('0xd'),_0x490f74,_0x18eb5b[_0x13c7('0x12')]['message']);return _0x3caede(_0x18eb5b['error']['message']);}logger[_0x13c7('0x12')](_0x13c7('0xd'),_0x490f74,_0x18eb5b['error'][_0x13c7('0x14')]);return _0x2b6a87(_0x18eb5b['error'][_0x13c7('0x14')]);}else{logger[_0x13c7('0x15')](_0x13c7('0xd'),_0x490f74,'request\x20sent');_0x2b6a87(_0x18eb5b['result'][_0x13c7('0x14')]);}})[_0x13c7('0x16')](function(_0x2c20ce){logger[_0x13c7('0x12')](_0x13c7('0xd'),_0x490f74,_0x2c20ce);_0x3caede(_0x2c20ce);});});}exports[_0x13c7('0x17')]=function(_0x1383df){var _0x4cfbe8=this;return new Promise(function(_0x3ee731,_0x2aa0ee){return db[_0x13c7('0x18')][_0x13c7('0x19')]({'raw':_0x1383df[_0x13c7('0x1a')]?_0x1383df[_0x13c7('0x1a')][_0x13c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1383df[_0x13c7('0x1a')]?_0x1383df['options']['where']||null:null,'attributes':_0x1383df[_0x13c7('0x1a')]?_0x1383df[_0x13c7('0x1a')][_0x13c7('0x1c')]||null:null,'limit':_0x1383df[_0x13c7('0x1a')]?_0x1383df[_0x13c7('0x1a')][_0x13c7('0x1d')]||null:null,'include':_0x1383df[_0x13c7('0x1a')]?_0x1383df[_0x13c7('0x1a')][_0x13c7('0x1e')]?_[_0x13c7('0x1f')](_0x1383df[_0x13c7('0x1a')][_0x13c7('0x1e')],function(_0x579aef){return{'model':db[_0x579aef[_0x13c7('0x20')]],'as':_0x579aef['as'],'attributes':_0x579aef['attributes'],'include':_0x579aef[_0x13c7('0x1e')]?_[_0x13c7('0x1f')](_0x579aef['include'],function(_0x14885a){return{'model':db[_0x14885a[_0x13c7('0x20')]],'as':_0x14885a['as'],'attributes':_0x14885a[_0x13c7('0x1c')],'include':_0x14885a['include']?_[_0x13c7('0x1f')](_0x14885a['include'],function(_0x5da36c){return{'model':db[_0x5da36c['model']],'as':_0x5da36c['as'],'attributes':_0x5da36c[_0x13c7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x13c7('0xc')](function(_0x1097a6){logger[_0x13c7('0x15')]('GetVoiceCallReport',_0x1383df);logger['debug'](_0x13c7('0x17'),_0x1383df,JSON[_0x13c7('0x11')](_0x1097a6));_0x3ee731(_0x1097a6);})[_0x13c7('0x16')](function(_0x1ac5f1){logger['error'](_0x13c7('0x17'),_0x1ac5f1['message'],_0x1383df);_0x2aa0ee(_0x4cfbe8['error'](0x1f4,_0x1ac5f1[_0x13c7('0x14')]));});});};exports[_0x13c7('0x21')]=function(_0x2753c0){var _0x4a29bd=this;return new Promise(function(_0xf11050,_0xfea519){return db['VoiceCallReport'][_0x13c7('0x22')](_0x2753c0[_0x13c7('0x23')],{'raw':_0x2753c0[_0x13c7('0x1a')]?_0x2753c0[_0x13c7('0x1a')][_0x13c7('0x1b')]===undefined?!![]:![]:!![]})[_0x13c7('0xc')](function(_0x5293ed){logger['info'](_0x13c7('0x21'),_0x2753c0);logger['debug'](_0x13c7('0x21'),_0x2753c0,JSON[_0x13c7('0x11')](_0x5293ed));_0xf11050(_0x5293ed);})[_0x13c7('0x16')](function(_0x2e6f77){logger[_0x13c7('0x12')](_0x13c7('0x21'),_0x2e6f77[_0x13c7('0x14')],_0x2753c0);_0xfea519(_0x4a29bd[_0x13c7('0x12')](0x1f4,_0x2e6f77['message']));});});};exports[_0x13c7('0x24')]=function(_0x640ddd){var _0x1142ff=this;return new Promise(function(_0x335085,_0x1a6603){return db[_0x13c7('0x18')]['update'](_0x640ddd['body'],{'raw':_0x640ddd['options']?_0x640ddd[_0x13c7('0x1a')][_0x13c7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x640ddd[_0x13c7('0x1a')]?_0x640ddd[_0x13c7('0x1a')]['where']||null:null,'attributes':_0x640ddd[_0x13c7('0x1a')]?_0x640ddd['options'][_0x13c7('0x1c')]||null:null,'limit':_0x640ddd['options']?_0x640ddd[_0x13c7('0x1a')][_0x13c7('0x1d')]||null:null})[_0x13c7('0xc')](function(_0x522323){logger['info'](_0x13c7('0x24'),_0x640ddd);logger['debug'](_0x13c7('0x24'),_0x640ddd,JSON[_0x13c7('0x11')](_0x522323));_0x335085(_0x522323);})['catch'](function(_0x3b462d){logger[_0x13c7('0x12')](_0x13c7('0x24'),_0x3b462d[_0x13c7('0x14')],_0x640ddd);_0x1a6603(_0x1142ff[_0x13c7('0x12')](0x1f4,_0x3b462d[_0x13c7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 4516a2c..0202939 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 _0x3144=['post','create','put','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x220e56,_0x1e7891){var _0x5a4137=function(_0x17f644){while(--_0x17f644){_0x220e56['push'](_0x220e56['shift']());}};_0x5a4137(++_0x1e7891);}(_0x3144,0x17c));var _0x4314=function(_0x448e03,_0x52c4bd){_0x448e03=_0x448e03-0x0;var _0x4b4469=_0x3144[_0x448e03];return _0x4b4469;};'use strict';var multer=require('multer');var util=require(_0x4314('0x0'));var path=require(_0x4314('0x1'));var timeout=require(_0x4314('0x2'));var express=require('express');var router=express[_0x4314('0x3')]();var auth=require(_0x4314('0x4'));var interaction=require(_0x4314('0x5'));var config=require(_0x4314('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x4314('0x7')]('/',auth[_0x4314('0x8')](),controller[_0x4314('0x9')]);router[_0x4314('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4314('0xa')]('/',auth[_0x4314('0x8')](),controller[_0x4314('0xb')]);router[_0x4314('0xc')](_0x4314('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4314('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4314('0xe')]=router; \ No newline at end of file +var _0x0f6a=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','Router','../../components/auth/service'];(function(_0x1f8bba,_0x79a01f){var _0xb9ab87=function(_0x4dbbab){while(--_0x4dbbab){_0x1f8bba['push'](_0x1f8bba['shift']());}};_0xb9ab87(++_0x79a01f);}(_0x0f6a,0x1b6));var _0xa0f6=function(_0x406236,_0xb4c282){_0x406236=_0x406236-0x0;var _0x1de954=_0x0f6a[_0x406236];return _0x1de954;};'use strict';var multer=require('multer');var util=require(_0xa0f6('0x0'));var path=require(_0xa0f6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0f6('0x2')]();var auth=require(_0xa0f6('0x3'));var interaction=require(_0xa0f6('0x4'));var config=require(_0xa0f6('0x5'));var controller=require(_0xa0f6('0x6'));router[_0xa0f6('0x7')]('/',auth[_0xa0f6('0x8')](),controller[_0xa0f6('0x9')]);router[_0xa0f6('0x7')](_0xa0f6('0xa'),auth[_0xa0f6('0x8')](),controller['show']);router[_0xa0f6('0xb')]('/',auth[_0xa0f6('0x8')](),controller[_0xa0f6('0xc')]);router[_0xa0f6('0xd')]('/:id',auth[_0xa0f6('0x8')](),controller[_0xa0f6('0xe')]);router['delete'](_0xa0f6('0xa'),auth[_0xa0f6('0x8')](),controller[_0xa0f6('0xf')]);module[_0xa0f6('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index ceb17e5..228546f 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 _0x2569=['setDataValue','getDataValue','options','split','BOOLEAN','sequelize','STRING','name'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0x2569,0xd5));var _0x9256=function(_0x400b64,_0x5eb1bf){_0x400b64=_0x400b64-0x0;var _0x1d615d=_0x2569[_0x400b64];return _0x1d615d;};'use strict';var Sequelize=require(_0x9256('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x9256('0x1')],'unique':_0x9256('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x9256('0x1')],'set':function(_0x3c8624){this[_0x9256('0x3')]('options',_0x3c8624?_0x3c8624['join'](''):[]);},'get':function(){return this[_0x9256('0x4')](_0x9256('0x5'))?this[_0x9256('0x4')](_0x9256('0x5'))[_0x9256('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x9256('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9256('0x1')]},'description':{'type':Sequelize[_0x9256('0x1')]}}; \ No newline at end of file +var _0x3038=['name','join','getDataValue','options','split','BOOLEAN','exports','STRING'];(function(_0x51cab2,_0x19a75d){var _0x4a99e7=function(_0x5f4ba5){while(--_0x5f4ba5){_0x51cab2['push'](_0x51cab2['shift']());}};_0x4a99e7(++_0x19a75d);}(_0x3038,0xe6));var _0x8303=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x3038[_0x2cfb48];return _0xc4594f;};'use strict';var Sequelize=require('sequelize');module[_0x8303('0x0')]={'name':{'type':Sequelize[_0x8303('0x1')]},'prefix':{'type':Sequelize[_0x8303('0x1')],'unique':_0x8303('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8303('0x1')],'set':function(_0x4361f3){this['setDataValue']('options',_0x4361f3?_0x4361f3[_0x8303('0x3')](''):[]);},'get':function(){return this[_0x8303('0x4')](_0x8303('0x5'))?this['getDataValue'](_0x8303('0x5'))[_0x8303('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8303('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x8303('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8303('0x1')]},'description':{'type':Sequelize[_0x8303('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2b77016..9b3945d 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 _0x88ac=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','name','send','index','map','VoiceChanSpy','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x88ac,0x194));var _0xc88a=function(_0x2b7694,_0x4afaa6){_0x2b7694=_0x2b7694-0x0;var _0x57ff70=_0x88ac[_0x2b7694];return _0x57ff70;};'use strict';var pdf=require(_0xc88a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc88a('0x1'));var zipdir=require(_0xc88a('0x2'));var jsonpatch=require(_0xc88a('0x3'));var rp=require(_0xc88a('0x4'));var moment=require('moment');var BPromise=require(_0xc88a('0x5'));var Mustache=require('mustache');var util=require(_0xc88a('0x6'));var path=require(_0xc88a('0x7'));var sox=require(_0xc88a('0x8'));var csv=require(_0xc88a('0x9'));var ejs=require(_0xc88a('0xa'));var fs=require('fs');var _=require(_0xc88a('0xb'));var squel=require(_0xc88a('0xc'));var crypto=require(_0xc88a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc88a('0xe'));var toCsv=require(_0xc88a('0x9'));var querystring=require('querystring');var Papa=require(_0xc88a('0xf'));var Redis=require(_0xc88a('0x10'));var authService=require(_0xc88a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc88a('0x12'));var hardwareService=require(_0xc88a('0x13'));var logger=require(_0xc88a('0x14'))(_0xc88a('0x15'));var utils=require('../../config/utils');var config=require(_0xc88a('0x16'));var db=require(_0xc88a('0x17'))['db'];function respondWithStatusCode(_0x5f5381,_0x4354aa){_0x4354aa=_0x4354aa||0xcc;return function(_0x211995){if(_0x211995){return _0x5f5381[_0xc88a('0x18')](_0x4354aa);}return _0x5f5381[_0xc88a('0x19')](_0x4354aa)[_0xc88a('0x1a')]();};}function respondWithResult(_0xf2ef69,_0xa07d87){_0xa07d87=_0xa07d87||0xc8;return function(_0x299613){if(_0x299613){return _0xf2ef69[_0xc88a('0x19')](_0xa07d87)[_0xc88a('0x1b')](_0x299613);}};}function respondWithFilteredResult(_0x2f72e5,_0x5ce7c3){return function(_0x21f568){if(_0x21f568){var _0x5294b4=_0x21f568[_0xc88a('0x1c')],_0xd9592=_0x5ce7c3[_0xc88a('0x1d')],_0x4cfa1c=_0x5ce7c3[_0xc88a('0x1d')]+_0x5ce7c3[_0xc88a('0x1e')],_0x232d79;if(_0x4cfa1c>=_0x5294b4){_0x4cfa1c=_0x5294b4;_0x232d79=0xc8;}else{_0x232d79=0xce;}_0x2f72e5['status'](_0x232d79);return _0x2f72e5[_0xc88a('0x1f')](_0xc88a('0x20'),_0xd9592+'-'+_0x4cfa1c+'/'+_0x5294b4)['json'](_0x21f568);}return null;};}function patchUpdates(_0x1fdcae){return function(_0x49029f){try{jsonpatch['apply'](_0x49029f,_0x1fdcae,!![]);}catch(_0x2d12f6){return BPromise[_0xc88a('0x21')](_0x2d12f6);}return _0x49029f[_0xc88a('0x22')]();};}function saveUpdates(_0xfb7c2d,_0xd324b3){return function(_0x4ed351){if(_0x4ed351){return _0x4ed351[_0xc88a('0x23')](_0xfb7c2d)['then'](function(_0xfa127c){return _0xfa127c;});}return null;};}function removeEntity(_0x2c0b41,_0x400f75){return function(_0x2b4c7c){if(_0x2b4c7c){return _0x2b4c7c[_0xc88a('0x24')]()[_0xc88a('0x25')](function(){var _0x3a5529=_0x2b4c7c[_0xc88a('0x26')]({'plain':!![]});var _0x3ab0af=_0xc88a('0x27');return db[_0xc88a('0x28')][_0xc88a('0x24')]({'where':{'type':_0x3ab0af,'resourceId':_0x3a5529['id']}})['then'](function(){return _0x2b4c7c;});})[_0xc88a('0x25')](function(){_0x2c0b41[_0xc88a('0x19')](0xcc)[_0xc88a('0x1a')]();});}};}function handleEntityNotFound(_0x4fe62f,_0x3a5477){return function(_0x5a2990){if(!_0x5a2990){_0x4fe62f['sendStatus'](0x194);}return _0x5a2990;};}function handleError(_0x3ebafc,_0x3e0834){_0x3e0834=_0x3e0834||0x1f4;return function(_0x205eb5){logger['error'](_0x205eb5['stack']);if(_0x205eb5[_0xc88a('0x29')]){delete _0x205eb5[_0xc88a('0x29')];}_0x3ebafc[_0xc88a('0x19')](_0x3e0834)[_0xc88a('0x2a')](_0x205eb5);};}exports[_0xc88a('0x2b')]=function(_0x3ad8a2,_0x2c0db){var _0x5b2204={},_0x3ca0b9={},_0x333093={'count':0x0,'rows':[]};var _0x1b7986=_[_0xc88a('0x2c')](db[_0xc88a('0x2d')][_0xc88a('0x2e')],function(_0x17226e){return{'name':_0x17226e['fieldName'],'type':_0x17226e['type'][_0xc88a('0x2f')]};});_0x3ca0b9[_0xc88a('0x30')]=_[_0xc88a('0x2c')](_0x1b7986,_0xc88a('0x29'));_0x3ca0b9[_0xc88a('0x31')]=_[_0xc88a('0x32')](_0x3ad8a2['query']);_0x3ca0b9[_0xc88a('0x33')]=_[_0xc88a('0x34')](_0x3ca0b9[_0xc88a('0x30')],_0x3ca0b9[_0xc88a('0x31')]);_0x5b2204[_0xc88a('0x35')]=_[_0xc88a('0x34')](_0x3ca0b9[_0xc88a('0x30')],qs[_0xc88a('0x36')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x36')]));_0x5b2204[_0xc88a('0x35')]=_0x5b2204[_0xc88a('0x35')]['length']?_0x5b2204[_0xc88a('0x35')]:_0x3ca0b9['model'];if(!_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x37')]('nolimit')){_0x5b2204[_0xc88a('0x1e')]=qs[_0xc88a('0x1e')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x1e')]);_0x5b2204[_0xc88a('0x1d')]=qs[_0xc88a('0x1d')](_0x3ad8a2['query']['offset']);}_0x5b2204['order']=qs[_0xc88a('0x38')](_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x38')]);_0x5b2204[_0xc88a('0x39')]=qs[_0xc88a('0x33')](_[_0xc88a('0x3a')](_0x3ad8a2[_0xc88a('0x31')],_0x3ca0b9['filters']),_0x1b7986);if(_0x3ad8a2['query'][_0xc88a('0x3b')]){_0x5b2204[_0xc88a('0x39')]=_[_0xc88a('0x3c')](_0x5b2204[_0xc88a('0x39')],{'$or':_[_0xc88a('0x2c')](_0x1b7986,function(_0x39a5f1){if(_0x39a5f1[_0xc88a('0x3d')]!==_0xc88a('0x3e')){var _0xb3af86={};_0xb3af86[_0x39a5f1[_0xc88a('0x29')]]={'$like':'%'+_0x3ad8a2[_0xc88a('0x31')]['filter']+'%'};return _0xb3af86;}})});}_0x5b2204=_[_0xc88a('0x3c')]({},_0x5b2204,_0x3ad8a2['options']);var _0x5a5de4={'where':_0x5b2204[_0xc88a('0x39')]};return db['VoiceChanSpy'][_0xc88a('0x1c')](_0x5a5de4)[_0xc88a('0x25')](function(_0x3b0cd9){_0x333093[_0xc88a('0x1c')]=_0x3b0cd9;if(_0x3ad8a2[_0xc88a('0x31')][_0xc88a('0x3f')]){_0x5b2204[_0xc88a('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x5b2204);})[_0xc88a('0x25')](function(_0x44d8c8){_0x333093[_0xc88a('0x41')]=_0x44d8c8;return _0x333093;})['then'](respondWithFilteredResult(_0x2c0db,_0x5b2204))['catch'](handleError(_0x2c0db,null));};exports[_0xc88a('0x42')]=function(_0x21e865,_0x405c98){var _0x4a0627={'raw':![],'where':{'id':_0x21e865[_0xc88a('0x43')]['id']}},_0x49933e={};_0x49933e[_0xc88a('0x30')]=_['keys'](db['VoiceChanSpy'][_0xc88a('0x2e')]);_0x49933e[_0xc88a('0x31')]=_[_0xc88a('0x32')](_0x21e865[_0xc88a('0x31')]);_0x49933e[_0xc88a('0x33')]=_[_0xc88a('0x34')](_0x49933e[_0xc88a('0x30')],_0x49933e[_0xc88a('0x31')]);_0x4a0627['attributes']=_[_0xc88a('0x34')](_0x49933e[_0xc88a('0x30')],qs[_0xc88a('0x36')](_0x21e865[_0xc88a('0x31')]['fields']));_0x4a0627['attributes']=_0x4a0627[_0xc88a('0x35')][_0xc88a('0x44')]?_0x4a0627[_0xc88a('0x35')]:_0x49933e[_0xc88a('0x30')];if(_0x21e865[_0xc88a('0x31')]['includeAll']){_0x4a0627[_0xc88a('0x40')]=[{'all':!![]}];}_0x4a0627=_[_0xc88a('0x3c')]({},_0x4a0627,_0x21e865['options']);return db[_0xc88a('0x2d')][_0xc88a('0x45')](_0x4a0627)[_0xc88a('0x25')](handleEntityNotFound(_0x405c98,null))[_0xc88a('0x25')](respondWithResult(_0x405c98,null))['catch'](handleError(_0x405c98,null));};exports['create']=function(_0xf06182,_0xe00083){return db[_0xc88a('0x2d')][_0xc88a('0x46')](_0xf06182[_0xc88a('0x47')],{})['then'](function(_0x464ff7){var _0x42cf18=_0xf06182[_0xc88a('0x48')]['get']({'plain':!![]});if(!_0x42cf18)throw new Error(_0xc88a('0x49'));if(_0x42cf18[_0xc88a('0x4a')]===_0xc88a('0x48')){var _0x26604f=_0x464ff7[_0xc88a('0x26')]({'plain':!![]});var _0x5003c0=_0xc88a('0x27');return db['UserProfileSection'][_0xc88a('0x45')]({'where':{'name':_0x5003c0,'userProfileId':_0x42cf18[_0xc88a('0x4b')]},'raw':!![]})['then'](function(_0x2ec963){if(_0x2ec963&&_0x2ec963[_0xc88a('0x4c')]===0x0){return db[_0xc88a('0x28')]['create']({'name':_0x26604f[_0xc88a('0x29')],'resourceId':_0x26604f['id'],'type':_0x2ec963['name'],'sectionId':_0x2ec963['id']},{})[_0xc88a('0x25')](function(){return _0x464ff7;});}else{return _0x464ff7;}})['catch'](function(_0x2aec95){logger[_0xc88a('0x4d')](_0xc88a('0x4e'),_0x2aec95);throw _0x2aec95;});}return _0x464ff7;})[_0xc88a('0x25')](respondWithResult(_0xe00083,0xc9))[_0xc88a('0x4f')](handleError(_0xe00083,null));};exports[_0xc88a('0x23')]=function(_0x800409,_0x59e258){if(_0x800409['body']['id']){delete _0x800409[_0xc88a('0x47')]['id'];}return db[_0xc88a('0x2d')][_0xc88a('0x45')]({'where':{'id':_0x800409[_0xc88a('0x43')]['id']}})[_0xc88a('0x25')](handleEntityNotFound(_0x59e258,null))[_0xc88a('0x25')](saveUpdates(_0x800409[_0xc88a('0x47')],null))[_0xc88a('0x25')](respondWithResult(_0x59e258,null))[_0xc88a('0x4f')](handleError(_0x59e258,null));};exports[_0xc88a('0x24')]=function(_0x4fc5e5,_0x3c6bf0){return db['VoiceChanSpy'][_0xc88a('0x45')]({'where':{'id':_0x4fc5e5[_0xc88a('0x43')]['id']}})[_0xc88a('0x25')](handleEntityNotFound(_0x3c6bf0,null))[_0xc88a('0x25')](removeEntity(_0x3c6bf0,null))[_0xc88a('0x4f')](handleError(_0x3c6bf0,null));}; \ No newline at end of file +var _0x27f9=['catch','show','params','find','create','user','role','get','UserProfileSection','userProfileId','autoAssociation','error','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource','index','VoiceChanSpy','fieldName','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x27f9,0x14d));var _0x927f=function(_0x3c7b8e,_0x1a18f2){_0x3c7b8e=_0x3c7b8e-0x0;var _0x1fe875=_0x27f9[_0x3c7b8e];return _0x1fe875;};'use strict';var pdf=require(_0x927f('0x0'));var emlformat=require(_0x927f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x927f('0x2'));var jsonpatch=require(_0x927f('0x3'));var rp=require(_0x927f('0x4'));var moment=require('moment');var BPromise=require(_0x927f('0x5'));var Mustache=require(_0x927f('0x6'));var util=require(_0x927f('0x7'));var path=require(_0x927f('0x8'));var sox=require(_0x927f('0x9'));var csv=require(_0x927f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x927f('0xb'));var squel=require(_0x927f('0xc'));var crypto=require(_0x927f('0xd'));var jsforce=require(_0x927f('0xe'));var deskjs=require(_0x927f('0xf'));var toCsv=require(_0x927f('0xa'));var querystring=require(_0x927f('0x10'));var Papa=require('papaparse');var Redis=require(_0x927f('0x11'));var authService=require(_0x927f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x927f('0x13'));var hardwareService=require(_0x927f('0x14'));var logger=require(_0x927f('0x15'))(_0x927f('0x16'));var utils=require(_0x927f('0x17'));var config=require('../../config/environment');var db=require(_0x927f('0x18'))['db'];function respondWithStatusCode(_0x555f74,_0x336bd3){_0x336bd3=_0x336bd3||0xcc;return function(_0x2e3fe8){if(_0x2e3fe8){return _0x555f74[_0x927f('0x19')](_0x336bd3);}return _0x555f74[_0x927f('0x1a')](_0x336bd3)[_0x927f('0x1b')]();};}function respondWithResult(_0x53b0bd,_0x3bb586){_0x3bb586=_0x3bb586||0xc8;return function(_0x49e07f){if(_0x49e07f){return _0x53b0bd[_0x927f('0x1a')](_0x3bb586)[_0x927f('0x1c')](_0x49e07f);}};}function respondWithFilteredResult(_0x4a6227,_0x3a08f5){return function(_0x16a981){if(_0x16a981){var _0x493910=_0x16a981[_0x927f('0x1d')],_0x15fcf2=_0x3a08f5[_0x927f('0x1e')],_0x14dc80=_0x3a08f5['offset']+_0x3a08f5[_0x927f('0x1f')],_0x129402;if(_0x14dc80>=_0x493910){_0x14dc80=_0x493910;_0x129402=0xc8;}else{_0x129402=0xce;}_0x4a6227['status'](_0x129402);return _0x4a6227[_0x927f('0x20')](_0x927f('0x21'),_0x15fcf2+'-'+_0x14dc80+'/'+_0x493910)['json'](_0x16a981);}return null;};}function patchUpdates(_0x1947be){return function(_0x1e9903){try{jsonpatch[_0x927f('0x22')](_0x1e9903,_0x1947be,!![]);}catch(_0x4cb06b){return BPromise[_0x927f('0x23')](_0x4cb06b);}return _0x1e9903[_0x927f('0x24')]();};}function saveUpdates(_0x217f13,_0x2dfa79){return function(_0x7cab05){if(_0x7cab05){return _0x7cab05[_0x927f('0x25')](_0x217f13)[_0x927f('0x26')](function(_0x29a67d){return _0x29a67d;});}return null;};}function removeEntity(_0xcb6b1d,_0x344c1c){return function(_0x542bcd){if(_0x542bcd){return _0x542bcd[_0x927f('0x27')]()[_0x927f('0x26')](function(){var _0x29249e=_0x542bcd['get']({'plain':!![]});var _0x5f5b0f=_0x927f('0x28');return db[_0x927f('0x29')]['destroy']({'where':{'type':_0x5f5b0f,'resourceId':_0x29249e['id']}})[_0x927f('0x26')](function(){return _0x542bcd;});})[_0x927f('0x26')](function(){_0xcb6b1d[_0x927f('0x1a')](0xcc)[_0x927f('0x1b')]();});}};}function handleEntityNotFound(_0x199b31,_0x1feeb8){return function(_0x549acf){if(!_0x549acf){_0x199b31['sendStatus'](0x194);}return _0x549acf;};}function handleError(_0x529047,_0x20fc09){_0x20fc09=_0x20fc09||0x1f4;return function(_0x302920){logger['error'](_0x302920['stack']);if(_0x302920['name']){delete _0x302920['name'];}_0x529047[_0x927f('0x1a')](_0x20fc09)['send'](_0x302920);};}exports[_0x927f('0x2a')]=function(_0x14ac5f,_0x45a565){var _0x564048={},_0x15827a={},_0x349690={'count':0x0,'rows':[]};var _0x10f70c=_['map'](db[_0x927f('0x2b')]['rawAttributes'],function(_0x24e270){return{'name':_0x24e270[_0x927f('0x2c')],'type':_0x24e270['type'][_0x927f('0x2d')]};});_0x15827a[_0x927f('0x2e')]=_[_0x927f('0x2f')](_0x10f70c,_0x927f('0x30'));_0x15827a[_0x927f('0x31')]=_[_0x927f('0x32')](_0x14ac5f[_0x927f('0x31')]);_0x15827a[_0x927f('0x33')]=_[_0x927f('0x34')](_0x15827a['model'],_0x15827a[_0x927f('0x31')]);_0x564048['attributes']=_[_0x927f('0x34')](_0x15827a[_0x927f('0x2e')],qs[_0x927f('0x35')](_0x14ac5f[_0x927f('0x31')][_0x927f('0x35')]));_0x564048[_0x927f('0x36')]=_0x564048['attributes'][_0x927f('0x37')]?_0x564048[_0x927f('0x36')]:_0x15827a['model'];if(!_0x14ac5f[_0x927f('0x31')][_0x927f('0x38')](_0x927f('0x39'))){_0x564048[_0x927f('0x1f')]=qs['limit'](_0x14ac5f[_0x927f('0x31')][_0x927f('0x1f')]);_0x564048[_0x927f('0x1e')]=qs[_0x927f('0x1e')](_0x14ac5f[_0x927f('0x31')][_0x927f('0x1e')]);}_0x564048[_0x927f('0x3a')]=qs[_0x927f('0x3b')](_0x14ac5f[_0x927f('0x31')][_0x927f('0x3b')]);_0x564048[_0x927f('0x3c')]=qs[_0x927f('0x33')](_[_0x927f('0x3d')](_0x14ac5f[_0x927f('0x31')],_0x15827a['filters']),_0x10f70c);if(_0x14ac5f['query'][_0x927f('0x3e')]){_0x564048['where']=_[_0x927f('0x3f')](_0x564048['where'],{'$or':_[_0x927f('0x2f')](_0x10f70c,function(_0xc8dfcf){if(_0xc8dfcf['type']!=='VIRTUAL'){var _0xf2a019={};_0xf2a019[_0xc8dfcf[_0x927f('0x30')]]={'$like':'%'+_0x14ac5f['query'][_0x927f('0x3e')]+'%'};return _0xf2a019;}})});}_0x564048=_['merge']({},_0x564048,_0x14ac5f['options']);var _0x237335={'where':_0x564048['where']};return db[_0x927f('0x2b')][_0x927f('0x1d')](_0x237335)[_0x927f('0x26')](function(_0x472b55){_0x349690['count']=_0x472b55;if(_0x14ac5f[_0x927f('0x31')][_0x927f('0x40')]){_0x564048[_0x927f('0x41')]=[{'all':!![]}];}return db[_0x927f('0x2b')]['findAll'](_0x564048);})[_0x927f('0x26')](function(_0x38be4a){_0x349690[_0x927f('0x42')]=_0x38be4a;return _0x349690;})[_0x927f('0x26')](respondWithFilteredResult(_0x45a565,_0x564048))[_0x927f('0x43')](handleError(_0x45a565,null));};exports[_0x927f('0x44')]=function(_0x1679c5,_0x2ffc16){var _0x1bae3d={'raw':![],'where':{'id':_0x1679c5[_0x927f('0x45')]['id']}},_0x293abb={};_0x293abb[_0x927f('0x2e')]=_['keys'](db[_0x927f('0x2b')]['rawAttributes']);_0x293abb[_0x927f('0x31')]=_[_0x927f('0x32')](_0x1679c5['query']);_0x293abb[_0x927f('0x33')]=_[_0x927f('0x34')](_0x293abb[_0x927f('0x2e')],_0x293abb[_0x927f('0x31')]);_0x1bae3d['attributes']=_[_0x927f('0x34')](_0x293abb[_0x927f('0x2e')],qs['fields'](_0x1679c5[_0x927f('0x31')][_0x927f('0x35')]));_0x1bae3d[_0x927f('0x36')]=_0x1bae3d[_0x927f('0x36')][_0x927f('0x37')]?_0x1bae3d[_0x927f('0x36')]:_0x293abb['model'];if(_0x1679c5['query'][_0x927f('0x40')]){_0x1bae3d[_0x927f('0x41')]=[{'all':!![]}];}_0x1bae3d=_[_0x927f('0x3f')]({},_0x1bae3d,_0x1679c5['options']);return db[_0x927f('0x2b')][_0x927f('0x46')](_0x1bae3d)['then'](handleEntityNotFound(_0x2ffc16,null))['then'](respondWithResult(_0x2ffc16,null))[_0x927f('0x43')](handleError(_0x2ffc16,null));};exports['create']=function(_0x10e8e8,_0xdf254b){return db[_0x927f('0x2b')][_0x927f('0x47')](_0x10e8e8['body'],{})['then'](function(_0x1bb1b8){var _0x5972aa=_0x10e8e8[_0x927f('0x48')]['get']({'plain':!![]});if(!_0x5972aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5972aa[_0x927f('0x49')]===_0x927f('0x48')){var _0x331f90=_0x1bb1b8[_0x927f('0x4a')]({'plain':!![]});var _0x30853f=_0x927f('0x28');return db[_0x927f('0x4b')][_0x927f('0x46')]({'where':{'name':_0x30853f,'userProfileId':_0x5972aa[_0x927f('0x4c')]},'raw':!![]})[_0x927f('0x26')](function(_0x15f219){if(_0x15f219&&_0x15f219[_0x927f('0x4d')]===0x0){return db[_0x927f('0x29')][_0x927f('0x47')]({'name':_0x331f90['name'],'resourceId':_0x331f90['id'],'type':_0x15f219[_0x927f('0x30')],'sectionId':_0x15f219['id']},{})['then'](function(){return _0x1bb1b8;});}else{return _0x1bb1b8;}})[_0x927f('0x43')](function(_0x1135b7){logger[_0x927f('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1135b7);throw _0x1135b7;});}return _0x1bb1b8;})['then'](respondWithResult(_0xdf254b,0xc9))[_0x927f('0x43')](handleError(_0xdf254b,null));};exports[_0x927f('0x25')]=function(_0x204e15,_0x3f2612){if(_0x204e15['body']['id']){delete _0x204e15[_0x927f('0x4f')]['id'];}return db['VoiceChanSpy'][_0x927f('0x46')]({'where':{'id':_0x204e15[_0x927f('0x45')]['id']}})[_0x927f('0x26')](handleEntityNotFound(_0x3f2612,null))[_0x927f('0x26')](saveUpdates(_0x204e15[_0x927f('0x4f')],null))[_0x927f('0x26')](respondWithResult(_0x3f2612,null))[_0x927f('0x43')](handleError(_0x3f2612,null));};exports['destroy']=function(_0x104f4d,_0x489ff4){return db['VoiceChanSpy'][_0x927f('0x46')]({'where':{'id':_0x104f4d[_0x927f('0x45')]['id']}})['then'](handleEntityNotFound(_0x489ff4,null))[_0x927f('0x26')](removeEntity(_0x489ff4,null))[_0x927f('0x43')](handleError(_0x489ff4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c4c318a..d1a435f 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 _0x757f=['system','push','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix'];(function(_0x6b2793,_0x25b54d){var _0x4f0744=function(_0x50ade4){while(--_0x50ade4){_0x6b2793['push'](_0x6b2793['shift']());}};_0x4f0744(++_0x25b54d);}(_0x757f,0xee));var _0xf757=function(_0x4f7576,_0x138a8f){_0x4f7576=_0x4f7576-0x0;var _0x45d522=_0x757f[_0x4f7576];return _0x45d522;};'use strict';var _=require(_0xf757('0x0'));var util=require('util');var BPromise=require(_0xf757('0x1'));var attributes=require(_0xf757('0x2'));var getUserApplications=function(_0x37e870,_0x135d5e,_0x5c5865){var _0x44ebcf=0x1;var _0x26a38a=[];var _0x302fba={'context':_0x135d5e[_0xf757('0x3')]||'from-sip','exten':util[_0xf757('0x4')](_0xf757('0x5'),_0x37e870[_0xf757('0x6')],_0x5c5865),'type':_0xf757('0x7'),'isApp':![],'ChanSpyId':_0x37e870['id'],'UserId':_0x135d5e['id']};_0x26a38a[_0xf757('0x8')](_['merge']({'app':'Set','appdata':util[_0xf757('0x4')](_0xf757('0x9'),_0xf757('0xa')),'priority':_0x44ebcf++},_0x302fba));if(_0x37e870[_0xf757('0xb')]){_0x26a38a['push'](_[_0xf757('0xc')]({'app':_0xf757('0xd'),'appdata':util[_0xf757('0x4')](_0xf757('0xe'),_0x37e870[_0xf757('0xf')]),'priority':_0x44ebcf++},_0x302fba));}if(_0x37e870[_0xf757('0x10')]){_0x26a38a[_0xf757('0x8')](_[_0xf757('0xc')]({'app':_0xf757('0x11'),'appdata':_0x37e870[_0xf757('0x12')],'priority':_0x44ebcf++},_0x302fba));}_0x26a38a[_0xf757('0x8')](_[_0xf757('0xc')]({'app':_0xf757('0x13'),'appdata':util[_0xf757('0x4')](_0xf757('0x14'),_0x135d5e[_0xf757('0x15')],_0x37e870[_0xf757('0x16')]?_0x37e870[_0xf757('0x16')]['join'](''):''),'priority':_0x44ebcf++},_0x302fba));if(_0x37e870[_0xf757('0xb')]){_0x26a38a[_0xf757('0x8')](_['merge']({'app':_0xf757('0x17'),'priority':_0x44ebcf++},_0x302fba));}return _0x26a38a;};var getChanSpyApplications=function(_0x2b3540,_0x10f49e){var _0x53fdce=[];for(var _0x1c5934=0x0,_0x45ea74=0x1;_0x1c5934<_0x10f49e[_0xf757('0x18')];_0x1c5934++,_0x45ea74=0x1){_0x53fdce=_0x53fdce[_0xf757('0x19')](getUserApplications(_0x2b3540,_0x10f49e[_0x1c5934],_0x10f49e[_0x1c5934]['internal']));if(_0x10f49e[_0x1c5934][_0xf757('0x1a')]!=_0x10f49e[_0x1c5934][_0xf757('0x15')]){_0x53fdce=_0x53fdce[_0xf757('0x19')](getUserApplications(_0x2b3540,_0x10f49e[_0x1c5934],_0x10f49e[_0x1c5934][_0xf757('0x15')]));}}return _0x53fdce;};var getChanSpyPromise=function(_0x25c375,_0x4d6580){return new BPromise(function(_0x4b9573,_0x343fe9){return _0x25c375['User']['findAll']({'attributes':['id',_0xf757('0x15'),_0xf757('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xf757('0x1b')](function(_0x2d993f){if(_0x2d993f){return _0x4b9573(getChanSpyApplications(_0x4d6580,_0x2d993f));}return _0x4b9573([]);})[_0xf757('0x1c')](function(_0x383bb2){_0x343fe9(_0x383bb2);});});};module['exports']=function(_0x495bad,_0x1edb1b){var _0x3a269d=_0x495bad[_0xf757('0x1d')];return _0x495bad[_0xf757('0x1e')](_0xf757('0x1f'),attributes,{'tableName':_0xf757('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x98f305,_0x3232c6,_0x355d70){return getChanSpyPromise(_0x3a269d,_0x98f305)[_0xf757('0x1b')](function(_0x4d9012){if(_0x4d9012&&_0x4d9012['length']){return _0x3a269d[_0xf757('0x21')][_0xf757('0x22')](_0x4d9012);}})[_0xf757('0x1b')](function(){_0x355d70();})[_0xf757('0x1c')](function(_0x207bae){_0x355d70(_0x207bae);});},'afterUpdate':function(_0x3ca172,_0x155a13,_0x180882){return _0x3a269d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3ca172['id']}})[_0xf757('0x1b')](function(){return getChanSpyPromise(_0x3a269d,_0x3ca172);})['then'](function(_0x1fa192){if(_0x1fa192&&_0x1fa192['length']){return _0x3a269d[_0xf757('0x21')][_0xf757('0x22')](_0x1fa192);}})['then'](function(){_0x180882();})[_0xf757('0x1c')](function(_0x269388){_0x180882(_0x269388);});},'afterDestroy':function(_0x1b6a03,_0x3ad266,_0x542b16){return _0x3a269d[_0xf757('0x21')]['destroy']({'where':{'ChanSpyId':_0x1b6a03['id']}})[_0xf757('0x1b')](function(){_0x542b16();})['catch'](function(_0xa03db8){_0x542b16(_0xa03db8);});}}});}; \ No newline at end of file +var _0xd136=['then','catch','models','define','voice_chanspy','VoiceExtension','destroy','bulkCreate','util','bluebird','context','from-sip','format','prefix','system','Set','CDR(type)=%s','chanspy','merge','MixMonitor','auth','push','password','ChanSpy','options','join','record','StopMixMonitor','length','concat','internal','name','User','findAll','agent'];(function(_0xa76db3,_0xf8fd0){var _0x47338e=function(_0x3163b6){while(--_0x3163b6){_0xa76db3['push'](_0xa76db3['shift']());}};_0x47338e(++_0xf8fd0);}(_0xd136,0x94));var _0x6d13=function(_0x3f0f6d,_0xf48051){_0x3f0f6d=_0x3f0f6d-0x0;var _0x1bd358=_0xd136[_0x3f0f6d];return _0x1bd358;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var BPromise=require(_0x6d13('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x56824,_0x2d8f30,_0x12b9d6){var _0x2a3702=0x1;var _0xec09ab=[];var _0x387947={'context':_0x2d8f30[_0x6d13('0x2')]||_0x6d13('0x3'),'exten':util[_0x6d13('0x4')]('%s%s',_0x56824[_0x6d13('0x5')],_0x12b9d6),'type':_0x6d13('0x6'),'isApp':![],'ChanSpyId':_0x56824['id'],'UserId':_0x2d8f30['id']};_0xec09ab['push'](_['merge']({'app':_0x6d13('0x7'),'appdata':util[_0x6d13('0x4')](_0x6d13('0x8'),_0x6d13('0x9')),'priority':_0x2a3702++},_0x387947));if(_0x56824['record']){_0xec09ab['push'](_[_0x6d13('0xa')]({'app':_0x6d13('0xb'),'appdata':util[_0x6d13('0x4')]('${UNIQUEID}.%s,a',_0x56824['recordingFormat']),'priority':_0x2a3702++},_0x387947));}if(_0x56824[_0x6d13('0xc')]){_0xec09ab[_0x6d13('0xd')](_[_0x6d13('0xa')]({'app':'Authenticate','appdata':_0x56824[_0x6d13('0xe')],'priority':_0x2a3702++},_0x387947));}_0xec09ab[_0x6d13('0xd')](_[_0x6d13('0xa')]({'app':_0x6d13('0xf'),'appdata':util['format']('SIP/%s,%s',_0x2d8f30['name'],_0x56824[_0x6d13('0x10')]?_0x56824[_0x6d13('0x10')][_0x6d13('0x11')](''):''),'priority':_0x2a3702++},_0x387947));if(_0x56824[_0x6d13('0x12')]){_0xec09ab[_0x6d13('0xd')](_['merge']({'app':_0x6d13('0x13'),'priority':_0x2a3702++},_0x387947));}return _0xec09ab;};var getChanSpyApplications=function(_0x405368,_0x2959a8){var _0x40d8ba=[];for(var _0x348cab=0x0,_0x3f67ba=0x1;_0x348cab<_0x2959a8[_0x6d13('0x14')];_0x348cab++,_0x3f67ba=0x1){_0x40d8ba=_0x40d8ba[_0x6d13('0x15')](getUserApplications(_0x405368,_0x2959a8[_0x348cab],_0x2959a8[_0x348cab][_0x6d13('0x16')]));if(_0x2959a8[_0x348cab]['internal']!=_0x2959a8[_0x348cab][_0x6d13('0x17')]){_0x40d8ba=_0x40d8ba[_0x6d13('0x15')](getUserApplications(_0x405368,_0x2959a8[_0x348cab],_0x2959a8[_0x348cab][_0x6d13('0x17')]));}}return _0x40d8ba;};var getChanSpyPromise=function(_0x425b3c,_0x1f3603){return new BPromise(function(_0x223eb4,_0x1daeb2){return _0x425b3c[_0x6d13('0x18')][_0x6d13('0x19')]({'attributes':['id',_0x6d13('0x17'),_0x6d13('0x16')],'where':{'role':_0x6d13('0x1a'),'chanspy':!![]},'raw':!![]})[_0x6d13('0x1b')](function(_0x691833){if(_0x691833){return _0x223eb4(getChanSpyApplications(_0x1f3603,_0x691833));}return _0x223eb4([]);})[_0x6d13('0x1c')](function(_0x208876){_0x1daeb2(_0x208876);});});};module['exports']=function(_0x387de2,_0x4f490b){var _0x3531bc=_0x387de2[_0x6d13('0x1d')];return _0x387de2[_0x6d13('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x6d13('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x432d99,_0x1ab8ef,_0x4366a0){return getChanSpyPromise(_0x3531bc,_0x432d99)[_0x6d13('0x1b')](function(_0x361432){if(_0x361432&&_0x361432[_0x6d13('0x14')]){return _0x3531bc[_0x6d13('0x20')]['bulkCreate'](_0x361432);}})[_0x6d13('0x1b')](function(){_0x4366a0();})['catch'](function(_0x4c8526){_0x4366a0(_0x4c8526);});},'afterUpdate':function(_0xf0063e,_0x588c40,_0x37b3fd){return _0x3531bc[_0x6d13('0x20')][_0x6d13('0x21')]({'where':{'ChanSpyId':_0xf0063e['id']}})['then'](function(){return getChanSpyPromise(_0x3531bc,_0xf0063e);})[_0x6d13('0x1b')](function(_0xd469b6){if(_0xd469b6&&_0xd469b6['length']){return _0x3531bc[_0x6d13('0x20')][_0x6d13('0x22')](_0xd469b6);}})[_0x6d13('0x1b')](function(){_0x37b3fd();})[_0x6d13('0x1c')](function(_0x20168d){_0x37b3fd(_0x20168d);});},'afterDestroy':function(_0x105934,_0x907f2f,_0x34abc4){return _0x3531bc['VoiceExtension'][_0x6d13('0x21')]({'where':{'ChanSpyId':_0x105934['id']}})[_0x6d13('0x1b')](function(){_0x34abc4();})['catch'](function(_0x12855d){_0x34abc4(_0x12855d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 70a707b..749cb0f 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 _0x3c14=['stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x29729c,_0x1b37b7){var _0x3441df=function(_0xe39527){while(--_0xe39527){_0x29729c['push'](_0x29729c['shift']());}};_0x3441df(++_0x1b37b7);}(_0x3c14,0x6c));var _0x43c1=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x3c14[_0x1d70db];return _0x3060c6;};'use strict';var _=require('lodash');var util=require(_0x43c1('0x0'));var moment=require(_0x43c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x43c1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x43c1('0x4'))(_0x43c1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e1ac,_0xb47d5f,_0x562642){return new BPromise(function(_0x54d24a,_0x368f4d){return client[_0x43c1('0x6')](_0x10e1ac,_0x562642)[_0x43c1('0x7')](function(_0x1f3b2e){logger[_0x43c1('0x8')](_0x43c1('0x9'),_0xb47d5f,'request\x20sent');logger['debug'](_0x43c1('0xa'),_0xb47d5f,'request\x20sent',JSON[_0x43c1('0xb')](_0x1f3b2e));if(_0x1f3b2e['error']){if(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xd')]===0x1f4){logger[_0x43c1('0xc')](_0x43c1('0x9'),_0xb47d5f,_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);return _0x368f4d(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);}logger[_0x43c1('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0xb47d5f,_0x1f3b2e[_0x43c1('0xc')]['message']);return _0x54d24a(_0x1f3b2e[_0x43c1('0xc')][_0x43c1('0xe')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0xb47d5f,'request\x20sent');_0x54d24a(_0x1f3b2e[_0x43c1('0xf')][_0x43c1('0xe')]);}})[_0x43c1('0x10')](function(_0x384e75){logger[_0x43c1('0xc')](_0x43c1('0x9'),_0xb47d5f,_0x384e75);_0x368f4d(_0x384e75);});});} \ No newline at end of file +var _0x3d3a=['http','then','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3d3a,0x78));var _0xa3d3=function(_0xe38e2a,_0x36597d){_0xe38e2a=_0xe38e2a-0x0;var _0x3f8130=_0x3d3a[_0xe38e2a];return _0x3f8130;};'use strict';var _=require('lodash');var util=require(_0xa3d3('0x0'));var moment=require(_0xa3d3('0x1'));var BPromise=require(_0xa3d3('0x2'));var rs=require(_0xa3d3('0x3'));var fs=require('fs');var Redis=require(_0xa3d3('0x4'));var db=require(_0xa3d3('0x5'))['db'];var utils=require(_0xa3d3('0x6'));var logger=require(_0xa3d3('0x7'))(_0xa3d3('0x8'));var config=require(_0xa3d3('0x9'));var jayson=require(_0xa3d3('0xa'));var client=jayson[_0xa3d3('0xb')][_0xa3d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x284cb6,_0x414e2f,_0x4f581c){return new BPromise(function(_0x3b81d4,_0x4a0d46){return client['request'](_0x284cb6,_0x4f581c)[_0xa3d3('0xd')](function(_0x275497){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x414e2f,_0xa3d3('0xe'));logger['debug'](_0xa3d3('0xf'),_0x414e2f,_0xa3d3('0xe'),JSON[_0xa3d3('0x10')](_0x275497));if(_0x275497['error']){if(_0x275497[_0xa3d3('0x11')]['code']===0x1f4){logger[_0xa3d3('0x11')](_0xa3d3('0x12'),_0x414e2f,_0x275497[_0xa3d3('0x11')]['message']);return _0x4a0d46(_0x275497['error'][_0xa3d3('0x13')]);}logger['error'](_0xa3d3('0x12'),_0x414e2f,_0x275497[_0xa3d3('0x11')][_0xa3d3('0x13')]);return _0x3b81d4(_0x275497[_0xa3d3('0x11')][_0xa3d3('0x13')]);}else{logger['info'](_0xa3d3('0x12'),_0x414e2f,_0xa3d3('0xe'));_0x3b81d4(_0x275497[_0xa3d3('0x14')]['message']);}})[_0xa3d3('0x15')](function(_0x45d4b0){logger[_0xa3d3('0x11')](_0xa3d3('0x12'),_0x414e2f,_0x45d4b0);_0x4a0d46(_0x45d4b0);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 30a349b..aa497ba 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 _0x46f7=['../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','express','Router'];(function(_0x208d39,_0x5de94f){var _0x3f96cb=function(_0x23d510){while(--_0x23d510){_0x208d39['push'](_0x208d39['shift']());}};_0x3f96cb(++_0x5de94f);}(_0x46f7,0x194));var _0x746f=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x46f7[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x746f('0x0'));var router=express[_0x746f('0x1')]();var auth=require(_0x746f('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x746f('0x3'));var controller=require('./voiceContext.controller');router[_0x746f('0x4')]('/',auth[_0x746f('0x5')](),controller['index']);router[_0x746f('0x4')](_0x746f('0x6'),auth[_0x746f('0x5')](),controller[_0x746f('0x7')]);router[_0x746f('0x8')]('/',auth[_0x746f('0x5')](),controller[_0x746f('0x9')]);router[_0x746f('0xa')](_0x746f('0x6'),auth['isAuthenticated'](),controller[_0x746f('0xb')]);router[_0x746f('0xc')]('/:id',auth[_0x746f('0x5')](),controller[_0x746f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6d1a=['index','get','isAuthenticated','show','post','create','put','update','/:id','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x4ef402,_0x58c632){var _0x44b661=function(_0x70dfe3){while(--_0x70dfe3){_0x4ef402['push'](_0x4ef402['shift']());}};_0x44b661(++_0x58c632);}(_0x6d1a,0x89));var _0xa6d1=function(_0x5ec873,_0x45c0b9){_0x5ec873=_0x5ec873-0x0;var _0x28d60c=_0x6d1a[_0x5ec873];return _0x28d60c;};'use strict';var multer=require('multer');var util=require(_0xa6d1('0x0'));var path=require(_0xa6d1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa6d1('0x2')]();var auth=require(_0xa6d1('0x3'));var interaction=require(_0xa6d1('0x4'));var config=require(_0xa6d1('0x5'));var controller=require(_0xa6d1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa6d1('0x7')]);router[_0xa6d1('0x8')]('/:id',auth[_0xa6d1('0x9')](),controller[_0xa6d1('0xa')]);router[_0xa6d1('0xb')]('/',auth[_0xa6d1('0x9')](),controller[_0xa6d1('0xc')]);router[_0xa6d1('0xd')]('/:id',auth[_0xa6d1('0x9')](),controller[_0xa6d1('0xe')]);router['delete'](_0xa6d1('0xf'),auth[_0xa6d1('0x9')](),controller[_0xa6d1('0x10')]);module[_0xa6d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b508b19..9bc45d4 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 _0x3e74=['name','sequelize','STRING'];(function(_0x4a8941,_0x42af9c){var _0x4e8c67=function(_0x163f2a){while(--_0x163f2a){_0x4a8941['push'](_0x4a8941['shift']());}};_0x4e8c67(++_0x42af9c);}(_0x3e74,0x175));var _0x43e7=function(_0x48c678,_0x4b8a81){_0x48c678=_0x48c678-0x0;var _0xead393=_0x3e74[_0x48c678];return _0xead393;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0x449e52,_0x58e267){var _0x5a7e5e=function(_0x382c80){while(--_0x382c80){_0x449e52['push'](_0x449e52['shift']());}};_0x5a7e5e(++_0x58e267);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f85b7f8..ec5547c 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 _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_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 db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 157ce81..5628d73 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x19ca65,_0x2dd9b3){var _0x549a46=function(_0x4aa923){while(--_0x4aa923){_0x19ca65['push'](_0x19ca65['shift']());}};_0x549a46(++_0x2dd9b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 726997e..c3ae910 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 _0xcfe7=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xff4391,_0x2108b1){var _0xc9689b=function(_0x2bf9f7){while(--_0x2bf9f7){_0xff4391['push'](_0xff4391['shift']());}};_0xc9689b(++_0x2108b1);}(_0xcfe7,0xfb));var _0x7cfe=function(_0x43c89b,_0x23d2cb){_0x43c89b=_0x43c89b-0x0;var _0xaf3b03=_0xcfe7[_0x43c89b];return _0xaf3b03;};'use strict';var _=require(_0x7cfe('0x0'));var util=require(_0x7cfe('0x1'));var moment=require('moment');var BPromise=require(_0x7cfe('0x2'));var rs=require(_0x7cfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cfe('0x4'))['db'];var utils=require(_0x7cfe('0x5'));var logger=require(_0x7cfe('0x6'))('rpc');var config=require(_0x7cfe('0x7'));var jayson=require(_0x7cfe('0x8'));var client=jayson[_0x7cfe('0x9')][_0x7cfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c37ce,_0x597f0f,_0x1bed96){return new BPromise(function(_0x1ad64e,_0x25a247){return client[_0x7cfe('0xb')](_0x1c37ce,_0x1bed96)[_0x7cfe('0xc')](function(_0x389f8f){logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));logger[_0x7cfe('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x597f0f,'request\x20sent',JSON[_0x7cfe('0x10')](_0x389f8f));if(_0x389f8f[_0x7cfe('0x11')]){if(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x12')]===0x1f4){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x389f8f['error']['message']);return _0x25a247(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x597f0f,_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);return _0x1ad64e(_0x389f8f[_0x7cfe('0x11')][_0x7cfe('0x13')]);}else{logger['info'](_0x7cfe('0xd'),_0x597f0f,_0x7cfe('0xe'));_0x1ad64e(_0x389f8f[_0x7cfe('0x14')][_0x7cfe('0x13')]);}})[_0x7cfe('0x15')](function(_0x1c82db){logger[_0x7cfe('0x11')](_0x7cfe('0xd'),_0x597f0f,_0x1c82db);_0x25a247(_0x1c82db);});});} \ No newline at end of file +var _0x1cf3=['request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x1cf3,0x1be));var _0x31cf=function(_0x385ce3,_0x38d911){_0x385ce3=_0x385ce3-0x0;var _0xc08d8a=_0x1cf3[_0x385ce3];return _0xc08d8a;};'use strict';var _=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var moment=require(_0x31cf('0x2'));var BPromise=require(_0x31cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31cf('0x5'));var logger=require(_0x31cf('0x6'))(_0x31cf('0x7'));var config=require(_0x31cf('0x8'));var jayson=require(_0x31cf('0x9'));var client=jayson[_0x31cf('0xa')][_0x31cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830b4,_0x2581c4,_0x6be80){return new BPromise(function(_0x3f7b2e,_0x3fa83e){return client[_0x31cf('0xc')](_0x1830b4,_0x6be80)[_0x31cf('0xd')](function(_0x56e8f6){logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,_0x31cf('0x10'));logger['debug'](_0x31cf('0x11'),_0x2581c4,_0x31cf('0x10'),JSON[_0x31cf('0x12')](_0x56e8f6));if(_0x56e8f6[_0x31cf('0x13')]){if(_0x56e8f6[_0x31cf('0x13')]['code']===0x1f4){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);return _0x3fa83e(_0x56e8f6[_0x31cf('0x13')]['message']);}logger[_0x31cf('0x13')](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')]['message']);return _0x3f7b2e(_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);}else{logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,'request\x20sent');_0x3f7b2e(_0x56e8f6['result'][_0x31cf('0x14')]);}})[_0x31cf('0x15')](function(_0x2d5532){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x2d5532);_0x3fa83e(_0x2d5532);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d3e69ad..c7ffb1c 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 _0x2eef=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','update','exports'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x2eef,0x187));var _0xf2ee=function(_0x38a703,_0x58a400){_0x38a703=_0x38a703-0x0;var _0x657177=_0x2eef[_0x38a703];return _0x657177;};'use strict';var multer=require(_0xf2ee('0x0'));var util=require('util');var path=require(_0xf2ee('0x1'));var timeout=require('connect-timeout');var express=require(_0xf2ee('0x2'));var router=express[_0xf2ee('0x3')]();var auth=require(_0xf2ee('0x4'));var interaction=require(_0xf2ee('0x5'));var config=require('../../config/environment');var controller=require(_0xf2ee('0x6'));router['get']('/',auth[_0xf2ee('0x7')](),controller['index']);router[_0xf2ee('0x8')](_0xf2ee('0x9'),auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xa')]);router[_0xf2ee('0x8')](_0xf2ee('0xb'),auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xc')]);router[_0xf2ee('0xd')]('/',auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xe')]);router['put']('/:id',auth[_0xf2ee('0x7')](),controller[_0xf2ee('0xf')]);router['delete']('/:id',auth[_0xf2ee('0x7')](),controller['destroy']);module[_0xf2ee('0x10')]=router; \ No newline at end of file +var _0x643e=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4caf4f,_0x1f9d37){var _0xf64dd9=function(_0x37507){while(--_0x37507){_0x4caf4f['push'](_0x4caf4f['shift']());}};_0xf64dd9(++_0x1f9d37);}(_0x643e,0x125));var _0xe643=function(_0x5520c4,_0x9c1355){_0x5520c4=_0x5520c4-0x0;var _0xd51604=_0x643e[_0x5520c4];return _0xd51604;};'use strict';var multer=require(_0xe643('0x0'));var util=require('util');var path=require(_0xe643('0x1'));var timeout=require('connect-timeout');var express=require(_0xe643('0x2'));var router=express[_0xe643('0x3')]();var auth=require(_0xe643('0x4'));var interaction=require(_0xe643('0x5'));var config=require(_0xe643('0x6'));var controller=require('./voiceDialReport.controller');router[_0xe643('0x7')]('/',auth['isAuthenticated'](),controller[_0xe643('0x8')]);router[_0xe643('0x7')](_0xe643('0x9'),auth[_0xe643('0xa')](),controller[_0xe643('0xb')]);router[_0xe643('0x7')](_0xe643('0xc'),auth[_0xe643('0xa')](),controller[_0xe643('0xd')]);router[_0xe643('0xe')]('/',auth[_0xe643('0xa')](),controller[_0xe643('0xf')]);router[_0xe643('0x10')](_0xe643('0xc'),auth[_0xe643('0xa')](),controller[_0xe643('0x11')]);router['delete'](_0xe643('0xc'),auth[_0xe643('0xa')](),controller[_0xe643('0x12')]);module[_0xe643('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b4b7197..959e778 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 _0x396f=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x9a29ea,_0x5b8b29){var _0x11f261=function(_0x397dea){while(--_0x397dea){_0x9a29ea['push'](_0x9a29ea['shift']());}};_0x11f261(++_0x5b8b29);}(_0x396f,0x80));var _0xf396=function(_0x2da05d,_0x2fcf57){_0x2da05d=_0x2da05d-0x0;var _0x5e6f08=_0x396f[_0x2da05d];return _0x5e6f08;};'use strict';var Sequelize=require(_0xf396('0x0'));module[_0xf396('0x1')]={'privilege':{'type':Sequelize[_0xf396('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf396('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf396('0x2')]},'calleridnum':{'type':Sequelize[_0xf396('0x2')]},'calleridname':{'type':Sequelize[_0xf396('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf396('0x2')]},'connectedlinename':{'type':Sequelize[_0xf396('0x2')]},'language':{'type':Sequelize[_0xf396('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf396('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xf396('0x2')]},'linkedid':{'type':Sequelize[_0xf396('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf396('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xf396('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf396('0x2')]},'destcalleridname':{'type':Sequelize[_0xf396('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf396('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf396('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xf396('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xf396('0x2')]},'destlinkedid':{'type':Sequelize[_0xf396('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf396('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf396('0x4')]},'endtime':{'type':Sequelize[_0xf396('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xf396('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xf396('0x3')]},'holdtime':{'type':Sequelize[_0xf396('0x3')]},'billableseconds':{'type':Sequelize[_0xf396('0x3')]}}; \ No newline at end of file +var _0x11a9=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x4c4d44,_0x199ab7){var _0x23af06=function(_0x1168c6){while(--_0x1168c6){_0x4c4d44['push'](_0x4c4d44['shift']());}};_0x23af06(++_0x199ab7);}(_0x11a9,0x116));var _0x911a=function(_0x3e6986,_0x33ebfa){_0x3e6986=_0x3e6986-0x0;var _0x2c5ffa=_0x11a9[_0x3e6986];return _0x2c5ffa;};'use strict';var Sequelize=require(_0x911a('0x0'));module[_0x911a('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x911a('0x2')]},'channelstate':{'type':Sequelize[_0x911a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x911a('0x2')]},'calleridnum':{'type':Sequelize[_0x911a('0x2')]},'calleridname':{'type':Sequelize[_0x911a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x911a('0x2')]},'connectedlinename':{'type':Sequelize[_0x911a('0x2')]},'language':{'type':Sequelize[_0x911a('0x2')]},'accountcode':{'type':Sequelize[_0x911a('0x2')]},'context':{'type':Sequelize[_0x911a('0x2')]},'exten':{'type':Sequelize[_0x911a('0x2')]},'priority':{'type':Sequelize[_0x911a('0x3')]},'uniqueid':{'type':Sequelize[_0x911a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x911a('0x2')]},'destchannelstate':{'type':Sequelize[_0x911a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x911a('0x2')]},'destcalleridname':{'type':Sequelize[_0x911a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x911a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x911a('0x2')]},'destlanguage':{'type':Sequelize[_0x911a('0x2')]},'destaccountcode':{'type':Sequelize[_0x911a('0x2')]},'destcontext':{'type':Sequelize[_0x911a('0x2')]},'destexten':{'type':Sequelize[_0x911a('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x911a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x911a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x911a('0x4')]},'endtime':{'type':Sequelize[_0x911a('0x4')]},'lastevent':{'type':Sequelize[_0x911a('0x2')],'comment':_0x911a('0x5')},'routeId':{'type':Sequelize[_0x911a('0x3')]},'duration':{'type':Sequelize[_0x911a('0x3')]},'holdtime':{'type':Sequelize[_0x911a('0x3')]},'billableseconds':{'type':Sequelize[_0x911a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 287be78..ba92c5a 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 _0x98a7=['findAll','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','save','update','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceDialReport','count','includeAll','include'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x98a7,0x9e));var _0x798a=function(_0x430dd8,_0x31875e){_0x430dd8=_0x430dd8-0x0;var _0x3b4ef3=_0x98a7[_0x430dd8];return _0x3b4ef3;};'use strict';var pdf=require(_0x798a('0x0'));var emlformat=require(_0x798a('0x1'));var rimraf=require(_0x798a('0x2'));var zipdir=require(_0x798a('0x3'));var jsonpatch=require(_0x798a('0x4'));var rp=require(_0x798a('0x5'));var moment=require(_0x798a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x798a('0x7'));var util=require(_0x798a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x798a('0x9'));var ejs=require(_0x798a('0xa'));var fs=require('fs');var _=require(_0x798a('0xb'));var squel=require(_0x798a('0xc'));var crypto=require(_0x798a('0xd'));var jsforce=require(_0x798a('0xe'));var deskjs=require(_0x798a('0xf'));var toCsv=require(_0x798a('0x9'));var querystring=require('querystring');var Papa=require(_0x798a('0x10'));var Redis=require(_0x798a('0x11'));var authService=require(_0x798a('0x12'));var qs=require(_0x798a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x798a('0x14'));var logger=require(_0x798a('0x15'))(_0x798a('0x16'));var utils=require(_0x798a('0x17'));var config=require(_0x798a('0x18'));var db=require(_0x798a('0x19'))['db'];function respondWithStatusCode(_0x578398,_0x261b1f){_0x261b1f=_0x261b1f||0xcc;return function(_0x526bd0){if(_0x526bd0){return _0x578398[_0x798a('0x1a')](_0x261b1f);}return _0x578398[_0x798a('0x1b')](_0x261b1f)['end']();};}function respondWithResult(_0x1cb92b,_0x3f96f6){_0x3f96f6=_0x3f96f6||0xc8;return function(_0x5b60ba){if(_0x5b60ba){return _0x1cb92b[_0x798a('0x1b')](_0x3f96f6)['json'](_0x5b60ba);}};}function respondWithFilteredResult(_0xf12a1,_0x1746d2){return function(_0x34bfdb){if(_0x34bfdb){var _0x1f5156=_0x34bfdb['count'],_0x560366=_0x1746d2[_0x798a('0x1c')],_0x1f8329=_0x1746d2[_0x798a('0x1c')]+_0x1746d2[_0x798a('0x1d')],_0x26b43a;if(_0x1f8329>=_0x1f5156){_0x1f8329=_0x1f5156;_0x26b43a=0xc8;}else{_0x26b43a=0xce;}_0xf12a1[_0x798a('0x1b')](_0x26b43a);return _0xf12a1[_0x798a('0x1e')](_0x798a('0x1f'),_0x560366+'-'+_0x1f8329+'/'+_0x1f5156)[_0x798a('0x20')](_0x34bfdb);}return null;};}function patchUpdates(_0x114d59){return function(_0x16c4f3){try{jsonpatch[_0x798a('0x21')](_0x16c4f3,_0x114d59,!![]);}catch(_0x429c4d){return BPromise['reject'](_0x429c4d);}return _0x16c4f3[_0x798a('0x22')]();};}function saveUpdates(_0x9840cc,_0x145295){return function(_0x4715e7){if(_0x4715e7){return _0x4715e7[_0x798a('0x23')](_0x9840cc)[_0x798a('0x24')](function(_0x318d41){return _0x318d41;});}return null;};}function removeEntity(_0xea094d,_0x23e327){return function(_0x2b103c){if(_0x2b103c){return _0x2b103c['destroy']()['then'](function(){_0xea094d[_0x798a('0x1b')](0xcc)[_0x798a('0x25')]();});}};}function handleEntityNotFound(_0x2bdfd7,_0x54d725){return function(_0x1c08ac){if(!_0x1c08ac){_0x2bdfd7[_0x798a('0x1a')](0x194);}return _0x1c08ac;};}function handleError(_0x3310e0,_0x5465b3){_0x5465b3=_0x5465b3||0x1f4;return function(_0x3ff7dc){logger['error'](_0x3ff7dc['stack']);if(_0x3ff7dc[_0x798a('0x26')]){delete _0x3ff7dc[_0x798a('0x26')];}_0x3310e0['status'](_0x5465b3)[_0x798a('0x27')](_0x3ff7dc);};}exports[_0x798a('0x28')]=function(_0x41a040,_0x2bef37){var _0x4c11fa={},_0x3eeb44={},_0xf28bbf={'count':0x0,'rows':[]};var _0x288e96=_[_0x798a('0x29')](db['VoiceDialReport'][_0x798a('0x2a')],function(_0x4674f6){return{'name':_0x4674f6[_0x798a('0x2b')],'type':_0x4674f6[_0x798a('0x2c')][_0x798a('0x2d')]};});_0x3eeb44[_0x798a('0x2e')]=_[_0x798a('0x29')](_0x288e96,'name');_0x3eeb44[_0x798a('0x2f')]=_[_0x798a('0x30')](_0x41a040[_0x798a('0x2f')]);_0x3eeb44['filters']=_[_0x798a('0x31')](_0x3eeb44[_0x798a('0x2e')],_0x3eeb44['query']);_0x4c11fa['attributes']=_[_0x798a('0x31')](_0x3eeb44['model'],qs['fields'](_0x41a040[_0x798a('0x2f')][_0x798a('0x32')]));_0x4c11fa['attributes']=_0x4c11fa[_0x798a('0x33')][_0x798a('0x34')]?_0x4c11fa[_0x798a('0x33')]:_0x3eeb44['model'];if(!_0x41a040[_0x798a('0x2f')][_0x798a('0x35')](_0x798a('0x36'))){_0x4c11fa[_0x798a('0x1d')]=qs['limit'](_0x41a040[_0x798a('0x2f')][_0x798a('0x1d')]);_0x4c11fa[_0x798a('0x1c')]=qs['offset'](_0x41a040['query'][_0x798a('0x1c')]);}_0x4c11fa['order']=qs[_0x798a('0x37')](_0x41a040[_0x798a('0x2f')]['sort']);_0x4c11fa[_0x798a('0x38')]=qs[_0x798a('0x39')](_[_0x798a('0x3a')](_0x41a040[_0x798a('0x2f')],_0x3eeb44['filters']),_0x288e96);if(_0x41a040[_0x798a('0x2f')][_0x798a('0x3b')]){_0x4c11fa[_0x798a('0x38')]=_['merge'](_0x4c11fa[_0x798a('0x38')],{'$or':_[_0x798a('0x29')](_0x288e96,function(_0x61e5ad){if(_0x61e5ad[_0x798a('0x2c')]!==_0x798a('0x3c')){var _0x12e98f={};_0x12e98f[_0x61e5ad['name']]={'$like':'%'+_0x41a040['query']['filter']+'%'};return _0x12e98f;}})});}_0x4c11fa=_[_0x798a('0x3d')]({},_0x4c11fa,_0x41a040[_0x798a('0x3e')]);var _0x5d20b5={'where':_0x4c11fa[_0x798a('0x38')]};return db[_0x798a('0x3f')]['count'](_0x5d20b5)[_0x798a('0x24')](function(_0x55c978){_0xf28bbf[_0x798a('0x40')]=_0x55c978;if(_0x41a040[_0x798a('0x2f')][_0x798a('0x41')]){_0x4c11fa[_0x798a('0x42')]=[{'all':!![]}];}return db[_0x798a('0x3f')][_0x798a('0x43')](_0x4c11fa);})['then'](function(_0x352ce4){_0xf28bbf['rows']=_0x352ce4;return _0xf28bbf;})['then'](respondWithFilteredResult(_0x2bef37,_0x4c11fa))[_0x798a('0x44')](handleError(_0x2bef37,null));};exports[_0x798a('0x45')]=function(_0x26e4c8,_0x531bb3){var _0x23c363={'raw':!![],'where':{'id':_0x26e4c8[_0x798a('0x46')]['id']}},_0x4e51f9={};_0x4e51f9[_0x798a('0x2e')]=_[_0x798a('0x30')](db[_0x798a('0x3f')][_0x798a('0x2a')]);_0x4e51f9[_0x798a('0x2f')]=_[_0x798a('0x30')](_0x26e4c8[_0x798a('0x2f')]);_0x4e51f9[_0x798a('0x39')]=_[_0x798a('0x31')](_0x4e51f9['model'],_0x4e51f9[_0x798a('0x2f')]);_0x23c363[_0x798a('0x33')]=_[_0x798a('0x31')](_0x4e51f9[_0x798a('0x2e')],qs[_0x798a('0x32')](_0x26e4c8[_0x798a('0x2f')][_0x798a('0x32')]));_0x23c363['attributes']=_0x23c363[_0x798a('0x33')][_0x798a('0x34')]?_0x23c363[_0x798a('0x33')]:_0x4e51f9[_0x798a('0x2e')];if(_0x26e4c8['query'][_0x798a('0x41')]){_0x23c363[_0x798a('0x42')]=[{'all':!![]}];}_0x23c363=_[_0x798a('0x3d')]({},_0x23c363,_0x26e4c8[_0x798a('0x3e')]);return db['VoiceDialReport']['find'](_0x23c363)[_0x798a('0x24')](handleEntityNotFound(_0x531bb3,null))[_0x798a('0x24')](respondWithResult(_0x531bb3,null))['catch'](handleError(_0x531bb3,null));};exports[_0x798a('0x47')]=function(_0xd9cb82,_0xa11857){return db[_0x798a('0x3f')][_0x798a('0x47')](_0xd9cb82[_0x798a('0x48')],{})['then'](respondWithResult(_0xa11857,0xc9))['catch'](handleError(_0xa11857,null));};exports[_0x798a('0x23')]=function(_0x1a6d60,_0x1928c7){if(_0x1a6d60['body']['id']){delete _0x1a6d60[_0x798a('0x48')]['id'];}return db[_0x798a('0x3f')][_0x798a('0x49')]({'where':{'id':_0x1a6d60[_0x798a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1928c7,null))['then'](saveUpdates(_0x1a6d60[_0x798a('0x48')],null))[_0x798a('0x24')](respondWithResult(_0x1928c7,null))['catch'](handleError(_0x1928c7,null));};exports['destroy']=function(_0x3214f7,_0x386077){return db[_0x798a('0x3f')][_0x798a('0x49')]({'where':{'id':_0x3214f7[_0x798a('0x46')]['id']}})['then'](handleEntityNotFound(_0x386077,null))['then'](removeEntity(_0x386077,null))[_0x798a('0x44')](handleError(_0x386077,null));};exports[_0x798a('0x4a')]=function(_0x1aa95c,_0x577c30){return db[_0x798a('0x3f')][_0x798a('0x4a')]()[_0x798a('0x24')](respondWithResult(_0x577c30,null))['catch'](handleError(_0x577c30,null));}; \ No newline at end of file +var _0x2056=['sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy'];(function(_0x372a92,_0x5f50be){var _0x27ea6d=function(_0x3e4e3c){while(--_0x3e4e3c){_0x372a92['push'](_0x372a92['shift']());}};_0x27ea6d(++_0x5f50be);}(_0x2056,0x107));var _0x6205=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x2056[_0xf55e73];return _0x116b99;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6205('0x0'));var zipdir=require(_0x6205('0x1'));var jsonpatch=require(_0x6205('0x2'));var rp=require(_0x6205('0x3'));var moment=require(_0x6205('0x4'));var BPromise=require(_0x6205('0x5'));var Mustache=require(_0x6205('0x6'));var util=require(_0x6205('0x7'));var path=require(_0x6205('0x8'));var sox=require('sox');var csv=require(_0x6205('0x9'));var ejs=require(_0x6205('0xa'));var fs=require('fs');var _=require(_0x6205('0xb'));var squel=require(_0x6205('0xc'));var crypto=require(_0x6205('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6205('0xe'));var toCsv=require(_0x6205('0x9'));var querystring=require(_0x6205('0xf'));var Papa=require(_0x6205('0x10'));var Redis=require(_0x6205('0x11'));var authService=require(_0x6205('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6205('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6205('0x14'))(_0x6205('0x15'));var utils=require(_0x6205('0x16'));var config=require(_0x6205('0x17'));var db=require(_0x6205('0x18'))['db'];function respondWithStatusCode(_0x4ed8b1,_0x40de17){_0x40de17=_0x40de17||0xcc;return function(_0x33001a){if(_0x33001a){return _0x4ed8b1['sendStatus'](_0x40de17);}return _0x4ed8b1[_0x6205('0x19')](_0x40de17)[_0x6205('0x1a')]();};}function respondWithResult(_0x5764bb,_0x16bc97){_0x16bc97=_0x16bc97||0xc8;return function(_0x52bcc1){if(_0x52bcc1){return _0x5764bb['status'](_0x16bc97)['json'](_0x52bcc1);}};}function respondWithFilteredResult(_0x11deaf,_0x7ab1f1){return function(_0x6dc6d8){if(_0x6dc6d8){var _0x31b20e=_0x6dc6d8['count'],_0x9c955d=_0x7ab1f1[_0x6205('0x1b')],_0x2f865f=_0x7ab1f1['offset']+_0x7ab1f1[_0x6205('0x1c')],_0x4ad261;if(_0x2f865f>=_0x31b20e){_0x2f865f=_0x31b20e;_0x4ad261=0xc8;}else{_0x4ad261=0xce;}_0x11deaf[_0x6205('0x19')](_0x4ad261);return _0x11deaf[_0x6205('0x1d')](_0x6205('0x1e'),_0x9c955d+'-'+_0x2f865f+'/'+_0x31b20e)[_0x6205('0x1f')](_0x6dc6d8);}return null;};}function patchUpdates(_0x52d7d4){return function(_0x53883a){try{jsonpatch[_0x6205('0x20')](_0x53883a,_0x52d7d4,!![]);}catch(_0x4e12c3){return BPromise[_0x6205('0x21')](_0x4e12c3);}return _0x53883a[_0x6205('0x22')]();};}function saveUpdates(_0x517662,_0x4ddefb){return function(_0x32cece){if(_0x32cece){return _0x32cece[_0x6205('0x23')](_0x517662)['then'](function(_0x339be2){return _0x339be2;});}return null;};}function removeEntity(_0x55da51,_0x285e43){return function(_0xc2820d){if(_0xc2820d){return _0xc2820d[_0x6205('0x24')]()['then'](function(){_0x55da51[_0x6205('0x19')](0xcc)[_0x6205('0x1a')]();});}};}function handleEntityNotFound(_0x48b0ff,_0x1e3bae){return function(_0x48316e){if(!_0x48316e){_0x48b0ff[_0x6205('0x25')](0x194);}return _0x48316e;};}function handleError(_0x301279,_0x40d6dd){_0x40d6dd=_0x40d6dd||0x1f4;return function(_0x3d5308){logger[_0x6205('0x26')](_0x3d5308[_0x6205('0x27')]);if(_0x3d5308[_0x6205('0x28')]){delete _0x3d5308[_0x6205('0x28')];}_0x301279[_0x6205('0x19')](_0x40d6dd)[_0x6205('0x29')](_0x3d5308);};}exports[_0x6205('0x2a')]=function(_0x9abdaa,_0x218923){var _0x3a9ccb={},_0x5df61b={},_0x221841={'count':0x0,'rows':[]};var _0x4f5123=_[_0x6205('0x2b')](db[_0x6205('0x2c')][_0x6205('0x2d')],function(_0x268fce){return{'name':_0x268fce['fieldName'],'type':_0x268fce[_0x6205('0x2e')]['key']};});_0x5df61b['model']=_[_0x6205('0x2b')](_0x4f5123,_0x6205('0x28'));_0x5df61b['query']=_[_0x6205('0x2f')](_0x9abdaa['query']);_0x5df61b[_0x6205('0x30')]=_[_0x6205('0x31')](_0x5df61b[_0x6205('0x32')],_0x5df61b[_0x6205('0x33')]);_0x3a9ccb[_0x6205('0x34')]=_[_0x6205('0x31')](_0x5df61b[_0x6205('0x32')],qs[_0x6205('0x35')](_0x9abdaa[_0x6205('0x33')]['fields']));_0x3a9ccb[_0x6205('0x34')]=_0x3a9ccb[_0x6205('0x34')][_0x6205('0x36')]?_0x3a9ccb['attributes']:_0x5df61b['model'];if(!_0x9abdaa[_0x6205('0x33')]['hasOwnProperty']('nolimit')){_0x3a9ccb[_0x6205('0x1c')]=qs[_0x6205('0x1c')](_0x9abdaa[_0x6205('0x33')][_0x6205('0x1c')]);_0x3a9ccb['offset']=qs[_0x6205('0x1b')](_0x9abdaa[_0x6205('0x33')]['offset']);}_0x3a9ccb[_0x6205('0x37')]=qs[_0x6205('0x38')](_0x9abdaa[_0x6205('0x33')][_0x6205('0x38')]);_0x3a9ccb['where']=qs['filters'](_['pick'](_0x9abdaa[_0x6205('0x33')],_0x5df61b[_0x6205('0x30')]),_0x4f5123);if(_0x9abdaa[_0x6205('0x33')][_0x6205('0x39')]){_0x3a9ccb[_0x6205('0x3a')]=_[_0x6205('0x3b')](_0x3a9ccb[_0x6205('0x3a')],{'$or':_[_0x6205('0x2b')](_0x4f5123,function(_0x441f83){if(_0x441f83[_0x6205('0x2e')]!==_0x6205('0x3c')){var _0x2672cc={};_0x2672cc[_0x441f83[_0x6205('0x28')]]={'$like':'%'+_0x9abdaa['query'][_0x6205('0x39')]+'%'};return _0x2672cc;}})});}_0x3a9ccb=_[_0x6205('0x3b')]({},_0x3a9ccb,_0x9abdaa[_0x6205('0x3d')]);var _0x5914f0={'where':_0x3a9ccb[_0x6205('0x3a')]};return db['VoiceDialReport'][_0x6205('0x3e')](_0x5914f0)[_0x6205('0x3f')](function(_0x46ecce){_0x221841[_0x6205('0x3e')]=_0x46ecce;if(_0x9abdaa[_0x6205('0x33')][_0x6205('0x40')]){_0x3a9ccb[_0x6205('0x41')]=[{'all':!![]}];}return db[_0x6205('0x2c')][_0x6205('0x42')](_0x3a9ccb);})['then'](function(_0x312c22){_0x221841[_0x6205('0x43')]=_0x312c22;return _0x221841;})[_0x6205('0x3f')](respondWithFilteredResult(_0x218923,_0x3a9ccb))[_0x6205('0x44')](handleError(_0x218923,null));};exports[_0x6205('0x45')]=function(_0x6842c6,_0x101cd9){var _0x184dc7={'raw':!![],'where':{'id':_0x6842c6['params']['id']}},_0x1dc7ae={};_0x1dc7ae[_0x6205('0x32')]=_[_0x6205('0x2f')](db[_0x6205('0x2c')][_0x6205('0x2d')]);_0x1dc7ae[_0x6205('0x33')]=_[_0x6205('0x2f')](_0x6842c6[_0x6205('0x33')]);_0x1dc7ae[_0x6205('0x30')]=_[_0x6205('0x31')](_0x1dc7ae['model'],_0x1dc7ae['query']);_0x184dc7[_0x6205('0x34')]=_[_0x6205('0x31')](_0x1dc7ae['model'],qs[_0x6205('0x35')](_0x6842c6[_0x6205('0x33')][_0x6205('0x35')]));_0x184dc7['attributes']=_0x184dc7['attributes']['length']?_0x184dc7[_0x6205('0x34')]:_0x1dc7ae[_0x6205('0x32')];if(_0x6842c6[_0x6205('0x33')][_0x6205('0x40')]){_0x184dc7['include']=[{'all':!![]}];}_0x184dc7=_[_0x6205('0x3b')]({},_0x184dc7,_0x6842c6[_0x6205('0x3d')]);return db['VoiceDialReport'][_0x6205('0x46')](_0x184dc7)[_0x6205('0x3f')](handleEntityNotFound(_0x101cd9,null))[_0x6205('0x3f')](respondWithResult(_0x101cd9,null))[_0x6205('0x44')](handleError(_0x101cd9,null));};exports['create']=function(_0x2dfeb1,_0x967c24){return db[_0x6205('0x2c')][_0x6205('0x47')](_0x2dfeb1[_0x6205('0x48')],{})[_0x6205('0x3f')](respondWithResult(_0x967c24,0xc9))[_0x6205('0x44')](handleError(_0x967c24,null));};exports[_0x6205('0x23')]=function(_0x281a52,_0x57fa4f){if(_0x281a52[_0x6205('0x48')]['id']){delete _0x281a52[_0x6205('0x48')]['id'];}return db[_0x6205('0x2c')][_0x6205('0x46')]({'where':{'id':_0x281a52[_0x6205('0x49')]['id']}})[_0x6205('0x3f')](handleEntityNotFound(_0x57fa4f,null))[_0x6205('0x3f')](saveUpdates(_0x281a52[_0x6205('0x48')],null))[_0x6205('0x3f')](respondWithResult(_0x57fa4f,null))['catch'](handleError(_0x57fa4f,null));};exports[_0x6205('0x24')]=function(_0x55c2e5,_0x72ccb5){return db[_0x6205('0x2c')][_0x6205('0x46')]({'where':{'id':_0x55c2e5[_0x6205('0x49')]['id']}})[_0x6205('0x3f')](handleEntityNotFound(_0x72ccb5,null))['then'](removeEntity(_0x72ccb5,null))[_0x6205('0x44')](handleError(_0x72ccb5,null));};exports['describe']=function(_0x175b26,_0x4cd861){return db[_0x6205('0x2c')][_0x6205('0x4a')]()['then'](respondWithResult(_0x4cd861,null))[_0x6205('0x44')](handleError(_0x4cd861,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 198b4c2..001e475 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 _0x9313=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceDialReport.attributes','exports'];(function(_0x4f66b3,_0x58142b){var _0x250718=function(_0x16cd76){while(--_0x16cd76){_0x4f66b3['push'](_0x4f66b3['shift']());}};_0x250718(++_0x58142b);}(_0x9313,0x1e0));var _0x3931=function(_0x57072f,_0x3c53d3){_0x57072f=_0x57072f-0x0;var _0x451029=_0x9313[_0x57072f];return _0x451029;};'use strict';var _=require(_0x3931('0x0'));var util=require(_0x3931('0x1'));var logger=require(_0x3931('0x2'))(_0x3931('0x3'));var moment=require(_0x3931('0x4'));var BPromise=require('bluebird');var rp=require(_0x3931('0x5'));var fs=require('fs');var path=require(_0x3931('0x6'));var rimraf=require(_0x3931('0x7'));var config=require('../../config/environment');var attributes=require(_0x3931('0x8'));module[_0x3931('0x9')]=function(_0x3cb3a3,_0x393c8e){return _0x3cb3a3[_0x3931('0xa')](_0x3931('0xb'),attributes,{'tableName':_0x3931('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3931('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x46f7=['uniqueid','lodash','util','moment','path','rimraf','../../config/environment','exports','define','VoiceDialReport'];(function(_0x692ddc,_0x4bc11c){var _0x1924ff=function(_0x3b1e59){while(--_0x3b1e59){_0x692ddc['push'](_0x692ddc['shift']());}};_0x1924ff(++_0x4bc11c);}(_0x46f7,0x79));var _0x746f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x46f7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x746f('0x0'));var util=require(_0x746f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x746f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x746f('0x3'));var rimraf=require(_0x746f('0x4'));var config=require(_0x746f('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x746f('0x6')]=function(_0x442f30,_0xe2c23e){return _0x442f30[_0x746f('0x7')](_0x746f('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x746f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index cd609e9..3c4c9aa 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 _0xdeb3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment'];(function(_0xfe86b4,_0x238152){var _0x3b3c53=function(_0x4b7b06){while(--_0x4b7b06){_0xfe86b4['push'](_0xfe86b4['shift']());}};_0x3b3c53(++_0x238152);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var moment=require(_0x3deb('0x2'));var BPromise=require(_0x3deb('0x3'));var rs=require(_0x3deb('0x4'));var fs=require('fs');var Redis=require(_0x3deb('0x5'));var db=require(_0x3deb('0x6'))['db'];var utils=require(_0x3deb('0x7'));var logger=require(_0x3deb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x9')][_0x3deb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c8e43,_0x14846f,_0xcaaef7){return new BPromise(function(_0x5ecf47,_0x571adc){return client[_0x3deb('0xb')](_0x3c8e43,_0xcaaef7)[_0x3deb('0xc')](function(_0x30bb01){logger[_0x3deb('0xd')](_0x3deb('0xe'),_0x14846f,_0x3deb('0xf'));logger[_0x3deb('0x10')](_0x3deb('0x11'),_0x14846f,'request\x20sent',JSON['stringify'](_0x30bb01));if(_0x30bb01['error']){if(_0x30bb01[_0x3deb('0x12')]['code']===0x1f4){logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x571adc(_0x30bb01['error'][_0x3deb('0x13')]);}logger[_0x3deb('0x12')](_0x3deb('0xe'),_0x14846f,_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);return _0x5ecf47(_0x30bb01[_0x3deb('0x12')][_0x3deb('0x13')]);}else{logger[_0x3deb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x14846f,_0x3deb('0xf'));_0x5ecf47(_0x30bb01[_0x3deb('0x14')]['message']);}})[_0x3deb('0x15')](function(_0x35923e){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x14846f,_0x35923e);_0x571adc(_0x35923e);});});}exports['CreateVoiceDialReport']=function(_0x2a8ec4){var _0x2d8263=this;return new Promise(function(_0x4adbaa,_0x51e2b1){return db[_0x3deb('0x16')][_0x3deb('0x17')](_0x2a8ec4[_0x3deb('0x18')],{'raw':_0x2a8ec4[_0x3deb('0x19')]?_0x2a8ec4['options'][_0x3deb('0x1a')]===undefined?!![]:![]:!![]})[_0x3deb('0xc')](function(_0xbd82de){logger['info'](_0x3deb('0x1b'),_0x2a8ec4);logger[_0x3deb('0x10')](_0x3deb('0x1b'),_0x2a8ec4,JSON[_0x3deb('0x1c')](_0xbd82de));_0x4adbaa(_0xbd82de);})[_0x3deb('0x15')](function(_0x543014){logger[_0x3deb('0x12')](_0x3deb('0x1b'),_0x543014[_0x3deb('0x13')],_0x2a8ec4);_0x51e2b1(_0x2d8263[_0x3deb('0x12')](0x1f4,_0x543014[_0x3deb('0x13')]));});});};exports[_0x3deb('0x1d')]=function(_0x3f3d52){var _0x451ce6=this;return new Promise(function(_0x4de8ed,_0xd42d62){return db[_0x3deb('0x16')][_0x3deb('0x1e')](_0x3f3d52[_0x3deb('0x18')],{'raw':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52['options'][_0x3deb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52[_0x3deb('0x19')][_0x3deb('0x1f')]||null:null,'attributes':_0x3f3d52[_0x3deb('0x19')]?_0x3f3d52[_0x3deb('0x19')][_0x3deb('0x20')]||null:null,'limit':_0x3f3d52['options']?_0x3f3d52['options'][_0x3deb('0x21')]||null:null})['then'](function(_0x2efb59){logger[_0x3deb('0xd')](_0x3deb('0x1d'),_0x3f3d52);logger['debug'](_0x3deb('0x1d'),_0x3f3d52,JSON['stringify'](_0x2efb59));_0x4de8ed(_0x2efb59);})['catch'](function(_0x14ffa1){logger[_0x3deb('0x12')](_0x3deb('0x1d'),_0x14ffa1[_0x3deb('0x13')],_0x3f3d52);_0xd42d62(_0x451ce6['error'](0x1f4,_0x14ffa1['message']));});});}; \ No newline at end of file +var _0x5455=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateVoiceDialReport','options','raw','VoiceDialReport','update','body','attributes','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x408af6,_0x39dfd8){var _0x25eef7=function(_0x47c945){while(--_0x47c945){_0x408af6['push'](_0x408af6['shift']());}};_0x25eef7(++_0x39dfd8);}(_0x5455,0x197));var _0x5545=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5455[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var moment=require(_0x5545('0x1'));var BPromise=require(_0x5545('0x2'));var rs=require(_0x5545('0x3'));var fs=require('fs');var Redis=require(_0x5545('0x4'));var db=require(_0x5545('0x5'))['db'];var utils=require(_0x5545('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5545('0x7'));var jayson=require(_0x5545('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ea57f,_0x5d69d3,_0x5c2476){return new BPromise(function(_0x9cbb0d,_0x36f3b9){return client['request'](_0x2ea57f,_0x5c2476)[_0x5545('0x9')](function(_0xbf37f){logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));logger[_0x5545('0xd')](_0x5545('0xe'),_0x5d69d3,_0x5545('0xc'),JSON[_0x5545('0xf')](_0xbf37f));if(_0xbf37f['error']){if(_0xbf37f['error'][_0x5545('0x10')]===0x1f4){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')]['message']);return _0x36f3b9(_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);}logger['error'](_0x5545('0xb'),_0x5d69d3,_0xbf37f[_0x5545('0x11')][_0x5545('0x12')]);return _0x9cbb0d(_0xbf37f[_0x5545('0x11')]['message']);}else{logger[_0x5545('0xa')](_0x5545('0xb'),_0x5d69d3,_0x5545('0xc'));_0x9cbb0d(_0xbf37f[_0x5545('0x13')][_0x5545('0x12')]);}})[_0x5545('0x14')](function(_0xf9256c){logger[_0x5545('0x11')](_0x5545('0xb'),_0x5d69d3,_0xf9256c);_0x36f3b9(_0xf9256c);});});}exports[_0x5545('0x15')]=function(_0x3a012e){var _0x373f92=this;return new Promise(function(_0x5f0e6f,_0x3a288d){return db['VoiceDialReport']['create'](_0x3a012e['body'],{'raw':_0x3a012e['options']?_0x3a012e[_0x5545('0x16')][_0x5545('0x17')]===undefined?!![]:![]:!![]})[_0x5545('0x9')](function(_0x58d53d){logger[_0x5545('0xa')](_0x5545('0x15'),_0x3a012e);logger[_0x5545('0xd')](_0x5545('0x15'),_0x3a012e,JSON['stringify'](_0x58d53d));_0x5f0e6f(_0x58d53d);})[_0x5545('0x14')](function(_0x2c2d9e){logger['error']('CreateVoiceDialReport',_0x2c2d9e[_0x5545('0x12')],_0x3a012e);_0x3a288d(_0x373f92[_0x5545('0x11')](0x1f4,_0x2c2d9e[_0x5545('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0xf3e8f4){var _0x458791=this;return new Promise(function(_0x3ae9f1,_0x4a2420){return db[_0x5545('0x18')][_0x5545('0x19')](_0xf3e8f4[_0x5545('0x1a')],{'raw':_0xf3e8f4['options']?_0xf3e8f4['options'][_0x5545('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf3e8f4[_0x5545('0x16')]?_0xf3e8f4[_0x5545('0x16')]['where']||null:null,'attributes':_0xf3e8f4[_0x5545('0x16')]?_0xf3e8f4['options'][_0x5545('0x1b')]||null:null,'limit':_0xf3e8f4[_0x5545('0x16')]?_0xf3e8f4[_0x5545('0x16')][_0x5545('0x1c')]||null:null})['then'](function(_0x198667){logger[_0x5545('0xa')](_0x5545('0x1d'),_0xf3e8f4);logger[_0x5545('0xd')](_0x5545('0x1d'),_0xf3e8f4,JSON['stringify'](_0x198667));_0x3ae9f1(_0x198667);})[_0x5545('0x14')](function(_0x196be4){logger['error'](_0x5545('0x1d'),_0x196be4[_0x5545('0x12')],_0xf3e8f4);_0x4a2420(_0x458791[_0x5545('0x11')](0x1f4,_0x196be4[_0x5545('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7146521..eda4061 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 _0x5b43=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','post','create','/:id/applications','addApplications','put','update','delete','/:id','destroy','exports','util','connect-timeout','express'];(function(_0x2ed19f,_0x25786e){var _0x2f7f8a=function(_0x162e0d){while(--_0x162e0d){_0x2ed19f['push'](_0x2ed19f['shift']());}};_0x2f7f8a(++_0x25786e);}(_0x5b43,0x11a));var _0x35b4=function(_0x324a5c,_0x3ab147){_0x324a5c=_0x324a5c-0x0;var _0x161e86=_0x5b43[_0x324a5c];return _0x161e86;};'use strict';var multer=require('multer');var util=require(_0x35b4('0x0'));var path=require('path');var timeout=require(_0x35b4('0x1'));var express=require(_0x35b4('0x2'));var router=express['Router']();var auth=require(_0x35b4('0x3'));var interaction=require(_0x35b4('0x4'));var config=require('../../config/environment');var controller=require(_0x35b4('0x5'));router['get']('/',auth[_0x35b4('0x6')](),controller[_0x35b4('0x7')]);router[_0x35b4('0x8')]('/:id',auth[_0x35b4('0x6')](),controller['show']);router[_0x35b4('0x9')]('/',auth[_0x35b4('0x6')](),controller[_0x35b4('0xa')]);router[_0x35b4('0x9')](_0x35b4('0xb'),auth[_0x35b4('0x6')](),controller[_0x35b4('0xc')]);router[_0x35b4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x35b4('0xe')]);router[_0x35b4('0xf')](_0x35b4('0x10'),auth[_0x35b4('0x6')](),controller[_0x35b4('0x11')]);module[_0x35b4('0x12')]=router; \ No newline at end of file +var _0x1134=['index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated'];(function(_0x483a32,_0x3b7fb0){var _0xd11451=function(_0x200ace){while(--_0x200ace){_0x483a32['push'](_0x483a32['shift']());}};_0xd11451(++_0x3b7fb0);}(_0x1134,0x1c4));var _0x4113=function(_0x4cee26,_0x4dac63){_0x4cee26=_0x4cee26-0x0;var _0xde9db3=_0x1134[_0x4cee26];return _0xde9db3;};'use strict';var multer=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var path=require(_0x4113('0x2'));var timeout=require(_0x4113('0x3'));var express=require(_0x4113('0x4'));var router=express[_0x4113('0x5')]();var auth=require(_0x4113('0x6'));var interaction=require(_0x4113('0x7'));var config=require('../../config/environment');var controller=require(_0x4113('0x8'));router['get']('/',auth[_0x4113('0x9')](),controller[_0x4113('0xa')]);router['get'](_0x4113('0xb'),auth[_0x4113('0x9')](),controller[_0x4113('0xc')]);router[_0x4113('0xd')]('/',auth[_0x4113('0x9')](),controller[_0x4113('0xe')]);router[_0x4113('0xd')](_0x4113('0xf'),auth[_0x4113('0x9')](),controller[_0x4113('0x10')]);router[_0x4113('0x11')](_0x4113('0xb'),auth[_0x4113('0x9')](),controller[_0x4113('0x12')]);router[_0x4113('0x13')](_0x4113('0xb'),auth[_0x4113('0x9')](),controller[_0x4113('0x14')]);module[_0x4113('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 917eaaf..1ffd4a8 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(_0x38b9b1,_0x49d83a){var _0x53714a=function(_0x563a49){while(--_0x563a49){_0x38b9b1['push'](_0x38b9b1['shift']());}};_0x53714a(++_0x49d83a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x8e1a06,_0x2035f9){var _0x169a32=function(_0x503061){while(--_0x503061){_0x8e1a06['push'](_0x8e1a06['shift']());}};_0x169a32(++_0x2035f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 b1e4f60..488c7f8 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 _0x524e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','find','type','name','destroy','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','show','params','catch','create','startsWith','body','exten','concat','user'];(function(_0x2cecec,_0xb41fa4){var _0x5c5054=function(_0xceb234){while(--_0xceb234){_0x2cecec['push'](_0x2cecec['shift']());}};_0x5c5054(++_0xb41fa4);}(_0x524e,0x15e));var _0xe524=function(_0x39aa47,_0x4fb2f1){_0x39aa47=_0x39aa47-0x0;var _0x16696e=_0x524e[_0x39aa47];return _0x16696e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];config[_0xe524('0x1c')]=_['defaults'](config['redis'],{'host':_0xe524('0x1d'),'port':0x18eb});var socket=require(_0xe524('0x1e'))(new Redis(config[_0xe524('0x1c')]));require(_0xe524('0x1f'))[_0xe524('0x20')](socket);function respondWithStatusCode(_0x57c1b6,_0x12ff75){_0x12ff75=_0x12ff75||0xcc;return function(_0x51e9fe){if(_0x51e9fe){return _0x57c1b6[_0xe524('0x21')](_0x12ff75);}return _0x57c1b6[_0xe524('0x22')](_0x12ff75)['end']();};}function respondWithResult(_0x569660,_0x488fce){_0x488fce=_0x488fce||0xc8;return function(_0x109795){if(_0x109795){return _0x569660['status'](_0x488fce)[_0xe524('0x23')](_0x109795);}};}function respondWithFilteredResult(_0x5f17fe,_0x5c8736){return function(_0x5a5c0d){if(_0x5a5c0d){var _0x3a4027=_0x5a5c0d[_0xe524('0x24')],_0x4f1dfb=_0x5c8736[_0xe524('0x25')],_0x11b2a1=_0x5c8736['offset']+_0x5c8736[_0xe524('0x26')],_0x238f8f;if(_0x11b2a1>=_0x3a4027){_0x11b2a1=_0x3a4027;_0x238f8f=0xc8;}else{_0x238f8f=0xce;}_0x5f17fe[_0xe524('0x22')](_0x238f8f);return _0x5f17fe['set'](_0xe524('0x27'),_0x4f1dfb+'-'+_0x11b2a1+'/'+_0x3a4027)[_0xe524('0x23')](_0x5a5c0d);}return null;};}function patchUpdates(_0x43a4f9){return function(_0x1dcc0f){try{jsonpatch[_0xe524('0x28')](_0x1dcc0f,_0x43a4f9,!![]);}catch(_0x1cab6c){return BPromise[_0xe524('0x29')](_0x1cab6c);}return _0x1dcc0f[_0xe524('0x2a')]();};}function saveUpdates(_0x7dfe97,_0x5c4d21){return function(_0x7d1f92){if(_0x7d1f92){return _0x7d1f92['update'](_0x7dfe97)['then'](function(_0x2d2f83){return _0x2d2f83;});}return null;};}function removeEntity(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(_0x85fc51){return _0x85fc51['destroy']()[_0xe524('0x2b')](function(){var _0x4a03bc=_0x85fc51[_0xe524('0x2c')]({'plain':!![]});var _0xcf5db=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e'),'ignore':![]},{'name':_0xe524('0x2f'),'value':_0xe524('0x30'),'ignore':![]},{'name':_0xe524('0x31'),'value':'internal','ignore':![]}];var _0x58a896=_(_0xcf5db)[_0xe524('0x32')](_0xe524('0x33'))[_0xe524('0x34')](_0xe524('0x35'))[_0xe524('0x35')]();if(_['includes'](_0x58a896,_0x4a03bc['type'])){return;}var _0x4b1ff=_[_0xe524('0x36')](_0xcf5db,[_0xe524('0x35'),_0x4a03bc[_0xe524('0x37')]])[_0xe524('0x38')];return db['UserProfileResource'][_0xe524('0x39')]({'where':{'type':_0x4b1ff,'resourceId':_0x4a03bc['id']}})[_0xe524('0x2b')](function(){return _0x85fc51;});})['then'](function(){_0x23df5e['status'](0xcc)[_0xe524('0x3a')]();});}};}function handleEntityNotFound(_0x376324,_0x5b2fc3){return function(_0x31d4a7){if(!_0x31d4a7){_0x376324['sendStatus'](0x194);}return _0x31d4a7;};}function handleError(_0x3fec06,_0x54af2a){_0x54af2a=_0x54af2a||0x1f4;return function(_0x315e56){logger[_0xe524('0x3b')](_0x315e56[_0xe524('0x3c')]);if(_0x315e56['name']){delete _0x315e56[_0xe524('0x38')];}_0x3fec06['status'](_0x54af2a)[_0xe524('0x3d')](_0x315e56);};}exports[_0xe524('0x3e')]=function(_0x276343,_0x502256){var _0x16e124={},_0x119cc3={},_0x49c43e={'count':0x0,'rows':[]};var _0x27817e=_[_0xe524('0x34')](db[_0xe524('0x3f')][_0xe524('0x40')],function(_0x53560d){return{'name':_0x53560d[_0xe524('0x41')],'type':_0x53560d[_0xe524('0x37')][_0xe524('0x42')]};});_0x119cc3[_0xe524('0x43')]=_[_0xe524('0x34')](_0x27817e,_0xe524('0x38'));_0x119cc3[_0xe524('0x44')]=_[_0xe524('0x45')](_0x276343['query']);_0x119cc3[_0xe524('0x46')]=_['intersection'](_0x119cc3[_0xe524('0x43')],_0x119cc3[_0xe524('0x44')]);_0x16e124['attributes']=_[_0xe524('0x47')](_0x119cc3['model'],qs[_0xe524('0x48')](_0x276343[_0xe524('0x44')][_0xe524('0x48')]));_0x16e124[_0xe524('0x49')]=_0x16e124[_0xe524('0x49')][_0xe524('0x4a')]?_0x16e124[_0xe524('0x49')]:_0x119cc3[_0xe524('0x43')];if(!_0x276343['query'][_0xe524('0x4b')](_0xe524('0x4c'))){_0x16e124[_0xe524('0x26')]=qs[_0xe524('0x26')](_0x276343[_0xe524('0x44')][_0xe524('0x26')]);_0x16e124[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x276343['query'][_0xe524('0x25')]);}_0x16e124[_0xe524('0x4d')]=qs[_0xe524('0x4e')](_0x276343['query'][_0xe524('0x4e')]);_0x16e124['where']=qs[_0xe524('0x46')](_[_0xe524('0x4f')](_0x276343[_0xe524('0x44')],_0x119cc3[_0xe524('0x46')]),_0x27817e);if(_0x276343[_0xe524('0x44')][_0xe524('0x32')]){_0x16e124[_0xe524('0x50')]=_['merge'](_0x16e124[_0xe524('0x50')],{'$or':_[_0xe524('0x34')](_0x27817e,function(_0x13c54c){if(_0x13c54c[_0xe524('0x37')]!==_0xe524('0x51')){var _0x1ae283={};_0x1ae283[_0x13c54c['name']]={'$like':'%'+_0x276343[_0xe524('0x44')][_0xe524('0x32')]+'%'};return _0x1ae283;}})});}_0x16e124=_[_0xe524('0x52')]({},_0x16e124,_0x276343['options']);var _0x21ea32={'where':_0x16e124['where']};return db['VoiceExtension'][_0xe524('0x24')](_0x21ea32)[_0xe524('0x2b')](function(_0x4da26f){_0x49c43e[_0xe524('0x24')]=_0x4da26f;if(_0x276343[_0xe524('0x44')][_0xe524('0x53')]){_0x16e124[_0xe524('0x54')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x16e124);})[_0xe524('0x2b')](function(_0x10aad6){_0x49c43e['rows']=_0x10aad6;return _0x49c43e;})[_0xe524('0x2b')](respondWithFilteredResult(_0x502256,_0x16e124))['catch'](handleError(_0x502256,null));};exports[_0xe524('0x55')]=function(_0x181680,_0x462b87){var _0x312c47={'raw':![],'where':{'id':_0x181680[_0xe524('0x56')]['id']}},_0xbde17b={};_0xbde17b[_0xe524('0x43')]=_[_0xe524('0x45')](db[_0xe524('0x3f')][_0xe524('0x40')]);_0xbde17b[_0xe524('0x44')]=_[_0xe524('0x45')](_0x181680[_0xe524('0x44')]);_0xbde17b[_0xe524('0x46')]=_[_0xe524('0x47')](_0xbde17b['model'],_0xbde17b[_0xe524('0x44')]);_0x312c47['attributes']=_['intersection'](_0xbde17b[_0xe524('0x43')],qs['fields'](_0x181680[_0xe524('0x44')][_0xe524('0x48')]));_0x312c47['attributes']=_0x312c47[_0xe524('0x49')]['length']?_0x312c47['attributes']:_0xbde17b[_0xe524('0x43')];if(_0x181680[_0xe524('0x44')][_0xe524('0x53')]){_0x312c47['include']=[{'all':!![]}];}_0x312c47=_['merge']({},_0x312c47,_0x181680['options']);return db['VoiceExtension']['find'](_0x312c47)['then'](handleEntityNotFound(_0x462b87,null))[_0xe524('0x2b')](respondWithResult(_0x462b87,null))[_0xe524('0x57')](handleError(_0x462b87,null));};exports['destroy']=function(_0x465fb5,_0x40b871){return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x465fb5[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x40b871,null))[_0xe524('0x2b')](removeEntity(_0x40b871,null))[_0xe524('0x57')](handleError(_0x40b871,null));};exports[_0xe524('0x58')]=function(_0x494c39,_0x24f65b){if(_0x494c39['body'][_0xe524('0x37')]===_0xe524('0x30')&&!_[_0xe524('0x59')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')],'_')){_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]='_'[_0xe524('0x5c')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]);}return db[_0xe524('0x3f')][_0xe524('0x58')](_0x494c39['body'],{'raw':![]})['then'](function(_0x4831fa){var _0xe49f84=_0x494c39[_0xe524('0x5d')][_0xe524('0x2c')]({'plain':!![]});if(!_0xe49f84)throw new Error(_0xe524('0x5e'));if(_0xe49f84[_0xe524('0x5f')]===_0xe524('0x5d')){var _0x33ae9d=_0x4831fa[_0xe524('0x2c')]({'plain':!![]});var _0x1e9006=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e')},{'name':'OutboundRoutes','value':_0xe524('0x30')},{'name':_0xe524('0x31'),'value':'internal'}];var _0x53da86=_['find'](_0x1e9006,['value',_0x33ae9d[_0xe524('0x37')]])[_0xe524('0x38')];return db[_0xe524('0x60')][_0xe524('0x36')]({'where':{'name':_0x53da86,'userProfileId':_0xe49f84['userProfileId']},'raw':!![]})[_0xe524('0x2b')](function(_0x244f08){if(_0x244f08&&_0x244f08[_0xe524('0x61')]===0x0){return db[_0xe524('0x62')]['create']({'name':_0x33ae9d['name'],'resourceId':_0x33ae9d['id'],'type':_0x244f08['name'],'sectionId':_0x244f08['id']},{})[_0xe524('0x2b')](function(){return _0x4831fa;});}else{return _0x4831fa;}})['catch'](function(_0x357418){logger[_0xe524('0x3b')](_0xe524('0x63'),_0x357418);throw _0x357418;});}return _0x4831fa;})[_0xe524('0x2b')](respondWithResult(_0x24f65b,0xc9))[_0xe524('0x57')](handleError(_0x24f65b,null));};exports['update']=function(_0x5d0507,_0x29a519){if(_0x5d0507[_0xe524('0x5a')]['id']){delete _0x5d0507[_0xe524('0x5a')]['id'];}return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x5d0507[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x29a519,null))[_0xe524('0x2b')](function(_0x26160b){if(_0x26160b){return db[_0xe524('0x3f')]['update'](_[_0xe524('0x4f')](_0x5d0507[_0xe524('0x5a')],[_0xe524('0x5b'),'context','description',_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66')]),{'where':{'context':_0x26160b[_0xe524('0x67')],'exten':_0x26160b[_0xe524('0x5b')]},'individualHooks':!![]})['then'](function(_0xe102a0){return _0xe102a0;});}return null;})[_0xe524('0x2b')](respondWithStatusCode(_0x29a519,null))[_0xe524('0x57')](handleError(_0x29a519,null));};exports[_0xe524('0x68')]=function(_0x3ce098,_0x22d06a,_0x35e6b2){return db[_0xe524('0x3f')][_0xe524('0x69')]({'where':{'id':_0x3ce098[_0xe524('0x56')]['id']}})[_0xe524('0x2b')](handleEntityNotFound(_0x22d06a,null))['then'](function(_0x3cf9c2){if(_0x3cf9c2){return db[_0xe524('0x6a')][_0xe524('0x6b')](function(_0xfed246){return db[_0xe524('0x3f')]['destroy']({'where':{'VoiceExtensionId':_0x3ce098[_0xe524('0x56')]['id']},'transaction':_0xfed246})[_0xe524('0x2b')](function(_0x2ea4c9){var _0x32d11a=_[_0xe524('0x34')](_0x3ce098[_0xe524('0x5a')],function(_0x2a09f5){_0x2a09f5['VoiceExtensionId']=_0x3ce098[_0xe524('0x56')]['id'];return _0x2a09f5;});return db[_0xe524('0x3f')][_0xe524('0x6c')](_0x32d11a,{'transaction':_0xfed246});});})[_0xe524('0x2b')](function(){return db['VoiceExtension'][_0xe524('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ce098['params']['id']},'order':_0xe524('0x6e')});});}})[_0xe524('0x2b')](respondWithResult(_0x22d06a,null))[_0xe524('0x57')](handleError(_0x22d06a,null));}; \ No newline at end of file +var _0xba34=['inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','length','include','create','body','outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','context','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','get','InboundRoutes'];(function(_0x5e7057,_0x4fa7f9){var _0x2a0003=function(_0x54c846){while(--_0x54c846){_0x5e7057['push'](_0x5e7057['shift']());}};_0x2a0003(++_0x4fa7f9);}(_0xba34,0x119));var _0x4ba3=function(_0x5ee53c,_0x1eb0df){_0x5ee53c=_0x5ee53c-0x0;var _0x4d0af5=_0xba34[_0x5ee53c];return _0x4d0af5;};'use strict';var pdf=require(_0x4ba3('0x0'));var emlformat=require(_0x4ba3('0x1'));var rimraf=require(_0x4ba3('0x2'));var zipdir=require(_0x4ba3('0x3'));var jsonpatch=require(_0x4ba3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ba3('0x5'));var util=require(_0x4ba3('0x6'));var path=require(_0x4ba3('0x7'));var sox=require(_0x4ba3('0x8'));var csv=require(_0x4ba3('0x9'));var ejs=require(_0x4ba3('0xa'));var fs=require('fs');var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x9'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var db=require(_0x4ba3('0x18'))['db'];config['redis']=_[_0x4ba3('0x19')](config['redis'],{'host':_0x4ba3('0x1a'),'port':0x18eb});var socket=require(_0x4ba3('0x1b'))(new Redis(config[_0x4ba3('0x1c')]));require(_0x4ba3('0x1d'))[_0x4ba3('0x1e')](socket);function respondWithStatusCode(_0x3d2ace,_0x3a74f7){_0x3a74f7=_0x3a74f7||0xcc;return function(_0x12ac90){if(_0x12ac90){return _0x3d2ace[_0x4ba3('0x1f')](_0x3a74f7);}return _0x3d2ace[_0x4ba3('0x20')](_0x3a74f7)[_0x4ba3('0x21')]();};}function respondWithResult(_0x301359,_0x29a9d1){_0x29a9d1=_0x29a9d1||0xc8;return function(_0x25f584){if(_0x25f584){return _0x301359[_0x4ba3('0x20')](_0x29a9d1)[_0x4ba3('0x22')](_0x25f584);}};}function respondWithFilteredResult(_0x58d20a,_0x382fd0){return function(_0x788277){if(_0x788277){var _0x5ff7ce=_0x788277[_0x4ba3('0x23')],_0x451c92=_0x382fd0[_0x4ba3('0x24')],_0x556290=_0x382fd0[_0x4ba3('0x24')]+_0x382fd0[_0x4ba3('0x25')],_0x2519bb;if(_0x556290>=_0x5ff7ce){_0x556290=_0x5ff7ce;_0x2519bb=0xc8;}else{_0x2519bb=0xce;}_0x58d20a[_0x4ba3('0x20')](_0x2519bb);return _0x58d20a['set']('Content-Range',_0x451c92+'-'+_0x556290+'/'+_0x5ff7ce)[_0x4ba3('0x22')](_0x788277);}return null;};}function patchUpdates(_0x579d9f){return function(_0x18dff5){try{jsonpatch[_0x4ba3('0x26')](_0x18dff5,_0x579d9f,!![]);}catch(_0x413bb3){return BPromise[_0x4ba3('0x27')](_0x413bb3);}return _0x18dff5[_0x4ba3('0x28')]();};}function saveUpdates(_0x278a23,_0x4a0823){return function(_0x143c78){if(_0x143c78){return _0x143c78[_0x4ba3('0x29')](_0x278a23)['then'](function(_0x28bb3d){return _0x28bb3d;});}return null;};}function removeEntity(_0x4ffe39,_0x1ae4de){return function(_0x18abb3){if(_0x18abb3){return _0x18abb3[_0x4ba3('0x2a')]()[_0x4ba3('0x2b')](function(){var _0x152e41=_0x18abb3[_0x4ba3('0x2c')]({'plain':!![]});var _0x159596=[{'name':_0x4ba3('0x2d'),'value':_0x4ba3('0x2e'),'ignore':![]},{'name':_0x4ba3('0x2f'),'value':'outbound','ignore':![]},{'name':_0x4ba3('0x30'),'value':_0x4ba3('0x31'),'ignore':![]}];var _0x2311ed=_(_0x159596)['filter'](_0x4ba3('0x32'))[_0x4ba3('0x33')](_0x4ba3('0x34'))['value']();if(_[_0x4ba3('0x35')](_0x2311ed,_0x152e41[_0x4ba3('0x36')])){return;}var _0x34ecb4=_[_0x4ba3('0x37')](_0x159596,['value',_0x152e41['type']])[_0x4ba3('0x38')];return db[_0x4ba3('0x39')][_0x4ba3('0x2a')]({'where':{'type':_0x34ecb4,'resourceId':_0x152e41['id']}})[_0x4ba3('0x2b')](function(){return _0x18abb3;});})[_0x4ba3('0x2b')](function(){_0x4ffe39[_0x4ba3('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27444b,_0x28f36c){return function(_0x24d8fc){if(!_0x24d8fc){_0x27444b[_0x4ba3('0x1f')](0x194);}return _0x24d8fc;};}function handleError(_0x2a6757,_0x1a7a2c){_0x1a7a2c=_0x1a7a2c||0x1f4;return function(_0x457236){logger[_0x4ba3('0x3a')](_0x457236[_0x4ba3('0x3b')]);if(_0x457236[_0x4ba3('0x38')]){delete _0x457236['name'];}_0x2a6757['status'](_0x1a7a2c)['send'](_0x457236);};}exports[_0x4ba3('0x3c')]=function(_0xd033d7,_0x41b4eb){var _0x4372cb={},_0x3eea33={},_0x137f9b={'count':0x0,'rows':[]};var _0x137551=_[_0x4ba3('0x33')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')],function(_0x437a20){return{'name':_0x437a20[_0x4ba3('0x3f')],'type':_0x437a20['type'][_0x4ba3('0x40')]};});_0x3eea33[_0x4ba3('0x41')]=_[_0x4ba3('0x33')](_0x137551,'name');_0x3eea33[_0x4ba3('0x42')]=_['keys'](_0xd033d7[_0x4ba3('0x42')]);_0x3eea33[_0x4ba3('0x43')]=_[_0x4ba3('0x44')](_0x3eea33[_0x4ba3('0x41')],_0x3eea33[_0x4ba3('0x42')]);_0x4372cb[_0x4ba3('0x45')]=_['intersection'](_0x3eea33[_0x4ba3('0x41')],qs[_0x4ba3('0x46')](_0xd033d7[_0x4ba3('0x42')]['fields']));_0x4372cb[_0x4ba3('0x45')]=_0x4372cb[_0x4ba3('0x45')]['length']?_0x4372cb[_0x4ba3('0x45')]:_0x3eea33['model'];if(!_0xd033d7['query'][_0x4ba3('0x47')](_0x4ba3('0x48'))){_0x4372cb[_0x4ba3('0x25')]=qs[_0x4ba3('0x25')](_0xd033d7[_0x4ba3('0x42')]['limit']);_0x4372cb[_0x4ba3('0x24')]=qs[_0x4ba3('0x24')](_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x24')]);}_0x4372cb[_0x4ba3('0x49')]=qs[_0x4ba3('0x4a')](_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x4a')]);_0x4372cb['where']=qs[_0x4ba3('0x43')](_[_0x4ba3('0x4b')](_0xd033d7[_0x4ba3('0x42')],_0x3eea33[_0x4ba3('0x43')]),_0x137551);if(_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x4c')]){_0x4372cb[_0x4ba3('0x4d')]=_[_0x4ba3('0x4e')](_0x4372cb[_0x4ba3('0x4d')],{'$or':_[_0x4ba3('0x33')](_0x137551,function(_0x3b9a0a){if(_0x3b9a0a[_0x4ba3('0x36')]!==_0x4ba3('0x4f')){var _0x28b649={};_0x28b649[_0x3b9a0a['name']]={'$like':'%'+_0xd033d7['query']['filter']+'%'};return _0x28b649;}})});}_0x4372cb=_['merge']({},_0x4372cb,_0xd033d7['options']);var _0x1df753={'where':_0x4372cb['where']};return db[_0x4ba3('0x3d')]['count'](_0x1df753)[_0x4ba3('0x2b')](function(_0x2ac317){_0x137f9b[_0x4ba3('0x23')]=_0x2ac317;if(_0xd033d7[_0x4ba3('0x42')][_0x4ba3('0x50')]){_0x4372cb['include']=[{'all':!![]}];}return db[_0x4ba3('0x3d')]['findAll'](_0x4372cb);})[_0x4ba3('0x2b')](function(_0x50f27a){_0x137f9b[_0x4ba3('0x51')]=_0x50f27a;return _0x137f9b;})[_0x4ba3('0x2b')](respondWithFilteredResult(_0x41b4eb,_0x4372cb))[_0x4ba3('0x52')](handleError(_0x41b4eb,null));};exports[_0x4ba3('0x53')]=function(_0xc23afe,_0xb5b940){var _0x1e8e96={'raw':![],'where':{'id':_0xc23afe[_0x4ba3('0x54')]['id']}},_0x5d5714={};_0x5d5714[_0x4ba3('0x41')]=_[_0x4ba3('0x55')](db[_0x4ba3('0x3d')][_0x4ba3('0x3e')]);_0x5d5714['query']=_['keys'](_0xc23afe[_0x4ba3('0x42')]);_0x5d5714[_0x4ba3('0x43')]=_[_0x4ba3('0x44')](_0x5d5714['model'],_0x5d5714[_0x4ba3('0x42')]);_0x1e8e96[_0x4ba3('0x45')]=_[_0x4ba3('0x44')](_0x5d5714['model'],qs['fields'](_0xc23afe[_0x4ba3('0x42')]['fields']));_0x1e8e96[_0x4ba3('0x45')]=_0x1e8e96[_0x4ba3('0x45')][_0x4ba3('0x56')]?_0x1e8e96[_0x4ba3('0x45')]:_0x5d5714[_0x4ba3('0x41')];if(_0xc23afe[_0x4ba3('0x42')]['includeAll']){_0x1e8e96[_0x4ba3('0x57')]=[{'all':!![]}];}_0x1e8e96=_[_0x4ba3('0x4e')]({},_0x1e8e96,_0xc23afe['options']);return db[_0x4ba3('0x3d')][_0x4ba3('0x37')](_0x1e8e96)[_0x4ba3('0x2b')](handleEntityNotFound(_0xb5b940,null))[_0x4ba3('0x2b')](respondWithResult(_0xb5b940,null))[_0x4ba3('0x52')](handleError(_0xb5b940,null));};exports['destroy']=function(_0x37a312,_0x38de05){return db['VoiceExtension'][_0x4ba3('0x37')]({'where':{'id':_0x37a312[_0x4ba3('0x54')]['id']}})[_0x4ba3('0x2b')](handleEntityNotFound(_0x38de05,null))[_0x4ba3('0x2b')](removeEntity(_0x38de05,null))[_0x4ba3('0x52')](handleError(_0x38de05,null));};exports[_0x4ba3('0x58')]=function(_0x45dae5,_0x1ab3fe){if(_0x45dae5[_0x4ba3('0x59')][_0x4ba3('0x36')]===_0x4ba3('0x5a')&&!_[_0x4ba3('0x5b')](_0x45dae5[_0x4ba3('0x59')][_0x4ba3('0x5c')],'_')){_0x45dae5[_0x4ba3('0x59')]['exten']='_'['concat'](_0x45dae5['body'][_0x4ba3('0x5c')]);}return db[_0x4ba3('0x3d')][_0x4ba3('0x58')](_0x45dae5[_0x4ba3('0x59')],{'raw':![]})[_0x4ba3('0x2b')](function(_0x57e25a){var _0x3920c0=_0x45dae5[_0x4ba3('0x5d')][_0x4ba3('0x2c')]({'plain':!![]});if(!_0x3920c0)throw new Error(_0x4ba3('0x5e'));if(_0x3920c0[_0x4ba3('0x5f')]===_0x4ba3('0x5d')){var _0xd2327c=_0x57e25a[_0x4ba3('0x2c')]({'plain':!![]});var _0x37a0a0=[{'name':_0x4ba3('0x2d'),'value':_0x4ba3('0x2e')},{'name':_0x4ba3('0x2f'),'value':_0x4ba3('0x5a')},{'name':_0x4ba3('0x30'),'value':'internal'}];var _0x20c849=_[_0x4ba3('0x37')](_0x37a0a0,[_0x4ba3('0x34'),_0xd2327c[_0x4ba3('0x36')]])[_0x4ba3('0x38')];return db[_0x4ba3('0x60')][_0x4ba3('0x37')]({'where':{'name':_0x20c849,'userProfileId':_0x3920c0[_0x4ba3('0x61')]},'raw':!![]})['then'](function(_0x8ea419){if(_0x8ea419&&_0x8ea419[_0x4ba3('0x62')]===0x0){return db[_0x4ba3('0x39')]['create']({'name':_0xd2327c[_0x4ba3('0x38')],'resourceId':_0xd2327c['id'],'type':_0x8ea419['name'],'sectionId':_0x8ea419['id']},{})[_0x4ba3('0x2b')](function(){return _0x57e25a;});}else{return _0x57e25a;}})[_0x4ba3('0x52')](function(_0x33ee10){logger[_0x4ba3('0x3a')](_0x4ba3('0x63'),_0x33ee10);throw _0x33ee10;});}return _0x57e25a;})['then'](respondWithResult(_0x1ab3fe,0xc9))[_0x4ba3('0x52')](handleError(_0x1ab3fe,null));};exports[_0x4ba3('0x29')]=function(_0x2a48fe,_0x65890d){if(_0x2a48fe[_0x4ba3('0x59')]['id']){delete _0x2a48fe['body']['id'];}return db[_0x4ba3('0x3d')][_0x4ba3('0x37')]({'where':{'id':_0x2a48fe[_0x4ba3('0x54')]['id']}})[_0x4ba3('0x2b')](handleEntityNotFound(_0x65890d,null))[_0x4ba3('0x2b')](function(_0x4070cd){if(_0x4070cd){return db[_0x4ba3('0x3d')][_0x4ba3('0x29')](_[_0x4ba3('0x4b')](_0x2a48fe[_0x4ba3('0x59')],[_0x4ba3('0x5c'),'context',_0x4ba3('0x64'),_0x4ba3('0x65'),'cutdigits','mandatoryDisposition']),{'where':{'context':_0x4070cd[_0x4ba3('0x66')],'exten':_0x4070cd[_0x4ba3('0x5c')]},'individualHooks':!![]})['then'](function(_0x220c83){return _0x220c83;});}return null;})[_0x4ba3('0x2b')](respondWithStatusCode(_0x65890d,null))[_0x4ba3('0x52')](handleError(_0x65890d,null));};exports['addApplications']=function(_0x1f5815,_0x46224,_0x1af489){return db[_0x4ba3('0x3d')][_0x4ba3('0x67')]({'where':{'id':_0x1f5815[_0x4ba3('0x54')]['id']}})['then'](handleEntityNotFound(_0x46224,null))[_0x4ba3('0x2b')](function(_0x2c0408){if(_0x2c0408){return db[_0x4ba3('0x68')]['transaction'](function(_0x3de990){return db[_0x4ba3('0x3d')][_0x4ba3('0x2a')]({'where':{'VoiceExtensionId':_0x1f5815[_0x4ba3('0x54')]['id']},'transaction':_0x3de990})[_0x4ba3('0x2b')](function(_0x2d75a3){var _0x1db4f1=_[_0x4ba3('0x33')](_0x1f5815['body'],function(_0x540f5c){_0x540f5c[_0x4ba3('0x69')]=_0x1f5815['params']['id'];return _0x540f5c;});return db[_0x4ba3('0x3d')][_0x4ba3('0x6a')](_0x1db4f1,{'transaction':_0x3de990});});})[_0x4ba3('0x2b')](function(){return db['VoiceExtension'][_0x4ba3('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f5815[_0x4ba3('0x54')]['id']},'order':_0x4ba3('0x6c')});});}})['then'](respondWithResult(_0x46224,null))[_0x4ba3('0x52')](handleError(_0x46224,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ff205e0..b321b36 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 _0x6aba=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x6aba,0x152));var _0xa6ab=function(_0x532bf7,_0x304edf){_0x532bf7=_0x532bf7-0x0;var _0xa16444=_0x6aba[_0x532bf7];return _0xa16444;};'use strict';var EventEmitter=require(_0xa6ab('0x0'));var VoiceExtension=require(_0xa6ab('0x1'))['db'][_0xa6ab('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa6ab('0x3')](0x0);var events={'afterCreate':_0xa6ab('0x4'),'afterUpdate':_0xa6ab('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3322b9){return function(_0x355001,_0x17dc28,_0x31b0bc){VoiceExtensionEvents[_0xa6ab('0x6')](_0x3322b9+':'+_0x355001['id'],_0x355001);VoiceExtensionEvents[_0xa6ab('0x6')](_0x3322b9,_0x355001);_0x31b0bc(null);};}for(var e in events){if(events[_0xa6ab('0x7')](e)){var event=events[e];VoiceExtension[_0xa6ab('0x8')](e,emitEvent(event));}}module[_0xa6ab('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe1c4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','update'];(function(_0x17b00c,_0x42cfe7){var _0x20b276=function(_0x5022fa){while(--_0x5022fa){_0x17b00c['push'](_0x17b00c['shift']());}};_0x20b276(++_0x42cfe7);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x5461ea,_0xc51bad){_0x5461ea=_0x5461ea-0x0;var _0x39fc8e=_0xe1c4[_0x5461ea];return _0x39fc8e;};'use strict';var EventEmitter=require(_0x4e1c('0x0'));var VoiceExtension=require(_0x4e1c('0x1'))['db'][_0x4e1c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e1c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2658c9){return function(_0x1c6359,_0x438c83,_0x51d90d){VoiceExtensionEvents['emit'](_0x2658c9+':'+_0x1c6359['id'],_0x1c6359);VoiceExtensionEvents[_0x4e1c('0x4')](_0x2658c9,_0x1c6359);_0x51d90d(null);};}for(var e in events){if(events[_0x4e1c('0x5')](e)){var event=events[e];VoiceExtension[_0x4e1c('0x6')](e,emitEvent(event));}}module[_0x4e1c('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 403232a..c85c679 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','define','voice_extensions'];(function(_0x17c182,_0x45c128){var _0x1ec5c7=function(_0x2c6cc9){while(--_0x2c6cc9){_0x17c182['push'](_0x17c182['shift']());}};_0x1ec5c7(++_0x45c128);}(_0x1261,0x144));var _0x1126=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x1261[_0x29ae80];return _0x5d6d71;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('VoiceExtension',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0x7a54,0x106));var _0x47a5=function(_0x1f773e,_0x2da5de){_0x1f773e=_0x1f773e-0x0;var _0x2cf198=_0x7a54[_0x1f773e];return _0x2cf198;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c19cb8d..fd838b8 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 _0x7c14=['where','attributes','limit','include','model','map','then','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','options','raw'];(function(_0x417a94,_0x14f396){var _0x20e7d5=function(_0x2bdec7){while(--_0x2bdec7){_0x417a94['push'](_0x417a94['shift']());}};_0x20e7d5(++_0x14f396);}(_0x7c14,0x1dc));var _0x47c1=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7c14[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x47c1('0x0'));var util=require(_0x47c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x47c1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47c1('0x3'))['db'];var utils=require(_0x47c1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x47c1('0x5'));var jayson=require(_0x47c1('0x6'));var client=jayson[_0x47c1('0x7')][_0x47c1('0x8')]({'port':0x232a});config[_0x47c1('0x9')]=_[_0x47c1('0xa')](config[_0x47c1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x47c1('0xb'))(new Redis(config[_0x47c1('0x9')]));require(_0x47c1('0xc'))[_0x47c1('0xd')](socket);function respondWithRpcPromise(_0x39d177,_0x18c685,_0x2f36ee){return new BPromise(function(_0x2cb1d2,_0x172c8f){return client[_0x47c1('0xe')](_0x39d177,_0x2f36ee)['then'](function(_0x62c338){logger[_0x47c1('0xf')](_0x47c1('0x10'),_0x18c685,_0x47c1('0x11'));logger[_0x47c1('0x12')](_0x47c1('0x13'),_0x18c685,_0x47c1('0x11'),JSON['stringify'](_0x62c338));if(_0x62c338['error']){if(_0x62c338[_0x47c1('0x14')][_0x47c1('0x15')]===0x1f4){logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);return _0x172c8f(_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);}logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x62c338[_0x47c1('0x14')][_0x47c1('0x16')]);return _0x2cb1d2(_0x62c338[_0x47c1('0x14')]['message']);}else{logger[_0x47c1('0xf')](_0x47c1('0x10'),_0x18c685,_0x47c1('0x11'));_0x2cb1d2(_0x62c338[_0x47c1('0x17')][_0x47c1('0x16')]);}})[_0x47c1('0x18')](function(_0x1276cc){logger[_0x47c1('0x14')](_0x47c1('0x10'),_0x18c685,_0x1276cc);_0x172c8f(_0x1276cc);});});}exports[_0x47c1('0x19')]=function(_0x29cfe9){var _0x3219bc=this;return new Promise(function(_0x8da9c,_0x47f025){return db['VoiceExtension']['findAll']({'raw':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9['options'][_0x47c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1c')]||null:null,'attributes':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1d')]||null:null,'limit':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9['options'][_0x47c1('0x1e')]||null:null,'include':_0x29cfe9[_0x47c1('0x1a')]?_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1f')]?_['map'](_0x29cfe9[_0x47c1('0x1a')][_0x47c1('0x1f')],function(_0x47aca9){return{'model':db[_0x47aca9[_0x47c1('0x20')]],'as':_0x47aca9['as'],'attributes':_0x47aca9['attributes'],'include':_0x47aca9[_0x47c1('0x1f')]?_[_0x47c1('0x21')](_0x47aca9[_0x47c1('0x1f')],function(_0x394866){return{'model':db[_0x394866[_0x47c1('0x20')]],'as':_0x394866['as'],'attributes':_0x394866[_0x47c1('0x1d')],'include':_0x394866[_0x47c1('0x1f')]?_[_0x47c1('0x21')](_0x394866[_0x47c1('0x1f')],function(_0x9413f2){return{'model':db[_0x9413f2[_0x47c1('0x20')]],'as':_0x9413f2['as'],'attributes':_0x9413f2[_0x47c1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x47c1('0x22')](function(_0x1c85f0){logger[_0x47c1('0xf')]('GetVoiceExtension',_0x29cfe9);logger[_0x47c1('0x12')](_0x47c1('0x19'),_0x29cfe9,JSON[_0x47c1('0x23')](_0x1c85f0));_0x8da9c(_0x1c85f0);})[_0x47c1('0x18')](function(_0x356b88){logger[_0x47c1('0x14')](_0x47c1('0x19'),_0x356b88[_0x47c1('0x16')],_0x29cfe9);_0x47f025(_0x3219bc['error'](0x1f4,_0x356b88[_0x47c1('0x16')]));});});}; \ No newline at end of file +var _0xbf12=['register','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbf12,0x8b));var _0x2bf1=function(_0x52bbc9,_0x3524f0){_0x52bbc9=_0x52bbc9-0x0;var _0x26e579=_0xbf12[_0x52bbc9];return _0x26e579;};'use strict';var _=require(_0x2bf1('0x0'));var util=require('util');var moment=require(_0x2bf1('0x1'));var BPromise=require(_0x2bf1('0x2'));var rs=require(_0x2bf1('0x3'));var fs=require('fs');var Redis=require(_0x2bf1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bf1('0x5'));var logger=require(_0x2bf1('0x6'))(_0x2bf1('0x7'));var config=require(_0x2bf1('0x8'));var jayson=require(_0x2bf1('0x9'));var client=jayson[_0x2bf1('0xa')][_0x2bf1('0xb')]({'port':0x232a});config[_0x2bf1('0xc')]=_[_0x2bf1('0xd')](config[_0x2bf1('0xc')],{'host':_0x2bf1('0xe'),'port':0x18eb});var socket=require(_0x2bf1('0xf'))(new Redis(config[_0x2bf1('0xc')]));require(_0x2bf1('0x10'))[_0x2bf1('0x11')](socket);function respondWithRpcPromise(_0x150312,_0x428531,_0x33e36b){return new BPromise(function(_0x13ee85,_0x20ed15){return client['request'](_0x150312,_0x33e36b)['then'](function(_0x404664){logger[_0x2bf1('0x12')](_0x2bf1('0x13'),_0x428531,_0x2bf1('0x14'));logger[_0x2bf1('0x15')](_0x2bf1('0x16'),_0x428531,_0x2bf1('0x14'),JSON[_0x2bf1('0x17')](_0x404664));if(_0x404664[_0x2bf1('0x18')]){if(_0x404664['error'][_0x2bf1('0x19')]===0x1f4){logger[_0x2bf1('0x18')](_0x2bf1('0x13'),_0x428531,_0x404664['error'][_0x2bf1('0x1a')]);return _0x20ed15(_0x404664['error'][_0x2bf1('0x1a')]);}logger[_0x2bf1('0x18')](_0x2bf1('0x13'),_0x428531,_0x404664['error'][_0x2bf1('0x1a')]);return _0x13ee85(_0x404664[_0x2bf1('0x18')]['message']);}else{logger['info'](_0x2bf1('0x13'),_0x428531,_0x2bf1('0x14'));_0x13ee85(_0x404664[_0x2bf1('0x1b')]['message']);}})[_0x2bf1('0x1c')](function(_0x363d75){logger[_0x2bf1('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x428531,_0x363d75);_0x20ed15(_0x363d75);});});}exports[_0x2bf1('0x1d')]=function(_0x1284ef){var _0x1678b0=this;return new Promise(function(_0x5eeb9e,_0x4be86d){return db[_0x2bf1('0x1e')]['findAll']({'raw':_0x1284ef['options']?_0x1284ef[_0x2bf1('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1284ef[_0x2bf1('0x1f')]?_0x1284ef['options'][_0x2bf1('0x20')]||null:null,'attributes':_0x1284ef[_0x2bf1('0x1f')]?_0x1284ef[_0x2bf1('0x1f')][_0x2bf1('0x21')]||null:null,'limit':_0x1284ef[_0x2bf1('0x1f')]?_0x1284ef[_0x2bf1('0x1f')][_0x2bf1('0x22')]||null:null,'include':_0x1284ef[_0x2bf1('0x1f')]?_0x1284ef[_0x2bf1('0x1f')][_0x2bf1('0x23')]?_[_0x2bf1('0x24')](_0x1284ef['options'][_0x2bf1('0x23')],function(_0xdf8837){return{'model':db[_0xdf8837[_0x2bf1('0x25')]],'as':_0xdf8837['as'],'attributes':_0xdf8837[_0x2bf1('0x21')],'include':_0xdf8837['include']?_[_0x2bf1('0x24')](_0xdf8837[_0x2bf1('0x23')],function(_0x493c00){return{'model':db[_0x493c00[_0x2bf1('0x25')]],'as':_0x493c00['as'],'attributes':_0x493c00[_0x2bf1('0x21')],'include':_0x493c00[_0x2bf1('0x23')]?_[_0x2bf1('0x24')](_0x493c00[_0x2bf1('0x23')],function(_0x29fae7){return{'model':db[_0x29fae7[_0x2bf1('0x25')]],'as':_0x29fae7['as'],'attributes':_0x29fae7[_0x2bf1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2bf1('0x26')](function(_0x281fe7){logger[_0x2bf1('0x12')](_0x2bf1('0x1d'),_0x1284ef);logger[_0x2bf1('0x15')](_0x2bf1('0x1d'),_0x1284ef,JSON['stringify'](_0x281fe7));_0x5eeb9e(_0x281fe7);})[_0x2bf1('0x1c')](function(_0x1dc5b0){logger['error']('GetVoiceExtension',_0x1dc5b0[_0x2bf1('0x1a')],_0x1284ef);_0x4be86d(_0x1678b0[_0x2bf1('0x18')](0x1f4,_0x1dc5b0[_0x2bf1('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 02e0e84..3b26271 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 _0x8c5b=['register','length','voiceExtension:','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x8c5b,0x1b3));var _0xb8c5=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x8c5b[_0x21f931];return _0x3f083c;};'use strict';var VoiceExtensionEvents=require(_0xb8c5('0x0'));var events=[_0xb8c5('0x1'),_0xb8c5('0x2'),_0xb8c5('0x3')];function createListener(_0x443e98,_0x524c7b){return function(_0xb8757f){_0x524c7b['emit'](_0x443e98,_0xb8757f);};}function removeListener(_0x29d4e9,_0x364a1f){return function(){VoiceExtensionEvents[_0xb8c5('0x4')](_0x29d4e9,_0x364a1f);};}exports[_0xb8c5('0x5')]=function(_0xe534b7){for(var _0x4db47e=0x0,_0x22211d=events[_0xb8c5('0x6')];_0x4db47e<_0x22211d;_0x4db47e++){var _0x3be950=events[_0x4db47e];var _0xb46065=createListener(_0xb8c5('0x7')+_0x3be950,_0xe534b7);VoiceExtensionEvents['on'](_0x3be950,_0xb46065);}}; \ No newline at end of file +var _0xa96b=['register','length','voiceExtension:','./voiceExtension.events','remove','update','emit','removeListener'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa96b,0xa3));var _0xba96=function(_0x3bb92a,_0x192d18){_0x3bb92a=_0x3bb92a-0x0;var _0x1d79cd=_0xa96b[_0x3bb92a];return _0x1d79cd;};'use strict';var VoiceExtensionEvents=require(_0xba96('0x0'));var events=['save',_0xba96('0x1'),_0xba96('0x2')];function createListener(_0x2a9c83,_0x109b2f){return function(_0x4eb72d){_0x109b2f[_0xba96('0x3')](_0x2a9c83,_0x4eb72d);};}function removeListener(_0x36278b,_0x567b33){return function(){VoiceExtensionEvents[_0xba96('0x4')](_0x36278b,_0x567b33);};}exports[_0xba96('0x5')]=function(_0x3748f3){for(var _0x57c59a=0x0,_0x1cc652=events[_0xba96('0x6')];_0x57c59a<_0x1cc652;_0x57c59a++){var _0x176945=events[_0x57c59a];var _0x351653=createListener(_0xba96('0x7')+_0x176945,_0x3748f3);VoiceExtensionEvents['on'](_0x176945,_0x351653);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ebbdcc4..27001a2 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 _0xb6e5=['/:id','show','/:id/messages','getMessages','post','create','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x560bb9,_0x13cd87){var _0x287e27=function(_0x3b2a81){while(--_0x3b2a81){_0x560bb9['push'](_0x560bb9['shift']());}};_0x287e27(++_0x13cd87);}(_0xb6e5,0xbe));var _0x5b6e=function(_0x3b67a7,_0x2edc12){_0x3b67a7=_0x3b67a7-0x0;var _0x5132f7=_0xb6e5[_0x3b67a7];return _0x5132f7;};'use strict';var multer=require('multer');var util=require(_0x5b6e('0x0'));var path=require(_0x5b6e('0x1'));var timeout=require(_0x5b6e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5b6e('0x3'));var interaction=require(_0x5b6e('0x4'));var config=require(_0x5b6e('0x5'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x5b6e('0x6')](),controller['index']);router[_0x5b6e('0x7')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0x9')]);router['get'](_0x5b6e('0xa'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0xb')]);router[_0x5b6e('0xc')]('/',auth[_0x5b6e('0x6')](),controller[_0x5b6e('0xd')]);router[_0x5b6e('0xe')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller['update']);router[_0x5b6e('0xf')](_0x5b6e('0x8'),auth[_0x5b6e('0x6')](),controller[_0x5b6e('0x10')]);module[_0x5b6e('0x11')]=router; \ No newline at end of file +var _0xb9b6=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post','create','put','delete','destroy','exports','util'];(function(_0x465351,_0x115a2c){var _0x19f941=function(_0x4584d7){while(--_0x4584d7){_0x465351['push'](_0x465351['shift']());}};_0x19f941(++_0x115a2c);}(_0xb9b6,0x131));var _0x6b9b=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xb9b6[_0x173f10];return _0x53142d;};'use strict';var multer=require('multer');var util=require(_0x6b9b('0x0'));var path=require('path');var timeout=require(_0x6b9b('0x1'));var express=require(_0x6b9b('0x2'));var router=express[_0x6b9b('0x3')]();var auth=require(_0x6b9b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6b9b('0x5'));var controller=require(_0x6b9b('0x6'));router[_0x6b9b('0x7')]('/',auth[_0x6b9b('0x8')](),controller[_0x6b9b('0x9')]);router[_0x6b9b('0x7')](_0x6b9b('0xa'),auth[_0x6b9b('0x8')](),controller['show']);router[_0x6b9b('0x7')]('/:id/messages',auth[_0x6b9b('0x8')](),controller[_0x6b9b('0xb')]);router[_0x6b9b('0xc')]('/',auth[_0x6b9b('0x8')](),controller[_0x6b9b('0xd')]);router[_0x6b9b('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6b9b('0xf')](_0x6b9b('0xa'),auth[_0x6b9b('0x8')](),controller[_0x6b9b('0x10')]);module[_0x6b9b('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 e7b0220..dbe6efe 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 _0xed3c=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','yes','ENUM','TINYINT(4)','TIMESTAMP'];(function(_0x560126,_0x1cff27){var _0x41ef92=function(_0x3e1731){while(--_0x3e1731){_0x560126['push'](_0x560126['shift']());}};_0x41ef92(++_0x1cff27);}(_0xed3c,0x1a6));var _0xced3=function(_0x3428a8,_0x4859c7){_0x3428a8=_0x3428a8-0x0;var _0x538873=_0xed3c[_0x3428a8];return _0x538873;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'customer_id':{'type':Sequelize[_0xced3('0x2')]},'context':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'from-voicemail','unique':_0xced3('0x3')},'mailbox':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'','allowNull':![],'unique':_0xced3('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xced3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ada18){this[_0xced3('0x4')](_0xced3('0x5'),typeof _0x1ada18==='string'&&_0x1ada18['trim']()?_0x1ada18['trim']():null);}},'pager':{'type':Sequelize[_0xced3('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xced3('0x2')]},'review':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xced3('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'stamp':{'type':_0xced3('0x9')},'emailsubject':{'type':Sequelize[_0xced3('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xced3('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xced3('0xb')],'get':function(){return this[_0xced3('0xc')](_0xced3('0xd'))+_0xced3('0xe')+this[_0xced3('0xc')](_0xced3('0xf'));}}}; \ No newline at end of file +var _0x4213=['trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x1cc15f,_0x5105c8){var _0x3c5201=function(_0x2622d1){while(--_0x2622d1){_0x1cc15f['push'](_0x1cc15f['shift']());}};_0x3c5201(++_0x5105c8);}(_0x4213,0x77));var _0x3421=function(_0x35c990,_0x51d242){_0x35c990=_0x35c990-0x0;var _0x340044=_0x4213[_0x35c990];return _0x340044;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'customer_id':{'type':Sequelize[_0x3421('0x2')]},'context':{'type':Sequelize[_0x3421('0x2')],'defaultValue':_0x3421('0x3'),'unique':_0x3421('0x4')},'mailbox':{'type':Sequelize[_0x3421('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3421('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3421('0x2')],'validate':{'isEmail':!![]},'set':function(_0xfe969c){this[_0x3421('0x5')](_0x3421('0x6'),typeof _0xfe969c==='string'&&_0xfe969c[_0x3421('0x7')]()?_0xfe969c[_0x3421('0x7')]():null);}},'pager':{'type':Sequelize[_0x3421('0x2')]},'tz':{'type':Sequelize[_0x3421('0x2')],'defaultValue':_0x3421('0x8')},'attach':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3421('0x2')]},'callback':{'type':Sequelize[_0x3421('0x2')]},'review':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3421('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3421('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x3421('0xa')](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x3421('0x9'),'no'),'defaultValue':_0x3421('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x3421('0x2')]},'emailbody':{'type':Sequelize[_0x3421('0x2')]},'maxsecs':{'type':Sequelize[_0x3421('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3421('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3421('0xd')],'get':function(){return this[_0x3421('0xe')](_0x3421('0xf'))+_0x3421('0x10')+this[_0x3421('0xe')](_0x3421('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 115c420..d970c50 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 _0x30f3=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','includeAll','include','findAll','catch','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','squel','crypto','jsforce'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x30f3,0x94));var _0x330f=function(_0x4c1b76,_0x2cdc2d){_0x4c1b76=_0x4c1b76-0x0;var _0x3ace6b=_0x30f3[_0x4c1b76];return _0x3ace6b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x330f('0x0'));var rimraf=require(_0x330f('0x1'));var zipdir=require(_0x330f('0x2'));var jsonpatch=require(_0x330f('0x3'));var rp=require(_0x330f('0x4'));var moment=require('moment');var BPromise=require(_0x330f('0x5'));var Mustache=require(_0x330f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x330f('0x7'));var csv=require('to-csv');var ejs=require(_0x330f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x330f('0x9'));var crypto=require(_0x330f('0xa'));var jsforce=require(_0x330f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x330f('0xc'));var Papa=require(_0x330f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x330f('0xe'));var hardwareService=require(_0x330f('0xf'));var logger=require(_0x330f('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x330f('0x11'));var db=require(_0x330f('0x12'))['db'];function respondWithStatusCode(_0x53bcfa,_0x312b14){_0x312b14=_0x312b14||0xcc;return function(_0x3e0a67){if(_0x3e0a67){return _0x53bcfa[_0x330f('0x13')](_0x312b14);}return _0x53bcfa[_0x330f('0x14')](_0x312b14)[_0x330f('0x15')]();};}function respondWithResult(_0x50cdb9,_0x3daf64){_0x3daf64=_0x3daf64||0xc8;return function(_0x138120){if(_0x138120){return _0x50cdb9[_0x330f('0x14')](_0x3daf64)[_0x330f('0x16')](_0x138120);}};}function respondWithFilteredResult(_0x460caa,_0x55e2df){return function(_0xb27150){if(_0xb27150){var _0x654668=_0xb27150[_0x330f('0x17')],_0x3d02a1=_0x55e2df[_0x330f('0x18')],_0x222764=_0x55e2df[_0x330f('0x18')]+_0x55e2df[_0x330f('0x19')],_0x3023ab;if(_0x222764>=_0x654668){_0x222764=_0x654668;_0x3023ab=0xc8;}else{_0x3023ab=0xce;}_0x460caa['status'](_0x3023ab);return _0x460caa[_0x330f('0x1a')](_0x330f('0x1b'),_0x3d02a1+'-'+_0x222764+'/'+_0x654668)['json'](_0xb27150);}return null;};}function patchUpdates(_0x2071aa){return function(_0x2404d8){try{jsonpatch[_0x330f('0x1c')](_0x2404d8,_0x2071aa,!![]);}catch(_0x64f7b){return BPromise[_0x330f('0x1d')](_0x64f7b);}return _0x2404d8[_0x330f('0x1e')]();};}function saveUpdates(_0x5bcdb0,_0x24c411){return function(_0x5566c8){if(_0x5566c8){return _0x5566c8[_0x330f('0x1f')](_0x5bcdb0)[_0x330f('0x20')](function(_0x4d70ea){return _0x4d70ea;});}return null;};}function removeEntity(_0xfdf204,_0x274a12){return function(_0x43590f){if(_0x43590f){return _0x43590f['destroy']()['then'](function(){var _0x20558a=_0x43590f['get']({'plain':!![]});var _0x2ec965=_0x330f('0x21');return db[_0x330f('0x22')][_0x330f('0x23')]({'where':{'type':_0x2ec965,'resourceId':_0x20558a['id']}})[_0x330f('0x20')](function(){return _0x43590f;});})[_0x330f('0x20')](function(){_0xfdf204[_0x330f('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb8d9,_0x148854){return function(_0x15dc88){if(!_0x15dc88){_0x2fb8d9[_0x330f('0x13')](0x194);}return _0x15dc88;};}function handleError(_0x3e75de,_0xbf80b7){_0xbf80b7=_0xbf80b7||0x1f4;return function(_0x2cea21){logger[_0x330f('0x24')](_0x2cea21[_0x330f('0x25')]);if(_0x2cea21[_0x330f('0x26')]){delete _0x2cea21[_0x330f('0x26')];}_0x3e75de[_0x330f('0x14')](_0xbf80b7)[_0x330f('0x27')](_0x2cea21);};}exports['index']=function(_0x535e26,_0xe45ae4){var _0x5fbe7e={},_0x470c9b={},_0x39ef8d={'count':0x0,'rows':[]};var _0x3f4a88=_[_0x330f('0x28')](db[_0x330f('0x29')][_0x330f('0x2a')],function(_0x1f4861){return{'name':_0x1f4861['fieldName'],'type':_0x1f4861[_0x330f('0x2b')]['key']};});_0x470c9b['model']=_['map'](_0x3f4a88,_0x330f('0x26'));_0x470c9b[_0x330f('0x2c')]=_[_0x330f('0x2d')](_0x535e26[_0x330f('0x2c')]);_0x470c9b['filters']=_['intersection'](_0x470c9b['model'],_0x470c9b[_0x330f('0x2c')]);_0x5fbe7e[_0x330f('0x2e')]=_[_0x330f('0x2f')](_0x470c9b[_0x330f('0x30')],qs[_0x330f('0x31')](_0x535e26[_0x330f('0x2c')][_0x330f('0x31')]));_0x5fbe7e[_0x330f('0x2e')]=_0x5fbe7e[_0x330f('0x2e')][_0x330f('0x32')]?_0x5fbe7e[_0x330f('0x2e')]:_0x470c9b[_0x330f('0x30')];if(!_0x535e26[_0x330f('0x2c')][_0x330f('0x33')]('nolimit')){_0x5fbe7e[_0x330f('0x19')]=qs[_0x330f('0x19')](_0x535e26[_0x330f('0x2c')][_0x330f('0x19')]);_0x5fbe7e['offset']=qs[_0x330f('0x18')](_0x535e26[_0x330f('0x2c')]['offset']);}_0x5fbe7e[_0x330f('0x34')]=qs[_0x330f('0x35')](_0x535e26['query'][_0x330f('0x35')]);_0x5fbe7e[_0x330f('0x36')]=qs[_0x330f('0x37')](_[_0x330f('0x38')](_0x535e26[_0x330f('0x2c')],_0x470c9b['filters']),_0x3f4a88);if(_0x535e26[_0x330f('0x2c')][_0x330f('0x39')]){_0x5fbe7e[_0x330f('0x36')]=_['merge'](_0x5fbe7e[_0x330f('0x36')],{'$or':_['map'](_0x3f4a88,function(_0x140201){if(_0x140201[_0x330f('0x2b')]!=='VIRTUAL'){var _0x1f16ed={};_0x1f16ed[_0x140201[_0x330f('0x26')]]={'$like':'%'+_0x535e26['query'][_0x330f('0x39')]+'%'};return _0x1f16ed;}})});}_0x5fbe7e=_['merge']({},_0x5fbe7e,_0x535e26['options']);var _0x136b23={'where':_0x5fbe7e[_0x330f('0x36')]};return db['VoiceMail']['count'](_0x136b23)['then'](function(_0x80a23a){_0x39ef8d['count']=_0x80a23a;if(_0x535e26['query'][_0x330f('0x3a')]){_0x5fbe7e[_0x330f('0x3b')]=[{'all':!![]}];}return db[_0x330f('0x29')][_0x330f('0x3c')](_0x5fbe7e);})[_0x330f('0x20')](function(_0x30660c){_0x39ef8d['rows']=_0x30660c;return _0x39ef8d;})[_0x330f('0x20')](respondWithFilteredResult(_0xe45ae4,_0x5fbe7e))[_0x330f('0x3d')](handleError(_0xe45ae4,null));};exports['show']=function(_0x30dfb4,_0x41f85c){var _0xd24367={'raw':!![],'where':{'id':_0x30dfb4['params']['id']}},_0xfbfc8={};_0xfbfc8[_0x330f('0x30')]=_['keys'](db[_0x330f('0x29')][_0x330f('0x2a')]);_0xfbfc8['query']=_[_0x330f('0x2d')](_0x30dfb4['query']);_0xfbfc8['filters']=_[_0x330f('0x2f')](_0xfbfc8[_0x330f('0x30')],_0xfbfc8[_0x330f('0x2c')]);_0xd24367[_0x330f('0x2e')]=_[_0x330f('0x2f')](_0xfbfc8['model'],qs[_0x330f('0x31')](_0x30dfb4['query'][_0x330f('0x31')]));_0xd24367[_0x330f('0x2e')]=_0xd24367[_0x330f('0x2e')][_0x330f('0x32')]?_0xd24367[_0x330f('0x2e')]:_0xfbfc8[_0x330f('0x30')];if(_0x30dfb4[_0x330f('0x2c')][_0x330f('0x3a')]){_0xd24367[_0x330f('0x3b')]=[{'all':!![]}];}_0xd24367=_[_0x330f('0x3e')]({},_0xd24367,_0x30dfb4[_0x330f('0x3f')]);return db[_0x330f('0x29')]['find'](_0xd24367)[_0x330f('0x20')](handleEntityNotFound(_0x41f85c,null))['then'](respondWithResult(_0x41f85c,null))[_0x330f('0x3d')](handleError(_0x41f85c,null));};exports[_0x330f('0x40')]=function(_0x45cc2c,_0x439fcd){return db[_0x330f('0x29')][_0x330f('0x40')](_0x45cc2c[_0x330f('0x41')],{})[_0x330f('0x20')](function(_0x110d6e){var _0x2592d5=_0x45cc2c[_0x330f('0x42')][_0x330f('0x43')]({'plain':!![]});if(!_0x2592d5)throw new Error(_0x330f('0x44'));if(_0x2592d5[_0x330f('0x45')]===_0x330f('0x42')){var _0x291ec2=_0x110d6e[_0x330f('0x43')]({'plain':!![]});var _0x3e14d3='Voicemails';return db[_0x330f('0x46')][_0x330f('0x47')]({'where':{'name':_0x3e14d3,'userProfileId':_0x2592d5[_0x330f('0x48')]},'raw':!![]})['then'](function(_0xf7a04e){if(_0xf7a04e&&_0xf7a04e['autoAssociation']===0x0){return db[_0x330f('0x22')][_0x330f('0x40')]({'name':_0x291ec2[_0x330f('0x26')],'resourceId':_0x291ec2['id'],'type':_0xf7a04e[_0x330f('0x26')],'sectionId':_0xf7a04e['id']},{})['then'](function(){return _0x110d6e;});}else{return _0x110d6e;}})[_0x330f('0x3d')](function(_0x5f1f1f){logger[_0x330f('0x24')](_0x330f('0x49'),_0x5f1f1f);throw _0x5f1f1f;});}return _0x110d6e;})['then'](respondWithResult(_0x439fcd,0xc9))[_0x330f('0x3d')](handleError(_0x439fcd,null));};exports[_0x330f('0x1f')]=function(_0xc55b66,_0x25cae2){if(_0xc55b66[_0x330f('0x41')]['id']){delete _0xc55b66[_0x330f('0x41')]['id'];}return db[_0x330f('0x29')][_0x330f('0x47')]({'where':{'id':_0xc55b66['params']['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x25cae2,null))[_0x330f('0x20')](saveUpdates(_0xc55b66[_0x330f('0x41')],null))[_0x330f('0x20')](respondWithResult(_0x25cae2,null))[_0x330f('0x3d')](handleError(_0x25cae2,null));};exports['destroy']=function(_0xf3c704,_0x2826e7){return db[_0x330f('0x29')][_0x330f('0x47')]({'where':{'id':_0xf3c704[_0x330f('0x4a')]['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x2826e7,null))[_0x330f('0x20')](removeEntity(_0x2826e7,null))[_0x330f('0x3d')](handleError(_0x2826e7,null));};exports[_0x330f('0x4b')]=function(_0x862080,_0x12a7ad,_0x50dcde){return db[_0x330f('0x29')][_0x330f('0x4c')]({'where':{'id':_0x862080[_0x330f('0x4a')]['id']}})[_0x330f('0x20')](handleEntityNotFound(_0x12a7ad,null))[_0x330f('0x20')](function(_0x541fa3){var _0x52fb41;var _0x520819={},_0x34ce18={};_0x34ce18[_0x330f('0x30')]=_[_0x330f('0x2d')](db[_0x330f('0x4d')][_0x330f('0x2a')]);_0x34ce18['query']=_[_0x330f('0x2d')](_0x862080[_0x330f('0x2c')]);_0x34ce18['filters']=_[_0x330f('0x2f')](_0x34ce18[_0x330f('0x30')],_0x34ce18[_0x330f('0x2c')]);_0x520819[_0x330f('0x2e')]=_['intersection'](_0x34ce18['model'],qs['fields'](_0x862080[_0x330f('0x2c')]['fields']));_0x520819[_0x330f('0x2e')]=_0x520819[_0x330f('0x2e')][_0x330f('0x32')]?_0x520819[_0x330f('0x2e')]:_0x34ce18[_0x330f('0x30')];if(!_0x862080[_0x330f('0x2c')][_0x330f('0x33')](_0x330f('0x4e'))){_0x520819[_0x330f('0x19')]=qs[_0x330f('0x19')](_0x862080[_0x330f('0x2c')][_0x330f('0x19')]);_0x520819['offset']=qs[_0x330f('0x18')](_0x862080[_0x330f('0x2c')][_0x330f('0x18')]);}_0x520819[_0x330f('0x34')]=qs[_0x330f('0x35')](_0x862080[_0x330f('0x2c')][_0x330f('0x35')]);_0x520819['where']=qs[_0x330f('0x37')](_[_0x330f('0x38')](_0x862080[_0x330f('0x2c')],_0x34ce18[_0x330f('0x37')]));if(_0x862080[_0x330f('0x2c')]['filter']){_0x520819[_0x330f('0x36')]=_[_0x330f('0x3e')](_0x520819['where'],{'$or':_['map'](_0x520819['attributes'],function(_0x3f60e7){var _0x300d9c={};_0x300d9c[_0x3f60e7]={'$like':'%'+_0x862080[_0x330f('0x2c')][_0x330f('0x39')]+'%'};return _0x300d9c;})});}_0x520819['where']=_[_0x330f('0x3e')](_0x520819['where'],{'mailboxuser':_0x541fa3[_0x330f('0x4f')]});_0x520819=_[_0x330f('0x3e')]({},_0x520819,_0x862080[_0x330f('0x3f')]);return db[_0x330f('0x4d')]['findAndCountAll'](_0x520819)[_0x330f('0x20')](respondWithFilteredResult(_0x12a7ad,_0x520819));})[_0x330f('0x3d')](handleError(_0x12a7ad,null));}; \ No newline at end of file +var _0x39bd=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','get','Voicemails','UserProfileResource','destroy','stack','name','send','index','rawAttributes','type','model','map','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceMail','include','findAll','rows','catch','show','params','keys','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x2fe606,_0x4bbc13){var _0x5cf17c=function(_0x490221){while(--_0x490221){_0x2fe606['push'](_0x2fe606['shift']());}};_0x5cf17c(++_0x4bbc13);}(_0x39bd,0x8c));var _0xd39b=function(_0x51253b,_0x40f30f){_0x51253b=_0x51253b-0x0;var _0x23b0dd=_0x39bd[_0x51253b];return _0x23b0dd;};'use strict';var pdf=require(_0xd39b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd39b('0x1'));var zipdir=require(_0xd39b('0x2'));var jsonpatch=require(_0xd39b('0x3'));var rp=require(_0xd39b('0x4'));var moment=require(_0xd39b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd39b('0x6'));var util=require(_0xd39b('0x7'));var path=require(_0xd39b('0x8'));var sox=require(_0xd39b('0x9'));var csv=require(_0xd39b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd39b('0xb'));var crypto=require('crypto');var jsforce=require(_0xd39b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd39b('0xa'));var querystring=require(_0xd39b('0xd'));var Papa=require('papaparse');var Redis=require(_0xd39b('0xe'));var authService=require(_0xd39b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd39b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd39b('0x11'))(_0xd39b('0x12'));var utils=require(_0xd39b('0x13'));var config=require(_0xd39b('0x14'));var db=require(_0xd39b('0x15'))['db'];function respondWithStatusCode(_0x2345db,_0x19efb9){_0x19efb9=_0x19efb9||0xcc;return function(_0x56af21){if(_0x56af21){return _0x2345db[_0xd39b('0x16')](_0x19efb9);}return _0x2345db[_0xd39b('0x17')](_0x19efb9)[_0xd39b('0x18')]();};}function respondWithResult(_0x4d5085,_0x5238ee){_0x5238ee=_0x5238ee||0xc8;return function(_0x148156){if(_0x148156){return _0x4d5085['status'](_0x5238ee)[_0xd39b('0x19')](_0x148156);}};}function respondWithFilteredResult(_0x2a5331,_0x5520e1){return function(_0x3853b8){if(_0x3853b8){var _0x4ffcb3=_0x3853b8[_0xd39b('0x1a')],_0x326e6d=_0x5520e1[_0xd39b('0x1b')],_0x412dfb=_0x5520e1[_0xd39b('0x1b')]+_0x5520e1[_0xd39b('0x1c')],_0x3edb4e;if(_0x412dfb>=_0x4ffcb3){_0x412dfb=_0x4ffcb3;_0x3edb4e=0xc8;}else{_0x3edb4e=0xce;}_0x2a5331[_0xd39b('0x17')](_0x3edb4e);return _0x2a5331['set'](_0xd39b('0x1d'),_0x326e6d+'-'+_0x412dfb+'/'+_0x4ffcb3)[_0xd39b('0x19')](_0x3853b8);}return null;};}function patchUpdates(_0x5cbe15){return function(_0x389550){try{jsonpatch['apply'](_0x389550,_0x5cbe15,!![]);}catch(_0x215ce6){return BPromise['reject'](_0x215ce6);}return _0x389550[_0xd39b('0x1e')]();};}function saveUpdates(_0x55140b,_0x2e57db){return function(_0x2cd071){if(_0x2cd071){return _0x2cd071[_0xd39b('0x1f')](_0x55140b)[_0xd39b('0x20')](function(_0xb6e8fa){return _0xb6e8fa;});}return null;};}function removeEntity(_0x2e2824,_0x1880eb){return function(_0x494b3b){if(_0x494b3b){return _0x494b3b['destroy']()['then'](function(){var _0x48513c=_0x494b3b[_0xd39b('0x21')]({'plain':!![]});var _0x28bb10=_0xd39b('0x22');return db[_0xd39b('0x23')][_0xd39b('0x24')]({'where':{'type':_0x28bb10,'resourceId':_0x48513c['id']}})[_0xd39b('0x20')](function(){return _0x494b3b;});})['then'](function(){_0x2e2824[_0xd39b('0x17')](0xcc)[_0xd39b('0x18')]();});}};}function handleEntityNotFound(_0x4f6f7f,_0x15ec2e){return function(_0x219890){if(!_0x219890){_0x4f6f7f[_0xd39b('0x16')](0x194);}return _0x219890;};}function handleError(_0xee8891,_0x1e55c9){_0x1e55c9=_0x1e55c9||0x1f4;return function(_0x3bce26){logger['error'](_0x3bce26[_0xd39b('0x25')]);if(_0x3bce26[_0xd39b('0x26')]){delete _0x3bce26['name'];}_0xee8891['status'](_0x1e55c9)[_0xd39b('0x27')](_0x3bce26);};}exports[_0xd39b('0x28')]=function(_0xda8897,_0x385a26){var _0x1bdc4b={},_0x68cdcf={},_0x2b6a05={'count':0x0,'rows':[]};var _0x4d46e4=_['map'](db['VoiceMail'][_0xd39b('0x29')],function(_0xb1b7a){return{'name':_0xb1b7a['fieldName'],'type':_0xb1b7a[_0xd39b('0x2a')]['key']};});_0x68cdcf[_0xd39b('0x2b')]=_[_0xd39b('0x2c')](_0x4d46e4,_0xd39b('0x26'));_0x68cdcf[_0xd39b('0x2d')]=_['keys'](_0xda8897[_0xd39b('0x2d')]);_0x68cdcf[_0xd39b('0x2e')]=_[_0xd39b('0x2f')](_0x68cdcf[_0xd39b('0x2b')],_0x68cdcf['query']);_0x1bdc4b['attributes']=_[_0xd39b('0x2f')](_0x68cdcf[_0xd39b('0x2b')],qs['fields'](_0xda8897[_0xd39b('0x2d')]['fields']));_0x1bdc4b[_0xd39b('0x30')]=_0x1bdc4b['attributes'][_0xd39b('0x31')]?_0x1bdc4b[_0xd39b('0x30')]:_0x68cdcf[_0xd39b('0x2b')];if(!_0xda8897['query']['hasOwnProperty'](_0xd39b('0x32'))){_0x1bdc4b['limit']=qs[_0xd39b('0x1c')](_0xda8897[_0xd39b('0x2d')][_0xd39b('0x1c')]);_0x1bdc4b[_0xd39b('0x1b')]=qs[_0xd39b('0x1b')](_0xda8897[_0xd39b('0x2d')][_0xd39b('0x1b')]);}_0x1bdc4b[_0xd39b('0x33')]=qs['sort'](_0xda8897[_0xd39b('0x2d')][_0xd39b('0x34')]);_0x1bdc4b[_0xd39b('0x35')]=qs['filters'](_[_0xd39b('0x36')](_0xda8897[_0xd39b('0x2d')],_0x68cdcf[_0xd39b('0x2e')]),_0x4d46e4);if(_0xda8897[_0xd39b('0x2d')][_0xd39b('0x37')]){_0x1bdc4b['where']=_['merge'](_0x1bdc4b[_0xd39b('0x35')],{'$or':_['map'](_0x4d46e4,function(_0x5c2dd4){if(_0x5c2dd4['type']!==_0xd39b('0x38')){var _0x41697b={};_0x41697b[_0x5c2dd4[_0xd39b('0x26')]]={'$like':'%'+_0xda8897[_0xd39b('0x2d')][_0xd39b('0x37')]+'%'};return _0x41697b;}})});}_0x1bdc4b=_[_0xd39b('0x39')]({},_0x1bdc4b,_0xda8897[_0xd39b('0x3a')]);var _0x16ac56={'where':_0x1bdc4b['where']};return db[_0xd39b('0x3b')]['count'](_0x16ac56)[_0xd39b('0x20')](function(_0x5ab383){_0x2b6a05[_0xd39b('0x1a')]=_0x5ab383;if(_0xda8897['query']['includeAll']){_0x1bdc4b[_0xd39b('0x3c')]=[{'all':!![]}];}return db[_0xd39b('0x3b')][_0xd39b('0x3d')](_0x1bdc4b);})[_0xd39b('0x20')](function(_0x17ffb5){_0x2b6a05[_0xd39b('0x3e')]=_0x17ffb5;return _0x2b6a05;})[_0xd39b('0x20')](respondWithFilteredResult(_0x385a26,_0x1bdc4b))[_0xd39b('0x3f')](handleError(_0x385a26,null));};exports[_0xd39b('0x40')]=function(_0x5489d4,_0x2c0506){var _0x2d2711={'raw':!![],'where':{'id':_0x5489d4[_0xd39b('0x41')]['id']}},_0x56ea4e={};_0x56ea4e[_0xd39b('0x2b')]=_[_0xd39b('0x42')](db[_0xd39b('0x3b')][_0xd39b('0x29')]);_0x56ea4e['query']=_[_0xd39b('0x42')](_0x5489d4['query']);_0x56ea4e['filters']=_[_0xd39b('0x2f')](_0x56ea4e[_0xd39b('0x2b')],_0x56ea4e[_0xd39b('0x2d')]);_0x2d2711[_0xd39b('0x30')]=_[_0xd39b('0x2f')](_0x56ea4e['model'],qs[_0xd39b('0x43')](_0x5489d4[_0xd39b('0x2d')][_0xd39b('0x43')]));_0x2d2711[_0xd39b('0x30')]=_0x2d2711[_0xd39b('0x30')][_0xd39b('0x31')]?_0x2d2711[_0xd39b('0x30')]:_0x56ea4e['model'];if(_0x5489d4['query'][_0xd39b('0x44')]){_0x2d2711[_0xd39b('0x3c')]=[{'all':!![]}];}_0x2d2711=_[_0xd39b('0x39')]({},_0x2d2711,_0x5489d4['options']);return db[_0xd39b('0x3b')][_0xd39b('0x45')](_0x2d2711)[_0xd39b('0x20')](handleEntityNotFound(_0x2c0506,null))[_0xd39b('0x20')](respondWithResult(_0x2c0506,null))[_0xd39b('0x3f')](handleError(_0x2c0506,null));};exports[_0xd39b('0x46')]=function(_0x1e9b02,_0x4abb3e){return db[_0xd39b('0x3b')][_0xd39b('0x46')](_0x1e9b02[_0xd39b('0x47')],{})[_0xd39b('0x20')](function(_0x2522f7){var _0xa25c2d=_0x1e9b02[_0xd39b('0x48')][_0xd39b('0x21')]({'plain':!![]});if(!_0xa25c2d)throw new Error(_0xd39b('0x49'));if(_0xa25c2d[_0xd39b('0x4a')]==='user'){var _0x406b5b=_0x2522f7[_0xd39b('0x21')]({'plain':!![]});var _0x45f8a9=_0xd39b('0x22');return db['UserProfileSection'][_0xd39b('0x45')]({'where':{'name':_0x45f8a9,'userProfileId':_0xa25c2d['userProfileId']},'raw':!![]})[_0xd39b('0x20')](function(_0x20ca78){if(_0x20ca78&&_0x20ca78['autoAssociation']===0x0){return db[_0xd39b('0x23')]['create']({'name':_0x406b5b[_0xd39b('0x26')],'resourceId':_0x406b5b['id'],'type':_0x20ca78[_0xd39b('0x26')],'sectionId':_0x20ca78['id']},{})[_0xd39b('0x20')](function(){return _0x2522f7;});}else{return _0x2522f7;}})[_0xd39b('0x3f')](function(_0x1f8035){logger[_0xd39b('0x4b')](_0xd39b('0x4c'),_0x1f8035);throw _0x1f8035;});}return _0x2522f7;})[_0xd39b('0x20')](respondWithResult(_0x4abb3e,0xc9))[_0xd39b('0x3f')](handleError(_0x4abb3e,null));};exports[_0xd39b('0x1f')]=function(_0x510186,_0x4085e0){if(_0x510186['body']['id']){delete _0x510186[_0xd39b('0x47')]['id'];}return db[_0xd39b('0x3b')][_0xd39b('0x45')]({'where':{'id':_0x510186['params']['id']}})['then'](handleEntityNotFound(_0x4085e0,null))[_0xd39b('0x20')](saveUpdates(_0x510186['body'],null))[_0xd39b('0x20')](respondWithResult(_0x4085e0,null))['catch'](handleError(_0x4085e0,null));};exports[_0xd39b('0x24')]=function(_0x2d88f6,_0x2b666e){return db[_0xd39b('0x3b')][_0xd39b('0x45')]({'where':{'id':_0x2d88f6[_0xd39b('0x41')]['id']}})[_0xd39b('0x20')](handleEntityNotFound(_0x2b666e,null))['then'](removeEntity(_0x2b666e,null))[_0xd39b('0x3f')](handleError(_0x2b666e,null));};exports['getMessages']=function(_0x565c48,_0x2bf00e,_0x5814ee){return db['VoiceMail'][_0xd39b('0x4d')]({'where':{'id':_0x565c48[_0xd39b('0x41')]['id']}})[_0xd39b('0x20')](handleEntityNotFound(_0x2bf00e,null))[_0xd39b('0x20')](function(_0x2aeb5f){var _0x427cf8;var _0x337571={},_0x43a220={};_0x43a220[_0xd39b('0x2b')]=_[_0xd39b('0x42')](db[_0xd39b('0x4e')]['rawAttributes']);_0x43a220[_0xd39b('0x2d')]=_[_0xd39b('0x42')](_0x565c48['query']);_0x43a220[_0xd39b('0x2e')]=_[_0xd39b('0x2f')](_0x43a220['model'],_0x43a220[_0xd39b('0x2d')]);_0x337571['attributes']=_[_0xd39b('0x2f')](_0x43a220[_0xd39b('0x2b')],qs[_0xd39b('0x43')](_0x565c48['query']['fields']));_0x337571['attributes']=_0x337571[_0xd39b('0x30')][_0xd39b('0x31')]?_0x337571['attributes']:_0x43a220[_0xd39b('0x2b')];if(!_0x565c48[_0xd39b('0x2d')]['hasOwnProperty'](_0xd39b('0x32'))){_0x337571[_0xd39b('0x1c')]=qs[_0xd39b('0x1c')](_0x565c48[_0xd39b('0x2d')][_0xd39b('0x1c')]);_0x337571[_0xd39b('0x1b')]=qs[_0xd39b('0x1b')](_0x565c48['query'][_0xd39b('0x1b')]);}_0x337571[_0xd39b('0x33')]=qs[_0xd39b('0x34')](_0x565c48['query'][_0xd39b('0x34')]);_0x337571[_0xd39b('0x35')]=qs['filters'](_['pick'](_0x565c48[_0xd39b('0x2d')],_0x43a220['filters']));if(_0x565c48['query'][_0xd39b('0x37')]){_0x337571['where']=_[_0xd39b('0x39')](_0x337571[_0xd39b('0x35')],{'$or':_['map'](_0x337571[_0xd39b('0x30')],function(_0x375ead){var _0x5151f8={};_0x5151f8[_0x375ead]={'$like':'%'+_0x565c48[_0xd39b('0x2d')]['filter']+'%'};return _0x5151f8;})});}_0x337571[_0xd39b('0x35')]=_[_0xd39b('0x39')](_0x337571[_0xd39b('0x35')],{'mailboxuser':_0x2aeb5f['mailbox']});_0x337571=_[_0xd39b('0x39')]({},_0x337571,_0x565c48[_0xd39b('0x3a')]);return db['VoiceMailMessage'][_0xd39b('0x4f')](_0x337571)[_0xd39b('0x20')](respondWithFilteredResult(_0x2bf00e,_0x337571));})[_0xd39b('0x3f')](handleError(_0x2bf00e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 846751e..8b2bf63 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 _0xb1d1=['rimraf','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49fb6e,_0x2b1a51){var _0x3c03cc=function(_0x2184ff){while(--_0x2184ff){_0x49fb6e['push'](_0x49fb6e['shift']());}};_0x3c03cc(++_0x2b1a51);}(_0xb1d1,0xbb));var _0x1b1d=function(_0x261bcf,_0x3613ce){_0x261bcf=_0x261bcf-0x0;var _0x74e3dd=_0xb1d1[_0x261bcf];return _0x74e3dd;};'use strict';var _=require(_0x1b1d('0x0'));var util=require(_0x1b1d('0x1'));var logger=require(_0x1b1d('0x2'))(_0x1b1d('0x3'));var moment=require(_0x1b1d('0x4'));var BPromise=require(_0x1b1d('0x5'));var rp=require(_0x1b1d('0x6'));var fs=require('fs');var path=require(_0x1b1d('0x7'));var rimraf=require(_0x1b1d('0x8'));var config=require('../../config/environment');var attributes=require(_0x1b1d('0x9'));module['exports']=function(_0x4e4985,_0x1a402b){return _0x4e4985[_0x1b1d('0xa')](_0x1b1d('0xb'),attributes,{'tableName':_0x1b1d('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x1b1d('0xd'),_0x1b1d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe311=['mailbox','context','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x486cf7,_0x2dabb6){var _0x2dc8c5=function(_0xe16e91){while(--_0xe16e91){_0x486cf7['push'](_0x486cf7['shift']());}};_0x2dc8c5(++_0x2dabb6);}(_0xe311,0x1a2));var _0x1e31=function(_0x4d4c51,_0x4e67db){_0x4d4c51=_0x4d4c51-0x0;var _0x3f4aa3=_0xe311[_0x4d4c51];return _0x3f4aa3;};'use strict';var _=require('lodash');var util=require(_0x1e31('0x0'));var logger=require(_0x1e31('0x1'))('api');var moment=require(_0x1e31('0x2'));var BPromise=require(_0x1e31('0x3'));var rp=require(_0x1e31('0x4'));var fs=require('fs');var path=require(_0x1e31('0x5'));var rimraf=require(_0x1e31('0x6'));var config=require(_0x1e31('0x7'));var attributes=require(_0x1e31('0x8'));module[_0x1e31('0x9')]=function(_0x354b05,_0x435124){return _0x354b05[_0x1e31('0xa')](_0x1e31('0xb'),attributes,{'tableName':_0x1e31('0xc'),'paranoid':![],'indexes':[{'name':_0x1e31('0xd'),'fields':[_0x1e31('0xe'),_0x1e31('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4d4cc82..ba1d3ab 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 _0x2796=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f64e8,_0x4ec85b){var _0x11613b=function(_0xa03035){while(--_0xa03035){_0x2f64e8['push'](_0x2f64e8['shift']());}};_0x11613b(++_0x4ec85b);}(_0x2796,0x1b3));var _0x6279=function(_0x32362b,_0xcc5ca4){_0x32362b=_0x32362b-0x0;var _0x302ba2=_0x2796[_0x32362b];return _0x302ba2;};'use strict';var _=require('lodash');var util=require(_0x6279('0x0'));var moment=require(_0x6279('0x1'));var BPromise=require('bluebird');var rs=require(_0x6279('0x2'));var fs=require('fs');var Redis=require(_0x6279('0x3'));var db=require(_0x6279('0x4'))['db'];var utils=require(_0x6279('0x5'));var logger=require('../../config/logger')(_0x6279('0x6'));var config=require('../../config/environment');var jayson=require(_0x6279('0x7'));var client=jayson[_0x6279('0x8')][_0x6279('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6ac8c,_0x2dad87,_0x11a73c){return new BPromise(function(_0x4e9083,_0x1d01fd){return client[_0x6279('0xa')](_0x6ac8c,_0x11a73c)[_0x6279('0xb')](function(_0x30872a){logger[_0x6279('0xc')](_0x6279('0xd'),_0x2dad87,_0x6279('0xe'));logger[_0x6279('0xf')](_0x6279('0x10'),_0x2dad87,_0x6279('0xe'),JSON[_0x6279('0x11')](_0x30872a));if(_0x30872a[_0x6279('0x12')]){if(_0x30872a[_0x6279('0x12')][_0x6279('0x13')]===0x1f4){logger[_0x6279('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);return _0x1d01fd(_0x30872a['error'][_0x6279('0x14')]);}logger[_0x6279('0x12')](_0x6279('0xd'),_0x2dad87,_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);return _0x4e9083(_0x30872a[_0x6279('0x12')][_0x6279('0x14')]);}else{logger[_0x6279('0xc')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x6279('0xe'));_0x4e9083(_0x30872a['result']['message']);}})[_0x6279('0x15')](function(_0x5b2b1e){logger[_0x6279('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2dad87,_0x5b2b1e);_0x1d01fd(_0x5b2b1e);});});} \ No newline at end of file +var _0xf30a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment'];(function(_0x161cd2,_0x46b260){var _0x219cd1=function(_0x893a74){while(--_0x893a74){_0x161cd2['push'](_0x161cd2['shift']());}};_0x219cd1(++_0x46b260);}(_0xf30a,0x140));var _0xaf30=function(_0x3ae7e6,_0x54c593){_0x3ae7e6=_0x3ae7e6-0x0;var _0x4373d8=_0xf30a[_0x3ae7e6];return _0x4373d8;};'use strict';var _=require('lodash');var util=require(_0xaf30('0x0'));var moment=require(_0xaf30('0x1'));var BPromise=require(_0xaf30('0x2'));var rs=require(_0xaf30('0x3'));var fs=require('fs');var Redis=require(_0xaf30('0x4'));var db=require(_0xaf30('0x5'))['db'];var utils=require(_0xaf30('0x6'));var logger=require(_0xaf30('0x7'))('rpc');var config=require(_0xaf30('0x8'));var jayson=require(_0xaf30('0x9'));var client=jayson[_0xaf30('0xa')][_0xaf30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10ebca,_0x1d6a8e,_0x2bb2e8){return new BPromise(function(_0x425a2c,_0x3e2e5c){return client[_0xaf30('0xc')](_0x10ebca,_0x2bb2e8)[_0xaf30('0xd')](function(_0x36644b){logger[_0xaf30('0xe')](_0xaf30('0xf'),_0x1d6a8e,_0xaf30('0x10'));logger[_0xaf30('0x11')](_0xaf30('0x12'),_0x1d6a8e,'request\x20sent',JSON['stringify'](_0x36644b));if(_0x36644b[_0xaf30('0x13')]){if(_0x36644b[_0xaf30('0x13')][_0xaf30('0x14')]===0x1f4){logger[_0xaf30('0x13')](_0xaf30('0xf'),_0x1d6a8e,_0x36644b['error'][_0xaf30('0x15')]);return _0x3e2e5c(_0x36644b['error'][_0xaf30('0x15')]);}logger[_0xaf30('0x13')](_0xaf30('0xf'),_0x1d6a8e,_0x36644b[_0xaf30('0x13')][_0xaf30('0x15')]);return _0x425a2c(_0x36644b['error'][_0xaf30('0x15')]);}else{logger[_0xaf30('0xe')]('VoiceMail,\x20%s,\x20%s',_0x1d6a8e,_0xaf30('0x10'));_0x425a2c(_0x36644b['result'][_0xaf30('0x15')]);}})[_0xaf30('0x16')](function(_0x1e0822){logger[_0xaf30('0x13')](_0xaf30('0xf'),_0x1d6a8e,_0x1e0822);_0x3e2e5c(_0x1e0822);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 48b92db..0d7f995 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x7217=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5f31b8,_0x581c7a){var _0xfa5b03=function(_0x21189d){while(--_0x21189d){_0x5f31b8['push'](_0x5f31b8['shift']());}};_0xfa5b03(++_0x581c7a);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'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['put'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0x11')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);module[_0x7721('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 000ba36..7a6b81f 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 _0x642a=['getDataValue','STRING','TIMESTAMP','sequelize','VIRTUAL'];(function(_0x3110b9,_0x194c4c){var _0x1eb6b6=function(_0x10ef65){while(--_0x10ef65){_0x3110b9['push'](_0x3110b9['shift']());}};_0x1eb6b6(++_0x194c4c);}(_0x642a,0x120));var _0xa642=function(_0x15b32b,_0x26b269){_0x15b32b=_0x15b32b-0x0;var _0x55aebb=_0x642a[_0x15b32b];return _0x55aebb;};'use strict';var Sequelize=require(_0xa642('0x0'));module['exports']={'name':{'type':Sequelize[_0xa642('0x1')],'get':function(_0x3d4353){return this[_0xa642('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa642('0x3')],'defaultValue':''},'stamp':{'type':_0xa642('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x9c86=['long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9c86,0x173));var _0x69c8=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x9c86[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0x69c8('0x0'));module[_0x69c8('0x1')]={'name':{'type':Sequelize[_0x69c8('0x2')],'get':function(_0xd468f2){return this[_0x69c8('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x69c8('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x69c8('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x69c8('0x6')](_0x69c8('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x69c8('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 be12a22..58e3f79 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 _0x878f=['request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','VoiceMailMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','rawAttributes','length','include','find','body','catch','update','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4cf84a,_0x8f3353){var _0x46cd6b=function(_0x6e454e){while(--_0x6e454e){_0x4cf84a['push'](_0x4cf84a['shift']());}};_0x46cd6b(++_0x8f3353);}(_0x878f,0x173));var _0xf878=function(_0x4ecbd0,_0x4c2a3d){_0x4ecbd0=_0x4ecbd0-0x0;var _0xefc830=_0x878f[_0x4ecbd0];return _0xefc830;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf878('0x0'));var rimraf=require(_0xf878('0x1'));var zipdir=require(_0xf878('0x2'));var jsonpatch=require(_0xf878('0x3'));var rp=require(_0xf878('0x4'));var moment=require(_0xf878('0x5'));var BPromise=require(_0xf878('0x6'));var Mustache=require(_0xf878('0x7'));var util=require(_0xf878('0x8'));var path=require(_0xf878('0x9'));var sox=require(_0xf878('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xe'));var authService=require(_0xf878('0xf'));var qs=require(_0xf878('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x11'));var logger=require(_0xf878('0x12'))('api');var utils=require(_0xf878('0x13'));var config=require('../../config/environment');var db=require(_0xf878('0x14'))['db'];function respondWithStatusCode(_0x97c396,_0x339c9c){_0x339c9c=_0x339c9c||0xcc;return function(_0x596fb5){if(_0x596fb5){return _0x97c396[_0xf878('0x15')](_0x339c9c);}return _0x97c396[_0xf878('0x16')](_0x339c9c)[_0xf878('0x17')]();};}function respondWithResult(_0x570dcc,_0xe2c2de){_0xe2c2de=_0xe2c2de||0xc8;return function(_0x3902f7){if(_0x3902f7){return _0x570dcc[_0xf878('0x16')](_0xe2c2de)['json'](_0x3902f7);}};}function respondWithFilteredResult(_0x568a3a,_0x4c0948){return function(_0x35ff2d){if(_0x35ff2d){var _0x31d888=_0x35ff2d[_0xf878('0x18')],_0x6dbeca=_0x4c0948[_0xf878('0x19')],_0x44aacc=_0x4c0948[_0xf878('0x19')]+_0x4c0948[_0xf878('0x1a')],_0x186a02;if(_0x44aacc>=_0x31d888){_0x44aacc=_0x31d888;_0x186a02=0xc8;}else{_0x186a02=0xce;}_0x568a3a[_0xf878('0x16')](_0x186a02);return _0x568a3a['set'](_0xf878('0x1b'),_0x6dbeca+'-'+_0x44aacc+'/'+_0x31d888)[_0xf878('0x1c')](_0x35ff2d);}return null;};}function patchUpdates(_0x412de1){return function(_0x622ea8){try{jsonpatch[_0xf878('0x1d')](_0x622ea8,_0x412de1,!![]);}catch(_0x237d15){return BPromise[_0xf878('0x1e')](_0x237d15);}return _0x622ea8['save']();};}function saveUpdates(_0x73f6bf,_0x140866){return function(_0x250f85){if(_0x250f85){return _0x250f85['update'](_0x73f6bf)[_0xf878('0x1f')](function(_0x23590c){return _0x23590c;});}return null;};}function removeEntity(_0xacc440,_0x392822){return function(_0x22d884){if(_0x22d884){return _0x22d884[_0xf878('0x20')]()[_0xf878('0x1f')](function(){_0xacc440[_0xf878('0x16')](0xcc)[_0xf878('0x17')]();});}};}function handleEntityNotFound(_0x1a6506,_0x45e61f){return function(_0x566995){if(!_0x566995){_0x1a6506[_0xf878('0x15')](0x194);}return _0x566995;};}function handleError(_0x5b0b06,_0xa3d3d3){_0xa3d3d3=_0xa3d3d3||0x1f4;return function(_0x12b32f){logger[_0xf878('0x21')](_0x12b32f[_0xf878('0x22')]);if(_0x12b32f[_0xf878('0x23')]){delete _0x12b32f['name'];}_0x5b0b06['status'](_0xa3d3d3)['send'](_0x12b32f);};}exports[_0xf878('0x24')]=function(_0x3baba4,_0x38fa87){var _0x5af87f={},_0xfa3e11={},_0x2e2256={'count':0x0,'rows':[]};var _0x3e848d=_[_0xf878('0x25')](db[_0xf878('0x26')]['rawAttributes'],function(_0x502322){return{'name':_0x502322[_0xf878('0x27')],'type':_0x502322[_0xf878('0x28')]['key']};});_0xfa3e11[_0xf878('0x29')]=_['differenceBy'](_[_0xf878('0x25')](_0x3e848d,'name'),[_0xf878('0x23')]);_0xfa3e11['query']=_[_0xf878('0x2a')](_0x3baba4['query']);_0xfa3e11[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0xfa3e11[_0xf878('0x29')],_0xfa3e11[_0xf878('0x2d')]);_0x5af87f[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0xfa3e11['model'],qs[_0xf878('0x2f')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x2f')]));_0x5af87f[_0xf878('0x2e')]=_0x5af87f[_0xf878('0x2e')]['length']?_0x5af87f[_0xf878('0x2e')]:_0xfa3e11[_0xf878('0x29')];if(!_0x3baba4['query'][_0xf878('0x30')](_0xf878('0x31'))){_0x5af87f[_0xf878('0x1a')]=qs[_0xf878('0x1a')](_0x3baba4[_0xf878('0x2d')]['limit']);_0x5af87f[_0xf878('0x19')]=qs[_0xf878('0x19')](_0x3baba4[_0xf878('0x2d')][_0xf878('0x19')]);}_0x5af87f['order']=qs[_0xf878('0x32')](_0x3baba4['query']['sort']);_0x5af87f[_0xf878('0x33')]=qs[_0xf878('0x2b')](_[_0xf878('0x34')](_0x3baba4[_0xf878('0x2d')],_0xfa3e11[_0xf878('0x2b')]),_0x3e848d);if(_0x3baba4['query'][_0xf878('0x35')]){_0x5af87f['where']=_[_0xf878('0x36')](_0x5af87f[_0xf878('0x33')],{'$or':_['map'](_0x3e848d,function(_0x1489d5){if(_0x1489d5[_0xf878('0x28')]!=='VIRTUAL'){var _0x329f0b={};_0x329f0b[_0x1489d5[_0xf878('0x23')]]={'$like':'%'+_0x3baba4['query'][_0xf878('0x35')]+'%'};return _0x329f0b;}})});}_0x5af87f=_[_0xf878('0x36')]({},_0x5af87f,_0x3baba4[_0xf878('0x37')]);var _0xc8eb91={'where':_0x5af87f[_0xf878('0x33')]};return db[_0xf878('0x26')][_0xf878('0x18')](_0xc8eb91)['then'](function(_0x1179fb){_0x2e2256[_0xf878('0x18')]=_0x1179fb;if(_0x3baba4['query'][_0xf878('0x38')]){_0x5af87f['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf878('0x39')](_0x5af87f);})[_0xf878('0x1f')](function(_0x43b03e){_0x2e2256[_0xf878('0x3a')]=_0x43b03e;return _0x2e2256;})[_0xf878('0x1f')](respondWithFilteredResult(_0x38fa87,_0x5af87f))['catch'](handleError(_0x38fa87,null));};exports[_0xf878('0x3b')]=function(_0x4c4ae4,_0xb09736){var _0x2801b0={'raw':!![],'where':{'id':_0x4c4ae4['params']['id']}},_0x4f6be1={};_0x4f6be1[_0xf878('0x29')]=_[_0xf878('0x2a')](db[_0xf878('0x26')][_0xf878('0x3c')]);_0x4f6be1[_0xf878('0x2d')]=_[_0xf878('0x2a')](_0x4c4ae4[_0xf878('0x2d')]);_0x4f6be1[_0xf878('0x2b')]=_[_0xf878('0x2c')](_0x4f6be1['model'],_0x4f6be1[_0xf878('0x2d')]);_0x2801b0[_0xf878('0x2e')]=_[_0xf878('0x2c')](_0x4f6be1[_0xf878('0x29')],qs[_0xf878('0x2f')](_0x4c4ae4[_0xf878('0x2d')]['fields']));_0x2801b0[_0xf878('0x2e')]=_0x2801b0[_0xf878('0x2e')][_0xf878('0x3d')]?_0x2801b0[_0xf878('0x2e')]:_0x4f6be1[_0xf878('0x29')];if(_0x4c4ae4['query'][_0xf878('0x38')]){_0x2801b0[_0xf878('0x3e')]=[{'all':!![]}];}_0x2801b0=_[_0xf878('0x36')]({},_0x2801b0,_0x4c4ae4[_0xf878('0x37')]);return db['VoiceMailMessage'][_0xf878('0x3f')](_0x2801b0)[_0xf878('0x1f')](handleEntityNotFound(_0xb09736,null))[_0xf878('0x1f')](respondWithResult(_0xb09736,null))['catch'](handleError(_0xb09736,null));};exports['create']=function(_0x9c2fa3,_0x5bf396){return db['VoiceMailMessage']['create'](_0x9c2fa3[_0xf878('0x40')],{})['then'](respondWithResult(_0x5bf396,0xc9))[_0xf878('0x41')](handleError(_0x5bf396,null));};exports[_0xf878('0x42')]=function(_0x1dcb19,_0x1ff60b){if(_0x1dcb19[_0xf878('0x40')]['id']){delete _0x1dcb19[_0xf878('0x40')]['id'];}return db[_0xf878('0x26')]['find']({'where':{'id':_0x1dcb19[_0xf878('0x43')]['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x1ff60b,null))[_0xf878('0x1f')](saveUpdates(_0x1dcb19[_0xf878('0x40')],null))[_0xf878('0x1f')](respondWithResult(_0x1ff60b,null))['catch'](handleError(_0x1ff60b,null));};exports['destroy']=function(_0xb4f8fb,_0x18c9dc){return db['VoiceMailMessage'][_0xf878('0x3f')]({'where':{'id':_0xb4f8fb['params']['id']}})[_0xf878('0x1f')](handleEntityNotFound(_0x18c9dc,null))[_0xf878('0x1f')](removeEntity(_0x18c9dc,null))[_0xf878('0x41')](handleError(_0x18c9dc,null));};exports[_0xf878('0x44')]=function(_0x5411c2,_0xf0d960,_0xd8fbc9){return db[_0xf878('0x26')]['find']({'where':{'id':_0x5411c2[_0xf878('0x43')]['id']},'attributes':['id',_0xf878('0x45'),_0xf878('0x46')]})[_0xf878('0x1f')](handleEntityNotFound(_0xf0d960,null))['then'](function(_0x112f2a){if(_0x112f2a){if(!_0x112f2a[_0xf878('0x45')]){throw new db[(_0xf878('0x47'))]['ValidationError'](_0xf878('0x48'));}var _0xdfa29b={'Content-Type':_0xf878('0x49'),'Content-Disposition':_0xf878('0x4a')};if(_0x112f2a['msg_id']){_0xdfa29b['Content-Disposition']='attachment;\x20filename=\x22'+_0x112f2a[_0xf878('0x46')]+'.wav\x22';}_0xf0d960['set'](_0xdfa29b);return _0xf0d960['send'](new Buffer(_0x112f2a[_0xf878('0x45')]));}})[_0xf878('0x41')](handleError(_0xf0d960,null));}; \ No newline at end of file +var _0x70e0=['../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','name','query','keys','filters','intersection','attributes','order','sort','pick','where','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','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'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x70e0,0x17b));var _0x070e=function(_0x289d93,_0x12f3b3){_0x289d93=_0x289d93-0x0;var _0x32c674=_0x70e0[_0x289d93];return _0x32c674;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x2c')](_['map'](_0x1d72d6,'name'),[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x1743cc['query']);_0x374c54[_0x070e('0x30')]=_[_0x070e('0x31')](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2e')]);_0x497f58['attributes']=_['intersection'](_0x374c54['model'],qs['fields'](_0x1743cc[_0x070e('0x2e')]['fields']));_0x497f58[_0x070e('0x32')]=_0x497f58[_0x070e('0x32')]['length']?_0x497f58['attributes']:_0x374c54[_0x070e('0x2b')];if(!_0x1743cc[_0x070e('0x2e')]['hasOwnProperty']('nolimit')){_0x497f58[_0x070e('0x19')]=qs[_0x070e('0x19')](_0x1743cc[_0x070e('0x2e')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs['offset'](_0x1743cc['query'][_0x070e('0x18')]);}_0x497f58[_0x070e('0x33')]=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2e')][_0x070e('0x34')]);_0x497f58['where']=qs[_0x070e('0x30')](_[_0x070e('0x35')](_0x1743cc['query'],_0x374c54[_0x070e('0x30')]),_0x1d72d6);if(_0x1743cc[_0x070e('0x2e')]['filter']){_0x497f58['where']=_['merge'](_0x497f58[_0x070e('0x36')],{'$or':_[_0x070e('0x26')](_0x1d72d6,function(_0x39dfaa){if(_0x39dfaa[_0x070e('0x37')]!==_0x070e('0x38')){var _0x5e3827={};_0x5e3827[_0x39dfaa[_0x070e('0x2d')]]={'$like':'%'+_0x1743cc[_0x070e('0x2e')][_0x070e('0x39')]+'%'};return _0x5e3827;}})});}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x3a')]);var _0x72cbc7={'where':_0x497f58[_0x070e('0x36')]};return db['VoiceMailMessage'][_0x070e('0x3b')](_0x72cbc7)[_0x070e('0x20')](function(_0x4800a9){_0x219e48[_0x070e('0x3b')]=_0x4800a9;if(_0x1743cc['query'][_0x070e('0x3c')]){_0x497f58[_0x070e('0x3d')]=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x47b929){_0x219e48[_0x070e('0x3f')]=_0x47b929;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))['catch'](handleError(_0x4763c6,null));};exports[_0x070e('0x40')]=function(_0x42c448,_0x38879f){var _0x4d52ff={'raw':!![],'where':{'id':_0x42c448[_0x070e('0x41')]['id']}},_0x2ad56c={};_0x2ad56c[_0x070e('0x2b')]=_[_0x070e('0x2f')](db['VoiceMailMessage'][_0x070e('0x28')]);_0x2ad56c['query']=_['keys'](_0x42c448['query']);_0x2ad56c[_0x070e('0x30')]=_[_0x070e('0x31')](_0x2ad56c[_0x070e('0x2b')],_0x2ad56c[_0x070e('0x2e')]);_0x4d52ff[_0x070e('0x32')]=_['intersection'](_0x2ad56c[_0x070e('0x2b')],qs['fields'](_0x42c448[_0x070e('0x2e')][_0x070e('0x42')]));_0x4d52ff[_0x070e('0x32')]=_0x4d52ff['attributes']['length']?_0x4d52ff[_0x070e('0x32')]:_0x2ad56c['model'];if(_0x42c448[_0x070e('0x2e')][_0x070e('0x3c')]){_0x4d52ff[_0x070e('0x3d')]=[{'all':!![]}];}_0x4d52ff=_['merge']({},_0x4d52ff,_0x42c448[_0x070e('0x3a')]);return db[_0x070e('0x27')]['find'](_0x4d52ff)['then'](handleEntityNotFound(_0x38879f,null))[_0x070e('0x20')](respondWithResult(_0x38879f,null))[_0x070e('0x43')](handleError(_0x38879f,null));};exports[_0x070e('0x44')]=function(_0x1fc7c4,_0x253e11){return db['VoiceMailMessage'][_0x070e('0x44')](_0x1fc7c4[_0x070e('0x45')],{})[_0x070e('0x20')](respondWithResult(_0x253e11,0xc9))[_0x070e('0x43')](handleError(_0x253e11,null));};exports[_0x070e('0x1f')]=function(_0xcd1c61,_0x1f54d5){if(_0xcd1c61[_0x070e('0x45')]['id']){delete _0xcd1c61[_0x070e('0x45')]['id'];}return db[_0x070e('0x27')][_0x070e('0x46')]({'where':{'id':_0xcd1c61[_0x070e('0x41')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x1f54d5,null))[_0x070e('0x20')](saveUpdates(_0xcd1c61[_0x070e('0x45')],null))['then'](respondWithResult(_0x1f54d5,null))[_0x070e('0x43')](handleError(_0x1f54d5,null));};exports[_0x070e('0x21')]=function(_0x40298a,_0x249e3f){return db[_0x070e('0x27')][_0x070e('0x46')]({'where':{'id':_0x40298a[_0x070e('0x41')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x249e3f,null))[_0x070e('0x20')](removeEntity(_0x249e3f,null))['catch'](handleError(_0x249e3f,null));};exports[_0x070e('0x47')]=function(_0x4c22da,_0x1acddb,_0x2be643){return db['VoiceMailMessage'][_0x070e('0x46')]({'where':{'id':_0x4c22da[_0x070e('0x41')]['id']},'attributes':['id',_0x070e('0x48'),_0x070e('0x49')]})[_0x070e('0x20')](handleEntityNotFound(_0x1acddb,null))[_0x070e('0x20')](function(_0x83f21e){if(_0x83f21e){if(!_0x83f21e['recording']){throw new db[(_0x070e('0x4a'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x3a06c6={'Content-Type':_0x070e('0x4b'),'Content-Disposition':_0x070e('0x4c')};if(_0x83f21e[_0x070e('0x49')]){_0x3a06c6[_0x070e('0x4d')]=_0x070e('0x4e')+_0x83f21e[_0x070e('0x49')]+_0x070e('0x4f');}_0x1acddb['set'](_0x3a06c6);return _0x1acddb[_0x070e('0x24')](new Buffer(_0x83f21e['recording']));}})['catch'](handleError(_0x1acddb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 56acfc1..a9b4e24 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 _0x2b65=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x2d2351,_0x153be9){var _0x5600cc=function(_0x554839){while(--_0x554839){_0x2d2351['push'](_0x2d2351['shift']());}};_0x5600cc(++_0x153be9);}(_0x2b65,0x131));var _0x52b6=function(_0x4eebd9,_0x57afb9){_0x4eebd9=_0x4eebd9-0x0;var _0x1d6117=_0x2b65[_0x4eebd9];return _0x1d6117;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var logger=require(_0x52b6('0x2'))(_0x52b6('0x3'));var moment=require(_0x52b6('0x4'));var BPromise=require(_0x52b6('0x5'));var rp=require(_0x52b6('0x6'));var fs=require('fs');var path=require(_0x52b6('0x7'));var rimraf=require('rimraf');var config=require(_0x52b6('0x8'));var attributes=require(_0x52b6('0x9'));module[_0x52b6('0xa')]=function(_0x2c643d,_0x25593f){return _0x2c643d[_0x52b6('0xb')](_0x52b6('0xc'),attributes,{'tableName':_0x52b6('0xd'),'paranoid':![],'indexes':[{'name':_0x52b6('0xe'),'fields':[_0x52b6('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x349e=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x5c318d,_0x31c5dd){var _0x24ab8e=function(_0xd8ef60){while(--_0xd8ef60){_0x5c318d['push'](_0x5c318d['shift']());}};_0x24ab8e(++_0x31c5dd);}(_0x349e,0xcb));var _0xe349=function(_0x205584,_0x1f1115){_0x205584=_0x205584-0x0;var _0x4f2374=_0x349e[_0x205584];return _0x4f2374;};'use strict';var _=require(_0xe349('0x0'));var util=require(_0xe349('0x1'));var logger=require(_0xe349('0x2'))(_0xe349('0x3'));var moment=require(_0xe349('0x4'));var BPromise=require(_0xe349('0x5'));var rp=require(_0xe349('0x6'));var fs=require('fs');var path=require(_0xe349('0x7'));var rimraf=require(_0xe349('0x8'));var config=require('../../config/environment');var attributes=require(_0xe349('0x9'));module['exports']=function(_0x55aae6,_0xb21068){return _0x55aae6['define'](_0xe349('0xa'),attributes,{'tableName':_0xe349('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xe349('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 a2f57b6..1fc60fc 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xfcbf57,_0x4b05fd){var _0x1078fa=function(_0xb65856){while(--_0xb65856){_0xfcbf57['push'](_0xfcbf57['shift']());}};_0x1078fa(++_0x4b05fd);}(_0x14a0,0x8e));var _0x014a=function(_0x32b185,_0x4bead4){_0x32b185=_0x32b185-0x0;var _0x5b3f73=_0x14a0[_0x32b185];return _0x5b3f73;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5e4740,_0x2e4ed7){var _0x314894=function(_0x35d383){while(--_0x35d383){_0x5e4740['push'](_0x5e4740['shift']());}};_0x314894(++_0x2e4ed7);}(_0x14a0,0x8e));var _0x014a=function(_0x3b2859,_0x1f0e63){_0x3b2859=_0x3b2859-0x0;var _0x329595=_0x14a0[_0x3b2859];return _0x329595;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e4a00f2..bd1085a 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 _0x0ae2=['/:id/sounds','getSounds','post','create','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show'];(function(_0x361b27,_0x3778c8){var _0x514d90=function(_0x48abf6){while(--_0x48abf6){_0x361b27['push'](_0x361b27['shift']());}};_0x514d90(++_0x3778c8);}(_0x0ae2,0xa5));var _0x20ae=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0x0ae2[_0x2ecc65];return _0x103cc3;};'use strict';var multer=require(_0x20ae('0x0'));var util=require('util');var path=require(_0x20ae('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20ae('0x2')]();var auth=require(_0x20ae('0x3'));var interaction=require(_0x20ae('0x4'));var config=require(_0x20ae('0x5'));var controller=require(_0x20ae('0x6'));router[_0x20ae('0x7')]('/',auth[_0x20ae('0x8')](),controller[_0x20ae('0x9')]);router[_0x20ae('0x7')]('/:id',auth[_0x20ae('0x8')](),controller[_0x20ae('0xa')]);router[_0x20ae('0x7')](_0x20ae('0xb'),auth[_0x20ae('0x8')](),controller[_0x20ae('0xc')]);router[_0x20ae('0xd')]('/',auth['isAuthenticated'](),controller[_0x20ae('0xe')]);router[_0x20ae('0xd')]('/:id/sounds',auth[_0x20ae('0x8')](),controller['addSound']);router['put'](_0x20ae('0xf'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x10')]);router[_0x20ae('0x11')](_0x20ae('0xf'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x12')]);router[_0x20ae('0x11')](_0x20ae('0x13'),auth[_0x20ae('0x8')](),controller[_0x20ae('0x14')]);module[_0x20ae('0x15')]=router; \ No newline at end of file +var _0x7c21=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout'];(function(_0x598e92,_0x544197){var _0x2b7ad4=function(_0x325f92){while(--_0x325f92){_0x598e92['push'](_0x598e92['shift']());}};_0x2b7ad4(++_0x544197);}(_0x7c21,0xa5));var _0x17c2=function(_0x458666,_0x29d66d){_0x458666=_0x458666-0x0;var _0x135a4a=_0x7c21[_0x458666];return _0x135a4a;};'use strict';var multer=require(_0x17c2('0x0'));var util=require('util');var path=require(_0x17c2('0x1'));var timeout=require(_0x17c2('0x2'));var express=require(_0x17c2('0x3'));var router=express[_0x17c2('0x4')]();var auth=require(_0x17c2('0x5'));var interaction=require(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var controller=require(_0x17c2('0x8'));router['get']('/',auth[_0x17c2('0x9')](),controller['index']);router[_0x17c2('0xa')](_0x17c2('0xb'),auth['isAuthenticated'](),controller[_0x17c2('0xc')]);router['get'](_0x17c2('0xd'),auth[_0x17c2('0x9')](),controller[_0x17c2('0xe')]);router[_0x17c2('0xf')]('/',auth['isAuthenticated'](),controller[_0x17c2('0x10')]);router[_0x17c2('0xf')]('/:id/sounds',auth[_0x17c2('0x9')](),controller[_0x17c2('0x11')]);router[_0x17c2('0x12')](_0x17c2('0xb'),auth[_0x17c2('0x9')](),controller[_0x17c2('0x13')]);router['delete'](_0x17c2('0xb'),auth[_0x17c2('0x9')](),controller[_0x17c2('0x14')]);router['delete'](_0x17c2('0x15'),auth['isAuthenticated'](),controller[_0x17c2('0x16')]);module[_0x17c2('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 2e13518..867bd92 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 _0x58b1=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0xb1bae1,_0x171c58){var _0x2e25b7=function(_0x116549){while(--_0x116549){_0xb1bae1['push'](_0xb1bae1['shift']());}};_0x2e25b7(++_0x171c58);}(_0x58b1,0x184));var _0x158b=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x58b1[_0x4c184d];return _0x23d997;};'use strict';var Sequelize=require(_0x158b('0x0'));module['exports']={'name':{'type':Sequelize[_0x158b('0x1')],'allowNull':![],'unique':_0x158b('0x2')},'mode':{'type':Sequelize[_0x158b('0x3')](_0x158b('0x4'),_0x158b('0x5'),_0x158b('0x6'),_0x158b('0x7'),'quietmp3',_0x158b('0x8')),'allowNull':!![],'defaultValue':_0x158b('0x5')},'directory':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![],'defaultValue':_0x158b('0x9')},'format':{'type':Sequelize[_0x158b('0x1')],'allowNull':!![]},'stamp':{'type':_0x158b('0xa')},'defaultEntry':{'type':Sequelize[_0x158b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc79e=['quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','STRING','ENUM','custom','mp3nb','quietmp3nb'];(function(_0x4da1d1,_0x7e80bf){var _0x42b10c=function(_0x18ada4){while(--_0x18ada4){_0x4da1d1['push'](_0x4da1d1['shift']());}};_0x42b10c(++_0x7e80bf);}(_0xc79e,0xcc));var _0xec79=function(_0x561a85,_0x36d66a){_0x561a85=_0x561a85-0x0;var _0x1520a3=_0xc79e[_0x561a85];return _0x1520a3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec79('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xec79('0x1')](_0xec79('0x2'),'files',_0xec79('0x3'),_0xec79('0x4'),_0xec79('0x5'),_0xec79('0x6')),'allowNull':!![],'defaultValue':_0xec79('0x7')},'directory':{'type':Sequelize[_0xec79('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0xec79('0x0')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xec79('0x0')],'allowNull':!![],'defaultValue':_0xec79('0x8')},'format':{'type':Sequelize[_0xec79('0x0')],'allowNull':!![]},'stamp':{'type':_0xec79('0x9')},'defaultEntry':{'type':Sequelize[_0xec79('0xa')],'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 9003d5b..f535b08 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x510a1f,_0x5908ec){var _0x54f45b=function(_0x421f48){while(--_0x421f48){_0x510a1f['push'](_0x510a1f['shift']());}};_0x54f45b(++_0x5908ec);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x52cad3,_0x125f41){var _0x1ab123=function(_0x2fbbab){while(--_0x2fbbab){_0x52cad3['push'](_0x52cad3['shift']());}};_0x1ab123(++_0x125f41);}(_0xb10b,0x12a));var _0xbb10=function(_0x52ef79,_0x23f3f0){_0x52ef79=_0x52ef79-0x0;var _0x23f33f=_0xb10b[_0x52ef79];return _0x23f33f;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4595e6a..f3142ae 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 _0x3cff=['exports','define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes'];(function(_0x331a56,_0x365331){var _0x4336aa=function(_0xc1fee7){while(--_0xc1fee7){_0x331a56['push'](_0x331a56['shift']());}};_0x4336aa(++_0x365331);}(_0x3cff,0xc3));var _0xf3cf=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x3cff[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0xf3cf('0x0'));var util=require(_0xf3cf('0x1'));var logger=require(_0xf3cf('0x2'))(_0xf3cf('0x3'));var moment=require('moment');var BPromise=require(_0xf3cf('0x4'));var rp=require(_0xf3cf('0x5'));var fs=require('fs');var path=require(_0xf3cf('0x6'));var rimraf=require(_0xf3cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3cf('0x8'));module[_0xf3cf('0x9')]=function(_0x582dc2,_0x2e473b){return _0x582dc2[_0xf3cf('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xf3cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d6=['api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x57d6,0xb3));var _0x657d=function(_0x2b26c5,_0x547bea){_0x2b26c5=_0x2b26c5-0x0;var _0xfc7f7f=_0x57d6[_0x2b26c5];return _0xfc7f7f;};'use strict';var _=require('lodash');var util=require(_0x657d('0x0'));var logger=require('../../config/logger')(_0x657d('0x1'));var moment=require(_0x657d('0x2'));var BPromise=require(_0x657d('0x3'));var rp=require(_0x657d('0x4'));var fs=require('fs');var path=require(_0x657d('0x5'));var rimraf=require('rimraf');var config=require(_0x657d('0x6'));var attributes=require(_0x657d('0x7'));module[_0x657d('0x8')]=function(_0x4f1bd1,_0x7d7af4){return _0x4f1bd1['define'](_0x657d('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index be8cb9c..3ae0d5b 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 _0x5b39=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x21c540,_0x52f6e0){var _0x489bf0=function(_0x5c6374){while(--_0x5c6374){_0x21c540['push'](_0x21c540['shift']());}};_0x489bf0(++_0x52f6e0);}(_0x5b39,0x70));var _0x95b3=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x5b39[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x95b3('0x0'));var util=require(_0x95b3('0x1'));var moment=require(_0x95b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95b3('0x3'));var db=require(_0x95b3('0x4'))['db'];var utils=require(_0x95b3('0x5'));var logger=require('../../config/logger')(_0x95b3('0x6'));var config=require('../../config/environment');var jayson=require(_0x95b3('0x7'));var client=jayson[_0x95b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x502051,_0x40119f,_0x63b4e8){return new BPromise(function(_0x5c9f07,_0x5c1456){return client['request'](_0x502051,_0x63b4e8)[_0x95b3('0x9')](function(_0x18770f){logger[_0x95b3('0xa')](_0x95b3('0xb'),_0x40119f,'request\x20sent');logger[_0x95b3('0xc')](_0x95b3('0xd'),_0x40119f,_0x95b3('0xe'),JSON[_0x95b3('0xf')](_0x18770f));if(_0x18770f[_0x95b3('0x10')]){if(_0x18770f[_0x95b3('0x10')][_0x95b3('0x11')]===0x1f4){logger[_0x95b3('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x18770f['error'][_0x95b3('0x12')]);return _0x5c1456(_0x18770f[_0x95b3('0x10')][_0x95b3('0x12')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x18770f[_0x95b3('0x10')][_0x95b3('0x12')]);return _0x5c9f07(_0x18770f['error'][_0x95b3('0x12')]);}else{logger[_0x95b3('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x40119f,_0x95b3('0xe'));_0x5c9f07(_0x18770f[_0x95b3('0x13')][_0x95b3('0x12')]);}})[_0x95b3('0x14')](function(_0x2a425f){logger[_0x95b3('0x10')](_0x95b3('0xb'),_0x40119f,_0x2a425f);_0x5c1456(_0x2a425f);});});} \ No newline at end of file +var _0x4864=['rpc','../../config/environment','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','../../mysqldb'];(function(_0x875033,_0x5d107b){var _0x404184=function(_0x2e69e8){while(--_0x2e69e8){_0x875033['push'](_0x875033['shift']());}};_0x404184(++_0x5d107b);}(_0x4864,0x12e));var _0x4486=function(_0x3b2be3,_0x3e602d){_0x3b2be3=_0x3b2be3-0x0;var _0x511b35=_0x4864[_0x3b2be3];return _0x511b35;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4486('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4486('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4486('0x2'));var config=require(_0x4486('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x4486('0x4')][_0x4486('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xa63f01,_0x5867ab,_0x1efe94){return new BPromise(function(_0x1ad57f,_0x3b0807){return client[_0x4486('0x6')](_0xa63f01,_0x1efe94)[_0x4486('0x7')](function(_0x5ab6ca){logger[_0x4486('0x8')](_0x4486('0x9'),_0x5867ab,_0x4486('0xa'));logger[_0x4486('0xb')](_0x4486('0xc'),_0x5867ab,_0x4486('0xa'),JSON[_0x4486('0xd')](_0x5ab6ca));if(_0x5ab6ca['error']){if(_0x5ab6ca[_0x4486('0xe')]['code']===0x1f4){logger[_0x4486('0xe')](_0x4486('0x9'),_0x5867ab,_0x5ab6ca[_0x4486('0xe')]['message']);return _0x3b0807(_0x5ab6ca[_0x4486('0xe')]['message']);}logger[_0x4486('0xe')](_0x4486('0x9'),_0x5867ab,_0x5ab6ca[_0x4486('0xe')][_0x4486('0xf')]);return _0x1ad57f(_0x5ab6ca['error'][_0x4486('0xf')]);}else{logger[_0x4486('0x8')](_0x4486('0x9'),_0x5867ab,_0x4486('0xa'));_0x1ad57f(_0x5ab6ca['result'][_0x4486('0xf')]);}})['catch'](function(_0x21928b){logger[_0x4486('0xe')](_0x4486('0x9'),_0x5867ab,_0x21928b);_0x3b0807(_0x21928b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 019e10b..1d3cd79 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 _0x0398=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','post','create','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0x540ba2,_0x19e111){var _0x93d930=function(_0xe68a34){while(--_0xe68a34){_0x540ba2['push'](_0x540ba2['shift']());}};_0x93d930(++_0x19e111);}(_0x0398,0xaf));var _0x8039=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x0398[_0x39a2d6];return _0x23af66;};'use strict';var multer=require(_0x8039('0x0'));var util=require(_0x8039('0x1'));var path=require(_0x8039('0x2'));var timeout=require(_0x8039('0x3'));var express=require(_0x8039('0x4'));var router=express[_0x8039('0x5')]();var auth=require(_0x8039('0x6'));var interaction=require(_0x8039('0x7'));var config=require('../../config/environment');var controller=require(_0x8039('0x8'));router[_0x8039('0x9')]('/',auth[_0x8039('0xa')](),controller[_0x8039('0xb')]);router[_0x8039('0x9')](_0x8039('0xc'),auth[_0x8039('0xa')](),controller[_0x8039('0xd')]);router[_0x8039('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8039('0xe')]);router[_0x8039('0x9')]('/:id/users',auth[_0x8039('0xa')](),controller['getAgents']);router[_0x8039('0xf')]('/',auth[_0x8039('0xa')](),controller[_0x8039('0x10')]);router[_0x8039('0xf')]('/:id/users',auth[_0x8039('0xa')](),controller[_0x8039('0x11')]);router[_0x8039('0x12')](_0x8039('0x13'),auth[_0x8039('0xa')](),controller[_0x8039('0x14')]);router[_0x8039('0x15')]('/:id',auth[_0x8039('0xa')](),controller[_0x8039('0x16')]);router[_0x8039('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x8039('0x17')]);module[_0x8039('0x18')]=router; \ No newline at end of file +var _0x6f82=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','create','post','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6f82,0x76));var _0x26f8=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x6f82[_0x55d58f];return _0x1ad6e6;};'use strict';var multer=require('multer');var util=require(_0x26f8('0x0'));var path=require('path');var timeout=require(_0x26f8('0x1'));var express=require(_0x26f8('0x2'));var router=express[_0x26f8('0x3')]();var auth=require(_0x26f8('0x4'));var interaction=require(_0x26f8('0x5'));var config=require(_0x26f8('0x6'));var controller=require(_0x26f8('0x7'));router[_0x26f8('0x8')]('/',auth[_0x26f8('0x9')](),controller[_0x26f8('0xa')]);router['get'](_0x26f8('0xb'),auth[_0x26f8('0x9')](),controller['describe']);router['get'](_0x26f8('0xc'),auth['isAuthenticated'](),controller[_0x26f8('0xd')]);router['get'](_0x26f8('0xe'),auth[_0x26f8('0x9')](),controller['getAgents']);router['post']('/',auth[_0x26f8('0x9')](),controller[_0x26f8('0xf')]);router[_0x26f8('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x26f8('0x11')]);router[_0x26f8('0x12')](_0x26f8('0xc'),auth['isAuthenticated'](),controller[_0x26f8('0x13')]);router[_0x26f8('0x14')](_0x26f8('0xc'),auth['isAuthenticated'](),controller[_0x26f8('0x15')]);router[_0x26f8('0x14')](_0x26f8('0xe'),auth['isAuthenticated'](),controller[_0x26f8('0x16')]);module[_0x26f8('0x17')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d65ceae..6201dec 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 _0x85de=['STRING','name','VIRTUAL','system-','sequelize','exports'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x85de,0x1f0));var _0xe85d=function(_0x5138ca,_0xb49c6){_0x5138ca=_0x5138ca-0x0;var _0x249305=_0x85de[_0x5138ca];return _0x249305;};'use strict';var Sequelize=require(_0xe85d('0x0'));module[_0xe85d('0x1')]={'name':{'type':Sequelize[_0xe85d('0x2')],'allowNull':![],'unique':_0xe85d('0x3')},'prefix':{'type':Sequelize[_0xe85d('0x4')],'get':function(_0x57970c){return _0xe85d('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xe85d('0x2')]},'callerIdAll':{'type':Sequelize[_0xe85d('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2c54=['STRING','VIRTUAL','system-','getDataValue','name','INTEGER','sequelize','exports'];(function(_0x2c04d9,_0x59ec65){var _0x5ad09a=function(_0x5e2ce3){while(--_0x5e2ce3){_0x2c04d9['push'](_0x2c04d9['shift']());}};_0x5ad09a(++_0x59ec65);}(_0x2c54,0x136));var _0x42c5=function(_0x17fdf1,_0xd819ae){_0x17fdf1=_0x17fdf1-0x0;var _0x50cfec=_0x2c54[_0x17fdf1];return _0x50cfec;};'use strict';var Sequelize=require(_0x42c5('0x0'));module[_0x42c5('0x1')]={'name':{'type':Sequelize[_0x42c5('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x42c5('0x3')],'get':function(_0x46bcc4){return _0x42c5('0x4')+this[_0x42c5('0x5')](_0x42c5('0x6'))+'-';}},'description':{'type':Sequelize[_0x42c5('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x42c5('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 63267e6..e0c4120 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 _0x394d=['filter','where','merge','VIRTUAL','options','VoicePrefix','include','findAll','show','params','intersection','includeAll','find','describe','sequelize','transaction','body','get','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','User','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x394d,0xb9));var _0xd394=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x394d[_0x42bdad];return _0x122626;};'use strict';var pdf=require(_0xd394('0x0'));var emlformat=require(_0xd394('0x1'));var rimraf=require(_0xd394('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd394('0x3'));var moment=require('moment');var BPromise=require(_0xd394('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd394('0x5'));var sox=require(_0xd394('0x6'));var csv=require('to-csv');var ejs=require(_0xd394('0x7'));var fs=require('fs');var _=require(_0xd394('0x8'));var squel=require(_0xd394('0x9'));var crypto=require(_0xd394('0xa'));var jsforce=require(_0xd394('0xb'));var deskjs=require(_0xd394('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd394('0xd'));var Papa=require(_0xd394('0xe'));var Redis=require(_0xd394('0xf'));var authService=require(_0xd394('0x10'));var qs=require(_0xd394('0x11'));var as=require(_0xd394('0x12'));var hardwareService=require(_0xd394('0x13'));var logger=require(_0xd394('0x14'))(_0xd394('0x15'));var utils=require(_0xd394('0x16'));var config=require(_0xd394('0x17'));var db=require(_0xd394('0x18'))['db'];config[_0xd394('0x19')]=_[_0xd394('0x1a')](config[_0xd394('0x19')],{'host':_0xd394('0x1b'),'port':0x18eb});var socket=require(_0xd394('0x1c'))(new Redis(config[_0xd394('0x19')]));require(_0xd394('0x1d'))[_0xd394('0x1e')](socket);function respondWithStatusCode(_0x4f3e8d,_0x5c1646){_0x5c1646=_0x5c1646||0xcc;return function(_0x25b53f){if(_0x25b53f){return _0x4f3e8d['sendStatus'](_0x5c1646);}return _0x4f3e8d[_0xd394('0x1f')](_0x5c1646)[_0xd394('0x20')]();};}function respondWithResult(_0x3f1fcb,_0x24511f){_0x24511f=_0x24511f||0xc8;return function(_0x115d6b){if(_0x115d6b){return _0x3f1fcb[_0xd394('0x1f')](_0x24511f)[_0xd394('0x21')](_0x115d6b);}};}function respondWithFilteredResult(_0x105faa,_0x313111){return function(_0x238ab5){if(_0x238ab5){var _0x1cfd22=_0x238ab5[_0xd394('0x22')],_0x4474c6=_0x313111[_0xd394('0x23')],_0x1dc771=_0x313111['offset']+_0x313111[_0xd394('0x24')],_0x54fc9e;if(_0x1dc771>=_0x1cfd22){_0x1dc771=_0x1cfd22;_0x54fc9e=0xc8;}else{_0x54fc9e=0xce;}_0x105faa[_0xd394('0x1f')](_0x54fc9e);return _0x105faa[_0xd394('0x25')](_0xd394('0x26'),_0x4474c6+'-'+_0x1dc771+'/'+_0x1cfd22)['json'](_0x238ab5);}return null;};}function patchUpdates(_0x276203){return function(_0x4d7acb){try{jsonpatch[_0xd394('0x27')](_0x4d7acb,_0x276203,!![]);}catch(_0x314690){return BPromise[_0xd394('0x28')](_0x314690);}return _0x4d7acb['save']();};}function saveUpdates(_0x3c11fc,_0x50f4f){return function(_0x4bab24){if(_0x4bab24){return _0x4bab24[_0xd394('0x29')](_0x3c11fc)[_0xd394('0x2a')](function(_0xcb138f){return _0xcb138f;});}return null;};}function removeEntity(_0x4fea08,_0x36201a){return function(_0x4b0b12){if(_0x4b0b12){return _0x4b0b12[_0xd394('0x2b')]()[_0xd394('0x2a')](function(){var _0x1bcbb4=_0x4b0b12['get']({'plain':!![]});var _0x5c9437=_0xd394('0x2c');return db[_0xd394('0x2d')]['destroy']({'where':{'type':_0x5c9437,'resourceId':_0x1bcbb4['id']}})[_0xd394('0x2a')](function(){return _0x4b0b12;});})[_0xd394('0x2a')](function(){_0x4fea08[_0xd394('0x1f')](0xcc)[_0xd394('0x20')]();});}};}function handleEntityNotFound(_0x5832fa,_0x4abc3d){return function(_0x4d2e2e){if(!_0x4d2e2e){_0x5832fa[_0xd394('0x2e')](0x194);}return _0x4d2e2e;};}function handleError(_0xe14120,_0x186c56){_0x186c56=_0x186c56||0x1f4;return function(_0x14e259){logger[_0xd394('0x2f')](_0x14e259[_0xd394('0x30')]);if(_0x14e259['name']){delete _0x14e259['name'];}_0xe14120[_0xd394('0x1f')](_0x186c56)[_0xd394('0x31')](_0x14e259);};}exports[_0xd394('0x32')]=function(_0x3f2a3b,_0x4f05bd){var _0x3ba2ce={},_0x194e8a={},_0x3b98c6={'count':0x0,'rows':[]};var _0x34a126=_[_0xd394('0x33')](db['VoicePrefix'][_0xd394('0x34')],function(_0x23f7f5){return{'name':_0x23f7f5[_0xd394('0x35')],'type':_0x23f7f5[_0xd394('0x36')][_0xd394('0x37')]};});_0x194e8a[_0xd394('0x38')]=_[_0xd394('0x33')](_0x34a126,_0xd394('0x39'));_0x194e8a['query']=_[_0xd394('0x3a')](_0x3f2a3b[_0xd394('0x3b')]);_0x194e8a[_0xd394('0x3c')]=_['intersection'](_0x194e8a[_0xd394('0x38')],_0x194e8a[_0xd394('0x3b')]);_0x3ba2ce[_0xd394('0x3d')]=_['intersection'](_0x194e8a[_0xd394('0x38')],qs[_0xd394('0x3e')](_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x3e')]));_0x3ba2ce['attributes']=_0x3ba2ce['attributes'][_0xd394('0x3f')]?_0x3ba2ce['attributes']:_0x194e8a[_0xd394('0x38')];if(!_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x40')](_0xd394('0x41'))){_0x3ba2ce[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x3f2a3b['query'][_0xd394('0x24')]);_0x3ba2ce[_0xd394('0x23')]=qs['offset'](_0x3f2a3b['query'][_0xd394('0x23')]);}_0x3ba2ce['order']=qs[_0xd394('0x42')](_0x3f2a3b[_0xd394('0x3b')]['sort']);_0x3ba2ce['where']=qs[_0xd394('0x3c')](_['pick'](_0x3f2a3b[_0xd394('0x3b')],_0x194e8a['filters']),_0x34a126);if(_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x43')]){_0x3ba2ce[_0xd394('0x44')]=_[_0xd394('0x45')](_0x3ba2ce[_0xd394('0x44')],{'$or':_['map'](_0x34a126,function(_0x480910){if(_0x480910[_0xd394('0x36')]!==_0xd394('0x46')){var _0x524689={};_0x524689[_0x480910[_0xd394('0x39')]]={'$like':'%'+_0x3f2a3b[_0xd394('0x3b')][_0xd394('0x43')]+'%'};return _0x524689;}})});}_0x3ba2ce=_[_0xd394('0x45')]({},_0x3ba2ce,_0x3f2a3b[_0xd394('0x47')]);var _0xf99a9d={'where':_0x3ba2ce[_0xd394('0x44')]};return db[_0xd394('0x48')][_0xd394('0x22')](_0xf99a9d)[_0xd394('0x2a')](function(_0x5dbf51){_0x3b98c6[_0xd394('0x22')]=_0x5dbf51;if(_0x3f2a3b['query']['includeAll']){_0x3ba2ce[_0xd394('0x49')]=[{'all':!![]}];}return db[_0xd394('0x48')][_0xd394('0x4a')](_0x3ba2ce);})['then'](function(_0x37d113){_0x3b98c6['rows']=_0x37d113;return _0x3b98c6;})[_0xd394('0x2a')](respondWithFilteredResult(_0x4f05bd,_0x3ba2ce))['catch'](handleError(_0x4f05bd,null));};exports[_0xd394('0x4b')]=function(_0xbfa64a,_0x116de3){var _0x553114={'raw':![],'where':{'id':_0xbfa64a[_0xd394('0x4c')]['id']}},_0x54ee78={};_0x54ee78[_0xd394('0x38')]=_[_0xd394('0x3a')](db[_0xd394('0x48')][_0xd394('0x34')]);_0x54ee78['query']=_[_0xd394('0x3a')](_0xbfa64a[_0xd394('0x3b')]);_0x54ee78[_0xd394('0x3c')]=_[_0xd394('0x4d')](_0x54ee78[_0xd394('0x38')],_0x54ee78['query']);_0x553114['attributes']=_['intersection'](_0x54ee78[_0xd394('0x38')],qs['fields'](_0xbfa64a[_0xd394('0x3b')]['fields']));_0x553114[_0xd394('0x3d')]=_0x553114[_0xd394('0x3d')]['length']?_0x553114[_0xd394('0x3d')]:_0x54ee78[_0xd394('0x38')];if(_0xbfa64a['query'][_0xd394('0x4e')]){_0x553114[_0xd394('0x49')]=[{'all':!![]}];}_0x553114=_[_0xd394('0x45')]({},_0x553114,_0xbfa64a['options']);return db['VoicePrefix'][_0xd394('0x4f')](_0x553114)[_0xd394('0x2a')](handleEntityNotFound(_0x116de3,null))[_0xd394('0x2a')](respondWithResult(_0x116de3,null))['catch'](handleError(_0x116de3,null));};exports[_0xd394('0x2b')]=function(_0x38853d,_0x3a1bb7){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x38853d[_0xd394('0x4c')]['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x3a1bb7,null))[_0xd394('0x2a')](removeEntity(_0x3a1bb7,null))['catch'](handleError(_0x3a1bb7,null));};exports[_0xd394('0x50')]=function(_0x456b7f,_0x3c51bd){return db['VoicePrefix'][_0xd394('0x50')]()[_0xd394('0x2a')](respondWithResult(_0x3c51bd,null))['catch'](handleError(_0x3c51bd,null));};exports['create']=function(_0x1dc86b,_0x922fe6){var _0x385235;return db[_0xd394('0x51')][_0xd394('0x52')](function(_0x4f7506){return db[_0xd394('0x48')]['create'](_0x1dc86b[_0xd394('0x53')],{'transaction':_0x4f7506})[_0xd394('0x2a')](function(_0xf4617){_0x385235=_0xf4617[_0xd394('0x54')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x385235[_0xd394('0x55')]},'raw':!![]})[_0xd394('0x2a')](function(_0x475c35){return createVoicePrefixExtensions(_0x385235,_0x475c35,_0x4f7506);});});})[_0xd394('0x2a')](function(){var _0x1c0a46=_0x1dc86b[_0xd394('0x56')]['get']({'plain':!![]});if(!_0x1c0a46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c0a46[_0xd394('0x57')]===_0xd394('0x56')){var _0x65f8df=_0x385235;return db[_0xd394('0x58')]['find']({'where':{'name':_0xd394('0x2c'),'userProfileId':_0x1c0a46[_0xd394('0x59')]},'raw':!![]})['then'](function(_0x10b85d){if(_0x10b85d&&_0x10b85d[_0xd394('0x5a')]===0x0){return db['UserProfileResource'][_0xd394('0x5b')]({'name':_0x65f8df[_0xd394('0x39')],'resourceId':_0x65f8df['id'],'type':_0x10b85d[_0xd394('0x39')],'sectionId':_0x10b85d['id']},{})[_0xd394('0x2a')](function(){return _0x385235;});}else{return _0x385235;}})[_0xd394('0x5c')](function(_0x45ec6d){logger[_0xd394('0x2f')](_0xd394('0x5d'),_0x45ec6d);throw _0x45ec6d;});}return _0x385235;})[_0xd394('0x2a')](respondWithResult(_0x922fe6,null))[_0xd394('0x5c')](handleError(_0x922fe6,null));};function Extension(_0x3359b4,_0x5c84ab,_0xd7ac25,_0x34ad59){this[_0xd394('0x5e')]=_0xd394('0x5f');this[_0xd394('0x60')]=_0x3359b4;this['app']=_0xd7ac25;this[_0xd394('0x36')]='system';this[_0xd394('0x61')]=_0xd394('0x62');this[_0xd394('0x63')]=_0x5c84ab;this[_0xd394('0x64')]=_0x34ad59;}function createVoicePrefixExtensions(_0x52226a,_0x3356c5,_0x2ffc81){return new BPromise(function(_0x5b1f68,_0x85c65){var _0x158447=new Extension(formatPrefixName(_0x52226a[_0xd394('0x65')]),0x1,_0xd394('0x66'),_0xd394('0x67'));_0x158447['VoicePrefixId']=_0x52226a['id'];return db[_0xd394('0x68')][_0xd394('0x5b')](_0x158447,{'transaction':_0x2ffc81})[_0xd394('0x2a')](function(_0x2f1b1c){var _0xa1e569=_0x2f1b1c['get']({'plain':!![]});var _0x841b1e=_[_0xd394('0x33')](addVoicePrefixExtensions(_0x52226a,_0x3356c5),function(_0x24c1bc){_0x24c1bc[_0xd394('0x55')]=_0xa1e569['id'];_0x24c1bc[_0xd394('0x69')]=_0x52226a['id'];return _0x24c1bc;});return db[_0xd394('0x68')][_0xd394('0x6a')](_0x841b1e,{'transaction':_0x2ffc81})[_0xd394('0x2a')](function(_0x5c403d){if(!_0x5c403d){return _0x85c65('Extensions\x20creation\x20failed');}else{return _0x5b1f68(_0x5c403d);}})['catch'](function(_0x5ebdad){return _0x85c65(_0x5ebdad);});});;});};function addVoicePrefixExtensions(_0x392cb1,_0xa15353){var _0x1da20c=[];var _0x894580=formatPrefixName(_0x392cb1[_0xd394('0x65')]);_0x1da20c[_0xd394('0x6b')](new Extension(_0x894580,0x2,_0xd394('0x6c'),_0xd394('0x6d')+_0x392cb1['name']));if(_0x392cb1['callerIdAll']){_0x1da20c['push'](new Extension(_0x894580,0x3,_0xd394('0x6c'),_0xd394('0x6e')+_0x392cb1[_0xd394('0x6f')]));}else{_0x1da20c[_0xd394('0x6b')](new Extension(_0x894580,0x3,_0xd394('0x66'),_0xd394('0x70')));}_0x1da20c['push'](new Extension(_0x894580,0x4,'goto',_0xa15353[_0xd394('0x5e')]+','+'${EXTEN:'+(0x8+_0x392cb1[_0xd394('0x39')]['length'])+'}'+','+0x1));return _0x1da20c;}function formatPrefixName(_0x2b7621){var _0x414a6a='_';for(var _0x51b3dd=0x0;_0x51b3dd<_0x2b7621[_0xd394('0x3f')];_0x51b3dd++){if(_0x2b7621[_0xd394('0x71')](_0x51b3dd)=='-'){_0x414a6a+=_0x2b7621[_0xd394('0x71')](_0x51b3dd);}else{_0x414a6a+='['+_0x2b7621[_0xd394('0x71')](_0x51b3dd)+']';}}_0x414a6a+='.';return _0x414a6a;}exports[_0xd394('0x29')]=function(_0x22bf75,_0x29f721,_0xcccefa){var _0x5c71d2=_0x22bf75['body'];_0x5c71d2[_0xd394('0x65')]=_0xd394('0x72')+_0x5c71d2[_0xd394('0x39')]+'-';return db[_0xd394('0x51')][_0xd394('0x52')](function(_0x51c9db){return db[_0xd394('0x48')][_0xd394('0x29')](_0x5c71d2,{'where':{'id':_0x5c71d2['id']},'transaction':_0x51c9db})[_0xd394('0x2a')](function(){return db[_0xd394('0x68')][_0xd394('0x2b')]({'where':{'VoicePrefixId':_0x5c71d2['id']},'transaction':_0x51c9db})[_0xd394('0x2a')](function(){return db['VoiceExtension'][_0xd394('0x4f')]({'where':{'id':_0x5c71d2[_0xd394('0x55')]},'raw':!![]})[_0xd394('0x2a')](function(_0x1a006b){return createVoicePrefixExtensions(_0x5c71d2,_0x1a006b,_0x51c9db);});});});})[_0xd394('0x2a')](function(){return db[_0xd394('0x48')][_0xd394('0x73')](_0x5c71d2['id']);})[_0xd394('0x2a')](respondWithResult(_0x29f721,null))['catch'](handleError(_0x29f721,null));};exports[_0xd394('0x74')]=function(_0x3da1c1,_0x101434,_0x2b7f0b){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x3da1c1[_0xd394('0x4c')]['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x101434,null))[_0xd394('0x2a')](function(_0x2ba597){if(_0x2ba597){return _0x2ba597[_0xd394('0x74')](_0x3da1c1[_0xd394('0x53')][_0xd394('0x75')],_[_0xd394('0x76')](_0x3da1c1[_0xd394('0x53')],[_0xd394('0x75'),'id'])||{})[_0xd394('0x77')](function(_0x3d601d){for(var _0x2ad711=0x0;_0x2ad711<_0x3da1c1[_0xd394('0x53')]['ids'][_0xd394('0x3f')];_0x2ad711+=0x1){socket['emit'](_0xd394('0x78'),{'UserId':_0x3da1c1[_0xd394('0x53')][_0xd394('0x75')][_0x2ad711],'VoicePrefixId':_0x3da1c1[_0xd394('0x4c')]['id']});}return _0x3d601d;});}})['then'](respondWithResult(_0x101434,null))['catch'](handleError(_0x101434,null));};exports[_0xd394('0x79')]=function(_0x15b1c9,_0x4f0f66,_0x4f13ea){return db['VoicePrefix'][_0xd394('0x4f')]({'where':{'id':_0x15b1c9['params']['id']}})[_0xd394('0x2a')](handleEntityNotFound(_0x4f0f66,null))[_0xd394('0x2a')](function(_0x3b1585){if(_0x3b1585){return _0x3b1585[_0xd394('0x79')](_0x15b1c9[_0xd394('0x3b')]['ids'])[_0xd394('0x2a')](function(){if(_['isArray'](_0x15b1c9['query'][_0xd394('0x75')])){for(var _0x3530c7=0x0;_0x3530c7<_0x15b1c9[_0xd394('0x3b')][_0xd394('0x75')]['length'];_0x3530c7+=0x1){socket[_0xd394('0x7a')](_0xd394('0x7b'),{'UserId':Number(_0x15b1c9[_0xd394('0x3b')][_0xd394('0x75')][_0x3530c7]),'VoicePrefixId':Number(_0x15b1c9[_0xd394('0x4c')]['id'])});}}else{socket[_0xd394('0x7a')](_0xd394('0x7b'),{'UserId':Number(_0x15b1c9['query']['ids']),'VoicePrefixId':Number(_0x15b1c9['params']['id'])});}});}})[_0xd394('0x2a')](respondWithStatusCode(_0x4f0f66,null))[_0xd394('0x5c')](handleError(_0x4f0f66,null));};exports['getAgents']=function(_0x26d46a,_0x1578d6,_0x579e08){var _0x109585={};var _0x4e804b={};var _0x351685;var _0x4bae5c;return db['VoicePrefix']['findOne']({'where':{'id':_0x26d46a['params']['id']}})['then'](handleEntityNotFound(_0x1578d6,null))[_0xd394('0x2a')](function(_0x319a05){if(_0x319a05){_0x351685=_0x319a05;_0x4e804b['model']=_[_0xd394('0x3a')](db[_0xd394('0x7c')]['rawAttributes']);_0x4e804b[_0xd394('0x3b')]=_[_0xd394('0x3a')](_0x26d46a[_0xd394('0x3b')]);_0x4e804b[_0xd394('0x3c')]=_['intersection'](_0x4e804b[_0xd394('0x38')],_0x4e804b[_0xd394('0x3b')]);_0x109585[_0xd394('0x3d')]=_[_0xd394('0x4d')](_0x4e804b['model'],qs['fields'](_0x26d46a['query'][_0xd394('0x3e')]));_0x109585[_0xd394('0x3d')]=_0x109585[_0xd394('0x3d')][_0xd394('0x3f')]?_0x109585[_0xd394('0x3d')]:_0x4e804b[_0xd394('0x38')];_0x109585['order']=qs[_0xd394('0x42')](_0x26d46a[_0xd394('0x3b')][_0xd394('0x42')]);_0x109585[_0xd394('0x44')]=qs[_0xd394('0x3c')](_[_0xd394('0x7d')](_0x26d46a[_0xd394('0x3b')],_0x4e804b['filters']));if(_0x26d46a[_0xd394('0x3b')][_0xd394('0x43')]){_0x109585[_0xd394('0x44')]=_[_0xd394('0x45')](_0x109585[_0xd394('0x44')],{'$or':_[_0xd394('0x33')](_0x109585['attributes'],function(_0x44f3a0){var _0x370d5b={};_0x370d5b[_0x44f3a0]={'$like':'%'+_0x26d46a['query'][_0xd394('0x43')]+'%'};return _0x370d5b;})});}_0x109585=_[_0xd394('0x45')]({},_0x109585,_0x26d46a[_0xd394('0x47')]);return _0x351685['getAgents'](_0x109585);}})[_0xd394('0x2a')](function(_0x4b312e){if(_0x4b312e){_0x4bae5c=_0x4b312e['length'];if(!_0x26d46a[_0xd394('0x3b')]['hasOwnProperty']('nolimit')){_0x109585[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x26d46a['query'][_0xd394('0x24')]);_0x109585[_0xd394('0x23')]=qs[_0xd394('0x23')](_0x26d46a[_0xd394('0x3b')][_0xd394('0x23')]);}return _0x351685['getAgents'](_0x109585);}})[_0xd394('0x2a')](function(_0x2167cd){if(_0x2167cd){return _0x2167cd?{'count':_0x4bae5c,'rows':_0x2167cd}:null;}})[_0xd394('0x2a')](respondWithResult(_0x1578d6,null))[_0xd394('0x5c')](handleError(_0x1578d6,null));}; \ No newline at end of file +var _0x0d28=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','sendStatus','end','status','count','offset','limit','set','apply','reject','save','update','then','destroy','VoicePrefixes','error','stack','name','send','VoicePrefix','rawAttributes','fieldName','model','map','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','describe','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId'];(function(_0xc7dc6f,_0x140483){var _0x26841c=function(_0x445299){while(--_0x445299){_0xc7dc6f['push'](_0xc7dc6f['shift']());}};_0x26841c(++_0x140483);}(_0x0d28,0x110));var _0x80d2=function(_0x9979f9,_0x22dba0){_0x9979f9=_0x9979f9-0x0;var _0x53b7fe=_0x0d28[_0x9979f9];return _0x53b7fe;};'use strict';var pdf=require(_0x80d2('0x0'));var emlformat=require(_0x80d2('0x1'));var rimraf=require(_0x80d2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80d2('0x3'));var rp=require('request-promise');var moment=require(_0x80d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x80d2('0x5'));var util=require(_0x80d2('0x6'));var path=require(_0x80d2('0x7'));var sox=require(_0x80d2('0x8'));var csv=require(_0x80d2('0x9'));var ejs=require(_0x80d2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x80d2('0xb'));var crypto=require(_0x80d2('0xc'));var jsforce=require(_0x80d2('0xd'));var deskjs=require(_0x80d2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x80d2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80d2('0x10'));var as=require(_0x80d2('0x11'));var hardwareService=require(_0x80d2('0x12'));var logger=require(_0x80d2('0x13'))('api');var utils=require(_0x80d2('0x14'));var config=require(_0x80d2('0x15'));var db=require('../../mysqldb')['db'];config[_0x80d2('0x16')]=_['defaults'](config[_0x80d2('0x16')],{'host':_0x80d2('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80d2('0x16')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x1f13be,_0x4efed4){_0x4efed4=_0x4efed4||0xcc;return function(_0x4f2f7e){if(_0x4f2f7e){return _0x1f13be[_0x80d2('0x18')](_0x4efed4);}return _0x1f13be['status'](_0x4efed4)[_0x80d2('0x19')]();};}function respondWithResult(_0x566ac3,_0x7d17ab){_0x7d17ab=_0x7d17ab||0xc8;return function(_0x4fd080){if(_0x4fd080){return _0x566ac3[_0x80d2('0x1a')](_0x7d17ab)['json'](_0x4fd080);}};}function respondWithFilteredResult(_0xb2841,_0x25e34b){return function(_0x236c9c){if(_0x236c9c){var _0x2b65da=_0x236c9c[_0x80d2('0x1b')],_0x2d398c=_0x25e34b[_0x80d2('0x1c')],_0xb7ad20=_0x25e34b[_0x80d2('0x1c')]+_0x25e34b[_0x80d2('0x1d')],_0x59ff6d;if(_0xb7ad20>=_0x2b65da){_0xb7ad20=_0x2b65da;_0x59ff6d=0xc8;}else{_0x59ff6d=0xce;}_0xb2841[_0x80d2('0x1a')](_0x59ff6d);return _0xb2841[_0x80d2('0x1e')]('Content-Range',_0x2d398c+'-'+_0xb7ad20+'/'+_0x2b65da)['json'](_0x236c9c);}return null;};}function patchUpdates(_0x2b298f){return function(_0x2ac217){try{jsonpatch[_0x80d2('0x1f')](_0x2ac217,_0x2b298f,!![]);}catch(_0x31bb06){return BPromise[_0x80d2('0x20')](_0x31bb06);}return _0x2ac217[_0x80d2('0x21')]();};}function saveUpdates(_0x3ac138,_0x52e349){return function(_0xd9ccf7){if(_0xd9ccf7){return _0xd9ccf7[_0x80d2('0x22')](_0x3ac138)[_0x80d2('0x23')](function(_0x107f31){return _0x107f31;});}return null;};}function removeEntity(_0x143af7,_0xda124e){return function(_0x3a071c){if(_0x3a071c){return _0x3a071c[_0x80d2('0x24')]()[_0x80d2('0x23')](function(){var _0x1bab6e=_0x3a071c['get']({'plain':!![]});var _0x1a9b0c=_0x80d2('0x25');return db['UserProfileResource'][_0x80d2('0x24')]({'where':{'type':_0x1a9b0c,'resourceId':_0x1bab6e['id']}})[_0x80d2('0x23')](function(){return _0x3a071c;});})[_0x80d2('0x23')](function(){_0x143af7['status'](0xcc)[_0x80d2('0x19')]();});}};}function handleEntityNotFound(_0xd223ab,_0xa71658){return function(_0x65dbd5){if(!_0x65dbd5){_0xd223ab[_0x80d2('0x18')](0x194);}return _0x65dbd5;};}function handleError(_0x3b7944,_0x4f5845){_0x4f5845=_0x4f5845||0x1f4;return function(_0x2b496e){logger[_0x80d2('0x26')](_0x2b496e[_0x80d2('0x27')]);if(_0x2b496e[_0x80d2('0x28')]){delete _0x2b496e[_0x80d2('0x28')];}_0x3b7944[_0x80d2('0x1a')](_0x4f5845)[_0x80d2('0x29')](_0x2b496e);};}exports['index']=function(_0x424e59,_0x41108a){var _0x4941e8={},_0x106a9c={},_0x4bacdb={'count':0x0,'rows':[]};var _0x5ad539=_['map'](db[_0x80d2('0x2a')][_0x80d2('0x2b')],function(_0x16a8b8){return{'name':_0x16a8b8[_0x80d2('0x2c')],'type':_0x16a8b8['type']['key']};});_0x106a9c[_0x80d2('0x2d')]=_[_0x80d2('0x2e')](_0x5ad539,_0x80d2('0x28'));_0x106a9c['query']=_[_0x80d2('0x2f')](_0x424e59['query']);_0x106a9c[_0x80d2('0x30')]=_[_0x80d2('0x31')](_0x106a9c['model'],_0x106a9c[_0x80d2('0x32')]);_0x4941e8['attributes']=_[_0x80d2('0x31')](_0x106a9c[_0x80d2('0x2d')],qs[_0x80d2('0x33')](_0x424e59[_0x80d2('0x32')][_0x80d2('0x33')]));_0x4941e8[_0x80d2('0x34')]=_0x4941e8[_0x80d2('0x34')]['length']?_0x4941e8[_0x80d2('0x34')]:_0x106a9c['model'];if(!_0x424e59['query']['hasOwnProperty'](_0x80d2('0x35'))){_0x4941e8[_0x80d2('0x1d')]=qs[_0x80d2('0x1d')](_0x424e59[_0x80d2('0x32')][_0x80d2('0x1d')]);_0x4941e8[_0x80d2('0x1c')]=qs[_0x80d2('0x1c')](_0x424e59[_0x80d2('0x32')][_0x80d2('0x1c')]);}_0x4941e8[_0x80d2('0x36')]=qs[_0x80d2('0x37')](_0x424e59[_0x80d2('0x32')][_0x80d2('0x37')]);_0x4941e8[_0x80d2('0x38')]=qs['filters'](_[_0x80d2('0x39')](_0x424e59[_0x80d2('0x32')],_0x106a9c[_0x80d2('0x30')]),_0x5ad539);if(_0x424e59[_0x80d2('0x32')][_0x80d2('0x3a')]){_0x4941e8[_0x80d2('0x38')]=_[_0x80d2('0x3b')](_0x4941e8[_0x80d2('0x38')],{'$or':_[_0x80d2('0x2e')](_0x5ad539,function(_0x419f02){if(_0x419f02[_0x80d2('0x3c')]!==_0x80d2('0x3d')){var _0x8e14b8={};_0x8e14b8[_0x419f02[_0x80d2('0x28')]]={'$like':'%'+_0x424e59[_0x80d2('0x32')][_0x80d2('0x3a')]+'%'};return _0x8e14b8;}})});}_0x4941e8=_[_0x80d2('0x3b')]({},_0x4941e8,_0x424e59[_0x80d2('0x3e')]);var _0x698ec6={'where':_0x4941e8[_0x80d2('0x38')]};return db['VoicePrefix']['count'](_0x698ec6)['then'](function(_0x511c53){_0x4bacdb[_0x80d2('0x1b')]=_0x511c53;if(_0x424e59[_0x80d2('0x32')]['includeAll']){_0x4941e8[_0x80d2('0x3f')]=[{'all':!![]}];}return db[_0x80d2('0x2a')][_0x80d2('0x40')](_0x4941e8);})['then'](function(_0x7e6958){_0x4bacdb[_0x80d2('0x41')]=_0x7e6958;return _0x4bacdb;})[_0x80d2('0x23')](respondWithFilteredResult(_0x41108a,_0x4941e8))[_0x80d2('0x42')](handleError(_0x41108a,null));};exports[_0x80d2('0x43')]=function(_0x50fc85,_0x545cb8){var _0x439734={'raw':![],'where':{'id':_0x50fc85[_0x80d2('0x44')]['id']}},_0x461534={};_0x461534[_0x80d2('0x2d')]=_['keys'](db[_0x80d2('0x2a')][_0x80d2('0x2b')]);_0x461534[_0x80d2('0x32')]=_[_0x80d2('0x2f')](_0x50fc85[_0x80d2('0x32')]);_0x461534[_0x80d2('0x30')]=_[_0x80d2('0x31')](_0x461534[_0x80d2('0x2d')],_0x461534[_0x80d2('0x32')]);_0x439734[_0x80d2('0x34')]=_['intersection'](_0x461534[_0x80d2('0x2d')],qs[_0x80d2('0x33')](_0x50fc85['query'][_0x80d2('0x33')]));_0x439734[_0x80d2('0x34')]=_0x439734['attributes'][_0x80d2('0x45')]?_0x439734[_0x80d2('0x34')]:_0x461534[_0x80d2('0x2d')];if(_0x50fc85[_0x80d2('0x32')][_0x80d2('0x46')]){_0x439734[_0x80d2('0x3f')]=[{'all':!![]}];}_0x439734=_[_0x80d2('0x3b')]({},_0x439734,_0x50fc85[_0x80d2('0x3e')]);return db['VoicePrefix'][_0x80d2('0x47')](_0x439734)['then'](handleEntityNotFound(_0x545cb8,null))['then'](respondWithResult(_0x545cb8,null))[_0x80d2('0x42')](handleError(_0x545cb8,null));};exports[_0x80d2('0x24')]=function(_0x1237d8,_0xfe0cf8){return db[_0x80d2('0x2a')][_0x80d2('0x47')]({'where':{'id':_0x1237d8[_0x80d2('0x44')]['id']}})['then'](handleEntityNotFound(_0xfe0cf8,null))[_0x80d2('0x23')](removeEntity(_0xfe0cf8,null))[_0x80d2('0x42')](handleError(_0xfe0cf8,null));};exports[_0x80d2('0x48')]=function(_0x56091d,_0x5097c9){return db[_0x80d2('0x2a')]['describe']()['then'](respondWithResult(_0x5097c9,null))['catch'](handleError(_0x5097c9,null));};exports['create']=function(_0x22048c,_0x35645f){var _0x33d8af;return db[_0x80d2('0x49')][_0x80d2('0x4a')](function(_0x197ded){return db[_0x80d2('0x2a')]['create'](_0x22048c[_0x80d2('0x4b')],{'transaction':_0x197ded})[_0x80d2('0x23')](function(_0xa10161){_0x33d8af=_0xa10161[_0x80d2('0x4c')]({'plain':!![]});return db[_0x80d2('0x4d')][_0x80d2('0x47')]({'where':{'id':_0x33d8af[_0x80d2('0x4e')]},'raw':!![]})[_0x80d2('0x23')](function(_0x50713f){return createVoicePrefixExtensions(_0x33d8af,_0x50713f,_0x197ded);});});})['then'](function(){var _0x2c64ae=_0x22048c['user']['get']({'plain':!![]});if(!_0x2c64ae)throw new Error(_0x80d2('0x4f'));if(_0x2c64ae['role']==='user'){var _0x43f66d=_0x33d8af;return db[_0x80d2('0x50')][_0x80d2('0x47')]({'where':{'name':_0x80d2('0x25'),'userProfileId':_0x2c64ae[_0x80d2('0x51')]},'raw':!![]})['then'](function(_0x50739f){if(_0x50739f&&_0x50739f['autoAssociation']===0x0){return db['UserProfileResource'][_0x80d2('0x52')]({'name':_0x43f66d[_0x80d2('0x28')],'resourceId':_0x43f66d['id'],'type':_0x50739f[_0x80d2('0x28')],'sectionId':_0x50739f['id']},{})[_0x80d2('0x23')](function(){return _0x33d8af;});}else{return _0x33d8af;}})[_0x80d2('0x42')](function(_0x16a828){logger[_0x80d2('0x26')](_0x80d2('0x53'),_0x16a828);throw _0x16a828;});}return _0x33d8af;})[_0x80d2('0x23')](respondWithResult(_0x35645f,null))[_0x80d2('0x42')](handleError(_0x35645f,null));};function Extension(_0x2cf327,_0x481fa8,_0xe0304b,_0xf0e276){this[_0x80d2('0x54')]='from-sip';this[_0x80d2('0x55')]=_0x2cf327;this[_0x80d2('0x56')]=_0xe0304b;this[_0x80d2('0x3c')]=_0x80d2('0x57');this['description']=_0x80d2('0x58');this[_0x80d2('0x59')]=_0x481fa8;this[_0x80d2('0x5a')]=_0xf0e276;}function createVoicePrefixExtensions(_0x58a43a,_0x3080cc,_0x2ec4b0){return new BPromise(function(_0x1c2257,_0x39c1c5){var _0x6da6e8=new Extension(formatPrefixName(_0x58a43a[_0x80d2('0x5b')]),0x1,'NoOp',_0x80d2('0x5c'));_0x6da6e8[_0x80d2('0x5d')]=_0x58a43a['id'];return db[_0x80d2('0x4d')][_0x80d2('0x52')](_0x6da6e8,{'transaction':_0x2ec4b0})['then'](function(_0x770c16){var _0x473c09=_0x770c16[_0x80d2('0x4c')]({'plain':!![]});var _0x409c1c=_[_0x80d2('0x2e')](addVoicePrefixExtensions(_0x58a43a,_0x3080cc),function(_0x9a68ec){_0x9a68ec[_0x80d2('0x4e')]=_0x473c09['id'];_0x9a68ec['VoicePrefixId']=_0x58a43a['id'];return _0x9a68ec;});return db[_0x80d2('0x4d')][_0x80d2('0x5e')](_0x409c1c,{'transaction':_0x2ec4b0})['then'](function(_0x59df31){if(!_0x59df31){return _0x39c1c5(_0x80d2('0x5f'));}else{return _0x1c2257(_0x59df31);}})[_0x80d2('0x42')](function(_0x4966ce){return _0x39c1c5(_0x4966ce);});});;});};function addVoicePrefixExtensions(_0x4c030e,_0x213476){var _0x4e053f=[];var _0x57daed=formatPrefixName(_0x4c030e[_0x80d2('0x5b')]);_0x4e053f['push'](new Extension(_0x57daed,0x2,_0x80d2('0x60'),'CDR(prefix)='+_0x4c030e['name']));if(_0x4c030e['callerIdAll']){_0x4e053f[_0x80d2('0x61')](new Extension(_0x57daed,0x3,_0x80d2('0x60'),_0x80d2('0x62')+_0x4c030e[_0x80d2('0x63')]));}else{_0x4e053f[_0x80d2('0x61')](new Extension(_0x57daed,0x3,_0x80d2('0x64'),'No\x20callerid\x20available'));}_0x4e053f['push'](new Extension(_0x57daed,0x4,_0x80d2('0x65'),_0x213476[_0x80d2('0x54')]+','+_0x80d2('0x66')+(0x8+_0x4c030e[_0x80d2('0x28')][_0x80d2('0x45')])+'}'+','+0x1));return _0x4e053f;}function formatPrefixName(_0x232790){var _0x526ba7='_';for(var _0x3b6f61=0x0;_0x3b6f61<_0x232790[_0x80d2('0x45')];_0x3b6f61++){if(_0x232790[_0x80d2('0x67')](_0x3b6f61)=='-'){_0x526ba7+=_0x232790[_0x80d2('0x67')](_0x3b6f61);}else{_0x526ba7+='['+_0x232790[_0x80d2('0x67')](_0x3b6f61)+']';}}_0x526ba7+='.';return _0x526ba7;}exports[_0x80d2('0x22')]=function(_0x43ef3b,_0x4c6d1a,_0x53fb5a){var _0x42340a=_0x43ef3b[_0x80d2('0x4b')];_0x42340a['prefix']=_0x80d2('0x68')+_0x42340a['name']+'-';return db[_0x80d2('0x49')]['transaction'](function(_0x462a86){return db['VoicePrefix'][_0x80d2('0x22')](_0x42340a,{'where':{'id':_0x42340a['id']},'transaction':_0x462a86})[_0x80d2('0x23')](function(){return db[_0x80d2('0x4d')][_0x80d2('0x24')]({'where':{'VoicePrefixId':_0x42340a['id']},'transaction':_0x462a86})[_0x80d2('0x23')](function(){return db[_0x80d2('0x4d')][_0x80d2('0x47')]({'where':{'id':_0x42340a[_0x80d2('0x4e')]},'raw':!![]})[_0x80d2('0x23')](function(_0x150dda){return createVoicePrefixExtensions(_0x42340a,_0x150dda,_0x462a86);});});});})['then'](function(){return db[_0x80d2('0x2a')][_0x80d2('0x69')](_0x42340a['id']);})[_0x80d2('0x23')](respondWithResult(_0x4c6d1a,null))[_0x80d2('0x42')](handleError(_0x4c6d1a,null));};exports['addAgents']=function(_0x28eec3,_0xa96b57,_0x3a71c8){return db[_0x80d2('0x2a')][_0x80d2('0x47')]({'where':{'id':_0x28eec3[_0x80d2('0x44')]['id']}})[_0x80d2('0x23')](handleEntityNotFound(_0xa96b57,null))[_0x80d2('0x23')](function(_0x18642f){if(_0x18642f){return _0x18642f['addAgents'](_0x28eec3[_0x80d2('0x4b')][_0x80d2('0x6a')],_[_0x80d2('0x6b')](_0x28eec3[_0x80d2('0x4b')],[_0x80d2('0x6a'),'id'])||{})[_0x80d2('0x6c')](function(_0x2b0e68){for(var _0x28b41b=0x0;_0x28b41b<_0x28eec3[_0x80d2('0x4b')]['ids']['length'];_0x28b41b+=0x1){socket[_0x80d2('0x6d')](_0x80d2('0x6e'),{'UserId':_0x28eec3[_0x80d2('0x4b')]['ids'][_0x28b41b],'VoicePrefixId':_0x28eec3[_0x80d2('0x44')]['id']});}return _0x2b0e68;});}})[_0x80d2('0x23')](respondWithResult(_0xa96b57,null))[_0x80d2('0x42')](handleError(_0xa96b57,null));};exports['removeAgents']=function(_0x2f2448,_0x12facf,_0x31f120){return db[_0x80d2('0x2a')][_0x80d2('0x47')]({'where':{'id':_0x2f2448[_0x80d2('0x44')]['id']}})[_0x80d2('0x23')](handleEntityNotFound(_0x12facf,null))[_0x80d2('0x23')](function(_0x566ac1){if(_0x566ac1){return _0x566ac1[_0x80d2('0x6f')](_0x2f2448[_0x80d2('0x32')]['ids'])[_0x80d2('0x23')](function(){if(_['isArray'](_0x2f2448[_0x80d2('0x32')]['ids'])){for(var _0x2460ce=0x0;_0x2460ce<_0x2f2448[_0x80d2('0x32')][_0x80d2('0x6a')][_0x80d2('0x45')];_0x2460ce+=0x1){socket['emit'](_0x80d2('0x70'),{'UserId':Number(_0x2f2448[_0x80d2('0x32')][_0x80d2('0x6a')][_0x2460ce]),'VoicePrefixId':Number(_0x2f2448['params']['id'])});}}else{socket[_0x80d2('0x6d')](_0x80d2('0x70'),{'UserId':Number(_0x2f2448[_0x80d2('0x32')][_0x80d2('0x6a')]),'VoicePrefixId':Number(_0x2f2448[_0x80d2('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x12facf,null))[_0x80d2('0x42')](handleError(_0x12facf,null));};exports[_0x80d2('0x71')]=function(_0x40ad15,_0x107723,_0x25bf82){var _0xa6a807={};var _0x5e0d4={};var _0x9f643b;var _0x2d7236;return db['VoicePrefix'][_0x80d2('0x72')]({'where':{'id':_0x40ad15[_0x80d2('0x44')]['id']}})[_0x80d2('0x23')](handleEntityNotFound(_0x107723,null))['then'](function(_0x547927){if(_0x547927){_0x9f643b=_0x547927;_0x5e0d4['model']=_[_0x80d2('0x2f')](db[_0x80d2('0x73')][_0x80d2('0x2b')]);_0x5e0d4['query']=_[_0x80d2('0x2f')](_0x40ad15[_0x80d2('0x32')]);_0x5e0d4[_0x80d2('0x30')]=_[_0x80d2('0x31')](_0x5e0d4[_0x80d2('0x2d')],_0x5e0d4[_0x80d2('0x32')]);_0xa6a807[_0x80d2('0x34')]=_['intersection'](_0x5e0d4[_0x80d2('0x2d')],qs[_0x80d2('0x33')](_0x40ad15[_0x80d2('0x32')][_0x80d2('0x33')]));_0xa6a807[_0x80d2('0x34')]=_0xa6a807[_0x80d2('0x34')][_0x80d2('0x45')]?_0xa6a807[_0x80d2('0x34')]:_0x5e0d4[_0x80d2('0x2d')];_0xa6a807[_0x80d2('0x36')]=qs[_0x80d2('0x37')](_0x40ad15[_0x80d2('0x32')][_0x80d2('0x37')]);_0xa6a807['where']=qs[_0x80d2('0x30')](_['pick'](_0x40ad15[_0x80d2('0x32')],_0x5e0d4['filters']));if(_0x40ad15[_0x80d2('0x32')][_0x80d2('0x3a')]){_0xa6a807['where']=_['merge'](_0xa6a807[_0x80d2('0x38')],{'$or':_[_0x80d2('0x2e')](_0xa6a807[_0x80d2('0x34')],function(_0x4bc6a0){var _0x102203={};_0x102203[_0x4bc6a0]={'$like':'%'+_0x40ad15[_0x80d2('0x32')][_0x80d2('0x3a')]+'%'};return _0x102203;})});}_0xa6a807=_[_0x80d2('0x3b')]({},_0xa6a807,_0x40ad15['options']);return _0x9f643b['getAgents'](_0xa6a807);}})[_0x80d2('0x23')](function(_0x2a401e){if(_0x2a401e){_0x2d7236=_0x2a401e[_0x80d2('0x45')];if(!_0x40ad15['query'][_0x80d2('0x74')](_0x80d2('0x35'))){_0xa6a807[_0x80d2('0x1d')]=qs[_0x80d2('0x1d')](_0x40ad15[_0x80d2('0x32')][_0x80d2('0x1d')]);_0xa6a807[_0x80d2('0x1c')]=qs[_0x80d2('0x1c')](_0x40ad15[_0x80d2('0x32')][_0x80d2('0x1c')]);}return _0x9f643b['getAgents'](_0xa6a807);}})[_0x80d2('0x23')](function(_0x368ae4){if(_0x368ae4){return _0x368ae4?{'count':_0x2d7236,'rows':_0x368ae4}:null;}})[_0x80d2('0x23')](respondWithResult(_0x107723,null))[_0x80d2('0x42')](handleError(_0x107723,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 64f4011..e72ebb4 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(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x34e8,0x12c));var _0x834e=function(_0x3a9123,_0x538c2d){_0x3a9123=_0x3a9123-0x0;var _0x54c15a=_0x34e8[_0x3a9123];return _0x54c15a;};'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(_0x131511,_0x9c6fca){var _0x37ccd1=function(_0x1c550b){while(--_0x1c550b){_0x131511['push'](_0x131511['shift']());}};_0x37ccd1(++_0x9c6fca);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'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 9186c3b..27d0d41 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 _0xc2a4=['path','rimraf','../../config/environment','exports','define','voice_prefixes','lodash','util','moment','bluebird','request-promise'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xc2a4,0x1ea));var _0x4c2a=function(_0x47a6a4,_0x30c996){_0x47a6a4=_0x47a6a4-0x0;var _0x30d371=_0xc2a4[_0x47a6a4];return _0x30d371;};'use strict';var _=require(_0x4c2a('0x0'));var util=require(_0x4c2a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c2a('0x2'));var BPromise=require(_0x4c2a('0x3'));var rp=require(_0x4c2a('0x4'));var fs=require('fs');var path=require(_0x4c2a('0x5'));var rimraf=require(_0x4c2a('0x6'));var config=require(_0x4c2a('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x4c2a('0x8')]=function(_0x31d92f,_0x47b4ed){return _0x31d92f[_0x4c2a('0x9')]('VoicePrefix',attributes,{'tableName':_0x4c2a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc0=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','request-promise','path','exports','define'];(function(_0x1f16dd,_0x1911d2){var _0x1c1594=function(_0x131416){while(--_0x131416){_0x1f16dd['push'](_0x1f16dd['shift']());}};_0x1c1594(++_0x1911d2);}(_0x4cc0,0x66));var _0x04cc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x4cc0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x04cc('0x0'));var util=require(_0x04cc('0x1'));var logger=require(_0x04cc('0x2'))('api');var moment=require(_0x04cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x04cc('0x4'));var fs=require('fs');var path=require(_0x04cc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x04cc('0x6')]=function(_0x1577af,_0x1875e2){return _0x1577af[_0x04cc('0x7')](_0x04cc('0x8'),attributes,{'tableName':_0x04cc('0x9'),'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 1a8a2eb..c64ae4d 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 _0x9039=['register','request','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9039,0x1a1));var _0x9903=function(_0x1d8fa1,_0x18d00f){_0x1d8fa1=_0x1d8fa1-0x0;var _0x528467=_0x9039[_0x1d8fa1];return _0x528467;};'use strict';var _=require(_0x9903('0x0'));var util=require(_0x9903('0x1'));var moment=require(_0x9903('0x2'));var BPromise=require(_0x9903('0x3'));var rs=require(_0x9903('0x4'));var fs=require('fs');var Redis=require(_0x9903('0x5'));var db=require(_0x9903('0x6'))['db'];var utils=require(_0x9903('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9903('0x8')][_0x9903('0x9')]({'port':0x232a});config['redis']=_[_0x9903('0xa')](config['redis'],{'host':_0x9903('0xb'),'port':0x18eb});var socket=require(_0x9903('0xc'))(new Redis(config[_0x9903('0xd')]));require(_0x9903('0xe'))[_0x9903('0xf')](socket);function respondWithRpcPromise(_0x1ad8ae,_0x589d61,_0x4135b5){return new BPromise(function(_0x2e2bb7,_0x304615){return client[_0x9903('0x10')](_0x1ad8ae,_0x4135b5)[_0x9903('0x11')](function(_0x58704f){logger[_0x9903('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x589d61,'request\x20sent');logger['debug'](_0x9903('0x13'),_0x589d61,_0x9903('0x14'),JSON[_0x9903('0x15')](_0x58704f));if(_0x58704f[_0x9903('0x16')]){if(_0x58704f[_0x9903('0x16')][_0x9903('0x17')]===0x1f4){logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);return _0x304615(_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);}logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);return _0x2e2bb7(_0x58704f[_0x9903('0x16')][_0x9903('0x19')]);}else{logger[_0x9903('0x12')](_0x9903('0x18'),_0x589d61,_0x9903('0x14'));_0x2e2bb7(_0x58704f['result'][_0x9903('0x19')]);}})[_0x9903('0x1a')](function(_0x508ece){logger[_0x9903('0x16')](_0x9903('0x18'),_0x589d61,_0x508ece);_0x304615(_0x508ece);});});} \ No newline at end of file +var _0x5f01=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','ioredis'];(function(_0x4da6ce,_0x5c2ca3){var _0x432833=function(_0x29e6d6){while(--_0x29e6d6){_0x4da6ce['push'](_0x4da6ce['shift']());}};_0x432833(++_0x5c2ca3);}(_0x5f01,0xcc));var _0x15f0=function(_0x4b765c,_0x459312){_0x4b765c=_0x4b765c-0x0;var _0x131c54=_0x5f01[_0x4b765c];return _0x131c54;};'use strict';var _=require('lodash');var util=require(_0x15f0('0x0'));var moment=require(_0x15f0('0x1'));var BPromise=require(_0x15f0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15f0('0x3'));var db=require(_0x15f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x15f0('0x5'))('rpc');var config=require(_0x15f0('0x6'));var jayson=require(_0x15f0('0x7'));var client=jayson[_0x15f0('0x8')][_0x15f0('0x9')]({'port':0x232a});config[_0x15f0('0xa')]=_[_0x15f0('0xb')](config['redis'],{'host':_0x15f0('0xc'),'port':0x18eb});var socket=require(_0x15f0('0xd'))(new Redis(config[_0x15f0('0xa')]));require(_0x15f0('0xe'))[_0x15f0('0xf')](socket);function respondWithRpcPromise(_0x2555e7,_0xce06a2,_0x514902){return new BPromise(function(_0x39c3ba,_0x35677b){return client['request'](_0x2555e7,_0x514902)[_0x15f0('0x10')](function(_0x2ded91){logger['info'](_0x15f0('0x11'),_0xce06a2,_0x15f0('0x12'));logger[_0x15f0('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xce06a2,'request\x20sent',JSON[_0x15f0('0x14')](_0x2ded91));if(_0x2ded91[_0x15f0('0x15')]){if(_0x2ded91[_0x15f0('0x15')][_0x15f0('0x16')]===0x1f4){logger[_0x15f0('0x15')](_0x15f0('0x11'),_0xce06a2,_0x2ded91[_0x15f0('0x15')][_0x15f0('0x17')]);return _0x35677b(_0x2ded91[_0x15f0('0x15')][_0x15f0('0x17')]);}logger[_0x15f0('0x15')](_0x15f0('0x11'),_0xce06a2,_0x2ded91[_0x15f0('0x15')][_0x15f0('0x17')]);return _0x39c3ba(_0x2ded91[_0x15f0('0x15')]['message']);}else{logger[_0x15f0('0x18')](_0x15f0('0x11'),_0xce06a2,_0x15f0('0x12'));_0x39c3ba(_0x2ded91[_0x15f0('0x19')][_0x15f0('0x17')]);}})['catch'](function(_0x564857){logger[_0x15f0('0x15')](_0x15f0('0x11'),_0xce06a2,_0x564857);_0x35677b(_0x564857);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 6d529b1..460f83c 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 _0x0298=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x5f3b0a,_0x442f2f){var _0x81e1f3=function(_0x4a6a9c){while(--_0x4a6a9c){_0x5f3b0a['push'](_0x5f3b0a['shift']());}};_0x81e1f3(++_0x442f2f);}(_0x0298,0x10c));var _0x8029=function(_0x271158,_0x3c4a1c){_0x271158=_0x271158-0x0;var _0x11f139=_0x0298[_0x271158];return _0x11f139;};'use strict';var VoicePrefixEvents=require(_0x8029('0x0'));var events=[_0x8029('0x1'),_0x8029('0x2'),'update'];function createListener(_0x19d515,_0x282b1e){return function(_0xa997a0){_0x282b1e[_0x8029('0x3')](_0x19d515,_0xa997a0);};}function removeListener(_0x5cf406,_0xfe2c81){return function(){VoicePrefixEvents[_0x8029('0x4')](_0x5cf406,_0xfe2c81);};}exports[_0x8029('0x5')]=function(_0x19e049){for(var _0x14dd98=0x0,_0x3c9c8e=events[_0x8029('0x6')];_0x14dd98<_0x3c9c8e;_0x14dd98++){var _0x480097=events[_0x14dd98];var _0x2f1e66=createListener(_0x8029('0x7')+_0x480097,_0x19e049);VoicePrefixEvents['on'](_0x480097,_0x2f1e66);}}; \ No newline at end of file +var _0x6b0c=['save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x23a56f,_0x3a2f85){var _0x2645a3=function(_0x58c21b){while(--_0x58c21b){_0x23a56f['push'](_0x23a56f['shift']());}};_0x2645a3(++_0x3a2f85);}(_0x6b0c,0x70));var _0xc6b0=function(_0x3c3291,_0x29838f){_0x3c3291=_0x3c3291-0x0;var _0x34ae92=_0x6b0c[_0x3c3291];return _0x34ae92;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc6b0('0x0'),_0xc6b0('0x1'),_0xc6b0('0x2')];function createListener(_0x578b24,_0x27680f){return function(_0x2ecc4e){_0x27680f['emit'](_0x578b24,_0x2ecc4e);};}function removeListener(_0x45bd1c,_0x6c6492){return function(){VoicePrefixEvents[_0xc6b0('0x3')](_0x45bd1c,_0x6c6492);};}exports[_0xc6b0('0x4')]=function(_0x4dd34b){for(var _0x49bba7=0x0,_0x5c1b81=events[_0xc6b0('0x5')];_0x49bba7<_0x5c1b81;_0x49bba7++){var _0xcbd62c=events[_0x49bba7];var _0x34c2c6=createListener(_0xc6b0('0x6')+_0xcbd62c,_0x4dd34b);VoicePrefixEvents['on'](_0xcbd62c,_0x34c2c6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d53b9c5..9b6f490 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 _0x04b0=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/lists','/:id/blacklists','addBlackLists','put','/:id','delete','destroy','removeTeams','removeAgents','removeLists','exports','multer','path'];(function(_0x41dcd2,_0x21abc9){var _0x3a0604=function(_0x83a5ce){while(--_0x83a5ce){_0x41dcd2['push'](_0x41dcd2['shift']());}};_0x3a0604(++_0x21abc9);}(_0x04b0,0xb7));var _0x004b=function(_0x5b4743,_0x324e70){_0x5b4743=_0x5b4743-0x0;var _0x599edc=_0x04b0[_0x5b4743];return _0x599edc;};'use strict';var multer=require(_0x004b('0x0'));var util=require('util');var path=require(_0x004b('0x1'));var timeout=require(_0x004b('0x2'));var express=require('express');var router=express[_0x004b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x004b('0x4'));var config=require(_0x004b('0x5'));var controller=require('./voiceQueue.controller');router[_0x004b('0x6')]('/',auth[_0x004b('0x7')](),controller['index']);router[_0x004b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x004b('0x8')]);router['get']('/:id/hoppers',auth[_0x004b('0x7')](),controller['getHoppers']);router[_0x004b('0x6')](_0x004b('0x9'),auth[_0x004b('0x7')](),controller[_0x004b('0xa')]);router[_0x004b('0x6')](_0x004b('0xb'),auth['isAuthenticated'](),controller[_0x004b('0xc')]);router[_0x004b('0x6')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x004b('0xd')]);router[_0x004b('0x6')](_0x004b('0xe'),auth[_0x004b('0x7')](),controller[_0x004b('0xf')]);router[_0x004b('0x6')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller[_0x004b('0x11')]);router[_0x004b('0x6')](_0x004b('0x12'),auth[_0x004b('0x7')](),controller[_0x004b('0x13')]);router[_0x004b('0x6')]('/:id/lists',auth[_0x004b('0x7')](),controller[_0x004b('0x14')]);router[_0x004b('0x6')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x004b('0x15')]);router[_0x004b('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x004b('0x16')](_0x004b('0x17'),auth['isAuthenticated'](),controller[_0x004b('0x18')]);router[_0x004b('0x16')](_0x004b('0xe'),auth[_0x004b('0x7')](),controller[_0x004b('0x19')]);router[_0x004b('0x16')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller['addAgents']);router[_0x004b('0x16')](_0x004b('0x1a'),auth[_0x004b('0x7')](),controller['addLists']);router[_0x004b('0x16')](_0x004b('0x1b'),auth['isAuthenticated'](),controller[_0x004b('0x1c')]);router[_0x004b('0x1d')](_0x004b('0x1e'),auth[_0x004b('0x7')](),controller['update']);router[_0x004b('0x1f')](_0x004b('0x1e'),auth[_0x004b('0x7')](),controller[_0x004b('0x20')]);router[_0x004b('0x1f')](_0x004b('0xe'),auth['isAuthenticated'](),controller[_0x004b('0x21')]);router[_0x004b('0x1f')](_0x004b('0x10'),auth[_0x004b('0x7')](),controller[_0x004b('0x22')]);router['delete'](_0x004b('0x1a'),auth[_0x004b('0x7')](),controller[_0x004b('0x23')]);router['delete'](_0x004b('0x1b'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0x004b('0x24')]=router; \ No newline at end of file +var _0x5de6=['/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addTeams','addAgents','addLists','addBlackLists','update','delete','removeTeams','removeAgents','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index'];(function(_0x2b7edf,_0x58e0a4){var _0x35f03f=function(_0x36be39){while(--_0x36be39){_0x2b7edf['push'](_0x2b7edf['shift']());}};_0x35f03f(++_0x58e0a4);}(_0x5de6,0x1bd));var _0x65de=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5de6[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x65de('0x0'));var util=require(_0x65de('0x1'));var path=require(_0x65de('0x2'));var timeout=require(_0x65de('0x3'));var express=require('express');var router=express[_0x65de('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x65de('0x5'));var config=require(_0x65de('0x6'));var controller=require(_0x65de('0x7'));router[_0x65de('0x8')]('/',auth[_0x65de('0x9')](),controller[_0x65de('0xa')]);router['get'](_0x65de('0xb'),auth[_0x65de('0x9')](),controller[_0x65de('0xc')]);router['get']('/:id/hoppers',auth[_0x65de('0x9')](),controller[_0x65de('0xd')]);router[_0x65de('0x8')](_0x65de('0xe'),auth[_0x65de('0x9')](),controller[_0x65de('0xf')]);router[_0x65de('0x8')](_0x65de('0x10'),auth[_0x65de('0x9')](),controller[_0x65de('0x11')]);router[_0x65de('0x8')](_0x65de('0x12'),auth[_0x65de('0x9')](),controller[_0x65de('0x13')]);router[_0x65de('0x8')]('/:id/teams',auth[_0x65de('0x9')](),controller[_0x65de('0x14')]);router[_0x65de('0x8')](_0x65de('0x15'),auth[_0x65de('0x9')](),controller['getAgents']);router[_0x65de('0x8')](_0x65de('0x16'),auth[_0x65de('0x9')](),controller[_0x65de('0x17')]);router['get'](_0x65de('0x18'),auth[_0x65de('0x9')](),controller[_0x65de('0x19')]);router[_0x65de('0x8')](_0x65de('0x1a'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x65de('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0x65de('0x1b')](_0x65de('0x1c'),auth[_0x65de('0x9')](),controller['clone']);router[_0x65de('0x1b')]('/:id/teams',auth[_0x65de('0x9')](),controller[_0x65de('0x1d')]);router[_0x65de('0x1b')]('/:id/users',auth[_0x65de('0x9')](),controller[_0x65de('0x1e')]);router[_0x65de('0x1b')](_0x65de('0x18'),auth['isAuthenticated'](),controller[_0x65de('0x1f')]);router['post'](_0x65de('0x1a'),auth[_0x65de('0x9')](),controller[_0x65de('0x20')]);router['put'](_0x65de('0xb'),auth[_0x65de('0x9')](),controller[_0x65de('0x21')]);router['delete'](_0x65de('0xb'),auth[_0x65de('0x9')](),controller['destroy']);router[_0x65de('0x22')]('/:id/teams',auth['isAuthenticated'](),controller[_0x65de('0x23')]);router[_0x65de('0x22')](_0x65de('0x15'),auth[_0x65de('0x9')](),controller[_0x65de('0x24')]);router['delete'](_0x65de('0x18'),auth[_0x65de('0x9')](),controller['removeLists']);router[_0x65de('0x22')]('/:id/blacklists',auth[_0x65de('0x9')](),controller[_0x65de('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5a8e6fb..559e778 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(_0x11bb56,_0x14299c){var _0x148b93=function(_0x3e281f){while(--_0x3e281f){_0x11bb56['push'](_0x11bb56['shift']());}};_0x148b93(++_0x14299c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x3fb5f7,_0x3b234b){var _0x344db7=function(_0x4a6485){while(--_0x4a6485){_0x3fb5f7['push'](_0x3fb5f7['shift']());}};_0x344db7(++_0x3b234b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 b66e6f1..ae25ccd 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 _0xdd72=['addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','updatedAt','CmListId','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','./voiceQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','count','includeAll','findAll','catch','show','include','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','omit','UserProfileSection','userProfileId','CmHopper','order','VoiceQueueId','rows','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','Team','Agents','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','ids','spread','online','isArray','getAgents','getMembers','getLists','CmList'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xdd72,0xd5));var _0x2dd7=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xdd72[_0x4fc80b];return _0x119dba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2dd7('0x0'));var rimraf=require(_0x2dd7('0x1'));var zipdir=require(_0x2dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2dd7('0x3'));var moment=require(_0x2dd7('0x4'));var BPromise=require(_0x2dd7('0x5'));var Mustache=require(_0x2dd7('0x6'));var util=require(_0x2dd7('0x7'));var path=require(_0x2dd7('0x8'));var sox=require(_0x2dd7('0x9'));var csv=require(_0x2dd7('0xa'));var ejs=require(_0x2dd7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dd7('0xc'));var jsforce=require(_0x2dd7('0xd'));var deskjs=require(_0x2dd7('0xe'));var toCsv=require(_0x2dd7('0xa'));var querystring=require(_0x2dd7('0xf'));var Papa=require('papaparse');var Redis=require(_0x2dd7('0x10'));var authService=require(_0x2dd7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dd7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2dd7('0x13'));var config=require(_0x2dd7('0x14'));var db=require(_0x2dd7('0x15'))['db'];config['redis']=_[_0x2dd7('0x16')](config['redis'],{'host':_0x2dd7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2dd7('0x18'))[_0x2dd7('0x19')](socket);function respondWithStatusCode(_0x41deee,_0x13d04a){_0x13d04a=_0x13d04a||0xcc;return function(_0x41c4e7){if(_0x41c4e7){return _0x41deee[_0x2dd7('0x1a')](_0x13d04a);}return _0x41deee['status'](_0x13d04a)[_0x2dd7('0x1b')]();};}function respondWithResult(_0x3bcfd1,_0x50d7df){_0x50d7df=_0x50d7df||0xc8;return function(_0x16faf1){if(_0x16faf1){return _0x3bcfd1[_0x2dd7('0x1c')](_0x50d7df)[_0x2dd7('0x1d')](_0x16faf1);}};}function respondWithFilteredResult(_0x3c5a21,_0x1962c6){return function(_0x128fe7){if(_0x128fe7){var _0x295f0d=_0x128fe7['count'],_0x1f34d0=_0x1962c6[_0x2dd7('0x1e')],_0x4a528c=_0x1962c6['offset']+_0x1962c6[_0x2dd7('0x1f')],_0x374377;if(_0x4a528c>=_0x295f0d){_0x4a528c=_0x295f0d;_0x374377=0xc8;}else{_0x374377=0xce;}_0x3c5a21[_0x2dd7('0x1c')](_0x374377);return _0x3c5a21[_0x2dd7('0x20')](_0x2dd7('0x21'),_0x1f34d0+'-'+_0x4a528c+'/'+_0x295f0d)[_0x2dd7('0x1d')](_0x128fe7);}return null;};}function patchUpdates(_0x79d736){return function(_0x41f09a){try{jsonpatch[_0x2dd7('0x22')](_0x41f09a,_0x79d736,!![]);}catch(_0x5f0c74){return BPromise['reject'](_0x5f0c74);}return _0x41f09a[_0x2dd7('0x23')]();};}function saveUpdates(_0x3b14c7,_0x333d9a){return function(_0x53f338){if(_0x53f338){return _0x53f338[_0x2dd7('0x24')](_0x3b14c7)[_0x2dd7('0x25')](function(_0xb44a54){return _0xb44a54;});}return null;};}function removeEntity(_0x190d8f,_0x366309){return function(_0xbbc41d){if(_0xbbc41d){return _0xbbc41d[_0x2dd7('0x26')]()['then'](function(){var _0x189e8b=_0xbbc41d[_0x2dd7('0x27')]({'plain':!![]});var _0x245a47=[{'name':'VoiceQueues','value':_0x2dd7('0x28'),'ignore':![]},{'name':_0x2dd7('0x29'),'value':_0x2dd7('0x2a'),'ignore':![]}];var _0x291ca7=_(_0x245a47)[_0x2dd7('0x2b')](_0x2dd7('0x2c'))[_0x2dd7('0x2d')](_0x2dd7('0x2e'))['value']();if(_[_0x2dd7('0x2f')](_0x291ca7,_0x189e8b[_0x2dd7('0x30')])){return;}var _0x419aad=_['find'](_0x245a47,[_0x2dd7('0x2e'),_0x189e8b['type']])[_0x2dd7('0x31')];return db['UserProfileResource'][_0x2dd7('0x26')]({'where':{'type':_0x419aad,'resourceId':_0x189e8b['id']}})['then'](function(){return _0xbbc41d;});})['then'](function(){_0x190d8f[_0x2dd7('0x1c')](0xcc)[_0x2dd7('0x1b')]();});}};}function handleEntityNotFound(_0x5d8a64,_0x290c5b){return function(_0x6d863){if(!_0x6d863){_0x5d8a64[_0x2dd7('0x1a')](0x194);}return _0x6d863;};}function handleError(_0x233dd6,_0x49b552){_0x49b552=_0x49b552||0x1f4;return function(_0x1d4d9f){logger[_0x2dd7('0x32')](_0x1d4d9f[_0x2dd7('0x33')]);if(_0x1d4d9f[_0x2dd7('0x31')]){delete _0x1d4d9f[_0x2dd7('0x31')];}_0x233dd6['status'](_0x49b552)[_0x2dd7('0x34')](_0x1d4d9f);};}exports[_0x2dd7('0x35')]=function(_0x1eed0f,_0x4591f3){var _0x34b821={},_0x4a94f5={},_0x41b81e={'count':0x0,'rows':[]};var _0x5069f3=_[_0x2dd7('0x2d')](db[_0x2dd7('0x36')][_0x2dd7('0x37')],function(_0x1979ec){return{'name':_0x1979ec[_0x2dd7('0x38')],'type':_0x1979ec[_0x2dd7('0x30')][_0x2dd7('0x39')]};});_0x4a94f5[_0x2dd7('0x3a')]=_[_0x2dd7('0x2d')](_0x5069f3,'name');_0x4a94f5[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x1eed0f[_0x2dd7('0x3b')]);_0x4a94f5[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x4a94f5['model'],_0x4a94f5[_0x2dd7('0x3b')]);_0x34b821[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x4a94f5[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x34b821[_0x2dd7('0x3f')]=_0x34b821['attributes'][_0x2dd7('0x41')]?_0x34b821['attributes']:_0x4a94f5[_0x2dd7('0x3a')];if(!_0x1eed0f[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x34b821[_0x2dd7('0x1f')]=qs['limit'](_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x34b821[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x1eed0f['query']['offset']);}_0x34b821['order']=qs[_0x2dd7('0x43')](_0x1eed0f['query'][_0x2dd7('0x43')]);_0x34b821[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x1eed0f[_0x2dd7('0x3b')],_0x4a94f5[_0x2dd7('0x3d')]),_0x5069f3);if(_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x34b821[_0x2dd7('0x44')]=_['merge'](_0x34b821[_0x2dd7('0x44')],{'$or':_['map'](_0x5069f3,function(_0x293966){if(_0x293966[_0x2dd7('0x30')]!==_0x2dd7('0x46')){var _0x1cf550={};_0x1cf550[_0x293966['name']]={'$like':'%'+_0x1eed0f['query'][_0x2dd7('0x2b')]+'%'};return _0x1cf550;}})});}_0x34b821=_['merge']({},_0x34b821,_0x1eed0f['options']);var _0x11323c={'where':_0x34b821[_0x2dd7('0x44')]};return db[_0x2dd7('0x36')][_0x2dd7('0x47')](_0x11323c)[_0x2dd7('0x25')](function(_0x1b2247){_0x41b81e['count']=_0x1b2247;if(_0x1eed0f[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x34b821['include']=[{'all':!![]}];}return db[_0x2dd7('0x36')][_0x2dd7('0x49')](_0x34b821);})[_0x2dd7('0x25')](function(_0x224a26){_0x41b81e['rows']=_0x224a26;return _0x41b81e;})[_0x2dd7('0x25')](respondWithFilteredResult(_0x4591f3,_0x34b821))[_0x2dd7('0x4a')](handleError(_0x4591f3,null));};exports[_0x2dd7('0x4b')]=function(_0x55d9d1,_0x8875d6){var _0xece239={'raw':![],'where':{'id':_0x55d9d1['params']['id']}},_0x5d9004={};_0x5d9004['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x36')]['rawAttributes']);_0x5d9004[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x55d9d1['query']);_0x5d9004['filters']=_[_0x2dd7('0x3e')](_0x5d9004[_0x2dd7('0x3a')],_0x5d9004[_0x2dd7('0x3b')]);_0xece239[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x5d9004[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x55d9d1[_0x2dd7('0x3b')]['fields']));_0xece239['attributes']=_0xece239['attributes'][_0x2dd7('0x41')]?_0xece239[_0x2dd7('0x3f')]:_0x5d9004[_0x2dd7('0x3a')];if(_0x55d9d1['query'][_0x2dd7('0x48')]){_0xece239[_0x2dd7('0x4c')]=[{'all':!![]}];}_0xece239=_[_0x2dd7('0x4d')]({},_0xece239,_0x55d9d1[_0x2dd7('0x4e')]);return db[_0x2dd7('0x36')]['find'](_0xece239)[_0x2dd7('0x25')](handleEntityNotFound(_0x8875d6,null))['then'](respondWithResult(_0x8875d6,null))[_0x2dd7('0x4a')](handleError(_0x8875d6,null));};exports[_0x2dd7('0x4f')]=function(_0x3598dc,_0x2f56aa){return db['VoiceQueue'][_0x2dd7('0x4f')](_0x3598dc[_0x2dd7('0x50')],{})[_0x2dd7('0x25')](function(_0x1f6a8e){var _0x3e9510=_0x3598dc[_0x2dd7('0x51')][_0x2dd7('0x27')]({'plain':!![]});if(!_0x3e9510)throw new Error(_0x2dd7('0x52'));if(_0x3e9510[_0x2dd7('0x53')]===_0x2dd7('0x51')){var _0x25e0b9=_0x1f6a8e[_0x2dd7('0x27')]({'plain':!![]});var _0x43d40c=[{'name':_0x2dd7('0x54'),'value':'inbound'},{'name':_0x2dd7('0x29'),'value':'outbound'}];var _0x190e09=_[_0x2dd7('0x55')](_0x43d40c,[_0x2dd7('0x2e'),_0x25e0b9[_0x2dd7('0x30')]])[_0x2dd7('0x31')];return db['UserProfileSection'][_0x2dd7('0x55')]({'where':{'name':_0x190e09,'userProfileId':_0x3e9510['userProfileId']},'raw':!![]})['then'](function(_0x692ebf){if(_0x692ebf&&_0x692ebf[_0x2dd7('0x56')]===0x0){return db[_0x2dd7('0x57')]['create']({'name':_0x25e0b9[_0x2dd7('0x31')],'resourceId':_0x25e0b9['id'],'type':_0x692ebf[_0x2dd7('0x31')],'sectionId':_0x692ebf['id']},{})[_0x2dd7('0x25')](function(){return _0x1f6a8e;});}else{return _0x1f6a8e;}})[_0x2dd7('0x4a')](function(_0x3e3120){logger[_0x2dd7('0x32')](_0x2dd7('0x58'),_0x3e3120);throw _0x3e3120;});}return _0x1f6a8e;})[_0x2dd7('0x25')](respondWithResult(_0x2f56aa,0xc9))[_0x2dd7('0x4a')](handleError(_0x2f56aa,null));};exports[_0x2dd7('0x59')]=function(_0x42426d,_0x220bbc){var _0x1a4edc={'where':{'id':_0x42426d[_0x2dd7('0x5a')]['id']}},_0x227e5e={};_0x227e5e[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x36')][_0x2dd7('0x37')]);_0x1a4edc['attributes']=_['intersection'](_0x227e5e[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x42426d[_0x2dd7('0x3b')]['fields']));_0x1a4edc['attributes']=_0x1a4edc[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x1a4edc['attributes']:_0x227e5e[_0x2dd7('0x3a')];if(_0x42426d[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x1a4edc[_0x2dd7('0x4c')]=[{'all':!![]}];}_0x1a4edc=_['merge']({},_0x1a4edc,_0x42426d['options']);return db[_0x2dd7('0x36')][_0x2dd7('0x55')](_0x1a4edc)['then'](handleEntityNotFound(_0x220bbc,null))[_0x2dd7('0x25')](function(_0x671c88){if(_0x671c88){var _0x33d251=_0x671c88[_0x2dd7('0x27')]({'plain':!![]});_0x33d251=qs['omit'](_0x33d251,['id',_0x2dd7('0x5b'),'updatedAt']);_0x42426d['body']=_[_0x2dd7('0x5c')](_0x42426d[_0x2dd7('0x50')],['id',_0x2dd7('0x5b'),'updatedAt']);return db[_0x2dd7('0x36')][_0x2dd7('0x4f')](_[_0x2dd7('0x4d')](_0x33d251,_0x42426d[_0x2dd7('0x50')]),{'include':_0x42426d[_0x2dd7('0x3b')][_0x2dd7('0x48')]?[{'all':!![]}]:undefined})[_0x2dd7('0x25')](function(_0x1df60f){var _0x340b48=_0x42426d['user'][_0x2dd7('0x27')]({'plain':!![]});if(!_0x340b48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340b48[_0x2dd7('0x53')]==='user'){var _0x40b3e2=_0x1df60f['get']({'plain':!![]});var _0x495c16=[{'name':_0x2dd7('0x54'),'value':_0x2dd7('0x28')},{'name':_0x2dd7('0x29'),'value':'outbound'}];var _0x362e41=_[_0x2dd7('0x55')](_0x495c16,[_0x2dd7('0x2e'),_0x40b3e2['type']])[_0x2dd7('0x31')];return db[_0x2dd7('0x5d')]['find']({'where':{'name':_0x362e41,'userProfileId':_0x340b48[_0x2dd7('0x5e')]},'raw':!![]})[_0x2dd7('0x25')](function(_0x552db5){if(_0x552db5&&_0x552db5['autoAssociation']===0x0){return db['UserProfileResource'][_0x2dd7('0x4f')]({'name':_0x40b3e2[_0x2dd7('0x31')],'resourceId':_0x40b3e2['id'],'type':_0x552db5[_0x2dd7('0x31')],'sectionId':_0x552db5['id']},{})[_0x2dd7('0x25')](function(){return _0x1df60f;});}else{return _0x1df60f;}})[_0x2dd7('0x4a')](function(_0x4bebc7){logger[_0x2dd7('0x32')](_0x2dd7('0x58'),_0x4bebc7);throw _0x4bebc7;});}return _0x1df60f;});}})[_0x2dd7('0x25')](respondWithResult(_0x220bbc,0xc9))[_0x2dd7('0x4a')](handleError(_0x220bbc,null));};exports[_0x2dd7('0x24')]=function(_0x50cbdc,_0x5378db){if(_0x50cbdc[_0x2dd7('0x50')]['id']){delete _0x50cbdc[_0x2dd7('0x50')]['id'];}return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x50cbdc[_0x2dd7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5378db,null))['then'](saveUpdates(_0x50cbdc[_0x2dd7('0x50')],null))[_0x2dd7('0x25')](respondWithResult(_0x5378db,null))['catch'](handleError(_0x5378db,null));};exports[_0x2dd7('0x26')]=function(_0x1a4538,_0x2a78cc){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x1a4538['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2a78cc,null))['then'](removeEntity(_0x2a78cc,null))[_0x2dd7('0x4a')](handleError(_0x2a78cc,null));};exports['getHoppers']=function(_0x4ad7e5,_0x1f58b8,_0x41f21a){var _0x4ce0e7={'raw':![],'where':{}};var _0x5ca2f0={};var _0xefcbf2={'count':0x0,'rows':[]};return db[_0x2dd7('0x36')]['findOne']({'where':{'id':_0x4ad7e5[_0x2dd7('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1f58b8,null))['then'](function(_0x28a4e3){if(_0x28a4e3){_0x5ca2f0['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x5f')][_0x2dd7('0x37')]);_0x5ca2f0[_0x2dd7('0x3b')]=_['keys'](_0x4ad7e5[_0x2dd7('0x3b')]);_0x5ca2f0['filters']=_['intersection'](_0x5ca2f0[_0x2dd7('0x3a')],_0x5ca2f0['query']);_0x4ce0e7[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x5ca2f0[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x4ad7e5['query'][_0x2dd7('0x40')]));_0x4ce0e7[_0x2dd7('0x3f')]=_0x4ce0e7[_0x2dd7('0x3f')]['length']?_0x4ce0e7[_0x2dd7('0x3f')]:_0x5ca2f0[_0x2dd7('0x3a')];if(!_0x4ad7e5[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x4ce0e7['limit']=qs[_0x2dd7('0x1f')](_0x4ad7e5[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x4ce0e7['offset']=qs[_0x2dd7('0x1e')](_0x4ad7e5[_0x2dd7('0x3b')]['offset']);}_0x4ce0e7[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x4ad7e5[_0x2dd7('0x3b')]['sort']);_0x4ce0e7[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x4ad7e5['query'],_0x5ca2f0[_0x2dd7('0x3d')]));_0x4ce0e7[_0x2dd7('0x44')][_0x2dd7('0x61')]=_0x28a4e3['id'];if(_0x4ad7e5[_0x2dd7('0x3b')]['filter']){_0x4ce0e7['where']=_[_0x2dd7('0x4d')](_0x4ce0e7[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x4ce0e7[_0x2dd7('0x3f')],function(_0x2a69af){var _0x2cc98e={};_0x2cc98e[_0x2a69af]={'$like':'%'+_0x4ad7e5[_0x2dd7('0x3b')]['filter']+'%'};return _0x2cc98e;})});}_0x4ce0e7=_[_0x2dd7('0x4d')]({},_0x4ce0e7,_0x4ad7e5[_0x2dd7('0x4e')]);return db[_0x2dd7('0x5f')][_0x2dd7('0x47')]({'where':_0x4ce0e7[_0x2dd7('0x44')]})['then'](function(_0x3f43e0){_0xefcbf2[_0x2dd7('0x47')]=_0x3f43e0;if(_0x4ad7e5['query'][_0x2dd7('0x48')]){_0x4ce0e7[_0x2dd7('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x2dd7('0x49')](_0x4ce0e7);})[_0x2dd7('0x25')](function(_0x384991){_0xefcbf2[_0x2dd7('0x62')]=_0x384991;return _0xefcbf2;});}})['then'](respondWithFilteredResult(_0x1f58b8,_0x4ce0e7))[_0x2dd7('0x4a')](handleError(_0x1f58b8,null));};exports[_0x2dd7('0x63')]=function(_0x55ab29,_0x4fda37,_0x275f71){var _0x3d3834={'raw':!![],'where':{}};var _0x11f7a0={};var _0x5ba348={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x55ab29[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x4fda37,null))[_0x2dd7('0x25')](function(_0x35b817){if(_0x35b817){_0x11f7a0['model']=_[_0x2dd7('0x3c')](db[_0x2dd7('0x65')][_0x2dd7('0x37')]);_0x11f7a0[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x55ab29[_0x2dd7('0x3b')]);_0x11f7a0[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x11f7a0[_0x2dd7('0x3a')],_0x11f7a0[_0x2dd7('0x3b')]);_0x3d3834[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x11f7a0[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x3d3834['attributes']=_0x3d3834[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x3d3834[_0x2dd7('0x3f')]:_0x11f7a0[_0x2dd7('0x3a')];if(!_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x3d3834[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x55ab29['query'][_0x2dd7('0x1f')]);_0x3d3834['offset']=qs[_0x2dd7('0x1e')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}_0x3d3834[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x3d3834[_0x2dd7('0x44')]=qs['filters'](_['pick'](_0x55ab29[_0x2dd7('0x3b')],_0x11f7a0[_0x2dd7('0x3d')]));_0x3d3834[_0x2dd7('0x44')][_0x2dd7('0x61')]=_0x35b817['id'];if(_0x55ab29[_0x2dd7('0x3b')]['filter']){_0x3d3834[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x3d3834[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x3d3834[_0x2dd7('0x3f')],function(_0x583e6c){var _0x585d42={};_0x585d42[_0x583e6c]={'$like':'%'+_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x585d42;})});}_0x3d3834=_[_0x2dd7('0x4d')]({},_0x3d3834,_0x55ab29[_0x2dd7('0x4e')]);return db[_0x2dd7('0x65')]['count']({'where':_0x3d3834[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0x400f54){_0x5ba348['count']=_0x400f54;if(_0x55ab29[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x3d3834[_0x2dd7('0x4c')]=[{'all':!![]}];}return db[_0x2dd7('0x65')][_0x2dd7('0x49')](_0x3d3834);})[_0x2dd7('0x25')](function(_0x1f9fb0){_0x5ba348[_0x2dd7('0x62')]=_0x1f9fb0;return _0x5ba348;});}})[_0x2dd7('0x25')](respondWithFilteredResult(_0x4fda37,_0x3d3834))[_0x2dd7('0x4a')](handleError(_0x4fda37,null));};exports[_0x2dd7('0x67')]=function(_0x475dbe,_0x46f5be,_0x312353){var _0x2e18ac={'raw':!![],'where':{}};var _0x5f13e4={};var _0x2ba885={'count':0x0,'rows':[]};return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x475dbe[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x46f5be,null))['then'](function(_0x305357){if(_0x305357){_0x5f13e4[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x68')][_0x2dd7('0x37')]);_0x5f13e4[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x475dbe[_0x2dd7('0x3b')]);_0x5f13e4[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x5f13e4[_0x2dd7('0x3a')],_0x5f13e4['query']);_0x2e18ac['attributes']=_['intersection'](_0x5f13e4[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x2e18ac[_0x2dd7('0x3f')]=_0x2e18ac[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x2e18ac['attributes']:_0x5f13e4[_0x2dd7('0x3a')];if(!_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x2e18ac[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x475dbe['query'][_0x2dd7('0x1f')]);_0x2e18ac['offset']=qs[_0x2dd7('0x1e')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}_0x2e18ac[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x475dbe[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x2e18ac[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x475dbe[_0x2dd7('0x3b')],_0x5f13e4[_0x2dd7('0x3d')]));_0x2e18ac['where'][_0x2dd7('0x61')]=_0x305357['id'];if(_0x475dbe[_0x2dd7('0x3b')]['filter']){_0x2e18ac[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x2e18ac[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x2e18ac['attributes'],function(_0x116ed1){var _0x5c01db={};_0x5c01db[_0x116ed1]={'$like':'%'+_0x475dbe[_0x2dd7('0x3b')]['filter']+'%'};return _0x5c01db;})});}_0x2e18ac=_[_0x2dd7('0x4d')]({},_0x2e18ac,_0x475dbe[_0x2dd7('0x4e')]);return db[_0x2dd7('0x68')]['count']({'where':_0x2e18ac[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0xad0a9d){_0x2ba885[_0x2dd7('0x47')]=_0xad0a9d;if(_0x475dbe[_0x2dd7('0x3b')]['includeAll']){_0x2e18ac[_0x2dd7('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2e18ac);})[_0x2dd7('0x25')](function(_0x1fe9d6){_0x2ba885[_0x2dd7('0x62')]=_0x1fe9d6;return _0x2ba885;});}})[_0x2dd7('0x25')](respondWithFilteredResult(_0x46f5be,_0x2e18ac))[_0x2dd7('0x4a')](handleError(_0x46f5be,null));};exports[_0x2dd7('0x69')]=function(_0x3ffc7a,_0x2d21d4,_0x32d2a7){var _0x5d925a={'raw':!![],'where':{}};var _0xd15f1e={};var _0xf50f35={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x3ffc7a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2d21d4,null))[_0x2dd7('0x25')](function(_0xda4086){if(_0xda4086){_0xd15f1e[_0x2dd7('0x3a')]=_['keys'](db[_0x2dd7('0x6a')][_0x2dd7('0x37')]);_0xd15f1e['query']=_[_0x2dd7('0x3c')](_0x3ffc7a[_0x2dd7('0x3b')]);_0xd15f1e[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0xd15f1e[_0x2dd7('0x3a')],_0xd15f1e[_0x2dd7('0x3b')]);_0x5d925a['attributes']=_[_0x2dd7('0x3e')](_0xd15f1e[_0x2dd7('0x3a')],qs['fields'](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x5d925a['attributes']=_0x5d925a['attributes'][_0x2dd7('0x41')]?_0x5d925a[_0x2dd7('0x3f')]:_0xd15f1e[_0x2dd7('0x3a')];if(!_0x3ffc7a['query'][_0x2dd7('0x66')]('nolimit')){_0x5d925a['limit']=qs[_0x2dd7('0x1f')](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x5d925a['offset']=qs[_0x2dd7('0x1e')](_0x3ffc7a['query'][_0x2dd7('0x1e')]);}_0x5d925a[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x5d925a[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_['pick'](_0x3ffc7a['query'],_0xd15f1e[_0x2dd7('0x3d')]));_0x5d925a['where']['VoiceQueueId']=_0xda4086['id'];if(_0x3ffc7a['query'][_0x2dd7('0x2b')]){_0x5d925a[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x5d925a[_0x2dd7('0x44')],{'$or':_['map'](_0x5d925a[_0x2dd7('0x3f')],function(_0x4dc03f){var _0x4f2202={};_0x4f2202[_0x4dc03f]={'$like':'%'+_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x4f2202;})});}_0x5d925a=_['merge']({},_0x5d925a,_0x3ffc7a[_0x2dd7('0x4e')]);return db[_0x2dd7('0x6a')][_0x2dd7('0x47')]({'where':_0x5d925a[_0x2dd7('0x44')]})[_0x2dd7('0x25')](function(_0x4a930e){_0xf50f35[_0x2dd7('0x47')]=_0x4a930e;if(_0x3ffc7a[_0x2dd7('0x3b')][_0x2dd7('0x48')]){_0x5d925a[_0x2dd7('0x4c')]=[{'all':!![]}];}return db[_0x2dd7('0x6a')]['findAll'](_0x5d925a);})['then'](function(_0x597a2e){_0xf50f35[_0x2dd7('0x62')]=_0x597a2e;return _0xf50f35;});}})['then'](respondWithFilteredResult(_0x2d21d4,_0x5d925a))[_0x2dd7('0x4a')](handleError(_0x2d21d4,null));};exports[_0x2dd7('0x6b')]=function(_0x1604db,_0x2db8e7,_0x4d3737){var _0x518a36={};var _0x23496e={};var _0x2e0168;var _0xa8db81;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x1604db[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x2db8e7,null))[_0x2dd7('0x25')](function(_0x333ac0){if(_0x333ac0){_0x2e0168=_0x333ac0;_0x23496e['model']=_[_0x2dd7('0x3c')](db['Team'][_0x2dd7('0x37')]);_0x23496e['query']=_['keys'](_0x1604db['query']);_0x23496e['filters']=_[_0x2dd7('0x3e')](_0x23496e[_0x2dd7('0x3a')],_0x23496e[_0x2dd7('0x3b')]);_0x518a36['attributes']=_[_0x2dd7('0x3e')](_0x23496e['model'],qs[_0x2dd7('0x40')](_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x518a36[_0x2dd7('0x3f')]=_0x518a36['attributes']['length']?_0x518a36['attributes']:_0x23496e[_0x2dd7('0x3a')];_0x518a36['order']=qs[_0x2dd7('0x43')](_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x518a36['where']=qs[_0x2dd7('0x3d')](_['pick'](_0x1604db['query'],_0x23496e[_0x2dd7('0x3d')]));if(_0x1604db[_0x2dd7('0x3b')]['filter']){_0x518a36[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x518a36['where'],{'$or':_[_0x2dd7('0x2d')](_0x518a36['attributes'],function(_0x4b7595){var _0x6b49f6={};_0x6b49f6[_0x4b7595]={'$like':'%'+_0x1604db[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x6b49f6;})});}_0x518a36=_['merge']({},_0x518a36,_0x1604db[_0x2dd7('0x4e')]);return _0x2e0168[_0x2dd7('0x6b')](_0x518a36);}})[_0x2dd7('0x25')](function(_0x3f8a87){if(_0x3f8a87){_0xa8db81=_0x3f8a87[_0x2dd7('0x41')];if(!_0x1604db[_0x2dd7('0x3b')]['hasOwnProperty'](_0x2dd7('0x42'))){_0x518a36['limit']=qs['limit'](_0x1604db[_0x2dd7('0x3b')]['limit']);_0x518a36[_0x2dd7('0x1e')]=qs['offset'](_0x1604db['query'][_0x2dd7('0x1e')]);}return _0x2e0168[_0x2dd7('0x6b')](_0x518a36);}})[_0x2dd7('0x25')](function(_0x4659bf){if(_0x4659bf){return _0x4659bf?{'count':_0xa8db81,'rows':_0x4659bf}:null;}})['then'](respondWithResult(_0x2db8e7,null))['catch'](handleError(_0x2db8e7,null));};exports[_0x2dd7('0x6c')]=function(_0x1b566b,_0xda281a,_0x16d65e){var _0x1c9282=_0x1b566b[_0x2dd7('0x50')][_0x2dd7('0x6d')];var _0x57aed0=_[_0x2dd7('0x2d')](_0x1c9282,'id');return db['Team'][_0x2dd7('0x49')]({'where':{'id':_0x57aed0},'attributes':['id'],'include':[{'model':db[_0x2dd7('0x6e')],'as':'Agents','attributes':['id',_0x2dd7('0x31'),'online','voicePause','interface'],'raw':!![]}]})[_0x2dd7('0x25')](function(_0xd39c1e){if(_0xd39c1e){var _0xe54762=_['flatMap'](_0xd39c1e,function(_0x52ab9d){var _0x31ac97=_0x52ab9d[_0x2dd7('0x27')]({'plain':!![]});_0x31ac97['Agents'][_0x2dd7('0x6f')](function(_0x4d5e24){_0x4d5e24[_0x2dd7('0x70')]=_[_0x2dd7('0x55')](_0x1c9282,{'id':_0x31ac97['id']})[_0x2dd7('0x70')];});return _0x31ac97['Agents'];});return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x1b566b[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(_0x58a0ed){return db[_0x2dd7('0x71')][_0x2dd7('0x72')](function(_0x5d6d74){return _0x58a0ed[_0x2dd7('0x6c')](_0x57aed0,{'transaction':_0x5d6d74})[_0x2dd7('0x25')](function(){return BPromise['each'](_0xe54762,function(_0x15b4b8){return db[_0x2dd7('0x73')][_0x2dd7('0x74')]({'where':{'UserId':_0x15b4b8['id'],'VoiceQueueId':_0x1b566b[_0x2dd7('0x5a')]['id']},'defaults':{'penalty':_0x15b4b8[_0x2dd7('0x70')]},'transaction':_0x5d6d74});});})['then'](function(){return BPromise['each'](_[_0x2dd7('0x2b')](_0xe54762,{'online':!![]}),function(_0x5cd811){return db['UserVoiceQueueRt'][_0x2dd7('0x75')]({'membername':_0x5cd811['name'],'UserId':_0x5cd811['id'],'queue_name':_0x58a0ed[_0x2dd7('0x31')],'VoiceQueueId':_0x58a0ed['id'],'interface':_[_0x2dd7('0x76')](_0x5cd811[_0x2dd7('0x77')])?util[_0x2dd7('0x78')](_0x2dd7('0x79'),_0x5cd811['name']):_0x5cd811[_0x2dd7('0x77')],'paused':_0x5cd811[_0x2dd7('0x7a')]||![],'penalty':_0x5cd811['penalty']},{'transaction':_0x5d6d74});});})[_0x2dd7('0x25')](function(){_0xe54762[_0x2dd7('0x6f')](function(_0x40f3bd){socket['emit'](_0x2dd7('0x7b'),{'UserId':_0x40f3bd['id'],'VoiceQueueId':_0x58a0ed['id']});});});});});}})['then'](respondWithStatusCode(_0xda281a,null))[_0x2dd7('0x4a')](handleError(_0xda281a,null));};exports[_0x2dd7('0x7c')]=function(_0x103417,_0x34b1d9,_0xe7ef93){return db[_0x2dd7('0x7d')][_0x2dd7('0x49')]({'where':{'id':_0x103417[_0x2dd7('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2dd7('0x6e')],'as':_0x2dd7('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x2dd7('0x25')](handleEntityNotFound(_0x34b1d9,null))['then'](function(_0x582146){var _0x35f45d=_[_0x2dd7('0x2d')](_0x582146,'id');var _0x5e91ce=[];var _0x1ce5b9=[];var _0x400d94=squel['select']();_0x400d94[_0x2dd7('0x7f')](_0x2dd7('0x80'))[_0x2dd7('0x81')](_0x2dd7('0x82'),'tq')[_0x2dd7('0x83')](_0x2dd7('0x84'),'ut',_0x2dd7('0x85'))[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x103417[_0x2dd7('0x5a')]['id']);for(var _0x135ec5=0x0;_0x135ec5<_0x582146[_0x2dd7('0x41')];_0x135ec5+=0x1){let _0x455411=_0x582146[_0x135ec5];for(var _0x3cffa1=0x0;_0x3cffa1<_0x455411['Agents'][_0x2dd7('0x41')];_0x3cffa1+=0x1){let _0x863180=_0x455411['Agents'][_0x3cffa1];var _0x11651e=_0x400d94['clone']();_0x11651e['where'](_0x2dd7('0x87'),_0x863180['id']);_0x1ce5b9[_0x2dd7('0x88')](db['sequelize']['query'](_0x11651e[_0x2dd7('0x89')](),{'type':db[_0x2dd7('0x71')][_0x2dd7('0x8a')]['SELECT']})[_0x2dd7('0x25')](function(_0xe24fc6){if(_0xe24fc6[_0x2dd7('0x41')]===0x1){return _0x863180['id'];}else{var _0x3d7516=_[_0x2dd7('0x8b')](_[_0x2dd7('0x2d')](_0xe24fc6,_0x2dd7('0x8c')),function(_0x4afbd7){return _[_0x2dd7('0x2f')](_0x35f45d,_0x4afbd7);});if(_0x3d7516){return _0x863180['id'];}}}));}}return BPromise[_0x2dd7('0x8d')](_0x1ce5b9)['then'](function(_0x57e4ce){_0x5e91ce=_(_0x5e91ce)[_0x2dd7('0x8e')](_0x57e4ce)['compact']()[_0x2dd7('0x2e')]();return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x103417[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(_0x40ff04){return db[_0x2dd7('0x71')][_0x2dd7('0x72')](function(_0x4333f8){return _0x40ff04[_0x2dd7('0x7c')](_0x103417['query']['ids'],{'transaction':_0x4333f8})[_0x2dd7('0x25')](function(){if(!_[_0x2dd7('0x8f')](_0x5e91ce)){return _0x40ff04[_0x2dd7('0x90')](_0x5e91ce,{'transaction':_0x4333f8})['then'](function(){return db[_0x2dd7('0x91')][_0x2dd7('0x26')]({'where':{'VoiceQueueId':_0x103417[_0x2dd7('0x5a')]['id'],'UserId':_0x5e91ce},'transaction':_0x4333f8});});}})[_0x2dd7('0x25')](function(){_0x5e91ce[_0x2dd7('0x6f')](function(_0x38e564){socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':_0x38e564,'VoiceQueueId':_0x40ff04['id']});});});});});});})['then'](respondWithStatusCode(_0x34b1d9,null))[_0x2dd7('0x4a')](handleError(_0x34b1d9,null));};exports[_0x2dd7('0x94')]=function(_0x3f553c,_0x588ca5,_0x4726a8){var _0x4127ee,_0x382796;return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x3f553c['params']['id']}})['then'](handleEntityNotFound(_0x588ca5,null))[_0x2dd7('0x25')](function(_0x17a19d){if(_0x17a19d){_0x382796=_0x17a19d;return _0x17a19d['addAgents'](_0x3f553c[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x3f553c[_0x2dd7('0x50')],['ids','id'])||{})[_0x2dd7('0x96')](function(_0x3a5775){for(var _0x2d4414=0x0;_0x2d4414<_0x3f553c[_0x2dd7('0x50')]['ids'][_0x2dd7('0x41')];_0x2d4414+=0x1){socket[_0x2dd7('0x92')](_0x2dd7('0x7b'),{'UserId':_0x3f553c['body'][_0x2dd7('0x95')][_0x2d4414],'VoiceQueueId':_0x3f553c[_0x2dd7('0x5a')]['id']});}return _0x3a5775;});}})[_0x2dd7('0x25')](function(_0x577f45){_0x4127ee=_0x577f45||[];if(_0x382796){return db[_0x2dd7('0x6e')][_0x2dd7('0x49')]({'where':{'id':_0x3f553c[_0x2dd7('0x50')][_0x2dd7('0x95')]},'attributes':['id',_0x2dd7('0x31'),_0x2dd7('0x97'),_0x2dd7('0x7a'),_0x2dd7('0x77')],'raw':!![]});}})[_0x2dd7('0x25')](function(_0x2c4c82){if(!_[_0x2dd7('0x8f')](_0x2c4c82)){var _0x2c3b65=[];for(var _0x1c8ddd=0x0;_0x1c8ddd<_0x2c4c82[_0x2dd7('0x41')];_0x1c8ddd++){if(_0x2c4c82[_0x1c8ddd]['online']){_0x2c3b65[_0x2dd7('0x88')](db[_0x2dd7('0x91')]['upsert']({'membername':_0x2c4c82[_0x1c8ddd][_0x2dd7('0x31')],'UserId':_0x2c4c82[_0x1c8ddd]['id'],'queue_name':_0x382796[_0x2dd7('0x31')],'VoiceQueueId':_0x382796['id'],'interface':_[_0x2dd7('0x76')](_0x2c4c82[_0x1c8ddd][_0x2dd7('0x77')])?util['format'](_0x2dd7('0x79'),_0x2c4c82[_0x1c8ddd][_0x2dd7('0x31')]):_0x2c4c82[_0x1c8ddd]['interface'],'paused':_0x2c4c82[_0x1c8ddd]['voicePause']||![],'penalty':_0x3f553c[_0x2dd7('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x2c3b65);}})[_0x2dd7('0x25')](function(){return _0x4127ee;})[_0x2dd7('0x25')](respondWithResult(_0x588ca5,null))[_0x2dd7('0x4a')](handleError(_0x588ca5,null));};exports[_0x2dd7('0x90')]=function(_0xbc5b42,_0x21af8d,_0x5c76c7){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0xbc5b42[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x21af8d,null))[_0x2dd7('0x25')](function(_0x4ad38f){if(_0x4ad38f){return _0x4ad38f['removeAgents'](_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')])['then'](function(){if(_[_0x2dd7('0x98')](_0xbc5b42['query'][_0x2dd7('0x95')])){for(var _0x2e0deb=0x0;_0x2e0deb<_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')][_0x2dd7('0x41')];_0x2e0deb+=0x1){socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':Number(_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')][_0x2e0deb]),'VoiceQueueId':Number(_0xbc5b42[_0x2dd7('0x5a')]['id'])});}}else{socket[_0x2dd7('0x92')](_0x2dd7('0x93'),{'UserId':Number(_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')]),'VoiceQueueId':Number(_0xbc5b42[_0x2dd7('0x5a')]['id'])});}});}})[_0x2dd7('0x25')](function(_0xa06ff7){return db[_0x2dd7('0x91')][_0x2dd7('0x26')]({'where':{'VoiceQueueId':_0xbc5b42[_0x2dd7('0x5a')]['id'],'UserId':_0xbc5b42[_0x2dd7('0x3b')][_0x2dd7('0x95')]}})[_0x2dd7('0x25')](function(){return _0xa06ff7;});})[_0x2dd7('0x25')](respondWithStatusCode(_0x21af8d,null))[_0x2dd7('0x4a')](handleError(_0x21af8d,null));};exports['getAgents']=function(_0x53d505,_0x19ef6c,_0x153d73){var _0xb8a83e={};var _0x5e2814={};var _0x261462;var _0x8580be;return db['VoiceQueue'][_0x2dd7('0x64')]({'where':{'id':_0x53d505[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x19ef6c,null))[_0x2dd7('0x25')](function(_0x303490){if(_0x303490){_0x261462=_0x303490;_0x5e2814[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x6e')][_0x2dd7('0x37')]);_0x5e2814['query']=_[_0x2dd7('0x3c')](_0x53d505[_0x2dd7('0x3b')]);_0x5e2814[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x5e2814['model'],_0x5e2814[_0x2dd7('0x3b')]);_0xb8a83e['attributes']=_[_0x2dd7('0x3e')](_0x5e2814[_0x2dd7('0x3a')],qs['fields'](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0xb8a83e[_0x2dd7('0x3f')]=_0xb8a83e[_0x2dd7('0x3f')]['length']?_0xb8a83e[_0x2dd7('0x3f')]:_0x5e2814[_0x2dd7('0x3a')];_0xb8a83e[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0xb8a83e[_0x2dd7('0x44')]=qs['filters'](_[_0x2dd7('0x45')](_0x53d505[_0x2dd7('0x3b')],_0x5e2814['filters']));if(_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0xb8a83e[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0xb8a83e[_0x2dd7('0x44')],{'$or':_['map'](_0xb8a83e[_0x2dd7('0x3f')],function(_0x5893bc){var _0x3a3305={};_0x3a3305[_0x5893bc]={'$like':'%'+_0x53d505['query'][_0x2dd7('0x2b')]+'%'};return _0x3a3305;})});}_0xb8a83e=_[_0x2dd7('0x4d')]({},_0xb8a83e,_0x53d505[_0x2dd7('0x4e')]);return _0x261462['getAgents'](_0xb8a83e);}})['then'](function(_0x5b5859){if(_0x5b5859){_0x8580be=_0x5b5859[_0x2dd7('0x41')];if(!_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0xb8a83e[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x53d505[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0xb8a83e[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x53d505['query'][_0x2dd7('0x1e')]);}return _0x261462[_0x2dd7('0x99')](_0xb8a83e);}})[_0x2dd7('0x25')](function(_0x502fdd){if(_0x502fdd){return _0x502fdd?{'count':_0x8580be,'rows':_0x502fdd}:null;}})[_0x2dd7('0x25')](respondWithResult(_0x19ef6c,null))[_0x2dd7('0x4a')](handleError(_0x19ef6c,null));};exports[_0x2dd7('0x9a')]=function(_0x104c9a,_0x20cbe8,_0xb8f919){var _0x270088={};var _0x9d3456={};var _0x30d55b;var _0x1250d3;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x104c9a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x20cbe8,null))[_0x2dd7('0x25')](function(_0x568e5c){if(_0x568e5c){_0x30d55b=_0x568e5c;_0x9d3456[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x91')][_0x2dd7('0x37')]);_0x9d3456[_0x2dd7('0x3b')]=_['keys'](_0x104c9a['query']);_0x9d3456[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x9d3456['model'],_0x9d3456[_0x2dd7('0x3b')]);_0x270088[_0x2dd7('0x3f')]=_[_0x2dd7('0x3e')](_0x9d3456['model'],qs[_0x2dd7('0x40')](_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x270088[_0x2dd7('0x3f')]=_0x270088['attributes'][_0x2dd7('0x41')]?_0x270088[_0x2dd7('0x3f')]:_0x9d3456[_0x2dd7('0x3a')];_0x270088['order']=qs['sort'](_0x104c9a[_0x2dd7('0x3b')]['sort']);_0x270088[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_[_0x2dd7('0x45')](_0x104c9a['query'],_0x9d3456[_0x2dd7('0x3d')]));if(_0x104c9a['query'][_0x2dd7('0x2b')]){_0x270088['where']=_[_0x2dd7('0x4d')](_0x270088['where'],{'$or':_[_0x2dd7('0x2d')](_0x270088['attributes'],function(_0x3c4a71){var _0x5d342b={};_0x5d342b[_0x3c4a71]={'$like':'%'+_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x2b')]+'%'};return _0x5d342b;})});}_0x270088=_[_0x2dd7('0x4d')]({},_0x270088,_0x104c9a[_0x2dd7('0x4e')]);return _0x30d55b['getMembers'](_0x270088);}})[_0x2dd7('0x25')](function(_0x56ff17){if(_0x56ff17){_0x1250d3=_0x56ff17[_0x2dd7('0x41')];if(!_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x270088[_0x2dd7('0x1f')]=qs[_0x2dd7('0x1f')](_0x104c9a[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x270088[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x104c9a[_0x2dd7('0x3b')]['offset']);}return _0x30d55b[_0x2dd7('0x9a')](_0x270088);}})[_0x2dd7('0x25')](function(_0x20ed6e){return _0x20ed6e?{'count':_0x1250d3,'rows':_0x20ed6e}:null;})[_0x2dd7('0x25')](respondWithResult(_0x20cbe8,null))[_0x2dd7('0x4a')](handleError(_0x20cbe8,null));};exports[_0x2dd7('0x9b')]=function(_0x1e2db2,_0x28e635,_0x291a09){var _0x3e4e1f={};var _0x30343d={};var _0x23ff18;var _0x4ea1ce;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x1e2db2[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x28e635,null))[_0x2dd7('0x25')](function(_0x2b410b){if(_0x2b410b){_0x23ff18=_0x2b410b;_0x30343d[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db[_0x2dd7('0x9c')][_0x2dd7('0x37')]);_0x30343d[_0x2dd7('0x3b')]=_[_0x2dd7('0x3c')](_0x1e2db2[_0x2dd7('0x3b')]);_0x30343d[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0x30343d[_0x2dd7('0x3a')],_0x30343d[_0x2dd7('0x3b')]);_0x3e4e1f[_0x2dd7('0x3f')]=_['intersection'](_0x30343d[_0x2dd7('0x3a')],qs[_0x2dd7('0x40')](_0x1e2db2['query'][_0x2dd7('0x40')]));_0x3e4e1f[_0x2dd7('0x3f')]=_0x3e4e1f[_0x2dd7('0x3f')][_0x2dd7('0x41')]?_0x3e4e1f['attributes']:_0x30343d[_0x2dd7('0x3a')];_0x3e4e1f[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x43')]);_0x3e4e1f[_0x2dd7('0x44')]=qs[_0x2dd7('0x3d')](_['pick'](_0x1e2db2[_0x2dd7('0x3b')],_0x30343d[_0x2dd7('0x3d')]));if(_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x3e4e1f[_0x2dd7('0x44')]=_['merge'](_0x3e4e1f['where'],{'$or':_['map'](_0x3e4e1f[_0x2dd7('0x3f')],function(_0x5ad03e){var _0x30100f={};_0x30100f[_0x5ad03e]={'$like':'%'+_0x1e2db2[_0x2dd7('0x3b')]['filter']+'%'};return _0x30100f;})});}_0x3e4e1f=_[_0x2dd7('0x4d')]({},_0x3e4e1f,_0x1e2db2[_0x2dd7('0x4e')]);return _0x23ff18[_0x2dd7('0x9b')](_0x3e4e1f);}})[_0x2dd7('0x25')](function(_0x50e991){if(_0x50e991){_0x4ea1ce=_0x50e991[_0x2dd7('0x41')];if(!_0x1e2db2['query'][_0x2dd7('0x66')](_0x2dd7('0x42'))){_0x3e4e1f[_0x2dd7('0x1f')]=qs['limit'](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x1f')]);_0x3e4e1f['offset']=qs[_0x2dd7('0x1e')](_0x1e2db2[_0x2dd7('0x3b')][_0x2dd7('0x1e')]);}return _0x23ff18[_0x2dd7('0x9b')](_0x3e4e1f);}})[_0x2dd7('0x25')](function(_0x235114){if(_0x235114){return _0x235114?{'count':_0x4ea1ce,'rows':_0x235114}:null;}})['then'](respondWithResult(_0x28e635,null))[_0x2dd7('0x4a')](handleError(_0x28e635,null));};exports[_0x2dd7('0x9d')]=function(_0x22ccc8,_0x10ff12,_0x550002){var _0x353fa9,_0x221229;return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x22ccc8[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x10ff12,null))['then'](function(_0x4731dd){if(_0x4731dd){_0x221229=_0x4731dd;return _0x4731dd[_0x2dd7('0x9d')](_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x22ccc8[_0x2dd7('0x50')],['ids','id'])||{});}return null;})[_0x2dd7('0x96')](function(_0x37f5ea){var _0x466220;_0x353fa9=_0x37f5ea||[];var _0x281982=[];if(_0x37f5ea){for(var _0xbf7615=0x0;_0xbf7615<_0x37f5ea[_0x2dd7('0x41')];_0xbf7615+=0x1){var _0x35c39a=_0x37f5ea[_0xbf7615][_0x2dd7('0x27')]({'plain':!![]});_0x221229[_0x2dd7('0x9e')]=_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x9e')]?_0x22ccc8[_0x2dd7('0x50')][_0x2dd7('0x9e')]:_0x221229[_0x2dd7('0x9e')];switch(_0x221229[_0x2dd7('0x9e')]){case _0x2dd7('0x9f'):_0x466220=squel[_0x2dd7('0xa0')]()[_0x2dd7('0xa1')](_0x2dd7('0xa2'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),_0x2dd7('0xa6'),_0x2dd7('0x61'),'createdAt','updatedAt'],squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')]('phone',_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))['field'](_0x35c39a['CmListId'][_0x2dd7('0x89')](),_0x2dd7('0xa6'))[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),'createdAt')['field'](_0x2dd7('0xa9'),'updatedAt')[_0x2dd7('0x81')](_0x2dd7('0xaa'))[_0x2dd7('0x44')](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a['CmListId']['toString']())['where'](_0x2dd7('0xad'))[_0x2dd7('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')]('COALESCE(calleridnum,\x27\x27)')[_0x2dd7('0x81')](_0x2dd7('0xae'))[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]()))[_0x2dd7('0x44')](_0x2dd7('0xaf'),squel[_0x2dd7('0xa7')]()[_0x2dd7('0x7f')](_0x2dd7('0xb0'))['from']('cm_hopper')[_0x2dd7('0x44')](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]())))[_0x2dd7('0x89')]();break;case _0x2dd7('0xb1'):_0x466220=squel['insert']()[_0x2dd7('0xa1')](_0x2dd7('0xa2'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),'ListId','VoiceQueueId',_0x2dd7('0x5b'),_0x2dd7('0xb2')],squel[_0x2dd7('0xa7')]()['field'](_0x2dd7('0xa8'),_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))[_0x2dd7('0x7f')](_0x35c39a[_0x2dd7('0xb3')]['toString'](),'ListId')[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0x5b'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xb2'))[_0x2dd7('0x81')](_0x2dd7('0xaa'))['where'](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a['CmListId']['toString']())[_0x2dd7('0x44')](_0x2dd7('0xad'))[_0x2dd7('0x44')](_0x2dd7('0xaf'),squel['select']()[_0x2dd7('0x7f')](_0x2dd7('0xb0'))[_0x2dd7('0x81')](_0x2dd7('0xa2'))['where'](_0x2dd7('0x86'),_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')]())))['toString']();break;default:_0x466220=squel[_0x2dd7('0xa0')]()[_0x2dd7('0xa1')]('cm_hopper')[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa4'),_0x2dd7('0xa5'),_0x2dd7('0xa6'),_0x2dd7('0x61'),_0x2dd7('0x5b'),_0x2dd7('0xb2')],squel[_0x2dd7('0xa7')]()['field']('phone',_0x2dd7('0xa8'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0xa4'))[_0x2dd7('0x7f')]('id',_0x2dd7('0xa5'))[_0x2dd7('0x7f')](_0x35c39a[_0x2dd7('0xb3')][_0x2dd7('0x89')](),_0x2dd7('0xa6'))[_0x2dd7('0x7f')](_0x22ccc8[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),_0x2dd7('0x61'))[_0x2dd7('0x7f')](_0x2dd7('0xa9'),_0x2dd7('0x5b'))['field']('NOW()',_0x2dd7('0xb2'))['from'](_0x2dd7('0xaa'))[_0x2dd7('0x44')]('deletedAt\x20IS\x20NULL')[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x35c39a[_0x2dd7('0xb3')]['toString']())['where'](_0x2dd7('0xad')))[_0x2dd7('0x89')]();}_0x281982[_0x2dd7('0x88')](db[_0x2dd7('0x71')][_0x2dd7('0x3b')](_0x466220));}return BPromise[_0x2dd7('0x8d')](_0x281982);}})[_0x2dd7('0x25')](function(){return _0x353fa9;})[_0x2dd7('0x25')](respondWithResult(_0x10ff12,null))['catch'](handleError(_0x10ff12,null));};exports[_0x2dd7('0xb4')]=function(_0x103595,_0x21d662,_0x3c04a1){return db['VoiceQueue'][_0x2dd7('0x55')]({'where':{'id':_0x103595[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x21d662,null))[_0x2dd7('0x25')](function(_0x3fd027){if(_0x3fd027){return _0x3fd027[_0x2dd7('0xb4')](_0x103595[_0x2dd7('0x3b')]['ids']);}})['then'](function(_0x263faa){if(_0x263faa){return db[_0x2dd7('0x5f')][_0x2dd7('0x26')]({'where':{'ListId':_0x103595['query'][_0x2dd7('0x95')],'VoiceQueueId':_0x103595[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(){return _0x263faa;});}})[_0x2dd7('0x25')](respondWithStatusCode(_0x21d662,null))['catch'](handleError(_0x21d662,null));};exports[_0x2dd7('0xb5')]=function(_0x31a10c,_0xe45e38,_0x791dcf){var _0x5b091a={};var _0xae6ec={};var _0xe91c5e;var _0x24e6b3;return db[_0x2dd7('0x36')][_0x2dd7('0x64')]({'where':{'id':_0x31a10c[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0xe45e38,null))[_0x2dd7('0x25')](function(_0x25832b){if(_0x25832b){_0xe91c5e=_0x25832b;_0xae6ec[_0x2dd7('0x3a')]=_[_0x2dd7('0x3c')](db['CmList'][_0x2dd7('0x37')]);_0xae6ec['query']=_[_0x2dd7('0x3c')](_0x31a10c[_0x2dd7('0x3b')]);_0xae6ec[_0x2dd7('0x3d')]=_[_0x2dd7('0x3e')](_0xae6ec[_0x2dd7('0x3a')],_0xae6ec[_0x2dd7('0x3b')]);_0x5b091a[_0x2dd7('0x3f')]=_['intersection'](_0xae6ec[_0x2dd7('0x3a')],qs['fields'](_0x31a10c[_0x2dd7('0x3b')][_0x2dd7('0x40')]));_0x5b091a['attributes']=_0x5b091a[_0x2dd7('0x3f')]['length']?_0x5b091a['attributes']:_0xae6ec[_0x2dd7('0x3a')];_0x5b091a[_0x2dd7('0x60')]=qs[_0x2dd7('0x43')](_0x31a10c['query']['sort']);_0x5b091a['where']=qs[_0x2dd7('0x3d')](_['pick'](_0x31a10c[_0x2dd7('0x3b')],_0xae6ec[_0x2dd7('0x3d')]));if(_0x31a10c[_0x2dd7('0x3b')][_0x2dd7('0x2b')]){_0x5b091a[_0x2dd7('0x44')]=_[_0x2dd7('0x4d')](_0x5b091a[_0x2dd7('0x44')],{'$or':_[_0x2dd7('0x2d')](_0x5b091a[_0x2dd7('0x3f')],function(_0x3e49de){var _0x2cc13f={};_0x2cc13f[_0x3e49de]={'$like':'%'+_0x31a10c['query'][_0x2dd7('0x2b')]+'%'};return _0x2cc13f;})});}_0x5b091a=_['merge']({},_0x5b091a,_0x31a10c[_0x2dd7('0x4e')]);return _0xe91c5e['getBlackLists'](_0x5b091a);}})['then'](function(_0x55e95f){if(_0x55e95f){_0x24e6b3=_0x55e95f['length'];if(!_0x31a10c['query']['hasOwnProperty'](_0x2dd7('0x42'))){_0x5b091a[_0x2dd7('0x1f')]=qs['limit'](_0x31a10c[_0x2dd7('0x3b')]['limit']);_0x5b091a[_0x2dd7('0x1e')]=qs[_0x2dd7('0x1e')](_0x31a10c[_0x2dd7('0x3b')]['offset']);}return _0xe91c5e[_0x2dd7('0xb5')](_0x5b091a);}})['then'](function(_0x24cb7e){if(_0x24cb7e){return _0x24cb7e?{'count':_0x24e6b3,'rows':_0x24cb7e}:null;}})[_0x2dd7('0x25')](respondWithResult(_0xe45e38,null))['catch'](handleError(_0xe45e38,null));};exports[_0x2dd7('0xb6')]=function(_0x327bee,_0x1873be,_0x18d696){var _0x1fad39,_0xc2360d;return db[_0x2dd7('0x36')]['find']({'where':{'id':_0x327bee['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x1873be,null))[_0x2dd7('0x25')](function(_0x38e3b0){if(_0x38e3b0){_0xc2360d=_0x38e3b0;return _0x38e3b0[_0x2dd7('0xb6')](_0x327bee[_0x2dd7('0x50')][_0x2dd7('0x95')],_[_0x2dd7('0x5c')](_0x327bee[_0x2dd7('0x50')],[_0x2dd7('0x95'),'id'])||{});}return null;})['spread'](function(_0x32e023){var _0x47289e;_0x1fad39=_0x32e023||[];var _0x5bb00a=[];if(_0x32e023){for(var _0x1a2e10=0x0;_0x1a2e10<_0x32e023[_0x2dd7('0x41')];_0x1a2e10+=0x1){var _0x48d00d=_0x32e023[_0x1a2e10][_0x2dd7('0x27')]({'plain':!![]});_0x47289e=squel['insert']()['into'](_0x2dd7('0xb7'))[_0x2dd7('0xa3')](['phone',_0x2dd7('0xa5'),_0x2dd7('0xa6'),'VoiceQueueId',_0x2dd7('0x5b'),'updatedAt'],squel[_0x2dd7('0xa7')]()['field'](_0x2dd7('0xa8'),_0x2dd7('0xa8'))[_0x2dd7('0x7f')]('id','ContactId')[_0x2dd7('0x7f')](_0x48d00d['CmListId'][_0x2dd7('0x89')](),_0x2dd7('0xa6'))['field'](_0x327bee[_0x2dd7('0x5a')]['id'][_0x2dd7('0x89')](),'VoiceQueueId')[_0x2dd7('0x7f')]('NOW()','createdAt')['field'](_0x2dd7('0xa9'),'updatedAt')[_0x2dd7('0x81')](_0x2dd7('0xaa'))['where'](_0x2dd7('0xab'))[_0x2dd7('0x44')](_0x2dd7('0xac'),_0x48d00d['CmListId'][_0x2dd7('0x89')]())[_0x2dd7('0x44')](_0x2dd7('0xad')))[_0x2dd7('0x89')]();_0x5bb00a[_0x2dd7('0x88')](db[_0x2dd7('0x71')][_0x2dd7('0x3b')](_0x47289e));}return BPromise[_0x2dd7('0x8d')](_0x5bb00a);}})['then'](function(){return _0x1fad39;})[_0x2dd7('0x25')](respondWithResult(_0x1873be,null))['catch'](handleError(_0x1873be,null));};exports[_0x2dd7('0xb8')]=function(_0x38de8a,_0x33314f,_0xf81657){return db[_0x2dd7('0x36')][_0x2dd7('0x55')]({'where':{'id':_0x38de8a['params']['id']}})[_0x2dd7('0x25')](handleEntityNotFound(_0x33314f,null))['then'](function(_0x2c5d8d){if(_0x2c5d8d){return _0x2c5d8d[_0x2dd7('0xb8')](_0x38de8a[_0x2dd7('0x3b')][_0x2dd7('0x95')]);}})['then'](function(_0x2e79de){if(_0x2e79de){return db[_0x2dd7('0x6a')]['destroy']({'where':{'ListId':_0x38de8a['query'][_0x2dd7('0x95')],'VoiceQueueId':_0x38de8a[_0x2dd7('0x5a')]['id']}})[_0x2dd7('0x25')](function(){return _0x2e79de;});}})['then'](respondWithStatusCode(_0x33314f,null))[_0x2dd7('0x4a')](handleError(_0x33314f,null));}; \ No newline at end of file +var _0x5c69=['socket.io-emitter','redis','./voiceQueue.socket','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','value','includes','type','find','name','status','error','send','index','VoiceQueue','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','includeAll','include','findAll','catch','params','keys','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','QueueCampaigns','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','userProfileId','autoAssociation','UserProfileResource','getHoppers','findOne','CmHopper','hasOwnProperty','pick','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','sequelize','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','penalty','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeAgents','addAgents','isEmpty','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','removeLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','localhost'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5c69,0xa0));var _0x95c6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5c69[_0x4b2436];return _0x4f5ab2;};'use strict';var pdf=require(_0x95c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x95c6('0x1'));var zipdir=require(_0x95c6('0x2'));var jsonpatch=require(_0x95c6('0x3'));var rp=require(_0x95c6('0x4'));var moment=require(_0x95c6('0x5'));var BPromise=require(_0x95c6('0x6'));var Mustache=require(_0x95c6('0x7'));var util=require(_0x95c6('0x8'));var path=require(_0x95c6('0x9'));var sox=require('sox');var csv=require(_0x95c6('0xa'));var ejs=require(_0x95c6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x95c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x95c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x95c6('0xa'));var querystring=require(_0x95c6('0xe'));var Papa=require(_0x95c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95c6('0x10'));var as=require(_0x95c6('0x11'));var hardwareService=require(_0x95c6('0x12'));var logger=require(_0x95c6('0x13'))(_0x95c6('0x14'));var utils=require('../../config/utils');var config=require(_0x95c6('0x15'));var db=require(_0x95c6('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x95c6('0x17'),'port':0x18eb});var socket=require(_0x95c6('0x18'))(new Redis(config[_0x95c6('0x19')]));require(_0x95c6('0x1a'))['register'](socket);function respondWithStatusCode(_0x2fdff4,_0x326ce7){_0x326ce7=_0x326ce7||0xcc;return function(_0x482619){if(_0x482619){return _0x2fdff4[_0x95c6('0x1b')](_0x326ce7);}return _0x2fdff4['status'](_0x326ce7)[_0x95c6('0x1c')]();};}function respondWithResult(_0x1fe0f3,_0x555895){_0x555895=_0x555895||0xc8;return function(_0x287c25){if(_0x287c25){return _0x1fe0f3['status'](_0x555895)[_0x95c6('0x1d')](_0x287c25);}};}function respondWithFilteredResult(_0x2a6e6e,_0x992a70){return function(_0x1afa98){if(_0x1afa98){var _0x2e0a21=_0x1afa98[_0x95c6('0x1e')],_0x4f92ea=_0x992a70[_0x95c6('0x1f')],_0x3f4388=_0x992a70[_0x95c6('0x1f')]+_0x992a70[_0x95c6('0x20')],_0x440bdd;if(_0x3f4388>=_0x2e0a21){_0x3f4388=_0x2e0a21;_0x440bdd=0xc8;}else{_0x440bdd=0xce;}_0x2a6e6e['status'](_0x440bdd);return _0x2a6e6e['set'](_0x95c6('0x21'),_0x4f92ea+'-'+_0x3f4388+'/'+_0x2e0a21)[_0x95c6('0x1d')](_0x1afa98);}return null;};}function patchUpdates(_0xf7106){return function(_0x5f189d){try{jsonpatch[_0x95c6('0x22')](_0x5f189d,_0xf7106,!![]);}catch(_0x20823b){return BPromise[_0x95c6('0x23')](_0x20823b);}return _0x5f189d[_0x95c6('0x24')]();};}function saveUpdates(_0x1ad3d3,_0x25ada2){return function(_0x45fbd1){if(_0x45fbd1){return _0x45fbd1[_0x95c6('0x25')](_0x1ad3d3)[_0x95c6('0x26')](function(_0x5ed4d2){return _0x5ed4d2;});}return null;};}function removeEntity(_0x876e43,_0xcbccf1){return function(_0x3c8102){if(_0x3c8102){return _0x3c8102[_0x95c6('0x27')]()[_0x95c6('0x26')](function(){var _0x3e4c11=_0x3c8102[_0x95c6('0x28')]({'plain':!![]});var _0x3a8d59=[{'name':_0x95c6('0x29'),'value':_0x95c6('0x2a'),'ignore':![]},{'name':'QueueCampaigns','value':_0x95c6('0x2b'),'ignore':![]}];var _0x4fa4e9=_(_0x3a8d59)['filter'](_0x95c6('0x2c'))['map'](_0x95c6('0x2d'))[_0x95c6('0x2d')]();if(_[_0x95c6('0x2e')](_0x4fa4e9,_0x3e4c11[_0x95c6('0x2f')])){return;}var _0x4e44e1=_[_0x95c6('0x30')](_0x3a8d59,[_0x95c6('0x2d'),_0x3e4c11[_0x95c6('0x2f')]])[_0x95c6('0x31')];return db['UserProfileResource'][_0x95c6('0x27')]({'where':{'type':_0x4e44e1,'resourceId':_0x3e4c11['id']}})['then'](function(){return _0x3c8102;});})[_0x95c6('0x26')](function(){_0x876e43[_0x95c6('0x32')](0xcc)[_0x95c6('0x1c')]();});}};}function handleEntityNotFound(_0x4845da,_0x39d22d){return function(_0x4a0a83){if(!_0x4a0a83){_0x4845da[_0x95c6('0x1b')](0x194);}return _0x4a0a83;};}function handleError(_0xe33275,_0x453d69){_0x453d69=_0x453d69||0x1f4;return function(_0x144fac){logger[_0x95c6('0x33')](_0x144fac['stack']);if(_0x144fac[_0x95c6('0x31')]){delete _0x144fac[_0x95c6('0x31')];}_0xe33275[_0x95c6('0x32')](_0x453d69)[_0x95c6('0x34')](_0x144fac);};}exports[_0x95c6('0x35')]=function(_0xb84e5a,_0x5e4230){var _0x3dac0a={},_0x2ed8f1={},_0x1f3669={'count':0x0,'rows':[]};var _0x223add=_['map'](db[_0x95c6('0x36')][_0x95c6('0x37')],function(_0x1a6763){return{'name':_0x1a6763[_0x95c6('0x38')],'type':_0x1a6763[_0x95c6('0x2f')][_0x95c6('0x39')]};});_0x2ed8f1['model']=_[_0x95c6('0x3a')](_0x223add,_0x95c6('0x31'));_0x2ed8f1['query']=_['keys'](_0xb84e5a[_0x95c6('0x3b')]);_0x2ed8f1[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x2ed8f1[_0x95c6('0x3e')],_0x2ed8f1['query']);_0x3dac0a[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x2ed8f1['model'],qs[_0x95c6('0x40')](_0xb84e5a[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x3dac0a[_0x95c6('0x3f')]=_0x3dac0a['attributes'][_0x95c6('0x41')]?_0x3dac0a[_0x95c6('0x3f')]:_0x2ed8f1[_0x95c6('0x3e')];if(!_0xb84e5a[_0x95c6('0x3b')]['hasOwnProperty'](_0x95c6('0x42'))){_0x3dac0a[_0x95c6('0x20')]=qs[_0x95c6('0x20')](_0xb84e5a[_0x95c6('0x3b')]['limit']);_0x3dac0a['offset']=qs[_0x95c6('0x1f')](_0xb84e5a['query'][_0x95c6('0x1f')]);}_0x3dac0a[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0xb84e5a[_0x95c6('0x3b')]['sort']);_0x3dac0a['where']=qs[_0x95c6('0x3c')](_['pick'](_0xb84e5a[_0x95c6('0x3b')],_0x2ed8f1[_0x95c6('0x3c')]),_0x223add);if(_0xb84e5a[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x3dac0a[_0x95c6('0x46')]=_['merge'](_0x3dac0a['where'],{'$or':_['map'](_0x223add,function(_0x199f8a){if(_0x199f8a[_0x95c6('0x2f')]!==_0x95c6('0x47')){var _0x352c77={};_0x352c77[_0x199f8a[_0x95c6('0x31')]]={'$like':'%'+_0xb84e5a[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0x352c77;}})});}_0x3dac0a=_['merge']({},_0x3dac0a,_0xb84e5a['options']);var _0x306dc1={'where':_0x3dac0a['where']};return db[_0x95c6('0x36')][_0x95c6('0x1e')](_0x306dc1)['then'](function(_0x3fd38b){_0x1f3669['count']=_0x3fd38b;if(_0xb84e5a[_0x95c6('0x3b')][_0x95c6('0x48')]){_0x3dac0a[_0x95c6('0x49')]=[{'all':!![]}];}return db[_0x95c6('0x36')][_0x95c6('0x4a')](_0x3dac0a);})['then'](function(_0x109f2f){_0x1f3669['rows']=_0x109f2f;return _0x1f3669;})[_0x95c6('0x26')](respondWithFilteredResult(_0x5e4230,_0x3dac0a))[_0x95c6('0x4b')](handleError(_0x5e4230,null));};exports['show']=function(_0x24a779,_0x8d1176){var _0x47a4cc={'raw':![],'where':{'id':_0x24a779[_0x95c6('0x4c')]['id']}},_0x3b51a8={};_0x3b51a8['model']=_[_0x95c6('0x4d')](db['VoiceQueue'][_0x95c6('0x37')]);_0x3b51a8[_0x95c6('0x3b')]=_['keys'](_0x24a779['query']);_0x3b51a8[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x3b51a8[_0x95c6('0x3e')],_0x3b51a8['query']);_0x47a4cc['attributes']=_[_0x95c6('0x3d')](_0x3b51a8['model'],qs[_0x95c6('0x40')](_0x24a779[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x47a4cc[_0x95c6('0x3f')]=_0x47a4cc[_0x95c6('0x3f')]['length']?_0x47a4cc[_0x95c6('0x3f')]:_0x3b51a8[_0x95c6('0x3e')];if(_0x24a779[_0x95c6('0x3b')][_0x95c6('0x48')]){_0x47a4cc['include']=[{'all':!![]}];}_0x47a4cc=_[_0x95c6('0x4e')]({},_0x47a4cc,_0x24a779[_0x95c6('0x4f')]);return db[_0x95c6('0x36')]['find'](_0x47a4cc)[_0x95c6('0x26')](handleEntityNotFound(_0x8d1176,null))['then'](respondWithResult(_0x8d1176,null))[_0x95c6('0x4b')](handleError(_0x8d1176,null));};exports['create']=function(_0x1172a3,_0xc794b1){return db['VoiceQueue'][_0x95c6('0x50')](_0x1172a3[_0x95c6('0x51')],{})[_0x95c6('0x26')](function(_0x2fca19){var _0x431e99=_0x1172a3['user'][_0x95c6('0x28')]({'plain':!![]});if(!_0x431e99)throw new Error(_0x95c6('0x52'));if(_0x431e99['role']===_0x95c6('0x53')){var _0x1955d2=_0x2fca19['get']({'plain':!![]});var _0x3490d9=[{'name':_0x95c6('0x29'),'value':_0x95c6('0x2a')},{'name':_0x95c6('0x54'),'value':_0x95c6('0x2b')}];var _0x267c3b=_[_0x95c6('0x30')](_0x3490d9,['value',_0x1955d2['type']])['name'];return db[_0x95c6('0x55')][_0x95c6('0x30')]({'where':{'name':_0x267c3b,'userProfileId':_0x431e99['userProfileId']},'raw':!![]})[_0x95c6('0x26')](function(_0x379e97){if(_0x379e97&&_0x379e97['autoAssociation']===0x0){return db['UserProfileResource'][_0x95c6('0x50')]({'name':_0x1955d2['name'],'resourceId':_0x1955d2['id'],'type':_0x379e97[_0x95c6('0x31')],'sectionId':_0x379e97['id']},{})[_0x95c6('0x26')](function(){return _0x2fca19;});}else{return _0x2fca19;}})[_0x95c6('0x4b')](function(_0x4f7e8c){logger[_0x95c6('0x33')](_0x95c6('0x56'),_0x4f7e8c);throw _0x4f7e8c;});}return _0x2fca19;})[_0x95c6('0x26')](respondWithResult(_0xc794b1,0xc9))['catch'](handleError(_0xc794b1,null));};exports[_0x95c6('0x57')]=function(_0x5bc083,_0x454032){var _0x28b1cc={'where':{'id':_0x5bc083['params']['id']}},_0x2da485={};_0x2da485[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db[_0x95c6('0x36')][_0x95c6('0x37')]);_0x28b1cc[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x2da485[_0x95c6('0x3e')],qs['fields'](_0x5bc083['query'][_0x95c6('0x40')]));_0x28b1cc[_0x95c6('0x3f')]=_0x28b1cc[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x28b1cc['attributes']:_0x2da485[_0x95c6('0x3e')];if(_0x5bc083['query'][_0x95c6('0x48')]){_0x28b1cc[_0x95c6('0x49')]=[{'all':!![]}];}_0x28b1cc=_[_0x95c6('0x4e')]({},_0x28b1cc,_0x5bc083[_0x95c6('0x4f')]);return db[_0x95c6('0x36')][_0x95c6('0x30')](_0x28b1cc)[_0x95c6('0x26')](handleEntityNotFound(_0x454032,null))['then'](function(_0x54eb4d){if(_0x54eb4d){var _0x1b0bf7=_0x54eb4d[_0x95c6('0x28')]({'plain':!![]});_0x1b0bf7=qs['omit'](_0x1b0bf7,['id',_0x95c6('0x58'),_0x95c6('0x59')]);_0x5bc083[_0x95c6('0x51')]=_[_0x95c6('0x5a')](_0x5bc083['body'],['id','createdAt',_0x95c6('0x59')]);return db[_0x95c6('0x36')][_0x95c6('0x50')](_[_0x95c6('0x4e')](_0x1b0bf7,_0x5bc083[_0x95c6('0x51')]),{'include':_0x5bc083['query'][_0x95c6('0x48')]?[{'all':!![]}]:undefined})[_0x95c6('0x26')](function(_0x4684c2){var _0xe3f6e2=_0x5bc083[_0x95c6('0x53')][_0x95c6('0x28')]({'plain':!![]});if(!_0xe3f6e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe3f6e2[_0x95c6('0x5b')]===_0x95c6('0x53')){var _0x4cfd2b=_0x4684c2[_0x95c6('0x28')]({'plain':!![]});var _0x588238=[{'name':_0x95c6('0x29'),'value':_0x95c6('0x2a')},{'name':_0x95c6('0x54'),'value':'outbound'}];var _0x5513de=_['find'](_0x588238,['value',_0x4cfd2b[_0x95c6('0x2f')]])['name'];return db[_0x95c6('0x55')][_0x95c6('0x30')]({'where':{'name':_0x5513de,'userProfileId':_0xe3f6e2[_0x95c6('0x5c')]},'raw':!![]})[_0x95c6('0x26')](function(_0x266d59){if(_0x266d59&&_0x266d59[_0x95c6('0x5d')]===0x0){return db[_0x95c6('0x5e')][_0x95c6('0x50')]({'name':_0x4cfd2b['name'],'resourceId':_0x4cfd2b['id'],'type':_0x266d59[_0x95c6('0x31')],'sectionId':_0x266d59['id']},{})[_0x95c6('0x26')](function(){return _0x4684c2;});}else{return _0x4684c2;}})[_0x95c6('0x4b')](function(_0x43aa86){logger[_0x95c6('0x33')](_0x95c6('0x56'),_0x43aa86);throw _0x43aa86;});}return _0x4684c2;});}})['then'](respondWithResult(_0x454032,0xc9))[_0x95c6('0x4b')](handleError(_0x454032,null));};exports[_0x95c6('0x25')]=function(_0x67d8b3,_0x463895){if(_0x67d8b3['body']['id']){delete _0x67d8b3[_0x95c6('0x51')]['id'];}return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x67d8b3[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x463895,null))[_0x95c6('0x26')](saveUpdates(_0x67d8b3['body'],null))['then'](respondWithResult(_0x463895,null))[_0x95c6('0x4b')](handleError(_0x463895,null));};exports[_0x95c6('0x27')]=function(_0x4d88c4,_0x299501){return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x4d88c4['params']['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x299501,null))[_0x95c6('0x26')](removeEntity(_0x299501,null))[_0x95c6('0x4b')](handleError(_0x299501,null));};exports[_0x95c6('0x5f')]=function(_0x2d0ee1,_0x51a0c8,_0xdd46ae){var _0x1b8273={'raw':![],'where':{}};var _0x43bda0={};var _0x2325b1={'count':0x0,'rows':[]};return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x2d0ee1[_0x95c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51a0c8,null))[_0x95c6('0x26')](function(_0x566e55){if(_0x566e55){_0x43bda0[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db[_0x95c6('0x61')][_0x95c6('0x37')]);_0x43bda0['query']=_[_0x95c6('0x4d')](_0x2d0ee1[_0x95c6('0x3b')]);_0x43bda0[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x43bda0[_0x95c6('0x3e')],_0x43bda0[_0x95c6('0x3b')]);_0x1b8273[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x43bda0[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x2d0ee1[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x1b8273['attributes']=_0x1b8273['attributes'][_0x95c6('0x41')]?_0x1b8273[_0x95c6('0x3f')]:_0x43bda0[_0x95c6('0x3e')];if(!_0x2d0ee1[_0x95c6('0x3b')][_0x95c6('0x62')](_0x95c6('0x42'))){_0x1b8273[_0x95c6('0x20')]=qs[_0x95c6('0x20')](_0x2d0ee1['query'][_0x95c6('0x20')]);_0x1b8273['offset']=qs[_0x95c6('0x1f')](_0x2d0ee1['query'][_0x95c6('0x1f')]);}_0x1b8273[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x2d0ee1[_0x95c6('0x3b')]['sort']);_0x1b8273[_0x95c6('0x46')]=qs[_0x95c6('0x3c')](_[_0x95c6('0x63')](_0x2d0ee1[_0x95c6('0x3b')],_0x43bda0['filters']));_0x1b8273['where'][_0x95c6('0x64')]=_0x566e55['id'];if(_0x2d0ee1[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x1b8273[_0x95c6('0x46')]=_['merge'](_0x1b8273[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x1b8273['attributes'],function(_0x35a306){var _0x397934={};_0x397934[_0x35a306]={'$like':'%'+_0x2d0ee1[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0x397934;})});}_0x1b8273=_[_0x95c6('0x4e')]({},_0x1b8273,_0x2d0ee1[_0x95c6('0x4f')]);return db['CmHopper'][_0x95c6('0x1e')]({'where':_0x1b8273[_0x95c6('0x46')]})[_0x95c6('0x26')](function(_0x47556b){_0x2325b1['count']=_0x47556b;if(_0x2d0ee1['query'][_0x95c6('0x48')]){_0x1b8273[_0x95c6('0x49')]=[{'all':!![]}];}return db[_0x95c6('0x61')][_0x95c6('0x4a')](_0x1b8273);})[_0x95c6('0x26')](function(_0x452cf7){_0x2325b1[_0x95c6('0x65')]=_0x452cf7;return _0x2325b1;});}})[_0x95c6('0x26')](respondWithFilteredResult(_0x51a0c8,_0x1b8273))[_0x95c6('0x4b')](handleError(_0x51a0c8,null));};exports[_0x95c6('0x66')]=function(_0x2578c5,_0x1a4e74,_0x5ea90e){var _0x521669={'raw':!![],'where':{}};var _0x20bbb1={};var _0x4b5dd8={'count':0x0,'rows':[]};return db[_0x95c6('0x36')]['findOne']({'where':{'id':_0x2578c5['params']['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x1a4e74,null))[_0x95c6('0x26')](function(_0x210e4e){if(_0x210e4e){_0x20bbb1[_0x95c6('0x3e')]=_['keys'](db[_0x95c6('0x67')][_0x95c6('0x37')]);_0x20bbb1[_0x95c6('0x3b')]=_[_0x95c6('0x4d')](_0x2578c5[_0x95c6('0x3b')]);_0x20bbb1[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x20bbb1[_0x95c6('0x3e')],_0x20bbb1['query']);_0x521669[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x20bbb1[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x521669[_0x95c6('0x3f')]=_0x521669[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x521669[_0x95c6('0x3f')]:_0x20bbb1[_0x95c6('0x3e')];if(!_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x62')](_0x95c6('0x42'))){_0x521669['limit']=qs[_0x95c6('0x20')](_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x20')]);_0x521669[_0x95c6('0x1f')]=qs[_0x95c6('0x1f')](_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x1f')]);}_0x521669['order']=qs[_0x95c6('0x44')](_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x44')]);_0x521669[_0x95c6('0x46')]=qs[_0x95c6('0x3c')](_['pick'](_0x2578c5[_0x95c6('0x3b')],_0x20bbb1[_0x95c6('0x3c')]));_0x521669[_0x95c6('0x46')]['VoiceQueueId']=_0x210e4e['id'];if(_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x521669[_0x95c6('0x46')]=_[_0x95c6('0x4e')](_0x521669[_0x95c6('0x46')],{'$or':_['map'](_0x521669[_0x95c6('0x3f')],function(_0x3fdfbb){var _0x17540a={};_0x17540a[_0x3fdfbb]={'$like':'%'+_0x2578c5['query'][_0x95c6('0x45')]+'%'};return _0x17540a;})});}_0x521669=_[_0x95c6('0x4e')]({},_0x521669,_0x2578c5[_0x95c6('0x4f')]);return db['CmHopperHistory']['count']({'where':_0x521669[_0x95c6('0x46')]})['then'](function(_0x49867e){_0x4b5dd8[_0x95c6('0x1e')]=_0x49867e;if(_0x2578c5[_0x95c6('0x3b')][_0x95c6('0x48')]){_0x521669[_0x95c6('0x49')]=[{'all':!![]}];}return db[_0x95c6('0x67')][_0x95c6('0x4a')](_0x521669);})[_0x95c6('0x26')](function(_0x114ec4){_0x4b5dd8['rows']=_0x114ec4;return _0x4b5dd8;});}})[_0x95c6('0x26')](respondWithFilteredResult(_0x1a4e74,_0x521669))['catch'](handleError(_0x1a4e74,null));};exports[_0x95c6('0x68')]=function(_0x2716a3,_0x67cb71,_0x5c9365){var _0x1d3a76={'raw':!![],'where':{}};var _0xed77b={};var _0x47013e={'count':0x0,'rows':[]};return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x2716a3[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x67cb71,null))['then'](function(_0x398cf1){if(_0x398cf1){_0xed77b[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db[_0x95c6('0x69')]['rawAttributes']);_0xed77b['query']=_[_0x95c6('0x4d')](_0x2716a3[_0x95c6('0x3b')]);_0xed77b['filters']=_[_0x95c6('0x3d')](_0xed77b[_0x95c6('0x3e')],_0xed77b[_0x95c6('0x3b')]);_0x1d3a76[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0xed77b[_0x95c6('0x3e')],qs['fields'](_0x2716a3['query']['fields']));_0x1d3a76[_0x95c6('0x3f')]=_0x1d3a76[_0x95c6('0x3f')]['length']?_0x1d3a76[_0x95c6('0x3f')]:_0xed77b[_0x95c6('0x3e')];if(!_0x2716a3[_0x95c6('0x3b')]['hasOwnProperty'](_0x95c6('0x42'))){_0x1d3a76[_0x95c6('0x20')]=qs[_0x95c6('0x20')](_0x2716a3['query'][_0x95c6('0x20')]);_0x1d3a76[_0x95c6('0x1f')]=qs[_0x95c6('0x1f')](_0x2716a3['query'][_0x95c6('0x1f')]);}_0x1d3a76['order']=qs[_0x95c6('0x44')](_0x2716a3[_0x95c6('0x3b')][_0x95c6('0x44')]);_0x1d3a76[_0x95c6('0x46')]=qs[_0x95c6('0x3c')](_[_0x95c6('0x63')](_0x2716a3[_0x95c6('0x3b')],_0xed77b[_0x95c6('0x3c')]));_0x1d3a76[_0x95c6('0x46')][_0x95c6('0x64')]=_0x398cf1['id'];if(_0x2716a3[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x1d3a76[_0x95c6('0x46')]=_[_0x95c6('0x4e')](_0x1d3a76[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x1d3a76['attributes'],function(_0xfd942){var _0x5e40a9={};_0x5e40a9[_0xfd942]={'$like':'%'+_0x2716a3['query']['filter']+'%'};return _0x5e40a9;})});}_0x1d3a76=_['merge']({},_0x1d3a76,_0x2716a3[_0x95c6('0x4f')]);return db[_0x95c6('0x69')][_0x95c6('0x1e')]({'where':_0x1d3a76[_0x95c6('0x46')]})[_0x95c6('0x26')](function(_0x2d4107){_0x47013e['count']=_0x2d4107;if(_0x2716a3[_0x95c6('0x3b')]['includeAll']){_0x1d3a76[_0x95c6('0x49')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x1d3a76);})[_0x95c6('0x26')](function(_0x2d7fc7){_0x47013e['rows']=_0x2d7fc7;return _0x47013e;});}})[_0x95c6('0x26')](respondWithFilteredResult(_0x67cb71,_0x1d3a76))[_0x95c6('0x4b')](handleError(_0x67cb71,null));};exports['getHopperBlacks']=function(_0x1756ed,_0x1d3915,_0x2db1b4){var _0x3d8fb4={'raw':!![],'where':{}};var _0x3fd9bf={};var _0x40e87={'count':0x0,'rows':[]};return db[_0x95c6('0x36')]['findOne']({'where':{'id':_0x1756ed[_0x95c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d3915,null))[_0x95c6('0x26')](function(_0xdc9d86){if(_0xdc9d86){_0x3fd9bf['model']=_[_0x95c6('0x4d')](db['CmHopperBlack']['rawAttributes']);_0x3fd9bf[_0x95c6('0x3b')]=_['keys'](_0x1756ed[_0x95c6('0x3b')]);_0x3fd9bf['filters']=_['intersection'](_0x3fd9bf[_0x95c6('0x3e')],_0x3fd9bf['query']);_0x3d8fb4[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x3fd9bf[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x1756ed[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x3d8fb4[_0x95c6('0x3f')]=_0x3d8fb4[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x3d8fb4[_0x95c6('0x3f')]:_0x3fd9bf[_0x95c6('0x3e')];if(!_0x1756ed[_0x95c6('0x3b')][_0x95c6('0x62')](_0x95c6('0x42'))){_0x3d8fb4[_0x95c6('0x20')]=qs[_0x95c6('0x20')](_0x1756ed['query'][_0x95c6('0x20')]);_0x3d8fb4[_0x95c6('0x1f')]=qs[_0x95c6('0x1f')](_0x1756ed['query'][_0x95c6('0x1f')]);}_0x3d8fb4[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x1756ed[_0x95c6('0x3b')][_0x95c6('0x44')]);_0x3d8fb4[_0x95c6('0x46')]=qs['filters'](_[_0x95c6('0x63')](_0x1756ed['query'],_0x3fd9bf[_0x95c6('0x3c')]));_0x3d8fb4['where'][_0x95c6('0x64')]=_0xdc9d86['id'];if(_0x1756ed[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x3d8fb4[_0x95c6('0x46')]=_['merge'](_0x3d8fb4[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x3d8fb4[_0x95c6('0x3f')],function(_0x3c2ed1){var _0xd1e9bd={};_0xd1e9bd[_0x3c2ed1]={'$like':'%'+_0x1756ed[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0xd1e9bd;})});}_0x3d8fb4=_['merge']({},_0x3d8fb4,_0x1756ed[_0x95c6('0x4f')]);return db[_0x95c6('0x6a')][_0x95c6('0x1e')]({'where':_0x3d8fb4[_0x95c6('0x46')]})[_0x95c6('0x26')](function(_0x27c41e){_0x40e87['count']=_0x27c41e;if(_0x1756ed[_0x95c6('0x3b')]['includeAll']){_0x3d8fb4[_0x95c6('0x49')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3d8fb4);})['then'](function(_0x4abdfa){_0x40e87[_0x95c6('0x65')]=_0x4abdfa;return _0x40e87;});}})[_0x95c6('0x26')](respondWithFilteredResult(_0x1d3915,_0x3d8fb4))[_0x95c6('0x4b')](handleError(_0x1d3915,null));};exports['getTeams']=function(_0x856623,_0x226866,_0x34c245){var _0x1efd90={};var _0x56aa72={};var _0x206180;var _0x4e5db4;return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x856623[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x226866,null))[_0x95c6('0x26')](function(_0x46e0e9){if(_0x46e0e9){_0x206180=_0x46e0e9;_0x56aa72[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db['Team'][_0x95c6('0x37')]);_0x56aa72[_0x95c6('0x3b')]=_[_0x95c6('0x4d')](_0x856623[_0x95c6('0x3b')]);_0x56aa72['filters']=_[_0x95c6('0x3d')](_0x56aa72[_0x95c6('0x3e')],_0x56aa72[_0x95c6('0x3b')]);_0x1efd90[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x56aa72[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x856623[_0x95c6('0x3b')]['fields']));_0x1efd90[_0x95c6('0x3f')]=_0x1efd90[_0x95c6('0x3f')]['length']?_0x1efd90[_0x95c6('0x3f')]:_0x56aa72[_0x95c6('0x3e')];_0x1efd90[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x856623['query'][_0x95c6('0x44')]);_0x1efd90[_0x95c6('0x46')]=qs[_0x95c6('0x3c')](_['pick'](_0x856623[_0x95c6('0x3b')],_0x56aa72[_0x95c6('0x3c')]));if(_0x856623[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x1efd90[_0x95c6('0x46')]=_['merge'](_0x1efd90['where'],{'$or':_[_0x95c6('0x3a')](_0x1efd90[_0x95c6('0x3f')],function(_0x555248){var _0x3f1037={};_0x3f1037[_0x555248]={'$like':'%'+_0x856623[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0x3f1037;})});}_0x1efd90=_['merge']({},_0x1efd90,_0x856623[_0x95c6('0x4f')]);return _0x206180[_0x95c6('0x6b')](_0x1efd90);}})[_0x95c6('0x26')](function(_0x192e96){if(_0x192e96){_0x4e5db4=_0x192e96[_0x95c6('0x41')];if(!_0x856623[_0x95c6('0x3b')]['hasOwnProperty']('nolimit')){_0x1efd90[_0x95c6('0x20')]=qs['limit'](_0x856623['query']['limit']);_0x1efd90['offset']=qs[_0x95c6('0x1f')](_0x856623[_0x95c6('0x3b')][_0x95c6('0x1f')]);}return _0x206180[_0x95c6('0x6b')](_0x1efd90);}})[_0x95c6('0x26')](function(_0x3473cc){if(_0x3473cc){return _0x3473cc?{'count':_0x4e5db4,'rows':_0x3473cc}:null;}})[_0x95c6('0x26')](respondWithResult(_0x226866,null))['catch'](handleError(_0x226866,null));};exports[_0x95c6('0x6c')]=function(_0x42f8be,_0x50d96b,_0x3c1e1b){var _0xa0bead=_0x42f8be[_0x95c6('0x51')]['teams'];var _0x54f1c3=_[_0x95c6('0x3a')](_0xa0bead,'id');return db[_0x95c6('0x6d')]['findAll']({'where':{'id':_0x54f1c3},'attributes':['id'],'include':[{'model':db[_0x95c6('0x6e')],'as':_0x95c6('0x6f'),'attributes':['id',_0x95c6('0x31'),_0x95c6('0x70'),_0x95c6('0x71'),_0x95c6('0x72')],'raw':!![]}]})[_0x95c6('0x26')](function(_0x3e2074){if(_0x3e2074){var _0x2c2b1d=_[_0x95c6('0x73')](_0x3e2074,function(_0x1b9e63){var _0x4a4543=_0x1b9e63[_0x95c6('0x28')]({'plain':!![]});_0x4a4543[_0x95c6('0x6f')][_0x95c6('0x74')](function(_0x520f7b){_0x520f7b['penalty']=_[_0x95c6('0x30')](_0xa0bead,{'id':_0x4a4543['id']})['penalty'];});return _0x4a4543[_0x95c6('0x6f')];});return db[_0x95c6('0x36')]['find']({'where':{'id':_0x42f8be['params']['id']}})[_0x95c6('0x26')](function(_0x3238d9){return db[_0x95c6('0x75')]['transaction'](function(_0x4566a1){return _0x3238d9[_0x95c6('0x6c')](_0x54f1c3,{'transaction':_0x4566a1})[_0x95c6('0x26')](function(){return BPromise['each'](_0x2c2b1d,function(_0x941428){return db[_0x95c6('0x76')][_0x95c6('0x77')]({'where':{'UserId':_0x941428['id'],'VoiceQueueId':_0x42f8be[_0x95c6('0x4c')]['id']},'defaults':{'penalty':_0x941428['penalty']},'transaction':_0x4566a1});});})[_0x95c6('0x26')](function(){return BPromise[_0x95c6('0x78')](_[_0x95c6('0x45')](_0x2c2b1d,{'online':!![]}),function(_0x41c93c){return db[_0x95c6('0x79')][_0x95c6('0x7a')]({'membername':_0x41c93c[_0x95c6('0x31')],'UserId':_0x41c93c['id'],'queue_name':_0x3238d9[_0x95c6('0x31')],'VoiceQueueId':_0x3238d9['id'],'interface':_[_0x95c6('0x7b')](_0x41c93c['interface'])?util[_0x95c6('0x7c')](_0x95c6('0x7d'),_0x41c93c[_0x95c6('0x31')]):_0x41c93c[_0x95c6('0x72')],'paused':_0x41c93c['voicePause']||![],'penalty':_0x41c93c[_0x95c6('0x7e')]},{'transaction':_0x4566a1});});})['then'](function(){_0x2c2b1d[_0x95c6('0x74')](function(_0x926120){socket[_0x95c6('0x7f')](_0x95c6('0x80'),{'UserId':_0x926120['id'],'VoiceQueueId':_0x3238d9['id']});});});});});}})['then'](respondWithStatusCode(_0x50d96b,null))[_0x95c6('0x4b')](handleError(_0x50d96b,null));};exports['removeTeams']=function(_0x54d6a5,_0x39c8d5,_0x348f83){return db[_0x95c6('0x6d')][_0x95c6('0x4a')]({'where':{'id':_0x54d6a5[_0x95c6('0x3b')][_0x95c6('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x95c6('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x95c6('0x26')](handleEntityNotFound(_0x39c8d5,null))[_0x95c6('0x26')](function(_0x573659){var _0x391ca6=_[_0x95c6('0x3a')](_0x573659,'id');var _0x52c638=[];var _0x87aae5=[];var _0x4240f7=squel[_0x95c6('0x82')]();_0x4240f7[_0x95c6('0x83')](_0x95c6('0x84'))['from'](_0x95c6('0x85'),'tq')[_0x95c6('0x86')]('user_has_teams','ut',_0x95c6('0x87'))['where'](_0x95c6('0x88'),_0x54d6a5[_0x95c6('0x4c')]['id']);for(var _0x25cc47=0x0;_0x25cc47<_0x573659[_0x95c6('0x41')];_0x25cc47+=0x1){let _0x929f6f=_0x573659[_0x25cc47];for(var _0x7aa819=0x0;_0x7aa819<_0x929f6f[_0x95c6('0x6f')][_0x95c6('0x41')];_0x7aa819+=0x1){let _0x4b15b8=_0x929f6f[_0x95c6('0x6f')][_0x7aa819];var _0x2e5c1f=_0x4240f7['clone']();_0x2e5c1f[_0x95c6('0x46')](_0x95c6('0x89'),_0x4b15b8['id']);_0x87aae5[_0x95c6('0x8a')](db['sequelize'][_0x95c6('0x3b')](_0x2e5c1f[_0x95c6('0x8b')](),{'type':db[_0x95c6('0x75')][_0x95c6('0x8c')][_0x95c6('0x8d')]})['then'](function(_0xfd8f1f){if(_0xfd8f1f[_0x95c6('0x41')]===0x1){return _0x4b15b8['id'];}else{var _0x3f3918=_[_0x95c6('0x8e')](_[_0x95c6('0x3a')](_0xfd8f1f,_0x95c6('0x8f')),function(_0x549033){return _[_0x95c6('0x2e')](_0x391ca6,_0x549033);});if(_0x3f3918){return _0x4b15b8['id'];}}}));}}return BPromise[_0x95c6('0x90')](_0x87aae5)[_0x95c6('0x26')](function(_0x30a3c1){_0x52c638=_(_0x52c638)['union'](_0x30a3c1)[_0x95c6('0x91')]()[_0x95c6('0x2d')]();return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x54d6a5['params']['id']}})[_0x95c6('0x26')](function(_0x4769d0){return db['sequelize'][_0x95c6('0x92')](function(_0x16324f){return _0x4769d0['removeTeams'](_0x54d6a5[_0x95c6('0x3b')][_0x95c6('0x81')],{'transaction':_0x16324f})[_0x95c6('0x26')](function(){if(!_['isEmpty'](_0x52c638)){return _0x4769d0[_0x95c6('0x93')](_0x52c638,{'transaction':_0x16324f})['then'](function(){return db['UserVoiceQueueRt'][_0x95c6('0x27')]({'where':{'VoiceQueueId':_0x54d6a5[_0x95c6('0x4c')]['id'],'UserId':_0x52c638},'transaction':_0x16324f});});}})[_0x95c6('0x26')](function(){_0x52c638['forEach'](function(_0x46ccec){socket['emit']('userVoiceQueue:remove',{'UserId':_0x46ccec,'VoiceQueueId':_0x4769d0['id']});});});});});});})[_0x95c6('0x26')](respondWithStatusCode(_0x39c8d5,null))[_0x95c6('0x4b')](handleError(_0x39c8d5,null));};exports[_0x95c6('0x94')]=function(_0x5f1583,_0x7f95fe,_0x4fc867){var _0x242e3c,_0x15fbb9;return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x5f1583[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x7f95fe,null))['then'](function(_0x1ae43c){if(_0x1ae43c){_0x15fbb9=_0x1ae43c;return _0x1ae43c[_0x95c6('0x94')](_0x5f1583[_0x95c6('0x51')][_0x95c6('0x81')],_[_0x95c6('0x5a')](_0x5f1583[_0x95c6('0x51')],[_0x95c6('0x81'),'id'])||{})['spread'](function(_0x57c442){for(var _0x4f2e6a=0x0;_0x4f2e6a<_0x5f1583[_0x95c6('0x51')]['ids'][_0x95c6('0x41')];_0x4f2e6a+=0x1){socket['emit'](_0x95c6('0x80'),{'UserId':_0x5f1583[_0x95c6('0x51')][_0x95c6('0x81')][_0x4f2e6a],'VoiceQueueId':_0x5f1583[_0x95c6('0x4c')]['id']});}return _0x57c442;});}})[_0x95c6('0x26')](function(_0x379545){_0x242e3c=_0x379545||[];if(_0x15fbb9){return db[_0x95c6('0x6e')][_0x95c6('0x4a')]({'where':{'id':_0x5f1583['body'][_0x95c6('0x81')]},'attributes':['id',_0x95c6('0x31'),'online','voicePause','interface'],'raw':!![]});}})[_0x95c6('0x26')](function(_0x48763e){if(!_[_0x95c6('0x95')](_0x48763e)){var _0x25f551=[];for(var _0x46b114=0x0;_0x46b114<_0x48763e[_0x95c6('0x41')];_0x46b114++){if(_0x48763e[_0x46b114]['online']){_0x25f551['push'](db['UserVoiceQueueRt'][_0x95c6('0x7a')]({'membername':_0x48763e[_0x46b114][_0x95c6('0x31')],'UserId':_0x48763e[_0x46b114]['id'],'queue_name':_0x15fbb9[_0x95c6('0x31')],'VoiceQueueId':_0x15fbb9['id'],'interface':_['isNil'](_0x48763e[_0x46b114][_0x95c6('0x72')])?util['format'](_0x95c6('0x7d'),_0x48763e[_0x46b114]['name']):_0x48763e[_0x46b114]['interface'],'paused':_0x48763e[_0x46b114][_0x95c6('0x71')]||![],'penalty':_0x5f1583[_0x95c6('0x51')][_0x95c6('0x7e')]||0x0}));}}return BPromise[_0x95c6('0x90')](_0x25f551);}})[_0x95c6('0x26')](function(){return _0x242e3c;})['then'](respondWithResult(_0x7f95fe,null))[_0x95c6('0x4b')](handleError(_0x7f95fe,null));};exports['removeAgents']=function(_0x5b78d5,_0x325594,_0x39e077){return db['VoiceQueue']['find']({'where':{'id':_0x5b78d5[_0x95c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x325594,null))['then'](function(_0x400bdf){if(_0x400bdf){return _0x400bdf[_0x95c6('0x93')](_0x5b78d5[_0x95c6('0x3b')][_0x95c6('0x81')])[_0x95c6('0x26')](function(){if(_[_0x95c6('0x96')](_0x5b78d5[_0x95c6('0x3b')][_0x95c6('0x81')])){for(var _0x3246f2=0x0;_0x3246f2<_0x5b78d5[_0x95c6('0x3b')][_0x95c6('0x81')][_0x95c6('0x41')];_0x3246f2+=0x1){socket['emit'](_0x95c6('0x97'),{'UserId':Number(_0x5b78d5['query'][_0x95c6('0x81')][_0x3246f2]),'VoiceQueueId':Number(_0x5b78d5[_0x95c6('0x4c')]['id'])});}}else{socket[_0x95c6('0x7f')](_0x95c6('0x97'),{'UserId':Number(_0x5b78d5[_0x95c6('0x3b')][_0x95c6('0x81')]),'VoiceQueueId':Number(_0x5b78d5[_0x95c6('0x4c')]['id'])});}});}})[_0x95c6('0x26')](function(_0x41a54c){return db[_0x95c6('0x79')][_0x95c6('0x27')]({'where':{'VoiceQueueId':_0x5b78d5[_0x95c6('0x4c')]['id'],'UserId':_0x5b78d5['query'][_0x95c6('0x81')]}})[_0x95c6('0x26')](function(){return _0x41a54c;});})['then'](respondWithStatusCode(_0x325594,null))[_0x95c6('0x4b')](handleError(_0x325594,null));};exports[_0x95c6('0x98')]=function(_0x43f07c,_0x3e7570,_0x94656){var _0x1a775d={};var _0x753a7b={};var _0x189536;var _0x67dd6;return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x43f07c[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x3e7570,null))['then'](function(_0x28e3ea){if(_0x28e3ea){_0x189536=_0x28e3ea;_0x753a7b[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db[_0x95c6('0x6e')][_0x95c6('0x37')]);_0x753a7b[_0x95c6('0x3b')]=_[_0x95c6('0x4d')](_0x43f07c[_0x95c6('0x3b')]);_0x753a7b['filters']=_[_0x95c6('0x3d')](_0x753a7b[_0x95c6('0x3e')],_0x753a7b[_0x95c6('0x3b')]);_0x1a775d[_0x95c6('0x3f')]=_['intersection'](_0x753a7b[_0x95c6('0x3e')],qs['fields'](_0x43f07c[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x1a775d[_0x95c6('0x3f')]=_0x1a775d[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x1a775d[_0x95c6('0x3f')]:_0x753a7b[_0x95c6('0x3e')];_0x1a775d[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x43f07c[_0x95c6('0x3b')][_0x95c6('0x44')]);_0x1a775d['where']=qs[_0x95c6('0x3c')](_[_0x95c6('0x63')](_0x43f07c[_0x95c6('0x3b')],_0x753a7b[_0x95c6('0x3c')]));if(_0x43f07c[_0x95c6('0x3b')]['filter']){_0x1a775d[_0x95c6('0x46')]=_[_0x95c6('0x4e')](_0x1a775d[_0x95c6('0x46')],{'$or':_['map'](_0x1a775d['attributes'],function(_0x12f84d){var _0x3566d7={};_0x3566d7[_0x12f84d]={'$like':'%'+_0x43f07c['query'][_0x95c6('0x45')]+'%'};return _0x3566d7;})});}_0x1a775d=_[_0x95c6('0x4e')]({},_0x1a775d,_0x43f07c['options']);return _0x189536[_0x95c6('0x98')](_0x1a775d);}})[_0x95c6('0x26')](function(_0x43cf08){if(_0x43cf08){_0x67dd6=_0x43cf08[_0x95c6('0x41')];if(!_0x43f07c['query'][_0x95c6('0x62')]('nolimit')){_0x1a775d['limit']=qs[_0x95c6('0x20')](_0x43f07c[_0x95c6('0x3b')][_0x95c6('0x20')]);_0x1a775d['offset']=qs[_0x95c6('0x1f')](_0x43f07c[_0x95c6('0x3b')][_0x95c6('0x1f')]);}return _0x189536[_0x95c6('0x98')](_0x1a775d);}})['then'](function(_0x4fcc26){if(_0x4fcc26){return _0x4fcc26?{'count':_0x67dd6,'rows':_0x4fcc26}:null;}})[_0x95c6('0x26')](respondWithResult(_0x3e7570,null))[_0x95c6('0x4b')](handleError(_0x3e7570,null));};exports[_0x95c6('0x99')]=function(_0x487b34,_0x16e2e1,_0x3cc5d1){var _0x11e41d={};var _0x4cd1ba={};var _0x4fc377;var _0x3b493e;return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x487b34[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x16e2e1,null))['then'](function(_0x2b2f7d){if(_0x2b2f7d){_0x4fc377=_0x2b2f7d;_0x4cd1ba[_0x95c6('0x3e')]=_['keys'](db[_0x95c6('0x79')]['rawAttributes']);_0x4cd1ba[_0x95c6('0x3b')]=_[_0x95c6('0x4d')](_0x487b34[_0x95c6('0x3b')]);_0x4cd1ba[_0x95c6('0x3c')]=_['intersection'](_0x4cd1ba[_0x95c6('0x3e')],_0x4cd1ba[_0x95c6('0x3b')]);_0x11e41d[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x4cd1ba[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x487b34[_0x95c6('0x3b')]['fields']));_0x11e41d[_0x95c6('0x3f')]=_0x11e41d[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x11e41d[_0x95c6('0x3f')]:_0x4cd1ba[_0x95c6('0x3e')];_0x11e41d[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x487b34[_0x95c6('0x3b')][_0x95c6('0x44')]);_0x11e41d[_0x95c6('0x46')]=qs['filters'](_['pick'](_0x487b34[_0x95c6('0x3b')],_0x4cd1ba['filters']));if(_0x487b34[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x11e41d['where']=_[_0x95c6('0x4e')](_0x11e41d[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x11e41d[_0x95c6('0x3f')],function(_0x237837){var _0x4cd177={};_0x4cd177[_0x237837]={'$like':'%'+_0x487b34['query'][_0x95c6('0x45')]+'%'};return _0x4cd177;})});}_0x11e41d=_['merge']({},_0x11e41d,_0x487b34[_0x95c6('0x4f')]);return _0x4fc377['getMembers'](_0x11e41d);}})[_0x95c6('0x26')](function(_0x3087d7){if(_0x3087d7){_0x3b493e=_0x3087d7[_0x95c6('0x41')];if(!_0x487b34[_0x95c6('0x3b')][_0x95c6('0x62')]('nolimit')){_0x11e41d['limit']=qs[_0x95c6('0x20')](_0x487b34['query'][_0x95c6('0x20')]);_0x11e41d[_0x95c6('0x1f')]=qs['offset'](_0x487b34[_0x95c6('0x3b')]['offset']);}return _0x4fc377['getMembers'](_0x11e41d);}})[_0x95c6('0x26')](function(_0x3ded94){return _0x3ded94?{'count':_0x3b493e,'rows':_0x3ded94}:null;})[_0x95c6('0x26')](respondWithResult(_0x16e2e1,null))[_0x95c6('0x4b')](handleError(_0x16e2e1,null));};exports[_0x95c6('0x9a')]=function(_0x51d96e,_0x558c4e,_0x5df381){var _0x3ded28={};var _0x521ff0={};var _0x3ed041;var _0x266732;return db[_0x95c6('0x36')][_0x95c6('0x60')]({'where':{'id':_0x51d96e[_0x95c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x558c4e,null))[_0x95c6('0x26')](function(_0x29b1b9){if(_0x29b1b9){_0x3ed041=_0x29b1b9;_0x521ff0[_0x95c6('0x3e')]=_[_0x95c6('0x4d')](db[_0x95c6('0x9b')][_0x95c6('0x37')]);_0x521ff0['query']=_[_0x95c6('0x4d')](_0x51d96e[_0x95c6('0x3b')]);_0x521ff0[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x521ff0[_0x95c6('0x3e')],_0x521ff0['query']);_0x3ded28[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x521ff0[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x3ded28['attributes']=_0x3ded28[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x3ded28[_0x95c6('0x3f')]:_0x521ff0[_0x95c6('0x3e')];_0x3ded28[_0x95c6('0x43')]=qs['sort'](_0x51d96e['query']['sort']);_0x3ded28[_0x95c6('0x46')]=qs[_0x95c6('0x3c')](_[_0x95c6('0x63')](_0x51d96e[_0x95c6('0x3b')],_0x521ff0[_0x95c6('0x3c')]));if(_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x45')]){_0x3ded28[_0x95c6('0x46')]=_[_0x95c6('0x4e')](_0x3ded28[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x3ded28[_0x95c6('0x3f')],function(_0x344300){var _0x7e2c2d={};_0x7e2c2d[_0x344300]={'$like':'%'+_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0x7e2c2d;})});}_0x3ded28=_['merge']({},_0x3ded28,_0x51d96e['options']);return _0x3ed041[_0x95c6('0x9a')](_0x3ded28);}})['then'](function(_0x1b30a2){if(_0x1b30a2){_0x266732=_0x1b30a2[_0x95c6('0x41')];if(!_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x62')](_0x95c6('0x42'))){_0x3ded28[_0x95c6('0x20')]=qs[_0x95c6('0x20')](_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x20')]);_0x3ded28['offset']=qs[_0x95c6('0x1f')](_0x51d96e[_0x95c6('0x3b')][_0x95c6('0x1f')]);}return _0x3ed041[_0x95c6('0x9a')](_0x3ded28);}})[_0x95c6('0x26')](function(_0x2b4966){if(_0x2b4966){return _0x2b4966?{'count':_0x266732,'rows':_0x2b4966}:null;}})[_0x95c6('0x26')](respondWithResult(_0x558c4e,null))[_0x95c6('0x4b')](handleError(_0x558c4e,null));};exports[_0x95c6('0x9c')]=function(_0xcc42c2,_0x2be648,_0x8d898){var _0x5a87c6,_0x21fc2a;return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0xcc42c2[_0x95c6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2be648,null))[_0x95c6('0x26')](function(_0xf84528){if(_0xf84528){_0x21fc2a=_0xf84528;return _0xf84528[_0x95c6('0x9c')](_0xcc42c2[_0x95c6('0x51')]['ids'],_[_0x95c6('0x5a')](_0xcc42c2[_0x95c6('0x51')],['ids','id'])||{});}return null;})[_0x95c6('0x9d')](function(_0x22a872){var _0x4c3b05;_0x5a87c6=_0x22a872||[];var _0x27e373=[];if(_0x22a872){for(var _0x5cacd3=0x0;_0x5cacd3<_0x22a872[_0x95c6('0x41')];_0x5cacd3+=0x1){var _0x2b98bc=_0x22a872[_0x5cacd3][_0x95c6('0x28')]({'plain':!![]});_0x21fc2a[_0x95c6('0x9e')]=_0xcc42c2[_0x95c6('0x51')][_0x95c6('0x9e')]?_0xcc42c2[_0x95c6('0x51')][_0x95c6('0x9e')]:_0x21fc2a[_0x95c6('0x9e')];switch(_0x21fc2a[_0x95c6('0x9e')]){case _0x95c6('0x9f'):_0x4c3b05=squel[_0x95c6('0xa0')]()[_0x95c6('0xa1')](_0x95c6('0xa2'))[_0x95c6('0xa3')]([_0x95c6('0xa4'),_0x95c6('0xa5'),_0x95c6('0xa6'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0x95c6('0x82')]()[_0x95c6('0x83')]('phone',_0x95c6('0xa4'))[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0xa5'))[_0x95c6('0x83')]('id',_0x95c6('0xa6'))[_0x95c6('0x83')](_0x2b98bc[_0x95c6('0xa8')]['toString'](),_0x95c6('0xa9'))[_0x95c6('0x83')](_0xcc42c2['params']['id'][_0x95c6('0x8b')](),'VoiceQueueId')[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0x58'))[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0x59'))[_0x95c6('0xaa')]('cm_contacts')['where'](_0x95c6('0xab'))['where'](_0x95c6('0xac'),_0x2b98bc['CmListId'][_0x95c6('0x8b')]())[_0x95c6('0x46')](_0x95c6('0xad'))['where'](_0x95c6('0xae'),squel[_0x95c6('0x82')]()[_0x95c6('0x83')](_0x95c6('0xaf'))[_0x95c6('0xaa')](_0x95c6('0xb0'))[_0x95c6('0x46')](_0x95c6('0x88'),_0xcc42c2[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')]()))[_0x95c6('0x46')](_0x95c6('0xae'),squel[_0x95c6('0x82')]()[_0x95c6('0x83')]('COALESCE(phone,\x27\x27)')[_0x95c6('0xaa')](_0x95c6('0xa2'))['where'](_0x95c6('0x88'),_0xcc42c2[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')]())))[_0x95c6('0x8b')]();break;case _0x95c6('0xb1'):_0x4c3b05=squel[_0x95c6('0xa0')]()['into'](_0x95c6('0xa2'))[_0x95c6('0xa3')]([_0x95c6('0xa4'),_0x95c6('0xa5'),_0x95c6('0xa6'),_0x95c6('0xa9'),'VoiceQueueId','createdAt',_0x95c6('0x59')],squel[_0x95c6('0x82')]()[_0x95c6('0x83')](_0x95c6('0xa4'),_0x95c6('0xa4'))[_0x95c6('0x83')]('NOW()',_0x95c6('0xa5'))[_0x95c6('0x83')]('id',_0x95c6('0xa6'))[_0x95c6('0x83')](_0x2b98bc[_0x95c6('0xa8')][_0x95c6('0x8b')](),_0x95c6('0xa9'))[_0x95c6('0x83')](_0xcc42c2[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')](),_0x95c6('0x64'))[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0x58'))['field']('NOW()',_0x95c6('0x59'))[_0x95c6('0xaa')](_0x95c6('0xb2'))['where']('deletedAt\x20IS\x20NULL')[_0x95c6('0x46')](_0x95c6('0xac'),_0x2b98bc['CmListId']['toString']())['where'](_0x95c6('0xad'))[_0x95c6('0x46')](_0x95c6('0xae'),squel[_0x95c6('0x82')]()['field'](_0x95c6('0xb3'))[_0x95c6('0xaa')](_0x95c6('0xa2'))[_0x95c6('0x46')](_0x95c6('0x88'),_0xcc42c2[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')]())))['toString']();break;default:_0x4c3b05=squel[_0x95c6('0xa0')]()[_0x95c6('0xa1')]('cm_hopper')[_0x95c6('0xa3')](['phone','scheduledAt','ContactId',_0x95c6('0xa9'),_0x95c6('0x64'),_0x95c6('0x58'),_0x95c6('0x59')],squel[_0x95c6('0x82')]()[_0x95c6('0x83')](_0x95c6('0xa4'),'phone')[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0xa5'))['field']('id','ContactId')[_0x95c6('0x83')](_0x2b98bc['CmListId']['toString'](),'ListId')[_0x95c6('0x83')](_0xcc42c2[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')](),_0x95c6('0x64'))['field'](_0x95c6('0xa7'),_0x95c6('0x58'))[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0x59'))['from'](_0x95c6('0xb2'))[_0x95c6('0x46')](_0x95c6('0xab'))[_0x95c6('0x46')](_0x95c6('0xac'),_0x2b98bc[_0x95c6('0xa8')]['toString']())[_0x95c6('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x95c6('0x8b')]();}_0x27e373['push'](db[_0x95c6('0x75')][_0x95c6('0x3b')](_0x4c3b05));}return BPromise['all'](_0x27e373);}})[_0x95c6('0x26')](function(){return _0x5a87c6;})[_0x95c6('0x26')](respondWithResult(_0x2be648,null))[_0x95c6('0x4b')](handleError(_0x2be648,null));};exports[_0x95c6('0xb4')]=function(_0x416a6c,_0x4fa27a,_0x52157c){return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x416a6c['params']['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x4fa27a,null))[_0x95c6('0x26')](function(_0xe614fc){if(_0xe614fc){return _0xe614fc['removeLists'](_0x416a6c[_0x95c6('0x3b')][_0x95c6('0x81')]);}})[_0x95c6('0x26')](function(_0x31cf44){if(_0x31cf44){return db[_0x95c6('0x61')][_0x95c6('0x27')]({'where':{'ListId':_0x416a6c['query'][_0x95c6('0x81')],'VoiceQueueId':_0x416a6c[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](function(){return _0x31cf44;});}})[_0x95c6('0x26')](respondWithStatusCode(_0x4fa27a,null))[_0x95c6('0x4b')](handleError(_0x4fa27a,null));};exports['getBlackLists']=function(_0x22eedc,_0xac14e8,_0x57585e){var _0x4f8219={};var _0x56ca6b={};var _0x58de6a;var _0xe282de;return db['VoiceQueue'][_0x95c6('0x60')]({'where':{'id':_0x22eedc[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0xac14e8,null))[_0x95c6('0x26')](function(_0x5c9276){if(_0x5c9276){_0x58de6a=_0x5c9276;_0x56ca6b['model']=_[_0x95c6('0x4d')](db['CmList']['rawAttributes']);_0x56ca6b['query']=_[_0x95c6('0x4d')](_0x22eedc[_0x95c6('0x3b')]);_0x56ca6b[_0x95c6('0x3c')]=_[_0x95c6('0x3d')](_0x56ca6b[_0x95c6('0x3e')],_0x56ca6b[_0x95c6('0x3b')]);_0x4f8219[_0x95c6('0x3f')]=_[_0x95c6('0x3d')](_0x56ca6b[_0x95c6('0x3e')],qs[_0x95c6('0x40')](_0x22eedc[_0x95c6('0x3b')][_0x95c6('0x40')]));_0x4f8219[_0x95c6('0x3f')]=_0x4f8219[_0x95c6('0x3f')][_0x95c6('0x41')]?_0x4f8219['attributes']:_0x56ca6b[_0x95c6('0x3e')];_0x4f8219[_0x95c6('0x43')]=qs[_0x95c6('0x44')](_0x22eedc[_0x95c6('0x3b')]['sort']);_0x4f8219[_0x95c6('0x46')]=qs['filters'](_[_0x95c6('0x63')](_0x22eedc[_0x95c6('0x3b')],_0x56ca6b[_0x95c6('0x3c')]));if(_0x22eedc[_0x95c6('0x3b')]['filter']){_0x4f8219[_0x95c6('0x46')]=_[_0x95c6('0x4e')](_0x4f8219[_0x95c6('0x46')],{'$or':_[_0x95c6('0x3a')](_0x4f8219[_0x95c6('0x3f')],function(_0x305c8c){var _0xfe8727={};_0xfe8727[_0x305c8c]={'$like':'%'+_0x22eedc[_0x95c6('0x3b')][_0x95c6('0x45')]+'%'};return _0xfe8727;})});}_0x4f8219=_[_0x95c6('0x4e')]({},_0x4f8219,_0x22eedc[_0x95c6('0x4f')]);return _0x58de6a['getBlackLists'](_0x4f8219);}})[_0x95c6('0x26')](function(_0x57708d){if(_0x57708d){_0xe282de=_0x57708d[_0x95c6('0x41')];if(!_0x22eedc['query'][_0x95c6('0x62')](_0x95c6('0x42'))){_0x4f8219['limit']=qs['limit'](_0x22eedc[_0x95c6('0x3b')][_0x95c6('0x20')]);_0x4f8219[_0x95c6('0x1f')]=qs['offset'](_0x22eedc[_0x95c6('0x3b')][_0x95c6('0x1f')]);}return _0x58de6a['getBlackLists'](_0x4f8219);}})[_0x95c6('0x26')](function(_0x5a36f7){if(_0x5a36f7){return _0x5a36f7?{'count':_0xe282de,'rows':_0x5a36f7}:null;}})['then'](respondWithResult(_0xac14e8,null))[_0x95c6('0x4b')](handleError(_0xac14e8,null));};exports[_0x95c6('0xb5')]=function(_0x4bdb16,_0x2bbea9,_0x152991){var _0x2cdcc2,_0x168237;return db[_0x95c6('0x36')][_0x95c6('0x30')]({'where':{'id':_0x4bdb16[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x2bbea9,null))['then'](function(_0xcc3b6f){if(_0xcc3b6f){_0x168237=_0xcc3b6f;return _0xcc3b6f[_0x95c6('0xb5')](_0x4bdb16['body']['ids'],_['omit'](_0x4bdb16[_0x95c6('0x51')],['ids','id'])||{});}return null;})['spread'](function(_0x41240f){var _0x39c46d;_0x2cdcc2=_0x41240f||[];var _0x3420a9=[];if(_0x41240f){for(var _0x6f694a=0x0;_0x6f694a<_0x41240f[_0x95c6('0x41')];_0x6f694a+=0x1){var _0x52c0f9=_0x41240f[_0x6f694a][_0x95c6('0x28')]({'plain':!![]});_0x39c46d=squel[_0x95c6('0xa0')]()['into'](_0x95c6('0xb6'))[_0x95c6('0xa3')]([_0x95c6('0xa4'),_0x95c6('0xa6'),_0x95c6('0xa9'),_0x95c6('0x64'),_0x95c6('0x58'),'updatedAt'],squel[_0x95c6('0x82')]()[_0x95c6('0x83')]('phone',_0x95c6('0xa4'))[_0x95c6('0x83')]('id','ContactId')[_0x95c6('0x83')](_0x52c0f9[_0x95c6('0xa8')]['toString'](),_0x95c6('0xa9'))[_0x95c6('0x83')](_0x4bdb16[_0x95c6('0x4c')]['id'][_0x95c6('0x8b')](),'VoiceQueueId')[_0x95c6('0x83')]('NOW()',_0x95c6('0x58'))[_0x95c6('0x83')](_0x95c6('0xa7'),_0x95c6('0x59'))[_0x95c6('0xaa')](_0x95c6('0xb2'))[_0x95c6('0x46')]('deletedAt\x20IS\x20NULL')[_0x95c6('0x46')]('ListId\x20=\x20?',_0x52c0f9[_0x95c6('0xa8')][_0x95c6('0x8b')]())[_0x95c6('0x46')](_0x95c6('0xad')))['toString']();_0x3420a9['push'](db['sequelize'][_0x95c6('0x3b')](_0x39c46d));}return BPromise[_0x95c6('0x90')](_0x3420a9);}})[_0x95c6('0x26')](function(){return _0x2cdcc2;})[_0x95c6('0x26')](respondWithResult(_0x2bbea9,null))[_0x95c6('0x4b')](handleError(_0x2bbea9,null));};exports['removeBlackLists']=function(_0x2008df,_0x97a386,_0x279d75){return db[_0x95c6('0x36')]['find']({'where':{'id':_0x2008df[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](handleEntityNotFound(_0x97a386,null))['then'](function(_0x2a8179){if(_0x2a8179){return _0x2a8179[_0x95c6('0xb7')](_0x2008df['query']['ids']);}})[_0x95c6('0x26')](function(_0x5d600b){if(_0x5d600b){return db[_0x95c6('0x6a')]['destroy']({'where':{'ListId':_0x2008df['query']['ids'],'VoiceQueueId':_0x2008df[_0x95c6('0x4c')]['id']}})[_0x95c6('0x26')](function(){return _0x5d600b;});}})['then'](respondWithStatusCode(_0x97a386,null))[_0x95c6('0x4b')](handleError(_0x97a386,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9259f39..bebd384 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 _0x248f=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save','update','remove'];(function(_0x19a08d,_0x41aa77){var _0x2485ed=function(_0x50472b){while(--_0x50472b){_0x19a08d['push'](_0x19a08d['shift']());}};_0x2485ed(++_0x41aa77);}(_0x248f,0x108));var _0xf248=function(_0xce7dc4,_0x13498e){_0xce7dc4=_0xce7dc4-0x0;var _0x31f02f=_0x248f[_0xce7dc4];return _0x31f02f;};'use strict';var EventEmitter=require(_0xf248('0x0'));var VoiceQueue=require(_0xf248('0x1'))['db'][_0xf248('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf248('0x3'),'afterUpdate':_0xf248('0x4'),'afterDestroy':_0xf248('0x5')};function emitEvent(_0x4589ab){return function(_0x538aa3,_0x2c3b4b,_0x4bd663){VoiceQueueEvents[_0xf248('0x6')](_0x4589ab+':'+_0x538aa3['id'],_0x538aa3);VoiceQueueEvents[_0xf248('0x6')](_0x4589ab,_0x538aa3);_0x4bd663(null);};}for(var e in events){if(events[_0xf248('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xf248('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x9c02=['VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x463d3f,_0x4a5099){var _0x31efa0=function(_0x3023a4){while(--_0x3023a4){_0x463d3f['push'](_0x463d3f['shift']());}};_0x31efa0(++_0x4a5099);}(_0x9c02,0xfa));var _0x29c0=function(_0x20c165,_0x294964){_0x20c165=_0x20c165-0x0;var _0x520683=_0x9c02[_0x20c165];return _0x520683;};'use strict';var EventEmitter=require(_0x29c0('0x0'));var VoiceQueue=require(_0x29c0('0x1'))['db'][_0x29c0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x29c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x29c0('0x4'),'afterDestroy':_0x29c0('0x5')};function emitEvent(_0x1d9826){return function(_0x2d2b19,_0x3a7254,_0x4b11d4){VoiceQueueEvents[_0x29c0('0x6')](_0x1d9826+':'+_0x2d2b19['id'],_0x2d2b19);VoiceQueueEvents[_0x29c0('0x6')](_0x1d9826,_0x2d2b19);_0x4b11d4(null);};}for(var e in events){if(events[_0x29c0('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x29c0('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 9677bf1..4b95fd7 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 _0x0a98=['VoiceQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes'];(function(_0x46251a,_0x39229d){var _0x5b0295=function(_0x3e9ea5){while(--_0x3e9ea5){_0x46251a['push'](_0x46251a['shift']());}};_0x5b0295(++_0x39229d);}(_0x0a98,0x1d7));var _0x80a9=function(_0x57fbc4,_0x5a219e){_0x57fbc4=_0x57fbc4-0x0;var _0x974300=_0x0a98[_0x57fbc4];return _0x974300;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x80a9('0x0'))(_0x80a9('0x1'));var moment=require(_0x80a9('0x2'));var BPromise=require(_0x80a9('0x3'));var rp=require(_0x80a9('0x4'));var fs=require('fs');var path=require(_0x80a9('0x5'));var rimraf=require(_0x80a9('0x6'));var config=require(_0x80a9('0x7'));var attributes=require(_0x80a9('0x8'));module['exports']=function(_0x5e8c7b,_0x54857c){return _0x5e8c7b['define'](_0x80a9('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe33a=['define','voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x5e24e5,_0x2b0442){var _0x7ecb30=function(_0xb3eee5){while(--_0xb3eee5){_0x5e24e5['push'](_0x5e24e5['shift']());}};_0x7ecb30(++_0x2b0442);}(_0xe33a,0x1a6));var _0xae33=function(_0x1fb712,_0x4c7960){_0x1fb712=_0x1fb712-0x0;var _0x4a0b21=_0xe33a[_0x1fb712];return _0x4a0b21;};'use strict';var _=require(_0xae33('0x0'));var util=require(_0xae33('0x1'));var logger=require(_0xae33('0x2'))(_0xae33('0x3'));var moment=require('moment');var BPromise=require(_0xae33('0x4'));var rp=require(_0xae33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae33('0x6'));var config=require(_0xae33('0x7'));var attributes=require(_0xae33('0x8'));module[_0xae33('0x9')]=function(_0x17127f,_0x39796a){return _0x17127f[_0xae33('0xa')]('VoiceQueue',attributes,{'tableName':_0xae33('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 5819af4..4673ef6 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 _0x82b6=['VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','debug','stringify','catch','ShowVoiceQueue','VoiceQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info'];(function(_0xa5fd6f,_0x27c90f){var _0x2893f1=function(_0x9b5d79){while(--_0x9b5d79){_0xa5fd6f['push'](_0xa5fd6f['shift']());}};_0x2893f1(++_0x27c90f);}(_0x82b6,0x17d));var _0x682b=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x82b6[_0x367a3d];return _0x460539;};'use strict';var _=require('lodash');var util=require(_0x682b('0x0'));var moment=require(_0x682b('0x1'));var BPromise=require('bluebird');var rs=require(_0x682b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x682b('0x3'))['db'];var utils=require(_0x682b('0x4'));var logger=require('../../config/logger')(_0x682b('0x5'));var config=require(_0x682b('0x6'));var jayson=require(_0x682b('0x7'));var client=jayson[_0x682b('0x8')][_0x682b('0x9')]({'port':0x232a});config[_0x682b('0xa')]=_[_0x682b('0xb')](config[_0x682b('0xa')],{'host':_0x682b('0xc'),'port':0x18eb});var socket=require(_0x682b('0xd'))(new Redis(config[_0x682b('0xa')]));require(_0x682b('0xe'))[_0x682b('0xf')](socket);function respondWithRpcPromise(_0x5de070,_0xe03745,_0x315742){return new BPromise(function(_0x36568a,_0x373962){return client[_0x682b('0x10')](_0x5de070,_0x315742)[_0x682b('0x11')](function(_0x28cbbb){logger[_0x682b('0x12')](_0x682b('0x13'),_0xe03745,_0x682b('0x14'));logger['debug'](_0x682b('0x15'),_0xe03745,_0x682b('0x14'),JSON['stringify'](_0x28cbbb));if(_0x28cbbb[_0x682b('0x16')]){if(_0x28cbbb[_0x682b('0x16')]['code']===0x1f4){logger[_0x682b('0x16')]('VoiceQueue,\x20%s,\x20%s',_0xe03745,_0x28cbbb[_0x682b('0x16')][_0x682b('0x17')]);return _0x373962(_0x28cbbb['error'][_0x682b('0x17')]);}logger[_0x682b('0x16')](_0x682b('0x13'),_0xe03745,_0x28cbbb['error'][_0x682b('0x17')]);return _0x36568a(_0x28cbbb[_0x682b('0x16')]['message']);}else{logger[_0x682b('0x12')](_0x682b('0x13'),_0xe03745,_0x682b('0x14'));_0x36568a(_0x28cbbb[_0x682b('0x18')]['message']);}})['catch'](function(_0x6b7681){logger['error'](_0x682b('0x13'),_0xe03745,_0x6b7681);_0x373962(_0x6b7681);});});}exports[_0x682b('0x19')]=function(_0xbc235e){var _0xa73d42=this;return new Promise(function(_0x3a30f0,_0x37165d){return db['VoiceQueue'][_0x682b('0x1a')]({'raw':_0xbc235e[_0x682b('0x1b')]?_0xbc235e[_0x682b('0x1b')][_0x682b('0x1c')]===undefined?!![]:![]:!![],'where':_0xbc235e[_0x682b('0x1b')]?_0xbc235e['options'][_0x682b('0x1d')]||null:null,'attributes':_0xbc235e['options']?_0xbc235e[_0x682b('0x1b')][_0x682b('0x1e')]||null:null,'limit':_0xbc235e['options']?_0xbc235e[_0x682b('0x1b')]['limit']||null:null,'include':_0xbc235e['options']?_0xbc235e['options'][_0x682b('0x1f')]?_[_0x682b('0x20')](_0xbc235e[_0x682b('0x1b')][_0x682b('0x1f')],function(_0x5ae56d){return{'model':db[_0x5ae56d[_0x682b('0x21')]],'as':_0x5ae56d['as'],'attributes':_0x5ae56d[_0x682b('0x1e')],'include':_0x5ae56d[_0x682b('0x1f')]?_['map'](_0x5ae56d[_0x682b('0x1f')],function(_0x527f1f){return{'model':db[_0x527f1f['model']],'as':_0x527f1f['as'],'attributes':_0x527f1f[_0x682b('0x1e')],'include':_0x527f1f[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x527f1f[_0x682b('0x1f')],function(_0x5e3194){return{'model':db[_0x5e3194[_0x682b('0x21')]],'as':_0x5e3194['as'],'attributes':_0x5e3194[_0x682b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45fe9e){logger['info'](_0x682b('0x19'),_0xbc235e);logger[_0x682b('0x22')]('GetVoiceQueue',_0xbc235e,JSON[_0x682b('0x23')](_0x45fe9e));_0x3a30f0(_0x45fe9e);})[_0x682b('0x24')](function(_0x1b39b3){logger[_0x682b('0x16')](_0x682b('0x19'),_0x1b39b3[_0x682b('0x17')],_0xbc235e);_0x37165d(_0xa73d42[_0x682b('0x16')](0x1f4,_0x1b39b3[_0x682b('0x17')]));});});};exports[_0x682b('0x25')]=function(_0x58909d){var _0x14753c=this;return new Promise(function(_0xc0f2cc,_0x312707){return db[_0x682b('0x26')][_0x682b('0x27')]({'raw':_0x58909d['options']?_0x58909d[_0x682b('0x1b')][_0x682b('0x1c')]===undefined?!![]:![]:!![],'where':_0x58909d['options']?_0x58909d[_0x682b('0x1b')][_0x682b('0x1d')]||null:null,'attributes':_0x58909d[_0x682b('0x1b')]?_0x58909d[_0x682b('0x1b')][_0x682b('0x1e')]||null:null,'include':_0x58909d['options']?_0x58909d['options'][_0x682b('0x1f')]?_['map'](_0x58909d['options'][_0x682b('0x1f')],function(_0x263ff7){return{'model':db[_0x263ff7['model']],'as':_0x263ff7['as'],'attributes':_0x263ff7[_0x682b('0x1e')],'include':_0x263ff7[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x263ff7['include'],function(_0x31e558){return{'model':db[_0x31e558[_0x682b('0x21')]],'as':_0x31e558['as'],'attributes':_0x31e558[_0x682b('0x1e')],'include':_0x31e558[_0x682b('0x1f')]?_[_0x682b('0x20')](_0x31e558[_0x682b('0x1f')],function(_0x369cad){return{'model':db[_0x369cad[_0x682b('0x21')]],'as':_0x369cad['as'],'attributes':_0x369cad[_0x682b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x682b('0x11')](function(_0x150af6){logger[_0x682b('0x12')](_0x682b('0x25'),_0x58909d);logger[_0x682b('0x22')](_0x682b('0x25'),_0x58909d,JSON[_0x682b('0x23')](_0x150af6));_0xc0f2cc(_0x150af6);})['catch'](function(_0x220288){logger[_0x682b('0x16')](_0x682b('0x25'),_0x220288['message'],_0x58909d);_0x312707(_0x14753c[_0x682b('0x16')](0x1f4,_0x220288['message']));});});}; \ No newline at end of file +var _0x274c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit','map','include','model','then','debug','ShowVoiceQueue','find','where'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x274c,0x1a4));var _0xc274=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x274c[_0x13ed69];return _0x50c72e;};'use strict';var _=require(_0xc274('0x0'));var util=require(_0xc274('0x1'));var moment=require(_0xc274('0x2'));var BPromise=require(_0xc274('0x3'));var rs=require(_0xc274('0x4'));var fs=require('fs');var Redis=require(_0xc274('0x5'));var db=require(_0xc274('0x6'))['db'];var utils=require(_0xc274('0x7'));var logger=require(_0xc274('0x8'))(_0xc274('0x9'));var config=require(_0xc274('0xa'));var jayson=require(_0xc274('0xb'));var client=jayson['client'][_0xc274('0xc')]({'port':0x232a});config[_0xc274('0xd')]=_[_0xc274('0xe')](config[_0xc274('0xd')],{'host':_0xc274('0xf'),'port':0x18eb});var socket=require(_0xc274('0x10'))(new Redis(config[_0xc274('0xd')]));require(_0xc274('0x11'))['register'](socket);function respondWithRpcPromise(_0x4f9764,_0x2c4953,_0x24cd32){return new BPromise(function(_0x32912e,_0x518361){return client[_0xc274('0x12')](_0x4f9764,_0x24cd32)['then'](function(_0x42b921){logger['info'](_0xc274('0x13'),_0x2c4953,_0xc274('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x2c4953,_0xc274('0x14'),JSON[_0xc274('0x15')](_0x42b921));if(_0x42b921['error']){if(_0x42b921[_0xc274('0x16')][_0xc274('0x17')]===0x1f4){logger[_0xc274('0x16')](_0xc274('0x13'),_0x2c4953,_0x42b921[_0xc274('0x16')][_0xc274('0x18')]);return _0x518361(_0x42b921[_0xc274('0x16')][_0xc274('0x18')]);}logger[_0xc274('0x16')](_0xc274('0x13'),_0x2c4953,_0x42b921[_0xc274('0x16')]['message']);return _0x32912e(_0x42b921[_0xc274('0x16')][_0xc274('0x18')]);}else{logger[_0xc274('0x19')](_0xc274('0x13'),_0x2c4953,_0xc274('0x14'));_0x32912e(_0x42b921[_0xc274('0x1a')][_0xc274('0x18')]);}})[_0xc274('0x1b')](function(_0x3c35f2){logger[_0xc274('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2c4953,_0x3c35f2);_0x518361(_0x3c35f2);});});}exports[_0xc274('0x1c')]=function(_0x125255){var _0x1c9f4c=this;return new Promise(function(_0x41b865,_0xad802f){return db[_0xc274('0x1d')]['findAll']({'raw':_0x125255['options']?_0x125255[_0xc274('0x1e')][_0xc274('0x1f')]===undefined?!![]:![]:!![],'where':_0x125255[_0xc274('0x1e')]?_0x125255[_0xc274('0x1e')]['where']||null:null,'attributes':_0x125255[_0xc274('0x1e')]?_0x125255[_0xc274('0x1e')][_0xc274('0x20')]||null:null,'limit':_0x125255[_0xc274('0x1e')]?_0x125255['options'][_0xc274('0x21')]||null:null,'include':_0x125255[_0xc274('0x1e')]?_0x125255[_0xc274('0x1e')]['include']?_[_0xc274('0x22')](_0x125255[_0xc274('0x1e')][_0xc274('0x23')],function(_0x734b88){return{'model':db[_0x734b88[_0xc274('0x24')]],'as':_0x734b88['as'],'attributes':_0x734b88[_0xc274('0x20')],'include':_0x734b88[_0xc274('0x23')]?_[_0xc274('0x22')](_0x734b88[_0xc274('0x23')],function(_0x30c416){return{'model':db[_0x30c416[_0xc274('0x24')]],'as':_0x30c416['as'],'attributes':_0x30c416[_0xc274('0x20')],'include':_0x30c416['include']?_['map'](_0x30c416['include'],function(_0x5b7fad){return{'model':db[_0x5b7fad[_0xc274('0x24')]],'as':_0x5b7fad['as'],'attributes':_0x5b7fad['attributes']};}):[]};}):[]};}):[]:[]})[_0xc274('0x25')](function(_0x34d7b9){logger[_0xc274('0x19')](_0xc274('0x1c'),_0x125255);logger[_0xc274('0x26')](_0xc274('0x1c'),_0x125255,JSON[_0xc274('0x15')](_0x34d7b9));_0x41b865(_0x34d7b9);})[_0xc274('0x1b')](function(_0x4e0337){logger['error'](_0xc274('0x1c'),_0x4e0337[_0xc274('0x18')],_0x125255);_0xad802f(_0x1c9f4c[_0xc274('0x16')](0x1f4,_0x4e0337[_0xc274('0x18')]));});});};exports[_0xc274('0x27')]=function(_0x29a32a){var _0x15fc33=this;return new Promise(function(_0x4e69a5,_0xf06b58){return db[_0xc274('0x1d')][_0xc274('0x28')]({'raw':_0x29a32a['options']?_0x29a32a[_0xc274('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x29a32a[_0xc274('0x1e')]?_0x29a32a[_0xc274('0x1e')][_0xc274('0x29')]||null:null,'attributes':_0x29a32a[_0xc274('0x1e')]?_0x29a32a['options']['attributes']||null:null,'include':_0x29a32a[_0xc274('0x1e')]?_0x29a32a[_0xc274('0x1e')]['include']?_[_0xc274('0x22')](_0x29a32a[_0xc274('0x1e')][_0xc274('0x23')],function(_0x32194c){return{'model':db[_0x32194c[_0xc274('0x24')]],'as':_0x32194c['as'],'attributes':_0x32194c['attributes'],'include':_0x32194c[_0xc274('0x23')]?_['map'](_0x32194c[_0xc274('0x23')],function(_0x218924){return{'model':db[_0x218924[_0xc274('0x24')]],'as':_0x218924['as'],'attributes':_0x218924[_0xc274('0x20')],'include':_0x218924[_0xc274('0x23')]?_[_0xc274('0x22')](_0x218924[_0xc274('0x23')],function(_0x7126bd){return{'model':db[_0x7126bd[_0xc274('0x24')]],'as':_0x7126bd['as'],'attributes':_0x7126bd[_0xc274('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc274('0x25')](function(_0x22d069){logger[_0xc274('0x19')](_0xc274('0x27'),_0x29a32a);logger['debug']('ShowVoiceQueue',_0x29a32a,JSON[_0xc274('0x15')](_0x22d069));_0x4e69a5(_0x22d069);})[_0xc274('0x1b')](function(_0x3105a1){logger[_0xc274('0x16')](_0xc274('0x27'),_0x3105a1[_0xc274('0x18')],_0x29a32a);_0xf06b58(_0x15fc33[_0xc274('0x16')](0x1f4,_0x3105a1[_0xc274('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3fa73b7..c47dbd7 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 _0xc37e=['register','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xc37e,0x152));var _0xec37=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc37e[_0x122ef9];return _0x42fba0;};'use strict';var VoiceQueueEvents=require(_0xec37('0x0'));var events=[_0xec37('0x1'),_0xec37('0x2'),_0xec37('0x3')];function createListener(_0x41f2c4,_0x346a20){return function(_0x9b6de4){_0x346a20[_0xec37('0x4')](_0x41f2c4,_0x9b6de4);};}function removeListener(_0xdef813,_0x345668){return function(){VoiceQueueEvents[_0xec37('0x5')](_0xdef813,_0x345668);};}exports[_0xec37('0x6')]=function(_0x2a1100){for(var _0xeca95=0x0,_0x378e1c=events['length'];_0xeca95<_0x378e1c;_0xeca95++){var _0x1c027e=events[_0xeca95];var _0x198f4a=createListener(_0xec37('0x7')+_0x1c027e,_0x2a1100);VoiceQueueEvents['on'](_0x1c027e,_0x198f4a);}}; \ No newline at end of file +var _0xf2ba=['voiceQueue:','./voiceQueue.events','save','removeListener','length'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf2ba,0xab));var _0xaf2b=function(_0x3bb45b,_0x2dcc0b){_0x3bb45b=_0x3bb45b-0x0;var _0x513162=_0xf2ba[_0x3bb45b];return _0x513162;};'use strict';var VoiceQueueEvents=require(_0xaf2b('0x0'));var events=[_0xaf2b('0x1'),'remove','update'];function createListener(_0x19f781,_0x278600){return function(_0x53e5d8){_0x278600['emit'](_0x19f781,_0x53e5d8);};}function removeListener(_0x270bcd,_0x470eae){return function(){VoiceQueueEvents[_0xaf2b('0x2')](_0x270bcd,_0x470eae);};}exports['register']=function(_0x4e6e12){for(var _0x57f9b6=0x0,_0x32081f=events[_0xaf2b('0x3')];_0x57f9b6<_0x32081f;_0x57f9b6++){var _0x59c0e9=events[_0x57f9b6];var _0x429e47=createListener(_0xaf2b('0x4')+_0x59c0e9,_0x4e6e12);VoiceQueueEvents['on'](_0x59c0e9,_0x429e47);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c67244a..42d3e91 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 _0x4317=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport'];(function(_0x141c90,_0x4dc489){var _0x4ea2eb=function(_0x294aae){while(--_0x294aae){_0x141c90['push'](_0x141c90['shift']());}};_0x4ea2eb(++_0x4dc489);}(_0x4317,0x7c));var _0x7431=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4317[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7431('0x0'));var path=require(_0x7431('0x1'));var timeout=require(_0x7431('0x2'));var express=require('express');var router=express[_0x7431('0x3')]();var auth=require(_0x7431('0x4'));var interaction=require(_0x7431('0x5'));var config=require(_0x7431('0x6'));var controller=require(_0x7431('0x7'));router[_0x7431('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7431('0x8')](_0x7431('0x9'),auth[_0x7431('0xa')](),controller[_0x7431('0xb')]);router[_0x7431('0x8')](_0x7431('0xc'),auth[_0x7431('0xa')](),controller[_0x7431('0xd')]);router[_0x7431('0x8')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0xf')]);router[_0x7431('0x10')]('/',auth[_0x7431('0xa')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0x13')]);router[_0x7431('0x14')](_0x7431('0xe'),auth[_0x7431('0xa')](),controller[_0x7431('0x15')]);module[_0x7431('0x16')]=router; \ No newline at end of file +var _0x3d04=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/index','getVoiceQueuesReport','show','create','put','/:id','delete','destroy'];(function(_0x321f86,_0x3da031){var _0x3738c5=function(_0x4b8f9a){while(--_0x4b8f9a){_0x321f86['push'](_0x321f86['shift']());}};_0x3738c5(++_0x3da031);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var path=require(_0x43d0('0x2'));var timeout=require(_0x43d0('0x3'));var express=require(_0x43d0('0x4'));var router=express[_0x43d0('0x5')]();var auth=require(_0x43d0('0x6'));var interaction=require(_0x43d0('0x7'));var config=require('../../config/environment');var controller=require(_0x43d0('0x8'));router[_0x43d0('0x9')]('/',auth[_0x43d0('0xa')](),controller[_0x43d0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x43d0('0x9')](_0x43d0('0xc'),auth[_0x43d0('0xa')](),controller[_0x43d0('0xd')]);router[_0x43d0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x43d0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router[_0x43d0('0x10')](_0x43d0('0x11'),auth[_0x43d0('0xa')](),controller['update']);router[_0x43d0('0x12')](_0x43d0('0x11'),auth['isAuthenticated'](),controller[_0x43d0('0x13')]);module[_0x43d0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 768e90a..d75d592 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 _0x3e33=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x29533a,_0x1ed50f){var _0x376831=function(_0x2387d2){while(--_0x2387d2){_0x29533a['push'](_0x29533a['shift']());}};_0x376831(++_0x1ed50f);}(_0x3e33,0x137));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x33e3('0x0'));var moment=require('moment');module[_0x33e3('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x33e3('0x2')]},'calleridname':{'type':Sequelize[_0x33e3('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x553277){var _0xbf9c0a=moment(_0x553277);var _0x3d4093=moment(this[_0x33e3('0x3')](_0x33e3('0x4')))[_0x33e3('0x5')](_0x33e3('0x6'));var _0x1c0172=_0xbf9c0a[_0x33e3('0x7')](_0x3d4093,_0x33e3('0x8'));this['setDataValue'](_0x33e3('0x9'),_0x553277);this[_0x33e3('0xa')](_0x33e3('0xb'),_0x1c0172||null);}},'position':{'type':Sequelize[_0x33e3('0xc')]},'count':{'type':Sequelize[_0x33e3('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallercomplete':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x33e3('0xe')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x33e3('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x33e3('0x2')]},'connectedlinenum':{'type':Sequelize[_0x33e3('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x33e3('0x2')]},'context':{'type':Sequelize[_0x33e3('0x2')]},'exten':{'type':Sequelize[_0x33e3('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x33e3('0xc')]},'mohtime':{'type':Sequelize[_0x33e3('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x33e3('0x2')]},'transfer':{'type':Sequelize[_0x33e3('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x33e3('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x33e3('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x33e3('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bb2=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4bb2,0x11c));var _0x24bb=function(_0x1dcd05,_0x29862f){_0x1dcd05=_0x1dcd05-0x0;var _0x8ed56d=_0x4bb2[_0x1dcd05];return _0x8ed56d;};'use strict';var Sequelize=require(_0x24bb('0x0'));var moment=require('moment');module[_0x24bb('0x1')]={'type':{'type':Sequelize[_0x24bb('0x2')]},'uniqueid':{'type':Sequelize[_0x24bb('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x24bb('0x2')]},'queue':{'type':Sequelize[_0x24bb('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x24bb('0x3')],'set':function(_0x2fe9dd){var _0x3236ff=moment(_0x2fe9dd);var _0x12d63c=moment(this[_0x24bb('0x4')](_0x24bb('0x5')))[_0x24bb('0x6')](_0x24bb('0x7'));var _0x1a9fcc=_0x3236ff[_0x24bb('0x8')](_0x12d63c,_0x24bb('0x9'));this[_0x24bb('0xa')](_0x24bb('0xb'),_0x2fe9dd);this[_0x24bb('0xa')](_0x24bb('0xc'),_0x1a9fcc||null);}},'position':{'type':Sequelize[_0x24bb('0xd')]},'count':{'type':Sequelize[_0x24bb('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x24bb('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x24bb('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x24bb('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x24bb('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x24bb('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x24bb('0x2')],'comment':_0x24bb('0xf')},'originalposition':{'type':Sequelize[_0x24bb('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x24bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x24bb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x24bb('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x24bb('0x2')]},'holdtime':{'type':Sequelize[_0x24bb('0xd')]},'mohtime':{'type':Sequelize[_0x24bb('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x24bb('0x2')]},'transfer':{'type':Sequelize[_0x24bb('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x24bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x24bb('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x24bb('0xd')],'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 11591df..17d8bab 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 _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 17a9ee0..81bf4ec 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 _0xbe2a=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xbe2a,0x1bf));var _0xabe2=function(_0x45a3b1,_0x32afd9){_0x45a3b1=_0x45a3b1-0x0;var _0x557985=_0xbe2a[_0x45a3b1];return _0x557985;};'use strict';var EventEmitter=require(_0xabe2('0x0'));var VoiceQueueReport=require(_0xabe2('0x1'))['db'][_0xabe2('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xabe2('0x3')](0x0);var events={'afterCreate':_0xabe2('0x4'),'afterUpdate':_0xabe2('0x5'),'afterDestroy':_0xabe2('0x6')};function emitEvent(_0xa1e8de){return function(_0x32fc32,_0x42d1e2,_0xf08a85){VoiceQueueReportEvents[_0xabe2('0x7')](_0xa1e8de+':'+_0x32fc32['id'],_0x32fc32);VoiceQueueReportEvents[_0xabe2('0x7')](_0xa1e8de,_0x32fc32);_0xf08a85(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xabe2('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xcdf4=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1f27f6,_0xf6c693){var _0x4b9c87=function(_0x2951f8){while(--_0x2951f8){_0x1f27f6['push'](_0x1f27f6['shift']());}};_0x4b9c87(++_0xf6c693);}(_0xcdf4,0xc7));var _0x4cdf=function(_0x29e252,_0x29ef4a){_0x29e252=_0x29e252-0x0;var _0x5e9c8a=_0xcdf4[_0x29e252];return _0x5e9c8a;};'use strict';var EventEmitter=require(_0x4cdf('0x0'));var VoiceQueueReport=require(_0x4cdf('0x1'))['db'][_0x4cdf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4cdf('0x3')](0x0);var events={'afterCreate':_0x4cdf('0x4'),'afterUpdate':_0x4cdf('0x5'),'afterDestroy':_0x4cdf('0x6')};function emitEvent(_0x4884ab){return function(_0x3ca450,_0xee3f5e,_0xcea4ec){VoiceQueueReportEvents[_0x4cdf('0x7')](_0x4884ab+':'+_0x3ca450['id'],_0x3ca450);VoiceQueueReportEvents['emit'](_0x4884ab,_0x3ca450);_0xcea4ec(null);};}for(var e in events){if(events[_0x4cdf('0x8')](e)){var event=events[e];VoiceQueueReport[_0x4cdf('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 67d6a7c..1f77a9c 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 _0xbb32=['moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','util','api'];(function(_0xc2b4c8,_0x756a49){var _0x402443=function(_0x571bae){while(--_0x571bae){_0xc2b4c8['push'](_0xc2b4c8['shift']());}};_0x402443(++_0x756a49);}(_0xbb32,0x129));var _0x2bb3=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xbb32[_0x4fc421];return _0x8c6d63;};'use strict';var _=require('lodash');var util=require(_0x2bb3('0x0'));var logger=require('../../config/logger')(_0x2bb3('0x1'));var moment=require(_0x2bb3('0x2'));var BPromise=require('bluebird');var rp=require(_0x2bb3('0x3'));var fs=require('fs');var path=require(_0x2bb3('0x4'));var rimraf=require(_0x2bb3('0x5'));var config=require(_0x2bb3('0x6'));var attributes=require(_0x2bb3('0x7'));module[_0x2bb3('0x8')]=function(_0x2e3722,_0x4878a3){return _0x2e3722[_0x2bb3('0x9')](_0x2bb3('0xa'),attributes,{'tableName':_0x2bb3('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2bb3('0xc')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6005=['exports','define','report_queue','uniqueid','calleridnum','lodash','moment','bluebird','request-promise','rimraf','./voiceQueueReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6005,0x1c8));var _0x5600=function(_0x573dd6,_0x53e782){_0x573dd6=_0x573dd6-0x0;var _0x4acb95=_0x6005[_0x573dd6];return _0x4acb95;};'use strict';var _=require(_0x5600('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5600('0x1'));var BPromise=require(_0x5600('0x2'));var rp=require(_0x5600('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5600('0x4'));var config=require('../../config/environment');var attributes=require(_0x5600('0x5'));module[_0x5600('0x6')]=function(_0x2df798,_0x43912f){return _0x2df798[_0x5600('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x5600('0x8'),'paranoid':![],'indexes':[{'fields':[_0x5600('0x9')]},{'fields':[_0x5600('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index afc3aa5..4401e18 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 _0xb323=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','catch','update','body','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x45b9e5,_0xaf6bb2){var _0x4f7466=function(_0x20fe4e){while(--_0x20fe4e){_0x45b9e5['push'](_0x45b9e5['shift']());}};_0x4f7466(++_0xaf6bb2);}(_0xb323,0x157));var _0x3b32=function(_0x3b8ae5,_0x473e3c){_0x3b8ae5=_0x3b8ae5-0x0;var _0x3adeb3=_0xb323[_0x3b8ae5];return _0x3adeb3;};'use strict';var _=require(_0x3b32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b32('0x2'));var db=require(_0x3b32('0x3'))['db'];var utils=require(_0x3b32('0x4'));var logger=require(_0x3b32('0x5'))(_0x3b32('0x6'));var config=require(_0x3b32('0x7'));var jayson=require(_0x3b32('0x8'));var client=jayson[_0x3b32('0x9')][_0x3b32('0xa')]({'port':0x232a});config[_0x3b32('0xb')]=_[_0x3b32('0xc')](config[_0x3b32('0xb')],{'host':_0x3b32('0xd'),'port':0x18eb});var socket=require(_0x3b32('0xe'))(new Redis(config[_0x3b32('0xb')]));require('./voiceQueueReport.socket')[_0x3b32('0xf')](socket);function respondWithRpcPromise(_0x4f12f9,_0x3ed32d,_0x3336f1){return new BPromise(function(_0x21e4d6,_0x1149a9){return client[_0x3b32('0x10')](_0x4f12f9,_0x3336f1)['then'](function(_0x322a0e){logger[_0x3b32('0x11')](_0x3b32('0x12'),_0x3ed32d,_0x3b32('0x13'));logger[_0x3b32('0x14')](_0x3b32('0x15'),_0x3ed32d,'request\x20sent',JSON[_0x3b32('0x16')](_0x322a0e));if(_0x322a0e[_0x3b32('0x17')]){if(_0x322a0e[_0x3b32('0x17')][_0x3b32('0x18')]===0x1f4){logger[_0x3b32('0x17')](_0x3b32('0x12'),_0x3ed32d,_0x322a0e['error'][_0x3b32('0x19')]);return _0x1149a9(_0x322a0e['error'][_0x3b32('0x19')]);}logger[_0x3b32('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x3ed32d,_0x322a0e['error'][_0x3b32('0x19')]);return _0x21e4d6(_0x322a0e['error'][_0x3b32('0x19')]);}else{logger['info'](_0x3b32('0x12'),_0x3ed32d,_0x3b32('0x13'));_0x21e4d6(_0x322a0e[_0x3b32('0x1a')][_0x3b32('0x19')]);}})['catch'](function(_0x4238d3){logger[_0x3b32('0x17')](_0x3b32('0x12'),_0x3ed32d,_0x4238d3);_0x1149a9(_0x4238d3);});});}exports['GetVoiceQueueReport']=function(_0x5eddce){var _0x1c6a40=this;return new Promise(function(_0x19020e,_0x345478){return db[_0x3b32('0x1b')][_0x3b32('0x1c')]({'raw':_0x5eddce['options']?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x1e')]===undefined?!![]:![]:!![],'where':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x1f')]||null:null,'attributes':_0x5eddce['options']?_0x5eddce[_0x3b32('0x1d')][_0x3b32('0x20')]||null:null,'limit':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce['options'][_0x3b32('0x21')]||null:null,'include':_0x5eddce[_0x3b32('0x1d')]?_0x5eddce['options'][_0x3b32('0x22')]?_[_0x3b32('0x23')](_0x5eddce['options']['include'],function(_0x3536f4){return{'model':db[_0x3536f4[_0x3b32('0x24')]],'as':_0x3536f4['as'],'attributes':_0x3536f4[_0x3b32('0x20')],'include':_0x3536f4['include']?_[_0x3b32('0x23')](_0x3536f4[_0x3b32('0x22')],function(_0x124784){return{'model':db[_0x124784[_0x3b32('0x24')]],'as':_0x124784['as'],'attributes':_0x124784['attributes'],'include':_0x124784[_0x3b32('0x22')]?_['map'](_0x124784[_0x3b32('0x22')],function(_0x4a1922){return{'model':db[_0x4a1922[_0x3b32('0x24')]],'as':_0x4a1922['as'],'attributes':_0x4a1922['attributes']};}):[]};}):[]};}):[]:[]})[_0x3b32('0x25')](function(_0x6d817f){logger['info'](_0x3b32('0x26'),_0x5eddce);logger[_0x3b32('0x14')](_0x3b32('0x26'),_0x5eddce,JSON[_0x3b32('0x16')](_0x6d817f));_0x19020e(_0x6d817f);})['catch'](function(_0x21c8cb){logger[_0x3b32('0x17')](_0x3b32('0x26'),_0x21c8cb[_0x3b32('0x19')],_0x5eddce);_0x345478(_0x1c6a40[_0x3b32('0x17')](0x1f4,_0x21c8cb[_0x3b32('0x19')]));});});};exports[_0x3b32('0x27')]=function(_0x407a62){var _0xa8a3cc=this;return new Promise(function(_0x585835,_0x3c6ad3){return db[_0x3b32('0x1b')][_0x3b32('0x28')](_0x407a62['body'],{'raw':_0x407a62[_0x3b32('0x1d')]?_0x407a62[_0x3b32('0x1d')][_0x3b32('0x1e')]===undefined?!![]:![]:!![]})[_0x3b32('0x25')](function(_0x2d4091){logger['info'](_0x3b32('0x27'),_0x407a62);logger[_0x3b32('0x14')](_0x3b32('0x27'),_0x407a62,JSON[_0x3b32('0x16')](_0x2d4091));_0x585835(_0x2d4091);})[_0x3b32('0x29')](function(_0x443dec){logger['error']('CreateVoiceQueueReport',_0x443dec[_0x3b32('0x19')],_0x407a62);_0x3c6ad3(_0xa8a3cc[_0x3b32('0x17')](0x1f4,_0x443dec['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x152f27){var _0x18e0e7=this;return new Promise(function(_0x3f600c,_0x167771){return db[_0x3b32('0x1b')][_0x3b32('0x2a')](_0x152f27[_0x3b32('0x2b')],{'raw':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')][_0x3b32('0x1f')]||null:null,'attributes':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')]['attributes']||null:null,'limit':_0x152f27[_0x3b32('0x1d')]?_0x152f27[_0x3b32('0x1d')][_0x3b32('0x21')]||null:null})[_0x3b32('0x25')](function(_0x4a79c7){logger['info']('UpdateVoiceQueueReport',_0x152f27);logger[_0x3b32('0x14')]('UpdateVoiceQueueReport',_0x152f27,JSON['stringify'](_0x4a79c7));_0x3f600c(_0x4a79c7);})['catch'](function(_0x5153ed){logger[_0x3b32('0x17')]('UpdateVoiceQueueReport',_0x5153ed[_0x3b32('0x19')],_0x152f27);_0x167771(_0x18e0e7['error'](0x1f4,_0x5153ed[_0x3b32('0x19')]));});});}; \ No newline at end of file +var _0xbe82=['message','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0xbe82,0x1c1));var _0x2be8=function(_0x49a694,_0x4772be){_0x49a694=_0x49a694-0x0;var _0x528a6f=_0xbe82[_0x49a694];return _0x528a6f;};'use strict';var _=require(_0x2be8('0x0'));var util=require(_0x2be8('0x1'));var moment=require('moment');var BPromise=require(_0x2be8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2be8('0x3'));var db=require(_0x2be8('0x4'))['db'];var utils=require(_0x2be8('0x5'));var logger=require(_0x2be8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2be8('0x7'));var client=jayson[_0x2be8('0x8')][_0x2be8('0x9')]({'port':0x232a});config['redis']=_[_0x2be8('0xa')](config[_0x2be8('0xb')],{'host':_0x2be8('0xc'),'port':0x18eb});var socket=require(_0x2be8('0xd'))(new Redis(config[_0x2be8('0xb')]));require(_0x2be8('0xe'))[_0x2be8('0xf')](socket);function respondWithRpcPromise(_0x103b64,_0x1cb802,_0x122056){return new BPromise(function(_0x5d578e,_0x5b0154){return client[_0x2be8('0x10')](_0x103b64,_0x122056)['then'](function(_0xea9818){logger[_0x2be8('0x11')](_0x2be8('0x12'),_0x1cb802,'request\x20sent');logger[_0x2be8('0x13')](_0x2be8('0x14'),_0x1cb802,_0x2be8('0x15'),JSON[_0x2be8('0x16')](_0xea9818));if(_0xea9818[_0x2be8('0x17')]){if(_0xea9818['error']['code']===0x1f4){logger[_0x2be8('0x17')](_0x2be8('0x12'),_0x1cb802,_0xea9818['error'][_0x2be8('0x18')]);return _0x5b0154(_0xea9818[_0x2be8('0x17')][_0x2be8('0x18')]);}logger[_0x2be8('0x17')](_0x2be8('0x12'),_0x1cb802,_0xea9818[_0x2be8('0x17')]['message']);return _0x5d578e(_0xea9818[_0x2be8('0x17')][_0x2be8('0x18')]);}else{logger[_0x2be8('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x1cb802,_0x2be8('0x15'));_0x5d578e(_0xea9818['result'][_0x2be8('0x18')]);}})[_0x2be8('0x19')](function(_0x5b446b){logger['error'](_0x2be8('0x12'),_0x1cb802,_0x5b446b);_0x5b0154(_0x5b446b);});});}exports['GetVoiceQueueReport']=function(_0x2a3482){var _0xcbf7d8=this;return new Promise(function(_0x2e984d,_0x3a5972){return db[_0x2be8('0x1a')][_0x2be8('0x1b')]({'raw':_0x2a3482['options']?_0x2a3482[_0x2be8('0x1c')][_0x2be8('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a3482[_0x2be8('0x1c')]?_0x2a3482[_0x2be8('0x1c')][_0x2be8('0x1e')]||null:null,'attributes':_0x2a3482[_0x2be8('0x1c')]?_0x2a3482[_0x2be8('0x1c')][_0x2be8('0x1f')]||null:null,'limit':_0x2a3482[_0x2be8('0x1c')]?_0x2a3482['options'][_0x2be8('0x20')]||null:null,'include':_0x2a3482[_0x2be8('0x1c')]?_0x2a3482[_0x2be8('0x1c')][_0x2be8('0x21')]?_[_0x2be8('0x22')](_0x2a3482['options']['include'],function(_0x3b9087){return{'model':db[_0x3b9087[_0x2be8('0x23')]],'as':_0x3b9087['as'],'attributes':_0x3b9087[_0x2be8('0x1f')],'include':_0x3b9087[_0x2be8('0x21')]?_[_0x2be8('0x22')](_0x3b9087[_0x2be8('0x21')],function(_0x16cbbb){return{'model':db[_0x16cbbb[_0x2be8('0x23')]],'as':_0x16cbbb['as'],'attributes':_0x16cbbb[_0x2be8('0x1f')],'include':_0x16cbbb[_0x2be8('0x21')]?_['map'](_0x16cbbb[_0x2be8('0x21')],function(_0x4af8c0){return{'model':db[_0x4af8c0[_0x2be8('0x23')]],'as':_0x4af8c0['as'],'attributes':_0x4af8c0[_0x2be8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2be8('0x24')](function(_0x3a49d3){logger[_0x2be8('0x11')](_0x2be8('0x25'),_0x2a3482);logger[_0x2be8('0x13')](_0x2be8('0x25'),_0x2a3482,JSON['stringify'](_0x3a49d3));_0x2e984d(_0x3a49d3);})[_0x2be8('0x19')](function(_0x2351b0){logger[_0x2be8('0x17')](_0x2be8('0x25'),_0x2351b0[_0x2be8('0x18')],_0x2a3482);_0x3a5972(_0xcbf7d8[_0x2be8('0x17')](0x1f4,_0x2351b0[_0x2be8('0x18')]));});});};exports[_0x2be8('0x26')]=function(_0x2689df){var _0x3af3fe=this;return new Promise(function(_0x2a119d,_0x27aefc){return db[_0x2be8('0x1a')][_0x2be8('0x27')](_0x2689df['body'],{'raw':_0x2689df[_0x2be8('0x1c')]?_0x2689df[_0x2be8('0x1c')][_0x2be8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4a8cc1){logger[_0x2be8('0x11')](_0x2be8('0x26'),_0x2689df);logger[_0x2be8('0x13')](_0x2be8('0x26'),_0x2689df,JSON[_0x2be8('0x16')](_0x4a8cc1));_0x2a119d(_0x4a8cc1);})[_0x2be8('0x19')](function(_0x3a26f1){logger[_0x2be8('0x17')]('CreateVoiceQueueReport',_0x3a26f1[_0x2be8('0x18')],_0x2689df);_0x27aefc(_0x3af3fe[_0x2be8('0x17')](0x1f4,_0x3a26f1[_0x2be8('0x18')]));});});};exports[_0x2be8('0x28')]=function(_0x2ee0f0){var _0x245d9b=this;return new Promise(function(_0x119e4a,_0x5d5f9d){return db[_0x2be8('0x1a')][_0x2be8('0x29')](_0x2ee0f0[_0x2be8('0x2a')],{'raw':_0x2ee0f0[_0x2be8('0x1c')]?_0x2ee0f0[_0x2be8('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ee0f0[_0x2be8('0x1c')]?_0x2ee0f0['options'][_0x2be8('0x1e')]||null:null,'attributes':_0x2ee0f0['options']?_0x2ee0f0[_0x2be8('0x1c')][_0x2be8('0x1f')]||null:null,'limit':_0x2ee0f0[_0x2be8('0x1c')]?_0x2ee0f0['options'][_0x2be8('0x20')]||null:null})[_0x2be8('0x24')](function(_0x45de6e){logger[_0x2be8('0x11')](_0x2be8('0x28'),_0x2ee0f0);logger['debug'](_0x2be8('0x28'),_0x2ee0f0,JSON['stringify'](_0x45de6e));_0x119e4a(_0x45de6e);})[_0x2be8('0x19')](function(_0x34caf0){logger[_0x2be8('0x17')]('UpdateVoiceQueueReport',_0x34caf0['message'],_0x2ee0f0);_0x5d5f9d(_0x245d9b[_0x2be8('0x17')](0x1f4,_0x34caf0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 234259e..cc33df6 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 _0xe9e2=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x1bb664,_0x556888){var _0x4635d9=function(_0x4b7d01){while(--_0x4b7d01){_0x1bb664['push'](_0x1bb664['shift']());}};_0x4635d9(++_0x556888);}(_0xe9e2,0xc6));var _0x2e9e=function(_0x36ba80,_0x284c26){_0x36ba80=_0x36ba80-0x0;var _0x135582=_0xe9e2[_0x36ba80];return _0x135582;};'use strict';var VoiceQueueReportEvents=require(_0x2e9e('0x0'));var events=[_0x2e9e('0x1'),_0x2e9e('0x2'),_0x2e9e('0x3')];function createListener(_0x2e0946,_0x533f75){return function(_0x2071c5){_0x533f75[_0x2e9e('0x4')](_0x2e0946,_0x2071c5);};}function removeListener(_0x5f2982,_0x7e25d2){return function(){VoiceQueueReportEvents[_0x2e9e('0x5')](_0x5f2982,_0x7e25d2);};}exports[_0x2e9e('0x6')]=function(_0x20f2a9){for(var _0x4ac7d7=0x0,_0x55c6ae=events[_0x2e9e('0x7')];_0x4ac7d7<_0x55c6ae;_0x4ac7d7++){var _0x49bb9e=events[_0x4ac7d7];var _0x5759d2=createListener(_0x2e9e('0x8')+_0x49bb9e,_0x20f2a9);VoiceQueueReportEvents['on'](_0x49bb9e,_0x5759d2);}}; \ No newline at end of file +var _0x70ef=['save','update','removeListener','register','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x22a6c6,_0x98eff2){var _0x46f1f6=function(_0x1abcc6){while(--_0x1abcc6){_0x22a6c6['push'](_0x22a6c6['shift']());}};_0x46f1f6(++_0x98eff2);}(_0x70ef,0x19d));var _0xf70e=function(_0x37c071,_0x4a4aa0){_0x37c071=_0x37c071-0x0;var _0x1ea43d=_0x70ef[_0x37c071];return _0x1ea43d;};'use strict';var VoiceQueueReportEvents=require(_0xf70e('0x0'));var events=[_0xf70e('0x1'),'remove',_0xf70e('0x2')];function createListener(_0x467924,_0x22f8bf){return function(_0x1a4b78){_0x22f8bf['emit'](_0x467924,_0x1a4b78);};}function removeListener(_0xa76071,_0x352039){return function(){VoiceQueueReportEvents[_0xf70e('0x3')](_0xa76071,_0x352039);};}exports[_0xf70e('0x4')]=function(_0x21d6b8){for(var _0x440f13=0x0,_0x4d68fb=events['length'];_0x440f13<_0x4d68fb;_0x440f13++){var _0x5efa6e=events[_0x440f13];var _0x2746d3=createListener(_0xf70e('0x5')+_0x5efa6e,_0x21d6b8);VoiceQueueReportEvents['on'](_0x5efa6e,_0x2746d3);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 427e978..f7ab06e 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 _0xa786=['index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x450cf0,_0x183637){var _0x173655=function(_0xd5596d){while(--_0xd5596d){_0x450cf0['push'](_0x450cf0['shift']());}};_0x173655(++_0x183637);}(_0xa786,0x1d2));var _0x6a78=function(_0x29c368,_0x82162b){_0x29c368=_0x29c368-0x0;var _0x5f3c39=_0xa786[_0x29c368];return _0x5f3c39;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a78('0x0'));var timeout=require(_0x6a78('0x1'));var express=require(_0x6a78('0x2'));var router=express[_0x6a78('0x3')]();var auth=require(_0x6a78('0x4'));var interaction=require(_0x6a78('0x5'));var config=require(_0x6a78('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x6a78('0x7')]('/',auth[_0x6a78('0x8')](),controller[_0x6a78('0x9')]);router[_0x6a78('0x7')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0xb')]);router[_0x6a78('0xc')]('/',auth[_0x6a78('0x8')](),controller[_0x6a78('0xd')]);router[_0x6a78('0xe')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0xf')]);router[_0x6a78('0x10')](_0x6a78('0xa'),auth[_0x6a78('0x8')](),controller[_0x6a78('0x11')]);module[_0x6a78('0x12')]=router; \ No newline at end of file +var _0xbf4b=['get','index','/:id','isAuthenticated','show','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x556c4d,_0x5a275d){var _0x136bb3=function(_0x344695){while(--_0x344695){_0x556c4d['push'](_0x556c4d['shift']());}};_0x136bb3(++_0x5a275d);}(_0xbf4b,0x99));var _0xbbf4=function(_0x221a0f,_0x3970f6){_0x221a0f=_0x221a0f-0x0;var _0x30309e=_0xbf4b[_0x221a0f];return _0x30309e;};'use strict';var multer=require(_0xbbf4('0x0'));var util=require(_0xbbf4('0x1'));var path=require('path');var timeout=require(_0xbbf4('0x2'));var express=require(_0xbbf4('0x3'));var router=express[_0xbbf4('0x4')]();var auth=require(_0xbbf4('0x5'));var interaction=require(_0xbbf4('0x6'));var config=require(_0xbbf4('0x7'));var controller=require(_0xbbf4('0x8'));router[_0xbbf4('0x9')]('/',auth['isAuthenticated'](),controller[_0xbbf4('0xa')]);router[_0xbbf4('0x9')](_0xbbf4('0xb'),auth[_0xbbf4('0xc')](),controller[_0xbbf4('0xd')]);router['post']('/',auth[_0xbbf4('0xc')](),controller[_0xbbf4('0xe')]);router['put']('/:id',auth[_0xbbf4('0xc')](),controller[_0xbbf4('0xf')]);router[_0xbbf4('0x10')]('/:id',auth[_0xbbf4('0xc')](),controller[_0xbbf4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 10d56bd..f4dcb00 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 _0x9d00=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x425f7b,_0x64101c){var _0x110fd6=function(_0x139292){while(--_0x139292){_0x425f7b['push'](_0x425f7b['shift']());}};_0x110fd6(++_0x64101c);}(_0x9d00,0x191));var _0x09d0=function(_0x27bbc7,_0x3bdaa5){_0x27bbc7=_0x27bbc7-0x0;var _0x4441e2=_0x9d00[_0x27bbc7];return _0x4441e2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x09d0('0x0'));module[_0x09d0('0x1')]={'time':{'type':Sequelize[_0x09d0('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x09d0('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x09d0('0x3'))}}; \ No newline at end of file +var _0x6681=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0x6681,0xda));var _0x1668=function(_0x5a5602,_0x141ea0){_0x5a5602=_0x5a5602-0x0;var _0x4fac3c=_0x6681[_0x5a5602];return _0x4fac3c;};'use strict';var Sequelize=require(_0x1668('0x0'));var moment=require(_0x1668('0x1'));module[_0x1668('0x2')]={'time':{'type':Sequelize[_0x1668('0x3')]},'callid':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1668('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1668('0x4')],'allowNull':![],'defaultValue':moment()[_0x1668('0x5')](_0x1668('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2a530f9..e189fca 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x421c4b,_0x5df9e8){var _0x177258=function(_0x6c354a){while(--_0x6c354a){_0x421c4b['push'](_0x421c4b['shift']());}};_0x177258(++_0x5df9e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x57cf37,_0x149b89){_0x57cf37=_0x57cf37-0x0;var _0x2df46f=_0xb10b[_0x57cf37];return _0x2df46f;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x24955f,_0x2eb32e){var _0x20ec55=function(_0x3f6576){while(--_0x3f6576){_0x24955f['push'](_0x24955f['shift']());}};_0x20ec55(++_0x2eb32e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ab06ae2..1202812 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 _0xafc4=['bluebird','request-promise','path','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','../../config/logger','moment'];(function(_0x2dd21f,_0x58a4b6){var _0x26536f=function(_0x2e6d28){while(--_0x2e6d28){_0x2dd21f['push'](_0x2dd21f['shift']());}};_0x26536f(++_0x58a4b6);}(_0xafc4,0x69));var _0x4afc=function(_0x3e1db8,_0xe3d569){_0x3e1db8=_0x3e1db8-0x0;var _0x4b60fd=_0xafc4[_0x3e1db8];return _0x4b60fd;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x4afc('0xa'),_0x4afc('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x1a2f8a,_0x2f04bb){var _0x47a352=function(_0x3f890b){while(--_0x3f890b){_0x1a2f8a['push'](_0x1a2f8a['shift']());}};_0x47a352(++_0x2f04bb);}(_0x5162,0x103));var _0x2516=function(_0x3bbd2d,_0xf8ba3c){_0x3bbd2d=_0x3bbd2d-0x0;var _0x241bd4=_0x5162[_0x3bbd2d];return _0x241bd4;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[{'name':_0x2516('0xa'),'fields':[_0x2516('0xb'),_0x2516('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5f70c1a..7793e92 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 _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x197ec5,_0x245b96){var _0x13ef62=function(_0x409f78){while(--_0x409f78){_0x197ec5['push'](_0x197ec5['shift']());}};_0x13ef62(++_0x245b96);}(_0xae60,0x1c7));var _0x0ae6=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xae60[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});} \ No newline at end of file +var _0x3423=['rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29c40c,_0x420d4b,_0x76422d){return new BPromise(function(_0xce08ab,_0x305d13){return client[_0x3342('0xc')](_0x29c40c,_0x76422d)[_0x3342('0xd')](function(_0x4ae4f3){logger['info'](_0x3342('0xe'),_0x420d4b,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x420d4b,'request\x20sent',JSON[_0x3342('0xf')](_0x4ae4f3));if(_0x4ae4f3[_0x3342('0x10')]){if(_0x4ae4f3['error'][_0x3342('0x11')]===0x1f4){logger['error'](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')]['message']);return _0x305d13(_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);}logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x4ae4f3[_0x3342('0x10')][_0x3342('0x12')]);return _0xce08ab(_0x4ae4f3[_0x3342('0x10')]['message']);}else{logger[_0x3342('0x13')](_0x3342('0xe'),_0x420d4b,'request\x20sent');_0xce08ab(_0x4ae4f3[_0x3342('0x14')][_0x3342('0x12')]);}})['catch'](function(_0x554f9c){logger[_0x3342('0x10')](_0x3342('0xe'),_0x420d4b,_0x554f9c);_0x305d13(_0x554f9c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 948daf4..686b675 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x2ba573,_0x25c00b){var _0x588b98=function(_0x585994){while(--_0x585994){_0x2ba573['push'](_0x2ba573['shift']());}};_0x588b98(++_0x25c00b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x4912ca,_0x1345b0){var _0x1b8006=function(_0x232d71){while(--_0x232d71){_0x4912ca['push'](_0x4912ca['shift']());}};_0x1b8006(++_0x1345b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 02274c6..c886891 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 _0xf11d=['path','exports','getDataValue','value','extname','setDataValue','channel','membername','STRING','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','format','toString','DATE','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0xf11d,0x7c));var _0xdf11=function(_0x5a04d7,_0x10866a){_0x5a04d7=_0x5a04d7-0x0;var _0x11eaa6=_0xf11d[_0x5a04d7];return _0x11eaa6;};'use strict';var Sequelize=require(_0xdf11('0x0'));var moment=require(_0xdf11('0x1'));var path=require(_0xdf11('0x2'));module[_0xdf11('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xdf11('0x4')](_0xdf11('0x5'))?path[_0xdf11('0x6')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x24ed37){if(_0x24ed37){this[_0xdf11('0x7')](_0xdf11('0x8'),_0x24ed37);this['setDataValue'](_0xdf11('0x9'),_0x24ed37['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xdf11('0xa')]},'calleridname':{'type':Sequelize[_0xdf11('0xa')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xdf11('0xa')]},'accountcode':{'type':Sequelize[_0xdf11('0xa')]},'context':{'type':Sequelize[_0xdf11('0xa')]},'exten':{'type':Sequelize[_0xdf11('0xa')]},'value':{'type':Sequelize[_0xdf11('0xa')]},'type':{'type':Sequelize[_0xdf11('0xa')]},'rating':{'type':Sequelize[_0xdf11('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xdf11('0xa')]},'userDisposition':{'type':Sequelize[_0xdf11('0xa')]},'location':{'type':Sequelize[_0xdf11('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xdf11('0xa')],'defaultValue':_0xdf11('0xd')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xdf11('0xc')]},'failureReason':{'type':Sequelize[_0xdf11('0xc')]},'sentiment':{'type':Sequelize[_0xdf11('0xa')]},'sPositive':{'type':Sequelize[_0xdf11('0xe')]},'sNegative':{'type':Sequelize[_0xdf11('0xe')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0xdf11('0xe')]},'tempSentiment':{'type':Sequelize[_0xdf11('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xdf11('0x4')]('createdAt'))[_0xdf11('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xdf11('0x11')]();}},'updatedAt':{'type':Sequelize[_0xdf11('0x12')],'get':function(){return moment(this[_0xdf11('0x4')](_0xdf11('0x13')))[_0xdf11('0x10')](_0xdf11('0x14'))[_0xdf11('0x11')]();}}}; \ No newline at end of file +var _0x641a=['split','INTEGER','NEW','TEXT','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','getDataValue','sequelize','moment','exports','STRING','membername'];(function(_0x4e657c,_0x1bd3e3){var _0x17bb5a=function(_0x55ecc1){while(--_0x55ecc1){_0x4e657c['push'](_0x4e657c['shift']());}};_0x17bb5a(++_0x1bd3e3);}(_0x641a,0x12b));var _0xa641=function(_0x3ee361,_0x244c67){_0x3ee361=_0x3ee361-0x0;var _0x32a3d0=_0x641a[_0x3ee361];return _0x32a3d0;};'use strict';var Sequelize=require(_0xa641('0x0'));var moment=require(_0xa641('0x1'));var path=require('path');module[_0xa641('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path['extname'](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa641('0x3')],'set':function(_0x5593cf){if(_0x5593cf){this['setDataValue']('channel',_0x5593cf);this['setDataValue'](_0xa641('0x4'),_0x5593cf[_0xa641('0x5')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xa641('0x3')]},'calleridnum':{'type':Sequelize[_0xa641('0x3')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa641('0x3')]},'connectedlinename':{'type':Sequelize[_0xa641('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa641('0x3')]},'exten':{'type':Sequelize[_0xa641('0x3')]},'value':{'type':Sequelize[_0xa641('0x3')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xa641('0x6')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa641('0x3')]},'userDisposition':{'type':Sequelize[_0xa641('0x3')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xa641('0x3')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xa641('0x7')},'fileUri':{'type':Sequelize[_0xa641('0x8')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xa641('0x8')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xa641('0x9')]},'sNeutral':{'type':Sequelize[_0xa641('0x9')]},'sMixed':{'type':Sequelize[_0xa641('0x9')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xa641('0xa')],'get':function(){return moment(this['getDataValue'](_0xa641('0xb')))[_0xa641('0xc')](_0xa641('0xd'))[_0xa641('0xe')]();}},'updatedAt':{'type':Sequelize[_0xa641('0xa')],'get':function(){return moment(this[_0xa641('0xf')]('updatedAt'))[_0xa641('0xc')](_0xa641('0xd'))[_0xa641('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index e796dd6..5c1cfe5 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 _0x3e7c=['fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','File:\x20\x22','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5991d7,_0x3ca7f8){var _0x5b299d=function(_0x358ddf){while(--_0x358ddf){_0x5991d7['push'](_0x5991d7['shift']());}};_0x5b299d(++_0x3ca7f8);}(_0x3e7c,0x1d6));var _0xc3e7=function(_0x558bc1,_0x858d32){_0x558bc1=_0x558bc1-0x0;var _0x225145=_0x3e7c[_0x558bc1];return _0x225145;};'use strict';var pdf=require(_0xc3e7('0x0'));var emlformat=require(_0xc3e7('0x1'));var rimraf=require(_0xc3e7('0x2'));var zipdir=require(_0xc3e7('0x3'));var jsonpatch=require(_0xc3e7('0x4'));var rp=require('request-promise');var moment=require(_0xc3e7('0x5'));var BPromise=require(_0xc3e7('0x6'));var Mustache=require(_0xc3e7('0x7'));var util=require('util');var path=require(_0xc3e7('0x8'));var sox=require(_0xc3e7('0x9'));var csv=require(_0xc3e7('0xa'));var ejs=require(_0xc3e7('0xb'));var fs=require('fs');var _=require(_0xc3e7('0xc'));var squel=require(_0xc3e7('0xd'));var crypto=require('crypto');var jsforce=require(_0xc3e7('0xe'));var deskjs=require(_0xc3e7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3e7('0x10'));var Papa=require(_0xc3e7('0x11'));var AWS=require(_0xc3e7('0x12'));var uuidv4=require(_0xc3e7('0x13'));var Redis=require(_0xc3e7('0x14'));var authService=require(_0xc3e7('0x15'));var qs=require(_0xc3e7('0x16'));var as=require(_0xc3e7('0x17'));var hardwareService=require(_0xc3e7('0x18'));var logger=require(_0xc3e7('0x19'))(_0xc3e7('0x1a'));var utils=require(_0xc3e7('0x1b'));var config=require(_0xc3e7('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4df160,_0x444d37){_0x444d37=_0x444d37||0xcc;return function(_0x1e11cd){if(_0x1e11cd){return _0x4df160[_0xc3e7('0x1d')](_0x444d37);}return _0x4df160['status'](_0x444d37)[_0xc3e7('0x1e')]();};}function respondWithResult(_0x353514,_0x6aa823){_0x6aa823=_0x6aa823||0xc8;return function(_0x5a7cfc){if(_0x5a7cfc){return _0x353514[_0xc3e7('0x1f')](_0x6aa823)['json'](_0x5a7cfc);}};}function respondWithFilteredResult(_0x5eb941,_0x18e129){return function(_0x4b3911){if(_0x4b3911){var _0x22b8f8=_0x4b3911['count'],_0x900450=_0x18e129['offset'],_0x12496b=_0x18e129[_0xc3e7('0x20')]+_0x18e129[_0xc3e7('0x21')],_0x38f156;if(_0x12496b>=_0x22b8f8){_0x12496b=_0x22b8f8;_0x38f156=0xc8;}else{_0x38f156=0xce;}_0x5eb941[_0xc3e7('0x1f')](_0x38f156);return _0x5eb941[_0xc3e7('0x22')](_0xc3e7('0x23'),_0x900450+'-'+_0x12496b+'/'+_0x22b8f8)[_0xc3e7('0x24')](_0x4b3911);}return null;};}function patchUpdates(_0x4c51b0){return function(_0xbe56d3){try{jsonpatch[_0xc3e7('0x25')](_0xbe56d3,_0x4c51b0,!![]);}catch(_0x5f45d9){return BPromise[_0xc3e7('0x26')](_0x5f45d9);}return _0xbe56d3['save']();};}function saveUpdates(_0x337552,_0x17c141){return function(_0x47dbeb){if(_0x47dbeb){return _0x47dbeb[_0xc3e7('0x27')](_0x337552)[_0xc3e7('0x28')](function(_0x4b7401){return _0x4b7401;});}return null;};}function removeEntity(_0x199ea0,_0x5391ff){return function(_0x568994){if(_0x568994){return _0x568994[_0xc3e7('0x29')]()[_0xc3e7('0x28')](function(){_0x199ea0['status'](0xcc)[_0xc3e7('0x1e')]();});}};}function handleEntityNotFound(_0x5f5b91,_0x204166){return function(_0x1142fc){if(!_0x1142fc){_0x5f5b91[_0xc3e7('0x1d')](0x194);}return _0x1142fc;};}function handleError(_0x5c3777,_0x458377){_0x458377=_0x458377||0x1f4;return function(_0x4803a8){logger['error'](_0x4803a8[_0xc3e7('0x2a')]);if(_0x4803a8[_0xc3e7('0x2b')]){delete _0x4803a8[_0xc3e7('0x2b')];}_0x5c3777['status'](_0x458377)[_0xc3e7('0x2c')](_0x4803a8);};}exports[_0xc3e7('0x2d')]=function(_0x47f267,_0x36c5cc){var _0x395437={},_0x1e856e={},_0x30b994={'count':0x0,'rows':[]};var _0x365c9b=_[_0xc3e7('0x2e')](db[_0xc3e7('0x2f')][_0xc3e7('0x30')],function(_0x5f32ec){return{'name':_0x5f32ec['fieldName'],'type':_0x5f32ec[_0xc3e7('0x31')][_0xc3e7('0x32')]};});_0x1e856e[_0xc3e7('0x33')]=_[_0xc3e7('0x34')](_['map'](_0x365c9b,_0xc3e7('0x2b')),[_0xc3e7('0x35')]);_0x1e856e['query']=_[_0xc3e7('0x36')](_0x47f267[_0xc3e7('0x37')]);_0x1e856e[_0xc3e7('0x38')]=_[_0xc3e7('0x39')](_0x1e856e[_0xc3e7('0x33')],_0x1e856e[_0xc3e7('0x37')]);_0x395437[_0xc3e7('0x3a')]=_[_0xc3e7('0x39')](_0x1e856e['model'],qs[_0xc3e7('0x3b')](_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x3b')]));_0x395437['attributes']=_0x395437[_0xc3e7('0x3a')][_0xc3e7('0x3c')]?_0x395437[_0xc3e7('0x3a')]:_0x1e856e[_0xc3e7('0x33')];if(!_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x3d')](_0xc3e7('0x3e'))){_0x395437[_0xc3e7('0x21')]=qs['limit'](_0x47f267['query']['limit']);_0x395437[_0xc3e7('0x20')]=qs[_0xc3e7('0x20')](_0x47f267['query'][_0xc3e7('0x20')]);}_0x395437[_0xc3e7('0x3f')]=qs[_0xc3e7('0x40')](_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x40')]);_0x395437['where']=qs[_0xc3e7('0x38')](_[_0xc3e7('0x41')](_0x47f267[_0xc3e7('0x37')],_0x1e856e[_0xc3e7('0x38')]),_0x365c9b);if(_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x42')]){_0x395437[_0xc3e7('0x43')]=_[_0xc3e7('0x44')](_0x395437[_0xc3e7('0x43')],{'$or':_[_0xc3e7('0x2e')](_0x365c9b,function(_0x504eea){if(_0x504eea[_0xc3e7('0x31')]!=='VIRTUAL'){var _0x4ff29e={};_0x4ff29e[_0x504eea[_0xc3e7('0x2b')]]={'$like':'%'+_0x47f267[_0xc3e7('0x37')][_0xc3e7('0x42')]+'%'};return _0x4ff29e;}})});}_0x395437=_[_0xc3e7('0x44')]({},_0x395437,_0x47f267[_0xc3e7('0x45')]);var _0x6ceeef={'where':_0x395437['where']};return db[_0xc3e7('0x2f')][_0xc3e7('0x46')](_0x6ceeef)[_0xc3e7('0x28')](function(_0x2f22dd){_0x30b994[_0xc3e7('0x46')]=_0x2f22dd;if(_0x47f267['query'][_0xc3e7('0x47')]){_0x395437['include']=[{'all':!![]}];}return db[_0xc3e7('0x2f')][_0xc3e7('0x48')](_0x395437);})[_0xc3e7('0x28')](function(_0x3e11b0){_0x30b994[_0xc3e7('0x49')]=_0x3e11b0;return _0x30b994;})[_0xc3e7('0x28')](respondWithFilteredResult(_0x36c5cc,_0x395437))[_0xc3e7('0x4a')](handleError(_0x36c5cc,null));};exports[_0xc3e7('0x4b')]=function(_0x22243c,_0xe43378){var _0x25963b={'raw':![],'where':{'id':_0x22243c[_0xc3e7('0x4c')]['id']}},_0x54fbd3={};_0x54fbd3[_0xc3e7('0x33')]=_['keys'](db['VoiceRecording'][_0xc3e7('0x30')]);_0x54fbd3[_0xc3e7('0x37')]=_[_0xc3e7('0x36')](_0x22243c['query']);_0x54fbd3['filters']=_[_0xc3e7('0x39')](_0x54fbd3[_0xc3e7('0x33')],_0x54fbd3[_0xc3e7('0x37')]);_0x25963b[_0xc3e7('0x3a')]=_['intersection'](_0x54fbd3['model'],qs[_0xc3e7('0x3b')](_0x22243c[_0xc3e7('0x37')][_0xc3e7('0x3b')]));_0x25963b[_0xc3e7('0x3a')]=_0x25963b[_0xc3e7('0x3a')][_0xc3e7('0x3c')]?_0x25963b[_0xc3e7('0x3a')]:_0x54fbd3[_0xc3e7('0x33')];if(_0x22243c[_0xc3e7('0x37')][_0xc3e7('0x47')]){_0x25963b[_0xc3e7('0x4d')]=[{'all':!![]}];}_0x25963b=_[_0xc3e7('0x44')]({},_0x25963b,_0x22243c[_0xc3e7('0x45')]);return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')](_0x25963b)[_0xc3e7('0x28')](handleEntityNotFound(_0xe43378,null))['then'](respondWithResult(_0xe43378,null))[_0xc3e7('0x4a')](handleError(_0xe43378,null));};exports[_0xc3e7('0x4f')]=function(_0x4a3d84,_0x52b900){return db[_0xc3e7('0x2f')][_0xc3e7('0x4f')](_0x4a3d84['body'],{})[_0xc3e7('0x28')](respondWithResult(_0x52b900,0xc9))[_0xc3e7('0x4a')](handleError(_0x52b900,null));};exports[_0xc3e7('0x27')]=function(_0x33c734,_0x3e8100){if(_0x33c734[_0xc3e7('0x50')]['id']){delete _0x33c734[_0xc3e7('0x50')]['id'];}return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')]({'where':{'id':_0x33c734[_0xc3e7('0x4c')]['id']}})[_0xc3e7('0x28')](handleEntityNotFound(_0x3e8100,null))['then'](saveUpdates(_0x33c734[_0xc3e7('0x50')],null))['then'](respondWithResult(_0x3e8100,null))[_0xc3e7('0x4a')](handleError(_0x3e8100,null));};exports[_0xc3e7('0x51')]=function(_0x267b96,_0x2c8002){return db[_0xc3e7('0x2f')]['describe']()[_0xc3e7('0x28')](respondWithResult(_0x2c8002,null))[_0xc3e7('0x4a')](handleError(_0x2c8002,null));};exports[_0xc3e7('0x52')]=function(_0x56c6d1,_0x42bf0b,_0x3b2822){var _0x1dd009=require(_0xc3e7('0x53'));var _0x4d1d90=![];var _0xc3624c={};if(_0x56c6d1['query'][_0xc3e7('0x31')]&&_0x56c6d1['query'][_0xc3e7('0x31')]===_0xc3e7('0x54')){_0xc3624c[_0xc3e7('0x54')]=_0x56c6d1[_0xc3e7('0x4c')]['id'];}else{_0xc3624c['id']=_0x56c6d1[_0xc3e7('0x4c')]['id'];}return db[_0xc3e7('0x2f')]['find']({'where':_0xc3624c,'attributes':['id',_0xc3e7('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x42bf0b,null))[_0xc3e7('0x28')](function(_0x507a34){if(_0x507a34){var _0x3c1d9a=_0x507a34['value'];var _0x1d4ccb=util[_0xc3e7('0x35')](_0xc3e7('0x56'),_0x3c1d9a);if(fs[_0xc3e7('0x57')](_0x1d4ccb)){_0x4d1d90=!![];return _0x1dd009[_0xc3e7('0x58')](_0x1d4ccb,_0x3c1d9a,config[_0xc3e7('0x59')][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x507a34;});}return _0x507a34;}})[_0xc3e7('0x28')](function(_0x4436a5){if(_0x4436a5){var _0x1e7bb3=_0x4436a5[_0xc3e7('0x55')];if(!fs[_0xc3e7('0x57')](_0x1e7bb3)){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))](_0xc3e7('0x5d'));}if(_0x4436a5[_0xc3e7('0x5e')]){return _0x42bf0b[_0xc3e7('0x52')](_0x1e7bb3,_0x4436a5[_0xc3e7('0x5e')]+path[_0xc3e7('0x5f')](_0x1e7bb3),function(){if(_0x4d1d90){fs[_0xc3e7('0x60')](_0x1e7bb3);}});}else{return _0x42bf0b['download'](_0x1e7bb3,function(_0x3d69f1){if(_0x4d1d90){fs['unlink'](_0x1e7bb3);}});}}})[_0xc3e7('0x4a')](function(_0x461291){if(_0x461291[_0xc3e7('0x61')]===_0xc3e7('0x5d')){_0x42bf0b['status'](0x194)[_0xc3e7('0x2c')](_0xc3e7('0x62'));}else{return handleError(_0x42bf0b,null);}});};exports[_0xc3e7('0x63')]=function(_0x3cbfa2,_0xfea910,_0x51323b){var _0xed5d88=require(_0xc3e7('0x53'));var _0x588037=![];var _0x4bde47={'$and':[db[_0xc3e7('0x64')][_0xc3e7('0x43')](db[_0xc3e7('0x64')]['fn'](_0xc3e7('0x65'),db['sequelize'][_0xc3e7('0x66')](_0xc3e7('0x54'))),_0x3cbfa2['query']['token'])]};if(_0x3cbfa2['query'][_0xc3e7('0x31')]&&_0x3cbfa2['query'][_0xc3e7('0x31')]==='uniqueid'){_0x4bde47[_0xc3e7('0x67')][_0xc3e7('0x68')]({'uniqueid':_0x3cbfa2[_0xc3e7('0x4c')]['id']});}else{_0x4bde47['$and'][_0xc3e7('0x68')]({'id':_0x3cbfa2[_0xc3e7('0x4c')]['id']});}return db['VoiceRecording'][_0xc3e7('0x4e')]({'where':_0x4bde47,'attributes':['id','value'],'raw':!![]})[_0xc3e7('0x28')](handleEntityNotFound(_0xfea910,null))[_0xc3e7('0x28')](function(_0x70b1d5){if(_0x70b1d5){var _0x4150a7=util[_0xc3e7('0x35')](_0xc3e7('0x56'),_0x70b1d5['value']);if(fs[_0xc3e7('0x57')](_0x4150a7)){_0x588037=!![];return _0xed5d88[_0xc3e7('0x58')](_0x4150a7,_0x70b1d5[_0xc3e7('0x55')],config['secrets'][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x70b1d5;});}return _0x70b1d5;}})[_0xc3e7('0x28')](function(_0x215847){if(_0x215847){if(!fs[_0xc3e7('0x57')](_0x215847['value'])){throw new db['Sequelize'][(_0xc3e7('0x5c'))](_0xc3e7('0x5d'));}if(_0x215847[_0xc3e7('0x5e')]){return _0xfea910['download'](_0x215847[_0xc3e7('0x55')],_0x215847[_0xc3e7('0x5e')]+path['extname'](_0x215847[_0xc3e7('0x55')]),function(){if(_0x588037){fs['unlink'](_0x215847[_0xc3e7('0x55')]);}});}else{return _0xfea910['download'](_0x215847[_0xc3e7('0x55')],function(_0x24d31c){if(_0x588037){fs[_0xc3e7('0x60')](_0x215847[_0xc3e7('0x55')]);}});}}})['catch'](handleError(_0xfea910,null));};exports[_0xc3e7('0x29')]=function(_0x47cb30,_0x3c5262){return db[_0xc3e7('0x2f')][_0xc3e7('0x4e')]({'where':{'id':_0x47cb30['params']['id']}})[_0xc3e7('0x28')](function(_0x3b0f33){if(!_0x3b0f33)throw new ReferenceError('Entity\x20not\x20found');return _0x3b0f33;})[_0xc3e7('0x28')](function(_0x23b5f1){var _0x3407be=_0x23b5f1[_0xc3e7('0x55')];logger[_0xc3e7('0x69')](_0xc3e7('0x6a'),_0x3407be);if(!_[_0xc3e7('0x6b')](_0x23b5f1['value'])&&fs[_0xc3e7('0x57')](_0x3407be)){logger['info']('File:\x20\x22'+_0x3407be+_0xc3e7('0x6c'));fs['unlinkSync'](_0x3407be);}_0x3407be=_0x3407be+'.cypher';if(!_[_0xc3e7('0x6b')](_0x23b5f1[_0xc3e7('0x55')])&&fs[_0xc3e7('0x57')](_0x3407be)){logger[_0xc3e7('0x69')](_0xc3e7('0x6d')+_0x3407be+_0xc3e7('0x6c'));fs[_0xc3e7('0x6e')](_0x3407be);}return _0x23b5f1;})[_0xc3e7('0x28')](function(_0x1a756d){if(!_0x1a756d)throw new InternalError();return _0x1a756d[_0xc3e7('0x29')]();})['then'](function(){_0x3c5262[_0xc3e7('0x1f')](0xcc)[_0xc3e7('0x1e')]();})[_0xc3e7('0x4a')](handleError(_0x3c5262,null));};function getBucketslist(_0x2c6fee,_0x17eff8,_0x3eb4f6){return new Promise(function(_0x3eaa6e,_0x43d95c){var _0x4d5c85=new AWS['S3']({'accessKeyId':_0x17eff8,'secretAccessKey':_0x2c6fee,'region':_0x3eb4f6});_0x4d5c85[_0xc3e7('0x6f')]({},function(_0x507982,_0x1aa80b){if(_0x507982){return _0x43d95c(_0x507982);}else{return _0x3eaa6e(_0x1aa80b);}});});}function createBucket(_0x1f2fe7,_0x52bbcf,_0x110c0a,_0x4cf6bd){return new Promise(function(_0x5d224d,_0x78b1f6){var _0x3fcd97=new AWS['S3']({'accessKeyId':_0x52bbcf,'secretAccessKey':_0x1f2fe7,'region':_0x110c0a});_0x3fcd97[_0xc3e7('0x70')]({'Bucket':_0x4cf6bd},function(_0x3fa814,_0x3d70a4){if(_0x3fa814){return _0x78b1f6(_0x3fa814);}else{return _0x5d224d(_0x3d70a4);}});});}function uploadFile(_0x5b09d2,_0x549cf5,_0x13f4cd,_0x22c90c,_0x4108d2,_0x4a1ae4){return new Promise(function(_0x35ef2f,_0x6d4a9b){var _0x4da274=new AWS['S3']({'accessKeyId':_0x549cf5,'secretAccessKey':_0x5b09d2,'region':_0x13f4cd});_0x4da274[_0xc3e7('0x71')]({'Bucket':_0x22c90c,'Key':_0x4108d2,'Body':_0x4a1ae4},function(_0x27f7e9,_0x5ae3e8){if(_0x27f7e9){return _0x6d4a9b(_0x27f7e9);}else{return _0x35ef2f(_0x5ae3e8);}});});}function startTranscribe(_0x85b6bf,_0x152f95,_0x50fab8,_0x5b41a8,_0x4a86eb,_0x4f44cd){return new Promise(function(_0x3adac1,_0x5d300b){var _0x45dcd6=new AWS[(_0xc3e7('0x72'))]({'accessKeyId':_0x152f95,'secretAccessKey':_0x85b6bf,'region':_0x50fab8});_0x45dcd6[_0xc3e7('0x73')]({'TranscriptionJobName':_0x5b41a8,'LanguageCode':_0x4a86eb,'Media':{'MediaFileUri':_0x4f44cd}},function(_0x40e726,_0x2e14ac){if(_0x40e726){return _0x5d300b(_0x40e726);}else{return _0x3adac1(_0x2e14ac);}});});}function transcribe(_0x5b348b,_0x116442,_0x10eedc,_0x15bdcd,_0x5b23cd,_0x56e0f8,_0x49437a){return new Promise(function(_0x27026d,_0x359c42){var _0x869a4b={};logger[_0xc3e7('0x69')](util['format'](_0xc3e7('0x74'),_0x5b348b,_0x5b23cd));return uploadFile(_0x116442,_0x10eedc,_0x15bdcd,_0x5b23cd,path[_0xc3e7('0x75')](_0x56e0f8),fs[_0xc3e7('0x76')](_0x56e0f8))['then'](function(_0x53d9c3){logger[_0xc3e7('0x69')](util['format'](_0xc3e7('0x77'),_0x5b348b,_0x5b23cd,_0x53d9c3[_0xc3e7('0x78')]));_0x869a4b[_0xc3e7('0x79')]=_0x53d9c3['Bucket'];_0x869a4b[_0xc3e7('0x7a')]=_0x53d9c3[_0xc3e7('0x78')];logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x7b'),_0x5b348b));return startTranscribe(_0x116442,_0x10eedc,_0x15bdcd,uuidv4(),_0x49437a,_0x53d9c3[_0xc3e7('0x78')]);})[_0xc3e7('0x28')](function(_0x2a9531){logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x7c'),_0x5b348b,_0x2a9531[_0xc3e7('0x7d')][_0xc3e7('0x7e')]));_0x869a4b[_0xc3e7('0x7f')]=_0x2a9531[_0xc3e7('0x7d')][_0xc3e7('0x7e')];_0x869a4b[_0xc3e7('0x80')]=_0x2a9531[_0xc3e7('0x7d')]['TranscriptionJobStatus'];return _0x27026d(_0x869a4b);})['catch'](function(_0x5f7479){return _0x359c42(_0x5f7479);});});}exports[_0xc3e7('0x81')]=function(_0x4281a4,_0x152829,_0x431774){var _0x3d1997;var _0x1e81d9;var _0xd2e3c9;var _0x46cf88=require(_0xc3e7('0x53'));return db[_0xc3e7('0x2f')]['findOne']({'where':{'id':_0x4281a4[_0xc3e7('0x4c')]['id']}})[_0xc3e7('0x28')](function(_0x4868eb){if(_0x4868eb){var _0x3f6153=util['format'](_0xc3e7('0x56'),_0x4868eb[_0xc3e7('0x55')]);if(fs[_0xc3e7('0x57')](_0x3f6153)){cypher=!![];return _0x46cf88['decryptFile'](_0x3f6153,_0x4868eb[_0xc3e7('0x55')],config[_0xc3e7('0x59')][_0xc3e7('0x5a')])[_0xc3e7('0x28')](function(){return _0x4868eb;});}return _0x4868eb;}})[_0xc3e7('0x28')](function(_0x49c9b2){if(!_0x49c9b2){throw new db['Sequelize']['ValidationError'](_0xc3e7('0x82'));}_0x1e81d9=_0x49c9b2;return db[_0xc3e7('0x83')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x152829,null))[_0xc3e7('0x28')](function(_0x41ee63){if(_0x41ee63){_0x3d1997=_0x41ee63;if(!_0x3d1997[_0xc3e7('0x84')]||!_0x3d1997['transcribeAccountId']||!_0x3d1997[_0xc3e7('0x85')]||!_0x3d1997['language']||!_0x3d1997['bucket']){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))](_0xc3e7('0x86'));}if(_0x4281a4[_0xc3e7('0x50')][_0xc3e7('0x87')]&&(!_0x3d1997[_0xc3e7('0x88')]||!_0x3d1997[_0xc3e7('0x89')]||!_0x3d1997[_0xc3e7('0x8a')]||!_0x3d1997[_0xc3e7('0x8b')]||!_0x3d1997[_0xc3e7('0x79')])){throw new db[(_0xc3e7('0x5b'))][(_0xc3e7('0x5c'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xc3e7('0x8c')]['findOne']({'where':{'id':_0x3d1997['transcribeAccountId']}});}})['then'](function(_0x24aa44){if(!_0x24aa44){throw new db['Sequelize'][(_0xc3e7('0x5c'))](_0xc3e7('0x8d'));}if(!_0x24aa44[_0xc3e7('0x8e')]||!_0x24aa44[_0xc3e7('0x8f')]){throw new db['Sequelize']['ValidationError'](_0xc3e7('0x90'));}_0xd2e3c9=_0x24aa44;return getBucketslist(_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9['data2'],_0x3d1997[_0xc3e7('0x85')]);})[_0xc3e7('0x28')](function(_0x12c647){if(_0x12c647&&_0x12c647[_0xc3e7('0x91')]){var _0x351d3a=_[_0xc3e7('0x4e')](_0x12c647['Buckets'],function(_0x21c12f){return _0x21c12f[_0xc3e7('0x92')]===_0x3d1997['bucket'];});if(!_0x351d3a){logger[_0xc3e7('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4281a4[_0xc3e7('0x4c')]['id'],_0x3d1997[_0xc3e7('0x79')]));return createBucket(_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9['data2'],_0x3d1997[_0xc3e7('0x85')],_0x3d1997[_0xc3e7('0x79')]);}logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x93'),_0x4281a4[_0xc3e7('0x4c')]['id'],_0x3d1997[_0xc3e7('0x79')]));return;}})['then'](function(_0x111063){if(_0x1e81d9['transcribeStatus']==='NEW'){return transcribe(_0x4281a4[_0xc3e7('0x4c')]['id'],_0xd2e3c9[_0xc3e7('0x8e')],_0xd2e3c9[_0xc3e7('0x8f')],_0x3d1997[_0xc3e7('0x85')],_0x3d1997[_0xc3e7('0x79')],_0x1e81d9[_0xc3e7('0x55')],_0x3d1997[_0xc3e7('0x8b')]);}else{logger[_0xc3e7('0x69')](util[_0xc3e7('0x35')](_0xc3e7('0x94'),_0x4281a4[_0xc3e7('0x4c')]['id']));return{'transcribeStatus':_0xc3e7('0x95')};}})[_0xc3e7('0x28')](function(_0x524e19){if(_0x524e19){_0x524e19[_0xc3e7('0x96')]=_0x4281a4[_0xc3e7('0x50')][_0xc3e7('0x87')];return _0x1e81d9['updateAttributes'](_0x524e19);}})['then'](respondWithResult(_0x152829,null))[_0xc3e7('0x4a')](handleError(_0x152829,null));};function writeFile(_0xffdd43,_0x382083){return new Promise(function(_0x1e1ce0,_0x41697e){fs[_0xc3e7('0x97')](_0x382083,_0xffdd43,function(_0x4af128,_0x48b650){if(_0x4af128){return _0x41697e(_0x4af128);}else{return _0x1e1ce0(_0x48b650);}});});}exports[_0xc3e7('0x98')]=function(_0x40ab8b,_0x172aa4,_0x2ee076){return db['VoiceRecording'][_0xc3e7('0x99')]({'where':{'id':_0x40ab8b[_0xc3e7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x172aa4))[_0xc3e7('0x28')](function(_0x1ccaf5){if(_0x1ccaf5&&_0x1ccaf5[_0xc3e7('0x9a')]){var _0x10b315=_0x1ccaf5[_0xc3e7('0x9a')];var _0x527c26=config[_0xc3e7('0x9b')]+_0xc3e7('0x9c')+_0x1ccaf5['id']+_0xc3e7('0x9d');if(fs['existsSync'](_0x527c26)){return _0x527c26;}return writeFile(_0x10b315,_0x527c26)[_0xc3e7('0x28')](function(){return _0x527c26;});}else{throw new db['Sequelize'][(_0xc3e7('0x5c'))]('Transcript\x20not\x20available');}})['then'](function(_0x5958ee){return _0x172aa4[_0xc3e7('0x52')](_0x5958ee);})[_0xc3e7('0x4a')](handleError(_0x172aa4));}; \ No newline at end of file +var _0xad67=['transcribeAccountId','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceRecording','fieldName','type','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','catch','params','rawAttributes','includeAll','find','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','sequelize','MD5','col','$and','push','Sequelize','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider'];(function(_0x19b581,_0x4bdf42){var _0x49c2eb=function(_0x3166bd){while(--_0x3166bd){_0x19b581['push'](_0x19b581['shift']());}};_0x49c2eb(++_0x4bdf42);}(_0xad67,0x13d));var _0x7ad6=function(_0x13eea8,_0x5ed8b2){_0x13eea8=_0x13eea8-0x0;var _0x255a29=_0xad67[_0x13eea8];return _0x255a29;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ad6('0x0'));var rimraf=require(_0x7ad6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad6('0x2'));var rp=require(_0x7ad6('0x3'));var moment=require(_0x7ad6('0x4'));var BPromise=require(_0x7ad6('0x5'));var Mustache=require(_0x7ad6('0x6'));var util=require(_0x7ad6('0x7'));var path=require('path');var sox=require(_0x7ad6('0x8'));var csv=require(_0x7ad6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ad6('0xa'));var squel=require(_0x7ad6('0xb'));var crypto=require(_0x7ad6('0xc'));var jsforce=require(_0x7ad6('0xd'));var deskjs=require(_0x7ad6('0xe'));var toCsv=require(_0x7ad6('0x9'));var querystring=require(_0x7ad6('0xf'));var Papa=require(_0x7ad6('0x10'));var AWS=require(_0x7ad6('0x11'));var uuidv4=require(_0x7ad6('0x12'));var Redis=require(_0x7ad6('0x13'));var authService=require(_0x7ad6('0x14'));var qs=require(_0x7ad6('0x15'));var as=require(_0x7ad6('0x16'));var hardwareService=require(_0x7ad6('0x17'));var logger=require(_0x7ad6('0x18'))(_0x7ad6('0x19'));var utils=require(_0x7ad6('0x1a'));var config=require(_0x7ad6('0x1b'));var db=require(_0x7ad6('0x1c'))['db'];function respondWithStatusCode(_0x42dffd,_0x10a223){_0x10a223=_0x10a223||0xcc;return function(_0x45bf3e){if(_0x45bf3e){return _0x42dffd[_0x7ad6('0x1d')](_0x10a223);}return _0x42dffd[_0x7ad6('0x1e')](_0x10a223)[_0x7ad6('0x1f')]();};}function respondWithResult(_0x16cde8,_0x24b1ef){_0x24b1ef=_0x24b1ef||0xc8;return function(_0x50a9af){if(_0x50a9af){return _0x16cde8['status'](_0x24b1ef)[_0x7ad6('0x20')](_0x50a9af);}};}function respondWithFilteredResult(_0x169769,_0x41d2d5){return function(_0x3041ca){if(_0x3041ca){var _0xb0faf0=_0x3041ca[_0x7ad6('0x21')],_0x1ebb42=_0x41d2d5[_0x7ad6('0x22')],_0x151d7a=_0x41d2d5['offset']+_0x41d2d5[_0x7ad6('0x23')],_0x2e4415;if(_0x151d7a>=_0xb0faf0){_0x151d7a=_0xb0faf0;_0x2e4415=0xc8;}else{_0x2e4415=0xce;}_0x169769[_0x7ad6('0x1e')](_0x2e4415);return _0x169769[_0x7ad6('0x24')](_0x7ad6('0x25'),_0x1ebb42+'-'+_0x151d7a+'/'+_0xb0faf0)[_0x7ad6('0x20')](_0x3041ca);}return null;};}function patchUpdates(_0x198b76){return function(_0xfaa14){try{jsonpatch[_0x7ad6('0x26')](_0xfaa14,_0x198b76,!![]);}catch(_0xe984d2){return BPromise[_0x7ad6('0x27')](_0xe984d2);}return _0xfaa14[_0x7ad6('0x28')]();};}function saveUpdates(_0xa700ae,_0x291100){return function(_0x4f5785){if(_0x4f5785){return _0x4f5785[_0x7ad6('0x29')](_0xa700ae)[_0x7ad6('0x2a')](function(_0x48fdd1){return _0x48fdd1;});}return null;};}function removeEntity(_0x107405,_0x57fd11){return function(_0x415ac5){if(_0x415ac5){return _0x415ac5[_0x7ad6('0x2b')]()[_0x7ad6('0x2a')](function(){_0x107405[_0x7ad6('0x1e')](0xcc)[_0x7ad6('0x1f')]();});}};}function handleEntityNotFound(_0x3ce756,_0x5c022e){return function(_0x43fcd5){if(!_0x43fcd5){_0x3ce756['sendStatus'](0x194);}return _0x43fcd5;};}function handleError(_0x311a8b,_0x586d22){_0x586d22=_0x586d22||0x1f4;return function(_0x366df9){logger['error'](_0x366df9[_0x7ad6('0x2c')]);if(_0x366df9[_0x7ad6('0x2d')]){delete _0x366df9[_0x7ad6('0x2d')];}_0x311a8b['status'](_0x586d22)[_0x7ad6('0x2e')](_0x366df9);};}exports[_0x7ad6('0x2f')]=function(_0x1f6f40,_0x2ff60e){var _0x4d6e8d={},_0x1b3cd4={},_0x4d484a={'count':0x0,'rows':[]};var _0x196ddf=_[_0x7ad6('0x30')](db[_0x7ad6('0x31')]['rawAttributes'],function(_0x141a14){return{'name':_0x141a14[_0x7ad6('0x32')],'type':_0x141a14[_0x7ad6('0x33')]['key']};});_0x1b3cd4[_0x7ad6('0x34')]=_[_0x7ad6('0x35')](_[_0x7ad6('0x30')](_0x196ddf,_0x7ad6('0x2d')),[_0x7ad6('0x36')]);_0x1b3cd4[_0x7ad6('0x37')]=_['keys'](_0x1f6f40[_0x7ad6('0x37')]);_0x1b3cd4[_0x7ad6('0x38')]=_['intersection'](_0x1b3cd4['model'],_0x1b3cd4[_0x7ad6('0x37')]);_0x4d6e8d['attributes']=_[_0x7ad6('0x39')](_0x1b3cd4[_0x7ad6('0x34')],qs[_0x7ad6('0x3a')](_0x1f6f40[_0x7ad6('0x37')]['fields']));_0x4d6e8d[_0x7ad6('0x3b')]=_0x4d6e8d[_0x7ad6('0x3b')][_0x7ad6('0x3c')]?_0x4d6e8d[_0x7ad6('0x3b')]:_0x1b3cd4['model'];if(!_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x3d')](_0x7ad6('0x3e'))){_0x4d6e8d[_0x7ad6('0x23')]=qs[_0x7ad6('0x23')](_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x23')]);_0x4d6e8d[_0x7ad6('0x22')]=qs[_0x7ad6('0x22')](_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x22')]);}_0x4d6e8d['order']=qs[_0x7ad6('0x3f')](_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x3f')]);_0x4d6e8d[_0x7ad6('0x40')]=qs[_0x7ad6('0x38')](_[_0x7ad6('0x41')](_0x1f6f40['query'],_0x1b3cd4['filters']),_0x196ddf);if(_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x42')]){_0x4d6e8d[_0x7ad6('0x40')]=_[_0x7ad6('0x43')](_0x4d6e8d['where'],{'$or':_['map'](_0x196ddf,function(_0x44cd43){if(_0x44cd43[_0x7ad6('0x33')]!=='VIRTUAL'){var _0x13bf20={};_0x13bf20[_0x44cd43[_0x7ad6('0x2d')]]={'$like':'%'+_0x1f6f40[_0x7ad6('0x37')][_0x7ad6('0x42')]+'%'};return _0x13bf20;}})});}_0x4d6e8d=_['merge']({},_0x4d6e8d,_0x1f6f40[_0x7ad6('0x44')]);var _0xe2228d={'where':_0x4d6e8d['where']};return db['VoiceRecording']['count'](_0xe2228d)[_0x7ad6('0x2a')](function(_0x173844){_0x4d484a[_0x7ad6('0x21')]=_0x173844;if(_0x1f6f40[_0x7ad6('0x37')]['includeAll']){_0x4d6e8d[_0x7ad6('0x45')]=[{'all':!![]}];}return db[_0x7ad6('0x31')]['findAll'](_0x4d6e8d);})[_0x7ad6('0x2a')](function(_0x1cb74f){_0x4d484a['rows']=_0x1cb74f;return _0x4d484a;})[_0x7ad6('0x2a')](respondWithFilteredResult(_0x2ff60e,_0x4d6e8d))[_0x7ad6('0x46')](handleError(_0x2ff60e,null));};exports['show']=function(_0x2c52a6,_0x75647c){var _0x415e54={'raw':![],'where':{'id':_0x2c52a6[_0x7ad6('0x47')]['id']}},_0x24717e={};_0x24717e[_0x7ad6('0x34')]=_['keys'](db[_0x7ad6('0x31')][_0x7ad6('0x48')]);_0x24717e['query']=_['keys'](_0x2c52a6[_0x7ad6('0x37')]);_0x24717e['filters']=_[_0x7ad6('0x39')](_0x24717e[_0x7ad6('0x34')],_0x24717e[_0x7ad6('0x37')]);_0x415e54[_0x7ad6('0x3b')]=_[_0x7ad6('0x39')](_0x24717e['model'],qs[_0x7ad6('0x3a')](_0x2c52a6[_0x7ad6('0x37')][_0x7ad6('0x3a')]));_0x415e54[_0x7ad6('0x3b')]=_0x415e54[_0x7ad6('0x3b')][_0x7ad6('0x3c')]?_0x415e54['attributes']:_0x24717e['model'];if(_0x2c52a6[_0x7ad6('0x37')][_0x7ad6('0x49')]){_0x415e54[_0x7ad6('0x45')]=[{'all':!![]}];}_0x415e54=_[_0x7ad6('0x43')]({},_0x415e54,_0x2c52a6[_0x7ad6('0x44')]);return db['VoiceRecording'][_0x7ad6('0x4a')](_0x415e54)['then'](handleEntityNotFound(_0x75647c,null))[_0x7ad6('0x2a')](respondWithResult(_0x75647c,null))[_0x7ad6('0x46')](handleError(_0x75647c,null));};exports['create']=function(_0x21c268,_0x286085){return db[_0x7ad6('0x31')]['create'](_0x21c268[_0x7ad6('0x4b')],{})[_0x7ad6('0x2a')](respondWithResult(_0x286085,0xc9))[_0x7ad6('0x46')](handleError(_0x286085,null));};exports[_0x7ad6('0x29')]=function(_0x2a9357,_0x30d8dc){if(_0x2a9357[_0x7ad6('0x4b')]['id']){delete _0x2a9357[_0x7ad6('0x4b')]['id'];}return db[_0x7ad6('0x31')][_0x7ad6('0x4a')]({'where':{'id':_0x2a9357[_0x7ad6('0x47')]['id']}})['then'](handleEntityNotFound(_0x30d8dc,null))['then'](saveUpdates(_0x2a9357[_0x7ad6('0x4b')],null))[_0x7ad6('0x2a')](respondWithResult(_0x30d8dc,null))[_0x7ad6('0x46')](handleError(_0x30d8dc,null));};exports[_0x7ad6('0x4c')]=function(_0x4eca04,_0x271550){return db[_0x7ad6('0x31')][_0x7ad6('0x4c')]()[_0x7ad6('0x2a')](respondWithResult(_0x271550,null))[_0x7ad6('0x46')](handleError(_0x271550,null));};exports[_0x7ad6('0x4d')]=function(_0x1dbb54,_0x50f3f8,_0x4488b0){var _0x4c7254=require(_0x7ad6('0x4e'));var _0x1da630=![];var _0x2ac082={};if(_0x1dbb54[_0x7ad6('0x37')][_0x7ad6('0x33')]&&_0x1dbb54[_0x7ad6('0x37')]['type']===_0x7ad6('0x4f')){_0x2ac082[_0x7ad6('0x4f')]=_0x1dbb54[_0x7ad6('0x47')]['id'];}else{_0x2ac082['id']=_0x1dbb54['params']['id'];}return db['VoiceRecording']['find']({'where':_0x2ac082,'attributes':['id',_0x7ad6('0x50')],'raw':!![]})[_0x7ad6('0x2a')](handleEntityNotFound(_0x50f3f8,null))['then'](function(_0x138504){if(_0x138504){var _0x5506a9=_0x138504['value'];var _0x40b6cc=util[_0x7ad6('0x36')](_0x7ad6('0x51'),_0x5506a9);if(fs[_0x7ad6('0x52')](_0x40b6cc)){_0x1da630=!![];return _0x4c7254[_0x7ad6('0x53')](_0x40b6cc,_0x5506a9,config[_0x7ad6('0x54')][_0x7ad6('0x55')])['then'](function(){return _0x138504;});}return _0x138504;}})[_0x7ad6('0x2a')](function(_0x4f6c2f){if(_0x4f6c2f){var _0x55855f=_0x4f6c2f[_0x7ad6('0x50')];if(!fs['existsSync'](_0x55855f)){throw new db['Sequelize'][(_0x7ad6('0x56'))](_0x7ad6('0x57'));}if(_0x4f6c2f[_0x7ad6('0x58')]){return _0x50f3f8[_0x7ad6('0x4d')](_0x55855f,_0x4f6c2f[_0x7ad6('0x58')]+path[_0x7ad6('0x59')](_0x55855f),function(){if(_0x1da630){fs['unlink'](_0x55855f);}});}else{return _0x50f3f8['download'](_0x55855f,function(_0xeec153){if(_0x1da630){fs[_0x7ad6('0x5a')](_0x55855f);}});}}})['catch'](function(_0x388312){if(_0x388312['message']===_0x7ad6('0x57')){_0x50f3f8[_0x7ad6('0x1e')](0x194)[_0x7ad6('0x2e')]('Not\x20found');}else{return handleError(_0x50f3f8,null);}});};exports[_0x7ad6('0x5b')]=function(_0x22874e,_0x4c5aa9,_0x567263){var _0x5dd364=require(_0x7ad6('0x4e'));var _0x4eee7f=![];var _0x2b701b={'$and':[db[_0x7ad6('0x5c')][_0x7ad6('0x40')](db[_0x7ad6('0x5c')]['fn'](_0x7ad6('0x5d'),db[_0x7ad6('0x5c')][_0x7ad6('0x5e')]('uniqueid')),_0x22874e['query']['token'])]};if(_0x22874e['query']['type']&&_0x22874e[_0x7ad6('0x37')][_0x7ad6('0x33')]===_0x7ad6('0x4f')){_0x2b701b[_0x7ad6('0x5f')]['push']({'uniqueid':_0x22874e[_0x7ad6('0x47')]['id']});}else{_0x2b701b[_0x7ad6('0x5f')][_0x7ad6('0x60')]({'id':_0x22874e[_0x7ad6('0x47')]['id']});}return db[_0x7ad6('0x31')]['find']({'where':_0x2b701b,'attributes':['id','value'],'raw':!![]})[_0x7ad6('0x2a')](handleEntityNotFound(_0x4c5aa9,null))[_0x7ad6('0x2a')](function(_0x7ba254){if(_0x7ba254){var _0x52873f=util[_0x7ad6('0x36')](_0x7ad6('0x51'),_0x7ba254[_0x7ad6('0x50')]);if(fs[_0x7ad6('0x52')](_0x52873f)){_0x4eee7f=!![];return _0x5dd364[_0x7ad6('0x53')](_0x52873f,_0x7ba254[_0x7ad6('0x50')],config[_0x7ad6('0x54')][_0x7ad6('0x55')])[_0x7ad6('0x2a')](function(){return _0x7ba254;});}return _0x7ba254;}})[_0x7ad6('0x2a')](function(_0x3a81bd){if(_0x3a81bd){if(!fs[_0x7ad6('0x52')](_0x3a81bd[_0x7ad6('0x50')])){throw new db[(_0x7ad6('0x61'))]['ValidationError'](_0x7ad6('0x57'));}if(_0x3a81bd['filename']){return _0x4c5aa9[_0x7ad6('0x4d')](_0x3a81bd['value'],_0x3a81bd[_0x7ad6('0x58')]+path[_0x7ad6('0x59')](_0x3a81bd[_0x7ad6('0x50')]),function(){if(_0x4eee7f){fs['unlink'](_0x3a81bd[_0x7ad6('0x50')]);}});}else{return _0x4c5aa9[_0x7ad6('0x4d')](_0x3a81bd[_0x7ad6('0x50')],function(_0x2ea0bf){if(_0x4eee7f){fs['unlink'](_0x3a81bd[_0x7ad6('0x50')]);}});}}})['catch'](handleError(_0x4c5aa9,null));};exports['destroy']=function(_0x2f5dfc,_0x308d1d){return db['VoiceRecording'][_0x7ad6('0x4a')]({'where':{'id':_0x2f5dfc[_0x7ad6('0x47')]['id']}})['then'](function(_0x151ce4){if(!_0x151ce4)throw new ReferenceError('Entity\x20not\x20found');return _0x151ce4;})[_0x7ad6('0x2a')](function(_0x33ce0a){var _0x5ae6fd=_0x33ce0a['value'];logger[_0x7ad6('0x62')](_0x7ad6('0x63'),_0x5ae6fd);if(!_[_0x7ad6('0x64')](_0x33ce0a[_0x7ad6('0x50')])&&fs['existsSync'](_0x5ae6fd)){logger[_0x7ad6('0x62')]('File:\x20\x22'+_0x5ae6fd+_0x7ad6('0x65'));fs['unlinkSync'](_0x5ae6fd);}_0x5ae6fd=_0x5ae6fd+_0x7ad6('0x66');if(!_[_0x7ad6('0x64')](_0x33ce0a['value'])&&fs[_0x7ad6('0x52')](_0x5ae6fd)){logger['info']('File:\x20\x22'+_0x5ae6fd+_0x7ad6('0x65'));fs[_0x7ad6('0x67')](_0x5ae6fd);}return _0x33ce0a;})[_0x7ad6('0x2a')](function(_0x18c487){if(!_0x18c487)throw new InternalError();return _0x18c487[_0x7ad6('0x2b')]();})[_0x7ad6('0x2a')](function(){_0x308d1d['status'](0xcc)['end']();})[_0x7ad6('0x46')](handleError(_0x308d1d,null));};function getBucketslist(_0x184a18,_0x5ea9bf,_0x1a86f9){return new Promise(function(_0x545de4,_0x12c52c){var _0xa33812=new AWS['S3']({'accessKeyId':_0x5ea9bf,'secretAccessKey':_0x184a18,'region':_0x1a86f9});_0xa33812[_0x7ad6('0x68')]({},function(_0x1d377c,_0x36b949){if(_0x1d377c){return _0x12c52c(_0x1d377c);}else{return _0x545de4(_0x36b949);}});});}function createBucket(_0xde1542,_0x456c0a,_0x3463b9,_0x3df433){return new Promise(function(_0x365dd7,_0x5c0183){var _0x123c51=new AWS['S3']({'accessKeyId':_0x456c0a,'secretAccessKey':_0xde1542,'region':_0x3463b9});_0x123c51[_0x7ad6('0x69')]({'Bucket':_0x3df433},function(_0x1dcddf,_0xeda5a6){if(_0x1dcddf){return _0x5c0183(_0x1dcddf);}else{return _0x365dd7(_0xeda5a6);}});});}function uploadFile(_0x419372,_0x2a505b,_0x3ca610,_0x5ba164,_0x4902ed,_0x1c2e03){return new Promise(function(_0x27255b,_0x535bbf){var _0x36bcb6=new AWS['S3']({'accessKeyId':_0x2a505b,'secretAccessKey':_0x419372,'region':_0x3ca610});_0x36bcb6[_0x7ad6('0x6a')]({'Bucket':_0x5ba164,'Key':_0x4902ed,'Body':_0x1c2e03},function(_0x2b1916,_0x287a3a){if(_0x2b1916){return _0x535bbf(_0x2b1916);}else{return _0x27255b(_0x287a3a);}});});}function startTranscribe(_0x5a44d7,_0x1829fd,_0x2ea3bb,_0xcc09ac,_0x380e35,_0x47d013){return new Promise(function(_0x1d14c7,_0x424250){var _0x4fa58d=new AWS[(_0x7ad6('0x6b'))]({'accessKeyId':_0x1829fd,'secretAccessKey':_0x5a44d7,'region':_0x2ea3bb});_0x4fa58d[_0x7ad6('0x6c')]({'TranscriptionJobName':_0xcc09ac,'LanguageCode':_0x380e35,'Media':{'MediaFileUri':_0x47d013}},function(_0x3d7b7b,_0x1ebf6f){if(_0x3d7b7b){return _0x424250(_0x3d7b7b);}else{return _0x1d14c7(_0x1ebf6f);}});});}function transcribe(_0x4a37c4,_0x5af79f,_0x3a2832,_0x24a7f3,_0x26c0cf,_0x1d3c99,_0x12cd75){return new Promise(function(_0x52d125,_0x2597b4){var _0x57cae9={};logger[_0x7ad6('0x62')](util[_0x7ad6('0x36')](_0x7ad6('0x6d'),_0x4a37c4,_0x26c0cf));return uploadFile(_0x5af79f,_0x3a2832,_0x24a7f3,_0x26c0cf,path[_0x7ad6('0x6e')](_0x1d3c99),fs[_0x7ad6('0x6f')](_0x1d3c99))['then'](function(_0x5722d2){logger['info'](util['format'](_0x7ad6('0x70'),_0x4a37c4,_0x26c0cf,_0x5722d2['Location']));_0x57cae9['bucket']=_0x5722d2[_0x7ad6('0x71')];_0x57cae9[_0x7ad6('0x72')]=_0x5722d2[_0x7ad6('0x73')];logger[_0x7ad6('0x62')](util['format'](_0x7ad6('0x74'),_0x4a37c4));return startTranscribe(_0x5af79f,_0x3a2832,_0x24a7f3,uuidv4(),_0x12cd75,_0x5722d2[_0x7ad6('0x73')]);})['then'](function(_0x5039af){logger[_0x7ad6('0x62')](util[_0x7ad6('0x36')](_0x7ad6('0x75'),_0x4a37c4,_0x5039af[_0x7ad6('0x76')][_0x7ad6('0x77')]));_0x57cae9['transcribeName']=_0x5039af['TranscriptionJob']['TranscriptionJobName'];_0x57cae9[_0x7ad6('0x78')]=_0x5039af[_0x7ad6('0x76')][_0x7ad6('0x79')];return _0x52d125(_0x57cae9);})[_0x7ad6('0x46')](function(_0x2084ec){return _0x2597b4(_0x2084ec);});});}exports[_0x7ad6('0x7a')]=function(_0x468eb6,_0x3d795b,_0x4f9849){var _0x58412b;var _0x1e9a43;var _0xa77eea;var _0x437444=require(_0x7ad6('0x4e'));return db[_0x7ad6('0x31')][_0x7ad6('0x7b')]({'where':{'id':_0x468eb6['params']['id']}})[_0x7ad6('0x2a')](function(_0x5c61fa){if(_0x5c61fa){var _0x30789d=util[_0x7ad6('0x36')]('%s.cypher',_0x5c61fa[_0x7ad6('0x50')]);if(fs['existsSync'](_0x30789d)){cypher=!![];return _0x437444[_0x7ad6('0x53')](_0x30789d,_0x5c61fa[_0x7ad6('0x50')],config[_0x7ad6('0x54')][_0x7ad6('0x55')])['then'](function(){return _0x5c61fa;});}return _0x5c61fa;}})[_0x7ad6('0x2a')](function(_0x4c14fe){if(!_0x4c14fe){throw new db['Sequelize'][(_0x7ad6('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x1e9a43=_0x4c14fe;return db[_0x7ad6('0x7c')][_0x7ad6('0x7b')]({'where':{'id':0x1}});})[_0x7ad6('0x2a')](handleEntityNotFound(_0x3d795b,null))[_0x7ad6('0x2a')](function(_0x5ded6b){if(_0x5ded6b){_0x58412b=_0x5ded6b;if(!_0x58412b['transcribe']||!_0x58412b['transcribeAccountId']||!_0x58412b[_0x7ad6('0x7d')]||!_0x58412b[_0x7ad6('0x7e')]||!_0x58412b['bucket']){throw new db['Sequelize'][(_0x7ad6('0x56'))]('Transcribe\x20not\x20configured');}if(_0x468eb6[_0x7ad6('0x4b')]['runSentiment']&&(!_0x58412b[_0x7ad6('0x7f')]||!_0x58412b[_0x7ad6('0x80')]||!_0x58412b[_0x7ad6('0x81')]||!_0x58412b[_0x7ad6('0x7e')]||!_0x58412b[_0x7ad6('0x82')])){throw new db[(_0x7ad6('0x61'))][(_0x7ad6('0x56'))](_0x7ad6('0x83'));}return db[_0x7ad6('0x84')][_0x7ad6('0x7b')]({'where':{'id':_0x58412b[_0x7ad6('0x85')]}});}})[_0x7ad6('0x2a')](function(_0x4d8ba7){if(!_0x4d8ba7){throw new db[(_0x7ad6('0x61'))][(_0x7ad6('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4d8ba7['data1']||!_0x4d8ba7[_0x7ad6('0x86')]){throw new db[(_0x7ad6('0x61'))][(_0x7ad6('0x56'))](_0x7ad6('0x87'));}_0xa77eea=_0x4d8ba7;return getBucketslist(_0xa77eea['data1'],_0xa77eea[_0x7ad6('0x86')],_0x58412b[_0x7ad6('0x7d')]);})['then'](function(_0x67959c){if(_0x67959c&&_0x67959c['Buckets']){var _0x1d46ae=_[_0x7ad6('0x4a')](_0x67959c[_0x7ad6('0x88')],function(_0x11f7b0){return _0x11f7b0['Name']===_0x58412b[_0x7ad6('0x82')];});if(!_0x1d46ae){logger['info'](util[_0x7ad6('0x36')](_0x7ad6('0x89'),_0x468eb6[_0x7ad6('0x47')]['id'],_0x58412b['bucket']));return createBucket(_0xa77eea['data1'],_0xa77eea[_0x7ad6('0x86')],_0x58412b[_0x7ad6('0x7d')],_0x58412b[_0x7ad6('0x82')]);}logger[_0x7ad6('0x62')](util[_0x7ad6('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x468eb6[_0x7ad6('0x47')]['id'],_0x58412b[_0x7ad6('0x82')]));return;}})[_0x7ad6('0x2a')](function(_0x69632){if(_0x1e9a43[_0x7ad6('0x78')]===_0x7ad6('0x8a')){return transcribe(_0x468eb6[_0x7ad6('0x47')]['id'],_0xa77eea[_0x7ad6('0x8b')],_0xa77eea['data2'],_0x58412b[_0x7ad6('0x7d')],_0x58412b[_0x7ad6('0x82')],_0x1e9a43[_0x7ad6('0x50')],_0x58412b[_0x7ad6('0x7e')]);}else{logger[_0x7ad6('0x62')](util['format'](_0x7ad6('0x8c'),_0x468eb6[_0x7ad6('0x47')]['id']));return{'transcribeStatus':_0x7ad6('0x8d')};}})[_0x7ad6('0x2a')](function(_0x107496){if(_0x107496){_0x107496[_0x7ad6('0x8e')]=_0x468eb6[_0x7ad6('0x4b')]['runSentiment'];return _0x1e9a43[_0x7ad6('0x8f')](_0x107496);}})[_0x7ad6('0x2a')](respondWithResult(_0x3d795b,null))[_0x7ad6('0x46')](handleError(_0x3d795b,null));};function writeFile(_0x5bc1a6,_0x517073){return new Promise(function(_0x299fee,_0x415917){fs[_0x7ad6('0x90')](_0x517073,_0x5bc1a6,function(_0xb58d98,_0x17e962){if(_0xb58d98){return _0x415917(_0xb58d98);}else{return _0x299fee(_0x17e962);}});});}exports[_0x7ad6('0x91')]=function(_0x38112d,_0x260f4b,_0x42c119){return db[_0x7ad6('0x31')][_0x7ad6('0x7b')]({'where':{'id':_0x38112d[_0x7ad6('0x47')]['id']}})[_0x7ad6('0x2a')](handleEntityNotFound(_0x260f4b))['then'](function(_0x234f7d){if(_0x234f7d&&_0x234f7d[_0x7ad6('0x92')]){var _0x3191b2=_0x234f7d[_0x7ad6('0x92')];var _0x3e1f66=config[_0x7ad6('0x93')]+_0x7ad6('0x94')+_0x234f7d['id']+_0x7ad6('0x95');if(fs[_0x7ad6('0x52')](_0x3e1f66)){return _0x3e1f66;}return writeFile(_0x3191b2,_0x3e1f66)[_0x7ad6('0x2a')](function(){return _0x3e1f66;});}else{throw new db[(_0x7ad6('0x61'))][(_0x7ad6('0x56'))]('Transcript\x20not\x20available');}})['then'](function(_0xcef92c){return _0x260f4b['download'](_0xcef92c);})[_0x7ad6('0x46')](handleError(_0x260f4b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 38132d0..2c946ac 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 _0x0f80=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x290485,_0x6f959c){var _0x4dc660=function(_0x4cdc61){while(--_0x4cdc61){_0x290485['push'](_0x290485['shift']());}};_0x4dc660(++_0x6f959c);}(_0x0f80,0x108));var _0x00f8=function(_0x8c1396,_0x53f0d7){_0x8c1396=_0x8c1396-0x0;var _0x4632f2=_0x0f80[_0x8c1396];return _0x4632f2;};'use strict';var _=require('lodash');var util=require(_0x00f8('0x0'));var logger=require(_0x00f8('0x1'))(_0x00f8('0x2'));var moment=require(_0x00f8('0x3'));var BPromise=require(_0x00f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00f8('0x5'));var rimraf=require(_0x00f8('0x6'));var config=require(_0x00f8('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x00f8('0x8')]=function(_0x15f84c,_0x38a533){return _0x15f84c[_0x00f8('0x9')](_0x00f8('0xa'),attributes,{'tableName':_0x00f8('0xb'),'paranoid':![],'indexes':[{'name':_0x00f8('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x11e5=['path','../../config/environment','define','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xe37207,_0x296ae3){var _0x35a422=function(_0x5552b6){while(--_0x5552b6){_0xe37207['push'](_0xe37207['shift']());}};_0x35a422(++_0x296ae3);}(_0x11e5,0x8b));var _0x511e=function(_0x3afad3,_0x5266f8){_0x3afad3=_0x3afad3-0x0;var _0x4e55c6=_0x11e5[_0x3afad3];return _0x4e55c6;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x511e('0x8'),'fields':[_0x511e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index cf45c44..3fb41f8 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(_0x3115fa,_0x1bf37e){var _0x3a5567=function(_0x18f739){while(--_0x18f739){_0x3115fa['push'](_0x3115fa['shift']());}};_0x3a5567(++_0x1bf37e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 880b63d..80a6638 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 _0x7096=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x770b94,_0x22933c){var _0x44f9a7=function(_0x39bdf0){while(--_0x39bdf0){_0x770b94['push'](_0x770b94['shift']());}};_0x44f9a7(++_0x22933c);}(_0x7096,0x10c));var _0x6709=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7096[_0x2dea24];return _0x309d58;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var auth=require(_0x6709('0x3'));var interaction=require(_0x6709('0x4'));var config=require(_0x6709('0x5'));var controller=require(_0x6709('0x6'));router[_0x6709('0x7')]('/',auth[_0x6709('0x8')](),controller[_0x6709('0x9')]);router[_0x6709('0x7')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xb')]);router[_0x6709('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6709('0xd')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xe')]);router[_0x6709('0xf')](_0x6709('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6709('0x10')]=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x4de729,_0x50ddcd){var _0x127c6c=function(_0x1b9f58){while(--_0x1b9f58){_0x4de729['push'](_0x4de729['shift']());}};_0x127c6c(++_0x50ddcd);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3138a7,_0x4276d8){_0x3138a7=_0x3138a7-0x0;var _0x3df3d1=_0x3f8a[_0x3138a7];return _0x3df3d1;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c51545c..11394f6 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 _0x4a94=['attended','STRING','ENUM','Yes','sequelize','moment','blind'];(function(_0x127b47,_0x7fb54f){var _0x4f35a1=function(_0x318c0b){while(--_0x318c0b){_0x127b47['push'](_0x127b47['shift']());}};_0x4f35a1(++_0x7fb54f);}(_0x4a94,0xa5));var _0x44a9=function(_0x4fa72e,_0x336dda){_0x4fa72e=_0x4fa72e-0x0;var _0x28323a=_0x4a94[_0x4fa72e];return _0x28323a;};'use strict';var Sequelize=require(_0x44a9('0x0'));var moment=require(_0x44a9('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x44a9('0x2'),_0x44a9('0x3'))},'result':{'type':Sequelize[_0x44a9('0x4')]},'transfererchannel':{'type':Sequelize[_0x44a9('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x44a9('0x4')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x44a9('0x4')]},'transferercontext':{'type':Sequelize[_0x44a9('0x4')]},'transfererexten':{'type':Sequelize[_0x44a9('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x44a9('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x44a9('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x44a9('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x44a9('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x44a9('0x4')]},'transfereecontext':{'type':Sequelize[_0x44a9('0x4')]},'transfereeexten':{'type':Sequelize[_0x44a9('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x44a9('0x4')]},'isexternal':{'type':Sequelize[_0x44a9('0x5')](_0x44a9('0x6'),'No')},'context':{'type':Sequelize[_0x44a9('0x4')]},'extension':{'type':Sequelize[_0x44a9('0x4')]}}; \ No newline at end of file +var _0x5106=['STRING','Yes','sequelize','exports','blind','attended'];(function(_0x2d714f,_0x246f3e){var _0x56acd8=function(_0x5dc956){while(--_0x5dc956){_0x2d714f['push'](_0x2d714f['shift']());}};_0x56acd8(++_0x246f3e);}(_0x5106,0x116));var _0x6510=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5106[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6510('0x0'));var moment=require('moment');module[_0x6510('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6510('0x2'),_0x6510('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x6510('0x4')]},'transferercalleridname':{'type':Sequelize[_0x6510('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6510('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x6510('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x6510('0x4')]},'transferercontext':{'type':Sequelize[_0x6510('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x6510('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x6510('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x6510('0x4')]},'transfereecontext':{'type':Sequelize[_0x6510('0x4')]},'transfereeexten':{'type':Sequelize[_0x6510('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x6510('0x5'),'No')},'context':{'type':Sequelize[_0x6510('0x4')]},'extension':{'type':Sequelize[_0x6510('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e1fe542..6d6438b 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 _0xb5ff=['Content-Range','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','findAll','rows','catch','params','fields','includeAll','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x17d8f4,_0xa046f0){var _0x336743=function(_0x34b3fc){while(--_0x34b3fc){_0x17d8f4['push'](_0x17d8f4['shift']());}};_0x336743(++_0xa046f0);}(_0xb5ff,0x6c));var _0xfb5f=function(_0x405dc0,_0x5f2898){_0x405dc0=_0x405dc0-0x0;var _0x1ed46d=_0xb5ff[_0x405dc0];return _0x1ed46d;};'use strict';var pdf=require(_0xfb5f('0x0'));var emlformat=require(_0xfb5f('0x1'));var rimraf=require(_0xfb5f('0x2'));var zipdir=require(_0xfb5f('0x3'));var jsonpatch=require(_0xfb5f('0x4'));var rp=require('request-promise');var moment=require(_0xfb5f('0x5'));var BPromise=require(_0xfb5f('0x6'));var Mustache=require(_0xfb5f('0x7'));var util=require(_0xfb5f('0x8'));var path=require(_0xfb5f('0x9'));var sox=require(_0xfb5f('0xa'));var csv=require('to-csv');var ejs=require(_0xfb5f('0xb'));var fs=require('fs');var _=require(_0xfb5f('0xc'));var squel=require('squel');var crypto=require(_0xfb5f('0xd'));var jsforce=require(_0xfb5f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfb5f('0xf'));var querystring=require(_0xfb5f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb5f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb5f('0x12'));var logger=require(_0xfb5f('0x13'))(_0xfb5f('0x14'));var utils=require('../../config/utils');var config=require(_0xfb5f('0x15'));var db=require(_0xfb5f('0x16'))['db'];function respondWithStatusCode(_0x1f6176,_0x31e782){_0x31e782=_0x31e782||0xcc;return function(_0x199b8b){if(_0x199b8b){return _0x1f6176[_0xfb5f('0x17')](_0x31e782);}return _0x1f6176[_0xfb5f('0x18')](_0x31e782)[_0xfb5f('0x19')]();};}function respondWithResult(_0x82a2f,_0x3dc4c7){_0x3dc4c7=_0x3dc4c7||0xc8;return function(_0x423ddd){if(_0x423ddd){return _0x82a2f['status'](_0x3dc4c7)[_0xfb5f('0x1a')](_0x423ddd);}};}function respondWithFilteredResult(_0x29a739,_0x23cd56){return function(_0x4f4431){if(_0x4f4431){var _0x51861a=_0x4f4431[_0xfb5f('0x1b')],_0xf92b1f=_0x23cd56[_0xfb5f('0x1c')],_0x37bff0=_0x23cd56[_0xfb5f('0x1c')]+_0x23cd56[_0xfb5f('0x1d')],_0x1d9df8;if(_0x37bff0>=_0x51861a){_0x37bff0=_0x51861a;_0x1d9df8=0xc8;}else{_0x1d9df8=0xce;}_0x29a739['status'](_0x1d9df8);return _0x29a739['set'](_0xfb5f('0x1e'),_0xf92b1f+'-'+_0x37bff0+'/'+_0x51861a)[_0xfb5f('0x1a')](_0x4f4431);}return null;};}function patchUpdates(_0x11db32){return function(_0x4d3517){try{jsonpatch['apply'](_0x4d3517,_0x11db32,!![]);}catch(_0x27f88f){return BPromise[_0xfb5f('0x1f')](_0x27f88f);}return _0x4d3517['save']();};}function saveUpdates(_0x4e3986,_0x1f45f9){return function(_0x94560d){if(_0x94560d){return _0x94560d[_0xfb5f('0x20')](_0x4e3986)[_0xfb5f('0x21')](function(_0x517f46){return _0x517f46;});}return null;};}function removeEntity(_0x24c667,_0x2910a1){return function(_0x381301){if(_0x381301){return _0x381301[_0xfb5f('0x22')]()[_0xfb5f('0x21')](function(){_0x24c667[_0xfb5f('0x18')](0xcc)[_0xfb5f('0x19')]();});}};}function handleEntityNotFound(_0x2e603a,_0x342935){return function(_0x21bd22){if(!_0x21bd22){_0x2e603a[_0xfb5f('0x17')](0x194);}return _0x21bd22;};}function handleError(_0x9eeecf,_0x43ad86){_0x43ad86=_0x43ad86||0x1f4;return function(_0x545493){logger[_0xfb5f('0x23')](_0x545493['stack']);if(_0x545493[_0xfb5f('0x24')]){delete _0x545493[_0xfb5f('0x24')];}_0x9eeecf[_0xfb5f('0x18')](_0x43ad86)[_0xfb5f('0x25')](_0x545493);};}exports[_0xfb5f('0x26')]=function(_0x3f342f,_0x375179){var _0x15aa02={},_0x40f1df={},_0x2af5ce={'count':0x0,'rows':[]};var _0x259f15=_[_0xfb5f('0x27')](db['VoiceTransferReport'][_0xfb5f('0x28')],function(_0x24e375){return{'name':_0x24e375[_0xfb5f('0x29')],'type':_0x24e375[_0xfb5f('0x2a')]['key']};});_0x40f1df['model']=_[_0xfb5f('0x27')](_0x259f15,_0xfb5f('0x24'));_0x40f1df[_0xfb5f('0x2b')]=_[_0xfb5f('0x2c')](_0x3f342f['query']);_0x40f1df[_0xfb5f('0x2d')]=_[_0xfb5f('0x2e')](_0x40f1df['model'],_0x40f1df[_0xfb5f('0x2b')]);_0x15aa02['attributes']=_[_0xfb5f('0x2e')](_0x40f1df[_0xfb5f('0x2f')],qs['fields'](_0x3f342f[_0xfb5f('0x2b')]['fields']));_0x15aa02[_0xfb5f('0x30')]=_0x15aa02[_0xfb5f('0x30')][_0xfb5f('0x31')]?_0x15aa02[_0xfb5f('0x30')]:_0x40f1df[_0xfb5f('0x2f')];if(!_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x32')](_0xfb5f('0x33'))){_0x15aa02[_0xfb5f('0x1d')]=qs[_0xfb5f('0x1d')](_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x1d')]);_0x15aa02[_0xfb5f('0x1c')]=qs[_0xfb5f('0x1c')](_0x3f342f[_0xfb5f('0x2b')]['offset']);}_0x15aa02[_0xfb5f('0x34')]=qs['sort'](_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x35')]);_0x15aa02[_0xfb5f('0x36')]=qs[_0xfb5f('0x2d')](_[_0xfb5f('0x37')](_0x3f342f['query'],_0x40f1df[_0xfb5f('0x2d')]),_0x259f15);if(_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x38')]){_0x15aa02[_0xfb5f('0x36')]=_[_0xfb5f('0x39')](_0x15aa02[_0xfb5f('0x36')],{'$or':_[_0xfb5f('0x27')](_0x259f15,function(_0x212538){if(_0x212538[_0xfb5f('0x2a')]!==_0xfb5f('0x3a')){var _0x2768b0={};_0x2768b0[_0x212538[_0xfb5f('0x24')]]={'$like':'%'+_0x3f342f[_0xfb5f('0x2b')][_0xfb5f('0x38')]+'%'};return _0x2768b0;}})});}_0x15aa02=_[_0xfb5f('0x39')]({},_0x15aa02,_0x3f342f[_0xfb5f('0x3b')]);var _0x53d7fb={'where':_0x15aa02[_0xfb5f('0x36')]};return db[_0xfb5f('0x3c')][_0xfb5f('0x1b')](_0x53d7fb)[_0xfb5f('0x21')](function(_0x19728e){_0x2af5ce[_0xfb5f('0x1b')]=_0x19728e;if(_0x3f342f['query']['includeAll']){_0x15aa02['include']=[{'all':!![]}];}return db[_0xfb5f('0x3c')][_0xfb5f('0x3d')](_0x15aa02);})[_0xfb5f('0x21')](function(_0x281008){_0x2af5ce[_0xfb5f('0x3e')]=_0x281008;return _0x2af5ce;})['then'](respondWithFilteredResult(_0x375179,_0x15aa02))[_0xfb5f('0x3f')](handleError(_0x375179,null));};exports['show']=function(_0x6cf3dc,_0x12dd4d){var _0x43214a={'raw':!![],'where':{'id':_0x6cf3dc[_0xfb5f('0x40')]['id']}},_0x46355c={};_0x46355c[_0xfb5f('0x2f')]=_[_0xfb5f('0x2c')](db['VoiceTransferReport'][_0xfb5f('0x28')]);_0x46355c[_0xfb5f('0x2b')]=_['keys'](_0x6cf3dc[_0xfb5f('0x2b')]);_0x46355c[_0xfb5f('0x2d')]=_[_0xfb5f('0x2e')](_0x46355c[_0xfb5f('0x2f')],_0x46355c[_0xfb5f('0x2b')]);_0x43214a[_0xfb5f('0x30')]=_['intersection'](_0x46355c['model'],qs[_0xfb5f('0x41')](_0x6cf3dc[_0xfb5f('0x2b')][_0xfb5f('0x41')]));_0x43214a[_0xfb5f('0x30')]=_0x43214a[_0xfb5f('0x30')][_0xfb5f('0x31')]?_0x43214a['attributes']:_0x46355c[_0xfb5f('0x2f')];if(_0x6cf3dc[_0xfb5f('0x2b')][_0xfb5f('0x42')]){_0x43214a['include']=[{'all':!![]}];}_0x43214a=_[_0xfb5f('0x39')]({},_0x43214a,_0x6cf3dc[_0xfb5f('0x3b')]);return db[_0xfb5f('0x3c')][_0xfb5f('0x43')](_0x43214a)[_0xfb5f('0x21')](handleEntityNotFound(_0x12dd4d,null))[_0xfb5f('0x21')](respondWithResult(_0x12dd4d,null))['catch'](handleError(_0x12dd4d,null));};exports['create']=function(_0x5dd86b,_0x138d72){return db[_0xfb5f('0x3c')]['create'](_0x5dd86b['body'],{})['then'](respondWithResult(_0x138d72,0xc9))['catch'](handleError(_0x138d72,null));};exports['update']=function(_0x226dc3,_0x1b2ba6){if(_0x226dc3[_0xfb5f('0x44')]['id']){delete _0x226dc3[_0xfb5f('0x44')]['id'];}return db[_0xfb5f('0x3c')][_0xfb5f('0x43')]({'where':{'id':_0x226dc3['params']['id']}})[_0xfb5f('0x21')](handleEntityNotFound(_0x1b2ba6,null))[_0xfb5f('0x21')](saveUpdates(_0x226dc3[_0xfb5f('0x44')],null))[_0xfb5f('0x21')](respondWithResult(_0x1b2ba6,null))[_0xfb5f('0x3f')](handleError(_0x1b2ba6,null));};exports[_0xfb5f('0x22')]=function(_0x2171b0,_0x949807){return db[_0xfb5f('0x3c')][_0xfb5f('0x43')]({'where':{'id':_0x2171b0[_0xfb5f('0x40')]['id']}})[_0xfb5f('0x21')](handleEntityNotFound(_0x949807,null))['then'](removeEntity(_0x949807,null))[_0xfb5f('0x3f')](handleError(_0x949807,null));}; \ No newline at end of file +var _0x7644=['filter','merge','VIRTUAL','VoiceTransferReport','includeAll','include','findAll','catch','show','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x3fb0b7,_0x34b84f){var _0x4404ac=function(_0x3bc861){while(--_0x3bc861){_0x3fb0b7['push'](_0x3fb0b7['shift']());}};_0x4404ac(++_0x34b84f);}(_0x7644,0xdb));var _0x4764=function(_0x341989,_0x3a20fe){_0x341989=_0x341989-0x0;var _0x289cfd=_0x7644[_0x341989];return _0x289cfd;};'use strict';var pdf=require(_0x4764('0x0'));var emlformat=require(_0x4764('0x1'));var rimraf=require(_0x4764('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4764('0x3'));var rp=require(_0x4764('0x4'));var moment=require(_0x4764('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4764('0x6'));var util=require(_0x4764('0x7'));var path=require(_0x4764('0x8'));var sox=require(_0x4764('0x9'));var csv=require(_0x4764('0xa'));var ejs=require(_0x4764('0xb'));var fs=require('fs');var _=require(_0x4764('0xc'));var squel=require('squel');var crypto=require(_0x4764('0xd'));var jsforce=require(_0x4764('0xe'));var deskjs=require(_0x4764('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4764('0x10'));var Papa=require(_0x4764('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4764('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4764('0x13'));var logger=require(_0x4764('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4764('0x15'));var db=require(_0x4764('0x16'))['db'];function respondWithStatusCode(_0x32347a,_0x1a844f){_0x1a844f=_0x1a844f||0xcc;return function(_0x591107){if(_0x591107){return _0x32347a['sendStatus'](_0x1a844f);}return _0x32347a[_0x4764('0x17')](_0x1a844f)[_0x4764('0x18')]();};}function respondWithResult(_0x5074f4,_0x1c5fd6){_0x1c5fd6=_0x1c5fd6||0xc8;return function(_0x5e397a){if(_0x5e397a){return _0x5074f4[_0x4764('0x17')](_0x1c5fd6)[_0x4764('0x19')](_0x5e397a);}};}function respondWithFilteredResult(_0xcd2fb3,_0x24b467){return function(_0xfe881e){if(_0xfe881e){var _0x4f19c7=_0xfe881e[_0x4764('0x1a')],_0x3d1401=_0x24b467[_0x4764('0x1b')],_0x4a90e6=_0x24b467[_0x4764('0x1b')]+_0x24b467[_0x4764('0x1c')],_0x1bc8d5;if(_0x4a90e6>=_0x4f19c7){_0x4a90e6=_0x4f19c7;_0x1bc8d5=0xc8;}else{_0x1bc8d5=0xce;}_0xcd2fb3['status'](_0x1bc8d5);return _0xcd2fb3['set'](_0x4764('0x1d'),_0x3d1401+'-'+_0x4a90e6+'/'+_0x4f19c7)[_0x4764('0x19')](_0xfe881e);}return null;};}function patchUpdates(_0x24b75b){return function(_0x15e234){try{jsonpatch[_0x4764('0x1e')](_0x15e234,_0x24b75b,!![]);}catch(_0x5b65b0){return BPromise['reject'](_0x5b65b0);}return _0x15e234[_0x4764('0x1f')]();};}function saveUpdates(_0x5622f7,_0x463bdb){return function(_0x2d5514){if(_0x2d5514){return _0x2d5514[_0x4764('0x20')](_0x5622f7)['then'](function(_0xc39a61){return _0xc39a61;});}return null;};}function removeEntity(_0x321702,_0x45721f){return function(_0x2d8ffa){if(_0x2d8ffa){return _0x2d8ffa[_0x4764('0x21')]()[_0x4764('0x22')](function(){_0x321702[_0x4764('0x17')](0xcc)[_0x4764('0x18')]();});}};}function handleEntityNotFound(_0x1fef50,_0x1554a9){return function(_0x93088){if(!_0x93088){_0x1fef50[_0x4764('0x23')](0x194);}return _0x93088;};}function handleError(_0x297edf,_0x481d3a){_0x481d3a=_0x481d3a||0x1f4;return function(_0x242e82){logger[_0x4764('0x24')](_0x242e82[_0x4764('0x25')]);if(_0x242e82[_0x4764('0x26')]){delete _0x242e82['name'];}_0x297edf[_0x4764('0x17')](_0x481d3a)['send'](_0x242e82);};}exports['index']=function(_0x3f9044,_0x3d164e){var _0x3b23b7={},_0x217408={},_0x2a9e21={'count':0x0,'rows':[]};var _0x127b01=_['map'](db['VoiceTransferReport'][_0x4764('0x27')],function(_0x36830a){return{'name':_0x36830a[_0x4764('0x28')],'type':_0x36830a[_0x4764('0x29')][_0x4764('0x2a')]};});_0x217408[_0x4764('0x2b')]=_[_0x4764('0x2c')](_0x127b01,_0x4764('0x26'));_0x217408[_0x4764('0x2d')]=_[_0x4764('0x2e')](_0x3f9044[_0x4764('0x2d')]);_0x217408[_0x4764('0x2f')]=_[_0x4764('0x30')](_0x217408[_0x4764('0x2b')],_0x217408['query']);_0x3b23b7[_0x4764('0x31')]=_[_0x4764('0x30')](_0x217408[_0x4764('0x2b')],qs[_0x4764('0x32')](_0x3f9044[_0x4764('0x2d')][_0x4764('0x32')]));_0x3b23b7[_0x4764('0x31')]=_0x3b23b7[_0x4764('0x31')][_0x4764('0x33')]?_0x3b23b7[_0x4764('0x31')]:_0x217408[_0x4764('0x2b')];if(!_0x3f9044[_0x4764('0x2d')][_0x4764('0x34')](_0x4764('0x35'))){_0x3b23b7['limit']=qs[_0x4764('0x1c')](_0x3f9044[_0x4764('0x2d')][_0x4764('0x1c')]);_0x3b23b7[_0x4764('0x1b')]=qs[_0x4764('0x1b')](_0x3f9044[_0x4764('0x2d')][_0x4764('0x1b')]);}_0x3b23b7[_0x4764('0x36')]=qs[_0x4764('0x37')](_0x3f9044[_0x4764('0x2d')][_0x4764('0x37')]);_0x3b23b7[_0x4764('0x38')]=qs['filters'](_['pick'](_0x3f9044[_0x4764('0x2d')],_0x217408[_0x4764('0x2f')]),_0x127b01);if(_0x3f9044[_0x4764('0x2d')][_0x4764('0x39')]){_0x3b23b7[_0x4764('0x38')]=_[_0x4764('0x3a')](_0x3b23b7[_0x4764('0x38')],{'$or':_[_0x4764('0x2c')](_0x127b01,function(_0x53d09a){if(_0x53d09a[_0x4764('0x29')]!==_0x4764('0x3b')){var _0x1d53cd={};_0x1d53cd[_0x53d09a['name']]={'$like':'%'+_0x3f9044[_0x4764('0x2d')]['filter']+'%'};return _0x1d53cd;}})});}_0x3b23b7=_[_0x4764('0x3a')]({},_0x3b23b7,_0x3f9044['options']);var _0x23a853={'where':_0x3b23b7[_0x4764('0x38')]};return db[_0x4764('0x3c')][_0x4764('0x1a')](_0x23a853)[_0x4764('0x22')](function(_0x2825bf){_0x2a9e21['count']=_0x2825bf;if(_0x3f9044[_0x4764('0x2d')][_0x4764('0x3d')]){_0x3b23b7[_0x4764('0x3e')]=[{'all':!![]}];}return db[_0x4764('0x3c')][_0x4764('0x3f')](_0x3b23b7);})[_0x4764('0x22')](function(_0x294ae3){_0x2a9e21['rows']=_0x294ae3;return _0x2a9e21;})[_0x4764('0x22')](respondWithFilteredResult(_0x3d164e,_0x3b23b7))[_0x4764('0x40')](handleError(_0x3d164e,null));};exports[_0x4764('0x41')]=function(_0x25eb91,_0x4f14f8){var _0x4e56a6={'raw':!![],'where':{'id':_0x25eb91['params']['id']}},_0x17e6b8={};_0x17e6b8[_0x4764('0x2b')]=_[_0x4764('0x2e')](db[_0x4764('0x3c')][_0x4764('0x27')]);_0x17e6b8[_0x4764('0x2d')]=_[_0x4764('0x2e')](_0x25eb91[_0x4764('0x2d')]);_0x17e6b8[_0x4764('0x2f')]=_[_0x4764('0x30')](_0x17e6b8['model'],_0x17e6b8[_0x4764('0x2d')]);_0x4e56a6['attributes']=_['intersection'](_0x17e6b8[_0x4764('0x2b')],qs[_0x4764('0x32')](_0x25eb91[_0x4764('0x2d')][_0x4764('0x32')]));_0x4e56a6[_0x4764('0x31')]=_0x4e56a6[_0x4764('0x31')]['length']?_0x4e56a6['attributes']:_0x17e6b8[_0x4764('0x2b')];if(_0x25eb91[_0x4764('0x2d')]['includeAll']){_0x4e56a6[_0x4764('0x3e')]=[{'all':!![]}];}_0x4e56a6=_['merge']({},_0x4e56a6,_0x25eb91['options']);return db[_0x4764('0x3c')]['find'](_0x4e56a6)[_0x4764('0x22')](handleEntityNotFound(_0x4f14f8,null))['then'](respondWithResult(_0x4f14f8,null))[_0x4764('0x40')](handleError(_0x4f14f8,null));};exports['create']=function(_0x58e6f1,_0x4b282){return db[_0x4764('0x3c')][_0x4764('0x42')](_0x58e6f1[_0x4764('0x43')],{})[_0x4764('0x22')](respondWithResult(_0x4b282,0xc9))['catch'](handleError(_0x4b282,null));};exports[_0x4764('0x20')]=function(_0x2f7afa,_0x317019){if(_0x2f7afa[_0x4764('0x43')]['id']){delete _0x2f7afa[_0x4764('0x43')]['id'];}return db[_0x4764('0x3c')]['find']({'where':{'id':_0x2f7afa['params']['id']}})[_0x4764('0x22')](handleEntityNotFound(_0x317019,null))[_0x4764('0x22')](saveUpdates(_0x2f7afa[_0x4764('0x43')],null))['then'](respondWithResult(_0x317019,null))['catch'](handleError(_0x317019,null));};exports['destroy']=function(_0x24e3e1,_0x1c9d19){return db[_0x4764('0x3c')]['find']({'where':{'id':_0x24e3e1[_0x4764('0x44')]['id']}})[_0x4764('0x22')](handleEntityNotFound(_0x1c9d19,null))[_0x4764('0x22')](removeEntity(_0x1c9d19,null))[_0x4764('0x40')](handleError(_0x1c9d19,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9bca341..6c5186c 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 _0x4312=['./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x18a6cc,_0x5ab117){var _0x166f89=function(_0x2fee60){while(--_0x2fee60){_0x18a6cc['push'](_0x18a6cc['shift']());}};_0x166f89(++_0x5ab117);}(_0x4312,0xd3));var _0x2431=function(_0x31210e,_0x1785ff){_0x31210e=_0x31210e-0x0;var _0x2167db=_0x4312[_0x31210e];return _0x2167db;};'use strict';var _=require(_0x2431('0x0'));var util=require(_0x2431('0x1'));var logger=require(_0x2431('0x2'))(_0x2431('0x3'));var moment=require(_0x2431('0x4'));var BPromise=require(_0x2431('0x5'));var rp=require(_0x2431('0x6'));var fs=require('fs');var path=require(_0x2431('0x7'));var rimraf=require(_0x2431('0x8'));var config=require(_0x2431('0x9'));var attributes=require(_0x2431('0xa'));module['exports']=function(_0x46cfe5,_0x506dfd){return _0x46cfe5[_0x2431('0xb')]('VoiceTransferReport',attributes,{'tableName':_0x2431('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ec=['exports','define','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x28a8f1,_0x25e135){var _0x47d8e2=function(_0x57c182){while(--_0x57c182){_0x28a8f1['push'](_0x28a8f1['shift']());}};_0x47d8e2(++_0x25e135);}(_0xa4ec,0x1e8));var _0xca4e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa4ec[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xca4e('0x0'));var util=require(_0xca4e('0x1'));var logger=require(_0xca4e('0x2'))(_0xca4e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca4e('0x4'));var fs=require('fs');var path=require(_0xca4e('0x5'));var rimraf=require('rimraf');var config=require(_0xca4e('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xca4e('0x7')]=function(_0x42feb7,_0x3719af){return _0x42feb7[_0xca4e('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 728ff4b..f11cb01 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 _0x04b5=['CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw'];(function(_0xce8627,_0x1a8bdf){var _0x146bc8=function(_0x1e3931){while(--_0x1e3931){_0xce8627['push'](_0xce8627['shift']());}};_0x146bc8(++_0x1a8bdf);}(_0x04b5,0x140));var _0x504b=function(_0x131cff,_0x489f20){_0x131cff=_0x131cff-0x0;var _0x3726da=_0x04b5[_0x131cff];return _0x3726da;};'use strict';var _=require(_0x504b('0x0'));var util=require(_0x504b('0x1'));var moment=require(_0x504b('0x2'));var BPromise=require(_0x504b('0x3'));var rs=require(_0x504b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x504b('0x5'))['db'];var utils=require(_0x504b('0x6'));var logger=require(_0x504b('0x7'))(_0x504b('0x8'));var config=require('../../config/environment');var jayson=require(_0x504b('0x9'));var client=jayson[_0x504b('0xa')][_0x504b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b4fc4,_0x430994,_0x555411){return new BPromise(function(_0x486cc2,_0x4ea8f7){return client['request'](_0x5b4fc4,_0x555411)[_0x504b('0xc')](function(_0x44257d){logger[_0x504b('0xd')](_0x504b('0xe'),_0x430994,'request\x20sent');logger['debug'](_0x504b('0xf'),_0x430994,_0x504b('0x10'),JSON[_0x504b('0x11')](_0x44257d));if(_0x44257d[_0x504b('0x12')]){if(_0x44257d['error'][_0x504b('0x13')]===0x1f4){logger[_0x504b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x44257d[_0x504b('0x12')][_0x504b('0x14')]);return _0x4ea8f7(_0x44257d[_0x504b('0x12')][_0x504b('0x14')]);}logger[_0x504b('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x44257d['error']['message']);return _0x486cc2(_0x44257d['error'][_0x504b('0x14')]);}else{logger[_0x504b('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x430994,_0x504b('0x10'));_0x486cc2(_0x44257d[_0x504b('0x15')][_0x504b('0x14')]);}})[_0x504b('0x16')](function(_0x551bbf){logger[_0x504b('0x12')](_0x504b('0xe'),_0x430994,_0x551bbf);_0x4ea8f7(_0x551bbf);});});}exports['CreateVoiceTransferReport']=function(_0x1229b1){var _0x405062=this;return new Promise(function(_0x4f962e,_0x3a853a){return db[_0x504b('0x17')][_0x504b('0x18')](_0x1229b1[_0x504b('0x19')],{'raw':_0x1229b1['options']?_0x1229b1[_0x504b('0x1a')][_0x504b('0x1b')]===undefined?!![]:![]:!![]})[_0x504b('0xc')](function(_0x239f2a){logger[_0x504b('0xd')](_0x504b('0x1c'),_0x1229b1);logger['debug']('CreateVoiceTransferReport',_0x1229b1,JSON[_0x504b('0x11')](_0x239f2a));_0x4f962e(_0x239f2a);})[_0x504b('0x16')](function(_0x38216e){logger[_0x504b('0x12')]('CreateVoiceTransferReport',_0x38216e[_0x504b('0x14')],_0x1229b1);_0x3a853a(_0x405062['error'](0x1f4,_0x38216e[_0x504b('0x14')]));});});}; \ No newline at end of file +var _0xb2f8=['message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3da395,_0x1303ec){var _0x49720c=function(_0x273e41){while(--_0x273e41){_0x3da395['push'](_0x3da395['shift']());}};_0x49720c(++_0x1303ec);}(_0xb2f8,0xf2));var _0x8b2f=function(_0x146be0,_0x39a85e){_0x146be0=_0x146be0-0x0;var _0x1bcc25=_0xb2f8[_0x146be0];return _0x1bcc25;};'use strict';var _=require(_0x8b2f('0x0'));var util=require(_0x8b2f('0x1'));var moment=require(_0x8b2f('0x2'));var BPromise=require(_0x8b2f('0x3'));var rs=require(_0x8b2f('0x4'));var fs=require('fs');var Redis=require(_0x8b2f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b2f('0x6'));var logger=require(_0x8b2f('0x7'))(_0x8b2f('0x8'));var config=require('../../config/environment');var jayson=require(_0x8b2f('0x9'));var client=jayson['client'][_0x8b2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d26b8,_0x5c6210,_0x1bd4e1){return new BPromise(function(_0xe2b0c3,_0xf4b253){return client['request'](_0x3d26b8,_0x1bd4e1)[_0x8b2f('0xb')](function(_0x2f2cf5){logger[_0x8b2f('0xc')](_0x8b2f('0xd'),_0x5c6210,_0x8b2f('0xe'));logger[_0x8b2f('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x5c6210,_0x8b2f('0xe'),JSON[_0x8b2f('0x10')](_0x2f2cf5));if(_0x2f2cf5['error']){if(_0x2f2cf5[_0x8b2f('0x11')]['code']===0x1f4){logger[_0x8b2f('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c6210,_0x2f2cf5[_0x8b2f('0x11')][_0x8b2f('0x12')]);return _0xf4b253(_0x2f2cf5['error'][_0x8b2f('0x12')]);}logger[_0x8b2f('0x11')](_0x8b2f('0xd'),_0x5c6210,_0x2f2cf5[_0x8b2f('0x11')][_0x8b2f('0x12')]);return _0xe2b0c3(_0x2f2cf5[_0x8b2f('0x11')][_0x8b2f('0x12')]);}else{logger[_0x8b2f('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c6210,_0x8b2f('0xe'));_0xe2b0c3(_0x2f2cf5[_0x8b2f('0x13')]['message']);}})['catch'](function(_0x5633d2){logger[_0x8b2f('0x11')](_0x8b2f('0xd'),_0x5c6210,_0x5633d2);_0xf4b253(_0x5633d2);});});}exports[_0x8b2f('0x14')]=function(_0x2e26a1){var _0x25c8ba=this;return new Promise(function(_0x1fd724,_0x2ec595){return db[_0x8b2f('0x15')][_0x8b2f('0x16')](_0x2e26a1['body'],{'raw':_0x2e26a1[_0x8b2f('0x17')]?_0x2e26a1[_0x8b2f('0x17')][_0x8b2f('0x18')]===undefined?!![]:![]:!![]})[_0x8b2f('0xb')](function(_0x58e07b){logger[_0x8b2f('0xc')](_0x8b2f('0x14'),_0x2e26a1);logger[_0x8b2f('0xf')](_0x8b2f('0x14'),_0x2e26a1,JSON[_0x8b2f('0x10')](_0x58e07b));_0x1fd724(_0x58e07b);})[_0x8b2f('0x19')](function(_0xd7c7c){logger[_0x8b2f('0x11')](_0x8b2f('0x14'),_0xd7c7c['message'],_0x2e26a1);_0x2ec595(_0x25c8ba[_0x8b2f('0x11')](0x1f4,_0xd7c7c[_0x8b2f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 05ffea2..2c2be53 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 _0x6b19=['hold','/unhold','/calls','calls','/transfer','transfer','exports','express','Router','./webbar.controller','isAuthenticated','canUpdate','originate','post','/hangup'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6b19,0xe8));var _0x96b1=function(_0x38fe68,_0x4959de){_0x38fe68=_0x38fe68-0x0;var _0xec066c=_0x6b19[_0x38fe68];return _0xec066c;};'use strict';var express=require(_0x96b1('0x0'));var router=express[_0x96b1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x96b1('0x2'));router['post']('/originate',auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller[_0x96b1('0x5')]);router[_0x96b1('0x6')](_0x96b1('0x7'),auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller['hangup']);router[_0x96b1('0x6')]('/answer',auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller['answer']);router[_0x96b1('0x6')]('/hold',auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller[_0x96b1('0x8')]);router[_0x96b1('0x6')](_0x96b1('0x9'),auth[_0x96b1('0x3')](),auth[_0x96b1('0x4')](),controller['unhold']);router['post'](_0x96b1('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x96b1('0xb')]);router[_0x96b1('0x6')](_0x96b1('0xc'),auth['isAuthenticated'](),auth[_0x96b1('0x4')](),controller[_0x96b1('0xd')]);module[_0x96b1('0xe')]=router; \ No newline at end of file +var _0x4711=['/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x1471('0x0'));var router=express[_0x1471('0x1')]();var auth=require(_0x1471('0x2'));var controller=require(_0x1471('0x3'));router[_0x1471('0x4')](_0x1471('0x5'),auth[_0x1471('0x6')](),auth['canUpdate'](),controller[_0x1471('0x7')]);router['post'](_0x1471('0x8'),auth[_0x1471('0x6')](),auth[_0x1471('0x9')](),controller[_0x1471('0xa')]);router[_0x1471('0x4')]('/answer',auth[_0x1471('0x6')](),auth[_0x1471('0x9')](),controller[_0x1471('0xb')]);router[_0x1471('0x4')](_0x1471('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1471('0xd')]);router[_0x1471('0x4')](_0x1471('0xe'),auth[_0x1471('0x6')](),auth[_0x1471('0x9')](),controller[_0x1471('0xf')]);router[_0x1471('0x4')](_0x1471('0x10'),auth['isAuthenticated'](),auth[_0x1471('0x9')](),controller[_0x1471('0x11')]);router[_0x1471('0x4')](_0x1471('0x12'),auth[_0x1471('0x6')](),auth['canUpdate'](),controller[_0x1471('0x13')]);module[_0x1471('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index ddd25e5..6fbbc3f 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 _0xc034=['transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','entityFound:','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','number','userId\x20is\x20required','string','sessionId\x20is\x20required'];(function(_0x340cf5,_0xd979e1){var _0x297d14=function(_0x31683f){while(--_0x31683f){_0x340cf5['push'](_0x340cf5['shift']());}};_0x297d14(++_0xd979e1);}(_0xc034,0x170));var _0x4c03=function(_0x3e6fc2,_0x46ab1d){_0x3e6fc2=_0x3e6fc2-0x0;var _0x33df1c=_0xc034[_0x3e6fc2];return _0x33df1c;};'use strict';var path=require(_0x4c03('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x4c03('0x1'))['db'];var config=require(_0x4c03('0x2'));var util=require(_0x4c03('0x3'));var BPromise=require(_0x4c03('0x4'));var jayson=require(_0x4c03('0x5'));var amiClient=jayson[_0x4c03('0x6')][_0x4c03('0x7')]({'port':0x232a});var logger=require(_0x4c03('0x8'))(_0x4c03('0x9'));var Redis=require(_0x4c03('0xa'));config[_0x4c03('0xb')]=_['defaults'](config[_0x4c03('0xb')],{'host':_0x4c03('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4c03('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':[!![],_0x4c03('0x10')]},'transferNumber':{'type':'string','required':[!![],_0x4c03('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4c03('0xd'),'required':[!![],_0x4c03('0xe')]},'sessionId':{'type':_0x4c03('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c03('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4c03('0xe')]}});function emit(_0xc59477,_0x2cd36a,_0x5ac6f9){logger[_0x4c03('0x12')](_0xc59477,_0x2cd36a,JSON[_0x4c03('0x13')](_0x5ac6f9));io['to'](_0xc59477)[_0x4c03('0x14')](_0x2cd36a,_0x5ac6f9);}function handleError(_0x793610){return function(_0x5bc41b){console[_0x4c03('0x15')](_0x4c03('0x16'),_0x5bc41b,_0x5bc41b instanceof RangeError);logger[_0x4c03('0x17')](_0x5bc41b[_0x4c03('0x18')]);if(_0x5bc41b instanceof RangeError){if(_0x5bc41b['name']){delete _0x5bc41b[_0x4c03('0x19')];}_0x793610[_0x4c03('0x1a')](0x194)[_0x4c03('0x1b')](_0x5bc41b);}else{if(_0x5bc41b[_0x4c03('0x19')]){delete _0x5bc41b[_0x4c03('0x19')];}_0x793610[_0x4c03('0x1a')](0x1f4)[_0x4c03('0x1b')](_0x5bc41b);}};}function checkError(){return function(_0x4d6f5d){if(!_0x4d6f5d){throw new RangeError(_0x4c03('0x1c'));}return _0x4d6f5d;};}function respondWithRpcPromise(_0x18f3b2,_0x517db1){return new BPromise(function(_0x546c8c,_0x4ce212){var _0x42cc4b=amiClient;return _0x42cc4b[_0x4c03('0x1d')](_0x18f3b2,_0x517db1)[_0x4c03('0x1e')](function(_0x3ead7b){if(_0x3ead7b[_0x4c03('0x17')]){if(_0x3ead7b['error'][_0x4c03('0x1f')]===0x1f4){return _0x4ce212(_0x3ead7b[_0x4c03('0x17')][_0x4c03('0x20')]);}return _0x546c8c(_0x3ead7b['error'][_0x4c03('0x20')]);}else{_0x546c8c(_0x3ead7b[_0x4c03('0x21')]);}})[_0x4c03('0x22')](function(_0x44fb02){_0x4ce212(_0x44fb02);});});}function getAgent(_0x4d3533){return db['User'][_0x4c03('0x23')]({'where':{'id':_0x4d3533,'role':_0x4c03('0x24')}})[_0x4c03('0x1e')](checkError());}function getAgentCheckSession(_0x1af8a5,_0x38d22b){return new BPromise(function(_0x530cf3,_0x5f55f1){var _0x4631bd=respondWithRpcPromise(_0x4c03('0x25'));var _0x3068ab=getAgent(_0x1af8a5);Promise[_0x4c03('0x26')]([_0x4631bd,_0x3068ab])[_0x4c03('0x1e')](function(_0x103191){var _0x2f7528=_0x103191[0x0];var _0x5cab83=_0x103191[0x1];var _0x2ba07d=_[_0x4c03('0x27')](_0x2f7528[_0x4c03('0x28')],function(_0x2f638a){return _0x2f638a[_0x4c03('0x29')]==_0x5cab83['id']&&_0x2f638a[_0x4c03('0x2a')]==_0x38d22b;});if(_0x2ba07d[_0x4c03('0x2b')]==0x1){_0x530cf3(_0x5cab83);}else{_0x5f55f1(new RangeError(_0x4c03('0x2c')+_0x38d22b+_0x4c03('0x2d')));}});});}exports[_0x4c03('0x2e')]=function(_0x4d26fd,_0x1e5557){logger[_0x4c03('0x12')](_0x4c03('0x2f'),_0x4d26fd[_0x4c03('0x30')]);var _0x1b49bd=originateValidation['validate'](_0x4d26fd['body']);if(_0x1b49bd[_0x4c03('0x2b')]>0x0){return _0x1e5557[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x1b49bd);}var _0x20f368=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x32')];var _0x1ed4e4=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x33')];var _0x2e9e90=_0x4d26fd['body'][_0x4c03('0x34')];var _0x6a4e44=_0x4d26fd[_0x4c03('0x30')][_0x4c03('0x35')];return getAgent(_0x20f368)[_0x4c03('0x1e')](function(_0x33a183){logger['info']('entityFound:',_0x33a183[_0x4c03('0x19')]);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x33a183[_0x4c03('0x19')]),_0x4c03('0x38'),{'callNumber':_0x1ed4e4,'callerId':_0x2e9e90,'callbackUrl':_0x6a4e44});return _0x1e5557['status'](0xc8)['json']({'error':![],'message':_0x4c03('0x39')});})[_0x4c03('0x22')](handleError(_0x1e5557));};exports['hangup']=function(_0xbd3e6b,_0x567615){logger[_0x4c03('0x12')](_0x4c03('0x3a'),_0xbd3e6b[_0x4c03('0x30')]);var _0x4b23ba=hangupValidation[_0x4c03('0x3b')](_0xbd3e6b['body']);if(_0x4b23ba['length']>0x0){return _0x567615[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x4b23ba);}var _0x120460=_0xbd3e6b[_0x4c03('0x30')]['userId'];var _0x5c1363=_0xbd3e6b['body']['sessionId'];return getAgent(_0x120460)['then'](function(_0x539674){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x539674['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x539674[_0x4c03('0x19')]),'webbar:hangup',{'sessionId':_0x5c1363});return _0x567615['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x567615));};exports[_0x4c03('0x3d')]=function(_0x1584b1,_0x590fde){logger[_0x4c03('0x12')]('answer\x20fired:',_0x1584b1[_0x4c03('0x30')]);var _0x414a8b=answerValidation[_0x4c03('0x3b')](_0x1584b1['body']);if(_0x414a8b['length']>0x0){return _0x590fde[_0x4c03('0x1a')](0x190)['json'](_0x414a8b);}var _0x1bd4ad=_0x1584b1[_0x4c03('0x30')][_0x4c03('0x32')];var _0x367b77=_0x1584b1[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0x1bd4ad)[_0x4c03('0x1e')](function(_0x1cb331){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x1cb331[_0x4c03('0x19')]);emit(util['format']('user:%s',_0x1cb331[_0x4c03('0x19')]),'webbar:answer',{'sessionId':_0x367b77});return _0x590fde[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':_0x4c03('0x3e')});})[_0x4c03('0x22')](handleError(_0x590fde));};exports[_0x4c03('0x3f')]=function(_0x3616f5,_0x287216){logger[_0x4c03('0x12')](_0x4c03('0x40'),_0x3616f5['body']);var _0x22a404=holdValidation[_0x4c03('0x3b')](_0x3616f5[_0x4c03('0x30')]);if(_0x22a404[_0x4c03('0x2b')]>0x0){return _0x287216['status'](0x190)[_0x4c03('0x31')](_0x22a404);}var _0x15d6db=_0x3616f5[_0x4c03('0x30')][_0x4c03('0x32')];var _0x90885a=_0x3616f5[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0x15d6db)[_0x4c03('0x1e')](function(_0x3c8686){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3c8686['name']);emit(util['format'](_0x4c03('0x37'),_0x3c8686[_0x4c03('0x19')]),_0x4c03('0x41'),{'sessionId':_0x90885a});return _0x287216[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x4c03('0x22')](handleError(_0x287216));};exports[_0x4c03('0x42')]=function(_0x51436b,_0x347eb1){logger['info']('unhold\x20fired:',_0x51436b[_0x4c03('0x30')]);var _0x3c8910=unholdValidation[_0x4c03('0x3b')](_0x51436b[_0x4c03('0x30')]);if(_0x3c8910[_0x4c03('0x2b')]>0x0){return _0x347eb1[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x3c8910);}var _0xf6c57e=_0x51436b['body'][_0x4c03('0x32')];var _0xcb0ea5=_0x51436b[_0x4c03('0x30')][_0x4c03('0x2a')];return getAgent(_0xf6c57e)['then'](function(_0x3ae27c){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3ae27c['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x3ae27c[_0x4c03('0x19')]),_0x4c03('0x43'),{'sessionId':_0xcb0ea5});return _0x347eb1[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x347eb1));};exports[_0x4c03('0x44')]=function(_0xb4ae5b,_0x23a5c6){logger['info'](_0x4c03('0x45'),_0x23a5c6[_0x4c03('0x30')]);var _0x27a996=callsValidation[_0x4c03('0x3b')](_0xb4ae5b[_0x4c03('0x30')]);if(_0x27a996['length']>0x0){return _0x23a5c6[_0x4c03('0x1a')](0x190)[_0x4c03('0x31')](_0x27a996);}var _0x4c2cf7=_0xb4ae5b['body'][_0x4c03('0x32')];var _0x1bd923=respondWithRpcPromise('VoiceChannels');var _0xf35b39=getAgent(_0x4c2cf7);return Promise[_0x4c03('0x26')]([_0x1bd923,_0xf35b39])[_0x4c03('0x1e')](function(_0x11798b){var _0x18de2b=_0x11798b[0x0];var _0x3a7603=_0x11798b[0x1];var _0x5188fb=_['filter'](_0x18de2b['rows'],function(_0x5a8040){return _0x5a8040['UserId']==_0x3a7603['id'];});return _0x23a5c6['status'](0xc8)[_0x4c03('0x31')]({'count':_0x5188fb[_0x4c03('0x2b')],'rows':_0x5188fb});})[_0x4c03('0x22')](handleError(_0x23a5c6));};exports[_0x4c03('0x46')]=function(_0x212eef,_0x45669f){logger[_0x4c03('0x12')](_0x4c03('0x47'),_0x212eef[_0x4c03('0x30')]);var _0x1252a1=conferenceValidation[_0x4c03('0x3b')](_0x212eef['body']);if(_0x1252a1[_0x4c03('0x2b')]>0x0){return _0x45669f['status'](0x190)[_0x4c03('0x31')](_0x1252a1);}var _0x4ac665=_0x212eef[_0x4c03('0x30')][_0x4c03('0x32')];return getAgent(_0x4ac665)[_0x4c03('0x1e')](function(_0x3a95be){logger['info'](_0x4c03('0x3c'),_0x3a95be['name']);emit(util[_0x4c03('0x36')](_0x4c03('0x37'),_0x3a95be[_0x4c03('0x19')]),'webbar:conference');return _0x45669f[_0x4c03('0x1a')](0xc8)[_0x4c03('0x31')]({'error':![],'message':'conference\x20executed!'});})[_0x4c03('0x22')](handleError(_0x45669f));};exports[_0x4c03('0x48')]=function(_0x13b490,_0x4af1a6){logger[_0x4c03('0x12')](_0x4c03('0x49'),_0x13b490[_0x4c03('0x30')]);var _0x3038aa=transferValidation['validate'](_0x13b490[_0x4c03('0x30')]);if(_0x3038aa['length']>0x0){return _0x4af1a6['status'](0x190)[_0x4c03('0x31')](_0x3038aa);}var _0x1b12b4=_0x13b490['body'][_0x4c03('0x32')];var _0x28768f=_0x13b490[_0x4c03('0x30')][_0x4c03('0x2a')];var _0x400e69=_0x13b490[_0x4c03('0x30')][_0x4c03('0x4a')];return getAgent(_0x1b12b4)[_0x4c03('0x1e')](function(_0x3356b0){logger[_0x4c03('0x12')](_0x4c03('0x3c'),_0x3356b0[_0x4c03('0x19')]);emit(util[_0x4c03('0x36')]('user:%s',_0x3356b0[_0x4c03('0x19')]),_0x4c03('0x4b'),{'sessionId':_0x28768f,'transferNumber':_0x400e69});return _0x4af1a6['status'](0xc8)[_0x4c03('0x31')]({'error':![],'message':_0x4c03('0x4c')});})[_0x4c03('0x22')](handleError(_0x4af1a6));}; \ No newline at end of file +var _0xac52=['log','error','stack','name','status','send','NotFound','request','message','result','catch','User','findOne','agent','then','VoiceChannels','all','rows','UserId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit'];(function(_0x34f0fb,_0x3323b2){var _0x9b7b2b=function(_0x3cca84){while(--_0x3cca84){_0x34f0fb['push'](_0x34f0fb['shift']());}};_0x9b7b2b(++_0x3323b2);}(_0xac52,0x122));var _0x2ac5=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0xac52[_0x26b80e];return _0x84a8a8;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x2ac5('0x0'));var db=require(_0x2ac5('0x1'))['db'];var config=require(_0x2ac5('0x2'));var util=require(_0x2ac5('0x3'));var BPromise=require(_0x2ac5('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x2ac5('0x5')][_0x2ac5('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x2ac5('0x7'));var Redis=require(_0x2ac5('0x8'));config[_0x2ac5('0x9')]=_['defaults'](config['redis'],{'host':_0x2ac5('0xa'),'port':0x18eb});var io=require(_0x2ac5('0xb'))(new Redis(config[_0x2ac5('0x9')]));var Schema=require(_0x2ac5('0xc'));var originateValidation=new Schema({'userId':{'type':_0x2ac5('0xd'),'required':[!![],_0x2ac5('0xe')]},'callNumber':{'type':_0x2ac5('0xf'),'required':[!![],_0x2ac5('0x10')]},'callerId':{'type':_0x2ac5('0xf')},'callbackUrl':{'type':_0x2ac5('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2ac5('0xe')]},'sessionId':{'type':_0x2ac5('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2ac5('0xd'),'required':[!![],_0x2ac5('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2ac5('0xf'),'required':[!![],_0x2ac5('0x11')]},'transferNumber':{'type':_0x2ac5('0xf'),'required':[!![],_0x2ac5('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x2ac5('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x2ac5('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2ac5('0xe')]},'sessionId':{'type':_0x2ac5('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2ac5('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2ac5('0xe')]}});function emit(_0x2396a3,_0x415a8c,_0x2ec753){logger[_0x2ac5('0x13')](_0x2396a3,_0x415a8c,JSON[_0x2ac5('0x14')](_0x2ec753));io['to'](_0x2396a3)[_0x2ac5('0x15')](_0x415a8c,_0x2ec753);}function handleError(_0x25e0eb){return function(_0x101a68){console[_0x2ac5('0x16')]('handleError:',_0x101a68,_0x101a68 instanceof RangeError);logger[_0x2ac5('0x17')](_0x101a68[_0x2ac5('0x18')]);if(_0x101a68 instanceof RangeError){if(_0x101a68[_0x2ac5('0x19')]){delete _0x101a68['name'];}_0x25e0eb[_0x2ac5('0x1a')](0x194)[_0x2ac5('0x1b')](_0x101a68);}else{if(_0x101a68['name']){delete _0x101a68[_0x2ac5('0x19')];}_0x25e0eb[_0x2ac5('0x1a')](0x1f4)[_0x2ac5('0x1b')](_0x101a68);}};}function checkError(){return function(_0x39fe38){if(!_0x39fe38){throw new RangeError(_0x2ac5('0x1c'));}return _0x39fe38;};}function respondWithRpcPromise(_0x2fc145,_0x2bd2cf){return new BPromise(function(_0x57a832,_0x28df07){var _0x6b9fb1=amiClient;return _0x6b9fb1[_0x2ac5('0x1d')](_0x2fc145,_0x2bd2cf)['then'](function(_0x40eddf){if(_0x40eddf[_0x2ac5('0x17')]){if(_0x40eddf[_0x2ac5('0x17')]['code']===0x1f4){return _0x28df07(_0x40eddf[_0x2ac5('0x17')][_0x2ac5('0x1e')]);}return _0x57a832(_0x40eddf[_0x2ac5('0x17')][_0x2ac5('0x1e')]);}else{_0x57a832(_0x40eddf[_0x2ac5('0x1f')]);}})[_0x2ac5('0x20')](function(_0x53791c){_0x28df07(_0x53791c);});});}function getAgent(_0xb8c01){return db[_0x2ac5('0x21')][_0x2ac5('0x22')]({'where':{'id':_0xb8c01,'role':_0x2ac5('0x23')}})[_0x2ac5('0x24')](checkError());}function getAgentCheckSession(_0x35bf65,_0x9ce264){return new BPromise(function(_0x31780f,_0x5d8a45){var _0x166c68=respondWithRpcPromise(_0x2ac5('0x25'));var _0xdf1196=getAgent(_0x35bf65);Promise[_0x2ac5('0x26')]([_0x166c68,_0xdf1196])[_0x2ac5('0x24')](function(_0x2b7eb6){var _0x5bd5ee=_0x2b7eb6[0x0];var _0xca4d63=_0x2b7eb6[0x1];var _0x1f6e1b=_['filter'](_0x5bd5ee[_0x2ac5('0x27')],function(_0x31edd9){return _0x31edd9[_0x2ac5('0x28')]==_0xca4d63['id']&&_0x31edd9['sessionId']==_0x9ce264;});if(_0x1f6e1b['length']==0x1){_0x31780f(_0xca4d63);}else{_0x5d8a45(new RangeError(_0x2ac5('0x29')+_0x9ce264+_0x2ac5('0x2a')));}});});}exports[_0x2ac5('0x2b')]=function(_0x1b18a5,_0x229530){logger['info'](_0x2ac5('0x2c'),_0x1b18a5[_0x2ac5('0x2d')]);var _0x5995a7=originateValidation[_0x2ac5('0xc')](_0x1b18a5[_0x2ac5('0x2d')]);if(_0x5995a7['length']>0x0){return _0x229530[_0x2ac5('0x1a')](0x190)[_0x2ac5('0x2e')](_0x5995a7);}var _0x9164c6=_0x1b18a5['body'][_0x2ac5('0x2f')];var _0x2c1dba=_0x1b18a5[_0x2ac5('0x2d')]['callNumber'];var _0x5cf7cd=_0x1b18a5[_0x2ac5('0x2d')]['callerId'];var _0x3cc442=_0x1b18a5['body'][_0x2ac5('0x30')];return getAgent(_0x9164c6)[_0x2ac5('0x24')](function(_0x5eedc7){logger[_0x2ac5('0x13')](_0x2ac5('0x31'),_0x5eedc7[_0x2ac5('0x19')]);emit(util[_0x2ac5('0x32')](_0x2ac5('0x33'),_0x5eedc7[_0x2ac5('0x19')]),_0x2ac5('0x34'),{'callNumber':_0x2c1dba,'callerId':_0x5cf7cd,'callbackUrl':_0x3cc442});return _0x229530[_0x2ac5('0x1a')](0xc8)[_0x2ac5('0x2e')]({'error':![],'message':_0x2ac5('0x35')});})[_0x2ac5('0x20')](handleError(_0x229530));};exports[_0x2ac5('0x36')]=function(_0x56eaa3,_0x591ac0){logger[_0x2ac5('0x13')](_0x2ac5('0x37'),_0x56eaa3[_0x2ac5('0x2d')]);var _0x3eef6f=hangupValidation[_0x2ac5('0xc')](_0x56eaa3[_0x2ac5('0x2d')]);if(_0x3eef6f[_0x2ac5('0x38')]>0x0){return _0x591ac0['status'](0x190)[_0x2ac5('0x2e')](_0x3eef6f);}var _0x17b6dd=_0x56eaa3[_0x2ac5('0x2d')][_0x2ac5('0x2f')];var _0x3de56b=_0x56eaa3[_0x2ac5('0x2d')][_0x2ac5('0x39')];return getAgent(_0x17b6dd)[_0x2ac5('0x24')](function(_0x29b64a){logger[_0x2ac5('0x13')](_0x2ac5('0x31'),_0x29b64a[_0x2ac5('0x19')]);emit(util['format'](_0x2ac5('0x33'),_0x29b64a[_0x2ac5('0x19')]),'webbar:hangup',{'sessionId':_0x3de56b});return _0x591ac0[_0x2ac5('0x1a')](0xc8)[_0x2ac5('0x2e')]({'error':![],'message':'hangup\x20executed!'});})[_0x2ac5('0x20')](handleError(_0x591ac0));};exports[_0x2ac5('0x3a')]=function(_0x31d12f,_0x3defb5){logger['info']('answer\x20fired:',_0x31d12f['body']);var _0x14a362=answerValidation[_0x2ac5('0xc')](_0x31d12f[_0x2ac5('0x2d')]);if(_0x14a362[_0x2ac5('0x38')]>0x0){return _0x3defb5[_0x2ac5('0x1a')](0x190)[_0x2ac5('0x2e')](_0x14a362);}var _0x3d0237=_0x31d12f['body'][_0x2ac5('0x2f')];var _0x2ce067=_0x31d12f[_0x2ac5('0x2d')][_0x2ac5('0x39')];return getAgent(_0x3d0237)[_0x2ac5('0x24')](function(_0xf0467e){logger[_0x2ac5('0x13')](_0x2ac5('0x31'),_0xf0467e[_0x2ac5('0x19')]);emit(util['format']('user:%s',_0xf0467e[_0x2ac5('0x19')]),_0x2ac5('0x3b'),{'sessionId':_0x2ce067});return _0x3defb5[_0x2ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x2ac5('0x3c')});})[_0x2ac5('0x20')](handleError(_0x3defb5));};exports[_0x2ac5('0x3d')]=function(_0x3eafff,_0x13b26e){logger['info'](_0x2ac5('0x3e'),_0x3eafff['body']);var _0x4b3cdd=holdValidation[_0x2ac5('0xc')](_0x3eafff[_0x2ac5('0x2d')]);if(_0x4b3cdd[_0x2ac5('0x38')]>0x0){return _0x13b26e['status'](0x190)['json'](_0x4b3cdd);}var _0xd679af=_0x3eafff[_0x2ac5('0x2d')][_0x2ac5('0x2f')];var _0x4b8282=_0x3eafff[_0x2ac5('0x2d')]['sessionId'];return getAgent(_0xd679af)['then'](function(_0x385483){logger[_0x2ac5('0x13')]('entityFound:',_0x385483[_0x2ac5('0x19')]);emit(util[_0x2ac5('0x32')](_0x2ac5('0x33'),_0x385483[_0x2ac5('0x19')]),_0x2ac5('0x3f'),{'sessionId':_0x4b8282});return _0x13b26e['status'](0xc8)[_0x2ac5('0x2e')]({'error':![],'message':_0x2ac5('0x40')});})['catch'](handleError(_0x13b26e));};exports['unhold']=function(_0x3e0fa9,_0x54a336){logger[_0x2ac5('0x13')](_0x2ac5('0x41'),_0x3e0fa9['body']);var _0x564995=unholdValidation['validate'](_0x3e0fa9['body']);if(_0x564995[_0x2ac5('0x38')]>0x0){return _0x54a336[_0x2ac5('0x1a')](0x190)[_0x2ac5('0x2e')](_0x564995);}var _0x53e70b=_0x3e0fa9[_0x2ac5('0x2d')][_0x2ac5('0x2f')];var _0x2e117e=_0x3e0fa9['body'][_0x2ac5('0x39')];return getAgent(_0x53e70b)[_0x2ac5('0x24')](function(_0x1a6f78){logger[_0x2ac5('0x13')]('entityFound:',_0x1a6f78[_0x2ac5('0x19')]);emit(util['format']('user:%s',_0x1a6f78[_0x2ac5('0x19')]),_0x2ac5('0x42'),{'sessionId':_0x2e117e});return _0x54a336['status'](0xc8)[_0x2ac5('0x2e')]({'error':![],'message':_0x2ac5('0x43')});})[_0x2ac5('0x20')](handleError(_0x54a336));};exports[_0x2ac5('0x44')]=function(_0x2a8e23,_0x251649){logger[_0x2ac5('0x13')](_0x2ac5('0x45'),_0x251649[_0x2ac5('0x2d')]);var _0x487938=callsValidation['validate'](_0x2a8e23['body']);if(_0x487938[_0x2ac5('0x38')]>0x0){return _0x251649[_0x2ac5('0x1a')](0x190)[_0x2ac5('0x2e')](_0x487938);}var _0x4a8eac=_0x2a8e23[_0x2ac5('0x2d')]['userId'];var _0x14f592=respondWithRpcPromise('VoiceChannels');var _0x3bda2f=getAgent(_0x4a8eac);return Promise['all']([_0x14f592,_0x3bda2f])[_0x2ac5('0x24')](function(_0x52b2c6){var _0x2abeab=_0x52b2c6[0x0];var _0x347b29=_0x52b2c6[0x1];var _0x4b1f26=_[_0x2ac5('0x46')](_0x2abeab[_0x2ac5('0x27')],function(_0x335de4){return _0x335de4['UserId']==_0x347b29['id'];});return _0x251649[_0x2ac5('0x1a')](0xc8)[_0x2ac5('0x2e')]({'count':_0x4b1f26['length'],'rows':_0x4b1f26});})[_0x2ac5('0x20')](handleError(_0x251649));};exports[_0x2ac5('0x47')]=function(_0x1d902d,_0x558e38){logger[_0x2ac5('0x13')](_0x2ac5('0x48'),_0x1d902d['body']);var _0x1de47a=conferenceValidation[_0x2ac5('0xc')](_0x1d902d[_0x2ac5('0x2d')]);if(_0x1de47a[_0x2ac5('0x38')]>0x0){return _0x558e38[_0x2ac5('0x1a')](0x190)[_0x2ac5('0x2e')](_0x1de47a);}var _0x3b8f97=_0x1d902d[_0x2ac5('0x2d')][_0x2ac5('0x2f')];return getAgent(_0x3b8f97)[_0x2ac5('0x24')](function(_0x3df33a){logger[_0x2ac5('0x13')]('entityFound:',_0x3df33a[_0x2ac5('0x19')]);emit(util[_0x2ac5('0x32')](_0x2ac5('0x33'),_0x3df33a[_0x2ac5('0x19')]),_0x2ac5('0x49'));return _0x558e38[_0x2ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x2ac5('0x4a')});})[_0x2ac5('0x20')](handleError(_0x558e38));};exports[_0x2ac5('0x4b')]=function(_0x4ca124,_0x1c9d3d){logger[_0x2ac5('0x13')](_0x2ac5('0x4c'),_0x4ca124[_0x2ac5('0x2d')]);var _0x388e84=transferValidation[_0x2ac5('0xc')](_0x4ca124[_0x2ac5('0x2d')]);if(_0x388e84[_0x2ac5('0x38')]>0x0){return _0x1c9d3d[_0x2ac5('0x1a')](0x190)['json'](_0x388e84);}var _0x5c1fbc=_0x4ca124[_0x2ac5('0x2d')][_0x2ac5('0x2f')];var _0x189927=_0x4ca124[_0x2ac5('0x2d')][_0x2ac5('0x39')];var _0x1dae3a=_0x4ca124[_0x2ac5('0x2d')][_0x2ac5('0x4d')];return getAgent(_0x5c1fbc)[_0x2ac5('0x24')](function(_0x2d1a57){logger[_0x2ac5('0x13')]('entityFound:',_0x2d1a57['name']);emit(util['format'](_0x2ac5('0x33'),_0x2d1a57[_0x2ac5('0x19')]),'webbar:transfer',{'sessionId':_0x189927,'transferNumber':_0x1dae3a});return _0x1c9d3d[_0x2ac5('0x1a')](0xc8)[_0x2ac5('0x2e')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x1c9d3d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index eb38fb8..47f24ee 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 _0xc339=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x584ebc,_0x27a6d4){var _0x4e4cc5=function(_0x40b9b0){while(--_0x40b9b0){_0x584ebc['push'](_0x584ebc['shift']());}};_0x4e4cc5(++_0x27a6d4);}(_0xc339,0x141));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9c33('0x0'));var util=require(_0x9c33('0x1'));var path=require('path');var timeout=require(_0x9c33('0x2'));var express=require(_0x9c33('0x3'));var router=express[_0x9c33('0x4')]();var auth=require(_0x9c33('0x5'));var interaction=require(_0x9c33('0x6'));var config=require(_0x9c33('0x7'));var controller=require('./whatsappAccount.controller');router[_0x9c33('0x8')]('/',auth[_0x9c33('0x9')](),controller[_0x9c33('0xa')]);router[_0x9c33('0x8')](_0x9c33('0xb'),auth[_0x9c33('0x9')](),controller[_0x9c33('0xc')]);router[_0x9c33('0x8')](_0x9c33('0xd'),auth['isAuthenticated'](),controller[_0x9c33('0xe')]);router[_0x9c33('0x8')](_0x9c33('0xf'),auth['isAuthenticated'](),controller[_0x9c33('0x10')]);router[_0x9c33('0x8')](_0x9c33('0x11'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x12')]);router[_0x9c33('0x8')](_0x9c33('0x13'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x14')]);router[_0x9c33('0x8')](_0x9c33('0x15'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x16')]);router[_0x9c33('0x17')]('/',auth['isAuthenticated'](),controller[_0x9c33('0x18')]);router[_0x9c33('0x17')](_0x9c33('0xf'),auth[_0x9c33('0x9')](),controller['addDisposition']);router[_0x9c33('0x17')](_0x9c33('0x11'),auth[_0x9c33('0x9')](),controller['addAnswer']);router[_0x9c33('0x17')](_0x9c33('0x13'),auth[_0x9c33('0x9')](),controller['addAgents']);router['post'](_0x9c33('0x15'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x19')]);router['post'](_0x9c33('0x1a'),controller[_0x9c33('0x1b')]);router[_0x9c33('0x17')](_0x9c33('0x1c'),auth['isAuthenticated'](),controller[_0x9c33('0x1d')]);router[_0x9c33('0x1e')](_0x9c33('0xd'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x1f')]);router[_0x9c33('0x20')](_0x9c33('0xd'),auth[_0x9c33('0x9')](),controller[_0x9c33('0x21')]);router[_0x9c33('0x20')]('/:id/dispositions',auth[_0x9c33('0x9')](),controller[_0x9c33('0x22')]);router[_0x9c33('0x20')]('/:id/canned_answers',auth[_0x9c33('0x9')](),controller[_0x9c33('0x23')]);router[_0x9c33('0x20')]('/:id/users',auth[_0x9c33('0x9')](),controller['removeAgents']);module[_0x9c33('0x24')]=router; \ No newline at end of file +var _0xc73a=['describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addApplications','notify','send','put','/:id','update','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x185abb,_0x1cfbb8){var _0x1971a2=function(_0x268b36){while(--_0x268b36){_0x185abb['push'](_0x185abb['shift']());}};_0x1971a2(++_0x1cfbb8);}(_0xc73a,0x72));var _0xac73=function(_0x4076d1,_0x3b70fb){_0x4076d1=_0x4076d1-0x0;var _0x3228a8=_0xc73a[_0x4076d1];return _0x3228a8;};'use strict';var multer=require('multer');var util=require(_0xac73('0x0'));var path=require(_0xac73('0x1'));var timeout=require(_0xac73('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xac73('0x3'));var interaction=require(_0xac73('0x4'));var config=require(_0xac73('0x5'));var controller=require('./whatsappAccount.controller');router[_0xac73('0x6')]('/',auth[_0xac73('0x7')](),controller[_0xac73('0x8')]);router['get'](_0xac73('0x9'),auth[_0xac73('0x7')](),controller[_0xac73('0xa')]);router[_0xac73('0x6')]('/:id',auth[_0xac73('0x7')](),controller['show']);router['get'](_0xac73('0xb'),auth[_0xac73('0x7')](),controller[_0xac73('0xc')]);router[_0xac73('0x6')](_0xac73('0xd'),auth[_0xac73('0x7')](),controller[_0xac73('0xe')]);router[_0xac73('0x6')]('/:id/users',auth[_0xac73('0x7')](),controller[_0xac73('0xf')]);router[_0xac73('0x6')](_0xac73('0x10'),auth[_0xac73('0x7')](),controller[_0xac73('0x11')]);router['post']('/',auth[_0xac73('0x7')](),controller['create']);router[_0xac73('0x12')](_0xac73('0xb'),auth[_0xac73('0x7')](),controller[_0xac73('0x13')]);router['post'](_0xac73('0xd'),auth[_0xac73('0x7')](),controller['addAnswer']);router[_0xac73('0x12')](_0xac73('0x14'),auth[_0xac73('0x7')](),controller['addAgents']);router[_0xac73('0x12')](_0xac73('0x10'),auth[_0xac73('0x7')](),controller[_0xac73('0x15')]);router[_0xac73('0x12')]('/:id/notify',controller[_0xac73('0x16')]);router[_0xac73('0x12')]('/:id/send',auth[_0xac73('0x7')](),controller[_0xac73('0x17')]);router[_0xac73('0x18')](_0xac73('0x19'),auth[_0xac73('0x7')](),controller[_0xac73('0x1a')]);router[_0xac73('0x1b')](_0xac73('0x19'),auth[_0xac73('0x7')](),controller['destroy']);router[_0xac73('0x1b')](_0xac73('0xb'),auth[_0xac73('0x7')](),controller['removeDispositions']);router[_0xac73('0x1b')]('/:id/canned_answers',auth[_0xac73('0x7')](),controller[_0xac73('0x1c')]);router[_0xac73('0x1b')](_0xac73('0x14'),auth[_0xac73('0x7')](),controller[_0xac73('0x1d')]);module[_0xac73('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a5d45e1..46d063a 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 _0xbbc6=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x34a81b,_0x1829bd){var _0x28ce4b=function(_0x228f18){while(--_0x228f18){_0x34a81b['push'](_0x34a81b['shift']());}};_0x28ce4b(++_0x1829bd);}(_0xbbc6,0x19e));var _0x6bbc=function(_0x12727b,_0x46b50c){_0x12727b=_0x12727b-0x0;var _0x2f1b37=_0xbbc6[_0x12727b];return _0x2f1b37;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6bbc('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bbc('0x1')],'unique':_0x6bbc('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x6bbc('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x6bbc('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6bbc('0x3')]();}},'phone':{'type':Sequelize[_0x6bbc('0x1')]},'type':{'type':Sequelize['ENUM'](_0x6bbc('0x4'))},'accountSid':{'type':Sequelize[_0x6bbc('0x1')]},'authToken':{'type':Sequelize[_0x6bbc('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6bbc('0x5');}},'notificationSound':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6bbc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6bbc('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6bbc('0x6')],'defaultValue':![],'comment':_0x6bbc('0x9'),'set':function(_0xcac5d1){if(!_0xcac5d1){this['setDataValue'](_0x6bbc('0xa'),null);}this['setDataValue'](_0x6bbc('0xb'),_0xcac5d1);}},'description':{'type':Sequelize[_0x6bbc('0x1')]}}; \ No newline at end of file +var _0x38b1=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2f17ff,_0x10bf85){var _0x571f17=function(_0xd2a219){while(--_0xd2a219){_0x2f17ff['push'](_0x2f17ff['shift']());}};_0x571f17(++_0x10bf85);}(_0x38b1,0x90));var _0x138b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b1[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x138b('0x0'));var rs=require(_0x138b('0x1'));module[_0x138b('0x2')]={'name':{'type':Sequelize[_0x138b('0x3')],'unique':_0x138b('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x138b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x138b('0x3')],'defaultValue':function(){return rs[_0x138b('0x5')]();}},'phone':{'type':Sequelize[_0x138b('0x3')]},'type':{'type':Sequelize['ENUM'](_0x138b('0x6'))},'accountSid':{'type':Sequelize[_0x138b('0x3')]},'authToken':{'type':Sequelize[_0x138b('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x138b('0x7');}},'notificationSound':{'type':Sequelize[_0x138b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x138b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x138b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x138b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x138b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x138b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x138b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x138b('0x9')],'comment':_0x138b('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x138b('0x8')],'defaultValue':![],'comment':_0x138b('0xb'),'set':function(_0x38f065){if(!_0x38f065){this[_0x138b('0xc')]('mandatoryDispositionPauseId',null);}this[_0x138b('0xc')](_0x138b('0xd'),_0x38f065);}},'description':{'type':Sequelize[_0x138b('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d00ff61..66f224e 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 _0x1be1=['ListId','mobile','From','replace','whatsapp:','messageId','MessageSid','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','push','close','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','order','sort','where','filter','merge','options','WhatsappAccount','findAll','rows','catch','show','keys','find','create','body','user','role','get','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','WhatsappAccountId','includeAll','include','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','Applications','applications','asc','account','CmContact','difference','createdAt','updatedAt','CompanyId'];(function(_0x24db71,_0x1c463f){var _0x466dbd=function(_0x2f8680){while(--_0x2f8680){_0x24db71['push'](_0x24db71['shift']());}};_0x466dbd(++_0x1c463f);}(_0x1be1,0x192));var _0x11be=function(_0x3a529a,_0x1b1fd8){_0x3a529a=_0x3a529a-0x0;var _0x4968da=_0x1be1[_0x3a529a];return _0x4968da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x11be('0x0'));var zipdir=require(_0x11be('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11be('0x2'));var moment=require(_0x11be('0x3'));var BPromise=require(_0x11be('0x4'));var Mustache=require(_0x11be('0x5'));var util=require('util');var path=require(_0x11be('0x6'));var sox=require(_0x11be('0x7'));var csv=require(_0x11be('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x8'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var db=require(_0x11be('0x15'))['db'];config[_0x11be('0x16')]=_['defaults'](config[_0x11be('0x16')],{'host':_0x11be('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11be('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function checkPasswordPattern(_0x5aa444,_0x588871,_0x2280e2){if(_0x2280e2){var _0x52bbef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x52bbef[_0x11be('0x18')](_0x588871)){return _0x5aa444;}else{throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x1b'));}}else{return _0x5aa444;}}function respondWithRpcPromise(_0x547037,_0x2ed725,_0x403d7a,_0x56ab61){return new BPromise(function(_0x299f45,_0xc3263c){var _0x23aa5f=_0x56ab61||client;return _0x23aa5f['request'](_0x547037,_0x403d7a)['then'](function(_0x141391){logger[_0x11be('0x1c')](_0x11be('0x1d'),_0x2ed725,_0x11be('0x1e'));logger['debug'](_0x11be('0x1f'),_0x2ed725,_0x11be('0x1e'),JSON[_0x11be('0x20')](_0x141391));if(_0x141391[_0x11be('0x21')]){if(_0x141391[_0x11be('0x21')][_0x11be('0x22')]===0x1f4){logger[_0x11be('0x21')](_0x11be('0x1d'),_0x2ed725,_0x141391[_0x11be('0x21')][_0x11be('0x23')]);return _0xc3263c(_0x141391['error'][_0x11be('0x23')]);}logger[_0x11be('0x21')](_0x11be('0x1d'),_0x2ed725,_0x141391['error']['message']);return _0x299f45(_0x141391[_0x11be('0x21')][_0x11be('0x23')]);}else{logger[_0x11be('0x1c')]('WhatsappAccount,\x20%s,\x20%s',_0x2ed725,_0x11be('0x1e'));_0x299f45(_0x141391['result'][_0x11be('0x23')]);}})['catch'](function(_0x28310d){logger[_0x11be('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x2ed725,_0x28310d);_0xc3263c(_0x28310d);});});}function respondWithStatusCode(_0x48029b,_0x28b3a0){_0x28b3a0=_0x28b3a0||0xcc;return function(_0x1d3b5c){if(_0x1d3b5c){return _0x48029b[_0x11be('0x24')](_0x28b3a0);}return _0x48029b[_0x11be('0x25')](_0x28b3a0)[_0x11be('0x26')]();};}function respondWithResult(_0xf5a6ac,_0x2cf9aa){_0x2cf9aa=_0x2cf9aa||0xc8;return function(_0x43ab30){if(_0x43ab30){return _0xf5a6ac['status'](_0x2cf9aa)[_0x11be('0x27')](_0x43ab30);}};}function respondWithFilteredResult(_0x4e899f,_0x182f6b){return function(_0x147b62){if(_0x147b62){var _0x510476=_0x147b62[_0x11be('0x28')],_0x584d4c=_0x182f6b[_0x11be('0x29')],_0x49fd5c=_0x182f6b[_0x11be('0x29')]+_0x182f6b[_0x11be('0x2a')],_0x265fc9;if(_0x49fd5c>=_0x510476){_0x49fd5c=_0x510476;_0x265fc9=0xc8;}else{_0x265fc9=0xce;}_0x4e899f[_0x11be('0x25')](_0x265fc9);return _0x4e899f[_0x11be('0x2b')](_0x11be('0x2c'),_0x584d4c+'-'+_0x49fd5c+'/'+_0x510476)['json'](_0x147b62);}return null;};}function patchUpdates(_0x71236f){return function(_0x3c1aa2){try{jsonpatch[_0x11be('0x2d')](_0x3c1aa2,_0x71236f,!![]);}catch(_0xff5e59){return BPromise[_0x11be('0x2e')](_0xff5e59);}return _0x3c1aa2[_0x11be('0x2f')]();};}function saveUpdates(_0x4cb8a6,_0x21ac91){return function(_0x440a77){if(_0x440a77){return _0x440a77[_0x11be('0x30')](_0x4cb8a6)[_0x11be('0x31')](function(_0x228bd3){return _0x228bd3;});}return null;};}function removeEntity(_0x53cd67,_0x368c8d){return function(_0x254be5){if(_0x254be5){return _0x254be5[_0x11be('0x32')]()['then'](function(){var _0x2c6fb2=_0x254be5['get']({'plain':!![]});var _0x4c7b47='WhatsappAccounts';return db['UserProfileResource'][_0x11be('0x32')]({'where':{'type':_0x4c7b47,'resourceId':_0x2c6fb2['id']}})[_0x11be('0x31')](function(){return _0x254be5;});})[_0x11be('0x31')](function(){_0x53cd67['status'](0xcc)[_0x11be('0x26')]();});}};}function handleEntityNotFound(_0x1866d8,_0x56ecd2){return function(_0x370d10){if(!_0x370d10){_0x1866d8['sendStatus'](0x194);}return _0x370d10;};}function handleError(_0x222f84,_0x58e702){_0x58e702=_0x58e702||0x1f4;return function(_0x4b4eb8){logger[_0x11be('0x21')](_0x4b4eb8[_0x11be('0x33')]);if(_0x4b4eb8[_0x11be('0x34')]){delete _0x4b4eb8['name'];}_0x222f84[_0x11be('0x25')](_0x58e702)[_0x11be('0x35')](_0x4b4eb8);};}exports[_0x11be('0x36')]=function(_0x18d402,_0x5b519b){var _0x11d5ea={'include':[{'model':db[_0x11be('0x37')],'as':_0x11be('0x38')}]},_0x361877={},_0x1c680e={'count':0x0,'rows':[]};var _0x1b1aac=_[_0x11be('0x39')](db['WhatsappAccount'][_0x11be('0x3a')],function(_0x399d39){return{'name':_0x399d39['fieldName'],'type':_0x399d39[_0x11be('0x3b')][_0x11be('0x3c')]};});_0x361877['model']=_[_0x11be('0x39')](_0x1b1aac,'name');_0x361877[_0x11be('0x3d')]=_['keys'](_0x18d402[_0x11be('0x3d')]);_0x361877[_0x11be('0x3e')]=_['intersection'](_0x361877[_0x11be('0x3f')],_0x361877['query']);_0x11d5ea[_0x11be('0x40')]=_[_0x11be('0x41')](_0x361877[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x18d402[_0x11be('0x3d')][_0x11be('0x42')]));_0x11d5ea[_0x11be('0x40')]=_0x11d5ea['attributes'][_0x11be('0x43')]?_0x11d5ea[_0x11be('0x40')]:_0x361877[_0x11be('0x3f')];if(!_0x18d402[_0x11be('0x3d')]['hasOwnProperty']('nolimit')){_0x11d5ea['limit']=qs[_0x11be('0x2a')](_0x18d402['query'][_0x11be('0x2a')]);_0x11d5ea['offset']=qs[_0x11be('0x29')](_0x18d402[_0x11be('0x3d')][_0x11be('0x29')]);}_0x11d5ea[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x18d402[_0x11be('0x3d')][_0x11be('0x45')]);_0x11d5ea['where']=qs[_0x11be('0x3e')](_['pick'](_0x18d402[_0x11be('0x3d')],_0x361877[_0x11be('0x3e')]),_0x1b1aac);if(_0x18d402[_0x11be('0x3d')]['filter']){_0x11d5ea['where']=_['merge'](_0x11d5ea[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x1b1aac,function(_0x49daf5){if(_0x49daf5['type']!=='VIRTUAL'){var _0x44e2e8={};_0x44e2e8[_0x49daf5[_0x11be('0x34')]]={'$like':'%'+_0x18d402[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x44e2e8;}})});}_0x11d5ea=_[_0x11be('0x48')]({},_0x11d5ea,_0x18d402[_0x11be('0x49')]);var _0x34b993={'where':_0x11d5ea[_0x11be('0x46')]};return db[_0x11be('0x4a')][_0x11be('0x28')](_0x34b993)[_0x11be('0x31')](function(_0x493799){_0x1c680e[_0x11be('0x28')]=_0x493799;if(_0x18d402[_0x11be('0x3d')]['includeAll']){_0x11d5ea['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x11be('0x4b')](_0x11d5ea);})['then'](function(_0x2f8222){_0x1c680e[_0x11be('0x4c')]=_0x2f8222;return _0x1c680e;})[_0x11be('0x31')](respondWithFilteredResult(_0x5b519b,_0x11d5ea))[_0x11be('0x4d')](handleError(_0x5b519b,null));};exports[_0x11be('0x4e')]=function(_0x3af729,_0x3bba53){var _0xc8c4a4={'raw':![],'where':{'id':_0x3af729['params']['id']},'include':[{'model':db[_0x11be('0x37')],'as':'mandatoryDispositionPause'}]},_0x3ebd7e={};_0x3ebd7e[_0x11be('0x3f')]=_[_0x11be('0x4f')](db['WhatsappAccount'][_0x11be('0x3a')]);_0x3ebd7e[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3af729[_0x11be('0x3d')]);_0x3ebd7e[_0x11be('0x3e')]=_['intersection'](_0x3ebd7e['model'],_0x3ebd7e[_0x11be('0x3d')]);_0xc8c4a4[_0x11be('0x40')]=_['intersection'](_0x3ebd7e['model'],qs[_0x11be('0x42')](_0x3af729[_0x11be('0x3d')][_0x11be('0x42')]));_0xc8c4a4['attributes']=_0xc8c4a4['attributes']['length']?_0xc8c4a4[_0x11be('0x40')]:_0x3ebd7e[_0x11be('0x3f')];if(_0x3af729[_0x11be('0x3d')]['includeAll']){_0xc8c4a4['include']=[{'all':!![]}];}_0xc8c4a4=_[_0x11be('0x48')]({},_0xc8c4a4,_0x3af729[_0x11be('0x49')]);return db[_0x11be('0x4a')][_0x11be('0x50')](_0xc8c4a4)['then'](handleEntityNotFound(_0x3bba53,null))[_0x11be('0x31')](respondWithResult(_0x3bba53,null))['catch'](handleError(_0x3bba53,null));};exports['create']=function(_0x568f20,_0x5aa6bf){return db[_0x11be('0x4a')][_0x11be('0x51')](_0x568f20[_0x11be('0x52')],{})[_0x11be('0x31')](function(_0x420415){var _0x17b4f9=_0x568f20[_0x11be('0x53')]['get']({'plain':!![]});if(!_0x17b4f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17b4f9[_0x11be('0x54')]===_0x11be('0x53')){var _0x11b969=_0x420415[_0x11be('0x55')]({'plain':!![]});var _0x5c7ed0=_0x11be('0x56');return db[_0x11be('0x57')][_0x11be('0x50')]({'where':{'name':_0x5c7ed0,'userProfileId':_0x17b4f9[_0x11be('0x58')]},'raw':!![]})['then'](function(_0x1aa57d){if(_0x1aa57d&&_0x1aa57d[_0x11be('0x59')]===0x0){return db[_0x11be('0x5a')]['create']({'name':_0x11b969[_0x11be('0x34')],'resourceId':_0x11b969['id'],'type':_0x1aa57d[_0x11be('0x34')],'sectionId':_0x1aa57d['id']},{})['then'](function(){return _0x420415;});}else{return _0x420415;}})['catch'](function(_0x53975a){logger[_0x11be('0x21')](_0x11be('0x5b'),_0x53975a);throw _0x53975a;});}return _0x420415;})[_0x11be('0x31')](respondWithResult(_0x5aa6bf,0xc9))['catch'](handleError(_0x5aa6bf,null));};exports[_0x11be('0x30')]=function(_0x3ada78,_0x7f62ed){if(_0x3ada78[_0x11be('0x52')]['id']){delete _0x3ada78[_0x11be('0x52')]['id'];}return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x3ada78[_0x11be('0x5c')]['id']},'include':[{'model':db[_0x11be('0x37')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x7f62ed,null))[_0x11be('0x31')](saveUpdates(_0x3ada78[_0x11be('0x52')],null))['then'](respondWithResult(_0x7f62ed,null))[_0x11be('0x4d')](handleError(_0x7f62ed,null));};exports[_0x11be('0x32')]=function(_0x42d4ee,_0x7aed92){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x42d4ee[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7aed92,null))['then'](removeEntity(_0x7aed92,null))[_0x11be('0x4d')](handleError(_0x7aed92,null));};exports[_0x11be('0x5d')]=function(_0x42ca5e,_0x5395c2){return db[_0x11be('0x4a')][_0x11be('0x5d')]()[_0x11be('0x31')](respondWithResult(_0x5395c2,null))[_0x11be('0x4d')](handleError(_0x5395c2,null));};exports[_0x11be('0x5e')]=function(_0x58a3b2,_0x32703c,_0xcefe71){if(_0x58a3b2[_0x11be('0x52')]['id']){delete _0x58a3b2[_0x11be('0x52')]['id'];}return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x58a3b2[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x32703c,null))[_0x11be('0x31')](function(_0x352b2f){if(_0x352b2f){_0x58a3b2['body']['WhatsappAccountId']=_0x352b2f['id'];return db[_0x11be('0x5f')]['create'](_0x58a3b2[_0x11be('0x52')]);}})[_0x11be('0x31')](respondWithResult(_0x32703c,null))[_0x11be('0x4d')](handleError(_0x32703c,null));};exports[_0x11be('0x60')]=function(_0x3d7188,_0x3a776d,_0x1943f2){var _0x3cb405={'raw':![],'where':{}};var _0x18f009={};var _0x48de70={'count':0x0,'rows':[]};return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x3d7188[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a776d,null))[_0x11be('0x31')](function(_0x1e3d94){if(_0x1e3d94){_0x18f009['model']=_['keys'](db['Disposition']['rawAttributes']);_0x18f009[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3d7188[_0x11be('0x3d')]);_0x18f009[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x18f009['model'],_0x18f009[_0x11be('0x3d')]);_0x3cb405[_0x11be('0x40')]=_[_0x11be('0x41')](_0x18f009[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x3d7188['query'][_0x11be('0x42')]));_0x3cb405[_0x11be('0x40')]=_0x3cb405[_0x11be('0x40')][_0x11be('0x43')]?_0x3cb405['attributes']:_0x18f009[_0x11be('0x3f')];if(!_0x3d7188[_0x11be('0x3d')][_0x11be('0x62')](_0x11be('0x63'))){_0x3cb405[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x3d7188['query'][_0x11be('0x2a')]);_0x3cb405[_0x11be('0x29')]=qs[_0x11be('0x29')](_0x3d7188[_0x11be('0x3d')]['offset']);}_0x3cb405[_0x11be('0x44')]=qs['sort'](_0x3d7188[_0x11be('0x3d')][_0x11be('0x45')]);_0x3cb405[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x3d7188[_0x11be('0x3d')],_0x18f009[_0x11be('0x3e')]));_0x3cb405['where'][_0x11be('0x64')]=_0x1e3d94['id'];if(_0x3d7188[_0x11be('0x3d')][_0x11be('0x47')]){_0x3cb405[_0x11be('0x46')]=_['merge'](_0x3cb405[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x3cb405[_0x11be('0x40')],function(_0x45da8c){var _0x3e4ecd={};_0x3e4ecd[_0x45da8c]={'$like':'%'+_0x3d7188[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x3e4ecd;})});}_0x3cb405=_[_0x11be('0x48')]({},_0x3cb405,_0x3d7188['options']);return db[_0x11be('0x5f')]['count']({'where':_0x3cb405['where']})[_0x11be('0x31')](function(_0x658255){_0x48de70[_0x11be('0x28')]=_0x658255;if(_0x3d7188[_0x11be('0x3d')][_0x11be('0x65')]){_0x3cb405[_0x11be('0x66')]=[{'all':!![]}];}return db[_0x11be('0x5f')]['findAll'](_0x3cb405);})['then'](function(_0xf13875){_0x48de70['rows']=_0xf13875;return _0x48de70;});}})['then'](respondWithFilteredResult(_0x3a776d,_0x3cb405))[_0x11be('0x4d')](handleError(_0x3a776d,null));};exports['removeDispositions']=function(_0x352419,_0x380eeb,_0x485968){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x352419['params']['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x380eeb,null))[_0x11be('0x31')](function(_0x511eaa){if(_0x511eaa){return _0x511eaa[_0x11be('0x67')](_0x352419[_0x11be('0x3d')][_0x11be('0x68')]);}})[_0x11be('0x31')](respondWithStatusCode(_0x380eeb,null))[_0x11be('0x4d')](handleError(_0x380eeb,null));};exports[_0x11be('0x69')]=function(_0x11cebb,_0x543683,_0x33210a){if(_0x11cebb[_0x11be('0x52')]['id']){delete _0x11cebb[_0x11be('0x52')]['id'];}return db['WhatsappAccount'][_0x11be('0x50')]({'where':{'id':_0x11cebb[_0x11be('0x5c')]['id']}})['then'](handleEntityNotFound(_0x543683,null))[_0x11be('0x31')](function(_0x290250){if(_0x290250){_0x11cebb[_0x11be('0x52')]['WhatsappAccountId']=_0x290250['id'];return db['CannedAnswer']['create'](_0x11cebb[_0x11be('0x52')]);}})[_0x11be('0x31')](respondWithResult(_0x543683,null))[_0x11be('0x4d')](handleError(_0x543683,null));};exports[_0x11be('0x6a')]=function(_0x3074f9,_0x4bb42f,_0x250caa){var _0x12917e={'raw':![],'where':{}};var _0x43dcfe={};var _0x3eefd1={'count':0x0,'rows':[]};return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x3074f9['params']['id']}})['then'](handleEntityNotFound(_0x4bb42f,null))[_0x11be('0x31')](function(_0x5dd85d){if(_0x5dd85d){_0x43dcfe[_0x11be('0x3f')]=_[_0x11be('0x4f')](db['CannedAnswer'][_0x11be('0x3a')]);_0x43dcfe[_0x11be('0x3d')]=_[_0x11be('0x4f')](_0x3074f9[_0x11be('0x3d')]);_0x43dcfe[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x43dcfe['model'],_0x43dcfe[_0x11be('0x3d')]);_0x12917e['attributes']=_[_0x11be('0x41')](_0x43dcfe['model'],qs[_0x11be('0x42')](_0x3074f9[_0x11be('0x3d')][_0x11be('0x42')]));_0x12917e[_0x11be('0x40')]=_0x12917e[_0x11be('0x40')][_0x11be('0x43')]?_0x12917e[_0x11be('0x40')]:_0x43dcfe[_0x11be('0x3f')];if(!_0x3074f9['query'][_0x11be('0x62')](_0x11be('0x63'))){_0x12917e['limit']=qs[_0x11be('0x2a')](_0x3074f9[_0x11be('0x3d')][_0x11be('0x2a')]);_0x12917e['offset']=qs['offset'](_0x3074f9[_0x11be('0x3d')]['offset']);}_0x12917e[_0x11be('0x44')]=qs['sort'](_0x3074f9[_0x11be('0x3d')][_0x11be('0x45')]);_0x12917e[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x3074f9[_0x11be('0x3d')],_0x43dcfe[_0x11be('0x3e')]));_0x12917e[_0x11be('0x46')][_0x11be('0x64')]=_0x5dd85d['id'];if(_0x3074f9[_0x11be('0x3d')][_0x11be('0x47')]){_0x12917e[_0x11be('0x46')]=_[_0x11be('0x48')](_0x12917e[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x12917e['attributes'],function(_0x30b984){var _0x27aafe={};_0x27aafe[_0x30b984]={'$like':'%'+_0x3074f9[_0x11be('0x3d')]['filter']+'%'};return _0x27aafe;})});}_0x12917e=_['merge']({},_0x12917e,_0x3074f9[_0x11be('0x49')]);return db[_0x11be('0x6b')]['count']({'where':_0x12917e[_0x11be('0x46')]})[_0x11be('0x31')](function(_0x3c583b){_0x3eefd1[_0x11be('0x28')]=_0x3c583b;if(_0x3074f9[_0x11be('0x3d')]['includeAll']){_0x12917e['include']=[{'all':!![]}];}return db[_0x11be('0x6b')][_0x11be('0x4b')](_0x12917e);})[_0x11be('0x31')](function(_0x3ae6a2){_0x3eefd1['rows']=_0x3ae6a2;return _0x3eefd1;});}})['then'](respondWithFilteredResult(_0x4bb42f,_0x12917e))[_0x11be('0x4d')](handleError(_0x4bb42f,null));};exports[_0x11be('0x6c')]=function(_0x3f5f7c,_0x5985dd,_0xcec3f5){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x3f5f7c[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x5985dd,null))['then'](function(_0x214091){if(_0x214091){return _0x214091['removeAnswers'](_0x3f5f7c['query'][_0x11be('0x68')]);}})[_0x11be('0x31')](respondWithStatusCode(_0x5985dd,null))['catch'](handleError(_0x5985dd,null));};exports['addAgents']=function(_0x5334bd,_0x39bc3a,_0x185aa0){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x5334bd[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x39bc3a,null))['then'](function(_0x1e4fed){if(_0x1e4fed){return _0x1e4fed[_0x11be('0x6d')](_0x5334bd[_0x11be('0x52')][_0x11be('0x68')],_[_0x11be('0x6e')](_0x5334bd[_0x11be('0x52')],[_0x11be('0x68'),'id'])||{})[_0x11be('0x6f')](function(_0x440f2e){for(var _0x41450f=0x0;_0x41450f<_0x5334bd[_0x11be('0x52')]['ids'][_0x11be('0x43')];_0x41450f+=0x1){socket['emit'](_0x11be('0x70'),{'UserId':_0x5334bd[_0x11be('0x52')][_0x11be('0x68')][_0x41450f],'WhatsappAccountId':_0x5334bd[_0x11be('0x5c')]['id']});}return _0x440f2e;});}})[_0x11be('0x31')](respondWithResult(_0x39bc3a,null))['catch'](handleError(_0x39bc3a,null));};exports[_0x11be('0x71')]=function(_0x1da9be,_0x543a39,_0x218d63){return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x1da9be[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x543a39,null))[_0x11be('0x31')](function(_0x1be631){if(_0x1be631){return _0x1be631['removeAgents'](_0x1da9be[_0x11be('0x3d')][_0x11be('0x68')])[_0x11be('0x31')](function(){if(_[_0x11be('0x72')](_0x1da9be['query'][_0x11be('0x68')])){for(var _0x248c08=0x0;_0x248c08<_0x1da9be[_0x11be('0x3d')][_0x11be('0x68')]['length'];_0x248c08+=0x1){socket[_0x11be('0x73')](_0x11be('0x74'),{'UserId':Number(_0x1da9be[_0x11be('0x3d')]['ids'][_0x248c08]),'WhatsappAccountId':Number(_0x1da9be[_0x11be('0x5c')]['id'])});}}else{socket[_0x11be('0x73')](_0x11be('0x74'),{'UserId':Number(_0x1da9be['query'][_0x11be('0x68')]),'WhatsappAccountId':Number(_0x1da9be['params']['id'])});}});}})[_0x11be('0x31')](respondWithStatusCode(_0x543a39,null))[_0x11be('0x4d')](handleError(_0x543a39,null));};exports[_0x11be('0x75')]=function(_0x19729f,_0x5c6843,_0x51412c){var _0x317285={};var _0x2e7d79={};var _0x3a7cc8;var _0x561f78;return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x19729f['params']['id']}})['then'](handleEntityNotFound(_0x5c6843,null))[_0x11be('0x31')](function(_0x348751){if(_0x348751){_0x3a7cc8=_0x348751;_0x2e7d79[_0x11be('0x3f')]=_[_0x11be('0x4f')](db[_0x11be('0x76')][_0x11be('0x3a')]);_0x2e7d79['query']=_['keys'](_0x19729f[_0x11be('0x3d')]);_0x2e7d79[_0x11be('0x3e')]=_[_0x11be('0x41')](_0x2e7d79['model'],_0x2e7d79[_0x11be('0x3d')]);_0x317285[_0x11be('0x40')]=_[_0x11be('0x41')](_0x2e7d79[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x19729f['query'][_0x11be('0x42')]));_0x317285[_0x11be('0x40')]=_0x317285[_0x11be('0x40')][_0x11be('0x43')]?_0x317285['attributes']:_0x2e7d79[_0x11be('0x3f')];_0x317285[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x19729f[_0x11be('0x3d')][_0x11be('0x45')]);_0x317285['where']=qs[_0x11be('0x3e')](_['pick'](_0x19729f[_0x11be('0x3d')],_0x2e7d79[_0x11be('0x3e')]));if(_0x19729f[_0x11be('0x3d')][_0x11be('0x47')]){_0x317285[_0x11be('0x46')]=_[_0x11be('0x48')](_0x317285[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x317285[_0x11be('0x40')],function(_0x123f5f){var _0x41bbbd={};_0x41bbbd[_0x123f5f]={'$like':'%'+_0x19729f[_0x11be('0x3d')][_0x11be('0x47')]+'%'};return _0x41bbbd;})});}_0x317285=_[_0x11be('0x48')]({},_0x317285,_0x19729f['options']);return _0x3a7cc8[_0x11be('0x75')](_0x317285);}})[_0x11be('0x31')](function(_0x7f506){if(_0x7f506){_0x561f78=_0x7f506['length'];if(!_0x19729f[_0x11be('0x3d')][_0x11be('0x62')](_0x11be('0x63'))){_0x317285[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x19729f[_0x11be('0x3d')][_0x11be('0x2a')]);_0x317285[_0x11be('0x29')]=qs[_0x11be('0x29')](_0x19729f[_0x11be('0x3d')][_0x11be('0x29')]);}return _0x3a7cc8[_0x11be('0x75')](_0x317285);}})[_0x11be('0x31')](function(_0x1c09fe){if(_0x1c09fe){return _0x1c09fe?{'count':_0x561f78,'rows':_0x1c09fe}:null;}})[_0x11be('0x31')](respondWithResult(_0x5c6843,null))[_0x11be('0x4d')](handleError(_0x5c6843,null));};exports[_0x11be('0x77')]=function(_0x307dcf,_0x1f84a3,_0x1f5c22){return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x307dcf[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x1f84a3,null))['then'](function(_0x241a57){if(_0x241a57){return db[_0x11be('0x78')][_0x11be('0x79')](function(_0x127877){return db['WhatsappApplication'][_0x11be('0x32')]({'where':{'WhatsappAccountId':_0x307dcf[_0x11be('0x5c')]['id']},'transaction':_0x127877})['then'](function(_0x4418b9){var _0x23595d=_[_0x11be('0x39')](_0x307dcf[_0x11be('0x52')],function(_0x2a6133){_0x2a6133[_0x11be('0x64')]=_0x307dcf[_0x11be('0x5c')]['id'];return _0x2a6133;});return db[_0x11be('0x7a')][_0x11be('0x7b')](_0x23595d,{'transaction':_0x127877});});})[_0x11be('0x31')](function(){return db[_0x11be('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x307dcf[_0x11be('0x5c')]['id']},'order':_0x11be('0x7c')});});}})[_0x11be('0x31')](respondWithResult(_0x1f84a3,null))[_0x11be('0x4d')](handleError(_0x1f84a3,null));};exports[_0x11be('0x7d')]=function(_0x1951e7,_0x330287,_0x1200a1){var _0x5208ea={};var _0x2ac652={};var _0x3ba5ce;var _0x546991;return db[_0x11be('0x4a')][_0x11be('0x61')]({'where':{'id':_0x1951e7[_0x11be('0x5c')]['id']}})[_0x11be('0x31')](handleEntityNotFound(_0x330287,null))['then'](function(_0x1e7699){if(_0x1e7699){_0x3ba5ce=_0x1e7699;_0x2ac652['model']=_[_0x11be('0x4f')](db['WhatsappApplication'][_0x11be('0x3a')]);_0x2ac652[_0x11be('0x3d')]=_['keys'](_0x1951e7[_0x11be('0x3d')]);_0x2ac652['filters']=_[_0x11be('0x41')](_0x2ac652['model'],_0x2ac652[_0x11be('0x3d')]);_0x5208ea[_0x11be('0x40')]=_['intersection'](_0x2ac652[_0x11be('0x3f')],qs[_0x11be('0x42')](_0x1951e7[_0x11be('0x3d')][_0x11be('0x42')]));_0x5208ea['attributes']=_0x5208ea[_0x11be('0x40')]['length']?_0x5208ea['attributes']:_0x2ac652[_0x11be('0x3f')];_0x5208ea[_0x11be('0x44')]=qs[_0x11be('0x45')](_0x1951e7['query']['sort']);_0x5208ea[_0x11be('0x46')]=qs[_0x11be('0x3e')](_['pick'](_0x1951e7[_0x11be('0x3d')],_0x2ac652['filters']));if(_0x1951e7[_0x11be('0x3d')][_0x11be('0x47')]){_0x5208ea[_0x11be('0x46')]=_[_0x11be('0x48')](_0x5208ea[_0x11be('0x46')],{'$or':_[_0x11be('0x39')](_0x5208ea[_0x11be('0x40')],function(_0x86b045){var _0x21626d={};_0x21626d[_0x86b045]={'$like':'%'+_0x1951e7[_0x11be('0x3d')]['filter']+'%'};return _0x21626d;})});}_0x5208ea=_[_0x11be('0x48')]({},_0x5208ea,_0x1951e7[_0x11be('0x49')]);return _0x3ba5ce['getApplications'](_0x5208ea);}})[_0x11be('0x31')](function(_0x47bf3b){if(_0x47bf3b){_0x546991=_0x47bf3b['length'];if(!_0x1951e7['query']['hasOwnProperty'](_0x11be('0x63'))){_0x5208ea[_0x11be('0x2a')]=qs[_0x11be('0x2a')](_0x1951e7['query'][_0x11be('0x2a')]);_0x5208ea['offset']=qs[_0x11be('0x29')](_0x1951e7[_0x11be('0x3d')][_0x11be('0x29')]);}return _0x3ba5ce[_0x11be('0x7d')](_0x5208ea);}})['then'](function(_0x151403){if(_0x151403){return _0x151403?{'count':_0x546991,'rows':_0x151403}:null;}})[_0x11be('0x31')](respondWithResult(_0x330287,null))[_0x11be('0x4d')](handleError(_0x330287,null));};exports['notify']=function(_0x23773d,_0x66e699,_0x1b60e8){var _0xae26dd={'channel':'whatsapp'};var _0x3c5a06=[];var _0x6a5ee4=[];var _0x5121f4={};return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x23773d[_0x11be('0x5c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x11be('0x7e')}]})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x2df568){_0xae26dd['account']=_0x2df568;_0xae26dd[_0x11be('0x7f')]=_['orderBy'](_0x2df568[_0x11be('0x7e')],[_0x11be('0x7c')],[_0x11be('0x80')]);if(_0xae26dd[_0x11be('0x81')][_0x11be('0x7e')]){delete _0xae26dd[_0x11be('0x81')][_0x11be('0x7e')];}return db[_0x11be('0x82')][_0x11be('0x5d')]();})[_0x11be('0x31')](function(_0x3009fc){if(!_0x3009fc){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x3c5a06=_[_0x11be('0x83')](_[_0x11be('0x4f')](_0x3009fc),[_0x11be('0x84'),_0x11be('0x85')]);_0x6a5ee4=_[_0x11be('0x83')](_[_0x11be('0x4f')](_0x3009fc),[_0x11be('0x84'),_0x11be('0x85'),_0x11be('0x86'),_0x11be('0x87')]);_0xae26dd[_0x11be('0x52')]={'mapKey':_0x11be('0x88')};if(_0xae26dd['account'][_0x11be('0x3b')]&&_0xae26dd[_0x11be('0x81')]['type']==='twilio'){_0xae26dd[_0x11be('0x52')]['from']=_0x23773d[_0x11be('0x52')][_0x11be('0x89')][_0x11be('0x8a')](_0x11be('0x8b'),'');_0xae26dd[_0x11be('0x52')][_0x11be('0x52')]=_0x23773d['body']['Body'];_0xae26dd[_0x11be('0x52')][_0x11be('0x8c')]=_0x23773d[_0x11be('0x52')][_0x11be('0x8d')];}if(_0xae26dd['body']['id']){delete _0xae26dd['body']['id'];}if(_[_0x11be('0x8e')](_0xae26dd['body'][_0x11be('0x8f')])){throw new db['Sequelize'][(_0x11be('0x1a'))]('from\x20is\x20mandatory');}if(_[_0x11be('0x8e')](_0xae26dd['body'][_0x11be('0x52')])||_0xae26dd[_0x11be('0x52')][_0x11be('0x52')]===''){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x90'));}if(_[_0x11be('0x8e')](_0xae26dd[_0x11be('0x52')][_0x11be('0x91')])){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6a5ee4);}if(!_[_0x11be('0x92')](_0x6a5ee4,_0xae26dd['body'][_0x11be('0x91')])){throw new db[(_0x11be('0x19'))][(_0x11be('0x1a'))](_0x11be('0x93')+_0x6a5ee4);}_0x5121f4[_0xae26dd[_0x11be('0x52')]['mapKey']]=_0xae26dd[_0x11be('0x52')]['from'];return db[_0x11be('0x94')][_0x11be('0x50')]({'where':{'id':_0xae26dd[_0x11be('0x81')][_0x11be('0x87')]},'include':[{'model':db[_0x11be('0x82')],'as':_0x11be('0x95'),'where':_0x5121f4,'limit':0x1,'order':[[_0x11be('0x85'),_0x11be('0x96')]]}]});})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x1f1d27){if(_0x1f1d27){_0xae26dd[_0x11be('0x97')]=_[_0x11be('0x6e')](_0x1f1d27,[_0x11be('0x95')]);if(_0x1f1d27['Contacts'][_0x11be('0x43')]){return _0x1f1d27[_0x11be('0x95')][0x0];}var _0x1374b5=_[_0x11be('0x98')](_0xae26dd['body'],{'firstName':_0xae26dd[_0x11be('0x52')][_0x11be('0x8f')],'ListId':_0x1f1d27['id']});_0x1374b5[_0xae26dd[_0x11be('0x52')]['mapKey']]=_0xae26dd['body'][_0x11be('0x8f')];return db[_0x11be('0x82')][_0x11be('0x51')](_0x1374b5,{'fields':_0x3c5a06,'raw':!![]});}})[_0x11be('0x31')](handleEntityNotFound(_0x66e699,null))[_0x11be('0x31')](function(_0x911f92){if(_0x911f92){_0xae26dd[_0x11be('0x99')]=_0x911f92;var _0x338b9a={'ContactId':_0x911f92['id'],'phone':_0xae26dd['body'][_0x11be('0x8f')],'WhatsappAccountId':_0x23773d['params']['id']};var _0x284629={'ContactId':_0x911f92['id'],'WhatsappAccountId':_0x23773d[_0x11be('0x5c')]['id'],'closed':![]};return db[_0x11be('0x9a')]['find']({'where':_0x284629})['then'](function(_0x1c9fae){if(_0x1c9fae){return[_0x1c9fae,![]];}return db[_0x11be('0x9a')][_0x11be('0x51')](_0x338b9a)[_0x11be('0x31')](function(_0x365c3e){return[_0x365c3e,!![]];});});}})[_0x11be('0x6f')](function(_0x130eb8,_0x31eb70){_0xae26dd[_0x11be('0x9b')]=_0x130eb8['get']({'plain':!![]});_0xae26dd[_0x11be('0x9b')][_0x11be('0x9c')]=![];if(_0x31eb70){if(_0xae26dd['account']['autoclose']){_0xae26dd[_0x11be('0x7f')][_0x11be('0x9d')]({'id':0x0,'priority':_0xae26dd[_0x11be('0x7f')]['length']+0x1,'app':_0x11be('0x9e'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0xae26dd[_0x11be('0x9b')][_0x11be('0x9c')]=!![];}return db['WhatsappMessage'][_0x11be('0x51')]({'phone':_0xae26dd[_0x11be('0x52')][_0x11be('0x8f')],'messageId':_0xae26dd[_0x11be('0x52')][_0x11be('0x8c')],'body':_0xae26dd[_0x11be('0x52')]['body'],'WhatsappAccountId':_0x23773d['params']['id'],'WhatsappInteractionId':_0x130eb8['id'],'direction':'in','ContactId':_0x130eb8[_0x11be('0x9f')],'AttachmentId':_0xae26dd['body'][_0x11be('0xa0')]});})[_0x11be('0x31')](function(_0x328ebc){_0xae26dd[_0x11be('0x23')]=_0x328ebc;if(_0xae26dd[_0x11be('0x9b')][_0x11be('0xa1')]){return db[_0x11be('0x76')]['find']({'attributes':['id',_0x11be('0x34')],'where':{'id':_0xae26dd[_0x11be('0x9b')]['UserId']}})[_0x11be('0x31')](function(_0x94c517){if(_0x94c517){_0xae26dd[_0x11be('0x7f')][_0x11be('0xa2')]({'id':0x0,'priority':0x0,'app':_0x11be('0xa3'),'appdata':_0x94c517[_0x11be('0x34')]+','+(_0xae26dd[_0x11be('0x81')][_0x11be('0xa4')]||0xa),'interval':_0x11be('0xa5')});}return respondWithRpcPromise(_0x11be('0xa6'),_0x11be('0xa7'),_0xae26dd);});}return respondWithRpcPromise(_0x11be('0xa6'),_0x11be('0xa7'),_0xae26dd);})[_0x11be('0x31')](function(_0x42ebf8){if(_0x42ebf8){var _0xb37a7b=0xc8;var _0x5804bc=_0x11be('0xa8');logger[_0x11be('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5804bc,_0xb37a7b,'entity\x20found');logger['debug'](_0x11be('0xa9'),_0x5804bc,_0xb37a7b,'entity\x20found',JSON['stringify'](_0x42ebf8));if(_0xae26dd[_0x11be('0x81')][_0x11be('0x3b')]===_0x11be('0xaa')){return _0x66e699['status'](_0xb37a7b)[_0x11be('0x2b')](_0x11be('0xab'),'text/xml')[_0x11be('0x35')](_0x11be('0xac'));}else{return _0x66e699[_0x11be('0x25')](_0xb37a7b)[_0x11be('0x27')](_0x42ebf8);}}})[_0x11be('0x4d')](handleError(_0x66e699,null));};exports[_0x11be('0x35')]=function(_0x1f35c2,_0x5de23a,_0x148dac){var _0x3f5cd8,_0x29b073,_0x4867d3;if(_[_0x11be('0x8e')](_0x1f35c2[_0x11be('0x52')]['body'])||_0x1f35c2['body'][_0x11be('0x52')]===''){throw new db['Sequelize']['ValidationError'](_0x11be('0x90'));}if(_[_0x11be('0x8e')](_0x1f35c2[_0x11be('0x52')]['to'])){throw new db['Sequelize']['ValidationError'](_0x11be('0xad'));}_0x3f5cd8=_0x1f35c2[_0x11be('0x52')]['to'];return db[_0x11be('0x4a')][_0x11be('0x50')]({'where':{'id':_0x1f35c2[_0x11be('0x5c')]['id']},'include':[{'model':db[_0x11be('0x94')],'as':_0x11be('0xae'),'include':[{'model':db[_0x11be('0x82')],'as':_0x11be('0x95'),'where':{'mobile':_0x3f5cd8},'limit':0x1,'order':[[_0x11be('0x85'),_0x11be('0x96')]]}]}]})[_0x11be('0x31')](handleEntityNotFound(_0x5de23a,null))['then'](function(_0x4f1168){if(_0x4f1168&&_0x4f1168[_0x11be('0xae')]){_0x29b073=_0x4f1168[_0x11be('0x55')]({'plain':!![]});if(_0x29b073[_0x11be('0xae')]&&_0x29b073['List'][_0x11be('0x95')][_0x11be('0x43')]){return _0x29b073[_0x11be('0xae')][_0x11be('0x95')][0x0];}return db['CmContact'][_0x11be('0x51')](_['defaults'](_0x1f35c2[_0x11be('0x52')],{'firstName':_0x3f5cd8,'mobile':_0x3f5cd8,'phone':_0x3f5cd8,'ListId':_0x29b073['ListId']}));}})[_0x11be('0x31')](handleEntityNotFound(_0x5de23a,null))['then'](function(_0x1e4efd){if(_0x1e4efd){_0x4867d3=_0x1e4efd;return db[_0x11be('0x9a')][_0x11be('0x50')]({'where':{'ContactId':_0x4867d3['id'],'closed':![],'WhatsappAccountId':_0x29b073['id']}})[_0x11be('0x31')](function(_0x5c4134){if(_0x5c4134){return[_0x5c4134,![]];}return db[_0x11be('0x9a')][_0x11be('0x51')]({'UserId':_0x1f35c2['user']['id'],'ContactId':_0x4867d3['id'],'WhatsappAccountId':_0x29b073['id'],'phone':_0x3f5cd8,'firstMsgDirection':_0x11be('0xaf'),'Messages':[_[_0x11be('0x48')](_0x1f35c2[_0x11be('0x52')],{'read':![],'body':_0x1f35c2[_0x11be('0x52')][_0x11be('0x52')],'phone':_0x3f5cd8,'WhatsappAccountId':_0x29b073['id'],'UserId':_0x1f35c2[_0x11be('0x53')]['id'],'ContactId':_0x4867d3['id']})]},{'include':[{'model':db[_0x11be('0xb0')],'as':_0x11be('0xb1')}]})[_0x11be('0x31')](function(_0x589a2d){return[_0x589a2d,!![]];});});}})['spread'](function(_0x34b286,_0x259af9){if(_0x259af9){return _0x34b286;}return db[_0x11be('0xb0')][_0x11be('0x51')](_[_0x11be('0x48')](_0x1f35c2[_0x11be('0x52')],{'read':![],'body':_0x1f35c2[_0x11be('0x52')][_0x11be('0x52')],'phone':_0x3f5cd8,'WhatsappAccountId':_0x29b073['id'],'WhatsappInteractionId':_0x34b286['id'],'UserId':_0x1f35c2[_0x11be('0x53')]['id'],'ContactId':_0x4867d3['id']}))[_0x11be('0x31')](function(_0x150f7a){_0x34b286[_0x11be('0xb2')][_0x11be('0xb1')]=[];_0x34b286[_0x11be('0xb2')]['Messages'][_0x11be('0x9d')](_0x150f7a['dataValues']);return _0x34b286;});})[_0x11be('0x31')](respondWithResult(_0x5de23a,null))[_0x11be('0x4d')](handleError(_0x5de23a,null));}; \ No newline at end of file +var _0x70e0=['startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','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','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','http','test','Sequelize','ValidationError','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','rawAttributes','fields','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','order','map','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','orderBy','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','UserId','unshift','waitForTheAssignedAgent','Start'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x70e0,0x17b));var _0x070e=function(_0x1a409d,_0x674056){_0x1a409d=_0x1a409d-0x0;var _0x29a508=_0x70e0[_0x1a409d];return _0x29a508;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];config[_0x070e('0x16')]=_[_0x070e('0x17')](config[_0x070e('0x16')],{'host':_0x070e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x070e('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x14c3fd,_0x51d14d,_0x5d3a38){if(_0x5d3a38){var _0x373d86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x373d86[_0x070e('0x1b')](_0x51d14d)){return _0x14c3fd;}else{throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x14c3fd;}}function respondWithRpcPromise(_0x49861b,_0x17e2e4,_0x2bd937,_0x38f6e6){return new BPromise(function(_0x2060cc,_0x364b3f){var _0x5037eb=_0x38f6e6||client;return _0x5037eb[_0x070e('0x1e')](_0x49861b,_0x2bd937)[_0x070e('0x1f')](function(_0x1ad3de){logger[_0x070e('0x20')](_0x070e('0x21'),_0x17e2e4,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x17e2e4,_0x070e('0x22'),JSON[_0x070e('0x23')](_0x1ad3de));if(_0x1ad3de[_0x070e('0x24')]){if(_0x1ad3de['error'][_0x070e('0x25')]===0x1f4){logger['error'](_0x070e('0x21'),_0x17e2e4,_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);return _0x364b3f(_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);}logger[_0x070e('0x24')](_0x070e('0x21'),_0x17e2e4,_0x1ad3de[_0x070e('0x24')]['message']);return _0x2060cc(_0x1ad3de[_0x070e('0x24')][_0x070e('0x26')]);}else{logger[_0x070e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x17e2e4,_0x070e('0x22'));_0x2060cc(_0x1ad3de['result']['message']);}})[_0x070e('0x27')](function(_0x25f6e){logger[_0x070e('0x24')](_0x070e('0x21'),_0x17e2e4,_0x25f6e);_0x364b3f(_0x25f6e);});});}function respondWithStatusCode(_0x4763c6,_0x497f58){_0x497f58=_0x497f58||0xcc;return function(_0x374c54){if(_0x374c54){return _0x4763c6[_0x070e('0x28')](_0x497f58);}return _0x4763c6[_0x070e('0x29')](_0x497f58)[_0x070e('0x2a')]();};}function respondWithResult(_0x43dd96,_0x28d7f2){_0x28d7f2=_0x28d7f2||0xc8;return function(_0x1a1892){if(_0x1a1892){return _0x43dd96[_0x070e('0x29')](_0x28d7f2)['json'](_0x1a1892);}};}function respondWithFilteredResult(_0x282344,_0x351641){return function(_0x3a16d0){if(_0x3a16d0){var _0x56fc12=_0x3a16d0[_0x070e('0x2b')],_0x5c5f0d=_0x351641['offset'],_0x13097f=_0x351641[_0x070e('0x2c')]+_0x351641[_0x070e('0x2d')],_0x46065c;if(_0x13097f>=_0x56fc12){_0x13097f=_0x56fc12;_0x46065c=0xc8;}else{_0x46065c=0xce;}_0x282344[_0x070e('0x29')](_0x46065c);return _0x282344[_0x070e('0x2e')]('Content-Range',_0x5c5f0d+'-'+_0x13097f+'/'+_0x56fc12)['json'](_0x3a16d0);}return null;};}function patchUpdates(_0x523b75){return function(_0x59c5b4){try{jsonpatch[_0x070e('0x2f')](_0x59c5b4,_0x523b75,!![]);}catch(_0x4e0a7d){return BPromise[_0x070e('0x30')](_0x4e0a7d);}return _0x59c5b4[_0x070e('0x31')]();};}function saveUpdates(_0x4f8130,_0x47a739){return function(_0x699739){if(_0x699739){return _0x699739[_0x070e('0x32')](_0x4f8130)['then'](function(_0x546a16){return _0x546a16;});}return null;};}function removeEntity(_0x41ade4,_0x27dd1f){return function(_0x444d02){if(_0x444d02){return _0x444d02[_0x070e('0x33')]()[_0x070e('0x1f')](function(){var _0x5f530d=_0x444d02['get']({'plain':!![]});var _0x24d17d=_0x070e('0x34');return db[_0x070e('0x35')][_0x070e('0x33')]({'where':{'type':_0x24d17d,'resourceId':_0x5f530d['id']}})[_0x070e('0x1f')](function(){return _0x444d02;});})['then'](function(){_0x41ade4[_0x070e('0x29')](0xcc)[_0x070e('0x2a')]();});}};}function handleEntityNotFound(_0x534150,_0x2d6bb6){return function(_0x34746e){if(!_0x34746e){_0x534150['sendStatus'](0x194);}return _0x34746e;};}function handleError(_0x4d4ee8,_0x5ddbe9){_0x5ddbe9=_0x5ddbe9||0x1f4;return function(_0x363bff){logger[_0x070e('0x24')](_0x363bff[_0x070e('0x36')]);if(_0x363bff[_0x070e('0x37')]){delete _0x363bff[_0x070e('0x37')];}_0x4d4ee8['status'](_0x5ddbe9)[_0x070e('0x38')](_0x363bff);};}exports[_0x070e('0x39')]=function(_0xb53332,_0x487276){var _0x268c5d={'include':[{'model':db['Pause'],'as':_0x070e('0x3a')}]},_0x72cbc7={},_0x165c16={'count':0x0,'rows':[]};var _0x348092=_['map'](db[_0x070e('0x3b')]['rawAttributes'],function(_0x18dae9){return{'name':_0x18dae9[_0x070e('0x3c')],'type':_0x18dae9[_0x070e('0x3d')][_0x070e('0x3e')]};});_0x72cbc7[_0x070e('0x3f')]=_['map'](_0x348092,_0x070e('0x37'));_0x72cbc7['query']=_['keys'](_0xb53332[_0x070e('0x40')]);_0x72cbc7[_0x070e('0x41')]=_[_0x070e('0x42')](_0x72cbc7['model'],_0x72cbc7[_0x070e('0x40')]);_0x268c5d[_0x070e('0x43')]=_[_0x070e('0x42')](_0x72cbc7[_0x070e('0x3f')],qs['fields'](_0xb53332[_0x070e('0x40')]['fields']));_0x268c5d['attributes']=_0x268c5d['attributes'][_0x070e('0x44')]?_0x268c5d[_0x070e('0x43')]:_0x72cbc7[_0x070e('0x3f')];if(!_0xb53332[_0x070e('0x40')][_0x070e('0x45')]('nolimit')){_0x268c5d[_0x070e('0x2d')]=qs['limit'](_0xb53332[_0x070e('0x40')][_0x070e('0x2d')]);_0x268c5d[_0x070e('0x2c')]=qs['offset'](_0xb53332['query'][_0x070e('0x2c')]);}_0x268c5d['order']=qs[_0x070e('0x46')](_0xb53332[_0x070e('0x40')][_0x070e('0x46')]);_0x268c5d['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0xb53332['query'],_0x72cbc7['filters']),_0x348092);if(_0xb53332[_0x070e('0x40')][_0x070e('0x48')]){_0x268c5d[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x268c5d[_0x070e('0x49')],{'$or':_['map'](_0x348092,function(_0x20b80e){if(_0x20b80e[_0x070e('0x3d')]!==_0x070e('0x4b')){var _0x391dee={};_0x391dee[_0x20b80e[_0x070e('0x37')]]={'$like':'%'+_0xb53332[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0x391dee;}})});}_0x268c5d=_[_0x070e('0x4a')]({},_0x268c5d,_0xb53332[_0x070e('0x4c')]);var _0x66a3f3={'where':_0x268c5d[_0x070e('0x49')]};return db[_0x070e('0x3b')][_0x070e('0x2b')](_0x66a3f3)[_0x070e('0x1f')](function(_0x402c82){_0x165c16['count']=_0x402c82;if(_0xb53332[_0x070e('0x40')][_0x070e('0x4d')]){_0x268c5d[_0x070e('0x4e')]=[{'all':!![]}];}return db[_0x070e('0x3b')][_0x070e('0x4f')](_0x268c5d);})[_0x070e('0x1f')](function(_0x3f0763){_0x165c16[_0x070e('0x50')]=_0x3f0763;return _0x165c16;})[_0x070e('0x1f')](respondWithFilteredResult(_0x487276,_0x268c5d))['catch'](handleError(_0x487276,null));};exports[_0x070e('0x51')]=function(_0x4c22da,_0x1acddb){var _0x2be643={'raw':![],'where':{'id':_0x4c22da[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x53')],'as':_0x070e('0x3a')}]},_0x4abbe9={};_0x4abbe9[_0x070e('0x3f')]=_[_0x070e('0x54')](db[_0x070e('0x3b')][_0x070e('0x55')]);_0x4abbe9['query']=_[_0x070e('0x54')](_0x4c22da['query']);_0x4abbe9['filters']=_[_0x070e('0x42')](_0x4abbe9[_0x070e('0x3f')],_0x4abbe9[_0x070e('0x40')]);_0x2be643[_0x070e('0x43')]=_[_0x070e('0x42')](_0x4abbe9[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x4c22da[_0x070e('0x40')]['fields']));_0x2be643[_0x070e('0x43')]=_0x2be643['attributes']['length']?_0x2be643[_0x070e('0x43')]:_0x4abbe9[_0x070e('0x3f')];if(_0x4c22da['query'][_0x070e('0x4d')]){_0x2be643[_0x070e('0x4e')]=[{'all':!![]}];}_0x2be643=_[_0x070e('0x4a')]({},_0x2be643,_0x4c22da[_0x070e('0x4c')]);return db[_0x070e('0x3b')][_0x070e('0x57')](_0x2be643)[_0x070e('0x1f')](handleEntityNotFound(_0x1acddb,null))['then'](respondWithResult(_0x1acddb,null))['catch'](handleError(_0x1acddb,null));};exports['create']=function(_0x3087e5,_0x1948a5){return db[_0x070e('0x3b')][_0x070e('0x58')](_0x3087e5['body'],{})[_0x070e('0x1f')](function(_0x5d3c3a){var _0x212710=_0x3087e5[_0x070e('0x59')][_0x070e('0x5a')]({'plain':!![]});if(!_0x212710)throw new Error(_0x070e('0x5b'));if(_0x212710[_0x070e('0x5c')]===_0x070e('0x59')){var _0x5561ed=_0x5d3c3a[_0x070e('0x5a')]({'plain':!![]});var _0x18e8d0=_0x070e('0x34');return db['UserProfileSection'][_0x070e('0x57')]({'where':{'name':_0x18e8d0,'userProfileId':_0x212710[_0x070e('0x5d')]},'raw':!![]})['then'](function(_0x1f1df5){if(_0x1f1df5&&_0x1f1df5['autoAssociation']===0x0){return db[_0x070e('0x35')]['create']({'name':_0x5561ed['name'],'resourceId':_0x5561ed['id'],'type':_0x1f1df5['name'],'sectionId':_0x1f1df5['id']},{})[_0x070e('0x1f')](function(){return _0x5d3c3a;});}else{return _0x5d3c3a;}})[_0x070e('0x27')](function(_0x1100d8){logger[_0x070e('0x24')](_0x070e('0x5e'),_0x1100d8);throw _0x1100d8;});}return _0x5d3c3a;})[_0x070e('0x1f')](respondWithResult(_0x1948a5,0xc9))['catch'](handleError(_0x1948a5,null));};exports[_0x070e('0x32')]=function(_0x54d4f9,_0xae78a4){if(_0x54d4f9['body']['id']){delete _0x54d4f9[_0x070e('0x5f')]['id'];}return db[_0x070e('0x3b')]['find']({'where':{'id':_0x54d4f9[_0x070e('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x070e('0x3a')}]})[_0x070e('0x1f')](handleEntityNotFound(_0xae78a4,null))[_0x070e('0x1f')](saveUpdates(_0x54d4f9[_0x070e('0x5f')],null))[_0x070e('0x1f')](respondWithResult(_0xae78a4,null))[_0x070e('0x27')](handleError(_0xae78a4,null));};exports[_0x070e('0x33')]=function(_0x148f1d,_0x3ef9cc){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x148f1d[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x3ef9cc,null))[_0x070e('0x1f')](removeEntity(_0x3ef9cc,null))['catch'](handleError(_0x3ef9cc,null));};exports[_0x070e('0x60')]=function(_0x19d78c,_0x381c83){return db[_0x070e('0x3b')]['describe']()[_0x070e('0x1f')](respondWithResult(_0x381c83,null))[_0x070e('0x27')](handleError(_0x381c83,null));};exports[_0x070e('0x61')]=function(_0x5625a9,_0x2a7b5d,_0x12a58f){if(_0x5625a9['body']['id']){delete _0x5625a9[_0x070e('0x5f')]['id'];}return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x5625a9[_0x070e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2a7b5d,null))[_0x070e('0x1f')](function(_0x52804d){if(_0x52804d){_0x5625a9[_0x070e('0x5f')][_0x070e('0x62')]=_0x52804d['id'];return db[_0x070e('0x63')][_0x070e('0x58')](_0x5625a9[_0x070e('0x5f')]);}})['then'](respondWithResult(_0x2a7b5d,null))[_0x070e('0x27')](handleError(_0x2a7b5d,null));};exports[_0x070e('0x64')]=function(_0x8cc913,_0x114bcf,_0x5591dd){var _0x26b2c0={'raw':![],'where':{}};var _0x5cadcf={};var _0x399055={'count':0x0,'rows':[]};return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x8cc913['params']['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x114bcf,null))['then'](function(_0x1e6e6a){if(_0x1e6e6a){_0x5cadcf['model']=_[_0x070e('0x54')](db[_0x070e('0x63')]['rawAttributes']);_0x5cadcf[_0x070e('0x40')]=_['keys'](_0x8cc913[_0x070e('0x40')]);_0x5cadcf[_0x070e('0x41')]=_['intersection'](_0x5cadcf['model'],_0x5cadcf[_0x070e('0x40')]);_0x26b2c0[_0x070e('0x43')]=_[_0x070e('0x42')](_0x5cadcf[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x8cc913[_0x070e('0x40')][_0x070e('0x56')]));_0x26b2c0[_0x070e('0x43')]=_0x26b2c0[_0x070e('0x43')][_0x070e('0x44')]?_0x26b2c0[_0x070e('0x43')]:_0x5cadcf[_0x070e('0x3f')];if(!_0x8cc913[_0x070e('0x40')]['hasOwnProperty'](_0x070e('0x66'))){_0x26b2c0[_0x070e('0x2d')]=qs['limit'](_0x8cc913['query'][_0x070e('0x2d')]);_0x26b2c0[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x8cc913[_0x070e('0x40')][_0x070e('0x2c')]);}_0x26b2c0[_0x070e('0x67')]=qs[_0x070e('0x46')](_0x8cc913[_0x070e('0x40')][_0x070e('0x46')]);_0x26b2c0[_0x070e('0x49')]=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x8cc913[_0x070e('0x40')],_0x5cadcf['filters']));_0x26b2c0['where']['WhatsappAccountId']=_0x1e6e6a['id'];if(_0x8cc913[_0x070e('0x40')][_0x070e('0x48')]){_0x26b2c0[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x26b2c0['where'],{'$or':_[_0x070e('0x68')](_0x26b2c0[_0x070e('0x43')],function(_0x416dde){var _0xd74f9c={};_0xd74f9c[_0x416dde]={'$like':'%'+_0x8cc913[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0xd74f9c;})});}_0x26b2c0=_['merge']({},_0x26b2c0,_0x8cc913[_0x070e('0x4c')]);return db['Disposition'][_0x070e('0x2b')]({'where':_0x26b2c0[_0x070e('0x49')]})[_0x070e('0x1f')](function(_0x3aa620){_0x399055[_0x070e('0x2b')]=_0x3aa620;if(_0x8cc913['query'][_0x070e('0x4d')]){_0x26b2c0[_0x070e('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x070e('0x4f')](_0x26b2c0);})[_0x070e('0x1f')](function(_0x553ea1){_0x399055[_0x070e('0x50')]=_0x553ea1;return _0x399055;});}})[_0x070e('0x1f')](respondWithFilteredResult(_0x114bcf,_0x26b2c0))[_0x070e('0x27')](handleError(_0x114bcf,null));};exports['removeDispositions']=function(_0x40d7e6,_0xe8c476,_0x134b72){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x40d7e6[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xe8c476,null))[_0x070e('0x1f')](function(_0x206b97){if(_0x206b97){return _0x206b97[_0x070e('0x69')](_0x40d7e6[_0x070e('0x40')][_0x070e('0x6a')]);}})[_0x070e('0x1f')](respondWithStatusCode(_0xe8c476,null))['catch'](handleError(_0xe8c476,null));};exports[_0x070e('0x6b')]=function(_0x2df184,_0x392c45,_0x1b71dd){if(_0x2df184[_0x070e('0x5f')]['id']){delete _0x2df184[_0x070e('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2df184['params']['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x392c45,null))[_0x070e('0x1f')](function(_0x39cd65){if(_0x39cd65){_0x2df184[_0x070e('0x5f')]['WhatsappAccountId']=_0x39cd65['id'];return db[_0x070e('0x6c')][_0x070e('0x58')](_0x2df184[_0x070e('0x5f')]);}})['then'](respondWithResult(_0x392c45,null))[_0x070e('0x27')](handleError(_0x392c45,null));};exports['getAnswers']=function(_0x237e3b,_0x396902,_0x59e6e5){var _0x59fe3e={'raw':![],'where':{}};var _0x2048e9={};var _0x1fa499={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x070e('0x65')]({'where':{'id':_0x237e3b['params']['id']}})['then'](handleEntityNotFound(_0x396902,null))['then'](function(_0x15480c){if(_0x15480c){_0x2048e9[_0x070e('0x3f')]=_[_0x070e('0x54')](db[_0x070e('0x6c')][_0x070e('0x55')]);_0x2048e9[_0x070e('0x40')]=_[_0x070e('0x54')](_0x237e3b[_0x070e('0x40')]);_0x2048e9[_0x070e('0x41')]=_[_0x070e('0x42')](_0x2048e9[_0x070e('0x3f')],_0x2048e9[_0x070e('0x40')]);_0x59fe3e[_0x070e('0x43')]=_[_0x070e('0x42')](_0x2048e9[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x237e3b[_0x070e('0x40')][_0x070e('0x56')]));_0x59fe3e[_0x070e('0x43')]=_0x59fe3e[_0x070e('0x43')][_0x070e('0x44')]?_0x59fe3e[_0x070e('0x43')]:_0x2048e9['model'];if(!_0x237e3b[_0x070e('0x40')][_0x070e('0x45')](_0x070e('0x66'))){_0x59fe3e[_0x070e('0x2d')]=qs['limit'](_0x237e3b[_0x070e('0x40')][_0x070e('0x2d')]);_0x59fe3e[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x237e3b[_0x070e('0x40')][_0x070e('0x2c')]);}_0x59fe3e['order']=qs['sort'](_0x237e3b['query'][_0x070e('0x46')]);_0x59fe3e['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x237e3b['query'],_0x2048e9[_0x070e('0x41')]));_0x59fe3e[_0x070e('0x49')]['WhatsappAccountId']=_0x15480c['id'];if(_0x237e3b['query'][_0x070e('0x48')]){_0x59fe3e[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x59fe3e[_0x070e('0x49')],{'$or':_[_0x070e('0x68')](_0x59fe3e['attributes'],function(_0x3aba7a){var _0x56e3da={};_0x56e3da[_0x3aba7a]={'$like':'%'+_0x237e3b[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0x56e3da;})});}_0x59fe3e=_['merge']({},_0x59fe3e,_0x237e3b[_0x070e('0x4c')]);return db[_0x070e('0x6c')][_0x070e('0x2b')]({'where':_0x59fe3e[_0x070e('0x49')]})[_0x070e('0x1f')](function(_0x32b286){_0x1fa499['count']=_0x32b286;if(_0x237e3b[_0x070e('0x40')][_0x070e('0x4d')]){_0x59fe3e[_0x070e('0x4e')]=[{'all':!![]}];}return db[_0x070e('0x6c')][_0x070e('0x4f')](_0x59fe3e);})['then'](function(_0x2531f7){_0x1fa499[_0x070e('0x50')]=_0x2531f7;return _0x1fa499;});}})[_0x070e('0x1f')](respondWithFilteredResult(_0x396902,_0x59fe3e))[_0x070e('0x27')](handleError(_0x396902,null));};exports[_0x070e('0x6d')]=function(_0x31ceee,_0x248347,_0x4546eb){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x31ceee[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x248347,null))[_0x070e('0x1f')](function(_0xf1edc1){if(_0xf1edc1){return _0xf1edc1[_0x070e('0x6d')](_0x31ceee[_0x070e('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x248347,null))[_0x070e('0x27')](handleError(_0x248347,null));};exports[_0x070e('0x6e')]=function(_0x4ceba3,_0x5d8c9f,_0x5d8f66){return db['WhatsappAccount'][_0x070e('0x57')]({'where':{'id':_0x4ceba3[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x5d8c9f,null))[_0x070e('0x1f')](function(_0x409811){if(_0x409811){return _0x409811[_0x070e('0x6e')](_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')],_[_0x070e('0x6f')](_0x4ceba3[_0x070e('0x5f')],['ids','id'])||{})[_0x070e('0x70')](function(_0x36cfe2){for(var _0x49c66a=0x0;_0x49c66a<_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')][_0x070e('0x44')];_0x49c66a+=0x1){socket[_0x070e('0x71')]('userWhatsappAccount:save',{'UserId':_0x4ceba3[_0x070e('0x5f')][_0x070e('0x6a')][_0x49c66a],'WhatsappAccountId':_0x4ceba3[_0x070e('0x52')]['id']});}return _0x36cfe2;});}})[_0x070e('0x1f')](respondWithResult(_0x5d8c9f,null))['catch'](handleError(_0x5d8c9f,null));};exports[_0x070e('0x72')]=function(_0x14a769,_0xfb9cec,_0xebbb53){return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x14a769[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0xfb9cec,null))[_0x070e('0x1f')](function(_0x1a41f2){if(_0x1a41f2){return _0x1a41f2[_0x070e('0x72')](_0x14a769['query'][_0x070e('0x6a')])[_0x070e('0x1f')](function(){if(_['isArray'](_0x14a769['query'][_0x070e('0x6a')])){for(var _0x53f6e7=0x0;_0x53f6e7<_0x14a769[_0x070e('0x40')][_0x070e('0x6a')][_0x070e('0x44')];_0x53f6e7+=0x1){socket[_0x070e('0x71')](_0x070e('0x73'),{'UserId':Number(_0x14a769[_0x070e('0x40')][_0x070e('0x6a')][_0x53f6e7]),'WhatsappAccountId':Number(_0x14a769['params']['id'])});}}else{socket[_0x070e('0x71')](_0x070e('0x73'),{'UserId':Number(_0x14a769[_0x070e('0x40')][_0x070e('0x6a')]),'WhatsappAccountId':Number(_0x14a769['params']['id'])});}});}})['then'](respondWithStatusCode(_0xfb9cec,null))[_0x070e('0x27')](handleError(_0xfb9cec,null));};exports[_0x070e('0x74')]=function(_0x2e92f0,_0x5b727f,_0x101bfc){var _0xf5b732={};var _0x4e795d={};var _0x2e9808;var _0x344289;return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x2e92f0[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x5b727f,null))['then'](function(_0x58c3d7){if(_0x58c3d7){_0x2e9808=_0x58c3d7;_0x4e795d[_0x070e('0x3f')]=_['keys'](db[_0x070e('0x75')][_0x070e('0x55')]);_0x4e795d['query']=_[_0x070e('0x54')](_0x2e92f0['query']);_0x4e795d[_0x070e('0x41')]=_[_0x070e('0x42')](_0x4e795d[_0x070e('0x3f')],_0x4e795d[_0x070e('0x40')]);_0xf5b732[_0x070e('0x43')]=_[_0x070e('0x42')](_0x4e795d['model'],qs[_0x070e('0x56')](_0x2e92f0[_0x070e('0x40')]['fields']));_0xf5b732['attributes']=_0xf5b732[_0x070e('0x43')][_0x070e('0x44')]?_0xf5b732[_0x070e('0x43')]:_0x4e795d[_0x070e('0x3f')];_0xf5b732[_0x070e('0x67')]=qs[_0x070e('0x46')](_0x2e92f0[_0x070e('0x40')][_0x070e('0x46')]);_0xf5b732['where']=qs[_0x070e('0x41')](_[_0x070e('0x47')](_0x2e92f0[_0x070e('0x40')],_0x4e795d[_0x070e('0x41')]));if(_0x2e92f0[_0x070e('0x40')][_0x070e('0x48')]){_0xf5b732[_0x070e('0x49')]=_[_0x070e('0x4a')](_0xf5b732['where'],{'$or':_[_0x070e('0x68')](_0xf5b732[_0x070e('0x43')],function(_0x40532a){var _0xbc61f2={};_0xbc61f2[_0x40532a]={'$like':'%'+_0x2e92f0[_0x070e('0x40')][_0x070e('0x48')]+'%'};return _0xbc61f2;})});}_0xf5b732=_[_0x070e('0x4a')]({},_0xf5b732,_0x2e92f0[_0x070e('0x4c')]);return _0x2e9808[_0x070e('0x74')](_0xf5b732);}})[_0x070e('0x1f')](function(_0x5b259e){if(_0x5b259e){_0x344289=_0x5b259e['length'];if(!_0x2e92f0[_0x070e('0x40')][_0x070e('0x45')](_0x070e('0x66'))){_0xf5b732['limit']=qs[_0x070e('0x2d')](_0x2e92f0[_0x070e('0x40')]['limit']);_0xf5b732[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x2e92f0[_0x070e('0x40')][_0x070e('0x2c')]);}return _0x2e9808[_0x070e('0x74')](_0xf5b732);}})[_0x070e('0x1f')](function(_0x4cd349){if(_0x4cd349){return _0x4cd349?{'count':_0x344289,'rows':_0x4cd349}:null;}})['then'](respondWithResult(_0x5b727f,null))[_0x070e('0x27')](handleError(_0x5b727f,null));};exports[_0x070e('0x76')]=function(_0x532f83,_0x4055ba,_0x1ba1d3){return db[_0x070e('0x3b')][_0x070e('0x65')]({'where':{'id':_0x532f83[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x4055ba,null))['then'](function(_0xb7866f){if(_0xb7866f){return db[_0x070e('0x77')]['transaction'](function(_0x44ab7c){return db[_0x070e('0x78')][_0x070e('0x33')]({'where':{'WhatsappAccountId':_0x532f83[_0x070e('0x52')]['id']},'transaction':_0x44ab7c})['then'](function(_0x4c621a){var _0x2c2585=_[_0x070e('0x68')](_0x532f83[_0x070e('0x5f')],function(_0x326948){_0x326948[_0x070e('0x62')]=_0x532f83[_0x070e('0x52')]['id'];return _0x326948;});return db[_0x070e('0x78')][_0x070e('0x79')](_0x2c2585,{'transaction':_0x44ab7c});});})[_0x070e('0x1f')](function(){return db[_0x070e('0x78')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x532f83[_0x070e('0x52')]['id']},'order':_0x070e('0x7a')});});}})[_0x070e('0x1f')](respondWithResult(_0x4055ba,null))[_0x070e('0x27')](handleError(_0x4055ba,null));};exports['getApplications']=function(_0x8c79df,_0x35ddab,_0x510bce){var _0x4b559b={};var _0x27c346={};var _0x4684c7;var _0x1abf03;return db['WhatsappAccount'][_0x070e('0x65')]({'where':{'id':_0x8c79df[_0x070e('0x52')]['id']}})[_0x070e('0x1f')](handleEntityNotFound(_0x35ddab,null))[_0x070e('0x1f')](function(_0x34b5ae){if(_0x34b5ae){_0x4684c7=_0x34b5ae;_0x27c346['model']=_[_0x070e('0x54')](db[_0x070e('0x78')]['rawAttributes']);_0x27c346[_0x070e('0x40')]=_['keys'](_0x8c79df['query']);_0x27c346['filters']=_[_0x070e('0x42')](_0x27c346[_0x070e('0x3f')],_0x27c346[_0x070e('0x40')]);_0x4b559b[_0x070e('0x43')]=_['intersection'](_0x27c346[_0x070e('0x3f')],qs[_0x070e('0x56')](_0x8c79df['query'][_0x070e('0x56')]));_0x4b559b[_0x070e('0x43')]=_0x4b559b[_0x070e('0x43')][_0x070e('0x44')]?_0x4b559b[_0x070e('0x43')]:_0x27c346[_0x070e('0x3f')];_0x4b559b['order']=qs[_0x070e('0x46')](_0x8c79df['query'][_0x070e('0x46')]);_0x4b559b[_0x070e('0x49')]=qs[_0x070e('0x41')](_['pick'](_0x8c79df[_0x070e('0x40')],_0x27c346[_0x070e('0x41')]));if(_0x8c79df[_0x070e('0x40')]['filter']){_0x4b559b[_0x070e('0x49')]=_[_0x070e('0x4a')](_0x4b559b['where'],{'$or':_[_0x070e('0x68')](_0x4b559b[_0x070e('0x43')],function(_0x478e5b){var _0x56ec32={};_0x56ec32[_0x478e5b]={'$like':'%'+_0x8c79df['query']['filter']+'%'};return _0x56ec32;})});}_0x4b559b=_[_0x070e('0x4a')]({},_0x4b559b,_0x8c79df[_0x070e('0x4c')]);return _0x4684c7[_0x070e('0x7b')](_0x4b559b);}})[_0x070e('0x1f')](function(_0x1204d7){if(_0x1204d7){_0x1abf03=_0x1204d7[_0x070e('0x44')];if(!_0x8c79df[_0x070e('0x40')][_0x070e('0x45')]('nolimit')){_0x4b559b['limit']=qs['limit'](_0x8c79df['query'][_0x070e('0x2d')]);_0x4b559b[_0x070e('0x2c')]=qs[_0x070e('0x2c')](_0x8c79df[_0x070e('0x40')][_0x070e('0x2c')]);}return _0x4684c7['getApplications'](_0x4b559b);}})['then'](function(_0x1644c2){if(_0x1644c2){return _0x1644c2?{'count':_0x1abf03,'rows':_0x1644c2}:null;}})[_0x070e('0x1f')](respondWithResult(_0x35ddab,null))['catch'](handleError(_0x35ddab,null));};exports[_0x070e('0x7c')]=function(_0x46e19f,_0x239385,_0x75ea53){var _0x38b0e1={'channel':_0x070e('0x7d')};var _0x5e71ab=[];var _0x202ebf=[];var _0x1d48a9={};return db[_0x070e('0x3b')]['find']({'where':{'id':_0x46e19f[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x78')],'as':_0x070e('0x7e')}]})[_0x070e('0x1f')](handleEntityNotFound(_0x239385,null))['then'](function(_0x4175b9){_0x38b0e1[_0x070e('0x7f')]=_0x4175b9;_0x38b0e1['applications']=_[_0x070e('0x80')](_0x4175b9[_0x070e('0x7e')],['priority'],[_0x070e('0x81')]);if(_0x38b0e1['account'][_0x070e('0x7e')]){delete _0x38b0e1['account'][_0x070e('0x7e')];}return db['CmContact']['describe']();})[_0x070e('0x1f')](function(_0x5df2fa){if(!_0x5df2fa){throw new db['Sequelize'][(_0x070e('0x1d'))](_0x070e('0x82'));}_0x5e71ab=_[_0x070e('0x83')](_[_0x070e('0x54')](_0x5df2fa),[_0x070e('0x84'),'updatedAt']);_0x202ebf=_[_0x070e('0x83')](_[_0x070e('0x54')](_0x5df2fa),[_0x070e('0x84'),_0x070e('0x85'),_0x070e('0x86'),_0x070e('0x87')]);_0x38b0e1['body']={'mapKey':_0x070e('0x88')};if(_0x38b0e1[_0x070e('0x7f')][_0x070e('0x3d')]&&_0x38b0e1[_0x070e('0x7f')]['type']==='twilio'){_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')]=_0x46e19f[_0x070e('0x5f')][_0x070e('0x8a')][_0x070e('0x8b')](_0x070e('0x8c'),'');_0x38b0e1['body'][_0x070e('0x5f')]=_0x46e19f[_0x070e('0x5f')][_0x070e('0x8d')];_0x38b0e1[_0x070e('0x5f')][_0x070e('0x8e')]=_0x46e19f[_0x070e('0x5f')]['MessageSid'];}if(_0x38b0e1['body']['id']){delete _0x38b0e1[_0x070e('0x5f')]['id'];}if(_[_0x070e('0x8f')](_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x90'));}if(_['isNil'](_0x38b0e1[_0x070e('0x5f')]['body'])||_0x38b0e1[_0x070e('0x5f')]['body']===''){throw new db['Sequelize']['ValidationError'](_0x070e('0x91'));}if(_[_0x070e('0x8f')](_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x93')+_0x202ebf);}if(!_[_0x070e('0x94')](_0x202ebf,_0x38b0e1[_0x070e('0x5f')]['mapKey'])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))](_0x070e('0x95')+_0x202ebf);}_0x1d48a9[_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')]]=_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')];return db[_0x070e('0x96')][_0x070e('0x57')]({'where':{'id':_0x38b0e1['account']['ListId']},'include':[{'model':db[_0x070e('0x97')],'as':_0x070e('0x98'),'where':_0x1d48a9,'limit':0x1,'order':[['updatedAt',_0x070e('0x99')]]}]});})['then'](handleEntityNotFound(_0x239385,null))['then'](function(_0x3f2eb0){if(_0x3f2eb0){_0x38b0e1[_0x070e('0x9a')]=_['omit'](_0x3f2eb0,[_0x070e('0x98')]);if(_0x3f2eb0[_0x070e('0x98')][_0x070e('0x44')]){return _0x3f2eb0['Contacts'][0x0];}var _0x590326=_[_0x070e('0x17')](_0x38b0e1[_0x070e('0x5f')],{'firstName':_0x38b0e1[_0x070e('0x5f')]['from'],'ListId':_0x3f2eb0['id']});_0x590326[_0x38b0e1[_0x070e('0x5f')][_0x070e('0x92')]]=_0x38b0e1['body'][_0x070e('0x89')];return db[_0x070e('0x97')][_0x070e('0x58')](_0x590326,{'fields':_0x5e71ab,'raw':!![]});}})[_0x070e('0x1f')](handleEntityNotFound(_0x239385,null))[_0x070e('0x1f')](function(_0x92db3c){if(_0x92db3c){_0x38b0e1[_0x070e('0x9b')]=_0x92db3c;var _0x1cf02b={'ContactId':_0x92db3c['id'],'phone':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')],'WhatsappAccountId':_0x46e19f[_0x070e('0x52')]['id']};var _0x2b45d5={'ContactId':_0x92db3c['id'],'WhatsappAccountId':_0x46e19f[_0x070e('0x52')]['id'],'closed':![]};return db[_0x070e('0x9c')][_0x070e('0x57')]({'where':_0x2b45d5})[_0x070e('0x1f')](function(_0x2948a2){if(_0x2948a2){return[_0x2948a2,![]];}return db['WhatsappInteraction']['create'](_0x1cf02b)['then'](function(_0x52b206){return[_0x52b206,!![]];});});}})[_0x070e('0x70')](function(_0x8e9f07,_0x19a31f){_0x38b0e1['interaction']=_0x8e9f07[_0x070e('0x5a')]({'plain':!![]});_0x38b0e1[_0x070e('0x9d')][_0x070e('0x9e')]=![];if(_0x19a31f){if(_0x38b0e1['account'][_0x070e('0x9f')]){_0x38b0e1[_0x070e('0xa0')][_0x070e('0xa1')]({'id':0x0,'priority':_0x38b0e1[_0x070e('0xa0')]['length']+0x1,'app':_0x070e('0xa2'),'appdata':_0x070e('0xa3'),'interval':_0x070e('0xa4')});}_0x38b0e1['interaction'][_0x070e('0x9e')]=!![];}return db[_0x070e('0xa5')][_0x070e('0x58')]({'phone':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x89')],'messageId':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x8e')],'body':_0x38b0e1[_0x070e('0x5f')][_0x070e('0x5f')],'WhatsappAccountId':_0x46e19f['params']['id'],'WhatsappInteractionId':_0x8e9f07['id'],'direction':'in','ContactId':_0x8e9f07['ContactId'],'AttachmentId':_0x38b0e1[_0x070e('0x5f')]['AttachmentId']});})['then'](function(_0x197c18){_0x38b0e1[_0x070e('0x26')]=_0x197c18;if(_0x38b0e1[_0x070e('0x9d')][_0x070e('0xa6')]){return db[_0x070e('0x75')][_0x070e('0x57')]({'attributes':['id','name'],'where':{'id':_0x38b0e1[_0x070e('0x9d')][_0x070e('0xa6')]}})[_0x070e('0x1f')](function(_0x351d73){if(_0x351d73){_0x38b0e1['applications'][_0x070e('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x351d73[_0x070e('0x37')]+','+(_0x38b0e1[_0x070e('0x7f')][_0x070e('0xa8')]||0xa),'interval':_0x070e('0xa4')});}return respondWithRpcPromise(_0x070e('0xa9'),_0x070e('0xaa'),_0x38b0e1);});}return respondWithRpcPromise(_0x070e('0xa9'),_0x070e('0xaa'),_0x38b0e1);})[_0x070e('0x1f')](function(_0x537d78){if(_0x537d78){var _0xc35037=0xc8;var _0x1f71df=_0x070e('0xab');logger[_0x070e('0x20')](_0x070e('0xac'),_0x1f71df,_0xc35037,_0x070e('0xad'));logger[_0x070e('0xae')](_0x070e('0xaf'),_0x1f71df,_0xc35037,'entity\x20found',JSON[_0x070e('0x23')](_0x537d78));if(_0x38b0e1[_0x070e('0x7f')]['type']==='twilio'){return _0x239385[_0x070e('0x29')](_0xc35037)[_0x070e('0x2e')](_0x070e('0xb0'),_0x070e('0xb1'))[_0x070e('0x38')](_0x070e('0xb2'));}else{return _0x239385['status'](_0xc35037)['json'](_0x537d78);}}})[_0x070e('0x27')](handleError(_0x239385,null));};exports[_0x070e('0x38')]=function(_0x5079d9,_0x31d3fa,_0x5aebee){var _0x17e949,_0xa2c957,_0x535518;if(_[_0x070e('0x8f')](_0x5079d9[_0x070e('0x5f')]['body'])||_0x5079d9['body'][_0x070e('0x5f')]===''){throw new db['Sequelize'][(_0x070e('0x1d'))](_0x070e('0x91'));}if(_[_0x070e('0x8f')](_0x5079d9['body']['to'])){throw new db[(_0x070e('0x1c'))][(_0x070e('0x1d'))]('to\x20is\x20mandatory');}_0x17e949=_0x5079d9[_0x070e('0x5f')]['to'];return db[_0x070e('0x3b')][_0x070e('0x57')]({'where':{'id':_0x5079d9[_0x070e('0x52')]['id']},'include':[{'model':db[_0x070e('0x96')],'as':_0x070e('0xb3'),'include':[{'model':db[_0x070e('0x97')],'as':_0x070e('0x98'),'where':{'mobile':_0x17e949},'limit':0x1,'order':[[_0x070e('0x85'),_0x070e('0x99')]]}]}]})['then'](handleEntityNotFound(_0x31d3fa,null))[_0x070e('0x1f')](function(_0x11a111){if(_0x11a111&&_0x11a111[_0x070e('0xb3')]){_0xa2c957=_0x11a111['get']({'plain':!![]});if(_0xa2c957['List']&&_0xa2c957[_0x070e('0xb3')][_0x070e('0x98')][_0x070e('0x44')]){return _0xa2c957[_0x070e('0xb3')]['Contacts'][0x0];}return db[_0x070e('0x97')]['create'](_['defaults'](_0x5079d9[_0x070e('0x5f')],{'firstName':_0x17e949,'mobile':_0x17e949,'phone':_0x17e949,'ListId':_0xa2c957['ListId']}));}})[_0x070e('0x1f')](handleEntityNotFound(_0x31d3fa,null))[_0x070e('0x1f')](function(_0x1f4a5e){if(_0x1f4a5e){_0x535518=_0x1f4a5e;return db[_0x070e('0x9c')]['find']({'where':{'ContactId':_0x535518['id'],'closed':![],'WhatsappAccountId':_0xa2c957['id']}})[_0x070e('0x1f')](function(_0x532c79){if(_0x532c79){return[_0x532c79,![]];}return db[_0x070e('0x9c')][_0x070e('0x58')]({'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id'],'WhatsappAccountId':_0xa2c957['id'],'phone':_0x17e949,'firstMsgDirection':_0x070e('0xb4'),'Messages':[_[_0x070e('0x4a')](_0x5079d9[_0x070e('0x5f')],{'read':![],'body':_0x5079d9[_0x070e('0x5f')][_0x070e('0x5f')],'phone':_0x17e949,'WhatsappAccountId':_0xa2c957['id'],'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id']})]},{'include':[{'model':db[_0x070e('0xa5')],'as':_0x070e('0xb5')}]})[_0x070e('0x1f')](function(_0x1316d1){return[_0x1316d1,!![]];});});}})[_0x070e('0x70')](function(_0x9c7a91,_0x34e985){if(_0x34e985){return _0x9c7a91;}return db['WhatsappMessage']['create'](_[_0x070e('0x4a')](_0x5079d9[_0x070e('0x5f')],{'read':![],'body':_0x5079d9['body'][_0x070e('0x5f')],'phone':_0x17e949,'WhatsappAccountId':_0xa2c957['id'],'WhatsappInteractionId':_0x9c7a91['id'],'UserId':_0x5079d9[_0x070e('0x59')]['id'],'ContactId':_0x535518['id']}))['then'](function(_0x257a42){_0x9c7a91[_0x070e('0xb6')]['Messages']=[];_0x9c7a91[_0x070e('0xb6')][_0x070e('0xb5')][_0x070e('0xa1')](_0x257a42[_0x070e('0xb6')]);return _0x9c7a91;});})[_0x070e('0x1f')](respondWithResult(_0x31d3fa,null))[_0x070e('0x27')](handleError(_0x31d3fa,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index a8dff49..e9670e5 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 _0x6d38=['WhatsappAccount','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x86d3('0x0'))['db'][_0x86d3('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x86d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x86d3('0x3')};function emitEvent(_0x574a1c){return function(_0xe9198a,_0x455b9d,_0x2501dd){WhatsappAccountEvents['emit'](_0x574a1c+':'+_0xe9198a['id'],_0xe9198a);WhatsappAccountEvents[_0x86d3('0x4')](_0x574a1c,_0xe9198a);_0x2501dd(null);};}for(var e in events){if(events[_0x86d3('0x5')](e)){var event=events[e];WhatsappAccount[_0x86d3('0x6')](e,emitEvent(event));}}module[_0x86d3('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x9a5a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x9a5a,0x194));var _0xa9a5=function(_0x376043,_0x53d5e0){_0x376043=_0x376043-0x0;var _0x2ce3ef=_0x9a5a[_0x376043];return _0x2ce3ef;};'use strict';var EventEmitter=require(_0xa9a5('0x0'));var WhatsappAccount=require(_0xa9a5('0x1'))['db'][_0xa9a5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa9a5('0x3')](0x0);var events={'afterCreate':_0xa9a5('0x4'),'afterUpdate':'update','afterDestroy':_0xa9a5('0x5')};function emitEvent(_0x1e6fb1){return function(_0x230710,_0x1080a9,_0x31e823){WhatsappAccountEvents[_0xa9a5('0x6')](_0x1e6fb1+':'+_0x230710['id'],_0x230710);WhatsappAccountEvents['emit'](_0x1e6fb1,_0x230710);_0x31e823(null);};}for(var e in events){if(events[_0xa9a5('0x7')](e)){var event=events[e];WhatsappAccount[_0xa9a5('0x8')](e,emitEvent(event));}}module[_0xa9a5('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e8a6285..c0a5547 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 _0xbdc6=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','lodash'];(function(_0x5e2c32,_0x584410){var _0x24645b=function(_0x503c73){while(--_0x503c73){_0x5e2c32['push'](_0x5e2c32['shift']());}};_0x24645b(++_0x584410);}(_0xbdc6,0xf9));var _0x6bdc=function(_0x1c09a7,_0x2033cc){_0x1c09a7=_0x1c09a7-0x0;var _0x183140=_0xbdc6[_0x1c09a7];return _0x183140;};'use strict';var _=require(_0x6bdc('0x0'));var util=require(_0x6bdc('0x1'));var logger=require(_0x6bdc('0x2'))(_0x6bdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bdc('0x4'));var fs=require('fs');var path=require(_0x6bdc('0x5'));var rimraf=require(_0x6bdc('0x6'));var config=require(_0x6bdc('0x7'));var attributes=require(_0x6bdc('0x8'));module['exports']=function(_0x51bb29,_0x4a371c){return _0x51bb29['define']('WhatsappAccount',attributes,{'tableName':_0x6bdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c75=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x24c6ed,_0x18a00d){var _0x4a7fd6=function(_0x1ca0cc){while(--_0x1ca0cc){_0x24c6ed['push'](_0x24c6ed['shift']());}};_0x4a7fd6(++_0x18a00d);}(_0x4c75,0x19c));var _0x54c7=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0x4c75[_0x53efa4];return _0x276274;};'use strict';var _=require(_0x54c7('0x0'));var util=require(_0x54c7('0x1'));var logger=require(_0x54c7('0x2'))('api');var moment=require(_0x54c7('0x3'));var BPromise=require(_0x54c7('0x4'));var rp=require(_0x54c7('0x5'));var fs=require('fs');var path=require(_0x54c7('0x6'));var rimraf=require(_0x54c7('0x7'));var config=require(_0x54c7('0x8'));var attributes=require(_0x54c7('0x9'));module[_0x54c7('0xa')]=function(_0x4513ea,_0xf4a632){return _0x4513ea[_0x54c7('0xb')](_0x54c7('0xc'),attributes,{'tableName':_0x54c7('0xd'),'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 c36c560..680b866 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 _0xa25d=['redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowWhatsappAccount','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x315963,_0x59fd1a){var _0x31bb2a=function(_0x376b2c){while(--_0x376b2c){_0x315963['push'](_0x315963['shift']());}};_0x31bb2a(++_0x59fd1a);}(_0xa25d,0x194));var _0xda25=function(_0x5800a5,_0x2823f6){_0x5800a5=_0x5800a5-0x0;var _0x420c85=_0xa25d[_0x5800a5];return _0x420c85;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require(_0xda25('0x3'));var rs=require(_0xda25('0x4'));var fs=require('fs');var Redis=require(_0xda25('0x5'));var db=require(_0xda25('0x6'))['db'];var utils=require(_0xda25('0x7'));var logger=require(_0xda25('0x8'))(_0xda25('0x9'));var config=require(_0xda25('0xa'));var jayson=require(_0xda25('0xb'));var client=jayson[_0xda25('0xc')][_0xda25('0xd')]({'port':0x232a});config[_0xda25('0xe')]=_[_0xda25('0xf')](config[_0xda25('0xe')],{'host':_0xda25('0x10'),'port':0x18eb});var socket=require(_0xda25('0x11'))(new Redis(config['redis']));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x476573,_0x4c382a,_0x258f8b){return new BPromise(function(_0x2671a6,_0x41de2f){return client[_0xda25('0x12')](_0x476573,_0x258f8b)[_0xda25('0x13')](function(_0x32af5d){logger[_0xda25('0x14')](_0xda25('0x15'),_0x4c382a,_0xda25('0x16'));logger[_0xda25('0x17')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4c382a,_0xda25('0x16'),JSON[_0xda25('0x18')](_0x32af5d));if(_0x32af5d[_0xda25('0x19')]){if(_0x32af5d[_0xda25('0x19')][_0xda25('0x1a')]===0x1f4){logger['error'](_0xda25('0x15'),_0x4c382a,_0x32af5d[_0xda25('0x19')][_0xda25('0x1b')]);return _0x41de2f(_0x32af5d[_0xda25('0x19')]['message']);}logger[_0xda25('0x19')](_0xda25('0x15'),_0x4c382a,_0x32af5d['error'][_0xda25('0x1b')]);return _0x2671a6(_0x32af5d['error'][_0xda25('0x1b')]);}else{logger[_0xda25('0x14')](_0xda25('0x15'),_0x4c382a,_0xda25('0x16'));_0x2671a6(_0x32af5d['result'][_0xda25('0x1b')]);}})[_0xda25('0x1c')](function(_0x522a19){logger[_0xda25('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x4c382a,_0x522a19);_0x41de2f(_0x522a19);});});}exports[_0xda25('0x1d')]=function(_0x7fc809){var _0x4e41ff=this;return new Promise(function(_0x2d6e0b,_0x1129cb){return db['WhatsappAccount'][_0xda25('0x1e')]({'raw':_0x7fc809[_0xda25('0x1f')]?_0x7fc809[_0xda25('0x1f')][_0xda25('0x20')]===undefined?!![]:![]:!![],'where':_0x7fc809[_0xda25('0x1f')]?_0x7fc809[_0xda25('0x1f')][_0xda25('0x21')]||null:null,'attributes':_0x7fc809['options']?_0x7fc809[_0xda25('0x1f')][_0xda25('0x22')]||null:null,'include':_0x7fc809[_0xda25('0x1f')]?_0x7fc809['options']['include']?_[_0xda25('0x23')](_0x7fc809[_0xda25('0x1f')][_0xda25('0x24')],function(_0x18f57f){return{'model':db[_0x18f57f[_0xda25('0x25')]],'as':_0x18f57f['as'],'attributes':_0x18f57f['attributes'],'include':_0x18f57f[_0xda25('0x24')]?_[_0xda25('0x23')](_0x18f57f[_0xda25('0x24')],function(_0x5c8f9e){return{'model':db[_0x5c8f9e[_0xda25('0x25')]],'as':_0x5c8f9e['as'],'attributes':_0x5c8f9e[_0xda25('0x22')],'include':_0x5c8f9e[_0xda25('0x24')]?_['map'](_0x5c8f9e['include'],function(_0x5da286){return{'model':db[_0x5da286[_0xda25('0x25')]],'as':_0x5da286['as'],'attributes':_0x5da286['attributes']};}):[]};}):[]};}):[]:[]})[_0xda25('0x13')](function(_0xfdfd00){logger['info'](_0xda25('0x1d'),_0x7fc809);logger[_0xda25('0x17')](_0xda25('0x1d'),_0x7fc809,JSON['stringify'](_0xfdfd00));_0x2d6e0b(_0xfdfd00);})[_0xda25('0x1c')](function(_0x578c6c){logger['error'](_0xda25('0x1d'),_0x578c6c[_0xda25('0x1b')],_0x7fc809);_0x1129cb(_0x4e41ff['error'](0x1f4,_0x578c6c[_0xda25('0x1b')]));});});}; \ No newline at end of file +var _0x96ca=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','options','raw','attributes','include','model','map','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x23d199,_0x24a179){var _0x26c072=function(_0x1e85da){while(--_0x1e85da){_0x23d199['push'](_0x23d199['shift']());}};_0x26c072(++_0x24a179);}(_0x96ca,0xf1));var _0xa96c=function(_0x97d6d5,_0x4453e7){_0x97d6d5=_0x97d6d5-0x0;var _0x3baaa2=_0x96ca[_0x97d6d5];return _0x3baaa2;};'use strict';var _=require(_0xa96c('0x0'));var util=require(_0xa96c('0x1'));var moment=require(_0xa96c('0x2'));var BPromise=require(_0xa96c('0x3'));var rs=require(_0xa96c('0x4'));var fs=require('fs');var Redis=require(_0xa96c('0x5'));var db=require(_0xa96c('0x6'))['db'];var utils=require(_0xa96c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa96c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa96c('0x9')][_0xa96c('0xa')]({'port':0x232a});config[_0xa96c('0xb')]=_[_0xa96c('0xc')](config['redis'],{'host':_0xa96c('0xd'),'port':0x18eb});var socket=require(_0xa96c('0xe'))(new Redis(config[_0xa96c('0xb')]));require(_0xa96c('0xf'))[_0xa96c('0x10')](socket);function respondWithRpcPromise(_0x2185c5,_0x173c6c,_0x2aba1c){return new BPromise(function(_0x1b891f,_0x1eebdd){return client[_0xa96c('0x11')](_0x2185c5,_0x2aba1c)['then'](function(_0x555d88){logger[_0xa96c('0x12')](_0xa96c('0x13'),_0x173c6c,_0xa96c('0x14'));logger['debug'](_0xa96c('0x15'),_0x173c6c,_0xa96c('0x14'),JSON[_0xa96c('0x16')](_0x555d88));if(_0x555d88['error']){if(_0x555d88[_0xa96c('0x17')][_0xa96c('0x18')]===0x1f4){logger[_0xa96c('0x17')](_0xa96c('0x13'),_0x173c6c,_0x555d88[_0xa96c('0x17')]['message']);return _0x1eebdd(_0x555d88[_0xa96c('0x17')][_0xa96c('0x19')]);}logger[_0xa96c('0x17')](_0xa96c('0x13'),_0x173c6c,_0x555d88['error']['message']);return _0x1b891f(_0x555d88['error'][_0xa96c('0x19')]);}else{logger[_0xa96c('0x12')](_0xa96c('0x13'),_0x173c6c,_0xa96c('0x14'));_0x1b891f(_0x555d88[_0xa96c('0x1a')][_0xa96c('0x19')]);}})[_0xa96c('0x1b')](function(_0x42fc8d){logger[_0xa96c('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x173c6c,_0x42fc8d);_0x1eebdd(_0x42fc8d);});});}exports[_0xa96c('0x1c')]=function(_0xcbce78){var _0x5b6085=this;return new Promise(function(_0x28df48,_0x3af37f){return db['WhatsappAccount']['find']({'raw':_0xcbce78[_0xa96c('0x1d')]?_0xcbce78[_0xa96c('0x1d')][_0xa96c('0x1e')]===undefined?!![]:![]:!![],'where':_0xcbce78[_0xa96c('0x1d')]?_0xcbce78[_0xa96c('0x1d')]['where']||null:null,'attributes':_0xcbce78[_0xa96c('0x1d')]?_0xcbce78[_0xa96c('0x1d')][_0xa96c('0x1f')]||null:null,'include':_0xcbce78[_0xa96c('0x1d')]?_0xcbce78[_0xa96c('0x1d')][_0xa96c('0x20')]?_['map'](_0xcbce78[_0xa96c('0x1d')][_0xa96c('0x20')],function(_0x3d77e3){return{'model':db[_0x3d77e3[_0xa96c('0x21')]],'as':_0x3d77e3['as'],'attributes':_0x3d77e3[_0xa96c('0x1f')],'include':_0x3d77e3[_0xa96c('0x20')]?_[_0xa96c('0x22')](_0x3d77e3[_0xa96c('0x20')],function(_0x2358ea){return{'model':db[_0x2358ea[_0xa96c('0x21')]],'as':_0x2358ea['as'],'attributes':_0x2358ea['attributes'],'include':_0x2358ea[_0xa96c('0x20')]?_['map'](_0x2358ea[_0xa96c('0x20')],function(_0x3a6083){return{'model':db[_0x3a6083['model']],'as':_0x3a6083['as'],'attributes':_0x3a6083['attributes']};}):[]};}):[]};}):[]:[]})[_0xa96c('0x23')](function(_0xf74f61){logger[_0xa96c('0x12')](_0xa96c('0x1c'),_0xcbce78);logger[_0xa96c('0x24')]('ShowWhatsappAccount',_0xcbce78,JSON[_0xa96c('0x16')](_0xf74f61));_0x28df48(_0xf74f61);})[_0xa96c('0x1b')](function(_0x37b452){logger[_0xa96c('0x17')](_0xa96c('0x1c'),_0x37b452[_0xa96c('0x19')],_0xcbce78);_0x3af37f(_0x5b6085[_0xa96c('0x17')](0x1f4,_0x37b452[_0xa96c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 42703cf..93895c4 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 _0x7824=['remove','update','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x411069,_0x16ae05){var _0x68c645=function(_0x55d1c8){while(--_0x55d1c8){_0x411069['push'](_0x411069['shift']());}};_0x68c645(++_0x16ae05);}(_0x7824,0xd1));var _0x4782=function(_0x9fc209,_0x12d4b4){_0x9fc209=_0x9fc209-0x0;var _0x4f2ca8=_0x7824[_0x9fc209];return _0x4f2ca8;};'use strict';var WhatsappAccountEvents=require(_0x4782('0x0'));var events=['save',_0x4782('0x1'),_0x4782('0x2')];function createListener(_0x178a79,_0x2b56be){return function(_0x35183d){_0x2b56be[_0x4782('0x3')](_0x178a79,_0x35183d);};}function removeListener(_0x64d9ce,_0x5a08d1){return function(){WhatsappAccountEvents['removeListener'](_0x64d9ce,_0x5a08d1);};}exports['register']=function(_0x243e77){for(var _0x10cee6=0x0,_0x17e373=events[_0x4782('0x4')];_0x10cee6<_0x17e373;_0x10cee6++){var _0x128fe7=events[_0x10cee6];var _0x5c62b0=createListener(_0x4782('0x5')+_0x128fe7,_0x243e77);WhatsappAccountEvents['on'](_0x128fe7,_0x5c62b0);}}; \ No newline at end of file +var _0x5a50=['./whatsappAccount.events','save','emit','removeListener','register','length'];(function(_0x501b83,_0x173644){var _0x4c4503=function(_0x1de899){while(--_0x1de899){_0x501b83['push'](_0x501b83['shift']());}};_0x4c4503(++_0x173644);}(_0x5a50,0xde));var _0x05a5=function(_0x48849a,_0x41fd99){_0x48849a=_0x48849a-0x0;var _0x43ae7a=_0x5a50[_0x48849a];return _0x43ae7a;};'use strict';var WhatsappAccountEvents=require(_0x05a5('0x0'));var events=[_0x05a5('0x1'),'remove','update'];function createListener(_0x1e9a69,_0x251427){return function(_0x3931c1){_0x251427[_0x05a5('0x2')](_0x1e9a69,_0x3931c1);};}function removeListener(_0x358aeb,_0x50d24c){return function(){WhatsappAccountEvents[_0x05a5('0x3')](_0x358aeb,_0x50d24c);};}exports[_0x05a5('0x4')]=function(_0x428891){for(var _0x7e31a1=0x0,_0x26c032=events[_0x05a5('0x5')];_0x7e31a1<_0x26c032;_0x7e31a1++){var _0x2c7f0a=events[_0x7e31a1];var _0x3452c8=createListener('whatsappAccount:'+_0x2c7f0a,_0x428891);WhatsappAccountEvents['on'](_0x2c7f0a,_0x3452c8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 708ced3..a8da76a 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 _0x7c91=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x7c91,0x1ca));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x17c9('0x0'));var util=require(_0x17c9('0x1'));var path=require(_0x17c9('0x2'));var timeout=require(_0x17c9('0x3'));var express=require(_0x17c9('0x4'));var router=express[_0x17c9('0x5')]();var auth=require(_0x17c9('0x6'));var interaction=require(_0x17c9('0x7'));var config=require(_0x17c9('0x8'));var controller=require(_0x17c9('0x9'));router[_0x17c9('0xa')]('/',auth[_0x17c9('0xb')](),controller[_0x17c9('0xc')]);router[_0x17c9('0xa')](_0x17c9('0xd'),auth[_0x17c9('0xb')](),controller['show']);router['post']('/',auth[_0x17c9('0xb')](),controller[_0x17c9('0xe')]);router[_0x17c9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x17c9('0x10')]);router[_0x17c9('0x11')](_0x17c9('0xd'),auth['isAuthenticated'](),controller[_0x17c9('0x12')]);module[_0x17c9('0x13')]=router; \ No newline at end of file +var _0x0f81=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x0f81,0x6c));var _0x10f8=function(_0x525798,_0x77a707){_0x525798=_0x525798-0x0;var _0x57da9a=_0x0f81[_0x525798];return _0x57da9a;};'use strict';var multer=require(_0x10f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x10f8('0x1'));var express=require(_0x10f8('0x2'));var router=express[_0x10f8('0x3')]();var auth=require(_0x10f8('0x4'));var interaction=require(_0x10f8('0x5'));var config=require(_0x10f8('0x6'));var controller=require(_0x10f8('0x7'));router[_0x10f8('0x8')]('/',auth[_0x10f8('0x9')](),controller['index']);router[_0x10f8('0x8')](_0x10f8('0xa'),auth[_0x10f8('0x9')](),controller[_0x10f8('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x10f8('0xa'),auth[_0x10f8('0x9')](),controller['update']);router[_0x10f8('0xc')](_0x10f8('0xa'),auth[_0x10f8('0x9')](),controller[_0x10f8('0xd')]);module[_0x10f8('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 8fd3e39..f4b3b9f 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 _0x042a=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x105aaa,_0x358e95){var _0xe4b1fa=function(_0x52b5aa){while(--_0x52b5aa){_0x105aaa['push'](_0x105aaa['shift']());}};_0xe4b1fa(++_0x358e95);}(_0x042a,0x76));var _0xa042=function(_0x1d2f6e,_0x28dbba){_0x1d2f6e=_0x1d2f6e-0x0;var _0x265e96=_0x042a[_0x1d2f6e];return _0x265e96;};'use strict';var Sequelize=require(_0xa042('0x0'));module[_0xa042('0x1')]={'priority':{'type':Sequelize[_0xa042('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa042('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa042('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa042('0x4')}}; \ No newline at end of file +var _0x9274=['noop','STRING','*,*,*,*','INTEGER'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x9274,0xe7));var _0x4927=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9274[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x4927('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4927('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4927('0x2')],'defaultValue':_0x4927('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1381881..8b6ec36 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 _0x5913=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','merge','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5913,0x10e));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3591('0x0'));var emlformat=require(_0x3591('0x1'));var rimraf=require(_0x3591('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3591('0x3'));var rp=require(_0x3591('0x4'));var moment=require(_0x3591('0x5'));var BPromise=require(_0x3591('0x6'));var Mustache=require(_0x3591('0x7'));var util=require(_0x3591('0x8'));var path=require(_0x3591('0x9'));var sox=require(_0x3591('0xa'));var csv=require(_0x3591('0xb'));var ejs=require(_0x3591('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3591('0xd'));var deskjs=require(_0x3591('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3591('0xf'));var Papa=require(_0x3591('0x10'));var Redis=require(_0x3591('0x11'));var authService=require(_0x3591('0x12'));var qs=require(_0x3591('0x13'));var as=require(_0x3591('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3591('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x416a7f,_0x24535c){_0x24535c=_0x24535c||0xcc;return function(_0x2699e4){if(_0x2699e4){return _0x416a7f[_0x3591('0x16')](_0x24535c);}return _0x416a7f[_0x3591('0x17')](_0x24535c)['end']();};}function respondWithResult(_0x262192,_0xc96c92){_0xc96c92=_0xc96c92||0xc8;return function(_0x3ab08e){if(_0x3ab08e){return _0x262192['status'](_0xc96c92)[_0x3591('0x18')](_0x3ab08e);}};}function respondWithFilteredResult(_0x19605f,_0x16fa4f){return function(_0x1a5bca){if(_0x1a5bca){var _0x1cf090=_0x1a5bca[_0x3591('0x19')],_0x51dfaf=_0x16fa4f['offset'],_0x1e61b2=_0x16fa4f[_0x3591('0x1a')]+_0x16fa4f[_0x3591('0x1b')],_0x21e92e;if(_0x1e61b2>=_0x1cf090){_0x1e61b2=_0x1cf090;_0x21e92e=0xc8;}else{_0x21e92e=0xce;}_0x19605f[_0x3591('0x17')](_0x21e92e);return _0x19605f[_0x3591('0x1c')](_0x3591('0x1d'),_0x51dfaf+'-'+_0x1e61b2+'/'+_0x1cf090)[_0x3591('0x18')](_0x1a5bca);}return null;};}function patchUpdates(_0x4ddf72){return function(_0x11b13e){try{jsonpatch[_0x3591('0x1e')](_0x11b13e,_0x4ddf72,!![]);}catch(_0x5e60a2){return BPromise['reject'](_0x5e60a2);}return _0x11b13e['save']();};}function saveUpdates(_0x1f6b85,_0x287eae){return function(_0x7a979d){if(_0x7a979d){return _0x7a979d[_0x3591('0x1f')](_0x1f6b85)[_0x3591('0x20')](function(_0x231124){return _0x231124;});}return null;};}function removeEntity(_0x51b04b,_0x3a98c3){return function(_0x310e2a){if(_0x310e2a){return _0x310e2a[_0x3591('0x21')]()[_0x3591('0x20')](function(){_0x51b04b[_0x3591('0x17')](0xcc)[_0x3591('0x22')]();});}};}function handleEntityNotFound(_0xfc9e6f,_0x4c3510){return function(_0x4b899f){if(!_0x4b899f){_0xfc9e6f[_0x3591('0x16')](0x194);}return _0x4b899f;};}function handleError(_0x5dbbfb,_0x546ac3){_0x546ac3=_0x546ac3||0x1f4;return function(_0x231b98){logger[_0x3591('0x23')](_0x231b98[_0x3591('0x24')]);if(_0x231b98[_0x3591('0x25')]){delete _0x231b98['name'];}_0x5dbbfb[_0x3591('0x17')](_0x546ac3)[_0x3591('0x26')](_0x231b98);};}exports[_0x3591('0x27')]=function(_0x17c9dd,_0x447b8d){var _0x151a24={},_0x5cd98c={},_0x4c503b={'count':0x0,'rows':[]};var _0x4d61e7=_[_0x3591('0x28')](db[_0x3591('0x29')][_0x3591('0x2a')],function(_0x763d7f){return{'name':_0x763d7f[_0x3591('0x2b')],'type':_0x763d7f[_0x3591('0x2c')]['key']};});_0x5cd98c['model']=_[_0x3591('0x28')](_0x4d61e7,_0x3591('0x25'));_0x5cd98c[_0x3591('0x2d')]=_['keys'](_0x17c9dd[_0x3591('0x2d')]);_0x5cd98c[_0x3591('0x2e')]=_['intersection'](_0x5cd98c[_0x3591('0x2f')],_0x5cd98c[_0x3591('0x2d')]);_0x151a24[_0x3591('0x30')]=_[_0x3591('0x31')](_0x5cd98c[_0x3591('0x2f')],qs['fields'](_0x17c9dd['query']['fields']));_0x151a24[_0x3591('0x30')]=_0x151a24['attributes'][_0x3591('0x32')]?_0x151a24[_0x3591('0x30')]:_0x5cd98c[_0x3591('0x2f')];if(!_0x17c9dd[_0x3591('0x2d')][_0x3591('0x33')](_0x3591('0x34'))){_0x151a24[_0x3591('0x1b')]=qs[_0x3591('0x1b')](_0x17c9dd[_0x3591('0x2d')][_0x3591('0x1b')]);_0x151a24[_0x3591('0x1a')]=qs[_0x3591('0x1a')](_0x17c9dd[_0x3591('0x2d')][_0x3591('0x1a')]);}_0x151a24[_0x3591('0x35')]=qs[_0x3591('0x36')](_0x17c9dd[_0x3591('0x2d')]['sort']);_0x151a24[_0x3591('0x37')]=qs[_0x3591('0x2e')](_[_0x3591('0x38')](_0x17c9dd[_0x3591('0x2d')],_0x5cd98c['filters']),_0x4d61e7);if(_0x17c9dd['query']['filter']){_0x151a24[_0x3591('0x37')]=_['merge'](_0x151a24[_0x3591('0x37')],{'$or':_['map'](_0x4d61e7,function(_0x14aadd){if(_0x14aadd['type']!==_0x3591('0x39')){var _0x506e57={};_0x506e57[_0x14aadd[_0x3591('0x25')]]={'$like':'%'+_0x17c9dd[_0x3591('0x2d')][_0x3591('0x3a')]+'%'};return _0x506e57;}})});}_0x151a24=_['merge']({},_0x151a24,_0x17c9dd[_0x3591('0x3b')]);var _0x280f14={'where':_0x151a24[_0x3591('0x37')]};return db[_0x3591('0x29')][_0x3591('0x19')](_0x280f14)['then'](function(_0x95cbda){_0x4c503b[_0x3591('0x19')]=_0x95cbda;if(_0x17c9dd[_0x3591('0x2d')][_0x3591('0x3c')]){_0x151a24[_0x3591('0x3d')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x3591('0x3e')](_0x151a24);})[_0x3591('0x20')](function(_0x483c2b){_0x4c503b[_0x3591('0x3f')]=_0x483c2b;return _0x4c503b;})['then'](respondWithFilteredResult(_0x447b8d,_0x151a24))[_0x3591('0x40')](handleError(_0x447b8d,null));};exports['show']=function(_0x288abf,_0x1c9f49){var _0x417f04={'raw':!![],'where':{'id':_0x288abf[_0x3591('0x41')]['id']}},_0x35395f={};_0x35395f[_0x3591('0x2f')]=_['keys'](db['WhatsappApplication'][_0x3591('0x2a')]);_0x35395f[_0x3591('0x2d')]=_['keys'](_0x288abf[_0x3591('0x2d')]);_0x35395f[_0x3591('0x2e')]=_[_0x3591('0x31')](_0x35395f[_0x3591('0x2f')],_0x35395f[_0x3591('0x2d')]);_0x417f04[_0x3591('0x30')]=_[_0x3591('0x31')](_0x35395f['model'],qs['fields'](_0x288abf[_0x3591('0x2d')][_0x3591('0x42')]));_0x417f04[_0x3591('0x30')]=_0x417f04['attributes'][_0x3591('0x32')]?_0x417f04[_0x3591('0x30')]:_0x35395f['model'];if(_0x288abf[_0x3591('0x2d')][_0x3591('0x3c')]){_0x417f04[_0x3591('0x3d')]=[{'all':!![]}];}_0x417f04=_[_0x3591('0x43')]({},_0x417f04,_0x288abf['options']);return db[_0x3591('0x29')][_0x3591('0x44')](_0x417f04)[_0x3591('0x20')](handleEntityNotFound(_0x1c9f49,null))[_0x3591('0x20')](respondWithResult(_0x1c9f49,null))[_0x3591('0x40')](handleError(_0x1c9f49,null));};exports[_0x3591('0x45')]=function(_0x4b1324,_0xe4294b){return db['WhatsappApplication'][_0x3591('0x45')](_0x4b1324['body'],{})[_0x3591('0x20')](respondWithResult(_0xe4294b,0xc9))['catch'](handleError(_0xe4294b,null));};exports[_0x3591('0x1f')]=function(_0x4cd92d,_0x2b62b5){if(_0x4cd92d[_0x3591('0x46')]['id']){delete _0x4cd92d[_0x3591('0x46')]['id'];}return db[_0x3591('0x29')]['find']({'where':{'id':_0x4cd92d[_0x3591('0x41')]['id']}})[_0x3591('0x20')](handleEntityNotFound(_0x2b62b5,null))[_0x3591('0x20')](saveUpdates(_0x4cd92d[_0x3591('0x46')],null))[_0x3591('0x20')](respondWithResult(_0x2b62b5,null))[_0x3591('0x40')](handleError(_0x2b62b5,null));};exports[_0x3591('0x21')]=function(_0x29e604,_0x3546e5){return db['WhatsappApplication'][_0x3591('0x44')]({'where':{'id':_0x29e604[_0x3591('0x41')]['id']}})['then'](handleEntityNotFound(_0x3546e5,null))[_0x3591('0x20')](removeEntity(_0x3546e5,null))['catch'](handleError(_0x3546e5,null));}; \ No newline at end of file +var _0x627c=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','fieldName','model','map','query','keys','attributes','intersection','fields','length','nolimit','offset','sort','filters','filter','where','merge','type','VIRTUAL','options','WhatsappApplication','includeAll','include','rows','catch','show','params','rawAttributes','find','create'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0x627c,0x115));var _0xc627=function(_0x1c289b,_0x1ae393){_0x1c289b=_0x1c289b-0x0;var _0x1757c6=_0x627c[_0x1c289b];return _0x1757c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc627('0x0'));var rimraf=require(_0xc627('0x1'));var zipdir=require(_0xc627('0x2'));var jsonpatch=require(_0xc627('0x3'));var rp=require(_0xc627('0x4'));var moment=require('moment');var BPromise=require(_0xc627('0x5'));var Mustache=require('mustache');var util=require(_0xc627('0x6'));var path=require(_0xc627('0x7'));var sox=require(_0xc627('0x8'));var csv=require(_0xc627('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc627('0xa'));var squel=require(_0xc627('0xb'));var crypto=require(_0xc627('0xc'));var jsforce=require(_0xc627('0xd'));var deskjs=require(_0xc627('0xe'));var toCsv=require(_0xc627('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc627('0xf'));var authService=require(_0xc627('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc627('0x11'));var hardwareService=require(_0xc627('0x12'));var logger=require(_0xc627('0x13'))(_0xc627('0x14'));var utils=require('../../config/utils');var config=require(_0xc627('0x15'));var db=require(_0xc627('0x16'))['db'];function respondWithStatusCode(_0xaa8858,_0x304053){_0x304053=_0x304053||0xcc;return function(_0x4c3031){if(_0x4c3031){return _0xaa8858['sendStatus'](_0x304053);}return _0xaa8858[_0xc627('0x17')](_0x304053)[_0xc627('0x18')]();};}function respondWithResult(_0x2993b4,_0x4c6d50){_0x4c6d50=_0x4c6d50||0xc8;return function(_0x411c18){if(_0x411c18){return _0x2993b4[_0xc627('0x17')](_0x4c6d50)[_0xc627('0x19')](_0x411c18);}};}function respondWithFilteredResult(_0x54282e,_0x251dc7){return function(_0x55af18){if(_0x55af18){var _0xa68375=_0x55af18[_0xc627('0x1a')],_0x47c3cb=_0x251dc7['offset'],_0x38e674=_0x251dc7['offset']+_0x251dc7[_0xc627('0x1b')],_0x43a3c8;if(_0x38e674>=_0xa68375){_0x38e674=_0xa68375;_0x43a3c8=0xc8;}else{_0x43a3c8=0xce;}_0x54282e[_0xc627('0x17')](_0x43a3c8);return _0x54282e[_0xc627('0x1c')](_0xc627('0x1d'),_0x47c3cb+'-'+_0x38e674+'/'+_0xa68375)[_0xc627('0x19')](_0x55af18);}return null;};}function patchUpdates(_0x508001){return function(_0x4b5f6f){try{jsonpatch[_0xc627('0x1e')](_0x4b5f6f,_0x508001,!![]);}catch(_0x26d57a){return BPromise['reject'](_0x26d57a);}return _0x4b5f6f[_0xc627('0x1f')]();};}function saveUpdates(_0x41366b,_0xe72823){return function(_0x3898e1){if(_0x3898e1){return _0x3898e1[_0xc627('0x20')](_0x41366b)[_0xc627('0x21')](function(_0x28b88f){return _0x28b88f;});}return null;};}function removeEntity(_0x218845,_0x3bcc1){return function(_0x418442){if(_0x418442){return _0x418442[_0xc627('0x22')]()[_0xc627('0x21')](function(){_0x218845[_0xc627('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5775df,_0x403247){return function(_0xdaef3e){if(!_0xdaef3e){_0x5775df[_0xc627('0x23')](0x194);}return _0xdaef3e;};}function handleError(_0x3b1be6,_0x1cdb16){_0x1cdb16=_0x1cdb16||0x1f4;return function(_0x53e43e){logger['error'](_0x53e43e[_0xc627('0x24')]);if(_0x53e43e[_0xc627('0x25')]){delete _0x53e43e['name'];}_0x3b1be6[_0xc627('0x17')](_0x1cdb16)[_0xc627('0x26')](_0x53e43e);};}exports['index']=function(_0x17240c,_0x228231){var _0x39e610={},_0xa4ece7={},_0xa2340e={'count':0x0,'rows':[]};var _0x59d98f=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x392864){return{'name':_0x392864[_0xc627('0x27')],'type':_0x392864['type']['key']};});_0xa4ece7[_0xc627('0x28')]=_[_0xc627('0x29')](_0x59d98f,_0xc627('0x25'));_0xa4ece7[_0xc627('0x2a')]=_[_0xc627('0x2b')](_0x17240c[_0xc627('0x2a')]);_0xa4ece7['filters']=_['intersection'](_0xa4ece7[_0xc627('0x28')],_0xa4ece7[_0xc627('0x2a')]);_0x39e610[_0xc627('0x2c')]=_[_0xc627('0x2d')](_0xa4ece7['model'],qs[_0xc627('0x2e')](_0x17240c[_0xc627('0x2a')][_0xc627('0x2e')]));_0x39e610[_0xc627('0x2c')]=_0x39e610[_0xc627('0x2c')][_0xc627('0x2f')]?_0x39e610['attributes']:_0xa4ece7['model'];if(!_0x17240c[_0xc627('0x2a')]['hasOwnProperty'](_0xc627('0x30'))){_0x39e610[_0xc627('0x1b')]=qs[_0xc627('0x1b')](_0x17240c[_0xc627('0x2a')]['limit']);_0x39e610[_0xc627('0x31')]=qs[_0xc627('0x31')](_0x17240c[_0xc627('0x2a')][_0xc627('0x31')]);}_0x39e610['order']=qs['sort'](_0x17240c[_0xc627('0x2a')][_0xc627('0x32')]);_0x39e610['where']=qs['filters'](_['pick'](_0x17240c['query'],_0xa4ece7[_0xc627('0x33')]),_0x59d98f);if(_0x17240c[_0xc627('0x2a')][_0xc627('0x34')]){_0x39e610[_0xc627('0x35')]=_[_0xc627('0x36')](_0x39e610['where'],{'$or':_[_0xc627('0x29')](_0x59d98f,function(_0x4b8ff1){if(_0x4b8ff1[_0xc627('0x37')]!==_0xc627('0x38')){var _0x49f82e={};_0x49f82e[_0x4b8ff1[_0xc627('0x25')]]={'$like':'%'+_0x17240c['query']['filter']+'%'};return _0x49f82e;}})});}_0x39e610=_[_0xc627('0x36')]({},_0x39e610,_0x17240c[_0xc627('0x39')]);var _0x397dba={'where':_0x39e610[_0xc627('0x35')]};return db[_0xc627('0x3a')][_0xc627('0x1a')](_0x397dba)['then'](function(_0x5e9f5c){_0xa2340e[_0xc627('0x1a')]=_0x5e9f5c;if(_0x17240c[_0xc627('0x2a')][_0xc627('0x3b')]){_0x39e610[_0xc627('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x39e610);})['then'](function(_0x109050){_0xa2340e[_0xc627('0x3d')]=_0x109050;return _0xa2340e;})[_0xc627('0x21')](respondWithFilteredResult(_0x228231,_0x39e610))[_0xc627('0x3e')](handleError(_0x228231,null));};exports[_0xc627('0x3f')]=function(_0x1c0c9b,_0x367fa0){var _0xc9fa41={'raw':!![],'where':{'id':_0x1c0c9b[_0xc627('0x40')]['id']}},_0x13944c={};_0x13944c[_0xc627('0x28')]=_['keys'](db[_0xc627('0x3a')][_0xc627('0x41')]);_0x13944c[_0xc627('0x2a')]=_[_0xc627('0x2b')](_0x1c0c9b[_0xc627('0x2a')]);_0x13944c[_0xc627('0x33')]=_[_0xc627('0x2d')](_0x13944c['model'],_0x13944c[_0xc627('0x2a')]);_0xc9fa41[_0xc627('0x2c')]=_['intersection'](_0x13944c[_0xc627('0x28')],qs[_0xc627('0x2e')](_0x1c0c9b[_0xc627('0x2a')]['fields']));_0xc9fa41['attributes']=_0xc9fa41['attributes'][_0xc627('0x2f')]?_0xc9fa41[_0xc627('0x2c')]:_0x13944c['model'];if(_0x1c0c9b['query']['includeAll']){_0xc9fa41[_0xc627('0x3c')]=[{'all':!![]}];}_0xc9fa41=_[_0xc627('0x36')]({},_0xc9fa41,_0x1c0c9b[_0xc627('0x39')]);return db[_0xc627('0x3a')][_0xc627('0x42')](_0xc9fa41)[_0xc627('0x21')](handleEntityNotFound(_0x367fa0,null))['then'](respondWithResult(_0x367fa0,null))[_0xc627('0x3e')](handleError(_0x367fa0,null));};exports[_0xc627('0x43')]=function(_0x1287b8,_0x2fe54a){return db[_0xc627('0x3a')][_0xc627('0x43')](_0x1287b8['body'],{})[_0xc627('0x21')](respondWithResult(_0x2fe54a,0xc9))[_0xc627('0x3e')](handleError(_0x2fe54a,null));};exports[_0xc627('0x20')]=function(_0xf4f7b7,_0x12b436){if(_0xf4f7b7['body']['id']){delete _0xf4f7b7[_0xc627('0x44')]['id'];}return db['WhatsappApplication'][_0xc627('0x42')]({'where':{'id':_0xf4f7b7['params']['id']}})[_0xc627('0x21')](handleEntityNotFound(_0x12b436,null))[_0xc627('0x21')](saveUpdates(_0xf4f7b7[_0xc627('0x44')],null))[_0xc627('0x21')](respondWithResult(_0x12b436,null))[_0xc627('0x3e')](handleError(_0x12b436,null));};exports[_0xc627('0x22')]=function(_0x5d9dc0,_0xbafb35){return db['WhatsappApplication'][_0xc627('0x42')]({'where':{'id':_0x5d9dc0['params']['id']}})[_0xc627('0x21')](handleEntityNotFound(_0xbafb35,null))[_0xc627('0x21')](removeEntity(_0xbafb35,null))['catch'](handleError(_0xbafb35,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 52494dc..96f99f0 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 _0xae60=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2f394d,_0xd986cb){var _0x2f4dcd=function(_0x2db6bd){while(--_0x2db6bd){_0x2f394d['push'](_0x2f394d['shift']());}};_0x2f4dcd(++_0xd986cb);}(_0xae60,0x1c7));var _0x0ae6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xae60[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('api');var moment=require(_0x0ae6('0x3'));var BPromise=require(_0x0ae6('0x4'));var rp=require(_0x0ae6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae6('0x6'));var config=require(_0x0ae6('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x0ae6('0x8')]=function(_0x25ac7c,_0x30e000){return _0x25ac7c[_0x0ae6('0x9')](_0x0ae6('0xa'),attributes,{'tableName':_0x0ae6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ae6('0xc'),'collate':_0x0ae6('0xd')});}; \ No newline at end of file +var _0x0833=['rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','lodash','util','../../config/logger','api','moment'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0x0833,0x1bd));var _0x3083=function(_0x248332,_0x51c9a5){_0x248332=_0x248332-0x0;var _0x2c8421=_0x0833[_0x248332];return _0x2c8421;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var logger=require(_0x3083('0x2'))(_0x3083('0x3'));var moment=require(_0x3083('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3083('0x5'));var config=require('../../config/environment');var attributes=require(_0x3083('0x6'));module[_0x3083('0x7')]=function(_0x914cec,_0x58ed49){return _0x914cec[_0x3083('0x8')](_0x3083('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index d267192..c7d4e7c 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 _0xf69d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappApplication,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xb49cb8,_0x39474b){var _0x879ead=function(_0x596639){while(--_0x596639){_0xb49cb8['push'](_0xb49cb8['shift']());}};_0x879ead(++_0x39474b);}(_0xf69d,0xd3));var _0xdf69=function(_0x3c0bbf,_0x5d7052){_0x3c0bbf=_0x3c0bbf-0x0;var _0x2bac03=_0xf69d[_0x3c0bbf];return _0x2bac03;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2501,_0x12c186,_0x18a08e){return new BPromise(function(_0xc1b77e,_0x38909e){return client[_0xdf69('0xd')](_0x1d2501,_0x18a08e)[_0xdf69('0xe')](function(_0x211ea9){logger[_0xdf69('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));logger[_0xdf69('0x11')](_0xdf69('0x12'),_0x12c186,_0xdf69('0x10'),JSON[_0xdf69('0x13')](_0x211ea9));if(_0x211ea9[_0xdf69('0x14')]){if(_0x211ea9['error']['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);return _0x38909e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x211ea9['error'][_0xdf69('0x15')]);return _0xc1b77e(_0x211ea9[_0xdf69('0x14')][_0xdf69('0x15')]);}else{logger[_0xdf69('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x12c186,_0xdf69('0x10'));_0xc1b77e(_0x211ea9['result'][_0xdf69('0x15')]);}})[_0xdf69('0x17')](function(_0x5263a4){logger[_0xdf69('0x14')](_0xdf69('0x16'),_0x12c186,_0x5263a4);_0x38909e(_0x5263a4);});});} \ No newline at end of file +var _0x1696=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result'];(function(_0xca39e1,_0x3ff6ef){var _0x3b07c5=function(_0x3e713f){while(--_0x3e713f){_0xca39e1['push'](_0xca39e1['shift']());}};_0x3b07c5(++_0x3ff6ef);}(_0x1696,0x79));var _0x6169=function(_0x36dd0f,_0x57d8d0){_0x36dd0f=_0x36dd0f-0x0;var _0x3fb834=_0x1696[_0x36dd0f];return _0x3fb834;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var moment=require(_0x6169('0x1'));var BPromise=require(_0x6169('0x2'));var rs=require(_0x6169('0x3'));var fs=require('fs');var Redis=require(_0x6169('0x4'));var db=require(_0x6169('0x5'))['db'];var utils=require(_0x6169('0x6'));var logger=require(_0x6169('0x7'))(_0x6169('0x8'));var config=require(_0x6169('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6169('0xa')][_0x6169('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x277459,_0x6f5cec,_0x289333){return new BPromise(function(_0x2a1658,_0x40350b){return client['request'](_0x277459,_0x289333)[_0x6169('0xc')](function(_0x519a4d){logger[_0x6169('0xd')](_0x6169('0xe'),_0x6f5cec,'request\x20sent');logger[_0x6169('0xf')](_0x6169('0x10'),_0x6f5cec,_0x6169('0x11'),JSON[_0x6169('0x12')](_0x519a4d));if(_0x519a4d['error']){if(_0x519a4d['error'][_0x6169('0x13')]===0x1f4){logger[_0x6169('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);return _0x40350b(_0x519a4d[_0x6169('0x14')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);return _0x2a1658(_0x519a4d[_0x6169('0x14')][_0x6169('0x15')]);}else{logger[_0x6169('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x6f5cec,_0x6169('0x11'));_0x2a1658(_0x519a4d[_0x6169('0x16')]['message']);}})[_0x6169('0x17')](function(_0x5afc48){logger[_0x6169('0x14')](_0x6169('0xe'),_0x6f5cec,_0x5afc48);_0x40350b(_0x5afc48);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 71486ea..c0f0bf7 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 _0x2090=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports'];(function(_0x36ad26,_0x2c4af6){var _0x59daa0=function(_0x3076db){while(--_0x3076db){_0x36ad26['push'](_0x36ad26['shift']());}};_0x59daa0(++_0x2c4af6);}(_0x2090,0xae));var _0x0209=function(_0x106590,_0x20cf3e){_0x106590=_0x106590-0x0;var _0x13b71c=_0x2090[_0x106590];return _0x13b71c;};'use strict';var multer=require('multer');var util=require(_0x0209('0x0'));var path=require(_0x0209('0x1'));var timeout=require('connect-timeout');var express=require(_0x0209('0x2'));var router=express[_0x0209('0x3')]();var auth=require(_0x0209('0x4'));var interaction=require(_0x0209('0x5'));var config=require(_0x0209('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x0209('0x7')]('/',auth['isAuthenticated'](),controller[_0x0209('0x8')]);router[_0x0209('0x7')]('/describe',auth[_0x0209('0x9')](),controller['describe']);router[_0x0209('0x7')](_0x0209('0xa'),auth[_0x0209('0x9')](),controller['show']);router[_0x0209('0x7')](_0x0209('0xb'),auth[_0x0209('0x9')](),controller[_0x0209('0xc')]);router[_0x0209('0x7')](_0x0209('0xd'),auth['isAuthenticated'](),controller[_0x0209('0xe')]);router['post']('/',auth[_0x0209('0x9')](),controller['create']);router[_0x0209('0xf')](_0x0209('0xb'),auth[_0x0209('0x9')](),controller[_0x0209('0x10')]);router['post']('/:id/tags',auth[_0x0209('0x9')](),interaction[_0x0209('0x11')]('whatsapp',_0x0209('0x12')),controller[_0x0209('0x13')]);router[_0x0209('0x14')](_0x0209('0xa'),auth[_0x0209('0x9')](),interaction[_0x0209('0x11')](_0x0209('0x15'),_0x0209('0x16')),controller['update']);router[_0x0209('0x17')](_0x0209('0xa'),auth[_0x0209('0x9')](),interaction[_0x0209('0x11')]('whatsapp',_0x0209('0x18')),controller[_0x0209('0x19')]);router[_0x0209('0x17')](_0x0209('0x1a'),auth[_0x0209('0x9')](),controller[_0x0209('0x1b')]);module[_0x0209('0x1c')]=router; \ No newline at end of file +var _0xf498=['post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xf498,0x108));var _0x8f49=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xf498[_0x9fd887];return _0x1a54ab;};'use strict';var multer=require(_0x8f49('0x0'));var util=require('util');var path=require(_0x8f49('0x1'));var timeout=require(_0x8f49('0x2'));var express=require('express');var router=express[_0x8f49('0x3')]();var auth=require(_0x8f49('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f49('0x5'));router[_0x8f49('0x6')]('/',auth[_0x8f49('0x7')](),controller['index']);router[_0x8f49('0x6')](_0x8f49('0x8'),auth[_0x8f49('0x7')](),controller[_0x8f49('0x9')]);router['get'](_0x8f49('0xa'),auth[_0x8f49('0x7')](),controller['show']);router[_0x8f49('0x6')](_0x8f49('0xb'),auth[_0x8f49('0x7')](),controller[_0x8f49('0xc')]);router[_0x8f49('0x6')](_0x8f49('0xd'),auth[_0x8f49('0x7')](),controller[_0x8f49('0xe')]);router[_0x8f49('0xf')]('/',auth[_0x8f49('0x7')](),controller[_0x8f49('0x10')]);router[_0x8f49('0xf')](_0x8f49('0xb'),auth[_0x8f49('0x7')](),controller[_0x8f49('0x11')]);router[_0x8f49('0xf')]('/:id/tags',auth[_0x8f49('0x7')](),interaction[_0x8f49('0x12')](_0x8f49('0x13'),_0x8f49('0x14')),controller[_0x8f49('0x15')]);router[_0x8f49('0x16')](_0x8f49('0xa'),auth[_0x8f49('0x7')](),interaction[_0x8f49('0x12')](_0x8f49('0x13'),_0x8f49('0x17')),controller[_0x8f49('0x18')]);router['delete'](_0x8f49('0xa'),auth[_0x8f49('0x7')](),interaction['tracked'](_0x8f49('0x13'),_0x8f49('0x19')),controller[_0x8f49('0x1a')]);router[_0x8f49('0x1b')](_0x8f49('0x1c'),auth[_0x8f49('0x7')](),controller[_0x8f49('0x1d')]);module[_0x8f49('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 44e9262..96042ff 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 _0xeee3=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xeee3,0x1e5));var _0x3eee=function(_0x37437e,_0x5ebc8d){_0x37437e=_0x37437e-0x0;var _0x5ade52=_0xeee3[_0x37437e];return _0x5ade52;};'use strict';var Sequelize=require(_0x3eee('0x0'));var moment=require(_0x3eee('0x1'));module[_0x3eee('0x2')]={'closed':{'type':Sequelize[_0x3eee('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3eee('0x4')]},'disposition':{'type':Sequelize[_0x3eee('0x5')]},'note':{'type':Sequelize[_0x3eee('0x5')]},'phone':{'type':Sequelize[_0x3eee('0x5')]},'read1stAt':{'type':Sequelize[_0x3eee('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3eee('0x6')]('in',_0x3eee('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3eee('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3eee('0x6')]('in',_0x3eee('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xccfc=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x192fa0,_0x5023c4){var _0x422a61=function(_0x5916ef){while(--_0x5916ef){_0x192fa0['push'](_0x192fa0['shift']());}};_0x422a61(++_0x5023c4);}(_0xccfc,0xdb));var _0xcccf=function(_0x161287,_0x3ecd82){_0x161287=_0x161287-0x0;var _0x5da653=_0xccfc[_0x161287];return _0x5da653;};'use strict';var Sequelize=require(_0xcccf('0x0'));var moment=require(_0xcccf('0x1'));module[_0xcccf('0x2')]={'closed':{'type':Sequelize[_0xcccf('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcccf('0x4')]},'disposition':{'type':Sequelize[_0xcccf('0x5')]},'note':{'type':Sequelize[_0xcccf('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xcccf('0x6')]('in',_0xcccf('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcccf('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 67378e2..cbd70c0 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x4546d8,_0x452155){var _0x20f0e7=function(_0x5a9951){while(--_0x5a9951){_0x4546d8['push'](_0x4546d8['shift']());}};_0x20f0e7(++_0x452155);}(_0xadb5,0xad));var _0x5adb=function(_0x1b85a3,_0x37d8f7){_0x1b85a3=_0x1b85a3-0x0;var _0x669abc=_0xadb5[_0x1b85a3];return _0x669abc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x3c7bd7,_0x37703e){var _0x4e0d2a=function(_0x597e30){while(--_0x597e30){_0x3c7bd7['push'](_0x3c7bd7['shift']());}};_0x4e0d2a(++_0x37703e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ef4c10d..d4e18f0 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 _0xf5c5=['then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xf5c5,0x13b));var _0x5f5c=function(_0x2e181c,_0x50246a){_0x2e181c=_0x2e181c-0x0;var _0x4c1d9e=_0xf5c5[_0x2e181c];return _0x4c1d9e;};'use strict';var EventEmitter=require(_0x5f5c('0x0'));var WhatsappInteraction=require(_0x5f5c('0x1'))['db'][_0x5f5c('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x5f5c('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5f5c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f5c('0x5'),'afterDestroy':_0x5f5c('0x6')};function emitEvent(_0x8e759b){return function(_0x223647,_0x59fbb9,_0x4a684e){_0x223647[_0x5f5c('0x7')]({'attributes':['id'],'raw':!![]})[_0x5f5c('0x8')](function(_0x173381){_0x223647['setDataValue']('Users',_0x173381[_0x5f5c('0x9')](function(_0x470e07){return{'id':_0x470e07['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x223647['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f5c('0x8')](function(_0x2e1645){_0x223647[_0x5f5c('0xa')](_0x5f5c('0xb'),_0x2e1645[_0x5f5c('0xc')]);WhatsappInteractionEvents[_0x5f5c('0xd')](_0x8e759b+':'+_0x223647['id'],_0x223647);WhatsappInteractionEvents[_0x5f5c('0xd')](_0x8e759b,_0x223647);_0x4a684e(null);})[_0x5f5c('0xe')](_0x4a684e(null));};}for(var e in events){if(events[_0x5f5c('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x5f5c('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x2978=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','Users','setDataValue'];(function(_0x28e0c5,_0xae901c){var _0x154afc=function(_0x9a6c91){while(--_0x9a6c91){_0x28e0c5['push'](_0x28e0c5['shift']());}};_0x154afc(++_0xae901c);}(_0x2978,0x111));var _0x8297=function(_0x3e7a0a,_0x427c37){_0x3e7a0a=_0x3e7a0a-0x0;var _0x2821c4=_0x2978[_0x3e7a0a];return _0x2821c4;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x8297('0x0'))['db'][_0x8297('0x1')];var WhatsappMessage=require(_0x8297('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x8297('0x2')](0x0);var events={'afterCreate':_0x8297('0x3'),'afterUpdate':_0x8297('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5eadaf){return function(_0x50a3c9,_0x442941,_0xebf9b7){_0x50a3c9['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xc9cc56){_0x50a3c9['setDataValue'](_0x8297('0x5'),_0xc9cc56['map'](function(_0x5e7d9d){return{'id':_0x5e7d9d['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x50a3c9['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24d9e5){_0x50a3c9[_0x8297('0x6')](_0x8297('0x7'),_0x24d9e5[_0x8297('0x8')]);WhatsappInteractionEvents[_0x8297('0x9')](_0x5eadaf+':'+_0x50a3c9['id'],_0x50a3c9);WhatsappInteractionEvents[_0x8297('0x9')](_0x5eadaf,_0x50a3c9);_0xebf9b7(null);})[_0x8297('0xa')](_0xebf9b7(null));};}for(var e in events){if(events[_0x8297('0xb')](e)){var event=events[e];WhatsappInteraction[_0x8297('0xc')](e,emitEvent(event));}}module[_0x8297('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f529b4a..9de9f11 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x55bfef,_0x26fb96){var _0x1f3ca1=function(_0x5d7c32){while(--_0x5d7c32){_0x55bfef['push'](_0x55bfef['shift']());}};_0x1f3ca1(++_0x26fb96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0xa0a1e4,_0x41cbd7){var _0x43875a=function(_0x5e442e){while(--_0x5e442e){_0xa0a1e4['push'](_0xa0a1e4['shift']());}};_0x43875a(++_0x41cbd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 2c2d741..eef9dbe 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 _0xaa87=['code','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0xaa87,0x66));var _0x7aa8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xaa87[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x7aa8('0x0'));var util=require(_0x7aa8('0x1'));var moment=require(_0x7aa8('0x2'));var BPromise=require(_0x7aa8('0x3'));var rs=require(_0x7aa8('0x4'));var fs=require('fs');var Redis=require(_0x7aa8('0x5'));var db=require(_0x7aa8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7aa8('0x7'))(_0x7aa8('0x8'));var config=require(_0x7aa8('0x9'));var jayson=require(_0x7aa8('0xa'));var client=jayson[_0x7aa8('0xb')][_0x7aa8('0xc')]({'port':0x232a});config[_0x7aa8('0xd')]=_[_0x7aa8('0xe')](config[_0x7aa8('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7aa8('0xd')]));require(_0x7aa8('0xf'))[_0x7aa8('0x10')](socket);function respondWithRpcPromise(_0x4b5399,_0x19d18b,_0x41f8b3){return new BPromise(function(_0x1e2395,_0x22bb50){return client[_0x7aa8('0x11')](_0x4b5399,_0x41f8b3)[_0x7aa8('0x12')](function(_0x2b973e){logger[_0x7aa8('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x7aa8('0x14'));logger[_0x7aa8('0x15')](_0x7aa8('0x16'),_0x19d18b,'request\x20sent',JSON[_0x7aa8('0x17')](_0x2b973e));if(_0x2b973e['error']){if(_0x2b973e['error'][_0x7aa8('0x18')]===0x1f4){logger[_0x7aa8('0x19')](_0x7aa8('0x1a'),_0x19d18b,_0x2b973e[_0x7aa8('0x19')]['message']);return _0x22bb50(_0x2b973e[_0x7aa8('0x19')][_0x7aa8('0x1b')]);}logger[_0x7aa8('0x19')](_0x7aa8('0x1a'),_0x19d18b,_0x2b973e['error'][_0x7aa8('0x1b')]);return _0x1e2395(_0x2b973e['error'][_0x7aa8('0x1b')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x7aa8('0x14'));_0x1e2395(_0x2b973e[_0x7aa8('0x1c')][_0x7aa8('0x1b')]);}})[_0x7aa8('0x1d')](function(_0x232b60){logger[_0x7aa8('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x19d18b,_0x232b60);_0x22bb50(_0x232b60);});});}exports[_0x7aa8('0x1e')]=function(_0x2f2c69){var _0xf6827f=this;return new Promise(function(_0x223823,_0x9914e4){return db[_0x7aa8('0x1f')][_0x7aa8('0x20')](_0x2f2c69[_0x7aa8('0x21')],{'raw':_0x2f2c69['options']?_0x2f2c69[_0x7aa8('0x22')][_0x7aa8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2c69[_0x7aa8('0x22')]?_0x2f2c69[_0x7aa8('0x22')][_0x7aa8('0x24')]||null:null,'attributes':_0x2f2c69[_0x7aa8('0x22')]?_0x2f2c69['options']['attributes']||null:null,'limit':_0x2f2c69['options']?_0x2f2c69[_0x7aa8('0x22')]['limit']||null:null})[_0x7aa8('0x12')](function(_0xa061b0){logger[_0x7aa8('0x13')](_0x7aa8('0x1e'),_0x2f2c69);logger[_0x7aa8('0x15')](_0x7aa8('0x1e'),_0x2f2c69,JSON[_0x7aa8('0x17')](_0xa061b0));_0x223823(_0xa061b0);})['catch'](function(_0x5f08b4){logger['error'](_0x7aa8('0x1e'),_0x5f08b4['message'],_0x2f2c69);_0x9914e4(_0xf6827f[_0x7aa8('0x19')](0x1f4,_0x5f08b4[_0x7aa8('0x1b')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2c92f2){return new Promise(function(_0x5aeb9b,_0x25bee9){return db['WhatsappInteraction']['find']({'where':_0x2c92f2[_0x7aa8('0x22')]?_0x2c92f2[_0x7aa8('0x22')][_0x7aa8('0x24')]||null:null})[_0x7aa8('0x12')](function(_0x538d28){if(_0x538d28){return _0x538d28[_0x7aa8('0x25')](_0x2c92f2[_0x7aa8('0x21')][_0x7aa8('0x26')],_[_0x7aa8('0x27')](_0x2c92f2[_0x7aa8('0x21')],[_0x7aa8('0x26'),'id'])||{});}})[_0x7aa8('0x28')](function(_0x132945){logger[_0x7aa8('0x13')](_0x7aa8('0x29'),_0x2c92f2);logger[_0x7aa8('0x15')](_0x7aa8('0x29'),_0x2c92f2,JSON[_0x7aa8('0x17')](_0x132945));_0x5aeb9b(_0x132945);})[_0x7aa8('0x1d')](function(_0x337db7){logger['error']('AddTags',_0x337db7[_0x7aa8('0x1b')],_0x2c92f2);_0x25bee9(_this[_0x7aa8('0x19')](0x1f4,_0x337db7[_0x7aa8('0x1b')]));});});}; \ No newline at end of file +var _0xa416=['omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','attributes','limit','catch','AddTagsToWhatsappInteraction','find','where','addTags','ids'];(function(_0x22a55a,_0x3f6d87){var _0x3a7f95=function(_0xc771a5){while(--_0xc771a5){_0x22a55a['push'](_0x22a55a['shift']());}};_0x3a7f95(++_0x3f6d87);}(_0xa416,0x14b));var _0x6a41=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa416[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6a41('0x0'));var util=require(_0x6a41('0x1'));var moment=require('moment');var BPromise=require(_0x6a41('0x2'));var rs=require(_0x6a41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a41('0x4'))['db'];var utils=require(_0x6a41('0x5'));var logger=require(_0x6a41('0x6'))(_0x6a41('0x7'));var config=require(_0x6a41('0x8'));var jayson=require(_0x6a41('0x9'));var client=jayson['client'][_0x6a41('0xa')]({'port':0x232a});config[_0x6a41('0xb')]=_['defaults'](config[_0x6a41('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a41('0xc'))(new Redis(config['redis']));require(_0x6a41('0xd'))[_0x6a41('0xe')](socket);function respondWithRpcPromise(_0x4f3fd5,_0x1b97df,_0x4e7295){return new BPromise(function(_0x142c44,_0x54a2db){return client[_0x6a41('0xf')](_0x4f3fd5,_0x4e7295)[_0x6a41('0x10')](function(_0x44dc8f){logger[_0x6a41('0x11')](_0x6a41('0x12'),_0x1b97df,_0x6a41('0x13'));logger[_0x6a41('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1b97df,'request\x20sent',JSON[_0x6a41('0x15')](_0x44dc8f));if(_0x44dc8f[_0x6a41('0x16')]){if(_0x44dc8f[_0x6a41('0x16')][_0x6a41('0x17')]===0x1f4){logger[_0x6a41('0x16')](_0x6a41('0x12'),_0x1b97df,_0x44dc8f[_0x6a41('0x16')][_0x6a41('0x18')]);return _0x54a2db(_0x44dc8f['error'][_0x6a41('0x18')]);}logger[_0x6a41('0x16')](_0x6a41('0x12'),_0x1b97df,_0x44dc8f[_0x6a41('0x16')][_0x6a41('0x18')]);return _0x142c44(_0x44dc8f[_0x6a41('0x16')][_0x6a41('0x18')]);}else{logger[_0x6a41('0x11')](_0x6a41('0x12'),_0x1b97df,_0x6a41('0x13'));_0x142c44(_0x44dc8f[_0x6a41('0x19')]['message']);}})['catch'](function(_0xa7fdea){logger[_0x6a41('0x16')](_0x6a41('0x12'),_0x1b97df,_0xa7fdea);_0x54a2db(_0xa7fdea);});});}exports[_0x6a41('0x1a')]=function(_0x13b7d1){var _0x3379ac=this;return new Promise(function(_0x12e69a,_0x21f199){return db['WhatsappInteraction'][_0x6a41('0x1b')](_0x13b7d1[_0x6a41('0x1c')],{'raw':_0x13b7d1['options']?_0x13b7d1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13b7d1['options']?_0x13b7d1['options']['where']||null:null,'attributes':_0x13b7d1[_0x6a41('0x1d')]?_0x13b7d1[_0x6a41('0x1d')][_0x6a41('0x1e')]||null:null,'limit':_0x13b7d1['options']?_0x13b7d1[_0x6a41('0x1d')][_0x6a41('0x1f')]||null:null})[_0x6a41('0x10')](function(_0x4eb5aa){logger[_0x6a41('0x11')](_0x6a41('0x1a'),_0x13b7d1);logger[_0x6a41('0x14')](_0x6a41('0x1a'),_0x13b7d1,JSON[_0x6a41('0x15')](_0x4eb5aa));_0x12e69a(_0x4eb5aa);})[_0x6a41('0x20')](function(_0x52a4b1){logger[_0x6a41('0x16')](_0x6a41('0x1a'),_0x52a4b1[_0x6a41('0x18')],_0x13b7d1);_0x21f199(_0x3379ac[_0x6a41('0x16')](0x1f4,_0x52a4b1['message']));});});};exports[_0x6a41('0x21')]=function(_0xefeac4){return new Promise(function(_0x863c1b,_0x25f5be){return db['WhatsappInteraction'][_0x6a41('0x22')]({'where':_0xefeac4[_0x6a41('0x1d')]?_0xefeac4[_0x6a41('0x1d')][_0x6a41('0x23')]||null:null})['then'](function(_0x3977ea){if(_0x3977ea){return _0x3977ea[_0x6a41('0x24')](_0xefeac4[_0x6a41('0x1c')][_0x6a41('0x25')],_[_0x6a41('0x26')](_0xefeac4[_0x6a41('0x1c')],[_0x6a41('0x25'),'id'])||{});}})[_0x6a41('0x27')](function(_0x4baf03){logger['info'](_0x6a41('0x28'),_0xefeac4);logger[_0x6a41('0x14')]('AddTags',_0xefeac4,JSON[_0x6a41('0x15')](_0x4baf03));_0x863c1b(_0x4baf03);})[_0x6a41('0x20')](function(_0x48ca6e){logger[_0x6a41('0x16')](_0x6a41('0x28'),_0x48ca6e[_0x6a41('0x18')],_0xefeac4);_0x25f5be(_this['error'](0x1f4,_0x48ca6e[_0x6a41('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f217af9..9151158 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 _0xd5d7=['register','length','./whatsappInteraction.events','save','update','emit','removeListener'];(function(_0x196673,_0x549432){var _0x72dcc5=function(_0x498a60){while(--_0x498a60){_0x196673['push'](_0x196673['shift']());}};_0x72dcc5(++_0x549432);}(_0xd5d7,0xa3));var _0x7d5d=function(_0x43ab67,_0x5352aa){_0x43ab67=_0x43ab67-0x0;var _0x3fbd1b=_0xd5d7[_0x43ab67];return _0x3fbd1b;};'use strict';var WhatsappInteractionEvents=require(_0x7d5d('0x0'));var events=[_0x7d5d('0x1'),'remove',_0x7d5d('0x2')];function createListener(_0xe74e8,_0x60a31){return function(_0x4f61da){_0x60a31[_0x7d5d('0x3')](_0xe74e8,_0x4f61da);};}function removeListener(_0xefc47e,_0x3b778c){return function(){WhatsappInteractionEvents[_0x7d5d('0x4')](_0xefc47e,_0x3b778c);};}exports[_0x7d5d('0x5')]=function(_0x2f2311){for(var _0x406190=0x0,_0x12450f=events[_0x7d5d('0x6')];_0x406190<_0x12450f;_0x406190++){var _0x96df62=events[_0x406190];var _0x334da4=createListener('whatsappInteraction:'+_0x96df62,_0x2f2311);WhatsappInteractionEvents['on'](_0x96df62,_0x334da4);}}; \ No newline at end of file +var _0x894a=['emit','register','length','whatsappInteraction:','save','remove'];(function(_0xf0685b,_0x5c0aaf){var _0x2b53d2=function(_0x216bf6){while(--_0x216bf6){_0xf0685b['push'](_0xf0685b['shift']());}};_0x2b53d2(++_0x5c0aaf);}(_0x894a,0x100));var _0xa894=function(_0x2914ff,_0x2cd8c4){_0x2914ff=_0x2914ff-0x0;var _0x17fbee=_0x894a[_0x2914ff];return _0x17fbee;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xa894('0x0'),_0xa894('0x1'),'update'];function createListener(_0x1e413f,_0x305ce3){return function(_0x16898f){_0x305ce3[_0xa894('0x2')](_0x1e413f,_0x16898f);};}function removeListener(_0x4c85d6,_0x27dbbc){return function(){WhatsappInteractionEvents['removeListener'](_0x4c85d6,_0x27dbbc);};}exports[_0xa894('0x3')]=function(_0x3fdd43){for(var _0xfb0025=0x0,_0x246aed=events[_0xa894('0x4')];_0xfb0025<_0x246aed;_0xfb0025++){var _0x22615c=events[_0xfb0025];var _0x584d5d=createListener(_0xa894('0x5')+_0x22615c,_0x3fdd43);WhatsappInteractionEvents['on'](_0x22615c,_0x584d5d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ebbaa27..40af0f6 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 _0x9467=['isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','accept','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x9467,0x1cc));var _0x7946=function(_0x4e3b91,_0x2780b3){_0x4e3b91=_0x4e3b91-0x0;var _0x37ae86=_0x9467[_0x4e3b91];return _0x37ae86;};'use strict';var multer=require(_0x7946('0x0'));var util=require('util');var path=require(_0x7946('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7946('0x2')]();var auth=require(_0x7946('0x3'));var interaction=require(_0x7946('0x4'));var config=require(_0x7946('0x5'));var controller=require(_0x7946('0x6'));router[_0x7946('0x7')]('/',auth[_0x7946('0x8')](),controller[_0x7946('0x9')]);router['get'](_0x7946('0xa'),auth[_0x7946('0x8')](),controller['describe']);router[_0x7946('0x7')](_0x7946('0xb'),auth['isAuthenticated'](),controller[_0x7946('0xc')]);router[_0x7946('0xd')]('/',auth[_0x7946('0x8')](),interaction[_0x7946('0xe')](_0x7946('0xf'),_0x7946('0x10')),controller[_0x7946('0x11')]);router[_0x7946('0xd')](_0x7946('0x12'),controller[_0x7946('0x13')]);router[_0x7946('0x14')](_0x7946('0xb'),auth[_0x7946('0x8')](),controller[_0x7946('0x15')]);router[_0x7946('0x14')]('/:id/accept',auth[_0x7946('0x8')](),controller[_0x7946('0x16')]);router['put']('/:id/reject',auth[_0x7946('0x8')](),controller['reject']);router[_0x7946('0x17')]('/:id',auth[_0x7946('0x8')](),controller[_0x7946('0x18')]);module[_0x7946('0x19')]=router; \ No newline at end of file +var _0x9e28=['describe','get','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','/describe'];(function(_0x3b59aa,_0x7a990b){var _0x5cad80=function(_0x94d87b){while(--_0x94d87b){_0x3b59aa['push'](_0x3b59aa['shift']());}};_0x5cad80(++_0x7a990b);}(_0x9e28,0x1b6));var _0x89e2=function(_0x526811,_0x24f39d){_0x526811=_0x526811-0x0;var _0x5e5721=_0x9e28[_0x526811];return _0x5e5721;};'use strict';var multer=require(_0x89e2('0x0'));var util=require(_0x89e2('0x1'));var path=require(_0x89e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x89e2('0x3'));var router=express[_0x89e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x89e2('0x5'));var config=require(_0x89e2('0x6'));var controller=require(_0x89e2('0x7'));router['get']('/',auth[_0x89e2('0x8')](),controller['index']);router['get'](_0x89e2('0x9'),auth[_0x89e2('0x8')](),controller[_0x89e2('0xa')]);router[_0x89e2('0xb')](_0x89e2('0xc'),auth[_0x89e2('0x8')](),controller[_0x89e2('0xd')]);router[_0x89e2('0xe')]('/',auth[_0x89e2('0x8')](),interaction[_0x89e2('0xf')](_0x89e2('0x10'),_0x89e2('0x11')),controller['create']);router[_0x89e2('0xe')](_0x89e2('0x12'),controller[_0x89e2('0x13')]);router[_0x89e2('0x14')]('/:id',auth[_0x89e2('0x8')](),controller['update']);router[_0x89e2('0x14')](_0x89e2('0x15'),auth[_0x89e2('0x8')](),controller[_0x89e2('0x16')]);router['put'](_0x89e2('0x17'),auth['isAuthenticated'](),controller[_0x89e2('0x18')]);router[_0x89e2('0x19')](_0x89e2('0xc'),auth[_0x89e2('0x8')](),controller[_0x89e2('0x1a')]);module[_0x89e2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 138e8e1..4f98701 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 _0x253c=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x253c,0xb0));var _0xc253=function(_0x957f74,_0x687fe1){_0x957f74=_0x957f74-0x0;var _0x45347a=_0x253c[_0x957f74];return _0x45347a;};'use strict';var Sequelize=require(_0xc253('0x0'));module[_0xc253('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc253('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc253('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc253('0x4')]('in','out'),'defaultValue':_0xc253('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc253('0x6')](0xbe)},'phone':{'type':Sequelize[_0xc253('0x6')]},'readAt':{'type':Sequelize[_0xc253('0x7')]},'secret':{'type':Sequelize[_0xc253('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x76dc=['STRING','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x76dc,0x1f2));var _0xc76d=function(_0x48b385,_0x370711){_0x48b385=_0x48b385-0x0;var _0xcd86a8=_0x76dc[_0x48b385];return _0xcd86a8;};'use strict';var Sequelize=require(_0xc76d('0x0'));module[_0xc76d('0x1')]={'body':{'type':Sequelize[_0xc76d('0x2')](_0xc76d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc76d('0x4')]('in',_0xc76d('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc76d('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc76d('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d58a1a3..185669c 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 _0x561f=['query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','fields','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','read1stAt','format','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','channel','event','EventManager','acceptmessage','WhatsappInteractionId','RejectMessage','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','limit','json','apply','reject','update','end','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x561f,0x1b3));var _0xf561=function(_0x127415,_0x5d93ae){_0x127415=_0x127415-0x0;var _0xe7d513=_0x561f[_0x127415];return _0xe7d513;};'use strict';var pdf=require(_0xf561('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf561('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf561('0x2'));var moment=require('moment');var BPromise=require(_0xf561('0x3'));var Mustache=require(_0xf561('0x4'));var util=require(_0xf561('0x5'));var path=require(_0xf561('0x6'));var sox=require(_0xf561('0x7'));var csv=require(_0xf561('0x8'));var ejs=require(_0xf561('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf561('0xa'));var crypto=require(_0xf561('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf561('0xc'));var toCsv=require(_0xf561('0x8'));var querystring=require(_0xf561('0xd'));var Papa=require(_0xf561('0xe'));var Redis=require(_0xf561('0xf'));var authService=require(_0xf561('0x10'));var qs=require(_0xf561('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf561('0x12'));var logger=require(_0xf561('0x13'))(_0xf561('0x14'));var utils=require(_0xf561('0x15'));var config=require(_0xf561('0x16'));var db=require(_0xf561('0x17'))['db'];config[_0xf561('0x18')]=_[_0xf561('0x19')](config[_0xf561('0x18')],{'host':_0xf561('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf561('0x18')]));require(_0xf561('0x1b'))['register'](socket);var jayson=require(_0xf561('0x1c'));var client=jayson[_0xf561('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xf561('0x1d')][_0xf561('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x490855,_0x5f2875,_0x1ca069){if(_0x1ca069){var _0x15aa17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15aa17[_0xf561('0x1f')](_0x5f2875)){return _0x490855;}else{throw new db['Sequelize'][(_0xf561('0x20'))](_0xf561('0x21'));}}else{return _0x490855;}}function respondWithRpcPromise(_0x5aeb53,_0x5dd18f,_0x30a92f,_0x4afaa4){return new BPromise(function(_0xf0ca41,_0x359955){var _0x2204ee=_0x4afaa4||client;return _0x2204ee[_0xf561('0x22')](_0x5aeb53,_0x30a92f)[_0xf561('0x23')](function(_0x315446){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,'request\x20sent');logger[_0xf561('0x24')](_0xf561('0x25'),_0x5dd18f,_0xf561('0x26'),JSON[_0xf561('0x27')](_0x315446));if(_0x315446[_0xf561('0x28')]){if(_0x315446[_0xf561('0x28')][_0xf561('0x29')]===0x1f4){logger[_0xf561('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,_0x315446[_0xf561('0x28')][_0xf561('0x2a')]);return _0x359955(_0x315446['error'][_0xf561('0x2a')]);}logger[_0xf561('0x28')](_0xf561('0x2b'),_0x5dd18f,_0x315446[_0xf561('0x28')]['message']);return _0xf0ca41(_0x315446['error'][_0xf561('0x2a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5dd18f,_0xf561('0x26'));_0xf0ca41(_0x315446[_0xf561('0x2c')][_0xf561('0x2a')]);}})[_0xf561('0x2d')](function(_0x28eefb){logger[_0xf561('0x28')](_0xf561('0x2b'),_0x5dd18f,_0x28eefb);_0x359955(_0x28eefb);});});}function respondWithStatusCode(_0x5c752c,_0x4044c3){_0x4044c3=_0x4044c3||0xcc;return function(_0x3c5358){if(_0x3c5358){return _0x5c752c[_0xf561('0x2e')](_0x4044c3);}return _0x5c752c[_0xf561('0x2f')](_0x4044c3)['end']();};}function respondWithResult(_0x5e29fd,_0x2e9c07){_0x2e9c07=_0x2e9c07||0xc8;return function(_0x35ab97){if(_0x35ab97){return _0x5e29fd[_0xf561('0x2f')](_0x2e9c07)['json'](_0x35ab97);}};}function respondWithFilteredResult(_0x259454,_0x22c29e){return function(_0x19ea77){if(_0x19ea77){var _0x46048c=_0x19ea77[_0xf561('0x30')],_0x2fa6a9=_0x22c29e[_0xf561('0x31')],_0x349ebf=_0x22c29e[_0xf561('0x31')]+_0x22c29e[_0xf561('0x32')],_0x1fd1e4;if(_0x349ebf>=_0x46048c){_0x349ebf=_0x46048c;_0x1fd1e4=0xc8;}else{_0x1fd1e4=0xce;}_0x259454[_0xf561('0x2f')](_0x1fd1e4);return _0x259454['set']('Content-Range',_0x2fa6a9+'-'+_0x349ebf+'/'+_0x46048c)[_0xf561('0x33')](_0x19ea77);}return null;};}function patchUpdates(_0x2f0989){return function(_0x421f1e){try{jsonpatch[_0xf561('0x34')](_0x421f1e,_0x2f0989,!![]);}catch(_0x23361c){return BPromise[_0xf561('0x35')](_0x23361c);}return _0x421f1e['save']();};}function saveUpdates(_0xd31701,_0x2ab009){return function(_0x2077c1){if(_0x2077c1){return _0x2077c1[_0xf561('0x36')](_0xd31701)[_0xf561('0x23')](function(_0x5522f4){return _0x5522f4;});}return null;};}function removeEntity(_0x3ce628,_0x38ba16){return function(_0xeabdb){if(_0xeabdb){return _0xeabdb['destroy']()[_0xf561('0x23')](function(){_0x3ce628[_0xf561('0x2f')](0xcc)[_0xf561('0x37')]();});}};}function handleEntityNotFound(_0x225c9b,_0x4f8202){return function(_0xca3f84){if(!_0xca3f84){_0x225c9b[_0xf561('0x2e')](0x194);}return _0xca3f84;};}function handleError(_0x10d915,_0x29d46b){_0x29d46b=_0x29d46b||0x1f4;return function(_0x5acf24){logger['error'](_0x5acf24[_0xf561('0x38')]);if(_0x5acf24[_0xf561('0x39')]){delete _0x5acf24[_0xf561('0x39')];}_0x10d915['status'](_0x29d46b)['send'](_0x5acf24);};}exports[_0xf561('0x3a')]=function(_0x1f0c0d,_0x54b1a4){var _0x3c8815={},_0x1cddcd={},_0x4a27ce={'count':0x0,'rows':[]};var _0x705f41=_[_0xf561('0x3b')](db[_0xf561('0x3c')][_0xf561('0x3d')],function(_0x5dbd09){return{'name':_0x5dbd09[_0xf561('0x3e')],'type':_0x5dbd09[_0xf561('0x3f')]['key']};});_0x1cddcd[_0xf561('0x40')]=_[_0xf561('0x3b')](_0x705f41,_0xf561('0x39'));_0x1cddcd[_0xf561('0x41')]=_[_0xf561('0x42')](_0x1f0c0d[_0xf561('0x41')]);_0x1cddcd[_0xf561('0x43')]=_[_0xf561('0x44')](_0x1cddcd['model'],_0x1cddcd[_0xf561('0x41')]);_0x3c8815['attributes']=_[_0xf561('0x44')](_0x1cddcd['model'],qs['fields'](_0x1f0c0d[_0xf561('0x41')]['fields']));_0x3c8815[_0xf561('0x45')]=_0x3c8815[_0xf561('0x45')][_0xf561('0x46')]?_0x3c8815['attributes']:_0x1cddcd['model'];if(!_0x1f0c0d['query'][_0xf561('0x47')]('nolimit')){_0x3c8815[_0xf561('0x32')]=qs[_0xf561('0x32')](_0x1f0c0d[_0xf561('0x41')][_0xf561('0x32')]);_0x3c8815[_0xf561('0x31')]=qs[_0xf561('0x31')](_0x1f0c0d['query'][_0xf561('0x31')]);}_0x3c8815['order']=qs['sort'](_0x1f0c0d[_0xf561('0x41')][_0xf561('0x48')]);_0x3c8815[_0xf561('0x49')]=qs[_0xf561('0x43')](_['pick'](_0x1f0c0d[_0xf561('0x41')],_0x1cddcd[_0xf561('0x43')]),_0x705f41);if(_0x1f0c0d[_0xf561('0x41')][_0xf561('0x4a')]){_0x3c8815[_0xf561('0x49')]=_[_0xf561('0x4b')](_0x3c8815[_0xf561('0x49')],{'$or':_[_0xf561('0x3b')](_0x705f41,function(_0x444060){if(_0x444060[_0xf561('0x3f')]!==_0xf561('0x4c')){var _0xe923d3={};_0xe923d3[_0x444060[_0xf561('0x39')]]={'$like':'%'+_0x1f0c0d[_0xf561('0x41')][_0xf561('0x4a')]+'%'};return _0xe923d3;}})});}_0x3c8815=_['merge']({},_0x3c8815,_0x1f0c0d[_0xf561('0x4d')]);var _0x4bbe81={'where':_0x3c8815[_0xf561('0x49')]};return db[_0xf561('0x3c')][_0xf561('0x30')](_0x4bbe81)[_0xf561('0x23')](function(_0x3e3e25){_0x4a27ce[_0xf561('0x30')]=_0x3e3e25;if(_0x1f0c0d['query'][_0xf561('0x4e')]){_0x3c8815['include']=[{'all':!![]}];}return db[_0xf561('0x3c')][_0xf561('0x4f')](_0x3c8815);})[_0xf561('0x23')](function(_0x541b59){_0x4a27ce['rows']=_0x541b59;return _0x4a27ce;})['then'](respondWithFilteredResult(_0x54b1a4,_0x3c8815))[_0xf561('0x2d')](handleError(_0x54b1a4,null));};exports[_0xf561('0x50')]=function(_0x55c4fd,_0x3337df){var _0x185470={'raw':!![],'where':{'id':_0x55c4fd[_0xf561('0x51')]['id']}},_0x265e1b={};_0x265e1b['model']=_[_0xf561('0x42')](db[_0xf561('0x3c')][_0xf561('0x3d')]);_0x265e1b['query']=_[_0xf561('0x42')](_0x55c4fd['query']);_0x265e1b[_0xf561('0x43')]=_[_0xf561('0x44')](_0x265e1b[_0xf561('0x40')],_0x265e1b['query']);_0x185470[_0xf561('0x45')]=_[_0xf561('0x44')](_0x265e1b['model'],qs[_0xf561('0x52')](_0x55c4fd[_0xf561('0x41')][_0xf561('0x52')]));_0x185470[_0xf561('0x45')]=_0x185470[_0xf561('0x45')][_0xf561('0x46')]?_0x185470[_0xf561('0x45')]:_0x265e1b[_0xf561('0x40')];if(_0x55c4fd[_0xf561('0x41')][_0xf561('0x4e')]){_0x185470[_0xf561('0x53')]=[{'all':!![]}];}_0x185470=_['merge']({},_0x185470,_0x55c4fd['options']);return db['WhatsappMessage'][_0xf561('0x54')](_0x185470)[_0xf561('0x23')](handleEntityNotFound(_0x3337df,null))[_0xf561('0x23')](respondWithResult(_0x3337df,null))['catch'](handleError(_0x3337df,null));};exports['create']=function(_0x2b254b,_0x5ca52c){return db['WhatsappMessage'][_0xf561('0x55')](_0x2b254b[_0xf561('0x56')],{})[_0xf561('0x23')](respondWithResult(_0x5ca52c,0xc9))[_0xf561('0x2d')](handleError(_0x5ca52c,null));};exports[_0xf561('0x36')]=function(_0x3e00ff,_0x1438a0){if(_0x3e00ff['body']['id']){delete _0x3e00ff[_0xf561('0x56')]['id'];}return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x3e00ff[_0xf561('0x51')]['id']}})[_0xf561('0x23')](handleEntityNotFound(_0x1438a0,null))[_0xf561('0x23')](saveUpdates(_0x3e00ff[_0xf561('0x56')],null))[_0xf561('0x23')](respondWithResult(_0x1438a0,null))[_0xf561('0x2d')](handleError(_0x1438a0,null));};exports[_0xf561('0x57')]=function(_0x1f7ece,_0x9af544){return db[_0xf561('0x3c')]['find']({'where':{'id':_0x1f7ece[_0xf561('0x51')]['id']}})['then'](handleEntityNotFound(_0x9af544,null))[_0xf561('0x23')](removeEntity(_0x9af544,null))[_0xf561('0x2d')](handleError(_0x9af544,null));};exports[_0xf561('0x58')]=function(_0x1c4520,_0xac130e){return db[_0xf561('0x3c')][_0xf561('0x58')]()[_0xf561('0x23')](respondWithResult(_0xac130e,null))[_0xf561('0x2d')](handleError(_0xac130e,null));};var interaction_log=require(_0xf561('0x13'))(_0xf561('0x59'));exports[_0xf561('0x5a')]=function(_0x5c4e52,_0x2ca2d5,_0x23a16){var _0x43e375={'channel':_0xf561('0x5b')};if(_0x5c4e52['body']['id']){delete _0x5c4e52[_0xf561('0x56')]['id'];}_0x5c4e52[_0xf561('0x56')][_0xf561('0x5c')]=!![];_0x5c4e52[_0xf561('0x56')]['readAt']=moment()['format'](_0xf561('0x5d'));_0x5c4e52[_0xf561('0x56')][_0xf561('0x5e')]=_0x5c4e52[_0xf561('0x56')][_0xf561('0x5e')]||_0x5c4e52[_0xf561('0x5f')]['id'];return db[_0xf561('0x3c')][_0xf561('0x54')]({'where':{'id':_0x5c4e52[_0xf561('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xf561('0x60')],'as':_0xf561('0x61')}]})[_0xf561('0x23')](handleEntityNotFound(_0x2ca2d5,null))[_0xf561('0x23')](saveUpdates(_0x5c4e52['body'],null))[_0xf561('0x23')](function(_0x310541){if(_0x310541){_0x43e375[_0xf561('0x2a')]=_0x310541[_0xf561('0x62')]({'plain':!![]});return db[_0xf561('0x63')][_0xf561('0x54')]({'where':{'id':_0x310541['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2ca2d5,null))[_0xf561('0x23')](function(_0x413c55){if(_0x413c55){return _0x413c55['update']({'UserId':_0x5c4e52['body']['UserId'],'read1stAt':_['isNil'](_0x413c55[_0xf561('0x64')])?moment()[_0xf561('0x65')](_0xf561('0x5d')):undefined});}return null;})[_0xf561('0x23')](function(_0x3fe91b){if(_0x3fe91b){_0x43e375[_0xf561('0x66')]=_0x3fe91b[_0xf561('0x62')]({'plain':!![]});interaction_log[_0xf561('0x67')](_0xf561('0x68'),_0x5c4e52[_0xf561('0x5f')]['id'],_0x5c4e52['user'][_0xf561('0x39')],_0x5c4e52[_0xf561('0x5f')][_0xf561('0x69')],_0x43e375['interaction']['id'],_0x5c4e52[_0xf561('0x56')]?JSON[_0xf561('0x27')](_0x5c4e52[_0xf561('0x56')]):_0xf561('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xf561('0x6b'),_0x43e375);}return null;})[_0xf561('0x23')](function(_0x6ee15f){if(_0x6ee15f){if(_0x5c4e52['body']['manual']){_0x43e375[_0xf561('0x2a')][_0xf561('0x6c')]=util['format']('SIP/%s',_0x5c4e52['user'][_0xf561('0x39')]);_0x43e375[_0xf561('0x2a')][_0xf561('0x6d')]=_0x43e375[_0xf561('0x6d')];_0x43e375[_0xf561('0x2a')][_0xf561('0x6e')]=_0xf561('0x5a');return respondWithRpcPromise(_0xf561('0x6f'),'EventManager',{'event':_0xf561('0x70'),'message':_0x43e375[_0xf561('0x2a')]},client9002)[_0xf561('0x23')](function(){return _0x43e375;});}return _0x43e375;}return null;})['then'](respondWithResult(_0x2ca2d5,null))[_0xf561('0x2d')](handleError(_0x2ca2d5,null));};var interaction_log=require(_0xf561('0x13'))(_0xf561('0x59'));exports['reject']=function(_0x592b73,_0x137ebf,_0x1a9208){var _0x2a5d2d={'agent':{},'channel':'whatsapp'};if(_0x592b73[_0xf561('0x56')]['id']){delete _0x592b73['body']['id'];}_0x592b73[_0xf561('0x56')][_0xf561('0x5e')]=_0x592b73[_0xf561('0x56')][_0xf561('0x5e')]||_0x592b73['user']['id'];_0x2a5d2d['agent']['id']=_0x592b73[_0xf561('0x56')][_0xf561('0x5e')];return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x592b73[_0xf561('0x51')]['id'],'UserId':null}})[_0xf561('0x23')](handleEntityNotFound(_0x137ebf,null))['then'](function(_0x2929a8){if(_0x2929a8){_0x2a5d2d['message']=_0x2929a8[_0xf561('0x62')]({'plain':!![]});return db[_0xf561('0x63')][_0xf561('0x54')]({'where':{'id':_0x2929a8[_0xf561('0x71')]}});}return null;})[_0xf561('0x23')](handleEntityNotFound(_0x137ebf,null))[_0xf561('0x23')](function(_0x7327b3){if(_0x7327b3){_0x2a5d2d['interaction']=_0x7327b3['get']({'plain':!![]});interaction_log[_0xf561('0x67')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x592b73['user']['id'],_0x592b73[_0xf561('0x5f')]['name'],_0x592b73[_0xf561('0x5f')]['role'],_0x2a5d2d[_0xf561('0x66')]['id'],_0x592b73[_0xf561('0x56')]?JSON[_0xf561('0x27')](_0x592b73[_0xf561('0x56')]):'null');return respondWithRpcPromise(_0xf561('0x72'),'rejectMessage',_0x2a5d2d);}return null;})[_0xf561('0x23')](function(_0x5d14b8){if(_0x5d14b8){_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6c')]=util['format'](_0xf561('0x73'),_0x592b73[_0xf561('0x5f')]['name']);_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6d')]=_0x2a5d2d['channel'];_0x5d14b8[_0xf561('0x2a')][_0xf561('0x6e')]='reject';respondWithRpcPromise(_0xf561('0x6f'),_0xf561('0x6f'),{'event':_0xf561('0x74'),'message':_0x5d14b8[_0xf561('0x2a')]},client9002);return _0x2a5d2d;}return null;})['then'](respondWithResult(_0x137ebf,null))[_0xf561('0x2d')](handleError(_0x137ebf,null));};exports['status']=function(_0x5a9365,_0x1d0cc6,_0x465ffc){if(_0x5a9365['body']['id']){delete _0x5a9365[_0xf561('0x56')]['id'];}var _0x32c8af;return db['WhatsappMessage'][_0xf561('0x54')]({'where':{'id':_0x5a9365['params']['id']}})[_0xf561('0x23')](handleEntityNotFound(_0x1d0cc6,null))['then'](function(_0xf487ca){if(_0xf487ca){_0x32c8af=_0xf487ca;return db['WhatsappAccount'][_0xf561('0x54')]({'where':{'id':_0xf487ca[_0xf561('0x75')]}});}})['then'](handleEntityNotFound(_0x1d0cc6,null))[_0xf561('0x23')](function(_0xaf223b){if(_0xaf223b){logger['debug'](_0xf561('0x76'),_0xf561('0x2f'),_0xf561('0x77'),_0xaf223b[_0xf561('0x3f')],util[_0xf561('0x78')](_0x5a9365[_0xf561('0x56')],{'showHidden':![],'depth':null}));switch(_0xaf223b[_0xf561('0x3f')]){case _0xf561('0x79'):if(_0x5a9365[_0xf561('0x56')]['MessageSid']&&_0x5a9365['body']['MessageSid']===_0x32c8af[_0xf561('0x7a')]&&_0x5a9365[_0xf561('0x56')]['MessageStatus']&&_0x5a9365[_0xf561('0x56')][_0xf561('0x7b')]===_0xf561('0x5c')){return _0x32c8af[_0xf561('0x36')]({'read':!![]});}else{logger[_0xf561('0x28')](_0xf561('0x7c'),_0xf561('0x2f'),_0xf561('0x79'),util[_0xf561('0x78')](_0x5a9365[_0xf561('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x32c8af;}})[_0xf561('0x23')](respondWithResult(_0x1d0cc6,null))['catch'](handleError(_0x1d0cc6,null));}; \ No newline at end of file +var _0x6927=['rimraf','zip-dir','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','ValidationError','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','name','send','index','map','WhatsappMessage','rawAttributes','key','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','params','keys','fields','includeAll','merge','create','body','find','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','user','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','type','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2ee233,_0x25ad8f){var _0x569ed0=function(_0x30d115){while(--_0x30d115){_0x2ee233['push'](_0x2ee233['shift']());}};_0x569ed0(++_0x25ad8f);}(_0x6927,0x177));var _0x7692=function(_0x41adf4,_0x453cae){_0x41adf4=_0x41adf4-0x0;var _0x4a356f=_0x6927[_0x41adf4];return _0x4a356f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7692('0x0'));var zipdir=require(_0x7692('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7692('0x2'));var BPromise=require(_0x7692('0x3'));var Mustache=require(_0x7692('0x4'));var util=require(_0x7692('0x5'));var path=require(_0x7692('0x6'));var sox=require('sox');var csv=require(_0x7692('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7692('0x8'));var squel=require('squel');var crypto=require(_0x7692('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7692('0xa'));var toCsv=require(_0x7692('0x7'));var querystring=require(_0x7692('0xb'));var Papa=require('papaparse');var Redis=require(_0x7692('0xc'));var authService=require(_0x7692('0xd'));var qs=require(_0x7692('0xe'));var as=require(_0x7692('0xf'));var hardwareService=require(_0x7692('0x10'));var logger=require('../../config/logger')(_0x7692('0x11'));var utils=require(_0x7692('0x12'));var config=require('../../config/environment');var db=require(_0x7692('0x13'))['db'];config['redis']=_[_0x7692('0x14')](config[_0x7692('0x15')],{'host':_0x7692('0x16'),'port':0x18eb});var socket=require(_0x7692('0x17'))(new Redis(config[_0x7692('0x15')]));require(_0x7692('0x18'))['register'](socket);var jayson=require(_0x7692('0x19'));var client=jayson[_0x7692('0x1a')][_0x7692('0x1b')]({'port':0x232c});var client9002=jayson[_0x7692('0x1a')][_0x7692('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x590a32,_0x1f85a4,_0x1dcb58){if(_0x1dcb58){var _0x3467fe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3467fe['test'](_0x1f85a4)){return _0x590a32;}else{throw new db['Sequelize'][(_0x7692('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x590a32;}}function respondWithRpcPromise(_0x102f39,_0x6dff2c,_0x5afa03,_0x8c45da){return new BPromise(function(_0x1866ec,_0x502352){var _0x54dc32=_0x8c45da||client;return _0x54dc32[_0x7692('0x1d')](_0x102f39,_0x5afa03)['then'](function(_0x3bbb87){logger[_0x7692('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x6dff2c,_0x7692('0x1f'));logger[_0x7692('0x20')](_0x7692('0x21'),_0x6dff2c,_0x7692('0x1f'),JSON[_0x7692('0x22')](_0x3bbb87));if(_0x3bbb87['error']){if(_0x3bbb87[_0x7692('0x23')][_0x7692('0x24')]===0x1f4){logger[_0x7692('0x23')](_0x7692('0x25'),_0x6dff2c,_0x3bbb87[_0x7692('0x23')][_0x7692('0x26')]);return _0x502352(_0x3bbb87['error'][_0x7692('0x26')]);}logger['error'](_0x7692('0x25'),_0x6dff2c,_0x3bbb87[_0x7692('0x23')][_0x7692('0x26')]);return _0x1866ec(_0x3bbb87[_0x7692('0x23')][_0x7692('0x26')]);}else{logger['info'](_0x7692('0x25'),_0x6dff2c,_0x7692('0x1f'));_0x1866ec(_0x3bbb87[_0x7692('0x27')][_0x7692('0x26')]);}})[_0x7692('0x28')](function(_0x159852){logger['error'](_0x7692('0x25'),_0x6dff2c,_0x159852);_0x502352(_0x159852);});});}function respondWithStatusCode(_0x17d8b8,_0x3413b8){_0x3413b8=_0x3413b8||0xcc;return function(_0x136f20){if(_0x136f20){return _0x17d8b8[_0x7692('0x29')](_0x3413b8);}return _0x17d8b8[_0x7692('0x2a')](_0x3413b8)['end']();};}function respondWithResult(_0x5e6025,_0x4dbd84){_0x4dbd84=_0x4dbd84||0xc8;return function(_0x20280d){if(_0x20280d){return _0x5e6025[_0x7692('0x2a')](_0x4dbd84)['json'](_0x20280d);}};}function respondWithFilteredResult(_0x5a8d7c,_0x52621a){return function(_0x3cbb04){if(_0x3cbb04){var _0x11fc25=_0x3cbb04[_0x7692('0x2b')],_0x30fc7d=_0x52621a[_0x7692('0x2c')],_0x34e317=_0x52621a[_0x7692('0x2c')]+_0x52621a[_0x7692('0x2d')],_0x35147d;if(_0x34e317>=_0x11fc25){_0x34e317=_0x11fc25;_0x35147d=0xc8;}else{_0x35147d=0xce;}_0x5a8d7c['status'](_0x35147d);return _0x5a8d7c[_0x7692('0x2e')](_0x7692('0x2f'),_0x30fc7d+'-'+_0x34e317+'/'+_0x11fc25)[_0x7692('0x30')](_0x3cbb04);}return null;};}function patchUpdates(_0x4f46a4){return function(_0x2c2df4){try{jsonpatch[_0x7692('0x31')](_0x2c2df4,_0x4f46a4,!![]);}catch(_0x95108a){return BPromise[_0x7692('0x32')](_0x95108a);}return _0x2c2df4['save']();};}function saveUpdates(_0x32ba3f,_0x251e53){return function(_0x60f97){if(_0x60f97){return _0x60f97[_0x7692('0x33')](_0x32ba3f)[_0x7692('0x34')](function(_0x5d4fc1){return _0x5d4fc1;});}return null;};}function removeEntity(_0x3e8d73,_0x2e08cf){return function(_0x26251f){if(_0x26251f){return _0x26251f[_0x7692('0x35')]()[_0x7692('0x34')](function(){_0x3e8d73[_0x7692('0x2a')](0xcc)[_0x7692('0x36')]();});}};}function handleEntityNotFound(_0xdfbb4f,_0x379d21){return function(_0xf13d9e){if(!_0xf13d9e){_0xdfbb4f[_0x7692('0x29')](0x194);}return _0xf13d9e;};}function handleError(_0x3bc601,_0x1cb705){_0x1cb705=_0x1cb705||0x1f4;return function(_0x422379){logger[_0x7692('0x23')](_0x422379['stack']);if(_0x422379[_0x7692('0x37')]){delete _0x422379['name'];}_0x3bc601[_0x7692('0x2a')](_0x1cb705)[_0x7692('0x38')](_0x422379);};}exports[_0x7692('0x39')]=function(_0x81c053,_0x55ce7a){var _0x3531c7={},_0x12dbd9={},_0x996cf3={'count':0x0,'rows':[]};var _0x2dad9a=_[_0x7692('0x3a')](db[_0x7692('0x3b')][_0x7692('0x3c')],function(_0x3b98f4){return{'name':_0x3b98f4['fieldName'],'type':_0x3b98f4['type'][_0x7692('0x3d')]};});_0x12dbd9['model']=_[_0x7692('0x3a')](_0x2dad9a,_0x7692('0x37'));_0x12dbd9[_0x7692('0x3e')]=_['keys'](_0x81c053[_0x7692('0x3e')]);_0x12dbd9[_0x7692('0x3f')]=_[_0x7692('0x40')](_0x12dbd9[_0x7692('0x41')],_0x12dbd9[_0x7692('0x3e')]);_0x3531c7[_0x7692('0x42')]=_['intersection'](_0x12dbd9[_0x7692('0x41')],qs['fields'](_0x81c053['query']['fields']));_0x3531c7[_0x7692('0x42')]=_0x3531c7[_0x7692('0x42')][_0x7692('0x43')]?_0x3531c7[_0x7692('0x42')]:_0x12dbd9['model'];if(!_0x81c053[_0x7692('0x3e')][_0x7692('0x44')]('nolimit')){_0x3531c7[_0x7692('0x2d')]=qs['limit'](_0x81c053[_0x7692('0x3e')][_0x7692('0x2d')]);_0x3531c7['offset']=qs[_0x7692('0x2c')](_0x81c053[_0x7692('0x3e')]['offset']);}_0x3531c7[_0x7692('0x45')]=qs['sort'](_0x81c053[_0x7692('0x3e')][_0x7692('0x46')]);_0x3531c7[_0x7692('0x47')]=qs[_0x7692('0x3f')](_[_0x7692('0x48')](_0x81c053[_0x7692('0x3e')],_0x12dbd9[_0x7692('0x3f')]),_0x2dad9a);if(_0x81c053[_0x7692('0x3e')][_0x7692('0x49')]){_0x3531c7[_0x7692('0x47')]=_['merge'](_0x3531c7['where'],{'$or':_[_0x7692('0x3a')](_0x2dad9a,function(_0x586722){if(_0x586722['type']!==_0x7692('0x4a')){var _0x3baeda={};_0x3baeda[_0x586722[_0x7692('0x37')]]={'$like':'%'+_0x81c053[_0x7692('0x3e')]['filter']+'%'};return _0x3baeda;}})});}_0x3531c7=_['merge']({},_0x3531c7,_0x81c053[_0x7692('0x4b')]);var _0x4c1654={'where':_0x3531c7[_0x7692('0x47')]};return db[_0x7692('0x3b')][_0x7692('0x2b')](_0x4c1654)[_0x7692('0x34')](function(_0x343b23){_0x996cf3['count']=_0x343b23;if(_0x81c053[_0x7692('0x3e')]['includeAll']){_0x3531c7[_0x7692('0x4c')]=[{'all':!![]}];}return db[_0x7692('0x3b')][_0x7692('0x4d')](_0x3531c7);})[_0x7692('0x34')](function(_0x56f6b3){_0x996cf3[_0x7692('0x4e')]=_0x56f6b3;return _0x996cf3;})['then'](respondWithFilteredResult(_0x55ce7a,_0x3531c7))[_0x7692('0x28')](handleError(_0x55ce7a,null));};exports['show']=function(_0x489cf8,_0x43e358){var _0x1d275d={'raw':!![],'where':{'id':_0x489cf8[_0x7692('0x4f')]['id']}},_0x2172ea={};_0x2172ea[_0x7692('0x41')]=_[_0x7692('0x50')](db['WhatsappMessage'][_0x7692('0x3c')]);_0x2172ea[_0x7692('0x3e')]=_[_0x7692('0x50')](_0x489cf8['query']);_0x2172ea[_0x7692('0x3f')]=_[_0x7692('0x40')](_0x2172ea['model'],_0x2172ea['query']);_0x1d275d[_0x7692('0x42')]=_['intersection'](_0x2172ea['model'],qs[_0x7692('0x51')](_0x489cf8['query']['fields']));_0x1d275d[_0x7692('0x42')]=_0x1d275d[_0x7692('0x42')][_0x7692('0x43')]?_0x1d275d['attributes']:_0x2172ea[_0x7692('0x41')];if(_0x489cf8[_0x7692('0x3e')][_0x7692('0x52')]){_0x1d275d[_0x7692('0x4c')]=[{'all':!![]}];}_0x1d275d=_[_0x7692('0x53')]({},_0x1d275d,_0x489cf8[_0x7692('0x4b')]);return db[_0x7692('0x3b')]['find'](_0x1d275d)[_0x7692('0x34')](handleEntityNotFound(_0x43e358,null))[_0x7692('0x34')](respondWithResult(_0x43e358,null))[_0x7692('0x28')](handleError(_0x43e358,null));};exports[_0x7692('0x54')]=function(_0x32da68,_0x46d616){return db[_0x7692('0x3b')][_0x7692('0x54')](_0x32da68[_0x7692('0x55')],{})[_0x7692('0x34')](respondWithResult(_0x46d616,0xc9))['catch'](handleError(_0x46d616,null));};exports[_0x7692('0x33')]=function(_0x876dd8,_0xe9c7a9){if(_0x876dd8[_0x7692('0x55')]['id']){delete _0x876dd8[_0x7692('0x55')]['id'];}return db[_0x7692('0x3b')]['find']({'where':{'id':_0x876dd8['params']['id']}})['then'](handleEntityNotFound(_0xe9c7a9,null))[_0x7692('0x34')](saveUpdates(_0x876dd8[_0x7692('0x55')],null))[_0x7692('0x34')](respondWithResult(_0xe9c7a9,null))[_0x7692('0x28')](handleError(_0xe9c7a9,null));};exports['destroy']=function(_0x34096f,_0xd87764){return db['WhatsappMessage'][_0x7692('0x56')]({'where':{'id':_0x34096f[_0x7692('0x4f')]['id']}})[_0x7692('0x34')](handleEntityNotFound(_0xd87764,null))[_0x7692('0x34')](removeEntity(_0xd87764,null))[_0x7692('0x28')](handleError(_0xd87764,null));};exports[_0x7692('0x57')]=function(_0x34e8f2,_0x26bc25){return db[_0x7692('0x3b')]['describe']()[_0x7692('0x34')](respondWithResult(_0x26bc25,null))[_0x7692('0x28')](handleError(_0x26bc25,null));};var interaction_log=require(_0x7692('0x58'))(_0x7692('0x59'));exports[_0x7692('0x5a')]=function(_0x260df0,_0xa7745,_0xd0ee8b){var _0x7c8370={'channel':'whatsapp'};if(_0x260df0[_0x7692('0x55')]['id']){delete _0x260df0[_0x7692('0x55')]['id'];}_0x260df0[_0x7692('0x55')][_0x7692('0x5b')]=!![];_0x260df0[_0x7692('0x55')][_0x7692('0x5c')]=moment()[_0x7692('0x5d')](_0x7692('0x5e'));_0x260df0[_0x7692('0x55')][_0x7692('0x5f')]=_0x260df0['body']['UserId']||_0x260df0['user']['id'];return db[_0x7692('0x3b')][_0x7692('0x56')]({'where':{'id':_0x260df0[_0x7692('0x4f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x7692('0x34')](handleEntityNotFound(_0xa7745,null))[_0x7692('0x34')](saveUpdates(_0x260df0[_0x7692('0x55')],null))[_0x7692('0x34')](function(_0x59d028){if(_0x59d028){_0x7c8370[_0x7692('0x26')]=_0x59d028[_0x7692('0x60')]({'plain':!![]});return db[_0x7692('0x61')][_0x7692('0x56')]({'where':{'id':_0x59d028[_0x7692('0x62')]}});}return null;})[_0x7692('0x34')](handleEntityNotFound(_0xa7745,null))[_0x7692('0x34')](function(_0x18d8ca){if(_0x18d8ca){return _0x18d8ca[_0x7692('0x33')]({'UserId':_0x260df0['body'][_0x7692('0x5f')],'read1stAt':_['isNil'](_0x18d8ca[_0x7692('0x63')])?moment()[_0x7692('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7692('0x34')](function(_0x5f5059){if(_0x5f5059){_0x7c8370[_0x7692('0x64')]=_0x5f5059[_0x7692('0x60')]({'plain':!![]});interaction_log[_0x7692('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x260df0['user']['id'],_0x260df0[_0x7692('0x65')][_0x7692('0x37')],_0x260df0['user']['role'],_0x7c8370[_0x7692('0x64')]['id'],_0x260df0['body']?JSON[_0x7692('0x22')](_0x260df0[_0x7692('0x55')]):_0x7692('0x66'));return respondWithRpcPromise(_0x7692('0x67'),_0x7692('0x68'),_0x7c8370);}return null;})['then'](function(_0x4b5402){if(_0x4b5402){if(_0x260df0[_0x7692('0x55')][_0x7692('0x69')]){_0x7c8370[_0x7692('0x26')][_0x7692('0x6a')]=util[_0x7692('0x5d')](_0x7692('0x6b'),_0x260df0[_0x7692('0x65')][_0x7692('0x37')]);_0x7c8370['message'][_0x7692('0x6c')]=_0x7c8370[_0x7692('0x6c')];_0x7c8370[_0x7692('0x26')]['event']=_0x7692('0x5a');return respondWithRpcPromise(_0x7692('0x6d'),_0x7692('0x6d'),{'event':_0x7692('0x6e'),'message':_0x7c8370[_0x7692('0x26')]},client9002)[_0x7692('0x34')](function(){return _0x7c8370;});}return _0x7c8370;}return null;})[_0x7692('0x34')](respondWithResult(_0xa7745,null))[_0x7692('0x28')](handleError(_0xa7745,null));};var interaction_log=require(_0x7692('0x58'))('whatsapp-interactions');exports[_0x7692('0x32')]=function(_0xce79ba,_0x184d83,_0x2de952){var _0x490937={'agent':{},'channel':'whatsapp'};if(_0xce79ba[_0x7692('0x55')]['id']){delete _0xce79ba['body']['id'];}_0xce79ba[_0x7692('0x55')]['UserId']=_0xce79ba['body']['UserId']||_0xce79ba['user']['id'];_0x490937['agent']['id']=_0xce79ba[_0x7692('0x55')][_0x7692('0x5f')];return db[_0x7692('0x3b')][_0x7692('0x56')]({'where':{'id':_0xce79ba[_0x7692('0x4f')]['id'],'UserId':null}})[_0x7692('0x34')](handleEntityNotFound(_0x184d83,null))['then'](function(_0x1680d2){if(_0x1680d2){_0x490937[_0x7692('0x26')]=_0x1680d2['get']({'plain':!![]});return db[_0x7692('0x61')]['find']({'where':{'id':_0x1680d2['WhatsappInteractionId']}});}return null;})[_0x7692('0x34')](handleEntityNotFound(_0x184d83,null))[_0x7692('0x34')](function(_0x5372ff){if(_0x5372ff){_0x490937[_0x7692('0x64')]=_0x5372ff[_0x7692('0x60')]({'plain':!![]});interaction_log['info'](_0x7692('0x6f'),_0xce79ba[_0x7692('0x65')]['id'],_0xce79ba[_0x7692('0x65')][_0x7692('0x37')],_0xce79ba[_0x7692('0x65')][_0x7692('0x70')],_0x490937[_0x7692('0x64')]['id'],_0xce79ba[_0x7692('0x55')]?JSON[_0x7692('0x22')](_0xce79ba[_0x7692('0x55')]):_0x7692('0x66'));return respondWithRpcPromise(_0x7692('0x71'),_0x7692('0x72'),_0x490937);}return null;})[_0x7692('0x34')](function(_0x829978){if(_0x829978){_0x829978['message']['interface']=util[_0x7692('0x5d')](_0x7692('0x6b'),_0xce79ba[_0x7692('0x65')]['name']);_0x829978['message'][_0x7692('0x6c')]=_0x490937[_0x7692('0x6c')];_0x829978[_0x7692('0x26')][_0x7692('0x73')]='reject';respondWithRpcPromise(_0x7692('0x6d'),_0x7692('0x6d'),{'event':'rejectmessage','message':_0x829978['message']},client9002);return _0x490937;}return null;})[_0x7692('0x34')](respondWithResult(_0x184d83,null))[_0x7692('0x28')](handleError(_0x184d83,null));};exports['status']=function(_0x4577a8,_0x41e1be,_0x670f53){if(_0x4577a8[_0x7692('0x55')]['id']){delete _0x4577a8[_0x7692('0x55')]['id'];}var _0x4af544;return db[_0x7692('0x3b')]['find']({'where':{'id':_0x4577a8[_0x7692('0x4f')]['id']}})[_0x7692('0x34')](handleEntityNotFound(_0x41e1be,null))[_0x7692('0x34')](function(_0x43a9ac){if(_0x43a9ac){_0x4af544=_0x43a9ac;return db[_0x7692('0x74')][_0x7692('0x56')]({'where':{'id':_0x43a9ac[_0x7692('0x75')]}});}})[_0x7692('0x34')](handleEntityNotFound(_0x41e1be,null))['then'](function(_0x5c2572){if(_0x5c2572){logger['debug'](_0x7692('0x76'),'status','received\x20delivery\x20report\x20from',_0x5c2572['type'],util[_0x7692('0x77')](_0x4577a8['body'],{'showHidden':![],'depth':null}));switch(_0x5c2572[_0x7692('0x78')]){case _0x7692('0x79'):if(_0x4577a8[_0x7692('0x55')]['MessageSid']&&_0x4577a8['body']['MessageSid']===_0x4af544[_0x7692('0x7a')]&&_0x4577a8[_0x7692('0x55')]['MessageStatus']&&_0x4577a8[_0x7692('0x55')][_0x7692('0x7b')]===_0x7692('0x5b')){return _0x4af544['update']({'read':!![]});}else{logger[_0x7692('0x23')](_0x7692('0x7c'),_0x7692('0x2a'),_0x7692('0x79'),util[_0x7692('0x77')](_0x4577a8[_0x7692('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x4af544;}})[_0x7692('0x34')](respondWithResult(_0x41e1be,null))['catch'](handleError(_0x41e1be,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 855a2fc..27becd6 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x38228d,_0x195238){var _0x3c8e4a=function(_0x50a94d){while(--_0x50a94d){_0x38228d['push'](_0x38228d['shift']());}};_0x3c8e4a(++_0x195238);}(_0xb10b,0x12a));var _0xbb10=function(_0x263714,_0x399b37){_0x263714=_0x263714-0x0;var _0x1cd43d=_0xb10b[_0x263714];return _0x1cd43d;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x4de90e,_0x3f0432){var _0x4cd9de=function(_0xeb28c9){while(--_0xeb28c9){_0x4de90e['push'](_0x4de90e['shift']());}};_0x4cd9de(++_0x3f0432);}(_0xb10b,0x12a));var _0xbb10=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xb10b[_0x512550];return _0x19f661;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 31c6762..6ba525f 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 _0x1448=['body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','utf8mb4','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x583bf8,_0x1e81fd){var _0x588bb6=function(_0x3a4144){while(--_0x3a4144){_0x583bf8['push'](_0x583bf8['shift']());}};_0x588bb6(++_0x1e81fd);}(_0x1448,0x1ad));var _0x8144=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1448[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8144('0x0'))('api');var moment=require(_0x8144('0x1'));var BPromise=require('bluebird');var rp=require(_0x8144('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8144('0x3'));var config=require(_0x8144('0x4'));var attributes=require('./whatsappMessage.attributes');module[_0x8144('0x5')]=function(_0x369d16,_0x41db58){return _0x369d16[_0x8144('0x6')](_0x8144('0x7'),attributes,{'tableName':_0x8144('0x8'),'paranoid':![],'indexes':[{'name':_0x8144('0x9'),'fields':[_0x8144('0x9')]},{'name':_0x8144('0xa'),'fields':[_0x8144('0xb')],'type':_0x8144('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5270d1,_0x2fe87c,_0x123dcc){var _0x59eb60=_0x369d16[_0x8144('0xd')];var _0x49df46=_0x5270d1[_0x8144('0xe')]({'plain':!![]});if(_0x49df46[_0x8144('0xf')][_0x8144('0x10')]()==='in'||_0x49df46[_0x8144('0xf')]['toLowerCase']()===_0x8144('0x11')&&!_0x49df46['secret']&&!_[_0x8144('0x12')](_0x49df46[_0x8144('0x13')])){_0x59eb60[_0x8144('0x14')][_0x8144('0x15')]({'where':{'id':_0x49df46[_0x8144('0x16')]}})[_0x8144('0x17')](function(_0x1c3637){if(_0x1c3637){_0x1c3637[_0x8144('0x18')]({'lastMsgAt':_0x49df46[_0x8144('0x19')],'lastMsgDirection':_0x49df46['direction'][_0x8144('0x10')]()});}})[_0x8144('0x1a')](function(_0x1586f8){console['error'](_0x1586f8);});}if(_0x49df46[_0x8144('0xf')]===_0x8144('0x11')&&!_0x49df46['secret']){var _0x426a03;_0x59eb60[_0x8144('0x1b')][_0x8144('0x1c')]({'where':{'id':_0x49df46[_0x8144('0x1d')]},'raw':!![]})[_0x8144('0x17')](function(_0x3fa055){_0x426a03=_0x3fa055;if(_0x426a03&&_0x426a03[_0x8144('0x1e')]){switch(_0x426a03['type']){case'twilio':var _0x3c5c13=require(_0x8144('0x1f'));if(_0x426a03['accountSid']&&_0x426a03[_0x8144('0x20')]&&_0x426a03[_0x8144('0x21')]){var _0x15dddf=new _0x3c5c13(_0x426a03['accountSid'],_0x426a03[_0x8144('0x20')]);_0x15dddf[_0x8144('0x22')][_0x8144('0x23')]({'body':_0x49df46[_0x8144('0xb')],'to':_0x8144('0x24')+_0x49df46[_0x8144('0x21')],'from':_0x8144('0x24')+_0x426a03['phone'],'statusCallback':_0x426a03['remote']+_0x8144('0x25')+_0x49df46['id']+_0x8144('0x26')+_0x426a03[_0x8144('0x27')]})[_0x8144('0x17')](function(_0x1a70e3){if(_0x1a70e3[_0x8144('0x28')]){return _0x5270d1[_0x8144('0x18')]({'messageId':_0x1a70e3[_0x8144('0x28')]});}})[_0x8144('0x1a')](function(_0x1feefc){logger['error'](_0x8144('0x29'),_0x8144('0x2a'),_0x8144('0x1f'),util['inspect'](_0x1feefc,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8144('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x123dcc();});}else{_0x123dcc();}}},'charset':_0x8144('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe3ee=['whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId','then','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create'];(function(_0x46eb55,_0x3cbe36){var _0x2a98af=function(_0x52c26f){while(--_0x52c26f){_0x46eb55['push'](_0x46eb55['shift']());}};_0x2a98af(++_0x3cbe36);}(_0xe3ee,0xe0));var _0xee3e=function(_0x4c8387,_0xdc888f){_0x4c8387=_0x4c8387-0x0;var _0x510e8e=_0xe3ee[_0x4c8387];return _0x510e8e;};'use strict';var _=require('lodash');var util=require(_0xee3e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xee3e('0x1'));var BPromise=require(_0xee3e('0x2'));var rp=require(_0xee3e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee3e('0x4'));var config=require(_0xee3e('0x5'));var attributes=require(_0xee3e('0x6'));module[_0xee3e('0x7')]=function(_0x2b5577,_0x15063d){return _0x2b5577[_0xee3e('0x8')](_0xee3e('0x9'),attributes,{'tableName':_0xee3e('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xee3e('0xb'),'fields':[_0xee3e('0xc')],'type':_0xee3e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1eadcd,_0x4b6e58,_0x31ad1f){var _0x38a16d=_0x2b5577[_0xee3e('0xe')];var _0xc62088=_0x1eadcd['get']({'plain':!![]});if(_0xc62088[_0xee3e('0xf')][_0xee3e('0x10')]()==='in'||_0xc62088[_0xee3e('0xf')][_0xee3e('0x10')]()===_0xee3e('0x11')&&!_0xc62088[_0xee3e('0x12')]&&!_['isNil'](_0xc62088[_0xee3e('0x13')])){_0x38a16d['WhatsappInteraction'][_0xee3e('0x14')]({'where':{'id':_0xc62088[_0xee3e('0x15')]}})[_0xee3e('0x16')](function(_0x2b2f62){if(_0x2b2f62){_0x2b2f62['update']({'lastMsgAt':_0xc62088['createdAt'],'lastMsgDirection':_0xc62088[_0xee3e('0xf')][_0xee3e('0x10')]()});}})[_0xee3e('0x17')](function(_0x177065){console[_0xee3e('0x18')](_0x177065);});}if(_0xc62088[_0xee3e('0xf')]===_0xee3e('0x11')&&!_0xc62088[_0xee3e('0x12')]){var _0x36e70b;_0x38a16d['WhatsappAccount'][_0xee3e('0x19')]({'where':{'id':_0xc62088[_0xee3e('0x1a')]},'raw':!![]})[_0xee3e('0x16')](function(_0x54e2bb){_0x36e70b=_0x54e2bb;if(_0x36e70b&&_0x36e70b['type']){switch(_0x36e70b[_0xee3e('0x1b')]){case'twilio':var _0x1d911e=require(_0xee3e('0x1c'));if(_0x36e70b[_0xee3e('0x1d')]&&_0x36e70b[_0xee3e('0x1e')]&&_0x36e70b[_0xee3e('0x1f')]){var _0x2a5f4b=new _0x1d911e(_0x36e70b[_0xee3e('0x1d')],_0x36e70b['authToken']);_0x2a5f4b[_0xee3e('0x20')][_0xee3e('0x21')]({'body':_0xc62088['body'],'to':_0xee3e('0x22')+_0xc62088[_0xee3e('0x1f')],'from':_0xee3e('0x22')+_0x36e70b['phone'],'statusCallback':_0x36e70b[_0xee3e('0x23')]+_0xee3e('0x24')+_0xc62088['id']+_0xee3e('0x25')+_0x36e70b[_0xee3e('0x26')]})[_0xee3e('0x16')](function(_0x305baa){if(_0x305baa[_0xee3e('0x27')]){return _0x1eadcd['update']({'messageId':_0x305baa[_0xee3e('0x27')]});}})['catch'](function(_0x697067){logger['error'](_0xee3e('0x28'),'afterCreate',_0xee3e('0x1c'),util[_0xee3e('0x29')](_0x697067,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xee3e('0x28'),'afterCreate',_0xee3e('0x1c'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x31ad1f();});}else{_0x31ad1f();}}},'charset':'utf8mb4','collate':_0xee3e('0x2a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f82a3bc..14a52a4 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 _0x4be5=['code','message','info','result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x4be5,0x74));var _0x54be=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x4be5[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0x54be('0x0'));var util=require(_0x54be('0x1'));var moment=require(_0x54be('0x2'));var BPromise=require(_0x54be('0x3'));var rs=require(_0x54be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54be('0x5'))['db'];var utils=require(_0x54be('0x6'));var logger=require(_0x54be('0x7'))(_0x54be('0x8'));var config=require(_0x54be('0x9'));var jayson=require(_0x54be('0xa'));var client=jayson['client'][_0x54be('0xb')]({'port':0x232a});config[_0x54be('0xc')]=_[_0x54be('0xd')](config['redis'],{'host':_0x54be('0xe'),'port':0x18eb});var socket=require(_0x54be('0xf'))(new Redis(config[_0x54be('0xc')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x22fb17,_0xb48ab3,_0x44a515){return new BPromise(function(_0x53140d,_0x3d72e8){return client[_0x54be('0x10')](_0x22fb17,_0x44a515)[_0x54be('0x11')](function(_0x3a2cb3){logger['info'](_0x54be('0x12'),_0xb48ab3,_0x54be('0x13'));logger[_0x54be('0x14')](_0x54be('0x15'),_0xb48ab3,_0x54be('0x13'),JSON[_0x54be('0x16')](_0x3a2cb3));if(_0x3a2cb3[_0x54be('0x17')]){if(_0x3a2cb3['error'][_0x54be('0x18')]===0x1f4){logger[_0x54be('0x17')](_0x54be('0x12'),_0xb48ab3,_0x3a2cb3[_0x54be('0x17')][_0x54be('0x19')]);return _0x3d72e8(_0x3a2cb3[_0x54be('0x17')][_0x54be('0x19')]);}logger[_0x54be('0x17')](_0x54be('0x12'),_0xb48ab3,_0x3a2cb3[_0x54be('0x17')]['message']);return _0x53140d(_0x3a2cb3['error'][_0x54be('0x19')]);}else{logger[_0x54be('0x1a')](_0x54be('0x12'),_0xb48ab3,'request\x20sent');_0x53140d(_0x3a2cb3[_0x54be('0x1b')][_0x54be('0x19')]);}})['catch'](function(_0x23dffe){logger['error'](_0x54be('0x12'),_0xb48ab3,_0x23dffe);_0x3d72e8(_0x23dffe);});});}exports[_0x54be('0x1c')]=function(_0x136e3e){var _0x219e58=this;return new Promise(function(_0x4c2fa1,_0xf8df5d){return db[_0x54be('0x1d')][_0x54be('0x1e')](_0x136e3e[_0x54be('0x1f')],{'raw':_0x136e3e['options']?_0x136e3e[_0x54be('0x20')][_0x54be('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x398771){logger[_0x54be('0x1a')]('CreateWhatsappMessage',_0x136e3e);logger[_0x54be('0x14')](_0x54be('0x1c'),_0x136e3e,JSON[_0x54be('0x16')](_0x398771));_0x4c2fa1(_0x398771);})[_0x54be('0x22')](function(_0x53d4db){logger[_0x54be('0x17')](_0x54be('0x1c'),_0x53d4db[_0x54be('0x19')],_0x136e3e);_0xf8df5d(_0x219e58[_0x54be('0x17')](0x1f4,_0x53d4db['message']));});});}; \ No newline at end of file +var _0xe05e=['CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xe05e,0x1cf));var _0xee05=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0xe05e[_0x5de214];return _0x4df627;};'use strict';var _=require(_0xee05('0x0'));var util=require(_0xee05('0x1'));var moment=require('moment');var BPromise=require(_0xee05('0x2'));var rs=require(_0xee05('0x3'));var fs=require('fs');var Redis=require(_0xee05('0x4'));var db=require(_0xee05('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee05('0x6'))(_0xee05('0x7'));var config=require(_0xee05('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee05('0x9')]({'port':0x232a});config[_0xee05('0xa')]=_[_0xee05('0xb')](config['redis'],{'host':_0xee05('0xc'),'port':0x18eb});var socket=require(_0xee05('0xd'))(new Redis(config[_0xee05('0xa')]));require(_0xee05('0xe'))[_0xee05('0xf')](socket);function respondWithRpcPromise(_0x3054d3,_0x2abb3c,_0x414f5f){return new BPromise(function(_0x1543fe,_0x5086cd){return client[_0xee05('0x10')](_0x3054d3,_0x414f5f)['then'](function(_0x3c0262){logger[_0xee05('0x11')](_0xee05('0x12'),_0x2abb3c,'request\x20sent');logger['debug'](_0xee05('0x13'),_0x2abb3c,_0xee05('0x14'),JSON[_0xee05('0x15')](_0x3c0262));if(_0x3c0262[_0xee05('0x16')]){if(_0x3c0262['error'][_0xee05('0x17')]===0x1f4){logger[_0xee05('0x16')](_0xee05('0x12'),_0x2abb3c,_0x3c0262[_0xee05('0x16')][_0xee05('0x18')]);return _0x5086cd(_0x3c0262['error'][_0xee05('0x18')]);}logger[_0xee05('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2abb3c,_0x3c0262['error'][_0xee05('0x18')]);return _0x1543fe(_0x3c0262['error'][_0xee05('0x18')]);}else{logger['info'](_0xee05('0x12'),_0x2abb3c,_0xee05('0x14'));_0x1543fe(_0x3c0262[_0xee05('0x19')][_0xee05('0x18')]);}})[_0xee05('0x1a')](function(_0x425edf){logger[_0xee05('0x16')](_0xee05('0x12'),_0x2abb3c,_0x425edf);_0x5086cd(_0x425edf);});});}exports[_0xee05('0x1b')]=function(_0x262594){var _0x260b66=this;return new Promise(function(_0x51162d,_0xdfb26d){return db[_0xee05('0x1c')][_0xee05('0x1d')](_0x262594[_0xee05('0x1e')],{'raw':_0x262594[_0xee05('0x1f')]?_0x262594[_0xee05('0x1f')][_0xee05('0x20')]===undefined?!![]:![]:!![]})[_0xee05('0x21')](function(_0x13bae3){logger[_0xee05('0x11')](_0xee05('0x1b'),_0x262594);logger[_0xee05('0x22')]('CreateWhatsappMessage',_0x262594,JSON[_0xee05('0x15')](_0x13bae3));_0x51162d(_0x13bae3);})[_0xee05('0x1a')](function(_0x2ffc96){logger[_0xee05('0x16')]('CreateWhatsappMessage',_0x2ffc96['message'],_0x262594);_0xdfb26d(_0x260b66[_0xee05('0x16')](0x1f4,_0x2ffc96['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 07d558b..093b1b2 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 _0x5e52=['removeListener','register','length','remove','update','emit'];(function(_0x3a10c3,_0x39e380){var _0x524306=function(_0x5f4996){while(--_0x5f4996){_0x3a10c3['push'](_0x3a10c3['shift']());}};_0x524306(++_0x39e380);}(_0x5e52,0x105));var _0x25e5=function(_0x527d25,_0x562df2){_0x527d25=_0x527d25-0x0;var _0x4d06b4=_0x5e52[_0x527d25];return _0x4d06b4;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x25e5('0x0'),_0x25e5('0x1')];function createListener(_0x44239b,_0x1c0243){return function(_0x3c3dd8){_0x1c0243[_0x25e5('0x2')](_0x44239b,_0x3c3dd8);};}function removeListener(_0x19ae44,_0x2e4518){return function(){WhatsappMessageEvents[_0x25e5('0x3')](_0x19ae44,_0x2e4518);};}exports[_0x25e5('0x4')]=function(_0x2aa402){for(var _0x1dbf42=0x0,_0x249ad1=events[_0x25e5('0x5')];_0x1dbf42<_0x249ad1;_0x1dbf42++){var _0x1ff859=events[_0x1dbf42];var _0x56d69d=createListener('whatsappMessage:'+_0x1ff859,_0x2aa402);WhatsappMessageEvents['on'](_0x1ff859,_0x56d69d);}}; \ No newline at end of file +var _0x2f2e=['emit','length','save','remove'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x2f2e,0x146));var _0xe2f2=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0x2f2e[_0x4dcecc];return _0x2aa658;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe2f2('0x0'),_0xe2f2('0x1'),'update'];function createListener(_0xc8150e,_0x5c1823){return function(_0x1d89ba){_0x5c1823[_0xe2f2('0x2')](_0xc8150e,_0x1d89ba);};}function removeListener(_0x2da048,_0x14543c){return function(){WhatsappMessageEvents['removeListener'](_0x2da048,_0x14543c);};}exports['register']=function(_0x5b202f){for(var _0x3dca30=0x0,_0x23f7a8=events[_0xe2f2('0x3')];_0x3dca30<_0x23f7a8;_0x3dca30++){var _0xc44c89=events[_0x3dca30];var _0x48111c=createListener('whatsappMessage:'+_0xc44c89,_0x5b202f);WhatsappMessageEvents['on'](_0xc44c89,_0x48111c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 130fd00..456fe3d 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 _0xa6ec=['getAgents','post','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','removeTeams','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','/:id/teams','getTeams'];(function(_0x45262e,_0x1d9c0b){var _0x3b7f60=function(_0x1d7a53){while(--_0x1d7a53){_0x45262e['push'](_0x45262e['shift']());}};_0x3b7f60(++_0x1d9c0b);}(_0xa6ec,0x1f3));var _0xca6e=function(_0x19b166,_0x59a1e3){_0x19b166=_0x19b166-0x0;var _0x427645=_0xa6ec[_0x19b166];return _0x427645;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xca6e('0x0'));var express=require(_0xca6e('0x1'));var router=express[_0xca6e('0x2')]();var auth=require(_0xca6e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xca6e('0x4'));var controller=require(_0xca6e('0x5'));router[_0xca6e('0x6')]('/',auth[_0xca6e('0x7')](),controller[_0xca6e('0x8')]);router[_0xca6e('0x6')](_0xca6e('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xca6e('0x7')](),controller[_0xca6e('0xa')]);router[_0xca6e('0x6')](_0xca6e('0xb'),auth[_0xca6e('0x7')](),controller['getMembers']);router['get'](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0xd')]);router[_0xca6e('0x6')]('/:id/users',auth[_0xca6e('0x7')](),controller[_0xca6e('0xe')]);router[_0xca6e('0xf')]('/',auth[_0xca6e('0x7')](),controller['create']);router['post'](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x10')]);router[_0xca6e('0xf')](_0xca6e('0x11'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x12')]);router[_0xca6e('0x13')]('/:id',auth[_0xca6e('0x7')](),controller[_0xca6e('0x14')]);router[_0xca6e('0x15')](_0xca6e('0x16'),auth['isAuthenticated'](),controller[_0xca6e('0x17')]);router[_0xca6e('0x15')](_0xca6e('0xc'),auth[_0xca6e('0x7')](),controller[_0xca6e('0x18')]);router['delete'](_0xca6e('0x11'),auth['isAuthenticated'](),controller[_0xca6e('0x19')]);module[_0xca6e('0x1a')]=router; \ No newline at end of file +var _0x425d=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','update','destroy','delete','exports'];(function(_0x5a5d46,_0x5f00e7){var _0x45f1ea=function(_0x36d4a3){while(--_0x36d4a3){_0x5a5d46['push'](_0x5a5d46['shift']());}};_0x45f1ea(++_0x5f00e7);}(_0x425d,0xc8));var _0xd425=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x425d[_0x25df80];return _0x17b6d0;};'use strict';var multer=require(_0xd425('0x0'));var util=require(_0xd425('0x1'));var path=require(_0xd425('0x2'));var timeout=require(_0xd425('0x3'));var express=require('express');var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require(_0xd425('0x8'));router[_0xd425('0x9')]('/',auth[_0xd425('0xa')](),controller['index']);router[_0xd425('0x9')](_0xd425('0xb'),auth[_0xd425('0xa')](),controller['describe']);router['get'](_0xd425('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd425('0x9')](_0xd425('0xd'),auth[_0xd425('0xa')](),controller[_0xd425('0xe')]);router['get'](_0xd425('0xf'),auth[_0xd425('0xa')](),controller['getTeams']);router[_0xd425('0x9')](_0xd425('0x10'),auth[_0xd425('0xa')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')]('/',auth['isAuthenticated'](),controller[_0xd425('0x13')]);router['post'](_0xd425('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd425('0x12')](_0xd425('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xd425('0x14')](_0xd425('0xc'),auth[_0xd425('0xa')](),controller[_0xd425('0x15')]);router['delete'](_0xd425('0xc'),auth['isAuthenticated'](),controller[_0xd425('0x16')]);router[_0xd425('0x17')](_0xd425('0xf'),auth[_0xd425('0xa')](),controller['removeTeams']);router[_0xd425('0x17')]('/:id/users',auth[_0xd425('0xa')](),controller['removeAgents']);module[_0xd425('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6f94bf7..f78e988 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 _0xd98c=['ENUM','roundrobin','sequelize','STRING','name'];(function(_0x25c988,_0xce8221){var _0x45fcc2=function(_0x47fba5){while(--_0x47fba5){_0x25c988['push'](_0x25c988['shift']());}};_0x45fcc2(++_0xce8221);}(_0xd98c,0x9d));var _0xcd98=function(_0x1feea7,_0x2f990d){_0x1feea7=_0x1feea7-0x0;var _0x5756ef=_0xd98c[_0x1feea7];return _0x5756ef;};'use strict';var Sequelize=require(_0xcd98('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd98('0x1')],'unique':_0xcd98('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd98('0x3')]('rrmemory','beepall',_0xcd98('0x4'))},'description':{'type':Sequelize[_0xcd98('0x1')]}}; \ No newline at end of file +var _0xb516=['exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x53823c,_0x1c2189){var _0x25dd05=function(_0x4c1d4f){while(--_0x4c1d4f){_0x53823c['push'](_0x53823c['shift']());}};_0x25dd05(++_0x1c2189);}(_0xb516,0x178));var _0x6b51=function(_0x50fd35,_0x3633cc){_0x50fd35=_0x50fd35-0x0;var _0x4948a1=_0xb516[_0x50fd35];return _0x4948a1;};'use strict';var Sequelize=require('sequelize');module[_0x6b51('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6b51('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6b51('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6b51('0x3')](_0x6b51('0x4'),_0x6b51('0x5'),_0x6b51('0x6'))},'description':{'type':Sequelize[_0x6b51('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 922a412..5add97c 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 _0xbfd3=['UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','transaction','each','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','merge','filter','includeAll','catch','params','fields','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','pick','WhatsappQueueId','options','findAll','User','findAndCountAll'];(function(_0x4c321b,_0x2a2bf0){var _0x1fd775=function(_0x1a826c){while(--_0x1a826c){_0x4c321b['push'](_0x4c321b['shift']());}};_0x1fd775(++_0x2a2bf0);}(_0xbfd3,0x144));var _0x3bfd=function(_0x3857b2,_0x2d209d){_0x3857b2=_0x3857b2-0x0;var _0x49d6df=_0xbfd3[_0x3857b2];return _0x49d6df;};'use strict';var pdf=require(_0x3bfd('0x0'));var emlformat=require(_0x3bfd('0x1'));var rimraf=require(_0x3bfd('0x2'));var zipdir=require(_0x3bfd('0x3'));var jsonpatch=require(_0x3bfd('0x4'));var rp=require('request-promise');var moment=require(_0x3bfd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3bfd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3bfd('0x7'));var ejs=require(_0x3bfd('0x8'));var fs=require('fs');var _=require(_0x3bfd('0x9'));var squel=require(_0x3bfd('0xa'));var crypto=require(_0x3bfd('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3bfd('0x7'));var querystring=require(_0x3bfd('0xc'));var Papa=require(_0x3bfd('0xd'));var Redis=require('ioredis');var authService=require(_0x3bfd('0xe'));var qs=require(_0x3bfd('0xf'));var as=require(_0x3bfd('0x10'));var hardwareService=require(_0x3bfd('0x11'));var logger=require(_0x3bfd('0x12'))(_0x3bfd('0x13'));var utils=require(_0x3bfd('0x14'));var config=require(_0x3bfd('0x15'));var db=require(_0x3bfd('0x16'))['db'];config[_0x3bfd('0x17')]=_[_0x3bfd('0x18')](config[_0x3bfd('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x3bfd('0x19'))(new Redis(config[_0x3bfd('0x17')]));require('./whatsappQueue.socket')[_0x3bfd('0x1a')](socket);function respondWithStatusCode(_0x259f4c,_0x224734){_0x224734=_0x224734||0xcc;return function(_0x3b6bfb){if(_0x3b6bfb){return _0x259f4c[_0x3bfd('0x1b')](_0x224734);}return _0x259f4c['status'](_0x224734)[_0x3bfd('0x1c')]();};}function respondWithResult(_0x1f3ebf,_0x4f25f0){_0x4f25f0=_0x4f25f0||0xc8;return function(_0x18bba0){if(_0x18bba0){return _0x1f3ebf[_0x3bfd('0x1d')](_0x4f25f0)[_0x3bfd('0x1e')](_0x18bba0);}};}function respondWithFilteredResult(_0x70a22d,_0x3e30f9){return function(_0x4ec2b0){if(_0x4ec2b0){var _0xfe31ed=_0x4ec2b0[_0x3bfd('0x1f')],_0x488827=_0x3e30f9[_0x3bfd('0x20')],_0x2e6ace=_0x3e30f9[_0x3bfd('0x20')]+_0x3e30f9[_0x3bfd('0x21')],_0x3f45a8;if(_0x2e6ace>=_0xfe31ed){_0x2e6ace=_0xfe31ed;_0x3f45a8=0xc8;}else{_0x3f45a8=0xce;}_0x70a22d['status'](_0x3f45a8);return _0x70a22d[_0x3bfd('0x22')](_0x3bfd('0x23'),_0x488827+'-'+_0x2e6ace+'/'+_0xfe31ed)[_0x3bfd('0x1e')](_0x4ec2b0);}return null;};}function patchUpdates(_0x4a342e){return function(_0x48455f){try{jsonpatch['apply'](_0x48455f,_0x4a342e,!![]);}catch(_0x121342){return BPromise[_0x3bfd('0x24')](_0x121342);}return _0x48455f[_0x3bfd('0x25')]();};}function saveUpdates(_0x5480ee,_0x376091){return function(_0x248918){if(_0x248918){return _0x248918[_0x3bfd('0x26')](_0x5480ee)['then'](function(_0x3dcb1f){return _0x3dcb1f;});}return null;};}function removeEntity(_0xb8e84f,_0x28c081){return function(_0x4587a3){if(_0x4587a3){return _0x4587a3[_0x3bfd('0x27')]()[_0x3bfd('0x28')](function(){var _0x2752cf=_0x4587a3['get']({'plain':!![]});var _0x1a0875=_0x3bfd('0x29');return db[_0x3bfd('0x2a')]['destroy']({'where':{'type':_0x1a0875,'resourceId':_0x2752cf['id']}})[_0x3bfd('0x28')](function(){return _0x4587a3;});})[_0x3bfd('0x28')](function(){_0xb8e84f[_0x3bfd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15cf39,_0x2f613f){return function(_0x9d3da2){if(!_0x9d3da2){_0x15cf39['sendStatus'](0x194);}return _0x9d3da2;};}function handleError(_0x39b7cf,_0xf509e5){_0xf509e5=_0xf509e5||0x1f4;return function(_0x32e329){logger[_0x3bfd('0x2b')](_0x32e329[_0x3bfd('0x2c')]);if(_0x32e329[_0x3bfd('0x2d')]){delete _0x32e329[_0x3bfd('0x2d')];}_0x39b7cf[_0x3bfd('0x1d')](_0xf509e5)[_0x3bfd('0x2e')](_0x32e329);};}exports[_0x3bfd('0x2f')]=function(_0x67af80,_0x54b82c){var _0x5e55d1={},_0x3a20e5={},_0x879dc2={'count':0x0,'rows':[]};var _0x2bd8cd=_[_0x3bfd('0x30')](db[_0x3bfd('0x31')][_0x3bfd('0x32')],function(_0x36cf1c){return{'name':_0x36cf1c[_0x3bfd('0x33')],'type':_0x36cf1c[_0x3bfd('0x34')][_0x3bfd('0x35')]};});_0x3a20e5['model']=_[_0x3bfd('0x30')](_0x2bd8cd,'name');_0x3a20e5['query']=_[_0x3bfd('0x36')](_0x67af80[_0x3bfd('0x37')]);_0x3a20e5[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x3a20e5[_0x3bfd('0x3a')],_0x3a20e5[_0x3bfd('0x37')]);_0x5e55d1[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x3a20e5[_0x3bfd('0x3a')],qs['fields'](_0x67af80[_0x3bfd('0x37')]['fields']));_0x5e55d1[_0x3bfd('0x3b')]=_0x5e55d1[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5e55d1[_0x3bfd('0x3b')]:_0x3a20e5[_0x3bfd('0x3a')];if(!_0x67af80[_0x3bfd('0x37')]['hasOwnProperty'](_0x3bfd('0x3d'))){_0x5e55d1[_0x3bfd('0x21')]=qs[_0x3bfd('0x21')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x21')]);_0x5e55d1[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x20')]);}_0x5e55d1[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x67af80[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x5e55d1[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_['pick'](_0x67af80[_0x3bfd('0x37')],_0x3a20e5['filters']),_0x2bd8cd);if(_0x67af80[_0x3bfd('0x37')]['filter']){_0x5e55d1['where']=_[_0x3bfd('0x41')](_0x5e55d1['where'],{'$or':_[_0x3bfd('0x30')](_0x2bd8cd,function(_0x136555){if(_0x136555[_0x3bfd('0x34')]!=='VIRTUAL'){var _0x54beab={};_0x54beab[_0x136555[_0x3bfd('0x2d')]]={'$like':'%'+_0x67af80['query'][_0x3bfd('0x42')]+'%'};return _0x54beab;}})});}_0x5e55d1=_[_0x3bfd('0x41')]({},_0x5e55d1,_0x67af80['options']);var _0x8265cd={'where':_0x5e55d1['where']};return db[_0x3bfd('0x31')][_0x3bfd('0x1f')](_0x8265cd)['then'](function(_0x5a9829){_0x879dc2['count']=_0x5a9829;if(_0x67af80['query'][_0x3bfd('0x43')]){_0x5e55d1['include']=[{'all':!![]}];}return db[_0x3bfd('0x31')]['findAll'](_0x5e55d1);})[_0x3bfd('0x28')](function(_0x4a7174){_0x879dc2['rows']=_0x4a7174;return _0x879dc2;})[_0x3bfd('0x28')](respondWithFilteredResult(_0x54b82c,_0x5e55d1))[_0x3bfd('0x44')](handleError(_0x54b82c,null));};exports['show']=function(_0x328ac0,_0x45bdb9){var _0x20c82f={'raw':!![],'where':{'id':_0x328ac0[_0x3bfd('0x45')]['id']}},_0x4f05b3={};_0x4f05b3['model']=_[_0x3bfd('0x36')](db[_0x3bfd('0x31')]['rawAttributes']);_0x4f05b3[_0x3bfd('0x37')]=_[_0x3bfd('0x36')](_0x328ac0[_0x3bfd('0x37')]);_0x4f05b3[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x4f05b3[_0x3bfd('0x3a')],_0x4f05b3[_0x3bfd('0x37')]);_0x20c82f[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x4f05b3[_0x3bfd('0x3a')],qs[_0x3bfd('0x46')](_0x328ac0[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x20c82f[_0x3bfd('0x3b')]=_0x20c82f[_0x3bfd('0x3b')]['length']?_0x20c82f['attributes']:_0x4f05b3['model'];if(_0x328ac0['query'][_0x3bfd('0x43')]){_0x20c82f[_0x3bfd('0x47')]=[{'all':!![]}];}_0x20c82f=_[_0x3bfd('0x41')]({},_0x20c82f,_0x328ac0['options']);return db[_0x3bfd('0x31')][_0x3bfd('0x48')](_0x20c82f)[_0x3bfd('0x28')](handleEntityNotFound(_0x45bdb9,null))[_0x3bfd('0x28')](respondWithResult(_0x45bdb9,null))[_0x3bfd('0x44')](handleError(_0x45bdb9,null));};exports[_0x3bfd('0x49')]=function(_0x192482,_0x3667e9){return db[_0x3bfd('0x31')]['create'](_0x192482[_0x3bfd('0x4a')],{})[_0x3bfd('0x28')](function(_0xa88c53){var _0x340be0=_0x192482[_0x3bfd('0x4b')][_0x3bfd('0x4c')]({'plain':!![]});if(!_0x340be0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340be0[_0x3bfd('0x4d')]==='user'){var _0x5f1930=_0xa88c53['get']({'plain':!![]});var _0x5adb05=_0x3bfd('0x29');return db[_0x3bfd('0x4e')][_0x3bfd('0x48')]({'where':{'name':_0x5adb05,'userProfileId':_0x340be0[_0x3bfd('0x4f')]},'raw':!![]})[_0x3bfd('0x28')](function(_0xbfc350){if(_0xbfc350&&_0xbfc350[_0x3bfd('0x50')]===0x0){return db[_0x3bfd('0x2a')][_0x3bfd('0x49')]({'name':_0x5f1930[_0x3bfd('0x2d')],'resourceId':_0x5f1930['id'],'type':_0xbfc350[_0x3bfd('0x2d')],'sectionId':_0xbfc350['id']},{})['then'](function(){return _0xa88c53;});}else{return _0xa88c53;}})['catch'](function(_0x11be5e){logger[_0x3bfd('0x2b')](_0x3bfd('0x51'),_0x11be5e);throw _0x11be5e;});}return _0xa88c53;})[_0x3bfd('0x28')](respondWithResult(_0x3667e9,0xc9))[_0x3bfd('0x44')](handleError(_0x3667e9,null));};exports['update']=function(_0x2e27cd,_0x18744d){if(_0x2e27cd[_0x3bfd('0x4a')]['id']){delete _0x2e27cd['body']['id'];}return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x2e27cd[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x18744d,null))['then'](saveUpdates(_0x2e27cd['body'],null))[_0x3bfd('0x28')](respondWithResult(_0x18744d,null))['catch'](handleError(_0x18744d,null));};exports[_0x3bfd('0x27')]=function(_0x426edd,_0x2454cb){return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x426edd[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x2454cb,null))[_0x3bfd('0x28')](removeEntity(_0x2454cb,null))[_0x3bfd('0x44')](handleError(_0x2454cb,null));};exports[_0x3bfd('0x52')]=function(_0x122dc0,_0x22e833){return db[_0x3bfd('0x31')][_0x3bfd('0x52')]()[_0x3bfd('0x28')](respondWithResult(_0x22e833,null))[_0x3bfd('0x44')](handleError(_0x22e833,null));};exports[_0x3bfd('0x53')]=function(_0x5021bb,_0x35fa3e,_0x52dbca){var _0x5b7d71={'raw':!![],'where':{}},_0x4ad6f6={},_0x3cb4ea;return db['WhatsappQueue'][_0x3bfd('0x54')]({'where':{'id':_0x5021bb[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x35fa3e,null))['then'](function(_0x3f149f){if(_0x3f149f){_0x3cb4ea=_0x3f149f['get']({'plain':!![]});_0x4ad6f6['model']=_[_0x3bfd('0x36')](db[_0x3bfd('0x55')][_0x3bfd('0x32')]);_0x4ad6f6[_0x3bfd('0x37')]=_['keys'](_0x5021bb[_0x3bfd('0x37')]);_0x4ad6f6[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x4ad6f6[_0x3bfd('0x3a')],_0x4ad6f6[_0x3bfd('0x37')]);_0x5b7d71[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x4ad6f6[_0x3bfd('0x3a')],qs[_0x3bfd('0x46')](_0x5021bb['query']['fields']));_0x5b7d71[_0x3bfd('0x3b')]=_0x5b7d71[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5b7d71[_0x3bfd('0x3b')]:_0x4ad6f6[_0x3bfd('0x3a')];if(!_0x5021bb['query'][_0x3bfd('0x56')](_0x3bfd('0x3d'))){_0x5b7d71['limit']=qs['limit'](_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x21')]);_0x5b7d71[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x5021bb['query'][_0x3bfd('0x20')]);}_0x5b7d71[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x5021bb[_0x3bfd('0x37')]['sort']);_0x5b7d71[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_[_0x3bfd('0x57')](_0x5021bb[_0x3bfd('0x37')],_0x4ad6f6[_0x3bfd('0x38')]));_0x5b7d71[_0x3bfd('0x40')][_0x3bfd('0x58')]=_0x3f149f['id'];if(_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x42')]){_0x5b7d71[_0x3bfd('0x40')]=_['merge'](_0x5b7d71['where'],{'$or':_[_0x3bfd('0x30')](_0x5b7d71['attributes'],function(_0x21952a){var _0xa0520f={};_0xa0520f[_0x21952a]={'$like':'%'+_0x5021bb[_0x3bfd('0x37')][_0x3bfd('0x42')]+'%'};return _0xa0520f;})});}_0x5b7d71=_[_0x3bfd('0x41')]({},_0x5b7d71,_0x5021bb[_0x3bfd('0x59')]);return db[_0x3bfd('0x55')][_0x3bfd('0x5a')](_0x5b7d71);}})[_0x3bfd('0x28')](function(_0x3f71a4){if(_0x3f71a4){return db[_0x3bfd('0x5b')][_0x3bfd('0x5c')]({'where':{'id':_[_0x3bfd('0x30')](_0x3f71a4,_0x3bfd('0x5d')),'role':_0x3bfd('0x5e')},'attributes':['id',_0x3bfd('0x2d'),_0x3bfd('0x5f'),_0x3bfd('0x60'),_0x3bfd('0x61')]});}})[_0x3bfd('0x28')](function(_0x515c55){if(_0x515c55){return{'count':_0x515c55[_0x3bfd('0x1f')],'rows':_[_0x3bfd('0x30')](_0x515c55['rows'],function(_0x4a9327){return{'membername':_0x4a9327['name'],'UserId':_0x4a9327['id'],'queue_name':_0x3cb4ea[_0x3bfd('0x2d')],'WhatsappQueueId':_0x3cb4ea['id'],'interface':util[_0x3bfd('0x62')]('%s/%s',_0x3bfd('0x63'),_0x4a9327[_0x3bfd('0x2d')]),'penalty':0x0,'paused':_0x4a9327['whatsappPause'],'createdAt':_0x4a9327[_0x3bfd('0x61')],'updatedAt':_0x4a9327[_0x3bfd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3bfd('0x28')](respondWithFilteredResult(_0x35fa3e,_0x5b7d71))['catch'](handleError(_0x35fa3e,null));};exports[_0x3bfd('0x64')]=function(_0x3cdd65,_0x4d2b23,_0x1f0375){var _0x5e0251={};var _0x179046={};var _0x5954ad;var _0x14e526;return db['WhatsappQueue'][_0x3bfd('0x54')]({'where':{'id':_0x3cdd65[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x4d2b23,null))[_0x3bfd('0x28')](function(_0x3b17f4){if(_0x3b17f4){_0x5954ad=_0x3b17f4;_0x179046[_0x3bfd('0x3a')]=_['keys'](db[_0x3bfd('0x65')][_0x3bfd('0x32')]);_0x179046[_0x3bfd('0x37')]=_['keys'](_0x3cdd65[_0x3bfd('0x37')]);_0x179046[_0x3bfd('0x38')]=_[_0x3bfd('0x39')](_0x179046[_0x3bfd('0x3a')],_0x179046['query']);_0x5e0251[_0x3bfd('0x3b')]=_[_0x3bfd('0x39')](_0x179046[_0x3bfd('0x3a')],qs['fields'](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x5e0251['attributes']=_0x5e0251[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x5e0251[_0x3bfd('0x3b')]:_0x179046['model'];_0x5e0251[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x5e0251[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_[_0x3bfd('0x57')](_0x3cdd65[_0x3bfd('0x37')],_0x179046[_0x3bfd('0x38')]));if(_0x3cdd65[_0x3bfd('0x37')]['filter']){_0x5e0251['where']=_[_0x3bfd('0x41')](_0x5e0251[_0x3bfd('0x40')],{'$or':_['map'](_0x5e0251['attributes'],function(_0x3e9417){var _0x818e2c={};_0x818e2c[_0x3e9417]={'$like':'%'+_0x3cdd65[_0x3bfd('0x37')]['filter']+'%'};return _0x818e2c;})});}_0x5e0251=_[_0x3bfd('0x41')]({},_0x5e0251,_0x3cdd65[_0x3bfd('0x59')]);return _0x5954ad['getTeams'](_0x5e0251);}})[_0x3bfd('0x28')](function(_0x528d2b){if(_0x528d2b){_0x14e526=_0x528d2b[_0x3bfd('0x3c')];if(!_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x56')]('nolimit')){_0x5e0251['limit']=qs[_0x3bfd('0x21')](_0x3cdd65['query'][_0x3bfd('0x21')]);_0x5e0251[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x3cdd65[_0x3bfd('0x37')][_0x3bfd('0x20')]);}return _0x5954ad[_0x3bfd('0x64')](_0x5e0251);}})[_0x3bfd('0x28')](function(_0x39a6a2){if(_0x39a6a2){return _0x39a6a2?{'count':_0x14e526,'rows':_0x39a6a2}:null;}})[_0x3bfd('0x28')](respondWithResult(_0x4d2b23,null))['catch'](handleError(_0x4d2b23,null));};exports[_0x3bfd('0x66')]=function(_0x299825,_0x1f0c58,_0x48ed52){var _0x253774=_0x299825[_0x3bfd('0x4a')][_0x3bfd('0x67')];return db[_0x3bfd('0x65')]['findAll']({'where':{'id':_0x253774},'attributes':['id'],'include':[{'model':db[_0x3bfd('0x5b')],'as':'Agents','attributes':['id','name','online',_0x3bfd('0x68'),_0x3bfd('0x69')],'raw':!![]}]})[_0x3bfd('0x28')](function(_0x24f42a){if(_0x24f42a){var _0x105740=_[_0x3bfd('0x6a')](_0x24f42a,function(_0x128dcb){var _0x339cee=_0x128dcb[_0x3bfd('0x4c')]({'plain':!![]});return _0x339cee[_0x3bfd('0x6b')];});return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x299825[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](function(_0x29e5e0){return db['sequelize'][_0x3bfd('0x6c')](function(_0x464ba7){return _0x29e5e0[_0x3bfd('0x66')](_0x253774,{'transaction':_0x464ba7})[_0x3bfd('0x28')](function(){return BPromise[_0x3bfd('0x6d')](_0x105740,function(_0x189c37){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x189c37['id'],'WhatsappQueueId':_0x299825[_0x3bfd('0x45')]['id']},'transaction':_0x464ba7});});})[_0x3bfd('0x28')](function(){_0x105740['forEach'](function(_0x4be38e){socket['emit'](_0x3bfd('0x6e'),{'UserId':_0x4be38e['id'],'WhatsappQueueId':_0x29e5e0['id']});});});});});}})[_0x3bfd('0x28')](respondWithStatusCode(_0x1f0c58,null))['catch'](handleError(_0x1f0c58,null));};exports[_0x3bfd('0x6f')]=function(_0xd14f16,_0x4bd29c,_0x413a61){return db['Team'][_0x3bfd('0x5a')]({'where':{'id':_0xd14f16[_0x3bfd('0x37')][_0x3bfd('0x67')]},'attributes':['id'],'include':[{'model':db[_0x3bfd('0x5b')],'as':_0x3bfd('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3bfd('0x28')](handleEntityNotFound(_0x4bd29c,null))['then'](function(_0x42cbcb){var _0x2d9432=_[_0x3bfd('0x30')](_0x42cbcb,'id');var _0x2aec16=[];var _0x43a05a=[];var _0x2870ba=squel[_0x3bfd('0x70')]();_0x2870ba[_0x3bfd('0x71')](_0x3bfd('0x72'))[_0x3bfd('0x73')](_0x3bfd('0x74'),'tq')[_0x3bfd('0x75')](_0x3bfd('0x76'),'ut',_0x3bfd('0x77'))[_0x3bfd('0x40')](_0x3bfd('0x78'),_0xd14f16[_0x3bfd('0x45')]['id']);for(var _0x467be8=0x0;_0x467be8<_0x42cbcb[_0x3bfd('0x3c')];_0x467be8+=0x1){let _0x10bebe=_0x42cbcb[_0x467be8];for(var _0x585296=0x0;_0x585296<_0x10bebe[_0x3bfd('0x6b')][_0x3bfd('0x3c')];_0x585296+=0x1){let _0x165149=_0x10bebe[_0x3bfd('0x6b')][_0x585296];var _0x29d064=_0x2870ba[_0x3bfd('0x79')]();_0x29d064[_0x3bfd('0x40')]('ut.UserId\x20=\x20?',_0x165149['id']);_0x43a05a['push'](db[_0x3bfd('0x7a')][_0x3bfd('0x37')](_0x29d064[_0x3bfd('0x7b')](),{'type':db[_0x3bfd('0x7a')]['QueryTypes'][_0x3bfd('0x7c')]})[_0x3bfd('0x28')](function(_0x289afe){if(_0x289afe[_0x3bfd('0x3c')]===0x1){return _0x165149['id'];}else{var _0x1e3a01=_['every'](_[_0x3bfd('0x30')](_0x289afe,_0x3bfd('0x7d')),function(_0x23dc9a){return _[_0x3bfd('0x7e')](_0x2d9432,_0x23dc9a);});if(_0x1e3a01){return _0x165149['id'];}}}));}}return BPromise[_0x3bfd('0x7f')](_0x43a05a)[_0x3bfd('0x28')](function(_0x2b5a49){_0x2aec16=_(_0x2aec16)[_0x3bfd('0x80')](_0x2b5a49)[_0x3bfd('0x81')]()[_0x3bfd('0x82')]();return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0xd14f16[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](function(_0x44a9a1){return db[_0x3bfd('0x7a')]['transaction'](function(_0x1b77ed){return _0x44a9a1[_0x3bfd('0x6f')](_0xd14f16[_0x3bfd('0x37')][_0x3bfd('0x67')],{'transaction':_0x1b77ed})[_0x3bfd('0x28')](function(){if(!_[_0x3bfd('0x83')](_0x2aec16)){return _0x44a9a1[_0x3bfd('0x84')](_0x2aec16,{'transaction':_0x1b77ed});}})['then'](function(){_0x2aec16['forEach'](function(_0x293627){socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':_0x293627,'WhatsappQueueId':_0x44a9a1['id']});});});});});});})['then'](respondWithStatusCode(_0x4bd29c,null))[_0x3bfd('0x44')](handleError(_0x4bd29c,null));};exports[_0x3bfd('0x87')]=function(_0xedb91d,_0x8dc275,_0x5ccd34){return db['WhatsappQueue'][_0x3bfd('0x48')]({'where':{'id':_0xedb91d['params']['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x8dc275,null))['then'](function(_0x339dfa){if(_0x339dfa){return _0x339dfa[_0x3bfd('0x87')](_0xedb91d[_0x3bfd('0x4a')][_0x3bfd('0x67')],_[_0x3bfd('0x88')](_0xedb91d[_0x3bfd('0x4a')],[_0x3bfd('0x67'),'id'])||{})['spread'](function(_0x1ccbc8){for(var _0xf164f1=0x0;_0xf164f1<_0xedb91d[_0x3bfd('0x4a')]['ids']['length'];_0xf164f1+=0x1){socket[_0x3bfd('0x85')](_0x3bfd('0x6e'),{'UserId':_0xedb91d[_0x3bfd('0x4a')][_0x3bfd('0x67')][_0xf164f1],'WhatsappQueueId':_0xedb91d[_0x3bfd('0x45')]['id']});}return _0x1ccbc8;});}})[_0x3bfd('0x28')](respondWithResult(_0x8dc275,null))[_0x3bfd('0x44')](handleError(_0x8dc275,null));};exports['removeAgents']=function(_0x3c5240,_0x4438a4,_0x484e2f){return db[_0x3bfd('0x31')][_0x3bfd('0x48')]({'where':{'id':_0x3c5240['params']['id']}})['then'](handleEntityNotFound(_0x4438a4,null))['then'](function(_0x166c99){if(_0x166c99){return _0x166c99['removeAgents'](_0x3c5240['query'][_0x3bfd('0x67')])['then'](function(){if(_[_0x3bfd('0x89')](_0x3c5240[_0x3bfd('0x37')][_0x3bfd('0x67')])){for(var _0x43298c=0x0;_0x43298c<_0x3c5240[_0x3bfd('0x37')][_0x3bfd('0x67')][_0x3bfd('0x3c')];_0x43298c+=0x1){socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':Number(_0x3c5240['query'][_0x3bfd('0x67')][_0x43298c]),'WhatsappQueueId':Number(_0x3c5240[_0x3bfd('0x45')]['id'])});}}else{socket[_0x3bfd('0x85')](_0x3bfd('0x86'),{'UserId':Number(_0x3c5240['query']['ids']),'WhatsappQueueId':Number(_0x3c5240[_0x3bfd('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x4438a4,null))[_0x3bfd('0x44')](handleError(_0x4438a4,null));};exports[_0x3bfd('0x8a')]=function(_0x5efc4d,_0x5c0953,_0x391143){var _0x1f3279={};var _0x2a597a={};var _0x410c56;var _0x485136;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5efc4d[_0x3bfd('0x45')]['id']}})[_0x3bfd('0x28')](handleEntityNotFound(_0x5c0953,null))[_0x3bfd('0x28')](function(_0x299ab5){if(_0x299ab5){_0x410c56=_0x299ab5;_0x2a597a[_0x3bfd('0x3a')]=_[_0x3bfd('0x36')](db['User'][_0x3bfd('0x32')]);_0x2a597a[_0x3bfd('0x37')]=_['keys'](_0x5efc4d[_0x3bfd('0x37')]);_0x2a597a['filters']=_[_0x3bfd('0x39')](_0x2a597a['model'],_0x2a597a[_0x3bfd('0x37')]);_0x1f3279['attributes']=_[_0x3bfd('0x39')](_0x2a597a['model'],qs[_0x3bfd('0x46')](_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x46')]));_0x1f3279[_0x3bfd('0x3b')]=_0x1f3279[_0x3bfd('0x3b')][_0x3bfd('0x3c')]?_0x1f3279[_0x3bfd('0x3b')]:_0x2a597a[_0x3bfd('0x3a')];_0x1f3279[_0x3bfd('0x3e')]=qs[_0x3bfd('0x3f')](_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x3f')]);_0x1f3279[_0x3bfd('0x40')]=qs[_0x3bfd('0x38')](_['pick'](_0x5efc4d[_0x3bfd('0x37')],_0x2a597a[_0x3bfd('0x38')]));if(_0x5efc4d['query']['filter']){_0x1f3279[_0x3bfd('0x40')]=_['merge'](_0x1f3279[_0x3bfd('0x40')],{'$or':_[_0x3bfd('0x30')](_0x1f3279[_0x3bfd('0x3b')],function(_0x259e5f){var _0x436e17={};_0x436e17[_0x259e5f]={'$like':'%'+_0x5efc4d[_0x3bfd('0x37')]['filter']+'%'};return _0x436e17;})});}_0x1f3279=_[_0x3bfd('0x41')]({},_0x1f3279,_0x5efc4d[_0x3bfd('0x59')]);return _0x410c56['getAgents'](_0x1f3279);}})[_0x3bfd('0x28')](function(_0x32a4e6){if(_0x32a4e6){_0x485136=_0x32a4e6[_0x3bfd('0x3c')];if(!_0x5efc4d[_0x3bfd('0x37')][_0x3bfd('0x56')](_0x3bfd('0x3d'))){_0x1f3279[_0x3bfd('0x21')]=qs[_0x3bfd('0x21')](_0x5efc4d['query'][_0x3bfd('0x21')]);_0x1f3279[_0x3bfd('0x20')]=qs[_0x3bfd('0x20')](_0x5efc4d['query']['offset']);}return _0x410c56[_0x3bfd('0x8a')](_0x1f3279);}})[_0x3bfd('0x28')](function(_0x1de869){if(_0x1de869){return _0x1de869?{'count':_0x485136,'rows':_0x1de869}:null;}})['then'](respondWithResult(_0x5c0953,null))[_0x3bfd('0x44')](handleError(_0x5c0953,null));}; \ No newline at end of file +var _0x3fc9=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','destroy','then','get','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','type','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','nolimit','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','User','field','tq.TeamId','from','join'];(function(_0x21cb79,_0x587c09){var _0x5bb335=function(_0x202369){while(--_0x202369){_0x21cb79['push'](_0x21cb79['shift']());}};_0x5bb335(++_0x587c09);}(_0x3fc9,0x1b0));var _0x93fc=function(_0x57f345,_0x316929){_0x57f345=_0x57f345-0x0;var _0x255e43=_0x3fc9[_0x57f345];return _0x255e43;};'use strict';var pdf=require(_0x93fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x93fc('0x1'));var zipdir=require(_0x93fc('0x2'));var jsonpatch=require(_0x93fc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x93fc('0x4'));var util=require(_0x93fc('0x5'));var path=require(_0x93fc('0x6'));var sox=require(_0x93fc('0x7'));var csv=require(_0x93fc('0x8'));var ejs=require(_0x93fc('0x9'));var fs=require('fs');var _=require(_0x93fc('0xa'));var squel=require(_0x93fc('0xb'));var crypto=require(_0x93fc('0xc'));var jsforce=require(_0x93fc('0xd'));var deskjs=require(_0x93fc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x93fc('0xf'));var Papa=require(_0x93fc('0x10'));var Redis=require(_0x93fc('0x11'));var authService=require(_0x93fc('0x12'));var qs=require(_0x93fc('0x13'));var as=require(_0x93fc('0x14'));var hardwareService=require(_0x93fc('0x15'));var logger=require(_0x93fc('0x16'))(_0x93fc('0x17'));var utils=require(_0x93fc('0x18'));var config=require(_0x93fc('0x19'));var db=require(_0x93fc('0x1a'))['db'];config['redis']=_[_0x93fc('0x1b')](config[_0x93fc('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x93fc('0x1d'))(new Redis(config[_0x93fc('0x1c')]));require(_0x93fc('0x1e'))['register'](socket);function respondWithStatusCode(_0x1a2b21,_0x430f23){_0x430f23=_0x430f23||0xcc;return function(_0x544df1){if(_0x544df1){return _0x1a2b21[_0x93fc('0x1f')](_0x430f23);}return _0x1a2b21[_0x93fc('0x20')](_0x430f23)['end']();};}function respondWithResult(_0x14aea2,_0xc5a3a3){_0xc5a3a3=_0xc5a3a3||0xc8;return function(_0x5b218d){if(_0x5b218d){return _0x14aea2[_0x93fc('0x20')](_0xc5a3a3)[_0x93fc('0x21')](_0x5b218d);}};}function respondWithFilteredResult(_0x44864d,_0x1d8240){return function(_0x1b43f0){if(_0x1b43f0){var _0xf41022=_0x1b43f0['count'],_0x20fbc1=_0x1d8240[_0x93fc('0x22')],_0x66a52d=_0x1d8240[_0x93fc('0x22')]+_0x1d8240[_0x93fc('0x23')],_0x188a11;if(_0x66a52d>=_0xf41022){_0x66a52d=_0xf41022;_0x188a11=0xc8;}else{_0x188a11=0xce;}_0x44864d[_0x93fc('0x20')](_0x188a11);return _0x44864d[_0x93fc('0x24')](_0x93fc('0x25'),_0x20fbc1+'-'+_0x66a52d+'/'+_0xf41022)['json'](_0x1b43f0);}return null;};}function patchUpdates(_0x5e1f1f){return function(_0x268ed1){try{jsonpatch[_0x93fc('0x26')](_0x268ed1,_0x5e1f1f,!![]);}catch(_0x21737b){return BPromise[_0x93fc('0x27')](_0x21737b);}return _0x268ed1['save']();};}function saveUpdates(_0x350932,_0x5a56e1){return function(_0x1ef475){if(_0x1ef475){return _0x1ef475['update'](_0x350932)['then'](function(_0x45652a){return _0x45652a;});}return null;};}function removeEntity(_0x1dc217,_0xd4a934){return function(_0x11a265){if(_0x11a265){return _0x11a265[_0x93fc('0x28')]()[_0x93fc('0x29')](function(){var _0x1f5f90=_0x11a265[_0x93fc('0x2a')]({'plain':!![]});var _0x388ea7=_0x93fc('0x2b');return db[_0x93fc('0x2c')][_0x93fc('0x28')]({'where':{'type':_0x388ea7,'resourceId':_0x1f5f90['id']}})[_0x93fc('0x29')](function(){return _0x11a265;});})['then'](function(){_0x1dc217[_0x93fc('0x20')](0xcc)[_0x93fc('0x2d')]();});}};}function handleEntityNotFound(_0x40b982,_0x3bf64f){return function(_0x4f1735){if(!_0x4f1735){_0x40b982['sendStatus'](0x194);}return _0x4f1735;};}function handleError(_0x3169bf,_0x2f7c94){_0x2f7c94=_0x2f7c94||0x1f4;return function(_0x363b17){logger[_0x93fc('0x2e')](_0x363b17['stack']);if(_0x363b17[_0x93fc('0x2f')]){delete _0x363b17['name'];}_0x3169bf[_0x93fc('0x20')](_0x2f7c94)[_0x93fc('0x30')](_0x363b17);};}exports[_0x93fc('0x31')]=function(_0xa50d2a,_0x449b1b){var _0x1fbe77={},_0x4cd0b0={},_0x43afc1={'count':0x0,'rows':[]};var _0x1e55ee=_[_0x93fc('0x32')](db[_0x93fc('0x33')]['rawAttributes'],function(_0x18c546){return{'name':_0x18c546['fieldName'],'type':_0x18c546[_0x93fc('0x34')]['key']};});_0x4cd0b0['model']=_['map'](_0x1e55ee,'name');_0x4cd0b0[_0x93fc('0x35')]=_[_0x93fc('0x36')](_0xa50d2a[_0x93fc('0x35')]);_0x4cd0b0[_0x93fc('0x37')]=_['intersection'](_0x4cd0b0[_0x93fc('0x38')],_0x4cd0b0['query']);_0x1fbe77[_0x93fc('0x39')]=_[_0x93fc('0x3a')](_0x4cd0b0[_0x93fc('0x38')],qs[_0x93fc('0x3b')](_0xa50d2a[_0x93fc('0x35')][_0x93fc('0x3b')]));_0x1fbe77[_0x93fc('0x39')]=_0x1fbe77[_0x93fc('0x39')][_0x93fc('0x3c')]?_0x1fbe77[_0x93fc('0x39')]:_0x4cd0b0[_0x93fc('0x38')];if(!_0xa50d2a['query']['hasOwnProperty']('nolimit')){_0x1fbe77[_0x93fc('0x23')]=qs[_0x93fc('0x23')](_0xa50d2a[_0x93fc('0x35')][_0x93fc('0x23')]);_0x1fbe77[_0x93fc('0x22')]=qs[_0x93fc('0x22')](_0xa50d2a['query'][_0x93fc('0x22')]);}_0x1fbe77[_0x93fc('0x3d')]=qs[_0x93fc('0x3e')](_0xa50d2a[_0x93fc('0x35')][_0x93fc('0x3e')]);_0x1fbe77['where']=qs[_0x93fc('0x37')](_[_0x93fc('0x3f')](_0xa50d2a[_0x93fc('0x35')],_0x4cd0b0[_0x93fc('0x37')]),_0x1e55ee);if(_0xa50d2a[_0x93fc('0x35')][_0x93fc('0x40')]){_0x1fbe77[_0x93fc('0x41')]=_[_0x93fc('0x42')](_0x1fbe77[_0x93fc('0x41')],{'$or':_[_0x93fc('0x32')](_0x1e55ee,function(_0x914b22){if(_0x914b22['type']!==_0x93fc('0x43')){var _0x45b044={};_0x45b044[_0x914b22['name']]={'$like':'%'+_0xa50d2a[_0x93fc('0x35')]['filter']+'%'};return _0x45b044;}})});}_0x1fbe77=_[_0x93fc('0x42')]({},_0x1fbe77,_0xa50d2a[_0x93fc('0x44')]);var _0xceabb7={'where':_0x1fbe77['where']};return db['WhatsappQueue'][_0x93fc('0x45')](_0xceabb7)[_0x93fc('0x29')](function(_0x22a476){_0x43afc1[_0x93fc('0x45')]=_0x22a476;if(_0xa50d2a['query'][_0x93fc('0x46')]){_0x1fbe77[_0x93fc('0x47')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x93fc('0x48')](_0x1fbe77);})[_0x93fc('0x29')](function(_0x2fef65){_0x43afc1[_0x93fc('0x49')]=_0x2fef65;return _0x43afc1;})[_0x93fc('0x29')](respondWithFilteredResult(_0x449b1b,_0x1fbe77))[_0x93fc('0x4a')](handleError(_0x449b1b,null));};exports[_0x93fc('0x4b')]=function(_0x2ab33b,_0x439a36){var _0x4aec8a={'raw':!![],'where':{'id':_0x2ab33b[_0x93fc('0x4c')]['id']}},_0x22bb4b={};_0x22bb4b[_0x93fc('0x38')]=_[_0x93fc('0x36')](db['WhatsappQueue'][_0x93fc('0x4d')]);_0x22bb4b[_0x93fc('0x35')]=_['keys'](_0x2ab33b[_0x93fc('0x35')]);_0x22bb4b[_0x93fc('0x37')]=_['intersection'](_0x22bb4b[_0x93fc('0x38')],_0x22bb4b[_0x93fc('0x35')]);_0x4aec8a['attributes']=_[_0x93fc('0x3a')](_0x22bb4b['model'],qs[_0x93fc('0x3b')](_0x2ab33b[_0x93fc('0x35')][_0x93fc('0x3b')]));_0x4aec8a[_0x93fc('0x39')]=_0x4aec8a[_0x93fc('0x39')][_0x93fc('0x3c')]?_0x4aec8a['attributes']:_0x22bb4b['model'];if(_0x2ab33b[_0x93fc('0x35')][_0x93fc('0x46')]){_0x4aec8a[_0x93fc('0x47')]=[{'all':!![]}];}_0x4aec8a=_[_0x93fc('0x42')]({},_0x4aec8a,_0x2ab33b[_0x93fc('0x44')]);return db[_0x93fc('0x33')][_0x93fc('0x4e')](_0x4aec8a)[_0x93fc('0x29')](handleEntityNotFound(_0x439a36,null))[_0x93fc('0x29')](respondWithResult(_0x439a36,null))[_0x93fc('0x4a')](handleError(_0x439a36,null));};exports[_0x93fc('0x4f')]=function(_0x88bedc,_0x35e747){return db[_0x93fc('0x33')]['create'](_0x88bedc[_0x93fc('0x50')],{})[_0x93fc('0x29')](function(_0x1e7fa6){var _0x15ccdc=_0x88bedc[_0x93fc('0x51')][_0x93fc('0x2a')]({'plain':!![]});if(!_0x15ccdc)throw new Error(_0x93fc('0x52'));if(_0x15ccdc[_0x93fc('0x53')]===_0x93fc('0x51')){var _0x5e6fcd=_0x1e7fa6['get']({'plain':!![]});var _0x5c8038=_0x93fc('0x2b');return db[_0x93fc('0x54')][_0x93fc('0x4e')]({'where':{'name':_0x5c8038,'userProfileId':_0x15ccdc[_0x93fc('0x55')]},'raw':!![]})['then'](function(_0x1a621f){if(_0x1a621f&&_0x1a621f[_0x93fc('0x56')]===0x0){return db['UserProfileResource'][_0x93fc('0x4f')]({'name':_0x5e6fcd[_0x93fc('0x2f')],'resourceId':_0x5e6fcd['id'],'type':_0x1a621f[_0x93fc('0x2f')],'sectionId':_0x1a621f['id']},{})[_0x93fc('0x29')](function(){return _0x1e7fa6;});}else{return _0x1e7fa6;}})[_0x93fc('0x4a')](function(_0x55ffc4){logger[_0x93fc('0x2e')](_0x93fc('0x57'),_0x55ffc4);throw _0x55ffc4;});}return _0x1e7fa6;})['then'](respondWithResult(_0x35e747,0xc9))[_0x93fc('0x4a')](handleError(_0x35e747,null));};exports['update']=function(_0x3a41d6,_0x1a7582){if(_0x3a41d6['body']['id']){delete _0x3a41d6[_0x93fc('0x50')]['id'];}return db[_0x93fc('0x33')]['find']({'where':{'id':_0x3a41d6[_0x93fc('0x4c')]['id']}})[_0x93fc('0x29')](handleEntityNotFound(_0x1a7582,null))['then'](saveUpdates(_0x3a41d6[_0x93fc('0x50')],null))[_0x93fc('0x29')](respondWithResult(_0x1a7582,null))['catch'](handleError(_0x1a7582,null));};exports['destroy']=function(_0x4254f4,_0x21096f){return db[_0x93fc('0x33')][_0x93fc('0x4e')]({'where':{'id':_0x4254f4['params']['id']}})[_0x93fc('0x29')](handleEntityNotFound(_0x21096f,null))['then'](removeEntity(_0x21096f,null))[_0x93fc('0x4a')](handleError(_0x21096f,null));};exports[_0x93fc('0x58')]=function(_0x1b073a,_0x48985e){return db[_0x93fc('0x33')][_0x93fc('0x58')]()[_0x93fc('0x29')](respondWithResult(_0x48985e,null))[_0x93fc('0x4a')](handleError(_0x48985e,null));};exports[_0x93fc('0x59')]=function(_0x1c6d8e,_0x477174,_0xd53620){var _0x5296c3={'raw':!![],'where':{}},_0x1c5be1={},_0x562b22;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1c6d8e[_0x93fc('0x4c')]['id']}})[_0x93fc('0x29')](handleEntityNotFound(_0x477174,null))[_0x93fc('0x29')](function(_0x14a6fe){if(_0x14a6fe){_0x562b22=_0x14a6fe[_0x93fc('0x2a')]({'plain':!![]});_0x1c5be1[_0x93fc('0x38')]=_['keys'](db[_0x93fc('0x5a')]['rawAttributes']);_0x1c5be1['query']=_[_0x93fc('0x36')](_0x1c6d8e[_0x93fc('0x35')]);_0x1c5be1[_0x93fc('0x37')]=_[_0x93fc('0x3a')](_0x1c5be1['model'],_0x1c5be1[_0x93fc('0x35')]);_0x5296c3[_0x93fc('0x39')]=_[_0x93fc('0x3a')](_0x1c5be1['model'],qs[_0x93fc('0x3b')](_0x1c6d8e[_0x93fc('0x35')][_0x93fc('0x3b')]));_0x5296c3[_0x93fc('0x39')]=_0x5296c3['attributes']['length']?_0x5296c3[_0x93fc('0x39')]:_0x1c5be1[_0x93fc('0x38')];if(!_0x1c6d8e['query']['hasOwnProperty'](_0x93fc('0x5b'))){_0x5296c3['limit']=qs[_0x93fc('0x23')](_0x1c6d8e[_0x93fc('0x35')]['limit']);_0x5296c3[_0x93fc('0x22')]=qs[_0x93fc('0x22')](_0x1c6d8e['query'][_0x93fc('0x22')]);}_0x5296c3[_0x93fc('0x3d')]=qs['sort'](_0x1c6d8e[_0x93fc('0x35')][_0x93fc('0x3e')]);_0x5296c3[_0x93fc('0x41')]=qs[_0x93fc('0x37')](_['pick'](_0x1c6d8e[_0x93fc('0x35')],_0x1c5be1[_0x93fc('0x37')]));_0x5296c3[_0x93fc('0x41')]['WhatsappQueueId']=_0x14a6fe['id'];if(_0x1c6d8e[_0x93fc('0x35')][_0x93fc('0x40')]){_0x5296c3[_0x93fc('0x41')]=_[_0x93fc('0x42')](_0x5296c3['where'],{'$or':_[_0x93fc('0x32')](_0x5296c3[_0x93fc('0x39')],function(_0x505b11){var _0x1a28c3={};_0x1a28c3[_0x505b11]={'$like':'%'+_0x1c6d8e[_0x93fc('0x35')][_0x93fc('0x40')]+'%'};return _0x1a28c3;})});}_0x5296c3=_['merge']({},_0x5296c3,_0x1c6d8e[_0x93fc('0x44')]);return db[_0x93fc('0x5a')][_0x93fc('0x48')](_0x5296c3);}})[_0x93fc('0x29')](function(_0x388780){if(_0x388780){return db['User'][_0x93fc('0x5c')]({'where':{'id':_['map'](_0x388780,_0x93fc('0x5d')),'role':_0x93fc('0x5e')},'attributes':['id',_0x93fc('0x2f'),'whatsappPause',_0x93fc('0x5f'),_0x93fc('0x60')]});}})[_0x93fc('0x29')](function(_0x4d10bc){if(_0x4d10bc){return{'count':_0x4d10bc['count'],'rows':_[_0x93fc('0x32')](_0x4d10bc['rows'],function(_0x2a98bc){return{'membername':_0x2a98bc['name'],'UserId':_0x2a98bc['id'],'queue_name':_0x562b22[_0x93fc('0x2f')],'WhatsappQueueId':_0x562b22['id'],'interface':util['format'](_0x93fc('0x61'),_0x93fc('0x62'),_0x2a98bc[_0x93fc('0x2f')]),'penalty':0x0,'paused':_0x2a98bc['whatsappPause'],'createdAt':_0x2a98bc[_0x93fc('0x60')],'updatedAt':_0x2a98bc[_0x93fc('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x477174,_0x5296c3))[_0x93fc('0x4a')](handleError(_0x477174,null));};exports[_0x93fc('0x63')]=function(_0x5b0a13,_0x51a474,_0x48a121){var _0x23bf65={};var _0x1405a6={};var _0x469979;var _0x554bdf;return db[_0x93fc('0x33')][_0x93fc('0x64')]({'where':{'id':_0x5b0a13[_0x93fc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51a474,null))[_0x93fc('0x29')](function(_0x500d5b){if(_0x500d5b){_0x469979=_0x500d5b;_0x1405a6[_0x93fc('0x38')]=_[_0x93fc('0x36')](db[_0x93fc('0x65')][_0x93fc('0x4d')]);_0x1405a6['query']=_[_0x93fc('0x36')](_0x5b0a13[_0x93fc('0x35')]);_0x1405a6['filters']=_['intersection'](_0x1405a6[_0x93fc('0x38')],_0x1405a6[_0x93fc('0x35')]);_0x23bf65[_0x93fc('0x39')]=_[_0x93fc('0x3a')](_0x1405a6[_0x93fc('0x38')],qs['fields'](_0x5b0a13['query']['fields']));_0x23bf65['attributes']=_0x23bf65[_0x93fc('0x39')][_0x93fc('0x3c')]?_0x23bf65[_0x93fc('0x39')]:_0x1405a6[_0x93fc('0x38')];_0x23bf65[_0x93fc('0x3d')]=qs[_0x93fc('0x3e')](_0x5b0a13[_0x93fc('0x35')][_0x93fc('0x3e')]);_0x23bf65[_0x93fc('0x41')]=qs[_0x93fc('0x37')](_['pick'](_0x5b0a13[_0x93fc('0x35')],_0x1405a6[_0x93fc('0x37')]));if(_0x5b0a13[_0x93fc('0x35')][_0x93fc('0x40')]){_0x23bf65[_0x93fc('0x41')]=_[_0x93fc('0x42')](_0x23bf65[_0x93fc('0x41')],{'$or':_[_0x93fc('0x32')](_0x23bf65[_0x93fc('0x39')],function(_0x278115){var _0x5e7f34={};_0x5e7f34[_0x278115]={'$like':'%'+_0x5b0a13[_0x93fc('0x35')][_0x93fc('0x40')]+'%'};return _0x5e7f34;})});}_0x23bf65=_[_0x93fc('0x42')]({},_0x23bf65,_0x5b0a13[_0x93fc('0x44')]);return _0x469979[_0x93fc('0x63')](_0x23bf65);}})[_0x93fc('0x29')](function(_0x268537){if(_0x268537){_0x554bdf=_0x268537['length'];if(!_0x5b0a13['query'][_0x93fc('0x66')](_0x93fc('0x5b'))){_0x23bf65[_0x93fc('0x23')]=qs['limit'](_0x5b0a13[_0x93fc('0x35')][_0x93fc('0x23')]);_0x23bf65[_0x93fc('0x22')]=qs[_0x93fc('0x22')](_0x5b0a13[_0x93fc('0x35')][_0x93fc('0x22')]);}return _0x469979[_0x93fc('0x63')](_0x23bf65);}})[_0x93fc('0x29')](function(_0x80cbdf){if(_0x80cbdf){return _0x80cbdf?{'count':_0x554bdf,'rows':_0x80cbdf}:null;}})['then'](respondWithResult(_0x51a474,null))[_0x93fc('0x4a')](handleError(_0x51a474,null));};exports[_0x93fc('0x67')]=function(_0x55167a,_0x3a163a,_0x45470){var _0x320a61=_0x55167a[_0x93fc('0x50')][_0x93fc('0x68')];return db['Team'][_0x93fc('0x48')]({'where':{'id':_0x320a61},'attributes':['id'],'include':[{'model':db['User'],'as':_0x93fc('0x69'),'attributes':['id',_0x93fc('0x2f'),_0x93fc('0x6a'),_0x93fc('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x4143b6){if(_0x4143b6){var _0x592921=_[_0x93fc('0x6c')](_0x4143b6,function(_0x3d853e){var _0x2a4847=_0x3d853e['get']({'plain':!![]});return _0x2a4847[_0x93fc('0x69')];});return db['WhatsappQueue'][_0x93fc('0x4e')]({'where':{'id':_0x55167a['params']['id']}})['then'](function(_0x47eb70){return db[_0x93fc('0x6d')][_0x93fc('0x6e')](function(_0x455f86){return _0x47eb70[_0x93fc('0x67')](_0x320a61,{'transaction':_0x455f86})[_0x93fc('0x29')](function(){return BPromise[_0x93fc('0x6f')](_0x592921,function(_0x2d2235){return db[_0x93fc('0x5a')][_0x93fc('0x70')]({'where':{'UserId':_0x2d2235['id'],'WhatsappQueueId':_0x55167a[_0x93fc('0x4c')]['id']},'transaction':_0x455f86});});})[_0x93fc('0x29')](function(){_0x592921[_0x93fc('0x71')](function(_0x35f558){socket[_0x93fc('0x72')]('userWhatsappQueue:save',{'UserId':_0x35f558['id'],'WhatsappQueueId':_0x47eb70['id']});});});});});}})['then'](respondWithStatusCode(_0x3a163a,null))[_0x93fc('0x4a')](handleError(_0x3a163a,null));};exports['removeTeams']=function(_0x183c5c,_0x34980a,_0x284728){return db['Team'][_0x93fc('0x48')]({'where':{'id':_0x183c5c['query'][_0x93fc('0x68')]},'attributes':['id'],'include':[{'model':db[_0x93fc('0x73')],'as':_0x93fc('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34980a,null))[_0x93fc('0x29')](function(_0x140155){var _0x545450=_[_0x93fc('0x32')](_0x140155,'id');var _0x1a4fb0=[];var _0x2b9839=[];var _0x26f548=squel['select']();_0x26f548[_0x93fc('0x74')](_0x93fc('0x75'))[_0x93fc('0x76')]('team_has_whatsapp_queues','tq')[_0x93fc('0x77')](_0x93fc('0x78'),'ut',_0x93fc('0x79'))[_0x93fc('0x41')]('WhatsappQueueId\x20=\x20?',_0x183c5c[_0x93fc('0x4c')]['id']);for(var _0x131918=0x0;_0x131918<_0x140155[_0x93fc('0x3c')];_0x131918+=0x1){let _0x435e72=_0x140155[_0x131918];for(var _0x58628d=0x0;_0x58628d<_0x435e72[_0x93fc('0x69')]['length'];_0x58628d+=0x1){let _0x309635=_0x435e72[_0x93fc('0x69')][_0x58628d];var _0x470547=_0x26f548[_0x93fc('0x7a')]();_0x470547[_0x93fc('0x41')](_0x93fc('0x7b'),_0x309635['id']);_0x2b9839['push'](db[_0x93fc('0x6d')]['query'](_0x470547[_0x93fc('0x7c')](),{'type':db[_0x93fc('0x6d')]['QueryTypes'][_0x93fc('0x7d')]})[_0x93fc('0x29')](function(_0xe6cabe){if(_0xe6cabe[_0x93fc('0x3c')]===0x1){return _0x309635['id'];}else{var _0x58afb8=_[_0x93fc('0x7e')](_[_0x93fc('0x32')](_0xe6cabe,_0x93fc('0x7f')),function(_0x2ecd54){return _[_0x93fc('0x80')](_0x545450,_0x2ecd54);});if(_0x58afb8){return _0x309635['id'];}}}));}}return BPromise['all'](_0x2b9839)['then'](function(_0x6a490e){_0x1a4fb0=_(_0x1a4fb0)[_0x93fc('0x81')](_0x6a490e)[_0x93fc('0x82')]()['value']();return db['WhatsappQueue'][_0x93fc('0x4e')]({'where':{'id':_0x183c5c['params']['id']}})[_0x93fc('0x29')](function(_0xba8c72){return db[_0x93fc('0x6d')][_0x93fc('0x6e')](function(_0x1a1b3b){return _0xba8c72['removeTeams'](_0x183c5c[_0x93fc('0x35')][_0x93fc('0x68')],{'transaction':_0x1a1b3b})['then'](function(){if(!_[_0x93fc('0x83')](_0x1a4fb0)){return _0xba8c72[_0x93fc('0x84')](_0x1a4fb0,{'transaction':_0x1a1b3b});}})[_0x93fc('0x29')](function(){_0x1a4fb0[_0x93fc('0x71')](function(_0x36adb0){socket['emit'](_0x93fc('0x85'),{'UserId':_0x36adb0,'WhatsappQueueId':_0xba8c72['id']});});});});});});})[_0x93fc('0x29')](respondWithStatusCode(_0x34980a,null))['catch'](handleError(_0x34980a,null));};exports['addAgents']=function(_0x25f7f4,_0x245436,_0x1538a5){return db[_0x93fc('0x33')][_0x93fc('0x4e')]({'where':{'id':_0x25f7f4['params']['id']}})[_0x93fc('0x29')](handleEntityNotFound(_0x245436,null))[_0x93fc('0x29')](function(_0x1270b0){if(_0x1270b0){return _0x1270b0[_0x93fc('0x86')](_0x25f7f4[_0x93fc('0x50')][_0x93fc('0x68')],_['omit'](_0x25f7f4['body'],[_0x93fc('0x68'),'id'])||{})[_0x93fc('0x87')](function(_0x3c85e1){for(var _0x9ab345=0x0;_0x9ab345<_0x25f7f4[_0x93fc('0x50')]['ids'][_0x93fc('0x3c')];_0x9ab345+=0x1){socket['emit'](_0x93fc('0x88'),{'UserId':_0x25f7f4[_0x93fc('0x50')]['ids'][_0x9ab345],'WhatsappQueueId':_0x25f7f4[_0x93fc('0x4c')]['id']});}return _0x3c85e1;});}})[_0x93fc('0x29')](respondWithResult(_0x245436,null))[_0x93fc('0x4a')](handleError(_0x245436,null));};exports[_0x93fc('0x84')]=function(_0x2e7ecd,_0x671243,_0xdccfb8){return db['WhatsappQueue'][_0x93fc('0x4e')]({'where':{'id':_0x2e7ecd[_0x93fc('0x4c')]['id']}})[_0x93fc('0x29')](handleEntityNotFound(_0x671243,null))['then'](function(_0x4e0dc0){if(_0x4e0dc0){return _0x4e0dc0[_0x93fc('0x84')](_0x2e7ecd[_0x93fc('0x35')][_0x93fc('0x68')])[_0x93fc('0x29')](function(){if(_['isArray'](_0x2e7ecd[_0x93fc('0x35')][_0x93fc('0x68')])){for(var _0x33cb81=0x0;_0x33cb81<_0x2e7ecd[_0x93fc('0x35')][_0x93fc('0x68')][_0x93fc('0x3c')];_0x33cb81+=0x1){socket[_0x93fc('0x72')](_0x93fc('0x85'),{'UserId':Number(_0x2e7ecd[_0x93fc('0x35')][_0x93fc('0x68')][_0x33cb81]),'WhatsappQueueId':Number(_0x2e7ecd[_0x93fc('0x4c')]['id'])});}}else{socket['emit'](_0x93fc('0x85'),{'UserId':Number(_0x2e7ecd[_0x93fc('0x35')][_0x93fc('0x68')]),'WhatsappQueueId':Number(_0x2e7ecd[_0x93fc('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x671243,null))['catch'](handleError(_0x671243,null));};exports[_0x93fc('0x89')]=function(_0x479ce9,_0x41b2ce,_0x3ae485){var _0x156147={};var _0x165128={};var _0x32f685;var _0x215d33;return db[_0x93fc('0x33')][_0x93fc('0x64')]({'where':{'id':_0x479ce9[_0x93fc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41b2ce,null))[_0x93fc('0x29')](function(_0xeab835){if(_0xeab835){_0x32f685=_0xeab835;_0x165128[_0x93fc('0x38')]=_[_0x93fc('0x36')](db[_0x93fc('0x73')][_0x93fc('0x4d')]);_0x165128[_0x93fc('0x35')]=_['keys'](_0x479ce9[_0x93fc('0x35')]);_0x165128['filters']=_[_0x93fc('0x3a')](_0x165128[_0x93fc('0x38')],_0x165128[_0x93fc('0x35')]);_0x156147['attributes']=_[_0x93fc('0x3a')](_0x165128['model'],qs['fields'](_0x479ce9['query'][_0x93fc('0x3b')]));_0x156147[_0x93fc('0x39')]=_0x156147[_0x93fc('0x39')][_0x93fc('0x3c')]?_0x156147[_0x93fc('0x39')]:_0x165128[_0x93fc('0x38')];_0x156147['order']=qs[_0x93fc('0x3e')](_0x479ce9[_0x93fc('0x35')]['sort']);_0x156147['where']=qs[_0x93fc('0x37')](_[_0x93fc('0x3f')](_0x479ce9[_0x93fc('0x35')],_0x165128['filters']));if(_0x479ce9[_0x93fc('0x35')][_0x93fc('0x40')]){_0x156147[_0x93fc('0x41')]=_[_0x93fc('0x42')](_0x156147[_0x93fc('0x41')],{'$or':_[_0x93fc('0x32')](_0x156147['attributes'],function(_0x118636){var _0x4e588a={};_0x4e588a[_0x118636]={'$like':'%'+_0x479ce9[_0x93fc('0x35')][_0x93fc('0x40')]+'%'};return _0x4e588a;})});}_0x156147=_[_0x93fc('0x42')]({},_0x156147,_0x479ce9[_0x93fc('0x44')]);return _0x32f685[_0x93fc('0x89')](_0x156147);}})[_0x93fc('0x29')](function(_0x480c04){if(_0x480c04){_0x215d33=_0x480c04[_0x93fc('0x3c')];if(!_0x479ce9['query']['hasOwnProperty'](_0x93fc('0x5b'))){_0x156147[_0x93fc('0x23')]=qs[_0x93fc('0x23')](_0x479ce9['query']['limit']);_0x156147[_0x93fc('0x22')]=qs['offset'](_0x479ce9[_0x93fc('0x35')][_0x93fc('0x22')]);}return _0x32f685[_0x93fc('0x89')](_0x156147);}})[_0x93fc('0x29')](function(_0x532cd6){if(_0x532cd6){return _0x532cd6?{'count':_0x215d33,'rows':_0x532cd6}:null;}})[_0x93fc('0x29')](respondWithResult(_0x41b2ce,null))[_0x93fc('0x4a')](handleError(_0x41b2ce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 260f0f3..8eaf0fd 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 _0xa56f=['remove','emit','exports','events','WhatsappQueue','setMaxListeners','save'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xa56f,0xc0));var _0xfa56=function(_0x333d4d,_0x50440f){_0x333d4d=_0x333d4d-0x0;var _0x21b5ca=_0xa56f[_0x333d4d];return _0x21b5ca;};'use strict';var EventEmitter=require(_0xfa56('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xfa56('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfa56('0x2')](0x0);var events={'afterCreate':_0xfa56('0x3'),'afterUpdate':'update','afterDestroy':_0xfa56('0x4')};function emitEvent(_0x426f1a){return function(_0x3b4b3a,_0xe4bb4e,_0x461c8b){WhatsappQueueEvents[_0xfa56('0x5')](_0x426f1a+':'+_0x3b4b3a['id'],_0x3b4b3a);WhatsappQueueEvents[_0xfa56('0x5')](_0x426f1a,_0x3b4b3a);_0x461c8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfa56('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb0ff=['events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x39758e,_0x1c4f9e){var _0x467281=function(_0x14ba8e){while(--_0x14ba8e){_0x39758e['push'](_0x39758e['shift']());}};_0x467281(++_0x1c4f9e);}(_0xb0ff,0xe1));var _0xfb0f=function(_0x2f2713,_0x153610){_0x2f2713=_0x2f2713-0x0;var _0x4d0110=_0xb0ff[_0x2f2713];return _0x4d0110;};'use strict';var EventEmitter=require(_0xfb0f('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xfb0f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfb0f('0x2')](0x0);var events={'afterCreate':_0xfb0f('0x3'),'afterUpdate':_0xfb0f('0x4'),'afterDestroy':_0xfb0f('0x5')};function emitEvent(_0x9e6896){return function(_0x29ac35,_0x1367bf,_0x9c7030){WhatsappQueueEvents[_0xfb0f('0x6')](_0x9e6896+':'+_0x29ac35['id'],_0x29ac35);WhatsappQueueEvents[_0xfb0f('0x6')](_0x9e6896,_0x29ac35);_0x9c7030(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xfb0f('0x7')](e,emitEvent(event));}}module[_0xfb0f('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 2070143..dfbd6ee 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 _0x8960=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8960,0x19a));var _0x0896=function(_0x1c6c1e,_0x175146){_0x1c6c1e=_0x1c6c1e-0x0;var _0x17e0bb=_0x8960[_0x1c6c1e];return _0x17e0bb;};'use strict';var _=require(_0x0896('0x0'));var util=require(_0x0896('0x1'));var logger=require(_0x0896('0x2'))('api');var moment=require(_0x0896('0x3'));var BPromise=require(_0x0896('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0896('0x5'));var rimraf=require(_0x0896('0x6'));var config=require(_0x0896('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x0896('0x8')]=function(_0x50e306,_0xc09080){return _0x50e306[_0x0896('0x9')](_0x0896('0xa'),attributes,{'tableName':_0x0896('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e46=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x37953a,_0x1e6670){var _0x3b5f05=function(_0x228c23){while(--_0x228c23){_0x37953a['push'](_0x37953a['shift']());}};_0x3b5f05(++_0x1e6670);}(_0x4e46,0xdf));var _0x64e4=function(_0x172ffe,_0x529ddf){_0x172ffe=_0x172ffe-0x0;var _0x2b47d3=_0x4e46[_0x172ffe];return _0x2b47d3;};'use strict';var _=require(_0x64e4('0x0'));var util=require('util');var logger=require(_0x64e4('0x1'))(_0x64e4('0x2'));var moment=require(_0x64e4('0x3'));var BPromise=require(_0x64e4('0x4'));var rp=require(_0x64e4('0x5'));var fs=require('fs');var path=require(_0x64e4('0x6'));var rimraf=require(_0x64e4('0x7'));var config=require(_0x64e4('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x64e4('0x9')]=function(_0x167d56,_0x4186b4){return _0x167d56[_0x64e4('0xa')](_0x64e4('0xb'),attributes,{'tableName':_0x64e4('0xc'),'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 5b60961..dfc1a80 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 _0xf575=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','GetWhatsappQueue','ShowWhatsappQueue','raw','stringify','moment','bluebird','randomstring'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xf575,0xa5));var _0x5f57=function(_0x574329,_0x5726cc){_0x574329=_0x574329-0x0;var _0x3a3620=_0xf575[_0x574329];return _0x3a3620;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f57('0x0'));var BPromise=require(_0x5f57('0x1'));var rs=require(_0x5f57('0x2'));var fs=require('fs');var Redis=require(_0x5f57('0x3'));var db=require(_0x5f57('0x4'))['db'];var utils=require(_0x5f57('0x5'));var logger=require(_0x5f57('0x6'))(_0x5f57('0x7'));var config=require(_0x5f57('0x8'));var jayson=require(_0x5f57('0x9'));var client=jayson[_0x5f57('0xa')][_0x5f57('0xb')]({'port':0x232a});config[_0x5f57('0xc')]=_[_0x5f57('0xd')](config[_0x5f57('0xc')],{'host':_0x5f57('0xe'),'port':0x18eb});var socket=require(_0x5f57('0xf'))(new Redis(config[_0x5f57('0xc')]));require(_0x5f57('0x10'))[_0x5f57('0x11')](socket);function respondWithRpcPromise(_0x4441ec,_0x1a7601,_0x4b8886){return new BPromise(function(_0x3bc624,_0x5f1a20){return client[_0x5f57('0x12')](_0x4441ec,_0x4b8886)[_0x5f57('0x13')](function(_0xf34058){logger[_0x5f57('0x14')](_0x5f57('0x15'),_0x1a7601,_0x5f57('0x16'));logger[_0x5f57('0x17')](_0x5f57('0x18'),_0x1a7601,'request\x20sent',JSON['stringify'](_0xf34058));if(_0xf34058[_0x5f57('0x19')]){if(_0xf34058[_0x5f57('0x19')][_0x5f57('0x1a')]===0x1f4){logger[_0x5f57('0x19')](_0x5f57('0x15'),_0x1a7601,_0xf34058[_0x5f57('0x19')][_0x5f57('0x1b')]);return _0x5f1a20(_0xf34058[_0x5f57('0x19')][_0x5f57('0x1b')]);}logger['error'](_0x5f57('0x15'),_0x1a7601,_0xf34058[_0x5f57('0x19')]['message']);return _0x3bc624(_0xf34058[_0x5f57('0x19')]['message']);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1a7601,_0x5f57('0x16'));_0x3bc624(_0xf34058['result']['message']);}})[_0x5f57('0x1c')](function(_0xa06b29){logger[_0x5f57('0x19')](_0x5f57('0x15'),_0x1a7601,_0xa06b29);_0x5f1a20(_0xa06b29);});});}exports['GetWhatsappQueue']=function(_0x3d0fc0){var _0x2bfedc=this;return new Promise(function(_0x2fc55d,_0x4c8615){return db[_0x5f57('0x1d')][_0x5f57('0x1e')]({'raw':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x20')]||null:null,'attributes':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x21')]||null:null,'limit':_0x3d0fc0[_0x5f57('0x1f')]?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x22')]||null:null,'include':_0x3d0fc0['options']?_0x3d0fc0[_0x5f57('0x1f')][_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x3d0fc0['options'][_0x5f57('0x23')],function(_0x50dd1e){return{'model':db[_0x50dd1e[_0x5f57('0x25')]],'as':_0x50dd1e['as'],'attributes':_0x50dd1e[_0x5f57('0x21')],'include':_0x50dd1e[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x50dd1e[_0x5f57('0x23')],function(_0x44b7c9){return{'model':db[_0x44b7c9[_0x5f57('0x25')]],'as':_0x44b7c9['as'],'attributes':_0x44b7c9['attributes'],'include':_0x44b7c9[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x44b7c9[_0x5f57('0x23')],function(_0x31e99f){return{'model':db[_0x31e99f[_0x5f57('0x25')]],'as':_0x31e99f['as'],'attributes':_0x31e99f[_0x5f57('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d26e1){logger['info'](_0x5f57('0x26'),_0x3d0fc0);logger[_0x5f57('0x17')]('GetWhatsappQueue',_0x3d0fc0,JSON['stringify'](_0x5d26e1));_0x2fc55d(_0x5d26e1);})[_0x5f57('0x1c')](function(_0x287411){logger['error'](_0x5f57('0x26'),_0x287411[_0x5f57('0x1b')],_0x3d0fc0);_0x4c8615(_0x2bfedc[_0x5f57('0x19')](0x1f4,_0x287411[_0x5f57('0x1b')]));});});};exports[_0x5f57('0x27')]=function(_0x6f22c6){var _0x3926ea=this;return new Promise(function(_0x4115da,_0x262849){return db['WhatsappQueue']['find']({'raw':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x28')]===undefined?!![]:![]:!![],'where':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')]['where']||null:null,'attributes':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x21')]||null:null,'include':_0x6f22c6[_0x5f57('0x1f')]?_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x6f22c6[_0x5f57('0x1f')][_0x5f57('0x23')],function(_0x3e85ed){return{'model':db[_0x3e85ed[_0x5f57('0x25')]],'as':_0x3e85ed['as'],'attributes':_0x3e85ed[_0x5f57('0x21')],'include':_0x3e85ed[_0x5f57('0x23')]?_[_0x5f57('0x24')](_0x3e85ed[_0x5f57('0x23')],function(_0x155c5c){return{'model':db[_0x155c5c[_0x5f57('0x25')]],'as':_0x155c5c['as'],'attributes':_0x155c5c[_0x5f57('0x21')],'include':_0x155c5c[_0x5f57('0x23')]?_['map'](_0x155c5c[_0x5f57('0x23')],function(_0x9e1d7a){return{'model':db[_0x9e1d7a[_0x5f57('0x25')]],'as':_0x9e1d7a['as'],'attributes':_0x9e1d7a[_0x5f57('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f57('0x13')](function(_0x48c629){logger[_0x5f57('0x14')](_0x5f57('0x27'),_0x6f22c6);logger[_0x5f57('0x17')](_0x5f57('0x27'),_0x6f22c6,JSON[_0x5f57('0x29')](_0x48c629));_0x4115da(_0x48c629);})[_0x5f57('0x1c')](function(_0x346c94){logger['error'](_0x5f57('0x27'),_0x346c94['message'],_0x6f22c6);_0x262849(_0x3926ea[_0x5f57('0x19')](0x1f4,_0x346c94['message']));});});}; \ No newline at end of file +var _0x4e1d=['map','include','model','GetWhatsappQueue','ShowWhatsappQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','WhatsappQueue','findAll','options','attributes'];(function(_0x215f34,_0x3eb76b){var _0x39d068=function(_0x2ae5b7){while(--_0x2ae5b7){_0x215f34['push'](_0x215f34['shift']());}};_0x39d068(++_0x3eb76b);}(_0x4e1d,0x99));var _0xd4e1=function(_0x5ed4d6,_0xddd879){_0x5ed4d6=_0x5ed4d6-0x0;var _0x452823=_0x4e1d[_0x5ed4d6];return _0x452823;};'use strict';var _=require(_0xd4e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd4e1('0x1'));var rs=require(_0xd4e1('0x2'));var fs=require('fs');var Redis=require(_0xd4e1('0x3'));var db=require(_0xd4e1('0x4'))['db'];var utils=require(_0xd4e1('0x5'));var logger=require(_0xd4e1('0x6'))(_0xd4e1('0x7'));var config=require(_0xd4e1('0x8'));var jayson=require(_0xd4e1('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd4e1('0xa')]=_[_0xd4e1('0xb')](config[_0xd4e1('0xa')],{'host':_0xd4e1('0xc'),'port':0x18eb});var socket=require(_0xd4e1('0xd'))(new Redis(config[_0xd4e1('0xa')]));require(_0xd4e1('0xe'))[_0xd4e1('0xf')](socket);function respondWithRpcPromise(_0x370d40,_0x2f73b8,_0x3e4d26){return new BPromise(function(_0x4734a5,_0x146d05){return client['request'](_0x370d40,_0x3e4d26)[_0xd4e1('0x10')](function(_0x109636){logger['info'](_0xd4e1('0x11'),_0x2f73b8,'request\x20sent');logger[_0xd4e1('0x12')](_0xd4e1('0x13'),_0x2f73b8,_0xd4e1('0x14'),JSON[_0xd4e1('0x15')](_0x109636));if(_0x109636[_0xd4e1('0x16')]){if(_0x109636[_0xd4e1('0x16')][_0xd4e1('0x17')]===0x1f4){logger[_0xd4e1('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2f73b8,_0x109636[_0xd4e1('0x16')][_0xd4e1('0x18')]);return _0x146d05(_0x109636[_0xd4e1('0x16')][_0xd4e1('0x18')]);}logger['error'](_0xd4e1('0x11'),_0x2f73b8,_0x109636[_0xd4e1('0x16')]['message']);return _0x4734a5(_0x109636[_0xd4e1('0x16')][_0xd4e1('0x18')]);}else{logger[_0xd4e1('0x19')](_0xd4e1('0x11'),_0x2f73b8,_0xd4e1('0x14'));_0x4734a5(_0x109636[_0xd4e1('0x1a')]['message']);}})[_0xd4e1('0x1b')](function(_0x3d4c41){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2f73b8,_0x3d4c41);_0x146d05(_0x3d4c41);});});}exports['GetWhatsappQueue']=function(_0x430981){var _0x46ccbd=this;return new Promise(function(_0x40fb79,_0x596ddc){return db[_0xd4e1('0x1c')][_0xd4e1('0x1d')]({'raw':_0x430981[_0xd4e1('0x1e')]?_0x430981[_0xd4e1('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x430981[_0xd4e1('0x1e')]?_0x430981[_0xd4e1('0x1e')]['where']||null:null,'attributes':_0x430981['options']?_0x430981[_0xd4e1('0x1e')][_0xd4e1('0x1f')]||null:null,'limit':_0x430981[_0xd4e1('0x1e')]?_0x430981[_0xd4e1('0x1e')]['limit']||null:null,'include':_0x430981[_0xd4e1('0x1e')]?_0x430981[_0xd4e1('0x1e')]['include']?_[_0xd4e1('0x20')](_0x430981[_0xd4e1('0x1e')][_0xd4e1('0x21')],function(_0x261f9a){return{'model':db[_0x261f9a['model']],'as':_0x261f9a['as'],'attributes':_0x261f9a[_0xd4e1('0x1f')],'include':_0x261f9a[_0xd4e1('0x21')]?_[_0xd4e1('0x20')](_0x261f9a[_0xd4e1('0x21')],function(_0x8c968d){return{'model':db[_0x8c968d[_0xd4e1('0x22')]],'as':_0x8c968d['as'],'attributes':_0x8c968d[_0xd4e1('0x1f')],'include':_0x8c968d[_0xd4e1('0x21')]?_[_0xd4e1('0x20')](_0x8c968d[_0xd4e1('0x21')],function(_0x5078d2){return{'model':db[_0x5078d2[_0xd4e1('0x22')]],'as':_0x5078d2['as'],'attributes':_0x5078d2[_0xd4e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd4e1('0x10')](function(_0x5244b7){logger['info'](_0xd4e1('0x23'),_0x430981);logger['debug'](_0xd4e1('0x23'),_0x430981,JSON['stringify'](_0x5244b7));_0x40fb79(_0x5244b7);})[_0xd4e1('0x1b')](function(_0xc9cb2f){logger[_0xd4e1('0x16')](_0xd4e1('0x23'),_0xc9cb2f[_0xd4e1('0x18')],_0x430981);_0x596ddc(_0x46ccbd[_0xd4e1('0x16')](0x1f4,_0xc9cb2f[_0xd4e1('0x18')]));});});};exports[_0xd4e1('0x24')]=function(_0x462576){var _0x19377a=this;return new Promise(function(_0x1a1599,_0x2f3f8f){return db['WhatsappQueue']['find']({'raw':_0x462576[_0xd4e1('0x1e')]?_0x462576['options']['raw']===undefined?!![]:![]:!![],'where':_0x462576[_0xd4e1('0x1e')]?_0x462576[_0xd4e1('0x1e')]['where']||null:null,'attributes':_0x462576['options']?_0x462576[_0xd4e1('0x1e')][_0xd4e1('0x1f')]||null:null,'include':_0x462576[_0xd4e1('0x1e')]?_0x462576[_0xd4e1('0x1e')]['include']?_[_0xd4e1('0x20')](_0x462576['options']['include'],function(_0x1f9934){return{'model':db[_0x1f9934[_0xd4e1('0x22')]],'as':_0x1f9934['as'],'attributes':_0x1f9934[_0xd4e1('0x1f')],'include':_0x1f9934[_0xd4e1('0x21')]?_[_0xd4e1('0x20')](_0x1f9934[_0xd4e1('0x21')],function(_0x240e2f){return{'model':db[_0x240e2f[_0xd4e1('0x22')]],'as':_0x240e2f['as'],'attributes':_0x240e2f[_0xd4e1('0x1f')],'include':_0x240e2f['include']?_[_0xd4e1('0x20')](_0x240e2f[_0xd4e1('0x21')],function(_0x3818a6){return{'model':db[_0x3818a6[_0xd4e1('0x22')]],'as':_0x3818a6['as'],'attributes':_0x3818a6[_0xd4e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd4e1('0x10')](function(_0x38c494){logger[_0xd4e1('0x19')]('ShowWhatsappQueue',_0x462576);logger['debug']('ShowWhatsappQueue',_0x462576,JSON[_0xd4e1('0x15')](_0x38c494));_0x1a1599(_0x38c494);})[_0xd4e1('0x1b')](function(_0x3a2ebe){logger[_0xd4e1('0x16')](_0xd4e1('0x24'),_0x3a2ebe[_0xd4e1('0x18')],_0x462576);_0x2f3f8f(_0x19377a[_0xd4e1('0x16')](0x1f4,_0x3a2ebe[_0xd4e1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 197ac4d..54e7910 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 _0x74a3=['length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener','register'];(function(_0x5c7b86,_0x361fde){var _0x189239=function(_0x36887c){while(--_0x36887c){_0x5c7b86['push'](_0x5c7b86['shift']());}};_0x189239(++_0x361fde);}(_0x74a3,0x1b2));var _0x374a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x74a3[_0x5b561d];return _0x431060;};'use strict';var WhatsappQueueEvents=require(_0x374a('0x0'));var events=[_0x374a('0x1'),_0x374a('0x2'),'update'];function createListener(_0x17dacf,_0x9689ad){return function(_0x1675b7){_0x9689ad[_0x374a('0x3')](_0x17dacf,_0x1675b7);};}function removeListener(_0x48d0c6,_0x5138f7){return function(){WhatsappQueueEvents[_0x374a('0x4')](_0x48d0c6,_0x5138f7);};}exports[_0x374a('0x5')]=function(_0x3e6b2f){for(var _0x278137=0x0,_0x4de31f=events[_0x374a('0x6')];_0x278137<_0x4de31f;_0x278137++){var _0x4342a1=events[_0x278137];var _0x539474=createListener(_0x374a('0x7')+_0x4342a1,_0x3e6b2f);WhatsappQueueEvents['on'](_0x4342a1,_0x539474);}}; \ No newline at end of file +var _0x824e=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x824e,0x89));var _0xe824=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x824e[_0x16dbcd];return _0x34706e;};'use strict';var WhatsappQueueEvents=require(_0xe824('0x0'));var events=[_0xe824('0x1'),_0xe824('0x2'),_0xe824('0x3')];function createListener(_0x28e55a,_0x32fbb4){return function(_0x2b2a3e){_0x32fbb4[_0xe824('0x4')](_0x28e55a,_0x2b2a3e);};}function removeListener(_0x43e41e,_0x428ba8){return function(){WhatsappQueueEvents[_0xe824('0x5')](_0x43e41e,_0x428ba8);};}exports[_0xe824('0x6')]=function(_0x5d04b9){for(var _0x1cc6d4=0x0,_0x483b8c=events['length'];_0x1cc6d4<_0x483b8c;_0x1cc6d4++){var _0x88080a=events[_0x1cc6d4];var _0x180ea8=createListener(_0xe824('0x7')+_0x88080a,_0x5d04b9);WhatsappQueueEvents['on'](_0x88080a,_0x180ea8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index bedc54e..34df97d 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 _0xba55=['../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba55,0x1f3));var _0x5ba5=function(_0x4b4872,_0x39d6cc){_0x4b4872=_0x4b4872-0x0;var _0x3c5cf2=_0xba55[_0x4b4872];return _0x3c5cf2;};'use strict';var multer=require(_0x5ba5('0x0'));var util=require(_0x5ba5('0x1'));var path=require(_0x5ba5('0x2'));var timeout=require(_0x5ba5('0x3'));var express=require('express');var router=express[_0x5ba5('0x4')]();var auth=require(_0x5ba5('0x5'));var interaction=require(_0x5ba5('0x6'));var config=require(_0x5ba5('0x7'));var controller=require(_0x5ba5('0x8'));router[_0x5ba5('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ba5('0xa')]);router['get'](_0x5ba5('0xb'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0xd')]);router[_0x5ba5('0x9')](_0x5ba5('0xe'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0xf')]);router[_0x5ba5('0x10')]('/',auth['isAuthenticated'](),controller[_0x5ba5('0x11')]);router[_0x5ba5('0x12')]('/:id',auth[_0x5ba5('0xc')](),controller['update']);router[_0x5ba5('0x13')](_0x5ba5('0xe'),auth[_0x5ba5('0xc')](),controller[_0x5ba5('0x14')]);module[_0x5ba5('0x15')]=router; \ No newline at end of file +var _0xd417=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x4905e5,_0x50fbf2){var _0x2f3c0f=function(_0x30374c){while(--_0x30374c){_0x4905e5['push'](_0x4905e5['shift']());}};_0x2f3c0f(++_0x50fbf2);}(_0xd417,0x1eb));var _0x7d41=function(_0x1e215e,_0x3d9ebc){_0x1e215e=_0x1e215e-0x0;var _0x42d10b=_0xd417[_0x1e215e];return _0x42d10b;};'use strict';var multer=require('multer');var util=require(_0x7d41('0x0'));var path=require(_0x7d41('0x1'));var timeout=require(_0x7d41('0x2'));var express=require(_0x7d41('0x3'));var router=express[_0x7d41('0x4')]();var auth=require(_0x7d41('0x5'));var interaction=require(_0x7d41('0x6'));var config=require(_0x7d41('0x7'));var controller=require(_0x7d41('0x8'));router['get']('/',auth[_0x7d41('0x9')](),controller[_0x7d41('0xa')]);router[_0x7d41('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7d41('0xc')]);router[_0x7d41('0xb')](_0x7d41('0xd'),auth[_0x7d41('0x9')](),controller[_0x7d41('0xe')]);router[_0x7d41('0xf')]('/',auth[_0x7d41('0x9')](),controller[_0x7d41('0x10')]);router[_0x7d41('0x11')]('/:id',auth[_0x7d41('0x9')](),controller[_0x7d41('0x12')]);router[_0x7d41('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7d41('0x14')]);module[_0x7d41('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 746fafe..9844608 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 _0x4b84=['sequelize','exports','DATE','STRING'];(function(_0x172fe8,_0x21c72e){var _0x3ef86e=function(_0x162607){while(--_0x162607){_0x172fe8['push'](_0x172fe8['shift']());}};_0x3ef86e(++_0x21c72e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x4b84[_0x19ac6e];return _0x1cdcf3;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44b8('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x44b8('0x2')]},'reason':{'type':Sequelize[_0x44b8('0x3')]}}; \ No newline at end of file +var _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0xf3cd[_0x401a4d];return _0x1faaff;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a742014..8dcb7ab 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 _0x7bd0=['update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save'];(function(_0x3b9c6e,_0x3d7e9a){var _0x3db00b=function(_0x4c4671){while(--_0x4c4671){_0x3b9c6e['push'](_0x3b9c6e['shift']());}};_0x3db00b(++_0x3d7e9a);}(_0x7bd0,0x111));var _0x07bd=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0x7bd0[_0x149a9b];return _0x2c2bf6;};'use strict';var pdf=require(_0x07bd('0x0'));var emlformat=require(_0x07bd('0x1'));var rimraf=require(_0x07bd('0x2'));var zipdir=require(_0x07bd('0x3'));var jsonpatch=require(_0x07bd('0x4'));var rp=require(_0x07bd('0x5'));var moment=require(_0x07bd('0x6'));var BPromise=require(_0x07bd('0x7'));var Mustache=require('mustache');var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require(_0x07bd('0xc'));var fs=require('fs');var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];function respondWithStatusCode(_0x456ecd,_0x1eff6c){_0x1eff6c=_0x1eff6c||0xcc;return function(_0x10aa2e){if(_0x10aa2e){return _0x456ecd[_0x07bd('0x1a')](_0x1eff6c);}return _0x456ecd['status'](_0x1eff6c)['end']();};}function respondWithResult(_0x2ca1bc,_0x3fe523){_0x3fe523=_0x3fe523||0xc8;return function(_0x1c59c2){if(_0x1c59c2){return _0x2ca1bc[_0x07bd('0x1b')](_0x3fe523)[_0x07bd('0x1c')](_0x1c59c2);}};}function respondWithFilteredResult(_0x2406b0,_0x2c9166){return function(_0x49d962){if(_0x49d962){var _0x418444=_0x49d962[_0x07bd('0x1d')],_0x505839=_0x2c9166[_0x07bd('0x1e')],_0x229bf1=_0x2c9166[_0x07bd('0x1e')]+_0x2c9166['limit'],_0x2dd97b;if(_0x229bf1>=_0x418444){_0x229bf1=_0x418444;_0x2dd97b=0xc8;}else{_0x2dd97b=0xce;}_0x2406b0[_0x07bd('0x1b')](_0x2dd97b);return _0x2406b0[_0x07bd('0x1f')]('Content-Range',_0x505839+'-'+_0x229bf1+'/'+_0x418444)[_0x07bd('0x1c')](_0x49d962);}return null;};}function patchUpdates(_0x72f775){return function(_0x758fd5){try{jsonpatch[_0x07bd('0x20')](_0x758fd5,_0x72f775,!![]);}catch(_0x36ccec){return BPromise[_0x07bd('0x21')](_0x36ccec);}return _0x758fd5[_0x07bd('0x22')]();};}function saveUpdates(_0x1a65ff,_0x29a52e){return function(_0x50109f){if(_0x50109f){return _0x50109f[_0x07bd('0x23')](_0x1a65ff)[_0x07bd('0x24')](function(_0xcb8b23){return _0xcb8b23;});}return null;};}function removeEntity(_0x11684d,_0x16d0e6){return function(_0x47bd50){if(_0x47bd50){return _0x47bd50['destroy']()[_0x07bd('0x24')](function(){_0x11684d['status'](0xcc)[_0x07bd('0x25')]();});}};}function handleEntityNotFound(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(!_0x4165bc){_0x480c9c[_0x07bd('0x1a')](0x194);}return _0x4165bc;};}function handleError(_0xf3b23c,_0xdb47ba){_0xdb47ba=_0xdb47ba||0x1f4;return function(_0x28bd91){logger[_0x07bd('0x26')](_0x28bd91['stack']);if(_0x28bd91[_0x07bd('0x27')]){delete _0x28bd91[_0x07bd('0x27')];}_0xf3b23c[_0x07bd('0x1b')](_0xdb47ba)[_0x07bd('0x28')](_0x28bd91);};}exports[_0x07bd('0x29')]=function(_0x1c1fda,_0x571dab){var _0x56687f={},_0x5184dc={},_0x335d61={'count':0x0,'rows':[]};var _0xfa7566=_[_0x07bd('0x2a')](db['WhatsappQueueReport'][_0x07bd('0x2b')],function(_0x400cc0){return{'name':_0x400cc0[_0x07bd('0x2c')],'type':_0x400cc0[_0x07bd('0x2d')][_0x07bd('0x2e')]};});_0x5184dc[_0x07bd('0x2f')]=_['map'](_0xfa7566,_0x07bd('0x27'));_0x5184dc[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x1c1fda[_0x07bd('0x30')]);_0x5184dc[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x5184dc[_0x07bd('0x2f')],_0x5184dc[_0x07bd('0x30')]);_0x56687f['attributes']=_['intersection'](_0x5184dc[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x1c1fda[_0x07bd('0x30')]['fields']));_0x56687f[_0x07bd('0x35')]=_0x56687f[_0x07bd('0x35')][_0x07bd('0x36')]?_0x56687f['attributes']:_0x5184dc['model'];if(!_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x37')](_0x07bd('0x38'))){_0x56687f[_0x07bd('0x39')]=qs['limit'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x39')]);_0x56687f[_0x07bd('0x1e')]=qs['offset'](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x1e')]);}_0x56687f['order']=qs[_0x07bd('0x3a')](_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3a')]);_0x56687f[_0x07bd('0x3b')]=qs['filters'](_['pick'](_0x1c1fda[_0x07bd('0x30')],_0x5184dc['filters']),_0xfa7566);if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]){_0x56687f[_0x07bd('0x3b')]=_[_0x07bd('0x3d')](_0x56687f[_0x07bd('0x3b')],{'$or':_[_0x07bd('0x2a')](_0xfa7566,function(_0x3e63b3){if(_0x3e63b3[_0x07bd('0x2d')]!==_0x07bd('0x3e')){var _0x27b563={};_0x27b563[_0x3e63b3[_0x07bd('0x27')]]={'$like':'%'+_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x3c')]+'%'};return _0x27b563;}})});}_0x56687f=_['merge']({},_0x56687f,_0x1c1fda[_0x07bd('0x3f')]);var _0x2799c6={'where':_0x56687f[_0x07bd('0x3b')]};return db[_0x07bd('0x40')]['count'](_0x2799c6)[_0x07bd('0x24')](function(_0xa36d6b){_0x335d61[_0x07bd('0x1d')]=_0xa36d6b;if(_0x1c1fda[_0x07bd('0x30')][_0x07bd('0x41')]){_0x56687f['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x07bd('0x42')](_0x56687f);})[_0x07bd('0x24')](function(_0x17c3df){_0x335d61[_0x07bd('0x43')]=_0x17c3df;return _0x335d61;})['then'](respondWithFilteredResult(_0x571dab,_0x56687f))[_0x07bd('0x44')](handleError(_0x571dab,null));};exports[_0x07bd('0x45')]=function(_0x3de7d3,_0x6cdf23){var _0x318b7c={'raw':!![],'where':{'id':_0x3de7d3[_0x07bd('0x46')]['id']}},_0x2a08e3={};_0x2a08e3['model']=_[_0x07bd('0x31')](db[_0x07bd('0x40')][_0x07bd('0x2b')]);_0x2a08e3[_0x07bd('0x30')]=_[_0x07bd('0x31')](_0x3de7d3['query']);_0x2a08e3[_0x07bd('0x32')]=_[_0x07bd('0x33')](_0x2a08e3[_0x07bd('0x2f')],_0x2a08e3[_0x07bd('0x30')]);_0x318b7c[_0x07bd('0x35')]=_['intersection'](_0x2a08e3[_0x07bd('0x2f')],qs[_0x07bd('0x34')](_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x34')]));_0x318b7c['attributes']=_0x318b7c['attributes'][_0x07bd('0x36')]?_0x318b7c[_0x07bd('0x35')]:_0x2a08e3[_0x07bd('0x2f')];if(_0x3de7d3[_0x07bd('0x30')][_0x07bd('0x41')]){_0x318b7c[_0x07bd('0x47')]=[{'all':!![]}];}_0x318b7c=_[_0x07bd('0x3d')]({},_0x318b7c,_0x3de7d3[_0x07bd('0x3f')]);return db[_0x07bd('0x40')]['find'](_0x318b7c)['then'](handleEntityNotFound(_0x6cdf23,null))[_0x07bd('0x24')](respondWithResult(_0x6cdf23,null))[_0x07bd('0x44')](handleError(_0x6cdf23,null));};exports[_0x07bd('0x48')]=function(_0xaa85c5,_0x44274b){return db[_0x07bd('0x40')]['create'](_0xaa85c5[_0x07bd('0x49')],{})[_0x07bd('0x24')](respondWithResult(_0x44274b,0xc9))[_0x07bd('0x44')](handleError(_0x44274b,null));};exports[_0x07bd('0x23')]=function(_0x7755e2,_0x4155df){if(_0x7755e2['body']['id']){delete _0x7755e2[_0x07bd('0x49')]['id'];}return db[_0x07bd('0x40')][_0x07bd('0x4a')]({'where':{'id':_0x7755e2[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x4155df,null))[_0x07bd('0x24')](saveUpdates(_0x7755e2[_0x07bd('0x49')],null))[_0x07bd('0x24')](respondWithResult(_0x4155df,null))[_0x07bd('0x44')](handleError(_0x4155df,null));};exports[_0x07bd('0x4b')]=function(_0x1ee56f,_0x2fa62e){return db['WhatsappQueueReport'][_0x07bd('0x4a')]({'where':{'id':_0x1ee56f[_0x07bd('0x46')]['id']}})[_0x07bd('0x24')](handleEntityNotFound(_0x2fa62e,null))['then'](removeEntity(_0x2fa62e,null))['catch'](handleError(_0x2fa62e,null));};exports[_0x07bd('0x4c')]=function(_0x560f06,_0x3d15b1){return db[_0x07bd('0x40')][_0x07bd('0x4c')]()[_0x07bd('0x24')](respondWithResult(_0x3d15b1,null))[_0x07bd('0x44')](handleError(_0x3d15b1,null));}; \ No newline at end of file +var _0x4f98=['length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','create','body','update','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','end','error','stack','name','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x1b29f1,_0x141885){var _0x155bd6=function(_0x2d344f){while(--_0x2d344f){_0x1b29f1['push'](_0x1b29f1['shift']());}};_0x155bd6(++_0x141885);}(_0x4f98,0x196));var _0x84f9=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x4f98[_0x7791d5];return _0x5ce288;};'use strict';var pdf=require(_0x84f9('0x0'));var emlformat=require(_0x84f9('0x1'));var rimraf=require(_0x84f9('0x2'));var zipdir=require(_0x84f9('0x3'));var jsonpatch=require(_0x84f9('0x4'));var rp=require(_0x84f9('0x5'));var moment=require(_0x84f9('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x84f9('0x7'));var util=require(_0x84f9('0x8'));var path=require(_0x84f9('0x9'));var sox=require(_0x84f9('0xa'));var csv=require('to-csv');var ejs=require(_0x84f9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x84f9('0xc'));var jsforce=require(_0x84f9('0xd'));var deskjs=require(_0x84f9('0xe'));var toCsv=require(_0x84f9('0xf'));var querystring=require(_0x84f9('0x10'));var Papa=require(_0x84f9('0x11'));var Redis=require(_0x84f9('0x12'));var authService=require(_0x84f9('0x13'));var qs=require(_0x84f9('0x14'));var as=require(_0x84f9('0x15'));var hardwareService=require(_0x84f9('0x16'));var logger=require(_0x84f9('0x17'))('api');var utils=require(_0x84f9('0x18'));var config=require(_0x84f9('0x19'));var db=require(_0x84f9('0x1a'))['db'];function respondWithStatusCode(_0x300e73,_0x2a5c9c){_0x2a5c9c=_0x2a5c9c||0xcc;return function(_0x4a9bde){if(_0x4a9bde){return _0x300e73[_0x84f9('0x1b')](_0x2a5c9c);}return _0x300e73[_0x84f9('0x1c')](_0x2a5c9c)['end']();};}function respondWithResult(_0x32047f,_0x5a7201){_0x5a7201=_0x5a7201||0xc8;return function(_0x204bc){if(_0x204bc){return _0x32047f[_0x84f9('0x1c')](_0x5a7201)['json'](_0x204bc);}};}function respondWithFilteredResult(_0x557532,_0x3b6339){return function(_0x4b2a3b){if(_0x4b2a3b){var _0x51af69=_0x4b2a3b[_0x84f9('0x1d')],_0x12b257=_0x3b6339[_0x84f9('0x1e')],_0xd59949=_0x3b6339[_0x84f9('0x1e')]+_0x3b6339[_0x84f9('0x1f')],_0x5dea57;if(_0xd59949>=_0x51af69){_0xd59949=_0x51af69;_0x5dea57=0xc8;}else{_0x5dea57=0xce;}_0x557532[_0x84f9('0x1c')](_0x5dea57);return _0x557532[_0x84f9('0x20')](_0x84f9('0x21'),_0x12b257+'-'+_0xd59949+'/'+_0x51af69)[_0x84f9('0x22')](_0x4b2a3b);}return null;};}function patchUpdates(_0x5eb27c){return function(_0x3f806d){try{jsonpatch[_0x84f9('0x23')](_0x3f806d,_0x5eb27c,!![]);}catch(_0x4c899b){return BPromise[_0x84f9('0x24')](_0x4c899b);}return _0x3f806d[_0x84f9('0x25')]();};}function saveUpdates(_0x3667de,_0x21b779){return function(_0x3db3d8){if(_0x3db3d8){return _0x3db3d8['update'](_0x3667de)[_0x84f9('0x26')](function(_0xbf095f){return _0xbf095f;});}return null;};}function removeEntity(_0x1725d1,_0x5c54b5){return function(_0x991be4){if(_0x991be4){return _0x991be4['destroy']()[_0x84f9('0x26')](function(){_0x1725d1[_0x84f9('0x1c')](0xcc)[_0x84f9('0x27')]();});}};}function handleEntityNotFound(_0x34fa2d,_0x31a38f){return function(_0x1c4465){if(!_0x1c4465){_0x34fa2d['sendStatus'](0x194);}return _0x1c4465;};}function handleError(_0x4958f8,_0x343dfd){_0x343dfd=_0x343dfd||0x1f4;return function(_0x505d06){logger[_0x84f9('0x28')](_0x505d06[_0x84f9('0x29')]);if(_0x505d06[_0x84f9('0x2a')]){delete _0x505d06[_0x84f9('0x2a')];}_0x4958f8[_0x84f9('0x1c')](_0x343dfd)['send'](_0x505d06);};}exports[_0x84f9('0x2b')]=function(_0x4d6404,_0x2be7b2){var _0x4c6ca7={},_0x5c0542={},_0x3242d2={'count':0x0,'rows':[]};var _0x39463e=_['map'](db[_0x84f9('0x2c')][_0x84f9('0x2d')],function(_0x14f749){return{'name':_0x14f749[_0x84f9('0x2e')],'type':_0x14f749[_0x84f9('0x2f')][_0x84f9('0x30')]};});_0x5c0542[_0x84f9('0x31')]=_['map'](_0x39463e,'name');_0x5c0542['query']=_[_0x84f9('0x32')](_0x4d6404[_0x84f9('0x33')]);_0x5c0542[_0x84f9('0x34')]=_[_0x84f9('0x35')](_0x5c0542[_0x84f9('0x31')],_0x5c0542[_0x84f9('0x33')]);_0x4c6ca7[_0x84f9('0x36')]=_[_0x84f9('0x35')](_0x5c0542[_0x84f9('0x31')],qs[_0x84f9('0x37')](_0x4d6404[_0x84f9('0x33')][_0x84f9('0x37')]));_0x4c6ca7[_0x84f9('0x36')]=_0x4c6ca7[_0x84f9('0x36')][_0x84f9('0x38')]?_0x4c6ca7['attributes']:_0x5c0542[_0x84f9('0x31')];if(!_0x4d6404[_0x84f9('0x33')]['hasOwnProperty'](_0x84f9('0x39'))){_0x4c6ca7[_0x84f9('0x1f')]=qs[_0x84f9('0x1f')](_0x4d6404['query']['limit']);_0x4c6ca7[_0x84f9('0x1e')]=qs[_0x84f9('0x1e')](_0x4d6404[_0x84f9('0x33')][_0x84f9('0x1e')]);}_0x4c6ca7[_0x84f9('0x3a')]=qs['sort'](_0x4d6404[_0x84f9('0x33')][_0x84f9('0x3b')]);_0x4c6ca7['where']=qs[_0x84f9('0x34')](_[_0x84f9('0x3c')](_0x4d6404[_0x84f9('0x33')],_0x5c0542[_0x84f9('0x34')]),_0x39463e);if(_0x4d6404[_0x84f9('0x33')]['filter']){_0x4c6ca7[_0x84f9('0x3d')]=_[_0x84f9('0x3e')](_0x4c6ca7[_0x84f9('0x3d')],{'$or':_['map'](_0x39463e,function(_0x3867a0){if(_0x3867a0[_0x84f9('0x2f')]!==_0x84f9('0x3f')){var _0x7b1ab={};_0x7b1ab[_0x3867a0[_0x84f9('0x2a')]]={'$like':'%'+_0x4d6404[_0x84f9('0x33')]['filter']+'%'};return _0x7b1ab;}})});}_0x4c6ca7=_['merge']({},_0x4c6ca7,_0x4d6404[_0x84f9('0x40')]);var _0x162a51={'where':_0x4c6ca7[_0x84f9('0x3d')]};return db[_0x84f9('0x2c')][_0x84f9('0x1d')](_0x162a51)[_0x84f9('0x26')](function(_0x5d022f){_0x3242d2[_0x84f9('0x1d')]=_0x5d022f;if(_0x4d6404[_0x84f9('0x33')]['includeAll']){_0x4c6ca7[_0x84f9('0x41')]=[{'all':!![]}];}return db[_0x84f9('0x2c')][_0x84f9('0x42')](_0x4c6ca7);})[_0x84f9('0x26')](function(_0x574f98){_0x3242d2['rows']=_0x574f98;return _0x3242d2;})[_0x84f9('0x26')](respondWithFilteredResult(_0x2be7b2,_0x4c6ca7))[_0x84f9('0x43')](handleError(_0x2be7b2,null));};exports[_0x84f9('0x44')]=function(_0x5c9106,_0x5306f4){var _0x120ed8={'raw':!![],'where':{'id':_0x5c9106['params']['id']}},_0x10866e={};_0x10866e['model']=_[_0x84f9('0x32')](db['WhatsappQueueReport'][_0x84f9('0x2d')]);_0x10866e[_0x84f9('0x33')]=_['keys'](_0x5c9106[_0x84f9('0x33')]);_0x10866e[_0x84f9('0x34')]=_[_0x84f9('0x35')](_0x10866e[_0x84f9('0x31')],_0x10866e['query']);_0x120ed8['attributes']=_[_0x84f9('0x35')](_0x10866e['model'],qs[_0x84f9('0x37')](_0x5c9106[_0x84f9('0x33')][_0x84f9('0x37')]));_0x120ed8[_0x84f9('0x36')]=_0x120ed8[_0x84f9('0x36')][_0x84f9('0x38')]?_0x120ed8[_0x84f9('0x36')]:_0x10866e['model'];if(_0x5c9106[_0x84f9('0x33')][_0x84f9('0x45')]){_0x120ed8[_0x84f9('0x41')]=[{'all':!![]}];}_0x120ed8=_[_0x84f9('0x3e')]({},_0x120ed8,_0x5c9106[_0x84f9('0x40')]);return db[_0x84f9('0x2c')]['find'](_0x120ed8)['then'](handleEntityNotFound(_0x5306f4,null))['then'](respondWithResult(_0x5306f4,null))[_0x84f9('0x43')](handleError(_0x5306f4,null));};exports[_0x84f9('0x46')]=function(_0x55c30c,_0x8768fd){return db[_0x84f9('0x2c')][_0x84f9('0x46')](_0x55c30c[_0x84f9('0x47')],{})['then'](respondWithResult(_0x8768fd,0xc9))[_0x84f9('0x43')](handleError(_0x8768fd,null));};exports[_0x84f9('0x48')]=function(_0x54b537,_0x4700af){if(_0x54b537['body']['id']){delete _0x54b537[_0x84f9('0x47')]['id'];}return db[_0x84f9('0x2c')][_0x84f9('0x49')]({'where':{'id':_0x54b537[_0x84f9('0x4a')]['id']}})[_0x84f9('0x26')](handleEntityNotFound(_0x4700af,null))[_0x84f9('0x26')](saveUpdates(_0x54b537[_0x84f9('0x47')],null))['then'](respondWithResult(_0x4700af,null))[_0x84f9('0x43')](handleError(_0x4700af,null));};exports[_0x84f9('0x4b')]=function(_0x1ba3f0,_0x519ffc){return db[_0x84f9('0x2c')][_0x84f9('0x49')]({'where':{'id':_0x1ba3f0[_0x84f9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x519ffc,null))[_0x84f9('0x26')](removeEntity(_0x519ffc,null))['catch'](handleError(_0x519ffc,null));};exports[_0x84f9('0x4c')]=function(_0x1b8612,_0x59906b){return db['WhatsappQueueReport']['describe']()[_0x84f9('0x26')](respondWithResult(_0x59906b,null))['catch'](handleError(_0x59906b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f6f86f7..03206dc 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 _0x25e4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','api'];(function(_0x221461,_0x57d49f){var _0x14b589=function(_0x2cf220){while(--_0x2cf220){_0x221461['push'](_0x221461['shift']());}};_0x14b589(++_0x57d49f);}(_0x25e4,0xe8));var _0x425e=function(_0x4f8db6,_0x33b819){_0x4f8db6=_0x4f8db6-0x0;var _0x1d4a1c=_0x25e4[_0x4f8db6];return _0x1d4a1c;};'use strict';var _=require(_0x425e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x425e('0x1'));var moment=require(_0x425e('0x2'));var BPromise=require(_0x425e('0x3'));var rp=require(_0x425e('0x4'));var fs=require('fs');var path=require(_0x425e('0x5'));var rimraf=require(_0x425e('0x6'));var config=require(_0x425e('0x7'));var attributes=require(_0x425e('0x8'));module[_0x425e('0x9')]=function(_0x25b532,_0xcf1e78){return _0x25b532[_0x425e('0xa')](_0x425e('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x425e('0xc'),'fields':[_0x425e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6204=['rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x6204,0x10e));var _0x4620=function(_0x1ee833,_0x123b1a){_0x1ee833=_0x1ee833-0x0;var _0xe675b8=_0x6204[_0x1ee833];return _0xe675b8;};'use strict';var _=require(_0x4620('0x0'));var util=require(_0x4620('0x1'));var logger=require(_0x4620('0x2'))(_0x4620('0x3'));var moment=require(_0x4620('0x4'));var BPromise=require('bluebird');var rp=require(_0x4620('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4620('0x6'));var config=require(_0x4620('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x45318d,_0x1f8f5d){return _0x45318d[_0x4620('0x8')](_0x4620('0x9'),attributes,{'tableName':_0x4620('0xa'),'paranoid':![],'indexes':[{'name':_0x4620('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7e6d305..0d8d054 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 _0x4325=['limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','WhatsappQueueReport','body','options','raw','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where'];(function(_0x3afe3c,_0x5b85b5){var _0x970cac=function(_0x35b4db){while(--_0x35b4db){_0x3afe3c['push'](_0x3afe3c['shift']());}};_0x970cac(++_0x5b85b5);}(_0x4325,0x177));var _0x5432=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4325[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require(_0x5432('0x2'));var BPromise=require(_0x5432('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require(_0x5432('0x5'))['db'];var utils=require(_0x5432('0x6'));var logger=require(_0x5432('0x7'))(_0x5432('0x8'));var config=require(_0x5432('0x9'));var jayson=require(_0x5432('0xa'));var client=jayson[_0x5432('0xb')][_0x5432('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28d667,_0x31316f,_0x4aebde){return new BPromise(function(_0x12a0d0,_0x3b82bd){return client[_0x5432('0xd')](_0x28d667,_0x4aebde)['then'](function(_0x2d5db2){logger[_0x5432('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31316f,_0x5432('0xf'));logger[_0x5432('0x10')](_0x5432('0x11'),_0x31316f,_0x5432('0xf'),JSON[_0x5432('0x12')](_0x2d5db2));if(_0x2d5db2[_0x5432('0x13')]){if(_0x2d5db2[_0x5432('0x13')][_0x5432('0x14')]===0x1f4){logger[_0x5432('0x13')](_0x5432('0x15'),_0x31316f,_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);return _0x3b82bd(_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);}logger[_0x5432('0x13')](_0x5432('0x15'),_0x31316f,_0x2d5db2['error'][_0x5432('0x16')]);return _0x12a0d0(_0x2d5db2[_0x5432('0x13')][_0x5432('0x16')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x31316f,'request\x20sent');_0x12a0d0(_0x2d5db2['result'][_0x5432('0x16')]);}})[_0x5432('0x17')](function(_0x5ec9ac){logger['error'](_0x5432('0x15'),_0x31316f,_0x5ec9ac);_0x3b82bd(_0x5ec9ac);});});}exports['CreateWhatsappQueueReport']=function(_0x4e415e){var _0x380646=this;return new Promise(function(_0x164eab,_0x251fae){return db[_0x5432('0x18')]['create'](_0x4e415e[_0x5432('0x19')],{'raw':_0x4e415e[_0x5432('0x1a')]?_0x4e415e[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![]})[_0x5432('0x1c')](function(_0x4a8bf3){logger[_0x5432('0xe')](_0x5432('0x1d'),_0x4e415e);logger['debug']('CreateWhatsappQueueReport',_0x4e415e,JSON['stringify'](_0x4a8bf3));_0x164eab(_0x4a8bf3);})[_0x5432('0x17')](function(_0x18b24a){logger[_0x5432('0x13')]('CreateWhatsappQueueReport',_0x18b24a['message'],_0x4e415e);_0x251fae(_0x380646[_0x5432('0x13')](0x1f4,_0x18b24a[_0x5432('0x16')]));});});};exports[_0x5432('0x1e')]=function(_0x59ea2e){var _0x189733=this;return new Promise(function(_0x4274f7,_0x3c8ff1){return db['WhatsappQueueReport'][_0x5432('0x1f')](_0x59ea2e[_0x5432('0x19')],{'raw':_0x59ea2e['options']?_0x59ea2e[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ea2e['options']?_0x59ea2e['options'][_0x5432('0x20')]||null:null,'attributes':_0x59ea2e['options']?_0x59ea2e['options']['attributes']||null:null,'limit':_0x59ea2e[_0x5432('0x1a')]?_0x59ea2e[_0x5432('0x1a')][_0x5432('0x21')]||null:null})[_0x5432('0x1c')](function(_0x52a322){logger[_0x5432('0xe')](_0x5432('0x1e'),_0x59ea2e);logger[_0x5432('0x10')](_0x5432('0x1e'),_0x59ea2e,JSON[_0x5432('0x12')](_0x52a322));_0x4274f7(_0x52a322);})[_0x5432('0x17')](function(_0x47d053){logger[_0x5432('0x13')](_0x5432('0x1e'),_0x47d053[_0x5432('0x16')],_0x59ea2e);_0x3c8ff1(_0x189733[_0x5432('0x13')](0x1f4,_0x47d053[_0x5432('0x16')]));});});}; \ No newline at end of file +var _0x1531=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','then','UpdateWhatsappQueueReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x21e9be,_0x145bbd){var _0x57797b=function(_0x1cf572){while(--_0x1cf572){_0x21e9be['push'](_0x21e9be['shift']());}};_0x57797b(++_0x145bbd);}(_0x1531,0x19f));var _0x1153=function(_0x1a64c2,_0x5a0803){_0x1a64c2=_0x1a64c2-0x0;var _0x3d3d3d=_0x1531[_0x1a64c2];return _0x3d3d3d;};'use strict';var _=require(_0x1153('0x0'));var util=require(_0x1153('0x1'));var moment=require(_0x1153('0x2'));var BPromise=require(_0x1153('0x3'));var rs=require(_0x1153('0x4'));var fs=require('fs');var Redis=require(_0x1153('0x5'));var db=require(_0x1153('0x6'))['db'];var utils=require(_0x1153('0x7'));var logger=require('../../config/logger')(_0x1153('0x8'));var config=require(_0x1153('0x9'));var jayson=require(_0x1153('0xa'));var client=jayson[_0x1153('0xb')][_0x1153('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x463b2b,_0x4d3b88,_0x4e074c){return new BPromise(function(_0x24e6de,_0x1118b1){return client['request'](_0x463b2b,_0x4e074c)['then'](function(_0xcc02cc){logger['info'](_0x1153('0xd'),_0x4d3b88,_0x1153('0xe'));logger[_0x1153('0xf')](_0x1153('0x10'),_0x4d3b88,'request\x20sent',JSON[_0x1153('0x11')](_0xcc02cc));if(_0xcc02cc[_0x1153('0x12')]){if(_0xcc02cc[_0x1153('0x12')]['code']===0x1f4){logger[_0x1153('0x12')](_0x1153('0xd'),_0x4d3b88,_0xcc02cc[_0x1153('0x12')][_0x1153('0x13')]);return _0x1118b1(_0xcc02cc['error'][_0x1153('0x13')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4d3b88,_0xcc02cc[_0x1153('0x12')]['message']);return _0x24e6de(_0xcc02cc[_0x1153('0x12')][_0x1153('0x13')]);}else{logger[_0x1153('0x14')](_0x1153('0xd'),_0x4d3b88,_0x1153('0xe'));_0x24e6de(_0xcc02cc[_0x1153('0x15')][_0x1153('0x13')]);}})[_0x1153('0x16')](function(_0x47c68e){logger[_0x1153('0x12')](_0x1153('0xd'),_0x4d3b88,_0x47c68e);_0x1118b1(_0x47c68e);});});}exports[_0x1153('0x17')]=function(_0x51f556){var _0x31689b=this;return new Promise(function(_0x18a607,_0x153a2d){return db[_0x1153('0x18')][_0x1153('0x19')](_0x51f556[_0x1153('0x1a')],{'raw':_0x51f556['options']?_0x51f556['options'][_0x1153('0x1b')]===undefined?!![]:![]:!![]})[_0x1153('0x1c')](function(_0x4efc9a){logger['info'](_0x1153('0x17'),_0x51f556);logger[_0x1153('0xf')](_0x1153('0x17'),_0x51f556,JSON[_0x1153('0x11')](_0x4efc9a));_0x18a607(_0x4efc9a);})['catch'](function(_0x42589d){logger[_0x1153('0x12')](_0x1153('0x17'),_0x42589d[_0x1153('0x13')],_0x51f556);_0x153a2d(_0x31689b['error'](0x1f4,_0x42589d[_0x1153('0x13')]));});});};exports[_0x1153('0x1d')]=function(_0x5c4d3f){var _0x459b82=this;return new Promise(function(_0x2ac1c6,_0x511bfc){return db['WhatsappQueueReport'][_0x1153('0x1e')](_0x5c4d3f['body'],{'raw':_0x5c4d3f[_0x1153('0x1f')]?_0x5c4d3f[_0x1153('0x1f')][_0x1153('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c4d3f[_0x1153('0x1f')]?_0x5c4d3f[_0x1153('0x1f')][_0x1153('0x20')]||null:null,'attributes':_0x5c4d3f[_0x1153('0x1f')]?_0x5c4d3f[_0x1153('0x1f')][_0x1153('0x21')]||null:null,'limit':_0x5c4d3f['options']?_0x5c4d3f[_0x1153('0x1f')][_0x1153('0x22')]||null:null})[_0x1153('0x1c')](function(_0x2e3545){logger[_0x1153('0x14')](_0x1153('0x1d'),_0x5c4d3f);logger['debug'](_0x1153('0x1d'),_0x5c4d3f,JSON[_0x1153('0x11')](_0x2e3545));_0x2ac1c6(_0x2e3545);})['catch'](function(_0x40862f){logger['error'](_0x1153('0x1d'),_0x40862f[_0x1153('0x13')],_0x5c4d3f);_0x511bfc(_0x459b82[_0x1153('0x12')](0x1f4,_0x40862f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a76dc79..161006d 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 _0x614e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5e292d,_0x1e1d24){var _0x2bbc9d=function(_0xfb0817){while(--_0xfb0817){_0x5e292d['push'](_0x5e292d['shift']());}};_0x2bbc9d(++_0x1e1d24);}(_0x614e,0x19d));var _0xe614=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x614e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe614('0x0'));var util=require(_0xe614('0x1'));var path=require(_0xe614('0x2'));var timeout=require(_0xe614('0x3'));var express=require(_0xe614('0x4'));var router=express[_0xe614('0x5')]();var auth=require(_0xe614('0x6'));var interaction=require(_0xe614('0x7'));var config=require(_0xe614('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xe614('0x9')](),controller[_0xe614('0xa')]);router[_0xe614('0xb')](_0xe614('0xc'),auth['isAuthenticated'](),controller[_0xe614('0xd')]);router['get'](_0xe614('0xe'),auth[_0xe614('0x9')](),controller[_0xe614('0xf')]);router[_0xe614('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe614('0x11')]('/:id',auth[_0xe614('0x9')](),controller[_0xe614('0x12')]);router[_0xe614('0x13')](_0xe614('0xe'),auth[_0xe614('0x9')](),controller[_0xe614('0x14')]);module[_0xe614('0x15')]=router; \ No newline at end of file +var _0xd54b=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','describe','show','create','put','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd54b,0x1e3));var _0xbd54=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd54b[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xbd54('0x0'));var util=require(_0xbd54('0x1'));var path=require(_0xbd54('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd54('0x3'));var router=express[_0xbd54('0x4')]();var auth=require(_0xbd54('0x5'));var interaction=require(_0xbd54('0x6'));var config=require(_0xbd54('0x7'));var controller=require(_0xbd54('0x8'));router[_0xbd54('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbd54('0x9')](_0xbd54('0xa'),auth[_0xbd54('0xb')](),controller[_0xbd54('0xc')]);router[_0xbd54('0x9')]('/:id',auth[_0xbd54('0xb')](),controller[_0xbd54('0xd')]);router['post']('/',auth[_0xbd54('0xb')](),controller[_0xbd54('0xe')]);router[_0xbd54('0xf')](_0xbd54('0x10'),auth[_0xbd54('0xb')](),controller[_0xbd54('0x11')]);router[_0xbd54('0x12')](_0xbd54('0x10'),auth[_0xbd54('0xb')](),controller[_0xbd54('0x13')]);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 5c9b97e..b8fe7a4 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb10b,0x12a));var _0xbb10=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xb10b[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x757a=['queue','DATE','exports','STRING'];(function(_0x47643e,_0x337374){var _0x2aa5db=function(_0x5dcbf2){while(--_0x5dcbf2){_0x47643e['push'](_0x47643e['shift']());}};_0x2aa5db(++_0x337374);}(_0x757a,0xde));var _0xa757=function(_0x4a0295,_0x550baa){_0x4a0295=_0x4a0295-0x0;var _0x4042a9=_0x757a[_0x4a0295];return _0x4042a9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f6bc403..7ff95c3 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 _0xc38c=['options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','VIRTUAL','filter','merge','where','WhatsappTransferReport','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll'];(function(_0x24fb13,_0x15a28d){var _0x1b383e=function(_0x325e3e){while(--_0x325e3e){_0x24fb13['push'](_0x24fb13['shift']());}};_0x1b383e(++_0x15a28d);}(_0xc38c,0x135));var _0xcc38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc38c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xcc38('0x0'));var emlformat=require(_0xcc38('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc38('0x2'));var jsonpatch=require(_0xcc38('0x3'));var rp=require(_0xcc38('0x4'));var moment=require(_0xcc38('0x5'));var BPromise=require(_0xcc38('0x6'));var Mustache=require(_0xcc38('0x7'));var util=require(_0xcc38('0x8'));var path=require('path');var sox=require(_0xcc38('0x9'));var csv=require(_0xcc38('0xa'));var ejs=require(_0xcc38('0xb'));var fs=require('fs');var _=require(_0xcc38('0xc'));var squel=require(_0xcc38('0xd'));var crypto=require(_0xcc38('0xe'));var jsforce=require(_0xcc38('0xf'));var deskjs=require(_0xcc38('0x10'));var toCsv=require(_0xcc38('0xa'));var querystring=require(_0xcc38('0x11'));var Papa=require('papaparse');var Redis=require(_0xcc38('0x12'));var authService=require(_0xcc38('0x13'));var qs=require(_0xcc38('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc38('0x15'))(_0xcc38('0x16'));var utils=require(_0xcc38('0x17'));var config=require(_0xcc38('0x18'));var db=require(_0xcc38('0x19'))['db'];function respondWithStatusCode(_0x4dfad0,_0x4c47b2){_0x4c47b2=_0x4c47b2||0xcc;return function(_0x4856c1){if(_0x4856c1){return _0x4dfad0[_0xcc38('0x1a')](_0x4c47b2);}return _0x4dfad0['status'](_0x4c47b2)[_0xcc38('0x1b')]();};}function respondWithResult(_0x35d53b,_0x2e49b0){_0x2e49b0=_0x2e49b0||0xc8;return function(_0xb44f10){if(_0xb44f10){return _0x35d53b['status'](_0x2e49b0)[_0xcc38('0x1c')](_0xb44f10);}};}function respondWithFilteredResult(_0x4a8eee,_0x5702e6){return function(_0x383395){if(_0x383395){var _0x2fb204=_0x383395[_0xcc38('0x1d')],_0x8ab46f=_0x5702e6[_0xcc38('0x1e')],_0x36e6b4=_0x5702e6[_0xcc38('0x1e')]+_0x5702e6[_0xcc38('0x1f')],_0x10608c;if(_0x36e6b4>=_0x2fb204){_0x36e6b4=_0x2fb204;_0x10608c=0xc8;}else{_0x10608c=0xce;}_0x4a8eee[_0xcc38('0x20')](_0x10608c);return _0x4a8eee[_0xcc38('0x21')](_0xcc38('0x22'),_0x8ab46f+'-'+_0x36e6b4+'/'+_0x2fb204)[_0xcc38('0x1c')](_0x383395);}return null;};}function patchUpdates(_0x5b6637){return function(_0x1ad043){try{jsonpatch['apply'](_0x1ad043,_0x5b6637,!![]);}catch(_0x577194){return BPromise['reject'](_0x577194);}return _0x1ad043[_0xcc38('0x23')]();};}function saveUpdates(_0x23afb9,_0x31e7c9){return function(_0x3969b3){if(_0x3969b3){return _0x3969b3[_0xcc38('0x24')](_0x23afb9)[_0xcc38('0x25')](function(_0xcb4289){return _0xcb4289;});}return null;};}function removeEntity(_0x1b0e4c,_0xcd8ef8){return function(_0x45e768){if(_0x45e768){return _0x45e768[_0xcc38('0x26')]()[_0xcc38('0x25')](function(){_0x1b0e4c[_0xcc38('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fb02,_0xcefa3){return function(_0x254e54){if(!_0x254e54){_0x47fb02['sendStatus'](0x194);}return _0x254e54;};}function handleError(_0x231f72,_0x3c475b){_0x3c475b=_0x3c475b||0x1f4;return function(_0x4ca3c5){logger['error'](_0x4ca3c5[_0xcc38('0x27')]);if(_0x4ca3c5[_0xcc38('0x28')]){delete _0x4ca3c5[_0xcc38('0x28')];}_0x231f72[_0xcc38('0x20')](_0x3c475b)[_0xcc38('0x29')](_0x4ca3c5);};}exports[_0xcc38('0x2a')]=function(_0x148cda,_0x4cdb41){var _0xf97e3e={},_0x5829ca={},_0x5589a8={'count':0x0,'rows':[]};var _0x1e18ef=_[_0xcc38('0x2b')](db['WhatsappTransferReport']['rawAttributes'],function(_0x1b17e2){return{'name':_0x1b17e2['fieldName'],'type':_0x1b17e2[_0xcc38('0x2c')][_0xcc38('0x2d')]};});_0x5829ca[_0xcc38('0x2e')]=_[_0xcc38('0x2b')](_0x1e18ef,_0xcc38('0x28'));_0x5829ca[_0xcc38('0x2f')]=_[_0xcc38('0x30')](_0x148cda[_0xcc38('0x2f')]);_0x5829ca[_0xcc38('0x31')]=_['intersection'](_0x5829ca[_0xcc38('0x2e')],_0x5829ca['query']);_0xf97e3e[_0xcc38('0x32')]=_['intersection'](_0x5829ca[_0xcc38('0x2e')],qs[_0xcc38('0x33')](_0x148cda[_0xcc38('0x2f')][_0xcc38('0x33')]));_0xf97e3e[_0xcc38('0x32')]=_0xf97e3e[_0xcc38('0x32')][_0xcc38('0x34')]?_0xf97e3e[_0xcc38('0x32')]:_0x5829ca[_0xcc38('0x2e')];if(!_0x148cda[_0xcc38('0x2f')]['hasOwnProperty'](_0xcc38('0x35'))){_0xf97e3e[_0xcc38('0x1f')]=qs[_0xcc38('0x1f')](_0x148cda['query']['limit']);_0xf97e3e[_0xcc38('0x1e')]=qs[_0xcc38('0x1e')](_0x148cda[_0xcc38('0x2f')]['offset']);}_0xf97e3e[_0xcc38('0x36')]=qs[_0xcc38('0x37')](_0x148cda[_0xcc38('0x2f')][_0xcc38('0x37')]);_0xf97e3e['where']=qs[_0xcc38('0x31')](_[_0xcc38('0x38')](_0x148cda['query'],_0x5829ca[_0xcc38('0x31')]),_0x1e18ef);if(_0x148cda[_0xcc38('0x2f')]['filter']){_0xf97e3e['where']=_['merge'](_0xf97e3e['where'],{'$or':_[_0xcc38('0x2b')](_0x1e18ef,function(_0x1e36ba){if(_0x1e36ba[_0xcc38('0x2c')]!==_0xcc38('0x39')){var _0x35570e={};_0x35570e[_0x1e36ba['name']]={'$like':'%'+_0x148cda['query'][_0xcc38('0x3a')]+'%'};return _0x35570e;}})});}_0xf97e3e=_[_0xcc38('0x3b')]({},_0xf97e3e,_0x148cda['options']);var _0xa4d802={'where':_0xf97e3e[_0xcc38('0x3c')]};return db[_0xcc38('0x3d')][_0xcc38('0x1d')](_0xa4d802)[_0xcc38('0x25')](function(_0x5ce0d1){_0x5589a8[_0xcc38('0x1d')]=_0x5ce0d1;if(_0x148cda[_0xcc38('0x2f')]['includeAll']){_0xf97e3e[_0xcc38('0x3e')]=[{'all':!![]}];}return db[_0xcc38('0x3d')][_0xcc38('0x3f')](_0xf97e3e);})[_0xcc38('0x25')](function(_0x4d3811){_0x5589a8[_0xcc38('0x40')]=_0x4d3811;return _0x5589a8;})[_0xcc38('0x25')](respondWithFilteredResult(_0x4cdb41,_0xf97e3e))[_0xcc38('0x41')](handleError(_0x4cdb41,null));};exports[_0xcc38('0x42')]=function(_0x4d8ff1,_0x116b69){var _0x3d41c1={'raw':!![],'where':{'id':_0x4d8ff1[_0xcc38('0x43')]['id']}},_0x4589f5={};_0x4589f5['model']=_[_0xcc38('0x30')](db[_0xcc38('0x3d')][_0xcc38('0x44')]);_0x4589f5[_0xcc38('0x2f')]=_[_0xcc38('0x30')](_0x4d8ff1[_0xcc38('0x2f')]);_0x4589f5['filters']=_[_0xcc38('0x45')](_0x4589f5[_0xcc38('0x2e')],_0x4589f5['query']);_0x3d41c1[_0xcc38('0x32')]=_[_0xcc38('0x45')](_0x4589f5[_0xcc38('0x2e')],qs['fields'](_0x4d8ff1['query'][_0xcc38('0x33')]));_0x3d41c1[_0xcc38('0x32')]=_0x3d41c1[_0xcc38('0x32')][_0xcc38('0x34')]?_0x3d41c1[_0xcc38('0x32')]:_0x4589f5[_0xcc38('0x2e')];if(_0x4d8ff1[_0xcc38('0x2f')][_0xcc38('0x46')]){_0x3d41c1[_0xcc38('0x3e')]=[{'all':!![]}];}_0x3d41c1=_['merge']({},_0x3d41c1,_0x4d8ff1[_0xcc38('0x47')]);return db[_0xcc38('0x3d')][_0xcc38('0x48')](_0x3d41c1)[_0xcc38('0x25')](handleEntityNotFound(_0x116b69,null))[_0xcc38('0x25')](respondWithResult(_0x116b69,null))['catch'](handleError(_0x116b69,null));};exports[_0xcc38('0x49')]=function(_0x4e9451,_0x2761bf){return db[_0xcc38('0x3d')]['create'](_0x4e9451['body'],{})[_0xcc38('0x25')](respondWithResult(_0x2761bf,0xc9))[_0xcc38('0x41')](handleError(_0x2761bf,null));};exports['update']=function(_0xe9d03f,_0x424047){if(_0xe9d03f[_0xcc38('0x4a')]['id']){delete _0xe9d03f[_0xcc38('0x4a')]['id'];}return db[_0xcc38('0x3d')][_0xcc38('0x48')]({'where':{'id':_0xe9d03f[_0xcc38('0x43')]['id']}})[_0xcc38('0x25')](handleEntityNotFound(_0x424047,null))['then'](saveUpdates(_0xe9d03f[_0xcc38('0x4a')],null))[_0xcc38('0x25')](respondWithResult(_0x424047,null))['catch'](handleError(_0x424047,null));};exports[_0xcc38('0x26')]=function(_0x5e3cfc,_0x5b597a){return db[_0xcc38('0x3d')]['find']({'where':{'id':_0x5e3cfc['params']['id']}})['then'](handleEntityNotFound(_0x5b597a,null))['then'](removeEntity(_0x5b597a,null))[_0xcc38('0x41')](handleError(_0x5b597a,null));};exports['describe']=function(_0x54c9c7,_0x20f9c7){return db['WhatsappTransferReport'][_0xcc38('0x4b')]()[_0xcc38('0x25')](respondWithResult(_0x20f9c7,null))[_0xcc38('0x41')](handleError(_0x20f9c7,null));}; \ No newline at end of file +var _0xc99c=['send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name'];(function(_0x5b2ae5,_0x20258a){var _0x475d1e=function(_0x4d640b){while(--_0x4d640b){_0x5b2ae5['push'](_0x5b2ae5['shift']());}};_0x475d1e(++_0x20258a);}(_0xc99c,0xa8));var _0xcc99=function(_0x2798e8,_0x19e075){_0x2798e8=_0x2798e8-0x0;var _0x42bb8c=_0xc99c[_0x2798e8];return _0x42bb8c;};'use strict';var pdf=require(_0xcc99('0x0'));var emlformat=require(_0xcc99('0x1'));var rimraf=require(_0xcc99('0x2'));var zipdir=require(_0xcc99('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcc99('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcc99('0x5'));var ejs=require(_0xcc99('0x6'));var fs=require('fs');var _=require(_0xcc99('0x7'));var squel=require(_0xcc99('0x8'));var crypto=require('crypto');var jsforce=require(_0xcc99('0x9'));var deskjs=require(_0xcc99('0xa'));var toCsv=require(_0xcc99('0x5'));var querystring=require(_0xcc99('0xb'));var Papa=require('papaparse');var Redis=require(_0xcc99('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcc99('0xd'));var as=require(_0xcc99('0xe'));var hardwareService=require(_0xcc99('0xf'));var logger=require(_0xcc99('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xcc99('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459069,_0x548f5d){_0x548f5d=_0x548f5d||0xcc;return function(_0x34532b){if(_0x34532b){return _0x459069[_0xcc99('0x12')](_0x548f5d);}return _0x459069[_0xcc99('0x13')](_0x548f5d)[_0xcc99('0x14')]();};}function respondWithResult(_0x1165ea,_0x5b3474){_0x5b3474=_0x5b3474||0xc8;return function(_0x2c9855){if(_0x2c9855){return _0x1165ea[_0xcc99('0x13')](_0x5b3474)[_0xcc99('0x15')](_0x2c9855);}};}function respondWithFilteredResult(_0x29b805,_0x9eb926){return function(_0x3f5a5d){if(_0x3f5a5d){var _0x529b65=_0x3f5a5d[_0xcc99('0x16')],_0x15d556=_0x9eb926[_0xcc99('0x17')],_0x5a44af=_0x9eb926[_0xcc99('0x17')]+_0x9eb926['limit'],_0x50aaa8;if(_0x5a44af>=_0x529b65){_0x5a44af=_0x529b65;_0x50aaa8=0xc8;}else{_0x50aaa8=0xce;}_0x29b805['status'](_0x50aaa8);return _0x29b805[_0xcc99('0x18')](_0xcc99('0x19'),_0x15d556+'-'+_0x5a44af+'/'+_0x529b65)['json'](_0x3f5a5d);}return null;};}function patchUpdates(_0x38e019){return function(_0x3515ea){try{jsonpatch[_0xcc99('0x1a')](_0x3515ea,_0x38e019,!![]);}catch(_0x10c041){return BPromise[_0xcc99('0x1b')](_0x10c041);}return _0x3515ea[_0xcc99('0x1c')]();};}function saveUpdates(_0x3cc262,_0x450514){return function(_0x4f6f3b){if(_0x4f6f3b){return _0x4f6f3b['update'](_0x3cc262)[_0xcc99('0x1d')](function(_0x11fcea){return _0x11fcea;});}return null;};}function removeEntity(_0x2a256c,_0x4d5ab4){return function(_0x502557){if(_0x502557){return _0x502557[_0xcc99('0x1e')]()['then'](function(){_0x2a256c[_0xcc99('0x13')](0xcc)[_0xcc99('0x14')]();});}};}function handleEntityNotFound(_0x13edc1,_0x22cc31){return function(_0x45fea7){if(!_0x45fea7){_0x13edc1[_0xcc99('0x12')](0x194);}return _0x45fea7;};}function handleError(_0x14bc21,_0x57e9a6){_0x57e9a6=_0x57e9a6||0x1f4;return function(_0x57e9cd){logger[_0xcc99('0x1f')](_0x57e9cd['stack']);if(_0x57e9cd[_0xcc99('0x20')]){delete _0x57e9cd['name'];}_0x14bc21['status'](_0x57e9a6)[_0xcc99('0x21')](_0x57e9cd);};}exports['index']=function(_0x216cfb,_0x475827){var _0x4306df={},_0x52e11b={},_0x333a4e={'count':0x0,'rows':[]};var _0x16e48b=_[_0xcc99('0x22')](db[_0xcc99('0x23')][_0xcc99('0x24')],function(_0x1d86ed){return{'name':_0x1d86ed[_0xcc99('0x25')],'type':_0x1d86ed[_0xcc99('0x26')][_0xcc99('0x27')]};});_0x52e11b[_0xcc99('0x28')]=_[_0xcc99('0x22')](_0x16e48b,_0xcc99('0x20'));_0x52e11b[_0xcc99('0x29')]=_[_0xcc99('0x2a')](_0x216cfb['query']);_0x52e11b[_0xcc99('0x2b')]=_[_0xcc99('0x2c')](_0x52e11b['model'],_0x52e11b['query']);_0x4306df[_0xcc99('0x2d')]=_[_0xcc99('0x2c')](_0x52e11b[_0xcc99('0x28')],qs[_0xcc99('0x2e')](_0x216cfb[_0xcc99('0x29')]['fields']));_0x4306df[_0xcc99('0x2d')]=_0x4306df[_0xcc99('0x2d')][_0xcc99('0x2f')]?_0x4306df['attributes']:_0x52e11b[_0xcc99('0x28')];if(!_0x216cfb['query'][_0xcc99('0x30')]('nolimit')){_0x4306df[_0xcc99('0x31')]=qs['limit'](_0x216cfb['query']['limit']);_0x4306df['offset']=qs['offset'](_0x216cfb[_0xcc99('0x29')][_0xcc99('0x17')]);}_0x4306df[_0xcc99('0x32')]=qs[_0xcc99('0x33')](_0x216cfb['query']['sort']);_0x4306df[_0xcc99('0x34')]=qs[_0xcc99('0x2b')](_['pick'](_0x216cfb['query'],_0x52e11b['filters']),_0x16e48b);if(_0x216cfb[_0xcc99('0x29')][_0xcc99('0x35')]){_0x4306df[_0xcc99('0x34')]=_[_0xcc99('0x36')](_0x4306df[_0xcc99('0x34')],{'$or':_[_0xcc99('0x22')](_0x16e48b,function(_0x2cc9be){if(_0x2cc9be['type']!==_0xcc99('0x37')){var _0x4ff62d={};_0x4ff62d[_0x2cc9be[_0xcc99('0x20')]]={'$like':'%'+_0x216cfb[_0xcc99('0x29')][_0xcc99('0x35')]+'%'};return _0x4ff62d;}})});}_0x4306df=_[_0xcc99('0x36')]({},_0x4306df,_0x216cfb[_0xcc99('0x38')]);var _0x17eebd={'where':_0x4306df[_0xcc99('0x34')]};return db[_0xcc99('0x23')][_0xcc99('0x16')](_0x17eebd)[_0xcc99('0x1d')](function(_0x293cf4){_0x333a4e[_0xcc99('0x16')]=_0x293cf4;if(_0x216cfb[_0xcc99('0x29')][_0xcc99('0x39')]){_0x4306df[_0xcc99('0x3a')]=[{'all':!![]}];}return db[_0xcc99('0x23')]['findAll'](_0x4306df);})[_0xcc99('0x1d')](function(_0x264f4d){_0x333a4e[_0xcc99('0x3b')]=_0x264f4d;return _0x333a4e;})['then'](respondWithFilteredResult(_0x475827,_0x4306df))['catch'](handleError(_0x475827,null));};exports[_0xcc99('0x3c')]=function(_0x285f5c,_0x32915b){var _0x3888e1={'raw':!![],'where':{'id':_0x285f5c[_0xcc99('0x3d')]['id']}},_0x320fd4={};_0x320fd4['model']=_['keys'](db[_0xcc99('0x23')][_0xcc99('0x24')]);_0x320fd4['query']=_['keys'](_0x285f5c[_0xcc99('0x29')]);_0x320fd4['filters']=_[_0xcc99('0x2c')](_0x320fd4[_0xcc99('0x28')],_0x320fd4[_0xcc99('0x29')]);_0x3888e1[_0xcc99('0x2d')]=_[_0xcc99('0x2c')](_0x320fd4['model'],qs['fields'](_0x285f5c['query']['fields']));_0x3888e1[_0xcc99('0x2d')]=_0x3888e1['attributes'][_0xcc99('0x2f')]?_0x3888e1[_0xcc99('0x2d')]:_0x320fd4[_0xcc99('0x28')];if(_0x285f5c['query'][_0xcc99('0x39')]){_0x3888e1['include']=[{'all':!![]}];}_0x3888e1=_[_0xcc99('0x36')]({},_0x3888e1,_0x285f5c[_0xcc99('0x38')]);return db[_0xcc99('0x23')][_0xcc99('0x3e')](_0x3888e1)[_0xcc99('0x1d')](handleEntityNotFound(_0x32915b,null))['then'](respondWithResult(_0x32915b,null))[_0xcc99('0x3f')](handleError(_0x32915b,null));};exports[_0xcc99('0x40')]=function(_0x2eb83f,_0x4bc31a){return db[_0xcc99('0x23')][_0xcc99('0x40')](_0x2eb83f[_0xcc99('0x41')],{})[_0xcc99('0x1d')](respondWithResult(_0x4bc31a,0xc9))[_0xcc99('0x3f')](handleError(_0x4bc31a,null));};exports['update']=function(_0x2f86a7,_0x4fae89){if(_0x2f86a7[_0xcc99('0x41')]['id']){delete _0x2f86a7[_0xcc99('0x41')]['id'];}return db[_0xcc99('0x23')][_0xcc99('0x3e')]({'where':{'id':_0x2f86a7['params']['id']}})[_0xcc99('0x1d')](handleEntityNotFound(_0x4fae89,null))[_0xcc99('0x1d')](saveUpdates(_0x2f86a7[_0xcc99('0x41')],null))[_0xcc99('0x1d')](respondWithResult(_0x4fae89,null))['catch'](handleError(_0x4fae89,null));};exports[_0xcc99('0x1e')]=function(_0x1c943f,_0x27a809){return db[_0xcc99('0x23')][_0xcc99('0x3e')]({'where':{'id':_0x1c943f[_0xcc99('0x3d')]['id']}})[_0xcc99('0x1d')](handleEntityNotFound(_0x27a809,null))[_0xcc99('0x1d')](removeEntity(_0x27a809,null))['catch'](handleError(_0x27a809,null));};exports[_0xcc99('0x42')]=function(_0x193495,_0x21d392){return db['WhatsappTransferReport'][_0xcc99('0x42')]()['then'](respondWithResult(_0x21d392,null))[_0xcc99('0x3f')](handleError(_0x21d392,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 057a48f..271e747 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 _0xfb71=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xfb71,0x1c7));var _0x1fb7=function(_0x99f43e,_0x41f7cf){_0x99f43e=_0x99f43e-0x0;var _0x3e22d1=_0xfb71[_0x99f43e];return _0x3e22d1;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require('../../config/logger')(_0x1fb7('0x2'));var moment=require(_0x1fb7('0x3'));var BPromise=require('bluebird');var rp=require(_0x1fb7('0x4'));var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require(_0x1fb7('0x8'));module['exports']=function(_0x740c68,_0x4ed2ac){return _0x740c68[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[{'name':_0x1fb7('0xc'),'fields':[_0x1fb7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2003=['bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2757e5,_0x42cfa2){var _0x326d5a=function(_0x146e15){while(--_0x146e15){_0x2757e5['push'](_0x2757e5['shift']());}};_0x326d5a(++_0x42cfa2);}(_0x2003,0x1f3));var _0x3200=function(_0xbe31a4,_0x11ba89){_0xbe31a4=_0xbe31a4-0x0;var _0x15ec28=_0x2003[_0xbe31a4];return _0x15ec28;};'use strict';var _=require(_0x3200('0x0'));var util=require(_0x3200('0x1'));var logger=require(_0x3200('0x2'))(_0x3200('0x3'));var moment=require(_0x3200('0x4'));var BPromise=require(_0x3200('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3200('0x6'));var rimraf=require('rimraf');var config=require(_0x3200('0x7'));var attributes=require(_0x3200('0x8'));module[_0x3200('0x9')]=function(_0x50d637,_0x471dfe){return _0x50d637[_0x3200('0xa')](_0x3200('0xb'),attributes,{'tableName':_0x3200('0xc'),'paranoid':![],'indexes':[{'name':_0x3200('0xd'),'fields':[_0x3200('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 2a09b6e..3e8ca50 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(_0x3fb510,_0xeda556){var _0x49d476=function(_0x227e2b){while(--_0x227e2b){_0x3fb510['push'](_0x3fb510['shift']());}};_0x49d476(++_0xeda556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x2b419a,_0x4af62f){var _0x184200=function(_0x175fef){while(--_0x175fef){_0x2b419a['push'](_0x2b419a['shift']());}};_0x184200(++_0x4af62f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 fe018e6..ddde82c 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9e8=['name','Offline\x20apps:','filter','join','None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2/config','./config/schedule/transcribe','sync','then','info','start','Online\x20apps:','map','online'];(function(_0x5b38ae,_0x26d993){var _0x58f579=function(_0x331746){while(--_0x331746){_0x5b38ae['push'](_0x5b38ae['shift']());}};_0x58f579(++_0x26d993);}(_0xb9e8,0x1e0));var _0x8b9e=function(_0x47e3ef,_0x551b2c){_0x47e3ef=_0x47e3ef-0x0;var _0x502417=_0xb9e8[_0x47e3ef];return _0x502417;};'use strict';var _=require(_0x8b9e('0x0'));var mysqldb=require(_0x8b9e('0x1'));var rpc=require(_0x8b9e('0x2'));var config=require(_0x8b9e('0x3'));var logger=require('./config/logger')(_0x8b9e('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x8b9e('0x5'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var transcribe=require(_0x8b9e('0x6'));function main(){return mysqldb['db']['sequelize'][_0x8b9e('0x7')]()['then'](function(){return rpc['listen']();})[_0x8b9e('0x8')](function(_0x14161d){logger[_0x8b9e('0x9')](_0x14161d);return chat[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(){return schedule[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(){return transcribe[_0x8b9e('0xa')]();})[_0x8b9e('0x8')](function(_0x4c35d6){logger[_0x8b9e('0x9')](_0x4c35d6);return pm2[_0x8b9e('0xa')](pm2Config);})[_0x8b9e('0x8')](function(_0x4fc3c0){logger[_0x8b9e('0x9')](_0x8b9e('0xb'),_[_0x8b9e('0xc')](_['filter'](_0x4fc3c0,{'status':_0x8b9e('0xd')}),_0x8b9e('0xe'))['join']());logger[_0x8b9e('0x9')](_0x8b9e('0xf'),_['map'](_[_0x8b9e('0x10')](_0x4fc3c0,function(_0x4be048){return _0x4be048['status']!==_0x8b9e('0xd');}),_0x8b9e('0xe'))[_0x8b9e('0x11')]()||_0x8b9e('0x12'));config['seedDB']&&require(_0x8b9e('0x13'))[_0x8b9e('0x14')]();require(_0x8b9e('0x15'))[_0x8b9e('0x14')]();})[_0x8b9e('0x16')](function(_0x3e082d){logger[_0x8b9e('0x17')](_0x8b9e('0x18'),_0x3e082d);process[_0x8b9e('0x19')](0x1);});}main(); \ No newline at end of file +var _0x450c=['sync','then','listen','start','info','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','None','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x345676,_0x554d0a){var _0x20a1da=function(_0x2b9b8d){while(--_0x2b9b8d){_0x345676['push'](_0x345676['shift']());}};_0x20a1da(++_0x554d0a);}(_0x450c,0x6b));var _0xc450=function(_0x1f244c,_0x499893){_0x1f244c=_0x1f244c-0x0;var _0xd65b6=_0x450c[_0x1f244c];return _0xd65b6;};'use strict';var _=require(_0xc450('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xc450('0x1'));var config=require(_0xc450('0x2'));var logger=require(_0xc450('0x3'))(_0xc450('0x4'));var pm2=require(_0xc450('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xc450('0x6'));var chat=require(_0xc450('0x7'));var transcribe=require(_0xc450('0x8'));function main(){return mysqldb['db']['sequelize'][_0xc450('0x9')]()[_0xc450('0xa')](function(){return rpc[_0xc450('0xb')]();})[_0xc450('0xa')](function(_0x2e77e3){logger['info'](_0x2e77e3);return chat[_0xc450('0xc')]();})[_0xc450('0xa')](function(){return schedule[_0xc450('0xc')]();})[_0xc450('0xa')](function(){return transcribe['start']();})['then'](function(_0x2d555a){logger[_0xc450('0xd')](_0x2d555a);return pm2[_0xc450('0xc')](pm2Config);})['then'](function(_0x387012){logger[_0xc450('0xd')](_0xc450('0xe'),_[_0xc450('0xf')](_[_0xc450('0x10')](_0x387012,{'status':_0xc450('0x11')}),'name')[_0xc450('0x12')]());logger[_0xc450('0xd')](_0xc450('0x13'),_['map'](_[_0xc450('0x10')](_0x387012,function(_0x1afd3b){return _0x1afd3b[_0xc450('0x14')]!==_0xc450('0x11');}),_0xc450('0x15'))['join']()||_0xc450('0x16'));config['seedDB']&&require(_0xc450('0x17'))[_0xc450('0x18')]();require(_0xc450('0x19'))['default']();})[_0xc450('0x1a')](function(_0x1d28de){logger['error'](_0xc450('0x1b'),_0x1d28de);process[_0xc450('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2f27606..c0cd715 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 _0x7952=['options','verify','session','randomBytes','toString','hex','floor','now','apiKeyIat','HS512','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','secrets','role','name','internal','email','userpic','md5secret','voicePause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','disposition','then','closed','status','unmanaged','json','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','Wrong\x20credentials.','Bearer','getUuid','query','apikey','find','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload'];(function(_0x2efccf,_0x6d7311){var _0x433d78=function(_0xc68641){while(--_0xc68641){_0x2efccf['push'](_0x2efccf['shift']());}};_0x433d78(++_0x6d7311);}(_0x7952,0xcc));var _0x2795=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7952[_0x57b54c];return _0x59cc19;};'use strict';var db=require(_0x2795('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x2795('0x1'));var _=require(_0x2795('0x2'));var jwt=require(_0x2795('0x3'));var expressJwt=require(_0x2795('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x2795('0x5'));var crypto=require(_0x2795('0x6'));var BPromise=require(_0x2795('0x7'));var validateJwt=expressJwt({'secret':config[_0x2795('0x8')]['session']});var userAttributes=['id',_0x2795('0x9'),'fullname',_0x2795('0xa'),_0x2795('0xb'),_0x2795('0xc'),_0x2795('0xd'),'permissions',_0x2795('0xe'),_0x2795('0xf'),'chatPause','mailPause','faxPause',_0x2795('0x10'),_0x2795('0x11'),_0x2795('0x12'),_0x2795('0x13'),_0x2795('0x14'),_0x2795('0x15'),_0x2795('0x16'),'allowmessenger',_0x2795('0x17'),_0x2795('0x18'),_0x2795('0x19'),_0x2795('0x1a'),_0x2795('0x1b'),_0x2795('0x1c'),_0x2795('0x1d'),_0x2795('0x1e'),_0x2795('0x1f'),_0x2795('0x20'),'phoneBarRemoteControl',_0x2795('0x21'),_0x2795('0x22'),'interface',_0x2795('0x23')];exports[_0x2795('0x24')]=function(){return this[_0x2795('0x25')](!![])['use'](function(_0x190878,_0x1ce63f,_0x3e1fb5){if(_0x190878[_0x2795('0x26')]){_0x3e1fb5();}else{return db['ChatInteraction'][_0x2795('0x27')]({'where':{'id':_0x190878[_0x2795('0x28')]['id']},'attributes':['id','closed',_0x2795('0x29')],'raw':!![]})[_0x2795('0x2a')](function(_0x268420){if(_0x268420&&_0x268420[_0x2795('0x2b')]){return _0x1ce63f[_0x2795('0x2c')](_0x268420['disposition']===_0x2795('0x2d')?0x195:0x193)[_0x2795('0x2e')]({'message':_0x268420['disposition']==='unmanaged'?'Unmanaged.':_0x2795('0x2f')});}else{_0x3e1fb5();}})[_0x2795('0x30')](function(_0x1650e8){_0x3e1fb5(_0x1650e8);});}});};exports[_0x2795('0x25')]=function isAuthenticated(_0x1dac8a){return compose()[_0x2795('0x31')](function(_0x5bcafe,_0x327f11,_0x1b4378){if(_0x5bcafe[_0x2795('0x32')][_0x2795('0x33')]){if(_[_0x2795('0x34')](_0x5bcafe[_0x2795('0x32')]['authorization'],_0x2795('0x35'))){var _0x353432=basicAuth(_0x5bcafe);db[_0x2795('0x36')]['find']({'where':{'name':_0x353432[_0x2795('0xa')]}})['then'](function(_0xff6280){if(!_0xff6280||!_0xff6280['authenticate'](_0x353432['pass'])){return _0x327f11['status'](0x191)[_0x2795('0x2e')]({'message':_0x2795('0x37')});}_0x5bcafe['user']={'id':_0xff6280['id']};_0x1b4378();})['catch'](function(_0x2cd173){_0x1b4378(_0x2cd173);});}else if(_[_0x2795('0x34')](_0x5bcafe[_0x2795('0x32')][_0x2795('0x33')],_0x2795('0x38'))){validateJwt(_0x5bcafe,_0x327f11,_0x1b4378);}else{if(_0x1dac8a){_0x1b4378();}else{return _0x327f11[_0x2795('0x2c')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5bcafe['query']['apikey']){try{var _0x34f0a3={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2795('0x39')]()};verifyJwt(_0x5bcafe[_0x2795('0x3a')][_0x2795('0x3b')],_0x34f0a3)[_0x2795('0x2a')](function(_0x186d14){return db[_0x2795('0x36')][_0x2795('0x3c')]({'where':{'id':_0x186d14['sub']}})[_0x2795('0x2a')](function(_0x57deaf){if(!_0x57deaf||!_['isEqual'](_0x57deaf['apiKeyNonce'],_0x186d14[_0x2795('0x3d')])){return _0x327f11[_0x2795('0x2c')](0x191)[_0x2795('0x2e')]({'message':_0x2795('0x3e')});}_0x5bcafe[_0x2795('0x26')]={'id':_0x57deaf['id']};_0x1b4378();});})['catch'](function(){return _0x327f11[_0x2795('0x2c')](0x191)[_0x2795('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x56809d){_0x1b4378(_0x56809d);}}else if(_0x1dac8a){_0x1b4378();}else{return _0x327f11['status'](0x193)['json']({'message':_0x2795('0x3f')});}})['use'](function(_0x1cb825,_0x17a6a3,_0x43f9d4){if(_0x1cb825[_0x2795('0x26')]){db[_0x2795('0x36')]['find']({'where':{'id':_0x1cb825['user']['id']},'attributes':userAttributes})[_0x2795('0x2a')](function(_0x6b1c44){if(!_0x6b1c44){return _0x17a6a3[_0x2795('0x2c')](0x194)['json']({'message':_0x2795('0x40')});}_0x1cb825['user']=_0x6b1c44;_0x43f9d4();})['catch'](function(_0xb3eb5d){_0x43f9d4(_0xb3eb5d);});}else if(_0x1dac8a){_0x43f9d4();}else{return _0x17a6a3[_0x2795('0x2c')](0x194)[_0x2795('0x2e')]({'message':_0x2795('0x41')});}});};exports[_0x2795('0x42')]=function canUpdate(){return compose()[_0x2795('0x31')](function(_0x34c25b,_0x154889,_0x80b4a1){return require(_0x2795('0x43'))[_0x2795('0x44')]()[_0x2795('0x2a')](function(_0x5e1345){if(_0x5e1345[_0x2795('0x45')]){_0x80b4a1();}else{return _0x154889[_0x2795('0x2c')](0x193)[_0x2795('0x2e')]({'message':_0x2795('0x46')});}})[_0x2795('0x30')](function(_0x440eb9){_0x80b4a1(_0x440eb9);});});};exports[_0x2795('0x47')]=function(_0x5b2bc4,_0x540dbc,_0x4eafab){_0x5b2bc4['isMiddleware']=!![];return _0x4eafab();};exports[_0x2795('0x48')]=function signToken(_0x4ccb64){return signJwt(_0x4ccb64);};exports[_0x2795('0x49')]=function(_0x574505,_0x4bf3d2){if(!_0x574505[_0x2795('0x26')]){return _0x4bf3d2[_0x2795('0x2c')](0x194)['json']({'message':_0x2795('0x4a')});}var _0x4068e0={'payload':{'id':_0x574505['user']['id'],'role':_0x574505[_0x2795('0x26')][_0x2795('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4068e0)['then'](function(_0x4ff332){_0x4bf3d2[_0x2795('0x4b')](_0x2795('0x4c'),_0x4ff332);_0x4bf3d2['redirect']('/dashboards/general');})[_0x2795('0x30')](function(_0x22b22f){return _0x4bf3d2[_0x2795('0x2c')](0x1f4)[_0x2795('0x4d')](_0x22b22f);});};exports[_0x2795('0x4e')]=function(_0x3ffa4a){if(_[_0x2795('0x4f')](_0x3ffa4a[_0x2795('0x50')])||_[_0x2795('0x4f')](_0x3ffa4a['apiKeyIat'])){return null;}else{return createJwt(_0x3ffa4a);}};exports[_0x2795('0x51')]=function(_0x130732){_0x130732[_0x2795('0x50')]=generateNonce();_0x130732['apiKeyIat']=generateIssuedAt();return createJwt(_0x130732);};exports['regenerateApiKey']=function(_0x33cae6,_0x22742b){var _0x27750c=_0x33cae6['query'][_0x2795('0x3b')];if(_0x27750c){var _0x5f24ba={'nonce':_0x22742b['apiKeyNonce'],'iat':_0x22742b['apiKeyIat'],'audience':hardwareConf[_0x2795('0x39')](),'issuer':hardwareConf[_0x2795('0x39')]()};return verifyJwt(_0x27750c,_0x5f24ba)[_0x2795('0x2a')](function(){return generateApiKey(_0x22742b);});}else{throw{'message':_0x2795('0x52')};}};function signJwt(_0xddd0cf){var _0x26740d=BPromise[_0x2795('0x53')](jwt[_0x2795('0x54')],{'context':jwt});var _0x4ef482=_0xddd0cf[_0x2795('0x55')]||config[_0x2795('0x8')]['session'];return new BPromise(function(_0x5b7d18,_0x11cc2e){_0x26740d(_0xddd0cf[_0x2795('0x56')],_0x4ef482,_0xddd0cf[_0x2795('0x57')])[_0x2795('0x2a')](function(_0x1951f5){_0x5b7d18(_0x1951f5);})[_0x2795('0x30')](function(_0x2eca4b){_0x11cc2e(_0x2eca4b);});});}function verifyJwt(_0x6ad46f,_0x42a973,_0x5310c8){var _0x213ad3=BPromise[_0x2795('0x53')](jwt[_0x2795('0x58')],{'context':jwt});var _0x1cde4a=_0x5310c8||config[_0x2795('0x8')][_0x2795('0x59')];return new BPromise(function(_0x5beebe,_0x57f740){_0x213ad3(_0x6ad46f,_0x1cde4a,_0x42a973)[_0x2795('0x2a')](function(_0x4f943f){_0x5beebe(_0x4f943f);})[_0x2795('0x30')](function(_0x1526ca){_0x57f740(_0x1526ca);});});}function generateNonce(){return crypto[_0x2795('0x5a')](0x10)[_0x2795('0x5b')](_0x2795('0x5c'));}function generateIssuedAt(){return Math[_0x2795('0x5d')](Date[_0x2795('0x5e')]()/0x3e8)[_0x2795('0x5b')]();}function createJwt(_0x261bb2){var _0x41d2e4={'payload':{'iat':_0x261bb2[_0x2795('0x5f')],'nonce':_0x261bb2[_0x2795('0x50')]},'options':{'algorithm':_0x2795('0x60'),'subject':_0x261bb2['id']['toString'](),'issuer':hardwareConf[_0x2795('0x39')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x41d2e4)[_0x2795('0x2a')](function(_0x280b4e){return{'iat':_0x261bb2[_0x2795('0x5f')],'nonce':_0x261bb2[_0x2795('0x50')],'token':_0x280b4e};});} \ No newline at end of file +var _0x332d=['name','internal','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','userProfileId','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','catch','authorization','headers','Basic','User','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','then','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','now','apiKeyNonce','../../mysqldb','../../config/environment','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','role'];(function(_0x279971,_0x43f66c){var _0x5bc40b=function(_0x564050){while(--_0x564050){_0x279971['push'](_0x279971['shift']());}};_0x5bc40b(++_0x43f66c);}(_0x332d,0x1c8));var _0xd332=function(_0x53d82c,_0x1d020a){_0x53d82c=_0x53d82c-0x0;var _0x2ff9ad=_0x332d[_0x53d82c];return _0x2ff9ad;};'use strict';var db=require(_0xd332('0x0'))['db'];var config=require(_0xd332('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xd332('0x2'));var compose=require(_0xd332('0x3'));var basicAuth=require(_0xd332('0x4'));var crypto=require(_0xd332('0x5'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xd332('0x6')][_0xd332('0x7')]});var userAttributes=['id',_0xd332('0x8'),'fullname',_0xd332('0x9'),_0xd332('0xa'),'email',_0xd332('0xb'),_0xd332('0xc'),_0xd332('0xd'),_0xd332('0xe'),_0xd332('0xf'),'mailPause','faxPause',_0xd332('0x10'),_0xd332('0x11'),_0xd332('0x12'),_0xd332('0x13'),_0xd332('0x14'),'lastPauseAt',_0xd332('0x15'),_0xd332('0x16'),_0xd332('0x17'),_0xd332('0x18'),_0xd332('0x19'),'phoneBarAutoAnswerDelay',_0xd332('0x1a'),'phoneBarEnableRecording',_0xd332('0x1b'),_0xd332('0x1c'),_0xd332('0x1d'),'phoneBarPrefixRequired',_0xd332('0x1e'),'phoneBarRemoteControlPort',_0xd332('0x1f'),'interface',_0xd332('0x20')];exports['isChatInteractionAuthorized']=function(){return this[_0xd332('0x21')](!![])[_0xd332('0x22')](function(_0xcb3ca5,_0x1edc7d,_0x1b7d4a){if(_0xcb3ca5[_0xd332('0x23')]){_0x1b7d4a();}else{return db[_0xd332('0x24')][_0xd332('0x25')]({'where':{'id':_0xcb3ca5['params']['id']},'attributes':['id',_0xd332('0x26'),_0xd332('0x27')],'raw':!![]})['then'](function(_0x5e9545){if(_0x5e9545&&_0x5e9545[_0xd332('0x26')]){return _0x1edc7d[_0xd332('0x28')](_0x5e9545['disposition']===_0xd332('0x29')?0x195:0x193)[_0xd332('0x2a')]({'message':_0x5e9545[_0xd332('0x27')]===_0xd332('0x29')?_0xd332('0x2b'):_0xd332('0x2c')});}else{_0x1b7d4a();}})[_0xd332('0x2d')](function(_0x3cf784){_0x1b7d4a(_0x3cf784);});}});};exports[_0xd332('0x21')]=function isAuthenticated(_0xa068b8){return compose()[_0xd332('0x22')](function(_0x574b9a,_0x28843b,_0x3ffb01){if(_0x574b9a['headers'][_0xd332('0x2e')]){if(_['startsWith'](_0x574b9a[_0xd332('0x2f')][_0xd332('0x2e')],_0xd332('0x30'))){var _0x427816=basicAuth(_0x574b9a);db[_0xd332('0x31')]['find']({'where':{'name':_0x427816[_0xd332('0x9')]}})['then'](function(_0x17b7af){if(!_0x17b7af||!_0x17b7af['authenticate'](_0x427816['pass'])){return _0x28843b[_0xd332('0x28')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x574b9a[_0xd332('0x23')]={'id':_0x17b7af['id']};_0x3ffb01();})[_0xd332('0x2d')](function(_0x15e24c){_0x3ffb01(_0x15e24c);});}else if(_[_0xd332('0x32')](_0x574b9a[_0xd332('0x2f')][_0xd332('0x2e')],_0xd332('0x33'))){validateJwt(_0x574b9a,_0x28843b,_0x3ffb01);}else{if(_0xa068b8){_0x3ffb01();}else{return _0x28843b[_0xd332('0x28')](0x193)['json']({'message':_0xd332('0x34')});}}}else if(_0x574b9a['query'][_0xd332('0x35')]){try{var _0x3b9d21={'audience':hardwareConf[_0xd332('0x36')](),'issuer':hardwareConf[_0xd332('0x36')]()};verifyJwt(_0x574b9a[_0xd332('0x37')][_0xd332('0x35')],_0x3b9d21)['then'](function(_0x37eba2){return db[_0xd332('0x31')][_0xd332('0x38')]({'where':{'id':_0x37eba2[_0xd332('0x39')]}})[_0xd332('0x3a')](function(_0x40301b){if(!_0x40301b||!_[_0xd332('0x3b')](_0x40301b['apiKeyNonce'],_0x37eba2[_0xd332('0x3c')])){return _0x28843b['status'](0x191)['json']({'message':_0xd332('0x3d')});}_0x574b9a['user']={'id':_0x40301b['id']};_0x3ffb01();});})['catch'](function(){return _0x28843b[_0xd332('0x28')](0x191)[_0xd332('0x2a')]({'message':_0xd332('0x3e')});});}catch(_0x4db029){_0x3ffb01(_0x4db029);}}else if(_0xa068b8){_0x3ffb01();}else{return _0x28843b[_0xd332('0x28')](0x193)[_0xd332('0x2a')]({'message':'Unknown\x20authorization\x20format'});}})[_0xd332('0x22')](function(_0x383d3a,_0x23932b,_0x3e61af){if(_0x383d3a[_0xd332('0x23')]){db[_0xd332('0x31')]['find']({'where':{'id':_0x383d3a[_0xd332('0x23')]['id']},'attributes':userAttributes})[_0xd332('0x3a')](function(_0x545fda){if(!_0x545fda){return _0x23932b[_0xd332('0x28')](0x194)[_0xd332('0x2a')]({'message':_0xd332('0x3f')});}_0x383d3a['user']=_0x545fda;_0x3e61af();})[_0xd332('0x2d')](function(_0xcd4c3){_0x3e61af(_0xcd4c3);});}else if(_0xa068b8){_0x3e61af();}else{return _0x23932b[_0xd332('0x28')](0x194)['json']({'message':_0xd332('0x40')});}});};exports[_0xd332('0x41')]=function canUpdate(){return compose()[_0xd332('0x22')](function(_0xc53613,_0x594404,_0x3c6864){return require(_0xd332('0x42'))['getLicense']()['then'](function(_0x3711a0){if(_0x3711a0[_0xd332('0x43')]){_0x3c6864();}else{return _0x594404[_0xd332('0x28')](0x193)[_0xd332('0x2a')]({'message':_0xd332('0x44')});}})[_0xd332('0x2d')](function(_0x4d4984){_0x3c6864(_0x4d4984);});});};exports[_0xd332('0x45')]=function(_0xaee506,_0x793204,_0x3acf62){_0xaee506[_0xd332('0x45')]=!![];return _0x3acf62();};exports[_0xd332('0x46')]=function signToken(_0x3161fd){return signJwt(_0x3161fd);};exports['setTokenCookie']=function(_0xe9320b,_0x1271b8){if(!_0xe9320b[_0xd332('0x23')]){return _0x1271b8[_0xd332('0x28')](0x194)[_0xd332('0x2a')]({'message':_0xd332('0x47')});}var _0x437711={'payload':{'id':_0xe9320b[_0xd332('0x23')]['id'],'role':_0xe9320b[_0xd332('0x23')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x437711)[_0xd332('0x3a')](function(_0x5caec0){_0x1271b8[_0xd332('0x48')](_0xd332('0x49'),_0x5caec0);_0x1271b8[_0xd332('0x4a')]('/dashboards/general');})[_0xd332('0x2d')](function(_0x58c37d){return _0x1271b8[_0xd332('0x28')](0x1f4)[_0xd332('0x4b')](_0x58c37d);});};exports[_0xd332('0x4c')]=function(_0x5d1f5e){if(_[_0xd332('0x4d')](_0x5d1f5e['apiKeyNonce'])||_[_0xd332('0x4d')](_0x5d1f5e[_0xd332('0x4e')])){return null;}else{return createJwt(_0x5d1f5e);}};exports[_0xd332('0x4f')]=function(_0x5e9e08){_0x5e9e08['apiKeyNonce']=generateNonce();_0x5e9e08['apiKeyIat']=generateIssuedAt();return createJwt(_0x5e9e08);};exports[_0xd332('0x50')]=function(_0x5078d9,_0x40393f){var _0x378c01=_0x5078d9[_0xd332('0x37')][_0xd332('0x35')];if(_0x378c01){var _0x53af56={'nonce':_0x40393f['apiKeyNonce'],'iat':_0x40393f[_0xd332('0x4e')],'audience':hardwareConf[_0xd332('0x36')](),'issuer':hardwareConf[_0xd332('0x36')]()};return verifyJwt(_0x378c01,_0x53af56)[_0xd332('0x3a')](function(){return generateApiKey(_0x40393f);});}else{throw{'message':_0xd332('0x51')};}};function signJwt(_0x39a258){var _0x3d8b9f=BPromise[_0xd332('0x52')](jwt[_0xd332('0x53')],{'context':jwt});var _0x5589ba=_0x39a258[_0xd332('0x54')]||config[_0xd332('0x6')][_0xd332('0x7')];return new BPromise(function(_0x3df02e,_0x3e26cd){_0x3d8b9f(_0x39a258[_0xd332('0x55')],_0x5589ba,_0x39a258[_0xd332('0x56')])['then'](function(_0x157472){_0x3df02e(_0x157472);})[_0xd332('0x2d')](function(_0x255a3e){_0x3e26cd(_0x255a3e);});});}function verifyJwt(_0x2f3ba8,_0x1f807a,_0x27cfff){var _0x2d715d=BPromise[_0xd332('0x52')](jwt['verify'],{'context':jwt});var _0x39b274=_0x27cfff||config[_0xd332('0x6')][_0xd332('0x7')];return new BPromise(function(_0x5888cf,_0x171a93){_0x2d715d(_0x2f3ba8,_0x39b274,_0x1f807a)[_0xd332('0x3a')](function(_0x3eb539){_0x5888cf(_0x3eb539);})[_0xd332('0x2d')](function(_0x24b941){_0x171a93(_0x24b941);});});}function generateNonce(){return crypto[_0xd332('0x57')](0x10)[_0xd332('0x58')](_0xd332('0x59'));}function generateIssuedAt(){return Math[_0xd332('0x5a')](Date[_0xd332('0x5b')]()/0x3e8)[_0xd332('0x58')]();}function createJwt(_0x54feff){var _0x3becc4={'payload':{'iat':_0x54feff[_0xd332('0x4e')],'nonce':_0x54feff[_0xd332('0x5c')]},'options':{'algorithm':'HS512','subject':_0x54feff['id'][_0xd332('0x58')](),'issuer':hardwareConf[_0xd332('0x36')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3becc4)[_0xd332('0x3a')](function(_0x2e5520){return{'iat':_0x54feff[_0xd332('0x4e')],'nonce':_0x54feff['apiKeyNonce'],'token':_0x2e5520};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 826b662..6c398db 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 _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xe706,0xa3));var _0x6e70=function(_0x13d9ac,_0x193a78){_0x13d9ac=_0x13d9ac-0x0;var _0x348a17=_0xe706[_0x13d9ac];return _0x348a17;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x3c758e,_0x2194ed){var _0x2c775f=function(_0x40b3bf){while(--_0x40b3bf){_0x3c758e['push'](_0x3c758e['shift']());}};_0x2c775f(++_0x2194ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 16eb8d7..44b0b8f 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 _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x3da2f5,_0x423ce2){var _0x6c3805=function(_0x367a32){while(--_0x367a32){_0x3da2f5['push'](_0x3da2f5['shift']());}};_0x6c3805(++_0x423ce2);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4151be,_0x4b6e59){_0x4151be=_0x4151be-0x0;var _0x48bc47=_0xa8a8[_0x4151be];return _0x48bc47;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file +var _0xd0bb=['push','QueryTypes','basename','.csv','join','mkdirSync','each','length','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0x404eed,_0x5390c5){var _0xd45887=function(_0x1ee42b){while(--_0x1ee42b){_0x404eed['push'](_0x404eed['shift']());}};_0xd45887(++_0x5390c5);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x20f3bc,_0x34c2fd){_0x20f3bc=_0x20f3bc-0x0;var _0x2e0502=_0xd0bb[_0x20f3bc];return _0x2e0502;};'use strict';var util=require(_0xbd0b('0x0'));var path=require(_0xbd0b('0x1'));var _=require(_0xbd0b('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xbd0b('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xbd0b('0x4'));var db=require(_0xbd0b('0x5'))['db'];var dbH=require('../../mysqldb')[_0xbd0b('0x6')];var logger=require('../../config/logger')(_0xbd0b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xbd0b('0x8')][0x2]);var QUERY=process[_0xbd0b('0x8')][0x3];var PATH=process[_0xbd0b('0x8')][0x4];function analyticExtractedReport(_0x809599,_0x5eb975){var _0x2a4075={'status':_0x809599};var _0x4533ff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5eb975){_0x2a4075[_0xbd0b('0x9')]=_0x5eb975;}return db[_0xbd0b('0xa')][_0xbd0b('0xb')](_0x2a4075,_0x4533ff);}function main(){var _0x53d5e8=0x1388;var _0x51cf98;logger[_0xbd0b('0xc')](util[_0xbd0b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbd0b('0xe')));return db[_0xbd0b('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd0b('0x10'),_0xbd0b('0x11')]})[_0xbd0b('0x12')](function(_0x315ed9){if(_0x315ed9){_0x51cf98=_0x315ed9;_0x53d5e8=_0x51cf98[_0xbd0b('0x11')]||0x1388;}})[_0xbd0b('0x12')](function(){return dbH[_0xbd0b('0x13')][_0xbd0b('0x14')](util[_0xbd0b('0xd')](_0xbd0b('0x15'),QUERY),{'type':dbH[_0xbd0b('0x13')]['QueryTypes'][_0xbd0b('0x16')]});})['then'](function(_0x4a8014){if(!_0x4a8014[0x0][_0xbd0b('0x17')]){return analyticExtractedReport(_0xbd0b('0x18'));}var _0x3183cf=[];var _0x40b075=0x0;var _0x39b0fe=!![];if(_0x4a8014&&_0x4a8014['length']){var _0x55e0a1=_0x4a8014[0x0][_0xbd0b('0x17')]%(_0x40b075+_0x53d5e8);if(_0x51cf98[_0xbd0b('0x10')]){for(;_0x39b0fe;_0x40b075+=_0x53d5e8,_0x55e0a1=_0x4a8014[0x0][_0xbd0b('0x17')]%(_0x40b075+_0x53d5e8)){if(_0x55e0a1==0x0||_0x55e0a1==_0x4a8014[0x0][_0xbd0b('0x17')]){_0x39b0fe=![];}_0x3183cf[_0xbd0b('0x19')](dbH[_0xbd0b('0x13')]['query'](util[_0xbd0b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x53d5e8,_0x40b075),{'type':dbH[_0xbd0b('0x13')][_0xbd0b('0x1a')][_0xbd0b('0x16')]}));}}else{_0x3183cf[_0xbd0b('0x19')](dbH['sequelize'][_0xbd0b('0x14')](QUERY,{'type':dbH[_0xbd0b('0x13')][_0xbd0b('0x1a')]['SELECT']}));}}var _0x1c5b52=path['dirname'](PATH);var _0xc66b8=path[_0xbd0b('0x1b')](PATH,_0xbd0b('0x1c'));var _0x17a92a=_0x51cf98[_0xbd0b('0x10')]&&_0x3183cf['length']>0x1;var _0x75909f=[];if(!fs['existsSync'](path[_0xbd0b('0x1d')](_0x1c5b52,_0xc66b8))&&_0x17a92a){fs[_0xbd0b('0x1e')](path[_0xbd0b('0x1d')](_0x1c5b52,_0xc66b8));}return BPromise[_0xbd0b('0x1f')](_0x3183cf,function(_0xfd9f82){_0x75909f[_0xbd0b('0x19')](_0xfd9f82);})['then'](function(){for(var _0x382f76=0x0;_0x382f76<_0x75909f[_0xbd0b('0x20')];_0x382f76+=0x1){var _0x33b752;var _0x1b5a00=_0x75909f[_0x382f76];if(_0x17a92a){_0x33b752=path[_0xbd0b('0x1d')](_0x1c5b52,_0xc66b8,util[_0xbd0b('0xd')]('%s%d.%s',_0xc66b8,_0x382f76,_0xbd0b('0x21')));}else{_0x33b752=path[_0xbd0b('0x1d')](_0x1c5b52,util[_0xbd0b('0xd')]('%s.%s',_0xc66b8,'csv'));}fs[_0xbd0b('0x22')](_0x33b752,csv(_0x1b5a00));}})[_0xbd0b('0x12')](function(){if(_0x17a92a){zipdir(path[_0xbd0b('0x1d')](_0x1c5b52,_0xc66b8),{'saveTo':path[_0xbd0b('0x1d')](_0x1c5b52,util[_0xbd0b('0xd')](_0xbd0b('0x23'),_0xc66b8,_0xbd0b('0x24')))},function(_0x4bc752,_0x45f7d6){});rimraf(path[_0xbd0b('0x1d')](_0x1c5b52,_0xc66b8),function(){});}})['then'](function(){logger['info'](util[_0xbd0b('0xd')](_0xbd0b('0x25'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbd0b('0x26'),_0x17a92a?util[_0xbd0b('0xd')](_0xbd0b('0x23'),_0xc66b8,_0x17a92a?_0xbd0b('0x24'):_0xbd0b('0x21')):null);});})[_0xbd0b('0x27')](function(_0x5f224e){logger[_0xbd0b('0xc')](util[_0xbd0b('0xd')](_0xbd0b('0x28'),EXTRACTED_REPORT_ID,_0xbd0b('0xe')),util[_0xbd0b('0x29')](_0x5f224e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbd0b('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 072f833..3757c3a 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(_0x49b773,_0x55629e){var _0x12f68b=function(_0x73c7fc){while(--_0x73c7fc){_0x49b773['push'](_0x49b773['shift']());}};_0x12f68b(++_0x55629e);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbf81d8,_0x546bfb){_0xbf81d8=_0xbf81d8-0x0;var _0x182d12=_0x5f2f[_0xbf81d8];return _0x182d12;};'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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x36a23a,_0x5ca5ed){var _0x3620ea=function(_0x293988){while(--_0x293988){_0x36a23a['push'](_0x36a23a['shift']());}};_0x3620ea(++_0x5ca5ed);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 20934ad..27f93ce 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 _0xe5ee=['num','Empty','length','push','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT'];(function(_0xc10ab5,_0x398c72){var _0x5ebfd7=function(_0x44cfcc){while(--_0x44cfcc){_0xc10ab5['push'](_0xc10ab5['shift']());}};_0x5ebfd7(++_0x398c72);}(_0xe5ee,0x8f));var _0xee5e=function(_0x49d145,_0x532c15){_0x49d145=_0x49d145-0x0;var _0x33a234=_0xe5ee[_0x49d145];return _0x33a234;};'use strict';var util=require(_0xee5e('0x0'));var path=require(_0xee5e('0x1'));var _=require(_0xee5e('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xee5e('0x3'));var zipdir=require(_0xee5e('0x4'));var rimraf=require(_0xee5e('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xee5e('0x6')];var logger=require(_0xee5e('0x7'))(_0xee5e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xee5e('0x9')][0x2]);var QUERY=process[_0xee5e('0x9')][0x3];var PATH=process[_0xee5e('0x9')][0x4];function analyticExtractedReport(_0x413988,_0x4deade){var _0x4c2615={'status':_0x413988};var _0x2e0ef9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4deade){_0x4c2615['savename']=_0x4deade;}return db[_0xee5e('0xa')][_0xee5e('0xb')](_0x4c2615,_0x2e0ef9);}function main(){var _0x4d3df5=0x1388;var _0x260990;logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0xe'),EXTRACTED_REPORT_ID,_0xee5e('0xf')));return db[_0xee5e('0x10')][_0xee5e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xee5e('0x12'),_0xee5e('0x13')]})[_0xee5e('0x14')](function(_0x59fddd){if(_0x59fddd){_0x260990=_0x59fddd;_0x4d3df5=_0x260990['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xee5e('0x15')](util[_0xee5e('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xee5e('0x16')][_0xee5e('0x17')][_0xee5e('0x18')]});})[_0xee5e('0x14')](function(_0x2884a3){if(!_0x2884a3[0x0][_0xee5e('0x19')]){return analyticExtractedReport(_0xee5e('0x1a'));}var _0x2aa865=[];var _0x96961c=0x0;var _0x15950a=!![];if(_0x260990[_0xee5e('0x12')]){if(_0x2884a3&&_0x2884a3[_0xee5e('0x1b')]){var _0x51cef6=_0x2884a3[0x0][_0xee5e('0x19')]%(_0x96961c+_0x4d3df5);for(;_0x15950a;_0x96961c+=_0x4d3df5,_0x51cef6=_0x2884a3[0x0][_0xee5e('0x19')]%(_0x96961c+_0x4d3df5)){if(_0x51cef6==0x0||_0x51cef6==_0x2884a3[0x0][_0xee5e('0x19')]){_0x15950a=![];}_0x2aa865[_0xee5e('0x1c')](dbH[_0xee5e('0x16')]['query'](util[_0xee5e('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4d3df5,_0x96961c),{'type':dbH[_0xee5e('0x16')]['QueryTypes'][_0xee5e('0x18')]}));}}}else{_0x2aa865[_0xee5e('0x1c')](dbH[_0xee5e('0x16')][_0xee5e('0x15')](QUERY,{'type':dbH['sequelize'][_0xee5e('0x17')][_0xee5e('0x18')]}));}var _0x2afb2a=path[_0xee5e('0x1d')](PATH);var _0x1cfdad=path['basename'](PATH,_0xee5e('0x1e'));var _0x2ddfbf=_0x260990[_0xee5e('0x12')]&&_0x2aa865['length']>0x1;var _0x573d58=[];if(!fs[_0xee5e('0x1f')](path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad))&&_0x2ddfbf){fs[_0xee5e('0x21')](path['join'](_0x2afb2a,_0x1cfdad));}return BPromise[_0xee5e('0x22')](_0x2aa865,function(_0x453b4f){_0x573d58[_0xee5e('0x1c')](_0x453b4f);})['then'](function(){for(var _0x2b11e0=0x0;_0x2b11e0<_0x573d58['length'];_0x2b11e0+=0x1){var _0x4b81f4;var _0x514f37=_0x573d58[_0x2b11e0];if(_0x2ddfbf){_0x4b81f4=path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad,util[_0xee5e('0xd')](_0xee5e('0x23'),_0x1cfdad,_0x2b11e0,'xlsx'));}else{_0x4b81f4=path['join'](_0x2afb2a,util['format'](_0xee5e('0x24'),_0x1cfdad,_0xee5e('0x25')));}fs['writeFileSync'](_0x4b81f4,json2xls(_0x514f37),_0xee5e('0x26'));}})['then'](function(){if(_0x2ddfbf){zipdir(path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad),{'saveTo':path[_0xee5e('0x20')](_0x2afb2a,util[_0xee5e('0xd')](_0xee5e('0x24'),_0x1cfdad,_0xee5e('0x27')))},function(_0x1bae17,_0x5d8aa0){});rimraf(path[_0xee5e('0x20')](_0x2afb2a,_0x1cfdad),function(){});}})[_0xee5e('0x14')](function(){logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x2ddfbf?util[_0xee5e('0xd')]('%s.%s',_0x1cfdad,_0x2ddfbf?_0xee5e('0x27'):'xlsx'):null);});})['catch'](function(_0x5b314a){logger[_0xee5e('0xc')](util[_0xee5e('0xd')](_0xee5e('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x5b314a,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x11f3=['util','path','lodash','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','mkdirSync','each','%s%d.%s','xlsx','binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x11f3,0x149));var _0x311f=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x11f3[_0xf4129c];return _0x426611;};'use strict';var util=require(_0x311f('0x0'));var path=require(_0x311f('0x1'));var _=require(_0x311f('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x311f('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x311f('0x4'));var db=require(_0x311f('0x5'))['db'];var dbH=require(_0x311f('0x5'))['dbH'];var logger=require('../../config/logger')(_0x311f('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x311f('0x7')][0x3];var PATH=process[_0x311f('0x7')][0x4];function analyticExtractedReport(_0x11c88d,_0x3381a7){var _0x565d4d={'status':_0x11c88d};var _0x24a3fc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3381a7){_0x565d4d[_0x311f('0x8')]=_0x3381a7;}return db[_0x311f('0x9')][_0x311f('0xa')](_0x565d4d,_0x24a3fc);}function main(){var _0x7cd779=0x1388;var _0x495f48;logger[_0x311f('0xb')](util[_0x311f('0xc')](_0x311f('0xd'),EXTRACTED_REPORT_ID,_0x311f('0xe')));return db[_0x311f('0xf')][_0x311f('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x311f('0x11'),_0x311f('0x12')]})[_0x311f('0x13')](function(_0xe68c1e){if(_0xe68c1e){_0x495f48=_0xe68c1e;_0x7cd779=_0x495f48[_0x311f('0x12')]||0x1388;}})[_0x311f('0x13')](function(){return dbH[_0x311f('0x14')][_0x311f('0x15')](util[_0x311f('0xc')](_0x311f('0x16'),QUERY),{'type':dbH[_0x311f('0x14')][_0x311f('0x17')][_0x311f('0x18')]});})['then'](function(_0x4e0362){if(!_0x4e0362[0x0]['num']){return analyticExtractedReport(_0x311f('0x19'));}var _0x38f876=[];var _0x248fca=0x0;var _0x7ff544=!![];if(_0x495f48[_0x311f('0x11')]){if(_0x4e0362&&_0x4e0362[_0x311f('0x1a')]){var _0x2661c2=_0x4e0362[0x0][_0x311f('0x1b')]%(_0x248fca+_0x7cd779);for(;_0x7ff544;_0x248fca+=_0x7cd779,_0x2661c2=_0x4e0362[0x0][_0x311f('0x1b')]%(_0x248fca+_0x7cd779)){if(_0x2661c2==0x0||_0x2661c2==_0x4e0362[0x0]['num']){_0x7ff544=![];}_0x38f876[_0x311f('0x1c')](dbH[_0x311f('0x14')][_0x311f('0x15')](util[_0x311f('0xc')](_0x311f('0x1d'),QUERY,_0x7cd779,_0x248fca),{'type':dbH[_0x311f('0x14')][_0x311f('0x17')][_0x311f('0x18')]}));}}}else{_0x38f876[_0x311f('0x1c')](dbH[_0x311f('0x14')]['query'](QUERY,{'type':dbH[_0x311f('0x14')]['QueryTypes'][_0x311f('0x18')]}));}var _0x4ddf62=path[_0x311f('0x1e')](PATH);var _0x32d9bf=path[_0x311f('0x1f')](PATH,_0x311f('0x20'));var _0x6632c5=_0x495f48[_0x311f('0x11')]&&_0x38f876['length']>0x1;var _0x5a3319=[];if(!fs['existsSync'](path[_0x311f('0x21')](_0x4ddf62,_0x32d9bf))&&_0x6632c5){fs[_0x311f('0x22')](path['join'](_0x4ddf62,_0x32d9bf));}return BPromise[_0x311f('0x23')](_0x38f876,function(_0x2dd2b2){_0x5a3319[_0x311f('0x1c')](_0x2dd2b2);})['then'](function(){for(var _0xd4c4b1=0x0;_0xd4c4b1<_0x5a3319['length'];_0xd4c4b1+=0x1){var _0x14c9c8;var _0x305219=_0x5a3319[_0xd4c4b1];if(_0x6632c5){_0x14c9c8=path[_0x311f('0x21')](_0x4ddf62,_0x32d9bf,util['format'](_0x311f('0x24'),_0x32d9bf,_0xd4c4b1,_0x311f('0x25')));}else{_0x14c9c8=path[_0x311f('0x21')](_0x4ddf62,util['format']('%s.%s',_0x32d9bf,_0x311f('0x25')));}fs['writeFileSync'](_0x14c9c8,json2xls(_0x305219),_0x311f('0x26'));}})[_0x311f('0x13')](function(){if(_0x6632c5){zipdir(path[_0x311f('0x21')](_0x4ddf62,_0x32d9bf),{'saveTo':path[_0x311f('0x21')](_0x4ddf62,util['format'](_0x311f('0x27'),_0x32d9bf,'zip'))},function(_0x198182,_0x931ea0){});rimraf(path[_0x311f('0x21')](_0x4ddf62,_0x32d9bf),function(){});}})['then'](function(){logger[_0x311f('0xb')](util['format'](_0x311f('0x28'),EXTRACTED_REPORT_ID,_0x311f('0xe')));return analyticExtractedReport(_0x311f('0x29'),_0x6632c5?util[_0x311f('0xc')]('%s.%s',_0x32d9bf,_0x6632c5?_0x311f('0x2a'):'xlsx'):null);});})[_0x311f('0x2b')](function(_0x296004){logger[_0x311f('0xb')](util['format'](_0x311f('0x2c'),EXTRACTED_REPORT_ID,_0x311f('0xe')),util[_0x311f('0x2d')](_0x296004,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x311f('0x2e'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8d77c8c..2ae893f 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 _0x91ff=['intervals','models','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','format','CDR(type)=%s','context','VoiceExtensionId','Set','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','outbound','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','app','toLowerCase','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','Interval','findAll','then'];(function(_0x347c9a,_0x5263dd){var _0x44e239=function(_0x4bbc3f){while(--_0x4bbc3f){_0x347c9a['push'](_0x347c9a['shift']());}};_0x44e239(++_0x5263dd);}(_0x91ff,0x15b));var _0xf91f=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x91ff[_0x5e6cb8];return _0x3faeb3;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x2d4c89,_0x4e5c14){var _0x205ff4=this;return _0x2d4c89['models'][_0xf91f('0x0')][_0xf91f('0x1')]({'raw':!![]})[_0xf91f('0x2')](function(_0x443475){_0x205ff4[_0xf91f('0x3')]=_0x443475;return _0x2d4c89[_0xf91f('0x4')][_0xf91f('0x5')]['findAll']({'where':{'IntervalId':_0x4e5c14[_0xf91f('0x6')]},'raw':!![]});})[_0xf91f('0x2')](function(_0x580d9a){return _0x2d4c89[_0xf91f('0x4')]['VoiceExtension'][_0xf91f('0x1')]({'where':{'exten':{'$in':_[_0xf91f('0x7')](_['map'](_0x580d9a,_0xf91f('0x8')))}},'order':[{'raw':_0xf91f('0x9')}],'raw':!![]});})[_0xf91f('0x2')](function(_0x46f206){var _0x151540=_[_0xf91f('0xa')](_0x46f206,{'priority':'1'});var _0x5269b6=_[_0xf91f('0xa')](_0x46f206,{'isApp':0x1});var _0x234b78=_[_0xf91f('0xb')](_0x5269b6,_0xf91f('0x8'));var _0xd07a4d=[_0xf91f('0xc'),_0xf91f('0xd')];var _0x41652d=[];var _0x1dea3d=[];for(var _0x2dd161 in _0x234b78){if(_0x234b78[_0xf91f('0xe')](_0x2dd161)){_0x205ff4[_0xf91f('0xf')]=0x2;_0x205ff4[_0xf91f('0x10')]=[];_0x205ff4[_0xf91f('0x11')]=_['find'](_0x151540,{'exten':_0x234b78[_0x2dd161][0x0]['exten']});_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':'Set','appdata':util[_0xf91f('0x14')](_0xf91f('0x15'),_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')]),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')]==='outbound'){if(_0x205ff4[_0xf91f('0x11')]){_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'CDR(destination)='+(_0x205ff4[_0xf91f('0x11')]['cutdigits']?_0xf91f('0x19')+_0x205ff4['extension'][_0xf91f('0x1a')]+'}':_0xf91f('0x1b')),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'CDR(routeid)='+_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});var _0x270367=_0x205ff4['priority']++;_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x1d')+(_0x270367+0x2)+_0xf91f('0x1e')+(_0x270367+0x1)+')','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x270367,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x205ff4[_0xf91f('0x11')]){_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':'Set','appdata':_0x205ff4[_0xf91f('0x11')][_0xf91f('0x1a')]?_0xf91f('0x1f')+_0x205ff4[_0xf91f('0x11')][_0xf91f('0x1a')]+'}':_0xf91f('0x20'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4['priority']++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x205ff4['extensions'][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x21')+_0x234b78[_0x2dd161][0x0]['VoiceExtensionId'],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});if(_0x205ff4[_0xf91f('0x11')]&&_0x205ff4[_0xf91f('0x11')][_0xf91f('0xe')](_0xf91f('0x22'))&&_0x205ff4[_0xf91f('0x11')]['recordingFormat']!==_0xf91f('0x23')){_0x205ff4['extensions'][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x24'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x25')+_0x205ff4['extension']['recordingFormat']||'wav','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x26'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']});_0x205ff4[_0xf91f('0x10')]['push']({'type':_0x234b78[_0x2dd161][0x0][_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x27'),'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'exten':_0x234b78[_0x2dd161][0x0]['exten'],'priority':_0x205ff4[_0xf91f('0xf')]++,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});for(var _0x3e969d=0x0,_0x1347fc=0x0;_0x3e969d<_0x234b78[_0x2dd161][_0xf91f('0x28')];_0x3e969d+=0x1,_0x1347fc=0x0){var _0x23bbd7=_0x234b78[_0x2dd161][_0x3e969d];if(_0x23bbd7[_0xf91f('0x13')]){_0x23bbd7['type']=_0x23bbd7['type']['toLowerCase']();}var _0x41c96d=[];var _0x2563cf=[];delete _0x23bbd7['id'];delete _0x23bbd7[_0xf91f('0x29')];delete _0x23bbd7[_0xf91f('0x2a')];var _0x15fb74=_0x23bbd7[_0xf91f('0x2b')]!==_0xf91f('0x2c')?[_0x23bbd7[_0xf91f('0x2b')]]:_0x23bbd7['IntervalId']?_[_0xf91f('0x2d')](_[_0xf91f('0xa')](_0x205ff4[_0xf91f('0x3')],{'IntervalId':_0x23bbd7[_0xf91f('0x6')]}),_0xf91f('0x2b')):[];if(_0x23bbd7[_0xf91f('0xe')]('tag')){if(_0x23bbd7['tag']&&_0x23bbd7[_0xf91f('0x2e')]!=='--'){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x2f')+_0x23bbd7[_0xf91f('0x2e')],'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}if(_0x23bbd7[_0xf91f('0x13')]===_0xf91f('0x30')&&_0x23bbd7[_0xf91f('0xe')]('callerID')){if(_0x23bbd7[_0xf91f('0x31')]){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7['type'],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x32')+_0x23bbd7[_0xf91f('0x31')]+')','context':_0x23bbd7['context'],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74['length']+_0x205ff4['priority']+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}else{_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':'ExecIf','appdata':_0xf91f('0x33'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}if(_0x23bbd7[_0xf91f('0xe')](_0xf91f('0x34'))){if(_0xd07a4d['indexOf'](_0x23bbd7[_0xf91f('0x35')][_0xf91f('0x36')]())>=0x0&&_0x23bbd7[_0xf91f('0x37')]!=='custom'){if(_0x23bbd7[_0xf91f('0x34')]){_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7['type'],'app':_0xf91f('0x1c'),'appdata':_0xf91f('0x38'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4['priority']+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});_0x41c96d['push']({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x39'),'context':_0x23bbd7['context'],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7['VoiceExtensionId']});}else{_0x41c96d['push']({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x1c'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});_0x41c96d[_0xf91f('0x12')]({'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x18'),'appdata':_0xf91f('0x3a'),'context':_0x23bbd7[_0xf91f('0x16')],'exten':_0x23bbd7[_0xf91f('0x8')],'priority':_0x15fb74[_0xf91f('0x28')]+_0x205ff4[_0xf91f('0xf')]+_0x1347fc++,'VoiceExtensionId':_0x23bbd7[_0xf91f('0x17')]});}}}for(var _0x48f0a7=0x0;_0x48f0a7<_0x15fb74[_0xf91f('0x28')];_0x48f0a7+=0x1){var _0x598e7e=_0x205ff4[_0xf91f('0xf')]+_0x15fb74[_0xf91f('0x28')];var _0x5b9d6c=_0x48f0a7===_0x15fb74[_0xf91f('0x28')]-0x1?_0x205ff4[_0xf91f('0xf')]+_0x41c96d[_0xf91f('0x28')]+_0x2563cf['length']+0x2:_0x205ff4['priority']+_0x48f0a7+0x1;_0x41c96d[_0xf91f('0x3b')](_0x48f0a7,0x0,{'type':_0x23bbd7[_0xf91f('0x13')],'app':_0xf91f('0x3c'),'appdata':_0x15fb74[_0x48f0a7]+'?'+_0x23bbd7[_0xf91f('0x16')]+_0xf91f('0x3d')+_0x598e7e+':'+_0x23bbd7[_0xf91f('0x16')]+',${EXTEN},'+_0x5b9d6c,'exten':_0x23bbd7['exten'],'context':_0x23bbd7[_0xf91f('0x16')],'priority':_0x205ff4[_0xf91f('0xf')]+_0x48f0a7,'VoiceExtensionId':_0x234b78[_0x2dd161][0x0][_0xf91f('0x17')]});}_0x23bbd7[_0xf91f('0xf')]=_0x41c96d[_0xf91f('0x28')]?_[_0xf91f('0x3e')](_0x41c96d)[_0xf91f('0xf')]+0x1:_0x205ff4[_0xf91f('0xf')];_0x205ff4['priority']=(_0x2563cf[_0xf91f('0x28')]?_[_0xf91f('0x3e')](_0x2563cf)[_0xf91f('0xf')]:_0x23bbd7[_0xf91f('0xf')])+0x1;_0x205ff4[_0xf91f('0x10')]=_[_0xf91f('0x3f')](_0x205ff4[_0xf91f('0x10')],_0x41c96d,[_0x23bbd7],_0x2563cf);}_0x205ff4[_0xf91f('0x10')][_0xf91f('0x12')]({'type':_0x234b78[_0x2dd161][0x0]['type'],'app':_0xf91f('0x40'),'exten':_0x234b78[_0x2dd161][0x0][_0xf91f('0x8')],'context':_0x234b78[_0x2dd161][0x0][_0xf91f('0x16')],'priority':_0x205ff4[_0xf91f('0xf')],'VoiceExtensionId':_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']});_0x41652d[_0xf91f('0x12')](_0x234b78[_0x2dd161][0x0]['VoiceExtensionId']);_0x1dea3d=_[_0xf91f('0x3f')](_0x1dea3d,_0x205ff4[_0xf91f('0x10')]);}}return _0x2d4c89[_0xf91f('0x41')](function(_0x21556c){return _0x2d4c89[_0xf91f('0x4')]['VoiceExtension'][_0xf91f('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x41652d}},'transaction':_0x21556c})[_0xf91f('0x2')](function(_0x31f9af){return _0x2d4c89[_0xf91f('0x4')][_0xf91f('0x5')][_0xf91f('0x43')](_[_0xf91f('0x44')](_0x1dea3d,_0xf91f('0xf')),{'transaction':_0x21556c});});});})['catch'](function(_0x49adee){console[_0xf91f('0x45')](_0x49adee);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xf9b2=['*,*,*,*','map','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','queue','hasOwnProperty','priority','find','extensions','push','type','CDR(type)=%s','VoiceExtensionId','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','Set','CDR(routeid)=','context','ExecIf','):Goto(','CDR(prefix)=noprefix','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval'];(function(_0x3a2147,_0x38bb13){var _0x49036b=function(_0x1cc4d2){while(--_0x1cc4d2){_0x3a2147['push'](_0x3a2147['shift']());}};_0x49036b(++_0x38bb13);}(_0xf9b2,0x9a));var _0x2f9b=function(_0x557eab,_0x5a7381){_0x557eab=_0x557eab-0x0;var _0x29ef81=_0xf9b2[_0x557eab];return _0x29ef81;};'use strict';var _=require(_0x2f9b('0x0'));var util=require(_0x2f9b('0x1'));function rewrite(_0x268782,_0xc36301){var _0x5c4234=this;return _0x268782[_0x2f9b('0x2')]['Interval'][_0x2f9b('0x3')]({'raw':!![]})['then'](function(_0x59c731){_0x5c4234[_0x2f9b('0x4')]=_0x59c731;return _0x268782[_0x2f9b('0x2')][_0x2f9b('0x5')][_0x2f9b('0x3')]({'where':{'IntervalId':_0xc36301[_0x2f9b('0x6')]},'raw':!![]});})[_0x2f9b('0x7')](function(_0xcf6aea){return _0x268782['models'][_0x2f9b('0x5')][_0x2f9b('0x3')]({'where':{'exten':{'$in':_[_0x2f9b('0x8')](_['map'](_0xcf6aea,_0x2f9b('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x2f9b('0x7')](function(_0x453a55){var _0x2063f5=_[_0x2f9b('0xa')](_0x453a55,{'priority':'1'});var _0x1d2e47=_[_0x2f9b('0xa')](_0x453a55,{'isApp':0x1});var _0x5c7983=_[_0x2f9b('0xb')](_0x1d2e47,_0x2f9b('0x9'));var _0x3f1f5e=[_0x2f9b('0xc'),'playback'];var _0x5873ad=[];var _0x23cf2b=[];for(var _0x47a95c in _0x5c7983){if(_0x5c7983[_0x2f9b('0xd')](_0x47a95c)){_0x5c4234[_0x2f9b('0xe')]=0x2;_0x5c4234['extensions']=[];_0x5c4234['extension']=_[_0x2f9b('0xf')](_0x2063f5,{'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')]});_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':'Set','appdata':util['format'](_0x2f9b('0x13'),_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')]),'context':_0x5c7983[_0x47a95c][0x0]['context'],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234['priority']++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});if(_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')]==='outbound'){if(_0x5c4234[_0x2f9b('0x15')]){_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':'Set','appdata':_0x2f9b('0x16')+(_0x5c4234[_0x2f9b('0x15')][_0x2f9b('0x17')]?_0x2f9b('0x18')+_0x5c4234['extension'][_0x2f9b('0x17')]+'}':_0x2f9b('0x19')),'context':_0x5c7983[_0x47a95c][0x0]['context'],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});}_0x5c4234[_0x2f9b('0x10')]['push']({'type':_0x5c7983[_0x47a95c][0x0]['type'],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x1b')+_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')],'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});var _0x307de3=_0x5c4234[_0x2f9b('0xe')]++;_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0]['type'],'app':_0x2f9b('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x307de3+0x2)+_0x2f9b('0x1e')+(_0x307de3+0x1)+')','context':_0x5c7983[_0x47a95c][0x0]['context'],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x307de3,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});if(_0x5c4234[_0x2f9b('0x15')]){_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':_0x5c4234[_0x2f9b('0x15')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x5c4234['extension']['cutdigits']+'}':_0x2f9b('0x1f'),'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0]['VoiceExtensionId']});}_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':'outboundrouteid='+_0x5c7983[_0x47a95c][0x0]['VoiceExtensionId'],'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});if(_0x5c4234[_0x2f9b('0x15')]&&_0x5c4234[_0x2f9b('0x15')]['hasOwnProperty'](_0x2f9b('0x20'))&&_0x5c4234[_0x2f9b('0x15')][_0x2f9b('0x20')]!=='none'){_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0]['type'],'app':_0x2f9b('0x1a'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5c4234[_0x2f9b('0x15')][_0x2f9b('0x20')]||_0x2f9b('0x21'),'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});}}_0x5c4234[_0x2f9b('0x10')]['push']({'type':_0x5c7983[_0x47a95c][0x0]['type'],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x22'),'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});_0x5c4234[_0x2f9b('0x10')]['push']({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x23'),'context':_0x5c7983[_0x47a95c][0x0]['context'],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234['priority']++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});_0x5c4234['extensions'][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x24'),'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'priority':_0x5c4234[_0x2f9b('0xe')]++,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});for(var _0x116ac2=0x0,_0x49b646=0x0;_0x116ac2<_0x5c7983[_0x47a95c]['length'];_0x116ac2+=0x1,_0x49b646=0x0){var _0x27a73e=_0x5c7983[_0x47a95c][_0x116ac2];if(_0x27a73e[_0x2f9b('0x12')]){_0x27a73e[_0x2f9b('0x12')]=_0x27a73e['type'][_0x2f9b('0x25')]();}var _0x34edac=[];var _0x2d837c=[];delete _0x27a73e['id'];delete _0x27a73e[_0x2f9b('0x26')];delete _0x27a73e[_0x2f9b('0x27')];var _0x559a73=_0x27a73e[_0x2f9b('0x28')]!==_0x2f9b('0x29')?[_0x27a73e[_0x2f9b('0x28')]]:_0x27a73e[_0x2f9b('0x6')]?_[_0x2f9b('0x2a')](_[_0x2f9b('0xa')](_0x5c4234[_0x2f9b('0x4')],{'IntervalId':_0x27a73e[_0x2f9b('0x6')]}),'interval'):[];if(_0x27a73e[_0x2f9b('0xd')]('tag')){if(_0x27a73e[_0x2f9b('0x2b')]&&_0x27a73e[_0x2f9b('0x2b')]!=='--'){_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e[_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x2c')+_0x27a73e[_0x2f9b('0x2b')],'context':_0x27a73e['context'],'exten':_0x27a73e['exten'],'priority':_0x559a73[_0x2f9b('0x2d')]+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});}}if(_0x27a73e[_0x2f9b('0x12')]==='outbound'&&_0x27a73e[_0x2f9b('0xd')](_0x2f9b('0x2e'))){if(_0x27a73e['callerID']){_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e['type'],'app':_0x2f9b('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x27a73e[_0x2f9b('0x2e')]+')','context':_0x27a73e[_0x2f9b('0x1c')],'exten':_0x27a73e[_0x2f9b('0x9')],'priority':_0x559a73[_0x2f9b('0x2d')]+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});}else{_0x34edac['push']({'type':_0x27a73e['type'],'app':_0x2f9b('0x1d'),'appdata':_0x2f9b('0x2f'),'context':_0x27a73e[_0x2f9b('0x1c')],'exten':_0x27a73e['exten'],'priority':_0x559a73['length']+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});}}if(_0x27a73e[_0x2f9b('0xd')](_0x2f9b('0x30'))){if(_0x3f1f5e[_0x2f9b('0x31')](_0x27a73e[_0x2f9b('0x32')]['toLowerCase']())>=0x0&&_0x27a73e[_0x2f9b('0x33')]!==_0x2f9b('0x34')){if(_0x27a73e['answer']){_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e[_0x2f9b('0x12')],'app':_0x2f9b('0x1d'),'appdata':_0x2f9b('0x35'),'context':_0x27a73e[_0x2f9b('0x1c')],'exten':_0x27a73e[_0x2f9b('0x9')],'priority':_0x559a73[_0x2f9b('0x2d')]+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e[_0x2f9b('0x12')],'app':_0x2f9b('0x1a'),'appdata':_0x2f9b('0x36'),'context':_0x27a73e[_0x2f9b('0x1c')],'exten':_0x27a73e['exten'],'priority':_0x559a73[_0x2f9b('0x2d')]+_0x5c4234['priority']+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});}else{_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e['type'],'app':_0x2f9b('0x1d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x27a73e['context'],'exten':_0x27a73e[_0x2f9b('0x9')],'priority':_0x559a73[_0x2f9b('0x2d')]+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});_0x34edac[_0x2f9b('0x11')]({'type':_0x27a73e[_0x2f9b('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x27a73e[_0x2f9b('0x1c')],'exten':_0x27a73e[_0x2f9b('0x9')],'priority':_0x559a73['length']+_0x5c4234[_0x2f9b('0xe')]+_0x49b646++,'VoiceExtensionId':_0x27a73e[_0x2f9b('0x14')]});}}}for(var _0x27590c=0x0;_0x27590c<_0x559a73['length'];_0x27590c+=0x1){var _0xae61f=_0x5c4234[_0x2f9b('0xe')]+_0x559a73[_0x2f9b('0x2d')];var _0x42cb6b=_0x27590c===_0x559a73['length']-0x1?_0x5c4234[_0x2f9b('0xe')]+_0x34edac[_0x2f9b('0x2d')]+_0x2d837c[_0x2f9b('0x2d')]+0x2:_0x5c4234[_0x2f9b('0xe')]+_0x27590c+0x1;_0x34edac[_0x2f9b('0x37')](_0x27590c,0x0,{'type':_0x27a73e['type'],'app':'GotoIfTime','appdata':_0x559a73[_0x27590c]+'?'+_0x27a73e['context']+_0x2f9b('0x38')+_0xae61f+':'+_0x27a73e['context']+',${EXTEN},'+_0x42cb6b,'exten':_0x27a73e[_0x2f9b('0x9')],'context':_0x27a73e['context'],'priority':_0x5c4234['priority']+_0x27590c,'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});}_0x27a73e['priority']=_0x34edac[_0x2f9b('0x2d')]?_['last'](_0x34edac)[_0x2f9b('0xe')]+0x1:_0x5c4234[_0x2f9b('0xe')];_0x5c4234[_0x2f9b('0xe')]=(_0x2d837c[_0x2f9b('0x2d')]?_[_0x2f9b('0x39')](_0x2d837c)['priority']:_0x27a73e[_0x2f9b('0xe')])+0x1;_0x5c4234['extensions']=_[_0x2f9b('0x3a')](_0x5c4234['extensions'],_0x34edac,[_0x27a73e],_0x2d837c);}_0x5c4234[_0x2f9b('0x10')][_0x2f9b('0x11')]({'type':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x12')],'app':_0x2f9b('0x3b'),'exten':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x9')],'context':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x1c')],'priority':_0x5c4234[_0x2f9b('0xe')],'VoiceExtensionId':_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]});_0x5873ad[_0x2f9b('0x11')](_0x5c7983[_0x47a95c][0x0][_0x2f9b('0x14')]);_0x23cf2b=_[_0x2f9b('0x3a')](_0x23cf2b,_0x5c4234[_0x2f9b('0x10')]);}}return _0x268782['transaction'](function(_0x5e801b){return _0x268782[_0x2f9b('0x2')][_0x2f9b('0x5')][_0x2f9b('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x5873ad}},'transaction':_0x5e801b})[_0x2f9b('0x7')](function(_0xbbdc99){return _0x268782['models']['VoiceExtension'][_0x2f9b('0x3d')](_[_0x2f9b('0x3e')](_0x23cf2b,_0x2f9b('0xe')),{'transaction':_0x5e801b});});});})[_0x2f9b('0x3f')](function(_0x478454){console[_0x2f9b('0x40')](_0x478454);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5fc84a3..d525aee 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(_0x2b4207,_0x1161eb){var _0x5acc77=function(_0xc9fd13){while(--_0xc9fd13){_0x2b4207['push'](_0x2b4207['shift']());}};_0x5acc77(++_0x1161eb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0xcb91[_0x56e0e8];return _0x2dab50;};'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 _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x21ade4,_0xb35281){var _0x44ef7e=function(_0x5a6362){while(--_0x5a6362){_0x21ade4['push'](_0x21ade4['shift']());}};_0x44ef7e(++_0xb35281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);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(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){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'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1db697c..86b19db 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x7a54,0x106));var _0x47a5=function(_0x27228f,_0x365cf7){_0x27228f=_0x27228f-0x0;var _0xab7fa=_0x7a54[_0x27228f];return _0xab7fa;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x7a54,0x106));var _0x47a5=function(_0x2cb77c,_0x2d4410){_0x2cb77c=_0x2cb77c-0x0;var _0xc4e4f6=_0x7a54[_0x2cb77c];return _0xc4e4f6;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index c7e8f35..b24d516 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x173f=['replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','sequelize','query','spread','length','isNil','phone','AdditionalPhones','push','all','catch','error','message','split','filter','CmContactHasItem','findOne','then','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','insert','into','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','exit','errors','code','main','stringify','start','binding','clone','socket_timestamp','server/files/tmp','.csv','info','body','findAll','name','keys','header','writeFileSync','parse','createReadStream','data','find','hasOwnProperty','trim'];(function(_0x8c616c,_0x525e5b){var _0xa38897=function(_0x30cd6e){while(--_0x30cd6e){_0x8c616c['push'](_0x8c616c['shift']());}};_0xa38897(++_0x525e5b);}(_0x173f,0xca));var _0xf173=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x173f[_0x49d41c];return _0xb64c5f;};'use strict';var fs=require('fs');var path=require(_0xf173('0x0'));var _=require('lodash');var Papa=require(_0xf173('0x1'));var util=require('util');var BPromise=require(_0xf173('0x2'));var moment=require('moment');var squel=require(_0xf173('0x3'));var Redis=require(_0xf173('0x4'));var db=require(_0xf173('0x5'))['db'];var config=require(_0xf173('0x6'));var logger=require(_0xf173('0x7'))(_0xf173('0x8'));config[_0xf173('0x9')]=_[_0xf173('0xa')](config['redis'],{'host':_0xf173('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf173('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf173('0xc')](_0xf173('0xd'));var tempTableName=_0xf173('0xe')+moment()[_0xf173('0xc')](_0xf173('0xf'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x2cc6c3){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))*$/[_0xf173('0x10')](_0x2cc6c3);}function selectNotIn(_0x914db0,_0x8b3979,_0x54f54a,_0x54283e,_0x3d7d0d){return squel[_0xf173('0x11')]()[_0xf173('0x12')]('phone')[_0xf173('0x13')](_0x54283e)[_0xf173('0x14')](_0x8b3979,null,_0x8b3979+_0xf173('0x15')+_0x54283e+'.'+_0x54f54a)[_0xf173('0x16')](_0x54283e+'.'+_0x54f54a+_0xf173('0x17')+_0x914db0+'.'+_0x54f54a)[_0xf173('0x16')](_0x8b3979+'.dialCheckDuplicateType\x20IN\x20('+_0x3d7d0d[_0xf173('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c5492,_0x58e457){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf173('0x18')][_0xf173('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xf173('0x1a')](function(_0x198d09){if(_0x198d09!==null){var _0x9a8ca4=[];for(var _0x191f5a=0x0;_0x191f5a<_0x198d09[_0xf173('0x1b')];_0x191f5a++){var _0x2b1a13=_0x198d09[_0x191f5a];if(!_[_0xf173('0x1c')](_0x2b1a13[_0xf173('0x1d')])){if(!_[_0xf173('0x1c')](_0x2b1a13[_0xf173('0x1e')]))_0x9a8ca4[_0xf173('0x1f')](insertAdditionalPhones(_0x2b1a13));promisesContact['push']({'contact':_0x2b1a13});}}}Promise[_0xf173('0x20')](_0x9a8ca4)['then'](function(){_0x1c5492({'val':0x1});});})[_0xf173('0x21')](function(_0x23ef69){logger[_0xf173('0x22')](_0x23ef69[_0xf173('0x23')]);});});}function insertAdditionalPhones(_0x1d6275){return new Promise(function(_0x179808,_0x3beb8e){var _0x4cc834=_0x1d6275[_0xf173('0x1e')];if(_[_0xf173('0x1c')](_0x4cc834))_0x3beb8e({'val':0x0});else{var _0x17d2af=_0x4cc834[_0xf173('0x24')](';');var _0x36efbc=[];orderBy=0x0;for(var _0x244fbd=0x0;_0x244fbd<_0x17d2af[_0xf173('0x1b')];_0x244fbd++){_0x36efbc[_0xf173('0x1f')](splitAdditionalPhone(_0x1d6275['id'],_0x17d2af[_0x244fbd]));}Promise[_0xf173('0x20')](_0x36efbc)['then'](function(){_0x179808({'val':_0x17d2af[_0xf173('0x1b')]});});}});}function splitAdditionalPhone(_0x5701b2,_0x4021bd){return new Promise(function(_0x3bf515,_0x3a88b6){var _0x4defa7=_0x4021bd[_0xf173('0x24')](':');var _0x4df9a3=_0x4defa7[0x0];var _0x38e191=_0x4defa7[0x1];if(_0x38e191!==''){var _0x1df23a=_0x38e191['split']('|');var _0x4c3ba9=[];for(var _0x2e7138=0x0;_0x2e7138<_0x1df23a[_0xf173('0x1b')];_0x2e7138++){if(_0x1df23a[_0x2e7138]!==''){var _0xfe2fe8=_[_0xf173('0x25')](promisesAdditionalPhones,{'contactId':_0x5701b2,'phone':_0x1df23a[_0x2e7138]});if(_0xfe2fe8[_0xf173('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xf173('0x1f')]({'contactId':_0x5701b2,'contactTypeId':_0x4df9a3,'phone':_0x1df23a[_0x2e7138],'orderBy':orderBy});}}}_0x3bf515({'ok':0x1});}else _0x3bf515({'res':0x0});});}function createAdditionalPhone(_0x30bbd7,_0x226078,_0x5179ec,_0x400556){return new Promise(function(_0x2284af,_0x4ad57d){return db[_0xf173('0x26')][_0xf173('0x27')]({'where':{'CmContactId':_0x30bbd7,'item':_0x5179ec}})[_0xf173('0x28')](function(_0x256d8d){if(_0x256d8d){return db['CmContactHasItem']['update']({'ItemTypeId':_0x226078,'OrderBy':_0x400556},{'where':{'CmContactId':_0x30bbd7,'item':_0x5179ec}})[_0xf173('0x28')](function(_0x1cc28f){_0x2284af({'res':_0xf173('0x29')});});}else{return db['CmContactHasItem'][_0xf173('0x2a')]({'CmContactId':_0x30bbd7,'item':_0x5179ec,'ItemTypeId':_0x226078,'OrderBy':_0x400556,'ItemClass':'PHONE'})[_0xf173('0x28')](function(_0x4ab14f){_0x2284af({'res':_0xf173('0x2b')});});}});});}function updateContact(_0xcd0042){return new Promise(function(_0x4d58a4,_0x1cca28){var _0x59be92=_0xcd0042['id'];delete _0xcd0042['id'];return db[_0xf173('0x2c')]['update'](_0xcd0042,{'where':{'id':_0x59be92}})['then'](function(_0x82c2e7){updatedRows+=0x1;return db[_0xf173('0x2d')]['update']({'phone':_0xcd0042[_0xf173('0x1d')]},{'where':{'ContactId':_0x59be92}})[_0xf173('0x28')](function(_0x2d91f9){_0x4d58a4({'ret':'OK'});});});});}function insertCmHopper(_0x4d36c3,_0x51b65b,_0x30ab11,_0x5e3271,_0x1c4454){var _0x5535f2=[_0xf173('0x2e'),_0xf173('0x2f'),_0xf173('0x30'),_0xf173('0x31'),_0x51b65b+'.'+_0x5e3271,'cm_contacts.createdAt',_0xf173('0x32'),'cm_contacts.priority',_0xf173('0x33'),'\x22'+_0x1c4454+'\x22'];return squel['insert']()['into'](_0xf173('0x34'))[_0xf173('0x35')](['phone',_0xf173('0x36'),_0xf173('0x37'),_0xf173('0x38'),_0x5e3271,'createdAt',_0xf173('0x39'),_0xf173('0x3a'),_0xf173('0x3b'),_0xf173('0x3c')],squel[_0xf173('0x11')]()[_0xf173('0x3d')](_0x5535f2)[_0xf173('0x13')](_0x51b65b)['join'](_0xf173('0x3e'),null,_0xf173('0x3f')+_0x51b65b+_0xf173('0x40'))[_0xf173('0x14')](_0x30ab11,null,_0x30ab11+'.id\x20=\x20'+_0x51b65b+'.'+_0x5e3271)['where'](_0x51b65b+_0xf173('0x41'),_0x4d36c3)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf173('0x16')](_0xf173('0x42'),selectNotIn(_0x51b65b,_0x30ab11,_0x5e3271,_0xf173('0x34'),[_0xf173('0x43'),_0xf173('0x44')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x51b65b,_0x30ab11,_0x5e3271,_0xf173('0x34'),['\x22always\x22'])))[_0xf173('0x45')]();}function insertCmHopperBlack(_0x4935cf,_0x12c3f8,_0x4f1d9c,_0x249313){var _0x4944f3=[_0xf173('0x2e'),'cm_contacts.id',_0xf173('0x31'),_0x12c3f8+'.'+_0x249313,'cm_contacts.createdAt',_0xf173('0x32')];return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x48'))[_0xf173('0x35')]([_0xf173('0x1d'),_0xf173('0x37'),'ListId',_0x249313,'createdAt',_0xf173('0x39')],squel[_0xf173('0x11')]()[_0xf173('0x3d')](_0x4944f3)[_0xf173('0x13')](_0x12c3f8)[_0xf173('0x14')](_0xf173('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x12c3f8+_0xf173('0x40'))[_0xf173('0x14')](_0x4f1d9c,null,_0x4f1d9c+_0xf173('0x15')+_0x12c3f8+'.'+_0x249313)['where'](_0x12c3f8+_0xf173('0x41'),_0x4935cf)[_0xf173('0x16')](_0xf173('0x49'),NOW)[_0xf173('0x16')](_0xf173('0x42'),squel[_0xf173('0x11')]()[_0xf173('0x12')](_0xf173('0x1d'))['from'](_0xf173('0x48'))[_0xf173('0x16')](_0xf173('0x4a'),_0x4935cf)[_0xf173('0x16')](_0x249313+'\x20=\x20?',_0x12c3f8+'.'+_0x249313)))['toString']();}function insertCmHopperAdditionalPhones(_0x4a68d6){var _0x5039ba=[_0xf173('0x4b'),_0xf173('0x4c'),_0xf173('0x4d'),_0xf173('0x4e'),_0xf173('0x4f')];return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x50'))[_0xf173('0x35')](['CmHopperId',_0xf173('0x1d'),_0xf173('0x51'),_0xf173('0x52'),'updatedAt'],squel[_0xf173('0x11')]()['fields'](_0x5039ba)[_0xf173('0x13')](_0xf173('0x34'))[_0xf173('0x14')](_0xf173('0x3e'),null,_0xf173('0x53'))[_0xf173('0x14')](_0xf173('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x4a68d6)[_0xf173('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xf173('0x45')]();}function insertCmContact(_0x5f5299,_0x32f6eb,_0x354302,_0x1c4f94){var _0x58d21c=_[_0xf173('0x55')](_['keys'](_0x1c4f94),[_0xf173('0x38'),'CompanyId',_0xf173('0x52'),_0xf173('0x39')]);return squel[_0xf173('0x46')]()[_0xf173('0x47')](_0xf173('0x3e'))[_0xf173('0x35')](_0x58d21c,squel[_0xf173('0x11')]()['fields'](_0x58d21c)['from'](_0x32f6eb)['where']('('+_0x354302[_0xf173('0x14')](',')+_0xf173('0x56'),squel[_0xf173('0x11')]()['fields'](_0x354302)['from'](_0xf173('0x3e'))[_0xf173('0x16')](_0xf173('0x4a'),_0x5f5299))[_0xf173('0x16')]('id\x20IN\x20?',squel[_0xf173('0x11')]()['field'](_0xf173('0x57'),_0xf173('0x58'))[_0xf173('0x13')](_0x32f6eb)[_0xf173('0x59')](_0x354302[_0xf173('0x14')](','))))[_0xf173('0x45')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3a5492){logger[_0xf173('0x22')](_0x3a5492[_0xf173('0x23')]);process[_0xf173('0x5a')](0x1);}function handleError(_0x297815,_0x49e6bd){stats[_0xf173('0x5b')]['push']({'name':_0x49e6bd[_0xf173('0x5c')],'message':_0x49e6bd[_0xf173('0x23')],'row':_0x297815});}function handleQuery(_0xc17cc2){logger['info'](_0xc17cc2);return db[_0xf173('0x18')]['query'](_0xc17cc2)[_0xf173('0x1a')](function(_0x1c80f1){results[_0xf173('0x1f')](_0x1c80f1);})[_0xf173('0x21')](function(_0x621351){logger['error'](_0x621351[_0xf173('0x23')]);});}function main(_0x2aec7e,_0x3528d8,_0x44d967,_0xa33cc4){logger['info'](_0xf173('0x5d'),_0x2aec7e,JSON[_0xf173('0x5e')](_0x3528d8));process['send'](_0xf173('0x5f'));var _0xa4c3ff=_0x3528d8[_0xf173('0x60')];var _0x31cfb2=_[_0xf173('0x61')](_0xa4c3ff);var _0x2e42ad=_0x3528d8[_0xf173('0x62')];var _0x443441=path[_0xf173('0x14')](config['root'],_0xf173('0x63'),_0x2e42ad+_0xf173('0x64'));logger[_0xf173('0x65')](_0xf173('0x66'),_0x3528d8);db['ContactItemType'][_0xf173('0x67')]({'raw':!![],'attributes':['id','name']})[_0xf173('0x28')](function(_0x21e743){for(var _0x27fd14=0x0;_0x27fd14<_0x21e743[_0xf173('0x1b')];_0x27fd14++){if(_0x21e743[_0x27fd14][_0xf173('0x68')]in _0xa4c3ff){contactItemTypes[_0xf173('0x1f')](_0x21e743[_0x27fd14]);delete _0x31cfb2[_0x21e743[_0x27fd14]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x31cfb2[_0xf173('0x1e')]='';var _0x2b6dda=_[_0xf173('0x69')](_0x31cfb2)[_0xf173('0x14')]();logger[_0xf173('0x65')](_0xf173('0x6a'),_0x2b6dda);fs[_0xf173('0x6b')](_0x443441,_0x2b6dda+'\x0a');Papa[_0xf173('0x6c')](fs[_0xf173('0x6d')](_0x2aec7e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x976bd2,_0x29c126){try{for(var _0x55927b=0x0,_0x2a5874=[];_0x55927b<_0x976bd2[_0xf173('0x6e')][_0xf173('0x1b')];_0x55927b++){stats['rows']+=0x1;if(_0x976bd2[_0xf173('0x5b')][_0x55927b]){handleError(_0x976bd2[_0xf173('0x6e')][_0x55927b],_0x976bd2[_0xf173('0x5b')][_0x55927b]);}else{var _0x141bd0=[];var _0x44a76b=[];for(var _0x4ce211 in _0xa4c3ff){let _0x1b2180=contactItemTypes[_0xf173('0x6f')](_0x3bab7c=>_0x3bab7c[_0xf173('0x68')]===_0x4ce211);if(_[_0xf173('0x1c')](_0x1b2180)){if(_0xa4c3ff[_0xf173('0x70')](_0x4ce211)){if(_0x976bd2['data'][_0x55927b][_0xa4c3ff[_0x4ce211]]){var _0x54ada2=_[_0xf173('0x71')](_0x976bd2['data'][_0x55927b][_0xa4c3ff[_0x4ce211]][_0xf173('0x72')](/"/g,'\x27'));switch(_0x4ce211){case _0xf173('0x36'):var _0x26b17f=moment(_0x54ada2,_0xf173('0xd'),!![]);if(_0x26b17f[_0xf173('0x73')]()){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0['push'](_0xf173('0x74'));}break;case'priority':var _0x5eb177=parseInt(_0x54ada2);_0x54ada2=_[_0xf173('0x75')](_0x5eb177)||_0x5eb177<0x0||_0x5eb177>0x4?_0xa33cc4?0x3:0x2:_0x5eb177;_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');break;case _0xf173('0x3b'):var _0xa96801=parseInt(_0x54ada2);if(_['isNumber'](_0xa96801)&&_['includes'](_0x44d967,_0xa96801)){_0x2a5874[_0xf173('0x1f')]('\x22'+_0xa96801+'\x22');}else{_0x141bd0[_0xf173('0x1f')](_0xf173('0x76'));}break;case _0xf173('0x77'):if(isEmail(_0x54ada2)){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0['push'](_0xf173('0x78'));}break;case _0xf173('0x79'):var _0x3aaef3=moment(_0x54ada2,_0xf173('0x7a'),!![]);if(_0x3aaef3[_0xf173('0x73')]()){_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}else{_0x141bd0[_0xf173('0x1f')](_0xf173('0x7b'));}break;default:_0x2a5874[_0xf173('0x1f')]('\x22'+_0x54ada2+'\x22');}}else{switch(_0x4ce211){case _0xf173('0x7c'):case _0xf173('0x1d'):_0x141bd0['push'](_0x4ce211+_0xf173('0x7d'));break;default:_0x2a5874[_0xf173('0x1f')]('\x22\x22');}}}}else{var _0x2b8cba='';for(var _0x205333=0x0;_0x205333<_0xa4c3ff[_0x4ce211]['length'];_0x205333++){var _0x54ada2=_[_0xf173('0x71')](_0x976bd2[_0xf173('0x6e')][_0x55927b][_0xa4c3ff[_0x4ce211][_0x205333]][_0xf173('0x72')](/"/g,'\x27'));if(_0x2b8cba=='')_0x2b8cba=_0x54ada2;else _0x2b8cba+='|'+_0x54ada2;}_0x44a76b[_0xf173('0x1f')](_0x1b2180['id']+':'+_0x2b8cba);}}if(hasAdditionalPhones){_0x2a5874['push']('\x22'+_0x44a76b[_0xf173('0x14')](';')+'\x22');}if(_0x141bd0['length']){handleError(_0x976bd2['data'][_0x55927b],{'code':_0xf173('0x7e'),'message':_0x141bd0[_0xf173('0x14')]()});}else{fs[_0xf173('0x7f')](_0x443441,_0x2a5874[_0xf173('0x14')]()+'\x0a');}_0x2a5874=[];}if(!(stats[_0xf173('0x80')]%0xc8)){socket[_0xf173('0x81')](_0xf173('0x82')+_0x2e42ad,stats);stats[_0xf173('0x5b')]=[];}}if(stopped){logger['info'](_0xf173('0x83'));_0x29c126[_0xf173('0x84')]();}}catch(_0x4076e8){handleError(_0x976bd2[_0xf173('0x6e')][_0x55927b],{'code':_0xf173('0x85'),'message':_0x4076e8[_0xf173('0x23')]});logger[_0xf173('0x22')](_0xf173('0x86'),_0x4076e8[_0xf173('0x23')]);}},'complete':function(){try{var _0x178db8=[];var _0x31fd11=tempTableName;_0x178db8[_0xf173('0x1f')](_0xf173('0x87')+_0x31fd11+'\x20LIKE\x20cm_contacts;');logger[_0xf173('0x65')](_0xf173('0x88'),contactItemTypes[_0xf173('0x1b')]);var _0x2d998c=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x443441,_0x31fd11,_0x2b6dda,_0x3528d8[_0xf173('0x38')],_0x3528d8[_0xf173('0x89')]||null,NOW,NOW);if(_[_0xf173('0x1c')](_0xa4c3ff[_0xf173('0x36')])){_0x2d998c+=_0xf173('0x8a');}_0x178db8[_0xf173('0x1f')](_0x2d998c);BPromise[_0xf173('0x8b')](_0x178db8,handleQuery)[_0xf173('0x28')](function(_0x5da48d){BPromise[_0xf173('0x20')]([handleAdditionalPhones()])[_0xf173('0x28')](function(){_0x178db8=[];for(var _0xd43931=0x0;_0xd43931\x20\x20','root','existsSync','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','papaparse','moment','squel','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss'];(function(_0x3466bf,_0x2886dd){var _0x42e29a=function(_0x2fbcee){while(--_0x2fbcee){_0x3466bf['push'](_0x3466bf['shift']());}};_0x42e29a(++_0x2886dd);}(_0xb7b9,0x1c1));var _0x9b7b=function(_0x39ee24,_0x30ecc6){_0x39ee24=_0x39ee24-0x0;var _0x3ffb17=_0xb7b9[_0x39ee24];return _0x3ffb17;};'use strict';var fs=require('fs');var path=require(_0x9b7b('0x0'));var _=require('lodash');var Papa=require(_0x9b7b('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x9b7b('0x2'));var squel=require(_0x9b7b('0x3'));var Redis=require('ioredis');var db=require(_0x9b7b('0x4'))['db'];var config=require(_0x9b7b('0x5'));var logger=require('../../../config/logger')(_0x9b7b('0x6'));config[_0x9b7b('0x7')]=_[_0x9b7b('0x8')](config[_0x9b7b('0x7')],{'host':_0x9b7b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x9b7b('0xa')](_0x9b7b('0xb'));var tempTableName='cm_contacts_temp_'+moment()[_0x9b7b('0xa')](_0x9b7b('0xc'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x372880){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))*$/[_0x9b7b('0xd')](_0x372880);}function selectNotIn(_0x598304,_0x5412ef,_0x446be2,_0x35026a,_0x5d65ee){return squel['select']()[_0x9b7b('0xe')](_0x9b7b('0xf'))[_0x9b7b('0x10')](_0x35026a)['join'](_0x5412ef,null,_0x5412ef+_0x9b7b('0x11')+_0x35026a+'.'+_0x446be2)[_0x9b7b('0x12')](_0x35026a+'.'+_0x446be2+_0x9b7b('0x13')+_0x598304+'.'+_0x446be2)[_0x9b7b('0x12')](_0x5412ef+_0x9b7b('0x14')+_0x5d65ee[_0x9b7b('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1ca6be,_0x3356ea){promisesAdditionalPhones=[];promisesContact=[];return db[_0x9b7b('0x16')][_0x9b7b('0x17')](_0x9b7b('0x18')+tempTableName)[_0x9b7b('0x19')](function(_0x34689b){if(_0x34689b!==null){var _0x25df69=[];for(var _0x5d6d50=0x0;_0x5d6d50<_0x34689b[_0x9b7b('0x1a')];_0x5d6d50++){var _0x3d1f59=_0x34689b[_0x5d6d50];if(!_['isNil'](_0x3d1f59[_0x9b7b('0xf')])){if(!_[_0x9b7b('0x1b')](_0x3d1f59[_0x9b7b('0x1c')]))_0x25df69[_0x9b7b('0x1d')](insertAdditionalPhones(_0x3d1f59));promisesContact[_0x9b7b('0x1d')]({'contact':_0x3d1f59});}}}Promise[_0x9b7b('0x1e')](_0x25df69)[_0x9b7b('0x1f')](function(){_0x1ca6be({'val':0x1});});})[_0x9b7b('0x20')](function(_0xdb81ea){logger[_0x9b7b('0x21')](_0xdb81ea[_0x9b7b('0x22')]);});});}function insertAdditionalPhones(_0x475d7c){return new Promise(function(_0x358db3,_0xa96f1a){var _0x37cf53=_0x475d7c[_0x9b7b('0x1c')];if(_[_0x9b7b('0x1b')](_0x37cf53))_0xa96f1a({'val':0x0});else{var _0x473536=_0x37cf53[_0x9b7b('0x23')](';');var _0x2b078c=[];orderBy=0x0;for(var _0x413fae=0x0;_0x413fae<_0x473536['length'];_0x413fae++){_0x2b078c[_0x9b7b('0x1d')](splitAdditionalPhone(_0x475d7c['id'],_0x473536[_0x413fae]));}Promise[_0x9b7b('0x1e')](_0x2b078c)['then'](function(){_0x358db3({'val':_0x473536[_0x9b7b('0x1a')]});});}});}function splitAdditionalPhone(_0x261584,_0x177c08){return new Promise(function(_0x4f5114,_0x9c6bf1){var _0x172727=_0x177c08['split'](':');var _0x3b9e50=_0x172727[0x0];var _0x5a72dd=_0x172727[0x1];if(_0x5a72dd!==''){var _0x5814b0=_0x5a72dd[_0x9b7b('0x23')]('|');var _0x37a9d3=[];for(var _0x551f05=0x0;_0x551f05<_0x5814b0[_0x9b7b('0x1a')];_0x551f05++){if(_0x5814b0[_0x551f05]!==''){var _0x45069d=_[_0x9b7b('0x24')](promisesAdditionalPhones,{'contactId':_0x261584,'phone':_0x5814b0[_0x551f05]});if(_0x45069d[_0x9b7b('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x261584,'contactTypeId':_0x3b9e50,'phone':_0x5814b0[_0x551f05],'orderBy':orderBy});}}}_0x4f5114({'ok':0x1});}else _0x4f5114({'res':0x0});});}function createAdditionalPhone(_0x22428e,_0x51fb37,_0x46c056,_0x490d15){return new Promise(function(_0x3aede,_0x4ba452){return db[_0x9b7b('0x25')]['findOne']({'where':{'CmContactId':_0x22428e,'item':_0x46c056}})[_0x9b7b('0x1f')](function(_0x3115b6){if(_0x3115b6){return db[_0x9b7b('0x25')][_0x9b7b('0x26')]({'ItemTypeId':_0x51fb37,'OrderBy':_0x490d15},{'where':{'CmContactId':_0x22428e,'item':_0x46c056}})[_0x9b7b('0x1f')](function(_0x4ac457){_0x3aede({'res':_0x9b7b('0x27')});});}else{return db[_0x9b7b('0x25')][_0x9b7b('0x28')]({'CmContactId':_0x22428e,'item':_0x46c056,'ItemTypeId':_0x51fb37,'OrderBy':_0x490d15,'ItemClass':'PHONE'})[_0x9b7b('0x1f')](function(_0x19ea93){_0x3aede({'res':_0x9b7b('0x29')});});}});});}function updateContact(_0x5765e6){return new Promise(function(_0x2f0331,_0x1461aa){var _0x593db6=_0x5765e6['id'];delete _0x5765e6['id'];return db['CmContact'][_0x9b7b('0x26')](_0x5765e6,{'where':{'id':_0x593db6}})['then'](function(_0x282d17){updatedRows+=0x1;return db[_0x9b7b('0x2a')][_0x9b7b('0x26')]({'phone':_0x5765e6['phone']},{'where':{'ContactId':_0x593db6}})['then'](function(_0x5be75a){_0x2f0331({'ret':'OK'});});});});}function insertCmHopper(_0x15d7bc,_0x283619,_0x6a22,_0x5177df,_0x3bdb4f){var _0x53c1a6=[_0x9b7b('0x2b'),_0x9b7b('0x2c'),_0x9b7b('0x2d'),'cm_contacts.ListId',_0x283619+'.'+_0x5177df,_0x9b7b('0x2e'),'cm_contacts.updatedAt',_0x9b7b('0x2f'),_0x9b7b('0x30'),'\x22'+_0x3bdb4f+'\x22'];return squel[_0x9b7b('0x31')]()['into'](_0x9b7b('0x32'))['fromQuery']([_0x9b7b('0xf'),_0x9b7b('0x33'),'ContactId',_0x9b7b('0x34'),_0x5177df,_0x9b7b('0x35'),_0x9b7b('0x36'),_0x9b7b('0x37'),_0x9b7b('0x38'),_0x9b7b('0x39')],squel[_0x9b7b('0x3a')]()[_0x9b7b('0x3b')](_0x53c1a6)[_0x9b7b('0x10')](_0x283619)[_0x9b7b('0x15')](_0x9b7b('0x3c'),null,_0x9b7b('0x3d')+_0x283619+_0x9b7b('0x3e'))[_0x9b7b('0x15')](_0x6a22,null,_0x6a22+'.id\x20=\x20'+_0x283619+'.'+_0x5177df)[_0x9b7b('0x12')](_0x283619+_0x9b7b('0x3f'),_0x15d7bc)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9b7b('0x12')](_0x9b7b('0x40'),selectNotIn(_0x283619,_0x6a22,_0x5177df,'cm_hopper',[_0x9b7b('0x41'),_0x9b7b('0x42')]))[_0x9b7b('0x12')](_0x9b7b('0x40'),selectNotIn(_0x283619,_0x6a22,_0x5177df,_0x9b7b('0x32'),['\x22always\x22'])))[_0x9b7b('0x43')]();}function insertCmHopperBlack(_0x7a5384,_0x381444,_0x3bfe5f,_0x5a637a){var _0x3e55b4=['cm_contacts.phone',_0x9b7b('0x2d'),_0x9b7b('0x44'),_0x381444+'.'+_0x5a637a,_0x9b7b('0x2e'),'cm_contacts.updatedAt'];return squel['insert']()['into'](_0x9b7b('0x45'))[_0x9b7b('0x46')](['phone',_0x9b7b('0x47'),_0x9b7b('0x34'),_0x5a637a,_0x9b7b('0x35'),_0x9b7b('0x36')],squel[_0x9b7b('0x3a')]()[_0x9b7b('0x3b')](_0x3e55b4)[_0x9b7b('0x10')](_0x381444)[_0x9b7b('0x15')](_0x9b7b('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x381444+_0x9b7b('0x3e'))[_0x9b7b('0x15')](_0x3bfe5f,null,_0x3bfe5f+_0x9b7b('0x11')+_0x381444+'.'+_0x5a637a)[_0x9b7b('0x12')](_0x381444+'.CmListId\x20=\x20?',_0x7a5384)[_0x9b7b('0x12')](_0x9b7b('0x48'),NOW)[_0x9b7b('0x12')](_0x9b7b('0x40'),squel[_0x9b7b('0x3a')]()[_0x9b7b('0xe')]('phone')[_0x9b7b('0x10')]('cm_hopper_black')[_0x9b7b('0x12')](_0x9b7b('0x49'),_0x7a5384)[_0x9b7b('0x12')](_0x5a637a+'\x20=\x20?',_0x381444+'.'+_0x5a637a)))[_0x9b7b('0x43')]();}function insertCmHopperAdditionalPhones(_0x8a93e7){var _0x12fbab=['cm_hopper.id',_0x9b7b('0x4a'),_0x9b7b('0x4b'),_0x9b7b('0x4c'),_0x9b7b('0x4d')];return squel[_0x9b7b('0x31')]()[_0x9b7b('0x4e')]('cm_hopper_additional_phones')[_0x9b7b('0x46')]([_0x9b7b('0x4f'),_0x9b7b('0xf'),_0x9b7b('0x50'),_0x9b7b('0x35'),_0x9b7b('0x36')],squel[_0x9b7b('0x3a')]()[_0x9b7b('0x3b')](_0x12fbab)[_0x9b7b('0x10')](_0x9b7b('0x32'))[_0x9b7b('0x15')]('cm_contacts',null,_0x9b7b('0x51'))[_0x9b7b('0x15')](_0x9b7b('0x52'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x9b7b('0x12')](_0x9b7b('0x53'),_0x8a93e7)[_0x9b7b('0x12')](_0x9b7b('0x48'),NOW))[_0x9b7b('0x43')]();}function insertCmContact(_0x1d7483,_0x37c6f5,_0x10a278,_0x2f9efd){var _0x5f1a69=_[_0x9b7b('0x54')](_[_0x9b7b('0x55')](_0x2f9efd),[_0x9b7b('0x34'),_0x9b7b('0x56'),_0x9b7b('0x35'),_0x9b7b('0x36')]);return squel[_0x9b7b('0x31')]()[_0x9b7b('0x4e')](_0x9b7b('0x3c'))[_0x9b7b('0x46')](_0x5f1a69,squel[_0x9b7b('0x3a')]()['fields'](_0x5f1a69)[_0x9b7b('0x10')](_0x37c6f5)[_0x9b7b('0x12')]('('+_0x10a278[_0x9b7b('0x15')](',')+_0x9b7b('0x57'),squel[_0x9b7b('0x3a')]()[_0x9b7b('0x3b')](_0x10a278)[_0x9b7b('0x10')](_0x9b7b('0x3c'))[_0x9b7b('0x12')](_0x9b7b('0x49'),_0x1d7483))[_0x9b7b('0x12')](_0x9b7b('0x58'),squel[_0x9b7b('0x3a')]()[_0x9b7b('0xe')](_0x9b7b('0x59'),_0x9b7b('0x5a'))[_0x9b7b('0x10')](_0x37c6f5)['group'](_0x10a278[_0x9b7b('0x15')](','))))[_0x9b7b('0x43')]();}function handleStop(){logger[_0x9b7b('0x5b')](_0x9b7b('0x5c'));stopped=!![];}function handleUncaughtException(_0x4d1d4e){logger['error'](_0x4d1d4e[_0x9b7b('0x22')]);process['exit'](0x1);}function handleError(_0x5bc991,_0x37bcd5){stats['errors'][_0x9b7b('0x1d')]({'name':_0x37bcd5[_0x9b7b('0x5d')],'message':_0x37bcd5['message'],'row':_0x5bc991});}function handleQuery(_0x5d49ac){logger[_0x9b7b('0x5b')](_0x5d49ac);return db[_0x9b7b('0x16')][_0x9b7b('0x17')](_0x5d49ac)[_0x9b7b('0x19')](function(_0x272a8c){results[_0x9b7b('0x1d')](_0x272a8c);})[_0x9b7b('0x20')](function(_0x21ea3a){logger['error'](_0x21ea3a[_0x9b7b('0x22')]);});}function main(_0x1e9355,_0x40a5ce,_0x32883b,_0x447dfa){logger[_0x9b7b('0x5b')]('main',_0x1e9355,JSON[_0x9b7b('0x5e')](_0x40a5ce));process[_0x9b7b('0x5f')](_0x9b7b('0x60'));var _0xb9566e=_0x40a5ce[_0x9b7b('0x61')];var _0x17ebe6=_['clone'](_0xb9566e);var _0x359879=_0x40a5ce[_0x9b7b('0x62')];var _0x19ba64=path['join'](config['root'],_0x9b7b('0x63'),_0x359879+_0x9b7b('0x64'));logger[_0x9b7b('0x5b')](_0x9b7b('0x65'),_0x40a5ce);db[_0x9b7b('0x66')][_0x9b7b('0x67')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x1e6d88){for(var _0x22e3ae=0x0;_0x22e3ae<_0x1e6d88[_0x9b7b('0x1a')];_0x22e3ae++){if(_0x1e6d88[_0x22e3ae]['name']in _0xb9566e){contactItemTypes[_0x9b7b('0x1d')](_0x1e6d88[_0x22e3ae]);delete _0x17ebe6[_0x1e6d88[_0x22e3ae]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x17ebe6[_0x9b7b('0x1c')]='';var _0x2ad40c=_['keys'](_0x17ebe6)[_0x9b7b('0x15')]();logger[_0x9b7b('0x5b')](_0x9b7b('0x68'),_0x2ad40c);fs[_0x9b7b('0x69')](_0x19ba64,_0x2ad40c+'\x0a');Papa['parse'](fs[_0x9b7b('0x6a')](_0x1e9355),{'header':!![],'skipEmptyLines':!![],'step':function(_0x130ec2,_0xb03d3e){try{for(var _0x1e28b0=0x0,_0x4eae6e=[];_0x1e28b0<_0x130ec2['data'][_0x9b7b('0x1a')];_0x1e28b0++){stats[_0x9b7b('0x6b')]+=0x1;if(_0x130ec2[_0x9b7b('0x6c')][_0x1e28b0]){handleError(_0x130ec2[_0x9b7b('0x6d')][_0x1e28b0],_0x130ec2[_0x9b7b('0x6c')][_0x1e28b0]);}else{var _0x2fcfbf=[];var _0x1a1138=[];for(var _0x27150b in _0xb9566e){let _0x2cd45b=contactItemTypes[_0x9b7b('0x6e')](_0x3f689a=>_0x3f689a[_0x9b7b('0x6f')]===_0x27150b);if(_[_0x9b7b('0x1b')](_0x2cd45b)){if(_0xb9566e[_0x9b7b('0x70')](_0x27150b)){if(_0x130ec2[_0x9b7b('0x6d')][_0x1e28b0][_0xb9566e[_0x27150b]]){var _0x1e4a17=_[_0x9b7b('0x71')](_0x130ec2['data'][_0x1e28b0][_0xb9566e[_0x27150b]][_0x9b7b('0x72')](/"/g,'\x27'));switch(_0x27150b){case _0x9b7b('0x33'):var _0x582637=moment(_0x1e4a17,_0x9b7b('0xb'),!![]);if(_0x582637[_0x9b7b('0x73')]()){_0x4eae6e[_0x9b7b('0x1d')]('\x22'+_0x1e4a17+'\x22');}else{_0x2fcfbf[_0x9b7b('0x1d')](_0x9b7b('0x74'));}break;case _0x9b7b('0x37'):var _0x514494=parseInt(_0x1e4a17);_0x1e4a17=_[_0x9b7b('0x75')](_0x514494)||_0x514494<0x0||_0x514494>0x4?_0x447dfa?0x3:0x2:_0x514494;_0x4eae6e['push']('\x22'+_0x1e4a17+'\x22');break;case _0x9b7b('0x38'):var _0x38f504=parseInt(_0x1e4a17);if(_['isNumber'](_0x38f504)&&_['includes'](_0x32883b,_0x38f504)){_0x4eae6e[_0x9b7b('0x1d')]('\x22'+_0x38f504+'\x22');}else{_0x2fcfbf[_0x9b7b('0x1d')](_0x9b7b('0x76'));}break;case _0x9b7b('0x77'):if(isEmail(_0x1e4a17)){_0x4eae6e[_0x9b7b('0x1d')]('\x22'+_0x1e4a17+'\x22');}else{_0x2fcfbf[_0x9b7b('0x1d')](_0x9b7b('0x78'));}break;case _0x9b7b('0x79'):var _0x1a8bf9=moment(_0x1e4a17,_0x9b7b('0x7a'),!![]);if(_0x1a8bf9[_0x9b7b('0x73')]()){_0x4eae6e['push']('\x22'+_0x1e4a17+'\x22');}else{_0x2fcfbf[_0x9b7b('0x1d')](_0x9b7b('0x7b'));}break;default:_0x4eae6e[_0x9b7b('0x1d')]('\x22'+_0x1e4a17+'\x22');}}else{switch(_0x27150b){case _0x9b7b('0x7c'):case _0x9b7b('0xf'):_0x2fcfbf[_0x9b7b('0x1d')](_0x27150b+'\x20not\x20specified');break;default:_0x4eae6e[_0x9b7b('0x1d')]('\x22\x22');}}}}else{var _0x1777cf='';for(var _0x4e7eb0=0x0;_0x4e7eb0<_0xb9566e[_0x27150b][_0x9b7b('0x1a')];_0x4e7eb0++){var _0x1e4a17=_[_0x9b7b('0x71')](_0x130ec2['data'][_0x1e28b0][_0xb9566e[_0x27150b][_0x4e7eb0]]['replace'](/"/g,'\x27'));if(_0x1777cf=='')_0x1777cf=_0x1e4a17;else _0x1777cf+='|'+_0x1e4a17;}_0x1a1138[_0x9b7b('0x1d')](_0x2cd45b['id']+':'+_0x1777cf);}}if(hasAdditionalPhones){_0x4eae6e[_0x9b7b('0x1d')]('\x22'+_0x1a1138[_0x9b7b('0x15')](';')+'\x22');}if(_0x2fcfbf[_0x9b7b('0x1a')]){handleError(_0x130ec2[_0x9b7b('0x6d')][_0x1e28b0],{'code':_0x9b7b('0x7d'),'message':_0x2fcfbf[_0x9b7b('0x15')]()});}else{fs['appendFileSync'](_0x19ba64,_0x4eae6e[_0x9b7b('0x15')]()+'\x0a');}_0x4eae6e=[];}if(!(stats[_0x9b7b('0x6b')]%0xc8)){socket[_0x9b7b('0x7e')](_0x9b7b('0x7f')+_0x359879,stats);stats[_0x9b7b('0x6c')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0xb03d3e[_0x9b7b('0x80')]();}}catch(_0x3c1333){handleError(_0x130ec2[_0x9b7b('0x6d')][_0x1e28b0],{'code':_0x9b7b('0x81'),'message':_0x3c1333['message']});logger[_0x9b7b('0x21')]('step',_0x3c1333[_0x9b7b('0x22')]);}},'complete':function(){try{var _0x1a2e50=[];var _0x419d6f=tempTableName;_0x1a2e50[_0x9b7b('0x1d')](_0x9b7b('0x82')+_0x419d6f+_0x9b7b('0x83'));logger[_0x9b7b('0x5b')](_0x9b7b('0x84'),contactItemTypes[_0x9b7b('0x1a')]);var _0x3c7e99=util[_0x9b7b('0xa')](_0x9b7b('0x85'),_0x19ba64,_0x419d6f,_0x2ad40c,_0x40a5ce[_0x9b7b('0x34')],_0x40a5ce[_0x9b7b('0x56')]||null,NOW,NOW);if(_[_0x9b7b('0x1b')](_0xb9566e[_0x9b7b('0x33')])){_0x3c7e99+=',\x20scheduledAt\x20=\x20NOW()';}_0x1a2e50[_0x9b7b('0x1d')](_0x3c7e99);BPromise[_0x9b7b('0x86')](_0x1a2e50,handleQuery)[_0x9b7b('0x1f')](function(_0x2f4a20){BPromise[_0x9b7b('0x1e')]([handleAdditionalPhones()])[_0x9b7b('0x1f')](function(){_0x1a2e50=[];for(var _0x4f0834=0x0;_0x4f0834=_0x319a91){return _0x3fc573[_0x35e3('0x11')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x3a0adc)});}_0x299563();})[_0x35e3('0x12')](function(_0x4e40ed){_0x299563(_0x4e40ed);});});}function isUserLimit(){return isLimit(_0x35e3('0x13'),0x1,db[_0x35e3('0x14')],{'where':{'$or':[{'role':_0x35e3('0x15')},{'role':'user'}]}});}exports[_0x35e3('0x16')]=isUserLimit; \ No newline at end of file +var _0x35c9=['findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','utf8','parse','hasOwnProperty','use','License'];(function(_0x45b35a,_0x3bfdc3){var _0x3597de=function(_0x1b9b7b){while(--_0x1b9b7b){_0x45b35a['push'](_0x45b35a['shift']());}};_0x3597de(++_0x3bfdc3);}(_0x35c9,0x186));var _0x935c=function(_0x249344,_0xb2d03d){_0x249344=_0x249344-0x0;var _0x5c45e4=_0x35c9[_0x249344];return _0x5c45e4;};'use strict';var crypto=require(_0x935c('0x0'));var util=require(_0x935c('0x1'));var compose=require('composable-middleware');var db=require(_0x935c('0x2'))['db'];var config=require(_0x935c('0x3'));function getValueFromLicense(_0x2e12c3,_0x4e6e1a){if(_0x2e12c3&&_0x4e6e1a){if(_0x4e6e1a[_0x935c('0x4')]&&_0x4e6e1a[_0x935c('0x5')]){var _0x3da016=_0x4e6e1a[_0x935c('0x4')];var _0x39f4ca=_0x4e6e1a[_0x935c('0x5')];var _0x57e12c=_0x3da016[_0x935c('0x6')]('-')[0x4];var _0x5503f6=_0x3da016[_0x935c('0x6')]('-')[0x0];var _0x201b05=crypto[_0x935c('0x7')](_0x935c('0x8'),util['format'](_0x935c('0x9'),_0x57e12c,_0x3da016,_0x5503f6));var _0x17e129=_0x201b05['update'](_0x39f4ca,'base64','utf8');_0x17e129+=_0x201b05['final'](_0x935c('0xa'));var _0x52e2f8=JSON[_0x935c('0xb')](_0x17e129);return _0x52e2f8[_0x935c('0xc')](_0x2e12c3)?_0x52e2f8[_0x2e12c3]:null;}}return null;}function isLimit(_0xf7d62e,_0x1d72a,_0xbf8cba,_0x59b2b8){var _0x1292ee=_0x1d72a;return compose()[_0x935c('0xd')](function(_0x4e5359,_0xfc140e,_0x1e65d4){return db[_0x935c('0xe')][_0x935c('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2dfd5b){var _0x5abc95=getValueFromLicense(_0xf7d62e,_0x2dfd5b);return _0x5abc95?_0x5abc95:_0x1292ee;})[_0x935c('0x10')](function(_0x244c0c){_0x1292ee=_0x244c0c;return _0xbf8cba[_0x935c('0x11')](_0x59b2b8);})['then'](function(_0x28e5bf){if(_0x28e5bf>=_0x1292ee){return _0xfc140e[_0x935c('0x12')](0x193)[_0x935c('0x13')]({'message':util[_0x935c('0x14')](_0x935c('0x15'),_0xf7d62e)});}_0x1e65d4();})[_0x935c('0x16')](function(_0x19be0f){_0x1e65d4(_0x19be0f);});});}function isUserLimit(){return isLimit(_0x935c('0x17'),0x1,db[_0x935c('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x935c('0x19')}]}});}exports[_0x935c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b73ee15..1ad999c 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 _0xbb2b=['DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<=\x20?','$gte','start','pop','utcOffset','hours','minutes','seconds','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','filter','conditions','buildExpression'];(function(_0x27eada,_0x2bd420){var _0x13e38c=function(_0x1cb743){while(--_0x1cb743){_0x27eada['push'](_0x27eada['shift']());}};_0x13e38c(++_0x2bd420);}(_0xbb2b,0x143));var _0xbbb2=function(_0x5a1496,_0x3c039b){_0x5a1496=_0x5a1496-0x0;var _0x3a45a4=_0xbb2b[_0x5a1496];return _0x3a45a4;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x1461ce){var _0x5848b2={'conditions':[]};_0x5848b2[_0xbbb2('0x0')]=_['startsWith'](_0x1461ce,_0xbbb2('0x1'))?'or':_0xbbb2('0x2');var _0x3490ca=_0x1461ce[_0xbbb2('0x3')](_0xbbb2('0x4'),'')[_0xbbb2('0x3')](_0xbbb2('0x1'),'')[_0xbbb2('0x5')]('||');for(var _0x4a01db=0x0;_0x4a01db<_0x3490ca[_0xbbb2('0x6')];_0x4a01db++){var _0x46e349=_0x3490ca[_0x4a01db][_0xbbb2('0x5')](':=');var _0x261a7f=_0x46e349[0x0];var _0x55aad4=_0x46e349[_0xbbb2('0x7')](0x1);_0x55aad4[_0xbbb2('0x8')](function(_0x25923a){var _0x402d60=_0x25923a[_0xbbb2('0x5')]('[')[_0xbbb2('0x9')]();var _0x17f7dd=_0x25923a['match'](/\[(.*?)\]/g);_0x17f7dd[_0xbbb2('0x8')](function(_0x2eccb3){var _0x3d5452=_0x2eccb3['split']('[')[_0xbbb2('0xa')](function(_0x39e0aa){return _0x39e0aa['indexOf'](']')>-0x1;})['map'](function(_0x3f4230){return _0x3f4230[_0xbbb2('0x5')](']')[0x0];})[0x0];_0x5848b2[_0xbbb2('0xb')]['push']({'field':_0x261a7f,'operator':_0x402d60,'value':_0x3d5452});});});}return _0x5848b2;};exports[_0xbbb2('0xc')]=function(_0x32d839,_0x49f60a,_0x1a0d32){var _0x1c2475={};if(_0x49f60a===_0xbbb2('0xd')){if(_0x1a0d32[_0xbbb2('0xe')]===_0xbbb2('0xf')){_0x1a0d32[_0xbbb2('0xe')]=_0xbbb2('0x10');_0x1a0d32[_0xbbb2('0x11')]+=','+_0x1a0d32[_0xbbb2('0x11')];}else if(_['includes']([_0xbbb2('0x12'),_0xbbb2('0x13')],_0x1a0d32[_0xbbb2('0xe')])){_0x1a0d32[_0xbbb2('0x11')]=moment(_0x1a0d32[_0xbbb2('0x11')])[_0xbbb2('0x14')](0x1,_0xbbb2('0x15'))[_0xbbb2('0x16')](_0xbbb2('0x17'));}}if(_0x1a0d32[_0xbbb2('0x18')]){_0x49f60a=_0x1a0d32[_0xbbb2('0x18')];_0x1c2475[_0xbbb2('0x19')]='CAST('+_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+_0xbbb2('0x1b')+_0x1a0d32['castTo']+')\x20'+parseOperator(_0x1a0d32['operator']);}else{_0x1c2475['text']=_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+'\x20'+parseOperator(_0x1a0d32[_0xbbb2('0xe')]);}if(_['includes']([_0xbbb2('0x1c'),_0xbbb2('0x1d')],_0x1a0d32[_0xbbb2('0xe')]))_0x1c2475['text']='('+_0x1c2475[_0xbbb2('0x19')]+_0xbbb2('0x1e')+_0x32d839+'.'+_0x1a0d32[_0xbbb2('0x1a')]+_0xbbb2('0x1f');_0x1c2475[_0xbbb2('0x11')]=parseValue(_0x49f60a,_0x1a0d32[_0xbbb2('0xe')],_0x1a0d32[_0xbbb2('0x11')]);return _0x1c2475;};function parseOperator(_0x2b9f82){var _0x3c0ed6;switch(_0x2b9f82){case _0xbbb2('0x20'):_0x3c0ed6=_0xbbb2('0x21');break;case'$notIn':_0x3c0ed6='NOT\x20IN\x20?';break;case _0xbbb2('0xf'):_0x3c0ed6=_0xbbb2('0x22');break;case _0xbbb2('0x1c'):_0x3c0ed6='<>\x20?';break;case _0xbbb2('0x23'):case _0xbbb2('0x24'):case _0xbbb2('0x25'):_0x3c0ed6=_0xbbb2('0x26');break;case _0xbbb2('0x27'):_0x3c0ed6='<\x20?';break;case _0xbbb2('0x12'):_0x3c0ed6='>\x20?';break;case'$lte':_0x3c0ed6=_0xbbb2('0x28');break;case _0xbbb2('0x29'):_0x3c0ed6='>=\x20?';break;case _0xbbb2('0x10'):_0x3c0ed6='BETWEEN\x20?\x20AND\x20?';break;}return _0x3c0ed6;}function parseValue(_0x4130b2,_0x516632,_0x5a7cf5){var _0x2e907b={'start':undefined,'end':undefined};switch(_0x516632){case _0xbbb2('0x20'):case _0xbbb2('0x1d'):_0x2e907b[_0xbbb2('0x2a')]=_0x5a7cf5[_0xbbb2('0x5')](',');break;case'$substring':_0x2e907b[_0xbbb2('0x2a')]='%'+_0x5a7cf5+'%';break;case _0xbbb2('0x24'):_0x2e907b['start']=_0x5a7cf5+'%';break;case _0xbbb2('0x25'):_0x2e907b['start']='%'+_0x5a7cf5;break;case'$between':var _0x18f709=_0x5a7cf5['split'](',');var _0x5a7cf5=_0x18f709['shift']();var _0x1ece9e=_0x18f709[_0xbbb2('0x2b')]();if(_0x4130b2===_0xbbb2('0xd')){_0x5a7cf5=moment(_0x5a7cf5)[_0xbbb2('0x2c')](0x0,!![])[_0xbbb2('0x16')]();_0x1ece9e=moment(_0x1ece9e)['utcOffset'](0x0,!![])[_0xbbb2('0x14')](0x17,_0xbbb2('0x2d'))[_0xbbb2('0x14')](0x3b,_0xbbb2('0x2e'))['add'](0x3b,_0xbbb2('0x2f'))['format']();}_0x2e907b={'start':_0x5a7cf5,'end':_0x1ece9e};break;default:_0x2e907b[_0xbbb2('0x2a')]=_0x5a7cf5;break;}return _0x2e907b;} \ No newline at end of file +var _0xf77d=['$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','hours','seconds','lodash','parseSearch','sqlOperator','startsWith','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','map','push','DATE','operator','$eq','$between','value','includes'];(function(_0x4d0907,_0x3e29fd){var _0x1fc0b2=function(_0x260c0b){while(--_0x260c0b){_0x4d0907['push'](_0x4d0907['shift']());}};_0x1fc0b2(++_0x3e29fd);}(_0xf77d,0x1e2));var _0xdf77=function(_0x3c62ef,_0x4bb6ab){_0x3c62ef=_0x3c62ef-0x0;var _0x4d44f1=_0xf77d[_0x3c62ef];return _0x4d44f1;};'use strict';var _=require(_0xdf77('0x0'));var moment=require('moment');exports[_0xdf77('0x1')]=function(_0x2ae965){var _0x46802c={'conditions':[]};_0x46802c[_0xdf77('0x2')]=_[_0xdf77('0x3')](_0x2ae965,'[$or]')?'or':_0xdf77('0x4');var _0x2c5195=_0x2ae965[_0xdf77('0x5')](_0xdf77('0x6'),'')[_0xdf77('0x5')]('[$or]','')[_0xdf77('0x7')]('||');for(var _0x26189d=0x0;_0x26189d<_0x2c5195[_0xdf77('0x8')];_0x26189d++){var _0x305d1c=_0x2c5195[_0x26189d][_0xdf77('0x7')](':=');var _0xb9bba9=_0x305d1c[0x0];var _0x4c0e1f=_0x305d1c[_0xdf77('0x9')](0x1);_0x4c0e1f[_0xdf77('0xa')](function(_0x2ecb42){var _0x5c9b6d=_0x2ecb42[_0xdf77('0x7')]('[')[_0xdf77('0xb')]();var _0x23f195=_0x2ecb42[_0xdf77('0xc')](/\[(.*?)\]/g);_0x23f195[_0xdf77('0xa')](function(_0x54dd95){var _0x253ccf=_0x54dd95[_0xdf77('0x7')]('[')[_0xdf77('0xd')](function(_0x55ea4e){return _0x55ea4e['indexOf'](']')>-0x1;})[_0xdf77('0xe')](function(_0xf8e59f){return _0xf8e59f[_0xdf77('0x7')](']')[0x0];})[0x0];_0x46802c['conditions'][_0xdf77('0xf')]({'field':_0xb9bba9,'operator':_0x5c9b6d,'value':_0x253ccf});});});}return _0x46802c;};exports['buildExpression']=function(_0x2680d3,_0x2c83b8,_0x8228af){var _0x941312={};if(_0x2c83b8===_0xdf77('0x10')){if(_0x8228af[_0xdf77('0x11')]===_0xdf77('0x12')){_0x8228af[_0xdf77('0x11')]=_0xdf77('0x13');_0x8228af[_0xdf77('0x14')]+=','+_0x8228af['value'];}else if(_[_0xdf77('0x15')](['$gt',_0xdf77('0x16')],_0x8228af['operator'])){_0x8228af[_0xdf77('0x14')]=moment(_0x8228af[_0xdf77('0x14')])[_0xdf77('0x17')](0x1,_0xdf77('0x18'))[_0xdf77('0x19')](_0xdf77('0x1a'));}}if(_0x8228af[_0xdf77('0x1b')]){_0x2c83b8=_0x8228af[_0xdf77('0x1b')];_0x941312[_0xdf77('0x1c')]=_0xdf77('0x1d')+_0x2680d3+'.'+_0x8228af[_0xdf77('0x1e')]+'\x20AS\x20'+_0x8228af['castTo']+')\x20'+parseOperator(_0x8228af[_0xdf77('0x11')]);}else{_0x941312[_0xdf77('0x1c')]=_0x2680d3+'.'+_0x8228af[_0xdf77('0x1e')]+'\x20'+parseOperator(_0x8228af[_0xdf77('0x11')]);}if(_[_0xdf77('0x15')]([_0xdf77('0x1f'),'$notIn'],_0x8228af[_0xdf77('0x11')]))_0x941312[_0xdf77('0x1c')]='('+_0x941312['text']+_0xdf77('0x20')+_0x2680d3+'.'+_0x8228af[_0xdf77('0x1e')]+_0xdf77('0x21');_0x941312[_0xdf77('0x14')]=parseValue(_0x2c83b8,_0x8228af['operator'],_0x8228af[_0xdf77('0x14')]);return _0x941312;};function parseOperator(_0x7d4778){var _0x55bbde;switch(_0x7d4778){case _0xdf77('0x22'):_0x55bbde=_0xdf77('0x23');break;case _0xdf77('0x24'):_0x55bbde=_0xdf77('0x25');break;case _0xdf77('0x12'):_0x55bbde=_0xdf77('0x26');break;case _0xdf77('0x1f'):_0x55bbde=_0xdf77('0x27');break;case _0xdf77('0x28'):case'$startsWith':case'$endsWith':_0x55bbde=_0xdf77('0x29');break;case _0xdf77('0x2a'):_0x55bbde=_0xdf77('0x2b');break;case _0xdf77('0x2c'):_0x55bbde=_0xdf77('0x2d');break;case _0xdf77('0x16'):_0x55bbde=_0xdf77('0x2e');break;case _0xdf77('0x2f'):_0x55bbde=_0xdf77('0x30');break;case _0xdf77('0x13'):_0x55bbde=_0xdf77('0x31');break;}return _0x55bbde;}function parseValue(_0x4c4182,_0x1a7ffd,_0x559213){var _0x54dfad={'start':undefined,'end':undefined};switch(_0x1a7ffd){case _0xdf77('0x22'):case _0xdf77('0x24'):_0x54dfad[_0xdf77('0x32')]=_0x559213['split'](',');break;case'$substring':_0x54dfad[_0xdf77('0x32')]='%'+_0x559213+'%';break;case _0xdf77('0x33'):_0x54dfad['start']=_0x559213+'%';break;case'$endsWith':_0x54dfad['start']='%'+_0x559213;break;case _0xdf77('0x13'):var _0x176d92=_0x559213['split'](',');var _0x559213=_0x176d92[_0xdf77('0xb')]();var _0x3839ca=_0x176d92[_0xdf77('0x34')]();if(_0x4c4182===_0xdf77('0x10')){_0x559213=moment(_0x559213)[_0xdf77('0x35')](0x0,!![])[_0xdf77('0x19')]();_0x3839ca=moment(_0x3839ca)[_0xdf77('0x35')](0x0,!![])[_0xdf77('0x17')](0x17,_0xdf77('0x36'))[_0xdf77('0x17')](0x3b,'minutes')[_0xdf77('0x17')](0x3b,_0xdf77('0x37'))[_0xdf77('0x19')]();}_0x54dfad={'start':_0x559213,'end':_0x3839ca};break;default:_0x54dfad['start']=_0x559213;break;}return _0x54dfad;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 082f36c..755ef77 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 _0xc8ae=['sort','map','indexOf','col','priority','unsigned','ASC','length','omit','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','forEach','join','lodash','sequelize','moment','fields','split','isEmpty','forOwn','type','DATE','parse','$gte','format','utc','$lte','YYYY-MM-DD','subtract','isArray','limit'];(function(_0x419530,_0x118836){var _0x1e9156=function(_0x2cb2f2){while(--_0x2cb2f2){_0x419530['push'](_0x419530['shift']());}};_0x1e9156(++_0x118836);}(_0xc8ae,0x1c2));var _0xec8a=function(_0x537522,_0x845cea){_0x537522=_0x537522-0x0;var _0x3a1154=_0xc8ae[_0x537522];return _0x3a1154;};'use strict';var _=require(_0xec8a('0x0'));var sequelize=require(_0xec8a('0x1'));var moment=require(_0xec8a('0x2'));var LIMIT_VALUE=0xfa;exports[_0xec8a('0x3')]=function(_0xc68d30){var _0x54db43=null;if(_0xc68d30){_0x54db43=_0xc68d30[_0xec8a('0x4')](',');}return _0x54db43;};exports['filters']=function(_0x333353,_0x863994){var _0x1b0523={};if(!_[_0xec8a('0x5')](_0x333353)){_[_0xec8a('0x6')](_0x333353,function(_0x291bd8,_0x2c9d02){try{if(_0x863994){var _0x54463b=_['find'](_0x863994,{'name':_0x2c9d02})||{};if(_0x54463b[_0xec8a('0x7')]===_0xec8a('0x8')&&_['isPlainObject'](_0x291bd8)){var _0x5d1f75=JSON[_0xec8a('0x9')](_0x291bd8);var _0x146fdf={'$gte':moment(moment(_0x5d1f75[_0xec8a('0xa')])[_0xec8a('0xb')]('YYYY-MM-DD'))[_0xec8a('0xc')]()[_0xec8a('0xb')](),'$lte':moment(moment(_0x5d1f75[_0xec8a('0xd')])['format'](_0xec8a('0xe')))[_0xec8a('0xc')]()[_0xec8a('0xf')](0x1,'s')[_0xec8a('0xb')]()};_0x1b0523[_0x2c9d02]=_0x146fdf;}else{_0x1b0523[_0x2c9d02]=_['isArray'](_0x291bd8)?_0x291bd8:JSON[_0xec8a('0x9')](_0x291bd8);}}else{_0x1b0523[_0x2c9d02]=_[_0xec8a('0x10')](_0x291bd8)?_0x291bd8:JSON['parse'](_0x291bd8);}}catch(_0x173f9c){_0x1b0523[_0x2c9d02]=_0x291bd8[_0xec8a('0x4')](',');}});}return _0x1b0523;};exports[_0xec8a('0x11')]=function(_0x519eca){_0x519eca=parseInt(_0x519eca,0xa);if(!_0x519eca||_0x519eca<0x0){_0x519eca=LIMIT_VALUE;}return _0x519eca;};exports['offset']=function(_0x4d798d){_0x4d798d=parseInt(_0x4d798d,0xa);if(!_0x4d798d||_0x4d798d<0x0){_0x4d798d=0x0;}return _0x4d798d;};exports[_0xec8a('0x12')]=function(_0x2e9edd){var _0x13a2d5,_0x4de2b9=null;if(_0x2e9edd){_0x13a2d5=_0x2e9edd[_0xec8a('0x4')](',');_0x4de2b9=_[_0xec8a('0x13')](_0x13a2d5,function(_0xc90b40){if(_0xc90b40[_0xec8a('0x14')]('-')===0x0){return[_0xc90b40==='priority'?sequelize['cast'](sequelize[_0xec8a('0x15')](_0xec8a('0x16')),_0xec8a('0x17')):_0xc90b40['substr'](0x1),'DESC'];}else{return[_0xc90b40===_0xec8a('0x16')?sequelize['cast'](sequelize[_0xec8a('0x15')](_0xec8a('0x16')),_0xec8a('0x17')):_0xc90b40,_0xec8a('0x18')];}});}return _0x4de2b9;};exports['omit']=function(_0x13855b,_0x13a77d){if(_[_0xec8a('0x5')](_0x13855b)){return _0x13855b;}if(_[_0xec8a('0x10')](_0x13855b)){for(var _0x5003ae=0x0;_0x5003ae<_0x13855b[_0xec8a('0x19')];_0x5003ae+=0x1){_0x13855b[_0x5003ae]=this[_0xec8a('0x1a')](_0x13855b[_0x5003ae],_0x13a77d);}return _0x13855b;}if(!_['isObject'](_0x13855b)){return _0x13855b;}if(_[_0xec8a('0x1b')](_0x13a77d)){_0x13a77d=[_0x13a77d];}if(!_[_0xec8a('0x10')](_0x13a77d)){return _0x13855b;}for(var _0x323759=0x0;_0x323759<_0x13a77d[_0xec8a('0x19')];_0x323759+=0x1){_[_0xec8a('0x1c')](_0x13855b,_0x13a77d[_0x323759]);}for(var _0x31ea81 in _0x13855b){if(_0x13855b[_0xec8a('0x1d')](_0x31ea81)){_0x13855b[_0x31ea81]=this[_0xec8a('0x1a')](_0x13855b[_0x31ea81],_0x13a77d);}}return _0x13855b;};exports[_0xec8a('0x1e')]=function(_0x4049e8){return _0x4049e8[_0xec8a('0x1f')](RegExp(_0xec8a('0x20')))?!![]:![];};exports['isEmail']=function(_0x592f0e){return _0x592f0e[_0xec8a('0x1f')](/^\S+@\S+$/)?!![]:![];};exports[_0xec8a('0x21')]=function(_0x55e428){var _0x169a72=[];_0x55e428[_0xec8a('0x4')]('\x20')[_0xec8a('0x22')](function(_0x3447d9){_0x169a72['push']('+'+_0x3447d9['toString']()+'*');});return _0x169a72[_0xec8a('0x23')]('\x20');}; \ No newline at end of file +var _0x9cbe=['forOwn','find','type','DATE','parse','$gte','format','YYYY-MM-DD','$lte','utc','isArray','limit','sort','map','indexOf','col','unsigned','substr','DESC','priority','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','fields','split','filters','isEmpty'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9cbe,0x114));var _0xe9cb=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x9cbe[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0xe9cb('0x0')]=function(_0x2669e1){var _0x411fb9=null;if(_0x2669e1){_0x411fb9=_0x2669e1[_0xe9cb('0x1')](',');}return _0x411fb9;};exports[_0xe9cb('0x2')]=function(_0x3e3b40,_0x5eb793){var _0x15ffe0={};if(!_[_0xe9cb('0x3')](_0x3e3b40)){_[_0xe9cb('0x4')](_0x3e3b40,function(_0xeb2b21,_0x404615){try{if(_0x5eb793){var _0x7894ea=_[_0xe9cb('0x5')](_0x5eb793,{'name':_0x404615})||{};if(_0x7894ea[_0xe9cb('0x6')]===_0xe9cb('0x7')&&_['isPlainObject'](_0xeb2b21)){var _0x4092c7=JSON[_0xe9cb('0x8')](_0xeb2b21);var _0x2ad15f={'$gte':moment(moment(_0x4092c7[_0xe9cb('0x9')])[_0xe9cb('0xa')](_0xe9cb('0xb')))['utc']()[_0xe9cb('0xa')](),'$lte':moment(moment(_0x4092c7[_0xe9cb('0xc')])[_0xe9cb('0xa')](_0xe9cb('0xb')))[_0xe9cb('0xd')]()['subtract'](0x1,'s')[_0xe9cb('0xa')]()};_0x15ffe0[_0x404615]=_0x2ad15f;}else{_0x15ffe0[_0x404615]=_[_0xe9cb('0xe')](_0xeb2b21)?_0xeb2b21:JSON[_0xe9cb('0x8')](_0xeb2b21);}}else{_0x15ffe0[_0x404615]=_[_0xe9cb('0xe')](_0xeb2b21)?_0xeb2b21:JSON[_0xe9cb('0x8')](_0xeb2b21);}}catch(_0x136325){_0x15ffe0[_0x404615]=_0xeb2b21[_0xe9cb('0x1')](',');}});}return _0x15ffe0;};exports[_0xe9cb('0xf')]=function(_0x144769){_0x144769=parseInt(_0x144769,0xa);if(!_0x144769||_0x144769<0x0){_0x144769=LIMIT_VALUE;}return _0x144769;};exports['offset']=function(_0xedc8df){_0xedc8df=parseInt(_0xedc8df,0xa);if(!_0xedc8df||_0xedc8df<0x0){_0xedc8df=0x0;}return _0xedc8df;};exports[_0xe9cb('0x10')]=function(_0x5f5336){var _0x258a56,_0x2b2efe=null;if(_0x5f5336){_0x258a56=_0x5f5336[_0xe9cb('0x1')](',');_0x2b2efe=_[_0xe9cb('0x11')](_0x258a56,function(_0x488175){if(_0x488175[_0xe9cb('0x12')]('-')===0x0){return[_0x488175==='priority'?sequelize['cast'](sequelize[_0xe9cb('0x13')]('priority'),_0xe9cb('0x14')):_0x488175[_0xe9cb('0x15')](0x1),_0xe9cb('0x16')];}else{return[_0x488175===_0xe9cb('0x17')?sequelize[_0xe9cb('0x18')](sequelize[_0xe9cb('0x13')](_0xe9cb('0x17')),_0xe9cb('0x14')):_0x488175,_0xe9cb('0x19')];}});}return _0x2b2efe;};exports[_0xe9cb('0x1a')]=function(_0x63bb57,_0x5730f8){if(_[_0xe9cb('0x3')](_0x63bb57)){return _0x63bb57;}if(_['isArray'](_0x63bb57)){for(var _0x5ce5bb=0x0;_0x5ce5bb<_0x63bb57[_0xe9cb('0x1b')];_0x5ce5bb+=0x1){_0x63bb57[_0x5ce5bb]=this[_0xe9cb('0x1a')](_0x63bb57[_0x5ce5bb],_0x5730f8);}return _0x63bb57;}if(!_[_0xe9cb('0x1c')](_0x63bb57)){return _0x63bb57;}if(_['isString'](_0x5730f8)){_0x5730f8=[_0x5730f8];}if(!_[_0xe9cb('0xe')](_0x5730f8)){return _0x63bb57;}for(var _0x3dd705=0x0;_0x3dd705<_0x5730f8[_0xe9cb('0x1b')];_0x3dd705+=0x1){_[_0xe9cb('0x1d')](_0x63bb57,_0x5730f8[_0x3dd705]);}for(var _0x436f2b in _0x63bb57){if(_0x63bb57[_0xe9cb('0x1e')](_0x436f2b)){_0x63bb57[_0x436f2b]=this[_0xe9cb('0x1a')](_0x63bb57[_0x436f2b],_0x5730f8);}}return _0x63bb57;};exports[_0xe9cb('0x1f')]=function(_0x4a547f){return _0x4a547f[_0xe9cb('0x20')](RegExp(_0xe9cb('0x21')))?!![]:![];};exports[_0xe9cb('0x22')]=function(_0x154f2c){return _0x154f2c['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xe9cb('0x23')]=function(_0x3a20f4){var _0x146183=[];_0x3a20f4['split']('\x20')[_0xe9cb('0x24')](function(_0x193a14){_0x146183[_0xe9cb('0x25')]('+'+_0x193a14[_0xe9cb('0x26')]()+'*');});return _0x146183[_0xe9cb('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a36f1e8..3bf0707 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd004=['default','get','env','set','appPath','join','root','public','development','test','client','json\x20replacer','toISOString','split','static','views','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','use','json','initialize','express','serve-favicon','body-parser','method-override','path','passport','cors','./environment','../mysqldb'];(function(_0x334dc2,_0x44f024){var _0x487011=function(_0x178358){while(--_0x178358){_0x334dc2['push'](_0x334dc2['shift']());}};_0x487011(++_0x44f024);}(_0xd004,0x155));var _0x4d00=function(_0x1b943f,_0x6f6e83){_0x1b943f=_0x1b943f-0x0;var _0x8b7549=_0xd004[_0x1b943f];return _0x8b7549;};'use strict';var express=require(_0x4d00('0x0'));var favicon=require(_0x4d00('0x1'));var bodyParser=require(_0x4d00('0x2'));var methodOverride=require(_0x4d00('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x4d00('0x4'));var passport=require(_0x4d00('0x5'));var cors=require(_0x4d00('0x6'));var moment=require('moment');var config=require(_0x4d00('0x7'));var db=require(_0x4d00('0x8'))['db'];exports[_0x4d00('0x9')]=function(_0x4938c0){var _0x833290=_0x4938c0[_0x4d00('0xa')](_0x4d00('0xb'));if(_0x833290==='production'){_0x4938c0[_0x4d00('0xc')](_0x4d00('0xd'),path[_0x4d00('0xe')](config[_0x4d00('0xf')],_0x4d00('0x10')));}if(_0x833290===_0x4d00('0x11')||_0x833290===_0x4d00('0x12')){_0x4938c0[_0x4d00('0xc')](_0x4d00('0xd'),path[_0x4d00('0xe')](config[_0x4d00('0xf')],_0x4d00('0x13')));_0x4938c0['use'](errorHandler());}_0x4938c0[_0x4d00('0xc')](_0x4d00('0x14'),function(_0x27ea0f,_0x3e6fba){if(this[_0x27ea0f]instanceof Date){_0x3e6fba=this[_0x27ea0f][_0x4d00('0x15')]()[_0x4d00('0x16')]('.')[0x0]+'Z';}return _0x3e6fba;});_0x4938c0['use'](express[_0x4d00('0x17')](_0x4938c0[_0x4d00('0xa')](_0x4d00('0xd'))));_0x4938c0[_0x4d00('0xc')](_0x4d00('0x18'),config[_0x4d00('0xf')]+_0x4d00('0x19'));_0x4938c0['engine'](_0x4d00('0x1a'),require(_0x4d00('0x1b'))[_0x4d00('0x1c')]);_0x4938c0['set'](_0x4d00('0x1d'),_0x4d00('0x1a'));_0x4938c0['use'](bodyParser[_0x4d00('0x1e')]({'limit':_0x4d00('0x1f'),'extended':!![]}));_0x4938c0[_0x4d00('0x20')](bodyParser[_0x4d00('0x21')]({'limit':_0x4d00('0x1f')}));_0x4938c0[_0x4d00('0x20')](cors());_0x4938c0['use'](methodOverride());_0x4938c0[_0x4d00('0x20')](cookieParser());_0x4938c0[_0x4d00('0x20')](passport[_0x4d00('0x22')]());}; \ No newline at end of file +var _0x0301=['public','development','appPath','use','set','toISOString','split','get','views','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','cookie-parser','path','moment','./environment','../mysqldb','default','production','join'];(function(_0x4b08b3,_0x1041dc){var _0x3854a7=function(_0x52b3c4){while(--_0x52b3c4){_0x4b08b3['push'](_0x4b08b3['shift']());}};_0x3854a7(++_0x1041dc);}(_0x0301,0x1db));var _0x1030=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0x0301[_0x3388d8];return _0x2bbe73;};'use strict';var express=require(_0x1030('0x0'));var favicon=require(_0x1030('0x1'));var bodyParser=require(_0x1030('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x1030('0x3'));var errorHandler=require('errorhandler');var path=require(_0x1030('0x4'));var passport=require('passport');var cors=require('cors');var moment=require(_0x1030('0x5'));var config=require(_0x1030('0x6'));var db=require(_0x1030('0x7'))['db'];exports[_0x1030('0x8')]=function(_0xb46350){var _0x464523=_0xb46350['get']('env');if(_0x464523===_0x1030('0x9')){_0xb46350['set']('appPath',path[_0x1030('0xa')](config['root'],_0x1030('0xb')));}if(_0x464523===_0x1030('0xc')||_0x464523==='test'){_0xb46350['set'](_0x1030('0xd'),path[_0x1030('0xa')](config['root'],'client'));_0xb46350[_0x1030('0xe')](errorHandler());}_0xb46350[_0x1030('0xf')]('json\x20replacer',function(_0x24680f,_0x3d85df){if(this[_0x24680f]instanceof Date){_0x3d85df=this[_0x24680f][_0x1030('0x10')]()[_0x1030('0x11')]('.')[0x0]+'Z';}return _0x3d85df;});_0xb46350[_0x1030('0xe')](express['static'](_0xb46350[_0x1030('0x12')](_0x1030('0xd'))));_0xb46350[_0x1030('0xf')](_0x1030('0x13'),config['root']+'/server/views');_0xb46350['engine']('html',require('ejs')[_0x1030('0x14')]);_0xb46350[_0x1030('0xf')](_0x1030('0x15'),_0x1030('0x16'));_0xb46350[_0x1030('0xe')](bodyParser[_0x1030('0x17')]({'limit':_0x1030('0x18'),'extended':!![]}));_0xb46350['use'](bodyParser[_0x1030('0x19')]({'limit':_0x1030('0x18')}));_0xb46350[_0x1030('0xe')](cors());_0xb46350[_0x1030('0xe')](methodOverride());_0xb46350[_0x1030('0xe')](cookieParser());_0xb46350[_0x1030('0xe')](passport[_0x1030('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 4a1b061..9c133d5 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 _0x291c=['family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','join','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length'];(function(_0x26a1a9,_0xa88722){var _0x22b456=function(_0x344c88){while(--_0x344c88){_0x26a1a9['push'](_0x26a1a9['shift']());}};_0x22b456(++_0xa88722);}(_0x291c,0x137));var _0xc291=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x291c[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xc291('0x0'));var os=require('os');var crypto=require(_0xc291('0x1'));var machine=require(_0xc291('0x2'));var exec=require(_0xc291('0x3'))[_0xc291('0x4')];function getInterfaces(){var _0x253ebb=[];var _0xc32916=os[_0xc291('0x5')]();var _0xafdfee=_[_0xc291('0x6')](_[_0xc291('0x7')](_0xc32916));for(var _0x5e7cbd=0x0;_0x5e7cbd<_0xafdfee[_0xc291('0x8')];_0x5e7cbd++){var _0x5f2563=_0xc32916[_0xafdfee[_0x5e7cbd]]['filter'](function(_0x40dc89){return _0x40dc89[_0xc291('0x9')]===_0xc291('0xa')&&_0x40dc89[_0xc291('0xb')]===![];});_0x253ebb=_0x253ebb['concat'](_0x5f2563);}return _0x253ebb;}function getFirstInterface(){var _0x2f8764=_[_0xc291('0xc')](getInterfaces());return{'macAddress':_0x2f8764&&_0x2f8764[_0xc291('0xd')]?_0x2f8764[_0xc291('0xd')]:_0xc291('0xe'),'ipAddress':_0x2f8764&&_0x2f8764[_0xc291('0xf')]?_0x2f8764[_0xc291('0xf')]:_0xc291('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x49934e=_['orderBy'](os[_0xc291('0x11')]()[_0xc291('0x12')](function(_0x3c7a29){return _0x3c7a29['model'];}))[_0xc291('0x13')](':');return crypto['createHash'](_0xc291('0x14'))[_0xc291('0x15')](_0x49934e)[_0xc291('0x16')](_0xc291('0x17'));}exports[_0xc291('0x18')]=function(){switch(os[_0xc291('0x19')]()){case _0xc291('0x1a'):return exec(_0xc291('0x1b'),{'encoding':_0xc291('0x1c')})[_0xc291('0x1d')]('\x0d\x0a','');default:var _0x5495ff=getFirstInterface();var _0x305ecc=getCPUhash();var _0x23dbf0=_0x305ecc+'|'+os['hostname']()+'|'+_0x5495ff[_0xc291('0x1e')]+'|'+_0x5495ff['ipAddress'];var _0x4c8947=crypto['createHash'](_0xc291('0x14'))[_0xc291('0x15')](_0x23dbf0)[_0xc291('0x16')](_0xc291('0x17'));return _0x4c8947[_0xc291('0x1f')](0x0,0x8)+'-'+_0x4c8947[_0xc291('0x1f')](0x8,0xc)+'-'+_0x4c8947[_0xc291('0x1f')](0xc,0x10)+'-'+_0x4c8947[_0xc291('0x1f')](0x10,0x14)+'-'+_0x4c8947[_0xc291('0x1f')](0x14);}}; \ No newline at end of file +var _0x7fbe=['orderBy','keys','length','filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','platform','win32','utf8','hostname','ipAddress','update','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces'];(function(_0x3cfc24,_0x4bd8a7){var _0x9d851b=function(_0x20f8cd){while(--_0x20f8cd){_0x3cfc24['push'](_0x3cfc24['shift']());}};_0x9d851b(++_0x4bd8a7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x290b68,_0x1f82af){_0x290b68=_0x290b68-0x0;var _0x2f23af=_0x7fbe[_0x290b68];return _0x2f23af;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0xe7fb('0x0'));var exec=require(_0xe7fb('0x1'))[_0xe7fb('0x2')];function getInterfaces(){var _0x1703d5=[];var _0x517d3a=os[_0xe7fb('0x3')]();var _0x11d2c4=_[_0xe7fb('0x4')](_[_0xe7fb('0x5')](_0x517d3a));for(var _0x5dbf04=0x0;_0x5dbf04<_0x11d2c4[_0xe7fb('0x6')];_0x5dbf04++){var _0x12d1b0=_0x517d3a[_0x11d2c4[_0x5dbf04]][_0xe7fb('0x7')](function(_0x1f943f){return _0x1f943f['family']===_0xe7fb('0x8')&&_0x1f943f[_0xe7fb('0x9')]===![];});_0x1703d5=_0x1703d5[_0xe7fb('0xa')](_0x12d1b0);}return _0x1703d5;}function getFirstInterface(){var _0x190a7a=_['head'](getInterfaces());return{'macAddress':_0x190a7a&&_0x190a7a['mac']?_0x190a7a[_0xe7fb('0xb')]:_0xe7fb('0xc'),'ipAddress':_0x190a7a&&_0x190a7a[_0xe7fb('0xd')]?_0x190a7a[_0xe7fb('0xd')]:_0xe7fb('0xe')};}exports[_0xe7fb('0xf')]=getFirstInterface;function getCPUhash(){var _0x3e934b=_[_0xe7fb('0x4')](os[_0xe7fb('0x10')]()[_0xe7fb('0x11')](function(_0x2437d4){return _0x2437d4[_0xe7fb('0x12')];}))[_0xe7fb('0x13')](':');return crypto[_0xe7fb('0x14')](_0xe7fb('0x15'))['update'](_0x3e934b)[_0xe7fb('0x16')](_0xe7fb('0x17'));}exports['getUuid']=function(){switch(os[_0xe7fb('0x18')]()){case _0xe7fb('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xe7fb('0x1a')})['replace']('\x0d\x0a','');default:var _0x12fff6=getFirstInterface();var _0x18d23c=getCPUhash();var _0x12603d=_0x18d23c+'|'+os[_0xe7fb('0x1b')]()+'|'+_0x12fff6['macAddress']+'|'+_0x12fff6[_0xe7fb('0x1c')];var _0x5ebc87=crypto[_0xe7fb('0x14')]('md5')[_0xe7fb('0x1d')](_0x12603d)[_0xe7fb('0x16')](_0xe7fb('0x17'));return _0x5ebc87[_0xe7fb('0x1e')](0x0,0x8)+'-'+_0x5ebc87['substring'](0x8,0xc)+'-'+_0x5ebc87[_0xe7fb('0x1e')](0xc,0x10)+'-'+_0x5ebc87['substring'](0x10,0x14)+'-'+_0x5ebc87[_0xe7fb('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 863fcfc..9f8089c 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 _0x7708=['format','%s/api/servers/%s/check?version=%s','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','createDecipher','final','||FIELD||VALUE||\x0a','User','findOne','fullname','email','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','request-promise','../environment','./hardware','license','https://www.xcallymotion.com'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x7708,0x188));var _0x8770=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x7708[_0x255c48];return _0xaebda3;};'use strict';var util=require(_0x8770('0x0'));var crypto=require(_0x8770('0x1'));var moment=require('moment');var rp=require(_0x8770('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0x8770('0x3'));var hardware=require(_0x8770('0x4'));var logger=require('../logger')(_0x8770('0x5'));var jira=require('../../api/jira/jira.controller');var HOST=_0x8770('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x42d305){return new BPromise(function(_0x2b0295,_0x20e293){var _0x212b12=util[_0x8770('0x7')](_0x8770('0x8'),HOST,_0x42d305,module['exports'][_0x8770('0x9')]);if(oldToken){_0x212b12=util[_0x8770('0x7')](_0x8770('0xa'),HOST,_0x42d305,module['exports'][_0x8770('0x9')],oldToken);}var _0x10e4a3={'uri':_0x212b12,'method':_0x8770('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x10e4a3)[_0x8770('0xc')](function(_0x4a0ca1){_0x2b0295(_0x4a0ca1);})[_0x8770('0xd')](function(_0x34d66c){_0x20e293(_0x34d66c);});});}function encryptDate(_0x2adcbf){var _0x51efbc=crypto[_0x8770('0xe')](_0x8770('0xf'),config[_0x8770('0x10')][_0x8770('0x11')]);var _0x2f2571=_0x51efbc[_0x8770('0x12')](_0x2adcbf,_0x8770('0x13'),_0x8770('0x14'));_0x2f2571+=_0x51efbc['final'](_0x8770('0x14'));return _0x2f2571;}function decryptDate(_0x106a20){var _0x5dd4e7=crypto[_0x8770('0x15')]('aes-256-ctr',config[_0x8770('0x10')]['session']);var _0x5b4716=_0x5dd4e7['update'](_0x106a20,_0x8770('0x14'),_0x8770('0x13'));_0x5b4716+=_0x5dd4e7[_0x8770('0x16')](_0x8770('0x13'));return _0x5b4716;}function sendJiraAlert(_0x4b0691,_0x550be9,_0x349bd4){var _0xfe176a=_0x8770('0x17');return db[_0x8770('0x18')][_0x8770('0x19')]({'where':{'role':'admin'},'attributes':[_0x8770('0x1a'),_0x8770('0x1b')],'raw':!![]})[_0x8770('0xc')](function(_0xe1cba5){ADMIN=_0xe1cba5;_0xfe176a+='|reason|'+_0x349bd4+'|\x0a';_0xfe176a+='|uuid|'+_0x4b0691+'|\x0a';_0xfe176a+=_0x8770('0x1c')+_0x550be9+'|\x0a';_0xfe176a+=_0x8770('0x1d')+ADMIN[_0x8770('0x1a')]+'|\x0a';_0xfe176a+=_0x8770('0x1e')+ADMIN[_0x8770('0x1b')]+'|\x0a';return _0xfe176a;})[_0x8770('0xc')](function(_0x5819dc){var _0x468fc0=hardware[_0x8770('0x1f')]()[_0x8770('0x20')];return jira[_0x8770('0x21')]({'key':'MOTLICENSE','summary':_0x8770('0x22'),'description':_0x5819dc,'issuetype':'Alert','oldToken':_0x4b0691,'newToken':_0x550be9,'email':ADMIN[_0x8770('0x1b')],'name':ADMIN[_0x8770('0x1a')],'reason':GRAY_PERIOD_REASON,'ip':_0x468fc0});});}function manageLicense(_0x473d31,_0x2b5f62){var _0x1538b2=_0x2b5f62[_0x8770('0x23')]({'plain':!![]});httpRequest(_0x473d31)[_0x8770('0xc')](function(_0x367564){if(oldToken){oldToken=undefined;}if(_0x367564[_0x8770('0x24')]){if(!_0x1538b2[_0x8770('0x5')]&&_0x1538b2['license']!=_0x367564[_0x8770('0x5')]||_0x1538b2[_0x8770('0x5')]&&_0x1538b2[_0x8770('0x25')]){logger[_0x8770('0x26')](_0x8770('0x27'));}if(_0x1538b2[_0x8770('0x5')]&&!_0x1538b2['data2']&&_0x1538b2['license']!=_0x367564[_0x8770('0x5')]){logger[_0x8770('0x26')](_0x8770('0x28'));}if(_0x1538b2[_0x8770('0x5')]&&!_0x1538b2[_0x8770('0x25')]&&_0x1538b2['license']==_0x367564['license']){return _0x2b5f62;}return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':_0x367564[_0x8770('0x5')]});}else{if(_0x367564[_0x8770('0x5')]||_0x1538b2[_0x8770('0x5')]){if(!_0x1538b2['data2']){if(_0x1538b2[_0x8770('0x29')]==_0x473d31){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x8770('0x2a'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x1538b2[_0x8770('0x29')];logger[_0x8770('0x26')](_0x8770('0x2b'),_0x1538b2[_0x8770('0x29')],_0x473d31);}sendJiraAlert(_0x1538b2[_0x8770('0x29')],_0x367564[_0x8770('0x2c')],GRAY_PERIOD_REASON);logger[_0x8770('0x26')](_0x8770('0x2d'),GRAY_PERIOD_REASON[_0x8770('0x2e')](),moment()['format'](_0x8770('0x2f')));return _0x2b5f62[_0x8770('0x12')]({'data2':encryptDate(moment()[_0x8770('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x1538b2[_0x8770('0x25')]),_0x8770('0x30'))>DAYS){logger[_0x8770('0x26')]('DEMO\x20START\x20AT\x20%s',moment()[_0x8770('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':null});}}}else{if(_0x1538b2[_0x8770('0x29')]!=_0x473d31){logger[_0x8770('0x26')](_0x8770('0x2b'),_0x1538b2[_0x8770('0x29')],_0x473d31);return _0x2b5f62[_0x8770('0x12')]({'data1':_0x473d31,'data2':null,'license':null});}}}return _0x2b5f62;})[_0x8770('0xc')](function(_0x17488d){_0x2b5f62=_0x17488d;})[_0x8770('0xd')](function(_0xfc8e37){logger['error'](_0xfc8e37[_0x8770('0x31')]);})[_0x8770('0x32')](function(){setTimeout(function(){manageLicense(hardware[_0x8770('0x33')](),_0x2b5f62);},TIME);});}function defaultLicense(){var _0x5b2825=hardware[_0x8770('0x33')]();if(_0x5b2825){return db[_0x8770('0x34')][_0x8770('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x5b2825}})[_0x8770('0x36')](function(_0x1e8e0b,_0x3a50db){logger['info'](_0x8770('0x37'),_0x5b2825);manageLicense(_0x5b2825,_0x1e8e0b);})['catch'](function(_0x3cdaa6){logger['error'](_0x3cdaa6[_0x8770('0x31')]);});}}exports[_0x8770('0x38')]=defaultLicense; \ No newline at end of file +var _0xacf4=['License','spread','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','../logger','license','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','base64','final','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','then','|reason|','|uuid|','|name|','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid'];(function(_0x5c5fb4,_0x2cb903){var _0x4c0813=function(_0x13d311){while(--_0x13d311){_0x5c5fb4['push'](_0x5c5fb4['shift']());}};_0x4c0813(++_0x2cb903);}(_0xacf4,0xe7));var _0x4acf=function(_0x156838,_0x39a171){_0x156838=_0x156838-0x0;var _0x5651b2=_0xacf4[_0x156838];return _0x5651b2;};'use strict';var util=require('util');var crypto=require('crypto');var moment=require(_0x4acf('0x0'));var rp=require(_0x4acf('0x1'));var BPromise=require(_0x4acf('0x2'));var pkginfo=require(_0x4acf('0x3'))(module,_0x4acf('0x4'));var db=require(_0x4acf('0x5'))['db'];var config=require(_0x4acf('0x6'));var hardware=require('./hardware');var logger=require(_0x4acf('0x7'))(_0x4acf('0x8'));var jira=require('../../api/jira/jira.controller');var HOST=_0x4acf('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2ba08a){return new BPromise(function(_0x649ad2,_0x45a5a4){var _0x25d345=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2ba08a,module[_0x4acf('0xa')]['version']);if(oldToken){_0x25d345=util[_0x4acf('0xb')](_0x4acf('0xc'),HOST,_0x2ba08a,module[_0x4acf('0xa')]['version'],oldToken);}var _0x290ca7={'uri':_0x25d345,'method':_0x4acf('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x290ca7)['then'](function(_0x5f22d9){_0x649ad2(_0x5f22d9);})[_0x4acf('0xe')](function(_0x540c8f){_0x45a5a4(_0x540c8f);});});}function encryptDate(_0x5bca4e){var _0x1783d2=crypto[_0x4acf('0xf')](_0x4acf('0x10'),config[_0x4acf('0x11')][_0x4acf('0x12')]);var _0x1a9949=_0x1783d2[_0x4acf('0x13')](_0x5bca4e,_0x4acf('0x14'),_0x4acf('0x15'));_0x1a9949+=_0x1783d2[_0x4acf('0x16')](_0x4acf('0x15'));return _0x1a9949;}function decryptDate(_0x5f0260){var _0x1b584a=crypto['createDecipher'](_0x4acf('0x10'),config[_0x4acf('0x11')][_0x4acf('0x12')]);var _0x5d934a=_0x1b584a['update'](_0x5f0260,_0x4acf('0x15'),_0x4acf('0x14'));_0x5d934a+=_0x1b584a[_0x4acf('0x16')]('utf8');return _0x5d934a;}function sendJiraAlert(_0x2a678b,_0x137302,_0x30d289){var _0x8b55f8=_0x4acf('0x17');return db[_0x4acf('0x18')][_0x4acf('0x19')]({'where':{'role':_0x4acf('0x1a')},'attributes':[_0x4acf('0x1b'),_0x4acf('0x1c')],'raw':!![]})[_0x4acf('0x1d')](function(_0x5f0284){ADMIN=_0x5f0284;_0x8b55f8+=_0x4acf('0x1e')+_0x30d289+'|\x0a';_0x8b55f8+=_0x4acf('0x1f')+_0x2a678b+'|\x0a';_0x8b55f8+='|machineUuid|'+_0x137302+'|\x0a';_0x8b55f8+=_0x4acf('0x20')+ADMIN[_0x4acf('0x1b')]+'|\x0a';_0x8b55f8+='|email|'+ADMIN[_0x4acf('0x1c')]+'|\x0a';return _0x8b55f8;})[_0x4acf('0x1d')](function(_0x433b7a){var _0x454555=hardware['getFirstInterface']()[_0x4acf('0x21')];return jira[_0x4acf('0x22')]({'key':'MOTLICENSE','summary':_0x4acf('0x23'),'description':_0x433b7a,'issuetype':_0x4acf('0x24'),'oldToken':_0x2a678b,'newToken':_0x137302,'email':ADMIN['email'],'name':ADMIN[_0x4acf('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x454555});});}function manageLicense(_0x7ebb,_0x38152c){var _0x16458f=_0x38152c['get']({'plain':!![]});httpRequest(_0x7ebb)['then'](function(_0x17a756){if(oldToken){oldToken=undefined;}if(_0x17a756[_0x4acf('0x25')]){if(!_0x16458f[_0x4acf('0x8')]&&_0x16458f[_0x4acf('0x8')]!=_0x17a756[_0x4acf('0x8')]||_0x16458f[_0x4acf('0x8')]&&_0x16458f[_0x4acf('0x26')]){logger[_0x4acf('0x27')](_0x4acf('0x28'));}if(_0x16458f[_0x4acf('0x8')]&&!_0x16458f['data2']&&_0x16458f[_0x4acf('0x8')]!=_0x17a756[_0x4acf('0x8')]){logger[_0x4acf('0x27')](_0x4acf('0x29'));}if(_0x16458f[_0x4acf('0x8')]&&!_0x16458f[_0x4acf('0x26')]&&_0x16458f[_0x4acf('0x8')]==_0x17a756['license']){return _0x38152c;}return _0x38152c[_0x4acf('0x13')]({'data1':_0x7ebb,'data2':null,'license':_0x17a756[_0x4acf('0x8')]});}else{if(_0x17a756[_0x4acf('0x8')]||_0x16458f['license']){if(!_0x16458f[_0x4acf('0x26')]){if(_0x16458f[_0x4acf('0x2a')]==_0x7ebb){GRAY_PERIOD_REASON=_0x4acf('0x2b');logger[_0x4acf('0x27')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4acf('0x2c');oldToken=_0x16458f[_0x4acf('0x2a')];logger[_0x4acf('0x27')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x16458f[_0x4acf('0x2a')],_0x7ebb);}sendJiraAlert(_0x16458f[_0x4acf('0x2a')],_0x17a756[_0x4acf('0x2d')],GRAY_PERIOD_REASON);logger[_0x4acf('0x27')](_0x4acf('0x2e'),GRAY_PERIOD_REASON[_0x4acf('0x2f')](),moment()['format'](_0x4acf('0x30')));return _0x38152c[_0x4acf('0x13')]({'data2':encryptDate(moment()['format'](_0x4acf('0x30')))});}else{if(moment()['diff'](decryptDate(_0x16458f['data2']),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x38152c[_0x4acf('0x13')]({'data1':_0x7ebb,'data2':null,'license':null});}}}else{if(_0x16458f[_0x4acf('0x2a')]!=_0x7ebb){logger['info'](_0x4acf('0x31'),_0x16458f[_0x4acf('0x2a')],_0x7ebb);return _0x38152c[_0x4acf('0x13')]({'data1':_0x7ebb,'data2':null,'license':null});}}}return _0x38152c;})[_0x4acf('0x1d')](function(_0x1cbb67){_0x38152c=_0x1cbb67;})[_0x4acf('0xe')](function(_0x16135d){logger[_0x4acf('0x32')](_0x16135d[_0x4acf('0x33')]);})[_0x4acf('0x34')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x38152c);},TIME);});}function defaultLicense(){var _0x5c449d=hardware[_0x4acf('0x35')]();if(_0x5c449d){return db[_0x4acf('0x36')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5c449d}})[_0x4acf('0x37')](function(_0x40455d,_0x43a2ea){logger[_0x4acf('0x27')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5c449d);manageLicense(_0x5c449d,_0x40455d);})['catch'](function(_0x41d618){logger[_0x4acf('0x32')](_0x41d618[_0x4acf('0x33')]);});}}exports[_0x4acf('0x38')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a042e77..09cc02c 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 _0x11c3=['../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','session','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','getLicense','License','find','then','checkLicense','crypto','lodash','moment'];(function(_0x5214ef,_0x10e7b8){var _0xa284d=function(_0x1f264d){while(--_0x1f264d){_0x5214ef['push'](_0x5214ef['shift']());}};_0xa284d(++_0x10e7b8);}(_0x11c3,0x179));var _0x311c=function(_0x11b664,_0x5ed6d7){_0x11b664=_0x11b664-0x0;var _0x419ea6=_0x11c3[_0x11b664];return _0x419ea6;};'use strict';var crypto=require(_0x311c('0x0'));var util=require('util');var _=require(_0x311c('0x1'));var moment=require(_0x311c('0x2'));var hardware=require('./hardware');var config=require(_0x311c('0x3'));var db=require(_0x311c('0x4'))['db'];function checkLicense(_0x216edc,_0x10ecfa){if(_0x216edc){try{var _0x10100e=_0x10ecfa||_0x216edc['license'];if(_[_0x311c('0x5')](_0x10100e)){throw new Error(_0x311c('0x6'));}var _0x32fcf4=_0x216edc[_0x311c('0x7')];var _0x12d1d9=_0x216edc[_0x311c('0x8')];var _0xee6b8d=_0x32fcf4[_0x311c('0x9')]('-')[0x4];var _0x57a2cf=_0x32fcf4[_0x311c('0x9')]('-')[0x0];var _0x5c9f1c=crypto[_0x311c('0xa')](_0x311c('0xb'),util[_0x311c('0xc')](_0x311c('0xd'),_0xee6b8d,_0x32fcf4,_0x57a2cf));var _0xe748e1=_0x5c9f1c[_0x311c('0xe')](_0x10100e,_0x311c('0xf'),'utf8');_0xe748e1+=_0x5c9f1c[_0x311c('0x10')](_0x311c('0x11'));var _0x895566=JSON[_0x311c('0x12')](_0xe748e1);_0x895566[_0x311c('0x13')]=![];_0x895566[_0x311c('0x14')]=_0x32fcf4;_0x895566[_0x311c('0x15')]=hardware[_0x311c('0x16')]();if(_0x12d1d9){var _0x1d76b8=crypto[_0x311c('0xa')](_0x311c('0xb'),config[_0x311c('0x17')][_0x311c('0x18')]);var _0x19ed0f=_0x1d76b8[_0x311c('0xe')](_0x12d1d9,_0x311c('0xf'),_0x311c('0x11'));_0x19ed0f+=_0x1d76b8[_0x311c('0x10')]('utf8');_0x895566['gray']=_0x19ed0f;_0x895566['deadline']=moment(_0x19ed0f)[_0x311c('0x19')](0x7,_0x311c('0x1a'))['format']();_0x895566[_0x311c('0x1b')]=_0x895566[_0x311c('0x14')]!=_0x895566[_0x311c('0x15')]?_0x311c('0x1c'):_0x311c('0x1d');}return _0x895566;}catch(_0x113167){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x311c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x311c('0x1f'),'uuid':_0x216edc['data1'],'machineUuid':hardware[_0x311c('0x16')](),'message':_0x113167[_0x311c('0x20')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x311c('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x216edc[_0x311c('0x7')],'machineUuid':hardware[_0x311c('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x311c('0x21')]=function(_0x476b8b){return db[_0x311c('0x22')][_0x311c('0x23')](_['defaults'](_0x476b8b,{'raw':!![],'where':{'id':0x1}}))[_0x311c('0x24')](function(_0xa93026){return checkLicense(_0xa93026,null);});};exports[_0x311c('0x25')]=checkLicense; \ No newline at end of file +var _0x579f=['crypto','util','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','getUuid','session','gray','deadline','add','grayReason','machineUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','defaults','then','checkLicense'];(function(_0x2c2c98,_0x3fa0bd){var _0x53c893=function(_0x2dc1a4){while(--_0x2dc1a4){_0x2c2c98['push'](_0x2c2c98['shift']());}};_0x53c893(++_0x3fa0bd);}(_0x579f,0x14d));var _0xf579=function(_0x4a7d15,_0xb669ce){_0x4a7d15=_0x4a7d15-0x0;var _0x1e8dce=_0x579f[_0x4a7d15];return _0x1e8dce;};'use strict';var crypto=require(_0xf579('0x0'));var util=require(_0xf579('0x1'));var _=require('lodash');var moment=require(_0xf579('0x2'));var hardware=require(_0xf579('0x3'));var config=require(_0xf579('0x4'));var db=require(_0xf579('0x5'))['db'];function checkLicense(_0x42a7c2,_0x16dfb5){if(_0x42a7c2){try{var _0x2bddb7=_0x16dfb5||_0x42a7c2[_0xf579('0x6')];if(_[_0xf579('0x7')](_0x2bddb7)){throw new Error(_0xf579('0x8'));}var _0x279b3b=_0x42a7c2[_0xf579('0x9')];var _0xba7a9e=_0x42a7c2['data2'];var _0x232e8f=_0x279b3b[_0xf579('0xa')]('-')[0x4];var _0x399c09=_0x279b3b['split']('-')[0x0];var _0x338a7f=crypto['createDecipher'](_0xf579('0xb'),util[_0xf579('0xc')](_0xf579('0xd'),_0x232e8f,_0x279b3b,_0x399c09));var _0x84b2cb=_0x338a7f[_0xf579('0xe')](_0x2bddb7,_0xf579('0xf'),_0xf579('0x10'));_0x84b2cb+=_0x338a7f[_0xf579('0x11')]('utf8');var _0x1745c6=JSON[_0xf579('0x12')](_0x84b2cb);_0x1745c6[_0xf579('0x13')]=![];_0x1745c6[_0xf579('0x14')]=_0x279b3b;_0x1745c6['machineUuid']=hardware[_0xf579('0x15')]();if(_0xba7a9e){var _0x469bf1=crypto['createDecipher']('aes-256-ctr',config['secrets'][_0xf579('0x16')]);var _0x2c15ac=_0x469bf1[_0xf579('0xe')](_0xba7a9e,_0xf579('0xf'),_0xf579('0x10'));_0x2c15ac+=_0x469bf1[_0xf579('0x11')](_0xf579('0x10'));_0x1745c6[_0xf579('0x17')]=_0x2c15ac;_0x1745c6[_0xf579('0x18')]=moment(_0x2c15ac)[_0xf579('0x19')](0x7,'days')[_0xf579('0xc')]();_0x1745c6[_0xf579('0x1a')]=_0x1745c6['uuid']!=_0x1745c6[_0xf579('0x1b')]?'changed':'disabled';}return _0x1745c6;}catch(_0x42b4c1){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf579('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xf579('0x1d'),'uuid':_0x42a7c2[_0xf579('0x9')],'machineUuid':hardware['getUuid'](),'message':_0x42b4c1[_0xf579('0x1e')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf579('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf579('0x1f'),'uuid':_0x42a7c2[_0xf579('0x9')],'machineUuid':hardware[_0xf579('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0xf579('0x20')]=function(_0x4f63f0){return db[_0xf579('0x21')]['find'](_[_0xf579('0x22')](_0x4f63f0,{'raw':!![],'where':{'id':0x1}}))[_0xf579('0x23')](function(_0x4668c1){return checkLicense(_0x4668c1,null);});};exports[_0xf579('0x24')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 813fb6f..c9d0585 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 _0x777a=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x777a,0x8e));var _0xa777=function(_0x2f422a,_0x167362){_0x2f422a=_0x2f422a-0x0;var _0xc6e00a=_0x777a[_0x2f422a];return _0xc6e00a;};'use strict';module['exports']={'DOMAIN':_0xa777('0x0'),'SESSION_SECRET':_0xa777('0x1'),'GOOGLE_ID':_0xa777('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xfc89=['http://localhost:9000','app-id','secret','exports'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xfc89,0xe7));var _0x9fc8=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xfc89[_0x160c73];return _0xd9302;};'use strict';module[_0x9fc8('0x0')]={'DOMAIN':_0x9fc8('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x9fc8('0x2'),'GOOGLE_SECRET':_0x9fc8('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index fa5f8c8..fab4c0e 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb966=['info','Console','debugLevel','winston','util','INFO','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','transports','%s-%s','error','File'];(function(_0x12e650,_0x33f29f){var _0x5b56b1=function(_0xa7f3d8){while(--_0xa7f3d8){_0x12e650['push'](_0x12e650['shift']());}};_0x5b56b1(++_0x33f29f);}(_0xb966,0x1a5));var _0x6b96=function(_0xa266ab,_0x155914){_0xa266ab=_0xa266ab-0x0;var _0x24bccf=_0xb966[_0xa266ab];return _0x24bccf;};'use strict';var moment=require('moment');var winston=require(_0x6b96('0x0'));var util=require(_0x6b96('0x1'));var path=require('path');var debugLevel=_0x6b96('0x2');function filename(_0x3f9d5a,_0x5b8b2d){return path['join']('/var',_0x6b96('0x3'),_0x6b96('0x4'),util[_0x6b96('0x5')]('%s-%s.log',_0x3f9d5a,_0x5b8b2d));}function formatter(_0x45fcb0,_0x2ad932){return util[_0x6b96('0x5')](_0x6b96('0x6'),moment()[_0x6b96('0x5')](_0x6b96('0x7')),_0x2ad932['level'][_0x6b96('0x8')](),_0x45fcb0,_0x2ad932[_0x6b96('0x9')]);}module[_0x6b96('0xa')]=function(_0x302464){return new winston[(_0x6b96('0xb'))]({'transports':[new winston[(_0x6b96('0xc'))]['File']({'name':util[_0x6b96('0x5')](_0x6b96('0xd'),_0x302464,_0x6b96('0xe')),'filename':filename(_0x302464,_0x6b96('0xe')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3df46a){return formatter(_0x302464,_0x3df46a);}}),new winston[(_0x6b96('0xc'))][(_0x6b96('0xf'))]({'name':util[_0x6b96('0x5')]('%s-%s',_0x302464,_0x6b96('0x10')),'filename':filename(_0x302464,_0x6b96('0x10')),'level':_0x6b96('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc69686){return formatter(_0x302464,_0xc69686);}}),new winston[(_0x6b96('0xc'))][(_0x6b96('0x11'))]({'level':process['env'][_0x6b96('0x12')]||debugLevel,'json':![],'formatter':function(_0x3c835f){return formatter(_0x302464,_0x3c835f);}})]});}; \ No newline at end of file +var _0xdde6=['format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','message','exports','Logger','transports','File','error','%s-%s','info','env','debugLevel','moment','path','INFO','join','/var','log','xcally'];(function(_0x3a9375,_0x159c5a){var _0x325534=function(_0x5852bc){while(--_0x5852bc){_0x3a9375['push'](_0x3a9375['shift']());}};_0x325534(++_0x159c5a);}(_0xdde6,0x134));var _0x6dde=function(_0x2799cb,_0x35f581){_0x2799cb=_0x2799cb-0x0;var _0x2cd7b6=_0xdde6[_0x2799cb];return _0x2cd7b6;};'use strict';var moment=require(_0x6dde('0x0'));var winston=require('winston');var util=require('util');var path=require(_0x6dde('0x1'));var debugLevel=_0x6dde('0x2');function filename(_0x21c33a,_0x5f4f90){return path[_0x6dde('0x3')](_0x6dde('0x4'),_0x6dde('0x5'),_0x6dde('0x6'),util[_0x6dde('0x7')](_0x6dde('0x8'),_0x21c33a,_0x5f4f90));}function formatter(_0x326b15,_0x1c1513){return util[_0x6dde('0x7')](_0x6dde('0x9'),moment()[_0x6dde('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1c1513['level'][_0x6dde('0xa')](),_0x326b15,_0x1c1513[_0x6dde('0xb')]);}module[_0x6dde('0xc')]=function(_0x350eec){return new winston[(_0x6dde('0xd'))]({'transports':[new winston[(_0x6dde('0xe'))][(_0x6dde('0xf'))]({'name':util[_0x6dde('0x7')]('%s-%s',_0x350eec,_0x6dde('0x10')),'filename':filename(_0x350eec,_0x6dde('0x10')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ae017){return formatter(_0x350eec,_0x3ae017);}}),new winston['transports']['File']({'name':util[_0x6dde('0x7')](_0x6dde('0x11'),_0x350eec,_0x6dde('0x12')),'filename':filename(_0x350eec,_0x6dde('0x12')),'level':_0x6dde('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d5ad7){return formatter(_0x350eec,_0x2d5ad7);}}),new winston[(_0x6dde('0xe'))]['Console']({'level':process[_0x6dde('0x13')][_0x6dde('0x14')]||debugLevel,'json':![],'formatter':function(_0x1187ea){return formatter(_0x350eec,_0x1187ea);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b0a2b7d..3de6cdf 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 _0x142b=['xdr','exports','ami','join','../../services/ami/index.js','agi','email','../../services/email/index.js','routing'];(function(_0x53aecb,_0x54c77a){var _0x219b0f=function(_0x25820a){while(--_0x25820a){_0x53aecb['push'](_0x53aecb['shift']());}};_0x219b0f(++_0x54c77a);}(_0x142b,0x1bb));var _0xb142=function(_0x322086,_0x3dc58d){_0x322086=_0x322086-0x0;var _0x4d6ab3=_0x142b[_0x322086];return _0x4d6ab3;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xb142('0x0'),'script':path[_0xb142('0x1')](__dirname,_0xb142('0x2'))},{'name':_0xb142('0x3'),'script':path[_0xb142('0x1')](__dirname,'../../services/agi/index.js')},{'name':_0xb142('0x4'),'script':path[_0xb142('0x1')](__dirname,_0xb142('0x5'))},{'name':_0xb142('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xb142('0x7'),'script':path[_0xb142('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xb142('0x8')]=config; \ No newline at end of file +var _0x9bc7=['exports','express','join','../../services/express/index.js','ami','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x26cab7,_0x1ccfca){var _0x31ba06=function(_0x1ed04a){while(--_0x1ed04a){_0x26cab7['push'](_0x26cab7['shift']());}};_0x31ba06(++_0x1ccfca);}(_0x9bc7,0x177));var _0x79bc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9bc7[_0x397e5f];return _0x5302b8;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x79bc('0x0'),'script':path[_0x79bc('0x1')](__dirname,_0x79bc('0x2'))},{'name':_0x79bc('0x3'),'script':path[_0x79bc('0x1')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x79bc('0x1')](__dirname,_0x79bc('0x4'))},{'name':_0x79bc('0x5'),'script':path[_0x79bc('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x79bc('0x6'),'script':path[_0x79bc('0x1')](__dirname,_0x79bc('0x7'))},{'name':_0x79bc('0x8'),'script':path['join'](__dirname,_0x79bc('0x9'))}]};module[_0x79bc('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 951f7e1..778a948 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 _0x6688=['pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x377231,_0x44a2b7){var _0x4dd94b=function(_0x44062f){while(--_0x44062f){_0x377231['push'](_0x377231['shift']());}};_0x4dd94b(++_0x44a2b7);}(_0x6688,0x10e));var _0x8668=function(_0x1db418,_0x559073){_0x1db418=_0x1db418-0x0;var _0x8c6f6c=_0x6688[_0x1db418];return _0x8c6f6c;};'use strict';var pm2=require(_0x8668('0x0'));var BPromise=require(_0x8668('0x1'));var config=require(_0x8668('0x2'));function connect(){return new BPromise(function(_0x50da57,_0x41afbf){return pm2[_0x8668('0x3')](function(_0x1932de){if(_0x1932de){return _0x41afbf(_0x1932de);}return _0x50da57(_0x8668('0x4'));});});};exports[_0x8668('0x5')]=function(_0x21922f){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x513305,_0x2a6329){return pm2[_0x8668('0x5')](_0x21922f,function(_0x51c691,_0x1b9518){if(_0x51c691){return _0x2a6329(_0x51c691);}pm2[_0x8668('0x7')]();return _0x513305(_0x1b9518);});});});};exports[_0x8668('0x8')]=function(_0x15e42d){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x2c15a6,_0x21315c){return pm2[_0x8668('0x8')](_0x15e42d,function(_0x51a0ff,_0x570b45){if(_0x51a0ff){return _0x21315c(_0x51a0ff);}pm2['disconnect']();return _0x2c15a6(_0x570b45);});});});};exports['restart']=function(_0x402c26){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x395095,_0x2c0b26){return pm2[_0x8668('0x9')](_0x402c26,function(_0x59dfbc,_0x526199){if(_0x59dfbc){return _0x2c0b26(_0x59dfbc);}pm2[_0x8668('0x7')]();return _0x395095(_0x526199);});});});};exports[_0x8668('0xa')]=function(){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x48311a,_0x3c8de8){return pm2[_0x8668('0xa')](function(_0x3626e7,_0x588c09){if(_0x3626e7){return _0x3c8de8(_0x3626e7);}pm2['disconnect']();return _0x48311a(_0x588c09);});});});};exports[_0x8668('0xb')]=function(_0x16fe4b){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x20dd0a,_0x5a68f6){return pm2['describe'](_0x16fe4b,function(_0x246506,_0x191220){if(_0x246506){return _0x5a68f6(_0x246506);}pm2[_0x8668('0x7')]();return _0x20dd0a(_0x191220);});});});};exports[_0x8668('0xc')]=function(_0x1ab443){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x5ad3a2,_0x455102){return pm2['delete'](_0x1ab443,function(_0x482176,_0x4fb5a2){if(_0x482176){return _0x455102(_0x482176);}pm2['disconnect']();return _0x5ad3a2(_0x4fb5a2);});});});};exports[_0x8668('0xd')]=function(){return connect()[_0x8668('0x6')](function(){return new BPromise(function(_0x2d6a6c,_0x50aea2){return pm2[_0x8668('0xd')](function(_0x585220){if(_0x585220){return _0x50aea2(_0x585220);}return _0x2d6a6c(_0x8668('0xe'));});});});}; \ No newline at end of file +var _0xdd54=['stop','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','then','start'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdd54,0x159));var _0x4dd5=function(_0x5738f7,_0x17df47){_0x5738f7=_0x5738f7-0x0;var _0x2e6d3c=_0xdd54[_0x5738f7];return _0x2e6d3c;};'use strict';var pm2=require(_0x4dd5('0x0'));var BPromise=require(_0x4dd5('0x1'));var config=require(_0x4dd5('0x2'));function connect(){return new BPromise(function(_0x29b277,_0x4a42cf){return pm2[_0x4dd5('0x3')](function(_0x11a9a2){if(_0x11a9a2){return _0x4a42cf(_0x11a9a2);}return _0x29b277('connected');});});};exports['start']=function(_0x3de4b1){return connect()[_0x4dd5('0x4')](function(){return new BPromise(function(_0x4656e5,_0x20b2ec){return pm2[_0x4dd5('0x5')](_0x3de4b1,function(_0x447b6c,_0x3df13a){if(_0x447b6c){return _0x20b2ec(_0x447b6c);}pm2['disconnect']();return _0x4656e5(_0x3df13a);});});});};exports[_0x4dd5('0x6')]=function(_0x1e3094){return connect()[_0x4dd5('0x4')](function(){return new BPromise(function(_0x2dbfef,_0x2122da){return pm2['stop'](_0x1e3094,function(_0x2d913e,_0x1012af){if(_0x2d913e){return _0x2122da(_0x2d913e);}pm2[_0x4dd5('0x7')]();return _0x2dbfef(_0x1012af);});});});};exports[_0x4dd5('0x8')]=function(_0x1f5457){return connect()['then'](function(){return new BPromise(function(_0x2c2daf,_0x4f18c7){return pm2[_0x4dd5('0x8')](_0x1f5457,function(_0x49b2ee,_0x4a8d6c){if(_0x49b2ee){return _0x4f18c7(_0x49b2ee);}pm2['disconnect']();return _0x2c2daf(_0x4a8d6c);});});});};exports['list']=function(){return connect()[_0x4dd5('0x4')](function(){return new BPromise(function(_0x48b6c9,_0x180efa){return pm2[_0x4dd5('0x9')](function(_0x56b60d,_0x443f53){if(_0x56b60d){return _0x180efa(_0x56b60d);}pm2[_0x4dd5('0x7')]();return _0x48b6c9(_0x443f53);});});});};exports['describe']=function(_0x49fb55){return connect()['then'](function(){return new BPromise(function(_0x366765,_0x266f4c){return pm2[_0x4dd5('0xa')](_0x49fb55,function(_0x225ba8,_0x5d41a4){if(_0x225ba8){return _0x266f4c(_0x225ba8);}pm2[_0x4dd5('0x7')]();return _0x366765(_0x5d41a4);});});});};exports[_0x4dd5('0xb')]=function(_0x2b6b33){return connect()[_0x4dd5('0x4')](function(){return new BPromise(function(_0x38840b,_0x4125cb){return pm2[_0x4dd5('0xb')](_0x2b6b33,function(_0x379098,_0x1d70c4){if(_0x379098){return _0x4125cb(_0x379098);}pm2[_0x4dd5('0x7')]();return _0x38840b(_0x1d70c4);});});});};exports[_0x4dd5('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x273adc,_0x492f1f){return pm2['dump'](function(_0x32e746){if(_0x32e746){return _0x492f1f(_0x32e746);}return _0x273adc('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5a6c198..09b10b4 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 _0xbcd0=['start','lodash','moment','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update','catch','error'];(function(_0x555ea8,_0x4f0c19){var _0x543af4=function(_0x265d2f){while(--_0x265d2f){_0x555ea8['push'](_0x555ea8['shift']());}};_0x543af4(++_0x4f0c19);}(_0xbcd0,0x8b));var _0x0bcd=function(_0x428d49,_0x59f03c){_0x428d49=_0x428d49-0x0;var _0x3ff07c=_0xbcd0[_0x428d49];return _0x3ff07c;};'use strict';var _=require(_0x0bcd('0x0'));var moment=require(_0x0bcd('0x1'));var Redis=require('ioredis');var db=require(_0x0bcd('0x2'))['db'];var config=require(_0x0bcd('0x3'));config[_0x0bcd('0x4')]=_['defaults'](config[_0x0bcd('0x4')],{'host':_0x0bcd('0x5'),'port':0x18eb});var io=require(_0x0bcd('0x6'))(new Redis(config[_0x0bcd('0x4')]));function closeInteractions(){var _0x105e5e=0x0;var _0x496075=[];return db[_0x0bcd('0x7')][_0x0bcd('0x8')]({'raw':!![],'attributes':['id',_0x0bcd('0x9')],'where':{'id':0x1}})[_0x0bcd('0xa')](function(_0x18db65){_0x105e5e=_0x18db65['chatTimeout'];if(_0x105e5e){return db[_0x0bcd('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x0bcd('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x18db65[_0x0bcd('0x9')],'minutes')}}});}else{return[];}})[_0x0bcd('0xa')](function(_0x2d25c3){_0x496075=_0x2d25c3;if(_0x105e5e){return db['ChatInteraction'][_0x0bcd('0xd')]({'closeReason':_0x0bcd('0xe'),'disposition':_0x0bcd('0xf'),'closed':!![],'closedAt':moment()[_0x0bcd('0x10')](_0x0bcd('0x11'))},{'where':{'id':_['map'](_0x496075||[],'id')}});}})[_0x0bcd('0xa')](function(_0x136547){for(var _0x3201b5=0x0;_0x3201b5<_0x496075[_0x0bcd('0x12')];_0x3201b5++){io['emit'](_0x0bcd('0x13'),{'id':_0x496075[_0x3201b5]['id'],'closed':!![]});}})[_0x0bcd('0x14')](function(_0x258a35){console[_0x0bcd('0x15')](_0x258a35);});}exports[_0x0bcd('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xccd7=['map','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','defaults','redis','Setting','chatTimeout','then','ChatInteraction','subtract','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xccd7,0xae));var _0x7ccd=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0xccd7[_0x42c6f1];return _0x3c7398;};'use strict';var _=require(_0x7ccd('0x0'));var moment=require(_0x7ccd('0x1'));var Redis=require(_0x7ccd('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');config['redis']=_[_0x7ccd('0x3')](config[_0x7ccd('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7ccd('0x4')]));function closeInteractions(){var _0x4d4fc6=0x0;var _0x3eb5b4=[];return db[_0x7ccd('0x5')]['find']({'raw':!![],'attributes':['id',_0x7ccd('0x6')],'where':{'id':0x1}})[_0x7ccd('0x7')](function(_0x1ae975){_0x4d4fc6=_0x1ae975[_0x7ccd('0x6')];if(_0x4d4fc6){return db[_0x7ccd('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7ccd('0x9')](_0x1ae975[_0x7ccd('0x6')],'minutes')}}});}else{return[];}})[_0x7ccd('0x7')](function(_0x396d53){_0x3eb5b4=_0x396d53;if(_0x4d4fc6){return db['ChatInteraction'][_0x7ccd('0xa')]({'closeReason':_0x7ccd('0xb'),'disposition':_0x7ccd('0xc'),'closed':!![],'closedAt':moment()[_0x7ccd('0xd')](_0x7ccd('0xe'))},{'where':{'id':_[_0x7ccd('0xf')](_0x3eb5b4||[],'id')}});}})['then'](function(_0x49da17){for(var _0x2d91c6=0x0;_0x2d91c6<_0x3eb5b4['length'];_0x2d91c6++){io[_0x7ccd('0x10')](_0x7ccd('0x11'),{'id':_0x3eb5b4[_0x2d91c6]['id'],'closed':!![]});}})[_0x7ccd('0x12')](function(_0x2285fe){console[_0x7ccd('0x13')](_0x2285fe);});}exports[_0x7ccd('0x14')]=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 2c4659e..bdb4633 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 _0x69b1=['jobs','map','toString','intersection','difference','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','exists','update','stop\x20cron','run','util','path','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','user','pass','format','\x22%s\x22\x20<%s>','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','status','Sent','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys'];(function(_0x5c6c62,_0x3f79f0){var _0x217d24=function(_0x8aea17){while(--_0x8aea17){_0x5c6c62['push'](_0x5c6c62['shift']());}};_0x217d24(++_0x3f79f0);}(_0x69b1,0x170));var _0x169b=function(_0x1b31a1,_0x2a8b9a){_0x1b31a1=_0x1b31a1-0x0;var _0x26c40e=_0x69b1[_0x1b31a1];return _0x26c40e;};'use strict';var fs=require('fs');var util=require(_0x169b('0x0'));var path=require(_0x169b('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x169b('0x2'));var jayson=require(_0x169b('0x3'));var BPromise=require('bluebird');var logger=require(_0x169b('0x4'))(_0x169b('0x5'));var db=require(_0x169b('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x169b('0x7'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x112c47,_0xafae21){return function(){logger['info'](_0x169b('0x8'),_0x112c47[_0x169b('0x9')]);var _0x7b5915=!![];var _0x3f326f={'tls':{'rejectUnauthorized':![]}};if(_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xb')]){_0x3f326f[_0x169b('0xb')]=_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0xb')];}else{_0x3f326f[_0x169b('0xd')]=_0x112c47[_0x169b('0xc')][_0x169b('0xa')]['host'];_0x3f326f[_0x169b('0xe')]=_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xe')];_0x3f326f['secure']=_0x112c47['MailAccount'][_0x169b('0xa')][_0x169b('0xf')];}if(_0x112c47[_0x169b('0xc')][_0x169b('0xa')]['authentication']){_0x3f326f['auth']={'user':_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x10')],'pass':_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x11')]};}var _0x503b32={'account':_0x3f326f,'message':{'from':util[_0x169b('0x12')](_0x169b('0x13'),_0x112c47[_0x169b('0xc')][_0x169b('0x14')],_0x112c47[_0x169b('0xc')][_0x169b('0x9')]||_0x112c47[_0x169b('0xc')][_0x169b('0xa')][_0x169b('0x10')]),'to':_0x112c47['email'],'cc':_0x112c47['cc'],'bcc':_0x112c47['bcc'],'subject':util['format'](_0x169b('0x15'),_0xafae21[_0x169b('0x14')],_0x112c47[_0x169b('0x16')],_0x112c47['subtractUnit'])}};var _0x463de9=path[_0x169b('0x17')](__dirname,_0x169b('0x18'));var _0xb7b1c1=_0xafae21[_0x169b('0x19')];var _0x4b0caa=util['format'](_0x169b('0x1a'),path[_0x169b('0x1b')](_0xafae21[_0x169b('0x19')],path[_0x169b('0x1c')](_0xafae21['savename'])),'zip');var _0x420019=path[_0x169b('0x17')](_0x463de9,_0xb7b1c1);var _0x322d7c=path[_0x169b('0x17')](_0x463de9,_0x4b0caa);if(fs['existsSync'](_0x420019)){_0xafae21[_0x169b('0x1d')]=_0x169b('0x1e');_0x503b32[_0x169b('0x1f')][_0x169b('0x20')]=[{'filename':_0xb7b1c1,'path':_0x420019}];_0x503b32[_0x169b('0x1f')]['text']=util[_0x169b('0x12')](_0x169b('0x21'),JSON[_0x169b('0x22')](_0xafae21,null,0x2));}else if(fs['existsSync'](_0x322d7c)){_0xafae21[_0x169b('0x1d')]=_0x169b('0x1e');_0x503b32[_0x169b('0x1f')]['attachments']=[{'filename':_0x4b0caa,'path':_0x322d7c}];}else{_0x503b32['message']['text']=_0x169b('0x23');if(!_0x112c47['sendIfEmpty']){_0x7b5915=![];logger[_0x169b('0x24')](_0x169b('0x25'));}}if(_0x7b5915){return client[_0x169b('0x26')](_0x169b('0x27'),_0x503b32)[_0x169b('0x28')](function(_0x283516){if(_0x283516[_0x169b('0x29')]){return logger['error'](_0x169b('0x2a'),JSON[_0x169b('0x22')](_0x283516));}return logger['info'](_0x169b('0x2b'));})[_0x169b('0x2c')](function(_0x35a4ea){return logger[_0x169b('0x29')](_0x169b('0x2a'),JSON['stringify'](_0x35a4ea));});}};}function handleError(){return function(_0x30a0c1){return logger[_0x169b('0x29')](JSON[_0x169b('0x22')](_0x30a0c1));};}function handleResult(_0x39c7b1){return function(_0x52370a){logger[_0x169b('0x24')](_0x169b('0x2d'),JSON[_0x169b('0x22')](_0x52370a));if(_0x39c7b1[_0x169b('0xc')]&&_0x39c7b1['MailAccount'][_0x169b('0xa')]&&!_[_0x169b('0x2e')](_0x39c7b1[_0x169b('0x9')])){setTimeout(handleSendEmail(_0x39c7b1,_0x52370a),0x3c*0x3e8);}};}function handleJob(_0x232d98){return function(){try{if(_[_0x169b('0x2e')](_0x232d98[_0x169b('0x16')])){return logger[_0x169b('0x24')](_0x169b('0x2f'));}if(_[_0x169b('0x2e')](_0x232d98[_0x169b('0x30')])){return logger[_0x169b('0x24')](_0x169b('0x31'));}var _0x426a1e={'startDate':moment()['subtract'](_0x232d98[_0x169b('0x16')],_0x232d98[_0x169b('0x30')])[_0x169b('0x12')](_0x169b('0x32')),'endDate':moment()[_0x169b('0x12')](_0x169b('0x32')),'type':_0x169b('0x33'),'output':_0x232d98[_0x169b('0x34')],'name':_0x232d98[_0x169b('0x14')]};if(!_[_0x169b('0x2e')](_0x232d98[_0x169b('0x35')])){logger[_0x169b('0x24')](_0x169b('0x36'),_0x232d98['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x232d98['DefaultReportId']},_0x426a1e)['then'](handleResult(_0x232d98))[_0x169b('0x2c')](handleError());}if(!_[_0x169b('0x2e')](_0x232d98[_0x169b('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x232d98['CustomReportId']);return analyticCustomReportController[_0x169b('0x38')]({'id':_0x232d98[_0x169b('0x37')]},_0x426a1e)['then'](handleResult(_0x232d98))['catch'](handleError());}}catch(_0x39b26a){logger['error'](JSON[_0x169b('0x22')](_0x39b26a));}return logger[_0x169b('0x24')](_0x169b('0x39'));};}function getJobs(_0x56ea34){var _0x1a15ea={};if(_0x56ea34){_0x1a15ea['id']=_0x56ea34;}return db[_0x169b('0x3a')][_0x169b('0x3b')]({'where':_0x1a15ea,'include':[{'model':db[_0x169b('0xc')],'attributes':['id',_0x169b('0x14'),_0x169b('0x9')],'include':[{'model':db[_0x169b('0x3c')],'as':'Smtp'}]}]})[_0x169b('0x28')](function(_0x33006c){var _0x2c3cb7=_[_0x169b('0x3d')](manager[_0x169b('0x3e')]);var _0x2e370a=_[_0x169b('0x3f')](_0x33006c,function(_0x546148){return _0x546148['id'][_0x169b('0x40')]();});var _0x1979f0=_['keyBy'](_0x33006c,function(_0x54393d){return _0x54393d['id']['toString']();});var _0x5ae945=_0x56ea34?_0x2e370a:_['difference'](_0x2e370a,_0x2c3cb7);var _0x10ef18=_[_0x169b('0x41')](_0x2e370a,_0x2c3cb7);var _0x217fc4=_[_0x169b('0x42')](_0x2c3cb7,_0x2e370a);var _0x36270f;var _0x3fa52f;for(_0x36270f=0x0;_0x36270f<_0x217fc4[_0x169b('0x43')]&&!_0x56ea34;_0x36270f+=0x1){_0x3fa52f=_0x217fc4[_0x36270f][_0x169b('0x40')]();if(manager['exists'](_0x3fa52f)){manager[_0x169b('0x44')](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger[_0x169b('0x24')](_0x169b('0x46'),_0x3fa52f);}}logger[_0x169b('0x24')](_0x169b('0x47'),JSON[_0x169b('0x22')](_0x5ae945));for(_0x36270f=0x0;_0x36270f<_0x5ae945[_0x169b('0x43')];_0x36270f+=0x1){_0x3fa52f=_0x5ae945[_0x36270f][_0x169b('0x40')]();logger[_0x169b('0x24')]('index',_0x3fa52f);if(_0x56ea34){logger[_0x169b('0x24')](_0x169b('0x48'),_0x56ea34);logger[_0x169b('0x24')](JSON[_0x169b('0x22')](_0x1979f0[_0x3fa52f]));BPromise[_0x169b('0x49')]()[_0x169b('0x28')](handleJob(_0x1979f0[_0x3fa52f]));logger[_0x169b('0x24')](_0x169b('0x4a'),_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}else if(_0x1979f0[_0x3fa52f][_0x169b('0x4b')]&&_0x1979f0[_0x3fa52f][_0x169b('0x4c')]&&moment()[_0x169b('0x4d')](_0x1979f0[_0x3fa52f][_0x169b('0x4e')],_0x1979f0[_0x3fa52f][_0x169b('0x4f')])){manager[_0x169b('0x50')](_0x3fa52f,_0x1979f0[_0x3fa52f][_0x169b('0x4b')],handleJob(_0x1979f0[_0x3fa52f]));manager[_0x169b('0x51')](_0x3fa52f);logger[_0x169b('0x24')]('add\x20cron',_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}else if(manager[_0x169b('0x52')](_0x3fa52f)){manager[_0x169b('0x44')](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger[_0x169b('0x24')]('stop\x20cron',_0x1979f0[_0x3fa52f]['name'],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}}for(_0x36270f=0x0,_0x3fa52f;_0x36270f<_0x10ef18['length']&&!_0x56ea34;_0x36270f+=0x1){_0x3fa52f=_0x10ef18[_0x36270f][_0x169b('0x40')]();if(manager[_0x169b('0x52')](_0x3fa52f)){if(_0x1979f0[_0x3fa52f]['cron']&&_0x1979f0[_0x3fa52f][_0x169b('0x4c')]&&moment()[_0x169b('0x4d')](_0x1979f0[_0x3fa52f][_0x169b('0x4e')],_0x1979f0[_0x3fa52f]['endAt'])){manager[_0x169b('0x53')](_0x3fa52f,_0x1979f0[_0x3fa52f]['cron'],handleJob(_0x1979f0[_0x3fa52f]));logger[_0x169b('0x24')]('update\x20cron',_0x1979f0[_0x3fa52f]['name'],_0x1979f0[_0x3fa52f]['cron']);}else{manager['stop'](_0x3fa52f);manager[_0x169b('0x45')](_0x3fa52f);logger['info'](_0x169b('0x54'),_0x1979f0[_0x3fa52f][_0x169b('0x14')],_0x1979f0[_0x3fa52f][_0x169b('0x4b')]);}}}})[_0x169b('0x2c')](function(_0x1f7c29){logger[_0x169b('0x29')](JSON[_0x169b('0x22')](_0x1f7c29));});}exports[_0x169b('0x55')]=function(_0x5f2ec0){return getJobs(_0x5f2ec0);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x532d=['catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','active','isBetween','endAt','add\x20cron','stop\x20cron','startAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','name','bcc','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','zip','status','Sent','attachments','message','text','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x532d,0x13f));var _0xd532=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x532d[_0x4bc4c8];return _0x3bb121;};'use strict';var fs=require('fs');var util=require(_0xd532('0x0'));var path=require(_0xd532('0x1'));var _=require(_0xd532('0x2'));var moment=require(_0xd532('0x3'));var CronJobManager=require(_0xd532('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xd532('0x5'));var logger=require(_0xd532('0x6'))(_0xd532('0x7'));var db=require(_0xd532('0x8'))['db'];var analyticCustomReportController=require(_0xd532('0x9'));var analyticDefaultReportController=require(_0xd532('0xa'));var client=jayson[_0xd532('0xb')][_0xd532('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1eb019,_0xfd1fda){return function(){logger['info'](_0xd532('0xd'),_0x1eb019[_0xd532('0xe')]);var _0x550205=!![];var _0x344163={'tls':{'rejectUnauthorized':![]}};if(_0x1eb019[_0xd532('0xf')][_0xd532('0x10')][_0xd532('0x11')]){_0x344163['service']=_0x1eb019['MailAccount'][_0xd532('0x10')][_0xd532('0x11')];}else{_0x344163[_0xd532('0x12')]=_0x1eb019[_0xd532('0xf')][_0xd532('0x10')][_0xd532('0x12')];_0x344163[_0xd532('0x13')]=_0x1eb019['MailAccount'][_0xd532('0x10')][_0xd532('0x13')];_0x344163[_0xd532('0x14')]=_0x1eb019[_0xd532('0xf')][_0xd532('0x10')][_0xd532('0x14')];}if(_0x1eb019['MailAccount'][_0xd532('0x10')][_0xd532('0x15')]){_0x344163[_0xd532('0x16')]={'user':_0x1eb019[_0xd532('0xf')][_0xd532('0x10')][_0xd532('0x17')],'pass':_0x1eb019[_0xd532('0xf')]['Smtp'][_0xd532('0x18')]};}var _0xdd9bc={'account':_0x344163,'message':{'from':util[_0xd532('0x19')]('\x22%s\x22\x20<%s>',_0x1eb019['MailAccount'][_0xd532('0x1a')],_0x1eb019[_0xd532('0xf')]['email']||_0x1eb019[_0xd532('0xf')]['Smtp'][_0xd532('0x17')]),'to':_0x1eb019[_0xd532('0xe')],'cc':_0x1eb019['cc'],'bcc':_0x1eb019[_0xd532('0x1b')],'subject':util[_0xd532('0x19')]('Report\x20%s\x20last\x20%s\x20%s',_0xfd1fda[_0xd532('0x1a')],_0x1eb019[_0xd532('0x1c')],_0x1eb019[_0xd532('0x1d')])}};var _0x7069f9=path[_0xd532('0x1e')](__dirname,_0xd532('0x1f'));var _0x147a0d=_0xfd1fda['savename'];var _0xba79df=util['format'](_0xd532('0x20'),path[_0xd532('0x21')](_0xfd1fda[_0xd532('0x22')],path['extname'](_0xfd1fda[_0xd532('0x22')])),_0xd532('0x23'));var _0xec7039=path[_0xd532('0x1e')](_0x7069f9,_0x147a0d);var _0x1fab6f=path['join'](_0x7069f9,_0xba79df);if(fs['existsSync'](_0xec7039)){_0xfd1fda[_0xd532('0x24')]=_0xd532('0x25');_0xdd9bc['message'][_0xd532('0x26')]=[{'filename':_0x147a0d,'path':_0xec7039}];_0xdd9bc[_0xd532('0x27')][_0xd532('0x28')]=util[_0xd532('0x19')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xd532('0x29')](_0xfd1fda,null,0x2));}else if(fs[_0xd532('0x2a')](_0x1fab6f)){_0xfd1fda['status']='Sent';_0xdd9bc[_0xd532('0x27')][_0xd532('0x26')]=[{'filename':_0xba79df,'path':_0x1fab6f}];}else{_0xdd9bc[_0xd532('0x27')][_0xd532('0x28')]=_0xd532('0x2b');if(!_0x1eb019[_0xd532('0x2c')]){_0x550205=![];logger[_0xd532('0x2d')](_0xd532('0x2e'));}}if(_0x550205){return client[_0xd532('0x2f')](_0xd532('0x30'),_0xdd9bc)[_0xd532('0x31')](function(_0x198ab7){if(_0x198ab7[_0xd532('0x32')]){return logger['error'](_0xd532('0x33'),JSON[_0xd532('0x29')](_0x198ab7));}return logger['info'](_0xd532('0x34'));})[_0xd532('0x35')](function(_0x24b973){return logger[_0xd532('0x32')](_0xd532('0x33'),JSON[_0xd532('0x29')](_0x24b973));});}};}function handleError(){return function(_0x1a8c2a){return logger[_0xd532('0x32')](JSON['stringify'](_0x1a8c2a));};}function handleResult(_0x1c61b1){return function(_0x3f6390){logger['info'](_0xd532('0x36'),JSON[_0xd532('0x29')](_0x3f6390));if(_0x1c61b1[_0xd532('0xf')]&&_0x1c61b1[_0xd532('0xf')][_0xd532('0x10')]&&!_[_0xd532('0x37')](_0x1c61b1['email'])){setTimeout(handleSendEmail(_0x1c61b1,_0x3f6390),0x3c*0x3e8);}};}function handleJob(_0x10a330){return function(){try{if(_[_0xd532('0x37')](_0x10a330[_0xd532('0x1c')])){return logger['info'](_0xd532('0x38'));}if(_[_0xd532('0x37')](_0x10a330[_0xd532('0x1d')])){return logger['info'](_0xd532('0x39'));}var _0xe24178={'startDate':moment()[_0xd532('0x3a')](_0x10a330[_0xd532('0x1c')],_0x10a330[_0xd532('0x1d')])[_0xd532('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xd532('0x3b')),'type':_0xd532('0x3c'),'output':_0x10a330['output'],'name':_0x10a330[_0xd532('0x1a')]};if(!_[_0xd532('0x37')](_0x10a330['DefaultReportId'])){logger[_0xd532('0x2d')](_0xd532('0x3d'),_0x10a330[_0xd532('0x3e')]);return analyticDefaultReportController['runReport']({'id':_0x10a330[_0xd532('0x3e')]},_0xe24178)[_0xd532('0x31')](handleResult(_0x10a330))[_0xd532('0x35')](handleError());}if(!_[_0xd532('0x37')](_0x10a330['CustomReportId'])){logger['info'](_0xd532('0x3f'),_0x10a330[_0xd532('0x40')]);return analyticCustomReportController[_0xd532('0x41')]({'id':_0x10a330[_0xd532('0x40')]},_0xe24178)[_0xd532('0x31')](handleResult(_0x10a330))[_0xd532('0x35')](handleError());}}catch(_0x25bd6d){logger['error'](JSON[_0xd532('0x29')](_0x25bd6d));}return logger[_0xd532('0x2d')](_0xd532('0x42'));};}function getJobs(_0x4eb146){var _0x1c5432={};if(_0x4eb146){_0x1c5432['id']=_0x4eb146;}return db[_0xd532('0x43')][_0xd532('0x44')]({'where':_0x1c5432,'include':[{'model':db[_0xd532('0xf')],'attributes':['id',_0xd532('0x1a'),_0xd532('0xe')],'include':[{'model':db[_0xd532('0x45')],'as':_0xd532('0x10')}]}]})[_0xd532('0x31')](function(_0x1fdb5f){var _0x23872a=_[_0xd532('0x46')](manager[_0xd532('0x47')]);var _0x1ce3fe=_[_0xd532('0x48')](_0x1fdb5f,function(_0x50876e){return _0x50876e['id']['toString']();});var _0x1ea0d6=_[_0xd532('0x49')](_0x1fdb5f,function(_0x3334bd){return _0x3334bd['id'][_0xd532('0x4a')]();});var _0x59e13a=_0x4eb146?_0x1ce3fe:_[_0xd532('0x4b')](_0x1ce3fe,_0x23872a);var _0x28626c=_['intersection'](_0x1ce3fe,_0x23872a);var _0x3de5d1=_[_0xd532('0x4b')](_0x23872a,_0x1ce3fe);var _0x44906c;var _0x1bb757;for(_0x44906c=0x0;_0x44906c<_0x3de5d1[_0xd532('0x4c')]&&!_0x4eb146;_0x44906c+=0x1){_0x1bb757=_0x3de5d1[_0x44906c][_0xd532('0x4a')]();if(manager[_0xd532('0x4d')](_0x1bb757)){manager[_0xd532('0x4e')](_0x1bb757);manager[_0xd532('0x4f')](_0x1bb757);logger[_0xd532('0x2d')](_0xd532('0x50'),_0x1bb757);}}logger[_0xd532('0x2d')](_0xd532('0x51'),JSON[_0xd532('0x29')](_0x59e13a));for(_0x44906c=0x0;_0x44906c<_0x59e13a[_0xd532('0x4c')];_0x44906c+=0x1){_0x1bb757=_0x59e13a[_0x44906c][_0xd532('0x4a')]();logger['info'](_0xd532('0x52'),_0x1bb757);if(_0x4eb146){logger[_0xd532('0x2d')]('my\x20id',_0x4eb146);logger[_0xd532('0x2d')](JSON['stringify'](_0x1ea0d6[_0x1bb757]));BPromise[_0xd532('0x53')]()['then'](handleJob(_0x1ea0d6[_0x1bb757]));logger[_0xd532('0x2d')]('run\x20job',_0x1ea0d6[_0x1bb757][_0xd532('0x1a')],_0x1ea0d6[_0x1bb757][_0xd532('0x54')]);}else if(_0x1ea0d6[_0x1bb757]['cron']&&_0x1ea0d6[_0x1bb757][_0xd532('0x55')]&&moment()[_0xd532('0x56')](_0x1ea0d6[_0x1bb757]['startAt'],_0x1ea0d6[_0x1bb757][_0xd532('0x57')])){manager['add'](_0x1bb757,_0x1ea0d6[_0x1bb757][_0xd532('0x54')],handleJob(_0x1ea0d6[_0x1bb757]));manager['start'](_0x1bb757);logger[_0xd532('0x2d')](_0xd532('0x58'),_0x1ea0d6[_0x1bb757][_0xd532('0x1a')],_0x1ea0d6[_0x1bb757][_0xd532('0x54')]);}else if(manager[_0xd532('0x4d')](_0x1bb757)){manager[_0xd532('0x4e')](_0x1bb757);manager[_0xd532('0x4f')](_0x1bb757);logger[_0xd532('0x2d')](_0xd532('0x59'),_0x1ea0d6[_0x1bb757][_0xd532('0x1a')],_0x1ea0d6[_0x1bb757][_0xd532('0x54')]);}}for(_0x44906c=0x0,_0x1bb757;_0x44906c<_0x28626c['length']&&!_0x4eb146;_0x44906c+=0x1){_0x1bb757=_0x28626c[_0x44906c][_0xd532('0x4a')]();if(manager[_0xd532('0x4d')](_0x1bb757)){if(_0x1ea0d6[_0x1bb757]['cron']&&_0x1ea0d6[_0x1bb757]['active']&&moment()[_0xd532('0x56')](_0x1ea0d6[_0x1bb757][_0xd532('0x5a')],_0x1ea0d6[_0x1bb757][_0xd532('0x57')])){manager['update'](_0x1bb757,_0x1ea0d6[_0x1bb757][_0xd532('0x54')],handleJob(_0x1ea0d6[_0x1bb757]));logger[_0xd532('0x2d')](_0xd532('0x5b'),_0x1ea0d6[_0x1bb757]['name'],_0x1ea0d6[_0x1bb757]['cron']);}else{manager[_0xd532('0x4e')](_0x1bb757);manager['deleteJob'](_0x1bb757);logger['info']('stop\x20cron',_0x1ea0d6[_0x1bb757][_0xd532('0x1a')],_0x1ea0d6[_0x1bb757]['cron']);}}}})[_0xd532('0x35')](function(_0x253bcb){logger[_0xd532('0x32')](JSON[_0xd532('0x29')](_0x253bcb));});}exports[_0xd532('0x5c')]=function(_0x75fd73){return getJobs(_0x75fd73);};exports['start']=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 3df395f..e4482ab 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 _0x9812=['transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Mixed','Neutral','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','name','error','start','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data1','data2'];(function(_0x412ac2,_0xc8dc0b){var _0x39b24d=function(_0x3df919){while(--_0x3df919){_0x412ac2['push'](_0x412ac2['shift']());}};_0x39b24d(++_0xc8dc0b);}(_0x9812,0x159));var _0x2981=function(_0x175395,_0x8bed5b){_0x175395=_0x175395-0x0;var _0x178161=_0x9812[_0x175395];return _0x178161;};var _=require(_0x2981('0x0'));var AWS=require(_0x2981('0x1'));var rp=require(_0x2981('0x2'));var util=require(_0x2981('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x2981('0x4'))(_0x2981('0x5'));function getTranscriptionJob(_0x4801db,_0x77ef1d,_0x14492b,_0x4a99fc){return new Promise(function(_0xffdceb,_0x109b9e){var _0x7dd589=new AWS[(_0x2981('0x6'))]({'accessKeyId':_0x77ef1d,'secretAccessKey':_0x4801db,'region':_0x14492b});_0x7dd589[_0x2981('0x7')]({'TranscriptionJobName':_0x4a99fc},function(_0x5b8775,_0x31afe0){if(_0x5b8775){return _0x109b9e(_0x5b8775);}else{return _0xffdceb(_0x31afe0);}});});}function sentiment(_0x3654c9,_0x4abe4f,_0x29534d,_0x3ae072,_0xe7f5cc){return new Promise(function(_0x4bbe34,_0x57c1c0){var _0x5df3e5=new AWS[(_0x2981('0x8'))]({'accessKeyId':_0x4abe4f,'secretAccessKey':_0x3654c9,'region':_0x29534d});_0x5df3e5['detectSentiment']({'Text':_0x3ae072,'LanguageCode':_0xe7f5cc[_0x2981('0x9')](0x0,0x2)},function(_0x2aa8be,_0x2c1165){if(_0x2aa8be){return _0x57c1c0(_0x2aa8be);}else{return _0x4bbe34(_0x2c1165);}});});}function checkTranscribeJob(_0x5aabb4,_0x350df8,_0x4f113a){var _0x5a5441;return new BPromise(function(_0x191629,_0x4cab8c){logger[_0x2981('0xa')](util[_0x2981('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')]));return getTranscriptionJob(_0x4f113a[_0x2981('0xd')],_0x4f113a[_0x2981('0xe')],_0x350df8[_0x2981('0xf')],_0x5aabb4[_0x2981('0xc')])['then'](function(_0x1be7ac){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x10'),_0x5aabb4['id'],_0x5aabb4[_0x2981('0xc')],_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]));if(!_0x5aabb4[_0x2981('0x13')]){switch(_0x1be7ac[_0x2981('0x11')][_0x2981('0x12')]){case _0x2981('0x14'):var _0x4600de={'transcribeStatus':_0x1be7ac[_0x2981('0x11')]['TranscriptionJobStatus'],'fileUri':_0x1be7ac[_0x2981('0x11')][_0x2981('0x15')]['TranscriptFileUri']};logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x5aabb4['id']));return rp({'uri':_0x1be7ac['TranscriptionJob'][_0x2981('0x15')][_0x2981('0x16')],'json':!![]})[_0x2981('0x17')](function(_0x216c1f){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x18'),_0x5aabb4['id']));if(_0x216c1f&&_0x216c1f['results']&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]&&_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x2981('0x1b')]){_0x4600de[_0x2981('0x13')]='';for(var _0x4bdb8d=0x0;_0x4bdb8d<_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')]['length'];_0x4bdb8d++){_0x4600de[_0x2981('0x13')]+=_0x216c1f[_0x2981('0x19')][_0x2981('0x1a')][_0x4bdb8d]['transcript']+'';}}return _0x5aabb4[_0x2981('0x1c')](_0x4600de);})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8[_0x2981('0x22')]||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4600de[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x4b791d){if(!_0x4b791d){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x29'));}if(!_0x4b791d[_0x2981('0xd')]||!_0x4b791d[_0x2981('0xe')]){throw new db['Sequelize']['ValidationError'](_0x2981('0x2a'));}_0x5a5441=_0x4b791d;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x4600de['fileText'],_0x350df8[_0x2981('0x2c')]);})[_0x2981('0x17')](function(_0x782735){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4[_0x2981('0x1c')]({'sentiment':_0x782735[_0x2981('0x2e')],'sPositive':_0x782735['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x782735[_0x2981('0x30')][_0x2981('0x31')],'sMixed':_0x782735[_0x2981('0x30')]['Mixed'],'sNeutral':_0x782735[_0x2981('0x30')]['Neutral']});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5aabb4['id']));_0x191629();});case _0x2981('0x32'):return _0x5aabb4[_0x2981('0x1c')]({'transcribeStatus':_0x2981('0x32'),'failureReason':_0x1be7ac[_0x2981('0x11')][_0x2981('0x33')]})['then'](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});default:logger[_0x2981('0xa')](util['format'](_0x2981('0x34'),_0x5aabb4['id']));break;}}else{return BPromise[_0x2981('0x35')]()[_0x2981('0x17')](function(){if(!_0x5aabb4[_0x2981('0x1e')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x21'));}if(!_0x350df8['sentiment']||!_0x350df8[_0x2981('0x23')]||!_0x350df8[_0x2981('0x24')]||!_0x350df8['language']||!_0x350df8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x36'));}if(!_0x5aabb4[_0x2981('0x13')]){throw new Error(_0x2981('0x26'));}if(_0x350df8[_0x2981('0x23')]===_0x4f113a['id']){return _0x4f113a;}else{return db[_0x2981('0x27')][_0x2981('0x28')]({'where':{'id':_settings[_0x2981('0x23')]}});}})[_0x2981('0x17')](function(_0x213bd2){if(!_0x213bd2){throw new db[(_0x2981('0x1f'))]['ValidationError'](_0x2981('0x29'));}if(!_0x213bd2['data1']||!_0x213bd2['data2']){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x2a'));}_0x5a5441=_0x213bd2;logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2b'),_0x5aabb4['id']));return sentiment(_0x5a5441['data1'],_0x5a5441[_0x2981('0xe')],_0x350df8[_0x2981('0x24')],_0x5aabb4['fileText'],_0x350df8[_0x2981('0x2c')]);})['then'](function(_0x106c0a){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x2d'),_0x5aabb4['id']));return _0x5aabb4['update']({'sentiment':_0x106c0a[_0x2981('0x2e')],'sPositive':_0x106c0a['SentimentScore'][_0x2981('0x2f')],'sNegative':_0x106c0a['SentimentScore']['Negative'],'sMixed':_0x106c0a['SentimentScore'][_0x2981('0x37')],'sNeutral':_0x106c0a[_0x2981('0x30')][_0x2981('0x38')],'transcribeStatus':_0x2981('0x14')});})[_0x2981('0x17')](function(){logger[_0x2981('0xa')](util[_0x2981('0xb')](_0x2981('0x1d'),_0x5aabb4['id']));_0x191629();});}})['catch'](function(_0x111dad){if(_0x111dad){if(!_0x111dad['name']||_0x111dad['name']!==_0x2981('0x39')){logger['error'](util[_0x2981('0xb')](_0x2981('0x3a'),_0x5aabb4['id']),util[_0x2981('0x3b')](_0x111dad,{'showHidden':![],'depth':null}));}}_0x191629();});});}function checkTranscribe(){var _0x337fa9;var _0xbb2dc8;var _0x36af38;return db[_0x2981('0x3c')]['findAll']({'where':{'transcribeStatus':_0x2981('0x3d')}})['then'](function(_0x522362){if(!_0x522362||!_0x522362[_0x2981('0x1b')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3e'));}_0x337fa9=_0x522362;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x4d9724){if(!_0x4d9724){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x3f'));}_0xbb2dc8=_0x4d9724;if(!_0xbb2dc8['transcribe']||!_0xbb2dc8[_0x2981('0x40')]||!_0xbb2dc8[_0x2981('0xf')]||!_0xbb2dc8[_0x2981('0x2c')]||!_0xbb2dc8[_0x2981('0x25')]){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))](_0x2981('0x41'));}return db['CloudProvider'][_0x2981('0x28')]({'where':{'id':_0xbb2dc8[_0x2981('0x40')]}});})[_0x2981('0x17')](function(_0x48bbf4){if(!_0x48bbf4){throw new db[(_0x2981('0x1f'))][(_0x2981('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x48bbf4[_0x2981('0xd')]||!_0x48bbf4['data2']){throw new db[(_0x2981('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x36af38=_0x48bbf4;var _0x25f493=[];_0x337fa9[_0x2981('0x42')](function(_0x17ab4f){_0x25f493['push'](checkTranscribeJob(_0x17ab4f,_0xbb2dc8,_0x36af38));});return BPromise[_0x2981('0x43')](_0x25f493);})[_0x2981('0x44')](function(_0x436951){if(_0x436951){if(!_0x436951[_0x2981('0x45')]||_0x436951[_0x2981('0x45')]!==_0x2981('0x39')){logger[_0x2981('0x46')](util[_0x2981('0x3b')](_0x436951,{'showHidden':![],'depth':null}));}}});}exports[_0x2981('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa7c9=['No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','inspect','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','TranscriptionJob','COMPLETED','TranscriptionJobStatus','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Transcript\x20not\x20available','CloudProvider','findOne','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll'];(function(_0x345c9d,_0x2d08e8){var _0x3f1577=function(_0x42acd9){while(--_0x42acd9){_0x345c9d['push'](_0x345c9d['shift']());}};_0x3f1577(++_0x2d08e8);}(_0xa7c9,0x15b));var _0x9a7c=function(_0x5b5280,_0x26296e){_0x5b5280=_0x5b5280-0x0;var _0x39483d=_0xa7c9[_0x5b5280];return _0x39483d;};var _=require(_0x9a7c('0x0'));var AWS=require(_0x9a7c('0x1'));var rp=require(_0x9a7c('0x2'));var util=require(_0x9a7c('0x3'));var BPromise=require('bluebird');var db=require(_0x9a7c('0x4'))['db'];var logger=require('../../config/logger')(_0x9a7c('0x5'));function getTranscriptionJob(_0x1bfd8d,_0x39ca31,_0x15d827,_0x4c8c5d){return new Promise(function(_0x381581,_0x3af8d5){var _0x1957fe=new AWS[(_0x9a7c('0x6'))]({'accessKeyId':_0x39ca31,'secretAccessKey':_0x1bfd8d,'region':_0x15d827});_0x1957fe[_0x9a7c('0x7')]({'TranscriptionJobName':_0x4c8c5d},function(_0x5cc6c5,_0x36d536){if(_0x5cc6c5){return _0x3af8d5(_0x5cc6c5);}else{return _0x381581(_0x36d536);}});});}function sentiment(_0x1a29e7,_0x57c4da,_0x1f78c8,_0x46b920,_0x22f30a){return new Promise(function(_0x2aac0b,_0x64d6b9){var _0x416947=new AWS[(_0x9a7c('0x8'))]({'accessKeyId':_0x57c4da,'secretAccessKey':_0x1a29e7,'region':_0x1f78c8});_0x416947['detectSentiment']({'Text':_0x46b920,'LanguageCode':_0x22f30a['substring'](0x0,0x2)},function(_0x3142eb,_0x1fb78f){if(_0x3142eb){return _0x64d6b9(_0x3142eb);}else{return _0x2aac0b(_0x1fb78f);}});});}function checkTranscribeJob(_0x4198e3,_0x14b156,_0x17d256){var _0x2507c0;return new BPromise(function(_0x244ab8,_0x2f3e6a){logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')](_0x9a7c('0xb'),_0x4198e3['id'],_0x4198e3[_0x9a7c('0xc')]));return getTranscriptionJob(_0x17d256['data1'],_0x17d256['data2'],_0x14b156['transcribeRegion'],_0x4198e3[_0x9a7c('0xc')])[_0x9a7c('0xd')](function(_0x105e35){logger['info'](util[_0x9a7c('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4198e3['id'],_0x4198e3[_0x9a7c('0xc')],_0x105e35[_0x9a7c('0xe')]['TranscriptionJobStatus']));if(!_0x4198e3['fileText']){switch(_0x105e35['TranscriptionJob']['TranscriptionJobStatus']){case _0x9a7c('0xf'):var _0x486394={'transcribeStatus':_0x105e35['TranscriptionJob'][_0x9a7c('0x10')],'fileUri':_0x105e35[_0x9a7c('0xe')]['Transcript'][_0x9a7c('0x11')]};logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x4198e3['id']));return rp({'uri':_0x105e35[_0x9a7c('0xe')][_0x9a7c('0x12')]['TranscriptFileUri'],'json':!![]})[_0x9a7c('0xd')](function(_0x3f60ef){logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')](_0x9a7c('0x13'),_0x4198e3['id']));if(_0x3f60ef&&_0x3f60ef[_0x9a7c('0x14')]&&_0x3f60ef[_0x9a7c('0x14')][_0x9a7c('0x15')]&&_0x3f60ef[_0x9a7c('0x14')]['transcripts']['length']){_0x486394['fileText']='';for(var _0x3d85ae=0x0;_0x3d85ae<_0x3f60ef['results'][_0x9a7c('0x15')][_0x9a7c('0x16')];_0x3d85ae++){_0x486394[_0x9a7c('0x17')]+=_0x3f60ef[_0x9a7c('0x14')]['transcripts'][_0x3d85ae][_0x9a7c('0x18')]+'';}}return _0x4198e3[_0x9a7c('0x19')](_0x486394);})['then'](function(){logger[_0x9a7c('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4198e3['id']));if(!_0x4198e3[_0x9a7c('0x1a')]){throw new db[(_0x9a7c('0x1b'))]['ValidationError'](_0x9a7c('0x1c'));}if(!_0x14b156['sentiment']||!_0x14b156[_0x9a7c('0x1d')]||!_0x14b156[_0x9a7c('0x1e')]||!_0x14b156[_0x9a7c('0x1f')]||!_0x14b156[_0x9a7c('0x20')]){throw new db[(_0x9a7c('0x1b'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x486394[_0x9a7c('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x14b156['sentimentAccountId']===_0x17d256['id']){return _0x17d256;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x9a7c('0x1d')]}});}})[_0x9a7c('0xd')](function(_0x213c33){if(!_0x213c33){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x22'));}if(!_0x213c33[_0x9a7c('0x23')]||!_0x213c33['data2']){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x24'));}_0x2507c0=_0x213c33;logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')](_0x9a7c('0x25'),_0x4198e3['id']));return sentiment(_0x2507c0[_0x9a7c('0x23')],_0x2507c0[_0x9a7c('0x26')],_0x14b156[_0x9a7c('0x1e')],_0x486394[_0x9a7c('0x17')],_0x14b156['language']);})[_0x9a7c('0xd')](function(_0x1e190f){logger['info'](util[_0x9a7c('0xa')](_0x9a7c('0x27'),_0x4198e3['id']));return _0x4198e3['update']({'sentiment':_0x1e190f[_0x9a7c('0x28')],'sPositive':_0x1e190f[_0x9a7c('0x29')][_0x9a7c('0x2a')],'sNegative':_0x1e190f[_0x9a7c('0x29')][_0x9a7c('0x2b')],'sMixed':_0x1e190f[_0x9a7c('0x29')][_0x9a7c('0x2c')],'sNeutral':_0x1e190f[_0x9a7c('0x29')][_0x9a7c('0x2d')]});})[_0x9a7c('0xd')](function(){logger['info'](util[_0x9a7c('0xa')](_0x9a7c('0x2e'),_0x4198e3['id']));_0x244ab8();});case _0x9a7c('0x2f'):return _0x4198e3[_0x9a7c('0x19')]({'transcribeStatus':_0x9a7c('0x2f'),'failureReason':_0x105e35[_0x9a7c('0xe')][_0x9a7c('0x30')]})[_0x9a7c('0xd')](function(){logger[_0x9a7c('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4198e3['id']));_0x244ab8();});default:logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')](_0x9a7c('0x31'),_0x4198e3['id']));break;}}else{return BPromise[_0x9a7c('0x32')]()['then'](function(){if(!_0x4198e3[_0x9a7c('0x1a')]){throw new db['Sequelize'][(_0x9a7c('0x21'))](_0x9a7c('0x1c'));}if(!_0x14b156[_0x9a7c('0x33')]||!_0x14b156[_0x9a7c('0x1d')]||!_0x14b156[_0x9a7c('0x1e')]||!_0x14b156[_0x9a7c('0x1f')]||!_0x14b156['bucket']){throw new db[(_0x9a7c('0x1b'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4198e3[_0x9a7c('0x17')]){throw new Error(_0x9a7c('0x34'));}if(_0x14b156['sentimentAccountId']===_0x17d256['id']){return _0x17d256;}else{return db[_0x9a7c('0x35')][_0x9a7c('0x36')]({'where':{'id':_settings[_0x9a7c('0x1d')]}});}})[_0x9a7c('0xd')](function(_0x17b76c){if(!_0x17b76c){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x22'));}if(!_0x17b76c[_0x9a7c('0x23')]||!_0x17b76c[_0x9a7c('0x26')]){throw new db[(_0x9a7c('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2507c0=_0x17b76c;logger[_0x9a7c('0x9')](util[_0x9a7c('0xa')](_0x9a7c('0x25'),_0x4198e3['id']));return sentiment(_0x2507c0[_0x9a7c('0x23')],_0x2507c0['data2'],_0x14b156[_0x9a7c('0x1e')],_0x4198e3['fileText'],_0x14b156['language']);})[_0x9a7c('0xd')](function(_0x66699f){logger['info'](util['format'](_0x9a7c('0x27'),_0x4198e3['id']));return _0x4198e3[_0x9a7c('0x19')]({'sentiment':_0x66699f[_0x9a7c('0x28')],'sPositive':_0x66699f['SentimentScore'][_0x9a7c('0x2a')],'sNegative':_0x66699f[_0x9a7c('0x29')][_0x9a7c('0x2b')],'sMixed':_0x66699f['SentimentScore']['Mixed'],'sNeutral':_0x66699f[_0x9a7c('0x29')][_0x9a7c('0x2d')],'transcribeStatus':_0x9a7c('0xf')});})[_0x9a7c('0xd')](function(){logger[_0x9a7c('0x9')](util['format'](_0x9a7c('0x2e'),_0x4198e3['id']));_0x244ab8();});}})[_0x9a7c('0x37')](function(_0x35eb7e){if(_0x35eb7e){if(!_0x35eb7e[_0x9a7c('0x38')]||_0x35eb7e[_0x9a7c('0x38')]!==_0x9a7c('0x39')){logger[_0x9a7c('0x3a')](util['format'](_0x9a7c('0x3b'),_0x4198e3['id']),util['inspect'](_0x35eb7e,{'showHidden':![],'depth':null}));}}_0x244ab8();});});}function checkTranscribe(){var _0x173d22;var _0x73481b;var _0x2628d3;return db['VoiceRecording'][_0x9a7c('0x3c')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x1df633){if(!_0x1df633||!_0x1df633[_0x9a7c('0x16')]){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x3d'));}_0x173d22=_0x1df633;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x9a7c('0xd')](function(_0x1b11f9){if(!_0x1b11f9){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x3e'));}_0x73481b=_0x1b11f9;if(!_0x73481b['transcribe']||!_0x73481b[_0x9a7c('0x3f')]||!_0x73481b[_0x9a7c('0x40')]||!_0x73481b[_0x9a7c('0x1f')]||!_0x73481b[_0x9a7c('0x20')]){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x41'));}return db[_0x9a7c('0x35')][_0x9a7c('0x36')]({'where':{'id':_0x73481b[_0x9a7c('0x3f')]}});})[_0x9a7c('0xd')](function(_0x2bbd2e){if(!_0x2bbd2e){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2bbd2e['data1']||!_0x2bbd2e['data2']){throw new db[(_0x9a7c('0x1b'))][(_0x9a7c('0x21'))](_0x9a7c('0x24'));}_0x2628d3=_0x2bbd2e;var _0x3f6b9f=[];_0x173d22['forEach'](function(_0x1b6828){_0x3f6b9f[_0x9a7c('0x42')](checkTranscribeJob(_0x1b6828,_0x73481b,_0x2628d3));});return BPromise['all'](_0x3f6b9f);})[_0x9a7c('0x37')](function(_0x42d889){if(_0x42d889){if(!_0x42d889[_0x9a7c('0x38')]||_0x42d889[_0x9a7c('0x38')]!==_0x9a7c('0x39')){logger[_0x9a7c('0x3a')](util[_0x9a7c('0x43')](_0x42d889,{'showHidden':![],'depth':null}));}}});}exports['start']=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 eb65aed..b3ced32 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3d1=['contacts1','CmHopper','finished\x20populating','hopper1','hopper2','catch','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','destroy','CmContact','bulkCreate','then','log'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd3d1,0xe3));var _0x1d3d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd3d1[_0x4565bf];return _0x5610ba;};'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[_0x1d3d('0x0')]({'id':i,'firstName':_0x1d3d('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1d3d('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1d3d('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x1d3d('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1d3d('0x3')](),'updatedAt':Date[_0x1d3d('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1d3d('0x0')]({'id':i,'firstName':_0x1d3d('0x1')+i,'lastName':_0x1d3d('0x4')+i,'phone':0xf879fb460+i,'email':_0x1d3d('0x5')+i+_0x1d3d('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1d3d('0x0')]({'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[_0x1d3d('0x3')]()});}db['CmContact'][_0x1d3d('0x6')]({'where':{}})['then'](function(){return db[_0x1d3d('0x7')][_0x1d3d('0x8')](contacts);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')]('finished\x20populating',_0x1d3d('0xb'));return db[_0x1d3d('0xc')][_0x1d3d('0x6')]({'where':{}});})[_0x1d3d('0x9')](function(){return db[_0x1d3d('0xc')]['bulkCreate'](hopper);})[_0x1d3d('0x9')](function(){console['log'](_0x1d3d('0xd'),_0x1d3d('0xe'));return db[_0x1d3d('0x7')][_0x1d3d('0x8')](contacts2);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')](_0x1d3d('0xd'),'contacts2');return db[_0x1d3d('0xc')][_0x1d3d('0x8')](hopper2);})[_0x1d3d('0x9')](function(){console[_0x1d3d('0xa')](_0x1d3d('0xd'),_0x1d3d('0xf'));})[_0x1d3d('0x10')](function(_0x5093c2){console['log'](_0x5093c2);}); \ No newline at end of file +var _0xa888=['contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','log'];(function(_0x16e13b,_0x2e1df1){var _0x28a47c=function(_0x331548){while(--_0x331548){_0x16e13b['push'](_0x16e13b['shift']());}};_0x28a47c(++_0x2e1df1);}(_0xa888,0xfe));var _0x8a88=function(_0x108398,_0x5a4de0){_0x108398=_0x108398-0x0;var _0x43d99e=_0xa888[_0x108398];return _0x43d99e;};'use strict';var util=require(_0x8a88('0x0'));var db=require(_0x8a88('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8a88('0x2')]({'id':i,'firstName':_0x8a88('0x3')+i,'lastName':_0x8a88('0x4')+i,'phone':0xf879fb460+i,'email':_0x8a88('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8a88('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x8a88('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8a88('0x2')]({'id':i,'firstName':_0x8a88('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x8a88('0x5')+i+_0x8a88('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x8a88('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8a88('0x6')](),'updatedAt':Date[_0x8a88('0x6')]()});}db[_0x8a88('0x8')][_0x8a88('0x9')]({'where':{}})[_0x8a88('0xa')](function(){return db[_0x8a88('0x8')]['bulkCreate'](contacts);})[_0x8a88('0xa')](function(){console[_0x8a88('0xb')]('finished\x20populating',_0x8a88('0xc'));return db[_0x8a88('0xd')]['destroy']({'where':{}});})[_0x8a88('0xa')](function(){return db[_0x8a88('0xd')][_0x8a88('0xe')](hopper);})[_0x8a88('0xa')](function(){console[_0x8a88('0xb')](_0x8a88('0xf'),_0x8a88('0x10'));return db[_0x8a88('0x8')][_0x8a88('0xe')](contacts2);})[_0x8a88('0xa')](function(){console['log'](_0x8a88('0xf'),_0x8a88('0x11'));return db[_0x8a88('0xd')][_0x8a88('0xe')](hopper2);})[_0x8a88('0xa')](function(){console[_0x8a88('0xb')](_0x8a88('0xf'),_0x8a88('0x12'));})['catch'](function(_0x52a363){console[_0x8a88('0xb')](_0x52a363);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 711c8e6..7bf482b 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e62=['wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp'];(function(_0x281753,_0x675351){var _0x57ce90=function(_0x3b44d3){while(--_0x3b44d3){_0x281753['push'](_0x281753['shift']());}};_0x57ce90(++_0x675351);}(_0x9e62,0x14b));var _0x29e6=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x9e62[_0x2ae2bc];return _0x53c290;};'use strict';var util=require(_0x29e6('0x0'));var db=require(_0x29e6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x29e6('0x2')]({'name':util[_0x29e6('0x3')](_0x29e6('0x4'),_0x29e6('0x5'),i),'fullname':util[_0x29e6('0x3')]('%s%s',_0x29e6('0x5'),i),'email':util['format'](_0x29e6('0x6'),_0x29e6('0x5'),i),'role':_0x29e6('0x5'),'password':'password','internal':0xfa0+i,'type':_0x29e6('0x7'),'transport':[_0x29e6('0x8'),'ws',_0x29e6('0x9')],'disallow':[_0x29e6('0xa')],'allow':['ulaw'],'defaultuser':util[_0x29e6('0x3')](_0x29e6('0x4'),_0x29e6('0x5'),i),'encryption':'yes','avpf':_0x29e6('0xb'),'force_avp':'yes','icesupport':_0x29e6('0xb'),'dtlsenable':_0x29e6('0xb'),'dtlsverify':'no','dtlscertfile':_0x29e6('0xc'),'dtlsprivatekey':_0x29e6('0xd'),'dtlssetup':'actpass','callerid':util[_0x29e6('0x3')](_0x29e6('0xe'),util['format'](_0x29e6('0x4'),_0x29e6('0x5'),i),0xfa0+i)});}db[_0x29e6('0xf')]['bulkCreate'](users)[_0x29e6('0x10')](function(){console[_0x29e6('0x11')](_0x29e6('0x12'));})[_0x29e6('0x13')](function(_0x20074d){console[_0x29e6('0x11')](_0x20074d);}); \ No newline at end of file +var _0x57ea=['log','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch'];(function(_0x315c25,_0x46c884){var _0x175dac=function(_0x584ea1){while(--_0x584ea1){_0x315c25['push'](_0x315c25['shift']());}};_0x175dac(++_0x46c884);}(_0x57ea,0x14b));var _0xa57e=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x57ea[_0x13ed69];return _0x50c72e;};'use strict';var util=require('util');var db=require(_0xa57e('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa57e('0x1')]({'name':util[_0xa57e('0x2')](_0xa57e('0x3'),_0xa57e('0x4'),i),'fullname':util[_0xa57e('0x2')](_0xa57e('0x3'),_0xa57e('0x4'),i),'email':util[_0xa57e('0x2')](_0xa57e('0x5'),_0xa57e('0x4'),i),'role':_0xa57e('0x4'),'password':_0xa57e('0x6'),'internal':0xfa0+i,'type':_0xa57e('0x7'),'transport':[_0xa57e('0x8'),'ws',_0xa57e('0x9')],'disallow':[_0xa57e('0xa')],'allow':[_0xa57e('0xb')],'defaultuser':util['format'](_0xa57e('0x3'),'agent',i),'encryption':'yes','avpf':_0xa57e('0xc'),'force_avp':_0xa57e('0xc'),'icesupport':'yes','dtlsenable':_0xa57e('0xc'),'dtlsverify':'no','dtlscertfile':_0xa57e('0xd'),'dtlsprivatekey':_0xa57e('0xe'),'dtlssetup':_0xa57e('0xf'),'callerid':util['format'](_0xa57e('0x10'),util[_0xa57e('0x2')](_0xa57e('0x3'),_0xa57e('0x4'),i),0xfa0+i)});}db[_0xa57e('0x11')][_0xa57e('0x12')](users)[_0xa57e('0x13')](function(){console['log']('add\x20user');})[_0xa57e('0x14')](function(_0x3add7f){console[_0xa57e('0x15')](_0x3add7f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4cb3319..791a8fb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfba1=['util','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','length','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','VoiceQueue','userProfileId','WhatsappQueues','WhatsappQueue','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','nsp','DISCONNECTED','CONNECTED'];(function(_0x531d54,_0x4d9187){var _0x547183=function(_0x366f1c){while(--_0x366f1c){_0x531d54['push'](_0x531d54['shift']());}};_0x547183(++_0x4d9187);}(_0xfba1,0x132));var _0x1fba=function(_0x30cabd,_0x2f456b){_0x30cabd=_0x30cabd-0x0;var _0x1a7084=_0xfba1[_0x30cabd];return _0x1a7084;};'use strict';var _=require('lodash');var util=require(_0x1fba('0x0'));var BPromise=require(_0x1fba('0x1'));var db=require(_0x1fba('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x1fba('0x3')],'include':[{'as':_0x1fba('0x4'),'model':db[_0x1fba('0x5')],'attributes':['id',_0x1fba('0x3'),_0x1fba('0x6')],'raw':!![],'where':{'role':_0x1fba('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1fba('0x3')],'where':{'role':_0x1fba('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x1fba('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1fba('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1fba('0x3'),'type'],'where':{'type':_0x1fba('0x9')}};function getAssociatedResources(_0x871e90,_0x1a6ea1,_0x7dcfc4){return db[_0x1fba('0xa')][_0x1fba('0xb')]({'where':{'name':_0x871e90,'userProfileId':_0x1a6ea1},'raw':!![]})['then'](function(_0x5cba25){if(_0x5cba25){if(_0x5cba25[_0x1fba('0xc')]){switch(_0x871e90){case _0x1fba('0xd'):case _0x1fba('0xe'):case _0x1fba('0xf'):case _0x1fba('0x10'):case _0x1fba('0x11'):case _0x1fba('0x12'):case'WhatsappQueues':return db[_0x7dcfc4]['findAll'](queryQueues);case _0x1fba('0x13'):return db[_0x7dcfc4][_0x1fba('0x14')](queryTelephones);case _0x1fba('0x15'):return db[_0x7dcfc4][_0x1fba('0x14')](queryTrunks);case _0x1fba('0x16'):return db[_0x7dcfc4][_0x1fba('0x14')](queryCampaigns);}}else{return db[_0x1fba('0x17')][_0x1fba('0x14')]({'attributes':[_0x1fba('0x18')],'where':{'sectionId':_0x5cba25['id']},'raw':!![]})[_0x1fba('0x19')](function(_0x255055){if(_0x255055){var _0x91c3e6={'where':{'id':_[_0x1fba('0x1a')](_0x255055,_0x1fba('0x18'))},'raw':!![]};switch(_0x7dcfc4){case _0x1fba('0x5'):_0x91c3e6[_0x1fba('0x1b')]['role']='telephone';break;case _0x1fba('0x1c'):_0x91c3e6['where']['type']=_0x1fba('0x9');break;}return db[_0x7dcfc4][_0x1fba('0x14')](_0x91c3e6);}else{return[];}});}}else{return[];}})['then'](function(_0x5aed2a){return _0x5aed2a;});}function joinOrLeaveQueues(_0x1fce98,_0x556179,_0x1856f6,_0x2277d8){_0x1fce98[_0x556179](util[_0x1fba('0x1d')]('%s:queue:%s',_0x1856f6,_0x2277d8[_0x1fba('0x3')]));if(_0x2277d8[_0x1fba('0x4')]){for(var _0x4b9549=0x0;_0x4b9549<_0x2277d8['Agents'][_0x1fba('0x1e')];_0x4b9549+=0x1){_0x1fce98[_0x556179](util[_0x1fba('0x1d')]('user:%s',_0x2277d8[_0x1fba('0x4')][_0x4b9549][_0x1fba('0x3')]));}}}function joinOrLeave(_0x261e18,_0x3fec6b,_0x343d0b){var _0x144054;if(_0x261e18[_0x1fba('0x1f')][_0x1fba('0x20')]['id']){db['User']['find']({'attributes':['id','name','role','userProfileId'],'where':{'id':_0x261e18[_0x1fba('0x1f')][_0x1fba('0x20')]['id']},'include':[{'model':db[_0x1fba('0x21')],'as':_0x1fba('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x23')],'as':_0x1fba('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x25')],'as':_0x1fba('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x27')],'as':_0x1fba('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1fba('0x2a')],'as':_0x1fba('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x1fba('0x19')](function(_0x4cc477){if(_0x4cc477){_0x144054=_0x4cc477;_0x261e18[_0x3fec6b](util['format'](_0x1fba('0x2c'),_0x4cc477[_0x1fba('0x3')]));var _0x8cadf9=[];switch(_0x4cc477[_0x1fba('0x6')]){case _0x1fba('0x2d'):_0x261e18[_0x3fec6b](_0x1fba('0x2e'));_0x261e18[_0x3fec6b](_0x1fba('0x2f'));if(queryQueues['hasOwnProperty'](_0x1fba('0x30'))){delete queryQueues[_0x1fba('0x30')];}_0x8cadf9['push'](db['VoiceQueue'][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x32')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x33')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x34')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db['MailQueue'][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x35')][_0x1fba('0x14')](queryQueues));_0x8cadf9[_0x1fba('0x31')](db['WhatsappQueue']['findAll'](queryQueues));_0x8cadf9[_0x1fba('0x31')](db[_0x1fba('0x5')][_0x1fba('0x14')](queryTelephones));_0x8cadf9['push'](db[_0x1fba('0x36')][_0x1fba('0x14')](queryTrunks));_0x8cadf9['push'](db[_0x1fba('0x1c')]['findAll'](queryCampaigns));_0x8cadf9['push'](db['User'][_0x1fba('0x14')](queryAgents));break;case _0x1fba('0x37'):_0x261e18[_0x3fec6b](_0x1fba('0x2e'));_0x261e18[_0x3fec6b](_0x1fba('0x2f'));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources('VoiceQueues',_0x4cc477['userProfileId'],_0x1fba('0x38')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0xe'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x32')));_0x8cadf9['push'](getAssociatedResources('FaxQueues',_0x4cc477[_0x1fba('0x39')],_0x1fba('0x33')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x10'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x34')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x11'),_0x4cc477[_0x1fba('0x39')],'MailQueue'));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x12'),_0x4cc477[_0x1fba('0x39')],'OpenchannelQueue'));_0x8cadf9['push'](getAssociatedResources(_0x1fba('0x3a'),_0x4cc477[_0x1fba('0x39')],_0x1fba('0x3b')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x13'),_0x4cc477['userProfileId'],_0x1fba('0x5')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources(_0x1fba('0x15'),_0x4cc477['userProfileId'],_0x1fba('0x36')));_0x8cadf9[_0x1fba('0x31')](getAssociatedResources('IvrCampaigns',_0x4cc477[_0x1fba('0x39')],_0x1fba('0x1c')));_0x8cadf9['push'](db[_0x1fba('0x5')][_0x1fba('0x14')](queryAgents));break;case _0x1fba('0x7'):_0x261e18[_0x3fec6b]('voice:inbound');_0x261e18[_0x3fec6b]('voice:outbound');_0x8cadf9[_0x1fba('0x31')](_0x4cc477['getVoiceQueues']({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x3c')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x3d')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x3e')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x3f')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9['push'](_0x4cc477[_0x1fba('0x40')]({'attributes':['id',_0x1fba('0x3')]}));_0x8cadf9[_0x1fba('0x31')](_0x4cc477[_0x1fba('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0x1fba('0x42')](_0x8cadf9);}})['then'](function(_0x9f8f10){if(_0x9f8f10&&_0x9f8f10['length']){for(var _0x11dfad=0x0;_0x11dfad<_0x9f8f10[_0x1fba('0x1e')];_0x11dfad+=0x1){for(var _0x286526=0x0;_0x286526<_0x9f8f10[_0x11dfad]['length'];_0x286526+=0x1){switch(_0x11dfad){case 0x0:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x43'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x1:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x44'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x2:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x45'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x3:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x46'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x4:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x47'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x5:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x48'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x6:joinOrLeaveQueues(_0x261e18,_0x3fec6b,_0x1fba('0x49'),_0x9f8f10[_0x11dfad][_0x286526]);break;case 0x7:_0x261e18[_0x3fec6b](util['format'](_0x1fba('0x4a'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0x8:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')](_0x1fba('0x4b'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0x9:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')](_0x1fba('0x4c'),_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x4d')],_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;case 0xa:_0x261e18[_0x3fec6b](util[_0x1fba('0x1d')]('user:%s',_0x9f8f10[_0x11dfad][_0x286526][_0x1fba('0x3')]));break;}}}}})['then'](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x4885df=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x22')],'id');return _0x144054[_0x1fba('0x4f')](_0x4885df)['then'](function(){for(var _0x46a524=0x0;_0x46a524<_0x4885df[_0x1fba('0x1e')];_0x46a524+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x51'),{'ChatInteractionId':Number(_0x4885df[_0x46a524]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x5a4d7e=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x24')],'id');return _0x144054[_0x1fba('0x52')](_0x5a4d7e)['then'](function(){for(var _0x1aec39=0x0;_0x1aec39<_0x5a4d7e[_0x1fba('0x1e')];_0x1aec39+=0x1){_0x343d0b['emit'](_0x1fba('0x53'),{'MailInteractionId':Number(_0x5a4d7e[_0x1aec39]),'UserId':Number(_0x144054['id'])});}});}})['then'](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x5b78bd=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x26')],'id');return _0x144054['removeFaxInteractions'](_0x5b78bd)['then'](function(){for(var _0x1347bf=0x0;_0x1347bf<_0x5b78bd[_0x1fba('0x1e')];_0x1347bf+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x54'),{'FaxInteractionId':Number(_0x5b78bd[_0x1347bf]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x1f6239=_[_0x1fba('0x1a')](_0x144054[_0x1fba('0x28')],'id');return _0x144054[_0x1fba('0x55')](_0x1f6239)['then'](function(){for(var _0x2e2028=0x0;_0x2e2028<_0x1f6239[_0x1fba('0x1e')];_0x2e2028+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x56'),{'SmsInteractionId':Number(_0x1f6239[_0x2e2028]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x775753=_['map'](_0x144054[_0x1fba('0x57')],'id');return _0x144054['removeOpenchannelInteractions'](_0x775753)[_0x1fba('0x19')](function(){for(var _0x453e5a=0x0;_0x453e5a<_0x775753[_0x1fba('0x1e')];_0x453e5a+=0x1){_0x343d0b['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x775753[_0x453e5a]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x19')](function(){if(_0x3fec6b===_0x1fba('0x4e')){var _0x25c109=_['map'](_0x144054[_0x1fba('0x2b')],'id');return _0x144054['removeWhatsappInteractions'](_0x25c109)[_0x1fba('0x19')](function(){for(var _0x28675f=0x0;_0x28675f<_0x25c109[_0x1fba('0x1e')];_0x28675f+=0x1){_0x343d0b[_0x1fba('0x50')](_0x1fba('0x58'),{'WhatsappInteractionId':Number(_0x25c109[_0x28675f]),'UserId':Number(_0x144054['id'])});}});}})[_0x1fba('0x59')](function(_0x3a56ea){_0x261e18[_0x1fba('0x5a')](_0x3a56ea);});}}function onDisconnect(_0x5d7609,_0x129b33){joinOrLeave(_0x5d7609,_0x1fba('0x4e'),_0x129b33);}function onConnect(_0x53d137){joinOrLeave(_0x53d137,_0x1fba('0x5b'));}exports[_0x1fba('0x5c')]=function(_0x258778){_0x258778['on']('connection',function(_0x32e4c7){_0x32e4c7[_0x1fba('0x5d')](0x0);_0x32e4c7[_0x1fba('0x5e')]=_0x32e4c7[_0x1fba('0x5f')][_0x1fba('0x60')][_0x1fba('0x61')]+':'+_0x32e4c7[_0x1fba('0x5f')][_0x1fba('0x60')][_0x1fba('0x62')];_0x32e4c7['connectedAt']=new Date();_0x32e4c7[_0x1fba('0x5a')]=function(_0x561e93){console['log']('SocketIO\x20'+_0x32e4c7[_0x1fba('0x63')]['name']+'['+_0x32e4c7['address']+']',_0x561e93);};_0x32e4c7['on']('disconnect',function(){onDisconnect(_0x32e4c7,_0x258778);_0x32e4c7[_0x1fba('0x5a')](_0x1fba('0x64'));});onConnect(_0x32e4c7);_0x32e4c7[_0x1fba('0x5a')](_0x1fba('0x65'));});}; \ No newline at end of file +var _0xf547=['FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','voice:outbound','VoiceQueue','Trunk','IvrCampaigns','voice:inbound','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','role','telephone','agent','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','ChatQueue'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xf547,0x1b7));var _0x7f54=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xf547[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x7f54('0x0'));var util=require(_0x7f54('0x1'));var BPromise=require(_0x7f54('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x7f54('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x7f54('0x4'),'model':db[_0x7f54('0x5')],'attributes':['id',_0x7f54('0x6'),_0x7f54('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7f54('0x6')],'where':{'role':_0x7f54('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7f54('0x6')],'where':{'role':_0x7f54('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7f54('0x6'),_0x7f54('0xa')],'where':{'type':_0x7f54('0xb')}};function getAssociatedResources(_0x2799ef,_0x36f15c,_0x183c25){return db[_0x7f54('0xc')]['findOne']({'where':{'name':_0x2799ef,'userProfileId':_0x36f15c},'raw':!![]})[_0x7f54('0xd')](function(_0x323d3c){if(_0x323d3c){if(_0x323d3c['autoAssociation']){switch(_0x2799ef){case _0x7f54('0xe'):case _0x7f54('0xf'):case _0x7f54('0x10'):case _0x7f54('0x11'):case _0x7f54('0x12'):case _0x7f54('0x13'):case _0x7f54('0x14'):return db[_0x183c25][_0x7f54('0x15')](queryQueues);case _0x7f54('0x16'):return db[_0x183c25][_0x7f54('0x15')](queryTelephones);case _0x7f54('0x17'):return db[_0x183c25]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x183c25][_0x7f54('0x15')](queryCampaigns);}}else{return db[_0x7f54('0x18')][_0x7f54('0x15')]({'attributes':[_0x7f54('0x19')],'where':{'sectionId':_0x323d3c['id']},'raw':!![]})[_0x7f54('0xd')](function(_0x6f3874){if(_0x6f3874){var _0x5c3f6a={'where':{'id':_[_0x7f54('0x1a')](_0x6f3874,_0x7f54('0x19'))},'raw':!![]};switch(_0x183c25){case _0x7f54('0x5'):_0x5c3f6a[_0x7f54('0x1b')]['role']='telephone';break;case _0x7f54('0x1c'):_0x5c3f6a[_0x7f54('0x1b')][_0x7f54('0xa')]='ivr';break;}return db[_0x183c25][_0x7f54('0x15')](_0x5c3f6a);}else{return[];}});}}else{return[];}})['then'](function(_0x1cf247){return _0x1cf247;});}function joinOrLeaveQueues(_0x5a2e0a,_0x429db1,_0x243d2b,_0x59c83e){_0x5a2e0a[_0x429db1](util[_0x7f54('0x1d')](_0x7f54('0x1e'),_0x243d2b,_0x59c83e[_0x7f54('0x6')]));if(_0x59c83e[_0x7f54('0x4')]){for(var _0x172e5d=0x0;_0x172e5d<_0x59c83e[_0x7f54('0x4')][_0x7f54('0x1f')];_0x172e5d+=0x1){_0x5a2e0a[_0x429db1](util[_0x7f54('0x1d')](_0x7f54('0x20'),_0x59c83e[_0x7f54('0x4')][_0x172e5d]['name']));}}}function joinOrLeave(_0x105ddb,_0x1ddb83,_0x28db78){var _0x3206bc;if(_0x105ddb[_0x7f54('0x21')][_0x7f54('0x22')]['id']){db[_0x7f54('0x5')][_0x7f54('0x23')]({'attributes':['id','name',_0x7f54('0x7'),_0x7f54('0x24')],'where':{'id':_0x105ddb[_0x7f54('0x21')][_0x7f54('0x22')]['id']},'include':[{'model':db[_0x7f54('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7f54('0x26')],'as':_0x7f54('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f54('0x28')],'as':_0x7f54('0x29'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7f54('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x7f54('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7f54('0x2c')],'as':_0x7f54('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2fe61b){if(_0x2fe61b){_0x3206bc=_0x2fe61b;_0x105ddb[_0x1ddb83](util[_0x7f54('0x1d')](_0x7f54('0x20'),_0x2fe61b[_0x7f54('0x6')]));var _0x61649f=[];switch(_0x2fe61b[_0x7f54('0x7')]){case _0x7f54('0x2e'):_0x105ddb[_0x1ddb83]('voice:inbound');_0x105ddb[_0x1ddb83]('voice:outbound');if(queryQueues[_0x7f54('0x2f')](_0x7f54('0x30'))){delete queryQueues[_0x7f54('0x30')];}_0x61649f[_0x7f54('0x31')](db['VoiceQueue'][_0x7f54('0x15')](queryQueues));_0x61649f['push'](db[_0x7f54('0x32')][_0x7f54('0x15')](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x33')][_0x7f54('0x15')](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x34')]['findAll'](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x35')]['findAll'](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x36')][_0x7f54('0x15')](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x37')][_0x7f54('0x15')](queryQueues));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x5')][_0x7f54('0x15')](queryTelephones));_0x61649f[_0x7f54('0x31')](db['Trunk'][_0x7f54('0x15')](queryTrunks));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x1c')][_0x7f54('0x15')](queryCampaigns));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x5')][_0x7f54('0x15')](queryAgents));break;case _0x7f54('0x38'):_0x105ddb[_0x1ddb83]('voice:inbound');_0x105ddb[_0x1ddb83](_0x7f54('0x39'));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0xe'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x3a')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0xf'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x32')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x10'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x33')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x11'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x34')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x12'),_0x2fe61b['userProfileId'],_0x7f54('0x35')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x13'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x36')));_0x61649f['push'](getAssociatedResources('WhatsappQueues',_0x2fe61b[_0x7f54('0x24')],'WhatsappQueue'));_0x61649f['push'](getAssociatedResources(_0x7f54('0x16'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x5')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x17'),_0x2fe61b['userProfileId'],_0x7f54('0x3b')));_0x61649f[_0x7f54('0x31')](getAssociatedResources(_0x7f54('0x3c'),_0x2fe61b[_0x7f54('0x24')],_0x7f54('0x1c')));_0x61649f[_0x7f54('0x31')](db[_0x7f54('0x5')][_0x7f54('0x15')](queryAgents));break;case _0x7f54('0x9'):_0x105ddb[_0x1ddb83](_0x7f54('0x3d'));_0x105ddb[_0x1ddb83](_0x7f54('0x39'));_0x61649f[_0x7f54('0x31')](_0x2fe61b[_0x7f54('0x3e')]({'attributes':['id','name']}));_0x61649f[_0x7f54('0x31')](_0x2fe61b['getChatQueues']({'attributes':['id','name']}));_0x61649f[_0x7f54('0x31')](_0x2fe61b[_0x7f54('0x3f')]({'attributes':['id',_0x7f54('0x6')]}));_0x61649f[_0x7f54('0x31')](_0x2fe61b[_0x7f54('0x40')]({'attributes':['id','name']}));_0x61649f[_0x7f54('0x31')](_0x2fe61b[_0x7f54('0x41')]({'attributes':['id','name']}));_0x61649f[_0x7f54('0x31')](_0x2fe61b[_0x7f54('0x42')]({'attributes':['id',_0x7f54('0x6')]}));_0x61649f[_0x7f54('0x31')](_0x2fe61b['getWhatsappQueues']({'attributes':['id',_0x7f54('0x6')]}));break;}return BPromise[_0x7f54('0x43')](_0x61649f);}})[_0x7f54('0xd')](function(_0x5bbd06){if(_0x5bbd06&&_0x5bbd06[_0x7f54('0x1f')]){for(var _0x4753de=0x0;_0x4753de<_0x5bbd06[_0x7f54('0x1f')];_0x4753de+=0x1){for(var _0x2c0766=0x0;_0x2c0766<_0x5bbd06[_0x4753de][_0x7f54('0x1f')];_0x2c0766+=0x1){switch(_0x4753de){case 0x0:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,_0x7f54('0x44'),_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x1:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,_0x7f54('0x45'),_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x2:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,_0x7f54('0x46'),_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x3:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,_0x7f54('0x47'),_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x4:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,_0x7f54('0x48'),_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x5:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,'openchannel',_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x6:joinOrLeaveQueues(_0x105ddb,_0x1ddb83,'whatsapp',_0x5bbd06[_0x4753de][_0x2c0766]);break;case 0x7:_0x105ddb[_0x1ddb83](util['format'](_0x7f54('0x49'),_0x5bbd06[_0x4753de][_0x2c0766][_0x7f54('0x6')]));break;case 0x8:_0x105ddb[_0x1ddb83](util[_0x7f54('0x1d')](_0x7f54('0x4a'),_0x5bbd06[_0x4753de][_0x2c0766][_0x7f54('0x6')]));break;case 0x9:_0x105ddb[_0x1ddb83](util[_0x7f54('0x1d')](_0x7f54('0x4b'),_0x5bbd06[_0x4753de][_0x2c0766][_0x7f54('0xa')],_0x5bbd06[_0x4753de][_0x2c0766]['name']));break;case 0xa:_0x105ddb[_0x1ddb83](util['format'](_0x7f54('0x20'),_0x5bbd06[_0x4753de][_0x2c0766]['name']));break;}}}}})[_0x7f54('0xd')](function(){if(_0x1ddb83==='leave'){var _0x4c4112=_[_0x7f54('0x1a')](_0x3206bc['ChatInteractions'],'id');return _0x3206bc[_0x7f54('0x4c')](_0x4c4112)[_0x7f54('0xd')](function(){for(var _0x1b2b4d=0x0;_0x1b2b4d<_0x4c4112['length'];_0x1b2b4d+=0x1){_0x28db78[_0x7f54('0x4d')](_0x7f54('0x4e'),{'ChatInteractionId':Number(_0x4c4112[_0x1b2b4d]),'UserId':Number(_0x3206bc['id'])});}});}})[_0x7f54('0xd')](function(){if(_0x1ddb83===_0x7f54('0x4f')){var _0x548400=_[_0x7f54('0x1a')](_0x3206bc['MailInteractions'],'id');return _0x3206bc['removeMailInteractions'](_0x548400)[_0x7f54('0xd')](function(){for(var _0x57e5da=0x0;_0x57e5da<_0x548400[_0x7f54('0x1f')];_0x57e5da+=0x1){_0x28db78[_0x7f54('0x4d')](_0x7f54('0x50'),{'MailInteractionId':Number(_0x548400[_0x57e5da]),'UserId':Number(_0x3206bc['id'])});}});}})[_0x7f54('0xd')](function(){if(_0x1ddb83===_0x7f54('0x4f')){var _0xe13fb3=_[_0x7f54('0x1a')](_0x3206bc[_0x7f54('0x29')],'id');return _0x3206bc[_0x7f54('0x51')](_0xe13fb3)[_0x7f54('0xd')](function(){for(var _0x296979=0x0;_0x296979<_0xe13fb3['length'];_0x296979+=0x1){_0x28db78[_0x7f54('0x4d')](_0x7f54('0x52'),{'FaxInteractionId':Number(_0xe13fb3[_0x296979]),'UserId':Number(_0x3206bc['id'])});}});}})[_0x7f54('0xd')](function(){if(_0x1ddb83===_0x7f54('0x4f')){var _0x38ddb5=_[_0x7f54('0x1a')](_0x3206bc[_0x7f54('0x2a')],'id');return _0x3206bc[_0x7f54('0x53')](_0x38ddb5)[_0x7f54('0xd')](function(){for(var _0xfd4cff=0x0;_0xfd4cff<_0x38ddb5[_0x7f54('0x1f')];_0xfd4cff+=0x1){_0x28db78[_0x7f54('0x4d')](_0x7f54('0x54'),{'SmsInteractionId':Number(_0x38ddb5[_0xfd4cff]),'UserId':Number(_0x3206bc['id'])});}});}})['then'](function(){if(_0x1ddb83===_0x7f54('0x4f')){var _0x182698=_[_0x7f54('0x1a')](_0x3206bc['OpenchannelInteractions'],'id');return _0x3206bc['removeOpenchannelInteractions'](_0x182698)[_0x7f54('0xd')](function(){for(var _0x45463b=0x0;_0x45463b<_0x182698[_0x7f54('0x1f')];_0x45463b+=0x1){_0x28db78['emit'](_0x7f54('0x55'),{'OpenchannelInteractionId':Number(_0x182698[_0x45463b]),'UserId':Number(_0x3206bc['id'])});}});}})[_0x7f54('0xd')](function(){if(_0x1ddb83===_0x7f54('0x4f')){var _0x49bc41=_['map'](_0x3206bc[_0x7f54('0x2d')],'id');return _0x3206bc['removeWhatsappInteractions'](_0x49bc41)['then'](function(){for(var _0x16a722=0x0;_0x16a722<_0x49bc41[_0x7f54('0x1f')];_0x16a722+=0x1){_0x28db78[_0x7f54('0x4d')](_0x7f54('0x56'),{'WhatsappInteractionId':Number(_0x49bc41[_0x16a722]),'UserId':Number(_0x3206bc['id'])});}});}})[_0x7f54('0x57')](function(_0x556f49){_0x105ddb[_0x7f54('0x58')](_0x556f49);});}}function onDisconnect(_0x405c06,_0x5a0c57){joinOrLeave(_0x405c06,_0x7f54('0x4f'),_0x5a0c57);}function onConnect(_0x52a4e9){joinOrLeave(_0x52a4e9,_0x7f54('0x59'));}exports[_0x7f54('0x5a')]=function(_0xcfbd5){_0xcfbd5['on'](_0x7f54('0x5b'),function(_0x18bc97){_0x18bc97[_0x7f54('0x5c')](0x0);_0x18bc97[_0x7f54('0x5d')]=_0x18bc97[_0x7f54('0x5e')]['connection']['remoteAddress']+':'+_0x18bc97['request'][_0x7f54('0x5b')]['remotePort'];_0x18bc97['connectedAt']=new Date();_0x18bc97[_0x7f54('0x58')]=function(_0x41b37f){console['log']('SocketIO\x20'+_0x18bc97[_0x7f54('0x5f')]['name']+'['+_0x18bc97[_0x7f54('0x5d')]+']',_0x41b37f);};_0x18bc97['on']('disconnect',function(){onDisconnect(_0x18bc97,_0xcfbd5);_0x18bc97[_0x7f54('0x58')](_0x7f54('0x60'));});onConnect(_0x18bc97);_0x18bc97[_0x7f54('0x58')](_0x7f54('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index eae1dff..668ab79 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 _0x752c=['interface','format','SIP/%s','incomingmessage','catch','outgoingmessage','event','opened','closed','User','find','default','length','hasOwnProperty','model','hook','callback','toLowerCase','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','closedinteraction','WhatsappMessage','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','EventManager','then','error','code','Trigger,\x20%s','get','channel','direction','UserId','name'];(function(_0x4a419b,_0x30d534){var _0x5a8926=function(_0x232538){while(--_0x232538){_0x4a419b['push'](_0x4a419b['shift']());}};_0x5a8926(++_0x30d534);}(_0x752c,0xea));var _0xc752=function(_0x3e34b3,_0x47109f){_0x3e34b3=_0x3e34b3-0x0;var _0x526990=_0x752c[_0x3e34b3];return _0x526990;};'use strict';var util=require(_0xc752('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc752('0x1'));var logger=require(_0xc752('0x2'))(_0xc752('0x3'));var client=jayson[_0xc752('0x4')][_0xc752('0x5')]({'port':0x232a});var triggers=[{'channel':_0xc752('0x6'),'model':_0xc752('0x7'),'event':_0xc752('0x8'),'condition':_0xc752('0x9'),'callback':afterCreate},{'channel':_0xc752('0x6'),'model':_0xc752('0x7'),'event':_0xc752('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Chat','model':_0xc752('0xb'),'event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage},{'channel':_0xc752('0xd'),'model':'SmsInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xc752('0xd'),'model':_0xc752('0xe'),'event':_0xc752('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc752('0xd'),'model':_0xc752('0xf'),'event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage},{'channel':_0xc752('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0xc752('0x9'),'callback':afterCreate},{'channel':_0xc752('0x10'),'model':_0xc752('0x11'),'event':_0xc752('0xa'),'condition':_0xc752('0x12'),'callback':afterUpdate},{'channel':_0xc752('0x10'),'model':_0xc752('0x13'),'event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage},{'channel':_0xc752('0x14'),'model':'FaxInteraction','event':'afterCreate','condition':_0xc752('0x9'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':'afterUpdate','condition':_0xc752('0x12'),'callback':afterUpdate},{'channel':_0xc752('0x14'),'model':'FaxMessage','event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage},{'channel':_0xc752('0x15'),'model':_0xc752('0x16'),'event':_0xc752('0x8'),'condition':_0xc752('0x9'),'callback':afterCreate},{'channel':_0xc752('0x15'),'model':_0xc752('0x16'),'event':_0xc752('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xc752('0x17'),'event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage},{'channel':_0xc752('0x18'),'model':'OpenchannelInteraction','event':_0xc752('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0xc752('0x19'),'event':_0xc752('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xc752('0x18'),'model':'OpenchannelMessage','event':_0xc752('0x8'),'condition':_0xc752('0xc'),'callback':afterCreateMessage}];function request(_0x4dd178){return client['request'](_0xc752('0x1a'),_0x4dd178)[_0xc752('0x1b')](function(_0x29dff3){logger['info']('Trigger,\x20%s',_0xc752('0x1a'),_0x29dff3);if(_0x29dff3[_0xc752('0x1c')]){if(_0x29dff3[_0xc752('0x1c')][_0xc752('0x1d')]===0x1f4){logger[_0xc752('0x1c')](_0xc752('0x1e'),'EventManager',_0x29dff3['error']);}}})['catch'](function(_0xdd1ec6){logger['error'](_0xc752('0x1e'),_0xc752('0x1a'),_0xdd1ec6);});}function afterCreateMessage(_0x1564ce,_0x273ec5){return function(_0x4391e1,_0x2d582d){_0x4391e1=_0x4391e1[_0xc752('0x1f')]({'plain':!![]});_0x4391e1[_0xc752('0x20')]=_0x1564ce;_0x4391e1['event']=_0x4391e1[_0xc752('0x21')];if(_0x4391e1['UserId']){return db['User']['find']({'where':{'id':_0x4391e1[_0xc752('0x22')]},'attributes':['id',_0xc752('0x23')],'raw':!![]})['then'](function(_0x4daee7){_0x4391e1[_0xc752('0x24')]=util[_0xc752('0x25')](_0xc752('0x26'),_0x4daee7[_0xc752('0x23')]);_0x4391e1[_0xc752('0x20')]=_0x1564ce;return request({'event':_0xc752('0x27'),'message':_0x4391e1});})[_0xc752('0x28')](function(_0x9b8140){console['error'](_0x9b8140);});}else{return request({'event':_0xc752('0x29'),'message':_0x4391e1});}};}function afterCreate(_0x116663,_0x4bb694){return function(_0x36a815,_0x3d137){_0x36a815=_0x36a815[_0xc752('0x1f')]({'plain':!![]});_0x36a815['channel']=_0x116663;_0x36a815[_0xc752('0x2a')]=_0xc752('0x2b');return request({'event':_0x4bb694,'message':_0x36a815});};}function afterUpdate(_0x22f50f,_0x2e2f5e){return function(_0x171afe,_0x36c586){if(_0x171afe['changed'](_0xc752('0x2c'))&&_0x171afe['closed']){_0x171afe=_0x171afe[_0xc752('0x1f')]({'plain':!![]});_0x171afe[_0xc752('0x20')]=_0x22f50f;_0x171afe[_0xc752('0x2a')]='closed';if(_0x171afe[_0xc752('0x22')]){return db[_0xc752('0x2d')][_0xc752('0x2e')]({'where':{'id':_0x171afe[_0xc752('0x22')]},'attributes':['id',_0xc752('0x23')],'raw':!![]})[_0xc752('0x1b')](function(_0x2c7040){_0x171afe[_0xc752('0x24')]=util['format'](_0xc752('0x26'),_0x2c7040[_0xc752('0x23')]);return request({'event':_0x2e2f5e,'message':_0x171afe});})['catch'](function(_0x48916f){console[_0xc752('0x1c')](_0x48916f);});}else{return request({'event':_0x2e2f5e,'message':_0x171afe});}}};}exports[_0xc752('0x2f')]=function(){for(var _0x289014=0x0;_0x289014=_0x39eba9[_0x6ff9('0x10')]){throw Error(_0x6ff9('0x11'));}_0x48c3e8(_0x2f8be4);})['catch'](function(_0xc2333e){_0x38c51d(_0xc2333e);});});}; \ No newline at end of file +var _0x01e2=['User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','./license/util','voice','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent'];(function(_0x508a0a,_0x3ed316){var _0x4acf06=function(_0x9cea61){while(--_0x9cea61){_0x508a0a['push'](_0x508a0a['shift']());}};_0x4acf06(++_0x3ed316);}(_0x01e2,0x123));var _0x201e=function(_0x57b51e,_0x3f9e16){_0x57b51e=_0x57b51e-0x0;var _0x1efb57=_0x01e2[_0x57b51e];return _0x1efb57;};'use strict';var _=require('lodash');var BPromise=require(_0x201e('0x0'));var db=require(_0x201e('0x1'))['db'];var util=require(_0x201e('0x2'));var channels=[_0x201e('0x3'),'mail',_0x201e('0x4'),_0x201e('0x5'),_0x201e('0x6'),'whatsapp',_0x201e('0x7')];exports[_0x201e('0x8')]=function(){return channels;};exports[_0x201e('0x9')]=function(_0x49157d){_0x49157d=_0x49157d[_0x201e('0xa')]();return _['includes'](channels,_0x49157d);};exports[_0x201e('0xb')]=function(_0x3d5b36,_0x4b0ffc,_0x34ea07,_0x2ddd47){var _0x350d4b={'loginAttempts':_0x4b0ffc,'blocked':_0x34ea07};if(!_[_0x201e('0xc')](_0x2ddd47)){_0x350d4b[_0x201e('0xd')]=_0x2ddd47;}return _0x3d5b36[_0x201e('0xe')](_0x350d4b);};exports[_0x201e('0xf')]=function(_0x2e76e5){return new BPromise(function(_0xef0b91,_0x278638){var _0x467af7=0x0;if(_0x2e76e5['role']!==_0x201e('0x10')){_0xef0b91(_0x2e76e5);}db[_0x201e('0x11')][_0x201e('0x12')]({'where':{'role':_0x201e('0x10'),'online':!![],'id':{'$ne':_0x2e76e5['id']}}})[_0x201e('0x13')](function(_0x57638e){_0x467af7=_0x57638e;return util[_0x201e('0xf')]();})[_0x201e('0x13')](function(_0x2aa7b0){if(_0x2aa7b0&&_0x2aa7b0[_0x201e('0x14')]&&_0x467af7>=_0x2aa7b0[_0x201e('0x14')]){throw Error(_0x201e('0x15'));}_0xef0b91(_0x2e76e5);})['catch'](function(_0x596108){_0x278638(_0x596108);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index cc876f6..7f94a37 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67b6=['send','exports','status','render','json'];(function(_0x26224c,_0x1a354c){var _0x4c2bc5=function(_0x179343){while(--_0x179343){_0x26224c['push'](_0x26224c['shift']());}};_0x4c2bc5(++_0x1a354c);}(_0x67b6,0x150));var _0x667b=function(_0x581618,_0x13cb14){_0x581618=_0x581618-0x0;var _0x19d2d8=_0x67b6[_0x581618];return _0x19d2d8;};'use strict';module[_0x667b('0x0')][0x194]=function pageNotFound(_0x519066,_0x3abae3){var _0x479f24='404';var _0x29673e=0x194;var _0x28f7ed={'status':_0x29673e};_0x3abae3[_0x667b('0x1')](_0x28f7ed[_0x667b('0x1')]);_0x3abae3[_0x667b('0x2')](_0x479f24,{},function(_0x2398c8,_0x20269d){if(_0x2398c8){return _0x3abae3[_0x667b('0x1')](_0x28f7ed['status'])[_0x667b('0x3')](_0x28f7ed);}_0x3abae3[_0x667b('0x4')](_0x20269d);});}; \ No newline at end of file +var _0x8463=['send','exports','404','status','render','json'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x8463,0x16f));var _0x3846=function(_0x251b5a,_0x5a6ea5){_0x251b5a=_0x251b5a-0x0;var _0xf1ebbc=_0x8463[_0x251b5a];return _0xf1ebbc;};'use strict';module[_0x3846('0x0')][0x194]=function pageNotFound(_0x2db998,_0x316ce7){var _0x111c70=_0x3846('0x1');var _0x27c344=0x194;var _0x984cc8={'status':_0x27c344};_0x316ce7[_0x3846('0x2')](_0x984cc8[_0x3846('0x2')]);_0x316ce7[_0x3846('0x3')](_0x111c70,{},function(_0x167b4c,_0x1037ea){if(_0x167b4c){return _0x316ce7['status'](_0x984cc8[_0x3846('0x2')])[_0x3846('0x4')](_0x984cc8);}_0x316ce7[_0x3846('0x5')](_0x1037ea);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ef7d7e5..b4e9f8c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7923=['Disposition','Dispositions','Answers','Interactions','Applications','List','ListId','Template','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tags','mail_interaction_has_tags','Users','MailInteractionId','Attachments','Interaction','restrict','DashboardItem','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','team_has_fax_queues','SmsAccountId','SmsApplication','TagId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatWebsiteId','ChatMessage','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','AttachmentId','ChatOfflineMessage','team_has_chat_queues','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','AutomationAllId','AutomationAnyId','Actions','AutomationId','Intervals','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','Description','VariableId','AccountId','Subject','Field','Variable','int_desk_configuration_has_tags','ZohoField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','ToId','SessionId','ProjectId','JscriptyAnswerReport','FaxQueues','HopperBlacks','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','determine','xC@LL1234','mysql','utf8mb4','name','sequelizeHistory','defaultsDeep','motion2','xcall','127.0.0.1','utf8_general_ci','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceExtension','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','MailQueue','UserMailQueue','ChatQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserWhatsappQueue','user_has_voice_prefixes','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Smtp'];(function(_0x3ddff2,_0x1a62ea){var _0x31bfd7=function(_0x362950){while(--_0x362950){_0x3ddff2['push'](_0x3ddff2['shift']());}};_0x31bfd7(++_0x1a62ea);}(_0x7923,0x8f));var _0x3792=function(_0x353afa,_0x4b9bd1){_0x353afa=_0x353afa-0x0;var _0x15cf5a=_0x7923[_0x353afa];return _0x15cf5a;};'use strict';var path=require(_0x3792('0x0'));var config=require(_0x3792('0x1'));var Sequelize=require(_0x3792('0x2'));var _=require(_0x3792('0x3'));var jstz=require(_0x3792('0x4'));var timezone=jstz[_0x3792('0x5')]();config[_0x3792('0x2')]=_['defaultsDeep'](config[_0x3792('0x2')],{'database':'motion2','username':'xcall','password':_0x3792('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3792('0x7'),'dialectOptions':{'charset':_0x3792('0x8')},'logging':![],'timezone':timezone[_0x3792('0x9')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x3792('0xa')]=_[_0x3792('0xb')](config['sequelizeHistory'],{'database':_0x3792('0xc'),'username':_0x3792('0xd'),'password':'xC@LL1234','options':{'host':_0x3792('0xe'),'port':0xcea,'dialect':_0x3792('0x7'),'dialectOptions':{'charset':_0x3792('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x3792('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3792('0x2')][_0x3792('0x10')],config[_0x3792('0x2')]['username'],config['sequelize'][_0x3792('0x11')],config[_0x3792('0x2')][_0x3792('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3792('0xa')][_0x3792('0x10')],config[_0x3792('0xa')][_0x3792('0x13')],config[_0x3792('0xa')][_0x3792('0x11')],config[_0x3792('0xa')][_0x3792('0x12')])};db[_0x3792('0x14')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x16'));db[_0x3792('0x17')]=db[_0x3792('0x2')]['import'](_0x3792('0x18'));db[_0x3792('0x19')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1a'));db['VoiceExtension']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1b'));db[_0x3792('0x1c')]=db[_0x3792('0x2')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x3792('0x1d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x1e'));db[_0x3792('0x1f')]=db[_0x3792('0x2')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x3792('0x20')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x21'));db['VoiceMail']=db[_0x3792('0x2')]['import'](_0x3792('0x22'));db[_0x3792('0x23')]=db['sequelize']['import'](_0x3792('0x24'));db[_0x3792('0x25')]=db[_0x3792('0x2')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x3792('0x26')]=db[_0x3792('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x3792('0x27')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x28'));db['VoiceQueueReport']=db['sequelize'][_0x3792('0x15')](_0x3792('0x29'));db[_0x3792('0x2a')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x2b'));db[_0x3792('0x2c')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/trunk/trunk.model');db[_0x3792('0x2d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x2e'));db[_0x3792('0x2f')]=db['sequelize']['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x3792('0x30')]=db['sequelize'][_0x3792('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x3792('0x31')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x32'));db['UserMailQueue']=db[_0x3792('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x3792('0x33')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x34'));db['UserSmsQueue']=db['sequelize'][_0x3792('0x15')](_0x3792('0x35'));db[_0x3792('0x36')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x37'));db['UserWhatsappQueue']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x38'));db[_0x3792('0x39')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x3a'));db[_0x3792('0x3b')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0x3792('0x3c')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailQueue/mailQueue.model');db[_0x3792('0x3d')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x3792('0x3e')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x3f'));db[_0x3792('0x40')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x41'));db[_0x3792('0x42')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/mailApplication/mailApplication.model');db[_0x3792('0x43')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x44'));db['Dashboard']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x45'));db['DashboardItem']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x46'));db[_0x3792('0x47')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x48'));db[_0x3792('0x49')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4a'));db[_0x3792('0x4b')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4c'));db[_0x3792('0x4d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x4e'));db[_0x3792('0x4f')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/faxQueue/faxQueue.model');db[_0x3792('0x50')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x51'));db[_0x3792('0x52')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x53'));db['SmsApplication']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x54'));db[_0x3792('0x55')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x56'));db[_0x3792('0x57')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x58'));db[_0x3792('0x59')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5a'));db[_0x3792('0x5b')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5c'));db[_0x3792('0x5d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x5e'));db[_0x3792('0x5f')]=db[_0x3792('0x2')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x60'));db['OpenchannelQueue']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x61'));db[_0x3792('0x62')]=db[_0x3792('0x2')]['import'](_0x3792('0x63'));db[_0x3792('0x64')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x3792('0x65')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x66'));db['ChatInteraction']=db['sequelize']['import'](_0x3792('0x67'));db['ChatMessage']=db[_0x3792('0x2')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x3792('0x15')](_0x3792('0x68'));db[_0x3792('0x69')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x6a'));db['ChatGroup']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6b'));db[_0x3792('0x6c')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6d'));db[_0x3792('0x6e')]=db['sequelize'][_0x3792('0x15')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x6f'));db[_0x3792('0x70')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x71'));db[_0x3792('0x72')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x73'));db[_0x3792('0x74')]=db[_0x3792('0x2')]['import'](_0x3792('0x75'));db[_0x3792('0x76')]=db[_0x3792('0x2')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x3792('0x77')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3792('0x78')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x79'));db[_0x3792('0x7a')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x7b'));db[_0x3792('0x7c')]=db[_0x3792('0x2')]['import'](_0x3792('0x7d'));db[_0x3792('0x7e')]=db[_0x3792('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x7f'));db[_0x3792('0x80')]=db['sequelize']['import'](_0x3792('0x81'));db['Interval']=db['sequelize'][_0x3792('0x15')](_0x3792('0x82'));db[_0x3792('0x83')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x84'));db[_0x3792('0x85')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x86'));db['VoiceQueuesLog']=db['sequelize'][_0x3792('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x3792('0x87')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x88'));db[_0x3792('0x89')]=db[_0x3792('0x2')]['import']('../api/sound/sound.model');db[_0x3792('0x8a')]=db[_0x3792('0x2')]['import'](_0x3792('0x8b'));db['Template']=db['sequelize']['import'](_0x3792('0x8c'));db[_0x3792('0x8d')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/trigger/trigger.model');db['Variable']=db[_0x3792('0x2')]['import'](_0x3792('0x8e'));db[_0x3792('0x8f')]=db['sequelize']['import'](_0x3792('0x90'));db['IntegrationReport']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x91'));db[_0x3792('0x92')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x93'));db[_0x3792('0x94')]=db['sequelize'][_0x3792('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x3792('0x95')]=db[_0x3792('0x2')]['import'](_0x3792('0x96'));db[_0x3792('0x97')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x98'));db[_0x3792('0x99')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x9a'));db[_0x3792('0x9b')]=db[_0x3792('0x2')]['import'](_0x3792('0x9c'));db[_0x3792('0x9d')]=db['sequelize'][_0x3792('0x15')](_0x3792('0x9e'));db[_0x3792('0x9f')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa0'));db[_0x3792('0xa1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa2'));db[_0x3792('0xa3')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa4'));db[_0x3792('0xa5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xa6'));db[_0x3792('0xa7')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x3792('0xa8')]=db['sequelize'][_0x3792('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0x3792('0xa9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xaa'));db[_0x3792('0xab')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xac'));db[_0x3792('0xad')]=db[_0x3792('0x2')]['import'](_0x3792('0xae'));db[_0x3792('0xaf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb0'));db['ZohoField']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intZohoField/intZohoField.model');db[_0x3792('0xb1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb2'));db[_0x3792('0xb3')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x3792('0xb4')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x3792('0xb5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb6'));db['FreshdeskConfiguration']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x3792('0xb7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xb8'));db[_0x3792('0xb9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xba'));db[_0x3792('0xbb')]=db[_0x3792('0x2')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x3792('0xbc')]=db[_0x3792('0x2')]['import'](_0x3792('0xbd'));db['ServicenowAccount']=db['sequelize'][_0x3792('0x15')](_0x3792('0xbe'));db[_0x3792('0xbf')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xc0'));db[_0x3792('0xc1')]=db['sequelize']['import'](_0x3792('0xc2'));db[_0x3792('0xc3')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x3792('0xc4')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xc5'));db[_0x3792('0xc6')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xc7'));db[_0x3792('0xc8')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xc9'));db[_0x3792('0xca')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x3792('0xcb')]=db[_0x3792('0x2')]['import'](_0x3792('0xcc'));db[_0x3792('0x8f')]=db[_0x3792('0x2')]['import'](_0x3792('0x90'));db[_0x3792('0xcd')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xce'));db[_0x3792('0xcf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd0'));db[_0x3792('0xd1')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xd2'));db['JscriptyAnswerReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x3792('0xd3')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd4'));db[_0x3792('0xd5')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xd6'));db[_0x3792('0xd7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xd8'));db['SquareReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/squareReport/squareReport.model');db[_0x3792('0xd9')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xda'));db[_0x3792('0xdb')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xdc'));db[_0x3792('0xdd')]=db[_0x3792('0x2')]['import'](_0x3792('0xde'));db[_0x3792('0xdf')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe0'));db[_0x3792('0xe1')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe2'));db['SquareRecording']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe3'));db[_0x3792('0xe4')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe5'));db[_0x3792('0xe6')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe7'));db['License']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xe8'));db[_0x3792('0xe9')]=db[_0x3792('0x2')]['import'](_0x3792('0xea'));db[_0x3792('0xeb')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xec'));db[_0x3792('0xed')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xee'));db[_0x3792('0xef')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf0'));db['MailTransferReport']=db[_0x3792('0x2')]['import'](_0x3792('0xf1'));db['ChatTransferReport']=db[_0x3792('0x2')]['import'](_0x3792('0xf2'));db[_0x3792('0xf3')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xf4'));db[_0x3792('0xf5')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf6'));db['SmsTransferReport']=db[_0x3792('0x2')][_0x3792('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x3792('0xf7')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xf8'));db[_0x3792('0xf9')]=db['sequelize'][_0x3792('0x15')](_0x3792('0xfa'));db[_0x3792('0xfb')]=db[_0x3792('0x2')]['import'](_0x3792('0xfc'));db['UserProfileSection']=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0xfd'));db[_0x3792('0xfe')]=db['sequelize'][_0x3792('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x3792('0xff')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x100'));db[_0x3792('0x101')]=db[_0x3792('0x2')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x3792('0x102')]=db['sequelize']['import'](_0x3792('0x103'));db[_0x3792('0x104')]=db[_0x3792('0x2')]['import'](_0x3792('0x105'));db[_0x3792('0x106')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x107'));db[_0x3792('0x108')]=db[_0x3792('0x2')][_0x3792('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x3792('0x109')]=db['sequelize']['import'](_0x3792('0x10a'));db[_0x3792('0x10b')]=db[_0x3792('0x2')]['import'](_0x3792('0x10c'));db[_0x3792('0x10d')]=db[_0x3792('0x2')][_0x3792('0x15')](_0x3792('0x10e'));db[_0x3792('0x14')][_0x3792('0x10f')](db[_0x3792('0x110')],{'as':'VoiceMail','onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x1f')],{'as':_0x3792('0x114'),'foreignKey':'UserId'});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x2f')],{'as':'VoiceQueuesRt','foreignKey':_0x3792('0x112')});db['User']['hasMany'](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'onDelete':_0x3792('0x111'),'hooks':!![]});db['User'][_0x3792('0x113')](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x76')],{'as':'HopperHistory','foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x119')],{'as':_0x3792('0x11a'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x55')],{'as':_0x3792('0x11b'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x4b')],{'as':_0x3792('0x11c'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x3e')],{'as':'MailInteractions','foreignKey':_0x3792('0x112')});db[_0x3792('0x14')][_0x3792('0x113')](db[_0x3792('0x104')],{'as':'WhatsappInteractions','foreignKey':_0x3792('0x112')});db['User'][_0x3792('0x113')](db[_0x3792('0xff')],{'as':'Notifications','foreignKey':_0x3792('0x11d')});db[_0x3792('0x14')][_0x3792('0x11e')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x3792('0x11f')});db['User'][_0x3792('0x120')](db[_0x3792('0x121')],{'as':_0x3792('0x122'),'through':_0x3792('0x123')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'through':'cm_user_has_contacts'});db['User'][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':'Lists','through':_0x3792('0x126')});db[_0x3792('0x14')]['belongsToMany'](db[_0x3792('0xe6')],{'through':'user_has_teams'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x3e')],{'as':_0x3792('0x127'),'through':_0x3792('0x128')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x119')],{'as':_0x3792('0x11a'),'through':'user_has_chat_interactions'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x4b')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x3792('0x120')](db[_0x3792('0x55')],{'as':_0x3792('0x11b'),'through':_0x3792('0x129')});db[_0x3792('0x14')][_0x3792('0x120')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'through':_0x3792('0x12a')});db['User'][_0x3792('0x120')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x1d')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x3792('0x120')](db[_0x3792('0x12b')],{'as':'MailQueues','through':_0x3792('0x12c'),'required':![]});db[_0x3792('0x14')]['belongsToMany'](db[_0x3792('0x69')],{'as':_0x3792('0x12d'),'through':_0x3792('0x31'),'required':![],'hooks':!![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x4f')],{'as':'FaxQueues','through':_0x3792('0x33'),'required':![]});db[_0x3792('0x14')]['belongsToMany'](db['SmsQueue'],{'as':_0x3792('0x12e'),'through':'UserSmsQueue','required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x12f')],{'as':_0x3792('0x130'),'through':_0x3792('0x36'),'required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x10b')],{'as':'WhatsappQueues','through':_0x3792('0x131'),'required':![]});db[_0x3792('0x14')][_0x3792('0x120')](db['CmList'],{'through':_0x3792('0x126')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0xf9')],{'as':'VoicePrefixes','through':_0x3792('0x132'),'required':![]});db['User'][_0x3792('0x120')](db[_0x3792('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User'][_0x3792('0x120')](db[_0x3792('0x47')],{'as':_0x3792('0x133'),'through':_0x3792('0x134')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x3c')],{'as':_0x3792('0x135'),'through':'user_has_mail_accounts'});db[_0x3792('0x14')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x3792('0x136'),'through':_0x3792('0x137')});db[_0x3792('0x14')][_0x3792('0x120')](db[_0x3792('0x52')],{'as':_0x3792('0x138'),'through':_0x3792('0x139')});db['User'][_0x3792('0x120')](db[_0x3792('0x101')],{'as':_0x3792('0x13a'),'through':_0x3792('0x13b')});db[_0x3792('0x14')][_0x3792('0x120')](db['SquareProject'],{'as':_0x3792('0x13c'),'through':_0x3792('0x13d')});db[_0x3792('0x17')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x13e'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x13f')});db[_0x3792('0x19')][_0x3792('0x113')](db['VoiceExtension'],{'onDelete':_0x3792('0x111')});db[_0x3792('0x115')]['hasMany'](db[_0x3792('0x115')],{'as':'Applications','onDelete':_0x3792('0x111')});db['VoiceMusicOnHold'][_0x3792('0x120')](db[_0x3792('0x89')],{'as':_0x3792('0x140'),'through':_0x3792('0x141')});db[_0x3792('0x1d')][_0x3792('0x113')](db[_0x3792('0x2f')],{'as':_0x3792('0x142'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')][_0x3792('0x113')](db[_0x3792('0x70')],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')]['hasMany'](db[_0x3792('0x74')],{'as':'HopperFinals','foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x145'),'foreignKey':'VoiceQueueId'});db[_0x3792('0x1d')][_0x3792('0x113')](db['ReportAgentPreview'],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x143')});db[_0x3792('0x1d')]['hasMany'](db[_0x3792('0x72')],{'as':'HopperBlacks','foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x113')](db['JscriptySessionReport'],{'as':_0x3792('0x146'),'foreignKey':_0x3792('0x143')});db['VoiceQueue'][_0x3792('0x11e')](db[_0x3792('0x2c')],{'as':_0x3792('0x2c'),'foreignKey':_0x3792('0x147')});db[_0x3792('0x1d')][_0x3792('0x11e')](db['Trunk'],{'as':_0x3792('0x148'),'foreignKey':_0x3792('0x149')});db[_0x3792('0x1d')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'as':_0x3792('0x14a'),'foreignKey':_0x3792('0x14b')});db['VoiceQueue'][_0x3792('0x11e')](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':_0x3792('0x14e'),'through':_0x3792('0x14f')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x30')});db[_0x3792('0x1d')][_0x3792('0x120')](db[_0x3792('0xe6')],{'as':_0x3792('0x151'),'through':_0x3792('0x152')});db[_0x3792('0x1d')]['belongsToMany'](db[_0x3792('0xf7')],{'as':_0x3792('0x153'),'through':_0x3792('0x154')});db[_0x3792('0x1f')]['belongsTo'](db[_0x3792('0x14')],{'as':_0x3792('0x14'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x20')][_0x3792('0x11e')](db['User'],{'as':'User','foreignKey':_0x3792('0x112')});db['VoiceMail']['hasMany'](db[_0x3792('0x23')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x3792('0x23')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x3792('0x156'),'targetKey':_0x3792('0x157')});db[_0x3792('0x25')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x3792('0x158'),'constraints':![]});db[_0x3792('0x25')]['hasMany'](db[_0x3792('0x27')],{'as':_0x3792('0x159'),'foreignKey':_0x3792('0x158'),'constraints':![]});db[_0x3792('0x25')]['belongsTo'](db[_0x3792('0x14')],{'as':_0x3792('0x14'),'foreignKey':'UserId'});db[_0x3792('0x25')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x39')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x3c'),'foreignKey':_0x3792('0x15c')});db['MailServerOut'][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x3c'),'foreignKey':'MailAccountId'});db[_0x3792('0x3c')]['hasOne'](db[_0x3792('0x39')],{'as':'Imap','onDelete':_0x3792('0x111')});db['MailAccount'][_0x3792('0x10f')](db[_0x3792('0x3b')],{'as':_0x3792('0x15d'),'onDelete':'cascade'});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x15c')});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x15c')});db[_0x3792('0x3c')][_0x3792('0x113')](db[_0x3792('0x40')],{'as':_0x3792('0x155'),'foreignKey':'MailAccountId'});db[_0x3792('0x3c')][_0x3792('0x113')](db['MailInteraction'],{'as':_0x3792('0x161')});db[_0x3792('0x3c')][_0x3792('0x113')](db['MailApplication'],{'as':_0x3792('0x162')});db['MailAccount'][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x3c')][_0x3792('0x11e')](db['Template'],{'as':_0x3792('0x165'),'foreignKey':'TemplateId'});db[_0x3792('0x3c')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x3c')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x166')});db[_0x3792('0x12b')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x150'),'through':_0x3792('0x12c')});db[_0x3792('0x12b')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x167'),'as':'Teams'});db[_0x3792('0x3e')][_0x3792('0x113')](db[_0x3792('0x40')],{'as':'Messages','onDelete':_0x3792('0x111'),'foreignKey':'MailInteractionId'});db[_0x3792('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0x3792('0x168'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x3e')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x3e')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'mail_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x3e')][_0x3792('0x120')](db['Tag'],{'through':_0x3792('0x16b'),'as':'ThroughTags'});db[_0x3792('0x3e')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x128'),'foreignKey':_0x3792('0x16d')});db[_0x3792('0x40')]['hasMany'](db[_0x3792('0xed')],{'as':_0x3792('0x16e'),'onDelete':_0x3792('0x111')});db[_0x3792('0x40')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x14')});db[_0x3792('0x40')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':_0x3792('0x111'),'as':'Contact'});db['MailMessage'][_0x3792('0x11e')](db[_0x3792('0x3e')],{'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x16d')});db['MailMessage'][_0x3792('0x11e')](db[_0x3792('0x3c')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x15c')});db['MailApplication'][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x42')][_0x3792('0x11e')](db['MailQueue'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x42')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'onDelete':'restrict'});db[_0x3792('0x42')]['belongsTo'](db['Interval'],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x42')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x43')]['belongsTo'](db[_0x3792('0x3c')],{});db[_0x3792('0x43')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':'ListId'});db[_0x3792('0x43')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x43')][_0x3792('0x11e')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x3792('0x40')],{});db[_0x3792('0x43')][_0x3792('0x11e')](db['User'],{});db[_0x3792('0x43')][_0x3792('0x11e')](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0x3792('0x171')],{'as':'Items','onDelete':_0x3792('0x111')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':'FaxAccountId'});db[_0x3792('0x47')]['hasMany'](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x172')});db[_0x3792('0x47')]['hasMany'](db[_0x3792('0x4b')],{'as':_0x3792('0x161')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x49')],{'as':_0x3792('0x162')});db[_0x3792('0x47')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x173'),'onDelete':_0x3792('0x111')});db[_0x3792('0x47')][_0x3792('0x113')](db['FaxMessage'],{'as':'Messages'});db[_0x3792('0x47')]['belongsTo'](db[_0x3792('0x2c')],{'as':_0x3792('0x2c')});db[_0x3792('0x47')]['belongsTo'](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x47')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x47')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x134')});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x49')]['belongsTo'](db[_0x3792('0x4f')],{'onDelete':'restrict'});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x47')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x49')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x4b')][_0x3792('0x113')](db[_0x3792('0x4d')],{'as':_0x3792('0x155'),'onDelete':'cascade','foreignKey':_0x3792('0x174')});db['FaxInteraction']['belongsTo'](db[_0x3792('0x47')],{'as':_0x3792('0x168'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x3792('0x11e')](db['CmContact'],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x4b')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x4b')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x175'),'as':_0x3792('0x16a')});db['FaxInteraction'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'fax_interaction_has_tags','as':_0x3792('0x176')});db[_0x3792('0x4b')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x177'),'foreignKey':_0x3792('0x174')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':'cascade','as':_0x3792('0x14')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x4b')],{'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x174')});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':_0x3792('0x111'),'as':'Contact'});db[_0x3792('0x4d')][_0x3792('0x11e')](db[_0x3792('0xed')],{'as':_0x3792('0xed'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x3792('0x11e')](db[_0x3792('0x47')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x172')});db['FaxQueue']['belongsToMany'](db[_0x3792('0x14')],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x3792('0xe6')],{'through':_0x3792('0x178'),'as':'Teams'});db[_0x3792('0x50')][_0x3792('0x11e')](db['FaxAccount'],{});db[_0x3792('0x50')][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x50')]['belongsTo'](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x50')][_0x3792('0x11e')](db[_0x3792('0x4b')],{});db[_0x3792('0x50')][_0x3792('0x11e')](db['FaxMessage'],{});db['FaxQueueReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{});db['FaxQueueReport'][_0x3792('0x11e')](db[_0x3792('0x4f')],{});db[_0x3792('0x52')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':'SmsAccountId'});db[_0x3792('0x52')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x179')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x57')],{'as':_0x3792('0x155'),'foreignKey':_0x3792('0x179')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x55')],{'as':_0x3792('0x161')});db['SmsAccount'][_0x3792('0x113')](db[_0x3792('0x17a')],{'as':_0x3792('0x162')});db[_0x3792('0x52')]['belongsTo'](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db[_0x3792('0x52')]['belongsTo'](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x52')]['belongsToMany'](db[_0x3792('0x14')],{'as':'Agents','through':_0x3792('0x139')});db[_0x3792('0x17a')][_0x3792('0x11e')](db['User'],{'onDelete':'restrict'});db[_0x3792('0x17a')][_0x3792('0x11e')](db[_0x3792('0x59')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x17a')][_0x3792('0x11e')](db['SmsAccount'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x17a')]['belongsTo'](db[_0x3792('0x14a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x17a')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x17b')});db[_0x3792('0x55')]['hasMany'](db['SmsMessage'],{'as':_0x3792('0x155'),'onDelete':'cascade','foreignKey':_0x3792('0x17c')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x52')],{'as':'Account','foreignKey':_0x3792('0x179')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x55')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'sms_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x17d'),'as':_0x3792('0x176')});db[_0x3792('0x55')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x14')});db[_0x3792('0x57')][_0x3792('0x11e')](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a')});db[_0x3792('0x57')][_0x3792('0x11e')](db['SmsInteraction'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x16f'),'foreignKey':_0x3792('0x17c')});db['SmsMessage'][_0x3792('0x11e')](db[_0x3792('0x52')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x179')});db['SmsQueue']['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x17e'),'foreignKey':_0x3792('0x17f')});db[_0x3792('0x59')]['belongsToMany'](db[_0x3792('0xe6')],{'through':_0x3792('0x180'),'as':'Teams'});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':'Dispositions','foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db[_0x3792('0x5f')],{'as':_0x3792('0x161'),'foreignKey':_0x3792('0x181')});db['OpenchannelAccount'][_0x3792('0x113')](db[_0x3792('0x182')],{'as':'Messages','foreignKey':_0x3792('0x181')});db[_0x3792('0x5b')][_0x3792('0x113')](db['OpenchannelApplication'],{'as':_0x3792('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x3792('0x5b')][_0x3792('0x11e')](db['CmList'],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x5b')][_0x3792('0x11e')](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x5b')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x150'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x3792('0x11e')](db['User'],{'onDelete':_0x3792('0x170')});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x12f')],{'onDelete':_0x3792('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x5b')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x181')});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'onDelete':_0x3792('0x170'),'foreignKey':'IntervalId'});db[_0x3792('0x5d')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':'restrict','foreignKey':_0x3792('0x17b')});db[_0x3792('0x5f')][_0x3792('0x113')](db[_0x3792('0x182')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x183')});db[_0x3792('0x5f')]['belongsTo'](db[_0x3792('0x5b')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x181')});db['OpenchannelInteraction'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db['OpenchannelInteraction'][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x5f')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x184'),'as':'Tags'});db['OpenchannelInteraction'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x184'),'as':_0x3792('0x176')});db[_0x3792('0x5f')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x12a'),'foreignKey':_0x3792('0x183')});db[_0x3792('0x182')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x14')});db[_0x3792('0x182')][_0x3792('0x11e')](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a')});db['OpenchannelMessage']['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x16f'),'foreignKey':'OpenchannelInteractionId'});db[_0x3792('0x182')]['belongsTo'](db[_0x3792('0xed')],{'as':_0x3792('0xed'),'foreignKey':'AttachmentId'});db[_0x3792('0x182')][_0x3792('0x11e')](db['OpenchannelAccount'],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x181')});db['OpenchannelQueue'][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'UserOpenchannelQueue','foreignKey':_0x3792('0x185')});db[_0x3792('0x12f')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x3792('0x62')]['hasMany'](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x186')});db['ChatWebsite'][_0x3792('0x113')](db[_0x3792('0x7e')],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x62')][_0x3792('0x113')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x3792('0x62')][_0x3792('0x113')](db['ChatInteraction'],{'as':_0x3792('0x161')});db[_0x3792('0x62')]['hasMany'](db[_0x3792('0x65')],{'as':_0x3792('0x162')});db['ChatWebsite'][_0x3792('0x113')](db[_0x3792('0x187')],{'as':_0x3792('0x155')});db[_0x3792('0x62')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x62')][_0x3792('0x11e')](db['Interval'],{'as':_0x3792('0x14a'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x3792('0x11e')](db[_0x3792('0x83')],{'as':_0x3792('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3792('0x62')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_chat_websites'});db[_0x3792('0x64')]['belongsTo'](db[_0x3792('0x5b')],{});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':'ContactId'});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x5f')],{});db[_0x3792('0x64')][_0x3792('0x11e')](db[_0x3792('0x182')],{});db[_0x3792('0x64')]['belongsTo'](db['User'],{});db[_0x3792('0x64')][_0x3792('0x11e')](db['OpenchannelQueue'],{});db[_0x3792('0x65')][_0x3792('0x11e')](db['User'],{'as':'Agent','foreignKey':_0x3792('0x112'),'onDelete':_0x3792('0x170')});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x69')],{'as':_0x3792('0x188'),'foreignKey':_0x3792('0x189'),'onDelete':_0x3792('0x170')});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x18a'),'foreignKey':_0x3792('0x186'),'onDelete':'restrict'});db[_0x3792('0x65')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':_0x3792('0x17b')});db['ChatInteraction'][_0x3792('0x113')](db[_0x3792('0x187')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':'ChatInteractionId'});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':'ContactId'});db[_0x3792('0x119')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x169'),'foreignKey':'UserId'});db[_0x3792('0x119')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x18b'),'as':_0x3792('0x16a')});db[_0x3792('0x119')]['belongsToMany'](db[_0x3792('0x8a')],{'through':_0x3792('0x18b'),'as':_0x3792('0x176')});db[_0x3792('0x119')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x18c'),'foreignKey':'ChatInteractionId'});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x14')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x3792('0x111'),'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x119')],{'onDelete':'cascade','as':_0x3792('0x16f'),'foreignKey':_0x3792('0x18d')});db[_0x3792('0x187')]['belongsTo'](db[_0x3792('0xed')],{'as':'Attachment','foreignKey':_0x3792('0x18e')});db[_0x3792('0x187')][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':'Account','foreignKey':_0x3792('0x186')});db['ChatOfflineMessage'][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':'cascade','as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x18f')][_0x3792('0x11e')](db['ChatWebsite'],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x69')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':'Agents','through':_0x3792('0x31'),'hooks':!![]});db[_0x3792('0x69')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x190'),'as':_0x3792('0x151')});db[_0x3792('0x121')][_0x3792('0x113')](db['ChatInternalMessage'],{'as':_0x3792('0x155'),'foreignKey':'ChatGroupId','onDelete':_0x3792('0x111')});db[_0x3792('0x121')]['belongsToMany'](db['User'],{'as':_0x3792('0x142'),'through':_0x3792('0x123')});db['ChatProactiveAction'][_0x3792('0x11e')](db[_0x3792('0x62')],{'as':_0x3792('0x18a'),'foreignKey':_0x3792('0x186')});db[_0x3792('0x6e')][_0x3792('0x113')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'foreignKey':_0x3792('0x191')});db['CmContact'][_0x3792('0x113')](db[_0x3792('0x70')],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x15b')});db['CmContact'][_0x3792('0x113')](db['CmHopperFinal'],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x124')]['hasMany'](db['CmHopperHistory'],{'as':_0x3792('0x145'),'foreignKey':_0x3792('0x15b')});db['CmContact'][_0x3792('0x113')](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0x124')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x3792('0x124')][_0x3792('0x113')](db['OpenchannelInteraction'],{'as':_0x3792('0x118'),'foreignKey':'ContactId','onDelete':_0x3792('0x170')});db['CmContact'][_0x3792('0x113')](db['ChatInteraction'],{'as':_0x3792('0x11a'),'foreignKey':_0x3792('0x15b'),'onDelete':'restrict'});db[_0x3792('0x124')][_0x3792('0x113')](db[_0x3792('0x55')],{'as':'SmsInteractions','foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')][_0x3792('0x113')](db[_0x3792('0x4b')],{'as':_0x3792('0x11c'),'foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')]['hasMany'](db['MailInteraction'],{'as':_0x3792('0x127'),'foreignKey':_0x3792('0x15b'),'onDelete':_0x3792('0x170')});db[_0x3792('0x124')][_0x3792('0x11e')](db[_0x3792('0x6e')],{'as':_0x3792('0x192'),'foreignKey':_0x3792('0x191')});db[_0x3792('0x124')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164'),'onDelete':_0x3792('0x111')});db[_0x3792('0x124')][_0x3792('0x120')](db['User'],{'as':_0x3792('0x16c'),'through':_0x3792('0x193')});db[_0x3792('0x124')]['belongsToMany'](db[_0x3792('0x8a')],{'as':'Tags','through':_0x3792('0x194')});db[_0x3792('0x124')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x3792('0x70')][_0x3792('0x11e')](db['CmContact'],{'as':_0x3792('0x15a'),'foreignKey':'ContactId','onDelete':_0x3792('0x111')});db['CmHopper'][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':'ListId','onDelete':_0x3792('0x111')});db[_0x3792('0x70')][_0x3792('0x11e')](db[_0x3792('0x14')],{'as':_0x3792('0x195'),'foreignKey':_0x3792('0x112')});db[_0x3792('0x70')][_0x3792('0x11e')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x3792('0x143'),'onDelete':_0x3792('0x111')});db['CmHopper'][_0x3792('0x11e')](db[_0x3792('0xe9')],{'as':_0x3792('0xe9'),'foreignKey':_0x3792('0x196'),'onDelete':'cascade'});db[_0x3792('0x70')][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':_0x3792('0x197')});db['CmHopperBlack'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b'),'onDelete':'cascade'});db[_0x3792('0x72')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164'),'onDelete':_0x3792('0x111')});db[_0x3792('0x72')][_0x3792('0x11e')](db[_0x3792('0x1d')],{'as':_0x3792('0x188'),'foreignKey':_0x3792('0x143'),'onDelete':'cascade'});db[_0x3792('0x72')]['belongsTo'](db['Campaign'],{'as':_0x3792('0xe9'),'foreignKey':'CampaignId','onDelete':_0x3792('0x111')});db['Automation']['hasMany'](db[_0x3792('0x80')],{'as':{'plural':'All','singular':_0x3792('0x198')},'foreignKey':_0x3792('0x199'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x7c')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0x3792('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x3792('0x7c')][_0x3792('0x113')](db[_0x3792('0x7a')],{'as':_0x3792('0x19b'),'foreignKey':_0x3792('0x19c'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x14a')]['hasMany'](db['Interval'],{'as':_0x3792('0x19d'),'foreignKey':_0x3792('0x14b'),'onDelete':_0x3792('0x111'),'hooks':!![],'required':![]});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'foreignKey':'IntervalId','onDelete':_0x3792('0x170')});db[_0x3792('0x14a')][_0x3792('0x113')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x3792('0x14b')});db['Interval'][_0x3792('0x113')](db[_0x3792('0x65')],{'as':_0x3792('0x19e'),'foreignKey':'IntervalId'});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x49')],{'as':'FaxApplications','foreignKey':_0x3792('0x14b')});db[_0x3792('0x14a')][_0x3792('0x113')](db[_0x3792('0x17a')],{'as':_0x3792('0x19f'),'foreignKey':_0x3792('0x14b')});db[_0x3792('0x87')][_0x3792('0x11e')](db[_0x3792('0x3c')],{});db[_0x3792('0x87')][_0x3792('0x11e')](db[_0x3792('0x94')],{'foreignKey':_0x3792('0x1a0')});db['Schedule'][_0x3792('0x11e')](db[_0x3792('0x92')],{'foreignKey':'CustomReportId'});db[_0x3792('0x89')][_0x3792('0x120')](db[_0x3792('0x1c')],{'as':_0x3792('0x1a1'),'through':_0x3792('0x141'),'onDelete':_0x3792('0x170')});db[_0x3792('0x8a')]['belongsToMany'](db[_0x3792('0x124')],{'through':_0x3792('0x194')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x119')],{'through':_0x3792('0x18b')});db[_0x3792('0x8a')]['belongsToMany'](db[_0x3792('0x3e')],{'through':'mail_interaction_has_tags'});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x55')],{'through':_0x3792('0x17d')});db[_0x3792('0x8a')][_0x3792('0x120')](db['FaxInteraction'],{'through':_0x3792('0x175')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x5f')],{'through':_0x3792('0x184')});db[_0x3792('0x8a')][_0x3792('0x120')](db[_0x3792('0x104')],{'through':_0x3792('0x1a2')});db[_0x3792('0x8d')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':_0x3792('0x1a3'),'singular':_0x3792('0x1a4')},'foreignKey':'TriggerAllId','onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x8d')][_0x3792('0x113')](db[_0x3792('0x80')],{'as':{'plural':_0x3792('0x1a5'),'singular':_0x3792('0x1a6')},'foreignKey':_0x3792('0x1a7'),'onDelete':_0x3792('0x111'),'hooks':!![]});db['Trigger']['hasMany'](db['Action'],{'as':_0x3792('0x19b'),'foreignKey':_0x3792('0x1a8'),'onDelete':_0x3792('0x111'),'hooks':!![]});db[_0x3792('0x92')][_0x3792('0x113')](db['AnalyticFieldReport'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1aa'),'hooks':!![]});db[_0x3792('0x94')]['hasMany'](db[_0x3792('0x99')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1a0')});db[_0x3792('0x97')]['hasMany'](db[_0x3792('0x99')],{'as':_0x3792('0x1a9'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x3792('0x99')][_0x3792('0x11e')](db[_0x3792('0x97')],{'foreignKey':_0x3792('0x1ab')});db[_0x3792('0x9d')][_0x3792('0x113')](db[_0x3792('0x9f')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db[_0x3792('0x9f')][_0x3792('0x113')](db[_0x3792('0xa1')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x3792('0x113')](db[_0x3792('0xa1')],{'as':_0x3792('0x1ae'),'onDelete':'cascade','foreignKey':_0x3792('0x1af')});db['SalesforceConfiguration'][_0x3792('0x113')](db['SalesforceField'],{'as':_0x3792('0x1a9'),'onDelete':'cascade','foreignKey':_0x3792('0x1b0')});db[_0x3792('0x9f')][_0x3792('0x11e')](db[_0x3792('0x9d')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db['SalesforceField']['hasMany'](db[_0x3792('0xa1')],{'as':'Subject','foreignKey':_0x3792('0x1b1')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xa1')]['hasMany'](db[_0x3792('0xa1')],{'as':'Field','foreignKey':'FieldId'});db['SalesforceField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db[_0x3792('0xa3')][_0x3792('0x113')](db[_0x3792('0xa5')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa5')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1ad'),'onDelete':'cascade','foreignKey':_0x3792('0x1b1')});db['SugarcrmConfiguration'][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1ae'),'onDelete':'cascade','foreignKey':_0x3792('0x1af')});db[_0x3792('0xa5')][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xa5')]['belongsTo'](db[_0x3792('0xa3')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db[_0x3792('0xa7')][_0x3792('0x113')](db['SugarcrmField'],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xa7')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xa7')][_0x3792('0x113')](db[_0x3792('0xa7')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db['SugarcrmField'][_0x3792('0x11e')](db['Variable'],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0x3792('0x1ac'),'onDelete':'cascade','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':'DescriptionId'});db[_0x3792('0xa9')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db['DeskConfiguration'][_0x3792('0x11e')](db[_0x3792('0xa8')],{'as':'Account','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xa9')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x1b8')});db[_0x3792('0xab')]['hasMany'](db[_0x3792('0xab')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xab')][_0x3792('0x113')](db[_0x3792('0xab')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['DeskField']['hasMany'](db[_0x3792('0xab')],{'as':'Field','foreignKey':'FieldId'});db[_0x3792('0xab')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xad')][_0x3792('0x113')](db[_0x3792('0xaf')],{'as':_0x3792('0x1ac'),'onDelete':'cascade','foreignKey':_0x3792('0x1b4')});db['ZohoConfiguration'][_0x3792('0x113')](db['ZohoField'],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':'SubjectId'});db[_0x3792('0xaf')][_0x3792('0x113')](db['ZohoField'],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xaf')]['hasMany'](db['ZohoField'],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xaf')][_0x3792('0x11e')](db[_0x3792('0xad')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db['ZohoField'][_0x3792('0x113')](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0x1b9')][_0x3792('0x113')](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0x1b9')]['hasMany'](db[_0x3792('0x1b9')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0x1b9')]['belongsTo'](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':'VariableId'});db[_0x3792('0xb1')][_0x3792('0x113')](db[_0x3792('0xb3')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0x3792('0x1ad'),'foreignKey':_0x3792('0x1b1')});db['ZendeskConfiguration'][_0x3792('0x113')](db[_0x3792('0xb4')],{'as':'Descriptions','foreignKey':_0x3792('0x1af')});db[_0x3792('0xb3')][_0x3792('0x113')](db['ZendeskField'],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db['ZendeskConfiguration'][_0x3792('0x11e')](db[_0x3792('0xb1')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xb3')][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':'int_zendesk_configuration_has_tags'});db[_0x3792('0xb4')][_0x3792('0x113')](db[_0x3792('0xb4')],{'as':_0x3792('0x1b5'),'foreignKey':'SubjectId'});db[_0x3792('0xb4')]['hasMany'](db[_0x3792('0xb4')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xb4')][_0x3792('0x113')](db['ZendeskField'],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db['ZendeskField'][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xb5')][_0x3792('0x113')](db['FreshdeskConfiguration'],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db[_0x3792('0x1ba')][_0x3792('0x113')](db['FreshdeskField'],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0x1ba')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0x1ba')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1a9'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0x1ba')][_0x3792('0x11e')](db[_0x3792('0xb5')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db['FreshdeskConfiguration'][_0x3792('0x120')](db[_0x3792('0x8a')],{'through':_0x3792('0x1bb')});db[_0x3792('0xb7')][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':_0x3792('0x1b5'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['FreshdeskField'][_0x3792('0x113')](db[_0x3792('0xb7')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db['FreshdeskField']['belongsTo'](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db['VtigerAccount'][_0x3792('0x113')](db[_0x3792('0xbb')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xbb')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x3792('0xbb')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Descriptions','foreignKey':_0x3792('0x1af')});db[_0x3792('0xbb')]['hasMany'](db[_0x3792('0xbc')],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xbb')][_0x3792('0x11e')](db[_0x3792('0xb9')],{'as':_0x3792('0x168'),'foreignKey':'AccountId'});db[_0x3792('0xbc')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xbc')][_0x3792('0x113')](db[_0x3792('0xbc')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x3792('0xbc')]['hasMany'](db[_0x3792('0xbc')],{'as':_0x3792('0x1b6'),'foreignKey':'FieldId'});db[_0x3792('0xbc')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':_0x3792('0x1b3')});db['ServicenowAccount'][_0x3792('0x113')](db[_0x3792('0xbf')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x3792('0xbf')]['hasMany'](db[_0x3792('0xc1')],{'as':_0x3792('0x1ad'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xbf')][_0x3792('0x113')](db['ServicenowField'],{'as':_0x3792('0x1ae'),'foreignKey':'DescriptionId'});db[_0x3792('0xbf')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xbf')][_0x3792('0x11e')](db[_0x3792('0x1bc')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc1')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':'Subject','foreignKey':_0x3792('0x1b1')});db[_0x3792('0xc1')][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db['ServicenowField'][_0x3792('0x113')](db[_0x3792('0xc1')],{'as':_0x3792('0x1b6'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xc1')][_0x3792('0x11e')](db[_0x3792('0x1b7')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3792('0xc3')][_0x3792('0x113')](db['Dynamics365Configuration'],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc4')]['hasMany'](db[_0x3792('0xc6')],{'as':_0x3792('0x1ad'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1b1')});db[_0x3792('0xc4')][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':_0x3792('0x1ae'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xc4')][_0x3792('0x113')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x3792('0x111'),'foreignKey':'FieldId'});db[_0x3792('0xc4')][_0x3792('0x11e')](db[_0x3792('0xc3')],{'as':'Account','foreignKey':_0x3792('0x1b4')});db[_0x3792('0xc6')]['hasMany'](db[_0x3792('0xc6')],{'as':_0x3792('0x1b5'),'foreignKey':_0x3792('0x1b1')});db['Dynamics365Field'][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':'Description','foreignKey':_0x3792('0x1af')});db[_0x3792('0xc6')][_0x3792('0x113')](db[_0x3792('0xc6')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db[_0x3792('0xc6')]['belongsTo'](db[_0x3792('0x1b7')],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xc8')][_0x3792('0x113')](db[_0x3792('0xca')],{'as':_0x3792('0x1ac'),'onDelete':_0x3792('0x111'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1ad'),'foreignKey':'SubjectId'});db[_0x3792('0xca')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1ae'),'foreignKey':'DescriptionId'});db[_0x3792('0xca')][_0x3792('0x113')](db['FreshsalesField'],{'as':_0x3792('0x1a9'),'foreignKey':_0x3792('0x1b0')});db[_0x3792('0xca')]['belongsTo'](db[_0x3792('0xc8')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1b4')});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':_0x3792('0x1b2'),'foreignKey':_0x3792('0x1af')});db[_0x3792('0xcb')][_0x3792('0x113')](db[_0x3792('0xcb')],{'as':'Field','foreignKey':_0x3792('0x1b0')});db[_0x3792('0xcb')][_0x3792('0x11e')](db['Variable'],{'as':_0x3792('0x1b7'),'foreignKey':_0x3792('0x1b3')});db[_0x3792('0xcf')]['belongsTo'](db['ChatWebsite'],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db['ChatQueueReport']['belongsTo'](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x119')],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x187')],{});db[_0x3792('0xcf')][_0x3792('0x11e')](db[_0x3792('0x14')],{});db['ChatQueueReport']['belongsTo'](db[_0x3792('0x69')],{});db[_0x3792('0xd1')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'foreignKey':'FromId'});db[_0x3792('0xd1')][_0x3792('0x11e')](db[_0x3792('0x14')],{'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1bd')});db[_0x3792('0xd5')][_0x3792('0x113')](db['JscriptyQuestionReport'],{'foreignKey':_0x3792('0x1be'),'onDelete':'cascade'});db[_0x3792('0xd5')][_0x3792('0x113')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x3792('0x111')});db[_0x3792('0xd7')][_0x3792('0x11e')](db['SmsAccount'],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':_0x3792('0x15a'),'foreignKey':_0x3792('0x15b')});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x55')],{});db[_0x3792('0xd7')]['belongsTo'](db[_0x3792('0x57')],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x14')],{});db[_0x3792('0xd7')][_0x3792('0x11e')](db[_0x3792('0x59')],{});db['JscriptyProject'][_0x3792('0x113')](db[_0x3792('0xd5')],{'foreignKey':_0x3792('0x1bf')});db['JscriptyProject']['hasMany'](db[_0x3792('0xd3')],{'foreignKey':'ProjectId'});db[_0x3792('0xdb')][_0x3792('0x113')](db[_0x3792('0x1c0')],{'foreignKey':'ProjectId'});db[_0x3792('0xe1')]['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x16c'),'through':_0x3792('0x13d')});db['Team'][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_teams'});db[_0x3792('0xe6')]['belongsToMany'](db[_0x3792('0x1d')],{'through':'team_has_voice_queues','as':'VoiceQueues'});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x12b')],{'through':_0x3792('0x167'),'as':'MailQueues'});db[_0x3792('0xe6')][_0x3792('0x120')](db['ChatQueue'],{'through':_0x3792('0x190'),'as':_0x3792('0x12d')});db[_0x3792('0xe6')]['belongsToMany'](db['FaxQueue'],{'through':_0x3792('0x178'),'as':_0x3792('0x1c1')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x59')],{'through':_0x3792('0x180'),'as':_0x3792('0x12e')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x12f')],{'through':'team_has_openchannel_queues','as':_0x3792('0x130')});db[_0x3792('0xe6')][_0x3792('0x120')](db[_0x3792('0x10b')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x3792('0xe9')]['hasMany'](db['CmHopper'],{'as':_0x3792('0x144'),'foreignKey':_0x3792('0x196')});db[_0x3792('0xe9')][_0x3792('0x113')](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x196')});db['Campaign'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x145'),'foreignKey':_0x3792('0x196')});db[_0x3792('0xe9')]['hasMany'](db['CmHopperBlack'],{'as':_0x3792('0x1c2'),'foreignKey':_0x3792('0x196')});db['Campaign'][_0x3792('0x11e')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x3792('0xe9')][_0x3792('0x11e')](db[_0x3792('0x2c')],{'as':_0x3792('0x148'),'foreignKey':_0x3792('0x149')});db[_0x3792('0xe9')][_0x3792('0x11e')](db[_0x3792('0x14a')],{'as':_0x3792('0x14a'),'foreignKey':'IntervalId'});db['Campaign'][_0x3792('0x11e')](db[_0x3792('0xe1')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x3792('0xe9')]['belongsToMany'](db['CmList'],{'as':_0x3792('0x14e'),'through':_0x3792('0x1c3')});db['Campaign'][_0x3792('0x120')](db[_0x3792('0xf7')],{'as':_0x3792('0x153'),'through':_0x3792('0x1c4')});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x40')],{});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3e')],{});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db['MailTransferReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':_0x3792('0x1c9')});db[_0x3792('0x1c5')]['belongsTo'](db[_0x3792('0x12b')],{'foreignKey':_0x3792('0x1ca'),'as':'ToQueue'});db[_0x3792('0x1c5')][_0x3792('0x11e')](db[_0x3792('0x3c')],{'foreignKey':_0x3792('0x1cb'),'as':'ToAccount'});db[_0x3792('0x1cc')]['belongsTo'](db['ChatMessage'],{});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x119')],{});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x62')],{'foreignKey':_0x3792('0x1cd'),'as':_0x3792('0x1ce')});db['ChatTransferReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x1cc')]['belongsTo'](db[_0x3792('0x69')],{'foreignKey':_0x3792('0x1cf'),'as':_0x3792('0x1d0')});db[_0x3792('0x1cc')][_0x3792('0x11e')](db[_0x3792('0x62')],{'foreignKey':_0x3792('0x1d1'),'as':_0x3792('0x1d2')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x4d')],{});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x4b')],{});db[_0x3792('0xf3')][_0x3792('0x11e')](db['FaxAccount'],{'foreignKey':_0x3792('0x1d3'),'as':_0x3792('0x1ce')});db['FaxTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':_0x3792('0x1c6'),'as':_0x3792('0x1c7')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':_0x3792('0x1c9')});db['FaxTransferReport'][_0x3792('0x11e')](db['FaxQueue'],{'foreignKey':_0x3792('0x1d4'),'as':_0x3792('0x1d0')});db[_0x3792('0xf3')][_0x3792('0x11e')](db[_0x3792('0x47')],{'foreignKey':_0x3792('0x1d5'),'as':_0x3792('0x1d2')});db['OpenchannelTransferReport'][_0x3792('0x11e')](db[_0x3792('0x182')],{});db['OpenchannelTransferReport'][_0x3792('0x11e')](db[_0x3792('0x5f')],{});db[_0x3792('0xf5')][_0x3792('0x11e')](db[_0x3792('0x5b')],{'foreignKey':_0x3792('0x1d6'),'as':_0x3792('0x1ce')});db['OpenchannelTransferReport'][_0x3792('0x11e')](db['User'],{'foreignKey':'FromUserId','as':_0x3792('0x1c7')});db[_0x3792('0xf5')]['belongsTo'](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c8'),'as':'ToAgent'});db[_0x3792('0xf5')][_0x3792('0x11e')](db['OpenchannelQueue'],{'foreignKey':_0x3792('0x1d7'),'as':'ToQueue'});db[_0x3792('0xf5')]['belongsTo'](db[_0x3792('0x5b')],{'foreignKey':_0x3792('0x1d8'),'as':_0x3792('0x1d2')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x57')],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x52')],{'foreignKey':_0x3792('0x1da'),'as':'FromAccount'});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':_0x3792('0x1c6'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x59')],{'foreignKey':_0x3792('0x1db'),'as':_0x3792('0x1d0')});db[_0x3792('0x1d9')][_0x3792('0x11e')](db[_0x3792('0x52')],{'foreignKey':_0x3792('0x1dc'),'as':_0x3792('0x1d2')});db[_0x3792('0xf7')][_0x3792('0x113')](db[_0x3792('0x15e')],{'as':_0x3792('0x15f'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')]['hasMany'](db['CmCustomField'],{'as':_0x3792('0x1dd'),'foreignKey':_0x3792('0x164')});db['CmList'][_0x3792('0x113')](db[_0x3792('0x124')],{'as':_0x3792('0x125'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x164')});db['CmList']['hasMany'](db[_0x3792('0x74')],{'as':_0x3792('0x117'),'foreignKey':_0x3792('0x164')});db['CmList'][_0x3792('0x113')](db[_0x3792('0x76')],{'as':_0x3792('0x1de'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')]['hasMany'](db[_0x3792('0x77')],{'as':_0x3792('0x77'),'foreignKey':_0x3792('0x164')});db[_0x3792('0xf7')][_0x3792('0x120')](db[_0x3792('0x1d')],{'as':_0x3792('0x1df'),'through':_0x3792('0x14f')});db[_0x3792('0xf7')]['belongsToMany'](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x126')});db[_0x3792('0xf9')][_0x3792('0x113')](db[_0x3792('0x115')],{'as':_0x3792('0x116'),'onDelete':_0x3792('0x111')});db[_0x3792('0xf9')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x132')});db[_0x3792('0xfb')][_0x3792('0x113')](db['User'],{'as':_0x3792('0x16c'),'foreignKey':_0x3792('0x11f')});db[_0x3792('0xfb')][_0x3792('0x113')](db[_0x3792('0x1e0')],{'as':_0x3792('0x1e1'),'foreignKey':'userProfileId','onDelete':_0x3792('0x111')});db['UserProfileSection'][_0x3792('0x113')](db[_0x3792('0xfe')],{'as':_0x3792('0x1e2'),'foreignKey':_0x3792('0x1e3'),'onDelete':_0x3792('0x111')});db[_0x3792('0x101')][_0x3792('0x113')](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db[_0x3792('0x101')][_0x3792('0x113')](db['CannedAnswer'],{'as':_0x3792('0x160'),'foreignKey':_0x3792('0x1e4')});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x106')],{'as':_0x3792('0x155'),'foreignKey':'WhatsappAccountId'});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x104')],{'as':_0x3792('0x161')});db[_0x3792('0x101')][_0x3792('0x113')](db[_0x3792('0x102')],{'as':_0x3792('0x162')});db[_0x3792('0x101')][_0x3792('0x11e')](db[_0x3792('0xf7')],{'as':'List','foreignKey':_0x3792('0x164')});db[_0x3792('0x101')]['belongsTo'](db['Pause'],{'as':_0x3792('0x14c'),'foreignKey':_0x3792('0x14d')});db[_0x3792('0x101')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':'user_has_whatsapp_accounts'});db[_0x3792('0x102')]['belongsTo'](db[_0x3792('0x14')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x10b')],{'onDelete':_0x3792('0x170')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x101')],{'onDelete':'restrict'});db[_0x3792('0x102')][_0x3792('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x3792('0x14b')});db[_0x3792('0x102')][_0x3792('0x11e')](db[_0x3792('0x8a')],{'onDelete':_0x3792('0x170'),'foreignKey':'TagId'});db[_0x3792('0x104')]['hasMany'](db[_0x3792('0x106')],{'as':_0x3792('0x155'),'onDelete':_0x3792('0x111'),'foreignKey':_0x3792('0x1e5')});db[_0x3792('0x104')][_0x3792('0x11e')](db[_0x3792('0x101')],{'as':_0x3792('0x168'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x104')][_0x3792('0x11e')](db['User'],{'as':_0x3792('0x169'),'foreignKey':'UserId'});db[_0x3792('0x104')][_0x3792('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x3792('0x16a')});db[_0x3792('0x104')][_0x3792('0x120')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x3792('0x176')});db[_0x3792('0x104')]['belongsToMany'](db['User'],{'as':_0x3792('0x16c'),'through':_0x3792('0x1e6'),'foreignKey':'WhatsappInteractionId'});db[_0x3792('0x106')][_0x3792('0x11e')](db['User'],{'as':'User'});db[_0x3792('0x106')][_0x3792('0x11e')](db[_0x3792('0x124')],{'onDelete':'cascade','as':'Contact'});db[_0x3792('0x106')][_0x3792('0x11e')](db['WhatsappInteraction'],{'onDelete':_0x3792('0x111'),'as':'Interaction','foreignKey':_0x3792('0x1e5')});db[_0x3792('0x106')][_0x3792('0x11e')](db[_0x3792('0x101')],{'as':_0x3792('0x168'),'foreignKey':_0x3792('0x1e4')});db[_0x3792('0x108')][_0x3792('0x11e')](db['WhatsappAccount'],{});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0xf7')],{'as':_0x3792('0x163'),'foreignKey':_0x3792('0x164')});db[_0x3792('0x108')][_0x3792('0x11e')](db[_0x3792('0x124')],{'as':'Contact','foreignKey':_0x3792('0x15b')});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0x104')],{});db[_0x3792('0x108')]['belongsTo'](db[_0x3792('0x10b')],{});db[_0x3792('0x108')][_0x3792('0x11e')](db[_0x3792('0x106')],{});db['WhatsappQueueReport'][_0x3792('0x11e')](db[_0x3792('0x14')],{});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x106')],{});db['WhatsappTransferReport'][_0x3792('0x11e')](db[_0x3792('0x104')],{});db[_0x3792('0x109')]['belongsTo'](db[_0x3792('0x101')],{'foreignKey':_0x3792('0x1e7'),'as':'FromAccount'});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x101')],{'foreignKey':_0x3792('0x1e8'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x3792('0x11e')](db['WhatsappQueue'],{'foreignKey':_0x3792('0x1e9'),'as':_0x3792('0x1d0')});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x3792('0x109')][_0x3792('0x11e')](db[_0x3792('0x14')],{'foreignKey':'ToUserId','as':_0x3792('0x1c9')});db[_0x3792('0x10b')][_0x3792('0x120')](db[_0x3792('0x14')],{'as':_0x3792('0x150'),'through':_0x3792('0x131'),'foreignKey':_0x3792('0x1ea')});db[_0x3792('0x10b')][_0x3792('0x120')](db[_0x3792('0xe6')],{'through':_0x3792('0x1eb'),'as':_0x3792('0x151')});module[_0x3792('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x49df=['Hoppers','HopperFinals','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Dispositions','Answers','MailMessage','List','ListId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Tag','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Interactions','Applications','Exntensions','Owner','ThroughTags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Agent','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','chat_group_has_users','Website','SmsInteractions','Company','CompanyId','cm_contact_has_tags','Queue','Campaign','CampaignId','Automation','All','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','DescriptionId','Subject','Field','FieldId','Variable','VariableId','Description','Descriptions','SubjectId','ZohoField','ZendeskConfiguration','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesAccount','SessionId','JscriptyAnswerReport','ProjectId','user_has_teams','FaxQueues','team_has_sms_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','password','options','database','username','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','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','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','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','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','UserVoiceQueue','MailQueue','MailQueues','ChatQueues','FaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_square_projects','VoiceExtension','SpiedAgents','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId'];(function(_0x4de1b3,_0x483b6a){var _0x5d932a=function(_0xeabfd8){while(--_0xeabfd8){_0x4de1b3['push'](_0x4de1b3['shift']());}};_0x5d932a(++_0x483b6a);}(_0x49df,0xad));var _0xf49d=function(_0x3d75f1,_0xc92bba){_0x3d75f1=_0x3d75f1-0x0;var _0x30c8af=_0x49df[_0x3d75f1];return _0x30c8af;};'use strict';var path=require('path');var config=require('../config/environment');var Sequelize=require(_0xf49d('0x0'));var _=require(_0xf49d('0x1'));var jstz=require(_0xf49d('0x2'));var timezone=jstz[_0xf49d('0x3')]();config[_0xf49d('0x0')]=_[_0xf49d('0x4')](config[_0xf49d('0x0')],{'database':'motion2','username':_0xf49d('0x5'),'password':_0xf49d('0x6'),'options':{'host':_0xf49d('0x7'),'port':0xcea,'dialect':_0xf49d('0x8'),'dialectOptions':{'charset':_0xf49d('0x9')},'logging':![],'timezone':timezone[_0xf49d('0xa')](),'define':{'charset':'utf8','collate':_0xf49d('0xb')}}});config[_0xf49d('0xc')]=_[_0xf49d('0x4')](config['sequelizeHistory'],{'database':'motion2','username':_0xf49d('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xf49d('0x8'),'dialectOptions':{'charset':_0xf49d('0x9')},'logging':![],'timezone':timezone[_0xf49d('0xa')](),'define':{'charset':'utf8','collate':_0xf49d('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf49d('0x0')]['database'],config[_0xf49d('0x0')]['username'],config['sequelize'][_0xf49d('0xd')],config['sequelize'][_0xf49d('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf49d('0xc')][_0xf49d('0xf')],config['sequelizeHistory'][_0xf49d('0x10')],config[_0xf49d('0xc')][_0xf49d('0xd')],config['sequelizeHistory'][_0xf49d('0xe')])};db[_0xf49d('0x11')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/user/user.model');db[_0xf49d('0x13')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x14'));db[_0xf49d('0x15')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x16'));db['VoiceExtension']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x17'));db[_0xf49d('0x18')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x19'));db[_0xf49d('0x1a')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x1b'));db['VoiceRecording']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x1c'));db['ScreenRecording']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x1d'));db['VoiceMail']=db['sequelize'][_0xf49d('0x12')]('../api/voiceMail/voiceMail.model');db[_0xf49d('0x1e')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x1f'));db['VoiceCallReport']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x20'));db[_0xf49d('0x21')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x22'));db[_0xf49d('0x23')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x24'));db[_0xf49d('0x25')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x26'));db['Trunk']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x27'));db[_0xf49d('0x28')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x29'));db[_0xf49d('0x2a')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xf49d('0x2b')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0xf49d('0x2c')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x2d'));db[_0xf49d('0x2e')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x2f'));db['UserSmsQueue']=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0xf49d('0x30')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x31'));db[_0xf49d('0x32')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x33'));db[_0xf49d('0x34')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x35'));db['MailServerOut']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x36'));db[_0xf49d('0x37')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x38'));db['MailQueue']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x39'));db['MailSubstatus']=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0xf49d('0x3a')]=db['sequelize']['import'](_0xf49d('0x3b'));db['MailMessage']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x3c'));db[_0xf49d('0x3d')]=db[_0xf49d('0x0')]['import']('../api/mailApplication/mailApplication.model');db[_0xf49d('0x3e')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x3f'));db[_0xf49d('0x40')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x41'));db[_0xf49d('0x42')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x43'));db[_0xf49d('0x44')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/faxAccount/faxAccount.model');db[_0xf49d('0x45')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x46'));db['FaxInteraction']=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/faxInteraction/faxInteraction.model');db[_0xf49d('0x47')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x48'));db['FaxQueue']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x49'));db[_0xf49d('0x4a')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x4b'));db[_0xf49d('0x4c')]=db[_0xf49d('0x0')]['import']('../api/smsAccount/smsAccount.model');db[_0xf49d('0x4d')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x4e'));db['SmsInteraction']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x4f'));db[_0xf49d('0x50')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x51'));db[_0xf49d('0x52')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x53'));db[_0xf49d('0x54')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xf49d('0x55')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x56'));db[_0xf49d('0x57')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x58'));db[_0xf49d('0x59')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x5a'));db['OpenchannelQueue']=db[_0xf49d('0x0')]['import'](_0xf49d('0x5b'));db[_0xf49d('0x5c')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x5d'));db['OpenchannelQueueReport']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x5e'));db[_0xf49d('0x5f')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x60'));db[_0xf49d('0x61')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x62'));db[_0xf49d('0x63')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x64'));db[_0xf49d('0x65')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x66'));db[_0xf49d('0x67')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/chatQueue/chatQueue.model');db[_0xf49d('0x68')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x69'));db[_0xf49d('0x6a')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x6b'));db[_0xf49d('0x6c')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x6d'));db[_0xf49d('0x6e')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x6f'));db[_0xf49d('0x70')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x71'));db[_0xf49d('0x72')]=db['sequelize']['import'](_0xf49d('0x73'));db[_0xf49d('0x74')]=db['sequelize']['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xf49d('0x75')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x76'));db[_0xf49d('0x77')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x78'));db[_0xf49d('0x79')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x7a'));db['Action']=db[_0xf49d('0x0')]['import'](_0xf49d('0x7b'));db['Automation']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x7c'));db[_0xf49d('0x7d')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x7e'));db[_0xf49d('0x7f')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x80'));db[_0xf49d('0x81')]=db['sequelize'][_0xf49d('0x12')]('../api/condition/condition.model');db[_0xf49d('0x82')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x83'));db[_0xf49d('0x84')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x85'));db[_0xf49d('0x86')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x87'));db['VoiceQueuesLog']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x88'));db[_0xf49d('0x89')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x8a'));db[_0xf49d('0x8b')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x8c'));db['Tag']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x8d'));db[_0xf49d('0x8e')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/template/template.model');db[_0xf49d('0x8f')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/trigger/trigger.model');db['Variable']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x90'));db[_0xf49d('0x91')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x92'));db[_0xf49d('0x93')]=db['sequelize'][_0xf49d('0x12')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x94'));db[_0xf49d('0x95')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x96'));db['AnalyticExtractedReport']=db[_0xf49d('0x0')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xf49d('0x97')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x98'));db[_0xf49d('0x99')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0x9a'));db[_0xf49d('0x9b')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x9c'));db['SalesforceAccount']=db[_0xf49d('0x0')]['import'](_0xf49d('0x9d'));db[_0xf49d('0x9e')]=db['sequelize']['import'](_0xf49d('0x9f'));db[_0xf49d('0xa0')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xa1'));db[_0xf49d('0xa2')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xf49d('0xa3')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0xa4'));db[_0xf49d('0xa5')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xa6'));db[_0xf49d('0xa7')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xa8'));db[_0xf49d('0xa9')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0xaa'));db[_0xf49d('0xab')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xac'));db[_0xf49d('0xad')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xae'));db[_0xf49d('0xaf')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xb0'));db['ZohoField']=db[_0xf49d('0x0')]['import']('../api/intZohoField/intZohoField.model');db[_0xf49d('0xb1')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xb2'));db['ZendeskConfiguration']=db['sequelize']['import'](_0xf49d('0xb3'));db[_0xf49d('0xb4')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xb5'));db[_0xf49d('0xb6')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xb7'));db['FreshdeskConfiguration']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xb8'));db[_0xf49d('0xb9')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xba'));db[_0xf49d('0xbb')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xbc'));db[_0xf49d('0xbd')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xbe'));db[_0xf49d('0xbf')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0xc0'));db[_0xf49d('0xc1')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xc2'));db['ServicenowConfiguration']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xc3'));db[_0xf49d('0xc4')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xc5'));db[_0xf49d('0xc6')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xf49d('0xc7')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xc8'));db[_0xf49d('0xc9')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xca'));db['FreshsalesAccount']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xcb'));db[_0xf49d('0xcc')]=db[_0xf49d('0x0')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xf49d('0xcd')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xf49d('0x91')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x92'));db['Network']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xce'));db[_0xf49d('0xcf')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd0'));db['ChatInternalMessage']=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd1'));db[_0xf49d('0xd2')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd3'));db[_0xf49d('0xd4')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd5'));db[_0xf49d('0xd6')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd7'));db['SquareReport']=db['sequelize']['import'](_0xf49d('0xd8'));db['SquareDetailsReport']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xd9'));db[_0xf49d('0xda')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xdb'));db[_0xf49d('0xdc')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xdd'));db[_0xf49d('0xde')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xdf'));db[_0xf49d('0xe0')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xe1'));db[_0xf49d('0xe2')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xe3'));db[_0xf49d('0xe4')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/squareMessage/squareMessage.model');db[_0xf49d('0xe5')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xe6'));db[_0xf49d('0xe7')]=db[_0xf49d('0x0')]['import']('../api/license/license.model');db['Campaign']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xe8'));db[_0xf49d('0xe9')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/migration/migration.model');db[_0xf49d('0xea')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xeb'));db[_0xf49d('0xec')]=db['sequelize'][_0xf49d('0x12')]('../api/plugin/plugin.model');db[_0xf49d('0xed')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xee'));db[_0xf49d('0xef')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xf0'));db[_0xf49d('0xf1')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0xf2'));db[_0xf49d('0xf3')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xf4'));db[_0xf49d('0xf5')]=db[_0xf49d('0x0')]['import'](_0xf49d('0xf6'));db[_0xf49d('0xf7')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xf8'));db[_0xf49d('0xf9')]=db['sequelize'][_0xf49d('0x12')](_0xf49d('0xfa'));db[_0xf49d('0xfb')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userProfile/userProfile.model');db[_0xf49d('0xfc')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0xf49d('0xfd')]=db['sequelize']['import'](_0xf49d('0xfe'));db['Notification']=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0xff'));db[_0xf49d('0x100')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x101'));db[_0xf49d('0x102')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x103'));db[_0xf49d('0x104')]=db[_0xf49d('0x0')][_0xf49d('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xf49d('0x105')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x106'));db['WhatsappQueueReport']=db[_0xf49d('0x0')]['import'](_0xf49d('0x107'));db[_0xf49d('0x108')]=db[_0xf49d('0x0')]['import'](_0xf49d('0x109'));db[_0xf49d('0x10a')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x10b'));db[_0xf49d('0x10c')]=db[_0xf49d('0x0')][_0xf49d('0x12')](_0xf49d('0x10d'));db[_0xf49d('0x11')][_0xf49d('0x10e')](db['VoiceMail'],{'as':_0xf49d('0x10f'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db[_0xf49d('0x113')],{'as':'Recordings','foreignKey':'UserId'});db[_0xf49d('0x11')][_0xf49d('0x112')](db['UserVoiceQueueRt'],{'as':_0xf49d('0x114'),'foreignKey':_0xf49d('0x111')});db['User'][_0xf49d('0x112')](db['VoiceExtension'],{'as':_0xf49d('0x115'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db[_0xf49d('0x11')]['hasMany'](db[_0xf49d('0x74')],{'as':'HopperFinals','foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db[_0xf49d('0x75')],{'as':_0xf49d('0x116'),'foreignKey':_0xf49d('0x111')});db['User'][_0xf49d('0x112')](db[_0xf49d('0x77')],{'as':_0xf49d('0x77'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db[_0xf49d('0x57')],{'as':_0xf49d('0x117'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db[_0xf49d('0x61')],{'as':_0xf49d('0x118'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db[_0xf49d('0x119')],{'as':_0xf49d('0x11a'),'foreignKey':_0xf49d('0x111')});db['User']['hasMany'](db[_0xf49d('0x3a')],{'as':_0xf49d('0x11b'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db['WhatsappInteraction'],{'as':_0xf49d('0x11c'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x11')][_0xf49d('0x112')](db['Notification'],{'as':_0xf49d('0x11d'),'foreignKey':_0xf49d('0x11e')});db[_0xf49d('0x11')][_0xf49d('0x11f')](db['UserProfile'],{'as':_0xf49d('0xfb'),'foreignKey':_0xf49d('0x120')});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x68')],{'as':_0xf49d('0x122'),'through':'chat_group_has_users'});db[_0xf49d('0x11')][_0xf49d('0x121')](db['CmContact'],{'as':_0xf49d('0x123'),'through':_0xf49d('0x124')});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0xf7')],{'as':_0xf49d('0x125'),'through':_0xf49d('0x126')});db['User'][_0xf49d('0x121')](db['Team'],{'through':'user_has_teams'});db['User'][_0xf49d('0x121')](db[_0xf49d('0x3a')],{'as':_0xf49d('0x11b'),'through':_0xf49d('0x127')});db[_0xf49d('0x11')][_0xf49d('0x121')](db['ChatInteraction'],{'as':_0xf49d('0x118'),'through':_0xf49d('0x128')});db['User']['belongsToMany'](db[_0xf49d('0x119')],{'as':_0xf49d('0x11a'),'through':_0xf49d('0x129')});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x12a')],{'as':'SmsInteractions','through':_0xf49d('0x12b')});db['User'][_0xf49d('0x121')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xf49d('0x12c')});db[_0xf49d('0x11')][_0xf49d('0x121')](db['WhatsappInteraction'],{'as':_0xf49d('0x11c'),'through':'user_has_whatsapp_interactions'});db['User']['belongsToMany'](db[_0xf49d('0x1a')],{'as':_0xf49d('0x12d'),'through':_0xf49d('0x12e'),'required':![]});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x12f')],{'as':_0xf49d('0x130'),'through':_0xf49d('0x2c'),'required':![]});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x67')],{'as':_0xf49d('0x131'),'through':_0xf49d('0x2b'),'required':![],'hooks':!![]});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x132')],{'as':'FaxQueues','through':_0xf49d('0x2e'),'required':![]});db[_0xf49d('0x11')]['belongsToMany'](db[_0xf49d('0x52')],{'as':_0xf49d('0x133'),'through':_0xf49d('0x134'),'required':![]});db[_0xf49d('0x11')]['belongsToMany'](db[_0xf49d('0x135')],{'as':_0xf49d('0x136'),'through':'UserOpenchannelQueue','required':![]});db[_0xf49d('0x11')][_0xf49d('0x121')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xf49d('0x32'),'required':![]});db['User'][_0xf49d('0x121')](db[_0xf49d('0xf7')],{'through':_0xf49d('0x126')});db[_0xf49d('0x11')][_0xf49d('0x121')](db['VoicePrefix'],{'as':_0xf49d('0x137'),'through':_0xf49d('0x138'),'required':![]});db[_0xf49d('0x11')][_0xf49d('0x121')](db[_0xf49d('0x5c')],{'as':_0xf49d('0x139'),'through':_0xf49d('0x13a')});db[_0xf49d('0x11')]['belongsToMany'](db['FaxAccount'],{'as':_0xf49d('0x13b'),'through':_0xf49d('0x13c')});db[_0xf49d('0x11')]['belongsToMany'](db[_0xf49d('0x37')],{'as':_0xf49d('0x13d'),'through':'user_has_mail_accounts'});db[_0xf49d('0x11')][_0xf49d('0x121')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xf49d('0x13e')});db[_0xf49d('0x11')]['belongsToMany'](db[_0xf49d('0x4c')],{'as':_0xf49d('0x13f'),'through':_0xf49d('0x140')});db[_0xf49d('0x11')][_0xf49d('0x121')](db['WhatsappAccount'],{'as':_0xf49d('0x141'),'through':'user_has_whatsapp_accounts'});db['User'][_0xf49d('0x121')](db[_0xf49d('0xe0')],{'as':'SquareProjects','through':_0xf49d('0x142')});db[_0xf49d('0x13')][_0xf49d('0x112')](db[_0xf49d('0x143')],{'as':_0xf49d('0x144'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x145')});db[_0xf49d('0x15')][_0xf49d('0x112')](db[_0xf49d('0x143')],{'onDelete':_0xf49d('0x110')});db[_0xf49d('0x143')][_0xf49d('0x112')](db[_0xf49d('0x143')],{'as':'Applications','onDelete':_0xf49d('0x110')});db[_0xf49d('0x18')][_0xf49d('0x121')](db[_0xf49d('0x8b')],{'as':_0xf49d('0x146'),'through':_0xf49d('0x147')});db[_0xf49d('0x1a')][_0xf49d('0x112')](db[_0xf49d('0x2a')],{'as':'Members','foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')]['hasMany'](db[_0xf49d('0x70')],{'as':_0xf49d('0x149'),'foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')]['hasMany'](db[_0xf49d('0x74')],{'as':_0xf49d('0x14a'),'foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')][_0xf49d('0x112')](db[_0xf49d('0x75')],{'as':_0xf49d('0x14b'),'foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')][_0xf49d('0x112')](db[_0xf49d('0x77')],{'as':_0xf49d('0x77'),'foreignKey':'VoiceQueueId'});db[_0xf49d('0x1a')][_0xf49d('0x112')](db[_0xf49d('0x72')],{'as':'HopperBlacks','foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')]['hasMany'](db[_0xf49d('0xd4')],{'as':_0xf49d('0x14c'),'foreignKey':_0xf49d('0x148')});db[_0xf49d('0x1a')][_0xf49d('0x11f')](db[_0xf49d('0x14d')],{'as':_0xf49d('0x14d'),'foreignKey':_0xf49d('0x14e')});db[_0xf49d('0x1a')][_0xf49d('0x11f')](db['Trunk'],{'as':_0xf49d('0x14f'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0xf49d('0x11f')](db[_0xf49d('0x82')],{'as':'Interval','foreignKey':_0xf49d('0x150')});db[_0xf49d('0x1a')]['belongsTo'](db[_0xf49d('0x84')],{'as':_0xf49d('0x151'),'foreignKey':_0xf49d('0x152')});db[_0xf49d('0x1a')]['belongsToMany'](db[_0xf49d('0xf7')],{'as':_0xf49d('0x125'),'through':'voice_queues_has_cm_lists'});db[_0xf49d('0x1a')]['belongsToMany'](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x12e')});db['VoiceQueue']['belongsToMany'](db[_0xf49d('0xe5')],{'as':_0xf49d('0x154'),'through':'team_has_voice_queues'});db['VoiceQueue'][_0xf49d('0x121')](db[_0xf49d('0xf7')],{'as':_0xf49d('0x155'),'through':'voice_queues_has_cm_blacklists'});db[_0xf49d('0x113')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':_0xf49d('0x11'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x156')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0xf49d('0x112')](db[_0xf49d('0x1e')],{'as':_0xf49d('0x157'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x158'),'sourceKey':_0xf49d('0x159')});db[_0xf49d('0x1e')][_0xf49d('0x11f')](db[_0xf49d('0x10f')],{'foreignKey':_0xf49d('0x158'),'targetKey':'mailbox'});db[_0xf49d('0x15a')][_0xf49d('0x112')](db[_0xf49d('0x15b')],{'as':_0xf49d('0x15c'),'foreignKey':'uniqueid','constraints':![]});db[_0xf49d('0x15a')][_0xf49d('0x112')](db[_0xf49d('0x23')],{'as':_0xf49d('0x15d'),'foreignKey':_0xf49d('0x15e'),'constraints':![]});db[_0xf49d('0x15a')]['belongsTo'](db[_0xf49d('0x11')],{'as':_0xf49d('0x11'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x15a')]['belongsTo'](db['CmContact'],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x34')]['belongsTo'](db[_0xf49d('0x37')],{'as':_0xf49d('0x37'),'foreignKey':_0xf49d('0x161')});db[_0xf49d('0x162')][_0xf49d('0x11f')](db[_0xf49d('0x37')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailAccount'][_0xf49d('0x10e')](db[_0xf49d('0x34')],{'as':_0xf49d('0x163'),'onDelete':_0xf49d('0x110')});db['MailAccount'][_0xf49d('0x10e')](db['MailServerOut'],{'as':_0xf49d('0x164'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x37')][_0xf49d('0x112')](db[_0xf49d('0x7f')],{'as':_0xf49d('0x165'),'foreignKey':_0xf49d('0x161')});db[_0xf49d('0x37')][_0xf49d('0x112')](db[_0xf49d('0x7d')],{'as':_0xf49d('0x166'),'foreignKey':_0xf49d('0x161')});db['MailAccount'][_0xf49d('0x112')](db[_0xf49d('0x167')],{'as':_0xf49d('0x157'),'foreignKey':_0xf49d('0x161')});db[_0xf49d('0x37')]['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0xf49d('0x37')][_0xf49d('0x112')](db[_0xf49d('0x3d')],{'as':'Applications'});db[_0xf49d('0x37')][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':_0xf49d('0x168'),'foreignKey':_0xf49d('0x169')});db[_0xf49d('0x37')][_0xf49d('0x11f')](db[_0xf49d('0x8e')],{'as':_0xf49d('0x8e'),'foreignKey':'TemplateId'});db[_0xf49d('0x37')]['belongsTo'](db[_0xf49d('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xf49d('0x152')});db[_0xf49d('0x37')][_0xf49d('0x121')](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x16a')});db[_0xf49d('0x12f')][_0xf49d('0x121')](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x2c')});db[_0xf49d('0x12f')][_0xf49d('0x121')](db[_0xf49d('0xe5')],{'through':_0xf49d('0x16b'),'as':_0xf49d('0x154')});db[_0xf49d('0x3a')][_0xf49d('0x112')](db[_0xf49d('0x167')],{'as':_0xf49d('0x157'),'onDelete':'cascade','foreignKey':_0xf49d('0x16c')});db[_0xf49d('0x3a')]['belongsTo'](db[_0xf49d('0x37')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x161')});db[_0xf49d('0x3a')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db['MailInteraction'][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':'Owner','foreignKey':'UserId'});db[_0xf49d('0x3a')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':_0xf49d('0x16f'),'as':_0xf49d('0x170')});db[_0xf49d('0x3a')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':_0xf49d('0x16f'),'as':'ThroughTags'});db[_0xf49d('0x3a')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':_0xf49d('0x127'),'foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db[_0xf49d('0xea')],{'as':_0xf49d('0x172'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x167')]['belongsTo'](db[_0xf49d('0x11')],{'as':_0xf49d('0x11')});db['MailMessage'][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x15f')});db[_0xf49d('0x167')]['belongsTo'](db[_0xf49d('0x3a')],{'as':_0xf49d('0x173'),'foreignKey':_0xf49d('0x16c')});db[_0xf49d('0x167')][_0xf49d('0x11f')](db[_0xf49d('0x37')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x161')});db[_0xf49d('0x3d')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x3d')][_0xf49d('0x11f')](db[_0xf49d('0x12f')],{'onDelete':'restrict'});db[_0xf49d('0x3d')][_0xf49d('0x11f')](db[_0xf49d('0x37')],{'onDelete':'restrict'});db[_0xf49d('0x3d')]['belongsTo'](db[_0xf49d('0x82')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xf49d('0x3d')][_0xf49d('0x11f')](db[_0xf49d('0x16e')],{'onDelete':'restrict','foreignKey':_0xf49d('0x175')});db['MailQueueReport'][_0xf49d('0x11f')](db[_0xf49d('0x37')],{});db[_0xf49d('0x3e')]['belongsTo'](db[_0xf49d('0xf7')],{'as':_0xf49d('0x168'),'foreignKey':'ListId'});db[_0xf49d('0x3e')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x3e')][_0xf49d('0x11f')](db[_0xf49d('0x3a')],{});db[_0xf49d('0x3e')][_0xf49d('0x11f')](db['MailMessage'],{});db[_0xf49d('0x3e')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{});db[_0xf49d('0x3e')]['belongsTo'](db[_0xf49d('0x12f')],{});db['Dashboard'][_0xf49d('0x112')](db[_0xf49d('0x42')],{'as':_0xf49d('0x176'),'onDelete':'cascade'});db[_0xf49d('0x44')][_0xf49d('0x112')](db[_0xf49d('0x7f')],{'as':_0xf49d('0x165'),'foreignKey':_0xf49d('0x177')});db['FaxAccount'][_0xf49d('0x112')](db[_0xf49d('0x7d')],{'as':_0xf49d('0x166'),'foreignKey':_0xf49d('0x177')});db[_0xf49d('0x44')][_0xf49d('0x112')](db['FaxInteraction'],{'as':_0xf49d('0x178')});db[_0xf49d('0x44')][_0xf49d('0x112')](db[_0xf49d('0x45')],{'as':_0xf49d('0x179')});db[_0xf49d('0x44')][_0xf49d('0x112')](db[_0xf49d('0x143')],{'as':_0xf49d('0x17a'),'onDelete':'cascade'});db[_0xf49d('0x44')][_0xf49d('0x112')](db[_0xf49d('0x47')],{'as':_0xf49d('0x157')});db[_0xf49d('0x44')][_0xf49d('0x11f')](db['Trunk'],{'as':_0xf49d('0x14d')});db['FaxAccount']['belongsTo'](db[_0xf49d('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xf49d('0x44')][_0xf49d('0x11f')](db[_0xf49d('0x84')],{'as':_0xf49d('0x151'),'foreignKey':_0xf49d('0x152')});db['FaxAccount'][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x13c')});db['FaxApplication'][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x45')][_0xf49d('0x11f')](db[_0xf49d('0x132')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x45')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db[_0xf49d('0x45')]['belongsTo'](db[_0xf49d('0x16e')],{'onDelete':'restrict','foreignKey':_0xf49d('0x175')});db['FaxInteraction'][_0xf49d('0x112')](db['FaxMessage'],{'as':_0xf49d('0x157'),'onDelete':_0xf49d('0x110'),'foreignKey':'FaxInteractionId'});db[_0xf49d('0x119')][_0xf49d('0x11f')](db[_0xf49d('0x44')],{'as':'Account','foreignKey':_0xf49d('0x177')});db[_0xf49d('0x119')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x119')]['belongsTo'](db[_0xf49d('0x11')],{'as':_0xf49d('0x17b'),'foreignKey':_0xf49d('0x111')});db['FaxInteraction']['belongsToMany'](db[_0xf49d('0x16e')],{'through':'fax_interaction_has_tags','as':_0xf49d('0x170')});db[_0xf49d('0x119')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':'fax_interaction_has_tags','as':_0xf49d('0x17c')});db['FaxInteraction'][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':_0xf49d('0x129'),'foreignKey':_0xf49d('0x17d')});db['FaxMessage'][_0xf49d('0x11f')](db['User'],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x11')});db[_0xf49d('0x47')][_0xf49d('0x11f')](db['FaxInteraction'],{'as':_0xf49d('0x173'),'foreignKey':_0xf49d('0x17d')});db[_0xf49d('0x47')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':_0xf49d('0x110'),'as':'Contact'});db['FaxMessage'][_0xf49d('0x11f')](db[_0xf49d('0xea')],{'as':_0xf49d('0xea'),'foreignKey':_0xf49d('0x17e')});db[_0xf49d('0x47')][_0xf49d('0x11f')](db[_0xf49d('0x44')],{'as':'Account','foreignKey':_0xf49d('0x177')});db[_0xf49d('0x132')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':'Agents','through':_0xf49d('0x2e')});db[_0xf49d('0x132')]['belongsToMany'](db[_0xf49d('0xe5')],{'through':_0xf49d('0x17f'),'as':_0xf49d('0x154')});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db[_0xf49d('0x44')],{});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db['CmList'],{'as':_0xf49d('0x168'),'foreignKey':'ListId'});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':'ContactId'});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db[_0xf49d('0x119')],{});db['FaxQueueReport'][_0xf49d('0x11f')](db[_0xf49d('0x47')],{});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db['User'],{});db[_0xf49d('0x4a')][_0xf49d('0x11f')](db[_0xf49d('0x132')],{});db[_0xf49d('0x4c')]['hasMany'](db[_0xf49d('0x7f')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xf49d('0x4c')]['hasMany'](db['CannedAnswer'],{'as':_0xf49d('0x166'),'foreignKey':_0xf49d('0x180')});db['SmsAccount'][_0xf49d('0x112')](db[_0xf49d('0x50')],{'as':_0xf49d('0x157'),'foreignKey':_0xf49d('0x180')});db[_0xf49d('0x4c')]['hasMany'](db[_0xf49d('0x12a')],{'as':'Interactions'});db[_0xf49d('0x4c')][_0xf49d('0x112')](db[_0xf49d('0x4d')],{'as':'Applications'});db[_0xf49d('0x4c')]['belongsTo'](db[_0xf49d('0xf7')],{'as':_0xf49d('0x168'),'foreignKey':_0xf49d('0x169')});db[_0xf49d('0x4c')]['belongsTo'](db[_0xf49d('0x84')],{'as':'mandatoryDispositionPause','foreignKey':_0xf49d('0x152')});db[_0xf49d('0x4c')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':'Agents','through':_0xf49d('0x140')});db[_0xf49d('0x4d')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x4d')][_0xf49d('0x11f')](db[_0xf49d('0x52')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x4d')][_0xf49d('0x11f')](db[_0xf49d('0x4c')],{'onDelete':_0xf49d('0x174')});db['SmsApplication'][_0xf49d('0x11f')](db[_0xf49d('0x82')],{'onDelete':'restrict','foreignKey':_0xf49d('0x150')});db[_0xf49d('0x4d')][_0xf49d('0x11f')](db['Tag'],{'onDelete':_0xf49d('0x174'),'foreignKey':_0xf49d('0x175')});db[_0xf49d('0x12a')][_0xf49d('0x112')](db['SmsMessage'],{'as':_0xf49d('0x157'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x181')});db[_0xf49d('0x12a')]['belongsTo'](db[_0xf49d('0x4c')],{'as':'Account','foreignKey':_0xf49d('0x180')});db[_0xf49d('0x12a')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0xf49d('0x12a')][_0xf49d('0x11f')](db['User'],{'as':_0xf49d('0x17b'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x12a')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':_0xf49d('0x182'),'as':'Tags'});db[_0xf49d('0x12a')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xf49d('0x17c')});db[_0xf49d('0x12a')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':'user_has_sms_interactions','foreignKey':_0xf49d('0x181')});db[_0xf49d('0x50')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':_0xf49d('0x11')});db[_0xf49d('0x50')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x15f')});db[_0xf49d('0x50')][_0xf49d('0x11f')](db[_0xf49d('0x12a')],{'onDelete':'cascade','as':_0xf49d('0x173'),'foreignKey':'SmsInteractionId'});db[_0xf49d('0x50')][_0xf49d('0x11f')](db[_0xf49d('0x4c')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x180')});db[_0xf49d('0x52')][_0xf49d('0x121')](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x134'),'foreignKey':_0xf49d('0x183')});db[_0xf49d('0x52')][_0xf49d('0x121')](db[_0xf49d('0xe5')],{'through':'team_has_sms_queues','as':_0xf49d('0x154')});db[_0xf49d('0x54')][_0xf49d('0x112')](db[_0xf49d('0x7f')],{'as':_0xf49d('0x165'),'foreignKey':'OpenchannelAccountId'});db[_0xf49d('0x54')][_0xf49d('0x112')](db[_0xf49d('0x7d')],{'as':_0xf49d('0x166'),'foreignKey':_0xf49d('0x184')});db[_0xf49d('0x54')][_0xf49d('0x112')](db[_0xf49d('0x57')],{'as':'Interactions','foreignKey':_0xf49d('0x184')});db[_0xf49d('0x54')][_0xf49d('0x112')](db[_0xf49d('0x59')],{'as':_0xf49d('0x157'),'foreignKey':_0xf49d('0x184')});db[_0xf49d('0x54')]['hasMany'](db[_0xf49d('0x55')],{'as':'Applications','foreignKey':_0xf49d('0x184')});db['OpenchannelAccount'][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0xf49d('0x11f')](db[_0xf49d('0x84')],{'as':_0xf49d('0x151'),'foreignKey':_0xf49d('0x152')});db['OpenchannelAccount']['belongsToMany'](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x13e')});db[_0xf49d('0x55')]['belongsTo'](db[_0xf49d('0x11')],{'onDelete':'restrict'});db[_0xf49d('0x55')]['belongsTo'](db[_0xf49d('0x135')],{'onDelete':_0xf49d('0x174'),'foreignKey':_0xf49d('0x185')});db[_0xf49d('0x55')][_0xf49d('0x11f')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xf49d('0x184')});db[_0xf49d('0x55')][_0xf49d('0x11f')](db[_0xf49d('0x82')],{'onDelete':'restrict','foreignKey':_0xf49d('0x150')});db['OpenchannelApplication'][_0xf49d('0x11f')](db[_0xf49d('0x16e')],{'onDelete':_0xf49d('0x174'),'foreignKey':'TagId'});db[_0xf49d('0x57')][_0xf49d('0x112')](db[_0xf49d('0x59')],{'as':_0xf49d('0x157'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x186')});db[_0xf49d('0x57')][_0xf49d('0x11f')](db[_0xf49d('0x54')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x184')});db[_0xf49d('0x57')][_0xf49d('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0xf49d('0x160')});db[_0xf49d('0x57')][_0xf49d('0x11f')](db['User'],{'as':_0xf49d('0x17b'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x57')]['belongsToMany'](db['Tag'],{'through':_0xf49d('0x187'),'as':_0xf49d('0x170')});db['OpenchannelInteraction'][_0xf49d('0x121')](db['Tag'],{'through':_0xf49d('0x187'),'as':_0xf49d('0x17c')});db[_0xf49d('0x57')]['belongsToMany'](db[_0xf49d('0x11')],{'as':'Users','through':_0xf49d('0x12c'),'foreignKey':_0xf49d('0x186')});db[_0xf49d('0x59')]['belongsTo'](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x11')});db[_0xf49d('0x59')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':'cascade','as':_0xf49d('0x15f')});db[_0xf49d('0x59')][_0xf49d('0x11f')](db[_0xf49d('0x57')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x173'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xf49d('0x11f')](db['Attachment'],{'as':_0xf49d('0xea'),'foreignKey':_0xf49d('0x17e')});db[_0xf49d('0x59')][_0xf49d('0x11f')](db[_0xf49d('0x54')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x184')});db['OpenchannelQueue']['belongsToMany'](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x30'),'foreignKey':_0xf49d('0x185')});db['OpenchannelQueue']['belongsToMany'](db[_0xf49d('0xe5')],{'through':_0xf49d('0x188'),'as':_0xf49d('0x154')});db[_0xf49d('0x5c')][_0xf49d('0x112')](db[_0xf49d('0x7f')],{'as':_0xf49d('0x165'),'foreignKey':_0xf49d('0x189')});db[_0xf49d('0x5c')]['hasMany'](db[_0xf49d('0x7d')],{'as':_0xf49d('0x166'),'foreignKey':'ChatWebsiteId'});db[_0xf49d('0x5c')]['hasMany'](db[_0xf49d('0x6a')],{'as':_0xf49d('0x18a')});db[_0xf49d('0x5c')][_0xf49d('0x112')](db[_0xf49d('0x61')],{'as':_0xf49d('0x178')});db['ChatWebsite'][_0xf49d('0x112')](db['ChatApplication'],{'as':'Applications'});db[_0xf49d('0x5c')][_0xf49d('0x112')](db[_0xf49d('0x63')],{'as':_0xf49d('0x157')});db['ChatWebsite'][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0xf49d('0x5c')][_0xf49d('0x11f')](db[_0xf49d('0x82')],{'as':_0xf49d('0x82'),'foreignKey':_0xf49d('0x150')});db['ChatWebsite']['belongsTo'](db[_0xf49d('0x84')],{'as':_0xf49d('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf49d('0x5c')][_0xf49d('0x121')](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x13a')});db['OpenchannelQueueReport'][_0xf49d('0x11f')](db[_0xf49d('0x54')],{});db[_0xf49d('0x18b')][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':_0xf49d('0x168'),'foreignKey':'ListId'});db[_0xf49d('0x18b')]['belongsTo'](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x18b')][_0xf49d('0x11f')](db['OpenchannelInteraction'],{});db[_0xf49d('0x18b')]['belongsTo'](db[_0xf49d('0x59')],{});db[_0xf49d('0x18b')][_0xf49d('0x11f')](db['User'],{});db[_0xf49d('0x18b')][_0xf49d('0x11f')](db[_0xf49d('0x135')],{});db[_0xf49d('0x5f')][_0xf49d('0x11f')](db['User'],{'as':_0xf49d('0x18c'),'foreignKey':'UserId','onDelete':_0xf49d('0x174')});db[_0xf49d('0x5f')]['belongsTo'](db[_0xf49d('0x67')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xf49d('0x174')});db[_0xf49d('0x5f')][_0xf49d('0x11f')](db[_0xf49d('0x5c')],{'as':'Website','foreignKey':_0xf49d('0x189'),'onDelete':_0xf49d('0x174')});db[_0xf49d('0x5f')][_0xf49d('0x11f')](db[_0xf49d('0x16e')],{'onDelete':'restrict','foreignKey':_0xf49d('0x175')});db[_0xf49d('0x61')][_0xf49d('0x112')](db[_0xf49d('0x63')],{'as':_0xf49d('0x157'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x18d')});db[_0xf49d('0x61')][_0xf49d('0x11f')](db[_0xf49d('0x5c')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x189')});db[_0xf49d('0x61')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x61')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':_0xf49d('0x17b'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x61')][_0xf49d('0x121')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xf49d('0x170')});db[_0xf49d('0x61')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':_0xf49d('0x18e'),'as':'ThroughTags'});db['ChatInteraction'][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':_0xf49d('0x128'),'foreignKey':_0xf49d('0x18d')});db[_0xf49d('0x63')][_0xf49d('0x11f')](db['User'],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x11')});db[_0xf49d('0x63')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x63')][_0xf49d('0x11f')](db[_0xf49d('0x61')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x173'),'foreignKey':_0xf49d('0x18d')});db['ChatMessage']['belongsTo'](db[_0xf49d('0xea')],{'as':'Attachment','foreignKey':_0xf49d('0x17e')});db[_0xf49d('0x63')][_0xf49d('0x11f')](db['ChatWebsite'],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x189')});db[_0xf49d('0x65')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db['ChatOfflineMessage']['belongsTo'](db[_0xf49d('0x5c')],{'as':_0xf49d('0x16d'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x2b'),'hooks':!![]});db[_0xf49d('0x67')][_0xf49d('0x121')](db[_0xf49d('0xe5')],{'through':_0xf49d('0x18f'),'as':_0xf49d('0x154')});db[_0xf49d('0x68')][_0xf49d('0x112')](db[_0xf49d('0x190')],{'as':_0xf49d('0x157'),'foreignKey':_0xf49d('0x191'),'onDelete':'cascade'});db[_0xf49d('0x68')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x192'),'through':_0xf49d('0x193')});db['ChatProactiveAction'][_0xf49d('0x11f')](db['ChatWebsite'],{'as':_0xf49d('0x194'),'foreignKey':_0xf49d('0x189')});db[_0xf49d('0x6c')]['hasMany'](db[_0xf49d('0x6e')],{'as':_0xf49d('0x123'),'foreignKey':'CompanyId'});db[_0xf49d('0x6e')]['hasMany'](db[_0xf49d('0x70')],{'as':_0xf49d('0x149'),'foreignKey':_0xf49d('0x160')});db['CmContact']['hasMany'](db[_0xf49d('0x74')],{'as':_0xf49d('0x14a'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x6e')][_0xf49d('0x112')](db[_0xf49d('0x75')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xf49d('0x6e')][_0xf49d('0x112')](db[_0xf49d('0x77')],{'as':_0xf49d('0x77'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x6e')][_0xf49d('0x112')](db[_0xf49d('0xd4')],{'as':_0xf49d('0x14c'),'foreignKey':_0xf49d('0x160')});db[_0xf49d('0x6e')][_0xf49d('0x112')](db[_0xf49d('0x57')],{'as':_0xf49d('0x117'),'foreignKey':_0xf49d('0x160'),'onDelete':_0xf49d('0x174')});db[_0xf49d('0x6e')][_0xf49d('0x112')](db[_0xf49d('0x61')],{'as':_0xf49d('0x118'),'foreignKey':'ContactId','onDelete':_0xf49d('0x174')});db[_0xf49d('0x6e')]['hasMany'](db[_0xf49d('0x12a')],{'as':_0xf49d('0x195'),'foreignKey':'ContactId','onDelete':_0xf49d('0x174')});db['CmContact'][_0xf49d('0x112')](db[_0xf49d('0x119')],{'as':_0xf49d('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact']['hasMany'](db['MailInteraction'],{'as':_0xf49d('0x11b'),'foreignKey':'ContactId','onDelete':_0xf49d('0x174')});db[_0xf49d('0x6e')][_0xf49d('0x11f')](db['CmCompany'],{'as':_0xf49d('0x196'),'foreignKey':_0xf49d('0x197')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0xf49d('0x168'),'foreignKey':_0xf49d('0x169'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x6e')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':_0xf49d('0x124')});db[_0xf49d('0x6e')][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'as':_0xf49d('0x170'),'through':_0xf49d('0x198')});db[_0xf49d('0x6e')]['belongsToMany'](db[_0xf49d('0x16e')],{'through':_0xf49d('0x198'),'as':_0xf49d('0x17c')});db[_0xf49d('0x70')]['belongsTo'](db['CmContact'],{'as':_0xf49d('0x15f'),'foreignKey':'ContactId','onDelete':_0xf49d('0x110')});db['CmHopper'][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':_0xf49d('0x168'),'foreignKey':_0xf49d('0x169'),'onDelete':'cascade'});db[_0xf49d('0x70')]['belongsTo'](db[_0xf49d('0x11')],{'as':_0xf49d('0x18c'),'foreignKey':_0xf49d('0x111')});db[_0xf49d('0x70')]['belongsTo'](db[_0xf49d('0x1a')],{'as':_0xf49d('0x199'),'foreignKey':_0xf49d('0x148'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db['Campaign'],{'as':_0xf49d('0x19a'),'foreignKey':_0xf49d('0x19b'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x70')][_0xf49d('0x11f')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0xf49d('0x11f')](db['CmContact'],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160'),'onDelete':'cascade'});db[_0xf49d('0x72')][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':'List','foreignKey':_0xf49d('0x169'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x72')][_0xf49d('0x11f')](db[_0xf49d('0x1a')],{'as':_0xf49d('0x199'),'foreignKey':'VoiceQueueId','onDelete':_0xf49d('0x110')});db[_0xf49d('0x72')][_0xf49d('0x11f')](db[_0xf49d('0x19a')],{'as':_0xf49d('0x19a'),'foreignKey':_0xf49d('0x19b'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0x19c')]['hasMany'](db['Condition'],{'as':{'plural':_0xf49d('0x19d'),'singular':'OneAll'},'foreignKey':_0xf49d('0x19e'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db['Automation']['hasMany'](db[_0xf49d('0x81')],{'as':{'plural':_0xf49d('0x19f'),'singular':'OneAny'},'foreignKey':_0xf49d('0x1a0'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db['Automation']['hasMany'](db[_0xf49d('0x1a1')],{'as':_0xf49d('0x1a2'),'foreignKey':_0xf49d('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xf49d('0x82')][_0xf49d('0x112')](db[_0xf49d('0x82')],{'as':_0xf49d('0x1a4'),'foreignKey':_0xf49d('0x150'),'onDelete':_0xf49d('0x110'),'hooks':!![],'required':![]});db[_0xf49d('0x82')][_0xf49d('0x112')](db['VoiceExtension'],{'as':_0xf49d('0x115'),'foreignKey':'IntervalId','onDelete':_0xf49d('0x174')});db['Interval'][_0xf49d('0x112')](db[_0xf49d('0x3d')],{'as':_0xf49d('0x1a5'),'foreignKey':_0xf49d('0x150')});db[_0xf49d('0x82')]['hasMany'](db['ChatApplication'],{'as':_0xf49d('0x1a6'),'foreignKey':_0xf49d('0x150')});db['Interval'][_0xf49d('0x112')](db['FaxApplication'],{'as':_0xf49d('0x1a7'),'foreignKey':'IntervalId'});db[_0xf49d('0x82')][_0xf49d('0x112')](db[_0xf49d('0x4d')],{'as':_0xf49d('0x1a8'),'foreignKey':_0xf49d('0x150')});db['Schedule'][_0xf49d('0x11f')](db[_0xf49d('0x37')],{});db[_0xf49d('0x89')][_0xf49d('0x11f')](db[_0xf49d('0x95')],{'foreignKey':_0xf49d('0x1a9')});db[_0xf49d('0x89')][_0xf49d('0x11f')](db['AnalyticCustomReport'],{'foreignKey':_0xf49d('0x1aa')});db[_0xf49d('0x8b')][_0xf49d('0x121')](db[_0xf49d('0x18')],{'as':_0xf49d('0x1ab'),'through':_0xf49d('0x147'),'onDelete':'restrict'});db[_0xf49d('0x16e')]['belongsToMany'](db['CmContact'],{'through':_0xf49d('0x198')});db['Tag'][_0xf49d('0x121')](db[_0xf49d('0x61')],{'through':_0xf49d('0x18e')});db[_0xf49d('0x16e')][_0xf49d('0x121')](db[_0xf49d('0x3a')],{'through':'mail_interaction_has_tags'});db[_0xf49d('0x16e')]['belongsToMany'](db[_0xf49d('0x12a')],{'through':'sms_interaction_has_tags'});db[_0xf49d('0x16e')]['belongsToMany'](db[_0xf49d('0x119')],{'through':_0xf49d('0x1ac')});db[_0xf49d('0x16e')][_0xf49d('0x121')](db[_0xf49d('0x57')],{'through':_0xf49d('0x187')});db['Tag'][_0xf49d('0x121')](db[_0xf49d('0x104')],{'through':_0xf49d('0x1ad')});db[_0xf49d('0x8f')]['hasMany'](db[_0xf49d('0x81')],{'as':{'plural':_0xf49d('0x1ae'),'singular':_0xf49d('0x1af')},'foreignKey':_0xf49d('0x1b0'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xf49d('0x81')],{'as':{'plural':_0xf49d('0x1b1'),'singular':_0xf49d('0x1b2')},'foreignKey':_0xf49d('0x1b3'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db['Trigger'][_0xf49d('0x112')](db['Action'],{'as':_0xf49d('0x1a2'),'foreignKey':_0xf49d('0x1b4'),'onDelete':_0xf49d('0x110'),'hooks':!![]});db['AnalyticCustomReport'][_0xf49d('0x112')](db[_0xf49d('0x99')],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xf49d('0x95')][_0xf49d('0x112')](db[_0xf49d('0x99')],{'as':'Fields','onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xf49d('0x97')]['hasMany'](db[_0xf49d('0x99')],{'as':'Fields','onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b6')});db[_0xf49d('0x99')][_0xf49d('0x11f')](db[_0xf49d('0x97')],{'foreignKey':'MetricId'});db[_0xf49d('0x1b7')][_0xf49d('0x112')](db[_0xf49d('0x9e')],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0x9e')][_0xf49d('0x112')](db[_0xf49d('0xa0')],{'as':_0xf49d('0x1ba'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xf49d('0x9e')][_0xf49d('0x112')](db[_0xf49d('0xa0')],{'as':'Descriptions','onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0x9e')]['hasMany'](db[_0xf49d('0xa0')],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':'FieldId'});db[_0xf49d('0x9e')][_0xf49d('0x11f')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xa0')]['hasMany'](db[_0xf49d('0xa0')],{'as':_0xf49d('0x1bc'),'foreignKey':'SubjectId'});db['SalesforceField']['hasMany'](db[_0xf49d('0xa0')],{'as':'Description','foreignKey':_0xf49d('0x1bb')});db['SalesforceField'][_0xf49d('0x112')](db[_0xf49d('0xa0')],{'as':_0xf49d('0x1bd'),'foreignKey':_0xf49d('0x1be')});db['SalesforceField']['belongsTo'](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':_0xf49d('0x1c0')});db[_0xf49d('0xa2')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xa3')][_0xf49d('0x112')](db[_0xf49d('0xa5')],{'as':'Subjects','onDelete':_0xf49d('0x110'),'foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xa5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xa3')]['hasMany'](db[_0xf49d('0xa5')],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xa3')]['belongsTo'](db[_0xf49d('0xa2')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xa5')][_0xf49d('0x112')](db['SugarcrmField'],{'as':_0xf49d('0x1bc'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0xf49d('0x112')](db['SugarcrmField'],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xf49d('0x1bd'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':'Variable','foreignKey':'VariableId'});db[_0xf49d('0xa7')][_0xf49d('0x112')](db['DeskConfiguration'],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db['DeskConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xab')],{'as':_0xf49d('0x1ba'),'onDelete':_0xf49d('0x110'),'foreignKey':'SubjectId'});db[_0xf49d('0xa9')][_0xf49d('0x112')](db[_0xf49d('0xab')],{'as':_0xf49d('0x1c2'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xa9')][_0xf49d('0x112')](db[_0xf49d('0xab')],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xa9')]['belongsTo'](db[_0xf49d('0xa7')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db['DeskConfiguration'][_0xf49d('0x121')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xf49d('0xab')][_0xf49d('0x112')](db[_0xf49d('0xab')],{'as':'Subject','foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xab')][_0xf49d('0x112')](db['DeskField'],{'as':'Description','foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xab')][_0xf49d('0x112')](db[_0xf49d('0xab')],{'as':_0xf49d('0x1bd'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xab')][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':'VariableId'});db[_0xf49d('0xad')][_0xf49d('0x112')](db[_0xf49d('0xaf')],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xaf')][_0xf49d('0x112')](db[_0xf49d('0x1c4')],{'as':_0xf49d('0x1ba'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1c3')});db['ZohoConfiguration'][_0xf49d('0x112')](db[_0xf49d('0x1c4')],{'as':_0xf49d('0x1c2'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xaf')][_0xf49d('0x112')](db['ZohoField'],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1be')});db['ZohoConfiguration'][_0xf49d('0x11f')](db[_0xf49d('0xad')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0x1c4')][_0xf49d('0x112')](db[_0xf49d('0x1c4')],{'as':'Subject','foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0x1c4')][_0xf49d('0x112')](db[_0xf49d('0x1c4')],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0x1c4')][_0xf49d('0x112')](db['ZohoField'],{'as':_0xf49d('0x1bd'),'foreignKey':'FieldId'});db[_0xf49d('0x1c4')]['belongsTo'](db['Variable'],{'as':_0xf49d('0x1bf'),'foreignKey':_0xf49d('0x1c0')});db[_0xf49d('0xb1')][_0xf49d('0x112')](db[_0xf49d('0x1c5')],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0x1c5')][_0xf49d('0x112')](db[_0xf49d('0xb4')],{'as':_0xf49d('0x1ba'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0x1c5')][_0xf49d('0x112')](db[_0xf49d('0xb4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xb4')],{'as':_0xf49d('0x1b5'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0x1c5')][_0xf49d('0x11f')](db[_0xf49d('0xb1')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db['ZendeskConfiguration'][_0xf49d('0x121')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xf49d('0xb4')][_0xf49d('0x112')](db[_0xf49d('0xb4')],{'as':_0xf49d('0x1bc'),'foreignKey':_0xf49d('0x1c3')});db['ZendeskField']['hasMany'](db[_0xf49d('0xb4')],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xb4')]['hasMany'](db[_0xf49d('0xb4')],{'as':_0xf49d('0x1bd'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xb4')][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':'Variable','foreignKey':'VariableId'});db['FreshdeskAccount'][_0xf49d('0x112')](db['FreshdeskConfiguration'],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0x1c6')][_0xf49d('0x112')](db[_0xf49d('0xb9')],{'as':_0xf49d('0x1ba'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0x1c6')]['hasMany'](db[_0xf49d('0xb9')],{'as':_0xf49d('0x1c2'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1bb')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0x1c6')][_0xf49d('0x11f')](db[_0xf49d('0xb6')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db['FreshdeskConfiguration'][_0xf49d('0x121')](db[_0xf49d('0x16e')],{'through':_0xf49d('0x1c7')});db[_0xf49d('0xb9')]['hasMany'](db[_0xf49d('0xb9')],{'as':_0xf49d('0x1bc'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xb9')][_0xf49d('0x112')](db[_0xf49d('0xb9')],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db['FreshdeskField'][_0xf49d('0x112')](db[_0xf49d('0xb9')],{'as':_0xf49d('0x1bd'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':'Variable','foreignKey':'VariableId'});db[_0xf49d('0xbb')][_0xf49d('0x112')](db[_0xf49d('0xbd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xbd')][_0xf49d('0x112')](db[_0xf49d('0xbf')],{'as':_0xf49d('0x1ba'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xbd')]['hasMany'](db[_0xf49d('0xbf')],{'as':_0xf49d('0x1c2'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xbf')],{'as':_0xf49d('0x1b5'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xbd')]['belongsTo'](db[_0xf49d('0xbb')],{'as':'Account','foreignKey':_0xf49d('0x1b9')});db['VtigerField'][_0xf49d('0x112')](db['VtigerField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xf49d('0xbf')][_0xf49d('0x112')](db['VtigerField'],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xbf')][_0xf49d('0x112')](db[_0xf49d('0xbf')],{'as':_0xf49d('0x1bd'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xbf')][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':_0xf49d('0x1c0')});db[_0xf49d('0xc1')][_0xf49d('0x112')](db[_0xf49d('0x1c8')],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db['ServicenowConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xc4')],{'as':_0xf49d('0x1ba'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0x1c8')][_0xf49d('0x112')](db[_0xf49d('0xc4')],{'as':'Descriptions','foreignKey':_0xf49d('0x1bb')});db['ServicenowConfiguration'][_0xf49d('0x112')](db[_0xf49d('0xc4')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0xf49d('0x11f')](db[_0xf49d('0xc1')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xc4')]['hasMany'](db[_0xf49d('0xc4')],{'as':_0xf49d('0x1bc'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xc4')][_0xf49d('0x112')](db[_0xf49d('0xc4')],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xc4')][_0xf49d('0x112')](db['ServicenowField'],{'as':'Field','foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xc4')][_0xf49d('0x11f')](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0xf49d('0x112')](db[_0xf49d('0xc7')],{'as':'Configurations','onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db['Dynamics365Configuration'][_0xf49d('0x112')](db[_0xf49d('0xc9')],{'as':_0xf49d('0x1ba'),'onDelete':'cascade','foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xc7')][_0xf49d('0x112')](db[_0xf49d('0xc9')],{'as':_0xf49d('0x1c2'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1bb')});db['Dynamics365Configuration']['hasMany'](db[_0xf49d('0xc9')],{'as':_0xf49d('0x1b5'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xc7')]['belongsTo'](db[_0xf49d('0xc6')],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db['Dynamics365Field'][_0xf49d('0x112')](db['Dynamics365Field'],{'as':_0xf49d('0x1bc'),'foreignKey':_0xf49d('0x1c3')});db[_0xf49d('0xc9')][_0xf49d('0x112')](db[_0xf49d('0xc9')],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xc9')][_0xf49d('0x112')](db[_0xf49d('0xc9')],{'as':_0xf49d('0x1bd'),'foreignKey':_0xf49d('0x1be')});db['Dynamics365Field']['belongsTo'](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':'VariableId'});db[_0xf49d('0x1c9')][_0xf49d('0x112')](db['FreshsalesConfiguration'],{'as':_0xf49d('0x1b8'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xcc')][_0xf49d('0x112')](db[_0xf49d('0xcd')],{'as':_0xf49d('0x1ba'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xf49d('0x1c2'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xcc')]['hasMany'](db[_0xf49d('0xcd')],{'as':'Fields','foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xcc')]['belongsTo'](db['FreshsalesAccount'],{'as':_0xf49d('0x16d'),'foreignKey':_0xf49d('0x1b9')});db[_0xf49d('0xcd')]['hasMany'](db['FreshsalesField'],{'as':_0xf49d('0x1bc'),'foreignKey':_0xf49d('0x1c3')});db['FreshsalesField'][_0xf49d('0x112')](db['FreshsalesField'],{'as':_0xf49d('0x1c1'),'foreignKey':_0xf49d('0x1bb')});db[_0xf49d('0xcd')][_0xf49d('0x112')](db[_0xf49d('0xcd')],{'as':'Field','foreignKey':_0xf49d('0x1be')});db[_0xf49d('0xcd')]['belongsTo'](db[_0xf49d('0x1bf')],{'as':_0xf49d('0x1bf'),'foreignKey':_0xf49d('0x1c0')});db[_0xf49d('0xcf')]['belongsTo'](db['ChatWebsite'],{});db[_0xf49d('0xcf')][_0xf49d('0x11f')](db[_0xf49d('0xf7')],{'as':'List','foreignKey':_0xf49d('0x169')});db[_0xf49d('0xcf')][_0xf49d('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0xf49d('0x160')});db['ChatQueueReport'][_0xf49d('0x11f')](db['ChatInteraction'],{});db[_0xf49d('0xcf')][_0xf49d('0x11f')](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0xf49d('0x11')],{});db[_0xf49d('0xcf')][_0xf49d('0x11f')](db['ChatQueue'],{});db[_0xf49d('0x190')]['belongsTo'](db[_0xf49d('0x11')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xf49d('0x190')]['belongsTo'](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x110'),'foreignKey':'ToId'});db['JscriptySessionReport']['hasMany'](db[_0xf49d('0xd2')],{'foreignKey':_0xf49d('0x1ca'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0xd4')]['hasMany'](db[_0xf49d('0x1cb')],{'foreignKey':_0xf49d('0x1ca'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0xd6')][_0xf49d('0x11f')](db[_0xf49d('0x4c')],{});db[_0xf49d('0xd6')]['belongsTo'](db[_0xf49d('0xf7')],{'as':'List','foreignKey':_0xf49d('0x169')});db['SmsQueueReport'][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':'Contact','foreignKey':_0xf49d('0x160')});db[_0xf49d('0xd6')][_0xf49d('0x11f')](db[_0xf49d('0x12a')],{});db[_0xf49d('0xd6')]['belongsTo'](db['SmsMessage'],{});db[_0xf49d('0xd6')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{});db[_0xf49d('0xd6')][_0xf49d('0x11f')](db[_0xf49d('0x52')],{});db[_0xf49d('0xda')]['hasMany'](db[_0xf49d('0xd4')],{'foreignKey':_0xf49d('0x1cc')});db[_0xf49d('0xda')][_0xf49d('0x112')](db[_0xf49d('0xd2')],{'foreignKey':_0xf49d('0x1cc')});db[_0xf49d('0xda')]['hasMany'](db[_0xf49d('0x1cb')],{'foreignKey':_0xf49d('0x1cc')});db[_0xf49d('0xe0')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x171'),'through':_0xf49d('0x142')});db['Team'][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':'Agents','through':_0xf49d('0x1cd')});db[_0xf49d('0xe5')][_0xf49d('0x121')](db[_0xf49d('0x1a')],{'through':'team_has_voice_queues','as':_0xf49d('0x12d')});db[_0xf49d('0xe5')][_0xf49d('0x121')](db[_0xf49d('0x12f')],{'through':_0xf49d('0x16b'),'as':'MailQueues'});db['Team'][_0xf49d('0x121')](db['ChatQueue'],{'through':_0xf49d('0x18f'),'as':'ChatQueues'});db['Team'][_0xf49d('0x121')](db[_0xf49d('0x132')],{'through':_0xf49d('0x17f'),'as':_0xf49d('0x1ce')});db[_0xf49d('0xe5')][_0xf49d('0x121')](db[_0xf49d('0x52')],{'through':_0xf49d('0x1cf'),'as':_0xf49d('0x133')});db[_0xf49d('0xe5')][_0xf49d('0x121')](db[_0xf49d('0x135')],{'through':_0xf49d('0x188'),'as':_0xf49d('0x136')});db[_0xf49d('0xe5')]['belongsToMany'](db[_0xf49d('0x10a')],{'through':_0xf49d('0x1d0'),'as':_0xf49d('0x1d1')});db[_0xf49d('0x19a')]['hasMany'](db[_0xf49d('0x70')],{'as':'Hoppers','foreignKey':_0xf49d('0x19b')});db['Campaign'][_0xf49d('0x112')](db[_0xf49d('0x74')],{'as':_0xf49d('0x14a'),'foreignKey':_0xf49d('0x19b')});db[_0xf49d('0x19a')][_0xf49d('0x112')](db[_0xf49d('0x75')],{'as':_0xf49d('0x14b'),'foreignKey':_0xf49d('0x19b')});db[_0xf49d('0x19a')][_0xf49d('0x112')](db[_0xf49d('0x72')],{'as':_0xf49d('0x1d2'),'foreignKey':_0xf49d('0x19b')});db[_0xf49d('0x19a')][_0xf49d('0x11f')](db['Trunk'],{'as':'Trunk','foreignKey':_0xf49d('0x14e')});db[_0xf49d('0x19a')][_0xf49d('0x11f')](db[_0xf49d('0x14d')],{'as':_0xf49d('0x14f'),'foreignKey':_0xf49d('0x1d3')});db[_0xf49d('0x19a')]['belongsTo'](db[_0xf49d('0x82')],{'as':'Interval','foreignKey':_0xf49d('0x150')});db[_0xf49d('0x19a')][_0xf49d('0x11f')](db[_0xf49d('0xe0')],{'as':_0xf49d('0xe0'),'foreignKey':_0xf49d('0x1d4')});db['Campaign']['belongsToMany'](db[_0xf49d('0xf7')],{'as':_0xf49d('0x125'),'through':_0xf49d('0x1d5')});db['Campaign'][_0xf49d('0x121')](db[_0xf49d('0xf7')],{'as':'BlackLists','through':_0xf49d('0x1d6')});db[_0xf49d('0xed')][_0xf49d('0x11f')](db[_0xf49d('0x167')],{});db[_0xf49d('0xed')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0xf49d('0x11f')](db[_0xf49d('0x37')],{'foreignKey':_0xf49d('0x1d7'),'as':_0xf49d('0x1d8')});db[_0xf49d('0xed')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1d9'),'as':_0xf49d('0x1da')});db[_0xf49d('0xed')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1db'),'as':_0xf49d('0x1dc')});db[_0xf49d('0xed')][_0xf49d('0x11f')](db[_0xf49d('0x12f')],{'foreignKey':_0xf49d('0x1dd'),'as':'ToQueue'});db['MailTransferReport'][_0xf49d('0x11f')](db[_0xf49d('0x37')],{'foreignKey':'ToMailAccountId','as':_0xf49d('0x1de')});db['ChatTransferReport']['belongsTo'](db[_0xf49d('0x63')],{});db[_0xf49d('0xef')]['belongsTo'](db[_0xf49d('0x61')],{});db[_0xf49d('0xef')]['belongsTo'](db[_0xf49d('0x5c')],{'foreignKey':'FromChatWebsiteId','as':_0xf49d('0x1d8')});db[_0xf49d('0xef')][_0xf49d('0x11f')](db['User'],{'foreignKey':_0xf49d('0x1d9'),'as':_0xf49d('0x1da')});db[_0xf49d('0xef')]['belongsTo'](db['User'],{'foreignKey':_0xf49d('0x1db'),'as':_0xf49d('0x1dc')});db[_0xf49d('0xef')][_0xf49d('0x11f')](db[_0xf49d('0x67')],{'foreignKey':_0xf49d('0x1df'),'as':_0xf49d('0x1e0')});db[_0xf49d('0xef')][_0xf49d('0x11f')](db[_0xf49d('0x5c')],{'foreignKey':_0xf49d('0x1e1'),'as':_0xf49d('0x1de')});db[_0xf49d('0xf1')]['belongsTo'](db['FaxMessage'],{});db[_0xf49d('0xf1')]['belongsTo'](db[_0xf49d('0x119')],{});db[_0xf49d('0xf1')][_0xf49d('0x11f')](db[_0xf49d('0x44')],{'foreignKey':_0xf49d('0x1e2'),'as':'FromAccount'});db[_0xf49d('0xf1')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1d9'),'as':_0xf49d('0x1da')});db[_0xf49d('0xf1')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1db'),'as':'ToAgent'});db[_0xf49d('0xf1')][_0xf49d('0x11f')](db[_0xf49d('0x132')],{'foreignKey':_0xf49d('0x1e3'),'as':_0xf49d('0x1e0')});db[_0xf49d('0xf1')]['belongsTo'](db[_0xf49d('0x44')],{'foreignKey':_0xf49d('0x1e4'),'as':_0xf49d('0x1de')});db[_0xf49d('0xf3')][_0xf49d('0x11f')](db[_0xf49d('0x59')],{});db[_0xf49d('0xf3')][_0xf49d('0x11f')](db[_0xf49d('0x57')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xf49d('0x1e5'),'as':_0xf49d('0x1d8')});db[_0xf49d('0xf3')]['belongsTo'](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1d9'),'as':_0xf49d('0x1da')});db[_0xf49d('0xf3')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1db'),'as':_0xf49d('0x1dc')});db[_0xf49d('0xf3')][_0xf49d('0x11f')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xf49d('0x1e0')});db[_0xf49d('0xf3')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xf49d('0x1e6'),'as':_0xf49d('0x1de')});db[_0xf49d('0xf5')][_0xf49d('0x11f')](db[_0xf49d('0x50')],{});db[_0xf49d('0xf5')][_0xf49d('0x11f')](db[_0xf49d('0x12a')],{});db[_0xf49d('0xf5')][_0xf49d('0x11f')](db[_0xf49d('0x4c')],{'foreignKey':_0xf49d('0x1e7'),'as':_0xf49d('0x1d8')});db[_0xf49d('0xf5')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'foreignKey':_0xf49d('0x1d9'),'as':'FromAgent'});db[_0xf49d('0xf5')][_0xf49d('0x11f')](db['User'],{'foreignKey':_0xf49d('0x1db'),'as':_0xf49d('0x1dc')});db['SmsTransferReport'][_0xf49d('0x11f')](db[_0xf49d('0x52')],{'foreignKey':'ToSmsQueueId','as':_0xf49d('0x1e0')});db['SmsTransferReport']['belongsTo'](db[_0xf49d('0x4c')],{'foreignKey':_0xf49d('0x1e8'),'as':_0xf49d('0x1de')});db['CmList'][_0xf49d('0x112')](db[_0xf49d('0x7f')],{'as':_0xf49d('0x165'),'foreignKey':_0xf49d('0x169')});db[_0xf49d('0xf7')]['hasMany'](db[_0xf49d('0x79')],{'as':_0xf49d('0x1e9'),'foreignKey':_0xf49d('0x169')});db[_0xf49d('0xf7')][_0xf49d('0x112')](db[_0xf49d('0x6e')],{'as':_0xf49d('0x123'),'onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x169')});db[_0xf49d('0xf7')][_0xf49d('0x112')](db[_0xf49d('0x74')],{'as':_0xf49d('0x14a'),'foreignKey':'ListId'});db[_0xf49d('0xf7')][_0xf49d('0x112')](db[_0xf49d('0x75')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0xf49d('0xf7')][_0xf49d('0x112')](db[_0xf49d('0x77')],{'as':_0xf49d('0x77'),'foreignKey':'ListId'});db[_0xf49d('0xf7')][_0xf49d('0x121')](db[_0xf49d('0x1a')],{'as':'Queues','through':_0xf49d('0x1ea')});db[_0xf49d('0xf7')]['belongsToMany'](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x126')});db[_0xf49d('0xf9')][_0xf49d('0x112')](db[_0xf49d('0x143')],{'as':_0xf49d('0x115'),'onDelete':_0xf49d('0x110')});db[_0xf49d('0xf9')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x138')});db[_0xf49d('0xfb')]['hasMany'](db[_0xf49d('0x11')],{'as':'Users','foreignKey':_0xf49d('0x120')});db[_0xf49d('0xfb')][_0xf49d('0x112')](db[_0xf49d('0xfc')],{'as':_0xf49d('0x1eb'),'foreignKey':_0xf49d('0x120'),'onDelete':_0xf49d('0x110')});db['UserProfileSection']['hasMany'](db[_0xf49d('0xfd')],{'as':_0xf49d('0x1ec'),'foreignKey':'sectionId','onDelete':_0xf49d('0x110')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db[_0xf49d('0x100')]['hasMany'](db[_0xf49d('0x7d')],{'as':'Answers','foreignKey':_0xf49d('0x1ed')});db[_0xf49d('0x100')][_0xf49d('0x112')](db['WhatsappMessage'],{'as':_0xf49d('0x157'),'foreignKey':_0xf49d('0x1ed')});db[_0xf49d('0x100')]['hasMany'](db[_0xf49d('0x104')],{'as':_0xf49d('0x178')});db[_0xf49d('0x100')][_0xf49d('0x112')](db[_0xf49d('0x102')],{'as':_0xf49d('0x179')});db[_0xf49d('0x100')][_0xf49d('0x11f')](db['CmList'],{'as':'List','foreignKey':_0xf49d('0x169')});db[_0xf49d('0x100')]['belongsTo'](db['Pause'],{'as':_0xf49d('0x151'),'foreignKey':_0xf49d('0x152')});db[_0xf49d('0x100')][_0xf49d('0x121')](db[_0xf49d('0x11')],{'as':_0xf49d('0x153'),'through':_0xf49d('0x1ee')});db[_0xf49d('0x102')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x102')][_0xf49d('0x11f')](db['WhatsappQueue'],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x102')][_0xf49d('0x11f')](db['WhatsappAccount'],{'onDelete':_0xf49d('0x174')});db[_0xf49d('0x102')]['belongsTo'](db[_0xf49d('0x82')],{'onDelete':_0xf49d('0x174'),'foreignKey':_0xf49d('0x150')});db[_0xf49d('0x102')][_0xf49d('0x11f')](db[_0xf49d('0x16e')],{'onDelete':'restrict','foreignKey':_0xf49d('0x175')});db[_0xf49d('0x104')][_0xf49d('0x112')](db[_0xf49d('0x105')],{'as':'Messages','onDelete':_0xf49d('0x110'),'foreignKey':_0xf49d('0x1ef')});db[_0xf49d('0x104')][_0xf49d('0x11f')](db[_0xf49d('0x100')],{'as':'Account','foreignKey':_0xf49d('0x1ed')});db[_0xf49d('0x104')][_0xf49d('0x11f')](db[_0xf49d('0x6e')],{'as':'Contact','foreignKey':_0xf49d('0x160')});db[_0xf49d('0x104')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':_0xf49d('0x17b'),'foreignKey':_0xf49d('0x111')});db['WhatsappInteraction'][_0xf49d('0x121')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xf49d('0x104')][_0xf49d('0x121')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xf49d('0x104')][_0xf49d('0x121')](db['User'],{'as':'Users','through':_0xf49d('0x1f0'),'foreignKey':_0xf49d('0x1ef')});db[_0xf49d('0x105')][_0xf49d('0x11f')](db[_0xf49d('0x11')],{'as':'User'});db[_0xf49d('0x105')][_0xf49d('0x11f')](db['CmContact'],{'onDelete':_0xf49d('0x110'),'as':_0xf49d('0x15f')});db[_0xf49d('0x105')][_0xf49d('0x11f')](db[_0xf49d('0x104')],{'onDelete':_0xf49d('0x110'),'as':'Interaction','foreignKey':_0xf49d('0x1ef')});db[_0xf49d('0x105')][_0xf49d('0x11f')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xf49d('0x1ed')});db[_0xf49d('0x1f1')][_0xf49d('0x11f')](db[_0xf49d('0x100')],{});db[_0xf49d('0x1f1')][_0xf49d('0x11f')](db['CmList'],{'as':'List','foreignKey':_0xf49d('0x169')});db[_0xf49d('0x1f1')][_0xf49d('0x11f')](db['CmContact'],{'as':_0xf49d('0x15f'),'foreignKey':_0xf49d('0x160')});db['WhatsappQueueReport'][_0xf49d('0x11f')](db[_0xf49d('0x104')],{});db[_0xf49d('0x1f1')]['belongsTo'](db[_0xf49d('0x10a')],{});db[_0xf49d('0x1f1')][_0xf49d('0x11f')](db[_0xf49d('0x105')],{});db[_0xf49d('0x1f1')]['belongsTo'](db[_0xf49d('0x11')],{});db[_0xf49d('0x108')][_0xf49d('0x11f')](db[_0xf49d('0x105')],{});db[_0xf49d('0x108')][_0xf49d('0x11f')](db[_0xf49d('0x104')],{});db[_0xf49d('0x108')][_0xf49d('0x11f')](db['WhatsappAccount'],{'foreignKey':_0xf49d('0x1f2'),'as':_0xf49d('0x1d8')});db[_0xf49d('0x108')][_0xf49d('0x11f')](db[_0xf49d('0x100')],{'foreignKey':_0xf49d('0x1f3'),'as':_0xf49d('0x1de')});db['WhatsappTransferReport'][_0xf49d('0x11f')](db[_0xf49d('0x10a')],{'foreignKey':'ToQueueId','as':_0xf49d('0x1e0')});db[_0xf49d('0x108')][_0xf49d('0x11f')](db['User'],{'foreignKey':_0xf49d('0x1d9'),'as':'FromAgent'});db[_0xf49d('0x108')][_0xf49d('0x11f')](db['User'],{'foreignKey':_0xf49d('0x1db'),'as':_0xf49d('0x1dc')});db[_0xf49d('0x10a')]['belongsToMany'](db['User'],{'as':_0xf49d('0x153'),'through':_0xf49d('0x32'),'foreignKey':_0xf49d('0x1f4')});db[_0xf49d('0x10a')][_0xf49d('0x121')](db[_0xf49d('0xe5')],{'through':_0xf49d('0x1d0'),'as':_0xf49d('0x154')});module[_0xf49d('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e150b50..4425e7c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f36=['api','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','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','agent_id','agent_name','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/interactions','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','static','root','join','/www','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','get','sendFile','resolve','appPath','path','express','express-winston','./errors','./config/environment','./config/logger'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x7f36,0x103));var _0x67f3=function(_0x192c9b,_0x45f704){_0x192c9b=_0x192c9b-0x0;var _0x1a33e9=_0x7f36[_0x192c9b];return _0x1a33e9;};'use strict';var path=require(_0x67f3('0x0'));var express=require(_0x67f3('0x1'));var ewinston=require(_0x67f3('0x2'));var util=require('util');var errors=require(_0x67f3('0x3'));var config=require(_0x67f3('0x4'));var logger=require(_0x67f3('0x5'))(_0x67f3('0x6'));var authLogger=require(_0x67f3('0x5'))('auth');exports[_0x67f3('0x7')]=function(_0x4cc94e){_0x4cc94e[_0x67f3('0x8')](ewinston[_0x67f3('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x49bcbd,_0xbab1fc){return util[_0x67f3('0xa')](_0x67f3('0xb'),_0x49bcbd[_0x67f3('0xc')],_0x49bcbd[_0x67f3('0xd')][_0x67f3('0xe')]?_0x49bcbd['headers'][_0x67f3('0xe')]:_0x49bcbd[_0x67f3('0xf')][_0x67f3('0x10')]||_0x49bcbd['ip'],_0x49bcbd[_0x67f3('0x11')],_0xbab1fc[_0x67f3('0x12')],_0xbab1fc['responseTime'],_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd['user']['id']:null,_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd[_0x67f3('0x13')]['name']:null,_0x49bcbd[_0x67f3('0x13')]?_0x49bcbd[_0x67f3('0x13')][_0x67f3('0x14')]:null);}}));_0x4cc94e[_0x67f3('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x594564,_0x238f2d){var _0x1b0578=_0x67f3('0x15');if(_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]&&_0x594564[_0x67f3('0x16')]['agent_id']){_0x1b0578=_0x67f3('0x18');}return util[_0x67f3('0xa')](_0x1b0578,_0x594564['method'],_0x594564[_0x67f3('0xd')][_0x67f3('0xe')]?_0x594564[_0x67f3('0xd')][_0x67f3('0xe')]:_0x594564[_0x67f3('0xf')][_0x67f3('0x10')]||_0x594564['ip'],_0x594564[_0x67f3('0x11')],_0x238f2d[_0x67f3('0x12')],_0x238f2d['responseTime'],_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')]['id']:null,_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')][_0x67f3('0x19')]:null,_0x594564[_0x67f3('0x13')]?_0x594564[_0x67f3('0x13')][_0x67f3('0x14')]:null,_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]?_0x594564[_0x67f3('0x16')][_0x67f3('0x17')]:'other',_0x594564[_0x67f3('0x16')]&&_0x594564['body'][_0x67f3('0x1a')]?_0x594564[_0x67f3('0x16')][_0x67f3('0x1a')]:'',_0x594564[_0x67f3('0x16')]&&_0x594564[_0x67f3('0x16')][_0x67f3('0x1b')]?_0x594564[_0x67f3('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x2f8b1d){var _0x1a160a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a160a['test'](_0x2f8b1d[_0x67f3('0x11')]);}}));_0x4cc94e[_0x67f3('0x8')]('/api/users',require('./api/user'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x1c'),require('./api/voiceChanSpy'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x1d'),require(_0x67f3('0x1e')));_0x4cc94e['use']('/api/voice/extensions',require(_0x67f3('0x1f')));_0x4cc94e[_0x67f3('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x20'),require(_0x67f3('0x21')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x22'),require(_0x67f3('0x23')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x24'),require(_0x67f3('0x25')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x26'),require('./api/voiceMail'));_0x4cc94e['use'](_0x67f3('0x27'),require(_0x67f3('0x28')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x29'),require('./api/voiceCallReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2a'),require('./api/voiceDialReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2b'),require('./api/voiceAgentReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x2c'),require(_0x67f3('0x2d')));_0x4cc94e[_0x67f3('0x8')]('/api/members/reports',require(_0x67f3('0x2e')));_0x4cc94e['use']('/api/trunks',require(_0x67f3('0x2f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x30'),require(_0x67f3('0x31')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x32'),require(_0x67f3('0x33')));_0x4cc94e[_0x67f3('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x34'),require(_0x67f3('0x35')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x36'),require(_0x67f3('0x37')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x38'),require('./api/mailInteraction'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x39'),require('./api/mailMessage'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x3a'),require('./api/mailApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x3b'),require(_0x67f3('0x3c')));_0x4cc94e['use'](_0x67f3('0x3d'),require(_0x67f3('0x3e')));_0x4cc94e[_0x67f3('0x8')]('/api/dashboards/items',require(_0x67f3('0x3f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x40'),require(_0x67f3('0x41')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x42'),require(_0x67f3('0x43')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x44'),require(_0x67f3('0x45')));_0x4cc94e[_0x67f3('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x4cc94e[_0x67f3('0x8')]('/api/fax/queues',require(_0x67f3('0x46')));_0x4cc94e['use'](_0x67f3('0x47'),require(_0x67f3('0x48')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x49'),require(_0x67f3('0x4a')));_0x4cc94e[_0x67f3('0x8')]('/api/sms/applications',require(_0x67f3('0x4b')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x4c'),require(_0x67f3('0x4d')));_0x4cc94e['use'](_0x67f3('0x4e'),require(_0x67f3('0x4f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x50'),require(_0x67f3('0x51')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x52'),require('./api/openchannelAccount'));_0x4cc94e['use'](_0x67f3('0x53'),require('./api/openchannelApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x54'),require('./api/openchannelInteraction'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x55'),require(_0x67f3('0x56')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x57'),require(_0x67f3('0x58')));_0x4cc94e['use'](_0x67f3('0x59'),require(_0x67f3('0x5a')));_0x4cc94e[_0x67f3('0x8')]('/api/openchannel/reports/queue',require(_0x67f3('0x5b')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x5c'),require('./api/chatInteraction'));_0x4cc94e[_0x67f3('0x8')]('/api/chat/messages',require(_0x67f3('0x5d')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x4cc94e['use'](_0x67f3('0x5e'),require(_0x67f3('0x5f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x60'),require(_0x67f3('0x61')));_0x4cc94e['use'](_0x67f3('0x62'),require(_0x67f3('0x63')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/companies',require(_0x67f3('0x64')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/contacts',require(_0x67f3('0x65')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x4cc94e['use'](_0x67f3('0x66'),require(_0x67f3('0x67')));_0x4cc94e['use'](_0x67f3('0x68'),require('./api/cmHopperFinal'));_0x4cc94e[_0x67f3('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x4cc94e[_0x67f3('0x8')]('/api/cm/custom_fields',require(_0x67f3('0x69')));_0x4cc94e[_0x67f3('0x8')]('/api/actions',require(_0x67f3('0x6a')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x6b'),require(_0x67f3('0x6c')));_0x4cc94e[_0x67f3('0x8')]('/api/canned_answers',require(_0x67f3('0x6d')));_0x4cc94e['use']('/api/dispositions',require(_0x67f3('0x6e')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x6f'),require('./api/condition'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x70'),require(_0x67f3('0x71')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x72'),require(_0x67f3('0x73')));_0x4cc94e[_0x67f3('0x8')]('/api/cdr',require('./api/cdr'));_0x4cc94e[_0x67f3('0x8')]('/api/voiceQueuesLog',require(_0x67f3('0x74')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x75'),require(_0x67f3('0x76')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x77'),require('./api/sound'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x78'),require(_0x67f3('0x79')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7a'),require(_0x67f3('0x7b')));_0x4cc94e[_0x67f3('0x8')]('/api/triggers',require(_0x67f3('0x7c')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7d'),require(_0x67f3('0x7e')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x7f'),require(_0x67f3('0x80')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/reports',require(_0x67f3('0x81')));_0x4cc94e['use'](_0x67f3('0x82'),require('./api/analyticCustomReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x83'),require(_0x67f3('0x84')));_0x4cc94e[_0x67f3('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x4cc94e['use']('/api/analytics/metrics',require(_0x67f3('0x85')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x86'),require('./api/analyticFieldReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x87'),require(_0x67f3('0x88')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x89'),require(_0x67f3('0x8a')));_0x4cc94e['use']('/api/integrations/salesforce/configurations',require(_0x67f3('0x8b')));_0x4cc94e['use'](_0x67f3('0x8c'),require(_0x67f3('0x8d')));_0x4cc94e['use'](_0x67f3('0x8e'),require(_0x67f3('0x8f')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x90'),require(_0x67f3('0x91')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x92'),require(_0x67f3('0x93')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/desk/accounts',require(_0x67f3('0x94')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x95'),require('./api/intDeskField'));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/accounts',require(_0x67f3('0x96')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/configurations',require(_0x67f3('0x97')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x98'),require(_0x67f3('0x99')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9a'),require(_0x67f3('0x9b')));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/zendesk/fields',require(_0x67f3('0x9c')));_0x4cc94e['use'](_0x67f3('0x9d'),require('./api/intFreshdeskAccount'));_0x4cc94e['use']('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9e'),require('./api/intFreshdeskField'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x9f'),require(_0x67f3('0xa0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa1'),require(_0x67f3('0xa2')));_0x4cc94e['use'](_0x67f3('0xa3'),require(_0x67f3('0xa4')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa5'),require(_0x67f3('0xa6')));_0x4cc94e['use'](_0x67f3('0xa7'),require('./api/intServicenowConfiguration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xa8'),require(_0x67f3('0xa9')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xaa'),require(_0x67f3('0xab')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xac'),require('./api/intDynamics365Configuration'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xad'),require(_0x67f3('0xae')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xaf'),require('./api/intFreshsalesAccount'));_0x4cc94e[_0x67f3('0x8')]('/api/integrations/freshsales/configurations',require(_0x67f3('0xb0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb1'),require(_0x67f3('0xb2')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb3'),require(_0x67f3('0xb4')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb5'),require(_0x67f3('0xb6')));_0x4cc94e[_0x67f3('0x8')]('/api/chat/internal/messages',require(_0x67f3('0xb7')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xb8'),require(_0x67f3('0xb9')));_0x4cc94e[_0x67f3('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xba'),require(_0x67f3('0xbb')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xbc'),require(_0x67f3('0xbd')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xbe'),require(_0x67f3('0xbf')));_0x4cc94e['use']('/api/square/details/reports',require(_0x67f3('0xc0')));_0x4cc94e['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc1'),require(_0x67f3('0xc2')));_0x4cc94e[_0x67f3('0x8')]('/api/square/odbc',require(_0x67f3('0xc3')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc4'),require(_0x67f3('0xc5')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc6'),require('./api/squareRecording'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc7'),require(_0x67f3('0xc8')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xc9'),require(_0x67f3('0xca')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xcb'),require(_0x67f3('0xcc')));_0x4cc94e[_0x67f3('0x8')]('/api/campaigns',require(_0x67f3('0xcd')));_0x4cc94e['use'](_0x67f3('0xce'),require('./api/migration'));_0x4cc94e[_0x67f3('0x8')]('/api/attachments',require(_0x67f3('0xcf')));_0x4cc94e['use']('/api/plugins',require(_0x67f3('0xd0')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd1'),require(_0x67f3('0xd2')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd3'),require(_0x67f3('0xd4')));_0x4cc94e['use'](_0x67f3('0xd5'),require(_0x67f3('0xd6')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd7'),require(_0x67f3('0xd8')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xd9'),require(_0x67f3('0xda')));_0x4cc94e[_0x67f3('0x8')]('/api/cm/lists',require(_0x67f3('0xdb')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xdc'),require('./api/voicePrefix'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xdd'),require(_0x67f3('0xde')));_0x4cc94e['use']('/api/userProfile/sections',require(_0x67f3('0xdf')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe0'),require(_0x67f3('0xe1')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe2'),require(_0x67f3('0xe3')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe4'),require(_0x67f3('0xe5')));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe6'),require(_0x67f3('0xe7')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xe8'),require(_0x67f3('0xe9')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xea'),require('./api/whatsappQueueReport'));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/reports/transfer',require(_0x67f3('0xeb')));_0x4cc94e[_0x67f3('0x8')]('/api/whatsapp/queues',require(_0x67f3('0xec')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xed'),require(_0x67f3('0xee')));_0x4cc94e[_0x67f3('0x8')]('/api/auth/local',require('./api/authLocal'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xef'),require('./api/authGoogle'));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf0'),require(_0x67f3('0xf1')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf2'),require(_0x67f3('0xf3')));_0x4cc94e['use'](_0x67f3('0xf4'),require(_0x67f3('0xf5')));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xf6'),require(_0x67f3('0xf7')));_0x4cc94e['use'](_0x67f3('0xf8'),require(_0x67f3('0xf9')));_0x4cc94e[_0x67f3('0x8')]('/api/webbar',require(_0x67f3('0xfa')));_0x4cc94e['use']('/apidoc',express[_0x67f3('0xfb')](path['join'](config[_0x67f3('0xfc')],'/apidoc')));_0x4cc94e[_0x67f3('0x8')]('/www',express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0xfe'))));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0xff'),express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0xff'))));_0x4cc94e[_0x67f3('0x8')](_0x67f3('0x100'),express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config[_0x67f3('0xfc')],_0x67f3('0x101'),_0x67f3('0x102'))));_0x4cc94e[_0x67f3('0x8')]('/plugins',express[_0x67f3('0xfb')](path[_0x67f3('0xfd')](config['root'],_0x67f3('0x103'))));_0x4cc94e[_0x67f3('0x104')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x67f3('0x105')](errors[0x194]);_0x4cc94e[_0x67f3('0x104')]('/*')[_0x67f3('0x105')](function(_0x1a097f,_0x4d8717){_0x4d8717[_0x67f3('0x106')](path[_0x67f3('0x107')](_0x4cc94e[_0x67f3('0x105')](_0x67f3('0x108'))+'/index.html'));});}; \ No newline at end of file +var _0x0499=['static','join','root','/www','/demo','/snippet','snippet','1.0.16','/server/files/plugins','get','sendFile','appPath','path','express-winston','util','./errors','./config/environment','api','./config/logger','auth','use','logger','format','x-forwarded-for','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','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','headers','connection','other','agent_name','test','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','/api/pauses','/api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/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/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','./api/webbar','/apidoc'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0499,0x127));var _0x9049=function(_0x520c84,_0x52bd96){_0x520c84=_0x520c84-0x0;var _0x13e925=_0x0499[_0x520c84];return _0x13e925;};'use strict';var path=require(_0x9049('0x0'));var express=require('express');var ewinston=require(_0x9049('0x1'));var util=require(_0x9049('0x2'));var errors=require(_0x9049('0x3'));var config=require(_0x9049('0x4'));var logger=require('./config/logger')(_0x9049('0x5'));var authLogger=require(_0x9049('0x6'))(_0x9049('0x7'));exports['default']=function(_0x29f430){_0x29f430[_0x9049('0x8')](ewinston[_0x9049('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x50ce54,_0x59b844){return util[_0x9049('0xa')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x50ce54['method'],_0x50ce54['headers'][_0x9049('0xb')]?_0x50ce54['headers'][_0x9049('0xb')]:_0x50ce54['connection'][_0x9049('0xc')]||_0x50ce54['ip'],_0x50ce54[_0x9049('0xd')],_0x59b844[_0x9049('0xe')],_0x59b844[_0x9049('0xf')],_0x50ce54[_0x9049('0x10')]?_0x50ce54['user']['id']:null,_0x50ce54[_0x9049('0x10')]?_0x50ce54['user']['name']:null,_0x50ce54[_0x9049('0x10')]?_0x50ce54[_0x9049('0x10')][_0x9049('0x11')]:null);}}));_0x29f430[_0x9049('0x8')](ewinston[_0x9049('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2d7aa5,_0xb07469){var _0x2bbc1c=_0x9049('0x12');if(_0x2d7aa5['body']&&_0x2d7aa5[_0x9049('0x13')][_0x9049('0x14')]&&_0x2d7aa5[_0x9049('0x13')][_0x9049('0x15')]){_0x2bbc1c=_0x9049('0x16');}return util[_0x9049('0xa')](_0x2bbc1c,_0x2d7aa5[_0x9049('0x17')],_0x2d7aa5['headers']['x-forwarded-for']?_0x2d7aa5[_0x9049('0x18')][_0x9049('0xb')]:_0x2d7aa5[_0x9049('0x19')][_0x9049('0xc')]||_0x2d7aa5['ip'],_0x2d7aa5[_0x9049('0xd')],_0xb07469['statusCode'],_0xb07469[_0x9049('0xf')],_0x2d7aa5[_0x9049('0x10')]?_0x2d7aa5[_0x9049('0x10')]['id']:null,_0x2d7aa5[_0x9049('0x10')]?_0x2d7aa5['user']['name']:null,_0x2d7aa5[_0x9049('0x10')]?_0x2d7aa5['user']['role']:null,_0x2d7aa5[_0x9049('0x13')]&&_0x2d7aa5[_0x9049('0x13')][_0x9049('0x14')]?_0x2d7aa5[_0x9049('0x13')][_0x9049('0x14')]:_0x9049('0x1a'),_0x2d7aa5[_0x9049('0x13')]&&_0x2d7aa5['body'][_0x9049('0x15')]?_0x2d7aa5[_0x9049('0x13')][_0x9049('0x15')]:'',_0x2d7aa5[_0x9049('0x13')]&&_0x2d7aa5['body'][_0x9049('0x1b')]?_0x2d7aa5[_0x9049('0x13')][_0x9049('0x1b')]:'');},'ignoreRoute':function(_0xf1d644){var _0x54d4d3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x54d4d3[_0x9049('0x1c')](_0xf1d644[_0x9049('0xd')]);}}));_0x29f430[_0x9049('0x8')](_0x9049('0x1d'),require('./api/user'));_0x29f430[_0x9049('0x8')]('/api/voice/chanspy',require(_0x9049('0x1e')));_0x29f430['use'](_0x9049('0x1f'),require(_0x9049('0x20')));_0x29f430[_0x9049('0x8')](_0x9049('0x21'),require(_0x9049('0x22')));_0x29f430[_0x9049('0x8')](_0x9049('0x23'),require(_0x9049('0x24')));_0x29f430[_0x9049('0x8')](_0x9049('0x25'),require('./api/voiceQueue'));_0x29f430[_0x9049('0x8')](_0x9049('0x26'),require('./api/voiceRecording'));_0x29f430[_0x9049('0x8')]('/api/screen/recordings',require(_0x9049('0x27')));_0x29f430[_0x9049('0x8')](_0x9049('0x28'),require(_0x9049('0x29')));_0x29f430[_0x9049('0x8')](_0x9049('0x2a'),require(_0x9049('0x2b')));_0x29f430[_0x9049('0x8')](_0x9049('0x2c'),require('./api/voiceCallReport'));_0x29f430[_0x9049('0x8')](_0x9049('0x2d'),require(_0x9049('0x2e')));_0x29f430['use'](_0x9049('0x2f'),require('./api/voiceAgentReport'));_0x29f430[_0x9049('0x8')]('/api/voice/queues/reports',require(_0x9049('0x30')));_0x29f430[_0x9049('0x8')](_0x9049('0x31'),require(_0x9049('0x32')));_0x29f430[_0x9049('0x8')]('/api/trunks',require('./api/trunk'));_0x29f430[_0x9049('0x8')](_0x9049('0x33'),require(_0x9049('0x34')));_0x29f430[_0x9049('0x8')](_0x9049('0x35'),require('./api/mailServerOut'));_0x29f430[_0x9049('0x8')](_0x9049('0x36'),require(_0x9049('0x37')));_0x29f430['use']('/api/mail/queues',require(_0x9049('0x38')));_0x29f430[_0x9049('0x8')](_0x9049('0x39'),require(_0x9049('0x3a')));_0x29f430['use'](_0x9049('0x3b'),require(_0x9049('0x3c')));_0x29f430[_0x9049('0x8')](_0x9049('0x3d'),require(_0x9049('0x3e')));_0x29f430[_0x9049('0x8')]('/api/mail/applications',require(_0x9049('0x3f')));_0x29f430[_0x9049('0x8')](_0x9049('0x40'),require(_0x9049('0x41')));_0x29f430[_0x9049('0x8')]('/api/dashboards',require('./api/dashboard'));_0x29f430['use'](_0x9049('0x42'),require(_0x9049('0x43')));_0x29f430[_0x9049('0x8')](_0x9049('0x44'),require(_0x9049('0x45')));_0x29f430[_0x9049('0x8')]('/api/fax/applications',require(_0x9049('0x46')));_0x29f430[_0x9049('0x8')]('/api/fax/interactions',require('./api/faxInteraction'));_0x29f430[_0x9049('0x8')](_0x9049('0x47'),require(_0x9049('0x48')));_0x29f430['use']('/api/fax/queues',require(_0x9049('0x49')));_0x29f430['use'](_0x9049('0x4a'),require('./api/faxQueueReport'));_0x29f430[_0x9049('0x8')](_0x9049('0x4b'),require(_0x9049('0x4c')));_0x29f430[_0x9049('0x8')](_0x9049('0x4d'),require(_0x9049('0x4e')));_0x29f430[_0x9049('0x8')](_0x9049('0x4f'),require(_0x9049('0x50')));_0x29f430[_0x9049('0x8')](_0x9049('0x51'),require(_0x9049('0x52')));_0x29f430['use'](_0x9049('0x53'),require(_0x9049('0x54')));_0x29f430[_0x9049('0x8')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x29f430[_0x9049('0x8')](_0x9049('0x55'),require('./api/openchannelApplication'));_0x29f430['use'](_0x9049('0x56'),require(_0x9049('0x57')));_0x29f430['use'](_0x9049('0x58'),require(_0x9049('0x59')));_0x29f430[_0x9049('0x8')](_0x9049('0x5a'),require(_0x9049('0x5b')));_0x29f430[_0x9049('0x8')]('/api/chat/websites',require(_0x9049('0x5c')));_0x29f430[_0x9049('0x8')](_0x9049('0x5d'),require('./api/openchannelQueueReport'));_0x29f430[_0x9049('0x8')](_0x9049('0x5e'),require(_0x9049('0x5f')));_0x29f430[_0x9049('0x8')](_0x9049('0x60'),require('./api/chatInteraction'));_0x29f430[_0x9049('0x8')](_0x9049('0x61'),require('./api/chatMessage'));_0x29f430[_0x9049('0x8')](_0x9049('0x62'),require(_0x9049('0x63')));_0x29f430[_0x9049('0x8')](_0x9049('0x64'),require('./api/chatQueue'));_0x29f430['use'](_0x9049('0x65'),require(_0x9049('0x66')));_0x29f430[_0x9049('0x8')](_0x9049('0x67'),require('./api/chatProactiveAction'));_0x29f430['use'](_0x9049('0x68'),require('./api/cmCompany'));_0x29f430['use'](_0x9049('0x69'),require('./api/cmContact'));_0x29f430[_0x9049('0x8')](_0x9049('0x6a'),require('./api/cmHopper'));_0x29f430['use'](_0x9049('0x6b'),require(_0x9049('0x6c')));_0x29f430[_0x9049('0x8')](_0x9049('0x6d'),require(_0x9049('0x6e')));_0x29f430[_0x9049('0x8')](_0x9049('0x6f'),require(_0x9049('0x70')));_0x29f430[_0x9049('0x8')](_0x9049('0x71'),require(_0x9049('0x72')));_0x29f430['use'](_0x9049('0x73'),require(_0x9049('0x74')));_0x29f430['use'](_0x9049('0x75'),require(_0x9049('0x76')));_0x29f430['use'](_0x9049('0x77'),require(_0x9049('0x78')));_0x29f430['use'](_0x9049('0x79'),require(_0x9049('0x7a')));_0x29f430[_0x9049('0x8')]('/api/conditions',require('./api/condition'));_0x29f430[_0x9049('0x8')](_0x9049('0x7b'),require('./api/interval'));_0x29f430['use'](_0x9049('0x7c'),require('./api/pause'));_0x29f430[_0x9049('0x8')](_0x9049('0x7d'),require('./api/cdr'));_0x29f430[_0x9049('0x8')]('/api/voiceQueuesLog',require(_0x9049('0x7e')));_0x29f430['use'](_0x9049('0x7f'),require(_0x9049('0x80')));_0x29f430[_0x9049('0x8')]('/api/sounds',require(_0x9049('0x81')));_0x29f430[_0x9049('0x8')](_0x9049('0x82'),require(_0x9049('0x83')));_0x29f430['use'](_0x9049('0x84'),require('./api/template'));_0x29f430[_0x9049('0x8')](_0x9049('0x85'),require(_0x9049('0x86')));_0x29f430['use'](_0x9049('0x87'),require(_0x9049('0x88')));_0x29f430[_0x9049('0x8')](_0x9049('0x89'),require(_0x9049('0x8a')));_0x29f430[_0x9049('0x8')]('/api/integrations/reports',require(_0x9049('0x8b')));_0x29f430['use'](_0x9049('0x8c'),require('./api/analyticCustomReport'));_0x29f430[_0x9049('0x8')](_0x9049('0x8d'),require(_0x9049('0x8e')));_0x29f430[_0x9049('0x8')](_0x9049('0x8f'),require(_0x9049('0x90')));_0x29f430['use']('/api/analytics/metrics',require(_0x9049('0x91')));_0x29f430[_0x9049('0x8')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x29f430['use'](_0x9049('0x92'),require(_0x9049('0x93')));_0x29f430['use'](_0x9049('0x94'),require(_0x9049('0x95')));_0x29f430[_0x9049('0x8')](_0x9049('0x96'),require(_0x9049('0x97')));_0x29f430['use'](_0x9049('0x98'),require(_0x9049('0x99')));_0x29f430[_0x9049('0x8')](_0x9049('0x9a'),require('./api/intSugarcrmAccount'));_0x29f430[_0x9049('0x8')](_0x9049('0x9b'),require(_0x9049('0x9c')));_0x29f430[_0x9049('0x8')](_0x9049('0x9d'),require(_0x9049('0x9e')));_0x29f430[_0x9049('0x8')](_0x9049('0x9f'),require(_0x9049('0xa0')));_0x29f430['use']('/api/integrations/desk/configurations',require(_0x9049('0xa1')));_0x29f430['use'](_0x9049('0xa2'),require(_0x9049('0xa3')));_0x29f430['use'](_0x9049('0xa4'),require(_0x9049('0xa5')));_0x29f430[_0x9049('0x8')](_0x9049('0xa6'),require(_0x9049('0xa7')));_0x29f430[_0x9049('0x8')](_0x9049('0xa8'),require('./api/intZohoField'));_0x29f430['use']('/api/integrations/zendesk/accounts',require(_0x9049('0xa9')));_0x29f430['use'](_0x9049('0xaa'),require('./api/intZendeskConfiguration'));_0x29f430['use'](_0x9049('0xab'),require(_0x9049('0xac')));_0x29f430[_0x9049('0x8')]('/api/integrations/freshdesk/accounts',require(_0x9049('0xad')));_0x29f430[_0x9049('0x8')](_0x9049('0xae'),require('./api/intFreshdeskConfiguration'));_0x29f430[_0x9049('0x8')](_0x9049('0xaf'),require('./api/intFreshdeskField'));_0x29f430[_0x9049('0x8')](_0x9049('0xb0'),require(_0x9049('0xb1')));_0x29f430[_0x9049('0x8')](_0x9049('0xb2'),require(_0x9049('0xb3')));_0x29f430['use'](_0x9049('0xb4'),require(_0x9049('0xb5')));_0x29f430[_0x9049('0x8')](_0x9049('0xb6'),require(_0x9049('0xb7')));_0x29f430[_0x9049('0x8')](_0x9049('0xb8'),require(_0x9049('0xb9')));_0x29f430[_0x9049('0x8')](_0x9049('0xba'),require(_0x9049('0xbb')));_0x29f430[_0x9049('0x8')](_0x9049('0xbc'),require('./api/intDynamics365Account'));_0x29f430[_0x9049('0x8')]('/api/integrations/dynamics365/configurations',require(_0x9049('0xbd')));_0x29f430[_0x9049('0x8')](_0x9049('0xbe'),require(_0x9049('0xbf')));_0x29f430[_0x9049('0x8')](_0x9049('0xc0'),require('./api/intFreshsalesAccount'));_0x29f430[_0x9049('0x8')]('/api/integrations/freshsales/configurations',require(_0x9049('0xc1')));_0x29f430[_0x9049('0x8')](_0x9049('0xc2'),require(_0x9049('0xc3')));_0x29f430['use'](_0x9049('0xc4'),require('./api/network'));_0x29f430[_0x9049('0x8')](_0x9049('0xc5'),require(_0x9049('0xc6')));_0x29f430[_0x9049('0x8')](_0x9049('0xc7'),require(_0x9049('0xc8')));_0x29f430[_0x9049('0x8')](_0x9049('0xc9'),require(_0x9049('0xca')));_0x29f430['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x29f430[_0x9049('0x8')]('/api/jscripty/sessions/reports',require(_0x9049('0xcb')));_0x29f430['use'](_0x9049('0xcc'),require(_0x9049('0xcd')));_0x29f430[_0x9049('0x8')]('/api/square/reports',require(_0x9049('0xce')));_0x29f430['use'](_0x9049('0xcf'),require(_0x9049('0xd0')));_0x29f430[_0x9049('0x8')]('/api/jscripty/projects',require(_0x9049('0xd1')));_0x29f430['use'](_0x9049('0xd2'),require('./api/setting'));_0x29f430[_0x9049('0x8')](_0x9049('0xd3'),require(_0x9049('0xd4')));_0x29f430[_0x9049('0x8')](_0x9049('0xd5'),require(_0x9049('0xd6')));_0x29f430[_0x9049('0x8')](_0x9049('0xd7'),require(_0x9049('0xd8')));_0x29f430['use'](_0x9049('0xd9'),require(_0x9049('0xda')));_0x29f430[_0x9049('0x8')](_0x9049('0xdb'),require(_0x9049('0xdc')));_0x29f430[_0x9049('0x8')]('/api/license',require('./api/license'));_0x29f430[_0x9049('0x8')](_0x9049('0xdd'),require(_0x9049('0xde')));_0x29f430['use'](_0x9049('0xdf'),require('./api/migration'));_0x29f430[_0x9049('0x8')]('/api/attachments',require(_0x9049('0xe0')));_0x29f430['use']('/api/plugins',require(_0x9049('0xe1')));_0x29f430[_0x9049('0x8')](_0x9049('0xe2'),require(_0x9049('0xe3')));_0x29f430[_0x9049('0x8')](_0x9049('0xe4'),require('./api/chatTransferReport'));_0x29f430[_0x9049('0x8')](_0x9049('0xe5'),require(_0x9049('0xe6')));_0x29f430[_0x9049('0x8')](_0x9049('0xe7'),require(_0x9049('0xe8')));_0x29f430[_0x9049('0x8')](_0x9049('0xe9'),require(_0x9049('0xea')));_0x29f430[_0x9049('0x8')](_0x9049('0xeb'),require(_0x9049('0xec')));_0x29f430[_0x9049('0x8')](_0x9049('0xed'),require(_0x9049('0xee')));_0x29f430['use'](_0x9049('0xef'),require(_0x9049('0xf0')));_0x29f430[_0x9049('0x8')](_0x9049('0xf1'),require(_0x9049('0xf2')));_0x29f430[_0x9049('0x8')](_0x9049('0xf3'),require(_0x9049('0xf4')));_0x29f430[_0x9049('0x8')](_0x9049('0xf5'),require(_0x9049('0xf6')));_0x29f430[_0x9049('0x8')](_0x9049('0xf7'),require(_0x9049('0xf8')));_0x29f430['use'](_0x9049('0xf9'),require(_0x9049('0xfa')));_0x29f430[_0x9049('0x8')](_0x9049('0xfb'),require('./api/whatsappInteraction'));_0x29f430[_0x9049('0x8')](_0x9049('0xfc'),require(_0x9049('0xfd')));_0x29f430[_0x9049('0x8')](_0x9049('0xfe'),require(_0x9049('0xff')));_0x29f430[_0x9049('0x8')](_0x9049('0x100'),require('./api/whatsappTransferReport'));_0x29f430[_0x9049('0x8')]('/api/whatsapp/queues',require(_0x9049('0x101')));_0x29f430[_0x9049('0x8')](_0x9049('0x102'),require(_0x9049('0x103')));_0x29f430[_0x9049('0x8')]('/api/auth/local',require(_0x9049('0x104')));_0x29f430[_0x9049('0x8')](_0x9049('0x105'),require(_0x9049('0x106')));_0x29f430[_0x9049('0x8')]('/api/jira',require(_0x9049('0x107')));_0x29f430[_0x9049('0x8')](_0x9049('0x108'),require(_0x9049('0x109')));_0x29f430[_0x9049('0x8')]('/api/version',require(_0x9049('0x10a')));_0x29f430[_0x9049('0x8')](_0x9049('0x10b'),require(_0x9049('0x10c')));_0x29f430[_0x9049('0x8')]('/api/pm2',require('./api/pm2'));_0x29f430[_0x9049('0x8')]('/api/webbar',require(_0x9049('0x10d')));_0x29f430[_0x9049('0x8')](_0x9049('0x10e'),express[_0x9049('0x10f')](path[_0x9049('0x110')](config[_0x9049('0x111')],_0x9049('0x10e'))));_0x29f430[_0x9049('0x8')](_0x9049('0x112'),express[_0x9049('0x10f')](path['join'](config[_0x9049('0x111')],_0x9049('0x112'))));_0x29f430[_0x9049('0x8')]('/demo',express[_0x9049('0x10f')](path['join'](config['root'],_0x9049('0x113'))));_0x29f430[_0x9049('0x8')](_0x9049('0x114'),express[_0x9049('0x10f')](path[_0x9049('0x110')](config[_0x9049('0x111')],_0x9049('0x115'),_0x9049('0x116'))));_0x29f430[_0x9049('0x8')]('/plugins',express[_0x9049('0x10f')](path['join'](config[_0x9049('0x111')],_0x9049('0x117'))));_0x29f430['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x9049('0x118')](errors[0x194]);_0x29f430['route']('/*')['get'](function(_0x5f1869,_0x41dc18){_0x41dc18[_0x9049('0x119')](path['resolve'](_0x29f430[_0x9049('0x118')](_0x9049('0x11a'))+'/index.html'));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 629d135..44b7883 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5887=['../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.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/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc'];(function(_0x1313c3,_0x553f2d){var _0x448a82=function(_0x181908){while(--_0x181908){_0x1313c3['push'](_0x1313c3['shift']());}};_0x448a82(++_0x553f2d);}(_0x5887,0xb5));var _0x7588=function(_0x784d87,_0x4f0284){_0x784d87=_0x784d87-0x0;var _0x22e453=_0x5887[_0x784d87];return _0x22e453;};'use strict';var jayson=require(_0x7588('0x0'));var BPromise=require(_0x7588('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0x7588('0x2')]=function(){return new BPromise(function(_0x457ee4,_0x308216){var _0x5e509b={};_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/user/user.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceExtension/voiceExtension.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceQueue/voiceQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x4')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x5')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x6')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x7')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x8')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x9')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xa')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xb')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xc')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/mailQueue/mailQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0xd')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/mailMessage/mailMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0xe')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0xf')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x10')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x11')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x12')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/faxMessage/faxMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x13')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x14')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x15')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x16')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x17')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x18')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x19')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1a')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1c')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1d')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1e')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/cmContact/cmContact.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x1f')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x20')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x21')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x22')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x23')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x24')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x25')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/sound/sound.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x26')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x27')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x28')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x29')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2a')));_0x5e509b=_['merge'](_0x5e509b,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x2b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2c')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2d')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2e')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x2f')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x30')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x31')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x32')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x33')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/squareProject/squareProject.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x34')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x35')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x36')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x37')));_0x5e509b=_['merge'](_0x5e509b,require(_0x7588('0x38')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x39')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3a')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3b')));_0x5e509b=_[_0x7588('0x3')](_0x5e509b,require(_0x7588('0x3c')));var _0x12f099=jayson[_0x7588('0x3d')](_0x5e509b)['http']();var _0x525b87=config[_0x7588('0x3e')]['port']||config[_0x7588('0x3f')]+0x1;var _0x22f4ca=config[_0x7588('0x3e')]['ip']||'localhost';_0x12f099['on'](_0x7588('0x40'),function(_0x46d1b6){return _0x308216(_0x46d1b6);});_0x12f099['listen'](_0x525b87,_0x22f4ca,function(){console[_0x7588('0x41')](_0x7588('0x42'),_0x22f4ca,_0x525b87);require(_0x7588('0x43'))[_0x7588('0x44')]();return _0x457ee4(_0x7588('0x45')+_0x22f4ca+':'+_0x525b87);});});}; \ No newline at end of file +var _0x0d2b=['../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0x0d2b,0x9f));var _0xb0d2=function(_0x52b993,_0x13ef76){_0x52b993=_0x52b993-0x0;var _0x1ac4ff=_0x0d2b[_0x52b993];return _0x1ac4ff;};'use strict';var jayson=require(_0xb0d2('0x0'));var BPromise=require(_0xb0d2('0x1'));var _=require('lodash');var config=require(_0xb0d2('0x2'));exports[_0xb0d2('0x3')]=function(){return new BPromise(function(_0xd18233,_0x4c11e7){var _0x11e1f9={};_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/user/user.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x5')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x6')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x7')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x8')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x9')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xa')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xb')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xc')));_0x11e1f9=_['merge'](_0x11e1f9,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xd')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xe')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0xf')));_0x11e1f9=_['merge'](_0x11e1f9,require('../api/mailInteraction/mailInteraction.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x10')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x11')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x12')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x13')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x14')));_0x11e1f9=_['merge'](_0x11e1f9,require('../api/faxInteraction/faxInteraction.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x15')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x16')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x17')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x18')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/smsInteraction/smsInteraction.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/smsMessage/smsMessage.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x19')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x1a')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x1b')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x1c')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x1d')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/chatInteraction/chatInteraction.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x1e')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x1f')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/cmContact/cmContact.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x20')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x21')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x22')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x23')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x24')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x25')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x26')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x27')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x28')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/trigger/trigger.rpc'));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x29')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x2a')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x2b')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x2c')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x2d')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x2e')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x2f')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x30')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x31')));_0x11e1f9=_['merge'](_0x11e1f9,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x32')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x33')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/squareProject/squareProject.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/squareRecording/squareRecording.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/squareMessage/squareMessage.rpc'));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x34')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require(_0xb0d2('0x35')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x36')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x37')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x38')));_0x11e1f9=_[_0xb0d2('0x4')](_0x11e1f9,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x39')));_0x11e1f9=_['merge'](_0x11e1f9,require(_0xb0d2('0x3a')));var _0x1b08d5=jayson['server'](_0x11e1f9)['http']();var _0x725433=config['rpc'][_0xb0d2('0x3b')]||config[_0xb0d2('0x3b')]+0x1;var _0xe1d803=config[_0xb0d2('0x3c')]['ip']||_0xb0d2('0x3d');_0x1b08d5['on'](_0xb0d2('0x3e'),function(_0x132023){return _0x4c11e7(_0x132023);});_0x1b08d5[_0xb0d2('0x3')](_0x725433,_0xe1d803,function(){console[_0xb0d2('0x3f')](_0xb0d2('0x40'),_0xe1d803,_0x725433);require('../config/triggers')['default']();return _0xd18233(_0xb0d2('0x41')+_0xe1d803+':'+_0x725433);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 80785f4..26199d8 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 _0x216b=['noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','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','label','util','lodash','events','./reply','./error','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','log','command=','close','inherits','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x1ceb6e,_0x4d6d50){var _0x1987d3=function(_0x113b78){while(--_0x113b78){_0x1ceb6e['push'](_0x1ceb6e['shift']());}};_0x1987d3(++_0x4d6d50);}(_0x216b,0x174));var _0xb216=function(_0x59c207,_0x8ff66e){_0x59c207=_0x59c207-0x0;var _0x82d8db=_0x216b[_0x59c207];return _0x82d8db;};'use strict';var util=require(_0xb216('0x0'));var _=require(_0xb216('0x1'));var EventEmitter=require(_0xb216('0x2'))['EventEmitter'];var AGIReply=require(_0xb216('0x3'));var AGIError=require(_0xb216('0x4'));function AGIChannel(_0x29b8ef){var _0x257d84=this,_0x155a40=new AGIReply(),_0xbc069=![],_0x4c9687={};EventEmitter['call'](_0x257d84);_0x29b8ef[_0xb216('0x5')](_0xb216('0x6'));_0x29b8ef[_0xb216('0x7')](0x8*0x3c*0x3c*0x3e8);_0x155a40[_0xb216('0x5')](_0xb216('0x6'));_0x155a40['on'](_0xb216('0x8'),function(_0x54baec){for(var _0x383e09 in _0x54baec){_0x257d84[_0x383e09]=_0x54baec[_0x383e09];}_0x257d84['emit'](_0xb216('0x9'));});_0x155a40['on'](_0xb216('0xa'),function(_0x391d75){if(_0x391d75[_0xb216('0xb')]()=='hangup'){_0x257d84['emit']('hangup');return;}if(_0x391d75[_0xb216('0xc')](0x0,0xb)==_0xb216('0xd')){_0xbc069=!![];}if(_0xbc069){_0x4c9687['rx']+=_0x391d75+'\x0a';if(_0x391d75[_0xb216('0xe')](_0xb216('0xf'))!=-0x1){_0xbc069=![];}}else{_0x4c9687['rx']=_0x391d75;}if(_0xbc069){return;}if(typeof _0x4c9687['cb']==_0xb216('0x10')){var _0x3ae0fd=_0x4c9687['rx']['substring'](0x0,0x3),_0x26695f=null,_0xbdabbe=null;_0x3ae0fd=parseInt(_0x3ae0fd);if(isNaN(_0x3ae0fd)){_0x4c9687['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb216('0x11')});return;}if(_0x3ae0fd!=0xc8){_0x4c9687['cb'](null,{'code':_0x3ae0fd,'result':-0x1,'extra':'KO'});return;}_0x26695f=_0x4c9687['rx']['substring'](0x4)[_0xb216('0x12')]('result=','');if(_0x26695f[_0xb216('0x13')]('\x20')!=-0x1){_0x26695f=_0x26695f[_0xb216('0x14')](0x0,_0x26695f['indexOf']('\x20'));}if(_[_0xb216('0x15')](_0x26695f,'-1')){_0x26695f=parseInt(_0x26695f);}_0xbdabbe=_0x4c9687['rx'][_0xb216('0x16')]('\x20');if(_0xbdabbe[_0xb216('0x17')]==0x3){_0xbdabbe=_0xbdabbe[0x2][_0xb216('0xc')](0x1,_0xbdabbe[0x2][_0xb216('0x17')]-0x1);}else if(_0xbdabbe[_0xb216('0x17')]>0x3){var _0x4ad104=/\((.+)\)/;var _0x400fe3=_0x4c9687['rx'][_0xb216('0x18')](_0x4ad104);if(_0x400fe3){_0xbdabbe=_0x400fe3[0x1];}else{_0xbdabbe=null;}}else{_0xbdabbe=null;}_0x4c9687['cb'](null,{'code':_0x3ae0fd,'result':_0x26695f,'extra':_0xbdabbe});}});_0x29b8ef['on'](_0xb216('0x19'),function(_0x824601){_0x257d84[_0xb216('0x1a')](_0xb216('0x19'),new AGIError(_0xb216('0x1b'),_0x824601[_0xb216('0x1c')]));});_0x29b8ef['on']('close',function(){_0x257d84['emit']('close',new AGIError(_0xb216('0x1d')));});_0x29b8ef['on'](_0xb216('0x1e'),function(){_0x257d84[_0xb216('0x1a')](_0xb216('0x1e'),new AGIError(_0xb216('0x1f')));_0x29b8ef[_0xb216('0x20')]();});_0x29b8ef[_0xb216('0x21')](_0x155a40);this['command']=function(_0x3c7307,_0x3edd80){console[_0xb216('0x22')](_0xb216('0x23'),_0x3c7307);var _0x3c7307=_0x3c7307||'',_0x3edd80=typeof _0x3edd80=='function'?_0x3edd80:new Function();_0x4c9687={'tx':_0x3c7307,'rx':'','cb':_0x3edd80};_0x29b8ef['write'](_0x3c7307+'\x0a');},this[_0xb216('0x24')]=function(){_0x29b8ef[_0xb216('0x20')]();};}util[_0xb216('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xb216('0x26')][_0xb216('0x27')]=function(_0x1a7af8){return this[_0xb216('0x28')][_0xb216('0x29')](this,_0x1a7af8);};AGIChannel[_0xb216('0x26')][_0xb216('0x2a')]=function(){return this[_0xb216('0x27')](_0xb216('0x2b'));};AGIChannel[_0xb216('0x26')][_0xb216('0x2c')]=function(_0xc5b550,_0x152a63,_0x5ee769){_0xc5b550=_0xc5b550===undefined?_0xb216('0x2d'):_0xc5b550;_0x152a63=_0x152a63===undefined?'5':_0x152a63;_0x5ee769=_0x5ee769===undefined?'1':_0x5ee769;return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x2f'),_0xc5b550,_0x152a63*0x3e8,_0x5ee769));};AGIChannel[_0xb216('0x26')][_0xb216('0x30')]=function(_0xadf9a9){_0xadf9a9=_0xadf9a9||_0xb216('0x31');return this[_0xb216('0x27')](util['format'](_0xb216('0x32'),_0xadf9a9));};AGIChannel[_0xb216('0x26')][_0xb216('0x33')]=function(_0x22e109,_0x23fda2){if(_[_0xb216('0x34')](_0x23fda2)){return this['sendRequest'](util['format'](_0xb216('0x35'),_0x22e109,_0x23fda2[_0xb216('0x36')](',')));}return this['sendRequest'](util[_0xb216('0x2e')](_0xb216('0x35'),_0x22e109,_0x23fda2));};AGIChannel[_0xb216('0x26')][_0xb216('0x37')]=function(_0x4933ab){return this['sendRequest'](util[_0xb216('0x2e')]('SET\x20CONTEXT\x20%s',_0x4933ab));};AGIChannel['prototype'][_0xb216('0x38')]=function(_0x3a8c19){return this['sendRequest'](util['format'](_0xb216('0x39'),_0x3a8c19));};AGIChannel[_0xb216('0x26')]['setPriority']=function(_0x139832){return this[_0xb216('0x27')](util[_0xb216('0x2e')]('SET\x20PRIORITY\x20%s',_0x139832));};AGIChannel[_0xb216('0x26')]['hangup']=function(){return this[_0xb216('0x27')](_0xb216('0x3a'));};AGIChannel[_0xb216('0x26')][_0xb216('0x3b')]=function(_0x3747ef,_0x1c88c2){var _0x19b298=_['isBoolean'](_0x1c88c2)||_[_0xb216('0x3c')](_0x1c88c2)?_0x1c88c2[_0xb216('0x3d')]():_0x1c88c2;return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x3e'),_0x3747ef,_0x19b298?_0x19b298[_0xb216('0x3d')]()[_0xb216('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb216('0x26')][_0xb216('0x3f')]=function(_0x88a489,_0x550de9){return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x40'),_0x88a489,_0x550de9));};AGIChannel[_0xb216('0x26')][_0xb216('0x41')]=function(_0x2db804,_0x5d0b2b){return this['sendRequest'](util['format'](_0xb216('0x42'),_0x2db804,_0x5d0b2b));};AGIChannel[_0xb216('0x26')][_0xb216('0x43')]=function(_0x377000,_0x342af6){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x377000,_0x342af6));};AGIChannel[_0xb216('0x26')][_0xb216('0x44')]=function(_0x4d3b90,_0x5a4826,_0x266760){_0x5a4826=_0x5a4826||this[_0xb216('0x45')];_0x266760=_0x266760||0x1;this['setContext'](_0x4d3b90);this[_0xb216('0x38')](_0x5a4826);this[_0xb216('0x46')](_0x266760);return this[_0xb216('0x30')](util[_0xb216('0x2e')](_0xb216('0x47'),_0x4d3b90,_0x5a4826,_0x266760));};AGIChannel[_0xb216('0x26')][_0xb216('0x48')]=function(_0x5eb418){console[_0xb216('0x22')](_0xb216('0x49'),_0x5eb418);return this[_0xb216('0x27')](util[_0xb216('0x2e')](_0xb216('0x4a'),_0x5eb418));};AGIChannel['prototype']['recordFile']=function(_0x5a3b45,_0x517ec1,_0x40127e,_0xd6d3da,_0x260b40,_0x4ff5e8){_0x517ec1=_0x517ec1||_0xb216('0x4b');_0x40127e=_0x40127e||'';_0xd6d3da=_0xd6d3da===undefined?-0x1:_0xd6d3da==='-1'?-0x1:_0xd6d3da*0x3e8;_0x260b40=_0x260b40===undefined?'':'s='+_0x260b40;_0x4ff5e8=_0x4ff5e8?_0xb216('0x4c'):'';return this[_0xb216('0x27')](util['format'](_0xb216('0x4d'),_0x5a3b45,_0x517ec1,_0x40127e,_0xd6d3da,_0x4ff5e8,_0x260b40));};AGIChannel[_0xb216('0x26')][_0xb216('0x4e')]=function(_0x5a0a41,_0x52cc7f){_0x52cc7f=_0x52cc7f||'';return this['sendRequest'](util[_0xb216('0x2e')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5a0a41,_0x52cc7f));};AGIChannel[_0xb216('0x26')][_0xb216('0x4f')]=function(_0x3cb3af){return this[_0xb216('0x33')](_0xb216('0x50'),_0x3cb3af);};AGIChannel['prototype'][_0xb216('0x51')]=function(_0x50d5e0){return this[_0xb216('0x33')](_0xb216('0x52'),_0x50d5e0);};AGIChannel['prototype'][_0xb216('0x19')]=function(_0x3be047,_0x13bda5){this[_0xb216('0x30')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x3be047['id'],_0x3be047[_0xb216('0x53')],_0x13bda5));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x74d3=['log','command=','close','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','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','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command'];(function(_0x575175,_0x27a9e5){var _0x19dfc0=function(_0x1bcb27){while(--_0x1bcb27){_0x575175['push'](_0x575175['shift']());}};_0x19dfc0(++_0x27a9e5);}(_0x74d3,0x1d7));var _0x374d=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x74d3[_0x2fc113];return _0x5144ce;};'use strict';var util=require(_0x374d('0x0'));var _=require(_0x374d('0x1'));var EventEmitter=require(_0x374d('0x2'))[_0x374d('0x3')];var AGIReply=require(_0x374d('0x4'));var AGIError=require(_0x374d('0x5'));function AGIChannel(_0x7529f5){var _0x8dc439=this,_0x291b85=new AGIReply(),_0x4a0236=![],_0x1af745={};EventEmitter['call'](_0x8dc439);_0x7529f5[_0x374d('0x6')](_0x374d('0x7'));_0x7529f5[_0x374d('0x8')](0x8*0x3c*0x3c*0x3e8);_0x291b85['setEncoding'](_0x374d('0x7'));_0x291b85['on']('headers',function(_0x11601d){for(var _0x2f12f9 in _0x11601d){_0x8dc439[_0x2f12f9]=_0x11601d[_0x2f12f9];}_0x8dc439[_0x374d('0x9')](_0x374d('0xa'));});_0x291b85['on'](_0x374d('0xb'),function(_0x3ec207){if(_0x3ec207[_0x374d('0xc')]()==_0x374d('0xd')){_0x8dc439[_0x374d('0x9')](_0x374d('0xd'));return;}if(_0x3ec207[_0x374d('0xe')](0x0,0xb)==_0x374d('0xf')){_0x4a0236=!![];}if(_0x4a0236){_0x1af745['rx']+=_0x3ec207+'\x0a';if(_0x3ec207[_0x374d('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x4a0236=![];}}else{_0x1af745['rx']=_0x3ec207;}if(_0x4a0236){return;}if(typeof _0x1af745['cb']==_0x374d('0x11')){var _0x5857f1=_0x1af745['rx']['substring'](0x0,0x3),_0x3f79be=null,_0x2f264c=null;_0x5857f1=parseInt(_0x5857f1);if(isNaN(_0x5857f1)){_0x1af745['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5857f1!=0xc8){_0x1af745['cb'](null,{'code':_0x5857f1,'result':-0x1,'extra':'KO'});return;}_0x3f79be=_0x1af745['rx'][_0x374d('0xe')](0x4)[_0x374d('0x12')](_0x374d('0x13'),'');if(_0x3f79be[_0x374d('0x14')]('\x20')!=-0x1){_0x3f79be=_0x3f79be['substr'](0x0,_0x3f79be['indexOf']('\x20'));}if(_[_0x374d('0x15')](_0x3f79be,'-1')){_0x3f79be=parseInt(_0x3f79be);}_0x2f264c=_0x1af745['rx'][_0x374d('0x16')]('\x20');if(_0x2f264c[_0x374d('0x17')]==0x3){_0x2f264c=_0x2f264c[0x2][_0x374d('0xe')](0x1,_0x2f264c[0x2][_0x374d('0x17')]-0x1);}else if(_0x2f264c[_0x374d('0x17')]>0x3){var _0x495885=/\((.+)\)/;var _0x4a7e7e=_0x1af745['rx'][_0x374d('0x18')](_0x495885);if(_0x4a7e7e){_0x2f264c=_0x4a7e7e[0x1];}else{_0x2f264c=null;}}else{_0x2f264c=null;}_0x1af745['cb'](null,{'code':_0x5857f1,'result':_0x3f79be,'extra':_0x2f264c});}});_0x7529f5['on'](_0x374d('0x19'),function(_0x8ae1d0){_0x8dc439[_0x374d('0x9')](_0x374d('0x19'),new AGIError(_0x374d('0x1a'),_0x8ae1d0[_0x374d('0x1b')]));});_0x7529f5['on']('close',function(){_0x8dc439[_0x374d('0x9')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x7529f5['on'](_0x374d('0x1c'),function(){_0x8dc439[_0x374d('0x9')](_0x374d('0x1c'),new AGIError(_0x374d('0x1d')));_0x7529f5[_0x374d('0x1e')]();});_0x7529f5[_0x374d('0x1f')](_0x291b85);this[_0x374d('0x20')]=function(_0x230513,_0x3337fb){console[_0x374d('0x21')](_0x374d('0x22'),_0x230513);var _0x230513=_0x230513||'',_0x3337fb=typeof _0x3337fb==_0x374d('0x11')?_0x3337fb:new Function();_0x1af745={'tx':_0x230513,'rx':'','cb':_0x3337fb};_0x7529f5['write'](_0x230513+'\x0a');},this[_0x374d('0x23')]=function(){_0x7529f5[_0x374d('0x1e')]();};}util[_0x374d('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x374d('0x25')][_0x374d('0x26')]=function(_0x548832){return this[_0x374d('0x20')][_0x374d('0x27')](this,_0x548832);};AGIChannel[_0x374d('0x25')][_0x374d('0x28')]=function(){return this[_0x374d('0x26')](_0x374d('0x29'));};AGIChannel[_0x374d('0x25')][_0x374d('0x2a')]=function(_0x2893fe,_0xe557db,_0x307e7c){_0x2893fe=_0x2893fe===undefined?_0x374d('0x2b'):_0x2893fe;_0xe557db=_0xe557db===undefined?'5':_0xe557db;_0x307e7c=_0x307e7c===undefined?'1':_0x307e7c;return this[_0x374d('0x26')](util[_0x374d('0x2c')](_0x374d('0x2d'),_0x2893fe,_0xe557db*0x3e8,_0x307e7c));};AGIChannel[_0x374d('0x25')]['noop']=function(_0x391192){_0x391192=_0x391192||_0x374d('0x2e');return this[_0x374d('0x26')](util[_0x374d('0x2c')](_0x374d('0x2f'),_0x391192));};AGIChannel[_0x374d('0x25')][_0x374d('0x30')]=function(_0x13e906,_0x4157fd){if(_[_0x374d('0x31')](_0x4157fd)){return this[_0x374d('0x26')](util[_0x374d('0x2c')](_0x374d('0x32'),_0x13e906,_0x4157fd[_0x374d('0x33')](',')));}return this[_0x374d('0x26')](util[_0x374d('0x2c')]('EXEC\x20%s\x20%s',_0x13e906,_0x4157fd));};AGIChannel['prototype'][_0x374d('0x34')]=function(_0x2bb903){return this['sendRequest'](util['format']('SET\x20CONTEXT\x20%s',_0x2bb903));};AGIChannel['prototype'][_0x374d('0x35')]=function(_0x50e4c9){return this[_0x374d('0x26')](util['format'](_0x374d('0x36'),_0x50e4c9));};AGIChannel[_0x374d('0x25')]['setPriority']=function(_0x266811){return this[_0x374d('0x26')](util[_0x374d('0x2c')](_0x374d('0x37'),_0x266811));};AGIChannel[_0x374d('0x25')]['hangup']=function(){return this[_0x374d('0x26')](_0x374d('0x38'));};AGIChannel['prototype'][_0x374d('0x39')]=function(_0x1fadaf,_0x28d579){var _0x2659c5=_[_0x374d('0x3a')](_0x28d579)||_[_0x374d('0x3b')](_0x28d579)?_0x28d579[_0x374d('0x3c')]():_0x28d579;return this['sendRequest'](util['format'](_0x374d('0x3d'),_0x1fadaf,_0x2659c5?_0x2659c5['toString']()[_0x374d('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x374d('0x25')]['sayNumber']=function(_0x4f27aa,_0x13d131){return this['sendRequest'](util[_0x374d('0x2c')](_0x374d('0x3e'),_0x4f27aa,_0x13d131));};AGIChannel['prototype'][_0x374d('0x3f')]=function(_0x616be,_0x4df91c){return this[_0x374d('0x26')](util[_0x374d('0x2c')](_0x374d('0x40'),_0x616be,_0x4df91c));};AGIChannel[_0x374d('0x25')][_0x374d('0x41')]=function(_0x57b3d1,_0x455f90){return this['sendRequest'](util[_0x374d('0x2c')](_0x374d('0x42'),_0x57b3d1,_0x455f90));};AGIChannel[_0x374d('0x25')]['continueAt']=function(_0x4fc506,_0x2b7c7f,_0x4bb134){_0x2b7c7f=_0x2b7c7f||this[_0x374d('0x43')];_0x4bb134=_0x4bb134||0x1;this[_0x374d('0x34')](_0x4fc506);this[_0x374d('0x35')](_0x2b7c7f);this[_0x374d('0x44')](_0x4bb134);return this[_0x374d('0x45')](util['format'](_0x374d('0x46'),_0x4fc506,_0x2b7c7f,_0x4bb134));};AGIChannel[_0x374d('0x25')][_0x374d('0x47')]=function(_0x467838){console['log']('getvariable',_0x467838);return this['sendRequest'](util[_0x374d('0x2c')](_0x374d('0x48'),_0x467838));};AGIChannel[_0x374d('0x25')][_0x374d('0x49')]=function(_0x103c5c,_0x120ccd,_0x4cffa5,_0x39179e,_0xa909af,_0x439ce3){_0x120ccd=_0x120ccd||_0x374d('0x4a');_0x4cffa5=_0x4cffa5||'';_0x39179e=_0x39179e===undefined?-0x1:_0x39179e==='-1'?-0x1:_0x39179e*0x3e8;_0xa909af=_0xa909af===undefined?'':'s='+_0xa909af;_0x439ce3=_0x439ce3?_0x374d('0x4b'):'';return this[_0x374d('0x26')](util[_0x374d('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x103c5c,_0x120ccd,_0x4cffa5,_0x39179e,_0x439ce3,_0xa909af));};AGIChannel[_0x374d('0x25')][_0x374d('0x4c')]=function(_0x17b36d,_0x41515d){_0x41515d=_0x41515d||'';return this['sendRequest'](util[_0x374d('0x2c')](_0x374d('0x4d'),_0x17b36d,_0x41515d));};AGIChannel[_0x374d('0x25')][_0x374d('0x4e')]=function(_0x1db42f){return this[_0x374d('0x30')](_0x374d('0x4f'),_0x1db42f);};AGIChannel[_0x374d('0x25')][_0x374d('0x50')]=function(_0x228515){return this[_0x374d('0x30')]('WAIT',_0x228515);};AGIChannel[_0x374d('0x25')][_0x374d('0x19')]=function(_0x16ddbc,_0x58c968){this[_0x374d('0x45')](util['format'](_0x374d('0x51'),_0x16ddbc['id'],_0x16ddbc[_0x374d('0x52')],_0x58c968));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x374d('0x53')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9a53c3a..44ee886 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 _0x4fef=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util'];(function(_0x1ca396,_0x56772a){var _0x1650c4=function(_0x19c9c2){while(--_0x19c9c2){_0x1ca396['push'](_0x1ca396['shift']());}};_0x1650c4(++_0x56772a);}(_0x4fef,0x10f));var _0xf4fe=function(_0x988535,_0x13675b){_0x988535=_0x988535-0x0;var _0x3ce528=_0x4fef[_0x988535];return _0x3ce528;};'use strict';var util=require(_0xf4fe('0x0'));var error={'E_AGI_UNDEFINED':_0xf4fe('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xf4fe('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xf4fe('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xf4fe('0x4'),'E_AGI_SOCKET_ERROR':_0xf4fe('0x5'),'E_AGI_SOCKET_CLOSE':_0xf4fe('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xf4fe('0x7'),'E_AGI_COMMAND_EMPTY':_0xf4fe('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf4fe('0x9'),'E_AGI_IVR_ENTRY':_0xf4fe('0xa')};function AGIError(_0x522427){var _0x522427=_0x522427||null,_0x3e844d=_0x3e844d||[],_0x4805b0=0x1,_0x23b761='';if(!error[_0x522427]){_0x522427=_0xf4fe('0xb');}_0x3e844d[_0xf4fe('0xc')](error[_0x522427]);while(arguments[_0x4805b0]){_0x3e844d[_0xf4fe('0xc')](arguments[_0x4805b0]);_0x4805b0++;}_0x23b761=util[_0xf4fe('0xd')][_0xf4fe('0xe')](util,_0x3e844d);this[_0xf4fe('0xf')]=_0x23b761;this[_0xf4fe('0x10')]=_0x522427;}module['exports']=AGIError; \ No newline at end of file +var _0xbdb0=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply'];(function(_0x473d1e,_0x4df799){var _0x503be9=function(_0x4bcfff){while(--_0x4bcfff){_0x473d1e['push'](_0x473d1e['shift']());}};_0x503be9(++_0x4df799);}(_0xbdb0,0x189));var _0x0bdb=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xbdb0[_0x29e3b6];return _0x55d4b0;};'use strict';var util=require(_0x0bdb('0x0'));var error={'E_AGI_UNDEFINED':_0x0bdb('0x1'),'E_AGI_ARGUMENT_PORT':_0x0bdb('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0bdb('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0bdb('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0bdb('0x5'),'E_AGI_SOCKET_ERROR':_0x0bdb('0x6'),'E_AGI_SOCKET_CLOSE':_0x0bdb('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x0bdb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0bdb('0x9')};function AGIError(_0x5254ca){var _0x5254ca=_0x5254ca||null,_0x1a189c=_0x1a189c||[],_0x9a24fd=0x1,_0x3afa5e='';if(!error[_0x5254ca]){_0x5254ca=_0x0bdb('0xa');}_0x1a189c[_0x0bdb('0xb')](error[_0x5254ca]);while(arguments[_0x9a24fd]){_0x1a189c[_0x0bdb('0xb')](arguments[_0x9a24fd]);_0x9a24fd++;}_0x3afa5e=util['format'][_0x0bdb('0xc')](util,_0x1a189c);this['message']=_0x3afa5e;this['name']=_0x5254ca;}module[_0x0bdb('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0c402ec..81bc3fc 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 _0xefda=['lodash','menu','getdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x2aeed1,_0x5f58){var _0x290eb7=function(_0x5231e5){while(--_0x5231e5){_0x2aeed1['push'](_0x2aeed1['shift']());}};_0x290eb7(++_0x5f58);}(_0xefda,0x96));var _0xaefd=function(_0x4d7f37,_0x2d60e7){_0x4d7f37=_0x4d7f37-0x0;var _0x5d8812=_0xefda[_0x4d7f37];return _0x5d8812;};'use strict';var _=require(_0xaefd('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0xaefd('0x1'),_0xaefd('0x2'),'getsecretdigits'];var Graph=function(){this[_0xaefd('0x3')]={};this[_0xaefd('0x4')]={};this[_0xaefd('0x5')]=0x0;};Graph[_0xaefd('0x6')][_0xaefd('0x7')]=function(_0x3288f9){this['vertices'][_0x3288f9['id']]=_0x3288f9;this[_0xaefd('0x4')][_0x3288f9['id']]=[];};Graph[_0xaefd('0x6')][_0xaefd('0x8')]=function(_0x1d76f3,_0x4ce248,_0x15193c){this[_0xaefd('0x4')][_0x1d76f3][_0xaefd('0x9')]({'target':_0x4ce248,'condition':_0x15193c});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _[_0xaefd('0xa')](this[_0xaefd('0x3')]);};Graph[_0xaefd('0x6')][_0xaefd('0xb')]=function(){return this[_0xaefd('0x5')];};Graph[_0xaefd('0x6')][_0xaefd('0xc')]=function(_0x3dfddf){return this[_0xaefd('0x3')][_0x3dfddf];};Graph[_0xaefd('0x6')][_0xaefd('0xd')]=function(_0x4b2b5c,_0x3172d3){if(!this['vertices'][_0x4b2b5c]){return logger[_0xaefd('0xe')](_0xaefd('0xf'));}var _0x9dfdf6=_0x3172d3(this[_0xaefd('0x3')][_0x4b2b5c]);if(!_0x9dfdf6){return logger['info'](_0xaefd('0x10'));}if(this[_0xaefd('0x4')][_0x4b2b5c][_0xaefd('0x11')]===0x0){return logger[_0xaefd('0xe')](_0xaefd('0x12'));}for(var _0x32f75e=0x0,_0x277070=[],_0x23d736=![];_0x32f75e\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc','context','extension','priority','vresponse','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','port','name','message','format','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge'];(function(_0x4870e1,_0x39f5e2){var _0x38169b=function(_0x46f077){while(--_0x46f077){_0x4870e1['push'](_0x4870e1['shift']());}};_0x38169b(++_0x39f5e2);}(_0xc306,0x1a9));var _0x6c30=function(_0x477675,_0x5146c4){_0x477675=_0x477675-0x0;var _0x1d0ff0=_0xc306[_0x477675];return _0x1d0ff0;};'use strict';var parser=require(_0x6c30('0x0'));var _=require('lodash');var syncho=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var moment=require(_0x6c30('0x3'));var config=require(_0x6c30('0x4'));var logger=require(_0x6c30('0x5'))('agi');var utilLicense=require(_0x6c30('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x6c30('0x7'));var Graph=require(_0x6c30('0x8'));var Vertices=require(_0x6c30('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6c30('0xa')]=_[_0x6c30('0xb')](config[_0x6c30('0xa')],{'ip':_0x6c30('0xc'),'port':0x11dd});function connectionHandler(_0x4e0017){process[_0x6c30('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4e0017);agiHandler(_0x4e0017);}catch(_0x3f937a){logger[_0x6c30('0xe')](_0x3f937a['stack']);}});});}function listeningHandler(){console[_0x6c30('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x6c30('0x10')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6c30('0xa')]['ip'],config[_0x6c30('0xa')][_0x6c30('0x10')]));}function errorHandler(_0x4db908){if(_0x4db908&&_0x4db908[_0x6c30('0x11')]&&_0x4db908['message']){logger[_0x6c30('0xe')](util['format']('[%s]\x20%s',_0x4db908[_0x6c30('0x11')],_0x4db908[_0x6c30('0x12')]));}else{logger['error'](util[_0x6c30('0x13')](_0x6c30('0x14'),_0x4db908[_0x6c30('0x15')]));}}function closeHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x17'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this[_0x6c30('0x1c')]));try{createSquareReport(this);}catch(_0x439581){logger[_0x6c30('0xe')](_0x439581[_0x6c30('0x15')]);}}function timeoutHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x1d'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x1e'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this['dnid'],this['uniqueid']));this[_0x6c30('0x1f')]=!![];}function getRoot(_0x4688fa){return parser[_0x6c30('0x20')](_0x4688fa,{'object':!![]})[_0x6c30('0x21')][_0x6c30('0x22')];}function addVertex(_0x34ddb6,_0x17c025,_0x726de6){_0x17c025[_0x6c30('0x23')]=_0x726de6;if(_0x17c025[_0x6c30('0x24')](_0x6c30('0x25'))){_0x17c025[_0x6c30('0x26')]=parseInt(_0x17c025[_0x6c30('0x25')],0xa);}_0x34ddb6[_0x6c30('0x27')](_['omit'](_0x17c025,_0x6c30('0x28')));}function initGraph(_0x1152f3,_0x56f3eb){var _0x190693=new Graph();for(var _0x6fc3f8 in _0x1152f3){if(_0x1152f3[_0x6c30('0x24')](_0x6fc3f8)){if(_['isArray'](_0x1152f3[_0x6fc3f8])){for(var _0x2706ae=0x0;_0x2706ae<_0x1152f3[_0x6fc3f8][_0x6c30('0x29')];_0x2706ae+=0x1){addVertex(_0x190693,_0x1152f3[_0x6fc3f8][_0x2706ae],_0x6fc3f8);}}else{addVertex(_0x190693,_0x1152f3[_0x6fc3f8],_0x6fc3f8);}}}for(var _0x3471dc=0x0;_0x3471dc<_0x56f3eb[_0x6c30('0x29')];_0x3471dc+=0x1){if(_0x56f3eb[_0x3471dc][_0x6c30('0x2a')]&&_0x56f3eb[_0x3471dc][_0x6c30('0x2b')]){_0x190693[_0x6c30('0x2c')](_0x56f3eb[_0x3471dc][_0x6c30('0x2a')],_0x56f3eb[_0x3471dc]['target'],_0x56f3eb[_0x3471dc][_0x6c30('0x2d')]);}}return _0x190693;}function getSquareProject(_0x2ff96a,_0x231ec0){rpc[_0x6c30('0x2e')](_0x2ff96a)['then'](function(_0x5b0990){_0x231ec0(null,_0x5b0990);})[_0x6c30('0x2f')](function(_0x53551f){_0x231ec0(null,_0x53551f);});}function createSquareReport(_0x29bc69,_0x428f61){rpc[_0x6c30('0x30')](_0x29bc69)[_0x6c30('0x31')](function(_0x2a14f7){if(_0x428f61){_0x428f61(null,_0x2a14f7);}})[_0x6c30('0x2f')](function(_0x16dd6f){if(_0x428f61){_0x428f61(null,_0x16dd6f);}});}function setChannelVariables(_0x27ddc4){for(var _0x4ec2a9 in _0x27ddc4){if(_0x27ddc4[_0x6c30('0x24')](_0x4ec2a9)){if(_0x4ec2a9[_0x6c30('0x32')]('agi_')===0x0){_0x27ddc4[_0x4ec2a9[_0x6c30('0x33')](0x4)]=_0x27ddc4[_0x4ec2a9];delete _0x27ddc4[_0x4ec2a9];}}}}function getLogFromObject(_0x1e9997){return util[_0x6c30('0x34')](_0x1e9997,{'showHidden':![],'depth':null});}function agiHandler(_0x4cf1c5){var _0x57153e,_0x11612c,_0x4c5a45,_0x5e852c,_0x5d1f3e;logger[_0x6c30('0x35')](_0x6c30('0x36'),JSON[_0x6c30('0x37')](_0x4cf1c5,null,0x2));logger[_0x6c30('0x16')](util[_0x6c30('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cf1c5['arg_1'],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5[_0x6c30('0x1c')]));_0x4cf1c5['on'](_0x6c30('0xe'),errorHandler);_0x4cf1c5['on'](_0x6c30('0x38'),closeHandler);_0x4cf1c5['on'](_0x6c30('0x39'),timeoutHandler);_0x4cf1c5[_0x6c30('0x1f')]=![];_0x4cf1c5['on'](_0x6c30('0x3a'),hangupHandler);var _0x472664=getSquareProject[_0x6c30('0x3b')](null,_0x4cf1c5[_0x6c30('0x18')]);if(_0x472664){if(_0x472664[_0x6c30('0x3c')]){_0x57153e=getRoot(_0x472664[_0x6c30('0x3c')]);console[_0x6c30('0xf')](_0x6c30('0x3d'),_0x57153e);if(_0x57153e&&_0x57153e['start']){logger[_0x6c30('0x35')](_0x6c30('0x22'),JSON[_0x6c30('0x37')](_0x57153e,null,0x2));_0x4cf1c5[_0x6c30('0x3e')]=moment()[_0x6c30('0x13')](_0x6c30('0x3f'));_0x11612c=initGraph(_[_0x6c30('0x40')](_0x57153e,_0x6c30('0x28')),_0x57153e[_0x6c30('0x28')]);_0x4c5a45=new Vertices(_0x4cf1c5,rpc,mailRpc);console['log'](_0x6c30('0x41'),_0x4c5a45);logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x42'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5['calleridname'],_0x4cf1c5[_0x6c30('0x1a')],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));console[_0x6c30('0xf')](_0x6c30('0x43'));_0x11612c[_0x6c30('0x44')](_0x57153e['start']['id'],function(_0x3e29a1){try{_0x3e29a1=_0x4c5a45[_0x6c30('0x45')](_0x3e29a1);logger['debug']('vertex',JSON[_0x6c30('0x37')](_0x3e29a1,null,0x2));console[_0x6c30('0xf')](_0x6c30('0x46'),_0x3e29a1);if(_0x3e29a1[_0x6c30('0x23')]===_0x6c30('0x47')){logger[_0x6c30('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4cf1c5[_0x6c30('0x48')]=_0x3e29a1['context']||_0x4cf1c5[_0x6c30('0x48')];_0x4cf1c5[_0x6c30('0x49')]=_0x3e29a1[_0x6c30('0x49')];_0x4cf1c5['priority']=_0x3e29a1[_0x6c30('0x4a')]?_0x3e29a1[_0x6c30('0x4a')]-0x1:0x1;return null;}else if(_0x3e29a1&&_0x4c5a45[_0x3e29a1['agicommand']]){_0x5d1f3e=_0x4c5a45[_0x3e29a1[_0x6c30('0x23')]](_0x3e29a1);console[_0x6c30('0xf')](_0x6c30('0x4b'),_0x5d1f3e);logger['info'](_0x6c30('0x4c'),JSON['stringify'](_0x5d1f3e,null,0x2));if(_0x5d1f3e&&_0x5d1f3e['code']===AGI_CODE_SUCCESS&&_0x5d1f3e['result']!==AGI_RESULT_ERROR&&!_0x4cf1c5[_0x6c30('0x1f')]){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e['result'])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x20891a){logger[_0x6c30('0xe')](_0x20891a[_0x6c30('0x15')]);return null;}});if(_0x57153e[_0x6c30('0x51')]){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x52'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5['uniqueid']));_0x11612c[_0x6c30('0x44')](_0x57153e[_0x6c30('0x51')]['id'],function(_0x1c02c2){try{_0x1c02c2=_0x4c5a45[_0x6c30('0x45')](_0x1c02c2);logger[_0x6c30('0x35')]('vertex',JSON[_0x6c30('0x37')](_0x1c02c2,null,0x2));if(_0x1c02c2&&_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]]){_0x5d1f3e=_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]](_0x1c02c2);if(_0x5d1f3e){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e[_0x6c30('0x4e')])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x29f9d0){logger[_0x6c30('0xe')](_0x29f9d0[_0x6c30('0x15')]);return null;}});}logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x53'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));logger['info'](util[_0x6c30('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5['extension'],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger[_0x6c30('0xe')](util[_0x6c30('0x13')](_0x6c30('0x55'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5['context'],_0x4cf1c5['extension'],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger['error'](util['format'](_0x6c30('0x56'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}function main(){var _0x5d7432;return utilLicense[_0x6c30('0x57')]()[_0x6c30('0x31')](function(_0x11df70){if(_0x11df70){if(_0x11df70['voice']){if(_0x11df70[_0x6c30('0x58')]&&_0x11df70[_0x6c30('0x58')]>0x0){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x59'),_0x11df70[_0x6c30('0x58')]));_0x5d7432=_0x11df70[_0x6c30('0x58')];}else{logger[_0x6c30('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6c30('0x16')](_0x6c30('0x5a'));_0x5d7432=-0x1;}}})[_0x6c30('0x2f')](function(_0x33cbf8){logger[_0x6c30('0xe')](_0x6c30('0x5b'),_0x33cbf8['stack']);})['finally'](function(){var _0x115efb=require('./server')(config[_0x6c30('0xa')][_0x6c30('0x10')],config[_0x6c30('0xa')]['ip'],_0x5d7432);_0x115efb['on'](_0x6c30('0xe'),errorHandler);_0x115efb['on'](_0x6c30('0x5c'),listeningHandler);_0x115efb['on'](_0x6c30('0x5d'),connectionHandler);_0x115efb['on'](_0x6c30('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x3792=['callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','debug','variables','stringify','close','production','SQUAREROOT','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','VERTEX','gotoc','context','extension','priority','response','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','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','voice'];(function(_0x476a4e,_0x44ec5f){var _0x58e8e7=function(_0x33b19a){while(--_0x33b19a){_0x476a4e['push'](_0x476a4e['shift']());}};_0x58e8e7(++_0x44ec5f);}(_0x3792,0xbe));var _0x2379=function(_0xad5672,_0x5c612b){_0xad5672=_0xad5672-0x0;var _0x294745=_0x3792[_0xad5672];return _0x294745;};'use strict';var parser=require(_0x2379('0x0'));var _=require(_0x2379('0x1'));var syncho=require('syncho');var util=require(_0x2379('0x2'));var moment=require(_0x2379('0x3'));var config=require(_0x2379('0x4'));var logger=require(_0x2379('0x5'))('agi');var utilLicense=require(_0x2379('0x6'));var rpc=require(_0x2379('0x7'));var mailRpc=require(_0x2379('0x8'));var Graph=require(_0x2379('0x9'));var Vertices=require(_0x2379('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2379('0xb')]=_[_0x2379('0xc')](config[_0x2379('0xb')],{'ip':_0x2379('0xd'),'port':0x11dd});function connectionHandler(_0xb519ed){process[_0x2379('0xe')](function(){syncho(function(){try{setChannelVariables(_0xb519ed);agiHandler(_0xb519ed);}catch(_0x3d5005){logger[_0x2379('0xf')](_0x3d5005[_0x2379('0x10')]);}});});}function listeningHandler(){console[_0x2379('0x11')](_0x2379('0x12'),config['agi'][_0x2379('0x13')]);logger[_0x2379('0x14')](util[_0x2379('0x15')](_0x2379('0x16'),config[_0x2379('0xb')]['ip'],config['agi'][_0x2379('0x13')]));}function errorHandler(_0xd4525b){if(_0xd4525b&&_0xd4525b['name']&&_0xd4525b[_0x2379('0x17')]){logger[_0x2379('0xf')](util[_0x2379('0x15')]('[%s]\x20%s',_0xd4525b['name'],_0xd4525b['message']));}else{logger[_0x2379('0xf')](util[_0x2379('0x15')]('[ERROR]\x20%s',_0xd4525b[_0x2379('0x10')]));}}function closeHandler(){logger[_0x2379('0x14')](util['format'](_0x2379('0x18'),this[_0x2379('0x19')],this[_0x2379('0x1a')],this['callerid'],this[_0x2379('0x1b')],this[_0x2379('0x1c')]));try{createSquareReport(this);}catch(_0x556875){logger[_0x2379('0xf')](_0x556875[_0x2379('0x10')]);}}function timeoutHandler(){logger[_0x2379('0x14')](util[_0x2379('0x15')](_0x2379('0x1d'),this[_0x2379('0x19')],this[_0x2379('0x1a')],this[_0x2379('0x1e')],this[_0x2379('0x1b')],this[_0x2379('0x1c')]));}function hangupHandler(){logger[_0x2379('0x14')](util[_0x2379('0x15')](_0x2379('0x1f'),this[_0x2379('0x19')],this[_0x2379('0x1a')],this[_0x2379('0x1e')],this[_0x2379('0x1b')],this['uniqueid']));this[_0x2379('0x20')]=!![];}function getRoot(_0x54e6f3){return parser[_0x2379('0x21')](_0x54e6f3,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x281053,_0x5499e4,_0x5c5475){_0x5499e4[_0x2379('0x22')]=_0x5c5475;if(_0x5499e4[_0x2379('0x23')](_0x2379('0x24'))){_0x5499e4[_0x2379('0x25')]=parseInt(_0x5499e4['retry'],0xa);}_0x281053[_0x2379('0x26')](_[_0x2379('0x27')](_0x5499e4,_0x2379('0x28')));}function initGraph(_0x3ee76c,_0x70416a){var _0xb09ef3=new Graph();for(var _0x3acc2b in _0x3ee76c){if(_0x3ee76c['hasOwnProperty'](_0x3acc2b)){if(_[_0x2379('0x29')](_0x3ee76c[_0x3acc2b])){for(var _0x395f72=0x0;_0x395f72<_0x3ee76c[_0x3acc2b][_0x2379('0x2a')];_0x395f72+=0x1){addVertex(_0xb09ef3,_0x3ee76c[_0x3acc2b][_0x395f72],_0x3acc2b);}}else{addVertex(_0xb09ef3,_0x3ee76c[_0x3acc2b],_0x3acc2b);}}}for(var _0x5b33f1=0x0;_0x5b33f1<_0x70416a[_0x2379('0x2a')];_0x5b33f1+=0x1){if(_0x70416a[_0x5b33f1][_0x2379('0x2b')]&&_0x70416a[_0x5b33f1]['target']){_0xb09ef3['addEdge'](_0x70416a[_0x5b33f1]['source'],_0x70416a[_0x5b33f1]['target'],_0x70416a[_0x5b33f1][_0x2379('0x2c')]);}}return _0xb09ef3;}function getSquareProject(_0x4100b5,_0x2c66d4){rpc[_0x2379('0x2d')](_0x4100b5)[_0x2379('0x2e')](function(_0x52fd44){_0x2c66d4(null,_0x52fd44);})['catch'](function(_0x165f8a){_0x2c66d4(null,_0x165f8a);});}function createSquareReport(_0x44e705,_0x372bc2){rpc[_0x2379('0x2f')](_0x44e705)['then'](function(_0x5bb09f){if(_0x372bc2){_0x372bc2(null,_0x5bb09f);}})[_0x2379('0x30')](function(_0x4d2fa2){if(_0x372bc2){_0x372bc2(null,_0x4d2fa2);}});}function setChannelVariables(_0x21c263){for(var _0x596b0a in _0x21c263){if(_0x21c263[_0x2379('0x23')](_0x596b0a)){if(_0x596b0a[_0x2379('0x31')](_0x2379('0x32'))===0x0){_0x21c263[_0x596b0a[_0x2379('0x33')](0x4)]=_0x21c263[_0x596b0a];delete _0x21c263[_0x596b0a];}}}}function getLogFromObject(_0x1d5fa1){return util[_0x2379('0x34')](_0x1d5fa1,{'showHidden':![],'depth':null});}function agiHandler(_0x23679a){var _0x4a679e,_0x10800d,_0x3f2a05,_0x1644c0,_0x506933;logger[_0x2379('0x35')](_0x2379('0x36'),JSON[_0x2379('0x37')](_0x23679a,null,0x2));logger['info'](util[_0x2379('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x23679a['arg_1'],_0x23679a[_0x2379('0x1a')],_0x23679a['callerid'],_0x23679a[_0x2379('0x1b')],_0x23679a[_0x2379('0x1c')]));_0x23679a['on']('error',errorHandler);_0x23679a['on'](_0x2379('0x38'),closeHandler);_0x23679a['on']('timeout',timeoutHandler);_0x23679a[_0x2379('0x20')]=![];_0x23679a['on']('hangup',hangupHandler);var _0x1fc1e3=getSquareProject['sync'](null,_0x23679a[_0x2379('0x19')]);if(_0x1fc1e3){if(_0x1fc1e3[_0x2379('0x39')]){_0x4a679e=getRoot(_0x1fc1e3[_0x2379('0x39')]);console[_0x2379('0x11')](_0x2379('0x3a'),_0x4a679e);if(_0x4a679e&&_0x4a679e[_0x2379('0x3b')]){logger[_0x2379('0x35')](_0x2379('0x3c'),JSON[_0x2379('0x37')](_0x4a679e,null,0x2));_0x23679a[_0x2379('0x3d')]=moment()['format'](_0x2379('0x3e'));_0x10800d=initGraph(_[_0x2379('0x27')](_0x4a679e,'mxCell'),_0x4a679e['mxCell']);_0x3f2a05=new Vertices(_0x23679a,rpc,mailRpc);console[_0x2379('0x11')]('vertices',_0x3f2a05);logger[_0x2379('0x14')](util[_0x2379('0x15')](_0x2379('0x3f'),_0x23679a[_0x2379('0x19')],_0x23679a['calleridname'],_0x23679a[_0x2379('0x1e')],_0x23679a[_0x2379('0x1b')],_0x23679a[_0x2379('0x1c')]));console[_0x2379('0x11')]('LOOP\x20through\x20graph');_0x10800d[_0x2379('0x40')](_0x4a679e[_0x2379('0x3b')]['id'],function(_0x11d76d){try{_0x11d76d=_0x3f2a05[_0x2379('0x41')](_0x11d76d);logger[_0x2379('0x35')](_0x2379('0x42'),JSON[_0x2379('0x37')](_0x11d76d,null,0x2));console['log'](_0x2379('0x43'),_0x11d76d);if(_0x11d76d[_0x2379('0x22')]===_0x2379('0x44')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x23679a[_0x2379('0x45')]=_0x11d76d[_0x2379('0x45')]||_0x23679a[_0x2379('0x45')];_0x23679a[_0x2379('0x46')]=_0x11d76d[_0x2379('0x46')];_0x23679a[_0x2379('0x47')]=_0x11d76d[_0x2379('0x47')]?_0x11d76d['priority']-0x1:0x1;return null;}else if(_0x11d76d&&_0x3f2a05[_0x11d76d[_0x2379('0x22')]]){_0x506933=_0x3f2a05[_0x11d76d[_0x2379('0x22')]](_0x11d76d);console[_0x2379('0x11')]('vresponse',_0x506933);logger['info'](_0x2379('0x48'),JSON[_0x2379('0x37')](_0x506933,null,0x2));if(_0x506933&&_0x506933['code']===AGI_CODE_SUCCESS&&_0x506933['result']!==AGI_RESULT_ERROR&&!_0x23679a['evtHangup']){logger[_0x2379('0x35')]('response',getLogFromObject(_0x506933));return _[_0x2379('0x49')](_0x506933['result'])?null:_0x506933[_0x2379('0x4a')][_0x2379('0x4b')]();}else{logger[_0x2379('0xf')](_0x2379('0x48'),getLogFromObject(_0x506933));return null;}}else{logger['error'](_0x2379('0x4c'));return null;}}catch(_0x565d94){logger[_0x2379('0xf')](_0x565d94[_0x2379('0x10')]);return null;}});if(_0x4a679e['finally']){logger[_0x2379('0x14')](util['format'](_0x2379('0x4d'),_0x23679a[_0x2379('0x19')],_0x23679a[_0x2379('0x1a')],_0x23679a[_0x2379('0x1e')],_0x23679a['dnid'],_0x23679a[_0x2379('0x1c')]));_0x10800d['traverseBFS'](_0x4a679e[_0x2379('0x4e')]['id'],function(_0x3aaede){try{_0x3aaede=_0x3f2a05[_0x2379('0x41')](_0x3aaede);logger[_0x2379('0x35')](_0x2379('0x42'),JSON[_0x2379('0x37')](_0x3aaede,null,0x2));if(_0x3aaede&&_0x3f2a05[_0x3aaede[_0x2379('0x22')]]){_0x506933=_0x3f2a05[_0x3aaede[_0x2379('0x22')]](_0x3aaede);if(_0x506933){logger[_0x2379('0x35')](_0x2379('0x48'),getLogFromObject(_0x506933));return _[_0x2379('0x49')](_0x506933[_0x2379('0x4a')])?null:_0x506933['result'][_0x2379('0x4b')]();}else{logger[_0x2379('0xf')](_0x2379('0x48'),getLogFromObject(_0x506933));return null;}}else{logger[_0x2379('0xf')]('agicommand\x20not\x20found');return null;}}catch(_0x5cd36b){logger[_0x2379('0xf')](_0x5cd36b['stack']);return null;}});}logger[_0x2379('0x14')](util[_0x2379('0x15')](_0x2379('0x4f'),_0x23679a[_0x2379('0x19')],_0x23679a['calleridname'],_0x23679a[_0x2379('0x1e')],_0x23679a[_0x2379('0x1b')],_0x23679a[_0x2379('0x1c')]));logger['info'](util[_0x2379('0x15')](_0x2379('0x50'),_0x23679a['context'],_0x23679a[_0x2379('0x46')],parseInt(_0x23679a[_0x2379('0x47')],0xa)+0x1));_0x23679a['continueAt'](_0x23679a[_0x2379('0x45')],_0x23679a['extension'],parseInt(_0x23679a['priority'],0xa)+0x1);_0x23679a['close']();}}else{logger['error'](util[_0x2379('0x15')](_0x2379('0x51'),_0x23679a[_0x2379('0x19')]));_0x23679a[_0x2379('0x52')](_0x23679a[_0x2379('0x45')],_0x23679a[_0x2379('0x46')],parseInt(_0x23679a[_0x2379('0x47')],0xa)+0x1);_0x23679a[_0x2379('0x38')]();}}else{logger[_0x2379('0xf')](util[_0x2379('0x15')](_0x2379('0x53'),_0x23679a['arg_1']));_0x23679a[_0x2379('0x52')](_0x23679a[_0x2379('0x45')],_0x23679a[_0x2379('0x46')],parseInt(_0x23679a['priority'],0xa)+0x1);_0x23679a['close']();}}function main(){var _0x383b6d;return utilLicense[_0x2379('0x54')]()[_0x2379('0x2e')](function(_0x145f4d){if(_0x145f4d){if(_0x145f4d[_0x2379('0x55')]){if(_0x145f4d['callysquare']&&_0x145f4d['callysquare']>0x0){logger[_0x2379('0x14')](util[_0x2379('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x145f4d[_0x2379('0x56')]));_0x383b6d=_0x145f4d[_0x2379('0x56')];}else{logger[_0x2379('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x2379('0x14')](_0x2379('0x57'));_0x383b6d=-0x1;}}})[_0x2379('0x30')](function(_0x127d77){logger[_0x2379('0xf')](_0x2379('0x58'),_0x127d77[_0x2379('0x10')]);})[_0x2379('0x4e')](function(){var _0x441b38=require(_0x2379('0x59'))(config['agi'][_0x2379('0x13')],config['agi']['ip'],_0x383b6d);_0x441b38['on']('error',errorHandler);_0x441b38['on'](_0x2379('0x5a'),listeningHandler);_0x441b38['on'](_0x2379('0x5b'),connectionHandler);_0x441b38['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0426a3d..c57240d 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1e8af4,_0x4b5ac0){var _0x34b1cc=function(_0x26767c){while(--_0x26767c){_0x1e8af4['push'](_0x1e8af4['shift']());}};_0x34b1cc(++_0x4b5ac0);}(_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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1682b6,_0x2c4aee){var _0x5a2480=function(_0x523237){while(--_0x523237){_0x1682b6['push'](_0x1682b6['shift']());}};_0x5a2480(++_0x2c4aee);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 7a60a12..bf0fa10 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(_0x30717e,_0xd96659){var _0x38e97f=function(_0x2b2eeb){while(--_0x2b2eeb){_0x30717e['push'](_0x30717e['shift']());}};_0x38e97f(++_0xd96659);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13eda4,_0x443061){_0x13eda4=_0x13eda4-0x0;var _0x4612fd=_0x5f2f[_0x13eda4];return _0x4612fd;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x3bbd21,_0x23f22d){var _0x11908b=function(_0x337f92){while(--_0x337f92){_0x3bbd21['push'](_0x3bbd21['shift']());}};_0x11908b(++_0x23f22d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a56df,_0x5eaec6){_0x2a56df=_0x2a56df-0x0;var _0x542a8f=_0x5f2f[_0x2a56df];return _0x542a8f;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1110cf8..5d9f1b8 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 _0x58bb=['merge','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','then','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x4f5121,_0x5edcb6){var _0x2c39cd=function(_0x3a2365){while(--_0x3a2365){_0x4f5121['push'](_0x4f5121['shift']());}};_0x2c39cd(++_0x5edcb6);}(_0x58bb,0x1d8));var _0xb58b=function(_0x398601,_0x52cfb0){_0x398601=_0x398601-0x0;var _0x112181=_0x58bb[_0x398601];return _0x112181;};'use strict';var BPromise=require(_0xb58b('0x0'));var moment=require(_0xb58b('0x1'));var _=require(_0xb58b('0x2'));var util=require(_0xb58b('0x3'));var jayson=require(_0xb58b('0x4'));var client=jayson[_0xb58b('0x5')]['http']({'port':0x2329});function request(_0x2fb9ed,_0x416c76){return new BPromise(function(_0x5ac983,_0x39fefd){return client['request'](_0x2fb9ed,_0x416c76)[_0xb58b('0x6')](function(_0x4d6a5f){if(_0x4d6a5f[_0xb58b('0x7')]){return _0x39fefd(_0x4d6a5f[_0xb58b('0x7')][_0xb58b('0x8')]);}else{return _0x5ac983(_0x4d6a5f[_0xb58b('0x9')]);}})[_0xb58b('0xa')](function(_0x3b6d3c){return _0x39fefd(_0x3b6d3c);});});}exports[_0xb58b('0xb')]=function(_0x1e44be){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x1e44be},'attributes':[_0xb58b('0xc')]}});};exports[_0xb58b('0xd')]=function(_0x23e672){return request(_0xb58b('0xe'),{'options':{'raw':![],'where':{'id':_0x23e672},'include':[{'model':_0xb58b('0xf'),'as':_0xb58b('0x10')}],'attributes':['id',_0xb58b('0x11'),_0xb58b('0x12')]}});};exports[_0xb58b('0x13')]=function(_0x34f8ff){return request('ShowSquareProject',{'options':{'where':{'id':_0x34f8ff},'attributes':[_0xb58b('0x11')]}});};exports['getVoiceQueueById']=function(_0x2cb309){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2cb309},'attributes':['name']}});};exports[_0xb58b('0x14')]=function(_0xc308a3){return request(_0xb58b('0x15'),{'options':{'where':{'id':_0xc308a3},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x557a23){return request(_0xb58b('0x16'),{'options':{'where':{'id':_0x557a23},'attributes':[_0xb58b('0x17')]}});};exports[_0xb58b('0x18')]=function(_0x2c8a92){return request(_0xb58b('0x19'),{'options':{'where':{'id':_0x2c8a92},'attributes':[_0xb58b('0x11')]}});};exports[_0xb58b('0x1a')]=function(_0x305d9b){return request(_0xb58b('0x1b'),{'options':{'where':{'id':_0x305d9b},'attributes':[_0xb58b('0x11')]}});};exports['getSoundById']=function(_0x470324){return request(_0xb58b('0x1c'),{'options':{'where':{'id':_0x470324},'attributes':[_0xb58b('0x1d')]}});};exports[_0xb58b('0x1e')]=function(_0xd9e5fb){return request(_0xb58b('0x1f'),{'options':{'raw':![],'where':{'id':_0xd9e5fb},'include':[{'model':_0xb58b('0x20'),'as':_0xb58b('0x21')}]}});};exports[_0xb58b('0x22')]=function(_0xd18aa7){return request(_0xb58b('0x23'),{'options':{'where':{'id':_0xd18aa7},'attributes':['id',_0xb58b('0x11')]}});};exports[_0xb58b('0x24')]=function(_0x453a6f){return request('CreateSmsMessage',{'body':_0x453a6f});};exports[_0xb58b('0x25')]=function(_0x2024bb){return request(_0xb58b('0x26'),{'body':_0x2024bb});};exports[_0xb58b('0x27')]=function(_0xf188fe){return request(_0xb58b('0x28'),{'body':_[_0xb58b('0x29')](_0xf188fe,{'project_name':_0xf188fe['arg_1'],'prev_project_name':_0xf188fe[_0xb58b('0x2a')]||'','is_subproject':_0xf188fe[_0xb58b('0x2a')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xb58b('0x2b')]=function(_0x329c6d){return request(_0xb58b('0x2c'),{'body':_0x329c6d});};exports[_0xb58b('0x2d')]=function(_0x17308f){return request('CreateSquareMessage',{'body':_0x17308f});};exports['createCmContact']=function(_0x23f329){return request(_0xb58b('0x2e'),{'options':{'raw':![],'where':{'phone':_0x23f329[_0xb58b('0x2f')],'ListId':_0x23f329[_0xb58b('0x30')]}}})[_0xb58b('0x6')](function(_0xab275){if(_0xab275){return _0xab275;}return request(_0xb58b('0x31'),{'body':_0x23f329});});};exports[_0xb58b('0x32')]=function(_0x707d13){return request(_0xb58b('0x33'),{'options':{'where':{'id':_0x707d13},'attributes':[_0xb58b('0x11')]}});};exports[_0xb58b('0x34')]=function(_0x2ce469,_0x45288c){return request(_0xb58b('0x35'),{'body':{'interface':_0x45288c},'options':{'where':_0x2ce469}});};exports['agentPause']=function(_0x348789,_0x359ed2,_0xa04ebe){return request(_0xb58b('0x36'),{'body':{'type':_0x359ed2,'uniqueid':_0xa04ebe},'options':{'where':_0x348789}});};exports['agentUnpause']=function(_0x23de11){return request(_0xb58b('0x37'),{'body':{},'options':{'where':_0x23de11}});};exports['agentLogout']=function(_0x458d3b){return request(_0xb58b('0x38'),{'body':{},'options':{'where':_0x458d3b}});}; \ No newline at end of file +var _0x6845=['ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x6845,0x1c2));var _0x5684=function(_0x1de0b2,_0x352f7f){_0x1de0b2=_0x1de0b2-0x0;var _0x3bcc72=_0x6845[_0x1de0b2];return _0x3bcc72;};'use strict';var BPromise=require(_0x5684('0x0'));var moment=require(_0x5684('0x1'));var _=require(_0x5684('0x2'));var util=require(_0x5684('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x5684('0x4')][_0x5684('0x5')]({'port':0x2329});function request(_0x5ca315,_0x607baf){return new BPromise(function(_0x3da080,_0x4545d3){return client[_0x5684('0x6')](_0x5ca315,_0x607baf)[_0x5684('0x7')](function(_0x57d271){if(_0x57d271['error']){return _0x4545d3(_0x57d271[_0x5684('0x8')][_0x5684('0x9')]);}else{return _0x3da080(_0x57d271[_0x5684('0xa')]);}})[_0x5684('0xb')](function(_0x7e7dd2){return _0x4545d3(_0x7e7dd2);});});}exports[_0x5684('0xc')]=function(_0x33ea2a){return request(_0x5684('0xd'),{'options':{'raw':![],'where':{'name':_0x33ea2a},'attributes':[_0x5684('0xe')]}});};exports[_0x5684('0xf')]=function(_0xd22df9){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xd22df9},'include':[{'model':_0x5684('0x10'),'as':_0x5684('0x11')}],'attributes':['id',_0x5684('0x12'),_0x5684('0x13')]}});};exports['getSquareProjectById']=function(_0xa891f7){return request(_0x5684('0xd'),{'options':{'where':{'id':_0xa891f7},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0xf41f45){return request(_0x5684('0x14'),{'options':{'where':{'id':_0xf41f45},'attributes':[_0x5684('0x12')]}});};exports['getVariableById']=function(_0x20150a){return request(_0x5684('0x15'),{'options':{'where':{'id':_0x20150a},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x16')]=function(_0x586561){return request(_0x5684('0x17'),{'options':{'where':{'id':_0x586561},'attributes':[_0x5684('0x18')]}});};exports[_0x5684('0x19')]=function(_0x23e029){return request(_0x5684('0x1a'),{'options':{'where':{'id':_0x23e029},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x1b')]=function(_0x12787d){return request(_0x5684('0x1c'),{'options':{'where':{'id':_0x12787d},'attributes':['name']}});};exports[_0x5684('0x1d')]=function(_0x337640){return request('ShowSound',{'options':{'where':{'id':_0x337640},'attributes':[_0x5684('0x1e')]}});};exports[_0x5684('0x1f')]=function(_0x53b4e6){return request(_0x5684('0x20'),{'options':{'raw':![],'where':{'id':_0x53b4e6},'include':[{'model':_0x5684('0x21'),'as':'Intervals'}]}});};exports[_0x5684('0x22')]=function(_0x2baaf2){return request(_0x5684('0x23'),{'options':{'where':{'id':_0x2baaf2},'attributes':['id',_0x5684('0x12')]}});};exports[_0x5684('0x24')]=function(_0x4a7fc8){return request(_0x5684('0x25'),{'body':_0x4a7fc8});};exports[_0x5684('0x26')]=function(_0x4e9aec){return request(_0x5684('0x27'),{'body':_0x4e9aec});};exports['createSquareReport']=function(_0x5a26cd){return request(_0x5684('0x28'),{'body':_[_0x5684('0x29')](_0x5a26cd,{'project_name':_0x5a26cd[_0x5684('0x2a')],'prev_project_name':_0x5a26cd['arg_2']||'','is_subproject':_0x5a26cd[_0x5684('0x2b')]?!![]:![],'leaveAt':moment()[_0x5684('0x2c')](_0x5684('0x2d'))})});};exports[_0x5684('0x2e')]=function(_0x44838e){return request('CreateSquareRecording',{'body':_0x44838e});};exports[_0x5684('0x2f')]=function(_0x195e8e){return request(_0x5684('0x30'),{'body':_0x195e8e});};exports[_0x5684('0x31')]=function(_0x17b9f3){return request(_0x5684('0x32'),{'options':{'raw':![],'where':{'phone':_0x17b9f3['phone'],'ListId':_0x17b9f3[_0x5684('0x33')]}}})[_0x5684('0x7')](function(_0x2f0f8f){if(_0x2f0f8f){return _0x2f0f8f;}return request(_0x5684('0x34'),{'body':_0x17b9f3});});};exports[_0x5684('0x35')]=function(_0x3f8508){return request(_0x5684('0x36'),{'options':{'where':{'id':_0x3f8508},'attributes':[_0x5684('0x12')]}});};exports[_0x5684('0x37')]=function(_0x4c1175,_0x412f8f){return request(_0x5684('0x38'),{'body':{'interface':_0x412f8f},'options':{'where':_0x4c1175}});};exports[_0x5684('0x39')]=function(_0x44322b,_0x4f3492,_0x2c7289){return request(_0x5684('0x3a'),{'body':{'type':_0x4f3492,'uniqueid':_0x2c7289},'options':{'where':_0x44322b}});};exports[_0x5684('0x3b')]=function(_0x298fbe){return request(_0x5684('0x3c'),{'body':{},'options':{'where':_0x298fbe}});};exports[_0x5684('0x3d')]=function(_0x4561dc){return request(_0x5684('0x3e'),{'body':{},'options':{'where':_0x4561dc}});}; \ 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 ff53bfa..56a7ad1 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 _0x55e0=['exports','./polly','./lex'];(function(_0x5400d9,_0x5a2440){var _0xe8f60e=function(_0x49ddcb){while(--_0x49ddcb){_0x5400d9['push'](_0x5400d9['shift']());}};_0xe8f60e(++_0x5a2440);}(_0x55e0,0xdc));var _0x055e=function(_0x1c3b3a,_0x434973){_0x1c3b3a=_0x1c3b3a-0x0;var _0x3437c4=_0x55e0[_0x1c3b3a];return _0x3437c4;};var polly=require(_0x055e('0x0'));var lex=require(_0x055e('0x1'));module[_0x055e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf021=['./polly','./lex','exports'];(function(_0x57ee1a,_0x18cad3){var _0x5c110c=function(_0x56b062){while(--_0x56b062){_0x57ee1a['push'](_0x57ee1a['shift']());}};_0x5c110c(++_0x18cad3);}(_0xf021,0x18f));var _0x1f02=function(_0x50c86a,_0x2fec99){_0x50c86a=_0x50c86a-0x0;var _0x53420a=_0xf021[_0x50c86a];return _0x53420a;};var polly=require(_0x1f02('0x0'));var lex=require(_0x1f02('0x1'));module[_0x1f02('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index e0db860..b968e8d 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 _0xa631=['exports'];(function(_0x14abc0,_0x137291){var _0xcf34b6=function(_0x3f6a0){while(--_0x3f6a0){_0x14abc0['push'](_0x14abc0['shift']());}};_0xcf34b6(++_0x137291);}(_0xa631,0xe4));var _0x1a63=function(_0x5a08da,_0x263ab1){_0x5a08da=_0x5a08da-0x0;var _0x3055e5=_0xa631[_0x5a08da];return _0x3055e5;};'use strict';var lex=require('./lib/api');module[_0x1a63('0x0')]=function(_0x1e771b,_0x17d7a7,_0x53c6fb,_0x265d0d,_0x584ab0,_0x536c8d){return lex(_0x1e771b,_0x17d7a7,_0x53c6fb,_0x265d0d,_0x584ab0,_0x536c8d);}; \ No newline at end of file +var _0xd52d=['exports'];(function(_0x57adc4,_0x5e592b){var _0x41a038=function(_0x1068dc){while(--_0x1068dc){_0x57adc4['push'](_0x57adc4['shift']());}};_0x41a038(++_0x5e592b);}(_0xd52d,0x1c7));var _0xdd52=function(_0x547029,_0x310816){_0x547029=_0x547029-0x0;var _0x57a812=_0xd52d[_0x547029];return _0x57a812;};'use strict';var lex=require('./lib/api');module[_0xdd52('0x0')]=function(_0x1dd2e9,_0x4a8e8e,_0x3bed6e,_0x52e3a8,_0x593052,_0x1dfed5){return lex(_0x1dd2e9,_0x4a8e8e,_0x3bed6e,_0x52e3a8,_0x593052,_0x1dfed5);}; \ 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 29eb0ff..f2174df 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 _0x8a74=['postText','slots','hasOwnProperty','slot_','LexRuntime','$LATEST','aws-sdk'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x8a74,0x1bf));var _0x48a7=function(_0x21acea,_0x281ead){_0x21acea=_0x21acea-0x0;var _0x447aac=_0x8a74[_0x21acea];return _0x447aac;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x48a7('0x0'));function lexResult(_0x331c18,_0x226c65){return new BPromise(function(_0x59b7a7,_0x1d0b48){_0x331c18[_0x48a7('0x1')](_0x226c65,function(_0x2f97e6,_0x3ad04c){if(_0x2f97e6){_0x1d0b48(_0x2f97e6);}if(_0x3ad04c[_0x48a7('0x2')]){for(const _0x29cd14 in _0x3ad04c[_0x48a7('0x2')]){if(_0x3ad04c['slots'][_0x48a7('0x3')](_0x29cd14)){var _0x18f186=_0x3ad04c[_0x48a7('0x2')][_0x29cd14];_0x3ad04c[_0x48a7('0x4')+_0x29cd14]=_0x18f186;}}}_0x59b7a7(_0x3ad04c);});});}module['exports']=function(_0x2ceb70,_0x3a0528,_0x3d3777,_0x4b46fb,_0x1a2be7,_0x41b20a){var _0x5848ad=new AWS[(_0x48a7('0x5'))]({'accessKeyId':_0x3a0528,'secretAccessKey':_0x3d3777,'region':_0x4b46fb});var _0x3a8663={'botAlias':_0x48a7('0x6'),'botName':_0x41b20a,'inputText':_0x1a2be7,'userId':_0x2ceb70};return lexResult(_0x5848ad,_0x3a8663);}; \ No newline at end of file +var _0x85b9=['aws-sdk','postText','slots','slot_','exports','LexRuntime','$LATEST','bluebird'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x85b9,0x127));var _0x985b=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x85b9[_0x44946b];return _0x249bc4;};'use strict';var BPromise=require(_0x985b('0x0'));var AWS=require(_0x985b('0x1'));function lexResult(_0x4971bf,_0x305e83){return new BPromise(function(_0x522307,_0xa420b9){_0x4971bf[_0x985b('0x2')](_0x305e83,function(_0x2eb6c4,_0x20a8ab){if(_0x2eb6c4){_0xa420b9(_0x2eb6c4);}if(_0x20a8ab[_0x985b('0x3')]){for(const _0x137526 in _0x20a8ab[_0x985b('0x3')]){if(_0x20a8ab[_0x985b('0x3')]['hasOwnProperty'](_0x137526)){var _0x4ad2be=_0x20a8ab[_0x985b('0x3')][_0x137526];_0x20a8ab[_0x985b('0x4')+_0x137526]=_0x4ad2be;}}}_0x522307(_0x20a8ab);});});}module[_0x985b('0x5')]=function(_0x237edc,_0x370903,_0x339dde,_0x3540ef,_0x462109,_0xf434b){var _0x592cff=new AWS[(_0x985b('0x6'))]({'accessKeyId':_0x370903,'secretAccessKey':_0x339dde,'region':_0x3540ef});var _0x335cc2={'botAlias':_0x985b('0x7'),'botName':_0xf434b,'inputText':_0x462109,'userId':_0x237edc};return lexResult(_0x592cff,_0x335cc2);}; \ 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 e8a3682..85cb52a 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 _0x0411=['exports','./lib/api'];(function(_0x32b402,_0x1b7069){var _0xb3e117=function(_0x54494d){while(--_0x54494d){_0x32b402['push'](_0x32b402['shift']());}};_0xb3e117(++_0x1b7069);}(_0x0411,0x8d));var _0x1041=function(_0x1933fe,_0x4dd1d2){_0x1933fe=_0x1933fe-0x0;var _0x3ccf9c=_0x0411[_0x1933fe];return _0x3ccf9c;};'use strict';var polly=require(_0x1041('0x0'));module[_0x1041('0x1')]=function(_0x23cfac,_0x48fb55,_0x57b762,_0xa06727,_0x596ab7,_0x2a4b8b,_0x5bc959){return polly(_0x23cfac,_0x48fb55,_0x57b762,_0xa06727,_0x596ab7,_0x2a4b8b,_0x5bc959);}; \ No newline at end of file +var _0x5423=['exports'];(function(_0x20f1f7,_0x4730b){var _0x10ef30=function(_0x596ceb){while(--_0x596ceb){_0x20f1f7['push'](_0x20f1f7['shift']());}};_0x10ef30(++_0x4730b);}(_0x5423,0x18a));var _0x3542=function(_0x223bc2,_0x38eae6){_0x223bc2=_0x223bc2-0x0;var _0x126d3d=_0x5423[_0x223bc2];return _0x126d3d;};'use strict';var polly=require('./lib/api');module[_0x3542('0x0')]=function(_0x1c799d,_0x2dfeb4,_0x4f59c7,_0x16affc,_0x21fa77,_0x1a7316,_0x3b4a4c){return polly(_0x1c799d,_0x2dfeb4,_0x4f59c7,_0x16affc,_0x21fa77,_0x1a7316,_0x3b4a4c);}; \ 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 de72598..5acb580 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 _0xbd87=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd87,0x11c));var _0x7bd8=function(_0x25fd7f,_0x1fc310){_0x25fd7f=_0x25fd7f-0x0;var _0x558eac=_0xbd87[_0x25fd7f];return _0x558eac;};'use strict';var fs=require('fs');var path=require(_0x7bd8('0x0'));var BPromise=require(_0x7bd8('0x1'));var rs=require('randomstring');var AWS=require(_0x7bd8('0x2'));function pollyResult(_0x163fa4,_0x32e5ac,_0x1ff6fc){return new BPromise(function(_0x42dd1b,_0x2b481e){_0x163fa4[_0x7bd8('0x3')](_0x32e5ac,function(_0xd41c8a,_0x5e76e2){if(_0xd41c8a){_0x2b481e(_0xd41c8a);}else if(_0x5e76e2){if(_0x5e76e2['AudioStream']instanceof Buffer){fs[_0x7bd8('0x4')](_0x1ff6fc,_0x5e76e2[_0x7bd8('0x5')],function(_0x5bedd1){if(_0x5bedd1){_0x2b481e(_0x5bedd1);}else{_0x42dd1b();}});}else{_0x2b481e(new Error(_0x7bd8('0x6')));}}else{_0x2b481e(new Error(_0x7bd8('0x7')));}});});}module[_0x7bd8('0x8')]=function(_0x562548,_0x3c4749,_0x5d90b7,_0x17e4bf,_0x2a6dad,_0x245b22,_0x26d83d){var _0x232b2c=new AWS[(_0x7bd8('0x9'))]({'accessKeyId':_0x562548,'secretAccessKey':_0x3c4749,'region':_0x5d90b7});var _0x24450b={'Text':_0x2a6dad,'TextType':_0x245b22||'text','OutputFormat':_0x7bd8('0xa'),'VoiceId':_0x17e4bf};return pollyResult(_0x232b2c,_0x24450b,_0x26d83d);}; \ No newline at end of file +var _0x0885=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly'];(function(_0x1c99c9,_0x439271){var _0x346c04=function(_0xc00940){while(--_0xc00940){_0x1c99c9['push'](_0x1c99c9['shift']());}};_0x346c04(++_0x439271);}(_0x0885,0x19c));var _0x5088=function(_0x50dcd2,_0x1781dd){_0x50dcd2=_0x50dcd2-0x0;var _0x3352d9=_0x0885[_0x50dcd2];return _0x3352d9;};'use strict';var fs=require('fs');var path=require(_0x5088('0x0'));var BPromise=require(_0x5088('0x1'));var rs=require(_0x5088('0x2'));var AWS=require(_0x5088('0x3'));function pollyResult(_0x4d3e82,_0x23c7ad,_0x19bd6e){return new BPromise(function(_0x1d7322,_0x4bc6ef){_0x4d3e82[_0x5088('0x4')](_0x23c7ad,function(_0x527862,_0x14d5b8){if(_0x527862){_0x4bc6ef(_0x527862);}else if(_0x14d5b8){if(_0x14d5b8[_0x5088('0x5')]instanceof Buffer){fs['writeFile'](_0x19bd6e,_0x14d5b8[_0x5088('0x5')],function(_0xa43ff4){if(_0xa43ff4){_0x4bc6ef(_0xa43ff4);}else{_0x1d7322();}});}else{_0x4bc6ef(new Error(_0x5088('0x6')));}}else{_0x4bc6ef(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x3f8249,_0x5f33a1,_0xdf94d8,_0x5c550e,_0x22f751,_0x471f42,_0x42a440){var _0x372198=new AWS[(_0x5088('0x7'))]({'accessKeyId':_0x3f8249,'secretAccessKey':_0x5f33a1,'region':_0xdf94d8});var _0x5a43fb={'Text':_0x22f751,'TextType':_0x471f42||_0x5088('0x8'),'OutputFormat':_0x5088('0x9'),'VoiceId':_0x5c550e};return pollyResult(_0x372198,_0x5a43fb,_0x42a440);}; \ 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 c55923f..14e7228 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 _0x293b=['exports'];(function(_0x2ce3b5,_0x30ce93){var _0x5423d2=function(_0x231b0f){while(--_0x231b0f){_0x2ce3b5['push'](_0x2ce3b5['shift']());}};_0x5423d2(++_0x30ce93);}(_0x293b,0x1ea));var _0xb293=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x293b[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0xb293('0x0')]=function(_0xa79dc5,_0x425796,_0x51f86c,_0x3b3734){return asr(_0xa79dc5,_0x425796,_0x51f86c);}; \ No newline at end of file +var _0x79f3=['./lib/api','exports'];(function(_0x269ae4,_0x34f5b7){var _0x9059e3=function(_0x363003){while(--_0x363003){_0x269ae4['push'](_0x269ae4['shift']());}};_0x9059e3(++_0x34f5b7);}(_0x79f3,0xee));var _0x379f=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x79f3[_0x2dea24];return _0x309d58;};'use strict';var asr=require(_0x379f('0x0'));module[_0x379f('0x1')]=function(_0x4189c0,_0x30765e,_0x3c8992,_0x2fb75c){return asr(_0x4189c0,_0x30765e,_0x3c8992);}; \ 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 8975f37..3daf5fa 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 _0xa1b2=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','https://speech.googleapis.com','exports'];(function(_0x10c04f,_0x21023f){var _0x3c0532=function(_0x5381a1){while(--_0x5381a1){_0x10c04f['push'](_0x10c04f['shift']());}};_0x3c0532(++_0x21023f);}(_0xa1b2,0xa8));var _0x2a1b=function(_0x41b7ef,_0x43d225){_0x41b7ef=_0x41b7ef-0x0;var _0x205cc8=_0xa1b2[_0x41b7ef];return _0x205cc8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x2a1b('0x0');module[_0x2a1b('0x1')]=function(_0x5800ff,_0x263e6d,_0x32568f){return new BPromise(function(_0x2e0deb,_0x36414d){var _0x504972;if(typeof _0x5800ff!==_0x2a1b('0x2')||_0x5800ff[_0x2a1b('0x3')]===0x0){return _0x36414d(_0x2a1b('0x4'));}if(typeof _0x263e6d!=='string'||_0x263e6d['length']===0x0){return _0x36414d(_0x2a1b('0x5'));}if(typeof _0x32568f!=='undefined'&&(typeof _0x32568f!==_0x2a1b('0x2')||_0x32568f[_0x2a1b('0x3')]===0x0)){return _0x36414d(_0x2a1b('0x6'));}try{_0x504972=fs[_0x2a1b('0x7')](_0x5800ff)[_0x2a1b('0x8')](_0x2a1b('0x9'));}catch(_0x48e319){return _0x36414d(_0x48e319);}return _0x2e0deb({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x263e6d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x32568f},'audio':{'content':_0x504972}},'json':!![]});});}; \ No newline at end of file +var _0x5189=['base64','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x4ec487,_0x3e0100){var _0x2cdbe5=function(_0x68e0fa){while(--_0x68e0fa){_0x4ec487['push'](_0x4ec487['shift']());}};_0x2cdbe5(++_0x3e0100);}(_0x5189,0x11a));var _0x9518=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x5189[_0x2b5b44];return _0x32cb66;};'use strict';var url=require(_0x9518('0x0'));var BPromise=require(_0x9518('0x1'));var fs=require('fs');var host=_0x9518('0x2');module[_0x9518('0x3')]=function(_0x3b8524,_0x5393e4,_0x30ffcb){return new BPromise(function(_0x36e299,_0x6ab8b){var _0x230cda;if(typeof _0x3b8524!==_0x9518('0x4')||_0x3b8524[_0x9518('0x5')]===0x0){return _0x6ab8b(_0x9518('0x6'));}if(typeof _0x5393e4!==_0x9518('0x4')||_0x5393e4[_0x9518('0x5')]===0x0){return _0x6ab8b(_0x9518('0x7'));}if(typeof _0x30ffcb!==_0x9518('0x8')&&(typeof _0x30ffcb!==_0x9518('0x4')||_0x30ffcb[_0x9518('0x5')]===0x0)){return _0x6ab8b(_0x9518('0x9'));}try{_0x230cda=fs[_0x9518('0xa')](_0x3b8524)[_0x9518('0xb')](_0x9518('0xc'));}catch(_0x18d5f8){return _0x6ab8b(_0x18d5f8);}return _0x36e299({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x5393e4,'body':{'config':{'encoding':_0x9518('0xd'),'sampleRateHertz':'8000','languageCode':_0x30ffcb},'audio':{'content':_0x230cda}},'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 15e4b1b..b707aa4 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 _0x9f91=['exports'];(function(_0x36ee2d,_0x6ba215){var _0x259e9c=function(_0x3d2c18){while(--_0x3d2c18){_0x36ee2d['push'](_0x36ee2d['shift']());}};_0x259e9c(++_0x6ba215);}(_0x9f91,0x14c));var _0x19f9=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x9f91[_0x1bc0ae];return _0x501104;};var asr=require('./asr');module[_0x19f9('0x0')]={'asr':asr}; \ No newline at end of file +var _0xa91a=['exports'];(function(_0x58b14b,_0x5ab912){var _0x5aec73=function(_0x43cdc1){while(--_0x43cdc1){_0x58b14b['push'](_0x58b14b['shift']());}};_0x5aec73(++_0x5ab912);}(_0xa91a,0x167));var _0xaa91=function(_0x2efc57,_0xadc556){_0x2efc57=_0x2efc57-0x0;var _0x5d5d56=_0xa91a[_0x2efc57];return _0x5d5d56;};var asr=require('./asr');module[_0xaa91('0x0')]={'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 d0ce971..de7eb98 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 _0xf250=['freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','http','parse','bluebird','randomstring','util','querystring','apiai-promise','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','resolve','.mp3','from','writeFile','split','googleTTS','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','googleDialogflow','stringify','result','resolvedQuery','action','actionIncomplete','fulfillment','status','code','endConversation','metadata','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s'];(function(_0x4b8435,_0x442eab){var _0x3aac28=function(_0x327f04){while(--_0x327f04){_0x4b8435['push'](_0x4b8435['shift']());}};_0x3aac28(++_0x442eab);}(_0xf250,0x135));var _0x0f25=function(_0x3ccdb0,_0x4adc30){_0x3ccdb0=_0x3ccdb0-0x0;var _0x58aa5b=_0xf250[_0x3ccdb0];return _0x58aa5b;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0x0f25('0x0'));var https=require('https');var urlParse=require('url')[_0x0f25('0x1')];var BPromise=require(_0x0f25('0x2'));var rs=require(_0x0f25('0x3'));var sox=require('sox');var rp=require('request-promise');var util=require(_0x0f25('0x4'));var querystring=require(_0x0f25('0x5'));var tts=require('google-tts-api');var apiai=require(_0x0f25('0x6'));var md5=require('md5');var google=require(_0x0f25('0x7'));var aws=require('./aws');var tilde=require('./tilde');var sestek=require(_0x0f25('0x8'));var logger=require(_0x0f25('0x9'))(_0x0f25('0xa'));var ISPEECH_API=_0x0f25('0xb');function downloadFile(_0xe4a5ae,_0x20ac2a){return new BPromise(function(_0x537cf3,_0x11b72d){var _0x5e6ea1=urlParse(_0xe4a5ae);var _0x46dc0a=_0x5e6ea1[_0x0f25('0xc')]===_0x0f25('0xd')?https:http;var _0x30dcf3={'host':_0x5e6ea1[_0x0f25('0xe')],'path':_0x5e6ea1[_0x0f25('0xf')],'headers':{'user-agent':_0x0f25('0x10')}};_0x46dc0a[_0x0f25('0x11')](_0x30dcf3,function(_0x545895){if(_0x545895[_0x0f25('0x12')]!==0xc8){logger[_0x0f25('0x13')](_0x0f25('0x14')+_0xe4a5ae+_0x0f25('0x15')+_0x545895[_0x0f25('0x12')]+'\x20('+_0x545895[_0x0f25('0x16')]+')');_0x11b72d(new Error(_0x0f25('0x14')+_0xe4a5ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x545895[_0x0f25('0x12')]+'\x20('+_0x545895[_0x0f25('0x16')]+')'));return;}var _0x11a7cf=fs['createWriteStream'](_0x20ac2a);_0x11a7cf['on']('finish',function(){logger[_0x0f25('0x17')](_0x0f25('0x18'));_0x11a7cf[_0x0f25('0x19')](_0x537cf3);});_0x11a7cf['on']('error',function(_0x122ab1){fs[_0x0f25('0x1a')](_0x20ac2a);logger['error']('download\x20error',_0x122ab1);_0x11b72d(_0x122ab1);});_0x545895[_0x0f25('0x1b')](_0x11a7cf);})['on']('error',function(_0x4b8b9e){logger['error'](_0x4b8b9e);_0x11b72d(_0x4b8b9e);})[_0x0f25('0x1c')]();});}function uploadFile(_0x1d3399){return new BPromise(function(_0x2fe703,_0x2c0366){var _0x523dcf=urlParse(_0x1d3399);var _0x23af9f=_0x523dcf['protocol']===_0x0f25('0xd')?https:http;var _0x666d11={'host':_0x523dcf['host'],'path':_0x523dcf[_0x0f25('0xf')],'headers':{'user-agent':_0x0f25('0x10')}};_0x23af9f[_0x0f25('0x11')](_0x666d11,function(_0x333e05){if(_0x333e05[_0x0f25('0x12')]!==0xc8){_0x2c0366(new Error(_0x0f25('0x14')+_0x1d3399+_0x0f25('0x15')+_0x333e05[_0x0f25('0x12')]+'\x20('+_0x333e05[_0x0f25('0x16')]+')'));return;}var _0x18bb90='';_0x333e05['on'](_0x0f25('0x1d'),function(_0x27a191){_0x18bb90+=_0x27a191;});_0x333e05['on'](_0x0f25('0x1c'),function(){_0x2fe703(_0x18bb90);});})['on'](_0x0f25('0x13'),function(_0x12cdec){_0x2c0366(_0x12cdec);})[_0x0f25('0x1c')]();});}function convertFile(_0x3e6057,_0x22c934){return new BPromise(function(_0x59f20e,_0x261c9c){var _0x44b839=sox[_0x0f25('0x1e')](_0x3e6057,_0x22c934,{'sampleRate':0x1f40,'format':_0x0f25('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44b839['on']('error',function(_0x259db5){logger[_0x0f25('0x13')](_0x0f25('0x20'),_0x259db5);_0x261c9c(_0x259db5);});_0x44b839['on'](_0x0f25('0x1c'),function(){logger[_0x0f25('0x17')](_0x0f25('0x21'));_0x59f20e();});_0x44b839[_0x0f25('0x22')]();});}function base64Decode(_0x19bd8f,_0x2c43e7){var _0xb76631=path['resolve'](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));fs[_0x0f25('0x26')](_0xb76631,_0x19bd8f,_0x0f25('0x27'));return convertFile(_0xb76631,_0x2c43e7)[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0xb76631);fs[_0x0f25('0x29')](_0x2c43e7,_0x0f25('0x2a'));}catch(_0x27da15){logger['error'](_0x27da15);}return _0x2c43e7['split']('.')[0x0];});}function base64Encode(_0x261a6f){var _0xafeecf=fs['readFileSync'](_0x261a6f);return new Buffer(_0xafeecf)[_0x0f25('0x2b')]('base64');}exports['googleCloudTTS']=function(_0x132a13,_0x17923a,_0x2c0fc6,_0x4ac456,_0x167c78,_0x59941e){var _0x23a841,_0x1dffcf;var _0x4935af=_0x0f25('0x2c');var _0x274812=_0x0f25('0x2d')+_0x132a13;var _0x9ef54={};if(_0x17923a===_0x0f25('0x2e')){_0x9ef54[_0x0f25('0x2f')]={'ssml':_0x2c0fc6};}else{_0x9ef54[_0x0f25('0x2f')]={'text':_0x2c0fc6};};_0x9ef54[_0x0f25('0x30')]={'languageCode':_0x4ac456,'ssmlGender':_0x167c78};_0x9ef54['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0xeea0a7={'url':_0x4935af+_0x0f25('0x31')+_0x274812,'method':_0x0f25('0x32'),'json':!![],'body':_0x9ef54};return rp(_0xeea0a7)['then'](function(_0x4def12){return new BPromise(function(_0x20c379,_0x58dce4){_0x23a841=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x34'));var _0x8534f0=Buffer[_0x0f25('0x35')](_0x4def12['audioContent'],_0x0f25('0x27'));return fs[_0x0f25('0x36')](_0x23a841,_0x8534f0,function(_0x4df40d){_0x58dce4(_0x4df40d);},function(_0x2c1a99){fs[_0x0f25('0x29')](_0x23a841,_0x0f25('0x2a'));_0x20c379(_0x2c1a99);});});})[_0x0f25('0x28')](function(_0xb4ef7b){_0x1dffcf=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x23a841,_0x1dffcf);})[_0x0f25('0x28')](function(){try{fs['unlink'](_0x23a841);fs['chmodSync'](_0x1dffcf,'777');}catch(_0x475b4){logger[_0x0f25('0x13')](_0x475b4);}logger[_0x0f25('0x17')]('googleCloudTTS\x20path',_0x1dffcf[_0x0f25('0x37')]('.')[0x0]);return _0x1dffcf['split']('.')[0x0];});};exports[_0x0f25('0x38')]=function(_0x122e60,_0x8fb8ef){var _0x326bc8,_0x2ab44a;return tts(_0x122e60,_0x8fb8ef||'en',0x1)[_0x0f25('0x28')](function(_0x59e785){logger['info'](_0x59e785);_0x326bc8=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+'.mp3');return downloadFile(_0x59e785,_0x326bc8);})['then'](function(){_0x2ab44a=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x326bc8,_0x2ab44a);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x326bc8);fs[_0x0f25('0x29')](_0x2ab44a,'777');}catch(_0x41c516){logger[_0x0f25('0x13')](_0x41c516);}logger[_0x0f25('0x17')](_0x0f25('0x39'),_0x2ab44a['split']('.')[0x0]);return _0x2ab44a[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x3a')]=function(_0x42427a,_0x3a8bc1,_0x3b8166){return google[_0x0f25('0x3b')](_0x42427a,_0x3a8bc1,_0x3b8166)[_0x0f25('0x28')](function(_0x2c022c){logger[_0x0f25('0x17')](_0x2c022c['uri']);return rp(_0x2c022c);})['then'](function(_0x4c303f){var _0x54da78='';var _0xcdd6e=0x0;try{fs[_0x0f25('0x1a')](_0x42427a);}catch(_0x2b8d7f){logger[_0x0f25('0x13')](_0x2b8d7f);}if(_0x4c303f&&_0x4c303f[_0x0f25('0x3c')]){_0x54da78=_0x4c303f['results'][_0x0f25('0x3d')](function(_0x3a1192){return _0x3a1192&&_0x3a1192[_0x0f25('0x3e')][0x0]&&_0x3a1192[_0x0f25('0x3e')][0x0]['transcript']?_0x3a1192[_0x0f25('0x3e')][0x0][_0x0f25('0x3f')]:'';})[_0x0f25('0x40')]('\x0a');_0xcdd6e=_0x4c303f['results'][_0x0f25('0x3d')](function(_0x4c9a95){return _0x4c9a95&&_0x4c9a95[_0x0f25('0x3e')][0x0]&&_0x4c9a95[_0x0f25('0x3e')][0x0]['confidence']?_0x4c9a95['alternatives'][0x0][_0x0f25('0x41')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x54da78);logger['info']('googleASR\x20confidence',_0xcdd6e);return{'transcript':_0x54da78,'confidence':_0xcdd6e};})[_0x0f25('0x42')](function(_0xae8b8){logger['error'](_0x0f25('0x43'),_0xae8b8[_0x0f25('0x12')],_0xae8b8['name'],_0xae8b8['message']);});};exports[_0x0f25('0x44')]=function(_0x1cf922,_0x16cf4b,_0x3bd3c8,_0x46fc68){var _0x411cd5=apiai(_0x16cf4b,{'language':_0x46fc68||'en'});return _0x411cd5['textRequest'](_0x3bd3c8,{'sessionId':md5(_0x1cf922)})[_0x0f25('0x28')](function(_0x197a7b){logger[_0x0f25('0x17')](JSON[_0x0f25('0x45')](_0x197a7b));return{'source':_0x197a7b[_0x0f25('0x46')]['source'],'resolvedQuery':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x47')],'action':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x48')],'actionIncomplete':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x49')],'speech':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x4a')]['speech'],'score':_0x197a7b[_0x0f25('0x46')]['score'],'statusCode':_0x197a7b[_0x0f25('0x4b')][_0x0f25('0x4c')],'endConversation':_0x197a7b[_0x0f25('0x46')]['metadata'][_0x0f25('0x4d')]||![],'isFallbackIntent':_0x197a7b[_0x0f25('0x46')][_0x0f25('0x4e')][_0x0f25('0x4f')]};});};exports[_0x0f25('0x50')]=function(_0x45478f,_0x34cc4a,_0x328b0d,_0x2e28a9){return tilde['asr'](_0x45478f,_0x34cc4a,_0x328b0d,_0x2e28a9)['then'](function(_0x5b4b31){try{fs[_0x0f25('0x1a')](_0x45478f);}catch(_0xaed1c7){logger[_0x0f25('0x13')](_0xaed1c7);}logger[_0x0f25('0x17')](_0x0f25('0x51'),_0x5b4b31['transcript']);logger['info'](_0x0f25('0x52'),_0x5b4b31[_0x0f25('0x41')]);return _0x5b4b31;});};exports[_0x0f25('0x53')]=function(_0x2adf77,_0x3d689a,_0x31dcc2,_0x4526b3,_0x385074,_0x2b7aee){var _0x11e2db=path['resolve'](__dirname,'tmp',rs[_0x0f25('0x24')](0x4)+_0x0f25('0x34'));var _0x53afae;return aws[_0x0f25('0x54')](_0x2adf77,_0x3d689a,_0x31dcc2,_0x4526b3,_0x385074,_0x2b7aee,_0x11e2db)[_0x0f25('0x28')](function(){_0x53afae=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x11e2db,_0x53afae);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x11e2db);fs[_0x0f25('0x29')](_0x53afae,_0x0f25('0x2a'));}catch(_0x51e425){logger[_0x0f25('0x13')](_0x51e425);}return _0x53afae[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x55')]=function(_0x35e93b,_0x255544,_0x3141ad,_0x8fe7da,_0x2f8870,_0x5f3924){return aws['lex'](_0x35e93b,_0x255544,_0x3141ad,_0x8fe7da,_0x2f8870,_0x5f3924)['then'](function(_0x130f10){logger[_0x0f25('0x17')](JSON['stringify'](_0x130f10));return _0x130f10;});};exports[_0x0f25('0x56')]=function(_0x64ca26,_0xf643a5,_0x7170dc,_0x4b7f8f){var _0x57e059=util[_0x0f25('0x57')](_0x0f25('0x58'),ISPEECH_API,_0x64ca26,encodeURIComponent(_0xf643a5),_0x7170dc,_0x4b7f8f);var _0x2237fd=path[_0x0f25('0x33')](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+'.mp3');var _0x2701e6;return downloadFile(_0x57e059,_0x2237fd)[_0x0f25('0x28')](function(){_0x2701e6=path['resolve'](__dirname,_0x0f25('0x23'),rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25'));return convertFile(_0x2237fd,_0x2701e6);})[_0x0f25('0x28')](function(){try{fs[_0x0f25('0x1a')](_0x2237fd);fs[_0x0f25('0x29')](_0x2701e6,_0x0f25('0x2a'));}catch(_0x3aa277){logger['error'](_0x3aa277);}return _0x2701e6[_0x0f25('0x37')]('.')[0x0];});};exports[_0x0f25('0x59')]=function(_0x75b169,_0x23b21f,_0x2206d9,_0x5c4f10){var _0xaa1578=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x23b21f,_0x2206d9,base64Encode(_0x75b169),_0x5c4f10?util[_0x0f25('0x57')](_0x0f25('0x5a'),encodeURIComponent(_0x5c4f10)):_0x0f25('0x5b'));return uploadFile(_0xaa1578)['then'](function(_0x18b95e){return querystring[_0x0f25('0x1')](_0x18b95e);});};exports[_0x0f25('0x5c')]=function(_0x5688df,_0x310c6c){return sestek['nda'](_0x5688df,_0x310c6c)[_0x0f25('0x28')](function(_0x4b156e){logger[_0x0f25('0x17')](JSON['stringify'](_0x4b156e));var _0x22c0ff={'speech':_0x4b156e[_0x0f25('0x5d')],'action':_0x4b156e[_0x0f25('0x5e')]?_0x4b156e[_0x0f25('0x5e')][_0x0f25('0x5f')]:undefined,'actiondata':_0x4b156e[_0x0f25('0x5e')]?_0x4b156e[_0x0f25('0x5e')]['CustomActionData']:undefined};if(_0x4b156e['channelData']&&_0x4b156e['channelData'][_0x0f25('0x60')]){return base64Decode(_0x4b156e['channelData']['AudioFromTts'][_0x0f25('0x61')],path[_0x0f25('0x33')](__dirname,'tmp',rs[_0x0f25('0x24')](0x4)+_0x0f25('0x25')))[_0x0f25('0x28')](function(_0x326f24){_0x22c0ff[_0x0f25('0x62')]=_0x326f24;return _0x22c0ff;});}return _0x22c0ff;});};exports[_0x0f25('0x63')]=function(){return __dirname;}; \ No newline at end of file +var _0x3fa9=['score','status','code','endConversation','metadata','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','parse','bluebird','sox','util','querystring','google-tts-api','apiai-promise','./google','./aws','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','ssml','input','audioConfig','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','transcript','join','map','alternatives','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','action','actionIncomplete','fulfillment','speech'];(function(_0x329015,_0x42a7fd){var _0x502b1c=function(_0x18137f){while(--_0x18137f){_0x329015['push'](_0x329015['shift']());}};_0x502b1c(++_0x42a7fd);}(_0x3fa9,0xe8));var _0x93fa=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x3fa9[_0x1b828b];return _0x98da1a;};'use strict';var fs=require('fs');var path=require(_0x93fa('0x0'));var http=require(_0x93fa('0x1'));var https=require(_0x93fa('0x2'));var urlParse=require('url')[_0x93fa('0x3')];var BPromise=require(_0x93fa('0x4'));var rs=require('randomstring');var sox=require(_0x93fa('0x5'));var rp=require('request-promise');var util=require(_0x93fa('0x6'));var querystring=require(_0x93fa('0x7'));var tts=require(_0x93fa('0x8'));var apiai=require(_0x93fa('0x9'));var md5=require('md5');var google=require(_0x93fa('0xa'));var aws=require(_0x93fa('0xb'));var tilde=require('./tilde');var sestek=require('./sestek');var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x93fa('0xc');function downloadFile(_0x49999a,_0x4a7a39){return new BPromise(function(_0x1653bd,_0x114f27){var _0x118ec8=urlParse(_0x49999a);var _0x5d1222=_0x118ec8[_0x93fa('0xd')]===_0x93fa('0xe')?https:http;var _0x1bab2f={'host':_0x118ec8[_0x93fa('0xf')],'path':_0x118ec8[_0x93fa('0x0')],'headers':{'user-agent':_0x93fa('0x10')}};_0x5d1222[_0x93fa('0x11')](_0x1bab2f,function(_0x4398aa){if(_0x4398aa[_0x93fa('0x12')]!==0xc8){logger[_0x93fa('0x13')](_0x93fa('0x14')+_0x49999a+_0x93fa('0x15')+_0x4398aa[_0x93fa('0x12')]+'\x20('+_0x4398aa[_0x93fa('0x16')]+')');_0x114f27(new Error(_0x93fa('0x14')+_0x49999a+_0x93fa('0x15')+_0x4398aa[_0x93fa('0x12')]+'\x20('+_0x4398aa[_0x93fa('0x16')]+')'));return;}var _0x4e28b4=fs[_0x93fa('0x17')](_0x4a7a39);_0x4e28b4['on'](_0x93fa('0x18'),function(){logger[_0x93fa('0x19')](_0x93fa('0x1a'));_0x4e28b4['close'](_0x1653bd);});_0x4e28b4['on'](_0x93fa('0x13'),function(_0x3d6369){fs[_0x93fa('0x1b')](_0x4a7a39);logger[_0x93fa('0x13')](_0x93fa('0x1c'),_0x3d6369);_0x114f27(_0x3d6369);});_0x4398aa[_0x93fa('0x1d')](_0x4e28b4);})['on']('error',function(_0x21c13e){logger[_0x93fa('0x13')](_0x21c13e);_0x114f27(_0x21c13e);})['end']();});}function uploadFile(_0x314b69){return new BPromise(function(_0x1362f5,_0x2a8927){var _0x42d560=urlParse(_0x314b69);var _0x8656fb=_0x42d560[_0x93fa('0xd')]===_0x93fa('0xe')?https:http;var _0x491744={'host':_0x42d560[_0x93fa('0xf')],'path':_0x42d560[_0x93fa('0x0')],'headers':{'user-agent':_0x93fa('0x10')}};_0x8656fb[_0x93fa('0x11')](_0x491744,function(_0xdd6fec){if(_0xdd6fec[_0x93fa('0x12')]!==0xc8){_0x2a8927(new Error('request\x20to\x20'+_0x314b69+_0x93fa('0x15')+_0xdd6fec[_0x93fa('0x12')]+'\x20('+_0xdd6fec['statusMessage']+')'));return;}var _0x4830a0='';_0xdd6fec['on'](_0x93fa('0x1e'),function(_0x22eeef){_0x4830a0+=_0x22eeef;});_0xdd6fec['on'](_0x93fa('0x1f'),function(){_0x1362f5(_0x4830a0);});})['on']('error',function(_0xcfb003){_0x2a8927(_0xcfb003);})[_0x93fa('0x1f')]();});}function convertFile(_0x4ee26e,_0xa9044a){return new BPromise(function(_0x9ab873,_0x13dd41){var _0x541478=sox[_0x93fa('0x20')](_0x4ee26e,_0xa9044a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x541478['on'](_0x93fa('0x13'),function(_0x3d3b89){logger[_0x93fa('0x13')](_0x93fa('0x21'),_0x3d3b89);_0x13dd41(_0x3d3b89);});_0x541478['on'](_0x93fa('0x1f'),function(){logger[_0x93fa('0x19')](_0x93fa('0x22'));_0x9ab873();});_0x541478[_0x93fa('0x23')]();});}function base64Decode(_0x4cdbf2,_0x53adf4){var _0x28ed99=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs[_0x93fa('0x26')](0x4)+_0x93fa('0x27'));fs[_0x93fa('0x28')](_0x28ed99,_0x4cdbf2,_0x93fa('0x29'));return convertFile(_0x28ed99,_0x53adf4)[_0x93fa('0x2a')](function(){try{fs[_0x93fa('0x1b')](_0x28ed99);fs[_0x93fa('0x2b')](_0x53adf4,_0x93fa('0x2c'));}catch(_0x56b6d7){logger['error'](_0x56b6d7);}return _0x53adf4[_0x93fa('0x2d')]('.')[0x0];});}function base64Encode(_0x11e994){var _0x51aa2b=fs['readFileSync'](_0x11e994);return new Buffer(_0x51aa2b)[_0x93fa('0x2e')](_0x93fa('0x29'));}exports[_0x93fa('0x2f')]=function(_0x470d97,_0x4f840d,_0x564320,_0x3d8cb5,_0x118769,_0x292b64){var _0x7c6f90,_0x4db5cb;var _0x4c9261='https://texttospeech.googleapis.com/v1/';var _0x1c317c='?key='+_0x470d97;var _0x2cac8f={};if(_0x4f840d===_0x93fa('0x30')){_0x2cac8f['input']={'ssml':_0x564320};}else{_0x2cac8f[_0x93fa('0x31')]={'text':_0x564320};};_0x2cac8f['voice']={'languageCode':_0x3d8cb5,'ssmlGender':_0x118769};_0x2cac8f[_0x93fa('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x177d2d={'url':_0x4c9261+'text:synthesize'+_0x1c317c,'method':'POST','json':!![],'body':_0x2cac8f};return rp(_0x177d2d)['then'](function(_0x32bc7c){return new BPromise(function(_0x22206d,_0xd0b0b1){_0x7c6f90=path['resolve'](__dirname,_0x93fa('0x25'),rs[_0x93fa('0x26')](0x4)+'.mp3');var _0x275bea=Buffer['from'](_0x32bc7c[_0x93fa('0x33')],_0x93fa('0x29'));return fs[_0x93fa('0x34')](_0x7c6f90,_0x275bea,function(_0x459c8a){_0xd0b0b1(_0x459c8a);},function(_0xceff0){fs['chmodSync'](_0x7c6f90,'777');_0x22206d(_0xceff0);});});})[_0x93fa('0x2a')](function(_0x30484a){_0x4db5cb=path[_0x93fa('0x24')](__dirname,'tmp',rs[_0x93fa('0x26')](0x4)+_0x93fa('0x27'));return convertFile(_0x7c6f90,_0x4db5cb);})[_0x93fa('0x2a')](function(){try{fs[_0x93fa('0x1b')](_0x7c6f90);fs[_0x93fa('0x2b')](_0x4db5cb,_0x93fa('0x2c'));}catch(_0x36aa26){logger['error'](_0x36aa26);}logger[_0x93fa('0x19')](_0x93fa('0x35'),_0x4db5cb[_0x93fa('0x2d')]('.')[0x0]);return _0x4db5cb['split']('.')[0x0];});};exports[_0x93fa('0x36')]=function(_0x5dedda,_0x45ffb6){var _0x335f06,_0x228962;return tts(_0x5dedda,_0x45ffb6||'en',0x1)[_0x93fa('0x2a')](function(_0x2bea9b){logger['info'](_0x2bea9b);_0x335f06=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs['generate'](0x4)+_0x93fa('0x37'));return downloadFile(_0x2bea9b,_0x335f06);})['then'](function(){_0x228962=path[_0x93fa('0x24')](__dirname,'tmp',rs[_0x93fa('0x26')](0x4)+_0x93fa('0x27'));return convertFile(_0x335f06,_0x228962);})[_0x93fa('0x2a')](function(){try{fs[_0x93fa('0x1b')](_0x335f06);fs['chmodSync'](_0x228962,'777');}catch(_0xa15353){logger[_0x93fa('0x13')](_0xa15353);}logger['info'](_0x93fa('0x38'),_0x228962[_0x93fa('0x2d')]('.')[0x0]);return _0x228962['split']('.')[0x0];});};exports[_0x93fa('0x39')]=function(_0x9183cf,_0x150a0c,_0x23d455){return google[_0x93fa('0x3a')](_0x9183cf,_0x150a0c,_0x23d455)[_0x93fa('0x2a')](function(_0x3fd4c3){logger['info'](_0x3fd4c3[_0x93fa('0x3b')]);return rp(_0x3fd4c3);})[_0x93fa('0x2a')](function(_0x34c0d4){var _0x3b4616='';var _0x3fc67c=0x0;try{fs['unlink'](_0x9183cf);}catch(_0x347d91){logger[_0x93fa('0x13')](_0x347d91);}if(_0x34c0d4&&_0x34c0d4[_0x93fa('0x3c')]){_0x3b4616=_0x34c0d4[_0x93fa('0x3c')]['map'](function(_0x5907db){return _0x5907db&&_0x5907db['alternatives'][0x0]&&_0x5907db['alternatives'][0x0][_0x93fa('0x3d')]?_0x5907db['alternatives'][0x0]['transcript']:'';})[_0x93fa('0x3e')]('\x0a');_0x3fc67c=_0x34c0d4[_0x93fa('0x3c')][_0x93fa('0x3f')](function(_0x21076a){return _0x21076a&&_0x21076a[_0x93fa('0x40')][0x0]&&_0x21076a['alternatives'][0x0][_0x93fa('0x41')]?_0x21076a['alternatives'][0x0][_0x93fa('0x41')]:0x0;})['join']('\x0a');}logger[_0x93fa('0x19')](_0x93fa('0x42'),_0x3b4616);logger[_0x93fa('0x19')]('googleASR\x20confidence',_0x3fc67c);return{'transcript':_0x3b4616,'confidence':_0x3fc67c};})[_0x93fa('0x43')](function(_0x20e29b){logger[_0x93fa('0x13')](_0x93fa('0x44'),_0x20e29b[_0x93fa('0x12')],_0x20e29b[_0x93fa('0x45')],_0x20e29b[_0x93fa('0x46')]);});};exports[_0x93fa('0x47')]=function(_0x379f16,_0x2aec44,_0xb93856,_0x45ab16){var _0x724e70=apiai(_0x2aec44,{'language':_0x45ab16||'en'});return _0x724e70[_0x93fa('0x48')](_0xb93856,{'sessionId':md5(_0x379f16)})[_0x93fa('0x2a')](function(_0x20ec08){logger[_0x93fa('0x19')](JSON[_0x93fa('0x49')](_0x20ec08));return{'source':_0x20ec08[_0x93fa('0x4a')][_0x93fa('0x4b')],'resolvedQuery':_0x20ec08['result']['resolvedQuery'],'action':_0x20ec08[_0x93fa('0x4a')][_0x93fa('0x4c')],'actionIncomplete':_0x20ec08['result'][_0x93fa('0x4d')],'speech':_0x20ec08['result'][_0x93fa('0x4e')][_0x93fa('0x4f')],'score':_0x20ec08[_0x93fa('0x4a')][_0x93fa('0x50')],'statusCode':_0x20ec08[_0x93fa('0x51')][_0x93fa('0x52')],'endConversation':_0x20ec08['result']['metadata'][_0x93fa('0x53')]||![],'isFallbackIntent':_0x20ec08[_0x93fa('0x4a')][_0x93fa('0x54')][_0x93fa('0x55')]};});};exports['tildeASR']=function(_0x73d16e,_0x46a313,_0xaf9e67,_0x3dd2f1){return tilde[_0x93fa('0x3a')](_0x73d16e,_0x46a313,_0xaf9e67,_0x3dd2f1)['then'](function(_0x456801){try{fs[_0x93fa('0x1b')](_0x73d16e);}catch(_0x95ebf2){logger[_0x93fa('0x13')](_0x95ebf2);}logger['info'](_0x93fa('0x56'),_0x456801[_0x93fa('0x3d')]);logger[_0x93fa('0x19')](_0x93fa('0x57'),_0x456801[_0x93fa('0x41')]);return _0x456801;});};exports[_0x93fa('0x58')]=function(_0x6c35ac,_0x2c48f3,_0xf06b5b,_0x35fca6,_0x52e17e,_0xf6b117){var _0x18c8bd=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs['generate'](0x4)+_0x93fa('0x37'));var _0x147199;return aws['polly'](_0x6c35ac,_0x2c48f3,_0xf06b5b,_0x35fca6,_0x52e17e,_0xf6b117,_0x18c8bd)[_0x93fa('0x2a')](function(){_0x147199=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs[_0x93fa('0x26')](0x4)+_0x93fa('0x27'));return convertFile(_0x18c8bd,_0x147199);})[_0x93fa('0x2a')](function(){try{fs[_0x93fa('0x1b')](_0x18c8bd);fs[_0x93fa('0x2b')](_0x147199,_0x93fa('0x2c'));}catch(_0xd9bff6){logger['error'](_0xd9bff6);}return _0x147199[_0x93fa('0x2d')]('.')[0x0];});};exports[_0x93fa('0x59')]=function(_0x352032,_0xad4c32,_0x525bf1,_0x2da8b2,_0x2b4950,_0x5203b2){return aws[_0x93fa('0x5a')](_0x352032,_0xad4c32,_0x525bf1,_0x2da8b2,_0x2b4950,_0x5203b2)[_0x93fa('0x2a')](function(_0x1af4da){logger['info'](JSON[_0x93fa('0x49')](_0x1af4da));return _0x1af4da;});};exports['ispeechTTS']=function(_0x5ca117,_0x309d42,_0x2379b5,_0x31d167){var _0x5a55d9=util[_0x93fa('0x5b')](_0x93fa('0x5c'),ISPEECH_API,_0x5ca117,encodeURIComponent(_0x309d42),_0x2379b5,_0x31d167);var _0x52aa2f=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs[_0x93fa('0x26')](0x4)+_0x93fa('0x37'));var _0x13b221;return downloadFile(_0x5a55d9,_0x52aa2f)[_0x93fa('0x2a')](function(){_0x13b221=path[_0x93fa('0x24')](__dirname,_0x93fa('0x25'),rs['generate'](0x4)+_0x93fa('0x27'));return convertFile(_0x52aa2f,_0x13b221);})[_0x93fa('0x2a')](function(){try{fs['unlink'](_0x52aa2f);fs[_0x93fa('0x2b')](_0x13b221,'777');}catch(_0x2b7846){logger['error'](_0x2b7846);}return _0x13b221[_0x93fa('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4a0840,_0x5a5cd5,_0xbebb70,_0x1292aa){var _0x5a2ed8=util[_0x93fa('0x5b')](_0x93fa('0x5d'),ISPEECH_API,_0x5a5cd5,_0xbebb70,base64Encode(_0x4a0840),_0x1292aa?util['format']('model=%s',encodeURIComponent(_0x1292aa)):_0x93fa('0x5e'));return uploadFile(_0x5a2ed8)[_0x93fa('0x2a')](function(_0x1a1cd2){return querystring[_0x93fa('0x3')](_0x1a1cd2);});};exports['sestekNDA']=function(_0xe2f70e,_0x53d0bf){return sestek[_0x93fa('0x5f')](_0xe2f70e,_0x53d0bf)['then'](function(_0x2fc912){logger[_0x93fa('0x19')](JSON[_0x93fa('0x49')](_0x2fc912));var _0x4c92b3={'speech':_0x2fc912[_0x93fa('0x60')],'action':_0x2fc912[_0x93fa('0x61')]?_0x2fc912['channelData'][_0x93fa('0x62')]:undefined,'actiondata':_0x2fc912[_0x93fa('0x61')]?_0x2fc912[_0x93fa('0x61')][_0x93fa('0x63')]:undefined};if(_0x2fc912[_0x93fa('0x61')]&&_0x2fc912[_0x93fa('0x61')]['AudioFromTts']){return base64Decode(_0x2fc912[_0x93fa('0x61')][_0x93fa('0x64')][_0x93fa('0x65')],path[_0x93fa('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x93fa('0x27')))[_0x93fa('0x2a')](function(_0x4e7d5d){_0x4c92b3[_0x93fa('0x66')]=_0x4e7d5d;return _0x4c92b3;});}return _0x4c92b3;});};exports[_0x93fa('0x67')]=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 5485171..fb94fcf 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 _0x5392=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5392,0xa7));var _0x2539=function(_0x46b1bd,_0x1940d9){_0x46b1bd=_0x46b1bd-0x0;var _0x1b2f0e=_0x5392[_0x46b1bd];return _0x1b2f0e;};var nda=require('./nda');module[_0x2539('0x0')]={'nda':nda}; \ No newline at end of file +var _0xe240=['exports','./nda'];(function(_0x516c0b,_0x581e8e){var _0x5c69ac=function(_0x75d9dc){while(--_0x75d9dc){_0x516c0b['push'](_0x516c0b['shift']());}};_0x5c69ac(++_0x581e8e);}(_0xe240,0x1a5));var _0x0e24=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe240[_0xfae23b];return _0x200640;};var nda=require(_0x0e24('0x0'));module[_0x0e24('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 aa42355..0f19555 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 _0xbe43=['ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','project','body','ProjectName','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','resolve'];(function(_0x11259f,_0x23b506){var _0x356dad=function(_0x5045e6){while(--_0x5045e6){_0x11259f['push'](_0x11259f['shift']());}};_0x356dad(++_0x23b506);}(_0xbe43,0x1b1));var _0x3be4=function(_0x1c11ab,_0x38350b){_0x1c11ab=_0x1c11ab-0x0;var _0x5238ff=_0xbe43[_0x1c11ab];return _0x5238ff;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x3be4('0x0'))('agi');module['exports']=function(_0xdd0a65,_0x2e6a57){var _0x33b384={'method':'POST','uri':url[_0x3be4('0x1')](_0x2e6a57[_0x3be4('0x2')],_0x3be4('0x3')),'form':{'grant_type':_0x3be4('0x4'),'username':_0x2e6a57[_0x3be4('0x5')],'password':_0x2e6a57[_0x3be4('0x4')]},'json':!![]};return rp(_0x33b384)[_0x3be4('0x6')](function(_0x303028){var _0x153b2e={'method':_0x3be4('0x7'),'uri':url[_0x3be4('0x1')](_0x2e6a57[_0x3be4('0x8')],_0x3be4('0x9')),'body':{'type':_0x2e6a57[_0x3be4('0xa')]||_0x3be4('0xb'),'channelId':_0x3be4('0xc'),'conversation':{'id':_0xdd0a65[_0x3be4('0xd')]},'from':{'id':_0xdd0a65[_0x3be4('0xe')],'name':_0xdd0a65[_0x3be4('0xf')]},'recipient':{'id':_0xdd0a65[_0x3be4('0x10')],'name':_0xdd0a65[_0x3be4('0x11')]},'text':_0x2e6a57['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x303028['access_token']},'json':!![]};if(_0x2e6a57[_0x3be4('0x12')]){_0x153b2e[_0x3be4('0x13')]['channelData'][_0x3be4('0x14')]=_0x2e6a57[_0x3be4('0x12')];}if(_0x2e6a57['ndagenerate_audio']=='1'){_0x153b2e[_0x3be4('0x13')][_0x3be4('0x15')][_0x3be4('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3be4('0x17')};}if(_0x2e6a57[_0x3be4('0x18')]){_0x153b2e[_0x3be4('0x13')][_0x3be4('0x15')]['CustomAction']=_0x2e6a57[_0x3be4('0x18')];if(_0x2e6a57[_0x3be4('0x19')]){_0x153b2e['body'][_0x3be4('0x15')][_0x3be4('0x1a')]=_0x2e6a57[_0x3be4('0x19')];}}logger[_0x3be4('0x1b')](JSON[_0x3be4('0x1c')](_0x153b2e));return rp(_0x153b2e);});}; \ No newline at end of file +var _0xcf09=['CustomAction','custom_action_data','CustomActionData','request-promise','url','../../../../../config/logger','exports','then','POST','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','body','custom_action'];(function(_0x23bcd4,_0xd3deb0){var _0x4cb792=function(_0x48d4c8){while(--_0x48d4c8){_0x23bcd4['push'](_0x23bcd4['shift']());}};_0x4cb792(++_0xd3deb0);}(_0xcf09,0x1b3));var _0x9cf0=function(_0x5c025a,_0x4ee23a){_0x5c025a=_0x5c025a-0x0;var _0xccb420=_0xcf09[_0x5c025a];return _0xccb420;};'use strict';var rp=require(_0x9cf0('0x0'));var url=require(_0x9cf0('0x1'));var logger=require(_0x9cf0('0x2'))('agi');module[_0x9cf0('0x3')]=function(_0x5106b0,_0x3742f2){var _0xb0727a={'method':'POST','uri':url['resolve'](_0x3742f2['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x3742f2['username'],'password':_0x3742f2['password']},'json':!![]};return rp(_0xb0727a)[_0x9cf0('0x4')](function(_0x1a94de){var _0x2c8646={'method':_0x9cf0('0x5'),'uri':url['resolve'](_0x3742f2[_0x9cf0('0x6')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3742f2[_0x9cf0('0x7')]||_0x9cf0('0x8'),'channelId':'Nda','conversation':{'id':_0x5106b0[_0x9cf0('0x9')]},'from':{'id':_0x5106b0[_0x9cf0('0xa')],'name':_0x5106b0['calleridname']},'recipient':{'id':_0x5106b0[_0x9cf0('0xb')],'name':_0x5106b0[_0x9cf0('0xc')]},'text':_0x3742f2['text'],'channelData':{}},'headers':{'Authorization':_0x9cf0('0xd')+_0x1a94de[_0x9cf0('0xe')]},'json':!![]};if(_0x3742f2[_0x9cf0('0xf')]){_0x2c8646['body'][_0x9cf0('0x10')][_0x9cf0('0x11')]=_0x3742f2[_0x9cf0('0xf')];}if(_0x3742f2[_0x9cf0('0x12')]=='1'){_0x2c8646[_0x9cf0('0x13')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3742f2[_0x9cf0('0x14')]){_0x2c8646[_0x9cf0('0x13')][_0x9cf0('0x10')][_0x9cf0('0x15')]=_0x3742f2[_0x9cf0('0x14')];if(_0x3742f2[_0x9cf0('0x16')]){_0x2c8646[_0x9cf0('0x13')]['channelData'][_0x9cf0('0x17')]=_0x3742f2[_0x9cf0('0x16')];}}logger['info'](JSON['stringify'](_0x2c8646));return rp(_0x2c8646);});}; \ 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 66d3414..11de24c 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8db=['exports','./lib/api'];(function(_0x309a31,_0x2ef3a9){var _0x66ad20=function(_0x1ae547){while(--_0x1ae547){_0x309a31['push'](_0x309a31['shift']());}};_0x66ad20(++_0x2ef3a9);}(_0xd8db,0x69));var _0xbd8d=function(_0x51a8ea,_0x3c6785){_0x51a8ea=_0x51a8ea-0x0;var _0x516fb1=_0xd8db[_0x51a8ea];return _0x516fb1;};'use strict';var asr=require(_0xbd8d('0x0'));module[_0xbd8d('0x1')]=function(_0x4409cf,_0x2729e6,_0x1cc609,_0x47f249){return asr(_0x4409cf,_0x2729e6,_0x1cc609,_0x47f249);}; \ No newline at end of file +var _0x9e11=['exports','./lib/api'];(function(_0x3a0420,_0x521d62){var _0x4ca2cd=function(_0x1e388d){while(--_0x1e388d){_0x3a0420['push'](_0x3a0420['shift']());}};_0x4ca2cd(++_0x521d62);}(_0x9e11,0x101));var _0x19e1=function(_0x25a1c9,_0x2ae6d7){_0x25a1c9=_0x25a1c9-0x0;var _0x4d0bab=_0x9e11[_0x25a1c9];return _0x4d0bab;};'use strict';var asr=require(_0x19e1('0x0'));module[_0x19e1('0x1')]=function(_0x58bae7,_0x1158ce,_0x4f9cc6,_0x42de60){return asr(_0x58bae7,_0x1158ce,_0x4f9cc6,_0x42de60);}; \ 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 b59a3fa..05a778e 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 _0xf32f=['final','hypotheses','transcript','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','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','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','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xf32f,0x1ef));var _0xff32=function(_0x408501,_0x81d8df){_0x408501=_0x408501-0x0;var _0x16f85f=_0xf32f[_0x408501];return _0x16f85f;};'use strict';var BPromise=require(_0xff32('0x0'));var _=require(_0xff32('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xff32('0x2'));var logger=require(_0xff32('0x3'))('agi');module[_0xff32('0x4')]=function(_0x13b0c0,_0x1c0e85,_0x4737a3,_0x76168){return new BPromise(function(_0x486005,_0x187da6){logger[_0xff32('0x5')](_0xff32('0x6'),_0x76168||_0xff32('0x7'));var _0x27211b=new WebSocket(_0x76168||_0xff32('0x7'),{'perMessageDeflate':![]});var _0x175f7b='';var _0x21639a='0';var _0x3b151d='1';var _0x13aa82=_0xff32('0x8');function _0x2a1a10(_0x5de0a8){var _0xa0b1af=crypto['createHash'](_0xff32('0x9'));_0xa0b1af['update'](_0x5de0a8);return _0xa0b1af[_0xff32('0xa')](_0xff32('0xb'));}function _0x5e7279(){try{logger[_0xff32('0x5')](_0xff32('0xc'));var _0x573496=moment()[_0xff32('0xd')]();var _0x1fe797=_0x2a1a10(_0x573496+_0x1c0e85+_0x4737a3);_0x27211b[_0xff32('0xe')](JSON[_0xff32('0xf')]({'appID':_0x1c0e85,'timestamp':_0x573496,'appKey':_0x1fe797}));var _0x5857c5=fs[_0xff32('0x10')](_0x13b0c0);_0x5857c5['on']('data',function(_0x1f48c2){_0x27211b[_0xff32('0xe')](_0x1f48c2);});_0x5857c5['on'](_0xff32('0x11'),function(){_0x27211b['send'](_0xff32('0x12'));});}catch(_0x24ac7d){logger['error'](_0xff32('0x13'),JSON[_0xff32('0xf')](_0x24ac7d));_0x27211b[_0xff32('0x14')]();}}function _0x4a7ced(_0x5a4597){try{if(_0x5a4597){var _0x2987ae=JSON['parse'](_0x5a4597);switch(_0x2987ae[_0xff32('0x15')]){case 0x0:if(_0x2987ae[_0xff32('0x16')]){if(_0x2987ae[_0xff32('0x16')][_0xff32('0x17')]){logger[_0xff32('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0xff32('0xf')](_0x2987ae[_0xff32('0x16')][_0xff32('0x18')]));_0x175f7b=_0x2987ae[_0xff32('0x16')]['hypotheses'][0x0][_0xff32('0x19')];_0x21639a=_0x2987ae['result'][_0xff32('0x18')][0x0][_0xff32('0x1a')];_0x3b151d='0';_0x13aa82=_0xff32('0x1b');_0x27211b[_0xff32('0x14')]();}}break;case 0x1:logger[_0xff32('0x5')](_0xff32('0x8'));_0x3b151d='1';_0x13aa82=_0xff32('0x8');break;case 0x2:logger['info'](_0xff32('0x1c'));_0x3b151d='2';_0x13aa82=_0xff32('0x1c');break;case 0x9:logger[_0xff32('0x5')](_0xff32('0x1d'));_0x3b151d='9';_0x13aa82='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xff32('0x1e'));_0x3b151d='10';_0x13aa82=_0xff32('0x1e');break;case 0xb:logger['info'](_0xff32('0x1f'));_0x3b151d='11';_0x13aa82='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x129098){logger[_0xff32('0x20')](_0xff32('0x21'),JSON['stringify'](_0x129098));_0x27211b[_0xff32('0x14')]();}}function _0x56466c(){logger[_0xff32('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x486005({'transcript':_0x175f7b,'confidence':_0x21639a,'status':_0x3b151d,'status_message':_0x13aa82});}function _0x4b3abb(_0x3e13d5){logger['error'](_0xff32('0x22'));if(!_['isNil'](_0x3e13d5)){logger[_0xff32('0x20')](_[_0xff32('0x23')](_0x3e13d5)?JSON[_0xff32('0xf')](_0x3e13d5):_0x3e13d5);}}_0x27211b['on'](_0xff32('0x24'),_0x5e7279);_0x27211b['on']('message',_0x4a7ced);_0x27211b['on'](_0xff32('0x11'),_0x56466c);_0x27211b['on'](_0xff32('0x20'),_0x4b3abb);});}; \ No newline at end of file +var _0x8479=['unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','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.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x8479,0x131));var _0x9847=function(_0x4c7e28,_0x2c54f1){_0x4c7e28=_0x4c7e28-0x0;var _0x5a02f4=_0x8479[_0x4c7e28];return _0x5a02f4;};'use strict';var BPromise=require(_0x9847('0x0'));var _=require(_0x9847('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9847('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x9847('0x3'));module[_0x9847('0x4')]=function(_0x2c8de4,_0x40635b,_0x53d0bf,_0x4827ba){return new BPromise(function(_0x15a7d5,_0x4d8865){logger[_0x9847('0x5')](_0x9847('0x6'),_0x4827ba||_0x9847('0x7'));var _0x5d3792=new WebSocket(_0x4827ba||_0x9847('0x7'),{'perMessageDeflate':![]});var _0x3d49e1='';var _0x1d2a9f='0';var _0x315880='1';var _0x32b2ba=_0x9847('0x8');function _0x267fb8(_0x3e145d){var _0x332306=crypto[_0x9847('0x9')](_0x9847('0xa'));_0x332306[_0x9847('0xb')](_0x3e145d);return _0x332306[_0x9847('0xc')](_0x9847('0xd'));}function _0x1b9fda(){try{logger[_0x9847('0x5')](_0x9847('0xe'));var _0x14b214=moment()[_0x9847('0xf')]();var _0x5808e4=_0x267fb8(_0x14b214+_0x40635b+_0x53d0bf);_0x5d3792[_0x9847('0x10')](JSON[_0x9847('0x11')]({'appID':_0x40635b,'timestamp':_0x14b214,'appKey':_0x5808e4}));var _0x55f6cf=fs[_0x9847('0x12')](_0x2c8de4);_0x55f6cf['on'](_0x9847('0x13'),function(_0x2f6e5c){_0x5d3792['send'](_0x2f6e5c);});_0x55f6cf['on']('close',function(){_0x5d3792[_0x9847('0x10')](_0x9847('0x14'));});}catch(_0x3d28eb){logger[_0x9847('0x15')](_0x9847('0x16'),JSON[_0x9847('0x11')](_0x3d28eb));_0x5d3792[_0x9847('0x17')]();}}function _0x20bb55(_0xc28577){try{if(_0xc28577){var _0x23880d=JSON['parse'](_0xc28577);switch(_0x23880d[_0x9847('0x18')]){case 0x0:if(_0x23880d['result']){if(_0x23880d[_0x9847('0x19')]['final']){logger[_0x9847('0x5')](_0x9847('0x1a'),JSON[_0x9847('0x11')](_0x23880d[_0x9847('0x19')][_0x9847('0x1b')]));_0x3d49e1=_0x23880d['result'][_0x9847('0x1b')][0x0][_0x9847('0x1c')];_0x1d2a9f=_0x23880d[_0x9847('0x19')]['hypotheses'][0x0][_0x9847('0x1d')];_0x315880='0';_0x32b2ba=_0x9847('0x1e');_0x5d3792[_0x9847('0x17')]();}}break;case 0x1:logger[_0x9847('0x5')](_0x9847('0x8'));_0x315880='1';_0x32b2ba=_0x9847('0x8');break;case 0x2:logger[_0x9847('0x5')](_0x9847('0x1f'));_0x315880='2';_0x32b2ba=_0x9847('0x1f');break;case 0x9:logger[_0x9847('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x315880='9';_0x32b2ba=_0x9847('0x20');break;case 0xa:logger[_0x9847('0x5')](_0x9847('0x21'));_0x315880='10';_0x32b2ba='Authentication\x20failed.';break;case 0xb:logger[_0x9847('0x5')](_0x9847('0x22'));_0x315880='11';_0x32b2ba=_0x9847('0x22');}}}catch(_0x37703a){logger[_0x9847('0x15')](_0x9847('0x23'),JSON[_0x9847('0x11')](_0x37703a));_0x5d3792[_0x9847('0x17')]();}}function _0x172d21(){logger['info'](_0x9847('0x24'));_0x15a7d5({'transcript':_0x3d49e1,'confidence':_0x1d2a9f,'status':_0x315880,'status_message':_0x32b2ba});}function _0x4876c3(_0x4a302d){logger[_0x9847('0x15')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x4a302d)){logger[_0x9847('0x15')](_[_0x9847('0x25')](_0x4a302d)?JSON[_0x9847('0x11')](_0x4a302d):_0x4a302d);}}_0x5d3792['on']('open',_0x1b9fda);_0x5d3792['on'](_0x9847('0x26'),_0x20bb55);_0x5d3792['on'](_0x9847('0x27'),_0x172d21);_0x5d3792['on'](_0x9847('0x15'),_0x4876c3);});}; \ 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 b156283..f814daa 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 _0x1485=['exports'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1485,0x77));var _0x5148=function(_0x1f13f0,_0x66cc8d){_0x1f13f0=_0x1f13f0-0x0;var _0xeda5eb=_0x1485[_0x1f13f0];return _0xeda5eb;};var asr=require('./asr');module[_0x5148('0x0')]={'asr':asr}; \ No newline at end of file +var _0xccef=['exports'];(function(_0x178b23,_0x1ab486){var _0x199850=function(_0x2899c8){while(--_0x2899c8){_0x178b23['push'](_0x178b23['shift']());}};_0x199850(++_0x1ab486);}(_0xccef,0x1d4));var _0xfcce=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xccef[_0x20a584];return _0x4b41a8;};var asr=require('./asr');module[_0xfcce('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 1518cce..0bab468 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 _0xbec5=['E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','inherits','exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbec5,0xe5));var _0x5bec=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xbec5[_0x590a38];return _0xf36626;};'use strict';var util=require(_0x5bec('0x0'));var net=require(_0x5bec('0x1'));var EventEmitter=require('events')[_0x5bec('0x2')];var AGIError=require(_0x5bec('0x3'));var AGIChannel=require(_0x5bec('0x4'));var AGIServer=function(_0x3859a1,_0x244027,_0x4ee982){var _0x1f8933=this,_0x3859a1=_0x3859a1||0x11dd,_0x244027=_0x244027||_0x5bec('0x5'),_0x4aaac6=null,_0x3ed67a=0x0;EventEmitter[_0x5bec('0x6')](_0x1f8933);function _0x406e65(){if(!_0x3859a1){_0x1f8933[_0x5bec('0x7')](_0x5bec('0x8'),new AGIError(_0x5bec('0x9')));return![];}_0x4aaac6=net[_0x5bec('0xa')]();_0x4aaac6['listen'](_0x3859a1,_0x244027);_0x4aaac6['on'](_0x5bec('0xb'),function(){_0x1f8933['emit'](_0x5bec('0xb'));});_0x4aaac6['on'](_0x5bec('0xc'),function(_0x117162){_0x4aaac6['getConnections'](function(_0x288d1b,_0x18fa47){if(_0x288d1b){_0x1f8933[_0x5bec('0x7')]('error',new AGIError(_0x5bec('0xd'),_0x288d1b));}else if(_0x4ee982&&_0x4ee982<0x0){_0x1f8933[_0x5bec('0x7')]('error',new AGIError(_0x5bec('0xe')));_0x117162[_0x5bec('0xf')]();}else if(_0x4ee982&&_0x4ee982>0x0&&_0x4ee982<_0x18fa47){_0x3ed67a+=0x1;_0x1f8933[_0x5bec('0x7')](_0x5bec('0x8'),new AGIError(_0x5bec('0x10'),_0x3ed67a));_0x117162[_0x5bec('0xf')]();}else{var _0x24dcd6=new AGIChannel(_0x117162);_0x24dcd6['on'](_0x5bec('0x11'),function(){_0x1f8933[_0x5bec('0x7')](_0x5bec('0xc'),_0x24dcd6);});}});});_0x4aaac6['on'](_0x5bec('0x8'),function(_0x325daf){_0x1f8933[_0x5bec('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x325daf[_0x5bec('0x12')]));});_0x4aaac6['on'](_0x5bec('0x13'),function(){_0x1f8933[_0x5bec('0x7')](_0x5bec('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x406e65();});};util[_0x5bec('0x14')](AGIServer,EventEmitter);module[_0x5bec('0x15')]=function(_0x4e0191,_0x339614,_0xa7e223){return new AGIServer(_0x4e0191,_0x339614,_0xa7e223);}; \ No newline at end of file +var _0x0e9f=['./error','call','emit','createServer','listen','listening','connection','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x0e9f,0x116));var _0xf0e9=function(_0x5bc68c,_0x11ec88){_0x5bc68c=_0x5bc68c-0x0;var _0x41ad55=_0x0e9f[_0x5bc68c];return _0x41ad55;};'use strict';var util=require(_0xf0e9('0x0'));var net=require(_0xf0e9('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0xf0e9('0x2'));var AGIChannel=require('./channel');var AGIServer=function(_0x4b7f25,_0x2d2d99,_0x559cad){var _0x52a19d=this,_0x4b7f25=_0x4b7f25||0x11dd,_0x2d2d99=_0x2d2d99||'127.0.0.1',_0x59ac7e=null,_0x2322dc=0x0;EventEmitter[_0xf0e9('0x3')](_0x52a19d);function _0x2fa08f(){if(!_0x4b7f25){_0x52a19d[_0xf0e9('0x4')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x59ac7e=net[_0xf0e9('0x5')]();_0x59ac7e[_0xf0e9('0x6')](_0x4b7f25,_0x2d2d99);_0x59ac7e['on'](_0xf0e9('0x7'),function(){_0x52a19d['emit'](_0xf0e9('0x7'));});_0x59ac7e['on'](_0xf0e9('0x8'),function(_0x3cfc16){_0x59ac7e['getConnections'](function(_0x27850e,_0x34af01){if(_0x27850e){_0x52a19d[_0xf0e9('0x4')](_0xf0e9('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x27850e));}else if(_0x559cad&&_0x559cad<0x0){_0x52a19d[_0xf0e9('0x4')]('error',new AGIError(_0xf0e9('0xa')));_0x3cfc16[_0xf0e9('0xb')]();}else if(_0x559cad&&_0x559cad>0x0&&_0x559cad<_0x34af01){_0x2322dc+=0x1;_0x52a19d['emit'](_0xf0e9('0x9'),new AGIError(_0xf0e9('0xc'),_0x2322dc));_0x3cfc16[_0xf0e9('0xb')]();}else{var _0x1b87cf=new AGIChannel(_0x3cfc16);_0x1b87cf['on'](_0xf0e9('0xd'),function(){_0x52a19d[_0xf0e9('0x4')]('connection',_0x1b87cf);});}});});_0x59ac7e['on'](_0xf0e9('0x9'),function(_0x1eb36f){_0x52a19d['emit'](_0xf0e9('0x9'),new AGIError(_0xf0e9('0xe'),_0x1eb36f[_0xf0e9('0xf')]));});_0x59ac7e['on'](_0xf0e9('0x10'),function(){_0x52a19d['emit'](_0xf0e9('0x10'),new AGIError(_0xf0e9('0x11')));});}process[_0xf0e9('0x12')](function(){_0x2fa08f();});};util[_0xf0e9('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x50df7a,_0x360f8b,_0x98bb88){return new AGIServer(_0x50df7a,_0x360f8b,_0x98bb88);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b22c198..6095c91 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 _0xfcbc=['agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','timeout','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','appid','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','replaceall\x20init','split','nextbracket','replaceAll','extra','toString','replaceall\x20end','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','sync','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','result','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','enter\x20in\x20callbackblock','no\x20list\x20selected','delay','add','minutes','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','setVariable','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','gotoc','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','operation','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','%s_STATUS_MESSAGE','statusMessage','saydigits','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','\x22%s\x22\x20<%s>','user','bcc','service','host','port','secure','authentication','auth','debug','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\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','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','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact\x20callback','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback_priority','agent','agentPause'];(function(_0x3989f1,_0x529cce){var _0x82188f=function(_0x307973){while(--_0x307973){_0x3989f1['push'](_0x3989f1['shift']());}};_0x82188f(++_0x529cce);}(_0xfcbc,0x169));var _0xcfcb=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xfcbc[_0x4c0622];return _0x1799d8;};'use strict';var fs=require('fs');var path=require(_0xcfcb('0x0'));var util=require(_0xcfcb('0x1'));var _=require(_0xcfcb('0x2'));var sh=require(_0xcfcb('0x3'));var odbc=require(_0xcfcb('0x4'))();var rs=require(_0xcfcb('0x5'));var moment=require(_0xcfcb('0x6'));var Mustache=require(_0xcfcb('0x7'));var rp=require(_0xcfcb('0x8'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require(_0xcfcb('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xcfcb('0xa'),_0xcfcb('0xb')];var verticesWithRetry=['menu',_0xcfcb('0xc'),_0xcfcb('0xd')];var AGIVertices=function(_0x25ccd3,_0x31615d,_0x30f209){this[_0xcfcb('0xe')]=_0x25ccd3;this[_0xcfcb('0xf')]=_0x31615d;this[_0xcfcb('0x10')]=_0x30f209;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x12')]=function(_0xbeae37,_0x41c883){this[_0xcfcb('0xf')][_0xcfcb('0x13')](_0xbeae37)['then'](function(_0x1b7f72){_0x41c883(null,_0x1b7f72?_0x1b7f72[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x4374b3){_0x41c883(_0x4374b3);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x16')]=function(_0x2c46f5,_0x3e5262){this[_0xcfcb('0xf')]['getVoiceQueueById'](_0x2c46f5)[_0xcfcb('0x17')](function(_0x16c6e9){_0x3e5262(null,_0x16c6e9?_0x16c6e9['name']:![]);})[_0xcfcb('0x15')](function(_0x2a9256){_0x3e5262(_0x2a9256);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x18')]=function(_0x3a27d1,_0x5151b8){this[_0xcfcb('0xf')][_0xcfcb('0x19')](_0x3a27d1)[_0xcfcb('0x17')](function(_0x2cd575){_0x5151b8(null,_0x2cd575?_0x2cd575[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x5c751b){_0x5151b8(_0x5c751b);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1a')]=function(_0x37fe4f,_0x5d2e93){this['rpc'][_0xcfcb('0x1b')](_0x37fe4f)[_0xcfcb('0x17')](function(_0x816406){_0x5d2e93(null,_0x816406?_0x816406[_0xcfcb('0x1c')]:![]);})[_0xcfcb('0x15')](function(_0x5b9d24){_0x5d2e93(_0x5b9d24);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1d')]=function(_0x4c9a4b,_0x38777b){this[_0xcfcb('0xf')]['getUserById'](_0x4c9a4b)[_0xcfcb('0x17')](function(_0x5a6820){_0x38777b(null,_0x5a6820?_0x5a6820[_0xcfcb('0x14')]:![]);})['catch'](function(_0x259ba5){_0x38777b(_0x259ba5);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1e')]=function(_0x4add9d,_0x265eb0){this[_0xcfcb('0xf')][_0xcfcb('0x1f')](_0x4add9d)[_0xcfcb('0x17')](function(_0x1a5119){_0x265eb0(null,_0x1a5119?_0x1a5119[_0xcfcb('0x14')]:![]);})[_0xcfcb('0x15')](function(_0x29c7ce){_0x265eb0(_0x29c7ce);});};AGIVertices[_0xcfcb('0x11')]['getSound']=function(_0x28c32f,_0xe912c7){var _0x3cdb3b=this;this[_0xcfcb('0xf')][_0xcfcb('0x20')](_0x28c32f)['then'](function(_0x35bf70){_0xe912c7(null,_0x35bf70?_0x3cdb3b[_0xcfcb('0x21')](_0x35bf70[_0xcfcb('0x22')]):![]);})[_0xcfcb('0x15')](function(_0x4d171a){_0xe912c7(_0x4d171a);});};AGIVertices[_0xcfcb('0x11')]['getMailAccount']=function(_0x3ebf90,_0x2032b9){this['rpc'][_0xcfcb('0x23')](_0x3ebf90)[_0xcfcb('0x17')](function(_0x35be10){_0x2032b9(null,_0x35be10?_0x35be10:![]);})[_0xcfcb('0x15')](function(_0x216eb4){_0x2032b9(_0x216eb4);});};AGIVertices[_0xcfcb('0x11')]['sendMailMessage']=function(_0x4a009e,_0x4b2b45,_0x37e23c){this[_0xcfcb('0x10')][_0xcfcb('0x24')](_0x4a009e,_0x4b2b45)[_0xcfcb('0x17')](function(){_0x37e23c(null);})['catch'](function(_0x1bbc7d){_0x37e23c(_0x1bbc7d);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x25')]=function(_0x89fef8,_0x1c5189){this[_0xcfcb('0xf')]['getIntervalById'](_0x89fef8)['then'](function(_0x4aaf84){if(_0x4aaf84){if(_0x4aaf84[_0xcfcb('0x26')]){_0x1c5189(null,[_0x4aaf84['interval']]);}else{_0x1c5189(null,_[_0xcfcb('0x27')](_0x4aaf84[_0xcfcb('0x28')],_0xcfcb('0x29')));}}else{_0x1c5189(null,![]);}})[_0xcfcb('0x15')](function(_0xa69965){_0x1c5189(_0xa69965);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x21')]=function(_0x2d64f5){return util[_0xcfcb('0x2a')](_0xcfcb('0x2b'),FILES_PATH,_0x2d64f5);};AGIVertices[_0xcfcb('0x11')]['getQueryOdbc']=function(_0x889d78,_0x18f2f1,_0x52e9ea){odbc['open'](_0x889d78,function(_0x593634){if(_0x593634){logger[_0xcfcb('0x2c')](_0xcfcb('0x2d'),_0x593634);_0x52e9ea(_0x593634);}else{logger['info'](_0xcfcb('0x2e'));odbc[_0xcfcb('0x2f')](_0x18f2f1,function(_0x10a25,_0x3add68){if(_0x10a25){logger[_0xcfcb('0x30')](_0xcfcb('0x31'),_0x18f2f1);_0x52e9ea(_0x10a25);}else{logger[_0xcfcb('0x30')](_0xcfcb('0x32'),_0x18f2f1);odbc[_0xcfcb('0x33')](function(_0x151f90){if(_0x151f90){logger[_0xcfcb('0x2c')](_0xcfcb('0x34'),_0x151f90);}_0x52e9ea(null,_0x3add68);});}});}});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x35')]=function(_0x449675,_0x3a3a69){this[_0xcfcb('0xf')][_0xcfcb('0x36')](_0x449675)[_0xcfcb('0x17')](function(_0x3cbce0){_0x3a3a69(null,_0x3cbce0?_0x3cbce0:![]);})[_0xcfcb('0x15')](function(_0x16b83c){_0x3a3a69(_0x16b83c);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x37')]=function(_0x50d8f2,_0x72c362){this[_0xcfcb('0xf')][_0xcfcb('0x37')](_0x50d8f2)['then'](function(_0x5e1495){_0x72c362(null,_0x5e1495);})[_0xcfcb('0x15')](function(_0x3f3788){_0x72c362(_0x3f3788);});};AGIVertices[_0xcfcb('0x11')]['createSquareDetailsReport']=function(_0xd5d22,_0x40e6d8,_0x22d021){this[_0xcfcb('0xf')][_0xcfcb('0x38')]({'uniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'node':_0xd5d22[_0xcfcb('0x3a')],'application':_0xd5d22[_0xcfcb('0x3b')],'data':_0x40e6d8||null,'project_name':this[_0xcfcb('0xe')][_0xcfcb('0x3c')],'callerid':this[_0xcfcb('0xe')]['callerid']})[_0xcfcb('0x17')](function(_0x33af17){if(_0x22d021){_0x22d021(null,_0x33af17);}})[_0xcfcb('0x15')](function(_0x2217aa){if(_0x22d021){_0x22d021(_0x2217aa);}});};AGIVertices['prototype'][_0xcfcb('0x3d')]=function(_0x50e969,_0x41b125,_0x1bd9f5,_0x3ed979){this['rpc']['createSquareRecording']({'uniqueid':this[_0xcfcb('0xe')]['uniqueid'],'callerid':this[_0xcfcb('0xe')][_0xcfcb('0x3e')],'calleridname':this[_0xcfcb('0xe')][_0xcfcb('0x3f')],'context':this[_0xcfcb('0xe')]['context'],'extension':this[_0xcfcb('0xe')][_0xcfcb('0x40')],'priority':this[_0xcfcb('0xe')]['priority'],'accountcode':this[_0xcfcb('0xe')][_0xcfcb('0x41')],'dnid':this[_0xcfcb('0xe')]['dnid'],'projectName':this[_0xcfcb('0xe')]['arg_1'],'saveName':_0x41b125,'filename':_0x50e969[_0xcfcb('0x42')]||_0x41b125,'savePath':_0x1bd9f5})[_0xcfcb('0x17')](function(_0x1c25af){_0x3ed979(null,_0x1c25af);})[_0xcfcb('0x15')](function(_0x54fa2c){_0x3ed979(_0x54fa2c);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x43')]=function(_0x5dce75,_0x5c9f39,_0x4b2a21){this[_0xcfcb('0xf')][_0xcfcb('0x43')]({'uniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'body':_0x5dce75,'direction':_0x5c9f39})[_0xcfcb('0x17')](function(_0x41c2a6){if(_0x4b2a21){_0x4b2a21(null,_0x41c2a6);}})[_0xcfcb('0x15')](function(_0x123310){if(_0x4b2a21){_0x4b2a21(_0x123310);}});};AGIVertices['prototype'][_0xcfcb('0x44')]=function(_0x31b38f,_0x1c191b){console[_0xcfcb('0x45')]('in\x20createcmcontact',_0x31b38f);console[_0xcfcb('0x45')](_0xcfcb('0x46'),_0x1c191b);this[_0xcfcb('0xf')][_0xcfcb('0x44')]({'firstName':_[_0xcfcb('0x47')](_0x31b38f[_0xcfcb('0x14')])||_[_0xcfcb('0x48')](_0x31b38f[_0xcfcb('0x14')])?'callback_'+Math['random']():_0x31b38f[_0xcfcb('0x14')],'lastName':_[_0xcfcb('0x47')](_0x31b38f[_0xcfcb('0x49')])||_[_0xcfcb('0x48')](_0x31b38f['lastName'])?null:_0x31b38f[_0xcfcb('0x49')],'phone':_0x31b38f[_0xcfcb('0x4a')],'ListId':_0x31b38f[_0xcfcb('0x4b')],'scheduledat':_0x31b38f[_0xcfcb('0x4c')],'callbackUniqueid':this[_0xcfcb('0xe')][_0xcfcb('0x39')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x31b38f['scheduledAt']['toString'](),'priority':_0x31b38f[_0xcfcb('0x4d')]})[_0xcfcb('0x17')](function(_0x49f162){_0x1c191b(null,_0x49f162);})[_0xcfcb('0x15')](function(_0x1c07f7){_0x1c191b(_0x1c07f7);});};AGIVertices[_0xcfcb('0x11')]['getPause']=function(_0x525cff,_0x41589c){this[_0xcfcb('0xf')]['getPauseById'](_0x525cff)[_0xcfcb('0x17')](function(_0x3975ac){_0x41589c(null,_0x3975ac?_0x3975ac[_0xcfcb('0x14')]:![]);})['catch'](function(_0x175348){_0x41589c(_0x175348);});};AGIVertices[_0xcfcb('0x11')]['agentPause']=function(_0x5886a2,_0x2a9e38,_0x5156c1){var _0x352ef4={'role':_0xcfcb('0x4e')};_0x352ef4[_0x5886a2]=this['channel'][_0xcfcb('0x3e')];this['rpc'][_0xcfcb('0x4f')](_0x352ef4,_0x2a9e38,this[_0xcfcb('0xe')][_0xcfcb('0x39')])[_0xcfcb('0x17')](function(_0x5330c2){_0x5156c1(null,_[_0xcfcb('0x48')](_0x5330c2)?![]:!![]);})['catch'](function(_0x564185){logger['error'](_0x564185);_0x5156c1(null,![]);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x50')]=function(_0x5bd312,_0x4899c3){var _0x514a79={'role':'agent'};_0x514a79[_0x5bd312]=this[_0xcfcb('0xe')]['callerid'];this['rpc'][_0xcfcb('0x50')](_0x514a79)['then'](function(_0x166d6b){_0x4899c3(null,_[_0xcfcb('0x48')](_0x166d6b)?![]:!![]);})[_0xcfcb('0x15')](function(_0x476651){logger[_0xcfcb('0x2c')](_0x476651);_0x4899c3(null,![]);});};AGIVertices[_0xcfcb('0x11')]['agentLogout']=function(_0x44948b,_0x5791ff){var _0x36c79a={'role':'agent'};_0x36c79a[_0x44948b]=this[_0xcfcb('0xe')]['callerid'];this[_0xcfcb('0xf')][_0xcfcb('0x51')](_0x36c79a)['then'](function(_0x46c356){_0x5791ff(null,_[_0xcfcb('0x48')](_0x46c356)?![]:!![]);})[_0xcfcb('0x15')](function(_0x5226e9){logger[_0xcfcb('0x2c')](_0x5226e9);_0x5791ff(null,![]);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x52')]=function(_0x5b3fd9,_0x14a101){var _0x184bcc={'role':'agent'};_0x184bcc[_0x5b3fd9]=this[_0xcfcb('0xe')][_0xcfcb('0x3e')];var _0x175eb4=_0x5b3fd9!=_0xcfcb('0x53')?util[_0xcfcb('0x2a')](_0xcfcb('0x54'),_0xcfcb('0x55'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')]):undefined;this[_0xcfcb('0xf')]['agentLogin'](_0x184bcc,_0x175eb4)['then'](function(_0x3c96db){_0x14a101(null,_[_0xcfcb('0x48')](_0x3c96db)?![]:!![]);})[_0xcfcb('0x15')](function(_0x16fd6d){logger[_0xcfcb('0x2c')](_0x16fd6d);_0x14a101(null,![]);});};AGIVertices['prototype'][_0xcfcb('0x56')]=function(_0x41ae8e,_0x573459){sh[_0xcfcb('0x57')](_[_0xcfcb('0x58')](_0x41ae8e),function(_0x1d51a3,_0x5cce9f){var _0x3ef619=_0x5cce9f[_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'');_0x573459(null,_0x3ef619);});};AGIVertices[_0xcfcb('0x11')]['googleCloudTTS']=function(_0x2f30f8,_0x5202f2){scripts[_0xcfcb('0x5a')](_0x2f30f8['apiKey'],_0x2f30f8[_0xcfcb('0x5b')]||_0xcfcb('0x5c'),_0x2f30f8['text'],_0x2f30f8[_0xcfcb('0x5d')]||_0xcfcb('0x5e'),_0x2f30f8[_0xcfcb('0x5f')]||_0xcfcb('0x60'),_0x2f30f8[_0xcfcb('0x61')]||_0xcfcb('0x62'))[_0xcfcb('0x17')](function(_0x5359de){_0x5202f2(null,_0x5359de);})['catch'](function(_0x175a20){_0x5202f2(_0x175a20);});};AGIVertices['prototype'][_0xcfcb('0x63')]=function(_0x2e09a5,_0xe874c2){scripts['googleTTS'](_0x2e09a5[_0xcfcb('0x5c')],_0x2e09a5[_0xcfcb('0x64')]||'en',0x1)[_0xcfcb('0x17')](function(_0x18bf49){_0xe874c2(null,_0x18bf49);})['catch'](function(_0x5f49a8){_0xe874c2(_0x5f49a8);});};AGIVertices[_0xcfcb('0x11')]['restAPI']=function(_0x320f8f,_0x5de336){var _0x597121={'uri':_0x320f8f[_0xcfcb('0x65')],'method':_0x320f8f[_0xcfcb('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x320f8f['timeout'])===_0xcfcb('0x67')&&parseInt(_0x320f8f[_0xcfcb('0x68')])>=0x1?parseInt(_0x320f8f[_0xcfcb('0x68')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xcfcb('0x69'),'PUT'],_0x597121[_0xcfcb('0x66')][_0xcfcb('0x6a')]())){try{_0x597121['body']=_0x320f8f[_0xcfcb('0xb')]?JSON['parse'](_0x320f8f[_0xcfcb('0xb')]):{};}catch(_0x19db1e){logger[_0xcfcb('0x2c')](_0xcfcb('0x6b'),_0x19db1e);}}try{_0x597121[_0xcfcb('0x6c')]=_0x320f8f[_0xcfcb('0xa')]?JSON[_0xcfcb('0x6d')](_0x320f8f[_0xcfcb('0xa')]):{};}catch(_0x3342c5){logger['error'](_0xcfcb('0x6e'),_0x3342c5);}if(_0x320f8f[_0xcfcb('0x6f')]){try{var _0x1c7df1=require(_0x320f8f[_0xcfcb('0x6f')])['sync'](this,_0x597121);_0x597121['uri']=Mustache[_0xcfcb('0x70')](_0x320f8f[_0xcfcb('0x65')],_0x1c7df1,{},['$$','$$']);if(_0x597121['headers']){_0x597121['headers']=JSON[_0xcfcb('0x6d')](Mustache[_0xcfcb('0x70')](JSON['stringify'](_0x597121[_0xcfcb('0x6c')]),_0x1c7df1,{},['$$','$$']));}if(_0x597121[_0xcfcb('0x71')]){_0x597121['body']=JSON[_0xcfcb('0x6d')](Mustache[_0xcfcb('0x70')](JSON[_0xcfcb('0x72')](_0x597121[_0xcfcb('0x71')]),_0x1c7df1,{},['$$','$$']));}}catch(_0x791775){logger[_0xcfcb('0x2c')](_0xcfcb('0x73'),_0x791775);}}rp(_0x597121)['then'](function(_0x2a1f3b){var _0x260438={'statusCode':_0x2a1f3b['statusCode']||0xc8,'statusMessage':_0x2a1f3b['statusMessage']||'OK','headers':_0x2a1f3b['headers']||{},'body':_0x2a1f3b['body']||{}};_0x5de336(null,_0x260438);})['catch'](function(_0x2593a1){var _0x3d8d48={'statusCode':_0x2593a1['statusCode']||0x1f4,'statusMessage':_0x2593a1['message']||_0xcfcb('0x74'),'headers':_0x2593a1[_0xcfcb('0x75')][_0xcfcb('0x6c')]||{},'body':_0x2593a1[_0xcfcb('0x75')]['body']||{}};_0x5de336(null,_0x3d8d48);});};AGIVertices[_0xcfcb('0x11')]['googleDialogflow']=function(_0x24d20a,_0x19cc84){scripts[_0xcfcb('0x76')](this[_0xcfcb('0xe')][_0xcfcb('0x39')],_0x24d20a[_0xcfcb('0x77')],_0x24d20a['text'],_0x24d20a[_0xcfcb('0x78')]||'en')['then'](function(_0x19fb8f){_0x19cc84(null,_0x19fb8f);})['catch'](function(_0xa62a59){_0x19cc84(_0xa62a59);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x79')]=function(_0x29d6c6,_0xe72a28){scripts[_0xcfcb('0x79')](this[_0xcfcb('0xe')],_0x29d6c6)[_0xcfcb('0x17')](function(_0x53edbb){_0xe72a28(null,_0x53edbb);})[_0xcfcb('0x15')](function(_0x105bd0){_0xe72a28(_0x105bd0);});};AGIVertices['prototype'][_0xcfcb('0x7a')]=function(_0x124850,_0x55b010){scripts[_0xcfcb('0x7a')](_0x124850[_0xcfcb('0x77')],_0x124850[_0xcfcb('0x5c')],_0x124850[_0xcfcb('0x7b')]||_0xcfcb('0x5e'),_0x124850['speed'])[_0xcfcb('0x17')](function(_0x3cb36e){_0x55b010(null,_0x3cb36e);})['catch'](function(_0xc78c4a){_0x55b010(_0xc78c4a);});};AGIVertices['prototype'][_0xcfcb('0x7c')]=function(_0x58ec12,_0x878a21,_0x3a1d70){scripts[_0xcfcb('0x7c')](_0x878a21,_0x58ec12['key'],_0x58ec12[_0xcfcb('0x7d')]||'en-US',this[_0xcfcb('0x7e')](_0x58ec12[_0xcfcb('0x7f')])?_0x58ec12[_0xcfcb('0x7f')]:undefined)['then'](function(_0x1e7e31){_0x3a1d70(null,_0x1e7e31);})['catch'](function(_0x48c43b){_0x3a1d70(_0x48c43b);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x80')]=function(_0x4e20f0,_0xe86c52){scripts[_0xcfcb('0x80')](_0x4e20f0[_0xcfcb('0x81')],_0x4e20f0[_0xcfcb('0x82')],_0x4e20f0['aws_polly_region'],_0x4e20f0[_0xcfcb('0x83')]||_0xcfcb('0x84'),_0x4e20f0['text'],_0x4e20f0['aws_text_type']||_0xcfcb('0x5c'))[_0xcfcb('0x17')](function(_0x4453f6){_0xe86c52(null,_0x4453f6);})[_0xcfcb('0x15')](function(_0x477b21){_0xe86c52(_0x477b21);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x85')]=function(_0x352e89,_0x55755d){scripts['awsLex'](this[_0xcfcb('0xe')][_0xcfcb('0x39')],_0x352e89['aws_access_key_id'],_0x352e89[_0xcfcb('0x82')],_0x352e89[_0xcfcb('0x86')],_0x352e89[_0xcfcb('0x5c')],_0x352e89[_0xcfcb('0x87')])[_0xcfcb('0x17')](function(_0x264ab9){_0x55755d(null,_0x264ab9);})[_0xcfcb('0x15')](function(_0xf4636b){_0x55755d(_0xf4636b);});};AGIVertices['prototype'][_0xcfcb('0x88')]=function(_0x27530d,_0x19554f,_0x15aed3){scripts[_0xcfcb('0x88')](_0x19554f,_0x27530d[_0xcfcb('0x77')],_0x27530d['google_asr_language']||_0xcfcb('0x5e'))[_0xcfcb('0x17')](function(_0x1ad41c){_0x15aed3(null,_0x1ad41c);})['catch'](function(_0x17743c){_0x15aed3(_0x17743c);});};AGIVertices['prototype']['tildeASR']=function(_0x1b72ad,_0x561810,_0x1381c1){scripts['tildeASR'](_0x561810,_0x1b72ad[_0xcfcb('0x89')],_0x1b72ad[_0xcfcb('0x8a')],_0x1b72ad[_0xcfcb('0x8b')])[_0xcfcb('0x17')](function(_0x104125){_0x1381c1(null,_0x104125);})['catch'](function(_0x5f205e){_0x1381c1(_0x5f205e);});};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x8c')]=function(_0x40672b){var _0x4aa019=_[_0xcfcb('0x8d')](verticesWithRetry,_0x40672b['agicommand'])?_0x40672b:_[_0xcfcb('0x8e')](_0x40672b);for(var _0x13ebd3 in _0x4aa019){if(_0x4aa019[_0xcfcb('0x8f')](_0x13ebd3)){if(_0x4aa019[_0x13ebd3]&&_[_0xcfcb('0x90')](_0x4aa019[_0x13ebd3])){if(_[_0xcfcb('0x8d')](recursiveMapAttributes,_0x13ebd3)){_0x4aa019[_0x13ebd3]=this[_0xcfcb('0x91')](_0x4aa019[_0x13ebd3]);}else{_0x4aa019[_0x13ebd3]=this[_0xcfcb('0x92')](_0x4aa019[_0x13ebd3]);}}}}return _0x4aa019;};AGIVertices['prototype'][_0xcfcb('0x93')]=function(_0x569efc){for(var _0x1e1167 in _0x569efc){if(_0x569efc[_0xcfcb('0x8f')](_0x1e1167)){if(_[_0xcfcb('0x94')](_0x569efc[_0x1e1167])){this[_0xcfcb('0x93')](_0x569efc[_0x1e1167]);}else if(_[_0xcfcb('0x95')](_0x569efc[_0x1e1167])){for(var _0x1597ea=0x0;_0x1597ea<_0x569efc[_0x1e1167]['length'];_0x1597ea++){this['recursiveNodeIndex'](_0x569efc[_0x1e1167][_0x1597ea]);}}else if(_['isString'](_0x569efc[_0x1e1167])){_0x569efc[_0x1e1167]=this[_0xcfcb('0x92')](_0x569efc[_0x1e1167]);}}}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x96')]=function(_0x37181b,_0x85c457){for(var _0x1a7299 in _0x37181b){if(_0x37181b[_0xcfcb('0x8f')](_0x1a7299)){if(_['isPlainObject'](_0x37181b[_0x1a7299])){if(!_[_0xcfcb('0x47')](_0x37181b[_0x1a7299])){this[_0xcfcb('0x96')](_0x37181b[_0x1a7299],util[_0xcfcb('0x2a')](_0xcfcb('0x97'),_0x85c457,_0x1a7299));}}else if(_[_0xcfcb('0x95')](_0x37181b[_0x1a7299])){for(var _0x194541=0x0;_0x194541<_0x37181b[_0x1a7299][_0xcfcb('0x98')];_0x194541++){this[_0xcfcb('0x96')](_0x37181b[_0x1a7299][_0x194541],util[_0xcfcb('0x2a')](_0xcfcb('0x97'),_0x85c457,_0x1a7299+'['+_0x194541+']'));}}else{if(!_[_0xcfcb('0x48')](_0x37181b[_0x1a7299])){this[_0xcfcb('0xe')]['setVariable'](util['format'](_0xcfcb('0x97'),_0x85c457,_0x1a7299),_0x37181b[_0x1a7299]);}}}}};AGIVertices['prototype'][_0xcfcb('0x91')]=function(_0x4cfe44){try{var _0x29c029=JSON[_0xcfcb('0x6d')](_0x4cfe44);this[_0xcfcb('0x93')](_0x29c029);return JSON[_0xcfcb('0x72')](_0x29c029);}catch(_0x3289ec){return this[_0xcfcb('0x92')](_0x4cfe44);}};AGIVertices['prototype'][_0xcfcb('0x92')]=function(_0x96cd){console[_0xcfcb('0x45')](_0xcfcb('0x99'),_0x96cd);var _0x148fe2=_0x96cd[_0xcfcb('0x9a')]('{');for(var _0x3d53e7=0x1;_0x3d53e7<_0x148fe2['length'];_0x3d53e7+=0x1){var _0x3507bf=_0x148fe2[_0x3d53e7][_0xcfcb('0x9a')]('}');console[_0xcfcb('0x45')](_0xcfcb('0x9b'),_0x3507bf);if(_0x3507bf['length']>0x1){_0x96cd=_0x96cd[_0xcfcb('0x9c')]('{'+_0x3507bf[0x0]+'}',this[_0xcfcb('0xe')][_0xcfcb('0x12')](_0x3507bf[0x0])[_0xcfcb('0x9d')]||_0x3507bf[0x0]);}}if(_0x148fe2[_0xcfcb('0x98')]===0x1){return _0x96cd[_0xcfcb('0x9e')]();}console['log'](_0xcfcb('0x9f'),_0x96cd);return this['replaceAllVariables'](_0x96cd);};AGIVertices['prototype'][_0xcfcb('0xa0')]=function(_0x5eff57,_0x51ad45){var _0x20851e=this[_0xcfcb('0xe')][_0xcfcb('0x12')](_0x5eff57);if(_0x20851e['result']===-0x1){return _0x20851e;}logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xa1'),_0x51ad45,_0x20851e['extra']));return this[_0xcfcb('0xe')]['setVariable'](_0x51ad45,_0x20851e[_0xcfcb('0x9d')]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x7e')]=function(_0x31ff0a){return _0x31ff0a&&_0x31ff0a!=='0'&&_0x31ff0a!=='-1'&&_0x31ff0a!=='';};AGIVertices[_0xcfcb('0x11')]['maxRetry']=function(_0x19fc9a){this['createSquareDetailsReport'][_0xcfcb('0xa2')](this,_0x19fc9a,'-');_0x19fc9a['retry']=_0x19fc9a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xcfcb('0x11')]['mrcpsynth']=function(_0x42d1e4){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x42d1e4[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x42d1e4[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}var _0x3cb506='\x22'+_0x42d1e4[_0xcfcb('0x5c')]+'\x22';if(this['isConfigured'](_0x42d1e4[_0xcfcb('0x75')])){_0x3cb506+=','+_0x42d1e4[_0xcfcb('0x75')];}var _0x2da580=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xa5'),_0x3cb506);if(_0x2da580['result']===-0x1){return _0x2da580;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0xa6'),_0x3cb506));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xa7')]=function(_0x5e2626){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xa8'),_0x5e2626['label']));if(!this['isConfigured'](_0x5e2626['grammar'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x215fbb=_0x5e2626[_0xcfcb('0xaa')];if(this[_0xcfcb('0x7e')](_0x5e2626[_0xcfcb('0x75')])){_0x215fbb+=','+_0x5e2626[_0xcfcb('0x75')];}var _0x25fda4=this[_0xcfcb('0xe')][_0xcfcb('0x57')]('MRCPRecog',_0x215fbb);if(_0x25fda4[_0xcfcb('0xab')]===-0x1){return _0x25fda4;}var _0xcaa542=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0xcaa542[_0xcfcb('0xab')]===-0x1){return _0xcaa542;}var _0x25eadd=this['getAndSetVariable']('RECOG_INPUT()',_0xcfcb('0xad'));if(_0x25eadd[_0xcfcb('0xab')]===-0x1){return _0x25eadd;}var _0x1e9aad=this['getAndSetVariable'](_0xcfcb('0xae'),_0xcfcb('0xaf'));if(_0x1e9aad[_0xcfcb('0xab')]===-0x1){return _0x1e9aad;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0xb0'),_0x215fbb));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb1')]=function(_0x347f35){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xb2'),_0x347f35['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xb1')]([_0x347f35[_0xcfcb('0xb3')],_0x347f35[_0xcfcb('0xb4')]]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb5')]=function(_0x15302a){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xb6'),_0x15302a[_0xcfcb('0x3a')]));if(this['isConfigured'](_0x15302a[_0xcfcb('0x68')])){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xb7'),_0x15302a[_0xcfcb('0x68')]));var _0xa2a60a=this[_0xcfcb('0xe')]['wait'](_0x15302a[_0xcfcb('0x68')]);if(_0xa2a60a[_0xcfcb('0xab')]===-0x1){return _0xa2a60a;}}return this[_0xcfcb('0xe')]['answer']();};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xb8')]=function(_0x16d6f0){console['logh'](_0xcfcb('0xb9'),_0x16d6f0);logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x16d6f0[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x16d6f0[_0xcfcb('0x4b')])){return this['channel']['error'](_0x16d6f0,_0xcfcb('0xba'));}_0x16d6f0[_0xcfcb('0x4c')]=moment();if(this[_0xcfcb('0x7e')](_0x16d6f0[_0xcfcb('0xbb')])){_0x16d6f0[_0xcfcb('0x4c')]=moment()[_0xcfcb('0xbc')](_0x16d6f0['delay'],_0xcfcb('0xbd'));}if(!this[_0xcfcb('0x7e')](_0x16d6f0['callback_priority'])){_0x16d6f0[_0xcfcb('0x4d')]=0x2;}console[_0xcfcb('0x45')](_0xcfcb('0xbe'),_0x16d6f0);this[_0xcfcb('0x44')][_0xcfcb('0xa2')](this,_0x16d6f0);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xbf'),_0x16d6f0[_0xcfcb('0x4a')],_0x16d6f0[_0xcfcb('0x4b')],_0x16d6f0[_0xcfcb('0x4c')]));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc0')]=function(_0x48f8b7){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x48f8b7['label']));var _0x666194=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0x48f8b7[_0xcfcb('0xc1')],_0x48f8b7['options']);if(_0x666194['result']===-0x1){return _0x666194;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0x48f8b7[_0xcfcb('0xc1')],_0x48f8b7[_0xcfcb('0x75')]));};AGIVertices[_0xcfcb('0x11')]['lumenvoxtts']=function(_0x32944b){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xc3'),_0x32944b['label']));if(!this[_0xcfcb('0x7e')](_0x32944b[_0xcfcb('0x5c')])){return this['channel']['noop'](_0xcfcb('0xa4'));}var _0x88a271='\x22'+_0x32944b[_0xcfcb('0x5c')]+'\x22';if(this[_0xcfcb('0x7e')](_0x32944b[_0xcfcb('0x75')])){_0x88a271+=','+_0x32944b['options'];}var _0x5166c5=this[_0xcfcb('0xe')]['exec'](_0xcfcb('0xa5'),_0x88a271);if(_0x5166c5['result']===-0x1){return _0x5166c5;}return this['channel']['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xa6'),_0x88a271));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc4')]=function(_0x1b3854){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xc5'),_0x1b3854[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x1b3854[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}var _0x10ccd8='\x22'+_0x1b3854[_0xcfcb('0x5c')]+'\x22';if(this[_0xcfcb('0x7e')](_0x1b3854[_0xcfcb('0x75')])){_0x10ccd8+=','+_0x1b3854[_0xcfcb('0x75')];}var _0x2fd5ea=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xa5'),_0x10ccd8);if(_0x2fd5ea[_0xcfcb('0xab')]===-0x1){return _0x2fd5ea;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xa6'),_0x10ccd8));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc6')]=function(_0x13ee0b){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0xc7'),_0x13ee0b[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x13ee0b['grammar'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x21de29=_0x13ee0b[_0xcfcb('0xaa')];if(this[_0xcfcb('0x7e')](_0x13ee0b[_0xcfcb('0x75')])){_0x21de29+=','+_0x13ee0b[_0xcfcb('0x75')];}var _0x56d102=this[_0xcfcb('0xe')][_0xcfcb('0x57')]('MRCPRecog',_0x21de29);if(_0x56d102[_0xcfcb('0xab')]===-0x1){return _0x56d102;}var _0x12379c=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),_0xcfcb('0xc8'));if(_0x12379c[_0xcfcb('0xab')]===-0x1){return _0x12379c;}var _0x12449d=this[_0xcfcb('0xa0')]('RECOG_INPUT()',_0xcfcb('0xc9'));if(_0x12449d[_0xcfcb('0xab')]===-0x1){return _0x12449d;}var _0x421051=this[_0xcfcb('0xa0')](_0xcfcb('0xae'),_0xcfcb('0xca'));if(_0x421051[_0xcfcb('0xab')]===-0x1){return _0x421051;}return this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x21de29));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xcb')]=function(_0x5635a1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xcc'),_0x5635a1['label']));if(!this[_0xcfcb('0x7e')](_0x5635a1[_0xcfcb('0xaa')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa9'));}var _0x36cd0a=_0x5635a1[_0xcfcb('0xaa')];if(this['isConfigured'](_0x5635a1['options'])){_0x36cd0a+=','+_0x5635a1['options'];}var _0x2d2259=this['channel']['exec'](_0xcfcb('0xcd'),_0x36cd0a);if(_0x2d2259[_0xcfcb('0xab')]===-0x1){return _0x2d2259;}var _0x1d16c6=this[_0xcfcb('0xa0')](_0xcfcb('0xac'),_0xcfcb('0xce'));if(_0x1d16c6['result']===-0x1){return _0x1d16c6;}var _0x33b1f5=this['getAndSetVariable']('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x33b1f5['result']===-0x1){return _0x33b1f5;}var _0x51d3a2=this[_0xcfcb('0xa0')](_0xcfcb('0xae'),'SESTEK_ASR_INSTANCE');if(_0x51d3a2[_0xcfcb('0xab')]===-0x1){return _0x51d3a2;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xb0'),_0x36cd0a));};AGIVertices[_0xcfcb('0x11')]['database']=function(_0x569662){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xcf'),_0x569662['label']));if(!this[_0xcfcb('0x7e')](_0x569662['odbc_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd0'));}var _0x101010=this['getSquareOdbc'][_0xcfcb('0xa2')](this,_0x569662['odbc_id']);if(!_0x101010){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd1'));}if(!this[_0xcfcb('0x7e')](_0x569662[_0xcfcb('0x2f')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd2'));}var _0x5fa896=_0x569662[_0xcfcb('0x2f')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xd3'),_0x5fa896));var _0x100873=this[_0xcfcb('0xd4')]['sync'](this,_0x101010,_0x5fa896);this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x569662,_0x5fa896);if(!this[_0xcfcb('0x7e')](_0x569662['variable_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xd5'));}var _0x4c1b21=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x569662['variable_id']);if(!_0x4c1b21){return this['channel'][_0xcfcb('0x2c')](_0x569662,_0xcfcb('0xd6'));}var _0x2bca87=this;_0x100873[_0xcfcb('0xd7')](function(_0x3ac8a2,_0x367e80){Object['keys'](_0x3ac8a2)[_0xcfcb('0xd7')](function(_0x4794eb){_0x2bca87[_0xcfcb('0xe')][_0xcfcb('0xd8')](util['format'](_0xcfcb('0xd9'),_0x4c1b21,_0x367e80,_0x4794eb),_0x3ac8a2[_0x4794eb]);});});this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')]('%s_ROWS_COUNT',_0x4c1b21),_0x100873[_0xcfcb('0x98')]);return this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xda'),_0x4c1b21));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xdb')]=function(_0x23f798){logger['debug'](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x23f798[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x23f798[_0xcfcb('0xdc')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x23f798,'no\x20user\x20selected');}var _0x1a73e3=this[_0xcfcb('0x1d')][_0xcfcb('0xa2')](this,_0x23f798[_0xcfcb('0xdc')]);if(!_0x1a73e3){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x23f798,'no\x20user\x20found');}var _0x461c75=this['channel']['exec'](_0xcfcb('0xdd'),[util[_0xcfcb('0x2a')]('SIP/%s',_0x1a73e3),_0x23f798['timeout'],_0x23f798[_0xcfcb('0xde')],_0x23f798['url']]);if(_0x461c75[_0xcfcb('0xab')]===-0x1){return _0x461c75;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xdf'),_0xcfcb('0xdd')));};AGIVertices['prototype'][_0xcfcb('0xe0')]=function(_0x58cb60){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xe1'),_0x58cb60[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x58cb60['key'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xe2'));}if(!this[_0xcfcb('0x7e')](_0x58cb60['text'])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0xa4'));}this['channel'][_0xcfcb('0xe3')]=!![];this['createSquareDetailsReport'](_0x58cb60);this[_0xcfcb('0x43')](_0x58cb60[_0xcfcb('0x5c')],'in');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x58cb60[_0xcfcb('0x5c')]));var _0x248e2e=this[_0xcfcb('0x76')][_0xcfcb('0xa2')](this,_0x58cb60);if(_0x248e2e){for(var _0x4f5a52 in _0x248e2e){if(_0x248e2e['hasOwnProperty'](_0x4f5a52)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0xe4'),_0x4f5a52[_0xcfcb('0x6a')]()),_0x248e2e[_0x4f5a52]);}}this[_0xcfcb('0x43')](_0x248e2e[_0xcfcb('0xe5')],'out');return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xe6'),_0x248e2e[_0xcfcb('0xe5')]));}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x58cb60,_0xcfcb('0xe7'));};AGIVertices[_0xcfcb('0x11')]['sesteknda']=function(_0x3c7d11){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xe8'),_0x3c7d11[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x3c7d11[_0xcfcb('0xe9')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xea'));}if(!this[_0xcfcb('0x7e')](_0x3c7d11[_0xcfcb('0xeb')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xec'));}if(!this[_0xcfcb('0x7e')](_0x3c7d11['password'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xed'));}if(!this['isConfigured'](_0x3c7d11[_0xcfcb('0xee')])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xe3')]=!![];this['createSquareDetailsReport'](_0x3c7d11);this['createSquareMessage'](_0x3c7d11[_0xcfcb('0x5c')],'in');this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xef'),_0x3c7d11[_0xcfcb('0x5c')]));var _0x5bfb75=this[_0xcfcb('0x79')][_0xcfcb('0xa2')](this,_0x3c7d11);if(_0x5bfb75){for(var _0x44d23e in _0x5bfb75){if(_0x5bfb75['hasOwnProperty'](_0x44d23e)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0xf0'),_0x44d23e[_0xcfcb('0x6a')]()),_0x5bfb75[_0x44d23e]);}}this[_0xcfcb('0x43')](_0x5bfb75[_0xcfcb('0xe5')],_0xcfcb('0xf1'));if(_0x5bfb75[_0xcfcb('0xf2')]){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5bfb75['audiofile']));var _0xd86893=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x5bfb75[_0xcfcb('0xf2')]);try{fs['unlink'](_0x5bfb75[_0xcfcb('0xf2')]+_0xcfcb('0xf4'));}catch(_0x51528d){logger[_0xcfcb('0x2c')](_0x51528d);}return _0xd86893;}else{return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xf5'),_0x5bfb75[_0xcfcb('0xe5')]));}}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3c7d11,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xf6')]=function(_0x466c07){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0xf7'),_0x466c07['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xf6'));};AGIVertices['prototype'][_0xcfcb('0xf8')]=function(_0xce80fc){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xce80fc['label']));var _0x5db055='';if(_0xce80fc[_0xcfcb('0xf9')]){if(!this[_0xcfcb('0x7e')](_0xce80fc[_0xcfcb('0xf9')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfa'));}else{var _0x1cdd35=parseInt(_0xce80fc[_0xcfcb('0xf9')],0xa);if(isNaN(_0x1cdd35)){_0x5db055=_0xce80fc[_0xcfcb('0xf9')];}else{_0x5db055=this['getTrunk']['sync'](this,_0xce80fc['trunk_id']);if(!_0x5db055){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfb'));}}}}else if(_0xce80fc['trunk_name']){_0x5db055=_0xce80fc[_0xcfcb('0xfc')];}else{return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0xce80fc,_0xcfcb('0xfa'));}var _0x40faaa=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0xdd'),[util['format'](_0xcfcb('0xfd'),_0x5db055,_0xce80fc[_0xcfcb('0x4a')]),_0xce80fc['timeout'],_0xce80fc[_0xcfcb('0xde')],_0xce80fc[_0xcfcb('0x65')]]);if(_0x40faaa[_0xcfcb('0xab')]===-0x1){return _0x40faaa;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Executed\x20command\x20%s',_0xcfcb('0xdd')));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xfe')]=function(_0x2a4aae){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2a4aae[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xfe'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xc')]=function(_0x692e3d){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0xff'),_0x692e3d[_0xcfcb('0x3a')]));if(_0x692e3d['retry']===0x0){return this[_0xcfcb('0x100')](_0x692e3d);}_0x692e3d[_0xcfcb('0x101')]-=0x1;if(!this[_0xcfcb('0x7e')](_0x692e3d[_0xcfcb('0x102')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,_0xcfcb('0x103'));}var _0x8b543c=this[_0xcfcb('0x104')][_0xcfcb('0xa2')](this,_0x692e3d[_0xcfcb('0x102')]);if(!_0x8b543c){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,_0xcfcb('0x105'));}if(!this['isConfigured'](_0x692e3d[_0xcfcb('0x106')])){return this['channel'][_0xcfcb('0x2c')](_0xcfcb('0xd5'));}var _0x51b1c4=this[_0xcfcb('0xe')][_0xcfcb('0x107')](_0x8b543c,_0x692e3d[_0xcfcb('0x108')],_0x692e3d[_0xcfcb('0x109')]);var _0x34feb4=_0x51b1c4[_0xcfcb('0xab')]?_0x51b1c4[_0xcfcb('0xab')][_0xcfcb('0x9e')]():'';logger[_0xcfcb('0x30')](_0xcfcb('0x10a'),JSON['stringify'](_0x51b1c4));if(_0x51b1c4[_0xcfcb('0xab')]===-0x1){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x34feb4);return _0x51b1c4;}else if(_0x51b1c4[_0xcfcb('0x9d')]===_0xcfcb('0x68')){_0x51b1c4[_0xcfcb('0xab')]=_0x34feb4['length']>=parseInt(_0x692e3d[_0xcfcb('0x10b')])?'x':'i';}else{_0x51b1c4[_0xcfcb('0xab')]=_0x34feb4[_0xcfcb('0x98')]>=parseInt(_0x692e3d['mindigit'])&&_0x34feb4[_0xcfcb('0x98')]<=parseInt(_0x692e3d[_0xcfcb('0x109')])?'x':'i';}var _0x113f5a=this['getVariable']['sync'](this,_0x692e3d[_0xcfcb('0x106')]);if(!_0x113f5a){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x692e3d,'no\x20variable\x20found');}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0x113f5a,_0x34feb4);if(this[_0xcfcb('0x7e')](_0x692e3d[_0xcfcb('0x10c')])){var _0x3b1a4a=parseInt(_0x692e3d[_0xcfcb('0x10c')],0xa);var _0x32b54a=rs['generate']({'charset':'*','length':_0x3b1a4a});var _0x3d9869=_0x34feb4[_0xcfcb('0x98')];if(_0x3d9869>0x0){if(_0x3d9869>_0x3b1a4a){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x692e3d[_0xcfcb('0x10d')]===_0xcfcb('0x10e')?_0x32b54a+_0x34feb4[_0xcfcb('0x10f')](_0x3b1a4a):_0x34feb4[_0xcfcb('0x10f')](0x0,_0x3d9869-_0x3b1a4a)+_0x32b54a);}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,rs[_0xcfcb('0x110')]({'charset':'*','length':_0x3d9869}));}}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,'');}}else{this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x692e3d,_0x34feb4);}return _0x51b1c4;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xd')]=function(_0x35c2da){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x111'),_0x35c2da['label']));return this[_0xcfcb('0xc')](_0x35c2da);};AGIVertices[_0xcfcb('0x11')]['goal']=function(_0x1da03c){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1da03c[_0xcfcb('0x3a')]));this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x1da03c,_0x1da03c[_0xcfcb('0x112')]);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x113'),_0x1da03c['goalname']));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x114')]=function(_0x119a08){logger['info'](util['format'](_0xcfcb('0x115'),_0x119a08['label']));if(!this[_0xcfcb('0x7e')](_0x119a08['aws_access_key_id'])||!this[_0xcfcb('0x7e')](_0x119a08['aws_secret_access_key'])){return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0x116'));}if(!this[_0xcfcb('0x7e')](_0x119a08[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x117'),_0x119a08['text']));var _0x26664e=this[_0xcfcb('0x80')][_0xcfcb('0xa2')](this,_0x119a08);if(_0x26664e){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x118'),_0x26664e));var _0x3c3ebb=this['channel']['streamFile'](_0x26664e);try{fs[_0xcfcb('0x119')](_0x26664e+_0xcfcb('0xf4'));}catch(_0x5956ea){logger[_0xcfcb('0x2c')](_0x5956ea);}return _0x3c3ebb;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x119a08,_0xcfcb('0x11a'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x11b')]=function(_0x13056f){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x11c'),_0x13056f['label']));if(!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x81')])||!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x82')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x116'));}if(!this[_0xcfcb('0x7e')](_0x13056f['aws_bot_name'])){return this['channel']['noop'](_0xcfcb('0x11d'));}if(!this[_0xcfcb('0x7e')](_0x13056f[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this[_0xcfcb('0xe')][_0xcfcb('0xe3')]=!![];this[_0xcfcb('0x38')](_0x13056f);this[_0xcfcb('0x43')](_0x13056f['text'],'in');this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x11e'),_0x13056f[_0xcfcb('0x5c')]));var _0x268b5b=this[_0xcfcb('0x85')][_0xcfcb('0xa2')](this,_0x13056f);if(_0x268b5b){for(var _0x54cbcf in _0x268b5b){if(_0x268b5b[_0xcfcb('0x8f')](_0x54cbcf)&&_[_0xcfcb('0x90')](_0x268b5b[_0x54cbcf])){this[_0xcfcb('0xe')]['setVariable'](util['format']('AWS_LEX_%s',_0x54cbcf[_0xcfcb('0x6a')]()),_0x268b5b[_0x54cbcf]);}}if(_[_0xcfcb('0x48')](_0x268b5b['message'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x11f'));}else{this['createSquareMessage'](_0x268b5b[_0xcfcb('0x120')],_0xcfcb('0xf1'));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x121'),_0x268b5b[_0xcfcb('0x120')]));}}return this[_0xcfcb('0xe')]['error'](_0x13056f,_0xcfcb('0x122'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x123')]=function(_0x5c269f){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x124'),_0x5c269f[_0xcfcb('0x3a')],_0x5c269f['timeout']));if(!this['isConfigured'](_0x5c269f['key'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20key\x20configured');}var _0x2bcd5c=_0xcfcb('0x125');var _0x20d8ef=util['format'](_0xcfcb('0x126'),FILES_PATH,rs[_0xcfcb('0x110')](0x4));var _0x29339e=util[_0xcfcb('0x2a')]('%s.%s',_0x20d8ef,_0x2bcd5c);var _0x1ef2da=!![];if(_0x5c269f[_0xcfcb('0x127')]==='NOBEEP'){_0x1ef2da=![];}var _0x44a54e=this[_0xcfcb('0xe')][_0xcfcb('0x128')](_0x20d8ef,_0x2bcd5c,_0x5c269f[_0xcfcb('0x129')],_0x5c269f['timeout'],undefined,_0x1ef2da);if(_0x44a54e[_0xcfcb('0xab')]!==-0x1){this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('google\x20%s\x20file\x20created',_0x29339e));var _0x5199b6=this[_0xcfcb('0x88')]['sync'](this,_0x5c269f,_0x29339e);if(_0x5199b6){for(var _0x3efc44 in _0x5199b6){if(_0x5199b6['hasOwnProperty'](_0x3efc44)){this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x12a'),_0x3efc44[_0xcfcb('0x6a')]()),_0x5199b6[_0x3efc44]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0xcfcb('0x72')](_0x5199b6)));}}return _0x44a54e;};AGIVertices['prototype'][_0xcfcb('0x12b')]=function(_0x795cb2){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x12c'),_0x795cb2['label']));if(!this['isConfigured'](_0x795cb2[_0xcfcb('0x89')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x12d'));}if(!this[_0xcfcb('0x7e')](_0x795cb2[_0xcfcb('0x8a')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x12e'));}var _0x2d26f7=_0xcfcb('0x125');var _0x522dca=util[_0xcfcb('0x2a')](_0xcfcb('0x126'),FILES_PATH,rs['generate'](0x4));var _0x4d99f1=util['format']('%s.%s',_0x522dca,_0x2d26f7);var _0x4b3cc6=!![];if(_0x795cb2[_0xcfcb('0x127')]==='NOBEEP'){_0x4b3cc6=![];}var _0x2cd46c=this[_0xcfcb('0xe')]['recordFile'](_0x522dca,_0x2d26f7,_0x795cb2[_0xcfcb('0x129')],_0x795cb2[_0xcfcb('0x68')],undefined,_0x4b3cc6);if(_0x2cd46c[_0xcfcb('0xab')]!==-0x1){this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x12f'),_0x4d99f1));var _0x20edce=this[_0xcfcb('0x130')][_0xcfcb('0xa2')](this,_0x795cb2,_0x4d99f1);if(_0x20edce){for(var _0x1d21f8 in _0x20edce){if(_0x20edce['hasOwnProperty'](_0x1d21f8)){this['channel'][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x131'),_0x1d21f8[_0xcfcb('0x6a')]()),_0x20edce[_0x1d21f8]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('TildeASR\x20Result\x20%s',JSON['stringify'](_0x20edce)));}}return _0x2cd46c;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x132')]=function(_0x2a460c){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2a460c[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')][_0xcfcb('0x133')](_0x2a460c[_0xcfcb('0x134')],_0x2a460c['extension'],_0x2a460c['priority']);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x135')]=function(_0x228df5){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x136'),_0x228df5[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x228df5[_0xcfcb('0x137')])){return this['channel'][_0xcfcb('0x2c')](_0x228df5,_0xcfcb('0x138'));}try{var _0x533a7a=eval(_0x228df5[_0xcfcb('0x137')])?'true':'false';this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x139'),_0x228df5[_0xcfcb('0x137')],_0x533a7a));return{'code':0xc8,'result':_0x533a7a};}catch(_0x1e1bcd){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x13a')]=function(_0x204ec6){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x13b'),_0x204ec6['label']));if(!this[_0xcfcb('0x7e')](_0x204ec6['interval_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x204ec6,_0xcfcb('0x13c'));}var _0x2f4e7c=this[_0xcfcb('0x25')]['sync'](this,_0x204ec6['interval_id']);if(!_0x2f4e7c){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x204ec6,_0xcfcb('0x13d'));}for(var _0x241985=0x0;_0x241985<_0x2f4e7c[_0xcfcb('0x98')];_0x241985+=0x1){var _0x2cdd4b=this['channel'][_0xcfcb('0x12')](util['format'](_0xcfcb('0x13e'),_0x2f4e7c[_0x241985]));if(_0x2cdd4b[_0xcfcb('0xab')]===-0x1){return _0x2cdd4b;}logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0x2cdd4b[_0xcfcb('0x9d')]));if(_0x2cdd4b['extra']===_0xcfcb('0x140')){logger['info'](util[_0xcfcb('0x2a')]('IFTIME\x20%s\x20%s',_0x2f4e7c[_0x241985],_0xcfcb('0x140')));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0xcfcb('0x140')));return{'code':0xc8,'result':_0xcfcb('0x140')};}else{logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],'false'));this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x13f'),_0x2f4e7c[_0x241985],_0xcfcb('0x141')));}}return{'code':0xc8,'result':_0xcfcb('0x141')};};AGIVertices['prototype'][_0xcfcb('0x142')]=function(_0x1404af){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x143'),_0x1404af['label']));return this[_0xcfcb('0xe')][_0xcfcb('0x142')]();};AGIVertices[_0xcfcb('0x11')]['ispeechasr']=function(_0x2b132a){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x144'),_0x2b132a['label']));if(!this['isConfigured'](_0x2b132a[_0xcfcb('0x77')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xe2'));}var _0x2ab424='wav';var _0x5c0e90=util[_0xcfcb('0x2a')](_0xcfcb('0x126'),FILES_PATH,rs[_0xcfcb('0x110')](0x4));var _0x1fa370=util[_0xcfcb('0x2a')]('%s.%s',_0x5c0e90,_0x2ab424);var _0x17e64d=!![];if(_0x2b132a[_0xcfcb('0x127')]===_0xcfcb('0x145')){_0x17e64d=![];}var _0x50fec3=this[_0xcfcb('0xe')][_0xcfcb('0x128')](_0x5c0e90,_0x2ab424,_0x2b132a['intKey'],_0x2b132a[_0xcfcb('0x68')],undefined,_0x17e64d);if(_0x50fec3[_0xcfcb('0xab')]!==-0x1){this['channel'][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x146'),_0x1fa370));var _0x577e05=this[_0xcfcb('0x7c')][_0xcfcb('0xa2')](this,_0x2b132a,_0x1fa370);if(_0x577e05){for(var _0x5b7647 in _0x577e05){if(_0x577e05['hasOwnProperty'](_0x5b7647)){this[_0xcfcb('0xe')]['setVariable'](util[_0xcfcb('0x2a')](_0xcfcb('0x147'),_0x5b7647[_0xcfcb('0x6a')]()),_0x577e05[_0x5b7647]);}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x577e05)));}}return _0x50fec3;};AGIVertices['prototype'][_0xcfcb('0x148')]=function(_0x5212d1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x149'),_0x5212d1[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x5212d1[_0xcfcb('0x77')])){return this['channel']['noop']('no\x20key\x20configured');}if(!this[_0xcfcb('0x7e')](_0x5212d1['text'])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20text\x20configured');}this[_0xcfcb('0xe')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x5212d1[_0xcfcb('0x5c')]));var _0x891007=this[_0xcfcb('0x7a')][_0xcfcb('0xa2')](this,_0x5212d1);if(_0x891007){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x146'),_0x891007));var _0x58c953=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x891007,_0x5212d1[_0xcfcb('0x129')]);try{fs[_0xcfcb('0x119')](_0x891007+_0xcfcb('0xf4'));}catch(_0x237880){logger[_0xcfcb('0x2c')](_0x237880);}return _0x58c953;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x5212d1,_0xcfcb('0x14a'));};AGIVertices['prototype'][_0xcfcb('0x14b')]=function(_0x59b19f){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x59b19f[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x59b19f[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x59b19f,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));var _0x223108=this['agentLogin'][_0xcfcb('0xa2')](this,_0x59b19f[_0xcfcb('0x14c')]);if(_0x223108){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x14e'),this['channel'][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x59b19f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x150')]=function(_0x27b018){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x27b018['label']));if(!this[_0xcfcb('0x7e')](_0x27b018['findBy'])){return this['channel'][_0xcfcb('0x2c')](_0x27b018,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x151'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));var _0x42e171=this[_0xcfcb('0x51')][_0xcfcb('0xa2')](this,_0x27b018[_0xcfcb('0x14c')]);if(_0x42e171){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util['format'](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x27b018[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this['channel'][_0xcfcb('0x3e')],_0x27b018['findBy']));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices['prototype']['math']=function(_0x441f22){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x441f22[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x441f22[_0xcfcb('0x154')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x441f22,'no\x20operation\x20configured');}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('math\x20%s',_0x441f22['operation']));var _0x559612=eval(_0x441f22[_0xcfcb('0x154')]);if(!this['isConfigured'](_0x441f22[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2bbf74=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x441f22['variable_id']);if(!_0x2bbf74){return this[_0xcfcb('0xe')]['error'](_0x441f22,_0xcfcb('0xd6'));}if(_[_0xcfcb('0x95')](_0x559612)){var _0x4a7066=this;_0x559612[_0xcfcb('0xd7')](function(_0x2d74cf,_0x521668){_0x4a7066[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')]('%s[%s]',_0x2bbf74,_0x521668),_0x2d74cf);});return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format']('variable\x20%s[key]\x20set',_0x2bbf74));}else{return this['channel'][_0xcfcb('0xd8')](_0x2bbf74,_0x559612);}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x155')]=function(_0x211dce){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x156'),_0x211dce[_0xcfcb('0x3a')]));if(_0x211dce['retry']===0x0){return this[_0xcfcb('0x100')](_0x211dce);}_0x211dce[_0xcfcb('0x101')]-=0x1;if(!this[_0xcfcb('0x7e')](_0x211dce['file_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x211dce,_0xcfcb('0x103'));}var _0x24d454=this['getSound'][_0xcfcb('0xa2')](this,_0x211dce[_0xcfcb('0x102')]);if(!_0x24d454){return this[_0xcfcb('0xe')]['error'](_0x211dce,_0xcfcb('0x105'));}var _0x2f0ee9=this[_0xcfcb('0xe')][_0xcfcb('0x107')](_0x24d454,_0x211dce['response'],_0x211dce[_0xcfcb('0x157')]);var _0x328a68=_0x2f0ee9[_0xcfcb('0xab')];if(_0x2f0ee9['result']===-0x1){this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x211dce,'-1');return _0x2f0ee9;}else if(_0x2f0ee9[_0xcfcb('0x9d')]===_0xcfcb('0x68')){_0x2f0ee9[_0xcfcb('0xab')]=_0x2f0ee9[_0xcfcb('0xab')][_0xcfcb('0x98')]>0x0?_0x2f0ee9[_0xcfcb('0xab')]:'t';}else if(_[_0xcfcb('0x47')](_0x2f0ee9['result'])){_0x2f0ee9[_0xcfcb('0xab')]='#';_0x328a68='#';}if(!this[_0xcfcb('0x7e')](_0x211dce['variable_id'])){this[_0xcfcb('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xf8ab52=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x211dce[_0xcfcb('0x106')]);if(!_0xf8ab52){return this['channel'][_0xcfcb('0x2c')](_0x211dce,_0xcfcb('0xd6'));}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xf8ab52,_0x328a68);}this['createSquareDetailsReport'][_0xcfcb('0xa2')](this,_0x211dce,_0x328a68);return _0x2f0ee9;};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0xa3')]=function(_0x2a5d56){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2a5d56['label']));return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0x2a5d56['output']||_0x2a5d56[_0xcfcb('0x3a')]);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x158')]=function(_0x18a00d){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x159'),_0x18a00d[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x18a00d[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x18a00d,_0xcfcb('0x14d'));}logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x151'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x18a00d['findBy']));var _0x16f153=this[_0xcfcb('0x15a')][_0xcfcb('0xa2')](this,_0x18a00d[_0xcfcb('0x15b')]);var _0x6a2577=this[_0xcfcb('0x4f')]['sync'](this,_0x18a00d[_0xcfcb('0x14c')],_0x16f153);if(_0x6a2577){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this['channel'][_0xcfcb('0x3e')],_0x18a00d[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this['channel']['callerid'],_0x18a00d[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util['format'](_0xcfcb('0x14f'),this[_0xcfcb('0xe')]['callerid'],_0x18a00d[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14e'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x18a00d[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x15c')]=function(_0x95b9c8){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x15d'),_0x95b9c8[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x95b9c8[_0xcfcb('0x102')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x95b9c8,_0xcfcb('0x103'));}var _0x3e0b75=this[_0xcfcb('0x104')][_0xcfcb('0xa2')](this,_0x95b9c8[_0xcfcb('0x102')]);if(!_0x3e0b75){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x95b9c8,_0xcfcb('0x105'));}var _0x47ec00=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x15e'),[_0x3e0b75,_0x95b9c8[_0xcfcb('0xde')]]);if(_0x47ec00[_0xcfcb('0xab')]===-0x1){return _0x47ec00;}return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x15e'),_0x3e0b75));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x15f')]=function(_0x4cf7a6){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x160'),_0x4cf7a6[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x4cf7a6['queue_id'])){return this[_0xcfcb('0xe')]['error'](_0x4cf7a6,_0xcfcb('0x161'));}var _0x278520='';var _0x40c006=parseInt(_0x4cf7a6[_0xcfcb('0x162')],0xa);if(isNaN(_0x40c006)){_0x278520=_0x4cf7a6[_0xcfcb('0x162')];}else{_0x278520=this[_0xcfcb('0x16')][_0xcfcb('0xa2')](this,_0x4cf7a6[_0xcfcb('0x162')]);if(!_0x278520){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x4cf7a6,'no\x20queue\x20found');}}var _0x5d18d2='';if(this[_0xcfcb('0x7e')](_0x4cf7a6[_0xcfcb('0x102')])){var _0x46afd6=this['getSound'][_0xcfcb('0xa2')](this,_0x4cf7a6['file_id']);if(_0x46afd6){_0x5d18d2=_0x46afd6;}}this[_0xcfcb('0x38')]['sync'](this,_0x4cf7a6,_0x278520);if(_0x4cf7a6[_0xcfcb('0xde')]['indexOf']('x')<0x0){_0x4cf7a6[_0xcfcb('0xde')]+='x';}if(_0x4cf7a6[_0xcfcb('0xde')][_0xcfcb('0x163')]('X')<0x0){_0x4cf7a6[_0xcfcb('0xde')]+='X';}this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xcfcb('0x164'),_0x278520?_0x278520[_0xcfcb('0x165')]():'');var _0x5af7d9=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x166'),[_0x278520,_0x4cf7a6['opts'],_0x4cf7a6['url'],_0x5d18d2,_0x4cf7a6[_0xcfcb('0x68')],_0x4cf7a6['agi'],_0x4cf7a6[_0xcfcb('0x167')],_0x4cf7a6[_0xcfcb('0x168')],'',_0x4cf7a6[_0xcfcb('0x169')]]);if(_0x5af7d9[_0xcfcb('0xab')]===-0x1){return _0x5af7d9;}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x166'),_0x278520));};AGIVertices['prototype'][_0xcfcb('0x16a')]=function(_0x1debc3){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1debc3['label']));var _0x206a6a=_0x1debc3[_0xcfcb('0x16b')]||'wav';var _0x2aa1e9=util['format']('%s_%s',this[_0xcfcb('0xe')][_0xcfcb('0x39')],rs['generate'](0x5));var _0x4d3816=util[_0xcfcb('0x2a')]('%s/recordings/%s.%s',FILES_PATH,_0x2aa1e9,_0x206a6a);var _0x67363=util['format'](_0xcfcb('0x126'),FILES_PATH,_0x2aa1e9);this['createSquareRecording']['sync'](this,_0x1debc3,_0x2aa1e9,_0x4d3816);this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0xcfcb('0x16c'),_0x2aa1e9);logger[_0xcfcb('0x30')](_0xcfcb('0x16d'),_0x67363,_0x206a6a,_0x1debc3[_0xcfcb('0x16e')],_0x1debc3[_0xcfcb('0x68')]);return this[_0xcfcb('0xe')]['recordFile'](_0x67363,_0x206a6a,_0x1debc3['escape_digits'],_0x1debc3[_0xcfcb('0x68')],undefined,!![]);};AGIVertices['prototype'][_0xcfcb('0x16f')]=function(_0x220367){logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x170'),_0x220367[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x220367['url'])){return this['channel'][_0xcfcb('0xa3')](_0xcfcb('0x171'));}var _0x348854=this[_0xcfcb('0x172')][_0xcfcb('0xa2')](this,_0x220367);logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x173'),util['inspect'](_0x348854,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x220367[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x174'));}var _0x4a7f0f=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x220367['variable_id']);if(!_0x4a7f0f){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x220367,_0xcfcb('0xd6'));}this['channel'][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x175'),_0x4a7f0f),_0x348854[_0xcfcb('0x176')]?_0x348854[_0xcfcb('0x176')]:'200');this[_0xcfcb('0xe')][_0xcfcb('0xd8')](util[_0xcfcb('0x2a')](_0xcfcb('0x177'),_0x4a7f0f),_0x348854['statusMessage']?_0x348854[_0xcfcb('0x178')]:'OK');if(_0x348854['body']){try{this[_0xcfcb('0x96')](_0x348854[_0xcfcb('0x71')],_0x4a7f0f);}catch(_0x3cf33a){logger[_0xcfcb('0x2c')](util[_0xcfcb('0x2a')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4a7f0f));}}return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0xda'),_0x4a7f0f));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x179')]=function(_0x506577){logger[_0xcfcb('0x30')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x506577[_0xcfcb('0x3a')]));return this['channel'][_0xcfcb('0x17a')](_0x506577['digits']['replace'](/\s+/g,''),_0x506577[_0xcfcb('0x16e')]);};AGIVertices['prototype'][_0xcfcb('0x17b')]=function(_0x1644bf){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x17c'),_0x1644bf['label']));return this[_0xcfcb('0xe')][_0xcfcb('0x17d')](_0x1644bf[_0xcfcb('0x67')]['replace'](/\s+/g,''),_0x1644bf[_0xcfcb('0x16e')]);};AGIVertices[_0xcfcb('0x11')]['sayphonetic']=function(_0x2db126){logger['info'](util['format'](_0xcfcb('0x17e'),_0x2db126['label']));return this[_0xcfcb('0xe')]['sayPhonetic'](_0x2db126['text'],_0x2db126['escape_digits']);};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x17f')]=function(_0x25abe6){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x180'),_0x25abe6[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x25abe6[_0xcfcb('0x181')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20mail\x20account\x20configured');}var _0x5336e8=this[_0xcfcb('0x182')]['sync'](this,_0x25abe6[_0xcfcb('0x181')]);if(!_0x5336e8||!_0x5336e8[_0xcfcb('0x183')]){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x25abe6,'no\x20mail\x20account\x20found');}var _0x202c20={'from':util[_0xcfcb('0x2a')](_0xcfcb('0x184'),_0x5336e8['name'],_0x5336e8['email']||_0x5336e8['Smtp'][_0xcfcb('0x185')]),'to':_0x25abe6['to']||'','cc':_0x25abe6['cc']||'','bcc':_0x25abe6[_0xcfcb('0x186')]||'','subject':_0x25abe6['subject'],'html':_0x25abe6[_0xcfcb('0x5c')],'text':_0x25abe6[_0xcfcb('0x5c')]};var _0x485d84={'tls':{'rejectUnauthorized':![]}};if(_0x5336e8['Smtp'][_0xcfcb('0x187')]){_0x485d84['service']=_0x5336e8[_0xcfcb('0x183')]['service'];}else{_0x485d84['host']=_0x5336e8['Smtp'][_0xcfcb('0x188')];_0x485d84[_0xcfcb('0x189')]=_0x5336e8[_0xcfcb('0x183')]['port'];_0x485d84[_0xcfcb('0x18a')]=_0x5336e8[_0xcfcb('0x183')][_0xcfcb('0x18a')];}if(_0x5336e8['Smtp'][_0xcfcb('0x18b')]){_0x485d84[_0xcfcb('0x18c')]={'user':_0x5336e8[_0xcfcb('0x183')][_0xcfcb('0x185')],'pass':_0x5336e8[_0xcfcb('0x183')]['pass']};}if(this[_0xcfcb('0x7e')](_0x25abe6['template_id'])){}logger[_0xcfcb('0x18d')](_0xcfcb('0x18e'),JSON['stringify'](_0x202c20));this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x25abe6,_0x25abe6[_0xcfcb('0x181')]);this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x18f'),_0x5336e8[_0xcfcb('0x14')]));this['sendMailMessage']['sync'](this,_0x485d84,_0x202c20);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x190'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x191')]=function(_0x546272){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x192'),_0x546272[_0xcfcb('0x3a')]));return this[_0xcfcb('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x193')]=function(_0xe04879){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x194'),_0xe04879['label']));if(!this[_0xcfcb('0x7e')](_0xe04879[_0xcfcb('0x195')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('no\x20sms\x20account\x20configured');}var _0x4cdd11=this[_0xcfcb('0x35')][_0xcfcb('0xa2')](this,_0xe04879[_0xcfcb('0x195')]);if(!_0x4cdd11){return this['channel']['error'](_0xe04879,_0xcfcb('0x196'));}var _0x353817={'body':_0xe04879[_0xcfcb('0x197')],'phone':_0xe04879['to']||'','SmsAccountId':_0x4cdd11['id']};logger[_0xcfcb('0x18d')](_0xcfcb('0x198'),JSON['stringify'](_0x353817));this[_0xcfcb('0x38')]['sync'](this,_0xe04879,_0xe04879['sms_account_id']);this['channel']['noop'](util['format'](_0xcfcb('0x199'),_0x4cdd11['name']));this[_0xcfcb('0x37')][_0xcfcb('0xa2')](this,_0x353817);return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0x19a'));};AGIVertices['prototype']['set']=function(_0x164b8d){logger['info'](util[_0xcfcb('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x164b8d[_0xcfcb('0x3a')]));if(!this['isConfigured'](_0x164b8d[_0xcfcb('0x106')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x164b8d,_0xcfcb('0x19b'));}var _0x19b55f=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x164b8d[_0xcfcb('0x106')]);if(!_0x19b55f){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x164b8d,_0xcfcb('0xd6'));}return this[_0xcfcb('0xe')][_0xcfcb('0xd8')](_0x19b55f,_0x164b8d['variable_value']);};AGIVertices[_0xcfcb('0x11')]['start']=function(_0x88f987){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x19c'),_0x88f987[_0xcfcb('0x3a')]));this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('START\x20CALLY\x20SQUARE');if(_0x88f987[_0xcfcb('0xb5')]==='yes'){this[_0xcfcb('0xe')][_0xcfcb('0xa3')]('Answer');return this['channel']['answer']();}return this[_0xcfcb('0xe')]['noop'](_0xcfcb('0x19d'));};AGIVertices[_0xcfcb('0x11')]['subproject']=function(_0x3ad3b4){logger[_0xcfcb('0x30')](util['format'](_0xcfcb('0x19e'),_0x3ad3b4[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x3ad3b4[_0xcfcb('0x19f')])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3ad3b4,_0xcfcb('0x1a0'));}var _0x21cbae=this[_0xcfcb('0x18')][_0xcfcb('0xa2')](this,_0x3ad3b4[_0xcfcb('0x19f')]);if(!this[_0xcfcb('0x7e')](_0x21cbae)){return this[_0xcfcb('0xe')]['error'](_0x3ad3b4,util[_0xcfcb('0x2a')](_0xcfcb('0x1a1'),_0x3ad3b4[_0xcfcb('0x19f')]));}if(_0x21cbae===this[_0xcfcb('0xe')][_0xcfcb('0x3c')]){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x3ad3b4,_0xcfcb('0x1a2'));}this[_0xcfcb('0x38')]['sync'](this,_0x3ad3b4,_0x21cbae);var _0x52ccff=this[_0xcfcb('0xe')][_0xcfcb('0x57')](_0xcfcb('0x1a3'),util[_0xcfcb('0x2a')](_0xcfcb('0x1a4'),config[_0xcfcb('0xb1')][_0xcfcb('0x188')]||'127.0.0.1',_0x21cbae,this[_0xcfcb('0xe')][_0xcfcb('0x3c')]));if(_0x52ccff[_0xcfcb('0xab')]===-0x1){return _0x52ccff;}return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0xc2'),_0xcfcb('0x1a3'),_0x21cbae));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1a5')]=function(_0x1bdb19){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1a6'),_0x1bdb19[_0xcfcb('0x3a')]));var _0x332d88=this[_0xcfcb('0x56')][_0xcfcb('0xa2')](this,_0x1bdb19[_0xcfcb('0xb3')]);this[_0xcfcb('0x38')][_0xcfcb('0xa2')](this,_0x1bdb19,_0x1bdb19[_0xcfcb('0xb3')]);if(this[_0xcfcb('0x7e')](_0x1bdb19['variable_id'])){var _0x32fd95=this['getVariable'][_0xcfcb('0xa2')](this,_0x1bdb19[_0xcfcb('0x106')]);if(_0x32fd95){this['channel']['setVariable'](_0x32fd95,_0x332d88);return this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x1a7'),_0x1bdb19['command'],_0x32fd95));}}return this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x1a8'),_0x1bdb19[_0xcfcb('0xb3')]));};AGIVertices['prototype'][_0xcfcb('0x1a9')]=function(_0x42f3c4){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1aa'),_0x42f3c4[_0xcfcb('0x3a')]));_0x42f3c4[_0xcfcb('0x5c')]=_0x42f3c4[_0xcfcb('0x5c')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcfcb('0x7e')](_0x42f3c4[_0xcfcb('0x1ab')])){return this['channel']['noop']('no\x20apiKey\x20configured');}if(!this[_0xcfcb('0x7e')](_0x42f3c4[_0xcfcb('0x5c')])){return this[_0xcfcb('0xe')][_0xcfcb('0xa3')](_0xcfcb('0xa4'));}this['channel'][_0xcfcb('0xa3')](util['format'](_0xcfcb('0x1ac'),_0x42f3c4['text']));var _0x28ac60=this[_0xcfcb('0x5a')][_0xcfcb('0xa2')](this,_0x42f3c4);if(_0x28ac60){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x1ad'),_0x28ac60));var _0x17afc5=this[_0xcfcb('0xe')][_0xcfcb('0xf3')](_0x28ac60);try{fs[_0xcfcb('0x119')](_0x28ac60+_0xcfcb('0xf4'));}catch(_0x3971d2){logger[_0xcfcb('0x2c')](_0x3971d2);}return _0x17afc5;}return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x42f3c4,_0xcfcb('0x1ae'));};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1af')]=function(_0x303cfb){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x303cfb[_0xcfcb('0x3a')]));_0x303cfb[_0xcfcb('0x5c')]=_0x303cfb[_0xcfcb('0x5c')][_0xcfcb('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x303cfb[_0xcfcb('0x5c')])){return this['channel'][_0xcfcb('0xa3')]('no\x20text\x20configured');}this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b0'),_0x303cfb[_0xcfcb('0x5c')]));var _0x2b2ade=this[_0xcfcb('0x63')][_0xcfcb('0xa2')](this,_0x303cfb);if(_0x2b2ade){this[_0xcfcb('0xe')][_0xcfcb('0xa3')](util[_0xcfcb('0x2a')]('Google\x20TTS\x20%s\x20file\x20created',_0x2b2ade));var _0xf2b55=this[_0xcfcb('0xe')]['streamFile'](_0x2b2ade);try{fs[_0xcfcb('0x119')](_0x2b2ade+_0xcfcb('0xf4'));}catch(_0x108bec){logger[_0xcfcb('0x2c')](_0x108bec);}return _0xf2b55;}return this['channel'][_0xcfcb('0x2c')](_0x303cfb,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xcfcb('0x11')][_0xcfcb('0x1b1')]=function(_0x470ab1){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b2'),_0x470ab1[_0xcfcb('0x3a')]));if(!this[_0xcfcb('0x7e')](_0x470ab1[_0xcfcb('0x14c')])){return this[_0xcfcb('0xe')]['error'](_0x470ab1,_0xcfcb('0x14d'));}logger['info'](util[_0xcfcb('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));var _0x47ea38=this[_0xcfcb('0x50')][_0xcfcb('0xa2')](this,_0x470ab1[_0xcfcb('0x14c')]);if(_0x47ea38){logger['info'](util[_0xcfcb('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));this['channel'][_0xcfcb('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xcfcb('0xe')]['callerid'],_0x470ab1[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x152')};}else{logger['info'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this['channel']['callerid'],_0x470ab1[_0xcfcb('0x14c')]));this[_0xcfcb('0xe')]['noop'](util[_0xcfcb('0x2a')](_0xcfcb('0x14f'),this[_0xcfcb('0xe')][_0xcfcb('0x3e')],_0x470ab1[_0xcfcb('0x14c')]));return{'code':0xc8,'result':_0xcfcb('0x153')};}};AGIVertices['prototype'][_0xcfcb('0x1b3')]=function(_0x367c06){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')](_0xcfcb('0x1b4'),_0x367c06[_0xcfcb('0x3a')]));var _0x125e74=this['channel'][_0xcfcb('0x57')](_0xcfcb('0x1b5'),[_0x367c06[_0xcfcb('0x1b6')],_0x367c06[_0xcfcb('0x75')]]);if(_0x125e74['result']===-0x1){return _0x125e74;}return this[_0xcfcb('0xe')]['noop'](util['format'](_0xcfcb('0xc2'),'VOICEMAIL',_0x367c06[_0xcfcb('0x1b6')]));};AGIVertices[_0xcfcb('0x11')]['vswitch']=function(_0x16b7e0){logger[_0xcfcb('0x30')](util[_0xcfcb('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x16b7e0['label']));if(!this[_0xcfcb('0x7e')](_0x16b7e0['variable_id'])){return this[_0xcfcb('0xe')][_0xcfcb('0x2c')](_0x16b7e0,_0xcfcb('0x19b'));}var _0x4cc57a=this[_0xcfcb('0x12')][_0xcfcb('0xa2')](this,_0x16b7e0[_0xcfcb('0x106')]);if(!_0x4cc57a){return this['channel'][_0xcfcb('0x2c')](_0x16b7e0,_0xcfcb('0xd6'));}var _0x26fc50=this[_0xcfcb('0xe')]['getVariable'](_0x4cc57a);return{'code':0xc8,'result':_0x26fc50[_0xcfcb('0x9d')]?_0x26fc50[_0xcfcb('0x9d')]:'-'};};String['prototype'][_0xcfcb('0x9c')]=function(_0x273851,_0xf0d4ae){return this[_0xcfcb('0x9a')](_0x273851)[_0xcfcb('0x1b7')](_0xf0d4ae);};module[_0xcfcb('0x1b8')]=AGIVertices; \ No newline at end of file +var _0x05bc=['googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','no\x20condition\x20configured','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','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','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','success','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','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','saynumber','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','bcc','subject','service','host','port','secure','authentication','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','shellCommand','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','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','extension','priority','dnid','file','createSquareMessage','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','dialogflow_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','key','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','replaceall\x20init','split','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','enter\x20in\x20callbackblock','no\x20list\x20selected','delay','minutes','before\x20createcmcontact','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','getSquareOdbc','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','response','maxdigit','mindigit','hiddendigitsnum','generate','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s'];(function(_0x21ed1c,_0x29e13b){var _0x29a822=function(_0x3f1ef1){while(--_0x3f1ef1){_0x21ed1c['push'](_0x21ed1c['shift']());}};_0x29a822(++_0x29e13b);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xc05b('0x0'));var _=require('lodash');var sh=require(_0xc05b('0x1'));var odbc=require(_0xc05b('0x2'))();var rs=require('randomstring');var moment=require(_0xc05b('0x3'));var Mustache=require(_0xc05b('0x4'));var rp=require(_0xc05b('0x5'));var logger=require(_0xc05b('0x6'))(_0xc05b('0x7'));var config=require(_0xc05b('0x8'));var scripts=require(_0xc05b('0x9'));var FILES_PATH=_0xc05b('0xa');var recursiveMapAttributes=[_0xc05b('0xb'),_0xc05b('0xc')];var verticesWithRetry=[_0xc05b('0xd'),_0xc05b('0xe'),_0xc05b('0xf')];var AGIVertices=function(_0x2b6c75,_0x5c13ee,_0x5d72b9){this[_0xc05b('0x10')]=_0x2b6c75;this[_0xc05b('0x11')]=_0x5c13ee;this[_0xc05b('0x12')]=_0x5d72b9;};AGIVertices[_0xc05b('0x13')][_0xc05b('0x14')]=function(_0x39b413,_0x40103a){this[_0xc05b('0x11')][_0xc05b('0x15')](_0x39b413)['then'](function(_0x2976c2){_0x40103a(null,_0x2976c2?_0x2976c2[_0xc05b('0x16')]:![]);})[_0xc05b('0x17')](function(_0x160659){_0x40103a(_0x160659);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x18')]=function(_0x55c1d3,_0xc3030a){this[_0xc05b('0x11')]['getVoiceQueueById'](_0x55c1d3)['then'](function(_0x356b76){_0xc3030a(null,_0x356b76?_0x356b76[_0xc05b('0x16')]:![]);})[_0xc05b('0x17')](function(_0xcceda9){_0xc3030a(_0xcceda9);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x19')]=function(_0xe94a8f,_0x5a33c1){this[_0xc05b('0x11')][_0xc05b('0x1a')](_0xe94a8f)[_0xc05b('0x1b')](function(_0x421cb){_0x5a33c1(null,_0x421cb?_0x421cb[_0xc05b('0x16')]:![]);})[_0xc05b('0x17')](function(_0x58224d){_0x5a33c1(_0x58224d);});};AGIVertices[_0xc05b('0x13')]['getSquareOdbc']=function(_0x3cc005,_0x561e50){this[_0xc05b('0x11')][_0xc05b('0x1c')](_0x3cc005)[_0xc05b('0x1b')](function(_0x48c36e){_0x561e50(null,_0x48c36e?_0x48c36e[_0xc05b('0x1d')]:![]);})[_0xc05b('0x17')](function(_0x1837fa){_0x561e50(_0x1837fa);});};AGIVertices[_0xc05b('0x13')]['getUser']=function(_0x1766bd,_0x456930){this[_0xc05b('0x11')][_0xc05b('0x1e')](_0x1766bd)[_0xc05b('0x1b')](function(_0x9a67cc){_0x456930(null,_0x9a67cc?_0x9a67cc['name']:![]);})['catch'](function(_0x2699fb){_0x456930(_0x2699fb);});};AGIVertices[_0xc05b('0x13')]['getTrunk']=function(_0x949652,_0x5b9e1f){this['rpc'][_0xc05b('0x1f')](_0x949652)['then'](function(_0x4eee98){_0x5b9e1f(null,_0x4eee98?_0x4eee98['name']:![]);})[_0xc05b('0x17')](function(_0x4c133c){_0x5b9e1f(_0x4c133c);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x20')]=function(_0x4d1fd4,_0x337cc1){var _0x395baa=this;this[_0xc05b('0x11')][_0xc05b('0x21')](_0x4d1fd4)[_0xc05b('0x1b')](function(_0xeb6d8b){_0x337cc1(null,_0xeb6d8b?_0x395baa[_0xc05b('0x22')](_0xeb6d8b[_0xc05b('0x23')]):![]);})[_0xc05b('0x17')](function(_0x12e0d3){_0x337cc1(_0x12e0d3);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x24')]=function(_0x4fbdc7,_0x3ca295){this['rpc'][_0xc05b('0x25')](_0x4fbdc7)['then'](function(_0x580d43){_0x3ca295(null,_0x580d43?_0x580d43:![]);})[_0xc05b('0x17')](function(_0x772f50){_0x3ca295(_0x772f50);});};AGIVertices[_0xc05b('0x13')]['sendMailMessage']=function(_0x884fcb,_0x4deec8,_0x4dee50){this['mailRpc'][_0xc05b('0x26')](_0x884fcb,_0x4deec8)[_0xc05b('0x1b')](function(){_0x4dee50(null);})[_0xc05b('0x17')](function(_0x5dbceb){_0x4dee50(_0x5dbceb);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x27')]=function(_0x3ca671,_0x22abe3){this['rpc'][_0xc05b('0x28')](_0x3ca671)[_0xc05b('0x1b')](function(_0x26814d){if(_0x26814d){if(_0x26814d['IntervalId']){_0x22abe3(null,[_0x26814d[_0xc05b('0x29')]]);}else{_0x22abe3(null,_[_0xc05b('0x2a')](_0x26814d['Intervals'],_0xc05b('0x29')));}}else{_0x22abe3(null,![]);}})[_0xc05b('0x17')](function(_0x4a640d){_0x22abe3(_0x4a640d);});};AGIVertices['prototype'][_0xc05b('0x22')]=function(_0x3bd87c){return util[_0xc05b('0x2b')](_0xc05b('0x2c'),FILES_PATH,_0x3bd87c);};AGIVertices['prototype'][_0xc05b('0x2d')]=function(_0x4883c2,_0xea8bc4,_0x2239aa){odbc[_0xc05b('0x2e')](_0x4883c2,function(_0x98ecbd){if(_0x98ecbd){logger['error'](_0xc05b('0x2f'),_0x98ecbd);_0x2239aa(_0x98ecbd);}else{logger[_0xc05b('0x30')]('ODBC\x20connection\x20successfully');odbc['query'](_0xea8bc4,function(_0x3e1861,_0x806d8d){if(_0x3e1861){logger[_0xc05b('0x30')](_0xc05b('0x31'),_0xea8bc4);_0x2239aa(_0x3e1861);}else{logger[_0xc05b('0x30')]('Query\x20executed\x20correctly\x20%s',_0xea8bc4);odbc[_0xc05b('0x32')](function(_0x125af2){if(_0x125af2){logger[_0xc05b('0x33')](_0xc05b('0x34'),_0x125af2);}_0x2239aa(null,_0x806d8d);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3ed64c,_0x56ba68){this[_0xc05b('0x11')]['getSmsAccountById'](_0x3ed64c)[_0xc05b('0x1b')](function(_0x12001f){_0x56ba68(null,_0x12001f?_0x12001f:![]);})[_0xc05b('0x17')](function(_0x1222a8){_0x56ba68(_0x1222a8);});};AGIVertices['prototype']['createSmsMessage']=function(_0x2aa4b8,_0x4b3150){this[_0xc05b('0x11')]['createSmsMessage'](_0x2aa4b8)[_0xc05b('0x1b')](function(_0x1f6ecb){_0x4b3150(null,_0x1f6ecb);})['catch'](function(_0x3697ff){_0x4b3150(_0x3697ff);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x35')]=function(_0x1f7288,_0x6d9709,_0x423145){this[_0xc05b('0x11')][_0xc05b('0x35')]({'uniqueid':this[_0xc05b('0x10')][_0xc05b('0x36')],'node':_0x1f7288[_0xc05b('0x37')],'application':_0x1f7288['agicommand'],'data':_0x6d9709||null,'project_name':this[_0xc05b('0x10')][_0xc05b('0x38')],'callerid':this[_0xc05b('0x10')]['callerid']})[_0xc05b('0x1b')](function(_0x2b830a){if(_0x423145){_0x423145(null,_0x2b830a);}})[_0xc05b('0x17')](function(_0x434087){if(_0x423145){_0x423145(_0x434087);}});};AGIVertices['prototype'][_0xc05b('0x39')]=function(_0x281f1d,_0x5aabb4,_0x51d277,_0x41a78d){this[_0xc05b('0x11')]['createSquareRecording']({'uniqueid':this[_0xc05b('0x10')][_0xc05b('0x36')],'callerid':this[_0xc05b('0x10')][_0xc05b('0x3a')],'calleridname':this[_0xc05b('0x10')][_0xc05b('0x3b')],'context':this[_0xc05b('0x10')]['context'],'extension':this[_0xc05b('0x10')][_0xc05b('0x3c')],'priority':this[_0xc05b('0x10')][_0xc05b('0x3d')],'accountcode':this[_0xc05b('0x10')]['accountcode'],'dnid':this[_0xc05b('0x10')][_0xc05b('0x3e')],'projectName':this[_0xc05b('0x10')][_0xc05b('0x38')],'saveName':_0x5aabb4,'filename':_0x281f1d[_0xc05b('0x3f')]||_0x5aabb4,'savePath':_0x51d277})[_0xc05b('0x1b')](function(_0xe7e2a3){_0x41a78d(null,_0xe7e2a3);})['catch'](function(_0x31deaa){_0x41a78d(_0x31deaa);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x40')]=function(_0x227a4f,_0x3a0f9d,_0x256eb6){this['rpc'][_0xc05b('0x40')]({'uniqueid':this[_0xc05b('0x10')]['uniqueid'],'body':_0x227a4f,'direction':_0x3a0f9d})[_0xc05b('0x1b')](function(_0x332111){if(_0x256eb6){_0x256eb6(null,_0x332111);}})[_0xc05b('0x17')](function(_0x1155a8){if(_0x256eb6){_0x256eb6(_0x1155a8);}});};AGIVertices['prototype']['createCmContact']=function(_0x8e5eab,_0xb9b274){console[_0xc05b('0x41')](_0xc05b('0x42'),_0x8e5eab);console['log'](_0xc05b('0x43'),_0xb9b274);this['rpc']['createCmContact']({'firstName':_[_0xc05b('0x44')](_0x8e5eab[_0xc05b('0x16')])||_[_0xc05b('0x45')](_0x8e5eab[_0xc05b('0x16')])?_0xc05b('0x46')+Math['random']():_0x8e5eab[_0xc05b('0x16')],'lastName':_['isEmpty'](_0x8e5eab[_0xc05b('0x47')])||_[_0xc05b('0x45')](_0x8e5eab[_0xc05b('0x47')])?null:_0x8e5eab['lastName'],'phone':_0x8e5eab[_0xc05b('0x48')],'ListId':_0x8e5eab[_0xc05b('0x49')],'scheduledat':_0x8e5eab[_0xc05b('0x4a')],'callbackUniqueid':this[_0xc05b('0x10')][_0xc05b('0x36')],'tags':_0xc05b('0x4b'),'description':_0xc05b('0x4c')+_0x8e5eab['scheduledAt'][_0xc05b('0x4d')](),'priority':_0x8e5eab[_0xc05b('0x4e')]})[_0xc05b('0x1b')](function(_0x2d6624){_0xb9b274(null,_0x2d6624);})['catch'](function(_0x19f68e){_0xb9b274(_0x19f68e);});};AGIVertices[_0xc05b('0x13')]['getPause']=function(_0x64c40f,_0x452e73){this[_0xc05b('0x11')][_0xc05b('0x4f')](_0x64c40f)['then'](function(_0x45ae8d){_0x452e73(null,_0x45ae8d?_0x45ae8d['name']:![]);})['catch'](function(_0x1b81f3){_0x452e73(_0x1b81f3);});};AGIVertices['prototype'][_0xc05b('0x50')]=function(_0x32119b,_0x28d80c,_0x14d275){var _0x3917bc={'role':_0xc05b('0x51')};_0x3917bc[_0x32119b]=this[_0xc05b('0x10')][_0xc05b('0x3a')];this[_0xc05b('0x11')][_0xc05b('0x50')](_0x3917bc,_0x28d80c,this[_0xc05b('0x10')][_0xc05b('0x36')])[_0xc05b('0x1b')](function(_0x242e08){_0x14d275(null,_['isNil'](_0x242e08)?![]:!![]);})[_0xc05b('0x17')](function(_0x18ba67){logger['error'](_0x18ba67);_0x14d275(null,![]);});};AGIVertices['prototype'][_0xc05b('0x52')]=function(_0x433a05,_0x13ce1f){var _0x1f8640={'role':_0xc05b('0x51')};_0x1f8640[_0x433a05]=this[_0xc05b('0x10')][_0xc05b('0x3a')];this[_0xc05b('0x11')][_0xc05b('0x52')](_0x1f8640)[_0xc05b('0x1b')](function(_0xf5a736){_0x13ce1f(null,_[_0xc05b('0x45')](_0xf5a736)?![]:!![]);})[_0xc05b('0x17')](function(_0x2dda37){logger[_0xc05b('0x33')](_0x2dda37);_0x13ce1f(null,![]);});};AGIVertices['prototype'][_0xc05b('0x53')]=function(_0x1d281d,_0x39cdff){var _0x25f56a={'role':_0xc05b('0x51')};_0x25f56a[_0x1d281d]=this[_0xc05b('0x10')]['callerid'];this[_0xc05b('0x11')]['agentLogout'](_0x25f56a)[_0xc05b('0x1b')](function(_0x442f91){_0x39cdff(null,_[_0xc05b('0x45')](_0x442f91)?![]:!![]);})[_0xc05b('0x17')](function(_0x30bceb){logger[_0xc05b('0x33')](_0x30bceb);_0x39cdff(null,![]);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x54')]=function(_0x79706,_0x4fa23c){var _0x2a307e={'role':_0xc05b('0x51')};_0x2a307e[_0x79706]=this[_0xc05b('0x10')][_0xc05b('0x3a')];var _0x1006a3=_0x79706!=_0xc05b('0x55')?util[_0xc05b('0x2b')]('%s/%s@from-sip/n',_0xc05b('0x56'),this[_0xc05b('0x10')][_0xc05b('0x3a')]):undefined;this[_0xc05b('0x11')][_0xc05b('0x54')](_0x2a307e,_0x1006a3)[_0xc05b('0x1b')](function(_0x50c70e){_0x4fa23c(null,_[_0xc05b('0x45')](_0x50c70e)?![]:!![]);})[_0xc05b('0x17')](function(_0x1c0ac2){logger[_0xc05b('0x33')](_0x1c0ac2);_0x4fa23c(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x46bcdb,_0x2002f0){sh[_0xc05b('0x57')](_[_0xc05b('0x58')](_0x46bcdb),function(_0x31d781,_0x498d4c){var _0x531b9e=_0x498d4c[_0xc05b('0x59')](/(\r\n|\n|\r)/gm,'');_0x2002f0(null,_0x531b9e);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x5a')]=function(_0xd0918d,_0x5c1bda){scripts[_0xc05b('0x5a')](_0xd0918d[_0xc05b('0x5b')],_0xd0918d['google_cloud_tts_text_type']||_0xc05b('0x5c'),_0xd0918d[_0xc05b('0x5c')],_0xd0918d[_0xc05b('0x5d')]||_0xc05b('0x5e'),_0xd0918d[_0xc05b('0x5f')]||'MALE',_0xd0918d[_0xc05b('0x60')]||_0xc05b('0x61'))[_0xc05b('0x1b')](function(_0x427cc4){_0x5c1bda(null,_0x427cc4);})[_0xc05b('0x17')](function(_0x4f28a9){_0x5c1bda(_0x4f28a9);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x62')]=function(_0x128899,_0x12bb92){scripts[_0xc05b('0x62')](_0x128899[_0xc05b('0x5c')],_0x128899[_0xc05b('0x63')]||'en',0x1)['then'](function(_0x466c12){_0x12bb92(null,_0x466c12);})['catch'](function(_0x4a5a7a){_0x12bb92(_0x4a5a7a);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x64')]=function(_0x340810,_0x5c7bc9){var _0x46622b={'uri':_0x340810[_0xc05b('0x65')],'method':_0x340810[_0xc05b('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x340810['timeout'])===_0xc05b('0x67')&&parseInt(_0x340810[_0xc05b('0x68')])>=0x1?parseInt(_0x340810['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xc05b('0x69')](['POST',_0xc05b('0x6a')],_0x46622b[_0xc05b('0x66')][_0xc05b('0x6b')]())){try{_0x46622b[_0xc05b('0x6c')]=_0x340810['rawBody']?JSON['parse'](_0x340810['rawBody']):{};}catch(_0x1a84de){logger[_0xc05b('0x33')](_0xc05b('0x6d'),_0x1a84de);}}try{_0x46622b[_0xc05b('0x6e')]=_0x340810[_0xc05b('0xb')]?JSON['parse'](_0x340810[_0xc05b('0xb')]):{};}catch(_0x2c8775){logger[_0xc05b('0x33')](_0xc05b('0x6f'),_0x2c8775);}if(_0x340810[_0xc05b('0x70')]){try{var _0xc3b2cc=require(_0x340810[_0xc05b('0x70')])[_0xc05b('0x71')](this,_0x46622b);_0x46622b[_0xc05b('0x72')]=Mustache[_0xc05b('0x73')](_0x340810[_0xc05b('0x65')],_0xc3b2cc,{},['$$','$$']);if(_0x46622b[_0xc05b('0x6e')]){_0x46622b[_0xc05b('0x6e')]=JSON[_0xc05b('0x74')](Mustache['render'](JSON[_0xc05b('0x75')](_0x46622b[_0xc05b('0x6e')]),_0xc3b2cc,{},['$$','$$']));}if(_0x46622b[_0xc05b('0x6c')]){_0x46622b[_0xc05b('0x6c')]=JSON[_0xc05b('0x74')](Mustache[_0xc05b('0x73')](JSON['stringify'](_0x46622b['body']),_0xc3b2cc,{},['$$','$$']));}}catch(_0x13e818){logger[_0xc05b('0x33')](_0xc05b('0x76'),_0x13e818);}}rp(_0x46622b)[_0xc05b('0x1b')](function(_0x50a1b9){var _0x367830={'statusCode':_0x50a1b9[_0xc05b('0x77')]||0xc8,'statusMessage':_0x50a1b9['statusMessage']||'OK','headers':_0x50a1b9[_0xc05b('0x6e')]||{},'body':_0x50a1b9[_0xc05b('0x6c')]||{}};_0x5c7bc9(null,_0x367830);})[_0xc05b('0x17')](function(_0x3744cd){var _0x38a63d={'statusCode':_0x3744cd['statusCode']||0x1f4,'statusMessage':_0x3744cd['message']||_0xc05b('0x78'),'headers':_0x3744cd[_0xc05b('0x79')]['headers']||{},'body':_0x3744cd['options'][_0xc05b('0x6c')]||{}};_0x5c7bc9(null,_0x38a63d);});};AGIVertices['prototype']['googleDialogflow']=function(_0x556d46,_0x51e25b){scripts['googleDialogflow'](this[_0xc05b('0x10')]['uniqueid'],_0x556d46['key'],_0x556d46['text'],_0x556d46[_0xc05b('0x7a')]||'en')['then'](function(_0x112de7){_0x51e25b(null,_0x112de7);})[_0xc05b('0x17')](function(_0xbffec6){_0x51e25b(_0xbffec6);});};AGIVertices['prototype'][_0xc05b('0x7b')]=function(_0x435588,_0x246cc9){scripts[_0xc05b('0x7b')](this[_0xc05b('0x10')],_0x435588)[_0xc05b('0x1b')](function(_0x512a29){_0x246cc9(null,_0x512a29);})[_0xc05b('0x17')](function(_0x4da505){_0x246cc9(_0x4da505);});};AGIVertices[_0xc05b('0x13')]['ispeechTTS']=function(_0x3285d3,_0x144712){scripts[_0xc05b('0x7c')](_0x3285d3['key'],_0x3285d3[_0xc05b('0x5c')],_0x3285d3['ispeech_tts_language']||_0xc05b('0x5e'),_0x3285d3[_0xc05b('0x7d')])['then'](function(_0x56c855){_0x144712(null,_0x56c855);})[_0xc05b('0x17')](function(_0x1fbefb){_0x144712(_0x1fbefb);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x7e')]=function(_0x2a07d1,_0x1bd6c2,_0x466af8){scripts[_0xc05b('0x7e')](_0x1bd6c2,_0x2a07d1['key'],_0x2a07d1[_0xc05b('0x7f')]||'en-US',this[_0xc05b('0x80')](_0x2a07d1['model'])?_0x2a07d1[_0xc05b('0x81')]:undefined)[_0xc05b('0x1b')](function(_0x305e3e){_0x466af8(null,_0x305e3e);})[_0xc05b('0x17')](function(_0x20c939){_0x466af8(_0x20c939);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x82')]=function(_0x16875f,_0x5843b9){scripts[_0xc05b('0x82')](_0x16875f[_0xc05b('0x83')],_0x16875f[_0xc05b('0x84')],_0x16875f[_0xc05b('0x85')],_0x16875f[_0xc05b('0x86')]||_0xc05b('0x87'),_0x16875f[_0xc05b('0x5c')],_0x16875f[_0xc05b('0x88')]||_0xc05b('0x5c'))['then'](function(_0x256976){_0x5843b9(null,_0x256976);})[_0xc05b('0x17')](function(_0x1c33e8){_0x5843b9(_0x1c33e8);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x89')]=function(_0x5da070,_0x5ec92b){scripts['awsLex'](this[_0xc05b('0x10')][_0xc05b('0x36')],_0x5da070[_0xc05b('0x83')],_0x5da070[_0xc05b('0x84')],_0x5da070[_0xc05b('0x8a')],_0x5da070[_0xc05b('0x5c')],_0x5da070[_0xc05b('0x8b')])[_0xc05b('0x1b')](function(_0x4818d2){_0x5ec92b(null,_0x4818d2);})['catch'](function(_0x4bdb5c){_0x5ec92b(_0x4bdb5c);});};AGIVertices['prototype'][_0xc05b('0x8c')]=function(_0x52cf1c,_0x2d8d62,_0x236376){scripts[_0xc05b('0x8c')](_0x2d8d62,_0x52cf1c[_0xc05b('0x8d')],_0x52cf1c[_0xc05b('0x8e')]||_0xc05b('0x5e'))[_0xc05b('0x1b')](function(_0x1921a2){_0x236376(null,_0x1921a2);})['catch'](function(_0x3fbbdf){_0x236376(_0x3fbbdf);});};AGIVertices[_0xc05b('0x13')][_0xc05b('0x8f')]=function(_0x187622,_0x5d07e1,_0x57cb96){scripts[_0xc05b('0x8f')](_0x5d07e1,_0x187622[_0xc05b('0x90')],_0x187622[_0xc05b('0x91')],_0x187622['uri'])[_0xc05b('0x1b')](function(_0x2f7744){_0x57cb96(null,_0x2f7744);})[_0xc05b('0x17')](function(_0x91437d){_0x57cb96(_0x91437d);});};AGIVertices['prototype'][_0xc05b('0x92')]=function(_0x4d4896){var _0x15c963=_['includes'](verticesWithRetry,_0x4d4896[_0xc05b('0x93')])?_0x4d4896:_['clone'](_0x4d4896);for(var _0x18a85e in _0x15c963){if(_0x15c963[_0xc05b('0x94')](_0x18a85e)){if(_0x15c963[_0x18a85e]&&_[_0xc05b('0x95')](_0x15c963[_0x18a85e])){if(_[_0xc05b('0x69')](recursiveMapAttributes,_0x18a85e)){_0x15c963[_0x18a85e]=this[_0xc05b('0x96')](_0x15c963[_0x18a85e]);}else{_0x15c963[_0x18a85e]=this[_0xc05b('0x97')](_0x15c963[_0x18a85e]);}}}}return _0x15c963;};AGIVertices['prototype'][_0xc05b('0x98')]=function(_0x53cd06){for(var _0x3f6423 in _0x53cd06){if(_0x53cd06[_0xc05b('0x94')](_0x3f6423)){if(_[_0xc05b('0x99')](_0x53cd06[_0x3f6423])){this['recursiveNodeIndex'](_0x53cd06[_0x3f6423]);}else if(_[_0xc05b('0x9a')](_0x53cd06[_0x3f6423])){for(var _0x7db963=0x0;_0x7db963<_0x53cd06[_0x3f6423][_0xc05b('0x9b')];_0x7db963++){this[_0xc05b('0x98')](_0x53cd06[_0x3f6423][_0x7db963]);}}else if(_[_0xc05b('0x95')](_0x53cd06[_0x3f6423])){_0x53cd06[_0x3f6423]=this[_0xc05b('0x97')](_0x53cd06[_0x3f6423]);}}}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x9c')]=function(_0x333a5e,_0x3ee692){for(var _0x4fa5cb in _0x333a5e){if(_0x333a5e[_0xc05b('0x94')](_0x4fa5cb)){if(_[_0xc05b('0x99')](_0x333a5e[_0x4fa5cb])){if(!_[_0xc05b('0x44')](_0x333a5e[_0x4fa5cb])){this[_0xc05b('0x9c')](_0x333a5e[_0x4fa5cb],util[_0xc05b('0x2b')](_0xc05b('0x9d'),_0x3ee692,_0x4fa5cb));}}else if(_['isArray'](_0x333a5e[_0x4fa5cb])){for(var _0x21e880=0x0;_0x21e880<_0x333a5e[_0x4fa5cb][_0xc05b('0x9b')];_0x21e880++){this[_0xc05b('0x9c')](_0x333a5e[_0x4fa5cb][_0x21e880],util[_0xc05b('0x2b')](_0xc05b('0x9d'),_0x3ee692,_0x4fa5cb+'['+_0x21e880+']'));}}else{if(!_[_0xc05b('0x45')](_0x333a5e[_0x4fa5cb])){this['channel']['setVariable'](util['format'](_0xc05b('0x9d'),_0x3ee692,_0x4fa5cb),_0x333a5e[_0x4fa5cb]);}}}}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x96')]=function(_0x426365){try{var _0x328707=JSON[_0xc05b('0x74')](_0x426365);this[_0xc05b('0x98')](_0x328707);return JSON[_0xc05b('0x75')](_0x328707);}catch(_0x4b1173){return this[_0xc05b('0x97')](_0x426365);}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x97')]=function(_0x221b78){console[_0xc05b('0x41')](_0xc05b('0x9e'),_0x221b78);var _0x3a7556=_0x221b78[_0xc05b('0x9f')]('{');for(var _0x544823=0x1;_0x544823<_0x3a7556[_0xc05b('0x9b')];_0x544823+=0x1){var _0x113230=_0x3a7556[_0x544823][_0xc05b('0x9f')]('}');console[_0xc05b('0x41')]('nextbracket',_0x113230);if(_0x113230[_0xc05b('0x9b')]>0x1){_0x221b78=_0x221b78[_0xc05b('0xa0')]('{'+_0x113230[0x0]+'}',this['channel'][_0xc05b('0x14')](_0x113230[0x0])[_0xc05b('0xa1')]||_0x113230[0x0]);}}if(_0x3a7556[_0xc05b('0x9b')]===0x1){return _0x221b78[_0xc05b('0x4d')]();}console[_0xc05b('0x41')](_0xc05b('0xa2'),_0x221b78);return this[_0xc05b('0x97')](_0x221b78);};AGIVertices[_0xc05b('0x13')][_0xc05b('0xa3')]=function(_0x3e4a33,_0x282659){var _0x287da0=this[_0xc05b('0x10')]['getVariable'](_0x3e4a33);if(_0x287da0[_0xc05b('0xa4')]===-0x1){return _0x287da0;}logger['info'](util[_0xc05b('0x2b')](_0xc05b('0xa5'),_0x282659,_0x287da0[_0xc05b('0xa1')]));return this[_0xc05b('0x10')][_0xc05b('0xa6')](_0x282659,_0x287da0['extra']);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x80')]=function(_0x75d59e){return _0x75d59e&&_0x75d59e!=='0'&&_0x75d59e!=='-1'&&_0x75d59e!=='';};AGIVertices[_0xc05b('0x13')][_0xc05b('0xa7')]=function(_0x31b1ca){this[_0xc05b('0x35')]['sync'](this,_0x31b1ca,'-');_0x31b1ca['retry']=_0x31b1ca['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc05b('0x13')][_0xc05b('0xa8')]=function(_0x54cd41){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0xa9'),_0x54cd41['label']));if(!this[_0xc05b('0x80')](_0x54cd41[_0xc05b('0x5c')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xab'));}var _0x2ab47b='\x22'+_0x54cd41[_0xc05b('0x5c')]+'\x22';if(this[_0xc05b('0x80')](_0x54cd41['options'])){_0x2ab47b+=','+_0x54cd41[_0xc05b('0x79')];}var _0x30863d=this[_0xc05b('0x10')][_0xc05b('0x57')](_0xc05b('0xac'),_0x2ab47b);if(_0x30863d[_0xc05b('0xa4')]===-0x1){return _0x30863d;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xad'),_0x2ab47b));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xae')]=function(_0x1dc882){logger[_0xc05b('0x30')](util['format'](_0xc05b('0xaf'),_0x1dc882[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x1dc882[_0xc05b('0xb0')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xb1'));}var _0x53160d=_0x1dc882['grammar'];if(this['isConfigured'](_0x1dc882[_0xc05b('0x79')])){_0x53160d+=','+_0x1dc882['options'];}var _0x196975=this[_0xc05b('0x10')][_0xc05b('0x57')]('MRCPRecog',_0x53160d);if(_0x196975[_0xc05b('0xa4')]===-0x1){return _0x196975;}var _0x3fe1c2=this['getAndSetVariable'](_0xc05b('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x3fe1c2[_0xc05b('0xa4')]===-0x1){return _0x3fe1c2;}var _0x116be7=this['getAndSetVariable'](_0xc05b('0xb3'),_0xc05b('0xb4'));if(_0x116be7['result']===-0x1){return _0x116be7;}var _0x3299c3=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x3299c3[_0xc05b('0xa4')]===-0x1){return _0x3299c3;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0xb5'),_0x53160d));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x7')]=function(_0x51be31){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0xb6'),_0x51be31[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0x7')]([_0x51be31[_0xc05b('0xb7')],_0x51be31[_0xc05b('0xb8')]]);};AGIVertices[_0xc05b('0x13')]['answer']=function(_0x3bc2e3){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3bc2e3[_0xc05b('0x37')]));if(this['isConfigured'](_0x3bc2e3[_0xc05b('0x68')])){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0xb9'),_0x3bc2e3[_0xc05b('0x68')]));var _0xaa2bb3=this['channel'][_0xc05b('0xba')](_0x3bc2e3['timeout']);if(_0xaa2bb3['result']===-0x1){return _0xaa2bb3;}}return this[_0xc05b('0x10')][_0xc05b('0xbb')]();};AGIVertices['prototype'][_0xc05b('0x4b')]=function(_0x318cca){console[_0xc05b('0x41')](_0xc05b('0xbc'),_0x318cca);logger[_0xc05b('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x318cca[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x318cca[_0xc05b('0x49')])){return this['channel'][_0xc05b('0x33')](_0x318cca,_0xc05b('0xbd'));}_0x318cca[_0xc05b('0x4a')]=moment();if(this[_0xc05b('0x80')](_0x318cca[_0xc05b('0xbe')])){_0x318cca[_0xc05b('0x4a')]=moment()['add'](_0x318cca['delay'],_0xc05b('0xbf'));}if(!this['isConfigured'](_0x318cca[_0xc05b('0x4e')])){_0x318cca['callback_priority']=0x2;}console[_0xc05b('0x41')](_0xc05b('0xc0'),_0x318cca);this[_0xc05b('0xc1')][_0xc05b('0x71')](this,_0x318cca);return this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0xc2'),_0x318cca[_0xc05b('0x48')],_0x318cca[_0xc05b('0x49')],_0x318cca[_0xc05b('0x4a')]));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xc3')]=function(_0x22009c){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0xc4'),_0x22009c[_0xc05b('0x37')]));var _0x15058c=this[_0xc05b('0x10')]['exec'](_0x22009c[_0xc05b('0xc5')],_0x22009c['options']);if(_0x15058c[_0xc05b('0xa4')]===-0x1){return _0x15058c;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xc6'),_0x22009c[_0xc05b('0xc5')],_0x22009c[_0xc05b('0x79')]));};AGIVertices['prototype'][_0xc05b('0xc7')]=function(_0x288c93){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0xc8'),_0x288c93[_0xc05b('0x37')]));if(!this['isConfigured'](_0x288c93[_0xc05b('0x5c')])){return this['channel']['noop'](_0xc05b('0xab'));}var _0x5e3c94='\x22'+_0x288c93[_0xc05b('0x5c')]+'\x22';if(this['isConfigured'](_0x288c93[_0xc05b('0x79')])){_0x5e3c94+=','+_0x288c93[_0xc05b('0x79')];}var _0x4fba7f=this[_0xc05b('0x10')][_0xc05b('0x57')](_0xc05b('0xac'),_0x5e3c94);if(_0x4fba7f[_0xc05b('0xa4')]===-0x1){return _0x4fba7f;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xad'),_0x5e3c94));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xc9')]=function(_0xc4d191){logger[_0xc05b('0x30')](util['format'](_0xc05b('0xca'),_0xc4d191[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0xc4d191[_0xc05b('0x5c')])){return this[_0xc05b('0x10')]['noop']('no\x20text\x20configured');}var _0x7bd4fd='\x22'+_0xc4d191['text']+'\x22';if(this[_0xc05b('0x80')](_0xc4d191[_0xc05b('0x79')])){_0x7bd4fd+=','+_0xc4d191['options'];}var _0xec6eab=this[_0xc05b('0x10')]['exec'](_0xc05b('0xac'),_0x7bd4fd);if(_0xec6eab[_0xc05b('0xa4')]===-0x1){return _0xec6eab;}return this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0xad'),_0x7bd4fd));};AGIVertices['prototype']['lumenvoxasr']=function(_0xc2526f){logger[_0xc05b('0x30')](util['format'](_0xc05b('0xcb'),_0xc2526f[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0xc2526f[_0xc05b('0xb0')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xb1'));}var _0xa8a988=_0xc2526f['grammar'];if(this[_0xc05b('0x80')](_0xc2526f['options'])){_0xa8a988+=','+_0xc2526f[_0xc05b('0x79')];}var _0x58469d=this[_0xc05b('0x10')][_0xc05b('0x57')](_0xc05b('0xcc'),_0xa8a988);if(_0x58469d[_0xc05b('0xa4')]===-0x1){return _0x58469d;}var _0xd60f62=this['getAndSetVariable'](_0xc05b('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0xd60f62['result']===-0x1){return _0xd60f62;}var _0x2fab89=this[_0xc05b('0xa3')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x2fab89[_0xc05b('0xa4')]===-0x1){return _0x2fab89;}var _0x302382=this['getAndSetVariable']('RECOG_INSTANCE()',_0xc05b('0xcd'));if(_0x302382['result']===-0x1){return _0x302382;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xb5'),_0xa8a988));};AGIVertices['prototype'][_0xc05b('0xce')]=function(_0x1976b5){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0xcf'),_0x1976b5[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x1976b5[_0xc05b('0xb0')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xb1'));}var _0x96570b=_0x1976b5[_0xc05b('0xb0')];if(this[_0xc05b('0x80')](_0x1976b5[_0xc05b('0x79')])){_0x96570b+=','+_0x1976b5[_0xc05b('0x79')];}var _0x196b3e=this[_0xc05b('0x10')][_0xc05b('0x57')]('MRCPRecog',_0x96570b);if(_0x196b3e['result']===-0x1){return _0x196b3e;}var _0x48cb3f=this[_0xc05b('0xa3')](_0xc05b('0xb2'),_0xc05b('0xd0'));if(_0x48cb3f[_0xc05b('0xa4')]===-0x1){return _0x48cb3f;}var _0x5c773f=this[_0xc05b('0xa3')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x5c773f['result']===-0x1){return _0x5c773f;}var _0x159554=this[_0xc05b('0xa3')](_0xc05b('0xd1'),_0xc05b('0xd2'));if(_0x159554[_0xc05b('0xa4')]===-0x1){return _0x159554;}return this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xb5'),_0x96570b));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xd3')]=function(_0x214007){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0xd4'),_0x214007[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x214007['odbc_id'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x214007,'no\x20database\x20selected');}var _0x2d9a1d=this[_0xc05b('0xd5')][_0xc05b('0x71')](this,_0x214007['odbc_id']);if(!_0x2d9a1d){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x214007,'no\x20odbc\x20database\x20found');}if(!this[_0xc05b('0x80')](_0x214007[_0xc05b('0xd6')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x214007,_0xc05b('0xd7'));}var _0x5712d1=_0x214007[_0xc05b('0xd6')][_0xc05b('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xd8'),_0x5712d1));var _0x1dc3e1=this[_0xc05b('0x2d')][_0xc05b('0x71')](this,_0x2d9a1d,_0x5712d1);this[_0xc05b('0x35')][_0xc05b('0x71')](this,_0x214007,_0x5712d1);if(!this[_0xc05b('0x80')](_0x214007[_0xc05b('0xd9')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xda'));}var _0x36ab89=this[_0xc05b('0x14')][_0xc05b('0x71')](this,_0x214007[_0xc05b('0xd9')]);if(!_0x36ab89){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x214007,_0xc05b('0xdb'));}var _0x7687d4=this;_0x1dc3e1['forEach'](function(_0x2c624c,_0x163f50){Object[_0xc05b('0xdc')](_0x2c624c)[_0xc05b('0xdd')](function(_0x4b4b88){_0x7687d4[_0xc05b('0x10')][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0xde'),_0x36ab89,_0x163f50,_0x4b4b88),_0x2c624c[_0x4b4b88]);});});this['channel']['setVariable'](util[_0xc05b('0x2b')](_0xc05b('0xdf'),_0x36ab89),_0x1dc3e1[_0xc05b('0x9b')]);return this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xe0'),_0x36ab89));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xe1')]=function(_0x44aa1f){logger[_0xc05b('0xe2')](util[_0xc05b('0x2b')](_0xc05b('0xe3'),_0x44aa1f[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x44aa1f[_0xc05b('0xe4')])){return this[_0xc05b('0x10')]['error'](_0x44aa1f,'no\x20user\x20selected');}var _0x51946b=this[_0xc05b('0xe5')][_0xc05b('0x71')](this,_0x44aa1f[_0xc05b('0xe4')]);if(!_0x51946b){return this['channel'][_0xc05b('0x33')](_0x44aa1f,_0xc05b('0xe6'));}var _0x167313=this['channel'][_0xc05b('0x57')](_0xc05b('0xe7'),[util[_0xc05b('0x2b')](_0xc05b('0xe8'),_0x51946b),_0x44aa1f[_0xc05b('0x68')],_0x44aa1f['opts'],_0x44aa1f['url']]);if(_0x167313[_0xc05b('0xa4')]===-0x1){return _0x167313;}return this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')]('Executed\x20command\x20%s',_0xc05b('0xe7')));};AGIVertices[_0xc05b('0x13')]['dialogflow']=function(_0x169800){logger[_0xc05b('0x30')](util['format'](_0xc05b('0xe9'),_0x169800[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x169800[_0xc05b('0x8d')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')]('no\x20key\x20configured');}if(!this[_0xc05b('0x80')](_0x169800['text'])){return this[_0xc05b('0x10')][_0xc05b('0xaa')]('no\x20text\x20configured');}this[_0xc05b('0x10')][_0xc05b('0xea')]=!![];this['createSquareDetailsReport'](_0x169800);this['createSquareMessage'](_0x169800['text'],'in');this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xeb'),_0x169800[_0xc05b('0x5c')]));var _0x5a850d=this['googleDialogflow'][_0xc05b('0x71')](this,_0x169800);if(_0x5a850d){for(var _0x1ac390 in _0x5a850d){if(_0x5a850d[_0xc05b('0x94')](_0x1ac390)){this[_0xc05b('0x10')]['setVariable'](util[_0xc05b('0x2b')](_0xc05b('0xec'),_0x1ac390[_0xc05b('0x6b')]()),_0x5a850d[_0x1ac390]);}}this[_0xc05b('0x40')](_0x5a850d['speech'],_0xc05b('0xed'));return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xee'),_0x5a850d[_0xc05b('0xef')]));}return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x169800,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xc05b('0x13')][_0xc05b('0xf0')]=function(_0x34a1e6){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0xf1'),_0x34a1e6[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x34a1e6[_0xc05b('0xf2')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0xf3'));}if(!this[_0xc05b('0x80')](_0x34a1e6[_0xc05b('0xf4')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0xf5'));}if(!this[_0xc05b('0x80')](_0x34a1e6[_0xc05b('0xf6')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0xf7'));}if(!this[_0xc05b('0x80')](_0x34a1e6[_0xc05b('0xf8')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')]('no\x20text\x20configured');}this[_0xc05b('0x10')][_0xc05b('0xea')]=!![];this[_0xc05b('0x35')](_0x34a1e6);this['createSquareMessage'](_0x34a1e6[_0xc05b('0x5c')],'in');this['channel']['noop'](util[_0xc05b('0x2b')](_0xc05b('0xf9'),_0x34a1e6[_0xc05b('0x5c')]));var _0x5cfc11=this[_0xc05b('0x7b')][_0xc05b('0x71')](this,_0x34a1e6);if(_0x5cfc11){for(var _0x231865 in _0x5cfc11){if(_0x5cfc11[_0xc05b('0x94')](_0x231865)){this[_0xc05b('0x10')][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0xfa'),_0x231865['toUpperCase']()),_0x5cfc11[_0x231865]);}}this[_0xc05b('0x40')](_0x5cfc11['speech'],_0xc05b('0xed'));if(_0x5cfc11[_0xc05b('0xfb')]){this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xfc'),_0x5cfc11[_0xc05b('0xfb')]));var _0x4bf3a6=this[_0xc05b('0x10')][_0xc05b('0xfd')](_0x5cfc11['audiofile']);try{fs[_0xc05b('0xfe')](_0x5cfc11['audiofile']+_0xc05b('0xff'));}catch(_0x2baa8e){logger[_0xc05b('0x33')](_0x2baa8e);}return _0x4bf3a6;}else{return this['channel'][_0xc05b('0xaa')](util['format']('SestekNDA\x20Result\x20%s',_0x5cfc11[_0xc05b('0xef')]));}}return this[_0xc05b('0x10')]['error'](_0x34a1e6,_0xc05b('0x100'));};AGIVertices['prototype'][_0xc05b('0x101')]=function(_0x70d06e){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x102'),_0x70d06e[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x101'));};AGIVertices['prototype'][_0xc05b('0x103')]=function(_0x49f4f1){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x104'),_0x49f4f1[_0xc05b('0x37')]));var _0x154fbd='';if(_0x49f4f1[_0xc05b('0x105')]){if(!this['isConfigured'](_0x49f4f1[_0xc05b('0x105')])){return this[_0xc05b('0x10')]['error'](_0x49f4f1,'no\x20trunk\x20selected');}else{var _0xbb100a=parseInt(_0x49f4f1['trunk_id'],0xa);if(isNaN(_0xbb100a)){_0x154fbd=_0x49f4f1[_0xc05b('0x105')];}else{_0x154fbd=this[_0xc05b('0x106')]['sync'](this,_0x49f4f1[_0xc05b('0x105')]);if(!_0x154fbd){return this[_0xc05b('0x10')]['error'](_0x49f4f1,_0xc05b('0x107'));}}}}else if(_0x49f4f1[_0xc05b('0x108')]){_0x154fbd=_0x49f4f1[_0xc05b('0x108')];}else{return this['channel'][_0xc05b('0x33')](_0x49f4f1,_0xc05b('0x109'));}var _0x1224b5=this[_0xc05b('0x10')]['exec'](_0xc05b('0xe7'),[util[_0xc05b('0x2b')](_0xc05b('0x10a'),_0x154fbd,_0x49f4f1[_0xc05b('0x48')]),_0x49f4f1[_0xc05b('0x68')],_0x49f4f1[_0xc05b('0x10b')],_0x49f4f1['url']]);if(_0x1224b5[_0xc05b('0xa4')]===-0x1){return _0x1224b5;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x10c'),'DIAL'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x10d')]=function(_0x4656ff){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x10e'),_0x4656ff[_0xc05b('0x37')]));return this[_0xc05b('0x10')]['noop'](_0xc05b('0x10d'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0xe')]=function(_0x34277a){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x10f'),_0x34277a[_0xc05b('0x37')]));if(_0x34277a[_0xc05b('0x110')]===0x0){return this[_0xc05b('0xa7')](_0x34277a);}_0x34277a[_0xc05b('0x110')]-=0x1;if(!this['isConfigured'](_0x34277a['file_id'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x34277a,_0xc05b('0x111'));}var _0x4d84c5=this[_0xc05b('0x20')][_0xc05b('0x71')](this,_0x34277a[_0xc05b('0x112')]);if(!_0x4d84c5){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x34277a,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x34277a[_0xc05b('0xd9')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0xc05b('0xda'));}var _0x36ce31=this[_0xc05b('0x10')]['getData'](_0x4d84c5,_0x34277a[_0xc05b('0x113')],_0x34277a[_0xc05b('0x114')]);var _0x1f75e1=_0x36ce31['result']?_0x36ce31['result']['toString']():'';logger[_0xc05b('0x30')]('test',JSON[_0xc05b('0x75')](_0x36ce31));if(_0x36ce31[_0xc05b('0xa4')]===-0x1){this[_0xc05b('0x35')]['sync'](this,_0x34277a,_0x1f75e1);return _0x36ce31;}else if(_0x36ce31[_0xc05b('0xa1')]==='timeout'){_0x36ce31[_0xc05b('0xa4')]=_0x1f75e1[_0xc05b('0x9b')]>=parseInt(_0x34277a[_0xc05b('0x115')])?'x':'i';}else{_0x36ce31[_0xc05b('0xa4')]=_0x1f75e1['length']>=parseInt(_0x34277a['mindigit'])&&_0x1f75e1['length']<=parseInt(_0x34277a['maxdigit'])?'x':'i';}var _0x27550a=this[_0xc05b('0x14')][_0xc05b('0x71')](this,_0x34277a[_0xc05b('0xd9')]);if(!_0x27550a){return this['channel'][_0xc05b('0x33')](_0x34277a,_0xc05b('0xdb'));}this['channel'][_0xc05b('0xa6')](_0x27550a,_0x1f75e1);if(this[_0xc05b('0x80')](_0x34277a[_0xc05b('0x116')])){var _0x4a0faa=parseInt(_0x34277a[_0xc05b('0x116')],0xa);var _0x342e4e=rs[_0xc05b('0x117')]({'charset':'*','length':_0x4a0faa});var _0x4361d2=_0x1f75e1[_0xc05b('0x9b')];if(_0x4361d2>0x0){if(_0x4361d2>_0x4a0faa){this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0x34277a,_0x34277a['hiddendigitspos']==='first'?_0x342e4e+_0x1f75e1['substr'](_0x4a0faa):_0x1f75e1[_0xc05b('0x118')](0x0,_0x4361d2-_0x4a0faa)+_0x342e4e);}else{this[_0xc05b('0x35')]['sync'](this,_0x34277a,rs['generate']({'charset':'*','length':_0x4361d2}));}}else{this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0x34277a,'');}}else{this[_0xc05b('0x35')][_0xc05b('0x71')](this,_0x34277a,_0x1f75e1);}return _0x36ce31;};AGIVertices[_0xc05b('0x13')][_0xc05b('0xf')]=function(_0x287766){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x119'),_0x287766[_0xc05b('0x37')]));return this[_0xc05b('0xe')](_0x287766);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x11a')]=function(_0x394093){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x11b'),_0x394093[_0xc05b('0x37')]));this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0x394093,_0x394093[_0xc05b('0x11c')]);return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x11d'),_0x394093[_0xc05b('0x11c')]));};AGIVertices['prototype'][_0xc05b('0x11e')]=function(_0x266912){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x11f'),_0x266912[_0xc05b('0x37')]));if(!this['isConfigured'](_0x266912[_0xc05b('0x83')])||!this[_0xc05b('0x80')](_0x266912[_0xc05b('0x84')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0x120'));}if(!this[_0xc05b('0x80')](_0x266912[_0xc05b('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x266912[_0xc05b('0x5c')]));var _0x480d24=this[_0xc05b('0x82')]['sync'](this,_0x266912);if(_0x480d24){this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x480d24));var _0x317825=this[_0xc05b('0x10')][_0xc05b('0xfd')](_0x480d24);try{fs[_0xc05b('0xfe')](_0x480d24+'.wav');}catch(_0x1f4203){logger[_0xc05b('0x33')](_0x1f4203);}return _0x317825;}return this[_0xc05b('0x10')]['error'](_0x266912,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xc05b('0x13')][_0xc05b('0x121')]=function(_0x2a3625){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x122'),_0x2a3625[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x2a3625['aws_access_key_id'])||!this['isConfigured'](_0x2a3625['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xc05b('0x80')](_0x2a3625[_0xc05b('0x8b')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')]('no\x20bot\x20name\x20configured');}if(!this[_0xc05b('0x80')](_0x2a3625[_0xc05b('0x5c')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0xab'));}this['channel'][_0xc05b('0xea')]=!![];this['createSquareDetailsReport'](_0x2a3625);this[_0xc05b('0x40')](_0x2a3625[_0xc05b('0x5c')],'in');this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x123'),_0x2a3625['text']));var _0x17a618=this[_0xc05b('0x89')]['sync'](this,_0x2a3625);if(_0x17a618){for(var _0x154aa8 in _0x17a618){if(_0x17a618['hasOwnProperty'](_0x154aa8)&&_[_0xc05b('0x95')](_0x17a618[_0x154aa8])){this['channel'][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0x124'),_0x154aa8[_0xc05b('0x6b')]()),_0x17a618[_0x154aa8]);}}if(_[_0xc05b('0x45')](_0x17a618[_0xc05b('0x125')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0x126'));}else{this[_0xc05b('0x40')](_0x17a618[_0xc05b('0x125')],'out');return this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0x127'),_0x17a618['message']));}}return this['channel'][_0xc05b('0x33')](_0x2a3625,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0xc05b('0x128')]=function(_0x4fd05f){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x129'),_0x4fd05f[_0xc05b('0x37')],_0x4fd05f[_0xc05b('0x68')]));if(!this[_0xc05b('0x80')](_0x4fd05f[_0xc05b('0x8d')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0x12a'));}var _0x193cda=_0xc05b('0x12b');var _0xfdad9d=util[_0xc05b('0x2b')](_0xc05b('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x4d1475=util[_0xc05b('0x2b')](_0xc05b('0x9d'),_0xfdad9d,_0x193cda);var _0x32733a=!![];if(_0x4fd05f[_0xc05b('0x12d')]===_0xc05b('0x12e')){_0x32733a=![];}var _0x4945ec=this[_0xc05b('0x10')][_0xc05b('0x12f')](_0xfdad9d,_0x193cda,_0x4fd05f[_0xc05b('0x130')],_0x4fd05f[_0xc05b('0x68')],undefined,_0x32733a);if(_0x4945ec[_0xc05b('0xa4')]!==-0x1){this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x131'),_0x4d1475));var _0x2edc9a=this['googleASR'][_0xc05b('0x71')](this,_0x4fd05f,_0x4d1475);if(_0x2edc9a){for(var _0xd03d65 in _0x2edc9a){if(_0x2edc9a['hasOwnProperty'](_0xd03d65)){this[_0xc05b('0x10')][_0xc05b('0xa6')](util['format'](_0xc05b('0x132'),_0xd03d65[_0xc05b('0x6b')]()),_0x2edc9a[_0xd03d65]);}}return this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0x133'),JSON[_0xc05b('0x75')](_0x2edc9a)));}}return _0x4945ec;};AGIVertices[_0xc05b('0x13')][_0xc05b('0x134')]=function(_0x4bd436){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x135'),_0x4bd436['label']));if(!this['isConfigured'](_0x4bd436[_0xc05b('0x90')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x136'));}if(!this[_0xc05b('0x80')](_0x4bd436[_0xc05b('0x91')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0x137'));}var _0x314886=_0xc05b('0x12b');var _0x587923=util['format'](_0xc05b('0x12c'),FILES_PATH,rs[_0xc05b('0x117')](0x4));var _0x346230=util[_0xc05b('0x2b')](_0xc05b('0x9d'),_0x587923,_0x314886);var _0x17a394=!![];if(_0x4bd436[_0xc05b('0x12d')]===_0xc05b('0x12e')){_0x17a394=![];}var _0x133ec4=this['channel'][_0xc05b('0x12f')](_0x587923,_0x314886,_0x4bd436[_0xc05b('0x130')],_0x4bd436[_0xc05b('0x68')],undefined,_0x17a394);if(_0x133ec4['result']!==-0x1){this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x138'),_0x346230));var _0xa06e7a=this[_0xc05b('0x8f')][_0xc05b('0x71')](this,_0x4bd436,_0x346230);if(_0xa06e7a){for(var _0x3f114d in _0xa06e7a){if(_0xa06e7a[_0xc05b('0x94')](_0x3f114d)){this[_0xc05b('0x10')][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0x139'),_0x3f114d['toUpperCase']()),_0xa06e7a[_0x3f114d]);}}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0xa06e7a)));}}return _0x133ec4;};AGIVertices['prototype'][_0xc05b('0x13a')]=function(_0xf7a4c5){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x13b'),_0xf7a4c5[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0x13c')](_0xf7a4c5[_0xc05b('0x13d')],_0xf7a4c5[_0xc05b('0x3c')],_0xf7a4c5[_0xc05b('0x3d')]);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x13e')]=function(_0x55e5a8){logger['info'](util[_0xc05b('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x55e5a8[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x55e5a8['condition'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x55e5a8,_0xc05b('0x13f'));}try{var _0xc2050=eval(_0x55e5a8[_0xc05b('0x140')])?_0xc05b('0x141'):_0xc05b('0x142');this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x55e5a8[_0xc05b('0x140')],_0xc2050));return{'code':0xc8,'result':_0xc2050};}catch(_0x267724){return{'code':0xc8,'result':_0xc05b('0x142')};}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x143')]=function(_0x500c7a){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x144'),_0x500c7a[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x500c7a[_0xc05b('0x145')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x500c7a,_0xc05b('0x146'));}var _0x451afe=this[_0xc05b('0x27')][_0xc05b('0x71')](this,_0x500c7a['interval_id']);if(!_0x451afe){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x500c7a,_0xc05b('0x147'));}for(var _0x42b8ca=0x0;_0x42b8ca<_0x451afe[_0xc05b('0x9b')];_0x42b8ca+=0x1){var _0x49a273=this[_0xc05b('0x10')][_0xc05b('0x14')](util['format'](_0xc05b('0x148'),_0x451afe[_0x42b8ca]));if(_0x49a273[_0xc05b('0xa4')]===-0x1){return _0x49a273;}logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x149'),_0x451afe[_0x42b8ca],_0x49a273[_0xc05b('0xa1')]));if(_0x49a273[_0xc05b('0xa1')]===_0xc05b('0x141')){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x149'),_0x451afe[_0x42b8ca],_0xc05b('0x141')));this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format']('IFTIME\x20%s\x20%s',_0x451afe[_0x42b8ca],_0xc05b('0x141')));return{'code':0xc8,'result':_0xc05b('0x141')};}else{logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x149'),_0x451afe[_0x42b8ca],_0xc05b('0x142')));this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x149'),_0x451afe[_0x42b8ca],_0xc05b('0x142')));}}return{'code':0xc8,'result':_0xc05b('0x142')};};AGIVertices[_0xc05b('0x13')][_0xc05b('0x14a')]=function(_0x4e1637){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x14b'),_0x4e1637[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0x14a')]();};AGIVertices[_0xc05b('0x13')][_0xc05b('0x14c')]=function(_0x5bb025){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x14d'),_0x5bb025['label']));if(!this[_0xc05b('0x80')](_0x5bb025['key'])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0x12a'));}var _0xb9fe5='wav';var _0x307694=util[_0xc05b('0x2b')](_0xc05b('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x2e65d0=util[_0xc05b('0x2b')](_0xc05b('0x9d'),_0x307694,_0xb9fe5);var _0x36e545=!![];if(_0x5bb025['beep']===_0xc05b('0x12e')){_0x36e545=![];}var _0x2cf983=this[_0xc05b('0x10')][_0xc05b('0x12f')](_0x307694,_0xb9fe5,_0x5bb025[_0xc05b('0x130')],_0x5bb025['timeout'],undefined,_0x36e545);if(_0x2cf983[_0xc05b('0xa4')]!==-0x1){this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')]('ispeech\x20%s\x20file\x20created',_0x2e65d0));var _0x27f60d=this['ispeechASR'][_0xc05b('0x71')](this,_0x5bb025,_0x2e65d0);if(_0x27f60d){for(var _0x414a81 in _0x27f60d){if(_0x27f60d[_0xc05b('0x94')](_0x414a81)){this['channel'][_0xc05b('0xa6')](util['format'](_0xc05b('0x14e'),_0x414a81[_0xc05b('0x6b')]()),_0x27f60d[_0x414a81]);}}return this['channel']['noop'](util[_0xc05b('0x2b')](_0xc05b('0x14f'),JSON['stringify'](_0x27f60d)));}}return _0x2cf983;};AGIVertices[_0xc05b('0x13')][_0xc05b('0x150')]=function(_0x3c6c5d){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x151'),_0x3c6c5d[_0xc05b('0x37')]));if(!this['isConfigured'](_0x3c6c5d['key'])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0x12a'));}if(!this[_0xc05b('0x80')](_0x3c6c5d[_0xc05b('0x5c')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0xab'));}this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0x152'),_0x3c6c5d[_0xc05b('0x5c')]));var _0x54a4cc=this[_0xc05b('0x7c')][_0xc05b('0x71')](this,_0x3c6c5d);if(_0x54a4cc){this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x153'),_0x54a4cc));var _0x333076=this['channel'][_0xc05b('0xfd')](_0x54a4cc,_0x3c6c5d[_0xc05b('0x130')]);try{fs[_0xc05b('0xfe')](_0x54a4cc+_0xc05b('0xff'));}catch(_0x3d8283){logger['error'](_0x3d8283);}return _0x333076;}return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x3c6c5d,_0xc05b('0x154'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x155')]=function(_0x19c771){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x156'),_0x19c771['label']));if(!this[_0xc05b('0x80')](_0x19c771[_0xc05b('0x157')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x19c771,_0xc05b('0x158'));}logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x159'),this['channel']['callerid'],_0x19c771['findBy']));var _0x1c971a=this[_0xc05b('0x54')][_0xc05b('0x71')](this,_0x19c771[_0xc05b('0x157')]);if(_0x1c971a){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x15a'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x19c771[_0xc05b('0x157')]));this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x15a'),this['channel']['callerid'],_0x19c771[_0xc05b('0x157')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xc05b('0x15b'),this['channel'][_0xc05b('0x3a')],_0x19c771[_0xc05b('0x157')]));this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x15b'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x19c771[_0xc05b('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x15c')]=function(_0xf54fdc){logger['info'](util[_0xc05b('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xf54fdc[_0xc05b('0x37')]));if(!this['isConfigured'](_0xf54fdc['findBy'])){return this['channel'][_0xc05b('0x33')](_0xf54fdc,'no\x20find\x20by\x20configured');}logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x159'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0xf54fdc[_0xc05b('0x157')]));var _0x220c4f=this['agentLogout'][_0xc05b('0x71')](this,_0xf54fdc['findBy']);if(_0x220c4f){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x15a'),this['channel']['callerid'],_0xf54fdc[_0xc05b('0x157')]));this['channel'][_0xc05b('0xaa')](util['format'](_0xc05b('0x15a'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0xf54fdc[_0xc05b('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x15b'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0xf54fdc[_0xc05b('0x157')]));this['channel'][_0xc05b('0xaa')](util['format'](_0xc05b('0x15b'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0xf54fdc[_0xc05b('0x157')]));return{'code':0xc8,'result':_0xc05b('0x15d')};}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x15e')]=function(_0x544259){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x15f'),_0x544259[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x544259['operation'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x544259,_0xc05b('0x160'));}this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x161'),_0x544259[_0xc05b('0x162')]));var _0x6a37ea=eval(_0x544259[_0xc05b('0x162')]);if(!this[_0xc05b('0x80')](_0x544259[_0xc05b('0xd9')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2938b7=this[_0xc05b('0x14')]['sync'](this,_0x544259[_0xc05b('0xd9')]);if(!_0x2938b7){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x544259,'no\x20variable\x20found');}if(_['isArray'](_0x6a37ea)){var _0xa8bf5f=this;_0x6a37ea['forEach'](function(_0x158789,_0x9b8a27){_0xa8bf5f[_0xc05b('0x10')][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0x163'),_0x2938b7,_0x9b8a27),_0x158789);});return this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0x164'),_0x2938b7));}else{return this['channel'][_0xc05b('0xa6')](_0x2938b7,_0x6a37ea);}};AGIVertices[_0xc05b('0x13')][_0xc05b('0xd')]=function(_0xc6bc30){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x165'),_0xc6bc30[_0xc05b('0x37')]));if(_0xc6bc30[_0xc05b('0x110')]===0x0){return this[_0xc05b('0xa7')](_0xc6bc30);}_0xc6bc30[_0xc05b('0x110')]-=0x1;if(!this[_0xc05b('0x80')](_0xc6bc30['file_id'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0xc6bc30,_0xc05b('0x111'));}var _0x34d233=this[_0xc05b('0x20')]['sync'](this,_0xc6bc30['file_id']);if(!_0x34d233){return this['channel'][_0xc05b('0x33')](_0xc6bc30,_0xc05b('0x166'));}var _0x524ae7=this[_0xc05b('0x10')][_0xc05b('0x167')](_0x34d233,_0xc6bc30[_0xc05b('0x113')],_0xc6bc30['digit']);var _0x4fee6c=_0x524ae7[_0xc05b('0xa4')];if(_0x524ae7['result']===-0x1){this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0xc6bc30,'-1');return _0x524ae7;}else if(_0x524ae7[_0xc05b('0xa1')]===_0xc05b('0x68')){_0x524ae7[_0xc05b('0xa4')]=_0x524ae7['result']['length']>0x0?_0x524ae7[_0xc05b('0xa4')]:'t';}else if(_[_0xc05b('0x44')](_0x524ae7['result'])){_0x524ae7['result']='#';_0x4fee6c='#';}if(!this[_0xc05b('0x80')](_0xc6bc30[_0xc05b('0xd9')])){this['channel'][_0xc05b('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x482966=this[_0xc05b('0x14')]['sync'](this,_0xc6bc30[_0xc05b('0xd9')]);if(!_0x482966){return this['channel'][_0xc05b('0x33')](_0xc6bc30,'no\x20variable\x20found');}this[_0xc05b('0x10')][_0xc05b('0xa6')](_0x482966,_0x4fee6c);}this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0xc6bc30,_0x4fee6c);return _0x524ae7;};AGIVertices['prototype'][_0xc05b('0xaa')]=function(_0x17b5dc){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x168'),_0x17b5dc[_0xc05b('0x37')]));return this[_0xc05b('0x10')]['noop'](_0x17b5dc[_0xc05b('0x169')]||_0x17b5dc[_0xc05b('0x37')]);};AGIVertices[_0xc05b('0x13')]['pause']=function(_0x79a486){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x79a486[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x79a486[_0xc05b('0x157')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x79a486,_0xc05b('0x158'));}logger[_0xc05b('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc05b('0x10')]['callerid'],_0x79a486[_0xc05b('0x157')]));var _0x3e698e=this['getPause'][_0xc05b('0x71')](this,_0x79a486[_0xc05b('0x16a')]);var _0x4787c9=this[_0xc05b('0x50')][_0xc05b('0x71')](this,_0x79a486['findBy'],_0x3e698e);if(_0x4787c9){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x79a486['findBy']));this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc05b('0x10')]['callerid'],_0x79a486['findBy']));return{'code':0xc8,'result':_0xc05b('0x16b')};}else{logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x15b'),this['channel']['callerid'],_0x79a486['findBy']));this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x15a'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x79a486[_0xc05b('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['playback']=function(_0x36b27d){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x36b27d[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x36b27d[_0xc05b('0x112')])){return this['channel'][_0xc05b('0x33')](_0x36b27d,_0xc05b('0x111'));}var _0x21e13d=this[_0xc05b('0x20')][_0xc05b('0x71')](this,_0x36b27d['file_id']);if(!_0x21e13d){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x36b27d,_0xc05b('0x166'));}var _0x5a86d6=this[_0xc05b('0x10')][_0xc05b('0x57')](_0xc05b('0x16c'),[_0x21e13d,_0x36b27d[_0xc05b('0x10b')]]);if(_0x5a86d6[_0xc05b('0xa4')]===-0x1){return _0x5a86d6;}return this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xc6'),_0xc05b('0x16c'),_0x21e13d));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x16d')]=function(_0x45052d){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x16e'),_0x45052d[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x45052d['queue_id'])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x45052d,_0xc05b('0x16f'));}var _0x3244db='';var _0x3e09da=parseInt(_0x45052d[_0xc05b('0x170')],0xa);if(isNaN(_0x3e09da)){_0x3244db=_0x45052d[_0xc05b('0x170')];}else{_0x3244db=this[_0xc05b('0x18')][_0xc05b('0x71')](this,_0x45052d[_0xc05b('0x170')]);if(!_0x3244db){return this['channel'][_0xc05b('0x33')](_0x45052d,_0xc05b('0x171'));}}var _0x4bf351='';if(this[_0xc05b('0x80')](_0x45052d[_0xc05b('0x112')])){var _0x5ed48a=this['getSound'][_0xc05b('0x71')](this,_0x45052d[_0xc05b('0x112')]);if(_0x5ed48a){_0x4bf351=_0x5ed48a;}}this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0x45052d,_0x3244db);if(_0x45052d[_0xc05b('0x10b')]['indexOf']('x')<0x0){_0x45052d[_0xc05b('0x10b')]+='x';}if(_0x45052d[_0xc05b('0x10b')][_0xc05b('0x172')]('X')<0x0){_0x45052d[_0xc05b('0x10b')]+='X';}this[_0xc05b('0x10')]['setVariable'](_0xc05b('0x173'),_0x3244db?_0x3244db[_0xc05b('0x174')]():'');var _0x2b40a9=this[_0xc05b('0x10')][_0xc05b('0x57')](_0xc05b('0x175'),[_0x3244db,_0x45052d['opts'],_0x45052d[_0xc05b('0x65')],_0x4bf351,_0x45052d[_0xc05b('0x68')],_0x45052d[_0xc05b('0x7')],_0x45052d['macro'],_0x45052d[_0xc05b('0x176')],'',_0x45052d[_0xc05b('0x177')]]);if(_0x2b40a9[_0xc05b('0xa4')]===-0x1){return _0x2b40a9;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xc6'),_0xc05b('0x175'),_0x3244db));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x178')]=function(_0x4c5b07){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x179'),_0x4c5b07['label']));var _0x5e9ab5=_0x4c5b07[_0xc05b('0x17a')]||_0xc05b('0x12b');var _0x4d76c8=util[_0xc05b('0x2b')](_0xc05b('0x17b'),this[_0xc05b('0x10')][_0xc05b('0x36')],rs[_0xc05b('0x117')](0x5));var _0x37fc2d=util['format'](_0xc05b('0x17c'),FILES_PATH,_0x4d76c8,_0x5e9ab5);var _0x36e716=util['format'](_0xc05b('0x12c'),FILES_PATH,_0x4d76c8);this['createSquareRecording'][_0xc05b('0x71')](this,_0x4c5b07,_0x4d76c8,_0x37fc2d);this[_0xc05b('0x10')]['setVariable'](_0xc05b('0x17d'),_0x4d76c8);logger[_0xc05b('0x30')](_0xc05b('0x17e'),_0x36e716,_0x5e9ab5,_0x4c5b07[_0xc05b('0x17f')],_0x4c5b07[_0xc05b('0x68')]);return this[_0xc05b('0x10')][_0xc05b('0x12f')](_0x36e716,_0x5e9ab5,_0x4c5b07[_0xc05b('0x17f')],_0x4c5b07[_0xc05b('0x68')],undefined,!![]);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x180')]=function(_0x3f9774){logger[_0xc05b('0x30')](util['format'](_0xc05b('0x181'),_0x3f9774[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x3f9774['url'])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x182'));}var _0x29a934=this[_0xc05b('0x64')][_0xc05b('0x71')](this,_0x3f9774);logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Response:',util[_0xc05b('0x183')](_0x29a934,{'showHidden':![],'depth':null})));if(!this[_0xc05b('0x80')](_0x3f9774[_0xc05b('0xd9')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0x184'));}var _0x18bcfb=this['getVariable'][_0xc05b('0x71')](this,_0x3f9774[_0xc05b('0xd9')]);if(!_0x18bcfb){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x3f9774,'no\x20variable\x20found');}this[_0xc05b('0x10')][_0xc05b('0xa6')](util[_0xc05b('0x2b')]('%s_STATUS_CODE',_0x18bcfb),_0x29a934['statusCode']?_0x29a934['statusCode']:_0xc05b('0x185'));this['channel'][_0xc05b('0xa6')](util[_0xc05b('0x2b')](_0xc05b('0x186'),_0x18bcfb),_0x29a934[_0xc05b('0x187')]?_0x29a934[_0xc05b('0x187')]:'OK');if(_0x29a934[_0xc05b('0x6c')]){try{this[_0xc05b('0x9c')](_0x29a934[_0xc05b('0x6c')],_0x18bcfb);}catch(_0x1149d3){logger[_0xc05b('0x33')](util[_0xc05b('0x2b')](_0xc05b('0x188'),_0x18bcfb));}}return this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0xe0'),_0x18bcfb));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x189')]=function(_0x3efdc9){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x18a'),_0x3efdc9['label']));return this[_0xc05b('0x10')]['sayDigits'](_0x3efdc9['digits'][_0xc05b('0x59')](/\s+/g,''),_0x3efdc9[_0xc05b('0x17f')]);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x18b')]=function(_0x5d28fb){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x18c'),_0x5d28fb[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0x18d')](_0x5d28fb[_0xc05b('0x67')][_0xc05b('0x59')](/\s+/g,''),_0x5d28fb[_0xc05b('0x17f')]);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x18e')]=function(_0x3f257f){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x3f257f[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0x18f')](_0x3f257f[_0xc05b('0x5c')],_0x3f257f[_0xc05b('0x17f')]);};AGIVertices[_0xc05b('0x13')][_0xc05b('0x190')]=function(_0x5f4c39){logger[_0xc05b('0x30')](util['format'](_0xc05b('0x191'),_0x5f4c39['label']));if(!this['isConfigured'](_0x5f4c39[_0xc05b('0x192')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x193'));}var _0x83430a=this[_0xc05b('0x24')][_0xc05b('0x71')](this,_0x5f4c39[_0xc05b('0x192')]);if(!_0x83430a||!_0x83430a[_0xc05b('0x194')]){return this['channel']['error'](_0x5f4c39,_0xc05b('0x195'));}var _0x29947a={'from':util[_0xc05b('0x2b')](_0xc05b('0x196'),_0x83430a[_0xc05b('0x16')],_0x83430a[_0xc05b('0x197')]||_0x83430a[_0xc05b('0x194')][_0xc05b('0x198')]),'to':_0x5f4c39['to']||'','cc':_0x5f4c39['cc']||'','bcc':_0x5f4c39[_0xc05b('0x199')]||'','subject':_0x5f4c39[_0xc05b('0x19a')],'html':_0x5f4c39['text'],'text':_0x5f4c39[_0xc05b('0x5c')]};var _0xb8e23e={'tls':{'rejectUnauthorized':![]}};if(_0x83430a[_0xc05b('0x194')]['service']){_0xb8e23e[_0xc05b('0x19b')]=_0x83430a[_0xc05b('0x194')][_0xc05b('0x19b')];}else{_0xb8e23e[_0xc05b('0x19c')]=_0x83430a[_0xc05b('0x194')][_0xc05b('0x19c')];_0xb8e23e[_0xc05b('0x19d')]=_0x83430a[_0xc05b('0x194')][_0xc05b('0x19d')];_0xb8e23e['secure']=_0x83430a['Smtp'][_0xc05b('0x19e')];}if(_0x83430a['Smtp'][_0xc05b('0x19f')]){_0xb8e23e['auth']={'user':_0x83430a[_0xc05b('0x194')][_0xc05b('0x198')],'pass':_0x83430a['Smtp']['pass']};}if(this[_0xc05b('0x80')](_0x5f4c39[_0xc05b('0x1a0')])){}logger[_0xc05b('0xe2')](_0xc05b('0x1a1'),JSON['stringify'](_0x29947a));this['createSquareDetailsReport'][_0xc05b('0x71')](this,_0x5f4c39,_0x5f4c39[_0xc05b('0x192')]);this[_0xc05b('0x10')]['noop'](util[_0xc05b('0x2b')](_0xc05b('0x1a2'),_0x83430a[_0xc05b('0x16')]));this[_0xc05b('0x26')][_0xc05b('0x71')](this,_0xb8e23e,_0x29947a);return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x1a3'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1a4')]=function(_0x4508dc){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1a5'),_0x4508dc[_0xc05b('0x37')]));return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x1a6'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1a7')]=function(_0x4d4385){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1a8'),_0x4d4385[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x4d4385[_0xc05b('0x1a9')])){return this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x1aa'));}var _0x3bc9cf=this[_0xc05b('0x1ab')]['sync'](this,_0x4d4385[_0xc05b('0x1a9')]);if(!_0x3bc9cf){return this[_0xc05b('0x10')]['error'](_0x4d4385,_0xc05b('0x1ac'));}var _0x1e2dc6={'body':_0x4d4385[_0xc05b('0x1ad')],'phone':_0x4d4385['to']||'','SmsAccountId':_0x3bc9cf['id']};logger[_0xc05b('0xe2')](_0xc05b('0x1ae'),JSON[_0xc05b('0x75')](_0x1e2dc6));this[_0xc05b('0x35')][_0xc05b('0x71')](this,_0x4d4385,_0x4d4385[_0xc05b('0x1a9')]);this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x1af'),_0x3bc9cf[_0xc05b('0x16')]));this[_0xc05b('0x1b0')][_0xc05b('0x71')](this,_0x1e2dc6);return this[_0xc05b('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1b1')]=function(_0x58c339){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x1b2'),_0x58c339[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x58c339[_0xc05b('0xd9')])){return this['channel'][_0xc05b('0x33')](_0x58c339,'no\x20variable\x20selected');}var _0x4598a2=this[_0xc05b('0x14')][_0xc05b('0x71')](this,_0x58c339[_0xc05b('0xd9')]);if(!_0x4598a2){return this['channel'][_0xc05b('0x33')](_0x58c339,_0xc05b('0xdb'));}return this[_0xc05b('0x10')]['setVariable'](_0x4598a2,_0x58c339[_0xc05b('0x1b3')]);};AGIVertices[_0xc05b('0x13')]['start']=function(_0xe965e0){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1b4'),_0xe965e0[_0xc05b('0x37')]));this[_0xc05b('0x10')][_0xc05b('0xaa')](_0xc05b('0x1b5'));if(_0xe965e0[_0xc05b('0xbb')]===_0xc05b('0x1b6')){this[_0xc05b('0x10')]['noop'](_0xc05b('0x1b7'));return this[_0xc05b('0x10')][_0xc05b('0xbb')]();}return this[_0xc05b('0x10')]['noop'](_0xc05b('0x1b8'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1b9')]=function(_0x4e146b){logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x1ba'),_0x4e146b['label']));if(!this[_0xc05b('0x80')](_0x4e146b[_0xc05b('0x1bb')])){return this['channel'][_0xc05b('0x33')](_0x4e146b,'no\x20subproject\x20selected');}var _0x41f433=this[_0xc05b('0x19')][_0xc05b('0x71')](this,_0x4e146b[_0xc05b('0x1bb')]);if(!this[_0xc05b('0x80')](_0x41f433)){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x4e146b,util[_0xc05b('0x2b')](_0xc05b('0x1bc'),_0x4e146b[_0xc05b('0x1bb')]));}if(_0x41f433===this[_0xc05b('0x10')][_0xc05b('0x38')]){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x4e146b,_0xc05b('0x1bd'));}this[_0xc05b('0x35')][_0xc05b('0x71')](this,_0x4e146b,_0x41f433);var _0x6bcf8f=this['channel'][_0xc05b('0x57')](_0xc05b('0x1be'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xc05b('0x19c')]||_0xc05b('0x1bf'),_0x41f433,this[_0xc05b('0x10')][_0xc05b('0x38')]));if(_0x6bcf8f[_0xc05b('0xa4')]===-0x1){return _0x6bcf8f;}return this['channel'][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xc6'),_0xc05b('0x1be'),_0x41f433));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1c0')]=function(_0x5ec45f){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5ec45f[_0xc05b('0x37')]));var _0x40f6f5=this[_0xc05b('0x1c1')]['sync'](this,_0x5ec45f[_0xc05b('0xb7')]);this[_0xc05b('0x35')]['sync'](this,_0x5ec45f,_0x5ec45f[_0xc05b('0xb7')]);if(this[_0xc05b('0x80')](_0x5ec45f['variable_id'])){var _0xd7190e=this[_0xc05b('0x14')]['sync'](this,_0x5ec45f[_0xc05b('0xd9')]);if(_0xd7190e){this['channel'][_0xc05b('0xa6')](_0xd7190e,_0x40f6f5);return this[_0xc05b('0x10')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5ec45f[_0xc05b('0xb7')],_0xd7190e));}}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0x1c2'),_0x5ec45f['command']));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1c3')]=function(_0xa543f8){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1c4'),_0xa543f8[_0xc05b('0x37')]));_0xa543f8['text']=_0xa543f8[_0xc05b('0x5c')][_0xc05b('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc05b('0x80')](_0xa543f8[_0xc05b('0x5b')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0x1c5'));}if(!this[_0xc05b('0x80')](_0xa543f8[_0xc05b('0x5c')])){return this[_0xc05b('0x10')]['noop'](_0xc05b('0xab'));}this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0x1c6'),_0xa543f8[_0xc05b('0x5c')]));var _0x1f5e9d=this['googleCloudTTS']['sync'](this,_0xa543f8);if(_0x1f5e9d){this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0x1c7'),_0x1f5e9d));var _0x4f076c=this[_0xc05b('0x10')][_0xc05b('0xfd')](_0x1f5e9d);try{fs[_0xc05b('0xfe')](_0x1f5e9d+_0xc05b('0xff'));}catch(_0x3eb436){logger[_0xc05b('0x33')](_0x3eb436);}return _0x4f076c;}return this[_0xc05b('0x10')][_0xc05b('0x33')](_0xa543f8,_0xc05b('0x1c8'));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1c9')]=function(_0x1fd36c){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1ca'),_0x1fd36c[_0xc05b('0x37')]));_0x1fd36c[_0xc05b('0x5c')]=_0x1fd36c[_0xc05b('0x5c')][_0xc05b('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc05b('0x80')](_0x1fd36c[_0xc05b('0x5c')])){return this['channel'][_0xc05b('0xaa')](_0xc05b('0xab'));}this[_0xc05b('0x10')][_0xc05b('0xaa')](util['format'](_0xc05b('0x1cb'),_0x1fd36c[_0xc05b('0x5c')]));var _0x150ee7=this[_0xc05b('0x62')]['sync'](this,_0x1fd36c);if(_0x150ee7){this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x150ee7));var _0xd4978=this['channel'][_0xc05b('0xfd')](_0x150ee7);try{fs[_0xc05b('0xfe')](_0x150ee7+_0xc05b('0xff'));}catch(_0x1debdd){logger[_0xc05b('0x33')](_0x1debdd);}return _0xd4978;}return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x1fd36c,_0xc05b('0x1cc'));};AGIVertices[_0xc05b('0x13')]['unpause']=function(_0x408945){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1cd'),_0x408945[_0xc05b('0x37')]));if(!this[_0xc05b('0x80')](_0x408945[_0xc05b('0x157')])){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x408945,_0xc05b('0x158'));}logger['info'](util[_0xc05b('0x2b')](_0xc05b('0x159'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x408945[_0xc05b('0x157')]));var _0x1b10bf=this[_0xc05b('0x52')]['sync'](this,_0x408945['findBy']);if(_0x1b10bf){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc05b('0x3a')],_0x408945[_0xc05b('0x157')]));this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0x15a'),this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x408945[_0xc05b('0x157')]));return{'code':0xc8,'result':_0xc05b('0x16b')};}else{logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x15b'),this[_0xc05b('0x10')]['callerid'],_0x408945[_0xc05b('0x157')]));this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc05b('0x10')][_0xc05b('0x3a')],_0x408945['findBy']));return{'code':0xc8,'result':_0xc05b('0x15d')};}};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1ce')]=function(_0x38a9e6){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x38a9e6['label']));var _0x2f9624=this[_0xc05b('0x10')][_0xc05b('0x57')]('VOICEMAIL',[_0x38a9e6[_0xc05b('0x1cf')],_0x38a9e6[_0xc05b('0x79')]]);if(_0x2f9624[_0xc05b('0xa4')]===-0x1){return _0x2f9624;}return this[_0xc05b('0x10')][_0xc05b('0xaa')](util[_0xc05b('0x2b')](_0xc05b('0xc6'),_0xc05b('0x1d0'),_0x38a9e6[_0xc05b('0x1cf')]));};AGIVertices[_0xc05b('0x13')][_0xc05b('0x1d1')]=function(_0x40e0f3){logger[_0xc05b('0x30')](util[_0xc05b('0x2b')](_0xc05b('0x1d2'),_0x40e0f3['label']));if(!this[_0xc05b('0x80')](_0x40e0f3[_0xc05b('0xd9')])){return this[_0xc05b('0x10')]['error'](_0x40e0f3,_0xc05b('0x1d3'));}var _0x5e052d=this[_0xc05b('0x14')][_0xc05b('0x71')](this,_0x40e0f3[_0xc05b('0xd9')]);if(!_0x5e052d){return this[_0xc05b('0x10')][_0xc05b('0x33')](_0x40e0f3,_0xc05b('0xdb'));}var _0x4c4d4a=this[_0xc05b('0x10')][_0xc05b('0x14')](_0x5e052d);return{'code':0xc8,'result':_0x4c4d4a[_0xc05b('0xa1')]?_0x4c4d4a[_0xc05b('0xa1')]:'-'};};String['prototype'][_0xc05b('0xa0')]=function(_0x421227,_0x2d5214){return this['split'](_0x421227)[_0xc05b('0x1d4')](_0x2d5214);};module[_0xc05b('0x1d5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b65dd0a..3b9cd3b 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 _0x7fbe=['transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','QueuePause','then','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','message','prototype','stopAcw','timer','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','attended','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]'];(function(_0x30a446,_0x17a06c){var _0x182f93=function(_0x3945a8){while(--_0x3945a8){_0x30a446['push'](_0x30a446['shift']());}};_0x182f93(++_0x17a06c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0x7fbe[_0x260073];return _0x4ff033;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7fb('0x0'));var ami=require(_0xe7fb('0x1'));var logger=require(_0xe7fb('0x2'))(_0xe7fb('0x3'));var RpcUser=require(_0xe7fb('0x4'));var RpcVoiceAgentReport=require(_0xe7fb('0x5'));function Acw(_0x11d2c4){this[_0xe7fb('0x6')]=_0x11d2c4[_0xe7fb('0x6')];this[_0xe7fb('0x7')]=_0x11d2c4[_0xe7fb('0x7')];this[_0xe7fb('0x8')]=_0x11d2c4[_0xe7fb('0x8')];this[_0xe7fb('0x9')]={};ami['on']('agentconnect',this[_0xe7fb('0xa')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xc'),this[_0xe7fb('0xd')]['bind'](this));ami['on']('hangup',this[_0xe7fb('0xe')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0xf'),this[_0xe7fb('0x10')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x11'),this[_0xe7fb('0x12')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x13'),this[_0xe7fb('0x14')][_0xe7fb('0xb')](this));ami['on'](_0xe7fb('0x15'),this[_0xe7fb('0x16')][_0xe7fb('0xb')](this));}function getDiff(_0x7fe4d3){var _0x598729=moment()[_0xe7fb('0x17')](0x0);var _0x2225e5=moment(_0x7fe4d3)['milliseconds'](0x0);return _0x598729[_0xe7fb('0x18')](_0x2225e5,_0xe7fb('0x19'));}Acw['prototype'][_0xe7fb('0x1a')]=function(_0x559129){try{var _0x12fff6=this;var _0x18d23c=this[_0xe7fb('0x9')][_0x559129][_0xe7fb('0x1b')];var _0x562262=this[_0xe7fb('0x9')][_0x559129]['queue'];var _0x293a47=this['voiceQueues'][_0x562262];var _0x1e77fd=![];var _0x4708f7=_0xe7fb('0x1c');if(_0x293a47[_0xe7fb('0x1d')]){if(_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')]){_0x1e77fd=!![];_0x4708f7=_0x293a47['mandatoryDispositionPause'][_0xe7fb('0x1e')];}}ami['Action']({'action':_0xe7fb('0x1f'),'interface':_0x18d23c,'paused':!![],'reason':_0x4708f7})['then'](function(_0xa5af01){if(_0x12fff6[_0xe7fb('0x7')][_0x18d23c]){return RpcUser['getAgent'](_0x12fff6[_0xe7fb('0x7')][_0x18d23c]['id'])[_0xe7fb('0x20')](function(_0x3ae8f1){if(_0x3ae8f1&&!_0x3ae8f1['voicePause']){logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x559129,_0x18d23c,_0x562262);var _0x5da3d9=_0x12fff6['channels'][_0x559129]['attended']&&_0x12fff6[_0xe7fb('0x9')][_0x559129]['destlinkedid']?_0x12fff6['channels'][_0x559129][_0xe7fb('0x23')]:_0x559129;return RpcUser[_0xe7fb('0x24')](_0x12fff6[_0xe7fb('0x7')][_0x18d23c],_0x4708f7,_0x5da3d9)['then'](function(_0x6c930){if(!_0x1e77fd){_0x12fff6[_0xe7fb('0x8')][_0x18d23c]={};logger[_0xe7fb('0x21')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=setTimeout(_0x12fff6['stopAcw'][_0xe7fb('0xb')](_0x12fff6,_0x18d23c),_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')]*0x3e8);_0x12fff6['timers'][_0x18d23c][_0xe7fb('0x27')]=moment()[_0xe7fb('0x28')](_0xe7fb('0x29'));_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')]=_0x559129;_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2b')]=_0x562262;_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['updateAcw']=function(){var _0x3d1fb5=getDiff(_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x27')]);clearTimeout(_0x12fff6['timers'][_0x18d23c]['timer']);_0x12fff6[_0xe7fb('0x8')][_0x18d23c]['timer']=![];RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0x3d1fb5},_0x12fff6[_0xe7fb('0x8')][_0x18d23c][_0xe7fb('0x2a')],_0x18d23c)[_0xe7fb('0x20')](function(_0x556368){logger[_0xe7fb('0x21')](_0xe7fb('0x2d'),_0x559129,_0x3d1fb5,_0x556368);})[_0xe7fb('0x2e')](function(_0x2f8818){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x559129,_0x2f8818);});delete _0x12fff6[_0xe7fb('0x8')][_0x18d23c];};}});}else{logger[_0xe7fb('0x21')](_0xe7fb('0x30'),_0x559129,_0x18d23c,_0x562262);}});}})[_0xe7fb('0x2e')](function(_0x46f430){logger[_0xe7fb('0x2f')](_0xe7fb('0x25'),_0x559129,_0x12fff6[_0xe7fb('0x6')][_0x562262][_0xe7fb('0x26')],_0x18d23c,_0x562262);})['finally'](function(){delete _0x12fff6[_0xe7fb('0x9')][_0x559129];});}catch(_0x29ef52){logger[_0xe7fb('0x2f')]('[ACW][START]\x20%s',_0x29ef52[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x33')]=function(_0x1530b1){try{var _0x402ca3=this;if(_0x402ca3[_0xe7fb('0x8')][_0x1530b1]){_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x34')]=![];var _0x195c35=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2a')];var _0x3c4f4b=_0x402ca3[_0xe7fb('0x8')][_0x1530b1][_0xe7fb('0x2b')];var _0xeb7c29=_0x402ca3[_0xe7fb('0x6')][_0x3c4f4b][_0xe7fb('0x26')];logger[_0xe7fb('0x21')](_0xe7fb('0x35'),_0x1530b1);RpcUser['saveUnpause'](this[_0xe7fb('0x7')][_0x1530b1]);RpcVoiceAgentReport[_0xe7fb('0x2c')]({'acwtime':_0xeb7c29,'agentacw':!![]},_0x195c35,_0x1530b1)[_0xe7fb('0x20')](function(_0x444f98){logger['info'](_0xe7fb('0x2d'),_0x195c35,_0xeb7c29,_0x444f98);})[_0xe7fb('0x2e')](function(_0xd472d){logger[_0xe7fb('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x195c35,_0xd472d);});}else{logger[_0xe7fb('0x2f')](_0xe7fb('0x36'),_0x1530b1);if(_0x402ca3[_0xe7fb('0x8')]){logger[_0xe7fb('0x21')](_0xe7fb('0x37'),JSON[_0xe7fb('0x38')](_0x402ca3['timers']));}}}catch(_0x4362c2){logger[_0xe7fb('0x2f')](_0xe7fb('0x39'),_0x4362c2['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xa')]=function(_0x5d42ac){try{if(this['voiceQueues'][_0x5d42ac['queue']]&&(this['voiceQueues'][_0x5d42ac['queue']][_0xe7fb('0x3')]||this[_0xe7fb('0x6')][_0x5d42ac[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x5d42ac['interface']]){this[_0xe7fb('0x9')][_0x5d42ac[_0xe7fb('0x2a')]]={'queue':_0x5d42ac['queue'],'interface':_0x5d42ac[_0xe7fb('0x1b')],'destlinkedid':_0x5d42ac[_0xe7fb('0x23')]};}}}catch(_0x240efa){logger[_0xe7fb('0x2f')]('[ACW][syncAgentConnect]\x20%s',_0x240efa[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x16')]=function(_0x56a84f){try{if(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]]&&(this[_0xe7fb('0x6')][_0x56a84f[_0xe7fb('0x2b')]][_0xe7fb('0x3')]||this['voiceQueues'][_0x56a84f[_0xe7fb('0x2b')]]['mandatoryDisposition'])){if(this[_0xe7fb('0x7')][_0x56a84f[_0xe7fb('0x1b')]]){this[_0xe7fb('0x9')][_0x56a84f[_0xe7fb('0x2a')]]={'queue':_0x56a84f[_0xe7fb('0x2b')],'interface':_0x56a84f['interface']};}}}catch(_0x364a0a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x364a0a[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xd')]=function(_0x589555){try{if(this[_0xe7fb('0x9')][_0x589555[_0xe7fb('0x2a')]]&&_['isUndefined'](this['channels'][_0x589555[_0xe7fb('0x2a')]][_0xe7fb('0x3a')])){logger[_0xe7fb('0x21')](_0xe7fb('0x3b'),_0x589555[_0xe7fb('0x2a')]);this[_0xe7fb('0x1a')](_0x589555[_0xe7fb('0x2a')]);}else if(this[_0xe7fb('0x9')][_0x589555['linkedid']]&&_[_0xe7fb('0x3c')](this['channels'][_0x589555[_0xe7fb('0x3d')]][_0xe7fb('0x3a')])){logger['info'](_0xe7fb('0x3e'),_0x589555['linkedid']);this[_0xe7fb('0x1a')](_0x589555['linkedid']);}}catch(_0x68e723){logger['error'](_0xe7fb('0x3f'),_0x68e723['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0xe')]=function(_0x41fcfb){try{if(this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x2a')]]['attended']){logger['info'](_0xe7fb('0x40'),_0x41fcfb['uniqueid']);this['startAcw'](_0x41fcfb['uniqueid']);}else if(this['channels'][_0x41fcfb['linkedid']]&&this[_0xe7fb('0x9')][_0x41fcfb[_0xe7fb('0x3d')]][_0xe7fb('0x3a')]){logger[_0xe7fb('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x41fcfb[_0xe7fb('0x3d')]);this[_0xe7fb('0x1a')](_0x41fcfb[_0xe7fb('0x3d')]);}}catch(_0x4a9372){logger['error'](_0xe7fb('0x41'),_0x4a9372[_0xe7fb('0x31')]);}};Acw[_0xe7fb('0x32')]['syncAttendedTransfer']=function(_0x27f860){try{if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]])){this['startAcw'](_0x27f860['transfereeuniqueid']);if(this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]][_0xe7fb('0x3a')]=!![];this['channels'][_0x27f860[_0xe7fb('0x45')]]=this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x44')]];delete this['channels'][_0x27f860['secondtransfereruniqueid']];}}else if(!_[_0xe7fb('0x42')](this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x45')]])){this[_0xe7fb('0x1a')](_0x27f860[_0xe7fb('0x45')]);if(this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']]){this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x46')]][_0xe7fb('0x3a')]=!![];this[_0xe7fb('0x9')][_0x27f860[_0xe7fb('0x43')]]=this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];delete this[_0xe7fb('0x9')][_0x27f860['origtransfereruniqueid']];}}}catch(_0x1eda1d){logger[_0xe7fb('0x2f')](_0xe7fb('0x47'),_0x1eda1d[_0xe7fb('0x31')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x2789a4){try{if(this[_0xe7fb('0x9')][_0x2789a4[_0xe7fb('0x48')]]){logger[_0xe7fb('0x21')](_0xe7fb('0x49'),JSON['stringify'](_0x2789a4[_0xe7fb('0x48')]));this['startAcw'](_0x2789a4[_0xe7fb('0x48')]);}else if(this['channels'][_0x2789a4['transfererlinkedid']]){logger[_0xe7fb('0x21')](_0xe7fb('0x4a'),JSON[_0xe7fb('0x38')](_0x2789a4['transfererlinkedid']));this[_0xe7fb('0x1a')](_0x2789a4[_0xe7fb('0x4b')]);}}catch(_0x3401e0){logger[_0xe7fb('0x2f')](_0xe7fb('0x4c'),_0x3401e0['message']);}};Acw[_0xe7fb('0x32')][_0xe7fb('0x10')]=function(_0x5151ec){try{if(this[_0xe7fb('0x6')][_0x5151ec[_0xe7fb('0x2b')]]&&this['voiceQueues'][_0x5151ec[_0xe7fb('0x2b')]]['autopause']===_0xe7fb('0x4d')){if(this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]]){logger['info'](_0xe7fb('0x4e'),_0x5151ec[_0xe7fb('0x2a')],_0x5151ec[_0xe7fb('0x1b')],_0x5151ec[_0xe7fb('0x2b')]);return RpcUser[_0xe7fb('0x24')](this[_0xe7fb('0x7')][_0x5151ec[_0xe7fb('0x1b')]],_0xe7fb('0x4f'),_0x5151ec['uniqueid']);}}}catch(_0x497998){logger[_0xe7fb('0x2f')](_0xe7fb('0x50'),_0x497998[_0xe7fb('0x31')]);}};module['exports']=Acw; \ No newline at end of file +var _0x008c=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','[ACW][START]\x20%s','message','stopAcw','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','isUndefined','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','bind','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','mandatoryDisposition','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause'];(function(_0xb7496d,_0x1cfdb8){var _0x33b87a=function(_0x4e1143){while(--_0x4e1143){_0xb7496d['push'](_0xb7496d['shift']());}};_0x33b87a(++_0x1cfdb8);}(_0x008c,0x188));var _0xc008=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0x008c[_0x22a8c4];return _0x104c6d;};'use strict';var util=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var ami=require(_0xc008('0x3'));var logger=require(_0xc008('0x4'))('acw');var RpcUser=require(_0xc008('0x5'));var RpcVoiceAgentReport=require(_0xc008('0x6'));function Acw(_0x10b33c){this[_0xc008('0x7')]=_0x10b33c[_0xc008('0x7')];this[_0xc008('0x8')]=_0x10b33c[_0xc008('0x8')];this[_0xc008('0x9')]=_0x10b33c[_0xc008('0x9')];this['channels']={};ami['on'](_0xc008('0xa'),this['syncAgentConnect'][_0xc008('0xb')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xc008('0xb')](this));ami['on'](_0xc008('0xc'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0xc008('0xd')][_0xc008('0xb')](this));ami['on']('attendedtransfer',this[_0xc008('0xe')][_0xc008('0xb')](this));ami['on'](_0xc008('0xf'),this[_0xc008('0x10')][_0xc008('0xb')](this));ami['on'](_0xc008('0x11'),this[_0xc008('0x12')]['bind'](this));}function getDiff(_0x560e28){var _0x33f44c=moment()['milliseconds'](0x0);var _0x25e13f=moment(_0x560e28)[_0xc008('0x13')](0x0);return _0x33f44c[_0xc008('0x14')](_0x25e13f,_0xc008('0x15'));}Acw[_0xc008('0x16')]['startAcw']=function(_0x5e894e){try{var _0x4bd0f4=this;var _0x11ef38=this[_0xc008('0x17')][_0x5e894e][_0xc008('0x18')];var _0x3eb12a=this['channels'][_0x5e894e]['queue'];var _0x540e45=this['voiceQueues'][_0x3eb12a];var _0x46042b=![];var _0x462af5='ACW';if(_0x540e45[_0xc008('0x19')]){if(_0x540e45['mandatoryDispositionPause']['name']){_0x46042b=!![];_0x462af5=_0x540e45['mandatoryDispositionPause']['name'];}}ami[_0xc008('0x1a')]({'action':'QueuePause','interface':_0x11ef38,'paused':!![],'reason':_0x462af5})['then'](function(_0x590a71){if(_0x4bd0f4['agents'][_0x11ef38]){return RpcUser['getAgent'](_0x4bd0f4[_0xc008('0x8')][_0x11ef38]['id'])[_0xc008('0x1b')](function(_0x251db2){if(_0x251db2&&!_0x251db2[_0xc008('0x1c')]){logger[_0xc008('0x1d')](_0xc008('0x1e'),_0x5e894e,_0x11ef38,_0x3eb12a);var _0x4f43e2=_0x4bd0f4[_0xc008('0x17')][_0x5e894e]['attended']&&_0x4bd0f4['channels'][_0x5e894e][_0xc008('0x1f')]?_0x4bd0f4[_0xc008('0x17')][_0x5e894e][_0xc008('0x1f')]:_0x5e894e;return RpcUser[_0xc008('0x20')](_0x4bd0f4['agents'][_0x11ef38],_0x462af5,_0x4f43e2)['then'](function(_0x5de1e9){if(!_0x46042b){_0x4bd0f4[_0xc008('0x9')][_0x11ef38]={};logger[_0xc008('0x1d')](_0xc008('0x21'),_0x5e894e,_0x4bd0f4[_0xc008('0x7')][_0x3eb12a]['acwTimeout'],_0x11ef38,_0x3eb12a);_0x4bd0f4['timers'][_0x11ef38]['timer']=setTimeout(_0x4bd0f4['stopAcw']['bind'](_0x4bd0f4,_0x11ef38),_0x4bd0f4[_0xc008('0x7')][_0x3eb12a][_0xc008('0x22')]*0x3e8);_0x4bd0f4[_0xc008('0x9')][_0x11ef38]['lastPauseAt']=moment()[_0xc008('0x23')](_0xc008('0x24'));_0x4bd0f4[_0xc008('0x9')][_0x11ef38][_0xc008('0x25')]=_0x5e894e;_0x4bd0f4['timers'][_0x11ef38][_0xc008('0x26')]=_0x3eb12a;_0x4bd0f4[_0xc008('0x9')][_0x11ef38]['updateAcw']=function(){var _0x58db82=getDiff(_0x4bd0f4['timers'][_0x11ef38][_0xc008('0x27')]);clearTimeout(_0x4bd0f4[_0xc008('0x9')][_0x11ef38][_0xc008('0x28')]);_0x4bd0f4[_0xc008('0x9')][_0x11ef38][_0xc008('0x28')]=![];RpcVoiceAgentReport[_0xc008('0x29')]({'acwtime':_0x58db82},_0x4bd0f4[_0xc008('0x9')][_0x11ef38][_0xc008('0x25')],_0x11ef38)[_0xc008('0x1b')](function(_0x2b862d){logger[_0xc008('0x1d')](_0xc008('0x2a'),_0x5e894e,_0x58db82,_0x2b862d);})['catch'](function(_0x334a09){logger[_0xc008('0x2b')]('[%s][UPDATE][ERRORS:%s]',_0x5e894e,_0x334a09);});delete _0x4bd0f4[_0xc008('0x9')][_0x11ef38];};}});}else{logger[_0xc008('0x1d')](_0xc008('0x2c'),_0x5e894e,_0x11ef38,_0x3eb12a);}});}})[_0xc008('0x2d')](function(_0xd0e05a){logger[_0xc008('0x2b')](_0xc008('0x21'),_0x5e894e,_0x4bd0f4[_0xc008('0x7')][_0x3eb12a][_0xc008('0x22')],_0x11ef38,_0x3eb12a);})['finally'](function(){delete _0x4bd0f4[_0xc008('0x17')][_0x5e894e];});}catch(_0x389a40){logger[_0xc008('0x2b')](_0xc008('0x2e'),_0x389a40[_0xc008('0x2f')]);}};Acw[_0xc008('0x16')][_0xc008('0x30')]=function(_0x5d0e06){try{var _0x35f360=this;if(_0x35f360[_0xc008('0x9')][_0x5d0e06]){_0x35f360['timers'][_0x5d0e06][_0xc008('0x28')]=![];var _0x15453c=_0x35f360['timers'][_0x5d0e06][_0xc008('0x25')];var _0x2e4ae1=_0x35f360[_0xc008('0x9')][_0x5d0e06]['queue'];var _0x53b353=_0x35f360['voiceQueues'][_0x2e4ae1][_0xc008('0x22')];logger['info'](_0xc008('0x31'),_0x5d0e06);RpcUser[_0xc008('0x32')](this[_0xc008('0x8')][_0x5d0e06]);RpcVoiceAgentReport[_0xc008('0x29')]({'acwtime':_0x53b353,'agentacw':!![]},_0x15453c,_0x5d0e06)[_0xc008('0x1b')](function(_0xa381d1){logger[_0xc008('0x1d')](_0xc008('0x2a'),_0x15453c,_0x53b353,_0xa381d1);})[_0xc008('0x2d')](function(_0x387dfd){logger[_0xc008('0x2b')](_0xc008('0x33'),_0x15453c,_0x387dfd);});}else{logger[_0xc008('0x2b')](_0xc008('0x34'),_0x5d0e06);if(_0x35f360['timers']){logger[_0xc008('0x1d')](_0xc008('0x35'),JSON[_0xc008('0x36')](_0x35f360[_0xc008('0x9')]));}}}catch(_0x49a16d){logger[_0xc008('0x2b')](_0xc008('0x37'),_0x49a16d[_0xc008('0x2f')]);}};Acw[_0xc008('0x16')][_0xc008('0x38')]=function(_0x5706bb){try{if(this[_0xc008('0x7')][_0x5706bb[_0xc008('0x26')]]&&(this[_0xc008('0x7')][_0x5706bb[_0xc008('0x26')]][_0xc008('0x39')]||this['voiceQueues'][_0x5706bb[_0xc008('0x26')]][_0xc008('0x19')])){if(this[_0xc008('0x8')][_0x5706bb[_0xc008('0x18')]]){this['channels'][_0x5706bb[_0xc008('0x25')]]={'queue':_0x5706bb[_0xc008('0x26')],'interface':_0x5706bb[_0xc008('0x18')],'destlinkedid':_0x5706bb['destlinkedid']};}}}catch(_0x1f9af7){logger['error'](_0xc008('0x3a'),_0x1f9af7['message']);}};Acw[_0xc008('0x16')][_0xc008('0x12')]=function(_0x5a5d85){try{if(this[_0xc008('0x7')][_0x5a5d85[_0xc008('0x26')]]&&(this[_0xc008('0x7')][_0x5a5d85['queue']][_0xc008('0x39')]||this[_0xc008('0x7')][_0x5a5d85[_0xc008('0x26')]][_0xc008('0x19')])){if(this[_0xc008('0x8')][_0x5a5d85[_0xc008('0x18')]]){this['channels'][_0x5a5d85['uniqueid']]={'queue':_0x5a5d85['queue'],'interface':_0x5a5d85[_0xc008('0x18')]};}}}catch(_0x36417a){logger[_0xc008('0x2b')](_0xc008('0x3b'),_0x36417a[_0xc008('0x2f')]);}};Acw[_0xc008('0x16')][_0xc008('0x3c')]=function(_0x33be4f){try{if(this['channels'][_0x33be4f['uniqueid']]&&_['isUndefined'](this[_0xc008('0x17')][_0x33be4f[_0xc008('0x25')]][_0xc008('0x3d')])){logger['info'](_0xc008('0x3e'),_0x33be4f[_0xc008('0x25')]);this[_0xc008('0x3f')](_0x33be4f[_0xc008('0x25')]);}else if(this[_0xc008('0x17')][_0x33be4f[_0xc008('0x40')]]&&_[_0xc008('0x41')](this[_0xc008('0x17')][_0x33be4f[_0xc008('0x40')]][_0xc008('0x3d')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x33be4f[_0xc008('0x40')]);this['startAcw'](_0x33be4f[_0xc008('0x40')]);}}catch(_0x36e6f8){logger[_0xc008('0x2b')]('[ACW][syncHangupRequest]\x20%s',_0x36e6f8[_0xc008('0x2f')]);}};Acw[_0xc008('0x16')][_0xc008('0x42')]=function(_0x8b9775){try{if(this[_0xc008('0x17')][_0x8b9775['uniqueid']]&&this[_0xc008('0x17')][_0x8b9775[_0xc008('0x25')]]['attended']){logger[_0xc008('0x1d')](_0xc008('0x43'),_0x8b9775['uniqueid']);this['startAcw'](_0x8b9775[_0xc008('0x25')]);}else if(this[_0xc008('0x17')][_0x8b9775[_0xc008('0x40')]]&&this[_0xc008('0x17')][_0x8b9775[_0xc008('0x40')]]['attended']){logger['info'](_0xc008('0x44'),_0x8b9775['linkedid']);this[_0xc008('0x3f')](_0x8b9775[_0xc008('0x40')]);}}catch(_0xf94fcb){logger[_0xc008('0x2b')](_0xc008('0x45'),_0xf94fcb[_0xc008('0x2f')]);}};Acw['prototype'][_0xc008('0xe')]=function(_0xbd7422){try{if(!_[_0xc008('0x46')](this[_0xc008('0x17')][_0xbd7422[_0xc008('0x47')]])){this['startAcw'](_0xbd7422[_0xc008('0x47')]);if(this['channels'][_0xbd7422['secondtransfereruniqueid']]){this['channels'][_0xbd7422[_0xc008('0x48')]][_0xc008('0x3d')]=!![];this[_0xc008('0x17')][_0xbd7422['transfertargetuniqueid']]=this[_0xc008('0x17')][_0xbd7422[_0xc008('0x48')]];delete this[_0xc008('0x17')][_0xbd7422['secondtransfereruniqueid']];}}else if(!_[_0xc008('0x46')](this[_0xc008('0x17')][_0xbd7422[_0xc008('0x49')]])){this[_0xc008('0x3f')](_0xbd7422['transfertargetuniqueid']);if(this[_0xc008('0x17')][_0xbd7422['origtransfereruniqueid']]){this[_0xc008('0x17')][_0xbd7422[_0xc008('0x4a')]][_0xc008('0x3d')]=!![];this[_0xc008('0x17')][_0xbd7422[_0xc008('0x47')]]=this[_0xc008('0x17')][_0xbd7422['origtransfereruniqueid']];delete this[_0xc008('0x17')][_0xbd7422['origtransfereruniqueid']];}}}catch(_0x5bf4a9){logger[_0xc008('0x2b')](_0xc008('0x4b'),_0x5bf4a9['message']);}};Acw[_0xc008('0x16')][_0xc008('0x10')]=function(_0x3e373e){try{if(this[_0xc008('0x17')][_0x3e373e[_0xc008('0x4c')]]){logger[_0xc008('0x1d')](_0xc008('0x4d'),JSON['stringify'](_0x3e373e[_0xc008('0x4c')]));this[_0xc008('0x3f')](_0x3e373e[_0xc008('0x4c')]);}else if(this[_0xc008('0x17')][_0x3e373e[_0xc008('0x4e')]]){logger[_0xc008('0x1d')](_0xc008('0x4f'),JSON[_0xc008('0x36')](_0x3e373e[_0xc008('0x4e')]));this[_0xc008('0x3f')](_0x3e373e[_0xc008('0x4e')]);}}catch(_0x2b5eb6){logger[_0xc008('0x2b')](_0xc008('0x50'),_0x2b5eb6['message']);}};Acw[_0xc008('0x16')][_0xc008('0xd')]=function(_0x3d3a7e){try{if(this['voiceQueues'][_0x3d3a7e[_0xc008('0x26')]]&&this[_0xc008('0x7')][_0x3d3a7e['queue']]['autopause']===_0xc008('0x51')){if(this[_0xc008('0x8')][_0x3d3a7e[_0xc008('0x18')]]){logger[_0xc008('0x1d')](_0xc008('0x52'),_0x3d3a7e[_0xc008('0x25')],_0x3d3a7e[_0xc008('0x18')],_0x3d3a7e[_0xc008('0x26')]);return RpcUser[_0xc008('0x20')](this[_0xc008('0x8')][_0x3d3a7e[_0xc008('0x18')]],'Auto-Pause',_0x3d3a7e[_0xc008('0x25')]);}}}catch(_0x25a52b){logger[_0xc008('0x2b')](_0xc008('0x53'),_0x25a52b['message']);}};module[_0xc008('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0c850a1..cc320b8 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 _0x0e41=['asterisk','port','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','error','actionSipShowRegistry','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','resolve','then','actionDeviceStateList','catch','close','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment'];(function(_0x32dcc4,_0x208540){var _0x25742f=function(_0x4bb3c7){while(--_0x4bb3c7){_0x32dcc4['push'](_0x32dcc4['shift']());}};_0x25742f(++_0x208540);}(_0x0e41,0x19b));var _0x10e4=function(_0x69cb63,_0x4f1a7a){_0x69cb63=_0x69cb63-0x0;var _0x49f16c=_0x0e41[_0x69cb63];return _0x49f16c;};'use strict';var Manager=require(_0x10e4('0x0'));var BPromise=require(_0x10e4('0x1'));var moment=require(_0x10e4('0x2'));var util=require('util');var _=require(_0x10e4('0x3'));var logger=require(_0x10e4('0x4'))(_0x10e4('0x5'));var config=require(_0x10e4('0x6'));var ami=new Manager(config[_0x10e4('0x7')][_0x10e4('0x8')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')]['username'],config[_0x10e4('0x7')][_0x10e4('0x9')],!![]);ami[_0x10e4('0xa')]();ami[_0x10e4('0xb')]=BPromise[_0x10e4('0xc')](ami[_0x10e4('0xd')]);function error(_0x4e6aeb){logger['error'](util[_0x10e4('0xe')](_0x10e4('0xf'),config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')],util['inspect'](_0x4e6aeb,![],null)));}function close(){logger[_0x10e4('0x11')](util[_0x10e4('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')]['port']));}ami[_0x10e4('0x12')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0x10e4('0x14')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x15')});};};ami[_0x10e4('0x16')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x17')});};};ami[_0x10e4('0x18')]=function(){return function(){return ami[_0x10e4('0xb')]({'action':_0x10e4('0x19')});};};function connect(_0x397cd8){logger[_0x10e4('0x1a')](util[_0x10e4('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x10e4('0x10')],config['asterisk']['ip'],config[_0x10e4('0x7')]['port']));ami[_0x10e4('0x1b')](_0x10e4('0x11'),error);ami[_0x10e4('0x1b')]('close',close);}ami['on']('connect',connect);ami['on'](_0x10e4('0x1c'),function(_0x737229){logger[_0x10e4('0x1a')](util[_0x10e4('0xe')](_0x10e4('0x1d'),config[_0x10e4('0x7')]['username'],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')],util[_0x10e4('0x1e')](_0x737229,![],null)));});ami['on'](_0x10e4('0x1f'),function(_0x3d7484){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x10e4('0x7')][_0x10e4('0x10')],config[_0x10e4('0x7')]['ip'],config[_0x10e4('0x7')][_0x10e4('0x8')]));return BPromise[_0x10e4('0x20')]()[_0x10e4('0x21')](ami[_0x10e4('0x12')]())['then'](ami[_0x10e4('0x22')]())[_0x10e4('0x21')](ami[_0x10e4('0x14')]())[_0x10e4('0x21')](ami[_0x10e4('0x16')]())[_0x10e4('0x21')](ami[_0x10e4('0x18')]())[_0x10e4('0x23')](function(_0xb0772){console['log'](_0xb0772);});});ami[_0x10e4('0x1b')](_0x10e4('0x11'),error);ami[_0x10e4('0x1b')](_0x10e4('0x24'),close);module[_0x10e4('0x25')]=ami; \ No newline at end of file +var _0xff18=['close','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','port','username','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','once','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log'];(function(_0x407178,_0x7769ef){var _0x58cf16=function(_0x4f749f){while(--_0x4f749f){_0x407178['push'](_0x407178['shift']());}};_0x58cf16(++_0x7769ef);}(_0xff18,0x13d));var _0x8ff1=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xff18[_0x494d1f];return _0x457b6e;};'use strict';var Manager=require(_0x8ff1('0x0'));var BPromise=require('bluebird');var moment=require(_0x8ff1('0x1'));var util=require(_0x8ff1('0x2'));var _=require(_0x8ff1('0x3'));var logger=require(_0x8ff1('0x4'))(_0x8ff1('0x5'));var config=require(_0x8ff1('0x6'));var ami=new Manager(config['asterisk'][_0x8ff1('0x7')],config['asterisk']['ip'],config['asterisk'][_0x8ff1('0x8')],config[_0x8ff1('0x9')][_0x8ff1('0xa')],!![]);ami[_0x8ff1('0xb')]();ami[_0x8ff1('0xc')]=BPromise[_0x8ff1('0xd')](ami[_0x8ff1('0xe')]);function error(_0x303c4e){logger[_0x8ff1('0xf')](util[_0x8ff1('0x10')](_0x8ff1('0x11'),config[_0x8ff1('0x9')][_0x8ff1('0x8')],config[_0x8ff1('0x9')]['ip'],config['asterisk'][_0x8ff1('0x7')],util[_0x8ff1('0x12')](_0x303c4e,![],null)));}function close(){logger[_0x8ff1('0xf')](util[_0x8ff1('0x10')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8ff1('0x9')]['username'],config[_0x8ff1('0x9')]['ip'],config[_0x8ff1('0x9')][_0x8ff1('0x7')]));}ami[_0x8ff1('0x13')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x8ff1('0x14')]=function(){return function(){return ami[_0x8ff1('0xc')]({'action':'devicestatelist'});};};ami[_0x8ff1('0x15')]=function(){return function(){return ami[_0x8ff1('0xc')]({'action':_0x8ff1('0x16')});};};ami[_0x8ff1('0x17')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x8ff1('0x18')]=function(){return function(){return ami[_0x8ff1('0xc')]({'action':'coreshowchannels'});};};function connect(_0x4f1228){logger[_0x8ff1('0x19')](util[_0x8ff1('0x10')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x8ff1('0x8')],config[_0x8ff1('0x9')]['ip'],config[_0x8ff1('0x9')][_0x8ff1('0x7')]));ami[_0x8ff1('0x1a')](_0x8ff1('0xf'),error);ami[_0x8ff1('0x1a')]('close',close);}ami['on'](_0x8ff1('0x1b'),connect);ami['on'](_0x8ff1('0x1c'),function(_0x550f19){logger['info'](util[_0x8ff1('0x10')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8ff1('0x9')]['username'],config[_0x8ff1('0x9')]['ip'],config[_0x8ff1('0x9')][_0x8ff1('0x7')],util[_0x8ff1('0x12')](_0x550f19,![],null)));});ami['on']('fullybooted',function(_0x500dd7){logger[_0x8ff1('0x19')](util[_0x8ff1('0x10')](_0x8ff1('0x1d'),config[_0x8ff1('0x9')][_0x8ff1('0x8')],config[_0x8ff1('0x9')]['ip'],config['asterisk'][_0x8ff1('0x7')]));return BPromise[_0x8ff1('0x1e')]()[_0x8ff1('0x1f')](ami[_0x8ff1('0x13')]())[_0x8ff1('0x1f')](ami[_0x8ff1('0x14')]())[_0x8ff1('0x1f')](ami[_0x8ff1('0x15')]())[_0x8ff1('0x1f')](ami['actionQueueSummary']())[_0x8ff1('0x1f')](ami['actionCoreShowChannels']())['catch'](function(_0x4af70d){console[_0x8ff1('0x20')](_0x4af70d);});});ami[_0x8ff1('0x1a')](_0x8ff1('0xf'),error);ami[_0x8ff1('0x1a')](_0x8ff1('0x21'),close);module[_0x8ff1('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1599615..70ef031 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 _0x302f=['rpc','memberReport','message','result','catch','exports','jayson/promise','../../config/logger','ami','client','http','Request','debug','error'];(function(_0x3713f0,_0x5882ff){var _0x2429ec=function(_0x38041a){while(--_0x38041a){_0x3713f0['push'](_0x3713f0['shift']());}};_0x2429ec(++_0x5882ff);}(_0x302f,0xe6));var _0xf302=function(_0x48136b,_0x4b0271){_0x48136b=_0x48136b-0x0;var _0x6a7aa5=_0x302f[_0x48136b];return _0x6a7aa5;};'use strict';var jayson=require(_0xf302('0x0'));var BPromise=require('bluebird');var logger=require(_0xf302('0x1'))(_0xf302('0x2'));var client=jayson[_0xf302('0x3')][_0xf302('0x4')]({'port':0x2329});client[_0xf302('0x5')]=function(_0x2ad8c4,_0x2a5abf){return new BPromise(function(_0x4093e1,_0x2cdacf){return client['request'](_0x2ad8c4,_0x2a5abf)['then'](function(_0x5e5f7e){logger[_0xf302('0x6')]('rpc','memberReport',_0x2ad8c4,_0x2a5abf,_0x5e5f7e);if(_0x5e5f7e[_0xf302('0x7')]){logger[_0xf302('0x7')](_0xf302('0x8'),_0xf302('0x9'),_0x2ad8c4,_0x5e5f7e[_0xf302('0x7')][_0xf302('0xa')],_0x2a5abf);return _0x2cdacf(_0x5e5f7e['error'][_0xf302('0xa')]);}else{return _0x4093e1(_0x5e5f7e[_0xf302('0xb')]);}})[_0xf302('0xc')](function(_0x41bc60){logger[_0xf302('0x7')](_0xf302('0x8'),'memberReport',_0x2ad8c4,_0x41bc60,_0x2a5abf);return _0x2cdacf(_0x41bc60);});});};module[_0xf302('0xd')]=client; \ No newline at end of file +var _0x60f9=['jayson/promise','bluebird','client','then','debug','rpc','error','memberReport','message','catch','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x60f9,0xb0));var _0x960f=function(_0x1ddf5f,_0x252301){_0x1ddf5f=_0x1ddf5f-0x0;var _0x286c8b=_0x60f9[_0x1ddf5f];return _0x286c8b;};'use strict';var jayson=require(_0x960f('0x0'));var BPromise=require(_0x960f('0x1'));var logger=require('../../config/logger')('ami');var client=jayson[_0x960f('0x2')]['http']({'port':0x2329});client['Request']=function(_0x52c943,_0x50bb2c){return new BPromise(function(_0x3819d1,_0x560e39){return client['request'](_0x52c943,_0x50bb2c)[_0x960f('0x3')](function(_0x5e4ecc){logger[_0x960f('0x4')](_0x960f('0x5'),'memberReport',_0x52c943,_0x50bb2c,_0x5e4ecc);if(_0x5e4ecc[_0x960f('0x6')]){logger[_0x960f('0x6')](_0x960f('0x5'),_0x960f('0x7'),_0x52c943,_0x5e4ecc[_0x960f('0x6')][_0x960f('0x8')],_0x50bb2c);return _0x560e39(_0x5e4ecc[_0x960f('0x6')][_0x960f('0x8')]);}else{return _0x3819d1(_0x5e4ecc['result']);}})[_0x960f('0x9')](function(_0x30790b){logger[_0x960f('0x6')](_0x960f('0x5'),_0x960f('0x7'),_0x52c943,_0x30790b,_0x50bb2c);return _0x560e39(_0x30790b);});});};module[_0x960f('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3c56020..b9e5cf1 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 _0x235a=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','queue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat'];(function(_0x1e15cc,_0x557934){var _0x3dd903=function(_0x38e380){while(--_0x38e380){_0x1e15cc['push'](_0x1e15cc['shift']());}};_0x3dd903(++_0x557934);}(_0x235a,0x1ef));var _0xa235=function(_0x4bcd5e,_0x93125){_0x4bcd5e=_0x4bcd5e-0x0;var _0x32dd5a=_0x235a[_0x4bcd5e];return _0x32dd5a;};'use strict';var util=require(_0xa235('0x0'));var _=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));function checkNameSurname(_0x49f946,_0x343afd,_0x52c3b3){var _0x3ae786='';if(!_[_0xa235('0x3')](_0x343afd)&&_0xa235('0x4')===typeof _0x343afd){_0x3ae786+=_0x343afd;}if(!_[_0xa235('0x3')](_0x52c3b3)&&_0xa235('0x4')===typeof _0x52c3b3){_0x3ae786+='\x20'+_0x52c3b3;}if(_0x3ae786!==''){return _0x3ae786;}return _0x49f946;}function Action(_0x5e94b0,_0x2961c8,_0x1707fc){this['voiceQueue']=_0x5e94b0;this[_0xa235('0x5')]=_0x1707fc||undefined;this[_0xa235('0x6')]=checkNameSurname(_0x2961c8[_0xa235('0x7')][_0xa235('0x8')],_0x2961c8['Contact'][_0xa235('0x9')],_0x2961c8['Contact']['lastName']);this[_0xa235('0xa')]=_0x2961c8['Contact'][_0xa235('0x8')];this['queue']=_0x5e94b0['name'];this['active']=_0x2961c8[_0xa235('0xb')]||![];this[_0xa235('0xc')]=_0x5e94b0[_0xa235('0xc')];this[_0xa235('0xd')]=_0x5e94b0['dialQueueTimeout']||0x3;this['scheduledat']=_0x2961c8['scheduledat'];this[_0xa235('0xe')]=_0x2961c8[_0xa235('0xe')];this[_0xa235('0xf')]=_0x2961c8[_0xa235('0xf')];this[_0xa235('0x10')]=_0x2961c8[_0xa235('0x10')];this[_0xa235('0x11')]=_0x2961c8[_0xa235('0x11')];this[_0xa235('0x12')]=_0x2961c8['countdropretry'];this[_0xa235('0x13')]=_0x2961c8[_0xa235('0x13')];this[_0xa235('0x14')]=_0x2961c8[_0xa235('0x14')];this[_0xa235('0x15')]=_0x2961c8[_0xa235('0x15')];this['ContactId']=_0x2961c8['ContactId'];this[_0xa235('0x16')]=_0x2961c8[_0xa235('0x16')];this[_0xa235('0x17')]=_0x2961c8['UserId'];this[_0xa235('0x18')]=_0x2961c8[_0xa235('0x18')];this[_0xa235('0x19')]=_0x2961c8[_0xa235('0x19')];this[_0xa235('0x1a')]=_0x2961c8['id'];this[_0xa235('0x1b')]=_0x2961c8[_0xa235('0x7')]['firstName']||'';this['starttime']=moment()[_0xa235('0x1c')](_0xa235('0x1d'));this[_0xa235('0x1e')]=_0x2961c8[_0xa235('0x1e')];this[_0xa235('0x1f')]=_0x2961c8[_0xa235('0x1f')];this[_0xa235('0x20')]=_0x2961c8[_0xa235('0x20')];this[_0xa235('0x21')]=_0x2961c8[_0xa235('0x21')];this[_0xa235('0x22')]='';this[_0xa235('0x23')]='';}Action[_0xa235('0x24')][_0xa235('0x25')]=function(){return util[_0xa235('0x1c')](_0xa235('0x26'),this[_0xa235('0x6')],this[_0xa235('0x27')][_0xa235('0x28')]>0x0?this[_0xa235('0xa')][_0xa235('0x29')](this['voiceQueue'][_0xa235('0x28')]):this['number']);};Action[_0xa235('0x24')]['getQueue']=function(){return this[_0xa235('0x2a')];};module[_0xa235('0x2b')]=Action; \ No newline at end of file +var _0x7e1a=['name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid'];(function(_0x31e79e,_0x5b45a9){var _0x1a3b24=function(_0x289a59){while(--_0x289a59){_0x31e79e['push'](_0x31e79e['shift']());}};_0x1a3b24(++_0x5b45a9);}(_0x7e1a,0x1c5));var _0xa7e1=function(_0x32c3d0,_0x2ca631){_0x32c3d0=_0x32c3d0-0x0;var _0x5c9b86=_0x7e1a[_0x32c3d0];return _0x5c9b86;};'use strict';var util=require(_0xa7e1('0x0'));var _=require(_0xa7e1('0x1'));var moment=require(_0xa7e1('0x2'));function checkNameSurname(_0xc277f7,_0x44e5bb,_0x2fdf4f){var _0x1f56a4='';if(!_[_0xa7e1('0x3')](_0x44e5bb)&&'string'===typeof _0x44e5bb){_0x1f56a4+=_0x44e5bb;}if(!_[_0xa7e1('0x3')](_0x2fdf4f)&&_0xa7e1('0x4')===typeof _0x2fdf4f){_0x1f56a4+='\x20'+_0x2fdf4f;}if(_0x1f56a4!==''){return _0x1f56a4;}return _0xc277f7;}function Action(_0x2cc9c3,_0x170590,_0x5f20e5){this[_0xa7e1('0x5')]=_0x2cc9c3;this[_0xa7e1('0x6')]=_0x5f20e5||undefined;this[_0xa7e1('0x7')]=checkNameSurname(_0x170590[_0xa7e1('0x8')][_0xa7e1('0x9')],_0x170590[_0xa7e1('0x8')][_0xa7e1('0xa')],_0x170590['Contact'][_0xa7e1('0xb')]);this['number']=_0x170590['Contact'][_0xa7e1('0x9')];this[_0xa7e1('0xc')]=_0x2cc9c3[_0xa7e1('0x7')];this[_0xa7e1('0xd')]=_0x170590['active']||![];this[_0xa7e1('0xe')]=_0x2cc9c3[_0xa7e1('0xe')];this[_0xa7e1('0xf')]=_0x2cc9c3[_0xa7e1('0xf')]||0x3;this[_0xa7e1('0x10')]=_0x170590['scheduledat'];this['countbusyretry']=_0x170590[_0xa7e1('0x11')];this[_0xa7e1('0x12')]=_0x170590[_0xa7e1('0x12')];this[_0xa7e1('0x13')]=_0x170590[_0xa7e1('0x13')];this[_0xa7e1('0x14')]=_0x170590[_0xa7e1('0x14')];this[_0xa7e1('0x15')]=_0x170590[_0xa7e1('0x15')];this['countabandonedretry']=_0x170590[_0xa7e1('0x16')];this[_0xa7e1('0x17')]=_0x170590[_0xa7e1('0x17')];this[_0xa7e1('0x18')]=_0x170590[_0xa7e1('0x18')];this[_0xa7e1('0x19')]=_0x170590[_0xa7e1('0x19')];this[_0xa7e1('0x1a')]=_0x170590[_0xa7e1('0x1a')];this[_0xa7e1('0x1b')]=_0x170590['UserId'];this[_0xa7e1('0x1c')]=_0x170590['VoiceQueueId'];this[_0xa7e1('0x1d')]=_0x170590[_0xa7e1('0x1d')];this[_0xa7e1('0x1e')]=_0x170590['id'];this[_0xa7e1('0x1f')]=_0x170590[_0xa7e1('0x8')][_0xa7e1('0xa')]||'';this[_0xa7e1('0x20')]=moment()[_0xa7e1('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x170590[_0xa7e1('0x22')];this[_0xa7e1('0x23')]=_0x170590['callbackuniqueid'];this[_0xa7e1('0x24')]=_0x170590[_0xa7e1('0x24')];this['recallme']=_0x170590[_0xa7e1('0x25')];this[_0xa7e1('0x26')]='';this[_0xa7e1('0x27')]='';}Action[_0xa7e1('0x28')][_0xa7e1('0x29')]=function(){return util[_0xa7e1('0x21')]('\x22%s\x22\x20<%s>',this[_0xa7e1('0x7')],this[_0xa7e1('0x5')][_0xa7e1('0x2a')]>0x0?this[_0xa7e1('0x2b')][_0xa7e1('0x2c')](this[_0xa7e1('0x5')][_0xa7e1('0x2a')]):this[_0xa7e1('0x2b')]);};Action[_0xa7e1('0x28')][_0xa7e1('0x2d')]=function(){return this[_0xa7e1('0xc')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 43a7c4b..f6f61e8 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab0a=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat'];(function(_0x3b0e0d,_0x327c39){var _0x155255=function(_0x487466){while(--_0x487466){_0x3b0e0d['push'](_0x3b0e0d['shift']());}};_0x155255(++_0x327c39);}(_0xab0a,0x150));var _0xaab0=function(_0x415937,_0x484161){_0x415937=_0x415937-0x0;var _0x456f05=_0xab0a[_0x415937];return _0x456f05;};'use strict';var util=require(_0xaab0('0x0'));var _=require('lodash');var moment=require(_0xaab0('0x1'));function getSeconds(_0x1fea44,_0x439e82){var _0xc346d9=moment(_0x1fea44)['milliseconds'](0x0);var _0x2e7e36=moment(_0x439e82)['milliseconds'](0x0);return _0xc346d9[_0xaab0('0x2')](_0x2e7e36,_0xaab0('0x3'));}function AdditionalPhone(_0x38e061){this[_0xaab0('0x4')]=_0x38e061['uniqueid'];this[_0xaab0('0x5')]=_0x38e061[_0xaab0('0x5')]||undefined;this[_0xaab0('0x6')]=_0x38e061['type'];this[_0xaab0('0x7')]=_0x38e061[_0xaab0('0x6')]==='outbound'?_0xaab0('0x8'):_0x38e061['type'];this['countbusyretry']=_0x38e061[_0xaab0('0x9')];this[_0xaab0('0xa')]=_0x38e061['countcongestionretry'];this[_0xaab0('0xb')]=_0x38e061['countnoanswerretry'];this[_0xaab0('0xc')]=_0x38e061[_0xaab0('0x9')]+_0x38e061['countcongestionretry']+_0x38e061[_0xaab0('0xb')]+_0x38e061['countnosuchnumberretry']+_0x38e061['countdropretry']+_0x38e061[_0xaab0('0xd')]+_0x38e061[_0xaab0('0xe')]+_0x38e061[_0xaab0('0xf')];this['countnosuchnumberretry']=_0x38e061[_0xaab0('0x10')];this[_0xaab0('0x11')]=_0x38e061[_0xaab0('0x11')];this[_0xaab0('0xd')]=_0x38e061[_0xaab0('0xd')];this[_0xaab0('0xe')]=_0x38e061['countmachineretry'];this['countagentrejectretry']=_0x38e061['countagentrejectretry'];this['queue']=_0x38e061[_0xaab0('0x8')];this[_0xaab0('0x12')]=_0x38e061[_0xaab0('0x13')];this[_0xaab0('0x14')]=_0x38e061[_0xaab0('0x15')];this[_0xaab0('0x16')]=_0x38e061[_0xaab0('0x16')];this[_0xaab0('0x17')]=_0x38e061[_0xaab0('0x17')];this[_0xaab0('0x18')]=_0x38e061[_0xaab0('0x17')];this['ringtime']=getSeconds(_0x38e061[_0xaab0('0x17')],_0x38e061['starttime']);this[_0xaab0('0x19')]=0x0;this[_0xaab0('0x1a')]=0x0;this[_0xaab0('0x1b')]=_0x38e061[_0xaab0('0x1b')];this[_0xaab0('0x1c')]=_0x38e061[_0xaab0('0x1c')];this['callbackat']=_0x38e061['callbackat'];this[_0xaab0('0x1d')]=_0x38e061['recallme'];this[_0xaab0('0x1e')]=_0x38e061['ContactId'];this[_0xaab0('0x1f')]=_0x38e061[_0xaab0('0x1f')];this[_0xaab0('0x20')]=_0x38e061[_0xaab0('0x20')];this['VoiceQueueId']=_0x38e061[_0xaab0('0x21')];this[_0xaab0('0x22')]=_0x38e061[_0xaab0('0x22')];this[_0xaab0('0x23')]=_0x38e061[_0xaab0('0x23')]||'';this[_0xaab0('0x24')]=_0x38e061[_0xaab0('0x24')]||'';}module[_0xaab0('0x25')]=History; \ No newline at end of file +var _0x16df=['CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x4a5ad9,_0x3208b8){var _0x56c9d5=function(_0x2e8652){while(--_0x2e8652){_0x4a5ad9['push'](_0x4a5ad9['shift']());}};_0x56c9d5(++_0x3208b8);}(_0x16df,0x106));var _0xf16d=function(_0x5a9464,_0xfb2566){_0x5a9464=_0x5a9464-0x0;var _0x5af4b1=_0x16df[_0x5a9464];return _0x5af4b1;};'use strict';var util=require('util');var _=require(_0xf16d('0x0'));var moment=require('moment');function getSeconds(_0x3e0d33,_0x23e9bb){var _0x3f0023=moment(_0x3e0d33)[_0xf16d('0x1')](0x0);var _0x4b95ff=moment(_0x23e9bb)[_0xf16d('0x1')](0x0);return _0x3f0023[_0xf16d('0x2')](_0x4b95ff,_0xf16d('0x3'));}function AdditionalPhone(_0xb08827){this['uniqueid']=_0xb08827['uniqueid'];this['scheduledat']=_0xb08827[_0xf16d('0x4')]||undefined;this[_0xf16d('0x5')]=_0xb08827[_0xf16d('0x5')];this[_0xf16d('0x6')]=_0xb08827[_0xf16d('0x5')]===_0xf16d('0x7')?'queue':_0xb08827[_0xf16d('0x5')];this['countbusyretry']=_0xb08827[_0xf16d('0x8')];this[_0xf16d('0x9')]=_0xb08827[_0xf16d('0x9')];this[_0xf16d('0xa')]=_0xb08827[_0xf16d('0xa')];this[_0xf16d('0xb')]=_0xb08827[_0xf16d('0x8')]+_0xb08827[_0xf16d('0x9')]+_0xb08827['countnoanswerretry']+_0xb08827[_0xf16d('0xc')]+_0xb08827[_0xf16d('0xd')]+_0xb08827[_0xf16d('0xe')]+_0xb08827[_0xf16d('0xf')]+_0xb08827[_0xf16d('0x10')];this[_0xf16d('0xc')]=_0xb08827[_0xf16d('0xc')];this['countdropretry']=_0xb08827['countdropretry'];this[_0xf16d('0xe')]=_0xb08827[_0xf16d('0xe')];this[_0xf16d('0xf')]=_0xb08827[_0xf16d('0xf')];this[_0xf16d('0x10')]=_0xb08827[_0xf16d('0x10')];this[_0xf16d('0x11')]=_0xb08827[_0xf16d('0x11')];this[_0xf16d('0x12')]=_0xb08827['name'];this[_0xf16d('0x13')]=_0xb08827[_0xf16d('0x14')];this[_0xf16d('0x15')]=_0xb08827['starttime'];this[_0xf16d('0x16')]=_0xb08827[_0xf16d('0x16')];this[_0xf16d('0x17')]=_0xb08827[_0xf16d('0x16')];this[_0xf16d('0x18')]=getSeconds(_0xb08827[_0xf16d('0x16')],_0xb08827[_0xf16d('0x15')]);this[_0xf16d('0x19')]=0x0;this[_0xf16d('0x1a')]=0x0;this[_0xf16d('0x1b')]=_0xb08827[_0xf16d('0x1b')];this[_0xf16d('0x1c')]=_0xb08827['callbackuniqueid'];this[_0xf16d('0x1d')]=_0xb08827[_0xf16d('0x1d')];this[_0xf16d('0x1e')]=_0xb08827[_0xf16d('0x1e')];this[_0xf16d('0x1f')]=_0xb08827['ContactId'];this[_0xf16d('0x20')]=_0xb08827[_0xf16d('0x20')];this[_0xf16d('0x21')]=_0xb08827[_0xf16d('0x21')];this['VoiceQueueId']=_0xb08827['VoiceQueueId'];this[_0xf16d('0x22')]=_0xb08827[_0xf16d('0x22')];this[_0xf16d('0x23')]=_0xb08827[_0xf16d('0x23')]||'';this[_0xf16d('0x24')]=_0xb08827[_0xf16d('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index bf23a87..2168616 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 _0x436a=['ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x436a,0x1d2));var _0xa436=function(_0x86dc50,_0xb0c514){_0x86dc50=_0x86dc50-0x0;var _0x819ceb=_0x436a[_0x86dc50];return _0x819ceb;};'use strict';var util=require(_0xa436('0x0'));var _=require('lodash');var moment=require(_0xa436('0x1'));function getSeconds(_0x4af25f,_0x165b47){var _0x11a4fd=moment(_0x4af25f)[_0xa436('0x2')](0x0);var _0x186cfd=moment(_0x165b47)[_0xa436('0x2')](0x0);return _0x11a4fd['diff'](_0x186cfd,_0xa436('0x3'));}function AgentComplete(_0x1fe643,_0x3f7686){this['state']=0x4;this[_0xa436('0x4')]=_0xa436('0x5');this[_0xa436('0x6')]=_0x1fe643[_0xa436('0x6')];this['type']=_0x1fe643[_0xa436('0x7')];this['campaigntype']=_0x1fe643[_0xa436('0x7')]===_0xa436('0x8')?_0xa436('0x9'):_0x1fe643['type'];this['countbusyretry']=_0x1fe643[_0xa436('0xa')];this[_0xa436('0xb')]=_0x1fe643[_0xa436('0xb')];this[_0xa436('0xc')]=_0x1fe643[_0xa436('0xc')];this['countglobal']=_0x1fe643[_0xa436('0xa')]+_0x1fe643[_0xa436('0xb')]+_0x1fe643[_0xa436('0xc')]+_0x1fe643[_0xa436('0xd')]+_0x1fe643['countdropretry']+_0x1fe643['countabandonedretry']+_0x1fe643['countmachineretry']+_0x1fe643[_0xa436('0xe')];this[_0xa436('0xd')]=_0x1fe643['countnosuchnumberretry'];this[_0xa436('0xf')]=_0x1fe643[_0xa436('0xf')];this[_0xa436('0x10')]=_0x1fe643['countabandonedretry'];this[_0xa436('0x11')]=_0x1fe643['countmachineretry'];this[_0xa436('0xe')]=_0x1fe643[_0xa436('0xe')];this[_0xa436('0x12')]=_0x3f7686[_0xa436('0x12')];this[_0xa436('0x13')]=_0x1fe643[_0xa436('0x14')];this[_0xa436('0x15')]=_0x1fe643[_0xa436('0x16')];this[_0xa436('0x17')]=_0x1fe643[_0xa436('0x17')];this[_0xa436('0x18')]=_0x1fe643['responsetime'];this[_0xa436('0x19')]=_0x1fe643[_0xa436('0x19')];this[_0xa436('0x1a')]=moment()[_0xa436('0x1b')](_0xa436('0x1c'));this[_0xa436('0x1d')]=getSeconds(_0x1fe643['responsetime'],_0x1fe643['starttime']);this[_0xa436('0x1e')]=getSeconds(_0x1fe643[_0xa436('0x19')],_0x1fe643[_0xa436('0x18')]);this[_0xa436('0x1f')]=getSeconds(this[_0xa436('0x1a')],_0x1fe643['answertime']);this[_0xa436('0x9')]=_0x3f7686[_0xa436('0x9')];this[_0xa436('0x20')]=_0x3f7686['membername'];this[_0xa436('0x21')]=_0x3f7686[_0xa436('0x21')];this[_0xa436('0x22')]=_0x1fe643[_0xa436('0x22')];this[_0xa436('0x23')]=_0x1fe643['callbackuniqueid'];this[_0xa436('0x24')]=_0x1fe643[_0xa436('0x24')];this[_0xa436('0x25')]=_0x1fe643[_0xa436('0x25')];this['ContactId']=_0x1fe643[_0xa436('0x26')];this[_0xa436('0x27')]=_0x1fe643['ListId'];this[_0xa436('0x28')]=_0x1fe643['UserId'];this[_0xa436('0x29')]=_0x1fe643['VoiceQueueId'];this['CampaignId']=_0x1fe643['CampaignId'];this['originatecalleridnum']=_0x1fe643[_0xa436('0x2a')]||'';this['originatecalleridname']=_0x1fe643[_0xa436('0x2b')]||'';}module[_0xa436('0x2c')]=AgentComplete; \ No newline at end of file +var _0x7a9a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','talktime','membername','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x5744c3,_0x39b62a){var _0xafeba2=function(_0xe685bf){while(--_0xe685bf){_0x5744c3['push'](_0x5744c3['shift']());}};_0xafeba2(++_0x39b62a);}(_0x7a9a,0x116));var _0xa7a9=function(_0x1a9329,_0x19b587){_0x1a9329=_0x1a9329-0x0;var _0x1b830e=_0x7a9a[_0x1a9329];return _0x1b830e;};'use strict';var util=require(_0xa7a9('0x0'));var _=require(_0xa7a9('0x1'));var moment=require(_0xa7a9('0x2'));function getSeconds(_0x2a88aa,_0x2ebb7d){var _0x203307=moment(_0x2a88aa)['milliseconds'](0x0);var _0x4eaa8c=moment(_0x2ebb7d)[_0xa7a9('0x3')](0x0);return _0x203307['diff'](_0x4eaa8c,_0xa7a9('0x4'));}function AgentComplete(_0x3dac4e,_0x455ca0){this[_0xa7a9('0x5')]=0x4;this[_0xa7a9('0x6')]=_0xa7a9('0x7');this['scheduledat']=_0x3dac4e[_0xa7a9('0x8')];this['type']=_0x3dac4e[_0xa7a9('0x9')];this['campaigntype']=_0x3dac4e[_0xa7a9('0x9')]===_0xa7a9('0xa')?_0xa7a9('0xb'):_0x3dac4e['type'];this[_0xa7a9('0xc')]=_0x3dac4e[_0xa7a9('0xc')];this[_0xa7a9('0xd')]=_0x3dac4e[_0xa7a9('0xd')];this[_0xa7a9('0xe')]=_0x3dac4e[_0xa7a9('0xe')];this['countglobal']=_0x3dac4e[_0xa7a9('0xc')]+_0x3dac4e[_0xa7a9('0xd')]+_0x3dac4e[_0xa7a9('0xe')]+_0x3dac4e[_0xa7a9('0xf')]+_0x3dac4e[_0xa7a9('0x10')]+_0x3dac4e[_0xa7a9('0x11')]+_0x3dac4e[_0xa7a9('0x12')]+_0x3dac4e[_0xa7a9('0x13')];this[_0xa7a9('0xf')]=_0x3dac4e['countnosuchnumberretry'];this[_0xa7a9('0x10')]=_0x3dac4e[_0xa7a9('0x10')];this[_0xa7a9('0x11')]=_0x3dac4e[_0xa7a9('0x11')];this[_0xa7a9('0x12')]=_0x3dac4e[_0xa7a9('0x12')];this['countagentrejectretry']=_0x3dac4e[_0xa7a9('0x13')];this[_0xa7a9('0x14')]=_0x455ca0[_0xa7a9('0x14')];this['calleridname']=_0x3dac4e[_0xa7a9('0x15')];this[_0xa7a9('0x16')]=_0x3dac4e[_0xa7a9('0x17')];this[_0xa7a9('0x18')]=_0x3dac4e[_0xa7a9('0x18')];this['responsetime']=_0x3dac4e['responsetime'];this[_0xa7a9('0x19')]=_0x3dac4e['answertime'];this[_0xa7a9('0x1a')]=moment()[_0xa7a9('0x1b')](_0xa7a9('0x1c'));this['ringtime']=getSeconds(_0x3dac4e[_0xa7a9('0x1d')],_0x3dac4e[_0xa7a9('0x18')]);this['holdtime']=getSeconds(_0x3dac4e['answertime'],_0x3dac4e[_0xa7a9('0x1d')]);this[_0xa7a9('0x1e')]=getSeconds(this[_0xa7a9('0x1a')],_0x3dac4e[_0xa7a9('0x19')]);this['queue']=_0x455ca0[_0xa7a9('0xb')];this[_0xa7a9('0x1f')]=_0x455ca0[_0xa7a9('0x1f')];this['reason']=_0x455ca0['reason'];this[_0xa7a9('0x20')]=_0x3dac4e[_0xa7a9('0x20')];this['callbackuniqueid']=_0x3dac4e['callbackuniqueid'];this[_0xa7a9('0x21')]=_0x3dac4e[_0xa7a9('0x21')];this[_0xa7a9('0x22')]=_0x3dac4e[_0xa7a9('0x22')];this[_0xa7a9('0x23')]=_0x3dac4e[_0xa7a9('0x23')];this[_0xa7a9('0x24')]=_0x3dac4e['ListId'];this[_0xa7a9('0x25')]=_0x3dac4e[_0xa7a9('0x25')];this[_0xa7a9('0x26')]=_0x3dac4e[_0xa7a9('0x26')];this[_0xa7a9('0x27')]=_0x3dac4e[_0xa7a9('0x27')];this['originatecalleridnum']=_0x3dac4e['originatecalleridnum']||'';this[_0xa7a9('0x28')]=_0x3dac4e[_0xa7a9('0x28')]||'';}module[_0xa7a9('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4360b3d..cffa5d4 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 _0xa1e4=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId'];(function(_0xb0454b,_0x56c432){var _0x38d907=function(_0x4d54c8){while(--_0x4d54c8){_0xb0454b['push'](_0xb0454b['shift']());}};_0x38d907(++_0x56c432);}(_0xa1e4,0x18a));var _0x4a1e=function(_0x29215d,_0x39143f){_0x29215d=_0x29215d-0x0;var _0x265037=_0xa1e4[_0x29215d];return _0x265037;};'use strict';var util=require(_0x4a1e('0x0'));var _=require(_0x4a1e('0x1'));var moment=require('moment');function getSeconds(_0xe764d4,_0x5a8cb){var _0x41a8de=moment(_0xe764d4)[_0x4a1e('0x2')](0x0);var _0x2cb06b=moment(_0x5a8cb)[_0x4a1e('0x2')](0x0);return _0x41a8de[_0x4a1e('0x3')](_0x2cb06b,_0x4a1e('0x4'));}function Final(_0xcfc160){this[_0x4a1e('0x5')]=_0xcfc160['uniqueid'];this[_0x4a1e('0x6')]=_0xcfc160[_0x4a1e('0x6')];this[_0x4a1e('0x7')]=_0xcfc160[_0x4a1e('0x7')];this[_0x4a1e('0x8')]=_0xcfc160[_0x4a1e('0x7')]===_0x4a1e('0x9')?_0x4a1e('0xa'):_0xcfc160[_0x4a1e('0x7')];this[_0x4a1e('0xb')]=_0xcfc160[_0x4a1e('0xb')];this[_0x4a1e('0xc')]=_0xcfc160[_0x4a1e('0xc')];this[_0x4a1e('0xd')]=_0xcfc160[_0x4a1e('0xd')];this[_0x4a1e('0xe')]=_0xcfc160[_0x4a1e('0xb')]+_0xcfc160[_0x4a1e('0xc')]+_0xcfc160[_0x4a1e('0xd')]+_0xcfc160[_0x4a1e('0xf')]+_0xcfc160['countdropretry']+_0xcfc160[_0x4a1e('0x10')]+_0xcfc160[_0x4a1e('0x11')]+_0xcfc160['countagentrejectretry'];this[_0x4a1e('0xf')]=_0xcfc160[_0x4a1e('0xf')];this[_0x4a1e('0x12')]=_0xcfc160['countdropretry'];this[_0x4a1e('0x10')]=_0xcfc160[_0x4a1e('0x10')];this['countmachineretry']=_0xcfc160[_0x4a1e('0x11')];this[_0x4a1e('0x13')]=_0xcfc160[_0x4a1e('0x13')];this['queue']=_0xcfc160[_0x4a1e('0xa')];this['calleridname']=_0xcfc160[_0x4a1e('0x14')];this[_0x4a1e('0x15')]=_0xcfc160[_0x4a1e('0x15')];this[_0x4a1e('0x16')]=_0xcfc160[_0x4a1e('0x16')];this[_0x4a1e('0x17')]=_0xcfc160[_0x4a1e('0x17')];this[_0x4a1e('0x18')]=_0xcfc160[_0x4a1e('0x17')];this[_0x4a1e('0x19')]=_0xcfc160[_0x4a1e('0x19')]||0x0;this[_0x4a1e('0x1a')]=_0xcfc160[_0x4a1e('0x1a')]||0x0;this[_0x4a1e('0x1b')]=_0xcfc160[_0x4a1e('0x1b')]||0x0;this[_0x4a1e('0x1c')]=_0xcfc160[_0x4a1e('0x1c')];this['callbackuniqueid']=_0xcfc160[_0x4a1e('0x1d')];this['callbackat']=_0xcfc160[_0x4a1e('0x1e')];this['recallme']=_0xcfc160[_0x4a1e('0x1f')];this[_0x4a1e('0x20')]=_0xcfc160[_0x4a1e('0x20')];this['ListId']=_0xcfc160['ListId'];this[_0x4a1e('0x21')]=_0xcfc160[_0x4a1e('0x21')];this[_0x4a1e('0x22')]=_0xcfc160[_0x4a1e('0x22')];this[_0x4a1e('0x23')]=_0xcfc160[_0x4a1e('0x23')];this[_0x4a1e('0x24')]=_0xcfc160['originatecalleridnum']||'';this[_0x4a1e('0x25')]=_0xcfc160[_0x4a1e('0x25')]||'';}module[_0x4a1e('0x26')]=Final; \ No newline at end of file +var _0xfb04=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x1cecf0,_0x3eb6fb){var _0x2d73bf=function(_0x2a71cd){while(--_0x2a71cd){_0x1cecf0['push'](_0x1cecf0['shift']());}};_0x2d73bf(++_0x3eb6fb);}(_0xfb04,0x1b5));var _0x4fb0=function(_0x4363ea,_0x19eadf){_0x4363ea=_0x4363ea-0x0;var _0x43022e=_0xfb04[_0x4363ea];return _0x43022e;};'use strict';var util=require(_0x4fb0('0x0'));var _=require('lodash');var moment=require(_0x4fb0('0x1'));function getSeconds(_0x5213ec,_0x2386c4){var _0x120ef4=moment(_0x5213ec)[_0x4fb0('0x2')](0x0);var _0x3ed6fb=moment(_0x2386c4)[_0x4fb0('0x2')](0x0);return _0x120ef4['diff'](_0x3ed6fb,'seconds');}function Final(_0x53f2a2){this[_0x4fb0('0x3')]=_0x53f2a2[_0x4fb0('0x3')];this[_0x4fb0('0x4')]=_0x53f2a2[_0x4fb0('0x4')];this['type']=_0x53f2a2[_0x4fb0('0x5')];this[_0x4fb0('0x6')]=_0x53f2a2['type']===_0x4fb0('0x7')?_0x4fb0('0x8'):_0x53f2a2[_0x4fb0('0x5')];this[_0x4fb0('0x9')]=_0x53f2a2['countbusyretry'];this[_0x4fb0('0xa')]=_0x53f2a2[_0x4fb0('0xa')];this[_0x4fb0('0xb')]=_0x53f2a2['countnoanswerretry'];this[_0x4fb0('0xc')]=_0x53f2a2[_0x4fb0('0x9')]+_0x53f2a2[_0x4fb0('0xa')]+_0x53f2a2['countnoanswerretry']+_0x53f2a2[_0x4fb0('0xd')]+_0x53f2a2[_0x4fb0('0xe')]+_0x53f2a2['countabandonedretry']+_0x53f2a2['countmachineretry']+_0x53f2a2['countagentrejectretry'];this[_0x4fb0('0xd')]=_0x53f2a2[_0x4fb0('0xd')];this[_0x4fb0('0xe')]=_0x53f2a2['countdropretry'];this[_0x4fb0('0xf')]=_0x53f2a2[_0x4fb0('0xf')];this[_0x4fb0('0x10')]=_0x53f2a2['countmachineretry'];this[_0x4fb0('0x11')]=_0x53f2a2['countagentrejectretry'];this[_0x4fb0('0x8')]=_0x53f2a2['queue'];this[_0x4fb0('0x12')]=_0x53f2a2['calleridname'];this[_0x4fb0('0x13')]=_0x53f2a2['calleridnum'];this[_0x4fb0('0x14')]=_0x53f2a2[_0x4fb0('0x14')];this[_0x4fb0('0x15')]=_0x53f2a2[_0x4fb0('0x15')];this[_0x4fb0('0x16')]=_0x53f2a2[_0x4fb0('0x15')];this[_0x4fb0('0x17')]=_0x53f2a2[_0x4fb0('0x17')]||0x0;this[_0x4fb0('0x18')]=_0x53f2a2[_0x4fb0('0x18')]||0x0;this['talktime']=_0x53f2a2[_0x4fb0('0x19')]||0x0;this['callback']=_0x53f2a2['callback'];this[_0x4fb0('0x1a')]=_0x53f2a2['callbackuniqueid'];this[_0x4fb0('0x1b')]=_0x53f2a2[_0x4fb0('0x1b')];this[_0x4fb0('0x1c')]=_0x53f2a2['recallme'];this['ContactId']=_0x53f2a2[_0x4fb0('0x1d')];this['ListId']=_0x53f2a2[_0x4fb0('0x1e')];this['UserId']=_0x53f2a2[_0x4fb0('0x1f')];this[_0x4fb0('0x20')]=_0x53f2a2['VoiceQueueId'];this[_0x4fb0('0x21')]=_0x53f2a2[_0x4fb0('0x21')];this[_0x4fb0('0x22')]=_0x53f2a2[_0x4fb0('0x22')]||'';this['originatecalleridname']=_0x53f2a2[_0x4fb0('0x23')]||'';}module[_0x4fb0('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9e4f119..a9a059d 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 _0x2202=['countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','endtime','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x1b1779,_0x1af2e8){var _0x47c709=function(_0xcced02){while(--_0xcced02){_0x1b1779['push'](_0x1b1779['shift']());}};_0x47c709(++_0x1af2e8);}(_0x2202,0x13e));var _0x2220=function(_0x57e7a9,_0x4b20c0){_0x57e7a9=_0x57e7a9-0x0;var _0x46aec4=_0x2202[_0x57e7a9];return _0x46aec4;};'use strict';var util=require(_0x2220('0x0'));var _=require(_0x2220('0x1'));var moment=require('moment');function getSeconds(_0x48983f,_0x192b90){var _0x3faed1=moment(_0x48983f)[_0x2220('0x2')](0x0);var _0x105ed5=moment(_0x192b90)[_0x2220('0x2')](0x0);return _0x3faed1['diff'](_0x105ed5,'seconds');}function Hangup(_0x243578,_0x14b710){this[_0x2220('0x3')]=0x4;this[_0x2220('0x4')]=_0x2220('0x5');this[_0x2220('0x6')]=_0x243578[_0x2220('0x6')];this[_0x2220('0x7')]=_0x243578[_0x2220('0x7')];this[_0x2220('0x8')]=_0x243578[_0x2220('0x7')]===_0x2220('0x9')?_0x2220('0xa'):_0x243578[_0x2220('0x7')];this[_0x2220('0xb')]=_0x243578[_0x2220('0xb')];this[_0x2220('0xc')]=_0x243578[_0x2220('0xc')];this['countnoanswerretry']=_0x243578[_0x2220('0xd')];this[_0x2220('0xe')]=_0x243578[_0x2220('0xb')]+_0x243578['countcongestionretry']+_0x243578[_0x2220('0xd')]+_0x243578[_0x2220('0xf')]+_0x243578[_0x2220('0x10')]+_0x243578[_0x2220('0x11')]+_0x243578[_0x2220('0x12')]+_0x243578['countagentrejectretry'];this[_0x2220('0xf')]=_0x243578[_0x2220('0xf')];this[_0x2220('0x10')]=_0x243578[_0x2220('0x10')];this[_0x2220('0x11')]=_0x243578[_0x2220('0x11')];this[_0x2220('0x12')]=_0x243578[_0x2220('0x12')];this[_0x2220('0x13')]=_0x243578[_0x2220('0x13')];this[_0x2220('0x14')]=_0x14b710[_0x2220('0x14')];this[_0x2220('0x15')]=_0x243578[_0x2220('0x16')];this[_0x2220('0x17')]=_0x243578['number'];this[_0x2220('0x18')]=_0x243578['starttime'];this[_0x2220('0x19')]=_0x243578[_0x2220('0x19')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2220('0x1a')]=getSeconds(_0x243578[_0x2220('0x19')],_0x243578[_0x2220('0x18')]);this[_0x2220('0x1b')]=0x0;this[_0x2220('0x1c')]=getSeconds(this[_0x2220('0x1d')],_0x243578[_0x2220('0x19')]);this[_0x2220('0xa')]=_0x243578[_0x2220('0xa')];this['membername']=_0x2220('0x1e');this[_0x2220('0x1f')]=_0x14b710['cause-txt'];this['callback']=_0x243578[_0x2220('0x20')];this['callbackuniqueid']=_0x243578[_0x2220('0x21')];this[_0x2220('0x22')]=_0x243578[_0x2220('0x22')];this[_0x2220('0x23')]=_0x243578[_0x2220('0x23')];this[_0x2220('0x24')]=_0x243578['ContactId'];this[_0x2220('0x25')]=_0x243578[_0x2220('0x25')];this[_0x2220('0x26')]=_0x243578[_0x2220('0x26')];this[_0x2220('0x27')]=_0x243578[_0x2220('0x27')];this['CampaignId']=_0x243578[_0x2220('0x28')];}module[_0x2220('0x29')]=Hangup; \ No newline at end of file +var _0xd0ac=['exports','util','lodash','milliseconds','diff','state','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x54ac59,_0x4e140e){var _0x43a462=function(_0x2503a5){while(--_0x2503a5){_0x54ac59['push'](_0x54ac59['shift']());}};_0x43a462(++_0x4e140e);}(_0xd0ac,0x1d5));var _0xcd0a=function(_0x7da909,_0x296635){_0x7da909=_0x7da909-0x0;var _0x14e260=_0xd0ac[_0x7da909];return _0x14e260;};'use strict';var util=require(_0xcd0a('0x0'));var _=require(_0xcd0a('0x1'));var moment=require('moment');function getSeconds(_0x28bf65,_0x103ffe){var _0xb51f89=moment(_0x28bf65)['milliseconds'](0x0);var _0x7603ca=moment(_0x103ffe)[_0xcd0a('0x2')](0x0);return _0xb51f89[_0xcd0a('0x3')](_0x7603ca,'seconds');}function Hangup(_0x341f85,_0x1fe510){this[_0xcd0a('0x4')]=0x4;this['statedesc']='Answer';this[_0xcd0a('0x5')]=_0x341f85[_0xcd0a('0x5')];this[_0xcd0a('0x6')]=_0x341f85[_0xcd0a('0x6')];this['campaigntype']=_0x341f85[_0xcd0a('0x6')]===_0xcd0a('0x7')?_0xcd0a('0x8'):_0x341f85[_0xcd0a('0x6')];this[_0xcd0a('0x9')]=_0x341f85[_0xcd0a('0x9')];this[_0xcd0a('0xa')]=_0x341f85[_0xcd0a('0xa')];this[_0xcd0a('0xb')]=_0x341f85[_0xcd0a('0xb')];this[_0xcd0a('0xc')]=_0x341f85['countbusyretry']+_0x341f85['countcongestionretry']+_0x341f85[_0xcd0a('0xb')]+_0x341f85[_0xcd0a('0xd')]+_0x341f85[_0xcd0a('0xe')]+_0x341f85[_0xcd0a('0xf')]+_0x341f85[_0xcd0a('0x10')]+_0x341f85[_0xcd0a('0x11')];this[_0xcd0a('0xd')]=_0x341f85[_0xcd0a('0xd')];this['countdropretry']=_0x341f85[_0xcd0a('0xe')];this[_0xcd0a('0xf')]=_0x341f85[_0xcd0a('0xf')];this['countmachineretry']=_0x341f85[_0xcd0a('0x10')];this[_0xcd0a('0x11')]=_0x341f85[_0xcd0a('0x11')];this[_0xcd0a('0x12')]=_0x1fe510[_0xcd0a('0x12')];this['calleridname']=_0x341f85['name'];this['calleridnum']=_0x341f85['number'];this[_0xcd0a('0x13')]=_0x341f85[_0xcd0a('0x13')];this[_0xcd0a('0x14')]=_0x341f85[_0xcd0a('0x14')];this[_0xcd0a('0x15')]=moment()[_0xcd0a('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcd0a('0x17')]=getSeconds(_0x341f85[_0xcd0a('0x14')],_0x341f85[_0xcd0a('0x13')]);this[_0xcd0a('0x18')]=0x0;this['talktime']=getSeconds(this[_0xcd0a('0x15')],_0x341f85['responsetime']);this[_0xcd0a('0x8')]=_0x341f85[_0xcd0a('0x8')];this[_0xcd0a('0x19')]=_0xcd0a('0x1a');this[_0xcd0a('0x1b')]=_0x1fe510[_0xcd0a('0x1c')];this['callback']=_0x341f85[_0xcd0a('0x1d')];this[_0xcd0a('0x1e')]=_0x341f85[_0xcd0a('0x1e')];this['callbackat']=_0x341f85[_0xcd0a('0x1f')];this[_0xcd0a('0x20')]=_0x341f85[_0xcd0a('0x20')];this['ContactId']=_0x341f85[_0xcd0a('0x21')];this[_0xcd0a('0x22')]=_0x341f85['ListId'];this[_0xcd0a('0x23')]=_0x341f85[_0xcd0a('0x23')];this[_0xcd0a('0x24')]=_0x341f85['VoiceQueueId'];this['CampaignId']=_0x341f85[_0xcd0a('0x25')];}module[_0xcd0a('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index dedf001..d1204a8 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 _0xc3ce=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type'];(function(_0x1ff69b,_0x331e8f){var _0x12bac5=function(_0x1b530a){while(--_0x1b530a){_0x1ff69b['push'](_0x1ff69b['shift']());}};_0x12bac5(++_0x331e8f);}(_0xc3ce,0x1e6));var _0xec3c=function(_0x3585db,_0x15615d){_0x3585db=_0x3585db-0x0;var _0x537104=_0xc3ce[_0x3585db];return _0x537104;};'use strict';var util=require(_0xec3c('0x0'));var _=require(_0xec3c('0x1'));var moment=require('moment');function getSeconds(_0x21367d,_0x49a23c){var _0x5bf111=moment(_0x21367d)[_0xec3c('0x2')](0x0);var _0x30ddbc=moment(_0x49a23c)[_0xec3c('0x2')](0x0);return _0x5bf111[_0xec3c('0x3')](_0x30ddbc,_0xec3c('0x4'));}function History(_0x1e13fd){this[_0xec3c('0x5')]=_0x1e13fd[_0xec3c('0x5')];this[_0xec3c('0x6')]=_0x1e13fd['scheduledat']||undefined;this[_0xec3c('0x7')]=_0x1e13fd[_0xec3c('0x7')];this['campaigntype']=_0x1e13fd[_0xec3c('0x7')]===_0xec3c('0x8')?_0xec3c('0x9'):_0x1e13fd['type'];this[_0xec3c('0xa')]=_0x1e13fd[_0xec3c('0xa')];this['countcongestionretry']=_0x1e13fd[_0xec3c('0xb')];this[_0xec3c('0xc')]=_0x1e13fd[_0xec3c('0xc')];this[_0xec3c('0xd')]=_0x1e13fd['countbusyretry']+_0x1e13fd[_0xec3c('0xb')]+_0x1e13fd[_0xec3c('0xc')]+_0x1e13fd[_0xec3c('0xe')]+_0x1e13fd[_0xec3c('0xf')]+_0x1e13fd[_0xec3c('0x10')]+_0x1e13fd[_0xec3c('0x11')]+_0x1e13fd[_0xec3c('0x12')];this[_0xec3c('0xe')]=_0x1e13fd[_0xec3c('0xe')];this[_0xec3c('0xf')]=_0x1e13fd[_0xec3c('0xf')];this[_0xec3c('0x10')]=_0x1e13fd[_0xec3c('0x10')];this[_0xec3c('0x11')]=_0x1e13fd[_0xec3c('0x11')];this[_0xec3c('0x12')]=_0x1e13fd['countagentrejectretry'];this[_0xec3c('0x9')]=_0x1e13fd[_0xec3c('0x9')];this['calleridname']=_0x1e13fd['name'];this[_0xec3c('0x13')]=_0x1e13fd[_0xec3c('0x14')];this[_0xec3c('0x15')]=_0x1e13fd[_0xec3c('0x15')];this[_0xec3c('0x16')]=_0x1e13fd['responsetime'];this[_0xec3c('0x17')]=_0x1e13fd['responsetime'];this[_0xec3c('0x18')]=getSeconds(_0x1e13fd['responsetime'],_0x1e13fd[_0xec3c('0x15')]);this[_0xec3c('0x19')]=0x0;this[_0xec3c('0x1a')]=0x0;this[_0xec3c('0x1b')]=_0x1e13fd[_0xec3c('0x1b')];this['callbackuniqueid']=_0x1e13fd['callbackuniqueid'];this[_0xec3c('0x1c')]=_0x1e13fd['callbackat'];this[_0xec3c('0x1d')]=_0x1e13fd['recallme'];this[_0xec3c('0x1e')]=_0x1e13fd[_0xec3c('0x1e')];this[_0xec3c('0x1f')]=_0x1e13fd[_0xec3c('0x1f')];this[_0xec3c('0x20')]=_0x1e13fd[_0xec3c('0x20')];this['VoiceQueueId']=_0x1e13fd[_0xec3c('0x21')];this['CampaignId']=_0x1e13fd[_0xec3c('0x22')];this[_0xec3c('0x23')]=_0x1e13fd['originatecalleridnum']||'';this[_0xec3c('0x24')]=_0x1e13fd[_0xec3c('0x24')]||'';}module[_0xec3c('0x25')]=History; \ No newline at end of file +var _0x6484=['originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6484,0x1bb));var _0x4648=function(_0x449949,_0x4065ba){_0x449949=_0x449949-0x0;var _0x2e76fe=_0x6484[_0x449949];return _0x2e76fe;};'use strict';var util=require('util');var _=require(_0x4648('0x0'));var moment=require(_0x4648('0x1'));function getSeconds(_0xc79143,_0x12b916){var _0x5393c3=moment(_0xc79143)[_0x4648('0x2')](0x0);var _0x2f31f4=moment(_0x12b916)['milliseconds'](0x0);return _0x5393c3[_0x4648('0x3')](_0x2f31f4,_0x4648('0x4'));}function History(_0x16bd59){this['uniqueid']=_0x16bd59[_0x4648('0x5')];this[_0x4648('0x6')]=_0x16bd59[_0x4648('0x6')]||undefined;this[_0x4648('0x7')]=_0x16bd59[_0x4648('0x7')];this[_0x4648('0x8')]=_0x16bd59[_0x4648('0x7')]===_0x4648('0x9')?_0x4648('0xa'):_0x16bd59['type'];this['countbusyretry']=_0x16bd59['countbusyretry'];this[_0x4648('0xb')]=_0x16bd59[_0x4648('0xb')];this[_0x4648('0xc')]=_0x16bd59[_0x4648('0xc')];this[_0x4648('0xd')]=_0x16bd59[_0x4648('0xe')]+_0x16bd59[_0x4648('0xb')]+_0x16bd59[_0x4648('0xc')]+_0x16bd59[_0x4648('0xf')]+_0x16bd59[_0x4648('0x10')]+_0x16bd59[_0x4648('0x11')]+_0x16bd59[_0x4648('0x12')]+_0x16bd59[_0x4648('0x13')];this['countnosuchnumberretry']=_0x16bd59[_0x4648('0xf')];this['countdropretry']=_0x16bd59['countdropretry'];this[_0x4648('0x11')]=_0x16bd59[_0x4648('0x11')];this[_0x4648('0x12')]=_0x16bd59[_0x4648('0x12')];this[_0x4648('0x13')]=_0x16bd59[_0x4648('0x13')];this['queue']=_0x16bd59[_0x4648('0xa')];this[_0x4648('0x14')]=_0x16bd59['name'];this[_0x4648('0x15')]=_0x16bd59[_0x4648('0x16')];this[_0x4648('0x17')]=_0x16bd59['starttime'];this[_0x4648('0x18')]=_0x16bd59['responsetime'];this[_0x4648('0x19')]=_0x16bd59[_0x4648('0x18')];this[_0x4648('0x1a')]=getSeconds(_0x16bd59['responsetime'],_0x16bd59[_0x4648('0x17')]);this['holdtime']=0x0;this[_0x4648('0x1b')]=0x0;this['callback']=_0x16bd59[_0x4648('0x1c')];this[_0x4648('0x1d')]=_0x16bd59[_0x4648('0x1d')];this[_0x4648('0x1e')]=_0x16bd59[_0x4648('0x1e')];this[_0x4648('0x1f')]=_0x16bd59[_0x4648('0x1f')];this[_0x4648('0x20')]=_0x16bd59['ContactId'];this[_0x4648('0x21')]=_0x16bd59[_0x4648('0x21')];this['UserId']=_0x16bd59[_0x4648('0x22')];this['VoiceQueueId']=_0x16bd59[_0x4648('0x23')];this[_0x4648('0x24')]=_0x16bd59[_0x4648('0x24')];this[_0x4648('0x25')]=_0x16bd59[_0x4648('0x25')]||'';this[_0x4648('0x26')]=_0x16bd59[_0x4648('0x26')]||'';}module[_0x4648('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index a23cbd9..335c8cf 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 _0xd962=['then','catch','[countReScheduled]\x20','prototype','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ListId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','exten','dialAMDActive','value','outboundAnswerCallsDay','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','AMD','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','campaigns','[syncHangupInAMDIvr][createHistory]','Machine','countglobal','amd','countabandonedretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','[syncHangupIvr][createHistory]','syncAgentComplete','reason','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','agiafterat','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','calleridnum','channel','syncQueueMember','actionid','strategy','locked','stateinterface','pick','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','content','indexOf','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialTimezone','checkDialMethod','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','dialPredictiveOptimizationPercentage','busyFactor','startMethodPredictive','floor','erlangCallToSecond','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\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]','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','p\x20=\x20','exports','util','lodash','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/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','originateresponse','agentcomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','type','available','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangAbandonmentRate','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','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\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:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','erlangBusyFactor','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','actions','[actions]','hasOwnProperty','Action','status','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0xd962,0x16a));var _0x2d96=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xd962[_0x363ef8];return _0x148822;};'use strict';var util=require(_0x2d96('0x0'));var _=require(_0x2d96('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2d96('0x2'));var rr=require('rr');var md5=require(_0x2d96('0x3'));var Redis=require(_0x2d96('0x4'));var ut=require(_0x2d96('0x5'));var config=require(_0x2d96('0x6'));var logger=require(_0x2d96('0x7'))(_0x2d96('0x8'));var loggerBooked=require(_0x2d96('0x7'))(_0x2d96('0x9'));var loggerPredictive=require('../../../config/logger')(_0x2d96('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x2d96('0xb'));var loggerSyncQueueSummary=require(_0x2d96('0x7'))(_0x2d96('0xc'));var ami=require(_0x2d96('0xd'));config[_0x2d96('0xe')]=_[_0x2d96('0xf')](config[_0x2d96('0xe')],{'host':_0x2d96('0x10'),'port':0x18eb});var io=require(_0x2d96('0x11'))(new Redis(config[_0x2d96('0xe')]));var cmHopper=require(_0x2d96('0x12'));var cmHopperFinal=require(_0x2d96('0x13'));var cmHopperHistory=require(_0x2d96('0x14'));var cmHopperBlack=require(_0x2d96('0x15'));var voiceQueueRt=require(_0x2d96('0x16'));var Action=require(_0x2d96('0x17'));var History=require(_0x2d96('0x18'));var Final=require(_0x2d96('0x19'));var AgentComplete=require(_0x2d96('0x1a'));var QueueCallerAbandon=require(_0x2d96('0x1b'));var Hangup=require('./hangup');var ipAgi=process['env'][_0x2d96('0x1c')]||_0x2d96('0x1d');var strategy={'rrmemory':_0x2d96('0x1e'),'roundrobin':_0x2d96('0x1f')};var Sequence=function(){};Sequence['prototype'][_0x2d96('0x20')]=function(_0x1bb080){this['tail']=this[_0x2d96('0x21')]?this[_0x2d96('0x21')]['finally'](_0x1bb080):_0x1bb080();};function Dialer(_0x23cc46,_0x1032f4){this[_0x2d96('0x22')]=new Sequence();this[_0x2d96('0x23')]=_0x1032f4;this[_0x2d96('0x24')]=_0x23cc46[_0x2d96('0x24')];this['campaigns']=_0x23cc46['campaigns'];this['agents']=_0x23cc46[_0x2d96('0x25')];this[_0x2d96('0x26')]=_0x23cc46[_0x2d96('0x26')];this['maxNumberOriginate']=config[_0x2d96('0x27')]||0x2;this[_0x2d96('0x28')]={};this['actions']={};this['contactsId']={};this[_0x2d96('0x29')]={};this[_0x2d96('0x2a')]={};this[_0x2d96('0x2b')]={};this[_0x2d96('0x2c')]={};this[_0x2d96('0x2d')]={};this[_0x2d96('0x2e')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x2d96('0x2f')][_0x2d96('0x30')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x31'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2d96('0x32'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x2d96('0xc')][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x33'),this[_0x2d96('0x34')][_0x2d96('0x30')](this));ami['on']('newexten',this[_0x2d96('0x35')][_0x2d96('0x30')](this));ami['on'](_0x2d96('0x36'),this[_0x2d96('0x37')]['bind'](this));ami['on'](_0x2d96('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0x2d96('0x39'),this['syncQueueStatusComplete'][_0x2d96('0x30')](this));this[_0x2d96('0x3a')]();this[_0x2d96('0x3b')]();}function isNotNull(_0x4c86d9){return _0x4c86d9!==null&&!_[_0x2d96('0x3c')](_0x4c86d9);}function checkIsLoggedIn(_0x58111d,_0x1e41f0){return function(){if(_0x1e41f0<=0x0){_0x58111d['message']=_0x2d96('0x3d');throw _0x58111d['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x571c35){return _0x571c35;}function checkIsActive(_0xf2af80,_0x5c227c){return function(){if(!isActive(_0x5c227c)){_0xf2af80[_0x2d96('0x3e')]=_0x2d96('0x3f');throw _0xf2af80[_0x2d96('0x40')]+_0x2d96('0x41');}};}function checkInterval(_0x1cc0ae){return function(){if(!isNotNull(_0x1cc0ae[_0x2d96('0x42')])){_0x1cc0ae[_0x2d96('0x3e')]=_0x2d96('0x43');throw _0x1cc0ae[_0x2d96('0x40')]+_0x2d96('0x44');}if(!isNotNull(_0x1cc0ae[_0x2d96('0x42')][_0x2d96('0x45')])){_0x1cc0ae[_0x2d96('0x3e')]='INTERVAL_IS_NULL';throw _0x1cc0ae[_0x2d96('0x40')]+_0x2d96('0x44');}if(!isNotNull(_[_0x2d96('0x46')](_0x1cc0ae[_0x2d96('0x42')][_0x2d96('0x45')]))){_0x1cc0ae['message']=_0x2d96('0x43');throw _0x1cc0ae['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x36108f,_0x14d921,_0x33c990){return{'action':_0x36108f,'response':_0x14d921,'message':_0x33c990,'stack':_0x33c990};}function myreject(_0x48f070){return function(_0x4df238){return _0x48f070(msgResponse(_0x2d96('0x47'),_0x2d96('0x48'),JSON[_0x2d96('0x49')](_0x4df238)));};}function getSeconds(_0x1bd340,_0x684d51){var _0x266b16=moment(_0x1bd340)[_0x2d96('0x4a')](0x0);var _0x102284=moment(_0x684d51)[_0x2d96('0x4a')](0x0);return _0x266b16['diff'](_0x102284,'seconds');}function emit(_0x36bfaf,_0x29e8dc,_0x54bd22){io['to'](_0x36bfaf)[_0x2d96('0x4b')](_0x29e8dc,_0x54bd22);}function emitVoiceQueueSummary(_0x28bead){if(_0x28bead[_0x2d96('0x4c')]==='outbound'){var _0x7789fc={'id':_0x28bead['id'],'name':_0x28bead[_0x2d96('0x40')],'strategy':_0x28bead['strategy'],'answered':_0x28bead['answered'],'available':_0x28bead[_0x2d96('0x4d')],'loggedIn':_0x28bead['loggedIn'],'pTalking':_0x28bead[_0x2d96('0x4e')],'sumBillable':_0x28bead[_0x2d96('0x4f')],'sumDuration':_0x28bead['sumDuration'],'sumHoldTime':_0x28bead[_0x2d96('0x50')]||0x0,'talking':_0x28bead[_0x2d96('0x51')],'total':_0x28bead['total'],'type':_0x28bead[_0x2d96('0x4c')],'unmanaged':_0x28bead[_0x2d96('0x52')],'abandoned':_0x28bead[_0x2d96('0x53')],'waiting':_0x28bead[_0x2d96('0x54')],'loggedInDb':_0x28bead[_0x2d96('0x55')],'dialActive':_0x28bead[_0x2d96('0x56')],'dialMethod':_0x28bead[_0x2d96('0x57')],'dialOriginateCallerIdName':_0x28bead[_0x2d96('0x58')],'dialOriginateCallerIdNumber':_0x28bead[_0x2d96('0x59')],'dialOriginateTimeout':_0x28bead['dialOriginateTimeout'],'dialPrefix':_0x28bead[_0x2d96('0x5a')],'outboundAnswerAgiCallsDay':_0x28bead['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x28bead['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x28bead[_0x2d96('0x5b')],'outboundBusyCallsDay':_0x28bead[_0x2d96('0x5c')],'outboundCongestionCallsDay':_0x28bead['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x28bead[_0x2d96('0x5d')],'outboundDropCallsDayCallersExit':_0x28bead[_0x2d96('0x5e')],'outboundDropCallsDayTimeout':_0x28bead[_0x2d96('0x5f')],'outboundNoAnswerCallsDay':_0x28bead[_0x2d96('0x60')],'outboundNoSuchCallsDay':_0x28bead[_0x2d96('0x61')],'outboundOriginateFailureCallsDay':_0x28bead[_0x2d96('0x62')],'outboundReCallsDay':_0x28bead[_0x2d96('0x63')],'outboundRejectCallsDay':_0x28bead[_0x2d96('0x64')],'outboundUnknownCallsDay':_0x28bead[_0x2d96('0x65')],'predictiveIntervalAnsweredCalls':_0x28bead[_0x2d96('0x66')],'predictiveIntervalAvgHoldtime':_0x28bead[_0x2d96('0x67')],'predictiveIntervalAvgTalktime':_0x28bead[_0x2d96('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x28bead[_0x2d96('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x28bead[_0x2d96('0x6a')],'predictiveIntervalErlangCalls':_0x28bead[_0x2d96('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x28bead['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x28bead[_0x2d96('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x28bead['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x28bead[_0x2d96('0x6d')],'predictiveIntervalAvailable':_0x28bead[_0x2d96('0x6e')],'predictiveIntervalTotalCalls':_0x28bead['predictiveIntervalTotalCalls'],'message':_0x28bead['message'],'originated':_0x28bead[_0x2d96('0x6f')],'erlangCalls':_0x28bead[_0x2d96('0x70')],'erlangCallToSecond':_0x28bead['erlangCallToSecond'],'erlangAbandonmentRate':_0x28bead[_0x2d96('0x71')],'erlangBusyFactor':_0x28bead['erlangBusyFactor'],'startPredictive':_0x28bead['startPredictive'],'startProgressive':_0x28bead[_0x2d96('0x2c')]};if(_0x28bead[_0x2d96('0x72')]){_0x7789fc[_0x2d96('0x72')]={'id':_0x28bead[_0x2d96('0x72')]['id'],'name':_0x28bead['Trunk']['name'],'active':_0x28bead['Trunk'][_0x2d96('0x73')],'callerid':_0x28bead[_0x2d96('0x72')]['callerid']};}if(_0x28bead[_0x2d96('0x42')]){_0x7789fc[_0x2d96('0x42')]={'id':_0x28bead['Interval']['id'],'name':_0x28bead[_0x2d96('0x42')][_0x2d96('0x40')]};}var _0x47723e=md5(JSON[_0x2d96('0x49')](_0x7789fc));if(_0x28bead[_0x2d96('0x3')]!==_0x47723e){_0x28bead[_0x2d96('0x3')]=_0x47723e;emit(util[_0x2d96('0x74')](_0x2d96('0x75'),_0x7789fc[_0x2d96('0x40')]),_0x2d96('0x76'),_0x7789fc);}}}function emitCampaignSummary(_0x57fb31){if(_0x57fb31[_0x2d96('0x4c')]===_0x2d96('0x77')){emit(util[_0x2d96('0x74')](_0x2d96('0x78'),_0x57fb31[_0x2d96('0x40')]),_0x2d96('0x79'),_0x57fb31);}}function checkGetDataPredictive(_0x4fb18c){if(isNotNull(_0x4fb18c)){if(!_['isEmpty'](_0x4fb18c)){loggerPredictive[_0x2d96('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7b'),_0x4fb18c[_0x2d96('0x7c')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7d'),_0x4fb18c[_0x2d96('0x66')]);loggerPredictive[_0x2d96('0x7a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4fb18c[_0x2d96('0x6a')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7e'),_0x4fb18c[_0x2d96('0x69')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x7f'),_0x4fb18c[_0x2d96('0x67')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x80'),_0x4fb18c[_0x2d96('0x68')]);loggerPredictive['info'](_0x2d96('0x81'));if(_0x4fb18c[_0x2d96('0x7c')]>0x0){if(!_['isUndefined'](_0x4fb18c[_0x2d96('0x68')])&&_0x4fb18c['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x82'));}if(!_[_0x2d96('0x3c')](_0x4fb18c[_0x2d96('0x67')])&&_0x4fb18c[_0x2d96('0x67')]>0x0){return!![];}else{loggerPredictive[_0x2d96('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x83'));}}else{loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x84'));}}else{loggerPredictive['info'](_0x2d96('0x84'));}return![];}function mergeDataErlangB(_0x3ec4f5){return function(_0x6c44e8){loggerPredictive['info'](_0x2d96('0x85'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x86'),_0x6c44e8['erlangCalls']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x87'),_0x6c44e8['erlangCallToSecond']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x88'),_0x6c44e8['erlangAbandonmentRate']);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x89'),_0x6c44e8[_0x2d96('0x8a')]);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x88'),_0x6c44e8['erlangAbandonmentRate']);loggerPredictive['info'](_0x2d96('0x81'));_[_0x2d96('0x8b')](_0x3ec4f5,_0x6c44e8);};}function getDiff(_0x212597){var _0x552c47=moment()[_0x2d96('0x4a')](0x0);var _0x33ee6d=moment(_0x212597)[_0x2d96('0x4a')](0x0);return _0x552c47[_0x2d96('0x8c')](_0x33ee6d,_0x2d96('0x8d'));}function ifInterval(_0x2a692e,_0x412ffa){if(_[_0x2d96('0x3c')](_0x412ffa)){return![];}if(getDiff(_0x412ffa)<_0x2a692e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x370c58){if(isNotNull(_0x370c58)){if(!_['isUndefined'](_0x370c58['startProgressive'])){_0x370c58[_0x2d96('0x2c')]=undefined;loggerPredictive[_0x2d96('0x7a')](_0x370c58[_0x2d96('0x40')],_0x2d96('0x8e'));}if(!_[_0x2d96('0x3c')](_0x370c58[_0x2d96('0x2b')])){_0x370c58[_0x2d96('0x2b')]=undefined;loggerPredictive[_0x2d96('0x7a')](_0x370c58[_0x2d96('0x40')],_0x2d96('0x8f'));}if(!_[_0x2d96('0x3c')](_0x370c58[_0x2d96('0x90')])){clearInterval(_0x370c58[_0x2d96('0x90')]);_0x370c58[_0x2d96('0x90')]=undefined;loggerPredictive['info'](_0x370c58[_0x2d96('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4f2ef6,_0x2c0860){if(_0x2c0860===0x0){return 0x0;}var _0x2c9807=0x1;for(var _0x4b6542=0x1;_0x4b6542<=_0x2c0860;_0x4b6542+=0x1){_0x2c9807=0x1+_0x2c9807*_0x4b6542/_0x4f2ef6;}return 0x1/_0x2c9807;}function isVoiceQueueOutbound(_0x316c5d){return _0x316c5d===_0x2d96('0x91');}function isNotPreview(_0x52605d){return _0x52605d!==_0x2d96('0x23');}function isCampaignIvr(_0x5e3b38){return _0x5e3b38===_0x2d96('0x77');}function getCallerId(_0x3382ad,_0xf3340c,_0x420b6d){if(!_[_0x2d96('0x3c')](_0x420b6d)&&_0x2d96('0x92')===typeof _0x420b6d&&!_[_0x2d96('0x46')](_0x420b6d)){if(!_['isUndefined'](_0xf3340c)&&_0x2d96('0x92')===typeof _0xf3340c&&!_[_0x2d96('0x46')](_0xf3340c)){return util['format'](_0x2d96('0x93'),_0xf3340c,_0x420b6d);}return util['format']('\x22%s\x22\x20<%s>',_0x420b6d,_0x420b6d);}if(!_[_0x2d96('0x3c')](_0x3382ad)&&_0x2d96('0x92')===typeof _0x3382ad&&!_[_0x2d96('0x46')](_0x3382ad)){return _0x3382ad;}return _0x2d96('0x94');}function loggerCatchQueueSummary(_0x46e0f8,_0x5c84f7){return function(_0x3079c8){freeVariablesPredictive(_0x5c84f7);emitVoiceQueueSummary(_0x5c84f7);emitCampaignSummary(_0x5c84f7);loggerSyncQueueSummary[_0x2d96('0x95')](_0x46e0f8,util['inspect'](_0x3079c8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x238aa5,_0x43fe87){return function(_0x21e66c){loggerPredictive[_0x2d96('0x95')](_0x43fe87[_0x2d96('0x40')],_0x238aa5);loggerPredictive[_0x2d96('0x95')](_0x21e66c[_0x2d96('0x96')]);freeVariablesPredictive(_0x43fe87);};}function loggerCatch(_0x2e1eff){return function(_0x5490b9){logger[_0x2d96('0x95')](_0x2e1eff,util['inspect'](_0x5490b9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x106a48){return _0x106a48&&!_['isUndefined'](_0x106a48)&&_0x106a48[_0x2d96('0x97')]>0x0;}function decremetOriginate(_0x39d785){if(!_[_0x2d96('0x3c')](_0x39d785)&&_0x39d785!==null){if(_0x39d785['hasOwnProperty'](_0x2d96('0x6f'))){if(_0x39d785['originated']>0x0){_0x39d785['originated']-=0x1;}else{logger[_0x2d96('0x95')](_0x2d96('0x98'));}}}else{logger[_0x2d96('0x95')](_0x2d96('0x99'));}}function checkContactLowerLimitOriginate(_0x124045,_0x115efc,_0xf13a93){if(_0x115efc>_0xf13a93){for(var _0x23759d=0x0;_0x23759d<_0x115efc-_0xf13a93;_0x23759d+=0x1){decremetOriginate(_0x124045);}}}function loggerGetContactDialer(_0x249787,_0x22ad71,_0x12822f){return function(_0x5c7db8){checkContactLowerLimitOriginate(_0x22ad71,_0x12822f,0x0);logger['error'](_0x249787,util[_0x2d96('0x9a')](_0x5c7db8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x335fdf){return function(_0x434481){if(isNotNull(_0x434481)&&isNotNull(_0x434481[0x0])){if(_0x434481[0x0]['contactsRescheduled']>0x0){_0x335fdf[_0x2d96('0x3e')]=_0x2d96('0x9b');logger[_0x2d96('0x7a')](_0x2d96('0x9c')+_0x335fdf[_0x2d96('0x40')],_0x434481[0x0][_0x2d96('0x9d')],_0x2d96('0x9e'));}else{_0x335fdf['message']=_0x2d96('0x9f');logger[_0x2d96('0x7a')](_0x2d96('0xa0')+_0x335fdf[_0x2d96('0x40')]);}}};}function notSendMessagesQueue(_0x210b72){if(_0x210b72['sendMessageOneNotActive']){freeVariablesPredictive(_0x210b72);if(_0x210b72['originated']===0x0&&_0x210b72[_0x2d96('0x51')]===0x0&&_0x210b72[_0x2d96('0x54')]===0x0&&(_0x210b72['pTalking']||0x0)===0x0){_0x210b72[_0x2d96('0xa1')]=![];_0x210b72[_0x2d96('0x4d')]=0x0;_0x210b72[_0x2d96('0x3e')]=_0x2d96('0x3f');loggerSyncQueueSummary['error'](_0x2d96('0xa2'),_0x210b72[_0x2d96('0x40')],'is\x20not\x20active');}else{_0x210b72[_0x2d96('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x2d96('0xa2'),_0x210b72[_0x2d96('0x40')],'is\x20disactive');}emitVoiceQueueSummary(_0x210b72);}}function notSendMessagesCampaign(_0x1cb26d){if(_0x1cb26d[_0x2d96('0xa1')]){if(_0x1cb26d[_0x2d96('0x6f')]===0x0){_0x1cb26d['sendMessageOneNotActive']=![];_0x1cb26d[_0x2d96('0x3e')]=_0x2d96('0x3f');loggerSyncQueueSummary[_0x2d96('0x95')](_0x2d96('0xa3'),_0x1cb26d[_0x2d96('0x40')],_0x2d96('0xa4'));}else{_0x1cb26d['message']=_0x2d96('0xa5');loggerSyncQueueSummary['error'](_0x2d96('0xa3'),_0x1cb26d[_0x2d96('0x40')],_0x2d96('0xa6'));}emitCampaignSummary(_0x1cb26d);}}function createObjHistory(_0x21c669,_0xe5af73,_0x595e1f,_0x20b7e6,_0x56a695){_0x21c669[_0x2d96('0x3e')]=_0x595e1f;var _0x2e5eb3=new Action(_0x21c669,_0xe5af73);var _0x50b2b6=new History(_0x2e5eb3);_0x50b2b6[_0x2d96('0xa7')]=_0x20b7e6;_0x50b2b6[_0x2d96('0xa8')]=_0x56a695;_0x50b2b6[_0x2d96('0xa9')]=_0x2e5eb3[_0x2d96('0xaa')];return _0x50b2b6;}Dialer['prototype'][_0x2d96('0x3b')]=function(){var _0x12204c=this;setInterval(function(){_0x12204c['clearZombieChannels'](_0x12204c[_0x2d96('0x29')],_0x2d96('0xab'));_0x12204c[_0x2d96('0xac')](_0x12204c[_0x2d96('0xad')],_0x2d96('0xae'));},0x32c8);};Dialer['prototype'][_0x2d96('0xac')]=function(_0x42f514,_0x11dfcf){var _0x5284d8=this;for(var _0x5ddbdb in _0x42f514){if(_0x42f514[_0x2d96('0xaf')](_0x5ddbdb)){this[_0x2d96('0x22')][_0x2d96('0x20')](function(){if(!_['isNil'](_0x42f514[_0x5ddbdb])){return ami[_0x2d96('0xb0')]({'action':_0x2d96('0xb1'),'channel':_0x42f514[_0x5ddbdb]['channel']})['catch'](function(_0x29cd4d){if(_0x29cd4d['message']===_0x2d96('0xb2')){setTimeout(function(){if(_0x42f514[_0x5ddbdb]&&_0x42f514[_0x5ddbdb][_0x2d96('0x4c')]!==_0x2d96('0x77')){_0x5284d8['updateOriginated'](_0x5284d8[_0x2d96('0x24')][_0x42f514[_0x5ddbdb][_0x2d96('0xb3')]]);logger['error'](_0x2d96('0xb4'),_0x11dfcf,_0x5ddbdb,_0x42f514[_0x5ddbdb][_0x2d96('0xb3')]);delete _0x42f514[_0x5ddbdb];}if(_0x42f514[_0x5ddbdb]&&_0x42f514[_0x5ddbdb][_0x2d96('0x4c')]===_0x2d96('0x77')){_0x5284d8['updateOriginated'](_0x5284d8['campaigns'][_0x42f514[_0x5ddbdb]['queue']]);logger[_0x2d96('0x95')](_0x2d96('0xb5'),_0x11dfcf,_0x5ddbdb,_0x42f514[_0x5ddbdb]['queue']);delete _0x42f514[_0x5ddbdb];}},0x2328);}});}});}}};Dialer['prototype'][_0x2d96('0xb6')]=function(_0x53a0c3){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xb6')](_0x53a0c3))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xba')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xbc')]=function(_0x3ac2ef){return BPromise[_0x2d96('0xb7')]()['then'](cmHopperBlack[_0x2d96('0xbc')](_0x3ac2ef))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xbd')));};Dialer['prototype'][_0x2d96('0xbe')]=function(_0x36e265){return BPromise['resolve']()['then'](cmHopperBlack[_0x2d96('0xbe')](_0x36e265))['catch'](loggerCatch(_0x2d96('0xbf')));};Dialer['prototype']['averageHandleTime']=function(_0x482780){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopperHistory[_0x2d96('0xc0')](_0x482780))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x2d96('0xc1')]=function(_0x35ed9f){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc1')](_0x35ed9f))[_0x2d96('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x2d96('0xc2')]=function(_0x2c5e9a,_0x50e316,_0x523670){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc2')](_0x2c5e9a,_0x50e316,_0x523670))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc3')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc4')]=function(_0x33dee8,_0x3bdb79,_0x2af692,_0x2918b6){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc4')](_0x33dee8,_0x3bdb79,_0x2af692,_0x2918b6))[_0x2d96('0xb9')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc5')]=function(_0x149726,_0x51d340,_0x510271){return BPromise['resolve']()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc5')](_0x149726,_0x51d340,_0x510271))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc6')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc7')]=function(_0x79bded){return BPromise['resolve']()[_0x2d96('0xb8')](voiceQueueRt[_0x2d96('0xc7')](_0x79bded))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xc8')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xc9')]=function(_0x10423e){return BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](cmHopper[_0x2d96('0xc9')](_0x10423e))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xca')));};Dialer[_0x2d96('0xbb')][_0x2d96('0xcb')]=function(_0x13108b){return BPromise['resolve']()[_0x2d96('0xb8')](cmHopperHistory['createHistory'](_0x13108b))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xcc')));};Dialer['prototype'][_0x2d96('0xcd')]=function(_0x17a08b){if(!_[_0x2d96('0x3c')](_0x17a08b)&&_0x17a08b!==null){if(_0x17a08b[_0x2d96('0xaf')](_0x2d96('0x6f'))){if(_0x17a08b['originated']>0x0){_0x17a08b[_0x2d96('0x6f')]-=0x1;}else{logger['error'](_0x2d96('0xce'));}}}else{logger[_0x2d96('0x95')](_0x2d96('0xcf'));}};Dialer['prototype'][_0x2d96('0xd0')]=function(_0x5c2f9a,_0x277370){var _0x21d6a2=this;return function(_0x1185bb){_0x21d6a2[_0x2d96('0xcd')](_0x277370);logger[_0x2d96('0x95')](_0x5c2f9a,util[_0x2d96('0x9a')](_0x1185bb,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x2d96('0xd1')]=function(_0x1b7038,_0x5e8a34,_0xd8ecaa){var _0x61a796={'state':0x19,'statedesc':_0x2d96('0xd2')};this[_0x2d96('0xcd')](_0x5e8a34);this['saveInDb'](_['merge'](_0x61a796,_['pick'](_0xd8ecaa,['ContactId',_0x2d96('0xd3'),'UserId','VoiceQueueId','CampaignId'])),_0x2d96('0xd4'),'[emptyContact]');logger[_0x2d96('0x95')](_0x1b7038);};Dialer[_0x2d96('0xbb')][_0x2d96('0xd5')]=function(_0x409622){return _0x409622===_0x2d96('0xd6');};Dialer[_0x2d96('0xbb')][_0x2d96('0xd7')]=function(_0x3d4d84){return!_[_0x2d96('0x3c')](_0x3d4d84)&&_0x3d4d84&&!_['isUndefined'](_0x3d4d84[_0x2d96('0x40')])&&!_[_0x2d96('0x3c')](_0x3d4d84[_0x2d96('0x73')])&&_0x3d4d84[_0x2d96('0x73')]&&(this[_0x2d96('0x26')][util[_0x2d96('0x74')](_0x2d96('0xd8'),_0x3d4d84[_0x2d96('0x40')])]['status']===_0x2d96('0xd9')||this[_0x2d96('0x26')][util['format']('SIP/%s',_0x3d4d84['name'])][_0x2d96('0xb1')]===_0x2d96('0xda'));};Dialer[_0x2d96('0xbb')][_0x2d96('0xdb')]=function(_0x3882e0,_0x13c75d,_0x10c320){this[_0x2d96('0xcb')](_0x3882e0)[_0x2d96('0xb9')](loggerCatch(_0x13c75d));this[_0x2d96('0xc9')](_0x3882e0)['catch'](loggerCatch(_0x10c320));};Dialer[_0x2d96('0xbb')][_0x2d96('0x37')]=function(_0x349743){var _0x30920c=this[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];var _0x379f3b;if(!_[_0x2d96('0xdd')](_0x349743)&&!_['isNil'](_0x349743[_0x2d96('0xde')])&&!_[_0x2d96('0xdd')](_0x349743[_0x2d96('0xde')]['amdstatus'])&&_0x349743[_0x2d96('0xdf')]==='xcally-motion-dialer'&&_0x30920c){if(_0x30920c['type']!==_0x2d96('0x77')&&this['voiceQueues'][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe0')]&&_0x349743[_0x2d96('0xe1')]==='HANGUP'){delete this['uniqueId'][_0x349743[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]);this[_0x2d96('0x24')][_0x30920c['queue']][_0x2d96('0xe2')]+=0x1;this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x379f3b=new Hangup(_0x30920c,_0x349743);_0x379f3b[_0x2d96('0xa7')]=0x12;_0x379f3b[_0x2d96('0xa8')]=_0x2d96('0xe3');_0x379f3b[_0x2d96('0xe4')]='AMD';this[_0x2d96('0xdb')](_0x379f3b,'[syncHangupInAMD][createHistory]',_0x2d96('0xe5'));}if(_0x30920c[_0x2d96('0x4c')]!==_0x2d96('0x77')&&this[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe0')]&&_0x349743[_0x2d96('0xe1')]===_0x2d96('0xe6')){var _0x5ef4e8=this;return new BPromise(function(_0x47f278,_0x475f79){delete _0x5ef4e8[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];_0x5ef4e8[_0x2d96('0xcd')](_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]);_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe7')]+=0x1;var _0x576e22=_0x5ef4e8[_0x2d96('0x24')][_0x30920c[_0x2d96('0xb3')]];var _0x8ea134=new Hangup(_0x30920c,_0x349743);_0x8ea134[_0x2d96('0xa7')]=0x13;_0x8ea134[_0x2d96('0xa8')]='Machine';_0x8ea134[_0x2d96('0xe4')]=_0x2d96('0xe8');_0x8ea134['countmachineretry']+=0x1;_0x8ea134['countglobal']+=0x1;_0x8ea134['amd']=!![];_0x5ef4e8['createHistory'](_0x8ea134)[_0x2d96('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x8ea134[_0x2d96('0xe9')]+_0x8ea134[_0x2d96('0xea')]+_0x8ea134[_0x2d96('0xeb')]+_0x8ea134[_0x2d96('0xec')]+_0x8ea134[_0x2d96('0xed')]+_0x8ea134['countabandonedretry']+_0x8ea134[_0x2d96('0xee')]+_0x8ea134[_0x2d96('0xef')]>=_0x576e22[_0x2d96('0xf0')]){_0x5ef4e8[_0x2d96('0xf1')](_0x8ea134,_0x47f278,_0x475f79,_0x2d96('0xf2'));}else{if(_0x8ea134[_0x2d96('0xee')]>=_0x576e22[_0x2d96('0xf3')]){_0x5ef4e8[_0x2d96('0xf4')](_0x8ea134,_0x47f278,_0x475f79,'reason\x2019\x20machine....');}else{_0x5ef4e8[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x8ea134[_0x2d96('0xee')],'scheduledat':moment()[_0x2d96('0xf5')](_0x576e22[_0x2d96('0xf6')],_0x2d96('0xf7'))['format'](_0x2d96('0xf8')),'ContactId':_0x8ea134[_0x2d96('0xf9')],'ListId':_0x8ea134[_0x2d96('0xd3')],'VoiceQueueId':_0x8ea134[_0x2d96('0xfa')]||undefined,'CampaignId':_0x8ea134[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xfc')));_0x47f278({'reschedule':0x1});}}});}if(_0x30920c['type']===_0x2d96('0x77')&&this[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]]['dialAMDActive']&&_0x349743[_0x2d96('0xe1')]==='HANGUP'){delete this[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]]);_0x379f3b=new Hangup(_0x30920c,_0x349743);_0x379f3b[_0x2d96('0xa7')]=0x12;_0x379f3b[_0x2d96('0xa8')]='HangupInAMD';_0x379f3b['membername']=_0x2d96('0xe8');this['saveInDb'](_0x379f3b,_0x2d96('0xfe'),'[syncHangupInAMDIvr]');}if(_0x30920c[_0x2d96('0x4c')]===_0x2d96('0x77')&&this['campaigns'][_0x30920c[_0x2d96('0xb3')]]['dialAMDActive']&&_0x349743[_0x2d96('0xe1')]==='MACHINE'){var _0x5ef4e8=this;return new BPromise(function(_0xa3ac3a,_0x4a10b1){delete _0x5ef4e8[_0x2d96('0x29')][_0x349743[_0x2d96('0xdc')]];_0x5ef4e8[_0x2d96('0xcd')](_0x5ef4e8['campaigns'][_0x30920c[_0x2d96('0xb3')]]);_0x5ef4e8[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe2')]+=0x1;_0x5ef4e8[_0x2d96('0xfd')][_0x30920c[_0x2d96('0xb3')]][_0x2d96('0xe7')]+=0x1;var _0x1f489a=_0x5ef4e8['campaigns'][_0x30920c[_0x2d96('0xb3')]];var _0x1db6fa=new Hangup(_0x30920c,_0x349743);_0x1db6fa[_0x2d96('0xa7')]=0x13;_0x1db6fa['statedesc']=_0x2d96('0xff');_0x1db6fa[_0x2d96('0xe4')]=_0x2d96('0xe8');_0x1db6fa[_0x2d96('0xee')]+=0x1;_0x1db6fa[_0x2d96('0x100')]+=0x1;_0x1db6fa[_0x2d96('0x101')]=!![];_0x5ef4e8[_0x2d96('0xcb')](_0x1db6fa)[_0x2d96('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1db6fa[_0x2d96('0xe9')]+_0x1db6fa['countcongestionretry']+_0x1db6fa[_0x2d96('0xeb')]+_0x1db6fa['countnosuchnumberretry']+_0x1db6fa[_0x2d96('0xed')]+_0x1db6fa[_0x2d96('0x102')]+_0x1db6fa[_0x2d96('0xee')]+_0x1db6fa[_0x2d96('0xef')]>=_0x1f489a[_0x2d96('0xf0')]){_0x5ef4e8['stateGlobal'](_0x1db6fa,_0xa3ac3a,_0x4a10b1,_0x2d96('0xf2'));}else{if(_0x1db6fa[_0x2d96('0xee')]>=_0x1f489a[_0x2d96('0xf3')]){_0x5ef4e8[_0x2d96('0xf4')](_0x1db6fa,_0xa3ac3a,_0x4a10b1,_0x2d96('0x103'));}else{_0x5ef4e8[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x1db6fa[_0x2d96('0xee')],'scheduledat':moment()[_0x2d96('0xf5')](_0x1f489a['dialMachineRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1db6fa['ContactId'],'ListId':_0x1db6fa['ListId'],'VoiceQueueId':_0x1db6fa[_0x2d96('0xfa')]||undefined,'CampaignId':_0x1db6fa[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xfc')));_0xa3ac3a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2d96('0x34')]=function(_0x2eb7a7){var _0x16e544=this[_0x2d96('0x29')][_0x2eb7a7['uniqueid']];var _0x14ddce=this;var _0x46c845;if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]===_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x2eb7a7['uniqueid']];this[_0x2d96('0xcd')](this['campaigns'][_0x16e544[_0x2d96('0xb3')]]);this['campaigns'][_0x16e544[_0x2d96('0xb3')]][_0x2d96('0x104')]+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);this['createHistory'](_0x46c845)[_0x2d96('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]!==_0x2d96('0x77')&&isNotNull(this[_0x2d96('0x24')][_0x16e544['queue']]['dialQueueProject'])){delete this[_0x2d96('0x29')][_0x2eb7a7[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this['voiceQueues'][_0x16e544[_0x2d96('0xb3')]]);this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);_0x46c845['state']=0x10;_0x46c845[_0x2d96('0xa8')]=_0x2d96('0x106');_0x46c845[_0x2d96('0xe4')]=_0x2d96('0x107');this[_0x2d96('0xcb')](_0x46c845)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}if(_0x16e544&&_0x16e544[_0x2d96('0x4c')]!==_0x2d96('0x77')&&!isNotNull(this[_0x2d96('0x24')][_0x16e544['queue']][_0x2d96('0x108')])){delete this[_0x2d96('0x29')][_0x2eb7a7[_0x2d96('0xdc')]];this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x16e544[_0x2d96('0xb3')]]);this['voiceQueues'][_0x16e544[_0x2d96('0xb3')]][_0x2d96('0x65')]+=0x1;_0x46c845=new Hangup(_0x16e544,_0x2eb7a7);_0x46c845[_0x2d96('0xa7')]=0xc;_0x46c845[_0x2d96('0xa8')]=_0x2eb7a7[_0x2d96('0x109')];_0x46c845[_0x2d96('0xe4')]=_0x2d96('0x10a');this[_0x2d96('0xcb')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10b')));this[_0x2d96('0xc9')](_0x46c845)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x105')));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x10c')]=function(_0x8ce950){var _0xd3e78a=this[_0x2d96('0x29')][_0x8ce950[_0x2d96('0xdc')]];var _0x39e7ac=this;if(this[_0x2d96('0x24')][_0x8ce950['queue']]){if(_0xd3e78a&&_0xd3e78a['type']!==_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x8ce950['uniqueid']];this['voiceQueues'][_0x8ce950['queue']][_0x2d96('0xe2')]+=0x1;var _0xba0104=new AgentComplete(_0xd3e78a,_0x8ce950);if(_0x8ce950[_0x2d96('0x10d')]==='agent'){_0xba0104['agiafterat']=this['voiceQueues'][_0x8ce950[_0x2d96('0xb3')]]['dialQueueProject2']&&this['voiceQueues'][_0x8ce950[_0x2d96('0xb3')]][_0x2d96('0x10e')]?moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2d96('0xcb')](_0xba0104)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10f')));this[_0x2d96('0xc9')](_0xba0104)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x2d96('0xbb')]['syncAgentConnect']=function(_0x26a3c8){if(this['voiceQueues'][_0x26a3c8['queue']]){if(this[_0x2d96('0x29')][_0x26a3c8['uniqueid']]&&this[_0x2d96('0x29')][_0x26a3c8[_0x2d96('0xdc')]][_0x2d96('0x4c')]!==_0x2d96('0x77')){this[_0x2d96('0xcd')](this[_0x2d96('0x24')][_0x26a3c8[_0x2d96('0xb3')]]);this[_0x2d96('0x29')][_0x26a3c8[_0x2d96('0xdc')]][_0x2d96('0x110')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));}}};Dialer[_0x2d96('0xbb')][_0x2d96('0x111')]=function(_0xb8a891){this[_0x2d96('0xcb')](_0xb8a891)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x10f')));this['moveContactManagedDialer'](_0xb8a891)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x112')));};Dialer[_0x2d96('0xbb')]['syncQueueCallerAbandon']=function(_0x336206){var _0x4e127=this[_0x2d96('0x29')][_0x336206[_0x2d96('0xdc')]];var _0x475ba0=this;if(this['voiceQueues'][_0x336206[_0x2d96('0xb3')]]){if(_0x4e127&&_0x4e127[_0x2d96('0x4c')]!==_0x2d96('0x77')){delete this[_0x2d96('0x29')][_0x336206['uniqueid']];this['updateOriginated'](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]);_0x4e127['droptime']=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));var _0x1dc8bf=new QueueCallerAbandon(_0x4e127,_0x336206);if(getSeconds(_0x4e127[_0x2d96('0x113')],_0x4e127[_0x2d96('0x114')])>=_0x4e127[_0x2d96('0x115')]){this['voiceQueues'][_0x336206[_0x2d96('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x5f')]+=0x1;this[_0x2d96('0x24')][_0x336206['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x1dc8bf[_0x2d96('0xa7')]=0xa;_0x1dc8bf[_0x2d96('0xa8')]=_0x2d96('0x116');_0x1dc8bf[_0x2d96('0x117')]='TIMEOUT';_0x1dc8bf[_0x2d96('0x118')]=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]['dialQueueProject2']?moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1dc8bf['countdropretry']+=0x1;_0x1dc8bf[_0x2d96('0x100')]+=0x1;if(_0x1dc8bf[_0x2d96('0xed')]>=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x119')]){this['queueCallerAbandonCreateState'](_0x1dc8bf);}else{this[_0x2d96('0xc1')]({'active':![],'countdropretry':_0x1dc8bf[_0x2d96('0xed')],'scheduledat':moment()[_0x2d96('0xf5')](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]]['dialDropRetryFrequency'],'minutes')['format'](_0x2d96('0xf8')),'ContactId':_0x4e127[_0x2d96('0xf9')],'ListId':_0x4e127[_0x2d96('0xd3')],'VoiceQueueId':_0x4e127[_0x2d96('0xfa')]||undefined,'CampaignId':_0x4e127[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11a')));var _0x1dfd1a=new History(_0x1dc8bf);_0x1dfd1a[_0x2d96('0xa7')]=0xa;_0x1dfd1a[_0x2d96('0xa8')]=_0x2d96('0x116');_0x1dfd1a[_0x2d96('0xaa')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));_0x1dfd1a[_0x2d96('0xa9')]=_0x1dfd1a[_0x2d96('0xaa')];_0x1dfd1a[_0x2d96('0x11b')]=_0x1dc8bf[_0x2d96('0x11b')];_0x1dfd1a['calleridnum']=_0x1dc8bf['calleridnum'];this[_0x2d96('0xcb')](_0x1dfd1a)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11c')));}}else{this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x69')]+=0x1;this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x5e')]+=0x1;_0x1dc8bf[_0x2d96('0xa7')]=0xb;_0x1dc8bf[_0x2d96('0xa8')]='Abandoned';_0x1dc8bf[_0x2d96('0x117')]=_0x2d96('0x11d');_0x1dc8bf[_0x2d96('0x102')]+=0x1;_0x1dc8bf['countglobal']+=0x1;if(_0x1dc8bf[_0x2d96('0x102')]>=this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x11e')]){this[_0x2d96('0x111')](_0x1dc8bf);}else{this[_0x2d96('0xc1')]({'active':![],'countabandonedretry':_0x1dc8bf[_0x2d96('0x102')],'scheduledat':moment()[_0x2d96('0xf5')](this[_0x2d96('0x24')][_0x336206[_0x2d96('0xb3')]][_0x2d96('0x11f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x4e127[_0x2d96('0xf9')],'ListId':_0x4e127[_0x2d96('0xd3')],'VoiceQueueId':_0x4e127[_0x2d96('0xfa')]||undefined,'CampaignId':_0x4e127[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x120')));var _0x1dfd1a=new History(_0x1dc8bf);_0x1dfd1a[_0x2d96('0xa7')]=0xb;_0x1dfd1a['statedesc']=_0x2d96('0x121');_0x1dfd1a[_0x2d96('0xaa')]=moment()[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss');_0x1dfd1a[_0x2d96('0xa9')]=_0x1dfd1a['starttime'];_0x1dfd1a['calleridname']=_0x1dc8bf[_0x2d96('0x11b')];_0x1dfd1a[_0x2d96('0x122')]=_0x1dc8bf['calleridnum'];this['createHistory'](_0x1dfd1a)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0x2d96('0x35')]=function(_0xba199){if(this[_0x2d96('0xad')][_0xba199[_0x2d96('0xdc')]]){this['actions'][_0xba199[_0x2d96('0xdc')]][_0x2d96('0x123')]=_0xba199[_0x2d96('0x123')];}if(this['uniqueId'][_0xba199[_0x2d96('0xdc')]]){this[_0x2d96('0x29')][_0xba199[_0x2d96('0xdc')]][_0x2d96('0x123')]=_0xba199['channel'];}};Dialer[_0x2d96('0xbb')][_0x2d96('0x124')]=function(_0x1ab5e6){if(strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]===_0x2d96('0x1f')){if(this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]]&&_[_0x2d96('0xdd')](this['actions'][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0x127')])&&_0x1ab5e6[_0x2d96('0xb1')]==='1'&&_0x1ab5e6['paused']==='0'){if(this['agents'][_0x1ab5e6[_0x2d96('0x128')]]){if(!this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]['locked']){this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]['locked']=!![];this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0x127')]=!![];this['actions'][_0x1ab5e6['actionid']][_0x2d96('0x128')]=_0x1ab5e6[_0x2d96('0x128')];}}}}else if((strategy[this['voiceQueues'][this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0xb3')]][_0x2d96('0x126')]]||_0x2d96('0x1e'))===_0x2d96('0x1e')){if(this['actions'][_0x1ab5e6[_0x2d96('0x125')]]){if(this[_0x2d96('0x25')][_0x1ab5e6[_0x2d96('0x128')]]){this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0x128')]=_0x1ab5e6['stateinterface'];if(_[_0x2d96('0xdd')](this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x1ab5e6['actionid']][_0x2d96('0xb3')]])){this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x1ab5e6[_0x2d96('0x125')]]['queue']]=[];}this[_0x2d96('0x2e')][this['actions'][_0x1ab5e6[_0x2d96('0x125')]][_0x2d96('0xb3')]]['push'](_['merge'](_[_0x2d96('0x129')](this['actions'][_0x1ab5e6['actionid']],[_0x2d96('0x12a'),_0x2d96('0x128')]),{'status':_0x1ab5e6[_0x2d96('0xb1')],'paused':_0x1ab5e6[_0x2d96('0x12b')]}));}}}};function unlockQueueStatus(_0xbfa8d8,_0x577437){setTimeout(function(){if(_[_0x2d96('0x3c')](_0xbfa8d8[_0x2d96('0x12c')])){loggerBooked[_0x2d96('0x95')](_0x2d96('0x12d'),_0x577437);}_0xbfa8d8['queueStatusComplete']=!![];loggerBooked[_0x2d96('0x7a')]('[booked][unlockQueueStatus]',_0x577437,JSON['stringify'](_[_0x2d96('0x129')](_0xbfa8d8,[_0x2d96('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x2d96('0xbb')][_0x2d96('0x12e')]=function(_0x520fc6){var _0x21c6d2=this;var _0x3f241f=_0x21c6d2[_0x2d96('0x24')][_0x21c6d2['actions'][_0x520fc6[_0x2d96('0x125')]]['queue']];if(strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]===_0x2d96('0x1f')){if(this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]&&this['actions'][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')]){this[_0x2d96('0x23')][_0x2d96('0x12f')](this['actions'][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x12a')],this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')])[_0x2d96('0xb9')](function(_0x49b04a){logger['error'](_0x2d96('0x130'),util['inspect'](_0x49b04a,{'showHidden':![],'depth':null}));})[_0x2d96('0x131')](function(){_0x21c6d2[_0x2d96('0xcd')](_0x21c6d2['voiceQueues'][_0x21c6d2[_0x2d96('0xad')][_0x520fc6['actionid']][_0x2d96('0xb3')]]);_0x21c6d2['agents'][_0x21c6d2[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0x128')]][_0x2d96('0x127')]=![];delete _0x21c6d2['actions'][_0x520fc6[_0x2d96('0x125')]];unlockQueueStatus(_0x3f241f);});}else{this[_0x2d96('0xcd')](this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']]);this[_0x2d96('0xc1')]({'active':![],'ContactId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xf9')],'ListId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['ListId'],'VoiceQueueId':this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xfa')]||undefined,'CampaignId':this[_0x2d96('0xad')][_0x520fc6['actionid']][_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x2d96('0xad')][_0x520fc6['actionid']];unlockQueueStatus(_0x3f241f);}}else if((strategy[this[_0x2d96('0x24')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]][_0x2d96('0x126')]]||_0x2d96('0x1e'))===_0x2d96('0x1e')){var _0x251b6d;if(this[_0x2d96('0xad')][_0x520fc6['actionid']]&&!_[_0x2d96('0x46')](this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]])){if(this[_0x2d96('0x132')][_0x21c6d2['actions'][_0x520fc6['actionid']][_0x2d96('0xb3')]]){this[_0x2d96('0x132')][_0x21c6d2[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]]=this['queueBookedRR'][this['actions'][_0x520fc6[_0x2d96('0x125')]]['queue']]?this[_0x2d96('0x132')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]]:this[_0x2d96('0x2e')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']]?this['queueBooked'][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']][_0x2d96('0x133')]||0x0:0x0;}this['queueBooked'][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]]['queue']][_0x2d96('0x133')]=this[_0x2d96('0x132')][this[_0x2d96('0xad')][_0x520fc6[_0x2d96('0x125')]][_0x2d96('0xb3')]];for(var _0x270914=0x0;_0x270914=0x0?!![]:![];})[_0x2d96('0xb9')](myreject(_0x5d32ec)));}}else{_0x321106['push'](ami[_0x2d96('0xb0')]({'action':_0x2d96('0x147'),'command':util[_0x2d96('0x74')](_0x2d96('0x14a'),_0x1e22b4,!_['isUndefined'](config['timezones'][_0x26fe57])?_0x26fe57:'')})[_0x2d96('0xb8')](function(_0x2daadf){return _0x2daadf[_0x2d96('0x148')]['indexOf']('true')>=0x0?!![]:![];})[_0x2d96('0xb9')](myreject(_0x5d32ec)));}BPromise[_0x2d96('0x14b')](_0x321106)[_0x2d96('0xb8')](function(_0x243b8c){var _0x3fefbe=_[_0x2d96('0x14c')](_0x243b8c);if(_0x3fefbe){return _0x4a2d33(_0x3fefbe);}else{_0x100f43[_0x2d96('0x3e')]=_0x4f64ba?_0x2d96('0x14d'):_0x2d96('0x14e');return _0x5d32ec(msgResponse('[ifTime][promiseAll]',_0x2d96('0x13e'),_0x2d96('0x14f')+_0x4f64ba+'\x20'+_0x34bdd1+_0x2d96('0x150')+util[_0x2d96('0x9a')](_0x1e22b4,{'showHidden':![],'depth':null})+_0x2d96('0x151')+_0x26fe57));}})[_0x2d96('0xb9')](function(_0x2faa37){return _0x5d32ec(msgResponse(_0x2d96('0x13d'),_0x2d96('0x13e'),JSON[_0x2d96('0x49')](_0x2faa37)));});});};Dialer[_0x2d96('0xbb')]['checkDialMethod']=function(_0x4c26bd){var _0x2a75d1=this;return function(){switch(_0x4c26bd['dialMethod']){case'progressive':freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,0x1);break;case _0x2d96('0x153'):freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,_0x4c26bd[_0x2d96('0x154')]);break;case'predictive':_0x2a75d1[_0x2d96('0xa')](_0x4c26bd);break;case _0x2d96('0x9'):freeVariablesPredictive(_0x4c26bd);_0x2a75d1[_0x2d96('0x152')](_0x4c26bd,0x1);break;default:freeVariablesPredictive(_0x4c26bd);logger[_0x2d96('0x95')](_0x2d96('0x155'),_0x4c26bd[_0x2d96('0x40')],_0x2d96('0x156'));}};};Dialer[_0x2d96('0xbb')][_0x2d96('0x157')]=function(_0xd91994){var _0x3a442d=this;return function(){_0x3a442d[_0x2d96('0x158')](_0xd91994);};};Dialer[_0x2d96('0xbb')][_0x2d96('0xc')]=function(_0x4b83d2){var _0x3630e5=this;if(isNotPreview(_0x4b83d2[_0x2d96('0x57')])){if(isVoiceQueueOutbound(_0x4b83d2[_0x2d96('0x4c')])&&isActive(_0x4b83d2[_0x2d96('0x56')])){_0x4b83d2['sendMessageOneNotActive']=!![];BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](checkIsLoggedIn(_0x4b83d2,_0x4b83d2[_0x2d96('0x159')]))[_0x2d96('0xb8')](checkIsActive(_0x4b83d2,_0x4b83d2['dialActive']))[_0x2d96('0xb8')](checkInterval(_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x15a')](_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5['checkIfTime'](_0x4b83d2['dialGlobalInterval'],_0x4b83d2[_0x2d96('0x15b')],_0x4b83d2[_0x2d96('0x40')],_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x13c')](_0x4b83d2[_0x2d96('0x42')],_0x4b83d2['dialTimezone'],_0x4b83d2[_0x2d96('0x40')],_0x4b83d2))[_0x2d96('0xb8')](_0x3630e5[_0x2d96('0x15c')](_0x4b83d2))[_0x2d96('0xb9')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4b83d2));}else{notSendMessagesQueue(_0x4b83d2);}}else{freeVariablesPredictive(_0x4b83d2);}};Dialer[_0x2d96('0xbb')][_0x2d96('0x138')]=function(){var _0x2e51eb=this;var _0x4069eb;for(var _0x4f7e42 in this['campaigns']){if(this[_0x2d96('0xfd')]['hasOwnProperty'](_0x4f7e42)){_0x4069eb=this[_0x2d96('0xfd')][_0x4f7e42];if(isCampaignIvr(_0x4069eb[_0x2d96('0x4c')])&&isActive(_0x4069eb[_0x2d96('0x73')])){_0x4069eb[_0x2d96('0xa1')]=!![];BPromise[_0x2d96('0xb7')]()[_0x2d96('0xb8')](checkIsActive(_0x4069eb,_0x4069eb[_0x2d96('0x73')]))[_0x2d96('0xb8')](checkInterval(_0x4069eb))['then'](_0x2e51eb[_0x2d96('0x15a')](_0x4069eb))[_0x2d96('0xb8')](_0x2e51eb[_0x2d96('0x13b')](_0x4069eb['dialGlobalInterval'],_0x4069eb[_0x2d96('0x15b')],_0x4069eb[_0x2d96('0x40')],_0x4069eb))[_0x2d96('0xb8')](_0x2e51eb[_0x2d96('0x13c')](_0x4069eb['Interval'],_0x4069eb['dialTimezone'],_0x4069eb[_0x2d96('0x40')],_0x4069eb))['then'](_0x2e51eb[_0x2d96('0x157')](_0x4069eb))[_0x2d96('0xb9')](loggerCatchQueueSummary(_0x2d96('0x15d'),_0x4069eb));}else{notSendMessagesCampaign(_0x4069eb);}}}};function getCallerIdRandom(_0x153dbc,_0x5b4968){var _0x3b492e,_0x223a6c,_0x123cd;if(_0x5b4968<=0x0){_0x5b4968=0x1;}_0x3b492e=new RegExp(_0x2d96('0x15e')+_0x5b4968+'}$');_0x223a6c=Math[_0x2d96('0x15f')](0xa,_0x5b4968-0x1);_0x123cd=Math[_0x2d96('0x15f')](0xa,_0x5b4968)-0x1;return util[_0x2d96('0x74')]('%s',_['replace'](_0x153dbc,_0x3b492e,_[_0x2d96('0x160')](_0x223a6c,_0x123cd)));}function extractCalleridName(_0x21baa9){var _0x4b2689=_0x21baa9[_0x2d96('0x161')](/"(.*?)"/);return _0x4b2689?_0x4b2689[0x1]:_0x21baa9;}function extractCalleridNumber(_0x472d98){var _0x460840=_0x472d98[_0x2d96('0x161')](/<(.*?)>/);return _0x460840?_0x460840[0x1]:_0x472d98;}Dialer['prototype'][_0x2d96('0x162')]=function(_0x901549,_0x4d806c){var _0x587f73=this;var _0x4fe087=uuid['v4']();this[_0x2d96('0xad')][_0x4fe087]=new Action(_0x901549,_0x4d806c,_0x4fe087);return new BPromise(function(_0x3d4253,_0x28a3f1){if(_[_0x2d96('0x3c')](_0x901549)&&_0x2d96('0x163')!==typeof _0x901549){return _0x28a3f1(msgResponse(_0x2d96('0x164'),_0x2d96('0x13e'),_0x2d96('0x165')));}if(_[_0x2d96('0x3c')](_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')])||_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')]===null){return _0x28a3f1(msgResponse(_0x2d96('0x164'),_0x2d96('0x13e'),_0x2d96('0x168')));}var _0x52ac0d={'XMD-CALLERID':_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x169')](),'XMD-AGI':_0x901549[_0x2d96('0x108')]?util[_0x2d96('0x74')](_0x2d96('0x16a'),ipAgi,_0x901549[_0x2d96('0x108')]):_0x2d96('0x16b'),'XMD-AGIAFTER':_0x901549[_0x2d96('0x16c')]?util[_0x2d96('0x74')](_0x2d96('0x16a'),ipAgi,_0x901549[_0x2d96('0x16c')]):_0x2d96('0x16b'),'XMD-QUEUE':_0x901549[_0x2d96('0x4c')]===_0x2d96('0x91')?util['format'](_0x2d96('0x16d'),_0x901549[_0x2d96('0x40')],_0x901549[_0x2d96('0x16e')]||'',_0x901549[_0x2d96('0x10e')]?'c':'',_0x901549[_0x2d96('0x115')]||0x3):'NONE','XMD-CONTACTID':_0x4d806c[_0x2d96('0xf9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x169')](),'XMD-AMD':_0x901549['dialAMDActive']?_0x2d96('0x16f'):_0x2d96('0x16b'),'XMD-DESTINATION':_0x2d96('0x170')};if(_0x901549[_0x2d96('0xe0')]){_0x52ac0d[_0x2d96('0x171')]=_0x901549[_0x2d96('0x172')]||0x9c4;_0x52ac0d[_0x2d96('0x173')]=_0x901549[_0x2d96('0x174')]||0x5dc;_0x52ac0d[_0x2d96('0x175')]=_0x901549[_0x2d96('0x176')]||0x320;_0x52ac0d['XMD-AMDTOTALANALYSISTIME']=_0x901549['dialAMDTotalAnalysisTime']||0x1388;_0x52ac0d[_0x2d96('0x177')]=_0x901549[_0x2d96('0x178')]||0x64;_0x52ac0d[_0x2d96('0x179')]=_0x901549[_0x2d96('0x17a')]||0x32;_0x52ac0d[_0x2d96('0x17b')]=_0x901549['dialAMDMaximumNumberOfWords']||0x3;_0x52ac0d['XMD-AMDSILENCETHRESHOLD']=_0x901549[_0x2d96('0x17c')]||0x100;_0x52ac0d[_0x2d96('0x17d')]=_0x901549[_0x2d96('0x17e')]||0x1388;}if(_0x901549[_0x2d96('0x4c')]===_0x2d96('0x91')){_0x52ac0d[_0x2d96('0x17f')]=_0x4d806c[_0x2d96('0xfa')];}else{_0x52ac0d[_0x2d96('0x180')]=_0x4d806c['CampaignId'];}for(var _0x49f9a4 in _0x4d806c[_0x2d96('0x166')]){if(_0x4d806c['Contact'][_0x2d96('0xaf')](_0x49f9a4)){if(isNotNull(_0x4d806c[_0x2d96('0x166')][_0x49f9a4])&&_0x49f9a4!=='id'&&_0x49f9a4!==_0x2d96('0x181')&&_0x49f9a4!==_0x2d96('0x182')&&_0x49f9a4!==_0x2d96('0x183')){_0x52ac0d[util[_0x2d96('0x74')](_0x2d96('0x184'),_0x2d96('0x185'),_[_0x2d96('0x186')](_0x49f9a4))]=_0x4d806c[_0x2d96('0x166')][_0x49f9a4];}}}var _0x9f50=_0x587f73[_0x2d96('0xd7')](_0x901549['Trunk'])?getCallerId(_0x901549['Trunk']['callerid'],_0x901549[_0x2d96('0x58')],_0x901549[_0x2d96('0x187')]>0x0?getCallerIdRandom(_0x901549[_0x2d96('0x59')],_0x901549[_0x2d96('0x187')]):_0x901549['dialOriginateCallerIdNumber']):getCallerId(_[_0x2d96('0xdd')](_0x901549['TrunkBackup'])?_0x901549['Trunk'][_0x2d96('0x188')]:_0x901549['TrunkBackup'][_0x2d96('0x188')],_0x901549['dialOriginateCallerIdName'],_0x901549[_0x2d96('0x187')]>0x0?getCallerIdRandom(_0x901549[_0x2d96('0x59')],_0x901549[_0x2d96('0x187')]):_0x901549['dialOriginateCallerIdNumber']);if(_0x9f50){_0x52ac0d[_0x2d96('0x189')]=_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x18a')]=extractCalleridName(_0x9f50);_0x52ac0d[_0x2d96('0x18b')]=_0x587f73[_0x2d96('0xad')][_0x4fe087][_0x2d96('0x18c')]=extractCalleridNumber(_0x9f50);}return ami['Action']({'actionid':_0x4fe087,'action':_0x2d96('0x164'),'channel':_0x587f73[_0x2d96('0xd7')](_0x901549['Trunk'])?util[_0x2d96('0x74')](_0x2d96('0x18d'),_0x901549['Trunk'][_0x2d96('0x40')],isNotNull(_0x901549[_0x2d96('0x5a')])?_0x901549['dialPrefix'][_0x2d96('0x18e')]()||'':'',_0x901549[_0x2d96('0x18f')]>0x0?_0x4d806c['Contact'][_0x2d96('0x167')][_0x2d96('0x190')](_0x901549[_0x2d96('0x18f')]):_0x4d806c[_0x2d96('0x166')]['phone']):util[_0x2d96('0x74')](_0x2d96('0x18d'),_[_0x2d96('0xdd')](_0x901549[_0x2d96('0x139')])?_0x901549[_0x2d96('0x72')][_0x2d96('0x40')]:_0x901549[_0x2d96('0x139')][_0x2d96('0x40')],isNotNull(_0x901549[_0x2d96('0x5a')])?_0x901549['dialPrefix'][_0x2d96('0x18e')]()||'':'',_0x901549[_0x2d96('0x18f')]>0x0?_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')][_0x2d96('0x190')](_0x901549[_0x2d96('0x18f')]):_0x4d806c[_0x2d96('0x166')][_0x2d96('0x167')]),'callerid':_0x9f50,'Exten':_0x2d96('0x170'),'Context':_0x2d96('0x191'),'Priority':'1','variable':_0x52ac0d,'timeout':(_0x901549['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4fe087})[_0x2d96('0xb8')](function(_0x1672eb){return _0x3d4253(_0x1672eb);})[_0x2d96('0xb9')](function(_0x19aea0){_0x901549[_0x2d96('0x62')]+=0x1;var _0x3406d5=new History(_0x587f73[_0x2d96('0xad')][_0x4fe087]);logger[_0x2d96('0x95')](util[_0x2d96('0x74')](_0x2d96('0x192'),JSON[_0x2d96('0x49')](_0x19aea0)));_0x3406d5[_0x2d96('0xa7')]=0xe;_0x3406d5['statedesc']=_0x2d96('0x193');_0x3406d5['starttime']=moment()['format'](_0x2d96('0xf8'));_0x3406d5[_0x2d96('0xa9')]=_0x3406d5[_0x2d96('0xaa')];_0x587f73[_0x2d96('0xcb')](_0x3406d5)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x194')));_0x587f73[_0x2d96('0xc9')](_0x3406d5)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x194')))[_0x2d96('0x131')](function(){delete _0x587f73[_0x2d96('0xad')][_0x4fe087];return _0x28a3f1(msgResponse('originate','Error',_0x2d96('0x195')));});});});};Dialer[_0x2d96('0xbb')]['syncOriginateResponse']=function(_0x4f154f){var _0x5774d5=this[_0x2d96('0xad')][_0x4f154f[_0x2d96('0x125')]];var _0x8cc13c=this;if(_0x5774d5){delete this[_0x2d96('0xad')][_0x4f154f[_0x2d96('0x125')]];_0x5774d5[_0x2d96('0x114')]=moment()['format'](_0x2d96('0xf8'));var _0x38f125=_0x5774d5['type']===_0x2d96('0x77')?this['campaigns'][_0x5774d5[_0x2d96('0xb3')]]:this[_0x2d96('0x24')][_0x5774d5['getQueue']()];if(!this[_0x2d96('0xd5')](_0x4f154f[_0x2d96('0x196')])){this[_0x2d96('0xcd')](_0x38f125);return this['callProgressDetecting'](_0x5774d5,_0x38f125,_0x4f154f)[_0x2d96('0xb8')](function(_0x42c926){})['catch'](loggerCatch(_0x2d96('0x197')));}else{this[_0x2d96('0x29')][_0x4f154f[_0x2d96('0xdc')]]=_0x5774d5;}}};Dialer['prototype'][_0x2d96('0x198')]=function(_0x7e85ec,_0x5191c6,_0xbce392){var _0x2586d4=new History(_0x5191c6);if(_0x2586d4['countbusyretry']+_0x2586d4['countcongestionretry']+_0x2586d4[_0x2d96('0xeb')]+_0x2586d4['countnosuchnumberretry']+_0x2586d4['countdropretry']+_0x2586d4[_0x2d96('0x102')]+_0x2586d4[_0x2d96('0xee')]+_0x2586d4[_0x2d96('0xef')]>=_0xbce392['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x7e85ec){case 0x3:if(_0x2586d4[_0x2d96('0xeb')]>=_0xbce392[_0x2d96('0x199')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countnoanswerretry':_0x2586d4[_0x2d96('0xeb')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialNoAnswerRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4['ContactId'],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x19a')));}break;case 0x5:if(_0x2586d4[_0x2d96('0xe9')]>=_0xbce392[_0x2d96('0x19b')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2586d4[_0x2d96('0xe9')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x19c')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch(_0x2d96('0x19d')));}break;case 0x8:if(_0x2586d4[_0x2d96('0xea')]>=_0xbce392[_0x2d96('0x19e')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countcongestionretry':_0x2586d4[_0x2d96('0xea')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x19f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1a0')));}break;case 0x0:if(_0x2586d4[_0x2d96('0xec')]>=_0xbce392[_0x2d96('0x1a1')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countnosuchnumberretry':_0x2586d4[_0x2d96('0xec')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x1a2')],'minutes')[_0x2d96('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch(_0x2d96('0x1a3')));}break;case 0xa:if(_0x2586d4[_0x2d96('0xed')]>=_0xbce392[_0x2d96('0x119')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countdropretry':_0x2586d4[_0x2d96('0xed')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x1a4')],'minutes')[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4['ListId'],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x11a')));}break;case 0xb:if(_0x2586d4['countabandonedretry']>=_0xbce392['dialAbandonedMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2586d4[_0x2d96('0x102')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392[_0x2d96('0x11f')],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x120')));}break;case 0x13:if(_0x2586d4[_0x2d96('0xee')]>=_0xbce392[_0x2d96('0xf3')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countmachineretry':_0x2586d4['countmachineretry']+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialMachineRetryFrequency'],'minutes')[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4[_0x2d96('0xf9')],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4['VoiceQueueId']||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x2586d4[_0x2d96('0xef')]>=_0xbce392[_0x2d96('0x1a5')]-0x1){return!![];}else{this[_0x2d96('0xc1')]({'active':![],'countagentrejectretry':_0x2586d4[_0x2d96('0xef')]+=0x1,'scheduledat':moment()[_0x2d96('0xf5')](_0xbce392['dialAgentRejectRetryFrequency'],_0x2d96('0xf7'))[_0x2d96('0x74')](_0x2d96('0xf8')),'ContactId':_0x2586d4['ContactId'],'ListId':_0x2586d4[_0x2d96('0xd3')],'VoiceQueueId':_0x2586d4[_0x2d96('0xfa')]||undefined,'CampaignId':_0x2586d4[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x2d96('0xbb')][_0x2d96('0x1a6')]=function(_0x358e87,_0x1bfa1b,_0x2ee8bf){var _0x30a79b=this;var _0x2b0592=new History(_0x358e87);return new BPromise(function(_0x90ac00,_0x3c2af6){if(_[_0x2d96('0x3c')](_0x1bfa1b)&&_0x2d96('0x163')!==typeof _0x1bfa1b){return _0x3c2af6(msgResponse(_0x2d96('0x1a7'),_0x2d96('0x13e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x2ee8bf)&&_0x2d96('0x163')!==typeof _0x2ee8bf){return _0x3c2af6(msgResponse('[callProgressDetecting]',_0x2d96('0x13e'),_0x2d96('0x1a8')));}switch(_0x2ee8bf['reason']){case'0':_0x1bfa1b[_0x2d96('0x61')]+=0x1;_0x2b0592['state']=0x0;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1a9');_0x2b0592[_0x2d96('0xec')]+=0x1;_0x2b0592['countglobal']+=0x1;ami['emit'](_0x2d96('0x1aa'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1ac')));_0x30a79b['createHistory'](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1ad')));if(_0x30a79b[_0x2d96('0x198')](0x0,_0x358e87,_0x1bfa1b)){if(_0x2b0592['countnosuchnumberretry']>=_0x1bfa1b[_0x2d96('0x1a1')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ae'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ae'));}}break;case'3':_0x1bfa1b[_0x2d96('0x60')]+=0x1;_0x2b0592[_0x2d96('0xa7')]=0x3;_0x2b0592[_0x2d96('0xa8')]='NoAnswer';_0x2b0592['countnoanswerretry']+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami['emit']('custom:agentnoanswer',ut['buildObj'](_0x358e87,'noanswer'));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1af')));if(_0x30a79b['checkRetriveMax'](0x3,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xeb')]>=_0x1bfa1b[_0x2d96('0x199')]){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b0'));}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b0'));}}break;case'5':_0x1bfa1b[_0x2d96('0x5c')]+=0x1;_0x2b0592['state']=0x5;_0x2b0592[_0x2d96('0xa8')]='Busy';_0x2b0592[_0x2d96('0xe9')]+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami[_0x2d96('0x4b')](_0x2d96('0x1b1'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1b2')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1b3')));if(_0x30a79b[_0x2d96('0x198')](0x5,_0x358e87,_0x1bfa1b)){if(_0x2b0592['countbusyretry']>=_0x1bfa1b[_0x2d96('0x19b')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b4'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1b4'));}}break;case'8':_0x1bfa1b[_0x2d96('0x1b5')]+=0x1;_0x2b0592['state']=0x8;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1b6');_0x2b0592[_0x2d96('0xea')]+=0x1;_0x2b0592['countglobal']+=0x1;ami[_0x2d96('0x4b')](_0x2d96('0x1b7'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1b8')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1b9')));if(_0x30a79b['checkRetriveMax'](0x8,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xea')]>=_0x1bfa1b['dialCongestionMaxRetry']){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,'reason\x208\x20congestion');}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1ba'));}}break;case'11':_0x1bfa1b[_0x2d96('0x1bb')]+=0x1;_0x2b0592['state']=0xb;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x121');_0x2b0592['countabandonedretry']+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;_0x30a79b['createHistory'](_0x2b0592)['catch'](loggerCatch(_0x2d96('0x1bc')));if(_0x30a79b[_0x2d96('0x198')](0xb,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0x102')]>=_0x1bfa1b[_0x2d96('0x11e')]){_0x30a79b['createStateFinal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1bd'));}else{_0x30a79b['stateGlobal'](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1bd'));}}break;case'20':_0x1bfa1b[_0x2d96('0x64')]+=0x1;_0x2b0592['state']=0x14;_0x2b0592[_0x2d96('0xa8')]=_0x2d96('0x1be');_0x2b0592[_0x2d96('0xef')]+=0x1;_0x2b0592[_0x2d96('0x100')]+=0x1;ami['emit'](_0x2d96('0x1bf'),ut[_0x2d96('0x1ab')](_0x358e87,_0x2d96('0x1c0')));_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1c1')));if(_0x30a79b['checkRetriveMax'](0x14,_0x358e87,_0x1bfa1b)){if(_0x2b0592[_0x2d96('0xef')]>=_0x1bfa1b[_0x2d96('0x1a5')]){_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1c2'));}else{_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2d96('0x1c2'));}}break;default:_0x1bfa1b['outboundUnknownCallsDay']+=0x1;_0x2b0592['state']=0xc;_0x2b0592[_0x2d96('0xa8')]=_0x2ee8bf[_0x2d96('0x10d')];_0x30a79b[_0x2d96('0xcb')](_0x2b0592)[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1c3')));if(_0x30a79b[_0x2d96('0x198')](_0x2ee8bf[_0x2d96('0x10d')],_0x358e87,_0x1bfa1b)){if(_0x2b0592['countbusyretry']+_0x2b0592['countcongestionretry']+_0x2b0592[_0x2d96('0xeb')]+_0x2b0592[_0x2d96('0xec')]+_0x2b0592[_0x2d96('0xed')]+_0x2b0592[_0x2d96('0x102')]+_0x2b0592[_0x2d96('0xee')]+_0x2b0592[_0x2d96('0xef')]>=_0x1bfa1b[_0x2d96('0xf0')]){_0x30a79b[_0x2d96('0xf1')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2ee8bf[_0x2d96('0x10d')]);}else{_0x30a79b[_0x2d96('0xf4')](_0x2b0592,_0x90ac00,_0x3c2af6,_0x2ee8bf[_0x2d96('0x10d')]);}}}});};Dialer[_0x2d96('0xbb')][_0x2d96('0xf1')]=function(_0x149a81,_0x5cb492,_0x16eb83,_0x52969f){var _0xe2f503=new Final(_0x149a81);_0xe2f503['state']=0xf;_0xe2f503[_0x2d96('0xa8')]='Global';this[_0x2d96('0xf4')](_0xe2f503,_0x5cb492,_0x16eb83,_0x52969f);};Dialer[_0x2d96('0xbb')][_0x2d96('0xf4')]=function(_0x5c13c8,_0x13c53d,_0x488b0d,_0x16d7a2){this['moveContactManagedDialer'](_0x5c13c8)['then'](function(_0x241987){return _0x13c53d(msgResponse('[callProgressDetecting]',_0x2d96('0xd6'),_0x16d7a2));})['catch'](function(_0x9e20fd){return _0x488b0d(msgResponse(_0x2d96('0x1c4'),_0x2d96('0x13e'),_0x2d96('0x1c5')));});};Dialer[_0x2d96('0xbb')][_0x2d96('0xa')]=function(_0x46cd45){var _0x500055=this;var _0x5c3297=_0x46cd45['dialPredictiveOptimizationPercentage']/0x64;var _0x386f26=_0x46cd45[_0x2d96('0x5f')]/(_0x46cd45['outboundDropCallsDayTimeout']+_0x46cd45[_0x2d96('0xe2')]);var _0x567ec2=Math[_0x2d96('0x1c6')](_0x46cd45['predictiveIntervalAvailable']*(_0x46cd45[_0x2d96('0x1c7')]/0x64));var _0x192518=Math[_0x2d96('0x1c6')](_0x46cd45[_0x2d96('0x6e')]*(_0x46cd45['predictiveIntervalMinThreshold']/0x64));var _0x118b6e=_0x46cd45['available']+_0x46cd45[_0x2d96('0x51')];var _0x3a210e=Math['floor'](_0x46cd45['erlangCalls']*_0x46cd45['erlangAbandonmentRate']*_0x46cd45[_0x2d96('0x6c')]*_0x46cd45['predictiveIntervalMultiplicativeFactor']);if(_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2c')])){if(!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2b')])){_0x46cd45['startPredictive']=undefined;loggerPredictive[_0x2d96('0x95')](_0x2d96('0x1c8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x90')])){loggerPredictive[_0x2d96('0x95')](_0x2d96('0x1c8'),_0x2d96('0x1c9'));clearInterval(_0x46cd45['handlePredictive']);_0x46cd45[_0x2d96('0x90')]=undefined;}_0x46cd45[_0x2d96('0x2c')]=moment()['format'](_0x2d96('0xf8'));loggerPredictive['info'](_0x46cd45[_0x2d96('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x46cd45[_0x2d96('0x2c')]);this[_0x2d96('0x152')](_0x46cd45,0x1);}else if(ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45['startProgressive'])){this[_0x2d96('0x152')](_0x46cd45,0x1);loggerPredictiveCalls[_0x2d96('0x7a')]('[startMethodPredictive][StartProgressive][Loop]',_0x46cd45[_0x2d96('0x2c')],_0x46cd45['name']);_0x46cd45[_0x2d96('0x70')]=0x0;_0x46cd45[_0x2d96('0x1cb')]=0x0;}else if(_0x5c3297<_0x386f26&&_0x46cd45[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){freeVariablesPredictive(_0x46cd45);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x1ce'),_0x2d96('0x1cf'),_0x386f26,_0x2d96('0x2c'),_0x46cd45[_0x2d96('0x40')]);}else if(_0x3a210e<_0x46cd45[_0x2d96('0x1cb')]&&_0x46cd45[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){freeVariablesPredictive(_0x46cd45);loggerPredictive['info'](_0x2d96('0x1d0'),_0x2d96('0x1d1'),_0x3a210e,_0x2d96('0x1d2'),_0x46cd45[_0x2d96('0x1cb')],_0x2d96('0x2c'),_0x46cd45[_0x2d96('0x40')]);}else if(!ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45[_0x2d96('0x2c')])&&_[_0x2d96('0x3c')](_0x46cd45['startPredictive'])&&!_[_0x2d96('0x3c')](_0x46cd45[_0x2d96('0x2c')])){_0x46cd45['startPredictive']=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1d3'),_0x46cd45[_0x2d96('0x2b')]);this['averageHandleTime'](_0x46cd45[_0x2d96('0x1ca')])[_0x2d96('0xb8')](this[_0x2d96('0x1d4')](_0x46cd45))[_0x2d96('0xb8')](mergeDataErlangB(_0x46cd45))[_0x2d96('0xb8')](this['startMethodPredictive'](_0x46cd45))[_0x2d96('0xb9')](loggerCatchPredictive(_0x2d96('0x1d5'),_0x46cd45));}else if(!ifInterval(_0x46cd45[_0x2d96('0x1ca')],_0x46cd45['startPredictive'])){_0x46cd45[_0x2d96('0x1cb')]=0x0;_0x46cd45[_0x2d96('0x2b')]=moment()[_0x2d96('0x74')](_0x2d96('0xf8'));loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1d6'),_0x46cd45['startPredictive']);clearInterval(_0x46cd45[_0x2d96('0x90')]);_0x46cd45[_0x2d96('0x90')]=undefined;this[_0x2d96('0x1d7')](_0x46cd45['dialPredictiveInterval'])[_0x2d96('0xb8')](this[_0x2d96('0x1d4')](_0x46cd45))[_0x2d96('0xb8')](mergeDataErlangB(_0x46cd45))[_0x2d96('0xb8')](this['startMethodPredictive'](_0x46cd45))[_0x2d96('0xb9')](loggerCatchPredictive(_0x2d96('0x1d8'),_0x46cd45));}else if(_0x46cd45[_0x2d96('0x6e')]&&_0x118b6e<_0x46cd45[_0x2d96('0x6e')]-_0x192518){freeVariablesPredictive(_0x46cd45);loggerPredictive[_0x2d96('0x7a')](_0x46cd45[_0x2d96('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x118b6e,_0x2d96('0x1d9'),_0x46cd45[_0x2d96('0x6e')],'-',_0x192518,'=',_0x46cd45[_0x2d96('0x6e')]-_0x192518,')');}else if(_0x46cd45[_0x2d96('0x6e')]&&_0x118b6e>_0x46cd45[_0x2d96('0x6e')]+_0x567ec2){freeVariablesPredictive(_0x46cd45);loggerPredictive['info'](_0x46cd45[_0x2d96('0x40')],_0x2d96('0x1da'),_0x118b6e,_0x2d96('0x1db'),_0x46cd45['predictiveIntervalAvailable'],'+',_0x567ec2,'=',_0x46cd45['predictiveIntervalAvailable']+_0x567ec2,')');}};Dialer['prototype'][_0x2d96('0x1d4')]=function(_0x4936e1){var _0x44ea7f=this;return function(_0x5e27f5){return new BPromise(function(_0xb17b4c,_0x20a932){_[_0x2d96('0x8b')](_0x4936e1,_0x5e27f5[0x0]);if(checkGetDataPredictive(_0x5e27f5[0x0])){var _0x2c9abd=_0x4936e1[_0x2d96('0x6e')]=_0x4936e1[_0x2d96('0x51')]+_0x4936e1[_0x2d96('0x4d')];var _0x53b6b4=_0x4936e1[_0x2d96('0x1ca')]*0x3c;var _0xf9a61f=_0x5e27f5[0x0][_0x2d96('0x68')]+_0x5e27f5[0x0][_0x2d96('0x67')];var _0x68e236=(_0x5e27f5[0x0][_0x2d96('0x66')]+_0x5e27f5[0x0][_0x2d96('0x6a')]+_0x5e27f5[0x0][_0x2d96('0x69')])/_0x5e27f5[0x0][_0x2d96('0x7c')];_0x4936e1[_0x2d96('0x6c')]=_0x68e236>0x0?_0x68e236:0x1;switch(_0x4936e1[_0x2d96('0x1cc')]){case _0x2d96('0x1cd'):var _0xb535f2=_0x4936e1['dialPredictiveOptimizationPercentage']/0x64;return _0x44ea7f[_0x2d96('0x1dc')](_0x2c9abd,_0x53b6b4,_0xf9a61f,_0x68e236,_0xb535f2)[_0x2d96('0xb8')](function(_0xcea1c4){return _0xb17b4c(_0xcea1c4);});case _0x2d96('0x1dd'):var _0xf23845=_0x4936e1['dialPredictiveOptimizationPercentage']/0x64;return _0x44ea7f['busyFactor'](_0x2c9abd,_0x53b6b4,_0xf9a61f,_0x68e236,_0xf23845)[_0x2d96('0xb8')](function(_0x4bddc0){return _0xb17b4c(_0x4bddc0);});default:return _0x20a932(msgResponse('[getDataPredictive]',_0x2d96('0x13e'),'Unknown\x20Predictive'));}}else{return _0x20a932(msgResponse(_0x2d96('0x1de'),_0x2d96('0x13e'),_0x2d96('0x1df')));}});};};Dialer[_0x2d96('0xbb')][_0x2d96('0x1e0')]=function(_0x2e255a){var _0x3223c2=this;return function(_0x35fd62){return new BPromise(function(_0x1a6ba5,_0x5ba1c2){_[_0x2d96('0x8b')](_0x2e255a,_0x35fd62[0x0]);if(checkGetDataPredictive(_0x35fd62[0x0])){loggerPredictive[_0x2d96('0x7a')](JSON[_0x2d96('0x49')](_0x35fd62[0x0]));if(_0x2e255a[_0x2d96('0x1cc')]===_0x2d96('0x1cd')){return _0x3223c2['getVoiceQueueRtPauses'](_0x2e255a['id'])[_0x2d96('0xb8')](function(_0x45b213){var _0x48d9ce=_0x2e255a['loggedIn']-_0x45b213[0x0]['outboundQueuePauses'];var _0x22a7a6=_0x2e255a[_0x2d96('0x1ca')]*0x3c;var _0x32e1de=_0x35fd62[0x0]['predictiveIntervalAvgTalktime']+_0x35fd62[0x0][_0x2d96('0x67')];var _0x236605=(_0x35fd62[0x0][_0x2d96('0x66')]+_0x35fd62[0x0][_0x2d96('0x6a')]+_0x35fd62[0x0][_0x2d96('0x69')])/_0x35fd62[0x0][_0x2d96('0x7c')];var _0x3e16f5=_0x2e255a['dialPredictiveOptimizationPercentage']/0x64;_0x2e255a[_0x2d96('0x6d')]=_0x45b213[0x0][_0x2d96('0x1e1')]||0x0;_0x2e255a[_0x2d96('0x6c')]=_0x236605>0x0?_0x236605:0x1;return _0x3223c2[_0x2d96('0x1dc')](_0x48d9ce,_0x22a7a6,_0x32e1de,_0x236605,_0x3e16f5);})[_0x2d96('0xb8')](function(_0x470541){return _0x1a6ba5(_0x470541);})['catch'](function(_0x35a14f){return _0x5ba1c2(msgResponse(_0x2d96('0x1e2'),_0x2d96('0x13e'),JSON['stringify'](_0x35a14f)));});}if(_0x2e255a[_0x2d96('0x1cc')]===_0x2d96('0x1dd')){return _0x3223c2[_0x2d96('0xc7')](_0x2e255a['id'])[_0x2d96('0xb8')](function(_0x19412d){var _0x554080=_0x2e255a[_0x2d96('0x159')]-_0x19412d[0x0]['outboundQueuePauses'];var _0xefbe58=_0x2e255a[_0x2d96('0x1ca')]*0x3c;var _0x565e3b=_0x35fd62[0x0][_0x2d96('0x68')]+_0x35fd62[0x0]['predictiveIntervalAvgHoldtime'];var _0x2d5353=(_0x35fd62[0x0][_0x2d96('0x66')]+_0x35fd62[0x0][_0x2d96('0x6a')]+_0x35fd62[0x0][_0x2d96('0x69')])/_0x35fd62[0x0]['predictiveIntervalTotalCalls'];var _0x5c7c7c=_0x2e255a[_0x2d96('0x1e3')]/0x64;_0x2e255a[_0x2d96('0x6d')]=_0x19412d[0x0][_0x2d96('0x1e1')]||0x0;_0x2e255a[_0x2d96('0x6c')]=_0x2d5353>0x0?_0x2d5353:0x1;return _0x3223c2[_0x2d96('0x1e4')](_0x554080,_0xefbe58,_0x565e3b,_0x2d5353,_0x5c7c7c);})[_0x2d96('0xb8')](function(_0x488cbd){return _0x1a6ba5(_0x488cbd);})['catch'](function(_0x327be6){return _0x5ba1c2(msgResponse(_0x2d96('0x1e2'),_0x2d96('0x13e'),JSON['stringify'](_0x327be6)));});}}else{return _0x5ba1c2(msgResponse(_0x2d96('0x1de'),_0x2d96('0x13e'),'check\x20failure'));}});};};Dialer['prototype'][_0x2d96('0x1e5')]=function(_0x1bd3d0){var _0x2c60c8=this;return function(){var _0x53f3d8=0x0;var _0x3b88a8=Math[_0x2d96('0x1e6')](_0x1bd3d0[_0x2d96('0x1e7')]*0x3e8);if(_0x3b88a8>0x0){_0x3b88a8=_0x3b88a8<0x64?0x64:_0x3b88a8;loggerPredictive[_0x2d96('0x7a')](_0x1bd3d0[_0x2d96('0x40')],'one\x20call\x20every:',_0x3b88a8,_0x2d96('0x4a'));_0x1bd3d0['handlePredictive']=setInterval(function(){_0x2c60c8[_0x2d96('0x90')](_0x1bd3d0);loggerPredictiveCalls[_0x2d96('0x7a')](_0x2d96('0x1e8'),_0x53f3d8+=0x1);},_0x3b88a8);}else{loggerPredictive['info'](_0x1bd3d0[_0x2d96('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x2d96('0x1e9')]=function(_0x2cdfc6,_0x474711){var _0x88077a=this;return function(_0x47c789){if(_[_0x2d96('0x46')](_0x47c789)){if(_[_0x2d96('0xdd')](_0x474711[_0x2d96('0x1ea')])||!_0x474711[_0x2d96('0x1eb')]){if(_0x2cdfc6[_0x2d96('0x57')]===_0x2d96('0x9')){_0x2cdfc6['queueStatusComplete']=_[_0x2d96('0x3c')](_0x2cdfc6[_0x2d96('0x12c')])?!![]:_0x2cdfc6['queueStatusComplete'];var _0x488cbf=uuid['v4']();_0x88077a[_0x2d96('0xad')][_0x488cbf]=new Action(_0x2cdfc6,_0x474711,_0x488cbf);loggerBooked[_0x2d96('0x7a')](_0x2d96('0x1ec'),_0x488cbf,_0x2d96('0x1ed'),JSON[_0x2d96('0x49')](_0x2cdfc6[_0x2d96('0x12c')]),_0x2d96('0x1ee'),_0x2cdfc6[_0x2d96('0x40')]);if(_0x2cdfc6['queueStatusComplete']){_0x2cdfc6[_0x2d96('0x12c')]=![];_0x88077a[_0x2d96('0x2e')][_0x88077a[_0x2d96('0xad')][_0x488cbf]['queue']]=[];ami[_0x2d96('0xb0')]({'actionid':_0x488cbf,'action':_0x2d96('0x1ef'),'queue':_0x2cdfc6['name']})['catch'](function(_0x19c34d){_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);_0x88077a['rescheduleContact']({'active':![],'ContactId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xf9')],'ListId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xd3')],'VoiceQueueId':_0x88077a[_0x2d96('0xad')][_0x488cbf]['VoiceQueueId']||undefined,'CampaignId':_0x88077a['actions'][_0x488cbf]['CampaignId']||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f0')));delete _0x88077a[_0x2d96('0xad')][_0x488cbf];});}else{loggerBooked[_0x2d96('0x7a')](_0x2d96('0x1f1'),JSON[_0x2d96('0x49')](_0x2cdfc6['queueStatusComplete']),_0x2d96('0x1ee'),_0x2cdfc6['name']);_0x88077a['updateOriginated'](_0x2cdfc6);_0x88077a[_0x2d96('0xc1')]({'active':![],'ContactId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xf9')],'ListId':_0x88077a['actions'][_0x488cbf][_0x2d96('0xd3')],'VoiceQueueId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xfa')]||undefined,'CampaignId':_0x88077a[_0x2d96('0xad')][_0x488cbf][_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f0')));delete _0x88077a['actions'][_0x488cbf];}}else{return _0x88077a[_0x2d96('0x162')](_0x2cdfc6,_0x474711);}}else{if(getDiff(_0x474711['scheduledat'])<_0x2cdfc6[_0x2d96('0x1f2')]*0x3c){if(_0x474711['Agent']&&!_0x474711[_0x2d96('0x1f3')][_0x2d96('0x1f4')]){_0x88077a[_0x2d96('0x23')][_0x2d96('0x12f')](_0x474711['id'])[_0x2d96('0x131')](function(){_0x88077a['updateOriginated'](_0x2cdfc6);});}else{_0x88077a[_0x2d96('0xc2')]({'active':![]},_0x474711['id'],0x1)['finally'](function(){console[_0x2d96('0x1f5')](_0x2d96('0x1f6'));_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);});}}else{_0x2cdfc6[_0x2d96('0x63')]+=0x1;_0x88077a[_0x2d96('0xcd')](_0x2cdfc6);if(_0x2cdfc6[_0x2d96('0x1f7')]){_0x88077a['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x474711['ContactId'],'ListId':_0x474711['ListId'],'VoiceQueueId':_0x474711['VoiceQueueId']||undefined,'CampaignId':_0x474711[_0x2d96('0xfb')]||undefined})[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1f8')));_0x88077a[_0x2d96('0xcb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1f9'),0x17,'RecallInQueue'))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0x1fa')));}else{_0x88077a[_0x2d96('0xdb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1fb'),0x16,_0x2d96('0x1fc')),_0x2d96('0x1fd'),_0x2d96('0x1fe'));}}}}else{_0x2cdfc6[_0x2d96('0x5b')]+=0x1;_0x88077a[_0x2d96('0xdb')](createObjHistory(_0x2cdfc6,_0x474711,_0x2d96('0x1ff'),0xd,_0x2d96('0x200')),_0x2d96('0x201'),'[Originate][MoveBlacklist]');throw _0x2d96('0x202');}};};Dialer['prototype'][_0x2d96('0x158')]=function(_0x4e1bc){var _0x611a7e=this;var _0x211f3c=[];var _0x4a8619=_0x4e1bc[_0x2d96('0x203')]-_0x4e1bc[_0x2d96('0x6f')]-_0x4e1bc[_0x2d96('0x204')];emitCampaignSummary(_0x4e1bc);if(_0x4a8619>0x0){if(_0x4a8619>this['maxNumberOriginate']){_0x4a8619=this[_0x2d96('0x27')];}_0x4e1bc[_0x2d96('0x204')]+=_0x4a8619;this[_0x2d96('0xc5')](_0x4e1bc['id'],_0x4a8619,_0x4e1bc[_0x2d96('0x205')])['then'](function(_0x2c1c4f){_0x4e1bc['temp']-=_0x4a8619;_0x4e1bc[_0x2d96('0x204')]=_0x4e1bc[_0x2d96('0x204')]>0x0?_0x4e1bc[_0x2d96('0x204')]:0x0;if(!checkContactEmpty(_0x2c1c4f)){_0x4e1bc[_0x2d96('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x2d96('0x206')+_0x4e1bc[_0x2d96('0x40')]);}else{_0x4e1bc[_0x2d96('0x6f')]+=_0x2c1c4f[_0x2d96('0x97')];_0x4e1bc[_0x2d96('0x3e')]=_0x2d96('0x207');for(var _0x4e4b49=0x0;_0x4e4b49<_0x2c1c4f['length'];_0x4e4b49+=0x1){_0x4e1bc[_0x2d96('0x208')]+=0x1;if(_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49])||_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49][_0x2d96('0x166')])||_[_0x2d96('0xdd')](_0x2c1c4f[_0x4e4b49][_0x2d96('0x166')][_0x2d96('0x167')])){_0x611a7e['emptyContact'](_0x2d96('0x209'),_0x4e1bc,_0x2c1c4f[_0x4e4b49]);}else{_0x611a7e[_0x2d96('0xbe')](_['pick'](_0x2c1c4f[_0x4e4b49],['CampaignId','Contact.phone']))['then'](_0x611a7e['checkContactBlack'](_0x4e1bc,_0x2c1c4f[_0x4e4b49]))[_0x2d96('0xb9')](_0x611a7e['loggerHandler'](_0x2d96('0x20a'),_0x4e1bc));}}}})[_0x2d96('0xb9')](loggerGetContactDialer(_0x2d96('0x20b'),_0x4e1bc,_0x4a8619));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x152')]=function(_0x4f11cb,_0xf3b2f4){var _0xf7d0a=this;var _0xc47d9c=[];var _0x4f6416=_0xf3b2f4>=0x1?_0xf3b2f4:0x1;var _0x13a095=[];if(_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')){_0x4f6416=0x1;}var _0x12e824=Math[_0x2d96('0x1e6')](_0x4f11cb[_0x2d96('0x4d')]*_0x4f6416)-_0x4f11cb[_0x2d96('0x6f')]-_0x4f11cb[_0x2d96('0x204')];emitVoiceQueueSummary(_0x4f11cb);if(_0x4f11cb[_0x2d96('0x20c')]>0x0){var _0x30db21=_0x4f11cb[_0x2d96('0x20c')]-_0x4f11cb['originated']-_0x4f11cb['talking']-_0x4f11cb['temp']-_0x4f11cb[_0x2d96('0x4e')];if(_0x12e824>_0x30db21){_0x12e824=_0x30db21;}}if(_0x12e824>0x0){if(_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')){_0x12e824=0x1;}if(_0x12e824>this[_0x2d96('0x27')]){_0x12e824=this[_0x2d96('0x27')];}_0x4f11cb[_0x2d96('0x204')]+=_0x12e824;for(var _0x5403a2 in this[_0x2d96('0x25')]){if(this[_0x2d96('0x25')][_0x2d96('0xaf')](_0x5403a2)){if(this[_0x2d96('0x25')][_0x5403a2]['state']===_0x2d96('0x20d')&&this['agents'][_0x5403a2][_0x2d96('0xb1')]===_0x2d96('0xd9')){_0xc47d9c[_0x2d96('0x146')](this['agents'][_0x5403a2]['id']);}}}this[_0x2d96('0xc4')](_0x4f11cb['id'],_0xc47d9c,_0x12e824,_0x4f11cb['dialOrderByScheduledAt'])[_0x2d96('0xb8')](function(_0x17f65f){_0x4f11cb[_0x2d96('0x204')]-=_0x12e824;_0x4f11cb[_0x2d96('0x204')]=_0x4f11cb[_0x2d96('0x204')]>0x0?_0x4f11cb[_0x2d96('0x204')]:0x0;if(!checkContactEmpty(_0x17f65f)){_0xf7d0a[_0x2d96('0xb6')](_0x4f11cb)['then'](sendMessageReschedule(_0x4f11cb))[_0x2d96('0xb9')](loggerCatch(_0x2d96('0xba')));}else{_0x4f11cb[_0x2d96('0x6f')]+=_0x17f65f[_0x2d96('0x97')];_0x4f11cb[_0x2d96('0x3e')]=_0x4f11cb[_0x2d96('0x57')]===_0x2d96('0x9')?_0x2d96('0x16f'):_0x2d96('0x207');for(var _0x5f0ec4=0x0;_0x5f0ec4<_0x17f65f[_0x2d96('0x97')];_0x5f0ec4+=0x1){if(_['isNil'](_0x17f65f[_0x5f0ec4])||_[_0x2d96('0xdd')](_0x17f65f[_0x5f0ec4]['Contact'])||_[_0x2d96('0xdd')](_0x17f65f[_0x5f0ec4][_0x2d96('0x166')][_0x2d96('0x167')])){_0xf7d0a[_0x2d96('0xd1')](_0x2d96('0x209'),_0x4f11cb,_0x17f65f[_0x5f0ec4]);}else{_0xf7d0a[_0x2d96('0xbc')](_[_0x2d96('0x129')](_0x17f65f[_0x5f0ec4],['VoiceQueueId',_0x2d96('0x20e')]))[_0x2d96('0xb8')](_0xf7d0a[_0x2d96('0x1e9')](_0x4f11cb,_0x17f65f[_0x5f0ec4]))[_0x2d96('0xb9')](_0xf7d0a[_0x2d96('0xd0')]('[actionOriginate]\x20',_0x4f11cb));}}}})[_0x2d96('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x4f11cb,_0x12e824));}};Dialer[_0x2d96('0xbb')][_0x2d96('0x90')]=function(_0x3c8a00){var _0xa8afa5=this;if(_0x3c8a00[_0x2d96('0x20c')]>0x0){var _0x5977d7=_0x3c8a00[_0x2d96('0x20c')]-_0x3c8a00[_0x2d96('0x6f')]-_0x3c8a00[_0x2d96('0x51')];if(_0x5977d7>0x0){this[_0x2d96('0x20f')](_0x3c8a00);}else{loggerPredictiveCalls[_0x2d96('0x7a')](_0x2d96('0x210'));}}else{this[_0x2d96('0x20f')](_0x3c8a00);}};Dialer[_0x2d96('0xbb')][_0x2d96('0x20f')]=function(_0x2bc8ca){var _0x228fc1=this;var _0x2e1e5d=[];_0x2bc8ca[_0x2d96('0x6f')]+=0x1;for(var _0x54b545 in this[_0x2d96('0x25')]){if(this[_0x2d96('0x25')][_0x2d96('0xaf')](_0x54b545)){if(this[_0x2d96('0x25')][_0x54b545][_0x2d96('0xa7')]===_0x2d96('0x20d')&&this['agents'][_0x54b545][_0x2d96('0xb1')]==='reachable'){_0x2e1e5d['push'](this[_0x2d96('0x25')][_0x54b545]['id']);}}}this[_0x2d96('0xc4')](_0x2bc8ca['id'],_0x2e1e5d,0x1,_0x2bc8ca['dialOrderByScheduledAt'])['then'](function(_0x31a483){if(!checkContactEmpty(_0x31a483)){checkContactLowerLimitOriginate(_0x2bc8ca,0x1,0x0);_0x228fc1[_0x2d96('0xb6')](_0x2bc8ca)[_0x2d96('0xb8')](sendMessageReschedule(_0x2bc8ca))['catch'](loggerCatch(_0x2d96('0xba')));}else{_0x2bc8ca[_0x2d96('0x3e')]=_0x2d96('0x207');if(_[_0x2d96('0xdd')](_0x31a483[0x0])||_['isNil'](_0x31a483[0x0]['Contact'])||_[_0x2d96('0xdd')](_0x31a483[0x0][_0x2d96('0x166')]['phone'])){_0x228fc1[_0x2d96('0xd1')]('[actionOriginate]\x20',_0x2bc8ca,_0x31a483[0x0]);}else{_0x228fc1[_0x2d96('0xbc')](_[_0x2d96('0x129')](_0x31a483[0x0],[_0x2d96('0xfa'),'Contact.phone']))['then'](_0x228fc1[_0x2d96('0x1e9')](_0x2bc8ca,_0x31a483[0x0]))[_0x2d96('0xb9')](_0x228fc1[_0x2d96('0xd0')](_0x2d96('0x211'),_0x2bc8ca));}}})[_0x2d96('0xb9')](loggerGetContactDialer(_0x2d96('0x212'),_0x2bc8ca,0x1));emitVoiceQueueSummary(_0x2bc8ca);};Dialer[_0x2d96('0xbb')][_0x2d96('0x1dc')]=function(_0x56e722,_0x6a21f5,_0x190568,_0x503c30,_0x5623e8,_0x4470c3){loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x213'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x214'),_0x56e722);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x215'),_0x6a21f5);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x216'),_0x190568);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x217'),_0x503c30);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x218'),_0x5623e8);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x81'));return new BPromise(function(_0x2d9a3e,_0x165533){if(_0x56e722<=0x0||isNaN(_0x56e722)){return _0x165533(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x56e722));}if(_0x190568<=0x0||isNaN(_0x190568)){return _0x165533(msgResponse(_0x2d96('0x219'),_0x2d96('0x48'),'Ts\x20=\x20'+_0x190568));}if(_0x503c30<=0x0||isNaN(_0x503c30)){return _0x165533(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x503c30));}if(_0x6a21f5<=0x0||isNaN(_0x6a21f5)){return _0x165533(msgResponse(_0x2d96('0x219'),'Error',_0x2d96('0x21a')+_0x6a21f5));}if(_0x5623e8<=0x0||isNaN(_0x5623e8)){return _0x165533(msgResponse('[abandonmentRate]',_0x2d96('0x48'),'Amax\x20=\x20'+_0x5623e8));}_0x4470c3=_0x4470c3||0x0;var _0x3e8b93=0x1/_0x190568;var _0x20cc63=0x0;var _0x39e799=0x0;var _0x50ccb6=0x0;var _0x30201c=0x0;for(var _0x5995b7=0x0;_0x50ccb6<_0x5623e8;_0x5995b7+=0x1){_0x39e799=_0x5995b7/_0x6a21f5;_0x20cc63=(_0x503c30*_0x39e799+_0x4470c3)/_0x3e8b93;_0x50ccb6=erlangb(_0x20cc63,_0x56e722);_0x30201c=_0x20cc63/_0x56e722*(0x1-erlangb(_0x20cc63,_0x56e722));}return _0x2d9a3e({'erlangCalls':_0x5995b7,'erlangCallToSecond':_0x6a21f5/_0x5995b7,'erlangAbandonmentRate':_0x50ccb6,'erlangBusyFactor':_0x30201c});});};Dialer[_0x2d96('0xbb')][_0x2d96('0x1e4')]=function(_0x117c37,_0x390996,_0x4241f5,_0x2e32fa,_0x110013,_0x4c8fb1){loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x21b'));loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x214'),_0x117c37);loggerPredictive['info'](_0x2d96('0x215'),_0x390996);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x216'),_0x4241f5);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x217'),_0x2e32fa);loggerPredictive[_0x2d96('0x7a')](_0x2d96('0x21c'),_0x110013);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x1c1dbc,_0x164db2){if(_0x117c37<=0x0||isNaN(_0x117c37)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21e')+_0x117c37));}if(_0x4241f5<=0x0||isNaN(_0x4241f5)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21f')+_0x4241f5));}if(_0x2e32fa<=0x0||isNaN(_0x2e32fa)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x220')+_0x2e32fa));}if(_0x390996<=0x0||isNaN(_0x390996)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),_0x2d96('0x21a')+_0x390996));}if(_0x110013<=0x0||isNaN(_0x110013)){return _0x164db2(msgResponse(_0x2d96('0x21d'),_0x2d96('0x48'),'Umin\x20=\x20'+_0x110013));}_0x4c8fb1=_0x4c8fb1||0x0;var _0x463dd9=0x1/_0x4241f5;var _0x1401f9=0x0;var _0xd40779=0x0;var _0x256d50=0x0;var _0x4e13bd=0x0;for(var _0x3845e0=0x0;_0x4e13bd<_0x110013;_0x3845e0+=0x1){_0xd40779=_0x3845e0/_0x390996;_0x1401f9=(_0x2e32fa*_0xd40779+_0x4c8fb1)/_0x463dd9;_0x256d50=erlangb(_0x1401f9,_0x117c37);_0x4e13bd=_0x1401f9/_0x117c37*(0x1-erlangb(_0x1401f9,_0x117c37));}return _0x1c1dbc({'erlangCalls':_0x3845e0,'erlangCallToSecond':_0x390996/_0x3845e0,'erlangAbandonmentRate':_0x256d50,'erlangBusyFactor':_0x4e13bd});});};module[_0x2d96('0x221')]=Dialer; \ No newline at end of file +var _0x6300=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','[actions]','prototype','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','merge','pick','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','voiceQueues','outboundAnswerAgiCallsDay','AMD','saveInDb','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','HangupInAMD','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','value','countglobal','amd','countbusyretry','reason\x2019\x20machine....','dialMachineRetryFrequency','CampaignId','[rescheduleContact][Machine]','syncHangup','dialQueueProject','AnswerAGI','[syncHangupIvr]','cause-txt','Unknow','[syncHangupIvr][createHistory]','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','timezones','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','responsetime','getQueue','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','reason','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsTimeout','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','busyFactor','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','maxNumberOriginate','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','uuid','md5','ioredis','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','defaults','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','campaigns','agents','trunks','channels','actions','optionPredictive','startPredictive','startProgressive','ivrOriginated','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','stringify','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x4403ad,_0xf468e0){var _0x3c371e=function(_0x1809c9){while(--_0x1809c9){_0x4403ad['push'](_0x4403ad['shift']());}};_0x3c371e(++_0xf468e0);}(_0x6300,0x1ae));var _0x0630=function(_0x14656f,_0x2233bb){_0x14656f=_0x14656f-0x0;var _0x54d72b=_0x6300[_0x14656f];return _0x54d72b;};'use strict';var util=require(_0x0630('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x0630('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0x0630('0x2'));var Redis=require(_0x0630('0x3'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x0630('0x4'))(_0x0630('0x5'));var loggerBooked=require('../../../config/logger')(_0x0630('0x6'));var loggerPredictive=require(_0x0630('0x4'))(_0x0630('0x7'));var loggerPredictiveCalls=require(_0x0630('0x4'))(_0x0630('0x8'));var loggerSyncQueueSummary=require(_0x0630('0x4'))(_0x0630('0x9'));var ami=require('../ami');config['redis']=_[_0x0630('0xa')](config[_0x0630('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x0630('0xc'))(new Redis(config[_0x0630('0xb')]));var cmHopper=require(_0x0630('0xd'));var cmHopperFinal=require(_0x0630('0xe'));var cmHopperHistory=require(_0x0630('0xf'));var cmHopperBlack=require(_0x0630('0x10'));var voiceQueueRt=require(_0x0630('0x11'));var Action=require(_0x0630('0x12'));var History=require(_0x0630('0x13'));var Final=require(_0x0630('0x14'));var AgentComplete=require(_0x0630('0x15'));var QueueCallerAbandon=require(_0x0630('0x16'));var Hangup=require(_0x0630('0x17'));var ipAgi=process[_0x0630('0x18')][_0x0630('0x19')]||_0x0630('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x0630('0x1b')]=function(_0x147aa3){this[_0x0630('0x1c')]=this['tail']?this['tail'][_0x0630('0x1d')](_0x147aa3):_0x147aa3();};function Dialer(_0x224378,_0x43e58c){this[_0x0630('0x1e')]=new Sequence();this[_0x0630('0x1f')]=_0x43e58c;this['voiceQueues']=_0x224378['voiceQueues'];this[_0x0630('0x20')]=_0x224378['campaigns'];this['agents']=_0x224378[_0x0630('0x21')];this[_0x0630('0x22')]=_0x224378[_0x0630('0x22')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x0630('0x23')]={};this[_0x0630('0x24')]={};this['contactsId']={};this['uniqueId']={};this[_0x0630('0x25')]={};this[_0x0630('0x26')]={};this[_0x0630('0x27')]={};this[_0x0630('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x0630('0x29'),this['syncAgentConnect'][_0x0630('0x2a')](this));ami['on'](_0x0630('0x2b'),this[_0x0630('0x2c')]['bind'](this));ami['on']('originateresponse',this[_0x0630('0x2d')]['bind'](this));ami['on'](_0x0630('0x2e'),this[_0x0630('0x2f')][_0x0630('0x2a')](this));ami['on'](_0x0630('0x30'),this[_0x0630('0x9')][_0x0630('0x2a')](this));ami['on'](_0x0630('0x31'),this['syncHangup'][_0x0630('0x2a')](this));ami['on'](_0x0630('0x32'),this[_0x0630('0x33')][_0x0630('0x2a')](this));ami['on']('varset',this[_0x0630('0x34')][_0x0630('0x2a')](this));ami['on'](_0x0630('0x35'),this['syncQueueMember']['bind'](this));ami['on'](_0x0630('0x36'),this[_0x0630('0x37')][_0x0630('0x2a')](this));this['loopCampaigns']();this[_0x0630('0x38')]();}function isNotNull(_0x18b8a2){return _0x18b8a2!==null&&!_[_0x0630('0x39')](_0x18b8a2);}function checkIsLoggedIn(_0x55b840,_0x5c05f2){return function(){if(_0x5c05f2<=0x0){_0x55b840[_0x0630('0x3a')]='AGENTS_NOT_LOGGED';throw _0x55b840[_0x0630('0x3b')]+_0x0630('0x3c');}};}function isActive(_0x106003){return _0x106003;}function checkIsActive(_0x1e0b27,_0x517d69){return function(){if(!isActive(_0x517d69)){_0x1e0b27[_0x0630('0x3a')]='NOT_ACTIVE';throw _0x1e0b27[_0x0630('0x3b')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1019c2){return function(){if(!isNotNull(_0x1019c2[_0x0630('0x3d')])){_0x1019c2['message']='INTERVAL_IS_NULL';throw _0x1019c2[_0x0630('0x3b')]+_0x0630('0x3e');}if(!isNotNull(_0x1019c2[_0x0630('0x3d')]['Intervals'])){_0x1019c2[_0x0630('0x3a')]=_0x0630('0x3f');throw _0x1019c2[_0x0630('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0630('0x40')](_0x1019c2['Interval'][_0x0630('0x41')]))){_0x1019c2['message']=_0x0630('0x3f');throw _0x1019c2[_0x0630('0x3b')]+_0x0630('0x3e');}};}function msgResponse(_0xd0a342,_0x264bb6,_0x5e285e){return{'action':_0xd0a342,'response':_0x264bb6,'message':_0x5e285e,'stack':_0x5e285e};}function myreject(_0x111850){return function(_0x201da4){return _0x111850(msgResponse(_0x0630('0x42'),'Error',JSON[_0x0630('0x43')](_0x201da4)));};}function getSeconds(_0x2d302c,_0x379bea){var _0x3bc306=moment(_0x2d302c)[_0x0630('0x44')](0x0);var _0x40d455=moment(_0x379bea)[_0x0630('0x44')](0x0);return _0x3bc306['diff'](_0x40d455,'seconds');}function emit(_0x393018,_0x29ce42,_0x1e7a11){io['to'](_0x393018)[_0x0630('0x45')](_0x29ce42,_0x1e7a11);}function emitVoiceQueueSummary(_0x4a8b24){if(_0x4a8b24[_0x0630('0x46')]===_0x0630('0x47')){var _0x1888c8={'id':_0x4a8b24['id'],'name':_0x4a8b24[_0x0630('0x3b')],'strategy':_0x4a8b24[_0x0630('0x48')],'answered':_0x4a8b24[_0x0630('0x49')],'available':_0x4a8b24[_0x0630('0x4a')],'loggedIn':_0x4a8b24[_0x0630('0x4b')],'pTalking':_0x4a8b24[_0x0630('0x4c')],'sumBillable':_0x4a8b24[_0x0630('0x4d')],'sumDuration':_0x4a8b24[_0x0630('0x4e')],'sumHoldTime':_0x4a8b24[_0x0630('0x4f')]||0x0,'talking':_0x4a8b24[_0x0630('0x50')],'total':_0x4a8b24['total'],'type':_0x4a8b24[_0x0630('0x46')],'unmanaged':_0x4a8b24['unmanaged'],'abandoned':_0x4a8b24[_0x0630('0x51')],'waiting':_0x4a8b24[_0x0630('0x52')],'loggedInDb':_0x4a8b24[_0x0630('0x53')],'dialActive':_0x4a8b24[_0x0630('0x54')],'dialMethod':_0x4a8b24[_0x0630('0x55')],'dialOriginateCallerIdName':_0x4a8b24[_0x0630('0x56')],'dialOriginateCallerIdNumber':_0x4a8b24[_0x0630('0x57')],'dialOriginateTimeout':_0x4a8b24[_0x0630('0x58')],'dialPrefix':_0x4a8b24[_0x0630('0x59')],'outboundAnswerAgiCallsDay':_0x4a8b24['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4a8b24[_0x0630('0x5a')],'outboundBlacklistCallsDay':_0x4a8b24[_0x0630('0x5b')],'outboundBusyCallsDay':_0x4a8b24[_0x0630('0x5c')],'outboundCongestionCallsDay':_0x4a8b24['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4a8b24[_0x0630('0x5d')],'outboundDropCallsDayCallersExit':_0x4a8b24[_0x0630('0x5e')],'outboundDropCallsDayTimeout':_0x4a8b24[_0x0630('0x5f')],'outboundNoAnswerCallsDay':_0x4a8b24[_0x0630('0x60')],'outboundNoSuchCallsDay':_0x4a8b24[_0x0630('0x61')],'outboundOriginateFailureCallsDay':_0x4a8b24[_0x0630('0x62')],'outboundReCallsDay':_0x4a8b24[_0x0630('0x63')],'outboundRejectCallsDay':_0x4a8b24[_0x0630('0x64')],'outboundUnknownCallsDay':_0x4a8b24[_0x0630('0x65')],'predictiveIntervalAnsweredCalls':_0x4a8b24[_0x0630('0x66')],'predictiveIntervalAvgHoldtime':_0x4a8b24['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a8b24['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4a8b24[_0x0630('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x4a8b24['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4a8b24[_0x0630('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a8b24[_0x0630('0x69')],'predictiveIntervalHitRate':_0x4a8b24[_0x0630('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x4a8b24['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4a8b24[_0x0630('0x6b')],'predictiveIntervalAvailable':_0x4a8b24[_0x0630('0x6c')],'predictiveIntervalTotalCalls':_0x4a8b24[_0x0630('0x6d')],'message':_0x4a8b24[_0x0630('0x3a')],'originated':_0x4a8b24[_0x0630('0x6e')],'erlangCalls':_0x4a8b24[_0x0630('0x6f')],'erlangCallToSecond':_0x4a8b24[_0x0630('0x70')],'erlangAbandonmentRate':_0x4a8b24[_0x0630('0x71')],'erlangBusyFactor':_0x4a8b24[_0x0630('0x72')],'startPredictive':_0x4a8b24['startPredictive'],'startProgressive':_0x4a8b24['startProgressive']};if(_0x4a8b24['Trunk']){_0x1888c8['Trunk']={'id':_0x4a8b24[_0x0630('0x73')]['id'],'name':_0x4a8b24[_0x0630('0x73')][_0x0630('0x3b')],'active':_0x4a8b24[_0x0630('0x73')][_0x0630('0x74')],'callerid':_0x4a8b24[_0x0630('0x73')][_0x0630('0x75')]};}if(_0x4a8b24[_0x0630('0x3d')]){_0x1888c8[_0x0630('0x3d')]={'id':_0x4a8b24[_0x0630('0x3d')]['id'],'name':_0x4a8b24[_0x0630('0x3d')][_0x0630('0x3b')]};}var _0x2757fd=md5(JSON[_0x0630('0x43')](_0x1888c8));if(_0x4a8b24[_0x0630('0x2')]!==_0x2757fd){_0x4a8b24['md5']=_0x2757fd;emit(util[_0x0630('0x76')](_0x0630('0x77'),_0x1888c8[_0x0630('0x3b')]),_0x0630('0x78'),_0x1888c8);}}}function emitCampaignSummary(_0x5cdcd9){if(_0x5cdcd9['type']===_0x0630('0x79')){emit(util[_0x0630('0x76')](_0x0630('0x7a'),_0x5cdcd9[_0x0630('0x3b')]),_0x0630('0x7b'),_0x5cdcd9);}}function checkGetDataPredictive(_0x42109e){if(isNotNull(_0x42109e)){if(!_['isEmpty'](_0x42109e)){loggerPredictive[_0x0630('0x7c')](_0x0630('0x7d'));loggerPredictive['info'](_0x0630('0x7e'),_0x42109e[_0x0630('0x6d')]);loggerPredictive[_0x0630('0x7c')](_0x0630('0x7f'),_0x42109e['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x0630('0x80'),_0x42109e['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x0630('0x7c')](_0x0630('0x81'),_0x42109e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x0630('0x82'),_0x42109e[_0x0630('0x83')]);loggerPredictive[_0x0630('0x7c')](_0x0630('0x84'),_0x42109e['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0630('0x7c')](_0x0630('0x85'));if(_0x42109e[_0x0630('0x6d')]>0x0){if(!_[_0x0630('0x39')](_0x42109e[_0x0630('0x86')])&&_0x42109e[_0x0630('0x86')]>0x0){return!![];}else{loggerPredictive[_0x0630('0x7c')](_0x0630('0x87'));}if(!_[_0x0630('0x39')](_0x42109e[_0x0630('0x83')])&&_0x42109e['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x0630('0x7c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0630('0x7c')](_0x0630('0x88'));}}else{loggerPredictive[_0x0630('0x7c')](_0x0630('0x89'));}}else{loggerPredictive[_0x0630('0x7c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3e3143){return function(_0x4cc11f){loggerPredictive[_0x0630('0x7c')](_0x0630('0x8a'));loggerPredictive[_0x0630('0x7c')](_0x0630('0x8b'),_0x4cc11f[_0x0630('0x6f')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cc11f[_0x0630('0x70')]);loggerPredictive['info'](_0x0630('0x8c'),_0x4cc11f[_0x0630('0x71')]);loggerPredictive['info'](_0x0630('0x8d'),_0x4cc11f[_0x0630('0x72')]);loggerPredictive['info'](_0x0630('0x8c'),_0x4cc11f[_0x0630('0x71')]);loggerPredictive[_0x0630('0x7c')](_0x0630('0x85'));_['merge'](_0x3e3143,_0x4cc11f);};}function getDiff(_0x4b6985){var _0x149a24=moment()['milliseconds'](0x0);var _0x128347=moment(_0x4b6985)[_0x0630('0x44')](0x0);return _0x149a24[_0x0630('0x8e')](_0x128347,_0x0630('0x8f'));}function ifInterval(_0x12b07c,_0x2e712d){if(_['isUndefined'](_0x2e712d)){return![];}if(getDiff(_0x2e712d)<_0x12b07c*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x5025b9){if(isNotNull(_0x5025b9)){if(!_[_0x0630('0x39')](_0x5025b9['startProgressive'])){_0x5025b9[_0x0630('0x27')]=undefined;loggerPredictive[_0x0630('0x7c')](_0x5025b9[_0x0630('0x3b')],_0x0630('0x90'));}if(!_['isUndefined'](_0x5025b9[_0x0630('0x26')])){_0x5025b9[_0x0630('0x26')]=undefined;loggerPredictive[_0x0630('0x7c')](_0x5025b9[_0x0630('0x3b')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0630('0x39')](_0x5025b9[_0x0630('0x91')])){clearInterval(_0x5025b9[_0x0630('0x91')]);_0x5025b9[_0x0630('0x91')]=undefined;loggerPredictive['info'](_0x5025b9[_0x0630('0x3b')],_0x0630('0x92'));}}}function erlangb(_0x5e09a7,_0x14fd31){if(_0x14fd31===0x0){return 0x0;}var _0x3fdf7b=0x1;for(var _0x7e0eb9=0x1;_0x7e0eb9<=_0x14fd31;_0x7e0eb9+=0x1){_0x3fdf7b=0x1+_0x3fdf7b*_0x7e0eb9/_0x5e09a7;}return 0x1/_0x3fdf7b;}function isVoiceQueueOutbound(_0xbea2aa){return _0xbea2aa==='outbound';}function isNotPreview(_0x30a14e){return _0x30a14e!=='preview';}function isCampaignIvr(_0x5dda60){return _0x5dda60==='ivr';}function getCallerId(_0x16ec51,_0x286505,_0x47602b){if(!_[_0x0630('0x39')](_0x47602b)&&_0x0630('0x93')===typeof _0x47602b&&!_[_0x0630('0x40')](_0x47602b)){if(!_[_0x0630('0x39')](_0x286505)&&_0x0630('0x93')===typeof _0x286505&&!_[_0x0630('0x40')](_0x286505)){return util[_0x0630('0x76')](_0x0630('0x94'),_0x286505,_0x47602b);}return util['format'](_0x0630('0x94'),_0x47602b,_0x47602b);}if(!_[_0x0630('0x39')](_0x16ec51)&&_0x0630('0x93')===typeof _0x16ec51&&!_[_0x0630('0x40')](_0x16ec51)){return _0x16ec51;}return _0x0630('0x95');}function loggerCatchQueueSummary(_0x44407b,_0x11d9d4){return function(_0x33d2f7){freeVariablesPredictive(_0x11d9d4);emitVoiceQueueSummary(_0x11d9d4);emitCampaignSummary(_0x11d9d4);loggerSyncQueueSummary[_0x0630('0x96')](_0x44407b,util[_0x0630('0x97')](_0x33d2f7,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5b9b40,_0x3c5b2f){return function(_0x18ebfc){loggerPredictive[_0x0630('0x96')](_0x3c5b2f[_0x0630('0x3b')],_0x5b9b40);loggerPredictive[_0x0630('0x96')](_0x18ebfc['stack']);freeVariablesPredictive(_0x3c5b2f);};}function loggerCatch(_0x2a8325){return function(_0x343c6f){logger[_0x0630('0x96')](_0x2a8325,util[_0x0630('0x97')](_0x343c6f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x150336){return _0x150336&&!_[_0x0630('0x39')](_0x150336)&&_0x150336[_0x0630('0x98')]>0x0;}function decremetOriginate(_0x195847){if(!_['isUndefined'](_0x195847)&&_0x195847!==null){if(_0x195847[_0x0630('0x99')](_0x0630('0x6e'))){if(_0x195847[_0x0630('0x6e')]>0x0){_0x195847['originated']-=0x1;}else{logger[_0x0630('0x96')](_0x0630('0x9a'));}}}else{logger[_0x0630('0x96')](_0x0630('0x9b'));}}function checkContactLowerLimitOriginate(_0x1bc952,_0x4b0ade,_0x539b76){if(_0x4b0ade>_0x539b76){for(var _0x277577=0x0;_0x277577<_0x4b0ade-_0x539b76;_0x277577+=0x1){decremetOriginate(_0x1bc952);}}}function loggerGetContactDialer(_0x18bb62,_0x305451,_0x5c64b9){return function(_0x2293ee){checkContactLowerLimitOriginate(_0x305451,_0x5c64b9,0x0);logger[_0x0630('0x96')](_0x18bb62,util[_0x0630('0x97')](_0x2293ee,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x288c7f){return function(_0x313ac1){if(isNotNull(_0x313ac1)&&isNotNull(_0x313ac1[0x0])){if(_0x313ac1[0x0][_0x0630('0x9c')]>0x0){_0x288c7f[_0x0630('0x3a')]='RESCHEDULED_CONTACTS';logger['info'](_0x0630('0x9d')+_0x288c7f[_0x0630('0x3b')],_0x313ac1[0x0][_0x0630('0x9c')],_0x0630('0x9e'));}else{_0x288c7f[_0x0630('0x3a')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x0630('0x7c')]('[getContactDialer2][Empty]'+_0x288c7f[_0x0630('0x3b')]);}}};}function notSendMessagesQueue(_0x2ce7ec){if(_0x2ce7ec[_0x0630('0x9f')]){freeVariablesPredictive(_0x2ce7ec);if(_0x2ce7ec[_0x0630('0x6e')]===0x0&&_0x2ce7ec[_0x0630('0x50')]===0x0&&_0x2ce7ec['waiting']===0x0&&(_0x2ce7ec[_0x0630('0x4c')]||0x0)===0x0){_0x2ce7ec['sendMessageOneNotActive']=![];_0x2ce7ec['available']=0x0;_0x2ce7ec['message']=_0x0630('0xa0');loggerSyncQueueSummary['error'](_0x0630('0xa1'),_0x2ce7ec[_0x0630('0x3b')],_0x0630('0xa2'));}else{_0x2ce7ec[_0x0630('0x3a')]=_0x0630('0xa3');loggerSyncQueueSummary[_0x0630('0x96')](_0x0630('0xa1'),_0x2ce7ec[_0x0630('0x3b')],_0x0630('0xa4'));}emitVoiceQueueSummary(_0x2ce7ec);}}function notSendMessagesCampaign(_0x39eba5){if(_0x39eba5[_0x0630('0x9f')]){if(_0x39eba5[_0x0630('0x6e')]===0x0){_0x39eba5[_0x0630('0x9f')]=![];_0x39eba5[_0x0630('0x3a')]=_0x0630('0xa0');loggerSyncQueueSummary[_0x0630('0x96')](_0x0630('0xa5'),_0x39eba5[_0x0630('0x3b')],_0x0630('0xa2'));}else{_0x39eba5['message']=_0x0630('0xa3');loggerSyncQueueSummary[_0x0630('0x96')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x39eba5[_0x0630('0x3b')],_0x0630('0xa4'));}emitCampaignSummary(_0x39eba5);}}function createObjHistory(_0x4700e0,_0x7db848,_0x5b1b45,_0x881cc,_0x5dbb18){_0x4700e0[_0x0630('0x3a')]=_0x5b1b45;var _0xbaf8a3=new Action(_0x4700e0,_0x7db848);var _0x4804a4=new History(_0xbaf8a3);_0x4804a4[_0x0630('0xa6')]=_0x881cc;_0x4804a4[_0x0630('0xa7')]=_0x5dbb18;_0x4804a4[_0x0630('0xa8')]=_0xbaf8a3[_0x0630('0xa9')];return _0x4804a4;}Dialer['prototype'][_0x0630('0x38')]=function(){var _0x280bf3=this;setInterval(function(){_0x280bf3[_0x0630('0xaa')](_0x280bf3[_0x0630('0xab')],_0x0630('0xac'));_0x280bf3[_0x0630('0xaa')](_0x280bf3['actions'],_0x0630('0xad'));},0x32c8);};Dialer[_0x0630('0xae')]['clearZombieChannels']=function(_0x4fedfc,_0x11b4b7){var _0x570b42=this;for(var _0x2a8cca in _0x4fedfc){if(_0x4fedfc[_0x0630('0x99')](_0x2a8cca)){this[_0x0630('0x1e')][_0x0630('0x1b')](function(){if(!_[_0x0630('0xaf')](_0x4fedfc[_0x2a8cca])){return ami[_0x0630('0xb0')]({'action':_0x0630('0xb1'),'channel':_0x4fedfc[_0x2a8cca]['channel']})[_0x0630('0xb2')](function(_0x2e0bef){if(_0x2e0bef[_0x0630('0x3a')]===_0x0630('0xb3')){setTimeout(function(){if(_0x4fedfc[_0x2a8cca]&&_0x4fedfc[_0x2a8cca][_0x0630('0x46')]!=='ivr'){_0x570b42[_0x0630('0xb4')](_0x570b42['voiceQueues'][_0x4fedfc[_0x2a8cca][_0x0630('0xb5')]]);logger[_0x0630('0x96')](_0x0630('0xb6'),_0x11b4b7,_0x2a8cca,_0x4fedfc[_0x2a8cca][_0x0630('0xb5')]);delete _0x4fedfc[_0x2a8cca];}if(_0x4fedfc[_0x2a8cca]&&_0x4fedfc[_0x2a8cca][_0x0630('0x46')]===_0x0630('0x79')){_0x570b42[_0x0630('0xb4')](_0x570b42[_0x0630('0x20')][_0x4fedfc[_0x2a8cca][_0x0630('0xb5')]]);logger[_0x0630('0x96')]('[Dialer][checkChannel][ivr]',_0x11b4b7,_0x2a8cca,_0x4fedfc[_0x2a8cca]['queue']);delete _0x4fedfc[_0x2a8cca];}},0x2328);}});}});}}};Dialer[_0x0630('0xae')][_0x0630('0xb7')]=function(_0xdc3934){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopper['countReScheduled'](_0xdc3934))['catch'](loggerCatch(_0x0630('0xba')));};Dialer[_0x0630('0xae')][_0x0630('0xbb')]=function(_0x31588a){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopperBlack['checkIsBlackList'](_0x31588a))[_0x0630('0xb2')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x0630('0xae')][_0x0630('0xbc')]=function(_0x3fc2b2){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopperBlack[_0x0630('0xbc')](_0x3fc2b2))['catch'](loggerCatch(_0x0630('0xbd')));};Dialer[_0x0630('0xae')][_0x0630('0xbe')]=function(_0x59ce13){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopperHistory[_0x0630('0xbf')](_0x59ce13))[_0x0630('0xb2')](loggerCatch(_0x0630('0xc0')));};Dialer['prototype'][_0x0630('0xc1')]=function(_0x35978b){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopper[_0x0630('0xc1')](_0x35978b))['catch'](loggerCatch(_0x0630('0xc2')));};Dialer['prototype'][_0x0630('0xc3')]=function(_0x347e74,_0x5895ad,_0x43e22a){return BPromise[_0x0630('0xb8')]()['then'](cmHopper[_0x0630('0xc3')](_0x347e74,_0x5895ad,_0x43e22a))[_0x0630('0xb2')](loggerCatch(_0x0630('0xc4')));};Dialer[_0x0630('0xae')][_0x0630('0xc5')]=function(_0x21ce7b,_0xd86eed,_0x14bb24,_0xbdfe52){return BPromise[_0x0630('0xb8')]()['then'](cmHopper[_0x0630('0xc5')](_0x21ce7b,_0xd86eed,_0x14bb24,_0xbdfe52))['catch'](loggerCatch(_0x0630('0xc6')));};Dialer[_0x0630('0xae')][_0x0630('0xc7')]=function(_0x51d807,_0x26fdc9,_0x4c9517){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopper['getContactDialerIvr'](_0x51d807,_0x26fdc9,_0x4c9517))[_0x0630('0xb2')](loggerCatch(_0x0630('0xc6')));};Dialer[_0x0630('0xae')][_0x0630('0xc8')]=function(_0x176c0a){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](voiceQueueRt['getVoiceQueueRtPauses'](_0x176c0a))[_0x0630('0xb2')](loggerCatch(_0x0630('0xc9')));};Dialer[_0x0630('0xae')][_0x0630('0xca')]=function(_0xaa1e7a){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopper[_0x0630('0xca')](_0xaa1e7a))[_0x0630('0xb2')](loggerCatch(_0x0630('0xcb')));};Dialer[_0x0630('0xae')][_0x0630('0xcc')]=function(_0x1031ab){return BPromise[_0x0630('0xb8')]()[_0x0630('0xb9')](cmHopperHistory['createHistory'](_0x1031ab))[_0x0630('0xb2')](loggerCatch('[createHistory]\x20'));};Dialer[_0x0630('0xae')][_0x0630('0xb4')]=function(_0x5669c2){if(!_[_0x0630('0x39')](_0x5669c2)&&_0x5669c2!==null){if(_0x5669c2[_0x0630('0x99')](_0x0630('0x6e'))){if(_0x5669c2[_0x0630('0x6e')]>0x0){_0x5669c2[_0x0630('0x6e')]-=0x1;}else{logger[_0x0630('0x96')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0630('0x96')](_0x0630('0xcd'));}};Dialer[_0x0630('0xae')][_0x0630('0xce')]=function(_0x95f199,_0x245f4e){var _0xd21739=this;return function(_0x39a299){_0xd21739[_0x0630('0xb4')](_0x245f4e);logger[_0x0630('0x96')](_0x95f199,util[_0x0630('0x97')](_0x39a299,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x5d8a33,_0x1fcd57,_0x425f26){var _0x1cf493={'state':0x19,'statedesc':'notFound'};this[_0x0630('0xb4')](_0x1fcd57);this['saveInDb'](_[_0x0630('0xcf')](_0x1cf493,_[_0x0630('0xd0')](_0x425f26,['ContactId',_0x0630('0xd1'),'UserId',_0x0630('0xd2'),'CampaignId'])),_0x0630('0xd3'),_0x0630('0xd4'));logger[_0x0630('0x96')](_0x5d8a33);};Dialer[_0x0630('0xae')][_0x0630('0xd5')]=function(_0x3aea16){return _0x3aea16==='Success';};Dialer[_0x0630('0xae')]['isTrunkReachable']=function(_0x4c0e96){return!_[_0x0630('0x39')](_0x4c0e96)&&_0x4c0e96&&!_[_0x0630('0x39')](_0x4c0e96[_0x0630('0x3b')])&&!_[_0x0630('0x39')](_0x4c0e96[_0x0630('0x74')])&&_0x4c0e96[_0x0630('0x74')]&&(this[_0x0630('0x22')][util[_0x0630('0x76')](_0x0630('0xd6'),_0x4c0e96[_0x0630('0x3b')])][_0x0630('0xb1')]===_0x0630('0xd7')||this['trunks'][util['format'](_0x0630('0xd6'),_0x4c0e96[_0x0630('0x3b')])][_0x0630('0xb1')]==='unmonitored');};Dialer[_0x0630('0xae')]['saveInDb']=function(_0x2b732f,_0xeb5aac,_0x216c8d){this[_0x0630('0xcc')](_0x2b732f)[_0x0630('0xb2')](loggerCatch(_0xeb5aac));this[_0x0630('0xca')](_0x2b732f)[_0x0630('0xb2')](loggerCatch(_0x216c8d));};Dialer['prototype'][_0x0630('0x34')]=function(_0x17656e){var _0x4b57a9=this[_0x0630('0xab')][_0x17656e[_0x0630('0xd8')]];var _0x4bc50a;if(!_['isNil'](_0x17656e)&&!_[_0x0630('0xaf')](_0x17656e[_0x0630('0xd9')])&&!_[_0x0630('0xaf')](_0x17656e['variable'][_0x0630('0xda')])&&_0x17656e[_0x0630('0xdb')]===_0x0630('0xdc')&&_0x4b57a9){if(_0x4b57a9[_0x0630('0x46')]!=='ivr'&&this['voiceQueues'][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdd')]&&_0x17656e['value']==='HANGUP'){delete this[_0x0630('0xab')][_0x17656e[_0x0630('0xd8')]];this[_0x0630('0xb4')](this[_0x0630('0xde')][_0x4b57a9[_0x0630('0xb5')]]);this[_0x0630('0xde')][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0x5a')]+=0x1;this['voiceQueues'][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdf')]+=0x1;_0x4bc50a=new Hangup(_0x4b57a9,_0x17656e);_0x4bc50a[_0x0630('0xa6')]=0x12;_0x4bc50a[_0x0630('0xa7')]='HangupInAMD';_0x4bc50a['membername']=_0x0630('0xe0');this[_0x0630('0xe1')](_0x4bc50a,'[syncHangupInAMD][createHistory]',_0x0630('0xe2'));}if(_0x4b57a9[_0x0630('0x46')]!==_0x0630('0x79')&&this[_0x0630('0xde')][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdd')]&&_0x17656e['value']===_0x0630('0xe3')){var _0x4be10c=this;return new BPromise(function(_0x1321eb,_0x59b729){delete _0x4be10c[_0x0630('0xab')][_0x17656e['uniqueid']];_0x4be10c[_0x0630('0xb4')](_0x4be10c['voiceQueues'][_0x4b57a9[_0x0630('0xb5')]]);_0x4be10c[_0x0630('0xde')][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0x5a')]+=0x1;_0x4be10c['voiceQueues'][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdf')]+=0x1;var _0x3d54ea=_0x4be10c[_0x0630('0xde')][_0x4b57a9[_0x0630('0xb5')]];var _0x1a15ce=new Hangup(_0x4b57a9,_0x17656e);_0x1a15ce['state']=0x13;_0x1a15ce['statedesc']='Machine';_0x1a15ce['membername']=_0x0630('0xe0');_0x1a15ce[_0x0630('0xe4')]+=0x1;_0x1a15ce['countglobal']+=0x1;_0x1a15ce['amd']=!![];_0x4be10c[_0x0630('0xcc')](_0x1a15ce)['catch'](loggerCatch(_0x0630('0xe5')));if(_0x1a15ce['countbusyretry']+_0x1a15ce[_0x0630('0xe6')]+_0x1a15ce['countnoanswerretry']+_0x1a15ce[_0x0630('0xe7')]+_0x1a15ce[_0x0630('0xe8')]+_0x1a15ce[_0x0630('0xe9')]+_0x1a15ce[_0x0630('0xe4')]+_0x1a15ce[_0x0630('0xea')]>=_0x3d54ea[_0x0630('0xeb')]){_0x4be10c[_0x0630('0xec')](_0x1a15ce,_0x1321eb,_0x59b729,_0x0630('0xed'));}else{if(_0x1a15ce[_0x0630('0xe4')]>=_0x3d54ea[_0x0630('0xee')]){_0x4be10c[_0x0630('0xef')](_0x1a15ce,_0x1321eb,_0x59b729,'reason\x2019\x20machine....');}else{_0x4be10c[_0x0630('0xc1')]({'active':![],'countmachineretry':_0x1a15ce[_0x0630('0xe4')],'scheduledat':moment()[_0x0630('0xf0')](_0x3d54ea['dialMachineRetryFrequency'],_0x0630('0xf1'))['format'](_0x0630('0xf2')),'ContactId':_0x1a15ce[_0x0630('0xf3')],'ListId':_0x1a15ce[_0x0630('0xd1')],'VoiceQueueId':_0x1a15ce[_0x0630('0xd2')]||undefined,'CampaignId':_0x1a15ce['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x1321eb({'reschedule':0x1});}}});}if(_0x4b57a9[_0x0630('0x46')]==='ivr'&&this[_0x0630('0x20')][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdd')]&&_0x17656e['value']==='HANGUP'){delete this[_0x0630('0xab')][_0x17656e[_0x0630('0xd8')]];this[_0x0630('0xb4')](this[_0x0630('0x20')][_0x4b57a9[_0x0630('0xb5')]]);_0x4bc50a=new Hangup(_0x4b57a9,_0x17656e);_0x4bc50a[_0x0630('0xa6')]=0x12;_0x4bc50a[_0x0630('0xa7')]=_0x0630('0xf4');_0x4bc50a[_0x0630('0xf5')]=_0x0630('0xe0');this[_0x0630('0xe1')](_0x4bc50a,_0x0630('0xf6'),_0x0630('0xf7'));}if(_0x4b57a9['type']==='ivr'&&this['campaigns'][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdd')]&&_0x17656e[_0x0630('0xf8')]===_0x0630('0xe3')){var _0x4be10c=this;return new BPromise(function(_0x1e25aa,_0x2e65b7){delete _0x4be10c[_0x0630('0xab')][_0x17656e[_0x0630('0xd8')]];_0x4be10c[_0x0630('0xb4')](_0x4be10c['campaigns'][_0x4b57a9[_0x0630('0xb5')]]);_0x4be10c['campaigns'][_0x4b57a9['queue']][_0x0630('0x5a')]+=0x1;_0x4be10c[_0x0630('0x20')][_0x4b57a9[_0x0630('0xb5')]][_0x0630('0xdf')]+=0x1;var _0x2d824d=_0x4be10c[_0x0630('0x20')][_0x4b57a9[_0x0630('0xb5')]];var _0x3de41f=new Hangup(_0x4b57a9,_0x17656e);_0x3de41f[_0x0630('0xa6')]=0x13;_0x3de41f[_0x0630('0xa7')]='Machine';_0x3de41f[_0x0630('0xf5')]=_0x0630('0xe0');_0x3de41f[_0x0630('0xe4')]+=0x1;_0x3de41f[_0x0630('0xf9')]+=0x1;_0x3de41f[_0x0630('0xfa')]=!![];_0x4be10c['createHistory'](_0x3de41f)['catch'](loggerCatch(_0x0630('0xe5')));if(_0x3de41f[_0x0630('0xfb')]+_0x3de41f['countcongestionretry']+_0x3de41f['countnoanswerretry']+_0x3de41f[_0x0630('0xe7')]+_0x3de41f[_0x0630('0xe8')]+_0x3de41f['countabandonedretry']+_0x3de41f[_0x0630('0xe4')]+_0x3de41f[_0x0630('0xea')]>=_0x2d824d[_0x0630('0xeb')]){_0x4be10c[_0x0630('0xec')](_0x3de41f,_0x1e25aa,_0x2e65b7,_0x0630('0xed'));}else{if(_0x3de41f[_0x0630('0xe4')]>=_0x2d824d['dialMachineMaxRetry']){_0x4be10c[_0x0630('0xef')](_0x3de41f,_0x1e25aa,_0x2e65b7,_0x0630('0xfc'));}else{_0x4be10c['rescheduleContact']({'active':![],'countmachineretry':_0x3de41f[_0x0630('0xe4')],'scheduledat':moment()[_0x0630('0xf0')](_0x2d824d[_0x0630('0xfd')],_0x0630('0xf1'))[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3de41f[_0x0630('0xf3')],'ListId':_0x3de41f['ListId'],'VoiceQueueId':_0x3de41f[_0x0630('0xd2')]||undefined,'CampaignId':_0x3de41f[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0xff')));_0x1e25aa({'reschedule':0x1});}}});}}};Dialer[_0x0630('0xae')][_0x0630('0x100')]=function(_0xecf40){var _0x2965d8=this[_0x0630('0xab')][_0xecf40[_0x0630('0xd8')]];var _0x446282=this;var _0x2459b3;if(_0x2965d8&&_0x2965d8['type']===_0x0630('0x79')){delete this['uniqueId'][_0xecf40[_0x0630('0xd8')]];this[_0x0630('0xb4')](this[_0x0630('0x20')][_0x2965d8['queue']]);this[_0x0630('0x20')][_0x2965d8['queue']]['ivrAnswerCallsDay']+=0x1;_0x2459b3=new Hangup(_0x2965d8,_0xecf40);this['createHistory'](_0x2459b3)[_0x0630('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0630('0xca')](_0x2459b3)[_0x0630('0xb2')](loggerCatch('[syncHangupIvr]'));}if(_0x2965d8&&_0x2965d8[_0x0630('0x46')]!==_0x0630('0x79')&&isNotNull(this['voiceQueues'][_0x2965d8[_0x0630('0xb5')]][_0x0630('0x101')])){delete this[_0x0630('0xab')][_0xecf40[_0x0630('0xd8')]];this[_0x0630('0xb4')](this[_0x0630('0xde')][_0x2965d8['queue']]);this[_0x0630('0xde')][_0x2965d8[_0x0630('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x2965d8['queue']][_0x0630('0xdf')]+=0x1;_0x2459b3=new Hangup(_0x2965d8,_0xecf40);_0x2459b3[_0x0630('0xa6')]=0x10;_0x2459b3[_0x0630('0xa7')]=_0x0630('0x102');_0x2459b3[_0x0630('0xf5')]='AGI';this[_0x0630('0xcc')](_0x2459b3)[_0x0630('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x2459b3)[_0x0630('0xb2')](loggerCatch(_0x0630('0x103')));}if(_0x2965d8&&_0x2965d8['type']!==_0x0630('0x79')&&!isNotNull(this['voiceQueues'][_0x2965d8[_0x0630('0xb5')]]['dialQueueProject'])){delete this['uniqueId'][_0xecf40[_0x0630('0xd8')]];this[_0x0630('0xb4')](this[_0x0630('0xde')][_0x2965d8[_0x0630('0xb5')]]);this[_0x0630('0xde')][_0x2965d8['queue']][_0x0630('0x65')]+=0x1;_0x2459b3=new Hangup(_0x2965d8,_0xecf40);_0x2459b3[_0x0630('0xa6')]=0xc;_0x2459b3['statedesc']=_0xecf40[_0x0630('0x104')];_0x2459b3[_0x0630('0xf5')]=_0x0630('0x105');this[_0x0630('0xcc')](_0x2459b3)[_0x0630('0xb2')](loggerCatch(_0x0630('0x106')));this[_0x0630('0xca')](_0x2459b3)[_0x0630('0xb2')](loggerCatch(_0x0630('0x103')));}};Dialer[_0x0630('0xae')]['syncAgentComplete']=function(_0x595a96){var _0x52c61b=this[_0x0630('0xab')][_0x595a96[_0x0630('0xd8')]];var _0x220560=this;if(this[_0x0630('0xde')][_0x595a96[_0x0630('0xb5')]]){if(_0x52c61b&&_0x52c61b['type']!==_0x0630('0x79')){delete this['uniqueId'][_0x595a96[_0x0630('0xd8')]];this[_0x0630('0xde')][_0x595a96[_0x0630('0xb5')]][_0x0630('0x5a')]+=0x1;var _0x98a321=new AgentComplete(_0x52c61b,_0x595a96);if(_0x595a96['reason']===_0x0630('0x107')){_0x98a321[_0x0630('0x108')]=this[_0x0630('0xde')][_0x595a96['queue']][_0x0630('0x109')]&&this[_0x0630('0xde')][_0x595a96[_0x0630('0xb5')]][_0x0630('0x10a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0630('0xcc')](_0x98a321)[_0x0630('0xb2')](loggerCatch(_0x0630('0x10b')));this[_0x0630('0xca')](_0x98a321)[_0x0630('0xb2')](loggerCatch(_0x0630('0x10c')));}}};Dialer[_0x0630('0xae')][_0x0630('0x10d')]=function(_0x4a27c6){if(this[_0x0630('0xde')][_0x4a27c6[_0x0630('0xb5')]]){if(this[_0x0630('0xab')][_0x4a27c6[_0x0630('0xd8')]]&&this[_0x0630('0xab')][_0x4a27c6['uniqueid']][_0x0630('0x46')]!==_0x0630('0x79')){this[_0x0630('0xb4')](this[_0x0630('0xde')][_0x4a27c6['queue']]);this[_0x0630('0xab')][_0x4a27c6[_0x0630('0xd8')]][_0x0630('0x10e')]=moment()[_0x0630('0x76')](_0x0630('0xf2'));}}};Dialer[_0x0630('0xae')][_0x0630('0x10f')]=function(_0x96aa87){this[_0x0630('0xcc')](_0x96aa87)[_0x0630('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0630('0xca')](_0x96aa87)[_0x0630('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x0630('0xae')]['syncQueueCallerAbandon']=function(_0x344e4d){var _0x542799=this[_0x0630('0xab')][_0x344e4d['uniqueid']];var _0xcb3e51=this;if(this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]]){if(_0x542799&&_0x542799[_0x0630('0x46')]!==_0x0630('0x79')){delete this[_0x0630('0xab')][_0x344e4d['uniqueid']];this[_0x0630('0xb4')](this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]]);_0x542799['droptime']=moment()[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x533fdd=new QueueCallerAbandon(_0x542799,_0x344e4d);if(getSeconds(_0x542799[_0x0630('0x110')],_0x542799['responsetime'])>=_0x542799[_0x0630('0x111')]){this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]][_0x0630('0x5f')]+=0x1;this['voiceQueues'][_0x344e4d[_0x0630('0xb5')]][_0x0630('0x69')]+=0x1;_0x533fdd[_0x0630('0xa6')]=0xa;_0x533fdd[_0x0630('0xa7')]=_0x0630('0x112');_0x533fdd[_0x0630('0x113')]=_0x0630('0x114');_0x533fdd[_0x0630('0x108')]=this['voiceQueues'][_0x344e4d['queue']][_0x0630('0x109')]?moment()[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x533fdd['countdropretry']+=0x1;_0x533fdd['countglobal']+=0x1;if(_0x533fdd[_0x0630('0xe8')]>=this['voiceQueues'][_0x344e4d['queue']][_0x0630('0x115')]){this[_0x0630('0x10f')](_0x533fdd);}else{this[_0x0630('0xc1')]({'active':![],'countdropretry':_0x533fdd[_0x0630('0xe8')],'scheduledat':moment()[_0x0630('0xf0')](this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]][_0x0630('0x116')],_0x0630('0xf1'))[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x542799[_0x0630('0xf3')],'ListId':_0x542799[_0x0630('0xd1')],'VoiceQueueId':_0x542799['VoiceQueueId']||undefined,'CampaignId':_0x542799[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x117')));var _0x38d197=new History(_0x533fdd);_0x38d197[_0x0630('0xa6')]=0xa;_0x38d197[_0x0630('0xa7')]=_0x0630('0x112');_0x38d197[_0x0630('0xa9')]=moment()['format'](_0x0630('0xf2'));_0x38d197[_0x0630('0xa8')]=_0x38d197[_0x0630('0xa9')];_0x38d197['calleridname']=_0x533fdd[_0x0630('0x118')];_0x38d197[_0x0630('0x119')]=_0x533fdd[_0x0630('0x119')];this[_0x0630('0xcc')](_0x38d197)[_0x0630('0xb2')](loggerCatch(_0x0630('0x11a')));}}else{this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]][_0x0630('0x67')]+=0x1;this[_0x0630('0xde')][_0x344e4d['queue']][_0x0630('0x5e')]+=0x1;_0x533fdd['state']=0xb;_0x533fdd[_0x0630('0xa7')]=_0x0630('0x11b');_0x533fdd[_0x0630('0x113')]=_0x0630('0x11c');_0x533fdd[_0x0630('0xe9')]+=0x1;_0x533fdd[_0x0630('0xf9')]+=0x1;if(_0x533fdd[_0x0630('0xe9')]>=this[_0x0630('0xde')][_0x344e4d[_0x0630('0xb5')]][_0x0630('0x11d')]){this[_0x0630('0x10f')](_0x533fdd);}else{this[_0x0630('0xc1')]({'active':![],'countabandonedretry':_0x533fdd[_0x0630('0xe9')],'scheduledat':moment()[_0x0630('0xf0')](this[_0x0630('0xde')][_0x344e4d['queue']][_0x0630('0x11e')],_0x0630('0xf1'))['format'](_0x0630('0xf2')),'ContactId':_0x542799[_0x0630('0xf3')],'ListId':_0x542799['ListId'],'VoiceQueueId':_0x542799[_0x0630('0xd2')]||undefined,'CampaignId':_0x542799['CampaignId']||undefined})[_0x0630('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x38d197=new History(_0x533fdd);_0x38d197['state']=0xb;_0x38d197[_0x0630('0xa7')]=_0x0630('0x11b');_0x38d197[_0x0630('0xa9')]=moment()[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x38d197[_0x0630('0xa8')]=_0x38d197['starttime'];_0x38d197[_0x0630('0x118')]=_0x533fdd[_0x0630('0x118')];_0x38d197[_0x0630('0x119')]=_0x533fdd[_0x0630('0x119')];this[_0x0630('0xcc')](_0x38d197)['catch'](loggerCatch(_0x0630('0x11f')));}}}}};Dialer[_0x0630('0xae')][_0x0630('0x33')]=function(_0x2479b8){if(this[_0x0630('0x24')][_0x2479b8['uniqueid']]){this['actions'][_0x2479b8[_0x0630('0xd8')]][_0x0630('0x120')]=_0x2479b8['channel'];}if(this[_0x0630('0xab')][_0x2479b8[_0x0630('0xd8')]]){this[_0x0630('0xab')][_0x2479b8[_0x0630('0xd8')]][_0x0630('0x120')]=_0x2479b8[_0x0630('0x120')];}};Dialer[_0x0630('0xae')][_0x0630('0x121')]=function(_0x208e1c){if(strategy[this[_0x0630('0xde')][this[_0x0630('0x24')][_0x208e1c['actionid']][_0x0630('0xb5')]][_0x0630('0x48')]]==='roundrobin'){if(this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]]&&_[_0x0630('0xaf')](this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]][_0x0630('0x123')])&&_0x208e1c[_0x0630('0xb1')]==='1'&&_0x208e1c[_0x0630('0x124')]==='0'){if(this[_0x0630('0x21')][_0x208e1c[_0x0630('0x125')]]){if(!this[_0x0630('0x21')][_0x208e1c[_0x0630('0x125')]][_0x0630('0x123')]){this[_0x0630('0x21')][_0x208e1c['stateinterface']]['locked']=!![];this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]]['locked']=!![];this[_0x0630('0x24')][_0x208e1c['actionid']][_0x0630('0x125')]=_0x208e1c[_0x0630('0x125')];}}}}else if((strategy[this['voiceQueues'][this[_0x0630('0x24')][_0x208e1c['actionid']]['queue']][_0x0630('0x48')]]||_0x0630('0x126'))==='rrmemory'){if(this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]]){if(this[_0x0630('0x21')][_0x208e1c[_0x0630('0x125')]]){this['actions'][_0x208e1c[_0x0630('0x122')]][_0x0630('0x125')]=_0x208e1c[_0x0630('0x125')];if(_[_0x0630('0xaf')](this['queueBooked'][this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]][_0x0630('0xb5')]])){this[_0x0630('0x127')][this[_0x0630('0x24')][_0x208e1c['actionid']][_0x0630('0xb5')]]=[];}this[_0x0630('0x127')][this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]]['queue']][_0x0630('0x128')](_[_0x0630('0xcf')](_[_0x0630('0xd0')](this[_0x0630('0x24')][_0x208e1c[_0x0630('0x122')]],[_0x0630('0x129'),_0x0630('0x125')]),{'status':_0x208e1c[_0x0630('0xb1')],'paused':_0x208e1c['paused']}));}}}};function unlockQueueStatus(_0x4fcfa2,_0x7b8679){setTimeout(function(){if(_['isUndefined'](_0x4fcfa2[_0x0630('0x12a')])){loggerBooked[_0x0630('0x96')](_0x0630('0x12b'),_0x7b8679);}_0x4fcfa2[_0x0630('0x12a')]=!![];loggerBooked[_0x0630('0x7c')](_0x0630('0x12c'),_0x7b8679,JSON[_0x0630('0x43')](_['pick'](_0x4fcfa2,[_0x0630('0x3b'),_0x0630('0x12a')])));},0x1f3);}Dialer['prototype'][_0x0630('0x37')]=function(_0x343497){var _0x31e548=this;var _0xbe846c=_0x31e548[_0x0630('0xde')][_0x31e548['actions'][_0x343497[_0x0630('0x122')]]['queue']];if(strategy[this[_0x0630('0xde')][this['actions'][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]][_0x0630('0x48')]]===_0x0630('0x12d')){if(this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]]&&this['actions'][_0x343497[_0x0630('0x122')]][_0x0630('0x125')]){this[_0x0630('0x1f')]['run'](this['actions'][_0x343497['actionid']][_0x0630('0x129')],this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0x125')])[_0x0630('0xb2')](function(_0xded0b4){logger[_0x0630('0x96')](_0x0630('0x12e'),util['inspect'](_0xded0b4,{'showHidden':![],'depth':null}));})[_0x0630('0x1d')](function(){_0x31e548[_0x0630('0xb4')](_0x31e548[_0x0630('0xde')][_0x31e548[_0x0630('0x24')][_0x343497[_0x0630('0x122')]]['queue']]);_0x31e548[_0x0630('0x21')][_0x31e548[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0x125')]]['locked']=![];delete _0x31e548[_0x0630('0x24')][_0x343497['actionid']];unlockQueueStatus(_0xbe846c);});}else{this['updateOriginated'](this[_0x0630('0xde')][this['actions'][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]);this[_0x0630('0xc1')]({'active':![],'ContactId':this['actions'][_0x343497[_0x0630('0x122')]][_0x0630('0xf3')],'ListId':this['actions'][_0x343497['actionid']]['ListId'],'VoiceQueueId':this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xd2')]||undefined,'CampaignId':this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x12f')));delete this[_0x0630('0x24')][_0x343497['actionid']];unlockQueueStatus(_0xbe846c);}}else if((strategy[this['voiceQueues'][this['actions'][_0x343497[_0x0630('0x122')]]['queue']][_0x0630('0x48')]]||_0x0630('0x126'))==='rrmemory'){var _0x57e9f6;if(this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]]&&!_['isEmpty'](this[_0x0630('0x127')][this[_0x0630('0x24')][_0x343497['actionid']][_0x0630('0xb5')]])){if(this['queueBookedRR'][_0x31e548[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]){this['queueBookedRR'][_0x31e548[_0x0630('0x24')][_0x343497['actionid']][_0x0630('0xb5')]]=this[_0x0630('0x130')][this[_0x0630('0x24')][_0x343497['actionid']][_0x0630('0xb5')]]?this[_0x0630('0x130')][this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]:this['queueBooked'][this['actions'][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]?this['queueBooked'][this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]['_rr']||0x0:0x0;}this[_0x0630('0x127')][this[_0x0630('0x24')][_0x343497[_0x0630('0x122')]][_0x0630('0xb5')]]['_rr']=this[_0x0630('0x130')][this[_0x0630('0x24')][_0x343497['actionid']][_0x0630('0xb5')]];for(var _0x2b669a=0x0;_0x2b669a=0x0?!![]:![];})[_0x0630('0xb2')](myreject(_0x2ff92e)));}}else{_0x5ed9a8[_0x0630('0x128')](ami['Action']({'action':_0x0630('0x149'),'command':util[_0x0630('0x76')](_0x0630('0x14a'),_0x16cf28,!_[_0x0630('0x39')](config[_0x0630('0x14f')][_0x5464ae])?_0x5464ae:'')})[_0x0630('0xb9')](function(_0x30faff){return _0x30faff['content'][_0x0630('0x14d')](_0x0630('0x14e'))>=0x0?!![]:![];})[_0x0630('0xb2')](myreject(_0x2ff92e)));}BPromise['all'](_0x5ed9a8)[_0x0630('0xb9')](function(_0x342920){var _0x28bc15=_[_0x0630('0x150')](_0x342920);if(_0x28bc15){return _0x1be589(_0x28bc15);}else{_0x325471[_0x0630('0x3a')]=_0x573008?_0x0630('0x151'):'INTERVAL_IS_OVERTIME';return _0x2ff92e(msgResponse(_0x0630('0x152'),_0x0630('0x143'),_0x0630('0x153')+_0x573008+'\x20'+_0x431cee+_0x0630('0x154')+util[_0x0630('0x97')](_0x16cf28,{'showHidden':![],'depth':null})+_0x0630('0x155')+_0x5464ae));}})['catch'](function(_0x2f4d60){return _0x2ff92e(msgResponse(_0x0630('0x141'),_0x0630('0x143'),JSON[_0x0630('0x43')](_0x2f4d60)));});});};Dialer[_0x0630('0xae')][_0x0630('0x156')]=function(_0x65c9b){var _0x39b7a5=this;return function(){switch(_0x65c9b['dialMethod']){case'progressive':freeVariablesPredictive(_0x65c9b);_0x39b7a5[_0x0630('0x157')](_0x65c9b,0x1);break;case'power':freeVariablesPredictive(_0x65c9b);_0x39b7a5[_0x0630('0x157')](_0x65c9b,_0x65c9b[_0x0630('0x158')]);break;case _0x0630('0x7'):_0x39b7a5[_0x0630('0x7')](_0x65c9b);break;case _0x0630('0x6'):freeVariablesPredictive(_0x65c9b);_0x39b7a5[_0x0630('0x157')](_0x65c9b,0x1);break;default:freeVariablesPredictive(_0x65c9b);logger[_0x0630('0x96')](_0x0630('0x159'),_0x65c9b[_0x0630('0x3b')],_0x0630('0x15a'));}};};Dialer[_0x0630('0xae')][_0x0630('0x15b')]=function(_0x5c93ec){var _0x2fcfa4=this;return function(){_0x2fcfa4['handleIvr'](_0x5c93ec);};};Dialer[_0x0630('0xae')][_0x0630('0x9')]=function(_0x2f6969){var _0x571ecb=this;if(isNotPreview(_0x2f6969[_0x0630('0x55')])){if(isVoiceQueueOutbound(_0x2f6969['type'])&&isActive(_0x2f6969['dialActive'])){_0x2f6969['sendMessageOneNotActive']=!![];BPromise[_0x0630('0xb8')]()['then'](checkIsLoggedIn(_0x2f6969,_0x2f6969['loggedIn']))['then'](checkIsActive(_0x2f6969,_0x2f6969[_0x0630('0x54')]))[_0x0630('0xb9')](checkInterval(_0x2f6969))[_0x0630('0xb9')](_0x571ecb[_0x0630('0x13c')](_0x2f6969))[_0x0630('0xb9')](_0x571ecb[_0x0630('0x140')](_0x2f6969[_0x0630('0x15c')],_0x2f6969[_0x0630('0x15d')],_0x2f6969['name'],_0x2f6969))[_0x0630('0xb9')](_0x571ecb[_0x0630('0x142')](_0x2f6969[_0x0630('0x3d')],_0x2f6969[_0x0630('0x15d')],_0x2f6969[_0x0630('0x3b')],_0x2f6969))[_0x0630('0xb9')](_0x571ecb['checkDialMethod'](_0x2f6969))[_0x0630('0xb2')](loggerCatchQueueSummary(_0x0630('0x15e'),_0x2f6969));}else{notSendMessagesQueue(_0x2f6969);}}else{freeVariablesPredictive(_0x2f6969);}};Dialer[_0x0630('0xae')][_0x0630('0x13b')]=function(){var _0x51a217=this;var _0x348060;for(var _0x12050c in this['campaigns']){if(this[_0x0630('0x20')]['hasOwnProperty'](_0x12050c)){_0x348060=this['campaigns'][_0x12050c];if(isCampaignIvr(_0x348060[_0x0630('0x46')])&&isActive(_0x348060[_0x0630('0x74')])){_0x348060['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x0630('0xb9')](checkIsActive(_0x348060,_0x348060[_0x0630('0x74')]))['then'](checkInterval(_0x348060))[_0x0630('0xb9')](_0x51a217[_0x0630('0x13c')](_0x348060))[_0x0630('0xb9')](_0x51a217[_0x0630('0x140')](_0x348060[_0x0630('0x15c')],_0x348060[_0x0630('0x15d')],_0x348060[_0x0630('0x3b')],_0x348060))[_0x0630('0xb9')](_0x51a217[_0x0630('0x142')](_0x348060[_0x0630('0x3d')],_0x348060[_0x0630('0x15d')],_0x348060['name'],_0x348060))['then'](_0x51a217['launchHandleIvr'](_0x348060))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x348060));}else{notSendMessagesCampaign(_0x348060);}}}};function getCallerIdRandom(_0x5b5f5e,_0x2674f2){var _0x584063,_0x217761,_0x3362be;if(_0x2674f2<=0x0){_0x2674f2=0x1;}_0x584063=new RegExp(_0x0630('0x15f')+_0x2674f2+'}$');_0x217761=Math['pow'](0xa,_0x2674f2-0x1);_0x3362be=Math[_0x0630('0x160')](0xa,_0x2674f2)-0x1;return util['format']('%s',_['replace'](_0x5b5f5e,_0x584063,_[_0x0630('0x161')](_0x217761,_0x3362be)));}function extractCalleridName(_0x386bc4){var _0x4a776f=_0x386bc4[_0x0630('0x162')](/"(.*?)"/);return _0x4a776f?_0x4a776f[0x1]:_0x386bc4;}function extractCalleridNumber(_0x2afeb2){var _0x714f6b=_0x2afeb2[_0x0630('0x162')](/<(.*?)>/);return _0x714f6b?_0x714f6b[0x1]:_0x2afeb2;}Dialer[_0x0630('0xae')][_0x0630('0x163')]=function(_0x33bb50,_0x2947c3){var _0x15c30e=this;var _0x20aca8=uuid['v4']();this[_0x0630('0x24')][_0x20aca8]=new Action(_0x33bb50,_0x2947c3,_0x20aca8);return new BPromise(function(_0x5eae68,_0x234516){if(_[_0x0630('0x39')](_0x33bb50)&&_0x0630('0x164')!==typeof _0x33bb50){return _0x234516(msgResponse(_0x0630('0x165'),_0x0630('0x143'),_0x0630('0x166')));}if(_[_0x0630('0x39')](_0x2947c3['Contact'][_0x0630('0x167')])||_0x2947c3[_0x0630('0x168')][_0x0630('0x167')]===null){return _0x234516(msgResponse(_0x0630('0x165'),_0x0630('0x143'),_0x0630('0x169')));}var _0x3104bb={'XMD-CALLERID':_0x15c30e[_0x0630('0x24')][_0x20aca8][_0x0630('0x16a')](),'XMD-AGI':_0x33bb50[_0x0630('0x101')]?util[_0x0630('0x76')](_0x0630('0x16b'),ipAgi,_0x33bb50[_0x0630('0x101')]):_0x0630('0x16c'),'XMD-AGIAFTER':_0x33bb50['dialQueueProject2']?util[_0x0630('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33bb50[_0x0630('0x109')]):_0x0630('0x16c'),'XMD-QUEUE':_0x33bb50[_0x0630('0x46')]===_0x0630('0x47')?util[_0x0630('0x76')]('\x22%s,%s%s,,,%s\x22',_0x33bb50['name'],_0x33bb50[_0x0630('0x16d')]||'',_0x33bb50[_0x0630('0x10a')]?'c':'',_0x33bb50[_0x0630('0x111')]||0x3):_0x0630('0x16c'),'XMD-CONTACTID':_0x2947c3[_0x0630('0xf3')],'XMD-CDRTYPE':_0x0630('0x5'),'CALLERID(all)':_0x15c30e[_0x0630('0x24')][_0x20aca8][_0x0630('0x16a')](),'XMD-AMD':_0x33bb50[_0x0630('0xdd')]?_0x0630('0x16e'):_0x0630('0x16c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x33bb50[_0x0630('0xdd')]){_0x3104bb['XMD-AMDINITIALSILENCE']=_0x33bb50[_0x0630('0x16f')]||0x9c4;_0x3104bb['XMD-AMDGREETING']=_0x33bb50[_0x0630('0x170')]||0x5dc;_0x3104bb['XMD-AMDAFTERGREETINGSILENCE']=_0x33bb50[_0x0630('0x171')]||0x320;_0x3104bb['XMD-AMDTOTALANALYSISTIME']=_0x33bb50[_0x0630('0x172')]||0x1388;_0x3104bb[_0x0630('0x173')]=_0x33bb50[_0x0630('0x174')]||0x64;_0x3104bb[_0x0630('0x175')]=_0x33bb50['dialAMDBetweenWordsSilence']||0x32;_0x3104bb[_0x0630('0x176')]=_0x33bb50[_0x0630('0x177')]||0x3;_0x3104bb[_0x0630('0x178')]=_0x33bb50[_0x0630('0x179')]||0x100;_0x3104bb['XMD-AMDMAXIMUMWORDLENGTH']=_0x33bb50[_0x0630('0x17a')]||0x1388;}if(_0x33bb50[_0x0630('0x46')]===_0x0630('0x47')){_0x3104bb['XMD-VOICEQUEUEID']=_0x2947c3[_0x0630('0xd2')];}else{_0x3104bb['XMD-CAMPAIGNID']=_0x2947c3['CampaignId'];}for(var _0x465348 in _0x2947c3[_0x0630('0x168')]){if(_0x2947c3['Contact'][_0x0630('0x99')](_0x465348)){if(isNotNull(_0x2947c3[_0x0630('0x168')][_0x465348])&&_0x465348!=='id'&&_0x465348!==_0x0630('0x17b')&&_0x465348!==_0x0630('0x17c')&&_0x465348!=='updatedAt'){_0x3104bb[util[_0x0630('0x76')](_0x0630('0x17d'),_0x0630('0x17e'),_[_0x0630('0x17f')](_0x465348))]=_0x2947c3[_0x0630('0x168')][_0x465348];}}}var _0x1a7cc5=_0x15c30e[_0x0630('0x13d')](_0x33bb50['Trunk'])?getCallerId(_0x33bb50[_0x0630('0x73')]['callerid'],_0x33bb50[_0x0630('0x56')],_0x33bb50[_0x0630('0x180')]>0x0?getCallerIdRandom(_0x33bb50[_0x0630('0x57')],_0x33bb50[_0x0630('0x180')]):_0x33bb50[_0x0630('0x57')]):getCallerId(_[_0x0630('0xaf')](_0x33bb50[_0x0630('0x13e')])?_0x33bb50['Trunk'][_0x0630('0x75')]:_0x33bb50[_0x0630('0x13e')][_0x0630('0x75')],_0x33bb50[_0x0630('0x56')],_0x33bb50[_0x0630('0x180')]>0x0?getCallerIdRandom(_0x33bb50[_0x0630('0x57')],_0x33bb50[_0x0630('0x180')]):_0x33bb50['dialOriginateCallerIdNumber']);if(_0x1a7cc5){_0x3104bb[_0x0630('0x181')]=_0x15c30e[_0x0630('0x24')][_0x20aca8][_0x0630('0x182')]=extractCalleridName(_0x1a7cc5);_0x3104bb[_0x0630('0x183')]=_0x15c30e['actions'][_0x20aca8]['originatecalleridnum']=extractCalleridNumber(_0x1a7cc5);}return ami[_0x0630('0xb0')]({'actionid':_0x20aca8,'action':_0x0630('0x165'),'channel':_0x15c30e[_0x0630('0x13d')](_0x33bb50[_0x0630('0x73')])?util[_0x0630('0x76')](_0x0630('0x184'),_0x33bb50['Trunk'][_0x0630('0x3b')],isNotNull(_0x33bb50[_0x0630('0x59')])?_0x33bb50[_0x0630('0x59')][_0x0630('0x185')]()||'':'',_0x33bb50[_0x0630('0x186')]>0x0?_0x2947c3[_0x0630('0x168')]['phone'][_0x0630('0x187')](_0x33bb50[_0x0630('0x186')]):_0x2947c3[_0x0630('0x168')][_0x0630('0x167')]):util[_0x0630('0x76')](_0x0630('0x184'),_[_0x0630('0xaf')](_0x33bb50['TrunkBackup'])?_0x33bb50[_0x0630('0x73')][_0x0630('0x3b')]:_0x33bb50[_0x0630('0x13e')][_0x0630('0x3b')],isNotNull(_0x33bb50['dialPrefix'])?_0x33bb50[_0x0630('0x59')][_0x0630('0x185')]()||'':'',_0x33bb50[_0x0630('0x186')]>0x0?_0x2947c3[_0x0630('0x168')][_0x0630('0x167')]['substring'](_0x33bb50[_0x0630('0x186')]):_0x2947c3[_0x0630('0x168')][_0x0630('0x167')]),'callerid':_0x1a7cc5,'Exten':_0x0630('0xdc'),'Context':_0x0630('0x188'),'Priority':'1','variable':_0x3104bb,'timeout':(_0x33bb50[_0x0630('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20aca8})[_0x0630('0xb9')](function(_0x512e92){return _0x5eae68(_0x512e92);})[_0x0630('0xb2')](function(_0x49cafe){_0x33bb50[_0x0630('0x62')]+=0x1;var _0xc22e68=new History(_0x15c30e[_0x0630('0x24')][_0x20aca8]);logger['error'](util[_0x0630('0x76')](_0x0630('0x189'),JSON[_0x0630('0x43')](_0x49cafe)));_0xc22e68[_0x0630('0xa6')]=0xe;_0xc22e68['statedesc']=_0x0630('0x18a');_0xc22e68[_0x0630('0xa9')]=moment()[_0x0630('0x76')](_0x0630('0xf2'));_0xc22e68[_0x0630('0xa8')]=_0xc22e68[_0x0630('0xa9')];_0x15c30e[_0x0630('0xcc')](_0xc22e68)[_0x0630('0xb2')](loggerCatch(_0x0630('0x18b')));_0x15c30e[_0x0630('0xca')](_0xc22e68)[_0x0630('0xb2')](loggerCatch(_0x0630('0x18b')))[_0x0630('0x1d')](function(){delete _0x15c30e[_0x0630('0x24')][_0x20aca8];return _0x234516(msgResponse(_0x0630('0x165'),_0x0630('0x18c'),_0x0630('0x18d')));});});});};Dialer[_0x0630('0xae')][_0x0630('0x2d')]=function(_0x474f65){var _0x510f9f=this['actions'][_0x474f65[_0x0630('0x122')]];var _0xe347c9=this;if(_0x510f9f){delete this['actions'][_0x474f65[_0x0630('0x122')]];_0x510f9f[_0x0630('0x18e')]=moment()[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x11ea66=_0x510f9f[_0x0630('0x46')]===_0x0630('0x79')?this[_0x0630('0x20')][_0x510f9f[_0x0630('0xb5')]]:this[_0x0630('0xde')][_0x510f9f[_0x0630('0x18f')]()];if(!this[_0x0630('0xd5')](_0x474f65['response'])){this['updateOriginated'](_0x11ea66);return this['callProgressDetecting'](_0x510f9f,_0x11ea66,_0x474f65)[_0x0630('0xb9')](function(_0x39b31c){})[_0x0630('0xb2')](loggerCatch(_0x0630('0x190')));}else{this[_0x0630('0xab')][_0x474f65['uniqueid']]=_0x510f9f;}}};Dialer['prototype'][_0x0630('0x191')]=function(_0x10ac32,_0x46fc86,_0x544bad){var _0x2e9b0c=new History(_0x46fc86);if(_0x2e9b0c[_0x0630('0xfb')]+_0x2e9b0c['countcongestionretry']+_0x2e9b0c[_0x0630('0x192')]+_0x2e9b0c[_0x0630('0xe7')]+_0x2e9b0c['countdropretry']+_0x2e9b0c[_0x0630('0xe9')]+_0x2e9b0c[_0x0630('0xe4')]+_0x2e9b0c[_0x0630('0xea')]>=_0x544bad[_0x0630('0xeb')]-0x1){return!![];}switch(_0x10ac32){case 0x3:if(_0x2e9b0c['countnoanswerretry']>=_0x544bad[_0x0630('0x193')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countnoanswerretry':_0x2e9b0c[_0x0630('0x192')]+=0x1,'scheduledat':moment()['add'](_0x544bad[_0x0630('0x194')],_0x0630('0xf1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c[_0x0630('0xd2')]||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x195')));}break;case 0x5:if(_0x2e9b0c[_0x0630('0xfb')]>=_0x544bad[_0x0630('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2e9b0c[_0x0630('0xfb')]+=0x1,'scheduledat':moment()[_0x0630('0xf0')](_0x544bad['dialBusyRetryFrequency'],_0x0630('0xf1'))[_0x0630('0x76')](_0x0630('0xf2')),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c['VoiceQueueId']||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x197')));}break;case 0x8:if(_0x2e9b0c[_0x0630('0xe6')]>=_0x544bad[_0x0630('0x198')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countcongestionretry':_0x2e9b0c[_0x0630('0xe6')]+=0x1,'scheduledat':moment()['add'](_0x544bad['dialCongestionRetryFrequency'],_0x0630('0xf1'))[_0x0630('0x76')](_0x0630('0xf2')),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c[_0x0630('0xd2')]||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x199')));}break;case 0x0:if(_0x2e9b0c[_0x0630('0xe7')]>=_0x544bad[_0x0630('0x19a')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countnosuchnumberretry':_0x2e9b0c[_0x0630('0xe7')]+=0x1,'scheduledat':moment()[_0x0630('0xf0')](_0x544bad[_0x0630('0x19b')],_0x0630('0xf1'))[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c['VoiceQueueId']||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})['catch'](loggerCatch(_0x0630('0x19c')));}break;case 0xa:if(_0x2e9b0c[_0x0630('0xe8')]>=_0x544bad[_0x0630('0x115')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countdropretry':_0x2e9b0c[_0x0630('0xe8')]+=0x1,'scheduledat':moment()[_0x0630('0xf0')](_0x544bad[_0x0630('0x116')],'minutes')[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c['VoiceQueueId']||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x117')));}break;case 0xb:if(_0x2e9b0c[_0x0630('0xe9')]>=_0x544bad[_0x0630('0x11d')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countabandonedretry':_0x2e9b0c['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0630('0xf0')](_0x544bad[_0x0630('0x11e')],'minutes')[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c['ListId'],'VoiceQueueId':_0x2e9b0c[_0x0630('0xd2')]||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x19d')));}break;case 0x13:if(_0x2e9b0c[_0x0630('0xe4')]>=_0x544bad['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countmachineretry':_0x2e9b0c[_0x0630('0xe4')]+=0x1,'scheduledat':moment()[_0x0630('0xf0')](_0x544bad[_0x0630('0xfd')],'minutes')[_0x0630('0x76')](_0x0630('0xf2')),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c[_0x0630('0xd2')]||undefined,'CampaignId':_0x2e9b0c['CampaignId']||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0xff')));}break;case 0x14:if(_0x2e9b0c['countagentrejectretry']>=_0x544bad[_0x0630('0x19e')]-0x1){return!![];}else{this[_0x0630('0xc1')]({'active':![],'countagentrejectretry':_0x2e9b0c['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x544bad['dialAgentRejectRetryFrequency'],'minutes')[_0x0630('0x76')](_0x0630('0xf2')),'ContactId':_0x2e9b0c[_0x0630('0xf3')],'ListId':_0x2e9b0c[_0x0630('0xd1')],'VoiceQueueId':_0x2e9b0c[_0x0630('0xd2')]||undefined,'CampaignId':_0x2e9b0c[_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x0630('0xae')]['callProgressDetecting']=function(_0x7f38e5,_0x479d39,_0x5ef1e4){var _0x1d7418=this;var _0x575e59=new History(_0x7f38e5);return new BPromise(function(_0x3397b9,_0x214a49){if(_['isUndefined'](_0x479d39)&&_0x0630('0x164')!==typeof _0x479d39){return _0x214a49(msgResponse(_0x0630('0x19f'),_0x0630('0x143'),_0x0630('0x1a0')));}if(_['isUndefined'](_0x5ef1e4)&&_0x0630('0x164')!==typeof _0x5ef1e4){return _0x214a49(msgResponse(_0x0630('0x19f'),_0x0630('0x143'),'evt\x20is\x20undefine'));}switch(_0x5ef1e4[_0x0630('0x1a1')]){case'0':_0x479d39[_0x0630('0x61')]+=0x1;_0x575e59[_0x0630('0xa6')]=0x0;_0x575e59[_0x0630('0xa7')]='NoSuchNumber';_0x575e59[_0x0630('0xe7')]+=0x1;_0x575e59['countglobal']+=0x1;ami[_0x0630('0x45')]('custom:agentnosuchnumber',ut[_0x0630('0x1a2')](_0x7f38e5,_0x0630('0x1a3')));_0x1d7418[_0x0630('0xcc')](_0x575e59)[_0x0630('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1d7418['checkRetriveMax'](0x0,_0x7f38e5,_0x479d39)){if(_0x575e59[_0x0630('0xe7')]>=_0x479d39[_0x0630('0x19a')]){_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1a4'));}else{_0x1d7418[_0x0630('0xec')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1a4'));}}break;case'3':_0x479d39['outboundNoAnswerCallsDay']+=0x1;_0x575e59[_0x0630('0xa6')]=0x3;_0x575e59['statedesc']='NoAnswer';_0x575e59['countnoanswerretry']+=0x1;_0x575e59['countglobal']+=0x1;ami[_0x0630('0x45')]('custom:agentnoanswer',ut['buildObj'](_0x7f38e5,_0x0630('0x1a5')));_0x1d7418[_0x0630('0xcc')](_0x575e59)[_0x0630('0xb2')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1d7418[_0x0630('0x191')](0x3,_0x7f38e5,_0x479d39)){if(_0x575e59['countnoanswerretry']>=_0x479d39[_0x0630('0x193')]){_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1d7418['stateGlobal'](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1a6'));}}break;case'5':_0x479d39[_0x0630('0x5c')]+=0x1;_0x575e59[_0x0630('0xa6')]=0x5;_0x575e59[_0x0630('0xa7')]='Busy';_0x575e59[_0x0630('0xfb')]+=0x1;_0x575e59[_0x0630('0xf9')]+=0x1;ami[_0x0630('0x45')]('custom:agentbusy',ut[_0x0630('0x1a2')](_0x7f38e5,_0x0630('0x1a7')));_0x1d7418[_0x0630('0xcc')](_0x575e59)['catch'](loggerCatch(_0x0630('0x1a8')));if(_0x1d7418['checkRetriveMax'](0x5,_0x7f38e5,_0x479d39)){if(_0x575e59['countbusyretry']>=_0x479d39[_0x0630('0x196')]){_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1a9'));}else{_0x1d7418[_0x0630('0xec')](_0x575e59,_0x3397b9,_0x214a49,'reason\x205\x20busy');}}break;case'8':_0x479d39[_0x0630('0x1aa')]+=0x1;_0x575e59[_0x0630('0xa6')]=0x8;_0x575e59[_0x0630('0xa7')]=_0x0630('0x1ab');_0x575e59['countcongestionretry']+=0x1;_0x575e59[_0x0630('0xf9')]+=0x1;ami[_0x0630('0x45')]('custom:agentcongestion',ut[_0x0630('0x1a2')](_0x7f38e5,_0x0630('0x1ac')));_0x1d7418[_0x0630('0xcc')](_0x575e59)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1d7418[_0x0630('0x191')](0x8,_0x7f38e5,_0x479d39)){if(_0x575e59[_0x0630('0xe6')]>=_0x479d39['dialCongestionMaxRetry']){_0x1d7418['createStateFinal'](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1ad'));}else{_0x1d7418['stateGlobal'](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1ad'));}}break;case'11':_0x479d39['outboundAbandonedCallsDay']+=0x1;_0x575e59['state']=0xb;_0x575e59[_0x0630('0xa7')]=_0x0630('0x11b');_0x575e59[_0x0630('0xe9')]+=0x1;_0x575e59[_0x0630('0xf9')]+=0x1;_0x1d7418[_0x0630('0xcc')](_0x575e59)['catch'](loggerCatch(_0x0630('0x11f')));if(_0x1d7418['checkRetriveMax'](0xb,_0x7f38e5,_0x479d39)){if(_0x575e59[_0x0630('0xe9')]>=_0x479d39['dialAbandonedMaxRetry']){_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1ae'));}else{_0x1d7418[_0x0630('0xec')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1ae'));}}break;case'20':_0x479d39[_0x0630('0x64')]+=0x1;_0x575e59[_0x0630('0xa6')]=0x14;_0x575e59[_0x0630('0xa7')]=_0x0630('0x1af');_0x575e59['countagentrejectretry']+=0x1;_0x575e59[_0x0630('0xf9')]+=0x1;ami[_0x0630('0x45')](_0x0630('0x1b0'),ut[_0x0630('0x1a2')](_0x7f38e5,'agentreject'));_0x1d7418[_0x0630('0xcc')](_0x575e59)[_0x0630('0xb2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1d7418[_0x0630('0x191')](0x14,_0x7f38e5,_0x479d39)){if(_0x575e59[_0x0630('0xea')]>=_0x479d39[_0x0630('0x19e')]){_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,'reason\x2020\x20agentreject');}else{_0x1d7418[_0x0630('0xec')](_0x575e59,_0x3397b9,_0x214a49,_0x0630('0x1b1'));}}break;default:_0x479d39[_0x0630('0x65')]+=0x1;_0x575e59[_0x0630('0xa6')]=0xc;_0x575e59[_0x0630('0xa7')]=_0x5ef1e4[_0x0630('0x1a1')];_0x1d7418['createHistory'](_0x575e59)['catch'](loggerCatch(_0x0630('0x1b2')));if(_0x1d7418[_0x0630('0x191')](_0x5ef1e4[_0x0630('0x1a1')],_0x7f38e5,_0x479d39)){if(_0x575e59[_0x0630('0xfb')]+_0x575e59[_0x0630('0xe6')]+_0x575e59[_0x0630('0x192')]+_0x575e59[_0x0630('0xe7')]+_0x575e59[_0x0630('0xe8')]+_0x575e59[_0x0630('0xe9')]+_0x575e59[_0x0630('0xe4')]+_0x575e59[_0x0630('0xea')]>=_0x479d39['dialGlobalMaxRetry']){_0x1d7418[_0x0630('0xec')](_0x575e59,_0x3397b9,_0x214a49,_0x5ef1e4['reason']);}else{_0x1d7418[_0x0630('0xef')](_0x575e59,_0x3397b9,_0x214a49,_0x5ef1e4['reason']);}}}});};Dialer[_0x0630('0xae')][_0x0630('0xec')]=function(_0x10bf90,_0x1410f0,_0x334d2e,_0x4a00e0){var _0x55c608=new Final(_0x10bf90);_0x55c608[_0x0630('0xa6')]=0xf;_0x55c608[_0x0630('0xa7')]='Global';this['createStateFinal'](_0x55c608,_0x1410f0,_0x334d2e,_0x4a00e0);};Dialer[_0x0630('0xae')]['createStateFinal']=function(_0x486eb1,_0x25ff40,_0x57364f,_0x38ed61){this['moveContactManagedDialer'](_0x486eb1)[_0x0630('0xb9')](function(_0x11dc78){return _0x25ff40(msgResponse(_0x0630('0x19f'),_0x0630('0x1b3'),_0x38ed61));})[_0x0630('0xb2')](function(_0x14a4e3){return _0x57364f(msgResponse(_0x0630('0x1b4'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x0630('0xae')][_0x0630('0x7')]=function(_0x115e0f){var _0x2708e6=this;var _0x3c65e6=_0x115e0f[_0x0630('0x1b5')]/0x64;var _0x456ded=_0x115e0f[_0x0630('0x5f')]/(_0x115e0f[_0x0630('0x5f')]+_0x115e0f['outboundAnswerCallsDay']);var _0x1420d3=Math[_0x0630('0x1b6')](_0x115e0f[_0x0630('0x6c')]*(_0x115e0f['predictiveIntervalMaxThreshold']/0x64));var _0x2e21c6=Math[_0x0630('0x1b6')](_0x115e0f['predictiveIntervalAvailable']*(_0x115e0f[_0x0630('0x1b7')]/0x64));var _0x5839c9=_0x115e0f[_0x0630('0x4a')]+_0x115e0f[_0x0630('0x50')];var _0x2f586d=Math['floor'](_0x115e0f[_0x0630('0x6f')]*_0x115e0f[_0x0630('0x71')]*_0x115e0f[_0x0630('0x6a')]*_0x115e0f['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x115e0f['startProgressive'])){if(!_[_0x0630('0x39')](_0x115e0f[_0x0630('0x26')])){_0x115e0f[_0x0630('0x26')]=undefined;loggerPredictive['error'](_0x0630('0x1b8'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x115e0f[_0x0630('0x91')])){loggerPredictive[_0x0630('0x96')](_0x0630('0x1b8'),_0x0630('0x1b9'));clearInterval(_0x115e0f['handlePredictive']);_0x115e0f[_0x0630('0x91')]=undefined;}_0x115e0f[_0x0630('0x27')]=moment()[_0x0630('0x76')](_0x0630('0xf2'));loggerPredictive['info'](_0x115e0f[_0x0630('0x3b')],_0x0630('0x1ba'),_0x115e0f[_0x0630('0x27')]);this[_0x0630('0x157')](_0x115e0f,0x1);}else if(ifInterval(_0x115e0f['dialPredictiveInterval'],_0x115e0f[_0x0630('0x27')])){this[_0x0630('0x157')](_0x115e0f,0x1);loggerPredictiveCalls['info'](_0x0630('0x1bb'),_0x115e0f[_0x0630('0x27')],_0x115e0f[_0x0630('0x3b')]);_0x115e0f[_0x0630('0x6f')]=0x0;_0x115e0f['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3c65e6<_0x456ded&&_0x115e0f[_0x0630('0x1bc')]===_0x0630('0x1bd')){freeVariablesPredictive(_0x115e0f);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0630('0x1be'),_0x456ded,'startProgressive',_0x115e0f[_0x0630('0x3b')]);}else if(_0x2f586d<_0x115e0f['predictiveIntervalErlangCallsDroppedCalls']&&_0x115e0f[_0x0630('0x1bc')]==='dropRate'){freeVariablesPredictive(_0x115e0f);loggerPredictive[_0x0630('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x2f586d,_0x0630('0x1bf'),_0x115e0f[_0x0630('0x69')],_0x0630('0x27'),_0x115e0f[_0x0630('0x3b')]);}else if(!ifInterval(_0x115e0f[_0x0630('0x1c0')],_0x115e0f['startProgressive'])&&_[_0x0630('0x39')](_0x115e0f[_0x0630('0x26')])&&!_[_0x0630('0x39')](_0x115e0f[_0x0630('0x27')])){_0x115e0f[_0x0630('0x26')]=moment()[_0x0630('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0630('0x7c')](_0x115e0f[_0x0630('0x3b')],_0x0630('0x1c1'),_0x115e0f[_0x0630('0x26')]);this['averageHandleTime'](_0x115e0f[_0x0630('0x1c0')])[_0x0630('0xb9')](this[_0x0630('0x1c2')](_0x115e0f))[_0x0630('0xb9')](mergeDataErlangB(_0x115e0f))[_0x0630('0xb9')](this[_0x0630('0x1c3')](_0x115e0f))['catch'](loggerCatchPredictive(_0x0630('0x1c4'),_0x115e0f));}else if(!ifInterval(_0x115e0f[_0x0630('0x1c0')],_0x115e0f[_0x0630('0x26')])){_0x115e0f[_0x0630('0x69')]=0x0;_0x115e0f[_0x0630('0x26')]=moment()['format'](_0x0630('0xf2'));loggerPredictive['info'](_0x115e0f[_0x0630('0x3b')],_0x0630('0x1c5'),_0x115e0f[_0x0630('0x26')]);clearInterval(_0x115e0f[_0x0630('0x91')]);_0x115e0f['handlePredictive']=undefined;this[_0x0630('0xbe')](_0x115e0f['dialPredictiveInterval'])[_0x0630('0xb9')](this['getDataPredictive'](_0x115e0f))[_0x0630('0xb9')](mergeDataErlangB(_0x115e0f))[_0x0630('0xb9')](this['startMethodPredictive'](_0x115e0f))[_0x0630('0xb2')](loggerCatchPredictive(_0x0630('0x1c6'),_0x115e0f));}else if(_0x115e0f['predictiveIntervalAvailable']&&_0x5839c9<_0x115e0f[_0x0630('0x6c')]-_0x2e21c6){freeVariablesPredictive(_0x115e0f);loggerPredictive['info'](_0x115e0f[_0x0630('0x3b')],_0x0630('0x1c7'),_0x5839c9,_0x0630('0x1c8'),_0x115e0f[_0x0630('0x6c')],'-',_0x2e21c6,'=',_0x115e0f[_0x0630('0x6c')]-_0x2e21c6,')');}else if(_0x115e0f['predictiveIntervalAvailable']&&_0x5839c9>_0x115e0f[_0x0630('0x6c')]+_0x1420d3){freeVariablesPredictive(_0x115e0f);loggerPredictive[_0x0630('0x7c')](_0x115e0f[_0x0630('0x3b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5839c9,')\x20are\x20more\x20than\x20threshold\x20(',_0x115e0f['predictiveIntervalAvailable'],'+',_0x1420d3,'=',_0x115e0f[_0x0630('0x6c')]+_0x1420d3,')');}};Dialer[_0x0630('0xae')]['getDataPredictive']=function(_0x727471){var _0x1d4561=this;return function(_0x15a4c5){return new BPromise(function(_0x202325,_0x1cd719){_[_0x0630('0xcf')](_0x727471,_0x15a4c5[0x0]);if(checkGetDataPredictive(_0x15a4c5[0x0])){var _0x24ba95=_0x727471[_0x0630('0x6c')]=_0x727471[_0x0630('0x50')]+_0x727471[_0x0630('0x4a')];var _0x346809=_0x727471[_0x0630('0x1c0')]*0x3c;var _0x1667ee=_0x15a4c5[0x0]['predictiveIntervalAvgTalktime']+_0x15a4c5[0x0][_0x0630('0x83')];var _0x89c740=(_0x15a4c5[0x0][_0x0630('0x66')]+_0x15a4c5[0x0][_0x0630('0x1c9')]+_0x15a4c5[0x0][_0x0630('0x67')])/_0x15a4c5[0x0][_0x0630('0x6d')];_0x727471['predictiveIntervalHitRate']=_0x89c740>0x0?_0x89c740:0x1;switch(_0x727471['dialPredictiveOptimization']){case _0x0630('0x1bd'):var _0x1cbdb2=_0x727471[_0x0630('0x1b5')]/0x64;return _0x1d4561[_0x0630('0x1ca')](_0x24ba95,_0x346809,_0x1667ee,_0x89c740,_0x1cbdb2)['then'](function(_0xf26745){return _0x202325(_0xf26745);});case'agentBusyFactor':var _0x147e8f=_0x727471[_0x0630('0x1b5')]/0x64;return _0x1d4561['busyFactor'](_0x24ba95,_0x346809,_0x1667ee,_0x89c740,_0x147e8f)[_0x0630('0xb9')](function(_0x34785f){return _0x202325(_0x34785f);});default:return _0x1cd719(msgResponse(_0x0630('0x1cb'),_0x0630('0x143'),_0x0630('0x1cc')));}}else{return _0x1cd719(msgResponse(_0x0630('0x1cb'),'Failure',_0x0630('0x1cd')));}});};};Dialer[_0x0630('0xae')][_0x0630('0x1ce')]=function(_0x2b06b9){var _0x50c86c=this;return function(_0x5c9b01){return new BPromise(function(_0x5c2dcc,_0x12693a){_['merge'](_0x2b06b9,_0x5c9b01[0x0]);if(checkGetDataPredictive(_0x5c9b01[0x0])){loggerPredictive['info'](JSON[_0x0630('0x43')](_0x5c9b01[0x0]));if(_0x2b06b9[_0x0630('0x1bc')]===_0x0630('0x1bd')){return _0x50c86c[_0x0630('0xc8')](_0x2b06b9['id'])[_0x0630('0xb9')](function(_0x566671){var _0x721dd9=_0x2b06b9[_0x0630('0x4b')]-_0x566671[0x0][_0x0630('0x1cf')];var _0xdb4716=_0x2b06b9[_0x0630('0x1c0')]*0x3c;var _0x1e3b73=_0x5c9b01[0x0][_0x0630('0x86')]+_0x5c9b01[0x0][_0x0630('0x83')];var _0x244cfd=(_0x5c9b01[0x0][_0x0630('0x66')]+_0x5c9b01[0x0][_0x0630('0x1c9')]+_0x5c9b01[0x0][_0x0630('0x67')])/_0x5c9b01[0x0][_0x0630('0x6d')];var _0xe65c51=_0x2b06b9[_0x0630('0x1b5')]/0x64;_0x2b06b9['predictiveIntervalPauses']=_0x566671[0x0][_0x0630('0x1cf')]||0x0;_0x2b06b9['predictiveIntervalHitRate']=_0x244cfd>0x0?_0x244cfd:0x1;return _0x50c86c[_0x0630('0x1ca')](_0x721dd9,_0xdb4716,_0x1e3b73,_0x244cfd,_0xe65c51);})[_0x0630('0xb9')](function(_0x405b68){return _0x5c2dcc(_0x405b68);})[_0x0630('0xb2')](function(_0x270324){return _0x12693a(msgResponse('[CatchErlangB]',_0x0630('0x143'),JSON[_0x0630('0x43')](_0x270324)));});}if(_0x2b06b9[_0x0630('0x1bc')]===_0x0630('0x1d0')){return _0x50c86c['getVoiceQueueRtPauses'](_0x2b06b9['id'])[_0x0630('0xb9')](function(_0x4f7e60){var _0x386f35=_0x2b06b9[_0x0630('0x4b')]-_0x4f7e60[0x0][_0x0630('0x1cf')];var _0x534fb2=_0x2b06b9[_0x0630('0x1c0')]*0x3c;var _0x28e755=_0x5c9b01[0x0][_0x0630('0x86')]+_0x5c9b01[0x0][_0x0630('0x83')];var _0xa16dbd=(_0x5c9b01[0x0][_0x0630('0x66')]+_0x5c9b01[0x0][_0x0630('0x1c9')]+_0x5c9b01[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5c9b01[0x0][_0x0630('0x6d')];var _0x5d4428=_0x2b06b9[_0x0630('0x1b5')]/0x64;_0x2b06b9[_0x0630('0x6b')]=_0x4f7e60[0x0]['outboundQueuePauses']||0x0;_0x2b06b9[_0x0630('0x6a')]=_0xa16dbd>0x0?_0xa16dbd:0x1;return _0x50c86c[_0x0630('0x1d1')](_0x386f35,_0x534fb2,_0x28e755,_0xa16dbd,_0x5d4428);})[_0x0630('0xb9')](function(_0x61bf72){return _0x5c2dcc(_0x61bf72);})[_0x0630('0xb2')](function(_0x32b718){return _0x12693a(msgResponse(_0x0630('0x1d2'),_0x0630('0x143'),JSON[_0x0630('0x43')](_0x32b718)));});}}else{return _0x12693a(msgResponse(_0x0630('0x1cb'),'Failure',_0x0630('0x1cd')));}});};};Dialer[_0x0630('0xae')][_0x0630('0x1c3')]=function(_0x2c43b6){var _0x265c44=this;return function(){var _0x5071da=0x0;var _0x209b57=Math[_0x0630('0x1d3')](_0x2c43b6[_0x0630('0x70')]*0x3e8);if(_0x209b57>0x0){_0x209b57=_0x209b57<0x64?0x64:_0x209b57;loggerPredictive[_0x0630('0x7c')](_0x2c43b6['name'],_0x0630('0x1d4'),_0x209b57,_0x0630('0x44'));_0x2c43b6[_0x0630('0x91')]=setInterval(function(){_0x265c44[_0x0630('0x91')](_0x2c43b6);loggerPredictiveCalls[_0x0630('0x7c')](_0x0630('0x1d5'),_0x5071da+=0x1);},_0x209b57);}else{loggerPredictive[_0x0630('0x7c')](_0x2c43b6[_0x0630('0x3b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0630('0xae')][_0x0630('0x1d6')]=function(_0x4cbb72,_0x5d8a71){var _0x28b5d9=this;return function(_0xd0ef23){if(_['isEmpty'](_0xd0ef23)){if(_[_0x0630('0xaf')](_0x5d8a71[_0x0630('0x1d7')])||!_0x5d8a71[_0x0630('0x1d8')]){if(_0x4cbb72[_0x0630('0x55')]==='booked'){_0x4cbb72[_0x0630('0x12a')]=_[_0x0630('0x39')](_0x4cbb72[_0x0630('0x12a')])?!![]:_0x4cbb72[_0x0630('0x12a')];var _0x4b520c=uuid['v4']();_0x28b5d9[_0x0630('0x24')][_0x4b520c]=new Action(_0x4cbb72,_0x5d8a71,_0x4b520c);loggerBooked[_0x0630('0x7c')](_0x0630('0x1d9'),_0x4b520c,_0x0630('0x1da'),JSON[_0x0630('0x43')](_0x4cbb72[_0x0630('0x12a')]),_0x0630('0x1db'),_0x4cbb72[_0x0630('0x3b')]);if(_0x4cbb72[_0x0630('0x12a')]){_0x4cbb72[_0x0630('0x12a')]=![];_0x28b5d9[_0x0630('0x127')][_0x28b5d9[_0x0630('0x24')][_0x4b520c][_0x0630('0xb5')]]=[];ami['Action']({'actionid':_0x4b520c,'action':_0x0630('0x1dc'),'queue':_0x4cbb72[_0x0630('0x3b')]})[_0x0630('0xb2')](function(_0x1544d3){_0x28b5d9[_0x0630('0xb4')](_0x4cbb72);_0x28b5d9['rescheduleContact']({'active':![],'ContactId':_0x28b5d9[_0x0630('0x24')][_0x4b520c][_0x0630('0xf3')],'ListId':_0x28b5d9[_0x0630('0x24')][_0x4b520c][_0x0630('0xd1')],'VoiceQueueId':_0x28b5d9[_0x0630('0x24')][_0x4b520c][_0x0630('0xd2')]||undefined,'CampaignId':_0x28b5d9[_0x0630('0x24')][_0x4b520c]['CampaignId']||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x1dd')));delete _0x28b5d9[_0x0630('0x24')][_0x4b520c];});}else{loggerBooked[_0x0630('0x7c')](_0x0630('0x1de'),JSON['stringify'](_0x4cbb72[_0x0630('0x12a')]),_0x0630('0x1db'),_0x4cbb72[_0x0630('0x3b')]);_0x28b5d9['updateOriginated'](_0x4cbb72);_0x28b5d9[_0x0630('0xc1')]({'active':![],'ContactId':_0x28b5d9[_0x0630('0x24')][_0x4b520c]['ContactId'],'ListId':_0x28b5d9[_0x0630('0x24')][_0x4b520c]['ListId'],'VoiceQueueId':_0x28b5d9[_0x0630('0x24')][_0x4b520c]['VoiceQueueId']||undefined,'CampaignId':_0x28b5d9[_0x0630('0x24')][_0x4b520c][_0x0630('0xfe')]||undefined})[_0x0630('0xb2')](loggerCatch(_0x0630('0x1dd')));delete _0x28b5d9['actions'][_0x4b520c];}}else{return _0x28b5d9['actionOriginate'](_0x4cbb72,_0x5d8a71);}}else{if(getDiff(_0x5d8a71['scheduledat'])<_0x4cbb72[_0x0630('0x1df')]*0x3c){if(_0x5d8a71[_0x0630('0x1e0')]&&!_0x5d8a71[_0x0630('0x1e0')][_0x0630('0x1e1')]){_0x28b5d9[_0x0630('0x1f')]['run'](_0x5d8a71['id'])['finally'](function(){_0x28b5d9[_0x0630('0xb4')](_0x4cbb72);});}else{_0x28b5d9[_0x0630('0xc3')]({'active':![]},_0x5d8a71['id'],0x1)[_0x0630('0x1d')](function(){console['log'](_0x0630('0x1e2'));_0x28b5d9[_0x0630('0xb4')](_0x4cbb72);});}}else{_0x4cbb72[_0x0630('0x63')]+=0x1;_0x28b5d9['updateOriginated'](_0x4cbb72);if(_0x4cbb72[_0x0630('0x1e3')]){_0x28b5d9['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d8a71[_0x0630('0xf3')],'ListId':_0x5d8a71[_0x0630('0xd1')],'VoiceQueueId':_0x5d8a71[_0x0630('0xd2')]||undefined,'CampaignId':_0x5d8a71['CampaignId']||undefined})[_0x0630('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x28b5d9['createHistory'](createObjHistory(_0x4cbb72,_0x5d8a71,_0x0630('0x1e4'),0x17,_0x0630('0x1e5')))[_0x0630('0xb2')](loggerCatch(_0x0630('0x1e6')));}else{_0x28b5d9[_0x0630('0xe1')](createObjHistory(_0x4cbb72,_0x5d8a71,_0x0630('0x1e7'),0x16,_0x0630('0x1e8')),_0x0630('0x1e9'),'[Originate][HistoryRecallClose]');}}}}else{_0x4cbb72['outboundBlacklistCallsDay']+=0x1;_0x28b5d9[_0x0630('0xe1')](createObjHistory(_0x4cbb72,_0x5d8a71,_0x0630('0x1ea'),0xd,_0x0630('0x1eb')),_0x0630('0x1ec'),_0x0630('0x1ed'));throw _0x0630('0x1ee');}};};Dialer[_0x0630('0xae')][_0x0630('0x1ef')]=function(_0x4dc824){var _0x1c4f2a=this;var _0xc7f70b=[];var _0x39bc84=_0x4dc824[_0x0630('0x1f0')]-_0x4dc824['originated']-_0x4dc824[_0x0630('0x1f1')];emitCampaignSummary(_0x4dc824);if(_0x39bc84>0x0){if(_0x39bc84>this[_0x0630('0x1f2')]){_0x39bc84=this['maxNumberOriginate'];}_0x4dc824['temp']+=_0x39bc84;this[_0x0630('0xc7')](_0x4dc824['id'],_0x39bc84,_0x4dc824[_0x0630('0x1f3')])[_0x0630('0xb9')](function(_0x4caa50){_0x4dc824[_0x0630('0x1f1')]-=_0x39bc84;_0x4dc824[_0x0630('0x1f1')]=_0x4dc824[_0x0630('0x1f1')]>0x0?_0x4dc824['temp']:0x0;if(!checkContactEmpty(_0x4caa50)){_0x4dc824[_0x0630('0x3a')]=_0x0630('0x1f4');logger[_0x0630('0x7c')]('[getContactCampaign2][Empty]'+_0x4dc824[_0x0630('0x3b')]);}else{_0x4dc824['originated']+=_0x4caa50[_0x0630('0x98')];_0x4dc824['message']=_0x0630('0x1f5');for(var _0x9b6571=0x0;_0x9b6571<_0x4caa50['length'];_0x9b6571+=0x1){_0x4dc824['ivrTotalCallsDays']+=0x1;if(_[_0x0630('0xaf')](_0x4caa50[_0x9b6571])||_[_0x0630('0xaf')](_0x4caa50[_0x9b6571][_0x0630('0x168')])||_[_0x0630('0xaf')](_0x4caa50[_0x9b6571][_0x0630('0x168')][_0x0630('0x167')])){_0x1c4f2a['emptyContact'](_0x0630('0x1f6'),_0x4dc824,_0x4caa50[_0x9b6571]);}else{_0x1c4f2a[_0x0630('0xbc')](_['pick'](_0x4caa50[_0x9b6571],[_0x0630('0xfe'),'Contact.phone']))[_0x0630('0xb9')](_0x1c4f2a[_0x0630('0x1d6')](_0x4dc824,_0x4caa50[_0x9b6571]))[_0x0630('0xb2')](_0x1c4f2a[_0x0630('0xce')](_0x0630('0x1f7'),_0x4dc824));}}}})['catch'](loggerGetContactDialer(_0x0630('0x1f8'),_0x4dc824,_0x39bc84));}};Dialer[_0x0630('0xae')][_0x0630('0x157')]=function(_0x314c2f,_0xd436fa){var _0x281c7b=this;var _0xb69f54=[];var _0xb3110=_0xd436fa>=0x1?_0xd436fa:0x1;var _0x24bcdd=[];if(_0x314c2f[_0x0630('0x55')]===_0x0630('0x6')){_0xb3110=0x1;}var _0x303ab2=Math['floor'](_0x314c2f['available']*_0xb3110)-_0x314c2f[_0x0630('0x6e')]-_0x314c2f[_0x0630('0x1f1')];emitVoiceQueueSummary(_0x314c2f);if(_0x314c2f[_0x0630('0x1f9')]>0x0){var _0x2ce4eb=_0x314c2f[_0x0630('0x1f9')]-_0x314c2f['originated']-_0x314c2f[_0x0630('0x50')]-_0x314c2f[_0x0630('0x1f1')]-_0x314c2f[_0x0630('0x4c')];if(_0x303ab2>_0x2ce4eb){_0x303ab2=_0x2ce4eb;}}if(_0x303ab2>0x0){if(_0x314c2f[_0x0630('0x55')]===_0x0630('0x6')){_0x303ab2=0x1;}if(_0x303ab2>this['maxNumberOriginate']){_0x303ab2=this['maxNumberOriginate'];}_0x314c2f[_0x0630('0x1f1')]+=_0x303ab2;for(var _0x58598f in this[_0x0630('0x21')]){if(this[_0x0630('0x21')][_0x0630('0x99')](_0x58598f)){if(this['agents'][_0x58598f][_0x0630('0xa6')]===_0x0630('0x1fa')&&this['agents'][_0x58598f][_0x0630('0xb1')]===_0x0630('0xd7')){_0xb69f54['push'](this[_0x0630('0x21')][_0x58598f]['id']);}}}this[_0x0630('0xc5')](_0x314c2f['id'],_0xb69f54,_0x303ab2,_0x314c2f[_0x0630('0x1f3')])[_0x0630('0xb9')](function(_0x2c200f){_0x314c2f['temp']-=_0x303ab2;_0x314c2f[_0x0630('0x1f1')]=_0x314c2f[_0x0630('0x1f1')]>0x0?_0x314c2f[_0x0630('0x1f1')]:0x0;if(!checkContactEmpty(_0x2c200f)){_0x281c7b[_0x0630('0xb7')](_0x314c2f)[_0x0630('0xb9')](sendMessageReschedule(_0x314c2f))[_0x0630('0xb2')](loggerCatch(_0x0630('0xba')));}else{_0x314c2f['originated']+=_0x2c200f[_0x0630('0x98')];_0x314c2f[_0x0630('0x3a')]=_0x314c2f[_0x0630('0x55')]===_0x0630('0x6')?_0x0630('0x16e'):_0x0630('0x1f5');for(var _0x1bae48=0x0;_0x1bae48<_0x2c200f[_0x0630('0x98')];_0x1bae48+=0x1){if(_[_0x0630('0xaf')](_0x2c200f[_0x1bae48])||_[_0x0630('0xaf')](_0x2c200f[_0x1bae48][_0x0630('0x168')])||_[_0x0630('0xaf')](_0x2c200f[_0x1bae48][_0x0630('0x168')]['phone'])){_0x281c7b['emptyContact']('[actionOriginate]\x20',_0x314c2f,_0x2c200f[_0x1bae48]);}else{_0x281c7b['checkIsBlackList'](_[_0x0630('0xd0')](_0x2c200f[_0x1bae48],['VoiceQueueId',_0x0630('0x1fb')]))[_0x0630('0xb9')](_0x281c7b['checkContactBlack'](_0x314c2f,_0x2c200f[_0x1bae48]))['catch'](_0x281c7b[_0x0630('0xce')]('[actionOriginate]\x20',_0x314c2f));}}}})['catch'](loggerGetContactDialer(_0x0630('0x1fc'),_0x314c2f,_0x303ab2));}};Dialer[_0x0630('0xae')]['handlePredictive']=function(_0x2179e6){var _0x100eb1=this;if(_0x2179e6[_0x0630('0x1f9')]>0x0){var _0x419f90=_0x2179e6[_0x0630('0x1f9')]-_0x2179e6[_0x0630('0x6e')]-_0x2179e6[_0x0630('0x50')];if(_0x419f90>0x0){this[_0x0630('0x1fd')](_0x2179e6);}else{loggerPredictiveCalls[_0x0630('0x7c')](_0x0630('0x1fe'));}}else{this['tryOriginatePredictive'](_0x2179e6);}};Dialer['prototype'][_0x0630('0x1fd')]=function(_0x58b866){var _0x26d2da=this;var _0x104d5b=[];_0x58b866[_0x0630('0x6e')]+=0x1;for(var _0x32184d in this[_0x0630('0x21')]){if(this[_0x0630('0x21')][_0x0630('0x99')](_0x32184d)){if(this[_0x0630('0x21')][_0x32184d][_0x0630('0xa6')]===_0x0630('0x1fa')&&this[_0x0630('0x21')][_0x32184d][_0x0630('0xb1')]===_0x0630('0xd7')){_0x104d5b[_0x0630('0x128')](this['agents'][_0x32184d]['id']);}}}this[_0x0630('0xc5')](_0x58b866['id'],_0x104d5b,0x1,_0x58b866['dialOrderByScheduledAt'])[_0x0630('0xb9')](function(_0x28b7e1){if(!checkContactEmpty(_0x28b7e1)){checkContactLowerLimitOriginate(_0x58b866,0x1,0x0);_0x26d2da['countReScheduled'](_0x58b866)[_0x0630('0xb9')](sendMessageReschedule(_0x58b866))[_0x0630('0xb2')](loggerCatch(_0x0630('0xba')));}else{_0x58b866[_0x0630('0x3a')]=_0x0630('0x1f5');if(_[_0x0630('0xaf')](_0x28b7e1[0x0])||_[_0x0630('0xaf')](_0x28b7e1[0x0]['Contact'])||_['isNil'](_0x28b7e1[0x0][_0x0630('0x168')][_0x0630('0x167')])){_0x26d2da['emptyContact'](_0x0630('0x1f6'),_0x58b866,_0x28b7e1[0x0]);}else{_0x26d2da[_0x0630('0xbb')](_[_0x0630('0xd0')](_0x28b7e1[0x0],[_0x0630('0xd2'),'Contact.phone']))['then'](_0x26d2da[_0x0630('0x1d6')](_0x58b866,_0x28b7e1[0x0]))[_0x0630('0xb2')](_0x26d2da[_0x0630('0xce')](_0x0630('0x1ff'),_0x58b866));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x58b866,0x1));emitVoiceQueueSummary(_0x58b866);};Dialer[_0x0630('0xae')][_0x0630('0x1ca')]=function(_0x488180,_0x951655,_0x5a7ea6,_0x2b9458,_0x434221,_0xb8cadc){loggerPredictive[_0x0630('0x7c')](_0x0630('0x200'));loggerPredictive[_0x0630('0x7c')](_0x0630('0x201'),_0x488180);loggerPredictive[_0x0630('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x951655);loggerPredictive[_0x0630('0x7c')](_0x0630('0x202'),_0x5a7ea6);loggerPredictive[_0x0630('0x7c')]('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',_0x2b9458);loggerPredictive[_0x0630('0x7c')](_0x0630('0x203'),_0x434221);loggerPredictive['info'](_0x0630('0x85'));return new BPromise(function(_0x28f0b8,_0x1e1f0e){if(_0x488180<=0x0||isNaN(_0x488180)){return _0x1e1f0e(msgResponse(_0x0630('0x204'),_0x0630('0x18c'),_0x0630('0x205')+_0x488180));}if(_0x5a7ea6<=0x0||isNaN(_0x5a7ea6)){return _0x1e1f0e(msgResponse(_0x0630('0x204'),'Error',_0x0630('0x206')+_0x5a7ea6));}if(_0x2b9458<=0x0||isNaN(_0x2b9458)){return _0x1e1f0e(msgResponse('[abandonmentRate]',_0x0630('0x18c'),_0x0630('0x207')+_0x2b9458));}if(_0x951655<=0x0||isNaN(_0x951655)){return _0x1e1f0e(msgResponse('[abandonmentRate]',_0x0630('0x18c'),'interval\x20=\x20'+_0x951655));}if(_0x434221<=0x0||isNaN(_0x434221)){return _0x1e1f0e(msgResponse(_0x0630('0x204'),_0x0630('0x18c'),'Amax\x20=\x20'+_0x434221));}_0xb8cadc=_0xb8cadc||0x0;var _0x14e2ba=0x1/_0x5a7ea6;var _0x52697c=0x0;var _0xf1bb3d=0x0;var _0x448f98=0x0;var _0x2d446d=0x0;for(var _0x5a005c=0x0;_0x448f98<_0x434221;_0x5a005c+=0x1){_0xf1bb3d=_0x5a005c/_0x951655;_0x52697c=(_0x2b9458*_0xf1bb3d+_0xb8cadc)/_0x14e2ba;_0x448f98=erlangb(_0x52697c,_0x488180);_0x2d446d=_0x52697c/_0x488180*(0x1-erlangb(_0x52697c,_0x488180));}return _0x28f0b8({'erlangCalls':_0x5a005c,'erlangCallToSecond':_0x951655/_0x5a005c,'erlangAbandonmentRate':_0x448f98,'erlangBusyFactor':_0x2d446d});});};Dialer[_0x0630('0xae')][_0x0630('0x1d1')]=function(_0x24ff5f,_0x159bc0,_0x1794f3,_0x46f4a0,_0x1e1d5d,_0x399b7f){loggerPredictive[_0x0630('0x7c')](_0x0630('0x208'));loggerPredictive[_0x0630('0x7c')](_0x0630('0x201'),_0x24ff5f);loggerPredictive[_0x0630('0x7c')](_0x0630('0x209'),_0x159bc0);loggerPredictive[_0x0630('0x7c')](_0x0630('0x202'),_0x1794f3);loggerPredictive[_0x0630('0x7c')]('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',_0x46f4a0);loggerPredictive[_0x0630('0x7c')](_0x0630('0x20a'),_0x1e1d5d);loggerPredictive[_0x0630('0x7c')]('---------------------------');return new BPromise(function(_0x2b89c1,_0x2a11a9){if(_0x24ff5f<=0x0||isNaN(_0x24ff5f)){return _0x2a11a9(msgResponse(_0x0630('0x20b'),_0x0630('0x18c'),_0x0630('0x205')+_0x24ff5f));}if(_0x1794f3<=0x0||isNaN(_0x1794f3)){return _0x2a11a9(msgResponse(_0x0630('0x20b'),_0x0630('0x18c'),_0x0630('0x206')+_0x1794f3));}if(_0x46f4a0<=0x0||isNaN(_0x46f4a0)){return _0x2a11a9(msgResponse('[busyFactor]','Error',_0x0630('0x207')+_0x46f4a0));}if(_0x159bc0<=0x0||isNaN(_0x159bc0)){return _0x2a11a9(msgResponse('[busyFactor]',_0x0630('0x18c'),'interval\x20=\x20'+_0x159bc0));}if(_0x1e1d5d<=0x0||isNaN(_0x1e1d5d)){return _0x2a11a9(msgResponse(_0x0630('0x20b'),'Error',_0x0630('0x20c')+_0x1e1d5d));}_0x399b7f=_0x399b7f||0x0;var _0x256533=0x1/_0x1794f3;var _0x1dfa37=0x0;var _0x1d0de5=0x0;var _0x3e9306=0x0;var _0x317355=0x0;for(var _0x4eeda8=0x0;_0x317355<_0x1e1d5d;_0x4eeda8+=0x1){_0x1d0de5=_0x4eeda8/_0x159bc0;_0x1dfa37=(_0x46f4a0*_0x1d0de5+_0x399b7f)/_0x256533;_0x3e9306=erlangb(_0x1dfa37,_0x24ff5f);_0x317355=_0x1dfa37/_0x24ff5f*(0x1-erlangb(_0x1dfa37,_0x24ff5f));}return _0x2b89c1({'erlangCalls':_0x4eeda8,'erlangCallToSecond':_0x159bc0/_0x4eeda8,'erlangAbandonmentRate':_0x3e9306,'erlangBusyFactor':_0x317355});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index caba1d8..287c638 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 _0x5e0b=['diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','queue','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds'];(function(_0xd336ba,_0x23d405){var _0x34c559=function(_0x1007b9){while(--_0x1007b9){_0xd336ba['push'](_0xd336ba['shift']());}};_0x34c559(++_0x23d405);}(_0x5e0b,0xa1));var _0xb5e0=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x5e0b[_0x3b7a0c];return _0x3bb70f;};'use strict';var util=require(_0xb5e0('0x0'));var _=require(_0xb5e0('0x1'));var moment=require('moment');function getSeconds(_0x1e0156,_0x4618e1){var _0x52152e=moment(_0x1e0156)[_0xb5e0('0x2')](0x0);var _0x4b4e01=moment(_0x4618e1)[_0xb5e0('0x2')](0x0);return _0x52152e[_0xb5e0('0x3')](_0x4b4e01,_0xb5e0('0x4'));}function QueueCallerAbandon(_0x4c1aaf,_0x48db97){this[_0xb5e0('0x5')]=_0x4c1aaf['scheduledat'];this[_0xb5e0('0x6')]=_0x4c1aaf[_0xb5e0('0x6')];this['campaigntype']=_0x4c1aaf[_0xb5e0('0x6')]===_0xb5e0('0x7')?'queue':_0x4c1aaf['type'];this[_0xb5e0('0x8')]=_0x4c1aaf[_0xb5e0('0x8')];this[_0xb5e0('0x9')]=_0x4c1aaf[_0xb5e0('0x9')];this['countnoanswerretry']=_0x4c1aaf[_0xb5e0('0xa')];this['countglobal']=_0x4c1aaf[_0xb5e0('0x8')]+_0x4c1aaf[_0xb5e0('0x9')]+_0x4c1aaf[_0xb5e0('0xa')]+_0x4c1aaf[_0xb5e0('0xb')]+_0x4c1aaf[_0xb5e0('0xc')]+_0x4c1aaf['countabandonedretry']+_0x4c1aaf[_0xb5e0('0xd')]+_0x4c1aaf[_0xb5e0('0xe')];this['countnosuchnumberretry']=_0x4c1aaf[_0xb5e0('0xb')];this[_0xb5e0('0xc')]=_0x4c1aaf[_0xb5e0('0xc')];this[_0xb5e0('0xf')]=_0x4c1aaf['countabandonedretry'];this[_0xb5e0('0xd')]=_0x4c1aaf[_0xb5e0('0xd')];this[_0xb5e0('0xe')]=_0x4c1aaf[_0xb5e0('0xe')];this[_0xb5e0('0x10')]=_0x48db97[_0xb5e0('0x10')];this[_0xb5e0('0x11')]=_0x4c1aaf[_0xb5e0('0x12')];this[_0xb5e0('0x13')]=_0x4c1aaf[_0xb5e0('0x14')];this[_0xb5e0('0x15')]=_0x4c1aaf['starttime'];this[_0xb5e0('0x16')]=_0x4c1aaf[_0xb5e0('0x16')];this[_0xb5e0('0x17')]=_0x4c1aaf[_0xb5e0('0x17')];this[_0xb5e0('0x18')]=this[_0xb5e0('0x17')];this['ringtime']=getSeconds(_0x4c1aaf[_0xb5e0('0x16')],_0x4c1aaf['starttime']);this['holdtime']=getSeconds(this['droptime'],_0x4c1aaf[_0xb5e0('0x16')]);this[_0xb5e0('0x19')]=0x0;this[_0xb5e0('0x1a')]=_0x48db97['queue'];this[_0xb5e0('0x1b')]=_0x48db97[_0xb5e0('0x1c')];this['reason']=_0x48db97[_0xb5e0('0x1d')];this['callback']=_0x4c1aaf['callback'];this['callbackuniqueid']=_0x4c1aaf[_0xb5e0('0x1e')];this[_0xb5e0('0x1f')]=_0x4c1aaf['callbackat'];this['recallme']=_0x4c1aaf[_0xb5e0('0x20')];this[_0xb5e0('0x21')]=_0x4c1aaf[_0xb5e0('0x21')];this[_0xb5e0('0x22')]=_0x4c1aaf[_0xb5e0('0x22')];this[_0xb5e0('0x23')]=_0x4c1aaf[_0xb5e0('0x23')];this[_0xb5e0('0x24')]=_0x4c1aaf['VoiceQueueId'];this['CampaignId']=_0x4c1aaf[_0xb5e0('0x25')];this[_0xb5e0('0x26')]=_0x4c1aaf[_0xb5e0('0x26')]||'';this[_0xb5e0('0x27')]=_0x4c1aaf[_0xb5e0('0x27')]||'';}module[_0xb5e0('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x6cdf=['number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','calleridnum'];(function(_0x287d08,_0x55ab1e){var _0x3e7834=function(_0x3cada6){while(--_0x3cada6){_0x287d08['push'](_0x287d08['shift']());}};_0x3e7834(++_0x55ab1e);}(_0x6cdf,0x1ba));var _0xf6cd=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x6cdf[_0x339129];return _0x1570df;};'use strict';var util=require(_0xf6cd('0x0'));var _=require('lodash');var moment=require(_0xf6cd('0x1'));function getSeconds(_0x442373,_0x5b5a90){var _0x3943a9=moment(_0x442373)[_0xf6cd('0x2')](0x0);var _0x4d3192=moment(_0x5b5a90)[_0xf6cd('0x2')](0x0);return _0x3943a9[_0xf6cd('0x3')](_0x4d3192,'seconds');}function QueueCallerAbandon(_0x197f20,_0x41725b){this[_0xf6cd('0x4')]=_0x197f20['scheduledat'];this['type']=_0x197f20[_0xf6cd('0x5')];this[_0xf6cd('0x6')]=_0x197f20[_0xf6cd('0x5')]===_0xf6cd('0x7')?'queue':_0x197f20[_0xf6cd('0x5')];this[_0xf6cd('0x8')]=_0x197f20[_0xf6cd('0x8')];this[_0xf6cd('0x9')]=_0x197f20[_0xf6cd('0x9')];this[_0xf6cd('0xa')]=_0x197f20['countnoanswerretry'];this[_0xf6cd('0xb')]=_0x197f20[_0xf6cd('0x8')]+_0x197f20[_0xf6cd('0x9')]+_0x197f20[_0xf6cd('0xa')]+_0x197f20[_0xf6cd('0xc')]+_0x197f20[_0xf6cd('0xd')]+_0x197f20[_0xf6cd('0xe')]+_0x197f20['countmachineretry']+_0x197f20[_0xf6cd('0xf')];this['countnosuchnumberretry']=_0x197f20[_0xf6cd('0xc')];this['countdropretry']=_0x197f20['countdropretry'];this[_0xf6cd('0xe')]=_0x197f20[_0xf6cd('0xe')];this[_0xf6cd('0x10')]=_0x197f20[_0xf6cd('0x10')];this[_0xf6cd('0xf')]=_0x197f20[_0xf6cd('0xf')];this[_0xf6cd('0x11')]=_0x41725b[_0xf6cd('0x11')];this[_0xf6cd('0x12')]=_0x197f20['name'];this[_0xf6cd('0x13')]=_0x197f20[_0xf6cd('0x14')];this[_0xf6cd('0x15')]=_0x197f20['starttime'];this[_0xf6cd('0x16')]=_0x197f20['responsetime'];this[_0xf6cd('0x17')]=_0x197f20[_0xf6cd('0x17')];this[_0xf6cd('0x18')]=this[_0xf6cd('0x17')];this[_0xf6cd('0x19')]=getSeconds(_0x197f20['responsetime'],_0x197f20[_0xf6cd('0x15')]);this[_0xf6cd('0x1a')]=getSeconds(this[_0xf6cd('0x17')],_0x197f20['responsetime']);this[_0xf6cd('0x1b')]=0x0;this[_0xf6cd('0x1c')]=_0x41725b[_0xf6cd('0x1c')];this[_0xf6cd('0x1d')]=_0x41725b[_0xf6cd('0x1e')];this[_0xf6cd('0x1f')]=_0x41725b[_0xf6cd('0x1f')];this[_0xf6cd('0x20')]=_0x197f20[_0xf6cd('0x20')];this[_0xf6cd('0x21')]=_0x197f20[_0xf6cd('0x21')];this[_0xf6cd('0x22')]=_0x197f20[_0xf6cd('0x22')];this['recallme']=_0x197f20[_0xf6cd('0x23')];this[_0xf6cd('0x24')]=_0x197f20[_0xf6cd('0x24')];this[_0xf6cd('0x25')]=_0x197f20[_0xf6cd('0x25')];this[_0xf6cd('0x26')]=_0x197f20[_0xf6cd('0x26')];this['VoiceQueueId']=_0x197f20[_0xf6cd('0x27')];this[_0xf6cd('0x28')]=_0x197f20['CampaignId'];this[_0xf6cd('0x29')]=_0x197f20['originatecalleridnum']||'';this['originatecalleridname']=_0x197f20['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f05da58..7eb2aba 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 _0xe5f8=['tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','moment','uniqueid','channel','%s/%s/%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5f8,0x140));var _0x8e5f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe5f8[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0x8e5f('0x0'));var _=require('lodash');var moment=require(_0x8e5f('0x1'));function Action(_0x418297,_0x39498a,_0x217819){this[_0x8e5f('0x2')]=_0x418297||undefined;this[_0x8e5f('0x3')]=util['format'](_0x8e5f('0x4'),_0x39498a[_0x8e5f('0x5')],_0x39498a['Trunk'][_0x8e5f('0x6')],_0x217819[_0x8e5f('0x7')]);this[_0x8e5f('0x8')]=_0x39498a[_0x8e5f('0x8')];this[_0x8e5f('0x9')]=_0x39498a['headerinfo'];this[_0x8e5f('0xa')]=_0x217819['path'];this[_0x8e5f('0xb')]=_0x217819[_0x8e5f('0xb')];}module[_0x8e5f('0xc')]=Action; \ No newline at end of file +var _0x0616=['lodash','moment','uniqueid','channel','%s/%s/%s','tech','Trunk','name','localstationid','path','AttachmentId','exports','util'];(function(_0x57234f,_0x5d6fe7){var _0x11b6dd=function(_0x47d062){while(--_0x47d062){_0x57234f['push'](_0x57234f['shift']());}};_0x11b6dd(++_0x5d6fe7);}(_0x0616,0x137));var _0x6061=function(_0x4bccd7,_0x213c94){_0x4bccd7=_0x4bccd7-0x0;var _0x196ceb=_0x0616[_0x4bccd7];return _0x196ceb;};'use strict';var util=require(_0x6061('0x0'));var _=require(_0x6061('0x1'));var moment=require(_0x6061('0x2'));function Action(_0x3c5995,_0x40193b,_0x8f2809){this[_0x6061('0x3')]=_0x3c5995||undefined;this[_0x6061('0x4')]=util['format'](_0x6061('0x5'),_0x40193b[_0x6061('0x6')],_0x40193b[_0x6061('0x7')][_0x6061('0x8')],_0x8f2809['fax']);this[_0x6061('0x9')]=_0x40193b[_0x6061('0x9')];this['headerinfo']=_0x40193b['headerinfo'];this['path']=_0x8f2809[_0x6061('0xa')];this[_0x6061('0xb')]=_0x8f2809[_0x6061('0xb')];}module[_0x6061('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 124c64e..993a678 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 _0x3989=['Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','util','lodash','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','trunks','newchannel','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif'];(function(_0x2b310b,_0x3a5dc9){var _0xb804d9=function(_0x40c711){while(--_0x40c711){_0x2b310b['push'](_0x2b310b['shift']());}};_0xb804d9(++_0x3a5dc9);}(_0x3989,0x85));var _0x9398=function(_0x243f1b,_0x22aa07){_0x243f1b=_0x243f1b-0x0;var _0x50339f=_0x3989[_0x243f1b];return _0x50339f;};'use strict';var util=require(_0x9398('0x0'));var _=require(_0x9398('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x9398('0x2'));var path=require(_0x9398('0x3'));var tiff2pdf=require(_0x9398('0x4'));var gs=require('./util/gs');var logger=require(_0x9398('0x5'))(_0x9398('0x6'));var ami=require(_0x9398('0x7'));var rpcDb=require(_0x9398('0x8'));var Channel=require('./channel');var ut=require(_0x9398('0x9'));var Action=require(_0x9398('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x9398('0xb'));var faxMessage=require(_0x9398('0xc'));function Fax(_0x281e97){this[_0x9398('0xd')]={};this['faxAccounts']=_0x281e97['faxAccounts'];this[_0x9398('0xe')]=_0x281e97['trunks'];this['actions']={};ami['on'](_0x9398('0xf'),this[_0x9398('0x10')]['bind'](this));ami['on'](_0x9398('0x11'),this['syncVarSet'][_0x9398('0x12')](this));ami['on'](_0x9398('0x13'),this[_0x9398('0x14')][_0x9398('0x12')](this));ami['on'](_0x9398('0x15'),this[_0x9398('0x16')]['bind'](this));ami['on'](_0x9398('0x17'),this['syncFaxStatus'][_0x9398('0x12')](this));ami['on']('receivefax',this[_0x9398('0x18')]['bind'](this));ami['on']('hangup',this[_0x9398('0x19')][_0x9398('0x12')](this));ami['on']('originateresponse',this[_0x9398('0x1a')][_0x9398('0x12')](this));}Fax[_0x9398('0x1b')]['syncNewchannel']=function(_0x526672){if(_0x526672[_0x9398('0x1c')]===_0x9398('0x1d')){for(var _0x5434db in this[_0x9398('0x1e')]){if(this[_0x9398('0x1e')][_0x9398('0x1f')](_0x5434db)){if(_0x526672[_0x9398('0x20')]===this[_0x9398('0x1e')][_0x5434db][_0x9398('0x21')]){this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]={};this[_0x9398('0xd')][_0x526672['uniqueid']]['channel']=_0x526672[_0x9398('0x23')];this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]['id']=this['faxAccounts'][_0x5434db]['id'];this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]][_0x9398('0x24')]=this[_0x9398('0x1e')][_0x5434db][_0x9398('0x24')];logger[_0x9398('0x25')](_0x526672['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x9398('0x26')][_0x526672['uniqueid']]){this[_0x9398('0xd')][_0x526672[_0x9398('0x22')]]={};this[_0x9398('0xd')][_0x526672['uniqueid']][_0x9398('0x23')]=_0x526672[_0x9398('0x23')];logger[_0x9398('0x25')](_0x526672[_0x9398('0x22')],_0x9398('0x27'));}};Fax[_0x9398('0x1b')]['syncVarSet']=function(_0x45c8db){if(this[_0x9398('0xd')][_0x45c8db[_0x9398('0x22')]]){for(var _0x1fb370 in _0x45c8db[_0x9398('0x28')]){if(_0x45c8db[_0x9398('0x28')][_0x9398('0x1f')](_0x1fb370)){this[_0x9398('0xd')][_0x45c8db[_0x9398('0x22')]][_0x1fb370]=_0x45c8db['value'];}}}};Fax[_0x9398('0x1b')][_0x9398('0x14')]=function(_0x2f6fe0){if(this[_0x9398('0xd')][_0x2f6fe0['uniqueid']]){this[_0x9398('0xd')][_0x2f6fe0[_0x9398('0x22')]]['channelstate']=_0x2f6fe0[_0x9398('0x29')];this[_0x9398('0xd')][_0x2f6fe0[_0x9398('0x22')]][_0x9398('0x2a')]=_0x2f6fe0[_0x9398('0x2a')];}};Fax['prototype'][_0x9398('0x16')]=function(_0x527db5){if(this[_0x9398('0xd')][_0x527db5[_0x9398('0x22')]]){for(var _0x2e44f6 in _0x527db5[_0x9398('0x28')]){if(_0x527db5['variable']['hasOwnProperty'](_0x2e44f6)){this['channels'][_0x527db5[_0x9398('0x22')]][_0x2e44f6]=_0x527db5[_0x9398('0x2b')];}}}};Fax[_0x9398('0x1b')][_0x9398('0x2c')]=function(_0x2bf336){if(this[_0x9398('0xd')][_0x2bf336['uniqueid']]){this[_0x9398('0xd')][_0x2bf336['uniqueid']][_0x9398('0x2d')]=_0x2bf336['operation'];this[_0x9398('0xd')][_0x2bf336[_0x9398('0x22')]]['status']=_0x2bf336[_0x9398('0x2e')];this[_0x9398('0xd')][_0x2bf336['uniqueid']][_0x9398('0x21')]=_0x2bf336[_0x9398('0x21')];this['channels'][_0x2bf336[_0x9398('0x22')]][_0x9398('0x2f')]=_0x2bf336[_0x9398('0x2f')];logger['info'](_0x2bf336[_0x9398('0x22')],_0x9398('0x30'));}};Fax[_0x9398('0x1b')][_0x9398('0x18')]=function(_0x30e1d8){var _0x542c06=this;if(this[_0x9398('0xd')][_0x30e1d8['uniqueid']]){var _0x56c833=this['channels'][_0x30e1d8['uniqueid']]['id'];this[_0x9398('0xd')][_0x30e1d8['uniqueid']][_0x9398('0x31')]=_0x30e1d8['remotestationid'];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]]['pagestransferred']=_0x30e1d8[_0x9398('0x32')];this['channels'][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x21')]=_0x30e1d8[_0x9398('0x21')];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x33')]=_0x30e1d8[_0x9398('0x33')];this['channels'][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x34')]=_0x30e1d8[_0x9398('0x34')];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x2f')]=_0x30e1d8['filename'];this[_0x9398('0xd')][_0x30e1d8[_0x9398('0x22')]][_0x9398('0x35')]=_0x30e1d8[_0x9398('0x35')];if(this['channels'][_0x30e1d8[_0x9398('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x30e1d8['filename'],_0x9398('0x36'),function(_0x14dfb1){logger[_0x9398('0x25')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x37'),_0x14dfb1[_0x9398('0x38')]);attachment[_0x9398('0x39')]({'name':path['parse'](_0x30e1d8['filename'])['name'],'basename':path[_0x9398('0x3a')](_0x30e1d8[_0x9398('0x2f')])[_0x9398('0x24')]+'.pdf','type':_0x9398('0x3b')})[_0x9398('0x3c')](function(_0x69207f){faxAccount[_0x9398('0x3d')](_0x56c833,{'from':_0x30e1d8['calleridnum'],'mapKey':_0x9398('0x6'),'body':path[_0x9398('0x3a')](_0x30e1d8[_0x9398('0x2f')])['name']+_0x9398('0x3e'),'AttachmentId':_0x69207f['id']})[_0x9398('0x3f')](function(_0x284950){logger[_0x9398('0x40')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x41'),JSON[_0x9398('0x42')](_0x284950));});})[_0x9398('0x3f')](function(_0x148b44){logger[_0x9398('0x40')](_0x30e1d8[_0x9398('0x22')],_0x9398('0x43'),JSON[_0x9398('0x42')](_0x148b44));});});}logger['info'](_0x30e1d8['uniqueid'],_0x9398('0x43'));}};Fax[_0x9398('0x1b')]['syncOriginateResponse']=function(_0x232946){if(this['actions'][_0x232946['uniqueid']]){_[_0x9398('0x44')](this['channels'][_0x232946[_0x9398('0x22')]],_[_0x9398('0x45')](_0x232946,['response',_0x9398('0x46')]));}};function updateStatus(_0x4c2894){if(_0x4c2894['AttachmentId']){faxMessage[_0x9398('0x47')](_0x4c2894[_0x9398('0x48')],{'failMessage':_0x9398('0x49')})['then'](function(_0x1b6bbe){ut['logger'](_0x9398('0x4a'),_0x1b6bbe);})['catch'](function(_0x3a05a9){ut[_0x9398('0x4b')](_0x9398('0x4c'),_0x3a05a9);});}else{ut[_0x9398('0x4b')](_0x9398('0x4d'));}}Fax[_0x9398('0x1b')][_0x9398('0x4e')]=function(_0x10c6f8,_0x53497d,_0x43f0f9){var _0x471e4d=this;var _0x9c0c43={};if(_0x53497d){_0x9c0c43={'read':_0x53497d};}else{_0x9c0c43={'failMessage':_0x43f0f9};}if(this[_0x9398('0x26')][_0x10c6f8][_0x9398('0x48')]){faxMessage[_0x9398('0x47')](this[_0x9398('0x26')][_0x10c6f8][_0x9398('0x48')],_0x9c0c43)[_0x9398('0x3c')](function(_0x28534e){ut['logger']('[Fax][Message][Updated]',_0x28534e);})['catch'](function(_0x66e9ff){ut[_0x9398('0x4b')]('[Fax][Message][NoUpdate1]',_0x66e9ff);})[_0x9398('0x4f')](function(){delete _0x471e4d[_0x9398('0xd')][_0x10c6f8];delete _0x471e4d[_0x9398('0x26')][_0x10c6f8];});}else{ut[_0x9398('0x4b')](_0x9398('0x50'));delete this[_0x9398('0xd')][_0x10c6f8];delete this[_0x9398('0x26')][_0x10c6f8];}};Fax[_0x9398('0x1b')][_0x9398('0x19')]=function(_0x369fb8){var _0x5dfcf5=this;if(this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]){if(this['actions'][_0x369fb8['uniqueid']]){this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]['id']=this[_0x9398('0x26')][_0x369fb8[_0x9398('0x22')]]['id'];this['channels'][_0x369fb8[_0x9398('0x22')]]['name']=this[_0x9398('0x26')][_0x369fb8[_0x9398('0x22')]][_0x9398('0x24')];}logger[_0x9398('0x25')](_0x369fb8[_0x9398('0x22')],this['actions'][_0x369fb8['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x9398('0x51'),JSON[_0x9398('0x42')](this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]));if(this['actions'][_0x369fb8[_0x9398('0x22')]]){if(this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]]['faxpages']>0x0&&this[_0x9398('0xd')][_0x369fb8['uniqueid']][_0x9398('0x17')]==='SUCCESS'){this[_0x9398('0x4e')](_0x369fb8[_0x9398('0x22')],!![]);}else{this['updateStatus'](_0x369fb8[_0x9398('0x22')],![],this[_0x9398('0xd')][_0x369fb8[_0x9398('0x22')]][_0x9398('0x52')]?_0x9398('0x53')+this['channels'][_0x369fb8[_0x9398('0x22')]]['faxstatusstring']:_0x9398('0x54'));}}}};Fax[_0x9398('0x1b')][_0x9398('0x55')]=function(_0x1031d8){var _0x5debed=this;return new BPromise(function(_0x3f0f47,_0x3d2bcd){_0x5debed[_0x9398('0x56')](_0x1031d8,_0x5debed[_0x9398('0x1e')][_0x1031d8[_0x9398('0x57')]])[_0x9398('0x3c')](function(_0x5bace7){ut[_0x9398('0x4b')](_0x9398('0x58'),_0x5bace7);_0x3f0f47(ut[_0x9398('0x38')](_0x9398('0x59')));})[_0x9398('0x3f')](function(_0x1c6b3b){ut['logger'](_0x9398('0x5a'),_0x1c6b3b);updateStatus(_0x1031d8);_0x3d2bcd(ut[_0x9398('0x38')](_0x9398('0x5b')));});});};Fax['prototype'][_0x9398('0x5c')]=function(_0x553339){var _0x2ff40e=this;return new BPromise(function(_0x1600d6,_0x8459bf){var _0x4829d5=_0x2ff40e['checkTrunk'](_0x2ff40e['faxAccounts'][_0x553339['FaxAccountId']][_0x9398('0x5d')],_0x553339);if(_0x4829d5[_0x9398('0x5e')]){_0x1600d6(ut[_0x9398('0x38')](_0x9398('0x5f')));}else{_0x8459bf(ut[_0x9398('0x38')](_0x4829d5['message']));}});};function originate(_0x4a9f70,_0x384f9b,_0x3e8d43){return new BPromise(function(_0x2968a8,_0x53ff76){if(_0x3e8d43){var _0xd96992=util[_0x9398('0x60')](_0x9398('0x61'),path[_0x9398('0x3a')](_0x4a9f70[_0x9398('0x3')])[_0x9398('0x24')],_0x4a9f70[_0x9398('0x3')]);gs[_0x9398('0x62')](_0xd96992)[_0x9398('0x3c')](function(){_0x4a9f70[_0x9398('0x3')]=util['format'](_0x9398('0x63'),path[_0x9398('0x3a')](_0x4a9f70['path'])[_0x9398('0x64')],path[_0x9398('0x3a')](_0x4a9f70[_0x9398('0x3')])['name']);_0x384f9b[_0x9398('0x65')]=_0x4a9f70['path'];ut[_0x9398('0x4b')](_0x9398('0x66'),'');ami['Action'](ut['variablesAction'](_0x4a9f70,_0x384f9b))['then'](function(_0x299de5){_0x2968a8(_0x299de5);})[_0x9398('0x3f')](function(_0x2be253){_0x53ff76(_0x2be253);});})[_0x9398('0x3f')](function(_0x5c4cee){_0x53ff76(_0x5c4cee);});}else{ami[_0x9398('0x67')](ut[_0x9398('0x68')](_0x4a9f70,_0x384f9b))[_0x9398('0x3c')](function(_0x10ce65){_0x2968a8(_0x10ce65);})[_0x9398('0x3f')](function(_0x25540f){_0x53ff76(_0x25540f);});}});}Fax['prototype']['execOriginate']=function(_0x5cbfc6,_0x4254d0){var _0x5de3a3=this;return new BPromise(function(_0x53fd60,_0x147b83){var _0x30130c=uuid['v4']();var _0x24f41b=ut['addVariables'](_0x5cbfc6,_0x4254d0);_0x5de3a3['actions'][_0x30130c]=new Action(_0x30130c,_0x4254d0,_0x5cbfc6);var _0x3a74f8=_0x5de3a3[_0x9398('0x26')][_0x30130c];if(path[_0x9398('0x3a')](_0x5cbfc6[_0x9398('0x3')])[_0x9398('0x69')]===_0x9398('0x3e')){originate(_0x3a74f8,_0x24f41b,!![])[_0x9398('0x3c')](function(_0x56369a){_0x53fd60(_0x56369a);})[_0x9398('0x3f')](function(_0x488d59){_0x147b83(_0x488d59);});}else{originate(_0x3a74f8,_0x24f41b,![])[_0x9398('0x3c')](function(_0x56cbb0){_0x53fd60(_0x56cbb0);})[_0x9398('0x3f')](function(_0x47bfb9){_0x147b83(_0x47bfb9);});}});};Fax['prototype'][_0x9398('0x6a')]=function(_0x21c94e){return!_[_0x9398('0x6b')](_0x21c94e)&&!_[_0x9398('0x6b')](_0x21c94e[_0x9398('0x24')])&&!_['isNil'](_0x21c94e[_0x9398('0x6c')])&&_0x21c94e[_0x9398('0x6c')]&&!_[_0x9398('0x6b')](this['trunks'][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])])&&!_['isNil'](this[_0x9398('0xe')][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])][_0x9398('0x2e')])&&(this['trunks'][util['format'](_0x9398('0x6d'),_0x21c94e['name'])][_0x9398('0x2e')]===_0x9398('0x6e')||this['trunks'][util[_0x9398('0x60')](_0x9398('0x6d'),_0x21c94e[_0x9398('0x24')])][_0x9398('0x2e')]===_0x9398('0x6f'));};Fax[_0x9398('0x1b')][_0x9398('0x70')]=function(_0x2a35b8,_0x12e351){if(!this[_0x9398('0x6a')](_0x2a35b8)){ut[_0x9398('0x4b')](_0x9398('0x71'),_['isNil'](_0x2a35b8)?'':_0x2a35b8[_0x9398('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x9398('0x72')};}if(_[_0x9398('0x6b')](_0x12e351['fax'])){ut['logger'](_0x9398('0x73'),JSON[_0x9398('0x42')](_0x12e351));return{'isValid':![],'message':_0x9398('0x74')};}if(_['isNil'](_0x12e351['path'])){ut[_0x9398('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x12e351));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9398('0x75')};};module['exports']=Fax; \ No newline at end of file +var _0xb2a1=['transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','faxstatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','channel','uniqueid','name','info','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution'];(function(_0x614626,_0xba1a54){var _0x4fb999=function(_0xae4934){while(--_0xae4934){_0x614626['push'](_0x614626['shift']());}};_0x4fb999(++_0xba1a54);}(_0xb2a1,0xb9));var _0x1b2a=function(_0x222c76,_0x2a472e){_0x222c76=_0x222c76-0x0;var _0xd7ff8d=_0xb2a1[_0x222c76];return _0xd7ff8d;};'use strict';var util=require(_0x1b2a('0x0'));var _=require(_0x1b2a('0x1'));var BPromise=require(_0x1b2a('0x2'));var uuid=require(_0x1b2a('0x3'));var moment=require(_0x1b2a('0x4'));var path=require(_0x1b2a('0x5'));var tiff2pdf=require(_0x1b2a('0x6'));var gs=require('./util/gs');var logger=require(_0x1b2a('0x7'))(_0x1b2a('0x8'));var ami=require(_0x1b2a('0x9'));var rpcDb=require(_0x1b2a('0xa'));var Channel=require(_0x1b2a('0xb'));var ut=require('./util/util');var Action=require(_0x1b2a('0xc'));var faxAccount=require(_0x1b2a('0xd'));var attachment=require(_0x1b2a('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x491d2b){this[_0x1b2a('0xf')]={};this[_0x1b2a('0x10')]=_0x491d2b[_0x1b2a('0x10')];this[_0x1b2a('0x11')]=_0x491d2b['trunks'];this[_0x1b2a('0x12')]={};ami['on'](_0x1b2a('0x13'),this[_0x1b2a('0x14')][_0x1b2a('0x15')](this));ami['on'](_0x1b2a('0x16'),this[_0x1b2a('0x17')][_0x1b2a('0x15')](this));ami['on'](_0x1b2a('0x18'),this[_0x1b2a('0x19')][_0x1b2a('0x15')](this));ami['on']('newexten',this['syncNewExten'][_0x1b2a('0x15')](this));ami['on'](_0x1b2a('0x1a'),this['syncFaxStatus'][_0x1b2a('0x15')](this));ami['on']('receivefax',this[_0x1b2a('0x1b')][_0x1b2a('0x15')](this));ami['on']('hangup',this[_0x1b2a('0x1c')][_0x1b2a('0x15')](this));ami['on'](_0x1b2a('0x1d'),this[_0x1b2a('0x1e')][_0x1b2a('0x15')](this));}Fax['prototype']['syncNewchannel']=function(_0x1da0d9){if(_0x1da0d9[_0x1b2a('0x1f')]===_0x1b2a('0x20')){for(var _0x1d72a7 in this[_0x1b2a('0x10')]){if(this[_0x1b2a('0x10')][_0x1b2a('0x21')](_0x1d72a7)){if(_0x1da0d9[_0x1b2a('0x22')]===this[_0x1b2a('0x10')][_0x1d72a7]['localstationid']){this[_0x1b2a('0xf')][_0x1da0d9['uniqueid']]={};this['channels'][_0x1da0d9['uniqueid']][_0x1b2a('0x23')]=_0x1da0d9['channel'];this[_0x1b2a('0xf')][_0x1da0d9[_0x1b2a('0x24')]]['id']=this[_0x1b2a('0x10')][_0x1d72a7]['id'];this['channels'][_0x1da0d9[_0x1b2a('0x24')]][_0x1b2a('0x25')]=this['faxAccounts'][_0x1d72a7]['name'];logger[_0x1b2a('0x26')](_0x1da0d9[_0x1b2a('0x24')],_0x1b2a('0x27'));}}}}if(this[_0x1b2a('0x12')][_0x1da0d9[_0x1b2a('0x24')]]){this[_0x1b2a('0xf')][_0x1da0d9[_0x1b2a('0x24')]]={};this[_0x1b2a('0xf')][_0x1da0d9[_0x1b2a('0x24')]]['channel']=_0x1da0d9[_0x1b2a('0x23')];logger[_0x1b2a('0x26')](_0x1da0d9[_0x1b2a('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x1b2a('0x28')]['syncVarSet']=function(_0x21166a){if(this[_0x1b2a('0xf')][_0x21166a[_0x1b2a('0x24')]]){for(var _0x34093f in _0x21166a[_0x1b2a('0x29')]){if(_0x21166a[_0x1b2a('0x29')]['hasOwnProperty'](_0x34093f)){this[_0x1b2a('0xf')][_0x21166a[_0x1b2a('0x24')]][_0x34093f]=_0x21166a[_0x1b2a('0x2a')];}}}};Fax[_0x1b2a('0x28')]['syncNewState']=function(_0x3b7d25){if(this['channels'][_0x3b7d25[_0x1b2a('0x24')]]){this[_0x1b2a('0xf')][_0x3b7d25[_0x1b2a('0x24')]][_0x1b2a('0x2b')]=_0x3b7d25[_0x1b2a('0x2b')];this[_0x1b2a('0xf')][_0x3b7d25['uniqueid']][_0x1b2a('0x2c')]=_0x3b7d25[_0x1b2a('0x2c')];}};Fax[_0x1b2a('0x28')][_0x1b2a('0x2d')]=function(_0x5013d9){if(this['channels'][_0x5013d9[_0x1b2a('0x24')]]){for(var _0x581fe6 in _0x5013d9[_0x1b2a('0x29')]){if(_0x5013d9[_0x1b2a('0x29')][_0x1b2a('0x21')](_0x581fe6)){this[_0x1b2a('0xf')][_0x5013d9[_0x1b2a('0x24')]][_0x581fe6]=_0x5013d9[_0x1b2a('0x2a')];}}}};Fax['prototype'][_0x1b2a('0x2e')]=function(_0x4f69c8){if(this[_0x1b2a('0xf')][_0x4f69c8[_0x1b2a('0x24')]]){this[_0x1b2a('0xf')][_0x4f69c8[_0x1b2a('0x24')]][_0x1b2a('0x2f')]=_0x4f69c8['operation'];this[_0x1b2a('0xf')][_0x4f69c8[_0x1b2a('0x24')]][_0x1b2a('0x30')]=_0x4f69c8[_0x1b2a('0x30')];this[_0x1b2a('0xf')][_0x4f69c8['uniqueid']]['localstationid']=_0x4f69c8['localstationid'];this['channels'][_0x4f69c8[_0x1b2a('0x24')]][_0x1b2a('0x31')]=_0x4f69c8['filename'];logger[_0x1b2a('0x26')](_0x4f69c8[_0x1b2a('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x1b2a('0x28')]['syncReceiveFax']=function(_0x44ea1f){var _0x2c22ac=this;if(this[_0x1b2a('0xf')][_0x44ea1f[_0x1b2a('0x24')]]){var _0x4aa8e4=this[_0x1b2a('0xf')][_0x44ea1f[_0x1b2a('0x24')]]['id'];this[_0x1b2a('0xf')][_0x44ea1f['uniqueid']][_0x1b2a('0x32')]=_0x44ea1f[_0x1b2a('0x32')];this[_0x1b2a('0xf')][_0x44ea1f[_0x1b2a('0x24')]][_0x1b2a('0x33')]=_0x44ea1f[_0x1b2a('0x33')];this[_0x1b2a('0xf')][_0x44ea1f[_0x1b2a('0x24')]]['localstationid']=_0x44ea1f['localstationid'];this['channels'][_0x44ea1f[_0x1b2a('0x24')]][_0x1b2a('0x34')]=_0x44ea1f[_0x1b2a('0x34')];this[_0x1b2a('0xf')][_0x44ea1f['uniqueid']][_0x1b2a('0x35')]=_0x44ea1f[_0x1b2a('0x35')];this['channels'][_0x44ea1f[_0x1b2a('0x24')]][_0x1b2a('0x31')]=_0x44ea1f[_0x1b2a('0x31')];this['channels'][_0x44ea1f[_0x1b2a('0x24')]][_0x1b2a('0x36')]=_0x44ea1f[_0x1b2a('0x36')];if(this['channels'][_0x44ea1f[_0x1b2a('0x24')]][_0x1b2a('0x33')]>0x0){tiff2pdf(_0x44ea1f[_0x1b2a('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x575562){logger[_0x1b2a('0x26')](_0x44ea1f['uniqueid'],_0x1b2a('0x37'),_0x575562[_0x1b2a('0x38')]);attachment[_0x1b2a('0x39')]({'name':path[_0x1b2a('0x3a')](_0x44ea1f[_0x1b2a('0x31')])[_0x1b2a('0x25')],'basename':path[_0x1b2a('0x3a')](_0x44ea1f[_0x1b2a('0x31')])[_0x1b2a('0x25')]+'.pdf','type':_0x1b2a('0x3b')})['then'](function(_0x281f1b){faxAccount[_0x1b2a('0x3c')](_0x4aa8e4,{'from':_0x44ea1f[_0x1b2a('0x36')],'mapKey':_0x1b2a('0x8'),'body':path[_0x1b2a('0x3a')](_0x44ea1f[_0x1b2a('0x31')])[_0x1b2a('0x25')]+_0x1b2a('0x3d'),'AttachmentId':_0x281f1b['id']})[_0x1b2a('0x3e')](function(_0x3e16c9){logger[_0x1b2a('0x3f')](_0x44ea1f[_0x1b2a('0x24')],_0x1b2a('0x40'),JSON[_0x1b2a('0x41')](_0x3e16c9));});})[_0x1b2a('0x3e')](function(_0x5cced6){logger['error'](_0x44ea1f[_0x1b2a('0x24')],'\x20receiveFax\x20',JSON['stringify'](_0x5cced6));});});}logger[_0x1b2a('0x26')](_0x44ea1f[_0x1b2a('0x24')],_0x1b2a('0x42'));}};Fax['prototype'][_0x1b2a('0x1e')]=function(_0x26abe7){if(this[_0x1b2a('0x12')][_0x26abe7[_0x1b2a('0x24')]]){_[_0x1b2a('0x43')](this[_0x1b2a('0xf')][_0x26abe7[_0x1b2a('0x24')]],_['pick'](_0x26abe7,[_0x1b2a('0x44'),_0x1b2a('0x45')]));}};function updateStatus(_0x28e584){if(_0x28e584[_0x1b2a('0x46')]){faxMessage[_0x1b2a('0x47')](_0x28e584[_0x1b2a('0x46')],{'failMessage':_0x1b2a('0x48')})[_0x1b2a('0x49')](function(_0x1f2bbe){ut[_0x1b2a('0x4a')](_0x1b2a('0x4b'),_0x1f2bbe);})[_0x1b2a('0x3e')](function(_0x27bcad){ut['logger'](_0x1b2a('0x4c'),_0x27bcad);});}else{ut[_0x1b2a('0x4a')](_0x1b2a('0x4d'));}}Fax[_0x1b2a('0x28')][_0x1b2a('0x4e')]=function(_0x58053a,_0x1773ef,_0x671080){var _0x5b2d47=this;var _0xda35e={};if(_0x1773ef){_0xda35e={'read':_0x1773ef};}else{_0xda35e={'failMessage':_0x671080};}if(this[_0x1b2a('0x12')][_0x58053a]['AttachmentId']){faxMessage[_0x1b2a('0x47')](this[_0x1b2a('0x12')][_0x58053a]['AttachmentId'],_0xda35e)[_0x1b2a('0x49')](function(_0x3cdd3b){ut[_0x1b2a('0x4a')]('[Fax][Message][Updated]',_0x3cdd3b);})[_0x1b2a('0x3e')](function(_0x477e83){ut[_0x1b2a('0x4a')](_0x1b2a('0x4f'),_0x477e83);})['finally'](function(){delete _0x5b2d47[_0x1b2a('0xf')][_0x58053a];delete _0x5b2d47[_0x1b2a('0x12')][_0x58053a];});}else{ut[_0x1b2a('0x4a')](_0x1b2a('0x50'));delete this[_0x1b2a('0xf')][_0x58053a];delete this[_0x1b2a('0x12')][_0x58053a];}};Fax[_0x1b2a('0x28')][_0x1b2a('0x1c')]=function(_0x980297){var _0x3b1298=this;if(this['channels'][_0x980297['uniqueid']]){if(this[_0x1b2a('0x12')][_0x980297[_0x1b2a('0x24')]]){this[_0x1b2a('0xf')][_0x980297[_0x1b2a('0x24')]]['id']=this[_0x1b2a('0x12')][_0x980297[_0x1b2a('0x24')]]['id'];this[_0x1b2a('0xf')][_0x980297[_0x1b2a('0x24')]][_0x1b2a('0x25')]=this[_0x1b2a('0x12')][_0x980297[_0x1b2a('0x24')]][_0x1b2a('0x25')];}logger[_0x1b2a('0x26')](_0x980297[_0x1b2a('0x24')],this[_0x1b2a('0x12')][_0x980297[_0x1b2a('0x24')]]?_0x1b2a('0x51'):_0x1b2a('0x52'),JSON[_0x1b2a('0x41')](this['channels'][_0x980297['uniqueid']]));if(this[_0x1b2a('0x12')][_0x980297[_0x1b2a('0x24')]]){if(this[_0x1b2a('0xf')][_0x980297[_0x1b2a('0x24')]][_0x1b2a('0x53')]>0x0&&this['channels'][_0x980297['uniqueid']][_0x1b2a('0x1a')]===_0x1b2a('0x54')){this[_0x1b2a('0x4e')](_0x980297[_0x1b2a('0x24')],!![]);}else{this['updateStatus'](_0x980297[_0x1b2a('0x24')],![],this[_0x1b2a('0xf')][_0x980297[_0x1b2a('0x24')]][_0x1b2a('0x55')]?_0x1b2a('0x56')+this[_0x1b2a('0xf')][_0x980297[_0x1b2a('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x1b2a('0x28')]['send']=function(_0x5ec92f){var _0x7f3042=this;return new BPromise(function(_0x4184d8,_0x1796ce){_0x7f3042[_0x1b2a('0x57')](_0x5ec92f,_0x7f3042['faxAccounts'][_0x5ec92f[_0x1b2a('0x58')]])[_0x1b2a('0x49')](function(_0x488542){ut[_0x1b2a('0x4a')]('[Fax][execOriginate][success]',_0x488542);_0x4184d8(ut[_0x1b2a('0x38')](_0x1b2a('0x59')));})[_0x1b2a('0x3e')](function(_0x4465a6){ut[_0x1b2a('0x4a')](_0x1b2a('0x5a'),_0x4465a6);updateStatus(_0x5ec92f);_0x1796ce(ut[_0x1b2a('0x38')](_0x1b2a('0x5b')));});});};Fax[_0x1b2a('0x28')][_0x1b2a('0x5c')]=function(_0x354a27){var _0x3b657f=this;return new BPromise(function(_0x55c1a2,_0x39ed71){var _0x1bd634=_0x3b657f[_0x1b2a('0x5d')](_0x3b657f[_0x1b2a('0x10')][_0x354a27[_0x1b2a('0x58')]]['Trunk'],_0x354a27);if(_0x1bd634[_0x1b2a('0x5e')]){_0x55c1a2(ut['message'](_0x1b2a('0x5f')));}else{_0x39ed71(ut[_0x1b2a('0x38')](_0x1bd634['message']));}});};function originate(_0x49a336,_0x49c671,_0x1f5899){return new BPromise(function(_0x2f116f,_0x68a62){if(_0x1f5899){var _0x521cb0=util[_0x1b2a('0x60')](_0x1b2a('0x61'),path[_0x1b2a('0x3a')](_0x49a336[_0x1b2a('0x5')])[_0x1b2a('0x25')],_0x49a336[_0x1b2a('0x5')]);gs[_0x1b2a('0x62')](_0x521cb0)['then'](function(){_0x49a336[_0x1b2a('0x5')]=util[_0x1b2a('0x60')](_0x1b2a('0x63'),path['parse'](_0x49a336[_0x1b2a('0x5')])['dir'],path['parse'](_0x49a336[_0x1b2a('0x5')])['name']);_0x49c671[_0x1b2a('0x64')]=_0x49a336[_0x1b2a('0x5')];ut[_0x1b2a('0x4a')](_0x1b2a('0x65'),'');ami['Action'](ut['variablesAction'](_0x49a336,_0x49c671))[_0x1b2a('0x49')](function(_0x192ef8){_0x2f116f(_0x192ef8);})['catch'](function(_0x57a393){_0x68a62(_0x57a393);});})[_0x1b2a('0x3e')](function(_0x225de2){_0x68a62(_0x225de2);});}else{ami[_0x1b2a('0x66')](ut[_0x1b2a('0x67')](_0x49a336,_0x49c671))['then'](function(_0x4674a7){_0x2f116f(_0x4674a7);})['catch'](function(_0x3a9930){_0x68a62(_0x3a9930);});}});}Fax[_0x1b2a('0x28')][_0x1b2a('0x57')]=function(_0x4f7ac4,_0x2a773a){var _0x487198=this;return new BPromise(function(_0x3f51ae,_0x4ef6f2){var _0x1d7f48=uuid['v4']();var _0x174359=ut[_0x1b2a('0x68')](_0x4f7ac4,_0x2a773a);_0x487198[_0x1b2a('0x12')][_0x1d7f48]=new Action(_0x1d7f48,_0x2a773a,_0x4f7ac4);var _0xa0dfbb=_0x487198[_0x1b2a('0x12')][_0x1d7f48];if(path[_0x1b2a('0x3a')](_0x4f7ac4[_0x1b2a('0x5')])[_0x1b2a('0x69')]===_0x1b2a('0x3d')){originate(_0xa0dfbb,_0x174359,!![])['then'](function(_0x813f41){_0x3f51ae(_0x813f41);})[_0x1b2a('0x3e')](function(_0x123e3d){_0x4ef6f2(_0x123e3d);});}else{originate(_0xa0dfbb,_0x174359,![])[_0x1b2a('0x49')](function(_0x41da73){_0x3f51ae(_0x41da73);})['catch'](function(_0x400f45){_0x4ef6f2(_0x400f45);});}});};Fax['prototype'][_0x1b2a('0x6a')]=function(_0x2a0da0){return!_['isNil'](_0x2a0da0)&&!_[_0x1b2a('0x6b')](_0x2a0da0[_0x1b2a('0x25')])&&!_[_0x1b2a('0x6b')](_0x2a0da0[_0x1b2a('0x6c')])&&_0x2a0da0[_0x1b2a('0x6c')]&&!_[_0x1b2a('0x6b')](this['trunks'][util['format'](_0x1b2a('0x6d'),_0x2a0da0[_0x1b2a('0x25')])])&&!_[_0x1b2a('0x6b')](this[_0x1b2a('0x11')][util[_0x1b2a('0x60')](_0x1b2a('0x6d'),_0x2a0da0[_0x1b2a('0x25')])]['status'])&&(this[_0x1b2a('0x11')][util[_0x1b2a('0x60')](_0x1b2a('0x6d'),_0x2a0da0['name'])][_0x1b2a('0x30')]===_0x1b2a('0x6e')||this[_0x1b2a('0x11')][util[_0x1b2a('0x60')](_0x1b2a('0x6d'),_0x2a0da0['name'])]['status']==='unmonitored');};Fax[_0x1b2a('0x28')][_0x1b2a('0x5d')]=function(_0x41ed60,_0xa4de6d){if(!this['isTrunkReachable'](_0x41ed60)){ut[_0x1b2a('0x4a')](_0x1b2a('0x6f'),_['isNil'](_0x41ed60)?'':_0x41ed60[_0x1b2a('0x25')]+_0x1b2a('0x70'));return{'isValid':![],'message':_0x1b2a('0x71')};}if(_[_0x1b2a('0x6b')](_0xa4de6d[_0x1b2a('0x8')])){ut['logger'](_0x1b2a('0x72'),JSON[_0x1b2a('0x41')](_0xa4de6d));return{'isValid':![],'message':_0x1b2a('0x73')};}if(_[_0x1b2a('0x6b')](_0xa4de6d[_0x1b2a('0x5')])){ut[_0x1b2a('0x4a')](_0x1b2a('0x74'),JSON['stringify'](_0xa4de6d));return{'isValid':![],'message':_0x1b2a('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x1b2a('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index fc4a063..458991c 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 _0xa5d8=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','resolve','catch'];(function(_0x588146,_0x32e8c4){var _0x5e19ac=function(_0x2f92d5){while(--_0x2f92d5){_0x588146['push'](_0x588146['shift']());}};_0x5e19ac(++_0x32e8c4);}(_0xa5d8,0xd2));var _0x8a5d=function(_0x3c4ad5,_0x5737eb){_0x3c4ad5=_0x3c4ad5-0x0;var _0x4c564d=_0xa5d8[_0x3c4ad5];return _0x4c564d;};'use strict';var util=require(_0x8a5d('0x0'));var BPromise=require(_0x8a5d('0x1'));var logger=require(_0x8a5d('0x2'))(_0x8a5d('0x3'));var _=require(_0x8a5d('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x59ccb3){return function(_0xfd6316){logger[_0x8a5d('0x5')](_0x59ccb3,util[_0x8a5d('0x6')](_0xfd6316,{'showHidden':![],'depth':null}));};}exports[_0x8a5d('0x7')]=function(_0x3a7270,_0x2ce035){return BPromise[_0x8a5d('0x8')]()['then'](faxAccount[_0x8a5d('0x7')](_0x3a7270,_0x2ce035))[_0x8a5d('0x9')](loggerCatch(_0x8a5d('0xa')));}; \ No newline at end of file +var _0xe70c=['util','../../../config/logger','preview','../rpc/faxAccount','inspect','notify','resolve'];(function(_0x2bc189,_0x30d6ce){var _0xa25a0f=function(_0x342e8c){while(--_0x342e8c){_0x2bc189['push'](_0x2bc189['shift']());}};_0xa25a0f(++_0x30d6ce);}(_0xe70c,0xcb));var _0xce70=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe70c[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xce70('0x0'));var BPromise=require('bluebird');var logger=require(_0xce70('0x1'))(_0xce70('0x2'));var _=require('lodash');var faxAccount=require(_0xce70('0x3'));function loggerCatch(_0x229e3d){return function(_0x48eb57){logger['error'](_0x229e3d,util[_0xce70('0x4')](_0x48eb57,{'showHidden':![],'depth':null}));};}exports[_0xce70('0x5')]=function(_0x1e7a7b,_0x5ee38d){return BPromise[_0xce70('0x6')]()['then'](faxAccount['notify'](_0x1e7a7b,_0x5ee38d))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e56a806..9653e1a 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 _0x329c=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x326c90,_0x143586){var _0x553370=function(_0xaedd29){while(--_0xaedd29){_0x326c90['push'](_0x326c90['shift']());}};_0x553370(++_0x143586);}(_0x329c,0x91));var _0xc329=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x329c[_0x4854d6];return _0x3885c0;};'use strict';var util=require(_0xc329('0x0'));var logger=require(_0xc329('0x1'))(_0xc329('0x2'));var BPromise=require(_0xc329('0x3'));var exec=require(_0xc329('0x4'))[_0xc329('0x5')];exports[_0xc329('0x6')]=function(_0x1982db){return new BPromise(function(_0xc077db,_0x2365d4){exec(_0x1982db,function(_0x567169,_0x169526,_0x1f750c){logger[_0xc329('0x7')]('Exec\x20gs',_0x169526);if(_0x567169){logger[_0xc329('0x7')](_0xc329('0x8'),_0xc329('0x9'),util[_0xc329('0xa')](_0x567169,{'showHidden':![],'depth':null}),_0x169526,_0x1f750c);_0x2365d4(_0x567169);}_0xc077db(_0x169526);});});}; \ No newline at end of file +var _0x3c01=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x3c01,0xd0));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x13c0('0x0'));var logger=require(_0x13c0('0x1'))(_0x13c0('0x2'));var BPromise=require(_0x13c0('0x3'));var exec=require(_0x13c0('0x4'))[_0x13c0('0x5')];exports[_0x13c0('0x6')]=function(_0x5145de){return new BPromise(function(_0x10911d,_0x2f8f1a){exec(_0x5145de,function(_0x3a9f4f,_0x25d3b3,_0x43d977){logger[_0x13c0('0x7')](_0x13c0('0x8'),_0x25d3b3);if(_0x3a9f4f){logger[_0x13c0('0x7')](_0x13c0('0x8'),_0x13c0('0x9'),util['inspect'](_0x3a9f4f,{'showHidden':![],'depth':null}),_0x25d3b3,_0x43d977);_0x2f8f1a(_0x3a9f4f);}_0x10911d(_0x25d3b3);});});}; \ 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 0e0cd31..7c1ba29 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 _0x6c76=['fax','message','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','moment'];(function(_0x5b30b5,_0x2b146e){var _0x3db40f=function(_0x2188b0){while(--_0x2188b0){_0x5b30b5['push'](_0x5b30b5['shift']());}};_0x3db40f(++_0x2b146e);}(_0x6c76,0x184));var _0x66c7=function(_0x568f30,_0x1a3c1a){_0x568f30=_0x568f30-0x0;var _0x162baf=_0x6c76[_0x568f30];return _0x162baf;};'use strict';var util=require(_0x66c7('0x0'));var _=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var logger=require('../../../../config/logger')(_0x66c7('0x3'));exports[_0x66c7('0x4')]=function(_0x519756){return{'message':_0x519756};};exports['logger']=function(_0x2f6db7,_0x2b7cf3){logger['info'](_0x2f6db7,util[_0x66c7('0x5')](_0x2b7cf3,{'showHidden':![],'depth':null}));};exports[_0x66c7('0x6')]=function(_0x52f71b,_0x23408c){var _0x4dffcd={'XMF-ECM':_0x23408c['ecm'],'XMF-HEADERINFO':_0x23408c[_0x66c7('0x7')],'XMF-MINRATE':_0x23408c[_0x66c7('0x8')],'XMF-MAXRATE':_0x23408c[_0x66c7('0x9')],'XMF-MODEM':util['format'](_0x66c7('0xa'),_0x23408c[_0x66c7('0xb')]),'XMF-GATEWAY':_0x23408c[_0x66c7('0xc')],'XMF-FAXDETECT':_0x23408c[_0x66c7('0xd')],'XMF-T38TIMEOUT':_0x23408c['t38timeout'],'XMF-LOCALSTATIONID':_0x23408c[_0x66c7('0xe')],'XMF-PATH':_0x52f71b[_0x66c7('0xf')]};return _0x4dffcd;};exports[_0x66c7('0x10')]=function(_0x187e00,_0x21fb64){return{'actionid':_0x187e00[_0x66c7('0x11')],'action':_0x66c7('0x12'),'channel':_0x187e00['channel'],'Exten':_0x66c7('0x13'),'Context':_0x66c7('0x14'),'Priority':'1','callerid':util[_0x66c7('0x15')](_0x66c7('0x16'),_0x187e00[_0x66c7('0x7')]?_0x187e00[_0x66c7('0x7')]:'',_0x187e00[_0x66c7('0xe')]),'variable':_0x21fb64,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x187e00[_0x66c7('0x11')]};}; \ No newline at end of file +var _0x750a=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','lodash','fax','message','logger','info','inspect','addVariables','ecm','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','variablesAction','uniqueid','channel'];(function(_0x5a3e48,_0xc6374){var _0x36bb87=function(_0x2d2883){while(--_0x2d2883){_0x5a3e48['push'](_0x5a3e48['shift']());}};_0x36bb87(++_0xc6374);}(_0x750a,0x140));var _0xa750=function(_0x2d07fd,_0xdcf44b){_0x2d07fd=_0x2d07fd-0x0;var _0x3f7fe3=_0x750a[_0x2d07fd];return _0x3f7fe3;};'use strict';var util=require('util');var _=require(_0xa750('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xa750('0x1'));exports[_0xa750('0x2')]=function(_0x1b459c){return{'message':_0x1b459c};};exports[_0xa750('0x3')]=function(_0x457cae,_0x43d704){logger[_0xa750('0x4')](_0x457cae,util[_0xa750('0x5')](_0x43d704,{'showHidden':![],'depth':null}));};exports[_0xa750('0x6')]=function(_0x2497df,_0x197299){var _0x1ae455={'XMF-ECM':_0x197299[_0xa750('0x7')],'XMF-HEADERINFO':_0x197299['headerinfo'],'XMF-MINRATE':_0x197299['minrate'],'XMF-MAXRATE':_0x197299[_0xa750('0x8')],'XMF-MODEM':util['format'](_0xa750('0x9'),_0x197299[_0xa750('0xa')]),'XMF-GATEWAY':_0x197299['gateway'],'XMF-FAXDETECT':_0x197299[_0xa750('0xb')],'XMF-T38TIMEOUT':_0x197299[_0xa750('0xc')],'XMF-LOCALSTATIONID':_0x197299['localstationid'],'XMF-PATH':_0x2497df['path']};return _0x1ae455;};exports[_0xa750('0xd')]=function(_0x4b19a1,_0x174fd0){return{'actionid':_0x4b19a1[_0xa750('0xe')],'action':'originate','channel':_0x4b19a1[_0xa750('0xf')],'Exten':_0xa750('0x10'),'Context':_0xa750('0x11'),'Priority':'1','callerid':util['format'](_0xa750('0x12'),_0x4b19a1[_0xa750('0x13')]?_0x4b19a1[_0xa750('0x13')]:'',_0x4b19a1[_0xa750('0x14')]),'variable':_0x174fd0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b19a1[_0xa750('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2757361..bec861a 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 _0x2c1b=['initCampaignHopperHistory','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c1b,0xcf));var _0xb2c1=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x2c1b[_0x5cb1af];return _0x8d7940;};'use strict';var BPromise=require(_0xb2c1('0x0'));var util=require(_0xb2c1('0x1'));var moment=require(_0xb2c1('0x2'));var server=require(_0xb2c1('0x3'));var Realtime=require(_0xb2c1('0x4'));var Report=require(_0xb2c1('0x5'));var Acw=require(_0xb2c1('0x6'));var Trigger=require(_0xb2c1('0x7'));var Dialer=require(_0xb2c1('0x8'));var Preview=require(_0xb2c1('0x9'));var Fax=require(_0xb2c1('0xa'));var user=require(_0xb2c1('0xb'));var voiceQueue=require(_0xb2c1('0xc'));var voiceQueueReport=require(_0xb2c1('0xd'));var voiceCallReport=require(_0xb2c1('0xe'));var trunk=require(_0xb2c1('0xf'));var trigger=require(_0xb2c1('0x10'));var template=require(_0xb2c1('0x11'));var cmHopperHistory=require(_0xb2c1('0x12'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xb2c1('0x13'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xb2c1('0x14'));var salesforce=require(_0xb2c1('0x15'));var sugarcrm=require(_0xb2c1('0x16'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xb2c1('0x17'));var zoho=require(_0xb2c1('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xb2c1('0x19'));var servicenow=require(_0xb2c1('0x1a'));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()[_0xb2c1('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb2c1('0x1b')](_0xb2c1('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xb2c1('0x1d')]()[_0xb2c1('0x1e')](user[_0xb2c1('0x1f')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x20')]())[_0xb2c1('0x1e')](user[_0xb2c1('0x21')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x22')]())[_0xb2c1('0x1e')](trunk[_0xb2c1('0x23')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x24')]())[_0xb2c1('0x1e')](voiceQueue[_0xb2c1('0x25')]())[_0xb2c1('0x1e')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())['then'](realtime[_0xb2c1('0x26')]())['then'](template[_0xb2c1('0x27')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x28')]())[_0xb2c1('0x1e')](zendesk['getZendeskAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x29')]())[_0xb2c1('0x1e')](salesforce['getSalesforceAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2a')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2b')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xb2c1('0x1e')](realtime['initFreshdeskAccounts']())[_0xb2c1('0x1e')](desk[_0xb2c1('0x2c')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2d')]())[_0xb2c1('0x1e')](zoho[_0xb2c1('0x2e')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x2f')]())[_0xb2c1('0x1e')](vtiger[_0xb2c1('0x30')]())[_0xb2c1('0x1e')](realtime['initVtigerAccounts']())[_0xb2c1('0x1e')](freshsales['getFreshsalesAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x31')]())[_0xb2c1('0x1e')](servicenow[_0xb2c1('0x32')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x33')]())[_0xb2c1('0x1e')](dynamics365['getDynamics365Accounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x34')]())['then'](campaign[_0xb2c1('0x35')]())['then'](realtime['initCampaigns']())[_0xb2c1('0x1e')](voiceExtension[_0xb2c1('0x36')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x37')]())['then'](faxAccount['getFaxAccounts']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x38')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xb2c1('0x1d')]()[_0xb2c1('0x1e')](voiceQueueReport[_0xb2c1('0x39')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3a')]())[_0xb2c1('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3b')]())['then'](cmHopperHistory[_0xb2c1('0x3c')]())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3d')]())[_0xb2c1('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xb2c1('0x1e')](realtime[_0xb2c1('0x3e')]())[_0xb2c1('0x1e')](function(_0x100210){})[_0xb2c1('0x3f')](function(_0x359118){console['log'](_0x359118);});}function main(){return server[_0xb2c1('0x40')](realtime,preview,fax)['then'](function(_0xbc04d6){return initRealtime();})[_0xb2c1('0x1e')](function(){return initParams();})[_0xb2c1('0x1e')](function(){report[_0xb2c1('0x41')]();setInterval(initRealtime,0x1388);})[_0xb2c1('0x3f')](function(_0x26964e){console[_0xb2c1('0x42')](_0x26964e);});}main(); \ No newline at end of file +var _0x7caa=['log','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x492445,_0x1454f9){var _0x34ca20=function(_0x33e606){while(--_0x33e606){_0x492445['push'](_0x492445['shift']());}};_0x34ca20(++_0x1454f9);}(_0x7caa,0xf9));var _0xa7ca=function(_0x4c9f69,_0x43ebc1){_0x4c9f69=_0x4c9f69-0x0;var _0x6b35f8=_0x7caa[_0x4c9f69];return _0x6b35f8;};'use strict';var BPromise=require(_0xa7ca('0x0'));var util=require(_0xa7ca('0x1'));var moment=require(_0xa7ca('0x2'));var server=require('./server');var Realtime=require(_0xa7ca('0x3'));var Report=require(_0xa7ca('0x4'));var Acw=require(_0xa7ca('0x5'));var Trigger=require(_0xa7ca('0x6'));var Dialer=require('./dialer');var Preview=require(_0xa7ca('0x7'));var Fax=require(_0xa7ca('0x8'));var user=require(_0xa7ca('0x9'));var voiceQueue=require(_0xa7ca('0xa'));var voiceQueueReport=require(_0xa7ca('0xb'));var voiceCallReport=require(_0xa7ca('0xc'));var trunk=require(_0xa7ca('0xd'));var trigger=require('./rpc/trigger');var template=require(_0xa7ca('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xa7ca('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xa7ca('0x10'));var zendesk=require(_0xa7ca('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xa7ca('0x12'));var freshdesk=require(_0xa7ca('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa7ca('0x14'));var freshsales=require(_0xa7ca('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xa7ca('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa7ca('0x17')](_0xa7ca('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa7ca('0x17')](_0xa7ca('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xa7ca('0x19')](user['getAgents']())[_0xa7ca('0x19')](realtime[_0xa7ca('0x1a')]())[_0xa7ca('0x19')](user['getTelephones']())['then'](realtime[_0xa7ca('0x1b')]())[_0xa7ca('0x19')](trunk[_0xa7ca('0x1c')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x1d')]())[_0xa7ca('0x19')](voiceQueue[_0xa7ca('0x1e')]())['then'](realtime[_0xa7ca('0x1f')]())[_0xa7ca('0x19')](trigger[_0xa7ca('0x20')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x21')]())[_0xa7ca('0x19')](template[_0xa7ca('0x22')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x23')]())[_0xa7ca('0x19')](zendesk[_0xa7ca('0x24')]())[_0xa7ca('0x19')](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())['then'](realtime[_0xa7ca('0x25')]())[_0xa7ca('0x19')](sugarcrm['getSugarcrmAccounts']())[_0xa7ca('0x19')](realtime[_0xa7ca('0x26')]())[_0xa7ca('0x19')](freshdesk[_0xa7ca('0x27')]())[_0xa7ca('0x19')](realtime['initFreshdeskAccounts']())[_0xa7ca('0x19')](desk[_0xa7ca('0x28')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x29')]())['then'](zoho[_0xa7ca('0x2a')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x2b')]())[_0xa7ca('0x19')](vtiger['getVtigerAccounts']())[_0xa7ca('0x19')](realtime['initVtigerAccounts']())[_0xa7ca('0x19')](freshsales[_0xa7ca('0x2c')]())[_0xa7ca('0x19')](realtime['initFreshsalesAccounts']())[_0xa7ca('0x19')](servicenow[_0xa7ca('0x2d')]())['then'](realtime[_0xa7ca('0x2e')]())['then'](dynamics365[_0xa7ca('0x2f')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x30')]())[_0xa7ca('0x19')](campaign[_0xa7ca('0x31')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x32')]())[_0xa7ca('0x19')](voiceExtension['getVoiceExtensions']())[_0xa7ca('0x19')](realtime[_0xa7ca('0x33')]())[_0xa7ca('0x19')](faxAccount[_0xa7ca('0x34')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x35')]())[_0xa7ca('0x19')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xa7ca('0x19')](voiceQueueReport[_0xa7ca('0x36')]())['then'](realtime[_0xa7ca('0x37')]())[_0xa7ca('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xa7ca('0x19')](realtime[_0xa7ca('0x38')]())[_0xa7ca('0x19')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xa7ca('0x39')]())[_0xa7ca('0x19')](voiceCallReport[_0xa7ca('0x3a')]())[_0xa7ca('0x19')](realtime[_0xa7ca('0x3b')]())[_0xa7ca('0x19')](function(_0x112647){})[_0xa7ca('0x3c')](function(_0x25eb13){console['log'](_0x25eb13);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x9c979f){return initRealtime();})[_0xa7ca('0x19')](function(){return initParams();})[_0xa7ca('0x19')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xa7ca('0x3c')](function(_0x4a1b44){console[_0xa7ca('0x3d')](_0x4a1b44);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a35a646..c38e297 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 _0x055b=['voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','toLowerCase','not_inuse','inuse','talking','statePause','toNumber','voiceStatusCallerIdNumber','interface','stringify','format','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online'];(function(_0x374a51,_0x5ec767){var _0x354ee9=function(_0x4183e9){while(--_0x4183e9){_0x374a51['push'](_0x374a51['shift']());}};_0x354ee9(++_0x5ec767);}(_0x055b,0x152));var _0xb055=function(_0x5436d4,_0xd522ce){_0x5436d4=_0x5436d4-0x0;var _0xf402d4=_0x055b[_0x5436d4];return _0xf402d4;};'use strict';var _=require(_0xb055('0x0'));var util=require(_0xb055('0x1'));var moment=require(_0xb055('0x2'));var md5=require(_0xb055('0x3'));var Redis=require(_0xb055('0x4'));var config=require(_0xb055('0x5'));config[_0xb055('0x6')]=_[_0xb055('0x7')](config[_0xb055('0x6')],{'host':_0xb055('0x8'),'port':0x18eb});var io=require(_0xb055('0x9'))(new Redis(config[_0xb055('0x6')]));function Agent(_0x390104){this['id']=_0x390104['id']||0x0;this[_0xb055('0xa')]=_0x390104[_0xb055('0xa')]||'';this[_0xb055('0xb')]=_0x390104[_0xb055('0xb')]||'';this[_0xb055('0xc')]=_0x390104[_0xb055('0xc')]||'';this['fullname']=_0x390104[_0xb055('0xd')]||'';this[_0xb055('0xe')]=_0xb055('0xf');this[_0xb055('0x10')]=0x0;this[_0xb055('0x11')]=_0xb055('0xf');this[_0xb055('0x12')]='';this[_0xb055('0x13')]='';this[_0xb055('0x14')]='';this['interface']='';this[_0xb055('0x15')]=_0x390104[_0xb055('0x15')]||![];this[_0xb055('0x16')]=_0xb055('0xf');this[_0xb055('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xb055('0x18')]='';this[_0xb055('0x19')]=![];this[_0xb055('0x1a')]=![];this[_0xb055('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x5950b2){var _0x57fa61;if(_0x5950b2&&_0x5950b2[_0xb055('0xe')]){_0x57fa61=_0x5950b2[_0xb055('0xe')][_0xb055('0x1b')]();switch(_0x57fa61){case _0xb055('0x1c'):_0x57fa61='idle';break;case _0xb055('0x1d'):_0x57fa61=_0xb055('0x1e');break;}}if(_0x57fa61&&this[_0xb055('0x16')]!==_0x57fa61||_0x5950b2[_0xb055('0x1f')]){this['voiceStatusTime']=_[_0xb055('0x20')](moment()['format']('x'));}if(_0x57fa61){this[_0xb055('0x16')]=_0x57fa61;}var _0x17d69f={'id':this['id'],'name':this[_0xb055('0xa')],'email':this[_0xb055('0xb')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0xb055('0xe')],'stateTime':this[_0xb055('0x10')],'status':this[_0xb055('0x11')],'address':this[_0xb055('0x12')],'online':this[_0xb055('0x15')],'voiceStatus':this[_0xb055('0x16')],'voiceStatusTime':this[_0xb055('0x17')],'voiceStatusCallerIdNumber':this[_0xb055('0x21')],'voiceStatusQueue':this[_0xb055('0x18')],'interface':this[_0xb055('0x22')],'onhold':this[_0xb055('0x19')]};var _0x3c0a18=md5(JSON[_0xb055('0x23')](_0x17d69f));if(this[_0xb055('0x3')]!==_0x3c0a18){this[_0xb055('0x3')]=_0x3c0a18;io['to'](util[_0xb055('0x24')]('user:%s',_0x17d69f[_0xb055('0xa')]))[_0xb055('0x25')](_0xb055('0x26'),_0x17d69f);}};module[_0xb055('0x27')]=Agent; \ No newline at end of file +var _0xc883=['user:%s','emit','user:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','stateTime','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','toNumber','format','voiceStatusQueue','onhold','stringify','md5'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc883,0x100));var _0x3c88=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xc883[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x3c88('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x3c88('0x1'));var config=require(_0x3c88('0x2'));config[_0x3c88('0x3')]=_[_0x3c88('0x4')](config[_0x3c88('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3c88('0x5'))(new Redis(config[_0x3c88('0x3')]));function Agent(_0x316fea){this['id']=_0x316fea['id']||0x0;this[_0x3c88('0x6')]=_0x316fea[_0x3c88('0x6')]||'';this[_0x3c88('0x7')]=_0x316fea[_0x3c88('0x7')]||'';this[_0x3c88('0x8')]=_0x316fea['accountcode']||'';this[_0x3c88('0x9')]=_0x316fea[_0x3c88('0x9')]||'';this['state']='unknown';this[_0x3c88('0xa')]=0x0;this['status']=_0x3c88('0xb');this[_0x3c88('0xc')]='';this[_0x3c88('0xd')]='';this[_0x3c88('0xe')]='';this[_0x3c88('0xf')]='';this[_0x3c88('0x10')]=_0x316fea[_0x3c88('0x10')]||![];this[_0x3c88('0x11')]='unknown';this[_0x3c88('0x12')]=0x0;this[_0x3c88('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x3c88('0x14')]=function(_0x28ab1b){var _0x132dcb;if(_0x28ab1b&&_0x28ab1b[_0x3c88('0x15')]){_0x132dcb=_0x28ab1b[_0x3c88('0x15')][_0x3c88('0x16')]();switch(_0x132dcb){case _0x3c88('0x17'):_0x132dcb=_0x3c88('0x18');break;case _0x3c88('0x19'):_0x132dcb='talking';break;}}if(_0x132dcb&&this[_0x3c88('0x11')]!==_0x132dcb||_0x28ab1b['statePause']){this[_0x3c88('0x12')]=_[_0x3c88('0x1a')](moment()[_0x3c88('0x1b')]('x'));}if(_0x132dcb){this[_0x3c88('0x11')]=_0x132dcb;}var _0x26c726={'id':this['id'],'name':this[_0x3c88('0x6')],'email':this[_0x3c88('0x7')],'accountcode':this[_0x3c88('0x8')],'fullname':this[_0x3c88('0x9')],'state':this[_0x3c88('0x15')],'stateTime':this[_0x3c88('0xa')],'status':this['status'],'address':this[_0x3c88('0xc')],'online':this[_0x3c88('0x10')],'voiceStatus':this[_0x3c88('0x11')],'voiceStatusTime':this[_0x3c88('0x12')],'voiceStatusCallerIdNumber':this[_0x3c88('0x13')],'voiceStatusQueue':this[_0x3c88('0x1c')],'interface':this['interface'],'onhold':this[_0x3c88('0x1d')]};var _0x2ff857=md5(JSON[_0x3c88('0x1e')](_0x26c726));if(this[_0x3c88('0x1f')]!==_0x2ff857){this[_0x3c88('0x1f')]=_0x2ff857;io['to'](util[_0x3c88('0x1b')](_0x3c88('0x20'),_0x26c726['name']))[_0x3c88('0x21')](_0x3c88('0x22'),_0x26c726);}};module[_0x3c88('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6f4c53b..f5d1fba 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 _0x30d9=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x70bd25,_0xfef885){var _0x45ae64=function(_0x299802){while(--_0x299802){_0x70bd25['push'](_0x70bd25['shift']());}};_0x45ae64(++_0xfef885);}(_0x30d9,0xd7));var _0x930d=function(_0x5ea3ab,_0x2ff882){_0x5ea3ab=_0x5ea3ab-0x0;var _0x4d3a6f=_0x30d9[_0x5ea3ab];return _0x4d3a6f;};'use strict';function Campaign(_0x132fde){this['id']=_0x132fde['id']||0x0;this[_0x930d('0x0')]=_0x132fde['name']||'';this[_0x930d('0x1')]=_0x132fde['type']||'campaign';this[_0x930d('0x2')]=0x0;this[_0x930d('0x3')]=0x0;this[_0x930d('0x4')]=0x0;this[_0x930d('0x5')]=0x0;this[_0x930d('0x6')]='';this[_0x930d('0x7')]=!![];this['active']=_0x132fde[_0x930d('0x8')];this['limitCalls']=_0x132fde[_0x930d('0x9')];this[_0x930d('0xa')]=_0x132fde[_0x930d('0xa')]||null;this[_0x930d('0xb')]=_0x132fde[_0x930d('0xb')]?_0x132fde[_0x930d('0xb')]:null;this[_0x930d('0xc')]=_0x132fde[_0x930d('0xc')];this[_0x930d('0xd')]=_0x132fde['dialOriginateCallerIdNumber'];this[_0x930d('0xe')]=_0x132fde['dialOriginateTimeout']||0x1e;this[_0x930d('0xf')]=_0x132fde[_0x930d('0xf')];this[_0x930d('0x10')]=_0x132fde[_0x930d('0x10')];this['dialBusyMaxRetry']=_0x132fde[_0x930d('0x11')];this[_0x930d('0x12')]=_0x132fde[_0x930d('0x12')];this[_0x930d('0x13')]=_0x132fde[_0x930d('0x13')];this[_0x930d('0x14')]=_0x132fde[_0x930d('0x14')];this['dialGlobalMaxRetry']=_0x132fde[_0x930d('0x15')];this[_0x930d('0x16')]=_0x132fde[_0x930d('0x16')]||0x3;this[_0x930d('0x17')]=_0x132fde[_0x930d('0x17')]||0x96;this[_0x930d('0x18')]=_0x132fde[_0x930d('0x18')]||0x3;this[_0x930d('0x19')]=_0x132fde[_0x930d('0x19')]||0x96;this[_0x930d('0x1a')]=_0x132fde[_0x930d('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x132fde[_0x930d('0x1b')]||0x96;this[_0x930d('0x1c')]=_0x132fde[_0x930d('0x1c')]||0x3;this[_0x930d('0x1d')]=_0x132fde['dialMachineRetryFrequency']||0x96;this[_0x930d('0x1e')]=_0x132fde[_0x930d('0x1e')]||0x3;this[_0x930d('0x1f')]=_0x132fde[_0x930d('0x1f')]||0x96;this[_0x930d('0x20')]=_0x132fde[_0x930d('0x20')]||_0x930d('0x21');this[_0x930d('0x22')]=_0x132fde[_0x930d('0x22')]||undefined;this[_0x930d('0x23')]=_0x132fde[_0x930d('0x23')]||undefined;this[_0x930d('0x24')]=_0x132fde['dialCutDigit']||undefined;this[_0x930d('0x25')]=_0x132fde['TrunkBackup']?_0x132fde[_0x930d('0x25')]:undefined;this[_0x930d('0x26')]=_0x132fde[_0x930d('0x26')]?_0x132fde['Trunk']:undefined;this[_0x930d('0x27')]=_0x132fde[_0x930d('0x27')]?_0x132fde['Interval']:undefined;this[_0x930d('0x28')]=_0x132fde[_0x930d('0x28')]?_0x132fde['SquareProject']:undefined;this[_0x930d('0x29')]=_0x132fde[_0x930d('0x28')]?_0x132fde[_0x930d('0x28')][_0x930d('0x0')]:undefined;this['dialAMDActive']=_0x132fde[_0x930d('0x2a')]||![];this[_0x930d('0x2b')]=_0x132fde['dialAMDInitialSilence'];this[_0x930d('0x2c')]=_0x132fde[_0x930d('0x2c')];this[_0x930d('0x2d')]=_0x132fde[_0x930d('0x2d')];this['dialAMDTotalAnalysisTime']=_0x132fde[_0x930d('0x2e')];this[_0x930d('0x2f')]=_0x132fde['dialAMDMinWordLength'];this[_0x930d('0x30')]=_0x132fde[_0x930d('0x30')];this[_0x930d('0x31')]=_0x132fde['dialAMDMaximumNumberOfWords'];this[_0x930d('0x32')]=_0x132fde[_0x930d('0x32')];this[_0x930d('0x33')]=_0x132fde[_0x930d('0x33')];}module[_0x930d('0x34')]=Campaign; \ No newline at end of file +var _0xd98a=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active'];(function(_0x1b15a5,_0x3c94e7){var _0x29f4bb=function(_0x4ac609){while(--_0x4ac609){_0x1b15a5['push'](_0x1b15a5['shift']());}};_0x29f4bb(++_0x3c94e7);}(_0xd98a,0x156));var _0xad98=function(_0xa4e8d8,_0x2c4841){_0xa4e8d8=_0xa4e8d8-0x0;var _0x373614=_0xd98a[_0xa4e8d8];return _0x373614;};'use strict';function Campaign(_0x3ec29a){this['id']=_0x3ec29a['id']||0x0;this[_0xad98('0x0')]=_0x3ec29a[_0xad98('0x0')]||'';this[_0xad98('0x1')]=_0x3ec29a[_0xad98('0x1')]||'campaign';this[_0xad98('0x2')]=0x0;this[_0xad98('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xad98('0x4')]=0x0;this[_0xad98('0x5')]='';this[_0xad98('0x6')]=!![];this[_0xad98('0x7')]=_0x3ec29a[_0xad98('0x7')];this[_0xad98('0x8')]=_0x3ec29a[_0xad98('0x8')];this[_0xad98('0x9')]=_0x3ec29a['dialTimezone']||null;this[_0xad98('0xa')]=_0x3ec29a[_0xad98('0xa')]?_0x3ec29a[_0xad98('0xa')]:null;this[_0xad98('0xb')]=_0x3ec29a['dialOriginateCallerIdName'];this[_0xad98('0xc')]=_0x3ec29a['dialOriginateCallerIdNumber'];this[_0xad98('0xd')]=_0x3ec29a[_0xad98('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x3ec29a['dialCongestionMaxRetry'];this[_0xad98('0xe')]=_0x3ec29a[_0xad98('0xe')];this['dialBusyMaxRetry']=_0x3ec29a[_0xad98('0xf')];this[_0xad98('0x10')]=_0x3ec29a[_0xad98('0x10')];this[_0xad98('0x11')]=_0x3ec29a['dialNoAnswerMaxRetry'];this[_0xad98('0x12')]=_0x3ec29a[_0xad98('0x12')];this[_0xad98('0x13')]=_0x3ec29a[_0xad98('0x13')];this[_0xad98('0x14')]=_0x3ec29a[_0xad98('0x14')]||0x3;this[_0xad98('0x15')]=_0x3ec29a[_0xad98('0x15')]||0x96;this[_0xad98('0x16')]=_0x3ec29a[_0xad98('0x16')]||0x3;this[_0xad98('0x17')]=_0x3ec29a[_0xad98('0x17')]||0x96;this[_0xad98('0x18')]=_0x3ec29a[_0xad98('0x18')]||0x3;this[_0xad98('0x19')]=_0x3ec29a['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x3ec29a[_0xad98('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x3ec29a[_0xad98('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x3ec29a[_0xad98('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3ec29a[_0xad98('0x1d')]||0x96;this[_0xad98('0x1e')]=_0x3ec29a[_0xad98('0x1e')]||'DESC';this['dialPrefix']=_0x3ec29a[_0xad98('0x1f')]||undefined;this[_0xad98('0x20')]=_0x3ec29a[_0xad98('0x20')]||undefined;this[_0xad98('0x21')]=_0x3ec29a[_0xad98('0x21')]||undefined;this[_0xad98('0x22')]=_0x3ec29a[_0xad98('0x22')]?_0x3ec29a['TrunkBackup']:undefined;this[_0xad98('0x23')]=_0x3ec29a[_0xad98('0x23')]?_0x3ec29a['Trunk']:undefined;this['Interval']=_0x3ec29a['Interval']?_0x3ec29a[_0xad98('0x24')]:undefined;this['SquareProject']=_0x3ec29a[_0xad98('0x25')]?_0x3ec29a[_0xad98('0x25')]:undefined;this[_0xad98('0x26')]=_0x3ec29a[_0xad98('0x25')]?_0x3ec29a[_0xad98('0x25')][_0xad98('0x0')]:undefined;this[_0xad98('0x27')]=_0x3ec29a[_0xad98('0x27')]||![];this[_0xad98('0x28')]=_0x3ec29a[_0xad98('0x28')];this[_0xad98('0x29')]=_0x3ec29a[_0xad98('0x29')];this[_0xad98('0x2a')]=_0x3ec29a['dialAMDAfterGreetingSilence'];this[_0xad98('0x2b')]=_0x3ec29a[_0xad98('0x2b')];this[_0xad98('0x2c')]=_0x3ec29a['dialAMDMinWordLength'];this[_0xad98('0x2d')]=_0x3ec29a[_0xad98('0x2d')];this[_0xad98('0x2e')]=_0x3ec29a[_0xad98('0x2e')];this[_0xad98('0x2f')]=_0x3ec29a[_0xad98('0x2f')];this[_0xad98('0x30')]=_0x3ec29a[_0xad98('0x30')];}module[_0xad98('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index ef26414..9661be6 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 _0xfb8a=['answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten'];(function(_0x455e00,_0x29577f){var _0x568400=function(_0x6dd5c9){while(--_0x6dd5c9){_0x455e00['push'](_0x455e00['shift']());}};_0x568400(++_0x29577f);}(_0xfb8a,0x109));var _0xafb8=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xfb8a[_0x342700];return _0x53406f;};'use strict';function Channel(){this[_0xafb8('0x0')]=null;this[_0xafb8('0x1')]='';this[_0xafb8('0x2')]='';this[_0xafb8('0x3')]=0x0;this['calleridname']='';this[_0xafb8('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xafb8('0x5')]=0x0;this[_0xafb8('0x6')]='';this[_0xafb8('0x7')]=0x0;this[_0xafb8('0x8')]=0x0;this[_0xafb8('0x9')]=0x0;this[_0xafb8('0xa')]=![];this[_0xafb8('0xb')]=null;this[_0xafb8('0xc')]=null;this[_0xafb8('0xd')]=![];this[_0xafb8('0xe')]=![];this[_0xafb8('0xf')]='';this[_0xafb8('0x10')]='';this[_0xafb8('0x11')]=0x0;this[_0xafb8('0x12')]=0x0;this['holdtime']=0x0;this[_0xafb8('0x13')]=null;this['tag']=null;this[_0xafb8('0x14')]=null;this[_0xafb8('0x15')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0xafb8('0x16')]=undefined;this[_0xafb8('0x17')]=undefined;this[_0xafb8('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x9d01=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','starttime','channel'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x9d01,0x1ec));var _0x19d0=function(_0xee3c89,_0x344e1d){_0xee3c89=_0xee3c89-0x0;var _0x4bf911=_0x9d01[_0xee3c89];return _0x4bf911;};'use strict';function Channel(){this[_0x19d0('0x0')]=null;this[_0x19d0('0x1')]='';this[_0x19d0('0x2')]='';this[_0x19d0('0x3')]=0x0;this[_0x19d0('0x4')]='';this[_0x19d0('0x5')]=undefined;this[_0x19d0('0x6')]=undefined;this[_0x19d0('0x7')]=0x0;this['context']='';this[_0x19d0('0x8')]=0x0;this['linkedid']=0x0;this[_0x19d0('0x9')]=0x0;this[_0x19d0('0xa')]=![];this[_0x19d0('0xb')]=null;this['endtime']=null;this[_0x19d0('0xc')]=![];this[_0x19d0('0xd')]=![];this[_0x19d0('0xe')]='';this[_0x19d0('0xf')]='';this[_0x19d0('0x10')]=0x0;this[_0x19d0('0x11')]=0x0;this[_0x19d0('0x12')]=0x0;this[_0x19d0('0x13')]=null;this[_0x19d0('0x14')]=null;this[_0x19d0('0x15')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x19d0('0x16')]=null;this[_0x19d0('0x17')]=[];this[_0x19d0('0x18')]=undefined;this[_0x19d0('0x19')]=undefined;this['mohtime']=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 a2aad7b..c920754 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 _0x777f=['token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x2b2cdf,_0x1586aa){var _0x343405=function(_0x4dfa8c){while(--_0x4dfa8c){_0x2b2cdf['push'](_0x2b2cdf['shift']());}};_0x343405(++_0x1586aa);}(_0x777f,0x9f));var _0xf777=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x777f[_0x5b6cf1];return _0x46278c;};'use strict';function DeskAccount(_0x2e2375){this['id']=_0x2e2375['id']||0x0;this[_0xf777('0x0')]=_0x2e2375[_0xf777('0x0')]||'';this[_0xf777('0x1')]=_0x2e2375[_0xf777('0x1')]||'';this[_0xf777('0x2')]=_0x2e2375[_0xf777('0x2')]||'';this[_0xf777('0x3')]=_0x2e2375['authType']||'';this[_0xf777('0x4')]=_0x2e2375[_0xf777('0x4')]||'';this['consumerKey']=_0x2e2375['consumerKey']||'';this['consumerSecret']=_0x2e2375[_0xf777('0x5')]||'';this[_0xf777('0x6')]=_0x2e2375[_0xf777('0x6')]||'';this[_0xf777('0x7')]=_0x2e2375[_0xf777('0x7')]||'';this[_0xf777('0x8')]=_0x2e2375[_0xf777('0x8')]||'';this[_0xf777('0x9')]=_0x2e2375['serverUrl']||'';this['Configurations']=_0x2e2375['Configurations']||{};}module[_0xf777('0xa')]=DeskAccount; \ No newline at end of file +var _0x0dee=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x2a44eb,_0x4f3448){var _0x22a54=function(_0x519f62){while(--_0x519f62){_0x2a44eb['push'](_0x2a44eb['shift']());}};_0x22a54(++_0x4f3448);}(_0x0dee,0xf7));var _0xe0de=function(_0x4b418d,_0xf00e43){_0x4b418d=_0x4b418d-0x0;var _0x1e5ebf=_0x0dee[_0x4b418d];return _0x1e5ebf;};'use strict';function DeskAccount(_0x2d297c){this['id']=_0x2d297c['id']||0x0;this[_0xe0de('0x0')]=_0x2d297c['name']||'';this[_0xe0de('0x1')]=_0x2d297c['username']||'';this[_0xe0de('0x2')]=_0x2d297c[_0xe0de('0x2')]||'';this['authType']=_0x2d297c[_0xe0de('0x3')]||'';this[_0xe0de('0x4')]=_0x2d297c[_0xe0de('0x4')]||'';this['consumerKey']=_0x2d297c[_0xe0de('0x5')]||'';this['consumerSecret']=_0x2d297c[_0xe0de('0x6')]||'';this[_0xe0de('0x7')]=_0x2d297c[_0xe0de('0x7')]||'';this['tokenSecret']=_0x2d297c[_0xe0de('0x8')]||'';this['type']=_0x2d297c[_0xe0de('0x9')]||'';this['serverUrl']=_0x2d297c[_0xe0de('0xa')]||'';this[_0xe0de('0xb')]=_0x2d297c[_0xe0de('0xb')]||{};}module[_0xe0de('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cceeca5..648432d 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 _0xc9dc=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x37862a,_0x2bc98e){var _0x5b0104=function(_0x391413){while(--_0x391413){_0x37862a['push'](_0x37862a['shift']());}};_0x5b0104(++_0x2bc98e);}(_0xc9dc,0x9c));var _0xcc9d=function(_0x37de5e,_0x3fa541){_0x37de5e=_0x37de5e-0x0;var _0x447e06=_0xc9dc[_0x37de5e];return _0x447e06;};'use strict';function Dynamics365Account(_0x34fc89){this['id']=_0x34fc89['id']||0x0;this[_0xcc9d('0x0')]=_0x34fc89['name']||'';this['username']=_0x34fc89[_0xcc9d('0x1')]||'';this[_0xcc9d('0x2')]=_0x34fc89[_0xcc9d('0x2')]||'';this[_0xcc9d('0x3')]=_0x34fc89[_0xcc9d('0x3')]||'';this['tenantId']=_0x34fc89[_0xcc9d('0x4')]||'';this[_0xcc9d('0x5')]=_0x34fc89[_0xcc9d('0x5')]||'';this[_0xcc9d('0x6')]=_0x34fc89[_0xcc9d('0x6')]||{};this[_0xcc9d('0x7')]=_0x34fc89['serverUrl']||'';this[_0xcc9d('0x8')]=_0x34fc89['Configurations']||{};}module[_0xcc9d('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x4c9d=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x247b0b,_0x3df01f){var _0x44dfde=function(_0x27bf40){while(--_0x27bf40){_0x247b0b['push'](_0x247b0b['shift']());}};_0x44dfde(++_0x3df01f);}(_0x4c9d,0x11f));var _0xd4c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4c9d[_0x2dafbe];return _0x58a45a;};'use strict';function Dynamics365Account(_0x4e1f80){this['id']=_0x4e1f80['id']||0x0;this['name']=_0x4e1f80[_0xd4c9('0x0')]||'';this[_0xd4c9('0x1')]=_0x4e1f80[_0xd4c9('0x1')]||'';this[_0xd4c9('0x2')]=_0x4e1f80[_0xd4c9('0x2')]||'';this[_0xd4c9('0x3')]=_0x4e1f80[_0xd4c9('0x3')]||'';this[_0xd4c9('0x4')]=_0x4e1f80['tenantId']||'';this[_0xd4c9('0x5')]=_0x4e1f80['clientId']||'';this[_0xd4c9('0x6')]=_0x4e1f80[_0xd4c9('0x6')]||{};this[_0xd4c9('0x7')]=_0x4e1f80[_0xd4c9('0x7')]||'';this['Configurations']=_0x4e1f80[_0xd4c9('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 96d1408..8a5df21 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 _0x7a7c=['t38timeout','tech','SIP','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect'];(function(_0x3c8344,_0x42b61c){var _0x59ba5=function(_0x228f07){while(--_0x228f07){_0x3c8344['push'](_0x3c8344['shift']());}};_0x59ba5(++_0x42b61c);}(_0x7a7c,0x1c6));var _0xc7a7=function(_0x2e81c7,_0x57f15a){_0x2e81c7=_0x2e81c7-0x0;var _0x2427dd=_0x7a7c[_0x2e81c7];return _0x2427dd;};'use strict';function FaxAccount(_0x3066df){this['id']=_0x3066df['id']||0x0;this[_0xc7a7('0x0')]=_0x3066df[_0xc7a7('0x0')]||'';this[_0xc7a7('0x1')]=_0x3066df['description'];this[_0xc7a7('0x2')]=_0x3066df[_0xc7a7('0x2')];this[_0xc7a7('0x3')]=_0x3066df['headerinfo'];this[_0xc7a7('0x4')]=_0x3066df[_0xc7a7('0x4')];this['minrate']=_0x3066df[_0xc7a7('0x5')]||0x960;this[_0xc7a7('0x6')]=_0x3066df[_0xc7a7('0x6')]||0x3840;this[_0xc7a7('0x7')]=_0x3066df[_0xc7a7('0x7')]||'v17,v27,v29';this[_0xc7a7('0x8')]=_0x3066df[_0xc7a7('0x8')]||'no';this['faxdetect']=_0x3066df[_0xc7a7('0x9')]||'no';this[_0xc7a7('0xa')]=_0x3066df[_0xc7a7('0xa')]||0x1388;this[_0xc7a7('0xb')]=_0x3066df[_0xc7a7('0xb')]||_0xc7a7('0xc');this[_0xc7a7('0xd')]=_0x3066df[_0xc7a7('0xd')]?_0x3066df['Trunk']:undefined;this['ListId']=_0x3066df['ListId'];this['key']=_0x3066df[_0xc7a7('0xe')];}module[_0xc7a7('0xf')]=FaxAccount; \ No newline at end of file +var _0x0a0d=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29','gateway'];(function(_0x472f79,_0x2b1258){var _0x1d7778=function(_0x5b01c4){while(--_0x5b01c4){_0x472f79['push'](_0x472f79['shift']());}};_0x1d7778(++_0x2b1258);}(_0x0a0d,0xe7));var _0xd0a0=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x0a0d[_0x2f1114];return _0x2fe856;};'use strict';function FaxAccount(_0x1171e5){this['id']=_0x1171e5['id']||0x0;this['name']=_0x1171e5['name']||'';this[_0xd0a0('0x0')]=_0x1171e5[_0xd0a0('0x0')];this['ecm']=_0x1171e5[_0xd0a0('0x1')];this[_0xd0a0('0x2')]=_0x1171e5[_0xd0a0('0x2')];this[_0xd0a0('0x3')]=_0x1171e5[_0xd0a0('0x3')];this['minrate']=_0x1171e5[_0xd0a0('0x4')]||0x960;this['maxrate']=_0x1171e5['maxrate']||0x3840;this['modem']=_0x1171e5['modem']||_0xd0a0('0x5');this['gateway']=_0x1171e5[_0xd0a0('0x6')]||'no';this['faxdetect']=_0x1171e5[_0xd0a0('0x7')]||'no';this[_0xd0a0('0x8')]=_0x1171e5[_0xd0a0('0x8')]||0x1388;this['tech']=_0x1171e5[_0xd0a0('0x9')]||_0xd0a0('0xa');this[_0xd0a0('0xb')]=_0x1171e5['Trunk']?_0x1171e5['Trunk']:undefined;this[_0xd0a0('0xc')]=_0x1171e5[_0xd0a0('0xc')];this[_0xd0a0('0xd')]=_0x1171e5['key'];}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 407546d..9f591c6 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 _0x0f08=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x1fa39c,_0x28fa76){var _0x2c7ace=function(_0x45e5d5){while(--_0x45e5d5){_0x1fa39c['push'](_0x1fa39c['shift']());}};_0x2c7ace(++_0x28fa76);}(_0x0f08,0x120));var _0x80f0=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x0f08[_0x1cd47d];return _0x29d52f;};'use strict';function FreshdeskAccount(_0x1577b7){this['id']=_0x1577b7['id']||0x0;this[_0x80f0('0x0')]=_0x1577b7[_0x80f0('0x0')]||'';this['username']=_0x1577b7[_0x80f0('0x1')]||'';this['apiKey']=_0x1577b7['token']||'';this[_0x80f0('0x2')]=_0x1577b7[_0x80f0('0x2')]||'';this[_0x80f0('0x3')]=_0x1577b7[_0x80f0('0x3')]||'';this['Configurations']=_0x1577b7[_0x80f0('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xabe4=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x2b3c76,_0x56d99a){var _0x108e68=function(_0x49d7b2){while(--_0x49d7b2){_0x2b3c76['push'](_0x2b3c76['shift']());}};_0x108e68(++_0x56d99a);}(_0xabe4,0x12d));var _0x4abe=function(_0x291e0e,_0x792683){_0x291e0e=_0x291e0e-0x0;var _0x3f85f3=_0xabe4[_0x291e0e];return _0x3f85f3;};'use strict';function FreshdeskAccount(_0x1b17ef){this['id']=_0x1b17ef['id']||0x0;this['name']=_0x1b17ef[_0x4abe('0x0')]||'';this[_0x4abe('0x1')]=_0x1b17ef[_0x4abe('0x1')]||'';this['apiKey']=_0x1b17ef[_0x4abe('0x2')]||'';this[_0x4abe('0x3')]=_0x1b17ef[_0x4abe('0x3')]||'';this['serverUrl']=_0x1b17ef[_0x4abe('0x4')]||'';this[_0x4abe('0x5')]=_0x1b17ef['Configurations']||{};}module[_0x4abe('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5743bf9..f187789 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 _0xbdf8=['Configurations','exports','name','username','token','remoteUri','serverUrl'];(function(_0x30d02d,_0x7ea7cc){var _0x58138b=function(_0x85127){while(--_0x85127){_0x30d02d['push'](_0x30d02d['shift']());}};_0x58138b(++_0x7ea7cc);}(_0xbdf8,0x16e));var _0x8bdf=function(_0x1b4f28,_0x1fd756){_0x1b4f28=_0x1b4f28-0x0;var _0x354abe=_0xbdf8[_0x1b4f28];return _0x354abe;};'use strict';function FreshsalesAccount(_0x3631c1){this['id']=_0x3631c1['id']||0x0;this[_0x8bdf('0x0')]=_0x3631c1[_0x8bdf('0x0')]||'';this[_0x8bdf('0x1')]=_0x3631c1[_0x8bdf('0x1')]||'';this['apiKey']=_0x3631c1[_0x8bdf('0x2')]||'';this[_0x8bdf('0x3')]=_0x3631c1[_0x8bdf('0x3')]||'';this[_0x8bdf('0x4')]=_0x3631c1[_0x8bdf('0x4')]||'';this[_0x8bdf('0x5')]=_0x3631c1[_0x8bdf('0x5')]||{};}module[_0x8bdf('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xfcfc=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0xfcfc,0x15b));var _0xcfcf=function(_0x4c11a3,_0x441c5d){_0x4c11a3=_0x4c11a3-0x0;var _0x5377ec=_0xfcfc[_0x4c11a3];return _0x5377ec;};'use strict';function FreshsalesAccount(_0x4b6b36){this['id']=_0x4b6b36['id']||0x0;this[_0xcfcf('0x0')]=_0x4b6b36[_0xcfcf('0x0')]||'';this[_0xcfcf('0x1')]=_0x4b6b36['username']||'';this[_0xcfcf('0x2')]=_0x4b6b36[_0xcfcf('0x3')]||'';this[_0xcfcf('0x4')]=_0x4b6b36[_0xcfcf('0x4')]||'';this[_0xcfcf('0x5')]=_0x4b6b36[_0xcfcf('0x5')]||'';this['Configurations']=_0x4b6b36[_0xcfcf('0x6')]||{};}module[_0xcfcf('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 518c69b..6797830 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 _0xd654=['accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinename'];(function(_0x388d76,_0x692c8a){var _0x4aacc5=function(_0x1ac84f){while(--_0x1ac84f){_0x388d76['push'](_0x388d76['shift']());}};_0x4aacc5(++_0x692c8a);}(_0xd654,0x15a));var _0x4d65=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xd654[_0x4565bf];return _0x5610ba;};'use strict';function QueueReport(){this[_0x4d65('0x0')]='inbound';this['uniqueid']='';this[_0x4d65('0x1')]='';this['calleridname']='';this[_0x4d65('0x2')]='';this[_0x4d65('0x3')]=null;this[_0x4d65('0x4')]=null;this[_0x4d65('0x5')]=0x1;this[_0x4d65('0x6')]=0x1;this[_0x4d65('0x7')]=![];this[_0x4d65('0x8')]=null;this[_0x4d65('0x9')]=![];this[_0x4d65('0xa')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x4d65('0xb')]=0x1;this[_0x4d65('0xc')]='';this['connectedlinenum']='';this[_0x4d65('0xd')]='';this[_0x4d65('0xe')]='';this[_0x4d65('0xf')]='';this[_0x4d65('0x10')]='';this[_0x4d65('0x11')]='';this[_0x4d65('0x12')]=0x0;this[_0x4d65('0x13')]=![];this[_0x4d65('0x14')]='';this[_0x4d65('0x15')]=0x0;this[_0x4d65('0x16')]={};}module[_0x4d65('0x17')]=QueueReport; \ No newline at end of file +var _0xcd32=['context','exten','priority','holdtime','lastAssignedTo','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename'];(function(_0x387f1e,_0x15e947){var _0x53f7a2=function(_0x5f0261){while(--_0x5f0261){_0x387f1e['push'](_0x387f1e['shift']());}};_0x53f7a2(++_0x15e947);}(_0xcd32,0x1d3));var _0x2cd3=function(_0x1d5880,_0x2c3c3a){_0x1d5880=_0x1d5880-0x0;var _0x3ec809=_0xcd32[_0x1d5880];return _0x3ec809;};'use strict';function QueueReport(){this[_0x2cd3('0x0')]=_0x2cd3('0x1');this['uniqueid']='';this[_0x2cd3('0x2')]='';this[_0x2cd3('0x3')]='';this[_0x2cd3('0x4')]='';this[_0x2cd3('0x5')]=null;this[_0x2cd3('0x6')]=null;this[_0x2cd3('0x7')]=0x1;this[_0x2cd3('0x8')]=0x1;this[_0x2cd3('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x2cd3('0xa')]=![];this[_0x2cd3('0xb')]=null;this[_0x2cd3('0xc')]=![];this[_0x2cd3('0xd')]=null;this[_0x2cd3('0xe')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x2cd3('0xf')]='';this['accountcode']='';this[_0x2cd3('0x10')]='';this[_0x2cd3('0x11')]='';this[_0x2cd3('0x12')]='';this[_0x2cd3('0x13')]=0x0;this['assigned']=![];this[_0x2cd3('0x14')]='';this['mohtime']=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 4b88859..8926ee2 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 _0x5ae9=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','username','remoteUri','password'];(function(_0x964709,_0x318d9a){var _0xfc2f1d=function(_0x51bbc3){while(--_0x51bbc3){_0x964709['push'](_0x964709['shift']());}};_0xfc2f1d(++_0x318d9a);}(_0x5ae9,0x19b));var _0x95ae=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x5ae9[_0x835cb7];return _0x3ef599;};'use strict';function SalesforceAccount(_0x579d85){this['id']=_0x579d85['id']||0x0;this['name']=_0x579d85['name']||'';this[_0x95ae('0x0')]=_0x579d85[_0x95ae('0x0')]||'';this['remoteUri']=_0x579d85[_0x95ae('0x1')]||'';this[_0x95ae('0x2')]=_0x579d85['password']||'';this[_0x95ae('0x3')]=_0x579d85['clientId']||'';this[_0x95ae('0x4')]=_0x579d85[_0x95ae('0x4')]||'';this[_0x95ae('0x5')]=_0x579d85[_0x95ae('0x5')]||'';this[_0x95ae('0x6')]=_0x579d85['type']||'integrationTab';this[_0x95ae('0x7')]=_0x579d85[_0x95ae('0x7')]||'';this[_0x95ae('0x8')]=_0x579d85[_0x95ae('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xb226=['securityToken','type','serverUrl','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x3718a1,_0x46e9f5){var _0x203fce=function(_0x5d8005){while(--_0x5d8005){_0x3718a1['push'](_0x3718a1['shift']());}};_0x203fce(++_0x46e9f5);}(_0xb226,0x18a));var _0x6b22=function(_0x394680,_0x4cd343){_0x394680=_0x394680-0x0;var _0x168f33=_0xb226[_0x394680];return _0x168f33;};'use strict';function SalesforceAccount(_0x2dc1a0){this['id']=_0x2dc1a0['id']||0x0;this[_0x6b22('0x0')]=_0x2dc1a0[_0x6b22('0x0')]||'';this[_0x6b22('0x1')]=_0x2dc1a0[_0x6b22('0x1')]||'';this['remoteUri']=_0x2dc1a0[_0x6b22('0x2')]||'';this[_0x6b22('0x3')]=_0x2dc1a0[_0x6b22('0x3')]||'';this[_0x6b22('0x4')]=_0x2dc1a0['clientId']||'';this['clientSecret']=_0x2dc1a0[_0x6b22('0x5')]||'';this['securityToken']=_0x2dc1a0[_0x6b22('0x6')]||'';this[_0x6b22('0x7')]=_0x2dc1a0[_0x6b22('0x7')]||'integrationTab';this[_0x6b22('0x8')]=_0x2dc1a0[_0x6b22('0x8')]||'';this['Configurations']=_0x2dc1a0['Configurations']||{};}module[_0x6b22('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7aee3e8..10acfd4 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 _0x2644=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2644,0x189));var _0x4264=function(_0x8267aa,_0x496ef0){_0x8267aa=_0x8267aa-0x0;var _0x2a437f=_0x2644[_0x8267aa];return _0x2a437f;};'use strict';function ServicenowAccount(_0x4c4df5){this['id']=_0x4c4df5['id']||0x0;this[_0x4264('0x0')]=_0x4c4df5[_0x4264('0x0')]||'';this[_0x4264('0x1')]=_0x4c4df5['username']||'';this[_0x4264('0x2')]=_0x4c4df5[_0x4264('0x2')]||'';this[_0x4264('0x3')]=_0x4c4df5[_0x4264('0x3')]||'';this[_0x4264('0x4')]=_0x4c4df5[_0x4264('0x4')]||'';this[_0x4264('0x5')]=_0x4c4df5['Configurations']||{};}module[_0x4264('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xbdb7=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbdb7,0x66));var _0x7bdb=function(_0x4cce81,_0x252735){_0x4cce81=_0x4cce81-0x0;var _0xad14bc=_0xbdb7[_0x4cce81];return _0xad14bc;};'use strict';function ServicenowAccount(_0x5a6915){this['id']=_0x5a6915['id']||0x0;this[_0x7bdb('0x0')]=_0x5a6915[_0x7bdb('0x0')]||'';this['username']=_0x5a6915[_0x7bdb('0x1')]||'';this[_0x7bdb('0x2')]=_0x5a6915[_0x7bdb('0x2')]||'';this['remoteUri']=_0x5a6915[_0x7bdb('0x3')]||'';this[_0x7bdb('0x4')]=_0x5a6915['serverUrl']||'';this[_0x7bdb('0x5')]=_0x5a6915['Configurations']||{};}module[_0x7bdb('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3d24fd8..59a6e78 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 _0x1271=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x488d97,_0x318f5d){var _0x5e180e=function(_0x35bdb1){while(--_0x35bdb1){_0x488d97['push'](_0x488d97['shift']());}};_0x5e180e(++_0x318f5d);}(_0x1271,0x12d));var _0x1127=function(_0x8240c4,_0x15f53b){_0x8240c4=_0x8240c4-0x0;var _0x3db05f=_0x1271[_0x8240c4];return _0x3db05f;};'use strict';function SugarcrmAccount(_0x45a9f0){this['id']=_0x45a9f0['id']||0x0;this[_0x1127('0x0')]=_0x45a9f0[_0x1127('0x0')]||'';this[_0x1127('0x1')]=_0x45a9f0[_0x1127('0x1')]||'';this[_0x1127('0x2')]=_0x45a9f0['password']||'';this[_0x1127('0x3')]=_0x45a9f0[_0x1127('0x3')]||'';this[_0x1127('0x4')]=_0x45a9f0[_0x1127('0x4')]||'';this[_0x1127('0x5')]=_0x45a9f0[_0x1127('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7812=['exports','name','username','password','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7812,0xa9));var _0x2781=function(_0x2a5353,_0x8afbe8){_0x2a5353=_0x2a5353-0x0;var _0x14eddc=_0x7812[_0x2a5353];return _0x14eddc;};'use strict';function SugarcrmAccount(_0x757741){this['id']=_0x757741['id']||0x0;this[_0x2781('0x0')]=_0x757741[_0x2781('0x0')]||'';this[_0x2781('0x1')]=_0x757741[_0x2781('0x1')]||'';this[_0x2781('0x2')]=_0x757741[_0x2781('0x2')]||'';this[_0x2781('0x3')]=_0x757741[_0x2781('0x3')]||'';this['serverUrl']=_0x757741[_0x2781('0x4')]||'';this['Configurations']=_0x757741['Configurations']||{};}module[_0x2781('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7893c58..3289051 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 _0x79a8=['exports','name','accountcode','unknown'];(function(_0x28b8b3,_0x5163fb){var _0x236f9d=function(_0xa5d7de){while(--_0xa5d7de){_0x28b8b3['push'](_0x28b8b3['shift']());}};_0x236f9d(++_0x5163fb);}(_0x79a8,0x65));var _0x879a=function(_0x56d9c0,_0x23cac4){_0x56d9c0=_0x56d9c0-0x0;var _0x183ba1=_0x79a8[_0x56d9c0];return _0x183ba1;};'use strict';function Telephone(_0x367356){this['id']=_0x367356['id']||0x0;this[_0x879a('0x0')]=_0x367356[_0x879a('0x0')]||'';this[_0x879a('0x1')]=_0x367356[_0x879a('0x1')]||'';this['state']=_0x879a('0x2');this['stateTime']=0x0;this['status']='unknown';this['address']='';}module[_0x879a('0x3')]=Telephone; \ No newline at end of file +var _0x007d=['name','accountcode','state','stateTime','status','address','exports'];(function(_0x4f7125,_0x4cb125){var _0x283845=function(_0x4f6c08){while(--_0x4f6c08){_0x4f7125['push'](_0x4f7125['shift']());}};_0x283845(++_0x4cb125);}(_0x007d,0x1ce));var _0xd007=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x007d[_0x122ef9];return _0x42fba0;};'use strict';function Telephone(_0x4a0aca){this['id']=_0x4a0aca['id']||0x0;this['name']=_0x4a0aca[_0xd007('0x0')]||'';this[_0xd007('0x1')]=_0x4a0aca['accountcode']||'';this[_0xd007('0x2')]='unknown';this[_0xd007('0x3')]=0x0;this[_0xd007('0x4')]='unknown';this[_0xd007('0x5')]='';}module[_0xd007('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 6912380..8681c77 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 _0x1e93=['exports','name','html'];(function(_0x210580,_0x1329d5){var _0x477835=function(_0x202c95){while(--_0x202c95){_0x210580['push'](_0x210580['shift']());}};_0x477835(++_0x1329d5);}(_0x1e93,0x14b));var _0x31e9=function(_0x568a72,_0x220535){_0x568a72=_0x568a72-0x0;var _0x614164=_0x1e93[_0x568a72];return _0x614164;};'use strict';function template(_0x3cad79){this['id']=_0x3cad79['id']||0x0;this[_0x31e9('0x0')]=_0x3cad79[_0x31e9('0x0')]||'';this[_0x31e9('0x1')]=_0x3cad79['html']||'';}module[_0x31e9('0x2')]=template; \ No newline at end of file +var _0x31b9=['exports','name','html'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x31b9,0x151));var _0x931b=function(_0x14566a,_0x50e276){_0x14566a=_0x14566a-0x0;var _0x556a06=_0x31b9[_0x14566a];return _0x556a06;};'use strict';function template(_0x358ab6){this['id']=_0x358ab6['id']||0x0;this[_0x931b('0x0')]=_0x358ab6[_0x931b('0x0')]||'';this[_0x931b('0x1')]=_0x358ab6[_0x931b('0x1')]||'';}module[_0x931b('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index fe834ea..88f4896 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(_0x5e4d16,_0x6dc4bb){var _0x29842d=function(_0x180e47){while(--_0x180e47){_0x5e4d16['push'](_0x5e4d16['shift']());}};_0x29842d(++_0x6dc4bb);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x4b84[_0x4347ec];return _0x4c8314;};'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(_0x38d9ae,_0x480705){var _0x1d9f15=function(_0x2819c0){while(--_0x2819c0){_0x38d9ae['push'](_0x38d9ae['shift']());}};_0x1d9f15(++_0x480705);}(_0x8ef6,0xf2));var _0x68ef=function(_0x576c32,_0x350a81){_0x576c32=_0x576c32-0x0;var _0x1dccfa=_0x8ef6[_0x576c32];return _0x1dccfa;};'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 5374ac7..a76f122 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 _0x4e16=['name','unknown','stateTime','status','registry','indexOf','split','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active'];(function(_0x59e86b,_0x245ea1){var _0x4d8900=function(_0x163d95){while(--_0x163d95){_0x59e86b['push'](_0x59e86b['shift']());}};_0x4d8900(++_0x245ea1);}(_0x4e16,0x1ee));var _0x64e1=function(_0x562219,_0x538e13){_0x562219=_0x562219-0x0;var _0x208fa5=_0x4e16[_0x562219];return _0x208fa5;};'use strict';function Trunk(_0x427db4){this['id']=_0x427db4['id']||0x0;this[_0x64e1('0x0')]=_0x427db4[_0x64e1('0x0')]||![];this[_0x64e1('0x1')]=_0x427db4[_0x64e1('0x1')]||'';this['state']=_0x64e1('0x2');this[_0x64e1('0x3')]=0x0;this[_0x64e1('0x4')]='unknown';this['registry']=_0x427db4[_0x64e1('0x5')]&&_0x427db4[_0x64e1('0x5')][_0x64e1('0x6')](':')?_0x427db4[_0x64e1('0x5')][_0x64e1('0x7')](':')[0x0]:'';this['host']='';this[_0x64e1('0x8')]='';this['domain']='';this[_0x64e1('0x9')]='';this[_0x64e1('0xa')]='';this[_0x64e1('0xb')]=_0x64e1('0x2');this[_0x64e1('0xc')]='';this[_0x64e1('0xd')]='';}module[_0x64e1('0xe')]=Trunk; \ No newline at end of file +var _0xbb46=['unknown','stateTime','status','registry','indexOf','split','host','domainport','refresh','stateRegistry','registrationtime','exports','active','name'];(function(_0x3d664b,_0x2bb943){var _0x3d344b=function(_0x4823a1){while(--_0x4823a1){_0x3d664b['push'](_0x3d664b['shift']());}};_0x3d344b(++_0x2bb943);}(_0xbb46,0x1be));var _0x6bb4=function(_0x340f98,_0x4c3814){_0x340f98=_0x340f98-0x0;var _0x578a8a=_0xbb46[_0x340f98];return _0x578a8a;};'use strict';function Trunk(_0x5407b3){this['id']=_0x5407b3['id']||0x0;this[_0x6bb4('0x0')]=_0x5407b3['active']||![];this[_0x6bb4('0x1')]=_0x5407b3[_0x6bb4('0x1')]||'';this['state']=_0x6bb4('0x2');this[_0x6bb4('0x3')]=0x0;this[_0x6bb4('0x4')]='unknown';this[_0x6bb4('0x5')]=_0x5407b3[_0x6bb4('0x5')]&&_0x5407b3[_0x6bb4('0x5')][_0x6bb4('0x6')](':')?_0x5407b3[_0x6bb4('0x5')][_0x6bb4('0x7')](':')[0x0]:'';this[_0x6bb4('0x8')]='';this['port']='';this['domain']='';this[_0x6bb4('0x9')]='';this[_0x6bb4('0xa')]='';this[_0x6bb4('0xb')]='unknown';this[_0x6bb4('0xc')]='';this['address']='';}module[_0x6bb4('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 261584e..db8c762 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 _0x2af2=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3401ce,_0x5d1579){var _0x1bb79d=function(_0x46985e){while(--_0x46985e){_0x3401ce['push'](_0x3401ce['shift']());}};_0x1bb79d(++_0x5d1579);}(_0x2af2,0x13d));var _0x22af=function(_0x5aea7e,_0x234e5a){_0x5aea7e=_0x5aea7e-0x0;var _0x3ab7f7=_0x2af2[_0x5aea7e];return _0x3ab7f7;};'use strict';function voiceExtension(_0x44b4a4){this['id']=_0x44b4a4['id']||0x0;this[_0x22af('0x0')]=_0x44b4a4[_0x22af('0x0')]||'';this['recordingFormat']=_0x44b4a4[_0x22af('0x1')]||_0x22af('0x2');this['mandatoryDisposition']=_0x44b4a4[_0x22af('0x3')]||![];}module[_0x22af('0x4')]=voiceExtension; \ No newline at end of file +var _0xe826=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5dbbab,_0x27f8db){var _0x5a4d02=function(_0x3142dd){while(--_0x3142dd){_0x5dbbab['push'](_0x5dbbab['shift']());}};_0x5a4d02(++_0x27f8db);}(_0xe826,0x19d));var _0x6e82=function(_0x72527e,_0x313f59){_0x72527e=_0x72527e-0x0;var _0x345f19=_0xe826[_0x72527e];return _0x345f19;};'use strict';function voiceExtension(_0x15b3b0){this['id']=_0x15b3b0['id']||0x0;this[_0x6e82('0x0')]=_0x15b3b0[_0x6e82('0x0')]||'';this[_0x6e82('0x1')]=_0x15b3b0['recordingFormat']||_0x6e82('0x2');this[_0x6e82('0x3')]=_0x15b3b0['mandatoryDisposition']||![];}module[_0x6e82('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 4fca572..1a1ec9d 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 _0xb1b7=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xb1b7,0xce));var _0x7b1b=function(_0x23a57c,_0x50f90a){_0x23a57c=_0x23a57c-0x0;var _0x241de6=_0xb1b7[_0x23a57c];return _0x241de6;};'use strict';var statusDesc=[_0x7b1b('0x0'),_0x7b1b('0x1'),_0x7b1b('0x2'),_0x7b1b('0x3'),_0x7b1b('0x4'),_0x7b1b('0x5'),_0x7b1b('0x6'),_0x7b1b('0x7'),'onhold'];var monitorFormat={'wav':_0x7b1b('0x8'),'wav49':_0x7b1b('0x9'),'gsm':'gsm'};var strategy={'rrmemory':_0x7b1b('0xa'),'roundrobin':'roundrobin'};function VoiceQueue(_0x54e0f0){this['id']=_0x54e0f0['id']||0x0;this['name']=_0x54e0f0[_0x7b1b('0xb')]||'';this[_0x7b1b('0xc')]=_0x54e0f0['monitor_format']||'';this['type']=_0x54e0f0[_0x7b1b('0xd')]||_0x7b1b('0xe');this[_0x7b1b('0xf')]=0x0;this[_0x7b1b('0x10')]=0x0;this[_0x7b1b('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x7b1b('0x12')]=0x0;this[_0x7b1b('0x13')]=0x0;this[_0x7b1b('0x14')]=0x0;this[_0x7b1b('0x15')]=0x0;this[_0x7b1b('0x16')]=0x0;this[_0x7b1b('0x17')]=0x0;this[_0x7b1b('0x18')]=_0x54e0f0['acw']||![];this[_0x7b1b('0x19')]=_0x54e0f0['acwTimeout']||0xa;this[_0x7b1b('0x1a')]=_0x54e0f0['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x7b1b('0x1b')]='';this[_0x7b1b('0x1c')]=0x0;this[_0x7b1b('0x1d')]=0x0;this[_0x7b1b('0x1e')]=_0x54e0f0['dialTimezone']||null;this[_0x7b1b('0x1f')]=_0x54e0f0[_0x7b1b('0x1f')]?_0x54e0f0['dialGlobalInterval']:null;this[_0x7b1b('0x20')]=_0x54e0f0[_0x7b1b('0x20')];this['dialMethod']=_0x54e0f0[_0x7b1b('0x21')]||_0x7b1b('0x22');this[_0x7b1b('0x23')]=_0x54e0f0[_0x7b1b('0x23')]||0x0;this[_0x7b1b('0x24')]=_0x54e0f0[_0x7b1b('0x24')]||0x0;this[_0x7b1b('0x25')]=_0x54e0f0[_0x7b1b('0x25')]||0x1;this[_0x7b1b('0x26')]=_0x54e0f0['dialPredictiveOptimization']||_0x7b1b('0x27');this[_0x7b1b('0x28')]=_0x54e0f0[_0x7b1b('0x28')]||0.03;this[_0x7b1b('0x29')]=_0x54e0f0[_0x7b1b('0x29')]||0x258;this[_0x7b1b('0x2a')]=_0x54e0f0[_0x7b1b('0x2a')]||_0x7b1b('0x2b');this[_0x7b1b('0x2c')]=_0x54e0f0[_0x7b1b('0x2c')]||'anonymous';this[_0x7b1b('0x2d')]=_0x54e0f0[_0x7b1b('0x2d')]||0x1e;this[_0x7b1b('0x2e')]=_0x54e0f0['dialQueueOptions']||_0x7b1b('0x2f');this['dialQueueTimeout']=_0x54e0f0[_0x7b1b('0x30')]||0x3;this['dialQueueProject']=_0x54e0f0[_0x7b1b('0x31')]||undefined;this[_0x7b1b('0x32')]=_0x54e0f0['dialCongestionMaxRetry']||0x3;this[_0x7b1b('0x33')]=_0x54e0f0[_0x7b1b('0x33')]||0x96;this['dialBusyMaxRetry']=_0x54e0f0[_0x7b1b('0x34')]||0x3;this[_0x7b1b('0x35')]=_0x54e0f0[_0x7b1b('0x35')]||0x96;this[_0x7b1b('0x36')]=_0x54e0f0['dialNoAnswerMaxRetry']||0x3;this[_0x7b1b('0x37')]=_0x54e0f0[_0x7b1b('0x37')]||0x96;this[_0x7b1b('0x38')]=_0x54e0f0[_0x7b1b('0x38')]||0x3;this[_0x7b1b('0x39')]=_0x54e0f0[_0x7b1b('0x39')]||0x96;this[_0x7b1b('0x3a')]=_0x54e0f0[_0x7b1b('0x3a')]||0x3;this[_0x7b1b('0x3b')]=_0x54e0f0[_0x7b1b('0x3b')]||0x96;this[_0x7b1b('0x3c')]=_0x54e0f0['dialAbandonedMaxRetry']||0x3;this[_0x7b1b('0x3d')]=_0x54e0f0[_0x7b1b('0x3d')]||0x96;this[_0x7b1b('0x3e')]=_0x54e0f0['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x54e0f0[_0x7b1b('0x3f')]||0x96;this[_0x7b1b('0x40')]=_0x54e0f0[_0x7b1b('0x40')]||0x3;this[_0x7b1b('0x41')]=_0x54e0f0['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x54e0f0[_0x7b1b('0x42')]||0x4;this[_0x7b1b('0x43')]=_0x54e0f0[_0x7b1b('0x43')]?_0x54e0f0[_0x7b1b('0x43')]:undefined;this[_0x7b1b('0x44')]=_0x54e0f0[_0x7b1b('0x44')]?_0x54e0f0['TrunkBackup']:undefined;this[_0x7b1b('0x45')]=_0x54e0f0[_0x7b1b('0x45')]||undefined;this['Interval']=_0x54e0f0[_0x7b1b('0x46')]?_0x54e0f0[_0x7b1b('0x46')]:undefined;this[_0x7b1b('0x47')]=_0x54e0f0[_0x7b1b('0x47')]||'DESC';this[_0x7b1b('0x48')]=_0x54e0f0[_0x7b1b('0x48')]||undefined;this[_0x7b1b('0x49')]=_0x54e0f0['dialCutDigit']||undefined;this[_0x7b1b('0x4a')]=strategy[_0x54e0f0[_0x7b1b('0x4a')]]||'rrmemory';this[_0x7b1b('0x4b')]=!![];this['dialAMDActive']=_0x54e0f0[_0x7b1b('0x4c')]||![];this['dialAMDInitialSilence']=_0x54e0f0[_0x7b1b('0x4d')];this[_0x7b1b('0x4e')]=_0x54e0f0['dialAMDGreeting'];this[_0x7b1b('0x4f')]=_0x54e0f0[_0x7b1b('0x4f')];this[_0x7b1b('0x50')]=_0x54e0f0['dialAMDTotalAnalysisTime'];this[_0x7b1b('0x51')]=_0x54e0f0[_0x7b1b('0x51')];this[_0x7b1b('0x52')]=_0x54e0f0['dialAMDBetweenWordsSilence'];this[_0x7b1b('0x53')]=_0x54e0f0[_0x7b1b('0x53')];this[_0x7b1b('0x54')]=_0x54e0f0[_0x7b1b('0x54')];this['dialAMDMaximumWordLength']=_0x54e0f0[_0x7b1b('0x55')];this[_0x7b1b('0x56')]=0x0;this[_0x7b1b('0x57')]=0x0;this['timeout']=_0x54e0f0[_0x7b1b('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x7b1b('0x59')]=0x0;this[_0x7b1b('0x5a')]=0x0;this[_0x7b1b('0x5b')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x7b1b('0x5c')]=0x0;this[_0x7b1b('0x5d')]=0x0;this[_0x7b1b('0x5e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x7b1b('0x5f')]=0x0;this[_0x7b1b('0x60')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x7b1b('0x61')]=undefined;this[_0x7b1b('0x62')]=undefined;this[_0x7b1b('0x63')]=undefined;this[_0x7b1b('0x64')]=1.05;this[_0x7b1b('0x65')]=0x0;this[_0x7b1b('0x66')]=0x0;this[_0x7b1b('0x67')]=0x0;this[_0x7b1b('0x68')]=0x0;this[_0x7b1b('0x69')]=0x0;this[_0x7b1b('0x6a')]=0x0;this[_0x7b1b('0x6b')]=0x0;this[_0x7b1b('0x6c')]=0x0;this[_0x7b1b('0x6d')]=_0x54e0f0[_0x7b1b('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x54e0f0['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x7b1b('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x7b1b('0x70')]=0x0;this['erlangCallToSecond']=0x0;this[_0x7b1b('0x71')]=0x0;this[_0x7b1b('0x72')]=0x0;this[_0x7b1b('0x73')]=_0x54e0f0[_0x7b1b('0x73')]||0x1e;this[_0x7b1b('0x74')]=_0x54e0f0[_0x7b1b('0x74')]||![];this[_0x7b1b('0x75')]=_0x54e0f0[_0x7b1b('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x54e0f0[_0x7b1b('0x76')]||![];this[_0x7b1b('0x77')]=_0x54e0f0[_0x7b1b('0x77')]||![];this['monitor_format']=monitorFormat[_0x54e0f0['monitor_format']]?monitorFormat[_0x54e0f0[_0x7b1b('0xc')]]:undefined;this[_0x7b1b('0x78')]=_0x54e0f0[_0x7b1b('0x78')]||![];this['mandatoryDispositionPause']=_0x54e0f0['mandatoryDispositionPause']?_0x54e0f0[_0x7b1b('0x79')]:undefined;}module[_0x7b1b('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x39f8=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','waiting','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold'];(function(_0xee9086,_0x3daacd){var _0xebe681=function(_0x56b142){while(--_0x56b142){_0xee9086['push'](_0xee9086['shift']());}};_0xebe681(++_0x3daacd);}(_0x39f8,0x15d));var _0x839f=function(_0x42193d,_0x59e220){_0x42193d=_0x42193d-0x0;var _0x2915a2=_0x39f8[_0x42193d];return _0x2915a2;};'use strict';var statusDesc=['unknown',_0x839f('0x0'),_0x839f('0x1'),'busy',_0x839f('0x2'),_0x839f('0x3'),'ringing',_0x839f('0x4'),_0x839f('0x5')];var monitorFormat={'wav':'wav','wav49':_0x839f('0x6'),'gsm':_0x839f('0x7')};var strategy={'rrmemory':_0x839f('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0xdadf3a){this['id']=_0xdadf3a['id']||0x0;this[_0x839f('0x9')]=_0xdadf3a[_0x839f('0x9')]||'';this[_0x839f('0xa')]=_0xdadf3a[_0x839f('0xa')]||'';this['type']=_0xdadf3a['type']||'inbound';this[_0x839f('0xb')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0x839f('0xc')]=0x0;this[_0x839f('0xd')]=0x0;this['sumBillable']=0x0;this[_0x839f('0xe')]=0x0;this[_0x839f('0xf')]=0x0;this[_0x839f('0x10')]=0x0;this[_0x839f('0x11')]=0x0;this[_0x839f('0x12')]=_0xdadf3a['acw']||![];this['acwTimeout']=_0xdadf3a[_0x839f('0x13')]||0xa;this[_0x839f('0x14')]=_0xdadf3a[_0x839f('0x14')]||'no';this['sendMessageOneNotActive']=!![];this[_0x839f('0x15')]='';this[_0x839f('0x16')]=0x0;this[_0x839f('0x17')]=0x0;this[_0x839f('0x18')]=_0xdadf3a['dialTimezone']||null;this['dialGlobalInterval']=_0xdadf3a[_0x839f('0x19')]?_0xdadf3a[_0x839f('0x19')]:null;this[_0x839f('0x1a')]=_0xdadf3a[_0x839f('0x1a')];this[_0x839f('0x1b')]=_0xdadf3a[_0x839f('0x1b')]||_0x839f('0x1c');this[_0x839f('0x1d')]=_0xdadf3a[_0x839f('0x1d')]||0x0;this[_0x839f('0x1e')]=_0xdadf3a[_0x839f('0x1e')]||0x0;this[_0x839f('0x1f')]=_0xdadf3a[_0x839f('0x1f')]||0x1;this[_0x839f('0x20')]=_0xdadf3a['dialPredictiveOptimization']||'dropRate';this[_0x839f('0x21')]=_0xdadf3a[_0x839f('0x21')]||0.03;this[_0x839f('0x22')]=_0xdadf3a['dialPredictiveInterval']||0x258;this[_0x839f('0x23')]=_0xdadf3a[_0x839f('0x23')]||_0x839f('0x24');this[_0x839f('0x25')]=_0xdadf3a[_0x839f('0x25')]||'anonymous';this['dialOriginateTimeout']=_0xdadf3a['dialOriginateTimeout']||0x1e;this[_0x839f('0x26')]=_0xdadf3a[_0x839f('0x26')]||_0x839f('0x27');this[_0x839f('0x28')]=_0xdadf3a[_0x839f('0x28')]||0x3;this['dialQueueProject']=_0xdadf3a[_0x839f('0x29')]||undefined;this[_0x839f('0x2a')]=_0xdadf3a['dialCongestionMaxRetry']||0x3;this[_0x839f('0x2b')]=_0xdadf3a[_0x839f('0x2b')]||0x96;this['dialBusyMaxRetry']=_0xdadf3a['dialBusyMaxRetry']||0x3;this[_0x839f('0x2c')]=_0xdadf3a[_0x839f('0x2c')]||0x96;this[_0x839f('0x2d')]=_0xdadf3a[_0x839f('0x2d')]||0x3;this[_0x839f('0x2e')]=_0xdadf3a[_0x839f('0x2e')]||0x96;this[_0x839f('0x2f')]=_0xdadf3a[_0x839f('0x2f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xdadf3a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x839f('0x30')]=_0xdadf3a[_0x839f('0x30')]||0x3;this[_0x839f('0x31')]=_0xdadf3a[_0x839f('0x31')]||0x96;this[_0x839f('0x32')]=_0xdadf3a[_0x839f('0x32')]||0x3;this[_0x839f('0x33')]=_0xdadf3a[_0x839f('0x33')]||0x96;this[_0x839f('0x34')]=_0xdadf3a[_0x839f('0x34')]||0x3;this[_0x839f('0x35')]=_0xdadf3a[_0x839f('0x35')]||0x96;this[_0x839f('0x36')]=_0xdadf3a[_0x839f('0x36')]||0x3;this['dialAgentRejectRetryFrequency']=_0xdadf3a[_0x839f('0x37')]||0x96;this['dialGlobalMaxRetry']=_0xdadf3a['dialGlobalMaxRetry']||0x4;this[_0x839f('0x38')]=_0xdadf3a[_0x839f('0x38')]?_0xdadf3a[_0x839f('0x38')]:undefined;this['TrunkBackup']=_0xdadf3a[_0x839f('0x39')]?_0xdadf3a[_0x839f('0x39')]:undefined;this[_0x839f('0x3a')]=_0xdadf3a[_0x839f('0x3a')]||undefined;this[_0x839f('0x3b')]=_0xdadf3a['Interval']?_0xdadf3a[_0x839f('0x3b')]:undefined;this[_0x839f('0x3c')]=_0xdadf3a[_0x839f('0x3c')]||_0x839f('0x3d');this[_0x839f('0x3e')]=_0xdadf3a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x839f('0x3f')]=_0xdadf3a[_0x839f('0x3f')]||undefined;this[_0x839f('0x40')]=strategy[_0xdadf3a['strategy']]||_0x839f('0x8');this['queueStatusComplete']=!![];this['dialAMDActive']=_0xdadf3a[_0x839f('0x41')]||![];this['dialAMDInitialSilence']=_0xdadf3a[_0x839f('0x42')];this[_0x839f('0x43')]=_0xdadf3a[_0x839f('0x43')];this[_0x839f('0x44')]=_0xdadf3a[_0x839f('0x44')];this[_0x839f('0x45')]=_0xdadf3a[_0x839f('0x45')];this['dialAMDMinWordLength']=_0xdadf3a[_0x839f('0x46')];this[_0x839f('0x47')]=_0xdadf3a[_0x839f('0x47')];this[_0x839f('0x48')]=_0xdadf3a[_0x839f('0x48')];this[_0x839f('0x49')]=_0xdadf3a[_0x839f('0x49')];this['dialAMDMaximumWordLength']=_0xdadf3a['dialAMDMaximumWordLength'];this[_0x839f('0x4a')]=0x0;this[_0x839f('0x4b')]=0x0;this[_0x839f('0x4c')]=_0xdadf3a['timeout'];this[_0x839f('0x4d')]=0x0;this[_0x839f('0x4e')]=0x0;this[_0x839f('0x4f')]=0x0;this[_0x839f('0x50')]=0x0;this[_0x839f('0x51')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x839f('0x52')]=0x0;this[_0x839f('0x53')]=0x0;this[_0x839f('0x54')]=0x0;this[_0x839f('0x55')]=0x0;this[_0x839f('0x56')]=0x0;this[_0x839f('0x57')]=0x0;this[_0x839f('0x58')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x839f('0x59')]=undefined;this[_0x839f('0x5a')]=1.05;this[_0x839f('0x5b')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x839f('0x5c')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x839f('0x5d')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x839f('0x5e')]=0x0;this[_0x839f('0x5f')]=0x0;this[_0x839f('0x60')]=_0xdadf3a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x839f('0x61')]=_0xdadf3a[_0x839f('0x62')]||0xa;this[_0x839f('0x63')]=0x0;this[_0x839f('0x64')]=0x0;this[_0x839f('0x65')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0x839f('0x66')]=0x0;this[_0x839f('0x67')]=0x0;this[_0x839f('0x68')]=_0xdadf3a[_0x839f('0x68')]||0x1e;this['dialRecallInQueue']=_0xdadf3a[_0x839f('0x69')]||![];this[_0x839f('0x6a')]=_0xdadf3a[_0x839f('0x6a')]||undefined;this[_0x839f('0x6b')]=_0xdadf3a[_0x839f('0x6b')]||![];this['dialAgiAfterHangupAgent']=_0xdadf3a[_0x839f('0x6c')]||![];this[_0x839f('0xa')]=monitorFormat[_0xdadf3a['monitor_format']]?monitorFormat[_0xdadf3a[_0x839f('0xa')]]:undefined;this[_0x839f('0x6d')]=_0xdadf3a[_0x839f('0x6d')]||![];this[_0x839f('0x6e')]=_0xdadf3a['mandatoryDispositionPause']?_0xdadf3a['mandatoryDispositionPause']:undefined;}module[_0x839f('0x6f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 898fe0c..de01850 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 _0x98ff=['name','username','accessKey','remoteUri','Configurations','exports'];(function(_0x438b3e,_0x128f17){var _0x1d010e=function(_0x3458d9){while(--_0x3458d9){_0x438b3e['push'](_0x438b3e['shift']());}};_0x1d010e(++_0x128f17);}(_0x98ff,0xba));var _0xf98f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x98ff[_0x5783f4];return _0x28e380;};'use strict';function VtigerAccount(_0x544e39){this['id']=_0x544e39['id']||0x0;this[_0xf98f('0x0')]=_0x544e39[_0xf98f('0x0')]||'';this[_0xf98f('0x1')]=_0x544e39[_0xf98f('0x1')]||'';this[_0xf98f('0x2')]=_0x544e39['accessKey']||'';this['remoteUri']=_0x544e39[_0xf98f('0x3')]||'';this['serverUrl']=_0x544e39['serverUrl']||'';this['Configurations']=_0x544e39[_0xf98f('0x4')]||{};}module[_0xf98f('0x5')]=VtigerAccount; \ No newline at end of file +var _0x84cf=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x42e25a,_0x51d76b){var _0x579626=function(_0x416a55){while(--_0x416a55){_0x42e25a['push'](_0x42e25a['shift']());}};_0x579626(++_0x51d76b);}(_0x84cf,0x176));var _0xf84c=function(_0x5e28a1,_0x306092){_0x5e28a1=_0x5e28a1-0x0;var _0x37d2a7=_0x84cf[_0x5e28a1];return _0x37d2a7;};'use strict';function VtigerAccount(_0x1ffb8b){this['id']=_0x1ffb8b['id']||0x0;this['name']=_0x1ffb8b[_0xf84c('0x0')]||'';this[_0xf84c('0x1')]=_0x1ffb8b[_0xf84c('0x1')]||'';this[_0xf84c('0x2')]=_0x1ffb8b[_0xf84c('0x2')]||'';this[_0xf84c('0x3')]=_0x1ffb8b[_0xf84c('0x3')]||'';this[_0xf84c('0x4')]=_0x1ffb8b['serverUrl']||'';this[_0xf84c('0x5')]=_0x1ffb8b[_0xf84c('0x5')]||{};}module[_0xf84c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8fbcc2c..4a470b3 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 _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x453299,_0x31452f){var _0x25bd07=function(_0xe1eb87){while(--_0xe1eb87){_0x453299['push'](_0x453299['shift']());}};_0x25bd07(++_0x31452f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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 +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x7a54,0x106));var _0x47a5=function(_0x4257ad,_0x4b7fca){_0x4257ad=_0x4257ad-0x0;var _0x258b55=_0x7a54[_0x4257ad];return _0x258b55;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4649afb..071134e 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 _0xeef7=['description','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x493a96,_0x55d69c){var _0x565afd=function(_0xe8873e){while(--_0xe8873e){_0x493a96['push'](_0x493a96['shift']());}};_0x565afd(++_0x55d69c);}(_0xeef7,0x7d));var _0x7eef=function(_0x3f5d16,_0x231c07){_0x3f5d16=_0x3f5d16-0x0;var _0x3e5df4=_0xeef7[_0x3f5d16];return _0x3e5df4;};'use strict';function ZohoAccount(_0x321fa5){this['id']=_0x321fa5['id']||0x0;this[_0x7eef('0x0')]=_0x321fa5['name']||'';this[_0x7eef('0x1')]=_0x321fa5[_0x7eef('0x1')]||'';this['host']=_0x321fa5['host']||'';this['zone']=_0x321fa5[_0x7eef('0x2')]||'';this[_0x7eef('0x3')]=_0x321fa5[_0x7eef('0x3')]||'';this['clientSecret']=_0x321fa5['clientSecret']||'';this['serverUrl']=_0x321fa5[_0x7eef('0x4')]||'';this[_0x7eef('0x5')]=_0x321fa5[_0x7eef('0x5')]||'';this['refreshToken']=_0x321fa5[_0x7eef('0x6')]||'';this[_0x7eef('0x7')]=_0x321fa5[_0x7eef('0x7')]||{};}module[_0x7eef('0x8')]=ZohoAccount; \ No newline at end of file +var _0xa887=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x14c195,_0x59d195){var _0x17a689=function(_0x2d83ad){while(--_0x2d83ad){_0x14c195['push'](_0x14c195['shift']());}};_0x17a689(++_0x59d195);}(_0xa887,0x89));var _0x7a88=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa887[_0x138f59];return _0x3d114d;};'use strict';function ZohoAccount(_0x566c53){this['id']=_0x566c53['id']||0x0;this['name']=_0x566c53[_0x7a88('0x0')]||'';this[_0x7a88('0x1')]=_0x566c53['description']||'';this[_0x7a88('0x2')]=_0x566c53[_0x7a88('0x2')]||'';this[_0x7a88('0x3')]=_0x566c53[_0x7a88('0x3')]||'';this[_0x7a88('0x4')]=_0x566c53[_0x7a88('0x4')]||'';this[_0x7a88('0x5')]=_0x566c53[_0x7a88('0x5')]||'';this[_0x7a88('0x6')]=_0x566c53['serverUrl']||'';this[_0x7a88('0x7')]=_0x566c53[_0x7a88('0x7')]||'';this['refreshToken']=_0x566c53[_0x7a88('0x8')]||'';this['Configurations']=_0x566c53[_0x7a88('0x9')]||{};}module[_0x7a88('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index a5d856d..5691346 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 _0x519e=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','isNil','uniqueid','idContact','queue','type','campaigntype','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x519e,0x86));var _0xe519=function(_0x136ce4,_0xe377f2){_0x136ce4=_0x136ce4-0x0;var _0x229da1=_0x519e[_0x136ce4];return _0x229da1;};'use strict';var util=require(_0xe519('0x0'));var _=require(_0xe519('0x1'));var moment=require(_0xe519('0x2'));function checkNameSurname(_0x89ec0b,_0x4038a8,_0x17b437){var _0x20668e='';if(!_['isNil'](_0x4038a8)&&_0xe519('0x3')===typeof _0x4038a8){_0x20668e+=_0x4038a8;}if(!_[_0xe519('0x4')](_0x17b437)&&_0xe519('0x3')===typeof _0x17b437){_0x20668e+='\x20'+_0x17b437;}if(_0x20668e!==''){return _0x20668e;}return _0x89ec0b;}function Action(_0x170876,_0x2b317a,_0x3d51e6,_0x2a7327,_0xef346b){this[_0xe519('0x5')]=_0x3d51e6||undefined;this[_0xe519('0x6')]=_0x170876['id'];this[_0xe519('0x7')]=_0x2b317a['name'];this[_0xe519('0x8')]=_0x2b317a[_0xe519('0x8')];this[_0xe519('0x9')]=_0xe519('0x7');this['dialAnswer']=![];this[_0xe519('0xa')]=_[_0xe519('0x4')](_0x170876['Agent'])?undefined:_0x170876[_0xe519('0xb')][_0xe519('0xc')];this[_0xe519('0xd')]=this[_0xe519('0xa')]?util[_0xe519('0xe')](_0xe519('0xf'),this['membername']):_0x2a7327||undefined;this[_0xe519('0x10')]=checkNameSurname(_0x170876[_0xe519('0x11')][_0xe519('0x12')],_0x170876[_0xe519('0x11')][_0xe519('0x13')],_0x170876['Contact'][_0xe519('0x14')]);this[_0xe519('0x15')]=_0x170876['active']||![];this['calleridnum']=_0x170876[_0xe519('0x11')]['phone'];this[_0xe519('0x16')]=_0x170876['scheduledat'];this[_0xe519('0x17')]=_0x170876[_0xe519('0x17')]||0x0;this[_0xe519('0x18')]=_0x170876['countcongestionretry']||0x0;this['countnoanswerretry']=_0x170876[_0xe519('0x19')]||0x0;this['countglobal']=(_0x170876[_0xe519('0x17')]||0x0)+(_0x170876[_0xe519('0x18')]||0x0)+(_0x170876[_0xe519('0x19')]||0x0)+(_0x170876['countnosuchnumberretry']||0x0)+(_0x170876[_0xe519('0x1a')]||0x0)+(_0x170876['countabandonedretry']||0x0)+(_0x170876['countmachineretry']||0x0)+(_0x170876[_0xe519('0x1b')]||0x0);this[_0xe519('0x1c')]=_0x170876[_0xe519('0x1c')]||0x0;this[_0xe519('0x1a')]=_0x170876['countdropretry']||0x0;this[_0xe519('0x1d')]=_0x170876[_0xe519('0x1d')]||0x0;this[_0xe519('0x1e')]=_0x170876[_0xe519('0x1e')]||0x0;this[_0xe519('0x1b')]=_0x170876[_0xe519('0x1b')]||0x0;this[_0xe519('0x1f')]=_0x170876[_0xe519('0x1f')];this['callbackuniqueid']=_0x170876['callbackuniqueid'];this[_0xe519('0x20')]=_0x170876[_0xe519('0x20')];this[_0xe519('0x21')]=_0x170876[_0xe519('0x21')];this[_0xe519('0x22')]=_0x170876[_0xe519('0x22')];this[_0xe519('0x23')]=_0x170876[_0xe519('0x23')];this[_0xe519('0x24')]=_[_0xe519('0x4')](_0x170876[_0xe519('0xb')])?_0x170876[_0xe519('0x24')]:_0x170876['Agent']['id'];this[_0xe519('0x25')]=_0x170876[_0xe519('0x25')];this[_0xe519('0x26')]='';this['originatecalleridname']='';}Action[_0xe519('0x27')][_0xe519('0x28')]=function(){return util[_0xe519('0xe')](_0xe519('0x29'),this['calleridname'],this[_0xe519('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x61e4=['string','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','firstName','Contact','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','callback','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil'];(function(_0x42d8fc,_0x30288c){var _0x987d2e=function(_0x57d7db){while(--_0x57d7db){_0x42d8fc['push'](_0x42d8fc['shift']());}};_0x987d2e(++_0x30288c);}(_0x61e4,0x9c));var _0x461e=function(_0x14ead9,_0x410058){_0x14ead9=_0x14ead9-0x0;var _0x17bfe6=_0x61e4[_0x14ead9];return _0x17bfe6;};'use strict';var util=require(_0x461e('0x0'));var _=require(_0x461e('0x1'));var moment=require(_0x461e('0x2'));function checkNameSurname(_0x4db63a,_0x35cfec,_0x2f9966){var _0x5c23a0='';if(!_[_0x461e('0x3')](_0x35cfec)&&_0x461e('0x4')===typeof _0x35cfec){_0x5c23a0+=_0x35cfec;}if(!_[_0x461e('0x3')](_0x2f9966)&&_0x461e('0x4')===typeof _0x2f9966){_0x5c23a0+='\x20'+_0x2f9966;}if(_0x5c23a0!==''){return _0x5c23a0;}return _0x4db63a;}function Action(_0x294bad,_0x2880e6,_0x41e9f0,_0x1bb427,_0x289c0c){this['uniqueid']=_0x41e9f0||undefined;this['idContact']=_0x294bad['id'];this[_0x461e('0x5')]=_0x2880e6[_0x461e('0x6')];this[_0x461e('0x7')]=_0x2880e6[_0x461e('0x7')];this[_0x461e('0x8')]=_0x461e('0x5');this[_0x461e('0x9')]=![];this[_0x461e('0xa')]=_[_0x461e('0x3')](_0x294bad[_0x461e('0xb')])?undefined:_0x294bad[_0x461e('0xb')]['name'];this[_0x461e('0xc')]=this[_0x461e('0xa')]?util[_0x461e('0xd')](_0x461e('0xe'),this[_0x461e('0xa')]):_0x1bb427||undefined;this[_0x461e('0xf')]=checkNameSurname(_0x294bad['Contact'][_0x461e('0x10')],_0x294bad['Contact'][_0x461e('0x11')],_0x294bad[_0x461e('0x12')]['lastName']);this[_0x461e('0x13')]=_0x294bad[_0x461e('0x13')]||![];this['calleridnum']=_0x294bad[_0x461e('0x12')][_0x461e('0x10')];this[_0x461e('0x14')]=_0x294bad[_0x461e('0x14')];this[_0x461e('0x15')]=_0x294bad[_0x461e('0x15')]||0x0;this[_0x461e('0x16')]=_0x294bad[_0x461e('0x16')]||0x0;this[_0x461e('0x17')]=_0x294bad['countnoanswerretry']||0x0;this[_0x461e('0x18')]=(_0x294bad[_0x461e('0x15')]||0x0)+(_0x294bad[_0x461e('0x16')]||0x0)+(_0x294bad['countnoanswerretry']||0x0)+(_0x294bad[_0x461e('0x19')]||0x0)+(_0x294bad[_0x461e('0x1a')]||0x0)+(_0x294bad[_0x461e('0x1b')]||0x0)+(_0x294bad['countmachineretry']||0x0)+(_0x294bad[_0x461e('0x1c')]||0x0);this['countnosuchnumberretry']=_0x294bad[_0x461e('0x19')]||0x0;this['countdropretry']=_0x294bad[_0x461e('0x1a')]||0x0;this['countabandonedretry']=_0x294bad['countabandonedretry']||0x0;this['countmachineretry']=_0x294bad['countmachineretry']||0x0;this['countagentrejectretry']=_0x294bad['countagentrejectretry']||0x0;this[_0x461e('0x1d')]=_0x294bad[_0x461e('0x1d')];this['callbackuniqueid']=_0x294bad['callbackuniqueid'];this[_0x461e('0x1e')]=_0x294bad[_0x461e('0x1e')];this['recallme']=_0x294bad['recallme'];this[_0x461e('0x1f')]=_0x294bad['ContactId'];this[_0x461e('0x20')]=_0x294bad[_0x461e('0x20')];this[_0x461e('0x21')]=_[_0x461e('0x3')](_0x294bad['Agent'])?_0x294bad['UserId']:_0x294bad[_0x461e('0xb')]['id'];this[_0x461e('0x22')]=_0x294bad[_0x461e('0x22')];this[_0x461e('0x23')]='';this[_0x461e('0x24')]='';}Action['prototype'][_0x461e('0x25')]=function(){return util[_0x461e('0xd')]('\x22%s\x22\x20<%s>',this[_0x461e('0xf')],this[_0x461e('0x26')]);};module[_0x461e('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 3ecc577..bbae7e4 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 _0x18e2=['checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','trim','dialCutDigit','substring','Contact','getCallerId','dialRandomLastDigitCallerIdNumber','extractCalleridName','extractCalleridNumber','merge','starttime','variablesAction','[originated][increment]','OriginateError','linkedid','syncOriginateResponse','actionid','logLookAgent','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','reason','channelstate','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','blindtransfer','loopCampaigns','type','outbound','strategy','answered','loggedIn','sumBillable','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','pTalking','sendMessageOneNotActive','available','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','campaignsPreview','hasOwnProperty','clockClearZombieChannels','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','logger2','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','emit','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','[syncHangup][talking][increment]','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','isEmpty','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','isValid'];(function(_0xcf6a46,_0x17684d){var _0x3f92f7=function(_0x313de5){while(--_0x313de5){_0xcf6a46['push'](_0xcf6a46['shift']());}};_0x3f92f7(++_0x17684d);}(_0x18e2,0x191));var _0x218e=function(_0xa0d0e,_0x38f6d2){_0xa0d0e=_0xa0d0e-0x0;var _0x31d0d7=_0x18e2[_0xa0d0e];return _0x31d0d7;};'use strict';var util=require(_0x218e('0x0'));var _=require(_0x218e('0x1'));var BPromise=require(_0x218e('0x2'));var uuid=require(_0x218e('0x3'));var moment=require(_0x218e('0x4'));var md5=require(_0x218e('0x5'));var Redis=require(_0x218e('0x6'));var config=require(_0x218e('0x7'));var logger=require(_0x218e('0x8'))(_0x218e('0x9'));var loggerAction=require(_0x218e('0x8'))(_0x218e('0xa'));var ami=require(_0x218e('0xb'));var rpcDb=require(_0x218e('0xc'));var Action=require(_0x218e('0xd'));var ut=require(_0x218e('0xe'));config[_0x218e('0xf')]=_[_0x218e('0x10')](config[_0x218e('0xf')],{'host':_0x218e('0x11'),'port':0x18eb});var io=require(_0x218e('0x12'))(new Redis(config[_0x218e('0xf')]));var Sequence=function(){};Sequence[_0x218e('0x13')][_0x218e('0x14')]=function(_0x5257ac){this[_0x218e('0x15')]=this[_0x218e('0x15')]?this[_0x218e('0x15')][_0x218e('0x16')](_0x5257ac):_0x5257ac();};function Preview(_0x4cf9cd){this[_0x218e('0x17')]=new Sequence();this['campaignsPreview']=_0x4cf9cd[_0x218e('0x18')];this['trunks']=_0x4cf9cd[_0x218e('0x19')];this[_0x218e('0x1a')]={};this[_0x218e('0x1b')]=_0x4cf9cd['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x218e('0x1c'),this['syncOriginateResponse'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x1e'),this[_0x218e('0x1f')][_0x218e('0x1d')](this));ami['on'](_0x218e('0x20'),this[_0x218e('0x21')]['bind'](this));ami['on'](_0x218e('0x22'),this[_0x218e('0x23')][_0x218e('0x1d')](this));ami['on'](_0x218e('0x24'),this[_0x218e('0x25')][_0x218e('0x1d')](this));ami['on']('varset',this['syncVarSet'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x26'),this['syncAttendedTransfer'][_0x218e('0x1d')](this));ami['on'](_0x218e('0x27'),this['syncBlindTransfer'][_0x218e('0x1d')](this));this[_0x218e('0x28')](this['campaignsPreview']);}function emit(_0x3168ee,_0x4287ca,_0x4d2115){io['to'](_0x3168ee)['emit'](_0x4287ca,_0x4d2115);}function emitCampaignPreview(_0xbf51af){if(_0xbf51af[_0x218e('0x29')]===_0x218e('0x2a')){var _0xf0642b={'id':_0xbf51af['id'],'name':_0xbf51af['name'],'strategy':_0xbf51af[_0x218e('0x2b')],'answered':_0xbf51af[_0x218e('0x2c')],'available':_0xbf51af['available'],'loggedIn':_0xbf51af[_0x218e('0x2d')],'pTalking':_0xbf51af['pTalking'],'sumBillable':_0xbf51af[_0x218e('0x2e')],'sumDuration':_0xbf51af['sumDuration'],'sumHoldTime':_0xbf51af[_0x218e('0x2f')]||0x0,'talking':_0xbf51af[_0x218e('0x30')],'total':_0xbf51af[_0x218e('0x31')],'type':_0xbf51af[_0x218e('0x29')],'unmanaged':_0xbf51af['unmanaged'],'abandoned':_0xbf51af[_0x218e('0x32')],'waiting':_0xbf51af[_0x218e('0x33')],'loggedInDb':_0xbf51af[_0x218e('0x34')],'dialActive':_0xbf51af[_0x218e('0x35')],'dialMethod':_0xbf51af[_0x218e('0x36')],'dialOriginateCallerIdName':_0xbf51af[_0x218e('0x37')],'dialOriginateCallerIdNumber':_0xbf51af[_0x218e('0x38')],'dialOriginateTimeout':_0xbf51af[_0x218e('0x39')],'dialPrefix':_0xbf51af[_0x218e('0x3a')],'outboundAnswerAgiCallsDay':_0xbf51af[_0x218e('0x3b')],'outboundAnswerCallsDay':_0xbf51af[_0x218e('0x3c')],'outboundBlacklistCallsDay':_0xbf51af[_0x218e('0x3d')],'outboundBusyCallsDay':_0xbf51af[_0x218e('0x3e')],'outboundCongestionCallsDay':_0xbf51af[_0x218e('0x3f')],'outboundDropCallsDayACS':_0xbf51af[_0x218e('0x40')],'outboundDropCallsDayCallersExit':_0xbf51af[_0x218e('0x41')],'outboundDropCallsDayTimeout':_0xbf51af[_0x218e('0x42')],'outboundNoAnswerCallsDay':_0xbf51af[_0x218e('0x43')],'outboundNoSuchCallsDay':_0xbf51af[_0x218e('0x44')],'outboundOriginateFailureCallsDay':_0xbf51af['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xbf51af['outboundReCallsDay'],'outboundRejectCallsDay':_0xbf51af[_0x218e('0x45')],'outboundUnknownCallsDay':_0xbf51af['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0xbf51af[_0x218e('0x46')],'predictiveIntervalAnsweredCalls':_0xbf51af[_0x218e('0x47')],'predictiveIntervalAvgHoldtime':_0xbf51af[_0x218e('0x48')],'predictiveIntervalAvgTalktime':_0xbf51af['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xbf51af['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xbf51af[_0x218e('0x49')],'predictiveIntervalErlangCalls':_0xbf51af[_0x218e('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0xbf51af['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xbf51af['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xbf51af['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xbf51af['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xbf51af[_0x218e('0x4b')],'predictiveIntervalTotalCalls':_0xbf51af[_0x218e('0x4c')],'message':_0xbf51af['message'],'originated':_0xbf51af[_0x218e('0x4d')],'erlangCalls':_0xbf51af[_0x218e('0x4e')],'erlangCallToSecond':_0xbf51af[_0x218e('0x4f')],'erlangAbandonmentRate':_0xbf51af[_0x218e('0x50')],'erlangBusyFactor':_0xbf51af[_0x218e('0x51')],'startPredictive':_0xbf51af[_0x218e('0x52')],'startProgressive':_0xbf51af[_0x218e('0x53')]};if(_0xbf51af[_0x218e('0x54')]){_0xf0642b[_0x218e('0x54')]={'id':_0xbf51af[_0x218e('0x54')]['id'],'name':_0xbf51af[_0x218e('0x54')][_0x218e('0x55')],'active':_0xbf51af[_0x218e('0x54')][_0x218e('0x56')],'callerid':_0xbf51af[_0x218e('0x54')][_0x218e('0x57')]};}if(_0xbf51af[_0x218e('0x58')]){_0xf0642b[_0x218e('0x58')]={'id':_0xbf51af[_0x218e('0x58')]['id'],'name':_0xbf51af[_0x218e('0x58')][_0x218e('0x55')]};}var _0x30029e=md5(JSON['stringify'](_0xf0642b));if(_0xbf51af[_0x218e('0x5')]!==_0x30029e){_0xbf51af[_0x218e('0x5')]=_0x30029e;emit(util[_0x218e('0x59')](_0x218e('0x5a'),_0xf0642b[_0x218e('0x55')]),_0x218e('0x5b'),_0xf0642b);}}}function emitVoiceQueueChannelRemove(_0xec0119){logger[_0x218e('0x5c')](_0x218e('0x5d'),JSON['stringify'](_0xec0119));emit(util['format'](_0x218e('0x5a'),_0xec0119[_0x218e('0x55')]),'voice_queue_channel:remove',_0xec0119);}function notSendMessagesQueue(_0x5335e9){if(_0x5335e9['sendMessageOneNotActive']){if(_0x5335e9[_0x218e('0x4d')]===0x0&&_0x5335e9[_0x218e('0x5e')]===0x0){_0x5335e9[_0x218e('0x5f')]=![];_0x5335e9[_0x218e('0x60')]=0x0;_0x5335e9['paused']=0x0;_0x5335e9[_0x218e('0x61')]=_0x218e('0x62');ut['logger'](_0x218e('0x63'),_0x5335e9[_0x218e('0x55')]+_0x218e('0x64'));}else{_0x5335e9[_0x218e('0x61')]=_0x218e('0x65');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5335e9['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x5335e9);}}Preview[_0x218e('0x13')]['loopCampaigns']=function(){var _0x5ab3a6=this;setInterval(function(){_0x5ab3a6[_0x218e('0x66')]();},0x7cf);};Preview[_0x218e('0x13')]['syncCampaigns']=function(){var _0x1a621f=this[_0x218e('0x67')];this['clockClearZombieChannels']+=0x1;for(var _0x21db3e in _0x1a621f){if(_0x1a621f[_0x218e('0x68')](_0x21db3e)&&(_0x1a621f[_0x21db3e][_0x218e('0x36')]===_0x218e('0x9')||_0x1a621f[_0x21db3e][_0x218e('0x36')]==='booked')&&_0x1a621f[_0x21db3e][_0x218e('0x29')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x218e('0x69')]=0x0;this['clearZombieChannels']();}}if(_0x1a621f[_0x218e('0x68')](_0x21db3e)&&_0x1a621f[_0x21db3e][_0x218e('0x36')]==='preview'&&_0x1a621f[_0x21db3e][_0x218e('0x29')]===_0x218e('0x2a')){if(_0x1a621f[_0x21db3e][_0x218e('0x35')]){this['setMessage'](_0x1a621f[_0x21db3e]);this[_0x218e('0x6a')](_0x1a621f[_0x21db3e]);}else{notSendMessagesQueue(_0x1a621f[_0x21db3e]);}}}};Preview[_0x218e('0x13')][_0x218e('0x6b')]=function(_0x19f056){var _0x11f35a=this;this[_0x218e('0x17')]['enqueue'](function(){if(!_['isNil'](_0x11f35a[_0x218e('0x1a')][_0x19f056])){loggerAction[_0x218e('0x5c')](_0x218e('0x6c'),_0x19f056,_0x218e('0x6d'),_0x11f35a['actions'][_0x19f056][_0x218e('0x6e')],_0x218e('0x6f'),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x67')][_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]][_0x218e('0x4d')]),_0x218e('0x71'),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x67')][_0x11f35a[_0x218e('0x1a')][_0x19f056]['queue']]['pTalking']),JSON[_0x218e('0x70')](_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x72')]),JSON[_0x218e('0x70')](_['pick'](_0x11f35a[_0x218e('0x1a')][_0x19f056],['contactId',_0x218e('0x73'),_0x218e('0x74'),_0x218e('0x75')])));return ami[_0x218e('0x76')]({'action':_0x218e('0x77'),'channel':_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x78')]})[_0x218e('0x79')](function(_0x35c58d){if(_0x35c58d[_0x218e('0x61')]===_0x218e('0x7a')){setTimeout(function(){if(_0x11f35a[_0x218e('0x1a')][_0x19f056]){ut[_0x218e('0x7b')](_0x11f35a[_0x218e('0x67')][_0x11f35a['actions'][_0x19f056]['queue']],_0x218e('0x7c'));if(_0x11f35a['actions'][_0x19f056][_0x218e('0x72')]===!![]){ut['decrementTalkink'](_0x11f35a['campaignsPreview'][_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]],_0x218e('0x7c'));ut[_0x218e('0x7d')](_0x218e('0x7e')+_0x19f056,_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]);}ut['loggerError'](_0x218e('0x7f')+_0x19f056,_0x11f35a[_0x218e('0x1a')][_0x19f056][_0x218e('0x6e')]);delete _0x11f35a[_0x218e('0x1a')][_0x19f056];}},0x2328);}});}});};Preview[_0x218e('0x13')]['clearZombieChannels']=function(){var _0x303f03=this;loggerAction[_0x218e('0x5c')](_0x218e('0x80'),_[_0x218e('0x81')](this[_0x218e('0x1a')]));for(var _0x2e4354 in this['actions']){if(_0x303f03[_0x218e('0x1a')][_0x218e('0x68')](_0x2e4354)){_0x303f03[_0x218e('0x6b')](_0x2e4354);}}};Preview[_0x218e('0x13')][_0x218e('0x6a')]=function(_0x179b52){var _0x5b305c=this;rpcDb[_0x218e('0x82')](_0x179b52['id'],ut['agentReadyId'](this[_0x218e('0x1b')]))[_0x218e('0x83')](function(_0x14b783){if(!_[_0x218e('0x84')](_0x14b783)){for(var _0x313c2f=0x0;_0x313c2f<_0x14b783[_0x218e('0x85')];_0x313c2f+=0x1){if(ut[_0x218e('0x86')](_0x14b783[_0x313c2f]['scheduledat'])<_0x179b52[_0x218e('0x87')]*0x3c){if(_0x14b783[_0x313c2f]['Agent']&&!_0x14b783[_0x313c2f][_0x218e('0x88')][_0x218e('0x89')]){_0x5b305c[_0x218e('0x8a')](_0x14b783[_0x313c2f]['id'])[_0x218e('0x83')](ut['logger2']('[RecallMe]'))[_0x218e('0x79')](ut['logger2'](_0x218e('0x8b')));}else{rpcDb[_0x218e('0x8c')](_0x14b783[_0x313c2f]['id']);}}else{var _0x16edf4=new Action(_0x14b783[_0x313c2f],_0x179b52);_0x16edf4['starttime']=moment()[_0x218e('0x59')](_0x218e('0x8d'));_0x179b52[_0x218e('0x8e')]+=0x1;ut[_0x218e('0x8f')](_0x16edf4,0x17,_0x218e('0x90'));if(_0x179b52['dialRecallInQueue']){rpcDb[_0x218e('0x91')](ut[_0x218e('0x92')](_0x14b783[_0x313c2f]));rpcDb['createCustomerHistory'](_0x16edf4,_0x218e('0x93'));}else{ut[_0x218e('0x8f')](_0x16edf4,0x16,_0x218e('0x94'));rpcDb[_0x218e('0x95')](_0x16edf4,_0x218e('0x96'));rpcDb[_0x218e('0x97')](_0x16edf4,_0x218e('0x96'));}}}}})[_0x218e('0x79')](ut[_0x218e('0x98')]('[getContactRecallMe]'));};Preview['prototype'][_0x218e('0x99')]=function(_0x39df33){_0x39df33[_0x218e('0x5f')]=!![];if(ut[_0x218e('0x9a')](_0x39df33[_0x218e('0x2d')])){_0x39df33[_0x218e('0x61')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x218e('0x9b')](_0x39df33['dialActive'])){_0x39df33[_0x218e('0x61')]='NOT_ACTIVE';}else if(!this[_0x218e('0x9c')](_0x39df33[_0x218e('0x54')])){if(!this[_0x218e('0x9c')](_0x39df33[_0x218e('0x9d')])){_0x39df33[_0x218e('0x61')]=_0x218e('0x9e');}else{_0x39df33['message']=_0x218e('0x9f');}}else{_0x39df33[_0x218e('0x61')]='ACTIVE';}emitCampaignPreview(_0x39df33);};Preview[_0x218e('0x13')][_0x218e('0xa0')]=function(_0x552632,_0x3300d5,_0x31f84c){var _0x540549=this;var _0x196c44=this[_0x218e('0x1a')][_0x3300d5];var _0x33fb35=this[_0x218e('0x67')][_0x196c44['queue']];var _0x2c346e;if(_0x33fb35){switch(_0x31f84c){case'1':_0x33fb35[_0x218e('0x44')]+=0x1;_0x196c44[_0x218e('0xa1')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x0,_0x218e('0xa3'));ami[_0x218e('0xa4')]('custom:agentnosuchnumber',ut['buildObj'](_0x196c44,_0x218e('0xa5')));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xa6'));if(ut['totalGlobal'](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut['cloneAction'](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xa9'));}else{if(_0x196c44[_0x218e('0xa1')]>=_0x33fb35[_0x218e('0xaa')]){rpcDb['createCustomerFinal'](_0x196c44,_0x218e('0xa9'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xa1'),_0x33fb35[_0x218e('0xad')]),_0x196c44[_0x218e('0xae')],_0x196c44[_0x218e('0xaf')]);}}delete this[_0x218e('0x1a')][_0x552632['linkedid']];break;case _0x218e('0xb0'):var _0x2c4e4e=moment()['format'](_0x218e('0x8d'));_0x196c44[_0x218e('0xb1')]=_0x2c4e4e;_0x196c44['answertime']=_0x2c4e4e;_0x196c44[_0x218e('0x72')]=!![];_0x33fb35[_0x218e('0x5e')]+=0x1;logger['info'](_0x218e('0xb2'),_0x196c44['uniqueid'],'\x20Queue',_0x33fb35[_0x218e('0x55')],_0x218e('0x71'),_0x33fb35[_0x218e('0x5e')]);ami[_0x218e('0xa4')]('custom:agentconnect',ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xb4')));if(_0x33fb35['acw']){ami['emit'](_0x218e('0xb5'),ut[_0x218e('0xb6')](_0x196c44));}break;case'16':ami[_0x218e('0xa4')](_0x218e('0xb7'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xb8')));emitVoiceQueueChannelRemove(ut[_0x218e('0xb3')](_0x196c44,'complete'));_0x33fb35[_0x218e('0x3c')]+=0x1;_0x33fb35['total']+=0x1;_0x33fb35['answered']+=0x1;ut[_0x218e('0xb9')](_0x33fb35,_0x218e('0xba'));_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x4,_0x218e('0xbc'));rpcDb['createCustomerHistory'](_0x196c44,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xbd'));rpcDb[_0x218e('0xbe')](_0x196c44);_0x33fb35[_0x218e('0xbf')]+=_0x196c44['talktime'];_0x33fb35[_0x218e('0x2e')]+=_0x196c44[_0x218e('0xc0')];logger['info'](_0x218e('0xc1'),_0x196c44[_0x218e('0xc2')],'\x20Queue',_0x33fb35[_0x218e('0x55')],_0x218e('0x71'),_0x33fb35[_0x218e('0x5e')]);delete this[_0x218e('0x1a')][_0x552632['linkedid']];break;case _0x218e('0xc3'):_0x33fb35[_0x218e('0x3e')]+=0x1;_0x196c44[_0x218e('0xc4')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x5,'Busy');ami['emit'](_0x218e('0xc5'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xc6')));rpcDb['createCustomerHistory'](_0x196c44,_0x218e('0xc7'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xc9'));}else{if(_0x196c44[_0x218e('0xc4')]>=_0x33fb35[_0x218e('0xca')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xc7'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x196c44,_0x218e('0xc4'),_0x33fb35[_0x218e('0xcb')]),_0x196c44['unlockAgent'],_0x196c44['activeContact']);}}break;case _0x218e('0xcc'):_0x33fb35[_0x218e('0x43')]+=0x1;_0x196c44[_0x218e('0xcd')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x3,_0x218e('0xce'));ami[_0x218e('0xa4')]('custom:agentnoanswer',ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xcf')));rpcDb[_0x218e('0x95')](_0x196c44,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut['cloneAction'](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x196c44['countnoanswerretry']>=_0x33fb35[_0x218e('0xd0')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xd1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x196c44,_0x218e('0xcd'),_0x33fb35[_0x218e('0xd2')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;case _0x218e('0xd3'):_0x33fb35[_0x218e('0x3f')]+=0x1;_0x196c44[_0x218e('0xd4')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut['totalGlobal'](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0x8,_0x218e('0xd5'));ami[_0x218e('0xa4')](_0x218e('0xd6'),ut[_0x218e('0xb3')](_0x196c44,'congestion'));rpcDb['createCustomerHistory'](_0x196c44,_0x218e('0xd7'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x196c44['countcongestionretry']>=_0x33fb35[_0x218e('0xd8')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xd7'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xd4'),_0x33fb35[_0x218e('0xcb')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;case _0x218e('0xd9'):_0x33fb35[_0x218e('0x45')]+=0x1;_0x196c44['countagentrejectretry']+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0x14,'AgentReject');ami[_0x218e('0xa4')](_0x218e('0xda'),ut[_0x218e('0xb3')](_0x196c44,_0x218e('0xdb')));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xdc'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0x14,'AgentReject');rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xdd'));}else{if(_0x196c44[_0x218e('0xde')]>=_0x33fb35[_0x218e('0xdf')]){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x218e('0xac')](_0x196c44,'countagentrejectretry',_0x33fb35[_0x218e('0xe0')]),_0x196c44['unlockAgent'],_0x196c44['activeContact']);}}break;case _0x218e('0xe1'):_0x33fb35[_0x218e('0x46')]+=0x1;_0x196c44[_0x218e('0xe2')]+=0x1;_0x196c44['countglobal']=ut[_0x218e('0xa2')](_0x196c44);ut['logCustomer'](_0x196c44,0xb,_0x218e('0xe3'));rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xe4'));if(ut['totalGlobal'](_0x196c44)>=_0x33fb35['dialGlobalMaxRetry']){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xe4'));}else{if(_0x196c44[_0x218e('0xe5')]>=_0x33fb35['dialAbandonedMaxRety']){rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xe4'));}else{rpcDb[_0x218e('0xab')](ut[_0x218e('0xac')](_0x196c44,_0x218e('0xe2'),_0x33fb35[_0x218e('0xe6')]),_0x196c44['unlockAgent'],_0x196c44[_0x218e('0xaf')]);}}break;default:if(_0x196c44[_0x218e('0x72')]){ut[_0x218e('0xb9')](_0x33fb35,_0x218e('0xe7'));ut[_0x218e('0x7d')](_0x218e('0xe8')+_0x33fb35['name'],_0x552632);}_0x33fb35[_0x218e('0xe9')]+=0x1;_0x196c44[_0x218e('0xbb')]=ut[_0x218e('0xa2')](_0x196c44);ut[_0x218e('0x8f')](_0x196c44,0xc,_0x552632[_0x218e('0xea')]||_0x552632[_0x218e('0xeb')]);rpcDb[_0x218e('0x95')](_0x196c44,_0x218e('0xec'));if(ut[_0x218e('0xa2')](_0x196c44)>=_0x33fb35[_0x218e('0xa7')]){_0x2c346e=ut[_0x218e('0xc8')](_0x196c44,0xf,_0x218e('0xa8'));rpcDb[_0x218e('0x97')](_0x2c346e,_0x218e('0xed'));}else{rpcDb[_0x218e('0x97')](_0x196c44,_0x218e('0xed'));}delete this[_0x218e('0x1a')][_0x552632['linkedid']];}if(!(_0x196c44[_0x218e('0x72')]&&_0x31f84c==='16')){ut['updateOriginated'](_0x33fb35,_0x218e('0xee'));logger[_0x218e('0x5c')](_0x218e('0xef'),_0x196c44['uniqueid'],_0x218e('0xf0'),_0x33fb35[_0x218e('0x55')],_0x218e('0x6f'),_0x33fb35[_0x218e('0x4d')]);}if(_0x31f84c!==_0x218e('0xb0')){delete this[_0x218e('0x1a')][_0x552632['linkedid']];delete this['actions'][_0x552632[_0x218e('0xf1')]];}}};Preview[_0x218e('0x13')][_0x218e('0xf2')]=function(_0x1e93ac,_0xae6ed0,_0x50a78f){if(_[_0x218e('0xf3')](_0xae6ed0)&&'object'!==typeof _0xae6ed0){return;}if(_[_0x218e('0xf3')](_0x50a78f)&&_0x218e('0xf4')!==typeof _0x50a78f){return;}switch(_0x50a78f['reason']){case'0':ut[_0x218e('0xf5')](_0x1e93ac,0x0,_0x218e('0xa3'));rpcDb[_0x218e('0xf6')](_0x1e93ac,_0x218e('0xf7'));break;case'3':ut['logAgent'](_0x1e93ac,0x3,_0x218e('0xce'));rpcDb[_0x218e('0xf6')](_0x1e93ac,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x1e93ac,0x5,_0x218e('0xf8'));rpcDb['createAgentHistory'](_0x1e93ac,_0x218e('0xf9'));break;case'8':ut['logAgent'](_0x1e93ac,0x8,_0x218e('0xd5'));rpcDb[_0x218e('0xf6')](_0x1e93ac,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x218e('0xf5')](_0x1e93ac,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x1e93ac,_0x218e('0xfa'));break;default:ut[_0x218e('0xf5')](_0x1e93ac,0xc,_0x50a78f['reason']);rpcDb[_0x218e('0xf6')](_0x1e93ac,_0x218e('0xfb'));}ut[_0x218e('0x7b')](_0xae6ed0,_0x218e('0xfc'));logger[_0x218e('0x5c')](_0x218e('0xfd'),_0x1e93ac['uniqueid'],_0x218e('0xf0'),_0xae6ed0[_0x218e('0x55')],_0x218e('0x6f'),_0xae6ed0[_0x218e('0x4d')]);delete this['actions'][_0x1e93ac[_0x218e('0xc2')]];};Preview[_0x218e('0x13')][_0x218e('0xfe')]=function(_0x2b697b,_0x5e2300,_0x3fed24,_0x23668e,_0x127d0f){var _0x194f75=this;return new BPromise(function(_0x10bd24,_0x120878){if(_['isNil'](_0x5e2300)||_['isNil'](_0x5e2300['Contact'])||_[_0x218e('0x84')](_0x5e2300['Contact'][_0x218e('0xff')])||_['isNil'](_0x5e2300[_0x218e('0x74')])){_0x120878(ut[_0x218e('0x61')]('Contact\x20is\x20undefined',_0x23668e,_0x127d0f));return;}var _0x16a87d=uuid['v4']();var _0x42da09=_0x194f75[_0x218e('0x67')][_0x5e2300[_0x218e('0x6d')][_0x218e('0x55')]];var _0x3b7d23=_0x3fed24?_0x194f75[_0x218e('0x1b')][_0x3fed24]['id']:undefined;_0x194f75[_0x218e('0x1a')][_0x16a87d]=new Action(_0x5e2300,_0x42da09,_0x16a87d,_0x3fed24,_0x3b7d23);var _0x2dd623=_0x194f75['actions'][_0x16a87d];_0x2dd623['unlockAgent']=_0x23668e;_0x2dd623[_0x218e('0xaf')]=_0x127d0f;_0x2dd623['lookAgent']=_0x3fed24;if(_[_0x218e('0x100')](_0x2b697b)){_0x194f75['execCall'](_0x2dd623,_0x42da09,_0x5e2300,_0x3fed24)[_0x218e('0x83')](function(_0x325b24){logger[_0x218e('0x5c')](_0x218e('0x101'),_0x218e('0x102')+_0x2dd623[_0x218e('0x6e')]+'\x20IdHopper:\x20'+_0x2dd623[_0x218e('0x103')],JSON[_0x218e('0x70')](_0x325b24));ami['emit'](_0x218e('0x104'),ut[_0x218e('0xb3')](_0x2dd623,_0x218e('0x105')));_0x10bd24(ut[_0x218e('0x61')](_0x218e('0x106')));})[_0x218e('0x79')](function(_0x4a1cfa){ut[_0x218e('0x107')](_0x218e('0x108'),_0x4a1cfa);_0x120878(ut[_0x218e('0x61')](_0x218e('0x109'),_0x23668e,_0x127d0f));});}else{_0x42da09['outboundBlacklistCallsDay']+=0x1;ut[_0x218e('0x10a')](_0x2dd623);rpcDb[_0x218e('0x10b')](_0x2dd623,_0x218e('0x10c'));delete _0x194f75[_0x218e('0x1a')][_0x16a87d];_0x120878(ut['message'](_0x218e('0x10d'),_0x23668e,_0x127d0f));}});};Preview[_0x218e('0x13')][_0x218e('0x9c')]=function(_0x4e41d3){return!_[_0x218e('0x84')](_0x4e41d3)&&!_[_0x218e('0x84')](_0x4e41d3[_0x218e('0x55')])&&!_['isNil'](_0x4e41d3[_0x218e('0x56')])&&_0x4e41d3[_0x218e('0x56')]&&!_[_0x218e('0x84')](this[_0x218e('0x19')][util[_0x218e('0x59')]('SIP/%s',_0x4e41d3['name'])])&&!_[_0x218e('0x84')](this['trunks'][util[_0x218e('0x59')](_0x218e('0x10e'),_0x4e41d3[_0x218e('0x55')])][_0x218e('0x77')])&&(this[_0x218e('0x19')][util['format'](_0x218e('0x10e'),_0x4e41d3['name'])][_0x218e('0x77')]===_0x218e('0x10f')||this[_0x218e('0x19')][util[_0x218e('0x59')](_0x218e('0x10e'),_0x4e41d3[_0x218e('0x55')])][_0x218e('0x77')]===_0x218e('0x110'));};Preview[_0x218e('0x13')][_0x218e('0x8a')]=function(_0x1c5372,_0x515219){var _0x4606a7=this;return new BPromise(function(_0x1f765b,_0x1dcb8e){_0x4606a7[_0x218e('0x111')](_0x1c5372,_0x515219)[_0x218e('0x83')](function(_0x212605){_0x1f765b(_['pick'](_0x212605,[_0x218e('0x61')]));})[_0x218e('0x79')](function(_0x5bcc94){if(_0x5bcc94[_0x218e('0x112')]){rpcDb[_0x218e('0x113')](_0x1c5372);}if(_0x5bcc94['active']){rpcDb['disableContact'](_0x1c5372);}_0x1dcb8e(_[_0x218e('0x114')](_0x5bcc94,['message']));});});};Preview[_0x218e('0x13')][_0x218e('0x111')]=function(_0xa70fc3,_0x10f3d0){var _0x1a202e=this;return new BPromise(function(_0x347f46,_0x28aadf){var _0x11b0a2,_0x222b90;rpcDb[_0x218e('0x115')](_0xa70fc3)[_0x218e('0x83')](function(_0x271a4d){if(!_[_0x218e('0x84')](_0x271a4d[0x0])){_0x222b90=_0x271a4d[0x0]['recallme']?![]:!![];_0x11b0a2=_0x271a4d[0x0][_0x218e('0x116')]?!![]:![];_0x11b0a2=_0x10f3d0?!![]:_0x11b0a2;}var _0x15de58=_0x1a202e[_0x218e('0x117')](_0x271a4d);if(_0x15de58[_0x218e('0x118')]){rpcDb[_0x218e('0x119')](_[_0x218e('0x114')](_0x271a4d[0x0],[_0x218e('0x74'),_0x218e('0x11a')]))[_0x218e('0x83')](function(_0x202580){_0x1a202e[_0x218e('0xfe')](_0x202580,_0x271a4d[0x0],_0x10f3d0,_0x222b90,_0x11b0a2)['then'](function(_0xf8ab01){_0x347f46(_0xf8ab01);})[_0x218e('0x79')](function(_0x2d5dc3){_0x28aadf(_0x2d5dc3);});})[_0x218e('0x79')](function(_0x3de14a){ut[_0x218e('0x107')](_0x218e('0x11b'),_0x3de14a);_0x28aadf(ut[_0x218e('0x61')](_0x218e('0x11c'),_0x222b90,_0x11b0a2));});}else{_0x28aadf(ut[_0x218e('0x61')](_0x15de58['message'],_0x222b90,_0x11b0a2));}})['catch'](function(_0x58782e){ut[_0x218e('0x107')](_0x218e('0x11d'),_0x58782e);_0x28aadf(ut[_0x218e('0x61')](_0x218e('0x11c'),![],!![]));});});};Preview['prototype'][_0x218e('0x117')]=function(_0x342da9){if(_[_0x218e('0x84')](_0x342da9)||_['isEmpty'](_0x342da9)||!_[_0x218e('0x84')](_0x342da9[0x0][_0x218e('0x88')])&&_[_0x218e('0x84')](_0x342da9[0x0][_0x218e('0x88')][_0x218e('0x55')])){ut[_0x218e('0x107')]('[Preview][validateContact][Empty\x20Contact]',_0x342da9);return{'isValid':![],'message':_0x218e('0x11e')};}var _0x4ba62e=this['campaignsPreview'][_0x342da9[0x0]['Queue'][_0x218e('0x55')]];_0x4ba62e[_0x218e('0x61')]='ACTIVE';if(_[_0x218e('0x84')](_0x4ba62e)){ut[_0x218e('0x107')](_0x218e('0x11f'),_0x4ba62e);return{'isValid':![],'message':_0x218e('0x120')};}if(!this[_0x218e('0x9c')](_0x4ba62e['Trunk'])){ut[_0x218e('0x107')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x218e('0x121')+_0x4ba62e[_0x218e('0x55')]+_0x218e('0x122'));if(!this[_0x218e('0x9c')](_0x4ba62e[_0x218e('0x9d')])){ut['logger'](_0x218e('0x123'),_0x4ba62e['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x218e('0x124')};}}if(!ut[_0x218e('0x9b')](_0x4ba62e[_0x218e('0x35')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x4ba62e['name']+_0x218e('0x125'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4ba62e[_0x218e('0x55')]+_0x218e('0x125')};}return{'isValid':!![],'message':_0x218e('0x126')};};Preview[_0x218e('0x13')][_0x218e('0x127')]=function(_0x339f5f,_0x42017d,_0x2a72ff,_0x40b9a6){var _0x3b11c4=this;return new BPromise(function(_0x46f802,_0x6d701e){var _0x5058c=_0x339f5f[_0x218e('0xc2')];var _0x2b3456=_0x3b11c4[_0x218e('0x9c')](_0x42017d[_0x218e('0x54')])?util[_0x218e('0x59')](_0x218e('0x128'),_0x42017d[_0x218e('0x54')][_0x218e('0x55')],_['isNil'](_0x42017d[_0x218e('0x3a')])?'':_0x42017d[_0x218e('0x3a')][_0x218e('0x129')]()||'',_0x42017d[_0x218e('0x12a')]>0x0?_0x2a72ff['Contact'][_0x218e('0xff')][_0x218e('0x12b')](_0x42017d[_0x218e('0x12a')]):_0x2a72ff[_0x218e('0x12c')][_0x218e('0xff')]):util[_0x218e('0x59')](_0x218e('0x128'),_[_0x218e('0x84')](_0x42017d['TrunkBackup'])?_0x42017d[_0x218e('0x54')][_0x218e('0x55')]:_0x42017d[_0x218e('0x9d')][_0x218e('0x55')],_[_0x218e('0x84')](_0x42017d[_0x218e('0x3a')])?'':_0x42017d[_0x218e('0x3a')][_0x218e('0x129')]()||'',_0x42017d[_0x218e('0x12a')]>0x0?_0x2a72ff['Contact']['phone'][_0x218e('0x12b')](_0x42017d[_0x218e('0x12a')]):_0x2a72ff[_0x218e('0x12c')][_0x218e('0xff')]);var _0x2d447c=_0x3b11c4['isTrunkReachable'](_0x42017d[_0x218e('0x54')])?ut[_0x218e('0x12d')](_0x42017d[_0x218e('0x54')][_0x218e('0x57')],_0x42017d[_0x218e('0x37')],_0x42017d[_0x218e('0x12e')]>0x0?ut['getCallerIdRandom'](_0x42017d[_0x218e('0x38')],_0x42017d[_0x218e('0x12e')]):_0x42017d[_0x218e('0x38')]):ut[_0x218e('0x12d')](_[_0x218e('0x84')](_0x42017d[_0x218e('0x9d')])?_0x42017d[_0x218e('0x54')][_0x218e('0x57')]:_0x42017d[_0x218e('0x9d')]['callerid'],_0x42017d[_0x218e('0x37')],_0x42017d['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x42017d[_0x218e('0x38')],_0x42017d[_0x218e('0x12e')]):_0x42017d[_0x218e('0x38')]);if(_0x2d447c){_0x339f5f['originatecalleridname']=ut[_0x218e('0x12f')](_0x2d447c);_0x339f5f['originatecalleridnum']=ut[_0x218e('0x130')](_0x2d447c);}var _0x55320e=ut['addVariables'](_0x42017d,_0x2a72ff,_0x2b3456,_0x2d447c,_0x5058c,_0x339f5f);_[_0x218e('0x131')](_0x339f5f,ut['toLowerVariables'](_0x55320e));_0x339f5f[_0x218e('0x132')]=moment()[_0x218e('0x59')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x218e('0x76')](ut[_0x218e('0x133')](_0x339f5f,_0x42017d,_0x55320e,_0x339f5f[_0x218e('0xaf')],_0x40b9a6))['then'](function(_0x4dceba){_0x42017d[_0x218e('0x4d')]+=0x1;logger['info'](_0x218e('0x134'),_0x5058c,_0x218e('0xf0'),_0x42017d[_0x218e('0x55')],_0x218e('0x6f'),_0x42017d[_0x218e('0x4d')]);_0x46f802(_0x4dceba);})[_0x218e('0x79')](function(_0x67f90){ut[_0x218e('0xf5')](_0x339f5f,0xe,_0x218e('0x135'));rpcDb[_0x218e('0xf6')](_0x339f5f,'[originateFailure][logOriginateFailure]');_0x6d701e(_0x67f90);});});};Preview['prototype']['syncNewExten']=function(_0x2dba63){if(this['actions'][_0x2dba63['linkedid']]){this[_0x218e('0x1a')][_0x2dba63[_0x218e('0x136')]]['channel']=_0x2dba63[_0x218e('0x78')];}};Preview[_0x218e('0x13')][_0x218e('0x137')]=function(_0x5830ab){var _0x5246e0=this;var _0x3fe7ed=this[_0x218e('0x1a')][_0x5830ab[_0x218e('0x138')]];if(_0x3fe7ed){if(_0x3fe7ed['lookAgent']&&this[_0x218e('0x1b')][_0x3fe7ed['lookAgent']]){ut[_0x218e('0x139')](_0x3fe7ed,this[_0x218e('0x1b')][_0x3fe7ed[_0x218e('0x13a')]]['name'],this[_0x218e('0x1b')][_0x3fe7ed['lookAgent']]['id']);}var _0x3103d8=_[_0x218e('0x13b')](_0x3fe7ed);_0x3103d8[_0x218e('0xb1')]=moment()[_0x218e('0x59')](_0x218e('0x8d'));var _0x16bfca=_0x5246e0[_0x218e('0x67')][_0x3fe7ed['queue']];if(ut[_0x218e('0x13c')](_0x5830ab[_0x218e('0x13d')])){if(_0x3fe7ed['unlockAgent']){rpcDb[_0x218e('0x113')](_0x3fe7ed[_0x218e('0x103')]);}if(_0x3fe7ed[_0x218e('0xaf')]){rpcDb['disableContact'](_0x3fe7ed[_0x218e('0x103')]);}ami[_0x218e('0xa4')](_0x218e('0x13e'),ut[_0x218e('0xb3')](_0x3fe7ed,_0x218e('0x13f')));this['callProgressDetectingAgent'](_0x3103d8,_0x16bfca,_0x5830ab);}else{_0x3fe7ed[_0x218e('0x132')]=moment()[_0x218e('0x59')](_0x218e('0x8d'));ut[_0x218e('0xf5')](_0x3103d8,0x4,'Answer');rpcDb['createAgentHistory'](_0x3103d8,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x218e('0x13')][_0x218e('0x1f')]=function(_0x3f9c18){var _0x45077f=this;var _0x27fec0=this[_0x218e('0x1a')][_0x3f9c18['linkedid']];var _0x2589e8;if(_0x27fec0){_0x2589e8=this[_0x218e('0x67')][_0x27fec0[_0x218e('0x6e')]];logger[_0x218e('0x5c')](_0x218e('0x140'),_0x3f9c18[_0x218e('0x136')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8[_0x218e('0x5e')]);}if(this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]&&_0x3f9c18[_0x218e('0x136')]!==_0x3f9c18['uniqueid']){if(_0x3f9c18[_0x218e('0x141')]==='16'&&this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')]);}else if(this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]][_0x218e('0x72')]){logger['info'](_0x218e('0x142'),_0x3f9c18['linkedid'],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],'pTalking:\x20',_0x2589e8['pTalking']);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18['cause']);}}else if(_0x27fec0&&_[_0x218e('0x84')](_0x27fec0[_0x218e('0x143')])&&_0x2589e8[_0x218e('0x144')]&&_0x3f9c18['linkedid']===_0x3f9c18[_0x218e('0xc2')]&&_[_0x218e('0x84')](_0x3f9c18[_0x218e('0x145')])&&_0x3f9c18[_0x218e('0x141')]==='16'&&_0x3f9c18[_0x218e('0x146')]==='6'&&_[_0x218e('0xf3')](_0x27fec0[_0x218e('0x147')])){if(_0x27fec0['unlockAgent']){rpcDb[_0x218e('0x113')](_0x27fec0[_0x218e('0x103')]);}if(_0x27fec0['activeContact']){rpcDb['disableContact'](_0x27fec0[_0x218e('0x103')]);}_0x3f9c18['reason']='22';this[_0x218e('0xf2')](_0x27fec0,_0x2589e8,_0x3f9c18);}else if(_0x27fec0&&_0x27fec0['transfer']){if(_0x3f9c18['cause']==='16'&&this[_0x218e('0x1a')][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){logger[_0x218e('0x5c')]('[syncHangup][talking][transfer]',_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8[_0x218e('0x5e')]);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')]);}else if(this['actions'][_0x3f9c18[_0x218e('0x136')]]['dialAnswer']){logger[_0x218e('0x5c')](_0x218e('0x142'),_0x3f9c18[_0x218e('0x136')],_0x3f9c18[_0x218e('0x141')],_0x218e('0xf0'),_0x2589e8[_0x218e('0x55')],_0x218e('0x71'),_0x2589e8['pTalking']);this[_0x218e('0xa0')](_0x3f9c18,_0x3f9c18['linkedid'],_0x3f9c18['cause']);}}};Preview[_0x218e('0x13')][_0x218e('0x23')]=function(_0x389600){if(this['actions'][_0x389600['destlinkedid']]&&_0x389600[_0x218e('0xf1')]!==_0x389600[_0x218e('0x148')]){this[_0x218e('0xa0')](_0x389600,_0x389600[_0x218e('0xf1')],_0x389600[_0x218e('0xeb')]);}};Preview['prototype']['syncHangupRequest']=function(_0x5b0ac8){if(this[_0x218e('0x1a')][_0x5b0ac8[_0x218e('0x136')]]&&_0x5b0ac8[_0x218e('0x136')]!==_0x5b0ac8[_0x218e('0xc2')]&&!this['actions'][_0x5b0ac8[_0x218e('0x136')]][_0x218e('0x72')]){if(_0x5b0ac8[_0x218e('0x141')]==='1'){this[_0x218e('0xa0')](_0x5b0ac8,_0x5b0ac8[_0x218e('0x136')],_0x5b0ac8[_0x218e('0x141')]);}}};Preview['prototype'][_0x218e('0x149')]=function(_0x229d6b,_0x3002c5,_0x290647){if(this[_0x218e('0x1a')][_0x229d6b]){if(_[_0x218e('0x84')](this[_0x218e('0x1a')][_0x229d6b][_0x218e('0x14a')])){this['actions'][_0x229d6b][_0x218e('0x14a')]={};}this['actions'][_0x229d6b][_0x218e('0x14a')][_0x3002c5]=_0x290647;}};Preview[_0x218e('0x13')]['syncVarSet']=function(_0x1f662d){try{if(!_[_0x218e('0x84')](_0x1f662d)){if(ut[_0x218e('0x14b')](_[_0x218e('0x14c')](_0x1f662d[_0x218e('0x14d')])[0x0])){this[_0x218e('0x149')](_0x1f662d[_0x218e('0xc2')],_[_0x218e('0x14c')](_0x1f662d[_0x218e('0x14d')])[0x0],_0x1f662d['value']);}}}catch(_0x5cb8ec){logger['error'](_0x218e('0x14e'),util[_0x218e('0x14f')](_0x5cb8ec,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x218e('0x150')]=function(_0x318a3b){if(_0x318a3b){if(this[_0x218e('0x1a')][_0x318a3b[_0x218e('0x151')]]){this[_0x218e('0x1a')][_0x318a3b[_0x218e('0x151')]][_0x218e('0x147')]=!![];}}};Preview[_0x218e('0x13')][_0x218e('0x152')]=function(_0x16f750){if(_0x16f750){if(this[_0x218e('0x1a')][_0x16f750['transfererlinkedid']]){this['actions'][_0x16f750[_0x218e('0x153')]]['transfer']=!![];}}};module[_0x218e('0x154')]=Preview; \ No newline at end of file +var _0x4bb5=['VoiceQueueId','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','run','execRun','pick','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','idContact','rejected','starttime','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','md5','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','stringify','dialAnswer','UserId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','total','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x4bb5,0x19f));var _0x54bb=function(_0x1ba3a5,_0x2e3fd1){_0x1ba3a5=_0x1ba3a5-0x0;var _0x3a96e8=_0x4bb5[_0x1ba3a5];return _0x3a96e8;};'use strict';var util=require(_0x54bb('0x0'));var _=require(_0x54bb('0x1'));var BPromise=require(_0x54bb('0x2'));var uuid=require(_0x54bb('0x3'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x54bb('0x4'));var config=require(_0x54bb('0x5'));var logger=require(_0x54bb('0x6'))(_0x54bb('0x7'));var loggerAction=require(_0x54bb('0x6'))(_0x54bb('0x8'));var ami=require(_0x54bb('0x9'));var rpcDb=require(_0x54bb('0xa'));var Action=require(_0x54bb('0xb'));var ut=require(_0x54bb('0xc'));config['redis']=_['defaults'](config[_0x54bb('0xd')],{'host':_0x54bb('0xe'),'port':0x18eb});var io=require(_0x54bb('0xf'))(new Redis(config[_0x54bb('0xd')]));var Sequence=function(){};Sequence[_0x54bb('0x10')][_0x54bb('0x11')]=function(_0x3954df){this['tail']=this[_0x54bb('0x12')]?this[_0x54bb('0x12')]['finally'](_0x3954df):_0x3954df();};function Preview(_0x36870c){this[_0x54bb('0x13')]=new Sequence();this[_0x54bb('0x14')]=_0x36870c[_0x54bb('0x15')];this[_0x54bb('0x16')]=_0x36870c[_0x54bb('0x16')];this[_0x54bb('0x17')]={};this['agents']=_0x36870c[_0x54bb('0x18')];this[_0x54bb('0x19')]=0x0;ami['on']('originateresponse',this[_0x54bb('0x1a')][_0x54bb('0x1b')](this));ami['on'](_0x54bb('0x1c'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x54bb('0x1d')]['bind'](this));ami['on'](_0x54bb('0x1e'),this['syncDialEnd'][_0x54bb('0x1b')](this));ami['on'](_0x54bb('0x1f'),this[_0x54bb('0x20')][_0x54bb('0x1b')](this));ami['on'](_0x54bb('0x21'),this[_0x54bb('0x22')][_0x54bb('0x1b')](this));ami['on'](_0x54bb('0x23'),this[_0x54bb('0x24')][_0x54bb('0x1b')](this));ami['on'](_0x54bb('0x25'),this[_0x54bb('0x26')][_0x54bb('0x1b')](this));this[_0x54bb('0x27')](this[_0x54bb('0x14')]);}function emit(_0x1d35a3,_0x381644,_0x28e9f4){io['to'](_0x1d35a3)[_0x54bb('0x28')](_0x381644,_0x28e9f4);}function emitCampaignPreview(_0x45967c){if(_0x45967c['type']===_0x54bb('0x29')){var _0x577a73={'id':_0x45967c['id'],'name':_0x45967c[_0x54bb('0x2a')],'strategy':_0x45967c[_0x54bb('0x2b')],'answered':_0x45967c[_0x54bb('0x2c')],'available':_0x45967c[_0x54bb('0x2d')],'loggedIn':_0x45967c[_0x54bb('0x2e')],'pTalking':_0x45967c[_0x54bb('0x2f')],'sumBillable':_0x45967c[_0x54bb('0x30')],'sumDuration':_0x45967c[_0x54bb('0x31')],'sumHoldTime':_0x45967c[_0x54bb('0x32')]||0x0,'talking':_0x45967c['talking'],'total':_0x45967c['total'],'type':_0x45967c[_0x54bb('0x33')],'unmanaged':_0x45967c[_0x54bb('0x34')],'abandoned':_0x45967c[_0x54bb('0x35')],'waiting':_0x45967c[_0x54bb('0x36')],'loggedInDb':_0x45967c['loggedInDb'],'dialActive':_0x45967c[_0x54bb('0x37')],'dialMethod':_0x45967c[_0x54bb('0x38')],'dialOriginateCallerIdName':_0x45967c[_0x54bb('0x39')],'dialOriginateCallerIdNumber':_0x45967c[_0x54bb('0x3a')],'dialOriginateTimeout':_0x45967c['dialOriginateTimeout'],'dialPrefix':_0x45967c[_0x54bb('0x3b')],'outboundAnswerAgiCallsDay':_0x45967c[_0x54bb('0x3c')],'outboundAnswerCallsDay':_0x45967c[_0x54bb('0x3d')],'outboundBlacklistCallsDay':_0x45967c[_0x54bb('0x3e')],'outboundBusyCallsDay':_0x45967c[_0x54bb('0x3f')],'outboundCongestionCallsDay':_0x45967c[_0x54bb('0x40')],'outboundDropCallsDayACS':_0x45967c['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x45967c[_0x54bb('0x41')],'outboundDropCallsDayTimeout':_0x45967c[_0x54bb('0x42')],'outboundNoAnswerCallsDay':_0x45967c[_0x54bb('0x43')],'outboundNoSuchCallsDay':_0x45967c['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x45967c[_0x54bb('0x44')],'outboundReCallsDay':_0x45967c[_0x54bb('0x45')],'outboundRejectCallsDay':_0x45967c[_0x54bb('0x46')],'outboundUnknownCallsDay':_0x45967c[_0x54bb('0x47')],'outboundAbandonedCallsDay':_0x45967c[_0x54bb('0x48')],'predictiveIntervalAnsweredCalls':_0x45967c[_0x54bb('0x49')],'predictiveIntervalAvgHoldtime':_0x45967c[_0x54bb('0x4a')],'predictiveIntervalAvgTalktime':_0x45967c[_0x54bb('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x45967c[_0x54bb('0x4c')],'predictiveIntervalDroppedCallsTimeout':_0x45967c[_0x54bb('0x4d')],'predictiveIntervalErlangCalls':_0x45967c[_0x54bb('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x45967c[_0x54bb('0x4f')],'predictiveIntervalHitRate':_0x45967c[_0x54bb('0x50')],'predictiveIntervalMultiplicativeFactor':_0x45967c[_0x54bb('0x51')],'predictiveIntervalPauses':_0x45967c[_0x54bb('0x52')],'predictiveIntervalAvailable':_0x45967c[_0x54bb('0x53')],'predictiveIntervalTotalCalls':_0x45967c['predictiveIntervalTotalCalls'],'message':_0x45967c[_0x54bb('0x54')],'originated':_0x45967c['originated'],'erlangCalls':_0x45967c['erlangCalls'],'erlangCallToSecond':_0x45967c[_0x54bb('0x55')],'erlangAbandonmentRate':_0x45967c['erlangAbandonmentRate'],'erlangBusyFactor':_0x45967c[_0x54bb('0x56')],'startPredictive':_0x45967c[_0x54bb('0x57')],'startProgressive':_0x45967c['startProgressive']};if(_0x45967c['Trunk']){_0x577a73[_0x54bb('0x58')]={'id':_0x45967c[_0x54bb('0x58')]['id'],'name':_0x45967c['Trunk'][_0x54bb('0x2a')],'active':_0x45967c[_0x54bb('0x58')]['active'],'callerid':_0x45967c[_0x54bb('0x58')][_0x54bb('0x59')]};}if(_0x45967c[_0x54bb('0x5a')]){_0x577a73[_0x54bb('0x5a')]={'id':_0x45967c[_0x54bb('0x5a')]['id'],'name':_0x45967c['Interval'][_0x54bb('0x2a')]};}var _0x5c15a0=md5(JSON['stringify'](_0x577a73));if(_0x45967c[_0x54bb('0x5b')]!==_0x5c15a0){_0x45967c[_0x54bb('0x5b')]=_0x5c15a0;emit(util[_0x54bb('0x5c')](_0x54bb('0x5d'),_0x577a73[_0x54bb('0x2a')]),_0x54bb('0x5e'),_0x577a73);}}}function emitVoiceQueueChannelRemove(_0x539d84){logger[_0x54bb('0x5f')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x539d84));emit(util['format'](_0x54bb('0x5d'),_0x539d84[_0x54bb('0x2a')]),_0x54bb('0x60'),_0x539d84);}function notSendMessagesQueue(_0x389e7e){if(_0x389e7e[_0x54bb('0x61')]){if(_0x389e7e[_0x54bb('0x62')]===0x0&&_0x389e7e['pTalking']===0x0){_0x389e7e[_0x54bb('0x61')]=![];_0x389e7e['available']=0x0;_0x389e7e['paused']=0x0;_0x389e7e[_0x54bb('0x54')]=_0x54bb('0x63');ut[_0x54bb('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x389e7e['name']+_0x54bb('0x65'));}else{_0x389e7e[_0x54bb('0x54')]='IS_DISACTIVED';ut[_0x54bb('0x64')](_0x54bb('0x66'),_0x389e7e[_0x54bb('0x2a')]+_0x54bb('0x67'));}emitCampaignPreview(_0x389e7e);}}Preview['prototype'][_0x54bb('0x27')]=function(){var _0x47ae46=this;setInterval(function(){_0x47ae46[_0x54bb('0x68')]();},0x7cf);};Preview[_0x54bb('0x10')][_0x54bb('0x68')]=function(){var _0x495dba=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x1400ef in _0x495dba){if(_0x495dba[_0x54bb('0x69')](_0x1400ef)&&(_0x495dba[_0x1400ef][_0x54bb('0x38')]===_0x54bb('0x7')||_0x495dba[_0x1400ef][_0x54bb('0x38')]==='booked')&&_0x495dba[_0x1400ef][_0x54bb('0x33')]==='outbound'){if(this[_0x54bb('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x54bb('0x6a')]();}}if(_0x495dba['hasOwnProperty'](_0x1400ef)&&_0x495dba[_0x1400ef][_0x54bb('0x38')]===_0x54bb('0x7')&&_0x495dba[_0x1400ef][_0x54bb('0x33')]===_0x54bb('0x29')){if(_0x495dba[_0x1400ef][_0x54bb('0x37')]){this[_0x54bb('0x6b')](_0x495dba[_0x1400ef]);this[_0x54bb('0x6c')](_0x495dba[_0x1400ef]);}else{notSendMessagesQueue(_0x495dba[_0x1400ef]);}}}};Preview['prototype'][_0x54bb('0x6d')]=function(_0x3bee77){var _0x865e0a=this;this[_0x54bb('0x13')][_0x54bb('0x11')](function(){if(!_['isNil'](_0x865e0a[_0x54bb('0x17')][_0x3bee77])){loggerAction[_0x54bb('0x5f')](_0x54bb('0x6e'),_0x3bee77,_0x54bb('0x6f'),_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x70')],'originated:\x20',JSON[_0x54bb('0x71')](_0x865e0a['campaignsPreview'][_0x865e0a['actions'][_0x3bee77][_0x54bb('0x70')]]['originated']),'pTalking:\x20',JSON[_0x54bb('0x71')](_0x865e0a[_0x54bb('0x14')][_0x865e0a[_0x54bb('0x17')][_0x3bee77]['queue']][_0x54bb('0x2f')]),JSON[_0x54bb('0x71')](_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x72')]),JSON[_0x54bb('0x71')](_['pick'](_0x865e0a[_0x54bb('0x17')][_0x3bee77],['contactId',_0x54bb('0x73'),'VoiceQueueId','ListId'])));return ami[_0x54bb('0x74')]({'action':_0x54bb('0x75'),'channel':_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x76')]})[_0x54bb('0x77')](function(_0x3a6fb8){if(_0x3a6fb8[_0x54bb('0x54')]===_0x54bb('0x78')){setTimeout(function(){if(_0x865e0a['actions'][_0x3bee77]){ut[_0x54bb('0x79')](_0x865e0a[_0x54bb('0x14')][_0x865e0a[_0x54bb('0x17')][_0x3bee77]['queue']],'[clearZombieChannel]');if(_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x72')]===!![]){ut[_0x54bb('0x7a')](_0x865e0a[_0x54bb('0x14')][_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x70')]],_0x54bb('0x7b'));ut[_0x54bb('0x7c')](_0x54bb('0x7d')+_0x3bee77,_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x70')]);}ut[_0x54bb('0x7c')](_0x54bb('0x7e')+_0x3bee77,_0x865e0a[_0x54bb('0x17')][_0x3bee77][_0x54bb('0x70')]);delete _0x865e0a[_0x54bb('0x17')][_0x3bee77];}},0x2328);}});}});};Preview[_0x54bb('0x10')][_0x54bb('0x6a')]=function(){var _0x212e34=this;loggerAction['info']('[action]',_[_0x54bb('0x7f')](this[_0x54bb('0x17')]));for(var _0x511d09 in this[_0x54bb('0x17')]){if(_0x212e34['actions']['hasOwnProperty'](_0x511d09)){_0x212e34[_0x54bb('0x6d')](_0x511d09);}}};Preview[_0x54bb('0x10')]['recallMe']=function(_0x21b1d6){var _0x1e21e6=this;rpcDb[_0x54bb('0x80')](_0x21b1d6['id'],ut[_0x54bb('0x81')](this[_0x54bb('0x18')]))[_0x54bb('0x82')](function(_0x147673){if(!_[_0x54bb('0x83')](_0x147673)){for(var _0x497fee=0x0;_0x497fee<_0x147673[_0x54bb('0x84')];_0x497fee+=0x1){if(ut[_0x54bb('0x85')](_0x147673[_0x497fee][_0x54bb('0x86')])<_0x21b1d6[_0x54bb('0x87')]*0x3c){if(_0x147673[_0x497fee][_0x54bb('0x88')]&&!_0x147673[_0x497fee]['Agent'][_0x54bb('0x89')]){_0x1e21e6['run'](_0x147673[_0x497fee]['id'])[_0x54bb('0x82')](ut['logger2']('[RecallMe]'))['catch'](ut[_0x54bb('0x8a')](_0x54bb('0x8b')));}else{rpcDb[_0x54bb('0x8c')](_0x147673[_0x497fee]['id']);}}else{var _0x3530fc=new Action(_0x147673[_0x497fee],_0x21b1d6);_0x3530fc['starttime']=moment()[_0x54bb('0x5c')](_0x54bb('0x8d'));_0x21b1d6['outboundReCallsDay']+=0x1;ut[_0x54bb('0x8e')](_0x3530fc,0x17,_0x54bb('0x8f'));if(_0x21b1d6[_0x54bb('0x90')]){rpcDb['rescheduleContactInQueue'](ut[_0x54bb('0x91')](_0x147673[_0x497fee]));rpcDb[_0x54bb('0x92')](_0x3530fc,_0x54bb('0x93'));}else{ut[_0x54bb('0x8e')](_0x3530fc,0x16,_0x54bb('0x94'));rpcDb[_0x54bb('0x92')](_0x3530fc,_0x54bb('0x95'));rpcDb[_0x54bb('0x96')](_0x3530fc,_0x54bb('0x95'));}}}}})[_0x54bb('0x77')](ut[_0x54bb('0x8a')](_0x54bb('0x97')));};Preview[_0x54bb('0x10')][_0x54bb('0x6b')]=function(_0x28fcd0){_0x28fcd0['sendMessageOneNotActive']=!![];if(ut[_0x54bb('0x98')](_0x28fcd0[_0x54bb('0x2e')])){_0x28fcd0['message']=_0x54bb('0x99');}else if(!ut[_0x54bb('0x9a')](_0x28fcd0['dialActive'])){_0x28fcd0[_0x54bb('0x54')]='NOT_ACTIVE';}else if(!this[_0x54bb('0x9b')](_0x28fcd0[_0x54bb('0x58')])){if(!this[_0x54bb('0x9b')](_0x28fcd0[_0x54bb('0x9c')])){_0x28fcd0[_0x54bb('0x54')]=_0x54bb('0x9d');}else{_0x28fcd0[_0x54bb('0x54')]=_0x54bb('0x9e');}}else{_0x28fcd0[_0x54bb('0x54')]=_0x54bb('0x9e');}emitCampaignPreview(_0x28fcd0);};Preview[_0x54bb('0x10')][_0x54bb('0x9f')]=function(_0x567f4b,_0x459f92,_0x5b0941){var _0x589569=this;var _0x1c7182=this[_0x54bb('0x17')][_0x459f92];var _0x56cacd=this[_0x54bb('0x14')][_0x1c7182[_0x54bb('0x70')]];var _0x4db774;if(_0x56cacd){switch(_0x5b0941){case'1':_0x56cacd[_0x54bb('0xa0')]+=0x1;_0x1c7182[_0x54bb('0xa1')]+=0x1;_0x1c7182[_0x54bb('0xa2')]=ut[_0x54bb('0xa3')](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0x0,_0x54bb('0xa4'));ami[_0x54bb('0x28')](_0x54bb('0xa5'),ut['buildObj'](_0x1c7182,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x1c7182,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut['cloneAction'](_0x1c7182,0xf,_0x54bb('0xa7'));rpcDb[_0x54bb('0x96')](_0x4db774,_0x54bb('0xa8'));}else{if(_0x1c7182['countnosuchnumberretry']>=_0x56cacd['dialNoSuchNumberMaxRetry']){rpcDb[_0x54bb('0x96')](_0x1c7182,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x54bb('0xa9')](ut[_0x54bb('0xaa')](_0x1c7182,'countnosuchnumberretry',_0x56cacd[_0x54bb('0xab')]),_0x1c7182[_0x54bb('0xac')],_0x1c7182[_0x54bb('0xad')]);}}delete this[_0x54bb('0x17')][_0x567f4b[_0x54bb('0xae')]];break;case _0x54bb('0xaf'):var _0x25d176=moment()[_0x54bb('0x5c')](_0x54bb('0x8d'));_0x1c7182[_0x54bb('0xb0')]=_0x25d176;_0x1c7182[_0x54bb('0xb1')]=_0x25d176;_0x1c7182[_0x54bb('0x72')]=!![];_0x56cacd[_0x54bb('0x2f')]+=0x1;logger['info'](_0x54bb('0xb2'),_0x1c7182[_0x54bb('0xb3')],'\x20Queue',_0x56cacd['name'],_0x54bb('0xb4'),_0x56cacd[_0x54bb('0x2f')]);ami['emit']('custom:agentconnect',ut['buildObj'](_0x1c7182,'connect'));if(_0x56cacd['acw']){ami['emit'](_0x54bb('0xb5'),ut[_0x54bb('0xb6')](_0x1c7182));}break;case'16':ami['emit'](_0x54bb('0xb7'),ut['buildObj'](_0x1c7182,'complete'));emitVoiceQueueChannelRemove(ut[_0x54bb('0xb8')](_0x1c7182,_0x54bb('0xb9')));_0x56cacd[_0x54bb('0x3d')]+=0x1;_0x56cacd[_0x54bb('0xba')]+=0x1;_0x56cacd[_0x54bb('0x2c')]+=0x1;ut[_0x54bb('0x7a')](_0x56cacd,_0x54bb('0xbb'));_0x1c7182['countglobal']=ut['totalGlobal'](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0x4,'Answer');rpcDb[_0x54bb('0x92')](_0x1c7182,_0x54bb('0xbc'));rpcDb[_0x54bb('0x96')](_0x1c7182,_0x54bb('0xbd'));rpcDb[_0x54bb('0xbe')](_0x1c7182);_0x56cacd[_0x54bb('0x31')]+=_0x1c7182['talktime'];_0x56cacd[_0x54bb('0x30')]+=_0x1c7182['talktime'];logger[_0x54bb('0x5f')](_0x54bb('0xbf'),_0x1c7182[_0x54bb('0xb3')],_0x54bb('0xc0'),_0x56cacd['name'],_0x54bb('0xb4'),_0x56cacd[_0x54bb('0x2f')]);delete this[_0x54bb('0x17')][_0x567f4b[_0x54bb('0xae')]];break;case _0x54bb('0xc1'):_0x56cacd['outboundBusyCallsDay']+=0x1;_0x1c7182[_0x54bb('0xc2')]+=0x1;_0x1c7182[_0x54bb('0xa2')]=ut['totalGlobal'](_0x1c7182);ut['logCustomer'](_0x1c7182,0x5,'Busy');ami['emit']('custom:agentbusy',ut[_0x54bb('0xb8')](_0x1c7182,_0x54bb('0xc3')));rpcDb['createCustomerHistory'](_0x1c7182,_0x54bb('0xc4'));if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0xf,_0x54bb('0xa7'));rpcDb['createCustomerFinal'](_0x4db774,_0x54bb('0xc6'));}else{if(_0x1c7182[_0x54bb('0xc2')]>=_0x56cacd[_0x54bb('0xc7')]){rpcDb[_0x54bb('0x96')](_0x1c7182,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x54bb('0xa9')](ut[_0x54bb('0xaa')](_0x1c7182,'countbusyretry',_0x56cacd[_0x54bb('0xc8')]),_0x1c7182[_0x54bb('0xac')],_0x1c7182['activeContact']);}}break;case _0x54bb('0xc9'):_0x56cacd[_0x54bb('0x43')]+=0x1;_0x1c7182[_0x54bb('0xca')]+=0x1;_0x1c7182['countglobal']=ut[_0x54bb('0xa3')](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0x3,_0x54bb('0xcb'));ami['emit']('custom:agentnoanswer',ut['buildObj'](_0x1c7182,'noanswer'));rpcDb[_0x54bb('0x92')](_0x1c7182,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0xf,_0x54bb('0xa7'));rpcDb[_0x54bb('0x96')](_0x4db774,_0x54bb('0xcc'));}else{if(_0x1c7182[_0x54bb('0xca')]>=_0x56cacd[_0x54bb('0xcd')]){rpcDb[_0x54bb('0x96')](_0x1c7182,_0x54bb('0xce'));}else{rpcDb[_0x54bb('0xa9')](ut[_0x54bb('0xaa')](_0x1c7182,_0x54bb('0xca'),_0x56cacd[_0x54bb('0xcf')]),_0x1c7182['unlockAgent'],_0x1c7182[_0x54bb('0xad')]);}}break;case'CONGESTION':_0x56cacd[_0x54bb('0x40')]+=0x1;_0x1c7182[_0x54bb('0xd0')]+=0x1;_0x1c7182['countglobal']=ut[_0x54bb('0xa3')](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0x8,'Congestion');ami[_0x54bb('0x28')]('custom:agentcongestion',ut[_0x54bb('0xb8')](_0x1c7182,_0x54bb('0xd1')));rpcDb['createCustomerHistory'](_0x1c7182,_0x54bb('0xd2'));if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0xf,_0x54bb('0xa7'));rpcDb[_0x54bb('0x96')](_0x4db774,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1c7182[_0x54bb('0xd0')]>=_0x56cacd[_0x54bb('0xd3')]){rpcDb['createCustomerFinal'](_0x1c7182,_0x54bb('0xd2'));}else{rpcDb[_0x54bb('0xa9')](ut[_0x54bb('0xaa')](_0x1c7182,'countcongestionretry',_0x56cacd[_0x54bb('0xc8')]),_0x1c7182[_0x54bb('0xac')],_0x1c7182[_0x54bb('0xad')]);}}break;case _0x54bb('0xd4'):_0x56cacd[_0x54bb('0x46')]+=0x1;_0x1c7182[_0x54bb('0xd5')]+=0x1;_0x1c7182[_0x54bb('0xa2')]=ut[_0x54bb('0xa3')](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0x14,_0x54bb('0xd6'));ami[_0x54bb('0x28')](_0x54bb('0xd7'),ut['buildObj'](_0x1c7182,_0x54bb('0xd8')));rpcDb[_0x54bb('0x92')](_0x1c7182,_0x54bb('0xd9'));if(ut['totalGlobal'](_0x1c7182)>=_0x56cacd['dialGlobalMaxRetry']){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0x14,_0x54bb('0xd6'));rpcDb[_0x54bb('0x96')](_0x4db774,_0x54bb('0xda'));}else{if(_0x1c7182[_0x54bb('0xd5')]>=_0x56cacd[_0x54bb('0xdb')]){rpcDb[_0x54bb('0x96')](_0x1c7182,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x54bb('0xa9')](ut['scheduledAt'](_0x1c7182,_0x54bb('0xd5'),_0x56cacd[_0x54bb('0xdc')]),_0x1c7182['unlockAgent'],_0x1c7182[_0x54bb('0xad')]);}}break;case _0x54bb('0xdd'):_0x56cacd[_0x54bb('0x48')]+=0x1;_0x1c7182[_0x54bb('0xde')]+=0x1;_0x1c7182['countglobal']=ut['totalGlobal'](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0xb,'Abandoned');rpcDb[_0x54bb('0x92')](_0x1c7182,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0xf,_0x54bb('0xa7'));rpcDb[_0x54bb('0x96')](_0x4db774,_0x54bb('0xdf'));}else{if(_0x1c7182[_0x54bb('0xe0')]>=_0x56cacd[_0x54bb('0xe1')]){rpcDb[_0x54bb('0x96')](_0x1c7182,_0x54bb('0xdf'));}else{rpcDb[_0x54bb('0xa9')](ut['scheduledAt'](_0x1c7182,_0x54bb('0xde'),_0x56cacd[_0x54bb('0xe2')]),_0x1c7182['unlockAgent'],_0x1c7182[_0x54bb('0xad')]);}}break;default:if(_0x1c7182[_0x54bb('0x72')]){ut[_0x54bb('0x7a')](_0x56cacd,_0x54bb('0xe3'));ut[_0x54bb('0x7c')](_0x54bb('0xe4')+_0x56cacd['name'],_0x567f4b);}_0x56cacd[_0x54bb('0x47')]+=0x1;_0x1c7182['countglobal']=ut[_0x54bb('0xa3')](_0x1c7182);ut[_0x54bb('0x8e')](_0x1c7182,0xc,_0x567f4b['cause-txt']||_0x567f4b[_0x54bb('0xe5')]);rpcDb[_0x54bb('0x92')](_0x1c7182,_0x54bb('0xe6'));if(ut[_0x54bb('0xa3')](_0x1c7182)>=_0x56cacd[_0x54bb('0xa6')]){_0x4db774=ut[_0x54bb('0xc5')](_0x1c7182,0xf,'Global');rpcDb['createCustomerFinal'](_0x4db774,_0x54bb('0xe7'));}else{rpcDb[_0x54bb('0x96')](_0x1c7182,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x567f4b[_0x54bb('0xae')]];}if(!(_0x1c7182[_0x54bb('0x72')]&&_0x5b0941==='16')){ut[_0x54bb('0x79')](_0x56cacd,_0x54bb('0xe8'));logger[_0x54bb('0x5f')](_0x54bb('0xe9'),_0x1c7182[_0x54bb('0xb3')],_0x54bb('0xc0'),_0x56cacd[_0x54bb('0x2a')],_0x54bb('0xea'),_0x56cacd['originated']);}if(_0x5b0941!==_0x54bb('0xaf')){delete this['actions'][_0x567f4b[_0x54bb('0xae')]];delete this[_0x54bb('0x17')][_0x567f4b[_0x54bb('0xeb')]];}}};Preview[_0x54bb('0x10')][_0x54bb('0xec')]=function(_0x5d6727,_0x5a32c9,_0x54e05e){if(_['isUndefined'](_0x5a32c9)&&'object'!==typeof _0x5a32c9){return;}if(_[_0x54bb('0xed')](_0x54e05e)&&_0x54bb('0xee')!==typeof _0x54e05e){return;}switch(_0x54e05e['reason']){case'0':ut[_0x54bb('0xef')](_0x5d6727,0x0,_0x54bb('0xa4'));rpcDb[_0x54bb('0xf0')](_0x5d6727,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x54bb('0xef')](_0x5d6727,0x3,_0x54bb('0xcb'));rpcDb[_0x54bb('0xf0')](_0x5d6727,_0x54bb('0xf1'));break;case'5':ut[_0x54bb('0xef')](_0x5d6727,0x5,_0x54bb('0xf2'));rpcDb['createAgentHistory'](_0x5d6727,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x54bb('0xef')](_0x5d6727,0x8,_0x54bb('0xf3'));rpcDb[_0x54bb('0xf0')](_0x5d6727,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x5d6727,0x16,_0x54bb('0xf4'));rpcDb[_0x54bb('0xf0')](_0x5d6727,_0x54bb('0xf5'));break;default:ut['logAgent'](_0x5d6727,0xc,_0x54e05e[_0x54bb('0xf6')]);rpcDb[_0x54bb('0xf0')](_0x5d6727,_0x54bb('0xf7'));}ut[_0x54bb('0x79')](_0x5a32c9,_0x54bb('0xf8'));logger['info'](_0x54bb('0xf9'),_0x5d6727['uniqueid'],'\x20Queue',_0x5a32c9['name'],_0x54bb('0xea'),_0x5a32c9[_0x54bb('0x62')]);delete this['actions'][_0x5d6727[_0x54bb('0xb3')]];};Preview[_0x54bb('0x10')][_0x54bb('0xfa')]=function(_0x897d38,_0x448c4c,_0x319bfe,_0x16652e,_0x4f79e8){var _0x83729=this;return new BPromise(function(_0xe2830,_0x593344){if(_[_0x54bb('0x83')](_0x448c4c)||_[_0x54bb('0x83')](_0x448c4c[_0x54bb('0xfb')])||_[_0x54bb('0x83')](_0x448c4c['Contact'][_0x54bb('0xfc')])||_[_0x54bb('0x83')](_0x448c4c[_0x54bb('0xfd')])){_0x593344(ut['message']('Contact\x20is\x20undefined',_0x16652e,_0x4f79e8));return;}var _0xe78ec6=uuid['v4']();var _0x518c0b=_0x83729[_0x54bb('0x14')][_0x448c4c[_0x54bb('0x6f')][_0x54bb('0x2a')]];var _0x553a8e=_0x319bfe?_0x83729[_0x54bb('0x18')][_0x319bfe]['id']:undefined;_0x83729[_0x54bb('0x17')][_0xe78ec6]=new Action(_0x448c4c,_0x518c0b,_0xe78ec6,_0x319bfe,_0x553a8e);var _0x472e8e=_0x83729[_0x54bb('0x17')][_0xe78ec6];_0x472e8e['unlockAgent']=_0x16652e;_0x472e8e[_0x54bb('0xad')]=_0x4f79e8;_0x472e8e[_0x54bb('0xfe')]=_0x319bfe;if(_['isEmpty'](_0x897d38)){_0x83729[_0x54bb('0xff')](_0x472e8e,_0x518c0b,_0x448c4c,_0x319bfe)[_0x54bb('0x82')](function(_0x25b10b){logger['info'](_0x54bb('0x100'),_0x54bb('0x101')+_0x472e8e[_0x54bb('0x70')]+_0x54bb('0x102')+_0x472e8e['idContact'],JSON[_0x54bb('0x71')](_0x25b10b));ami['emit'](_0x54bb('0x103'),ut[_0x54bb('0xb8')](_0x472e8e,_0x54bb('0x104')));_0xe2830(ut[_0x54bb('0x54')](_0x54bb('0x105')));})['catch'](function(_0x1b6843){ut[_0x54bb('0x64')](_0x54bb('0x106'),_0x1b6843);_0x593344(ut[_0x54bb('0x54')](_0x54bb('0x107'),_0x16652e,_0x4f79e8));});}else{_0x518c0b[_0x54bb('0x3e')]+=0x1;ut['logBlacklist'](_0x472e8e);rpcDb['createHistory'](_0x472e8e,_0x54bb('0x108'));delete _0x83729[_0x54bb('0x17')][_0xe78ec6];_0x593344(ut[_0x54bb('0x54')](_0x54bb('0x109'),_0x16652e,_0x4f79e8));}});};Preview[_0x54bb('0x10')]['isTrunkReachable']=function(_0x3e7f15){return!_[_0x54bb('0x83')](_0x3e7f15)&&!_[_0x54bb('0x83')](_0x3e7f15['name'])&&!_[_0x54bb('0x83')](_0x3e7f15['active'])&&_0x3e7f15[_0x54bb('0x10a')]&&!_[_0x54bb('0x83')](this['trunks'][util[_0x54bb('0x5c')](_0x54bb('0x10b'),_0x3e7f15[_0x54bb('0x2a')])])&&!_['isNil'](this[_0x54bb('0x16')][util[_0x54bb('0x5c')]('SIP/%s',_0x3e7f15[_0x54bb('0x2a')])]['status'])&&(this[_0x54bb('0x16')][util[_0x54bb('0x5c')](_0x54bb('0x10b'),_0x3e7f15[_0x54bb('0x2a')])][_0x54bb('0x75')]===_0x54bb('0x10c')||this[_0x54bb('0x16')][util[_0x54bb('0x5c')](_0x54bb('0x10b'),_0x3e7f15[_0x54bb('0x2a')])]['status']==='unmonitored');};Preview[_0x54bb('0x10')][_0x54bb('0x10d')]=function(_0x4c406c,_0xf8933d){var _0x2f0e69=this;return new BPromise(function(_0x44040a,_0x449af3){_0x2f0e69[_0x54bb('0x10e')](_0x4c406c,_0xf8933d)['then'](function(_0x2e7329){_0x44040a(_[_0x54bb('0x10f')](_0x2e7329,[_0x54bb('0x54')]));})['catch'](function(_0x200d12){if(_0x200d12[_0x54bb('0x110')]){rpcDb[_0x54bb('0x111')](_0x4c406c);}if(_0x200d12['active']){rpcDb['disableContact'](_0x4c406c);}_0x449af3(_[_0x54bb('0x10f')](_0x200d12,[_0x54bb('0x54')]));});});};Preview[_0x54bb('0x10')][_0x54bb('0x10e')]=function(_0x4e302b,_0x1c6680){var _0x4f40c6=this;return new BPromise(function(_0x4d2da9,_0x1004b3){var _0x1996ee,_0x5d9ebf;rpcDb['getContactPreview'](_0x4e302b)[_0x54bb('0x82')](function(_0x74c9ba){if(!_['isNil'](_0x74c9ba[0x0])){_0x5d9ebf=_0x74c9ba[0x0]['recallme']?![]:!![];_0x1996ee=_0x74c9ba[0x0][_0x54bb('0x112')]?!![]:![];_0x1996ee=_0x1c6680?!![]:_0x1996ee;}var _0x272f93=_0x4f40c6[_0x54bb('0x113')](_0x74c9ba);if(_0x272f93[_0x54bb('0x114')]){rpcDb[_0x54bb('0x115')](_['pick'](_0x74c9ba[0x0],['VoiceQueueId','Contact.phone']))[_0x54bb('0x82')](function(_0x2034a2){_0x4f40c6[_0x54bb('0xfa')](_0x2034a2,_0x74c9ba[0x0],_0x1c6680,_0x5d9ebf,_0x1996ee)[_0x54bb('0x82')](function(_0x4b013d){_0x4d2da9(_0x4b013d);})[_0x54bb('0x77')](function(_0x3c4fe5){_0x1004b3(_0x3c4fe5);});})[_0x54bb('0x77')](function(_0x4b6eaf){ut[_0x54bb('0x64')](_0x54bb('0x116'),_0x4b6eaf);_0x1004b3(ut[_0x54bb('0x54')]('Call\x20unsuccessful',_0x5d9ebf,_0x1996ee));});}else{_0x1004b3(ut[_0x54bb('0x54')](_0x272f93[_0x54bb('0x54')],_0x5d9ebf,_0x1996ee));}})[_0x54bb('0x77')](function(_0xd5bf15){ut['logger'](_0x54bb('0x117'),_0xd5bf15);_0x1004b3(ut['message'](_0x54bb('0x118'),![],!![]));});});};Preview[_0x54bb('0x10')][_0x54bb('0x113')]=function(_0x4a6617){if(_[_0x54bb('0x83')](_0x4a6617)||_[_0x54bb('0x119')](_0x4a6617)||!_[_0x54bb('0x83')](_0x4a6617[0x0][_0x54bb('0x88')])&&_[_0x54bb('0x83')](_0x4a6617[0x0][_0x54bb('0x88')][_0x54bb('0x2a')])){ut[_0x54bb('0x64')]('[Preview][validateContact][Empty\x20Contact]',_0x4a6617);return{'isValid':![],'message':_0x54bb('0x11a')};}var _0x107d7d=this[_0x54bb('0x14')][_0x4a6617[0x0][_0x54bb('0x6f')][_0x54bb('0x2a')]];_0x107d7d[_0x54bb('0x54')]=_0x54bb('0x9e');if(_[_0x54bb('0x83')](_0x107d7d)){ut[_0x54bb('0x64')](_0x54bb('0x11b'),_0x107d7d);return{'isValid':![],'message':_0x54bb('0x11c')};}if(!this['isTrunkReachable'](_0x107d7d[_0x54bb('0x58')])){ut[_0x54bb('0x64')](_0x54bb('0x11d'),'campaign\x20Name:\x20'+_0x107d7d[_0x54bb('0x2a')]+_0x54bb('0x11e'));if(!this[_0x54bb('0x9b')](_0x107d7d[_0x54bb('0x9c')])){ut['logger'](_0x54bb('0x11d'),_0x107d7d[_0x54bb('0x2a')]+_0x54bb('0x11f'));return{'isValid':![],'message':_0x54bb('0x120')};}}if(!ut[_0x54bb('0x9a')](_0x107d7d['dialActive'])){ut[_0x54bb('0x64')](_0x54bb('0x121'),_0x107d7d['name']+_0x54bb('0x122'));return{'isValid':![],'message':_0x54bb('0x123')+_0x107d7d[_0x54bb('0x2a')]+_0x54bb('0x122')};}return{'isValid':!![],'message':_0x54bb('0x124')};};Preview[_0x54bb('0x10')][_0x54bb('0xff')]=function(_0x1d942e,_0x281f37,_0x215b68,_0x9e7677){var _0xc417b8=this;return new BPromise(function(_0x55a4b1,_0x483bc8){var _0x2918ac=_0x1d942e[_0x54bb('0xb3')];var _0x597ab6=_0xc417b8[_0x54bb('0x9b')](_0x281f37[_0x54bb('0x58')])?util['format'](_0x54bb('0x125'),_0x281f37[_0x54bb('0x58')][_0x54bb('0x2a')],_[_0x54bb('0x83')](_0x281f37[_0x54bb('0x3b')])?'':_0x281f37[_0x54bb('0x3b')][_0x54bb('0x126')]()||'',_0x281f37['dialCutDigit']>0x0?_0x215b68[_0x54bb('0xfb')][_0x54bb('0xfc')][_0x54bb('0x127')](_0x281f37[_0x54bb('0x128')]):_0x215b68['Contact'][_0x54bb('0xfc')]):util[_0x54bb('0x5c')](_0x54bb('0x125'),_['isNil'](_0x281f37[_0x54bb('0x9c')])?_0x281f37['Trunk'][_0x54bb('0x2a')]:_0x281f37[_0x54bb('0x9c')][_0x54bb('0x2a')],_[_0x54bb('0x83')](_0x281f37['dialPrefix'])?'':_0x281f37[_0x54bb('0x3b')]['trim']()||'',_0x281f37[_0x54bb('0x128')]>0x0?_0x215b68['Contact'][_0x54bb('0xfc')][_0x54bb('0x127')](_0x281f37['dialCutDigit']):_0x215b68[_0x54bb('0xfb')][_0x54bb('0xfc')]);var _0x138d05=_0xc417b8[_0x54bb('0x9b')](_0x281f37[_0x54bb('0x58')])?ut[_0x54bb('0x129')](_0x281f37[_0x54bb('0x58')][_0x54bb('0x59')],_0x281f37[_0x54bb('0x39')],_0x281f37['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x281f37[_0x54bb('0x3a')],_0x281f37[_0x54bb('0x12a')]):_0x281f37[_0x54bb('0x3a')]):ut[_0x54bb('0x129')](_['isNil'](_0x281f37[_0x54bb('0x9c')])?_0x281f37[_0x54bb('0x58')][_0x54bb('0x59')]:_0x281f37['TrunkBackup'][_0x54bb('0x59')],_0x281f37[_0x54bb('0x39')],_0x281f37[_0x54bb('0x12a')]>0x0?ut['getCallerIdRandom'](_0x281f37[_0x54bb('0x3a')],_0x281f37[_0x54bb('0x12a')]):_0x281f37['dialOriginateCallerIdNumber']);if(_0x138d05){_0x1d942e[_0x54bb('0x12b')]=ut['extractCalleridName'](_0x138d05);_0x1d942e['originatecalleridnum']=ut['extractCalleridNumber'](_0x138d05);}var _0x15275f=ut[_0x54bb('0x12c')](_0x281f37,_0x215b68,_0x597ab6,_0x138d05,_0x2918ac,_0x1d942e);_[_0x54bb('0x12d')](_0x1d942e,ut[_0x54bb('0x12e')](_0x15275f));_0x1d942e['starttime']=moment()[_0x54bb('0x5c')](_0x54bb('0x8d'));ami['Action'](ut[_0x54bb('0x12f')](_0x1d942e,_0x281f37,_0x15275f,_0x1d942e[_0x54bb('0xad')],_0x9e7677))['then'](function(_0x1272f){_0x281f37['originated']+=0x1;logger[_0x54bb('0x5f')](_0x54bb('0x130'),_0x2918ac,_0x54bb('0xc0'),_0x281f37['name'],_0x54bb('0xea'),_0x281f37[_0x54bb('0x62')]);_0x55a4b1(_0x1272f);})[_0x54bb('0x77')](function(_0x561602){ut[_0x54bb('0xef')](_0x1d942e,0xe,_0x54bb('0x131'));rpcDb[_0x54bb('0xf0')](_0x1d942e,_0x54bb('0x132'));_0x483bc8(_0x561602);});});};Preview[_0x54bb('0x10')]['syncNewExten']=function(_0x359387){if(this['actions'][_0x359387['linkedid']]){this[_0x54bb('0x17')][_0x359387['linkedid']][_0x54bb('0x76')]=_0x359387[_0x54bb('0x76')];}};Preview['prototype'][_0x54bb('0x1a')]=function(_0x40f0e2){var _0x485f8c=this;var _0x4276e7=this['actions'][_0x40f0e2[_0x54bb('0x133')]];if(_0x4276e7){if(_0x4276e7['lookAgent']&&this[_0x54bb('0x18')][_0x4276e7[_0x54bb('0xfe')]]){ut['logLookAgent'](_0x4276e7,this[_0x54bb('0x18')][_0x4276e7[_0x54bb('0xfe')]][_0x54bb('0x2a')],this[_0x54bb('0x18')][_0x4276e7[_0x54bb('0xfe')]]['id']);}var _0x3c45e5=_[_0x54bb('0x134')](_0x4276e7);_0x3c45e5['responsetime']=moment()[_0x54bb('0x5c')](_0x54bb('0x8d'));var _0x409bcb=_0x485f8c[_0x54bb('0x14')][_0x4276e7[_0x54bb('0x70')]];if(ut[_0x54bb('0x135')](_0x40f0e2['response'])){if(_0x4276e7[_0x54bb('0xac')]){rpcDb[_0x54bb('0x111')](_0x4276e7[_0x54bb('0x136')]);}if(_0x4276e7['activeContact']){rpcDb[_0x54bb('0x8c')](_0x4276e7['idContact']);}ami[_0x54bb('0x28')]('custom:agentringnoanswer',ut[_0x54bb('0xb8')](_0x4276e7,_0x54bb('0x137')));this[_0x54bb('0xec')](_0x3c45e5,_0x409bcb,_0x40f0e2);}else{_0x4276e7[_0x54bb('0x138')]=moment()[_0x54bb('0x5c')](_0x54bb('0x8d'));ut[_0x54bb('0xef')](_0x3c45e5,0x4,_0x54bb('0x139'));rpcDb['createAgentHistory'](_0x3c45e5,_0x54bb('0x13a'));}}};Preview['prototype']['syncHangup']=function(_0x530e06){var _0x5100fd=this;var _0x13e224=this[_0x54bb('0x17')][_0x530e06['linkedid']];var _0x273f06;if(_0x13e224){_0x273f06=this['campaignsPreview'][_0x13e224['queue']];logger['info'](_0x54bb('0x13b'),_0x530e06[_0x54bb('0xae')],_0x54bb('0xc0'),_0x273f06[_0x54bb('0x2a')],_0x54bb('0xb4'),_0x273f06['pTalking']);}if(this[_0x54bb('0x17')][_0x530e06['linkedid']]&&_0x530e06['linkedid']!==_0x530e06['uniqueid']){if(_0x530e06[_0x54bb('0x13c')]==='16'&&this['actions'][_0x530e06['linkedid']][_0x54bb('0x72')]){this['callProgressDetectingCustomer'](_0x530e06,_0x530e06[_0x54bb('0xae')],_0x530e06['cause']);}else if(this[_0x54bb('0x17')][_0x530e06[_0x54bb('0xae')]][_0x54bb('0x72')]){logger[_0x54bb('0x5f')](_0x54bb('0x13d'),_0x530e06[_0x54bb('0xae')],_0x530e06[_0x54bb('0x13c')],_0x54bb('0xc0'),_0x273f06[_0x54bb('0x2a')],_0x54bb('0xb4'),_0x273f06[_0x54bb('0x2f')]);this['callProgressDetectingCustomer'](_0x530e06,_0x530e06[_0x54bb('0xae')],_0x530e06['cause']);}}else if(_0x13e224&&_[_0x54bb('0x83')](_0x13e224[_0x54bb('0x13e')])&&_0x273f06[_0x54bb('0x13f')]&&_0x530e06[_0x54bb('0xae')]===_0x530e06[_0x54bb('0xb3')]&&_[_0x54bb('0x83')](_0x530e06[_0x54bb('0xf6')])&&_0x530e06[_0x54bb('0x13c')]==='16'&&_0x530e06[_0x54bb('0x140')]==='6'&&_['isUndefined'](_0x13e224[_0x54bb('0x141')])){if(_0x13e224['unlockAgent']){rpcDb[_0x54bb('0x111')](_0x13e224[_0x54bb('0x136')]);}if(_0x13e224[_0x54bb('0xad')]){rpcDb['disableContact'](_0x13e224[_0x54bb('0x136')]);}_0x530e06[_0x54bb('0xf6')]='22';this['callProgressDetectingAgent'](_0x13e224,_0x273f06,_0x530e06);}else if(_0x13e224&&_0x13e224[_0x54bb('0x141')]){if(_0x530e06['cause']==='16'&&this[_0x54bb('0x17')][_0x530e06[_0x54bb('0xae')]][_0x54bb('0x72')]){logger[_0x54bb('0x5f')](_0x54bb('0x142'),_0x530e06['linkedid'],_0x530e06[_0x54bb('0x13c')],'\x20Queue',_0x273f06[_0x54bb('0x2a')],'pTalking:\x20',_0x273f06['pTalking']);this[_0x54bb('0x9f')](_0x530e06,_0x530e06[_0x54bb('0xae')],_0x530e06[_0x54bb('0x13c')]);}else if(this[_0x54bb('0x17')][_0x530e06[_0x54bb('0xae')]][_0x54bb('0x72')]){logger[_0x54bb('0x5f')](_0x54bb('0x13d'),_0x530e06['linkedid'],_0x530e06[_0x54bb('0x13c')],_0x54bb('0xc0'),_0x273f06[_0x54bb('0x2a')],_0x54bb('0xb4'),_0x273f06[_0x54bb('0x2f')]);this['callProgressDetectingCustomer'](_0x530e06,_0x530e06['linkedid'],_0x530e06[_0x54bb('0x13c')]);}}};Preview['prototype'][_0x54bb('0x143')]=function(_0x10c0c3){if(this[_0x54bb('0x17')][_0x10c0c3['destlinkedid']]&&_0x10c0c3[_0x54bb('0xeb')]!==_0x10c0c3[_0x54bb('0x144')]){this['callProgressDetectingCustomer'](_0x10c0c3,_0x10c0c3[_0x54bb('0xeb')],_0x10c0c3[_0x54bb('0xe5')]);}};Preview[_0x54bb('0x10')][_0x54bb('0x1d')]=function(_0x132aa7){if(this['actions'][_0x132aa7[_0x54bb('0xae')]]&&_0x132aa7[_0x54bb('0xae')]!==_0x132aa7[_0x54bb('0xb3')]&&!this[_0x54bb('0x17')][_0x132aa7[_0x54bb('0xae')]][_0x54bb('0x72')]){if(_0x132aa7[_0x54bb('0x13c')]==='1'){this['callProgressDetectingCustomer'](_0x132aa7,_0x132aa7[_0x54bb('0xae')],_0x132aa7[_0x54bb('0x13c')]);}}};Preview[_0x54bb('0x10')][_0x54bb('0x145')]=function(_0x10553d,_0x4f9da8,_0x5a9d97){if(this[_0x54bb('0x17')][_0x10553d]){if(_[_0x54bb('0x83')](this[_0x54bb('0x17')][_0x10553d][_0x54bb('0x146')])){this[_0x54bb('0x17')][_0x10553d]['variables']={};}this['actions'][_0x10553d][_0x54bb('0x146')][_0x4f9da8]=_0x5a9d97;}};Preview[_0x54bb('0x10')][_0x54bb('0x22')]=function(_0x179ff6){try{if(!_[_0x54bb('0x83')](_0x179ff6)){if(ut[_0x54bb('0x147')](_[_0x54bb('0x148')](_0x179ff6['variable'])[0x0])){this['addVariable'](_0x179ff6[_0x54bb('0xb3')],_['keys'](_0x179ff6['variable'])[0x0],_0x179ff6[_0x54bb('0x149')]);}}}catch(_0x3e9c6f){logger['error'](_0x54bb('0x14a'),util[_0x54bb('0x14b')](_0x3e9c6f,{'showHidden':![],'depth':null}));}};Preview[_0x54bb('0x10')]['syncAttendedTransfer']=function(_0xe91530){if(_0xe91530){if(this['actions'][_0xe91530[_0x54bb('0x14c')]]){this[_0x54bb('0x17')][_0xe91530[_0x54bb('0x14c')]][_0x54bb('0x141')]=!![];}}};Preview[_0x54bb('0x10')][_0x54bb('0x26')]=function(_0x1d684e){if(_0x1d684e){if(this[_0x54bb('0x17')][_0x1d684e['transfererlinkedid']]){this['actions'][_0x1d684e[_0x54bb('0x14d')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 77399d8..b9ebf1b 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 _0x5ad3=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','answertime','queuecallercomplete','endtime','membername','from-sip','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x4ca164,_0x453db6){var _0x18b051=function(_0x5a584c){while(--_0x5a584c){_0x4ca164['push'](_0x4ca164['shift']());}};_0x18b051(++_0x453db6);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0x5ad3[_0x39db05];return _0x3f0e22;};'use strict';var util=require(_0x35ad('0x0'));var BPromise=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var _=require('lodash');var cmHopper=require(_0x35ad('0x4'));var cmHopperFinal=require(_0x35ad('0x5'));var cmHopperHistory=require(_0x35ad('0x6'));var cmHopperBlack=require(_0x35ad('0x7'));var voiceQueueRt=require(_0x35ad('0x8'));var agentReportPreview=require(_0x35ad('0x9'));var voiceQueueReport=require(_0x35ad('0xa'));function loggerCatch(_0x436dcb){return function(_0x36c606){logger[_0x35ad('0xb')](_0x436dcb,util['inspect'](_0x36c606,{'showHidden':![],'depth':null}));};}function create(_0x292521){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopperHistory['createHistory'](_0x292521))[_0x35ad('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5a29e3){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](agentReportPreview['createHistory'](_0x5a29e3))[_0x35ad('0xe')](loggerCatch(_0x35ad('0xf')));}function moveContact(_0x4ad760){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x10')](_0x4ad760,!![]))['catch'](loggerCatch(_0x35ad('0x11')));}exports[_0x35ad('0x12')]=function(_0x595fe8){return BPromise['resolve']()[_0x35ad('0xd')](cmHopperBlack[_0x35ad('0x12')](_0x595fe8))[_0x35ad('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x35ad('0x13')]=function(_0x2ebceb){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper['getContactPreview'](_0x2ebceb))['catch'](loggerCatch(_0x35ad('0x14')));};exports[_0x35ad('0x15')]=function(_0x27efeb,_0x56cb8e){create(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));moveContact(_0x27efeb)[_0x35ad('0xe')](loggerCatch(_0x56cb8e));};exports[_0x35ad('0x16')]=function(_0x3158a1,_0x3a73c8){createAgent(_0x3158a1)[_0x35ad('0xe')](loggerCatch(_0x3a73c8));};exports['createCustomerHistory']=function(_0xd32a43,_0x2876ad){create(_0xd32a43)['catch'](loggerCatch(_0x2876ad));};exports['createCustomerFinal']=function(_0x3251d9,_0x398853){moveContact(_0x3251d9)['catch'](loggerCatch(_0x398853));};exports[_0x35ad('0x17')]=function(_0x32735e,_0x496620,_0x37c03d){if(_0x496620){_0x32735e[_0x35ad('0x18')]=null;}if(_0x37c03d){_0x32735e[_0x35ad('0x19')]=![];}return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x17')](_0x32735e))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1a')));};exports[_0x35ad('0x1b')]=function(_0xebc6c5){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1b')](_0xebc6c5))['catch'](loggerCatch(_0x35ad('0x1c')));};exports[_0x35ad('0x1d')]=function(_0xa3cb9f){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper['unlockContact']({'UserId':null},_0xa3cb9f,0x1))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x1e')));};exports[_0x35ad('0x1f')]=function(_0x1ca61d){return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](cmHopper[_0x35ad('0x1d')]({'active':![]},_0x1ca61d,0x1))[_0x35ad('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x35ad('0x20')]=function(_0x11da54){var _0x2f8b3={};_0x2f8b3[_0x35ad('0x21')]=_0x11da54[_0x35ad('0x21')];_0x2f8b3['uniqueid']=_0x11da54['uniqueid'];_0x2f8b3[_0x35ad('0x22')]=_0x11da54['calleridnum'];_0x2f8b3[_0x35ad('0x23')]=_0x11da54['calleridname'];_0x2f8b3['queue']=_0x11da54['queue'];_0x2f8b3['queuecallerjoinAt']=_0x11da54[_0x35ad('0x24')];_0x2f8b3['queuecallerleaveAt']=_0x11da54['answertime'];_0x2f8b3[_0x35ad('0x25')]=0x1;_0x2f8b3['queuecallercompleteAt']=_0x11da54[_0x35ad('0x26')];_0x2f8b3['connectedlinename']=_0x11da54[_0x35ad('0x27')];_0x2f8b3['context']=_0x35ad('0x28');_0x2f8b3['exten']=_0x35ad('0x29');_0x2f8b3[_0x35ad('0x2a')]=0x0;_0x2f8b3[_0x35ad('0x2b')]=0x1;_0x2f8b3['lastAssignedTo']=_0x11da54[_0x35ad('0x27')];_0x2f8b3[_0x35ad('0x2c')]=_0x35ad('0x2d');return BPromise[_0x35ad('0xc')]()[_0x35ad('0xd')](voiceQueueReport['create'](_0x2f8b3))['catch'](loggerCatch(_0x35ad('0x2e')));};exports[_0x35ad('0x2f')]=function(_0x378e2a,_0x1c8a3d){return BPromise['resolve']()[_0x35ad('0xd')](cmHopper[_0x35ad('0x2f')](_0x378e2a,_0x1c8a3d))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x30')));};exports[_0x35ad('0x31')]=function(_0x3b7b52){return BPromise['resolve']()['then'](cmHopper[_0x35ad('0x17')](_0x3b7b52,!![],!![]))[_0x35ad('0xe')](loggerCatch(_0x35ad('0x32')));}; \ No newline at end of file +var _0x84e7=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','context','from-sip','exten','holdtime','lastAssignedTo','membername','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x84e7,0x122));var _0x784e=function(_0x260e58,_0x19e80e){_0x260e58=_0x260e58-0x0;var _0x37d024=_0x84e7[_0x260e58];return _0x37d024;};'use strict';var util=require('util');var BPromise=require(_0x784e('0x0'));var logger=require(_0x784e('0x1'))('preview');var _=require(_0x784e('0x2'));var cmHopper=require(_0x784e('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x784e('0x4'));var cmHopperBlack=require(_0x784e('0x5'));var voiceQueueRt=require(_0x784e('0x6'));var agentReportPreview=require(_0x784e('0x7'));var voiceQueueReport=require(_0x784e('0x8'));function loggerCatch(_0x133296){return function(_0x48ed22){logger[_0x784e('0x9')](_0x133296,util['inspect'](_0x48ed22,{'showHidden':![],'depth':null}));};}function create(_0xfaa170){return BPromise[_0x784e('0xa')]()['then'](cmHopperHistory[_0x784e('0xb')](_0xfaa170))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function createAgent(_0x3ddd55){return BPromise['resolve']()['then'](agentReportPreview[_0x784e('0xb')](_0x3ddd55))[_0x784e('0xc')](loggerCatch(_0x784e('0xd')));}function moveContact(_0x2fd1b5){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0xf')](_0x2fd1b5,!![]))[_0x784e('0xc')](loggerCatch(_0x784e('0x10')));}exports[_0x784e('0x11')]=function(_0x208d24){return BPromise['resolve']()[_0x784e('0xe')](cmHopperBlack['checkIsBlackList'](_0x208d24))[_0x784e('0xc')](loggerCatch(_0x784e('0x12')));};exports[_0x784e('0x13')]=function(_0x21e844){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x13')](_0x21e844))[_0x784e('0xc')](loggerCatch(_0x784e('0x14')));};exports['createHistory']=function(_0x519059,_0x112ba1){create(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));moveContact(_0x519059)[_0x784e('0xc')](loggerCatch(_0x112ba1));};exports[_0x784e('0x15')]=function(_0x3ac83,_0x19072b){createAgent(_0x3ac83)[_0x784e('0xc')](loggerCatch(_0x19072b));};exports['createCustomerHistory']=function(_0x2524d0,_0x285ddd){create(_0x2524d0)[_0x784e('0xc')](loggerCatch(_0x285ddd));};exports[_0x784e('0x16')]=function(_0x440cd6,_0x42f894){moveContact(_0x440cd6)[_0x784e('0xc')](loggerCatch(_0x42f894));};exports['rescheduleContact']=function(_0x5add8f,_0x12aacb,_0x52bc9d){if(_0x12aacb){_0x5add8f[_0x784e('0x17')]=null;}if(_0x52bc9d){_0x5add8f[_0x784e('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x784e('0x19')](_0x5add8f))[_0x784e('0xc')](loggerCatch(_0x784e('0x1a')));};exports[_0x784e('0x1b')]=function(_0x51f452){return BPromise['resolve']()['then'](cmHopper[_0x784e('0x1b')](_0x51f452))[_0x784e('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0x784e('0x1c')]=function(_0x5e809a){return BPromise[_0x784e('0xa')]()['then'](cmHopper[_0x784e('0x1c')]({'UserId':null},_0x5e809a,0x1))[_0x784e('0xc')](loggerCatch(_0x784e('0x1d')));};exports[_0x784e('0x1e')]=function(_0x5cb14f){return BPromise[_0x784e('0xa')]()[_0x784e('0xe')](cmHopper[_0x784e('0x1c')]({'active':![]},_0x5cb14f,0x1))[_0x784e('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0x784e('0x1f')]=function(_0xa3603f){var _0x5f3da2={};_0x5f3da2['type']=_0xa3603f[_0x784e('0x20')];_0x5f3da2[_0x784e('0x21')]=_0xa3603f[_0x784e('0x21')];_0x5f3da2[_0x784e('0x22')]=_0xa3603f[_0x784e('0x22')];_0x5f3da2[_0x784e('0x23')]=_0xa3603f[_0x784e('0x23')];_0x5f3da2[_0x784e('0x24')]=_0xa3603f[_0x784e('0x24')];_0x5f3da2[_0x784e('0x25')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x27')]=_0xa3603f[_0x784e('0x26')];_0x5f3da2[_0x784e('0x28')]=0x1;_0x5f3da2[_0x784e('0x29')]=_0xa3603f['endtime'];_0x5f3da2[_0x784e('0x2a')]=_0xa3603f['membername'];_0x5f3da2[_0x784e('0x2b')]=_0x784e('0x2c');_0x5f3da2[_0x784e('0x2d')]='xcally-motion-preview';_0x5f3da2[_0x784e('0x2e')]=0x0;_0x5f3da2['assigned']=0x1;_0x5f3da2[_0x784e('0x2f')]=_0xa3603f[_0x784e('0x30')];_0x5f3da2['queuecallerexitreason']=_0x784e('0x31');return BPromise[_0x784e('0xa')]()['then'](voiceQueueReport['create'](_0x5f3da2))[_0x784e('0xc')](loggerCatch(_0x784e('0x32')));};exports[_0x784e('0x33')]=function(_0x4724af,_0x33b2a6){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x33')](_0x4724af,_0x33b2a6))['catch'](loggerCatch(_0x784e('0x34')));};exports['rescheduleContactInQueue']=function(_0x4adb1f){return BPromise['resolve']()[_0x784e('0xe')](cmHopper[_0x784e('0x19')](_0x4adb1f,!![],!![]))['catch'](loggerCatch(_0x784e('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 0c99bb7..f726e15 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 _0x6132=['isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','talktime','answertime','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','channelAgent','queue','agentReadyId','not_inuse','status','reachable','getDiff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','scheduledat','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','lodash','../../../../config/logger','preview','env','milliseconds','diff','loggerCatch','inspect','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0x6132,0xf3));var _0x2613=function(_0x4326e4,_0x1e1efc){_0x4326e4=_0x4326e4-0x0;var _0x57b1a2=_0x6132[_0x4326e4];return _0x57b1a2;};'use strict';var util=require('util');var _=require(_0x2613('0x0'));var moment=require('moment');var logger=require(_0x2613('0x1'))(_0x2613('0x2'));var ipAgi=process[_0x2613('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x3c1186,_0x521394){var _0x41719b=moment(_0x3c1186)['milliseconds'](0x0);var _0x4479f6=moment(_0x521394)[_0x2613('0x4')](0x0);return _0x41719b[_0x2613('0x5')](_0x4479f6,'seconds');}exports[_0x2613('0x6')]=function(_0x43c876){return function(_0x51f79d){logger['error'](_0x43c876,util[_0x2613('0x7')](_0x51f79d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x7c5e0b,_0x5894a5){logger[_0x2613('0x8')](_0x7c5e0b,util[_0x2613('0x7')](_0x5894a5,{'showHidden':![],'depth':null}));};exports[_0x2613('0x9')]=function(_0x3dd7aa,_0x49d6a9){logger[_0x2613('0xa')](_0x3dd7aa,util[_0x2613('0x7')](_0x49d6a9,{'showHidden':![],'depth':null}));};exports[_0x2613('0xb')]=function(_0xd7e8ae){return function(_0x5db104){logger[_0x2613('0x8')](_0xd7e8ae,util[_0x2613('0x7')](_0x5db104,{'showHidden':![],'depth':null}));};};exports[_0x2613('0xc')]=function(_0x163b44,_0xfea102,_0x18acee){return{'message':_0x163b44,'unlock':_0xfea102,'active':_0x18acee};};exports[_0x2613('0xd')]=function(_0x2b3e5e,_0x34ce5b,_0x166b99){if(!_[_0x2613('0xe')](_0x166b99)&&_0x2613('0xf')===typeof _0x166b99&&!_[_0x2613('0x10')](_0x166b99)){if(!_[_0x2613('0xe')](_0x34ce5b)&&_0x2613('0xf')===typeof _0x34ce5b&&!_[_0x2613('0x10')](_0x34ce5b)){return util[_0x2613('0x11')](_0x2613('0x12'),_0x34ce5b,_0x166b99);}return util[_0x2613('0x11')](_0x2613('0x12'),_0x166b99,_0x166b99);}if(!_[_0x2613('0xe')](_0x2b3e5e)&&_0x2613('0xf')===typeof _0x2b3e5e&&!_['isEmpty'](_0x2b3e5e)){return _0x2b3e5e;}return _0x2613('0x13');};exports[_0x2613('0x14')]=function(_0x838811){if(_[_0x2613('0x15')](_0x838811)){return![];}return _0x838811;};exports[_0x2613('0x16')]=function(_0x363754,_0x22c4db,_0xaace51,_0x41f86d,_0x335bf5,_0x44cfac){var _0x48811a={'XMD-QUEUE':_0x22c4db[_0x2613('0x17')]?_0x22c4db[_0x2613('0x17')][_0x2613('0x18')]:'','XMD-CALLERID':_0x41f86d,'XMD-CALLERID-PREVIEW':_0x44cfac?util['format'](_0x2613('0x12'),_0x44cfac['calleridname'],_0x44cfac[_0x2613('0x19')]):_0x41f86d,'XMD-DIALID':_0x335bf5,'XMD-CONTACTID':_0x22c4db[_0x2613('0x1a')],'XMD-CDRTYPE':_0x2613('0x1b'),'CALLERID(all)':_0x41f86d,'XMD-VOICEQUEUEID':_0x22c4db[_0x2613('0x1c')],'XMD-DIALCHANNEL':_0xaace51,'XMD-DIALTIMEOUT':_0x363754[_0x2613('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x2613('0x11')](_0x2613('0x1e'),_0x363754[_0x2613('0x1f')]?'g':'',_[_0x2613('0x10')](_0x363754[_0x2613('0x20')])?'':_0x2613('0x21')),'XMD-DIALURL':_0x363754['dialPreviewUrl']||'','XMD-AGI':_0x363754[_0x2613('0x22')]?util[_0x2613('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x363754[_0x2613('0x22')]):'NONE','XMD-AGIAFTER':_0x363754[_0x2613('0x1f')]?util[_0x2613('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x363754[_0x2613('0x1f')]):_0x2613('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x44cfac?_0x44cfac[_0x2613('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x44cfac?_0x44cfac['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x2613('0x10')](_0x363754['monitor_format'])){_0x48811a[util[_0x2613('0x11')]('%s',_0x2613('0x25'))]=_0x363754[_0x2613('0x20')];_0x48811a[util[_0x2613('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x335bf5;}if(_0x22c4db&&_0x22c4db[_0x2613('0x26')]){for(var _0x38519 in _0x22c4db[_0x2613('0x26')]){if(_0x22c4db['Contact'][_0x2613('0x27')](_0x38519)){if(!_[_0x2613('0x15')](_0x22c4db['Contact'][_0x38519])&&_0x38519!=='id'&&_0x38519!==_0x2613('0x28')&&_0x38519!=='createdAt'&&_0x38519!==_0x2613('0x29')){_0x48811a[util['format'](_0x2613('0x2a'),_0x2613('0x2b'),_[_0x2613('0x2c')](_0x38519))]=_0x22c4db[_0x2613('0x26')][_0x38519];}}}}return _0x48811a;};exports[_0x2613('0x2d')]=function(_0x22755c){var _0x34a858={};for(var _0x3ad841 in _0x22755c){if(_0x22755c[_0x2613('0x27')](_0x3ad841)){_0x34a858[util[_0x2613('0x11')]('%s',_[_0x2613('0x2e')](_0x3ad841))]=_0x22755c[_0x3ad841];}}return{'variables':_0x34a858};};exports['updateOriginated']=function(_0x485a92,_0x2c6aad){if(!_['isNil'](_0x485a92)){if(_0x485a92['hasOwnProperty'](_0x2613('0x2f'))){if(_0x485a92[_0x2613('0x2f')]>0x0){_0x485a92[_0x2613('0x2f')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2c6aad);}}}else{logger['error'](_0x2613('0x30'),_0x2c6aad);}};exports[_0x2613('0x31')]=function(_0x416f25){var _0x35dd2b=moment()[_0x2613('0x11')](_0x2613('0x32'));_0x416f25[_0x2613('0x33')]=0xd;_0x416f25[_0x2613('0x34')]=_0x2613('0x35');_0x416f25[_0x2613('0x36')]=_0x35dd2b;_0x416f25[_0x2613('0x37')]=_0x35dd2b;_0x416f25[_0x2613('0x38')]=_0x35dd2b;};exports[_0x2613('0x39')]=function(_0x166fbb,_0x22d9eb,_0x2b2029){var _0x14e4bb=moment()[_0x2613('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x166fbb['state']=_0x22d9eb;_0x166fbb['statedesc']=_0x2b2029;_0x166fbb['responsetime']=_0x14e4bb;_0x166fbb[_0x2613('0x3a')]=getSeconds(_0x166fbb[_0x2613('0x37')],_0x166fbb['starttime']);};exports['logLookAgent']=function(_0x19af11,_0x51bf5a,_0x1fa7b3){_0x19af11[_0x2613('0x3b')]=_0x51bf5a;_0x19af11[_0x2613('0x3c')]=_0x1fa7b3;};exports['logCustomer']=function(_0x2aacff,_0x33a62a,_0x1679e5){var _0x1e8319=moment()[_0x2613('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2aacff['state']=_0x33a62a;_0x2aacff[_0x2613('0x34')]=_0x1679e5;_0x2aacff[_0x2613('0x37')]=_0x2aacff['responsetime']?_0x2aacff[_0x2613('0x37')]:_0x1e8319;_0x2aacff[_0x2613('0x38')]=_0x2aacff[_0x2613('0x38')]?_0x2aacff['endtime']:_0x1e8319;_0x2aacff[_0x2613('0x3a')]=getSeconds(_0x2aacff[_0x2613('0x37')]||0x0,_0x2aacff[_0x2613('0x36')]||0x0);_0x2aacff[_0x2613('0x3d')]=_0x2aacff['answertime']?getSeconds(_0x2aacff['endtime'],_0x2aacff[_0x2613('0x3e')]):0x0;};exports['isFailure']=function(_0x444176){return _0x444176===_0x2613('0x3f');};exports[_0x2613('0x40')]=function(_0x13e49e,_0x2930e1,_0x2e35a5,_0x555caf,_0x5bc650){var _0x31d21d=_0x555caf?'RECALL':_0x13e49e[_0x2613('0x41')];_0x31d21d=_0x5bc650?_0x2613('0x42'):_0x31d21d;return{'actionid':_0x13e49e[_0x2613('0x43')],'action':_0x2613('0x44'),'channel':_0x13e49e['channelAgent'],'callerid':util['format'](_0x2613('0x12'),_0x31d21d,_0x13e49e[_0x2613('0x19')]),'Exten':_0x2613('0x45'),'Context':_0x2613('0x46'),'Priority':'1','variable':_0x2e35a5,'timeout':(_0x2930e1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x13e49e[_0x2613('0x43')]};};exports['totalGlobal']=function(_0x538bd9){return _0x538bd9[_0x2613('0x47')]+_0x538bd9[_0x2613('0x48')]+_0x538bd9[_0x2613('0x49')]+_0x538bd9[_0x2613('0x4a')]+_0x538bd9['countnosuchnumberretry'];};exports[_0x2613('0x4b')]=function(_0x1bdc0f){var _0x111231=_[_0x2613('0x4c')](_0x1bdc0f);_0x111231['state']=0xf;_0x111231[_0x2613('0x34')]=_0x2613('0x4d');return _0x111231;};exports['scheduledAt']=function(_0x2a01de,_0x16f6d0,_0xa20e71){var _0x48756d={};_0x48756d[_0x16f6d0]=_0x2a01de[_0x16f6d0];_0x48756d[_0x2613('0x4e')]=![];_0x48756d['scheduledat']=moment()[_0x2613('0x4f')](_0xa20e71,_0x2613('0x50'))[_0x2613('0x11')](_0x2613('0x32'));_0x48756d[_0x2613('0x1a')]=_0x2a01de[_0x2613('0x1a')];_0x48756d['ListId']=_0x2a01de[_0x2613('0x51')];_0x48756d[_0x2613('0x1c')]=_0x2a01de[_0x2613('0x1c')]||undefined;return _0x48756d;};exports[_0x2613('0x52')]=function(_0x28c708,_0x4a3704){if(!_[_0x2613('0x15')](_0x28c708)){if(_0x28c708[_0x2613('0x53')]>0x0){_0x28c708[_0x2613('0x53')]-=0x1;}else{logger[_0x2613('0xa')](_0x4a3704,_0x2613('0x54'));}}else{logger['error'](_0x4a3704,_0x2613('0x55'));}};exports[_0x2613('0x56')]=function(_0x22e0aa){if(_0x22e0aa<=0x0){return!![];}return![];};exports[_0x2613('0x57')]=function(_0x3a78fe,_0x50063f){_0x3a78fe[_0x2613('0x58')]=_0x50063f;_0x3a78fe[_0x2613('0x18')]=_0x3a78fe['queue'];_0x3a78fe[_0x2613('0x59')]=_0x3a78fe[_0x2613('0x5a')];return _0x3a78fe;};exports['buildAcw']=function(_0x194907){var _0x32a661={};_0x32a661[_0x2613('0x5b')]=_0x194907['queue'];_0x32a661[_0x2613('0x59')]=_0x194907[_0x2613('0x5a')];_0x32a661[_0x2613('0x43')]=_0x194907[_0x2613('0x43')];return _0x32a661;};exports[_0x2613('0x5c')]=function(_0x3a3c37){var _0x13e5dd=[];for(var _0x2f9ed0 in _0x3a3c37){if(_0x3a3c37[_0x2613('0x27')](_0x2f9ed0)){if(!_['isNil'](_0x3a3c37[_0x2f9ed0])&&_0x3a3c37[_0x2f9ed0]['state']===_0x2613('0x5d')&&_0x3a3c37[_0x2f9ed0][_0x2613('0x5e')]===_0x2613('0x5f')){_0x13e5dd['push'](_0x3a3c37[_0x2f9ed0]['id']);}}}return _0x13e5dd;};exports[_0x2613('0x60')]=function(_0x2c7b61){var _0x5cf4d3=moment()[_0x2613('0x4')](0x0);var _0x15c96c=moment(_0x2c7b61)[_0x2613('0x4')](0x0);return _0x5cf4d3[_0x2613('0x5')](_0x15c96c,_0x2613('0x61'));};exports[_0x2613('0x62')]=function(_0x2bc548){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2bc548['ContactId'],'ListId':_0x2bc548[_0x2613('0x51')],'VoiceQueueId':_0x2bc548['VoiceQueueId']||undefined,'CampaignId':_0x2bc548[_0x2613('0x63')]||undefined};};exports['filterKey']=function(_0x41a599){if(_0x41a599==='uniqueid'||_0x41a599===_0x2613('0x64')||_0x41a599===_0x2613('0x5b')||_0x41a599===_0x2613('0x65')||_0x41a599===_0x2613('0x66')||_0x41a599===_0x2613('0x67')||_0x41a599==='membername'||_0x41a599===_0x2613('0x5a')||_0x41a599==='calleridname'||_0x41a599===_0x2613('0x4e')||_0x41a599===_0x2613('0x19')||_0x41a599===_0x2613('0x68')||_0x41a599==='countbusyretry'||_0x41a599===_0x2613('0x48')||_0x41a599===_0x2613('0x49')||_0x41a599===_0x2613('0x69')||_0x41a599===_0x2613('0x6a')||_0x41a599===_0x2613('0x6b')||_0x41a599===_0x2613('0x6c')||_0x41a599==='recallme'||_0x41a599==='ContactId'||_0x41a599==='ListId'||_0x41a599===_0x2613('0x3c')||_0x41a599==='VoiceQueueId'||_0x41a599==='sipcallid'||_0x41a599===_0x2613('0x6d')||_0x41a599===_0x2613('0x6e')||_0x41a599===_0x2613('0x6f')||_0x41a599===_0x2613('0x70')||_0x41a599===_0x2613('0x71')||_0x41a599===_0x2613('0x72')||_0x41a599==='xmd-dialoptions'||_0x41a599==='xmd-dialid'||_0x41a599===_0x2613('0x73')||_0x41a599==='xmd-contactid'||_0x41a599==='xmd-cdrtype'||_0x41a599===_0x2613('0x74')||_0x41a599===_0x2613('0x75')||_0x41a599==='xmd-agi'||_0x41a599===_0x2613('0x76')||_0x41a599===_0x2613('0x77')||_0x41a599===_0x2613('0x78')||_0x41a599===_0x2613('0x79')||_0x41a599===_0x2613('0x7a')||_0x41a599===_0x2613('0x7b')||_0x41a599===_0x2613('0x7c')||_0x41a599==='rtpaudioqosrttbridged'||_0x41a599===_0x2613('0x76')||_0x41a599===_0x2613('0x77')||_0x41a599==='rtpaudioqosjitter'||_0x41a599===_0x2613('0x79')||_0x41a599===_0x2613('0x7a')||_0x41a599===_0x2613('0x7b')||_0x41a599===_0x2613('0x7c')||_0x41a599===_0x2613('0x7d')||_0x41a599==='bridgepeer'||_0x41a599===_0x2613('0x7e')||_0x41a599===_0x2613('0x33')||_0x41a599===_0x2613('0x34')){return![];}return!![];};exports[_0x2613('0x7f')]=function(_0x4355de,_0x5467bd){var _0x5c1e9d,_0x83b8fb,_0x156edb;if(_0x5467bd<=0x0){_0x5467bd=0x1;}_0x5c1e9d=new RegExp(_0x2613('0x80')+_0x5467bd+'}$');_0x83b8fb=Math[_0x2613('0x81')](0xa,_0x5467bd-0x1);_0x156edb=Math['pow'](0xa,_0x5467bd)-0x1;return util['format']('%s',_['replace'](_0x4355de,_0x5c1e9d,_[_0x2613('0x82')](_0x83b8fb,_0x156edb)));};exports['extractCalleridName']=function(_0x2dcc84){var _0x29ec08=_0x2dcc84[_0x2613('0x83')](/"(.*?)"/);return _0x29ec08?_0x29ec08[0x1]:_0x2dcc84;};exports['extractCalleridNumber']=function(_0x4ee679){var _0x1bcc9f=_0x4ee679[_0x2613('0x83')](/<(.*?)>/);return _0x1bcc9f?_0x1bcc9f[0x1]:_0x4ee679;}; \ No newline at end of file +var _0x762e=['addVariables','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','calleridnum','timeout','uniqueid','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','push','CampaignId','idContact','type','campaigntype','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>'];(function(_0x59e586,_0x34bd0e){var _0x48d30d=function(_0x32ce99){while(--_0x32ce99){_0x59e586['push'](_0x59e586['shift']());}};_0x48d30d(++_0x34bd0e);}(_0x762e,0xea));var _0xe762=function(_0x1d83c7,_0x1c040e){_0x1d83c7=_0x1d83c7-0x0;var _0x4d335f=_0x762e[_0x1d83c7];return _0x4d335f;};'use strict';var util=require(_0xe762('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xe762('0x1'))('preview');var ipAgi=process['env'][_0xe762('0x2')]||_0xe762('0x3');function getSeconds(_0x2a390a,_0x59723c){var _0xe78ccf=moment(_0x2a390a)[_0xe762('0x4')](0x0);var _0x48995a=moment(_0x59723c)['milliseconds'](0x0);return _0xe78ccf[_0xe762('0x5')](_0x48995a,_0xe762('0x6'));}exports[_0xe762('0x7')]=function(_0xf20548){return function(_0x26a4fc){logger[_0xe762('0x8')](_0xf20548,util['inspect'](_0x26a4fc,{'showHidden':![],'depth':null}));};};exports[_0xe762('0x9')]=function(_0x2c0793,_0x177ad9){logger[_0xe762('0xa')](_0x2c0793,util[_0xe762('0xb')](_0x177ad9,{'showHidden':![],'depth':null}));};exports[_0xe762('0xc')]=function(_0x224a19,_0x4938e5){logger[_0xe762('0x8')](_0x224a19,util[_0xe762('0xb')](_0x4938e5,{'showHidden':![],'depth':null}));};exports[_0xe762('0xd')]=function(_0x4a7d2f){return function(_0x340573){logger['info'](_0x4a7d2f,util[_0xe762('0xb')](_0x340573,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x12d8d8,_0x25a6cf,_0x1ebf3d){return{'message':_0x12d8d8,'unlock':_0x25a6cf,'active':_0x1ebf3d};};exports['getCallerId']=function(_0x50aa09,_0x35be11,_0x417be3){if(!_[_0xe762('0xe')](_0x417be3)&&_0xe762('0xf')===typeof _0x417be3&&!_[_0xe762('0x10')](_0x417be3)){if(!_[_0xe762('0xe')](_0x35be11)&&_0xe762('0xf')===typeof _0x35be11&&!_[_0xe762('0x10')](_0x35be11)){return util['format'](_0xe762('0x11'),_0x35be11,_0x417be3);}return util[_0xe762('0x12')](_0xe762('0x11'),_0x417be3,_0x417be3);}if(!_[_0xe762('0xe')](_0x50aa09)&&'string'===typeof _0x50aa09&&!_[_0xe762('0x10')](_0x50aa09)){return _0x50aa09;}return _0xe762('0x13');};exports['isActive']=function(_0x5c6350){if(_['isNil'](_0x5c6350)){return![];}return _0x5c6350;};exports[_0xe762('0x14')]=function(_0x5505b1,_0x428a59,_0x5bd84e,_0x8775aa,_0x57ad0d,_0x11ad31){var _0x190aa3={'XMD-QUEUE':_0x428a59[_0xe762('0x15')]?_0x428a59[_0xe762('0x15')][_0xe762('0x16')]:'','XMD-CALLERID':_0x8775aa,'XMD-CALLERID-PREVIEW':_0x11ad31?util['format']('\x22%s\x22\x20<%s>',_0x11ad31['calleridname'],_0x11ad31['calleridnum']):_0x8775aa,'XMD-DIALID':_0x57ad0d,'XMD-CONTACTID':_0x428a59[_0xe762('0x17')],'XMD-CDRTYPE':_0xe762('0x18'),'CALLERID(all)':_0x8775aa,'XMD-VOICEQUEUEID':_0x428a59[_0xe762('0x19')],'XMD-DIALCHANNEL':_0x5bd84e,'XMD-DIALTIMEOUT':_0x5505b1[_0xe762('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xe762('0x12')]('\x22rtTxX%s%s\x22',_0x5505b1[_0xe762('0x1b')]?'g':'',_[_0xe762('0x10')](_0x5505b1[_0xe762('0x1c')])?'':_0xe762('0x1d')),'XMD-DIALURL':_0x5505b1[_0xe762('0x1e')]||'','XMD-AGI':_0x5505b1[_0xe762('0x1f')]?util[_0xe762('0x12')](_0xe762('0x20'),ipAgi,_0x5505b1[_0xe762('0x1f')]):_0xe762('0x21'),'XMD-AGIAFTER':_0x5505b1[_0xe762('0x1b')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5505b1[_0xe762('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x11ad31?_0x11ad31[_0xe762('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x11ad31?_0x11ad31[_0xe762('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xe762('0x10')](_0x5505b1[_0xe762('0x1c')])){_0x190aa3[util[_0xe762('0x12')]('%s',_0xe762('0x24'))]=_0x5505b1[_0xe762('0x1c')];_0x190aa3[util[_0xe762('0x12')]('%s',_0xe762('0x25'))]=_0x57ad0d;}if(_0x428a59&&_0x428a59[_0xe762('0x26')]){for(var _0x26dbd3 in _0x428a59[_0xe762('0x26')]){if(_0x428a59['Contact'][_0xe762('0x27')](_0x26dbd3)){if(!_[_0xe762('0x28')](_0x428a59[_0xe762('0x26')][_0x26dbd3])&&_0x26dbd3!=='id'&&_0x26dbd3!==_0xe762('0x29')&&_0x26dbd3!==_0xe762('0x2a')&&_0x26dbd3!==_0xe762('0x2b')){_0x190aa3[util[_0xe762('0x12')](_0xe762('0x2c'),'XMD-',_['toUpper'](_0x26dbd3))]=_0x428a59[_0xe762('0x26')][_0x26dbd3];}}}}return _0x190aa3;};exports[_0xe762('0x2d')]=function(_0x105941){var _0x31a9d9={};for(var _0x1e8c3f in _0x105941){if(_0x105941[_0xe762('0x27')](_0x1e8c3f)){_0x31a9d9[util[_0xe762('0x12')]('%s',_['toLower'](_0x1e8c3f))]=_0x105941[_0x1e8c3f];}}return{'variables':_0x31a9d9};};exports[_0xe762('0x2e')]=function(_0x1c0821,_0xc4f64e){if(!_['isNil'](_0x1c0821)){if(_0x1c0821[_0xe762('0x27')](_0xe762('0x2f'))){if(_0x1c0821[_0xe762('0x2f')]>0x0){_0x1c0821[_0xe762('0x2f')]-=0x1;}else{logger[_0xe762('0x8')](_0xe762('0x30'),_0xc4f64e);}}}else{logger[_0xe762('0x8')](_0xe762('0x31'),_0xc4f64e);}};exports[_0xe762('0x32')]=function(_0x46f7cd){var _0x4e6fa9=moment()[_0xe762('0x12')](_0xe762('0x33'));_0x46f7cd[_0xe762('0x34')]=0xd;_0x46f7cd[_0xe762('0x35')]=_0xe762('0x36');_0x46f7cd[_0xe762('0x37')]=_0x4e6fa9;_0x46f7cd[_0xe762('0x38')]=_0x4e6fa9;_0x46f7cd[_0xe762('0x39')]=_0x4e6fa9;};exports[_0xe762('0x3a')]=function(_0x45872b,_0xafa2d6,_0x45c131){var _0xa7cb9c=moment()[_0xe762('0x12')](_0xe762('0x33'));_0x45872b[_0xe762('0x34')]=_0xafa2d6;_0x45872b[_0xe762('0x35')]=_0x45c131;_0x45872b[_0xe762('0x38')]=_0xa7cb9c;_0x45872b[_0xe762('0x3b')]=getSeconds(_0x45872b[_0xe762('0x38')],_0x45872b[_0xe762('0x37')]);};exports['logLookAgent']=function(_0x5abccb,_0x19cfb0,_0xfafbf3){_0x5abccb[_0xe762('0x3c')]=_0x19cfb0;_0x5abccb[_0xe762('0x3d')]=_0xfafbf3;};exports[_0xe762('0x3e')]=function(_0x2a5b71,_0x3c7755,_0x43fe46){var _0x394f46=moment()[_0xe762('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a5b71['state']=_0x3c7755;_0x2a5b71[_0xe762('0x35')]=_0x43fe46;_0x2a5b71[_0xe762('0x38')]=_0x2a5b71['responsetime']?_0x2a5b71[_0xe762('0x38')]:_0x394f46;_0x2a5b71[_0xe762('0x39')]=_0x2a5b71[_0xe762('0x39')]?_0x2a5b71[_0xe762('0x39')]:_0x394f46;_0x2a5b71['ringtime']=getSeconds(_0x2a5b71['responsetime']||0x0,_0x2a5b71[_0xe762('0x37')]||0x0);_0x2a5b71[_0xe762('0x3f')]=_0x2a5b71['answertime']?getSeconds(_0x2a5b71[_0xe762('0x39')],_0x2a5b71[_0xe762('0x40')]):0x0;};exports[_0xe762('0x41')]=function(_0x3f6848){return _0x3f6848===_0xe762('0x42');};exports[_0xe762('0x43')]=function(_0x435005,_0x163bd4,_0x281398,_0x3efbad,_0x15a9ea){var _0xcaf61f=_0x3efbad?_0xe762('0x44'):_0x435005['calleridname'];_0xcaf61f=_0x15a9ea?'BOOKED':_0xcaf61f;return{'actionid':_0x435005['uniqueid'],'action':_0xe762('0x45'),'channel':_0x435005[_0xe762('0x46')],'callerid':util[_0xe762('0x12')](_0xe762('0x11'),_0xcaf61f,_0x435005[_0xe762('0x47')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x281398,'timeout':(_0x163bd4[_0xe762('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x435005[_0xe762('0x49')]};};exports['totalGlobal']=function(_0xec8de2){return _0xec8de2['countbusyretry']+_0xec8de2['countcongestionretry']+_0xec8de2[_0xe762('0x4a')]+_0xec8de2[_0xe762('0x4b')]+_0xec8de2['countnosuchnumberretry'];};exports[_0xe762('0x4c')]=function(_0x2b3b1d){var _0x26d591=_[_0xe762('0x4d')](_0x2b3b1d);_0x26d591['state']=0xf;_0x26d591[_0xe762('0x35')]=_0xe762('0x4e');return _0x26d591;};exports['scheduledAt']=function(_0x2eb2fb,_0x8be01b,_0x101db6){var _0x23447d={};_0x23447d[_0x8be01b]=_0x2eb2fb[_0x8be01b];_0x23447d[_0xe762('0x4f')]=![];_0x23447d[_0xe762('0x50')]=moment()['add'](_0x101db6,_0xe762('0x51'))[_0xe762('0x12')](_0xe762('0x33'));_0x23447d[_0xe762('0x17')]=_0x2eb2fb['ContactId'];_0x23447d[_0xe762('0x52')]=_0x2eb2fb['ListId'];_0x23447d[_0xe762('0x19')]=_0x2eb2fb[_0xe762('0x19')]||undefined;return _0x23447d;};exports[_0xe762('0x53')]=function(_0x39c92d,_0x142c08){if(!_[_0xe762('0x28')](_0x39c92d)){if(_0x39c92d[_0xe762('0x54')]>0x0){_0x39c92d[_0xe762('0x54')]-=0x1;}else{logger[_0xe762('0x8')](_0x142c08,_0xe762('0x55'));}}else{logger[_0xe762('0x8')](_0x142c08,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe762('0x56')]=function(_0x253bb6){if(_0x253bb6<=0x0){return!![];}return![];};exports[_0xe762('0x57')]=function(_0xa82691,_0x4f1fea){_0xa82691[_0xe762('0x58')]=_0x4f1fea;_0xa82691[_0xe762('0x16')]=_0xa82691[_0xe762('0x59')];_0xa82691[_0xe762('0x5a')]=_0xa82691[_0xe762('0x46')];return _0xa82691;};exports[_0xe762('0x5b')]=function(_0x3346dd){var _0x206b11={};_0x206b11[_0xe762('0x59')]=_0x3346dd[_0xe762('0x59')];_0x206b11['interface']=_0x3346dd[_0xe762('0x46')];_0x206b11[_0xe762('0x49')]=_0x3346dd[_0xe762('0x49')];return _0x206b11;};exports[_0xe762('0x5c')]=function(_0xfbc228){var _0x4168e7=[];for(var _0x3de12d in _0xfbc228){if(_0xfbc228[_0xe762('0x27')](_0x3de12d)){if(!_['isNil'](_0xfbc228[_0x3de12d])&&_0xfbc228[_0x3de12d]['state']===_0xe762('0x5d')&&_0xfbc228[_0x3de12d][_0xe762('0x5e')]==='reachable'){_0x4168e7[_0xe762('0x5f')](_0xfbc228[_0x3de12d]['id']);}}}return _0x4168e7;};exports['getDiff']=function(_0x195572){var _0x9a3925=moment()[_0xe762('0x4')](0x0);var _0x1de7f4=moment(_0x195572)[_0xe762('0x4')](0x0);return _0x9a3925[_0xe762('0x5')](_0x1de7f4,_0xe762('0x6'));};exports['createBody']=function(_0x5b4bf7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b4bf7[_0xe762('0x17')],'ListId':_0x5b4bf7['ListId'],'VoiceQueueId':_0x5b4bf7[_0xe762('0x19')]||undefined,'CampaignId':_0x5b4bf7[_0xe762('0x60')]||undefined};};exports['filterKey']=function(_0x2b8575){if(_0x2b8575===_0xe762('0x49')||_0x2b8575===_0xe762('0x61')||_0x2b8575===_0xe762('0x59')||_0x2b8575===_0xe762('0x62')||_0x2b8575===_0xe762('0x63')||_0x2b8575==='dialAnswer'||_0x2b8575===_0xe762('0x3c')||_0x2b8575===_0xe762('0x46')||_0x2b8575==='calleridname'||_0x2b8575===_0xe762('0x4f')||_0x2b8575===_0xe762('0x47')||_0x2b8575===_0xe762('0x50')||_0x2b8575==='countbusyretry'||_0x2b8575==='countcongestionretry'||_0x2b8575===_0xe762('0x4a')||_0x2b8575==='countglobal'||_0x2b8575===_0xe762('0x64')||_0x2b8575===_0xe762('0x65')||_0x2b8575===_0xe762('0x66')||_0x2b8575==='recallme'||_0x2b8575===_0xe762('0x17')||_0x2b8575==='ListId'||_0x2b8575==='UserId'||_0x2b8575===_0xe762('0x19')||_0x2b8575===_0xe762('0x67')||_0x2b8575==='xmd-voicequeueid'||_0x2b8575===_0xe762('0x68')||_0x2b8575===_0xe762('0x69')||_0x2b8575==='xmd-listid'||_0x2b8575==='xmd-dialurl'||_0x2b8575==='xmd-dialtimeout'||_0x2b8575==='xmd-dialoptions'||_0x2b8575===_0xe762('0x6a')||_0x2b8575==='xmd-dialchannel'||_0x2b8575===_0xe762('0x6b')||_0x2b8575===_0xe762('0x6c')||_0x2b8575===_0xe762('0x6d')||_0x2b8575===_0xe762('0x6e')||_0x2b8575===_0xe762('0x6f')||_0x2b8575===_0xe762('0x70')||_0x2b8575===_0xe762('0x71')||_0x2b8575===_0xe762('0x72')||_0x2b8575===_0xe762('0x73')||_0x2b8575==='rtpaudioqosloss'||_0x2b8575===_0xe762('0x74')||_0x2b8575==='rtpaudioqosrtt'||_0x2b8575===_0xe762('0x75')||_0x2b8575===_0xe762('0x70')||_0x2b8575===_0xe762('0x71')||_0x2b8575===_0xe762('0x72')||_0x2b8575===_0xe762('0x73')||_0x2b8575==='rtpaudioqosloss'||_0x2b8575===_0xe762('0x74')||_0x2b8575===_0xe762('0x76')||_0x2b8575===_0xe762('0x75')||_0x2b8575==='bridgepeer'||_0x2b8575===_0xe762('0x77')||_0x2b8575===_0xe762('0x34')||_0x2b8575==='statedesc'){return![];}return!![];};exports[_0xe762('0x78')]=function(_0x376d59,_0x47ae3e){var _0x5bd363,_0x4da689,_0x2ac902;if(_0x47ae3e<=0x0){_0x47ae3e=0x1;}_0x5bd363=new RegExp('\x5cw{0,'+_0x47ae3e+'}$');_0x4da689=Math[_0xe762('0x79')](0xa,_0x47ae3e-0x1);_0x2ac902=Math[_0xe762('0x79')](0xa,_0x47ae3e)-0x1;return util[_0xe762('0x12')]('%s',_[_0xe762('0x7a')](_0x376d59,_0x5bd363,_[_0xe762('0x7b')](_0x4da689,_0x2ac902)));};exports[_0xe762('0x7c')]=function(_0x730b1d){var _0x226180=_0x730b1d[_0xe762('0x7d')](/"(.*?)"/);return _0x226180?_0x226180[0x1]:_0x730b1d;};exports[_0xe762('0x7e')]=function(_0x370da0){var _0x5597d7=_0x370da0[_0xe762('0x7d')](/<(.*?)>/);return _0x5597d7?_0x5597d7[0x1]:_0x370da0;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 031b600..bfd2bcc 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(_0xb6e4c,_0x42e3bf){var _0x83e9ae=function(_0x5114f3){while(--_0x5114f3){_0xb6e4c['push'](_0xb6e4c['shift']());}};_0x83e9ae(++_0x42e3bf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35d76f,_0x30b143){_0x35d76f=_0x35d76f-0x0;var _0x2f3ce5=_0x5f2f[_0x35d76f];return _0x2f3ce5;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x474e4d,_0x3cfc20){var _0x3d60ce=function(_0x5f434e){while(--_0x5f434e){_0x474e4d['push'](_0x474e4d['shift']());}};_0x3d60ce(++_0x3cfc20);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48aaa9,_0x353658){_0x48aaa9=_0x48aaa9-0x0;var _0x49a3a2=_0x5f2f[_0x48aaa9];return _0x49a3a2;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6282d4b..e15c27a 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 _0x6a3c=['../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','triggers','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','isNil','interface','format','SIP/%s','name','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','telephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','total','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','bluebird','util','lodash','moment','../model/agent'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x6a3c,0x14b));var _0xc6a3=function(_0x35d092,_0x43ee53){_0x35d092=_0x35d092-0x0;var _0x409c19=_0x6a3c[_0x35d092];return _0x409c19;};'use strict';var BPromise=require(_0xc6a3('0x0'));var util=require(_0xc6a3('0x1'));var _=require(_0xc6a3('0x2'));var moment=require(_0xc6a3('0x3'));var Agent=require(_0xc6a3('0x4'));var Telephone=require(_0xc6a3('0x5'));var Trunk=require(_0xc6a3('0x6'));var VoiceQueue=require(_0xc6a3('0x7'));var Trigger=require(_0xc6a3('0x8'));var Template=require('../model/template');var Campaign=require(_0xc6a3('0x9'));var VoiceExtension=require(_0xc6a3('0xa'));var ZendeskAccount=require(_0xc6a3('0xb'));var SalesforceAccount=require(_0xc6a3('0xc'));var FreshdeskAccount=require(_0xc6a3('0xd'));var SugarcrmAccount=require(_0xc6a3('0xe'));var ZohoAccount=require(_0xc6a3('0xf'));var DeskAccount=require(_0xc6a3('0x10'));var VtigerAccount=require(_0xc6a3('0x11'));var ServicenowAccount=require(_0xc6a3('0x12'));var Dynamics365Account=require(_0xc6a3('0x13'));var FreshsalesAccount=require(_0xc6a3('0x14'));var FaxAccount=require(_0xc6a3('0x15'));var Realtime=function(){this[_0xc6a3('0x16')]={};this['telephones']={};this[_0xc6a3('0x17')]={};this['voiceQueues']={};this[_0xc6a3('0x18')]={};this['campaigns']={};this['templates']={};this[_0xc6a3('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc6a3('0x1a')]={};this[_0xc6a3('0x1b')]={};this[_0xc6a3('0x1c')]={};this[_0xc6a3('0x1d')]={};this[_0xc6a3('0x1e')]={};this[_0xc6a3('0x1f')]={};this['salesforceAccounts']={};this[_0xc6a3('0x20')]={};this[_0xc6a3('0x21')]={};this[_0xc6a3('0x22')]={};this[_0xc6a3('0x23')]={};this['vtigerAccounts']={};this[_0xc6a3('0x24')]={};this[_0xc6a3('0x25')]={};this[_0xc6a3('0x26')]={};this[_0xc6a3('0x27')]={};};function freeIsNotKey(_0x5a15b4,_0x3f6028,_0xe2dc7d){var _0x3589b4=_['mapKeys'](_0x5a15b4,function(_0xdfae2a,_0x4d0cd0){return _0xdfae2a[_0xe2dc7d];});for(var _0x57656c in _0x3f6028){if(_0x3f6028[_0xc6a3('0x28')](_0x57656c)){if(!_0x3589b4[_0x57656c]){delete _0x3f6028[_0x57656c];}}}}function freeIsNotKeySip(_0x18d7ea,_0x366614){var _0x14171f=_[_0xc6a3('0x29')](_0x18d7ea,function(_0x425e37,_0x28846e){return util['format']('SIP/%s',_0x425e37['name']);});for(var _0x3b1bfd in _0x366614){if(_0x366614[_0xc6a3('0x28')](_0x3b1bfd)){if(!_0x14171f[_0x3b1bfd]){delete _0x366614[_0x3b1bfd];}}}}function freeIsNotKeyAgent(_0x1cb86b,_0x3409bb){var _0x578b5e=_[_0xc6a3('0x29')](_0x1cb86b,function(_0x102d29,_0x465dbe){var _0x1bcd17=_[_0xc6a3('0x2a')](_0x102d29[_0xc6a3('0x2b')])?util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x102d29[_0xc6a3('0x2e')]):_0x102d29[_0xc6a3('0x2b')];return _0x1bcd17;});for(var _0x20a178 in _0x3409bb){if(_0x3409bb[_0xc6a3('0x28')](_0x20a178)){if(!_0x578b5e[_0x20a178]){delete _0x3409bb[_0x20a178];}}}}function clearVoiceCallReports(_0x1c0e7f){_0x1c0e7f['total']=0x0;_0x1c0e7f[_0xc6a3('0x2f')]=0x0;_0x1c0e7f[_0xc6a3('0x30')]=0x0;_0x1c0e7f[_0xc6a3('0x31')]=0x0;_0x1c0e7f[_0xc6a3('0x32')]=0x0;}function clearCampaigns(_0x1caa7d){if(!_[_0xc6a3('0x33')](_0x1caa7d)){for(var _0x37ab72 in _0x1caa7d){if(_0x1caa7d['hasOwnProperty'](_0x37ab72)){_0x1caa7d[_0x37ab72][_0xc6a3('0x34')]=0x0;_0x1caa7d[_0x37ab72][_0xc6a3('0x35')]=0x0;}}}}function clearVoiceQueues(_0x1ee6b6){if(!_[_0xc6a3('0x33')](_0x1ee6b6)){for(var _0x34ba9b in _0x1ee6b6){if(_0x1ee6b6['hasOwnProperty'](_0x34ba9b)){_0x1ee6b6[_0x34ba9b]['total']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x2f')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x36')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x37')]=0x0;_0x1ee6b6[_0x34ba9b]['sumHoldTime']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x31')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x32')]=0x0;_0x1ee6b6[_0x34ba9b]['outboundAnswerAgiCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundNoAnswerCallsDay']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x38')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x39')]=0x0;_0x1ee6b6[_0x34ba9b]['outboundNoSuchCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundUnknownCallsDay']=0x0;_0x1ee6b6[_0x34ba9b]['outboundDropCallsDayTimeout']=0x0;_0x1ee6b6[_0x34ba9b]['outboundDropCallsDayCallersExit']=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3a')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3b')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3c')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3d')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3e')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x3f')]=0x0;_0x1ee6b6[_0x34ba9b][_0xc6a3('0x40')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x22881e,_0x49ac13){for(var _0x1f81bc in _0x49ac13){if(_0x22881e['hasOwnProperty'](_0x1f81bc)){_0x22881e[_0x1f81bc]=_0x49ac13[_0x1f81bc];}}};Realtime[_0xc6a3('0x41')][_0xc6a3('0x42')]=function(){var _0xd6d505=this;return function(_0x552908){if(_0x552908){freeIsNotKeyAgent(_0x552908,_0xd6d505[_0xc6a3('0x16')]);for(var _0x372a14=0x0,_0x2b61ab={},_0x5c1bb4={};_0x372a14<_0x552908[_0xc6a3('0x43')];_0x372a14+=0x1){_0x2b61ab=_0x552908[_0x372a14];var _0x27549c=_['isNil'](_0x2b61ab[_0xc6a3('0x2b')])?util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x2b61ab['name']):_0x2b61ab[_0xc6a3('0x2b')];if(_[_0xc6a3('0x44')](_0xd6d505[_0xc6a3('0x16')][_0x27549c])){_0xd6d505[_0xc6a3('0x16')][_0x27549c]=new Agent(_0x2b61ab);}else{_0xd6d505[_0xc6a3('0x45')](_0xd6d505[_0xc6a3('0x16')][_0x27549c],_0x2b61ab);}}}return _0xd6d505[_0xc6a3('0x16')];};};Realtime[_0xc6a3('0x41')]['initTelephones']=function(){var _0x1007a7=this;return function(_0x24477e){if(_0x24477e){freeIsNotKeySip(_0x24477e,_0x1007a7['telephones']);for(var _0x4a3366=0x0,_0x1ba5cb={},_0x4aa2dd={};_0x4a3366<_0x24477e[_0xc6a3('0x43')];_0x4a3366+=0x1){_0x1ba5cb=_0x24477e[_0x4a3366];if(_['isUndefined'](_0x1007a7[_0xc6a3('0x46')][util['format'](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])])){_0x1007a7['telephones'][util['format'](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])]=new Telephone(_0x1ba5cb);}else{_0x1007a7[_0xc6a3('0x45')](_0x1007a7[_0xc6a3('0x46')][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x1ba5cb[_0xc6a3('0x2e')])],_0x1ba5cb);}}}return _0x1007a7[_0xc6a3('0x46')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x47')]=function(){var _0x4334c1=this;return function(_0x274344){if(_0x274344){freeIsNotKeySip(_0x274344,_0x4334c1['trunks']);for(var _0x574783=0x0,_0x47f2d4={},_0x35c49a={};_0x574783<_0x274344[_0xc6a3('0x43')];_0x574783+=0x1){_0x47f2d4=_0x274344[_0x574783];if(_[_0xc6a3('0x44')](_0x4334c1['trunks'][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x47f2d4[_0xc6a3('0x2e')])])){_0x4334c1[_0xc6a3('0x17')][util[_0xc6a3('0x2c')](_0xc6a3('0x2d'),_0x47f2d4[_0xc6a3('0x2e')])]=new Trunk(_0x47f2d4);}else{_0x4334c1['mergeFromDatabase'](_0x4334c1[_0xc6a3('0x17')][util['format']('SIP/%s',_0x47f2d4['name'])],_0x47f2d4);}}}return _0x4334c1[_0xc6a3('0x17')];};};Realtime['prototype'][_0xc6a3('0x48')]=function(){var _0x10751c=this;return function(_0x1b8cea){if(_0x1b8cea){freeIsNotKey(_0x1b8cea,_0x10751c[_0xc6a3('0x49')],'name');for(var _0x45335f=0x0,_0x4410ae={},_0x40a081={};_0x45335f<_0x1b8cea[_0xc6a3('0x43')];_0x45335f+=0x1){_0x4410ae=_0x1b8cea[_0x45335f];if(_[_0xc6a3('0x44')](_0x10751c[_0xc6a3('0x49')][_0x4410ae[_0xc6a3('0x2e')]])){_0x10751c['voiceQueues'][_0x4410ae['name']]=new VoiceQueue(_0x4410ae);}else{_0x10751c[_0xc6a3('0x45')](_0x10751c['voiceQueues'][_0x4410ae[_0xc6a3('0x2e')]],_0x4410ae);}}}return _0x10751c['voiceQueues'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4a')]=function(){var _0x1fe3f6=this;return function(_0x4800b0){if(_0x4800b0){freeIsNotKey(_0x4800b0,_0x1fe3f6[_0xc6a3('0x18')],'id');for(var _0x387875=0x0,_0x13d807={},_0x464143={};_0x387875<_0x4800b0[_0xc6a3('0x43')];_0x387875+=0x1){_0x13d807=_0x4800b0[_0x387875];if(_[_0xc6a3('0x44')](_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']])){_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']]=new Trigger(_0x13d807);}else{_0x1fe3f6[_0xc6a3('0x45')](_0x1fe3f6[_0xc6a3('0x18')][_0x13d807['id']],_0x13d807);}}}return _0x1fe3f6[_0xc6a3('0x18')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4b')]=function(){var _0x186ae8=this;return function(_0x105d49){if(_0x105d49){freeIsNotKey(_0x105d49,_0x186ae8['templates'],'id');for(var _0x4d1aba=0x0,_0x32f8e4={},_0x224d24={};_0x4d1aba<_0x105d49[_0xc6a3('0x43')];_0x4d1aba+=0x1){_0x32f8e4=_0x105d49[_0x4d1aba];if(_[_0xc6a3('0x44')](_0x186ae8[_0xc6a3('0x4c')][_0x32f8e4['id']])){_0x186ae8[_0xc6a3('0x4c')][_0x32f8e4['id']]=new Template(_0x32f8e4);}else{_0x186ae8['mergeFromDatabase'](_0x186ae8['templates'][_0x32f8e4['id']],_0x32f8e4);}}}return _0x186ae8[_0xc6a3('0x4c')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x4d')]=function(){var _0x2fdd93=this;return function(_0x3fdef9){if(_0x3fdef9){freeIsNotKey(_0x3fdef9,_0x2fdd93[_0xc6a3('0x1f')],'id');for(var _0x4cbd85=0x0,_0x191876={},_0x1627ac={};_0x4cbd85<_0x3fdef9[_0xc6a3('0x43')];_0x4cbd85+=0x1){_0x191876=_0x3fdef9[_0x4cbd85];if(_[_0xc6a3('0x44')](_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']])){_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']]=new ZendeskAccount(_0x191876);}else{_0x2fdd93[_0xc6a3('0x45')](_0x2fdd93[_0xc6a3('0x1f')][_0x191876['id']],_0x191876);}}}return _0x2fdd93[_0xc6a3('0x1f')];};};Realtime['prototype'][_0xc6a3('0x4e')]=function(){var _0x47f9a9=this;return function(_0x4f80ba){if(_0x4f80ba){freeIsNotKey(_0x4f80ba,_0x47f9a9[_0xc6a3('0x4f')],'id');for(var _0x3422b2=0x0,_0x3a2e4b={},_0x513954={};_0x3422b2<_0x4f80ba[_0xc6a3('0x43')];_0x3422b2+=0x1){_0x3a2e4b=_0x4f80ba[_0x3422b2];if(_[_0xc6a3('0x44')](_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']])){_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']]=new SalesforceAccount(_0x3a2e4b);}else{_0x47f9a9[_0xc6a3('0x45')](_0x47f9a9[_0xc6a3('0x4f')][_0x3a2e4b['id']],_0x3a2e4b);}}}return _0x47f9a9['salesforceAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x50')]=function(){var _0x1f173f=this;return function(_0xe11797){if(_0xe11797){freeIsNotKey(_0xe11797,_0x1f173f['freshdeskAccounts'],'id');for(var _0x530d58=0x0,_0x206752={},_0x59a697={};_0x530d58<_0xe11797[_0xc6a3('0x43')];_0x530d58+=0x1){_0x206752=_0xe11797[_0x530d58];if(_[_0xc6a3('0x44')](_0x1f173f[_0xc6a3('0x21')][_0x206752['id']])){_0x1f173f[_0xc6a3('0x21')][_0x206752['id']]=new FreshdeskAccount(_0x206752);}else{_0x1f173f[_0xc6a3('0x45')](_0x1f173f[_0xc6a3('0x21')][_0x206752['id']],_0x206752);}}}return _0x1f173f[_0xc6a3('0x21')];};};Realtime['prototype'][_0xc6a3('0x51')]=function(){var _0x3d7b86=this;return function(_0x5df183){if(_0x5df183){freeIsNotKey(_0x5df183,_0x3d7b86[_0xc6a3('0x22')],'id');for(var _0x292868=0x0,_0x5dd0df={},_0x15c732={};_0x292868<_0x5df183['length'];_0x292868+=0x1){_0x5dd0df=_0x5df183[_0x292868];if(_['isUndefined'](_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']])){_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']]=new ZohoAccount(_0x5dd0df);}else{_0x3d7b86[_0xc6a3('0x45')](_0x3d7b86[_0xc6a3('0x22')][_0x5dd0df['id']],_0x5dd0df);}}}return _0x3d7b86['zohoAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x52')]=function(){var _0x33ed43=this;return function(_0x194e83){if(_0x194e83){freeIsNotKey(_0x194e83,_0x33ed43[_0xc6a3('0x23')],'id');for(var _0x24d989=0x0,_0x5a539d={},_0xeea1ed={};_0x24d989<_0x194e83[_0xc6a3('0x43')];_0x24d989+=0x1){_0x5a539d=_0x194e83[_0x24d989];if(_[_0xc6a3('0x44')](_0x33ed43[_0xc6a3('0x23')][_0x5a539d['id']])){_0x33ed43[_0xc6a3('0x23')][_0x5a539d['id']]=new DeskAccount(_0x5a539d);}else{_0x33ed43['mergeFromDatabase'](_0x33ed43['deskAccounts'][_0x5a539d['id']],_0x5a539d);}}}return _0x33ed43[_0xc6a3('0x23')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x53')]=function(){var _0xb9d98=this;return function(_0x395e1b){if(_0x395e1b){freeIsNotKey(_0x395e1b,_0xb9d98[_0xc6a3('0x20')],'id');for(var _0xb917e8=0x0,_0x51ee80={},_0x3cd2cc={};_0xb917e8<_0x395e1b[_0xc6a3('0x43')];_0xb917e8+=0x1){_0x51ee80=_0x395e1b[_0xb917e8];if(_[_0xc6a3('0x44')](_0xb9d98[_0xc6a3('0x20')][_0x51ee80['id']])){_0xb9d98['sugarcrmAccounts'][_0x51ee80['id']]=new SugarcrmAccount(_0x51ee80);}else{_0xb9d98['mergeFromDatabase'](_0xb9d98['sugarcrmAccounts'][_0x51ee80['id']],_0x51ee80);}}}return _0xb9d98['sugarcrmAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x54')]=function(){var _0x1d6bb0=this;return function(_0x1f568a){if(_0x1f568a){freeIsNotKey(_0x1f568a,_0x1d6bb0[_0xc6a3('0x55')],'id');for(var _0x32f593=0x0,_0x1e71e7={},_0x29b34c={};_0x32f593<_0x1f568a[_0xc6a3('0x43')];_0x32f593+=0x1){_0x1e71e7=_0x1f568a[_0x32f593];if(_['isUndefined'](_0x1d6bb0[_0xc6a3('0x55')][_0x1e71e7['id']])){_0x1d6bb0['vtigerAccounts'][_0x1e71e7['id']]=new VtigerAccount(_0x1e71e7);}else{_0x1d6bb0[_0xc6a3('0x45')](_0x1d6bb0['vtigerAccounts'][_0x1e71e7['id']],_0x1e71e7);}}}return _0x1d6bb0[_0xc6a3('0x55')];};};Realtime['prototype'][_0xc6a3('0x56')]=function(){var _0x3455d5=this;return function(_0x26e4f7){if(_0x26e4f7){freeIsNotKey(_0x26e4f7,_0x3455d5[_0xc6a3('0x24')],'id');for(var _0x59911b=0x0,_0x3b7977={},_0x3c7b50={};_0x59911b<_0x26e4f7[_0xc6a3('0x43')];_0x59911b+=0x1){_0x3b7977=_0x26e4f7[_0x59911b];if(_[_0xc6a3('0x44')](_0x3455d5['servicenowAccounts'][_0x3b7977['id']])){_0x3455d5[_0xc6a3('0x24')][_0x3b7977['id']]=new ServicenowAccount(_0x3b7977);}else{_0x3455d5[_0xc6a3('0x45')](_0x3455d5['servicenowAccounts'][_0x3b7977['id']],_0x3b7977);}}}return _0x3455d5[_0xc6a3('0x24')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x10aee6=this;return function(_0x460a6f){if(_0x460a6f){freeIsNotKey(_0x460a6f,_0x10aee6[_0xc6a3('0x25')],'id');for(var _0x31d932=0x0,_0x70f7b={},_0x28d3df={};_0x31d932<_0x460a6f[_0xc6a3('0x43')];_0x31d932+=0x1){_0x70f7b=_0x460a6f[_0x31d932];if(_[_0xc6a3('0x44')](_0x10aee6['dynamics365Accounts'][_0x70f7b['id']])){_0x10aee6[_0xc6a3('0x25')][_0x70f7b['id']]=new Dynamics365Account(_0x70f7b);}else{_0x10aee6[_0xc6a3('0x45')](_0x10aee6[_0xc6a3('0x25')][_0x70f7b['id']],_0x70f7b);}}}return _0x10aee6[_0xc6a3('0x25')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x57')]=function(){var _0x5b42a8=this;return function(_0x3c0bcb){if(_0x3c0bcb){freeIsNotKey(_0x3c0bcb,_0x5b42a8[_0xc6a3('0x26')],'id');for(var _0x35a7eb=0x0,_0x45b4dc={},_0x3ef9f4={};_0x35a7eb<_0x3c0bcb[_0xc6a3('0x43')];_0x35a7eb+=0x1){_0x45b4dc=_0x3c0bcb[_0x35a7eb];if(_[_0xc6a3('0x44')](_0x5b42a8[_0xc6a3('0x26')][_0x45b4dc['id']])){_0x5b42a8['freshsalesAccounts'][_0x45b4dc['id']]=new FreshsalesAccount(_0x45b4dc);}else{_0x5b42a8['mergeFromDatabase'](_0x5b42a8['freshsalesAccounts'][_0x45b4dc['id']],_0x45b4dc);}}}return _0x5b42a8['freshsalesAccounts'];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x58')]=function(){var _0x229d35=this;return function(_0x5459a5){for(var _0x213ad6=0x0;_0x213ad6<_0x5459a5[_0xc6a3('0x43')];_0x213ad6+=0x1){_[_0xc6a3('0x59')](_0x229d35['voiceQueues'][_0x5459a5[_0x213ad6]['name']],_0x5459a5[_0x213ad6]);}return _0x229d35['voiceQueues'];};};Realtime[_0xc6a3('0x41')]['initVoiceQueueReports']=function(){var _0x131a4c=this;return function(_0x46b48d){clearVoiceQueues(_0x131a4c['voiceQueues']);if(_0x46b48d){_0x46b48d=_[_0xc6a3('0x5a')](_0x46b48d,'uniqueid');for(var _0x36ddd3 in _0x46b48d){if(_0x46b48d[_0xc6a3('0x28')](_0x36ddd3)){var _0x2e5c9a={};for(var _0x2c0a97=0x0;_0x2c0a97<_0x46b48d[_0x36ddd3][_0xc6a3('0x43')];_0x2c0a97+=0x1){var _0x566953=_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5b')];if(_0x131a4c[_0xc6a3('0x49')][_0x566953]){if(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5c')]){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x36')]+=0x1;}if(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallerabandon']){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x37')]+=0x1;}_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x30')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallerleaveAt'])['diff'](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5d')]),_0xc6a3('0x5e'))||0x0;if(_0x2c0a97===_0x46b48d[_0x36ddd3][_0xc6a3('0x43')]-0x1){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x31')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97]['queuecallercompleteAt']||_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5f')]||_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x60')])[_0xc6a3('0x61')](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x5d')]),_0xc6a3('0x5e'))||0x0;_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x62')]+=0x1;if(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x63')]){_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x2f')]+=0x1;_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x32')]+=moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x64')])[_0xc6a3('0x61')](moment(_0x46b48d[_0x36ddd3][_0x2c0a97][_0xc6a3('0x65')]),_0xc6a3('0x5e'))||0x0;}}else{_0x131a4c[_0xc6a3('0x49')][_0x566953]['sumDuration']+=_0x131a4c[_0xc6a3('0x49')][_0x566953][_0xc6a3('0x30')]||0x0;}}}}}}return _0x131a4c[_0xc6a3('0x49')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x395774=this;return function(_0x3ee969){clearVoiceCallReports(_0x395774[_0xc6a3('0x19')]);if(_0x3ee969){for(var _0xa25938=0x0;_0xa25938<_0x3ee969[_0xc6a3('0x43')];_0xa25938+=0x1){_0x395774[_0xc6a3('0x19')][_0xc6a3('0x62')]+=0x1;_0x395774[_0xc6a3('0x19')][_0xc6a3('0x31')]+=_0x3ee969[_0xa25938][_0xc6a3('0x66')];if(_0x3ee969[_0xa25938][_0xc6a3('0x67')]===_0xc6a3('0x68')){_0x395774[_0xc6a3('0x19')][_0xc6a3('0x2f')]+=0x1;_0x395774['outbound'][_0xc6a3('0x30')]+=_0x3ee969[_0xa25938][_0xc6a3('0x66')]-_0x3ee969[_0xa25938][_0xc6a3('0x69')]||0x0;_0x395774[_0xc6a3('0x19')][_0xc6a3('0x32')]+=_0x3ee969[_0xa25938][_0xc6a3('0x69')];}}}return _0x395774[_0xc6a3('0x19')];};};Realtime['prototype'][_0xc6a3('0x6a')]=function(){var _0x28ea01=this;return function(_0x4f6f1a){if(_0x4f6f1a){freeIsNotKey(_0x4f6f1a,_0x28ea01['campaigns'],_0xc6a3('0x2e'));for(var _0x162f75=0x0,_0xb15af5={};_0x162f75<_0x4f6f1a[_0xc6a3('0x43')];_0x162f75+=0x1){_0xb15af5=_0x4f6f1a[_0x162f75];if(_[_0xc6a3('0x44')](_0x28ea01[_0xc6a3('0x6b')][_0xb15af5['name']])){_0x28ea01['campaigns'][_0xb15af5[_0xc6a3('0x2e')]]=new Campaign(_0xb15af5);}else{_0x28ea01[_0xc6a3('0x45')](_0x28ea01['campaigns'][_0xb15af5[_0xc6a3('0x2e')]],_0xb15af5);_0x28ea01[_0xc6a3('0x6b')][_0xb15af5[_0xc6a3('0x2e')]][_0xc6a3('0x6c')]=_0xb15af5[_0xc6a3('0x6d')]?_0xb15af5[_0xc6a3('0x6d')][_0xc6a3('0x2e')]:undefined;}}}return _0x28ea01[_0xc6a3('0x6b')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x6e')]=function(){var _0x231a90=this;return function(_0x545903){if(_0x545903){freeIsNotKey(_0x545903,_0x231a90[_0xc6a3('0x1a')],'id');for(var _0x2f2e33=0x0,_0x230435={};_0x2f2e33<_0x545903['length'];_0x2f2e33+=0x1){_0x230435=_0x545903[_0x2f2e33];if(_[_0xc6a3('0x44')](_0x231a90['voiceExtensions'][_0x230435['id']])){_0x231a90[_0xc6a3('0x1a')][_0x230435['id']]=new VoiceExtension(_0x230435);}else{_0x231a90[_0xc6a3('0x45')](_0x231a90[_0xc6a3('0x1a')][_0x230435['id']],_0x230435);}}}return _0x231a90[_0xc6a3('0x1a')];};};Realtime[_0xc6a3('0x41')][_0xc6a3('0x6f')]=function(){var _0x33956f=this;return function(_0x471377){clearCampaigns(_0x33956f[_0xc6a3('0x6b')]);for(var _0x2678cd=0x0;_0x2678cd<_0x471377[_0xc6a3('0x43')];_0x2678cd+=0x1){_[_0xc6a3('0x59')](_0x33956f[_0xc6a3('0x6b')][_0x471377[_0x2678cd][_0xc6a3('0x2e')]],_0x471377[_0x2678cd]);}return _0x33956f['campaigns'];};};Realtime[_0xc6a3('0x41')]['initFaxAccounts']=function(){var _0xd46584=this;return function(_0x493247){if(_0x493247){freeIsNotKey(_0x493247,_0xd46584[_0xc6a3('0x27')],'id');for(var _0x278e00=0x0,_0x5de818={},_0x21b1e0={};_0x278e00<_0x493247[_0xc6a3('0x43')];_0x278e00+=0x1){_0x5de818=_0x493247[_0x278e00];if(_[_0xc6a3('0x44')](_0xd46584[_0xc6a3('0x27')][_0x5de818['id']])){_0xd46584[_0xc6a3('0x27')][_0x5de818['id']]=new FaxAccount(_0x5de818);}else{_0xd46584[_0xc6a3('0x45')](_0xd46584[_0xc6a3('0x27')][_0x5de818['id']],_0x5de818);}}}return _0xd46584['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x2afc=['initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/dynamics365Account','../model/faxAccount','agents','trunks','voiceQueues','triggers','templates','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','telephones','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x2afc,0x87));var _0xc2af=function(_0x1d2e5e,_0x145ae6){_0x1d2e5e=_0x1d2e5e-0x0;var _0x4a1d68=_0x2afc[_0x1d2e5e];return _0x4a1d68;};'use strict';var BPromise=require(_0xc2af('0x0'));var util=require(_0xc2af('0x1'));var _=require(_0xc2af('0x2'));var moment=require('moment');var Agent=require(_0xc2af('0x3'));var Telephone=require(_0xc2af('0x4'));var Trunk=require(_0xc2af('0x5'));var VoiceQueue=require(_0xc2af('0x6'));var Trigger=require('../model/trigger');var Template=require(_0xc2af('0x7'));var Campaign=require(_0xc2af('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xc2af('0x9'));var SalesforceAccount=require(_0xc2af('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xc2af('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xc2af('0xc'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xc2af('0xd'));var Realtime=function(){this[_0xc2af('0xe')]={};this['telephones']={};this[_0xc2af('0xf')]={};this[_0xc2af('0x10')]={};this[_0xc2af('0x11')]={};this['campaigns']={};this[_0xc2af('0x12')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc2af('0x13')]={};this[_0xc2af('0x14')]={};this[_0xc2af('0x15')]={};this['outboundChannels']={};this[_0xc2af('0x16')]={};this[_0xc2af('0x17')]={};this[_0xc2af('0x18')]={};this['sugarcrmAccounts']={};this[_0xc2af('0x19')]={};this[_0xc2af('0x1a')]={};this[_0xc2af('0x1b')]={};this[_0xc2af('0x1c')]={};this[_0xc2af('0x1d')]={};this[_0xc2af('0x1e')]={};this[_0xc2af('0x1f')]={};this[_0xc2af('0x20')]={};};function freeIsNotKey(_0x38d2cf,_0x5aaf2,_0x522c95){var _0x3bf7f8=_[_0xc2af('0x21')](_0x38d2cf,function(_0xeea2a7,_0x1b7da1){return _0xeea2a7[_0x522c95];});for(var _0x574121 in _0x5aaf2){if(_0x5aaf2['hasOwnProperty'](_0x574121)){if(!_0x3bf7f8[_0x574121]){delete _0x5aaf2[_0x574121];}}}}function freeIsNotKeySip(_0x5504ca,_0x210153){var _0x34297e=_['mapKeys'](_0x5504ca,function(_0x984c9f,_0xbc747){return util[_0xc2af('0x22')](_0xc2af('0x23'),_0x984c9f[_0xc2af('0x24')]);});for(var _0x10d381 in _0x210153){if(_0x210153[_0xc2af('0x25')](_0x10d381)){if(!_0x34297e[_0x10d381]){delete _0x210153[_0x10d381];}}}}function freeIsNotKeyAgent(_0x55a4c4,_0x12c831){var _0x413b3d=_[_0xc2af('0x21')](_0x55a4c4,function(_0x1b01a3,_0x33eb15){var _0x5a7f6c=_[_0xc2af('0x26')](_0x1b01a3[_0xc2af('0x27')])?util[_0xc2af('0x22')](_0xc2af('0x23'),_0x1b01a3['name']):_0x1b01a3[_0xc2af('0x27')];return _0x5a7f6c;});for(var _0x69c032 in _0x12c831){if(_0x12c831['hasOwnProperty'](_0x69c032)){if(!_0x413b3d[_0x69c032]){delete _0x12c831[_0x69c032];}}}}function clearVoiceCallReports(_0x3ba535){_0x3ba535[_0xc2af('0x28')]=0x0;_0x3ba535[_0xc2af('0x29')]=0x0;_0x3ba535[_0xc2af('0x2a')]=0x0;_0x3ba535[_0xc2af('0x2b')]=0x0;_0x3ba535[_0xc2af('0x2c')]=0x0;}function clearCampaigns(_0x5e901e){if(!_['isEmpty'](_0x5e901e)){for(var _0xdb0204 in _0x5e901e){if(_0x5e901e[_0xc2af('0x25')](_0xdb0204)){_0x5e901e[_0xdb0204]['ivrTotalCallsDays']=0x0;_0x5e901e[_0xdb0204][_0xc2af('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x429639){if(!_[_0xc2af('0x2e')](_0x429639)){for(var _0x294401 in _0x429639){if(_0x429639[_0xc2af('0x25')](_0x294401)){_0x429639[_0x294401][_0xc2af('0x28')]=0x0;_0x429639[_0x294401][_0xc2af('0x29')]=0x0;_0x429639[_0x294401][_0xc2af('0x2f')]=0x0;_0x429639[_0x294401]['abandoned']=0x0;_0x429639[_0x294401]['sumHoldTime']=0x0;_0x429639[_0x294401]['sumDuration']=0x0;_0x429639[_0x294401][_0xc2af('0x2c')]=0x0;_0x429639[_0x294401][_0xc2af('0x30')]=0x0;_0x429639[_0x294401][_0xc2af('0x31')]=0x0;_0x429639[_0x294401][_0xc2af('0x32')]=0x0;_0x429639[_0x294401]['outboundCongestionCallsDay']=0x0;_0x429639[_0x294401][_0xc2af('0x33')]=0x0;_0x429639[_0x294401][_0xc2af('0x34')]=0x0;_0x429639[_0x294401]['outboundDropCallsDayTimeout']=0x0;_0x429639[_0x294401][_0xc2af('0x35')]=0x0;_0x429639[_0x294401][_0xc2af('0x36')]=0x0;_0x429639[_0x294401][_0xc2af('0x37')]=0x0;_0x429639[_0x294401][_0xc2af('0x38')]=0x0;_0x429639[_0x294401]['outboundReCallsDay']=0x0;_0x429639[_0x294401][_0xc2af('0x30')]=0x0;_0x429639[_0x294401][_0xc2af('0x39')]=0x0;_0x429639[_0x294401][_0xc2af('0x3a')]=!![];}}}}Realtime[_0xc2af('0x3b')][_0xc2af('0x3c')]=function(_0x3fbb57,_0x520085){for(var _0x29a4ab in _0x520085){if(_0x3fbb57[_0xc2af('0x25')](_0x29a4ab)){_0x3fbb57[_0x29a4ab]=_0x520085[_0x29a4ab];}}};Realtime[_0xc2af('0x3b')][_0xc2af('0x3d')]=function(){var _0x5e3a15=this;return function(_0x2ffedd){if(_0x2ffedd){freeIsNotKeyAgent(_0x2ffedd,_0x5e3a15['agents']);for(var _0x141dff=0x0,_0x12d682={},_0x5c478e={};_0x141dff<_0x2ffedd[_0xc2af('0x3e')];_0x141dff+=0x1){_0x12d682=_0x2ffedd[_0x141dff];var _0x25d2f3=_[_0xc2af('0x26')](_0x12d682[_0xc2af('0x27')])?util[_0xc2af('0x22')]('SIP/%s',_0x12d682[_0xc2af('0x24')]):_0x12d682[_0xc2af('0x27')];if(_[_0xc2af('0x3f')](_0x5e3a15[_0xc2af('0xe')][_0x25d2f3])){_0x5e3a15['agents'][_0x25d2f3]=new Agent(_0x12d682);}else{_0x5e3a15[_0xc2af('0x3c')](_0x5e3a15[_0xc2af('0xe')][_0x25d2f3],_0x12d682);}}}return _0x5e3a15['agents'];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x40')]=function(){var _0x15059e=this;return function(_0x3b9547){if(_0x3b9547){freeIsNotKeySip(_0x3b9547,_0x15059e[_0xc2af('0x41')]);for(var _0x4521ea=0x0,_0x40720a={},_0x491d18={};_0x4521ea<_0x3b9547[_0xc2af('0x3e')];_0x4521ea+=0x1){_0x40720a=_0x3b9547[_0x4521ea];if(_['isUndefined'](_0x15059e['telephones'][util['format'](_0xc2af('0x23'),_0x40720a[_0xc2af('0x24')])])){_0x15059e[_0xc2af('0x41')][util[_0xc2af('0x22')]('SIP/%s',_0x40720a['name'])]=new Telephone(_0x40720a);}else{_0x15059e[_0xc2af('0x3c')](_0x15059e['telephones'][util[_0xc2af('0x22')](_0xc2af('0x23'),_0x40720a[_0xc2af('0x24')])],_0x40720a);}}}return _0x15059e[_0xc2af('0x41')];};};Realtime[_0xc2af('0x3b')]['initTrunks']=function(){var _0x68d071=this;return function(_0x52bbdf){if(_0x52bbdf){freeIsNotKeySip(_0x52bbdf,_0x68d071['trunks']);for(var _0x3e3ad7=0x0,_0x41945e={},_0x36ca6a={};_0x3e3ad7<_0x52bbdf[_0xc2af('0x3e')];_0x3e3ad7+=0x1){_0x41945e=_0x52bbdf[_0x3e3ad7];if(_[_0xc2af('0x3f')](_0x68d071[_0xc2af('0xf')][util[_0xc2af('0x22')](_0xc2af('0x23'),_0x41945e[_0xc2af('0x24')])])){_0x68d071['trunks'][util[_0xc2af('0x22')](_0xc2af('0x23'),_0x41945e[_0xc2af('0x24')])]=new Trunk(_0x41945e);}else{_0x68d071[_0xc2af('0x3c')](_0x68d071[_0xc2af('0xf')][util['format']('SIP/%s',_0x41945e[_0xc2af('0x24')])],_0x41945e);}}}return _0x68d071[_0xc2af('0xf')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x42')]=function(){var _0x5335ee=this;return function(_0x26133e){if(_0x26133e){freeIsNotKey(_0x26133e,_0x5335ee[_0xc2af('0x10')],_0xc2af('0x24'));for(var _0x3de5dc=0x0,_0xa93866={},_0x20de86={};_0x3de5dc<_0x26133e[_0xc2af('0x3e')];_0x3de5dc+=0x1){_0xa93866=_0x26133e[_0x3de5dc];if(_['isUndefined'](_0x5335ee[_0xc2af('0x10')][_0xa93866[_0xc2af('0x24')]])){_0x5335ee[_0xc2af('0x10')][_0xa93866[_0xc2af('0x24')]]=new VoiceQueue(_0xa93866);}else{_0x5335ee[_0xc2af('0x3c')](_0x5335ee[_0xc2af('0x10')][_0xa93866[_0xc2af('0x24')]],_0xa93866);}}}return _0x5335ee[_0xc2af('0x10')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x43')]=function(){var _0x525b1e=this;return function(_0x43715e){if(_0x43715e){freeIsNotKey(_0x43715e,_0x525b1e[_0xc2af('0x11')],'id');for(var _0x414f76=0x0,_0x289ea2={},_0x133c8d={};_0x414f76<_0x43715e[_0xc2af('0x3e')];_0x414f76+=0x1){_0x289ea2=_0x43715e[_0x414f76];if(_[_0xc2af('0x3f')](_0x525b1e[_0xc2af('0x11')][_0x289ea2['id']])){_0x525b1e[_0xc2af('0x11')][_0x289ea2['id']]=new Trigger(_0x289ea2);}else{_0x525b1e[_0xc2af('0x3c')](_0x525b1e[_0xc2af('0x11')][_0x289ea2['id']],_0x289ea2);}}}return _0x525b1e['triggers'];};};Realtime['prototype'][_0xc2af('0x44')]=function(){var _0x35b317=this;return function(_0x3013f6){if(_0x3013f6){freeIsNotKey(_0x3013f6,_0x35b317[_0xc2af('0x12')],'id');for(var _0x1f496a=0x0,_0x4e73b9={},_0x14fe8e={};_0x1f496a<_0x3013f6['length'];_0x1f496a+=0x1){_0x4e73b9=_0x3013f6[_0x1f496a];if(_[_0xc2af('0x3f')](_0x35b317[_0xc2af('0x12')][_0x4e73b9['id']])){_0x35b317[_0xc2af('0x12')][_0x4e73b9['id']]=new Template(_0x4e73b9);}else{_0x35b317[_0xc2af('0x3c')](_0x35b317[_0xc2af('0x12')][_0x4e73b9['id']],_0x4e73b9);}}}return _0x35b317[_0xc2af('0x12')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x45')]=function(){var _0x41f15b=this;return function(_0x53153c){if(_0x53153c){freeIsNotKey(_0x53153c,_0x41f15b[_0xc2af('0x17')],'id');for(var _0x5a26c4=0x0,_0x5a8a02={},_0x28d1c2={};_0x5a26c4<_0x53153c[_0xc2af('0x3e')];_0x5a26c4+=0x1){_0x5a8a02=_0x53153c[_0x5a26c4];if(_[_0xc2af('0x3f')](_0x41f15b[_0xc2af('0x17')][_0x5a8a02['id']])){_0x41f15b[_0xc2af('0x17')][_0x5a8a02['id']]=new ZendeskAccount(_0x5a8a02);}else{_0x41f15b[_0xc2af('0x3c')](_0x41f15b[_0xc2af('0x17')][_0x5a8a02['id']],_0x5a8a02);}}}return _0x41f15b[_0xc2af('0x17')];};};Realtime['prototype'][_0xc2af('0x46')]=function(){var _0x3dd51d=this;return function(_0x2f88d3){if(_0x2f88d3){freeIsNotKey(_0x2f88d3,_0x3dd51d[_0xc2af('0x18')],'id');for(var _0x52f1fe=0x0,_0x1a1f6b={},_0x305101={};_0x52f1fe<_0x2f88d3['length'];_0x52f1fe+=0x1){_0x1a1f6b=_0x2f88d3[_0x52f1fe];if(_[_0xc2af('0x3f')](_0x3dd51d[_0xc2af('0x18')][_0x1a1f6b['id']])){_0x3dd51d['salesforceAccounts'][_0x1a1f6b['id']]=new SalesforceAccount(_0x1a1f6b);}else{_0x3dd51d[_0xc2af('0x3c')](_0x3dd51d[_0xc2af('0x18')][_0x1a1f6b['id']],_0x1a1f6b);}}}return _0x3dd51d[_0xc2af('0x18')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x47')]=function(){var _0x399723=this;return function(_0x1103e4){if(_0x1103e4){freeIsNotKey(_0x1103e4,_0x399723[_0xc2af('0x19')],'id');for(var _0x23d23a=0x0,_0x5be498={},_0x1c638c={};_0x23d23a<_0x1103e4[_0xc2af('0x3e')];_0x23d23a+=0x1){_0x5be498=_0x1103e4[_0x23d23a];if(_[_0xc2af('0x3f')](_0x399723['freshdeskAccounts'][_0x5be498['id']])){_0x399723['freshdeskAccounts'][_0x5be498['id']]=new FreshdeskAccount(_0x5be498);}else{_0x399723['mergeFromDatabase'](_0x399723['freshdeskAccounts'][_0x5be498['id']],_0x5be498);}}}return _0x399723[_0xc2af('0x19')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x48')]=function(){var _0x598c6d=this;return function(_0x188733){if(_0x188733){freeIsNotKey(_0x188733,_0x598c6d['zohoAccounts'],'id');for(var _0xd1954e=0x0,_0x21afa1={},_0x3deb37={};_0xd1954e<_0x188733[_0xc2af('0x3e')];_0xd1954e+=0x1){_0x21afa1=_0x188733[_0xd1954e];if(_[_0xc2af('0x3f')](_0x598c6d['zohoAccounts'][_0x21afa1['id']])){_0x598c6d['zohoAccounts'][_0x21afa1['id']]=new ZohoAccount(_0x21afa1);}else{_0x598c6d[_0xc2af('0x3c')](_0x598c6d['zohoAccounts'][_0x21afa1['id']],_0x21afa1);}}}return _0x598c6d[_0xc2af('0x1a')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x49')]=function(){var _0x458dea=this;return function(_0x5423e1){if(_0x5423e1){freeIsNotKey(_0x5423e1,_0x458dea[_0xc2af('0x1b')],'id');for(var _0x462614=0x0,_0x583ce4={},_0x414cd6={};_0x462614<_0x5423e1['length'];_0x462614+=0x1){_0x583ce4=_0x5423e1[_0x462614];if(_[_0xc2af('0x3f')](_0x458dea['deskAccounts'][_0x583ce4['id']])){_0x458dea['deskAccounts'][_0x583ce4['id']]=new DeskAccount(_0x583ce4);}else{_0x458dea[_0xc2af('0x3c')](_0x458dea[_0xc2af('0x1b')][_0x583ce4['id']],_0x583ce4);}}}return _0x458dea['deskAccounts'];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x4a')]=function(){var _0x45bb1f=this;return function(_0x54b755){if(_0x54b755){freeIsNotKey(_0x54b755,_0x45bb1f['sugarcrmAccounts'],'id');for(var _0x31de2f=0x0,_0x3a20e9={},_0x2c402a={};_0x31de2f<_0x54b755[_0xc2af('0x3e')];_0x31de2f+=0x1){_0x3a20e9=_0x54b755[_0x31de2f];if(_[_0xc2af('0x3f')](_0x45bb1f['sugarcrmAccounts'][_0x3a20e9['id']])){_0x45bb1f[_0xc2af('0x4b')][_0x3a20e9['id']]=new SugarcrmAccount(_0x3a20e9);}else{_0x45bb1f['mergeFromDatabase'](_0x45bb1f[_0xc2af('0x4b')][_0x3a20e9['id']],_0x3a20e9);}}}return _0x45bb1f[_0xc2af('0x4b')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x4c')]=function(){var _0x50b73a=this;return function(_0x1b0982){if(_0x1b0982){freeIsNotKey(_0x1b0982,_0x50b73a[_0xc2af('0x1c')],'id');for(var _0x2cc27e=0x0,_0x2d3c7e={},_0x304956={};_0x2cc27e<_0x1b0982['length'];_0x2cc27e+=0x1){_0x2d3c7e=_0x1b0982[_0x2cc27e];if(_['isUndefined'](_0x50b73a['vtigerAccounts'][_0x2d3c7e['id']])){_0x50b73a[_0xc2af('0x1c')][_0x2d3c7e['id']]=new VtigerAccount(_0x2d3c7e);}else{_0x50b73a[_0xc2af('0x3c')](_0x50b73a[_0xc2af('0x1c')][_0x2d3c7e['id']],_0x2d3c7e);}}}return _0x50b73a[_0xc2af('0x1c')];};};Realtime[_0xc2af('0x3b')]['initServicenowAccounts']=function(){var _0x25234f=this;return function(_0x1206cf){if(_0x1206cf){freeIsNotKey(_0x1206cf,_0x25234f[_0xc2af('0x1d')],'id');for(var _0x35c06e=0x0,_0x340ae4={},_0x25c1ab={};_0x35c06e<_0x1206cf[_0xc2af('0x3e')];_0x35c06e+=0x1){_0x340ae4=_0x1206cf[_0x35c06e];if(_[_0xc2af('0x3f')](_0x25234f['servicenowAccounts'][_0x340ae4['id']])){_0x25234f[_0xc2af('0x1d')][_0x340ae4['id']]=new ServicenowAccount(_0x340ae4);}else{_0x25234f['mergeFromDatabase'](_0x25234f['servicenowAccounts'][_0x340ae4['id']],_0x340ae4);}}}return _0x25234f[_0xc2af('0x1d')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x4d')]=function(){var _0x489636=this;return function(_0x1cf985){if(_0x1cf985){freeIsNotKey(_0x1cf985,_0x489636[_0xc2af('0x1e')],'id');for(var _0x4ff6c9=0x0,_0x40fd09={},_0x3ab44f={};_0x4ff6c9<_0x1cf985[_0xc2af('0x3e')];_0x4ff6c9+=0x1){_0x40fd09=_0x1cf985[_0x4ff6c9];if(_['isUndefined'](_0x489636['dynamics365Accounts'][_0x40fd09['id']])){_0x489636[_0xc2af('0x1e')][_0x40fd09['id']]=new Dynamics365Account(_0x40fd09);}else{_0x489636[_0xc2af('0x3c')](_0x489636[_0xc2af('0x1e')][_0x40fd09['id']],_0x40fd09);}}}return _0x489636[_0xc2af('0x1e')];};};Realtime[_0xc2af('0x3b')]['initFreshsalesAccounts']=function(){var _0x57609c=this;return function(_0x21e44f){if(_0x21e44f){freeIsNotKey(_0x21e44f,_0x57609c[_0xc2af('0x1f')],'id');for(var _0x2de6a1=0x0,_0x16a327={},_0x4c256a={};_0x2de6a1<_0x21e44f[_0xc2af('0x3e')];_0x2de6a1+=0x1){_0x16a327=_0x21e44f[_0x2de6a1];if(_[_0xc2af('0x3f')](_0x57609c['freshsalesAccounts'][_0x16a327['id']])){_0x57609c[_0xc2af('0x1f')][_0x16a327['id']]=new FreshsalesAccount(_0x16a327);}else{_0x57609c['mergeFromDatabase'](_0x57609c[_0xc2af('0x1f')][_0x16a327['id']],_0x16a327);}}}return _0x57609c[_0xc2af('0x1f')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x4e')]=function(){var _0x22396c=this;return function(_0x135aa2){for(var _0x4c7549=0x0;_0x4c7549<_0x135aa2[_0xc2af('0x3e')];_0x4c7549+=0x1){_[_0xc2af('0x4f')](_0x22396c[_0xc2af('0x10')][_0x135aa2[_0x4c7549][_0xc2af('0x24')]],_0x135aa2[_0x4c7549]);}return _0x22396c[_0xc2af('0x10')];};};Realtime['prototype'][_0xc2af('0x50')]=function(){var _0x5754e2=this;return function(_0x4180da){clearVoiceQueues(_0x5754e2['voiceQueues']);if(_0x4180da){_0x4180da=_[_0xc2af('0x51')](_0x4180da,_0xc2af('0x52'));for(var _0x11145f in _0x4180da){if(_0x4180da[_0xc2af('0x25')](_0x11145f)){var _0x24777f={};for(var _0x5ef680=0x0;_0x5ef680<_0x4180da[_0x11145f][_0xc2af('0x3e')];_0x5ef680+=0x1){var _0xc90c77=_0x4180da[_0x11145f][_0x5ef680]['queue'];if(_0x5754e2[_0xc2af('0x10')][_0xc90c77]){if(_0x4180da[_0x11145f][_0x5ef680]['queuecallerexit']){_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x2f')]+=0x1;}if(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x53')]){_0x5754e2[_0xc2af('0x10')][_0xc90c77]['abandoned']+=0x1;}_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x2a')]+=moment(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x54')])[_0xc2af('0x55')](moment(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x56')]),'seconds')||0x0;if(_0x5ef680===_0x4180da[_0x11145f][_0xc2af('0x3e')]-0x1){_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x2b')]+=moment(_0x4180da[_0x11145f][_0x5ef680]['queuecallercompleteAt']||_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x57')]||_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x58')])['diff'](moment(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x56')]),_0xc2af('0x59'))||0x0;_0x5754e2[_0xc2af('0x10')][_0xc90c77]['total']+=0x1;if(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x5a')]){_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x29')]+=0x1;_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x2c')]+=moment(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x5b')])[_0xc2af('0x55')](moment(_0x4180da[_0x11145f][_0x5ef680][_0xc2af('0x54')]),_0xc2af('0x59'))||0x0;}}else{_0x5754e2[_0xc2af('0x10')][_0xc90c77][_0xc2af('0x2b')]+=_0x5754e2[_0xc2af('0x10')][_0xc90c77]['sumHoldTime']||0x0;}}}}}}return _0x5754e2[_0xc2af('0x10')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x5c')]=function(){var _0x3a17c9=this;return function(_0x54c43c){clearVoiceCallReports(_0x3a17c9[_0xc2af('0x5d')]);if(_0x54c43c){for(var _0x5c1a22=0x0;_0x5c1a22<_0x54c43c['length'];_0x5c1a22+=0x1){_0x3a17c9['outbound'][_0xc2af('0x28')]+=0x1;_0x3a17c9['outbound'][_0xc2af('0x2b')]+=_0x54c43c[_0x5c1a22][_0xc2af('0x5e')];if(_0x54c43c[_0x5c1a22][_0xc2af('0x5f')]===_0xc2af('0x60')){_0x3a17c9['outbound'][_0xc2af('0x29')]+=0x1;_0x3a17c9[_0xc2af('0x5d')][_0xc2af('0x2a')]+=_0x54c43c[_0x5c1a22][_0xc2af('0x5e')]-_0x54c43c[_0x5c1a22]['billableseconds']||0x0;_0x3a17c9['outbound'][_0xc2af('0x2c')]+=_0x54c43c[_0x5c1a22][_0xc2af('0x61')];}}}return _0x3a17c9[_0xc2af('0x5d')];};};Realtime['prototype'][_0xc2af('0x62')]=function(){var _0x17c141=this;return function(_0x244f73){if(_0x244f73){freeIsNotKey(_0x244f73,_0x17c141['campaigns'],_0xc2af('0x24'));for(var _0x45b09c=0x0,_0x4b0ddd={};_0x45b09c<_0x244f73['length'];_0x45b09c+=0x1){_0x4b0ddd=_0x244f73[_0x45b09c];if(_['isUndefined'](_0x17c141[_0xc2af('0x63')][_0x4b0ddd['name']])){_0x17c141[_0xc2af('0x63')][_0x4b0ddd['name']]=new Campaign(_0x4b0ddd);}else{_0x17c141[_0xc2af('0x3c')](_0x17c141['campaigns'][_0x4b0ddd[_0xc2af('0x24')]],_0x4b0ddd);_0x17c141[_0xc2af('0x63')][_0x4b0ddd[_0xc2af('0x24')]][_0xc2af('0x64')]=_0x4b0ddd[_0xc2af('0x65')]?_0x4b0ddd['SquareProject'][_0xc2af('0x24')]:undefined;}}}return _0x17c141[_0xc2af('0x63')];};};Realtime[_0xc2af('0x3b')][_0xc2af('0x66')]=function(){var _0x6069ae=this;return function(_0x5223e3){if(_0x5223e3){freeIsNotKey(_0x5223e3,_0x6069ae['voiceExtensions'],'id');for(var _0x21402b=0x0,_0x3cd298={};_0x21402b<_0x5223e3[_0xc2af('0x3e')];_0x21402b+=0x1){_0x3cd298=_0x5223e3[_0x21402b];if(_['isUndefined'](_0x6069ae[_0xc2af('0x13')][_0x3cd298['id']])){_0x6069ae[_0xc2af('0x13')][_0x3cd298['id']]=new VoiceExtension(_0x3cd298);}else{_0x6069ae[_0xc2af('0x3c')](_0x6069ae[_0xc2af('0x13')][_0x3cd298['id']],_0x3cd298);}}}return _0x6069ae[_0xc2af('0x13')];};};Realtime[_0xc2af('0x3b')]['initCampaignHopperHistory']=function(){var _0xbd1975=this;return function(_0xcd7537){clearCampaigns(_0xbd1975[_0xc2af('0x63')]);for(var _0x392d67=0x0;_0x392d67<_0xcd7537[_0xc2af('0x3e')];_0x392d67+=0x1){_[_0xc2af('0x4f')](_0xbd1975['campaigns'][_0xcd7537[_0x392d67][_0xc2af('0x24')]],_0xcd7537[_0x392d67]);}return _0xbd1975[_0xc2af('0x63')];};};Realtime[_0xc2af('0x3b')]['initFaxAccounts']=function(){var _0x5c84c2=this;return function(_0x16865e){if(_0x16865e){freeIsNotKey(_0x16865e,_0x5c84c2['faxAccounts'],'id');for(var _0x555102=0x0,_0xff6060={},_0x187b29={};_0x555102<_0x16865e[_0xc2af('0x3e')];_0x555102+=0x1){_0xff6060=_0x16865e[_0x555102];if(_[_0xc2af('0x3f')](_0x5c84c2[_0xc2af('0x20')][_0xff6060['id']])){_0x5c84c2[_0xc2af('0x20')][_0xff6060['id']]=new FaxAccount(_0xff6060);}else{_0x5c84c2[_0xc2af('0x3c')](_0x5c84c2[_0xc2af('0x20')][_0xff6060['id']],_0xff6060);}}}return _0x5c84c2[_0xc2af('0x20')];};};module[_0xc2af('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 2d13771..ea7a76f 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 _0x79a3=['disabled','voiceQueueReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','calleridname','monitor','length','monitorFilename','createdAt','monitors','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','indexOf','mobile','phone','substring','lastIndexOf','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x79a3,0x137));var _0x379a=function(_0x5e76be,_0x260463){_0x5e76be=_0x5e76be-0x0;var _0x51cb9c=_0x79a3[_0x5e76be];return _0x51cb9c;};'use strict';var BPromise=require(_0x379a('0x0'));var _=require(_0x379a('0x1'));var moment=require(_0x379a('0x2'));var util=require('util');var config=require(_0x379a('0x3'));var logger=require(_0x379a('0x4'))('ami');var ami=require(_0x379a('0x5'));var RpcVoiceAgentReport=require(_0x379a('0x6'));var RpcVoiceCallReport=require(_0x379a('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x379a('0x8'));var RpcVoiceRecording=require(_0x379a('0x9'));var RpcVoiceTransferReport=require(_0x379a('0xa'));var VoiceQueueReport=require(_0x379a('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x379a('0xc'));var VoiceDialReport=require(_0x379a('0xd'));var UserReport=require(_0x379a('0xe'));function Report(_0x497bdd){this[_0x379a('0xf')]=_0x497bdd;this[_0x379a('0x10')]=_0x497bdd['agents'];this['telephones']=_0x497bdd[_0x379a('0x11')];}Report[_0x379a('0x12')][_0x379a('0x13')]=function(_0x3afbf7){var _0x34bee5=new VoiceQueueReport(this[_0x379a('0xf')]);var _0x4a11ff=new VoiceAgentReport(this[_0x379a('0xf')]);var _0x13945b=new VoiceDialReport(this[_0x379a('0xf')]);var _0x4fad10=new VoiceCallReport(this[_0x379a('0xf')]);var _0x258fd6=new UserReport(this[_0x379a('0xf')]);if(config['xdr']&&config[_0x379a('0x14')][_0x379a('0x15')]){ami['on']('custom:voiceQueueReport',this[_0x379a('0x16')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0x379a('0x17')][_0x379a('0x18')](this));ami['on'](_0x379a('0x19'),this[_0x379a('0x1a')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1b'),this[_0x379a('0x1c')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1d'),this[_0x379a('0x1e')][_0x379a('0x18')](this));ami['on'](_0x379a('0x1f'),this[_0x379a('0x20')][_0x379a('0x18')](this));}};Report['prototype'][_0x379a('0x21')]=function(_0x43228b){var _0x21dae4=undefined;_0x21dae4=_[_0x379a('0x22')](this[_0x379a('0x10')],function(_0x15f57b){return _0x15f57b[_0x379a('0x23')]==_0x43228b||_0x15f57b[_0x379a('0x24')]==_0x43228b;});if(_[_0x379a('0x25')](_0x21dae4)){var _0x1763a2=_[_0x379a('0x22')](this[_0x379a('0x11')],function(_0x5024ff){return _0x5024ff['accountcode']==_0x43228b||_0x5024ff[_0x379a('0x24')]==_0x43228b;});if(_0x1763a2){_0x21dae4=_['find'](this[_0x379a('0x10')],function(_0x5eed14){return _0x5eed14[_0x379a('0x26')]==util[_0x379a('0x27')](_0x379a('0x28'),_0x1763a2[_0x379a('0x24')]);});}}return _0x21dae4;};Report[_0x379a('0x12')]['voiceQueueReport']=function(_0x33290c){for(var _0xf0b34b=0x0;_0xf0b34b<_0x33290c['length'];_0xf0b34b+=0x1){var _0x4cb7e0=this[_0x379a('0x21')](_0x33290c[_0xf0b34b][_0x379a('0x29')]);if(_0x4cb7e0){_0x33290c[_0xf0b34b][_0x379a('0x23')]=_0x4cb7e0[_0x379a('0x23')];_0x33290c[_0xf0b34b][_0x379a('0x2a')]=!![];_0x33290c[_0xf0b34b][_0x379a('0x2b')]=_0x4cb7e0['name'];_0x33290c[_0xf0b34b][_0x379a('0x26')]=_[_0x379a('0x25')](_0x4cb7e0[_0x379a('0x26')])?util[_0x379a('0x27')](_0x379a('0x28'),_0x4cb7e0['name']):_0x4cb7e0[_0x379a('0x26')];if(_0x33290c[_0xf0b34b][_0x379a('0x2c')]){_0x33290c[_0xf0b34b]['queuecallercompleteAt']=moment()[_0x379a('0x27')](_0x379a('0x2d'));}if(_0x33290c[_0xf0b34b][_0x379a('0x2e')]){_0x33290c[_0xf0b34b][_0x379a('0x2f')]=moment()[_0x379a('0x27')](_0x379a('0x2d'));}RpcMemberReport[_0x379a('0x16')](_0x33290c[_0xf0b34b]);}RpcVoiceQueueReport[_0x379a('0x30')](_0x33290c[_0xf0b34b]);}};function extractCalleridNumber(_0x568ba3){var _0x56e1e5=_0x568ba3['match'](/<(.*?)>/);return _0x56e1e5?_0x56e1e5[0x1]:_0x568ba3;}Report[_0x379a('0x12')]['voiceCallReport']=function(_0x11eba1){_0x11eba1[_0x379a('0x31')]=_0x11eba1[_0x379a('0x31')]||_0x11eba1[_0x379a('0x32')];if(_0x11eba1['type']==_0x379a('0x33')){_0x11eba1[_0x379a('0x34')]='queue';_0x11eba1[_0x379a('0x35')]=_0x11eba1[_0x379a('0x36')];if(_0x11eba1[_0x379a('0x37')]==_0x379a('0x38')){_0x11eba1['accountcode']='';_0x11eba1[_0x379a('0x31')]=extractCalleridNumber(_0x11eba1[_0x379a('0x39')]);}else if(_0x11eba1[_0x379a('0x37')]==_0x379a('0x3a')){if(_0x11eba1[_0x379a('0x31')]==_0x379a('0x3b')){_0x11eba1['destination']=extractCalleridNumber(_0x11eba1[_0x379a('0x3c')]);_0x11eba1['calleridnum']=_0x11eba1[_0x379a('0x3d')];_0x11eba1[_0x379a('0x3e')]=[_0x11eba1[_0x379a('0x3f')],_0x11eba1[_0x379a('0x3f')]=_0x11eba1[_0x379a('0x3e')]][0x0];_0x11eba1['callerid']=_0x11eba1[_0x379a('0x3c')];}else{_0x11eba1['destination']=_0x11eba1['calleridnum'];_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x3d')];if(_0x11eba1['disposition']==_0x379a('0x41')){_0x11eba1[_0x379a('0x23')]=_0x11eba1[_0x379a('0x29')];}else{_0x11eba1[_0x379a('0x23')]='';}}}}else{_0x11eba1[_0x379a('0x39')]=util[_0x379a('0x27')]('\x22%s\x22\x20<%s>',_0x11eba1[_0x379a('0x42')],_0x11eba1[_0x379a('0x40')]);}RpcVoiceCallReport[_0x379a('0x30')](_0x11eba1);if(_0x11eba1[_0x379a('0x43')]){for(var _0x50910a=0x0;_0x50910a<_0x11eba1['monitors'][_0x379a('0x44')];_0x50910a+=0x1){_0x11eba1[_0x379a('0x45')]=_0x11eba1['monitors'][_0x50910a]['filename'];_0x11eba1[_0x379a('0x46')]=_0x11eba1[_0x379a('0x47')][_0x50910a][_0x379a('0x46')];if(_0x11eba1[_0x379a('0x32')]==_0x379a('0x3b')){_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x29')];_0x11eba1[_0x379a('0x42')]=_0x11eba1['connectedlinename'];_0x11eba1['connectedlinenum']=_0x11eba1[_0x379a('0x23')];_0x11eba1[_0x379a('0x48')]=_0x11eba1[_0x379a('0x49')];_0x11eba1[_0x379a('0x32')]=_0x11eba1[_0x379a('0x3d')];}else if(_0x11eba1[_0x379a('0x32')]==_0x379a('0x4a')){_0x11eba1[_0x379a('0x40')]=_0x11eba1[_0x379a('0x31')];_0x11eba1[_0x379a('0x32')]=_0x11eba1[_0x379a('0x3d')];}RpcVoiceRecording[_0x379a('0x30')](_0x11eba1);}}};Report[_0x379a('0x12')][_0x379a('0x1a')]=function(_0x25ff66){if(_[_0x379a('0x4b')](_0x25ff66)){_0x25ff66[_0x379a('0x4c')](function(_0x5b31aa){RpcVoiceAgentReport[_0x379a('0x30')](_0x5b31aa);});}else{RpcVoiceAgentReport[_0x379a('0x30')](_0x25ff66);}};Report[_0x379a('0x12')]['voiceDialReport']=function(_0x3be311){RpcVoiceDialReport[_0x379a('0x30')](_0x3be311);var _0x454967=undefined;var _0xdeb235=_0x3be311['channel'];if(_['startsWith'](_0xdeb235,'Local')){var _0x142952=_0xdeb235['substring'](_0xdeb235[_0x379a('0x4d')]('/')+0x1,_0xdeb235[_0x379a('0x4d')]('@'));_0x454967=_['find'](this[_0x379a('0x10')],function(_0x516a92){return _0x516a92[_0x379a('0x4e')]==_0x142952||_0x516a92[_0x379a('0x4f')]==_0x142952||_0x516a92['accountcode']==_0x142952;});}else{var _0x142952=_0xdeb235[_0x379a('0x50')](_0xdeb235[_0x379a('0x4d')]('/')+0x1,_0xdeb235[_0x379a('0x51')]('-'));_0x454967=this[_0x379a('0x21')](_0x142952);}if(_0x454967){_0x3be311[_0x379a('0x26')]=_[_0x379a('0x25')](_0x454967['interface'])?util[_0x379a('0x27')](_0x379a('0x28'),_0x454967[_0x379a('0x24')]):_0x454967[_0x379a('0x26')];_0x3be311['membername']=_0x454967[_0x379a('0x24')];_0x3be311[_0x379a('0x23')]=_0x454967['accountcode'];RpcMemberReport['voiceDialReport'](_0x3be311);}};Report[_0x379a('0x12')][_0x379a('0x1e')]=function(_0x2465b9){RpcVoiceTransferReport[_0x379a('0x1e')](_0x2465b9);};Report['prototype'][_0x379a('0x20')]=function(_0x4923c3){RpcVoiceTransferReport['attendedTransfer'](_0x4923c3);};module[_0x379a('0x52')]=Report; \ No newline at end of file +var _0x1e98=['custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','voiceCallReport','destination','type','lastapplication','queue','callerid','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','calleridpreview','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','monitors','filename','createdAt','exten','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','bluebird','moment','util','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1e98,0x17c));var _0x81e9=function(_0x37d5ff,_0x5ee83b){_0x37d5ff=_0x37d5ff-0x0;var _0x146b37=_0x1e98[_0x37d5ff];return _0x146b37;};'use strict';var BPromise=require(_0x81e9('0x0'));var _=require('lodash');var moment=require(_0x81e9('0x1'));var util=require(_0x81e9('0x2'));var config=require('../../../config/environment');var logger=require(_0x81e9('0x3'))(_0x81e9('0x4'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x81e9('0x5'));var RpcVoiceCallReport=require(_0x81e9('0x6'));var RpcVoiceDialReport=require(_0x81e9('0x7'));var RpcMemberReport=require(_0x81e9('0x8'));var RpcVoiceQueueReport=require(_0x81e9('0x9'));var RpcVoiceRecording=require(_0x81e9('0xa'));var RpcVoiceTransferReport=require(_0x81e9('0xb'));var VoiceQueueReport=require(_0x81e9('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x81e9('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x81e9('0xe'));function Report(_0x41c2c6){this[_0x81e9('0xf')]=_0x41c2c6;this[_0x81e9('0x10')]=_0x41c2c6['agents'];this[_0x81e9('0x11')]=_0x41c2c6[_0x81e9('0x11')];}Report[_0x81e9('0x12')][_0x81e9('0x13')]=function(_0x57f2ea){var _0x56d4d8=new VoiceQueueReport(this[_0x81e9('0xf')]);var _0x1de2b5=new VoiceAgentReport(this['realtime']);var _0x2ad69a=new VoiceDialReport(this[_0x81e9('0xf')]);var _0x3d11ad=new VoiceCallReport(this[_0x81e9('0xf')]);var _0x133ec9=new UserReport(this[_0x81e9('0xf')]);if(config[_0x81e9('0x14')]&&config[_0x81e9('0x14')][_0x81e9('0x15')]){ami['on']('custom:voiceQueueReport',this[_0x81e9('0x16')][_0x81e9('0x17')](this));ami['on'](_0x81e9('0x18'),this['voiceCallReport'][_0x81e9('0x17')](this));ami['on'](_0x81e9('0x19'),this[_0x81e9('0x1a')][_0x81e9('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x81e9('0x1b')][_0x81e9('0x17')](this));ami['on'](_0x81e9('0x1c'),this[_0x81e9('0x1d')][_0x81e9('0x17')](this));ami['on'](_0x81e9('0x1e'),this[_0x81e9('0x1f')][_0x81e9('0x17')](this));}};Report[_0x81e9('0x12')][_0x81e9('0x20')]=function(_0x320c2d){var _0x5a92e4=undefined;_0x5a92e4=_[_0x81e9('0x21')](this[_0x81e9('0x10')],function(_0x502843){return _0x502843[_0x81e9('0x22')]==_0x320c2d||_0x502843[_0x81e9('0x23')]==_0x320c2d;});if(_[_0x81e9('0x24')](_0x5a92e4)){var _0x1d659a=_['find'](this['telephones'],function(_0x2a7a08){return _0x2a7a08['accountcode']==_0x320c2d||_0x2a7a08[_0x81e9('0x23')]==_0x320c2d;});if(_0x1d659a){_0x5a92e4=_[_0x81e9('0x21')](this['agents'],function(_0x53ea1e){return _0x53ea1e['interface']==util[_0x81e9('0x25')](_0x81e9('0x26'),_0x1d659a[_0x81e9('0x23')]);});}}return _0x5a92e4;};Report[_0x81e9('0x12')]['voiceQueueReport']=function(_0x33e201){for(var _0x4deea4=0x0;_0x4deea4<_0x33e201[_0x81e9('0x27')];_0x4deea4+=0x1){var _0x23f168=this['findAgent'](_0x33e201[_0x4deea4][_0x81e9('0x28')]);if(_0x23f168){_0x33e201[_0x4deea4]['accountcode']=_0x23f168[_0x81e9('0x22')];_0x33e201[_0x4deea4][_0x81e9('0x29')]=!![];_0x33e201[_0x4deea4][_0x81e9('0x2a')]=_0x23f168[_0x81e9('0x23')];_0x33e201[_0x4deea4][_0x81e9('0x2b')]=_['isNil'](_0x23f168[_0x81e9('0x2b')])?util[_0x81e9('0x25')](_0x81e9('0x26'),_0x23f168[_0x81e9('0x23')]):_0x23f168['interface'];if(_0x33e201[_0x4deea4][_0x81e9('0x2c')]){_0x33e201[_0x4deea4][_0x81e9('0x2d')]=moment()[_0x81e9('0x25')](_0x81e9('0x2e'));}if(_0x33e201[_0x4deea4][_0x81e9('0x2f')]){_0x33e201[_0x4deea4]['queuecallerexitAt']=moment()[_0x81e9('0x25')](_0x81e9('0x2e'));}RpcMemberReport[_0x81e9('0x16')](_0x33e201[_0x4deea4]);}RpcVoiceQueueReport[_0x81e9('0x30')](_0x33e201[_0x4deea4]);}};function extractCalleridNumber(_0x3ca142){var _0x3754c1=_0x3ca142['match'](/<(.*?)>/);return _0x3754c1?_0x3754c1[0x1]:_0x3ca142;}Report[_0x81e9('0x12')][_0x81e9('0x31')]=function(_0xe1f054){_0xe1f054[_0x81e9('0x32')]=_0xe1f054['destination']||_0xe1f054['exten'];if(_0xe1f054[_0x81e9('0x33')]=='dialer'){_0xe1f054[_0x81e9('0x34')]=_0x81e9('0x35');_0xe1f054['lastdata']=_0xe1f054[_0x81e9('0x35')];if(_0xe1f054['context']=='from-voip-provider'){_0xe1f054[_0x81e9('0x22')]='';_0xe1f054[_0x81e9('0x32')]=extractCalleridNumber(_0xe1f054[_0x81e9('0x36')]);}else if(_0xe1f054['context']=='from-sip'){if(_0xe1f054[_0x81e9('0x32')]==_0x81e9('0x37')){_0xe1f054[_0x81e9('0x32')]=extractCalleridNumber(_0xe1f054['calleridpreview']);_0xe1f054[_0x81e9('0x38')]=_0xe1f054[_0x81e9('0x39')];_0xe1f054['destinationchannel']=[_0xe1f054[_0x81e9('0x3a')],_0xe1f054[_0x81e9('0x3a')]=_0xe1f054[_0x81e9('0x3b')]][0x0];_0xe1f054[_0x81e9('0x36')]=_0xe1f054[_0x81e9('0x3c')];}else{_0xe1f054['destination']=_0xe1f054[_0x81e9('0x38')];_0xe1f054['calleridnum']=_0xe1f054[_0x81e9('0x39')];if(_0xe1f054[_0x81e9('0x3d')]=='ANSWERED'){_0xe1f054[_0x81e9('0x22')]=_0xe1f054['connectedlinenum'];}else{_0xe1f054[_0x81e9('0x22')]='';}}}}else{_0xe1f054[_0x81e9('0x36')]=util[_0x81e9('0x25')](_0x81e9('0x3e'),_0xe1f054[_0x81e9('0x3f')],_0xe1f054[_0x81e9('0x38')]);}RpcVoiceCallReport[_0x81e9('0x30')](_0xe1f054);if(_0xe1f054[_0x81e9('0x40')]){for(var _0x26ab95=0x0;_0x26ab95<_0xe1f054['monitors'][_0x81e9('0x27')];_0x26ab95+=0x1){_0xe1f054[_0x81e9('0x41')]=_0xe1f054[_0x81e9('0x42')][_0x26ab95][_0x81e9('0x43')];_0xe1f054[_0x81e9('0x44')]=_0xe1f054[_0x81e9('0x42')][_0x26ab95]['createdAt'];if(_0xe1f054[_0x81e9('0x45')]==_0x81e9('0x37')){_0xe1f054[_0x81e9('0x38')]=_0xe1f054['connectedlinenum'];_0xe1f054['calleridname']=_0xe1f054['connectedlinename'];_0xe1f054['connectedlinenum']=_0xe1f054[_0x81e9('0x22')];_0xe1f054['connectedlinename']=_0xe1f054[_0x81e9('0x46')];_0xe1f054[_0x81e9('0x45')]=_0xe1f054[_0x81e9('0x39')];}else if(_0xe1f054[_0x81e9('0x45')]==_0x81e9('0x47')){_0xe1f054[_0x81e9('0x38')]=_0xe1f054[_0x81e9('0x32')];_0xe1f054[_0x81e9('0x45')]=_0xe1f054[_0x81e9('0x39')];}RpcVoiceRecording['create'](_0xe1f054);}}};Report[_0x81e9('0x12')][_0x81e9('0x1a')]=function(_0x1c2f79){if(_[_0x81e9('0x48')](_0x1c2f79)){_0x1c2f79[_0x81e9('0x49')](function(_0x5bc0c8){RpcVoiceAgentReport['create'](_0x5bc0c8);});}else{RpcVoiceAgentReport[_0x81e9('0x30')](_0x1c2f79);}};Report[_0x81e9('0x12')][_0x81e9('0x1b')]=function(_0xc45687){RpcVoiceDialReport['create'](_0xc45687);var _0x59e2ec=undefined;var _0x8ec1df=_0xc45687[_0x81e9('0x3a')];if(_['startsWith'](_0x8ec1df,_0x81e9('0x4a'))){var _0x2f042b=_0x8ec1df[_0x81e9('0x4b')](_0x8ec1df[_0x81e9('0x4c')]('/')+0x1,_0x8ec1df[_0x81e9('0x4c')]('@'));_0x59e2ec=_[_0x81e9('0x21')](this[_0x81e9('0x10')],function(_0x3bace9){return _0x3bace9[_0x81e9('0x4d')]==_0x2f042b||_0x3bace9[_0x81e9('0x4e')]==_0x2f042b||_0x3bace9[_0x81e9('0x22')]==_0x2f042b;});}else{var _0x2f042b=_0x8ec1df['substring'](_0x8ec1df[_0x81e9('0x4c')]('/')+0x1,_0x8ec1df[_0x81e9('0x4f')]('-'));_0x59e2ec=this[_0x81e9('0x20')](_0x2f042b);}if(_0x59e2ec){_0xc45687[_0x81e9('0x2b')]=_[_0x81e9('0x24')](_0x59e2ec[_0x81e9('0x2b')])?util[_0x81e9('0x25')](_0x81e9('0x26'),_0x59e2ec[_0x81e9('0x23')]):_0x59e2ec[_0x81e9('0x2b')];_0xc45687[_0x81e9('0x46')]=_0x59e2ec['name'];_0xc45687['accountcode']=_0x59e2ec[_0x81e9('0x22')];RpcMemberReport[_0x81e9('0x1b')](_0xc45687);}};Report[_0x81e9('0x12')][_0x81e9('0x1d')]=function(_0x34205b){RpcVoiceTransferReport[_0x81e9('0x1d')](_0x34205b);};Report[_0x81e9('0x12')][_0x81e9('0x1f')]=function(_0x1d0564){RpcVoiceTransferReport[_0x81e9('0x1f')](_0x1d0564);};module[_0x81e9('0x50')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 64d7032..24e2cae 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 _0x810c=['trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','state','toLowerCase','inuse','local','updateStatusRealtime','stateTime','toNumber','telephone:%s','name','telephone:save','startsWith','Queue','Local','substring','indexOf','find','mobile','phone','accountcode','peer','registered','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','registry','bind','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','catch','isNotNull','isUndefined','emit','trunks','username','merge','event','actionid','format','trunk:%s'];(function(_0x4e324f,_0x4f0cfc){var _0x4e6076=function(_0x4b8227){while(--_0x4b8227){_0x4e324f['push'](_0x4e324f['shift']());}};_0x4e6076(++_0x4f0cfc);}(_0x810c,0x1ba));var _0xc810=function(_0x17a749,_0x40908b){_0x17a749=_0x17a749-0x0;var _0x10ee89=_0x810c[_0x17a749];return _0x10ee89;};'use strict';var _=require(_0xc810('0x0'));var moment=require(_0xc810('0x1'));var BPromise=require(_0xc810('0x2'));var util=require(_0xc810('0x3'));var Redis=require(_0xc810('0x4'));var config=require(_0xc810('0x5'));var logger=require(_0xc810('0x6'))('ami');var ami=require(_0xc810('0x7'));config[_0xc810('0x8')]=_['defaults'](config['redis'],{'host':_0xc810('0x9'),'port':0x18eb});var io=require(_0xc810('0xa'))(new Redis(config[_0xc810('0x8')]));function UserReport(_0x349343){this['trunks']=_0x349343['trunks'];this[_0xc810('0xb')]=_0x349343[_0xc810('0xb')];this[_0xc810('0xc')]=_0x349343[_0xc810('0xc')];ami['on'](_0xc810('0xd'),this[_0xc810('0xe')]['bind'](this));ami['on'](_0xc810('0xf'),this['syncRegistry'][_0xc810('0x10')](this));ami['on'](_0xc810('0x11'),this['syncDeviceState'][_0xc810('0x10')](this));ami['on'](_0xc810('0x12'),this[_0xc810('0x13')]['bind'](this));this[_0xc810('0x14')]();return BPromise[_0xc810('0x15')]()[_0xc810('0x16')](ami[_0xc810('0x17')]())[_0xc810('0x16')](ami[_0xc810('0x18')]())[_0xc810('0x16')](ami[_0xc810('0x19')]())['catch'](loggerCatch(_0xc810('0x1a')));}function loggerCatch(_0x3e9560){return function(_0xabf7df){logger[_0xc810('0x1b')](_0x3e9560,util[_0xc810('0x1c')](_0xabf7df,{'showHidden':![],'depth':null}));};}UserReport[_0xc810('0x1d')][_0xc810('0x14')]=function(){setInterval(function(){BPromise[_0xc810('0x15')]()['then'](ami[_0xc810('0x17')]())[_0xc810('0x16')](ami['actionDeviceStateList']())[_0xc810('0x16')](ami[_0xc810('0x19')]())[_0xc810('0x1e')](loggerCatch(_0xc810('0x1a')));},0x32c8);};UserReport[_0xc810('0x1d')][_0xc810('0x1f')]=function(_0x183723){return _0x183723!==null&&!_[_0xc810('0x20')](_0x183723);};UserReport[_0xc810('0x1d')][_0xc810('0x21')]=function(_0x659b74,_0x5207d7,_0x3abb0b){io['to'](_0x659b74)['emit'](_0x5207d7,_0x3abb0b);};UserReport['prototype']['syncRegistry']=function(_0x1da2a5){try{if(this['isNotNull'](_0x1da2a5)){var _0x75c7e=_['find'](this[_0xc810('0x22')],{'registry':_0x1da2a5[_0xc810('0x23')]});if(_0x75c7e){_0x1da2a5['stateRegistry']=_0x1da2a5['state'];_[_0xc810('0x24')](_0x75c7e,_['omit'](_0x1da2a5,[_0xc810('0x25'),_0xc810('0x26'),_0xc810('0x23'),'state']));this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x28'),_0x75c7e['name']),_0xc810('0x29'),_0x75c7e);}}}catch(_0x1bf598){logger[_0xc810('0x1b')](_0xc810('0x2a'),util['inspect'](_0x1bf598,{'showHidden':![],'depth':null}));}};UserReport[_0xc810('0x1d')][_0xc810('0x2b')]=function(_0x2e6068){try{if(this[_0xc810('0x1f')](_0x2e6068)){if(this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]]){if(!this['agents'][_0x2e6068[_0xc810('0x2c')]]['local']||_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()==_0xc810('0x2f')){this['agents'][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x30')]=![];if(this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]]['stateTime']=_['toNumber'](moment()[_0xc810('0x27')]('x'));}this['agents'][_0x2e6068['device']][_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();this[_0xc810('0xb')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x31')](_0x2e6068);}}else if(this['telephones'][_0x2e6068[_0xc810('0x2c')]]){if(this[_0xc810('0xc')][_0x2e6068['device']][_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x32')]=_[_0xc810('0x33')](moment()[_0xc810('0x27')]('x'));}this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x34'),this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x35')]),_0xc810('0x36'),this[_0xc810('0xc')][_0x2e6068[_0xc810('0x2c')]]);}else if(this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]){if(this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]['state']!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x32')]=_[_0xc810('0x33')](moment()[_0xc810('0x27')]('x'));}this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]['state']=_0x2e6068['state'][_0xc810('0x2e')]();this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x28'),this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]][_0xc810('0x35')]),_0xc810('0x29'),this[_0xc810('0x22')][_0x2e6068[_0xc810('0x2c')]]);}else if(_[_0xc810('0x37')](_0x2e6068[_0xc810('0x2c')],_0xc810('0x38'))){}else if(_[_0xc810('0x37')](_0x2e6068[_0xc810('0x2c')],_0xc810('0x39'))){var _0x2a2932=_0x2e6068[_0xc810('0x2c')];var _0x11f0b6=_0x2a2932[_0xc810('0x3a')](_0x2a2932[_0xc810('0x3b')]('/')+0x1,_0x2a2932[_0xc810('0x3b')]('@'));var _0x2672eb=_[_0xc810('0x3c')](this[_0xc810('0xb')],function(_0x400c0d){return _0x400c0d[_0xc810('0x3d')]==_0x11f0b6||_0x400c0d[_0xc810('0x3e')]==_0x11f0b6||_0x400c0d[_0xc810('0x3f')]==_0x11f0b6;});if(_0x2672eb){if(_0x2672eb[_0xc810('0x2d')]!==_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]()){_0x2672eb[_0xc810('0x32')]=_['toNumber'](moment()[_0xc810('0x27')]('x'));}_0x2672eb[_0xc810('0x2d')]=_0x2e6068[_0xc810('0x2d')][_0xc810('0x2e')]();_0x2672eb[_0xc810('0x30')]=!![];_0x2672eb[_0xc810('0x31')](_0x2e6068);}}else{}}}catch(_0x3e47fa){logger[_0xc810('0x1b')]('[syncDeviceState][UserReport]',util['inspect'](_0x3e47fa,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc810('0x13')]=function(_0x327d8f){try{if(this['isNotNull'](_0x327d8f)&&this[_0xc810('0x1f')](_0x327d8f[_0xc810('0x12')])){if(this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]){if(!this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]['local']||_0x327d8f[_0xc810('0x12')]['toLowerCase']()==_0xc810('0x41')){this['agents'][_0x327d8f['peer']][_0xc810('0x30')]=![];this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f[_0xc810('0x12')][_0xc810('0x2e')]();this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x42')]=_0x327d8f[_0xc810('0x42')];this[_0xc810('0xb')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x31')](_0x327d8f);}}else if(this['telephones'][_0x327d8f[_0xc810('0x40')]]){this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f['peerstatus'][_0xc810('0x2e')]();this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x42')]=_0x327d8f['address'];this[_0xc810('0x21')](util[_0xc810('0x27')](_0xc810('0x34'),this[_0xc810('0xc')][_0x327d8f[_0xc810('0x40')]][_0xc810('0x35')]),_0xc810('0x36'),this[_0xc810('0xc')][_0x327d8f['peer']]);}else if(this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]){this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]['status']=_0x327d8f[_0xc810('0x12')][_0xc810('0x2e')]();this['trunks'][_0x327d8f['peer']][_0xc810('0x42')]=_0x327d8f[_0xc810('0x42')];this[_0xc810('0x21')](util[_0xc810('0x27')]('trunk:%s',this[_0xc810('0x22')][_0x327d8f['peer']][_0xc810('0x35')]),_0xc810('0x29'),this[_0xc810('0x22')][_0x327d8f[_0xc810('0x40')]]);}else{}}}catch(_0x59c5cb){logger[_0xc810('0x1b')](_0xc810('0x43'),util['inspect'](_0x59c5cb,{'showHidden':![],'depth':null}));}};module[_0xc810('0x44')]=UserReport; \ No newline at end of file +var _0x50d2=['actionid','state','format','trunk:%s','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime','updateStatusRealtime','toNumber','telephone:%s','name','trunk:save','Queue','startsWith','Local','substring','indexOf','find','phone','[syncDeviceState][UserReport]','peerstatus','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','then','actionSipShowRegistry','catch','[loopSyncRealTimeShow]','error','inspect','loopSyncRealTimeShow','actionDeviceStateList','prototype','isNotNull','emit','merge','event'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x50d2,0x15e));var _0x250d=function(_0x10c124,_0x2778b4){_0x10c124=_0x10c124-0x0;var _0x5f396c=_0x50d2[_0x10c124];return _0x5f396c;};'use strict';var _=require(_0x250d('0x0'));var moment=require('moment');var BPromise=require(_0x250d('0x1'));var util=require(_0x250d('0x2'));var Redis=require('ioredis');var config=require(_0x250d('0x3'));var logger=require(_0x250d('0x4'))(_0x250d('0x5'));var ami=require(_0x250d('0x6'));config['redis']=_[_0x250d('0x7')](config[_0x250d('0x8')],{'host':_0x250d('0x9'),'port':0x18eb});var io=require(_0x250d('0xa'))(new Redis(config['redis']));function UserReport(_0x4b4321){this['trunks']=_0x4b4321[_0x250d('0xb')];this[_0x250d('0xc')]=_0x4b4321[_0x250d('0xc')];this['telephones']=_0x4b4321[_0x250d('0xd')];ami['on'](_0x250d('0xe'),this[_0x250d('0xf')][_0x250d('0x10')](this));ami['on'](_0x250d('0x11'),this['syncRegistry'][_0x250d('0x10')](this));ami['on'](_0x250d('0x12'),this[_0x250d('0x13')][_0x250d('0x10')](this));ami['on']('peerstatus',this[_0x250d('0x14')][_0x250d('0x10')](this));this['loopSyncRealTimeShow']();return BPromise['resolve']()[_0x250d('0x15')](ami[_0x250d('0x16')]())[_0x250d('0x15')](ami['actionDeviceStateList']())[_0x250d('0x15')](ami['actionSipPeerStatus']())[_0x250d('0x17')](loggerCatch(_0x250d('0x18')));}function loggerCatch(_0x2f132d){return function(_0x5a6158){logger[_0x250d('0x19')](_0x2f132d,util[_0x250d('0x1a')](_0x5a6158,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x250d('0x1b')]=function(){setInterval(function(){BPromise['resolve']()[_0x250d('0x15')](ami[_0x250d('0x16')]())[_0x250d('0x15')](ami[_0x250d('0x1c')]())['then'](ami['actionSipPeerStatus']())[_0x250d('0x17')](loggerCatch(_0x250d('0x18')));},0x32c8);};UserReport[_0x250d('0x1d')][_0x250d('0x1e')]=function(_0x1f4685){return _0x1f4685!==null&&!_['isUndefined'](_0x1f4685);};UserReport[_0x250d('0x1d')][_0x250d('0x1f')]=function(_0x50f9bd,_0x36b56c,_0x5bde37){io['to'](_0x50f9bd)['emit'](_0x36b56c,_0x5bde37);};UserReport[_0x250d('0x1d')][_0x250d('0xf')]=function(_0x3aa8d5){try{if(this['isNotNull'](_0x3aa8d5)){var _0x27eac1=_['find'](this[_0x250d('0xb')],{'registry':_0x3aa8d5['username']});if(_0x27eac1){_0x3aa8d5['stateRegistry']=_0x3aa8d5['state'];_[_0x250d('0x20')](_0x27eac1,_['omit'](_0x3aa8d5,[_0x250d('0x21'),_0x250d('0x22'),'username',_0x250d('0x23')]));this['emit'](util[_0x250d('0x24')](_0x250d('0x25'),_0x27eac1['name']),'trunk:save',_0x27eac1);}}}catch(_0x3e7dd8){logger[_0x250d('0x19')](_0x250d('0x26'),util[_0x250d('0x1a')](_0x3e7dd8,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x250d('0x13')]=function(_0x5476f2){try{if(this['isNotNull'](_0x5476f2)){if(this['agents'][_0x5476f2[_0x250d('0x27')]]){if(!this[_0x250d('0xc')][_0x5476f2['device']][_0x250d('0x28')]||_0x5476f2[_0x250d('0x23')]['toLowerCase']()==_0x250d('0x29')){this[_0x250d('0xc')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x28')]=![];if(this[_0x250d('0xc')][_0x5476f2[_0x250d('0x27')]]['state']!==_0x5476f2[_0x250d('0x23')][_0x250d('0x2a')]()){this[_0x250d('0xc')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x2b')]=_['toNumber'](moment()[_0x250d('0x24')]('x'));}this[_0x250d('0xc')][_0x5476f2['device']][_0x250d('0x23')]=_0x5476f2['state'][_0x250d('0x2a')]();this[_0x250d('0xc')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x2c')](_0x5476f2);}}else if(this[_0x250d('0xd')][_0x5476f2['device']]){if(this[_0x250d('0xd')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x23')]!==_0x5476f2['state']['toLowerCase']()){this[_0x250d('0xd')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x2b')]=_[_0x250d('0x2d')](moment()['format']('x'));}this[_0x250d('0xd')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x23')]=_0x5476f2['state'][_0x250d('0x2a')]();this[_0x250d('0x1f')](util[_0x250d('0x24')](_0x250d('0x2e'),this['telephones'][_0x5476f2[_0x250d('0x27')]][_0x250d('0x2f')]),'telephone:save',this['telephones'][_0x5476f2['device']]);}else if(this[_0x250d('0xb')][_0x5476f2['device']]){if(this[_0x250d('0xb')][_0x5476f2[_0x250d('0x27')]][_0x250d('0x23')]!==_0x5476f2[_0x250d('0x23')][_0x250d('0x2a')]()){this[_0x250d('0xb')][_0x5476f2['device']][_0x250d('0x2b')]=_[_0x250d('0x2d')](moment()[_0x250d('0x24')]('x'));}this['trunks'][_0x5476f2[_0x250d('0x27')]][_0x250d('0x23')]=_0x5476f2['state']['toLowerCase']();this[_0x250d('0x1f')](util[_0x250d('0x24')](_0x250d('0x25'),this['trunks'][_0x5476f2[_0x250d('0x27')]]['name']),_0x250d('0x30'),this[_0x250d('0xb')][_0x5476f2[_0x250d('0x27')]]);}else if(_['startsWith'](_0x5476f2[_0x250d('0x27')],_0x250d('0x31'))){}else if(_[_0x250d('0x32')](_0x5476f2[_0x250d('0x27')],_0x250d('0x33'))){var _0x6a27d9=_0x5476f2[_0x250d('0x27')];var _0x4523fa=_0x6a27d9[_0x250d('0x34')](_0x6a27d9[_0x250d('0x35')]('/')+0x1,_0x6a27d9['indexOf']('@'));var _0x24bdcd=_[_0x250d('0x36')](this[_0x250d('0xc')],function(_0x5be31e){return _0x5be31e['mobile']==_0x4523fa||_0x5be31e[_0x250d('0x37')]==_0x4523fa||_0x5be31e['accountcode']==_0x4523fa;});if(_0x24bdcd){if(_0x24bdcd[_0x250d('0x23')]!==_0x5476f2['state'][_0x250d('0x2a')]()){_0x24bdcd[_0x250d('0x2b')]=_['toNumber'](moment()[_0x250d('0x24')]('x'));}_0x24bdcd[_0x250d('0x23')]=_0x5476f2[_0x250d('0x23')][_0x250d('0x2a')]();_0x24bdcd[_0x250d('0x28')]=!![];_0x24bdcd[_0x250d('0x2c')](_0x5476f2);}}else{}}}catch(_0x3479a1){logger[_0x250d('0x19')](_0x250d('0x38'),util[_0x250d('0x1a')](_0x3479a1,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x250d('0x14')]=function(_0x5ac27e){try{if(this[_0x250d('0x1e')](_0x5ac27e)&&this[_0x250d('0x1e')](_0x5ac27e[_0x250d('0x39')])){if(this[_0x250d('0xc')][_0x5ac27e[_0x250d('0x3a')]]){if(!this[_0x250d('0xc')][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x28')]||_0x5ac27e[_0x250d('0x39')][_0x250d('0x2a')]()==_0x250d('0x3b')){this[_0x250d('0xc')][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x28')]=![];this['agents'][_0x5ac27e['peer']][_0x250d('0x3c')]=_0x5ac27e['peerstatus'][_0x250d('0x2a')]();this[_0x250d('0xc')][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x3d')]=_0x5ac27e[_0x250d('0x3d')];this[_0x250d('0xc')][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x2c')](_0x5ac27e);}}else if(this[_0x250d('0xd')][_0x5ac27e['peer']]){this[_0x250d('0xd')][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x3c')]=_0x5ac27e[_0x250d('0x39')]['toLowerCase']();this[_0x250d('0xd')][_0x5ac27e[_0x250d('0x3a')]]['address']=_0x5ac27e['address'];this['emit'](util[_0x250d('0x24')]('telephone:%s',this['telephones'][_0x5ac27e[_0x250d('0x3a')]][_0x250d('0x2f')]),'telephone:save',this['telephones'][_0x5ac27e['peer']]);}else if(this[_0x250d('0xb')][_0x5ac27e[_0x250d('0x3a')]]){this[_0x250d('0xb')][_0x5ac27e['peer']]['status']=_0x5ac27e[_0x250d('0x39')][_0x250d('0x2a')]();this[_0x250d('0xb')][_0x5ac27e['peer']]['address']=_0x5ac27e[_0x250d('0x3d')];this[_0x250d('0x1f')](util[_0x250d('0x24')](_0x250d('0x25'),this['trunks'][_0x5ac27e[_0x250d('0x3a')]]['name']),_0x250d('0x30'),this[_0x250d('0xb')][_0x5ac27e[_0x250d('0x3a')]]);}else{}}}catch(_0x1f3139){logger[_0x250d('0x19')](_0x250d('0x3e'),util[_0x250d('0x1a')](_0x1f3139,{'showHidden':![],'depth':null}));}};module[_0x250d('0x3f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0c2597f..b882944 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 _0x9717=['type','inbound','omit','privilege','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','agentacw','acwtime','user:agentcomplete','addVariable','keys','variable','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue'];(function(_0x20ea55,_0x17d021){var _0x44c458=function(_0x395cbf){while(--_0x395cbf){_0x20ea55['push'](_0x20ea55['shift']());}};_0x44c458(++_0x17d021);}(_0x9717,0x1a5));var _0x7971=function(_0x581708,_0x55970c){_0x581708=_0x581708-0x0;var _0x378653=_0x9717[_0x581708];return _0x378653;};'use strict';var _=require(_0x7971('0x0'));var moment=require(_0x7971('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x7971('0x2'));var logger=require(_0x7971('0x3'))(_0x7971('0x4'));var ami=require(_0x7971('0x5'));config['redis']=_[_0x7971('0x6')](config[_0x7971('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x5b8785){this[_0x7971('0x8')]={};this[_0x7971('0x9')]=_0x5b8785['voiceQueues'];this[_0x7971('0xa')]=_0x5b8785['agents'];this['variables']={};ami['on'](_0x7971('0xb'),this[_0x7971('0xc')][_0x7971('0xd')](this));ami['on'](_0x7971('0xe'),this[_0x7971('0xf')][_0x7971('0xd')](this));ami['on'](_0x7971('0x10'),this[_0x7971('0x11')][_0x7971('0xd')](this));ami['on'](_0x7971('0x12'),this[_0x7971('0x13')]['bind'](this));ami['on'](_0x7971('0x14'),this[_0x7971('0x15')][_0x7971('0xd')](this));ami['on'](_0x7971('0x16'),this[_0x7971('0x17')][_0x7971('0xd')](this));ami['on'](_0x7971('0x18'),this[_0x7971('0x19')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1a'),this[_0x7971('0x1b')]['bind'](this));ami['on']('musiconholdstop',this[_0x7971('0x1c')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1d'),this[_0x7971('0x1e')][_0x7971('0xd')](this));ami['on'](_0x7971('0x1f'),this[_0x7971('0x20')][_0x7971('0xd')](this));}VoiceAgentReport[_0x7971('0x21')][_0x7971('0x22')]=function(_0x4c6a5a,_0x14487f,_0x106cb3){io['to'](_0x4c6a5a)[_0x7971('0x22')](_0x14487f,_0x106cb3);};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x23')]=function(_0x31f8be){return _0x31f8be!==null&&!_[_0x7971('0x24')](_0x31f8be);};VoiceAgentReport[_0x7971('0x21')][_0x7971('0xc')]=function(_0x33f039){try{if(this['isNotNull'](_0x33f039)){if(_[_0x7971('0x24')](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]])){this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]]={};}if(_[_0x7971('0x24')](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]])){this[_0x7971('0x8')][_0x33f039['uniqueid']][_0x33f039[_0x7971('0x26')]]={'agentcalledAt':moment()['format'](_0x7971('0x27')),'lastevent':_0x7971('0x28'),'variables':this[_0x7971('0x29')][_0x33f039['uniqueid']],'type':this['voiceQueues'][_0x33f039[_0x7971('0x2a')]]?this[_0x7971('0x9')][_0x33f039[_0x7971('0x2a')]][_0x7971('0x2b')]||_0x7971('0x2c'):_0x7971('0x2c')};}_['merge'](this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]],_[_0x7971('0x2d')](_0x33f039,['event',_0x7971('0x2e')]));ami[_0x7971('0x22')](_0x7971('0x2f'),this[_0x7971('0x8')][_0x33f039[_0x7971('0x25')]][_0x33f039[_0x7971('0x26')]]);this['emit'](util[_0x7971('0x30')](_0x7971('0x31'),_0x33f039[_0x7971('0x32')]),_0x7971('0x33'),this[_0x7971('0x8')][_0x33f039['uniqueid']][_0x33f039['destuniqueid']]);}}catch(_0x3c32cc){logger[_0x7971('0x34')](_0x7971('0x35'),util[_0x7971('0x36')](_0x3c32cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')]['syncAgentConnect']=function(_0x53a42d){try{if(this[_0x7971('0x23')](_0x53a42d)){if(this[_0x7971('0x8')][_0x53a42d['uniqueid']]){for(var _0x7da162 in this[_0x7971('0x8')][_0x53a42d['uniqueid']]){if(this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7971('0x37')](_0x7da162)){if(_0x53a42d[_0x7971('0x26')]===_0x7da162){this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x38')]=moment()[_0x7971('0x30')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x39')]=_0x7971('0x3a');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3b')]=_0x53a42d[_0x7971('0x3b')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3c')]=_0x53a42d['connectedlinenum'];this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162]['connectedlinename']=_0x53a42d[_0x7971('0x3d')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162]['destchannelstate']=_0x53a42d[_0x7971('0x3e')];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x3f')]=_0x53a42d[_0x7971('0x3f')];_['merge'](this[_0x7971('0xa')][_0x53a42d[_0x7971('0x40')]],_[_0x7971('0x41')](_0x53a42d,['queue',_0x7971('0x42')]));this['emit'](util[_0x7971('0x30')](_0x7971('0x31'),_0x53a42d[_0x7971('0x32')]),_0x7971('0x43'),this['channels'][_0x53a42d[_0x7971('0x25')]][_0x53a42d[_0x7971('0x26')]]);ami[_0x7971('0x22')]('custom:agentconnect',this['channels'][_0x53a42d['uniqueid']][_0x7da162]);}else if(!this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x10')]&&!this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162]['agentcomplete']){this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x44')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x45')]=_0x7971('0x46');this[_0x7971('0x8')][_0x53a42d['uniqueid']][_0x7da162]['lastevent']=_0x7971('0x46');this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x47')]=_0x53a42d['destuniqueid'];this[_0x7971('0x8')][_0x53a42d[_0x7971('0x25')]][_0x7da162][_0x7971('0x48')]=_0x53a42d[_0x7971('0x32')];ami[_0x7971('0x22')](_0x7971('0x49'),this['channels'][_0x53a42d[_0x7971('0x25')]][_0x7da162]);}}}}}}catch(_0xbc1840){logger[_0x7971('0x34')]('[syncAgentConnect][VoiceAgentReport]',util[_0x7971('0x36')](_0xbc1840,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x11')]=function(_0x239114){try{if(this[_0x7971('0x23')](_0x239114)){if(this[_0x7971('0x8')][_0x239114['uniqueid']]&&this['channels'][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]]){this['channels'][_0x239114['uniqueid']][_0x239114[_0x7971('0x26')]][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]]['agentringnoanswerAt']=moment()['format'](_0x7971('0x27'));this[_0x7971('0x8')][_0x239114[_0x7971('0x25')]][_0x239114[_0x7971('0x26')]][_0x7971('0x45')]=_0x7971('0x4a');this[_0x7971('0x8')][_0x239114['uniqueid']][_0x239114['destuniqueid']][_0x7971('0x39')]=_0x7971('0x4a');ami[_0x7971('0x22')](_0x7971('0x4b'),this[_0x7971('0x8')][_0x239114['uniqueid']][_0x239114[_0x7971('0x26')]]);}}}catch(_0x566a83){logger[_0x7971('0x34')](_0x7971('0x4c'),util['inspect'](_0x566a83,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x1f4f67){try{if(this[_0x7971('0x23')](_0x1f4f67)){if(this['channels'][_0x1f4f67[_0x7971('0x25')]]){for(var _0xfdd705 in this['channels'][_0x1f4f67['uniqueid']]){if(this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]]['hasOwnProperty'](_0xfdd705)&&!this['channels'][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['agentringnoanswer']&&!this['channels'][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x14')]){this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x10')]=!![];this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['agentringnoanswerAt']=moment()[_0x7971('0x30')](_0x7971('0x27'));this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]['reason']=_0x7971('0x4d');this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705][_0x7971('0x39')]=_0x7971('0x4d');ami[_0x7971('0x22')](_0x7971('0x4e'),this[_0x7971('0x8')][_0x1f4f67[_0x7971('0x25')]][_0xfdd705]);}}}}}catch(_0x21b55c){logger['error'](_0x7971('0x4f'),util[_0x7971('0x36')](_0x21b55c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')]['syncAgentComplete']=function(_0x1fe770){try{if(this[_0x7971('0x23')](_0x1fe770)){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]]){for(var _0x212b10 in this['channels'][_0x1fe770[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x7971('0x37')](_0x212b10)){if(this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x38')]&&!this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x14')]){this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x14')]=!![];this['channels'][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x50')]=moment()[_0x7971('0x30')](_0x7971('0x27'));this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x39')]=_0x7971('0x51');this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x52')]=_0x1fe770[_0x7971('0x52')];this['channels'][_0x1fe770['uniqueid']][_0x212b10][_0x7971('0x45')]=_0x1fe770[_0x7971('0x45')]==_0x7971('0x53')?_0x7971('0x54'):_0x1fe770['reason'];if(this['voiceQueues'][_0x1fe770[_0x7971('0x2a')]]&&this[_0x7971('0x9')][_0x1fe770['queue']]['acw']){this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x55')]=!![];this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10][_0x7971('0x56')]=this[_0x7971('0x9')][_0x1fe770['queue']]['acwTimeout'];}this['agents'][_0x1fe770[_0x7971('0x40')]]=_['omit'](this[_0x7971('0xa')][_0x1fe770['interface']],['queue',_0x7971('0x42')]);this[_0x7971('0x22')](util[_0x7971('0x30')](_0x7971('0x31'),_0x1fe770[_0x7971('0x32')]),_0x7971('0x57'),this[_0x7971('0x8')][_0x1fe770['uniqueid']][_0x212b10]);ami[_0x7971('0x22')]('custom:agentcomplete',this[_0x7971('0x8')][_0x1fe770[_0x7971('0x25')]][_0x212b10]);}}}}}}catch(_0x5920f4){logger[_0x7971('0x34')]('[syncAgentComplete][VoiceAgentReport]',util[_0x7971('0x36')](_0x5920f4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x17')]=function(_0x3ec45e){try{if(this[_0x7971('0x23')](_0x3ec45e)){this[_0x7971('0x58')](_0x3ec45e[_0x7971('0x25')],_[_0x7971('0x59')](_0x3ec45e[_0x7971('0x5a')])[0x0],_0x3ec45e['value']);if(this['channels'][_0x3ec45e[_0x7971('0x25')]]){for(var _0x1e1c12 in this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x7971('0x37')](_0x1e1c12)){if(_['isUndefined'](this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12][_0x7971('0x29')])){this['channels'][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12]['variables']={};}this[_0x7971('0x8')][_0x3ec45e[_0x7971('0x25')]][_0x1e1c12][_0x7971('0x29')]=this[_0x7971('0x29')][_0x3ec45e[_0x7971('0x25')]];}}}}}catch(_0x4a146b){logger[_0x7971('0x34')]('[syncVarSet][VoiceAgentReport]',util['inspect'](_0x4a146b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x58')]=function(_0xced0f2,_0x221f1f,_0x3c45eb){var _0x45f226=['rtpaudioqos',_0x7971('0x5b'),'rtpaudioqosjitter',_0x7971('0x5c'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7971('0x5d'),'sipcallid',_0x7971('0x5e'),_0x7971('0x5f'),'bridgepvtcallid','membercalls',_0x7971('0x60'),_0x7971('0x61'),_0x7971('0x62'),_0x7971('0x32'),'memberpenalty',_0x7971('0x63')];if(!_[_0x7971('0x64')](_0x221f1f)&&!_[_0x7971('0x65')](_0x45f226,_0x221f1f)){if(_['isUndefined'](this['variables'][_0xced0f2])){this[_0x7971('0x29')][_0xced0f2]={};}this[_0x7971('0x29')][_0xced0f2][_0x221f1f]=_0x3c45eb;}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x19')]=function(_0x2643f3){try{if(this[_0x7971('0x23')](_0x2643f3)){if(this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]]){for(var _0x13b0e8 in this['channels'][_0x2643f3[_0x7971('0x25')]]){if(this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]][_0x7971('0x37')](_0x13b0e8)){if(this['channels'][_0x2643f3[_0x7971('0x25')]][_0x13b0e8]['reason']==_0x7971('0x53')&&this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]][_0x13b0e8][_0x7971('0x14')]){this['channels'][_0x2643f3[_0x7971('0x25')]][_0x13b0e8][_0x7971('0x50')]=moment()[_0x7971('0x30')](_0x7971('0x27'));}}}ami[_0x7971('0x22')](_0x7971('0x66'),_['values'](this[_0x7971('0x8')][_0x2643f3[_0x7971('0x25')]]));delete this['channels'][_0x2643f3[_0x7971('0x25')]];}if(this['variables'][_0x2643f3['uniqueid']]){delete this[_0x7971('0x29')][_0x2643f3[_0x7971('0x25')]];}}}catch(_0x58fa55){logger['error'](_0x7971('0x67'),util[_0x7971('0x36')](_0x58fa55,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x1e')]=function(_0x1acae4){try{if(this['isNotNull'](_0x1acae4)){if(this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']]){for(var _0x685fb5 in this['channels'][_0x1acae4[_0x7971('0x68')]]){if(this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]]['hasOwnProperty'](_0x685fb5)){if(_0x1acae4['origtransfereruniqueid']===_0x685fb5){var _0x20158b=moment();this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x14')]=!![];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x50')]=moment()['format'](_0x7971('0x27'));this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x45')]=_0x7971('0x53');this['channels'][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x39')]=_0x7971('0x51');this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']][_0x685fb5][_0x7971('0x52')]=_0x20158b[_0x7971('0x69')](this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]][_0x685fb5][_0x7971('0x38')],_0x7971('0x6a'));}}}}if(this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]]){var _0x461729=this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x6b')]]=this[_0x7971('0x8')][_0x1acae4['transfereeuniqueid']];this[_0x7971('0x8')][_0x1acae4[_0x7971('0x68')]]=_0x461729;}}}catch(_0x72278e){logger[_0x7971('0x34')](_0x7971('0x6c'),util['inspect'](_0x72278e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x20')]=function(_0x218391){try{if(this[_0x7971('0x23')](_0x218391)){if(this['channels'][_0x218391['transfereeuniqueid']]){for(var _0x52bb6d in this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]]){if(this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]]['hasOwnProperty'](_0x52bb6d)){if(_0x218391['transfereruniqueid']===_0x52bb6d){var _0x5669ac=moment();this['channels'][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x14')]=!![];this['channels'][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x50')]=_0x5669ac;this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x45')]=_0x7971('0x53');this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d][_0x7971('0x39')]='complete';this[_0x7971('0x8')][_0x218391['transfereeuniqueid']][_0x52bb6d][_0x7971('0x52')]=_0x5669ac['diff'](this[_0x7971('0x8')][_0x218391[_0x7971('0x68')]][_0x52bb6d]['agentconnectAt'],_0x7971('0x6a'));}}}}}}catch(_0x5613dc){logger['error'](_0x7971('0x6d'),util[_0x7971('0x36')](_0x5613dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7971('0x1b')]=function(_0x569bb3){var _0x52938c='';try{if(this[_0x7971('0x23')](_0x569bb3)){if(_0x569bb3[_0x7971('0x6e')]){_0x52938c=_0x569bb3[_0x7971('0x6e')][_0x7971('0x6f')](0x0,_0x569bb3[_0x7971('0x6e')]['lastIndexOf']('-'));if(this['agents'][_0x52938c]){this['agents'][_0x52938c][_0x7971('0x70')]=!![];}}}}catch(_0x5955c4){logger['error'](_0x7971('0x71'),util[_0x7971('0x36')](_0x5955c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7971('0x21')][_0x7971('0x1c')]=function(_0x2d5dd9){var _0x5481dc='';try{if(this[_0x7971('0x23')](_0x2d5dd9)){if(_0x2d5dd9[_0x7971('0x6e')]){_0x5481dc=_0x2d5dd9['channel'][_0x7971('0x6f')](0x0,_0x2d5dd9[_0x7971('0x6e')]['lastIndexOf']('-'));if(this[_0x7971('0xa')][_0x5481dc]){this[_0x7971('0xa')][_0x5481dc][_0x7971('0x70')]=![];}}}}catch(_0x255a20){logger[_0x7971('0x34')](_0x7971('0x72'),util[_0x7971('0x36')](_0x255a20,{'showHidden':![],'depth':null}));}};module[_0x7971('0x73')]=VoiceAgentReport; \ No newline at end of file +var _0x6692=['acw','agentacw','acwTimeout','interface','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','complete','diff','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','uniqueid','isUndefined','format','YYYY-MM-DD\x20HH:mm:ss','queue','type','inbound','merge','destuniqueid','event','privilege','custom:agentcalled','user:%s','membername','user:called','error','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswer','agentcomplete','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','[syncAgentConnect][VoiceAgentReport]','inspect','syncAgentRingNoAnswer','agentringnoanswerAt','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','talktime','transfer'];(function(_0x24560d,_0x333e2f){var _0x4132d1=function(_0x344508){while(--_0x344508){_0x24560d['push'](_0x24560d['shift']());}};_0x4132d1(++_0x333e2f);}(_0x6692,0xb5));var _0x2669=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x6692[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x2669('0x0'));var moment=require(_0x2669('0x1'));var util=require(_0x2669('0x2'));var Redis=require(_0x2669('0x3'));var config=require(_0x2669('0x4'));var logger=require('../../../config/logger')(_0x2669('0x5'));var ami=require(_0x2669('0x6'));config[_0x2669('0x7')]=_[_0x2669('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2669('0x9'))(new Redis(config[_0x2669('0x7')]));function VoiceAgentReport(_0x5baf6b){this[_0x2669('0xa')]={};this[_0x2669('0xb')]=_0x5baf6b['voiceQueues'];this[_0x2669('0xc')]=_0x5baf6b['agents'];this[_0x2669('0xd')]={};ami['on'](_0x2669('0xe'),this[_0x2669('0xf')][_0x2669('0x10')](this));ami['on'](_0x2669('0x11'),this[_0x2669('0x12')][_0x2669('0x10')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x2669('0x13'),this['syncQueueCallerAbandon'][_0x2669('0x10')](this));ami['on']('agentcomplete',this[_0x2669('0x14')][_0x2669('0x10')](this));ami['on'](_0x2669('0x15'),this['syncVarSet'][_0x2669('0x10')](this));ami['on'](_0x2669('0x16'),this[_0x2669('0x17')][_0x2669('0x10')](this));ami['on'](_0x2669('0x18'),this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x2669('0x10')](this));ami['on'](_0x2669('0x19'),this['syncAttendedTransfer'][_0x2669('0x10')](this));ami['on'](_0x2669('0x1a'),this[_0x2669('0x1b')][_0x2669('0x10')](this));}VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x1d')]=function(_0x5daa33,_0x3a38a5,_0x9b87bb){io['to'](_0x5daa33)[_0x2669('0x1d')](_0x3a38a5,_0x9b87bb);};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x1e')]=function(_0x98021a){return _0x98021a!==null&&!_['isUndefined'](_0x98021a);};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0xf')]=function(_0x37fc98){try{if(this[_0x2669('0x1e')](_0x37fc98)){if(_['isUndefined'](this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]])){this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]]={};}if(_[_0x2669('0x20')](this['channels'][_0x37fc98[_0x2669('0x1f')]][_0x37fc98['destuniqueid']])){this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]][_0x37fc98['destuniqueid']]={'agentcalledAt':moment()[_0x2669('0x21')](_0x2669('0x22')),'lastevent':'called','variables':this[_0x2669('0xd')][_0x37fc98['uniqueid']],'type':this[_0x2669('0xb')][_0x37fc98[_0x2669('0x23')]]?this[_0x2669('0xb')][_0x37fc98[_0x2669('0x23')]][_0x2669('0x24')]||'inbound':_0x2669('0x25')};}_[_0x2669('0x26')](this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]][_0x37fc98[_0x2669('0x27')]],_['omit'](_0x37fc98,[_0x2669('0x28'),_0x2669('0x29')]));ami['emit'](_0x2669('0x2a'),this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]][_0x37fc98['destuniqueid']]);this[_0x2669('0x1d')](util[_0x2669('0x21')](_0x2669('0x2b'),_0x37fc98[_0x2669('0x2c')]),_0x2669('0x2d'),this[_0x2669('0xa')][_0x37fc98[_0x2669('0x1f')]][_0x37fc98[_0x2669('0x27')]]);}}catch(_0x34d3ae){logger[_0x2669('0x2e')]('[syncAgentCalled][VoiceAgentReport]',util['inspect'](_0x34d3ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x12')]=function(_0x4c21ab){try{if(this[_0x2669('0x1e')](_0x4c21ab)){if(this['channels'][_0x4c21ab['uniqueid']]){for(var _0x29e7ba in this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]]){if(this['channels'][_0x4c21ab[_0x2669('0x1f')]]['hasOwnProperty'](_0x29e7ba)){if(_0x4c21ab[_0x2669('0x27')]===_0x29e7ba){this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x2f')]=moment()[_0x2669('0x21')](_0x2669('0x22'));this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x30')]=_0x2669('0x31');this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x32')]=_0x4c21ab['holdtime'];this['channels'][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['connectedlinenum']=_0x4c21ab[_0x2669('0x33')];this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['connectedlinename']=_0x4c21ab[_0x2669('0x34')];this['channels'][_0x4c21ab['uniqueid']][_0x29e7ba][_0x2669('0x35')]=_0x4c21ab['destchannelstate'];this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['destchannelstatedesc']=_0x4c21ab['destchannelstatedesc'];_[_0x2669('0x26')](this[_0x2669('0xc')][_0x4c21ab['interface']],_[_0x2669('0x36')](_0x4c21ab,[_0x2669('0x23'),_0x2669('0x37')]));this['emit'](util[_0x2669('0x21')](_0x2669('0x2b'),_0x4c21ab[_0x2669('0x2c')]),_0x2669('0x38'),this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x4c21ab[_0x2669('0x27')]]);ami['emit'](_0x2669('0x39'),this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]);}else if(!this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x3a')]&&!this['channels'][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x3b')]){this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x3a')]=!![];this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['agentringnoanswerAt']=moment()[_0x2669('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x3c')]='answered_elsewhere';this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['lastevent']=_0x2669('0x3d');this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba][_0x2669('0x3e')]=_0x4c21ab[_0x2669('0x27')];this['channels'][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]['answeredelsewheremembername']=_0x4c21ab[_0x2669('0x2c')];ami[_0x2669('0x1d')]('custom:agentansweredelsewhere',this[_0x2669('0xa')][_0x4c21ab[_0x2669('0x1f')]][_0x29e7ba]);}}}}}}catch(_0x2943ad){logger['error'](_0x2669('0x3f'),util[_0x2669('0x40')](_0x2943ad,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2669('0x41')]=function(_0x55b761){try{if(this['isNotNull'](_0x55b761)){if(this[_0x2669('0xa')][_0x55b761[_0x2669('0x1f')]]&&this[_0x2669('0xa')][_0x55b761[_0x2669('0x1f')]][_0x55b761[_0x2669('0x27')]]){this['channels'][_0x55b761[_0x2669('0x1f')]][_0x55b761[_0x2669('0x27')]]['agentringnoanswer']=!![];this[_0x2669('0xa')][_0x55b761[_0x2669('0x1f')]][_0x55b761[_0x2669('0x27')]][_0x2669('0x42')]=moment()['format'](_0x2669('0x22'));this[_0x2669('0xa')][_0x55b761[_0x2669('0x1f')]][_0x55b761['destuniqueid']][_0x2669('0x3c')]=_0x2669('0x43');this[_0x2669('0xa')][_0x55b761['uniqueid']][_0x55b761[_0x2669('0x27')]][_0x2669('0x30')]=_0x2669('0x43');ami[_0x2669('0x1d')](_0x2669('0x44'),this[_0x2669('0xa')][_0x55b761[_0x2669('0x1f')]][_0x55b761['destuniqueid']]);}}}catch(_0x2d4000){logger[_0x2669('0x2e')](_0x2669('0x45'),util['inspect'](_0x2d4000,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2669('0x46')]=function(_0x58504c){try{if(this[_0x2669('0x1e')](_0x58504c)){if(this[_0x2669('0xa')][_0x58504c[_0x2669('0x1f')]]){for(var _0x5e381f in this[_0x2669('0xa')][_0x58504c[_0x2669('0x1f')]]){if(this[_0x2669('0xa')][_0x58504c[_0x2669('0x1f')]][_0x2669('0x47')](_0x5e381f)&&!this[_0x2669('0xa')][_0x58504c['uniqueid']][_0x5e381f]['agentringnoanswer']&&!this[_0x2669('0xa')][_0x58504c['uniqueid']][_0x5e381f]['agentcomplete']){this[_0x2669('0xa')][_0x58504c['uniqueid']][_0x5e381f][_0x2669('0x3a')]=!![];this['channels'][_0x58504c['uniqueid']][_0x5e381f][_0x2669('0x42')]=moment()[_0x2669('0x21')](_0x2669('0x22'));this[_0x2669('0xa')][_0x58504c[_0x2669('0x1f')]][_0x5e381f][_0x2669('0x3c')]=_0x2669('0x48');this['channels'][_0x58504c[_0x2669('0x1f')]][_0x5e381f][_0x2669('0x30')]=_0x2669('0x48');ami[_0x2669('0x1d')](_0x2669('0x49'),this['channels'][_0x58504c[_0x2669('0x1f')]][_0x5e381f]);}}}}}catch(_0xd74ada){logger[_0x2669('0x2e')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x2669('0x40')](_0xd74ada,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentComplete']=function(_0x10c4ca){try{if(this[_0x2669('0x1e')](_0x10c4ca)){if(this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]]){for(var _0x490b40 in this['channels'][_0x10c4ca[_0x2669('0x1f')]]){if(this['channels'][_0x10c4ca[_0x2669('0x1f')]]['hasOwnProperty'](_0x490b40)){if(this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40][_0x2669('0x2f')]&&!this['channels'][_0x10c4ca['uniqueid']][_0x490b40][_0x2669('0x3b')]){this[_0x2669('0xa')][_0x10c4ca['uniqueid']][_0x490b40][_0x2669('0x3b')]=!![];this[_0x2669('0xa')][_0x10c4ca['uniqueid']][_0x490b40][_0x2669('0x4a')]=moment()[_0x2669('0x21')](_0x2669('0x22'));this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40][_0x2669('0x30')]='complete';this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40]['talktime']=_0x10c4ca[_0x2669('0x4b')];this['channels'][_0x10c4ca[_0x2669('0x1f')]][_0x490b40][_0x2669('0x3c')]=_0x10c4ca[_0x2669('0x3c')]==_0x2669('0x4c')?'agent':_0x10c4ca[_0x2669('0x3c')];if(this[_0x2669('0xb')][_0x10c4ca[_0x2669('0x23')]]&&this[_0x2669('0xb')][_0x10c4ca[_0x2669('0x23')]][_0x2669('0x4d')]){this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40][_0x2669('0x4e')]=!![];this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40]['acwtime']=this['voiceQueues'][_0x10c4ca['queue']][_0x2669('0x4f')];}this[_0x2669('0xc')][_0x10c4ca[_0x2669('0x50')]]=_[_0x2669('0x51')](this[_0x2669('0xc')][_0x10c4ca[_0x2669('0x50')]],[_0x2669('0x23'),_0x2669('0x37')]);this[_0x2669('0x1d')](util['format'](_0x2669('0x2b'),_0x10c4ca['membername']),_0x2669('0x52'),this[_0x2669('0xa')][_0x10c4ca[_0x2669('0x1f')]][_0x490b40]);ami['emit'](_0x2669('0x53'),this['channels'][_0x10c4ca[_0x2669('0x1f')]][_0x490b40]);}}}}}}catch(_0x28c4f5){logger[_0x2669('0x2e')](_0x2669('0x54'),util[_0x2669('0x40')](_0x28c4f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x55')]=function(_0x8bdff4){try{if(this[_0x2669('0x1e')](_0x8bdff4)){this[_0x2669('0x56')](_0x8bdff4[_0x2669('0x1f')],_[_0x2669('0x57')](_0x8bdff4[_0x2669('0x58')])[0x0],_0x8bdff4[_0x2669('0x59')]);if(this['channels'][_0x8bdff4['uniqueid']]){for(var _0x2783ba in this['channels'][_0x8bdff4[_0x2669('0x1f')]]){if(this[_0x2669('0xa')][_0x8bdff4['uniqueid']][_0x2669('0x47')](_0x2783ba)){if(_['isUndefined'](this[_0x2669('0xa')][_0x8bdff4[_0x2669('0x1f')]][_0x2783ba]['variables'])){this[_0x2669('0xa')][_0x8bdff4[_0x2669('0x1f')]][_0x2783ba]['variables']={};}this[_0x2669('0xa')][_0x8bdff4[_0x2669('0x1f')]][_0x2783ba]['variables']=this[_0x2669('0xd')][_0x8bdff4[_0x2669('0x1f')]];}}}}}catch(_0x46f8f7){logger['error'](_0x2669('0x5a'),util[_0x2669('0x40')](_0x46f8f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2669('0x1c')]['addVariable']=function(_0xd7762a,_0x626d3b,_0x1dff0f){var _0x418fa0=[_0x2669('0x5b'),_0x2669('0x5c'),_0x2669('0x5d'),'rtpaudioqosjitterbridged',_0x2669('0x5e'),_0x2669('0x5f'),_0x2669('0x60'),'rtpaudioqosrttbridged',_0x2669('0x61'),_0x2669('0x62'),_0x2669('0x63'),_0x2669('0x64'),_0x2669('0x65'),_0x2669('0x66'),_0x2669('0x67'),_0x2669('0x68'),_0x2669('0x2c'),_0x2669('0x69'),_0x2669('0x6a')];if(!_['isNil'](_0x626d3b)&&!_['includes'](_0x418fa0,_0x626d3b)){if(_[_0x2669('0x20')](this[_0x2669('0xd')][_0xd7762a])){this[_0x2669('0xd')][_0xd7762a]={};}this[_0x2669('0xd')][_0xd7762a][_0x626d3b]=_0x1dff0f;}};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x17')]=function(_0x4a2bb4){try{if(this[_0x2669('0x1e')](_0x4a2bb4)){if(this[_0x2669('0xa')][_0x4a2bb4['uniqueid']]){for(var _0x2d3750 in this[_0x2669('0xa')][_0x4a2bb4['uniqueid']]){if(this['channels'][_0x4a2bb4[_0x2669('0x1f')]]['hasOwnProperty'](_0x2d3750)){if(this['channels'][_0x4a2bb4['uniqueid']][_0x2d3750][_0x2669('0x3c')]=='transfer'&&this['channels'][_0x4a2bb4[_0x2669('0x1f')]][_0x2d3750][_0x2669('0x3b')]){this['channels'][_0x4a2bb4[_0x2669('0x1f')]][_0x2d3750]['agentcompleteAt']=moment()[_0x2669('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit'](_0x2669('0x6b'),_[_0x2669('0x6c')](this[_0x2669('0xa')][_0x4a2bb4[_0x2669('0x1f')]]));delete this[_0x2669('0xa')][_0x4a2bb4[_0x2669('0x1f')]];}if(this[_0x2669('0xd')][_0x4a2bb4['uniqueid']]){delete this['variables'][_0x4a2bb4['uniqueid']];}}}catch(_0x3e3692){logger[_0x2669('0x2e')](_0x2669('0x6d'),util[_0x2669('0x40')](_0x3e3692,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x6e')]=function(_0x3b60ac){try{if(this[_0x2669('0x1e')](_0x3b60ac)){if(this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]]){for(var _0x3904b1 in this[_0x2669('0xa')][_0x3b60ac['transfereeuniqueid']]){if(this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]][_0x2669('0x47')](_0x3904b1)){if(_0x3b60ac[_0x2669('0x70')]===_0x3904b1){var _0x2a9c7d=moment();this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]][_0x3904b1]['agentcomplete']=!![];this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]][_0x3904b1][_0x2669('0x4a')]=moment()[_0x2669('0x21')](_0x2669('0x22'));this[_0x2669('0xa')][_0x3b60ac['transfereeuniqueid']][_0x3904b1][_0x2669('0x3c')]=_0x2669('0x4c');this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]][_0x3904b1][_0x2669('0x30')]='complete';this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]][_0x3904b1]['talktime']=_0x2a9c7d['diff'](this[_0x2669('0xa')][_0x3b60ac['transfereeuniqueid']][_0x3904b1][_0x2669('0x2f')],_0x2669('0x71'));}}}}if(this[_0x2669('0xa')][_0x3b60ac['secondtransfereruniqueid']]){var _0x5a78e0=this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x72')]];this[_0x2669('0xa')][_0x3b60ac['secondtransfereruniqueid']]=this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]];this[_0x2669('0xa')][_0x3b60ac[_0x2669('0x6f')]]=_0x5a78e0;}}}catch(_0x30680c){logger[_0x2669('0x2e')](_0x2669('0x73'),util[_0x2669('0x40')](_0x30680c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2669('0x1b')]=function(_0x1ea667){try{if(this[_0x2669('0x1e')](_0x1ea667)){if(this[_0x2669('0xa')][_0x1ea667['transfereeuniqueid']]){for(var _0x45517b in this[_0x2669('0xa')][_0x1ea667['transfereeuniqueid']]){if(this[_0x2669('0xa')][_0x1ea667['transfereeuniqueid']]['hasOwnProperty'](_0x45517b)){if(_0x1ea667[_0x2669('0x74')]===_0x45517b){var _0x72d38f=moment();this[_0x2669('0xa')][_0x1ea667['transfereeuniqueid']][_0x45517b][_0x2669('0x3b')]=!![];this[_0x2669('0xa')][_0x1ea667['transfereeuniqueid']][_0x45517b][_0x2669('0x4a')]=_0x72d38f;this[_0x2669('0xa')][_0x1ea667[_0x2669('0x6f')]][_0x45517b][_0x2669('0x3c')]=_0x2669('0x4c');this[_0x2669('0xa')][_0x1ea667[_0x2669('0x6f')]][_0x45517b]['lastevent']=_0x2669('0x75');this[_0x2669('0xa')][_0x1ea667[_0x2669('0x6f')]][_0x45517b][_0x2669('0x4b')]=_0x72d38f[_0x2669('0x76')](this['channels'][_0x1ea667[_0x2669('0x6f')]][_0x45517b][_0x2669('0x2f')],'seconds');}}}}}}catch(_0xa1af2e){logger['error'](_0x2669('0x77'),util[_0x2669('0x40')](_0xa1af2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2669('0x1c')][_0x2669('0x78')]=function(_0x519ec4){var _0x50750c='';try{if(this[_0x2669('0x1e')](_0x519ec4)){if(_0x519ec4[_0x2669('0x79')]){_0x50750c=_0x519ec4[_0x2669('0x79')][_0x2669('0x7a')](0x0,_0x519ec4[_0x2669('0x79')]['lastIndexOf']('-'));if(this['agents'][_0x50750c]){this[_0x2669('0xc')][_0x50750c][_0x2669('0x7b')]=!![];}}}}catch(_0x16d6a0){logger[_0x2669('0x2e')](_0x2669('0x7c'),util[_0x2669('0x40')](_0x16d6a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2669('0x7d')]=function(_0x55b514){var _0xed413b='';try{if(this[_0x2669('0x1e')](_0x55b514)){if(_0x55b514[_0x2669('0x79')]){_0xed413b=_0x55b514['channel'][_0x2669('0x7a')](0x0,_0x55b514[_0x2669('0x79')][_0x2669('0x7e')]('-'));if(this['agents'][_0xed413b]){this[_0x2669('0xc')][_0xed413b][_0x2669('0x7b')]=![];}}}}catch(_0x259b22){logger[_0x2669('0x2e')](_0x2669('0x7f'),util[_0x2669('0x40')](_0x259b22,{'showHidden':![],'depth':null}));}};module[_0x2669('0x80')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 42f15c0..277b88e 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 _0xdabe=['socket.io-emitter','channels','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','isNotNull','isUndefined','emit','prototype','linkedid','merge','uniqueid','error','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','context','from-sip','agents','split','destconnectedlinenum','exten','user:%s','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','duration','subtract','seconds','keys','includes','lastapplication','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinenum','calleridname','destinationchannel','membername','name','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','endsWith','.wav49','replace','monitorFilename','find','monitors','isNil','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','type','xmd-queue','queue','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfercalleridnum','origtransferercalleridnum','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','inuse','busy','invalid','unavailable','ringing','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','localhost'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0xdabe,0x1a8));var _0xedab=function(_0x3d0461,_0xeab134){_0x3d0461=_0x3d0461-0x0;var _0x5d5045=_0xdabe[_0x3d0461];return _0x5d5045;};'use strict';var BPromise=require('bluebird');var _=require(_0xedab('0x0'));var moment=require(_0xedab('0x1'));var util=require(_0xedab('0x2'));var path=require(_0xedab('0x3'));var Redis=require(_0xedab('0x4'));var config=require(_0xedab('0x5'));var logger=require(_0xedab('0x6'))(_0xedab('0x7'));var ami=require('../ami');var Channel=require(_0xedab('0x8'));var statusDesc=[_0xedab('0x9'),'not_inuse',_0xedab('0xa'),_0xedab('0xb'),_0xedab('0xc'),_0xedab('0xd'),_0xedab('0xe'),'ringinuse','onhold'];var applications=[_0xedab('0xf'),'queue',_0xedab('0x10'),_0xedab('0x11'),_0xedab('0x12'),_0xedab('0x13')];var dispositions=['NO\x20ANSWER',_0xedab('0x14'),'FAILED',_0xedab('0x15'),'NO\x20ANSWER',_0xedab('0x15'),_0xedab('0x16'),_0xedab('0x17'),_0xedab('0x14'),_0xedab('0x14'),_0xedab('0x14')];var actions={};config[_0xedab('0x18')]=_['defaults'](config[_0xedab('0x18')],{'host':_0xedab('0x19'),'port':0x18eb});var io=require(_0xedab('0x1a'))(new Redis(config['redis']));function VoiceCallReport(_0x28f99e){this[_0xedab('0x1b')]=_0x28f99e[_0xedab('0x1b')];this['agents']=_0x28f99e['agents'];ami['on']('coreshowchannel',this[_0xedab('0x1c')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x1e'),this[_0xedab('0x1c')][_0xedab('0x1d')](this));ami['on']('newchannel',this[_0xedab('0x1f')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x20'),this[_0xedab('0x21')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x22'),this[_0xedab('0x23')]['bind'](this));ami['on'](_0xedab('0x24'),this[_0xedab('0x25')][_0xedab('0x1d')](this));ami['on']('newcallerid',this[_0xedab('0x26')][_0xedab('0x1d')](this));ami['on'](_0xedab('0x27'),this['syncAttendedTransfer'][_0xedab('0x1d')](this));ami['on']('blindtransfer',this[_0xedab('0x28')]['bind'](this));ami['on'](_0xedab('0x29'),this[_0xedab('0x2a')][_0xedab('0x1d')](this));ami['on']('musiconholdstop',this[_0xedab('0x2b')][_0xedab('0x1d')](this));return BPromise[_0xedab('0x2c')]()[_0xedab('0x2d')](ami[_0xedab('0x2e')]())[_0xedab('0x2f')](function(_0x2ed730){console[_0xedab('0x30')](_0x2ed730);});}VoiceCallReport['prototype'][_0xedab('0x31')]=function(_0x9c38e4){return _0x9c38e4!==null&&!_[_0xedab('0x32')](_0x9c38e4);};VoiceCallReport['prototype'][_0xedab('0x33')]=function(_0x516686,_0x37db78,_0x35f4c5){io['to'](_0x516686)[_0xedab('0x33')](_0x37db78,_0x35f4c5);};VoiceCallReport[_0xedab('0x34')][_0xedab('0x26')]=function(_0x361bba){try{if(this[_0xedab('0x31')](_0x361bba)){if(_0x361bba['uniqueid']===_0x361bba[_0xedab('0x35')]){if(!_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x361bba['uniqueid']])){_[_0xedab('0x36')](this['channels'][_0x361bba[_0xedab('0x37')]],_['pick'](_0x361bba,_['keys'](this[_0xedab('0x1b')][_0x361bba[_0xedab('0x37')]])));}}}}catch(_0x1516a6){logger[_0xedab('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0xedab('0x39')](_0x1516a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x1f')]=function(_0x395969){try{if(this[_0xedab('0x31')](_0x395969)){if(_0x395969[_0xedab('0x37')]===_0x395969[_0xedab('0x35')]&&_0x395969[_0xedab('0x3a')]!=_0xedab('0x3b')){if(_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]])){this['channels'][_0x395969['uniqueid']]=new Channel();this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]][_0xedab('0x3c')]=moment()[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]][_0xedab('0x3f')]=dispositions[_[_0xedab('0x40')](_0x395969[_0xedab('0x41')])];_[_0xedab('0x36')](this[_0xedab('0x1b')][_0x395969['uniqueid']],_[_0xedab('0x42')](_0x395969,_['keys'](this[_0xedab('0x1b')][_0x395969[_0xedab('0x37')]])));if(_0x395969[_0xedab('0x43')]===_0xedab('0x44')){if(this[_0xedab('0x45')][_0x395969[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this['agents'][_0x395969[_0xedab('0x3a')]['split']('-')[0x0]][_0xedab('0x47')]=_0x395969[_0xedab('0x48')];this['emit'](util['format'](_0xedab('0x49'),this[_0xedab('0x45')][_0x395969[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]['name']),_0xedab('0x4a'),{'destaccountcode':this[_0xedab('0x45')][_0x395969['channel'][_0xedab('0x46')]('-')[0x0]][_0xedab('0x4b')],'destconnectedlinenum':_0x395969[_0xedab('0x48')]});}}}}}}catch(_0x324a04){logger['error'](_0xedab('0x4c'),util[_0xedab('0x39')](_0x324a04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x1c')]=function(_0x4452af){try{if(this['isNotNull'](_0x4452af)){if(_0x4452af['uniqueid']===_0x4452af[_0xedab('0x35')]&&_0x4452af['exten']!='h'&&_0x4452af[_0xedab('0x3a')]!=_0xedab('0x3b')){_0x4452af['application']=_0x4452af[_0xedab('0x4d')][_0xedab('0x4e')]();_0x4452af['applicationdata']=(_0x4452af[_0xedab('0x4f')]||_0x4452af[_0xedab('0x50')])[_0xedab('0x4e')]();if(_[_0xedab('0x32')](this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]])){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]=new Channel();this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0xedab('0x3c')]=_0x4452af[_0xedab('0x51')]?moment()[_0xedab('0x52')](moment[_0xedab('0x51')](_0x4452af[_0xedab('0x51')])[_0xedab('0x53')](),_0xedab('0x53'))[_0xedab('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]['disposition']='NO\x20ANSWER';}_[_0xedab('0x36')](this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]],_[_0xedab('0x42')](_0x4452af,_[_0xedab('0x54')](this[_0xedab('0x1b')][_0x4452af['uniqueid']])));if(_[_0xedab('0x55')](applications,_0x4452af[_0xedab('0x4d')])){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0xedab('0x56')]=_0x4452af[_0xedab('0x4d')];this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]]['lastdata']=_0x4452af[_0xedab('0x50')];if(_0x4452af['application']===_0xedab('0xf')&&_['startsWith'](_0x4452af[_0xedab('0x50')],_0xedab('0x57'))){var _0x4d9572=_0x4452af[_0xedab('0x50')]['split']('=');var _0x1b3be6=_0x4d9572[0x0][_0xedab('0x58')](/cdr\((.*)\)/);if(_0x1b3be6){this[_0xedab('0x1b')][_0x4452af[_0xedab('0x37')]][_0x1b3be6[0x1]]=_0x4d9572[0x1];}}else if(_0x4452af['application']==='queue'){this[_0xedab('0x1b')][_0x4452af['uniqueid']]['queue']=_0x4452af[_0xedab('0x50')][_0xedab('0x46')](',')[0x0];}}}}}catch(_0x428776){logger[_0xedab('0x38')](_0xedab('0x59'),util['inspect'](_0x428776,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x21')]=function(_0x19f27c){try{if(this[_0xedab('0x31')](_0x19f27c)){if(_0x19f27c[_0xedab('0x37')]!==_0x19f27c[_0xedab('0x35')]){if(this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]]){if(_0x19f27c['channelstate']==='6'){if(!this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5a')]){var _0x1eca76=moment();this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5a')]=!![];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5b')]=_0x1eca76[_0xedab('0x3d')](_0xedab('0x3e'));if(this[_0xedab('0x1b')][_0x19f27c['linkedid']]['starttime']){this['channels'][_0x19f27c['linkedid']]['holdtime']=_0x1eca76[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x3c')],_0xedab('0x53'));}}this[_0xedab('0x1b')][_0x19f27c['linkedid']][_0xedab('0x35')]=_0x19f27c[_0xedab('0x37')];if(_0x19f27c[_0xedab('0x5d')]!==_0xedab('0x5e')){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x5f')]=_0x19f27c[_0xedab('0x5d')];}this['channels'][_0x19f27c['linkedid']]['connectedlinename']=_0x19f27c[_0xedab('0x60')];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x61')]=_0x19f27c[_0xedab('0x3a')];this[_0xedab('0x1b')][_0x19f27c['linkedid']][_0xedab('0x3f')]=dispositions[_[_0xedab('0x40')](_0x19f27c[_0xedab('0x41')])];if(this[_0xedab('0x45')][_0x19f27c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]]['UserId']=this['agents'][_0x19f27c['channel']['split']('-')[0x0]]['id'];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x35')]][_0xedab('0x62')]=this['agents'][_0x19f27c['channel'][_0xedab('0x46')]('-')[0x0]][_0xedab('0x63')];}}}}else{if(this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]]){if(_0x19f27c[_0xedab('0x41')]==='6'){if(this['agents'][_0x19f27c[_0xedab('0x3a')]['split']('-')[0x0]]){this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]][_0xedab('0x64')]=this[_0xedab('0x45')][_0x19f27c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]['id'];this[_0xedab('0x1b')][_0x19f27c[_0xedab('0x37')]]['membername']=this['agents'][_0x19f27c[_0xedab('0x3a')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x3fce7c){logger[_0xedab('0x38')](_0xedab('0x65'),util[_0xedab('0x39')](_0x3fce7c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xedab('0x66')]=function(_0x13f078,_0x35ecdf){if(this[_0xedab('0x1b')][_0x13f078]){this[_0xedab('0x1b')][_0x13f078]['monitor']=!![];if(_[_0xedab('0x67')](_0x35ecdf,_0xedab('0x68'))){_0x35ecdf=_0x35ecdf[_0xedab('0x69')](_0xedab('0x68'),'.WAV');}this['channels'][_0x13f078][_0xedab('0x6a')]=_0x35ecdf;var _0xcd4388=_[_0xedab('0x6b')](this[_0xedab('0x1b')][_0x13f078][_0xedab('0x6c')],{'filename':_0x35ecdf});if(_[_0xedab('0x6d')](_0xcd4388)){this[_0xedab('0x1b')][_0x13f078]['monitors']['push']({'filename':_0x35ecdf,'createdAt':moment()[_0xedab('0x3d')](_0xedab('0x3e')),'mixmonitorid':'','status':_0xedab('0x6e')});}}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x23')]=function(_0x17b612){try{if(this[_0xedab('0x31')](_0x17b612)){if(this[_0xedab('0x1b')][_0x17b612['uniqueid']]&&_0x17b612['channel']!='OutgoingSpoolFailed'){if(this[_0xedab('0x31')](_0x17b612['variable'])){if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x70')])){this[_0xedab('0x66')](_0x17b612[_0xedab('0x37')],_0x17b612[_0xedab('0x71')]);}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-phone'])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x5d')]=_0x17b612[_0xedab('0x71')];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x72')])){this[_0xedab('0x1b')][_0x17b612['uniqueid']][_0xedab('0x73')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-cdrtype'])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x74')]=_0x17b612['value'];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x75')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x76')]=_0x17b612[_0xedab('0x71')][_0xedab('0x46')](',')[0x0];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')]['xmd-originatecalleridnum'])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]]['originatecalleridnum']=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x77')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x78')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612['variable'][_0xedab('0x79')])){this[_0xedab('0x1b')][_0x17b612[_0xedab('0x37')]][_0xedab('0x7a')]=_0x17b612[_0xedab('0x71')];}else if(this['isNotNull'](_0x17b612[_0xedab('0x6f')][_0xedab('0x7b')])){this['channels'][_0x17b612[_0xedab('0x37')]][_0xedab('0x76')]=_0x17b612[_0xedab('0x71')];}else if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')][_0xedab('0x7c')])){this[_0xedab('0x1b')][_0x17b612['uniqueid']][_0xedab('0x7d')]=_0x17b612[_0xedab('0x71')];}}}else if(this['isNotNull'](_0x17b612['variable'][_0xedab('0x70')])){if(_0x17b612[_0xedab('0x71')]){var _0x3e5cc1=path[_0xedab('0x7e')](_0x17b612[_0xedab('0x71')])[_0xedab('0x63')];this[_0xedab('0x66')](_0x3e5cc1,_0x17b612[_0xedab('0x71')]);}}else if(this['channels'][_0x17b612['linkedid']]){if(this[_0xedab('0x31')](_0x17b612[_0xedab('0x6f')])){if(this['isNotNull'](_0x17b612[_0xedab('0x6f')]['sipcallid'])){this[_0xedab('0x1b')][_0x17b612['linkedid']][_0xedab('0x7f')]=_0x17b612['value'];}}}}}catch(_0xb72c18){logger[_0xedab('0x38')]('[syncVarSet][VoiceCallReport]',util[_0xedab('0x39')](_0xb72c18,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x25')]=function(_0x385c0c){try{if(this[_0xedab('0x31')](_0x385c0c)){if(this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]){var _0x25785a=moment();this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]['endtime']=_0x25785a[_0xedab('0x3d')](_0xedab('0x3e'));this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x51')]=_0x25785a[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]['starttime'],_0xedab('0x53'));if(this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x5a')]){this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x80')]=_0x25785a[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x5b')],'seconds');this['channels'][_0x385c0c[_0xedab('0x37')]]['holdtime']=this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]][_0xedab('0x51')]-this[_0xedab('0x1b')][_0x385c0c['uniqueid']]['billableseconds'];}if(_0x385c0c['context']==='from-sip'){if(this['agents'][_0x385c0c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]]){this['agents'][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]]=_[_0xedab('0x81')](this['agents'][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]],['destconnectedlinenum']);this[_0xedab('0x33')](util[_0xedab('0x3d')](_0xedab('0x49'),this['agents'][_0x385c0c[_0xedab('0x3a')][_0xedab('0x46')]('-')[0x0]][_0xedab('0x63')]),_0xedab('0x82'),{'destaccountcode':this[_0xedab('0x45')][_0x385c0c[_0xedab('0x3a')]['split']('-')[0x0]][_0xedab('0x4b')]});}}ami[_0xedab('0x33')](_0xedab('0x83'),this[_0xedab('0x1b')][_0x385c0c[_0xedab('0x37')]]);delete this[_0xedab('0x1b')][_0x385c0c['uniqueid']];}}}catch(_0x43de43){logger['error'](_0xedab('0x84'),util['inspect'](_0x43de43,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')]['syncAttendedTransfer']=function(_0x1ec58d){try{if(this[_0xedab('0x31')](_0x1ec58d)){if(this['channels'][_0x1ec58d['transfereeuniqueid']]){this[_0xedab('0x1b')][_0x1ec58d['transfereeuniqueid']][_0xedab('0x85')]=_0x1ec58d[_0xedab('0x86')];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x87')]][_0xedab('0x88')]=_0x1ec58d[_0xedab('0x89')];if(this[_0xedab('0x1b')][_0x1ec58d['secondtransfereruniqueid']]){var _0x289d68=this['channels'][_0x1ec58d[_0xedab('0x8a')]];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8a')]]=this[_0xedab('0x1b')][_0x1ec58d['transfereeuniqueid']];this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x87')]]=_0x289d68;}}else if(this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8b')]]){this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']]['transfercalleridnum']=_0x1ec58d[_0xedab('0x86')];this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']][_0xedab('0x88')]=_0x1ec58d[_0xedab('0x89')];if(this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8c')]]){var _0x289d68=this[_0xedab('0x1b')][_0x1ec58d[_0xedab('0x8c')]];this[_0xedab('0x1b')][_0x1ec58d['origtransfereruniqueid']]=this['channels'][_0x1ec58d[_0xedab('0x8b')]];this[_0xedab('0x1b')][_0x1ec58d['transfertargetuniqueid']]=_0x289d68;}}}}catch(_0x107453){logger['error'](_0xedab('0x8d'),util[_0xedab('0x39')](_0x107453,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x28')]=function(_0x568df5){try{if(this[_0xedab('0x31')](_0x568df5)){if(this[_0xedab('0x1b')][_0x568df5[_0xedab('0x87')]]){this[_0xedab('0x1b')][_0x568df5[_0xedab('0x87')]][_0xedab('0x85')]=_0x568df5['transfereecalleridnum'];this['channels'][_0x568df5['transfereeuniqueid']]['transferconnectedlinenum']=_0x568df5[_0xedab('0x8e')];this[_0xedab('0x25')]({'event':'BlindTransfer','uniqueid':_0x568df5[_0xedab('0x87')],'context':_0x568df5['context'],'channel':_0x568df5['transfererchannel']});}}}catch(_0x169abe){logger['error'](_0xedab('0x8f'),util[_0xedab('0x39')](_0x169abe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')][_0xedab('0x2a')]=function(_0xba2c5a){try{if(this['isNotNull'](_0xba2c5a)){if(this[_0xedab('0x1b')][_0xba2c5a[_0xedab('0x37')]]){if(!_[_0xedab('0x6d')](this[_0xedab('0x1b')][_0xba2c5a[_0xedab('0x37')]][_0xedab('0x5b')])){this[_0xedab('0x1b')][_0xba2c5a['uniqueid']][_0xedab('0x90')]=moment()[_0xedab('0x3d')](_0xedab('0x3e'));}}}}catch(_0x27ceac){logger[_0xedab('0x38')](_0xedab('0x91'),util[_0xedab('0x39')](_0x27ceac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xedab('0x34')]['syncMusicOnHoldStop']=function(_0x21ee2f){try{if(this['isNotNull'](_0x21ee2f)){if(this['channels'][_0x21ee2f[_0xedab('0x37')]]){if(!_[_0xedab('0x6d')](this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x90')])){this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x92')]+=moment()[_0xedab('0x93')](0x0)[_0xedab('0x5c')](this[_0xedab('0x1b')][_0x21ee2f['uniqueid']]['mohstarttime'],_0xedab('0x53'));delete this[_0xedab('0x1b')][_0x21ee2f[_0xedab('0x37')]][_0xedab('0x90')];}}}}catch(_0x157132){logger[_0xedab('0x38')](_0xedab('0x94'),util[_0xedab('0x39')](_0x157132,{'showHidden':![],'depth':null}));}};module[_0xedab('0x95')]=VoiceCallReport; \ No newline at end of file +var _0x2aec=['extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','moment','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','linkedid','merge','pick','keys','uniqueid','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','isUndefined','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','user:%s','name','user:agentconnect','accountcode','exten','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','seconds','includes','lastapplication','lastdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','diff','xcally-motion-preview','connectedlinenum','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','syncMixMonitorFilename','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-cdrtype','type','xmd-queue','originatecalleridnum','destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','answertime','holdtime','billableseconds','omit','emit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]'];(function(_0x1df45d,_0x1a446d){var _0x512f7c=function(_0xbf46f3){while(--_0xbf46f3){_0x1df45d['push'](_0x1df45d['shift']());}};_0x512f7c(++_0x1a446d);}(_0x2aec,0x1dd));var _0xc2ae=function(_0x25e1da,_0x1b93a5){_0x25e1da=_0x25e1da-0x0;var _0x45f430=_0x2aec[_0x25e1da];return _0x45f430;};'use strict';var BPromise=require(_0xc2ae('0x0'));var _=require('lodash');var moment=require(_0xc2ae('0x1'));var util=require('util');var path=require(_0xc2ae('0x2'));var Redis=require(_0xc2ae('0x3'));var config=require(_0xc2ae('0x4'));var logger=require(_0xc2ae('0x5'))('ami');var ami=require('../ami');var Channel=require(_0xc2ae('0x6'));var statusDesc=[_0xc2ae('0x7'),_0xc2ae('0x8'),_0xc2ae('0x9'),_0xc2ae('0xa'),'invalid',_0xc2ae('0xb'),_0xc2ae('0xc'),_0xc2ae('0xd'),_0xc2ae('0xe')];var applications=[_0xc2ae('0xf'),_0xc2ae('0x10'),_0xc2ae('0x11'),_0xc2ae('0x12'),_0xc2ae('0x13'),_0xc2ae('0x14')];var dispositions=['NO\x20ANSWER',_0xc2ae('0x15'),_0xc2ae('0x15'),_0xc2ae('0x16'),_0xc2ae('0x16'),_0xc2ae('0x16'),_0xc2ae('0x17'),_0xc2ae('0x18'),_0xc2ae('0x15'),'FAILED',_0xc2ae('0x15')];var actions={};config[_0xc2ae('0x19')]=_[_0xc2ae('0x1a')](config[_0xc2ae('0x19')],{'host':_0xc2ae('0x1b'),'port':0x18eb});var io=require(_0xc2ae('0x1c'))(new Redis(config[_0xc2ae('0x19')]));function VoiceCallReport(_0x12abfe){this[_0xc2ae('0x1d')]=_0x12abfe[_0xc2ae('0x1d')];this[_0xc2ae('0x1e')]=_0x12abfe[_0xc2ae('0x1e')];ami['on'](_0xc2ae('0x1f'),this['syncNewExten'][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x21'),this[_0xc2ae('0x22')][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x23'),this['syncNewChannel'][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x24'),this[_0xc2ae('0x25')][_0xc2ae('0x20')](this));ami['on']('varset',this[_0xc2ae('0x26')]['bind'](this));ami['on'](_0xc2ae('0x27'),this[_0xc2ae('0x28')][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x29'),this[_0xc2ae('0x2a')][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x2b'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xc2ae('0x2c'),this[_0xc2ae('0x2d')][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x2e'),this[_0xc2ae('0x2f')][_0xc2ae('0x20')](this));ami['on'](_0xc2ae('0x30'),this[_0xc2ae('0x31')][_0xc2ae('0x20')](this));return BPromise['resolve']()[_0xc2ae('0x32')](ami[_0xc2ae('0x33')]())[_0xc2ae('0x34')](function(_0x1f118f){console[_0xc2ae('0x35')](_0x1f118f);});}VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x37')]=function(_0x4d0645){return _0x4d0645!==null&&!_['isUndefined'](_0x4d0645);};VoiceCallReport[_0xc2ae('0x36')]['emit']=function(_0x539b19,_0x459258,_0x3a5c3d){io['to'](_0x539b19)['emit'](_0x459258,_0x3a5c3d);};VoiceCallReport[_0xc2ae('0x36')]['syncNewCallerId']=function(_0x12159b){try{if(this[_0xc2ae('0x37')](_0x12159b)){if(_0x12159b['uniqueid']===_0x12159b[_0xc2ae('0x38')]){if(!_['isUndefined'](this[_0xc2ae('0x1d')][_0x12159b['uniqueid']])){_[_0xc2ae('0x39')](this[_0xc2ae('0x1d')][_0x12159b['uniqueid']],_[_0xc2ae('0x3a')](_0x12159b,_[_0xc2ae('0x3b')](this['channels'][_0x12159b[_0xc2ae('0x3c')]])));}}}}catch(_0x311133){logger[_0xc2ae('0x3d')](_0xc2ae('0x3e'),util[_0xc2ae('0x3f')](_0x311133,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')]['syncNewChannel']=function(_0x35c6ac){try{if(this['isNotNull'](_0x35c6ac)){if(_0x35c6ac['uniqueid']===_0x35c6ac[_0xc2ae('0x38')]&&_0x35c6ac[_0xc2ae('0x40')]!=_0xc2ae('0x41')){if(_[_0xc2ae('0x42')](this[_0xc2ae('0x1d')][_0x35c6ac[_0xc2ae('0x3c')]])){this['channels'][_0x35c6ac[_0xc2ae('0x3c')]]=new Channel();this[_0xc2ae('0x1d')][_0x35c6ac[_0xc2ae('0x3c')]][_0xc2ae('0x43')]=moment()[_0xc2ae('0x44')](_0xc2ae('0x45'));this['channels'][_0x35c6ac[_0xc2ae('0x3c')]][_0xc2ae('0x46')]=dispositions[_[_0xc2ae('0x47')](_0x35c6ac[_0xc2ae('0x48')])];_['merge'](this[_0xc2ae('0x1d')][_0x35c6ac[_0xc2ae('0x3c')]],_[_0xc2ae('0x3a')](_0x35c6ac,_[_0xc2ae('0x3b')](this[_0xc2ae('0x1d')][_0x35c6ac[_0xc2ae('0x3c')]])));if(_0x35c6ac['context']===_0xc2ae('0x49')){if(this[_0xc2ae('0x1e')][_0x35c6ac[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]){this[_0xc2ae('0x1e')][_0x35c6ac['channel']['split']('-')[0x0]][_0xc2ae('0x4b')]=_0x35c6ac['exten'];this['emit'](util[_0xc2ae('0x44')](_0xc2ae('0x4c'),this['agents'][_0x35c6ac[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]][_0xc2ae('0x4d')]),_0xc2ae('0x4e'),{'destaccountcode':this[_0xc2ae('0x1e')][_0x35c6ac[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]][_0xc2ae('0x4f')],'destconnectedlinenum':_0x35c6ac[_0xc2ae('0x50')]});}}}}}}catch(_0x301e1e){logger['error'](_0xc2ae('0x51'),util[_0xc2ae('0x3f')](_0x301e1e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x22')]=function(_0x45a5c1){try{if(this[_0xc2ae('0x37')](_0x45a5c1)){if(_0x45a5c1[_0xc2ae('0x3c')]===_0x45a5c1[_0xc2ae('0x38')]&&_0x45a5c1[_0xc2ae('0x50')]!='h'&&_0x45a5c1[_0xc2ae('0x40')]!='OutgoingSpoolFailed'){_0x45a5c1[_0xc2ae('0x52')]=_0x45a5c1[_0xc2ae('0x52')][_0xc2ae('0x53')]();_0x45a5c1[_0xc2ae('0x54')]=(_0x45a5c1[_0xc2ae('0x55')]||_0x45a5c1['applicationdata'])[_0xc2ae('0x53')]();if(_[_0xc2ae('0x42')](this[_0xc2ae('0x1d')][_0x45a5c1[_0xc2ae('0x3c')]])){this['channels'][_0x45a5c1[_0xc2ae('0x3c')]]=new Channel();this[_0xc2ae('0x1d')][_0x45a5c1['uniqueid']][_0xc2ae('0x43')]=_0x45a5c1[_0xc2ae('0x56')]?moment()['subtract'](moment[_0xc2ae('0x56')](_0x45a5c1['duration'])[_0xc2ae('0x57')](),'seconds')[_0xc2ae('0x44')](_0xc2ae('0x45')):moment()[_0xc2ae('0x44')](_0xc2ae('0x45'));this[_0xc2ae('0x1d')][_0x45a5c1['uniqueid']][_0xc2ae('0x46')]=_0xc2ae('0x16');}_['merge'](this[_0xc2ae('0x1d')][_0x45a5c1[_0xc2ae('0x3c')]],_[_0xc2ae('0x3a')](_0x45a5c1,_[_0xc2ae('0x3b')](this[_0xc2ae('0x1d')][_0x45a5c1['uniqueid']])));if(_[_0xc2ae('0x58')](applications,_0x45a5c1[_0xc2ae('0x52')])){this['channels'][_0x45a5c1[_0xc2ae('0x3c')]][_0xc2ae('0x59')]=_0x45a5c1['application'];this['channels'][_0x45a5c1[_0xc2ae('0x3c')]][_0xc2ae('0x5a')]=_0x45a5c1[_0xc2ae('0x54')];if(_0x45a5c1[_0xc2ae('0x52')]===_0xc2ae('0xf')&&_[_0xc2ae('0x5b')](_0x45a5c1[_0xc2ae('0x54')],_0xc2ae('0x5c'))){var _0x366b9e=_0x45a5c1['applicationdata'][_0xc2ae('0x4a')]('=');var _0x18a6f6=_0x366b9e[0x0]['match'](/cdr\((.*)\)/);if(_0x18a6f6){this[_0xc2ae('0x1d')][_0x45a5c1[_0xc2ae('0x3c')]][_0x18a6f6[0x1]]=_0x366b9e[0x1];}}else if(_0x45a5c1[_0xc2ae('0x52')]===_0xc2ae('0x10')){this[_0xc2ae('0x1d')][_0x45a5c1[_0xc2ae('0x3c')]][_0xc2ae('0x10')]=_0x45a5c1[_0xc2ae('0x54')][_0xc2ae('0x4a')](',')[0x0];}}}}}catch(_0x4b7e57){logger[_0xc2ae('0x3d')](_0xc2ae('0x5d'),util['inspect'](_0x4b7e57,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x25')]=function(_0x5107ab){try{if(this[_0xc2ae('0x37')](_0x5107ab)){if(_0x5107ab[_0xc2ae('0x3c')]!==_0x5107ab[_0xc2ae('0x38')]){if(this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]]){if(_0x5107ab[_0xc2ae('0x48')]==='6'){if(!this[_0xc2ae('0x1d')][_0x5107ab['linkedid']][_0xc2ae('0x5e')]){var _0x1f10ad=moment();this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x5e')]=!![];this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]]['answertime']=_0x1f10ad[_0xc2ae('0x44')](_0xc2ae('0x45'));if(this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x43')]){this[_0xc2ae('0x1d')][_0x5107ab['linkedid']]['holdtime']=_0x1f10ad[_0xc2ae('0x5f')](this[_0xc2ae('0x1d')][_0x5107ab['linkedid']][_0xc2ae('0x43')],_0xc2ae('0x57'));}}this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]]['linkedid']=_0x5107ab['uniqueid'];if(_0x5107ab['calleridnum']!==_0xc2ae('0x60')){this['channels'][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x61')]=_0x5107ab[_0xc2ae('0x62')];}this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x63')]=_0x5107ab[_0xc2ae('0x64')];this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x65')]=_0x5107ab[_0xc2ae('0x40')];this[_0xc2ae('0x1d')][_0x5107ab['linkedid']]['disposition']=dispositions[_[_0xc2ae('0x47')](_0x5107ab[_0xc2ae('0x48')])];if(this[_0xc2ae('0x1e')][_0x5107ab[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]){this['channels'][_0x5107ab['linkedid']][_0xc2ae('0x66')]=this[_0xc2ae('0x1e')][_0x5107ab[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]['id'];this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x38')]][_0xc2ae('0x67')]=this['agents'][_0x5107ab[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]][_0xc2ae('0x4d')];}}}}else{if(this[_0xc2ae('0x1d')][_0x5107ab[_0xc2ae('0x3c')]]){if(_0x5107ab['channelstate']==='6'){if(this[_0xc2ae('0x1e')][_0x5107ab['channel'][_0xc2ae('0x4a')]('-')[0x0]]){this[_0xc2ae('0x1d')][_0x5107ab['uniqueid']][_0xc2ae('0x66')]=this['agents'][_0x5107ab[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]['id'];this['channels'][_0x5107ab[_0xc2ae('0x3c')]][_0xc2ae('0x67')]=this[_0xc2ae('0x1e')][_0x5107ab['channel']['split']('-')[0x0]][_0xc2ae('0x4d')];}}}}}}catch(_0x33e5ae){logger[_0xc2ae('0x3d')]('[syncNewState][VoiceCallReport]',util['inspect'](_0x33e5ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x68')]=function(_0x23c016,_0xf856cc){if(this[_0xc2ae('0x1d')][_0x23c016]){this[_0xc2ae('0x1d')][_0x23c016]['monitor']=!![];if(_[_0xc2ae('0x69')](_0xf856cc,_0xc2ae('0x6a'))){_0xf856cc=_0xf856cc[_0xc2ae('0x6b')](_0xc2ae('0x6a'),_0xc2ae('0x6c'));}this[_0xc2ae('0x1d')][_0x23c016]['monitorFilename']=_0xf856cc;var _0x3fe8a4=_[_0xc2ae('0x6d')](this[_0xc2ae('0x1d')][_0x23c016][_0xc2ae('0x6e')],{'filename':_0xf856cc});if(_[_0xc2ae('0x6f')](_0x3fe8a4)){this['channels'][_0x23c016][_0xc2ae('0x6e')][_0xc2ae('0x70')]({'filename':_0xf856cc,'createdAt':moment()[_0xc2ae('0x44')](_0xc2ae('0x45')),'mixmonitorid':'','status':_0xc2ae('0x71')});}}};VoiceCallReport[_0xc2ae('0x36')]['syncVarSet']=function(_0x3acf9e){try{if(this['isNotNull'](_0x3acf9e)){if(this[_0xc2ae('0x1d')][_0x3acf9e[_0xc2ae('0x3c')]]&&_0x3acf9e[_0xc2ae('0x40')]!=_0xc2ae('0x41')){if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')])){if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x73')])){this[_0xc2ae('0x68')](_0x3acf9e[_0xc2ae('0x3c')],_0x3acf9e[_0xc2ae('0x74')]);}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x75')])){this['channels'][_0x3acf9e[_0xc2ae('0x3c')]]['calleridnum']=_0x3acf9e[_0xc2ae('0x74')];}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')]['xmd-callerid'])){this['channels'][_0x3acf9e[_0xc2ae('0x3c')]]['callerid']=_0x3acf9e['value'];}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x76')])){this[_0xc2ae('0x1d')][_0x3acf9e['uniqueid']][_0xc2ae('0x77')]=_0x3acf9e[_0xc2ae('0x74')];}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x78')])){this[_0xc2ae('0x1d')][_0x3acf9e[_0xc2ae('0x3c')]]['queue']=_0x3acf9e['value'][_0xc2ae('0x4a')](',')[0x0];}else if(this['isNotNull'](_0x3acf9e[_0xc2ae('0x72')]['xmd-originatecalleridnum'])){this[_0xc2ae('0x1d')][_0x3acf9e[_0xc2ae('0x3c')]][_0xc2ae('0x79')]=_0x3acf9e[_0xc2ae('0x74')];}else if(this['isNotNull'](_0x3acf9e[_0xc2ae('0x72')]['xmd-destination'])){this['channels'][_0x3acf9e['uniqueid']][_0xc2ae('0x7a')]=_0x3acf9e[_0xc2ae('0x74')];}else if(this['isNotNull'](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x7b')])){this['channels'][_0x3acf9e[_0xc2ae('0x3c')]]['calleridpreview']=_0x3acf9e[_0xc2ae('0x74')];}else if(this['isNotNull'](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x7c')])){this[_0xc2ae('0x1d')][_0x3acf9e['uniqueid']][_0xc2ae('0x10')]=_0x3acf9e['value'];}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x7d')])){this['channels'][_0x3acf9e[_0xc2ae('0x3c')]][_0xc2ae('0x7e')]=_0x3acf9e[_0xc2ae('0x74')];}}}else if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x73')])){if(_0x3acf9e[_0xc2ae('0x74')]){var _0x460ff1=path['parse'](_0x3acf9e[_0xc2ae('0x74')])['name'];this[_0xc2ae('0x68')](_0x460ff1,_0x3acf9e[_0xc2ae('0x74')]);}}else if(this['channels'][_0x3acf9e['linkedid']]){if(this[_0xc2ae('0x37')](_0x3acf9e['variable'])){if(this[_0xc2ae('0x37')](_0x3acf9e[_0xc2ae('0x72')][_0xc2ae('0x7d')])){this['channels'][_0x3acf9e['linkedid']][_0xc2ae('0x7f')]=_0x3acf9e[_0xc2ae('0x74')];}}}}}catch(_0x50097a){logger[_0xc2ae('0x3d')](_0xc2ae('0x80'),util['inspect'](_0x50097a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x2ba742){try{if(this[_0xc2ae('0x37')](_0x2ba742)){if(this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]]){var _0x2984c2=moment();this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x81')]=_0x2984c2[_0xc2ae('0x44')](_0xc2ae('0x45'));this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x56')]=_0x2984c2[_0xc2ae('0x5f')](this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x43')],_0xc2ae('0x57'));if(this[_0xc2ae('0x1d')][_0x2ba742['uniqueid']][_0xc2ae('0x5e')]){this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]]['billableseconds']=_0x2984c2[_0xc2ae('0x5f')](this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x82')],_0xc2ae('0x57'));this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x83')]=this[_0xc2ae('0x1d')][_0x2ba742['uniqueid']][_0xc2ae('0x56')]-this[_0xc2ae('0x1d')][_0x2ba742[_0xc2ae('0x3c')]][_0xc2ae('0x84')];}if(_0x2ba742['context']===_0xc2ae('0x49')){if(this[_0xc2ae('0x1e')][_0x2ba742[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]){this[_0xc2ae('0x1e')][_0x2ba742[_0xc2ae('0x40')]['split']('-')[0x0]]=_[_0xc2ae('0x85')](this[_0xc2ae('0x1e')][_0x2ba742[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]],[_0xc2ae('0x4b')]);this[_0xc2ae('0x86')](util[_0xc2ae('0x44')]('user:%s',this[_0xc2ae('0x1e')][_0x2ba742[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]]['name']),_0xc2ae('0x87'),{'destaccountcode':this[_0xc2ae('0x1e')][_0x2ba742[_0xc2ae('0x40')][_0xc2ae('0x4a')]('-')[0x0]][_0xc2ae('0x4f')]});}}ami[_0xc2ae('0x86')](_0xc2ae('0x88'),this['channels'][_0x2ba742[_0xc2ae('0x3c')]]);delete this['channels'][_0x2ba742['uniqueid']];}}}catch(_0x466cf9){logger[_0xc2ae('0x3d')](_0xc2ae('0x89'),util[_0xc2ae('0x3f')](_0x466cf9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')]['syncAttendedTransfer']=function(_0x3b4bd6){try{if(this['isNotNull'](_0x3b4bd6)){if(this[_0xc2ae('0x1d')][_0x3b4bd6['transfereeuniqueid']]){this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x8a')]][_0xc2ae('0x8b')]=_0x3b4bd6[_0xc2ae('0x8c')];this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x8a')]][_0xc2ae('0x8d')]=_0x3b4bd6[_0xc2ae('0x8e')];if(this[_0xc2ae('0x1d')][_0x3b4bd6['secondtransfereruniqueid']]){var _0x40a301=this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x8f')]];this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x8f')]]=this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x8a')]];this['channels'][_0x3b4bd6[_0xc2ae('0x8a')]]=_0x40a301;}}else if(this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x90')]]){this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x90')]]['transfercalleridnum']=_0x3b4bd6[_0xc2ae('0x8c')];this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x90')]]['transferconnectedlinenum']=_0x3b4bd6[_0xc2ae('0x8e')];if(this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x91')]]){var _0x40a301=this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x91')]];this[_0xc2ae('0x1d')][_0x3b4bd6['origtransfereruniqueid']]=this[_0xc2ae('0x1d')][_0x3b4bd6[_0xc2ae('0x90')]];this[_0xc2ae('0x1d')][_0x3b4bd6['transfertargetuniqueid']]=_0x40a301;}}}}catch(_0x342e5d){logger['error'](_0xc2ae('0x92'),util[_0xc2ae('0x3f')](_0x342e5d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x2d')]=function(_0x5bafe5){try{if(this[_0xc2ae('0x37')](_0x5bafe5)){if(this[_0xc2ae('0x1d')][_0x5bafe5[_0xc2ae('0x8a')]]){this['channels'][_0x5bafe5[_0xc2ae('0x8a')]][_0xc2ae('0x8b')]=_0x5bafe5['transfereecalleridnum'];this[_0xc2ae('0x1d')][_0x5bafe5[_0xc2ae('0x8a')]][_0xc2ae('0x8d')]=_0x5bafe5[_0xc2ae('0x93')];this[_0xc2ae('0x28')]({'event':_0xc2ae('0x94'),'uniqueid':_0x5bafe5[_0xc2ae('0x8a')],'context':_0x5bafe5[_0xc2ae('0x95')],'channel':_0x5bafe5[_0xc2ae('0x96')]});}}}catch(_0x423934){logger['error'](_0xc2ae('0x97'),util[_0xc2ae('0x3f')](_0x423934,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x2f')]=function(_0x5d3cee){try{if(this['isNotNull'](_0x5d3cee)){if(this[_0xc2ae('0x1d')][_0x5d3cee[_0xc2ae('0x3c')]]){if(!_[_0xc2ae('0x6f')](this[_0xc2ae('0x1d')][_0x5d3cee['uniqueid']][_0xc2ae('0x82')])){this['channels'][_0x5d3cee[_0xc2ae('0x3c')]][_0xc2ae('0x98')]=moment()['format'](_0xc2ae('0x45'));}}}}catch(_0x2a94a4){logger[_0xc2ae('0x3d')](_0xc2ae('0x99'),util[_0xc2ae('0x3f')](_0x2a94a4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xc2ae('0x36')][_0xc2ae('0x31')]=function(_0x4be067){try{if(this[_0xc2ae('0x37')](_0x4be067)){if(this[_0xc2ae('0x1d')][_0x4be067[_0xc2ae('0x3c')]]){if(!_['isNil'](this[_0xc2ae('0x1d')][_0x4be067[_0xc2ae('0x3c')]][_0xc2ae('0x98')])){this[_0xc2ae('0x1d')][_0x4be067['uniqueid']]['mohtime']+=moment()[_0xc2ae('0x9a')](0x0)[_0xc2ae('0x5f')](this['channels'][_0x4be067['uniqueid']][_0xc2ae('0x98')],_0xc2ae('0x57'));delete this[_0xc2ae('0x1d')][_0x4be067[_0xc2ae('0x3c')]]['mohstarttime'];}}}}catch(_0x14e2a5){logger[_0xc2ae('0x3d')](_0xc2ae('0x9b'),util[_0xc2ae('0x3f')](_0x14e2a5,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index b0912c5..91dc03a 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 _0xfd2f=['[syncHangup][VoiceDialReport]','exports','lodash','moment','util','../../../config/environment','ami','../ami','defaults','redis','channels','outbound','dialbegin','syncDialBegin','bind','dialend','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','format','called','channel','substring','lastIndexOf','omit','event','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','voice:outbound','[syncDialEnd][VoiceDialReport]','syncVarSet','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','includes','variables','endtime','duration','diff','starttime','seconds','lastevent','holdtime','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove'];(function(_0x13289a,_0x5ad531){var _0x2658a0=function(_0x5c9dfd){while(--_0x5c9dfd){_0x13289a['push'](_0x13289a['shift']());}};_0x2658a0(++_0x5ad531);}(_0xfd2f,0x14a));var _0xffd2=function(_0x413704,_0x21b102){_0x413704=_0x413704-0x0;var _0x45940b=_0xfd2f[_0x413704];return _0x45940b;};'use strict';var _=require(_0xffd2('0x0'));var moment=require(_0xffd2('0x1'));var util=require(_0xffd2('0x2'));var Redis=require('ioredis');var config=require(_0xffd2('0x3'));var logger=require('../../../config/logger')(_0xffd2('0x4'));var ami=require(_0xffd2('0x5'));config['redis']=_[_0xffd2('0x6')](config[_0xffd2('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0xd5e752){this[_0xffd2('0x8')]=_0xd5e752['outboundChannels'];this[_0xffd2('0x9')]=_0xd5e752['outbound'];this['variables']={};ami['on'](_0xffd2('0xa'),this[_0xffd2('0xb')][_0xffd2('0xc')](this));ami['on'](_0xffd2('0xd'),this['syncDialEnd'][_0xffd2('0xc')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xffd2('0xe'),this[_0xffd2('0xf')][_0xffd2('0xc')](this));}VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x11')]=function(_0x1f135b){return _0x1f135b!==null&&!_[_0xffd2('0x12')](_0x1f135b);};VoiceDialReport['prototype']['emit']=function(_0x4de637,_0x4bf841,_0x2f0d34){io['to'](_0x4de637)[_0xffd2('0x13')](_0x4bf841,_0x2f0d34);};VoiceDialReport['prototype'][_0xffd2('0xb')]=function(_0x391d70){try{if(this[_0xffd2('0x11')](_0x391d70)){if(this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]]){_[_0xffd2('0x15')](this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]],{'starttime':moment()[_0xffd2('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xffd2('0x17'),'interface':_0x391d70[_0xffd2('0x18')][_0xffd2('0x19')](0x0,_0x391d70['channel'][_0xffd2('0x1a')]('-')),'membername':_0x391d70[_0xffd2('0x18')][_0xffd2('0x19')](_0x391d70[_0xffd2('0x18')]['lastIndexOf']('/')+0x1,_0x391d70['channel'][_0xffd2('0x1a')]('-'))},_[_0xffd2('0x1b')](_0x391d70,[_0xffd2('0x1c'),'privilege']));this[_0xffd2('0x13')]('voice:outbound',_0xffd2('0x1d'),this[_0xffd2('0x8')][_0x391d70['uniqueid']]);ami[_0xffd2('0x13')](_0xffd2('0x1e'),this[_0xffd2('0x8')][_0x391d70[_0xffd2('0x14')]]);}}}catch(_0x2b8ca2){logger[_0xffd2('0x1f')](_0xffd2('0x20'),util[_0xffd2('0x21')](_0x2b8ca2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x22')]=function(_0x202f9f){try{if(this['isNotNull'](_0x202f9f)){if(this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]){this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x23')]=_0x202f9f[_0xffd2('0x23')];if(_0x202f9f['dialstatus']===_0xffd2('0x24')){this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x25')]=_0x202f9f[_0xffd2('0x25')];this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]['connectedlinename']=_0x202f9f[_0xffd2('0x26')];this['channels'][_0x202f9f[_0xffd2('0x14')]][_0xffd2('0x27')]=moment()[_0xffd2('0x16')](_0xffd2('0x28'));this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]['lastevent']='connect';ami[_0xffd2('0x13')]('custom:dialconnect',this[_0xffd2('0x8')][_0x202f9f[_0xffd2('0x14')]]);}this[_0xffd2('0x13')](_0xffd2('0x29'),'voice_outbound_channel:save',this['channels'][_0x202f9f[_0xffd2('0x14')]]);}}}catch(_0x7ece74){logger['error'](_0xffd2('0x2a'),util[_0xffd2('0x21')](_0x7ece74,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xffd2('0x2b')]=function(_0x66eb3a){try{if(this[_0xffd2('0x11')](_0x66eb3a)){this['addVariable'](_0x66eb3a['uniqueid'],_[_0xffd2('0x2c')](_0x66eb3a[_0xffd2('0x2d')])[0x0],_0x66eb3a[_0xffd2('0x2e')]);if(this[_0xffd2('0x11')](_0x66eb3a[_0xffd2('0x2d')])&&this['isNotNull'](_0x66eb3a['variable'][_0xffd2('0x2f')])){if(_[_0xffd2('0x12')](this[_0xffd2('0x8')][_0x66eb3a['uniqueid']])){this[_0xffd2('0x8')][_0x66eb3a[_0xffd2('0x14')]]={'routeId':_0x66eb3a[_0xffd2('0x2e')],'variables':this['variables'][_0x66eb3a[_0xffd2('0x14')]]};this[_0xffd2('0x13')](_0xffd2('0x29'),_0xffd2('0x1d'),this[_0xffd2('0x8')][_0x66eb3a[_0xffd2('0x14')]]);}}}}catch(_0x2c0916){logger['error'](_0xffd2('0x30'),util[_0xffd2('0x21')](_0x2c0916,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xffd2('0x10')][_0xffd2('0x31')]=function(_0x3aa1ce,_0x2d0dd8,_0x55745e){var _0x18e464=[_0xffd2('0x32'),_0xffd2('0x33'),_0xffd2('0x34'),_0xffd2('0x35'),_0xffd2('0x36'),_0xffd2('0x37'),'rtpaudioqosrtt',_0xffd2('0x38'),'sipcallid','sipuri',_0xffd2('0x39'),_0xffd2('0x3a'),_0xffd2('0x3b'),_0xffd2('0x3c'),_0xffd2('0x3d'),'memberlastcall',_0xffd2('0x3e'),_0xffd2('0x3f'),'memberrealtime'];if(!_['isNil'](_0x2d0dd8)&&!_[_0xffd2('0x40')](_0x18e464,_0x2d0dd8)){if(_[_0xffd2('0x12')](this[_0xffd2('0x41')][_0x3aa1ce])){this[_0xffd2('0x41')][_0x3aa1ce]={};}this[_0xffd2('0x41')][_0x3aa1ce][_0x2d0dd8]=_0x55745e;}};VoiceDialReport[_0xffd2('0x10')]['syncHangup']=function(_0x2d5e6c){try{if(this['isNotNull'](_0x2d5e6c)){if(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]){this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']][_0xffd2('0x42')]=moment()[_0xffd2('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x43')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x42')])[_0xffd2('0x44')](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x45')],_0xffd2('0x46'));this['channels'][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x47')]='complete';this[_0xffd2('0x9')]['total']+=0x1;if(this['channels'][_0x2d5e6c['uniqueid']][_0xffd2('0x27')]){this['outbound']['answered']+=0x1;this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']][_0xffd2('0x48')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x27')])[_0xffd2('0x44')](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x45')],_0xffd2('0x46'));this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x49')]=moment(this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x42')])['diff'](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x27')],_0xffd2('0x46'));this[_0xffd2('0x9')]['sumHoldTime']+=this['channels'][_0x2d5e6c[_0xffd2('0x14')]]['holdtime']||0x0;this[_0xffd2('0x9')][_0xffd2('0x4a')]+=this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]][_0xffd2('0x49')];}this[_0xffd2('0x9')][_0xffd2('0x4b')]+=this[_0xffd2('0x8')][_0x2d5e6c['uniqueid']]['duration'];ami[_0xffd2('0x13')](_0xffd2('0x4c'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);ami['emit'](_0xffd2('0x4d'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);this['emit'](_0xffd2('0x29'),'voice_outbound:save',this[_0xffd2('0x9')]);logger['info'](_0xffd2('0x4e'),JSON['stringify'](this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]));this[_0xffd2('0x13')](_0xffd2('0x29'),_0xffd2('0x4f'),this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]]);delete this[_0xffd2('0x8')][_0x2d5e6c[_0xffd2('0x14')]];}if(this[_0xffd2('0x41')][_0x2d5e6c[_0xffd2('0x14')]]){delete this[_0xffd2('0x41')][_0x2d5e6c[_0xffd2('0x14')]];}}}catch(_0x4ef309){logger[_0xffd2('0x1f')](_0xffd2('0x50'),util['inspect'](_0x4ef309,{'showHidden':![],'depth':null}));}};module[_0xffd2('0x51')]=VoiceDialReport; \ No newline at end of file +var _0xa368=['dialstatus','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','isNotNull','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','endtime','starttime','seconds','complete','answered','holdtime','diff','sumBillable','billableseconds','duration','custom:voiceDialReport','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','util','ami','../ami','redis','localhost','socket.io-emitter','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','channels','merge','uniqueid','format','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect'];(function(_0x3ae9aa,_0x48a0ec){var _0x3c11e1=function(_0x3e45b5){while(--_0x3e45b5){_0x3ae9aa['push'](_0x3ae9aa['shift']());}};_0x3c11e1(++_0x48a0ec);}(_0xa368,0xd3));var _0x8a36=function(_0x8d44aa,_0x3d979e){_0x8d44aa=_0x8d44aa-0x0;var _0x3d5d40=_0xa368[_0x8d44aa];return _0x3d5d40;};'use strict';var _=require(_0x8a36('0x0'));var moment=require('moment');var util=require(_0x8a36('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x8a36('0x2'));var ami=require(_0x8a36('0x3'));config[_0x8a36('0x4')]=_['defaults'](config['redis'],{'host':_0x8a36('0x5'),'port':0x18eb});var io=require(_0x8a36('0x6'))(new Redis(config[_0x8a36('0x4')]));function VoiceDialReport(_0x26d1a9){this['channels']=_0x26d1a9[_0x8a36('0x7')];this['outbound']=_0x26d1a9[_0x8a36('0x8')];this[_0x8a36('0x9')]={};ami['on']('dialbegin',this[_0x8a36('0xa')][_0x8a36('0xb')](this));ami['on'](_0x8a36('0xc'),this[_0x8a36('0xd')][_0x8a36('0xb')](this));ami['on'](_0x8a36('0xe'),this[_0x8a36('0xf')][_0x8a36('0xb')](this));ami['on'](_0x8a36('0x10'),this[_0x8a36('0x11')]['bind'](this));}VoiceDialReport[_0x8a36('0x12')]['isNotNull']=function(_0x102796){return _0x102796!==null&&!_[_0x8a36('0x13')](_0x102796);};VoiceDialReport['prototype'][_0x8a36('0x14')]=function(_0x352787,_0x3a4fa2,_0x2416a0){io['to'](_0x352787)['emit'](_0x3a4fa2,_0x2416a0);};VoiceDialReport[_0x8a36('0x12')][_0x8a36('0xa')]=function(_0x542a32){try{if(this['isNotNull'](_0x542a32)){if(this[_0x8a36('0x15')][_0x542a32['uniqueid']]){_[_0x8a36('0x16')](this[_0x8a36('0x15')][_0x542a32[_0x8a36('0x17')]],{'starttime':moment()[_0x8a36('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x542a32[_0x8a36('0x19')][_0x8a36('0x1a')](0x0,_0x542a32[_0x8a36('0x19')][_0x8a36('0x1b')]('-')),'membername':_0x542a32[_0x8a36('0x19')][_0x8a36('0x1a')](_0x542a32[_0x8a36('0x19')]['lastIndexOf']('/')+0x1,_0x542a32[_0x8a36('0x19')][_0x8a36('0x1b')]('-'))},_[_0x8a36('0x1c')](_0x542a32,[_0x8a36('0x1d'),'privilege']));this['emit'](_0x8a36('0x1e'),_0x8a36('0x1f'),this[_0x8a36('0x15')][_0x542a32[_0x8a36('0x17')]]);ami[_0x8a36('0x14')]('custom:dialbegin',this['channels'][_0x542a32['uniqueid']]);}}}catch(_0x5a6113){logger[_0x8a36('0x20')](_0x8a36('0x21'),util[_0x8a36('0x22')](_0x5a6113,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a36('0x12')]['syncDialEnd']=function(_0x1a1d2f){try{if(this['isNotNull'](_0x1a1d2f)){if(this[_0x8a36('0x15')][_0x1a1d2f[_0x8a36('0x17')]]){this[_0x8a36('0x15')][_0x1a1d2f[_0x8a36('0x17')]]['dialstatus']=_0x1a1d2f[_0x8a36('0x23')];if(_0x1a1d2f[_0x8a36('0x23')]==='ANSWER'){this['channels'][_0x1a1d2f['uniqueid']][_0x8a36('0x24')]=_0x1a1d2f[_0x8a36('0x24')];this[_0x8a36('0x15')][_0x1a1d2f[_0x8a36('0x17')]][_0x8a36('0x25')]=_0x1a1d2f[_0x8a36('0x25')];this[_0x8a36('0x15')][_0x1a1d2f[_0x8a36('0x17')]][_0x8a36('0x26')]=moment()[_0x8a36('0x18')](_0x8a36('0x27'));this['channels'][_0x1a1d2f[_0x8a36('0x17')]][_0x8a36('0x28')]=_0x8a36('0x29');ami[_0x8a36('0x14')](_0x8a36('0x2a'),this['channels'][_0x1a1d2f[_0x8a36('0x17')]]);}this[_0x8a36('0x14')](_0x8a36('0x1e'),_0x8a36('0x1f'),this[_0x8a36('0x15')][_0x1a1d2f[_0x8a36('0x17')]]);}}}catch(_0x4d57a4){logger[_0x8a36('0x20')](_0x8a36('0x2b'),util[_0x8a36('0x22')](_0x4d57a4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8a36('0xf')]=function(_0x57eb36){try{if(this[_0x8a36('0x2c')](_0x57eb36)){this[_0x8a36('0x2d')](_0x57eb36[_0x8a36('0x17')],_[_0x8a36('0x2e')](_0x57eb36[_0x8a36('0x2f')])[0x0],_0x57eb36[_0x8a36('0x30')]);if(this['isNotNull'](_0x57eb36[_0x8a36('0x2f')])&&this['isNotNull'](_0x57eb36[_0x8a36('0x2f')]['outboundrouteid'])){if(_['isUndefined'](this[_0x8a36('0x15')][_0x57eb36[_0x8a36('0x17')]])){this[_0x8a36('0x15')][_0x57eb36[_0x8a36('0x17')]]={'routeId':_0x57eb36['value'],'variables':this[_0x8a36('0x9')][_0x57eb36[_0x8a36('0x17')]]};this[_0x8a36('0x14')](_0x8a36('0x1e'),_0x8a36('0x1f'),this['channels'][_0x57eb36[_0x8a36('0x17')]]);}}}}catch(_0xe2c24c){logger[_0x8a36('0x20')](_0x8a36('0x31'),util[_0x8a36('0x22')](_0xe2c24c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8a36('0x12')][_0x8a36('0x2d')]=function(_0x3b900b,_0x2cc7a6,_0x259ff3){var _0x349847=[_0x8a36('0x32'),_0x8a36('0x33'),_0x8a36('0x34'),_0x8a36('0x35'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x8a36('0x36'),_0x8a36('0x37'),'sipcallid',_0x8a36('0x38'),_0x8a36('0x39'),_0x8a36('0x3a'),'membercalls','memberdynamic',_0x8a36('0x3b'),'memberlastcall',_0x8a36('0x3c'),_0x8a36('0x3d'),_0x8a36('0x3e')];if(!_[_0x8a36('0x3f')](_0x2cc7a6)&&!_[_0x8a36('0x40')](_0x349847,_0x2cc7a6)){if(_[_0x8a36('0x13')](this['variables'][_0x3b900b])){this[_0x8a36('0x9')][_0x3b900b]={};}this[_0x8a36('0x9')][_0x3b900b][_0x2cc7a6]=_0x259ff3;}};VoiceDialReport[_0x8a36('0x12')][_0x8a36('0x11')]=function(_0x9f4514){try{if(this[_0x8a36('0x2c')](_0x9f4514)){if(this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]){this['channels'][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x41')]=moment()[_0x8a36('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]['duration']=moment(this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]['endtime'])['diff'](this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x42')],_0x8a36('0x43'));this['channels'][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x28')]=_0x8a36('0x44');this[_0x8a36('0x8')]['total']+=0x1;if(this[_0x8a36('0x15')][_0x9f4514['uniqueid']][_0x8a36('0x26')]){this['outbound'][_0x8a36('0x45')]+=0x1;this['channels'][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x46')]=moment(this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x26')])[_0x8a36('0x47')](this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x42')],_0x8a36('0x43'));this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]['billableseconds']=moment(this['channels'][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x41')])[_0x8a36('0x47')](this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]['answertime'],_0x8a36('0x43'));this['outbound']['sumHoldTime']+=this[_0x8a36('0x15')][_0x9f4514['uniqueid']]['holdtime']||0x0;this['outbound'][_0x8a36('0x48')]+=this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x49')];}this['outbound']['sumDuration']+=this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]][_0x8a36('0x4a')];ami['emit'](_0x8a36('0x4b'),this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]);ami[_0x8a36('0x14')]('custom:dialend',this['channels'][_0x9f4514[_0x8a36('0x17')]]);this[_0x8a36('0x14')](_0x8a36('0x1e'),_0x8a36('0x4c'),this['outbound']);logger[_0x8a36('0x4d')](_0x8a36('0x4e'),JSON[_0x8a36('0x4f')](this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]));this[_0x8a36('0x14')](_0x8a36('0x1e'),_0x8a36('0x50'),this[_0x8a36('0x15')][_0x9f4514[_0x8a36('0x17')]]);delete this['channels'][_0x9f4514[_0x8a36('0x17')]];}if(this[_0x8a36('0x9')][_0x9f4514[_0x8a36('0x17')]]){delete this['variables'][_0x9f4514[_0x8a36('0x17')]];}}}catch(_0x17e8c9){logger['error'](_0x8a36('0x51'),util['inspect'](_0x17e8c9,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 37f89ef..fbce392 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 _0x6f93=['EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','includes','length','diff','seconds','sumDuration','milliseconds','sumBillable','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','../../../config/logger','ami','../ami','../model/queueReport','defaults','redis','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','enqueue','isNil','Action','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','answered','available','loggedIn','sumHoldTime','total','unmanaged','Trunk','active','Interval','voice_queue:save','isNotNull','queues','[queuesummary]','queue','countBy','callers','toNumber','talking','loggedin','[syncQueueSummary][VoiceQueueReport]','inspect','syncNewExten','uniqueid','type','queuecallerjoinAt','position','count','merge','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','[syncAgentConnect][VoiceQueueReport]','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','channel','local/','linkedid','add','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','queuestatus','CONTINUE','TIMEOUT','timeout','custom:timeout','queueposition'];(function(_0x238d69,_0x59f488){var _0x38f5a7=function(_0xe8a9e6){while(--_0xe8a9e6){_0x238d69['push'](_0x238d69['shift']());}};_0x38f5a7(++_0x59f488);}(_0x6f93,0xfe));var _0x36f9=function(_0x445991,_0x1137f1){_0x445991=_0x445991-0x0;var _0x45d1e8=_0x6f93[_0x445991];return _0x45d1e8;};'use strict';var _=require(_0x36f9('0x0'));var moment=require(_0x36f9('0x1'));var BPromise=require(_0x36f9('0x2'));var util=require(_0x36f9('0x3'));var md5=require(_0x36f9('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x36f9('0x5'))(_0x36f9('0x6'));var ami=require(_0x36f9('0x7'));var QueueReport=require(_0x36f9('0x8'));config['redis']=_[_0x36f9('0x9')](config[_0x36f9('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x36f9('0xb'))(new Redis(config[_0x36f9('0xa')]));var Sequence=function(){};Sequence[_0x36f9('0xc')]['enqueue']=function(_0x1d28f4){this['tail']=this[_0x36f9('0xd')]?this[_0x36f9('0xd')][_0x36f9('0xe')](_0x1d28f4):_0x1d28f4();};function VoiceQueueReport(_0x535315){this[_0x36f9('0xf')]=new Sequence();this[_0x36f9('0x10')]={};this[_0x36f9('0x11')]=_0x535315[_0x36f9('0x11')];this[_0x36f9('0x12')]=_0x535315['queueChannels'];this[_0x36f9('0x13')]=_0x535315['voiceQueues'];this[_0x36f9('0x14')]=!![];this['campaigns']=_0x535315[_0x36f9('0x15')];this[_0x36f9('0x16')]={};ami['on'](_0x36f9('0x17'),this[_0x36f9('0x18')][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x1a'),this[_0x36f9('0x1b')]['bind'](this));ami['on'](_0x36f9('0x1c'),this[_0x36f9('0x1d')][_0x36f9('0x19')](this));ami['on']('queuecallerabandon',this[_0x36f9('0x1e')][_0x36f9('0x19')](this));ami['on']('queuecallerleave',this[_0x36f9('0x1f')]['bind'](this));ami['on'](_0x36f9('0x20'),this[_0x36f9('0x21')]['bind'](this));ami['on'](_0x36f9('0x22'),this['syncAgentConnect']['bind'](this));ami['on'](_0x36f9('0x23'),this['syncVarSet'][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x24'),this[_0x36f9('0x25')][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x26'),this[_0x36f9('0x27')][_0x36f9('0x19')](this));ami['on']('musiconholdstart',this[_0x36f9('0x28')][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x29'),this[_0x36f9('0x2a')][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x2b'),this[_0x36f9('0x2c')][_0x36f9('0x19')](this));ami['on'](_0x36f9('0x2d'),this['syncBlindTransfer'][_0x36f9('0x19')](this));this[_0x36f9('0x2e')]();this[_0x36f9('0x2f')]();}function isNotNull(_0x278301){return _0x278301!==null&&!_[_0x36f9('0x30')](_0x278301);}function clearChannels(_0x4a08cf){if(!_[_0x36f9('0x31')](_0x4a08cf)){for(var _0x5d5c39 in _0x4a08cf){if(_0x4a08cf[_0x36f9('0x32')](_0x5d5c39)){delete _0x4a08cf[_0x5d5c39];}}}}function clearCampaigns(_0x5a92d2){if(!_['isEmpty'](_0x5a92d2)){for(var _0x123431 in _0x5a92d2){if(_0x5a92d2[_0x36f9('0x32')](_0x123431)){_0x5a92d2[_0x123431][_0x36f9('0x33')]=0x0;}}}}function clearVoiceQueues(_0x2e8698){if(!_[_0x36f9('0x31')](_0x2e8698)){for(var _0x49f57a in _0x2e8698){if(_0x2e8698[_0x36f9('0x32')](_0x49f57a)){_0x2e8698[_0x49f57a][_0x36f9('0x33')]=0x0;_0x2e8698[_0x49f57a]['talking']=0x0;_0x2e8698[_0x49f57a][_0x36f9('0x34')]=0x0;_0x2e8698[_0x49f57a][_0x36f9('0x35')]=0x0;_0x2e8698[_0x49f57a][_0x36f9('0x36')]=!![];}}}}function clearAgentBooked(_0x5b3ec8){if(!_[_0x36f9('0x31')](_0x5b3ec8)){for(var _0x5f2b83 in _0x5b3ec8){if(_0x5b3ec8[_0x36f9('0x32')](_0x5f2b83)){_0x5b3ec8[_0x5f2b83][_0x36f9('0x37')]=!![];}}}}VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x38')]=function(){var _0xf0ca77=this;for(var _0x45adb4 in this['channels']){if(this[_0x36f9('0x12')]['hasOwnProperty'](_0x45adb4)&&!this[_0x36f9('0x12')][_0x45adb4][_0x36f9('0x39')]){this[_0x36f9('0xf')][_0x36f9('0x3a')](function(){if(!_[_0x36f9('0x3b')](_0xf0ca77[_0x36f9('0x12')][_0x45adb4])){return ami[_0x36f9('0x3c')]({'action':'status','channel':_0xf0ca77[_0x36f9('0x12')][_0x45adb4]['channel']})[_0x36f9('0x3d')](function(_0x50c9fa){if(_0x50c9fa[_0x36f9('0x3e')]===_0x36f9('0x3f')){setTimeout(function(){if(_0xf0ca77[_0x36f9('0x12')][_0x45adb4]){delete _0xf0ca77[_0x36f9('0x12')][_0x45adb4];logger[_0x36f9('0x40')](_0x36f9('0x41'),_0x45adb4);}if(_0xf0ca77[_0x36f9('0x10')][_0x45adb4]){delete _0xf0ca77[_0x36f9('0x10')][_0x45adb4];logger[_0x36f9('0x40')]('[voiceQueueReport][checkQueueReport]',_0x45adb4);}if(_0xf0ca77[_0x36f9('0x16')][_0x45adb4]){delete _0xf0ca77[_0x36f9('0x16')][_0x45adb4];logger[_0x36f9('0x40')]('[voiceQueueReport][checkVariables]',_0x45adb4);}},0x1f40);}});}});}}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x27')]=function(){logger['error'](_0x36f9('0x42'));clearChannels(this['channels']);this[_0x36f9('0x43')](this[_0x36f9('0x10')]);clearAgentBooked(this['agents']);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x36f9('0x15')]);};VoiceQueueReport['prototype'][_0x36f9('0x43')]=function(_0x2af1e6){var _0xfc0ad5=this;if(!_[_0x36f9('0x31')](_0x2af1e6)){for(var _0x24260f in _0x2af1e6){if(_0x2af1e6[_0x36f9('0x32')](_0x24260f)){_0xfc0ad5[_0x36f9('0x44')](_0x2af1e6[_0x24260f]);delete _0x2af1e6[_0x24260f];}}}};function loggerCatch(_0x11cd77){return function(_0x41727b){logger[_0x36f9('0x40')](_0x11cd77,util['inspect'](_0x41727b,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x45')]=function(_0x58503f,_0x24ed02,_0x3065e0){io['to'](_0x58503f)[_0x36f9('0x45')](_0x24ed02,_0x3065e0);};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x46')]=function(_0x43f6ef){this[_0x36f9('0x45')](util[_0x36f9('0x47')](_0x36f9('0x48'),_0x43f6ef[_0x36f9('0x49')]),_0x36f9('0x4a'),_0x43f6ef);};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x44')]=function(_0x3b4c78){logger[_0x36f9('0x4b')](_0x36f9('0x4c'),JSON[_0x36f9('0x4d')](_0x3b4c78));this['emit'](util['format']('voice:queue:%s',_0x3b4c78['name']),_0x36f9('0x4e'),_0x3b4c78);};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x4f')]=function(_0x54d214){if(_0x54d214['type']===_0x36f9('0x50')){var _0x30f119={'id':_0x54d214['id'],'name':_0x54d214['name'],'strategy':_0x54d214[_0x36f9('0x51')],'answered':_0x54d214[_0x36f9('0x52')],'available':_0x54d214[_0x36f9('0x53')],'loggedIn':_0x54d214[_0x36f9('0x54')],'pTalking':_0x54d214[_0x36f9('0x34')],'sumBillable':_0x54d214['sumBillable'],'sumDuration':_0x54d214['sumDuration'],'sumHoldTime':_0x54d214[_0x36f9('0x55')]||0x0,'talking':_0x54d214['talking'],'total':_0x54d214[_0x36f9('0x56')],'type':_0x54d214['type'],'unmanaged':_0x54d214[_0x36f9('0x57')],'abandoned':_0x54d214['abandoned'],'waiting':_0x54d214[_0x36f9('0x35')]};if(_0x54d214[_0x36f9('0x58')]){_0x30f119[_0x36f9('0x58')]={'id':_0x54d214[_0x36f9('0x58')]['id'],'name':_0x54d214[_0x36f9('0x58')]['name'],'active':_0x54d214[_0x36f9('0x58')][_0x36f9('0x59')],'callerid':_0x54d214[_0x36f9('0x58')]['callerid']};}if(_0x54d214[_0x36f9('0x5a')]){_0x30f119['Interval']={'id':_0x54d214[_0x36f9('0x5a')]['id'],'name':_0x54d214[_0x36f9('0x5a')][_0x36f9('0x49')]};}var _0x2ce8bc=md5(JSON[_0x36f9('0x4d')](_0x30f119));if(_0x54d214[_0x36f9('0x4')]!==_0x2ce8bc){_0x54d214[_0x36f9('0x4')]=_0x2ce8bc;this['emit'](util['format']('voice:queue:%s',_0x30f119['name']),_0x36f9('0x5b'),_0x30f119);}}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x5c')]=function(_0x19ad4b){return _0x19ad4b!==null&&!_['isUndefined'](_0x19ad4b);};VoiceQueueReport['prototype'][_0x36f9('0x2f')]=function(){var _0x1f0156=this;setInterval(function(){_0x1f0156[_0x36f9('0x38')]();ami[_0x36f9('0x3c')]({'action':_0x36f9('0x5d')})[_0x36f9('0x3d')](loggerCatch('[queues]'));},0x2710);};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x2e')]=function(){var _0x46b738=this;setInterval(function(){if(_0x46b738[_0x36f9('0x14')]){return ami[_0x36f9('0x3c')]({'action':_0x36f9('0x17')})['then'](function(_0x3833fe){_0x46b738[_0x36f9('0x14')]=![];})[_0x36f9('0x3d')](loggerCatch(_0x36f9('0x5e')));}},0x3e8);};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x18')]=function(_0x3affa9){try{if(this[_0x36f9('0x5c')](_0x3affa9)&&this[_0x36f9('0x5c')](_0x3affa9['queue'])){if(this['voiceQueues'][_0x3affa9[_0x36f9('0x5f')]]){var _0x37ad6d=_[_0x36f9('0x60')](this[_0x36f9('0x12')],_0x36f9('0x5f'))[_0x3affa9[_0x36f9('0x5f')]]||0x0;var _0x14e7ce=_0x37ad6d-_0x3affa9[_0x36f9('0x61')];if(this['voiceQueues'][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x35')]!==_['toNumber'](_0x3affa9['callers'])||this[_0x36f9('0x13')][_0x3affa9['queue']][_0x36f9('0x54')]!==_[_0x36f9('0x62')](_0x3affa9['loggedin'])||this[_0x36f9('0x13')][_0x3affa9['queue']][_0x36f9('0x53')]!==_[_0x36f9('0x62')](_0x3affa9['available'])||this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x63')]!==_0x14e7ce){this[_0x36f9('0x13')][_0x3affa9['queue']][_0x36f9('0x35')]=_['toNumber'](_0x3affa9[_0x36f9('0x61')]);this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x54')]=_[_0x36f9('0x62')](_0x3affa9['loggedin']);this['voiceQueues'][_0x3affa9['queue']][_0x36f9('0x53')]=_[_0x36f9('0x62')](_0x3affa9[_0x36f9('0x53')]);this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x63')]=_0x14e7ce>0x0?_0x14e7ce:0x0;this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]]['talking']=this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]][_0x36f9('0x63')]>_[_0x36f9('0x62')](_0x3affa9[_0x36f9('0x64')])?_['toNumber'](_0x3affa9[_0x36f9('0x64')]):this['voiceQueues'][_0x3affa9['queue']]['talking'];this[_0x36f9('0x4f')](this['voiceQueues'][_0x3affa9[_0x36f9('0x5f')]]);}ami[_0x36f9('0x45')]('custom:queuesummary',this[_0x36f9('0x13')][_0x3affa9[_0x36f9('0x5f')]]);}}}catch(_0x5f4e27){logger[_0x36f9('0x40')](_0x36f9('0x65'),util[_0x36f9('0x66')](_0x5f4e27,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1b')]=function(_0x4ba297){this[_0x36f9('0x14')]=!![];};VoiceQueueReport['prototype'][_0x36f9('0x67')]=function(_0x48765d){};VoiceQueueReport['prototype'][_0x36f9('0x1d')]=function(_0x4e1192){try{if(this[_0x36f9('0x5c')](_0x4e1192)){if(_['isUndefined'](this[_0x36f9('0x10')][_0x4e1192[_0x36f9('0x68')]])){this['queueReports'][_0x4e1192['uniqueid']]=[];this['channels'][_0x4e1192[_0x36f9('0x68')]]={};}var _0x494303=new QueueReport();_0x494303[_0x36f9('0x49')]=_0x4e1192['queue'];_0x494303[_0x36f9('0x69')]=this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]]&&this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]][_0x36f9('0x69')]?this[_0x36f9('0x13')][_0x494303[_0x36f9('0x49')]]['type']||_0x36f9('0x50'):_0x36f9('0x50');_0x494303['queue']=_0x4e1192[_0x36f9('0x5f')];_0x494303[_0x36f9('0x6a')]=moment()[_0x36f9('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x494303[_0x36f9('0x6b')]=_0x4e1192['position'];_0x494303['count']=_0x4e1192[_0x36f9('0x6c')];_[_0x36f9('0x6d')](_0x494303,_['pick'](_0x4e1192,_['keys'](_0x494303)));this[_0x36f9('0x10')][_0x4e1192[_0x36f9('0x68')]][_0x36f9('0x6e')](_0x494303);this[_0x36f9('0x12')][_0x4e1192[_0x36f9('0x68')]]=_0x494303;this[_0x36f9('0x46')](_0x494303);}}catch(_0x59504a){logger[_0x36f9('0x40')](_0x36f9('0x6f'),util[_0x36f9('0x66')](_0x59504a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1e')]=function(_0x1d5bd9){try{if(this[_0x36f9('0x5c')](_0x1d5bd9)){if(this[_0x36f9('0x10')][_0x1d5bd9['uniqueid']]){var _0x752be4=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x1d5bd9[_0x36f9('0x68')]]);_0x752be4[_0x36f9('0x71')]=![];_0x752be4['queuecallercompleteAt']=null;_0x752be4[_0x36f9('0x72')]=_0x1d5bd9['holdtime'];_0x752be4[_0x36f9('0x73')]=_0x1d5bd9[_0x36f9('0x73')];_0x752be4[_0x36f9('0x74')]=!![];_0x752be4[_0x36f9('0x75')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x752be4[_0x36f9('0x77')]=_0x36f9('0x78');_0x752be4[_0x36f9('0x79')]=null;this['channels'][_0x1d5bd9['uniqueid']]=_0x752be4;this[_0x36f9('0x44')](_0x752be4);}}}catch(_0x42ca0b){logger[_0x36f9('0x40')](_0x36f9('0x7a'),util[_0x36f9('0x66')](_0x42ca0b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x1f')]=function(_0x59c98e){try{if(this[_0x36f9('0x5c')](_0x59c98e)){if(this[_0x36f9('0x10')][_0x59c98e[_0x36f9('0x68')]]){var _0x34a9ce=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x59c98e[_0x36f9('0x68')]]);_0x34a9ce[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x34a9ce[_0x36f9('0x7c')]=_0x59c98e[_0x36f9('0x7c')];_0x34a9ce[_0x36f9('0x7d')]=_0x59c98e[_0x36f9('0x7d')];this[_0x36f9('0x12')][_0x59c98e['uniqueid']]=_0x34a9ce;this[_0x36f9('0x46')](_0x34a9ce);}}}catch(_0x32ac39){logger[_0x36f9('0x40')](_0x36f9('0x7e'),util[_0x36f9('0x66')](_0x32ac39,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x36f9('0x7f')]=function(_0x23108a){try{if(this[_0x36f9('0x5c')](_0x23108a)){if(this[_0x36f9('0x10')][_0x23108a[_0x36f9('0x68')]]){var _0x3b4fa1=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x23108a['uniqueid']]);_0x3b4fa1['queuecallercomplete']=!![];_0x3b4fa1[_0x36f9('0x77')]='COMPLETEDBYAGENT';}}}catch(_0x54130e){logger[_0x36f9('0x40')](_0x36f9('0x80'),util[_0x36f9('0x66')](_0x54130e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x21')]=function(_0x226211){try{if(this[_0x36f9('0x5c')](_0x226211)){if(this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]){var _0xda4faf=_['last'](this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]);_0xda4faf[_0x36f9('0x74')]=![];_0xda4faf[_0x36f9('0x75')]=null;_0xda4faf['assigned']=!![];_0xda4faf[_0x36f9('0x79')]=_0x226211[_0x36f9('0x81')];_0xda4faf[_0x36f9('0x72')]=_0x226211[_0x36f9('0x72')];_0xda4faf[_0x36f9('0x71')]=!![];_0xda4faf[_0x36f9('0x82')]=![];_0xda4faf[_0x36f9('0x83')]=null;if(!_0xda4faf[_0x36f9('0x84')]){if(_0x226211[_0x36f9('0x85')]=='transfer'){_0xda4faf[_0x36f9('0x77')]=_0x36f9('0x86');}else{if(_[_0x36f9('0x87')](_0x226211[_0x36f9('0x88')]['toLowerCase'](),_0x36f9('0x89'))){if(this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]]){var _0x2d5d68=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x226211['linkedid']]);_0x2d5d68['queuecallercomplete']=![];_0x2d5d68[_0x36f9('0x82')]=!![];_0x2d5d68[_0x36f9('0x83')]=moment(_0xda4faf['queuecallerjoinAt'])[_0x36f9('0x8b')](_0x226211['holdtime'],'seconds')[_0x36f9('0x47')](_0x36f9('0x76'));_0x2d5d68['queuecallerexitreason']='FORWARDTRANSFER';_0x2d5d68['transfer']=!![];_0x2d5d68[_0x36f9('0x8c')]=_0x36f9('0x8d');_0x2d5d68[_0x36f9('0x8e')]=_0x226211[_0x36f9('0x8f')];_0x2d5d68[_0x36f9('0x90')]=_0x226211['uniqueid'];var _0x4e0f1c=this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]];this[_0x36f9('0x10')][_0x226211[_0x36f9('0x8a')]]=this[_0x36f9('0x10')][_0x226211['uniqueid']];this[_0x36f9('0x10')][_0x226211[_0x36f9('0x68')]]=_0x4e0f1c;}}else{_0xda4faf[_0x36f9('0x77')]=_0x36f9('0x91')+_0x226211[_0x36f9('0x85')][_0x36f9('0x92')]();}}}this[_0x36f9('0x12')][_0x226211[_0x36f9('0x68')]]=_0xda4faf;this['emitVoiceQueueChannelRemove'](_0xda4faf);}}}catch(_0x1edc9a){logger[_0x36f9('0x40')](_0x36f9('0x93'),util[_0x36f9('0x66')](_0x1edc9a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')]['syncVarSet']=function(_0x18f943){try{if(this[_0x36f9('0x5c')](_0x18f943)){this[_0x36f9('0x94')](_0x18f943['uniqueid'],_[_0x36f9('0x95')](_0x18f943[_0x36f9('0x96')])[0x0],_0x18f943[_0x36f9('0x97')]);if(this['queueReports'][_0x18f943['uniqueid']]){var _0x5cd52e=_[_0x36f9('0x70')](this[_0x36f9('0x10')][_0x18f943['uniqueid']]);if(_0x5cd52e){if(this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')])&&this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')][_0x36f9('0x98')])){switch(_0x18f943['value']){case _0x36f9('0x99'):_0x5cd52e[_0x36f9('0x82')]=![];_0x5cd52e[_0x36f9('0x83')]=null;break;case _0x36f9('0x9a'):_0x5cd52e['lastevent']=_0x36f9('0x9b');ami['emit'](_0x36f9('0x9c'),_0x5cd52e);break;default:_0x5cd52e[_0x36f9('0x82')]=!![];_0x5cd52e[_0x36f9('0x83')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x5cd52e[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));}_0x5cd52e[_0x36f9('0x74')]=![];_0x5cd52e[_0x36f9('0x75')]=null;_0x5cd52e[_0x36f9('0x77')]=_0x18f943[_0x36f9('0x97')];this[_0x36f9('0x12')][_0x18f943[_0x36f9('0x68')]]=_0x5cd52e;this[_0x36f9('0x44')](_0x5cd52e);}else if(this[_0x36f9('0x5c')](_0x18f943[_0x36f9('0x96')])&&this[_0x36f9('0x5c')](_0x18f943['variable'][_0x36f9('0x9d')])){if(!_0x5cd52e[_0x36f9('0x74')]){_0x5cd52e[_0x36f9('0x82')]=!![];_0x5cd52e[_0x36f9('0x83')]=moment()[_0x36f9('0x47')](_0x36f9('0x76'));_0x5cd52e['queuecallerexitreason']=_0x36f9('0x9e');_0x5cd52e[_0x36f9('0x7b')]=moment()[_0x36f9('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x36f9('0x12')][_0x18f943[_0x36f9('0x68')]]=_0x5cd52e;}}_0x5cd52e[_0x36f9('0x16')]=this['variables'][_0x18f943['uniqueid']];}}}}catch(_0x3ed857){logger[_0x36f9('0x40')](_0x36f9('0x9f'),util[_0x36f9('0x66')](_0x3ed857,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x36f9('0xc')][_0x36f9('0x94')]=function(_0x3eed59,_0xe166af,_0x46d1cc){var _0x3b4e49=[_0x36f9('0xa0'),_0x36f9('0xa1'),_0x36f9('0xa2'),'rtpaudioqosjitterbridged',_0x36f9('0xa3'),_0x36f9('0xa4'),_0x36f9('0xa5'),'rtpaudioqosrttbridged','sipcallid',_0x36f9('0xa6'),_0x36f9('0xa7'),_0x36f9('0xa8'),_0x36f9('0xa9'),_0x36f9('0xaa'),_0x36f9('0xab'),'memberlastcall','membername',_0x36f9('0xac'),'memberrealtime'];if(!_[_0x36f9('0x3b')](_0xe166af)&&!_[_0x36f9('0xad')](_0x3b4e49,_0xe166af)){if(_[_0x36f9('0x30')](this[_0x36f9('0x16')][_0x3eed59])){this['variables'][_0x3eed59]={};}this[_0x36f9('0x16')][_0x3eed59][_0xe166af]=_0x46d1cc;}};VoiceQueueReport[_0x36f9('0xc')]['syncHangup']=function(_0x5974f4){try{if(this[_0x36f9('0x5c')](_0x5974f4)){if(this[_0x36f9('0x10')][_0x5974f4['uniqueid']]){for(var _0xb903aa=0x0,_0x21c2f4={};_0xb903aa0x0?_0x5c3487:0x0;this[_0x5638('0x14')][_0x5dd7df[_0x5638('0x60')]][_0x5638('0x33')]=this[_0x5638('0x14')][_0x5dd7df[_0x5638('0x60')]][_0x5638('0x33')]>_['toNumber'](_0x5dd7df[_0x5638('0x64')])?_['toNumber'](_0x5dd7df['loggedin']):this[_0x5638('0x14')][_0x5dd7df[_0x5638('0x60')]][_0x5638('0x33')];this[_0x5638('0x66')](this['voiceQueues'][_0x5dd7df[_0x5638('0x60')]]);}ami['emit'](_0x5638('0x67'),this[_0x5638('0x14')][_0x5dd7df['queue']]);}}}catch(_0x59eadf){logger[_0x5638('0x3e')](_0x5638('0x68'),util[_0x5638('0x69')](_0x59eadf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5638('0x1b')]=function(_0x2f5558){this[_0x5638('0x15')]=!![];};VoiceQueueReport[_0x5638('0xc')]['syncNewExten']=function(_0x2f24db){};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x1d')]=function(_0x4447aa){try{if(this[_0x5638('0x5d')](_0x4447aa)){if(_[_0x5638('0x30')](this['queueReports'][_0x4447aa[_0x5638('0x6a')]])){this['queueReports'][_0x4447aa[_0x5638('0x6a')]]=[];this[_0x5638('0x12')][_0x4447aa[_0x5638('0x6a')]]={};}var _0x14ecc6=new QueueReport();_0x14ecc6[_0x5638('0x4d')]=_0x4447aa[_0x5638('0x60')];_0x14ecc6[_0x5638('0x55')]=this['voiceQueues'][_0x14ecc6[_0x5638('0x4d')]]&&this['voiceQueues'][_0x14ecc6[_0x5638('0x4d')]][_0x5638('0x55')]?this[_0x5638('0x14')][_0x14ecc6[_0x5638('0x4d')]][_0x5638('0x55')]||_0x5638('0x4e'):'inbound';_0x14ecc6['queue']=_0x4447aa[_0x5638('0x60')];_0x14ecc6['queuecallerjoinAt']=moment()['format'](_0x5638('0x6b'));_0x14ecc6[_0x5638('0x6c')]=_0x4447aa['position'];_0x14ecc6[_0x5638('0x6d')]=_0x4447aa[_0x5638('0x6d')];_[_0x5638('0x6e')](_0x14ecc6,_[_0x5638('0x6f')](_0x4447aa,_['keys'](_0x14ecc6)));this[_0x5638('0x40')][_0x4447aa[_0x5638('0x6a')]]['push'](_0x14ecc6);this[_0x5638('0x12')][_0x4447aa[_0x5638('0x6a')]]=_0x14ecc6;this[_0x5638('0x70')](_0x14ecc6);}}catch(_0x5b2da1){logger['error'](_0x5638('0x71'),util[_0x5638('0x69')](_0x5b2da1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x1f')]=function(_0x539b88){try{if(this[_0x5638('0x5d')](_0x539b88)){if(this[_0x5638('0x40')][_0x539b88['uniqueid']]){var _0x244b5e=_[_0x5638('0x72')](this[_0x5638('0x40')][_0x539b88[_0x5638('0x6a')]]);_0x244b5e[_0x5638('0x73')]=![];_0x244b5e[_0x5638('0x74')]=null;_0x244b5e[_0x5638('0x75')]=_0x539b88[_0x5638('0x75')];_0x244b5e[_0x5638('0x76')]=_0x539b88['originalposition'];_0x244b5e[_0x5638('0x1e')]=!![];_0x244b5e[_0x5638('0x77')]=moment()[_0x5638('0x47')](_0x5638('0x6b'));_0x244b5e['queuecallerexitreason']=_0x5638('0x78');_0x244b5e[_0x5638('0x79')]=null;this[_0x5638('0x12')][_0x539b88[_0x5638('0x6a')]]=_0x244b5e;this[_0x5638('0x45')](_0x244b5e);}}}catch(_0x1dddd7){logger['error']('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x5638('0x69')](_0x1dddd7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')]['syncQueueCallerLeave']=function(_0x8502bd){try{if(this[_0x5638('0x5d')](_0x8502bd)){if(this[_0x5638('0x40')][_0x8502bd['uniqueid']]){var _0xa60796=_['last'](this[_0x5638('0x40')][_0x8502bd[_0x5638('0x6a')]]);_0xa60796['queuecallerleaveAt']=moment()['format'](_0x5638('0x6b'));_0xa60796[_0x5638('0x7a')]=_0x8502bd[_0x5638('0x7a')];_0xa60796[_0x5638('0x7b')]=_0x8502bd[_0x5638('0x7b')];this[_0x5638('0x12')][_0x8502bd[_0x5638('0x6a')]]=_0xa60796;this['emitVoiceQueueChannelSave'](_0xa60796);}}}catch(_0x3bb69a){logger[_0x5638('0x3e')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x5638('0x69')](_0x3bb69a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x7c')]=function(_0x48eb7a){try{if(this[_0x5638('0x5d')](_0x48eb7a)){if(this['queueReports'][_0x48eb7a[_0x5638('0x6a')]]){var _0x3348f6=_['last'](this[_0x5638('0x40')][_0x48eb7a['uniqueid']]);_0x3348f6['queuecallercomplete']=!![];_0x3348f6['queuecallerexitreason']='COMPLETEDBYAGENT';}}}catch(_0x28c326){logger[_0x5638('0x3e')]('[syncAgentConnect][VoiceQueueReport]',util[_0x5638('0x69')](_0x28c326,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x23')]=function(_0xa2fe7c){try{if(this[_0x5638('0x5d')](_0xa2fe7c)){if(this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x6a')]]){var _0x5a6511=_[_0x5638('0x72')](this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x6a')]]);_0x5a6511[_0x5638('0x1e')]=![];_0x5a6511[_0x5638('0x77')]=null;_0x5a6511['assigned']=!![];_0x5a6511[_0x5638('0x79')]=_0xa2fe7c[_0x5638('0x7d')];_0x5a6511[_0x5638('0x75')]=_0xa2fe7c[_0x5638('0x75')];_0x5a6511['queuecallercomplete']=!![];_0x5a6511[_0x5638('0x7e')]=![];_0x5a6511['queuecallerexitAt']=null;if(!_0x5a6511['transfer']){if(_0xa2fe7c[_0x5638('0x7f')]==_0x5638('0x80')){_0x5a6511[_0x5638('0x81')]='COMPLETED';}else{if(_[_0x5638('0x82')](_0xa2fe7c[_0x5638('0x3b')][_0x5638('0x83')](),_0x5638('0x84'))){if(this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x85')]]){var _0x375310=_[_0x5638('0x72')](this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x85')]]);_0x375310['queuecallercomplete']=![];_0x375310[_0x5638('0x7e')]=!![];_0x375310['queuecallerexitAt']=moment(_0x5a6511[_0x5638('0x86')])[_0x5638('0x87')](_0xa2fe7c[_0x5638('0x75')],_0x5638('0x88'))[_0x5638('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x375310['queuecallerexitreason']='FORWARDTRANSFER';_0x375310[_0x5638('0x80')]=!![];_0x375310[_0x5638('0x89')]=_0x5638('0x8a');_0x375310[_0x5638('0x8b')]=_0xa2fe7c['destexten'];_0x375310[_0x5638('0x8c')]=_0xa2fe7c[_0x5638('0x6a')];var _0x5e8eb8=this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x85')]];this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x85')]]=this[_0x5638('0x40')][_0xa2fe7c['uniqueid']];this[_0x5638('0x40')][_0xa2fe7c[_0x5638('0x6a')]]=_0x5e8eb8;}}else{_0x5a6511['queuecallerexitreason']=_0x5638('0x8d')+_0xa2fe7c['reason'][_0x5638('0x8e')]();}}}this[_0x5638('0x12')][_0xa2fe7c[_0x5638('0x6a')]]=_0x5a6511;this['emitVoiceQueueChannelRemove'](_0x5a6511);}}}catch(_0x27ece4){logger[_0x5638('0x3e')](_0x5638('0x8f'),util['inspect'](_0x27ece4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x25')]=function(_0xbd2cb9){try{if(this[_0x5638('0x5d')](_0xbd2cb9)){this[_0x5638('0x90')](_0xbd2cb9['uniqueid'],_[_0x5638('0x91')](_0xbd2cb9['variable'])[0x0],_0xbd2cb9['value']);if(this[_0x5638('0x40')][_0xbd2cb9[_0x5638('0x6a')]]){var _0x392a69=_['last'](this[_0x5638('0x40')][_0xbd2cb9[_0x5638('0x6a')]]);if(_0x392a69){if(this[_0x5638('0x5d')](_0xbd2cb9[_0x5638('0x92')])&&this[_0x5638('0x5d')](_0xbd2cb9[_0x5638('0x92')][_0x5638('0x93')])){switch(_0xbd2cb9[_0x5638('0x94')]){case _0x5638('0x95'):_0x392a69[_0x5638('0x7e')]=![];_0x392a69[_0x5638('0x96')]=null;break;case'TIMEOUT':_0x392a69[_0x5638('0x97')]=_0x5638('0x98');ami[_0x5638('0x46')](_0x5638('0x99'),_0x392a69);break;default:_0x392a69[_0x5638('0x7e')]=!![];_0x392a69['queuecallerexitAt']=moment()[_0x5638('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x392a69[_0x5638('0x9a')]=moment()[_0x5638('0x47')](_0x5638('0x6b'));}_0x392a69[_0x5638('0x1e')]=![];_0x392a69['queuecallerabandonAt']=null;_0x392a69[_0x5638('0x81')]=_0xbd2cb9[_0x5638('0x94')];this[_0x5638('0x12')][_0xbd2cb9['uniqueid']]=_0x392a69;this[_0x5638('0x45')](_0x392a69);}else if(this['isNotNull'](_0xbd2cb9[_0x5638('0x92')])&&this[_0x5638('0x5d')](_0xbd2cb9['variable'][_0x5638('0x9b')])){if(!_0x392a69['queuecallerabandon']){_0x392a69['queuecallerexit']=!![];_0x392a69[_0x5638('0x96')]=moment()[_0x5638('0x47')](_0x5638('0x6b'));_0x392a69[_0x5638('0x81')]=_0x5638('0x9c');_0x392a69[_0x5638('0x9a')]=moment()[_0x5638('0x47')](_0x5638('0x6b'));this[_0x5638('0x12')][_0xbd2cb9[_0x5638('0x6a')]]=_0x392a69;}}_0x392a69[_0x5638('0x17')]=this[_0x5638('0x17')][_0xbd2cb9[_0x5638('0x6a')]];}}}}catch(_0x2d4c22){logger[_0x5638('0x3e')](_0x5638('0x9d'),util[_0x5638('0x69')](_0x2d4c22,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5638('0xc')][_0x5638('0x90')]=function(_0x15c23f,_0x2f2f98,_0x4258d1){var _0x295530=[_0x5638('0x9e'),_0x5638('0x9f'),_0x5638('0xa0'),_0x5638('0xa1'),_0x5638('0xa2'),_0x5638('0xa3'),'rtpaudioqosrtt',_0x5638('0xa4'),'sipcallid',_0x5638('0xa5'),_0x5638('0xa6'),_0x5638('0xa7'),_0x5638('0xa8'),_0x5638('0xa9'),_0x5638('0xaa'),'memberlastcall',_0x5638('0x7d'),_0x5638('0xab'),_0x5638('0xac')];if(!_[_0x5638('0xad')](_0x2f2f98)&&!_['includes'](_0x295530,_0x2f2f98)){if(_[_0x5638('0x30')](this[_0x5638('0x17')][_0x15c23f])){this[_0x5638('0x17')][_0x15c23f]={};}this[_0x5638('0x17')][_0x15c23f][_0x2f2f98]=_0x4258d1;}};VoiceQueueReport['prototype'][_0x5638('0x26')]=function(_0x1335e2){try{if(this[_0x5638('0x5d')](_0x1335e2)){if(this[_0x5638('0x40')][_0x1335e2[_0x5638('0x6a')]]){for(var _0x131209=0x0,_0x222eb6={};_0x131209=0x0?moment(_0x16c1ef[_0x008b('0x16')])[_0x008b('0xe')](_0x16c1ef['starttime'],_0x008b('0x17')):null,'data1':_0x008b('0x18'),'data2':_0x16c1ef['accountcode'],'data3':_0x16c1ef[_0x008b('0x19')],'data4':_0x16c1ef[_0x008b('0x1a')]||null,'role':_0x008b('0x11'),'internal':_0x16c1ef[_0x008b('0x13')]?_['toNumber'](_0x16c1ef[_0x008b('0x13')]):undefined,'uniqueid':_0x16c1ef[_0x008b('0x1b')]},'log':_0x008b('0x6')});}; \ No newline at end of file +var _0x26e3=['lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','queuecallerexitAt','Request','CreateMemberReport','voice'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x26e3,0x8e));var _0x326e=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0x26e3[_0x5a6961];return _0x4af0a6;};'use strict';var moment=require(_0x326e('0x0'));var _=require(_0x326e('0x1'));var util=require(_0x326e('0x2'));var client=require(_0x326e('0x3'));exports['voiceQueueReport']=function(_0x4a827c){var _0x5d20f5=_0x4a827c['queuecallercompleteAt']||_0x4a827c[_0x326e('0x4')];return client[_0x326e('0x5')](_0x326e('0x6'),{'body':{'channel':_0x326e('0x7'),'membername':_0x4a827c[_0x326e('0x8')],'interface':_[_0x326e('0x9')](_0x4a827c[_0x326e('0xa')])?util[_0x326e('0xb')]('SIP/%s',_0x4a827c['lastAssignedTo']):_0x4a827c['interface'],'type':_0x326e('0xc'),'enterAt':_0x4a827c[_0x326e('0xd')],'exitAt':_0x5d20f5,'duration':moment(_0x5d20f5)[_0x326e('0xe')](_0x4a827c[_0x326e('0xd')],_0x326e('0xf')),'data1':_0x326e('0x10'),'data2':_0x4a827c[_0x326e('0x11')],'data3':_0x4a827c[_0x326e('0x12')],'data4':null,'data5':_0x4a827c[_0x326e('0x13')],'role':_0x326e('0x14'),'internal':_0x4a827c[_0x326e('0x15')]?_[_0x326e('0x16')](_0x4a827c[_0x326e('0x15')]):undefined,'uniqueid':_0x4a827c[_0x326e('0x17')]},'log':_0x326e('0x6')});};exports[_0x326e('0x18')]=function(_0x1e93ef){return client['Request'](_0x326e('0x6'),{'body':{'channel':_0x326e('0x7'),'membername':_0x1e93ef[_0x326e('0x19')],'interface':_0x1e93ef['interface'],'type':_0x326e('0xc'),'enterAt':_0x1e93ef[_0x326e('0x1a')],'exitAt':_0x1e93ef[_0x326e('0x1b')],'duration':moment(_0x1e93ef[_0x326e('0x1b')])[_0x326e('0xe')](_0x1e93ef[_0x326e('0x1a')],_0x326e('0xf'))>=0x0?moment(_0x1e93ef[_0x326e('0x1b')])[_0x326e('0xe')](_0x1e93ef[_0x326e('0x1a')],_0x326e('0xf')):null,'data1':_0x326e('0x1c'),'data2':_0x1e93ef[_0x326e('0x15')],'data3':_0x1e93ef[_0x326e('0x12')],'data4':_0x1e93ef[_0x326e('0x1d')]||null,'role':_0x326e('0x14'),'internal':_0x1e93ef[_0x326e('0x15')]?_['toNumber'](_0x1e93ef['accountcode']):undefined,'uniqueid':_0x1e93ef[_0x326e('0x17')]},'log':_0x326e('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index fc7b361..b264ac8 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 _0x9c2c=['../client','getTemplates','GetTemplate','html'];(function(_0x40071b,_0x1c596f){var _0x21883d=function(_0x5b1b98){while(--_0x5b1b98){_0x40071b['push'](_0x40071b['shift']());}};_0x21883d(++_0x1c596f);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(_0x4ac695){return function(_0x507004){return client['Request'](_0xc9c2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xc9c2('0x3')]},'log':_0xc9c2('0x2')});};}; \ No newline at end of file +var _0x2b65=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x54377f,_0x531a79){var _0x38c92f=function(_0x2d6762){while(--_0x2d6762){_0x54377f['push'](_0x54377f['shift']());}};_0x38c92f(++_0x531a79);}(_0x2b65,0x131));var _0x52b6=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x2b65[_0x3cf5a3];return _0x39ba2d;};'use strict';var client=require(_0x52b6('0x0'));exports[_0x52b6('0x1')]=function(_0x9b1a2c){return function(_0xc5814d){return client[_0x52b6('0x2')](_0x52b6('0x3'),{'options':{'raw':!![],'attributes':['id',_0x52b6('0x4'),_0x52b6('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index eb9ab0d..d792f9e 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 _0x4157=['Request','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','GetTrigger','getTriggers'];(function(_0x119190,_0x5074ce){var _0x1c1587=function(_0x2c9625){while(--_0x2c9625){_0x119190['push'](_0x119190['shift']());}};_0x1c1587(++_0x5074ce);}(_0x4157,0x1e2));var _0x7415=function(_0x11fb82,_0x8fd714){_0x11fb82=_0x11fb82-0x0;var _0x59c3bb=_0x4157[_0x11fb82];return _0x59c3bb;};'use strict';var client=require('../client');exports[_0x7415('0x0')]=function(_0x15241e){return function(_0x219edb){return client[_0x7415('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x7415('0x2'),_0x7415('0x3'),_0x7415('0x4')],'include':[{'model':_0x7415('0x5'),'as':_0x7415('0x6'),'attributes':['id',_0x7415('0x7'),_0x7415('0x8'),'value']},{'model':'Condition','as':_0x7415('0x9'),'attributes':['id','field',_0x7415('0x8'),_0x7415('0xa')]},{'model':_0x7415('0xb'),'as':_0x7415('0xc'),'attributes':['id',_0x7415('0xd'),_0x7415('0xe'),_0x7415('0xf'),_0x7415('0x10'),_0x7415('0x11'),_0x7415('0x12'),_0x7415('0x13'),'data7']}]},'log':_0x7415('0x14')});};}; \ No newline at end of file +var _0x88e9=['GetTrigger','name','channel','status','Condition','AllConditions','operator','value','field','Action','Actions','action','data3','data4','data6','data7','getTriggers','Request'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x88e9,0x1e4));var _0x988e=function(_0x346610,_0x33bf69){_0x346610=_0x346610-0x0;var _0x55f160=_0x88e9[_0x346610];return _0x55f160;};'use strict';var client=require('../client');exports[_0x988e('0x0')]=function(_0x2a0e2f){return function(_0x378a8e){return client[_0x988e('0x1')](_0x988e('0x2'),{'options':{'raw':![],'attributes':['id',_0x988e('0x3'),_0x988e('0x4'),_0x988e('0x5')],'include':[{'model':_0x988e('0x6'),'as':_0x988e('0x7'),'attributes':['id','field',_0x988e('0x8'),_0x988e('0x9')]},{'model':_0x988e('0x6'),'as':'AnyConditions','attributes':['id',_0x988e('0xa'),'operator',_0x988e('0x9')]},{'model':_0x988e('0xb'),'as':_0x988e('0xc'),'attributes':['id',_0x988e('0xd'),'data1','data2',_0x988e('0xe'),_0x988e('0xf'),'data5',_0x988e('0x10'),_0x988e('0x11')]}]},'log':_0x988e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 047a7f9..99cec28 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 _0x5301=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0xe51d98,_0x47a734){var _0x5ff5f1=function(_0x4193f4){while(--_0x4193f4){_0xe51d98['push'](_0xe51d98['shift']());}};_0x5ff5f1(++_0x47a734);}(_0x5301,0x133));var _0x1530=function(_0x3eb27b,_0x561a9d){_0x3eb27b=_0x3eb27b-0x0;var _0x44c621=_0x5301[_0x3eb27b];return _0x44c621;};'use strict';var client=require(_0x1530('0x0'));exports[_0x1530('0x1')]=function(_0x10c2c4){return function(_0x29473d){return client[_0x1530('0x2')](_0x1530('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1530('0x4'),_0x1530('0x5')]},'log':_0x1530('0x3')});};}; \ No newline at end of file +var _0x0172=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x34c26b,_0x5e279b){var _0x2f9f58=function(_0x273abe){while(--_0x273abe){_0x34c26b['push'](_0x34c26b['shift']());}};_0x2f9f58(++_0x5e279b);}(_0x0172,0x157));var _0x2017=function(_0x262833,_0x5a0afb){_0x262833=_0x262833-0x0;var _0x18645a=_0x0172[_0x262833];return _0x18645a;};'use strict';var client=require(_0x2017('0x0'));exports[_0x2017('0x1')]=function(_0x18f172){return function(_0x45389a){return client['Request'](_0x2017('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2017('0x3'),_0x2017('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 96154aa..64fa73e 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 _0x6af8=['email','online','interface','../client','Request','agent','name','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','getAgents','getTelephones','GetUser','telephone','internal','savePause','saveUnpause','getAgent'];(function(_0xb8511a,_0xcc541d){var _0x323cd5=function(_0x4d8c01){while(--_0x4d8c01){_0xb8511a['push'](_0xb8511a['shift']());}};_0x323cd5(++_0xcc541d);}(_0x6af8,0xdf));var _0x86af=function(_0x308eb8,_0x193ed9){_0x308eb8=_0x308eb8-0x0;var _0x3b7d95=_0x6af8[_0x308eb8];return _0x3b7d95;};'use strict';var client=require(_0x86af('0x0'));exports['getAgents']=function(){return function(){return client[_0x86af('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':_0x86af('0x2')},'attributes':['id',_0x86af('0x3'),'email',_0x86af('0x4'),_0x86af('0x5'),'online',_0x86af('0x6'),_0x86af('0x7'),_0x86af('0x8'),_0x86af('0x9'),'phone',_0x86af('0xa'),'interface']},'log':_0x86af('0xb')});};};exports[_0x86af('0xc')]=function(){return function(){return client['Request'](_0x86af('0xd'),{'options':{'raw':!![],'where':{'role':_0x86af('0xe')},'attributes':['id',_0x86af('0x3'),_0x86af('0x4'),_0x86af('0xf')]},'log':'getTelephones'});};};exports[_0x86af('0x10')]=function(_0x191bbc,_0x40de46,_0x744afb){return client['Request']('PauseUser',{'body':{'type':_0x40de46,'uniqueid':_0x744afb},'options':{'where':{'id':_0x191bbc['id']}},'log':_0x86af('0x10')});};exports[_0x86af('0x11')]=function(_0xb43b39){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0xb43b39['id']}},'log':_0x86af('0x10')});};exports[_0x86af('0x12')]=function(_0x45fcd8){return client[_0x86af('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x86af('0x2'),'id':_0x45fcd8},'attributes':['id','name',_0x86af('0x13'),'accountcode',_0x86af('0x5'),_0x86af('0x14'),_0x86af('0x6'),_0x86af('0x7'),_0x86af('0x8'),_0x86af('0x9'),_0x86af('0x15')]},'log':_0x86af('0x12')});}; \ No newline at end of file +var _0x773c=['getAgents','Request','GetUser','agent','fullname','online','lastLoginAt','lastPauseAt','phone','mobile','interface','getTelephones','telephone','accountcode','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','name','pauseType','voicePause','../client'];(function(_0x86bf15,_0x267ab3){var _0x444a5e=function(_0x1b11ed){while(--_0x1b11ed){_0x86bf15['push'](_0x86bf15['shift']());}};_0x444a5e(++_0x267ab3);}(_0x773c,0x77));var _0xc773=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0x773c[_0x5d9867];return _0x7d2118;};'use strict';var client=require(_0xc773('0x0'));exports[_0xc773('0x1')]=function(){return function(){return client[_0xc773('0x2')](_0xc773('0x3'),{'options':{'raw':![],'where':{'role':_0xc773('0x4')},'attributes':['id','name','email','accountcode',_0xc773('0x5'),_0xc773('0x6'),_0xc773('0x7'),'pauseType',_0xc773('0x8'),'voicePause',_0xc773('0x9'),_0xc773('0xa'),_0xc773('0xb')]},'log':_0xc773('0x1')});};};exports[_0xc773('0xc')]=function(){return function(){return client[_0xc773('0x2')](_0xc773('0x3'),{'options':{'raw':!![],'where':{'role':_0xc773('0xd')},'attributes':['id','name',_0xc773('0xe'),_0xc773('0xf')]},'log':_0xc773('0xc')});};};exports[_0xc773('0x10')]=function(_0x4fa3fa,_0x897afd,_0x3c1ed1){return client[_0xc773('0x2')]('PauseUser',{'body':{'type':_0x897afd,'uniqueid':_0x3c1ed1},'options':{'where':{'id':_0x4fa3fa['id']}},'log':_0xc773('0x10')});};exports[_0xc773('0x11')]=function(_0x30910d){return client[_0xc773('0x2')](_0xc773('0x12'),{'body':{},'options':{'where':{'id':_0x30910d['id']}},'log':'savePause'});};exports[_0xc773('0x13')]=function(_0x4285a){return client[_0xc773('0x2')](_0xc773('0x14'),{'options':{'raw':![],'where':{'role':_0xc773('0x4'),'id':_0x4285a},'attributes':['id',_0xc773('0x15'),'email','accountcode','fullname',_0xc773('0x6'),'lastLoginAt',_0xc773('0x16'),_0xc773('0x8'),_0xc773('0x17'),_0xc773('0xb')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c57e735..b6e701d 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 _0x39ef=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x206b6c,_0x22301f){var _0x20bac7=function(_0x37ae2c){while(--_0x37ae2c){_0x206b6c['push'](_0x206b6c['shift']());}};_0x20bac7(++_0x22301f);}(_0x39ef,0xe5));var _0xf39e=function(_0x5ebb09,_0x5a6fe5){_0x5ebb09=_0x5ebb09-0x0;var _0x29d0f4=_0x39ef[_0x5ebb09];return _0x29d0f4;};'use strict';var client=require(_0xf39e('0x0'));exports['create']=function(_0x3e6c2e){return client['Request'](_0xf39e('0x1'),{'body':_0x3e6c2e,'log':_0xf39e('0x1')});};exports[_0xf39e('0x2')]=function(_0x1e9ba4,_0x80255d,_0x57e646){return client[_0xf39e('0x3')](_0xf39e('0x4'),{'body':_0x1e9ba4,'options':{'where':{'uniqueid':_0x80255d,'interface':_0x57e646,'agentcomplete':!![]}},'log':_0xf39e('0x4')});}; \ No newline at end of file +var _0x9d08=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d08,0x1b3));var _0x89d0=function(_0x3efd08,_0x22778b){_0x3efd08=_0x3efd08-0x0;var _0x291f87=_0x9d08[_0x3efd08];return _0x291f87;};'use strict';var client=require(_0x89d0('0x0'));exports[_0x89d0('0x1')]=function(_0x4b7591){return client[_0x89d0('0x2')]('CreateVoiceAgentReport',{'body':_0x4b7591,'log':_0x89d0('0x3')});};exports[_0x89d0('0x4')]=function(_0x3e5c32,_0x5b0429,_0x3ed5a3){return client[_0x89d0('0x2')](_0x89d0('0x5'),{'body':_0x3e5c32,'options':{'where':{'uniqueid':_0x5b0429,'interface':_0x3ed5a3,'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 6d42a72..5d2e4ba 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 _0x01e1=['YYYY-MM-DD\x20HH:mm:ss','billableseconds','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','day','format','endOf'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x01e1,0x1c4));var _0x101e=function(_0xb2ec63,_0x10dae4){_0xb2ec63=_0xb2ec63-0x0;var _0x598c4f=_0x01e1[_0xb2ec63];return _0x598c4f;};'use strict';var moment=require(_0x101e('0x0'));var util=require('util');var _=require(_0x101e('0x1'));var client=require('../client');exports[_0x101e('0x2')]=function(_0x41f212){return client[_0x101e('0x3')](_0x101e('0x4'),{'body':_[_0x101e('0x5')](_0x41f212,{'source':_0x41f212[_0x101e('0x6')],'destinationcontext':_0x41f212[_0x101e('0x7')],'callerid':_0x41f212['callerid'],'amaflags':_0x101e('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x101e('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x101e('0xa'))[_0x101e('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x101e('0xc')](_0x101e('0xa'))[_0x101e('0xb')](_0x101e('0xd'))]}},'attributes':['type','disposition','duration',_0x101e('0xe')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xb51f=['format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','outbound','startOf','day'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xb51f,0x1a9));var _0xfb51=function(_0x3a47b1,_0x318a5e){_0x3a47b1=_0x3a47b1-0x0;var _0x464796=_0xb51f[_0x3a47b1];return _0x464796;};'use strict';var moment=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var _=require(_0xfb51('0x2'));var client=require(_0xfb51('0x3'));exports[_0xfb51('0x4')]=function(_0x56b1cf){return client['Request']('CreateVoiceCallReport',{'body':_[_0xfb51('0x5')](_0x56b1cf,{'source':_0x56b1cf[_0xfb51('0x6')],'destinationcontext':_0x56b1cf[_0xfb51('0x7')],'callerid':_0x56b1cf['callerid'],'amaflags':_0xfb51('0x8')}),'log':_0xfb51('0x9')});};exports[_0xfb51('0xa')]=function(){return function(){return client[_0xfb51('0xb')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xfb51('0xc')],'createdAt':{'$between':[moment()[_0xfb51('0xd')](_0xfb51('0xe'))[_0xfb51('0xf')](_0xfb51('0x10')),moment()['endOf']('day')[_0xfb51('0xf')](_0xfb51('0x10'))]}},'attributes':[_0xfb51('0x11'),_0xfb51('0x12'),_0xfb51('0x13'),_0xfb51('0x14')]},'log':_0xfb51('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8c9fbfb..19f3fe6 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 _0x205d=['create'];(function(_0x2fc8a0,_0x3cb528){var _0x500b32=function(_0x4d7021){while(--_0x4d7021){_0x2fc8a0['push'](_0x2fc8a0['shift']());}};_0x500b32(++_0x3cb528);}(_0x205d,0x9f));var _0xd205=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x205d[_0x23b655];return _0x364b32;};'use strict';var client=require('../client');exports[_0xd205('0x0')]=function(_0x26c01e){return client['Request']('CreateVoiceDialReport',{'body':_0x26c01e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x3988=['CreateVoiceDialReport','Request'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x3988,0x75));var _0x8398=function(_0x143a3b,_0xcb3299){_0x143a3b=_0x143a3b-0x0;var _0x57478f=_0x3988[_0x143a3b];return _0x57478f;};'use strict';var client=require('../client');exports['create']=function(_0x4de47e){return client[_0x8398('0x0')](_0x8398('0x1'),{'body':_0x4de47e,'log':_0x8398('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1fd7911..854eb1a 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 _0xd8d7=['Request','GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xd8d7[_0x413b4d];return _0x8b810a;};'use strict';var client=require(_0x7d8d('0x0'));exports[_0x7d8d('0x1')]=function(){return function(){return client[_0x7d8d('0x2')](_0x7d8d('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7d8d('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x6aa4=['Request','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x3ace85,_0xfb5919){var _0x3ccc9c=function(_0x1f4e8d){while(--_0x1f4e8d){_0x3ace85['push'](_0x3ace85['shift']());}};_0x3ccc9c(++_0xfb5919);}(_0x6aa4,0xb2));var _0x46aa=function(_0x5da210,_0x44efa1){_0x5da210=_0x5da210-0x0;var _0x2fbafe=_0x6aa4[_0x5da210];return _0x2fbafe;};'use strict';var client=require(_0x46aa('0x0'));exports[_0x46aa('0x1')]=function(){return function(){return client[_0x46aa('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x46aa('0x3'),_0x46aa('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x46aa('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 405af49..ae68cc0 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 _0x7932=['type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','Interval','interval','../client','getVoiceQueues','name','acw','acwTimeout','autopause','monitor_format'];(function(_0x2ded1e,_0x1584ac){var _0x321640=function(_0x31a626){while(--_0x31a626){_0x2ded1e['push'](_0x2ded1e['shift']());}};_0x321640(++_0x1584ac);}(_0x7932,0x6d));var _0x2793=function(_0x2c5096,_0x2f3bb5){_0x2c5096=_0x2c5096-0x0;var _0x1a719f=_0x7932[_0x2c5096];return _0x1a719f;};'use strict';var client=require(_0x2793('0x0'));exports[_0x2793('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2793('0x2'),_0x2793('0x3'),_0x2793('0x4'),_0x2793('0x5'),_0x2793('0x6'),_0x2793('0x7'),'dialActive','dialMethod',_0x2793('0x8'),_0x2793('0x9'),_0x2793('0xa'),_0x2793('0xb'),'dialPredictiveOptimizationPercentage',_0x2793('0xc'),_0x2793('0xd'),_0x2793('0xe'),_0x2793('0xf'),_0x2793('0x10'),_0x2793('0x11'),_0x2793('0x12'),'dialCongestionMaxRetry',_0x2793('0x13'),_0x2793('0x14'),_0x2793('0x15'),_0x2793('0x16'),_0x2793('0x17'),_0x2793('0x18'),'dialTimezone',_0x2793('0x19'),_0x2793('0x1a'),'dialCheckDuplicateType',_0x2793('0x1b'),_0x2793('0x1c'),_0x2793('0x1d'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x2793('0x1e'),_0x2793('0x1f'),_0x2793('0x20'),_0x2793('0x21'),_0x2793('0x22'),_0x2793('0x23'),_0x2793('0x24'),_0x2793('0x25'),_0x2793('0x26'),_0x2793('0x27'),_0x2793('0x28'),'dialQueueProject2','monitor_format',_0x2793('0x29'),'dialRandomLastDigitCallerIdNumber',_0x2793('0x2a'),_0x2793('0x2b'),_0x2793('0x2c'),_0x2793('0x2d'),_0x2793('0x2e'),'dialAbandonedMaxRetry',_0x2793('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x2793('0x30'),_0x2793('0x31'),'mandatoryDisposition',_0x2793('0x32'),_0x2793('0x33')],'include':[{'model':'Trunk','as':_0x2793('0x34'),'attributes':['id',_0x2793('0x2'),_0x2793('0x35'),_0x2793('0x36')]},{'model':_0x2793('0x37'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x2793('0x34'),'as':'TrunkBackup','attributes':['id',_0x2793('0x2'),_0x2793('0x35'),'active']},{'model':_0x2793('0x38'),'as':'Interval','attributes':['id',_0x2793('0x2')],'include':[{'model':_0x2793('0x38'),'as':'Intervals','attributes':['id',_0x2793('0x2'),_0x2793('0x39')]}]}]},'log':_0x2793('0x1')});};}; \ No newline at end of file +var _0xb7b4=['dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','name','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x39eb43,_0x4b0e70){var _0x54fb56=function(_0x5782f7){while(--_0x5782f7){_0x39eb43['push'](_0x39eb43['shift']());}};_0x54fb56(++_0x4b0e70);}(_0xb7b4,0x1ad));var _0x4b7b=function(_0x405ef9,_0x2c6121){_0x405ef9=_0x405ef9-0x0;var _0x3642ee=_0xb7b4[_0x405ef9];return _0x3642ee;};'use strict';var client=require(_0x4b7b('0x0'));exports[_0x4b7b('0x1')]=function(){return function(){return client[_0x4b7b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x4b7b('0x3'),_0x4b7b('0x4'),'autopause',_0x4b7b('0x5'),_0x4b7b('0x6'),_0x4b7b('0x7'),_0x4b7b('0x8'),_0x4b7b('0x9'),_0x4b7b('0xa'),_0x4b7b('0xb'),_0x4b7b('0xc'),_0x4b7b('0xd'),_0x4b7b('0xe'),_0x4b7b('0xf'),_0x4b7b('0x10'),'dialOriginateTimeout',_0x4b7b('0x11'),'dialQueueTimeout',_0x4b7b('0x12'),_0x4b7b('0x13'),_0x4b7b('0x14'),'dialBusyMaxRetry',_0x4b7b('0x15'),_0x4b7b('0x16'),_0x4b7b('0x17'),_0x4b7b('0x18'),_0x4b7b('0x19'),_0x4b7b('0x1a'),_0x4b7b('0x1b'),_0x4b7b('0x1c'),_0x4b7b('0x1d'),'dialAMDInitialSilence',_0x4b7b('0x1e'),_0x4b7b('0x1f'),'dialAMDTotalAnalysisTime',_0x4b7b('0x20'),_0x4b7b('0x21'),_0x4b7b('0x22'),_0x4b7b('0x23'),_0x4b7b('0x24'),_0x4b7b('0x25'),'dialRecallMeTimeout',_0x4b7b('0x26'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x4b7b('0x27'),_0x4b7b('0x28'),_0x4b7b('0x5'),_0x4b7b('0x29'),_0x4b7b('0x2a'),_0x4b7b('0x2b'),'dialNoSuchNumberMaxRetry',_0x4b7b('0x2c'),_0x4b7b('0x2d'),_0x4b7b('0x2e'),_0x4b7b('0x2f'),_0x4b7b('0x30'),'dialMachineMaxRetry',_0x4b7b('0x31'),_0x4b7b('0x32'),_0x4b7b('0x33'),_0x4b7b('0x34'),_0x4b7b('0x35'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x4b7b('0x36'),'as':'Trunk','attributes':['id',_0x4b7b('0x37'),_0x4b7b('0x38'),'active']},{'model':_0x4b7b('0x39'),'as':_0x4b7b('0x3a'),'attributes':['id',_0x4b7b('0x37')]},{'model':_0x4b7b('0x36'),'as':'TrunkBackup','attributes':['id',_0x4b7b('0x37'),_0x4b7b('0x38'),_0x4b7b('0x3b')]},{'model':_0x4b7b('0x3c'),'as':_0x4b7b('0x3c'),'attributes':['id',_0x4b7b('0x37')],'include':[{'model':'Interval','as':_0x4b7b('0x3d'),'attributes':['id',_0x4b7b('0x37'),_0x4b7b('0x3e')]}]}]},'log':_0x4b7b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5b5641d..3fef592 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 _0xc1ec=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc1ec,0x13d));var _0xcc1e=function(_0x276b58,_0x142d99){_0x276b58=_0x276b58-0x0;var _0x59623c=_0xc1ec[_0x276b58];return _0x59623c;};'use strict';var moment=require(_0xcc1e('0x0'));var _=require(_0xcc1e('0x1'));var client=require(_0xcc1e('0x2'));exports['create']=function(_0x41b881){return client[_0xcc1e('0x3')](_0xcc1e('0x4'),{'body':_0x41b881,'log':_0xcc1e('0x4')});};exports[_0xcc1e('0x5')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xcc1e('0x6')]('day')[_0xcc1e('0x7')](_0xcc1e('0x8')),moment()[_0xcc1e('0x9')](_0xcc1e('0xa'))[_0xcc1e('0x7')](_0xcc1e('0x8'))]}},'attributes':[_0xcc1e('0xb'),_0xcc1e('0xc'),_0xcc1e('0xd'),_0xcc1e('0xe'),_0xcc1e('0xf'),_0xcc1e('0x10'),_0xcc1e('0x11'),_0xcc1e('0x12'),_0xcc1e('0x13'),_0xcc1e('0x14')]},'log':_0xcc1e('0x15')});};}; \ No newline at end of file +var _0x7225=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','CreateVoiceQueueReport','getVoiceQueueReports','Request','GetVoiceQueueReport','startOf'];(function(_0x359fd3,_0x278add){var _0x257acd=function(_0x33c5a6){while(--_0x33c5a6){_0x359fd3['push'](_0x359fd3['shift']());}};_0x257acd(++_0x278add);}(_0x7225,0x109));var _0x5722=function(_0x18841b,_0xeaadb){_0x18841b=_0x18841b-0x0;var _0x199abf=_0x7225[_0x18841b];return _0x199abf;};'use strict';var moment=require('moment');var _=require(_0x5722('0x0'));var client=require(_0x5722('0x1'));exports['create']=function(_0x5c2018){return client['Request'](_0x5722('0x2'),{'body':_0x5c2018,'log':_0x5722('0x2')});};exports[_0x5722('0x3')]=function(){return function(){return client[_0x5722('0x4')](_0x5722('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5722('0x6')](_0x5722('0x7'))[_0x5722('0x8')](_0x5722('0x9')),moment()[_0x5722('0xa')](_0x5722('0x7'))[_0x5722('0x8')](_0x5722('0x9'))]}},'attributes':['uniqueid',_0x5722('0xb'),'queuecallerjoinAt',_0x5722('0xc'),_0x5722('0xd'),'queuecallercompleteAt','queuecallerexit',_0x5722('0xe'),'queuecallerabandon',_0x5722('0xf')]},'log':_0x5722('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 02254af..4b4cb42 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 _0xcbb9=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x2b3939,_0x499ea0){var _0x2d20c3=function(_0x475290){while(--_0x475290){_0x2b3939['push'](_0x2b3939['shift']());}};_0x2d20c3(++_0x499ea0);}(_0xcbb9,0xb1));var _0x9cbb=function(_0x3dff1c,_0x58d15f){_0x3dff1c=_0x3dff1c-0x0;var _0x588567=_0xcbb9[_0x3dff1c];return _0x588567;};'use strict';var client=require(_0x9cbb('0x0'));exports[_0x9cbb('0x1')]=function(_0x22addf){return function(){return client[_0x9cbb('0x2')](_0x9cbb('0x3'),{'options':{'where':{'VoiceQueueId':_0x22addf,'paused':!![]},'raw':!![]},'log':_0x9cbb('0x1')});};}; \ No newline at end of file +var _0xdd4c=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0xf02a38,_0x264f61){var _0x33c0bf=function(_0x167977){while(--_0x167977){_0xf02a38['push'](_0xf02a38['shift']());}};_0x33c0bf(++_0x264f61);}(_0xdd4c,0xb3));var _0xcdd4=function(_0x3f1f86,_0x29383a){_0x3f1f86=_0x3f1f86-0x0;var _0x2e17fc=_0xdd4c[_0x3f1f86];return _0x2e17fc;};'use strict';var client=require(_0xcdd4('0x0'));exports['getVoiceQueueRtPauses']=function(_0x454323){return function(){return client['Request'](_0xcdd4('0x1'),{'options':{'where':{'VoiceQueueId':_0x454323,'paused':!![]},'raw':!![]},'log':_0xcdd4('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 35ffd48..4b4bdca 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 _0xf89a=['merge','monitorFilename','CreateVoiceRecording','lodash','create'];(function(_0x1830a9,_0x1583bd){var _0x2b6166=function(_0x4cf0e6){while(--_0x4cf0e6){_0x1830a9['push'](_0x1830a9['shift']());}};_0x2b6166(++_0x1583bd);}(_0xf89a,0x198));var _0xaf89=function(_0x47606d,_0x1039c6){_0x47606d=_0x47606d-0x0;var _0x1b0225=_0xf89a[_0x47606d];return _0x1b0225;};'use strict';var _=require(_0xaf89('0x0'));var client=require('../client');exports[_0xaf89('0x1')]=function(_0x1bf391){return client['Request']('CreateVoiceRecording',{'body':_[_0xaf89('0x2')](_0x1bf391,{'value':_0x1bf391[_0xaf89('0x3')]}),'log':_0xaf89('0x4')});}; \ No newline at end of file +var _0xa16f=['CreateVoiceRecording','merge','monitorFilename','lodash','create','Request'];(function(_0x125e6f,_0x30edf7){var _0x4ee58c=function(_0x36aed9){while(--_0x36aed9){_0x125e6f['push'](_0x125e6f['shift']());}};_0x4ee58c(++_0x30edf7);}(_0xa16f,0x135));var _0xfa16=function(_0x466267,_0x352599){_0x466267=_0x466267-0x0;var _0x3a6ea5=_0xa16f[_0x466267];return _0x3a6ea5;};'use strict';var _=require(_0xfa16('0x0'));var client=require('../client');exports[_0xfa16('0x1')]=function(_0x1fe413){return client[_0xfa16('0x2')](_0xfa16('0x3'),{'body':_[_0xfa16('0x4')](_0x1fe413,{'value':_0x1fe413[_0xfa16('0x5')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 3957bda..f46fee1 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 _0xe464=['result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xe464,0x11d));var _0x4e46=function(_0x2131dd,_0x31471c){_0x2131dd=_0x2131dd-0x0;var _0xac1305=_0xe464[_0x2131dd];return _0xac1305;};'use strict';var client=require('../client');exports[_0x4e46('0x0')]=function(_0x3d78fa){return client[_0x4e46('0x1')](_0x4e46('0x2'),{'body':{'result':_0x3d78fa[_0x4e46('0x3')],'transfererchannel':_0x3d78fa[_0x4e46('0x4')],'transferercalleridnum':_0x3d78fa['transferercalleridnum'],'transferercalleridname':_0x3d78fa['transferercalleridname'],'transfererconnectedlinenum':_0x3d78fa[_0x4e46('0x5')],'transfererconnectedlinename':_0x3d78fa[_0x4e46('0x6')],'transfereraccountcode':_0x3d78fa['transfereraccountcode'],'transferercontext':_0x3d78fa[_0x4e46('0x7')],'transfererexten':_0x3d78fa[_0x4e46('0x8')],'transfererlinkedid':_0x3d78fa[_0x4e46('0x9')],'transfereechannel':_0x3d78fa['transfereechannel'],'transfereecalleridnum':_0x3d78fa['transfereecalleridnum'],'transfereecalleridname':_0x3d78fa[_0x4e46('0xa')],'transfereeconnectedlinenum':_0x3d78fa[_0x4e46('0xb')],'transfereeconnectedlinename':_0x3d78fa[_0x4e46('0xc')],'transfereeaccountcode':_0x3d78fa['transfereeaccountcode'],'transfereecontext':_0x3d78fa['transfereecontext'],'transfereeexten':_0x3d78fa[_0x4e46('0xd')],'transfereelinkedid':_0x3d78fa[_0x4e46('0xe')],'isexternal':_0x3d78fa[_0x4e46('0xf')],'context':_0x3d78fa[_0x4e46('0x10')],'extension':_0x3d78fa[_0x4e46('0x11')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x4e46('0x12')]=function(_0x23a1cb){return client[_0x4e46('0x1')](_0x4e46('0x2'),{'body':{'result':_0x23a1cb[_0x4e46('0x3')],'transfererchannel':_0x23a1cb['origtransfererchannel'],'transferercalleridnum':_0x23a1cb['origtransferercalleridnum'],'transferercalleridname':_0x23a1cb['origtransferercalleridname'],'transfererconnectedlinenum':_0x23a1cb[_0x4e46('0x13')],'transfererconnectedlinename':_0x23a1cb[_0x4e46('0x14')],'transfereraccountcode':_0x23a1cb[_0x4e46('0x15')],'transferercontext':_0x23a1cb[_0x4e46('0x16')],'transfererexten':_0x23a1cb[_0x4e46('0x17')],'transfererlinkedid':_0x23a1cb['origtransfererlinkedid'],'transfereechannel':_0x23a1cb[_0x4e46('0x18')],'transfereecalleridnum':_0x23a1cb[_0x4e46('0x19')],'transfereecalleridname':_0x23a1cb[_0x4e46('0x1a')],'transfereeconnectedlinenum':_0x23a1cb[_0x4e46('0x1b')],'transfereeconnectedlinename':_0x23a1cb[_0x4e46('0x1c')],'transfereeaccountcode':_0x23a1cb[_0x4e46('0x1d')],'transfereecontext':_0x23a1cb[_0x4e46('0x1e')],'transfereeexten':_0x23a1cb[_0x4e46('0x1f')],'transfereelinkedid':_0x23a1cb[_0x4e46('0x20')],'isexternal':_0x23a1cb['isexternal'],'context':_0x23a1cb[_0x4e46('0x21')],'extension':_0x23a1cb[_0x4e46('0x22')],'type':_0x4e46('0x23')},'log':_0x4e46('0x2')});}; \ No newline at end of file +var _0x1da4=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten'];(function(_0x225ddc,_0x20e331){var _0x51c2ab=function(_0x407a05){while(--_0x407a05){_0x225ddc['push'](_0x225ddc['shift']());}};_0x51c2ab(++_0x20e331);}(_0x1da4,0x120));var _0x41da=function(_0x53828b,_0x4ffa98){_0x53828b=_0x53828b-0x0;var _0x11ddd6=_0x1da4[_0x53828b];return _0x11ddd6;};'use strict';var client=require(_0x41da('0x0'));exports[_0x41da('0x1')]=function(_0x223529){return client[_0x41da('0x2')](_0x41da('0x3'),{'body':{'result':_0x223529[_0x41da('0x4')],'transfererchannel':_0x223529['transfererchannel'],'transferercalleridnum':_0x223529[_0x41da('0x5')],'transferercalleridname':_0x223529['transferercalleridname'],'transfererconnectedlinenum':_0x223529[_0x41da('0x6')],'transfererconnectedlinename':_0x223529[_0x41da('0x7')],'transfereraccountcode':_0x223529[_0x41da('0x8')],'transferercontext':_0x223529[_0x41da('0x9')],'transfererexten':_0x223529[_0x41da('0xa')],'transfererlinkedid':_0x223529[_0x41da('0xb')],'transfereechannel':_0x223529[_0x41da('0xc')],'transfereecalleridnum':_0x223529['transfereecalleridnum'],'transfereecalleridname':_0x223529[_0x41da('0xd')],'transfereeconnectedlinenum':_0x223529[_0x41da('0xe')],'transfereeconnectedlinename':_0x223529['transfereeconnectedlinename'],'transfereeaccountcode':_0x223529[_0x41da('0xf')],'transfereecontext':_0x223529[_0x41da('0x10')],'transfereeexten':_0x223529[_0x41da('0x11')],'transfereelinkedid':_0x223529[_0x41da('0x12')],'isexternal':_0x223529[_0x41da('0x13')],'context':_0x223529[_0x41da('0x14')],'extension':_0x223529[_0x41da('0x15')],'type':'blind'},'log':_0x41da('0x3')});};exports['attendedTransfer']=function(_0x475b00){return client[_0x41da('0x2')](_0x41da('0x3'),{'body':{'result':_0x475b00[_0x41da('0x4')],'transfererchannel':_0x475b00[_0x41da('0x16')],'transferercalleridnum':_0x475b00[_0x41da('0x17')],'transferercalleridname':_0x475b00[_0x41da('0x18')],'transfererconnectedlinenum':_0x475b00[_0x41da('0x19')],'transfererconnectedlinename':_0x475b00[_0x41da('0x1a')],'transfereraccountcode':_0x475b00[_0x41da('0x1b')],'transferercontext':_0x475b00['secondtransferercontext'],'transfererexten':_0x475b00[_0x41da('0x1c')],'transfererlinkedid':_0x475b00[_0x41da('0x1d')],'transfereechannel':_0x475b00[_0x41da('0x1e')],'transfereecalleridnum':_0x475b00[_0x41da('0x1f')],'transfereecalleridname':_0x475b00[_0x41da('0x20')],'transfereeconnectedlinenum':_0x475b00[_0x41da('0x21')],'transfereeconnectedlinename':_0x475b00[_0x41da('0x22')],'transfereeaccountcode':_0x475b00[_0x41da('0x23')],'transfereecontext':_0x475b00[_0x41da('0x24')],'transfereeexten':_0x475b00[_0x41da('0x25')],'transfereelinkedid':_0x475b00[_0x41da('0x26')],'isexternal':_0x475b00[_0x41da('0x13')],'context':_0x475b00['origtransferercontext'],'extension':_0x475b00[_0x41da('0x27')],'type':_0x41da('0x28')},'log':_0x41da('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6f757be..0e09bac 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 _0xa940=['unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','Interval','push','values','length','username','voicechannel','validate','map','find','uniqueid','channel','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','StopMixMonitor','destinationchannel','stop','%s.%s','filename','wav','monitors','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','catch','message','command','Command','then','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type'];(function(_0x4452dc,_0x479149){var _0x52b892=function(_0x4a0098){while(--_0x4a0098){_0x4452dc['push'](_0x4452dc['shift']());}};_0x52b892(++_0x479149);}(_0xa940,0x168));var _0x0a94=function(_0x1642a7,_0x2e72f1){_0x1642a7=_0x1642a7-0x0;var _0x41eb0c=_0xa940[_0x1642a7];return _0x41eb0c;};'use strict';var _=require('lodash');var util=require(_0x0a94('0x0'));var jayson=require(_0x0a94('0x1'));var schema=require('validate');var BPromise=require(_0x0a94('0x2'));var moment=require(_0x0a94('0x3'));var config=require(_0x0a94('0x4'));var properties=require(_0x0a94('0x5'));var ami=require(_0x0a94('0x6'));exports[_0x0a94('0x7')]=function(_0x5c71ba,_0x399c79,_0x3c1e1b){return new BPromise(function(_0x4a103c,_0x2f6b77){var _0x50ea05={'QueuePause':function(_0x41697a){return new Promise(function(_0x385ae5,_0x402795){var _0x414e58=util[_0x0a94('0x8')](_0x0a94('0x9'),_0x0a94('0xa'),_0x41697a[_0x0a94('0xb')]);if(_0x5c71ba[_0x0a94('0xc')]&&_0x5c71ba[_0x0a94('0xc')][_0x414e58]&&_0x5c71ba[_0x0a94('0xc')][_0x414e58][_0x0a94('0xd')]){_0x5c71ba[_0x0a94('0xc')][_0x414e58][_0x0a94('0xe')]();}if(_0x5c71ba[_0x0a94('0xf')][_0x414e58]){_0x5c71ba[_0x0a94('0xf')][_0x414e58][_0x0a94('0x10')]({'statePause':_0x41697a[_0x0a94('0x11')]?!![]:![]});}_0x385ae5({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4787f8){var _0x1ba3ac=this;return new Promise(function(_0x96be8d,_0x50f0b2){if(ami[_0x0a94('0x12')]()==![]){return _0x50f0b2(_0x1ba3ac[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')]['username'],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}_0x4787f8=_['pick'](_0x4787f8,_[_0x0a94('0x17')](properties[_0x0a94('0x18')]));_0x4787f8[_0x0a94('0x19')]=_0x0a94('0x1a');return ami[_0x0a94('0x1b')](_0x4787f8)['then'](function(_0x5492cb){_0x96be8d({'code':0xc8,'message':_0x5492cb['message']});})[_0x0a94('0x1c')](function(_0x5d9cdf){_0x50f0b2(_0x1ba3ac[_0x0a94('0x13')](0x1f5,_0x5d9cdf[_0x0a94('0x1d')]));});});},'Command':function(_0x5647fd){var _0x12ed20=this;return new Promise(function(_0x416f8d,_0xa47fab){if(ami[_0x0a94('0x12')]()==![]){return _0xa47fab(_0x12ed20[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')]['username'],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}_0x5647fd=_['pick'](_0x5647fd,_0x0a94('0x1e'));_0x5647fd['action']=_0x0a94('0x1f');return ami[_0x0a94('0x1b')](_0x5647fd)[_0x0a94('0x20')](function(_0x1de4c3){_0x416f8d({'code':0xc8,'message':_0x1de4c3['content']});})['catch'](function(_0x106044){_0xa47fab(_0x12ed20[_0x0a94('0x13')](0x1f5,_0x106044[_0x0a94('0x1d')]));});});},'VoiceQueues':function(_0x178842){return new Promise(function(_0x3ed8ed,_0x9e6377){var _0x170b2c=[];for(var _0x2a8233 in _0x5c71ba[_0x0a94('0x21')]){if(_0x5c71ba[_0x0a94('0x21')][_0x0a94('0x22')](_0x2a8233)){var _0x47d6da=_0x5c71ba['voiceQueues'][_0x2a8233];var _0x28918d={'id':_0x47d6da['id'],'name':_0x47d6da[_0x0a94('0xb')],'strategy':_0x47d6da[_0x0a94('0x23')],'answered':_0x47d6da[_0x0a94('0x24')],'available':_0x47d6da[_0x0a94('0x25')],'loggedIn':_0x47d6da[_0x0a94('0x26')],'pTalking':_0x47d6da[_0x0a94('0x27')],'sumBillable':_0x47d6da['sumBillable'],'sumDuration':_0x47d6da[_0x0a94('0x28')],'sumHoldTime':_0x47d6da[_0x0a94('0x29')]||0x0,'talking':_0x47d6da[_0x0a94('0x2a')],'total':_0x47d6da[_0x0a94('0x2b')],'type':_0x47d6da[_0x0a94('0x2c')],'unmanaged':_0x47d6da[_0x0a94('0x2d')],'abandoned':_0x47d6da[_0x0a94('0x2e')],'waiting':_0x47d6da['waiting'],'loggedInDb':_0x47d6da[_0x0a94('0x2f')]};if(_0x47d6da[_0x0a94('0x2c')]===_0x0a94('0x30')){_0x28918d[_0x0a94('0x31')]=_0x47d6da[_0x0a94('0x31')];_0x28918d[_0x0a94('0x32')]=_0x47d6da[_0x0a94('0x32')];_0x28918d['dialOriginateCallerIdName']=_0x47d6da['dialOriginateCallerIdName'];_0x28918d['dialOriginateCallerIdNumber']=_0x47d6da[_0x0a94('0x33')];_0x28918d[_0x0a94('0x34')]=_0x47d6da[_0x0a94('0x34')];_0x28918d[_0x0a94('0x35')]=_0x47d6da[_0x0a94('0x35')];_0x28918d[_0x0a94('0x36')]=_0x47d6da[_0x0a94('0x36')];_0x28918d[_0x0a94('0x37')]=_0x47d6da['outboundAnswerCallsDay'];_0x28918d['outboundBlacklistCallsDay']=_0x47d6da[_0x0a94('0x38')];_0x28918d[_0x0a94('0x39')]=_0x47d6da[_0x0a94('0x39')];_0x28918d['outboundCongestionCallsDay']=_0x47d6da['outboundCongestionCallsDay'];_0x28918d[_0x0a94('0x3a')]=_0x47d6da['outboundDropCallsDayACS'];_0x28918d[_0x0a94('0x3b')]=_0x47d6da['outboundDropCallsDayCallersExit'];_0x28918d['outboundDropCallsDayTimeout']=_0x47d6da['outboundDropCallsDayTimeout'];_0x28918d[_0x0a94('0x3c')]=_0x47d6da['outboundNoAnswerCallsDay'];_0x28918d['outboundNoSuchCallsDay']=_0x47d6da[_0x0a94('0x3d')];_0x28918d['outboundOriginateFailureCallsDay']=_0x47d6da[_0x0a94('0x3e')];_0x28918d[_0x0a94('0x3f')]=_0x47d6da[_0x0a94('0x3f')];_0x28918d[_0x0a94('0x40')]=_0x47d6da['outboundRejectCallsDay'];_0x28918d[_0x0a94('0x41')]=_0x47d6da[_0x0a94('0x41')];_0x28918d['predictiveIntervalAnsweredCalls']=_0x47d6da['predictiveIntervalAnsweredCalls'];_0x28918d[_0x0a94('0x42')]=_0x47d6da['predictiveIntervalAvgHoldtime'];_0x28918d[_0x0a94('0x43')]=_0x47d6da[_0x0a94('0x43')];_0x28918d['predictiveIntervalDroppedCallsCallersExit']=_0x47d6da[_0x0a94('0x44')];_0x28918d[_0x0a94('0x45')]=_0x47d6da['predictiveIntervalDroppedCallsTimeout'];_0x28918d['predictiveIntervalErlangCalls']=_0x47d6da[_0x0a94('0x46')];_0x28918d[_0x0a94('0x47')]=_0x47d6da[_0x0a94('0x47')];_0x28918d[_0x0a94('0x48')]=_0x47d6da['predictiveIntervalHitRate'];_0x28918d[_0x0a94('0x49')]=_0x47d6da[_0x0a94('0x49')];_0x28918d['predictiveIntervalPauses']=_0x47d6da[_0x0a94('0x4a')];_0x28918d[_0x0a94('0x4b')]=_0x47d6da[_0x0a94('0x4b')];_0x28918d[_0x0a94('0x4c')]=_0x47d6da[_0x0a94('0x4c')];_0x28918d[_0x0a94('0x1d')]=_0x47d6da[_0x0a94('0x1d')];_0x28918d[_0x0a94('0x4d')]=_0x47d6da[_0x0a94('0x4d')];_0x28918d['erlangCalls']=_0x47d6da[_0x0a94('0x4e')];_0x28918d['erlangCallToSecond']=_0x47d6da[_0x0a94('0x4f')];_0x28918d[_0x0a94('0x50')]=_0x47d6da[_0x0a94('0x50')];_0x28918d[_0x0a94('0x51')]=_0x47d6da[_0x0a94('0x51')];_0x28918d['startPredictive']=_0x47d6da['startPredictive'];_0x28918d[_0x0a94('0x52')]=_0x47d6da[_0x0a94('0x52')];}if(_0x47d6da[_0x0a94('0x53')]){_0x28918d['Trunk']={'id':_0x47d6da[_0x0a94('0x53')]['id'],'name':_0x47d6da[_0x0a94('0x53')][_0x0a94('0xb')],'active':_0x47d6da['Trunk']['active'],'callerid':_0x47d6da[_0x0a94('0x53')][_0x0a94('0x54')]};}if(_0x47d6da[_0x0a94('0x55')]){_0x28918d[_0x0a94('0x55')]={'id':_0x47d6da[_0x0a94('0x55')]['id'],'name':_0x47d6da[_0x0a94('0x55')][_0x0a94('0xb')]};}_0x170b2c[_0x0a94('0x56')](_0x28918d);}}_0x3ed8ed({'count':_0x170b2c['length'],'rows':_0x170b2c});});},'VoiceChannels':function(_0x34a719){return new Promise(function(_0x92cd8b,_0x55de48){var _0x299514=_[_0x0a94('0x57')](_0x5c71ba['channels']);_0x92cd8b({'count':_0x299514[_0x0a94('0x58')],'rows':_0x299514});});},'VoiceChannelMixMonitor':function(_0x16e2b2){var _0x1ff14a=this;return new Promise(function(_0x4dc593,_0x534386){if(ami[_0x0a94('0x12')]()==![]){return _0x534386(_0x1ff14a['error'](0x1f4,[config['asterisk']['ip'],config[_0x0a94('0x14')][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x490ded=schema(properties[_0x0a94('0x5a')])[_0x0a94('0x5b')](_0x16e2b2);if(_0x490ded[_0x0a94('0x58')]>0x0){return _0x534386(_0x1ff14a[_0x0a94('0x13')](0x1f4,_[_0x0a94('0x5c')](_0x490ded,'message')[_0x0a94('0x16')](',\x20')));}var _0x6bcd28=_[_0x0a94('0x5d')](_0x5c71ba['channels'],{'uniqueid':_0x16e2b2[_0x0a94('0x5e')]});if(_0x6bcd28&&_0x6bcd28[_0x0a94('0x5f')]){var _0x2ab01d=util[_0x0a94('0x8')]('%s.%s',_0x16e2b2['filename']||_0x16e2b2['uniqueid'],_0x16e2b2[_0x0a94('0x8')]||'wav');return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x60'),'channel':_0x6bcd28[_0x0a94('0x5f')],'file':_0x2ab01d,'options':_0x0a94('0x61')})['then'](function(_0x1a5bbb){var _0x4270ab=_[_0x0a94('0x5d')](_0x6bcd28['monitors'],{'filename':_0x0a94('0x62')+_0x2ab01d['toLowerCase']()});if(_['isNil'](_0x4270ab)){_0x6bcd28['monitors'][_0x0a94('0x56')]({'filename':_0x0a94('0x62')+_0x2ab01d[_0x0a94('0x63')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1a5bbb['mixmonitorid'],'status':'rec'});}else{_0x4270ab[_0x0a94('0x64')]=_0x1a5bbb[_0x0a94('0x64')];_0x4270ab[_0x0a94('0x65')]=_0x0a94('0x66');}_0x4dc593({'code':0xc8,'message':[_0x16e2b2['uniqueid'],_0x0a94('0x67'),_0x1a5bbb[_0x0a94('0x64')]][_0x0a94('0x16')]('\x20'),'mixmonitorid':_0x1a5bbb[_0x0a94('0x64')]});})[_0x0a94('0x1c')](function(_0x335a25){_0x534386(_0x1ff14a[_0x0a94('0x13')](0x1f5,[_0x16e2b2[_0x0a94('0x5e')],_0x335a25[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x534386(_0x1ff14a['error'](0x1f5,_0x0a94('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x43c1e9){var _0x56cb6c=this;return new Promise(function(_0x56f8ab,_0x52d237){if(ami[_0x0a94('0x12')]()==![]){return _0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config['asterisk'][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x51a299=schema(properties[_0x0a94('0x5a')])[_0x0a94('0x5b')](_0x43c1e9);if(_0x51a299['length']>0x0){return _0x52d237(_0x56cb6c['error'](0x1f4,_[_0x0a94('0x5c')](_0x51a299,_0x0a94('0x1d'))['join'](',\x20')));}var _0x30527b=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x69')],{'uniqueid':_0x43c1e9[_0x0a94('0x5e')]});if(_0x30527b){return BPromise['resolve']()[_0x0a94('0x20')](function(){if(_0x30527b['channel']){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x6a'),'channel':_0x30527b['channel'],'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]})[_0x0a94('0x1c')](function(_0x44417a){});}})[_0x0a94('0x20')](function(){if(_0x30527b[_0x0a94('0x6b')]){return ami['Action']({'action':_0x0a94('0x6a'),'channel':_0x30527b['destinationchannel'],'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]})[_0x0a94('0x1c')](function(_0x509291){});}})[_0x0a94('0x20')](function(_0x1bb87a){var _0x10aa82=_[_0x0a94('0x5d')](_0x30527b['monitors'],{'mixmonitorid':_0x43c1e9[_0x0a94('0x64')]});if(_0x10aa82){_0x10aa82[_0x0a94('0x65')]=_0x0a94('0x6c');}})[_0x0a94('0x20')](function(){var _0x22b3ae=util[_0x0a94('0x8')](_0x0a94('0x6d'),_0x43c1e9[_0x0a94('0x6e')]||_0x43c1e9[_0x0a94('0x5e')],_0x43c1e9[_0x0a94('0x8')]||_0x0a94('0x6f'));var _0x3340ec=_['find'](_0x30527b[_0x0a94('0x70')],{'filename':_0x0a94('0x62')+_0x22b3ae[_0x0a94('0x63')]()});if(_0x3340ec){_0x3340ec[_0x0a94('0x65')]=_0x0a94('0x6c');}})[_0x0a94('0x20')](function(){_0x56f8ab({'code':0xc8,'message':[_0x43c1e9[_0x0a94('0x5e')],_0x0a94('0x71')][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x3edb16){_0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f5,[_0x43c1e9[_0x0a94('0x5e')],_0x3edb16[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x52d237(_0x56cb6c[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannels':function(_0x116d3a){return new Promise(function(_0x446863,_0x1eded9){var _0x4393b8=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x72')]);_0x446863({'count':_0x4393b8[_0x0a94('0x58')],'rows':_0x4393b8});});},'VoiceQueuesChannel':function(_0x2a93d9){var _0x3e9f1=this;return new Promise(function(_0x3eaf61,_0x42d14d){var _0x57e086=schema(properties[_0x0a94('0x73')])[_0x0a94('0x5b')](_0x2a93d9);if(_0x57e086['length']>0x0){return _0x42d14d(_0x3e9f1[_0x0a94('0x13')](0x1f4,_[_0x0a94('0x5c')](_0x57e086,_0x0a94('0x1d'))[_0x0a94('0x16')](',\x20')));}var _0x236dad=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x72')],{'uniqueid':_0x2a93d9['uniqueid']});if(_0x236dad){_0x3eaf61(_0x236dad);}else{return _0x42d14d(_0x3e9f1['error'](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x4efc62){var _0x3a42ec=this;return new Promise(function(_0x1b51d4,_0x4e271a){if(ami[_0x0a94('0x12')]()==![]){return _0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f4,[config[_0x0a94('0x14')]['ip'],config[_0x0a94('0x14')][_0x0a94('0x59')],_0x0a94('0x15')]['join']('\x20')));}var _0x244d00=schema(properties[_0x0a94('0x74')])[_0x0a94('0x5b')](_0x4efc62);if(_0x244d00[_0x0a94('0x58')]>0x0){return _0x4e271a(_0x3a42ec['error'](0x1f4,_[_0x0a94('0x5c')](_0x244d00,_0x0a94('0x1d'))[_0x0a94('0x16')](',\x20')));}var _0x2f4e24=_[_0x0a94('0x5d')](_0x5c71ba[_0x0a94('0x72')],{'uniqueid':_0x4efc62['uniqueid']});if(_0x2f4e24&&_0x2f4e24[_0x0a94('0x5f')]){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x75'),'channel':_0x2f4e24[_0x0a94('0x5f')]})[_0x0a94('0x20')](function(_0x12d7cc){_0x1b51d4({'code':0xc8,'message':[_0x4efc62[_0x0a94('0x5e')],_0x12d7cc['message'][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x156174){_0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f5,[_0x4efc62[_0x0a94('0x5e')],_0x156174[_0x0a94('0x1d')][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')));});}else{return _0x4e271a(_0x3a42ec[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x54ce65){var _0x1f6788=this;return new Promise(function(_0x22e9dd,_0x3cd5cc){if(ami[_0x0a94('0x12')]()==![]){return _0x3cd5cc(_0x1f6788['error'](0x1f4,[config[_0x0a94('0x14')]['ip'],config['asterisk'][_0x0a94('0x59')],_0x0a94('0x15')][_0x0a94('0x16')]('\x20')));}var _0x311d90=schema(properties['voicequeuechannelredirect'])[_0x0a94('0x5b')](_0x54ce65);if(_0x311d90[_0x0a94('0x58')]>0x0){return _0x3cd5cc(_0x1f6788['error'](0x1f4,_[_0x0a94('0x5c')](_0x311d90,'message')[_0x0a94('0x16')](',\x20')));}var _0x33b8bb=_[_0x0a94('0x5d')](_0x5c71ba['queueChannels'],{'uniqueid':_0x54ce65[_0x0a94('0x5e')]});if(_0x33b8bb&&_0x33b8bb['channel']){return ami[_0x0a94('0x1b')]({'action':_0x0a94('0x76'),'channel':_0x33b8bb[_0x0a94('0x5f')],'exten':_0x54ce65[_0x0a94('0x77')],'context':_0x54ce65[_0x0a94('0x78')]||_0x33b8bb['context'],'priority':0x1})[_0x0a94('0x20')](function(_0xadb74){_0x22e9dd({'code':0xc8,'message':[_0x54ce65[_0x0a94('0x5e')],_0xadb74['message'][_0x0a94('0x63')]()][_0x0a94('0x16')]('\x20')});})[_0x0a94('0x1c')](function(_0x375a2f){_0x3cd5cc(_0x1f6788[_0x0a94('0x13')](0x1f5,[_0x54ce65[_0x0a94('0x5e')],_0x375a2f['message']['toLowerCase']()][_0x0a94('0x16')]('\x20')));});}else{return _0x3cd5cc(_0x1f6788[_0x0a94('0x13')](0x1f5,_0x0a94('0x68')));}});},'Agents':function(_0x518d9c){return new Promise(function(_0x3929ef,_0x53b720){var _0x52a107=_['values'](_0x5c71ba['agents']);_0x3929ef({'count':_0x52a107[_0x0a94('0x58')],'rows':_0x52a107});});},'Telephones':function(_0x2ffe7b){return new Promise(function(_0x343091,_0x302b18){var _0x579db2=_[_0x0a94('0x57')](_0x5c71ba['telephones']);_0x343091({'count':_0x579db2[_0x0a94('0x58')],'rows':_0x579db2});});},'Trunks':function(_0x15d0e8){return new Promise(function(_0x2e2d95,_0x43fa09){var _0x3d854a=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x79')]);_0x2e2d95({'count':_0x3d854a[_0x0a94('0x58')],'rows':_0x3d854a});});},'OutboundChannels':function(_0x4fa7b7){return new Promise(function(_0x1e5b4a,_0x2255f0){var _0x1603ef=_['values'](_0x5c71ba[_0x0a94('0x7a')]);_0x1e5b4a({'count':_0x1603ef[_0x0a94('0x58')],'rows':_0x1603ef});});},'Outbound':function(_0x335cae){return new Promise(function(_0x284023,_0x168504){_0x284023(_0x5c71ba[_0x0a94('0x30')]);});},'Campaigns':function(_0x1c7ef9){return new Promise(function(_0x58013d,_0x4263a7){var _0x4b8760=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x7b')]);_0x58013d({'count':_0x4b8760[_0x0a94('0x58')],'rows':_0x4b8760});});},'VoiceQueuesPreview':function(_0x24a013){var _0x132925=this;return new Promise(function(_0x42b732,_0x1613c3){_0x399c79['run'](_0x24a013['id'])['then'](function(_0x57141c){_0x42b732({'code':0xc8,'message':_0x57141c[_0x0a94('0x1d')]});})['catch'](function(_0x25def4){_0x1613c3(_0x132925[_0x0a94('0x13')](0x1f4,_0x25def4[_0x0a94('0x1d')]));});});},'EventManager':function(_0xf3eeee){var _0x44db62=this;return new Promise(function(_0x33c145,_0x293df8){if(!_0xf3eeee[_0x0a94('0x7c')]){return _0x293df8(_0x44db62[_0x0a94('0x13')](0x1f4,_0x0a94('0x7d')));}ami[_0x0a94('0x7e')](_0x0a94('0x7f')+_0xf3eeee[_0x0a94('0x7c')],_0xf3eeee[_0x0a94('0x1d')]);_0x33c145({'code':0xc8,'message':_0xf3eeee});});},'FaxAccounts':function(_0xd58108){return new Promise(function(_0x5bb1d5,_0x443c6c){var _0x33e133=_[_0x0a94('0x57')](_0x5c71ba[_0x0a94('0x80')]);_0x5bb1d5({'count':_0x33e133[_0x0a94('0x58')],'rows':_0x33e133});});},'SendFax':function(_0x276233){var _0x67976c=this;return new Promise(function(_0x30abf9,_0x19b0b9){_0x3c1e1b[_0x0a94('0x81')](_0x276233)['then'](function(_0x8db910){_0x30abf9({'code':0xc8,'message':_0x8db910['message']});})[_0x0a94('0x1c')](function(_0x42c826){_0x19b0b9(_0x67976c[_0x0a94('0x13')](0x1f4,_0x42c826['message']));});});},'CheckAfterSend':function(_0x10cdf7){var _0x4ea5d6=this;return new Promise(function(_0x17bd9c,_0x3fc3c6){_0x3c1e1b[_0x0a94('0x82')](_0x10cdf7)[_0x0a94('0x20')](function(_0x5f560f){_0x17bd9c({'code':0xc8,'message':_0x5f560f[_0x0a94('0x1d')]});})[_0x0a94('0x1c')](function(_0x158149){_0x3fc3c6(_0x4ea5d6[_0x0a94('0x13')](0x1f4,_0x158149['message']));});});}};var _0x8f037=jayson[_0x0a94('0x83')](_0x50ea05)['http']();_0x8f037['on'](_0x0a94('0x13'),function(_0x5e03c9){return _0x2f6b77(_0x5e03c9);});_0x8f037[_0x0a94('0x7')](0x232a,_0x0a94('0x84'),function(){console[_0x0a94('0x85')](_0x0a94('0x86'),0x232a);return _0x4a103c('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x18b9=['voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','values','channels','length','voicechannel','map','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','then','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','uniqueid','Channel\x20doesn\x27t\x20exist','find','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Action','message','catch','command','Command','content'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0x18b9,0x17d));var _0x918b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x18b9[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x918b('0x0'));var util=require(_0x918b('0x1'));var jayson=require(_0x918b('0x2'));var schema=require(_0x918b('0x3'));var BPromise=require(_0x918b('0x4'));var moment=require(_0x918b('0x5'));var config=require('../../../config/environment');var properties=require(_0x918b('0x6'));var ami=require(_0x918b('0x7'));exports[_0x918b('0x8')]=function(_0x2eb85e,_0xe7ab98,_0xd346c5){return new BPromise(function(_0x2d98bd,_0x39f13f){var _0x34a7f7={'QueuePause':function(_0x34ce4b){return new Promise(function(_0x54aa3a,_0x21b65e){var _0x117739=util['format']('%s/%s','SIP',_0x34ce4b['name']);if(_0x2eb85e[_0x918b('0x9')]&&_0x2eb85e[_0x918b('0x9')][_0x117739]&&_0x2eb85e[_0x918b('0x9')][_0x117739][_0x918b('0xa')]){_0x2eb85e[_0x918b('0x9')][_0x117739][_0x918b('0xb')]();}if(_0x2eb85e['agents'][_0x117739]){_0x2eb85e[_0x918b('0xc')][_0x117739][_0x918b('0xd')]({'statePause':_0x34ce4b['pause']?!![]:![]});}_0x54aa3a({'code':0xc8,'message':_0x918b('0xe')});});},'Reload':function(_0x4adcad){var _0x579aa0=this;return new Promise(function(_0x4ad990,_0x54a788){if(ami[_0x918b('0xf')]()==![]){return _0x54a788(_0x579aa0[_0x918b('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x918b('0x11')][_0x918b('0x12')],_0x918b('0x13')][_0x918b('0x14')]('\x20')));}_0x4adcad=_[_0x918b('0x15')](_0x4adcad,_['keys'](properties[_0x918b('0x16')]));_0x4adcad[_0x918b('0x17')]='Reload';return ami[_0x918b('0x18')](_0x4adcad)['then'](function(_0x687959){_0x4ad990({'code':0xc8,'message':_0x687959[_0x918b('0x19')]});})[_0x918b('0x1a')](function(_0x5e3159){_0x54a788(_0x579aa0[_0x918b('0x10')](0x1f5,_0x5e3159[_0x918b('0x19')]));});});},'Command':function(_0x577995){var _0x956bf7=this;return new Promise(function(_0x2d09ab,_0x176fbe){if(ami[_0x918b('0xf')]()==![]){return _0x176fbe(_0x956bf7[_0x918b('0x10')](0x1f4,[config[_0x918b('0x11')]['ip'],config[_0x918b('0x11')][_0x918b('0x12')],'ami\x20disconnected'][_0x918b('0x14')]('\x20')));}_0x577995=_[_0x918b('0x15')](_0x577995,_0x918b('0x1b'));_0x577995[_0x918b('0x17')]=_0x918b('0x1c');return ami[_0x918b('0x18')](_0x577995)['then'](function(_0x1fc3d5){_0x2d09ab({'code':0xc8,'message':_0x1fc3d5[_0x918b('0x1d')]});})[_0x918b('0x1a')](function(_0x4b31a1){_0x176fbe(_0x956bf7[_0x918b('0x10')](0x1f5,_0x4b31a1[_0x918b('0x19')]));});});},'VoiceQueues':function(_0x3ecc99){return new Promise(function(_0x4157ba,_0x230913){var _0x1ff714=[];for(var _0x3005df in _0x2eb85e['voiceQueues']){if(_0x2eb85e[_0x918b('0x1e')][_0x918b('0x1f')](_0x3005df)){var _0x101e4b=_0x2eb85e[_0x918b('0x1e')][_0x3005df];var _0x49392e={'id':_0x101e4b['id'],'name':_0x101e4b[_0x918b('0x20')],'strategy':_0x101e4b[_0x918b('0x21')],'answered':_0x101e4b[_0x918b('0x22')],'available':_0x101e4b[_0x918b('0x23')],'loggedIn':_0x101e4b[_0x918b('0x24')],'pTalking':_0x101e4b[_0x918b('0x25')],'sumBillable':_0x101e4b[_0x918b('0x26')],'sumDuration':_0x101e4b[_0x918b('0x27')],'sumHoldTime':_0x101e4b[_0x918b('0x28')]||0x0,'talking':_0x101e4b['talking'],'total':_0x101e4b[_0x918b('0x29')],'type':_0x101e4b[_0x918b('0x2a')],'unmanaged':_0x101e4b[_0x918b('0x2b')],'abandoned':_0x101e4b[_0x918b('0x2c')],'waiting':_0x101e4b['waiting'],'loggedInDb':_0x101e4b[_0x918b('0x2d')]};if(_0x101e4b[_0x918b('0x2a')]===_0x918b('0x2e')){_0x49392e[_0x918b('0x2f')]=_0x101e4b[_0x918b('0x2f')];_0x49392e[_0x918b('0x30')]=_0x101e4b[_0x918b('0x30')];_0x49392e[_0x918b('0x31')]=_0x101e4b[_0x918b('0x31')];_0x49392e['dialOriginateCallerIdNumber']=_0x101e4b[_0x918b('0x32')];_0x49392e[_0x918b('0x33')]=_0x101e4b[_0x918b('0x33')];_0x49392e[_0x918b('0x34')]=_0x101e4b[_0x918b('0x34')];_0x49392e[_0x918b('0x35')]=_0x101e4b['outboundAnswerAgiCallsDay'];_0x49392e['outboundAnswerCallsDay']=_0x101e4b[_0x918b('0x36')];_0x49392e[_0x918b('0x37')]=_0x101e4b['outboundBlacklistCallsDay'];_0x49392e[_0x918b('0x38')]=_0x101e4b['outboundBusyCallsDay'];_0x49392e[_0x918b('0x39')]=_0x101e4b['outboundCongestionCallsDay'];_0x49392e[_0x918b('0x3a')]=_0x101e4b['outboundDropCallsDayACS'];_0x49392e[_0x918b('0x3b')]=_0x101e4b[_0x918b('0x3b')];_0x49392e[_0x918b('0x3c')]=_0x101e4b[_0x918b('0x3c')];_0x49392e[_0x918b('0x3d')]=_0x101e4b[_0x918b('0x3d')];_0x49392e[_0x918b('0x3e')]=_0x101e4b['outboundNoSuchCallsDay'];_0x49392e[_0x918b('0x3f')]=_0x101e4b['outboundOriginateFailureCallsDay'];_0x49392e['outboundReCallsDay']=_0x101e4b[_0x918b('0x40')];_0x49392e[_0x918b('0x41')]=_0x101e4b[_0x918b('0x41')];_0x49392e[_0x918b('0x42')]=_0x101e4b[_0x918b('0x42')];_0x49392e[_0x918b('0x43')]=_0x101e4b[_0x918b('0x43')];_0x49392e[_0x918b('0x44')]=_0x101e4b[_0x918b('0x44')];_0x49392e['predictiveIntervalAvgTalktime']=_0x101e4b[_0x918b('0x45')];_0x49392e['predictiveIntervalDroppedCallsCallersExit']=_0x101e4b[_0x918b('0x46')];_0x49392e[_0x918b('0x47')]=_0x101e4b[_0x918b('0x47')];_0x49392e['predictiveIntervalErlangCalls']=_0x101e4b[_0x918b('0x48')];_0x49392e[_0x918b('0x49')]=_0x101e4b[_0x918b('0x49')];_0x49392e[_0x918b('0x4a')]=_0x101e4b['predictiveIntervalHitRate'];_0x49392e['predictiveIntervalMultiplicativeFactor']=_0x101e4b['predictiveIntervalMultiplicativeFactor'];_0x49392e['predictiveIntervalPauses']=_0x101e4b[_0x918b('0x4b')];_0x49392e['predictiveIntervalAvailable']=_0x101e4b[_0x918b('0x4c')];_0x49392e['predictiveIntervalTotalCalls']=_0x101e4b['predictiveIntervalTotalCalls'];_0x49392e[_0x918b('0x19')]=_0x101e4b[_0x918b('0x19')];_0x49392e['originated']=_0x101e4b['originated'];_0x49392e['erlangCalls']=_0x101e4b[_0x918b('0x4d')];_0x49392e[_0x918b('0x4e')]=_0x101e4b[_0x918b('0x4e')];_0x49392e[_0x918b('0x4f')]=_0x101e4b[_0x918b('0x4f')];_0x49392e[_0x918b('0x50')]=_0x101e4b['erlangBusyFactor'];_0x49392e[_0x918b('0x51')]=_0x101e4b[_0x918b('0x51')];_0x49392e[_0x918b('0x52')]=_0x101e4b[_0x918b('0x52')];}if(_0x101e4b['Trunk']){_0x49392e[_0x918b('0x53')]={'id':_0x101e4b[_0x918b('0x53')]['id'],'name':_0x101e4b[_0x918b('0x53')][_0x918b('0x20')],'active':_0x101e4b[_0x918b('0x53')][_0x918b('0x54')],'callerid':_0x101e4b[_0x918b('0x53')]['callerid']};}if(_0x101e4b['Interval']){_0x49392e[_0x918b('0x55')]={'id':_0x101e4b[_0x918b('0x55')]['id'],'name':_0x101e4b[_0x918b('0x55')][_0x918b('0x20')]};}_0x1ff714[_0x918b('0x56')](_0x49392e);}}_0x4157ba({'count':_0x1ff714['length'],'rows':_0x1ff714});});},'VoiceChannels':function(_0x157daa){return new Promise(function(_0x23eeca,_0x4d04da){var _0x2481e9=_[_0x918b('0x57')](_0x2eb85e[_0x918b('0x58')]);_0x23eeca({'count':_0x2481e9[_0x918b('0x59')],'rows':_0x2481e9});});},'VoiceChannelMixMonitor':function(_0x266dd6){var _0x58dec9=this;return new Promise(function(_0x562c3e,_0x3b3f97){if(ami[_0x918b('0xf')]()==![]){return _0x3b3f97(_0x58dec9[_0x918b('0x10')](0x1f4,[config[_0x918b('0x11')]['ip'],config[_0x918b('0x11')]['username'],_0x918b('0x13')][_0x918b('0x14')]('\x20')));}var _0x2703fe=schema(properties[_0x918b('0x5a')])['validate'](_0x266dd6);if(_0x2703fe[_0x918b('0x59')]>0x0){return _0x3b3f97(_0x58dec9[_0x918b('0x10')](0x1f4,_[_0x918b('0x5b')](_0x2703fe,_0x918b('0x19'))['join'](',\x20')));}var _0x1591cb=_['find'](_0x2eb85e[_0x918b('0x58')],{'uniqueid':_0x266dd6['uniqueid']});if(_0x1591cb&&_0x1591cb[_0x918b('0x5c')]){var _0x686bb2=util[_0x918b('0x5d')](_0x918b('0x5e'),_0x266dd6[_0x918b('0x5f')]||_0x266dd6['uniqueid'],_0x266dd6[_0x918b('0x5d')]||_0x918b('0x60'));return ami['Action']({'action':_0x918b('0x61'),'channel':_0x1591cb[_0x918b('0x5c')],'file':_0x686bb2,'options':_0x918b('0x62')})[_0x918b('0x63')](function(_0x3474de){var _0x411f79=_['find'](_0x1591cb[_0x918b('0x64')],{'filename':_0x918b('0x65')+_0x686bb2[_0x918b('0x66')]()});if(_[_0x918b('0x67')](_0x411f79)){_0x1591cb[_0x918b('0x64')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0x686bb2[_0x918b('0x66')](),'createdAt':moment()[_0x918b('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3474de[_0x918b('0x68')],'status':_0x918b('0x69')});}else{_0x411f79[_0x918b('0x68')]=_0x3474de[_0x918b('0x68')];_0x411f79[_0x918b('0x6a')]=_0x918b('0x69');}_0x562c3e({'code':0xc8,'message':[_0x266dd6[_0x918b('0x6b')],'MixMonitor\x20Success',_0x3474de[_0x918b('0x68')]]['join']('\x20'),'mixmonitorid':_0x3474de[_0x918b('0x68')]});})[_0x918b('0x1a')](function(_0x645012){_0x3b3f97(_0x58dec9[_0x918b('0x10')](0x1f5,[_0x266dd6['uniqueid'],_0x645012[_0x918b('0x19')][_0x918b('0x66')]()]['join']('\x20')));});}else{return _0x3b3f97(_0x58dec9[_0x918b('0x10')](0x1f5,_0x918b('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x279d23){var _0x52e93f=this;return new Promise(function(_0x5579b1,_0x6694b){if(ami['isConnected']()==![]){return _0x6694b(_0x52e93f[_0x918b('0x10')](0x1f4,[config[_0x918b('0x11')]['ip'],config[_0x918b('0x11')][_0x918b('0x12')],_0x918b('0x13')][_0x918b('0x14')]('\x20')));}var _0x1c4569=schema(properties['voicechannel'])['validate'](_0x279d23);if(_0x1c4569[_0x918b('0x59')]>0x0){return _0x6694b(_0x52e93f[_0x918b('0x10')](0x1f4,_[_0x918b('0x5b')](_0x1c4569,_0x918b('0x19'))['join'](',\x20')));}var _0x5b57f9=_[_0x918b('0x6d')](_0x2eb85e[_0x918b('0x58')],{'uniqueid':_0x279d23['uniqueid']});if(_0x5b57f9){return BPromise[_0x918b('0x6e')]()[_0x918b('0x63')](function(){if(_0x5b57f9[_0x918b('0x5c')]){return ami['Action']({'action':_0x918b('0x6f'),'channel':_0x5b57f9[_0x918b('0x5c')],'mixmonitorid':_0x279d23['mixmonitorid']})['catch'](function(_0x5db70c){});}})['then'](function(){if(_0x5b57f9[_0x918b('0x70')]){return ami[_0x918b('0x18')]({'action':_0x918b('0x6f'),'channel':_0x5b57f9[_0x918b('0x70')],'mixmonitorid':_0x279d23[_0x918b('0x68')]})[_0x918b('0x1a')](function(_0x4b8a6e){});}})['then'](function(_0x232951){var _0x41a2a8=_[_0x918b('0x6d')](_0x5b57f9[_0x918b('0x64')],{'mixmonitorid':_0x279d23[_0x918b('0x68')]});if(_0x41a2a8){_0x41a2a8[_0x918b('0x6a')]='stop';}})['then'](function(){var _0x5dc154=util['format'](_0x918b('0x5e'),_0x279d23[_0x918b('0x5f')]||_0x279d23[_0x918b('0x6b')],_0x279d23[_0x918b('0x5d')]||_0x918b('0x60'));var _0x7514ce=_[_0x918b('0x6d')](_0x5b57f9[_0x918b('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x5dc154['toLowerCase']()});if(_0x7514ce){_0x7514ce[_0x918b('0x6a')]=_0x918b('0x71');}})[_0x918b('0x63')](function(){_0x5579b1({'code':0xc8,'message':[_0x279d23[_0x918b('0x6b')],_0x918b('0x72')][_0x918b('0x14')]('\x20')});})['catch'](function(_0x305500){_0x6694b(_0x52e93f[_0x918b('0x10')](0x1f5,[_0x279d23['uniqueid'],_0x305500[_0x918b('0x19')]['toLowerCase']()][_0x918b('0x14')]('\x20')));});}else{return _0x6694b(_0x52e93f['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xb42c6b){return new Promise(function(_0xae7875,_0x12293b){var _0xfe6b65=_['values'](_0x2eb85e[_0x918b('0x73')]);_0xae7875({'count':_0xfe6b65[_0x918b('0x59')],'rows':_0xfe6b65});});},'VoiceQueuesChannel':function(_0xe5c46d){var _0x4f33cd=this;return new Promise(function(_0x437b91,_0x58f39f){var _0x4d115a=schema(properties[_0x918b('0x74')])[_0x918b('0x3')](_0xe5c46d);if(_0x4d115a[_0x918b('0x59')]>0x0){return _0x58f39f(_0x4f33cd['error'](0x1f4,_['map'](_0x4d115a,_0x918b('0x19'))['join'](',\x20')));}var _0x243cfc=_[_0x918b('0x6d')](_0x2eb85e[_0x918b('0x73')],{'uniqueid':_0xe5c46d['uniqueid']});if(_0x243cfc){_0x437b91(_0x243cfc);}else{return _0x58f39f(_0x4f33cd[_0x918b('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0xc8a421){var _0x5168e8=this;return new Promise(function(_0x446c9a,_0x5ac913){if(ami[_0x918b('0xf')]()==![]){return _0x5ac913(_0x5168e8['error'](0x1f4,[config[_0x918b('0x11')]['ip'],config[_0x918b('0x11')][_0x918b('0x12')],_0x918b('0x13')][_0x918b('0x14')]('\x20')));}var _0x6c6e69=schema(properties[_0x918b('0x75')])[_0x918b('0x3')](_0xc8a421);if(_0x6c6e69[_0x918b('0x59')]>0x0){return _0x5ac913(_0x5168e8[_0x918b('0x10')](0x1f4,_['map'](_0x6c6e69,_0x918b('0x19'))['join'](',\x20')));}var _0x21984f=_['find'](_0x2eb85e[_0x918b('0x73')],{'uniqueid':_0xc8a421['uniqueid']});if(_0x21984f&&_0x21984f['channel']){return ami[_0x918b('0x18')]({'action':'Hangup','channel':_0x21984f[_0x918b('0x5c')]})[_0x918b('0x63')](function(_0x558910){_0x446c9a({'code':0xc8,'message':[_0xc8a421[_0x918b('0x6b')],_0x558910['message'][_0x918b('0x66')]()][_0x918b('0x14')]('\x20')});})[_0x918b('0x1a')](function(_0x27c4ba){_0x5ac913(_0x5168e8[_0x918b('0x10')](0x1f5,[_0xc8a421['uniqueid'],_0x27c4ba[_0x918b('0x19')][_0x918b('0x66')]()][_0x918b('0x14')]('\x20')));});}else{return _0x5ac913(_0x5168e8[_0x918b('0x10')](0x1f5,_0x918b('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x59cadb){var _0x22cd08=this;return new Promise(function(_0x350007,_0x3a08da){if(ami[_0x918b('0xf')]()==![]){return _0x3a08da(_0x22cd08[_0x918b('0x10')](0x1f4,[config[_0x918b('0x11')]['ip'],config[_0x918b('0x11')][_0x918b('0x12')],'ami\x20disconnected'][_0x918b('0x14')]('\x20')));}var _0x59201e=schema(properties[_0x918b('0x76')])[_0x918b('0x3')](_0x59cadb);if(_0x59201e[_0x918b('0x59')]>0x0){return _0x3a08da(_0x22cd08['error'](0x1f4,_[_0x918b('0x5b')](_0x59201e,_0x918b('0x19'))[_0x918b('0x14')](',\x20')));}var _0x110c53=_[_0x918b('0x6d')](_0x2eb85e[_0x918b('0x73')],{'uniqueid':_0x59cadb['uniqueid']});if(_0x110c53&&_0x110c53[_0x918b('0x5c')]){return ami[_0x918b('0x18')]({'action':'Redirect','channel':_0x110c53['channel'],'exten':_0x59cadb[_0x918b('0x77')],'context':_0x59cadb[_0x918b('0x78')]||_0x110c53[_0x918b('0x78')],'priority':0x1})[_0x918b('0x63')](function(_0x5d9c2b){_0x350007({'code':0xc8,'message':[_0x59cadb[_0x918b('0x6b')],_0x5d9c2b['message'][_0x918b('0x66')]()]['join']('\x20')});})[_0x918b('0x1a')](function(_0xed6163){_0x3a08da(_0x22cd08[_0x918b('0x10')](0x1f5,[_0x59cadb['uniqueid'],_0xed6163['message'][_0x918b('0x66')]()]['join']('\x20')));});}else{return _0x3a08da(_0x22cd08[_0x918b('0x10')](0x1f5,_0x918b('0x6c')));}});},'Agents':function(_0x11c0e0){return new Promise(function(_0x2e63ad,_0x4009c9){var _0x2444c2=_[_0x918b('0x57')](_0x2eb85e['agents']);_0x2e63ad({'count':_0x2444c2[_0x918b('0x59')],'rows':_0x2444c2});});},'Telephones':function(_0x418918){return new Promise(function(_0x4bbe0e,_0x3a3dec){var _0x3551fc=_[_0x918b('0x57')](_0x2eb85e[_0x918b('0x79')]);_0x4bbe0e({'count':_0x3551fc[_0x918b('0x59')],'rows':_0x3551fc});});},'Trunks':function(_0xf82244){return new Promise(function(_0x1dfbe6,_0x2dea0f){var _0xf00554=_[_0x918b('0x57')](_0x2eb85e[_0x918b('0x7a')]);_0x1dfbe6({'count':_0xf00554[_0x918b('0x59')],'rows':_0xf00554});});},'OutboundChannels':function(_0x8423f5){return new Promise(function(_0x19a7f5,_0x1d3588){var _0x1e9d0d=_['values'](_0x2eb85e[_0x918b('0x7b')]);_0x19a7f5({'count':_0x1e9d0d[_0x918b('0x59')],'rows':_0x1e9d0d});});},'Outbound':function(_0x186ed3){return new Promise(function(_0x3278b7,_0x482505){_0x3278b7(_0x2eb85e[_0x918b('0x2e')]);});},'Campaigns':function(_0x5e2fe1){return new Promise(function(_0x3771b4,_0x2ce987){var _0x4e4416=_[_0x918b('0x57')](_0x2eb85e['campaigns']);_0x3771b4({'count':_0x4e4416['length'],'rows':_0x4e4416});});},'VoiceQueuesPreview':function(_0x59a30d){var _0x2d2dea=this;return new Promise(function(_0x3b06a1,_0x3fd018){_0xe7ab98[_0x918b('0x7c')](_0x59a30d['id'])['then'](function(_0x4672dc){_0x3b06a1({'code':0xc8,'message':_0x4672dc[_0x918b('0x19')]});})['catch'](function(_0x478361){_0x3fd018(_0x2d2dea['error'](0x1f4,_0x478361[_0x918b('0x19')]));});});},'EventManager':function(_0x2243b9){var _0x1965b6=this;return new Promise(function(_0xa1973a,_0x2f1f52){if(!_0x2243b9[_0x918b('0x7d')]){return _0x2f1f52(_0x1965b6['error'](0x1f4,_0x918b('0x7e')));}ami[_0x918b('0x7f')](_0x918b('0x80')+_0x2243b9['event'],_0x2243b9[_0x918b('0x19')]);_0xa1973a({'code':0xc8,'message':_0x2243b9});});},'FaxAccounts':function(_0x1a28a1){return new Promise(function(_0x1ced17,_0x160484){var _0x4b7663=_[_0x918b('0x57')](_0x2eb85e[_0x918b('0x81')]);_0x1ced17({'count':_0x4b7663[_0x918b('0x59')],'rows':_0x4b7663});});},'SendFax':function(_0x2a3219){var _0x116791=this;return new Promise(function(_0x54a978,_0xcf7ab3){_0xd346c5[_0x918b('0x82')](_0x2a3219)['then'](function(_0x56f7b7){_0x54a978({'code':0xc8,'message':_0x56f7b7['message']});})[_0x918b('0x1a')](function(_0x6db7ad){_0xcf7ab3(_0x116791[_0x918b('0x10')](0x1f4,_0x6db7ad[_0x918b('0x19')]));});});},'CheckAfterSend':function(_0x517915){var _0x500a32=this;return new Promise(function(_0x2e098d,_0x3dcc1d){_0xd346c5['checkAfterSend'](_0x517915)[_0x918b('0x63')](function(_0x219157){_0x2e098d({'code':0xc8,'message':_0x219157['message']});})[_0x918b('0x1a')](function(_0x51e908){_0x3dcc1d(_0x500a32[_0x918b('0x10')](0x1f4,_0x51e908[_0x918b('0x19')]));});});}};var _0x22fce7=jayson[_0x918b('0x83')](_0x34a7f7)[_0x918b('0x84')]();_0x22fce7['on'](_0x918b('0x10'),function(_0x2ef7e9){return _0x39f13f(_0x2ef7e9);});_0x22fce7[_0x918b('0x8')](0x232a,_0x918b('0x85'),function(){console[_0x918b('0x86')](_0x918b('0x87'),0x232a);return _0x2d98bd(_0x918b('0x88')+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 3443fbd..e080587 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 _0xf3f9=['ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','autoCreate','data2','data1','calleridnum','isNil','routeId','firstName','calleridname','destcalleridname','','destcalleridnum','uniqueid','then','omit','[%s][%s]\x20Contact\x20found:%s','format','name','action','toLowerCase','resolve','createContact','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','user:%s','trigger:%s','merge','catch','[%s][%s]\x20Error\x20creating\x20contact','bluebird','util'];(function(_0x129f47,_0x2d4e0c){var _0xcaf42a=function(_0x46a26d){while(--_0x46a26d){_0x129f47['push'](_0x129f47['shift']());}};_0xcaf42a(++_0x2d4e0c);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x1b53ba,_0x1f33ec){_0x1b53ba=_0x1b53ba-0x0;var _0x52b28f=_0xf3f9[_0x1b53ba];return _0x52b28f;};'use strict';var BPromise=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var _=require('lodash');var Redis=require(_0x9f3f('0x2'));var config=require(_0x9f3f('0x3'));var logger=require(_0x9f3f('0x4'))(_0x9f3f('0x5'));var cmContactRpc=require(_0x9f3f('0x6'));config[_0x9f3f('0x7')]=_[_0x9f3f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9f3f('0x9'))(new Redis(config['redis']));function emit(_0x17b150,_0x4a9a17,_0x373b80,_0xa6b3ae){logger[_0x9f3f('0xa')]('[%s][%s]',_0x17b150,'',_0x4a9a17,_0x373b80,JSON[_0x9f3f('0xb')](_0xa6b3ae));io['to'](_0x4a9a17)['emit'](_0x373b80,_0xa6b3ae);}exports['exec']=function(_0x5add2e,_0x52806e,_0x435966){_0x435966[_0x9f3f('0xc')]=0x0;if(_0x52806e[_0x9f3f('0xd')]&&parseInt(_0x52806e[_0x9f3f('0xd')],0xa)){var _0xd63ce8={'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa),'phone':_0x435966[_0x9f3f('0xf')]};if(_[_0x9f3f('0x10')](_0x435966[_0x9f3f('0x11')])){_0xd63ce8[_0x9f3f('0x12')]=_0x435966[_0x9f3f('0x13')]&&_0x435966[_0x9f3f('0x13')]!==''?_0x435966[_0x9f3f('0x13')]:_0x435966[_0x9f3f('0xf')]||_0x435966['uniqueid'];}else{_0xd63ce8['firstName']=_0x435966[_0x9f3f('0x14')]&&_0x435966[_0x9f3f('0x14')]!==_0x9f3f('0x15')?_0x435966[_0x9f3f('0x14')]:_0x435966[_0x9f3f('0x16')]||_0x435966[_0x9f3f('0x17')];_0xd63ce8['phone']=_0x435966[_0x9f3f('0x14')]&&_0x435966[_0x9f3f('0x14')]!==_0x9f3f('0x15')?_0x435966[_0x9f3f('0x14')]:_0x435966[_0x9f3f('0x16')]||_0x435966[_0x9f3f('0x17')];}BPromise['resolve']()[_0x9f3f('0x18')](cmContactRpc['showContact']({'where':_[_0x9f3f('0x19')](_0xd63ce8,[_0x9f3f('0x12')])}))['then'](function(_0x3e276d){if(_0x3e276d){logger[_0x9f3f('0xa')](_0x9f3f('0x1a'),_0x435966[_0x9f3f('0x17')],'',_0x3e276d['id']);if(_0x5add2e){_0x435966['xmd-contactid2']=_0x3e276d['id'];emit(_0x435966['uniqueid'],util[_0x9f3f('0x1b')]('user:%s',_0x5add2e[_0x9f3f('0x1c')]),util['format']('trigger:%s',_0x52806e[_0x9f3f('0x1d')][_0x9f3f('0x1e')]()),_['merge'](_0x435966,{'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa)}));}return;}else{logger['info']('[%s][%s]\x20Contact\x20not\x20found',_0x435966[_0x9f3f('0x17')],'');return BPromise[_0x9f3f('0x1f')]()[_0x9f3f('0x18')](cmContactRpc[_0x9f3f('0x20')](_0xd63ce8));}})['then'](function(_0x1f8ce9){if(_0x1f8ce9){logger['info'](_0x9f3f('0x21'),_0x435966[_0x9f3f('0x17')],'',_0x1f8ce9['id']);if(_0x5add2e){_0x435966[_0x9f3f('0x22')]=_0x1f8ce9['id'];emit(_0x435966['uniqueid'],util[_0x9f3f('0x1b')](_0x9f3f('0x23'),_0x5add2e[_0x9f3f('0x1c')]),util[_0x9f3f('0x1b')](_0x9f3f('0x24'),_0x52806e['action']['toLowerCase']()),_[_0x9f3f('0x25')](_0x435966,{'ListId':parseInt(_0x52806e['data1'],0xa)}));}}})[_0x9f3f('0x26')](function(_0x3187cb){logger['error'](_0x9f3f('0x27'),_0x435966['uniqueid'],'',JSON['stringify'](_0x3187cb));});}else{if(_0x5add2e){logger['info']('[%s][%s]\x20Autocreate\x20disabled',_0x435966[_0x9f3f('0x17')],'');emit(_0x435966[_0x9f3f('0x17')],util['format'](_0x9f3f('0x23'),_0x5add2e[_0x9f3f('0x1c')]),util[_0x9f3f('0x1b')](_0x9f3f('0x24'),_0x52806e[_0x9f3f('0x1d')]['toLowerCase']()),_[_0x9f3f('0x25')]({'ListId':parseInt(_0x52806e[_0x9f3f('0xe')],0xa)},_0x435966));}}}; \ No newline at end of file +var _0x26c2=['data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','trigger:%s','action','merge','[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','error','[%s][%s]\x20Error\x20creating\x20contact','stringify','[%s][%s]\x20Autocreate\x20disabled','toLowerCase','util','lodash','ioredis','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','emit','exec','autoCreate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26c2,0x1d6));var _0x226c=function(_0x4b5810,_0x10dca5){_0x4b5810=_0x4b5810-0x0;var _0x827e55=_0x26c2[_0x4b5810];return _0x827e55;};'use strict';var BPromise=require('bluebird');var util=require(_0x226c('0x0'));var _=require(_0x226c('0x1'));var Redis=require(_0x226c('0x2'));var config=require(_0x226c('0x3'));var logger=require('../../../../config/logger')(_0x226c('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x226c('0x5')]=_[_0x226c('0x6')](config[_0x226c('0x5')],{'host':_0x226c('0x7'),'port':0x18eb});var io=require(_0x226c('0x8'))(new Redis(config[_0x226c('0x5')]));function emit(_0x23ccdb,_0x50654d,_0x58ebd8,_0x53fc4f){logger[_0x226c('0x9')](_0x226c('0xa'),_0x23ccdb,'',_0x50654d,_0x58ebd8,JSON['stringify'](_0x53fc4f));io['to'](_0x50654d)[_0x226c('0xb')](_0x58ebd8,_0x53fc4f);}exports[_0x226c('0xc')]=function(_0x85ed80,_0x36d64b,_0x1ae421){_0x1ae421[_0x226c('0xd')]=0x0;if(_0x36d64b[_0x226c('0xe')]&&parseInt(_0x36d64b['data2'],0xa)){var _0x4dd4f5={'ListId':parseInt(_0x36d64b[_0x226c('0xf')],0xa),'phone':_0x1ae421[_0x226c('0x10')]};if(_[_0x226c('0x11')](_0x1ae421[_0x226c('0x12')])){_0x4dd4f5['firstName']=_0x1ae421['calleridname']&&_0x1ae421[_0x226c('0x13')]!==_0x226c('0x14')?_0x1ae421[_0x226c('0x13')]:_0x1ae421[_0x226c('0x10')]||_0x1ae421[_0x226c('0x15')];}else{_0x4dd4f5['firstName']=_0x1ae421[_0x226c('0x16')]&&_0x1ae421[_0x226c('0x16')]!==_0x226c('0x14')?_0x1ae421['destcalleridname']:_0x1ae421[_0x226c('0x17')]||_0x1ae421[_0x226c('0x15')];_0x4dd4f5[_0x226c('0x18')]=_0x1ae421[_0x226c('0x16')]&&_0x1ae421[_0x226c('0x16')]!==_0x226c('0x14')?_0x1ae421[_0x226c('0x16')]:_0x1ae421[_0x226c('0x17')]||_0x1ae421[_0x226c('0x15')];}BPromise[_0x226c('0x19')]()[_0x226c('0x1a')](cmContactRpc[_0x226c('0x1b')]({'where':_[_0x226c('0x1c')](_0x4dd4f5,['firstName'])}))[_0x226c('0x1a')](function(_0x1d3ee8){if(_0x1d3ee8){logger[_0x226c('0x9')]('[%s][%s]\x20Contact\x20found:%s',_0x1ae421[_0x226c('0x15')],'',_0x1d3ee8['id']);if(_0x85ed80){_0x1ae421[_0x226c('0x1d')]=_0x1d3ee8['id'];emit(_0x1ae421['uniqueid'],util[_0x226c('0x1e')](_0x226c('0x1f'),_0x85ed80[_0x226c('0x20')]),util[_0x226c('0x1e')](_0x226c('0x21'),_0x36d64b[_0x226c('0x22')]['toLowerCase']()),_[_0x226c('0x23')](_0x1ae421,{'ListId':parseInt(_0x36d64b[_0x226c('0xf')],0xa)}));}return;}else{logger[_0x226c('0x9')](_0x226c('0x24'),_0x1ae421[_0x226c('0x15')],'');return BPromise[_0x226c('0x19')]()['then'](cmContactRpc[_0x226c('0x25')](_0x4dd4f5));}})[_0x226c('0x1a')](function(_0x418d7e){if(_0x418d7e){logger['info'](_0x226c('0x26'),_0x1ae421['uniqueid'],'',_0x418d7e['id']);if(_0x85ed80){_0x1ae421[_0x226c('0x1d')]=_0x418d7e['id'];emit(_0x1ae421[_0x226c('0x15')],util[_0x226c('0x1e')](_0x226c('0x1f'),_0x85ed80['name']),util['format']('trigger:%s',_0x36d64b['action']['toLowerCase']()),_[_0x226c('0x23')](_0x1ae421,{'ListId':parseInt(_0x36d64b[_0x226c('0xf')],0xa)}));}}})['catch'](function(_0x8c67bc){logger[_0x226c('0x27')](_0x226c('0x28'),_0x1ae421[_0x226c('0x15')],'',JSON[_0x226c('0x29')](_0x8c67bc));});}else{if(_0x85ed80){logger['info'](_0x226c('0x2a'),_0x1ae421[_0x226c('0x15')],'');emit(_0x1ae421['uniqueid'],util[_0x226c('0x1e')](_0x226c('0x1f'),_0x85ed80[_0x226c('0x20')]),util['format'](_0x226c('0x21'),_0x36d64b[_0x226c('0x22')][_0x226c('0x2b')]()),_[_0x226c('0x23')]({'ListId':parseInt(_0x36d64b[_0x226c('0xf')],0xa)},_0x1ae421));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2f0a9f6..79de525 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 _0xa914=['field','account','chat','value','ChatWebsiteId','upperFirst','AccountId','message','event','operator','agent','membername','lastevent','routeId','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','trigger','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','prototype','clone','checkTriggers','interface','status','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','winApplication','winArguments','name','format','trigger:%s:%s','jscripty','trigger:%s','exec','integration','queue','voiceExtensions','urlforward','script','parse','query','search','replace','checkTrigger','length','every','AllConditions','checkConditions','channel','AnyConditions','some'];(function(_0x34e0d3,_0xcc8aad){var _0x30751b=function(_0x29bdf4){while(--_0x29bdf4){_0x34e0d3['push'](_0x34e0d3['shift']());}};_0x30751b(++_0xcc8aad);}(_0xa914,0x83));var _0x4a91=function(_0x4457f4,_0x1aaef3){_0x4457f4=_0x4457f4-0x0;var _0x5b4588=_0xa914[_0x4457f4];return _0x5b4588;};'use strict';var util=require('util');var _=require(_0x4a91('0x0'));var url=require(_0x4a91('0x1'));var Mustache=require(_0x4a91('0x2'));var Redis=require(_0x4a91('0x3'));var urlforward=require(_0x4a91('0x4'));var integration=require(_0x4a91('0x5'));var cmContact=require(_0x4a91('0x6'));var script=require(_0x4a91('0x7'));var cmContactRpc=require(_0x4a91('0x8'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4a91('0x9'));var ami=require('../ami');config[_0x4a91('0xa')]=_['defaults'](config['redis'],{'host':_0x4a91('0xb'),'port':0x18eb});var io=require(_0x4a91('0xc'))(new Redis(config[_0x4a91('0xa')]));var operators={'equals':function(_0x274f0e,_0x87002){return _0x274f0e==_0x87002;},'not_equals':function(_0x4545db,_0x2b644f){return _0x4545db!=_0x2b644f;}};var barAndWebActions=[_0x4a91('0xd'),'url',_0x4a91('0xe')];function Trigger(_0xa21714){this[_0x4a91('0xf')]=_0xa21714['triggers'];this[_0x4a91('0x10')]=_0xa21714['agents'];this['voiceQueues']=_0xa21714[_0x4a91('0x11')];this[_0x4a91('0x12')]=_0xa21714[_0x4a91('0x12')];this['voiceExtensions']=_0xa21714['voiceExtensions'];this['zendeskAccounts']=_0xa21714[_0x4a91('0x13')];this['freshdeskAccounts']=_0xa21714[_0x4a91('0x14')];this[_0x4a91('0x15')]=_0xa21714[_0x4a91('0x15')];this['sugarcrmAccounts']=_0xa21714[_0x4a91('0x16')];this[_0x4a91('0x17')]=_0xa21714[_0x4a91('0x17')];this[_0x4a91('0x18')]=_0xa21714['deskAccounts'];this[_0x4a91('0x19')]=_0xa21714[_0x4a91('0x19')];this[_0x4a91('0x1a')]=_0xa21714[_0x4a91('0x1a')];this[_0x4a91('0x1b')]=_0xa21714[_0x4a91('0x1b')];this[_0x4a91('0x1c')]=_0xa21714[_0x4a91('0x1c')];this['accounts']={'zendesk':this[_0x4a91('0x13')],'salesforce':this[_0x4a91('0x15')],'freshdesk':this[_0x4a91('0x14')],'sugarcrm':this[_0x4a91('0x16')],'zoho':this[_0x4a91('0x17')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x4a91('0x1c')],'servicenow':this[_0x4a91('0x1a')]};ami['on'](_0x4a91('0x1d'),this[_0x4a91('0x1e')]['bind'](this));ami['on'](_0x4a91('0x1f'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x21'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on']('custom:agentcomplete',this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x22'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x23'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x24'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x25'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on']('custom:timeout',this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x26'),this[_0x4a91('0x27')]['bind'](this));ami['on']('custom:dialconnect',this[_0x4a91('0x27')]['bind'](this));ami['on'](_0x4a91('0x28'),this[_0x4a91('0x27')]['bind'](this));ami['on'](_0x4a91('0x29'),this[_0x4a91('0x1e')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on']('custom:incomingmessage',this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x2a'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x2b'),this[_0x4a91('0x1e')][_0x4a91('0x20')](this));ami['on'](_0x4a91('0x2c'),this[_0x4a91('0x1e')]['bind'](this));}Trigger['prototype'][_0x4a91('0x2d')]=function(_0x3a2ccb,_0x370350,_0x1adf13){logger[_0x4a91('0x2e')](_0x3a2ccb,_0x370350,JSON['stringify'](_0x1adf13));io['to'](_0x3a2ccb)[_0x4a91('0x2d')](_0x370350,_0x1adf13);};Trigger[_0x4a91('0x2f')][_0x4a91('0x1e')]=function(_0x2dc576){var _0x421b41=_[_0x4a91('0x30')](_0x2dc576);this[_0x4a91('0x31')](_0x421b41);};Trigger[_0x4a91('0x2f')]['syncAgentDial']=function(_0x47938a){if(this[_0x4a91('0x10')][_0x47938a[_0x4a91('0x32')]]){this[_0x4a91('0x1e')](_0x47938a);}};Trigger[_0x4a91('0x2f')][_0x4a91('0x31')]=function(_0x5d160d){var _0x1e9f4f;for(var _0x512859 in this[_0x4a91('0xf')]){if(this[_0x4a91('0xf')]['hasOwnProperty'](_0x512859)){if(this[_0x4a91('0xf')][_0x512859][_0x4a91('0x33')]){_0x1e9f4f=this['checkTrigger'](this[_0x4a91('0xf')][_0x512859],_0x5d160d);if(_0x1e9f4f){_[_0x4a91('0x34')](_0x5d160d,_0x5d160d[_0x4a91('0x35')]);for(var _0x141499=0x0,_0x6cc29a,_0x3bbc07,_0x20b76b;_0x1414990x0){_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(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 48af4ef..7cc828f 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 _0xb6fe=['headers','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','telephone1','enduserId','contactid','forEach','nameField','customField','idField','indexOf','content','incident','incidents','assign','getString','ticketType','phonecall','Subjects','Descriptions','/contacts(','callDirection','queue','Fields','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers('];(function(_0x6c2b03,_0x4f6978){var _0x111555=function(_0x4cb466){while(--_0x4cb466){_0x6c2b03['push'](_0x6c2b03['shift']());}};_0x111555(++_0x4f6978);}(_0xb6fe,0x192));var _0xeb6f=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb6fe[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var BPromise=require(_0xeb6f('0x0'));var rp=require(_0xeb6f('0x1'));var util=require(_0xeb6f('0x2'));var intUtil=require(_0xeb6f('0x3'));var md5=require(_0xeb6f('0x4'));var Redis=require(_0xeb6f('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0xeb6f('0x6'));config[_0xeb6f('0x7')]=_[_0xeb6f('0x8')](config[_0xeb6f('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xeb6f('0x9'))(new Redis(config['redis']));function getAuthToken(_0x542736,_0x46169a,_0x1c704a){var _0x218b8a={'method':_0xeb6f('0xa'),'uri':_0x46169a,'form':{'client_id':_0x542736[_0xeb6f('0xb')],'resource':_0x542736[_0xeb6f('0xc')],'username':_0x542736['username'],'password':_0x542736['password'],'grant_type':_0xeb6f('0xd'),'client_secret':_0x542736['clientSecret']},'json':!![]};return rp(_0x218b8a)[_0xeb6f('0xe')](function(_0x53cd63){return _0x53cd63[_0xeb6f('0xf')];})[_0xeb6f('0x10')](function(_0x3ab27d){logger[_0xeb6f('0x11')]('['+[_0x1c704a[_0xeb6f('0x12')]()]+_0xeb6f('0x13'));return _0x3ab27d[_0xeb6f('0x14')];});}function getUser(_0x543f5a,_0x44fb21,_0x29323b,_0x1e09df,_0x4e8907,_0x1e0ba7){return new BPromise(function(_0x94a51,_0x5ba925){return getAuthToken(_0x44fb21,_0x1e09df,_0x1e0ba7)[_0xeb6f('0xe')](function(_0x4e58b1){var _0x2158a7={'method':_0xeb6f('0x15'),'uri':_0x4e8907+_0xeb6f('0x16'),'headers':{'Authorization':_0xeb6f('0x17')+_0x4e58b1,'OData-Version':_0xeb6f('0x18')},'json':!![]};return rp(_0x2158a7);})[_0xeb6f('0xe')](function(_0x56b735){var _0x47b20e=_0x56b735[_0xeb6f('0x19')];var _0x54eb85=![];var _0x36cb2a=null;if(!_[_0xeb6f('0x1a')](_0x29323b)){if(intUtil[_0xeb6f('0x1b')](_0x29323b[_0xeb6f('0x1c')])){_0x543f5a['userEmail']=_0x29323b[_0xeb6f('0x1c')];for(_0x36cb2a=0x0;_0x36cb2a<_0x47b20e['length'];_0x36cb2a++){if(_0x47b20e[_0x36cb2a][_0xeb6f('0x1d')]===_0x29323b['email']&&!_0x47b20e[_0x36cb2a]['isdisabled']){_0x54eb85=!![];logger[_0xeb6f('0x1e')]('['+[_0x1e0ba7[_0xeb6f('0x12')]()]+_0xeb6f('0x1f')+_0x47b20e[_0x36cb2a][_0xeb6f('0x20')]+'!');_0x543f5a[_0xeb6f('0x21')]=_0x47b20e[_0x36cb2a]['systemuserid'];}}}}if(!_0x54eb85){logger[_0xeb6f('0x1e')]('['+[_0x1e0ba7[_0xeb6f('0x12')]()]+_0xeb6f('0x22'));_0x543f5a['userEmail']=_0x44fb21[_0xeb6f('0x23')];for(_0x36cb2a=0x0;_0x36cb2a<_0x47b20e[_0xeb6f('0x24')];_0x36cb2a++){if(_0x47b20e[_0x36cb2a][_0xeb6f('0x1d')]===_0x44fb21[_0xeb6f('0x23')]){_0x543f5a[_0xeb6f('0x21')]=_0x47b20e[_0x36cb2a][_0xeb6f('0x20')];}}}_0x94a51(_0x543f5a);})[_0xeb6f('0x10')](function(_0x220192){_0x5ba925(_0x220192['message']);});});}function createEndUser(_0x57d053,_0x34f130,_0x279c44,_0x3422a6,_0x3fdfe7,_0x163e2c){return new BPromise(function(_0x387f93,_0x5a4f63){return getAuthToken(_0x34f130,_0x279c44,_0x163e2c)[_0xeb6f('0xe')](function(_0x327db9){var _0x480e63=_0x163e2c[_0xeb6f('0x25')]()===_0xeb6f('0x26')?_0x3fdfe7[_0xeb6f('0x27')]:_0x3fdfe7[_0xeb6f('0x28')];var _0xe46ddb={'method':_0xeb6f('0xa'),'uri':_0x3422a6+_0xeb6f('0x29'),'body':{'telephone1':_0x480e63,'fullname':_0x480e63,'firstname':_0x480e63,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeb6f('0x2a')+_0x57d053[_0xeb6f('0x21')]+')'},'headers':{'Authorization':_0xeb6f('0x17')+_0x327db9,'OData-Version':_0xeb6f('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xe46ddb);})[_0xeb6f('0xe')](function(_0x5d27a2){var _0x41b721=_0x5d27a2[_0xeb6f('0x2b')][_0xeb6f('0x2c')];var _0x3ae784=_0x41b721[_0xeb6f('0x2d')](_0x41b721[_0xeb6f('0x2e')]('(')+0x1,_0x41b721[_0xeb6f('0x2e')](')'));_0x57d053['enduserId']=_0x3ae784;_0x387f93(_0x57d053);})[_0xeb6f('0x10')](function(_0x5c4ddd){_0x5a4f63(_0x5c4ddd[_0xeb6f('0x14')]);});});}function getEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2){return new BPromise(function(_0x4e83f6,_0xd15aa8){return getAuthToken(_0x5ebfb9,_0x566e48,_0xba11a2)[_0xeb6f('0xe')](function(_0x1d32a8){var _0xaff4b2={'method':_0xeb6f('0x15'),'uri':_0x1f3df7+_0xeb6f('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x1d32a8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xaff4b2);})[_0xeb6f('0xe')](function(_0x136b70){var _0x23447d=null;if(_0x136b70){var _0x5d6219=_0x136b70[_0xeb6f('0x19')];var _0x4064d4=![];for(_0x23447d=0x0;_0x23447d<_0x5d6219['length'];_0x23447d++){var _0x5d366f=_0xba11a2[_0xeb6f('0x25')]()===_0xeb6f('0x26')?_0x1fadb0[_0xeb6f('0x27')]:_0x1fadb0[_0xeb6f('0x28')];if(_0x5d6219[_0x23447d][_0xeb6f('0x30')]===_0x5d366f){_0x4064d4=!![];_0x3dd05f[_0xeb6f('0x31')]=_0x5d6219[_0x23447d][_0xeb6f('0x32')];}}if(_0x4064d4){_0x4e83f6(_0x3dd05f);}else{return createEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2)['then'](function(_0x250f59){logger[_0xeb6f('0x1e')]('['+[_0xba11a2[_0xeb6f('0x12')]()]+']\x20Enduser\x20created!',_0x250f59['enduserId']);_0x4e83f6(_0x250f59);});}}else{return createEndUser(_0x3dd05f,_0x5ebfb9,_0x566e48,_0x1f3df7,_0x1fadb0,_0xba11a2)['then'](function(_0x879816){logger[_0xeb6f('0x1e')]('['+[_0xba11a2[_0xeb6f('0x12')]()]+']\x20Enduser\x20Created!',_0x879816[_0xeb6f('0x31')]);_0x4e83f6(_0x879816);});}});});}function getCustomFields(_0x2fbe89,_0x5c9a51,_0x3a3e3f){var _0x5b6023={};if(_0x2fbe89[_0xeb6f('0x24')]>0x0){_[_0xeb6f('0x33')](_0x2fbe89,function(_0x3c973b){if(_0x3c973b['type']==='string'&&_0x3c973b[_0xeb6f('0x34')]&&!_0x3c973b[_0xeb6f('0x35')]){var _0x19ed8a=_0x3c973b[_0xeb6f('0x36')]['toLowerCase']();var _0x5fde6a=_0x19ed8a[_0xeb6f('0x2d')](0x0,_0x19ed8a[_0xeb6f('0x37')]('_'));var _0x2f0cee=_0x19ed8a[_0xeb6f('0x2d')](_0x19ed8a[_0xeb6f('0x37')]('_')+0x1);if(_0x5fde6a===_0x3a3e3f){_0x5b6023[_0x2f0cee]=_0x3c973b[_0xeb6f('0x38')];}}});}return _0x5b6023;}function getTicket(_0x1fc794,_0x2715a2,_0x1ec604,_0x5db6cf,_0x373573,_0x20c597,_0x110579){return new BPromise(function(_0x5c0b8c,_0x297d3d){var _0x14580e;return getAuthToken(_0x2715a2,_0x1ec604,_0x110579)[_0xeb6f('0xe')](function(_0x36f2cf){if(_0x20c597['ticketType']===_0xeb6f('0x39')){_0x14580e={'method':_0xeb6f('0xa'),'uri':_0x5db6cf+_0xeb6f('0x3a'),'body':Object[_0xeb6f('0x3b')]({},{'title':intUtil[_0xeb6f('0x3c')](_0x20c597['Subjects'],_0x373573,'\x20'),'description':intUtil[_0xeb6f('0x3c')](_0x20c597['Descriptions'],_0x373573,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1fc794[_0xeb6f('0x31')]+')','ownerid@odata.bind':_0xeb6f('0x2a')+_0x1fc794['userId']+')','caseorigincode':'1'},getCustomFields(_0x20c597['Fields'],_0x373573,_0x20c597[_0xeb6f('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x36f2cf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x20c597[_0xeb6f('0x3d')]===_0xeb6f('0x3e')){_0x14580e={'method':_0xeb6f('0xa'),'uri':_0x5db6cf+'phonecalls','body':Object[_0xeb6f('0x3b')]({},{'subject':intUtil[_0xeb6f('0x3c')](_0x20c597[_0xeb6f('0x3f')],_0x373573,'\x20'),'phonenumber':String(_0x373573[_0xeb6f('0x28')]),'description':intUtil[_0xeb6f('0x3c')](_0x20c597[_0xeb6f('0x40')],_0x373573,'\x0a'),'regardingobjectid_contact@odata.bind':_0xeb6f('0x41')+_0x1fc794['enduserId']+')','ownerid@odata.bind':_0xeb6f('0x2a')+_0x1fc794['userId']+')','directioncode':_0x1fc794[_0xeb6f('0x42')]===_0xeb6f('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1fc794[_0xeb6f('0x21')]+')','participationtypemask':_0x1fc794['callDirection']===_0xeb6f('0x43')?0x2:0x1},{'partyid_contact@odata.bind':_0xeb6f('0x41')+_0x1fc794[_0xeb6f('0x31')]+')','participationtypemask':_0x1fc794[_0xeb6f('0x42')]===_0xeb6f('0x43')?0x1:0x2}]},getCustomFields(_0x20c597[_0xeb6f('0x44')],_0x373573,_0x20c597[_0xeb6f('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x36f2cf,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x14580e);})[_0xeb6f('0xe')](function(_0x18b378){var _0x1a45f8=_0x18b378[_0xeb6f('0x2b')][_0xeb6f('0x2c')];var _0x19db1a=_0x1a45f8['substring'](_0x1a45f8['lastIndexOf']('(')+0x1,_0x1a45f8[_0xeb6f('0x2e')](')'));_0x1fc794['ticketId']=_0x19db1a;_0x5c0b8c(_0x1fc794);})[_0xeb6f('0x10')](function(_0x479b46){_0x297d3d(_0x479b46[_0xeb6f('0x14')]);});});}function emit(_0x182957,_0x49bbad,_0x240dcf,_0xdcdf68){var _0x2e33f7={'uri':util[_0xeb6f('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x182957,_0x240dcf,_0xdcdf68)};io['to'](util[_0xeb6f('0x45')](_0xeb6f('0x46'),_0x49bbad))['emit'](_0xeb6f('0x47'),_0x2e33f7);}exports['cs']=function(_0x2071f3,_0x4b8864,_0x2a373d,_0x19ea61,_0x2dd9ce,_0x462801,_0x197da7,_0x332454){var _0x3b99ed={};_0x462801['remoteUri']=intUtil[_0xeb6f('0x48')](_0x462801[_0xeb6f('0xc')]);_0x462801[_0xeb6f('0x49')]=intUtil[_0xeb6f('0x48')](_0x462801[_0xeb6f('0x49')]);_0x3b99ed[_0xeb6f('0x42')]=_0x332454===_0xeb6f('0x43')||_0x332454===_0xeb6f('0x4a')?_0xeb6f('0x43'):'outbound';var _0x2ebfa3=util[_0xeb6f('0x45')](_0xeb6f('0x4b'),_0x462801[_0xeb6f('0xc')]);var _0x1b1882=util[_0xeb6f('0x45')](_0xeb6f('0x4c'),_0x462801['tenantId']);var _0x4d1c57=util['format'](_0xeb6f('0x4d'),_0x462801[_0xeb6f('0x49')],_0x4b8864[_0xeb6f('0x4e')],md5(_0x4b8864[_0xeb6f('0x4e')]));if(_0x2dd9ce&&_0x2dd9ce[_0xeb6f('0x4f')]){logger[_0xeb6f('0x1e')]('[QUEUE]',_0xeb6f('0x50'));_0x4b8864['recordingURL']=_0x4d1c57;}else if(_0x197da7&&_0x197da7[_0xeb6f('0x51')]&&_0x197da7[_0xeb6f('0x51')]!=='none'){logger[_0xeb6f('0x1e')](_0xeb6f('0x52'),_0xeb6f('0x50'));_0x4b8864[_0xeb6f('0x53')]=_0x4d1c57;}else{_0x4b8864['recordingURL']='';}return getUser(_0x3b99ed,_0x462801,_0x19ea61,_0x1b1882,_0x2ebfa3,_0x332454)[_0xeb6f('0xe')](function(_0x39da1c){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x54'),_0x39da1c['userId']);logger['info']('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x39da1c['userEmail']);return getEndUser(_0x39da1c,_0x462801,_0x1b1882,_0x2ebfa3,_0x4b8864,_0x332454);})[_0xeb6f('0xe')](function(_0xc413a3){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xc413a3[_0xeb6f('0x31')]);logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x55'),_0x4b8864['calleridnum']);return getTicket(_0xc413a3,_0x462801,_0x1b1882,_0x2ebfa3,_0x4b8864,_0x2a373d,_0x332454);})['then'](function(_0x208128){logger[_0xeb6f('0x1e')](util[_0xeb6f('0x45')]('['+_0x332454[_0xeb6f('0x12')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2a373d[_0xeb6f('0x3d')],_0x208128[_0xeb6f('0x56')]));logger[_0xeb6f('0x1e')](util['format']('['+_0x332454[_0xeb6f('0x12')]()+']\x20Call\x20direction:\x20%s',_0x332454));if(_0x332454!==_0xeb6f('0x4a')){logger[_0xeb6f('0x1e')]('['+_0x332454[_0xeb6f('0x12')]()+']',_0xeb6f('0x57'));emit(_0x462801['remoteUri'],_0x19ea61['name'],_0x2a373d[_0xeb6f('0x3d')],_0x208128[_0xeb6f('0x56')]);}})['catch'](function(_0x502559){logger[_0xeb6f('0x11')]('['+_0x332454[_0xeb6f('0x12')]()+_0xeb6f('0x58'),util['inspect'](_0x502559,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3aa1=['ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','clientId','username','password','access_token','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','email','internalemailaddress','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','then','toLowerCase','destcalleridnum','POST','/systemusers(','userId','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','contacts?$select=telephone1','outbound','calleridnum','telephone1','info',']\x20Enduser\x20created!','forEach','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','remoteUri','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','./util','md5'];(function(_0x6cd22c,_0x40bde1){var _0x428a79=function(_0x22df89){while(--_0x22df89){_0x6cd22c['push'](_0x6cd22c['shift']());}};_0x428a79(++_0x40bde1);}(_0x3aa1,0x164));var _0x13aa=function(_0x1f1ed1,_0x49d785){_0x1f1ed1=_0x1f1ed1-0x0;var _0x2fc964=_0x3aa1[_0x1f1ed1];return _0x2fc964;};'use strict';var _=require(_0x13aa('0x0'));var BPromise=require(_0x13aa('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x13aa('0x2'));var md5=require(_0x13aa('0x3'));var Redis=require(_0x13aa('0x4'));var logger=require(_0x13aa('0x5'))(_0x13aa('0x6'));var config=require(_0x13aa('0x7'));config['redis']=_[_0x13aa('0x8')](config[_0x13aa('0x9')],{'host':_0x13aa('0xa'),'port':0x18eb});var io=require(_0x13aa('0xb'))(new Redis(config['redis']));function getAuthToken(_0x49e6bb,_0x5ef345,_0x5c97e3){var _0x50caa4={'method':'POST','uri':_0x5ef345,'form':{'client_id':_0x49e6bb[_0x13aa('0xc')],'resource':_0x49e6bb['remoteUri'],'username':_0x49e6bb[_0x13aa('0xd')],'password':_0x49e6bb[_0x13aa('0xe')],'grant_type':_0x13aa('0xe'),'client_secret':_0x49e6bb['clientSecret']},'json':!![]};return rp(_0x50caa4)['then'](function(_0x3ea8ae){return _0x3ea8ae[_0x13aa('0xf')];})['catch'](function(_0x3b0b3e){logger[_0x13aa('0x10')]('['+[_0x5c97e3['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x3b0b3e[_0x13aa('0x11')];});}function getUser(_0x3382c0,_0x5689d2,_0x1aac81,_0x1960e6,_0x8a0270,_0x59e2ad){return new BPromise(function(_0x5c7b6e,_0x128ddb){return getAuthToken(_0x5689d2,_0x1960e6,_0x59e2ad)['then'](function(_0x258ff1){var _0x17fddf={'method':_0x13aa('0x12'),'uri':_0x8a0270+_0x13aa('0x13'),'headers':{'Authorization':_0x13aa('0x14')+_0x258ff1,'OData-Version':'4.0'},'json':!![]};return rp(_0x17fddf);})['then'](function(_0x214713){var _0xb3cf05=_0x214713[_0x13aa('0x15')];var _0xc4cbc1=![];var _0x1d94e6=null;if(!_['isNil'](_0x1aac81)){if(intUtil[_0x13aa('0x16')](_0x1aac81['email'])){_0x3382c0['userEmail']=_0x1aac81[_0x13aa('0x17')];for(_0x1d94e6=0x0;_0x1d94e6<_0xb3cf05['length'];_0x1d94e6++){if(_0xb3cf05[_0x1d94e6][_0x13aa('0x18')]===_0x1aac81[_0x13aa('0x17')]&&!_0xb3cf05[_0x1d94e6]['isdisabled']){_0xc4cbc1=!![];logger['info']('['+[_0x59e2ad['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xb3cf05[_0x1d94e6][_0x13aa('0x19')]+'!');_0x3382c0['userId']=_0xb3cf05[_0x1d94e6][_0x13aa('0x19')];}}}}if(!_0xc4cbc1){logger['info']('['+[_0x59e2ad[_0x13aa('0x1a')]()]+_0x13aa('0x1b'));_0x3382c0[_0x13aa('0x1c')]=_0x5689d2[_0x13aa('0xd')];for(_0x1d94e6=0x0;_0x1d94e6<_0xb3cf05[_0x13aa('0x1d')];_0x1d94e6++){if(_0xb3cf05[_0x1d94e6]['internalemailaddress']===_0x5689d2['username']){_0x3382c0['userId']=_0xb3cf05[_0x1d94e6]['systemuserid'];}}}_0x5c7b6e(_0x3382c0);})['catch'](function(_0x362b6b){_0x128ddb(_0x362b6b[_0x13aa('0x11')]);});});}function createEndUser(_0x2e9a23,_0x39ed54,_0x4f3bbd,_0x48a3bb,_0x4e0c98,_0x2f7f8d){return new BPromise(function(_0x38ee0d,_0x2a8f38){return getAuthToken(_0x39ed54,_0x4f3bbd,_0x2f7f8d)[_0x13aa('0x1e')](function(_0x1190fe){var _0x506fdc=_0x2f7f8d[_0x13aa('0x1f')]()==='outbound'?_0x4e0c98[_0x13aa('0x20')]:_0x4e0c98['calleridnum'];var _0x41cdbd={'method':_0x13aa('0x21'),'uri':_0x48a3bb+'contacts','body':{'telephone1':_0x506fdc,'fullname':_0x506fdc,'firstname':_0x506fdc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x13aa('0x22')+_0x2e9a23[_0x13aa('0x23')]+')'},'headers':{'Authorization':_0x13aa('0x14')+_0x1190fe,'OData-Version':_0x13aa('0x24')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x41cdbd);})[_0x13aa('0x1e')](function(_0x4d6943){var _0x433567=_0x4d6943[_0x13aa('0x25')][_0x13aa('0x26')];var _0x1e5be5=_0x433567[_0x13aa('0x27')](_0x433567[_0x13aa('0x28')]('(')+0x1,_0x433567[_0x13aa('0x28')](')'));_0x2e9a23[_0x13aa('0x29')]=_0x1e5be5;_0x38ee0d(_0x2e9a23);})[_0x13aa('0x2a')](function(_0xcabcca){_0x2a8f38(_0xcabcca[_0x13aa('0x11')]);});});}function getEndUser(_0x55403d,_0x2d2fd2,_0x21feef,_0x459333,_0x2d6f4f,_0x4ea3b4){return new BPromise(function(_0x4f7a31,_0x2049a3){return getAuthToken(_0x2d2fd2,_0x21feef,_0x4ea3b4)['then'](function(_0x498fe2){var _0x3754a4={'method':'GET','uri':_0x459333+_0x13aa('0x2b'),'headers':{'Authorization':_0x13aa('0x14')+_0x498fe2,'If-None-Match':null,'OData-Version':_0x13aa('0x24')},'json':!![]};return rp(_0x3754a4);})['then'](function(_0x3789f6){var _0x46da25=null;if(_0x3789f6){var _0x5af69b=_0x3789f6[_0x13aa('0x15')];var _0x4fbc01=![];for(_0x46da25=0x0;_0x46da25<_0x5af69b['length'];_0x46da25++){var _0x6747b=_0x4ea3b4[_0x13aa('0x1f')]()===_0x13aa('0x2c')?_0x2d6f4f[_0x13aa('0x20')]:_0x2d6f4f[_0x13aa('0x2d')];if(_0x5af69b[_0x46da25][_0x13aa('0x2e')]===_0x6747b){_0x4fbc01=!![];_0x55403d[_0x13aa('0x29')]=_0x5af69b[_0x46da25]['contactid'];}}if(_0x4fbc01){_0x4f7a31(_0x55403d);}else{return createEndUser(_0x55403d,_0x2d2fd2,_0x21feef,_0x459333,_0x2d6f4f,_0x4ea3b4)['then'](function(_0x5e47d3){logger[_0x13aa('0x2f')]('['+[_0x4ea3b4['toUpperCase']()]+_0x13aa('0x30'),_0x5e47d3[_0x13aa('0x29')]);_0x4f7a31(_0x5e47d3);});}}else{return createEndUser(_0x55403d,_0x2d2fd2,_0x21feef,_0x459333,_0x2d6f4f,_0x4ea3b4)[_0x13aa('0x1e')](function(_0x4918ef){logger[_0x13aa('0x2f')]('['+[_0x4ea3b4[_0x13aa('0x1a')]()]+']\x20Enduser\x20Created!',_0x4918ef[_0x13aa('0x29')]);_0x4f7a31(_0x4918ef);});}});});}function getCustomFields(_0x4343fd,_0xef1916,_0x3afd4e){var _0x373f19={};if(_0x4343fd['length']>0x0){_[_0x13aa('0x31')](_0x4343fd,function(_0x46fabd){if(_0x46fabd['type']==='string'&&_0x46fabd[_0x13aa('0x32')]&&!_0x46fabd[_0x13aa('0x33')]){var _0x462ecc=_0x46fabd[_0x13aa('0x34')]['toLowerCase']();var _0x594e8e=_0x462ecc[_0x13aa('0x27')](0x0,_0x462ecc[_0x13aa('0x35')]('_'));var _0xabed4d=_0x462ecc[_0x13aa('0x27')](_0x462ecc['indexOf']('_')+0x1);if(_0x594e8e===_0x3afd4e){_0x373f19[_0xabed4d]=_0x46fabd[_0x13aa('0x36')];}}});}return _0x373f19;}function getTicket(_0x43c3ae,_0x4065b6,_0x5e0f89,_0x41d475,_0x137da5,_0x45323f,_0x357f10){return new BPromise(function(_0x2f06b5,_0x3b671c){var _0x5b1803;return getAuthToken(_0x4065b6,_0x5e0f89,_0x357f10)['then'](function(_0x111de0){if(_0x45323f[_0x13aa('0x37')]==='incident'){_0x5b1803={'method':_0x13aa('0x21'),'uri':_0x41d475+_0x13aa('0x38'),'body':Object[_0x13aa('0x39')]({},{'title':intUtil[_0x13aa('0x3a')](_0x45323f['Subjects'],_0x137da5,'\x20'),'description':intUtil[_0x13aa('0x3a')](_0x45323f[_0x13aa('0x3b')],_0x137da5,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x43c3ae[_0x13aa('0x29')]+')','ownerid@odata.bind':_0x13aa('0x22')+_0x43c3ae[_0x13aa('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x45323f[_0x13aa('0x3c')],_0x137da5,_0x45323f[_0x13aa('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x111de0,'OData-Version':_0x13aa('0x24')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x45323f[_0x13aa('0x37')]===_0x13aa('0x3d')){_0x5b1803={'method':'POST','uri':_0x41d475+_0x13aa('0x3e'),'body':Object[_0x13aa('0x39')]({},{'subject':intUtil['getString'](_0x45323f[_0x13aa('0x3f')],_0x137da5,'\x20'),'phonenumber':String(_0x137da5[_0x13aa('0x2d')]),'description':intUtil['getString'](_0x45323f[_0x13aa('0x3b')],_0x137da5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x13aa('0x40')+_0x43c3ae['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x43c3ae['userId']+')','directioncode':_0x43c3ae[_0x13aa('0x41')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x13aa('0x22')+_0x43c3ae[_0x13aa('0x23')]+')','participationtypemask':_0x43c3ae[_0x13aa('0x41')]===_0x13aa('0x42')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x43c3ae[_0x13aa('0x29')]+')','participationtypemask':_0x43c3ae[_0x13aa('0x41')]===_0x13aa('0x42')?0x1:0x2}]},getCustomFields(_0x45323f['Fields'],_0x137da5,_0x45323f[_0x13aa('0x37')])),'headers':{'Authorization':_0x13aa('0x14')+_0x111de0,'OData-Version':_0x13aa('0x24')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5b1803);})[_0x13aa('0x1e')](function(_0x16a85c){var _0x16d7d8=_0x16a85c[_0x13aa('0x25')][_0x13aa('0x26')];var _0x1b1afe=_0x16d7d8[_0x13aa('0x27')](_0x16d7d8[_0x13aa('0x28')]('(')+0x1,_0x16d7d8[_0x13aa('0x28')](')'));_0x43c3ae[_0x13aa('0x43')]=_0x1b1afe;_0x2f06b5(_0x43c3ae);})[_0x13aa('0x2a')](function(_0x12d92a){_0x3b671c(_0x12d92a[_0x13aa('0x11')]);});});}function emit(_0x44f732,_0x145da4,_0x59cc50,_0x20c28d){var _0x2da568={'uri':util[_0x13aa('0x44')](_0x13aa('0x45'),_0x44f732,_0x59cc50,_0x20c28d)};io['to'](util['format']('user:%s',_0x145da4))[_0x13aa('0x46')](_0x13aa('0x47'),_0x2da568);}exports['cs']=function(_0x132eac,_0x4d3a89,_0x5c536b,_0x1f133e,_0x59e9e7,_0x4e1a71,_0x4cfa6c,_0x3fa7bb){var _0x2df8a1={};_0x4e1a71[_0x13aa('0x48')]=intUtil['stripTrailingSlash'](_0x4e1a71['remoteUri']);_0x4e1a71['serverUrl']=intUtil['stripTrailingSlash'](_0x4e1a71[_0x13aa('0x49')]);_0x2df8a1['callDirection']=_0x3fa7bb==='queue'||_0x3fa7bb===_0x13aa('0x4a')?'queue':_0x13aa('0x2c');var _0x27ff05=util[_0x13aa('0x44')]('%s/api/data/v9.0/',_0x4e1a71[_0x13aa('0x48')]);var _0x4b0e27=util[_0x13aa('0x44')](_0x13aa('0x4b'),_0x4e1a71[_0x13aa('0x4c')]);var _0x1d92ff=util[_0x13aa('0x44')](_0x13aa('0x4d'),_0x4e1a71[_0x13aa('0x49')],_0x4d3a89['uniqueid'],md5(_0x4d3a89[_0x13aa('0x4e')]));if(_0x59e9e7&&_0x59e9e7['monitor_format']){logger[_0x13aa('0x2f')](_0x13aa('0x4f'),_0x13aa('0x50'));_0x4d3a89[_0x13aa('0x51')]=_0x1d92ff;}else if(_0x4cfa6c&&_0x4cfa6c['recordingFormat']&&_0x4cfa6c['recordingFormat']!==_0x13aa('0x52')){logger[_0x13aa('0x2f')](_0x13aa('0x53'),_0x13aa('0x50'));_0x4d3a89[_0x13aa('0x51')]=_0x1d92ff;}else{_0x4d3a89[_0x13aa('0x51')]='';}return getUser(_0x2df8a1,_0x4e1a71,_0x1f133e,_0x4b0e27,_0x27ff05,_0x3fa7bb)['then'](function(_0x345f63){logger[_0x13aa('0x2f')]('['+_0x3fa7bb['toUpperCase']()+_0x13aa('0x54'),_0x345f63[_0x13aa('0x23')]);logger[_0x13aa('0x2f')]('['+_0x3fa7bb[_0x13aa('0x1a')]()+_0x13aa('0x55'),_0x345f63[_0x13aa('0x1c')]);return getEndUser(_0x345f63,_0x4e1a71,_0x4b0e27,_0x27ff05,_0x4d3a89,_0x3fa7bb);})[_0x13aa('0x1e')](function(_0x109d53){logger[_0x13aa('0x2f')]('['+_0x3fa7bb[_0x13aa('0x1a')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x109d53['enduserId']);logger[_0x13aa('0x2f')]('['+_0x3fa7bb['toUpperCase']()+_0x13aa('0x56'),_0x4d3a89[_0x13aa('0x2d')]);return getTicket(_0x109d53,_0x4e1a71,_0x4b0e27,_0x27ff05,_0x4d3a89,_0x5c536b,_0x3fa7bb);})[_0x13aa('0x1e')](function(_0x12cddc){logger[_0x13aa('0x2f')](util[_0x13aa('0x44')]('['+_0x3fa7bb[_0x13aa('0x1a')]()+_0x13aa('0x57'),_0x5c536b[_0x13aa('0x37')],_0x12cddc[_0x13aa('0x43')]));logger[_0x13aa('0x2f')](util[_0x13aa('0x44')]('['+_0x3fa7bb[_0x13aa('0x1a')]()+']\x20Call\x20direction:\x20%s',_0x3fa7bb));if(_0x3fa7bb!==_0x13aa('0x4a')){logger[_0x13aa('0x2f')]('['+_0x3fa7bb[_0x13aa('0x1a')]()+']',_0x13aa('0x58'));emit(_0x4e1a71[_0x13aa('0x48')],_0x1f133e['name'],_0x5c536b[_0x13aa('0x37')],_0x12cddc['ticketId']);}})['catch'](function(_0x4e20ab){logger[_0x13aa('0x10')]('['+_0x3fa7bb['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x13aa('0x59')](_0x4e20ab,{'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 5bb13fd..64ded29 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 _0x5dd5=['Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','recordingURL','Authorization','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','name','Fields','mapValues','value','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','toLowerCase','idField','push','content','variableName','custom_fields'];(function(_0x5aa6ef,_0x5ec8ed){var _0x2554f5=function(_0x3b20ee){while(--_0x3b20ee){_0x5aa6ef['push'](_0x5aa6ef['shift']());}};_0x2554f5(++_0x5ec8ed);}(_0x5dd5,0x17a));var _0x55dd=function(_0x3794d5,_0x5e6b91){_0x3794d5=_0x3794d5-0x0;var _0x44080c=_0x5dd5[_0x3794d5];return _0x44080c;};'use strict';var _=require('lodash');var rp=require(_0x55dd('0x0'));var md5=require(_0x55dd('0x1'));var util=require(_0x55dd('0x2'));var Redis=require(_0x55dd('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x55dd('0x4'))('freshdesk');config[_0x55dd('0x5')]=_[_0x55dd('0x6')](config[_0x55dd('0x5')],{'host':_0x55dd('0x7'),'port':0x18eb});var io=require(_0x55dd('0x8'))(new Redis(config[_0x55dd('0x5')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x5024f5,_0x5185f3,_0x1b617b){io['to'](_0x5024f5)[_0x55dd('0x9')](_0x5185f3,_0x1b617b);}function getTicket(_0x31f580,_0x3050f8,_0x1018c8,_0x2199cf,_0x1be033){logger[_0x55dd('0xa')](_0x55dd('0xb'));var _0x555d79=_[_0x55dd('0xc')]({'responder_id':_0x3050f8['id'],'requester_id':_0x1018c8['id'],'name':util[_0x55dd('0xd')](_0x55dd('0xe'),_0x1be033[_0x55dd('0xf')]),'phone':_0x1be033[_0x55dd('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x55dd('0x11')](_0x2199cf[_0x55dd('0x12')],_0x1be033,'\x20'),'description':intUtil[_0x55dd('0x11')](_0x2199cf[_0x55dd('0x13')],_0x1be033,'
'),'tags':getTags(_0x2199cf['Tags'],_0x55dd('0x14'))},getCustomFields(_0x2199cf[_0x55dd('0x15')],_0x1be033));_0x555d79['custom_fields']=_[_0x55dd('0x16')](_['keyBy'](_0x555d79['custom_fields'],'id'),_0x55dd('0x17'));return request({'uri':util[_0x55dd('0xd')]('%s/api/v2/tickets',_0x31f580[_0x55dd('0x18')]),'method':_0x55dd('0x19'),'body':_0x555d79})['then'](function(_0x564972){logger[_0x55dd('0xa')](_0x55dd('0x1a'));return _0x564972;});}function getUser(_0x3fa76e,_0x2bac64){if(intUtil[_0x55dd('0x1b')](_0x2bac64)){return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x1c'),_0x3fa76e[_0x55dd('0x18')]),'qs':{'email':_0x2bac64}})[_0x55dd('0x1d')](function(_0x440601){if(_0x440601['length']){logger['info']('Agent\x20found!');return _[_0x55dd('0x1e')](_0x440601,function(_0xace668){return _0xace668[_0x55dd('0x1f')][_0x55dd('0x20')]===_0x2bac64;});}else{logger[_0x55dd('0xa')](_0x55dd('0x21'));return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x22'),_0x3fa76e['remoteUri'])})[_0x55dd('0x1d')](function(_0x455f92){logger[_0x55dd('0xa')](_0x55dd('0x23'));return _0x455f92;});}});}else{logger[_0x55dd('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x22'),_0x3fa76e[_0x55dd('0x18')])})[_0x55dd('0x1d')](function(_0x680ae3){logger[_0x55dd('0xa')](_0x55dd('0x23'));return _0x680ae3;});}}function getEndUser(_0x28733e,_0x304ba6,_0x3c1e94){logger[_0x55dd('0xa')](_0x55dd('0x24'),_0x3c1e94);return request({'uri':util[_0x55dd('0xd')](_0x55dd('0x25'),_0x28733e[_0x55dd('0x18')]),'qs':{'phone':_0x3c1e94}})['then'](function(_0x14c619){if(_0x14c619['length']){logger[_0x55dd('0xa')](_0x55dd('0x26'));return _['find'](_0x14c619,{'phone':_0x3c1e94});}else{logger['info'](_0x55dd('0x27'));return request({'uri':util['format'](_0x55dd('0x25'),_0x28733e['remoteUri']),'method':'POST','body':{'name':_0x304ba6,'phone':_0x3c1e94}})[_0x55dd('0x1d')](function(_0x805067){logger[_0x55dd('0xa')](_0x55dd('0x28'));return _0x805067;});}});}function getAuth(_0x2ebc4a){return util[_0x55dd('0xd')](_0x55dd('0x29'),new Buffer(_0x2ebc4a[_0x55dd('0x2a')]+':X')[_0x55dd('0x2b')](_0x55dd('0x2c')));}function request(_0x30725d){logger[_0x55dd('0x2d')](_0x55dd('0x2e'),JSON[_0x55dd('0x2f')](_0x30725d));return rp(_[_0x55dd('0x6')](_0x30725d,{'method':_0x55dd('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x57f428,_0x2a4fd0){var _0x3a2a59=[];if(_0x57f428&&_0x57f428[_0x55dd('0x31')]>0x0){_0x3a2a59=_[_0x55dd('0x32')](_0x57f428,_0x2a4fd0);}return _0x3a2a59;}function getCustomFields(_0x4d380d,_0x4622e9){var _0x1d9ac1=[];var _0x2a995d={'custom_fields':[]};if(_0x4d380d[_0x55dd('0x31')]>0x0){_[_0x55dd('0x33')](_0x4d380d,function(_0x1cb934){if(_0x1cb934[_0x55dd('0x34')]===_0x55dd('0x35')&&_0x1cb934[_0x55dd('0x36')]&&!_0x1cb934[_0x55dd('0x37')]){_0x2a995d[_0x1cb934[_0x55dd('0x36')][_0x55dd('0x38')]()]=_0x1cb934['content']['toString']();}else if(_0x1cb934[_0x55dd('0x34')]===_0x55dd('0x35')&&_0x1cb934[_0x55dd('0x39')]&&_0x1cb934['customField']){_0x2a995d['custom_fields'][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x1cb934[_0x55dd('0x3b')]['toString']()});}else if(_0x1cb934[_0x55dd('0x34')]==='variable'&&_0x1cb934[_0x55dd('0x3c')]&&_0x1cb934['idField']&&_0x1cb934['customField']){_0x4622e9[_0x1cb934['variableName']]&&_0x2a995d[_0x55dd('0x3d')][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x4622e9[_0x1cb934['variableName']]['toString']()});}else if(_0x1cb934[_0x55dd('0x34')]==='customVariable'&&_0x1cb934[_0x55dd('0x3e')]&&_0x1cb934[_0x55dd('0x3e')][_0x55dd('0x14')]&&_0x1cb934[_0x55dd('0x39')]&&_0x1cb934[_0x55dd('0x37')]){_0x4622e9[_0x1cb934[_0x55dd('0x3e')][_0x55dd('0x14')][_0x55dd('0x38')]()]&&_0x2a995d[_0x55dd('0x3d')][_0x55dd('0x3a')]({'id':_0x1cb934[_0x55dd('0x39')],'value':_0x4622e9[_0x1cb934['Variable'][_0x55dd('0x14')]['toLowerCase']()][_0x55dd('0x2b')]()});}});}return _0x2a995d;}exports['queue']=function(_0xe790b2,_0x1d129c,_0x4d160c,_0x528e7a,_0x38ee0e,_0x2af08d){var _0x21b4eb,_0x55d1e0;_0x2af08d[_0x55dd('0x18')]=intUtil[_0x55dd('0x3f')](_0x2af08d['remoteUri']);_0x2af08d[_0x55dd('0x40')]=intUtil['stripTrailingSlash'](_0x2af08d[_0x55dd('0x40')]);if(_0x38ee0e&&_0x38ee0e[_0x55dd('0x41')]){logger['info']('[QUEUE]',_0x55dd('0x42'));_0x1d129c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2af08d[_0x55dd('0x40')],_0x1d129c[_0x55dd('0x43')],md5(_0x1d129c['uniqueid']));}else{_0x1d129c['recordingURL']='';}headers['Authorization']=getAuth(_0x2af08d);return getUser(_0x2af08d,_0x528e7a[_0x55dd('0x20')])[_0x55dd('0x1d')](function(_0x5394b6){_0x21b4eb=_0x5394b6;logger['info'](_0x55dd('0x44'),_0x21b4eb['id']);return getEndUser(_0x2af08d,_0x1d129c['calleridname'],_0x1d129c['calleridnum']);})[_0x55dd('0x1d')](function(_0x3df910){_0x55d1e0=_0x3df910;logger[_0x55dd('0xa')]('The\x20Enduser\x20ID\x20is:',_0x55d1e0['id']);return getTicket(_0x2af08d,_0x21b4eb,_0x55d1e0,_0x4d160c,_0x1d129c);})[_0x55dd('0x1d')](function(_0x403c31){if(_0x403c31&&_0x403c31['id']){logger['info']('Ticket\x20created!');logger[_0x55dd('0xa')]('The\x20Ticket\x20ID\x20is:',_0x403c31['id']);logger[_0x55dd('0xa')](_0x55dd('0x45'),_0x55dd('0x46'));emit(util['format'](_0x55dd('0x47'),_0x528e7a[_0x55dd('0x14')]),_0x55dd('0x48'),{'uri':util[_0x55dd('0xd')](_0x55dd('0x49'),_0x2af08d[_0x55dd('0x18')],_0x403c31['id'])});}})[_0x55dd('0x4a')](function(_0x4cc1b7){logger[_0x55dd('0x4b')](_0x55dd('0x45'),JSON[_0x55dd('0x2f')](_0x4cc1b7));});};exports[_0x55dd('0x4c')]=function(_0x1ea12e,_0x5a2345,_0x12936c,_0x68ce14,_0x2f61a8,_0x576c96,_0x58903d){var _0x501798,_0x4bf3d6;_0x576c96['remoteUri']=intUtil[_0x55dd('0x3f')](_0x576c96[_0x55dd('0x18')]);_0x576c96[_0x55dd('0x40')]=intUtil[_0x55dd('0x3f')](_0x576c96[_0x55dd('0x40')]);if(_0x58903d&&_0x58903d[_0x55dd('0x4d')]&&_0x58903d['recordingFormat']!==_0x55dd('0x4e')){logger[_0x55dd('0xa')](_0x55dd('0x4f'),_0x55dd('0x42'));_0x5a2345['recordingURL']=util[_0x55dd('0xd')](_0x55dd('0x50'),_0x576c96[_0x55dd('0x40')],_0x5a2345[_0x55dd('0x43')],md5(_0x5a2345[_0x55dd('0x43')]));}headers['Authorization']=getAuth(_0x576c96);return getUser(_0x576c96,_0x68ce14['email'])[_0x55dd('0x1d')](function(_0x527221){_0x501798=_0x527221;logger['info']('The\x20User\x20ID\x20is:',_0x501798['id']);return getEndUser(_0x576c96,_0x5a2345['destcalleridname'],_0x5a2345['destcalleridnum']);})[_0x55dd('0x1d')](function(_0x80d2fe){_0x4bf3d6=_0x80d2fe;logger['info'](_0x55dd('0x51'),_0x4bf3d6['id']);return getTicket(_0x576c96,_0x501798,_0x4bf3d6,_0x12936c,_0x5a2345);})['then'](function(_0x380eae){if(_0x380eae&&_0x380eae['id']){logger[_0x55dd('0xa')](_0x55dd('0x1a'));logger[_0x55dd('0xa')](_0x55dd('0x52'),_0x380eae['id']);logger['info'](_0x55dd('0x4f'),_0x55dd('0x46'));emit(util['format'](_0x55dd('0x47'),_0x68ce14['name']),_0x55dd('0x48'),{'uri':util['format'](_0x55dd('0x49'),_0x576c96['remoteUri'],_0x380eae['id'])});}})['catch'](function(_0xe2f6e){logger['error'](_0x55dd('0x4f'),JSON[_0x55dd('0x2f')](_0xe2f6e));});};exports[_0x55dd('0x53')]=function(_0x19bf98,_0x12ab0e,_0x554d97,_0x4e60d2,_0x7cdd1d,_0x3f28e8){var _0x32df1c,_0x23685a;_0x3f28e8[_0x55dd('0x18')]=intUtil['stripTrailingSlash'](_0x3f28e8[_0x55dd('0x18')]);_0x3f28e8[_0x55dd('0x40')]=intUtil[_0x55dd('0x3f')](_0x3f28e8[_0x55dd('0x40')]);if(_0x7cdd1d&&_0x7cdd1d[_0x55dd('0x41')]){logger[_0x55dd('0xa')]('['+_0x12ab0e[_0x55dd('0x54')][_0x55dd('0x55')]()+']',_0x55dd('0x42'));_0x12ab0e[_0x55dd('0x56')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f28e8['serverUrl'],_0x12ab0e['uniqueid'],md5(_0x12ab0e[_0x55dd('0x43')]));}else{_0x12ab0e['recordingURL']='';}headers[_0x55dd('0x57')]=getAuth(_0x3f28e8);return getUser(_0x3f28e8,'')[_0x55dd('0x1d')](function(_0x558ce6){_0x32df1c=_0x558ce6;logger['info'](_0x55dd('0x44'),_0x32df1c['id']);return getEndUser(_0x3f28e8,_0x12ab0e[_0x55dd('0xf')],_0x12ab0e[_0x55dd('0x10')]);})[_0x55dd('0x1d')](function(_0x316ca2){_0x23685a=_0x316ca2;logger[_0x55dd('0xa')](_0x55dd('0x51'),_0x23685a['id']);return getTicket(_0x3f28e8,_0x32df1c,_0x23685a,_0x554d97,_0x12ab0e);})[_0x55dd('0x1d')](function(_0x17cea5){if(_0x17cea5){logger['info'](_0x55dd('0x1a'));logger[_0x55dd('0xa')](_0x55dd('0x52'),_0x17cea5['id']);}})[_0x55dd('0x4a')](function(_0xe52101){logger['error']('['+_0x12ab0e['lastevent']['toUpperCase']()+']',JSON[_0x55dd('0x2f')](_0xe52101));});}; \ No newline at end of file +var _0x282f=['nameField','customField','toLowerCase','content','type','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridnum','unmanaged','calleridnum','lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','value','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','remoteUri','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','[HTTP]','GET','length','forEach','string'];(function(_0x512140,_0x4b2ae7){var _0x5cc137=function(_0x2b77fe){while(--_0x2b77fe){_0x512140['push'](_0x512140['shift']());}};_0x5cc137(++_0x4b2ae7);}(_0x282f,0x180));var _0xf282=function(_0x2db0c9,_0x13c4dd){_0x2db0c9=_0x2db0c9-0x0;var _0x1a71ec=_0x282f[_0x2db0c9];return _0x1a71ec;};'use strict';var _=require('lodash');var rp=require(_0xf282('0x0'));var md5=require(_0xf282('0x1'));var util=require(_0xf282('0x2'));var Redis=require('ioredis');var intUtil=require(_0xf282('0x3'));var config=require(_0xf282('0x4'));var logger=require(_0xf282('0x5'))('freshdesk');config[_0xf282('0x6')]=_[_0xf282('0x7')](config[_0xf282('0x6')],{'host':_0xf282('0x8'),'port':0x18eb});var io=require(_0xf282('0x9'))(new Redis(config[_0xf282('0x6')]));var headers={'Content-Type':_0xf282('0xa'),'Accept':'application/json'};function emit(_0x47e6bd,_0x2e2762,_0x51abc0){io['to'](_0x47e6bd)[_0xf282('0xb')](_0x2e2762,_0x51abc0);}function getTicket(_0x435787,_0x5d8168,_0x202287,_0x3e95de,_0x1f1190){logger['info'](_0xf282('0xc'));var _0x33b310=_[_0xf282('0xd')]({'responder_id':_0x5d8168['id'],'requester_id':_0x202287['id'],'name':util[_0xf282('0xe')](_0xf282('0xf'),_0x1f1190[_0xf282('0x10')]),'phone':_0x1f1190['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf282('0x11')](_0x3e95de[_0xf282('0x12')],_0x1f1190,'\x20'),'description':intUtil[_0xf282('0x11')](_0x3e95de[_0xf282('0x13')],_0x1f1190,'
'),'tags':getTags(_0x3e95de[_0xf282('0x14')],_0xf282('0x15'))},getCustomFields(_0x3e95de[_0xf282('0x16')],_0x1f1190));_0x33b310[_0xf282('0x17')]=_['mapValues'](_['keyBy'](_0x33b310[_0xf282('0x17')],'id'),_0xf282('0x18'));return request({'uri':util[_0xf282('0xe')](_0xf282('0x19'),_0x435787['remoteUri']),'method':_0xf282('0x1a'),'body':_0x33b310})[_0xf282('0x1b')](function(_0x4ee595){logger[_0xf282('0x1c')](_0xf282('0x1d'));return _0x4ee595;});}function getUser(_0x199d88,_0x32dbb5){if(intUtil[_0xf282('0x1e')](_0x32dbb5)){return request({'uri':util[_0xf282('0xe')]('%s/api/v2/agents',_0x199d88[_0xf282('0x1f')]),'qs':{'email':_0x32dbb5}})[_0xf282('0x1b')](function(_0x4c9e09){if(_0x4c9e09['length']){logger['info'](_0xf282('0x20'));return _[_0xf282('0x21')](_0x4c9e09,function(_0xae05ec){return _0xae05ec['contact'][_0xf282('0x22')]===_0x32dbb5;});}else{logger[_0xf282('0x1c')](_0xf282('0x23'));return request({'uri':util[_0xf282('0xe')]('%s/api/v2/agents/me',_0x199d88['remoteUri'])})[_0xf282('0x1b')](function(_0x56c674){logger[_0xf282('0x1c')](_0xf282('0x24'));return _0x56c674;});}});}else{logger[_0xf282('0x1c')](_0xf282('0x25'));return request({'uri':util['format'](_0xf282('0x26'),_0x199d88[_0xf282('0x1f')])})[_0xf282('0x1b')](function(_0x2f97e6){logger[_0xf282('0x1c')](_0xf282('0x24'));return _0x2f97e6;});}}function getEndUser(_0xb9f0d,_0x3e035d,_0x54fb89){logger[_0xf282('0x1c')]('Searching\x20enduser\x20with\x20phone',_0x54fb89);return request({'uri':util[_0xf282('0xe')](_0xf282('0x27'),_0xb9f0d[_0xf282('0x1f')]),'qs':{'phone':_0x54fb89}})[_0xf282('0x1b')](function(_0x4b9440){if(_0x4b9440['length']){logger[_0xf282('0x1c')](_0xf282('0x28'));return _[_0xf282('0x21')](_0x4b9440,{'phone':_0x54fb89});}else{logger['info'](_0xf282('0x29'));return request({'uri':util[_0xf282('0xe')](_0xf282('0x27'),_0xb9f0d[_0xf282('0x1f')]),'method':_0xf282('0x1a'),'body':{'name':_0x3e035d,'phone':_0x54fb89}})['then'](function(_0x23b40d){logger['info']('Enduser\x20created.');return _0x23b40d;});}});}function getAuth(_0x4e0a9b){return util[_0xf282('0xe')](_0xf282('0x2a'),new Buffer(_0x4e0a9b[_0xf282('0x2b')]+':X')[_0xf282('0x2c')](_0xf282('0x2d')));}function request(_0x4602ad){logger['debug'](_0xf282('0x2e'),JSON['stringify'](_0x4602ad));return rp(_['defaults'](_0x4602ad,{'method':_0xf282('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x51e256,_0x39577a){var _0x611698=[];if(_0x51e256&&_0x51e256[_0xf282('0x30')]>0x0){_0x611698=_['map'](_0x51e256,_0x39577a);}return _0x611698;}function getCustomFields(_0x24be2e,_0x439960){var _0x2e2cb3=[];var _0x8134={'custom_fields':[]};if(_0x24be2e[_0xf282('0x30')]>0x0){_[_0xf282('0x31')](_0x24be2e,function(_0x59e9a8){if(_0x59e9a8['type']===_0xf282('0x32')&&_0x59e9a8[_0xf282('0x33')]&&!_0x59e9a8[_0xf282('0x34')]){_0x8134[_0x59e9a8[_0xf282('0x33')][_0xf282('0x35')]()]=_0x59e9a8[_0xf282('0x36')][_0xf282('0x2c')]();}else if(_0x59e9a8[_0xf282('0x37')]===_0xf282('0x32')&&_0x59e9a8[_0xf282('0x38')]&&_0x59e9a8['customField']){_0x8134[_0xf282('0x17')][_0xf282('0x39')]({'id':_0x59e9a8['idField'],'value':_0x59e9a8[_0xf282('0x36')]['toString']()});}else if(_0x59e9a8[_0xf282('0x37')]==='variable'&&_0x59e9a8[_0xf282('0x3a')]&&_0x59e9a8[_0xf282('0x38')]&&_0x59e9a8[_0xf282('0x34')]){_0x439960[_0x59e9a8['variableName']]&&_0x8134[_0xf282('0x17')][_0xf282('0x39')]({'id':_0x59e9a8['idField'],'value':_0x439960[_0x59e9a8['variableName']][_0xf282('0x2c')]()});}else if(_0x59e9a8[_0xf282('0x37')]===_0xf282('0x3b')&&_0x59e9a8[_0xf282('0x3c')]&&_0x59e9a8[_0xf282('0x3c')][_0xf282('0x15')]&&_0x59e9a8[_0xf282('0x38')]&&_0x59e9a8[_0xf282('0x34')]){_0x439960[_0x59e9a8[_0xf282('0x3c')][_0xf282('0x15')][_0xf282('0x35')]()]&&_0x8134['custom_fields'][_0xf282('0x39')]({'id':_0x59e9a8[_0xf282('0x38')],'value':_0x439960[_0x59e9a8[_0xf282('0x3c')][_0xf282('0x15')][_0xf282('0x35')]()]['toString']()});}});}return _0x8134;}exports[_0xf282('0x3d')]=function(_0x3ce1bc,_0x434f87,_0x179529,_0x363fe2,_0x33ef96,_0x30ce22){var _0x466a26,_0x2f46f3;_0x30ce22[_0xf282('0x1f')]=intUtil[_0xf282('0x3e')](_0x30ce22[_0xf282('0x1f')]);_0x30ce22[_0xf282('0x3f')]=intUtil[_0xf282('0x3e')](_0x30ce22['serverUrl']);if(_0x33ef96&&_0x33ef96['monitor_format']){logger[_0xf282('0x1c')](_0xf282('0x40'),_0xf282('0x41'));_0x434f87['recordingURL']=util[_0xf282('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30ce22['serverUrl'],_0x434f87['uniqueid'],md5(_0x434f87['uniqueid']));}else{_0x434f87[_0xf282('0x42')]='';}headers[_0xf282('0x43')]=getAuth(_0x30ce22);return getUser(_0x30ce22,_0x363fe2[_0xf282('0x22')])[_0xf282('0x1b')](function(_0x15752c){_0x466a26=_0x15752c;logger[_0xf282('0x1c')]('The\x20User\x20ID\x20is:',_0x466a26['id']);return getEndUser(_0x30ce22,_0x434f87[_0xf282('0x10')],_0x434f87['calleridnum']);})['then'](function(_0x196f36){_0x2f46f3=_0x196f36;logger[_0xf282('0x1c')](_0xf282('0x44'),_0x2f46f3['id']);return getTicket(_0x30ce22,_0x466a26,_0x2f46f3,_0x179529,_0x434f87);})[_0xf282('0x1b')](function(_0x199990){if(_0x199990&&_0x199990['id']){logger['info'](_0xf282('0x1d'));logger[_0xf282('0x1c')](_0xf282('0x45'),_0x199990['id']);logger[_0xf282('0x1c')](_0xf282('0x40'),_0xf282('0x46'));emit(util[_0xf282('0xe')](_0xf282('0x47'),_0x363fe2['name']),_0xf282('0x48'),{'uri':util[_0xf282('0xe')](_0xf282('0x49'),_0x30ce22['remoteUri'],_0x199990['id'])});}})[_0xf282('0x4a')](function(_0x53d179){logger[_0xf282('0x4b')](_0xf282('0x40'),JSON[_0xf282('0x4c')](_0x53d179));});};exports[_0xf282('0x4d')]=function(_0x16da9a,_0x105faa,_0x200bda,_0x211fa7,_0x23e4b7,_0x3979ad,_0x507889){var _0x5928e3,_0x57b3ff;_0x3979ad[_0xf282('0x1f')]=intUtil['stripTrailingSlash'](_0x3979ad['remoteUri']);_0x3979ad['serverUrl']=intUtil[_0xf282('0x3e')](_0x3979ad['serverUrl']);if(_0x507889&&_0x507889['recordingFormat']&&_0x507889[_0xf282('0x4e')]!=='none'){logger[_0xf282('0x1c')](_0xf282('0x4f'),_0xf282('0x41'));_0x105faa[_0xf282('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3979ad[_0xf282('0x3f')],_0x105faa[_0xf282('0x50')],md5(_0x105faa[_0xf282('0x50')]));}headers[_0xf282('0x43')]=getAuth(_0x3979ad);return getUser(_0x3979ad,_0x211fa7[_0xf282('0x22')])[_0xf282('0x1b')](function(_0x46ec74){_0x5928e3=_0x46ec74;logger[_0xf282('0x1c')](_0xf282('0x51'),_0x5928e3['id']);return getEndUser(_0x3979ad,_0x105faa['destcalleridname'],_0x105faa[_0xf282('0x52')]);})[_0xf282('0x1b')](function(_0xbc35e){_0x57b3ff=_0xbc35e;logger[_0xf282('0x1c')](_0xf282('0x44'),_0x57b3ff['id']);return getTicket(_0x3979ad,_0x5928e3,_0x57b3ff,_0x200bda,_0x105faa);})['then'](function(_0x2165b3){if(_0x2165b3&&_0x2165b3['id']){logger[_0xf282('0x1c')](_0xf282('0x1d'));logger['info'](_0xf282('0x45'),_0x2165b3['id']);logger['info'](_0xf282('0x4f'),_0xf282('0x46'));emit(util[_0xf282('0xe')](_0xf282('0x47'),_0x211fa7['name']),'trigger:browser:url',{'uri':util[_0xf282('0xe')](_0xf282('0x49'),_0x3979ad[_0xf282('0x1f')],_0x2165b3['id'])});}})['catch'](function(_0xa71266){logger[_0xf282('0x4b')](_0xf282('0x4f'),JSON[_0xf282('0x4c')](_0xa71266));});};exports[_0xf282('0x53')]=function(_0x14cb24,_0x1cf5c5,_0x24339a,_0x2de721,_0x30c864,_0x328c8a){var _0x2d14c3,_0xfa18b8;_0x328c8a[_0xf282('0x1f')]=intUtil[_0xf282('0x3e')](_0x328c8a[_0xf282('0x1f')]);_0x328c8a[_0xf282('0x3f')]=intUtil['stripTrailingSlash'](_0x328c8a[_0xf282('0x3f')]);if(_0x30c864&&_0x30c864['monitor_format']){logger[_0xf282('0x1c')]('['+_0x1cf5c5['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1cf5c5[_0xf282('0x42')]=util[_0xf282('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x328c8a[_0xf282('0x3f')],_0x1cf5c5['uniqueid'],md5(_0x1cf5c5['uniqueid']));}else{_0x1cf5c5['recordingURL']='';}headers[_0xf282('0x43')]=getAuth(_0x328c8a);return getUser(_0x328c8a,'')['then'](function(_0x4c3c7e){_0x2d14c3=_0x4c3c7e;logger[_0xf282('0x1c')](_0xf282('0x51'),_0x2d14c3['id']);return getEndUser(_0x328c8a,_0x1cf5c5[_0xf282('0x10')],_0x1cf5c5[_0xf282('0x54')]);})[_0xf282('0x1b')](function(_0x3a2dca){_0xfa18b8=_0x3a2dca;logger[_0xf282('0x1c')](_0xf282('0x44'),_0xfa18b8['id']);return getTicket(_0x328c8a,_0x2d14c3,_0xfa18b8,_0x24339a,_0x1cf5c5);})[_0xf282('0x1b')](function(_0x6b9366){if(_0x6b9366){logger[_0xf282('0x1c')]('Ticket\x20created!');logger['info'](_0xf282('0x45'),_0x6b9366['id']);}})['catch'](function(_0x49d66e){logger[_0xf282('0x4b')]('['+_0x1cf5c5[_0xf282('0x55')][_0xf282('0x56')]()+']',JSON[_0xf282('0x4c')](_0x49d66e));});}; \ 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 0851d40..184c8d1 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 _0xb889=['user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','User\x20found:','Admin\x20selected','catch','error','/api/contacts/filters','Getting\x20contacts\x20filter','name','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','Contact\x20found:','endUserId','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/'];(function(_0x447b8f,_0x396387){var _0x237474=function(_0x15ad47){while(--_0x15ad47){_0x447b8f['push'](_0x447b8f['shift']());}};_0x237474(++_0x396387);}(_0xb889,0x16f));var _0x9b88=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xb889[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x9b88('0x0'));var rp=require(_0x9b88('0x1'));var md5=require(_0x9b88('0x2'));var util=require(_0x9b88('0x3'));var moment=require('moment');var Promise=require(_0x9b88('0x4'));var Redis=require(_0x9b88('0x5'));var intUtil=require(_0x9b88('0x6'));var config=require(_0x9b88('0x7'));var logger=require(_0x9b88('0x8'))(_0x9b88('0x9'));config[_0x9b88('0xa')]=_[_0x9b88('0xb')](config[_0x9b88('0xa')],{'host':_0x9b88('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9b88('0xa')]));function getAdminId(_0x23b6f0,_0x143302,_0x17c1e6,_0x37fa10){return new Promise(function(_0x5c4fc4,_0x3c7b98){var _0x13c0d0=![];var _0x210ac1={'method':_0x9b88('0xd'),'uri':_0x37fa10+_0x9b88('0xe'),'json':!![]};_0x210ac1[_0x9b88('0xf')]=_0x17c1e6;logger[_0x9b88('0x10')](_0x9b88('0x11'));return rp(_0x210ac1)[_0x9b88('0x12')](function(_0x34f7d6){if(_0x34f7d6){var _0x4e5103=_0x34f7d6['users'];var _0x253efd=null;for(_0x253efd=0x0;_0x253efd<_0x4e5103['length'];_0x253efd++){if(_0x4e5103[_0x253efd]['email']===_0x23b6f0[_0x9b88('0x13')]){_0x23b6f0[_0x9b88('0x14')]=_0x4e5103[_0x253efd]['id'];_0x13c0d0=!![];}}if(_0x13c0d0){logger[_0x9b88('0x10')]('Admin\x20found:',_0x23b6f0[_0x9b88('0x14')]);_0x5c4fc4(_0x23b6f0);}else{_0x3c7b98({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3c7b98({'statusCode':0x194,'message':_0x9b88('0x15')});}})['catch'](function(_0x4bc3de){logger['error']('['+[_0x143302[_0x9b88('0x16')]()]+']',_0x4bc3de[_0x9b88('0x17')]);_0x3c7b98(_0x4bc3de);});});}function getUser(_0x199f55,_0x2d9556,_0x1eefac){return function(_0x42554d){return new Promise(function(_0x11a44f,_0x658142){var _0x18a90c={'method':_0x9b88('0xd'),'uri':_0x1eefac+'/api/selector/owners','json':!![]};_0x18a90c[_0x9b88('0xf')]=_0x2d9556;logger['info'](_0x9b88('0x18'));return rp(_0x18a90c)[_0x9b88('0x12')](function(_0x133ec2){if(_0x133ec2){var _0x447143=_0x133ec2[_0x9b88('0x19')];var _0x11fbd8=![];var _0x267bc2=null;if(_0x42554d[_0x9b88('0x1a')]!==null){logger[_0x9b88('0x10')](_0x9b88('0x1b'),_0x42554d['agentEmail']);_0x42554d[_0x9b88('0x1c')]=_0x42554d[_0x9b88('0x1a')];for(_0x267bc2=0x0;_0x267bc2<_0x447143[_0x9b88('0x1d')];_0x267bc2++){if(_0x447143[_0x267bc2][_0x9b88('0x1e')]===_0x42554d['agentEmail']){_0x11fbd8=!![];_0x42554d[_0x9b88('0x1f')]=_0x447143[_0x267bc2]['id'];logger[_0x9b88('0x10')](_0x9b88('0x20'),_0x42554d[_0x9b88('0x1f')]);}}}if(!_0x11fbd8){logger[_0x9b88('0x10')](_0x9b88('0x21'));_0x42554d[_0x9b88('0x1c')]=_0x42554d[_0x9b88('0x13')];_0x42554d[_0x9b88('0x1f')]=_0x42554d['adminId'];_0x11fbd8=!![];}if(_0x11fbd8){_0x11a44f(_0x42554d);}else{_0x658142({'statusCode':0x194,'message':_0x9b88('0x15')});}}else{_0x658142({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9b88('0x22')](function(_0x4e2544){logger[_0x9b88('0x23')]('['+[_0x199f55[_0x9b88('0x16')]()]+']',_0x4e2544['message']);_0x658142(_0x4e2544);});});};}function getEndUser(_0xda709e,_0x5b1366,_0x243c83){return function(_0x730586){return new Promise(function(_0x5b3142,_0x276164){var _0x977d05=0x0;var _0x587ed2={'method':'GET','uri':_0x243c83+_0x9b88('0x24'),'json':!![]};_0x587ed2[_0x9b88('0xf')]=_0x5b1366;logger['info'](_0x9b88('0x25'));return rp(_0x587ed2)[_0x9b88('0x12')](function(_0x20507d){_0x20507d['filters']['forEach'](function(_0x57c5b9){if(_0x57c5b9[_0x9b88('0x26')]==='All\x20Contacts'){_0x977d05=_0x57c5b9['id'];}});})[_0x9b88('0x12')](function(){logger[_0x9b88('0x10')](_0x9b88('0x27'));var _0x52b443={'method':_0x9b88('0xd'),'uri':_0x243c83+_0x9b88('0x28')+_0x977d05,'json':!![]};_0x52b443[_0x9b88('0xf')]=_0x5b1366;return rp(_0x52b443);})[_0x9b88('0x12')](function(_0x578e7b){logger[_0x9b88('0x10')](_0x9b88('0x29'),_0x730586[_0x9b88('0x2a')]);if(_0x578e7b[_0x9b88('0x2b')][_0x9b88('0x1d')]>0x0){var _0x163aba=_[_0x9b88('0x2c')](_0x578e7b[_0x9b88('0x2b')],function(_0x22992c){if(_0x22992c[_0x9b88('0x2d')]===_0x730586[_0x9b88('0x2a')]||_0x22992c['mobile_number']===_0x730586[_0x9b88('0x2a')]){return _0x22992c;}});if(_0x163aba){_0x730586['endUserId']=_0x163aba['id'];logger[_0x9b88('0x10')](_0x9b88('0x2e'),_0x730586[_0x9b88('0x2f')]);_0x5b3142(_0x730586);}else{return createEndUser(_0x730586,_0xda709e,_0x5b1366,_0x243c83)['then'](function(_0x5819d2){logger[_0x9b88('0x10')]('Contact\x20created:',_0x730586[_0x9b88('0x2f')]);_0x5b3142(_0x5819d2);});}}else{return createEndUser(_0x730586,_0xda709e,_0x5b1366,_0x243c83)[_0x9b88('0x12')](function(_0x52d1e8){logger[_0x9b88('0x10')]('Contact\x20created:',_0x730586['endUserId']);_0x5b3142(_0x52d1e8);});}})['catch'](function(_0x2f2ff6){throw new Error(_0x2f2ff6[_0x9b88('0x17')]);});});};}function createEndUser(_0x162f57,_0x4c8f8c,_0x98425,_0x5561c6){return new Promise(function(_0xf8bddd,_0x148426){var _0xd071=moment();var _0x2488af={'method':_0x9b88('0x30'),'uri':_0x5561c6+_0x9b88('0x31'),'body':{'contact':{'last_name':_0x162f57[_0x9b88('0x2a')],'work_number':_0x162f57[_0x9b88('0x2a')],'mobile_number':_0x162f57[_0x9b88('0x2a')],'owner_id':_0x162f57['userId'],'created_at':_0xd071[_0x9b88('0x32')](_0x9b88('0x33'))}},'json':!![]};_0x2488af[_0x9b88('0xf')]=_0x98425;logger[_0x9b88('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2488af)[_0x9b88('0x12')](function(_0x58461c){_0x162f57['endUserId']=_0x58461c[_0x9b88('0x34')]['id'];_0xf8bddd(_0x162f57);})[_0x9b88('0x22')](function(_0x2db369){logger[_0x9b88('0x23')]('['+[_0x4c8f8c[_0x9b88('0x16')]()]+']',_0x2db369[_0x9b88('0x17')]);_0x148426(_0x2db369[_0x9b88('0x17')]);});});}function getTicket(_0x452174,_0x18e1d1,_0x43e341,_0x37274c,_0x42c2c4){return function(_0x5c03bc){logger[_0x9b88('0x10')](_0x9b88('0x35'));return new Promise(function(_0x1226e7,_0x212bbf){var _0x1b1458=moment();var _0xa553bc={'method':'POST','uri':_0x43e341+_0x9b88('0x36'),'body':{'title':intUtil[_0x9b88('0x37')](_0x37274c['Subjects'],_0x42c2c4,'\x20'),'description':intUtil[_0x9b88('0x37')](_0x37274c[_0x9b88('0x38')],_0x42c2c4,'\x0a'),'owner_id':_0x5c03bc[_0x9b88('0x1f')],'creater_id':_0x5c03bc[_0x9b88('0x14')],'targetable_id':_0x5c03bc[_0x9b88('0x2f')],'targetable_type':_0x9b88('0x39'),'created_at':_0x1b1458['format'](_0x9b88('0x33')),'due_date':_0x1b1458[_0x9b88('0x3a')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0xa553bc[_0x9b88('0xf')]=_0x18e1d1;return rp(_0xa553bc)['then'](function(_0xa96e3f){_0x5c03bc['ticketId']=_0xa96e3f[_0x9b88('0x3b')]['id'];logger[_0x9b88('0x10')](_0x9b88('0x3c'),_0x5c03bc[_0x9b88('0x3d')]);_0x1226e7(_0x5c03bc);})[_0x9b88('0x22')](function(_0x39275f){logger[_0x9b88('0x23')]('['+[_0x452174[_0x9b88('0x16')]()]+']',_0x39275f['message']);_0x212bbf(_0x39275f[_0x9b88('0x17')]);});});};}function emit(_0x3a1168,_0x549978,_0x3537fd){var _0x41e7b1={'uri':_0x3a1168+_0x9b88('0x3e')+_0x3537fd};io['to'](util[_0x9b88('0x32')](_0x9b88('0x3f'),_0x549978))['emit'](_0x9b88('0x40'),_0x41e7b1);}exports['cs']=function(_0x168b78,_0x443c9b,_0x1fd343,_0x59b7b2,_0x5e448c,_0x65af72,_0x552848,_0x7e8b5f){var _0x123d23={};var _0x4021c7={'Authorization':_0x9b88('0x41')+_0x65af72[_0x9b88('0x42')]};_0x65af72[_0x9b88('0x43')]=intUtil[_0x9b88('0x44')](_0x65af72[_0x9b88('0x43')]);_0x65af72['serverUrl']=intUtil[_0x9b88('0x44')](_0x65af72[_0x9b88('0x45')]);var _0x5c0da3=_0x65af72[_0x9b88('0x43')];_0x123d23[_0x9b88('0x13')]=_0x65af72[_0x9b88('0x46')];_0x123d23[_0x9b88('0x2a')]=_0x7e8b5f[_0x9b88('0x47')]()===_0x9b88('0x48')?_0x443c9b['destcalleridnum']:_0x443c9b['calleridnum'];_0x123d23[_0x9b88('0x49')]=_0x7e8b5f===_0x9b88('0x4a')||_0x7e8b5f===_0x9b88('0x4b')?_0x9b88('0x4a'):_0x9b88('0x48');if(_0x59b7b2){_0x123d23[_0x9b88('0x1a')]=_0x59b7b2[_0x9b88('0x1e')];}var _0x542f7a=util[_0x9b88('0x32')](_0x9b88('0x4c'),_0x65af72[_0x9b88('0x45')],_0x443c9b[_0x9b88('0x4d')],md5(_0x443c9b[_0x9b88('0x4d')]));if(_0x5e448c&&_0x5e448c[_0x9b88('0x4e')]){logger[_0x9b88('0x10')]('[QUEUE]',_0x9b88('0x4f'));_0x443c9b['recordingURL']=_0x542f7a;}else if(_0x552848&&_0x552848[_0x9b88('0x50')]&&_0x552848[_0x9b88('0x50')]!==_0x9b88('0x51')){logger[_0x9b88('0x10')]('[OUTBOUND]',_0x9b88('0x4f'));_0x443c9b[_0x9b88('0x52')]=_0x542f7a;}else{_0x443c9b[_0x9b88('0x52')]='';}return getAdminId(_0x123d23,_0x7e8b5f,_0x4021c7,_0x5c0da3)[_0x9b88('0x12')](getUser(_0x7e8b5f,_0x4021c7,_0x5c0da3))[_0x9b88('0x12')](getEndUser(_0x7e8b5f,_0x4021c7,_0x5c0da3))['then'](getTicket(_0x7e8b5f,_0x4021c7,_0x5c0da3,_0x1fd343,_0x443c9b))['then'](function(_0x3c57df){logger[_0x9b88('0x10')](util[_0x9b88('0x32')](_0x9b88('0x53'),_0x3c57df[_0x9b88('0x3d')]));if(_0x7e8b5f!=='unmanaged'){logger[_0x9b88('0x10')]('['+[_0x7e8b5f['toUpperCase']()]+']',_0x9b88('0x54'));emit(_0x5c0da3,_0x59b7b2['name'],_0x3c57df['endUserId']);}})['catch'](function(_0x3ee602){logger['error']('['+[_0x7e8b5f[_0x9b88('0x16')]()]+_0x9b88('0x55'),util['inspect'](_0x3ee602,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x22cb=['error','message','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Contact','format','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','ioredis','freshsales','defaults','redis','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected'];(function(_0x3dafd1,_0x2ee4cc){var _0xd0d976=function(_0x42c614){while(--_0x42c614){_0x3dafd1['push'](_0x3dafd1['shift']());}};_0xd0d976(++_0x2ee4cc);}(_0x22cb,0x1ed));var _0xb22c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x22cb[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xb22c('0x0'));var rp=require(_0xb22c('0x1'));var md5=require('md5');var util=require(_0xb22c('0x2'));var moment=require('moment');var Promise=require(_0xb22c('0x3'));var Redis=require(_0xb22c('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb22c('0x5'));config['redis']=_[_0xb22c('0x6')](config[_0xb22c('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb22c('0x7')]));function getAdminId(_0x3d0bf2,_0x2bd1f5,_0x2b8173,_0x39a68d){return new Promise(function(_0x57be18,_0x5627a9){var _0x249aae=![];var _0x56e0bb={'method':'GET','uri':_0x39a68d+_0xb22c('0x8'),'json':!![]};_0x56e0bb[_0xb22c('0x9')]=_0x2b8173;logger[_0xb22c('0xa')](_0xb22c('0xb'));return rp(_0x56e0bb)[_0xb22c('0xc')](function(_0x219808){if(_0x219808){var _0x152303=_0x219808[_0xb22c('0xd')];var _0xd0789e=null;for(_0xd0789e=0x0;_0xd0789e<_0x152303['length'];_0xd0789e++){if(_0x152303[_0xd0789e]['email']===_0x3d0bf2[_0xb22c('0xe')]){_0x3d0bf2[_0xb22c('0xf')]=_0x152303[_0xd0789e]['id'];_0x249aae=!![];}}if(_0x249aae){logger[_0xb22c('0xa')](_0xb22c('0x10'),_0x3d0bf2[_0xb22c('0xf')]);_0x57be18(_0x3d0bf2);}else{_0x5627a9({'statusCode':0x194,'message':_0xb22c('0x11')});}}else{_0x5627a9({'statusCode':0x194,'message':_0xb22c('0x11')});}})[_0xb22c('0x12')](function(_0x5c65bf){logger['error']('['+[_0x2bd1f5[_0xb22c('0x13')]()]+']',_0x5c65bf['message']);_0x5627a9(_0x5c65bf);});});}function getUser(_0x24bbe5,_0x239f6c,_0x40ece8){return function(_0x4172fb){return new Promise(function(_0x460bc6,_0x211949){var _0x338bf9={'method':_0xb22c('0x14'),'uri':_0x40ece8+_0xb22c('0x8'),'json':!![]};_0x338bf9[_0xb22c('0x9')]=_0x239f6c;logger[_0xb22c('0xa')](_0xb22c('0x15'));return rp(_0x338bf9)[_0xb22c('0xc')](function(_0x2d8336){if(_0x2d8336){var _0x2bdc65=_0x2d8336[_0xb22c('0xd')];var _0x3b993a=![];var _0x5123c5=null;if(_0x4172fb[_0xb22c('0x16')]!==null){logger[_0xb22c('0xa')](_0xb22c('0x17'),_0x4172fb[_0xb22c('0x16')]);_0x4172fb[_0xb22c('0x18')]=_0x4172fb[_0xb22c('0x16')];for(_0x5123c5=0x0;_0x5123c5<_0x2bdc65[_0xb22c('0x19')];_0x5123c5++){if(_0x2bdc65[_0x5123c5]['email']===_0x4172fb[_0xb22c('0x16')]){_0x3b993a=!![];_0x4172fb[_0xb22c('0x1a')]=_0x2bdc65[_0x5123c5]['id'];logger[_0xb22c('0xa')](_0xb22c('0x1b'),_0x4172fb[_0xb22c('0x1a')]);}}}if(!_0x3b993a){logger[_0xb22c('0xa')](_0xb22c('0x1c'));_0x4172fb['userEmail']=_0x4172fb[_0xb22c('0xe')];_0x4172fb['userId']=_0x4172fb[_0xb22c('0xf')];_0x3b993a=!![];}if(_0x3b993a){_0x460bc6(_0x4172fb);}else{_0x211949({'statusCode':0x194,'message':_0xb22c('0x11')});}}else{_0x211949({'statusCode':0x194,'message':_0xb22c('0x11')});}})[_0xb22c('0x12')](function(_0x5159a3){logger[_0xb22c('0x1d')]('['+[_0x24bbe5[_0xb22c('0x13')]()]+']',_0x5159a3[_0xb22c('0x1e')]);_0x211949(_0x5159a3);});});};}function getEndUser(_0x5adf78,_0x30ba84,_0x142f2e){return function(_0x102991){return new Promise(function(_0x601a04,_0x59871d){var _0x399107=0x0;var _0x3063d0={'method':_0xb22c('0x14'),'uri':_0x142f2e+'/api/contacts/filters','json':!![]};_0x3063d0[_0xb22c('0x9')]=_0x30ba84;logger[_0xb22c('0xa')](_0xb22c('0x1f'));return rp(_0x3063d0)[_0xb22c('0xc')](function(_0x5f0dad){_0x5f0dad[_0xb22c('0x20')][_0xb22c('0x21')](function(_0x338b73){if(_0x338b73[_0xb22c('0x22')]===_0xb22c('0x23')){_0x399107=_0x338b73['id'];}});})['then'](function(){logger[_0xb22c('0xa')](_0xb22c('0x24'));var _0x265b54={'method':_0xb22c('0x14'),'uri':_0x142f2e+_0xb22c('0x25')+_0x399107,'json':!![]};_0x265b54[_0xb22c('0x9')]=_0x30ba84;return rp(_0x265b54);})['then'](function(_0x15fe1d){logger[_0xb22c('0xa')](_0xb22c('0x26'),_0x102991[_0xb22c('0x27')]);if(_0x15fe1d[_0xb22c('0x28')][_0xb22c('0x19')]>0x0){var _0x1d708d=_[_0xb22c('0x29')](_0x15fe1d['contacts'],function(_0x3d48f2){if(_0x3d48f2[_0xb22c('0x2a')]===_0x102991[_0xb22c('0x27')]||_0x3d48f2[_0xb22c('0x2b')]===_0x102991[_0xb22c('0x27')]){return _0x3d48f2;}});if(_0x1d708d){_0x102991[_0xb22c('0x2c')]=_0x1d708d['id'];logger[_0xb22c('0xa')](_0xb22c('0x2d'),_0x102991[_0xb22c('0x2c')]);_0x601a04(_0x102991);}else{return createEndUser(_0x102991,_0x5adf78,_0x30ba84,_0x142f2e)['then'](function(_0x111481){logger[_0xb22c('0xa')](_0xb22c('0x2e'),_0x102991[_0xb22c('0x2c')]);_0x601a04(_0x111481);});}}else{return createEndUser(_0x102991,_0x5adf78,_0x30ba84,_0x142f2e)[_0xb22c('0xc')](function(_0x11767b){logger[_0xb22c('0xa')](_0xb22c('0x2e'),_0x102991[_0xb22c('0x2c')]);_0x601a04(_0x11767b);});}})[_0xb22c('0x12')](function(_0x21ec17){throw new Error(_0x21ec17[_0xb22c('0x1e')]);});});};}function createEndUser(_0x4c5e10,_0x28782d,_0xd1c9a7,_0x3fa92d){return new Promise(function(_0x53df7e,_0x29cc2a){var _0x494315=moment();var _0x4cb756={'method':'POST','uri':_0x3fa92d+_0xb22c('0x2f'),'body':{'contact':{'last_name':_0x4c5e10['contactNumber'],'work_number':_0x4c5e10['contactNumber'],'mobile_number':_0x4c5e10[_0xb22c('0x27')],'owner_id':_0x4c5e10[_0xb22c('0x1a')],'created_at':_0x494315['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4cb756[_0xb22c('0x9')]=_0xd1c9a7;logger['info'](_0xb22c('0x30'));return rp(_0x4cb756)[_0xb22c('0xc')](function(_0x51cda8){_0x4c5e10[_0xb22c('0x2c')]=_0x51cda8[_0xb22c('0x31')]['id'];_0x53df7e(_0x4c5e10);})[_0xb22c('0x12')](function(_0xeb2c26){logger[_0xb22c('0x1d')]('['+[_0x28782d[_0xb22c('0x13')]()]+']',_0xeb2c26['message']);_0x29cc2a(_0xeb2c26[_0xb22c('0x1e')]);});});}function getTicket(_0x32d850,_0x441151,_0x47f171,_0x1e8895,_0x1988f0){return function(_0x37d3a6){logger[_0xb22c('0xa')](_0xb22c('0x32'));return new Promise(function(_0x425448,_0x553317){var _0x3c62b9=moment();var _0x3fb662={'method':'POST','uri':_0x47f171+'/api/tasks','body':{'title':intUtil[_0xb22c('0x33')](_0x1e8895['Subjects'],_0x1988f0,'\x20'),'description':intUtil[_0xb22c('0x33')](_0x1e8895['Descriptions'],_0x1988f0,'\x0a'),'owner_id':_0x37d3a6[_0xb22c('0x1a')],'creater_id':_0x37d3a6['adminId'],'targetable_id':_0x37d3a6[_0xb22c('0x2c')],'targetable_type':_0xb22c('0x34'),'created_at':_0x3c62b9[_0xb22c('0x35')](_0xb22c('0x36')),'due_date':_0x3c62b9[_0xb22c('0x37')](0x1e,'m')[_0xb22c('0x35')](_0xb22c('0x36'))},'json':!![]};_0x3fb662[_0xb22c('0x9')]=_0x441151;return rp(_0x3fb662)['then'](function(_0x11227b){_0x37d3a6[_0xb22c('0x38')]=_0x11227b[_0xb22c('0x39')]['id'];logger[_0xb22c('0xa')](_0xb22c('0x3a'),_0x37d3a6[_0xb22c('0x38')]);_0x425448(_0x37d3a6);})[_0xb22c('0x12')](function(_0x47a5e0){logger['error']('['+[_0x32d850['toUpperCase']()]+']',_0x47a5e0['message']);_0x553317(_0x47a5e0[_0xb22c('0x1e')]);});});};}function emit(_0x270972,_0x4cbfb9,_0x395330){var _0x5da658={'uri':_0x270972+_0xb22c('0x3b')+_0x395330};io['to'](util[_0xb22c('0x35')](_0xb22c('0x3c'),_0x4cbfb9))[_0xb22c('0x3d')](_0xb22c('0x3e'),_0x5da658);}exports['cs']=function(_0x36d301,_0x5056e5,_0x4826c5,_0x4fa473,_0x2a6373,_0x5d58d2,_0x446cb5,_0x637fe2){var _0x338315={};var _0x5de574={'Authorization':_0xb22c('0x3f')+_0x5d58d2[_0xb22c('0x40')]};_0x5d58d2[_0xb22c('0x41')]=intUtil[_0xb22c('0x42')](_0x5d58d2['remoteUri']);_0x5d58d2[_0xb22c('0x43')]=intUtil[_0xb22c('0x42')](_0x5d58d2[_0xb22c('0x43')]);var _0x543a05=_0x5d58d2[_0xb22c('0x41')];_0x338315[_0xb22c('0xe')]=_0x5d58d2[_0xb22c('0x44')];_0x338315[_0xb22c('0x27')]=_0x637fe2['toLowerCase']()===_0xb22c('0x45')?_0x5056e5[_0xb22c('0x46')]:_0x5056e5[_0xb22c('0x47')];_0x338315[_0xb22c('0x48')]=_0x637fe2===_0xb22c('0x49')||_0x637fe2===_0xb22c('0x4a')?_0xb22c('0x49'):_0xb22c('0x45');if(_0x4fa473){_0x338315['agentEmail']=_0x4fa473['email'];}var _0x50effb=util[_0xb22c('0x35')](_0xb22c('0x4b'),_0x5d58d2[_0xb22c('0x43')],_0x5056e5[_0xb22c('0x4c')],md5(_0x5056e5[_0xb22c('0x4c')]));if(_0x2a6373&&_0x2a6373[_0xb22c('0x4d')]){logger[_0xb22c('0xa')](_0xb22c('0x4e'),'Recording\x20is\x20enabled!');_0x5056e5[_0xb22c('0x4f')]=_0x50effb;}else if(_0x446cb5&&_0x446cb5[_0xb22c('0x50')]&&_0x446cb5[_0xb22c('0x50')]!==_0xb22c('0x51')){logger[_0xb22c('0xa')](_0xb22c('0x52'),_0xb22c('0x53'));_0x5056e5[_0xb22c('0x4f')]=_0x50effb;}else{_0x5056e5['recordingURL']='';}return getAdminId(_0x338315,_0x637fe2,_0x5de574,_0x543a05)[_0xb22c('0xc')](getUser(_0x637fe2,_0x5de574,_0x543a05))['then'](getEndUser(_0x637fe2,_0x5de574,_0x543a05))['then'](getTicket(_0x637fe2,_0x5de574,_0x543a05,_0x4826c5,_0x5056e5))['then'](function(_0xa6a443){logger[_0xb22c('0xa')](util[_0xb22c('0x35')](_0xb22c('0x54'),_0xa6a443[_0xb22c('0x38')]));if(_0x637fe2!==_0xb22c('0x4a')){logger['info']('['+[_0x637fe2[_0xb22c('0x13')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x543a05,_0x4fa473[_0xb22c('0x22')],_0xa6a443[_0xb22c('0x2c')]);}})[_0xb22c('0x12')](function(_0x5bf9cf){logger[_0xb22c('0x1d')]('['+[_0x637fe2['toUpperCase']()]+_0xb22c('0x55'),util[_0xb22c('0x56')](_0x5bf9cf,{'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 9288ade..90cf81e 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 _0xda3f=['outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data2','util','./zendesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3'];(function(_0x47517e,_0x59d6eb){var _0x360a08=function(_0x246bb8){while(--_0x246bb8){_0x47517e['push'](_0x47517e['shift']());}};_0x360a08(++_0x59d6eb);}(_0xda3f,0xec));var _0xfda3=function(_0x32c3a8,_0x363fd0){_0x32c3a8=_0x32c3a8-0x0;var _0xa0846f=_0xda3f[_0x32c3a8];return _0xa0846f;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var zendesk=require(_0xfda3('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfda3('0x2'));var desk=require('./desk');var vtiger=require(_0xfda3('0x3'));var servicenow=require(_0xfda3('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfda3('0x5'));var integrations=[_0xfda3('0x6'),'salesforce','sugarcrm',_0xfda3('0x7'),_0xfda3('0x8'),_0xfda3('0x9'),_0xfda3('0xa'),_0xfda3('0xb'),_0xfda3('0xc'),_0xfda3('0xd')];exports[_0xfda3('0xe')]=function(_0xdc5b45,_0x14d549,_0x102643,_0x4713ba,_0x4d7841,_0xe933f5){if(_0x102643){if(_[_0xfda3('0xf')](integrations,_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]())){try{var _0x1443f4=null;var _0x4b77ea='';var _0x583125=_0x102643[_0xdc5b45['data1'][_0xfda3('0x11')]()];if(_0x583125){var _0x1e7a55=_0x583125[_0xdc5b45['data2']];if(_0x1e7a55){var _0x501588=_['find'](_0x1e7a55[_0xfda3('0x12')],{'id':parseInt(_0xdc5b45[_0xfda3('0x13')],0xa)});if(_0x501588){if(_0x4713ba){if(_0x4d7841&&_0x14d549['queue']){_0x4b77ea='queue';}else if(_0x14d549['routeId']){_0x4b77ea=_0xfda3('0x14');}else{console[_0xfda3('0x15')](_0xfda3('0x16'),_0x14d549);}}else{_0x4b77ea=_0xfda3('0x17');}switch(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]()){case _0xfda3('0x6'):zendesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x18'):salesforce[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x19'):sugarcrm[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x7'):freshdesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case'zoho':zoho[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x9'):desk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xa'):vtiger[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xc'):freshsales['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case _0xfda3('0xd'):servicenow['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case'dynamics365':dynamics365['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;default:console[_0xfda3('0x15')](_0xfda3('0x1a'));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45['data1']['toLowerCase']());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x13')]));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x1f')]));}}else{}}catch(_0x4ae9b9){console[_0xfda3('0x1c')](_0x4ae9b9);}}}}; \ No newline at end of file +var _0xb7e7=['data1','toLowerCase','data2','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','zendesk','zoho','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb7e7[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var zendesk=require(_0x7b7e('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x7b7e('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x7b7e('0x3'));var desk=require('./desk');var vtiger=require(_0x7b7e('0x4'));var servicenow=require(_0x7b7e('0x5'));var dynamics365=require(_0x7b7e('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x7b7e('0x7'),_0x7b7e('0x8'),_0x7b7e('0x9'),'zoho',_0x7b7e('0xa'),_0x7b7e('0xb'),_0x7b7e('0xc'),_0x7b7e('0xd'),_0x7b7e('0xe')];exports[_0x7b7e('0xf')]=function(_0x242e70,_0x52de3b,_0x299519,_0x1eef0a,_0x10a666,_0x29b622){if(_0x299519){if(_[_0x7b7e('0x10')](integrations,_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')]())){try{var _0x55620b=null;var _0xaadda='';var _0x54d8ce=_0x299519[_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')]()];if(_0x54d8ce){var _0x50d7d2=_0x54d8ce[_0x242e70[_0x7b7e('0x13')]];if(_0x50d7d2){var _0x5976ac=_['find'](_0x50d7d2[_0x7b7e('0x14')],{'id':parseInt(_0x242e70[_0x7b7e('0x15')],0xa)});if(_0x5976ac){if(_0x1eef0a){if(_0x10a666&&_0x52de3b[_0x7b7e('0x16')]){_0xaadda=_0x7b7e('0x16');}else if(_0x52de3b[_0x7b7e('0x17')]){_0xaadda='outbound';}else{console['log'](_0x7b7e('0x18'),_0x52de3b);}}else{_0xaadda=_0x7b7e('0x19');}switch(_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')]()){case _0x7b7e('0x1a'):zendesk[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0x7'):salesforce[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0x8'):sugarcrm[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0x9'):freshdesk[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0x1b'):zoho[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0xa'):desk[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0xb'):vtiger[_0xaadda](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622);break;case _0x7b7e('0xd'):freshsales['cs'](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622,_0xaadda);break;case _0x7b7e('0xe'):servicenow['cs'](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622,_0xaadda);break;case _0x7b7e('0xc'):dynamics365['cs'](_0x242e70,_0x52de3b,_0x5976ac,_0x1eef0a,_0x10a666,_0x50d7d2,_0x29b622,_0xaadda);break;default:console[_0x7b7e('0x1c')](_0x7b7e('0x1d'));}}else{_0x55620b=require(_0x7b7e('0x1e'))(_0x242e70['data1'][_0x7b7e('0x12')]());_0x55620b[_0x7b7e('0x1f')](_0x7b7e('0x20'),util['format'](_0x7b7e('0x21'),_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')](),_0x242e70[_0x7b7e('0x15')]));}}else{_0x55620b=require(_0x7b7e('0x1e'))(_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')]());_0x55620b[_0x7b7e('0x1f')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x242e70[_0x7b7e('0x11')][_0x7b7e('0x12')](),_0x242e70[_0x7b7e('0x13')]));}}else{}}catch(_0x483c6f){console['error'](_0x483c6f);}}}}; \ 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 df68bd9..03401ff 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 _0x94c4=['username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','stringify','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','monitor_format','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Descriptions','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','User','find','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','execute','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','upperFirst','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x94c4,0x9f));var _0x494c=function(_0x25669c,_0x3163ce){_0x25669c=_0x25669c-0x0;var _0x5c5284=_0x94c4[_0x25669c];return _0x5c5284;};'use strict';var _=require(_0x494c('0x0'));var rp=require(_0x494c('0x1'));var moment=require('moment');var BPromise=require(_0x494c('0x2'));var md5=require(_0x494c('0x3'));var jsforce=require(_0x494c('0x4'));var util=require(_0x494c('0x5'));var Redis=require(_0x494c('0x6'));var intUtil=require(_0x494c('0x7'));var config=require('../../../../config/environment');var logger=require(_0x494c('0x8'))(_0x494c('0x9'));config[_0x494c('0xa')]=_[_0x494c('0xb')](config[_0x494c('0xa')],{'host':_0x494c('0xc'),'port':0x18eb});var io=require(_0x494c('0xd'))(new Redis(config[_0x494c('0xa')]));function emit(_0x5a94ef,_0x16a397,_0x567b02){io['to'](_0x5a94ef)['emit'](_0x16a397,_0x567b02);}function getTicket(_0x4fe4d1,_0x243108,_0x41ef8c,_0x4b3651,_0x48665d,_0x5e3312,_0x18a8f5,_0x3b1a74){var _0x2e1b38={};if(_0x4b3651[_0x494c('0xe')]===_0x494c('0xf')){_0x2e1b38=Object[_0x494c('0x10')]({},{'OwnerId':_0x243108['id'],'ActivityDate':moment[_0x494c('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x494c('0x12')](_0x4b3651['Subjects'],_0x48665d,'\x20'),'Description':intUtil['getString'](_0x4b3651[_0x494c('0x13')],_0x48665d,'\x0a')},getCustomFields(_0x5e3312,_0x48665d));if(_0x41ef8c){_0x2e1b38['WhoId']=_0x41ef8c['id'];}}else if(_0x4b3651[_0x494c('0xe')]===_0x494c('0x14')){_0x2e1b38=Object[_0x494c('0x10')]({},{'OwnerId':_0x243108['id'],'Subject':intUtil['getString'](_0x4b3651[_0x494c('0x15')],_0x48665d,'\x20'),'Description':intUtil['getString'](_0x4b3651[_0x494c('0x13')],_0x48665d,'\x0a')},getCustomFields(_0x5e3312,_0x48665d));if(_0x41ef8c){_0x2e1b38[_0x494c('0x16')]=_0x41ef8c['id'];}}return _0x18a8f5[_0x494c('0x17')](_0x4b3651[_0x494c('0xe')])[_0x494c('0x18')](_0x2e1b38);}function getUser(_0x1e7940,_0x4215a7,_0x452a59){if(!_[_0x494c('0x19')](_0x4215a7)&&intUtil[_0x494c('0x1a')](_0x4215a7)){var _0x101286={'Email':_0x4215a7};var _0x554ee4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x452a59[_0x494c('0x17')](_0x494c('0x1b'))[_0x494c('0x1c')](_0x101286,_0x554ee4)['execute']()['then'](function(_0xaaff10){if(_0xaaff10[_0x494c('0x1d')]){var _0x4c5fe7=_[_0x494c('0x1c')](_0xaaff10,function(_0x59057a){return _0x59057a[_0x494c('0x1e')]===_0x4215a7;});if(_0x4c5fe7){logger[_0x494c('0x1f')]('Agent\x20%s\x20found.',_0x4215a7);return BPromise[_0x494c('0x20')]({'id':_0x4c5fe7['Id'],'name':_0x4c5fe7[_0x494c('0x21')]});}}else{logger[_0x494c('0x1f')](_0x494c('0x22'),_0x4215a7);return _0x452a59['identity']()[_0x494c('0x23')](function(_0x21b147){return BPromise['resolve']({'id':_0x21b147[_0x494c('0x24')],'name':_0x21b147['display_name']});});}});}else{logger[_0x494c('0x1f')](_0x494c('0x22'),_0x4215a7);return _0x452a59[_0x494c('0x25')]()[_0x494c('0x23')](function(_0x5059c6){return BPromise[_0x494c('0x20')]({'id':_0x5059c6[_0x494c('0x24')],'name':_0x5059c6['display_name']});});}}function getEndUser(_0x4f836d,_0x64a520,_0x5df66b,_0xc30371,_0x48cec7){var _0x39c9bf={'Phone':_0xc30371};var _0x4eb134={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x494c('0x20')]()[_0x494c('0x23')](function(){if(_0x64a520[_0x494c('0xe')]===_0x494c('0xf')){logger[_0x494c('0x1f')](_0x494c('0x26'),_0xc30371,_0x64a520[_0x494c('0x27')]);switch(_0x64a520[_0x494c('0x27')]){case _0x494c('0x28'):return _0x48cec7[_0x494c('0x17')](_0x494c('0x29'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)['execute']()['then'](function(_0x4555fd){if(_0x4555fd&&_0x4555fd[_0x494c('0x1d')]){return _0x4555fd;}else{return _0x48cec7[_0x494c('0x17')](_0x494c('0x2a'))['find'](_0x39c9bf,_0x4eb134);}});case _0x494c('0x2b'):return _0x48cec7[_0x494c('0x17')](_0x494c('0x29'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)[_0x494c('0x2c')]();case'lead':return _0x48cec7[_0x494c('0x17')](_0x494c('0x2a'))[_0x494c('0x1c')](_0x39c9bf,_0x4eb134);default:return null;}}else if(_0x64a520[_0x494c('0xe')]==='Case'){logger['info'](_0x494c('0x26'),_0xc30371,_0x494c('0x2b'));return _0x48cec7[_0x494c('0x17')]('Contact')[_0x494c('0x1c')](_0x39c9bf,_0x4eb134)['execute']();}})[_0x494c('0x23')](function(_0x587127){if(_0x587127&&_0x587127[_0x494c('0x1d')]){var _0x6149d2=_['find'](_0x587127,function(_0x359ea5){return _0x359ea5['Phone']===_0xc30371;});if(_0x6149d2){return BPromise[_0x494c('0x20')]({'id':_0x6149d2['Id'],'name':_0x6149d2[_0x494c('0x21')],'phone':_0x6149d2[_0x494c('0x2d')]});}}})[_0x494c('0x23')](function(_0x3c60cd){if(_0x3c60cd){logger[_0x494c('0x1f')](_0x494c('0x2e'),_0xc30371);return BPromise[_0x494c('0x20')](_0x3c60cd);}else{logger[_0x494c('0x1f')](_0x494c('0x2f'),_0xc30371);var _0x596697={'LastName':_0x5df66b!==''?_0x5df66b:util['format'](_0x494c('0x30'),_0xc30371),'Phone':_0xc30371};if(_0x64a520[_0x494c('0x31')]){if(_0x64a520[_0x494c('0x31')]==='contact'){logger[_0x494c('0x1f')](_0x494c('0x32'),_0xc30371,_0x64a520[_0x494c('0x31')]);}else if(_0x64a520[_0x494c('0x31')]===_0x494c('0x33')&&_0x64a520[_0x494c('0xe')]==='Task'){logger[_0x494c('0x1f')](_0x494c('0x32'),_0xc30371,_0x64a520[_0x494c('0x31')]);_0x596697[_0x494c('0x34')]='No\x20Company';}else{return null;}}return _0x48cec7[_0x494c('0x17')](_[_0x494c('0x35')](_0x64a520[_0x494c('0x31')]))[_0x494c('0x18')](_0x596697);}});}function getCustomFields(_0x242c86,_0x10a147){var _0x23f321={};if(_0x242c86[_0x494c('0x1d')]>0x0){_['forEach'](_0x242c86,function(_0x16ceb3){if(_0x16ceb3['type']===_0x494c('0x36')&&_0x16ceb3[_0x494c('0x37')]){_0x23f321[_0x16ceb3[_0x494c('0x37')]]=_0x16ceb3[_0x494c('0x38')]['toString']();}else if(_0x16ceb3[_0x494c('0x39')]===_0x494c('0x3a')&&_0x16ceb3['variableName']&&_0x16ceb3[_0x494c('0x37')]){_0x10a147[_0x16ceb3['variableName']]&&(_0x23f321[_0x16ceb3['idField']]=_0x10a147[_0x16ceb3[_0x494c('0x3b')]][_0x494c('0x3c')]());}else if(_0x16ceb3[_0x494c('0x39')]===_0x494c('0x3d')&&_0x16ceb3[_0x494c('0x3e')]&&_0x16ceb3[_0x494c('0x3e')]['name']&&_0x16ceb3[_0x494c('0x37')]){_0x10a147[_0x16ceb3['Variable'][_0x494c('0x3f')][_0x494c('0x40')]()]&&(_0x23f321[_0x16ceb3[_0x494c('0x37')]]=_0x10a147[_0x16ceb3['Variable'][_0x494c('0x3f')][_0x494c('0x40')]()]['toString']());}});}return _0x23f321;}function getConnection(_0x37b576){var _0x356785=_0x37b576[_0x494c('0x41')][_0x494c('0x42')](_0x37b576[_0x494c('0x43')]);var _0x5d9dd8=new jsforce[(_0x494c('0x44'))]({'oauth2':{'loginUrl':_0x37b576['remoteUri']||_0x494c('0x45'),'clientId':_0x37b576[_0x494c('0x46')],'clientSecret':_0x37b576[_0x494c('0x47')]}});return _0x5d9dd8[_0x494c('0x48')](_0x37b576[_0x494c('0x49')],_0x356785)[_0x494c('0x23')](function(){logger[_0x494c('0x1f')](_0x494c('0x4a'));return _0x5d9dd8;});}exports[_0x494c('0x4b')]=function(_0x3a1596,_0x14983b,_0x110b2b,_0x4eaa23,_0x1dbe36,_0x2e4ab2){var _0x33e1c7,_0x428672,_0xbd2493,_0x50b638;_0x2e4ab2['serverUrl']=intUtil[_0x494c('0x4c')](_0x2e4ab2[_0x494c('0x4d')]);_0x2e4ab2['remoteUri']=intUtil['stripTrailingSlash'](_0x2e4ab2[_0x494c('0x4e')]);if(_0x1dbe36&&_0x1dbe36['monitor_format']){logger[_0x494c('0x1f')](_0x494c('0x4f'),_0x494c('0x50'));_0x14983b[_0x494c('0x51')]=util[_0x494c('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e4ab2[_0x494c('0x4d')],_0x14983b[_0x494c('0x53')],md5(_0x14983b[_0x494c('0x53')]));}else{_0x14983b[_0x494c('0x51')]='';}return getConnection(_0x2e4ab2)['then'](function(_0x10f7e2){_0x50b638=_0x10f7e2;return getUser(_0x2e4ab2,_0x4eaa23['email'],_0x50b638);})[_0x494c('0x23')](function(_0x93b920){_0x33e1c7=_0x93b920;return getEndUser(_0x2e4ab2,_0x110b2b,_0x14983b[_0x494c('0x54')],_0x14983b['calleridnum'],_0x50b638);})['then'](function(_0x45952b){_0x428672=_0x45952b;return getTicket(_0x2e4ab2,_0x33e1c7,_0x428672,_0x110b2b,_0x14983b,_0x110b2b[_0x494c('0x55')],_0x50b638,_0x494c('0x4b'));})[_0x494c('0x23')](function(_0x4061f4){_0xbd2493=_0x4061f4;logger[_0x494c('0x1f')](_0x494c('0x56'),_0xbd2493['id']);logger[_0x494c('0x1f')](_0x494c('0x57'),_0xbd2493['id'],_0x4eaa23[_0x494c('0x3f')],_0x2e4ab2[_0x494c('0x39')]);switch(_0x2e4ab2[_0x494c('0x39')]){case _0x494c('0x58'):emit(util[_0x494c('0x52')](_0x494c('0x59'),_0x4eaa23[_0x494c('0x3f')]),'trigger:salesforce:display',{'recordId':_0xbd2493['id']});break;case _0x494c('0x5a'):emit(util[_0x494c('0x52')]('user:%s',_0x4eaa23[_0x494c('0x3f')]),_0x494c('0x5b'),{'uri':util[_0x494c('0x52')](_0x494c('0x5c'),_0x50b638['instanceUrl'],_0xbd2493['id'])});break;default:logger['error'](_0x494c('0x5d'));}})['catch'](function(_0x2eb3fe){logger[_0x494c('0x5e')](_0x494c('0x4f'),JSON[_0x494c('0x5f')](_0x2eb3fe));});};exports['outbound']=function(_0x4a3426,_0x4df406,_0x19af97,_0x1df8ef,_0x2e271,_0x29f88b,_0x1b909a){var _0x4b5ea4,_0x2a7a6b,_0x49b57c,_0x24a52f;_0x29f88b[_0x494c('0x4d')]=intUtil[_0x494c('0x4c')](_0x29f88b[_0x494c('0x4d')]);_0x29f88b[_0x494c('0x4e')]=intUtil[_0x494c('0x4c')](_0x29f88b['remoteUri']);if(_0x1b909a&&_0x1b909a[_0x494c('0x60')]&&_0x1b909a['recordingFormat']!=='none'){logger[_0x494c('0x1f')](_0x494c('0x61'),_0x494c('0x50'));_0x4df406[_0x494c('0x51')]=util[_0x494c('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29f88b[_0x494c('0x4d')],_0x4df406[_0x494c('0x53')],md5(_0x4df406['uniqueid']));}return getConnection(_0x29f88b)[_0x494c('0x23')](function(_0x1bd0bf){_0x24a52f=_0x1bd0bf;return getUser(_0x29f88b,_0x1df8ef[_0x494c('0x62')],_0x24a52f);})[_0x494c('0x23')](function(_0x192bf3){_0x4b5ea4=_0x192bf3;return getEndUser(_0x29f88b,_0x19af97,_0x4df406[_0x494c('0x63')],_0x4df406[_0x494c('0x64')],_0x24a52f);})[_0x494c('0x23')](function(_0x376f19){_0x2a7a6b=_0x376f19;return getTicket(_0x29f88b,_0x4b5ea4,_0x2a7a6b,_0x19af97,_0x4df406,_0x19af97[_0x494c('0x55')],_0x24a52f,_0x494c('0x65'));})[_0x494c('0x23')](function(_0x1ce13c){_0x49b57c=_0x1ce13c;logger[_0x494c('0x1f')](_0x494c('0x66'),_0x49b57c['id']);logger[_0x494c('0x1f')](_0x494c('0x67'),_0x49b57c['id'],_0x1df8ef['name'],_0x29f88b[_0x494c('0x39')]);switch(_0x29f88b[_0x494c('0x39')]){case _0x494c('0x58'):emit(util[_0x494c('0x52')]('user:%s',_0x1df8ef[_0x494c('0x3f')]),_0x494c('0x68'),{'recordId':_0x49b57c['id']});break;case _0x494c('0x5a'):emit(util[_0x494c('0x52')]('user:%s',_0x1df8ef[_0x494c('0x3f')]),_0x494c('0x5b'),{'uri':util['format']('%s/%s/e',_0x24a52f[_0x494c('0x69')],_0x49b57c['id'])});break;default:logger[_0x494c('0x5e')](_0x494c('0x61'),_0x494c('0x6a'));}})[_0x494c('0x6b')](function(_0x519df7){logger[_0x494c('0x5e')]('[OUTBOUND]',JSON['stringify'](_0x519df7));});};exports[_0x494c('0x6c')]=function(_0x59393c,_0x1f1d5c,_0x1bfa64,_0x5b1fc9,_0x1bdc5d,_0x335add){var _0x2e74dc,_0x2dc42a,_0x35b695,_0x28310c;_0x335add[_0x494c('0x4d')]=intUtil['stripTrailingSlash'](_0x335add[_0x494c('0x4d')]);_0x335add['remoteUri']=intUtil[_0x494c('0x4c')](_0x335add[_0x494c('0x4e')]);if(_0x1bdc5d&&_0x1bdc5d[_0x494c('0x6d')]){logger['info']('['+_0x1f1d5c[_0x494c('0x6e')][_0x494c('0x6f')]()+']',_0x494c('0x50'));_0x1f1d5c[_0x494c('0x51')]=util[_0x494c('0x52')](_0x494c('0x70'),_0x335add[_0x494c('0x4d')],_0x1f1d5c[_0x494c('0x53')],md5(_0x1f1d5c['uniqueid']));}else{_0x1f1d5c['recordingURL']='';}return getConnection(_0x335add)[_0x494c('0x23')](function(_0x4994f2){_0x28310c=_0x4994f2;if(!_[_0x494c('0x19')](_0x5b1fc9)){return getUser(_0x335add,_0x5b1fc9[_0x494c('0x3f')],_0x28310c);}else{return getUser(_0x335add,null,_0x28310c);}})[_0x494c('0x23')](function(_0x38b464){_0x2e74dc=_0x38b464;return getEndUser(_0x335add,_0x1bfa64,_0x1f1d5c[_0x494c('0x54')],_0x1f1d5c[_0x494c('0x71')],_0x28310c);})['then'](function(_0x3ef082){_0x2dc42a=_0x3ef082;return getTicket(_0x335add,_0x2e74dc,_0x2dc42a,_0x1bfa64,_0x1f1d5c,_0x1bfa64[_0x494c('0x55')],_0x28310c);})[_0x494c('0x23')](function(_0x48e409){_0x35b695=_0x48e409;logger['info']('['+_0x1f1d5c[_0x494c('0x6e')]['toUpperCase']()+_0x494c('0x72'),_0x35b695['id']);logger[_0x494c('0x1f')]('['+_0x1f1d5c[_0x494c('0x6e')][_0x494c('0x6f')]()+_0x494c('0x73'),_0x335add[_0x494c('0x39')]);})['catch'](function(_0xd17e11){logger['error']('['+_0x1f1d5c['lastevent'][_0x494c('0x6f')]()+']',JSON[_0x494c('0x5f')](_0xd17e11));});}; \ No newline at end of file +var _0x93c2=['Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','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','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','calleridname','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase','lodash','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','ticketType','Task','utc','Subjects','getString','Descriptions','WhoId','Case','assign','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','moduleSearch','contact_lead','Contact','Lead','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Phone'];(function(_0x424b05,_0x526b5b){var _0x4c65cd=function(_0x59e1f3){while(--_0x59e1f3){_0x424b05['push'](_0x424b05['shift']());}};_0x4c65cd(++_0x526b5b);}(_0x93c2,0x120));var _0x293c=function(_0x4ebae2,_0xf5cccb){_0x4ebae2=_0x4ebae2-0x0;var _0x9a2ef7=_0x93c2[_0x4ebae2];return _0x9a2ef7;};'use strict';var _=require(_0x293c('0x0'));var rp=require('request-promise');var moment=require(_0x293c('0x1'));var BPromise=require(_0x293c('0x2'));var md5=require(_0x293c('0x3'));var jsforce=require(_0x293c('0x4'));var util=require(_0x293c('0x5'));var Redis=require('ioredis');var intUtil=require(_0x293c('0x6'));var config=require(_0x293c('0x7'));var logger=require(_0x293c('0x8'))(_0x293c('0x9'));config[_0x293c('0xa')]=_[_0x293c('0xb')](config[_0x293c('0xa')],{'host':_0x293c('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x293c('0xa')]));function emit(_0x38aab8,_0x151dcd,_0x42ab6b){io['to'](_0x38aab8)['emit'](_0x151dcd,_0x42ab6b);}function getTicket(_0x2610d7,_0x2ac4eb,_0x4f3d34,_0xfac8c4,_0x422cf8,_0x2bdff6,_0x4adc02,_0x5edb70){var _0x124473={};if(_0xfac8c4[_0x293c('0xd')]===_0x293c('0xe')){_0x124473=Object['assign']({},{'OwnerId':_0x2ac4eb['id'],'ActivityDate':moment[_0x293c('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0xfac8c4[_0x293c('0x10')],_0x422cf8,'\x20'),'Description':intUtil[_0x293c('0x11')](_0xfac8c4[_0x293c('0x12')],_0x422cf8,'\x0a')},getCustomFields(_0x2bdff6,_0x422cf8));if(_0x4f3d34){_0x124473[_0x293c('0x13')]=_0x4f3d34['id'];}}else if(_0xfac8c4[_0x293c('0xd')]===_0x293c('0x14')){_0x124473=Object[_0x293c('0x15')]({},{'OwnerId':_0x2ac4eb['id'],'Subject':intUtil[_0x293c('0x11')](_0xfac8c4[_0x293c('0x10')],_0x422cf8,'\x20'),'Description':intUtil[_0x293c('0x11')](_0xfac8c4['Descriptions'],_0x422cf8,'\x0a')},getCustomFields(_0x2bdff6,_0x422cf8));if(_0x4f3d34){_0x124473['ContactId']=_0x4f3d34['id'];}}return _0x4adc02[_0x293c('0x16')](_0xfac8c4[_0x293c('0xd')])[_0x293c('0x17')](_0x124473);}function getUser(_0x1da47e,_0x758fd,_0x502713){if(!_[_0x293c('0x18')](_0x758fd)&&intUtil[_0x293c('0x19')](_0x758fd)){var _0x151a03={'Email':_0x758fd};var _0x551963={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x502713[_0x293c('0x16')](_0x293c('0x1a'))[_0x293c('0x1b')](_0x151a03,_0x551963)[_0x293c('0x1c')]()[_0x293c('0x1d')](function(_0x10cb4a){if(_0x10cb4a[_0x293c('0x1e')]){var _0xec4bb9=_['find'](_0x10cb4a,function(_0x2ffc17){return _0x2ffc17[_0x293c('0x1f')]===_0x758fd;});if(_0xec4bb9){logger[_0x293c('0x20')](_0x293c('0x21'),_0x758fd);return BPromise['resolve']({'id':_0xec4bb9['Id'],'name':_0xec4bb9[_0x293c('0x22')]});}}else{logger[_0x293c('0x20')](_0x293c('0x23'),_0x758fd);return _0x502713[_0x293c('0x24')]()[_0x293c('0x1d')](function(_0x3e7999){return BPromise[_0x293c('0x25')]({'id':_0x3e7999[_0x293c('0x26')],'name':_0x3e7999[_0x293c('0x27')]});});}});}else{logger[_0x293c('0x20')](_0x293c('0x23'),_0x758fd);return _0x502713[_0x293c('0x24')]()[_0x293c('0x1d')](function(_0x37cdeb){return BPromise[_0x293c('0x25')]({'id':_0x37cdeb[_0x293c('0x26')],'name':_0x37cdeb[_0x293c('0x27')]});});}}function getEndUser(_0x25fe3f,_0x15bf9f,_0x4cdae1,_0x27e8cb,_0x2b0c71){var _0xb48e20={'Phone':_0x27e8cb};var _0x4fceb3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x293c('0x1d')](function(){if(_0x15bf9f[_0x293c('0xd')]===_0x293c('0xe')){logger[_0x293c('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x27e8cb,_0x15bf9f[_0x293c('0x28')]);switch(_0x15bf9f[_0x293c('0x28')]){case _0x293c('0x29'):return _0x2b0c71[_0x293c('0x16')](_0x293c('0x2a'))[_0x293c('0x1b')](_0xb48e20,_0x4fceb3)[_0x293c('0x1c')]()[_0x293c('0x1d')](function(_0x245663){if(_0x245663&&_0x245663[_0x293c('0x1e')]){return _0x245663;}else{return _0x2b0c71[_0x293c('0x16')](_0x293c('0x2b'))[_0x293c('0x1b')](_0xb48e20,_0x4fceb3);}});case _0x293c('0x2c'):return _0x2b0c71[_0x293c('0x16')]('Contact')['find'](_0xb48e20,_0x4fceb3)[_0x293c('0x1c')]();case _0x293c('0x2d'):return _0x2b0c71['sobject'](_0x293c('0x2b'))['find'](_0xb48e20,_0x4fceb3);default:return null;}}else if(_0x15bf9f['ticketType']===_0x293c('0x14')){logger['info'](_0x293c('0x2e'),_0x27e8cb,'contact');return _0x2b0c71[_0x293c('0x16')](_0x293c('0x2a'))['find'](_0xb48e20,_0x4fceb3)[_0x293c('0x1c')]();}})[_0x293c('0x1d')](function(_0x4fc085){if(_0x4fc085&&_0x4fc085[_0x293c('0x1e')]){var _0x4b16f6=_[_0x293c('0x1b')](_0x4fc085,function(_0x1cc13e){return _0x1cc13e[_0x293c('0x2f')]===_0x27e8cb;});if(_0x4b16f6){return BPromise[_0x293c('0x25')]({'id':_0x4b16f6['Id'],'name':_0x4b16f6[_0x293c('0x22')],'phone':_0x4b16f6[_0x293c('0x2f')]});}}})[_0x293c('0x1d')](function(_0x52e568){if(_0x52e568){logger['info'](_0x293c('0x30'),_0x27e8cb);return BPromise[_0x293c('0x25')](_0x52e568);}else{logger[_0x293c('0x20')](_0x293c('0x31'),_0x27e8cb);var _0x154667={'LastName':_0x4cdae1!==''?_0x4cdae1:util['format'](_0x293c('0x32'),_0x27e8cb),'Phone':_0x27e8cb};if(_0x15bf9f[_0x293c('0x33')]){if(_0x15bf9f['moduleCreate']===_0x293c('0x2c')){logger['info'](_0x293c('0x34'),_0x27e8cb,_0x15bf9f[_0x293c('0x33')]);}else if(_0x15bf9f[_0x293c('0x33')]===_0x293c('0x2d')&&_0x15bf9f[_0x293c('0xd')]===_0x293c('0xe')){logger['info'](_0x293c('0x34'),_0x27e8cb,_0x15bf9f[_0x293c('0x33')]);_0x154667[_0x293c('0x35')]=_0x293c('0x36');}else{return null;}}return _0x2b0c71['sobject'](_[_0x293c('0x37')](_0x15bf9f[_0x293c('0x33')]))['create'](_0x154667);}});}function getCustomFields(_0x51fb89,_0x4a098d){var _0x5b23fb={};if(_0x51fb89[_0x293c('0x1e')]>0x0){_[_0x293c('0x38')](_0x51fb89,function(_0x3c27d8){if(_0x3c27d8[_0x293c('0x39')]===_0x293c('0x3a')&&_0x3c27d8[_0x293c('0x3b')]){_0x5b23fb[_0x3c27d8[_0x293c('0x3b')]]=_0x3c27d8[_0x293c('0x3c')][_0x293c('0x3d')]();}else if(_0x3c27d8[_0x293c('0x39')]===_0x293c('0x3e')&&_0x3c27d8[_0x293c('0x3f')]&&_0x3c27d8[_0x293c('0x3b')]){_0x4a098d[_0x3c27d8[_0x293c('0x3f')]]&&(_0x5b23fb[_0x3c27d8[_0x293c('0x3b')]]=_0x4a098d[_0x3c27d8[_0x293c('0x3f')]][_0x293c('0x3d')]());}else if(_0x3c27d8[_0x293c('0x39')]===_0x293c('0x40')&&_0x3c27d8[_0x293c('0x41')]&&_0x3c27d8[_0x293c('0x41')][_0x293c('0x42')]&&_0x3c27d8[_0x293c('0x3b')]){_0x4a098d[_0x3c27d8[_0x293c('0x41')][_0x293c('0x42')][_0x293c('0x43')]()]&&(_0x5b23fb[_0x3c27d8[_0x293c('0x3b')]]=_0x4a098d[_0x3c27d8[_0x293c('0x41')]['name']['toLowerCase']()][_0x293c('0x3d')]());}});}return _0x5b23fb;}function getConnection(_0xf76e65){var _0x5a7fbe=_0xf76e65['password']['concat'](_0xf76e65[_0x293c('0x44')]);var _0x66a1c9=new jsforce[(_0x293c('0x45'))]({'oauth2':{'loginUrl':_0xf76e65[_0x293c('0x46')]||_0x293c('0x47'),'clientId':_0xf76e65['clientId'],'clientSecret':_0xf76e65[_0x293c('0x48')]}});return _0x66a1c9['login'](_0xf76e65['username'],_0x5a7fbe)[_0x293c('0x1d')](function(){logger[_0x293c('0x20')](_0x293c('0x49'));return _0x66a1c9;});}exports[_0x293c('0x4a')]=function(_0x7a5a6f,_0x5d4b0a,_0x382acc,_0x32f6c7,_0x4dd215,_0x4bbdc0){var _0x143918,_0x5b12be,_0x3e2668,_0x18fc96;_0x4bbdc0[_0x293c('0x4b')]=intUtil['stripTrailingSlash'](_0x4bbdc0['serverUrl']);_0x4bbdc0[_0x293c('0x46')]=intUtil[_0x293c('0x4c')](_0x4bbdc0[_0x293c('0x46')]);if(_0x4dd215&&_0x4dd215[_0x293c('0x4d')]){logger[_0x293c('0x20')]('[QUEUE]',_0x293c('0x4e'));_0x5d4b0a[_0x293c('0x4f')]=util[_0x293c('0x50')](_0x293c('0x51'),_0x4bbdc0[_0x293c('0x4b')],_0x5d4b0a[_0x293c('0x52')],md5(_0x5d4b0a[_0x293c('0x52')]));}else{_0x5d4b0a[_0x293c('0x4f')]='';}return getConnection(_0x4bbdc0)[_0x293c('0x1d')](function(_0x541785){_0x18fc96=_0x541785;return getUser(_0x4bbdc0,_0x32f6c7[_0x293c('0x53')],_0x18fc96);})[_0x293c('0x1d')](function(_0x4bf6f1){_0x143918=_0x4bf6f1;return getEndUser(_0x4bbdc0,_0x382acc,_0x5d4b0a['calleridname'],_0x5d4b0a[_0x293c('0x54')],_0x18fc96);})[_0x293c('0x1d')](function(_0x5a9dd8){_0x5b12be=_0x5a9dd8;return getTicket(_0x4bbdc0,_0x143918,_0x5b12be,_0x382acc,_0x5d4b0a,_0x382acc[_0x293c('0x55')],_0x18fc96,_0x293c('0x4a'));})[_0x293c('0x1d')](function(_0x17ea4a){_0x3e2668=_0x17ea4a;logger[_0x293c('0x20')](_0x293c('0x56'),_0x3e2668['id']);logger['info'](_0x293c('0x57'),_0x3e2668['id'],_0x32f6c7[_0x293c('0x42')],_0x4bbdc0[_0x293c('0x39')]);switch(_0x4bbdc0[_0x293c('0x39')]){case _0x293c('0x58'):emit(util[_0x293c('0x50')](_0x293c('0x59'),_0x32f6c7[_0x293c('0x42')]),_0x293c('0x5a'),{'recordId':_0x3e2668['id']});break;case _0x293c('0x5b'):emit(util[_0x293c('0x50')](_0x293c('0x59'),_0x32f6c7[_0x293c('0x42')]),'trigger:browser:url',{'uri':util['format'](_0x293c('0x5c'),_0x18fc96['instanceUrl'],_0x3e2668['id'])});break;default:logger['error'](_0x293c('0x5d'));}})[_0x293c('0x5e')](function(_0x515862){logger['error'](_0x293c('0x5f'),JSON[_0x293c('0x60')](_0x515862));});};exports[_0x293c('0x61')]=function(_0x106f90,_0x326c9f,_0x318067,_0x142e6e,_0x57ae9b,_0xa0499b,_0x2a5af1){var _0x48d136,_0x1c46f0,_0x3dba4c,_0x185ae6;_0xa0499b[_0x293c('0x4b')]=intUtil[_0x293c('0x4c')](_0xa0499b['serverUrl']);_0xa0499b[_0x293c('0x46')]=intUtil[_0x293c('0x4c')](_0xa0499b[_0x293c('0x46')]);if(_0x2a5af1&&_0x2a5af1[_0x293c('0x62')]&&_0x2a5af1['recordingFormat']!==_0x293c('0x63')){logger[_0x293c('0x20')](_0x293c('0x64'),'Recording\x20is\x20enabled!');_0x326c9f['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa0499b[_0x293c('0x4b')],_0x326c9f[_0x293c('0x52')],md5(_0x326c9f[_0x293c('0x52')]));}return getConnection(_0xa0499b)['then'](function(_0x448756){_0x185ae6=_0x448756;return getUser(_0xa0499b,_0x142e6e[_0x293c('0x53')],_0x185ae6);})['then'](function(_0x417f76){_0x48d136=_0x417f76;return getEndUser(_0xa0499b,_0x318067,_0x326c9f[_0x293c('0x65')],_0x326c9f[_0x293c('0x66')],_0x185ae6);})[_0x293c('0x1d')](function(_0x38b069){_0x1c46f0=_0x38b069;return getTicket(_0xa0499b,_0x48d136,_0x1c46f0,_0x318067,_0x326c9f,_0x318067[_0x293c('0x55')],_0x185ae6,'outbound');})[_0x293c('0x1d')](function(_0x4d216b){_0x3dba4c=_0x4d216b;logger[_0x293c('0x20')](_0x293c('0x67'),_0x3dba4c['id']);logger[_0x293c('0x20')](_0x293c('0x68'),_0x3dba4c['id'],_0x142e6e['name'],_0xa0499b[_0x293c('0x39')]);switch(_0xa0499b[_0x293c('0x39')]){case _0x293c('0x58'):emit(util[_0x293c('0x50')](_0x293c('0x59'),_0x142e6e[_0x293c('0x42')]),'trigger:salesforce:display',{'recordId':_0x3dba4c['id']});break;case _0x293c('0x5b'):emit(util['format']('user:%s',_0x142e6e[_0x293c('0x42')]),'trigger:browser:url',{'uri':util['format'](_0x293c('0x5c'),_0x185ae6['instanceUrl'],_0x3dba4c['id'])});break;default:logger[_0x293c('0x69')](_0x293c('0x64'),_0x293c('0x6a'));}})[_0x293c('0x5e')](function(_0x2e9410){logger[_0x293c('0x69')]('[OUTBOUND]',JSON[_0x293c('0x60')](_0x2e9410));});};exports[_0x293c('0x6b')]=function(_0x41de8d,_0x333e9b,_0x170754,_0x2277bb,_0xc06f44,_0x81eef1){var _0x51bcc7,_0x264509,_0x545802,_0x87ef84;_0x81eef1['serverUrl']=intUtil[_0x293c('0x4c')](_0x81eef1[_0x293c('0x4b')]);_0x81eef1['remoteUri']=intUtil['stripTrailingSlash'](_0x81eef1[_0x293c('0x46')]);if(_0xc06f44&&_0xc06f44[_0x293c('0x4d')]){logger['info']('['+_0x333e9b['lastevent']['toUpperCase']()+']',_0x293c('0x4e'));_0x333e9b[_0x293c('0x4f')]=util[_0x293c('0x50')](_0x293c('0x51'),_0x81eef1['serverUrl'],_0x333e9b[_0x293c('0x52')],md5(_0x333e9b[_0x293c('0x52')]));}else{_0x333e9b[_0x293c('0x4f')]='';}return getConnection(_0x81eef1)[_0x293c('0x1d')](function(_0x70e978){_0x87ef84=_0x70e978;if(!_['isNil'](_0x2277bb)){return getUser(_0x81eef1,_0x2277bb[_0x293c('0x42')],_0x87ef84);}else{return getUser(_0x81eef1,null,_0x87ef84);}})['then'](function(_0x5b5b8d){_0x51bcc7=_0x5b5b8d;return getEndUser(_0x81eef1,_0x170754,_0x333e9b[_0x293c('0x6c')],_0x333e9b['calleridnum'],_0x87ef84);})[_0x293c('0x1d')](function(_0xa917be){_0x264509=_0xa917be;return getTicket(_0x81eef1,_0x51bcc7,_0x264509,_0x170754,_0x333e9b,_0x170754[_0x293c('0x55')],_0x87ef84);})[_0x293c('0x1d')](function(_0x429bd8){_0x545802=_0x429bd8;logger[_0x293c('0x20')]('['+_0x333e9b[_0x293c('0x6d')]['toUpperCase']()+_0x293c('0x6e'),_0x545802['id']);logger[_0x293c('0x20')]('['+_0x333e9b[_0x293c('0x6d')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x81eef1[_0x293c('0x39')]);})[_0x293c('0x5e')](function(_0x33de7f){logger[_0x293c('0x69')]('['+_0x333e9b['lastevent'][_0x293c('0x6f')]()+']',JSON['stringify'](_0x33de7f));});}; \ 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 e101d42..8719026 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 _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(_0x451359,_0x49a479){var _0x41b9e5=function(_0x1c5706){while(--_0x1c5706){_0x451359['push'](_0x451359['shift']());}};_0x41b9e5(++_0x49a479);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'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 +var _0x814b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','Variable','name','POST','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number','label','?sysparm_query=name%3D','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged'];(function(_0x5a3a3f,_0x341312){var _0xaf0d63=function(_0x417edf){while(--_0x417edf){_0x5a3a3f['push'](_0x5a3a3f['shift']());}};_0xaf0d63(++_0x341312);}(_0x814b,0x1a2));var _0xb814=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x814b[_0xcd0918];return _0x250704;};'use strict';var _=require(_0xb814('0x0'));var Promise=require(_0xb814('0x1'));var rp=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var md5=require(_0xb814('0x4'));var Redis=require(_0xb814('0x5'));var intUtil=require('./util');var config=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));config[_0xb814('0x9')]=_[_0xb814('0xa')](config[_0xb814('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xb814('0xb'))(new Redis(config[_0xb814('0x9')]));function getAdminUser(_0x5c8539,_0x271af9,_0x2913a6,_0x186d5a,_0x41166c,_0x1fea33){return new Promise(function(_0x21d4a5,_0x1086f8){var _0x19aad8={'method':_0xb814('0xc'),'uri':_0x186d5a+_0xb814('0xd')+'&'+_0x41166c+'&'+_0x1fea33,'auth':_0x271af9,'json':!![]};return rp(_0x19aad8)[_0xb814('0xe')](function(_0x4b5f14){if(_0x4b5f14[_0xb814('0xf')]['length']>0x0){_0x2913a6[_0xb814('0x10')]=_0x4b5f14[_0xb814('0xf')][0x0][_0xb814('0x11')];}logger[_0xb814('0x12')]('['+[_0x5c8539[_0xb814('0x13')]()]+_0xb814('0x14'),_0x2913a6);_0x21d4a5(_0x2913a6);})[_0xb814('0x15')](function(_0x41ed7b){logger[_0xb814('0x16')]('['+[_0x5c8539[_0xb814('0x13')]()]+']',_0x41ed7b[_0xb814('0x17')]);_0x1086f8(_0x41ed7b[_0xb814('0x17')]);});});}function getUser(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6,_0x45e0d0){return function(_0x265a83){logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x18'),_0x265a83);return new Promise(function(_0x48c9df,_0x168a48){if(intUtil['validateEmail'](_0x265a83[_0xb814('0x19')])){var _0xfac75b={'method':'GET','uri':_0x303aca+'sys_user?sysparm_query=email%3D'+_0x265a83['userEmail']+'&'+_0x3a71d6+'&'+_0x45e0d0,'auth':_0x39bfcf,'json':!![]};logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xfac75b);return rp(_0xfac75b)[_0xb814('0xe')](function(_0x24211d){logger[_0xb814('0x12')]('['+[_0x17f5bd['toUpperCase']()]+_0xb814('0x1a'),_0x24211d);if(_0x24211d['result'][_0xb814('0x1b')]>0x0&&String(_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x1c')])===_0xb814('0x1d')){_0x265a83[_0xb814('0x1e')]=_0x24211d[_0xb814('0xf')][0x0][_0xb814('0x11')];}else{_0x265a83['userId']=_0x265a83[_0xb814('0x10')];_0x265a83['userEmail']=_0x265a83[_0xb814('0x1f')];}logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x20'),_0x265a83);_0x48c9df(_0x265a83);})[_0xb814('0x15')](function(_0xb9e57d){logger[_0xb814('0x16')]('['+[_0x17f5bd['toUpperCase']()]+']',_0xb9e57d[_0xb814('0x17')]);_0x168a48(_0xb9e57d[_0xb814('0x17')]);});}else{logger[_0xb814('0x12')]('['+[_0x17f5bd[_0xb814('0x13')]()]+_0xb814('0x21'));_0x265a83[_0xb814('0x1e')]=_0x265a83[_0xb814('0x10')];_0x265a83[_0xb814('0x19')]=_0x265a83['adminEmail'];_0x48c9df(_0x265a83);}});};}function createEndUser(_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2,_0x37d24d){logger[_0xb814('0x12')]('['+[_0x271aa8['toUpperCase']()]+_0xb814('0x22'),_0x52ed64);return new Promise(function(_0x2051d0,_0x58c3ca){var _0x338a28={'method':'POST','uri':_0x9008b2+_0xb814('0x23')+_0x37d24d,'body':{'user_name':_0x52ed64['endUserNumber'],'roles':'user','first_name':_0x52ed64[_0xb814('0x24')],'active':'true','date_format':_0xb814('0x25'),'phone':_0x52ed64[_0xb814('0x24')]},'auth':_0x328a08,'json':!![]};return rp(_0x338a28)[_0xb814('0xe')](function(_0x599f9f){logger['info']('['+[_0x271aa8[_0xb814('0x13')]()]+_0xb814('0x26'),_0x599f9f['result']);_0x52ed64[_0xb814('0x27')]=_0x599f9f[_0xb814('0xf')][_0xb814('0x11')];_0x2051d0(_0x52ed64);})[_0xb814('0x15')](function(_0x1b78de){logger[_0xb814('0x16')]('['+[_0x271aa8[_0xb814('0x13')]()]+']',_0x1b78de['message']);_0x58c3ca(_0x1b78de[_0xb814('0x17')]);});});}function getEndUser(_0x2263f6,_0x30de5a,_0x424e2b,_0x14100d,_0x4ff31a){return function(_0x16ef82){logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+_0xb814('0x28'),_0x16ef82);return new Promise(function(_0xe0f509,_0x492d5e){var _0x40b885={'method':_0xb814('0xc'),'uri':_0x424e2b+'sys_user?sysparm_query=phone%3D'+_0x16ef82[_0xb814('0x24')]+'&'+_0x14100d+'&'+_0x4ff31a,'auth':_0x30de5a,'json':!![]};return rp(_0x40b885)[_0xb814('0xe')](function(_0x1a8bd0){if(_0x1a8bd0[_0xb814('0xf')][_0xb814('0x1b')]>0x0){_0x16ef82[_0xb814('0x27')]=_0x1a8bd0['result'][0x0][_0xb814('0x11')];logger['info']('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20getEndUser\x20crm',_0x16ef82);_0xe0f509(_0x16ef82);}else{return createEndUser(_0x2263f6,_0x30de5a,_0x16ef82,_0x424e2b,_0x14100d)[_0xb814('0xe')](function(_0x4b9233){logger[_0xb814('0x12')]('['+[_0x2263f6[_0xb814('0x13')]()]+'],\x20createEndUser\x20crm',_0x4b9233);_0xe0f509(_0x4b9233);});}})['catch'](function(_0x5dd6bc){logger['error']('['+[_0x2263f6[_0xb814('0x13')]()]+']',_0x5dd6bc[_0xb814('0x17')]);_0x492d5e(_0x5dd6bc[_0xb814('0x17')]);});});};}function getCustomFields(_0x42c2ed,_0x51cdba){var _0x47d782={};if(_0x42c2ed[_0xb814('0x1b')]>0x0){_['forEach'](_0x42c2ed,function(_0x2a93da){if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x2a')&&_0x2a93da[_0xb814('0x2b')]&&!_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x2a93da[_0xb814('0x2f')][_0xb814('0x30')]();}else if(_0x2a93da['type']==='string'&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da['idField'][_0xb814('0x2e')]()]=_0x2a93da['content'][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]===_0xb814('0x31')&&_0x2a93da[_0xb814('0x32')]&&_0x2a93da['idField']&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da[_0xb814('0x32')]][_0xb814('0x30')]();}else if(_0x2a93da[_0xb814('0x29')]==='customVariable'&&_0x2a93da[_0xb814('0x33')]&&_0x2a93da[_0xb814('0x33')][_0xb814('0x34')]&&_0x2a93da[_0xb814('0x2d')]&&_0x2a93da[_0xb814('0x2c')]){_0x47d782[_0x2a93da[_0xb814('0x2d')][_0xb814('0x2e')]()]=_0x51cdba[_0x2a93da['Variable']['name'][_0xb814('0x2e')]()][_0xb814('0x30')]();}});}return _0x47d782;}function getTicket(_0x4c08d6,_0x2bf906,_0x43f1b,_0x40e627,_0x24b697,_0x40af85){return function(_0x2eb9b6){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x2eb9b6);return new Promise(function(_0x37800a,_0x17510c){var _0x4a76bb=_0x4c08d6[_0xb814('0x2e')]()==='outbound'?_0x2eb9b6[_0xb814('0x1e')]:_0x2eb9b6[_0xb814('0x27')];var _0xc71270={'method':_0xb814('0x35'),'uri':_0x43f1b+_0xb814('0x36')+'?'+_0x40af85,'body':Object[_0xb814('0x37')]({},{'active':_0xb814('0x1d'),'caller_id':_0x4a76bb,'assigned_to':_0x2eb9b6[_0xb814('0x1e')],'short_description':intUtil[_0xb814('0x38')](_0x40e627[_0xb814('0x39')],_0x24b697,'\x20'),'description':intUtil['getString'](_0x40e627['Descriptions'],_0x24b697,'\x0a')},getCustomFields(_0x40e627[_0xb814('0x3a')],_0x24b697)),'auth':_0x2bf906,'json':!![]};return rp(_0xc71270)[_0xb814('0xe')](function(_0x4156d8){logger[_0xb814('0x12')]('['+[_0x4c08d6[_0xb814('0x13')]()]+_0xb814('0x3b'),_0x4156d8[_0xb814('0xf')]);_0x2eb9b6['ticketId']=_0x4156d8[_0xb814('0xf')][_0xb814('0x11')];_0x2eb9b6[_0xb814('0x3c')]=_0x4156d8['result'][_0xb814('0x3d')];logger['info']('['+[_0x4c08d6[_0xb814('0x13')]()]+']\x20getTicket\x20crm',_0x2eb9b6);_0x37800a(_0x2eb9b6);})[_0xb814('0x15')](function(_0x3cf8f8){logger['error']('['+[_0x4c08d6[_0xb814('0x13')]()]+']',_0x3cf8f8[_0xb814('0x17')]);_0x17510c(_0x3cf8f8[_0xb814('0x17')]);});});};}function createRemoteTag(_0x5209d1,_0x3da050,_0x5f0e58,_0x13bdcf){return new Promise(function(_0x158893,_0x4aed78){var _0x39952d={'method':'POST','uri':_0x5f0e58+'label'+'?'+_0x13bdcf,'body':{'short_description':_0x5209d1,'global':!![],'active':!![],'name':_0x5209d1},'auth':_0x3da050,'json':!![]};return rp(_0x39952d)[_0xb814('0xe')](function(_0x35f59a){var _0x34935b=_0x35f59a['result'][_0xb814('0x11')];_0x158893(_0x34935b);});});}function getRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5,_0x2db5a6){return new Promise(function(_0x5c32c2,_0x25a607){var _0x1656ed={'method':_0xb814('0xc'),'uri':_0x2174e5+_0xb814('0x3e')+_0xb814('0x3f')+_0x538b0f+'&'+_0x58d6e5,'auth':_0xf88d23,'json':!![]};return rp(_0x1656ed)[_0xb814('0xe')](function(_0x21d3e9){if(_0x21d3e9[_0xb814('0xf')]['length']>0x0){var _0x374532=_0x21d3e9[_0xb814('0xf')][0x0]['sys_id'];_0x5c32c2(_0x374532);}else{return createRemoteTag(_0x538b0f,_0xf88d23,_0x2174e5,_0x58d6e5)[_0xb814('0xe')](function(_0xe14249){_0x5c32c2(_0xe14249);});}});});}function assignTagToIncident(_0x4d13db,_0x371000,_0x58b9a6,_0x48362c,_0x2114ca){return new Promise(function(_0x5257be,_0x3ff213){var _0xd1cd8b={'method':_0xb814('0x35'),'uri':_0x58b9a6+'label_entry'+'?'+_0x2114ca,'body':{'label':_0x4d13db,'table':_0xb814('0x36'),'id_type':'Incident','table_key':_0x48362c[_0xb814('0x40')],'title':_0xb814('0x41')+_0x48362c[_0xb814('0x3c')],'id_display':_0x48362c[_0xb814('0x3c')]},'auth':_0x371000,'json':!![]};return rp(_0xd1cd8b)[_0xb814('0xe')](function(_0x3b374b){_0x5257be();})[_0xb814('0x15')](function(){_0x5257be();});});}function manageTags(_0x113350,_0x46014f,_0x4d611d,_0x211194,_0x111884,_0x3852ae,_0x1ac6d0){return new Promise(function(_0x3b35a8,_0x3d4843){var _0x52edfa=[];_0x46014f[_0xb814('0x42')](function(_0x4ccd94){_0x52edfa[_0xb814('0x43')](getRemoteTag(_0x4ccd94,_0x4d611d,_0x211194,_0x3852ae,_0x1ac6d0));});return Promise[_0xb814('0x44')](_0x52edfa)[_0xb814('0xe')](function(_0x4c884c){if(_0x4c884c[_0xb814('0x1b')]){logger['info']('['+[_0x113350[_0xb814('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4c884c);var _0x2f0c94=[];_0x4c884c[_0xb814('0x42')](function(_0xa03cd2){_0x2f0c94[_0xb814('0x43')](assignTagToIncident(_0xa03cd2,_0x4d611d,_0x211194,_0x111884,_0x3852ae));});return Promise[_0xb814('0x44')](_0x2f0c94)[_0xb814('0xe')](function(){_0x3b35a8();})[_0xb814('0x15')](function(){_0x3b35a8();});}else{_0x3b35a8();}});});}function getTags(_0x4d44e3,_0x44088d,_0x51ca51,_0x255047,_0x22c73f,_0x1b989d){return function(_0x3dcaeb){return new Promise(function(_0x19fa45,_0x139531){var _0x514dab=[];var _0x12882a=_0x255047[_0xb814('0x45')];if(_0x12882a&&_0x12882a['length']>0x0){_0x514dab=_[_0xb814('0x46')](_0x12882a,_0xb814('0x34'));}if(_0x514dab[_0xb814('0x1b')]>0x0){return manageTags(_0x4d44e3,_0x514dab,_0x44088d,_0x51ca51,_0x3dcaeb,_0x22c73f,_0x1b989d)[_0xb814('0xe')](function(){_0x19fa45(_0x3dcaeb);});}else{_0x19fa45(_0x3dcaeb);}});};}function emit(_0x2161eb,_0x51d834,_0x3a4d4b){var _0x5e8e8e=_0xb814('0x47')+_0xb814('0x48')+_0xb814('0x49')+_0xb814('0x4a');var _0x2e39b1={'uri':_0x2161eb+_0xb814('0x4b')+_0x3a4d4b+_0x5e8e8e};io['to'](util['format']('user:%s',_0x51d834))['emit'](_0xb814('0x4c'),_0x2e39b1);}exports['cs']=function(_0x490e5c,_0x45a8b9,_0x1d3954,_0x25db89,_0x5e966c,_0x1b76fa,_0x3e5ce8,_0xee204){var _0x5aabbe={};var _0x30f717={'user':_0x1b76fa[_0xb814('0x4d')],'pass':_0x1b76fa[_0xb814('0x4e')]};var _0x3564e0='sysparm_limit=1';var _0x5dedd7=_0xb814('0x4f');_0x1b76fa[_0xb814('0x50')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x50')]);_0x1b76fa[_0xb814('0x52')]=intUtil[_0xb814('0x51')](_0x1b76fa[_0xb814('0x52')]);var _0xe47442=util[_0xb814('0x53')](_0xb814('0x54'),_0x1b76fa[_0xb814('0x50')]);_0x5aabbe[_0xb814('0x19')]=!_[_0xb814('0x55')](_0x25db89)?_0x25db89[_0xb814('0x56')]:null;_0x5aabbe[_0xb814('0x1f')]=_0x1b76fa['email'];_0x5aabbe[_0xb814('0x24')]=_0xee204[_0xb814('0x2e')]()===_0xb814('0x57')?_0x45a8b9[_0xb814('0x58')]:_0x45a8b9[_0xb814('0x59')];_0x5aabbe[_0xb814('0x5a')]=_0xee204==='queue'||_0xee204===_0xb814('0x5b')?'queue':_0xb814('0x57');var _0x39aa00=util[_0xb814('0x53')](_0xb814('0x5c'),_0x1b76fa[_0xb814('0x52')],_0x45a8b9['uniqueid'],md5(_0x45a8b9['uniqueid']));if(_0x5e966c&&_0x5e966c[_0xb814('0x5d')]){logger[_0xb814('0x12')](_0xb814('0x5e'),_0xb814('0x5f'));_0x45a8b9['recordingURL']=_0x39aa00;}else if(_0x3e5ce8&&_0x3e5ce8[_0xb814('0x60')]&&_0x3e5ce8['recordingFormat']!==_0xb814('0x61')){logger[_0xb814('0x12')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x45a8b9[_0xb814('0x62')]=_0x39aa00;}else{_0x45a8b9['recordingURL']='';}return getAdminUser(_0xee204,_0x30f717,_0x5aabbe,_0xe47442,_0x5dedd7,_0x3564e0)[_0xb814('0xe')](getUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getEndUser(_0xee204,_0x30f717,_0xe47442,_0x5dedd7,_0x3564e0))[_0xb814('0xe')](getTicket(_0xee204,_0x30f717,_0xe47442,_0x1d3954,_0x45a8b9,_0x5dedd7))[_0xb814('0xe')](function(_0x46784f){logger[_0xb814('0x12')](util[_0xb814('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x46784f[_0xb814('0x40')]));logger['info'](util[_0xb814('0x53')]('call\x20direction:\x20%s',_0xee204));if(_0xee204!==_0xb814('0x5b')){logger[_0xb814('0x12')]('['+[_0xee204['toUpperCase']()]+']',_0xb814('0x63'));emit(_0x1b76fa['remoteUri'],_0x25db89[_0xb814('0x34')],_0x46784f[_0xb814('0x40')]);}})['catch'](function(_0x5a0c4a){logger[_0xb814('0x16')]('['+[_0xee204[_0xb814('0x13')]()]+_0xb814('0x64'),util[_0xb814('0x65')](_0x5a0c4a,{'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 442ca96..830ff06 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 _0xad40=['%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','Outbound','Ticket\x20created!','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','replace','duration_minutes','parent_type','parent_name','length','forEach','variableName','push','idField','set_entry','stringify','format','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','find','entry_list','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','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','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt'];(function(_0x2e6b7e,_0x4b8f20){var _0x3c03cf=function(_0x54f0e9){while(--_0x54f0e9){_0x2e6b7e['push'](_0x2e6b7e['shift']());}};_0x3c03cf(++_0x4b8f20);}(_0xad40,0xfa));var _0x0ad4=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xad40[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0ad4('0x0'));var rp=require(_0x0ad4('0x1'));var BPromise=require(_0x0ad4('0x2'));var md5=require(_0x0ad4('0x3'));var util=require('util');var Redis=require(_0x0ad4('0x4'));var intUtil=require(_0x0ad4('0x5'));var config=require(_0x0ad4('0x6'));var logger=require(_0x0ad4('0x7'))(_0x0ad4('0x8'));config[_0x0ad4('0x9')]=_[_0x0ad4('0xa')](config['redis'],{'host':_0x0ad4('0xb'),'port':0x18eb});var io=require(_0x0ad4('0xc'))(new Redis(config[_0x0ad4('0x9')]));var def={'method':_0x0ad4('0xd'),'json':!![]};function emit(_0x44b342,_0x29f1ee,_0x239e92){io['to'](_0x44b342)['emit'](_0x29f1ee,_0x239e92);}function getTicket(_0x918eb4,_0x3788e9,_0x90d11a,_0x2c5757,_0x2a4ba5,_0xbbd2bd,_0x43197c,_0x48c3d9){logger[_0x0ad4('0xe')](_0x0ad4('0xf'));var _0x23b1de=new Date();var _0x15b90f=[{'name':_0x0ad4('0x10'),'value':intUtil[_0x0ad4('0x11')](_0x2c5757[_0x0ad4('0x12')],_0x2a4ba5,'\x20')},{'name':_0x0ad4('0x13'),'value':_0x3788e9['id']},{'name':_0x0ad4('0x14'),'value':_0x3788e9['id']},{'name':_0x0ad4('0x15'),'value':intUtil['getString'](_0x2c5757[_0x0ad4('0x16')],_0x2a4ba5,'\x0a')},{'name':'date_start','value':_0x23b1de[_0x0ad4('0x17')]()['slice'](0x0,0x13)[_0x0ad4('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x0ad4('0x19'),'value':'15'},{'name':'parent_id','value':_0x90d11a['id']},{'name':_0x0ad4('0x1a'),'value':'Contacts'},{'name':_0x0ad4('0x1b'),'value':_0x90d11a[_0x0ad4('0x10')]},{'name':'direction','value':_0x48c3d9}];if(_0xbbd2bd[_0x0ad4('0x1c')]){_[_0x0ad4('0x1d')](_0xbbd2bd,function(_0x5dbea6){if(_0x2a4ba5[_0x5dbea6[_0x0ad4('0x1e')]]){_0x15b90f[_0x0ad4('0x1f')]({'name':_0x5dbea6[_0x0ad4('0x20')],'value':_0x2a4ba5[_0x5dbea6[_0x0ad4('0x1e')]]});}});}return request({'form':{'method':_0x0ad4('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0ad4('0x22')]({'session':_0x43197c['id'],'module_name':'Calls','name_value_list':_0x15b90f})}});}function getAuth(_0x5394db){return util[_0x0ad4('0x23')]('Basic\x20%s',new Buffer(_0x5394db[_0x0ad4('0x24')]+':X')[_0x0ad4('0x25')](_0x0ad4('0x26')));}function getServerInfo(_0x147361){return request({'form':{'method':_0x0ad4('0x27'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0x147361['id']})}});}function getUser(_0xf47993,_0x2565aa,_0x169232){if(!_[_0x0ad4('0x29')](_0x2565aa)){logger[_0x0ad4('0xe')](_0x0ad4('0x2a'),_0x2565aa);return request({'form':{'method':'get_entry_list','input_type':_0x0ad4('0x28'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x169232['id'],'module_name':_0x0ad4('0x2b'),'query':util[_0x0ad4('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2565aa),'order_by':'','offset':'0','select_fields':['id',_0x0ad4('0x10'),_0x0ad4('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0ad4('0x2d')](function(_0x193a8a){if(_0x193a8a['entry_list'][_0x0ad4('0x1c')]){var _0x34847b=_[_0x0ad4('0x2e')](_0x193a8a[_0x0ad4('0x2f')],function(_0x169555){return _0x169555[_0x0ad4('0x30')]['user_name'][_0x0ad4('0x31')]===_0x2565aa;});if(_0x34847b){logger[_0x0ad4('0xe')]('Agent\x20found!');return BPromise['resolve']({'id':_0x34847b[_0x0ad4('0x30')]['id']['value'],'name':_0x34847b['name_value_list'][_0x0ad4('0x10')]['value']});}}logger[_0x0ad4('0xe')](_0x0ad4('0x32'));return BPromise[_0x0ad4('0x33')]({'id':_0x169232['name_value_list'][_0x0ad4('0x34')][_0x0ad4('0x31')],'name':_0x169232[_0x0ad4('0x30')][_0x0ad4('0x2c')][_0x0ad4('0x31')]});});}else{logger[_0x0ad4('0xe')](_0x0ad4('0x35'));return BPromise[_0x0ad4('0x33')]({'id':_0x169232['name_value_list'][_0x0ad4('0x34')]['value'],'name':_0x169232[_0x0ad4('0x30')][_0x0ad4('0x2c')][_0x0ad4('0x31')]});}}function getEndUser(_0x432f7f,_0x3d72fb,_0x44e177,_0x165c48){logger[_0x0ad4('0xe')]('Searching\x20enduser\x20with\x20phone',_0x44e177);return request({'form':{'method':'get_entry_list','input_type':_0x0ad4('0x28'),'response_type':'JSON','rest_data':JSON[_0x0ad4('0x22')]({'session':_0x165c48['id'],'module_name':_0x0ad4('0x36'),'query':util[_0x0ad4('0x23')](_0x0ad4('0x37'),_0x44e177),'order_by':'','offset':'0','select_fields':['id',_0x0ad4('0x10'),_0x0ad4('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x8764b3){if(_0x8764b3[_0x0ad4('0x2f')][_0x0ad4('0x1c')]){var _0x3e6d2e=_[_0x0ad4('0x2e')](_0x8764b3['entry_list'],function(_0x243058){return _0x243058[_0x0ad4('0x30')][_0x0ad4('0x38')][_0x0ad4('0x31')]===_0x44e177;});if(_0x3e6d2e){logger[_0x0ad4('0xe')](_0x0ad4('0x39'));return BPromise[_0x0ad4('0x33')]({'id':_0x3e6d2e[_0x0ad4('0x30')]['id']['value'],'name':_0x3e6d2e[_0x0ad4('0x30')][_0x0ad4('0x10')][_0x0ad4('0x31')],'phone':_0x3e6d2e[_0x0ad4('0x30')][_0x0ad4('0x38')][_0x0ad4('0x31')]});}}else{logger[_0x0ad4('0xe')](_0x0ad4('0x3a'));return request({'form':{'method':_0x0ad4('0x21'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0x165c48['id'],'module_name':_0x0ad4('0x36'),'name_value_list':[{'name':_0x0ad4('0x3b'),'value':_0x3d72fb!==''?_0x3d72fb:util[_0x0ad4('0x23')](_0x0ad4('0x3c'),_0x44e177)},{'name':_0x0ad4('0x38'),'value':_0x44e177}]})}})[_0x0ad4('0x2d')](function(_0x18bf38){logger[_0x0ad4('0xe')](_0x0ad4('0x3d'));return BPromise[_0x0ad4('0x33')]({'id':_0x18bf38['id'],'name':_0x18bf38[_0x0ad4('0x2f')][_0x0ad4('0x3b')][_0x0ad4('0x31')],'phone':_0x18bf38['entry_list']['phone_home'][_0x0ad4('0x31')]});});}});}function request(_0xc69b7f){logger[_0x0ad4('0x3e')]('[HTTP]',JSON[_0x0ad4('0x22')](_0xc69b7f));return rp(_[_0x0ad4('0x3f')](def,_0xc69b7f));}function getTags(_0x5b655d,_0x3e3a4a){var _0x2aa94f=[];if(_0x5b655d&&_0x5b655d['length']>0x0){_0x2aa94f=_[_0x0ad4('0x40')](_0x5b655d,_0x3e3a4a);}return _0x2aa94f;}function getCustomFields(_0x42f0fb,_0x116e94){var _0x447991=[];var _0x108ac5={'custom_fields':[]};if(_0x42f0fb['length']>0x0){_[_0x0ad4('0x1d')](_0x42f0fb,function(_0x3a26d3){if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x42')&&_0x3a26d3[_0x0ad4('0x43')]&&!_0x3a26d3[_0x0ad4('0x44')]){_0x108ac5[_0x3a26d3[_0x0ad4('0x43')][_0x0ad4('0x45')]()]=_0x3a26d3[_0x0ad4('0x46')]['toString']();}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x42')&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3[_0x0ad4('0x44')]){_0x108ac5[_0x0ad4('0x47')][_0x0ad4('0x1f')]({'id':_0x3a26d3['idField'],'value':_0x3a26d3[_0x0ad4('0x46')][_0x0ad4('0x25')]()});}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x48')&&_0x3a26d3[_0x0ad4('0x1e')]&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3[_0x0ad4('0x44')]){_0x116e94[_0x3a26d3[_0x0ad4('0x1e')]]&&_0x108ac5[_0x0ad4('0x47')][_0x0ad4('0x1f')]({'id':_0x3a26d3[_0x0ad4('0x20')],'value':_0x116e94[_0x3a26d3['variableName']][_0x0ad4('0x25')]()});}else if(_0x3a26d3[_0x0ad4('0x41')]===_0x0ad4('0x49')&&_0x3a26d3[_0x0ad4('0x4a')]&&_0x3a26d3['Variable']['name']&&_0x3a26d3[_0x0ad4('0x20')]&&_0x3a26d3['customField']){_0x116e94[_0x3a26d3[_0x0ad4('0x4a')][_0x0ad4('0x10')][_0x0ad4('0x45')]()]&&_0x108ac5['custom_fields'][_0x0ad4('0x1f')]({'id':_0x3a26d3[_0x0ad4('0x20')],'value':_0x116e94[_0x3a26d3[_0x0ad4('0x4a')][_0x0ad4('0x10')][_0x0ad4('0x45')]()]['toString']()});}});}return _0x108ac5;}function getConnection(_0x49e30c){return request({'method':_0x0ad4('0xd'),'form':{'method':_0x0ad4('0x4b'),'input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'user_auth':{'user_name':_0x49e30c[_0x0ad4('0x4c')],'password':_0x49e30c['password'],'encryption':_0x0ad4('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x422f3f){var _0x4ea158=_0x422f3f;if(_0x4ea158['id']){def['sessionID']=_0x4ea158['id'];return BPromise[_0x0ad4('0x33')](_0x4ea158);}else{throw new Error(util[_0x0ad4('0x23')](_0x0ad4('0x4e'),_0x49e30c['id']));}});}function setRelationship(_0xb27aa7,_0xc6f224,_0x3eea6a,_0xceff9d){return request({'form':{'method':'set_relationship','input_type':_0x0ad4('0x28'),'response_type':_0x0ad4('0x28'),'rest_data':JSON[_0x0ad4('0x22')]({'session':_0xb27aa7['id'],'module_name':'Calls','module_id':_0x3eea6a['id'],'link_field_name':_0xceff9d,'related_ids':[_0xc6f224['id']]})}});}exports[_0x0ad4('0x4f')]=function(_0x5c7a96,_0x193a82,_0x153642,_0x1b302d,_0x38f7ea,_0xb6be21){var _0x3ebfbd,_0x26e36d,_0x2b99c6,_0x56d663;_0xb6be21['remoteUri']=intUtil['stripTrailingSlash'](_0xb6be21[_0x0ad4('0x50')]);_0xb6be21[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0xb6be21[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util[_0x0ad4('0x23')](_0x0ad4('0x54'),_0xb6be21[_0x0ad4('0x50')]);if(_0x38f7ea&&_0x38f7ea[_0x0ad4('0x55')]){logger[_0x0ad4('0xe')](_0x0ad4('0x56'),_0x0ad4('0x57'));_0x193a82[_0x0ad4('0x58')]=util['format'](_0x0ad4('0x59'),_0xb6be21['serverUrl'],_0x193a82[_0x0ad4('0x5a')],md5(_0x193a82[_0x0ad4('0x5a')]));}else{_0x193a82[_0x0ad4('0x58')]='';}return getConnection(_0xb6be21)[_0x0ad4('0x2d')](function(_0x3d7e37){_0x56d663=_0x3d7e37;return getUser(_0xb6be21,_0x1b302d[_0x0ad4('0x10')],_0x56d663);})['then'](function(_0x4d8cb2){_0x3ebfbd=_0x4d8cb2;logger[_0x0ad4('0xe')]('The\x20User\x20ID\x20is:',_0x3ebfbd['id']);return getEndUser(_0xb6be21,_0x193a82[_0x0ad4('0x5b')],_0x193a82[_0x0ad4('0x5c')],_0x56d663);})[_0x0ad4('0x2d')](function(_0x3b7b8d){_0x26e36d=_0x3b7b8d;logger['info'](_0x0ad4('0x5d'),_0x26e36d['id']);return getTicket(_0xb6be21,_0x3ebfbd,_0x26e36d,_0x153642,_0x193a82,_0x153642[_0x0ad4('0x5e')],_0x56d663,_0x0ad4('0x5f'));})[_0x0ad4('0x2d')](function(_0x2d5b26){_0x2b99c6=_0x2d5b26;logger['info']('Ticket\x20created!');logger[_0x0ad4('0xe')](_0x0ad4('0x60'),_0x2b99c6['id']);return setRelationship(_0x56d663,_0x3ebfbd,_0x2b99c6,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x56d663,_0x26e36d,_0x2b99c6,_0x0ad4('0x62'));})['then'](function(){return getServerInfo(_0x56d663);})[_0x0ad4('0x2d')](function(_0x3735fc){var _0x5928be=parseInt(_0x3735fc[_0x0ad4('0x63')][_0x0ad4('0x64')](0x0));var _0x416c5c=util[_0x0ad4('0x23')](_0x0ad4('0x65'),_0xb6be21[_0x0ad4('0x50')],_0x2b99c6['id']);if(_0x5928be>0x6){_0x416c5c=util[_0x0ad4('0x23')](_0x0ad4('0x66'),_0xb6be21['remoteUri'],_0x2b99c6['id']);}logger[_0x0ad4('0xe')](_0x0ad4('0x56'),_0x0ad4('0x67'));emit(util[_0x0ad4('0x23')](_0x0ad4('0x68'),_0x1b302d['name']),_0x0ad4('0x69'),{'uri':_0x416c5c});})[_0x0ad4('0x6a')](function(_0x24b332){logger[_0x0ad4('0x6b')]('[QUEUE]',JSON[_0x0ad4('0x22')](_0x24b332));});};exports[_0x0ad4('0x6c')]=function(_0x152eed,_0x3b03cc,_0x1ec41d,_0x4109ce,_0x2edb0b,_0x569832,_0x5e1a9a){var _0xa3c0ef,_0x497c8b,_0xc79343,_0x3508f1;_0x569832[_0x0ad4('0x50')]=intUtil[_0x0ad4('0x52')](_0x569832[_0x0ad4('0x50')]);_0x569832[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0x569832[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util[_0x0ad4('0x23')](_0x0ad4('0x54'),_0x569832[_0x0ad4('0x50')]);if(_0x5e1a9a&&_0x5e1a9a[_0x0ad4('0x6d')]&&_0x5e1a9a['recordingFormat']!=='none'){logger[_0x0ad4('0xe')](_0x0ad4('0x6e'),_0x0ad4('0x57'));_0x3b03cc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x569832[_0x0ad4('0x51')],_0x3b03cc['uniqueid'],md5(_0x3b03cc[_0x0ad4('0x5a')]));}return getConnection(_0x569832)[_0x0ad4('0x2d')](function(_0x12d3d9){_0x3508f1=_0x12d3d9;return getUser(_0x569832,_0x4109ce[_0x0ad4('0x10')],_0x3508f1);})[_0x0ad4('0x2d')](function(_0x478445){_0xa3c0ef=_0x478445;logger[_0x0ad4('0xe')](_0x0ad4('0x6f'),_0xa3c0ef['id']);return getEndUser(_0x569832,_0x3b03cc['destcalleridname'],_0x3b03cc['destcalleridnum'],_0x3508f1);})[_0x0ad4('0x2d')](function(_0x445173){_0x497c8b=_0x445173;logger[_0x0ad4('0xe')](_0x0ad4('0x5d'),_0x497c8b['id']);return getTicket(_0x569832,_0xa3c0ef,_0x497c8b,_0x1ec41d,_0x3b03cc,_0x1ec41d[_0x0ad4('0x5e')],_0x3508f1,_0x0ad4('0x70'));})[_0x0ad4('0x2d')](function(_0x239b59){_0xc79343=_0x239b59;logger['info'](_0x0ad4('0x71'));logger[_0x0ad4('0xe')](_0x0ad4('0x60'),_0xc79343['id']);return setRelationship(_0x3508f1,_0xa3c0ef,_0xc79343,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x3508f1,_0x497c8b,_0xc79343,_0x0ad4('0x62'));})[_0x0ad4('0x2d')](function(){return getServerInfo(_0x3508f1);})[_0x0ad4('0x2d')](function(_0x1efe6d){var _0xdb1230=parseInt(_0x1efe6d['version'][_0x0ad4('0x64')](0x0));var _0x19460a=util[_0x0ad4('0x23')](_0x0ad4('0x65'),_0x569832[_0x0ad4('0x50')],_0xc79343['id']);if(_0xdb1230>0x6){_0x19460a=util[_0x0ad4('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x569832[_0x0ad4('0x50')],_0xc79343['id']);}logger[_0x0ad4('0xe')]('[OUTBOUND]',_0x0ad4('0x67'));emit(util[_0x0ad4('0x23')](_0x0ad4('0x68'),_0x4109ce[_0x0ad4('0x10')]),_0x0ad4('0x69'),{'uri':_0x19460a});})[_0x0ad4('0x6a')](function(_0x409149){logger[_0x0ad4('0x6b')](_0x0ad4('0x6e'),JSON[_0x0ad4('0x22')](_0x409149));});};exports[_0x0ad4('0x72')]=function(_0x1831db,_0x377f48,_0x226bef,_0x278eea,_0x51d48c,_0x50d30c){var _0x166d2b,_0x3dcd37,_0x3c9a3a,_0x41f21f;_0x50d30c[_0x0ad4('0x50')]=intUtil[_0x0ad4('0x52')](_0x50d30c['remoteUri']);_0x50d30c[_0x0ad4('0x51')]=intUtil[_0x0ad4('0x52')](_0x50d30c[_0x0ad4('0x51')]);def[_0x0ad4('0x53')]=util['format']('%s/service/v4_1/rest.php',_0x50d30c[_0x0ad4('0x50')]);if(_0x51d48c&&_0x51d48c[_0x0ad4('0x55')]){logger[_0x0ad4('0xe')]('['+_0x377f48[_0x0ad4('0x73')][_0x0ad4('0x74')]()+']',_0x0ad4('0x57'));_0x377f48['recordingURL']=util['format'](_0x0ad4('0x59'),_0x50d30c[_0x0ad4('0x51')],_0x377f48['uniqueid'],md5(_0x377f48['uniqueid']));}else{_0x377f48[_0x0ad4('0x58')]='';}return getConnection(_0x50d30c)['then'](function(_0x49c5e2){_0x41f21f=_0x49c5e2;if(!_['isNil'](_0x278eea)){return getUser(_0x50d30c,_0x278eea[_0x0ad4('0x10')],_0x41f21f);}else{return getUser(_0x50d30c,null,_0x41f21f);}})[_0x0ad4('0x2d')](function(_0x438813){_0x166d2b=_0x438813;logger[_0x0ad4('0xe')]('The\x20User\x20ID\x20is:',_0x166d2b['id']);return getEndUser(_0x50d30c,_0x377f48[_0x0ad4('0x5b')],_0x377f48[_0x0ad4('0x5c')],_0x41f21f);})[_0x0ad4('0x2d')](function(_0x300d40){_0x3dcd37=_0x300d40;logger['info'](_0x0ad4('0x5d'),_0x3dcd37['id']);return getTicket(_0x50d30c,_0x166d2b,_0x3dcd37,_0x226bef,_0x377f48,_0x226bef[_0x0ad4('0x5e')],_0x41f21f,'Inbound');})['then'](function(_0x226677){_0x3c9a3a=_0x226677;logger[_0x0ad4('0xe')](_0x0ad4('0x71'));logger[_0x0ad4('0xe')]('The\x20Ticket\x20ID\x20is:',_0x3c9a3a['id']);return setRelationship(_0x41f21f,_0x166d2b,_0x3c9a3a,_0x0ad4('0x61'));})[_0x0ad4('0x2d')](function(){return setRelationship(_0x41f21f,_0x3dcd37,_0x3c9a3a,_0x0ad4('0x62'));})['then'](function(){return getServerInfo(_0x41f21f);})['catch'](function(_0x4f1103){logger[_0x0ad4('0x6b')]('['+_0x377f48[_0x0ad4('0x73')][_0x0ad4('0x74')]()+']',JSON['stringify'](_0x4f1103));});}; \ No newline at end of file +var _0x2b47=['users','version','charAt','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','contacts','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','lastevent','toUpperCase','calleridnum','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','duration_hours','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','apiKey','base64','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','string','nameField','customField','toLowerCase','type','content','toString','variable','custom_fields','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','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','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:'];(function(_0x226961,_0x1691d6){var _0x341579=function(_0x56a479){while(--_0x56a479){_0x226961['push'](_0x226961['shift']());}};_0x341579(++_0x1691d6);}(_0x2b47,0x177));var _0x72b4=function(_0x3fa392,_0x4eceb0){_0x3fa392=_0x3fa392-0x0;var _0xd438c5=_0x2b47[_0x3fa392];return _0xd438c5;};'use strict';var _=require(_0x72b4('0x0'));var rp=require('request-promise');var BPromise=require(_0x72b4('0x1'));var md5=require(_0x72b4('0x2'));var util=require(_0x72b4('0x3'));var Redis=require('ioredis');var intUtil=require(_0x72b4('0x4'));var config=require(_0x72b4('0x5'));var logger=require(_0x72b4('0x6'))(_0x72b4('0x7'));config[_0x72b4('0x8')]=_[_0x72b4('0x9')](config['redis'],{'host':_0x72b4('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x72b4('0x8')]));var def={'method':_0x72b4('0xb'),'json':!![]};function emit(_0xb1e42f,_0x1bdf7f,_0x84381c){io['to'](_0xb1e42f)[_0x72b4('0xc')](_0x1bdf7f,_0x84381c);}function getTicket(_0x114a98,_0x165537,_0x3d2504,_0x438e61,_0x26d199,_0x4dee4e,_0x542fb7,_0x406ca3){logger[_0x72b4('0xd')](_0x72b4('0xe'));var _0x19e7d3=new Date();var _0x2b80f0=[{'name':_0x72b4('0xf'),'value':intUtil[_0x72b4('0x10')](_0x438e61[_0x72b4('0x11')],_0x26d199,'\x20')},{'name':_0x72b4('0x12'),'value':_0x165537['id']},{'name':_0x72b4('0x13'),'value':_0x165537['id']},{'name':'description','value':intUtil[_0x72b4('0x10')](_0x438e61[_0x72b4('0x14')],_0x26d199,'\x0a')},{'name':_0x72b4('0x15'),'value':_0x19e7d3[_0x72b4('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x72b4('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x72b4('0x18'),'value':_0x3d2504['id']},{'name':_0x72b4('0x19'),'value':'Contacts'},{'name':_0x72b4('0x1a'),'value':_0x3d2504[_0x72b4('0xf')]},{'name':_0x72b4('0x1b'),'value':_0x406ca3}];if(_0x4dee4e[_0x72b4('0x1c')]){_[_0x72b4('0x1d')](_0x4dee4e,function(_0x334910){if(_0x26d199[_0x334910[_0x72b4('0x1e')]]){_0x2b80f0[_0x72b4('0x1f')]({'name':_0x334910[_0x72b4('0x20')],'value':_0x26d199[_0x334910['variableName']]});}});}return request({'form':{'method':_0x72b4('0x21'),'input_type':'JSON','response_type':_0x72b4('0x22'),'rest_data':JSON[_0x72b4('0x23')]({'session':_0x542fb7['id'],'module_name':'Calls','name_value_list':_0x2b80f0})}});}function getAuth(_0x13d8d1){return util[_0x72b4('0x24')]('Basic\x20%s',new Buffer(_0x13d8d1[_0x72b4('0x25')]+':X')['toString'](_0x72b4('0x26')));}function getServerInfo(_0x5dce4d){return request({'form':{'method':'get_server_info','input_type':_0x72b4('0x22'),'response_type':'JSON','rest_data':JSON[_0x72b4('0x23')]({'session':_0x5dce4d['id']})}});}function getUser(_0x8e0277,_0x1da2a5,_0x4f4ce8){if(!_[_0x72b4('0x27')](_0x1da2a5)){logger[_0x72b4('0xd')](_0x72b4('0x28'),_0x1da2a5);return request({'form':{'method':'get_entry_list','input_type':_0x72b4('0x22'),'response_type':_0x72b4('0x22'),'rest_data':JSON[_0x72b4('0x23')]({'session':_0x4f4ce8['id'],'module_name':_0x72b4('0x29'),'query':util[_0x72b4('0x24')](_0x72b4('0x2a'),_0x1da2a5),'order_by':'','offset':'0','select_fields':['id',_0x72b4('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72b4('0x2b')](function(_0x5d0d20){if(_0x5d0d20[_0x72b4('0x2c')][_0x72b4('0x1c')]){var _0x3489bc=_[_0x72b4('0x2d')](_0x5d0d20[_0x72b4('0x2c')],function(_0x3c7167){return _0x3c7167['name_value_list'][_0x72b4('0x2e')][_0x72b4('0x2f')]===_0x1da2a5;});if(_0x3489bc){logger[_0x72b4('0xd')](_0x72b4('0x30'));return BPromise[_0x72b4('0x31')]({'id':_0x3489bc[_0x72b4('0x32')]['id'][_0x72b4('0x2f')],'name':_0x3489bc[_0x72b4('0x32')]['name'][_0x72b4('0x2f')]});}}logger[_0x72b4('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x72b4('0x31')]({'id':_0x4f4ce8[_0x72b4('0x32')][_0x72b4('0x33')][_0x72b4('0x2f')],'name':_0x4f4ce8[_0x72b4('0x32')][_0x72b4('0x2e')][_0x72b4('0x2f')]});});}else{logger[_0x72b4('0xd')](_0x72b4('0x34'));return BPromise[_0x72b4('0x31')]({'id':_0x4f4ce8[_0x72b4('0x32')][_0x72b4('0x33')][_0x72b4('0x2f')],'name':_0x4f4ce8[_0x72b4('0x32')][_0x72b4('0x2e')][_0x72b4('0x2f')]});}}function getEndUser(_0x588b8c,_0x4a7867,_0x14b77c,_0x503442){logger[_0x72b4('0xd')]('Searching\x20enduser\x20with\x20phone',_0x14b77c);return request({'form':{'method':_0x72b4('0x35'),'input_type':_0x72b4('0x22'),'response_type':_0x72b4('0x22'),'rest_data':JSON[_0x72b4('0x23')]({'session':_0x503442['id'],'module_name':'Contacts','query':util[_0x72b4('0x24')](_0x72b4('0x36'),_0x14b77c),'order_by':'','offset':'0','select_fields':['id',_0x72b4('0xf'),_0x72b4('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x72b4('0x2b')](function(_0x22c56c){if(_0x22c56c[_0x72b4('0x2c')][_0x72b4('0x1c')]){var _0x176651=_['find'](_0x22c56c['entry_list'],function(_0xf1c65c){return _0xf1c65c['name_value_list']['phone_home'][_0x72b4('0x2f')]===_0x14b77c;});if(_0x176651){logger['info'](_0x72b4('0x38'));return BPromise[_0x72b4('0x31')]({'id':_0x176651[_0x72b4('0x32')]['id'][_0x72b4('0x2f')],'name':_0x176651[_0x72b4('0x32')][_0x72b4('0xf')][_0x72b4('0x2f')],'phone':_0x176651[_0x72b4('0x32')][_0x72b4('0x37')][_0x72b4('0x2f')]});}}else{logger[_0x72b4('0xd')](_0x72b4('0x39'));return request({'form':{'method':_0x72b4('0x21'),'input_type':_0x72b4('0x22'),'response_type':'JSON','rest_data':JSON[_0x72b4('0x23')]({'session':_0x503442['id'],'module_name':_0x72b4('0x3a'),'name_value_list':[{'name':'first_name','value':_0x4a7867!==_0x72b4('0x3b')?_0x4a7867:util[_0x72b4('0x24')](_0x72b4('0x3c'),_0x14b77c)},{'name':_0x72b4('0x37'),'value':_0x14b77c}]})}})['then'](function(_0x1b8152){logger[_0x72b4('0xd')](_0x72b4('0x3d'));return BPromise[_0x72b4('0x31')]({'id':_0x1b8152['id'],'name':_0x1b8152[_0x72b4('0x2c')]['first_name']['value'],'phone':_0x1b8152[_0x72b4('0x2c')][_0x72b4('0x37')]['value']});});}});}function request(_0x4bd077){logger['debug'](_0x72b4('0x3e'),JSON['stringify'](_0x4bd077));return rp(_['merge'](def,_0x4bd077));}function getTags(_0x1807ee,_0x16e0b7){var _0x5ab64e=[];if(_0x1807ee&&_0x1807ee[_0x72b4('0x1c')]>0x0){_0x5ab64e=_[_0x72b4('0x3f')](_0x1807ee,_0x16e0b7);}return _0x5ab64e;}function getCustomFields(_0x5b8f8f,_0x24ea07){var _0x1e10bb=[];var _0x555f6b={'custom_fields':[]};if(_0x5b8f8f[_0x72b4('0x1c')]>0x0){_[_0x72b4('0x1d')](_0x5b8f8f,function(_0x536db0){if(_0x536db0['type']===_0x72b4('0x40')&&_0x536db0[_0x72b4('0x41')]&&!_0x536db0[_0x72b4('0x42')]){_0x555f6b[_0x536db0[_0x72b4('0x41')][_0x72b4('0x43')]()]=_0x536db0['content']['toString']();}else if(_0x536db0[_0x72b4('0x44')]===_0x72b4('0x40')&&_0x536db0[_0x72b4('0x20')]&&_0x536db0[_0x72b4('0x42')]){_0x555f6b['custom_fields'][_0x72b4('0x1f')]({'id':_0x536db0[_0x72b4('0x20')],'value':_0x536db0[_0x72b4('0x45')][_0x72b4('0x46')]()});}else if(_0x536db0['type']===_0x72b4('0x47')&&_0x536db0[_0x72b4('0x1e')]&&_0x536db0[_0x72b4('0x20')]&&_0x536db0['customField']){_0x24ea07[_0x536db0[_0x72b4('0x1e')]]&&_0x555f6b[_0x72b4('0x48')][_0x72b4('0x1f')]({'id':_0x536db0['idField'],'value':_0x24ea07[_0x536db0['variableName']][_0x72b4('0x46')]()});}else if(_0x536db0[_0x72b4('0x44')]==='customVariable'&&_0x536db0[_0x72b4('0x49')]&&_0x536db0[_0x72b4('0x49')][_0x72b4('0xf')]&&_0x536db0[_0x72b4('0x20')]&&_0x536db0[_0x72b4('0x42')]){_0x24ea07[_0x536db0['Variable'][_0x72b4('0xf')]['toLowerCase']()]&&_0x555f6b[_0x72b4('0x48')]['push']({'id':_0x536db0['idField'],'value':_0x24ea07[_0x536db0[_0x72b4('0x49')]['name'][_0x72b4('0x43')]()]['toString']()});}});}return _0x555f6b;}function getConnection(_0x26096b){return request({'method':_0x72b4('0xb'),'form':{'method':_0x72b4('0x4a'),'input_type':_0x72b4('0x22'),'response_type':_0x72b4('0x22'),'rest_data':JSON[_0x72b4('0x23')]({'user_auth':{'user_name':_0x26096b[_0x72b4('0x4b')],'password':_0x26096b['password'],'encryption':_0x72b4('0x4c')},'application':_0x72b4('0x4d')})}})['then'](function(_0x136c7d){var _0x4c76a6=_0x136c7d;if(_0x4c76a6['id']){def[_0x72b4('0x4e')]=_0x4c76a6['id'];return BPromise[_0x72b4('0x31')](_0x4c76a6);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x26096b['id']));}});}function setRelationship(_0x301e1b,_0x5ae0fd,_0xce0288,_0x47bfac){return request({'form':{'method':'set_relationship','input_type':_0x72b4('0x22'),'response_type':_0x72b4('0x22'),'rest_data':JSON['stringify']({'session':_0x301e1b['id'],'module_name':_0x72b4('0x4f'),'module_id':_0xce0288['id'],'link_field_name':_0x47bfac,'related_ids':[_0x5ae0fd['id']]})}});}exports[_0x72b4('0x50')]=function(_0x1ca327,_0x1bd4e9,_0x1d11fe,_0xc85420,_0x2148e4,_0xa1ecbd){var _0x467b8c,_0x4705fd,_0x4843b2,_0x532b95;_0xa1ecbd[_0x72b4('0x51')]=intUtil[_0x72b4('0x52')](_0xa1ecbd['remoteUri']);_0xa1ecbd[_0x72b4('0x53')]=intUtil['stripTrailingSlash'](_0xa1ecbd[_0x72b4('0x53')]);def[_0x72b4('0x54')]=util[_0x72b4('0x24')](_0x72b4('0x55'),_0xa1ecbd[_0x72b4('0x51')]);if(_0x2148e4&&_0x2148e4[_0x72b4('0x56')]){logger['info'](_0x72b4('0x57'),_0x72b4('0x58'));_0x1bd4e9[_0x72b4('0x59')]=util[_0x72b4('0x24')](_0x72b4('0x5a'),_0xa1ecbd[_0x72b4('0x53')],_0x1bd4e9[_0x72b4('0x5b')],md5(_0x1bd4e9[_0x72b4('0x5b')]));}else{_0x1bd4e9[_0x72b4('0x59')]='';}return getConnection(_0xa1ecbd)[_0x72b4('0x2b')](function(_0x148db0){_0x532b95=_0x148db0;return getUser(_0xa1ecbd,_0xc85420[_0x72b4('0xf')],_0x532b95);})[_0x72b4('0x2b')](function(_0x503c5a){_0x467b8c=_0x503c5a;logger[_0x72b4('0xd')]('The\x20User\x20ID\x20is:',_0x467b8c['id']);return getEndUser(_0xa1ecbd,_0x1bd4e9[_0x72b4('0x5c')],_0x1bd4e9['calleridnum'],_0x532b95);})['then'](function(_0x3c6819){_0x4705fd=_0x3c6819;logger[_0x72b4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x4705fd['id']);return getTicket(_0xa1ecbd,_0x467b8c,_0x4705fd,_0x1d11fe,_0x1bd4e9,_0x1d11fe[_0x72b4('0x5d')],_0x532b95,_0x72b4('0x5e'));})[_0x72b4('0x2b')](function(_0x18b42e){_0x4843b2=_0x18b42e;logger[_0x72b4('0xd')](_0x72b4('0x5f'));logger[_0x72b4('0xd')](_0x72b4('0x60'),_0x4843b2['id']);return setRelationship(_0x532b95,_0x467b8c,_0x4843b2,_0x72b4('0x61'));})[_0x72b4('0x2b')](function(){return setRelationship(_0x532b95,_0x4705fd,_0x4843b2,'contacts');})['then'](function(){return getServerInfo(_0x532b95);})[_0x72b4('0x2b')](function(_0x1874f2){var _0x2602ef=parseInt(_0x1874f2[_0x72b4('0x62')][_0x72b4('0x63')](0x0));var _0x3f0d2d=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xa1ecbd['remoteUri'],_0x4843b2['id']);if(_0x2602ef>0x6){_0x3f0d2d=util[_0x72b4('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xa1ecbd[_0x72b4('0x51')],_0x4843b2['id']);}logger[_0x72b4('0xd')](_0x72b4('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0xc85420['name']),_0x72b4('0x64'),{'uri':_0x3f0d2d});})[_0x72b4('0x65')](function(_0x83caa6){logger[_0x72b4('0x66')](_0x72b4('0x57'),JSON[_0x72b4('0x23')](_0x83caa6));});};exports[_0x72b4('0x67')]=function(_0x4d6889,_0x2899cf,_0x991275,_0xf90022,_0x240d3a,_0x128a7d,_0x1bbe16){var _0x5aea4b,_0x1ca7ca,_0x21b33e,_0x5e120d;_0x128a7d['remoteUri']=intUtil[_0x72b4('0x52')](_0x128a7d[_0x72b4('0x51')]);_0x128a7d[_0x72b4('0x53')]=intUtil['stripTrailingSlash'](_0x128a7d[_0x72b4('0x53')]);def[_0x72b4('0x54')]=util[_0x72b4('0x24')](_0x72b4('0x55'),_0x128a7d[_0x72b4('0x51')]);if(_0x1bbe16&&_0x1bbe16['recordingFormat']&&_0x1bbe16[_0x72b4('0x68')]!==_0x72b4('0x69')){logger['info'](_0x72b4('0x6a'),_0x72b4('0x58'));_0x2899cf[_0x72b4('0x59')]=util[_0x72b4('0x24')](_0x72b4('0x5a'),_0x128a7d[_0x72b4('0x53')],_0x2899cf[_0x72b4('0x5b')],md5(_0x2899cf[_0x72b4('0x5b')]));}return getConnection(_0x128a7d)['then'](function(_0x3f69d0){_0x5e120d=_0x3f69d0;return getUser(_0x128a7d,_0xf90022[_0x72b4('0xf')],_0x5e120d);})['then'](function(_0x401535){_0x5aea4b=_0x401535;logger[_0x72b4('0xd')]('The\x20User\x20ID\x20is:',_0x5aea4b['id']);return getEndUser(_0x128a7d,_0x2899cf[_0x72b4('0x6b')],_0x2899cf[_0x72b4('0x6c')],_0x5e120d);})[_0x72b4('0x2b')](function(_0x3b2438){_0x1ca7ca=_0x3b2438;logger['info'](_0x72b4('0x6d'),_0x1ca7ca['id']);return getTicket(_0x128a7d,_0x5aea4b,_0x1ca7ca,_0x991275,_0x2899cf,_0x991275[_0x72b4('0x5d')],_0x5e120d,_0x72b4('0x6e'));})['then'](function(_0x4d7462){_0x21b33e=_0x4d7462;logger[_0x72b4('0xd')](_0x72b4('0x5f'));logger[_0x72b4('0xd')](_0x72b4('0x60'),_0x21b33e['id']);return setRelationship(_0x5e120d,_0x5aea4b,_0x21b33e,_0x72b4('0x61'));})['then'](function(){return setRelationship(_0x5e120d,_0x1ca7ca,_0x21b33e,_0x72b4('0x6f'));})[_0x72b4('0x2b')](function(){return getServerInfo(_0x5e120d);})[_0x72b4('0x2b')](function(_0x2f00ae){var _0x4f6a2a=parseInt(_0x2f00ae[_0x72b4('0x62')][_0x72b4('0x63')](0x0));var _0xbadf64=util[_0x72b4('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x128a7d[_0x72b4('0x51')],_0x21b33e['id']);if(_0x4f6a2a>0x6){_0xbadf64=util[_0x72b4('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x128a7d[_0x72b4('0x51')],_0x21b33e['id']);}logger[_0x72b4('0xd')]('[OUTBOUND]',_0x72b4('0x70'));emit(util[_0x72b4('0x24')](_0x72b4('0x71'),_0xf90022[_0x72b4('0xf')]),_0x72b4('0x64'),{'uri':_0xbadf64});})[_0x72b4('0x65')](function(_0x5adddf){logger['error'](_0x72b4('0x6a'),JSON['stringify'](_0x5adddf));});};exports[_0x72b4('0x72')]=function(_0x18d5dc,_0x3fed16,_0x265102,_0xd48642,_0x59c1fe,_0x327b81){var _0x430df6,_0x17f35a,_0x38111f,_0x405c02;_0x327b81['remoteUri']=intUtil[_0x72b4('0x52')](_0x327b81[_0x72b4('0x51')]);_0x327b81[_0x72b4('0x53')]=intUtil[_0x72b4('0x52')](_0x327b81[_0x72b4('0x53')]);def['uri']=util[_0x72b4('0x24')](_0x72b4('0x55'),_0x327b81[_0x72b4('0x51')]);if(_0x59c1fe&&_0x59c1fe['monitor_format']){logger[_0x72b4('0xd')]('['+_0x3fed16[_0x72b4('0x73')][_0x72b4('0x74')]()+']',_0x72b4('0x58'));_0x3fed16[_0x72b4('0x59')]=util[_0x72b4('0x24')](_0x72b4('0x5a'),_0x327b81[_0x72b4('0x53')],_0x3fed16[_0x72b4('0x5b')],md5(_0x3fed16[_0x72b4('0x5b')]));}else{_0x3fed16['recordingURL']='';}return getConnection(_0x327b81)[_0x72b4('0x2b')](function(_0x25e0f8){_0x405c02=_0x25e0f8;if(!_[_0x72b4('0x27')](_0xd48642)){return getUser(_0x327b81,_0xd48642['name'],_0x405c02);}else{return getUser(_0x327b81,null,_0x405c02);}})['then'](function(_0x30195f){_0x430df6=_0x30195f;logger[_0x72b4('0xd')]('The\x20User\x20ID\x20is:',_0x430df6['id']);return getEndUser(_0x327b81,_0x3fed16[_0x72b4('0x5c')],_0x3fed16[_0x72b4('0x75')],_0x405c02);})['then'](function(_0x5e2dd5){_0x17f35a=_0x5e2dd5;logger[_0x72b4('0xd')](_0x72b4('0x6d'),_0x17f35a['id']);return getTicket(_0x327b81,_0x430df6,_0x17f35a,_0x265102,_0x3fed16,_0x265102[_0x72b4('0x5d')],_0x405c02,'Inbound');})[_0x72b4('0x2b')](function(_0x460996){_0x38111f=_0x460996;logger[_0x72b4('0xd')](_0x72b4('0x5f'));logger[_0x72b4('0xd')](_0x72b4('0x60'),_0x38111f['id']);return setRelationship(_0x405c02,_0x430df6,_0x38111f,_0x72b4('0x61'));})[_0x72b4('0x2b')](function(){return setRelationship(_0x405c02,_0x17f35a,_0x38111f,'contacts');})['then'](function(){return getServerInfo(_0x405c02);})[_0x72b4('0x65')](function(_0x25b6d1){logger[_0x72b4('0x66')]('['+_0x3fed16[_0x72b4('0x73')]['toUpperCase']()+']',JSON[_0x72b4('0x23')](_0x25b6d1));});}; \ 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 eb23c0d..d2984d8 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 _0xf26e=['util','getString','length','sortBy','content','type','variable','variableName','push','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','customVariable','stripTrailingSlash','slice','substring','isNil','test','lodash'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xf26e,0x67));var _0xef26=function(_0x44af12,_0x587bda){_0x44af12=_0x44af12-0x0;var _0xa6c21d=_0xf26e[_0x44af12];return _0xa6c21d;};'use strict';var _=require(_0xef26('0x0'));var util=require(_0xef26('0x1'));exports[_0xef26('0x2')]=function(_0x4d473b,_0x94c5d5,_0x440f94){var _0x1b067c=[];if(_0x4d473b[_0xef26('0x3')]>0x0){var _0x300a84=_[_0xef26('0x4')](_0x4d473b,['id']);for(var _0x33ea97=0x0;_0x33ea97<_0x300a84['length'];_0x33ea97++){var _0x3fb1f6=_0x300a84[_0x33ea97];if(_0x3fb1f6['type']==='string'){_0x1b067c['push'](_0x3fb1f6[_0xef26('0x5')]);}else if(_0x3fb1f6[_0xef26('0x6')]===_0xef26('0x7')&&_0x3fb1f6[_0xef26('0x8')]){_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]&&_0x1b067c[_0xef26('0x9')](_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]][_0xef26('0xa')]());}else if(_0x3fb1f6[_0xef26('0x6')]==='customVariable'&&_0x3fb1f6['Variable']&&_0x3fb1f6['Variable'][_0xef26('0xb')]){_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')]['toLowerCase']()]&&_0x1b067c['push'](_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')][_0xef26('0xd')]()][_0xef26('0xa')]());}else if(_0x3fb1f6[_0xef26('0x6')]===_0xef26('0xe')){if(_0x3fb1f6[_0xef26('0xf')]==='string'&&_0x3fb1f6[_0xef26('0x10')]){_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')]('%s:\x20%s',_0x3fb1f6['key'],_0x3fb1f6[_0xef26('0x12')]));}else if(_0x3fb1f6[_0xef26('0xf')]===_0xef26('0x7')&&_0x3fb1f6[_0xef26('0x8')]&&_0x3fb1f6['key']){_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]&&_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')](_0xef26('0x13'),_0x3fb1f6[_0xef26('0x10')],_0x94c5d5[_0x3fb1f6[_0xef26('0x8')]]));}else if(_0x3fb1f6[_0xef26('0xf')]===_0xef26('0x14')&&_0x3fb1f6[_0xef26('0xc')]&&_0x3fb1f6['Variable'][_0xef26('0xb')]&&_0x3fb1f6['key']){_0x94c5d5[_0x3fb1f6[_0xef26('0xc')][_0xef26('0xb')][_0xef26('0xd')]()]&&_0x1b067c[_0xef26('0x9')](util[_0xef26('0x11')](_0xef26('0x13'),_0x3fb1f6[_0xef26('0x10')],_0x94c5d5[_0x3fb1f6[_0xef26('0xc')]['name'][_0xef26('0xd')]()]));}}}}return _0x1b067c['join'](_0x440f94);};exports[_0xef26('0x15')]=function(_0x54b40f){var _0x11323e=_0x54b40f[_0xef26('0x16')](-0x1);if(_0x11323e==='/'){_0x54b40f=_0x54b40f[_0xef26('0x17')](0x0,_0x54b40f['lastIndexOf'](_0x11323e));}return _0x54b40f;};exports['validateEmail']=function(_0x2e4c00){if(!_[_0xef26('0x18')](_0x2e4c00)&&_0x2e4c00!==''){var _0x16a440=/^(([^<>()\[\]\\.,;:\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 _0x16a440[_0xef26('0x19')](String(_0x2e4c00)[_0xef26('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xe6c3=['validateEmail','isNil','test','lodash','getString','length','sortBy','type','string','content','variable','variableName','push','toString','name','Variable','toLowerCase','keyValue','key','format','keyType','%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe6c3,0x153));var _0x3e6c=function(_0x17713e,_0x5441e8){_0x17713e=_0x17713e-0x0;var _0x506c75=_0xe6c3[_0x17713e];return _0x506c75;};'use strict';var _=require(_0x3e6c('0x0'));var util=require('util');exports[_0x3e6c('0x1')]=function(_0x2d7400,_0x3b5ceb,_0x18e701){var _0x491798=[];if(_0x2d7400[_0x3e6c('0x2')]>0x0){var _0x444a12=_[_0x3e6c('0x3')](_0x2d7400,['id']);for(var _0x123e7c=0x0;_0x123e7c<_0x444a12[_0x3e6c('0x2')];_0x123e7c++){var _0x3f088d=_0x444a12[_0x123e7c];if(_0x3f088d[_0x3e6c('0x4')]===_0x3e6c('0x5')){_0x491798['push'](_0x3f088d[_0x3e6c('0x6')]);}else if(_0x3f088d[_0x3e6c('0x4')]===_0x3e6c('0x7')&&_0x3f088d[_0x3e6c('0x8')]){_0x3b5ceb[_0x3f088d[_0x3e6c('0x8')]]&&_0x491798[_0x3e6c('0x9')](_0x3b5ceb[_0x3f088d[_0x3e6c('0x8')]][_0x3e6c('0xa')]());}else if(_0x3f088d[_0x3e6c('0x4')]==='customVariable'&&_0x3f088d['Variable']&&_0x3f088d['Variable'][_0x3e6c('0xb')]){_0x3b5ceb[_0x3f088d[_0x3e6c('0xc')][_0x3e6c('0xb')][_0x3e6c('0xd')]()]&&_0x491798[_0x3e6c('0x9')](_0x3b5ceb[_0x3f088d['Variable']['name'][_0x3e6c('0xd')]()][_0x3e6c('0xa')]());}else if(_0x3f088d['type']===_0x3e6c('0xe')){if(_0x3f088d['keyType']==='string'&&_0x3f088d[_0x3e6c('0xf')]){_0x491798[_0x3e6c('0x9')](util[_0x3e6c('0x10')]('%s:\x20%s',_0x3f088d[_0x3e6c('0xf')],_0x3f088d['keyContent']));}else if(_0x3f088d[_0x3e6c('0x11')]===_0x3e6c('0x7')&&_0x3f088d[_0x3e6c('0x8')]&&_0x3f088d[_0x3e6c('0xf')]){_0x3b5ceb[_0x3f088d[_0x3e6c('0x8')]]&&_0x491798[_0x3e6c('0x9')](util[_0x3e6c('0x10')](_0x3e6c('0x12'),_0x3f088d['key'],_0x3b5ceb[_0x3f088d['variableName']]));}else if(_0x3f088d[_0x3e6c('0x11')]===_0x3e6c('0x13')&&_0x3f088d[_0x3e6c('0xc')]&&_0x3f088d[_0x3e6c('0xc')][_0x3e6c('0xb')]&&_0x3f088d[_0x3e6c('0xf')]){_0x3b5ceb[_0x3f088d[_0x3e6c('0xc')][_0x3e6c('0xb')][_0x3e6c('0xd')]()]&&_0x491798['push'](util['format'](_0x3e6c('0x12'),_0x3f088d[_0x3e6c('0xf')],_0x3b5ceb[_0x3f088d[_0x3e6c('0xc')][_0x3e6c('0xb')][_0x3e6c('0xd')]()]));}}}}return _0x491798[_0x3e6c('0x14')](_0x18e701);};exports[_0x3e6c('0x15')]=function(_0xd2f22c){var _0x1c77a4=_0xd2f22c[_0x3e6c('0x16')](-0x1);if(_0x1c77a4==='/'){_0xd2f22c=_0xd2f22c[_0x3e6c('0x17')](0x0,_0xd2f22c[_0x3e6c('0x18')](_0x1c77a4));}return _0xd2f22c;};exports[_0x3e6c('0x19')]=function(_0x51664b){if(!_[_0x3e6c('0x1a')](_0x51664b)&&_0x51664b!==''){var _0x2eb750=/^(([^<>()\[\]\\.,;:\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 _0x2eb750[_0x3e6c('0x1b')](String(_0x51664b)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index c63ebc2..e0ab203 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 _0x4723=['info','Creating\x20new\x20ticket...','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','create','username','HelpDesk','stringify','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','success','result','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','error','getUser','Searching\x20end\x20user\x20with\x20phone','sessionName','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\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','[OUTBOUND]','Recording\x20is\x20enabled!','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','calleridnum','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','emit','length','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x56df27,_0x54182d){var _0x1ce2c5=function(_0x12a1b9){while(--_0x12a1b9){_0x56df27['push'](_0x56df27['shift']());}};_0x1ce2c5(++_0x54182d);}(_0x4723,0x16c));var _0x3472=function(_0x2330fd,_0x56e9c7){_0x2330fd=_0x2330fd-0x0;var _0x5c1eba=_0x4723[_0x2330fd];return _0x5c1eba;};'use strict';var _=require(_0x3472('0x0'));var rp=require(_0x3472('0x1'));var BPromise=require('bluebird');var md5=require(_0x3472('0x2'));var util=require(_0x3472('0x3'));var Redis=require(_0x3472('0x4'));var intUtil=require(_0x3472('0x5'));var config=require(_0x3472('0x6'));var logger=require(_0x3472('0x7'))(_0x3472('0x8'));config[_0x3472('0x9')]=_[_0x3472('0xa')](config[_0x3472('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4fc267,_0x16bd34,_0x3c1647){io['to'](_0x4fc267)[_0x3472('0xb')](_0x16bd34,_0x3c1647);}function getCustomFields(_0x1bcaf5,_0x2214e6){var _0xa3b312={};if(_0x1bcaf5[_0x3472('0xc')]>0x0){_[_0x3472('0xd')](_0x1bcaf5,function(_0x8b845){if(_0x8b845[_0x3472('0xe')]==='string'&&_0x8b845[_0x3472('0xf')]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x8b845[_0x3472('0x10')][_0x3472('0x11')]();}else if(_0x8b845[_0x3472('0xe')]===_0x3472('0x12')&&_0x8b845[_0x3472('0x13')]&&_0x8b845[_0x3472('0xf')]&&_0x2214e6[_0x8b845[_0x3472('0x13')]]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x2214e6[_0x8b845[_0x3472('0x13')]][_0x3472('0x11')]();}else if(_0x8b845['type']===_0x3472('0x14')&&_0x8b845[_0x3472('0x15')]&&_0x8b845[_0x3472('0x15')][_0x3472('0x16')]&&_0x8b845[_0x3472('0xf')]&&_0x2214e6[_0x8b845['Variable'][_0x3472('0x16')]['toLowerCase']()]){_0xa3b312[_0x8b845[_0x3472('0xf')]]=_0x2214e6[_0x8b845[_0x3472('0x15')][_0x3472('0x16')][_0x3472('0x17')]()][_0x3472('0x11')]();}});}return _0xa3b312;}function createTicket(_0x51d3e3,_0x34bc62,_0xdc94ae,_0x338986,_0x46905b,_0x37bbb5,_0x299aaf){logger[_0x3472('0x18')](_0x3472('0x19'));var _0x3335b5=_['merge']({'parent_id':'','assigned_user_id':_0x34bc62['id'],'ticketpriorities':_0x3472('0x1a'),'ticketstatus':_0x3472('0x1b'),'ticket_title':intUtil[_0x3472('0x1c')](_0x338986['Subjects'],_0x46905b,'\x20'),'description':intUtil['getString'](_0x338986[_0x3472('0x1d')],_0x46905b,'\x0a'),'contact_id':_0xdc94ae['id']},getCustomFields(_0x37bbb5,_0x46905b));var _0x3d9bea={'method':_0x3472('0x1e'),'uri':util[_0x3472('0x1f')](_0x3472('0x20'),_0x51d3e3['remoteUri']),'form':{'operation':_0x3472('0x21'),'username':_0x51d3e3[_0x3472('0x22')],'sessionName':_0x299aaf['sessionName'],'elementType':_0x3472('0x23'),'element':JSON[_0x3472('0x24')](_0x3335b5)},'json':!![]};return request(_0x3d9bea)['then'](function(_0x48979d){if(_0x48979d['success']){return BPromise['resolve']({'id':_0x48979d['result']['id']});}else{throw new Error(util[_0x3472('0x1f')](_0x3472('0x25'),JSON[_0x3472('0x24')](_0x48979d['error'])));}})[_0x3472('0x26')](function(_0x5cfba2){var _0x418646=_0x5cfba2[_0x3472('0x27')]||0x1f4;logger['error'](_0x3472('0x28'),_0x3472('0x29'),_0x418646,JSON[_0x3472('0x24')](_0x5cfba2));});}function getUser(_0x4c5f36,_0x40e273,_0x42a27c){if(intUtil[_0x3472('0x2a')](_0x40e273)){logger['info'](_0x3472('0x2b'),_0x40e273);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x4c5f36[_0x3472('0x2c')]),'qs':{'operation':_0x3472('0x2d'),'username':_0x4c5f36[_0x3472('0x22')],'sessionName':_0x42a27c['sessionName'],'query':util[_0x3472('0x1f')](_0x3472('0x2e'),_0x40e273)},'json':!![]})[_0x3472('0x2f')](function(_0x313421){if(_0x313421[_0x3472('0x30')]&&_0x313421[_0x3472('0x31')][_0x3472('0xc')]){logger[_0x3472('0x18')]('Agent\x20found!');return BPromise[_0x3472('0x32')]({'id':_0x313421[_0x3472('0x31')][0x0]['id'],'email':_0x313421[_0x3472('0x31')][0x0][_0x3472('0x33')],'name':_0x313421[_0x3472('0x31')][0x0]['first_name']+'\x20'+_0x313421[_0x3472('0x31')][_0x3472('0x34')]});}else{logger[_0x3472('0x18')](_0x3472('0x35'));return BPromise[_0x3472('0x32')]({'id':_0x42a27c[_0x3472('0x36')],'email':_0x4c5f36[_0x3472('0x22')],'name':_0x3472('0x37')});}})[_0x3472('0x26')](function(_0x1e0177){var _0xfa3a55=_0x1e0177[_0x3472('0x27')]||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),_0x3472('0x39'),_0xfa3a55,JSON[_0x3472('0x24')](_0x1e0177));});}else{logger['info'](_0x3472('0x35'));return BPromise[_0x3472('0x32')]({'id':_0x42a27c[_0x3472('0x36')],'email':_0x4c5f36[_0x3472('0x22')],'name':_0x3472('0x37')})[_0x3472('0x26')](function(_0x464416){var _0x11b940=_0x464416['statusCode']||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),_0x3472('0x39'),_0x11b940,JSON['stringify'](_0x464416));});}}function getEndUser(_0x322435,_0x15d5b4,_0x4d08a2,_0x72d165){logger['info'](_0x3472('0x3a'),_0x4d08a2);return request({'method':'GET','uri':util[_0x3472('0x1f')]('%s/webservice.php',_0x322435['remoteUri']),'qs':{'operation':_0x3472('0x2d'),'username':_0x322435['username'],'sessionName':_0x72d165[_0x3472('0x3b')],'query':util[_0x3472('0x1f')](_0x3472('0x3c'),_0x4d08a2,_0x4d08a2,_0x4d08a2,_0x4d08a2,_0x4d08a2)},'json':!![]})[_0x3472('0x2f')](function(_0x4eaeb4){if(_0x4eaeb4[_0x3472('0x30')]&&_0x4eaeb4['result'][_0x3472('0xc')]){logger[_0x3472('0x18')]('Enduser\x20found!');return BPromise[_0x3472('0x32')]({'id':_0x4eaeb4['result'][0x0]['id'],'name':_0x4eaeb4[_0x3472('0x31')][0x0]['firstname']+'\x20'+_0x4eaeb4[_0x3472('0x31')][0x0]['lastname'],'phone':_0x4d08a2});}else{logger[_0x3472('0x18')](_0x3472('0x3d'));return request({'method':_0x3472('0x1e'),'uri':util['format'](_0x3472('0x20'),_0x322435[_0x3472('0x2c')]),'form':{'operation':_0x3472('0x21'),'sessionName':_0x72d165[_0x3472('0x3b')],'elementType':_0x3472('0x3e'),'element':JSON[_0x3472('0x24')]({'lastname':_0x15d5b4,'phone':_0x4d08a2,'assigned_user_id':'\x20'})},'json':!![]})[_0x3472('0x2f')](function(_0x13a05c){logger[_0x3472('0x18')](_0x3472('0x3f'));return BPromise[_0x3472('0x32')]({'id':_0x13a05c[_0x3472('0x31')]['id'],'name':_0x13a05c['result']['lastname'],'phone':_0x13a05c[_0x3472('0x31')][_0x3472('0x40')]});})[_0x3472('0x26')](function(_0x5d5de9){var _0x39964b=_0x5d5de9['statusCode']||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),'getEndUser',_0x39964b,JSON['stringify'](_0x5d5de9));});}});}function getConnection(_0x3019c3){var _0x15b4e8=_0x3019c3[_0x3472('0x22')];var _0x112efc=_0x3019c3['accessKey'];return request({'method':'GET','uri':util[_0x3472('0x1f')]('%s/webservice.php',_0x3019c3[_0x3472('0x2c')]),'qs':{'operation':'getchallenge','username':_0x15b4e8},'json':!![]})[_0x3472('0x2f')](function(_0x3d9e19){if(_0x3d9e19[_0x3472('0x30')]){return request({'method':_0x3472('0x1e'),'uri':util[_0x3472('0x1f')](_0x3472('0x20'),_0x3019c3[_0x3472('0x2c')]),'form':{'operation':_0x3472('0x41'),'username':_0x15b4e8,'accessKey':md5(_0x3d9e19[_0x3472('0x31')][_0x3472('0x42')]+_0x112efc)},'json':!![]});}})[_0x3472('0x2f')](function(_0x1fe26c){if(_0x1fe26c[_0x3472('0x30')]){return BPromise['resolve'](_0x1fe26c[_0x3472('0x31')]);}else{throw new Error(util['format'](_0x3472('0x43'),_0x3019c3['id']));}})[_0x3472('0x26')](function(_0x97228c){var _0x3ae5be=_0x97228c[_0x3472('0x27')]||0x1f4;logger[_0x3472('0x38')](_0x3472('0x28'),'getConnection',_0x3ae5be,JSON[_0x3472('0x24')](_0x97228c));});}function request(_0xca2fc5){logger['info'](_0x3472('0x44'),JSON[_0x3472('0x24')](_0xca2fc5));return rp(_0xca2fc5);}exports[_0x3472('0x45')]=function(_0x288302,_0x2c6c2d,_0x44bfe5,_0xc203d4,_0x94e9e4,_0x1200a8){var _0x512e13,_0xdf5f43,_0x3791ba,_0xf8c416;_0x1200a8[_0x3472('0x2c')]=intUtil[_0x3472('0x46')](_0x1200a8[_0x3472('0x2c')]);if(_0x94e9e4&&_0x94e9e4[_0x3472('0x47')]){logger['info'](_0x3472('0x48'),'Recording\x20is\x20enabled!');_0x2c6c2d[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x1200a8['serverUrl'],_0x2c6c2d[_0x3472('0x4b')],md5(_0x2c6c2d[_0x3472('0x4b')]));}else{_0x2c6c2d[_0x3472('0x49')]='';}return getConnection(_0x1200a8)[_0x3472('0x2f')](function(_0x5cdfac){_0xf8c416=_0x5cdfac;return getUser(_0x1200a8,_0xc203d4['email'],_0xf8c416);})[_0x3472('0x2f')](function(_0x595263){_0x512e13=_0x595263;logger['info']('The\x20User\x20ID\x20is:',_0x512e13['id']);return getEndUser(_0x1200a8,_0x2c6c2d[_0x3472('0x4c')],_0x2c6c2d['calleridnum'],_0xf8c416);})['then'](function(_0x2aa81a){_0xdf5f43=_0x2aa81a;logger['info'](_0x3472('0x4d'),_0xdf5f43['id']);return createTicket(_0x1200a8,_0x512e13,_0xdf5f43,_0x44bfe5,_0x2c6c2d,_0x44bfe5[_0x3472('0x4e')],_0xf8c416);})[_0x3472('0x2f')](function(_0x1f9e6a){_0x3791ba=_0x1f9e6a;logger[_0x3472('0x18')](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x3791ba['id']);var _0x201e6c=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1200a8[_0x3472('0x2c')],_['split'](_0x3791ba['id'],'x')[0x1]);logger['info'](_0x3472('0x48'),_0x3472('0x51'));emit(util[_0x3472('0x1f')](_0x3472('0x52'),_0xc203d4[_0x3472('0x16')]),_0x3472('0x53'),{'uri':_0x201e6c});})[_0x3472('0x26')](function(_0x35888f){logger[_0x3472('0x38')](_0x3472('0x48'),JSON[_0x3472('0x24')](_0x35888f));});};exports[_0x3472('0x54')]=function(_0x4fd3e4,_0x5de623,_0x5a68e2,_0x1a6b99,_0x13a257,_0x4e57d3,_0x416c04){var _0x3208c9,_0x5c336c,_0x25ecbe,_0x4270ba;_0x4e57d3[_0x3472('0x2c')]=intUtil[_0x3472('0x46')](_0x4e57d3[_0x3472('0x2c')]);_0x4e57d3[_0x3472('0x55')]=intUtil[_0x3472('0x46')](_0x4e57d3[_0x3472('0x55')]);if(_0x416c04&&_0x416c04['recordingFormat']&&_0x416c04['recordingFormat']!=='none'){logger['info'](_0x3472('0x56'),_0x3472('0x57'));_0x5de623[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x4e57d3[_0x3472('0x55')],_0x5de623['uniqueid'],md5(_0x5de623[_0x3472('0x4b')]));}return getConnection(_0x4e57d3)[_0x3472('0x2f')](function(_0x1bcb72){_0x4270ba=_0x1bcb72;return getUser(_0x4e57d3,_0x1a6b99[_0x3472('0x58')],_0x4270ba);})['then'](function(_0x28a9c4){_0x3208c9=_0x28a9c4;logger[_0x3472('0x18')](_0x3472('0x59'),_0x3208c9['id']);return getEndUser(_0x4e57d3,_0x5de623[_0x3472('0x5a')],_0x5de623[_0x3472('0x5b')],_0x4270ba);})['then'](function(_0x14bc96){_0x5c336c=_0x14bc96;logger[_0x3472('0x18')](_0x3472('0x4d'),_0x5c336c['id']);return createTicket(_0x4e57d3,_0x3208c9,_0x5c336c,_0x5a68e2,_0x5de623,_0x5a68e2[_0x3472('0x4e')],_0x4270ba);})[_0x3472('0x2f')](function(_0x3729ad){_0x25ecbe=_0x3729ad;logger[_0x3472('0x18')](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x25ecbe['id']);var _0x54fb13=util[_0x3472('0x1f')](_0x3472('0x5c'),_0x4e57d3[_0x3472('0x2c')],_[_0x3472('0x5d')](_0x25ecbe['id'],'x')[0x1]);logger[_0x3472('0x18')](_0x3472('0x56'),_0x3472('0x51'));emit(util[_0x3472('0x1f')](_0x3472('0x52'),_0x1a6b99[_0x3472('0x16')]),_0x3472('0x53'),{'uri':_0x54fb13});})['catch'](function(_0x440c18){logger[_0x3472('0x38')](_0x3472('0x56'),JSON['stringify'](_0x440c18));});};exports['unmanaged']=function(_0x5e7261,_0x4e10bf,_0x14f046,_0x27240f,_0x14ba2f,_0x24f900){var _0x14120f,_0x559ba2,_0x57da90,_0x47f299;_0x24f900[_0x3472('0x2c')]=intUtil['stripTrailingSlash'](_0x24f900[_0x3472('0x2c')]);_0x24f900['serverUrl']=intUtil[_0x3472('0x46')](_0x24f900['serverUrl']);if(_0x14ba2f&&_0x14ba2f[_0x3472('0x47')]){logger[_0x3472('0x18')]('['+_0x4e10bf['lastevent']['toUpperCase']()+']',_0x3472('0x57'));_0x4e10bf[_0x3472('0x49')]=util[_0x3472('0x1f')](_0x3472('0x4a'),_0x24f900[_0x3472('0x55')],_0x4e10bf[_0x3472('0x4b')],md5(_0x4e10bf['uniqueid']));}else{_0x4e10bf[_0x3472('0x49')]='';}return getConnection(_0x24f900)['then'](function(_0x43da9f){_0x47f299=_0x43da9f;return getUser(_0x24f900,'',_0x47f299);})['then'](function(_0x4baff4){_0x14120f=_0x4baff4;logger[_0x3472('0x18')](_0x3472('0x59'),_0x14120f['id']);return getEndUser(_0x24f900,_0x4e10bf[_0x3472('0x4c')],_0x4e10bf[_0x3472('0x5e')],_0x47f299);})[_0x3472('0x2f')](function(_0x167b06){_0x559ba2=_0x167b06;logger[_0x3472('0x18')](_0x3472('0x4d'),_0x559ba2['id']);return createTicket(_0x24f900,_0x14120f,_0x559ba2,_0x14f046,_0x4e10bf,_0x14f046[_0x3472('0x4e')],_0x47f299);})[_0x3472('0x2f')](function(_0x35d630){_0x57da90=_0x35d630;logger['info'](_0x3472('0x4f'));logger[_0x3472('0x18')](_0x3472('0x50'),_0x57da90['id']);})[_0x3472('0x26')](function(_0x45d683){logger[_0x3472('0x38')]('['+_0x4e10bf[_0x3472('0x5f')][_0x3472('0x60')]()+']',JSON['stringify'](_0x45d683));});}; \ No newline at end of file +var _0x0eee=['calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','The\x20Enduser\x20ID\x20is:','lastevent','toUpperCase','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','length','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Subjects','getString','remoteUri','create','username','sessionName','HelpDesk','stringify','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','POST','Contacts','phone','accessKey','token','success','Account\x20%d\x20is\x20not\x20valid','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname'];(function(_0xa5515e,_0x452b09){var _0x132661=function(_0x5c546f){while(--_0x5c546f){_0xa5515e['push'](_0xa5515e['shift']());}};_0x132661(++_0x452b09);}(_0x0eee,0x6c));var _0xe0ee=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0eee[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var rp=require(_0xe0ee('0x0'));var BPromise=require(_0xe0ee('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xe0ee('0x2'));var intUtil=require('./util');var config=require(_0xe0ee('0x3'));var logger=require(_0xe0ee('0x4'))('vTiger');config[_0xe0ee('0x5')]=_['defaults'](config['redis'],{'host':_0xe0ee('0x6'),'port':0x18eb});var io=require(_0xe0ee('0x7'))(new Redis(config[_0xe0ee('0x5')]));function emit(_0x4c615a,_0x4dde6d,_0x128ad1){io['to'](_0x4c615a)[_0xe0ee('0x8')](_0x4dde6d,_0x128ad1);}function getCustomFields(_0x5eed91,_0x42fe24){var _0xe245e7={};if(_0x5eed91[_0xe0ee('0x9')]>0x0){_['forEach'](_0x5eed91,function(_0x4b1f4c){if(_0x4b1f4c[_0xe0ee('0xa')]===_0xe0ee('0xb')&&_0x4b1f4c[_0xe0ee('0xc')]){_0xe245e7[_0x4b1f4c[_0xe0ee('0xc')]]=_0x4b1f4c[_0xe0ee('0xd')]['toString']();}else if(_0x4b1f4c['type']===_0xe0ee('0xe')&&_0x4b1f4c[_0xe0ee('0xf')]&&_0x4b1f4c['idField']&&_0x42fe24[_0x4b1f4c[_0xe0ee('0xf')]]){_0xe245e7[_0x4b1f4c['idField']]=_0x42fe24[_0x4b1f4c[_0xe0ee('0xf')]][_0xe0ee('0x10')]();}else if(_0x4b1f4c[_0xe0ee('0xa')]===_0xe0ee('0x11')&&_0x4b1f4c[_0xe0ee('0x12')]&&_0x4b1f4c[_0xe0ee('0x12')][_0xe0ee('0x13')]&&_0x4b1f4c[_0xe0ee('0xc')]&&_0x42fe24[_0x4b1f4c['Variable']['name'][_0xe0ee('0x14')]()]){_0xe245e7[_0x4b1f4c['idField']]=_0x42fe24[_0x4b1f4c[_0xe0ee('0x12')]['name'][_0xe0ee('0x14')]()][_0xe0ee('0x10')]();}});}return _0xe245e7;}function createTicket(_0xe3f0ff,_0x18c1ab,_0x40b0d4,_0x4f385d,_0x14f32d,_0x3cf033,_0xb0c1c){logger[_0xe0ee('0x15')](_0xe0ee('0x16'));var _0x3a2d53=_[_0xe0ee('0x17')]({'parent_id':'','assigned_user_id':_0x18c1ab['id'],'ticketpriorities':_0xe0ee('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4f385d[_0xe0ee('0x19')],_0x14f32d,'\x20'),'description':intUtil[_0xe0ee('0x1a')](_0x4f385d['Descriptions'],_0x14f32d,'\x0a'),'contact_id':_0x40b0d4['id']},getCustomFields(_0x3cf033,_0x14f32d));var _0x386322={'method':'POST','uri':util['format']('%s/webservice.php',_0xe3f0ff[_0xe0ee('0x1b')]),'form':{'operation':_0xe0ee('0x1c'),'username':_0xe3f0ff[_0xe0ee('0x1d')],'sessionName':_0xb0c1c[_0xe0ee('0x1e')],'elementType':_0xe0ee('0x1f'),'element':JSON[_0xe0ee('0x20')](_0x3a2d53)},'json':!![]};return request(_0x386322)[_0xe0ee('0x21')](function(_0xf4ac4a){if(_0xf4ac4a['success']){return BPromise[_0xe0ee('0x22')]({'id':_0xf4ac4a[_0xe0ee('0x23')]['id']});}else{throw new Error(util[_0xe0ee('0x24')](_0xe0ee('0x25'),JSON[_0xe0ee('0x20')](_0xf4ac4a[_0xe0ee('0x26')])));}})['catch'](function(_0x1c2a4f){var _0x3a3fed=_0x1c2a4f[_0xe0ee('0x27')]||0x1f4;logger[_0xe0ee('0x26')](_0xe0ee('0x28'),'createTicket',_0x3a3fed,JSON[_0xe0ee('0x20')](_0x1c2a4f));});}function getUser(_0x1133f6,_0x396617,_0x621bde){if(intUtil[_0xe0ee('0x29')](_0x396617)){logger['info']('Getting\x20agent\x20with\x20email',_0x396617);return request({'method':_0xe0ee('0x2a'),'uri':util['format'](_0xe0ee('0x2b'),_0x1133f6[_0xe0ee('0x1b')]),'qs':{'operation':_0xe0ee('0x2c'),'username':_0x1133f6[_0xe0ee('0x1d')],'sessionName':_0x621bde[_0xe0ee('0x1e')],'query':util['format'](_0xe0ee('0x2d'),_0x396617)},'json':!![]})[_0xe0ee('0x21')](function(_0x576269){if(_0x576269['success']&&_0x576269['result'][_0xe0ee('0x9')]){logger[_0xe0ee('0x15')](_0xe0ee('0x2e'));return BPromise[_0xe0ee('0x22')]({'id':_0x576269[_0xe0ee('0x23')][0x0]['id'],'email':_0x576269[_0xe0ee('0x23')][0x0][_0xe0ee('0x2f')],'name':_0x576269[_0xe0ee('0x23')][0x0]['first_name']+'\x20'+_0x576269[_0xe0ee('0x23')][_0xe0ee('0x30')]});}else{logger[_0xe0ee('0x15')](_0xe0ee('0x31'));return BPromise[_0xe0ee('0x22')]({'id':_0x621bde[_0xe0ee('0x32')],'email':_0x1133f6[_0xe0ee('0x1d')],'name':_0xe0ee('0x33')});}})[_0xe0ee('0x34')](function(_0x13f7ac){var _0x271ad9=_0x13f7ac[_0xe0ee('0x27')]||0x1f4;logger[_0xe0ee('0x26')](_0xe0ee('0x28'),_0xe0ee('0x35'),_0x271ad9,JSON[_0xe0ee('0x20')](_0x13f7ac));});}else{logger[_0xe0ee('0x15')](_0xe0ee('0x31'));return BPromise[_0xe0ee('0x22')]({'id':_0x621bde['userId'],'email':_0x1133f6[_0xe0ee('0x1d')],'name':_0xe0ee('0x33')})[_0xe0ee('0x34')](function(_0xef7574){var _0x245fe9=_0xef7574[_0xe0ee('0x27')]||0x1f4;logger[_0xe0ee('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xe0ee('0x35'),_0x245fe9,JSON[_0xe0ee('0x20')](_0xef7574));});}}function getEndUser(_0x430a74,_0x4161bd,_0x33247f,_0x1607a5){logger['info'](_0xe0ee('0x36'),_0x33247f);return request({'method':_0xe0ee('0x2a'),'uri':util[_0xe0ee('0x24')](_0xe0ee('0x2b'),_0x430a74[_0xe0ee('0x1b')]),'qs':{'operation':_0xe0ee('0x2c'),'username':_0x430a74[_0xe0ee('0x1d')],'sessionName':_0x1607a5['sessionName'],'query':util[_0xe0ee('0x24')](_0xe0ee('0x37'),_0x33247f,_0x33247f,_0x33247f,_0x33247f,_0x33247f)},'json':!![]})[_0xe0ee('0x21')](function(_0xf42ad6){if(_0xf42ad6['success']&&_0xf42ad6[_0xe0ee('0x23')]['length']){logger['info'](_0xe0ee('0x38'));return BPromise[_0xe0ee('0x22')]({'id':_0xf42ad6[_0xe0ee('0x23')][0x0]['id'],'name':_0xf42ad6[_0xe0ee('0x23')][0x0][_0xe0ee('0x39')]+'\x20'+_0xf42ad6['result'][0x0][_0xe0ee('0x3a')],'phone':_0x33247f});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xe0ee('0x3b'),'uri':util[_0xe0ee('0x24')]('%s/webservice.php',_0x430a74[_0xe0ee('0x1b')]),'form':{'operation':_0xe0ee('0x1c'),'sessionName':_0x1607a5[_0xe0ee('0x1e')],'elementType':_0xe0ee('0x3c'),'element':JSON['stringify']({'lastname':_0x4161bd,'phone':_0x33247f,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x350e65){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0x350e65['result']['id'],'name':_0x350e65[_0xe0ee('0x23')]['lastname'],'phone':_0x350e65[_0xe0ee('0x23')][_0xe0ee('0x3d')]});})[_0xe0ee('0x34')](function(_0x470ecf){var _0x1ea450=_0x470ecf[_0xe0ee('0x27')]||0x1f4;logger[_0xe0ee('0x26')](_0xe0ee('0x28'),'getEndUser',_0x1ea450,JSON[_0xe0ee('0x20')](_0x470ecf));});}});}function getConnection(_0x159190){var _0x13da83=_0x159190[_0xe0ee('0x1d')];var _0x2b137f=_0x159190[_0xe0ee('0x3e')];return request({'method':_0xe0ee('0x2a'),'uri':util[_0xe0ee('0x24')](_0xe0ee('0x2b'),_0x159190[_0xe0ee('0x1b')]),'qs':{'operation':'getchallenge','username':_0x13da83},'json':!![]})[_0xe0ee('0x21')](function(_0x3d9b78){if(_0x3d9b78['success']){return request({'method':_0xe0ee('0x3b'),'uri':util[_0xe0ee('0x24')](_0xe0ee('0x2b'),_0x159190[_0xe0ee('0x1b')]),'form':{'operation':'login','username':_0x13da83,'accessKey':md5(_0x3d9b78[_0xe0ee('0x23')][_0xe0ee('0x3f')]+_0x2b137f)},'json':!![]});}})[_0xe0ee('0x21')](function(_0x4613eb){if(_0x4613eb[_0xe0ee('0x40')]){return BPromise[_0xe0ee('0x22')](_0x4613eb[_0xe0ee('0x23')]);}else{throw new Error(util[_0xe0ee('0x24')](_0xe0ee('0x41'),_0x159190['id']));}})[_0xe0ee('0x34')](function(_0x3f6999){var _0x87c48d=_0x3f6999['statusCode']||0x1f4;logger[_0xe0ee('0x26')](_0xe0ee('0x28'),_0xe0ee('0x42'),_0x87c48d,JSON[_0xe0ee('0x20')](_0x3f6999));});}function request(_0x26c0fc){logger[_0xe0ee('0x15')]('[HTTP]',JSON[_0xe0ee('0x20')](_0x26c0fc));return rp(_0x26c0fc);}exports['queue']=function(_0x4076f3,_0x53f7e2,_0xd4c1ef,_0x3947de,_0x3789d5,_0x22b0b3){var _0x4e0d56,_0x4e0f9a,_0x1b03f2,_0x2218fd;_0x22b0b3['remoteUri']=intUtil[_0xe0ee('0x43')](_0x22b0b3['remoteUri']);if(_0x3789d5&&_0x3789d5[_0xe0ee('0x44')]){logger['info'](_0xe0ee('0x45'),_0xe0ee('0x46'));_0x53f7e2[_0xe0ee('0x47')]=util[_0xe0ee('0x24')](_0xe0ee('0x48'),_0x22b0b3[_0xe0ee('0x49')],_0x53f7e2[_0xe0ee('0x4a')],md5(_0x53f7e2[_0xe0ee('0x4a')]));}else{_0x53f7e2[_0xe0ee('0x47')]='';}return getConnection(_0x22b0b3)[_0xe0ee('0x21')](function(_0x56003b){_0x2218fd=_0x56003b;return getUser(_0x22b0b3,_0x3947de[_0xe0ee('0x4b')],_0x2218fd);})[_0xe0ee('0x21')](function(_0x88d12d){_0x4e0d56=_0x88d12d;logger[_0xe0ee('0x15')](_0xe0ee('0x4c'),_0x4e0d56['id']);return getEndUser(_0x22b0b3,_0x53f7e2[_0xe0ee('0x4d')],_0x53f7e2[_0xe0ee('0x4e')],_0x2218fd);})[_0xe0ee('0x21')](function(_0x390c6e){_0x4e0f9a=_0x390c6e;logger[_0xe0ee('0x15')]('The\x20Enduser\x20ID\x20is:',_0x4e0f9a['id']);return createTicket(_0x22b0b3,_0x4e0d56,_0x4e0f9a,_0xd4c1ef,_0x53f7e2,_0xd4c1ef['Fields'],_0x2218fd);})['then'](function(_0x37e19c){_0x1b03f2=_0x37e19c;logger['info']('Ticket\x20created!');logger[_0xe0ee('0x15')](_0xe0ee('0x4f'),_0x1b03f2['id']);var _0x41bd20=util[_0xe0ee('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x22b0b3[_0xe0ee('0x1b')],_['split'](_0x1b03f2['id'],'x')[0x1]);logger[_0xe0ee('0x15')]('[QUEUE]',_0xe0ee('0x50'));emit(util[_0xe0ee('0x24')](_0xe0ee('0x51'),_0x3947de[_0xe0ee('0x13')]),_0xe0ee('0x52'),{'uri':_0x41bd20});})[_0xe0ee('0x34')](function(_0x447cf0){logger[_0xe0ee('0x26')](_0xe0ee('0x45'),JSON[_0xe0ee('0x20')](_0x447cf0));});};exports['outbound']=function(_0x3dfc36,_0x4dfc75,_0x55574f,_0x36ce6f,_0x3dc1c6,_0x1b4d2e,_0x45c0d4){var _0xa57f5,_0x2e1220,_0x326a13,_0x39de3e;_0x1b4d2e[_0xe0ee('0x1b')]=intUtil[_0xe0ee('0x43')](_0x1b4d2e[_0xe0ee('0x1b')]);_0x1b4d2e[_0xe0ee('0x49')]=intUtil[_0xe0ee('0x43')](_0x1b4d2e[_0xe0ee('0x49')]);if(_0x45c0d4&&_0x45c0d4[_0xe0ee('0x53')]&&_0x45c0d4[_0xe0ee('0x53')]!=='none'){logger[_0xe0ee('0x15')](_0xe0ee('0x54'),'Recording\x20is\x20enabled!');_0x4dfc75['recordingURL']=util['format'](_0xe0ee('0x48'),_0x1b4d2e[_0xe0ee('0x49')],_0x4dfc75[_0xe0ee('0x4a')],md5(_0x4dfc75[_0xe0ee('0x4a')]));}return getConnection(_0x1b4d2e)[_0xe0ee('0x21')](function(_0x3697b7){_0x39de3e=_0x3697b7;return getUser(_0x1b4d2e,_0x36ce6f[_0xe0ee('0x4b')],_0x39de3e);})[_0xe0ee('0x21')](function(_0x349b6e){_0xa57f5=_0x349b6e;logger[_0xe0ee('0x15')](_0xe0ee('0x4c'),_0xa57f5['id']);return getEndUser(_0x1b4d2e,_0x4dfc75[_0xe0ee('0x55')],_0x4dfc75[_0xe0ee('0x56')],_0x39de3e);})[_0xe0ee('0x21')](function(_0x3be5e3){_0x2e1220=_0x3be5e3;logger[_0xe0ee('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2e1220['id']);return createTicket(_0x1b4d2e,_0xa57f5,_0x2e1220,_0x55574f,_0x4dfc75,_0x55574f['Fields'],_0x39de3e);})[_0xe0ee('0x21')](function(_0x129747){_0x326a13=_0x129747;logger[_0xe0ee('0x15')](_0xe0ee('0x57'));logger[_0xe0ee('0x15')](_0xe0ee('0x4f'),_0x326a13['id']);var _0xafad75=util[_0xe0ee('0x24')](_0xe0ee('0x58'),_0x1b4d2e['remoteUri'],_['split'](_0x326a13['id'],'x')[0x1]);logger[_0xe0ee('0x15')]('[OUTBOUND]',_0xe0ee('0x50'));emit(util[_0xe0ee('0x24')](_0xe0ee('0x51'),_0x36ce6f[_0xe0ee('0x13')]),_0xe0ee('0x52'),{'uri':_0xafad75});})[_0xe0ee('0x34')](function(_0x5ed274){logger[_0xe0ee('0x26')]('[OUTBOUND]',JSON['stringify'](_0x5ed274));});};exports[_0xe0ee('0x59')]=function(_0x3070c2,_0x54b269,_0x359142,_0x3ee2ba,_0x1c967d,_0x485a59){var _0x3f13a7,_0x42c4d6,_0x241d2d,_0x260cb1;_0x485a59[_0xe0ee('0x1b')]=intUtil[_0xe0ee('0x43')](_0x485a59['remoteUri']);_0x485a59[_0xe0ee('0x49')]=intUtil[_0xe0ee('0x43')](_0x485a59['serverUrl']);if(_0x1c967d&&_0x1c967d[_0xe0ee('0x44')]){logger[_0xe0ee('0x15')]('['+_0x54b269['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x54b269['recordingURL']=util[_0xe0ee('0x24')](_0xe0ee('0x48'),_0x485a59[_0xe0ee('0x49')],_0x54b269['uniqueid'],md5(_0x54b269[_0xe0ee('0x4a')]));}else{_0x54b269[_0xe0ee('0x47')]='';}return getConnection(_0x485a59)['then'](function(_0x182dc0){_0x260cb1=_0x182dc0;return getUser(_0x485a59,'',_0x260cb1);})[_0xe0ee('0x21')](function(_0x38b23b){_0x3f13a7=_0x38b23b;logger[_0xe0ee('0x15')](_0xe0ee('0x4c'),_0x3f13a7['id']);return getEndUser(_0x485a59,_0x54b269[_0xe0ee('0x4d')],_0x54b269[_0xe0ee('0x4e')],_0x260cb1);})['then'](function(_0x255aff){_0x42c4d6=_0x255aff;logger[_0xe0ee('0x15')](_0xe0ee('0x5a'),_0x42c4d6['id']);return createTicket(_0x485a59,_0x3f13a7,_0x42c4d6,_0x359142,_0x54b269,_0x359142['Fields'],_0x260cb1);})[_0xe0ee('0x21')](function(_0x461af4){_0x241d2d=_0x461af4;logger[_0xe0ee('0x15')](_0xe0ee('0x57'));logger[_0xe0ee('0x15')](_0xe0ee('0x4f'),_0x241d2d['id']);})[_0xe0ee('0x34')](function(_0x463c0a){logger[_0xe0ee('0x26')]('['+_0x54b269[_0xe0ee('0x5b')][_0xe0ee('0x5c')]()+']',JSON[_0xe0ee('0x20')](_0x463c0a));});}; \ 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 7931115..981a108 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 _0x6324=['[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','idField','variableName','push','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0x6324,0x142));var _0x4632=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6324[_0x32d457];return _0x338386;};'use strict';var _=require(_0x4632('0x0'));var rp=require(_0x4632('0x1'));var md5=require(_0x4632('0x2'));var util=require(_0x4632('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4632('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4632('0x5'))('zendesk');config[_0x4632('0x6')]=_['defaults'](config[_0x4632('0x6')],{'host':_0x4632('0x7'),'port':0x18eb});var io=require(_0x4632('0x8'))(new Redis(config[_0x4632('0x6')]));function emit(_0x4a15b2,_0x17e860,_0x44dd6d){io['to'](_0x4a15b2)[_0x4632('0x9')](_0x17e860,_0x44dd6d);}var headers={'Content-Type':'application/json','Accept':_0x4632('0xa')};function getTicket(_0x47824c,_0x47a518,_0x556bbc,_0xcdefa2,_0x21999d){logger[_0x4632('0xb')](_0x4632('0xc'));return request({'uri':util[_0x4632('0xd')](_0x4632('0xe'),_0x47824c[_0x4632('0xf')]),'method':_0x4632('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x556bbc['id'],'submitter_id':_0x47a518?_0x47a518['id']:undefined,'assignee_id':_0x47a518?_0x47a518['id']:undefined,'tags':getTags(_0xcdefa2[_0x4632('0x11')],'name'),'subject':intUtil[_0x4632('0x12')](_0xcdefa2[_0x4632('0x13')],_0x21999d,'\x20'),'description':intUtil[_0x4632('0x12')](_0xcdefa2[_0x4632('0x14')],_0x21999d,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xcdefa2[_0x4632('0x14')],_0x21999d,'\x0a')}},getCustomFields(_0xcdefa2[_0x4632('0x15')],_0x21999d))}})[_0x4632('0x16')](function(_0x37d798){logger[_0x4632('0xb')]('Ticket\x20created!');return _0x37d798['ticket'];});}function getUser(_0x2fd7ae,_0x38bedd){if(intUtil[_0x4632('0x17')](_0x38bedd)){logger[_0x4632('0xb')]('Getting\x20agent\x20with\x20email',_0x38bedd);return request({'uri':util[_0x4632('0xd')](_0x4632('0x18'),_0x2fd7ae[_0x4632('0xf')]),'qs':{'query':util['format'](_0x4632('0x19'),_0x38bedd)}})[_0x4632('0x16')](function(_0x58e193){if(_0x58e193['count']){logger[_0x4632('0xb')](_0x4632('0x1a'));return _[_0x4632('0x1b')](_0x58e193[_0x4632('0x1c')],{'email':_0x38bedd,'role':_0x4632('0x1d')});}else{logger[_0x4632('0xb')](_0x4632('0x1e'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x1f'),_0x2fd7ae[_0x4632('0xf')])})[_0x4632('0x16')](function(_0x2d656a){logger[_0x4632('0xb')](_0x4632('0x20'));return _0x2d656a[_0x4632('0x21')];});}});}else{logger[_0x4632('0xb')](_0x4632('0x1e'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x1f'),_0x2fd7ae[_0x4632('0xf')])})[_0x4632('0x16')](function(_0x4455ef){logger[_0x4632('0xb')](_0x4632('0x20'));return _0x4455ef[_0x4632('0x21')];});}}function getEndUser(_0x1b8de0,_0x4af026,_0x2e3428){logger[_0x4632('0xb')](_0x4632('0x22'),_0x2e3428);return request({'uri':util[_0x4632('0xd')](_0x4632('0x18'),_0x1b8de0[_0x4632('0xf')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x2e3428)}})[_0x4632('0x16')](function(_0x244743){var _0x2f6656;if(_0x244743[_0x4632('0x1c')][_0x4632('0x23')]){_0x244743[_0x4632('0x1c')]=_[_0x4632('0x24')](_0x244743['results'],{'suspended':![],'role':_0x4632('0x25')});if(_0x244743[_0x4632('0x1c')]['length']){_0x2f6656=_[_0x4632('0x26')](_0x244743['results']);}}if(_0x2f6656){logger[_0x4632('0xb')]('Enduser\x20found!');return _0x2f6656;}else{logger['info'](_0x4632('0x27'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x28'),_0x1b8de0['remoteUri']),'method':'POST','body':{'user':{'role':_0x4632('0x25'),'name':util[_0x4632('0xd')]('Caller\x20-\x20%s',_0x4af026||_0x2e3428),'phone':_0x2e3428}}})['then'](function(_0x97cb9a){logger[_0x4632('0xb')]('Enduser\x20created.');return _0x97cb9a[_0x4632('0x21')];});}});}function getAuth(_0x2a1093){var _0x4686c7;if(_0x2a1093[_0x4632('0x29')]===_0x4632('0x2a')){_0x4686c7=util['format'](_0x4632('0x2b'),_0x2a1093[_0x4632('0x2c')],_0x2a1093['password']);}else if(_0x2a1093['authType']===_0x4632('0x2d')){_0x4686c7=util['format']('%s/token:%s',_0x2a1093[_0x4632('0x2c')],_0x2a1093['token']);}return util[_0x4632('0xd')](_0x4632('0x2e'),new Buffer(_0x4686c7)[_0x4632('0x2f')]('base64'));}function request(_0x4d091b){logger[_0x4632('0x30')](_0x4632('0x31'),JSON[_0x4632('0x32')](_0x4d091b));return rp(_[_0x4632('0x33')](_0x4d091b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x486f6c,_0x3114c4){var _0xd90c7c=[];if(_0x486f6c&&_0x486f6c[_0x4632('0x23')]>0x0){_0xd90c7c=_['map'](_0x486f6c,_0x3114c4);}return _0xd90c7c;}function getCustomFields(_0x5a3fb4,_0x53b436){var _0x405308=[];var _0x393ef2={'custom_fields':[]};if(_0x5a3fb4['length']>0x0){_[_0x4632('0x34')](_0x5a3fb4,function(_0x20a700){if(_0x20a700[_0x4632('0x35')]===_0x4632('0x36')&&_0x20a700[_0x4632('0x37')]&&!_0x20a700[_0x4632('0x38')]){_0x393ef2[_0x20a700[_0x4632('0x37')][_0x4632('0x39')]()]=_0x20a700[_0x4632('0x3a')][_0x4632('0x2f')]();}else if(_0x20a700[_0x4632('0x35')]===_0x4632('0x36')&&_0x20a700['idField']&&_0x20a700[_0x4632('0x38')]){_0x393ef2[_0x4632('0x3b')]['push']({'id':_0x20a700[_0x4632('0x3c')],'value':_0x20a700[_0x4632('0x3a')]['toString']()});}else if(_0x20a700[_0x4632('0x35')]==='variable'&&_0x20a700[_0x4632('0x3d')]&&_0x20a700[_0x4632('0x3c')]&&_0x20a700[_0x4632('0x38')]){_0x53b436[_0x20a700[_0x4632('0x3d')]]&&_0x393ef2['custom_fields'][_0x4632('0x3e')]({'id':_0x20a700[_0x4632('0x3c')],'value':_0x53b436[_0x20a700[_0x4632('0x3d')]][_0x4632('0x2f')]()});}else if(_0x20a700['type']==='customVariable'&&_0x20a700[_0x4632('0x3f')]&&_0x20a700[_0x4632('0x3f')][_0x4632('0x40')]&&_0x20a700['idField']&&_0x20a700[_0x4632('0x38')]){_0x53b436[_0x20a700[_0x4632('0x3f')][_0x4632('0x40')][_0x4632('0x39')]()]&&_0x393ef2[_0x4632('0x3b')][_0x4632('0x3e')]({'id':_0x20a700[_0x4632('0x3c')],'value':_0x53b436[_0x20a700['Variable'][_0x4632('0x40')][_0x4632('0x39')]()][_0x4632('0x2f')]()});}});}return _0x393ef2;}exports[_0x4632('0x41')]=function(_0x165c00,_0x4d1d50,_0x579ed2,_0x6e373d,_0x3a1d52,_0x23b0df){var _0x2e5978,_0x4fa733;_0x23b0df[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x23b0df[_0x4632('0xf')]);_0x23b0df[_0x4632('0x43')]=intUtil[_0x4632('0x42')](_0x23b0df['serverUrl']);if(_0x3a1d52&&_0x3a1d52[_0x4632('0x44')]){logger[_0x4632('0xb')](_0x4632('0x45'),_0x4632('0x46'));_0x4d1d50[_0x4632('0x47')]=util[_0x4632('0xd')](_0x4632('0x48'),_0x23b0df[_0x4632('0x43')],_0x4d1d50[_0x4632('0x49')],md5(_0x4d1d50[_0x4632('0x49')]));}else{_0x4d1d50[_0x4632('0x47')]='';}headers['Authorization']=getAuth(_0x23b0df);return getUser(_0x23b0df,_0x6e373d[_0x4632('0x4a')])[_0x4632('0x16')](function(_0x30864d){_0x2e5978=_0x30864d;logger['info'](_0x4632('0x4b'),_0x2e5978['id']);return getEndUser(_0x23b0df,_0x4d1d50[_0x4632('0x4c')],_0x4d1d50[_0x4632('0x4d')]);})[_0x4632('0x16')](function(_0xa681e9){_0x4fa733=_0xa681e9;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x4fa733['id']);return getTicket(_0x23b0df,_0x2e5978,_0x4fa733,_0x579ed2,_0x4d1d50);})[_0x4632('0x16')](function(_0x1f43b6){if(_0x1f43b6){logger[_0x4632('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1f43b6['id']);switch(_0x23b0df[_0x4632('0x35')]){case _0x4632('0x4f'):logger['info'](_0x4632('0x45'),_0x4632('0x50'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x51'),_0x23b0df[_0x4632('0xf')],_0x2e5978['id'],_0x1f43b6['id']),'method':_0x4632('0x10')});case _0x4632('0x52'):logger[_0x4632('0xb')](_0x4632('0x45'),_0x4632('0x53'));emit(util[_0x4632('0xd')](_0x4632('0x54'),_0x6e373d[_0x4632('0x40')]),_0x4632('0x55'),{'uri':util[_0x4632('0xd')](_0x4632('0x56'),_0x23b0df[_0x4632('0xf')],_0x1f43b6['id'])});break;default:logger[_0x4632('0x57')](_0x4632('0x45'),_0x4632('0x58'));}}})['catch'](function(_0x3bd8ee){logger[_0x4632('0x57')](_0x4632('0x59'),util[_0x4632('0x5a')](_0x3bd8ee,{'showHidden':!![],'depth':null}));});};exports[_0x4632('0x5b')]=function(_0x33ad25,_0x5d2cbb,_0x3d313f,_0x433fea,_0x41409d,_0x5877b9,_0xdc9d7f){var _0x275ea1,_0x57dbe7;_0x5877b9[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x5877b9[_0x4632('0xf')]);_0x5877b9['serverUrl']=intUtil[_0x4632('0x42')](_0x5877b9[_0x4632('0x43')]);if(_0xdc9d7f&&_0xdc9d7f[_0x4632('0x5c')]&&_0xdc9d7f[_0x4632('0x5c')]!==_0x4632('0x5d')){logger[_0x4632('0xb')](_0x4632('0x5e'),_0x4632('0x46'));_0x5d2cbb[_0x4632('0x47')]=util[_0x4632('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5877b9[_0x4632('0x43')],_0x5d2cbb[_0x4632('0x49')],md5(_0x5d2cbb['uniqueid']));}headers[_0x4632('0x5f')]=getAuth(_0x5877b9);return getUser(_0x5877b9,_0x433fea['email'])['then'](function(_0xa55d76){_0x275ea1=_0xa55d76;logger[_0x4632('0xb')](_0x4632('0x4b'),_0x275ea1['id']);return getEndUser(_0x5877b9,_0x5d2cbb[_0x4632('0x60')],_0x5d2cbb[_0x4632('0x61')]);})[_0x4632('0x16')](function(_0x32920e){_0x57dbe7=_0x32920e;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x57dbe7['id']);return getTicket(_0x5877b9,_0x275ea1,_0x57dbe7,_0x3d313f,_0x5d2cbb);})[_0x4632('0x16')](function(_0x1c321f){if(_0x1c321f){logger[_0x4632('0xb')](_0x4632('0x62'),_0x1c321f['id']);switch(_0x5877b9[_0x4632('0x35')]){case'integrationTab':logger['info'](_0x4632('0x5e'),_0x4632('0x50'));return request({'uri':util[_0x4632('0xd')](_0x4632('0x51'),_0x5877b9[_0x4632('0xf')],_0x275ea1['id'],_0x1c321f['id']),'method':_0x4632('0x10')});case'newTab':logger[_0x4632('0xb')](_0x4632('0x5e'),_0x4632('0x53'));emit(util[_0x4632('0xd')]('user:%s',_0x433fea['name']),_0x4632('0x55'),{'uri':util['format'](_0x4632('0x56'),_0x5877b9[_0x4632('0xf')],_0x1c321f['id'])});break;default:logger[_0x4632('0x57')](_0x4632('0x5e'),_0x4632('0x58'));}}})['catch'](function(_0x61aa92){logger[_0x4632('0x57')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x61aa92,{'showHidden':!![],'depth':null}));});};exports[_0x4632('0x63')]=function(_0x1375f6,_0x47391f,_0x3090d6,_0x4dfda1,_0x5a2cc1,_0x52e63b){var _0x10f7ab,_0x5b37cc;_0x52e63b[_0x4632('0xf')]=intUtil[_0x4632('0x42')](_0x52e63b[_0x4632('0xf')]);_0x52e63b[_0x4632('0x43')]=intUtil[_0x4632('0x42')](_0x52e63b[_0x4632('0x43')]);if(_0x5a2cc1&&_0x5a2cc1[_0x4632('0x44')]){logger[_0x4632('0xb')]('['+_0x47391f[_0x4632('0x64')][_0x4632('0x65')]()+']',_0x4632('0x46'));_0x47391f[_0x4632('0x47')]=util[_0x4632('0xd')](_0x4632('0x48'),_0x52e63b[_0x4632('0x43')],_0x47391f[_0x4632('0x49')],md5(_0x47391f['uniqueid']));}else{_0x47391f[_0x4632('0x47')]='';}headers[_0x4632('0x5f')]=getAuth(_0x52e63b);return getUser(_0x52e63b)[_0x4632('0x16')](function(_0x26a3f3){_0x10f7ab=_0x26a3f3;logger[_0x4632('0xb')](_0x4632('0x4b'),_0x10f7ab['id']);return getEndUser(_0x52e63b,_0x47391f[_0x4632('0x4c')],_0x47391f[_0x4632('0x4d')]);})[_0x4632('0x16')](function(_0x33561f){_0x5b37cc=_0x33561f;logger[_0x4632('0xb')](_0x4632('0x4e'),_0x5b37cc['id']);return getTicket(_0x52e63b,_0x10f7ab,_0x5b37cc,_0x3090d6,_0x47391f);})[_0x4632('0x16')](function(_0x4bba05){if(_0x4bba05){logger[_0x4632('0xb')](_0x4632('0x62'),_0x4bba05['id']);}})[_0x4632('0x66')](function(_0x3a4645){logger[_0x4632('0x57')]('['+_0x47391f[_0x4632('0x64')]['toUpperCase']()+']'+_0x4632('0x67'),util[_0x4632('0x5a')](_0x3a4645,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb332=['destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','uniqueid','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','then','validateEmail','Getting\x20agent\x20with\x20email','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','[HTTP]','stringify','defaults','GET','forEach','type','string','nameField','toLowerCase','content','customField','custom_fields','idField','variable','variableName','push','Variable','stripTrailingSlash','serverUrl','monitor_format','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x5b2c50,_0x4db66b){var _0x47f2f9=function(_0xef76e4){while(--_0xef76e4){_0x5b2c50['push'](_0x5b2c50['shift']());}};_0x47f2f9(++_0x4db66b);}(_0xb332,0xd9));var _0x2b33=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xb332[_0xfd9b19];return _0x514918;};'use strict';var _=require(_0x2b33('0x0'));var rp=require('request-promise');var md5=require(_0x2b33('0x1'));var util=require(_0x2b33('0x2'));var Redis=require('ioredis');var intUtil=require(_0x2b33('0x3'));var config=require('../../../../config/environment');var logger=require(_0x2b33('0x4'))('zendesk');config[_0x2b33('0x5')]=_['defaults'](config[_0x2b33('0x5')],{'host':_0x2b33('0x6'),'port':0x18eb});var io=require(_0x2b33('0x7'))(new Redis(config[_0x2b33('0x5')]));function emit(_0x5a7a3f,_0x5ccf2d,_0x4302b7){io['to'](_0x5a7a3f)['emit'](_0x5ccf2d,_0x4302b7);}var headers={'Content-Type':_0x2b33('0x8'),'Accept':_0x2b33('0x8')};function getTicket(_0x2f2cb3,_0x14b4d1,_0x5834bb,_0x16f18,_0x1cefb1){logger[_0x2b33('0x9')](_0x2b33('0xa'));return request({'uri':util[_0x2b33('0xb')](_0x2b33('0xc'),_0x2f2cb3[_0x2b33('0xd')]),'method':_0x2b33('0xe'),'body':{'ticket':_[_0x2b33('0xf')]({'requester_id':_0x5834bb['id'],'submitter_id':_0x14b4d1?_0x14b4d1['id']:undefined,'assignee_id':_0x14b4d1?_0x14b4d1['id']:undefined,'tags':getTags(_0x16f18[_0x2b33('0x10')],_0x2b33('0x11')),'subject':intUtil['getString'](_0x16f18[_0x2b33('0x12')],_0x1cefb1,'\x20'),'description':intUtil[_0x2b33('0x13')](_0x16f18[_0x2b33('0x14')],_0x1cefb1,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x16f18[_0x2b33('0x14')],_0x1cefb1,'\x0a')}},getCustomFields(_0x16f18['Fields'],_0x1cefb1))}})[_0x2b33('0x15')](function(_0x17292f){logger[_0x2b33('0x9')]('Ticket\x20created!');return _0x17292f['ticket'];});}function getUser(_0x1d8e75,_0x1d50d0){if(intUtil[_0x2b33('0x16')](_0x1d50d0)){logger[_0x2b33('0x9')](_0x2b33('0x17'),_0x1d50d0);return request({'uri':util['format']('%s/search.json',_0x1d8e75['remoteUri']),'qs':{'query':util[_0x2b33('0xb')]('type:user\x20role:agent\x20email:%s',_0x1d50d0)}})['then'](function(_0x42cfd7){if(_0x42cfd7[_0x2b33('0x18')]){logger[_0x2b33('0x9')]('Agent\x20found!');return _[_0x2b33('0x19')](_0x42cfd7['results'],{'email':_0x1d50d0,'role':_0x2b33('0x1a')});}else{logger[_0x2b33('0x9')](_0x2b33('0x1b'));return request({'uri':util[_0x2b33('0xb')](_0x2b33('0x1c'),_0x1d8e75[_0x2b33('0xd')])})[_0x2b33('0x15')](function(_0x4fb725){logger[_0x2b33('0x9')](_0x2b33('0x1d'));return _0x4fb725[_0x2b33('0x1e')];});}});}else{logger[_0x2b33('0x9')](_0x2b33('0x1b'));return request({'uri':util[_0x2b33('0xb')](_0x2b33('0x1c'),_0x1d8e75[_0x2b33('0xd')])})['then'](function(_0x2b857f){logger[_0x2b33('0x9')](_0x2b33('0x1d'));return _0x2b857f[_0x2b33('0x1e')];});}}function getEndUser(_0x4df3d4,_0x2ec9db,_0x530098){logger[_0x2b33('0x9')]('Searching\x20enduser\x20with\x20phone',_0x530098);return request({'uri':util[_0x2b33('0xb')](_0x2b33('0x1f'),_0x4df3d4['remoteUri']),'qs':{'query':util[_0x2b33('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x530098)}})[_0x2b33('0x15')](function(_0x5b16a8){var _0x315ebd;if(_0x5b16a8[_0x2b33('0x20')][_0x2b33('0x21')]){_0x5b16a8[_0x2b33('0x20')]=_[_0x2b33('0x22')](_0x5b16a8[_0x2b33('0x20')],{'suspended':![],'role':_0x2b33('0x23')});if(_0x5b16a8[_0x2b33('0x20')][_0x2b33('0x21')]){_0x315ebd=_[_0x2b33('0x24')](_0x5b16a8['results']);}}if(_0x315ebd){logger['info'](_0x2b33('0x25'));return _0x315ebd;}else{logger[_0x2b33('0x9')](_0x2b33('0x26'));return request({'uri':util[_0x2b33('0xb')](_0x2b33('0x27'),_0x4df3d4['remoteUri']),'method':'POST','body':{'user':{'role':_0x2b33('0x23'),'name':util[_0x2b33('0xb')](_0x2b33('0x28'),_0x2ec9db||_0x530098),'phone':_0x530098}}})[_0x2b33('0x15')](function(_0xadee18){logger[_0x2b33('0x9')]('Enduser\x20created.');return _0xadee18[_0x2b33('0x1e')];});}});}function getAuth(_0x4da2dd){var _0x370faf;if(_0x4da2dd[_0x2b33('0x29')]===_0x2b33('0x2a')){_0x370faf=util[_0x2b33('0xb')](_0x2b33('0x2b'),_0x4da2dd[_0x2b33('0x2c')],_0x4da2dd[_0x2b33('0x2a')]);}else if(_0x4da2dd[_0x2b33('0x29')]===_0x2b33('0x2d')){_0x370faf=util[_0x2b33('0xb')](_0x2b33('0x2e'),_0x4da2dd[_0x2b33('0x2c')],_0x4da2dd[_0x2b33('0x2d')]);}return util[_0x2b33('0xb')](_0x2b33('0x2f'),new Buffer(_0x370faf)[_0x2b33('0x30')]('base64'));}function request(_0x52a229){logger['debug'](_0x2b33('0x31'),JSON[_0x2b33('0x32')](_0x52a229));return rp(_[_0x2b33('0x33')](_0x52a229,{'method':_0x2b33('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x32c792,_0x51a5d3){var _0x5a6bc1=[];if(_0x32c792&&_0x32c792[_0x2b33('0x21')]>0x0){_0x5a6bc1=_['map'](_0x32c792,_0x51a5d3);}return _0x5a6bc1;}function getCustomFields(_0x44aea1,_0x12cbb2){var _0x1f7b14=[];var _0xa638d6={'custom_fields':[]};if(_0x44aea1[_0x2b33('0x21')]>0x0){_[_0x2b33('0x35')](_0x44aea1,function(_0x156e77){if(_0x156e77[_0x2b33('0x36')]===_0x2b33('0x37')&&_0x156e77[_0x2b33('0x38')]&&!_0x156e77['customField']){_0xa638d6[_0x156e77[_0x2b33('0x38')][_0x2b33('0x39')]()]=_0x156e77[_0x2b33('0x3a')]['toString']();}else if(_0x156e77['type']===_0x2b33('0x37')&&_0x156e77['idField']&&_0x156e77[_0x2b33('0x3b')]){_0xa638d6[_0x2b33('0x3c')]['push']({'id':_0x156e77[_0x2b33('0x3d')],'value':_0x156e77[_0x2b33('0x3a')]['toString']()});}else if(_0x156e77[_0x2b33('0x36')]===_0x2b33('0x3e')&&_0x156e77['variableName']&&_0x156e77[_0x2b33('0x3d')]&&_0x156e77[_0x2b33('0x3b')]){_0x12cbb2[_0x156e77[_0x2b33('0x3f')]]&&_0xa638d6['custom_fields'][_0x2b33('0x40')]({'id':_0x156e77[_0x2b33('0x3d')],'value':_0x12cbb2[_0x156e77[_0x2b33('0x3f')]][_0x2b33('0x30')]()});}else if(_0x156e77[_0x2b33('0x36')]==='customVariable'&&_0x156e77[_0x2b33('0x41')]&&_0x156e77[_0x2b33('0x41')][_0x2b33('0x11')]&&_0x156e77['idField']&&_0x156e77[_0x2b33('0x3b')]){_0x12cbb2[_0x156e77[_0x2b33('0x41')][_0x2b33('0x11')][_0x2b33('0x39')]()]&&_0xa638d6['custom_fields'][_0x2b33('0x40')]({'id':_0x156e77[_0x2b33('0x3d')],'value':_0x12cbb2[_0x156e77['Variable']['name']['toLowerCase']()][_0x2b33('0x30')]()});}});}return _0xa638d6;}exports['queue']=function(_0x35df3c,_0x71214,_0x4ac79b,_0xaef4ff,_0x16e415,_0xd68bbd){var _0x361b71,_0x13bb23;_0xd68bbd['remoteUri']=intUtil[_0x2b33('0x42')](_0xd68bbd[_0x2b33('0xd')]);_0xd68bbd[_0x2b33('0x43')]=intUtil[_0x2b33('0x42')](_0xd68bbd[_0x2b33('0x43')]);if(_0x16e415&&_0x16e415[_0x2b33('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x71214['recordingURL']=util[_0x2b33('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd68bbd[_0x2b33('0x43')],_0x71214['uniqueid'],md5(_0x71214['uniqueid']));}else{_0x71214[_0x2b33('0x45')]='';}headers[_0x2b33('0x46')]=getAuth(_0xd68bbd);return getUser(_0xd68bbd,_0xaef4ff[_0x2b33('0x47')])['then'](function(_0xa8f425){_0x361b71=_0xa8f425;logger['info'](_0x2b33('0x48'),_0x361b71['id']);return getEndUser(_0xd68bbd,_0x71214[_0x2b33('0x49')],_0x71214[_0x2b33('0x4a')]);})[_0x2b33('0x15')](function(_0x144435){_0x13bb23=_0x144435;logger[_0x2b33('0x9')]('The\x20Enduser\x20ID\x20is:',_0x13bb23['id']);return getTicket(_0xd68bbd,_0x361b71,_0x13bb23,_0x4ac79b,_0x71214);})[_0x2b33('0x15')](function(_0x27f766){if(_0x27f766){logger[_0x2b33('0x9')]('The\x20Ticket\x20ID\x20is:',_0x27f766['id']);switch(_0xd68bbd[_0x2b33('0x36')]){case _0x2b33('0x4b'):logger[_0x2b33('0x9')]('[QUEUE]',_0x2b33('0x4c'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xd68bbd[_0x2b33('0xd')],_0x361b71['id'],_0x27f766['id']),'method':_0x2b33('0xe')});case _0x2b33('0x4d'):logger[_0x2b33('0x9')](_0x2b33('0x4e'),_0x2b33('0x4f'));emit(util[_0x2b33('0xb')](_0x2b33('0x50'),_0xaef4ff['name']),_0x2b33('0x51'),{'uri':util[_0x2b33('0xb')]('%s/agent/tickets/%s',_0xd68bbd[_0x2b33('0xd')],_0x27f766['id'])});break;default:logger[_0x2b33('0x52')]('[QUEUE]',_0x2b33('0x53'));}}})[_0x2b33('0x54')](function(_0x20f473){logger[_0x2b33('0x52')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2b33('0x55')](_0x20f473,{'showHidden':!![],'depth':null}));});};exports[_0x2b33('0x56')]=function(_0x5528fe,_0x150035,_0x162d13,_0x1ce316,_0x26e0ca,_0x3a9bbf,_0x35756e){var _0x1bbb5f,_0x5609f6;_0x3a9bbf['remoteUri']=intUtil[_0x2b33('0x42')](_0x3a9bbf[_0x2b33('0xd')]);_0x3a9bbf['serverUrl']=intUtil[_0x2b33('0x42')](_0x3a9bbf[_0x2b33('0x43')]);if(_0x35756e&&_0x35756e[_0x2b33('0x57')]&&_0x35756e['recordingFormat']!==_0x2b33('0x58')){logger[_0x2b33('0x9')](_0x2b33('0x59'),_0x2b33('0x5a'));_0x150035[_0x2b33('0x45')]=util[_0x2b33('0xb')](_0x2b33('0x5b'),_0x3a9bbf[_0x2b33('0x43')],_0x150035['uniqueid'],md5(_0x150035['uniqueid']));}headers[_0x2b33('0x46')]=getAuth(_0x3a9bbf);return getUser(_0x3a9bbf,_0x1ce316[_0x2b33('0x47')])[_0x2b33('0x15')](function(_0x275210){_0x1bbb5f=_0x275210;logger[_0x2b33('0x9')](_0x2b33('0x48'),_0x1bbb5f['id']);return getEndUser(_0x3a9bbf,_0x150035['destcalleridname'],_0x150035[_0x2b33('0x5c')]);})[_0x2b33('0x15')](function(_0x2eafb2){_0x5609f6=_0x2eafb2;logger[_0x2b33('0x9')](_0x2b33('0x5d'),_0x5609f6['id']);return getTicket(_0x3a9bbf,_0x1bbb5f,_0x5609f6,_0x162d13,_0x150035);})[_0x2b33('0x15')](function(_0x4cdc75){if(_0x4cdc75){logger[_0x2b33('0x9')](_0x2b33('0x5e'),_0x4cdc75['id']);switch(_0x3a9bbf[_0x2b33('0x36')]){case _0x2b33('0x4b'):logger[_0x2b33('0x9')]('[OUTBOUND]',_0x2b33('0x4c'));return request({'uri':util[_0x2b33('0xb')](_0x2b33('0x5f'),_0x3a9bbf[_0x2b33('0xd')],_0x1bbb5f['id'],_0x4cdc75['id']),'method':'POST'});case _0x2b33('0x4d'):logger['info'](_0x2b33('0x59'),_0x2b33('0x4f'));emit(util[_0x2b33('0xb')](_0x2b33('0x50'),_0x1ce316[_0x2b33('0x11')]),_0x2b33('0x51'),{'uri':util[_0x2b33('0xb')](_0x2b33('0x60'),_0x3a9bbf['remoteUri'],_0x4cdc75['id'])});break;default:logger[_0x2b33('0x52')](_0x2b33('0x59'),_0x2b33('0x53'));}}})[_0x2b33('0x54')](function(_0x311c62){logger[_0x2b33('0x52')](_0x2b33('0x61'),util[_0x2b33('0x55')](_0x311c62,{'showHidden':!![],'depth':null}));});};exports[_0x2b33('0x62')]=function(_0x2474d3,_0xfd05df,_0x34a555,_0x47acb1,_0x452cca,_0x4db872){var _0x4fb281,_0x6dd6fa;_0x4db872[_0x2b33('0xd')]=intUtil[_0x2b33('0x42')](_0x4db872['remoteUri']);_0x4db872[_0x2b33('0x43')]=intUtil[_0x2b33('0x42')](_0x4db872[_0x2b33('0x43')]);if(_0x452cca&&_0x452cca[_0x2b33('0x44')]){logger['info']('['+_0xfd05df['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xfd05df['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4db872[_0x2b33('0x43')],_0xfd05df[_0x2b33('0x63')],md5(_0xfd05df[_0x2b33('0x63')]));}else{_0xfd05df['recordingURL']='';}headers[_0x2b33('0x46')]=getAuth(_0x4db872);return getUser(_0x4db872)[_0x2b33('0x15')](function(_0x3602ba){_0x4fb281=_0x3602ba;logger[_0x2b33('0x9')](_0x2b33('0x48'),_0x4fb281['id']);return getEndUser(_0x4db872,_0xfd05df[_0x2b33('0x49')],_0xfd05df['calleridnum']);})['then'](function(_0x57ef17){_0x6dd6fa=_0x57ef17;logger['info']('The\x20Enduser\x20ID\x20is:',_0x6dd6fa['id']);return getTicket(_0x4db872,_0x4fb281,_0x6dd6fa,_0x34a555,_0xfd05df);})['then'](function(_0x35a66b){if(_0x35a66b){logger[_0x2b33('0x9')]('The\x20Ticket\x20ID\x20is:',_0x35a66b['id']);}})[_0x2b33('0x54')](function(_0xc06357){logger[_0x2b33('0x52')]('['+_0xfd05df[_0x2b33('0x64')][_0x2b33('0x65')]()+']'+_0x2b33('0x66'),util[_0x2b33('0x55')](_0xc06357,{'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 d0a5484..d73c7ce 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 _0xa195=['stringify','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','data','code','SUCCESS','details','startCase','Error:\x20','catch','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','format','mm:ss','utc','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','toUpperCase','lodash','request-promise','util','./util','ioredis','../../../../config/environment','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]'];(function(_0x401f03,_0x1cd361){var _0xd1e6f9=function(_0x2a51f2){while(--_0x2a51f2){_0x401f03['push'](_0x401f03['shift']());}};_0xd1e6f9(++_0x1cd361);}(_0xa195,0x1b2));var _0x5a19=function(_0x273301,_0x523bb8){_0x273301=_0x273301-0x0;var _0x27607d=_0xa195[_0x273301];return _0x27607d;};'use strict';var _=require(_0x5a19('0x0'));var rp=require(_0x5a19('0x1'));var md5=require('md5');var util=require(_0x5a19('0x2'));var intUtil=require(_0x5a19('0x3'));var moment=require('moment');var Redis=require(_0x5a19('0x4'));var BPromise=require('bluebird');var config=require(_0x5a19('0x5'));var logger=require('../../../../config/logger')(_0x5a19('0x6'));config[_0x5a19('0x7')]=_['defaults'](config[_0x5a19('0x7')],{'host':_0x5a19('0x8'),'port':0x18eb});var io=require(_0x5a19('0x9'))(new Redis(config[_0x5a19('0x7')]));function emit(_0x328c98,_0x17889c,_0x5c28bc){io['to'](_0x328c98)[_0x5a19('0xa')](_0x17889c,_0x5c28bc);}function request(_0x26e303){logger[_0x5a19('0xb')](_0x5a19('0xc'),JSON[_0x5a19('0xd')](_0x26e303));return rp(_0x26e303);}function getCustomFields(_0x46d8e7,_0x1e55a6){var _0x20c238={};if(_0x46d8e7['length']>0x0){_[_0x5a19('0xe')](_0x46d8e7,function(_0x24191f){if(_0x24191f[_0x5a19('0xf')]==='string'&&_0x24191f[_0x5a19('0x10')]){_0x20c238[_0x24191f['idField']]=_0x24191f[_0x5a19('0x11')][_0x5a19('0x12')]();}else if(_0x24191f['type']===_0x5a19('0x13')&&_0x24191f[_0x5a19('0x14')]&&_0x24191f[_0x5a19('0x10')]&&_0x1e55a6[_0x24191f[_0x5a19('0x14')]]){_0x20c238[_0x24191f['idField']]=_0x1e55a6[_0x24191f[_0x5a19('0x14')]][_0x5a19('0x12')]();}else if(_0x24191f[_0x5a19('0xf')]===_0x5a19('0x15')&&_0x24191f[_0x5a19('0x16')]&&_0x24191f['Variable']['name']&&_0x24191f[_0x5a19('0x10')]&&_0x1e55a6[_0x24191f[_0x5a19('0x16')][_0x5a19('0x17')][_0x5a19('0x18')]()]){_0x20c238[_0x24191f[_0x5a19('0x10')]]=_0x1e55a6[_0x24191f[_0x5a19('0x16')][_0x5a19('0x17')]['toLowerCase']()][_0x5a19('0x12')]();}});}return _0x20c238;}function getName(_0x46733f){if(_0x46733f['indexOf']('\x20')>0x0){var _0x36b3ac=_0x46733f[_0x5a19('0x19')](/ (.+)/);if(_0x36b3ac[0x1]){return _0x36b3ac;}}return[_0x46733f,_0x46733f];}var accountsTokens={};function getAccessToken(_0x47738f){return new Promise(function(_0x1d1b16,_0x44061f){if(!_[_0x5a19('0x1a')](accountsTokens[_0x47738f['id']])&&!_[_0x5a19('0x1a')](accountsTokens[_0x47738f['id']][_0x5a19('0x1b')])){if(moment()['isBefore'](accountsTokens[_0x47738f['id']][_0x5a19('0x1c')])){_0x1d1b16(accountsTokens[_0x47738f['id']][_0x5a19('0x1b')]);}}var _0x65efba;switch(_0x47738f[_0x5a19('0x1d')]){case'US':_0x65efba=_0x5a19('0x1e');break;case'AU':_0x65efba='https://accounts.zoho.com.au';break;case'EU':_0x65efba=_0x5a19('0x1f');break;case'IN':_0x65efba=_0x5a19('0x20');break;case'CN':_0x65efba=_0x5a19('0x21');break;default:_0x65efba='https://accounts.zoho.eu';break;}var _0x48f895={'method':_0x5a19('0x22'),'uri':_0x65efba+_0x5a19('0x23'),'qs':{'refresh_token':_0x47738f[_0x5a19('0x24')],'client_id':_0x47738f[_0x5a19('0x25')],'client_secret':_0x47738f[_0x5a19('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48f895)[_0x5a19('0x27')](function(_0x2ab999){accountsTokens[_0x47738f['id']]={'access_token':_0x2ab999['access_token'],'expires_in':moment()[_0x5a19('0x28')](_0x2ab999[_0x5a19('0x1c')],'seconds')};_0x1d1b16(_0x2ab999[_0x5a19('0x1b')]);})['catch'](function(_0x1040af){logger[_0x5a19('0x29')](_0x5a19('0x2a'),_0x1040af[_0x5a19('0x2b')]);_0x44061f(_0x1040af);});});}function getUser(_0x68fbb7,_0x3c9aef,_0x25e724,_0x18ea07){logger['info'](_0x5a19('0x2c'));return request({'method':_0x5a19('0x2d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x3c9aef),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x5a19('0x2e')+_0x68fbb7},'json':!![]})[_0x5a19('0x27')](function(_0x96b675){if(_0x96b675['users']){var _0x4e8c10=-0x1;if(_[_0x5a19('0x2f')](_0x96b675[_0x5a19('0x30')])){if(!_[_0x5a19('0x1a')](_0x18ea07)){_0x4e8c10=_[_0x5a19('0x31')](_0x96b675[_0x5a19('0x30')],function(_0x405967){return _0x405967[_0x5a19('0x32')]===_0x18ea07;});}if(_0x4e8c10>=0x0){logger[_0x5a19('0x33')](_0x5a19('0x34'));}else{logger['info'](_0x5a19('0x35'));_0x4e8c10=_['findIndex'](_0x96b675[_0x5a19('0x30')],function(_0x546c36){return _0x546c36[_0x5a19('0x36')][_0x5a19('0x17')]===_0x5a19('0x37');});}return _0x96b675[_0x5a19('0x30')][_0x4e8c10];}else{if(_0x96b675[_0x5a19('0x38')][_0x5a19('0x36')][_0x5a19('0x17')]==='Administrator'){logger[_0x5a19('0x33')]('Using\x20the\x20admin\x20account!');user=_0x96b675[_0x5a19('0x38')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x5a19('0xd')](_0x96b675));throw new Error(_0x5a19('0x39')+JSON[_0x5a19('0xd')](_0x96b675));}}}else{logger['error'](_0x5a19('0x3a'),JSON[_0x5a19('0xd')](_0x96b675));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5a19('0xd')](_0x96b675));}})['catch'](function(_0x4fe605){console[_0x5a19('0x29')](_0x4fe605);});}function getZohoUser(_0x38d1a2,_0x1ffdfd){return new BPromise(function(_0x263951,_0x245c9f){request(_0x38d1a2)[_0x5a19('0x27')](function(_0x190002){var _0x29282c=null;if(_0x190002){_0x29282c=_0x190002['data'][0x0];_0x29282c[_0x5a19('0x3b')]=_0x1ffdfd;}_0x263951(_0x29282c);})['catch'](function(_0x43ddd8){_0x245c9f(_0x43ddd8);});});}function createEndUser(_0x23188e,_0x3a7ce0,_0x1478a5,_0x134890,_0x3ac723,_0x2882d8){var _0x1478a5=getName(_0x1478a5);return request({'method':_0x5a19('0x22'),'uri':_0x5a19('0x3c')+_0x3a7ce0+_0x5a19('0x3d')+_['startCase'](_0x2882d8[_0x5a19('0x3e')])+'s','body':{'data':[{'Last_Name':_0x1478a5[0x1],'First_Name':_0x1478a5[0x0],'Phone':_0x134890,'Owner':{'name':!_[_0x5a19('0x1a')](_0x3ac723['role'][_0x5a19('0x17')])?_0x3ac723[_0x5a19('0x3f')][_0x5a19('0x17')]:!_['isNil'](_0x3ac723[_0x5a19('0x40')])?_0x3ac723[_0x5a19('0x40')]+'\x20'+_0x3ac723['last_name']:_0x3ac723['last_name'],'id':_0x3ac723['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23188e},'json':!![]})[_0x5a19('0x27')](function(_0x3b07d0){if(_0x3b07d0&&_0x3b07d0[_0x5a19('0x41')][0x0][_0x5a19('0x42')]===_0x5a19('0x43')){var _0x1f02b4=_0x3b07d0[_0x5a19('0x41')][0x0][_0x5a19('0x44')];_0x1f02b4[_0x5a19('0x3b')]=_[_0x5a19('0x45')](_0x2882d8[_0x5a19('0x3e')])+'s';return _0x1f02b4;}logger[_0x5a19('0x29')](_0x5a19('0x3a'),JSON[_0x5a19('0xd')](data));throw new Error(_0x5a19('0x46')+JSON[_0x5a19('0xd')](data));})[_0x5a19('0x47')](function(_0x5d9b53){console['log']('CREATE\x20ERROR',_0x5d9b53);});}function getEndUser(_0x12304f,_0x1337aa,_0x2a2121,_0x27bbec,_0x2ce111,_0x140755,_0x430258){var _0x48bb88={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12304f},'json':!![]};switch(_0x430258[_0x5a19('0x48')]){case _0x5a19('0x49'):_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+_0x5a19('0x4b')+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Contacts')[_0x5a19('0x27')](function(_0x2e6fbc){if(_0x2e6fbc)return _0x2e6fbc;_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ce111+'))';return getZohoUser(_0x48bb88,_0x5a19('0x4c'))['then'](function(_0x1a6035){if(_0x1a6035)return _0x1a6035;if(_0x430258['moduleCreate']!=_0x5a19('0x4d')){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});});break;case _0x5a19('0x4e'):_0x48bb88[_0x5a19('0x4a')]='https://www.zohoapis.'+_0x1337aa+_0x5a19('0x4b')+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Contacts')[_0x5a19('0x27')](function(_0x9fb163){if(_0x9fb163)return _0x9fb163;if(_0x430258[_0x5a19('0x3e')]!='nothing'){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});break;case _0x5a19('0x4f'):_0x48bb88[_0x5a19('0x4a')]=_0x5a19('0x3c')+_0x1337aa+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ce111+'))';return getZohoUser(_0x48bb88,'Leads')[_0x5a19('0x27')](function(_0x1cd73e){if(_0x1cd73e)return _0x1cd73e;if(_0x430258[_0x5a19('0x3e')]!=_0x5a19('0x4d')){return createEndUser(_0x12304f,_0x1337aa,_0x27bbec,_0x2ce111,_0x140755,_0x430258);}else{return{};}});break;}}function getCall(_0x3acaa6,_0x52f989,_0x5ea1e5,_0x2dbf53,_0x29639e,_0x107111,_0x4eab2e,_0x157cc7){logger[_0x5a19('0x33')](_0x5a19('0x50'));var _0x33e2b7={};_0x33e2b7[_0x5a19('0x51')]={'name':!_['isNil'](_0x2dbf53[_0x5a19('0x3f')][_0x5a19('0x17')])&&!_[_0x5a19('0x1a')](_0x2dbf53[_0x5a19('0x36')][_0x5a19('0x17')])&&_0x2dbf53[_0x5a19('0x36')][_0x5a19('0x17')]===_0x5a19('0x52')?_0x2dbf53['role']['name']:!_[_0x5a19('0x1a')](_0x2dbf53[_0x5a19('0x40')])?_0x2dbf53[_0x5a19('0x40')]+'\x20'+_0x2dbf53[_0x5a19('0x53')]:_0x2dbf53[_0x5a19('0x53')],'id':_0x2dbf53['id']};_0x33e2b7[_0x5a19('0x54')]=intUtil[_0x5a19('0x55')](_0x107111[_0x5a19('0x56')],_0x4eab2e,'\x20');_0x33e2b7[_0x5a19('0x57')]=intUtil[_0x5a19('0x55')](_0x107111[_0x5a19('0x58')],_0x4eab2e,'\x0a');if(_0x29639e[_0x5a19('0x3b')]===_0x5a19('0x59')){_0x33e2b7[_0x5a19('0x5a')]={'name':!_[_0x5a19('0x1a')](_0x29639e[_0x5a19('0x5b')])?_0x29639e['Full_Name']:!_[_0x5a19('0x1a')](_0x29639e['First_Name'])?_0x29639e[_0x5a19('0x5c')]+'\x20'+_0x29639e[_0x5a19('0x5d')]:_0x29639e[_0x5a19('0x5d')],'id':_0x29639e['id']};}if(_0x29639e['enduserType']==='Leads'){_0x33e2b7[_0x5a19('0x5e')]={'name':!_['isNil'](_0x29639e[_0x5a19('0x5b')])?_0x29639e[_0x5a19('0x5b')]:!_[_0x5a19('0x1a')](_0x29639e['First_Name'])?_0x29639e[_0x5a19('0x5c')]+'\x20'+_0x29639e[_0x5a19('0x5d')]:_0x29639e['Last_Name'],'id':_0x29639e['id']};_0x33e2b7['$se_module']=_['startCase'](_0x29639e['enduserType']);}if(_0x4eab2e[_0x5a19('0x5f')]){_0x33e2b7[_0x5a19('0x60')]=moment['utc'](parseInt(_0x4eab2e[_0x5a19('0x5f')])*0x3e8)[_0x5a19('0x61')](_0x5a19('0x62'));}else if(_0x4eab2e['answertime']&&_0x4eab2e['endtime']){_0x33e2b7[_0x5a19('0x60')]=moment[_0x5a19('0x63')](moment(_0x4eab2e[_0x5a19('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0x5a19('0x65')](moment(_0x4eab2e[_0x5a19('0x66')],_0x5a19('0x67'))))['format'](_0x5a19('0x62'));}switch(_0x4eab2e[_0x5a19('0x68')]){case _0x5a19('0x69'):_0x33e2b7['Call_Result']=_0x5a19('0x6a');break;case _0x5a19('0x6b'):case'connect':_0x33e2b7[_0x5a19('0x6c')]=_0x5a19('0x6d');break;case'rejected':_0x33e2b7['Call_Result']=_0x5a19('0x6e');break;case _0x5a19('0x6f'):_0x33e2b7[_0x5a19('0x6c')]='Abandoned';break;case _0x5a19('0x70'):_0x33e2b7['Call_Result']='Timeout';default:}_0x33e2b7[_0x5a19('0x71')]=(_0x157cc7===_0x5a19('0x72')?moment(_0x4eab2e[_0x5a19('0x66')])[_0x5a19('0x61')](_0x5a19('0x67')):moment(_0x4eab2e[_0x5a19('0x73')])['format'](_0x5a19('0x67')))||moment()[_0x5a19('0x61')](_0x5a19('0x67'));_0x33e2b7['Call_Type']=_0x157cc7||_0x5a19('0x74');_0x33e2b7=_[_0x5a19('0x75')](_0x33e2b7,getCustomFields(_0x107111[_0x5a19('0x76')],_0x4eab2e));return request({'method':_0x5a19('0x22'),'uri':_0x5a19('0x3c')+_0x52f989+_0x5a19('0x77'),'headers':{'Authorization':_0x5a19('0x2e')+_0x3acaa6},'body':{'data':[_0x33e2b7]},'json':!![]})['then'](function(_0x93b4b7){if(_0x93b4b7&&_0x93b4b7[_0x5a19('0x41')][0x0][_0x5a19('0x42')]==='SUCCESS'){logger[_0x5a19('0x33')]('Call\x20created!');return{'id':_0x93b4b7['data'][0x0][_0x5a19('0x44')]['id']};}})[_0x5a19('0x47')](function(_0x10c292){logger[_0x5a19('0x33')](_0x5a19('0x78'),_0x10c292[_0x5a19('0x2b')]);console['log'](_0x5a19('0x78'),_0x10c292);});}exports[_0x5a19('0x79')]=function(_0x319eee,_0x435d3c,_0x4fa208,_0x21142c,_0xbada32,_0x8bdc72){var _0x3e1b9a,_0x1c8b70,_0x5b9d86;_0x8bdc72[_0x5a19('0x7a')]=intUtil['stripTrailingSlash'](_0x8bdc72[_0x5a19('0x7a')]);_0x8bdc72[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x8bdc72[_0x5a19('0x7b')]);if(_0xbada32&&_0xbada32[_0x5a19('0x7d')]){logger[_0x5a19('0x33')](_0x5a19('0x7e'),_0x5a19('0x7f'));_0x435d3c[_0x5a19('0x80')]=_0x8bdc72[_0x5a19('0x7b')]+_0x5a19('0x81')+_0x435d3c[_0x5a19('0x82')]+_0x5a19('0x83')+md5(_0x435d3c[_0x5a19('0x82')]);}else{_0x435d3c[_0x5a19('0x80')]='';}var _0x4662ba=_0x8bdc72[_0x5a19('0x7a')]===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x8bdc72)['then'](function(_0x2d57f9){_0x5b9d86=_0x2d57f9;return getUser(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x21142c[_0x5a19('0x32')]);})[_0x5a19('0x27')](function(_0x5014b4){_0x3e1b9a=_0x5014b4;logger[_0x5a19('0x33')](_0x5a19('0x86'),_0x3e1b9a['id']);return getEndUser(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x435d3c[_0x5a19('0x87')],_0x435d3c['calleridnum'],_0x3e1b9a,_0x4fa208);})['then'](function(_0x336077){_0x1c8b70=_0x336077;return getCall(_0x5b9d86,_0x4662ba,_0x8bdc72,_0x3e1b9a,_0x1c8b70,_0x4fa208,_0x435d3c,_0x5a19('0x74'));})['then'](function(_0x521edf){if(_0x521edf){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x521edf['id']);logger['info'](_0x5a19('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a19('0x61')](_0x5a19('0x89'),_0x21142c[_0x5a19('0x17')]),'trigger:browser:url',{'uri':_0x5a19('0x8a')+_0x8bdc72[_0x5a19('0x7a')]+_0x5a19('0x8b')+_0x521edf['id']});}})[_0x5a19('0x47')](function(_0x2aa6d0){logger[_0x5a19('0x29')](_0x5a19('0x7e'),JSON[_0x5a19('0xd')](_0x2aa6d0));});};exports[_0x5a19('0x72')]=function(_0x16f882,_0x4d40fb,_0x56d8c3,_0x34a729,_0x44ebe7,_0x42142d,_0xa287d4){var _0x1206eb,_0x46e8fb,_0x207874;_0x42142d['host']=intUtil[_0x5a19('0x7c')](_0x42142d[_0x5a19('0x7a')]);_0x42142d[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x42142d[_0x5a19('0x7b')]);if(_0xa287d4&&_0xa287d4[_0x5a19('0x8c')]&&_0xa287d4['recordingFormat']!=='none'){logger[_0x5a19('0x33')]('[OUTBOUND]',_0x5a19('0x7f'));_0x4d40fb['recordingURL']=_0x42142d[_0x5a19('0x7b')]+_0x5a19('0x81')+_0x4d40fb['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4d40fb['uniqueid']);}var _0x3729ef=_0x42142d['host']===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x42142d)[_0x5a19('0x27')](function(_0x5e39b0){_0x207874=_0x5e39b0;return getUser(_0x207874,_0x3729ef,_0x42142d,_0x34a729[_0x5a19('0x32')]);})[_0x5a19('0x27')](function(_0x2c8b4d){_0x1206eb=_0x2c8b4d;logger['info'](_0x5a19('0x86'),_0x1206eb['id']);return getEndUser(_0x207874,_0x3729ef,_0x42142d,_0x4d40fb[_0x5a19('0x8d')],_0x4d40fb[_0x5a19('0x8e')],_0x1206eb,_0x56d8c3);})[_0x5a19('0x27')](function(_0x626b37){_0x46e8fb=_0x626b37;return getCall(_0x207874,_0x3729ef,_0x42142d,_0x1206eb,_0x46e8fb,_0x56d8c3,_0x4d40fb,_0x5a19('0x8f'));})[_0x5a19('0x27')](function(_0x1626bd){if(_0x1626bd){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x1626bd['id']);logger[_0x5a19('0x33')](_0x5a19('0x90'),_0x5a19('0x91'));emit(util['format']('user:%s',_0x34a729[_0x5a19('0x17')]),_0x5a19('0x92'),{'uri':_0x5a19('0x8a')+_0x42142d[_0x5a19('0x7a')]+_0x5a19('0x8b')+_0x1626bd['id']});}})[_0x5a19('0x47')](function(_0x33257c){logger[_0x5a19('0x29')](_0x5a19('0x90'),JSON[_0x5a19('0xd')](_0x33257c));});};exports[_0x5a19('0x93')]=function(_0x224280,_0x159883,_0x59412e,_0x4f2781,_0x21349c,_0x4ca1fc){var _0x312f8f,_0x552822,_0x2be3cd;_0x4ca1fc[_0x5a19('0x7a')]=intUtil[_0x5a19('0x7c')](_0x4ca1fc['host']);_0x4ca1fc[_0x5a19('0x7b')]=intUtil[_0x5a19('0x7c')](_0x4ca1fc[_0x5a19('0x7b')]);if(_0x21349c&&_0x21349c[_0x5a19('0x7d')]){logger[_0x5a19('0x33')]('['+_0x159883['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x159883[_0x5a19('0x80')]=_0x4ca1fc[_0x5a19('0x7b')]+'/api/voice/recordings/'+_0x159883['uniqueid']+_0x5a19('0x83')+md5(_0x159883[_0x5a19('0x82')]);}else{_0x159883[_0x5a19('0x80')]='';}var _0x536bcf=_0x4ca1fc[_0x5a19('0x7a')]===_0x5a19('0x84')?'eu':_0x5a19('0x85');return getAccessToken(_0x4ca1fc)[_0x5a19('0x27')](function(_0x5dd169){_0x2be3cd=_0x5dd169;return getUser(_0x2be3cd,_0x536bcf,_0x4ca1fc);})[_0x5a19('0x27')](function(_0x57543e){_0x312f8f=_0x57543e;logger[_0x5a19('0x33')](_0x5a19('0x86'),_0x312f8f['id']);return getEndUser(_0x2be3cd,_0x536bcf,_0x4ca1fc,_0x159883[_0x5a19('0x87')],_0x159883['calleridnum'],_0x312f8f,_0x59412e);})['then'](function(_0x3b63be){_0x552822=_0x3b63be;return getCall(_0x2be3cd,_0x536bcf,_0x4ca1fc,_0x312f8f,_0x552822,_0x59412e,_0x159883,'Inbound');})[_0x5a19('0x27')](function(_0x290619){if(_0x290619){logger[_0x5a19('0x33')](_0x5a19('0x88'),_0x290619['id']);}})[_0x5a19('0x47')](function(_0x37b527){logger[_0x5a19('0x29')]('['+_0x159883[_0x5a19('0x68')][_0x5a19('0x94')]()+']',JSON[_0x5a19('0xd')](_0x37b527));});}; \ No newline at end of file +var _0x4fad=['Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','POST','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','socket.io-emitter','debug','[HTTP]','length','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','error','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','profile','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','format','lastevent','called','Called','complete','Call_Result','rejected','Rejected','abandoned'];(function(_0x2dca8f,_0x8b3aa1){var _0x1f4744=function(_0x5be102){while(--_0x5be102){_0x2dca8f['push'](_0x2dca8f['shift']());}};_0x1f4744(++_0x8b3aa1);}(_0x4fad,0xcb));var _0xd4fa=function(_0x501c8f,_0x20cedc){_0x501c8f=_0x501c8f-0x0;var _0x303616=_0x4fad[_0x501c8f];return _0x303616;};'use strict';var _=require(_0xd4fa('0x0'));var rp=require(_0xd4fa('0x1'));var md5=require(_0xd4fa('0x2'));var util=require('util');var intUtil=require(_0xd4fa('0x3'));var moment=require(_0xd4fa('0x4'));var Redis=require(_0xd4fa('0x5'));var BPromise=require(_0xd4fa('0x6'));var config=require(_0xd4fa('0x7'));var logger=require(_0xd4fa('0x8'))(_0xd4fa('0x9'));config[_0xd4fa('0xa')]=_['defaults'](config[_0xd4fa('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xd4fa('0xb'))(new Redis(config[_0xd4fa('0xa')]));function emit(_0x155c09,_0x3fff99,_0x58d2cd){io['to'](_0x155c09)['emit'](_0x3fff99,_0x58d2cd);}function request(_0x26a894){logger[_0xd4fa('0xc')](_0xd4fa('0xd'),JSON['stringify'](_0x26a894));return rp(_0x26a894);}function getCustomFields(_0x2df3c5,_0x612e9d){var _0x2fa021={};if(_0x2df3c5[_0xd4fa('0xe')]>0x0){_['forEach'](_0x2df3c5,function(_0x109893){if(_0x109893[_0xd4fa('0xf')]===_0xd4fa('0x10')&&_0x109893['idField']){_0x2fa021[_0x109893[_0xd4fa('0x11')]]=_0x109893[_0xd4fa('0x12')][_0xd4fa('0x13')]();}else if(_0x109893[_0xd4fa('0xf')]===_0xd4fa('0x14')&&_0x109893[_0xd4fa('0x15')]&&_0x109893['idField']&&_0x612e9d[_0x109893[_0xd4fa('0x15')]]){_0x2fa021[_0x109893[_0xd4fa('0x11')]]=_0x612e9d[_0x109893[_0xd4fa('0x15')]][_0xd4fa('0x13')]();}else if(_0x109893[_0xd4fa('0xf')]===_0xd4fa('0x16')&&_0x109893[_0xd4fa('0x17')]&&_0x109893['Variable'][_0xd4fa('0x18')]&&_0x109893[_0xd4fa('0x11')]&&_0x612e9d[_0x109893[_0xd4fa('0x17')]['name']['toLowerCase']()]){_0x2fa021[_0x109893[_0xd4fa('0x11')]]=_0x612e9d[_0x109893['Variable']['name'][_0xd4fa('0x19')]()][_0xd4fa('0x13')]();}});}return _0x2fa021;}function getName(_0x29789b){if(_0x29789b[_0xd4fa('0x1a')]('\x20')>0x0){var _0x56a95c=_0x29789b[_0xd4fa('0x1b')](/ (.+)/);if(_0x56a95c[0x1]){return _0x56a95c;}}return[_0x29789b,_0x29789b];}var accountsTokens={};function getAccessToken(_0x1dc03e){return new Promise(function(_0x562412,_0xbf7dcf){if(!_['isNil'](accountsTokens[_0x1dc03e['id']])&&!_['isNil'](accountsTokens[_0x1dc03e['id']][_0xd4fa('0x1c')])){if(moment()[_0xd4fa('0x1d')](accountsTokens[_0x1dc03e['id']][_0xd4fa('0x1e')])){_0x562412(accountsTokens[_0x1dc03e['id']][_0xd4fa('0x1c')]);}}var _0x586af0;switch(_0x1dc03e[_0xd4fa('0x1f')]){case'US':_0x586af0=_0xd4fa('0x20');break;case'AU':_0x586af0=_0xd4fa('0x21');break;case'EU':_0x586af0=_0xd4fa('0x22');break;case'IN':_0x586af0=_0xd4fa('0x23');break;case'CN':_0x586af0='https://accounts.zoho.com.cn';break;default:_0x586af0=_0xd4fa('0x22');break;}var _0x14ea6e={'method':'POST','uri':_0x586af0+_0xd4fa('0x24'),'qs':{'refresh_token':_0x1dc03e[_0xd4fa('0x25')],'client_id':_0x1dc03e[_0xd4fa('0x26')],'client_secret':_0x1dc03e[_0xd4fa('0x27')],'grant_type':_0xd4fa('0x28')},'json':!![]};return rp(_0x14ea6e)[_0xd4fa('0x29')](function(_0x3c6d17){accountsTokens[_0x1dc03e['id']]={'access_token':_0x3c6d17[_0xd4fa('0x1c')],'expires_in':moment()[_0xd4fa('0x2a')](_0x3c6d17['expires_in'],_0xd4fa('0x2b'))};_0x562412(_0x3c6d17['access_token']);})[_0xd4fa('0x2c')](function(_0x136d2c){logger['error'](_0xd4fa('0x2d'),_0x136d2c[_0xd4fa('0x2e')]);_0xbf7dcf(_0x136d2c);});});}function getUser(_0x1b16ba,_0x5345c4,_0x18d550,_0x12b723){logger['info'](_0xd4fa('0x2f'));return request({'method':_0xd4fa('0x30'),'uri':util['format'](_0xd4fa('0x31'),_0x5345c4),'qs':{'type':_0xd4fa('0x32')},'headers':{'Authorization':_0xd4fa('0x33')+_0x1b16ba},'json':!![]})[_0xd4fa('0x29')](function(_0x4490eb){if(_0x4490eb[_0xd4fa('0x34')]){var _0x1ce1e3=-0x1;if(_[_0xd4fa('0x35')](_0x4490eb['users'])){if(!_[_0xd4fa('0x36')](_0x12b723)){_0x1ce1e3=_[_0xd4fa('0x37')](_0x4490eb[_0xd4fa('0x34')],function(_0x3c982c){return _0x3c982c['email']===_0x12b723;});}if(_0x1ce1e3>=0x0){logger[_0xd4fa('0x38')](_0xd4fa('0x39'));}else{logger[_0xd4fa('0x38')](_0xd4fa('0x3a'));_0x1ce1e3=_['findIndex'](_0x4490eb['users'],function(_0x59f899){return _0x59f899['profile'][_0xd4fa('0x18')]===_0xd4fa('0x3b');});}return _0x4490eb['users'][_0x1ce1e3];}else{if(_0x4490eb['user']['profile']['name']===_0xd4fa('0x3b')){logger[_0xd4fa('0x38')]('Using\x20the\x20admin\x20account!');user=_0x4490eb[_0xd4fa('0x3c')];return user;}else{logger[_0xd4fa('0x3d')]('The\x20failing\x20result\x20is',JSON[_0xd4fa('0x3e')](_0x4490eb));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd4fa('0x3e')](_0x4490eb));}}}else{logger['error'](_0xd4fa('0x3f'),JSON[_0xd4fa('0x3e')](_0x4490eb));throw new Error(_0xd4fa('0x40')+JSON[_0xd4fa('0x3e')](_0x4490eb));}})[_0xd4fa('0x2c')](function(_0x54612c){console[_0xd4fa('0x3d')](_0x54612c);});}function getZohoUser(_0x43c5da,_0x3e0f5b){return new BPromise(function(_0x28bc55,_0xe7b22a){request(_0x43c5da)[_0xd4fa('0x29')](function(_0x4de01e){var _0x30e083=null;if(_0x4de01e){_0x30e083=_0x4de01e[_0xd4fa('0x41')][0x0];_0x30e083[_0xd4fa('0x42')]=_0x3e0f5b;}_0x28bc55(_0x30e083);})[_0xd4fa('0x2c')](function(_0x40fb31){_0xe7b22a(_0x40fb31);});});}function createEndUser(_0x5a3a9c,_0x4146a8,_0x4a039e,_0xdf7d0c,_0x32edea,_0x4c806d){var _0x4a039e=getName(_0x4a039e);return request({'method':'POST','uri':_0xd4fa('0x43')+_0x4146a8+_0xd4fa('0x44')+_[_0xd4fa('0x45')](_0x4c806d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4a039e[0x1],'First_Name':_0x4a039e[0x0],'Phone':_0xdf7d0c,'Owner':{'name':!_[_0xd4fa('0x36')](_0x32edea[_0xd4fa('0x46')][_0xd4fa('0x18')])?_0x32edea[_0xd4fa('0x46')]['name']:!_['isNil'](_0x32edea[_0xd4fa('0x47')])?_0x32edea[_0xd4fa('0x47')]+'\x20'+_0x32edea[_0xd4fa('0x48')]:_0x32edea[_0xd4fa('0x48')],'id':_0x32edea['id']}}]},'headers':{'Authorization':_0xd4fa('0x33')+_0x5a3a9c},'json':!![]})['then'](function(_0x2ac2a3){if(_0x2ac2a3&&_0x2ac2a3[_0xd4fa('0x41')][0x0][_0xd4fa('0x49')]===_0xd4fa('0x4a')){var _0xd59d99=_0x2ac2a3[_0xd4fa('0x41')][0x0][_0xd4fa('0x4b')];_0xd59d99['enduserType']=_[_0xd4fa('0x45')](_0x4c806d[_0xd4fa('0x4c')])+'s';return _0xd59d99;}logger[_0xd4fa('0x3d')](_0xd4fa('0x3f'),JSON['stringify'](data));throw new Error(_0xd4fa('0x4d')+JSON[_0xd4fa('0x3e')](data));})[_0xd4fa('0x2c')](function(_0xd1079b){console[_0xd4fa('0x4e')](_0xd4fa('0x4f'),_0xd1079b);});}function getEndUser(_0x1f6438,_0x2f6a19,_0x3dee6d,_0x6e88d6,_0x2745f0,_0x4427e4,_0x1e7408){var _0x39e402={'method':_0xd4fa('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1f6438},'json':!![]};switch(_0x1e7408[_0xd4fa('0x50')]){case _0xd4fa('0x51'):_0x39e402[_0xd4fa('0x52')]='https://www.zohoapis.'+_0x2f6a19+_0xd4fa('0x53')+_0x2745f0+'))';return getZohoUser(_0x39e402,_0xd4fa('0x54'))[_0xd4fa('0x29')](function(_0x48fdca){if(_0x48fdca)return _0x48fdca;_0x39e402['uri']=_0xd4fa('0x43')+_0x2f6a19+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2745f0+'))';return getZohoUser(_0x39e402,_0xd4fa('0x55'))['then'](function(_0x105120){if(_0x105120)return _0x105120;if(_0x1e7408['moduleCreate']!=_0xd4fa('0x56')){return createEndUser(_0x1f6438,_0x2f6a19,_0x6e88d6,_0x2745f0,_0x4427e4,_0x1e7408);}else{return{};}});});break;case _0xd4fa('0x57'):_0x39e402[_0xd4fa('0x52')]=_0xd4fa('0x43')+_0x2f6a19+_0xd4fa('0x53')+_0x2745f0+'))';return getZohoUser(_0x39e402,_0xd4fa('0x54'))['then'](function(_0x5e4044){if(_0x5e4044)return _0x5e4044;if(_0x1e7408[_0xd4fa('0x4c')]!=_0xd4fa('0x56')){return createEndUser(_0x1f6438,_0x2f6a19,_0x6e88d6,_0x2745f0,_0x4427e4,_0x1e7408);}else{return{};}});break;case _0xd4fa('0x58'):_0x39e402[_0xd4fa('0x52')]=_0xd4fa('0x43')+_0x2f6a19+_0xd4fa('0x59')+_0x2745f0+'))';return getZohoUser(_0x39e402,_0xd4fa('0x55'))[_0xd4fa('0x29')](function(_0x59da9b){if(_0x59da9b)return _0x59da9b;if(_0x1e7408[_0xd4fa('0x4c')]!=_0xd4fa('0x56')){return createEndUser(_0x1f6438,_0x2f6a19,_0x6e88d6,_0x2745f0,_0x4427e4,_0x1e7408);}else{return{};}});break;}}function getCall(_0x44c028,_0x1bf33b,_0xb29b3a,_0x3c87f9,_0xf52d1,_0x108c53,_0x2ced44,_0x185702){logger['info']('Creating\x20new\x20call...');var _0x329505={};_0x329505[_0xd4fa('0x5a')]={'name':!_['isNil'](_0x3c87f9[_0xd4fa('0x46')][_0xd4fa('0x18')])&&!_[_0xd4fa('0x36')](_0x3c87f9['profile']['name'])&&_0x3c87f9[_0xd4fa('0x5b')][_0xd4fa('0x18')]===_0xd4fa('0x5c')?_0x3c87f9[_0xd4fa('0x46')][_0xd4fa('0x18')]:!_[_0xd4fa('0x36')](_0x3c87f9[_0xd4fa('0x47')])?_0x3c87f9['first_name']+'\x20'+_0x3c87f9[_0xd4fa('0x48')]:_0x3c87f9[_0xd4fa('0x48')],'id':_0x3c87f9['id']};_0x329505[_0xd4fa('0x5d')]=intUtil[_0xd4fa('0x5e')](_0x108c53['Subjects'],_0x2ced44,'\x20');_0x329505[_0xd4fa('0x5f')]=intUtil[_0xd4fa('0x5e')](_0x108c53[_0xd4fa('0x60')],_0x2ced44,'\x0a');if(_0xf52d1[_0xd4fa('0x42')]===_0xd4fa('0x54')){_0x329505[_0xd4fa('0x61')]={'name':!_[_0xd4fa('0x36')](_0xf52d1[_0xd4fa('0x62')])?_0xf52d1['Full_Name']:!_['isNil'](_0xf52d1[_0xd4fa('0x63')])?_0xf52d1[_0xd4fa('0x63')]+'\x20'+_0xf52d1[_0xd4fa('0x64')]:_0xf52d1[_0xd4fa('0x64')],'id':_0xf52d1['id']};}if(_0xf52d1[_0xd4fa('0x42')]===_0xd4fa('0x55')){_0x329505[_0xd4fa('0x65')]={'name':!_[_0xd4fa('0x36')](_0xf52d1[_0xd4fa('0x62')])?_0xf52d1[_0xd4fa('0x62')]:!_[_0xd4fa('0x36')](_0xf52d1[_0xd4fa('0x63')])?_0xf52d1[_0xd4fa('0x63')]+'\x20'+_0xf52d1['Last_Name']:_0xf52d1['Last_Name'],'id':_0xf52d1['id']};_0x329505[_0xd4fa('0x66')]=_['startCase'](_0xf52d1[_0xd4fa('0x42')]);}if(_0x2ced44['talktime']){_0x329505[_0xd4fa('0x67')]=moment[_0xd4fa('0x68')](parseInt(_0x2ced44[_0xd4fa('0x69')])*0x3e8)['format'](_0xd4fa('0x6a'));}else if(_0x2ced44[_0xd4fa('0x6b')]&&_0x2ced44[_0xd4fa('0x6c')]){_0x329505[_0xd4fa('0x67')]=moment['utc'](moment(_0x2ced44[_0xd4fa('0x6c')],'YYYY-MM-DDTHH:mm:ss')[_0xd4fa('0x6d')](moment(_0x2ced44[_0xd4fa('0x6e')],_0xd4fa('0x6f'))))[_0xd4fa('0x70')](_0xd4fa('0x6a'));}switch(_0x2ced44[_0xd4fa('0x71')]){case _0xd4fa('0x72'):_0x329505['Call_Result']=_0xd4fa('0x73');break;case _0xd4fa('0x74'):case'connect':_0x329505[_0xd4fa('0x75')]='Answered';break;case _0xd4fa('0x76'):_0x329505['Call_Result']=_0xd4fa('0x77');break;case _0xd4fa('0x78'):_0x329505[_0xd4fa('0x75')]=_0xd4fa('0x79');break;case _0xd4fa('0x7a'):_0x329505['Call_Result']=_0xd4fa('0x7b');default:}_0x329505[_0xd4fa('0x7c')]=(_0x185702===_0xd4fa('0x7d')?moment(_0x2ced44[_0xd4fa('0x6e')])['format'](_0xd4fa('0x6f')):moment(_0x2ced44[_0xd4fa('0x7e')])[_0xd4fa('0x70')](_0xd4fa('0x6f')))||moment()[_0xd4fa('0x70')](_0xd4fa('0x6f'));_0x329505[_0xd4fa('0x7f')]=_0x185702||_0xd4fa('0x80');_0x329505=_[_0xd4fa('0x81')](_0x329505,getCustomFields(_0x108c53[_0xd4fa('0x82')],_0x2ced44));return request({'method':_0xd4fa('0x83'),'uri':_0xd4fa('0x43')+_0x1bf33b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x44c028},'body':{'data':[_0x329505]},'json':!![]})[_0xd4fa('0x29')](function(_0x109b1a){if(_0x109b1a&&_0x109b1a['data'][0x0][_0xd4fa('0x49')]==='SUCCESS'){logger['info'](_0xd4fa('0x84'));return{'id':_0x109b1a['data'][0x0][_0xd4fa('0x4b')]['id']};}})[_0xd4fa('0x2c')](function(_0x4b98d6){logger[_0xd4fa('0x38')](_0xd4fa('0x85'),_0x4b98d6[_0xd4fa('0x2e')]);console[_0xd4fa('0x4e')](_0xd4fa('0x85'),_0x4b98d6);});}exports[_0xd4fa('0x86')]=function(_0x1d238c,_0x312f7a,_0x45f96a,_0x2f2685,_0xf7db5b,_0x1e1296){var _0xb1be27,_0x4db827,_0x211cd7;_0x1e1296['host']=intUtil[_0xd4fa('0x87')](_0x1e1296['host']);_0x1e1296['serverUrl']=intUtil[_0xd4fa('0x87')](_0x1e1296[_0xd4fa('0x88')]);if(_0xf7db5b&&_0xf7db5b[_0xd4fa('0x89')]){logger[_0xd4fa('0x38')](_0xd4fa('0x8a'),_0xd4fa('0x8b'));_0x312f7a[_0xd4fa('0x8c')]=_0x1e1296[_0xd4fa('0x88')]+_0xd4fa('0x8d')+_0x312f7a[_0xd4fa('0x8e')]+_0xd4fa('0x8f')+md5(_0x312f7a[_0xd4fa('0x8e')]);}else{_0x312f7a[_0xd4fa('0x8c')]='';}var _0x100d13=_0x1e1296[_0xd4fa('0x90')]===_0xd4fa('0x91')?'eu':_0xd4fa('0x92');return getAccessToken(_0x1e1296)[_0xd4fa('0x29')](function(_0x2341ff){_0x211cd7=_0x2341ff;return getUser(_0x211cd7,_0x100d13,_0x1e1296,_0x2f2685[_0xd4fa('0x93')]);})[_0xd4fa('0x29')](function(_0x4f5ff7){_0xb1be27=_0x4f5ff7;logger['info'](_0xd4fa('0x94'),_0xb1be27['id']);return getEndUser(_0x211cd7,_0x100d13,_0x1e1296,_0x312f7a['calleridname'],_0x312f7a[_0xd4fa('0x95')],_0xb1be27,_0x45f96a);})['then'](function(_0x1267ab){_0x4db827=_0x1267ab;return getCall(_0x211cd7,_0x100d13,_0x1e1296,_0xb1be27,_0x4db827,_0x45f96a,_0x312f7a,_0xd4fa('0x80'));})[_0xd4fa('0x29')](function(_0x299221){if(_0x299221){logger['info']('The\x20Call\x20ID\x20is:',_0x299221['id']);logger[_0xd4fa('0x38')](_0xd4fa('0x8a'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd4fa('0x96'),_0x2f2685['name']),_0xd4fa('0x97'),{'uri':_0xd4fa('0x98')+_0x1e1296[_0xd4fa('0x90')]+_0xd4fa('0x99')+_0x299221['id']});}})[_0xd4fa('0x2c')](function(_0x591965){logger['error'](_0xd4fa('0x8a'),JSON[_0xd4fa('0x3e')](_0x591965));});};exports[_0xd4fa('0x7d')]=function(_0x3bd58b,_0x5190aa,_0x324faf,_0x2935cd,_0x4cfad7,_0x47bc81,_0x284b14){var _0x4a2f5b,_0x23e7a8,_0x446ee4;_0x47bc81[_0xd4fa('0x90')]=intUtil[_0xd4fa('0x87')](_0x47bc81[_0xd4fa('0x90')]);_0x47bc81[_0xd4fa('0x88')]=intUtil[_0xd4fa('0x87')](_0x47bc81['serverUrl']);if(_0x284b14&&_0x284b14['recordingFormat']&&_0x284b14['recordingFormat']!==_0xd4fa('0x9a')){logger[_0xd4fa('0x38')](_0xd4fa('0x9b'),_0xd4fa('0x8b'));_0x5190aa[_0xd4fa('0x8c')]=_0x47bc81[_0xd4fa('0x88')]+'/api/voice/recordings/'+_0x5190aa[_0xd4fa('0x8e')]+_0xd4fa('0x8f')+md5(_0x5190aa[_0xd4fa('0x8e')]);}var _0x3bca7b=_0x47bc81['host']===_0xd4fa('0x91')?'eu':_0xd4fa('0x92');return getAccessToken(_0x47bc81)[_0xd4fa('0x29')](function(_0x26c775){_0x446ee4=_0x26c775;return getUser(_0x446ee4,_0x3bca7b,_0x47bc81,_0x2935cd[_0xd4fa('0x93')]);})[_0xd4fa('0x29')](function(_0x2a283a){_0x4a2f5b=_0x2a283a;logger['info'](_0xd4fa('0x94'),_0x4a2f5b['id']);return getEndUser(_0x446ee4,_0x3bca7b,_0x47bc81,_0x5190aa[_0xd4fa('0x9c')],_0x5190aa[_0xd4fa('0x9d')],_0x4a2f5b,_0x324faf);})[_0xd4fa('0x29')](function(_0x1aa4ce){_0x23e7a8=_0x1aa4ce;return getCall(_0x446ee4,_0x3bca7b,_0x47bc81,_0x4a2f5b,_0x23e7a8,_0x324faf,_0x5190aa,_0xd4fa('0x9e'));})[_0xd4fa('0x29')](function(_0x3f9249){if(_0x3f9249){logger[_0xd4fa('0x38')]('The\x20Call\x20ID\x20is:',_0x3f9249['id']);logger['info'](_0xd4fa('0x9b'),_0xd4fa('0x9f'));emit(util[_0xd4fa('0x70')](_0xd4fa('0x96'),_0x2935cd[_0xd4fa('0x18')]),_0xd4fa('0x97'),{'uri':_0xd4fa('0x98')+_0x47bc81[_0xd4fa('0x90')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3f9249['id']});}})[_0xd4fa('0x2c')](function(_0x2b2690){logger[_0xd4fa('0x3d')]('[OUTBOUND]',JSON[_0xd4fa('0x3e')](_0x2b2690));});};exports['unmanaged']=function(_0x2e8b57,_0x2329a7,_0x13a1c9,_0x17d4d6,_0x4e330e,_0x503f5e){var _0x7b5e88,_0x3e231c,_0x5647b7;_0x503f5e[_0xd4fa('0x90')]=intUtil[_0xd4fa('0x87')](_0x503f5e[_0xd4fa('0x90')]);_0x503f5e[_0xd4fa('0x88')]=intUtil['stripTrailingSlash'](_0x503f5e[_0xd4fa('0x88')]);if(_0x4e330e&&_0x4e330e[_0xd4fa('0x89')]){logger[_0xd4fa('0x38')]('['+_0x2329a7[_0xd4fa('0x71')][_0xd4fa('0xa0')]()+']','Recording\x20is\x20enabled!');_0x2329a7['recordingURL']=_0x503f5e[_0xd4fa('0x88')]+_0xd4fa('0x8d')+_0x2329a7[_0xd4fa('0x8e')]+_0xd4fa('0x8f')+md5(_0x2329a7[_0xd4fa('0x8e')]);}else{_0x2329a7['recordingURL']='';}var _0x4e78dc=_0x503f5e['host']===_0xd4fa('0x91')?'eu':_0xd4fa('0x92');return getAccessToken(_0x503f5e)[_0xd4fa('0x29')](function(_0xfb935a){_0x5647b7=_0xfb935a;return getUser(_0x5647b7,_0x4e78dc,_0x503f5e);})[_0xd4fa('0x29')](function(_0x53a8df){_0x7b5e88=_0x53a8df;logger[_0xd4fa('0x38')](_0xd4fa('0x94'),_0x7b5e88['id']);return getEndUser(_0x5647b7,_0x4e78dc,_0x503f5e,_0x2329a7['calleridname'],_0x2329a7['calleridnum'],_0x7b5e88,_0x13a1c9);})['then'](function(_0x4e2d77){_0x3e231c=_0x4e2d77;return getCall(_0x5647b7,_0x4e78dc,_0x503f5e,_0x7b5e88,_0x3e231c,_0x13a1c9,_0x2329a7,_0xd4fa('0x80'));})['then'](function(_0x3f1099){if(_0x3f1099){logger[_0xd4fa('0x38')](_0xd4fa('0xa1'),_0x3f1099['id']);}})[_0xd4fa('0x2c')](function(_0x4c2301){logger['error']('['+_0x2329a7[_0xd4fa('0x71')][_0xd4fa('0xa0')]()+']',JSON[_0xd4fa('0x3e')](_0x4c2301));});}; \ 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 f182ac5..284ebd5 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(_0x168170,_0x1f8514){var _0x301582=function(_0x1767c8){while(--_0x1767c8){_0x168170['push'](_0x168170['shift']());}};_0x301582(++_0x1f8514);}(_0x7a54,0x106));var _0x47a5=function(_0xaf0f44,_0x1849ee){_0xaf0f44=_0xaf0f44-0x0;var _0x2df32c=_0x7a54[_0xaf0f44];return _0x2df32c;};'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(_0x19b0e4,_0x41bb69){var _0x1033b6=function(_0x107941){while(--_0x107941){_0x19b0e4['push'](_0x19b0e4['shift']());}};_0x1033b6(++_0x41bb69);}(_0x7a54,0x106));var _0x47a5=function(_0x1dc217,_0x489767){_0x1dc217=_0x1dc217-0x0;var _0x130715=_0x7a54[_0x1dc217];return _0x130715;};'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 72a0ad6..862ba4a 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x57b6bb,_0x4f1ea6){var _0x39a128=function(_0x256c29){while(--_0x256c29){_0x57b6bb['push'](_0x57b6bb['shift']());}};_0x39a128(++_0x4f1ea6);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xb10b[_0x5e1e25];return _0x548e5f;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x1576bd,_0x5f48d7){var _0x5e4d38=function(_0x4fe592){while(--_0x4fe592){_0x1576bd['push'](_0x1576bd['shift']());}};_0x5e4d38(++_0x5f48d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fce61,_0x1d3cff){_0x3fce61=_0x3fce61-0x0;var _0x2b835b=_0x5f2f[_0x3fce61];return _0x2b835b;};'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 2de8bc2..31a899b 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 _0x49fe=['routing','message','result','exports','jayson/promise','bluebird','../../config/logger','http','then','debug','rpc','error'];(function(_0x3144ec,_0x10259d){var _0x26a508=function(_0xe91eba){while(--_0xe91eba){_0x3144ec['push'](_0x3144ec['shift']());}};_0x26a508(++_0x10259d);}(_0x49fe,0x100));var _0xe49f=function(_0x3d76d6,_0x4625d9){_0x3d76d6=_0x3d76d6-0x0;var _0x1f6a18=_0x49fe[_0x3d76d6];return _0x1f6a18;};'use strict';var jayson=require(_0xe49f('0x0'));var BPromise=require(_0xe49f('0x1'));var logger=require(_0xe49f('0x2'))('routing');var client=jayson['client'][_0xe49f('0x3')]({'port':0x2329});client['Request']=function(_0x195bcf,_0x199a0b){return new BPromise(function(_0xb0e197,_0x43c119){return client['request'](_0x195bcf,_0x199a0b)[_0xe49f('0x4')](function(_0x51fe70){logger[_0xe49f('0x5')](_0xe49f('0x6'),'routing',_0x195bcf,_0x199a0b,_0x51fe70);if(_0x51fe70[_0xe49f('0x7')]){logger[_0xe49f('0x7')](_0xe49f('0x6'),_0xe49f('0x8'),_0x195bcf,_0x51fe70[_0xe49f('0x7')]['message'],_0x199a0b);return _0x43c119(_0x51fe70['error'][_0xe49f('0x9')]);}else{return _0xb0e197(_0x51fe70[_0xe49f('0xa')]);}})['catch'](function(_0x51be71){logger[_0xe49f('0x7')](_0xe49f('0x6'),_0xe49f('0x8'),_0x195bcf,_0x51be71,_0x199a0b);return _0x43c119(_0x51be71);});});};module[_0xe49f('0xb')]=client; \ No newline at end of file +var _0xdd0c=['http','request','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger','routing'];(function(_0x27af08,_0x192c31){var _0x49eb8e=function(_0x249b6b){while(--_0x249b6b){_0x27af08['push'](_0x27af08['shift']());}};_0x49eb8e(++_0x192c31);}(_0xdd0c,0x165));var _0xcdd0=function(_0x4c27ba,_0x3d1779){_0x4c27ba=_0x4c27ba-0x0;var _0x1b2173=_0xdd0c[_0x4c27ba];return _0x1b2173;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var client=jayson['client'][_0xcdd0('0x3')]({'port':0x2329});client['Request']=function(_0x3d8684,_0x159e38){return new BPromise(function(_0x432716,_0x354e5f){return client[_0xcdd0('0x4')](_0x3d8684,_0x159e38)['then'](function(_0x2b33fc){logger[_0xcdd0('0x5')](_0xcdd0('0x6'),_0xcdd0('0x2'),_0x3d8684,_0x159e38,_0x2b33fc);if(_0x2b33fc[_0xcdd0('0x7')]){logger['error'](_0xcdd0('0x6'),'routing',_0x3d8684,_0x2b33fc['error'][_0xcdd0('0x8')],_0x159e38);return _0x354e5f(_0x2b33fc[_0xcdd0('0x7')][_0xcdd0('0x8')]);}else{return _0x432716(_0x2b33fc[_0xcdd0('0x9')]);}})[_0xcdd0('0xa')](function(_0x460fce){logger[_0xcdd0('0x7')](_0xcdd0('0x6'),_0xcdd0('0x2'),_0x3d8684,_0x460fce,_0x159e38);return _0x354e5f(_0x460fce);});});};module[_0xcdd0('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8e19eca..4d7a40e 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 _0x8085=['catch','bluebird','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x8085,0x71));var _0x5808=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8085[_0x2283dc];return _0x16db90;};'use strict';var BPromise=require(_0x5808('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x5808('0x1'));var mailAccount=require(_0x5808('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5808('0x3'))['db'];function initRealtime(){return BPromise[_0x5808('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x5808('0x5')](realtime[_0x5808('0x6')]())['then'](function(){email[_0x5808('0x7')](realtime[_0x5808('0x8')]);return realtime;});}function main(){return server[_0x5808('0x9')](realtime,email)[_0x5808('0x5')](function(_0x2a9716){return initRealtime();})[_0x5808('0x5')](function(_0x30e63c){return db[_0x5808('0xa')][_0x5808('0xb')]({'attributes':['id',_0x5808('0xc')],'raw':!![]});})[_0x5808('0x5')](function(_0x422c41){return setInterval(initRealtime,_0x422c41[_0x5808('0xc')]*0x3e8);})[_0x5808('0xd')](function(_0x16d194){console['log'](_0x16d194);});}main(); \ No newline at end of file +var _0x49fe=['Setting','findOne','loginMailFrequency','catch','bluebird','./server','./realtime','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0xef95ec,_0x29b82c){var _0x4f6d75=function(_0x31de2e){while(--_0x31de2e){_0xef95ec['push'](_0xef95ec['shift']());}};_0x4f6d75(++_0x29b82c);}(_0x49fe,0x100));var _0xe49f=function(_0x42ed0b,_0xaa7f0b){_0x42ed0b=_0x42ed0b-0x0;var _0x51b4a6=_0x49fe[_0x42ed0b];return _0x51b4a6;};'use strict';var BPromise=require(_0xe49f('0x0'));var server=require(_0xe49f('0x1'));var Realtime=require(_0xe49f('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xe49f('0x3'))['db'];function initRealtime(){return BPromise['resolve']()[_0xe49f('0x4')](mailAccount[_0xe49f('0x5')]())[_0xe49f('0x4')](realtime[_0xe49f('0x6')]())['then'](function(){email[_0xe49f('0x7')](realtime[_0xe49f('0x8')]);return realtime;});}function main(){return server[_0xe49f('0x9')](realtime,email)[_0xe49f('0x4')](function(_0x4f9b1f){return initRealtime();})[_0xe49f('0x4')](function(_0x18f791){return db[_0xe49f('0xa')][_0xe49f('0xb')]({'attributes':['id',_0xe49f('0xc')],'raw':!![]});})['then'](function(_0x581b52){return setInterval(initRealtime,_0x581b52[_0xe49f('0xc')]*0x3e8);})[_0xe49f('0xd')](function(_0x5ef2aa){console['log'](_0x5ef2aa);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0026392..302ac27 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 _0x2081=['hasOwnProperty','active','handleImapBox','email','handleImapEmail','bind','end','handleImapEnd','error','disabled','messageStatus','prototype','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','Imap','status','total','isNil','stringify','emit','mailAccount:update','refresh'];(function(_0x127ae8,_0x78f7f5){var _0x36a731=function(_0x545c4b){while(--_0x545c4b){_0x127ae8['push'](_0x127ae8['shift']());}};_0x36a731(++_0x78f7f5);}(_0x2081,0xc4));var _0x1208=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x2081[_0x575057];return _0x49dbc8;};'use strict';var _=require(_0x1208('0x0'));var moment=require(_0x1208('0x1'));var BPromise=require(_0x1208('0x2'));var md5=require(_0x1208('0x3'));var Redis=require(_0x1208('0x4'));var config=require(_0x1208('0x5'));var logger=require('../../../config/logger')('email');config[_0x1208('0x6')]=_[_0x1208('0x7')](config['redis'],{'host':_0x1208('0x8'),'port':0x18eb});var io=require(_0x1208('0x9'))(new Redis(config[_0x1208('0x6')]));var EmailImap=require(_0x1208('0xa'));var EmailSmtp=require(_0x1208('0xb'));var mailAccount=require(_0x1208('0xc'));var md5Accounts={};function EmailChannel(_0x1a4729){logger[_0x1208('0xd')](_0x1208('0xe'));this[_0x1208('0xf')]=_0x1a4729[_0x1208('0xf')];this[_0x1208('0x10')]={};this[_0x1208('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x1922ef){var _0x44ff54=this[_0x1208('0xf')][_0x1922ef];var _0xcbeba7={'id':_0x44ff54['id'],'name':_0x44ff54[_0x1208('0x12')],'key':_0x44ff54[_0x1208('0x13')],'active':_0x44ff54['active'],'Imap':{'status':_0x44ff54[_0x1208('0x14')][_0x1208('0x15')],'messageStatus':_0x44ff54[_0x1208('0x14')]['messageStatus'],'total':_0x44ff54[_0x1208('0x14')][_0x1208('0x16')]}};if(_[_0x1208('0x17')](md5Accounts[_0x1922ef])){md5Accounts[_0x1922ef]={};}var _0x107a52=md5(JSON[_0x1208('0x18')](_0xcbeba7));if(md5Accounts[_0x1922ef][_0x1208('0x3')]!==_0x107a52){md5Accounts[_0x1922ef][_0x1208('0x3')]=_0x107a52;io[_0x1208('0x19')](_0x1208('0x1a'),_0xcbeba7);}};EmailChannel['prototype'][_0x1208('0x1b')]=function(_0x281c91){for(var _0x2fdacc in _0x281c91){if(_0x281c91[_0x1208('0x1c')](_0x2fdacc)){if(_0x281c91[_0x2fdacc]['Imap']&&_0x281c91[_0x2fdacc][_0x1208('0x1d')]){var _0x87326=_0x281c91[_0x2fdacc]['Imap'];if(!this[_0x1208('0x10')][_0x1208('0x1c')](_0x87326['id'])){this[_0x1208('0x10')][_0x87326['id']]=new EmailImap(_0x87326,_0x281c91[_0x2fdacc]['email']);this[_0x1208('0x10')][_0x87326['id']]['on']('box',this[_0x1208('0x1e')]['bind'](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x1f'),this[_0x1208('0x20')][_0x1208('0x21')](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x22'),this[_0x1208('0x23')][_0x1208('0x21')](this,_0x2fdacc));this[_0x1208('0x10')][_0x87326['id']]['on'](_0x1208('0x24'),this['handleImapError'][_0x1208('0x21')](this,_0x2fdacc));}}else{if(_[_0x1208('0x17')](this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')])){this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')]={};}this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')][_0x1208('0x15')]=_0x1208('0x25');this[_0x1208('0xf')][_0x2fdacc][_0x1208('0x14')][_0x1208('0x26')]='';this['emit'](_0x2fdacc);}}}};EmailChannel[_0x1208('0x27')][_0x1208('0x1e')]=function(_0x1aeaa0,_0x453a6d){if(this[_0x1208('0xf')][_0x1aeaa0]){this[_0x1208('0xf')][_0x1aeaa0][_0x1208('0x14')][_0x1208('0x15')]=_0x1208('0x28');this['mailAccounts'][_0x1aeaa0][_0x1208('0x14')][_0x1208('0x26')]=_0x453a6d[_0x1208('0x12')];if(_0x453a6d[_0x1208('0x29')]){this[_0x1208('0xf')][_0x1aeaa0][_0x1208('0x14')]['total']=_0x453a6d[_0x1208('0x29')][_0x1208('0x16')];}return this[_0x1208('0x19')](_0x1aeaa0);}};EmailChannel['prototype'][_0x1208('0x20')]=function(_0x2a8d64,_0xa06c73){logger[_0x1208('0xd')](_0x1208('0x2a'),_0xa06c73[_0x1208('0x2b')],_0xa06c73['lastName'],_0xa06c73[_0x1208('0x2c')],_0x2a8d64);if(this[_0x1208('0xf')][_0x2a8d64]){return mailAccount[_0x1208('0x2d')](_0x2a8d64,_0xa06c73)[_0x1208('0x2e')](function(_0x41142a){if(_0x41142a){logger[_0x1208('0xd')](_0x1208('0x2f'));}})[_0x1208('0x30')](function(_0x1b4282){logger[_0x1208('0x24')](_0x1208('0x31'),JSON[_0x1208('0x18')](_0x1b4282));});}};EmailChannel['prototype'][_0x1208('0x23')]=function(_0x25e141){if(this[_0x1208('0xf')][_0x25e141]&&this['mailAccounts'][_0x25e141]['Imap']){if(this['imapAccounts'][this[_0x1208('0xf')][_0x25e141][_0x1208('0x14')]['id']]){delete this[_0x1208('0x10')][this[_0x1208('0xf')][_0x25e141][_0x1208('0x14')]['id']];}this['mailAccounts'][_0x25e141][_0x1208('0x14')][_0x1208('0x32')]=moment();this[_0x1208('0x19')](_0x25e141);}};EmailChannel[_0x1208('0x27')]['handleImapError']=function(_0x5ef5a7,_0x4d56a8){if(this['mailAccounts'][_0x5ef5a7]){this[_0x1208('0xf')][_0x5ef5a7][_0x1208('0x14')][_0x1208('0x15')]='error';this[_0x1208('0xf')][_0x5ef5a7]['Imap']['messageStatus']=_0x4d56a8;return this[_0x1208('0x19')](_0x5ef5a7);}};EmailChannel[_0x1208('0x27')][_0x1208('0x33')]=function(_0x3eaddf,_0x554ee1){return this['smtp']['send'](_0x3eaddf,_0x554ee1);};EmailChannel[_0x1208('0x27')][_0x1208('0x34')]=function(_0x1e8f5b){var _0x56efe3=this;if(this[_0x1208('0xf')][_0x1e8f5b['id']]){if(_[_0x1208('0x17')](this['mailAccounts'][_0x1e8f5b['id']]['Smtp'])){this['mailAccounts'][_0x1e8f5b['id']][_0x1208('0x35')]={};}this[_0x1208('0xf')][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x32')]=moment();return new BPromise(function(_0xf4419a,_0x4741b9){return _0x56efe3[_0x1208('0x11')][_0x1208('0x36')](_0x1e8f5b)[_0x1208('0x2e')](function(_0x38d408){_0x56efe3['mailAccounts'][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x15')]='verified';_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']]['Smtp'][_0x1208('0x26')]='';_0x56efe3['emit'](_0x1e8f5b['id']);_0xf4419a(_0x38d408);})[_0x1208('0x30')](function(_0xbe0474){_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']]['Smtp'][_0x1208('0x15')]=_0x1208('0x24');_0x56efe3[_0x1208('0xf')][_0x1e8f5b['id']][_0x1208('0x35')][_0x1208('0x26')]=_0xbe0474;_0x56efe3[_0x1208('0x19')](_0x1e8f5b['id']);_0x4741b9(_0xbe0474);});});}return this[_0x1208('0x11')][_0x1208('0x36')](_0x1e8f5b);};module[_0x1208('0x37')]=EmailChannel; \ No newline at end of file +var _0x78f6=['moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','smtp','prototype','emit','mailAccounts','name','key','active','Imap','status','messageStatus','isNil','stringify','refresh','hasOwnProperty','imapAccounts','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','Smtp','verify','verified','catch','exports'];(function(_0x5df9cc,_0x5c7445){var _0x472d6a=function(_0x236aae){while(--_0x236aae){_0x5df9cc['push'](_0x5df9cc['shift']());}};_0x472d6a(++_0x5c7445);}(_0x78f6,0x138));var _0x678f=function(_0x351271,_0xba13a8){_0x351271=_0x351271-0x0;var _0x36e9c1=_0x78f6[_0x351271];return _0x36e9c1;};'use strict';var _=require('lodash');var moment=require(_0x678f('0x0'));var BPromise=require(_0x678f('0x1'));var md5=require(_0x678f('0x2'));var Redis=require(_0x678f('0x3'));var config=require('../../../config/environment');var logger=require(_0x678f('0x4'))(_0x678f('0x5'));config[_0x678f('0x6')]=_[_0x678f('0x7')](config[_0x678f('0x6')],{'host':_0x678f('0x8'),'port':0x18eb});var io=require(_0x678f('0x9'))(new Redis(config[_0x678f('0x6')]));var EmailImap=require(_0x678f('0xa'));var EmailSmtp=require(_0x678f('0xb'));var mailAccount=require(_0x678f('0xc'));var md5Accounts={};function EmailChannel(_0x27e526){logger[_0x678f('0xd')]('start\x20email\x20channel');this['mailAccounts']=_0x27e526['mailAccounts'];this['imapAccounts']={};this[_0x678f('0xe')]=new EmailSmtp();}EmailChannel[_0x678f('0xf')][_0x678f('0x10')]=function(_0x74f731){var _0x5d2b31=this[_0x678f('0x11')][_0x74f731];var _0x50f8ab={'id':_0x5d2b31['id'],'name':_0x5d2b31[_0x678f('0x12')],'key':_0x5d2b31[_0x678f('0x13')],'active':_0x5d2b31[_0x678f('0x14')],'Imap':{'status':_0x5d2b31[_0x678f('0x15')][_0x678f('0x16')],'messageStatus':_0x5d2b31[_0x678f('0x15')][_0x678f('0x17')],'total':_0x5d2b31[_0x678f('0x15')]['total']}};if(_[_0x678f('0x18')](md5Accounts[_0x74f731])){md5Accounts[_0x74f731]={};}var _0x21266=md5(JSON[_0x678f('0x19')](_0x50f8ab));if(md5Accounts[_0x74f731]['md5']!==_0x21266){md5Accounts[_0x74f731]['md5']=_0x21266;io['emit']('mailAccount:update',_0x50f8ab);}};EmailChannel[_0x678f('0xf')][_0x678f('0x1a')]=function(_0x370114){for(var _0x110d53 in _0x370114){if(_0x370114[_0x678f('0x1b')](_0x110d53)){if(_0x370114[_0x110d53]['Imap']&&_0x370114[_0x110d53][_0x678f('0x14')]){var _0x504e37=_0x370114[_0x110d53][_0x678f('0x15')];if(!this[_0x678f('0x1c')][_0x678f('0x1b')](_0x504e37['id'])){this['imapAccounts'][_0x504e37['id']]=new EmailImap(_0x504e37,_0x370114[_0x110d53][_0x678f('0x5')]);this[_0x678f('0x1c')][_0x504e37['id']]['on'](_0x678f('0x1d'),this['handleImapBox']['bind'](this,_0x110d53));this[_0x678f('0x1c')][_0x504e37['id']]['on'](_0x678f('0x5'),this[_0x678f('0x1e')][_0x678f('0x1f')](this,_0x110d53));this[_0x678f('0x1c')][_0x504e37['id']]['on'](_0x678f('0x20'),this[_0x678f('0x21')]['bind'](this,_0x110d53));this[_0x678f('0x1c')][_0x504e37['id']]['on'](_0x678f('0x22'),this[_0x678f('0x23')]['bind'](this,_0x110d53));}}else{if(_[_0x678f('0x18')](this[_0x678f('0x11')][_0x110d53]['Imap'])){this['mailAccounts'][_0x110d53][_0x678f('0x15')]={};}this['mailAccounts'][_0x110d53][_0x678f('0x15')][_0x678f('0x16')]=_0x678f('0x24');this['mailAccounts'][_0x110d53][_0x678f('0x15')][_0x678f('0x17')]='';this[_0x678f('0x10')](_0x110d53);}}}};EmailChannel[_0x678f('0xf')][_0x678f('0x25')]=function(_0x231658,_0x5bef0a){if(this[_0x678f('0x11')][_0x231658]){this['mailAccounts'][_0x231658][_0x678f('0x15')][_0x678f('0x16')]=_0x678f('0x26');this[_0x678f('0x11')][_0x231658][_0x678f('0x15')][_0x678f('0x17')]=_0x5bef0a['name'];if(_0x5bef0a['messages']){this[_0x678f('0x11')][_0x231658][_0x678f('0x15')][_0x678f('0x27')]=_0x5bef0a['messages'][_0x678f('0x27')];}return this['emit'](_0x231658);}};EmailChannel['prototype'][_0x678f('0x1e')]=function(_0x20a0aa,_0x5f4126){logger[_0x678f('0xd')](_0x678f('0x28'),_0x5f4126['firstName'],_0x5f4126['lastName'],_0x5f4126[_0x678f('0x29')],_0x20a0aa);if(this[_0x678f('0x11')][_0x20a0aa]){return mailAccount[_0x678f('0x2a')](_0x20a0aa,_0x5f4126)[_0x678f('0x2b')](function(_0x1b0342){if(_0x1b0342){logger[_0x678f('0xd')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x42ea4a){logger[_0x678f('0x22')](_0x678f('0x2c'),JSON['stringify'](_0x42ea4a));});}};EmailChannel[_0x678f('0xf')][_0x678f('0x21')]=function(_0x1f1ce8){if(this[_0x678f('0x11')][_0x1f1ce8]&&this[_0x678f('0x11')][_0x1f1ce8]['Imap']){if(this[_0x678f('0x1c')][this[_0x678f('0x11')][_0x1f1ce8][_0x678f('0x15')]['id']]){delete this[_0x678f('0x1c')][this[_0x678f('0x11')][_0x1f1ce8][_0x678f('0x15')]['id']];}this[_0x678f('0x11')][_0x1f1ce8][_0x678f('0x15')]['lastSync']=moment();this[_0x678f('0x10')](_0x1f1ce8);}};EmailChannel[_0x678f('0xf')][_0x678f('0x23')]=function(_0x4db819,_0x5a71c6){if(this['mailAccounts'][_0x4db819]){this[_0x678f('0x11')][_0x4db819][_0x678f('0x15')][_0x678f('0x16')]=_0x678f('0x22');this[_0x678f('0x11')][_0x4db819][_0x678f('0x15')][_0x678f('0x17')]=_0x5a71c6;return this[_0x678f('0x10')](_0x4db819);}};EmailChannel[_0x678f('0xf')][_0x678f('0x2d')]=function(_0x3c6d4b,_0x3331fc){return this[_0x678f('0xe')][_0x678f('0x2e')](_0x3c6d4b,_0x3331fc);};EmailChannel[_0x678f('0xf')]['verifySmtp']=function(_0x25d425){var _0x2d913a=this;if(this[_0x678f('0x11')][_0x25d425['id']]){if(_[_0x678f('0x18')](this['mailAccounts'][_0x25d425['id']][_0x678f('0x2f')])){this['mailAccounts'][_0x25d425['id']][_0x678f('0x2f')]={};}this[_0x678f('0x11')][_0x25d425['id']][_0x678f('0x2f')]['lastSync']=moment();return new BPromise(function(_0x43d527,_0x4327b0){return _0x2d913a[_0x678f('0xe')][_0x678f('0x30')](_0x25d425)[_0x678f('0x2b')](function(_0x1c24e9){_0x2d913a[_0x678f('0x11')][_0x25d425['id']][_0x678f('0x2f')][_0x678f('0x16')]=_0x678f('0x31');_0x2d913a[_0x678f('0x11')][_0x25d425['id']][_0x678f('0x2f')]['messageStatus']='';_0x2d913a[_0x678f('0x10')](_0x25d425['id']);_0x43d527(_0x1c24e9);})[_0x678f('0x32')](function(_0x360528){_0x2d913a[_0x678f('0x11')][_0x25d425['id']]['Smtp'][_0x678f('0x16')]='error';_0x2d913a[_0x678f('0x11')][_0x25d425['id']][_0x678f('0x2f')][_0x678f('0x17')]=_0x360528;_0x2d913a[_0x678f('0x10')](_0x25d425['id']);_0x4327b0(_0x360528);});});}return this[_0x678f('0xe')]['verify'](_0x25d425);};module[_0x678f('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index acbc2f3..a5f0224 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 _0x2a4f=['length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','emit','textCode','hasOwnProperty','upperFirst','exports','path','imap','lodash','mailparser','iconv','events','./utils','../../../config/logger','email','INBOX','getAccount','ready','handleReady','once','end','handleEnd','handleError','bind','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','openBox','handleOpenBox','box','readUnseen','search','handleReadUnseen'];(function(_0x2d6138,_0x219734){var _0x55eb00=function(_0xff8f6){while(--_0xff8f6){_0x2d6138['push'](_0x2d6138['shift']());}};_0x55eb00(++_0x219734);}(_0x2a4f,0xfd));var _0xf2a4=function(_0x43037d,_0x36c76f){_0x43037d=_0x43037d-0x0;var _0x13d7e6=_0x2a4f[_0x43037d];return _0x13d7e6;};'use strict';var fs=require('fs');var path=require(_0xf2a4('0x0'));var util=require('util');var Imap=require(_0xf2a4('0x1'));var _=require(_0xf2a4('0x2'));var rs=require('randomstring');var simpleParser=require(_0xf2a4('0x3'))['simpleParser'];var Iconv=require(_0xf2a4('0x4'))['Iconv'];var EventEmitter=require(_0xf2a4('0x5'))['EventEmitter'];var utils=require(_0xf2a4('0x6'));var logger=require(_0xf2a4('0x7'))(_0xf2a4('0x8'));function EmailImap(_0x3d7cfc,_0x5bb1f1){this['mailbox']=_0xf2a4('0x9');this['account']=this[_0xf2a4('0xa')](_0x3d7cfc,_0x5bb1f1);this[_0xf2a4('0x1')]=new Imap(this['account']);this[_0xf2a4('0x1')]['once'](_0xf2a4('0xb'),this[_0xf2a4('0xc')]['bind'](this));this[_0xf2a4('0x1')][_0xf2a4('0xd')](_0xf2a4('0xe'),this[_0xf2a4('0xf')]['bind'](this));this[_0xf2a4('0x1')]['on']('error',this[_0xf2a4('0x10')][_0xf2a4('0x11')](this));this[_0xf2a4('0x1')][_0xf2a4('0x12')]();}util[_0xf2a4('0x13')](EmailImap,EventEmitter);EmailImap[_0xf2a4('0x14')][_0xf2a4('0xa')]=function(_0x4e67a7,_0x5da05e){var _0x523a1c={'connTimeout':_0x4e67a7[_0xf2a4('0x15')]?_0x4e67a7['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4e67a7[_0xf2a4('0x16')]?_0x4e67a7[_0xf2a4('0x16')]*0x3e8:0x1388};if(_[_0xf2a4('0x17')](_0x4e67a7[_0xf2a4('0x18')])){if(_0x4e67a7['authentication']){_0x523a1c[_0xf2a4('0x19')]=_0x4e67a7[_0xf2a4('0x19')];_0x523a1c[_0xf2a4('0x1a')]=_0x4e67a7[_0xf2a4('0x1a')];}_0x523a1c[_0xf2a4('0x1b')]=_0x4e67a7['host'];_0x523a1c[_0xf2a4('0x1c')]=_0x4e67a7[_0xf2a4('0x1c')]||0x3e1;if(_0x4e67a7[_0xf2a4('0x1d')]){_0x523a1c['tls']=!![];}else{_0x523a1c[_0xf2a4('0x1d')]=![];_0x523a1c[_0xf2a4('0x1e')]='required';}}else{_0x523a1c[_0xf2a4('0x19')]=_0x4e67a7[_0xf2a4('0x19')];_0x523a1c[_0xf2a4('0x1a')]=_0x4e67a7[_0xf2a4('0x1a')];_0x523a1c[_0xf2a4('0x1b')]=utils['getHost'](_0x4e67a7[_0xf2a4('0x18')]);_0x523a1c[_0xf2a4('0x1c')]=0x3e1;_0x523a1c[_0xf2a4('0x1d')]=!![];}_0x523a1c[_0xf2a4('0x8')]=_0x5da05e||_0x4e67a7['user']||'anonymous@xcally.com';return _0x523a1c;};EmailImap[_0xf2a4('0x14')][_0xf2a4('0xc')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x1f')](this['mailbox'],![],this[_0xf2a4('0x20')][_0xf2a4('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x5f6f21,_0x3665b4){if(_0x5f6f21){this[_0xf2a4('0x10')](_0x5f6f21,!![]);}else{this['emit'](_0xf2a4('0x21'),_0x3665b4);this['readUnseen']();}};EmailImap[_0xf2a4('0x14')]['handleCloseBox']=function(_0x1d4fd1){if(_0x1d4fd1){this[_0xf2a4('0x10')](_0x1d4fd1,!![]);}else{this[_0xf2a4('0x1')][_0xf2a4('0xe')]();}};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x22')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x23')](['UNSEEN'],this[_0xf2a4('0x24')]['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x24')]=function(_0xf25c0f,_0x43f4b4){if(_0xf25c0f){this[_0xf2a4('0x10')](_0xf25c0f,!![]);}else{if(_0x43f4b4[_0xf2a4('0x25')]){try{var _0x50adeb=this['imap'][_0xf2a4('0x26')](_0x43f4b4,{'bodies':'','markSeen':!![]});_0x50adeb['on'](_0xf2a4('0x27'),this[_0xf2a4('0x28')][_0xf2a4('0x11')](this));_0x50adeb['once']('error',this[_0xf2a4('0x29')][_0xf2a4('0x11')](this));_0x50adeb['once']('end',this[_0xf2a4('0x2a')]['bind'](this));}catch(_0x80bc67){logger[_0xf2a4('0x2b')](_0x80bc67);}}else{this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this[_0xf2a4('0x2d')]['bind'](this));}}};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x28')]=function(_0x429e37,_0x4a7a64){_0x429e37['on']('body',this[_0xf2a4('0x2e')][_0xf2a4('0x11')](this));_0x429e37['once'](_0xf2a4('0x2f'),this[_0xf2a4('0x30')][_0xf2a4('0x11')](this));_0x429e37[_0xf2a4('0xd')](_0xf2a4('0xe'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x2e')]=function(_0x35f65b,_0x28a881){simpleParser(_0x35f65b,{'Iconv':Iconv},this[_0xf2a4('0x31')][_0xf2a4('0x11')](this));};EmailImap[_0xf2a4('0x14')]['handleMessageAttributes']=function(_0x2c99df){};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x32')]=function(){};EmailImap[_0xf2a4('0x14')]['handleSimpleParser']=function(_0x27b3e8,_0xbf61f9){if(_0x27b3e8){logger[_0xf2a4('0x2b')](_0x27b3e8);}else{var _0x466d9d=this;utils[_0xf2a4('0x33')](this[_0xf2a4('0x34')],_0xbf61f9,function(_0x5ec2b4){_0x466d9d['emit'](_0xf2a4('0x8'),_0x5ec2b4);});}};EmailImap['prototype'][_0xf2a4('0x2a')]=function(){this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this['handleCloseBox'][_0xf2a4('0x11')](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0x29')]=function(_0x1bb4f1){this[_0xf2a4('0x10')](_0x1bb4f1);this[_0xf2a4('0x1')][_0xf2a4('0x2c')](!![],this[_0xf2a4('0x2d')]['bind'](this));};EmailImap[_0xf2a4('0x14')][_0xf2a4('0xf')]=function(){this[_0xf2a4('0x35')]('end');};EmailImap['prototype'][_0xf2a4('0x10')]=function(_0x62eb18,_0x2840e1){logger[_0xf2a4('0x2b')]('handleError',this[_0xf2a4('0x34')]['email'],JSON['stringify'](_0x62eb18));var _0x3e9d79='';if(_0x62eb18){if(_0x62eb18[_0xf2a4('0x36')]){_0x3e9d79=_0x62eb18[_0xf2a4('0x36')];}else{for(var _0x1a6834 in _0x62eb18){if(_0x62eb18[_0xf2a4('0x37')](_0x1a6834)){_0x3e9d79+=_[_0xf2a4('0x38')](_0x1a6834)+':\x20'+_0x62eb18[_0x1a6834]+'\x0a';}}}}if(_0x2840e1){this[_0xf2a4('0x1')][_0xf2a4('0xe')]();}else{this[_0xf2a4('0x35')](_0xf2a4('0x2b'),_0x3e9d79);this[_0xf2a4('0x35')]('end');}};module[_0xf2a4('0x39')]=EmailImap; \ No newline at end of file +var _0x9d90=['readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleCloseBox','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','ready','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','connTimeout','isNil','service','authentication','user','password','host','port','tls','required','anonymous@xcally.com','handleOpenBox','emit','box'];(function(_0x18ea90,_0x4f90f3){var _0x8e1813=function(_0x21aea6){while(--_0x21aea6){_0x18ea90['push'](_0x18ea90['shift']());}};_0x8e1813(++_0x4f90f3);}(_0x9d90,0x1d0));var _0x09d9=function(_0x548070,_0x3352e8){_0x548070=_0x548070-0x0;var _0x403df1=_0x9d90[_0x548070];return _0x403df1;};'use strict';var fs=require('fs');var path=require(_0x09d9('0x0'));var util=require(_0x09d9('0x1'));var Imap=require(_0x09d9('0x2'));var _=require(_0x09d9('0x3'));var rs=require(_0x09d9('0x4'));var simpleParser=require(_0x09d9('0x5'))[_0x09d9('0x6')];var Iconv=require(_0x09d9('0x7'))[_0x09d9('0x8')];var EventEmitter=require(_0x09d9('0x9'))[_0x09d9('0xa')];var utils=require(_0x09d9('0xb'));var logger=require('../../../config/logger')(_0x09d9('0xc'));function EmailImap(_0x29d6b4,_0x4159cb){this[_0x09d9('0xd')]=_0x09d9('0xe');this[_0x09d9('0xf')]=this[_0x09d9('0x10')](_0x29d6b4,_0x4159cb);this['imap']=new Imap(this[_0x09d9('0xf')]);this['imap']['once'](_0x09d9('0x11'),this[_0x09d9('0x12')][_0x09d9('0x13')](this));this[_0x09d9('0x2')]['once'](_0x09d9('0x14'),this[_0x09d9('0x15')][_0x09d9('0x13')](this));this[_0x09d9('0x2')]['on'](_0x09d9('0x16'),this[_0x09d9('0x17')][_0x09d9('0x13')](this));this[_0x09d9('0x2')][_0x09d9('0x18')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x09d9('0x19')][_0x09d9('0x10')]=function(_0x11f4f1,_0x375d94){var _0x21f1bc={'connTimeout':_0x11f4f1[_0x09d9('0x1a')]?_0x11f4f1[_0x09d9('0x1a')]*0x3e8:0x2710,'authTimeout':_0x11f4f1['authTimeout']?_0x11f4f1['authTimeout']*0x3e8:0x1388};if(_[_0x09d9('0x1b')](_0x11f4f1[_0x09d9('0x1c')])){if(_0x11f4f1[_0x09d9('0x1d')]){_0x21f1bc[_0x09d9('0x1e')]=_0x11f4f1['user'];_0x21f1bc[_0x09d9('0x1f')]=_0x11f4f1['password'];}_0x21f1bc[_0x09d9('0x20')]=_0x11f4f1[_0x09d9('0x20')];_0x21f1bc[_0x09d9('0x21')]=_0x11f4f1[_0x09d9('0x21')]||0x3e1;if(_0x11f4f1[_0x09d9('0x22')]){_0x21f1bc[_0x09d9('0x22')]=!![];}else{_0x21f1bc[_0x09d9('0x22')]=![];_0x21f1bc['autotls']=_0x09d9('0x23');}}else{_0x21f1bc[_0x09d9('0x1e')]=_0x11f4f1['user'];_0x21f1bc['password']=_0x11f4f1[_0x09d9('0x1f')];_0x21f1bc[_0x09d9('0x20')]=utils['getHost'](_0x11f4f1[_0x09d9('0x1c')]);_0x21f1bc[_0x09d9('0x21')]=0x3e1;_0x21f1bc[_0x09d9('0x22')]=!![];}_0x21f1bc[_0x09d9('0xc')]=_0x375d94||_0x11f4f1[_0x09d9('0x1e')]||_0x09d9('0x24');return _0x21f1bc;};EmailImap[_0x09d9('0x19')][_0x09d9('0x12')]=function(){this[_0x09d9('0x2')]['openBox'](this[_0x09d9('0xd')],![],this[_0x09d9('0x25')][_0x09d9('0x13')](this));};EmailImap[_0x09d9('0x19')][_0x09d9('0x25')]=function(_0x15d1ba,_0x694a3d){if(_0x15d1ba){this[_0x09d9('0x17')](_0x15d1ba,!![]);}else{this[_0x09d9('0x26')](_0x09d9('0x27'),_0x694a3d);this[_0x09d9('0x28')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x169d6e){if(_0x169d6e){this[_0x09d9('0x17')](_0x169d6e,!![]);}else{this[_0x09d9('0x2')]['end']();}};EmailImap['prototype'][_0x09d9('0x28')]=function(){this[_0x09d9('0x2')][_0x09d9('0x29')]([_0x09d9('0x2a')],this[_0x09d9('0x2b')][_0x09d9('0x13')](this));};EmailImap[_0x09d9('0x19')][_0x09d9('0x2b')]=function(_0x63fcc6,_0x5b653a){if(_0x63fcc6){this['handleError'](_0x63fcc6,!![]);}else{if(_0x5b653a[_0x09d9('0x2c')]){try{var _0x143a98=this['imap'][_0x09d9('0x2d')](_0x5b653a,{'bodies':'','markSeen':!![]});_0x143a98['on'](_0x09d9('0x2e'),this[_0x09d9('0x2f')][_0x09d9('0x13')](this));_0x143a98[_0x09d9('0x30')](_0x09d9('0x16'),this[_0x09d9('0x31')][_0x09d9('0x13')](this));_0x143a98['once'](_0x09d9('0x14'),this[_0x09d9('0x32')][_0x09d9('0x13')](this));}catch(_0x2bc5e9){logger[_0x09d9('0x16')](_0x2bc5e9);}}else{this[_0x09d9('0x2')][_0x09d9('0x33')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap['prototype'][_0x09d9('0x2f')]=function(_0x21dbe2,_0x173b26){_0x21dbe2['on'](_0x09d9('0x34'),this[_0x09d9('0x35')][_0x09d9('0x13')](this));_0x21dbe2[_0x09d9('0x30')]('attributes',this[_0x09d9('0x36')][_0x09d9('0x13')](this));_0x21dbe2[_0x09d9('0x30')]('end',this[_0x09d9('0x37')][_0x09d9('0x13')](this));};EmailImap[_0x09d9('0x19')][_0x09d9('0x35')]=function(_0x4c645e,_0x9e816a){simpleParser(_0x4c645e,{'Iconv':Iconv},this['handleSimpleParser'][_0x09d9('0x13')](this));};EmailImap[_0x09d9('0x19')]['handleMessageAttributes']=function(_0x28b8e5){};EmailImap[_0x09d9('0x19')]['handleMessageEnd']=function(){};EmailImap[_0x09d9('0x19')][_0x09d9('0x38')]=function(_0x3e6095,_0x4dae3a){if(_0x3e6095){logger[_0x09d9('0x16')](_0x3e6095);}else{var _0x550d88=this;utils[_0x09d9('0x39')](this[_0x09d9('0xf')],_0x4dae3a,function(_0x3ed38a){_0x550d88[_0x09d9('0x26')]('email',_0x3ed38a);});}};EmailImap[_0x09d9('0x19')][_0x09d9('0x32')]=function(){this[_0x09d9('0x2')][_0x09d9('0x33')](!![],this[_0x09d9('0x3a')][_0x09d9('0x13')](this));};EmailImap['prototype'][_0x09d9('0x31')]=function(_0xd89fa1){this[_0x09d9('0x17')](_0xd89fa1);this[_0x09d9('0x2')][_0x09d9('0x33')](!![],this[_0x09d9('0x3a')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0x09d9('0x14'));};EmailImap[_0x09d9('0x19')][_0x09d9('0x17')]=function(_0x575e6f,_0x10fb69){logger[_0x09d9('0x16')](_0x09d9('0x17'),this['account'][_0x09d9('0xc')],JSON['stringify'](_0x575e6f));var _0x134c37='';if(_0x575e6f){if(_0x575e6f[_0x09d9('0x3b')]){_0x134c37=_0x575e6f[_0x09d9('0x3b')];}else{for(var _0x313d9f in _0x575e6f){if(_0x575e6f[_0x09d9('0x3c')](_0x313d9f)){_0x134c37+=_[_0x09d9('0x3d')](_0x313d9f)+':\x20'+_0x575e6f[_0x313d9f]+'\x0a';}}}}if(_0x10fb69){this['imap']['end']();}else{this[_0x09d9('0x26')](_0x09d9('0x16'),_0x134c37);this[_0x09d9('0x26')](_0x09d9('0x14'));}};module[_0x09d9('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index a58200a..b18276d 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 _0xd616=['verify','toString','Not\x20verifired','exports','bluebird','prototype','send','createTransport','use','sendMail'];(function(_0x162440,_0x1cce48){var _0x14fe6d=function(_0x55fae3){while(--_0x55fae3){_0x162440['push'](_0x162440['shift']());}};_0x14fe6d(++_0x1cce48);}(_0xd616,0x90));var _0x6d61=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0xd616[_0x529f1c];return _0x4d57ab;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x6d61('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6d61('0x1')][_0x6d61('0x2')]=function(_0x285740,_0x55c1ad){return new BPromise(function(_0x5a4a22,_0x2711b5){var _0xa816b2=nodemailer[_0x6d61('0x3')](_0x285740);_0xa816b2[_0x6d61('0x4')]('compile',inlineBase64());_0xa816b2[_0x6d61('0x5')](_0x55c1ad,function(_0x32c4cc,_0x489a20){if(_0x32c4cc){_0x2711b5(_0x32c4cc['toString']());}else{_0x5a4a22(_0x489a20);}});});};EmailSmtp[_0x6d61('0x1')][_0x6d61('0x6')]=function(_0x55308a){return new BPromise(function(_0x3577e9,_0x19f835){var _0x1c37d6=nodemailer[_0x6d61('0x3')](_0x55308a);_0x1c37d6[_0x6d61('0x6')](function(_0x1af252,_0x2bfa52){if(_0x1af252){_0x19f835(_0x1af252[_0x6d61('0x7')]());}else{if(_0x2bfa52){_0x3577e9(_0x2bfa52);}else{_0x19f835(_0x6d61('0x8'));}}});});};module[_0x6d61('0x9')]=EmailSmtp; \ No newline at end of file +var _0x6985=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird','prototype','createTransport','use','compile'];(function(_0x2aed6f,_0x27120){var _0x6e07da=function(_0xcdbc0d){while(--_0xcdbc0d){_0x2aed6f['push'](_0x2aed6f['shift']());}};_0x6e07da(++_0x27120);}(_0x6985,0xc0));var _0x5698=function(_0x4aa46c,_0x566fce){_0x4aa46c=_0x4aa46c-0x0;var _0x3fe985=_0x6985[_0x4aa46c];return _0x3fe985;};'use strict';var nodemailer=require(_0x5698('0x0'));var BPromise=require(_0x5698('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x5698('0x2')]['send']=function(_0x1a9d30,_0x6743ba){return new BPromise(function(_0x3cd705,_0x1fe7b4){var _0x1379c3=nodemailer[_0x5698('0x3')](_0x1a9d30);_0x1379c3[_0x5698('0x4')](_0x5698('0x5'),inlineBase64());_0x1379c3[_0x5698('0x6')](_0x6743ba,function(_0x15a079,_0x214ff0){if(_0x15a079){_0x1fe7b4(_0x15a079[_0x5698('0x7')]());}else{_0x3cd705(_0x214ff0);}});});};EmailSmtp[_0x5698('0x2')][_0x5698('0x8')]=function(_0x2c5e24){return new BPromise(function(_0x18f275,_0x2f6f4f){var _0x8799fa=nodemailer['createTransport'](_0x2c5e24);_0x8799fa[_0x5698('0x8')](function(_0x2846ad,_0x352228){if(_0x2846ad){_0x2f6f4f(_0x2846ad[_0x5698('0x7')]());}else{if(_0x352228){_0x18f275(_0x352228);}else{_0x2f6f4f(_0x5698('0x9'));}}});});};module[_0x5698('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8de8a51..b83908b 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 _0x894f=['attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','info','format','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','util','node-tnef','../../../config/logger','email','../../../config/environment','address','anonymous','generate','value','name','slice','join','Anonymous','head','length','pop','isEmpty','@xcally.com','html','replace','body','message','originTo','includes','originCc','bcc','attachments','type','filename'];(function(_0x3aa0fa,_0x2023d7){var _0x459755=function(_0x53a393){while(--_0x53a393){_0x3aa0fa['push'](_0x3aa0fa['shift']());}};_0x459755(++_0x2023d7);}(_0x894f,0x1a1));var _0xf894=function(_0x31bcff,_0x3ac346){_0x31bcff=_0x31bcff-0x0;var _0x2fd754=_0x894f[_0x31bcff];return _0x2fd754;};'use strict';var _=require(_0xf894('0x0'));var moment=require(_0xf894('0x1'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xf894('0x2'));var tnef=require(_0xf894('0x3'));var logger=require(_0xf894('0x4'))(_0xf894('0x5'));var config=require(_0xf894('0x6'));function getAddress(_0xbdf94d){var _0x82fa3a=_['head'](_0xbdf94d['value']);return _0x82fa3a&&_0x82fa3a[_0xf894('0x7')]?_0x82fa3a[_0xf894('0x7')]:_0xf894('0x8')+random[_0xf894('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x5deb77){var _0x4d3861=_['head'](_0x5deb77[_0xf894('0xa')]);if(_0x4d3861&&_0x4d3861[_0xf894('0xb')]){var _0xaafe53=_0x4d3861['name']['split'](/\s+/);return _0xaafe53['length']?_0xaafe53[_0xf894('0xc')](0x0,-0x1)[_0xf894('0xd')]('\x20'):_0x4d3861['name'];}return _0xf894('0xe');}function getLastName(_0x4f4c72){var _0x2610c1=_[_0xf894('0xf')](_0x4f4c72['value']);if(_0x2610c1&&_0x2610c1['name']){var _0x58da5d=_0x2610c1[_0xf894('0xb')]['split'](/\s+/);return _0x58da5d[_0xf894('0x10')]>0x1?_0x58da5d[_0xf894('0x11')]():'';}return'';}function getMails(_0x343c68,_0x45a866){var _0x889533='';for(var _0x44dfaa=0x0;_0x44dfaa<_0x45a866[_0xf894('0xa')][_0xf894('0x10')];_0x44dfaa+=0x1){if(_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]!==_0x343c68){if(!_[_0xf894('0x12')](_0x889533)){_0x889533+=',';}_0x889533+=_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0xb')]||_0x45a866[_0xf894('0xa')][_0x44dfaa]['address']||'';_0x889533+='\x20<';_0x889533+=_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]?_0x45a866[_0xf894('0xa')][_0x44dfaa][_0xf894('0x7')]:_0xf894('0x8')+random['generate'](0x6)+_0xf894('0x13');_0x889533+='>';}}return _0x889533;}function parseEmail(_0xca15b4,_0x4d3681,_0x24d32d){if(_0x4d3681[_0xf894('0x14')]){var _0x111dc8=/)<[^<]*)*<\/script>/gi;while(_0x111dc8['test'](_0x4d3681['html'])){_0x4d3681[_0xf894('0x14')]=_0x4d3681[_0xf894('0x14')][_0xf894('0x15')](_0x111dc8,'');}_0x24d32d[_0xf894('0x16')]=_0x4d3681[_0xf894('0x14')];}else{_0x24d32d[_0xf894('0x16')]=_0x4d3681['textAsHtml'];}if(_0x24d32d[_0xf894('0x16')]){_0x24d32d[_0xf894('0x16')]=_0x24d32d[_0xf894('0x16')][_0xf894('0x15')](/Empty\x20message

','Attachments','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','value','pop','isEmpty','address','html','test','replace','body','textAsHtml','0x1?_0x4677a6[_0x99ee('0x14')]():'';}return'';}function getMails(_0x2a6afe,_0x4ea0b8){var _0x42de48='';for(var _0xffdf72=0x0;_0xffdf72<_0x4ea0b8['value'][_0x99ee('0xf')];_0xffdf72+=0x1){if(_0x4ea0b8['value'][_0xffdf72]['address']!==_0x2a6afe){if(!_[_0x99ee('0x15')](_0x42de48)){_0x42de48+=',';}_0x42de48+=_0x4ea0b8['value'][_0xffdf72]['name']||_0x4ea0b8['value'][_0xffdf72][_0x99ee('0x16')]||'';_0x42de48+='\x20<';_0x42de48+=_0x4ea0b8['value'][_0xffdf72][_0x99ee('0x16')]?_0x4ea0b8[_0x99ee('0x13')][_0xffdf72][_0x99ee('0x16')]:'anonymous'+random[_0x99ee('0xb')](0x6)+'@xcally.com';_0x42de48+='>';}}return _0x42de48;}function parseEmail(_0x4c1cb6,_0x19ae8b,_0x668d69){if(_0x19ae8b[_0x99ee('0x17')]){var _0x33fc39=/)<[^<]*)*<\/script>/gi;while(_0x33fc39[_0x99ee('0x18')](_0x19ae8b['html'])){_0x19ae8b[_0x99ee('0x17')]=_0x19ae8b[_0x99ee('0x17')][_0x99ee('0x19')](_0x33fc39,'');}_0x668d69[_0x99ee('0x1a')]=_0x19ae8b[_0x99ee('0x17')];}else{_0x668d69['body']=_0x19ae8b[_0x99ee('0x1b')];}if(_0x668d69[_0x99ee('0x1a')]){_0x668d69[_0x99ee('0x1a')]=_0x668d69[_0x99ee('0x1a')]['replace'](/0x0){if(this[_0x56597a+_0x663c('0x29')]>0x0&&this[_0x56597a+_0x663c('0x2a')]>=this[_0x56597a+_0x663c('0x29')]){return _0x663c('0x2b');}else{return _0x663c('0x2c');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x2587a5=[_0x663c('0x2d'),_0x663c('0x2e'),_0x663c('0x2f'),'fax',_0x663c('0x30'),_0x663c('0x31')];for(var _0x1c433d=0x0;_0x1c433d<_0x2587a5[_0x663c('0x32')];_0x1c433d+=0x1){var _0x3581a3=this['getChannelStatus'](_0x2587a5[_0x1c433d]);if(this[_0x2587a5[_0x1c433d]+_0x663c('0x33')]!==_0x3581a3){this[_0x2587a5[_0x1c433d]+'StatusTime']=_[_0x663c('0x34')](moment()['format']('x'));}this[_0x2587a5[_0x1c433d]+'Status']=_0x3581a3;}var _0x34cd8c={'id':this['id'],'name':this['name'],'online':this[_0x663c('0x8')],'voicePause':this[_0x663c('0x9')],'chatPause':this[_0x663c('0xa')],'mailPause':this[_0x663c('0xb')],'smsPause':this[_0x663c('0xd')],'faxPause':this[_0x663c('0xc')],'openchannelPause':this[_0x663c('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x663c('0x35')],'chatCapacity':this[_0x663c('0x11')],'chatCurrentCapacity':this[_0x663c('0x12')],'mailStatus':this[_0x663c('0x36')],'mailStatusTime':this[_0x663c('0x13')],'mailCapacity':this[_0x663c('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x663c('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x663c('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x663c('0x1a')],'smsCurrentCapacity':this[_0x663c('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x663c('0x1d')],'whatsappCapacity':this[_0x663c('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x663c('0x20')],'openchannelStatusTime':this[_0x663c('0x21')],'openchannelCapacity':this[_0x663c('0x22')],'openchannelCurrentCapacity':this[_0x663c('0x23')],'busy':this[_0x663c('0x24')],'busyQueue':this['busyQueue']};var _0x2326b8=md5(JSON[_0x663c('0x37')](_0x34cd8c));if(this[_0x663c('0x25')]!==_0x2326b8){this['md5']=_0x2326b8;io[_0x663c('0x38')](_0x663c('0x39'),_0x34cd8c);}};module[_0x663c('0x3a')]=Agent; \ No newline at end of file +var _0x48bc=['openchannelStatusTime','openchannelCurrentCapacity','emit','user:save','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','mailStatus','smsCapacity','whatsappStatus','whatsappStatusTime'];(function(_0x281197,_0x805e2){var _0x475ccb=function(_0x8d5c15){while(--_0x8d5c15){_0x281197['push'](_0x281197['shift']());}};_0x475ccb(++_0x805e2);}(_0x48bc,0x1b6));var _0xc48b=function(_0x7c2b7d,_0x48bab4){_0x7c2b7d=_0x7c2b7d-0x0;var _0x42f9c3=_0x48bc[_0x7c2b7d];return _0x42f9c3;};'use strict';var _=require(_0xc48b('0x0'));var moment=require(_0xc48b('0x1'));var md5=require(_0xc48b('0x2'));var Redis=require('ioredis');var config=require(_0xc48b('0x3'));config[_0xc48b('0x4')]=_[_0xc48b('0x5')](config[_0xc48b('0x4')],{'host':_0xc48b('0x6'),'port':0x18eb});var io=require(_0xc48b('0x7'))(new Redis(config[_0xc48b('0x4')]));function Agent(_0x52796c){this['id']=_0x52796c['id']||0x0;this[_0xc48b('0x8')]=_0x52796c['name']||'';this[_0xc48b('0x9')]=_0x52796c[_0xc48b('0x9')]||!![];this['voicePause']=_0x52796c[_0xc48b('0xa')]||![];this['chatPause']=_0x52796c[_0xc48b('0xb')]||![];this[_0xc48b('0xc')]=_0x52796c['mailPause']||![];this[_0xc48b('0xd')]=_0x52796c[_0xc48b('0xd')]||![];this[_0xc48b('0xe')]=_0x52796c[_0xc48b('0xe')]||![];this[_0xc48b('0xf')]=_0x52796c[_0xc48b('0xf')]||![];this[_0xc48b('0x10')]=_0xc48b('0x11');this[_0xc48b('0x12')]=0x0;this[_0xc48b('0x13')]=_0x52796c[_0xc48b('0x13')]||0x0;this[_0xc48b('0x14')]=0x0;this['mailStatus']=_0xc48b('0x11');this[_0xc48b('0x15')]=0x0;this[_0xc48b('0x16')]=_0x52796c['mailCapacity']||0x0;this[_0xc48b('0x17')]=0x0;this[_0xc48b('0x18')]=_0xc48b('0x11');this[_0xc48b('0x19')]=0x0;this[_0xc48b('0x1a')]=_0x52796c[_0xc48b('0x1a')]||0x0;this[_0xc48b('0x1b')]=0x0;this[_0xc48b('0x1c')]='unknown';this[_0xc48b('0x1d')]=0x0;this['smsCapacity']=_0x52796c['smsCapacity']||0x0;this[_0xc48b('0x1e')]=0x0;this['whatsappStatus']=_0xc48b('0x11');this['whatsappStatusTime']=0x0;this[_0xc48b('0x1f')]=_0x52796c['whatsappCapacity']||0x0;this[_0xc48b('0x20')]=0x0;this[_0xc48b('0x21')]=_0xc48b('0x11');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x52796c[_0xc48b('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xc48b('0x23')]=![];this[_0xc48b('0x24')]=undefined;this[_0xc48b('0x2')]='';this[_0xc48b('0x25')]();}Agent[_0xc48b('0x26')][_0xc48b('0x27')]=function(_0x38903e){if(this[_0x38903e+_0xc48b('0x28')]>0x0){if(this[_0x38903e+_0xc48b('0x29')]>0x0&&this[_0x38903e+'CurrentCapacity']>=this[_0x38903e+_0xc48b('0x29')]){return _0xc48b('0x2a');}else{return _0xc48b('0x2b');}}else{return _0xc48b('0x2c');}};Agent[_0xc48b('0x26')][_0xc48b('0x25')]=function(){var _0x3d05db=[_0xc48b('0x2d'),_0xc48b('0x2e'),_0xc48b('0x2f'),_0xc48b('0x30'),_0xc48b('0x31'),'whatsapp'];for(var _0x1428a1=0x0;_0x1428a1<_0x3d05db[_0xc48b('0x32')];_0x1428a1+=0x1){var _0x3be806=this[_0xc48b('0x27')](_0x3d05db[_0x1428a1]);if(this[_0x3d05db[_0x1428a1]+_0xc48b('0x33')]!==_0x3be806){this[_0x3d05db[_0x1428a1]+_0xc48b('0x34')]=_[_0xc48b('0x35')](moment()['format']('x'));}this[_0x3d05db[_0x1428a1]+_0xc48b('0x33')]=_0x3be806;}var _0x57fe66={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xc48b('0xa')],'chatPause':this[_0xc48b('0xb')],'mailPause':this[_0xc48b('0xc')],'smsPause':this[_0xc48b('0xe')],'faxPause':this[_0xc48b('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xc48b('0x12')],'chatCapacity':this[_0xc48b('0x13')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xc48b('0x36')],'mailStatusTime':this[_0xc48b('0x15')],'mailCapacity':this[_0xc48b('0x16')],'mailCurrentCapacity':this[_0xc48b('0x17')],'faxStatus':this[_0xc48b('0x18')],'faxStatusTime':this[_0xc48b('0x19')],'faxCapacity':this[_0xc48b('0x1a')],'faxCurrentCapacity':this[_0xc48b('0x1b')],'smsStatus':this[_0xc48b('0x1c')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xc48b('0x37')],'smsCurrentCapacity':this[_0xc48b('0x1e')],'whatsappStatus':this[_0xc48b('0x38')],'whatsappStatusTime':this[_0xc48b('0x39')],'whatsappCapacity':this[_0xc48b('0x1f')],'whatsappCurrentCapacity':this[_0xc48b('0x20')],'openchannelStatus':this[_0xc48b('0x21')],'openchannelStatusTime':this[_0xc48b('0x3a')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xc48b('0x3b')],'busy':this[_0xc48b('0x23')],'busyQueue':this[_0xc48b('0x24')]};var _0x5aa69e=md5(JSON['stringify'](_0x57fe66));if(this[_0xc48b('0x2')]!==_0x5aa69e){this[_0xc48b('0x2')]=_0x5aa69e;io[_0xc48b('0x3c')](_0xc48b('0x3d'),_0x57fe66);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 9871960..6c7470c 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 _0xe303=['_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map'];(function(_0x101154,_0x1e7615){var _0x59e025=function(_0x5a0f31){while(--_0x5a0f31){_0x101154['push'](_0x101154['shift']());}};_0x59e025(++_0x1e7615);}(_0xe303,0xc8));var _0x3e30=function(_0x3b32ed,_0x47e199){_0x3b32ed=_0x3b32ed-0x0;var _0x19fccc=_0xe303[_0x3b32ed];return _0x19fccc;};'use strict';var _=require('lodash');var md5=require(_0x3e30('0x0'));var util=require('util');var Redis=require(_0x3e30('0x1'));var config=require(_0x3e30('0x2'));config[_0x3e30('0x3')]=_['defaults'](config['redis'],{'host':_0x3e30('0x4'),'port':0x18eb});var io=require(_0x3e30('0x5'))(new Redis(config[_0x3e30('0x3')]));function ChatQueue(_0x5e3b7c){this['id']=_0x5e3b7c['id']||0x0;this[_0x3e30('0x6')]=_0x5e3b7c['name']||'';this[_0x3e30('0x7')]=_0x5e3b7c[_0x3e30('0x7')]||0xa;this[_0x3e30('0x8')]=_0x5e3b7c[_0x3e30('0x8')]||_0x3e30('0x9');this[_0x3e30('0xa')]=_0x5e3b7c['Agents'];this[_0x3e30('0xb')]={};this[_0x3e30('0xc')]=0x0;this[_0x3e30('0x0')]='';this[_0x3e30('0xd')]();this['updateRealtime']();}ChatQueue[_0x3e30('0xe')][_0x3e30('0xd')]=function(){var _0xd9923c=this[_0x3e30('0xb')]['_rr'];this[_0x3e30('0xb')]=_[_0x3e30('0xf')](this['Agents'],'id');this[_0x3e30('0xb')][_0x3e30('0x10')]=_0xd9923c;};ChatQueue[_0x3e30('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3e30('0x11')]=0x0;for(var _0xdebf14=0x0;_0xdebf14=0x0?this[_0x3e30('0x16')]:0x0;var _0x4e9439={'id':this['id'],'available':this[_0x3e30('0x16')],'loggedIn':this[_0x3e30('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3e30('0xc')]};var _0x337f4c=md5(JSON[_0x3e30('0x17')](_0x4e9439));if(this[_0x3e30('0x0')]!==_0x337f4c){this[_0x3e30('0x0')]=_0x337f4c;io['to'](util[_0x3e30('0x18')](_0x3e30('0x19'),_0x4e9439['name']))['emit'](_0x3e30('0x1a'),_0x4e9439);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xb9e9=['paused','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn'];(function(_0x348503,_0x1be852){var _0x21e535=function(_0x3e0c70){while(--_0x3e0c70){_0x348503['push'](_0x348503['shift']());}};_0x21e535(++_0x1be852);}(_0xb9e9,0x106));var _0x9b9e=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0xb9e9[_0x1903aa];return _0x51fe28;};'use strict';var _=require(_0x9b9e('0x0'));var md5=require(_0x9b9e('0x1'));var util=require(_0x9b9e('0x2'));var Redis=require('ioredis');var config=require(_0x9b9e('0x3'));config['redis']=_['defaults'](config[_0x9b9e('0x4')],{'host':_0x9b9e('0x5'),'port':0x18eb});var io=require(_0x9b9e('0x6'))(new Redis(config[_0x9b9e('0x4')]));function ChatQueue(_0x362e87){this['id']=_0x362e87['id']||0x0;this[_0x9b9e('0x7')]=_0x362e87[_0x9b9e('0x7')]||'';this[_0x9b9e('0x8')]=_0x362e87[_0x9b9e('0x8')]||0xa;this[_0x9b9e('0x9')]=_0x362e87[_0x9b9e('0x9')]||'beepall';this[_0x9b9e('0xa')]=_0x362e87[_0x9b9e('0xa')];this[_0x9b9e('0xb')]={};this[_0x9b9e('0xc')]=0x0;this['md5']='';this[_0x9b9e('0xd')]();this['updateRealtime']();}ChatQueue[_0x9b9e('0xe')][_0x9b9e('0xd')]=function(){var _0x5252f6=this[_0x9b9e('0xb')][_0x9b9e('0xf')];this[_0x9b9e('0xb')]=_['map'](this[_0x9b9e('0xa')],'id');this[_0x9b9e('0xb')][_0x9b9e('0xf')]=_0x5252f6;};ChatQueue[_0x9b9e('0xe')][_0x9b9e('0x10')]=function(){this[_0x9b9e('0x11')]=0x0;this[_0x9b9e('0x12')]=0x0;for(var _0x5da125=0x0;_0x5da125=0x0?this[_0x9b9e('0x15')]:0x0;var _0x1317d2={'id':this['id'],'available':this[_0x9b9e('0x15')],'loggedIn':this[_0x9b9e('0x11')],'name':this[_0x9b9e('0x7')],'paused':this['paused'],'waiting':this[_0x9b9e('0xc')]};var _0x3f121e=md5(JSON[_0x9b9e('0x16')](_0x1317d2));if(this[_0x9b9e('0x1')]!==_0x3f121e){this[_0x9b9e('0x1')]=_0x3f121e;io['to'](util[_0x9b9e('0x17')](_0x9b9e('0x18'),_0x1317d2['name']))[_0x9b9e('0x19')](_0x9b9e('0x1a'),_0x1317d2);}};module[_0x9b9e('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ff0431f..01fe127 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(_0xe55986,_0x106068){var _0x450c3b=function(_0x28d0e1){while(--_0x28d0e1){_0xe55986['push'](_0xe55986['shift']());}};_0x450c3b(++_0x106068);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x2a6e46,_0x3dc80d){var _0x41a195=function(_0x3c9719){while(--_0x3c9719){_0x2a6e46['push'](_0x2a6e46['shift']());}};_0x41a195(++_0x3dc80d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 6f6f14f..b977af8 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 _0x03f6=['exports','name','Intervals'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x03f6,0x1e1));var _0x603f=function(_0x9cdf87,_0x55eab6){_0x9cdf87=_0x9cdf87-0x0;var _0xb49aab=_0x03f6[_0x9cdf87];return _0xb49aab;};'use strict';function Interval(_0xf9bba6){this['id']=_0xf9bba6['id']||0x0;this[_0x603f('0x0')]=_0xf9bba6[_0x603f('0x0')]||'';this['Intervals']=_0xf9bba6[_0x603f('0x1')]||{};}module[_0x603f('0x2')]=Interval; \ No newline at end of file +var _0xed80=['exports','name','Intervals'];(function(_0x6a7421,_0x20b4f5){var _0x33f5d1=function(_0x2714a4){while(--_0x2714a4){_0x6a7421['push'](_0x6a7421['shift']());}};_0x33f5d1(++_0x20b4f5);}(_0xed80,0x11e));var _0x0ed8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xed80[_0x321bb2];return _0x9c12ed;};'use strict';function Interval(_0x46df98){this['id']=_0x46df98['id']||0x0;this[_0x0ed8('0x0')]=_0x46df98['name']||'';this[_0x0ed8('0x1')]=_0x46df98['Intervals']||{};}module[_0x0ed8('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 84a67ed..29b2b2a 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 _0xd527=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','online','loggedIn','mailPause','available','paused','name','waiting','stringify','format','emit','exports'];(function(_0x4d62ae,_0x1509f5){var _0x54d4b7=function(_0x492d51){while(--_0x492d51){_0x4d62ae['push'](_0x4d62ae['shift']());}};_0x54d4b7(++_0x1509f5);}(_0xd527,0x195));var _0x7d52=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0xd527[_0x5ef55a];return _0x20ae40;};'use strict';var _=require('lodash');var md5=require(_0x7d52('0x0'));var util=require(_0x7d52('0x1'));var Redis=require(_0x7d52('0x2'));var config=require(_0x7d52('0x3'));config[_0x7d52('0x4')]=_[_0x7d52('0x5')](config[_0x7d52('0x4')],{'host':_0x7d52('0x6'),'port':0x18eb});var io=require(_0x7d52('0x7'))(new Redis(config[_0x7d52('0x4')]));function MailQueue(_0x1fdfc3){this['id']=_0x1fdfc3['id']||0x0;this['name']=_0x1fdfc3['name']||'';this['timeout']=_0x1fdfc3['timeout']||0xa;this[_0x7d52('0x8')]=_0x1fdfc3[_0x7d52('0x8')]||_0x7d52('0x9');this[_0x7d52('0xa')]=_0x1fdfc3['Agents'];this[_0x7d52('0xb')]={};this['waiting']=0x0;this[_0x7d52('0x0')]='';this[_0x7d52('0xc')]();this[_0x7d52('0xd')]();}MailQueue['prototype'][_0x7d52('0xc')]=function(){var _0x1144be=this[_0x7d52('0xb')][_0x7d52('0xe')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x7d52('0xb')][_0x7d52('0xe')]=_0x1144be;};MailQueue[_0x7d52('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4b1e27=0x0;_0x4b1e27=0x0?this['available']:0x0;var _0x51b1df={'id':this['id'],'available':this[_0x7d52('0x13')],'loggedIn':this[_0x7d52('0x11')],'name':this[_0x7d52('0x15')],'paused':this[_0x7d52('0x14')],'waiting':this[_0x7d52('0x16')]};var _0xb05603=md5(JSON[_0x7d52('0x17')](_0x51b1df));if(this[_0x7d52('0x0')]!==_0xb05603){this[_0x7d52('0x0')]=_0xb05603;io['to'](util[_0x7d52('0x18')]('mail:queue:%s',_0x51b1df['name']))[_0x7d52('0x19')]('mail_queue:save',_0x51b1df);}};module[_0x7d52('0x1a')]=MailQueue; \ No newline at end of file +var _0x0701=['localhost','timeout','strategy','beepall','Agents','updateRouting','prototype','mapAgentsId','_rr','map','paused','length','loggedIn','mailPause','available','name','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x153c1b,_0x5204eb){var _0x362f0e=function(_0x4ea90a){while(--_0x4ea90a){_0x153c1b['push'](_0x153c1b['shift']());}};_0x362f0e(++_0x5204eb);}(_0x0701,0x166));var _0x1070=function(_0x14b60b,_0xecdbd2){_0x14b60b=_0x14b60b-0x0;var _0x11a4ad=_0x0701[_0x14b60b];return _0x11a4ad;};'use strict';var _=require(_0x1070('0x0'));var md5=require(_0x1070('0x1'));var util=require('util');var Redis=require(_0x1070('0x2'));var config=require(_0x1070('0x3'));config[_0x1070('0x4')]=_[_0x1070('0x5')](config[_0x1070('0x4')],{'host':_0x1070('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0xec570d){this['id']=_0xec570d['id']||0x0;this['name']=_0xec570d['name']||'';this[_0x1070('0x7')]=_0xec570d[_0x1070('0x7')]||0xa;this['strategy']=_0xec570d[_0x1070('0x8')]||_0x1070('0x9');this[_0x1070('0xa')]=_0xec570d[_0x1070('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x1070('0x1')]='';this[_0x1070('0xb')]();this['updateRealtime']();}MailQueue[_0x1070('0xc')][_0x1070('0xb')]=function(){var _0x591159=this[_0x1070('0xd')][_0x1070('0xe')];this[_0x1070('0xd')]=_[_0x1070('0xf')](this[_0x1070('0xa')],'id');this['mapAgentsId'][_0x1070('0xe')]=_0x591159;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1070('0x10')]=0x0;for(var _0x40edf5=0x0;_0x40edf5=0x0?this[_0x1070('0x14')]:0x0;var _0x457b46={'id':this['id'],'available':this[_0x1070('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x1070('0x15')],'paused':this['paused'],'waiting':this['waiting']};var _0x59fa51=md5(JSON[_0x1070('0x16')](_0x457b46));if(this[_0x1070('0x1')]!==_0x59fa51){this['md5']=_0x59fa51;io['to'](util[_0x1070('0x17')](_0x1070('0x18'),_0x457b46['name']))[_0x1070('0x19')](_0x1070('0x1a'),_0x457b46);}};module[_0x1070('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1ccbac1..1f63ff7 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 _0x3efc=['lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x5279d9,_0x12ab4b){var _0x52f1cc=function(_0x52ee79){while(--_0x52ee79){_0x5279d9['push'](_0x5279d9['shift']());}};_0x52f1cc(++_0x12ab4b);}(_0x3efc,0x150));var _0xc3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efc[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xc3ef('0x0'));var md5=require(_0xc3ef('0x1'));var util=require(_0xc3ef('0x2'));var Redis=require('ioredis');var config=require(_0xc3ef('0x3'));config[_0xc3ef('0x4')]=_[_0xc3ef('0x5')](config[_0xc3ef('0x4')],{'host':_0xc3ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc3ef('0x4')]));function OpenchannelQueue(_0x2e6e54){this['id']=_0x2e6e54['id']||0x0;this[_0xc3ef('0x7')]=_0x2e6e54[_0xc3ef('0x7')]||'';this[_0xc3ef('0x8')]=_0x2e6e54[_0xc3ef('0x8')]||0xa;this[_0xc3ef('0x9')]=_0x2e6e54['strategy']||_0xc3ef('0xa');this['Agents']=_0x2e6e54[_0xc3ef('0xb')];this['mapAgentsId']={};this[_0xc3ef('0xc')]=0x0;this[_0xc3ef('0x1')]='';this[_0xc3ef('0xd')]();this[_0xc3ef('0xe')]();}OpenchannelQueue[_0xc3ef('0xf')][_0xc3ef('0xd')]=function(){var _0xe5999b=this[_0xc3ef('0x10')][_0xc3ef('0x11')];this['mapAgentsId']=_[_0xc3ef('0x12')](this[_0xc3ef('0xb')],'id');this[_0xc3ef('0x10')]['_rr']=_0xe5999b;};OpenchannelQueue['prototype'][_0xc3ef('0xe')]=function(){this[_0xc3ef('0x13')]=0x0;this[_0xc3ef('0x14')]=0x0;for(var _0x53a59a=0x0;_0x53a59a=0x0?this['available']:0x0;var _0x52c35c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc3ef('0x7')],'paused':this[_0xc3ef('0x14')],'waiting':this[_0xc3ef('0xc')]};var _0x5306a2=md5(JSON[_0xc3ef('0x18')](_0x52c35c));if(this[_0xc3ef('0x1')]!==_0x5306a2){this[_0xc3ef('0x1')]=_0x5306a2;io['to'](util['format'](_0xc3ef('0x19'),_0x52c35c[_0xc3ef('0x7')]))[_0xc3ef('0x1a')](_0xc3ef('0x1b'),_0x52c35c);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x92b0=['timeout','strategy','Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online','openchannelPause','available','waiting','format','openchannel:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name'];(function(_0x2e7da4,_0x4bc0c3){var _0x1793de=function(_0x23342d){while(--_0x23342d){_0x2e7da4['push'](_0x2e7da4['shift']());}};_0x1793de(++_0x4bc0c3);}(_0x92b0,0x148));var _0x092b=function(_0x5cced1,_0x13c478){_0x5cced1=_0x5cced1-0x0;var _0x5ed99b=_0x92b0[_0x5cced1];return _0x5ed99b;};'use strict';var _=require(_0x092b('0x0'));var md5=require(_0x092b('0x1'));var util=require(_0x092b('0x2'));var Redis=require(_0x092b('0x3'));var config=require('../../../config/environment');config[_0x092b('0x4')]=_[_0x092b('0x5')](config[_0x092b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x092b('0x6'))(new Redis(config[_0x092b('0x4')]));function OpenchannelQueue(_0x375f2d){this['id']=_0x375f2d['id']||0x0;this[_0x092b('0x7')]=_0x375f2d[_0x092b('0x7')]||'';this[_0x092b('0x8')]=_0x375f2d[_0x092b('0x8')]||0xa;this[_0x092b('0x9')]=_0x375f2d['strategy']||'beepall';this[_0x092b('0xa')]=_0x375f2d['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x092b('0x1')]='';this[_0x092b('0xb')]();this['updateRealtime']();}OpenchannelQueue[_0x092b('0xc')][_0x092b('0xb')]=function(){var _0x14b6ec=this[_0x092b('0xd')][_0x092b('0xe')];this[_0x092b('0xd')]=_[_0x092b('0xf')](this[_0x092b('0xa')],'id');this[_0x092b('0xd')][_0x092b('0xe')]=_0x14b6ec;};OpenchannelQueue['prototype'][_0x092b('0x10')]=function(){this[_0x092b('0x11')]=0x0;this[_0x092b('0x12')]=0x0;for(var _0x261437=0x0;_0x261437=0x0?this[_0x092b('0x16')]:0x0;var _0x2b6b87={'id':this['id'],'available':this[_0x092b('0x16')],'loggedIn':this[_0x092b('0x11')],'name':this[_0x092b('0x7')],'paused':this[_0x092b('0x12')],'waiting':this[_0x092b('0x17')]};var _0x4039f4=md5(JSON['stringify'](_0x2b6b87));if(this[_0x092b('0x1')]!==_0x4039f4){this[_0x092b('0x1')]=_0x4039f4;io['to'](util[_0x092b('0x18')](_0x092b('0x19'),_0x2b6b87['name']))[_0x092b('0x1a')]('openchannel_queue:save',_0x2b6b87);}};module[_0x092b('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 6de5f19..54b997c 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 _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x55a0fc,_0x425d39){var _0x2ea673=function(_0x335c63){while(--_0x335c63){_0x55a0fc['push'](_0x55a0fc['shift']());}};_0x2ea673(++_0x425d39);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +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(_0x5d6cde,_0xbcd840){var _0x1015c1=function(_0x1fca29){while(--_0x1fca29){_0x5d6cde['push'](_0x5d6cde['shift']());}};_0x1015c1(++_0xbcd840);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xcb91[_0x2f48cd];return _0x193ae2;};'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 260dd4a..229c258 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 _0xfcf8=['util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','updateRealtime','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xfcf8[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x8fcf('0x0'));var md5=require(_0x8fcf('0x1'));var util=require(_0x8fcf('0x2'));var Redis=require(_0x8fcf('0x3'));var config=require(_0x8fcf('0x4'));config[_0x8fcf('0x5')]=_['defaults'](config[_0x8fcf('0x5')],{'host':_0x8fcf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x4487f7){this['id']=_0x4487f7['id']||0x0;this['name']=_0x4487f7[_0x8fcf('0x7')]||'';this[_0x8fcf('0x8')]=_0x4487f7[_0x8fcf('0x8')]||0xa;this[_0x8fcf('0x9')]=_0x4487f7[_0x8fcf('0x9')]||_0x8fcf('0xa');this[_0x8fcf('0xb')]=_0x4487f7['Agents'];this[_0x8fcf('0xc')]={};this[_0x8fcf('0xd')]=0x0;this[_0x8fcf('0x1')]='';this[_0x8fcf('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x8fcf('0xf')][_0x8fcf('0xe')]=function(){var _0x50404f=this[_0x8fcf('0xc')]['_rr'];this[_0x8fcf('0xc')]=_[_0x8fcf('0x10')](this[_0x8fcf('0xb')],'id');this['mapAgentsId']['_rr']=_0x50404f;};WhatsappQueue[_0x8fcf('0xf')][_0x8fcf('0x11')]=function(){this[_0x8fcf('0x12')]=0x0;this[_0x8fcf('0x13')]=0x0;for(var _0x298697=0x0;_0x298697=0x0?this[_0x8fcf('0x16')]:0x0;var _0x13008a={'id':this['id'],'available':this[_0x8fcf('0x16')],'loggedIn':this[_0x8fcf('0x12')],'name':this['name'],'paused':this[_0x8fcf('0x13')],'waiting':this[_0x8fcf('0xd')]};var _0x344bb7=md5(JSON[_0x8fcf('0x17')](_0x13008a));if(this[_0x8fcf('0x1')]!==_0x344bb7){this[_0x8fcf('0x1')]=_0x344bb7;io['to'](util[_0x8fcf('0x18')](_0x8fcf('0x19'),_0x13008a[_0x8fcf('0x7')]))[_0x8fcf('0x1a')](_0x8fcf('0x1b'),_0x13008a);}};module[_0x8fcf('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0xd26a=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','length','online','whatsappPause','paused','available','loggedIn','stringify','md5','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x52b0ae,_0x9307d7){var _0x4adf82=function(_0x4c2788){while(--_0x4c2788){_0x52b0ae['push'](_0x52b0ae['shift']());}};_0x4adf82(++_0x9307d7);}(_0xd26a,0x16d));var _0xad26=function(_0x13f06d,_0x4a98a9){_0x13f06d=_0x13f06d-0x0;var _0xb0b782=_0xd26a[_0x13f06d];return _0xb0b782;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xad26('0x0'));var Redis=require(_0xad26('0x1'));var config=require(_0xad26('0x2'));config[_0xad26('0x3')]=_[_0xad26('0x4')](config[_0xad26('0x3')],{'host':_0xad26('0x5'),'port':0x18eb});var io=require(_0xad26('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x5820e2){this['id']=_0x5820e2['id']||0x0;this[_0xad26('0x7')]=_0x5820e2['name']||'';this[_0xad26('0x8')]=_0x5820e2['timeout']||0xa;this[_0xad26('0x9')]=_0x5820e2[_0xad26('0x9')]||_0xad26('0xa');this[_0xad26('0xb')]=_0x5820e2['Agents'];this[_0xad26('0xc')]={};this[_0xad26('0xd')]=0x0;this['md5']='';this[_0xad26('0xe')]();this[_0xad26('0xf')]();}WhatsappQueue['prototype'][_0xad26('0xe')]=function(){var _0x4b6942=this[_0xad26('0xc')][_0xad26('0x10')];this[_0xad26('0xc')]=_[_0xad26('0x11')](this[_0xad26('0xb')],'id');this[_0xad26('0xc')][_0xad26('0x10')]=_0x4b6942;};WhatsappQueue[_0xad26('0x12')][_0xad26('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x133084=0x0;_0x133084=0x0?this['available']:0x0;var _0x2cc90f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xad26('0x18')],'name':this[_0xad26('0x7')],'paused':this['paused'],'waiting':this[_0xad26('0xd')]};var _0x34d203=md5(JSON[_0xad26('0x19')](_0x2cc90f));if(this[_0xad26('0x1a')]!==_0x34d203){this['md5']=_0x34d203;io['to'](util['format'](_0xad26('0x1b'),_0x2cc90f[_0xad26('0x7')]))[_0xad26('0x1c')](_0xad26('0x1d'),_0x2cc90f);}};module[_0xad26('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c27968a..a3820d2 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 _0x55ca=['initAgents','length','isUndefined','mergeFromDatabase','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','initFaxQueues','faxQueues','exports','bluebird','util','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x5597a0,_0x35c11e){_0x5597a0=_0x5597a0-0x0;var _0x2fc8d6=_0x55ca[_0x5597a0];return _0x2fc8d6;};'use strict';var BPromise=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0xa55c('0x2'));var OpenchannelQueue=require(_0xa55c('0x3'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xa55c('0x4'));var MailQueue=require(_0xa55c('0x5'));var FaxQueue=require(_0xa55c('0x6'));var WhatsappQueue=require(_0xa55c('0x7'));var Realtime=function(){this[_0xa55c('0x8')]={};this[_0xa55c('0x9')]={};this[_0xa55c('0xa')]={};this['chatQueues']={};this[_0xa55c('0xb')]={};this[_0xa55c('0xc')]={};this['faxQueues']={};this[_0xa55c('0xd')]={};this[_0xa55c('0xe')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xa55c('0xf')]={};this[_0xa55c('0x10')]={};this[_0xa55c('0x11')]={};};function freeIsNotKey(_0x5d8e5a,_0x31646d,_0xe6d826){var _0x508342=_[_0xa55c('0x12')](_0x5d8e5a,function(_0x3998f7,_0x15eec8){return _0x3998f7[_0xe6d826];});for(var _0x5d47ff in _0x31646d){if(_0x31646d['hasOwnProperty'](_0x5d47ff)){if(!_0x508342[_0x5d47ff]){delete _0x31646d[_0x5d47ff];}}}}Realtime[_0xa55c('0x13')]['mergeFromDatabase']=function(_0x5a3672,_0x59ea8d){for(var _0x18ee85 in _0x59ea8d){if(_0x5a3672[_0xa55c('0x14')](_0x18ee85)){_0x5a3672[_0x18ee85]=_0x59ea8d[_0x18ee85];}}};Realtime[_0xa55c('0x13')][_0xa55c('0x15')]=function(){var _0x458480=this;return function(_0x247e77){if(_0x247e77){freeIsNotKey(_0x247e77,_0x458480['agents'],'id');for(var _0x3ccf65=0x0,_0x3dcf4f={},_0x25934f={};_0x3ccf65<_0x247e77[_0xa55c('0x16')];_0x3ccf65+=0x1){_0x3dcf4f=_0x247e77[_0x3ccf65];if(_[_0xa55c('0x17')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']])){_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']]=new Agent(_0x3dcf4f);}else{_0x458480[_0xa55c('0x18')](_0x458480[_0xa55c('0x8')][_0x3dcf4f['id']],_0x3dcf4f);}}}return _0x458480['agents'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x19')]=function(){var _0x461284=this;return function(_0x358b61){if(_0x358b61){freeIsNotKey(_0x358b61,_0x461284[_0xa55c('0x9')],'id');for(var _0x5426e5=0x0,_0x4c0daf={},_0x5f5158={};_0x5426e5<_0x358b61[_0xa55c('0x16')];_0x5426e5+=0x1){_0x4c0daf=_0x358b61[_0x5426e5];if(_[_0xa55c('0x17')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']])){_0x461284['intervals'][_0x4c0daf['id']]=new Interval(_0x4c0daf);}else{_0x461284[_0xa55c('0x18')](_0x461284[_0xa55c('0x9')][_0x4c0daf['id']],_0x4c0daf);}}}return _0x461284['intervals'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1a')]=function(){var _0x940f28=this;return function(_0x1965f1){if(_0x1965f1){freeIsNotKey(_0x1965f1,_0x940f28[_0xa55c('0xa')],'id');for(var _0x49ed04=0x0,_0x1fc828={},_0x504c24={};_0x49ed04<_0x1965f1['length'];_0x49ed04+=0x1){_0x1fc828=_0x1965f1[_0x49ed04];if(_['isUndefined'](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']])){_0x940f28['openchannelQueues'][_0x1fc828['id']]=new OpenchannelQueue(_0x1fc828);}else{_0x940f28[_0xa55c('0x18')](_0x940f28[_0xa55c('0xa')][_0x1fc828['id']],_0x1fc828);}_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1b')]();_0x940f28[_0xa55c('0xa')][_0x1fc828['id']][_0xa55c('0x1c')]();}}return _0x940f28[_0xa55c('0xa')];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1d')]=function(){var _0x3cd152=this;return function(_0x1273d7){if(_0x1273d7){freeIsNotKey(_0x1273d7,_0x3cd152['chatQueues'],'id');for(var _0x430d55=0x0,_0x28814f={},_0x1c9f6b={};_0x430d55<_0x1273d7[_0xa55c('0x16')];_0x430d55+=0x1){_0x28814f=_0x1273d7[_0x430d55];if(_['isUndefined'](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']])){_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']]=new ChatQueue(_0x28814f);}else{_0x3cd152[_0xa55c('0x18')](_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']],_0x28814f);}_0x3cd152[_0xa55c('0x1e')][_0x28814f['id']][_0xa55c('0x1b')]();_0x3cd152['chatQueues'][_0x28814f['id']][_0xa55c('0x1c')]();}}return _0x3cd152['chatQueues'];};};Realtime[_0xa55c('0x13')][_0xa55c('0x1f')]=function(){var _0x1cc53e=this;return function(_0x223813){if(_0x223813){freeIsNotKey(_0x223813,_0x1cc53e['smsQueues'],'id');for(var _0x3d28fb=0x0,_0x2096ae={},_0x331e58={};_0x3d28fb<_0x223813[_0xa55c('0x16')];_0x3d28fb+=0x1){_0x2096ae=_0x223813[_0x3d28fb];if(_[_0xa55c('0x17')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']])){_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']]=new SmsQueue(_0x2096ae);}else{_0x1cc53e[_0xa55c('0x18')](_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']],_0x2096ae);}_0x1cc53e[_0xa55c('0xb')][_0x2096ae['id']][_0xa55c('0x1b')]();_0x1cc53e['smsQueues'][_0x2096ae['id']]['updateRealtime']();}}return _0x1cc53e[_0xa55c('0xb')];};};Realtime[_0xa55c('0x13')]['initMailQueues']=function(){var _0x30fadd=this;return function(_0x2f0110){if(_0x2f0110){freeIsNotKey(_0x2f0110,_0x30fadd[_0xa55c('0xc')],'id');for(var _0x1839ac=0x0,_0x30d4f8={},_0x38ff96={};_0x1839ac<_0x2f0110[_0xa55c('0x16')];_0x1839ac+=0x1){_0x30d4f8=_0x2f0110[_0x1839ac];if(_[_0xa55c('0x17')](_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']])){_0x30fadd['mailQueues'][_0x30d4f8['id']]=new MailQueue(_0x30d4f8);}else{_0x30fadd['mergeFromDatabase'](_0x30fadd['mailQueues'][_0x30d4f8['id']],_0x30d4f8);}_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']][_0xa55c('0x1b')]();_0x30fadd[_0xa55c('0xc')][_0x30d4f8['id']]['updateRealtime']();}}return _0x30fadd[_0xa55c('0xc')];};};Realtime['prototype'][_0xa55c('0x20')]=function(){var _0x4ad813=this;return function(_0x18c6f1){if(_0x18c6f1){freeIsNotKey(_0x18c6f1,_0x4ad813[_0xa55c('0x21')],'id');for(var _0x3c0ec1=0x0,_0x4d3eb5={},_0x7c4a47={};_0x3c0ec1<_0x18c6f1[_0xa55c('0x16')];_0x3c0ec1+=0x1){_0x4d3eb5=_0x18c6f1[_0x3c0ec1];if(_['isUndefined'](_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']])){_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]=new FaxQueue(_0x4d3eb5);}else{_0x4ad813['mergeFromDatabase'](_0x4ad813['faxQueues'][_0x4d3eb5['id']],_0x4d3eb5);}_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']]['updateRouting']();_0x4ad813[_0xa55c('0x21')][_0x4d3eb5['id']][_0xa55c('0x1c')]();}}return _0x4ad813['faxQueues'];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x4de781=this;return function(_0x3b3308){if(_0x3b3308){freeIsNotKey(_0x3b3308,_0x4de781[_0xa55c('0xd')],'id');for(var _0x429336=0x0,_0x99c4f8={},_0x2d8cbf={};_0x429336<_0x3b3308['length'];_0x429336+=0x1){_0x99c4f8=_0x3b3308[_0x429336];if(_[_0xa55c('0x17')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']])){_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]=new WhatsappQueue(_0x99c4f8);}else{_0x4de781[_0xa55c('0x18')](_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']],_0x99c4f8);}_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRouting']();_0x4de781[_0xa55c('0xd')][_0x99c4f8['id']]['updateRealtime']();}}return _0x4de781['whatsappQueues'];};};module[_0xa55c('0x22')]=Realtime; \ No newline at end of file +var _0xedd9=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','openchannelQueues','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','exports','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','chatQueues','mailQueues'];(function(_0x3beaf1,_0x33d93f){var _0x4f9102=function(_0x1bc436){while(--_0x1bc436){_0x3beaf1['push'](_0x3beaf1['shift']());}};_0x4f9102(++_0x33d93f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ff414,_0x4f54bc){_0x4ff414=_0x4ff414-0x0;var _0x286feb=_0xedd9[_0x4ff414];return _0x286feb;};'use strict';var BPromise=require('bluebird');var util=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var Agent=require(_0x9edd('0x3'));var Interval=require(_0x9edd('0x4'));var OpenchannelQueue=require(_0x9edd('0x5'));var ChatQueue=require(_0x9edd('0x6'));var SmsQueue=require(_0x9edd('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x9edd('0x8'));var WhatsappQueue=require(_0x9edd('0x9'));var Realtime=function(){this[_0x9edd('0xa')]={};this[_0x9edd('0xb')]={};this['openchannelQueues']={};this[_0x9edd('0xc')]={};this['smsQueues']={};this[_0x9edd('0xd')]={};this[_0x9edd('0xe')]={};this[_0x9edd('0xf')]={};this[_0x9edd('0x10')]={};this['mailQueuesWaitingInteractions']={};this[_0x9edd('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0x9edd('0x12')]={};this[_0x9edd('0x13')]={};};function freeIsNotKey(_0x523026,_0xbf9da6,_0x13dc4f){var _0x5b6c00=_[_0x9edd('0x14')](_0x523026,function(_0x1b73d1,_0x25e64c){return _0x1b73d1[_0x13dc4f];});for(var _0xfd544a in _0xbf9da6){if(_0xbf9da6[_0x9edd('0x15')](_0xfd544a)){if(!_0x5b6c00[_0xfd544a]){delete _0xbf9da6[_0xfd544a];}}}}Realtime[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0xef5498,_0x47eb64){for(var _0x176bfa in _0x47eb64){if(_0xef5498[_0x9edd('0x15')](_0x176bfa)){_0xef5498[_0x176bfa]=_0x47eb64[_0x176bfa];}}};Realtime[_0x9edd('0x16')][_0x9edd('0x18')]=function(){var _0x13b6b6=this;return function(_0x338f3c){if(_0x338f3c){freeIsNotKey(_0x338f3c,_0x13b6b6[_0x9edd('0xa')],'id');for(var _0x75a4ab=0x0,_0x4ea60f={},_0x5f5bf4={};_0x75a4ab<_0x338f3c[_0x9edd('0x19')];_0x75a4ab+=0x1){_0x4ea60f=_0x338f3c[_0x75a4ab];if(_[_0x9edd('0x1a')](_0x13b6b6['agents'][_0x4ea60f['id']])){_0x13b6b6[_0x9edd('0xa')][_0x4ea60f['id']]=new Agent(_0x4ea60f);}else{_0x13b6b6[_0x9edd('0x17')](_0x13b6b6[_0x9edd('0xa')][_0x4ea60f['id']],_0x4ea60f);}}}return _0x13b6b6['agents'];};};Realtime[_0x9edd('0x16')]['initIntervals']=function(){var _0x2cdcef=this;return function(_0x1083e4){if(_0x1083e4){freeIsNotKey(_0x1083e4,_0x2cdcef['intervals'],'id');for(var _0x498977=0x0,_0x45c3ab={},_0x50338f={};_0x498977<_0x1083e4[_0x9edd('0x19')];_0x498977+=0x1){_0x45c3ab=_0x1083e4[_0x498977];if(_['isUndefined'](_0x2cdcef['intervals'][_0x45c3ab['id']])){_0x2cdcef[_0x9edd('0xb')][_0x45c3ab['id']]=new Interval(_0x45c3ab);}else{_0x2cdcef[_0x9edd('0x17')](_0x2cdcef['intervals'][_0x45c3ab['id']],_0x45c3ab);}}}return _0x2cdcef['intervals'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x1b')]=function(){var _0x477878=this;return function(_0x542172){if(_0x542172){freeIsNotKey(_0x542172,_0x477878[_0x9edd('0x1c')],'id');for(var _0x1dca43=0x0,_0x44a6c1={},_0x2ca65f={};_0x1dca43<_0x542172[_0x9edd('0x19')];_0x1dca43+=0x1){_0x44a6c1=_0x542172[_0x1dca43];if(_['isUndefined'](_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']])){_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']]=new OpenchannelQueue(_0x44a6c1);}else{_0x477878[_0x9edd('0x17')](_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']],_0x44a6c1);}_0x477878[_0x9edd('0x1c')][_0x44a6c1['id']]['updateRouting']();_0x477878['openchannelQueues'][_0x44a6c1['id']][_0x9edd('0x1d')]();}}return _0x477878[_0x9edd('0x1c')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x1e')]=function(){var _0x3c2227=this;return function(_0x4fe471){if(_0x4fe471){freeIsNotKey(_0x4fe471,_0x3c2227['chatQueues'],'id');for(var _0x214d0a=0x0,_0x257a26={},_0x1c762c={};_0x214d0a<_0x4fe471['length'];_0x214d0a+=0x1){_0x257a26=_0x4fe471[_0x214d0a];if(_[_0x9edd('0x1a')](_0x3c2227[_0x9edd('0xc')][_0x257a26['id']])){_0x3c2227[_0x9edd('0xc')][_0x257a26['id']]=new ChatQueue(_0x257a26);}else{_0x3c2227[_0x9edd('0x17')](_0x3c2227['chatQueues'][_0x257a26['id']],_0x257a26);}_0x3c2227[_0x9edd('0xc')][_0x257a26['id']][_0x9edd('0x1f')]();_0x3c2227[_0x9edd('0xc')][_0x257a26['id']][_0x9edd('0x1d')]();}}return _0x3c2227[_0x9edd('0xc')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x20')]=function(){var _0x1fba7b=this;return function(_0x19b6c1){if(_0x19b6c1){freeIsNotKey(_0x19b6c1,_0x1fba7b[_0x9edd('0x21')],'id');for(var _0x4fd03f=0x0,_0x138002={},_0x6907a5={};_0x4fd03f<_0x19b6c1[_0x9edd('0x19')];_0x4fd03f+=0x1){_0x138002=_0x19b6c1[_0x4fd03f];if(_[_0x9edd('0x1a')](_0x1fba7b['smsQueues'][_0x138002['id']])){_0x1fba7b[_0x9edd('0x21')][_0x138002['id']]=new SmsQueue(_0x138002);}else{_0x1fba7b[_0x9edd('0x17')](_0x1fba7b[_0x9edd('0x21')][_0x138002['id']],_0x138002);}_0x1fba7b['smsQueues'][_0x138002['id']][_0x9edd('0x1f')]();_0x1fba7b[_0x9edd('0x21')][_0x138002['id']][_0x9edd('0x1d')]();}}return _0x1fba7b[_0x9edd('0x21')];};};Realtime[_0x9edd('0x16')][_0x9edd('0x22')]=function(){var _0x473068=this;return function(_0x438a5d){if(_0x438a5d){freeIsNotKey(_0x438a5d,_0x473068[_0x9edd('0xd')],'id');for(var _0x2539c6=0x0,_0x29e789={},_0x42c1d9={};_0x2539c6<_0x438a5d[_0x9edd('0x19')];_0x2539c6+=0x1){_0x29e789=_0x438a5d[_0x2539c6];if(_[_0x9edd('0x1a')](_0x473068['mailQueues'][_0x29e789['id']])){_0x473068[_0x9edd('0xd')][_0x29e789['id']]=new MailQueue(_0x29e789);}else{_0x473068['mergeFromDatabase'](_0x473068[_0x9edd('0xd')][_0x29e789['id']],_0x29e789);}_0x473068[_0x9edd('0xd')][_0x29e789['id']][_0x9edd('0x1f')]();_0x473068[_0x9edd('0xd')][_0x29e789['id']][_0x9edd('0x1d')]();}}return _0x473068['mailQueues'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x23')]=function(){var _0x2b3469=this;return function(_0x38e9be){if(_0x38e9be){freeIsNotKey(_0x38e9be,_0x2b3469[_0x9edd('0xe')],'id');for(var _0x337e6c=0x0,_0x5c0627={},_0x1cbbac={};_0x337e6c<_0x38e9be[_0x9edd('0x19')];_0x337e6c+=0x1){_0x5c0627=_0x38e9be[_0x337e6c];if(_[_0x9edd('0x1a')](_0x2b3469['faxQueues'][_0x5c0627['id']])){_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']]=new FaxQueue(_0x5c0627);}else{_0x2b3469['mergeFromDatabase'](_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']],_0x5c0627);}_0x2b3469['faxQueues'][_0x5c0627['id']][_0x9edd('0x1f')]();_0x2b3469[_0x9edd('0xe')][_0x5c0627['id']][_0x9edd('0x1d')]();}}return _0x2b3469['faxQueues'];};};Realtime[_0x9edd('0x16')][_0x9edd('0x24')]=function(){var _0x2f8f61=this;return function(_0x48958a){if(_0x48958a){freeIsNotKey(_0x48958a,_0x2f8f61[_0x9edd('0xf')],'id');for(var _0x51ad91=0x0,_0x1fc4fb={},_0xfbc492={};_0x51ad91<_0x48958a['length'];_0x51ad91+=0x1){_0x1fc4fb=_0x48958a[_0x51ad91];if(_[_0x9edd('0x1a')](_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']])){_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']]=new WhatsappQueue(_0x1fc4fb);}else{_0x2f8f61[_0x9edd('0x17')](_0x2f8f61['whatsappQueues'][_0x1fc4fb['id']],_0x1fc4fb);}_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']]['updateRouting']();_0x2f8f61[_0x9edd('0xf')][_0x1fc4fb['id']][_0x9edd('0x1d')]();}}return _0x2f8f61['whatsappQueues'];};};module[_0x9edd('0x25')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index a5ec678..b8fbad2 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 _0x2669=['addTags','addTagsToChatInteraction','update','Request','updateChatInteraction'];(function(_0x1a2021,_0x1c1228){var _0x16fa06=function(_0x52d717){while(--_0x52d717){_0x1a2021['push'](_0x1a2021['shift']());}};_0x16fa06(++_0x1c1228);}(_0x2669,0x188));var _0x9266=function(_0xa8f776,_0x420cbf){_0xa8f776=_0xa8f776-0x0;var _0x435961=_0x2669[_0xa8f776];return _0x435961;};'use strict';var client=require('../client');exports[_0x9266('0x0')]=function(_0x4cccfe,_0x4b7652){return client[_0x9266('0x1')]('UpdateChatInteraction',{'body':_0x4b7652,'options':{'where':{'id':_0x4cccfe}},'log':_0x9266('0x2')});};exports[_0x9266('0x3')]=function(_0x39838b,_0x387325){return client[_0x9266('0x1')]('AddTagsToChatInteraction',{'body':_0x387325,'options':{'where':{'id':_0x39838b}},'log':_0x9266('0x4')});}; \ No newline at end of file +var _0x4af0=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4af0,0xc7));var _0x04af=function(_0x360fc0,_0x131d38){_0x360fc0=_0x360fc0-0x0;var _0x23e8a1=_0x4af0[_0x360fc0];return _0x23e8a1;};'use strict';var client=require(_0x04af('0x0'));exports[_0x04af('0x1')]=function(_0x513506,_0x269aae){return client[_0x04af('0x2')](_0x04af('0x3'),{'body':_0x269aae,'options':{'where':{'id':_0x513506}},'log':_0x04af('0x4')});};exports[_0x04af('0x5')]=function(_0x37e639,_0x1efba2){return client[_0x04af('0x2')](_0x04af('0x6'),{'body':_0x1efba2,'options':{'where':{'id':_0x37e639}},'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 5e8bef9..548ce8c 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 _0xfbce=['../client','CreateChatMessage','createChatMessage'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xfbce,0x8d));var _0xefbc=function(_0x1b3ddb,_0x190f99){_0x1b3ddb=_0x1b3ddb-0x0;var _0x3b952d=_0xfbce[_0x1b3ddb];return _0x3b952d;};'use strict';var client=require(_0xefbc('0x0'));exports['create']=function(_0x68f71f){return client['Request'](_0xefbc('0x1'),{'body':_0x68f71f,'log':_0xefbc('0x2')});}; \ No newline at end of file +var _0xf583=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x365fe8,_0x5df6c8){var _0x59d121=function(_0x599557){while(--_0x599557){_0x365fe8['push'](_0x365fe8['shift']());}};_0x59d121(++_0x5df6c8);}(_0xf583,0xb1));var _0x3f58=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xf583[_0x4b4f24];return _0x1c13d4;};'use strict';var client=require(_0x3f58('0x0'));exports['create']=function(_0x595429){return client[_0x3f58('0x1')](_0x3f58('0x2'),{'body':_0x595429,'log':_0x3f58('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index de46907..4373598 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 _0xe46e=['../client','Request','GetChatQueue','name','timeout','Agents','online','getChatQueues'];(function(_0x4c0998,_0x165050){var _0x1110e2=function(_0x7cb8c3){while(--_0x7cb8c3){_0x4c0998['push'](_0x4c0998['shift']());}};_0x1110e2(++_0x165050);}(_0xe46e,0x180));var _0xee46=function(_0x2de1ec,_0x315e8e){_0x2de1ec=_0x2de1ec-0x0;var _0x152595=_0xe46e[_0x2de1ec];return _0x152595;};'use strict';var client=require(_0xee46('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xee46('0x1')](_0xee46('0x2'),{'options':{'raw':![],'attributes':['id',_0xee46('0x3'),_0xee46('0x4'),'strategy'],'include':[{'model':'User','as':_0xee46('0x5'),'attributes':['id',_0xee46('0x3'),_0xee46('0x6'),'chatPause']}]},'log':_0xee46('0x7')});};}; \ No newline at end of file +var _0x5960=['User','name','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0xeddee2,_0xc88424){var _0x565e11=function(_0x56eb76){while(--_0x56eb76){_0xeddee2['push'](_0xeddee2['shift']());}};_0x565e11(++_0xc88424);}(_0x5960,0x146));var _0x0596=function(_0x4d7ccb,_0x391cc8){_0x4d7ccb=_0x4d7ccb-0x0;var _0x41db3b=_0x5960[_0x4d7ccb];return _0x41db3b;};'use strict';var client=require('../client');exports[_0x0596('0x0')]=function(){return function(){return client[_0x0596('0x1')](_0x0596('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0596('0x3'),'as':'Agents','attributes':['id',_0x0596('0x4'),_0x0596('0x5'),_0x0596('0x6')]}]},'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 dbffd1d..441e6f5 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 _0x49c4=['Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x49c4,0x9b));var _0x449c=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x49c4[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0x449c('0x0'));exports['create']=function(_0x47c5a9){return client[_0x449c('0x1')](_0x449c('0x2'),{'body':_0x47c5a9,'log':_0x449c('0x2')});};exports[_0x449c('0x3')]=function(_0x16e006,_0x23314e){return client['Request']('UpdateChatQueueReport',{'body':_0x23314e,'options':{'where':{'uniqueid':_0x16e006},'order':[['id',_0x449c('0x4')]],'limit':0x1},'log':_0x449c('0x5')});}; \ No newline at end of file +var _0x3fc6=['update','Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x54de3f,_0x8aa4e8){var _0x7995f6=function(_0x3e5b14){while(--_0x3e5b14){_0x54de3f['push'](_0x54de3f['shift']());}};_0x7995f6(++_0x8aa4e8);}(_0x3fc6,0x159));var _0x63fc=function(_0x2b06c5,_0x5778dc){_0x2b06c5=_0x2b06c5-0x0;var _0xdf41d8=_0x3fc6[_0x2b06c5];return _0xdf41d8;};'use strict';var client=require(_0x63fc('0x0'));exports[_0x63fc('0x1')]=function(_0x2ef9ab){return client['Request'](_0x63fc('0x2'),{'body':_0x2ef9ab,'log':_0x63fc('0x2')});};exports[_0x63fc('0x3')]=function(_0x133695,_0x155db7){return client[_0x63fc('0x4')]('UpdateChatQueueReport',{'body':_0x155db7,'options':{'where':{'uniqueid':_0x133695},'order':[['id','DESC']],'limit':0x1},'log':_0x63fc('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 040f746..497d77e 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 _0x870d=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x27689b,_0x207195){var _0x10c86b=function(_0x411ede){while(--_0x411ede){_0x27689b['push'](_0x27689b['shift']());}};_0x10c86b(++_0x207195);}(_0x870d,0x1eb));var _0xd870=function(_0x5bca71,_0x592224){_0x5bca71=_0x5bca71-0x0;var _0x2440e2=_0x870d[_0x5bca71];return _0x2440e2;};'use strict';var client=require(_0xd870('0x0'));exports[_0xd870('0x1')]=function(_0x4da954,_0x4337c4){return client['Request'](_0xd870('0x2'),{'body':_0x4337c4,'options':{'where':{'id':_0x4da954}},'log':_0xd870('0x3')});};exports[_0xd870('0x4')]=function(_0x15f2dc,_0x43999f){return client[_0xd870('0x5')](_0xd870('0x6'),{'body':_0x43999f,'options':{'where':{'id':_0x15f2dc}},'log':_0xd870('0x7')});}; \ No newline at end of file +var _0x399c=['addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x11963b,_0x5d2da7){var _0x5d451e=function(_0x41e9e5){while(--_0x41e9e5){_0x11963b['push'](_0x11963b['shift']());}};_0x5d451e(++_0x5d2da7);}(_0x399c,0x1cf));var _0xc399=function(_0x32ecc4,_0x29612f){_0x32ecc4=_0x32ecc4-0x0;var _0x509cfc=_0x399c[_0x32ecc4];return _0x509cfc;};'use strict';var client=require(_0xc399('0x0'));exports['update']=function(_0x18028b,_0x3a7ab5){return client[_0xc399('0x1')](_0xc399('0x2'),{'body':_0x3a7ab5,'options':{'where':{'id':_0x18028b}},'log':_0xc399('0x3')});};exports[_0xc399('0x4')]=function(_0x4230f9,_0x372195){return client['Request'](_0xc399('0x5'),{'body':_0x372195,'options':{'where':{'id':_0x4230f9}},'log':_0xc399('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 28fcfc4..5cbcf3c 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 _0xdd4c=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xdd4c,0x8d));var _0xcdd4=function(_0x2a5da5,_0x5d34e5){_0x2a5da5=_0x2a5da5-0x0;var _0x715df1=_0xdd4c[_0x2a5da5];return _0x715df1;};'use strict';var client=require('../client');exports[_0xcdd4('0x0')]=function(_0x1cca3f){return client[_0xcdd4('0x1')](_0xcdd4('0x2'),{'body':_0x1cca3f,'log':_0xcdd4('0x3')});}; \ No newline at end of file +var _0x2b10=['Request','../client','create'];(function(_0x4e346a,_0x1ba060){var _0x12ac3a=function(_0xbf09f5){while(--_0xbf09f5){_0x4e346a['push'](_0x4e346a['shift']());}};_0x12ac3a(++_0x1ba060);}(_0x2b10,0xeb));var _0x02b1=function(_0x4db9ba,_0x502d89){_0x4db9ba=_0x4db9ba-0x0;var _0x3f716f=_0x2b10[_0x4db9ba];return _0x3f716f;};'use strict';var client=require(_0x02b1('0x0'));exports[_0x02b1('0x1')]=function(_0x487332){return client[_0x02b1('0x2')]('CreateFaxMessage',{'body':_0x487332,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 401e62e..139fb19 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 _0xee25=['timeout','User','Agents','online','faxPause','getFaxQueues','GetFaxQueue','name'];(function(_0x12c178,_0x35a3f6){var _0x504051=function(_0x276053){while(--_0x276053){_0x12c178['push'](_0x12c178['shift']());}};_0x504051(++_0x35a3f6);}(_0xee25,0x8d));var _0x5ee2=function(_0x1759d8,_0x3bb3c7){_0x1759d8=_0x1759d8-0x0;var _0x560ed1=_0xee25[_0x1759d8];return _0x560ed1;};'use strict';var client=require('../client');exports[_0x5ee2('0x0')]=function(){return function(){return client['Request'](_0x5ee2('0x1'),{'options':{'raw':![],'attributes':['id',_0x5ee2('0x2'),_0x5ee2('0x3'),'strategy'],'include':[{'model':_0x5ee2('0x4'),'as':_0x5ee2('0x5'),'attributes':['id',_0x5ee2('0x2'),_0x5ee2('0x6'),_0x5ee2('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x9066=['name','timeout','strategy','User','Agents','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x6c40ba,_0x5e39fa){var _0x7a54dd=function(_0x166452){while(--_0x166452){_0x6c40ba['push'](_0x6c40ba['shift']());}};_0x7a54dd(++_0x5e39fa);}(_0x9066,0x1d1));var _0x6906=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9066[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports[_0x6906('0x0')]=function(){return function(){return client[_0x6906('0x1')](_0x6906('0x2'),{'options':{'raw':![],'attributes':['id',_0x6906('0x3'),_0x6906('0x4'),_0x6906('0x5')],'include':[{'model':_0x6906('0x6'),'as':_0x6906('0x7'),'attributes':['id','name','online',_0x6906('0x8')]}]},'log':_0x6906('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index eb5f066..a8fdd8e 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 _0x5da8=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x392dc7,_0x2b5c91){var _0x440de9=function(_0xddb25b){while(--_0xddb25b){_0x392dc7['push'](_0x392dc7['shift']());}};_0x440de9(++_0x2b5c91);}(_0x5da8,0x1b0));var _0x85da=function(_0x3875e9,_0x8c1f0c){_0x3875e9=_0x3875e9-0x0;var _0x168265=_0x5da8[_0x3875e9];return _0x168265;};'use strict';var client=require(_0x85da('0x0'));exports[_0x85da('0x1')]=function(_0x90fa12){return client[_0x85da('0x2')](_0x85da('0x3'),{'body':_0x90fa12,'log':_0x85da('0x3')});};exports[_0x85da('0x4')]=function(_0x1c3876,_0x36d402){return client[_0x85da('0x2')](_0x85da('0x5'),{'body':_0x36d402,'options':{'where':{'uniqueid':_0x1c3876},'order':[['id',_0x85da('0x6')]],'limit':0x1},'log':_0x85da('0x5')});}; \ No newline at end of file +var _0xe011=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xe011,0x14c));var _0x1e01=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe011[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require(_0x1e01('0x0'));exports[_0x1e01('0x1')]=function(_0x3e94c1){return client[_0x1e01('0x2')](_0x1e01('0x3'),{'body':_0x3e94c1,'log':'CreateFaxQueueReport'});};exports[_0x1e01('0x4')]=function(_0x567134,_0x3147fb){return client[_0x1e01('0x2')](_0x1e01('0x5'),{'body':_0x3147fb,'options':{'where':{'uniqueid':_0x567134},'order':[['id',_0x1e01('0x6')]],'limit':0x1},'log':_0x1e01('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index da937b4..c8ffe4a 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 _0x01d3=['interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x2baa60,_0xf1dd85){var _0x459792=function(_0x51d329){while(--_0x51d329){_0x2baa60['push'](_0x2baa60['shift']());}};_0x459792(++_0xf1dd85);}(_0x01d3,0xa2));var _0x301d=function(_0x5d07a7,_0x43ff2e){_0x5d07a7=_0x5d07a7-0x0;var _0x95d216=_0x01d3[_0x5d07a7];return _0x95d216;};'use strict';var client=require(_0x301d('0x0'));exports[_0x301d('0x1')]=function(){return function(){return client[_0x301d('0x2')](_0x301d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x301d('0x4'),'as':_0x301d('0x5'),'attributes':['id','name',_0x301d('0x6')]}]},'log':_0x301d('0x1')});};}; \ No newline at end of file +var _0xda3f=['getIntervals','Request','Intervals','interval'];(function(_0x4800d3,_0x36d075){var _0x2199cf=function(_0x318ceb){while(--_0x318ceb){_0x4800d3['push'](_0x4800d3['shift']());}};_0x2199cf(++_0x36d075);}(_0xda3f,0xec));var _0xfda3=function(_0x18124b,_0x578dbe){_0x18124b=_0x18124b-0x0;var _0x3179ee=_0xda3f[_0x18124b];return _0x3179ee;};'use strict';var client=require('../client');exports[_0xfda3('0x0')]=function(){return function(){return client[_0xfda3('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xfda3('0x2'),'attributes':['id','name',_0xfda3('0x3')]}]},'log':_0xfda3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index dc041c1..8285b9f 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 _0x54e3=['Request','addTagsToChatInteraction','../client','updateMailInteraction','addTags'];(function(_0x524615,_0x6470f5){var _0x49fd51=function(_0x24d299){while(--_0x24d299){_0x524615['push'](_0x524615['shift']());}};_0x49fd51(++_0x6470f5);}(_0x54e3,0x124));var _0x354e=function(_0x1bc20d,_0x2ea2db){_0x1bc20d=_0x1bc20d-0x0;var _0x131e17=_0x54e3[_0x1bc20d];return _0x131e17;};'use strict';var client=require(_0x354e('0x0'));exports['update']=function(_0xe23b4d,_0x283dcb){return client['Request']('UpdateMailInteraction',{'body':_0x283dcb,'options':{'where':{'id':_0xe23b4d}},'log':_0x354e('0x1')});};exports[_0x354e('0x2')]=function(_0x54b971,_0x338bac){return client[_0x354e('0x3')]('AddTagsToMailInteraction',{'body':_0x338bac,'options':{'where':{'id':_0x54b971}},'log':_0x354e('0x4')});}; \ No newline at end of file +var _0x8280=['addTags','Request','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x4a2129,_0x3417a7){var _0x1bc59b=function(_0x3d8a3a){while(--_0x3d8a3a){_0x4a2129['push'](_0x4a2129['shift']());}};_0x1bc59b(++_0x3417a7);}(_0x8280,0x1ad));var _0x0828=function(_0x16683a,_0x460dca){_0x16683a=_0x16683a-0x0;var _0x480406=_0x8280[_0x16683a];return _0x480406;};'use strict';var client=require('../client');exports[_0x0828('0x0')]=function(_0x4ec1d4,_0x4515b0){return client['Request'](_0x0828('0x1'),{'body':_0x4515b0,'options':{'where':{'id':_0x4ec1d4}},'log':_0x0828('0x2')});};exports[_0x0828('0x3')]=function(_0x493447,_0x299d71){return client[_0x0828('0x4')]('AddTagsToMailInteraction',{'body':_0x299d71,'options':{'where':{'id':_0x493447}},'log':_0x0828('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3ee8e0d..5aa8b8f 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 _0xe5b6=['Request','../client','create'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xe5b6,0x70));var _0x6e5b=function(_0x242b7c,_0x5a0fde){_0x242b7c=_0x242b7c-0x0;var _0x4e9563=_0xe5b6[_0x242b7c];return _0x4e9563;};'use strict';var client=require(_0x6e5b('0x0'));exports[_0x6e5b('0x1')]=function(_0x2c415b){return client[_0x6e5b('0x2')]('CreateMailMessage',{'body':_0x2c415b,'log':'createMailMessage'});}; \ No newline at end of file +var _0x26ab=['CreateMailMessage','createMailMessage','create'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x26ab,0x194));var _0xb26a=function(_0x39ead1,_0x4b4ed6){_0x39ead1=_0x39ead1-0x0;var _0x4fa944=_0x26ab[_0x39ead1];return _0x4fa944;};'use strict';var client=require('../client');exports[_0xb26a('0x0')]=function(_0x3ce9d7){return client['Request'](_0xb26a('0x1'),{'body':_0x3ce9d7,'log':_0xb26a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e4163e2..6a28e85 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 _0x5775=['name','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x5be901,_0x3d0145){var _0x194714=function(_0x4e8d4d){while(--_0x4e8d4d){_0x5be901['push'](_0x5be901['shift']());}};_0x194714(++_0x3d0145);}(_0x5775,0x15b));var _0x5577=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x5775[_0x34325b];return _0x3da348;};'use strict';var client=require(_0x5577('0x0'));exports[_0x5577('0x1')]=function(){return function(){return client['Request'](_0x5577('0x2'),{'options':{'raw':![],'attributes':['id',_0x5577('0x3'),'timeout','strategy'],'include':[{'model':'User','as':_0x5577('0x4'),'attributes':['id','name',_0x5577('0x5'),_0x5577('0x6')]}]},'log':_0x5577('0x1')});};}; \ No newline at end of file +var _0x6c14=['strategy','Agents','online','mailPause','getMailQueues','Request','name','timeout'];(function(_0x38c543,_0x25829d){var _0x50bb63=function(_0x2b8aeb){while(--_0x2b8aeb){_0x38c543['push'](_0x38c543['shift']());}};_0x50bb63(++_0x25829d);}(_0x6c14,0x18c));var _0x46c1=function(_0x838c7,_0x38e5a4){_0x838c7=_0x838c7-0x0;var _0xc4d590=_0x6c14[_0x838c7];return _0xc4d590;};'use strict';var client=require('../client');exports[_0x46c1('0x0')]=function(){return function(){return client[_0x46c1('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x46c1('0x2'),_0x46c1('0x3'),_0x46c1('0x4')],'include':[{'model':'User','as':_0x46c1('0x5'),'attributes':['id',_0x46c1('0x2'),_0x46c1('0x6'),_0x46c1('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 92ead0f..2492052 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 _0x2477=['UpdateMailQueueReport','../client','CreateMailQueueReport','update','Request'];(function(_0x591935,_0x3a04f5){var _0x59bffa=function(_0x13f499){while(--_0x13f499){_0x591935['push'](_0x591935['shift']());}};_0x59bffa(++_0x3a04f5);}(_0x2477,0x187));var _0x7247=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0x2477[_0x2b152a];return _0x2ad4c7;};'use strict';var client=require(_0x7247('0x0'));exports['create']=function(_0x407f56){return client['Request'](_0x7247('0x1'),{'body':_0x407f56,'log':'CreateMailQueueReport'});};exports[_0x7247('0x2')]=function(_0x5e4451,_0x3b33f0){return client[_0x7247('0x3')](_0x7247('0x4'),{'body':_0x3b33f0,'options':{'where':{'uniqueid':_0x5e4451},'order':[['id','DESC']],'limit':0x1},'log':_0x7247('0x4')});}; \ No newline at end of file +var _0x06ce=['../client','create','Request','update','UpdateMailQueueReport','DESC'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x06ce,0x18c));var _0xe06c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x06ce[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0xe06c('0x0'));exports[_0xe06c('0x1')]=function(_0x2d2e1e){return client[_0xe06c('0x2')]('CreateMailQueueReport',{'body':_0x2d2e1e,'log':'CreateMailQueueReport'});};exports[_0xe06c('0x3')]=function(_0x1acf4c,_0xe0fcb1){return client['Request'](_0xe06c('0x4'),{'body':_0xe0fcb1,'options':{'where':{'uniqueid':_0x1acf4c},'order':[['id',_0xe06c('0x5')]],'limit':0x1},'log':_0xe06c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 7b24b21..d9bcb1d 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 _0xa225=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','updateOpenchannelInteraction'];(function(_0x4eba62,_0x54477a){var _0x246083=function(_0x5e575f){while(--_0x5e575f){_0x4eba62['push'](_0x4eba62['shift']());}};_0x246083(++_0x54477a);}(_0xa225,0xd5));var _0x5a22=function(_0x6f723e,_0x136bd0){_0x6f723e=_0x6f723e-0x0;var _0x2afaa1=_0xa225[_0x6f723e];return _0x2afaa1;};'use strict';var client=require(_0x5a22('0x0'));exports['update']=function(_0x168b15,_0x3bf85e){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x3bf85e,'options':{'where':{'id':_0x168b15}},'log':_0x5a22('0x1')});};exports[_0x5a22('0x2')]=function(_0x29a571,_0x3f9f77){return client['Request'](_0x5a22('0x3'),{'body':_0x3f9f77,'options':{'where':{'id':_0x29a571}},'log':_0x5a22('0x4')});}; \ No newline at end of file +var _0x775e=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3f9be1,_0x5dca1){var _0x257fe6=function(_0x515578){while(--_0x515578){_0x3f9be1['push'](_0x3f9be1['shift']());}};_0x257fe6(++_0x5dca1);}(_0x775e,0x65));var _0xe775=function(_0x247033,_0xb9809d){_0x247033=_0x247033-0x0;var _0x6c7529=_0x775e[_0x247033];return _0x6c7529;};'use strict';var client=require(_0xe775('0x0'));exports[_0xe775('0x1')]=function(_0x384e9e,_0xc90fc8){return client[_0xe775('0x2')](_0xe775('0x3'),{'body':_0xc90fc8,'options':{'where':{'id':_0x384e9e}},'log':_0xe775('0x4')});};exports[_0xe775('0x5')]=function(_0x1b693b,_0x21c3bc){return client[_0xe775('0x2')](_0xe775('0x6'),{'body':_0x21c3bc,'options':{'where':{'id':_0x1b693b}},'log':_0xe775('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f2dd08a..84a403f 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 _0xcb91=['CreateOpenchannelMessage','createOpenchannelMessage','Request'];(function(_0x12287b,_0x24974c){var _0x3e7605=function(_0x589485){while(--_0x589485){_0x12287b['push'](_0x12287b['shift']());}};_0x3e7605(++_0x24974c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xcb91[_0x3f2d02];return _0x54092b;};'use strict';var client=require('../client');exports['create']=function(_0x26fe42){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'body':_0x26fe42,'log':_0x1cb9('0x2')});}; \ No newline at end of file +var _0x9bde=['create','Request','createOpenchannelMessage'];(function(_0x376da1,_0x44127f){var _0x1d9f50=function(_0x3c6790){while(--_0x3c6790){_0x376da1['push'](_0x376da1['shift']());}};_0x1d9f50(++_0x44127f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5a93e3,_0x3893ce){_0x5a93e3=_0x5a93e3-0x0;var _0x381d2d=_0x9bde[_0x5a93e3];return _0x381d2d;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(_0x4defda){return client[_0xe9bd('0x1')]('CreateOpenchannelMessage',{'body':_0x4defda,'log':_0xe9bd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7e3cfee..ac9e810 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 _0x06b0=['../client','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x51dfe2,_0xa2a9e){var _0x478344=function(_0x1df303){while(--_0x1df303){_0x51dfe2['push'](_0x51dfe2['shift']());}};_0x478344(++_0xa2a9e);}(_0x06b0,0xd1));var _0x006b=function(_0x5f572e,_0xa8ae3f){_0x5f572e=_0x5f572e-0x0;var _0x5e65dc=_0x06b0[_0x5f572e];return _0x5e65dc;};'use strict';var client=require(_0x006b('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x006b('0x1')](_0x006b('0x2'),{'options':{'raw':![],'attributes':['id',_0x006b('0x3'),_0x006b('0x4'),_0x006b('0x5')],'include':[{'model':_0x006b('0x6'),'as':_0x006b('0x7'),'attributes':['id',_0x006b('0x3'),_0x006b('0x8'),_0x006b('0x9')]}]},'log':_0x006b('0xa')});};}; \ No newline at end of file +var _0x5744=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x5744,0x1cf));var _0x4574=function(_0x3a33b3,_0x1e6c9e){_0x3a33b3=_0x3a33b3-0x0;var _0x2057b3=_0x5744[_0x3a33b3];return _0x2057b3;};'use strict';var client=require(_0x4574('0x0'));exports[_0x4574('0x1')]=function(){return function(){return client[_0x4574('0x2')](_0x4574('0x3'),{'options':{'raw':![],'attributes':['id',_0x4574('0x4'),_0x4574('0x5'),_0x4574('0x6')],'include':[{'model':_0x4574('0x7'),'as':_0x4574('0x8'),'attributes':['id',_0x4574('0x4'),_0x4574('0x9'),_0x4574('0xa')]}]},'log':_0x4574('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f8242c4..a359111 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 _0x102a=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x428301,_0x439ef9){var _0x1d1ada=function(_0xeab08a){while(--_0xeab08a){_0x428301['push'](_0x428301['shift']());}};_0x1d1ada(++_0x439ef9);}(_0x102a,0x1e4));var _0xa102=function(_0x5f44b9,_0x368af6){_0x5f44b9=_0x5f44b9-0x0;var _0x551ab9=_0x102a[_0x5f44b9];return _0x551ab9;};'use strict';var client=require(_0xa102('0x0'));exports[_0xa102('0x1')]=function(_0x51d44b){return client[_0xa102('0x2')]('CreateOpenchannelQueueReport',{'body':_0x51d44b,'log':_0xa102('0x3')});};exports['update']=function(_0x386b44,_0x257660){return client[_0xa102('0x2')](_0xa102('0x4'),{'body':_0x257660,'options':{'where':{'uniqueid':_0x386b44},'order':[['id',_0xa102('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x3830=['update','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x645adc,_0x23ab56){var _0x253557=function(_0x1852b9){while(--_0x1852b9){_0x645adc['push'](_0x645adc['shift']());}};_0x253557(++_0x23ab56);}(_0x3830,0x18a));var _0x0383=function(_0x1d5ce7,_0x213179){_0x1d5ce7=_0x1d5ce7-0x0;var _0x58141b=_0x3830[_0x1d5ce7];return _0x58141b;};'use strict';var client=require(_0x0383('0x0'));exports[_0x0383('0x1')]=function(_0x4193be){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x4193be,'log':'CreateOpenchannelQueueReport'});};exports[_0x0383('0x2')]=function(_0x557404,_0x494f65){return client[_0x0383('0x3')](_0x0383('0x4'),{'body':_0x494f65,'options':{'where':{'uniqueid':_0x557404},'order':[['id',_0x0383('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e4b8d02..6f822c6 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 _0x2913=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x26afc5,_0x49844c){var _0x11d9aa=function(_0x504e89){while(--_0x504e89){_0x26afc5['push'](_0x26afc5['shift']());}};_0x11d9aa(++_0x49844c);}(_0x2913,0x123));var _0x3291=function(_0x4b93cd,_0x23cd51){_0x4b93cd=_0x4b93cd-0x0;var _0x3b6ad5=_0x2913[_0x4b93cd];return _0x3b6ad5;};'use strict';var client=require('../client');exports['update']=function(_0x38c4ef,_0x10a850){return client['Request'](_0x3291('0x0'),{'body':_0x10a850,'options':{'where':{'id':_0x38c4ef}},'log':_0x3291('0x1')});};exports[_0x3291('0x2')]=function(_0x1cb732,_0x22e946){return client[_0x3291('0x3')](_0x3291('0x4'),{'body':_0x22e946,'options':{'where':{'id':_0x1cb732}},'log':_0x3291('0x5')});}; \ No newline at end of file +var _0x4757=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4757,0x1c2));var _0x7475=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x4757[_0x38854e];return _0x3f8415;};'use strict';var client=require('../client');exports['update']=function(_0x38a4e3,_0x2cbc93){return client['Request'](_0x7475('0x0'),{'body':_0x2cbc93,'options':{'where':{'id':_0x38a4e3}},'log':_0x7475('0x1')});};exports[_0x7475('0x2')]=function(_0xb11762,_0x58c33d){return client[_0x7475('0x3')](_0x7475('0x4'),{'body':_0x58c33d,'options':{'where':{'id':_0xb11762}},'log':_0x7475('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 6dc6183..7d8d35a 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 _0x5615=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5615,0xa0));var _0x5561=function(_0x3d78dc,_0x190ed6){_0x3d78dc=_0x3d78dc-0x0;var _0x527293=_0x5615[_0x3d78dc];return _0x527293;};'use strict';var client=require(_0x5561('0x0'));exports[_0x5561('0x1')]=function(_0x529110){return client['Request'](_0x5561('0x2'),{'body':_0x529110,'log':_0x5561('0x3')});}; \ No newline at end of file +var _0xec60=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x8b12ff,_0x305f98){var _0xf2262a=function(_0x176cfd){while(--_0x176cfd){_0x8b12ff['push'](_0x8b12ff['shift']());}};_0xf2262a(++_0x305f98);}(_0xec60,0x1de));var _0x0ec6=function(_0xd828a0,_0x31cae9){_0xd828a0=_0xd828a0-0x0;var _0x40ad4c=_0xec60[_0xd828a0];return _0x40ad4c;};'use strict';var client=require(_0x0ec6('0x0'));exports[_0x0ec6('0x1')]=function(_0x30a41b){return client[_0x0ec6('0x2')](_0x0ec6('0x3'),{'body':_0x30a41b,'log':_0x0ec6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 265991a..63190d7 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 _0x48f5=['User','Agents','online','smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','strategy'];(function(_0x321157,_0x25090c){var _0x11e86c=function(_0x6ae52c){while(--_0x6ae52c){_0x321157['push'](_0x321157['shift']());}};_0x11e86c(++_0x25090c);}(_0x48f5,0x68));var _0x548f=function(_0x321665,_0x44fbde){_0x321665=_0x321665-0x0;var _0x3dab65=_0x48f5[_0x321665];return _0x3dab65;};'use strict';var client=require(_0x548f('0x0'));exports[_0x548f('0x1')]=function(){return function(){return client[_0x548f('0x2')](_0x548f('0x3'),{'options':{'raw':![],'attributes':['id',_0x548f('0x4'),'timeout',_0x548f('0x5')],'include':[{'model':_0x548f('0x6'),'as':_0x548f('0x7'),'attributes':['id','name',_0x548f('0x8'),_0x548f('0x9')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xde46=['smsPause','../client','getSmsQueues','Request','GetSmsQueue','strategy','Agents','name','online'];(function(_0x4186da,_0x1c2c81){var _0x283bbb=function(_0x597ba1){while(--_0x597ba1){_0x4186da['push'](_0x4186da['shift']());}};_0x283bbb(++_0x1c2c81);}(_0xde46,0x14e));var _0x6de4=function(_0x445949,_0x1fe15e){_0x445949=_0x445949-0x0;var _0x7e3d84=_0xde46[_0x445949];return _0x7e3d84;};'use strict';var client=require(_0x6de4('0x0'));exports[_0x6de4('0x1')]=function(){return function(){return client[_0x6de4('0x2')](_0x6de4('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x6de4('0x4')],'include':[{'model':'User','as':_0x6de4('0x5'),'attributes':['id',_0x6de4('0x6'),_0x6de4('0x7'),_0x6de4('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index e34b3fd..46dd217 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 _0x62b7=['CreateSmsQueueReport','UpdateSmsQueueReport','../client','create','Request'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x62b7,0x179));var _0x762b=function(_0x5ec09d,_0x391827){_0x5ec09d=_0x5ec09d-0x0;var _0x304aae=_0x62b7[_0x5ec09d];return _0x304aae;};'use strict';var client=require(_0x762b('0x0'));exports[_0x762b('0x1')]=function(_0xf532e9){return client[_0x762b('0x2')](_0x762b('0x3'),{'body':_0xf532e9,'log':_0x762b('0x3')});};exports['update']=function(_0x25ea19,_0x587d18){return client[_0x762b('0x2')](_0x762b('0x4'),{'body':_0x587d18,'options':{'where':{'uniqueid':_0x25ea19},'order':[['id','DESC']],'limit':0x1},'log':_0x762b('0x4')});}; \ No newline at end of file +var _0xbc8a=['UpdateSmsQueueReport','create','Request','CreateSmsQueueReport','update','DESC'];(function(_0xe3f787,_0x3575bb){var _0x51e48b=function(_0x298f50){while(--_0x298f50){_0xe3f787['push'](_0xe3f787['shift']());}};_0x51e48b(++_0x3575bb);}(_0xbc8a,0xd3));var _0xabc8=function(_0x291b8c,_0x6b7ed8){_0x291b8c=_0x291b8c-0x0;var _0x22ba34=_0xbc8a[_0x291b8c];return _0x22ba34;};'use strict';var client=require('../client');exports[_0xabc8('0x0')]=function(_0x2b3c4e){return client[_0xabc8('0x1')](_0xabc8('0x2'),{'body':_0x2b3c4e,'log':'CreateSmsQueueReport'});};exports[_0xabc8('0x3')]=function(_0x8310d5,_0x21a814){return client['Request']('UpdateSmsQueueReport',{'body':_0x21a814,'options':{'where':{'uniqueid':_0x8310d5},'order':[['id',_0xabc8('0x4')]],'limit':0x1},'log':_0xabc8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2a54558..8b6ec03 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 _0xa1d3=['smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','GetUser','agent','name','online','pauseType','lastPauseAt','mailPause'];(function(_0x6ef1a7,_0x388ae9){var _0x48e84a=function(_0x2f40f0){while(--_0x2f40f0){_0x6ef1a7['push'](_0x6ef1a7['shift']());}};_0x48e84a(++_0x388ae9);}(_0xa1d3,0x1b1));var _0x3a1d=function(_0x514299,_0x44a553){_0x514299=_0x514299-0x0;var _0x453188=_0xa1d3[_0x514299];return _0x453188;};'use strict';var client=require(_0x3a1d('0x0'));exports[_0x3a1d('0x1')]=function(){return function(){return client['Request'](_0x3a1d('0x2'),{'options':{'raw':!![],'where':{'role':_0x3a1d('0x3')},'attributes':['id',_0x3a1d('0x4'),_0x3a1d('0x5'),_0x3a1d('0x6'),_0x3a1d('0x7'),'voicePause','chatPause',_0x3a1d('0x8'),'faxPause',_0x3a1d('0x9'),_0x3a1d('0xa'),_0x3a1d('0xb'),_0x3a1d('0xc'),_0x3a1d('0xd'),_0x3a1d('0xe'),_0x3a1d('0xf'),_0x3a1d('0x10'),'openchannelCapacity']},'log':'getAgents'});};}; \ No newline at end of file +var _0xcde6=['whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','mailPause','faxPause','whatsappPause','openchannelPause','chatCapacity'];(function(_0x1d1b2c,_0x5380ee){var _0x4dc377=function(_0x241061){while(--_0x241061){_0x1d1b2c['push'](_0x1d1b2c['shift']());}};_0x4dc377(++_0x5380ee);}(_0xcde6,0x82));var _0x6cde=function(_0x166e2c,_0xca9174){_0x166e2c=_0x166e2c-0x0;var _0xc0387f=_0xcde6[_0x166e2c];return _0xc0387f;};'use strict';var client=require(_0x6cde('0x0'));exports[_0x6cde('0x1')]=function(){return function(){return client[_0x6cde('0x2')](_0x6cde('0x3'),{'options':{'raw':!![],'where':{'role':_0x6cde('0x4')},'attributes':['id',_0x6cde('0x5'),'online',_0x6cde('0x6'),_0x6cde('0x7'),_0x6cde('0x8'),'chatPause',_0x6cde('0x9'),_0x6cde('0xa'),'smsPause',_0x6cde('0xb'),_0x6cde('0xc'),_0x6cde('0xd'),'mailCapacity','faxCapacity','smsCapacity',_0x6cde('0xe'),_0x6cde('0xf')]},'log':_0x6cde('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 0cb9aed..3c2754a 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 _0xd82a=['../client','update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xd82a,0xbd));var _0xad82=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xd82a[_0x288f5e];return _0x476cc9;};'use strict';var client=require(_0xad82('0x0'));exports[_0xad82('0x1')]=function(_0x2fd97e,_0x40afa5){return client['Request'](_0xad82('0x2'),{'body':_0x40afa5,'options':{'where':{'id':_0x2fd97e}},'log':'updateWhatsappInteraction'});};exports[_0xad82('0x3')]=function(_0x3a0a37,_0x40b3d6){return client[_0xad82('0x4')](_0xad82('0x5'),{'body':_0x40b3d6,'options':{'where':{'id':_0x3a0a37}},'log':_0xad82('0x6')});}; \ No newline at end of file +var _0x046b=['addTags','AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x596424,_0x2f151c){var _0x3c5588=function(_0x26daf6){while(--_0x26daf6){_0x596424['push'](_0x596424['shift']());}};_0x3c5588(++_0x2f151c);}(_0x046b,0x147));var _0xb046=function(_0x2afd3e,_0x6d310a){_0x2afd3e=_0x2afd3e-0x0;var _0x184f97=_0x046b[_0x2afd3e];return _0x184f97;};'use strict';var client=require('../client');exports[_0xb046('0x0')]=function(_0x1cf0d6,_0x2a173b){return client[_0xb046('0x1')](_0xb046('0x2'),{'body':_0x2a173b,'options':{'where':{'id':_0x1cf0d6}},'log':'updateWhatsappInteraction'});};exports[_0xb046('0x3')]=function(_0x1cec98,_0xf9102a){return client[_0xb046('0x1')](_0xb046('0x4'),{'body':_0xf9102a,'options':{'where':{'id':_0x1cec98}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bf3d04e..290f7f1 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 _0x197d=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x35ca98,_0x4d5c36){var _0x46ef88=function(_0x144b8d){while(--_0x144b8d){_0x35ca98['push'](_0x35ca98['shift']());}};_0x46ef88(++_0x4d5c36);}(_0x197d,0xb5));var _0xd197=function(_0x4a8ce2,_0x563bbc){_0x4a8ce2=_0x4a8ce2-0x0;var _0x3c6905=_0x197d[_0x4a8ce2];return _0x3c6905;};'use strict';var client=require(_0xd197('0x0'));exports[_0xd197('0x1')]=function(_0x3470bc){return client[_0xd197('0x2')](_0xd197('0x3'),{'body':_0x3470bc,'log':_0xd197('0x4')});}; \ No newline at end of file +var _0x1660=['createWhatsappMessage','create','CreateWhatsappMessage'];(function(_0x1606d3,_0xb79b67){var _0x3cdaa8=function(_0x2f7a30){while(--_0x2f7a30){_0x1606d3['push'](_0x1606d3['shift']());}};_0x3cdaa8(++_0xb79b67);}(_0x1660,0x1c0));var _0x0166=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x1660[_0x59d89e];return _0x554e93;};'use strict';var client=require('../client');exports[_0x0166('0x0')]=function(_0x4a55d7){return client['Request'](_0x0166('0x1'),{'body':_0x4a55d7,'log':_0x0166('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c10f9f1..0f087e1 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 _0xc901=['whatsappPause','getWhatsappQueues','../client','timeout','strategy','Agents','name','online'];(function(_0x274108,_0x1e5879){var _0x516356=function(_0x5be079){while(--_0x5be079){_0x274108['push'](_0x274108['shift']());}};_0x516356(++_0x1e5879);}(_0xc901,0x142));var _0x1c90=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc901[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x1c90('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0x1c90('0x1'),_0x1c90('0x2')],'include':[{'model':'User','as':_0x1c90('0x3'),'attributes':['id',_0x1c90('0x4'),_0x1c90('0x5'),_0x1c90('0x6')]}]},'log':_0x1c90('0x7')});};}; \ No newline at end of file +var _0x777d=['Request','GetWhatsappQueue','timeout','strategy','online','getWhatsappQueues'];(function(_0x182e06,_0x3e2215){var _0x5e6f27=function(_0x2e7340){while(--_0x2e7340){_0x182e06['push'](_0x182e06['shift']());}};_0x5e6f27(++_0x3e2215);}(_0x777d,0xe9));var _0xd777=function(_0x1d5714,_0x2fa5f4){_0x1d5714=_0x1d5714-0x0;var _0x1b620e=_0x777d[_0x1d5714];return _0x1b620e;};'use strict';var client=require('../client');exports[_0xd777('0x0')]=function(){return function(){return client[_0xd777('0x1')](_0xd777('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd777('0x3'),_0xd777('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xd777('0x5'),'whatsappPause']}]},'log':_0xd777('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3036eb6..9518d79 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 _0x4a45=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4a45,0xb9));var _0x54a4=function(_0x1d6f6c,_0x39ace0){_0x1d6f6c=_0x1d6f6c-0x0;var _0x2d592d=_0x4a45[_0x1d6f6c];return _0x2d592d;};'use strict';var client=require(_0x54a4('0x0'));exports[_0x54a4('0x1')]=function(_0x131c73){return client[_0x54a4('0x2')](_0x54a4('0x3'),{'body':_0x131c73,'log':_0x54a4('0x3')});};exports[_0x54a4('0x4')]=function(_0x402f19,_0x319614){return client[_0x54a4('0x2')]('UpdateWhatsappQueueReport',{'body':_0x319614,'options':{'where':{'uniqueid':_0x402f19},'order':[['id',_0x54a4('0x5')]],'limit':0x1},'log':_0x54a4('0x6')});}; \ No newline at end of file +var _0x4c33=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create'];(function(_0x49944a,_0x1a3723){var _0x2567fc=function(_0x2aa79e){while(--_0x2aa79e){_0x49944a['push'](_0x49944a['shift']());}};_0x2567fc(++_0x1a3723);}(_0x4c33,0xb8));var _0x34c3=function(_0xd5edf7,_0x43c249){_0xd5edf7=_0xd5edf7-0x0;var _0x5cb898=_0x4c33[_0xd5edf7];return _0x5cb898;};'use strict';var client=require(_0x34c3('0x0'));exports[_0x34c3('0x1')]=function(_0x1d8195){return client[_0x34c3('0x2')](_0x34c3('0x3'),{'body':_0x1d8195,'log':_0x34c3('0x3')});};exports[_0x34c3('0x4')]=function(_0x342158,_0x1041a9){return client['Request'](_0x34c3('0x5'),{'body':_0x1041a9,'options':{'where':{'uniqueid':_0x342158},'order':[['id','DESC']],'limit':0x1},'log':_0x34c3('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 e4e3e77..caac44b 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 _0x3f21=['[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','timeout','createQueue','atimeout','channel','format','START:%s','rules','end'];(function(_0x201d02,_0x16330b){var _0x549a99=function(_0x10066a){while(--_0x10066a){_0x201d02['push'](_0x201d02['shift']());}};_0x549a99(++_0x16330b);}(_0x3f21,0xcd));var _0x13f2=function(_0x4343e2,_0x346afb){_0x4343e2=_0x4343e2-0x0;var _0x402b4f=_0x3f21[_0x4343e2];return _0x402b4f;};'use strict';var schema=require('validate');var _=require(_0x13f2('0x0'));var util=require(_0x13f2('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x13f2('0x2'))(_0x13f2('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x13f2('0x4')},'timeout':{'type':_0x13f2('0x5'),'message':_0x13f2('0x6')}});function writeLog(_0x52c7a7,_0x259bd3,_0x5e8ca6){return logger[_0x13f2('0x7')](util['format'](_0x13f2('0x8'),_0x52c7a7,_0x259bd3['name'],_0x5e8ca6));}function handleFindAgent(_0x1a6d1c){return function(_0x3347fa){return _0x3347fa[_0x13f2('0x9')]['toLowerCase']()===_0x1a6d1c['toLowerCase']();};}exports['consequence']=function(_0x126ede,_0x46ec9b,_0x3a8295,_0x10d537){return function(_0x53611c){try{var _0x511196={'name':_0x46ec9b[0x0],'timeout':_0x46ec9b[0x1]};var _0x1c26ac=queue[_0x13f2('0xa')](_0x511196,{'typecast':!![]});if(_0x1c26ac[_0x13f2('0xb')]){logger[_0x13f2('0xc')](_0x13f2('0xd'),_0x126ede,_[_0x13f2('0xe')](_0x1c26ac,_0x13f2('0xf'))[_0x13f2('0x10')](',\x20'));_0x53611c[_0x13f2('0x11')]();}else{var _0x2a7300=_['find'](_0x3a8295['agents'],handleFindAgent(_0x511196[_0x13f2('0x9')]));if(_0x2a7300){var _0x15830b=(_0x511196[_0x13f2('0x12')]||0xa)*0x3e8;var _0x294b05,_0x42fdd2;var _0x2d58ad=seqqueue[_0x13f2('0x13')](_0x15830b);_0x2d58ad['id']=_0x126ede;_0x2d58ad[_0x13f2('0x14')]=_0x15830b;_0x2d58ad[_0x13f2('0x15')]=_0x10d537[_0x13f2('0x15')];writeLog(_0x126ede,_0x2a7300,util[_0x13f2('0x16')](_0x13f2('0x17'),_0x15830b));_0x3a8295[_0x13f2('0x18')][_0x126ede]['on'](_0x13f2('0x19'),function(){logger[_0x13f2('0x7')](_0x13f2('0x1a'),_0x126ede);clearTimeout(_0x42fdd2);_0x42fdd2=undefined;_0x2d58ad['close']();if(_0x3a8295[_0x13f2('0x18')][_0x126ede]){delete _0x3a8295[_0x13f2('0x18')][_0x126ede];}_0x53611c[_0x13f2('0x11')]();});_0x3a8295[_0x13f2('0x18')][_0x126ede]['on'](_0x13f2('0x1b'),function(){if(_0x3a8295[_0x13f2('0x18')][_0x126ede]){delete _0x3a8295['rules'][_0x126ede];}});_0x42fdd2=setTimeout(function(){logger[_0x13f2('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x126ede);clearTimeout(_0x42fdd2);_0x2d58ad[_0x13f2('0x1c')]();_0x53611c[_0x13f2('0x1d')]();},_0x15830b);strategy['agent'](_0x2d58ad,_0x2a7300,_0x3a8295,_0x10d537);}else{logger[_0x13f2('0xc')](_0x13f2('0x1e'),_0x126ede,_0x511196[_0x13f2('0x9')]);_0x53611c[_0x13f2('0x11')]();}}}catch(_0x2845f3){console['log'](_0x2845f3);logger[_0x13f2('0xc')](_0x13f2('0x1f'),_0x126ede,_0x2845f3[_0x13f2('0x20')]);_0x53611c[_0x13f2('0x11')]();}};}; \ No newline at end of file +var _0x7875=['error','[%s][AGENT]\x20%s','message','join','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length'];(function(_0x3018d1,_0x4e3083){var _0x526a79=function(_0x313d99){while(--_0x313d99){_0x3018d1['push'](_0x3018d1['shift']());}};_0x526a79(++_0x4e3083);}(_0x7875,0x135));var _0x5787=function(_0x418305,_0xcf9d75){_0x418305=_0x418305-0x0;var _0x39a433=_0x7875[_0x418305];return _0x39a433;};'use strict';var schema=require(_0x5787('0x0'));var _=require(_0x5787('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x5787('0x2'))(_0x5787('0x3'));var strategy=require(_0x5787('0x4'));var queue=schema({'name':{'type':_0x5787('0x5'),'required':!![],'message':_0x5787('0x6')},'timeout':{'type':_0x5787('0x7'),'message':_0x5787('0x8')}});function writeLog(_0x4900b8,_0xeec3e9,_0x871025){return logger[_0x5787('0x9')](util[_0x5787('0xa')](_0x5787('0xb'),_0x4900b8,_0xeec3e9[_0x5787('0xc')],_0x871025));}function handleFindAgent(_0x46d186){return function(_0x4fefb7){return _0x4fefb7['name'][_0x5787('0xd')]()===_0x46d186[_0x5787('0xd')]();};}exports['consequence']=function(_0x185359,_0x3b9bf3,_0x4161b9,_0x58d302){return function(_0xe51249){try{var _0x12dace={'name':_0x3b9bf3[0x0],'timeout':_0x3b9bf3[0x1]};var _0x5bf151=queue[_0x5787('0x0')](_0x12dace,{'typecast':!![]});if(_0x5bf151[_0x5787('0xe')]){logger[_0x5787('0xf')](_0x5787('0x10'),_0x185359,_['map'](_0x5bf151,_0x5787('0x11'))[_0x5787('0x12')](',\x20'));_0xe51249['stop']();}else{var _0x56577e=_[_0x5787('0x13')](_0x4161b9['agents'],handleFindAgent(_0x12dace[_0x5787('0xc')]));if(_0x56577e){var _0x1fd3e5=(_0x12dace[_0x5787('0x14')]||0xa)*0x3e8;var _0xffe73a,_0x2438c4;var _0x482093=seqqueue[_0x5787('0x15')](_0x1fd3e5);_0x482093['id']=_0x185359;_0x482093[_0x5787('0x16')]=_0x1fd3e5;_0x482093[_0x5787('0x17')]=_0x58d302[_0x5787('0x17')];writeLog(_0x185359,_0x56577e,util['format']('START:%s',_0x1fd3e5));_0x4161b9[_0x5787('0x18')][_0x185359]['on'](_0x5787('0x19'),function(){logger[_0x5787('0x9')](_0x5787('0x1a'),_0x185359);clearTimeout(_0x2438c4);_0x2438c4=undefined;_0x482093['close']();if(_0x4161b9[_0x5787('0x18')][_0x185359]){delete _0x4161b9[_0x5787('0x18')][_0x185359];}_0xe51249[_0x5787('0x1b')]();});_0x4161b9['rules'][_0x185359]['on'](_0x5787('0x1c'),function(){if(_0x4161b9[_0x5787('0x18')][_0x185359]){delete _0x4161b9['rules'][_0x185359];}});_0x2438c4=setTimeout(function(){logger[_0x5787('0x9')](_0x5787('0x1d'),_0x185359);clearTimeout(_0x2438c4);_0x482093[_0x5787('0x1e')]();_0xe51249[_0x5787('0x1f')]();},_0x1fd3e5);strategy[_0x5787('0x20')](_0x482093,_0x56577e,_0x4161b9,_0x58d302);}else{logger[_0x5787('0xf')](_0x5787('0x21'),_0x185359,_0x12dace[_0x5787('0xc')]);_0xe51249[_0x5787('0x1b')]();}}}catch(_0x2685fc){console[_0x5787('0x22')](_0x2685fc);logger[_0x5787('0xf')](_0x5787('0x23'),_0x185359,_0x2685fc['stack']);_0xe51249['stop']();}};}; \ 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 695bb58..1f283c3 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 _0xba34=['body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty'];(function(_0x7ea912,_0x2c10eb){var _0x5bce6c=function(_0x5af2ed){while(--_0x5af2ed){_0x7ea912['push'](_0x7ea912['shift']());}};_0x5bce6c(++_0x2c10eb);}(_0xba34,0x119));var _0x4ba3=function(_0x441895,_0x23bf5d){_0x441895=_0x441895-0x0;var _0x5f77a4=_0xba34[_0x441895];return _0x5f77a4;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var AWS=require(_0x4ba3('0x2'));var utils=require(_0x4ba3('0x3'));var logger=require(_0x4ba3('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4ba3('0x5')),'smsMessage':require(_0x4ba3('0x6')),'faxMessage':require(_0x4ba3('0x7')),'whatsappMessage':require(_0x4ba3('0x8'))};exports[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return function(_0x585f2d){try{if(!_[_0x4ba3('0xa')](this[_0x4ba3('0xb')][_0x4ba3('0xc')])){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x4ba3('0xf'));return _0x585f2d[_0x4ba3('0x10')]();}var _0x3f653c={'ContactId':this[_0x4ba3('0x11')]['id'],'sentAt':moment()[_0x4ba3('0x12')](_0x4ba3('0x13')),'direction':'out'};var _0x4619c5=this[_0x4ba3('0x14')];if(_0x4619c5==='chat'){_0x3f653c[_0x4ba3('0x15')]=this['account']['id'];}else{_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+'AccountId']=this[_0x4ba3('0x17')]['id'];}_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+_0x4ba3('0x18')]=this[_0x4ba3('0xb')]['id'];if(this[_0x4ba3('0xb')][_0x4ba3('0x19')]){var _0x3a74f7=_0xe5f99a[0x4];if(!_[_0x4ba3('0x1a')](_0x3a74f7)){_0x3f653c[_0x4ba3('0x1b')]=utils[_0x4ba3('0x1c')](_0x3a74f7,this);return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x25f584){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c['body']);})[_0x4ba3('0x20')](function(_0x788277){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON['stringify'](_0x788277));})[_0x4ba3('0x22')](function(){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0xb88621);_0x585f2d[_0x4ba3('0x24')]();});}else{logger[_0x4ba3('0xd')](_0x4ba3('0x25'),_0xb88621);_0x585f2d['stop']();}}else{var _0x57de6a=this;var _0x2278b0=new AWS['LexRuntime']({'accessKeyId':_0xe5f99a[0x0],'secretAccessKey':_0xe5f99a[0x1],'region':_0xe5f99a[0x2]});var _0x18dff5={'botAlias':_0x4ba3('0x26'),'botName':_0xe5f99a[0x3],'inputText':this[_0x4ba3('0x27')][_0x4ba3('0x1b')],'userId':this[_0x4ba3('0x14')]+':'+this[_0x4ba3('0xb')]['id']['toString']()};_0x2278b0[_0x4ba3('0x28')](_0x18dff5,function(_0x1f87e1,_0x5c28f9){if(_0x1f87e1){logger[_0x4ba3('0x21')]('[%s][AMAZONLEX]\x20%s',_0xb88621,_0x1f87e1[_0x4ba3('0x27')]);_0x585f2d[_0x4ba3('0x10')]();}else if(_0x5c28f9&&_0x5c28f9[_0x4ba3('0x27')]){_0x57de6a[_0x4ba3('0x1b')][_0x4ba3('0x29')]=_0x5c28f9;_0x3f653c[_0x4ba3('0x1b')]=_0x5c28f9[_0x4ba3('0x27')];return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x50c729){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c[_0x4ba3('0x1b')]);if(_0x5c28f9['dialogState']==_0x4ba3('0x2a')){_0x585f2d[_0x4ba3('0x10')]();}else{_0x585f2d[_0x4ba3('0x24')]();}})['catch'](function(_0x10cae6){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x10cae6));_0x585f2d['next']();});}else{_0x585f2d['next']();}});}}catch(_0x38ef88){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x38ef88));_0x585f2d[_0x4ba3('0x24')]();}};}; \ No newline at end of file +var _0xba34=['body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','amazonlex','Failed','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty'];(function(_0x54c0d6,_0x4081c7){var _0x25a766=function(_0x2f1f65){while(--_0x2f1f65){_0x54c0d6['push'](_0x54c0d6['shift']());}};_0x25a766(++_0x4081c7);}(_0xba34,0x119));var _0x4ba3=function(_0x280051,_0x1d5b6a){_0x280051=_0x280051-0x0;var _0x32100c=_0xba34[_0x280051];return _0x32100c;};'use strict';var _=require(_0x4ba3('0x0'));var moment=require(_0x4ba3('0x1'));var AWS=require(_0x4ba3('0x2'));var utils=require(_0x4ba3('0x3'));var logger=require(_0x4ba3('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4ba3('0x5')),'smsMessage':require(_0x4ba3('0x6')),'faxMessage':require(_0x4ba3('0x7')),'whatsappMessage':require(_0x4ba3('0x8'))};exports[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return function(_0x585f2d){try{if(!_[_0x4ba3('0xa')](this[_0x4ba3('0xb')][_0x4ba3('0xc')])){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x4ba3('0xf'));return _0x585f2d[_0x4ba3('0x10')]();}var _0x3f653c={'ContactId':this[_0x4ba3('0x11')]['id'],'sentAt':moment()[_0x4ba3('0x12')](_0x4ba3('0x13')),'direction':'out'};var _0x4619c5=this[_0x4ba3('0x14')];if(_0x4619c5==='chat'){_0x3f653c[_0x4ba3('0x15')]=this['account']['id'];}else{_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+'AccountId']=this[_0x4ba3('0x17')]['id'];}_0x3f653c[_[_0x4ba3('0x16')](_0x4619c5)+_0x4ba3('0x18')]=this[_0x4ba3('0xb')]['id'];if(this[_0x4ba3('0xb')][_0x4ba3('0x19')]){var _0x3a74f7=_0xe5f99a[0x4];if(!_[_0x4ba3('0x1a')](_0x3a74f7)){_0x3f653c[_0x4ba3('0x1b')]=utils[_0x4ba3('0x1c')](_0x3a74f7,this);return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x25f584){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c['body']);})[_0x4ba3('0x20')](function(_0x788277){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON['stringify'](_0x788277));})[_0x4ba3('0x22')](function(){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0xb88621);_0x585f2d[_0x4ba3('0x24')]();});}else{logger[_0x4ba3('0xd')](_0x4ba3('0x25'),_0xb88621);_0x585f2d['stop']();}}else{var _0x57de6a=this;var _0x2278b0=new AWS['LexRuntime']({'accessKeyId':_0xe5f99a[0x0],'secretAccessKey':_0xe5f99a[0x1],'region':_0xe5f99a[0x2]});var _0x18dff5={'botAlias':_0x4ba3('0x26'),'botName':_0xe5f99a[0x3],'inputText':this[_0x4ba3('0x27')][_0x4ba3('0x1b')],'userId':this[_0x4ba3('0x14')]+':'+this[_0x4ba3('0xb')]['id']['toString']()};_0x2278b0[_0x4ba3('0x28')](_0x18dff5,function(_0x1f87e1,_0x5c28f9){if(_0x1f87e1){logger[_0x4ba3('0x21')]('[%s][AMAZONLEX]\x20%s',_0xb88621,_0x1f87e1[_0x4ba3('0x27')]);_0x585f2d[_0x4ba3('0x10')]();}else if(_0x5c28f9&&_0x5c28f9[_0x4ba3('0x27')]){_0x57de6a[_0x4ba3('0x1b')][_0x4ba3('0x29')]=_0x5c28f9;_0x3f653c[_0x4ba3('0x1b')]=_0x5c28f9[_0x4ba3('0x27')];return rpc[_0x4619c5+_0x4ba3('0x1d')][_0x4ba3('0x1e')](_0x3f653c)[_0x4ba3('0x1f')](function(_0x50c729){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0xb88621,_0x3f653c[_0x4ba3('0x1b')]);if(_0x5c28f9['dialogState']==_0x4ba3('0x2a')){_0x585f2d[_0x4ba3('0x10')]();}else{_0x585f2d[_0x4ba3('0x24')]();}})['catch'](function(_0x10cae6){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x10cae6));_0x585f2d['next']();});}else{_0x585f2d['next']();}});}}catch(_0x38ef88){logger[_0x4ba3('0x21')](_0x4ba3('0xe'),_0xb88621,JSON[_0x4ba3('0x2b')](_0x38ef88));_0x585f2d[_0x4ba3('0x24')]();}};}; \ 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 9f6c430..a9f2b6c 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 _0x910e=['[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','finally','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','account','Smtp','host','port','secure','authentication','auth','user','inReplyTo','html','','replace','body','','then'];(function(_0x19f5ad,_0xb7bc88){var _0x3c1507=function(_0x2b10df){while(--_0x2b10df){_0x19f5ad['push'](_0x19f5ad['shift']());}};_0x3c1507(++_0xb7bc88);}(_0x910e,0xef));var _0xe910=function(_0x5362bb,_0x5a7143){_0x5362bb=_0x5362bb-0x0;var _0x1cb94d=_0x910e[_0x5362bb];return _0x1cb94d;};'use strict';var _=require(_0xe910('0x0'));var moment=require(_0xe910('0x1'));var utils=require(_0xe910('0x2'));var logger=require(_0xe910('0x3'))(_0xe910('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe910('0x5')),'mailMessage':require(_0xe910('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe910('0x7'))};var mailRpc=require(_0xe910('0x8'));exports[_0xe910('0x9')]=function(_0x8cc5e9,_0x55267c){return function(_0x420c72){try{if(_0x55267c[0x0]==='1'&&(_[_0xe910('0xa')](this[_0xe910('0xb')][_0xe910('0xc')])||!this['interaction'][_0xe910('0xc')])){logger[_0xe910('0xd')](_0xe910('0xe'),_0x8cc5e9,_0xe910('0xf'));return _0x420c72[_0xe910('0x10')]();}var _0x14e5c9=this[_0xe910('0x11')];var _0x38e3f5={'body':utils['getMustacheRender'](_0x55267c[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0xe910('0x12')](_0xe910('0x13')),'direction':'out'};if(this[_0xe910('0x14')]){_0x38e3f5['to']=this[_0xe910('0x14')][_0xe910('0x15')]||'';_0x38e3f5['cc']=this[_0xe910('0x14')]['cc']||'';_0x38e3f5[_0xe910('0x15')]=this[_0xe910('0x14')]['to']||'';_0x38e3f5[_0xe910('0x16')]=this[_0xe910('0x14')][_0xe910('0x16')]||'';_0x38e3f5[_0xe910('0x17')]=!![];if(this[_0xe910('0x14')]['subject']){_0x38e3f5[_0xe910('0x18')]='';_0x38e3f5['subject']+=_[_0xe910('0x19')](this[_0xe910('0x14')][_0xe910('0x18')],_0xe910('0x1a'))?'':_0xe910('0x1b');_0x38e3f5[_0xe910('0x18')]+=this[_0xe910('0x14')]['subject'];}}if(this[_0xe910('0x11')]===_0xe910('0x1c')){_0x38e3f5[_0xe910('0x1d')]=this['account']['id'];}else{_0x38e3f5[_[_0xe910('0x1e')](this[_0xe910('0x11')])+_0xe910('0x1f')]=this['account']['id'];}_0x38e3f5[_[_0xe910('0x1e')](this['channel'])+_0xe910('0x20')]=this[_0xe910('0xb')]['id'];if(rpc[this[_0xe910('0x11')]+_0xe910('0x21')]){if(this[_0xe910('0x11')]==='mail'){var _0x457663={'tls':{'rejectUnauthorized':![]}};if(this[_0xe910('0x22')][_0xe910('0x23')]['service']){_0x457663['service']=this[_0xe910('0x22')]['Smtp']['service'];}else{_0x457663[_0xe910('0x24')]=this['account'][_0xe910('0x23')][_0xe910('0x24')];_0x457663[_0xe910('0x25')]=this[_0xe910('0x22')][_0xe910('0x23')][_0xe910('0x25')];_0x457663[_0xe910('0x26')]=this[_0xe910('0x22')]['Smtp'][_0xe910('0x26')];}if(this['account'][_0xe910('0x23')][_0xe910('0x27')]){_0x457663[_0xe910('0x28')]={'user':this['account'][_0xe910('0x23')][_0xe910('0x29')],'pass':this['account'][_0xe910('0x23')]['pass']};}_0x38e3f5[_0xe910('0x2a')]=this['message']['messageId'];_0x38e3f5[_0xe910('0x2b')]=_0xe910('0x2c')+_[_0xe910('0x2d')](_0x38e3f5[_0xe910('0x2e')],_0xe910('0x2f'),_0xe910('0x30'))+_0xe910('0x31');return mailRpc['sendMailMessage'](_0x457663,_0x38e3f5)[_0xe910('0x32')](function(_0x8def7a){logger['info'](_0xe910('0x33'),_0x8cc5e9);_0x38e3f5[_0xe910('0x34')]=_0x8def7a[_0xe910('0x14')][_0xe910('0x34')];return rpc[_0x14e5c9+'Message']['create'](_0x38e3f5);})[_0xe910('0x32')](function(_0x282fa6){logger['info'](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x282fa6));})[_0xe910('0x36')](function(_0xd9242){logger[_0xe910('0x37')]('[RPC][%s][AUTOREPLY]\x20%s',_0x8cc5e9,JSON[_0xe910('0x35')](_0xd9242));})[_0xe910('0x38')](function(){_0x420c72[_0xe910('0x10')]();});}else{return rpc[this[_0xe910('0x11')]+_0xe910('0x21')]['create'](_0x38e3f5)[_0xe910('0x32')](function(_0xacdcde){logger[_0xe910('0xd')]('[%s][AUTOREPLY]\x20%s',_0x8cc5e9,_0x38e3f5[_0xe910('0x2e')]);})['catch'](function(_0x5f088c){logger[_0xe910('0x37')](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x5f088c));})[_0xe910('0x38')](function(){_0x420c72[_0xe910('0x10')]();});}}}catch(_0x2faf05){logger[_0xe910('0x37')](_0xe910('0xe'),_0x8cc5e9,JSON[_0xe910('0x35')](_0x2faf05));_0x420c72[_0xe910('0x39')]();}};}; \ No newline at end of file +var _0x4768=['isNil','interaction','created','[%s][AUTOREPLY]\x20%s','next','channel','getMustacheRender','format','YYYY-MM-DD\x20HH:mm:ss','out','from','message','phone','read','subject','Re:','account','upperFirst','AccountId','InteractionId','Smtp','service','secure','authentication','auth','inReplyTo','messageId','body','','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','error','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence'];(function(_0x488907,_0x1c9b09){var _0x6ceaf8=function(_0x3e7737){while(--_0x3e7737){_0x488907['push'](_0x488907['shift']());}};_0x6ceaf8(++_0x1c9b09);}(_0x4768,0x132));var _0x8476=function(_0x5f0d82,_0x500323){_0x5f0d82=_0x5f0d82-0x0;var _0x35b08c=_0x4768[_0x5f0d82];return _0x35b08c;};'use strict';var _=require(_0x8476('0x0'));var moment=require(_0x8476('0x1'));var utils=require(_0x8476('0x2'));var logger=require(_0x8476('0x3'))(_0x8476('0x4'));var rpc={'chatMessage':require(_0x8476('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8476('0x6')),'smsMessage':require(_0x8476('0x7')),'faxMessage':require(_0x8476('0x8')),'whatsappMessage':require(_0x8476('0x9'))};var mailRpc=require(_0x8476('0xa'));exports[_0x8476('0xb')]=function(_0x3c229d,_0xcc2cf){return function(_0x5e7752){try{if(_0xcc2cf[0x0]==='1'&&(_[_0x8476('0xc')](this[_0x8476('0xd')]['created'])||!this[_0x8476('0xd')][_0x8476('0xe')])){logger['info'](_0x8476('0xf'),_0x3c229d,'Autoreply\x20already\x20sent');return _0x5e7752[_0x8476('0x10')]();}var _0x33e244=this[_0x8476('0x11')];var _0x527889={'body':utils[_0x8476('0x12')](_0xcc2cf[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x8476('0x13')](_0x8476('0x14')),'direction':_0x8476('0x15')};if(this['message']){_0x527889['to']=this['message'][_0x8476('0x16')]||'';_0x527889['cc']=this[_0x8476('0x17')]['cc']||'';_0x527889[_0x8476('0x16')]=this[_0x8476('0x17')]['to']||'';_0x527889['phone']=this[_0x8476('0x17')][_0x8476('0x18')]||'';_0x527889[_0x8476('0x19')]=!![];if(this['message'][_0x8476('0x1a')]){_0x527889[_0x8476('0x1a')]='';_0x527889[_0x8476('0x1a')]+=_['startsWith'](this[_0x8476('0x17')][_0x8476('0x1a')],_0x8476('0x1b'))?'':'Re:\x20';_0x527889[_0x8476('0x1a')]+=this[_0x8476('0x17')][_0x8476('0x1a')];}}if(this[_0x8476('0x11')]==='chat'){_0x527889['ChatWebsiteId']=this[_0x8476('0x1c')]['id'];}else{_0x527889[_[_0x8476('0x1d')](this[_0x8476('0x11')])+_0x8476('0x1e')]=this[_0x8476('0x1c')]['id'];}_0x527889[_[_0x8476('0x1d')](this[_0x8476('0x11')])+_0x8476('0x1f')]=this['interaction']['id'];if(rpc[this[_0x8476('0x11')]+'Message']){if(this[_0x8476('0x11')]==='mail'){var _0xa227e4={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x8476('0x20')][_0x8476('0x21')]){_0xa227e4[_0x8476('0x21')]=this['account'][_0x8476('0x20')][_0x8476('0x21')];}else{_0xa227e4['host']=this['account']['Smtp']['host'];_0xa227e4['port']=this[_0x8476('0x1c')]['Smtp']['port'];_0xa227e4['secure']=this[_0x8476('0x1c')][_0x8476('0x20')][_0x8476('0x22')];}if(this['account'][_0x8476('0x20')][_0x8476('0x23')]){_0xa227e4[_0x8476('0x24')]={'user':this['account'][_0x8476('0x20')]['user'],'pass':this[_0x8476('0x1c')][_0x8476('0x20')]['pass']};}_0x527889[_0x8476('0x25')]=this[_0x8476('0x17')][_0x8476('0x26')];_0x527889['html']=''+_['replace'](_0x527889[_0x8476('0x27')],_0x8476('0x28'),']+(>|$)/g,''),'priorityTrue':_0x424edf[0x1],'priorityFalse':_0x424edf[0x2]};var _0x3f68ba=gotoif[_0x3fe7('0x0')](_0x3675ea,{'typecast':!![]});if(_0x3f68ba[_0x3fe7('0xd')]){logger['error'](_0x3fe7('0xe'),_0x3805c4,_[_0x3fe7('0xf')](_0x3f68ba,_0x3fe7('0x10'))[_0x3fe7('0x11')](',\x20'));_0x2ae7fa['stop']();}else{try{var _0x5552eb=eval('('+_0x3675ea['condition']+')');var _0x3bf136=_0x5552eb?_0x3675ea[_0x3fe7('0x12')]:_0x3675ea[_0x3fe7('0x13')];logger[_0x3fe7('0x14')](_0x3fe7('0x15'),_0x3805c4,_0x3675ea[_0x3fe7('0x16')],_0x5552eb,_0x3bf136||_0x3fe7('0x17'));if(_0x3bf136){var _0x262505=_[_0x3fe7('0x18')](_0x2ae7fa[_0x3fe7('0x19')](),{'p':_0x3bf136});if(_0x262505>=0x0){logger[_0x3fe7('0x14')](_0x3fe7('0x1a'),_0x3805c4,_0x3bf136||_0x3fe7('0x17'),_0x262505);_0x2ae7fa['next'](_0x262505);}else{logger['info'](_0x3fe7('0x1b'),_0x3805c4,_0x3bf136||_0x3fe7('0x17'));_0x2ae7fa[_0x3fe7('0x1c')]();}}else{_0x2ae7fa[_0x3fe7('0x17')]();}}catch(_0x5f9795){logger[_0x3fe7('0x1d')](_0x3fe7('0x1e'),_0x3805c4,_0x5f9795[_0x3fe7('0x10')]);_0x2ae7fa[_0x3fe7('0x1c')]();}}}catch(_0x4a4b30){logger[_0x3fe7('0x1d')](_0x3fe7('0xe'),_0x3805c4,JSON[_0x3fe7('0x1f')](_0x4a4b30));_0x2ae7fa['stop']();}};}; \ No newline at end of file +var _0xa623=['priorityFalse','[%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','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','error','message','join','stop','condition','priorityTrue'];(function(_0x19847f,_0x95897f){var _0x28a3cc=function(_0x3ea2a5){while(--_0x3ea2a5){_0x19847f['push'](_0x19847f['shift']());}};_0x28a3cc(++_0x95897f);}(_0xa623,0x1bd));var _0x3a62=function(_0x22aed9,_0x7aa9aa){_0x22aed9=_0x22aed9-0x0;var _0x1dc042=_0xa623[_0x22aed9];return _0x1dc042;};'use strict';var schema=require(_0x3a62('0x0'));var _=require(_0x3a62('0x1'));var htmlToText=require(_0x3a62('0x2'));var utils=require(_0x3a62('0x3'));var logger=require(_0x3a62('0x4'))(_0x3a62('0x5'));var gotoif=schema({'condition':{'type':_0x3a62('0x6'),'required':!![],'message':_0x3a62('0x7')},'priorityTrue':{'type':'number','message':_0x3a62('0x8')},'priorityFalse':{'type':'number','message':_0x3a62('0x9')}});exports[_0x3a62('0xa')]=function(_0x274c3e,_0x35c51c){return function(_0x22a2fb){try{var _0x55b58={'condition':htmlToText[_0x3a62('0xb')](utils['getMustacheRender'](_0x35c51c[0x0],this),{'wordwrap':![]})[_0x3a62('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x35c51c[0x1],'priorityFalse':_0x35c51c[0x2]};var _0x2c3936=gotoif[_0x3a62('0x0')](_0x55b58,{'typecast':!![]});if(_0x2c3936['length']){logger[_0x3a62('0xd')]('[%s][GOTOIF]\x20%s',_0x274c3e,_['map'](_0x2c3936,_0x3a62('0xe'))[_0x3a62('0xf')](',\x20'));_0x22a2fb[_0x3a62('0x10')]();}else{try{var _0x400924=eval('('+_0x55b58[_0x3a62('0x11')]+')');var _0x544753=_0x400924?_0x55b58[_0x3a62('0x12')]:_0x55b58[_0x3a62('0x13')];logger['info'](_0x3a62('0x14'),_0x274c3e,_0x55b58['condition'],_0x400924,_0x544753||_0x3a62('0x15'));if(_0x544753){var _0x5d693d=_[_0x3a62('0x16')](_0x22a2fb[_0x3a62('0x17')](),{'p':_0x544753});if(_0x5d693d>=0x0){logger['info'](_0x3a62('0x18'),_0x274c3e,_0x544753||_0x3a62('0x15'),_0x5d693d);_0x22a2fb['next'](_0x5d693d);}else{logger[_0x3a62('0x19')](_0x3a62('0x1a'),_0x274c3e,_0x544753||_0x3a62('0x15'));_0x22a2fb[_0x3a62('0x10')]();}}else{_0x22a2fb[_0x3a62('0x15')]();}}catch(_0x535826){logger[_0x3a62('0xd')](_0x3a62('0x1b'),_0x274c3e,_0x535826['message']);_0x22a2fb[_0x3a62('0x10')]();}}}catch(_0x367851){logger['error'](_0x3a62('0x1c'),_0x274c3e,JSON['stringify'](_0x367851));_0x22a2fb[_0x3a62('0x10')]();}};}; \ 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 0fc8da1..8c9f36f 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 _0xf4e8=['join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s'];(function(_0x201e1b,_0x1ddea6){var _0x256eb0=function(_0x573f93){while(--_0x573f93){_0x201e1b['push'](_0x201e1b['shift']());}};_0x256eb0(++_0x1ddea6);}(_0xf4e8,0x15f));var _0x8f4e=function(_0x41f7b2,_0x58547b){_0x41f7b2=_0x41f7b2-0x0;var _0x19ec6d=_0xf4e8[_0x41f7b2];return _0x19ec6d;};'use strict';var schema=require(_0x8f4e('0x0'));var _=require(_0x8f4e('0x1'));var logger=require(_0x8f4e('0x2'))(_0x8f4e('0x3'));var gotop=schema({'priority':{'type':_0x8f4e('0x4'),'required':!![],'message':_0x8f4e('0x5')}});exports['consequence']=function(_0x1b5446,_0x18721a){return function(_0x32cacc){try{var _0x1a7d8a={'priority':_0x18721a[0x0]};var _0x4eeed5=gotop[_0x8f4e('0x0')](_0x1a7d8a,{'typecast':!![]});if(_0x4eeed5[_0x8f4e('0x6')]){logger[_0x8f4e('0x7')](_0x8f4e('0x8'),_0x1b5446,_['map'](_0x4eeed5,'message')[_0x8f4e('0x9')](',\x20'));_0x32cacc[_0x8f4e('0xa')]();}else{logger['info'](_0x8f4e('0xb'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]);if(_0x1a7d8a[_0x8f4e('0xc')]){var _0x3e4fbc=_[_0x8f4e('0xd')](_0x32cacc[_0x8f4e('0xe')](),{'p':_0x1a7d8a['priority']});if(_0x3e4fbc>=0x0){logger[_0x8f4e('0xf')](_0x8f4e('0x10'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]||_0x8f4e('0x11'),_0x3e4fbc);_0x32cacc[_0x8f4e('0x11')](_0x3e4fbc);}else{logger['info'](_0x8f4e('0x12'),_0x1b5446,_0x1a7d8a[_0x8f4e('0xc')]||_0x8f4e('0x11'));_0x32cacc[_0x8f4e('0xa')]();}}else{_0x32cacc[_0x8f4e('0x11')]();}}}catch(_0x42ad56){logger[_0x8f4e('0x7')]('[%s][GOTOP]\x20%s',_0x1b5446,JSON[_0x8f4e('0x13')](_0x42ad56));_0x32cacc[_0x8f4e('0xa')]();}};}; \ No newline at end of file +var _0xdaf9=['findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x1bd91c,_0x285e72){var _0x3bc43c=function(_0x5801c4){while(--_0x5801c4){_0x1bd91c['push'](_0x1bd91c['shift']());}};_0x3bc43c(++_0x285e72);}(_0xdaf9,0x10a));var _0x9daf=function(_0x485000,_0x883b0b){_0x485000=_0x485000-0x0;var _0x3c47dc=_0xdaf9[_0x485000];return _0x3c47dc;};'use strict';var schema=require(_0x9daf('0x0'));var _=require(_0x9daf('0x1'));var logger=require(_0x9daf('0x2'))(_0x9daf('0x3'));var gotop=schema({'priority':{'type':_0x9daf('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x9daf('0x5')]=function(_0x396910,_0x3f95aa){return function(_0x1e7d32){try{var _0x1190d5={'priority':_0x3f95aa[0x0]};var _0x16dfc2=gotop['validate'](_0x1190d5,{'typecast':!![]});if(_0x16dfc2[_0x9daf('0x6')]){logger[_0x9daf('0x7')](_0x9daf('0x8'),_0x396910,_[_0x9daf('0x9')](_0x16dfc2,_0x9daf('0xa'))['join'](',\x20'));_0x1e7d32[_0x9daf('0xb')]();}else{logger['info'](_0x9daf('0xc'),_0x396910,_0x1190d5['priority']);if(_0x1190d5[_0x9daf('0xd')]){var _0x1d695f=_[_0x9daf('0xe')](_0x1e7d32[_0x9daf('0xf')](),{'p':_0x1190d5[_0x9daf('0xd')]});if(_0x1d695f>=0x0){logger[_0x9daf('0x10')](_0x9daf('0x11'),_0x396910,_0x1190d5[_0x9daf('0xd')]||_0x9daf('0x12'),_0x1d695f);_0x1e7d32[_0x9daf('0x12')](_0x1d695f);}else{logger[_0x9daf('0x10')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x396910,_0x1190d5['priority']||'next');_0x1e7d32[_0x9daf('0xb')]();}}else{_0x1e7d32[_0x9daf('0x12')]();}}}catch(_0x52dedb){logger[_0x9daf('0x7')](_0x9daf('0x8'),_0x396910,JSON[_0x9daf('0x13')](_0x52dedb));_0x1e7d32['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 b5278a1..398e651 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 _0x4784=['AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId','account','upperFirst'];(function(_0x2564be,_0x2bfdd7){var _0x47905e=function(_0x70eae1){while(--_0x70eae1){_0x2564be['push'](_0x2564be['shift']());}};_0x47905e(++_0x2bfdd7);}(_0x4784,0x19d));var _0x4478=function(_0x1b08c9,_0x514a3a){_0x1b08c9=_0x1b08c9-0x0;var _0x272c0c=_0x4784[_0x1b08c9];return _0x272c0c;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4478('0x0'));var rpc={'chatMessage':require(_0x4478('0x1')),'openchannelMessage':require(_0x4478('0x2')),'mailMessage':require(_0x4478('0x3')),'smsMessage':require(_0x4478('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4478('0x5'))};exports['consequence']=function(_0x56315f,_0x4059f0){return function(_0xdec58e){try{var _0x3d392f={'body':utils[_0x4478('0x6')](_0x4059f0[0x0],this),'ContactId':this[_0x4478('0x7')]['id']};if(this[_0x4478('0x8')]==='chat'){_0x3d392f[_0x4478('0x9')]=this[_0x4478('0xa')]['id'];}else{_0x3d392f[_[_0x4478('0xb')](this[_0x4478('0x8')])+_0x4478('0xc')]=this['account']['id'];}_0x3d392f[_[_0x4478('0xb')](this[_0x4478('0x8')])+_0x4478('0xd')]=this[_0x4478('0xe')]['id'];if(rpc[this[_0x4478('0x8')]+'Message']){return rpc[this[_0x4478('0x8')]+_0x4478('0xf')][_0x4478('0x10')](_0x3d392f)[_0x4478('0x11')](function(_0x2fe0f2){logger[_0x4478('0x12')](_0x4478('0x13'),_0x56315f,_0x3d392f[_0x4478('0x14')]);_0xdec58e['next']();})[_0x4478('0x15')](function(_0x1437b8){logger[_0x4478('0x16')](_0x4478('0x13'),_0x56315f,JSON[_0x4478('0x17')](_0x1437b8));_0xdec58e[_0x4478('0x18')]();});}}catch(_0x3c6263){logger[_0x4478('0x16')]('[%s][MESSAGE]\x20%s',_0x56315f,JSON[_0x4478('0x17')](_0x3c6263));_0xdec58e['stop']();}};}; \ No newline at end of file +var _0x4083=['contact','channel','chat','account','upperFirst','AccountId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x4083,0x1b0));var _0x3408=function(_0x533f7f,_0x59f644){_0x533f7f=_0x533f7f-0x0;var _0x5e7c68=_0x4083[_0x533f7f];return _0x5e7c68;};'use strict';var _=require(_0x3408('0x0'));var utils=require('./utils');var logger=require(_0x3408('0x1'))(_0x3408('0x2'));var rpc={'chatMessage':require(_0x3408('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3408('0x4')),'smsMessage':require(_0x3408('0x5')),'faxMessage':require(_0x3408('0x6')),'whatsappMessage':require(_0x3408('0x7'))};exports[_0x3408('0x8')]=function(_0x3cd0c0,_0x260b2d){return function(_0x200fab){try{var _0x588f9b={'body':utils[_0x3408('0x9')](_0x260b2d[0x0],this),'ContactId':this[_0x3408('0xa')]['id']};if(this[_0x3408('0xb')]===_0x3408('0xc')){_0x588f9b['ChatWebsiteId']=this[_0x3408('0xd')]['id'];}else{_0x588f9b[_[_0x3408('0xe')](this['channel'])+_0x3408('0xf')]=this['account']['id'];}_0x588f9b[_[_0x3408('0xe')](this[_0x3408('0xb')])+'InteractionId']=this[_0x3408('0x10')]['id'];if(rpc[this[_0x3408('0xb')]+_0x3408('0x11')]){return rpc[this[_0x3408('0xb')]+_0x3408('0x11')]['create'](_0x588f9b)['then'](function(_0x15879b){logger[_0x3408('0x12')](_0x3408('0x13'),_0x3cd0c0,_0x588f9b[_0x3408('0x14')]);_0x200fab[_0x3408('0x15')]();})[_0x3408('0x16')](function(_0x14f00e){logger[_0x3408('0x17')](_0x3408('0x13'),_0x3cd0c0,JSON[_0x3408('0x18')](_0x14f00e));_0x200fab[_0x3408('0x19')]();});}}catch(_0x205c23){logger[_0x3408('0x17')](_0x3408('0x13'),_0x3cd0c0,JSON[_0x3408('0x18')](_0x205c23));_0x200fab[_0x3408('0x19')]();}};}; \ 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 03f0f5d..a96cab8 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 _0xa095=['getMustacheRender','error','stop','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s'];(function(_0x2f2d60,_0x4322bc){var _0x248feb=function(_0x151591){while(--_0x151591){_0x2f2d60['push'](_0x2f2d60['shift']());}};_0x248feb(++_0x4322bc);}(_0xa095,0xf3));var _0x5a09=function(_0x4c9316,_0x5c7f6f){_0x4c9316=_0x4c9316-0x0;var _0x146aad=_0xa095[_0x4c9316];return _0x146aad;};'use strict';var utils=require(_0x5a09('0x0'));var logger=require(_0x5a09('0x1'))(_0x5a09('0x2'));exports['consequence']=function(_0x43c9ad,_0x89200e){return function(_0x14e579){try{logger[_0x5a09('0x3')](_0x5a09('0x4'),_0x43c9ad,utils[_0x5a09('0x5')](_0x89200e[0x0],this));_0x14e579['next']();}catch(_0x252e18){logger[_0x5a09('0x6')](_0x5a09('0x4'),_0x43c9ad,JSON['stringify'](_0x252e18));_0x14e579[_0x5a09('0x7')]();}};}; \ No newline at end of file +var _0xa2cf=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing'];(function(_0x5c29c2,_0x565b36){var _0x41fdda=function(_0x1a8538){while(--_0x1a8538){_0x5c29c2['push'](_0x5c29c2['shift']());}};_0x41fdda(++_0x565b36);}(_0xa2cf,0xbb));var _0xfa2c=function(_0x2a1832,_0x534810){_0x2a1832=_0x2a1832-0x0;var _0x3c8bd2=_0xa2cf[_0x2a1832];return _0x3c8bd2;};'use strict';var utils=require('./utils');var logger=require(_0xfa2c('0x0'))(_0xfa2c('0x1'));exports['consequence']=function(_0x48429d,_0x487615){return function(_0x307c2c){try{logger[_0xfa2c('0x2')](_0xfa2c('0x3'),_0x48429d,utils[_0xfa2c('0x4')](_0x487615[0x0],this));_0x307c2c[_0xfa2c('0x5')]();}catch(_0x22c813){logger[_0xfa2c('0x6')](_0xfa2c('0x3'),_0x48429d,JSON[_0xfa2c('0x7')](_0x22c813));_0x307c2c[_0xfa2c('0x8')]();}};}; \ 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 1be0fd6..f0675cf 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 _0x9c44=['[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','atimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','QueueId','upperFirst','channel','InteractionId','message','AccountId','info','name','QueueReport','create','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x49c4('0x0'));var seqqueue=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var config=require(_0x49c4('0x4'));var logger=require(_0x49c4('0x5'))('routing');var strategy=require('./strategy');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));var attributes=['id',_0x49c4('0x9'),'account',_0x49c4('0xa'),_0x49c4('0xb'),_0x49c4('0xc')];function emit(_0x4487ca,_0x4c7d3a,_0x5ab4a3){io['to'](_0x4487ca)[_0x49c4('0xd')](_0x4c7d3a,_0x5ab4a3);}function emitChannelQueueInteraction(_0x313e73,_0x58cad7,_0xb611a1,_0x459d09,_0x4adb3c,_0x536d42,_0x1d19bf,_0x6d1b08){var _0x5487cd=_[_0x49c4('0xe')](_0xb611a1);_0x5487cd[_0x49c4('0x9')]=_0x6d1b08;_0x5487cd['queue']=_0x58cad7;_0x5487cd[_0x49c4('0xf')]=_0x459d09;_0x5487cd['id']=_0x4adb3c;if(_0x536d42){_0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c]=_[_0x49c4('0x12')](_0x5487cd,attributes);}else{delete _0x1d19bf[util[_0x49c4('0x10')](_0x49c4('0x11'),_0x313e73)][_0x4adb3c];}emit(util[_0x49c4('0x10')](_0x49c4('0x13'),_0x313e73,_0x58cad7),util['format'](_0x49c4('0x14'),_0x313e73,_0x536d42?_0x49c4('0x15'):_0x49c4('0x16')),_[_0x49c4('0x12')](_0x5487cd,attributes));}var rpc={'openchannelQueueReport':require(_0x49c4('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x49c4('0x18')),'smsQueueReport':require(_0x49c4('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x49c4('0x1a'),'required':!![],'message':_0x49c4('0x1b')},'timeout':{'type':_0x49c4('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x24856d,_0x50b151,_0x2cbd50,_0x1806c2){if(_0x24856d&&_0x50b151&&_0x2cbd50){_0x50b151[_0x49c4('0x1d')]+=0x1;var _0x291526={'uniqueid':_0x24856d,'from':_0x2cbd50[_0x49c4('0x1e')]?_0x2cbd50[_0x49c4('0x1e')][_0x49c4('0xb')]:'','joinAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'ContactId':_0x2cbd50['contact']?_0x2cbd50['contact']['id']:null,'ListId':_0x2cbd50['list']?_0x2cbd50[_0x49c4('0x20')]['id']:null};_0x291526[_['upperFirst'](_0x2cbd50['channel'])+_0x49c4('0x21')]=_0x50b151['id']||null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+_0x49c4('0x24')]=_0x2cbd50['interaction']?_0x2cbd50['interaction']['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+'MessageId']=_0x2cbd50[_0x49c4('0x25')]?_0x2cbd50[_0x49c4('0x25')]['id']:null;_0x291526[_[_0x49c4('0x22')](_0x2cbd50[_0x49c4('0x23')])+(_0x2cbd50['channel']!=='chat'?_0x49c4('0x26'):'WebsiteId')]=_0x2cbd50[_0x49c4('0xf')]?_0x2cbd50[_0x49c4('0xf')]['id']:null;logger[_0x49c4('0x27')](util[_0x49c4('0x10')]('[%s][START:QUEUE][NAME:%s]',_0x24856d,_0x50b151[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2cbd50[_0x49c4('0x23')],_0x50b151[_0x49c4('0x28')],_0x291526,_0x2cbd50[_0x49c4('0xf')][_0x49c4('0x28')],_0x2cbd50[_0x49c4('0x25')]['id'],!![],_0x1806c2,_0x50b151['id']);if(rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2cbd50[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2a')](_0x291526)['catch'](function(_0x4f4495){logger['error'](_0x49c4('0x2b'));});}}}function stopRouting(_0x7ee704,_0x1eb035,_0x27e467,_0x28eb47){if(_0x7ee704&&_0x1eb035){_0x1eb035['waiting']-=0x1;var _0x38ad77={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'acceptAt':moment()[_0x49c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x49c4('0x27')](util[_0x49c4('0x10')](_0x49c4('0x2c'),_0x7ee704,_0x1eb035[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x27e467[_0x49c4('0x23')],_0x1eb035['name'],_0x27e467[_0x49c4('0x1e')],_0x27e467[_0x49c4('0xf')][_0x49c4('0x28')],_0x27e467['message']['id'],![],_0x28eb47,_0x1eb035['id']);if(rpc[_0x27e467['channel']+_0x49c4('0x29')]){return rpc[_0x27e467[_0x49c4('0x23')]+_0x49c4('0x29')][_0x49c4('0x2d')](_0x7ee704,_0x38ad77)[_0x49c4('0x2e')](function(_0x2cf897){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function endRouting(_0x3209cd,_0x4e0209,_0x2d34ca,_0x5b96df){if(_0x3209cd&&_0x4e0209){_0x4e0209[_0x49c4('0x1d')]-=0x1;var _0x349791={'leaveAt':moment()[_0x49c4('0x10')](_0x49c4('0x1f')),'exitAt':moment()['format'](_0x49c4('0x1f')),'reason':_0x49c4('0x31')};logger[_0x49c4('0x27')](util['format'](_0x49c4('0x32'),_0x3209cd,_0x4e0209[_0x49c4('0x28')]));emitChannelQueueInteraction(_0x2d34ca[_0x49c4('0x23')],_0x4e0209[_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x1e')],_0x2d34ca[_0x49c4('0xf')][_0x49c4('0x28')],_0x2d34ca[_0x49c4('0x25')]['id'],![],_0x5b96df);if(rpc[_0x2d34ca[_0x49c4('0x23')]+_0x49c4('0x29')]){return rpc[_0x2d34ca[_0x49c4('0x23')]+'QueueReport'][_0x49c4('0x2d')](_0x3209cd,_0x349791)[_0x49c4('0x2e')](function(_0x32b172){logger[_0x49c4('0x2f')](_0x49c4('0x30'));});}}}function handleFindQueue(_0x29dd5d){return function(_0x1be62d){return _0x1be62d[_0x49c4('0x28')][_0x49c4('0x33')]()===_0x29dd5d[_0x49c4('0x33')]();};}exports[_0x49c4('0x34')]=function(_0xa3d59e,_0x326142,_0x4e38bc,_0x212366){return function(_0x49829e){try{var _0x104efb={'name':_0x326142[0x0],'timeout':_0x326142[0x1]};var _0x4915bc=queue[_0x49c4('0x35')](_0x104efb,{'typecast':!![]});if(_0x4915bc[_0x49c4('0x36')]){logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_['map'](_0x4915bc,'message')[_0x49c4('0x38')](',\x20'));_0x49829e[_0x49c4('0x39')]();}else{var _0x38349b=_[_0x49c4('0x3a')](_0x4e38bc[_0x212366['channel']+_0x49c4('0x3b')],handleFindQueue(_0x104efb[_0x49c4('0x28')]));if(_0x38349b){startRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);var _0x2ccd47=(_0x38349b[_0x49c4('0x31')]||0xa)*0x3e8;var _0x81a674=(_0x104efb[_0x49c4('0x31')]||0x14)*0x3e8;var _0x1a9593,_0x3351c1;if(_0x2ccd47>_0x81a674){_0x81a674=_0x2ccd47;}var _0x3c4a1d=seqqueue['createQueue'](_0x2ccd47);_0x3c4a1d['id']=_0xa3d59e;_0x3c4a1d[_0x49c4('0x3c')]=_0x2ccd47;_0x3c4a1d['qtimeout']=_0x81a674;_0x3c4a1d[_0x49c4('0x23')]=_0x212366[_0x49c4('0x23')];_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x3e'),function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa3d59e);stopRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x1a9593=undefined;_0x3c4a1d[_0x49c4('0x3f')](!![]);if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc[_0x49c4('0x3d')][_0xa3d59e];}_0x49829e[_0x49c4('0x39')]();});_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]['on'](_0x49c4('0x40'),function(){if(_0x4e38bc[_0x49c4('0x3d')][_0xa3d59e]){delete _0x4e38bc['rules'][_0xa3d59e];}});_0x1a9593=setTimeout(function(){logger[_0x49c4('0x27')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa3d59e);endRouting(_0xa3d59e,_0x38349b,_0x212366,_0x4e38bc);clearTimeout(_0x1a9593);_0x3c4a1d[_0x49c4('0x3f')](!![]);_0x49829e[_0x49c4('0x41')]();},_0x81a674);switch(_0x38349b[_0x49c4('0x42')]){case _0x49c4('0x43'):strategy[_0x49c4('0x43')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);break;default:strategy[_0x49c4('0x44')](_0x3c4a1d,_0x38349b,_0x4e38bc,_0x212366);}}else{logger[_0x49c4('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa3d59e,_0x104efb[_0x49c4('0x28')]);_0x49829e[_0x49c4('0x39')]();}}}catch(_0x4a5c34){console[_0x49c4('0x45')](_0x4a5c34);logger[_0x49c4('0x2f')](_0x49c4('0x37'),_0xa3d59e,_0x4a5c34[_0x49c4('0x46')]);_0x49829e['stop']();}};}; \ 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(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0x3e74,0x175));var _0x43e7=function(_0x502ee2,_0x39c60d){_0x502ee2=_0x502ee2-0x0;var _0x42ffbc=_0x3e74[_0x502ee2];return _0x42ffbc;};'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 f576376..07a7950 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 _0xcac8=['agent','realtime','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','info','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','routing','notificationId','squeue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcac8,0x163));var _0x8cac=function(_0x4da191,_0x2062f1){_0x4da191=_0x4da191-0x0;var _0x53689f=_0xcac8[_0x4da191];return _0x53689f;};'use strict';var _=require(_0x8cac('0x0'));var uuid=require(_0x8cac('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x8cac('0x2'));var Agent=function(_0x8a6db3,_0xf0da25,_0x193b30,_0x44796a){this[_0x8cac('0x3')]=uuid['v4']();this[_0x8cac('0x4')]=_0x8a6db3;this[_0x8cac('0x5')]=_0xf0da25;this[_0x8cac('0x6')]=_0x193b30;this[_0x8cac('0x2')]=_0x44796a;this[_0x8cac('0x4')][_0x8cac('0x7')](this[_0x8cac('0x8')][_0x8cac('0x9')](this),this[_0x8cac('0xa')][_0x8cac('0x9')](this));this[_0x8cac('0x4')]['on'](_0x8cac('0xb'),this['handleTimeout']['bind'](this));this[_0x8cac('0x4')]['on']('drained',this[_0x8cac('0xc')][_0x8cac('0x9')](this));};Agent['prototype'][_0x8cac('0x7')]=function(){this[_0x8cac('0x4')][_0x8cac('0x7')](this['handleRun'][_0x8cac('0x9')](this),this[_0x8cac('0xa')]['bind'](this));};Agent[_0x8cac('0xd')][_0x8cac('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x8cac('0xd')][_0x8cac('0x8')]=function(_0x4d4765){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);if(_['isNil'](this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']])){logger[_0x8cac('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);setTimeout(this['push'][_0x8cac('0x9')](this),0x3e8);}else{if(this[_0x8cac('0x2')]['forcedOwnership']||util['isAgentAvailable'](this[_0x8cac('0x4')]['id'],this[_0x8cac('0x6')][_0x8cac('0xf')][this['agent']['id']],this[_0x8cac('0x4')][_0x8cac('0x10')],![])){this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']][_0x8cac('0x11')]=!![];this[_0x8cac('0x6')][_0x8cac('0xf')][this['agent']['id']][_0x8cac('0x12')]=undefined;util[_0x8cac('0x13')](this['notificationId'],this['squeue']['id'],this[_0x8cac('0x6')][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']],null,this[_0x8cac('0x2')]);util[_0x8cac('0x14')](this[_0x8cac('0x4')]['id'],this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']],_0x8cac('0x15')+(this['routing'][_0x8cac('0x16')]?':FORCED':''));}else{logger['info'](_0x8cac('0x17'),this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);setTimeout(this[_0x8cac('0x7')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x8cac('0xa')]=function(_0x1b04a7){if(_[_0x8cac('0x18')](this['realtime'][_0x8cac('0xf')][this[_0x8cac('0x5')]['id']])){return logger[_0x8cac('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x8cac('0x5')]['id']);}else{logger[_0x8cac('0xe')](_0x8cac('0x19'),this[_0x8cac('0x4')]['id'],this[_0x8cac('0x5')]['id']);util[_0x8cac('0x1a')](this[_0x8cac('0x3')],this[_0x8cac('0x4')]['id'],this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']],null,this[_0x8cac('0x2')]);this[_0x8cac('0x6')]['agents'][this[_0x8cac('0x5')]['id']][_0x8cac('0x11')]=![];this[_0x8cac('0x6')]['agents'][this['agent']['id']][_0x8cac('0x12')]=undefined;util['writeLog'](this[_0x8cac('0x4')]['id'],this['realtime']['agents'][this['agent']['id']],_0x1b04a7?_0x8cac('0x1b'):_0x8cac('0x1c'));}if(!_0x1b04a7){setTimeout(this[_0x8cac('0x7')]['bind'](this),0x3e8);}};function agent(_0xa1d666,_0x49f401,_0x3aa580,_0x440848){return new Agent(_0xa1d666,_0x49f401,_0x3aa580,_0x440848);}module[_0x8cac('0x1d')]=agent; \ No newline at end of file +var _0x65d8=['agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','busy','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','uuid','../../../../../config/logger','routing','notificationId','squeue','push','bind','timeout','handleTimeout','drained','prototype','handleRun','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil'];(function(_0x3303bf,_0x51e0ef){var _0x185d3c=function(_0x5d0447){while(--_0x5d0447){_0x3303bf['push'](_0x3303bf['shift']());}};_0x185d3c(++_0x51e0ef);}(_0x65d8,0x139));var _0x865d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x65d8[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var uuid=require(_0x865d('0x0'));var util=require('./util');var logger=require(_0x865d('0x1'))(_0x865d('0x2'));var Agent=function(_0x212fd9,_0x2739d6,_0x15a673,_0x474079){this[_0x865d('0x3')]=uuid['v4']();this[_0x865d('0x4')]=_0x212fd9;this['agent']=_0x2739d6;this['realtime']=_0x15a673;this[_0x865d('0x2')]=_0x474079;this[_0x865d('0x4')][_0x865d('0x5')](this['handleRun']['bind'](this),this['handleTimeout'][_0x865d('0x6')](this));this[_0x865d('0x4')]['on'](_0x865d('0x7'),this[_0x865d('0x8')]['bind'](this));this[_0x865d('0x4')]['on'](_0x865d('0x9'),this['handleDrained'][_0x865d('0x6')](this));};Agent[_0x865d('0xa')][_0x865d('0x5')]=function(){this[_0x865d('0x4')]['push'](this[_0x865d('0xb')][_0x865d('0x6')](this),this[_0x865d('0x8')][_0x865d('0x6')](this));};Agent[_0x865d('0xa')][_0x865d('0xc')]=function(){this[_0x865d('0x8')](!![]);};Agent[_0x865d('0xa')][_0x865d('0xb')]=function(_0x13d6f5){logger[_0x865d('0xd')](_0x865d('0xe'),this[_0x865d('0x4')]['id'],this[_0x865d('0xf')]['id']);if(_[_0x865d('0x10')](this['realtime'][_0x865d('0x11')][this[_0x865d('0xf')]['id']])){logger[_0x865d('0xd')](_0x865d('0x12'),this[_0x865d('0x4')]['id'],this[_0x865d('0xf')]['id']);setTimeout(this[_0x865d('0x5')][_0x865d('0x6')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x865d('0x13')](this[_0x865d('0x4')]['id'],this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']],this[_0x865d('0x4')][_0x865d('0x15')],![])){this[_0x865d('0x14')]['agents'][this[_0x865d('0xf')]['id']][_0x865d('0x16')]=!![];this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']]['busyQueue']=undefined;util[_0x865d('0x17')](this['notificationId'],this[_0x865d('0x4')]['id'],this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']],null,this[_0x865d('0x2')]);util[_0x865d('0x18')](this[_0x865d('0x4')]['id'],this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']],_0x865d('0x19')+(this[_0x865d('0x2')][_0x865d('0x1a')]?_0x865d('0x1b'):''));}else{logger[_0x865d('0xd')](_0x865d('0x1c'),this[_0x865d('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x865d('0x5')][_0x865d('0x6')](this),0x3e8);}}};Agent[_0x865d('0xa')][_0x865d('0x8')]=function(_0x1dc022){if(_[_0x865d('0x10')](this[_0x865d('0x14')]['agents'][this[_0x865d('0xf')]['id']])){return logger[_0x865d('0xd')](_0x865d('0x12'),this[_0x865d('0x4')]['id'],this[_0x865d('0xf')]['id']);}else{logger['info'](_0x865d('0x1d'),this[_0x865d('0x4')]['id'],this[_0x865d('0xf')]['id']);util[_0x865d('0x1e')](this[_0x865d('0x3')],this[_0x865d('0x4')]['id'],this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']],null,this[_0x865d('0x2')]);this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']]['busy']=![];this['realtime'][_0x865d('0x11')][this['agent']['id']][_0x865d('0x1f')]=undefined;util[_0x865d('0x18')](this[_0x865d('0x4')]['id'],this[_0x865d('0x14')][_0x865d('0x11')][this[_0x865d('0xf')]['id']],_0x1dc022?'STOP':_0x865d('0x20'));}if(!_0x1dc022){setTimeout(this['push'][_0x865d('0x6')](this),0x3e8);}};function agent(_0x14d118,_0x1dfce8,_0x501e7e,_0x3ce807){return new Agent(_0x14d118,_0x1dfce8,_0x501e7e,_0x3ce807);}module['exports']=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 8808678..681d67a 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 _0x385f=['busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','info','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','TIMEOUT','exports','uuid','./util','../../../../../config/logger','squeue','queue','realtime','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0x385f,0xb6));var _0xf385=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x385f[_0x5e42a7];return _0x36d21b;};'use strict';var _=require('lodash');var uuid=require(_0xf385('0x0'));var util=require(_0xf385('0x1'));var logger=require(_0xf385('0x2'))('routing');var Beepall=function(_0x37babf,_0x157469,_0x3bd6c7,_0x67121e){this['notificationId']=uuid['v4']();this[_0xf385('0x3')]=_0x37babf;this[_0xf385('0x4')]=_0x157469;this[_0xf385('0x5')]=_0x3bd6c7;this[_0xf385('0x6')]=_0x67121e;this[_0xf385('0x3')][_0xf385('0x7')](this[_0xf385('0x8')][_0xf385('0x9')](this),this['handleTimeout']['bind'](this));this[_0xf385('0x3')]['on']('timeout',this[_0xf385('0xa')][_0xf385('0x9')](this));this['squeue']['on'](_0xf385('0xb'),this[_0xf385('0xc')]['bind'](this));};Beepall[_0xf385('0xd')][_0xf385('0x7')]=function(){this[_0xf385('0x3')]['push'](this[_0xf385('0x8')][_0xf385('0x9')](this),this['handleTimeout'][_0xf385('0x9')](this));};Beepall['prototype']['handleDrained']=function(_0x4af61c){this[_0xf385('0xa')](!![]);};Beepall[_0xf385('0xd')][_0xf385('0x8')]=function(_0x1d7d6b){var _0x28fb26=!![];if(!_[_0xf385('0xe')](this[_0xf385('0x4')])&&!_[_0xf385('0xe')](this[_0xf385('0x4')]['Agents'])&&this[_0xf385('0x4')][_0xf385('0xf')]['length']>0x0){for(var _0x16aa3e=0x0,_0x582bca;_0x16aa3e0x0){for(var _0x321c0a=0x0,_0x206a9b;_0x321c0a0x0&&_0x28c762[_0x7adaaf+_0x177f('0x25')]>=_0x28c762[_0x7adaaf+_0x177f('0x26')]){writeLog(_0x2880e6,_0x28c762,_0x7adaaf[_0x177f('0x27')]()+_0x177f('0x28'));return![];}}return!![];};exports[_0x177f('0x29')]=function(_0x1ae57e,_0x2a64d7,_0x13f570,_0x3d7f1c,_0x25d876){return sendNotification(!![],_0x1ae57e,_0x2a64d7,_0x13f570,_0x3d7f1c,_0x25d876);};exports[_0x177f('0x2a')]=function(_0xdf7bd,_0x4a1b02,_0xfa8ad0,_0x1df4e4,_0x4b9c40){return sendNotification(![],_0xdf7bd,_0x4a1b02,_0xfa8ad0,_0x1df4e4,_0x4b9c40);};exports[_0x177f('0x2b')]=writeLog; \ No newline at end of file +var _0x25a8=['hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause'];(function(_0x33466d,_0x4d7e8c){var _0x401b25=function(_0x13a18d){while(--_0x13a18d){_0x33466d['push'](_0x33466d['shift']());}};_0x401b25(++_0x4d7e8c);}(_0x25a8,0x126));var _0x825a=function(_0x5a4cea,_0x2fc40f){_0x5a4cea=_0x5a4cea-0x0;var _0x239ff0=_0x25a8[_0x5a4cea];return _0x239ff0;};'use strict';var _=require('lodash');var util=require(_0x825a('0x0'));var utils=require(_0x825a('0x1'));var Mustache=require(_0x825a('0x2'));var Redis=require('ioredis');var config=require(_0x825a('0x3'));var logger=require('../../../../../config/logger')(_0x825a('0x4'));config[_0x825a('0x5')]=_[_0x825a('0x6')](config[_0x825a('0x5')],{'host':_0x825a('0x7'),'port':0x18eb});var io=require(_0x825a('0x8'))(new Redis(config[_0x825a('0x5')]));function emit(_0x29a13c,_0x31be45,_0x215c51){io['to'](_0x29a13c)['emit'](_0x31be45,_0x215c51);}function sendNotification(_0x13b61d,_0x55c1d0,_0x579b53,_0x48696e,_0x1d1d7a,_0x460611){io['to'](util['format'](_0x825a('0x9'),_0x48696e[_0x825a('0xa')]))[_0x825a('0xb')]('user:save',_0x48696e);var _0x8add5d=_0x460611||{};var _0x1eec2d=_0x579b53['split']('.');var _0x558567={'uniqueid':_0x55c1d0,'channel':_0x1eec2d[0x0],'id':_0x1eec2d[0x1],'title':_0x1eec2d[0x0]+'\x20interaction','interactionId':_0x1eec2d[0x2],'queue':_0x1d1d7a?_0x1d1d7a[_0x825a('0xa')]:null,'sound':_0x8add5d[_0x825a('0xc')][_0x825a('0xd')],'shake':_0x8add5d[_0x825a('0xc')][_0x825a('0xe')]};try{if(!_0x8add5d['body']){_0x8add5d[_0x825a('0xf')]={};}if(_0x1d1d7a){_0x8add5d[_0x825a('0xf')][_0x825a('0x10')]=_0x1d1d7a;}else if(_0x8add5d[_0x825a('0xf')][_0x825a('0x10')]){delete _0x8add5d[_0x825a('0xf')][_0x825a('0x10')];}_0x558567[_0x825a('0x11')]=utils[_0x825a('0x12')](_0x8add5d['account'][_0x825a('0x13')],_0x8add5d);}catch(_0x58e23d){_0x558567[_0x825a('0x11')]=_0x825a('0x14');logger['error'](util[_0x825a('0x15')]('[%s][QUEUE]\x20%s',_0x55c1d0,_0x58e23d[_0x825a('0x16')]));}io['to'](util['format'](_0x825a('0x9'),_0x48696e[_0x825a('0xa')]))[_0x825a('0xb')](util[_0x825a('0x15')](_0x825a('0x17'),_0x13b61d?_0x825a('0x18'):_0x825a('0x19')),_0x558567);}function writeLog(_0x59946d,_0x513511,_0x1ff559){return logger[_0x825a('0x1a')](util['format'](_0x825a('0x1b'),_0x59946d,_0x513511[_0x825a('0xa')],_0x1ff559));}exports[_0x825a('0x1c')]=function(_0x3466f8,_0x105cd7,_0x3eace3,_0x312342){if(_0x105cd7[_0x825a('0x1d')]){writeLog(_0x3466f8,_0x105cd7,_0x825a('0x1e'));return![];}if(!_0x105cd7[_0x825a('0x1f')]){writeLog(_0x3466f8,_0x105cd7,_0x825a('0x20'));return![];}if(_0x105cd7[_0x3eace3+_0x825a('0x21')]){writeLog(_0x3466f8,_0x105cd7,'PAUSE');return![];}if(_0x312342&&_0x105cd7[_0x825a('0x22')](_0x3eace3+'Capacity')&&_0x105cd7['hasOwnProperty'](_0x3eace3+_0x825a('0x23'))){if(_0x105cd7[_0x3eace3+_0x825a('0x24')]>0x0&&_0x105cd7[_0x3eace3+'CurrentCapacity']>=_0x105cd7[_0x3eace3+_0x825a('0x24')]){writeLog(_0x3466f8,_0x105cd7,_0x3eace3['toUpperCase']()+_0x825a('0x25'));return![];}}return!![];};exports[_0x825a('0x26')]=function(_0x23beed,_0x3e6bf7,_0x46a28d,_0x16a359,_0x5494a0){return sendNotification(!![],_0x23beed,_0x3e6bf7,_0x46a28d,_0x16a359,_0x5494a0);};exports[_0x825a('0x27')]=function(_0x490532,_0x1327cc,_0xa52de7,_0x56e614,_0xd0e237){return sendNotification(![],_0x490532,_0x1327cc,_0xa52de7,_0x56e614,_0xd0e237);};exports[_0x825a('0x28')]=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 629936a..83e9243 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 _0x2898=['next','info','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x497880,_0x430dbc){var _0x1a3d4b=function(_0x25d7e1){while(--_0x25d7e1){_0x497880['push'](_0x497880['shift']());}};_0x1a3d4b(++_0x430dbc);}(_0x2898,0x11f));var _0x8289=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x2898[_0x308213];return _0x2e1619;};'use strict';var schema=require(_0x8289('0x0'));var sh=require(_0x8289('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0x8289('0x2'),'required':!![],'message':_0x8289('0x3')}});exports[_0x8289('0x4')]=function(_0x459415,_0x3ce352){return function(_0x393232){try{var _0x2943e7={'command':_0x3ce352[0x0]};var _0x31fb97=system[_0x8289('0x0')](_0x2943e7,{'typecast':!![]});if(_0x31fb97[_0x8289('0x5')]){logger[_0x8289('0x6')](_0x8289('0x7'),_0x459415,_[_0x8289('0x8')](_0x31fb97,_0x8289('0x9'))[_0x8289('0xa')](',\x20'));logger['info'](_0x8289('0xb'),_0x459415);_0x393232[_0x8289('0xc')]();}else{var _0x166292=this;var _0xdb2774=utils['getMustacheRender'](_0x3ce352[0x0],this);logger[_0x8289('0xd')](_0x8289('0xe'),_0x459415,_0xdb2774);sh['exec'](_[_0x8289('0xf')](_0xdb2774),function(_0x1f25e9,_0x552216){logger[_0x8289('0xd')](_0x8289('0x10'),_0x459415,_0x1f25e9);if(_0x1f25e9==0x0){var _0x151ead=_0x552216[_0x8289('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x8289('0x12')](_0x3ce352[0x1])||_[_0x8289('0x13')](_0x3ce352[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x459415);_0x166292['body'][_0x3ce352[0x1]]=_0x151ead;}else{logger['info'](_0x8289('0x14'),_0x459415,_0x3ce352[0x1],_0x151ead);_0x166292['body'][_0x3ce352[0x1]]=_0x151ead;}}_0x393232[_0x8289('0xc')]();});}}catch(_0x213d44){logger['error'](_0x8289('0x7'),_0x459415,_[_0x8289('0x15')](_0x213d44)?JSON[_0x8289('0x16')](_0x213d44):_0x213d44);logger[_0x8289('0xd')](_0x8289('0xb'),_0x459415);_0x393232[_0x8289('0xc')]();}};}; \ No newline at end of file +var _0xec5f=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','lodash','./utils','../../../../config/logger','string','consequence','length','map','join','info'];(function(_0x520a1b,_0x446485){var _0x11bea9=function(_0x2241cc){while(--_0x2241cc){_0x520a1b['push'](_0x520a1b['shift']());}};_0x11bea9(++_0x446485);}(_0xec5f,0x10e));var _0xfec5=function(_0xa6e7dc,_0x4781ef){_0xa6e7dc=_0xa6e7dc-0x0;var _0x3ca83c=_0xec5f[_0xa6e7dc];return _0x3ca83c;};'use strict';var schema=require(_0xfec5('0x0'));var sh=require('shelljs');var _=require(_0xfec5('0x1'));var utils=require(_0xfec5('0x2'));var logger=require(_0xfec5('0x3'))('routing');var system=schema({'command':{'type':_0xfec5('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xfec5('0x5')]=function(_0x568e3f,_0x12f95a){return function(_0x590bff){try{var _0x462189={'command':_0x12f95a[0x0]};var _0x5c1dac=system[_0xfec5('0x0')](_0x462189,{'typecast':!![]});if(_0x5c1dac[_0xfec5('0x6')]){logger['error']('[%s][SYSTEM]\x20%s',_0x568e3f,_[_0xfec5('0x7')](_0x5c1dac,'message')[_0xfec5('0x8')](',\x20'));logger[_0xfec5('0x9')](_0xfec5('0xa'),_0x568e3f);_0x590bff[_0xfec5('0xb')]();}else{var _0x2cbe67=this;var _0x1d0484=utils['getMustacheRender'](_0x12f95a[0x0],this);logger[_0xfec5('0x9')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x568e3f,_0x1d0484);sh[_0xfec5('0xc')](_['trim'](_0x1d0484),function(_0x5bd118,_0x3ce9e7){logger[_0xfec5('0x9')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x568e3f,_0x5bd118);if(_0x5bd118==0x0){var _0x266cde=_0x3ce9e7[_0xfec5('0xd')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x12f95a[0x1])||_[_0xfec5('0xe')](_0x12f95a[0x1])){logger[_0xfec5('0x9')](_0xfec5('0xf'),_0x568e3f);_0x2cbe67['body'][_0x12f95a[0x1]]=_0x266cde;}else{logger[_0xfec5('0x9')](_0xfec5('0x10'),_0x568e3f,_0x12f95a[0x1],_0x266cde);_0x2cbe67['body'][_0x12f95a[0x1]]=_0x266cde;}}_0x590bff[_0xfec5('0xb')]();});}}catch(_0x14309d){logger[_0xfec5('0x11')]('[%s][SYSTEM]\x20%s',_0x568e3f,_[_0xfec5('0x12')](_0x14309d)?JSON[_0xfec5('0x13')](_0x14309d):_0x14309d);logger[_0xfec5('0x9')](_0xfec5('0xa'),_0x568e3f);_0x590bff['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 1ffb0c8..20f6326 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 _0xbaa0=['../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x903e7f,_0x3a8c45){var _0x2411f3=function(_0x4392a0){while(--_0x4392a0){_0x903e7f['push'](_0x903e7f['shift']());}};_0x2411f3(++_0x3a8c45);}(_0xbaa0,0x10e));var _0x0baa=function(_0x3456e8,_0x5e604b){_0x3456e8=_0x3456e8-0x0;var _0x1d405d=_0xbaa0[_0x3456e8];return _0x1d405d;};'use strict';var schema=require(_0x0baa('0x0'));var _=require(_0x0baa('0x1'));var rpc={'chatInteraction':require(_0x0baa('0x2')),'openchannelInteraction':require(_0x0baa('0x3')),'smsInteraction':require(_0x0baa('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0baa('0x5'))};var logger=require(_0x0baa('0x6'))(_0x0baa('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x0baa('0x8')}});exports[_0x0baa('0x9')]=function(_0x33ee12,_0x5d6a3a,_0x4f4fd8,_0x5ce300){return function(_0x157138){try{var _0x346b2d={'tag':_0x5d6a3a[0x0]};var _0x3f4732=tag[_0x0baa('0x0')](_0x346b2d,{'typecast':!![]});if(_0x3f4732[_0x0baa('0xa')]){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,_[_0x0baa('0xd')](_0x3f4732,'message')['join'](',\x20'));logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);_0x157138[_0x0baa('0x10')]();}else{var _0x5de4fc={'ids':[_0x5d6a3a[0x0]]};if(rpc[_0x5ce300[_0x0baa('0x11')]+_0x0baa('0x12')]){rpc[_0x5ce300[_0x0baa('0x11')]+_0x0baa('0x12')]['addTags'](_0x5ce300[_0x0baa('0x13')]['id'],_0x5de4fc)[_0x0baa('0x14')](function(_0x19b3fe){logger[_0x0baa('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x33ee12,_0x5d6a3a[0x1],_0x5ce300[_0x0baa('0x11')],_0x5ce300[_0x0baa('0x13')]['id']);})[_0x0baa('0x15')](function(_0x1d05e7){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,JSON['stringify'](_0x1d05e7));logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);})['finally'](function(){_0x157138[_0x0baa('0x10')]();});}}}catch(_0x829f7){logger[_0x0baa('0xb')](_0x0baa('0xc'),_0x33ee12,_['isObject'](_0x829f7)?JSON[_0x0baa('0x16')](_0x829f7):_0x829f7);logger[_0x0baa('0xe')](_0x0baa('0xf'),_0x33ee12);_0x157138['next']();}};}; \ No newline at end of file +var _0xe033=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','join','info','next','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe033,0x1ad));var _0x3e03=function(_0xfccad4,_0xa381f7){_0xfccad4=_0xfccad4-0x0;var _0x3f2a5a=_0xe033[_0xfccad4];return _0x3f2a5a;};'use strict';var schema=require(_0x3e03('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x3e03('0x1')),'openchannelInteraction':require(_0x3e03('0x2')),'smsInteraction':require(_0x3e03('0x3')),'mailInteraction':require(_0x3e03('0x4')),'faxInteraction':require(_0x3e03('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x3e03('0x6'))(_0x3e03('0x7'));var tag=schema({'tag':{'type':_0x3e03('0x8'),'required':!![],'message':_0x3e03('0x9')}});exports[_0x3e03('0xa')]=function(_0x42c347,_0x391eb9,_0x40f3d2,_0x5b2032){return function(_0x2d6794){try{var _0x4aa604={'tag':_0x391eb9[0x0]};var _0x5971b9=tag[_0x3e03('0x0')](_0x4aa604,{'typecast':!![]});if(_0x5971b9[_0x3e03('0xb')]){logger['error'](_0x3e03('0xc'),_0x42c347,_[_0x3e03('0xd')](_0x5971b9,'message')[_0x3e03('0xe')](',\x20'));logger[_0x3e03('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x42c347);_0x2d6794[_0x3e03('0x10')]();}else{var _0x408063={'ids':[_0x391eb9[0x0]]};if(rpc[_0x5b2032['channel']+_0x3e03('0x11')]){rpc[_0x5b2032[_0x3e03('0x12')]+'Interaction'][_0x3e03('0x13')](_0x5b2032[_0x3e03('0x14')]['id'],_0x408063)['then'](function(_0x2f6a33){logger[_0x3e03('0xf')](_0x3e03('0x15'),_0x42c347,_0x391eb9[0x1],_0x5b2032[_0x3e03('0x12')],_0x5b2032[_0x3e03('0x14')]['id']);})[_0x3e03('0x16')](function(_0x17758e){logger[_0x3e03('0x17')]('[%s][TAG]\x20%s',_0x42c347,JSON[_0x3e03('0x18')](_0x17758e));logger[_0x3e03('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x42c347);})['finally'](function(){_0x2d6794['next']();});}}}catch(_0x261903){logger[_0x3e03('0x17')](_0x3e03('0xc'),_0x42c347,_[_0x3e03('0x19')](_0x261903)?JSON[_0x3e03('0x18')](_0x261903):_0x261903);logger['info'](_0x3e03('0x1a'),_0x42c347);_0x2d6794[_0x3e03('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 065c658..053c0a1 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 _0xb634=['mustache','exports','merge','body','contact','message','account','interaction'];(function(_0x23840d,_0x1b8d7a){var _0x14265b=function(_0x25b9b6){while(--_0x25b9b6){_0x23840d['push'](_0x23840d['shift']());}};_0x14265b(++_0x1b8d7a);}(_0xb634,0x1c0));var _0x4b63=function(_0x4812c6,_0x2e4bd1){_0x4812c6=_0x4812c6-0x0;var _0x375230=_0xb634[_0x4812c6];return _0x375230;};'use strict';var Mustache=require(_0x4b63('0x0'));var _=require('lodash');module[_0x4b63('0x1')]={'getMustacheRender':function(_0x53aafa,_0x938dee){return Mustache['render'](_0x53aafa,_[_0x4b63('0x2')](_0x938dee[_0x4b63('0x3')],{'contact':_0x938dee[_0x4b63('0x4')],'message':_0x938dee[_0x4b63('0x5')],'account':_0x938dee[_0x4b63('0x6')],'interaction':_0x938dee[_0x4b63('0x7')],'list':_0x938dee['list']}))||'';}}; \ No newline at end of file +var _0xd2ce=['interaction','lodash','render','merge','body','contact','message'];(function(_0x5980a7,_0x44b693){var _0x504639=function(_0x31e753){while(--_0x31e753){_0x5980a7['push'](_0x5980a7['shift']());}};_0x504639(++_0x44b693);}(_0xd2ce,0x13c));var _0xed2c=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xd2ce[_0x187ee1];return _0x388160;};'use strict';var Mustache=require('mustache');var _=require(_0xed2c('0x0'));module['exports']={'getMustacheRender':function(_0x409f03,_0x271df9){return Mustache[_0xed2c('0x1')](_0x409f03,_[_0xed2c('0x2')](_0x271df9[_0xed2c('0x3')],{'contact':_0x271df9[_0xed2c('0x4')],'message':_0x271df9[_0xed2c('0x5')],'account':_0x271df9['account'],'interaction':_0x271df9[_0xed2c('0x6')],'list':_0x271df9['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2ddba39..75c0e0b 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 _0x09c2=['channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','split','push','slice','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','mailQueues','waiting','smsQueues','faxQueues','available','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules'];(function(_0x505a40,_0x59994f){var _0x472c12=function(_0x189593){while(--_0x189593){_0x505a40['push'](_0x505a40['shift']());}};_0x472c12(++_0x59994f);}(_0x09c2,0x9e));var _0x209c=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x09c2[_0x4a96d2];return _0x38af04;};'use strict';var _=require(_0x209c('0x0'));var util=require(_0x209c('0x1'));var path=require(_0x209c('0x2'));var fs=require('fs');var jayson=require(_0x209c('0x3'));var BPromise=require('bluebird');var uuid=require(_0x209c('0x4'));var config=require(_0x209c('0x5'));var logger=require(_0x209c('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x209c('0x7')),'mailQueueReport':require(_0x209c('0x8')),'chatQueueReport':require(_0x209c('0x9')),'smsQueueReport':require(_0x209c('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x209c('0xb'));function getId(_0xb83a42,_0x413d70,_0x557486){return util['format'](_0x209c('0xc'),_0xb83a42,_0x413d70||0x0,_0x557486||0x0);}function getIntervals(_0x4c6dd4,_0xb24d3c){var _0x26796f=[];if(!_['isNil'](_0xb24d3c[_0x209c('0xd')])&&!_[_0x209c('0xe')](_0x4c6dd4[_0xb24d3c[_0x209c('0xd')]])&&!_[_0x209c('0xe')](_0x4c6dd4[_0xb24d3c['IntervalId']][_0x209c('0xf')])){_0x26796f=_[_0x209c('0x10')](_0x4c6dd4[_0xb24d3c[_0x209c('0xd')]]['Intervals'],_0x209c('0x11'));}else if(!_['isNil'](_0xb24d3c[_0x209c('0x11')])){_0x26796f=[_0xb24d3c[_0x209c('0x11')]];}return _0x26796f;}exports[_0x209c('0x12')]=function(_0x4c1991){_0x4c1991[_0x209c('0x13')]={};return new BPromise(function(_0x5a0532,_0xbd78b5){var _0x43b20f={'Start':function(_0x1319e8){var _0x325bdf=this;return new Promise(function(_0x5d7003,_0x4ce4fb){if(_0x1319e8){try{var _0x4f8f41=[];var _0x38e704=getId(_0x1319e8[_0x209c('0x14')],_0x1319e8[_0x209c('0x15')]?_0x1319e8[_0x209c('0x15')]['id']:0x0,_0x1319e8[_0x209c('0x16')]?_0x1319e8['interaction']['id']:0x0);if(_0x1319e8['applications']&&_[_0x209c('0x17')](_0x1319e8[_0x209c('0x18')])&&_0x1319e8[_0x209c('0x18')][_0x209c('0x19')]){for(var _0x4138aa=0x0;_0x4138aa<_0x1319e8[_0x209c('0x18')][_0x209c('0x19')];_0x4138aa+=0x1){var _0x4a1f47=_0x1319e8[_0x209c('0x18')][_0x4138aa];if(fs[_0x209c('0x1a')](path[_0x209c('0x1b')](__dirname,_0x209c('0x18'),_0x4a1f47[_0x209c('0x1c')]+_0x209c('0x1d')))){var _0x22d576=[];switch(_0x4a1f47[_0x209c('0x1c')]['toLowerCase']()){case _0x209c('0x1e'):var _0x1ac816=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x1ac816[0x0]);_0x22d576['push'](_0x1ac816[_0x209c('0x22')](0x1,_0x1ac816[_0x209c('0x19')])[_0x209c('0x1b')](','));break;case'dialogflow':var _0x51abc2=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x51abc2[0x0]);_0x22d576[_0x209c('0x21')](_0x51abc2[0x1]);_0x22d576['push'](_0x51abc2['slice'](0x2,_0x51abc2[_0x209c('0x19')])[_0x209c('0x1b')](','));break;case _0x209c('0x23'):var _0x17b644=_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');_0x22d576[_0x209c('0x21')](_0x17b644[0x0]);_0x22d576[_0x209c('0x21')](_0x17b644[0x1]);_0x22d576[_0x209c('0x21')](_0x17b644[0x2]);_0x22d576[_0x209c('0x21')](_0x17b644[0x3]);_0x22d576[_0x209c('0x21')](_0x17b644['slice'](0x4,_0x17b644['length'])[_0x209c('0x1b')](','));break;case _0x209c('0x15'):_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x1f')]);break;case _0x209c('0x24'):_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x25')]);_0x22d576[_0x209c('0x21')](_0x4a1f47[_0x209c('0x1f')]);break;default:_0x22d576=_['isNil'](_0x4a1f47[_0x209c('0x1f')])?[]:_0x4a1f47[_0x209c('0x1f')][_0x209c('0x20')](',');}var _0x3c46b2={'id':util['format'](_0x209c('0x26'),_0x38e704,_0x4a1f47['id'],_0x4a1f47[_0x209c('0x1c')]),'condition':require(_0x209c('0x27'))['condition'](_0x38e704,getIntervals(_0x4c1991[_0x209c('0x28')],_0x4a1f47),_0x4c1991),'consequence':require('./applications/'+_0x4a1f47['app'])[_0x209c('0x29')](_0x38e704,_0x22d576,_0x4c1991,_0x1319e8),'p':_0x4a1f47[_0x209c('0x2a')]||0x0};logger[_0x209c('0x2b')](_0x209c('0x2c'),_0x3c46b2['id'],'on\x20interval',getIntervals(_0x4c1991[_0x209c('0x28')],_0x4a1f47)[_0x209c('0x1b')](_0x209c('0x2d')));_0x4f8f41['push'](_0x3c46b2);}else{logger['error'](_0x209c('0x2e'),path[_0x209c('0x1b')](__dirname,_0x209c('0x18'),_0x4a1f47[_0x209c('0x1c')]+'.js'));}}_0x4c1991['rules'][_0x38e704]=new RuleEngine(_0x4f8f41);_0x4c1991[_0x209c('0x13')][_0x38e704][_0x209c('0x2f')](_0x1319e8,function(_0xad7fa){logger[_0x209c('0x2b')](_0x209c('0x30'),JSON[_0x209c('0x31')](_0xad7fa['matchPath']));if(_0x4c1991[_0x209c('0x13')][_0x38e704]){_0x4c1991[_0x209c('0x13')][_0x38e704][_0x209c('0x32')](_0x209c('0x33'));}});return _0x5d7003({'code':0xc8,'message':_0x1319e8});}else{logger[_0x209c('0x2b')](_0x209c('0x34'));return _0x5d7003({'code':0xc8,'message':_0x1319e8});}}catch(_0x212071){logger[_0x209c('0x35')](_0x212071[_0x209c('0x36')]);return _0x4ce4fb(_0x325bdf[_0x209c('0x35')](0x1f4,_0x212071));}}return _0x4ce4fb(_0x209c('0x37'));});},'AcceptMessage':function(_0x39a3dd){var _0x1b0a4f=this;return new Promise(function(_0x6b6617,_0x115ddf){if(_0x39a3dd[_0x209c('0x15')]&&_0x39a3dd[_0x209c('0x15')]['id']){try{var _0x4e0763=getId(_0x39a3dd[_0x209c('0x14')],_0x39a3dd[_0x209c('0x15')]?_0x39a3dd[_0x209c('0x15')]['id']:0x0,_0x39a3dd[_0x209c('0x16')]?_0x39a3dd[_0x209c('0x16')]['id']:0x0);if(_0x4c1991[_0x209c('0x13')][_0x4e0763]){_0x4c1991[_0x209c('0x13')][_0x4e0763][_0x209c('0x32')]('end');if(rpc[_0x39a3dd['channel']+_0x209c('0x38')]){rpc[_0x39a3dd[_0x209c('0x14')]+_0x209c('0x38')][_0x209c('0x39')](_0x4e0763,{'UserId':_0x39a3dd[_0x209c('0x15')][_0x209c('0x3a')]})[_0x209c('0x3b')](function(_0x138d92){logger[_0x209c('0x35')](_0x209c('0x3c'));});}}return _0x6b6617({'code':0xc8,'message':_0x39a3dd});}catch(_0x25bbf1){logger['error'](_0x25bbf1['stack']);return _0x115ddf(_0x1b0a4f[_0x209c('0x35')](0x1f4,_0x25bbf1));}}logger['error'](_0x209c('0x3d'));return _0x115ddf(_0x1b0a4f[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'RejectMessage':function(_0x1758b4){var _0x22dc02=this;return new Promise(function(_0x3eb09e,_0x4cf096){if(_0x1758b4[_0x209c('0x3e')]&&_0x1758b4['agent']['id']){try{if(_0x4c1991[_0x209c('0x3f')][_0x1758b4['agent']['id']]){_0x4c1991['agents'][_0x1758b4[_0x209c('0x3e')]['id']][_0x209c('0x40')]=![];_0x4c1991[_0x209c('0x3f')][_0x1758b4[_0x209c('0x3e')]['id']][_0x209c('0x41')]=undefined;}return _0x3eb09e({'code':0xc8,'message':_0x1758b4});}catch(_0x224880){logger[_0x209c('0x35')](_0x224880['stack']);return _0x4cf096(_0x22dc02[_0x209c('0x35')](0x1f4,_0x224880));}}logger[_0x209c('0x35')](_0x209c('0x3d'));return _0x4cf096(_0x22dc02[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'AbandonInteraction':function(_0x161f06){var _0x52d02f=this;return new Promise(function(_0x2e677e,_0x2ceb94){if(_0x161f06[_0x209c('0x14')]&&_0x161f06[_0x209c('0x16')]&&_0x161f06[_0x209c('0x16')]['id']){try{var _0x44669b=getId(_0x161f06[_0x209c('0x14')],_0x161f06[_0x209c('0x15')]?_0x161f06['message']['id']:0x0,_0x161f06[_0x209c('0x16')]?_0x161f06[_0x209c('0x16')]['id']:0x0);if(_0x4c1991[_0x209c('0x13')][_0x44669b]){_0x4c1991[_0x209c('0x13')][_0x44669b][_0x209c('0x32')]('end');}return _0x2e677e({'code':0xc8,'message':_0x161f06});}catch(_0xa47038){logger[_0x209c('0x35')](_0xa47038[_0x209c('0x36')]);return _0x2ceb94(_0x52d02f[_0x209c('0x35')](0x1f4,_0xa47038));}}logger[_0x209c('0x35')]('message\x20is\x20empty');return _0x2ceb94(_0x52d02f[_0x209c('0x35')](0x1f4,_0x209c('0x3d')));});},'AgentCapacity':function(_0x4a5a4e){var _0x5a47bc=this;return new Promise(function(_0xe8bda5,_0x7ed1a1){if(_0x4c1991['agents'][_0x209c('0x42')](_0x4a5a4e['id'])){for(var _0x2ccb2b in _0x4a5a4e[_0x209c('0x43')]){if(_0x4a5a4e['capacity'][_0x209c('0x42')](_0x2ccb2b)){if(_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x209c('0x42')](_0x2ccb2b+_0x209c('0x44'))){_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x2ccb2b+_0x209c('0x44')]=parseInt(_0x4a5a4e[_0x209c('0x43')][_0x2ccb2b],0xa);}}}_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']][_0x209c('0x45')]();return _0xe8bda5({'code':0xc8,'message':_0x4c1991[_0x209c('0x3f')][_0x4a5a4e['id']]});}else{return _0x7ed1a1(_0x5a47bc[_0x209c('0x35')](0x1f4,_0x209c('0x46')));}});},'Agents':function(_0x16e17e){return new Promise(function(_0x481d71,_0xfd0007){var _0x26f749=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x3f')]);_0x481d71({'count':_0x26f749[_0x209c('0x19')],'rows':_0x26f749});});},'ChatQueues':function(_0x1306ae){return new Promise(function(_0x229da4,_0x4c1a8b){var _0x200baf=[];for(var _0x26ffda in _0x4c1991['chatQueues']){if(_0x4c1991[_0x209c('0x48')][_0x209c('0x42')](_0x26ffda)){var _0x52739e=_0x4c1991[_0x209c('0x48')][_0x26ffda];var _0x3310dd={'id':_0x52739e['id'],'available':_0x52739e['available'],'loggedIn':_0x52739e[_0x209c('0x49')],'name':_0x52739e[_0x209c('0x4a')],'paused':_0x52739e[_0x209c('0x4b')],'waiting':_0x52739e['waiting']};_0x200baf[_0x209c('0x21')](_0x3310dd);}}_0x229da4({'count':_0x200baf['length'],'rows':_0x200baf});});},'MailQueues':function(_0x391b58){return new Promise(function(_0x534d97,_0x42766a){var _0x53b94d=[];for(var _0x1efd8a in _0x4c1991[_0x209c('0x4c')]){if(_0x4c1991[_0x209c('0x4c')]['hasOwnProperty'](_0x1efd8a)){var _0x2c8f52=_0x4c1991[_0x209c('0x4c')][_0x1efd8a];var _0x20332d={'id':_0x2c8f52['id'],'available':_0x2c8f52['available'],'loggedIn':_0x2c8f52[_0x209c('0x49')],'name':_0x2c8f52['name'],'paused':_0x2c8f52[_0x209c('0x4b')],'waiting':_0x2c8f52[_0x209c('0x4d')]};_0x53b94d['push'](_0x20332d);}}_0x534d97({'count':_0x53b94d[_0x209c('0x19')],'rows':_0x53b94d});});},'OpenchannelQueues':function(_0x58e475){return new Promise(function(_0x27d2d0,_0xb88d2f){var _0x47817d=[];for(var _0xcfe3ff in _0x4c1991['openchannelQueues']){if(_0x4c1991['openchannelQueues'][_0x209c('0x42')](_0xcfe3ff)){var _0x2e536e=_0x4c1991['openchannelQueues'][_0xcfe3ff];var _0x2b1c4b={'id':_0x2e536e['id'],'available':_0x2e536e['available'],'loggedIn':_0x2e536e['loggedIn'],'name':_0x2e536e[_0x209c('0x4a')],'paused':_0x2e536e[_0x209c('0x4b')],'waiting':_0x2e536e[_0x209c('0x4d')]};_0x47817d[_0x209c('0x21')](_0x2b1c4b);}}_0x27d2d0({'count':_0x47817d['length'],'rows':_0x47817d});});},'SmsQueues':function(_0x4dd843){return new Promise(function(_0x1637f2,_0x4f6430){var _0x2b9a62=[];for(var _0x474a72 in _0x4c1991[_0x209c('0x4e')]){if(_0x4c1991[_0x209c('0x4e')][_0x209c('0x42')](_0x474a72)){var _0x1acb17=_0x4c1991[_0x209c('0x4e')][_0x474a72];var _0x906960={'id':_0x1acb17['id'],'available':_0x1acb17['available'],'loggedIn':_0x1acb17['loggedIn'],'name':_0x1acb17['name'],'paused':_0x1acb17[_0x209c('0x4b')],'waiting':_0x1acb17['waiting']};_0x2b9a62[_0x209c('0x21')](_0x906960);}}_0x1637f2({'count':_0x2b9a62[_0x209c('0x19')],'rows':_0x2b9a62});});},'FaxQueues':function(_0x3c9949){return new Promise(function(_0x51ab98,_0x35da24){var _0x490f36=[];for(var _0x4f6fff in _0x4c1991[_0x209c('0x4f')]){if(_0x4c1991[_0x209c('0x4f')][_0x209c('0x42')](_0x4f6fff)){var _0x3a27f4=_0x4c1991[_0x209c('0x4f')][_0x4f6fff];var _0x597c49={'id':_0x3a27f4['id'],'available':_0x3a27f4[_0x209c('0x50')],'loggedIn':_0x3a27f4[_0x209c('0x49')],'name':_0x3a27f4[_0x209c('0x4a')],'paused':_0x3a27f4[_0x209c('0x4b')],'waiting':_0x3a27f4[_0x209c('0x4d')]};_0x490f36[_0x209c('0x21')](_0x597c49);}}_0x51ab98({'count':_0x490f36[_0x209c('0x19')],'rows':_0x490f36});});},'WhatsappQueues':function(_0x4a36c5){return new Promise(function(_0x40b265,_0x109d01){var _0x3f7127=[];for(var _0x5629a2 in _0x4c1991[_0x209c('0x51')]){if(_0x4c1991[_0x209c('0x51')][_0x209c('0x42')](_0x5629a2)){var _0x4b291e=_0x4c1991[_0x209c('0x51')][_0x5629a2];var _0x48ecfb={'id':_0x4b291e['id'],'available':_0x4b291e['available'],'loggedIn':_0x4b291e[_0x209c('0x49')],'name':_0x4b291e[_0x209c('0x4a')],'paused':_0x4b291e[_0x209c('0x4b')],'waiting':_0x4b291e[_0x209c('0x4d')]};_0x3f7127[_0x209c('0x21')](_0x48ecfb);}}_0x40b265({'count':_0x3f7127[_0x209c('0x19')],'rows':_0x3f7127});});},'ChatQueuesWaitingInteractions':function(_0x23b89d){return new Promise(function(_0x36e7da,_0x3f5ad3){var _0x2ebc8a=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x52')]);_0x36e7da({'count':_0x2ebc8a[_0x209c('0x19')],'rows':_0x2ebc8a});});},'MailQueuesWaitingInteractions':function(_0x5ad7a4){return new Promise(function(_0xbfc24a,_0x34bcfd){var _0x52b56b=_['values'](_0x4c1991[_0x209c('0x53')]);_0xbfc24a({'count':_0x52b56b[_0x209c('0x19')],'rows':_0x52b56b});});},'OpenchannelQueuesWaitingInteractions':function(_0x16cfdd){return new Promise(function(_0x2eff1c,_0x5af181){var _0x188930=_['values'](_0x4c1991[_0x209c('0x54')]);_0x2eff1c({'count':_0x188930[_0x209c('0x19')],'rows':_0x188930});});},'SmsQueuesWaitingInteractions':function(_0x3f2577){return new Promise(function(_0x1dd3ec,_0x6e6fb1){var _0x5be559=_[_0x209c('0x47')](_0x4c1991[_0x209c('0x55')]);_0x1dd3ec({'count':_0x5be559['length'],'rows':_0x5be559});});},'FaxQueuesWaitingInteractions':function(_0x59cf15){return new Promise(function(_0x498747,_0x3faf40){var _0x8dbba9=_[_0x209c('0x47')](_0x4c1991['faxQueuesWaitingInteractions']);_0x498747({'count':_0x8dbba9[_0x209c('0x19')],'rows':_0x8dbba9});});},'WhatsappQueuesWaitingInteractions':function(_0x5e2328){return new Promise(function(_0x379c88,_0x7106ca){var _0x102ddd=_[_0x209c('0x47')](_0x4c1991['whatsappQueuesWaitingInteractions']);_0x379c88({'count':_0x102ddd['length'],'rows':_0x102ddd});});}};var _0x2098d2=jayson['server'](_0x43b20f)[_0x209c('0x56')]();_0x2098d2['on'](_0x209c('0x35'),function(_0x232c2f){logger[_0x209c('0x35')](JSON[_0x209c('0x31')](_0x232c2f));return _0xbd78b5(_0x232c2f);});_0x2098d2['listen'](0x232c,'127.0.0.1',function(){console['log'](_0x209c('0x57'),0x232c);return _0x5a0532(_0x209c('0x58')+0x232c);});});}; \ No newline at end of file +var _0x5445=['routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','amazonlex','split','TagId','intervals','./applications/','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','matchPath','stack','routing\x20is\x20empty','emit','end','channel','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','listen','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','../../../config/environment','../../../config/logger'];(function(_0x2a6464,_0x277d91){var _0x3ccced=function(_0x2332f8){while(--_0x2332f8){_0x2a6464['push'](_0x2a6464['shift']());}};_0x3ccced(++_0x277d91);}(_0x5445,0xfa));var _0x5544=function(_0x533ca6,_0x4ed3fb){_0x533ca6=_0x533ca6-0x0;var _0x34f0bd=_0x5445[_0x533ca6];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require(_0x5544('0x0'));var path=require(_0x5544('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x5544('0x2'));var uuid=require('uuid');var config=require(_0x5544('0x3'));var logger=require(_0x5544('0x4'))(_0x5544('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5544('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x5544('0x7')),'faxQueueReport':require(_0x5544('0x8')),'whatsappQueueReport':require(_0x5544('0x9'))};var RuleEngine=require(_0x5544('0xa'));function getId(_0xdac10d,_0x52c1cd,_0x3179cd){return util['format'](_0x5544('0xb'),_0xdac10d,_0x52c1cd||0x0,_0x3179cd||0x0);}function getIntervals(_0x53d3dd,_0x595b7b){var _0x4914f2=[];if(!_[_0x5544('0xc')](_0x595b7b[_0x5544('0xd')])&&!_[_0x5544('0xc')](_0x53d3dd[_0x595b7b[_0x5544('0xd')]])&&!_[_0x5544('0xc')](_0x53d3dd[_0x595b7b['IntervalId']][_0x5544('0xe')])){_0x4914f2=_[_0x5544('0xf')](_0x53d3dd[_0x595b7b['IntervalId']]['Intervals'],'interval');}else if(!_['isNil'](_0x595b7b[_0x5544('0x10')])){_0x4914f2=[_0x595b7b['interval']];}return _0x4914f2;}exports['listen']=function(_0x49771f){_0x49771f[_0x5544('0x11')]={};return new BPromise(function(_0x121cda,_0x55540e){var _0x52255a={'Start':function(_0x30995b){var _0x82441e=this;return new Promise(function(_0x5c28cf,_0x326f1e){if(_0x30995b){try{var _0x3bb71c=[];var _0x4545f1=getId(_0x30995b['channel'],_0x30995b[_0x5544('0x12')]?_0x30995b[_0x5544('0x12')]['id']:0x0,_0x30995b['interaction']?_0x30995b[_0x5544('0x13')]['id']:0x0);if(_0x30995b[_0x5544('0x14')]&&_[_0x5544('0x15')](_0x30995b[_0x5544('0x14')])&&_0x30995b[_0x5544('0x14')][_0x5544('0x16')]){for(var _0x542105=0x0;_0x542105<_0x30995b[_0x5544('0x14')][_0x5544('0x16')];_0x542105+=0x1){var _0x163c58=_0x30995b[_0x5544('0x14')][_0x542105];if(fs[_0x5544('0x17')](path[_0x5544('0x18')](__dirname,_0x5544('0x14'),_0x163c58[_0x5544('0x19')]+_0x5544('0x1a')))){var _0x4c038b=[];switch(_0x163c58[_0x5544('0x19')][_0x5544('0x1b')]()){case _0x5544('0x1c'):var _0x5d9aca=_0x163c58[_0x5544('0x1d')]['split'](',');_0x4c038b[_0x5544('0x1e')](_0x5d9aca[0x0]);_0x4c038b['push'](_0x5d9aca[_0x5544('0x1f')](0x1,_0x5d9aca['length'])[_0x5544('0x18')](','));break;case _0x5544('0x20'):var _0x48ea07=_0x163c58[_0x5544('0x1d')]['split'](',');_0x4c038b[_0x5544('0x1e')](_0x48ea07[0x0]);_0x4c038b[_0x5544('0x1e')](_0x48ea07[0x1]);_0x4c038b[_0x5544('0x1e')](_0x48ea07[_0x5544('0x1f')](0x2,_0x48ea07['length'])[_0x5544('0x18')](','));break;case _0x5544('0x21'):var _0x35314f=_0x163c58[_0x5544('0x1d')][_0x5544('0x22')](',');_0x4c038b[_0x5544('0x1e')](_0x35314f[0x0]);_0x4c038b[_0x5544('0x1e')](_0x35314f[0x1]);_0x4c038b[_0x5544('0x1e')](_0x35314f[0x2]);_0x4c038b[_0x5544('0x1e')](_0x35314f[0x3]);_0x4c038b[_0x5544('0x1e')](_0x35314f[_0x5544('0x1f')](0x4,_0x35314f[_0x5544('0x16')])[_0x5544('0x18')](','));break;case'message':_0x4c038b[_0x5544('0x1e')](_0x163c58[_0x5544('0x1d')]);break;case'tag':_0x4c038b[_0x5544('0x1e')](_0x163c58[_0x5544('0x23')]);_0x4c038b['push'](_0x163c58[_0x5544('0x1d')]);break;default:_0x4c038b=_['isNil'](_0x163c58['appdata'])?[]:_0x163c58['appdata'][_0x5544('0x22')](',');}var _0xbd565f={'id':util['format']('%s:%s:%s',_0x4545f1,_0x163c58['id'],_0x163c58['app']),'condition':require('./interval')['condition'](_0x4545f1,getIntervals(_0x49771f[_0x5544('0x24')],_0x163c58),_0x49771f),'consequence':require(_0x5544('0x25')+_0x163c58[_0x5544('0x19')])['consequence'](_0x4545f1,_0x4c038b,_0x49771f,_0x30995b),'p':_0x163c58['priority']||0x0};logger['info'](_0x5544('0x26'),_0xbd565f['id'],_0x5544('0x27'),getIntervals(_0x49771f[_0x5544('0x24')],_0x163c58)[_0x5544('0x18')](_0x5544('0x28')));_0x3bb71c[_0x5544('0x1e')](_0xbd565f);}else{logger[_0x5544('0x29')](_0x5544('0x2a'),path[_0x5544('0x18')](__dirname,_0x5544('0x14'),_0x163c58['app']+_0x5544('0x1a')));}}_0x49771f[_0x5544('0x11')][_0x4545f1]=new RuleEngine(_0x3bb71c);_0x49771f[_0x5544('0x11')][_0x4545f1][_0x5544('0x2b')](_0x30995b,function(_0x383b64){logger[_0x5544('0x2c')](_0x5544('0x2d'),JSON['stringify'](_0x383b64[_0x5544('0x2e')]));if(_0x49771f[_0x5544('0x11')][_0x4545f1]){_0x49771f[_0x5544('0x11')][_0x4545f1]['emit']('complete');}});return _0x5c28cf({'code':0xc8,'message':_0x30995b});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x5c28cf({'code':0xc8,'message':_0x30995b});}}catch(_0x4dc3f2){logger['error'](_0x4dc3f2[_0x5544('0x2f')]);return _0x326f1e(_0x82441e[_0x5544('0x29')](0x1f4,_0x4dc3f2));}}return _0x326f1e(_0x5544('0x30'));});},'AcceptMessage':function(_0x4d4eec){var _0x5c902e=this;return new Promise(function(_0x5be5c3,_0x1db5c3){if(_0x4d4eec['message']&&_0x4d4eec[_0x5544('0x12')]['id']){try{var _0x89e1ef=getId(_0x4d4eec['channel'],_0x4d4eec[_0x5544('0x12')]?_0x4d4eec[_0x5544('0x12')]['id']:0x0,_0x4d4eec['interaction']?_0x4d4eec[_0x5544('0x13')]['id']:0x0);if(_0x49771f[_0x5544('0x11')][_0x89e1ef]){_0x49771f['rules'][_0x89e1ef][_0x5544('0x31')](_0x5544('0x32'));if(rpc[_0x4d4eec[_0x5544('0x33')]+_0x5544('0x34')]){rpc[_0x4d4eec[_0x5544('0x33')]+_0x5544('0x34')][_0x5544('0x35')](_0x89e1ef,{'UserId':_0x4d4eec[_0x5544('0x12')][_0x5544('0x36')]})[_0x5544('0x37')](function(_0x467917){logger[_0x5544('0x29')]('error\x20update\x20queue\x20report');});}}return _0x5be5c3({'code':0xc8,'message':_0x4d4eec});}catch(_0xc21b2a){logger[_0x5544('0x29')](_0xc21b2a['stack']);return _0x1db5c3(_0x5c902e[_0x5544('0x29')](0x1f4,_0xc21b2a));}}logger[_0x5544('0x29')](_0x5544('0x38'));return _0x1db5c3(_0x5c902e[_0x5544('0x29')](0x1f4,_0x5544('0x38')));});},'RejectMessage':function(_0x556c6c){var _0x303a71=this;return new Promise(function(_0x2c85dc,_0x31c3f8){if(_0x556c6c[_0x5544('0x39')]&&_0x556c6c['agent']['id']){try{if(_0x49771f[_0x5544('0x3a')][_0x556c6c[_0x5544('0x39')]['id']]){_0x49771f['agents'][_0x556c6c[_0x5544('0x39')]['id']][_0x5544('0x3b')]=![];_0x49771f[_0x5544('0x3a')][_0x556c6c[_0x5544('0x39')]['id']]['busyQueue']=undefined;}return _0x2c85dc({'code':0xc8,'message':_0x556c6c});}catch(_0x4ebbbb){logger[_0x5544('0x29')](_0x4ebbbb[_0x5544('0x2f')]);return _0x31c3f8(_0x303a71['error'](0x1f4,_0x4ebbbb));}}logger[_0x5544('0x29')](_0x5544('0x38'));return _0x31c3f8(_0x303a71[_0x5544('0x29')](0x1f4,_0x5544('0x38')));});},'AbandonInteraction':function(_0x432eb7){var _0x136023=this;return new Promise(function(_0x446263,_0x45cdda){if(_0x432eb7[_0x5544('0x33')]&&_0x432eb7[_0x5544('0x13')]&&_0x432eb7['interaction']['id']){try{var _0x58c387=getId(_0x432eb7[_0x5544('0x33')],_0x432eb7['message']?_0x432eb7['message']['id']:0x0,_0x432eb7[_0x5544('0x13')]?_0x432eb7[_0x5544('0x13')]['id']:0x0);if(_0x49771f[_0x5544('0x11')][_0x58c387]){_0x49771f[_0x5544('0x11')][_0x58c387][_0x5544('0x31')](_0x5544('0x32'));}return _0x446263({'code':0xc8,'message':_0x432eb7});}catch(_0x305478){logger[_0x5544('0x29')](_0x305478[_0x5544('0x2f')]);return _0x45cdda(_0x136023[_0x5544('0x29')](0x1f4,_0x305478));}}logger['error'](_0x5544('0x38'));return _0x45cdda(_0x136023[_0x5544('0x29')](0x1f4,_0x5544('0x38')));});},'AgentCapacity':function(_0x330e72){var _0xb23f79=this;return new Promise(function(_0x50e8cb,_0x8d6273){if(_0x49771f['agents'][_0x5544('0x3c')](_0x330e72['id'])){for(var _0x528eda in _0x330e72[_0x5544('0x3d')]){if(_0x330e72[_0x5544('0x3d')][_0x5544('0x3c')](_0x528eda)){if(_0x49771f['agents'][_0x330e72['id']][_0x5544('0x3c')](_0x528eda+_0x5544('0x3e'))){_0x49771f['agents'][_0x330e72['id']][_0x528eda+_0x5544('0x3e')]=parseInt(_0x330e72['capacity'][_0x528eda],0xa);}}}_0x49771f['agents'][_0x330e72['id']][_0x5544('0x3f')]();return _0x50e8cb({'code':0xc8,'message':_0x49771f[_0x5544('0x3a')][_0x330e72['id']]});}else{return _0x8d6273(_0xb23f79[_0x5544('0x29')](0x1f4,_0x5544('0x40')));}});},'Agents':function(_0x2739a2){return new Promise(function(_0x26cdd8,_0x4ac8e8){var _0x97a406=_['values'](_0x49771f['agents']);_0x26cdd8({'count':_0x97a406[_0x5544('0x16')],'rows':_0x97a406});});},'ChatQueues':function(_0x276fcc){return new Promise(function(_0x3bdae0,_0x5f13fb){var _0x61e76b=[];for(var _0x15f466 in _0x49771f[_0x5544('0x41')]){if(_0x49771f['chatQueues']['hasOwnProperty'](_0x15f466)){var _0x5292c1=_0x49771f['chatQueues'][_0x15f466];var _0x123d05={'id':_0x5292c1['id'],'available':_0x5292c1[_0x5544('0x42')],'loggedIn':_0x5292c1['loggedIn'],'name':_0x5292c1[_0x5544('0x43')],'paused':_0x5292c1[_0x5544('0x44')],'waiting':_0x5292c1[_0x5544('0x45')]};_0x61e76b['push'](_0x123d05);}}_0x3bdae0({'count':_0x61e76b['length'],'rows':_0x61e76b});});},'MailQueues':function(_0x4254c3){return new Promise(function(_0x553b70,_0x50d20f){var _0x480386=[];for(var _0x307227 in _0x49771f['mailQueues']){if(_0x49771f[_0x5544('0x46')]['hasOwnProperty'](_0x307227)){var _0x1d4c03=_0x49771f[_0x5544('0x46')][_0x307227];var _0x2dfb6b={'id':_0x1d4c03['id'],'available':_0x1d4c03[_0x5544('0x42')],'loggedIn':_0x1d4c03[_0x5544('0x47')],'name':_0x1d4c03[_0x5544('0x43')],'paused':_0x1d4c03[_0x5544('0x44')],'waiting':_0x1d4c03['waiting']};_0x480386['push'](_0x2dfb6b);}}_0x553b70({'count':_0x480386[_0x5544('0x16')],'rows':_0x480386});});},'OpenchannelQueues':function(_0x1543ee){return new Promise(function(_0x20d4c9,_0x41bf0e){var _0x55f290=[];for(var _0x2e5a34 in _0x49771f[_0x5544('0x48')]){if(_0x49771f[_0x5544('0x48')][_0x5544('0x3c')](_0x2e5a34)){var _0x4fdc0c=_0x49771f[_0x5544('0x48')][_0x2e5a34];var _0x51bce4={'id':_0x4fdc0c['id'],'available':_0x4fdc0c[_0x5544('0x42')],'loggedIn':_0x4fdc0c[_0x5544('0x47')],'name':_0x4fdc0c[_0x5544('0x43')],'paused':_0x4fdc0c['paused'],'waiting':_0x4fdc0c[_0x5544('0x45')]};_0x55f290[_0x5544('0x1e')](_0x51bce4);}}_0x20d4c9({'count':_0x55f290[_0x5544('0x16')],'rows':_0x55f290});});},'SmsQueues':function(_0x12e7f4){return new Promise(function(_0x44133f,_0x2b58b1){var _0x3d5ec2=[];for(var _0x3c52eb in _0x49771f[_0x5544('0x49')]){if(_0x49771f[_0x5544('0x49')]['hasOwnProperty'](_0x3c52eb)){var _0x2df938=_0x49771f[_0x5544('0x49')][_0x3c52eb];var _0x46f212={'id':_0x2df938['id'],'available':_0x2df938['available'],'loggedIn':_0x2df938[_0x5544('0x47')],'name':_0x2df938[_0x5544('0x43')],'paused':_0x2df938[_0x5544('0x44')],'waiting':_0x2df938[_0x5544('0x45')]};_0x3d5ec2[_0x5544('0x1e')](_0x46f212);}}_0x44133f({'count':_0x3d5ec2[_0x5544('0x16')],'rows':_0x3d5ec2});});},'FaxQueues':function(_0xd85a70){return new Promise(function(_0x40b4ba,_0x3caa4c){var _0x5eb9b2=[];for(var _0x1d3cea in _0x49771f[_0x5544('0x4a')]){if(_0x49771f[_0x5544('0x4a')][_0x5544('0x3c')](_0x1d3cea)){var _0x2d6bda=_0x49771f[_0x5544('0x4a')][_0x1d3cea];var _0x4509d8={'id':_0x2d6bda['id'],'available':_0x2d6bda[_0x5544('0x42')],'loggedIn':_0x2d6bda[_0x5544('0x47')],'name':_0x2d6bda['name'],'paused':_0x2d6bda[_0x5544('0x44')],'waiting':_0x2d6bda[_0x5544('0x45')]};_0x5eb9b2[_0x5544('0x1e')](_0x4509d8);}}_0x40b4ba({'count':_0x5eb9b2[_0x5544('0x16')],'rows':_0x5eb9b2});});},'WhatsappQueues':function(_0xc38bae){return new Promise(function(_0x23e59f,_0x1f0555){var _0x463a4e=[];for(var _0x79da87 in _0x49771f['whatsappQueues']){if(_0x49771f[_0x5544('0x4b')][_0x5544('0x3c')](_0x79da87)){var _0x42696=_0x49771f[_0x5544('0x4b')][_0x79da87];var _0x4e787e={'id':_0x42696['id'],'available':_0x42696['available'],'loggedIn':_0x42696[_0x5544('0x47')],'name':_0x42696[_0x5544('0x43')],'paused':_0x42696[_0x5544('0x44')],'waiting':_0x42696[_0x5544('0x45')]};_0x463a4e['push'](_0x4e787e);}}_0x23e59f({'count':_0x463a4e['length'],'rows':_0x463a4e});});},'ChatQueuesWaitingInteractions':function(_0x5046cb){return new Promise(function(_0x101526,_0x263179){var _0x145943=_[_0x5544('0x4c')](_0x49771f['chatQueuesWaitingInteractions']);_0x101526({'count':_0x145943[_0x5544('0x16')],'rows':_0x145943});});},'MailQueuesWaitingInteractions':function(_0x6cfdcd){return new Promise(function(_0x2ff8df,_0xdfb3cf){var _0x31c6d5=_[_0x5544('0x4c')](_0x49771f['mailQueuesWaitingInteractions']);_0x2ff8df({'count':_0x31c6d5['length'],'rows':_0x31c6d5});});},'OpenchannelQueuesWaitingInteractions':function(_0x5e822e){return new Promise(function(_0x28ce56,_0x2abd9d){var _0x1ad3ab=_[_0x5544('0x4c')](_0x49771f['openchannelQueuesWaitingInteractions']);_0x28ce56({'count':_0x1ad3ab[_0x5544('0x16')],'rows':_0x1ad3ab});});},'SmsQueuesWaitingInteractions':function(_0x98f576){return new Promise(function(_0x34b53c,_0x38443b){var _0x5f5639=_[_0x5544('0x4c')](_0x49771f[_0x5544('0x4d')]);_0x34b53c({'count':_0x5f5639[_0x5544('0x16')],'rows':_0x5f5639});});},'FaxQueuesWaitingInteractions':function(_0x5e99d5){return new Promise(function(_0x10543d,_0xe10886){var _0xea587b=_[_0x5544('0x4c')](_0x49771f[_0x5544('0x4e')]);_0x10543d({'count':_0xea587b[_0x5544('0x16')],'rows':_0xea587b});});},'WhatsappQueuesWaitingInteractions':function(_0x1ba4c2){return new Promise(function(_0x56713b,_0x46468f){var _0x154a73=_[_0x5544('0x4c')](_0x49771f[_0x5544('0x4f')]);_0x56713b({'count':_0x154a73['length'],'rows':_0x154a73});});}};var _0x42066c=jayson['server'](_0x52255a)[_0x5544('0x50')]();_0x42066c['on']('error',function(_0x512e30){logger[_0x5544('0x29')](JSON[_0x5544('0x51')](_0x512e30));return _0x55540e(_0x512e30);});_0x42066c[_0x5544('0x52')](0x232c,'127.0.0.1',function(){console['log'](_0x5544('0x53'),0x232c);return _0x121cda(_0x5544('0x54')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6e7c399..9a49642 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 _0x87cd=['join','log','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','jayson/promise','../../../config/logger','routing','http','request','then','error','message','result','catch','rules','stop','length','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some'];(function(_0x51cdc4,_0x2ca7fd){var _0x1b6ddf=function(_0x17d765){while(--_0x17d765){_0x51cdc4['push'](_0x51cdc4['shift']());}};_0x1b6ddf(++_0x2ca7fd);}(_0x87cd,0x155));var _0xd87c=function(_0x4372a3,_0x132ee3){_0x4372a3=_0x4372a3-0x0;var _0x25b0f9=_0x87cd[_0x4372a3];return _0x25b0f9;};'use strict';var util=require(_0xd87c('0x0'));var BPromise=require(_0xd87c('0x1'));var jayson=require(_0xd87c('0x2'));var _=require('lodash');var logger=require(_0xd87c('0x3'))(_0xd87c('0x4'));var client=jayson['client'][_0xd87c('0x5')]({'port':0x232a});function request(_0x50f289,_0xb006a4){return new BPromise(function(_0x2c5d07,_0x11b17d){return client[_0xd87c('0x6')](_0x50f289,_0xb006a4)[_0xd87c('0x7')](function(_0x12137b){if(_0x12137b['error']){return _0x11b17d(_0x12137b[_0xd87c('0x8')][_0xd87c('0x9')]);}else{return _0x2c5d07(_0x12137b[_0xd87c('0xa')]);}})[_0xd87c('0xb')](function(_0x5cbc55){return _0x11b17d(_0x5cbc55);});});}exports['condition']=function(_0x1a94f4,_0x1ff962,_0x10f0dc){return function(_0x4ea42d){if(_0x10f0dc[_0xd87c('0xc')]&&!_0x10f0dc[_0xd87c('0xc')][_0x1a94f4]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1a94f4);return _0x4ea42d[_0xd87c('0xd')]();}var _0x28801a=[];for(var _0x157dc5=0x0;_0x157dc5<_0x1ff962[_0xd87c('0xe')];_0x157dc5+=0x1){_0x28801a[_0xd87c('0xf')](request(_0xd87c('0x10'),{'command':util['format'](_0xd87c('0x11'),_0x1ff962[_0x157dc5])})[_0xd87c('0x7')](function(_0x3fcbf3){return _0x3fcbf3&&_0x3fcbf3[_0xd87c('0x9')]&&_0x3fcbf3[_0xd87c('0x9')][_0xd87c('0x12')](_0xd87c('0x13'))>=0x0?!![]:![];})[_0xd87c('0xb')](function(_0xba9a66){logger[_0xd87c('0x8')](_0xd87c('0x14'),_0x1a94f4,_0x1ff962[_0x157dc5]);}));}BPromise[_0xd87c('0x15')](_0x28801a)[_0xd87c('0x7')](function(_0x53a864){var _0x5e6ec1=_[_0xd87c('0x16')](_0x53a864);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x1a94f4,_0x1ff962[_0xd87c('0x17')]('\x20|\x20'),_0x5e6ec1);_0x4ea42d['when'](_0x5e6ec1);})[_0xd87c('0xb')](function(_0x337223){console[_0xd87c('0x18')](_0x337223);logger['error'](_0xd87c('0x19'),_0x1a94f4,_0x1ff962['join']('\x20|\x20'),_0x337223['stack']);_0x4ea42d[_0xd87c('0xd')]();});};}; \ No newline at end of file +var _0xae8f=['join','\x20|\x20','log','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x136db2,_0x19f161){var _0x3f472d=function(_0x8316cf){while(--_0x8316cf){_0x136db2['push'](_0x136db2['shift']());}};_0x3f472d(++_0x19f161);}(_0xae8f,0x13b));var _0xfae8=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xae8f[_0x35c5a8];return _0x34782c;};'use strict';var util=require('util');var BPromise=require(_0xfae8('0x0'));var jayson=require(_0xfae8('0x1'));var _=require(_0xfae8('0x2'));var logger=require(_0xfae8('0x3'))(_0xfae8('0x4'));var client=jayson[_0xfae8('0x5')][_0xfae8('0x6')]({'port':0x232a});function request(_0x560783,_0x3edbe0){return new BPromise(function(_0x270a77,_0x4d6e71){return client[_0xfae8('0x7')](_0x560783,_0x3edbe0)[_0xfae8('0x8')](function(_0xba0a0b){if(_0xba0a0b[_0xfae8('0x9')]){return _0x4d6e71(_0xba0a0b[_0xfae8('0x9')][_0xfae8('0xa')]);}else{return _0x270a77(_0xba0a0b['result']);}})[_0xfae8('0xb')](function(_0x2afce0){return _0x4d6e71(_0x2afce0);});});}exports['condition']=function(_0x1cbddd,_0x58d852,_0x260bf4){return function(_0xd3ac62){if(_0x260bf4['rules']&&!_0x260bf4['rules'][_0x1cbddd]){logger[_0xfae8('0xc')](_0xfae8('0xd'),_0x1cbddd);return _0xd3ac62[_0xfae8('0xe')]();}var _0x134bea=[];for(var _0x3561fc=0x0;_0x3561fc<_0x58d852[_0xfae8('0xf')];_0x3561fc+=0x1){_0x134bea['push'](request('Command',{'command':util[_0xfae8('0x10')]('iftime\x20%s',_0x58d852[_0x3561fc])})[_0xfae8('0x8')](function(_0x23e815){return _0x23e815&&_0x23e815['message']&&_0x23e815['message'][_0xfae8('0x11')](_0xfae8('0x12'))>=0x0?!![]:![];})['catch'](function(_0x2e5a91){logger[_0xfae8('0x9')](_0xfae8('0x13'),_0x1cbddd,_0x58d852[_0x3561fc]);}));}BPromise[_0xfae8('0x14')](_0x134bea)['then'](function(_0x2b54d8){var _0x5f5a85=_[_0xfae8('0x15')](_0x2b54d8);logger[_0xfae8('0xc')](_0xfae8('0x16'),_0x1cbddd,_0x58d852[_0xfae8('0x17')](_0xfae8('0x18')),_0x5f5a85);_0xd3ac62['when'](_0x5f5a85);})[_0xfae8('0xb')](function(_0x215be7){console[_0xfae8('0x19')](_0x215be7);logger[_0xfae8('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1cbddd,_0x58d852['join'](_0xfae8('0x18')),_0x215be7['stack']);_0xd3ac62['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d531bb7..7bbd682 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 _0xd906=['clone','hangup','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils','info','format','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','lastevent','timeout','ringtime','push','queuecallerabandon','forIn','includes','abandoned','holdtime','talktime','agentconnect','agentconnectAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','reason','blindtransfer','transfereruniqueid','transfertype','blind','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid'];(function(_0x1804c1,_0x2b07bc){var _0x24b5bb=function(_0xa02e68){while(--_0xa02e68){_0x1804c1['push'](_0x1804c1['shift']());}};_0x24b5bb(++_0x2b07bc);}(_0xd906,0x175));var _0x6d90=function(_0x1f703f,_0x2eca87){_0x1f703f=_0x1f703f-0x0;var _0x17b7f1=_0xd906[_0x1f703f];return _0x17b7f1;};'use strict';var _=require(_0x6d90('0x0'));var util=require(_0x6d90('0x1'));var utils=require(_0x6d90('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x25c158,_0x3a62d6){utils[_0x6d90('0x3')](util[_0x6d90('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x25c158['uniqueid'],_0x25c158[_0x6d90('0x5')],_0x25c158[_0x6d90('0x6')],_0x25c158[_0x6d90('0x7')],_0x25c158[_0x6d90('0x8')],_0x25c158[_0x6d90('0x9')],_0x25c158[_0x6d90('0xa')],_0x25c158['lastevent']));if(_0x25c158[_0x6d90('0x6')]){utils[_0x6d90('0xb')](_0x25c158['queue'])[_0x6d90('0xc')](function(_0x5a087e){if(_0x5a087e){_0x25c158[_0x6d90('0xd')]=_0x5a087e[_0x6d90('0xd')];_0x25c158[_0x6d90('0xe')]=_0x25c158['agentcomplete']?_0x5a087e[_0x6d90('0xf')]:![];_0x25c158[_0x6d90('0x10')]=_0x25c158['agentacw']?_0x5a087e[_0x6d90('0x11')]:0x0;}utils['request'](_0x6d90('0x12'),_0x25c158);});}else{utils[_0x6d90('0x13')](_0x6d90('0x12'),_0x25c158);}if(_0x3a62d6){delete transfers[_0x25c158[_0x6d90('0x14')]];}else{delete agents[_0x25c158[_0x6d90('0x15')]];}}exports[_0x6d90('0x16')]=function(_0x4315c2){try{agents[_0x4315c2[_0x6d90('0x15')]]=_0x4315c2;agents[_0x4315c2[_0x6d90('0x15')]][_0x6d90('0x17')]=utils[_0x6d90('0x18')]();agents[_0x4315c2[_0x6d90('0x15')]]['lastevent']=_0x6d90('0x19');agents[_0x4315c2[_0x6d90('0x15')]][_0x6d90('0xa')]=null;agents[_0x4315c2[_0x6d90('0x15')]]['connectedlinename']=null;}catch(_0x536ea4){utils[_0x6d90('0x1a')](_0x536ea4[_0x6d90('0x1b')]);}};exports['agentringnoanswer']=function(_0x5d368e){try{if(!_[_0x6d90('0x1c')](agents[_0x5d368e[_0x6d90('0x15')]])){agents[_0x5d368e['destuniqueid']][_0x6d90('0x1d')]=!![];agents[_0x5d368e[_0x6d90('0x15')]][_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();agents[_0x5d368e[_0x6d90('0x15')]][_0x6d90('0x1f')]=_0x6d90('0x20');agents[_0x5d368e[_0x6d90('0x15')]]['reason']='timeout';agents[_0x5d368e[_0x6d90('0x15')]]['holdtime']=_0x5d368e[_0x6d90('0x21')]?parseInt(_0x5d368e['ringtime'])/0x3e8:0x0;agents[_0x5d368e[_0x6d90('0x15')]]['talktime']=0x0;unanswered[_0x6d90('0x22')](_0x5d368e[_0x6d90('0x15')]);}}catch(_0x4b0527){utils['error'](_0x4b0527[_0x6d90('0x1b')]);}};exports[_0x6d90('0x23')]=function(_0x195e18){try{_[_0x6d90('0x24')](agents,function(_0x3d041c,_0x5ecbe9){if(_0x3d041c[_0x6d90('0x14')]==_0x195e18['uniqueid']&&!_[_0x6d90('0x25')](unanswered,_0x3d041c[_0x6d90('0x15')])){_0x3d041c[_0x6d90('0x1d')]=!![];_0x3d041c[_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();_0x3d041c[_0x6d90('0x1f')]='abandoned';_0x3d041c['reason']=_0x6d90('0x26');_0x3d041c[_0x6d90('0x27')]=_0x195e18[_0x6d90('0x27')];_0x3d041c[_0x6d90('0x28')]=0x0;writeDB(_0x3d041c);}});}catch(_0x3450b4){utils[_0x6d90('0x1a')](_0x3450b4[_0x6d90('0x1b')]);}};exports[_0x6d90('0x29')]=function(_0x27ff44){try{if(agents[_0x27ff44[_0x6d90('0x15')]]){agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0xa')]=_0x27ff44[_0x6d90('0xa')];agents[_0x27ff44[_0x6d90('0x15')]]['connectedlinename']=_0x27ff44['connectedlinename'];agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x27')]=_0x27ff44['ringtime'];agents[_0x27ff44[_0x6d90('0x15')]][_0x6d90('0x1f')]='connect';_[_0x6d90('0x24')](agents,function(_0xe3f6c4,_0x11746e){if(_0xe3f6c4['destuniqueid']!=_0x27ff44[_0x6d90('0x15')]&&_0xe3f6c4['uniqueid']==_0x27ff44['uniqueid']){_0xe3f6c4[_0x6d90('0x28')]=0x0;_0xe3f6c4[_0x6d90('0x27')]=_0x27ff44['ringtime'];_0xe3f6c4['agentringnoanswer']=!![];_0xe3f6c4[_0x6d90('0x1e')]=utils[_0x6d90('0x18')]();_0xe3f6c4['lastevent']='answered_elsewhere';_0xe3f6c4['reason']='answered_elsewhere';_0xe3f6c4[_0x6d90('0x2b')]=_0x27ff44['destuniqueid'];_0xe3f6c4[_0x6d90('0x2c')]=_0x27ff44[_0x6d90('0x7')];writeDB(_0xe3f6c4);}});}}catch(_0x3948d3){utils[_0x6d90('0x1a')](_0x3948d3[_0x6d90('0x1b')]);}};exports['agentcomplete']=function(_0x852701){try{if(!_['isNil'](agents[_0x852701['destuniqueid']])){agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x2d')]=!![];agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x2e')]=utils[_0x6d90('0x18')]();agents[_0x852701[_0x6d90('0x15')]]['talktime']=utils[_0x6d90('0x2f')](agents[_0x852701['destuniqueid']][_0x6d90('0x2e')],agents[_0x852701['destuniqueid']][_0x6d90('0x2a')]);agents[_0x852701[_0x6d90('0x15')]][_0x6d90('0x30')]=_0x852701['reason'];agents[_0x852701[_0x6d90('0x15')]]['lastevent']='complete';writeDB(agents[_0x852701[_0x6d90('0x15')]]);}}catch(_0x5e0b26){utils[_0x6d90('0x1a')](_0x5e0b26[_0x6d90('0x1b')]);}};exports[_0x6d90('0x31')]=function(_0x44d930){try{if(!_[_0x6d90('0x1c')](agents[_0x44d930[_0x6d90('0x32')]])){agents[_0x44d930[_0x6d90('0x32')]]['transfer']=!![];agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x33')]=_0x6d90('0x34');agents[_0x44d930[_0x6d90('0x32')]]['transferexten']=_0x44d930[_0x6d90('0x35')];agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x36')]=agents[_0x44d930[_0x6d90('0x32')]][_0x6d90('0x14')];}}catch(_0x4aa71e){utils[_0x6d90('0x1a')](_0x4aa71e[_0x6d90('0x1b')]);}};exports['attendedtransfer']=function(_0x3359f4){try{if(_0x3359f4[_0x6d90('0x37')]==_0x3359f4[_0x6d90('0x38')]){if(!_[_0x6d90('0x1c')](agents[_0x3359f4[_0x6d90('0x39')]])){agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3a')]=!![];agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x33')]='ATTENDED';agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3b')]=_0x3359f4[_0x6d90('0x3c')];agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x36')]=_0x3359f4['origtransfereruniqueid'];}if(_0x3359f4[_0x6d90('0x3d')]&&agents[_0x3359f4[_0x6d90('0x3d')]]){agents[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3e')]=0x1;transfers[_0x3359f4[_0x6d90('0x3d')]]=_['clone'](agents[_0x3359f4['transfereeuniqueid']]);transfers[_0x3359f4['transfereeuniqueid']]['calleridnum']=agents[_0x3359f4[_0x6d90('0x39')]]['calleridnum'];transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3f')]=agents[_0x3359f4[_0x6d90('0x39')]][_0x6d90('0x3f')];transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x17')]=utils['now']();transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x3359f4[_0x6d90('0x3d')]][_0x6d90('0x3e')]=0x2;}}else if(_0x3359f4['secondtransfereruniqueid']==_0x3359f4['secondtransfererlinkedid']){if(!_[_0x6d90('0x1c')](agents[_0x3359f4[_0x6d90('0x37')]])){agents[_0x3359f4[_0x6d90('0x37')]]['transfer']=!![];agents[_0x3359f4[_0x6d90('0x37')]]['transfertype']='ATTENDED';agents[_0x3359f4['origtransfereruniqueid']][_0x6d90('0x3b')]=_0x3359f4['secondtransfererexten'];agents[_0x3359f4[_0x6d90('0x37')]][_0x6d90('0x36')]=_0x3359f4[_0x6d90('0x39')];}if(_0x3359f4[_0x6d90('0x40')]&&agents[_0x3359f4[_0x6d90('0x40')]]){agents[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x3e')]=0x1;transfers[_0x3359f4[_0x6d90('0x40')]]=_[_0x6d90('0x41')](agents[_0x3359f4[_0x6d90('0x40')]]);transfers[_0x3359f4[_0x6d90('0x40')]]['calleridnum']=agents[_0x3359f4['origtransfereruniqueid']][_0x6d90('0x9')];transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x3f')]=agents[_0x3359f4[_0x6d90('0x37')]][_0x6d90('0x3f')];transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x17')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x2a')]=utils[_0x6d90('0x18')]();transfers[_0x3359f4[_0x6d90('0x40')]][_0x6d90('0x27')]=0x0;transfers[_0x3359f4['transfertargetuniqueid']][_0x6d90('0x3e')]=0x2;}}}catch(_0x5e4390){utils['error'](_0x5e4390[_0x6d90('0x1b')]);}};exports[_0x6d90('0x42')]=function(_0x22aa6f){try{if(agents[_0x22aa6f[_0x6d90('0x14')]]&&agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x30')]==='timeout'){if(_0x22aa6f[_0x6d90('0x43')]==='21'){agents[_0x22aa6f['uniqueid']][_0x6d90('0x30')]=_0x6d90('0x44');agents[_0x22aa6f[_0x6d90('0x14')]]['lastevent']='rejected';}writeDB(agents[_0x22aa6f[_0x6d90('0x14')]]);var _0x2ebbf6=unanswered[_0x6d90('0x45')](_0x22aa6f[_0x6d90('0x14')]);if(_0x2ebbf6>-0x1)unanswered[_0x6d90('0x46')](_0x2ebbf6,0x1);}if(transfers[_0x22aa6f[_0x6d90('0x14')]]){transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2d')]=!![];transfers[_0x22aa6f['uniqueid']]['agentcompleteAt']=utils[_0x6d90('0x18')]();transfers[_0x22aa6f['uniqueid']]['talktime']=utils['diffTime'](transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2e')],transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2a')]);transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x30')]=_0x6d90('0x47');transfers[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x1f')]=_0x6d90('0x48');writeDB(transfers[_0x22aa6f['uniqueid']],!![]);}if(agents[_0x22aa6f[_0x6d90('0x14')]]&&agents[_0x22aa6f[_0x6d90('0x14')]]['agentconnectAt']){agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2d')]=!![];agents[_0x22aa6f[_0x6d90('0x14')]]['agentcompleteAt']=utils[_0x6d90('0x18')]();agents[_0x22aa6f['uniqueid']][_0x6d90('0x28')]=utils[_0x6d90('0x2f')](agents[_0x22aa6f[_0x6d90('0x14')]]['agentcompleteAt'],agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x2a')]);agents[_0x22aa6f['uniqueid']][_0x6d90('0x30')]=agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x3a')]?_0x6d90('0x3a'):_0x6d90('0x47');agents[_0x22aa6f[_0x6d90('0x14')]][_0x6d90('0x1f')]=_0x6d90('0x48');writeDB(agents[_0x22aa6f[_0x6d90('0x14')]]);}}catch(_0x93637e){utils[_0x6d90('0x1a')](_0x93637e[_0x6d90('0x1b')]);}}; \ No newline at end of file +var _0x0ba8=['agent','util','./utils','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','called','connectedlinename','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','forIn','abandoned','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice'];(function(_0x481a22,_0x4fcd90){var _0x1d4694=function(_0x21da3f){while(--_0x21da3f){_0x481a22['push'](_0x481a22['shift']());}};_0x1d4694(++_0x4fcd90);}(_0x0ba8,0x93));var _0x80ba=function(_0x1e87e2,_0x17448b){_0x1e87e2=_0x1e87e2-0x0;var _0xd0df1=_0x0ba8[_0x1e87e2];return _0xd0df1;};'use strict';var _=require('lodash');var util=require(_0x80ba('0x0'));var utils=require(_0x80ba('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a935a,_0xbd9be){utils[_0x80ba('0x2')](util[_0x80ba('0x3')](_0x80ba('0x4'),_0x2a935a[_0x80ba('0x5')],_0x2a935a[_0x80ba('0x6')],_0x2a935a[_0x80ba('0x7')],_0x2a935a[_0x80ba('0x8')],_0x2a935a[_0x80ba('0x9')],_0x2a935a['calleridnum'],_0x2a935a[_0x80ba('0xa')],_0x2a935a[_0x80ba('0xb')]));if(_0x2a935a[_0x80ba('0x7')]){utils['getVoiceQueueByName'](_0x2a935a['queue'])[_0x80ba('0xc')](function(_0xc36708){if(_0xc36708){_0x2a935a[_0x80ba('0xd')]=_0xc36708[_0x80ba('0xd')];_0x2a935a[_0x80ba('0xe')]=_0x2a935a[_0x80ba('0xf')]?_0xc36708[_0x80ba('0x10')]:![];_0x2a935a[_0x80ba('0x11')]=_0x2a935a[_0x80ba('0xe')]?_0xc36708[_0x80ba('0x12')]:0x0;}utils[_0x80ba('0x13')](_0x80ba('0x14'),_0x2a935a);});}else{utils[_0x80ba('0x13')](_0x80ba('0x14'),_0x2a935a);}if(_0xbd9be){delete transfers[_0x2a935a[_0x80ba('0x5')]];}else{delete agents[_0x2a935a['destuniqueid']];}}exports['agentcalled']=function(_0x4819b5){try{agents[_0x4819b5[_0x80ba('0x15')]]=_0x4819b5;agents[_0x4819b5[_0x80ba('0x15')]][_0x80ba('0x16')]=utils['now']();agents[_0x4819b5[_0x80ba('0x15')]][_0x80ba('0xb')]=_0x80ba('0x17');agents[_0x4819b5[_0x80ba('0x15')]]['connectedlinenum']=null;agents[_0x4819b5[_0x80ba('0x15')]][_0x80ba('0x18')]=null;}catch(_0x4296d5){utils[_0x80ba('0x19')](_0x4296d5[_0x80ba('0x1a')]);}};exports['agentringnoanswer']=function(_0x10aa2d){try{if(!_[_0x80ba('0x1b')](agents[_0x10aa2d[_0x80ba('0x15')]])){agents[_0x10aa2d['destuniqueid']][_0x80ba('0x1c')]=!![];agents[_0x10aa2d['destuniqueid']][_0x80ba('0x1d')]=utils[_0x80ba('0x1e')]();agents[_0x10aa2d[_0x80ba('0x15')]][_0x80ba('0xb')]=_0x80ba('0x1f');agents[_0x10aa2d[_0x80ba('0x15')]][_0x80ba('0x20')]=_0x80ba('0x1f');agents[_0x10aa2d[_0x80ba('0x15')]][_0x80ba('0x21')]=_0x10aa2d[_0x80ba('0x22')]?parseInt(_0x10aa2d[_0x80ba('0x22')])/0x3e8:0x0;agents[_0x10aa2d['destuniqueid']][_0x80ba('0x23')]=0x0;unanswered[_0x80ba('0x24')](_0x10aa2d[_0x80ba('0x15')]);}}catch(_0x12803f){utils[_0x80ba('0x19')](_0x12803f['stack']);}};exports['queuecallerabandon']=function(_0x55626c){try{_[_0x80ba('0x25')](agents,function(_0x225f8d,_0x3a410f){if(_0x225f8d['uniqueid']==_0x55626c[_0x80ba('0x5')]&&!_['includes'](unanswered,_0x225f8d[_0x80ba('0x15')])){_0x225f8d[_0x80ba('0x1c')]=!![];_0x225f8d['agentringnoanswerAt']=utils[_0x80ba('0x1e')]();_0x225f8d[_0x80ba('0xb')]=_0x80ba('0x26');_0x225f8d[_0x80ba('0x20')]='abandoned';_0x225f8d['holdtime']=_0x55626c['holdtime'];_0x225f8d['talktime']=0x0;writeDB(_0x225f8d);}});}catch(_0x4c48d6){utils[_0x80ba('0x19')](_0x4c48d6[_0x80ba('0x1a')]);}};exports[_0x80ba('0x27')]=function(_0x490542){try{if(agents[_0x490542['destuniqueid']]){agents[_0x490542['destuniqueid']][_0x80ba('0x28')]=utils[_0x80ba('0x1e')]();agents[_0x490542[_0x80ba('0x15')]][_0x80ba('0xa')]=_0x490542[_0x80ba('0xa')];agents[_0x490542[_0x80ba('0x15')]][_0x80ba('0x18')]=_0x490542['connectedlinename'];agents[_0x490542['destuniqueid']][_0x80ba('0x21')]=_0x490542[_0x80ba('0x22')];agents[_0x490542[_0x80ba('0x15')]][_0x80ba('0xb')]=_0x80ba('0x29');_[_0x80ba('0x25')](agents,function(_0x4cbce8,_0x418109){if(_0x4cbce8[_0x80ba('0x15')]!=_0x490542[_0x80ba('0x15')]&&_0x4cbce8[_0x80ba('0x5')]==_0x490542[_0x80ba('0x5')]){_0x4cbce8['talktime']=0x0;_0x4cbce8[_0x80ba('0x21')]=_0x490542[_0x80ba('0x22')];_0x4cbce8[_0x80ba('0x1c')]=!![];_0x4cbce8['agentringnoanswerAt']=utils[_0x80ba('0x1e')]();_0x4cbce8[_0x80ba('0xb')]=_0x80ba('0x2a');_0x4cbce8[_0x80ba('0x20')]=_0x80ba('0x2a');_0x4cbce8['answeredelsewheredestinationuniqueid']=_0x490542[_0x80ba('0x15')];_0x4cbce8[_0x80ba('0x2b')]=_0x490542[_0x80ba('0x8')];writeDB(_0x4cbce8);}});}}catch(_0x325e7a){utils['error'](_0x325e7a[_0x80ba('0x1a')]);}};exports[_0x80ba('0xf')]=function(_0x2cdc2d){try{if(!_[_0x80ba('0x1b')](agents[_0x2cdc2d[_0x80ba('0x15')]])){agents[_0x2cdc2d[_0x80ba('0x15')]][_0x80ba('0xf')]=!![];agents[_0x2cdc2d[_0x80ba('0x15')]]['agentcompleteAt']=utils[_0x80ba('0x1e')]();agents[_0x2cdc2d[_0x80ba('0x15')]][_0x80ba('0x23')]=utils[_0x80ba('0x2c')](agents[_0x2cdc2d['destuniqueid']][_0x80ba('0x2d')],agents[_0x2cdc2d[_0x80ba('0x15')]][_0x80ba('0x28')]);agents[_0x2cdc2d[_0x80ba('0x15')]][_0x80ba('0x20')]=_0x2cdc2d[_0x80ba('0x20')];agents[_0x2cdc2d[_0x80ba('0x15')]][_0x80ba('0xb')]=_0x80ba('0x2e');writeDB(agents[_0x2cdc2d[_0x80ba('0x15')]]);}}catch(_0x2186b3){utils[_0x80ba('0x19')](_0x2186b3[_0x80ba('0x1a')]);}};exports[_0x80ba('0x2f')]=function(_0x828261){try{if(!_[_0x80ba('0x1b')](agents[_0x828261['transfereruniqueid']])){agents[_0x828261[_0x80ba('0x30')]]['transfer']=!![];agents[_0x828261[_0x80ba('0x30')]][_0x80ba('0x31')]=_0x80ba('0x32');agents[_0x828261[_0x80ba('0x30')]][_0x80ba('0x33')]=_0x828261['extension'];agents[_0x828261[_0x80ba('0x30')]][_0x80ba('0x34')]=agents[_0x828261[_0x80ba('0x30')]]['uniqueid'];}}catch(_0x26fe85){utils[_0x80ba('0x19')](_0x26fe85['stack']);}};exports[_0x80ba('0x35')]=function(_0xf1df58){try{if(_0xf1df58[_0x80ba('0x36')]==_0xf1df58[_0x80ba('0x37')]){if(!_[_0x80ba('0x1b')](agents[_0xf1df58[_0x80ba('0x38')]])){agents[_0xf1df58[_0x80ba('0x38')]][_0x80ba('0x39')]=!![];agents[_0xf1df58[_0x80ba('0x38')]][_0x80ba('0x31')]=_0x80ba('0x3a');agents[_0xf1df58['secondtransfereruniqueid']]['transferexten']=_0xf1df58[_0x80ba('0x3b')];agents[_0xf1df58[_0x80ba('0x38')]][_0x80ba('0x34')]=_0xf1df58[_0x80ba('0x36')];}if(_0xf1df58['transfereeuniqueid']&&agents[_0xf1df58[_0x80ba('0x3c')]]){agents[_0xf1df58[_0x80ba('0x3c')]][_0x80ba('0x3d')]=0x1;transfers[_0xf1df58['transfereeuniqueid']]=_[_0x80ba('0x3e')](agents[_0xf1df58['transfereeuniqueid']]);transfers[_0xf1df58[_0x80ba('0x3c')]]['calleridnum']=agents[_0xf1df58[_0x80ba('0x38')]][_0x80ba('0x3f')];transfers[_0xf1df58['transfereeuniqueid']][_0x80ba('0x40')]=agents[_0xf1df58[_0x80ba('0x38')]][_0x80ba('0x40')];transfers[_0xf1df58[_0x80ba('0x3c')]][_0x80ba('0x16')]=utils[_0x80ba('0x1e')]();transfers[_0xf1df58['transfereeuniqueid']][_0x80ba('0x28')]=utils[_0x80ba('0x1e')]();transfers[_0xf1df58[_0x80ba('0x3c')]]['holdtime']=0x0;transfers[_0xf1df58['transfereeuniqueid']][_0x80ba('0x3d')]=0x2;}}else if(_0xf1df58[_0x80ba('0x38')]==_0xf1df58['secondtransfererlinkedid']){if(!_[_0x80ba('0x1b')](agents[_0xf1df58[_0x80ba('0x36')]])){agents[_0xf1df58[_0x80ba('0x36')]][_0x80ba('0x39')]=!![];agents[_0xf1df58[_0x80ba('0x36')]][_0x80ba('0x31')]=_0x80ba('0x3a');agents[_0xf1df58['origtransfereruniqueid']][_0x80ba('0x33')]=_0xf1df58[_0x80ba('0x41')];agents[_0xf1df58['origtransfereruniqueid']][_0x80ba('0x34')]=_0xf1df58[_0x80ba('0x38')];}if(_0xf1df58[_0x80ba('0x42')]&&agents[_0xf1df58[_0x80ba('0x42')]]){agents[_0xf1df58['transfertargetuniqueid']][_0x80ba('0x3d')]=0x1;transfers[_0xf1df58[_0x80ba('0x42')]]=_['clone'](agents[_0xf1df58[_0x80ba('0x42')]]);transfers[_0xf1df58['transfertargetuniqueid']][_0x80ba('0x3f')]=agents[_0xf1df58['origtransfereruniqueid']][_0x80ba('0x3f')];transfers[_0xf1df58[_0x80ba('0x42')]][_0x80ba('0x40')]=agents[_0xf1df58[_0x80ba('0x36')]][_0x80ba('0x40')];transfers[_0xf1df58[_0x80ba('0x42')]][_0x80ba('0x16')]=utils[_0x80ba('0x1e')]();transfers[_0xf1df58['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0xf1df58['transfertargetuniqueid']][_0x80ba('0x21')]=0x0;transfers[_0xf1df58[_0x80ba('0x42')]][_0x80ba('0x3d')]=0x2;}}}catch(_0x41804d){utils[_0x80ba('0x19')](_0x41804d[_0x80ba('0x1a')]);}};exports[_0x80ba('0x43')]=function(_0x8ab46f){try{if(agents[_0x8ab46f[_0x80ba('0x5')]]&&agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x20')]===_0x80ba('0x1f')){if(_0x8ab46f[_0x80ba('0x44')]==='21'){agents[_0x8ab46f['uniqueid']][_0x80ba('0x20')]=_0x80ba('0x45');agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0xb')]='rejected';}writeDB(agents[_0x8ab46f[_0x80ba('0x5')]]);var _0x4fdf6b=unanswered[_0x80ba('0x46')](_0x8ab46f[_0x80ba('0x5')]);if(_0x4fdf6b>-0x1)unanswered[_0x80ba('0x47')](_0x4fdf6b,0x1);}if(transfers[_0x8ab46f[_0x80ba('0x5')]]){transfers[_0x8ab46f['uniqueid']]['agentcomplete']=!![];transfers[_0x8ab46f['uniqueid']][_0x80ba('0x2d')]=utils[_0x80ba('0x1e')]();transfers[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x23')]=utils[_0x80ba('0x2c')](transfers[_0x8ab46f['uniqueid']][_0x80ba('0x2d')],transfers[_0x8ab46f['uniqueid']]['agentconnectAt']);transfers[_0x8ab46f[_0x80ba('0x5')]]['reason']=_0x80ba('0x48');transfers[_0x8ab46f['uniqueid']]['lastevent']=_0x80ba('0x2e');writeDB(transfers[_0x8ab46f[_0x80ba('0x5')]],!![]);}if(agents[_0x8ab46f[_0x80ba('0x5')]]&&agents[_0x8ab46f['uniqueid']][_0x80ba('0x28')]){agents[_0x8ab46f['uniqueid']][_0x80ba('0xf')]=!![];agents[_0x8ab46f['uniqueid']][_0x80ba('0x2d')]=utils['now']();agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x23')]=utils[_0x80ba('0x2c')](agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x2d')],agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x28')]);agents[_0x8ab46f[_0x80ba('0x5')]]['reason']=agents[_0x8ab46f[_0x80ba('0x5')]][_0x80ba('0x39')]?'transfer':_0x80ba('0x48');agents[_0x8ab46f['uniqueid']][_0x80ba('0xb')]=_0x80ba('0x2e');writeDB(agents[_0x8ab46f[_0x80ba('0x5')]]);}}catch(_0x10d525){utils[_0x80ba('0x19')](_0x10d525[_0x80ba('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c2bc8f3..ac9f379 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 _0xe704=['error','stack','newstate','isNil','systemanswertime','now','linkedid','channelstate','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','queue','xmd-contactid','ContactId','xmd-cdrtype','type','sipcallid','newexten','application','set','startsWith','appdata','toLowerCase','substring','lastIndexOf','includes','noop','execif','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','destination','callerid','disposition','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','context','DOCUMENTATION'];(function(_0x443bf5,_0xb461b5){var _0x442746=function(_0x39035a){while(--_0x39035a){_0x443bf5['push'](_0x443bf5['shift']());}};_0x442746(++_0xb461b5);}(_0xe704,0x12f));var _0x4e70=function(_0xe6dd74,_0x290b11){_0xe6dd74=_0xe6dd74-0x0;var _0x579670=_0xe704[_0xe6dd74];return _0x579670;};'use strict';var _=require(_0x4e70('0x0'));var util=require(_0x4e70('0x1'));var utils=require(_0x4e70('0x2'));var dispositions=[_0x4e70('0x3'),'FAILED',_0x4e70('0x4'),_0x4e70('0x3'),_0x4e70('0x3'),_0x4e70('0x3'),_0x4e70('0x5'),_0x4e70('0x6'),_0x4e70('0x4'),_0x4e70('0x4'),_0x4e70('0x4')];var channels={};function writeDB(_0x18be98){utils[_0x4e70('0x7')](util[_0x4e70('0x8')](_0x4e70('0x9'),_0x18be98[_0x4e70('0xa')],_0x18be98[_0x4e70('0xb')],_0x18be98['type'],_0x18be98['accountcode'],_0x18be98['source'],_0x18be98[_0x4e70('0xc')],_0x18be98[_0x4e70('0xd')],_0x18be98[_0x4e70('0xe')]));if(_0x18be98[_0x4e70('0xf')]){utils['getUserByInternal'](_0x18be98[_0x4e70('0xf')])[_0x4e70('0x10')](function(_0x1f02db){if(_0x1f02db){_0x18be98[_0x4e70('0x11')]=_0x1f02db['id'];}utils[_0x4e70('0x12')](_0x4e70('0x13'),_0x18be98);});}else{utils[_0x4e70('0x12')](_0x4e70('0x13'),_0x18be98);}if(channels[_0x18be98[_0x4e70('0xa')]]){delete channels[_0x18be98[_0x4e70('0xa')]];}}exports[_0x4e70('0x14')]=function(_0x5388a5){try{if(_0x5388a5[_0x4e70('0xa')]==_0x5388a5['linkedid']&&_0x5388a5[_0x4e70('0xb')]!=_0x4e70('0x15')){channels[_0x5388a5[_0x4e70('0xa')]]={'uniqueid':_0x5388a5[_0x4e70('0xa')],'accountcode':_0x5388a5[_0x4e70('0xf')],'source':_0x5388a5[_0x4e70('0x16')],'destination':_0x5388a5['exten'],'destinationcontext':_0x5388a5[_0x4e70('0x17')],'channel':_0x5388a5['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4e70('0x3'),'amaflags':_0x4e70('0x18')};}}catch(_0x1e2a90){utils[_0x4e70('0x19')](_0x1e2a90[_0x4e70('0x1a')]);}};exports[_0x4e70('0x1b')]=function(_0x1fad54){try{if(!_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0xa')]])&&_0x1fad54['channelstate']==0x6){if(_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0xa')]][_0x4e70('0x1d')])){channels[_0x1fad54['uniqueid']][_0x4e70('0x1d')]=utils[_0x4e70('0x1e')]();}}else if(!_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0x1f')]])&&_0x1fad54[_0x4e70('0x20')]==0x6&&_0x1fad54['context']!=_0x4e70('0x21')){channels[_0x1fad54['linkedid']][_0x4e70('0xf')]=_0x1fad54[_0x4e70('0xf')];channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0x22')]=_0x1fad54['channel'];if(_[_0x4e70('0x1c')](channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0x23')])){channels[_0x1fad54['linkedid']][_0x4e70('0x23')]=utils[_0x4e70('0x1e')]();}channels[_0x1fad54[_0x4e70('0x1f')]][_0x4e70('0xe')]=dispositions[_[_0x4e70('0x24')](_0x1fad54['channelstate'])]||_0x4e70('0x5');}}catch(_0x541737){utils[_0x4e70('0x19')](_0x541737['stack']);}};exports[_0x4e70('0x25')]=function(_0x212850){try{if(!_[_0x4e70('0x1c')](channels[_0x212850['uniqueid']])){if(_['isNil'](channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0xd')])){channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0xd')]=_0x212850[_0x4e70('0x26')]+'\x20<'+_0x212850[_0x4e70('0x16')]+'>';}channels[_0x212850[_0x4e70('0xa')]]['endtime']=utils[_0x4e70('0x1e')]();channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x27')]=utils[_0x4e70('0x28')](channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x29')],channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x2a')]);channels[_0x212850['uniqueid']][_0x4e70('0x2b')]=channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x23')]?utils[_0x4e70('0x28')](channels[_0x212850[_0x4e70('0xa')]]['endtime'],channels[_0x212850[_0x4e70('0xa')]][_0x4e70('0x23')]):0x0;writeDB(channels[_0x212850[_0x4e70('0xa')]]);}}catch(_0x23b9ea){utils[_0x4e70('0x19')](_0x23b9ea['stack']);}};exports[_0x4e70('0x2c')]=function(_0x1c81ac){try{if(!_[_0x4e70('0x1c')](channels[_0x1c81ac[_0x4e70('0x2d')]])){if(channels[_0x1c81ac['localtwolinkedid']][_0x4e70('0xb')]==_0x1c81ac[_0x4e70('0x2e')]){channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x22')]=_0x1c81ac[_0x4e70('0x2f')];channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x30')]=_0x4e70('0x31');}else if(channels[_0x1c81ac['localtwolinkedid']][_0x4e70('0xb')]=_0x1c81ac['transfertargetchannel']){channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x22')]=_0x1c81ac['origtransfererchannel'];channels[_0x1c81ac[_0x4e70('0x2d')]][_0x4e70('0x30')]=_0x4e70('0x31');}}}catch(_0x2358c){utils['error'](_0x2358c[_0x4e70('0x1a')]);}};exports[_0x4e70('0x32')]=function(_0xd617da){try{if(!_['isNil'](channels[_0xd617da[_0x4e70('0xa')]])){channels[_0xd617da['uniqueid']][_0x4e70('0x33')]=utils[_0x4e70('0x1e')]();}}catch(_0x1cf1f9){utils[_0x4e70('0x19')](_0x1cf1f9[_0x4e70('0x1a')]);}};exports[_0x4e70('0x34')]=function(_0x3e9749){try{if(!_[_0x4e70('0x1c')](channels[_0x3e9749['uniqueid']])){if(!_[_0x4e70('0x1c')](channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')])){channels[_0x3e9749[_0x4e70('0xa')]]['mohtime']+=utils[_0x4e70('0x28')](utils[_0x4e70('0x1e')](),channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')]);delete channels[_0x3e9749[_0x4e70('0xa')]][_0x4e70('0x33')];}}}catch(_0x1b580f){utils[_0x4e70('0x19')](_0x1b580f[_0x4e70('0x1a')]);}};exports['varset']=function(_0x21266e){try{if(!_[_0x4e70('0x1c')](channels[_0x21266e[_0x4e70('0xa')]])){if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x36')])){channels[_0x21266e['uniqueid']][_0x4e70('0x37')]=_0x21266e[_0x4e70('0x38')];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x39')])){channels[_0x21266e[_0x4e70('0xa')]]['destination']=_0x21266e[_0x4e70('0x38')];channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0xd')]='\x22'+_0x21266e['value']+_0x4e70('0x3a')+_0x21266e['value']+'>';}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3b')])||!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3c')])){channels[_0x21266e['uniqueid']][_0x4e70('0xd')]=_0x21266e[_0x4e70('0x38')];}if(!_['isNil'](_0x21266e['variable'][_0x4e70('0x3d')])||!_['isNil'](_0x21266e[_0x4e70('0x35')][_0x4e70('0x3e')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x3f')]='Queue';channels[_0x21266e['uniqueid']]['lastdata']=_0x21266e[_0x4e70('0x38')];channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x40')]=!![];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')][_0x4e70('0x41')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x42')]=_0x21266e[_0x4e70('0x38')];}if(!_[_0x4e70('0x1c')](_0x21266e['variable'][_0x4e70('0x43')])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x44')]=_0x21266e['value'];}if(!_['isNil'](_0x21266e[_0x4e70('0x35')]['outboundrouteid'])){channels[_0x21266e['uniqueid']]['routeid']=_0x21266e['value'];}if(!_[_0x4e70('0x1c')](_0x21266e[_0x4e70('0x35')]['sipcallid'])){channels[_0x21266e[_0x4e70('0xa')]][_0x4e70('0x45')]=_0x21266e[_0x4e70('0x38')];}}}catch(_0xef638){utils[_0x4e70('0x19')](_0xef638[_0x4e70('0x1a')]);}};exports[_0x4e70('0x46')]=function(_0x20d033){try{if(!_[_0x4e70('0x1c')](channels[_0x20d033[_0x4e70('0xa')]])){if(_0x20d033[_0x4e70('0x47')]['toLowerCase']()==_0x4e70('0x48')&&_[_0x4e70('0x49')](_0x20d033[_0x4e70('0x4a')][_0x4e70('0x4b')](),'cdr')){var _0x26580b=_0x20d033[_0x4e70('0x4a')]['split']('=');var _0x2c8e69=_0x26580b[0x0][_0x4e70('0x4c')](_0x26580b[0x0]['lastIndexOf']('(')+0x1,_0x26580b[0x0][_0x4e70('0x4d')](')'));var _0x2a6653=_0x26580b[0x1];channels[_0x20d033['uniqueid']][_0x2c8e69]=_0x2a6653;}if(!_[_0x4e70('0x4e')]([_0x4e70('0x25'),_0x4e70('0x4f'),_0x4e70('0x50'),_0x4e70('0x48'),'gotoif'],_0x20d033[_0x4e70('0x47')]['toLowerCase']())){channels[_0x20d033['uniqueid']]['lastapplication']=_0x20d033['application'];channels[_0x20d033[_0x4e70('0xa')]][_0x4e70('0x51')]=_0x20d033['appdata'];}}}catch(_0x5b6bc5){utils['error'](_0x5b6bc5[_0x4e70('0x1a')]);}}; \ No newline at end of file +var _0x0446=['NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','source','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','DOCUMENTATION','error','stack','newstate','isNil','channelstate','systemanswertime','context','transfer','destinationchannel','answertime','disposition','toNumber','hangup','callerid','endtime','now','diffTime','starttime','billableseconds','attendedtransfer','transfereechannel','secondtransfererchannel','localtwolinkedid','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','value','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','ContactId','xmd-cdrtype','sipcallid','newexten','toLowerCase','startsWith','appdata','split','lastIndexOf','includes','execif','set','gotoif','application','lastdata','lodash','util','./utils'];(function(_0x15be24,_0x17cd29){var _0xa4e5d6=function(_0x5f5bf8){while(--_0x5f5bf8){_0x15be24['push'](_0x15be24['shift']());}};_0xa4e5d6(++_0x17cd29);}(_0x0446,0xf3));var _0x6044=function(_0x3f933c,_0x3c35ea){_0x3f933c=_0x3f933c-0x0;var _0x55cfd0=_0x0446[_0x3f933c];return _0x55cfd0;};'use strict';var _=require(_0x6044('0x0'));var util=require(_0x6044('0x1'));var utils=require(_0x6044('0x2'));var dispositions=[_0x6044('0x3'),_0x6044('0x4'),'FAILED','NO\x20ANSWER',_0x6044('0x3'),_0x6044('0x3'),_0x6044('0x5'),_0x6044('0x6'),_0x6044('0x4'),'FAILED',_0x6044('0x4')];var channels={};function writeDB(_0x20b77f){utils[_0x6044('0x7')](util['format'](_0x6044('0x8'),_0x20b77f[_0x6044('0x9')],_0x20b77f[_0x6044('0xa')],_0x20b77f[_0x6044('0xb')],_0x20b77f['accountcode'],_0x20b77f[_0x6044('0xc')],_0x20b77f['destination'],_0x20b77f['callerid'],_0x20b77f['disposition']));if(_0x20b77f[_0x6044('0xd')]){utils[_0x6044('0xe')](_0x20b77f[_0x6044('0xd')])[_0x6044('0xf')](function(_0x159122){if(_0x159122){_0x20b77f[_0x6044('0x10')]=_0x159122['id'];}utils[_0x6044('0x11')](_0x6044('0x12'),_0x20b77f);});}else{utils[_0x6044('0x11')]('CreateVoiceCallReport',_0x20b77f);}if(channels[_0x20b77f[_0x6044('0x9')]]){delete channels[_0x20b77f[_0x6044('0x9')]];}}exports[_0x6044('0x13')]=function(_0x2da257){try{if(_0x2da257[_0x6044('0x9')]==_0x2da257[_0x6044('0x14')]&&_0x2da257[_0x6044('0xa')]!=_0x6044('0x15')){channels[_0x2da257[_0x6044('0x9')]]={'uniqueid':_0x2da257[_0x6044('0x9')],'accountcode':_0x2da257[_0x6044('0xd')],'source':_0x2da257[_0x6044('0x16')],'destination':_0x2da257[_0x6044('0x17')],'destinationcontext':_0x2da257['context'],'channel':_0x2da257['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6044('0x3'),'amaflags':_0x6044('0x18')};}}catch(_0xed13e5){utils[_0x6044('0x19')](_0xed13e5[_0x6044('0x1a')]);}};exports[_0x6044('0x1b')]=function(_0x1e3d7a){try{if(!_[_0x6044('0x1c')](channels[_0x1e3d7a['uniqueid']])&&_0x1e3d7a[_0x6044('0x1d')]==0x6){if(_[_0x6044('0x1c')](channels[_0x1e3d7a['uniqueid']][_0x6044('0x1e')])){channels[_0x1e3d7a['uniqueid']][_0x6044('0x1e')]=utils['now']();}}else if(!_['isNil'](channels[_0x1e3d7a[_0x6044('0x14')]])&&_0x1e3d7a[_0x6044('0x1d')]==0x6&&_0x1e3d7a[_0x6044('0x1f')]!=_0x6044('0x20')){channels[_0x1e3d7a[_0x6044('0x14')]][_0x6044('0xd')]=_0x1e3d7a[_0x6044('0xd')];channels[_0x1e3d7a[_0x6044('0x14')]][_0x6044('0x21')]=_0x1e3d7a['channel'];if(_[_0x6044('0x1c')](channels[_0x1e3d7a[_0x6044('0x14')]][_0x6044('0x22')])){channels[_0x1e3d7a[_0x6044('0x14')]]['answertime']=utils['now']();}channels[_0x1e3d7a[_0x6044('0x14')]][_0x6044('0x23')]=dispositions[_[_0x6044('0x24')](_0x1e3d7a['channelstate'])]||_0x6044('0x5');}}catch(_0x288e29){utils['error'](_0x288e29[_0x6044('0x1a')]);}};exports[_0x6044('0x25')]=function(_0x2344fc){try{if(!_['isNil'](channels[_0x2344fc['uniqueid']])){if(_[_0x6044('0x1c')](channels[_0x2344fc[_0x6044('0x9')]][_0x6044('0x26')])){channels[_0x2344fc['uniqueid']]['callerid']=_0x2344fc['calleridname']+'\x20<'+_0x2344fc[_0x6044('0x16')]+'>';}channels[_0x2344fc['uniqueid']][_0x6044('0x27')]=utils[_0x6044('0x28')]();channels[_0x2344fc[_0x6044('0x9')]]['duration']=utils[_0x6044('0x29')](channels[_0x2344fc[_0x6044('0x9')]][_0x6044('0x27')],channels[_0x2344fc[_0x6044('0x9')]][_0x6044('0x2a')]);channels[_0x2344fc[_0x6044('0x9')]][_0x6044('0x2b')]=channels[_0x2344fc[_0x6044('0x9')]]['answertime']?utils[_0x6044('0x29')](channels[_0x2344fc[_0x6044('0x9')]]['endtime'],channels[_0x2344fc[_0x6044('0x9')]][_0x6044('0x22')]):0x0;writeDB(channels[_0x2344fc[_0x6044('0x9')]]);}}catch(_0x599cd5){utils['error'](_0x599cd5[_0x6044('0x1a')]);}};exports[_0x6044('0x2c')]=function(_0x2f6d16){try{if(!_[_0x6044('0x1c')](channels[_0x2f6d16['localtwolinkedid']])){if(channels[_0x2f6d16['localtwolinkedid']][_0x6044('0xa')]==_0x2f6d16[_0x6044('0x2d')]){channels[_0x2f6d16['localtwolinkedid']][_0x6044('0x21')]=_0x2f6d16[_0x6044('0x2e')];channels[_0x2f6d16[_0x6044('0x2f')]][_0x6044('0x30')]=_0x6044('0x31');}else if(channels[_0x2f6d16[_0x6044('0x2f')]]['channel']=_0x2f6d16[_0x6044('0x32')]){channels[_0x2f6d16['localtwolinkedid']][_0x6044('0x21')]=_0x2f6d16[_0x6044('0x33')];channels[_0x2f6d16['localtwolinkedid']][_0x6044('0x30')]=_0x6044('0x31');}}}catch(_0x15957d){utils['error'](_0x15957d[_0x6044('0x1a')]);}};exports[_0x6044('0x34')]=function(_0x1fa871){try{if(!_[_0x6044('0x1c')](channels[_0x1fa871[_0x6044('0x9')]])){channels[_0x1fa871[_0x6044('0x9')]][_0x6044('0x35')]=utils['now']();}}catch(_0x467e3a){utils[_0x6044('0x19')](_0x467e3a[_0x6044('0x1a')]);}};exports[_0x6044('0x36')]=function(_0x5080ba){try{if(!_[_0x6044('0x1c')](channels[_0x5080ba[_0x6044('0x9')]])){if(!_[_0x6044('0x1c')](channels[_0x5080ba['uniqueid']]['musiconholdstartAt'])){channels[_0x5080ba[_0x6044('0x9')]]['mohtime']+=utils[_0x6044('0x29')](utils[_0x6044('0x28')](),channels[_0x5080ba[_0x6044('0x9')]]['musiconholdstartAt']);delete channels[_0x5080ba['uniqueid']][_0x6044('0x35')];}}}catch(_0x4bdb65){utils[_0x6044('0x19')](_0x4bdb65[_0x6044('0x1a')]);}};exports[_0x6044('0x37')]=function(_0xe021d1){try{if(!_[_0x6044('0x1c')](channels[_0xe021d1[_0x6044('0x9')]])){if(!_[_0x6044('0x1c')](_0xe021d1['variable']['xmd-originatecalleridnum'])){channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0xc')]=_0xe021d1[_0x6044('0x38')];}if(!_['isNil'](_0xe021d1['variable'][_0x6044('0x39')])){channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0x3a')]=_0xe021d1[_0x6044('0x38')];channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0x26')]='\x22'+_0xe021d1['value']+_0x6044('0x3b')+_0xe021d1['value']+'>';}if(!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')][_0x6044('0x3d')])||!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')]['xmd-callerid'])){channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0x26')]=_0xe021d1[_0x6044('0x38')];}if(!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')]['xmd-queue'])||!_['isNil'](_0xe021d1['variable'][_0x6044('0x3e')])){channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0x3f')]=_0x6044('0x40');channels[_0xe021d1[_0x6044('0x9')]]['lastdata']=_0xe021d1['value'];channels[_0xe021d1[_0x6044('0x9')]][_0x6044('0x41')]=!![];}if(!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')][_0x6044('0x42')])){channels[_0xe021d1['uniqueid']][_0x6044('0x43')]=_0xe021d1[_0x6044('0x38')];}if(!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')][_0x6044('0x44')])){channels[_0xe021d1['uniqueid']][_0x6044('0xb')]=_0xe021d1['value'];}if(!_[_0x6044('0x1c')](_0xe021d1[_0x6044('0x3c')]['outboundrouteid'])){channels[_0xe021d1[_0x6044('0x9')]]['routeid']=_0xe021d1[_0x6044('0x38')];}if(!_['isNil'](_0xe021d1[_0x6044('0x3c')][_0x6044('0x45')])){channels[_0xe021d1['uniqueid']][_0x6044('0x45')]=_0xe021d1['value'];}}}catch(_0x3ce992){utils[_0x6044('0x19')](_0x3ce992['stack']);}};exports[_0x6044('0x46')]=function(_0x15c1cf){try{if(!_[_0x6044('0x1c')](channels[_0x15c1cf[_0x6044('0x9')]])){if(_0x15c1cf['application'][_0x6044('0x47')]()=='set'&&_[_0x6044('0x48')](_0x15c1cf[_0x6044('0x49')]['toLowerCase'](),'cdr')){var _0x306e99=_0x15c1cf['appdata'][_0x6044('0x4a')]('=');var _0x3ee757=_0x306e99[0x0]['substring'](_0x306e99[0x0][_0x6044('0x4b')]('(')+0x1,_0x306e99[0x0][_0x6044('0x4b')](')'));var _0x4d7c8f=_0x306e99[0x1];channels[_0x15c1cf['uniqueid']][_0x3ee757]=_0x4d7c8f;}if(!_[_0x6044('0x4c')]([_0x6044('0x25'),'noop',_0x6044('0x4d'),_0x6044('0x4e'),_0x6044('0x4f')],_0x15c1cf[_0x6044('0x50')]['toLowerCase']())){channels[_0x15c1cf[_0x6044('0x9')]][_0x6044('0x3f')]=_0x15c1cf['application'];channels[_0x15c1cf[_0x6044('0x9')]][_0x6044('0x51')]=_0x15c1cf[_0x6044('0x49')];}}}catch(_0x1f00d3){utils[_0x6044('0x19')](_0x1f00d3[_0x6044('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 9b3eef3..ab3111e 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 _0x5496=['lodash','connect','info','CONNECTED','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils'];(function(_0x42473d,_0x443295){var _0x19a081=function(_0x86e0a1){while(--_0x86e0a1){_0x42473d['push'](_0x42473d['shift']());}};_0x19a081(++_0x443295);}(_0x5496,0x175));var _0x6549=function(_0x1e6732,_0x523685){_0x1e6732=_0x1e6732-0x0;var _0x59c5eb=_0x5496[_0x1e6732];return _0x59c5eb;};'use strict';var utils=require(_0x6549('0x0'));var _=require(_0x6549('0x1'));exports[_0x6549('0x2')]=function(){utils[_0x6549('0x3')](_0x6549('0x4'));};exports['shutdown']=function(){utils[_0x6549('0x3')]('SHUTDOWN');};exports[_0x6549('0x5')]=function(){utils[_0x6549('0x3')](_0x6549('0x6'));};exports['error']=function(_0x5a4658){utils[_0x6549('0x7')](_0x5a4658);};exports[_0x6549('0x8')]=function(){utils['info'](_0x6549('0x9'));};exports[_0x6549('0xa')]=function(_0x1ef2a6){}; \ No newline at end of file +var _0xdbf5=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','lodash','CONNECTED','shutdown','info'];(function(_0x28b0a4,_0x2ea758){var _0x105ce6=function(_0x6df20f){while(--_0x6df20f){_0x28b0a4['push'](_0x28b0a4['shift']());}};_0x105ce6(++_0x2ea758);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x290dd8,_0x3a37cc){_0x290dd8=_0x290dd8-0x0;var _0x5f202e=_0xdbf5[_0x290dd8];return _0x5f202e;};'use strict';var utils=require('./utils');var _=require(_0x5dbf('0x0'));exports['connect']=function(){utils['info'](_0x5dbf('0x1'));};exports[_0x5dbf('0x2')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x4'));};exports[_0x5dbf('0x5')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x6'));};exports[_0x5dbf('0x7')]=function(_0x3f8628){utils[_0x5dbf('0x7')](_0x3f8628);};exports[_0x5dbf('0x8')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x9'));};exports['managerevent']=function(_0x134810){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 53250d1..f3e3a58 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 _0xc7ec=['appdata','toLowerCase','cdr(routeid)','error','stack','isNil','variable','value','dialbegin','starttime','now','called','dialend','dialstatus','ANSWER','assign','answertime','lastevent','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','request','newexten','application','set','startsWith'];(function(_0x12166e,_0x458cd5){var _0x64ca38=function(_0x4c8a7a){while(--_0x4c8a7a){_0x12166e['push'](_0x12166e['shift']());}};_0x64ca38(++_0x458cd5);}(_0xc7ec,0x164));var _0xcc7e=function(_0x527dc5,_0x1de7e7){_0x527dc5=_0x527dc5-0x0;var _0x216de9=_0xc7ec[_0x527dc5];return _0x216de9;};'use strict';var _=require(_0xcc7e('0x0'));var util=require(_0xcc7e('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x550bc4){utils[_0xcc7e('0x2')](util[_0xcc7e('0x3')](_0xcc7e('0x4'),_0x550bc4[_0xcc7e('0x5')],_0x550bc4[_0xcc7e('0x6')],_0x550bc4[_0xcc7e('0x7')],_0x550bc4[_0xcc7e('0x8')],_0x550bc4['connectedlinenum'],_0x550bc4['dialstatus']));utils[_0xcc7e('0x9')]('CreateVoiceDialReport',_0x550bc4);delete dials[_0x550bc4[_0xcc7e('0x5')]];}exports[_0xcc7e('0xa')]=function(_0x6650fb){try{if(_0x6650fb[_0xcc7e('0xb')]['toLowerCase']()==_0xcc7e('0xc')&&_[_0xcc7e('0xd')](_0x6650fb[_0xcc7e('0xe')][_0xcc7e('0xf')](),_0xcc7e('0x10'))){var _0x13597e=_0x6650fb[_0xcc7e('0xe')]['split']('=');dials[_0x6650fb['uniqueid']]={'routeId':_0x13597e[0x1]};}}catch(_0x228088){utils[_0xcc7e('0x11')](_0x228088[_0xcc7e('0x12')]);}};exports['varset']=function(_0x583fde){try{if(!_[_0xcc7e('0x13')](_0x583fde[_0xcc7e('0x14')]['outboundrouteid'])){dials[_0x583fde[_0xcc7e('0x5')]]={'routeId':_0x583fde[_0xcc7e('0x15')]};}}catch(_0x2b1149){utils[_0xcc7e('0x11')](_0x2b1149['stack']);}};exports[_0xcc7e('0x16')]=function(_0x1b7841){try{if(!_[_0xcc7e('0x13')](dials[_0x1b7841[_0xcc7e('0x5')]])){dials[_0x1b7841[_0xcc7e('0x5')]]=_['assign'](dials[_0x1b7841[_0xcc7e('0x5')]],_0x1b7841);dials[_0x1b7841[_0xcc7e('0x5')]][_0xcc7e('0x17')]=utils[_0xcc7e('0x18')]();dials[_0x1b7841[_0xcc7e('0x5')]]['lastevent']=_0xcc7e('0x19');}}catch(_0x7f4f5e){utils[_0xcc7e('0x11')](_0x7f4f5e[_0xcc7e('0x12')]);}};exports[_0xcc7e('0x1a')]=function(_0x2a72e7){try{if(!_['isNil'](dials[_0x2a72e7['uniqueid']])){dials[_0x2a72e7['uniqueid']]['dialstatus']=_0x2a72e7[_0xcc7e('0x1b')];if(_0x2a72e7[_0xcc7e('0x1b')]==_0xcc7e('0x1c')){dials[_0x2a72e7['uniqueid']]=_[_0xcc7e('0x1d')](dials[_0x2a72e7[_0xcc7e('0x5')]],_0x2a72e7);dials[_0x2a72e7[_0xcc7e('0x5')]][_0xcc7e('0x1e')]=utils[_0xcc7e('0x18')]();dials[_0x2a72e7[_0xcc7e('0x5')]][_0xcc7e('0x1f')]='connect';}}}catch(_0x2e47a9){utils['error'](_0x2e47a9['stack']);}};exports['hangup']=function(_0x20a586){try{if(!_[_0xcc7e('0x13')](dials[_0x20a586[_0xcc7e('0x5')]])){dials[_0x20a586[_0xcc7e('0x5')]]=_[_0xcc7e('0x1d')](dials[_0x20a586['uniqueid']],{'endtime':utils[_0xcc7e('0x18')](),'lastevent':'complete'});dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x20')]=utils[_0xcc7e('0x21')](dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x22')],dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x17')]);dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x23')]=utils['diffTime'](dials[_0x20a586['uniqueid']][_0xcc7e('0x1e')]||dials[_0x20a586['uniqueid']][_0xcc7e('0x22')],dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x17')]);dials[_0x20a586['uniqueid']][_0xcc7e('0x24')]=dials[_0x20a586[_0xcc7e('0x5')]][_0xcc7e('0x1e')]?utils[_0xcc7e('0x21')](dials[_0x20a586['uniqueid']][_0xcc7e('0x22')],dials[_0x20a586['uniqueid']]['answertime']):0x0;writeDB(dials[_0x20a586[_0xcc7e('0x5')]]);}}catch(_0x37f601){utils[_0xcc7e('0x11')](_0x37f601[_0xcc7e('0x12')]);}}; \ No newline at end of file +var _0x4c37=['CreateVoiceDialReport','application','toLowerCase','set','startsWith','cdr(routeid)','split','error','isNil','variable','stack','starttime','lastevent','called','dialend','dialstatus','ANSWER','assign','answertime','now','connect','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','request'];(function(_0xd79494,_0x1fcda7){var _0x1c1698=function(_0x15e012){while(--_0x15e012){_0xd79494['push'](_0xd79494['shift']());}};_0x1c1698(++_0x1fcda7);}(_0x4c37,0x8a));var _0x74c3=function(_0x4966e9,_0x5e2272){_0x4966e9=_0x4966e9-0x0;var _0x2887b2=_0x4c37[_0x4966e9];return _0x2887b2;};'use strict';var _=require(_0x74c3('0x0'));var util=require(_0x74c3('0x1'));var utils=require(_0x74c3('0x2'));var dials={};function writeDB(_0x426b3a){utils[_0x74c3('0x3')](util[_0x74c3('0x4')](_0x74c3('0x5'),_0x426b3a[_0x74c3('0x6')],_0x426b3a[_0x74c3('0x7')],_0x426b3a['dialstring'],_0x426b3a[_0x74c3('0x8')],_0x426b3a['connectedlinenum'],_0x426b3a['dialstatus']));utils[_0x74c3('0x9')](_0x74c3('0xa'),_0x426b3a);delete dials[_0x426b3a[_0x74c3('0x6')]];}exports['newexten']=function(_0x13a674){try{if(_0x13a674[_0x74c3('0xb')][_0x74c3('0xc')]()==_0x74c3('0xd')&&_[_0x74c3('0xe')](_0x13a674['appdata'][_0x74c3('0xc')](),_0x74c3('0xf'))){var _0x2a18b1=_0x13a674['appdata'][_0x74c3('0x10')]('=');dials[_0x13a674[_0x74c3('0x6')]]={'routeId':_0x2a18b1[0x1]};}}catch(_0x61553b){utils[_0x74c3('0x11')](_0x61553b['stack']);}};exports['varset']=function(_0x277566){try{if(!_[_0x74c3('0x12')](_0x277566[_0x74c3('0x13')]['outboundrouteid'])){dials[_0x277566[_0x74c3('0x6')]]={'routeId':_0x277566['value']};}}catch(_0x188f60){utils[_0x74c3('0x11')](_0x188f60[_0x74c3('0x14')]);}};exports['dialbegin']=function(_0x1b1b80){try{if(!_[_0x74c3('0x12')](dials[_0x1b1b80[_0x74c3('0x6')]])){dials[_0x1b1b80['uniqueid']]=_['assign'](dials[_0x1b1b80[_0x74c3('0x6')]],_0x1b1b80);dials[_0x1b1b80[_0x74c3('0x6')]][_0x74c3('0x15')]=utils['now']();dials[_0x1b1b80[_0x74c3('0x6')]][_0x74c3('0x16')]=_0x74c3('0x17');}}catch(_0xe4ccf8){utils[_0x74c3('0x11')](_0xe4ccf8[_0x74c3('0x14')]);}};exports[_0x74c3('0x18')]=function(_0x1b242c){try{if(!_[_0x74c3('0x12')](dials[_0x1b242c['uniqueid']])){dials[_0x1b242c[_0x74c3('0x6')]]['dialstatus']=_0x1b242c[_0x74c3('0x19')];if(_0x1b242c[_0x74c3('0x19')]==_0x74c3('0x1a')){dials[_0x1b242c[_0x74c3('0x6')]]=_[_0x74c3('0x1b')](dials[_0x1b242c['uniqueid']],_0x1b242c);dials[_0x1b242c[_0x74c3('0x6')]][_0x74c3('0x1c')]=utils[_0x74c3('0x1d')]();dials[_0x1b242c[_0x74c3('0x6')]][_0x74c3('0x16')]=_0x74c3('0x1e');}}}catch(_0x2d6f91){utils[_0x74c3('0x11')](_0x2d6f91[_0x74c3('0x14')]);}};exports['hangup']=function(_0x3a7324){try{if(!_[_0x74c3('0x12')](dials[_0x3a7324['uniqueid']])){dials[_0x3a7324[_0x74c3('0x6')]]=_[_0x74c3('0x1b')](dials[_0x3a7324['uniqueid']],{'endtime':utils[_0x74c3('0x1d')](),'lastevent':_0x74c3('0x1f')});dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x20')]=utils[_0x74c3('0x21')](dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x22')],dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x15')]);dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x23')]=utils[_0x74c3('0x21')](dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x1c')]||dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x22')],dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x15')]);dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x24')]=dials[_0x3a7324[_0x74c3('0x6')]]['answertime']?utils[_0x74c3('0x21')](dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x22')],dials[_0x3a7324[_0x74c3('0x6')]][_0x74c3('0x1c')]):0x0;writeDB(dials[_0x3a7324['uniqueid']]);}}catch(_0x4f02f7){utils['error'](_0x4f02f7[_0x74c3('0x14')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index f5fb953..d7cfab0 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 _0x4826=['close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','port','asterisk','username','password','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error'];(function(_0x5b8af9,_0x3f1f47){var _0x137746=function(_0x499093){while(--_0x499093){_0x5b8af9['push'](_0x5b8af9['shift']());}};_0x137746(++_0x3f1f47);}(_0x4826,0x143));var _0x6482=function(_0x335c48,_0xaafd9){_0x335c48=_0x335c48-0x0;var _0x567177=_0x4826[_0x335c48];return _0x567177;};var AsteriskManager=require('asterisk-manager');var config=require(_0x6482('0x0'));var utils=require(_0x6482('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x6482('0x2')],config[_0x6482('0x3')]['ip'],config['asterisk'][_0x6482('0x4')],config[_0x6482('0x3')][_0x6482('0x5')],!![]);ami['keepConnected']();if(config[_0x6482('0x6')]&&config[_0x6482('0x6')][_0x6482('0x7')]){utils[_0x6482('0x8')](_0x6482('0x9'));}else{var agents=require('./agents.controller');var calls=require(_0x6482('0xa'));var queues=require(_0x6482('0xb'));var recordings=require(_0x6482('0xc'));var members=require(_0x6482('0xd'));var dials=require(_0x6482('0xe'));var transfers=require(_0x6482('0xf'));var core=require(_0x6482('0x10'));ami['on'](_0x6482('0x11'),core[_0x6482('0x11')]);ami['on'](_0x6482('0x12'),core[_0x6482('0x12')]);ami['on'](_0x6482('0x13'),core[_0x6482('0x13')]);ami['on'](_0x6482('0x14'),core[_0x6482('0x14')]);ami['on'](_0x6482('0x15'),core[_0x6482('0x15')]);ami['on']('managerevent',core[_0x6482('0x16')]);ami['on']('devicestatechange',function(_0x4022fa){try{members[_0x6482('0x17')](_0x4022fa);}catch(_0x3ec538){utils[_0x6482('0x14')](_0x3ec538);}});ami['on'](_0x6482('0x18'),function(_0x493a40){try{agents['agentcalled'](_0x493a40);}catch(_0x3862d8){utils[_0x6482('0x14')](_0x3862d8);}});ami['on'](_0x6482('0x19'),function(_0x2e7d3d){try{agents[_0x6482('0x19')](_0x2e7d3d);}catch(_0x170f18){utils[_0x6482('0x14')](_0x170f18);}});ami['on'](_0x6482('0x1a'),function(_0x22d8dd){try{agents[_0x6482('0x1a')](_0x22d8dd);queues[_0x6482('0x1a')](_0x22d8dd);}catch(_0x921af8){utils[_0x6482('0x14')](_0x921af8);}});ami['on'](_0x6482('0x1b'),function(_0x56989d){try{agents['agentcomplete'](_0x56989d);queues[_0x6482('0x1b')](_0x56989d);members[_0x6482('0x1b')](_0x56989d);}catch(_0x1bd5e9){utils[_0x6482('0x14')](_0x1bd5e9);}});ami['on'](_0x6482('0x1c'),function(_0x73a7e2){try{agents['queuecallerabandon'](_0x73a7e2);queues[_0x6482('0x1c')](_0x73a7e2);}catch(_0x17c0cc){utils[_0x6482('0x14')](_0x17c0cc);}});ami['on'](_0x6482('0x1d'),function(_0x3e18e5){try{queues[_0x6482('0x1d')](_0x3e18e5);recordings[_0x6482('0x1d')](_0x3e18e5);}catch(_0x5797af){utils['error'](_0x5797af);}});ami['on'](_0x6482('0x1e'),function(_0x1b2843){try{queues[_0x6482('0x1e')](_0x1b2843);}catch(_0x5f4442){utils[_0x6482('0x14')](_0x5f4442);}});ami['on']('musiconholdstart',function(_0x45dcf1){try{queues['musiconholdstart'](_0x45dcf1);calls[_0x6482('0x1f')](_0x45dcf1);}catch(_0x3eb312){utils[_0x6482('0x14')](_0x3eb312);}});ami['on'](_0x6482('0x20'),function(_0x130bf6){try{queues[_0x6482('0x20')](_0x130bf6);calls[_0x6482('0x20')](_0x130bf6);}catch(_0x190c67){utils[_0x6482('0x14')](_0x190c67);}});ami['on'](_0x6482('0x21'),function(_0x5b75c3){try{calls[_0x6482('0x21')](_0x5b75c3);recordings[_0x6482('0x21')](_0x5b75c3);}catch(_0xd8678b){utils[_0x6482('0x14')](_0xd8678b);}});ami['on'](_0x6482('0x22'),function(_0x594a10){try{calls['hangup'](_0x594a10);recordings['hangup'](_0x594a10);dials[_0x6482('0x22')](_0x594a10);agents['hangup'](_0x594a10);queues[_0x6482('0x22')](_0x594a10);}catch(_0x486034){utils['error'](_0x486034);}});ami['on'](_0x6482('0x23'),function(_0x1be065){try{members['cdr'](_0x1be065);}catch(_0x2c2c13){utils[_0x6482('0x14')](_0x2c2c13);}});ami['on'](_0x6482('0x24'),function(_0x995f2){try{queues['blindtransfer'](_0x995f2);agents[_0x6482('0x24')](_0x995f2);transfers[_0x6482('0x24')](_0x995f2);}catch(_0x172c35){utils[_0x6482('0x14')](_0x172c35);}});ami['on']('attendedtransfer',function(_0x6abaed){try{queues['attendedtransfer'](_0x6abaed);transfers[_0x6482('0x25')](_0x6abaed);agents[_0x6482('0x25')](_0x6abaed);calls[_0x6482('0x25')](_0x6abaed);}catch(_0x1f8f5f){utils[_0x6482('0x14')](_0x1f8f5f);}});ami['on'](_0x6482('0x26'),function(_0x309ea8){try{queues[_0x6482('0x26')](_0x309ea8);recordings[_0x6482('0x26')](_0x309ea8);calls[_0x6482('0x26')](_0x309ea8);dials[_0x6482('0x26')](_0x309ea8);}catch(_0x322f8a){utils['error'](_0x322f8a);}});ami['on'](_0x6482('0x27'),function(_0x1c3925){try{calls[_0x6482('0x27')](_0x1c3925);recordings['newexten'](_0x1c3925);dials['newexten'](_0x1c3925);}catch(_0x46780f){utils[_0x6482('0x14')](_0x46780f);}});ami['on'](_0x6482('0x28'),function(_0x381d61){try{calls['newchannel'](_0x381d61);recordings['newchannel'](_0x381d61);}catch(_0x3ee6d0){utils['error'](_0x3ee6d0);}});ami['on'](_0x6482('0x29'),function(_0x4c9c42){try{dials[_0x6482('0x29')](_0x4c9c42);}catch(_0x53d72d){utils[_0x6482('0x14')](_0x53d72d);}});ami['on'](_0x6482('0x2a'),function(_0x437eba){try{dials['dialend'](_0x437eba);}catch(_0x525272){utils[_0x6482('0x14')](_0x525272);}});} \ No newline at end of file +var _0x838a=['agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','port','username','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x838a,0xb4));var _0xa838=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x838a[_0x53e3fa];return _0xe8584a;};var AsteriskManager=require(_0xa838('0x0'));var config=require(_0xa838('0x1'));var utils=require(_0xa838('0x2'));var ami=new AsteriskManager(config[_0xa838('0x3')][_0xa838('0x4')],config[_0xa838('0x3')]['ip'],config[_0xa838('0x3')][_0xa838('0x5')],config[_0xa838('0x3')]['password'],!![]);ami[_0xa838('0x6')]();if(config[_0xa838('0x7')]&&config[_0xa838('0x7')][_0xa838('0x8')]){utils['info'](_0xa838('0x9'));}else{var agents=require(_0xa838('0xa'));var calls=require(_0xa838('0xb'));var queues=require(_0xa838('0xc'));var recordings=require(_0xa838('0xd'));var members=require(_0xa838('0xe'));var dials=require(_0xa838('0xf'));var transfers=require('./transfers.controller');var core=require(_0xa838('0x10'));ami['on'](_0xa838('0x11'),core[_0xa838('0x11')]);ami['on'](_0xa838('0x12'),core[_0xa838('0x12')]);ami['on'](_0xa838('0x13'),core[_0xa838('0x13')]);ami['on'](_0xa838('0x14'),core[_0xa838('0x14')]);ami['on']('close',core[_0xa838('0x15')]);ami['on'](_0xa838('0x16'),core[_0xa838('0x16')]);ami['on'](_0xa838('0x17'),function(_0x4c996f){try{members[_0xa838('0x17')](_0x4c996f);}catch(_0x32a949){utils[_0xa838('0x14')](_0x32a949);}});ami['on']('agentcalled',function(_0x494d5c){try{agents['agentcalled'](_0x494d5c);}catch(_0x3b6d4a){utils[_0xa838('0x14')](_0x3b6d4a);}});ami['on']('agentringnoanswer',function(_0x17e518){try{agents[_0xa838('0x18')](_0x17e518);}catch(_0x5625ff){utils[_0xa838('0x14')](_0x5625ff);}});ami['on']('agentconnect',function(_0x34f1b2){try{agents[_0xa838('0x19')](_0x34f1b2);queues['agentconnect'](_0x34f1b2);}catch(_0x565a32){utils[_0xa838('0x14')](_0x565a32);}});ami['on']('agentcomplete',function(_0x1dda0){try{agents[_0xa838('0x1a')](_0x1dda0);queues[_0xa838('0x1a')](_0x1dda0);members[_0xa838('0x1a')](_0x1dda0);}catch(_0x3794c6){utils[_0xa838('0x14')](_0x3794c6);}});ami['on'](_0xa838('0x1b'),function(_0x3497af){try{agents[_0xa838('0x1b')](_0x3497af);queues[_0xa838('0x1b')](_0x3497af);}catch(_0x321340){utils['error'](_0x321340);}});ami['on'](_0xa838('0x1c'),function(_0x5897e9){try{queues['queuecallerjoin'](_0x5897e9);recordings[_0xa838('0x1c')](_0x5897e9);}catch(_0x7a24e9){utils[_0xa838('0x14')](_0x7a24e9);}});ami['on'](_0xa838('0x1d'),function(_0x46038d){try{queues[_0xa838('0x1d')](_0x46038d);}catch(_0x186ea2){utils[_0xa838('0x14')](_0x186ea2);}});ami['on'](_0xa838('0x1e'),function(_0x290083){try{queues[_0xa838('0x1e')](_0x290083);calls[_0xa838('0x1e')](_0x290083);}catch(_0x122a5f){utils['error'](_0x122a5f);}});ami['on'](_0xa838('0x1f'),function(_0x3c6ab0){try{queues[_0xa838('0x1f')](_0x3c6ab0);calls[_0xa838('0x1f')](_0x3c6ab0);}catch(_0x27b0fa){utils[_0xa838('0x14')](_0x27b0fa);}});ami['on'](_0xa838('0x20'),function(_0x1c0d61){try{calls[_0xa838('0x20')](_0x1c0d61);recordings[_0xa838('0x20')](_0x1c0d61);}catch(_0x2d183c){utils[_0xa838('0x14')](_0x2d183c);}});ami['on'](_0xa838('0x21'),function(_0x58aeb4){try{calls[_0xa838('0x21')](_0x58aeb4);recordings[_0xa838('0x21')](_0x58aeb4);dials[_0xa838('0x21')](_0x58aeb4);agents[_0xa838('0x21')](_0x58aeb4);queues['hangup'](_0x58aeb4);}catch(_0x34fcaf){utils[_0xa838('0x14')](_0x34fcaf);}});ami['on']('cdr',function(_0x5aca55){try{members['cdr'](_0x5aca55);}catch(_0x75cb31){utils['error'](_0x75cb31);}});ami['on']('blindtransfer',function(_0x1c4318){try{queues[_0xa838('0x22')](_0x1c4318);agents[_0xa838('0x22')](_0x1c4318);transfers[_0xa838('0x22')](_0x1c4318);}catch(_0x5edb36){utils[_0xa838('0x14')](_0x5edb36);}});ami['on'](_0xa838('0x23'),function(_0x5874fb){try{queues['attendedtransfer'](_0x5874fb);transfers[_0xa838('0x23')](_0x5874fb);agents[_0xa838('0x23')](_0x5874fb);calls[_0xa838('0x23')](_0x5874fb);}catch(_0x494948){utils[_0xa838('0x14')](_0x494948);}});ami['on'](_0xa838('0x24'),function(_0x51eddb){try{queues[_0xa838('0x24')](_0x51eddb);recordings[_0xa838('0x24')](_0x51eddb);calls[_0xa838('0x24')](_0x51eddb);dials[_0xa838('0x24')](_0x51eddb);}catch(_0x267ea0){utils[_0xa838('0x14')](_0x267ea0);}});ami['on']('newexten',function(_0x3f2d59){try{calls[_0xa838('0x25')](_0x3f2d59);recordings[_0xa838('0x25')](_0x3f2d59);dials[_0xa838('0x25')](_0x3f2d59);}catch(_0x445754){utils[_0xa838('0x14')](_0x445754);}});ami['on'](_0xa838('0x26'),function(_0x519af8){try{calls[_0xa838('0x26')](_0x519af8);recordings[_0xa838('0x26')](_0x519af8);}catch(_0x30a391){utils['error'](_0x30a391);}});ami['on']('dialbegin',function(_0x13028d){try{dials[_0xa838('0x27')](_0x13028d);}catch(_0x37f45a){utils[_0xa838('0x14')](_0x37f45a);}});ami['on'](_0xa838('0x28'),function(_0xfc744f){try{dials['dialend'](_0xfc744f);}catch(_0xd86876){utils[_0xa838('0x14')](_0xd86876);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fda9a12..0fb391e 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 _0x4020=['./utils','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','type','then','name','internal','request','membername','CreateMemberReport','catch','error','some','startsWith','devicestatechange','state','INUSE','BUSY','now','agent','NOT_INUSE','isNil','device','exitAt','diffTime','enterAt','assign','queue','split','data1','source','data3','destination','destinationchannel','lodash','util'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x4020,0xa2));var _0x0402=function(_0x16a044,_0x2bece0){_0x16a044=_0x16a044-0x0;var _0xae9d42=_0x4020[_0x16a044];return _0xae9d42;};'use strict';var _=require(_0x0402('0x0'));var util=require(_0x0402('0x1'));var utils=require(_0x0402('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x0402('0x3')];function writeDB(_0xbc1f04){utils['info'](util[_0x0402('0x4')](_0x0402('0x5'),_0xbc1f04[_0x0402('0x6')],_0xbc1f04[_0x0402('0x7')],_0xbc1f04[_0x0402('0x8')],_0xbc1f04[_0x0402('0x9')],_0xbc1f04['membername'],_0xbc1f04[_0x0402('0xa')]));if(_0xbc1f04[_0x0402('0x7')]){utils['getUserByInterface'](_0xbc1f04['interface'])[_0x0402('0xb')](function(_0x4183fe){if(_0x4183fe){_0xbc1f04['membername']=_0x4183fe[_0x0402('0xc')];_0xbc1f04[_0x0402('0xd')]=_0x4183fe['internal'];utils[_0x0402('0xe')]('CreateMemberReport',_0xbc1f04);}else{utils['getUserByName'](_0xbc1f04[_0x0402('0x7')]['split']('/')[0x1])[_0x0402('0xb')](function(_0x20fa93){if(_0x20fa93){_0xbc1f04[_0x0402('0xf')]=_0x20fa93[_0x0402('0xc')];_0xbc1f04[_0x0402('0xd')]=_0x20fa93[_0x0402('0xd')];utils[_0x0402('0xe')](_0x0402('0x10'),_0xbc1f04);}});}})[_0x0402('0x11')](function(_0x129fff){utils[_0x0402('0x12')](_0x129fff);});}delete members[_0xbc1f04[_0x0402('0x7')]];}function startsWith(_0x4fa02e,_0x38ea21){return _[_0x0402('0x13')](_0x4fa02e,function(_0x5c90f6){return _[_0x0402('0x14')](_0x38ea21,_0x5c90f6);});}exports[_0x0402('0x15')]=function(_0x28f714){switch(_0x28f714[_0x0402('0x16')]){case _0x0402('0x17'):case _0x0402('0x18'):if(!startsWith(exclude,_0x28f714['device'])){members[_0x28f714['device']]={'channel':'voice','interface':_0x28f714['device'],'type':'TALKING','enterAt':utils[_0x0402('0x19')](),'role':_0x0402('0x1a')};}break;case _0x0402('0x1b'):if(!_[_0x0402('0x1c')](members[_0x28f714['device']])){members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x1e')]=utils[_0x0402('0x19')]();members[_0x28f714[_0x0402('0x1d')]]['duration']=utils[_0x0402('0x1f')](members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x1e')],members[_0x28f714[_0x0402('0x1d')]][_0x0402('0x20')]);if(members[_0x28f714[_0x0402('0x1d')]]['uniqueid']){writeDB(members[_0x28f714['device']]);}}default:break;}};exports['agentcomplete']=function(_0x462691){if(!_[_0x0402('0x1c')](members[_0x462691[_0x0402('0x7')]])){members[_0x462691[_0x0402('0x7')]]=_[_0x0402('0x21')](members[_0x462691[_0x0402('0x7')]],{'data4':_0x462691[_0x0402('0x22')],'uniqueid':_0x462691[_0x0402('0x6')]});}};exports['cdr']=function(_0x54379a){if(_0x54379a['channel']){var _0x2c9fbc=_0x54379a[_0x0402('0x8')][_0x0402('0x23')]('-')[0x0];if(!_['isNil'](members[_0x2c9fbc])){members[_0x2c9fbc]=_[_0x0402('0x21')](members[_0x2c9fbc],{'data1':members[_0x2c9fbc][_0x0402('0x24')]||_0x54379a['type'],'data2':members[_0x2c9fbc][_0x0402('0x9')]||_0x54379a[_0x0402('0x25')],'data3':members[_0x2c9fbc][_0x0402('0x26')]||_0x54379a[_0x0402('0x27')],'uniqueid':members[_0x2c9fbc][_0x0402('0x6')]||_0x54379a['uniqueid']});if(members[_0x2c9fbc][_0x0402('0x1e')]){writeDB(members[_0x2c9fbc]);}}}if(_0x54379a[_0x0402('0x28')]){var _0x3ceb8e=_0x54379a['destinationchannel'][_0x0402('0x23')]('-')[0x0];if(!_[_0x0402('0x1c')](members[_0x3ceb8e])){members[_0x3ceb8e]=_[_0x0402('0x21')](members[_0x3ceb8e],{'data1':members[_0x3ceb8e][_0x0402('0x24')]||_0x54379a[_0x0402('0xa')],'data2':members[_0x3ceb8e][_0x0402('0x9')]||_0x54379a[_0x0402('0x25')],'data3':members[_0x3ceb8e][_0x0402('0x26')]||_0x54379a[_0x0402('0x27')],'uniqueid':members[_0x3ceb8e][_0x0402('0x6')]||_0x54379a[_0x0402('0x6')]});if(members[_0x3ceb8e][_0x0402('0x1e')]){writeDB(members[_0x3ceb8e]);}}}}; \ No newline at end of file +var _0x9f92=['info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','queue','assign','data1','data2','source','destinationchannel','data3','destination','lodash','util','./utils','Local/_attended@transfer','Queue:'];(function(_0x16fb2b,_0x4934ce){var _0x4db088=function(_0x131778){while(--_0x131778){_0x16fb2b['push'](_0x16fb2b['shift']());}};_0x4db088(++_0x4934ce);}(_0x9f92,0x144));var _0x29f9=function(_0x2d2f17,_0x2bd8a9){_0x2d2f17=_0x2d2f17-0x0;var _0x5a49ae=_0x9f92[_0x2d2f17];return _0x5a49ae;};'use strict';var _=require(_0x29f9('0x0'));var util=require(_0x29f9('0x1'));var utils=require(_0x29f9('0x2'));var members={};var exclude=[_0x29f9('0x3'),_0x29f9('0x4')];function writeDB(_0x49bfb3){utils[_0x29f9('0x5')](util[_0x29f9('0x6')](_0x29f9('0x7'),_0x49bfb3[_0x29f9('0x8')],_0x49bfb3[_0x29f9('0x9')],_0x49bfb3[_0x29f9('0xa')],_0x49bfb3['data2'],_0x49bfb3[_0x29f9('0xb')],_0x49bfb3[_0x29f9('0xc')]));if(_0x49bfb3[_0x29f9('0x9')]){utils[_0x29f9('0xd')](_0x49bfb3[_0x29f9('0x9')])[_0x29f9('0xe')](function(_0x4b1872){if(_0x4b1872){_0x49bfb3['membername']=_0x4b1872[_0x29f9('0xf')];_0x49bfb3[_0x29f9('0x10')]=_0x4b1872[_0x29f9('0x10')];utils[_0x29f9('0x11')](_0x29f9('0x12'),_0x49bfb3);}else{utils[_0x29f9('0x13')](_0x49bfb3[_0x29f9('0x9')][_0x29f9('0x14')]('/')[0x1])[_0x29f9('0xe')](function(_0x16b79d){if(_0x16b79d){_0x49bfb3['membername']=_0x16b79d[_0x29f9('0xf')];_0x49bfb3[_0x29f9('0x10')]=_0x16b79d[_0x29f9('0x10')];utils[_0x29f9('0x11')]('CreateMemberReport',_0x49bfb3);}});}})[_0x29f9('0x15')](function(_0x134035){utils[_0x29f9('0x16')](_0x134035);});}delete members[_0x49bfb3[_0x29f9('0x9')]];}function startsWith(_0x491888,_0x3280f4){return _['some'](_0x491888,function(_0x1c2027){return _[_0x29f9('0x17')](_0x3280f4,_0x1c2027);});}exports[_0x29f9('0x18')]=function(_0x419faa){switch(_0x419faa[_0x29f9('0x19')]){case _0x29f9('0x1a'):case _0x29f9('0x1b'):if(!startsWith(exclude,_0x419faa['device'])){members[_0x419faa[_0x29f9('0x1c')]]={'channel':_0x29f9('0x1d'),'interface':_0x419faa[_0x29f9('0x1c')],'type':_0x29f9('0x1e'),'enterAt':utils[_0x29f9('0x1f')](),'role':_0x29f9('0x20')};}break;case'NOT_INUSE':if(!_[_0x29f9('0x21')](members[_0x419faa[_0x29f9('0x1c')]])){members[_0x419faa['device']][_0x29f9('0x22')]=utils[_0x29f9('0x1f')]();members[_0x419faa[_0x29f9('0x1c')]][_0x29f9('0x23')]=utils[_0x29f9('0x24')](members[_0x419faa['device']][_0x29f9('0x22')],members[_0x419faa[_0x29f9('0x1c')]][_0x29f9('0x25')]);if(members[_0x419faa[_0x29f9('0x1c')]][_0x29f9('0x8')]){writeDB(members[_0x419faa['device']]);}}default:break;}};exports[_0x29f9('0x26')]=function(_0x160f6f){if(!_[_0x29f9('0x21')](members[_0x160f6f[_0x29f9('0x9')]])){members[_0x160f6f['interface']]=_['assign'](members[_0x160f6f[_0x29f9('0x9')]],{'data4':_0x160f6f[_0x29f9('0x27')],'uniqueid':_0x160f6f['uniqueid']});}};exports['cdr']=function(_0x4097a8){if(_0x4097a8['channel']){var _0x133f64=_0x4097a8['channel'][_0x29f9('0x14')]('-')[0x0];if(!_[_0x29f9('0x21')](members[_0x133f64])){members[_0x133f64]=_[_0x29f9('0x28')](members[_0x133f64],{'data1':members[_0x133f64][_0x29f9('0x29')]||_0x4097a8['type'],'data2':members[_0x133f64][_0x29f9('0x2a')]||_0x4097a8[_0x29f9('0x2b')],'data3':members[_0x133f64]['data3']||_0x4097a8['destination'],'uniqueid':members[_0x133f64][_0x29f9('0x8')]||_0x4097a8[_0x29f9('0x8')]});if(members[_0x133f64][_0x29f9('0x22')]){writeDB(members[_0x133f64]);}}}if(_0x4097a8[_0x29f9('0x2c')]){var _0x2c199b=_0x4097a8['destinationchannel'][_0x29f9('0x14')]('-')[0x0];if(!_[_0x29f9('0x21')](members[_0x2c199b])){members[_0x2c199b]=_['assign'](members[_0x2c199b],{'data1':members[_0x2c199b][_0x29f9('0x29')]||_0x4097a8['type'],'data2':members[_0x2c199b][_0x29f9('0x2a')]||_0x4097a8[_0x29f9('0x2b')],'data3':members[_0x2c199b][_0x29f9('0x2d')]||_0x4097a8[_0x29f9('0x2e')],'uniqueid':members[_0x2c199b][_0x29f9('0x8')]||_0x4097a8['uniqueid']});if(members[_0x2c199b][_0x29f9('0x22')]){writeDB(members[_0x2c199b]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 01535db..adf033f 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 _0x163d=['transfertargetlinkedid','queuecallerenterreason','clone','musiconholdstart','musiconholdstartAt','musiconholdstop','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','uniqueid','assign','position','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','varset','variable','queuestatus','value','CONTINUE','queuecallerexitAt','queuecallerabandonAt','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','membername','lastAssignedTo','queuecallercompleteAt','transfer','TRANSFER','reason','toUpperCase','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x163d,0xea));var _0xd163=function(_0x21cec0,_0x31be6c){_0x21cec0=_0x21cec0-0x0;var _0x1c1cf1=_0x163d[_0x21cec0];return _0x1c1cf1;};'use strict';var _=require('lodash');var util=require(_0xd163('0x0'));var utils=require(_0xd163('0x1'));var queues={};function writeDB(_0x106e00){utils[_0xd163('0x2')](util[_0xd163('0x3')](_0xd163('0x4'),_0x106e00['uniqueid'],_0x106e00[_0xd163('0x5')],_0x106e00[_0xd163('0x6')],_0x106e00['lastAssignedTo'],_0x106e00[_0xd163('0x7')],_0x106e00[_0xd163('0x8')],_0x106e00['queuecallerexitreason']));if(_0x106e00[_0xd163('0x6')]){utils['getVoiceQueueByName'](_0x106e00['queue'])[_0xd163('0x9')](function(_0x4e45fe){if(_0x4e45fe){_0x106e00[_0xd163('0xa')]=_0x4e45fe['type'];}utils[_0xd163('0xb')]('CreateVoiceQueueReport',_0x106e00);});}else{utils['request'](_0xd163('0xc'),_0x106e00);}if(_0x106e00[_0xd163('0xd')]){delete queues[_0x106e00[_0xd163('0xd')]];}else{delete queues[_0x106e00['uniqueid']];}}exports[_0xd163('0xe')]=function(_0x5529b4){queues[_0x5529b4[_0xd163('0xf')]]=_[_0xd163('0x10')](_0x5529b4,{'originalposition':_0x5529b4[_0xd163('0x11')],'queuecallerjoinAt':utils[_0xd163('0x12')](),'mohtime':0x0});};exports['hangup']=function(_0x9c48b6){if(!_[_0xd163('0x13')](queues[_0x9c48b6[_0xd163('0xf')]])){if(queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x14')]){if(!queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x15')]&&!queues[_0x9c48b6['uniqueid']][_0xd163('0x16')]){queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x17')]=!![];queues[_0x9c48b6['uniqueid']]['queuecallercompleteAt']=utils[_0xd163('0x12')]();queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x19');}writeDB(queues[_0x9c48b6[_0xd163('0xf')]]);}else{if(queues[_0x9c48b6['uniqueid']][_0xd163('0xd')]){queues[queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0xd')]]=queues[_0x9c48b6['uniqueid']];queues[queues[_0x9c48b6[_0xd163('0xf')]][_0xd163('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x9c48b6[_0xd163('0xf')]];}}}};exports[_0xd163('0x1a')]=function(_0x320f50){if(!_[_0xd163('0x13')](_0x320f50[_0xd163('0x1b')][_0xd163('0x1c')])&&_0x320f50[_0xd163('0x1d')]['toUpperCase']()!==_0xd163('0x1e')){if(!_[_0xd163('0x13')](queues[_0x320f50['uniqueid']])){queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x320f50[_0xd163('0xf')]]['queuecallerabandonAt']=null;queues[_0x320f50['uniqueid']][_0xd163('0x16')]=!![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x1f')]=utils[_0xd163('0x12')]();queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x18')]=_0x320f50[_0xd163('0x1d')]['toUpperCase']();writeDB(queues[_0x320f50[_0xd163('0xf')]]);}}else if(!_[_0xd163('0x13')](_0x320f50[_0xd163('0x1b')]['queueposition'])){if(!_[_0xd163('0x13')](queues[_0x320f50[_0xd163('0xf')]])&&!queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x15')]){queues[_0x320f50[_0xd163('0xf')]]['queuecallerabandon']=![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x16')]=!![];queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x1f')]=utils[_0xd163('0x12')]();queues[_0x320f50[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x21');}}};exports[_0xd163('0x15')]=function(_0x3542fc){if(!_['isNil'](queues[_0x3542fc[_0xd163('0xf')]])){queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x1f')]=null;queues[_0x3542fc['uniqueid']]['queuecallerabandon']=!![];queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x20')]=utils[_0xd163('0x12')]();queues[_0x3542fc[_0xd163('0xf')]][_0xd163('0x18')]='ABANDONED';}};exports[_0xd163('0x22')]=function(_0x30828e){if(!_[_0xd163('0x13')](queues[_0x30828e[_0xd163('0xf')]])){queues[_0x30828e[_0xd163('0xf')]]['queuecallerleave']=!![];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x14')]=utils[_0xd163('0x12')]();queues[_0x30828e['uniqueid']][_0xd163('0x23')]=utils[_0xd163('0x24')](queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x14')],queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x25')]);queues[_0x30828e['uniqueid']][_0xd163('0x11')]=_0x30828e[_0xd163('0x11')];queues[_0x30828e['uniqueid']]['count']=_0x30828e[_0xd163('0x26')];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x27')]=_0x30828e[_0xd163('0x27')];queues[_0x30828e[_0xd163('0xf')]][_0xd163('0x28')]=_0x30828e[_0xd163('0x28')];}};exports[_0xd163('0x29')]=function(_0x57d9e5){if(!_['isNil'](queues[_0x57d9e5['uniqueid']])){queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x57d9e5['uniqueid']][_0xd163('0x18')]=null;queues[_0x57d9e5['uniqueid']][_0xd163('0x1f')]=null;queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x2a')]=!![];queues[_0x57d9e5[_0xd163('0xf')]][_0xd163('0x8')]=_0x57d9e5[_0xd163('0x2b')];queues[_0x57d9e5[_0xd163('0xf')]]['lastAssignedTo']=_0x57d9e5[_0xd163('0x2c')];}};exports['agentcomplete']=function(_0x567bb0){if(!_[_0xd163('0x13')](queues[_0x567bb0[_0xd163('0xf')]])){if(queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x14')]){queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x15')]=![];queues[_0x567bb0['uniqueid']]['queuecallerabandon']=![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x20')]=null;queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x16')]=![];queues[_0x567bb0['uniqueid']][_0xd163('0x1f')]=null;queues[_0x567bb0['uniqueid']][_0xd163('0x2a')]=!![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x2d')]=_0x567bb0[_0xd163('0x2c')];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x17')]=!![];queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x2e')]=utils[_0xd163('0x12')]();if(_0x567bb0['reason']=='transfer'){if(!queues[_0x567bb0['uniqueid']][_0xd163('0x2f')]){queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x18')]=_0xd163('0x30');}}else{queues[_0x567bb0[_0xd163('0xf')]][_0xd163('0x18')]='COMPLETEDBY'+_0x567bb0[_0xd163('0x31')][_0xd163('0x32')]();}writeDB(queues[_0x567bb0[_0xd163('0xf')]]);}}};exports[_0xd163('0x33')]=function(_0x123993){if(!_[_0xd163('0x13')](queues[_0x123993[_0xd163('0x34')]])){queues[_0x123993['transfereeuniqueid']][_0xd163('0x2f')]=!![];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x35')]=_0xd163('0x36');queues[_0x123993[_0xd163('0x34')]][_0xd163('0x37')]=_0x123993[_0xd163('0x38')];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x39')]=_0x123993[_0xd163('0x34')];queues[_0x123993[_0xd163('0x34')]][_0xd163('0x18')]=_0xd163('0x3a');}};exports[_0xd163('0x3b')]=function(_0x3005e0){try{if(_0x3005e0[_0xd163('0x3c')]==_0x3005e0[_0xd163('0x3d')]){if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3e')]])){queues[_0x3005e0['secondtransfererlinkedid']][_0xd163('0x2f')]=!![];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x35')]=_0xd163('0x3f');queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x37')]=_0x3005e0['origtransfererexten'];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x39')]=_0x3005e0['origtransfereruniqueid'];queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x18')]=_0xd163('0x40');}if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3d')]])){if(_0x3005e0['transfereelinkedid']&&queues[_0x3005e0[_0xd163('0x41')]]){queues[_0x3005e0['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3005e0['transfereeuniqueid']]=_['clone'](queues[_0x3005e0['transfereelinkedid']]);queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x42')];queues[_0x3005e0['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3005e0['transfereeuniqueid']][_0xd163('0x7')]=queues[_0x3005e0[_0xd163('0x3e')]][_0xd163('0x7')];queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x43')]=queues[_0x3005e0['secondtransfererlinkedid']][_0xd163('0x43')];queues[_0x3005e0['transfereeuniqueid']][_0xd163('0x25')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x14')]=utils['now']();queues[_0x3005e0[_0xd163('0x34')]]['holdtime']=0x0;queues[_0x3005e0[_0xd163('0x34')]][_0xd163('0x44')]=0x0;}else{queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x3e')];}}}else if(_0x3005e0[_0xd163('0x45')]==_0x3005e0[_0xd163('0x3e')]){if(!_[_0xd163('0x13')](queues[_0x3005e0[_0xd163('0x3d')]])){queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x2f')]=!![];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x35')]='ATTENDED';queues[_0x3005e0[_0xd163('0x3d')]]['transferexten']=_0x3005e0['secondtransfererexten'];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x39')]=_0x3005e0[_0xd163('0x45')];queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x18')]=_0xd163('0x40');}if(!_['isNil'](queues[_0x3005e0[_0xd163('0x3e')]])){if(_0x3005e0[_0xd163('0x46')]&&queues[_0x3005e0[_0xd163('0x46')]]){queues[_0x3005e0[_0xd163('0x46')]][_0xd163('0x47')]=0x1;queues[_0x3005e0[_0xd163('0x42')]]=_[_0xd163('0x48')](queues[_0x3005e0[_0xd163('0x46')]]);queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0xd')]=_0x3005e0[_0xd163('0x42')];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x47')]=0x2;queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x7')]=queues[_0x3005e0[_0xd163('0x3d')]]['calleridnum'];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x43')]=queues[_0x3005e0[_0xd163('0x3d')]][_0xd163('0x43')];queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x25')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x14')]=utils[_0xd163('0x12')]();queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x23')]=0x0;queues[_0x3005e0[_0xd163('0x42')]][_0xd163('0x44')]=0x0;}else{queues[_0x3005e0[_0xd163('0x3e')]]['transfereduniqueid']=_0x3005e0[_0xd163('0x3d')];}}}}catch(_0x1c6889){utils['error'](_0x1c6889['stack']);}};exports[_0xd163('0x49')]=function(_0x360b13){if(!_['isNil'](queues[_0x360b13[_0xd163('0xf')]])){queues[_0x360b13[_0xd163('0xf')]][_0xd163('0x4a')]=utils['now']();}};exports[_0xd163('0x4b')]=function(_0x3d4542){if(!_[_0xd163('0x13')](queues[_0x3d4542[_0xd163('0xf')]])){if(!_[_0xd163('0x13')](queues[_0x3d4542['uniqueid']][_0xd163('0x4a')])){queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x44')]+=utils[_0xd163('0x24')](utils[_0xd163('0x12')](),queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x4a')]);delete queues[_0x3d4542[_0xd163('0xf')]][_0xd163('0x4a')];}}}; \ No newline at end of file +var _0xfa9e=['origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','stack','musiconholdstartAt','./utils','format','uniqueid','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','assign','position','now','hangup','queuecallerabandon','queuecallercompleteAt','queuecallerenterreason','queuestatus','value','toUpperCase','CONTINUE','isNil','queuecallerabandonAt','variable','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','destaccountcode','lastAssignedTo','membername','agentcomplete','queuecallerexit','assigned','queuecallercomplete','transfer','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0xfa9e,0x12d));var _0xefa9=function(_0xe5c0a,_0x19039a){_0xe5c0a=_0xe5c0a-0x0;var _0x110404=_0xfa9e[_0xe5c0a];return _0x110404;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xefa9('0x0'));var queues={};function writeDB(_0x2aa582){utils['info'](util[_0xefa9('0x1')]('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x2aa582[_0xefa9('0x2')],_0x2aa582['channel'],_0x2aa582['queue'],_0x2aa582['lastAssignedTo'],_0x2aa582['calleridnum'],_0x2aa582[_0xefa9('0x3')],_0x2aa582[_0xefa9('0x4')]));if(_0x2aa582[_0xefa9('0x5')]){utils[_0xefa9('0x6')](_0x2aa582[_0xefa9('0x5')])[_0xefa9('0x7')](function(_0x33f216){if(_0x33f216){_0x2aa582[_0xefa9('0x8')]=_0x33f216[_0xefa9('0x8')];}utils[_0xefa9('0x9')](_0xefa9('0xa'),_0x2aa582);});}else{utils[_0xefa9('0x9')]('CreateVoiceQueueReport',_0x2aa582);}if(_0x2aa582[_0xefa9('0xb')]){delete queues[_0x2aa582[_0xefa9('0xb')]];}else{delete queues[_0x2aa582[_0xefa9('0x2')]];}}exports['queuecallerjoin']=function(_0x2e5640){queues[_0x2e5640[_0xefa9('0x2')]]=_[_0xefa9('0xc')](_0x2e5640,{'originalposition':_0x2e5640[_0xefa9('0xd')],'queuecallerjoinAt':utils[_0xefa9('0xe')](),'mohtime':0x0});};exports[_0xefa9('0xf')]=function(_0x511107){if(!_['isNil'](queues[_0x511107[_0xefa9('0x2')]])){if(queues[_0x511107[_0xefa9('0x2')]]['queuecallerleaveAt']){if(!queues[_0x511107[_0xefa9('0x2')]][_0xefa9('0x10')]&&!queues[_0x511107[_0xefa9('0x2')]]['queuecallerexit']){queues[_0x511107['uniqueid']]['queuecallercomplete']=!![];queues[_0x511107[_0xefa9('0x2')]][_0xefa9('0x11')]=utils['now']();queues[_0x511107[_0xefa9('0x2')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x511107[_0xefa9('0x2')]]);}else{if(queues[_0x511107[_0xefa9('0x2')]]['transfereduniqueid']){queues[queues[_0x511107[_0xefa9('0x2')]][_0xefa9('0xb')]]=queues[_0x511107['uniqueid']];queues[queues[_0x511107[_0xefa9('0x2')]]['transfereduniqueid']][_0xefa9('0x12')]=0x2;delete queues[_0x511107[_0xefa9('0x2')]];}}}};exports['varset']=function(_0x271519){if(!_['isNil'](_0x271519['variable'][_0xefa9('0x13')])&&_0x271519[_0xefa9('0x14')][_0xefa9('0x15')]()!==_0xefa9('0x16')){if(!_[_0xefa9('0x17')](queues[_0x271519['uniqueid']])){queues[_0x271519[_0xefa9('0x2')]][_0xefa9('0x10')]=![];queues[_0x271519['uniqueid']][_0xefa9('0x18')]=null;queues[_0x271519[_0xefa9('0x2')]]['queuecallerexit']=!![];queues[_0x271519['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x271519[_0xefa9('0x2')]][_0xefa9('0x4')]=_0x271519[_0xefa9('0x14')][_0xefa9('0x15')]();writeDB(queues[_0x271519[_0xefa9('0x2')]]);}}else if(!_['isNil'](_0x271519[_0xefa9('0x19')][_0xefa9('0x1a')])){if(!_[_0xefa9('0x17')](queues[_0x271519[_0xefa9('0x2')]])&&!queues[_0x271519[_0xefa9('0x2')]]['queuecallerabandon']){queues[_0x271519[_0xefa9('0x2')]]['queuecallerabandon']=![];queues[_0x271519[_0xefa9('0x2')]]['queuecallerabandonAt']=null;queues[_0x271519[_0xefa9('0x2')]]['queuecallerexit']=!![];queues[_0x271519[_0xefa9('0x2')]][_0xefa9('0x1b')]=utils['now']();queues[_0x271519['uniqueid']]['queuecallerexitreason']=_0xefa9('0x1c');}}};exports[_0xefa9('0x10')]=function(_0x22d4cd){if(!_[_0xefa9('0x17')](queues[_0x22d4cd['uniqueid']])){queues[_0x22d4cd[_0xefa9('0x2')]]['queuecallerexit']=![];queues[_0x22d4cd['uniqueid']]['queuecallerexitAt']=null;queues[_0x22d4cd[_0xefa9('0x2')]][_0xefa9('0x10')]=!![];queues[_0x22d4cd[_0xefa9('0x2')]][_0xefa9('0x18')]=utils[_0xefa9('0xe')]();queues[_0x22d4cd[_0xefa9('0x2')]][_0xefa9('0x4')]=_0xefa9('0x1d');}};exports[_0xefa9('0x1e')]=function(_0x5367ac){if(!_['isNil'](queues[_0x5367ac['uniqueid']])){queues[_0x5367ac['uniqueid']][_0xefa9('0x1e')]=!![];queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x1f')]=utils['now']();queues[_0x5367ac['uniqueid']][_0xefa9('0x20')]=utils[_0xefa9('0x21')](queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x1f')],queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x22')]);queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0xd')]=_0x5367ac[_0xefa9('0xd')];queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x23')]=_0x5367ac[_0xefa9('0x23')];queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x24')]=_0x5367ac['connectedlinenum'];queues[_0x5367ac[_0xefa9('0x2')]][_0xefa9('0x25')]=_0x5367ac[_0xefa9('0x25')];}};exports['agentconnect']=function(_0x29f635){if(!_[_0xefa9('0x17')](queues[_0x29f635['uniqueid']])){queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x10')]=![];queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x10')]=![];queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x18')]=null;queues[_0x29f635[_0xefa9('0x2')]]['queuecallerexit']=![];queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x4')]=null;queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x1b')]=null;queues[_0x29f635[_0xefa9('0x2')]]['assigned']=!![];queues[_0x29f635['uniqueid']][_0xefa9('0x3')]=_0x29f635[_0xefa9('0x26')];queues[_0x29f635[_0xefa9('0x2')]][_0xefa9('0x27')]=_0x29f635[_0xefa9('0x28')];}};exports[_0xefa9('0x29')]=function(_0x90ef41){if(!_[_0xefa9('0x17')](queues[_0x90ef41[_0xefa9('0x2')]])){if(queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x1f')]){queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x10')]=![];queues[_0x90ef41[_0xefa9('0x2')]]['queuecallerabandon']=![];queues[_0x90ef41['uniqueid']][_0xefa9('0x18')]=null;queues[_0x90ef41['uniqueid']][_0xefa9('0x2a')]=![];queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x1b')]=null;queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x2b')]=!![];queues[_0x90ef41['uniqueid']][_0xefa9('0x27')]=_0x90ef41[_0xefa9('0x28')];queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x2c')]=!![];queues[_0x90ef41['uniqueid']][_0xefa9('0x11')]=utils['now']();if(_0x90ef41['reason']==_0xefa9('0x2d')){if(!queues[_0x90ef41[_0xefa9('0x2')]][_0xefa9('0x2d')]){queues[_0x90ef41[_0xefa9('0x2')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x90ef41[_0xefa9('0x2')]]['queuecallerexitreason']='COMPLETEDBY'+_0x90ef41[_0xefa9('0x2e')][_0xefa9('0x15')]();}writeDB(queues[_0x90ef41[_0xefa9('0x2')]]);}}};exports[_0xefa9('0x2f')]=function(_0x2ea26a){if(!_[_0xefa9('0x17')](queues[_0x2ea26a[_0xefa9('0x30')]])){queues[_0x2ea26a[_0xefa9('0x30')]][_0xefa9('0x2d')]=!![];queues[_0x2ea26a[_0xefa9('0x30')]][_0xefa9('0x31')]=_0xefa9('0x32');queues[_0x2ea26a['transfereeuniqueid']][_0xefa9('0x33')]=_0x2ea26a[_0xefa9('0x34')];queues[_0x2ea26a[_0xefa9('0x30')]][_0xefa9('0x35')]=_0x2ea26a[_0xefa9('0x30')];queues[_0x2ea26a[_0xefa9('0x30')]][_0xefa9('0x4')]='BLINDTRANSFER';}};exports[_0xefa9('0x36')]=function(_0x472e15){try{if(_0x472e15[_0xefa9('0x37')]==_0x472e15[_0xefa9('0x38')]){if(!_[_0xefa9('0x17')](queues[_0x472e15[_0xefa9('0x39')]])){queues[_0x472e15[_0xefa9('0x39')]][_0xefa9('0x2d')]=!![];queues[_0x472e15['secondtransfererlinkedid']][_0xefa9('0x31')]=_0xefa9('0x3a');queues[_0x472e15['secondtransfererlinkedid']]['transferexten']=_0x472e15[_0xefa9('0x3b')];queues[_0x472e15[_0xefa9('0x39')]][_0xefa9('0x35')]=_0x472e15[_0xefa9('0x37')];queues[_0x472e15[_0xefa9('0x39')]][_0xefa9('0x4')]=_0xefa9('0x3c');}if(!_[_0xefa9('0x17')](queues[_0x472e15[_0xefa9('0x38')]])){if(_0x472e15[_0xefa9('0x3d')]&&queues[_0x472e15[_0xefa9('0x3d')]]){queues[_0x472e15['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x472e15[_0xefa9('0x30')]]=_[_0xefa9('0x3e')](queues[_0x472e15['transfereelinkedid']]);queues[_0x472e15['transfereeuniqueid']][_0xefa9('0xb')]=_0x472e15[_0xefa9('0x3f')];queues[_0x472e15[_0xefa9('0x30')]][_0xefa9('0x12')]=0x2;queues[_0x472e15['transfereeuniqueid']][_0xefa9('0x40')]=queues[_0x472e15['secondtransfererlinkedid']][_0xefa9('0x40')];queues[_0x472e15[_0xefa9('0x30')]][_0xefa9('0x41')]=queues[_0x472e15[_0xefa9('0x39')]][_0xefa9('0x41')];queues[_0x472e15['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xefa9('0xe')]();queues[_0x472e15['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0xefa9('0xe')]();queues[_0x472e15[_0xefa9('0x30')]]['holdtime']=0x0;queues[_0x472e15[_0xefa9('0x30')]]['mohtime']=0x0;}else{queues[_0x472e15[_0xefa9('0x38')]][_0xefa9('0xb')]=_0x472e15[_0xefa9('0x39')];}}}else if(_0x472e15[_0xefa9('0x42')]==_0x472e15[_0xefa9('0x39')]){if(!_[_0xefa9('0x17')](queues[_0x472e15['origtransfererlinkedid']])){queues[_0x472e15[_0xefa9('0x38')]][_0xefa9('0x2d')]=!![];queues[_0x472e15[_0xefa9('0x38')]][_0xefa9('0x31')]=_0xefa9('0x3a');queues[_0x472e15[_0xefa9('0x38')]][_0xefa9('0x33')]=_0x472e15[_0xefa9('0x43')];queues[_0x472e15['origtransfererlinkedid']]['transferuniqueid']=_0x472e15[_0xefa9('0x42')];queues[_0x472e15['origtransfererlinkedid']][_0xefa9('0x4')]=_0xefa9('0x3c');}if(!_[_0xefa9('0x17')](queues[_0x472e15['secondtransfererlinkedid']])){if(_0x472e15['transfertargetlinkedid']&&queues[_0x472e15[_0xefa9('0x44')]]){queues[_0x472e15[_0xefa9('0x44')]][_0xefa9('0x12')]=0x1;queues[_0x472e15['transfertargetuniqueid']]=_[_0xefa9('0x3e')](queues[_0x472e15['transfertargetlinkedid']]);queues[_0x472e15[_0xefa9('0x3f')]][_0xefa9('0xb')]=_0x472e15[_0xefa9('0x3f')];queues[_0x472e15[_0xefa9('0x3f')]]['queuecallerenterreason']=0x2;queues[_0x472e15[_0xefa9('0x3f')]][_0xefa9('0x40')]=queues[_0x472e15[_0xefa9('0x38')]][_0xefa9('0x40')];queues[_0x472e15[_0xefa9('0x3f')]][_0xefa9('0x41')]=queues[_0x472e15[_0xefa9('0x38')]]['calleridname'];queues[_0x472e15[_0xefa9('0x3f')]]['queuecallerjoinAt']=utils[_0xefa9('0xe')]();queues[_0x472e15['transfertargetuniqueid']][_0xefa9('0x1f')]=utils[_0xefa9('0xe')]();queues[_0x472e15[_0xefa9('0x3f')]][_0xefa9('0x20')]=0x0;queues[_0x472e15[_0xefa9('0x3f')]][_0xefa9('0x45')]=0x0;}else{queues[_0x472e15[_0xefa9('0x39')]][_0xefa9('0xb')]=_0x472e15['origtransfererlinkedid'];}}}}catch(_0x1b56f0){utils['error'](_0x1b56f0[_0xefa9('0x46')]);}};exports['musiconholdstart']=function(_0x4d3359){if(!_[_0xefa9('0x17')](queues[_0x4d3359[_0xefa9('0x2')]])){queues[_0x4d3359['uniqueid']][_0xefa9('0x47')]=utils[_0xefa9('0xe')]();}};exports['musiconholdstop']=function(_0x4d502e){if(!_[_0xefa9('0x17')](queues[_0x4d502e['uniqueid']])){if(!_['isNil'](queues[_0x4d502e[_0xefa9('0x2')]]['musiconholdstartAt'])){queues[_0x4d502e[_0xefa9('0x2')]][_0xefa9('0x45')]+=utils[_0xefa9('0x21')](utils[_0xefa9('0xe')](),queues[_0x4d502e[_0xefa9('0x2')]][_0xefa9('0x47')]);delete queues[_0x4d502e[_0xefa9('0x2')]][_0xefa9('0x47')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 57e54b7..c2513a3 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 _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x34e8,0x12c));var _0x834e=function(_0x53ddfa,_0x7048){_0x53ddfa=_0x53ddfa-0x0;var _0x175052=_0x34e8[_0x53ddfa];return _0x175052;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file +var _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x3e3a3d,_0x1552ba){var _0x377d10=function(_0x1ffec6){while(--_0x1ffec6){_0x3e3a3d['push'](_0x3e3a3d['shift']());}};_0x377d10(++_0x1552ba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xcb91[_0x1db251];return _0x56685a;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f3baea5..855ad59 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 _0x4be6=['transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','stack','attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4be6,0xb5));var _0x64be=function(_0x302099,_0xe61dca){_0x302099=_0x302099-0x0;var _0x24a042=_0x4be6[_0x302099];return _0x24a042;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var utils=require(_0x64be('0x1'));function writeDB(_0x22ef48){utils[_0x64be('0x2')](util[_0x64be('0x3')](_0x64be('0x4'),_0x22ef48[_0x64be('0x5')]));utils[_0x64be('0x6')](_0x64be('0x7'),_0x22ef48);}exports[_0x64be('0x8')]=function(_0x56f0c3){try{_0x56f0c3[_0x64be('0x5')]=_0x64be('0x9');writeDB(_0x56f0c3);}catch(_0x3e8639){utils['error'](_0x3e8639[_0x64be('0xa')]);}};exports[_0x64be('0xb')]=function(_0x50d57f){try{_0x50d57f=_[_0x64be('0xc')](_0x50d57f,{'transfererchannel':_0x50d57f['origtransfererchannel'],'transferercalleridnum':_0x50d57f[_0x64be('0xd')],'transferercalleridname':_0x50d57f[_0x64be('0xe')],'transfererconnectedlinenum':_0x50d57f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x50d57f[_0x64be('0xf')],'transfereraccountcode':_0x50d57f[_0x64be('0x10')],'transferercontext':_0x50d57f[_0x64be('0x11')],'transfererexten':_0x50d57f[_0x64be('0x12')],'transfererlinkedid':_0x50d57f['origtransfererlinkedid'],'context':_0x50d57f[_0x64be('0x13')],'extension':_0x50d57f['origtransfererexten'],'type':_0x64be('0x14')});if(_[_0x64be('0x15')](_0x50d57f[_0x64be('0x16')])){_0x50d57f=_[_0x64be('0xc')](_0x50d57f,{'transfereechannel':_0x50d57f[_0x64be('0x17')],'transfereecalleridnum':_0x50d57f['transfertargetcalleridnum'],'transfereecalleridname':_0x50d57f[_0x64be('0x18')],'transfereeconnectedlinenum':_0x50d57f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x50d57f[_0x64be('0x19')],'transfereeaccountcode':_0x50d57f[_0x64be('0x1a')],'transfereecontext':_0x50d57f[_0x64be('0x1b')],'transfereeexten':_0x50d57f[_0x64be('0x1c')],'transfereelinkedid':_0x50d57f[_0x64be('0x1d')]});}writeDB(_0x50d57f);}catch(_0x507bca){utils['error'](_0x507bca[_0x64be('0xa')]);}}; \ No newline at end of file +var _0x8781=['origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','TRANSFER|%s','request','CreateVoiceTransferReport','blindtransfer','type','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x533ffd,_0x547e7b){var _0x1069f5=function(_0x580224){while(--_0x580224){_0x533ffd['push'](_0x533ffd['shift']());}};_0x1069f5(++_0x547e7b);}(_0x8781,0x1c8));var _0x1878=function(_0x50887a,_0x3c75b3){_0x50887a=_0x50887a-0x0;var _0x5794f3=_0x8781[_0x50887a];return _0x5794f3;};'use strict';var _=require(_0x1878('0x0'));var util=require(_0x1878('0x1'));var utils=require(_0x1878('0x2'));function writeDB(_0x1884a3){utils[_0x1878('0x3')](util[_0x1878('0x4')](_0x1878('0x5'),_0x1884a3['type']));utils[_0x1878('0x6')](_0x1878('0x7'),_0x1884a3);}exports[_0x1878('0x8')]=function(_0x43ad96){try{_0x43ad96[_0x1878('0x9')]=_0x1878('0xa');writeDB(_0x43ad96);}catch(_0x4d2374){utils[_0x1878('0xb')](_0x4d2374[_0x1878('0xc')]);}};exports[_0x1878('0xd')]=function(_0x46cd98){try{_0x46cd98=_[_0x1878('0xe')](_0x46cd98,{'transfererchannel':_0x46cd98[_0x1878('0xf')],'transferercalleridnum':_0x46cd98[_0x1878('0x10')],'transferercalleridname':_0x46cd98[_0x1878('0x11')],'transfererconnectedlinenum':_0x46cd98[_0x1878('0x12')],'transfererconnectedlinename':_0x46cd98[_0x1878('0x13')],'transfereraccountcode':_0x46cd98[_0x1878('0x14')],'transferercontext':_0x46cd98['secondtransferercontext'],'transfererexten':_0x46cd98[_0x1878('0x15')],'transfererlinkedid':_0x46cd98[_0x1878('0x16')],'context':_0x46cd98[_0x1878('0x17')],'extension':_0x46cd98[_0x1878('0x18')],'type':'attended'});if(_['isNil'](_0x46cd98[_0x1878('0x19')])){_0x46cd98=_[_0x1878('0xe')](_0x46cd98,{'transfereechannel':_0x46cd98[_0x1878('0x1a')],'transfereecalleridnum':_0x46cd98[_0x1878('0x1b')],'transfereecalleridname':_0x46cd98['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x46cd98['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x46cd98[_0x1878('0x1c')],'transfereeaccountcode':_0x46cd98[_0x1878('0x1d')],'transfereecontext':_0x46cd98['transfertargetcontext'],'transfereeexten':_0x46cd98[_0x1878('0x1e')],'transfereelinkedid':_0x46cd98[_0x1878('0x1f')]});}writeDB(_0x46cd98);}catch(_0xb324ba){utils['error'](_0xb324ba['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3638f2f..2bf0c22 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 _0xd840=['catch','internal','name','interface','then','GETUSER|','stringify','length','FOUND','NOTFOUND','result','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','GETVOICEQUEUEBYNAME|','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diff','sumTime','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','info','debug','error','stack','request'];(function(_0x49933b,_0xf55e90){var _0xe9b5c0=function(_0x389ef3){while(--_0x389ef3){_0x49933b['push'](_0x49933b['shift']());}};_0xe9b5c0(++_0xf55e90);}(_0xd840,0x1be));var _0x0d84=function(_0x5a09db,_0x41a70c){_0x5a09db=_0x5a09db-0x0;var _0x3f722a=_0xd840[_0x5a09db];return _0x3f722a;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0d84('0x0'));var BPromise=require(_0x0d84('0x1'));var client=jayson[_0x0d84('0x2')][_0x0d84('0x3')]({'port':0x2329});var logger=require(_0x0d84('0x4'))('xdr');exports[_0x0d84('0x5')]=function(_0x1ce2f4){logger['info'](_0x1ce2f4);};exports['debug']=function(_0x54484f){logger[_0x0d84('0x6')](JSON['stringify'](_0x54484f));};exports[_0x0d84('0x7')]=function(_0x36bc7e){logger[_0x0d84('0x7')](_0x36bc7e[_0x0d84('0x8')]);};exports[_0x0d84('0x9')]=function(_0x4afede,_0x4bbd86){return client[_0x0d84('0x9')](_0x4afede,{'body':_0x4bbd86})['then'](function(_0x5674b0){logger[_0x0d84('0x6')](JSON['stringify'](_0x5674b0));})[_0x0d84('0xa')](function(_0x2e2474){logger[_0x0d84('0x7')](_0x2e2474['stack']);});};function getUser(_0x17e946){return client[_0x0d84('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0d84('0xb'),_0x0d84('0xc'),_0x0d84('0xd')],'where':_0x17e946,'limit':0x1}})[_0x0d84('0xe')](function(_0x323a22){logger[_0x0d84('0x5')](_0x0d84('0xf')+JSON[_0x0d84('0x10')](_0x17e946)+'|'+(_0x323a22['result'][_0x0d84('0x11')]?_0x0d84('0x12'):_0x0d84('0x13')));return _0x323a22[_0x0d84('0x14')]['length']?_0x323a22[_0x0d84('0x14')][0x0]:null;});}exports[_0x0d84('0x15')]=function(_0x348511){return new BPromise(function(_0x38f2d7,_0x263886){if(_0x348511){return getUser({'internal':_0x348511})[_0x0d84('0xe')](function(_0x20294f){return _0x38f2d7(_0x20294f);})['catch'](function(_0x3d6c2a){logger['error'](_0x3d6c2a['stack']);return _0x38f2d7(null);});}else{return _0x38f2d7(null);}});};exports[_0x0d84('0x16')]=function(_0x5e3957){return new BPromise(function(_0x186b36,_0x235afb){if(_0x5e3957){return getUser({'interface':_0x5e3957})['then'](function(_0x11789e){return _0x186b36(_0x11789e);})[_0x0d84('0xa')](function(_0x2e7956){logger[_0x0d84('0x7')](_0x2e7956[_0x0d84('0x8')]);return _0x186b36(null);});}else{return _0x186b36(null);}});};exports[_0x0d84('0x17')]=function(_0x51068c){return new BPromise(function(_0x12edcb,_0x1c02c1){if(_0x51068c){return getUser({'name':_0x51068c})[_0x0d84('0xe')](function(_0x999c9c){return _0x12edcb(_0x999c9c);})[_0x0d84('0xa')](function(_0x1e323c){logger[_0x0d84('0x7')](_0x1e323c['stack']);return _0x12edcb(null);});}else{return _0x12edcb(null);}});};exports['getVoiceQueueByName']=function(_0x18644a){return new BPromise(function(_0x1141d8,_0x3c2a82){if(_0x18644a){return client['request'](_0x0d84('0x18'),{'options':{'raw':!![],'attributes':['id',_0x0d84('0xc'),_0x0d84('0x19'),_0x0d84('0x1a'),'acwTimeout'],'where':{'name':_0x18644a},'limit':0x1}})['then'](function(_0x305ecb){logger[_0x0d84('0x5')](_0x0d84('0x1b')+_0x18644a+'|'+(_0x305ecb['result']['length']?_0x0d84('0x12'):_0x0d84('0x13')));return _0x1141d8(_0x305ecb[_0x0d84('0x14')][_0x0d84('0x11')]?_0x305ecb[_0x0d84('0x14')][0x0]:null);})[_0x0d84('0xa')](function(_0x491c6c){logger[_0x0d84('0x7')](_0x491c6c[_0x0d84('0x8')]);return _0x1141d8(null);});}else{return _0x1141d8(null);}});};exports['addTime']=function(_0x3e6625,_0x5a6274){return moment(_0x3e6625)[_0x0d84('0x1c')](_0x5a6274,'seconds')[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports[_0x0d84('0x1f')]=function(_0x5e9316,_0x425da6){return moment(_0x5e9316)[_0x0d84('0x20')](_0x425da6,_0x0d84('0x21'))[_0x0d84('0x1d')](_0x0d84('0x1e'));};exports['diffTime']=function(_0xc1ff69,_0x44e08b){return moment(_0xc1ff69)[_0x0d84('0x22')](moment(_0x44e08b),'seconds');};exports[_0x0d84('0x23')]=function(_0x32f52a,_0x5e30d2){return parseInt(_0x32f52a,0xa)+parseInt(_0x5e30d2,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0d84('0x24')]=function(_0x566595,_0x79b554){if(_0x79b554){return moment(_0x566595)[_0x0d84('0x24')](_0x79b554);}else{return!![];}};exports[_0x0d84('0x25')]=function(_0x5d324f,_0x540372){if(_0x540372){return moment(_0x5d324f)[_0x0d84('0x25')](_0x540372);}else if(_0x5d324f){return!![];}else{return![];}}; \ No newline at end of file +var _0x96fa=['request','catch','GetUser','internal','name','interface','then','result','length','FOUND','getUserByInternal','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','isAfter','isBefore','jayson/promise','moment','bluebird','client','../../config/logger','info','debug','stringify','error','stack'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x96fa,0x1f1));var _0xa96f=function(_0x4903d4,_0x4f9f76){_0x4903d4=_0x4903d4-0x0;var _0x2a1f93=_0x96fa[_0x4903d4];return _0x2a1f93;};'use strict';var jayson=require(_0xa96f('0x0'));var moment=require(_0xa96f('0x1'));var BPromise=require(_0xa96f('0x2'));var client=jayson[_0xa96f('0x3')]['http']({'port':0x2329});var logger=require(_0xa96f('0x4'))('xdr');exports[_0xa96f('0x5')]=function(_0x29bd8a){logger[_0xa96f('0x5')](_0x29bd8a);};exports[_0xa96f('0x6')]=function(_0xedd6c8){logger[_0xa96f('0x6')](JSON[_0xa96f('0x7')](_0xedd6c8));};exports[_0xa96f('0x8')]=function(_0x2f36b5){logger[_0xa96f('0x8')](_0x2f36b5[_0xa96f('0x9')]);};exports[_0xa96f('0xa')]=function(_0x5ecb2d,_0x3715d5){return client[_0xa96f('0xa')](_0x5ecb2d,{'body':_0x3715d5})['then'](function(_0x501103){logger[_0xa96f('0x6')](JSON['stringify'](_0x501103));})[_0xa96f('0xb')](function(_0x38bd4d){logger[_0xa96f('0x8')](_0x38bd4d[_0xa96f('0x9')]);});};function getUser(_0x300a48){return client[_0xa96f('0xa')](_0xa96f('0xc'),{'options':{'raw':!![],'attributes':['id',_0xa96f('0xd'),_0xa96f('0xe'),_0xa96f('0xf')],'where':_0x300a48,'limit':0x1}})[_0xa96f('0x10')](function(_0x59026d){logger['info']('GETUSER|'+JSON['stringify'](_0x300a48)+'|'+(_0x59026d[_0xa96f('0x11')][_0xa96f('0x12')]?_0xa96f('0x13'):'NOTFOUND'));return _0x59026d[_0xa96f('0x11')][_0xa96f('0x12')]?_0x59026d['result'][0x0]:null;});}exports[_0xa96f('0x14')]=function(_0x41d2fb){return new BPromise(function(_0x32e08d,_0x34e6f9){if(_0x41d2fb){return getUser({'internal':_0x41d2fb})['then'](function(_0x410468){return _0x32e08d(_0x410468);})['catch'](function(_0x4a4464){logger[_0xa96f('0x8')](_0x4a4464['stack']);return _0x32e08d(null);});}else{return _0x32e08d(null);}});};exports['getUserByInterface']=function(_0x5c1ab9){return new BPromise(function(_0x5122f7,_0x294c2e){if(_0x5c1ab9){return getUser({'interface':_0x5c1ab9})['then'](function(_0x504afe){return _0x5122f7(_0x504afe);})[_0xa96f('0xb')](function(_0x3d38a4){logger[_0xa96f('0x8')](_0x3d38a4['stack']);return _0x5122f7(null);});}else{return _0x5122f7(null);}});};exports[_0xa96f('0x15')]=function(_0x3f70a4){return new BPromise(function(_0x2e707b,_0x3bdcae){if(_0x3f70a4){return getUser({'name':_0x3f70a4})[_0xa96f('0x10')](function(_0x4733bd){return _0x2e707b(_0x4733bd);})['catch'](function(_0x3fdfcf){logger[_0xa96f('0x8')](_0x3fdfcf['stack']);return _0x2e707b(null);});}else{return _0x2e707b(null);}});};exports[_0xa96f('0x16')]=function(_0x2187c7){return new BPromise(function(_0x23a16e,_0x4a3daa){if(_0x2187c7){return client[_0xa96f('0xa')](_0xa96f('0x17'),{'options':{'raw':!![],'attributes':['id',_0xa96f('0xe'),_0xa96f('0x18'),_0xa96f('0x19'),_0xa96f('0x1a')],'where':{'name':_0x2187c7},'limit':0x1}})['then'](function(_0x57c0fa){logger[_0xa96f('0x5')](_0xa96f('0x1b')+_0x2187c7+'|'+(_0x57c0fa[_0xa96f('0x11')][_0xa96f('0x12')]?_0xa96f('0x13'):_0xa96f('0x1c')));return _0x23a16e(_0x57c0fa[_0xa96f('0x11')]['length']?_0x57c0fa[_0xa96f('0x11')][0x0]:null);})[_0xa96f('0xb')](function(_0x4f941a){logger[_0xa96f('0x8')](_0x4f941a['stack']);return _0x23a16e(null);});}else{return _0x23a16e(null);}});};exports[_0xa96f('0x1d')]=function(_0x18ffa7,_0x272dc2){return moment(_0x18ffa7)['add'](_0x272dc2,_0xa96f('0x1e'))[_0xa96f('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xa96f('0x20')]=function(_0x1917c0,_0x233a69){return moment(_0x1917c0)[_0xa96f('0x21')](_0x233a69,_0xa96f('0x1e'))[_0xa96f('0x1f')](_0xa96f('0x22'));};exports['diffTime']=function(_0x1c9ef8,_0x3b3995){return moment(_0x1c9ef8)[_0xa96f('0x23')](moment(_0x3b3995),_0xa96f('0x1e'));};exports[_0xa96f('0x24')]=function(_0x431e9f,_0x34b709){return parseInt(_0x431e9f,0xa)+parseInt(_0x34b709,0xa);};exports['now']=function(){return moment()[_0xa96f('0x1f')](_0xa96f('0x22'));};exports[_0xa96f('0x25')]=function(_0x24ea1d,_0x5b22e7){if(_0x5b22e7){return moment(_0x24ea1d)[_0xa96f('0x25')](_0x5b22e7);}else{return!![];}};exports[_0xa96f('0x26')]=function(_0x55255b,_0xf9bab4){if(_0xf9bab4){return moment(_0x55255b)[_0xa96f('0x26')](_0xf9bab4);}else if(_0x55255b){return!![];}else{return![];}}; \ No newline at end of file